Compare commits

...
Author SHA1 Message Date
Matej Bačo 5b16d56b85 Finish fixing phpstan errors 2024-09-27 16:18:40 +00:00
Matej Bačo 562201095a Add PHP Stan at level 1 2024-09-27 15:15:44 +00:00
Steven NguyenandGitHub cfc36a9f47 Merge pull request #8617 from appwrite/docs-fix-endpoints
Sentence casing endpoint API reference
2024-09-25 15:31:30 -07:00
Steven NguyenandGitHub 52e5947822 Merge branch 'main' into docs-fix-endpoints 2024-09-25 14:05:59 -07:00
Torsten DittmannandGitHub fdd39a29c3 Merge pull request #8707 from appwrite/feat-make-create-execution-async-loose
feat: make create execution async loose
2024-09-25 12:12:02 +02:00
bff846480a Update app/controllers/api/functions.php
Co-authored-by: Matej Bačo <matejbacocom@gmail.com>
2024-09-25 10:01:12 +01:00
loks0n 711dc7bd08 feat: add logic 2024-09-25 09:59:51 +01:00
loks0n df76c7c268 Merge branch 'main' of https://github.com/appwrite/appwrite into feat-make-create-execution-async-loose 2024-09-25 09:42:12 +01:00
Luke B. SilverandGitHub b52c9648f1 Merge branch '1.6.x' into feat-make-create-execution-async-loose 2024-09-25 09:35:55 +01:00
loks0n 8ae99cb373 feat: make create execution async loose 2024-09-20 20:00:59 +01:00
Christy JacobandGitHub 21a406830a Merge pull request #8705 from appwrite/fix-schedule-base
fix: typo in scheduler base
2024-09-20 20:42:41 +04:00
Binyamin Yawitz 5ffca0f6fa fix: typo in scheduler base 2024-09-20 12:37:45 -04:00
Christy JacobandGitHub 9f7bf5a9f7 Merge pull request #8704 from appwrite/revert-7975-feat-eldad4-coroutines
Revert "Feat eldad4 coroutines"
2024-09-20 20:30:39 +04:00
Binyamin YawitzandGitHub 5512340cdd Revert "Feat eldad4 coroutines" 2024-09-20 12:30:05 -04:00
Christy JacobandGitHub f94f7763c8 Merge pull request #8703 from appwrite/revert-8691-fix-schedule-base
Revert "Fix typo in scheduler base"
2024-09-20 20:29:46 +04:00
Binyamin YawitzandGitHub d2aaa99076 Revert "Fix typo in scheduler base" 2024-09-20 12:26:17 -04:00
Christy JacobandGitHub ab19f1323e Merge pull request #8702 from appwrite/revert-8694-fix-auth-injection
Revert "Fix auth injection"
2024-09-20 20:25:40 +04:00
Binyamin YawitzandGitHub 904e4c8650 Revert "Fix auth injection" 2024-09-20 12:24:12 -04:00
Christy JacobandGitHub 778edf1ac2 Merge pull request #8694 from appwrite/fix-auth-injection
Fix auth injection
2024-09-20 02:33:16 +04:00
Binyamin Yawitz 24eef9accf fix: injection name 2024-09-19 18:28:24 -04:00
Christy JacobandGitHub 24ecdd71b1 Merge pull request #8691 from appwrite/fix-schedule-base
Fix typo in scheduler base
2024-09-19 22:25:52 +04:00
Binyamin Yawitz 0702d7ec9c chore: merge 2024-09-19 14:25:05 -04:00
Christy JacobandGitHub 193f94e5e1 Merge pull request #7975 from appwrite/feat-eldad4-coroutines
Feat eldad4 coroutines
2024-09-19 22:16:50 +04:00
Binyamin Yawitz 48d4d873de Merge branch '1.6.x' into feat-eldad4-coroutines 2024-09-19 13:50:27 -04:00
Binyamin Yawitz fe7f39d7a5 fix: reviews 2024-09-19 13:48:15 -04:00
fogelito 2517605cd1 Add this 2024-09-19 18:45:00 +03:00
Binyamin Yawitz 1581a8c654 chore: merge 2024-09-18 09:28:55 -04:00
Binyamin Yawitz de95bf677e fix: removing unneeded coroutine 2024-09-16 15:05:20 -04:00
Torsten DittmannandBinyamin Yawitz 7d58879373 fix: architecture agnostic runtimes in cli 2024-09-16 11:18:57 -04:00
Binyamin Yawitz e246005c51 chore: merge 2024-09-16 11:17:40 -04:00
Binyamin Yawitz 8bc123848f chore: packages update 2024-09-10 11:46:58 +02:00
Binyamin Yawitz f8c26e0f0a chore: merge 2024-09-10 11:12:16 +02:00
Binyamin Yawitz 3571260a2b chore: packages update 2024-09-10 11:06:02 +02:00
Binyamin Yawitz 3ca7672726 chore: merge 2024-09-09 17:59:38 +02:00
Binyamin Yawitz 1861ae3f68 fix: mock phone tests 2024-09-09 17:48:26 +02:00
Binyamin Yawitz 828928b609 chore: packages update 2024-09-09 15:03:49 +02:00
Binyamin Yawitz ef1380bf61 chore: merge 2024-09-09 14:52:47 +02:00
Binyamin Yawitz b390485dd9 fix: coroutine access in schedulers 2024-09-06 15:52:20 -04:00
Binyamin Yawitz b200e66bd1 fix: adding getConsoleDB injection 2024-09-06 15:52:04 -04:00
Binyamin Yawitz d0cc9c8a13 fix: expanding exception classes & conditioning experiment logger 2024-09-05 18:44:06 -04:00
Binyamin Yawitz 5622d1fd89 fix: adjusting to cr 2024-09-05 18:22:28 -04:00
Binyamin Yawitz 0d41b084ea chore: formatting and packages updates 2024-09-05 18:17:16 -04:00
Binyamin Yawitz 48264673da fix: adding experimental logger 2024-09-05 18:14:06 -04:00
Binyamin Yawitz 9e525366cb Merge branch '1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	app/controllers/api/functions.php
#	app/init.php
#	composer.lock
#	src/Appwrite/Specification/Format/Swagger2.php
2024-09-05 18:09:16 -04:00
Binyamin Yawitz 557eefe2c4 review: addressing 2024-09-05 18:06:41 -04:00
Binyamin Yawitz 439e42e1ab review: addressing 2024-09-05 14:49:37 -04:00
Binyamin Yawitz 8e145a9519 refactor: global to registry 2024-09-05 14:03:59 -04:00
Binyamin Yawitz 0ecc61fe9e refactor: import instead of FQDN 2024-09-05 13:26:26 -04:00
Binyamin Yawitz 41bffa0165 refactor: small change 2024-09-05 13:24:54 -04:00
Binyamin Yawitz fbb23b227b refactor: global to registry 2024-09-05 13:20:44 -04:00
Binyamin Yawitz 5d70884e6c chore: cleaning 2024-09-05 13:11:39 -04:00
Binyamin Yawitz 3af2ea0d4c chore: updating packages 2024-09-05 13:04:42 -04:00
Binyamin Yawitz 946bf20dd7 chore: update packages to RC 2024-09-04 20:48:10 -04:00
Binyamin Yawitz 5ae124c54c chore: update 2024-09-04 17:33:19 -04:00
Binyamin Yawitz f3ab0d2dca fix: latest vcs 2024-09-04 17:30:28 -04:00
Binyamin Yawitz 74a8c7da12 fix: fixes 2024-09-04 16:41:45 -04:00
Binyamin Yawitz ec4af20d09 chore: packages update 2024-09-04 15:13:49 -04:00
Binyamin Yawitz feb775d2c4 chore: merge, lint, stan 2024-09-04 14:52:01 -04:00
Binyamin Yawitz cedf3cf28d chore: format 2024-09-03 19:32:30 -04:00
Binyamin Yawitz 686b5439a2 chore: merge 2024-09-03 19:22:53 -04:00
Binyamin Yawitz 7d6eac4ddb Merge branch '1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	app/cli.php
#	app/controllers/api/account.php
#	app/controllers/api/functions.php
#	app/controllers/api/projects.php
#	app/controllers/general.php
#	app/controllers/shared/api.php
#	app/http.php
#	app/init.php
#	app/realtime.php
#	app/worker.php
#	composer.json
#	composer.lock
#	src/Appwrite/Migration/Migration.php
#	src/Appwrite/Platform/Tasks/Migrate.php
#	src/Appwrite/Platform/Tasks/ScheduleExecutions.php
#	src/Appwrite/Platform/Workers/Builds.php
#	src/Appwrite/Platform/Workers/Deletes.php
#	src/Appwrite/Specification/Format/Swagger2.php
#	src/Appwrite/Utopia/Response.php
2024-09-03 19:06:48 -04:00
Richard Choi 08b539ba05 change API reference endpoints to sentence case 2024-09-03 16:32:11 +00:00
Richard Choi 4e780c0f75 Change API reference endpoints to sentence casing 2024-09-03 16:22:30 +00:00
Binyamin Yawitz 579aa5bd1a fixing: Adding missing models from merge 2024-08-07 14:50:06 -04:00
Binyamin Yawitz d2b8d3ae7a chore: finishing merge 2024-08-07 14:24:52 -04:00
Binyamin Yawitz e672a0ebe2 Merge branch 'refs/heads/1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	src/Appwrite/Auth/Validator/MockNumber.php
2024-08-07 14:01:46 -04:00
Binyamin Yawitz fc95877177 chore: stan 2024-08-06 15:20:45 -04:00
Binyamin Yawitz 6475f29d45 chore: lint 2024-08-06 15:12:21 -04:00
Binyamin Yawitz 7a1e3ce4d9 chore: merge 2024-08-06 15:05:24 -04:00
Binyamin Yawitz 90acd79345 chore: Adjusting init to match latest 2024-08-06 15:04:59 -04:00
Binyamin Yawitz 9ed43ebbc2 Merge branch 'refs/heads/1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	app/controllers/api/functions.php
#	app/controllers/general.php
#	app/init.php
#	composer.lock
#	dev/xdebug.ini
#	src/Appwrite/Utopia/Response.php
2024-08-06 14:57:05 -04:00
Binyamin Yawitz 19918843a4 test: 2024-08-01 15:38:18 -04:00
Binyamin Yawitz ff1d4219e3 refactor: Exporting global 2024-07-29 15:15:57 -04:00
Binyamin Yawitz b884059ecd refactor: Making sure database names remains the same as previous versions 2024-07-29 12:29:21 -04:00
Binyamin Yawitz 613c3b41f8 fix: Redis with null password 2024-07-26 12:40:31 -04:00
Binyamin Yawitz 6619870847 fix: Load only when needed 2024-07-26 11:19:54 -04:00
Binyamin Yawitz 2947d22392 chore: Updating workers 2024-07-22 14:45:39 -04:00
Binyamin Yawitz 916f58cd9d fixes: Logger and Abuse timelimit 2024-07-19 14:19:30 -04:00
Binyamin Yawitz 35910a6dbe chore: updating packages 2024-07-19 13:50:34 -04:00
Binyamin Yawitz 7d14a8b742 feat: Supporting old project database name 2024-07-19 13:49:10 -04:00
Binyamin Yawitz 05862e8bc0 chore: lint 2024-07-19 10:02:32 -04:00
Binyamin Yawitz cfdf5ff5cb chore: Merge 2024-07-19 10:00:06 -04:00
Binyamin Yawitz f7a28bcf71 Merge branch 'refs/heads/1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	app/init.php
#	src/Appwrite/Migration/Migration.php
2024-07-19 09:59:08 -04:00
Binyamin Yawitz 87e0f2539c fix: tests 2024-07-18 15:31:24 -04:00
Binyamin Yawitz f4e2736475 fix: Adding restart to the scheduler 2024-07-18 13:53:31 -04:00
Binyamin Yawitz b9596b780b chore: lint 2024-07-18 12:18:43 -04:00
Binyamin Yawitz 5ad0214a1e chore: 1.6 -> current 2024-07-18 12:16:24 -04:00
Binyamin Yawitz 349c4f706f Merge branch 'refs/heads/1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	app/controllers/web/console.php
#	app/http.php
2024-07-18 11:54:01 -04:00
Binyamin Yawitz 850c17dde1 tests: Ensure stability 2024-07-18 11:51:09 -04:00
Binyamin Yawitz 0bdf75a4a0 chore: Update response models 2024-07-18 09:11:04 -04:00
Binyamin Yawitz b245aab9d8 fix: Adjusting to coroutine 2024-07-17 15:59:25 -04:00
Binyamin Yawitz c15d362865 chore: Updating composer 2024-07-17 15:50:15 -04:00
Binyamin Yawitz bbdd886a6c fix: Adjusting 2024-07-17 15:48:44 -04:00
Binyamin Yawitz 023e222029 fix: Adjusting 2024-07-17 15:48:38 -04:00
Binyamin Yawitz 8d66536e7f fix: Adjusting 2024-07-17 15:34:57 -04:00
Binyamin Yawitz d1af8cfbe0 feat: Extracting authentication cookie 2024-07-17 15:21:47 -04:00
Binyamin Yawitz 19119b573d chore: Merge and lint 2024-07-17 15:06:06 -04:00
Binyamin Yawitz 927dbc7e11 Merge branch 'refs/heads/1.6.x' into feat-eldad4-coroutines
# Conflicts:
#	app/console
#	app/controllers/api/account.php
#	app/controllers/api/functions.php
#	app/controllers/api/projects.php
#	app/controllers/api/users.php
#	app/controllers/api/vcs.php
#	app/controllers/general.php
#	app/controllers/mock.php
#	app/controllers/shared/api.php
#	app/init.php
#	composer.json
#	composer.lock
#	src/Appwrite/Platform/Tasks/Doctor.php
#	src/Appwrite/Platform/Tasks/ScheduleMessages.php
#	src/Appwrite/Platform/Workers/Builds.php
#	src/Appwrite/Utopia/Response.php
2024-07-17 14:31:13 -04:00
Binyamin Yawitz acef279091 refactor: headers to instance 2024-07-15 16:15:02 -04:00
Binyamin Yawitz b1e766d61a refactor: Response Models init 2024-07-15 13:26:32 -04:00
Binyamin Yawitz 6d22474af9 fix: Initializing response model 2024-07-15 13:26:18 -04:00
Binyamin Yawitz b86f1c0aa4 refactor: Auto load inline-classes 2024-07-15 12:52:18 -04:00
Binyamin Yawitz 55d4cd2aa5 refactor: response models to static 2024-07-15 10:34:59 -04:00
Binyamin Yawitz 9b94a4a1ed chore: improvements 2024-07-12 18:11:43 -04:00
Binyamin Yawitz 66b9467e6d rollback: Reverting to more stable server 2024-07-05 11:44:58 -04:00
Binyamin Yawitz a60000d631 fix: Small fix 2024-07-04 17:07:33 -04:00
Binyamin Yawitz 1217aee296 refactor: Connection pools 2024-07-04 15:04:36 -04:00
Binyamin Yawitz 664c3ad466 chore: Cleanup 2024-07-04 15:04:20 -04:00
Binyamin Yawitz ea13375109 chore: Merge tasks 2024-07-04 11:02:34 -04:00
Binyamin Yawitz a3682b72e1 Merge remote-tracking branch 'refs/remotes/origin/main' into feat-eldad4-coroutines
# Conflicts:
#	app/cli.php
#	app/console
#	app/controllers/api/projects.php
#	app/controllers/general.php
#	app/init.php
#	app/realtime.php
#	app/worker.php
#	composer.json
#	composer.lock
2024-07-03 17:03:24 -04:00
Binyamin Yawitz 92668fda0d feat: Moving to coroutine dedicated http server 2024-07-03 16:24:04 -04:00
Binyamin Yawitz a4f675c632 feat: Coroutine adjustments 2024-07-02 11:16:44 -04:00
Binyamin Yawitz 77b593dae5 feat: Coroutine adjustments 2024-07-01 14:25:32 -04:00
Binyamin Yawitz b05671b8b3 refactor: Rollback 2024-07-01 08:36:46 -04:00
Binyamin Yawitz 5bcb22cd4f test: Latest swoole 2024-06-28 15:44:52 -04:00
Binyamin Yawitz efb8af902e Merge branch 'refs/heads/main' into feat-eldad4-coroutines
# Conflicts:
#	src/Appwrite/Platform/Workers/Certificates.php
2024-06-28 15:08:15 -04:00
Binyamin Yawitz 6f62f915d9 feat: Adding Authentication injection for user id and secret 2024-06-28 14:33:13 -04:00
Binyamin Yawitz 034814c924 chore: Removing default function timeout 2024-06-25 09:38:33 -04:00
Binyamin Yawitz 78d321b33b chore: rearrange account.php methods 2024-06-24 15:52:22 -04:00
Binyamin Yawitz 97cd5e4934 chore: DI+CO improvements 2024-06-24 13:31:40 -04:00
Binyamin Yawitz 3ecd8ce189 chore: Commenting unused code 2024-06-24 13:31:24 -04:00
Binyamin Yawitz aa4bc1c776 feat: Adapting Migrate to DI 2024-06-24 13:31:01 -04:00
Binyamin Yawitz 4ea291705a feat: Adapting specs to DI 2024-06-24 13:30:51 -04:00
Binyamin Yawitz 4ef09b680f feat: GraphQL DI 2024-06-21 17:22:58 -04:00
Binyamin Yawitz ca0e44620a chore: merge 2024-06-21 15:26:58 -04:00
Binyamin Yawitz c7ba512db5 chore: merge 2024-06-21 15:23:07 -04:00
Binyamin Yawitz bc46ce30ab chore: merge 2024-06-20 17:26:40 -04:00
Binyamin Yawitz 6c26e2eb51 Merge branch 'refs/heads/main' into feat-eldad4-coroutines
# Conflicts:
#	app/cli.php
#	composer.json
#	composer.lock
2024-06-20 17:23:15 -04:00
Binyamin Yawitz 74ef1a4257 chore: GraphQL arrangement 2024-06-20 16:51:30 -04:00
Binyamin Yawitz 7d248f29f0 feat: Coroutine graphql wip 2024-06-11 18:08:40 -04:00
Binyamin Yawitz a2b8f74ae1 chore: Updating dependencies 2024-06-11 12:30:14 -04:00
Binyamin Yawitz 8e9dd17dfd feat: Refreshing GraphQL coroutine cache related resources 2024-06-11 12:29:19 -04:00
Binyamin Yawitz 7dccb21ffc lint 2024-06-10 15:14:06 -04:00
Binyamin Yawitz 8795d72146 test: Temp database workaround for old PHP 2024-06-10 15:09:01 -04:00
Binyamin Yawitz c14fc2a721 test: GraphQL wip 2024-06-10 15:06:42 -04:00
Binyamin Yawitz e75645334a test: GraphQL wip 2024-06-10 12:56:29 -04:00
Binyamin Yawitz 300c0f0ee2 test: Messaging, refactor to use own auth 2024-06-10 07:49:12 -04:00
Binyamin Yawitz c1ded34c12 test: Functions. reverting time and adding restart policy 2024-06-10 07:16:07 -04:00
Binyamin Yawitz dc47007566 test: Realtime tests 2024-06-07 15:36:45 -04:00
Binyamin Yawitz 38cabc8afc test: Databases tests 2024-06-07 12:54:07 -04:00
Binyamin Yawitz 321f621132 test: Functions tests 2024-06-07 12:13:12 -04:00
Binyamin Yawitz 5ac5baca38 fixes: General refactors 2024-06-06 21:06:52 -04:00
Binyamin Yawitz d0a55e266c lint: Linting 2024-06-06 20:54:51 -04:00
Binyamin Yawitz ea5d0fbaf2 refactor: Removing redundant injections 2024-06-06 20:54:39 -04:00
Binyamin Yawitz 269b9b27c2 feat: Adding cache 2024-06-06 20:54:08 -04:00
Binyamin Yawitz 757cf24d4d feat: Adjusting health API to new pools 2024-06-06 20:52:51 -04:00
Binyamin Yawitz ba629e94ef feat: Adjusting Doctor to new pools 2024-06-06 20:52:30 -04:00
Binyamin Yawitz 0bd9426aa7 feat: Adding plans, updating server and exception class 2024-06-06 13:13:39 -04:00
Binyamin Yawitz 1b80ec289b test: Adjusting unit testing to new structure 2024-06-06 10:12:05 -04:00
Binyamin Yawitz cf30941514 fix: compose file 2024-06-05 20:46:49 -04:00
Binyamin Yawitz 6b0892a495 refactor: Adjusting to merge and some code cleanups 2024-06-05 20:41:23 -04:00
Binyamin Yawitz b5a241db8d merge: Main into Coroutines 2024-06-05 18:38:39 -04:00
Binyamin Yawitz 07582ecc5f fix: Changing auth function to instance 2024-06-05 13:38:02 -04:00
Binyamin Yawitz 6a7ee3df8a fix: realtime auth 2024-06-05 09:08:27 -04:00
Binyamin Yawitz 72d5e94c97 wip: coroutines 2024-06-04 16:56:28 -04:00
Binyamin Yawitz 1c9457b1ed cicd: removing logs 2024-06-04 15:47:55 -04:00
Binyamin Yawitz 85ccfd883e fix: Removing local compose values 2024-06-04 15:36:49 -04:00
Binyamin Yawitz 187ccc64de cicd: checking compose logs 2024-06-04 15:31:34 -04:00
Binyamin Yawitz 8ac7d0a160 fix: Removing local compose values 2024-06-04 15:31:20 -04:00
Binyamin Yawitz 3682da417a fix: reverting to run swoole 5.1.1 2024-06-04 15:23:29 -04:00
Binyamin Yawitz c411aa2342 fix: Realtime auth 2024-06-04 15:23:08 -04:00
Binyamin Yawitz d1c3e47392 refactor: CLI injections 2024-06-04 13:22:27 -04:00
Binyamin Yawitz f7d9efc18e feat: Adding DI to realtime 2024-06-04 13:12:10 -04:00
Binyamin Yawitz 0093ad7799 Revert "wip: Starting realtime"
This reverts commit 7dfc654121.
2024-06-04 11:57:16 -04:00
Binyamin Yawitz 7dfc654121 wip: Starting realtime 2024-06-03 15:24:39 -04:00
Binyamin Yawitz 0664c39533 fix: Typo 2024-06-03 14:11:31 -04:00
Binyamin Yawitz 6083d8b7a8 feat(tasks): Coroutine 2024-06-03 14:09:58 -04:00
Eldad Fux 90fd0ba392 Updated db lib 2024-05-09 21:50:34 +01:00
Eldad Fux 525383c725 Updates to realtime 2024-05-08 21:01:07 +01:00
Eldad Fux 0b7c795e2b Updated lock file 2024-05-08 19:33:51 +01:00
Eldad Fux 5cfe4db839 Updated console 2024-05-08 18:24:15 +01:00
Eldad Fux c53de9fb6b Merge branch 'main' of github.com:appwrite/appwrite into feat-eldad4-coroutines 2024-05-08 18:21:55 +01:00
Eldad Fux 90ef64c63e Fixed namespace 2024-05-08 18:16:43 +01:00
Eldad Fux 55fe725f4b Fixed format 2024-04-24 23:16:43 +02:00
Eldad Fux 9fc0342cf1 Updated injections 2024-04-23 13:30:20 +02:00
Eldad Fux beeb66e66d Fixed account tests 2024-04-23 00:17:07 +02:00
Eldad Fux 46ab7b1a36 Fixed functions test 2024-04-22 23:33:18 +02:00
Eldad Fux 69a43aa667 Fixed projects tests 2024-04-22 23:28:40 +02:00
Eldad Fux 7381ababb8 Merge remote-tracking branch 'refs/remotes/origin/feat-eldad4-coroutines' into feat-eldad4-coroutines 2024-04-22 23:02:59 +02:00
Eldad Fux d67df5feb1 Fixed formatting 2024-04-22 22:45:55 +02:00
Eldad A. FuxandGitHub 6c8b228b6c Merge branch 'main' into feat-eldad4-coroutines 2024-04-22 22:37:10 +02:00
Eldad Fux 86b46353ad Fixed for general tests 2024-04-22 22:35:38 +02:00
Eldad Fux 99994f6278 Fixed storage tests 2024-04-22 21:43:57 +02:00
Eldad Fux 09e9483d94 Changed autoloading order 2024-04-22 21:38:48 +02:00
Eldad Fux 351b9318d4 Fixed router, and options 2024-04-22 17:58:40 +02:00
Eldad Fux 6a67a1d48a Fixed execute to match new signature 2024-04-22 14:41:46 +02:00
Eldad Fux 19f8b13cfe Fixed formatting 2024-04-22 14:19:37 +02:00
Eldad Fux ab6744df3a Fixed webhooks tests 2024-04-22 14:12:09 +02:00
Eldad Fux 5d54f567cd Fixed client overwriting 2024-04-22 09:45:31 +02:00
Eldad Fux c413a6cab5 Updated database service 2024-04-22 09:01:48 +02:00
Eldad Fux 3b70ae4d9f Fixed formatting 2024-04-22 07:56:36 +02:00
Eldad Fux b97cf78d9d Enabled more controllers 2024-04-22 07:51:35 +02:00
Eldad Fux aff328c660 Fixed test 2024-04-22 07:51:24 +02:00
Eldad Fux 74dc9957f2 Fixed console test 2024-04-22 07:25:29 +02:00
Eldad Fux 479f20dabf Fixed some workers 2024-04-22 07:00:17 +02:00
Eldad Fux 6d6f22788d Eanble compression 2024-04-15 23:38:36 +02:00
Eldad A. FuxandGitHub 2e4c6eae96 Merge branch 'main' into feat-eldad2-coroutines 2024-04-15 22:14:27 +02:00
Eldad Fux 07a830e9a6 Work on the main worker 2024-04-15 22:03:07 +02:00
Eldad Fux 13eb3bccd0 Fixed users tests 2024-04-15 12:36:42 +02:00
Eldad Fux 87ca2dfb32 Applied fixes for tests 2024-04-15 07:29:32 +02:00
Eldad Fux 49a50b32a7 Test DB failure 2024-04-15 06:29:12 +02:00
Eldad Fux a5ba262c4c Fixed bootstrap file 2024-04-15 05:59:02 +02:00
Eldad Fux fd2410d2ae Fixed bootstrap 2024-04-14 22:42:31 +02:00
Eldad Fux 766b2ba13e Avatars tests are green! 2024-04-14 22:17:07 +02:00
Eldad Fux 6cade89369 New init structure 2024-04-14 11:22:53 +02:00
Eldad Fux 9e234b7600 updated server 2024-04-14 10:58:05 +02:00
Eldad Fux 08b3182ef3 WIP 2024-04-14 10:56:09 +02:00
Eldad Fux 211bcf8948 Removed proxy db 2024-04-09 21:02:02 +02:00
Eldad Fux bd57955168 Enabled coroutines 2024-04-03 13:43:20 +02:00
Eldad Fux a1db69b7e7 Fixed missing System namespace 2024-04-02 08:13:28 +02:00
Eldad Fux 378bb5fda3 Fixed server 2024-04-02 03:14:19 +02:00
Eldad Fux be7a6e55f8 Fixed whitespace 2024-04-02 03:02:06 +02:00
Eldad Fux 5ce3de4933 Merge remote-tracking branch 'origin/main' into feat-eldad2-coroutines 2024-04-02 02:13:15 +02:00
Eldad Fux b570368f10 Fixed auth error in users usage 2024-04-01 23:57:20 +02:00
Eldad Fux c73ef2c649 Fixed 451 status code 2024-04-01 23:46:00 +02:00
Eldad Fux 6ce8781af1 Fixed email escaping 2024-04-01 19:39:26 +02:00
Eldad Fux 713928cff3 Couroutines test
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to appwrite here: https://github.com/appwrite/appwrite/blob/master/CONTRIBUTING.md

Happy contributing!

-->

## What does this PR do?

(Provide a description of what this PR does and why it's needed.)

## Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

## Related PRs and Issues

- (Related PR or issue)

## Checklist

- [ ] Have you read the [Contributing Guidelines on issues](https://github.com/appwrite/appwrite/blob/master/CONTRIBUTING.md)?
- [ ] If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?
2024-04-01 18:40:35 +02:00
Matej Bačo 2a0a69f3ed Fix connections pool 2024-03-09 11:59:45 +01:00
Matej Bačo 4de95913a5 Disable debug 2024-03-08 19:12:53 +01:00
Matej Bačo 513bf7eaca Update .env 2024-03-08 15:10:26 +01:00
Matej Bačo d5f180db4f Add debugging 2024-03-08 15:10:20 +01:00
Matej Bačo db1674811f Finish fixing code QL warnings 2024-03-08 13:57:20 +01:00
Matej Bačo 005a239932 Auth fixes 2024-03-07 18:24:01 +01:00
Matej Bačo efeb898be1 Import fixes 2024-03-07 15:29:42 +01:00
Matej Bačo 5a7c43ab32 Introduce code analysis 2024-03-07 10:59:08 +01:00
Matej Bačo 8a8638a817 Formatting fix 2024-03-07 10:20:24 +01:00
Matej Bačo ee065bc64c Merge branch '1.5.x' into feat-database-proxy 2024-03-07 10:18:49 +01:00
Matej Bačo 27e995eb53 Reomve leftpover 2024-03-06 22:31:23 +01:00
Matej Bačo 1b65c5fbc9 linter fix 2024-03-06 22:26:14 +01:00
Matej Bačo 4fa9ccd9e4 upgrade libs 2024-03-06 22:25:43 +01:00
Matej Bačo f83d6e61ae PR review changes 2024-03-06 17:01:43 +01:00
Matej Bačo 882d8e5a88 Fix database tests 2024-03-06 16:19:23 +01:00
Matej Bačo a9731cd5bc Fix account tests 2024-03-06 12:38:51 +01:00
Matej Bačo e807a5d20a Upgrade DB proxy 2024-03-05 13:41:26 +00:00
Matej Bačo d8996b47b5 Implement DB proxy 2024-03-05 11:37:47 +01:00
52 changed files with 321 additions and 214 deletions
+16
View File
@@ -0,0 +1,16 @@
name: "PHP Stan - CodeQL"
on: [pull_request]
jobs:
lint:
name: CodeQL
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Run CodeQL
run: |
docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer check"
+5
View File
@@ -23,6 +23,8 @@ use Utopia\Queue\Connection;
use Utopia\Registry\Registry;
use Utopia\System\System;
/** @var Utopia\Registry\Registry $register */
// overwriting runtimes to be architectur agnostic for CLI
Config::setParam('runtimes', (new Runtimes('v4'))->getAll(supported: false));
@@ -57,6 +59,7 @@ CLI::setResource('dbForConsole', function ($pools, $cache) {
$maxAttempts = 5;
$attempts = 0;
$ready = false;
$dbForConsole = null;
do {
$attempts++;
@@ -90,6 +93,8 @@ CLI::setResource('dbForConsole', function ($pools, $cache) {
}
} while ($attempts < $maxAttempts && !$ready);
/** @var Utopia\Database\Database $dbForConsole */
if (!$ready) {
throw new Exception("Console is not ready yet. Please try again later.");
}
+22 -14
View File
@@ -144,7 +144,7 @@ function sendSessionAlert(Locale $locale, Document $user, Document $project, Doc
->trigger();
};
// @phpstan-ignore class.notFound
$createSession = function (string $userId, string $secret, Request $request, Response $response, Document $user, Database $dbForProject, Document $project, Locale $locale, Reader $geodb, Event $queueForEvents, Mail $queueForMails) {
$roles = Authorization::getRoles();
$isPrivilegedUser = Auth::isPrivilegedUser($roles);
@@ -581,13 +581,14 @@ App::delete('/v1/account/sessions')
->setDocument($session)
->trigger();
}
$queueForEvents
->setParam('userId', $user->getId())
->setParam('sessionId', $session->getId()); // TODO: Trigger for all sessions
}
$dbForProject->purgeCachedDocument('users', $user->getId());
$queueForEvents
->setParam('userId', $user->getId())
->setParam('sessionId', $session->getId());
$response->noContent();
});
@@ -825,6 +826,7 @@ App::post('/v1/account/sessions/email')
->inject('queueForEvents')
->inject('queueForMails')
->inject('hooks')
// @phpstan-ignore class.notFound
->action(function (string $email, string $password, Request $request, Response $response, Document $user, Database $dbForProject, Document $project, Locale $locale, Reader $geodb, Event $queueForEvents, Mail $queueForMails, Hooks $hooks) {
$email = \strtolower($email);
$protocol = $request->getProtocol();
@@ -955,6 +957,7 @@ App::post('/v1/account/sessions/anonymous')
->inject('dbForProject')
->inject('geodb')
->inject('queueForEvents')
// @phpstan-ignore class.notFound
->action(function (Request $request, Response $response, Locale $locale, Document $user, Document $project, Database $dbForProject, Reader $geodb, Event $queueForEvents) {
$protocol = $request->getProtocol();
$roles = Authorization::getRoles();
@@ -1252,6 +1255,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
->inject('dbForProject')
->inject('geodb')
->inject('queueForEvents')
// @phpstan-ignore class.notFound
->action(function (string $provider, string $code, string $state, string $error, string $error_description, Request $request, Response $response, Document $project, Document $user, Database $dbForProject, Reader $geodb, Event $queueForEvents) use ($oauthDefaultSuccess) {
$protocol = $request->getProtocol();
$callback = $protocol . '://' . $request->getHostname() . '/v1/account/sessions/oauth2/callback/' . $provider . '/' . $project->getId();
@@ -1389,6 +1393,7 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
}
$sessions = $user->getAttribute('sessions', []);
$session = null;
$current = Auth::sessionVerify($sessions, Auth::$secret);
if ($current) { // Delete current session of new one.
@@ -1658,6 +1663,8 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect')
->addCookie(Auth::$cookieName, Auth::encodeSession($user->getId(), $secret), (new \DateTime($expire))->getTimestamp(), '/', Config::getParam('cookieDomain'), ('https' == $protocol), true, Config::getParam('cookieSamesite'));
}
/** @var Utopia\Database\Document $session */
if (isset($sessionUpgrade) && $sessionUpgrade) {
foreach ($user->getAttribute('targets', []) as $target) {
if ($target->getAttribute('providerType') !== MESSAGE_TYPE_PUSH) {
@@ -2554,6 +2561,7 @@ App::get('/v1/account/logs')
->inject('locale')
->inject('geodb')
->inject('dbForProject')
// @phpstan-ignore class.notFound
->action(function (array $queries, Response $response, Document $user, Locale $locale, Reader $geodb, Database $dbForProject) {
try {
@@ -3683,7 +3691,7 @@ App::patch('/v1/account/mfa')
});
App::get('/v1/account/mfa/factors')
->desc('List Factors')
->desc('List factors')
->groups(['api', 'account', 'mfa'])
->label('scope', 'account')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
@@ -3715,7 +3723,7 @@ App::get('/v1/account/mfa/factors')
});
App::post('/v1/account/mfa/authenticators/:type')
->desc('Create Authenticator')
->desc('Create authenticator')
->groups(['api', 'account'])
->label('event', 'users.[userId].update.mfa')
->label('scope', 'account')
@@ -3787,7 +3795,7 @@ App::post('/v1/account/mfa/authenticators/:type')
});
App::put('/v1/account/mfa/authenticators/:type')
->desc('Verify Authenticator')
->desc('Verify authenticator')
->groups(['api', 'account'])
->label('event', 'users.[userId].update.mfa')
->label('scope', 'account')
@@ -3852,7 +3860,7 @@ App::put('/v1/account/mfa/authenticators/:type')
});
App::post('/v1/account/mfa/recovery-codes')
->desc('Create MFA Recovery Codes')
->desc('Create MFA recovery codes')
->groups(['api', 'account'])
->label('event', 'users.[userId].update.mfa')
->label('scope', 'account')
@@ -3894,7 +3902,7 @@ App::post('/v1/account/mfa/recovery-codes')
});
App::patch('/v1/account/mfa/recovery-codes')
->desc('Regenerate MFA Recovery Codes')
->desc('Regenerate MFA recovery codes')
->groups(['api', 'account', 'mfaProtected'])
->label('event', 'users.[userId].update.mfa')
->label('scope', 'account')
@@ -3935,7 +3943,7 @@ App::patch('/v1/account/mfa/recovery-codes')
});
App::get('/v1/account/mfa/recovery-codes')
->desc('Get MFA Recovery Codes')
->desc('Get MFA recovery codes')
->groups(['api', 'account', 'mfaProtected'])
->label('scope', 'account')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
@@ -3965,7 +3973,7 @@ App::get('/v1/account/mfa/recovery-codes')
});
App::delete('/v1/account/mfa/authenticators/:type')
->desc('Delete Authenticator')
->desc('Delete authenticator')
->groups(['api', 'account', 'mfaProtected'])
->label('event', 'users.[userId].delete.mfa')
->label('scope', 'account')
@@ -4003,7 +4011,7 @@ App::delete('/v1/account/mfa/authenticators/:type')
});
App::post('/v1/account/mfa/challenge')
->desc('Create MFA Challenge')
->desc('Create MFA challenge')
->groups(['api', 'account', 'mfa'])
->label('scope', 'account')
->label('event', 'users.[userId].challenges.[challengeId].create')
@@ -4191,7 +4199,7 @@ App::post('/v1/account/mfa/challenge')
});
App::put('/v1/account/mfa/challenge')
->desc('Create MFA Challenge (confirmation)')
->desc('Create MFA challenge (confirmation)')
->groups(['api', 'account', 'mfa'])
->label('scope', 'account')
->label('event', 'users.[userId].sessions.[sessionId].create')
@@ -4452,7 +4460,7 @@ App::delete('/v1/account/targets/:targetId/push')
$response->noContent();
});
App::get('/v1/account/identities')
->desc('List Identities')
->desc('List identities')
->groups(['api', 'account'])
->label('scope', 'account')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_JWT])
+3 -6
View File
@@ -52,7 +52,6 @@ $avatarCallback = function (string $type, string $code, int $width, int $height,
$image = new Image(\file_get_contents($path));
$image->crop((int) $width, (int) $height);
$output = (empty($output)) ? $type : $output;
$data = $image->output($output, $quality);
$response
->addHeader('Expires', \date('D, d M Y H:i:s', \time() + 60 * 60 * 24 * 30) . ' GMT')
@@ -271,7 +270,6 @@ App::get('/v1/avatars/image')
}
$image->crop((int) $width, (int) $height);
$output = (empty($output)) ? $type : $output;
$data = $image->output($output, $quality);
$response
@@ -416,7 +414,6 @@ App::get('/v1/avatars/favicon')
$image = new Image($data);
$image->crop((int) $width, (int) $height);
$output = (empty($output)) ? $type : $output;
$data = $image->output($output, $quality);
$response
@@ -550,7 +547,7 @@ App::get('/v1/avatars/initials')
});
App::get('/v1/cards/cloud')
->desc('Get Front Of Cloud Card')
->desc('Get front Of Cloud Card')
->groups(['api', 'avatars'])
->label('scope', 'avatars.read')
->label('cache', true)
@@ -757,7 +754,7 @@ App::get('/v1/cards/cloud')
});
App::get('/v1/cards/cloud-back')
->desc('Get Back Of Cloud Card')
->desc('Get back Of Cloud Card')
->groups(['api', 'avatars'])
->label('scope', 'avatars.read')
->label('cache', true)
@@ -835,7 +832,7 @@ App::get('/v1/cards/cloud-back')
});
App::get('/v1/cards/cloud-og')
->desc('Get OG Image From Cloud Card')
->desc('Get OG image From Cloud Card')
->groups(['api', 'avatars'])
->label('scope', 'avatars.read')
->label('cache', true)
+1 -1
View File
@@ -57,7 +57,7 @@ App::get('/v1/console/variables')
});
App::post('/v1/console/assistant')
->desc('Ask Query')
->desc('Ask query')
->groups(['api', 'assistant'])
->label('scope', 'assistant.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
+4 -3
View File
@@ -381,7 +381,7 @@ function updateAttribute(
size: $size,
required: $required,
default: $default,
formatOptions: $options ?? null,
formatOptions: $options,
newKey: $newKey ?? null
);
} catch (TruncateException) {
@@ -603,6 +603,7 @@ App::get('/v1/databases/:databaseId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $databaseId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$database = $dbForProject->getDocument('databases', $databaseId);
@@ -942,6 +943,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $databaseId, string $collectionId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId));
@@ -1067,8 +1069,6 @@ App::put('/v1/databases/:databaseId/collections/:collectionId')
// Map aggregate permissions into the multiple permissions they represent.
$permissions = Permission::aggregate($permissions);
$enabled ??= $collection->getAttribute('enabled', true);
$collection = $dbForProject->updateDocument('database_' . $database->getInternalId(), $collectionId, $collection
->setAttribute('name', $name)
->setAttribute('$permissions', $permissions)
@@ -3296,6 +3296,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents/:documen
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $databaseId, string $collectionId, string $documentId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$database = Authorization::skip(fn () => $dbForProject->getDocument('databases', $databaseId));
+6 -6
View File
@@ -817,8 +817,6 @@ App::put('/v1/functions/:functionId')
$runtime = $function->getAttribute('runtime');
}
$enabled ??= $function->getAttribute('enabled', true);
$repositoryId = $function->getAttribute('repositoryId', '');
$repositoryInternalId = $function->getAttribute('repositoryInternalId', '');
@@ -1718,7 +1716,7 @@ App::post('/v1/functions/:functionId/executions')
->label('sdk.request.type', Response::CONTENT_TYPE_JSON)
->param('functionId', '', new UID(), 'Function ID.')
->param('body', '', new Payload(10485760, 0), 'HTTP body of execution. Default value is empty string.', true)
->param('async', false, new Boolean(), 'Execute code in the background. Default value is false.', true)
->param('async', false, new Boolean(true), 'Execute code in the background. Default value is false.', true)
->param('path', '/', new Text(2048), 'HTTP path of execution. Path can include query params. Default value is /', true)
->param('method', 'POST', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], true), 'HTTP method of execution. Default value is GET.', true)
->param('headers', [], new AnyOf([new Assoc(), new Text(65535)], AnyOf::TYPE_MIXED), 'HTTP headers of execution. Defaults to empty.', true)
@@ -1733,7 +1731,9 @@ App::post('/v1/functions/:functionId/executions')
->inject('queueForUsage')
->inject('queueForFunctions')
->inject('geodb')
->action(function (string $functionId, string $body, bool $async, string $path, string $method, mixed $headers, ?string $scheduledAt, Response $response, Request $request, Document $project, Database $dbForProject, Database $dbForConsole, Document $user, Event $queueForEvents, Usage $queueForUsage, Func $queueForFunctions, Reader $geodb) {
// @phpstan-ignore class.notFound
->action(function (string $functionId, string $body, mixed $async, string $path, string $method, mixed $headers, ?string $scheduledAt, Response $response, Request $request, Document $project, Database $dbForProject, Database $dbForConsole, Document $user, Event $queueForEvents, Usage $queueForUsage, Func $queueForFunctions, Reader $geodb) {
$async = \strval($async) === 'true' || \strval($async) === '1';
if (!$async && !is_null($scheduledAt)) {
throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Scheduled executions must run asynchronously. Set scheduledAt to a future date, or set async to true.');
@@ -1839,7 +1839,7 @@ App::post('/v1/functions/:functionId/executions')
$headers['x-appwrite-key'] = API_KEY_DYNAMIC . '_' . $apiKey;
$headers['x-appwrite-trigger'] = 'http';
$headers['x-appwrite-user-id'] = $user->getId() ?? '';
$headers['x-appwrite-user-jwt'] = $jwt ?? '';
$headers['x-appwrite-user-jwt'] = $jwt;
$headers['x-appwrite-country-code'] = '';
$headers['x-appwrite-continent-code'] = '';
$headers['x-appwrite-continent-eu'] = 'false';
@@ -1956,7 +1956,7 @@ App::post('/v1/functions/:functionId/executions')
if ($version === 'v2') {
$vars = \array_merge($vars, [
'APPWRITE_FUNCTION_TRIGGER' => $headers['x-appwrite-trigger'] ?? '',
'APPWRITE_FUNCTION_DATA' => $body ?? '',
'APPWRITE_FUNCTION_DATA' => $body,
'APPWRITE_FUNCTION_USER_ID' => $headers['x-appwrite-user-id'] ?? '',
'APPWRITE_FUNCTION_JWT' => $headers['x-appwrite-user-jwt'] ?? ''
]);
+6 -6
View File
@@ -134,11 +134,11 @@ App::get('/v1/health/cache')
foreach ($configs as $key => $config) {
foreach ($config as $database) {
$checkStart = \microtime(true);
try {
$adapter = $pools->get($database)->pop()->getResource();
$checkStart = \microtime(true);
if ($adapter->ping()) {
$output[] = new Document([
'name' => $key . " ($database)",
@@ -191,11 +191,11 @@ App::get('/v1/health/queue')
foreach ($configs as $key => $config) {
foreach ($config as $database) {
$checkStart = \microtime(true);
try {
$adapter = $pools->get($database)->pop()->getResource();
$checkStart = \microtime(true);
if ($adapter->ping()) {
$output[] = new Document([
'name' => $key . " ($database)",
@@ -248,11 +248,11 @@ App::get('/v1/health/pubsub')
foreach ($configs as $key => $config) {
foreach ($config as $database) {
$checkStart = \microtime(true);
try {
$adapter = $pools->get($database)->pop()->getResource();
$checkStart = \microtime(true);
if ($adapter->ping()) {
$output[] = new Document([
'name' => $key . " ($database)",
+3 -1
View File
@@ -25,6 +25,7 @@ App::get('/v1/locale')
->inject('response')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (Request $request, Response $response, Locale $locale, Reader $geodb) {
$eu = Config::getParam('locale-eu');
$currencies = Config::getParam('locale-currencies');
@@ -69,7 +70,7 @@ App::get('/v1/locale')
});
App::get('/v1/locale/codes')
->desc('List Locale Codes')
->desc('List locale codes')
->groups(['api', 'locale'])
->label('scope', 'locale.read')
->label('sdk.auth', [APP_AUTH_TYPE_SESSION, APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_JWT])
@@ -210,6 +211,7 @@ App::get('/v1/locale/continents')
->action(function (Response $response, Locale $locale) {
$list = Config::getParam('locale-continents');
$output = [];
foreach ($list as $value) {
$output[] = new Document([
'name' => $locale->getText('continents.' . strtolower($value)),
+6 -3
View File
@@ -899,6 +899,7 @@ App::get('/v1/messaging/providers/:providerId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $providerId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$provider = $dbForProject->getDocument('providers', $providerId);
@@ -2031,6 +2032,7 @@ App::get('/v1/messaging/topics/:topicId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $topicId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$topic = $dbForProject->getDocument('topics', $topicId);
@@ -2399,6 +2401,7 @@ App::get('/v1/messaging/subscribers/:subscriberId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $subscriberId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$subscriber = $dbForProject->getDocument('subscribers', $subscriberId);
@@ -2932,9 +2935,8 @@ App::post('/v1/messaging/messages/push')
$host = System::getEnv('_APP_DOMAIN', 'localhost');
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https';
$scheduleTime = $currentScheduledAt ?? $scheduledAt;
if (!\is_null($scheduleTime)) {
$expiry = (new \DateTime($scheduleTime))->add(new \DateInterval('P15D'))->format('U');
if (!\is_null($scheduledAt)) {
$expiry = (new \DateTime($scheduledAt))->add(new \DateInterval('P15D'))->format('U');
} else {
$expiry = (new \DateTime())->add(new \DateInterval('P15D'))->format('U');
}
@@ -3081,6 +3083,7 @@ App::get('/v1/messaging/messages/:messageId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $messageId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$message = $dbForProject->getDocument('messages', $messageId);
+15 -15
View File
@@ -33,7 +33,7 @@ include_once __DIR__ . '/../shared/api.php';
App::post('/v1/migrations/appwrite')
->groups(['api', 'migrations'])
->desc('Migrate Appwrite Data')
->desc('Migrate Appwrite data')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
@@ -87,7 +87,7 @@ App::post('/v1/migrations/appwrite')
App::post('/v1/migrations/firebase/oauth')
->groups(['api', 'migrations'])
->desc('Migrate Firebase Data (OAuth)')
->desc('Migrate Firebase data (OAuth)')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
@@ -189,7 +189,7 @@ App::post('/v1/migrations/firebase/oauth')
App::post('/v1/migrations/firebase')
->groups(['api', 'migrations'])
->desc('Migrate Firebase Data (Service Account)')
->desc('Migrate Firebase data (Service Account)')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
@@ -249,7 +249,7 @@ App::post('/v1/migrations/firebase')
App::post('/v1/migrations/supabase')
->groups(['api', 'migrations'])
->desc('Migrate Supabase Data')
->desc('Migrate Supabase data')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
@@ -309,7 +309,7 @@ App::post('/v1/migrations/supabase')
App::post('/v1/migrations/nhost')
->groups(['api', 'migrations'])
->desc('Migrate NHost Data')
->desc('Migrate NHost data')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].create')
->label('audits.event', 'migration.create')
@@ -371,7 +371,7 @@ App::post('/v1/migrations/nhost')
App::get('/v1/migrations')
->groups(['api', 'migrations'])
->desc('List Migrations')
->desc('List migrations')
->label('scope', 'migrations.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
@@ -424,7 +424,7 @@ App::get('/v1/migrations')
App::get('/v1/migrations/:migrationId')
->groups(['api', 'migrations'])
->desc('Get Migration')
->desc('Get migration')
->label('scope', 'migrations.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
@@ -448,7 +448,7 @@ App::get('/v1/migrations/:migrationId')
App::get('/v1/migrations/appwrite/report')
->groups(['api', 'migrations'])
->desc('Generate a report on Appwrite Data')
->desc('Generate a report on Appwrite data')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
@@ -490,7 +490,7 @@ App::get('/v1/migrations/appwrite/report')
App::get('/v1/migrations/firebase/report')
->groups(['api', 'migrations'])
->desc('Generate a report on Firebase Data')
->desc('Generate a report on Firebase data')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
@@ -537,7 +537,7 @@ App::get('/v1/migrations/firebase/report')
App::get('/v1/migrations/firebase/report/oauth')
->groups(['api', 'migrations'])
->desc('Generate a report on Firebase Data using OAuth')
->desc('Generate a report on Firebase data using OAuth')
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'migrations')
@@ -627,7 +627,7 @@ App::get('/v1/migrations/firebase/report/oauth')
});
App::get('/v1/migrations/firebase/connect')
->desc('Authorize with firebase')
->desc('Authorize with Firebase')
->groups(['api', 'migrations'])
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@@ -781,7 +781,7 @@ App::get('/v1/migrations/firebase/redirect')
});
App::get('/v1/migrations/firebase/projects')
->desc('List Firebase Projects')
->desc('List Firebase projects')
->groups(['api', 'migrations'])
->label('scope', 'migrations.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@@ -870,7 +870,7 @@ App::get('/v1/migrations/firebase/projects')
});
App::get('/v1/migrations/firebase/deauthorize')
->desc('Revoke Appwrite\'s authorization to access Firebase Projects')
->desc('Revoke Appwrite\'s authorization to access Firebase projects')
->groups(['api', 'migrations'])
->label('scope', 'migrations.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@@ -985,7 +985,7 @@ App::get('/v1/migrations/nhost/report')
App::patch('/v1/migrations/:migrationId')
->groups(['api', 'migrations'])
->desc('Retry Migration')
->desc('Retry migration')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].retry')
->label('audits.event', 'migration.retry')
@@ -1030,7 +1030,7 @@ App::patch('/v1/migrations/:migrationId')
App::delete('/v1/migrations/:migrationId')
->groups(['api', 'migrations'])
->desc('Delete Migration')
->desc('Delete migration')
->label('scope', 'migrations.write')
->label('event', 'migrations.[migrationId].delete')
->label('audits.event', 'migrationId.delete')
+5 -7
View File
@@ -276,8 +276,6 @@ App::get('/v1/project/usage')
'buildsStorageTotal' => $total[METRIC_BUILDS_STORAGE],
'deploymentsStorageTotal' => $total[METRIC_DEPLOYMENTS_STORAGE],
'executionsBreakdown' => $executionsBreakdown,
'executionsMbSecondsBreakdown' => $executionsMbSecondsBreakdown,
'buildsMbSecondsBreakdown' => $buildsMbSecondsBreakdown,
'bucketsBreakdown' => $bucketsBreakdown,
'executionsMbSecondsBreakdown' => $executionsMbSecondsBreakdown,
'buildsMbSecondsBreakdown' => $buildsMbSecondsBreakdown,
@@ -288,7 +286,7 @@ App::get('/v1/project/usage')
// Variables
App::post('/v1/project/variables')
->desc('Create Variable')
->desc('Create variable')
->groups(['api'])
->label('scope', 'projects.write')
->label('audits.event', 'variable.create')
@@ -343,7 +341,7 @@ App::post('/v1/project/variables')
});
App::get('/v1/project/variables')
->desc('List Variables')
->desc('List variables')
->groups(['api'])
->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@@ -368,7 +366,7 @@ App::get('/v1/project/variables')
});
App::get('/v1/project/variables/:variableId')
->desc('Get Variable')
->desc('Get variable')
->groups(['api'])
->label('scope', 'projects.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@@ -392,7 +390,7 @@ App::get('/v1/project/variables/:variableId')
});
App::put('/v1/project/variables/:variableId')
->desc('Update Variable')
->desc('Update variable')
->groups(['api'])
->label('scope', 'projects.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
@@ -438,7 +436,7 @@ App::put('/v1/project/variables/:variableId')
});
App::delete('/v1/project/variables/:variableId')
->desc('Delete Variable')
->desc('Delete variable')
->groups(['api'])
->label('scope', 'projects.write')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
+5 -5
View File
@@ -23,7 +23,7 @@ use Utopia\Validator\WhiteList;
App::post('/v1/proxy/rules')
->groups(['api', 'proxy'])
->desc('Create Rule')
->desc('Create rule')
->label('scope', 'rules.write')
->label('event', 'rules.[ruleId].create')
->label('audits.event', 'rule.create')
@@ -149,7 +149,7 @@ App::post('/v1/proxy/rules')
App::get('/v1/proxy/rules')
->groups(['api', 'proxy'])
->desc('List Rules')
->desc('List rules')
->label('scope', 'rules.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
@@ -212,7 +212,7 @@ App::get('/v1/proxy/rules')
App::get('/v1/proxy/rules/:ruleId')
->groups(['api', 'proxy'])
->desc('Get Rule')
->desc('Get rule')
->label('scope', 'rules.read')
->label('sdk.auth', [APP_AUTH_TYPE_ADMIN])
->label('sdk.namespace', 'proxy')
@@ -241,7 +241,7 @@ App::get('/v1/proxy/rules/:ruleId')
App::delete('/v1/proxy/rules/:ruleId')
->groups(['api', 'proxy'])
->desc('Delete Rule')
->desc('Delete rule')
->label('scope', 'rules.write')
->label('event', 'rules.[ruleId].delete')
->label('audits.event', 'rules.delete')
@@ -277,7 +277,7 @@ App::delete('/v1/proxy/rules/:ruleId')
});
App::patch('/v1/proxy/rules/:ruleId/verification')
->desc('Update Rule Verification Status')
->desc('Update rule verification status')
->groups(['api', 'proxy'])
->label('scope', 'rules.write')
->label('event', 'rules.[ruleId].update')
+5 -9
View File
@@ -257,10 +257,6 @@ App::put('/v1/storage/buckets/:bucketId')
$permissions ??= $bucket->getPermissions();
$maximumFileSize ??= $bucket->getAttribute('maximumFileSize', (int) System::getEnv('_APP_STORAGE_LIMIT', 0));
$allowedFileExtensions ??= $bucket->getAttribute('allowedFileExtensions', []);
$enabled ??= $bucket->getAttribute('enabled', true);
$encryption ??= $bucket->getAttribute('encryption', true);
$antivirus ??= $bucket->getAttribute('antivirus', true);
/**
* Map aggregate permissions into the multiple permissions they represent,
@@ -581,8 +577,8 @@ App::post('/v1/storage/buckets/:bucketId/files')
if ($bucket->getAttribute('encryption', true) && $fileSize <= APP_STORAGE_READ_BUFFER) {
$openSSLVersion = '1';
$openSSLCipher = OpenSSL::CIPHER_AES_128_GCM;
$openSSLTag = \bin2hex($tag);
$openSSLIV = \bin2hex($iv);
$openSSLTag = '';
$openSSLIV = '';
}
if ($file->isEmpty()) {
@@ -1549,7 +1545,7 @@ App::put('/v1/storage/buckets/:bucketId/files/:fileId')
});
App::delete('/v1/storage/buckets/:bucketId/files/:fileId')
->desc('Delete File')
->desc('Delete file')
->groups(['api', 'storage'])
->label('scope', 'files.write')
->label('event', 'buckets.[bucketId].files.[fileId].delete')
@@ -1666,7 +1662,7 @@ App::get('/v1/storage/usage')
];
$total = [];
Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats, &$total) {
Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) {
foreach ($metrics as $metric) {
$result = $dbForProject->findOne('stats', [
Query::equal('metric', [$metric]),
@@ -1751,7 +1747,7 @@ App::get('/v1/storage/:bucketId/usage')
];
Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats, &$total) {
Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) {
foreach ($metrics as $metric) {
$result = $dbForProject->findOne('stats', [
Query::equal('metric', [$metric]),
+3 -1
View File
@@ -454,7 +454,7 @@ App::post('/v1/teams/:teamId/memberships')
}
} elseif (!empty($phone)) {
$invitee = $dbForProject->findOne('users', [Query::equal('phone', [$phone])]);
if (!empty($invitee) && !empty($email) && $invitee->getAttribute('email', '') !== $email) {
if (!empty($invitee) && $invitee->getAttribute('email', '') !== $email) {
throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given phone and email doesn\'t match', 409);
}
}
@@ -950,6 +950,7 @@ App::patch('/v1/teams/:teamId/memberships/:membershipId/status')
->inject('project')
->inject('geodb')
->inject('queueForEvents')
// @phpstan-ignore class.notFound
->action(function (string $teamId, string $membershipId, string $userId, string $secret, Request $request, Response $response, Document $user, Database $dbForProject, Document $project, Reader $geodb, Event $queueForEvents) {
$protocol = $request->getProtocol();
@@ -1145,6 +1146,7 @@ App::get('/v1/teams/:teamId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $teamId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$team = $dbForProject->getDocument('teams', $teamId);
+12 -10
View File
@@ -452,7 +452,7 @@ App::post('/v1/users/scrypt-modified')
});
App::post('/v1/users/:userId/targets')
->desc('Create User Target')
->desc('Create user target')
->groups(['api', 'users'])
->label('audits.event', 'target.create')
->label('audits.resource', 'target/response.$id')
@@ -647,7 +647,7 @@ App::get('/v1/users/:userId/prefs')
});
App::get('/v1/users/:userId/targets/:targetId')
->desc('Get User Target')
->desc('Get user target')
->groups(['api', 'users'])
->label('scope', 'targets.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_ADMIN])
@@ -775,6 +775,7 @@ App::get('/v1/users/:userId/logs')
->inject('dbForProject')
->inject('locale')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (string $userId, array $queries, Response $response, Database $dbForProject, Locale $locale, Reader $geodb) {
$user = $dbForProject->getDocument('users', $userId);
@@ -848,7 +849,7 @@ App::get('/v1/users/:userId/logs')
});
App::get('/v1/users/:userId/targets')
->desc('List User Targets')
->desc('List user targets')
->groups(['api', 'users'])
->label('scope', 'targets.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY, APP_AUTH_TYPE_ADMIN])
@@ -903,7 +904,7 @@ App::get('/v1/users/:userId/targets')
});
App::get('/v1/users/identities')
->desc('List Identities')
->desc('List identities')
->groups(['api', 'users'])
->label('scope', 'users.read')
->label('sdk.auth', [APP_AUTH_TYPE_KEY])
@@ -1425,7 +1426,7 @@ App::patch('/v1/users/:userId/prefs')
});
App::patch('/v1/users/:userId/targets/:targetId')
->desc('Update User target')
->desc('Update user target')
->groups(['api', 'users'])
->label('audits.event', 'target.update')
->label('audits.resource', 'target/{response.$id}')
@@ -1557,7 +1558,7 @@ App::patch('/v1/users/:userId/mfa')
});
App::get('/v1/users/:userId/mfa/factors')
->desc('List Factors')
->desc('List factors')
->groups(['api', 'users'])
->label('scope', 'users.read')
->label('usage.metric', 'users.{scope}.requests.read')
@@ -1590,7 +1591,7 @@ App::get('/v1/users/:userId/mfa/factors')
});
App::get('/v1/users/:userId/mfa/recovery-codes')
->desc('Get MFA Recovery Codes')
->desc('Get MFA recovery codes')
->groups(['api', 'users'])
->label('scope', 'users.read')
->label('usage.metric', 'users.{scope}.requests.read')
@@ -1625,7 +1626,7 @@ App::get('/v1/users/:userId/mfa/recovery-codes')
});
App::patch('/v1/users/:userId/mfa/recovery-codes')
->desc('Create MFA Recovery Codes')
->desc('Create MFA recovery codes')
->groups(['api', 'users'])
->label('event', 'users.[userId].create.mfa.recovery-codes')
->label('scope', 'users.write')
@@ -1671,7 +1672,7 @@ App::patch('/v1/users/:userId/mfa/recovery-codes')
});
App::put('/v1/users/:userId/mfa/recovery-codes')
->desc('Regenerate MFA Recovery Codes')
->desc('Regenerate MFA recovery codes')
->groups(['api', 'users'])
->label('event', 'users.[userId].update.mfa.recovery-codes')
->label('scope', 'users.write')
@@ -1716,7 +1717,7 @@ App::put('/v1/users/:userId/mfa/recovery-codes')
});
App::delete('/v1/users/:userId/mfa/authenticators/:type')
->desc('Delete Authenticator')
->desc('Delete authenticator')
->groups(['api', 'users'])
->label('event', 'users.[userId].delete.mfa')
->label('scope', 'users.write')
@@ -1780,6 +1781,7 @@ App::post('/v1/users/:userId/sessions')
->inject('locale')
->inject('geodb')
->inject('queueForEvents')
// @phpstan-ignore class.notFound
->action(function (string $userId, Request $request, Response $response, Database $dbForProject, Document $project, Locale $locale, Reader $geodb, Event $queueForEvents) {
$user = $dbForProject->getDocument('users', $userId);
if ($user->isEmpty()) {
+6 -10
View File
@@ -82,10 +82,6 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
}
if (empty($repositoryName)) {
throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND);
}
$isAuthorized = !$external;
if (!$isAuthorized && !empty($providerPullRequestId)) {
@@ -263,7 +259,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
};
App::get('/v1/vcs/github/authorize')
->desc('Install GitHub App')
->desc('Install GitHub app')
->groups(['api', 'vcs'])
->label('scope', 'vcs.read')
->label('sdk.namespace', 'vcs')
@@ -305,7 +301,7 @@ App::get('/v1/vcs/github/authorize')
});
App::get('/v1/vcs/github/callback')
->desc('Capture installation and authorization from GitHub App')
->desc('Capture installation and authorization from GitHub app')
->groups(['api', 'vcs'])
->label('scope', 'public')
->label('error', __DIR__ . '/../../views/general/error.phtml')
@@ -598,7 +594,7 @@ App::post('/v1/vcs/github/installations/:installationId/providerRepositories/:pr
});
App::get('/v1/vcs/github/installations/:installationId/providerRepositories')
->desc('List Repositories')
->desc('List repositories')
->groups(['api', 'vcs'])
->label('scope', 'vcs.read')
->label('sdk.namespace', 'vcs')
@@ -843,7 +839,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
});
App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:providerRepositoryId/branches')
->desc('List Repository Branches')
->desc('List repository branches')
->groups(['api', 'vcs'])
->label('scope', 'vcs.read')
->label('sdk.namespace', 'vcs')
@@ -892,7 +888,7 @@ App::get('/v1/vcs/github/installations/:installationId/providerRepositories/:pro
});
App::post('/v1/vcs/github/events')
->desc('Create Event')
->desc('Create event')
->groups(['api', 'vcs'])
->label('scope', 'public')
->inject('gitHub')
@@ -1120,7 +1116,7 @@ App::get('/v1/vcs/installations/:installationId')
});
App::delete('/v1/vcs/installations/:installationId')
->desc('Delete Installation')
->desc('Delete installation')
->groups(['api', 'vcs'])
->label('scope', 'vcs.write')
->label('sdk.namespace', 'vcs')
+6 -1
View File
@@ -44,6 +44,7 @@ Config::setParam('domainVerification', false);
Config::setParam('cookieDomain', 'localhost');
Config::setParam('cookieSamesite', Response::COOKIE_SAMESITE_NONE);
// @phpstan-ignore class.notFound
function router(App $utopia, Database $dbForConsole, callable $getProjectDB, SwooleRequest $swooleRequest, Request $request, Response $response, Event $queueForEvents, Usage $queueForUsage, Reader $geodb)
{
$utopia->getRoute()?->label('error', __DIR__ . '/../views/general/error.phtml');
@@ -242,7 +243,7 @@ function router(App $utopia, Database $dbForConsole, callable $getProjectDB, Swo
if ($version === 'v2') {
$vars = \array_merge($vars, [
'APPWRITE_FUNCTION_TRIGGER' => $headers['x-appwrite-trigger'] ?? '',
'APPWRITE_FUNCTION_DATA' => $body ?? '',
'APPWRITE_FUNCTION_DATA' => $body,
'APPWRITE_FUNCTION_USER_ID' => $headers['x-appwrite-user-id'] ?? '',
'APPWRITE_FUNCTION_JWT' => $headers['x-appwrite-user-jwt'] ?? ''
]);
@@ -450,6 +451,7 @@ App::init()
->inject('queueForUsage')
->inject('queueForEvents')
->inject('queueForCertificates')
// @phpstan-ignore class.notFound
->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Document $console, Document $project, Database $dbForConsole, callable $getProjectDB, Locale $locale, array $localeCodes, array $clients, Reader $geodb, Usage $queueForUsage, Event $queueForEvents, Certificate $queueForCertificates) {
/*
* Appwrite Router
@@ -667,6 +669,7 @@ App::options()
->inject('queueForEvents')
->inject('queueForUsage')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Event $queueForEvents, Usage $queueForUsage, Reader $geodb) {
/*
* Appwrite Router
@@ -954,6 +957,7 @@ App::get('/robots.txt')
->inject('queueForEvents')
->inject('queueForUsage')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Event $queueForEvents, Usage $queueForUsage, Reader $geodb) {
$host = $request->getHostname() ?? '';
$mainDomain = System::getEnv('_APP_DOMAIN', '');
@@ -979,6 +983,7 @@ App::get('/humans.txt')
->inject('queueForEvents')
->inject('queueForUsage')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (App $utopia, SwooleRequest $swooleRequest, Request $request, Response $response, Database $dbForConsole, callable $getProjectDB, Event $queueForEvents, Usage $queueForUsage, Reader $geodb) {
$host = $request->getHostname() ?? '';
$mainDomain = System::getEnv('_APP_DOMAIN', '');
+2
View File
@@ -229,6 +229,8 @@ App::get('/v1/mock/github/callback')
throw new Exception(Exception::PROJECT_NOT_FOUND, $error);
}
$installation = new Document();
if (!empty($providerInstallationId)) {
$privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY');
$githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID');
+1
View File
@@ -35,6 +35,7 @@ App::init()
->inject('request')
->inject('project')
->inject('geodb')
// @phpstan-ignore class.notFound
->action(function (App $utopia, Request $request, Document $project, Reader $geodb) {
$denylist = System::getEnv('_APP_CONSOLE_COUNTRIES_DENYLIST', '');
if (!empty($denylist && $project->getId() === 'console')) {
+5 -1
View File
@@ -26,6 +26,8 @@ use Utopia\Pools\Group;
use Utopia\Swoole\Files;
use Utopia\System\System;
/** @var Utopia\Registry\Registry $register */
$http = new Server(
host: "0.0.0.0",
port: System::getEnv('PORT', 80),
@@ -71,12 +73,12 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
$attempts = 0;
$max = 10;
$sleep = 1;
$dbForConsole = null;
do {
try {
$attempts++;
$dbForConsole = $app->getResource('dbForConsole');
/** @var Utopia\Database\Database $dbForConsole */
break; // leave the do-while if successful
} catch (\Throwable $e) {
Console::warning("Database not ready. Retrying connection ({$attempts})...");
@@ -87,6 +89,8 @@ $http->on(Constant::EVENT_START, function (Server $http) use ($payloadSize, $reg
}
} while ($attempts < $max);
/** @var Utopia\Database\Database $dbForConsole */
Console::success('[Setup] - Server database init started...');
try {
+2 -1
View File
@@ -781,7 +781,7 @@ $register->set('logger', function () {
};
}
if (empty($providerName) || empty($providerConfig)) {
if (empty($providerName)) {
return;
}
@@ -1028,6 +1028,7 @@ $register->set('smtp', function () {
return $mail;
});
$register->set('geodb', function () {
// @phpstan-ignore class.notFound
return new Reader(__DIR__ . '/assets/dbip/dbip-country-lite-2024-09.mmdb');
});
$register->set('passwordsDictionary', function () {
+1 -1
View File
@@ -266,7 +266,7 @@ $server->onWorkerStart(function (int $workerId) use ($server, $register, $stats,
$attempts = 0;
$start = time();
Timer::tick(5000, function () use ($server, $register, $realtime, $stats, $logError) {
Timer::tick(5000, function () use ($server, $register, $realtime, $stats) {
/**
* Sending current connections to project channels on the console project every 5 seconds.
*/
+2 -1
View File
@@ -36,6 +36,8 @@ use Utopia\Queue\Server;
use Utopia\Registry\Registry;
use Utopia\System\System;
/** @var Utopia\Registry\Registry $register */
Authorization::disable();
Runtime::enableCoroutine(SWOOLE_HOOK_ALL);
@@ -272,7 +274,6 @@ Server::setResource('deviceForCache', function (Document $project) {
return getDevice(APP_STORAGE_CACHE . '/app-' . $project->getId());
}, ['project']);
$pools = $register->get('pools');
$platform = new Appwrite();
$args = $platform->getEnv('argv');
+4 -2
View File
@@ -14,7 +14,8 @@
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/pint --test",
"format": "vendor/bin/pint",
"bench": "vendor/bin/phpbench run --report=benchmark"
"bench": "vendor/bin/phpbench run --report=benchmark",
"check": "./vendor/bin/phpstan analyse --level 1 -c phpstan.neon app src tests"
},
"autoload": {
"psr-4": {
@@ -88,7 +89,8 @@
"swoole/ide-helper": "5.1.2",
"textalk/websocket": "1.5.7",
"laravel/pint": "^1.14",
"phpbench/phpbench": "^1.2"
"phpbench/phpbench": "^1.2",
"phpstan/phpstan": "1.12.*"
},
"provide": {
"ext-phpiredis": "*"
Generated
+100 -42
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b6820da26239716cf14a445697902a03",
"content-hash": "95bd5ac66d795d804215b495ba0221e9",
"packages": [
{
"name": "adhocore/jwt",
@@ -2069,16 +2069,16 @@
},
{
"name": "utopia-php/logger",
"version": "0.6.0",
"version": "0.6.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/logger.git",
"reference": "a2d1daeeb8f61fdec6d851950d9a021a3d05c9f9"
"reference": "7e8ff512c6f04577aba1df67c7b9628971946f9c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/logger/zipball/a2d1daeeb8f61fdec6d851950d9a021a3d05c9f9",
"reference": "a2d1daeeb8f61fdec6d851950d9a021a3d05c9f9",
"url": "https://api.github.com/repos/utopia-php/logger/zipball/7e8ff512c6f04577aba1df67c7b9628971946f9c",
"reference": "7e8ff512c6f04577aba1df67c7b9628971946f9c",
"shasum": ""
},
"require": {
@@ -2117,9 +2117,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/logger/issues",
"source": "https://github.com/utopia-php/logger/tree/0.6.0"
"source": "https://github.com/utopia-php/logger/tree/0.6.1"
},
"time": "2024-05-23T13:37:54+00:00"
"time": "2024-09-20T14:02:12+00:00"
},
{
"name": "utopia-php/messaging",
@@ -3314,16 +3314,16 @@
},
{
"name": "laravel/pint",
"version": "v1.17.3",
"version": "v1.18.1",
"source": {
"type": "git",
"url": "https://github.com/laravel/pint.git",
"reference": "9d77be916e145864f10788bb94531d03e1f7b482"
"reference": "35c00c05ec43e6b46d295efc0f4386ceb30d50d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/9d77be916e145864f10788bb94531d03e1f7b482",
"reference": "9d77be916e145864f10788bb94531d03e1f7b482",
"url": "https://api.github.com/repos/laravel/pint/zipball/35c00c05ec43e6b46d295efc0f4386ceb30d50d9",
"reference": "35c00c05ec43e6b46d295efc0f4386ceb30d50d9",
"shasum": ""
},
"require": {
@@ -3376,7 +3376,7 @@
"issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint"
},
"time": "2024-09-03T15:00:28+00:00"
"time": "2024-09-24T17:22:50+00:00"
},
{
"name": "matthiasmullie/minify",
@@ -4185,16 +4185,16 @@
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.30.1",
"version": "1.32.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "51b95ec8670af41009e2b2b56873bad96682413e"
"reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e",
"reference": "51b95ec8670af41009e2b2b56873bad96682413e",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6ca22b154efdd9e3c68c56f5d94670920a1c19a4",
"reference": "6ca22b154efdd9e3c68c56f5d94670920a1c19a4",
"shasum": ""
},
"require": {
@@ -4226,9 +4226,67 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1"
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.32.0"
},
"time": "2024-09-07T20:13:05+00:00"
"time": "2024-09-26T07:23:32+00:00"
},
{
"name": "phpstan/phpstan",
"version": "1.12.5",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
}
],
"time": "2024-09-26T12:45:22+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -5865,16 +5923,16 @@
},
{
"name": "symfony/console",
"version": "v7.1.4",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111"
"reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/1eed7af6961d763e7832e874d7f9b21c3ea9c111",
"reference": "1eed7af6961d763e7832e874d7f9b21c3ea9c111",
"url": "https://api.github.com/repos/symfony/console/zipball/0fa539d12b3ccf068a722bbbffa07ca7079af9ee",
"reference": "0fa539d12b3ccf068a722bbbffa07ca7079af9ee",
"shasum": ""
},
"require": {
@@ -5938,7 +5996,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.1.4"
"source": "https://github.com/symfony/console/tree/v7.1.5"
},
"funding": [
{
@@ -5954,7 +6012,7 @@
"type": "tidelift"
}
],
"time": "2024-08-15T22:48:53+00:00"
"time": "2024-09-20T08:28:38+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -6025,16 +6083,16 @@
},
{
"name": "symfony/filesystem",
"version": "v7.1.2",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "92a91985250c251de9b947a14bb2c9390b1a562c"
"reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c",
"reference": "92a91985250c251de9b947a14bb2c9390b1a562c",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/61fe0566189bf32e8cfee78335d8776f64a66f5a",
"reference": "61fe0566189bf32e8cfee78335d8776f64a66f5a",
"shasum": ""
},
"require": {
@@ -6071,7 +6129,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v7.1.2"
"source": "https://github.com/symfony/filesystem/tree/v7.1.5"
},
"funding": [
{
@@ -6087,7 +6145,7 @@
"type": "tidelift"
}
],
"time": "2024-06-28T10:03:55+00:00"
"time": "2024-09-17T09:16:35+00:00"
},
{
"name": "symfony/finder",
@@ -6536,16 +6594,16 @@
},
{
"name": "symfony/process",
"version": "v7.1.3",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca"
"reference": "5c03ee6369281177f07f7c68252a280beccba847"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca",
"reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca",
"url": "https://api.github.com/repos/symfony/process/zipball/5c03ee6369281177f07f7c68252a280beccba847",
"reference": "5c03ee6369281177f07f7c68252a280beccba847",
"shasum": ""
},
"require": {
@@ -6577,7 +6635,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v7.1.3"
"source": "https://github.com/symfony/process/tree/v7.1.5"
},
"funding": [
{
@@ -6593,7 +6651,7 @@
"type": "tidelift"
}
],
"time": "2024-07-26T12:44:47+00:00"
"time": "2024-09-19T21:48:23+00:00"
},
{
"name": "symfony/service-contracts",
@@ -6680,16 +6738,16 @@
},
{
"name": "symfony/string",
"version": "v7.1.4",
"version": "v7.1.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b"
"reference": "d66f9c343fa894ec2037cc928381df90a7ad4306"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/6cd670a6d968eaeb1c77c2e76091c45c56bc367b",
"reference": "6cd670a6d968eaeb1c77c2e76091c45c56bc367b",
"url": "https://api.github.com/repos/symfony/string/zipball/d66f9c343fa894ec2037cc928381df90a7ad4306",
"reference": "d66f9c343fa894ec2037cc928381df90a7ad4306",
"shasum": ""
},
"require": {
@@ -6747,7 +6805,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v7.1.4"
"source": "https://github.com/symfony/string/tree/v7.1.5"
},
"funding": [
{
@@ -6763,7 +6821,7 @@
"type": "tidelift"
}
],
"time": "2024-08-12T09:59:40+00:00"
"time": "2024-09-20T08:28:38+00:00"
},
{
"name": "textalk/websocket",
+5
View File
@@ -0,0 +1,5 @@
parameters:
scanDirectories:
- vendor/swoole/ide-helper
excludePaths:
- tests/resources
+1
View File
@@ -25,6 +25,7 @@ class Scrypt extends Hash
{
$options = $this->getOptions();
// @phpstan-ignore function.notFound
return \scrypt($password, $options['salt'], $options['costCpu'], $options['costMemory'], $options['costParallel'], $options['length']);
}
@@ -61,7 +61,10 @@ class Scryptmodified extends Hash
$saltSeparatorBytes = \base64_decode($options['saltSeparator']);
$password = mb_convert_encoding($password, 'UTF-8');
// @phpstan-ignore function.notFound
$derivedKey = \scrypt($password, $saltBytes . $saltSeparatorBytes, 16384, 8, 1, 64);
$derivedKey = \hex2bin($derivedKey);
return $derivedKey;
-10
View File
@@ -170,16 +170,6 @@ class Func extends Event
return $this;
}
/**
* Returns set custom data for the function event.
*
* @return string
*/
public function getData(): string
{
return $this->data;
}
/**
* Sets JWT for the function event.
*
+6 -6
View File
@@ -25,7 +25,7 @@ class Resolvers
?Route $route,
): callable {
return static fn ($type, $args, $context, $info) => new Swoole(
function (callable $resolve, callable $reject) use ($utopia, $route, $args, $context, $info) {
function (callable $resolve, callable $reject) use ($utopia, $route, $args) {
/** @var App $utopia */
/** @var Response $response */
/** @var Request $request */
@@ -96,7 +96,7 @@ class Resolvers
callable $url,
): callable {
return static fn ($type, $args, $context, $info) => new Swoole(
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $type, $args) {
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $args) {
$utopia = $utopia->getResource('utopia:graphql', true);
$request = $utopia->getResource('request', true);
$response = $utopia->getResource('response', true);
@@ -127,7 +127,7 @@ class Resolvers
callable $params,
): callable {
return static fn ($type, $args, $context, $info) => new Swoole(
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $params, $type, $args) {
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $params, $args) {
$utopia = $utopia->getResource('utopia:graphql', true);
$request = $utopia->getResource('request', true);
$response = $utopia->getResource('response', true);
@@ -163,7 +163,7 @@ class Resolvers
callable $params,
): callable {
return static fn ($type, $args, $context, $info) => new Swoole(
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $params, $type, $args) {
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $params, $args) {
$utopia = $utopia->getResource('utopia:graphql', true);
$request = $utopia->getResource('request', true);
$response = $utopia->getResource('response', true);
@@ -195,7 +195,7 @@ class Resolvers
callable $params,
): callable {
return static fn ($type, $args, $context, $info) => new Swoole(
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $params, $type, $args) {
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $params, $args) {
$utopia = $utopia->getResource('utopia:graphql', true);
$request = $utopia->getResource('request', true);
$response = $utopia->getResource('response', true);
@@ -225,7 +225,7 @@ class Resolvers
callable $url,
): callable {
return static fn ($type, $args, $context, $info) => new Swoole(
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $type, $args) {
function (callable $resolve, callable $reject) use ($utopia, $databaseId, $collectionId, $url, $args) {
$utopia = $utopia->getResource('utopia:graphql', true);
$request = $utopia->getResource('request', true);
$response = $utopia->getResource('response', true);
+1
View File
@@ -156,6 +156,7 @@ class Schema
$offset = 0;
while (!empty($attrs = $attributes($limit, $offset))) {
$databaseId = '';
foreach ($attrs as $attr) {
if ($attr['status'] !== 'available') {
continue;
+1 -1
View File
@@ -453,7 +453,7 @@ class V20 extends Migration
Query::equal('period', ['1d']),
]);
$value = $query ?? 0;
$value = $query;
$this->createInfMetric($to, $value);
}
+1 -1
View File
@@ -165,7 +165,7 @@ abstract class ScheduleBase extends Action
$total = $total + $sum;
foreach ($results as $document) {
$localDocument = $schedules[$document['resourceId']] ?? null;
$localDocument = $this->schedules[$document->getInternalId()] ?? null;
// Check if resource has been updated since last sync
$org = $localDocument !== null ? \strtotime($localDocument['resourceUpdatedAt']) : null;
+2 -1
View File
@@ -197,6 +197,7 @@ class Builds extends Action
$isVcsEnabled = !empty($providerRepositoryId);
$owner = '';
$repositoryName = '';
$providerInstallationId = '';
if ($isVcsEnabled) {
$installation = $dbForConsole->getDocument('installations', $installationId);
@@ -359,7 +360,7 @@ class Builds extends Action
$providerCommitHash = \trim($stdout);
$authorUrl = "https://github.com/$cloneOwner";
$deployment->setAttribute('providerCommitHash', $providerCommitHash ?? '');
$deployment->setAttribute('providerCommitHash', $providerCommitHash);
$deployment->setAttribute('providerCommitAuthorUrl', $authorUrl);
$deployment->setAttribute('providerCommitAuthor', 'Appwrite');
$deployment->setAttribute('providerCommitMessage', "Create '" . $function->getAttribute('name', '') . "' function");
+1 -1
View File
@@ -199,7 +199,7 @@ class Databases extends Action
}
if ($type === Database::VAR_RELATIONSHIP && $options['twoWay']) {
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $relatedCollection->getId());
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $options['relatedCollection']);
}
$dbForProject->purgeCachedDocument('database_' . $database->getInternalId(), $collectionId);
+1 -1
View File
@@ -756,7 +756,7 @@ class Deletes extends Action
Query::equal('resourceType', ['function']),
Query::equal('resourceInternalId', [$functionInternalId]),
Query::equal('projectInternalId', [$project->getInternalId()])
], $dbForConsole, function (Document $document) use ($project, $dbForConsole) {
], $dbForConsole, function (Document $document) use ($dbForConsole) {
$this->deleteRule($dbForConsole, $document);
});
+3 -3
View File
@@ -442,8 +442,8 @@ class Functions extends Action
if ($version === 'v2') {
$vars = \array_merge($vars, [
'APPWRITE_FUNCTION_TRIGGER' => $headers['x-appwrite-trigger'] ?? '',
'APPWRITE_FUNCTION_DATA' => $body ?? '',
'APPWRITE_FUNCTION_EVENT_DATA' => $body ?? '',
'APPWRITE_FUNCTION_DATA' => $body,
'APPWRITE_FUNCTION_EVENT_DATA' => $body,
'APPWRITE_FUNCTION_EVENT' => $headers['x-appwrite-event'] ?? '',
'APPWRITE_FUNCTION_USER_ID' => $headers['x-appwrite-user-id'] ?? '',
'APPWRITE_FUNCTION_JWT' => $headers['x-appwrite-user-jwt'] ?? ''
@@ -605,7 +605,7 @@ class Functions extends Action
);
if (!empty($error)) {
throw new Exception($error, $errorCode);
throw new Exception($error, $errorCode ?? 0);
}
}
}
+24 -22
View File
@@ -346,32 +346,34 @@ class Messaging extends Action
$dbForProject->updateDocument('messages', $message->getId(), $message);
// Delete any attachments that were downloaded to local storage
if ($provider->getAttribute('type') === MESSAGE_TYPE_EMAIL) {
if ($deviceForFiles->getType() === Storage::DEVICE_LOCAL) {
return;
}
$data = $message->getAttribute('data');
$attachments = $data['attachments'] ?? [];
foreach ($attachments as $attachment) {
$bucketId = $attachment['bucketId'];
$fileId = $attachment['fileId'];
$bucket = $dbForProject->getDocument('buckets', $bucketId);
if ($bucket->isEmpty()) {
throw new \Exception('Storage bucket with the requested ID could not be found');
foreach ($providers as $provider) {
if ($provider->getAttribute('type') === MESSAGE_TYPE_EMAIL) {
if ($deviceForFiles->getType() === Storage::DEVICE_LOCAL) {
return;
}
$file = $dbForProject->getDocument('bucket_' . $bucket->getInternalId(), $fileId);
if ($file->isEmpty()) {
throw new \Exception('Storage file with the requested ID could not be found');
}
$data = $message->getAttribute('data');
$attachments = $data['attachments'] ?? [];
$path = $file->getAttribute('path', '');
foreach ($attachments as $attachment) {
$bucketId = $attachment['bucketId'];
$fileId = $attachment['fileId'];
if ($this->getLocalDevice($project)->exists($path)) {
$this->getLocalDevice($project)->delete($path);
$bucket = $dbForProject->getDocument('buckets', $bucketId);
if ($bucket->isEmpty()) {
throw new \Exception('Storage bucket with the requested ID could not be found');
}
$file = $dbForProject->getDocument('bucket_' . $bucket->getInternalId(), $fileId);
if ($file->isEmpty()) {
throw new \Exception('Storage file with the requested ID could not be found');
}
$path = $file->getAttribute('path', '');
if ($this->getLocalDevice($project)->exists($path)) {
$this->getLocalDevice($project)->delete($path);
}
}
}
}
+1 -1
View File
@@ -202,7 +202,7 @@ class Webhooks extends Action
$template->setParam('{{webhook}}', $webhook->getAttribute('name'));
$template->setParam('{{project}}', $project->getAttribute('name'));
$template->setParam('{{url}}', $webhook->getAttribute('url'));
$template->setParam('{{error}}', $curlError ?? 'The server returned ' . $statusCode . ' status code');
$template->setParam('{{error}}', 'The server returned ' . $statusCode . ' status code');
$template->setParam('{{path}}', "/console/project-$projectId/settings/webhooks/$webhookId");
$template->setParam('{{attempts}}', $attempts);
+1 -1
View File
@@ -12,7 +12,7 @@ abstract class Promise
private mixed $result;
public function __construct(?callable $executor = null)
final public function __construct(?callable $executor = null)
{
if (\is_null($executor)) {
return;
-5
View File
@@ -6,11 +6,6 @@ use Swoole\Coroutine\Channel;
class Swoole extends Promise
{
public function __construct(?callable $executor = null)
{
parent::__construct($executor);
}
protected function execute(
callable $executor,
callable $resolve,
@@ -103,10 +103,6 @@ class OpenAPI3 extends Format
$output['components']['securitySchemes']['Key']['x-appwrite'] = ['demo' => '<YOUR_API_KEY>'];
}
if (isset($output['securityDefinitions']['JWT'])) {
$output['securityDefinitions']['JWT']['x-appwrite'] = ['demo' => '<YOUR_JWT>'];
}
if (isset($output['components']['securitySchemes']['Locale'])) {
$output['components']['securitySchemes']['Locale']['x-appwrite'] = ['demo' => 'en'];
}
@@ -239,7 +235,6 @@ class OpenAPI3 extends Format
if ($route->getLabel('sdk.response.code', 500) === 204) {
$temp['responses'][(string)$route->getLabel('sdk.response.code', '500')]['description'] = 'No content';
unset($temp['responses'][(string)$route->getLabel('sdk.response.code', '500')]['schema']);
}
if ((!empty($scope))) { // && 'public' != $scope
@@ -287,7 +282,7 @@ class OpenAPI3 extends Format
$validator = $validator->getValidator();
}
switch ((!empty($validator)) ? \get_class($validator) : '') {
switch (get_class($validator)) {
case 'Utopia\Database\Validator\UID':
case 'Utopia\Validator\Text':
$node['schema']['type'] = $validator->getType();
@@ -286,7 +286,7 @@ class Swagger2 extends Format
$validator = $validator->getValidator();
}
$validatorClass = (!empty($validator)) ? \get_class($validator) : '';
$validatorClass = \get_class($validator);
if ($validatorClass === 'Utopia\Validator\AnyOf') {
$validator = $param['validator']->getValidators()[0];
$validatorClass = \get_class($validator);
+4
View File
@@ -650,6 +650,10 @@ class Response extends SwooleResponse
$ruleType = $rule['type'];
}
if (!isset($ruleType)) {
continue;
}
if (!array_key_exists($ruleType, $this->models)) {
throw new Exception('Missing model for rule: ' . $ruleType);
}
+12 -4
View File
@@ -67,15 +67,21 @@ class Comment
];
}
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
$hostname = System::getEnv('_APP_DOMAIN');
$lastFunctionId = '';
$lastProjectId = '';
foreach ($projects as $projectId => $project) {
$lastProjectId = $projectId;
$text .= "**{$project['name']}** `{$projectId}`\n\n";
$text .= "| Function | ID | Status | Action |\n";
$text .= "| :- | :- | :- | :- |\n";
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https';
$hostname = System::getEnv('_APP_DOMAIN');
foreach ($project['functions'] as $functionId => $function) {
$lastFunctionId = $functionId;
if ($function['status'] === 'waiting' || $function['status'] === 'processing' || $function['status'] === 'building') {
$text .= "**Your function deployment is in progress. Please check back in a few minutes for the updated status.**\n\n";
} elseif ($function['status'] === 'ready') {
@@ -115,9 +121,11 @@ class Comment
$text .= "\n\n";
}
$functionUrl = $protocol . '://' . $hostname . '/console/project-' . $projectId . '/functions/function-' . $functionId;
$functionUrl = $protocol . '://' . $hostname . '/console/project-' . $lastProjectId . '/functions/function-' . $lastFunctionId;
$text .= "Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to [your deployments]($functionUrl). Learn more about Appwrite [Function deployments](https://appwrite.io/docs/functions).\n\n";
$tip = $this->tips[array_rand($this->tips)];
$text .= "> **💡 Did you know?** \n " . $tip . "\n\n";
@@ -766,6 +766,7 @@ class FunctionsCustomServerTest extends Scope
'x-appwrite-project' => $this->getProject()['$id']
];
$id = '';
$largeTag = [];
while (!feof($handle)) {
$curlFile = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode(@fread($handle, $chunkSize)), $mimeType, 'php-large-fx.tar.gz');
$headers['content-range'] = 'bytes ' . ($counter * $chunkSize) . '-' . min(((($counter * $chunkSize) + $chunkSize) - 1), $size - 1) . '/' . $size;
+1 -1
View File
@@ -560,7 +560,7 @@ class MessagingTest extends Scope
$apiKey = $emailDSN->getPassword();
$domain = $emailDSN->getUser();
if (empty($to) || empty($from) || empty($apiKey) || empty($domain) || empty($isEuRegion)) {
if (empty($to) || empty($fromName) || empty($fromEmail) || empty($apiKey) || empty($domain) || empty($isEuRegion)) {
$this->markTestSkipped('Email provider not configured');
}
@@ -183,7 +183,7 @@ class StorageClientTest extends Scope
/**
* @depends testCreateFile
* @param $file
* @return array
* @return void
* @throws \Exception
*/
public function testGetFileDownload($file)
@@ -232,7 +232,7 @@ class StorageServerTest extends Scope
/**
* @depends testCreateFile
* @param $file
* @return array
* @return void
* @throws \Exception
*/
public function testGetFileDownload($file)
@@ -1429,7 +1429,7 @@ trait MessagingBase
$authKey = $smsDSN->getPassword();
$templateId = $smsDSN->getParam('templateId');
if (empty($to) || empty($from) || empty($senderId) || empty($authKey)) {
if (empty($to) || empty($senderId) || empty($authKey)) {
$this->markTestSkipped('SMS provider not configured');
}
@@ -96,6 +96,7 @@ trait StorageBase
'content-type' => 'multipart/form-data',
'x-appwrite-project' => $this->getProject()['$id']
];
$largeFile = [];
$id = '';
while (!feof($handle)) {
$curlFile = new \CURLFile('data://' . $mimeType . ';base64,' . base64_encode(@fread($handle, $chunkSize)), $mimeType, 'large-file.mp4');