chirag-appwrite-cli 0.1.1 → 0.2.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/build-verify.yml +71 -0
- package/.github/workflows/npm-publish.yml +41 -22
- package/CHANGELOG.md +190 -1
- package/LICENSE.md +12 -1
- package/README.md +182 -15
- package/bun.lock +627 -0
- package/dist/bundle.cjs +108228 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +149 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/client.d.ts +88 -0
- package/dist/lib/client.d.ts.map +1 -0
- package/dist/lib/client.js +238 -0
- package/dist/lib/client.js.map +1 -0
- package/dist/lib/commands/config.d.ts +557 -0
- package/dist/lib/commands/config.d.ts.map +1 -0
- package/dist/lib/commands/config.js +415 -0
- package/dist/lib/commands/config.js.map +1 -0
- package/dist/lib/commands/db.d.ts +34 -0
- package/dist/lib/commands/db.d.ts.map +1 -0
- package/dist/lib/commands/db.js +247 -0
- package/dist/lib/commands/db.js.map +1 -0
- package/dist/lib/commands/errors.d.ts +68 -0
- package/dist/lib/commands/errors.d.ts.map +1 -0
- package/dist/lib/commands/errors.js +72 -0
- package/dist/lib/commands/errors.js.map +1 -0
- package/dist/lib/commands/generic.d.ts +17 -0
- package/dist/lib/commands/generic.d.ts.map +1 -0
- package/dist/lib/commands/generic.js +292 -0
- package/dist/lib/commands/generic.js.map +1 -0
- package/dist/lib/commands/init.d.ts +3 -0
- package/dist/lib/commands/init.d.ts.map +1 -0
- package/dist/lib/commands/init.js +526 -0
- package/dist/lib/commands/init.js.map +1 -0
- package/dist/lib/commands/pull.d.ts +110 -0
- package/dist/lib/commands/pull.d.ts.map +1 -0
- package/dist/lib/commands/pull.js +626 -0
- package/dist/lib/commands/pull.js.map +1 -0
- package/dist/lib/commands/push.d.ts +82 -0
- package/dist/lib/commands/push.d.ts.map +1 -0
- package/dist/lib/commands/push.js +1666 -0
- package/dist/lib/commands/push.js.map +1 -0
- package/dist/lib/commands/run.d.ts +3 -0
- package/dist/lib/commands/run.d.ts.map +1 -0
- package/dist/lib/commands/run.js +289 -0
- package/dist/lib/commands/run.js.map +1 -0
- package/dist/lib/commands/schema.d.ts +57 -0
- package/dist/lib/commands/schema.d.ts.map +1 -0
- package/dist/lib/commands/schema.js +75 -0
- package/dist/lib/commands/schema.js.map +1 -0
- package/dist/lib/commands/services/account.d.ts +3 -0
- package/dist/lib/commands/services/account.d.ts.map +1 -0
- package/dist/lib/commands/services/account.js +306 -0
- package/dist/lib/commands/services/account.js.map +1 -0
- package/dist/lib/commands/services/avatars.d.ts +3 -0
- package/dist/lib/commands/services/avatars.d.ts.map +1 -0
- package/dist/lib/commands/services/avatars.js +118 -0
- package/dist/lib/commands/services/avatars.js.map +1 -0
- package/dist/lib/commands/services/console.d.ts +3 -0
- package/dist/lib/commands/services/console.d.ts.map +1 -0
- package/dist/lib/commands/services/console.js +41 -0
- package/dist/lib/commands/services/console.js.map +1 -0
- package/dist/lib/commands/services/databases.d.ts +3 -0
- package/dist/lib/commands/services/databases.d.ts.map +1 -0
- package/dist/lib/commands/services/databases.js +612 -0
- package/dist/lib/commands/services/databases.js.map +1 -0
- package/dist/lib/commands/services/functions.d.ts +3 -0
- package/dist/lib/commands/services/functions.d.ts.map +1 -0
- package/dist/lib/commands/services/functions.js +258 -0
- package/dist/lib/commands/services/functions.js.map +1 -0
- package/dist/lib/commands/services/graphql.d.ts +3 -0
- package/dist/lib/commands/services/graphql.d.ts.map +1 -0
- package/dist/lib/commands/services/graphql.js +28 -0
- package/dist/lib/commands/services/graphql.js.map +1 -0
- package/dist/lib/commands/services/health.d.ts +3 -0
- package/dist/lib/commands/services/health.d.ts.map +1 -0
- package/dist/lib/commands/services/health.js +123 -0
- package/dist/lib/commands/services/health.js.map +1 -0
- package/dist/lib/commands/services/locale.d.ts +3 -0
- package/dist/lib/commands/services/locale.d.ts.map +1 -0
- package/dist/lib/commands/services/locale.js +52 -0
- package/dist/lib/commands/services/locale.js.map +1 -0
- package/dist/lib/commands/services/messaging.d.ts +3 -0
- package/dist/lib/commands/services/messaging.d.ts.map +1 -0
- package/dist/lib/commands/services/messaging.js +505 -0
- package/dist/lib/commands/services/messaging.js.map +1 -0
- package/dist/lib/commands/services/migrations.d.ts +3 -0
- package/dist/lib/commands/services/migrations.d.ts.map +1 -0
- package/dist/lib/commands/services/migrations.js +135 -0
- package/dist/lib/commands/services/migrations.js.map +1 -0
- package/dist/lib/commands/services/project.d.ts +3 -0
- package/dist/lib/commands/services/project.d.ts.map +1 -0
- package/dist/lib/commands/services/project.js +54 -0
- package/dist/lib/commands/services/project.js.map +1 -0
- package/dist/lib/commands/services/projects.d.ts +3 -0
- package/dist/lib/commands/services/projects.d.ts.map +1 -0
- package/dist/lib/commands/services/projects.js +415 -0
- package/dist/lib/commands/services/projects.js.map +1 -0
- package/dist/lib/commands/services/proxy.d.ts +3 -0
- package/dist/lib/commands/services/proxy.d.ts.map +1 -0
- package/dist/lib/commands/services/proxy.js +68 -0
- package/dist/lib/commands/services/proxy.js.map +1 -0
- package/dist/lib/commands/services/sites.d.ts +3 -0
- package/dist/lib/commands/services/sites.d.ts.map +1 -0
- package/dist/lib/commands/services/sites.js +242 -0
- package/dist/lib/commands/services/sites.js.map +1 -0
- package/dist/lib/commands/services/storage.d.ts +3 -0
- package/dist/lib/commands/services/storage.d.ts.map +1 -0
- package/dist/lib/commands/services/storage.js +153 -0
- package/dist/lib/commands/services/storage.js.map +1 -0
- package/dist/lib/commands/services/tablesdb.d.ts +3 -0
- package/dist/lib/commands/services/tablesdb.d.ts.map +1 -0
- package/dist/lib/commands/services/tablesdb.js +605 -0
- package/dist/lib/commands/services/tablesdb.js.map +1 -0
- package/dist/lib/commands/services/teams.d.ts +3 -0
- package/dist/lib/commands/services/teams.d.ts.map +1 -0
- package/dist/lib/commands/services/teams.js +123 -0
- package/dist/lib/commands/services/teams.js.map +1 -0
- package/dist/lib/commands/services/tokens.d.ts +3 -0
- package/dist/lib/commands/services/tokens.d.ts.map +1 -0
- package/dist/lib/commands/services/tokens.js +49 -0
- package/dist/lib/commands/services/tokens.js.map +1 -0
- package/dist/lib/commands/services/users.d.ts +3 -0
- package/dist/lib/commands/services/users.d.ts.map +1 -0
- package/dist/lib/commands/services/users.js +312 -0
- package/dist/lib/commands/services/users.js.map +1 -0
- package/dist/lib/commands/services/vcs.d.ts +3 -0
- package/dist/lib/commands/services/vcs.d.ts.map +1 -0
- package/dist/lib/commands/services/vcs.js +87 -0
- package/dist/lib/commands/services/vcs.js.map +1 -0
- package/dist/lib/commands/types.d.ts +3 -0
- package/dist/lib/commands/types.d.ts.map +1 -0
- package/dist/lib/commands/types.js +151 -0
- package/dist/lib/commands/types.js.map +1 -0
- package/dist/lib/commands/update.d.ts +3 -0
- package/dist/lib/commands/update.d.ts.map +1 -0
- package/dist/lib/commands/update.js +201 -0
- package/dist/lib/commands/update.js.map +1 -0
- package/dist/lib/commands/utils/attributes.d.ts +46 -0
- package/dist/lib/commands/utils/attributes.d.ts.map +1 -0
- package/dist/lib/commands/utils/attributes.js +521 -0
- package/dist/lib/commands/utils/attributes.js.map +1 -0
- package/dist/lib/commands/utils/change-approval.d.ts +25 -0
- package/dist/lib/commands/utils/change-approval.d.ts.map +1 -0
- package/dist/lib/commands/utils/change-approval.js +129 -0
- package/dist/lib/commands/utils/change-approval.js.map +1 -0
- package/dist/lib/commands/utils/database-sync.d.ts +10 -0
- package/dist/lib/commands/utils/database-sync.d.ts.map +1 -0
- package/dist/lib/commands/utils/database-sync.js +136 -0
- package/dist/lib/commands/utils/database-sync.js.map +1 -0
- package/dist/lib/commands/utils/deployment.d.ts +34 -0
- package/dist/lib/commands/utils/deployment.d.ts.map +1 -0
- package/dist/lib/commands/utils/deployment.js +108 -0
- package/dist/lib/commands/utils/deployment.js.map +1 -0
- package/dist/lib/commands/utils/error-formatter.d.ts +19 -0
- package/dist/lib/commands/utils/error-formatter.d.ts.map +1 -0
- package/dist/lib/commands/utils/error-formatter.js +333 -0
- package/dist/lib/commands/utils/error-formatter.js.map +1 -0
- package/dist/lib/commands/utils/pools.d.ts +16 -0
- package/dist/lib/commands/utils/pools.d.ts.map +1 -0
- package/dist/lib/commands/utils/pools.js +197 -0
- package/dist/lib/commands/utils/pools.js.map +1 -0
- package/dist/lib/config.d.ts +119 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +728 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/emulation/docker.d.ts +7 -0
- package/dist/lib/emulation/docker.d.ts.map +1 -0
- package/dist/lib/emulation/docker.js +224 -0
- package/dist/lib/emulation/docker.js.map +1 -0
- package/dist/lib/emulation/utils.d.ts +29 -0
- package/dist/lib/emulation/utils.d.ts.map +1 -0
- package/dist/lib/emulation/utils.js +165 -0
- package/dist/lib/emulation/utils.js.map +1 -0
- package/dist/lib/id.d.ts +7 -0
- package/dist/lib/id.d.ts.map +1 -0
- package/dist/lib/id.js +27 -0
- package/dist/lib/id.js.map +1 -0
- package/dist/lib/paginate.d.ts +9 -0
- package/dist/lib/paginate.d.ts.map +1 -0
- package/dist/lib/paginate.js +43 -0
- package/dist/lib/paginate.js.map +1 -0
- package/dist/lib/parser.d.ts +18 -0
- package/dist/lib/parser.d.ts.map +1 -0
- package/dist/lib/parser.js +225 -0
- package/dist/lib/parser.js.map +1 -0
- package/dist/lib/questions.d.ts +59 -0
- package/dist/lib/questions.d.ts.map +1 -0
- package/dist/lib/questions.js +991 -0
- package/dist/lib/questions.js.map +1 -0
- package/dist/lib/sdks.d.ts +4 -0
- package/dist/lib/sdks.d.ts.map +1 -0
- package/dist/lib/sdks.js +61 -0
- package/dist/lib/sdks.js.map +1 -0
- package/dist/lib/services.d.ts +13 -0
- package/dist/lib/services.d.ts.map +1 -0
- package/dist/lib/services.js +47 -0
- package/dist/lib/services.js.map +1 -0
- package/dist/lib/spinner.d.ts +28 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +91 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/type-generation/attribute.d.ts +17 -0
- package/dist/lib/type-generation/attribute.d.ts.map +1 -0
- package/dist/lib/type-generation/attribute.js +16 -0
- package/dist/lib/type-generation/attribute.js.map +1 -0
- package/dist/lib/type-generation/languages/csharp.d.ts +7 -0
- package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/csharp.js +180 -0
- package/dist/lib/type-generation/languages/csharp.js.map +1 -0
- package/dist/lib/type-generation/languages/dart.d.ts +8 -0
- package/dist/lib/type-generation/languages/dart.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/dart.js +197 -0
- package/dist/lib/type-generation/languages/dart.js.map +1 -0
- package/dist/lib/type-generation/languages/java.d.ts +7 -0
- package/dist/lib/type-generation/languages/java.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/java.js +140 -0
- package/dist/lib/type-generation/languages/java.js.map +1 -0
- package/dist/lib/type-generation/languages/javascript.d.ts +9 -0
- package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/javascript.js +109 -0
- package/dist/lib/type-generation/languages/javascript.js.map +1 -0
- package/dist/lib/type-generation/languages/kotlin.d.ts +7 -0
- package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/kotlin.js +95 -0
- package/dist/lib/type-generation/languages/kotlin.js.map +1 -0
- package/dist/lib/type-generation/languages/language.d.ts +43 -0
- package/dist/lib/type-generation/languages/language.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/language.js +77 -0
- package/dist/lib/type-generation/languages/language.js.map +1 -0
- package/dist/lib/type-generation/languages/php.d.ts +7 -0
- package/dist/lib/type-generation/languages/php.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/php.js +116 -0
- package/dist/lib/type-generation/languages/php.js.map +1 -0
- package/dist/lib/type-generation/languages/swift.d.ts +7 -0
- package/dist/lib/type-generation/languages/swift.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/swift.js +179 -0
- package/dist/lib/type-generation/languages/swift.js.map +1 -0
- package/dist/lib/type-generation/languages/typescript.d.ts +9 -0
- package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -0
- package/dist/lib/type-generation/languages/typescript.js +115 -0
- package/dist/lib/type-generation/languages/typescript.js.map +1 -0
- package/dist/lib/types.d.ts +63 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.d.ts +18 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +323 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/validations.d.ts +2 -0
- package/dist/lib/validations.d.ts.map +1 -0
- package/dist/lib/validations.js +16 -0
- package/dist/lib/validations.js.map +1 -0
- package/dist/package.json +68 -0
- package/dist/scripts/generate-commands.d.ts +2 -0
- package/dist/scripts/generate-commands.d.ts.map +1 -0
- package/dist/scripts/generate-commands.js +398 -0
- package/dist/scripts/generate-commands.js.map +1 -0
- package/dist/sites/profile-website/src/lib/utils.d.ts +4 -0
- package/dist/sites/profile-website/src/lib/utils.d.ts.map +1 -0
- package/dist/sites/profile-website/src/lib/utils.js +32 -0
- package/dist/sites/profile-website/src/lib/utils.js.map +1 -0
- package/dist/sites/profile-website/tailwind.config.d.ts +3 -0
- package/dist/sites/profile-website/tailwind.config.d.ts.map +1 -0
- package/dist/sites/profile-website/tailwind.config.js +110 -0
- package/dist/sites/profile-website/tailwind.config.js.map +1 -0
- package/dist/test.d.ts +2 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/test.js +38 -0
- package/dist/test.js.map +1 -0
- package/index.ts +190 -0
- package/install.ps1 +5 -8
- package/install.sh +4 -5
- package/lib/client.ts +292 -0
- package/lib/commands/config.ts +493 -0
- package/lib/commands/db.ts +324 -0
- package/lib/commands/errors.ts +93 -0
- package/lib/commands/generic.ts +440 -0
- package/lib/commands/init.ts +713 -0
- package/lib/commands/pull.ts +944 -0
- package/lib/commands/push.ts +2355 -0
- package/lib/commands/run.ts +416 -0
- package/lib/commands/schema.ts +103 -0
- package/lib/commands/services/account.ts +832 -0
- package/lib/commands/services/avatars.ts +400 -0
- package/lib/commands/services/console.ts +73 -0
- package/lib/commands/services/databases.ts +2080 -0
- package/lib/commands/services/functions.ts +855 -0
- package/lib/commands/services/graphql.ts +47 -0
- package/lib/commands/services/health.ts +322 -0
- package/lib/commands/services/locale.ts +99 -0
- package/lib/commands/services/messaging.ts +1871 -0
- package/lib/commands/services/migrations.ts +421 -0
- package/lib/commands/services/project.ts +116 -0
- package/lib/commands/services/projects.ts +1317 -0
- package/lib/commands/services/proxy.ts +163 -0
- package/lib/commands/services/sites.ts +777 -0
- package/lib/commands/services/storage.ts +547 -0
- package/lib/commands/services/tablesdb.ts +1928 -0
- package/lib/commands/services/teams.ts +294 -0
- package/lib/commands/services/tokens.ts +106 -0
- package/lib/commands/services/users.ts +886 -0
- package/lib/commands/services/vcs.ts +268 -0
- package/lib/commands/types.ts +220 -0
- package/lib/commands/update.ts +245 -0
- package/lib/commands/utils/attributes.ts +734 -0
- package/lib/commands/utils/change-approval.ts +186 -0
- package/lib/commands/utils/database-sync.ts +180 -0
- package/lib/commands/utils/deployment.ts +180 -0
- package/lib/commands/utils/error-formatter.ts +417 -0
- package/lib/commands/utils/pools.ts +354 -0
- package/lib/config.ts +932 -0
- package/lib/emulation/docker.ts +312 -0
- package/lib/emulation/utils.ts +207 -0
- package/lib/id.ts +30 -0
- package/lib/paginate.ts +77 -0
- package/lib/parser.ts +264 -0
- package/lib/questions.ts +1167 -0
- package/lib/sdks.ts +84 -0
- package/lib/services.ts +72 -0
- package/lib/spinner.ts +131 -0
- package/lib/type-generation/attribute.ts +18 -0
- package/lib/type-generation/languages/csharp.ts +192 -0
- package/lib/type-generation/languages/dart.ts +217 -0
- package/lib/type-generation/languages/java.ts +152 -0
- package/lib/type-generation/languages/javascript.ts +122 -0
- package/lib/type-generation/languages/kotlin.ts +107 -0
- package/lib/type-generation/languages/language.ts +127 -0
- package/lib/type-generation/languages/php.ts +128 -0
- package/lib/type-generation/languages/swift.ts +191 -0
- package/lib/type-generation/languages/typescript.ts +133 -0
- package/lib/types.ts +75 -0
- package/lib/utils.ts +394 -0
- package/lib/validations.ts +20 -0
- package/package.json +39 -21
- package/scoop/appwrite.config.json +20 -0
- package/scripts/generate-commands.ts +539 -0
- package/tsconfig.json +24 -0
- package/appwrite.config.json +0 -420
- package/docs/examples/account/create-anonymous-session.md +0 -1
- package/docs/examples/account/create-email-password-session.md +0 -3
- package/docs/examples/account/create-email-token.md +0 -4
- package/docs/examples/account/create-j-w-t.md +0 -1
- package/docs/examples/account/create-magic-u-r-l-token.md +0 -5
- package/docs/examples/account/create-mfa-authenticator.md +0 -2
- package/docs/examples/account/create-mfa-challenge.md +0 -2
- package/docs/examples/account/create-mfa-recovery-codes.md +0 -1
- package/docs/examples/account/create-o-auth2session.md +0 -5
- package/docs/examples/account/create-o-auth2token.md +0 -5
- package/docs/examples/account/create-phone-token.md +0 -3
- package/docs/examples/account/create-phone-verification.md +0 -1
- package/docs/examples/account/create-push-target.md +0 -4
- package/docs/examples/account/create-recovery.md +0 -3
- package/docs/examples/account/create-session.md +0 -3
- package/docs/examples/account/create-verification.md +0 -2
- package/docs/examples/account/create.md +0 -5
- package/docs/examples/account/delete-identity.md +0 -2
- package/docs/examples/account/delete-mfa-authenticator.md +0 -2
- package/docs/examples/account/delete-push-target.md +0 -2
- package/docs/examples/account/delete-session.md +0 -2
- package/docs/examples/account/delete-sessions.md +0 -1
- package/docs/examples/account/delete.md +0 -1
- package/docs/examples/account/get-mfa-recovery-codes.md +0 -1
- package/docs/examples/account/get-prefs.md +0 -1
- package/docs/examples/account/get-session.md +0 -2
- package/docs/examples/account/get.md +0 -1
- package/docs/examples/account/list-identities.md +0 -2
- package/docs/examples/account/list-logs.md +0 -2
- package/docs/examples/account/list-mfa-factors.md +0 -1
- package/docs/examples/account/list-sessions.md +0 -1
- package/docs/examples/account/update-email.md +0 -3
- package/docs/examples/account/update-m-f-a.md +0 -2
- package/docs/examples/account/update-magic-u-r-l-session.md +0 -3
- package/docs/examples/account/update-mfa-authenticator.md +0 -3
- package/docs/examples/account/update-mfa-challenge.md +0 -3
- package/docs/examples/account/update-mfa-recovery-codes.md +0 -1
- package/docs/examples/account/update-name.md +0 -2
- package/docs/examples/account/update-password.md +0 -3
- package/docs/examples/account/update-phone-session.md +0 -3
- package/docs/examples/account/update-phone-verification.md +0 -3
- package/docs/examples/account/update-phone.md +0 -3
- package/docs/examples/account/update-prefs.md +0 -2
- package/docs/examples/account/update-push-target.md +0 -3
- package/docs/examples/account/update-recovery.md +0 -4
- package/docs/examples/account/update-session.md +0 -2
- package/docs/examples/account/update-status.md +0 -1
- package/docs/examples/account/update-verification.md +0 -3
- package/docs/examples/avatars/get-browser.md +0 -5
- package/docs/examples/avatars/get-credit-card.md +0 -5
- package/docs/examples/avatars/get-favicon.md +0 -2
- package/docs/examples/avatars/get-flag.md +0 -5
- package/docs/examples/avatars/get-image.md +0 -4
- package/docs/examples/avatars/get-initials.md +0 -5
- package/docs/examples/avatars/get-q-r.md +0 -5
- package/docs/examples/console/get-resource.md +0 -3
- package/docs/examples/console/variables.md +0 -1
- package/docs/examples/databases/create-boolean-attribute.md +0 -7
- package/docs/examples/databases/create-collection.md +0 -7
- package/docs/examples/databases/create-datetime-attribute.md +0 -7
- package/docs/examples/databases/create-document.md +0 -6
- package/docs/examples/databases/create-documents.md +0 -4
- package/docs/examples/databases/create-email-attribute.md +0 -7
- package/docs/examples/databases/create-enum-attribute.md +0 -8
- package/docs/examples/databases/create-float-attribute.md +0 -9
- package/docs/examples/databases/create-index.md +0 -8
- package/docs/examples/databases/create-integer-attribute.md +0 -9
- package/docs/examples/databases/create-ip-attribute.md +0 -7
- package/docs/examples/databases/create-relationship-attribute.md +0 -9
- package/docs/examples/databases/create-string-attribute.md +0 -9
- package/docs/examples/databases/create-url-attribute.md +0 -7
- package/docs/examples/databases/create.md +0 -4
- package/docs/examples/databases/decrement-document-attribute.md +0 -7
- package/docs/examples/databases/delete-attribute.md +0 -4
- package/docs/examples/databases/delete-collection.md +0 -3
- package/docs/examples/databases/delete-document.md +0 -4
- package/docs/examples/databases/delete-documents.md +0 -4
- package/docs/examples/databases/delete-index.md +0 -4
- package/docs/examples/databases/delete.md +0 -2
- package/docs/examples/databases/get-attribute.md +0 -4
- package/docs/examples/databases/get-collection-usage.md +0 -4
- package/docs/examples/databases/get-collection.md +0 -3
- package/docs/examples/databases/get-database-usage.md +0 -3
- package/docs/examples/databases/get-document.md +0 -5
- package/docs/examples/databases/get-index.md +0 -4
- package/docs/examples/databases/get-usage.md +0 -2
- package/docs/examples/databases/get.md +0 -2
- package/docs/examples/databases/increment-document-attribute.md +0 -7
- package/docs/examples/databases/list-attributes.md +0 -4
- package/docs/examples/databases/list-collection-logs.md +0 -4
- package/docs/examples/databases/list-collections.md +0 -4
- package/docs/examples/databases/list-document-logs.md +0 -5
- package/docs/examples/databases/list-documents.md +0 -4
- package/docs/examples/databases/list-indexes.md +0 -4
- package/docs/examples/databases/list-logs.md +0 -3
- package/docs/examples/databases/list-usage.md +0 -2
- package/docs/examples/databases/list.md +0 -3
- package/docs/examples/databases/update-boolean-attribute.md +0 -7
- package/docs/examples/databases/update-collection.md +0 -7
- package/docs/examples/databases/update-datetime-attribute.md +0 -7
- package/docs/examples/databases/update-document.md +0 -6
- package/docs/examples/databases/update-documents.md +0 -5
- package/docs/examples/databases/update-email-attribute.md +0 -7
- package/docs/examples/databases/update-enum-attribute.md +0 -8
- package/docs/examples/databases/update-float-attribute.md +0 -9
- package/docs/examples/databases/update-integer-attribute.md +0 -9
- package/docs/examples/databases/update-ip-attribute.md +0 -7
- package/docs/examples/databases/update-relationship-attribute.md +0 -6
- package/docs/examples/databases/update-string-attribute.md +0 -8
- package/docs/examples/databases/update-url-attribute.md +0 -7
- package/docs/examples/databases/update.md +0 -4
- package/docs/examples/databases/upsert-document.md +0 -6
- package/docs/examples/databases/upsert-documents.md +0 -4
- package/docs/examples/functions/create-deployment.md +0 -6
- package/docs/examples/functions/create-duplicate-deployment.md +0 -4
- package/docs/examples/functions/create-execution.md +0 -8
- package/docs/examples/functions/create-template-deployment.md +0 -7
- package/docs/examples/functions/create-variable.md +0 -5
- package/docs/examples/functions/create-vcs-deployment.md +0 -5
- package/docs/examples/functions/create.md +0 -19
- package/docs/examples/functions/delete-deployment.md +0 -3
- package/docs/examples/functions/delete-execution.md +0 -3
- package/docs/examples/functions/delete-variable.md +0 -3
- package/docs/examples/functions/delete.md +0 -2
- package/docs/examples/functions/get-deployment-download.md +0 -4
- package/docs/examples/functions/get-deployment.md +0 -3
- package/docs/examples/functions/get-execution.md +0 -3
- package/docs/examples/functions/get-template.md +0 -2
- package/docs/examples/functions/get-usage.md +0 -3
- package/docs/examples/functions/get-variable.md +0 -3
- package/docs/examples/functions/get.md +0 -2
- package/docs/examples/functions/list-deployments.md +0 -4
- package/docs/examples/functions/list-executions.md +0 -3
- package/docs/examples/functions/list-runtimes.md +0 -1
- package/docs/examples/functions/list-specifications.md +0 -1
- package/docs/examples/functions/list-templates.md +0 -5
- package/docs/examples/functions/list-usage.md +0 -2
- package/docs/examples/functions/list-variables.md +0 -2
- package/docs/examples/functions/list.md +0 -3
- package/docs/examples/functions/update-deployment-status.md +0 -3
- package/docs/examples/functions/update-function-deployment.md +0 -3
- package/docs/examples/functions/update-variable.md +0 -6
- package/docs/examples/functions/update.md +0 -19
- package/docs/examples/graphql/mutation.md +0 -2
- package/docs/examples/graphql/query.md +0 -2
- package/docs/examples/health/get-antivirus.md +0 -1
- package/docs/examples/health/get-cache.md +0 -1
- package/docs/examples/health/get-certificate.md +0 -2
- package/docs/examples/health/get-d-b.md +0 -1
- package/docs/examples/health/get-failed-jobs.md +0 -3
- package/docs/examples/health/get-pub-sub.md +0 -1
- package/docs/examples/health/get-queue-builds.md +0 -2
- package/docs/examples/health/get-queue-certificates.md +0 -2
- package/docs/examples/health/get-queue-databases.md +0 -3
- package/docs/examples/health/get-queue-deletes.md +0 -2
- package/docs/examples/health/get-queue-functions.md +0 -2
- package/docs/examples/health/get-queue-logs.md +0 -2
- package/docs/examples/health/get-queue-mails.md +0 -2
- package/docs/examples/health/get-queue-messaging.md +0 -2
- package/docs/examples/health/get-queue-migrations.md +0 -2
- package/docs/examples/health/get-queue-stats-resources.md +0 -2
- package/docs/examples/health/get-queue-usage.md +0 -2
- package/docs/examples/health/get-queue-webhooks.md +0 -2
- package/docs/examples/health/get-storage-local.md +0 -1
- package/docs/examples/health/get-storage.md +0 -1
- package/docs/examples/health/get-time.md +0 -1
- package/docs/examples/health/get.md +0 -1
- package/docs/examples/locale/get.md +0 -1
- package/docs/examples/locale/list-codes.md +0 -1
- package/docs/examples/locale/list-continents.md +0 -1
- package/docs/examples/locale/list-countries-e-u.md +0 -1
- package/docs/examples/locale/list-countries-phones.md +0 -1
- package/docs/examples/locale/list-countries.md +0 -1
- package/docs/examples/locale/list-currencies.md +0 -1
- package/docs/examples/locale/list-languages.md +0 -1
- package/docs/examples/messaging/create-apns-provider.md +0 -9
- package/docs/examples/messaging/create-email.md +0 -13
- package/docs/examples/messaging/create-fcm-provider.md +0 -5
- package/docs/examples/messaging/create-mailgun-provider.md +0 -11
- package/docs/examples/messaging/create-msg91provider.md +0 -7
- package/docs/examples/messaging/create-push.md +0 -20
- package/docs/examples/messaging/create-sendgrid-provider.md +0 -9
- package/docs/examples/messaging/create-sms.md +0 -8
- package/docs/examples/messaging/create-smtp-provider.md +0 -15
- package/docs/examples/messaging/create-subscriber.md +0 -4
- package/docs/examples/messaging/create-telesign-provider.md +0 -7
- package/docs/examples/messaging/create-textmagic-provider.md +0 -7
- package/docs/examples/messaging/create-topic.md +0 -4
- package/docs/examples/messaging/create-twilio-provider.md +0 -7
- package/docs/examples/messaging/create-vonage-provider.md +0 -7
- package/docs/examples/messaging/delete-provider.md +0 -2
- package/docs/examples/messaging/delete-subscriber.md +0 -3
- package/docs/examples/messaging/delete-topic.md +0 -2
- package/docs/examples/messaging/delete.md +0 -2
- package/docs/examples/messaging/get-message.md +0 -2
- package/docs/examples/messaging/get-provider.md +0 -2
- package/docs/examples/messaging/get-subscriber.md +0 -3
- package/docs/examples/messaging/get-topic.md +0 -2
- package/docs/examples/messaging/list-message-logs.md +0 -3
- package/docs/examples/messaging/list-messages.md +0 -3
- package/docs/examples/messaging/list-provider-logs.md +0 -3
- package/docs/examples/messaging/list-providers.md +0 -3
- package/docs/examples/messaging/list-subscriber-logs.md +0 -3
- package/docs/examples/messaging/list-subscribers.md +0 -4
- package/docs/examples/messaging/list-targets.md +0 -3
- package/docs/examples/messaging/list-topic-logs.md +0 -3
- package/docs/examples/messaging/list-topics.md +0 -3
- package/docs/examples/messaging/update-apns-provider.md +0 -9
- package/docs/examples/messaging/update-email.md +0 -13
- package/docs/examples/messaging/update-fcm-provider.md +0 -5
- package/docs/examples/messaging/update-mailgun-provider.md +0 -11
- package/docs/examples/messaging/update-msg91provider.md +0 -7
- package/docs/examples/messaging/update-push.md +0 -20
- package/docs/examples/messaging/update-sendgrid-provider.md +0 -9
- package/docs/examples/messaging/update-sms.md +0 -8
- package/docs/examples/messaging/update-smtp-provider.md +0 -15
- package/docs/examples/messaging/update-telesign-provider.md +0 -7
- package/docs/examples/messaging/update-textmagic-provider.md +0 -7
- package/docs/examples/messaging/update-topic.md +0 -4
- package/docs/examples/messaging/update-twilio-provider.md +0 -7
- package/docs/examples/messaging/update-vonage-provider.md +0 -7
- package/docs/examples/migrations/create-appwrite-migration.md +0 -5
- package/docs/examples/migrations/create-csv-migration.md +0 -4
- package/docs/examples/migrations/create-firebase-migration.md +0 -3
- package/docs/examples/migrations/create-n-host-migration.md +0 -9
- package/docs/examples/migrations/create-supabase-migration.md +0 -8
- package/docs/examples/migrations/delete.md +0 -2
- package/docs/examples/migrations/get-appwrite-report.md +0 -5
- package/docs/examples/migrations/get-firebase-report.md +0 -3
- package/docs/examples/migrations/get-n-host-report.md +0 -9
- package/docs/examples/migrations/get-supabase-report.md +0 -8
- package/docs/examples/migrations/get.md +0 -2
- package/docs/examples/migrations/list.md +0 -3
- package/docs/examples/migrations/retry.md +0 -2
- package/docs/examples/project/create-variable.md +0 -4
- package/docs/examples/project/delete-variable.md +0 -2
- package/docs/examples/project/get-usage.md +0 -4
- package/docs/examples/project/get-variable.md +0 -2
- package/docs/examples/project/list-variables.md +0 -1
- package/docs/examples/project/update-variable.md +0 -5
- package/docs/examples/projects/create-dev-key.md +0 -4
- package/docs/examples/projects/create-j-w-t.md +0 -4
- package/docs/examples/projects/create-key.md +0 -5
- package/docs/examples/projects/create-platform.md +0 -7
- package/docs/examples/projects/create-smtp-test.md +0 -11
- package/docs/examples/projects/create-webhook.md +0 -9
- package/docs/examples/projects/create.md +0 -14
- package/docs/examples/projects/delete-dev-key.md +0 -3
- package/docs/examples/projects/delete-email-template.md +0 -4
- package/docs/examples/projects/delete-key.md +0 -3
- package/docs/examples/projects/delete-platform.md +0 -3
- package/docs/examples/projects/delete-sms-template.md +0 -4
- package/docs/examples/projects/delete-webhook.md +0 -3
- package/docs/examples/projects/delete.md +0 -2
- package/docs/examples/projects/get-dev-key.md +0 -3
- package/docs/examples/projects/get-email-template.md +0 -4
- package/docs/examples/projects/get-key.md +0 -3
- package/docs/examples/projects/get-platform.md +0 -3
- package/docs/examples/projects/get-sms-template.md +0 -4
- package/docs/examples/projects/get-webhook.md +0 -3
- package/docs/examples/projects/get.md +0 -2
- package/docs/examples/projects/list-dev-keys.md +0 -3
- package/docs/examples/projects/list-keys.md +0 -2
- package/docs/examples/projects/list-platforms.md +0 -2
- package/docs/examples/projects/list-webhooks.md +0 -2
- package/docs/examples/projects/list.md +0 -3
- package/docs/examples/projects/update-api-status-all.md +0 -3
- package/docs/examples/projects/update-api-status.md +0 -4
- package/docs/examples/projects/update-auth-duration.md +0 -3
- package/docs/examples/projects/update-auth-limit.md +0 -3
- package/docs/examples/projects/update-auth-password-dictionary.md +0 -3
- package/docs/examples/projects/update-auth-password-history.md +0 -3
- package/docs/examples/projects/update-auth-sessions-limit.md +0 -3
- package/docs/examples/projects/update-auth-status.md +0 -4
- package/docs/examples/projects/update-dev-key.md +0 -5
- package/docs/examples/projects/update-email-template.md +0 -9
- package/docs/examples/projects/update-key.md +0 -6
- package/docs/examples/projects/update-memberships-privacy.md +0 -5
- package/docs/examples/projects/update-mock-numbers.md +0 -3
- package/docs/examples/projects/update-o-auth2.md +0 -6
- package/docs/examples/projects/update-personal-data-check.md +0 -3
- package/docs/examples/projects/update-platform.md +0 -7
- package/docs/examples/projects/update-service-status-all.md +0 -3
- package/docs/examples/projects/update-service-status.md +0 -4
- package/docs/examples/projects/update-session-alerts.md +0 -3
- package/docs/examples/projects/update-session-invalidation.md +0 -3
- package/docs/examples/projects/update-sms-template.md +0 -5
- package/docs/examples/projects/update-smtp.md +0 -11
- package/docs/examples/projects/update-team.md +0 -3
- package/docs/examples/projects/update-webhook-signature.md +0 -3
- package/docs/examples/projects/update-webhook.md +0 -10
- package/docs/examples/projects/update.md +0 -12
- package/docs/examples/proxy/create-a-p-i-rule.md +0 -2
- package/docs/examples/proxy/create-function-rule.md +0 -4
- package/docs/examples/proxy/create-redirect-rule.md +0 -6
- package/docs/examples/proxy/create-site-rule.md +0 -4
- package/docs/examples/proxy/delete-rule.md +0 -2
- package/docs/examples/proxy/get-rule.md +0 -2
- package/docs/examples/proxy/list-rules.md +0 -3
- package/docs/examples/proxy/update-rule-verification.md +0 -2
- package/docs/examples/sites/create-deployment.md +0 -7
- package/docs/examples/sites/create-duplicate-deployment.md +0 -3
- package/docs/examples/sites/create-template-deployment.md +0 -7
- package/docs/examples/sites/create-variable.md +0 -5
- package/docs/examples/sites/create-vcs-deployment.md +0 -5
- package/docs/examples/sites/create.md +0 -19
- package/docs/examples/sites/delete-deployment.md +0 -3
- package/docs/examples/sites/delete-log.md +0 -3
- package/docs/examples/sites/delete-variable.md +0 -3
- package/docs/examples/sites/delete.md +0 -2
- package/docs/examples/sites/get-deployment-download.md +0 -4
- package/docs/examples/sites/get-deployment.md +0 -3
- package/docs/examples/sites/get-log.md +0 -3
- package/docs/examples/sites/get-template.md +0 -2
- package/docs/examples/sites/get-usage.md +0 -3
- package/docs/examples/sites/get-variable.md +0 -3
- package/docs/examples/sites/get.md +0 -2
- package/docs/examples/sites/list-deployments.md +0 -4
- package/docs/examples/sites/list-frameworks.md +0 -1
- package/docs/examples/sites/list-logs.md +0 -3
- package/docs/examples/sites/list-specifications.md +0 -1
- package/docs/examples/sites/list-templates.md +0 -5
- package/docs/examples/sites/list-usage.md +0 -2
- package/docs/examples/sites/list-variables.md +0 -2
- package/docs/examples/sites/list.md +0 -3
- package/docs/examples/sites/update-deployment-status.md +0 -3
- package/docs/examples/sites/update-site-deployment.md +0 -3
- package/docs/examples/sites/update-variable.md +0 -6
- package/docs/examples/sites/update.md +0 -19
- package/docs/examples/storage/create-bucket.md +0 -11
- package/docs/examples/storage/create-file.md +0 -5
- package/docs/examples/storage/delete-bucket.md +0 -2
- package/docs/examples/storage/delete-file.md +0 -3
- package/docs/examples/storage/get-bucket-usage.md +0 -3
- package/docs/examples/storage/get-bucket.md +0 -2
- package/docs/examples/storage/get-file-download.md +0 -4
- package/docs/examples/storage/get-file-preview.md +0 -15
- package/docs/examples/storage/get-file-view.md +0 -4
- package/docs/examples/storage/get-file.md +0 -3
- package/docs/examples/storage/get-usage.md +0 -2
- package/docs/examples/storage/list-buckets.md +0 -3
- package/docs/examples/storage/list-files.md +0 -4
- package/docs/examples/storage/update-bucket.md +0 -11
- package/docs/examples/storage/update-file.md +0 -5
- package/docs/examples/tables/create-boolean-column.md +0 -7
- package/docs/examples/tables/create-datetime-column.md +0 -7
- package/docs/examples/tables/create-email-column.md +0 -7
- package/docs/examples/tables/create-enum-column.md +0 -8
- package/docs/examples/tables/create-float-column.md +0 -9
- package/docs/examples/tables/create-index.md +0 -8
- package/docs/examples/tables/create-integer-column.md +0 -9
- package/docs/examples/tables/create-ip-column.md +0 -7
- package/docs/examples/tables/create-relationship-column.md +0 -9
- package/docs/examples/tables/create-row.md +0 -6
- package/docs/examples/tables/create-rows.md +0 -4
- package/docs/examples/tables/create-string-column.md +0 -9
- package/docs/examples/tables/create-url-column.md +0 -7
- package/docs/examples/tables/create.md +0 -7
- package/docs/examples/tables/decrement-row-column.md +0 -7
- package/docs/examples/tables/delete-column.md +0 -4
- package/docs/examples/tables/delete-index.md +0 -4
- package/docs/examples/tables/delete-row.md +0 -4
- package/docs/examples/tables/delete-rows.md +0 -4
- package/docs/examples/tables/delete.md +0 -3
- package/docs/examples/tables/get-column.md +0 -4
- package/docs/examples/tables/get-index.md +0 -4
- package/docs/examples/tables/get-row.md +0 -5
- package/docs/examples/tables/get-usage.md +0 -4
- package/docs/examples/tables/get.md +0 -3
- package/docs/examples/tables/increment-row-column.md +0 -7
- package/docs/examples/tables/list-columns.md +0 -4
- package/docs/examples/tables/list-indexes.md +0 -4
- package/docs/examples/tables/list-logs.md +0 -4
- package/docs/examples/tables/list-row-logs.md +0 -5
- package/docs/examples/tables/list-rows.md +0 -4
- package/docs/examples/tables/list.md +0 -4
- package/docs/examples/tables/update-boolean-column.md +0 -7
- package/docs/examples/tables/update-datetime-column.md +0 -7
- package/docs/examples/tables/update-email-column.md +0 -7
- package/docs/examples/tables/update-enum-column.md +0 -8
- package/docs/examples/tables/update-float-column.md +0 -9
- package/docs/examples/tables/update-integer-column.md +0 -9
- package/docs/examples/tables/update-ip-column.md +0 -7
- package/docs/examples/tables/update-relationship-column.md +0 -6
- package/docs/examples/tables/update-row.md +0 -6
- package/docs/examples/tables/update-rows.md +0 -5
- package/docs/examples/tables/update-string-column.md +0 -8
- package/docs/examples/tables/update-url-column.md +0 -7
- package/docs/examples/tables/update.md +0 -7
- package/docs/examples/tables/upsert-row.md +0 -4
- package/docs/examples/tables/upsert-rows.md +0 -3
- package/docs/examples/teams/create-membership.md +0 -8
- package/docs/examples/teams/create.md +0 -4
- package/docs/examples/teams/delete-membership.md +0 -3
- package/docs/examples/teams/delete.md +0 -2
- package/docs/examples/teams/get-membership.md +0 -3
- package/docs/examples/teams/get-prefs.md +0 -2
- package/docs/examples/teams/get.md +0 -2
- package/docs/examples/teams/list-logs.md +0 -3
- package/docs/examples/teams/list-memberships.md +0 -4
- package/docs/examples/teams/list.md +0 -3
- package/docs/examples/teams/update-membership-status.md +0 -5
- package/docs/examples/teams/update-membership.md +0 -4
- package/docs/examples/teams/update-name.md +0 -3
- package/docs/examples/teams/update-prefs.md +0 -3
- package/docs/examples/tokens/create-file-token.md +0 -4
- package/docs/examples/tokens/delete.md +0 -2
- package/docs/examples/tokens/get.md +0 -2
- package/docs/examples/tokens/list.md +0 -4
- package/docs/examples/tokens/update.md +0 -3
- package/docs/examples/users/create-argon2user.md +0 -5
- package/docs/examples/users/create-bcrypt-user.md +0 -5
- package/docs/examples/users/create-j-w-t.md +0 -4
- package/docs/examples/users/create-m-d5user.md +0 -5
- package/docs/examples/users/create-mfa-recovery-codes.md +0 -2
- package/docs/examples/users/create-p-h-pass-user.md +0 -5
- package/docs/examples/users/create-s-h-a-user.md +0 -6
- package/docs/examples/users/create-scrypt-modified-user.md +0 -8
- package/docs/examples/users/create-scrypt-user.md +0 -10
- package/docs/examples/users/create-session.md +0 -2
- package/docs/examples/users/create-target.md +0 -7
- package/docs/examples/users/create-token.md +0 -4
- package/docs/examples/users/create.md +0 -6
- package/docs/examples/users/delete-identity.md +0 -2
- package/docs/examples/users/delete-mfa-authenticator.md +0 -3
- package/docs/examples/users/delete-session.md +0 -3
- package/docs/examples/users/delete-sessions.md +0 -2
- package/docs/examples/users/delete-target.md +0 -3
- package/docs/examples/users/delete.md +0 -2
- package/docs/examples/users/get-mfa-recovery-codes.md +0 -2
- package/docs/examples/users/get-prefs.md +0 -2
- package/docs/examples/users/get-target.md +0 -3
- package/docs/examples/users/get-usage.md +0 -2
- package/docs/examples/users/get.md +0 -2
- package/docs/examples/users/list-identities.md +0 -3
- package/docs/examples/users/list-logs.md +0 -3
- package/docs/examples/users/list-memberships.md +0 -4
- package/docs/examples/users/list-mfa-factors.md +0 -2
- package/docs/examples/users/list-sessions.md +0 -2
- package/docs/examples/users/list-targets.md +0 -3
- package/docs/examples/users/list.md +0 -3
- package/docs/examples/users/update-email-verification.md +0 -3
- package/docs/examples/users/update-email.md +0 -3
- package/docs/examples/users/update-labels.md +0 -3
- package/docs/examples/users/update-mfa-recovery-codes.md +0 -2
- package/docs/examples/users/update-mfa.md +0 -3
- package/docs/examples/users/update-name.md +0 -3
- package/docs/examples/users/update-password.md +0 -3
- package/docs/examples/users/update-phone-verification.md +0 -3
- package/docs/examples/users/update-phone.md +0 -3
- package/docs/examples/users/update-prefs.md +0 -3
- package/docs/examples/users/update-status.md +0 -3
- package/docs/examples/users/update-target.md +0 -6
- package/docs/examples/vcs/create-repository-detection.md +0 -5
- package/docs/examples/vcs/create-repository.md +0 -4
- package/docs/examples/vcs/delete-installation.md +0 -2
- package/docs/examples/vcs/get-installation.md +0 -2
- package/docs/examples/vcs/get-repository-contents.md +0 -5
- package/docs/examples/vcs/get-repository.md +0 -3
- package/docs/examples/vcs/list-installations.md +0 -3
- package/docs/examples/vcs/list-repositories.md +0 -4
- package/docs/examples/vcs/list-repository-branches.md +0 -3
- package/docs/examples/vcs/update-external-deployments.md +0 -4
- package/functions/Starter function/.prettierrc.json +0 -6
- package/functions/Starter function/README.md +0 -48
- package/functions/Starter function/package-lock.json +0 -60
- package/functions/Starter function/package.json +0 -16
- package/functions/Starter function/src/main.js +0 -35
- package/generate/appwrite.d.ts +0 -55
- package/generate/appwrite.db.ts +0 -75
- package/index.js +0 -109
- package/lib/client-generation/languages/typescript.js +0 -65
- package/lib/client.js +0 -259
- package/lib/commands/account.js +0 -2074
- package/lib/commands/avatars.js +0 -491
- package/lib/commands/console.js +0 -129
- package/lib/commands/databases.js +0 -2972
- package/lib/commands/functions.js +0 -1737
- package/lib/commands/generic.js +0 -328
- package/lib/commands/graphql.js +0 -128
- package/lib/commands/health.js +0 -891
- package/lib/commands/init.js +0 -566
- package/lib/commands/locale.js +0 -324
- package/lib/commands/messaging.js +0 -2970
- package/lib/commands/migrations.js +0 -751
- package/lib/commands/organizations.js +0 -48
- package/lib/commands/project.js +0 -308
- package/lib/commands/projects.js +0 -2615
- package/lib/commands/proxy.js +0 -406
- package/lib/commands/pull.js +0 -474
- package/lib/commands/push.js +0 -2117
- package/lib/commands/run.js +0 -330
- package/lib/commands/sites.js +0 -1663
- package/lib/commands/storage.js +0 -990
- package/lib/commands/tables.js +0 -2607
- package/lib/commands/teams.js +0 -682
- package/lib/commands/tokens.js +0 -261
- package/lib/commands/types.js +0 -191
- package/lib/commands/users.js +0 -2035
- package/lib/commands/vcs.js +0 -484
- package/lib/config.js +0 -717
- package/lib/emulation/docker.js +0 -264
- package/lib/emulation/utils.js +0 -186
- package/lib/exception.js +0 -9
- package/lib/id.js +0 -30
- package/lib/paginate.js +0 -52
- package/lib/parser.js +0 -246
- package/lib/questions.js +0 -1006
- package/lib/sdks.js +0 -60
- package/lib/spinner.js +0 -104
- package/lib/type-generation/attribute.js +0 -16
- package/lib/type-generation/languages/dart.js +0 -196
- package/lib/type-generation/languages/java.js +0 -130
- package/lib/type-generation/languages/javascript.js +0 -102
- package/lib/type-generation/languages/kotlin.js +0 -85
- package/lib/type-generation/languages/language.js +0 -125
- package/lib/type-generation/languages/php.js +0 -110
- package/lib/type-generation/languages/swift.js +0 -169
- package/lib/type-generation/languages/typescript.js +0 -105
- package/lib/utils.js +0 -289
- package/lib/validations.js +0 -17
- package/scoop/appwrite.json +0 -30
- package/sites/JavaScript starter2/.env.example +0 -3
- package/sites/JavaScript starter2/LICENSE +0 -21
- package/sites/JavaScript starter2/images/appwrite.svg +0 -8
- package/sites/JavaScript starter2/images/javascript.svg +0 -5
- package/sites/JavaScript starter2/index.html +0 -250
- package/sites/JavaScript starter2/lib/appwrite.js +0 -10
- package/sites/JavaScript starter2/package-lock.json +0 -1431
- package/sites/JavaScript starter2/package.json +0 -21
- package/sites/JavaScript starter2/readme.md +0 -26
- package/sites/JavaScript starter2/src/javascript.svg +0 -1
- package/sites/JavaScript starter2/style/app.css +0 -20
- package/sites/JavaScript starter2/vite.config.js +0 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../../lib/type-generation/languages/language.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED,8BAAsB,YAAY;;IAOhC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAW1C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI1C,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI/C,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAM1C,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAI3C;;OAEG;IACH,QAAQ,CAAC,OAAO,CACd,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,UAAU,EAAE,EAC1B,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM;IAET;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;OAEG;IACH,QAAQ,CAAC,WAAW,IAAI,MAAM;IAE9B;;OAEG;IACH,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM;CACtD;AAKD,wBAAgB,cAAc,IAAI,MAAM,CAsCvC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
export class LanguageMeta {
|
|
4
|
+
constructor() {
|
|
5
|
+
if (new.target === LanguageMeta) {
|
|
6
|
+
throw new TypeError("Abstract classes can't be instantiated.");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
static toKebabCase(string) {
|
|
10
|
+
return string
|
|
11
|
+
.replace(/[^a-zA-Z0-9\s-_]/g, "") // Remove invalid characters
|
|
12
|
+
.replace(/([a-z])([A-Z])/g, "$1-$2") // Add hyphen between camelCase
|
|
13
|
+
.replace(/([A-Z])([A-Z][a-z])/g, "$1-$2") // Add hyphen between PascalCase
|
|
14
|
+
.replace(/[_\s]+/g, "-") // Replace spaces and underscores with hyphens
|
|
15
|
+
.replace(/^-+|-+$/g, "") // Remove leading and trailing hyphens
|
|
16
|
+
.replace(/--+/g, "-") // Replace multiple hyphens with a single hyphen
|
|
17
|
+
.toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
static toSnakeCase(string) {
|
|
20
|
+
return this.toKebabCase(string).replace(/-/g, "_");
|
|
21
|
+
}
|
|
22
|
+
static toUpperSnakeCase(string) {
|
|
23
|
+
return this.toSnakeCase(string).toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
static toCamelCase(string) {
|
|
26
|
+
return this.toKebabCase(string).replace(/-([a-z0-9])/g, (g) => g[1].toUpperCase());
|
|
27
|
+
}
|
|
28
|
+
static toPascalCase(string) {
|
|
29
|
+
return this.toCamelCase(string).replace(/^./, (g) => g.toUpperCase());
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns true if the language uses a single file for all types.
|
|
33
|
+
*/
|
|
34
|
+
isSingleFile() {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const existsFiles = (...files) => files.some((file) => fs.existsSync(path.join(process.cwd(), file)));
|
|
39
|
+
export function detectLanguage() {
|
|
40
|
+
if (existsFiles("tsconfig.json", "deno.json")) {
|
|
41
|
+
return "ts";
|
|
42
|
+
}
|
|
43
|
+
if (existsFiles("package.json")) {
|
|
44
|
+
return "js";
|
|
45
|
+
}
|
|
46
|
+
if (existsFiles("composer.json")) {
|
|
47
|
+
return "php";
|
|
48
|
+
}
|
|
49
|
+
if (existsFiles("requirements.txt", "Pipfile", "pyproject.toml")) {
|
|
50
|
+
return "python";
|
|
51
|
+
}
|
|
52
|
+
if (existsFiles("Gemfile", "Rakefile")) {
|
|
53
|
+
return "ruby";
|
|
54
|
+
}
|
|
55
|
+
if (existsFiles("build.gradle.kts")) {
|
|
56
|
+
return "kotlin";
|
|
57
|
+
}
|
|
58
|
+
if (existsFiles("build.gradle", "pom.xml")) {
|
|
59
|
+
return "java";
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
if (fs.readdirSync(process.cwd()).some((file) => file.endsWith(".csproj"))) {
|
|
63
|
+
return "dotnet";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Directory not readable, skip .csproj detection
|
|
68
|
+
}
|
|
69
|
+
if (existsFiles("Package.swift")) {
|
|
70
|
+
return "swift";
|
|
71
|
+
}
|
|
72
|
+
if (existsFiles("pubspec.yaml")) {
|
|
73
|
+
return "dart";
|
|
74
|
+
}
|
|
75
|
+
throw new Error("Could not detect language, please specify with -l");
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../../../lib/type-generation/languages/language.ts"],"names":[],"mappings":"A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C,CAAC,EACtE,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,iDAAiD;IACnD,CAAC;IACD,IAAI,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,IAAI,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LanguageMeta, Attribute, Collection } from "./language.js";
|
|
2
|
+
export declare class PHP extends LanguageMeta {
|
|
3
|
+
getType(attribute: Attribute, collections?: Collection[], collectionName?: string): string;
|
|
4
|
+
getTemplate(): string;
|
|
5
|
+
getFileName(collection: Collection): string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=php.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../../../lib/type-generation/languages/php.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEpE,qBAAa,GAAI,SAAQ,YAAY;IACnC,OAAO,CACL,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,UAAU,EAAE,EAC1B,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM;IA2DT,WAAW,IAAI,MAAM;IAyDrB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;CAG5C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { AttributeType } from "../attribute.js";
|
|
2
|
+
import { LanguageMeta } from "./language.js";
|
|
3
|
+
export class PHP extends LanguageMeta {
|
|
4
|
+
getType(attribute, collections, collectionName) {
|
|
5
|
+
if (attribute.array) {
|
|
6
|
+
return "array";
|
|
7
|
+
}
|
|
8
|
+
let type = "";
|
|
9
|
+
switch (attribute.type) {
|
|
10
|
+
case AttributeType.STRING:
|
|
11
|
+
case AttributeType.EMAIL:
|
|
12
|
+
case AttributeType.DATETIME:
|
|
13
|
+
type = "string";
|
|
14
|
+
if (attribute.format === AttributeType.ENUM) {
|
|
15
|
+
type =
|
|
16
|
+
LanguageMeta.toPascalCase(collectionName) +
|
|
17
|
+
LanguageMeta.toPascalCase(attribute.key);
|
|
18
|
+
}
|
|
19
|
+
break;
|
|
20
|
+
case AttributeType.INTEGER:
|
|
21
|
+
type = "int";
|
|
22
|
+
break;
|
|
23
|
+
case AttributeType.FLOAT:
|
|
24
|
+
type = "float";
|
|
25
|
+
break;
|
|
26
|
+
case AttributeType.BOOLEAN:
|
|
27
|
+
type = "bool";
|
|
28
|
+
break;
|
|
29
|
+
case AttributeType.RELATIONSHIP:
|
|
30
|
+
const relatedCollection = collections?.find((c) => c.$id === attribute.relatedCollection);
|
|
31
|
+
if (!relatedCollection) {
|
|
32
|
+
throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
|
|
33
|
+
}
|
|
34
|
+
type = LanguageMeta.toPascalCase(relatedCollection.name);
|
|
35
|
+
if ((attribute.relationType === "oneToMany" &&
|
|
36
|
+
attribute.side === "parent") ||
|
|
37
|
+
(attribute.relationType === "manyToOne" &&
|
|
38
|
+
attribute.side === "child") ||
|
|
39
|
+
attribute.relationType === "manyToMany") {
|
|
40
|
+
type = "array";
|
|
41
|
+
}
|
|
42
|
+
break;
|
|
43
|
+
case AttributeType.POINT:
|
|
44
|
+
case AttributeType.LINESTRING:
|
|
45
|
+
case AttributeType.POLYGON:
|
|
46
|
+
type = "array";
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`Unknown attribute type: ${attribute.type}`);
|
|
50
|
+
}
|
|
51
|
+
if (!attribute.required && attribute.default === null) {
|
|
52
|
+
type += "|null";
|
|
53
|
+
}
|
|
54
|
+
return type;
|
|
55
|
+
}
|
|
56
|
+
getTemplate() {
|
|
57
|
+
return `<?php
|
|
58
|
+
namespace Appwrite\\Models;
|
|
59
|
+
|
|
60
|
+
// This file is auto-generated by the Appwrite CLI.
|
|
61
|
+
// You can regenerate it by running \`appwrite ${process.argv.slice(2).join(" ")}\`.
|
|
62
|
+
|
|
63
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
64
|
+
<% if (attribute.type === 'relationship' && !(attribute.relationType === 'manyToMany') && !(attribute.relationType === 'oneToMany' && attribute.side === 'parent')) { -%>
|
|
65
|
+
use Appwrite\\Models\\<%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>;
|
|
66
|
+
|
|
67
|
+
<% } -%>
|
|
68
|
+
<% } -%>
|
|
69
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
70
|
+
<% if (attribute.format === 'enum') { -%>
|
|
71
|
+
enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>: string {
|
|
72
|
+
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
73
|
+
case <%- toUpperSnakeCase(element) %> = '<%- element %>';
|
|
74
|
+
<% } -%>
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
<% } -%>
|
|
78
|
+
<% } -%>
|
|
79
|
+
class <%- toPascalCase(collection.name) %> {
|
|
80
|
+
<% for (const attribute of collection.attributes ){ -%>
|
|
81
|
+
private <%- getType(attribute, collections, collection.name) %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
82
|
+
<% } -%>
|
|
83
|
+
|
|
84
|
+
public function __construct(
|
|
85
|
+
<% for (const attribute of collection.attributes ){ -%>
|
|
86
|
+
<% if (attribute.required) { -%>
|
|
87
|
+
<%- getType(attribute, collections, collection.name).replace('|null', '') %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %><% if (collection.attributes.indexOf(attribute) < collection.attributes.length - 1) { %>,<% } %>
|
|
88
|
+
<% } else { -%>
|
|
89
|
+
?<%- getType(attribute, collections, collection.name).replace('|null', '') %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %> = null<% if (collection.attributes.indexOf(attribute) < collection.attributes.length - 1) { %>,<% } %>
|
|
90
|
+
<% } -%>
|
|
91
|
+
<% } -%>
|
|
92
|
+
) {
|
|
93
|
+
<% for (const attribute of collection.attributes ){ -%>
|
|
94
|
+
$this-><%- strict ? toCamelCase(attribute.key) : attribute.key %> = $<%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
95
|
+
<% } -%>
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
99
|
+
public function get<%- toPascalCase(attribute.key) %>(): <%- getType(attribute, collections, collection.name) %> {
|
|
100
|
+
return $this-><%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public function set<%- toPascalCase(attribute.key) %>(<%- getType(attribute, collections, collection.name) %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %>): void {
|
|
104
|
+
$this-><%- strict ? toCamelCase(attribute.key) : attribute.key %> = $<%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
105
|
+
}
|
|
106
|
+
<% if (index < collection.attributes.length - 1) { %>
|
|
107
|
+
<% } -%>
|
|
108
|
+
<% } -%>
|
|
109
|
+
}
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
getFileName(collection) {
|
|
113
|
+
return LanguageMeta.toPascalCase(collection.name) + ".php";
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.js","sourceRoot":"","sources":["../../../../lib/type-generation/languages/php.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAyB,MAAM,eAAe,CAAC;AAEpE,MAAM,OAAO,GAAI,SAAQ,YAAY;IACnC,OA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oBAC9B,CAAC,SAAS,CAAC,YAAY,KAAK,WAAW;wBACrC,SAAS,CAAC,IAAI,KAAK,OAAO,CAAC;oBAC7B,SAAS,CAAC,YAAY,KAAK,YAAY,EACvC,CAAC;oBACD,IAAI,GAAG,OAAO,CAAC;gBACjB,CAAC;gBACD,MAAM;YACR,KAAK,aAAa,CAAC,KAAK,CAAC;YACzB,KAAK,aAAa,CAAC,UAAU,CAAC;YAC9B,KAAK,aAAa,CAAC,OAAO;gBACxB,IAAI,GAAG,OAAO,CAAC;gBACf,MAAM;YACR;gBACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YACtD,IAAI,IAAI,OAAO,CAAC;QAClB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW;QACT,OAAO;;;;iDAIsC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiD/E,CAAC;IACA,CAAC;IAED,WAAW,CAAC,UAAsB;QAChC,OAAO,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;IAC7D,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LanguageMeta, Attribute, Collection } from "./language.js";
|
|
2
|
+
export declare class Swift extends LanguageMeta {
|
|
3
|
+
getType(attribute: Attribute, collections?: Collection[], collectionName?: string): string;
|
|
4
|
+
getTemplate(): string;
|
|
5
|
+
getFileName(collection: Collection): string;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=swift.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swift.d.ts","sourceRoot":"","sources":["../../../../lib/type-generation/languages/swift.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEpE,qBAAa,KAAM,SAAQ,YAAY;IACrC,OAAO,CACL,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,UAAU,EAAE,EAC1B,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM;IA+DT,WAAW,IAAI,MAAM;IAoHrB,WAAW,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM;CAG5C"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { AttributeType } from "../attribute.js";
|
|
2
|
+
import { LanguageMeta } from "./language.js";
|
|
3
|
+
export class Swift extends LanguageMeta {
|
|
4
|
+
getType(attribute, collections, collectionName) {
|
|
5
|
+
let type = "";
|
|
6
|
+
switch (attribute.type) {
|
|
7
|
+
case AttributeType.STRING:
|
|
8
|
+
case AttributeType.EMAIL:
|
|
9
|
+
case AttributeType.DATETIME:
|
|
10
|
+
type = "String";
|
|
11
|
+
if (attribute.format === AttributeType.ENUM) {
|
|
12
|
+
type =
|
|
13
|
+
LanguageMeta.toPascalCase(collectionName) +
|
|
14
|
+
LanguageMeta.toPascalCase(attribute.key);
|
|
15
|
+
}
|
|
16
|
+
break;
|
|
17
|
+
case AttributeType.INTEGER:
|
|
18
|
+
type = "Int";
|
|
19
|
+
break;
|
|
20
|
+
case AttributeType.FLOAT:
|
|
21
|
+
type = "Double";
|
|
22
|
+
break;
|
|
23
|
+
case AttributeType.BOOLEAN:
|
|
24
|
+
type = "Bool";
|
|
25
|
+
break;
|
|
26
|
+
case AttributeType.RELATIONSHIP:
|
|
27
|
+
const relatedCollection = collections?.find((c) => c.$id === attribute.relatedCollection);
|
|
28
|
+
if (!relatedCollection) {
|
|
29
|
+
throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
|
|
30
|
+
}
|
|
31
|
+
type = LanguageMeta.toPascalCase(relatedCollection.name);
|
|
32
|
+
if ((attribute.relationType === "oneToMany" &&
|
|
33
|
+
attribute.side === "parent") ||
|
|
34
|
+
(attribute.relationType === "manyToOne" &&
|
|
35
|
+
attribute.side === "child") ||
|
|
36
|
+
attribute.relationType === "manyToMany") {
|
|
37
|
+
type = `[${type}]`;
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case AttributeType.POINT:
|
|
41
|
+
type = "[Double]";
|
|
42
|
+
break;
|
|
43
|
+
case AttributeType.LINESTRING:
|
|
44
|
+
type = "[[Double]]";
|
|
45
|
+
break;
|
|
46
|
+
case AttributeType.POLYGON:
|
|
47
|
+
type = "[[[Double]]]";
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
throw new Error(`Unknown attribute type: ${attribute.type}`);
|
|
51
|
+
}
|
|
52
|
+
if (attribute.array) {
|
|
53
|
+
type = "[" + type + "]";
|
|
54
|
+
}
|
|
55
|
+
if (!attribute.required && attribute.default === null) {
|
|
56
|
+
type += "?";
|
|
57
|
+
}
|
|
58
|
+
return type;
|
|
59
|
+
}
|
|
60
|
+
getTemplate() {
|
|
61
|
+
return `import Foundation
|
|
62
|
+
|
|
63
|
+
/// This file is auto-generated by the Appwrite CLI.
|
|
64
|
+
/// You can regenerate it by running \`appwrite ${process.argv.slice(2).join(" ")}\`.
|
|
65
|
+
|
|
66
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
67
|
+
<% if (attribute.format === 'enum') { -%>
|
|
68
|
+
public enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>: String, Codable, CaseIterable {
|
|
69
|
+
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
70
|
+
case <%- strict ? toCamelCase(element) : element %> = "<%- element %>"
|
|
71
|
+
<% } -%>
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
<% } -%>
|
|
75
|
+
<% } -%>
|
|
76
|
+
public class <%- toPascalCase(collection.name) %>: Codable {
|
|
77
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
78
|
+
public let <%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections, collection.name) %>
|
|
79
|
+
<% } %>
|
|
80
|
+
enum CodingKeys: String, CodingKey {
|
|
81
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
82
|
+
case <%- strict ? toCamelCase(attribute.key) : attribute.key %> = "<%- attribute.key %>"
|
|
83
|
+
<% } -%>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
public init(
|
|
87
|
+
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
88
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections, collection.name) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
89
|
+
<% } -%>
|
|
90
|
+
) {
|
|
91
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
92
|
+
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = <%- strict ? toCamelCase(attribute.key) : attribute.key %>
|
|
93
|
+
<% } -%>
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public required init(from decoder: Decoder) throws {
|
|
97
|
+
let container = try decoder.container(keyedBy: CodingKeys.self)
|
|
98
|
+
|
|
99
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
100
|
+
<% if (!(!attribute.required && attribute.default === null)) { -%>
|
|
101
|
+
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = try container.decode(<%- getType(attribute, collections, collection.name).replace('?', '') %>.self, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
102
|
+
<% } else { -%>
|
|
103
|
+
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = try container.decodeIfPresent(<%- getType(attribute, collections, collection.name).replace('?', '') %>.self, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
104
|
+
<% } -%>
|
|
105
|
+
<% } -%>
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public func encode(to encoder: Encoder) throws {
|
|
109
|
+
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
110
|
+
|
|
111
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
112
|
+
<% if (!(!attribute.required && attribute.default === null)) { -%>
|
|
113
|
+
try container.encode(<%- strict ? toCamelCase(attribute.key) : attribute.key %>, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
114
|
+
<% } else { -%>
|
|
115
|
+
try container.encodeIfPresent(<%- strict ? toCamelCase(attribute.key) : attribute.key %>, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
116
|
+
<% } -%>
|
|
117
|
+
<% } -%>
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public func toMap() -> [String: Any] {
|
|
121
|
+
return [
|
|
122
|
+
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
123
|
+
<% if (attribute.type === 'relationship') { -%>
|
|
124
|
+
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %> as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
125
|
+
<% } else if (attribute.array && attribute.type !== 'string' && attribute.type !== 'integer' && attribute.type !== 'float' && attribute.type !== 'boolean') { -%>
|
|
126
|
+
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %>?.map { $0.toMap() } as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
127
|
+
<% } else { -%>
|
|
128
|
+
"<%- attribute.key %>": <%- strict ? toCamelCase(attribute.key) : attribute.key %> as Any<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
129
|
+
<% } -%>
|
|
130
|
+
<% } -%>
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public static func from(map: [String: Any]) -> <%- toPascalCase(collection.name) %> {
|
|
135
|
+
return <%- toPascalCase(collection.name) %>(
|
|
136
|
+
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
137
|
+
<% if (attribute.type === 'relationship') { -%>
|
|
138
|
+
<% if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') { -%>
|
|
139
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [<%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %>]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
140
|
+
<% } else { -%>
|
|
141
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> <%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollection).name) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
142
|
+
<% } -%>
|
|
143
|
+
<% } else if (attribute.array) { -%>
|
|
144
|
+
<% if (attribute.type === 'string') { -%>
|
|
145
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [String]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
146
|
+
<% } else if (attribute.type === 'integer') { -%>
|
|
147
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [Int]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
148
|
+
<% } else if (attribute.type === 'float') { -%>
|
|
149
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [Double]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
150
|
+
<% } else if (attribute.type === 'boolean') { -%>
|
|
151
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [Bool]<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
152
|
+
<% } else { -%>
|
|
153
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: (map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [[String: Any]])<% if (!attribute.required) { %>?<% } %>.map { <%- toPascalCase(attribute.type) %>.from(map: $0) }<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
154
|
+
<% } -%>
|
|
155
|
+
<% } else { -%>
|
|
156
|
+
<% if ((attribute.type === 'string' || attribute.type === 'email' || attribute.type === 'datetime') && attribute.format !== 'enum') { -%>
|
|
157
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> String<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
158
|
+
<% } else if (attribute.type === 'string' && attribute.format === 'enum') { -%>
|
|
159
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>(rawValue: map["<%- attribute.key %>"] as! String)!<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
160
|
+
<% } else if (attribute.type === 'integer') { -%>
|
|
161
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Int<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
162
|
+
<% } else if (attribute.type === 'float') { -%>
|
|
163
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Double<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
164
|
+
<% } else if (attribute.type === 'boolean') { -%>
|
|
165
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Bool<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
166
|
+
<% } else { -%>
|
|
167
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- toPascalCase(attribute.type) %>.from(map: map["<%- attribute.key %>"] as! [String: Any])<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
168
|
+
<% } -%>
|
|
169
|
+
<% } -%>
|
|
170
|
+
<% } -%>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
}`;
|
|
174
|
+
}
|
|
175
|
+
getFileName(collection) {
|
|
176
|
+
return LanguageMeta.toPascalCase(collection.name) + ".swift";
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=swift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swift.js","sourceRoot":"","sources":["../../../../lib/type-generation/languages/swift.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAyB,MAAM,eAAe,CAAC;AAEpE,MAAM,OAAO,KAAM,SAAQ,YAAY;IACrC,OAAO,CACL,SAAoB,EACpB,WAA0B,EAC1B,cAAuB;QAEvB,IAAI,IAAI,GAAG,EAAE,CAAC;QACd,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;YACvB,KAAK,aAAa,CAAC,MAAM,CAAC;YAC1B,KAAK,aAAa,CAAC,KAAK,CAAC;YACzB,KAAK,aAAa,CAAC,QAAQ;gBACzB,IAAI,GAAG,QAAQ,CAAC;gBAChB,IAAI,SAAS,CAAC,MAAM,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;oBAC5C,IAAI;wBACF,YAAY,CAAC,YAAY,CAAC,cAAe,CAAC;4BAC1C,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBAC7C,CAAC;gBACD,MAAM;YACR,KAAK,aAAa,CAAC,OAAO;gBACxB,IAAI,GAAG,KAAK,CAAC;gBACb,MAAM;YACR,KAAK,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,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,SAAS,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YACtD,IAAI,IAAI,GAAG,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW;QACT,OAAO;;;kDAGuC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6G/E,CAAC;IACD,CAAC;IAED,WAAW,CAAC,UAAsB;QAChC,OAAO,YAAY,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LanguageMeta, Attribute, Collection } from "./language.js";
|
|
2
|
+
export declare class TypeScript extends LanguageMeta {
|
|
3
|
+
getType(attribute: Attribute, collections?: Collection[], collectionName?: string): string;
|
|
4
|
+
isSingleFile(): boolean;
|
|
5
|
+
private _getAppwriteDependency;
|
|
6
|
+
getTemplate(): string;
|
|
7
|
+
getFileName(_: Collection | undefined): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../../lib/type-generation/languages/typescript.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEpE,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CACL,SAAS,EAAE,SAAS,EACpB,WAAW,CAAC,EAAE,UAAU,EAAE,EAC1B,cAAc,CAAC,EAAE,MAAM,GACtB,MAAM;IAiET,YAAY,IAAI,OAAO;IAIvB,OAAO,CAAC,sBAAsB;IAmB9B,WAAW,IAAI,MAAM;IA+BrB,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM;CAG/C"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { AttributeType } from "../attribute.js";
|
|
4
|
+
import { LanguageMeta } from "./language.js";
|
|
5
|
+
export class TypeScript extends LanguageMeta {
|
|
6
|
+
getType(attribute, collections, collectionName) {
|
|
7
|
+
let type = "";
|
|
8
|
+
switch (attribute.type) {
|
|
9
|
+
case AttributeType.STRING:
|
|
10
|
+
case AttributeType.EMAIL:
|
|
11
|
+
case AttributeType.DATETIME:
|
|
12
|
+
case AttributeType.IP:
|
|
13
|
+
case AttributeType.URL:
|
|
14
|
+
type = "string";
|
|
15
|
+
if (attribute.format === AttributeType.ENUM) {
|
|
16
|
+
type =
|
|
17
|
+
LanguageMeta.toPascalCase(collectionName) +
|
|
18
|
+
LanguageMeta.toPascalCase(attribute.key);
|
|
19
|
+
}
|
|
20
|
+
break;
|
|
21
|
+
case AttributeType.INTEGER:
|
|
22
|
+
type = "number";
|
|
23
|
+
break;
|
|
24
|
+
case AttributeType.FLOAT:
|
|
25
|
+
type = "number";
|
|
26
|
+
break;
|
|
27
|
+
case AttributeType.BOOLEAN:
|
|
28
|
+
type = "boolean";
|
|
29
|
+
break;
|
|
30
|
+
case AttributeType.RELATIONSHIP:
|
|
31
|
+
const relatedCollection = collections?.find((c) => c.$id === attribute.relatedCollection);
|
|
32
|
+
if (!relatedCollection) {
|
|
33
|
+
throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
|
|
34
|
+
}
|
|
35
|
+
type = LanguageMeta.toPascalCase(relatedCollection.name);
|
|
36
|
+
if ((attribute.relationType === "oneToMany" &&
|
|
37
|
+
attribute.side === "parent") ||
|
|
38
|
+
(attribute.relationType === "manyToOne" &&
|
|
39
|
+
attribute.side === "child") ||
|
|
40
|
+
attribute.relationType === "manyToMany") {
|
|
41
|
+
type = `${type}[]`;
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case AttributeType.POINT:
|
|
45
|
+
type = "Array<number>";
|
|
46
|
+
break;
|
|
47
|
+
case AttributeType.LINESTRING:
|
|
48
|
+
type = "Array<Array<number>>";
|
|
49
|
+
break;
|
|
50
|
+
case AttributeType.POLYGON:
|
|
51
|
+
type = "Array<Array<Array<number>>>";
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
throw new Error(`Unknown attribute type: ${attribute.type}`);
|
|
55
|
+
}
|
|
56
|
+
if (attribute.array) {
|
|
57
|
+
type += "[]";
|
|
58
|
+
}
|
|
59
|
+
if (!attribute.required && attribute.default === null) {
|
|
60
|
+
type += " | null";
|
|
61
|
+
}
|
|
62
|
+
return type;
|
|
63
|
+
}
|
|
64
|
+
isSingleFile() {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
_getAppwriteDependency() {
|
|
68
|
+
if (fs.existsSync(path.resolve(process.cwd(), "package.json"))) {
|
|
69
|
+
const packageJsonRaw = fs.readFileSync(path.resolve(process.cwd(), "package.json"));
|
|
70
|
+
const packageJson = JSON.parse(packageJsonRaw.toString("utf-8"));
|
|
71
|
+
return packageJson.dependencies &&
|
|
72
|
+
packageJson.dependencies["node-appwrite"]
|
|
73
|
+
? "node-appwrite"
|
|
74
|
+
: "appwrite";
|
|
75
|
+
}
|
|
76
|
+
if (fs.existsSync(path.resolve(process.cwd(), "deno.json"))) {
|
|
77
|
+
return "https://deno.land/x/appwrite/mod.ts";
|
|
78
|
+
}
|
|
79
|
+
return "appwrite";
|
|
80
|
+
}
|
|
81
|
+
getTemplate() {
|
|
82
|
+
return `import type { Models } from '${this._getAppwriteDependency()}';
|
|
83
|
+
|
|
84
|
+
// This file is auto-generated by the Appwrite CLI.
|
|
85
|
+
// You can regenerate it by running \`appwrite ${process.argv.slice(2).join(" ")}\`.
|
|
86
|
+
|
|
87
|
+
<% for (const collection of collections) { -%>
|
|
88
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
89
|
+
<% if (attribute.format === 'enum') { -%>
|
|
90
|
+
export enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
|
|
91
|
+
<% const entries = Object.entries(attribute.elements); -%>
|
|
92
|
+
<% for (let i = 0; i < entries.length; i++) { -%>
|
|
93
|
+
<%- toUpperSnakeCase(entries[i][1]) %> = "<%- entries[i][1] %>"<% if (i !== entries.length - 1) { %>,<% } %>
|
|
94
|
+
<% } -%>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
<% } -%>
|
|
98
|
+
<% } -%>
|
|
99
|
+
<% } -%>
|
|
100
|
+
<% for (const [index, collection] of Object.entries(collections)) { -%>
|
|
101
|
+
export type <%- toPascalCase(collection.name) %> = Models.Row & {
|
|
102
|
+
<% for (const attribute of collection.attributes) { -%>
|
|
103
|
+
<% const propertyName = strict ? toCamelCase(attribute.key) : attribute.key; -%>
|
|
104
|
+
<% const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propertyName); -%>
|
|
105
|
+
<% if (isValidIdentifier) { %><%- propertyName %><% } else { %>"<%- propertyName %>"<% } %>: <%- getType(attribute, collections, collection.name) %>;
|
|
106
|
+
<% } -%>
|
|
107
|
+
}<% if (index < collections.length - 1) { %>
|
|
108
|
+
<% } %>
|
|
109
|
+
<% } -%>`;
|
|
110
|
+
}
|
|
111
|
+
getFileName(_) {
|
|
112
|
+
return "appwrite.d.ts";
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../../lib/type-generation/languages/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,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AAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;YACjE,OAAO,WAAW,CAAC,YAAY;gBAC7B,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC;gBACzC,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,UAAU,CAAC;QACjB,CAAC;QAED,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC;YAC5D,OAAO,qCAAqC,CAAC;QAC/C,CAAC;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,WAAW;QACT,OAAO,gCAAgC,IAAI,CAAC,sBAAsB,EAAE;;;iDAGvB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;SAwBvE,CAAC;IACR,CAAC;IAED,WAAW,CAAC,CAAyB;QACnC,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { File } from "undici";
|
|
2
|
+
import type { ReadableStream } from "node:stream/web";
|
|
3
|
+
export type ResponseType = "json" | "arraybuffer";
|
|
4
|
+
export interface Headers {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
}
|
|
7
|
+
export interface RequestParams {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface FileUpload {
|
|
11
|
+
type: "file";
|
|
12
|
+
file: File;
|
|
13
|
+
filename: string;
|
|
14
|
+
}
|
|
15
|
+
export interface FileInput {
|
|
16
|
+
type: "file";
|
|
17
|
+
stream: ReadableStream;
|
|
18
|
+
filename: string;
|
|
19
|
+
size: number;
|
|
20
|
+
}
|
|
21
|
+
export interface UploadProgress {
|
|
22
|
+
$id: string;
|
|
23
|
+
progress: number;
|
|
24
|
+
sizeUploaded: number;
|
|
25
|
+
chunksTotal: number;
|
|
26
|
+
chunksUploaded: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ConfigData {
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface Entity {
|
|
32
|
+
$id: string;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export interface ParsedData {
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface CommandDescription {
|
|
39
|
+
[key: string]: string;
|
|
40
|
+
}
|
|
41
|
+
export interface CliConfig {
|
|
42
|
+
verbose: boolean;
|
|
43
|
+
json: boolean;
|
|
44
|
+
force: boolean;
|
|
45
|
+
all: boolean;
|
|
46
|
+
ids: string[];
|
|
47
|
+
report: boolean;
|
|
48
|
+
reportData: Record<string, unknown>;
|
|
49
|
+
}
|
|
50
|
+
export interface SessionData {
|
|
51
|
+
endpoint: string;
|
|
52
|
+
email?: string;
|
|
53
|
+
phone?: string;
|
|
54
|
+
cookie?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface GlobalConfigData extends ConfigData {
|
|
57
|
+
sessions: {
|
|
58
|
+
[key: string]: SessionData;
|
|
59
|
+
};
|
|
60
|
+
current: string;
|
|
61
|
+
cookie?: string;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,aAAa,CAAC;AAElD,MAAM,WAAW,OAAO;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAA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