appwrite-cli 13.0.0-rc.1 → 13.0.0-rc.3
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/publish.yml +68 -0
- package/CHANGELOG.md +10 -1
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/cli.ts +152 -0
- package/dist/bundle.cjs +95813 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +145 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -142
- package/dist/index.js.map +1 -1
- package/dist/lib/client.d.ts +2 -3
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +57 -45
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/commands/config.d.ts +562 -0
- package/dist/lib/commands/config.d.ts.map +1 -0
- package/dist/lib/commands/config.js +416 -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 +2 -2
- package/dist/lib/commands/generic.d.ts.map +1 -1
- package/dist/lib/commands/generic.js +170 -157
- package/dist/lib/commands/generic.js.map +1 -1
- package/dist/lib/commands/init.d.ts +1 -1
- package/dist/lib/commands/init.d.ts.map +1 -1
- package/dist/lib/commands/init.js +201 -192
- package/dist/lib/commands/init.js.map +1 -1
- package/dist/lib/commands/pull.d.ts +105 -3
- package/dist/lib/commands/pull.d.ts.map +1 -1
- package/dist/lib/commands/pull.js +530 -370
- package/dist/lib/commands/pull.js.map +1 -1
- package/dist/lib/commands/push.d.ts +106 -0
- package/dist/lib/commands/push.d.ts.map +1 -1
- package/dist/lib/commands/push.js +1432 -1830
- package/dist/lib/commands/push.js.map +1 -1
- package/dist/lib/commands/run.d.ts +1 -1
- package/dist/lib/commands/run.d.ts.map +1 -1
- package/dist/lib/commands/run.js +129 -127
- package/dist/lib/commands/run.js.map +1 -1
- package/dist/lib/commands/schema.d.ts +59 -0
- package/dist/lib/commands/schema.d.ts.map +1 -0
- package/dist/lib/commands/schema.js +86 -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 +328 -0
- package/dist/lib/commands/services/account.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 +28 -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 +620 -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 +266 -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 +250 -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 +175 -0
- package/dist/lib/commands/services/storage.js.map +1 -0
- package/dist/lib/commands/services/tables-db.d.ts +3 -0
- package/dist/lib/commands/services/tables-db.d.ts.map +1 -0
- package/dist/lib/commands/services/tables-db.js +613 -0
- package/dist/lib/commands/services/tables-db.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 +1 -1
- package/dist/lib/commands/types.d.ts.map +1 -1
- package/dist/lib/commands/types.js +53 -57
- package/dist/lib/commands/types.js.map +1 -1
- package/dist/lib/commands/update.d.ts +1 -1
- package/dist/lib/commands/update.d.ts.map +1 -1
- package/dist/lib/commands/update.js +69 -69
- package/dist/lib/commands/update.js.map +1 -1
- package/dist/lib/commands/utils/attributes.d.ts +47 -0
- package/dist/lib/commands/utils/attributes.d.ts.map +1 -0
- package/dist/lib/commands/utils/attributes.js +514 -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 +109 -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 +198 -0
- package/dist/lib/commands/utils/pools.js.map +1 -0
- package/dist/lib/config.d.ts +41 -40
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +264 -239
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +14 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +19 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/emulation/docker.d.ts +4 -12
- package/dist/lib/emulation/docker.d.ts.map +1 -1
- package/dist/lib/emulation/docker.js +159 -142
- package/dist/lib/emulation/docker.js.map +1 -1
- package/dist/lib/emulation/utils.d.ts +1 -1
- package/dist/lib/emulation/utils.d.ts.map +1 -1
- package/dist/lib/emulation/utils.js +55 -58
- package/dist/lib/emulation/utils.js.map +1 -1
- package/dist/lib/id.d.ts +1 -1
- package/dist/lib/id.d.ts.map +1 -1
- package/dist/lib/id.js +13 -18
- package/dist/lib/id.js.map +1 -1
- package/dist/lib/paginate.d.ts +3 -4
- package/dist/lib/paginate.d.ts.map +1 -1
- package/dist/lib/paginate.js +7 -10
- package/dist/lib/paginate.js.map +1 -1
- package/dist/lib/parser.d.ts +1 -1
- package/dist/lib/parser.d.ts.map +1 -1
- package/dist/lib/parser.js +92 -103
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/questions.d.ts +1 -1
- package/dist/lib/questions.d.ts.map +1 -1
- package/dist/lib/questions.js +381 -385
- package/dist/lib/questions.js.map +1 -1
- package/dist/lib/sdks.d.ts +1 -1
- package/dist/lib/sdks.d.ts.map +1 -1
- package/dist/lib/sdks.js +39 -30
- package/dist/lib/sdks.js.map +1 -1
- 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 +1 -1
- package/dist/lib/spinner.d.ts.map +1 -1
- package/dist/lib/spinner.js +25 -27
- package/dist/lib/spinner.js.map +1 -1
- package/dist/lib/type-generation/attribute.d.ts +1 -1
- package/dist/lib/type-generation/attribute.d.ts.map +1 -1
- package/dist/lib/type-generation/attribute.js +14 -17
- package/dist/lib/type-generation/attribute.js.map +1 -1
- package/dist/lib/type-generation/languages/csharp.d.ts +1 -1
- package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/csharp.js +34 -34
- package/dist/lib/type-generation/languages/csharp.js.map +1 -1
- package/dist/lib/type-generation/languages/dart.d.ts +1 -1
- package/dist/lib/type-generation/languages/dart.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/dart.js +57 -57
- package/dist/lib/type-generation/languages/dart.js.map +1 -1
- package/dist/lib/type-generation/languages/java.d.ts +1 -1
- package/dist/lib/type-generation/languages/java.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/java.js +35 -35
- package/dist/lib/type-generation/languages/java.js.map +1 -1
- package/dist/lib/type-generation/languages/javascript.d.ts +1 -1
- package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/javascript.js +45 -44
- package/dist/lib/type-generation/languages/javascript.js.map +1 -1
- package/dist/lib/type-generation/languages/kotlin.d.ts +1 -1
- package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/kotlin.js +35 -35
- package/dist/lib/type-generation/languages/kotlin.js.map +1 -1
- package/dist/lib/type-generation/languages/language.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/language.js +32 -37
- package/dist/lib/type-generation/languages/language.js.map +1 -1
- package/dist/lib/type-generation/languages/php.d.ts +1 -1
- package/dist/lib/type-generation/languages/php.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/php.js +34 -34
- package/dist/lib/type-generation/languages/php.js.map +1 -1
- package/dist/lib/type-generation/languages/swift.d.ts +1 -1
- package/dist/lib/type-generation/languages/swift.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/swift.js +35 -35
- package/dist/lib/type-generation/languages/swift.js.map +1 -1
- package/dist/lib/type-generation/languages/typescript.d.ts +1 -1
- package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/typescript.js +49 -46
- package/dist/lib/type-generation/languages/typescript.js.map +1 -1
- package/dist/lib/types.d.ts +38 -108
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +1 -2
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +142 -98
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/validations.d.ts.map +1 -1
- package/dist/lib/validations.js +2 -6
- package/dist/lib/validations.js.map +1 -1
- package/dist/package.json +68 -0
- package/index.ts +25 -149
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.ts +261 -220
- package/lib/commands/config.ts +494 -0
- package/lib/commands/db.ts +324 -0
- package/lib/commands/errors.ts +93 -0
- package/lib/commands/generic.ts +371 -269
- package/lib/commands/init.ts +631 -519
- package/lib/commands/pull.ts +827 -453
- package/lib/commands/push.ts +2191 -2349
- package/lib/commands/run.ts +382 -302
- package/lib/commands/schema.ts +122 -0
- package/lib/commands/services/account.ts +647 -0
- package/lib/commands/services/console.ts +52 -0
- package/lib/commands/services/databases.ts +1163 -0
- package/lib/commands/services/functions.ts +536 -0
- package/lib/commands/services/graphql.ts +50 -0
- package/lib/commands/services/health.ts +260 -0
- package/lib/commands/services/locale.ts +102 -0
- package/lib/commands/services/messaging.ts +1052 -0
- package/lib/commands/services/migrations.ts +249 -0
- package/lib/commands/services/project.ts +112 -0
- package/lib/commands/services/projects.ts +785 -0
- package/lib/commands/services/proxy.ts +135 -0
- package/lib/commands/services/sites.ts +505 -0
- package/lib/commands/services/storage.ts +338 -0
- package/lib/commands/services/tables-db.ts +1150 -0
- package/lib/commands/services/teams.ts +232 -0
- package/lib/commands/services/tokens.ts +94 -0
- package/lib/commands/services/users.ts +616 -0
- package/lib/commands/services/vcs.ts +165 -0
- package/lib/commands/types.ts +145 -118
- package/lib/commands/update.ts +189 -159
- package/lib/commands/utils/attributes.ts +719 -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 +184 -0
- package/lib/commands/utils/error-formatter.ts +417 -0
- package/lib/commands/utils/pools.ts +355 -0
- package/lib/config.ts +766 -687
- package/lib/constants.ts +22 -0
- package/lib/emulation/docker.ts +277 -216
- package/lib/emulation/utils.ts +188 -174
- package/lib/id.ts +23 -23
- package/lib/paginate.ts +69 -55
- package/lib/parser.ts +220 -189
- package/lib/questions.ts +1024 -948
- package/lib/sdks.ts +84 -51
- package/lib/services.ts +72 -0
- package/lib/spinner.ts +112 -99
- package/lib/type-generation/attribute.ts +15 -14
- package/lib/type-generation/languages/csharp.ts +71 -60
- package/lib/type-generation/languages/dart.ts +106 -93
- package/lib/type-generation/languages/java.ts +69 -58
- package/lib/type-generation/languages/javascript.ts +84 -73
- package/lib/type-generation/languages/kotlin.ts +71 -60
- package/lib/type-generation/languages/language.ts +103 -95
- package/lib/type-generation/languages/php.ts +67 -56
- package/lib/type-generation/languages/swift.ts +71 -60
- package/lib/type-generation/languages/typescript.ts +93 -76
- package/lib/types.ts +50 -125
- package/lib/utils.ts +304 -233
- package/lib/validations.ts +17 -14
- package/package.json +31 -22
- package/scoop/appwrite.config.json +3 -3
- package/tsconfig.json +7 -13
- package/.github/workflows/autoclose.yml +0 -11
- package/.github/workflows/npm-publish.yml +0 -49
- package/dist/lib/commands/account.d.ts +0 -379
- package/dist/lib/commands/account.d.ts.map +0 -1
- package/dist/lib/commands/account.js +0 -1228
- package/dist/lib/commands/account.js.map +0 -1
- package/dist/lib/commands/console.d.ts +0 -20
- package/dist/lib/commands/console.d.ts.map +0 -1
- package/dist/lib/commands/console.js +0 -78
- package/dist/lib/commands/console.js.map +0 -1
- package/dist/lib/commands/databases.d.ts +0 -732
- package/dist/lib/commands/databases.d.ts.map +0 -1
- package/dist/lib/commands/databases.js +0 -2196
- package/dist/lib/commands/databases.js.map +0 -1
- package/dist/lib/commands/functions.d.ts +0 -310
- package/dist/lib/commands/functions.d.ts.map +0 -1
- package/dist/lib/commands/functions.js +0 -1100
- package/dist/lib/commands/functions.js.map +0 -1
- package/dist/lib/commands/graphql.d.ts +0 -19
- package/dist/lib/commands/graphql.d.ts.map +0 -1
- package/dist/lib/commands/graphql.js +0 -77
- package/dist/lib/commands/graphql.js.map +0 -1
- package/dist/lib/commands/health.d.ts +0 -153
- package/dist/lib/commands/health.d.ts.map +0 -1
- package/dist/lib/commands/health.js +0 -464
- package/dist/lib/commands/health.js.map +0 -1
- package/dist/lib/commands/locale.d.ts +0 -53
- package/dist/lib/commands/locale.d.ts.map +0 -1
- package/dist/lib/commands/locale.js +0 -165
- package/dist/lib/commands/locale.js.map +0 -1
- package/dist/lib/commands/messaging.d.ts +0 -588
- package/dist/lib/commands/messaging.d.ts.map +0 -1
- package/dist/lib/commands/messaging.js +0 -2042
- package/dist/lib/commands/messaging.js.map +0 -1
- package/dist/lib/commands/migrations.d.ts +0 -150
- package/dist/lib/commands/migrations.d.ts.map +0 -1
- package/dist/lib/commands/migrations.js +0 -524
- package/dist/lib/commands/migrations.js.map +0 -1
- package/dist/lib/commands/organizations.d.ts +0 -11
- package/dist/lib/commands/organizations.d.ts.map +0 -1
- package/dist/lib/commands/organizations.js +0 -31
- package/dist/lib/commands/organizations.js.map +0 -1
- package/dist/lib/commands/project.d.ts +0 -53
- package/dist/lib/commands/project.d.ts.map +0 -1
- package/dist/lib/commands/project.js +0 -176
- package/dist/lib/commands/project.js.map +0 -1
- package/dist/lib/commands/projects.d.ts +0 -516
- package/dist/lib/commands/projects.d.ts.map +0 -1
- package/dist/lib/commands/projects.js +0 -1590
- package/dist/lib/commands/projects.js.map +0 -1
- package/dist/lib/commands/proxy.d.ts +0 -71
- package/dist/lib/commands/proxy.d.ts.map +0 -1
- package/dist/lib/commands/proxy.js +0 -240
- package/dist/lib/commands/proxy.js.map +0 -1
- package/dist/lib/commands/sites.d.ts +0 -296
- package/dist/lib/commands/sites.d.ts.map +0 -1
- package/dist/lib/commands/sites.js +0 -1046
- package/dist/lib/commands/sites.js.map +0 -1
- package/dist/lib/commands/storage.d.ts +0 -170
- package/dist/lib/commands/storage.d.ts.map +0 -1
- package/dist/lib/commands/storage.js +0 -651
- package/dist/lib/commands/storage.js.map +0 -1
- package/dist/lib/commands/tables-db.d.ts +0 -728
- package/dist/lib/commands/tables-db.d.ts.map +0 -1
- package/dist/lib/commands/tables-db.js +0 -2198
- package/dist/lib/commands/tables-db.js.map +0 -1
- package/dist/lib/commands/teams.d.ts +0 -129
- package/dist/lib/commands/teams.d.ts.map +0 -1
- package/dist/lib/commands/teams.js +0 -403
- package/dist/lib/commands/teams.js.map +0 -1
- package/dist/lib/commands/tokens.d.ts +0 -48
- package/dist/lib/commands/tokens.d.ts.map +0 -1
- package/dist/lib/commands/tokens.js +0 -156
- package/dist/lib/commands/tokens.js.map +0 -1
- package/dist/lib/commands/users.d.ts +0 -382
- package/dist/lib/commands/users.d.ts.map +0 -1
- package/dist/lib/commands/users.js +0 -1195
- package/dist/lib/commands/users.js.map +0 -1
- package/dist/lib/commands/vcs.d.ts +0 -92
- package/dist/lib/commands/vcs.d.ts.map +0 -1
- package/dist/lib/commands/vcs.js +0 -276
- package/dist/lib/commands/vcs.js.map +0 -1
- package/dist/lib/exception.d.ts +0 -8
- package/dist/lib/exception.d.ts.map +0 -1
- package/dist/lib/exception.js +0 -16
- package/dist/lib/exception.js.map +0 -1
- package/lib/commands/account.ts +0 -1867
- package/lib/commands/console.ts +0 -112
- package/lib/commands/databases.ts +0 -3272
- package/lib/commands/functions.ts +0 -1587
- package/lib/commands/graphql.ts +0 -110
- package/lib/commands/health.ts +0 -753
- package/lib/commands/locale.ts +0 -270
- package/lib/commands/messaging.ts +0 -2878
- package/lib/commands/migrations.ts +0 -754
- package/lib/commands/organizations.ts +0 -46
- package/lib/commands/project.ts +0 -266
- package/lib/commands/projects.ts +0 -2370
- package/lib/commands/proxy.ts +0 -357
- package/lib/commands/sites.ts +0 -1514
- package/lib/commands/storage.ts +0 -919
- package/lib/commands/tables-db.ts +0 -3260
- package/lib/commands/teams.ts +0 -609
- package/lib/commands/tokens.ts +0 -232
- package/lib/commands/users.ts +0 -1804
- package/lib/commands/vcs.ts +0 -428
- package/lib/exception.ts +0 -20
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { ZodError, ZodIssue, z } from "zod";
|
|
2
|
+
import type {
|
|
3
|
+
$ZodIssueInvalidType,
|
|
4
|
+
$ZodIssueTooBig,
|
|
5
|
+
$ZodIssueTooSmall,
|
|
6
|
+
$ZodIssueUnrecognizedKeys,
|
|
7
|
+
$ZodIssueNotMultipleOf,
|
|
8
|
+
$ZodIssueInvalidStringFormat,
|
|
9
|
+
} from "zod/v4/core";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Formats a Zod validation error into a human-readable message
|
|
13
|
+
*/
|
|
14
|
+
export class ZodErrorFormatter {
|
|
15
|
+
static formatError(error: ZodError, contextData?: any): string {
|
|
16
|
+
const issues = error.issues;
|
|
17
|
+
|
|
18
|
+
if (issues.length === 1) {
|
|
19
|
+
return this.formatIssue(issues[0], contextData);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const messages = issues.map(
|
|
23
|
+
(issue) => `• ${this.formatIssue(issue, contextData)}`,
|
|
24
|
+
);
|
|
25
|
+
return `Found ${issues.length} validation errors:\n\n${messages.join("\n\n")}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private static formatIssue(issue: ZodIssue, contextData?: any): string {
|
|
29
|
+
const location = this.formatPath(issue.path, contextData);
|
|
30
|
+
const locationText = location ? ` at ${location}` : "";
|
|
31
|
+
|
|
32
|
+
switch (issue.code) {
|
|
33
|
+
case "unrecognized_keys": {
|
|
34
|
+
const unrecognizedIssue = issue as $ZodIssueUnrecognizedKeys;
|
|
35
|
+
const keys = unrecognizedIssue.keys.map((key) => `"${key}"`).join(", ");
|
|
36
|
+
const propertyWord =
|
|
37
|
+
unrecognizedIssue.keys.length === 1 ? "property" : "properties";
|
|
38
|
+
return `Unexpected ${propertyWord} ${keys}${locationText}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
case "invalid_type": {
|
|
42
|
+
const invalidTypeIssue = issue as $ZodIssueInvalidType;
|
|
43
|
+
return `Expected ${invalidTypeIssue.expected}, got ${this.formatValue(invalidTypeIssue.input)}${locationText}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
case "too_small": {
|
|
47
|
+
const tooSmallIssue = issue as $ZodIssueTooSmall;
|
|
48
|
+
const minimum = tooSmallIssue.minimum;
|
|
49
|
+
const origin = tooSmallIssue.origin;
|
|
50
|
+
|
|
51
|
+
if (origin === "array") {
|
|
52
|
+
const itemWord = minimum === 1 ? "item" : "items";
|
|
53
|
+
return `Array${locationText} must have at least ${minimum} ${itemWord}`;
|
|
54
|
+
} else if (origin === "string") {
|
|
55
|
+
const charWord = minimum === 1 ? "character" : "characters";
|
|
56
|
+
return `String${locationText} must be at least ${minimum} ${charWord}`;
|
|
57
|
+
} else if (origin === "number") {
|
|
58
|
+
return `Number${locationText} must be at least ${minimum}`;
|
|
59
|
+
}
|
|
60
|
+
return `Value${locationText} must be at least ${minimum}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
case "too_big": {
|
|
64
|
+
const tooBigIssue = issue as $ZodIssueTooBig;
|
|
65
|
+
const maximum = tooBigIssue.maximum;
|
|
66
|
+
const origin = tooBigIssue.origin;
|
|
67
|
+
|
|
68
|
+
if (origin === "array") {
|
|
69
|
+
const itemWord = maximum === 1 ? "item" : "items";
|
|
70
|
+
return `Array${locationText} must have at most ${maximum} ${itemWord}`;
|
|
71
|
+
} else if (origin === "string") {
|
|
72
|
+
const charWord = maximum === 1 ? "character" : "characters";
|
|
73
|
+
return `String${locationText} must be at most ${maximum} ${charWord}`;
|
|
74
|
+
} else if (origin === "number") {
|
|
75
|
+
return `Number${locationText} must be at most ${maximum}`;
|
|
76
|
+
}
|
|
77
|
+
return `Value${locationText} must be at most ${maximum}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
case "invalid_format": {
|
|
81
|
+
const formatIssue = issue as $ZodIssueInvalidStringFormat;
|
|
82
|
+
return `Invalid ${formatIssue.format} format${locationText}`;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
case "invalid_union": {
|
|
86
|
+
// Check if this is an enum validation error by examining the issue context
|
|
87
|
+
const unionIssue = issue as any;
|
|
88
|
+
if (unionIssue.unionErrors && unionIssue.unionErrors.length > 0) {
|
|
89
|
+
// Look for enum-like validation errors
|
|
90
|
+
const enumError = unionIssue.unionErrors.find(
|
|
91
|
+
(err: any) =>
|
|
92
|
+
err.issues &&
|
|
93
|
+
err.issues.some(
|
|
94
|
+
(subIssue: any) =>
|
|
95
|
+
subIssue.code === "invalid_literal" ||
|
|
96
|
+
subIssue.code === "invalid_enum_value",
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
if (enumError) {
|
|
101
|
+
// Extract allowed values from the enum error
|
|
102
|
+
const enumIssues = enumError.issues.filter(
|
|
103
|
+
(subIssue: any) =>
|
|
104
|
+
subIssue.code === "invalid_literal" ||
|
|
105
|
+
subIssue.code === "invalid_enum_value",
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (enumIssues.length > 0) {
|
|
109
|
+
// Try to extract the allowed values
|
|
110
|
+
const allowedValues = this.extractAllowedEnumValues(
|
|
111
|
+
unionIssue.unionErrors,
|
|
112
|
+
);
|
|
113
|
+
if (allowedValues.length > 0) {
|
|
114
|
+
const valuesList = allowedValues
|
|
115
|
+
.map((v) => `"${v}"`)
|
|
116
|
+
.join(", ");
|
|
117
|
+
return `Invalid value${locationText}. Expected one of: ${valuesList}`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return `Invalid value${locationText}. None of the allowed types matched`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
case "custom":
|
|
126
|
+
return `${issue.message || "Custom validation failed"}${locationText}`;
|
|
127
|
+
|
|
128
|
+
case "not_multiple_of": {
|
|
129
|
+
const multipleOfIssue = issue as $ZodIssueNotMultipleOf;
|
|
130
|
+
return `Number${locationText} must be a multiple of ${multipleOfIssue.divisor}`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
case "invalid_key":
|
|
134
|
+
return `Invalid key${locationText}`;
|
|
135
|
+
|
|
136
|
+
case "invalid_element":
|
|
137
|
+
return `Invalid element${locationText}`;
|
|
138
|
+
|
|
139
|
+
case "invalid_value": {
|
|
140
|
+
const invalidValueIssue = issue as any;
|
|
141
|
+
if (
|
|
142
|
+
invalidValueIssue.values &&
|
|
143
|
+
Array.isArray(invalidValueIssue.values)
|
|
144
|
+
) {
|
|
145
|
+
const allowedValues = invalidValueIssue.values
|
|
146
|
+
.map((v: any) => `"${v}"`)
|
|
147
|
+
.join(", ");
|
|
148
|
+
return `Invalid value${locationText}. Expected one of: ${allowedValues}`;
|
|
149
|
+
}
|
|
150
|
+
return `Invalid value${locationText}`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
default:
|
|
154
|
+
return `${(issue as ZodIssue).message || "Validation failed"}${locationText}`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
private static formatValue(value: unknown): string {
|
|
159
|
+
if (value === null) {
|
|
160
|
+
return "null";
|
|
161
|
+
}
|
|
162
|
+
if (value === undefined) {
|
|
163
|
+
return "undefined";
|
|
164
|
+
}
|
|
165
|
+
if (typeof value === "string") {
|
|
166
|
+
return `"${value}"`;
|
|
167
|
+
}
|
|
168
|
+
return String(value);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
private static formatPath(path: PropertyKey[], contextData?: any): string {
|
|
172
|
+
if (path.length === 0) return "";
|
|
173
|
+
|
|
174
|
+
const formatted: string[] = [];
|
|
175
|
+
|
|
176
|
+
for (let i = 0; i < path.length; i++) {
|
|
177
|
+
const segment = path[i];
|
|
178
|
+
|
|
179
|
+
if (typeof segment === "number") {
|
|
180
|
+
formatted.push(`[${segment}]`);
|
|
181
|
+
} else if (typeof segment === "string") {
|
|
182
|
+
if (i === 0) {
|
|
183
|
+
formatted.push(segment);
|
|
184
|
+
} else {
|
|
185
|
+
formatted.push(`.${segment}`);
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
// Handle symbol keys by converting to string
|
|
189
|
+
formatted.push(`.${String(segment)}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return this.humanizePath(formatted.join(""), contextData);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
private static humanizePath(path: string, contextData?: any): string {
|
|
197
|
+
// Try to resolve names from context data first
|
|
198
|
+
if (contextData) {
|
|
199
|
+
const resolvedPath = this.resolvePathWithNames(path, contextData);
|
|
200
|
+
if (resolvedPath !== path) {
|
|
201
|
+
return resolvedPath;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const patterns = [
|
|
206
|
+
{
|
|
207
|
+
pattern: /^collections\[(\d+)\]\.attributes\[(\d+)\]$/,
|
|
208
|
+
replacement: "Collections $1 → attributes $2",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
pattern: /^collections\[(\d+)\]\.indexes\[(\d+)\]$/,
|
|
212
|
+
replacement: "Collections $1 → indexes $2",
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
pattern: /^collections\[(\d+)\]$/,
|
|
216
|
+
replacement: "Collections $1",
|
|
217
|
+
},
|
|
218
|
+
{ pattern: /^databases\[(\d+)\]$/, replacement: "Databases $1" },
|
|
219
|
+
{ pattern: /^functions\[(\d+)\]$/, replacement: "Functions $1" },
|
|
220
|
+
{ pattern: /^sites\[(\d+)\]$/, replacement: "Sites $1" },
|
|
221
|
+
{ pattern: /^buckets\[(\d+)\]$/, replacement: "Buckets $1" },
|
|
222
|
+
{ pattern: /^teams\[(\d+)\]$/, replacement: "Teams $1" },
|
|
223
|
+
{ pattern: /^topics\[(\d+)\]$/, replacement: "Topics $1" },
|
|
224
|
+
{
|
|
225
|
+
pattern: /^settings\.auth\.methods$/,
|
|
226
|
+
replacement: "auth.methods",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
pattern: /^settings\.auth\.security$/,
|
|
230
|
+
replacement: "auth.security",
|
|
231
|
+
},
|
|
232
|
+
{ pattern: /^settings\.services$/, replacement: "services" },
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
for (const { pattern, replacement } of patterns) {
|
|
236
|
+
if (pattern.test(path)) {
|
|
237
|
+
return path.replace(pattern, replacement);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return path
|
|
242
|
+
.replace(/\[(\d+)\]/g, " $1")
|
|
243
|
+
.replace(/\./g, " → ")
|
|
244
|
+
.replace(/^(\w)/, (match) => match.toUpperCase());
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private static resolvePathWithNames(path: string, contextData: any): string {
|
|
248
|
+
// Handle collections and their attributes/indexes
|
|
249
|
+
const collectionAttributeMatch = path.match(
|
|
250
|
+
/^collections\[(\d+)\]\.attributes\[(\d+)\](.*)$/,
|
|
251
|
+
);
|
|
252
|
+
if (collectionAttributeMatch) {
|
|
253
|
+
const [, collectionIndex, attributeIndex, remainder] =
|
|
254
|
+
collectionAttributeMatch;
|
|
255
|
+
const collection = contextData.collections?.[parseInt(collectionIndex)];
|
|
256
|
+
const attribute = collection?.attributes?.[parseInt(attributeIndex)];
|
|
257
|
+
|
|
258
|
+
if (collection && attribute) {
|
|
259
|
+
const collectionName = collection.name || collection.$id;
|
|
260
|
+
const attributeName = attribute.key;
|
|
261
|
+
return `Collections "${collectionName}" → attributes "${attributeName}"${remainder}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const collectionIndexMatch = path.match(
|
|
266
|
+
/^collections\[(\d+)\]\.indexes\[(\d+)\](.*)$/,
|
|
267
|
+
);
|
|
268
|
+
if (collectionIndexMatch) {
|
|
269
|
+
const [, collectionIndex, indexIndex, remainder] = collectionIndexMatch;
|
|
270
|
+
const collection = contextData.collections?.[parseInt(collectionIndex)];
|
|
271
|
+
const index = collection?.indexes?.[parseInt(indexIndex)];
|
|
272
|
+
|
|
273
|
+
if (collection && index) {
|
|
274
|
+
const collectionName = collection.name || collection.$id;
|
|
275
|
+
const indexName = index.key;
|
|
276
|
+
return `Collections "${collectionName}" → indexes "${indexName}"${remainder}`;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const collectionMatch = path.match(/^collections\[(\d+)\](.*)$/);
|
|
281
|
+
if (collectionMatch) {
|
|
282
|
+
const [, collectionIndex, remainder] = collectionMatch;
|
|
283
|
+
const collection = contextData.collections?.[parseInt(collectionIndex)];
|
|
284
|
+
|
|
285
|
+
if (collection) {
|
|
286
|
+
const collectionName = collection.name || collection.$id;
|
|
287
|
+
return `Collections "${collectionName}"${remainder}`;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Handle databases
|
|
292
|
+
const databaseMatch = path.match(/^databases\[(\d+)\](.*)$/);
|
|
293
|
+
if (databaseMatch) {
|
|
294
|
+
const [, databaseIndex, remainder] = databaseMatch;
|
|
295
|
+
const database = contextData.databases?.[parseInt(databaseIndex)];
|
|
296
|
+
|
|
297
|
+
if (database) {
|
|
298
|
+
const databaseName = database.name || database.$id;
|
|
299
|
+
return `Databases "${databaseName}"${remainder}`;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Handle functions
|
|
304
|
+
const functionMatch = path.match(/^functions\[(\d+)\](.*)$/);
|
|
305
|
+
if (functionMatch) {
|
|
306
|
+
const [, functionIndex, remainder] = functionMatch;
|
|
307
|
+
const func = contextData.functions?.[parseInt(functionIndex)];
|
|
308
|
+
|
|
309
|
+
if (func) {
|
|
310
|
+
const functionName = func.name || func.$id;
|
|
311
|
+
return `Functions "${functionName}"${remainder}`;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Handle sites
|
|
316
|
+
const siteMatch = path.match(/^sites\[(\d+)\](.*)$/);
|
|
317
|
+
if (siteMatch) {
|
|
318
|
+
const [, siteIndex, remainder] = siteMatch;
|
|
319
|
+
const site = contextData.sites?.[parseInt(siteIndex)];
|
|
320
|
+
|
|
321
|
+
if (site) {
|
|
322
|
+
const siteName = site.name || site.$id;
|
|
323
|
+
return `Sites "${siteName}"${remainder}`;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Handle buckets
|
|
328
|
+
const bucketMatch = path.match(/^buckets\[(\d+)\](.*)$/);
|
|
329
|
+
if (bucketMatch) {
|
|
330
|
+
const [, bucketIndex, remainder] = bucketMatch;
|
|
331
|
+
const bucket = contextData.buckets?.[parseInt(bucketIndex)];
|
|
332
|
+
|
|
333
|
+
if (bucket) {
|
|
334
|
+
const bucketName = bucket.name || bucket.$id;
|
|
335
|
+
return `Buckets "${bucketName}"${remainder}`;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Handle teams
|
|
340
|
+
const teamMatch = path.match(/^teams\[(\d+)\](.*)$/);
|
|
341
|
+
if (teamMatch) {
|
|
342
|
+
const [, teamIndex, remainder] = teamMatch;
|
|
343
|
+
const team = contextData.teams?.[parseInt(teamIndex)];
|
|
344
|
+
|
|
345
|
+
if (team) {
|
|
346
|
+
const teamName = team.name || team.$id;
|
|
347
|
+
return `Teams "${teamName}"${remainder}`;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Handle topics
|
|
352
|
+
const topicMatch = path.match(/^topics\[(\d+)\](.*)$/);
|
|
353
|
+
if (topicMatch) {
|
|
354
|
+
const [, topicIndex, remainder] = topicMatch;
|
|
355
|
+
const topic = contextData.topics?.[parseInt(topicIndex)];
|
|
356
|
+
|
|
357
|
+
if (topic) {
|
|
358
|
+
const topicName = topic.name || topic.$id;
|
|
359
|
+
return `Topics "${topicName}"${remainder}`;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return path;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
private static extractAllowedEnumValues(unionErrors: any[]): string[] {
|
|
367
|
+
const allowedValues = new Set<string>();
|
|
368
|
+
|
|
369
|
+
for (const error of unionErrors) {
|
|
370
|
+
if (error.issues) {
|
|
371
|
+
for (const issue of error.issues) {
|
|
372
|
+
if (
|
|
373
|
+
issue.code === "invalid_literal" &&
|
|
374
|
+
issue.expected !== undefined
|
|
375
|
+
) {
|
|
376
|
+
allowedValues.add(String(issue.expected));
|
|
377
|
+
} else if (issue.code === "invalid_enum_value" && issue.options) {
|
|
378
|
+
issue.options.forEach((option: any) =>
|
|
379
|
+
allowedValues.add(String(option)),
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
return Array.from(allowedValues).sort();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Helper function to wrap Zod parse calls with better error formatting
|
|
392
|
+
* This function outputs the error directly to console and exits the process
|
|
393
|
+
*/
|
|
394
|
+
export function parseWithBetterErrors<T>(
|
|
395
|
+
schema: z.ZodTypeAny,
|
|
396
|
+
data: unknown,
|
|
397
|
+
context?: string,
|
|
398
|
+
contextData?: any,
|
|
399
|
+
): T {
|
|
400
|
+
try {
|
|
401
|
+
return schema.parse(data) as T;
|
|
402
|
+
} catch (error) {
|
|
403
|
+
if (error instanceof ZodError) {
|
|
404
|
+
const formattedMessage = ZodErrorFormatter.formatError(
|
|
405
|
+
error,
|
|
406
|
+
contextData,
|
|
407
|
+
);
|
|
408
|
+
const errorMessage = context
|
|
409
|
+
? `❌ ${context}: ${formattedMessage}`
|
|
410
|
+
: `❌ ${formattedMessage}`;
|
|
411
|
+
|
|
412
|
+
console.error(errorMessage);
|
|
413
|
+
process.exit(1);
|
|
414
|
+
}
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
}
|