appwrite-cli 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +41 -0
- package/Formula/appwrite.rb +19 -0
- package/LICENSE.md +12 -0
- package/README.md +102 -0
- package/docs/examples/account/create-anonymous-session.md +1 -0
- package/docs/examples/account/create-j-w-t.md +1 -0
- package/docs/examples/account/create-magic-u-r-l-session.md +4 -0
- package/docs/examples/account/create-o-auth2session.md +5 -0
- package/docs/examples/account/create-recovery.md +3 -0
- package/docs/examples/account/create-session.md +3 -0
- package/docs/examples/account/create-verification.md +2 -0
- package/docs/examples/account/create.md +5 -0
- package/docs/examples/account/delete-session.md +2 -0
- package/docs/examples/account/delete-sessions.md +1 -0
- package/docs/examples/account/delete.md +1 -0
- package/docs/examples/account/get-logs.md +3 -0
- package/docs/examples/account/get-prefs.md +1 -0
- package/docs/examples/account/get-session.md +2 -0
- package/docs/examples/account/get-sessions.md +1 -0
- package/docs/examples/account/get.md +1 -0
- package/docs/examples/account/update-email.md +3 -0
- package/docs/examples/account/update-magic-u-r-l-session.md +3 -0
- package/docs/examples/account/update-name.md +2 -0
- package/docs/examples/account/update-password.md +3 -0
- package/docs/examples/account/update-prefs.md +2 -0
- package/docs/examples/account/update-recovery.md +5 -0
- package/docs/examples/account/update-session.md +2 -0
- package/docs/examples/account/update-verification.md +3 -0
- package/docs/examples/avatars/get-browser.md +5 -0
- package/docs/examples/avatars/get-credit-card.md +5 -0
- package/docs/examples/avatars/get-favicon.md +2 -0
- package/docs/examples/avatars/get-flag.md +5 -0
- package/docs/examples/avatars/get-image.md +4 -0
- package/docs/examples/avatars/get-initials.md +6 -0
- package/docs/examples/avatars/get-q-r.md +5 -0
- package/docs/examples/database/create-boolean-attribute.md +6 -0
- package/docs/examples/database/create-collection.md +6 -0
- package/docs/examples/database/create-document.md +6 -0
- package/docs/examples/database/create-email-attribute.md +6 -0
- package/docs/examples/database/create-enum-attribute.md +7 -0
- package/docs/examples/database/create-float-attribute.md +8 -0
- package/docs/examples/database/create-index.md +6 -0
- package/docs/examples/database/create-integer-attribute.md +8 -0
- package/docs/examples/database/create-ip-attribute.md +6 -0
- package/docs/examples/database/create-string-attribute.md +7 -0
- package/docs/examples/database/create-url-attribute.md +6 -0
- package/docs/examples/database/delete-attribute.md +3 -0
- package/docs/examples/database/delete-collection.md +2 -0
- package/docs/examples/database/delete-document.md +3 -0
- package/docs/examples/database/delete-index.md +3 -0
- package/docs/examples/database/get-attribute.md +3 -0
- package/docs/examples/database/get-collection-usage.md +3 -0
- package/docs/examples/database/get-collection.md +2 -0
- package/docs/examples/database/get-document.md +3 -0
- package/docs/examples/database/get-index.md +3 -0
- package/docs/examples/database/get-usage.md +2 -0
- package/docs/examples/database/list-attributes.md +2 -0
- package/docs/examples/database/list-collection-logs.md +4 -0
- package/docs/examples/database/list-collections.md +7 -0
- package/docs/examples/database/list-document-logs.md +5 -0
- package/docs/examples/database/list-documents.md +9 -0
- package/docs/examples/database/list-indexes.md +2 -0
- package/docs/examples/database/update-collection.md +7 -0
- package/docs/examples/database/update-document.md +6 -0
- package/docs/examples/functions/create-deployment.md +5 -0
- package/docs/examples/functions/create-execution.md +4 -0
- package/docs/examples/functions/create.md +9 -0
- package/docs/examples/functions/delete-deployment.md +3 -0
- package/docs/examples/functions/delete.md +2 -0
- package/docs/examples/functions/get-deployment.md +3 -0
- package/docs/examples/functions/get-execution.md +3 -0
- package/docs/examples/functions/get-usage.md +3 -0
- package/docs/examples/functions/get.md +2 -0
- package/docs/examples/functions/list-deployments.md +8 -0
- package/docs/examples/functions/list-executions.md +7 -0
- package/docs/examples/functions/list-runtimes.md +1 -0
- package/docs/examples/functions/list.md +7 -0
- package/docs/examples/functions/retry-build.md +4 -0
- package/docs/examples/functions/update-deployment.md +3 -0
- package/docs/examples/functions/update.md +8 -0
- package/docs/examples/health/get-antivirus.md +1 -0
- package/docs/examples/health/get-cache.md +1 -0
- package/docs/examples/health/get-d-b.md +1 -0
- package/docs/examples/health/get-queue-certificates.md +1 -0
- package/docs/examples/health/get-queue-functions.md +1 -0
- package/docs/examples/health/get-queue-logs.md +1 -0
- package/docs/examples/health/get-queue-usage.md +1 -0
- package/docs/examples/health/get-queue-webhooks.md +1 -0
- package/docs/examples/health/get-storage-local.md +1 -0
- package/docs/examples/health/get-time.md +1 -0
- package/docs/examples/health/get.md +1 -0
- package/docs/examples/locale/get-continents.md +1 -0
- package/docs/examples/locale/get-countries-e-u.md +1 -0
- package/docs/examples/locale/get-countries-phones.md +1 -0
- package/docs/examples/locale/get-countries.md +1 -0
- package/docs/examples/locale/get-currencies.md +1 -0
- package/docs/examples/locale/get-languages.md +1 -0
- package/docs/examples/locale/get.md +1 -0
- package/docs/examples/projects/create-domain.md +3 -0
- package/docs/examples/projects/create-key.md +4 -0
- package/docs/examples/projects/create-platform.md +7 -0
- package/docs/examples/projects/create-webhook.md +8 -0
- package/docs/examples/projects/create.md +13 -0
- package/docs/examples/projects/delete-domain.md +3 -0
- package/docs/examples/projects/delete-key.md +3 -0
- package/docs/examples/projects/delete-platform.md +3 -0
- package/docs/examples/projects/delete-webhook.md +3 -0
- package/docs/examples/projects/delete.md +3 -0
- package/docs/examples/projects/get-domain.md +3 -0
- package/docs/examples/projects/get-key.md +3 -0
- package/docs/examples/projects/get-platform.md +3 -0
- package/docs/examples/projects/get-usage.md +3 -0
- package/docs/examples/projects/get-webhook.md +3 -0
- package/docs/examples/projects/get.md +2 -0
- package/docs/examples/projects/list-domains.md +2 -0
- package/docs/examples/projects/list-keys.md +2 -0
- package/docs/examples/projects/list-platforms.md +2 -0
- package/docs/examples/projects/list-webhooks.md +2 -0
- package/docs/examples/projects/list.md +7 -0
- package/docs/examples/projects/update-auth-limit.md +3 -0
- package/docs/examples/projects/update-auth-status.md +4 -0
- package/docs/examples/projects/update-domain-verification.md +3 -0
- package/docs/examples/projects/update-key.md +5 -0
- package/docs/examples/projects/update-o-auth2.md +5 -0
- package/docs/examples/projects/update-platform.md +7 -0
- package/docs/examples/projects/update-service-status.md +4 -0
- package/docs/examples/projects/update-webhook.md +9 -0
- package/docs/examples/projects/update.md +12 -0
- package/docs/examples/storage/create-bucket.md +11 -0
- package/docs/examples/storage/create-file.md +6 -0
- package/docs/examples/storage/delete-bucket.md +2 -0
- package/docs/examples/storage/delete-file.md +3 -0
- package/docs/examples/storage/get-bucket-usage.md +3 -0
- package/docs/examples/storage/get-bucket.md +2 -0
- package/docs/examples/storage/get-file-download.md +3 -0
- package/docs/examples/storage/get-file-preview.md +14 -0
- package/docs/examples/storage/get-file-view.md +3 -0
- package/docs/examples/storage/get-file.md +3 -0
- package/docs/examples/storage/get-usage.md +2 -0
- package/docs/examples/storage/list-buckets.md +7 -0
- package/docs/examples/storage/list-files.md +8 -0
- package/docs/examples/storage/update-bucket.md +11 -0
- package/docs/examples/storage/update-file.md +5 -0
- package/docs/examples/teams/create-membership.md +6 -0
- package/docs/examples/teams/create.md +4 -0
- package/docs/examples/teams/delete-membership.md +3 -0
- package/docs/examples/teams/delete.md +2 -0
- package/docs/examples/teams/get-membership.md +3 -0
- package/docs/examples/teams/get-memberships.md +8 -0
- package/docs/examples/teams/get.md +2 -0
- package/docs/examples/teams/list.md +7 -0
- package/docs/examples/teams/update-membership-roles.md +4 -0
- package/docs/examples/teams/update-membership-status.md +5 -0
- package/docs/examples/teams/update.md +3 -0
- package/docs/examples/users/create.md +5 -0
- package/docs/examples/users/delete-session.md +3 -0
- package/docs/examples/users/delete-sessions.md +2 -0
- package/docs/examples/users/delete.md +2 -0
- package/docs/examples/users/get-logs.md +4 -0
- package/docs/examples/users/get-prefs.md +2 -0
- package/docs/examples/users/get-sessions.md +2 -0
- package/docs/examples/users/get-usage.md +3 -0
- package/docs/examples/users/get.md +2 -0
- package/docs/examples/users/list.md +7 -0
- package/docs/examples/users/update-email.md +3 -0
- package/docs/examples/users/update-name.md +3 -0
- package/docs/examples/users/update-password.md +3 -0
- package/docs/examples/users/update-prefs.md +3 -0
- package/docs/examples/users/update-status.md +3 -0
- package/docs/examples/users/update-verification.md +3 -0
- package/index.js +49 -0
- package/install.sh +165 -0
- package/ldid/COPYING +661 -0
- package/ldid/Makefile +51 -0
- package/ldid/control +12 -0
- package/ldid/control.sh +5 -0
- package/ldid/deb.sh +10 -0
- package/ldid/ios.sh +2 -0
- package/ldid/ldid.cpp +3253 -0
- package/ldid/ldid.hpp +164 -0
- package/ldid/libplist/.github/workflows/build.yml +62 -0
- package/ldid/libplist/.github/workflows/codeql-analysis.yml +71 -0
- package/ldid/libplist/AUTHORS +28 -0
- package/ldid/libplist/COPYING +340 -0
- package/ldid/libplist/COPYING.LESSER +502 -0
- package/ldid/libplist/Makefile.am +20 -0
- package/ldid/libplist/NEWS +252 -0
- package/ldid/libplist/README.md +114 -0
- package/ldid/libplist/aclocal.m4 +1729 -0
- package/ldid/libplist/autogen.sh +26 -0
- package/ldid/libplist/configure.ac +292 -0
- package/ldid/libplist/cython/Makefile.am +53 -0
- package/ldid/libplist/cython/plist.pxd +78 -0
- package/ldid/libplist/cython/plist.pyx +947 -0
- package/ldid/libplist/cython/plist_util.c +40 -0
- package/ldid/libplist/cython/plist_util.h +5 -0
- package/ldid/libplist/docs/Makefile.am +3 -0
- package/ldid/libplist/docs/plistutil.1 +62 -0
- package/ldid/libplist/fuzz/Makefile.am +43 -0
- package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-4766291097288704 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-4930725262393344 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-5421965105954816 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-5556177727389696 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-6557963011489792 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/clusterfuzz-testcase-6605859144597504 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-0ce4dd483b645bc05ec45a97d285dcf1933ee840 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-0d59cdcb5c3416c2790612b78a631ce9f5622800 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-17d635ab460fef74df1ac7561f1253533a6359c5 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-33a67313fa7864cd627ef92d12017a127d342f28 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-39f1347115f8fe9ac25cdc9332e3fc5cd32c7f7b +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-4bd78175fe01d07c5ee90104fbc68d95dd092210 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-4c5404453bb7425aef9b953a5f6f3f0afcc48392 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-52775e25f6af20af351cd616834e602fc988a032 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-6d1399685b745d3d49fadc91072fabcdde8d16fa +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-94b3725900d63c6258448fd757559c81002de9c9 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-a47195acbabc3f5b2cda9c6ebda42f2afc1cc5af +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-ce852bae6aeeffc4698a93660236f1b995ce966e +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-daddb6e82e3d1ed76e20e4131462f5247a6fb131 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-f21be4ebce7f9c337bf96b93cec7e252f5c75a21 +0 -0
- package/ldid/libplist/fuzz/bplist-crashes/crash-f779dafccc0164684d1a264976e56037188b40e2 +0 -0
- package/ldid/libplist/fuzz/bplist-leaks/leak-96fb453b3ba18d31e164831795a708183b5a0dac +0 -0
- package/ldid/libplist/fuzz/bplist-leaks/leak-acb3c00a83d7635638a476a4e70fc1f1caa1a5b1 +0 -0
- package/ldid/libplist/fuzz/bplist-leaks/leak-fe2cd4b1f67e0c9b21e6225a4fb4ca19eab80074 +0 -0
- package/ldid/libplist/fuzz/bplist.dict +1 -0
- package/ldid/libplist/fuzz/bplist_fuzzer.cc +32 -0
- package/ldid/libplist/fuzz/bplist_fuzzer.options +3 -0
- package/ldid/libplist/fuzz/fuzzers.test +8 -0
- package/ldid/libplist/fuzz/init-fuzzers.sh +23 -0
- package/ldid/libplist/fuzz/test-fuzzers.sh +33 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-4516959125241856 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-4663876528373760 +5 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-5799076113154048 +45 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-5922404220010496 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6015098361479168 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6043836860071936 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6047509906456576 +10050 -0
- package/ldid/libplist/fuzz/xplist-crashes/clusterfuzz-testcase-6482601374121984 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-09788d7acb46b4b177422f9c4ee54556a3ad1f17 +53 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-155c60d5c4b2778110fb4a633caa7d64eb9b99c1 +9 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-348c909a0b3532977185f551eb5d2ed04e694883 +11 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-7bc172e27a2b1d4fcaf031f59d1f08fb83081e4a +8 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-80c28b0e2a446665e68927dd4441c10c9a68e64e +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-8acf177da60ecf13c36d0da1b8e25de891980ea6 +5 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-94276cf69a50e78dd6cdf079c208cb80f357cd33 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-9ddb891a0ec42401eb4629e6b99e01aef7909eb9 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-a8b44e1f5be4f75f00a937016ec5405bce77a0f9 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-da39a3ee5e6b4b0d3255bfef95601890afd80709 +0 -0
- package/ldid/libplist/fuzz/xplist-crashes/crash-f03c680ee1c4d84c28e731752df77a61e213a24d +72 -0
- package/ldid/libplist/fuzz/xplist-leaks/clusterfuzz-testcase-4634751103139840 +187 -0
- package/ldid/libplist/fuzz/xplist-leaks/clusterfuzz-testcase-6056412121661440 +12 -0
- package/ldid/libplist/fuzz/xplist-leaks/leak-47b0a9f21d3affab6cfc898e5140bb53265ada07 +0 -0
- package/ldid/libplist/fuzz/xplist-leaks/leak-4c81aae70b20d9b9408b78d40999a54205bdcfb7 +0 -0
- package/ldid/libplist/fuzz/xplist-leaks/leak-53bc466851eda790bd891733da5db0a7482886bf +6 -0
- package/ldid/libplist/fuzz/xplist.dict +51 -0
- package/ldid/libplist/fuzz/xplist_fuzzer.cc +32 -0
- package/ldid/libplist/fuzz/xplist_fuzzer.options +3 -0
- package/ldid/libplist/include/Makefile.am +15 -0
- package/ldid/libplist/include/plist/Array.h +55 -0
- package/ldid/libplist/include/plist/Boolean.h +48 -0
- package/ldid/libplist/include/plist/Data.h +49 -0
- package/ldid/libplist/include/plist/Date.h +50 -0
- package/ldid/libplist/include/plist/Dictionary.h +68 -0
- package/ldid/libplist/include/plist/Integer.h +48 -0
- package/ldid/libplist/include/plist/Key.h +49 -0
- package/ldid/libplist/include/plist/Node.h +57 -0
- package/ldid/libplist/include/plist/Real.h +48 -0
- package/ldid/libplist/include/plist/String.h +49 -0
- package/ldid/libplist/include/plist/Structure.h +59 -0
- package/ldid/libplist/include/plist/Uid.h +48 -0
- package/ldid/libplist/include/plist/plist++.h +39 -0
- package/ldid/libplist/include/plist/plist.h +953 -0
- package/ldid/libplist/libcnary/COPYING +502 -0
- package/ldid/libplist/libcnary/Makefile.am +15 -0
- package/ldid/libplist/libcnary/README +5 -0
- package/ldid/libplist/libcnary/cnary.c +46 -0
- package/ldid/libplist/libcnary/include/node.h +65 -0
- package/ldid/libplist/libcnary/include/node_list.h +47 -0
- package/ldid/libplist/libcnary/include/object.h +41 -0
- package/ldid/libplist/libcnary/node.c +216 -0
- package/ldid/libplist/libcnary/node_list.c +157 -0
- package/ldid/libplist/m4/ac_pkg_cython.m4 +67 -0
- package/ldid/libplist/m4/as-compiler-flag.m4 +62 -0
- package/ldid/libplist/m4/ax_pthread.m4 +485 -0
- package/ldid/libplist/m4/ax_python_devel.m4 +327 -0
- package/ldid/libplist/m4/cython_python.m4 +7 -0
- package/ldid/libplist/src/Array.cpp +148 -0
- package/ldid/libplist/src/Boolean.cpp +73 -0
- package/ldid/libplist/src/Data.cpp +79 -0
- package/ldid/libplist/src/Date.cpp +76 -0
- package/ldid/libplist/src/Dictionary.cpp +182 -0
- package/ldid/libplist/src/Integer.cpp +73 -0
- package/ldid/libplist/src/Key.cpp +80 -0
- package/ldid/libplist/src/Makefile.am +63 -0
- package/ldid/libplist/src/Node.cpp +166 -0
- package/ldid/libplist/src/Real.cpp +73 -0
- package/ldid/libplist/src/String.cpp +80 -0
- package/ldid/libplist/src/Structure.cpp +123 -0
- package/ldid/libplist/src/Uid.cpp +73 -0
- package/ldid/libplist/src/base64.c +119 -0
- package/ldid/libplist/src/base64.h +28 -0
- package/ldid/libplist/src/bplist.c +1381 -0
- package/ldid/libplist/src/bytearray.c +61 -0
- package/ldid/libplist/src/bytearray.h +36 -0
- package/ldid/libplist/src/hashtable.c +140 -0
- package/ldid/libplist/src/hashtable.h +50 -0
- package/ldid/libplist/src/plist.c +1356 -0
- package/ldid/libplist/src/plist.h +74 -0
- package/ldid/libplist/src/ptrarray.c +96 -0
- package/ldid/libplist/src/ptrarray.h +40 -0
- package/ldid/libplist/src/strbuf.h +34 -0
- package/ldid/libplist/src/time64.c +814 -0
- package/ldid/libplist/src/time64.h +81 -0
- package/ldid/libplist/src/time64_limits.h +97 -0
- package/ldid/libplist/src/xplist.c +1435 -0
- package/ldid/libplist/test/Makefile.am +93 -0
- package/ldid/libplist/test/amp.test +14 -0
- package/ldid/libplist/test/bigarray.test +15 -0
- package/ldid/libplist/test/cdata.test +12 -0
- package/ldid/libplist/test/data/1.plist +35 -0
- package/ldid/libplist/test/data/2.plist +100 -0
- package/ldid/libplist/test/data/3.plist +420 -0
- package/ldid/libplist/test/data/4.plist +5037 -0
- package/ldid/libplist/test/data/5.plist +55053 -0
- package/ldid/libplist/test/data/6.plist +4006 -0
- package/ldid/libplist/test/data/7.plist +14 -0
- package/ldid/libplist/test/data/amp.plist +6 -0
- package/ldid/libplist/test/data/cdata.plist +6 -0
- package/ldid/libplist/test/data/dictref1byte.bplist +0 -0
- package/ldid/libplist/test/data/dictref2bytes.bplist +0 -0
- package/ldid/libplist/test/data/dictref3bytes.bplist +0 -0
- package/ldid/libplist/test/data/dictref4bytes.bplist +0 -0
- package/ldid/libplist/test/data/dictref5bytes.bplist +0 -0
- package/ldid/libplist/test/data/dictref6bytes.bplist +0 -0
- package/ldid/libplist/test/data/dictref7bytes.bplist +0 -0
- package/ldid/libplist/test/data/dictref8bytes.bplist +0 -0
- package/ldid/libplist/test/data/empty_keys.plist +8 -0
- package/ldid/libplist/test/data/entities.plist +57 -0
- package/ldid/libplist/test/data/hex.plist +5 -0
- package/ldid/libplist/test/data/invalid_tag.plist +6 -0
- package/ldid/libplist/test/data/malformed_dict.bplist +0 -0
- package/ldid/libplist/test/data/off1byte.bplist +0 -0
- package/ldid/libplist/test/data/off2bytes.bplist +0 -0
- package/ldid/libplist/test/data/off3bytes.bplist +0 -0
- package/ldid/libplist/test/data/off4bytes.bplist +0 -0
- package/ldid/libplist/test/data/off5bytes.bplist +0 -0
- package/ldid/libplist/test/data/off6bytes.bplist +0 -0
- package/ldid/libplist/test/data/off7bytes.bplist +0 -0
- package/ldid/libplist/test/data/off8bytes.bplist +0 -0
- package/ldid/libplist/test/data/offxml.plist +8 -0
- package/ldid/libplist/test/data/order.bplist +0 -0
- package/ldid/libplist/test/data/order.plist +27 -0
- package/ldid/libplist/test/data/recursion.bplist +0 -0
- package/ldid/libplist/test/data/signed.bplist +0 -0
- package/ldid/libplist/test/data/signed.plist +5 -0
- package/ldid/libplist/test/data/signedunsigned.bplist +0 -0
- package/ldid/libplist/test/data/signedunsigned.plist +11 -0
- package/ldid/libplist/test/data/unsigned.bplist +0 -0
- package/ldid/libplist/test/data/unsigned.plist +5 -0
- package/ldid/libplist/test/dates.test +15 -0
- package/ldid/libplist/test/empty.test +15 -0
- package/ldid/libplist/test/empty_keys.test +12 -0
- package/ldid/libplist/test/entities.test +12 -0
- package/ldid/libplist/test/hex.test +12 -0
- package/ldid/libplist/test/huge.test +15 -0
- package/ldid/libplist/test/invalid_tag.test +14 -0
- package/ldid/libplist/test/large.test +15 -0
- package/ldid/libplist/test/malformed_dict.test +11 -0
- package/ldid/libplist/test/medium.test +15 -0
- package/ldid/libplist/test/offsetsize.test +12 -0
- package/ldid/libplist/test/order.test +13 -0
- package/ldid/libplist/test/plist_cmp.c +158 -0
- package/ldid/libplist/test/plist_test.c +135 -0
- package/ldid/libplist/test/recursion.test +11 -0
- package/ldid/libplist/test/refsize.test +12 -0
- package/ldid/libplist/test/signedunsigned1.test +23 -0
- package/ldid/libplist/test/signedunsigned2.test +23 -0
- package/ldid/libplist/test/signedunsigned3.test +23 -0
- package/ldid/libplist/test/small.test +15 -0
- package/ldid/libplist/test/timezone1.test +17 -0
- package/ldid/libplist/test/timezone2.test +21 -0
- package/ldid/libplist/tools/Makefile.am +10 -0
- package/ldid/libplist/tools/plistutil.c +299 -0
- package/ldid/lookup2.c +416 -0
- package/ldid/make.sh +90 -0
- package/ldid/minimal/hexdump.h +76 -0
- package/ldid/minimal/mapping.h +72 -0
- package/ldid/minimal/sqlite3.h +71 -0
- package/ldid/minimal/stdlib.h +129 -0
- package/ldid/minimal/string.h +51 -0
- package/ldid/plist.sh +2 -0
- package/ldid/sha1.h +64 -0
- package/ldid/sysroot.sh +31 -0
- package/ldid/version.sh +2 -0
- package/lib/client.js +243 -0
- package/lib/commands/account.js +785 -0
- package/lib/commands/avatars.js +349 -0
- package/lib/commands/database.js +1238 -0
- package/lib/commands/deploy.js +477 -0
- package/lib/commands/functions.js +689 -0
- package/lib/commands/generic.js +106 -0
- package/lib/commands/health.js +269 -0
- package/lib/commands/init.js +148 -0
- package/lib/commands/locale.js +177 -0
- package/lib/commands/projects.js +1191 -0
- package/lib/commands/storage.js +743 -0
- package/lib/commands/teams.js +435 -0
- package/lib/commands/users.js +542 -0
- package/lib/config.js +264 -0
- package/lib/exception.js +9 -0
- package/lib/parser.js +179 -0
- package/lib/questions.js +223 -0
- package/lib/sdks.js +82 -0
- package/package.json +41 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const inquirer = require("inquirer");
|
|
2
|
+
const { Command } = require("commander");
|
|
3
|
+
const { sdkForConsole } = require("../sdks");
|
|
4
|
+
const { globalConfig, localConfig } = require("../config");
|
|
5
|
+
const { actionRunner, success, parseBool, commandDescriptions, log, parse } = require("../parser");
|
|
6
|
+
const { questionsLogin } = require("../questions");
|
|
7
|
+
const { accountCreateSession, accountDeleteSession } = require("./account");
|
|
8
|
+
|
|
9
|
+
const login = new Command("login")
|
|
10
|
+
.description(commandDescriptions['login'])
|
|
11
|
+
.action(actionRunner(async () => {
|
|
12
|
+
const answers = await inquirer.prompt(questionsLogin)
|
|
13
|
+
|
|
14
|
+
let client = await sdkForConsole(false);
|
|
15
|
+
|
|
16
|
+
await accountCreateSession({
|
|
17
|
+
email: answers.email,
|
|
18
|
+
password: answers.password,
|
|
19
|
+
parseOutput: false,
|
|
20
|
+
sdk: client
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
success()
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
const logout = new Command("logout")
|
|
27
|
+
.description(commandDescriptions['logout'])
|
|
28
|
+
.action(actionRunner(async () => {
|
|
29
|
+
let client = await sdkForConsole();
|
|
30
|
+
|
|
31
|
+
await accountDeleteSession({
|
|
32
|
+
sessionId: 'current',
|
|
33
|
+
parseOutput: false,
|
|
34
|
+
sdk: client
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
globalConfig.setCookie("");
|
|
38
|
+
success()
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
const client = new Command("client")
|
|
42
|
+
.description(commandDescriptions['client'])
|
|
43
|
+
.option("--selfSigned <value>", "Configure the CLI to use a self-signed certificate ( true or false )", parseBool)
|
|
44
|
+
.option("--endpoint <endpoint>", "Set your Apwrite server endpoint")
|
|
45
|
+
.option("--projectId <projectId>", "Set your Apwrite project ID")
|
|
46
|
+
.option("--key <key>", "Set your Apwrite server's API key")
|
|
47
|
+
.option("--debug", "Print CLI debug information")
|
|
48
|
+
.option("--reset", "Reset the CLI configuration")
|
|
49
|
+
.action(actionRunner(async ({ selfSigned, endpoint, projectId, key, debug, reset }, command) => {
|
|
50
|
+
if (selfSigned == undefined && endpoint == undefined && projectId == undefined && key == undefined && debug == undefined && reset == undefined) {
|
|
51
|
+
command.help()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (debug) {
|
|
55
|
+
let config = {
|
|
56
|
+
endpoint: globalConfig.getEndpoint(),
|
|
57
|
+
key: globalConfig.getKey(),
|
|
58
|
+
cookie: globalConfig.getCookie(),
|
|
59
|
+
selfSigned: globalConfig.getSelfSigned(),
|
|
60
|
+
project: localConfig.getProject()
|
|
61
|
+
}
|
|
62
|
+
parse(config)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (endpoint !== undefined) {
|
|
66
|
+
try {
|
|
67
|
+
let url = new URL(endpoint);
|
|
68
|
+
if (url.protocol === "http:" || url.protocol === "https:") {
|
|
69
|
+
globalConfig.setEndpoint(endpoint);
|
|
70
|
+
} else {
|
|
71
|
+
throw new Error();
|
|
72
|
+
}
|
|
73
|
+
} catch (_) {
|
|
74
|
+
throw new Error("Invalid endpoint");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (key !== undefined) {
|
|
79
|
+
globalConfig.setKey(key)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (projectId !== undefined) {
|
|
83
|
+
localConfig.setProject(projectId, '');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (selfSigned == true || selfSigned == false) {
|
|
87
|
+
globalConfig.setSelfSigned(selfSigned);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (reset !== undefined) {
|
|
91
|
+
globalConfig.setEndpoint("");
|
|
92
|
+
globalConfig.setKey("");
|
|
93
|
+
globalConfig.setCookie("");
|
|
94
|
+
globalConfig.setSelfSigned("");
|
|
95
|
+
localConfig.setProject("", "");
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
success()
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
module.exports = {
|
|
103
|
+
login,
|
|
104
|
+
logout,
|
|
105
|
+
client
|
|
106
|
+
};
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const { promisify } = require('util');
|
|
3
|
+
const libClient = require('../client.js');
|
|
4
|
+
const childProcess = require('child_process');
|
|
5
|
+
const { Command } = require('commander');
|
|
6
|
+
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
|
+
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
8
|
+
const { localConfig, globalConfig } = require("../config");
|
|
9
|
+
|
|
10
|
+
const health = new Command("health").description(commandDescriptions['health'])
|
|
11
|
+
|
|
12
|
+
const healthGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
13
|
+
|
|
14
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
15
|
+
let path = '/health';
|
|
16
|
+
let payload = {};
|
|
17
|
+
let response = undefined;
|
|
18
|
+
response = await client.call('get', path, {
|
|
19
|
+
'content-type': 'application/json',
|
|
20
|
+
}, payload);
|
|
21
|
+
|
|
22
|
+
if (parseOutput) {
|
|
23
|
+
parse(response)
|
|
24
|
+
success()
|
|
25
|
+
}
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const healthGetAntivirus = async ({ parseOutput = true, sdk = undefined}) => {
|
|
30
|
+
|
|
31
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
32
|
+
let path = '/health/anti-virus';
|
|
33
|
+
let payload = {};
|
|
34
|
+
let response = undefined;
|
|
35
|
+
response = await client.call('get', path, {
|
|
36
|
+
'content-type': 'application/json',
|
|
37
|
+
}, payload);
|
|
38
|
+
|
|
39
|
+
if (parseOutput) {
|
|
40
|
+
parse(response)
|
|
41
|
+
success()
|
|
42
|
+
}
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const healthGetCache = async ({ parseOutput = true, sdk = undefined}) => {
|
|
47
|
+
|
|
48
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
49
|
+
let path = '/health/cache';
|
|
50
|
+
let payload = {};
|
|
51
|
+
let response = undefined;
|
|
52
|
+
response = await client.call('get', path, {
|
|
53
|
+
'content-type': 'application/json',
|
|
54
|
+
}, payload);
|
|
55
|
+
|
|
56
|
+
if (parseOutput) {
|
|
57
|
+
parse(response)
|
|
58
|
+
success()
|
|
59
|
+
}
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const healthGetDB = async ({ parseOutput = true, sdk = undefined}) => {
|
|
64
|
+
|
|
65
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
66
|
+
let path = '/health/db';
|
|
67
|
+
let payload = {};
|
|
68
|
+
let response = undefined;
|
|
69
|
+
response = await client.call('get', path, {
|
|
70
|
+
'content-type': 'application/json',
|
|
71
|
+
}, payload);
|
|
72
|
+
|
|
73
|
+
if (parseOutput) {
|
|
74
|
+
parse(response)
|
|
75
|
+
success()
|
|
76
|
+
}
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const healthGetQueueCertificates = async ({ parseOutput = true, sdk = undefined}) => {
|
|
81
|
+
|
|
82
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
83
|
+
let path = '/health/queue/certificates';
|
|
84
|
+
let payload = {};
|
|
85
|
+
let response = undefined;
|
|
86
|
+
response = await client.call('get', path, {
|
|
87
|
+
'content-type': 'application/json',
|
|
88
|
+
}, payload);
|
|
89
|
+
|
|
90
|
+
if (parseOutput) {
|
|
91
|
+
parse(response)
|
|
92
|
+
success()
|
|
93
|
+
}
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const healthGetQueueFunctions = async ({ parseOutput = true, sdk = undefined}) => {
|
|
98
|
+
|
|
99
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
100
|
+
let path = '/health/queue/functions';
|
|
101
|
+
let payload = {};
|
|
102
|
+
let response = undefined;
|
|
103
|
+
response = await client.call('get', path, {
|
|
104
|
+
'content-type': 'application/json',
|
|
105
|
+
}, payload);
|
|
106
|
+
|
|
107
|
+
if (parseOutput) {
|
|
108
|
+
parse(response)
|
|
109
|
+
success()
|
|
110
|
+
}
|
|
111
|
+
return response;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const healthGetQueueLogs = async ({ parseOutput = true, sdk = undefined}) => {
|
|
115
|
+
|
|
116
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
117
|
+
let path = '/health/queue/logs';
|
|
118
|
+
let payload = {};
|
|
119
|
+
let response = undefined;
|
|
120
|
+
response = await client.call('get', path, {
|
|
121
|
+
'content-type': 'application/json',
|
|
122
|
+
}, payload);
|
|
123
|
+
|
|
124
|
+
if (parseOutput) {
|
|
125
|
+
parse(response)
|
|
126
|
+
success()
|
|
127
|
+
}
|
|
128
|
+
return response;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const healthGetQueueUsage = async ({ parseOutput = true, sdk = undefined}) => {
|
|
132
|
+
|
|
133
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
134
|
+
let path = '/health/queue/usage';
|
|
135
|
+
let payload = {};
|
|
136
|
+
let response = undefined;
|
|
137
|
+
response = await client.call('get', path, {
|
|
138
|
+
'content-type': 'application/json',
|
|
139
|
+
}, payload);
|
|
140
|
+
|
|
141
|
+
if (parseOutput) {
|
|
142
|
+
parse(response)
|
|
143
|
+
success()
|
|
144
|
+
}
|
|
145
|
+
return response;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const healthGetQueueWebhooks = async ({ parseOutput = true, sdk = undefined}) => {
|
|
149
|
+
|
|
150
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
151
|
+
let path = '/health/queue/webhooks';
|
|
152
|
+
let payload = {};
|
|
153
|
+
let response = undefined;
|
|
154
|
+
response = await client.call('get', path, {
|
|
155
|
+
'content-type': 'application/json',
|
|
156
|
+
}, payload);
|
|
157
|
+
|
|
158
|
+
if (parseOutput) {
|
|
159
|
+
parse(response)
|
|
160
|
+
success()
|
|
161
|
+
}
|
|
162
|
+
return response;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const healthGetStorageLocal = async ({ parseOutput = true, sdk = undefined}) => {
|
|
166
|
+
|
|
167
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
168
|
+
let path = '/health/storage/local';
|
|
169
|
+
let payload = {};
|
|
170
|
+
let response = undefined;
|
|
171
|
+
response = await client.call('get', path, {
|
|
172
|
+
'content-type': 'application/json',
|
|
173
|
+
}, payload);
|
|
174
|
+
|
|
175
|
+
if (parseOutput) {
|
|
176
|
+
parse(response)
|
|
177
|
+
success()
|
|
178
|
+
}
|
|
179
|
+
return response;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const healthGetTime = async ({ parseOutput = true, sdk = undefined}) => {
|
|
183
|
+
|
|
184
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
185
|
+
let path = '/health/time';
|
|
186
|
+
let payload = {};
|
|
187
|
+
let response = undefined;
|
|
188
|
+
response = await client.call('get', path, {
|
|
189
|
+
'content-type': 'application/json',
|
|
190
|
+
}, payload);
|
|
191
|
+
|
|
192
|
+
if (parseOutput) {
|
|
193
|
+
parse(response)
|
|
194
|
+
success()
|
|
195
|
+
}
|
|
196
|
+
return response;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
health
|
|
201
|
+
.command(`get`)
|
|
202
|
+
.description(`Check the Appwrite HTTP server is up and responsive.`)
|
|
203
|
+
.action(actionRunner(healthGet))
|
|
204
|
+
|
|
205
|
+
health
|
|
206
|
+
.command(`getAntivirus`)
|
|
207
|
+
.description(`Check the Appwrite Antivirus server is up and connection is successful.`)
|
|
208
|
+
.action(actionRunner(healthGetAntivirus))
|
|
209
|
+
|
|
210
|
+
health
|
|
211
|
+
.command(`getCache`)
|
|
212
|
+
.description(`Check the Appwrite in-memory cache server is up and connection is successful.`)
|
|
213
|
+
.action(actionRunner(healthGetCache))
|
|
214
|
+
|
|
215
|
+
health
|
|
216
|
+
.command(`getDB`)
|
|
217
|
+
.description(`Check the Appwrite database server is up and connection is successful.`)
|
|
218
|
+
.action(actionRunner(healthGetDB))
|
|
219
|
+
|
|
220
|
+
health
|
|
221
|
+
.command(`getQueueCertificates`)
|
|
222
|
+
.description(`Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.`)
|
|
223
|
+
.action(actionRunner(healthGetQueueCertificates))
|
|
224
|
+
|
|
225
|
+
health
|
|
226
|
+
.command(`getQueueFunctions`)
|
|
227
|
+
.description(``)
|
|
228
|
+
.action(actionRunner(healthGetQueueFunctions))
|
|
229
|
+
|
|
230
|
+
health
|
|
231
|
+
.command(`getQueueLogs`)
|
|
232
|
+
.description(`Get the number of logs that are waiting to be processed in the Appwrite internal queue server.`)
|
|
233
|
+
.action(actionRunner(healthGetQueueLogs))
|
|
234
|
+
|
|
235
|
+
health
|
|
236
|
+
.command(`getQueueUsage`)
|
|
237
|
+
.description(`Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server.`)
|
|
238
|
+
.action(actionRunner(healthGetQueueUsage))
|
|
239
|
+
|
|
240
|
+
health
|
|
241
|
+
.command(`getQueueWebhooks`)
|
|
242
|
+
.description(`Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server.`)
|
|
243
|
+
.action(actionRunner(healthGetQueueWebhooks))
|
|
244
|
+
|
|
245
|
+
health
|
|
246
|
+
.command(`getStorageLocal`)
|
|
247
|
+
.description(`Check the Appwrite local storage device is up and connection is successful.`)
|
|
248
|
+
.action(actionRunner(healthGetStorageLocal))
|
|
249
|
+
|
|
250
|
+
health
|
|
251
|
+
.command(`getTime`)
|
|
252
|
+
.description(`Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP.`)
|
|
253
|
+
.action(actionRunner(healthGetTime))
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
module.exports = {
|
|
257
|
+
health,
|
|
258
|
+
healthGet,
|
|
259
|
+
healthGetAntivirus,
|
|
260
|
+
healthGetCache,
|
|
261
|
+
healthGetDB,
|
|
262
|
+
healthGetQueueCertificates,
|
|
263
|
+
healthGetQueueFunctions,
|
|
264
|
+
healthGetQueueLogs,
|
|
265
|
+
healthGetQueueUsage,
|
|
266
|
+
healthGetQueueWebhooks,
|
|
267
|
+
healthGetStorageLocal,
|
|
268
|
+
healthGetTime
|
|
269
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const childProcess = require('child_process');
|
|
4
|
+
const { Command } = require("commander");
|
|
5
|
+
const inquirer = require("inquirer");
|
|
6
|
+
const { teamsCreate } = require("./teams");
|
|
7
|
+
const { projectsCreate } = require("./projects");
|
|
8
|
+
const { functionsCreate } = require("./functions");
|
|
9
|
+
const { databaseListCollections } = require("./database");
|
|
10
|
+
const { sdkForConsole } = require("../sdks");
|
|
11
|
+
const { localConfig } = require("../config");
|
|
12
|
+
const { questionsInitProject, questionsInitFunction } = require("../questions");
|
|
13
|
+
const { success, log, actionRunner, commandDescriptions } = require("../parser");
|
|
14
|
+
|
|
15
|
+
const init = new Command("init")
|
|
16
|
+
.description(commandDescriptions['init'])
|
|
17
|
+
.option("--all", "Flag to initialize projects and collection")
|
|
18
|
+
.action(actionRunner(async ({ all }, command) => {
|
|
19
|
+
if (all == undefined) {
|
|
20
|
+
command.help()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
await initProject();
|
|
24
|
+
await initCollection()
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const initProject = async () => {
|
|
28
|
+
let response = {}
|
|
29
|
+
let answers = await inquirer.prompt(questionsInitProject)
|
|
30
|
+
if (!answers.project) process.exit(1)
|
|
31
|
+
|
|
32
|
+
let sdk = await sdkForConsole();
|
|
33
|
+
if (answers.start == "new") {
|
|
34
|
+
response = await teamsCreate({
|
|
35
|
+
teamId: 'unique()',
|
|
36
|
+
name: answers.project,
|
|
37
|
+
sdk,
|
|
38
|
+
parseOutput: false
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
let teamId = response['$id'];
|
|
42
|
+
response = await projectsCreate({
|
|
43
|
+
projectId: 'unique()',
|
|
44
|
+
name: answers.project,
|
|
45
|
+
teamId,
|
|
46
|
+
parseOutput: false
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
localConfig.setProject(response['$id'], response.name);
|
|
50
|
+
} else {
|
|
51
|
+
localConfig.setProject(answers.project.id, answers.project.name);
|
|
52
|
+
}
|
|
53
|
+
success();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const initFunction = async () => {
|
|
57
|
+
let answers = await inquirer.prompt(questionsInitFunction)
|
|
58
|
+
|
|
59
|
+
if (fs.existsSync(path.join(process.cwd(), 'functions', answers.name))) {
|
|
60
|
+
throw new Error(`( ${answers.name} ) already exists in the current directory. Please choose another name.`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if(!answers.runtime.entrypoint) {
|
|
64
|
+
log(`Entrypoint for this runtime not found. You will be asked to configure entrypoint when you first deploy the function.`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let response = await functionsCreate({
|
|
68
|
+
functionId: 'unique()',
|
|
69
|
+
name: answers.name,
|
|
70
|
+
runtime: answers.runtime.id,
|
|
71
|
+
parseOutput: false
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
let command = `
|
|
75
|
+
mkdir -m 777 -p 'functions/${answers.name}' && \
|
|
76
|
+
cd 'functions/${answers.name}' && \
|
|
77
|
+
git init && \
|
|
78
|
+
git remote add -f origin https://github.com/appwrite/functions-starter && \
|
|
79
|
+
git config core.sparseCheckout true && \
|
|
80
|
+
echo '${answers.runtime.id}' >> .git/info/sparse-checkout && \
|
|
81
|
+
git pull origin main && \
|
|
82
|
+
rm -rf .git && \
|
|
83
|
+
mv ${answers.runtime.id}/* . && \
|
|
84
|
+
rm -rf ${answers.runtime.id}`;
|
|
85
|
+
|
|
86
|
+
// Execute the child process but do not print any std output
|
|
87
|
+
childProcess.execSync(command, { stdio: 'pipe' });
|
|
88
|
+
|
|
89
|
+
const readmePath = path.join(process.cwd(), 'functions', answers.name, 'README.md');
|
|
90
|
+
const readmeFile = fs.readFileSync(readmePath).toString();
|
|
91
|
+
const newReadmeFile = readmeFile.split('\n');
|
|
92
|
+
newReadmeFile[0] = `# ${answers.name}`;
|
|
93
|
+
newReadmeFile.splice(1, 2);
|
|
94
|
+
fs.writeFileSync(readmePath, newReadmeFile.join('\n'));
|
|
95
|
+
|
|
96
|
+
let data = {
|
|
97
|
+
$id: response['$id'],
|
|
98
|
+
name: response.name,
|
|
99
|
+
runtime: response.runtime,
|
|
100
|
+
path: `functions/${answers.name}`,
|
|
101
|
+
entrypoint: answers.runtime.entrypoint || '',
|
|
102
|
+
execute: response.execute,
|
|
103
|
+
vars: response.vars,
|
|
104
|
+
events: response.events,
|
|
105
|
+
schedule: response.schedule,
|
|
106
|
+
timeout: response.timeout,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
localConfig.addFunction(data);
|
|
110
|
+
success();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const initCollection = async () => {
|
|
114
|
+
// TODO: Pagination?
|
|
115
|
+
let response = await databaseListCollections({
|
|
116
|
+
limit: 100,
|
|
117
|
+
parseOutput: false
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
let collections = response.collections;
|
|
121
|
+
log(`Found ${collections.length} collections`);
|
|
122
|
+
|
|
123
|
+
collections.forEach(async collection => {
|
|
124
|
+
log(`Fetching ${collection.name} ...`);
|
|
125
|
+
localConfig.addCollection(collection);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
success();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
init
|
|
132
|
+
.command("project")
|
|
133
|
+
.description("Initialise your Appwrite project")
|
|
134
|
+
.action(actionRunner(initProject));
|
|
135
|
+
|
|
136
|
+
init
|
|
137
|
+
.command("function")
|
|
138
|
+
.description("Initialise your Appwrite cloud function")
|
|
139
|
+
.action(actionRunner(initFunction))
|
|
140
|
+
|
|
141
|
+
init
|
|
142
|
+
.command("collection")
|
|
143
|
+
.description("Initialise your Appwrite collections")
|
|
144
|
+
.action(actionRunner(initCollection))
|
|
145
|
+
|
|
146
|
+
module.exports = {
|
|
147
|
+
init,
|
|
148
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const { promisify } = require('util');
|
|
3
|
+
const libClient = require('../client.js');
|
|
4
|
+
const childProcess = require('child_process');
|
|
5
|
+
const { Command } = require('commander');
|
|
6
|
+
const { sdkForProject, sdkForConsole } = require('../sdks')
|
|
7
|
+
const { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log } = require('../parser')
|
|
8
|
+
const { localConfig, globalConfig } = require("../config");
|
|
9
|
+
|
|
10
|
+
const locale = new Command("locale").description(commandDescriptions['locale'])
|
|
11
|
+
|
|
12
|
+
const localeGet = async ({ parseOutput = true, sdk = undefined}) => {
|
|
13
|
+
|
|
14
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
15
|
+
let path = '/locale';
|
|
16
|
+
let payload = {};
|
|
17
|
+
let response = undefined;
|
|
18
|
+
response = await client.call('get', path, {
|
|
19
|
+
'content-type': 'application/json',
|
|
20
|
+
}, payload);
|
|
21
|
+
|
|
22
|
+
if (parseOutput) {
|
|
23
|
+
parse(response)
|
|
24
|
+
success()
|
|
25
|
+
}
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const localeGetContinents = async ({ parseOutput = true, sdk = undefined}) => {
|
|
30
|
+
|
|
31
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
32
|
+
let path = '/locale/continents';
|
|
33
|
+
let payload = {};
|
|
34
|
+
let response = undefined;
|
|
35
|
+
response = await client.call('get', path, {
|
|
36
|
+
'content-type': 'application/json',
|
|
37
|
+
}, payload);
|
|
38
|
+
|
|
39
|
+
if (parseOutput) {
|
|
40
|
+
parse(response)
|
|
41
|
+
success()
|
|
42
|
+
}
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const localeGetCountries = async ({ parseOutput = true, sdk = undefined}) => {
|
|
47
|
+
|
|
48
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
49
|
+
let path = '/locale/countries';
|
|
50
|
+
let payload = {};
|
|
51
|
+
let response = undefined;
|
|
52
|
+
response = await client.call('get', path, {
|
|
53
|
+
'content-type': 'application/json',
|
|
54
|
+
}, payload);
|
|
55
|
+
|
|
56
|
+
if (parseOutput) {
|
|
57
|
+
parse(response)
|
|
58
|
+
success()
|
|
59
|
+
}
|
|
60
|
+
return response;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const localeGetCountriesEU = async ({ parseOutput = true, sdk = undefined}) => {
|
|
64
|
+
|
|
65
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
66
|
+
let path = '/locale/countries/eu';
|
|
67
|
+
let payload = {};
|
|
68
|
+
let response = undefined;
|
|
69
|
+
response = await client.call('get', path, {
|
|
70
|
+
'content-type': 'application/json',
|
|
71
|
+
}, payload);
|
|
72
|
+
|
|
73
|
+
if (parseOutput) {
|
|
74
|
+
parse(response)
|
|
75
|
+
success()
|
|
76
|
+
}
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const localeGetCountriesPhones = async ({ parseOutput = true, sdk = undefined}) => {
|
|
81
|
+
|
|
82
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
83
|
+
let path = '/locale/countries/phones';
|
|
84
|
+
let payload = {};
|
|
85
|
+
let response = undefined;
|
|
86
|
+
response = await client.call('get', path, {
|
|
87
|
+
'content-type': 'application/json',
|
|
88
|
+
}, payload);
|
|
89
|
+
|
|
90
|
+
if (parseOutput) {
|
|
91
|
+
parse(response)
|
|
92
|
+
success()
|
|
93
|
+
}
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const localeGetCurrencies = async ({ parseOutput = true, sdk = undefined}) => {
|
|
98
|
+
|
|
99
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
100
|
+
let path = '/locale/currencies';
|
|
101
|
+
let payload = {};
|
|
102
|
+
let response = undefined;
|
|
103
|
+
response = await client.call('get', path, {
|
|
104
|
+
'content-type': 'application/json',
|
|
105
|
+
}, payload);
|
|
106
|
+
|
|
107
|
+
if (parseOutput) {
|
|
108
|
+
parse(response)
|
|
109
|
+
success()
|
|
110
|
+
}
|
|
111
|
+
return response;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const localeGetLanguages = async ({ parseOutput = true, sdk = undefined}) => {
|
|
115
|
+
|
|
116
|
+
let client = !sdk ? await sdkForProject() : sdk;
|
|
117
|
+
let path = '/locale/languages';
|
|
118
|
+
let payload = {};
|
|
119
|
+
let response = undefined;
|
|
120
|
+
response = await client.call('get', path, {
|
|
121
|
+
'content-type': 'application/json',
|
|
122
|
+
}, payload);
|
|
123
|
+
|
|
124
|
+
if (parseOutput) {
|
|
125
|
+
parse(response)
|
|
126
|
+
success()
|
|
127
|
+
}
|
|
128
|
+
return response;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
locale
|
|
133
|
+
.command(`get`)
|
|
134
|
+
.description(`Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. ([IP Geolocation by DB-IP](https://db-ip.com))`)
|
|
135
|
+
.action(actionRunner(localeGet))
|
|
136
|
+
|
|
137
|
+
locale
|
|
138
|
+
.command(`getContinents`)
|
|
139
|
+
.description(`List of all continents. You can use the locale header to get the data in a supported language.`)
|
|
140
|
+
.action(actionRunner(localeGetContinents))
|
|
141
|
+
|
|
142
|
+
locale
|
|
143
|
+
.command(`getCountries`)
|
|
144
|
+
.description(`List of all countries. You can use the locale header to get the data in a supported language.`)
|
|
145
|
+
.action(actionRunner(localeGetCountries))
|
|
146
|
+
|
|
147
|
+
locale
|
|
148
|
+
.command(`getCountriesEU`)
|
|
149
|
+
.description(`List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.`)
|
|
150
|
+
.action(actionRunner(localeGetCountriesEU))
|
|
151
|
+
|
|
152
|
+
locale
|
|
153
|
+
.command(`getCountriesPhones`)
|
|
154
|
+
.description(`List of all countries phone codes. You can use the locale header to get the data in a supported language.`)
|
|
155
|
+
.action(actionRunner(localeGetCountriesPhones))
|
|
156
|
+
|
|
157
|
+
locale
|
|
158
|
+
.command(`getCurrencies`)
|
|
159
|
+
.description(`List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.`)
|
|
160
|
+
.action(actionRunner(localeGetCurrencies))
|
|
161
|
+
|
|
162
|
+
locale
|
|
163
|
+
.command(`getLanguages`)
|
|
164
|
+
.description(`List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.`)
|
|
165
|
+
.action(actionRunner(localeGetLanguages))
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
module.exports = {
|
|
169
|
+
locale,
|
|
170
|
+
localeGet,
|
|
171
|
+
localeGetContinents,
|
|
172
|
+
localeGetCountries,
|
|
173
|
+
localeGetCountriesEU,
|
|
174
|
+
localeGetCountriesPhones,
|
|
175
|
+
localeGetCurrencies,
|
|
176
|
+
localeGetLanguages
|
|
177
|
+
};
|