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
package/lib/questions.ts
CHANGED
|
@@ -1,1090 +1,1166 @@
|
|
|
1
|
-
import chalk from
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const JSONbigConfig = JSONbig({ storeAsString: false });
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { localConfig, globalConfig } from "./config.js";
|
|
3
|
+
import { sdkForConsole } from "./sdks.js";
|
|
4
|
+
import { validateRequired } from "./validations.js";
|
|
5
|
+
import { paginate } from "./paginate.js";
|
|
6
|
+
import { checkDeployConditions, isCloud } from "./utils.js";
|
|
7
|
+
import { Account, Client } from "@appwrite.io/console";
|
|
8
|
+
import {
|
|
9
|
+
getOrganizationsService,
|
|
10
|
+
getTeamsService,
|
|
11
|
+
getProjectsService,
|
|
12
|
+
getFunctionsService,
|
|
13
|
+
getSitesService,
|
|
14
|
+
getDatabasesService,
|
|
15
|
+
} from "./services.js";
|
|
16
|
+
import { SDK_TITLE, DEFAULT_ENDPOINT, EXECUTABLE_NAME } from "./constants.js";
|
|
18
17
|
|
|
19
18
|
interface Answers {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
override?: boolean;
|
|
20
|
+
method?: string;
|
|
21
|
+
start?: string;
|
|
22
|
+
organization?: string;
|
|
23
|
+
[key: string]: any;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
interface Choice {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
name: string;
|
|
28
|
+
value: any;
|
|
29
|
+
disabled?: boolean | string;
|
|
30
|
+
current?: boolean;
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
interface Question {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
type: string;
|
|
35
|
+
name: string;
|
|
36
|
+
message: string;
|
|
37
|
+
default?: any;
|
|
38
|
+
when?: ((answers: Answers) => boolean | Promise<boolean>) | boolean;
|
|
39
|
+
choices?:
|
|
40
|
+
| ((answers: Answers) => Promise<Choice[]> | Choice[])
|
|
41
|
+
| (() => Promise<Choice[]> | Choice[])
|
|
42
|
+
| Choice[]
|
|
43
|
+
| string[];
|
|
44
|
+
validate?: (value: any) => boolean | string | Promise<boolean | string>;
|
|
45
|
+
mask?: string;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
const whenOverride = (answers: Answers): boolean =>
|
|
48
|
+
const whenOverride = (answers: Answers): boolean =>
|
|
49
|
+
answers.override === undefined ? true : answers.override;
|
|
46
50
|
|
|
47
51
|
const getIgnores = (runtime: string): string[] => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
const language = runtime.split("-").slice(0, -1).join("-");
|
|
53
|
+
|
|
54
|
+
switch (language) {
|
|
55
|
+
case "cpp":
|
|
56
|
+
return ["build", "CMakeFiles", "CMakeCaches.txt"];
|
|
57
|
+
case "dart":
|
|
58
|
+
return [".packages", ".dart_tool"];
|
|
59
|
+
case "deno":
|
|
60
|
+
return [];
|
|
61
|
+
case "dotnet":
|
|
62
|
+
return ["bin", "obj", ".nuget"];
|
|
63
|
+
case "java":
|
|
64
|
+
case "kotlin":
|
|
65
|
+
return ["build"];
|
|
66
|
+
case "node":
|
|
67
|
+
case "bun":
|
|
68
|
+
return ["node_modules", ".npm"];
|
|
69
|
+
case "php":
|
|
70
|
+
return ["vendor"];
|
|
71
|
+
case "python":
|
|
72
|
+
case "python-ml":
|
|
73
|
+
return ["__pypackages__"];
|
|
74
|
+
case "ruby":
|
|
75
|
+
return ["vendor"];
|
|
76
|
+
case "rust":
|
|
77
|
+
return ["target", "debug", "*.rs.bk", "*.pdb"];
|
|
78
|
+
case "swift":
|
|
79
|
+
return [".build", ".swiftpm"];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return [];
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
const getEntrypoint = (runtime: string): string | undefined => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
86
|
+
const language = runtime.split("-").slice(0, -1).join("-");
|
|
87
|
+
|
|
88
|
+
switch (language) {
|
|
89
|
+
case "dart":
|
|
90
|
+
return "lib/main.dart";
|
|
91
|
+
case "deno":
|
|
92
|
+
return "src/main.ts";
|
|
93
|
+
case "node":
|
|
94
|
+
return "src/main.js";
|
|
95
|
+
case "bun":
|
|
96
|
+
return "src/main.ts";
|
|
97
|
+
case "php":
|
|
98
|
+
return "src/index.php";
|
|
99
|
+
case "python":
|
|
100
|
+
case "python-ml":
|
|
101
|
+
return "src/main.py";
|
|
102
|
+
case "ruby":
|
|
103
|
+
return "lib/main.rb";
|
|
104
|
+
case "rust":
|
|
105
|
+
return "main.rs";
|
|
106
|
+
case "swift":
|
|
107
|
+
return "Sources/index.swift";
|
|
108
|
+
case "cpp":
|
|
109
|
+
return "src/main.cc";
|
|
110
|
+
case "dotnet":
|
|
111
|
+
return "src/Index.cs";
|
|
112
|
+
case "java":
|
|
113
|
+
return "src/Main.java";
|
|
114
|
+
case "kotlin":
|
|
115
|
+
return "src/Main.kt";
|
|
116
|
+
case "go":
|
|
117
|
+
return "main.go";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return undefined;
|
|
117
121
|
};
|
|
118
122
|
|
|
119
123
|
const getInstallCommand = (runtime: string): string | undefined => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
124
|
+
const language = runtime.split("-").slice(0, -1).join("-");
|
|
125
|
+
|
|
126
|
+
switch (language) {
|
|
127
|
+
case "dart":
|
|
128
|
+
return "dart pub get";
|
|
129
|
+
case "deno":
|
|
130
|
+
return "deno cache src/main.ts";
|
|
131
|
+
case "node":
|
|
132
|
+
return "npm install";
|
|
133
|
+
case "bun":
|
|
134
|
+
return "bun install";
|
|
135
|
+
case "php":
|
|
136
|
+
return "composer install";
|
|
137
|
+
case "python":
|
|
138
|
+
case "python-ml":
|
|
139
|
+
return "pip install -r requirements.txt";
|
|
140
|
+
case "ruby":
|
|
141
|
+
return "bundle install";
|
|
142
|
+
case "rust":
|
|
143
|
+
return "cargo install";
|
|
144
|
+
case "dotnet":
|
|
145
|
+
return "dotnet restore";
|
|
146
|
+
case "swift":
|
|
147
|
+
case "java":
|
|
148
|
+
case "kotlin":
|
|
149
|
+
case "cpp":
|
|
150
|
+
return "";
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return undefined;
|
|
150
154
|
};
|
|
151
155
|
|
|
152
156
|
export const questionsInitProject: Question[] = [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return Object.keys(localConfig.getProject()).length !== 0;
|
|
160
|
-
}
|
|
157
|
+
{
|
|
158
|
+
type: "confirm",
|
|
159
|
+
name: "override",
|
|
160
|
+
message: `An ${SDK_TITLE} project ( ${localConfig.getProject()["projectId"]} ) is already associated with the current directory. Would you like to override it?`,
|
|
161
|
+
when() {
|
|
162
|
+
return Object.keys(localConfig.getProject()).length !== 0;
|
|
161
163
|
},
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "list",
|
|
167
|
+
name: "start",
|
|
168
|
+
when: whenOverride,
|
|
169
|
+
message: "How would you like to start?",
|
|
170
|
+
choices: [
|
|
171
|
+
{
|
|
172
|
+
name: "Create new project",
|
|
173
|
+
value: "new",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: "Link directory to an existing project",
|
|
177
|
+
value: "existing",
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
type: "search-list",
|
|
183
|
+
name: "organization",
|
|
184
|
+
message: "Choose your organization",
|
|
185
|
+
choices: async () => {
|
|
186
|
+
let client = await sdkForConsole(true);
|
|
187
|
+
const { teams } = isCloud()
|
|
188
|
+
? await paginate(
|
|
189
|
+
async (opts: { sdk?: Client } = {}) =>
|
|
190
|
+
(await getOrganizationsService(opts.sdk)).list(),
|
|
191
|
+
{ sdk: client },
|
|
192
|
+
100,
|
|
193
|
+
"teams",
|
|
194
|
+
)
|
|
195
|
+
: await paginate(
|
|
196
|
+
async (opts: { sdk?: Client } = {}) =>
|
|
197
|
+
(await getTeamsService(opts.sdk)).list(),
|
|
198
|
+
{ parseOutput: false, sdk: client },
|
|
199
|
+
100,
|
|
200
|
+
"teams",
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
let choices = teams.map((team: any, idx: number) => {
|
|
204
|
+
return {
|
|
205
|
+
name: `${team.name} (${team["$id"]})`,
|
|
206
|
+
value: team["$id"],
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
if (choices.length == 0) {
|
|
211
|
+
throw new Error(
|
|
212
|
+
`No organizations found. Please create a new organization at ${globalConfig.getEndpoint().replace("/v1", "/console/onboarding")}`,
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return choices;
|
|
177
217
|
},
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
218
|
+
when: whenOverride,
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: "input",
|
|
222
|
+
name: "project",
|
|
223
|
+
message: "What would you like to name your project?",
|
|
224
|
+
default: "My Awesome Project",
|
|
225
|
+
when: (answer: Answers) => answer.start !== "existing",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
type: "input",
|
|
229
|
+
name: "id",
|
|
230
|
+
message: "What ID would you like to have for your project?",
|
|
231
|
+
default: "unique()",
|
|
232
|
+
when: (answer: Answers) => answer.start !== "existing",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
type: "search-list",
|
|
236
|
+
name: "project",
|
|
237
|
+
message: `Choose your ${SDK_TITLE} project.`,
|
|
238
|
+
choices: async (answers: Answers) => {
|
|
239
|
+
const queries = [
|
|
240
|
+
JSON.stringify({
|
|
241
|
+
method: "equal",
|
|
242
|
+
attribute: "teamId",
|
|
243
|
+
values: [answers.organization],
|
|
244
|
+
}),
|
|
245
|
+
JSON.stringify({ method: "orderDesc", attribute: "$id" }),
|
|
246
|
+
];
|
|
247
|
+
|
|
248
|
+
const { projects } = await paginate(
|
|
249
|
+
async () => (await getProjectsService()).list(queries),
|
|
250
|
+
{ parseOutput: false },
|
|
251
|
+
100,
|
|
252
|
+
"projects",
|
|
253
|
+
queries,
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
let choices = projects.map((project: any) => {
|
|
257
|
+
return {
|
|
258
|
+
name: `${project.name} (${project["$id"]})`,
|
|
259
|
+
value: {
|
|
260
|
+
$id: project["$id"],
|
|
261
|
+
region: project.region || "",
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
if (choices.length === 0) {
|
|
267
|
+
throw new Error("No projects found. Please create a new project.");
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return choices;
|
|
202
271
|
},
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
272
|
+
when: (answer: Answers) => answer.start === "existing",
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
type: "list",
|
|
276
|
+
name: "region",
|
|
277
|
+
message: `Select your ${SDK_TITLE} Cloud region`,
|
|
278
|
+
choices: async () => {
|
|
279
|
+
let client = await sdkForConsole(true);
|
|
280
|
+
const endpoint = globalConfig.getEndpoint() || DEFAULT_ENDPOINT;
|
|
281
|
+
let response = (await client.call(
|
|
282
|
+
"GET",
|
|
283
|
+
new URL(endpoint + "/console/regions"),
|
|
284
|
+
)) as { regions: any[] };
|
|
285
|
+
let regions = response.regions || [];
|
|
286
|
+
if (!regions.length) {
|
|
287
|
+
throw new Error(
|
|
288
|
+
"No regions found. Please check your network or Appwrite Cloud availability.",
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
return regions
|
|
292
|
+
.filter((region: any) => !region.disabled)
|
|
293
|
+
.map((region: any) => ({
|
|
294
|
+
name: `${region.name} (${region.$id})`,
|
|
295
|
+
value: region.$id,
|
|
296
|
+
}));
|
|
216
297
|
},
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
message: "Choose your Appwrite project.",
|
|
221
|
-
choices: async (answers: Answers) => {
|
|
222
|
-
const queries = [
|
|
223
|
-
JSON.stringify({ method: 'equal', attribute: 'teamId', values: [answers.organization] }),
|
|
224
|
-
JSON.stringify({ method: 'orderDesc', attribute: '$id' })
|
|
225
|
-
]
|
|
226
|
-
|
|
227
|
-
const { projects } = await paginate(projectsList, { parseOutput: false }, 100, 'projects', queries);
|
|
228
|
-
|
|
229
|
-
let choices = projects.map((project: any) => {
|
|
230
|
-
return {
|
|
231
|
-
name: `${project.name} (${project['$id']})`,
|
|
232
|
-
value: {
|
|
233
|
-
"$id": project['$id'],
|
|
234
|
-
"region": project.region || ''
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
if (choices.length === 0) {
|
|
240
|
-
throw new Error("No projects found. Please create a new project.")
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return choices;
|
|
244
|
-
},
|
|
245
|
-
when: (answer: Answers) => answer.start === 'existing'
|
|
298
|
+
when: (answer: Answers) => {
|
|
299
|
+
if (answer.start === "existing") return false;
|
|
300
|
+
return isCloud();
|
|
246
301
|
},
|
|
247
|
-
|
|
248
|
-
type: "list",
|
|
249
|
-
name: "region",
|
|
250
|
-
message: "Select your Appwrite Cloud region",
|
|
251
|
-
choices: async () => {
|
|
252
|
-
let client = await sdkForConsole(true);
|
|
253
|
-
let response = await client.call("GET", "/console/regions");
|
|
254
|
-
let regions = response.regions || [];
|
|
255
|
-
if (!regions.length) {
|
|
256
|
-
throw new Error("No regions found. Please check your network or Appwrite Cloud availability.");
|
|
257
|
-
}
|
|
258
|
-
return regions.filter((region: any) => !region.disabled).map((region: any) => ({
|
|
259
|
-
name: `${region.name} (${region.$id})`,
|
|
260
|
-
value: region.$id
|
|
261
|
-
}));
|
|
262
|
-
},
|
|
263
|
-
when: (answer: Answers) => {
|
|
264
|
-
if (answer.start === 'existing') return false;
|
|
265
|
-
return isCloud();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
302
|
+
},
|
|
268
303
|
];
|
|
269
304
|
|
|
270
305
|
export const questionsInitProjectAutopull: Question[] = [
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
},
|
|
306
|
+
{
|
|
307
|
+
type: "confirm",
|
|
308
|
+
name: "autopull",
|
|
309
|
+
message: `Would you like to pull all resources from the project you just linked?`,
|
|
310
|
+
},
|
|
277
311
|
];
|
|
278
312
|
|
|
279
313
|
export const questionsPullResources: Question[] = [
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
314
|
+
{
|
|
315
|
+
type: "list",
|
|
316
|
+
name: "resource",
|
|
317
|
+
message: "Which resources would you like to pull?",
|
|
318
|
+
choices: [
|
|
319
|
+
{ name: `Settings ${chalk.blackBright(`(Project)`)}`, value: "settings" },
|
|
320
|
+
{
|
|
321
|
+
name: `Functions ${chalk.blackBright(`(Deployment)`)}`,
|
|
322
|
+
value: "functions",
|
|
323
|
+
},
|
|
324
|
+
{ name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: "tables" },
|
|
325
|
+
{ name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: "buckets" },
|
|
326
|
+
{ name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: "teams" },
|
|
327
|
+
{ name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: "messages" },
|
|
328
|
+
{
|
|
329
|
+
name: `Collections ${chalk.blackBright(`(Legacy Databases)`)}`,
|
|
330
|
+
value: "collections",
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
},
|
|
294
334
|
];
|
|
295
335
|
|
|
296
336
|
export const questionsPullFunctions: Question[] = [
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
337
|
+
{
|
|
338
|
+
type: "checkbox",
|
|
339
|
+
name: "functions",
|
|
340
|
+
message: "Which functions would you like to pull?",
|
|
341
|
+
validate: (value: any) => validateRequired("function", value),
|
|
342
|
+
choices: async () => {
|
|
343
|
+
const { functions } = await paginate(
|
|
344
|
+
async () => (await getFunctionsService()).list(),
|
|
345
|
+
{ parseOutput: false },
|
|
346
|
+
100,
|
|
347
|
+
"functions",
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
if (functions.length === 0) {
|
|
351
|
+
throw `We couldn't find any functions in your ${SDK_TITLE} project`;
|
|
352
|
+
}
|
|
353
|
+
return functions.map((func: any) => {
|
|
354
|
+
return {
|
|
355
|
+
name: `${func.name} (${func.$id})`,
|
|
356
|
+
value: { ...func },
|
|
357
|
+
};
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
},
|
|
316
361
|
];
|
|
317
362
|
|
|
318
363
|
export const questionsPullFunctionsCode: Question[] = [
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
364
|
+
{
|
|
365
|
+
type: "confirm",
|
|
366
|
+
name: "override",
|
|
367
|
+
message: "Do you want to pull source code of the latest deployment?",
|
|
368
|
+
},
|
|
324
369
|
];
|
|
325
370
|
|
|
326
371
|
export const questionsPullSites: Question[] = [
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
372
|
+
{
|
|
373
|
+
type: "checkbox",
|
|
374
|
+
name: "sites",
|
|
375
|
+
message: "Which sites would you like to pull?",
|
|
376
|
+
validate: (value: any) => validateRequired("site", value),
|
|
377
|
+
choices: async () => {
|
|
378
|
+
const { sites } = await paginate(
|
|
379
|
+
async () => (await getSitesService()).list(),
|
|
380
|
+
{ parseOutput: false },
|
|
381
|
+
100,
|
|
382
|
+
"sites",
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
if (sites.length === 0) {
|
|
386
|
+
throw `We couldn't find any sites in your ${SDK_TITLE} project`;
|
|
387
|
+
}
|
|
388
|
+
return sites.map((site: any) => {
|
|
389
|
+
return {
|
|
390
|
+
name: `${site.name} (${site.$id})`,
|
|
391
|
+
value: { ...site },
|
|
392
|
+
};
|
|
393
|
+
});
|
|
394
|
+
},
|
|
395
|
+
},
|
|
346
396
|
];
|
|
347
397
|
|
|
348
398
|
export const questionsPullSitesCode: Question[] = [
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
399
|
+
{
|
|
400
|
+
type: "confirm",
|
|
401
|
+
name: "override",
|
|
402
|
+
message: "Do you want to pull source code of the latest deployment?",
|
|
403
|
+
},
|
|
354
404
|
];
|
|
355
405
|
|
|
356
406
|
export const questionsCreateFunction: Question[] = [
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
407
|
+
{
|
|
408
|
+
type: "input",
|
|
409
|
+
name: "name",
|
|
410
|
+
message: "What would you like to name your function?",
|
|
411
|
+
default: "My Awesome Function",
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
type: "input",
|
|
415
|
+
name: "id",
|
|
416
|
+
message: "What ID would you like to have for your function?",
|
|
417
|
+
default: "unique()",
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
type: "list",
|
|
421
|
+
name: "runtime",
|
|
422
|
+
message: "What runtime would you like to use?",
|
|
423
|
+
choices: async () => {
|
|
424
|
+
let response = await (await getFunctionsService()).listRuntimes();
|
|
425
|
+
let runtimes = response["runtimes"];
|
|
426
|
+
let choices = runtimes.map((runtime: any, idx: number) => {
|
|
427
|
+
return {
|
|
428
|
+
name: `${runtime.name} (${runtime["$id"]})`,
|
|
429
|
+
value: {
|
|
430
|
+
id: runtime["$id"],
|
|
431
|
+
name: runtime["$id"].split("-")[0],
|
|
432
|
+
entrypoint: getEntrypoint(runtime["$id"]),
|
|
433
|
+
ignore: getIgnores(runtime["$id"]),
|
|
434
|
+
commands: getInstallCommand(runtime["$id"]),
|
|
435
|
+
},
|
|
436
|
+
};
|
|
437
|
+
});
|
|
438
|
+
return choices;
|
|
362
439
|
},
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
type: "list",
|
|
443
|
+
name: "specification",
|
|
444
|
+
message: "What specification would you like to use?",
|
|
445
|
+
choices: async () => {
|
|
446
|
+
let response = await (await getFunctionsService()).listSpecifications();
|
|
447
|
+
let specifications = response["specifications"];
|
|
448
|
+
let choices = specifications.map((spec: any, idx: number) => {
|
|
449
|
+
return {
|
|
450
|
+
name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
|
|
451
|
+
value: spec.slug,
|
|
452
|
+
disabled: spec.enabled === false ? "Upgrade to use" : false,
|
|
453
|
+
};
|
|
454
|
+
});
|
|
455
|
+
return choices;
|
|
368
456
|
},
|
|
369
|
-
|
|
370
|
-
type: "list",
|
|
371
|
-
name: "runtime",
|
|
372
|
-
message: "What runtime would you like to use?",
|
|
373
|
-
choices: async () => {
|
|
374
|
-
let response = await functionsListRuntimes({
|
|
375
|
-
parseOutput: false
|
|
376
|
-
})
|
|
377
|
-
let runtimes = response["runtimes"]
|
|
378
|
-
let choices = runtimes.map((runtime: any, idx: number) => {
|
|
379
|
-
return {
|
|
380
|
-
name: `${runtime.name} (${runtime['$id']})`,
|
|
381
|
-
value: {
|
|
382
|
-
id: runtime['$id'],
|
|
383
|
-
name: runtime['$id'].split('-')[0],
|
|
384
|
-
entrypoint: getEntrypoint(runtime['$id']),
|
|
385
|
-
ignore: getIgnores(runtime['$id']),
|
|
386
|
-
commands: getInstallCommand(runtime['$id'])
|
|
387
|
-
},
|
|
388
|
-
}
|
|
389
|
-
})
|
|
390
|
-
return choices;
|
|
391
|
-
},
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
type: "list",
|
|
395
|
-
name: "specification",
|
|
396
|
-
message: "What specification would you like to use?",
|
|
397
|
-
choices: async () => {
|
|
398
|
-
let response = await functionsListSpecifications({
|
|
399
|
-
parseOutput: false
|
|
400
|
-
})
|
|
401
|
-
let specifications = response["specifications"]
|
|
402
|
-
let choices = specifications.map((spec: any, idx: number) => {
|
|
403
|
-
return {
|
|
404
|
-
name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
|
|
405
|
-
value: spec.slug,
|
|
406
|
-
disabled: spec.enabled === false ? 'Upgrade to use' : false
|
|
407
|
-
}
|
|
408
|
-
})
|
|
409
|
-
return choices;
|
|
410
|
-
},
|
|
411
|
-
}
|
|
457
|
+
},
|
|
412
458
|
];
|
|
413
459
|
|
|
414
|
-
export const questionsCreateFunctionSelectTemplate = (
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
460
|
+
export const questionsCreateFunctionSelectTemplate = (
|
|
461
|
+
templates: string[],
|
|
462
|
+
): Question[] => {
|
|
463
|
+
return [
|
|
464
|
+
{
|
|
465
|
+
type: "search-list",
|
|
466
|
+
name: "template",
|
|
467
|
+
message: "What template would you like to use?",
|
|
468
|
+
choices: templates.map((template) => {
|
|
469
|
+
const name =
|
|
470
|
+
`${template[0].toUpperCase()}${template.split("").slice(1).join("")}`.replace(
|
|
471
|
+
/[-_]/g,
|
|
472
|
+
" ",
|
|
473
|
+
);
|
|
474
|
+
|
|
475
|
+
return { value: template, name };
|
|
476
|
+
}),
|
|
477
|
+
},
|
|
478
|
+
];
|
|
427
479
|
};
|
|
428
480
|
|
|
429
481
|
export const questionsCreateBucket: Question[] = [
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
482
|
+
{
|
|
483
|
+
type: "input",
|
|
484
|
+
name: "bucket",
|
|
485
|
+
message: "What would you like to name your bucket?",
|
|
486
|
+
default: "My Awesome Bucket",
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
type: "input",
|
|
490
|
+
name: "id",
|
|
491
|
+
message: "What ID would you like to have for your bucket?",
|
|
492
|
+
default: "unique()",
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
type: "list",
|
|
496
|
+
name: "fileSecurity",
|
|
497
|
+
message: "Enable File-Security configuring permissions for individual file",
|
|
498
|
+
choices: ["No", "Yes"],
|
|
499
|
+
},
|
|
448
500
|
];
|
|
449
501
|
|
|
450
502
|
export const questionsCreateTeam: Question[] = [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
503
|
+
{
|
|
504
|
+
type: "input",
|
|
505
|
+
name: "team",
|
|
506
|
+
message: "What would you like to name your team?",
|
|
507
|
+
default: "My Awesome Team",
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
type: "input",
|
|
511
|
+
name: "id",
|
|
512
|
+
message: "What ID would you like to have for your team?",
|
|
513
|
+
default: "unique()",
|
|
514
|
+
},
|
|
463
515
|
];
|
|
464
516
|
|
|
465
517
|
export const questionsCreateCollection: Question[] = [
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
518
|
+
{
|
|
519
|
+
type: "list",
|
|
520
|
+
name: "method",
|
|
521
|
+
message: "What database would you like to use for your collection",
|
|
522
|
+
choices: ["New", "Existing"],
|
|
523
|
+
when: async () => {
|
|
524
|
+
return localConfig.getDatabases().length !== 0;
|
|
474
525
|
},
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
{
|
|
498
|
-
type: "input",
|
|
499
|
-
name: "databaseName",
|
|
500
|
-
message: "What would you like to name your database?",
|
|
501
|
-
default: "My Awesome Database",
|
|
502
|
-
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
type: "input",
|
|
506
|
-
name: "databaseId",
|
|
507
|
-
message: "What ID would you like to have for your database?",
|
|
508
|
-
default: "unique()",
|
|
509
|
-
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
type: "input",
|
|
513
|
-
name: "collection",
|
|
514
|
-
message: "What would you like to name your collection?",
|
|
515
|
-
default: "My Awesome Collection"
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
type: "search-list",
|
|
529
|
+
name: "database",
|
|
530
|
+
message: "Choose the collection database",
|
|
531
|
+
choices: async () => {
|
|
532
|
+
const databases = localConfig.getDatabases();
|
|
533
|
+
|
|
534
|
+
let choices = databases.map((database: any, idx: number) => {
|
|
535
|
+
return {
|
|
536
|
+
name: `${database.name} (${database.$id})`,
|
|
537
|
+
value: database.$id,
|
|
538
|
+
};
|
|
539
|
+
});
|
|
540
|
+
|
|
541
|
+
if (choices.length === 0) {
|
|
542
|
+
throw new Error(
|
|
543
|
+
"No databases found. Please create one in project console.",
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return choices;
|
|
516
548
|
},
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
549
|
+
when: (answers: Answers) =>
|
|
550
|
+
(answers.method ?? "").toLowerCase() === "existing",
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
type: "input",
|
|
554
|
+
name: "databaseName",
|
|
555
|
+
message: "What would you like to name your database?",
|
|
556
|
+
default: "My Awesome Database",
|
|
557
|
+
when: (answers: Answers) =>
|
|
558
|
+
(answers.method ?? "").toLowerCase() !== "existing",
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
type: "input",
|
|
562
|
+
name: "databaseId",
|
|
563
|
+
message: "What ID would you like to have for your database?",
|
|
564
|
+
default: "unique()",
|
|
565
|
+
when: (answers: Answers) =>
|
|
566
|
+
(answers.method ?? "").toLowerCase() !== "existing",
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
type: "input",
|
|
570
|
+
name: "collection",
|
|
571
|
+
message: "What would you like to name your collection?",
|
|
572
|
+
default: "My Awesome Collection",
|
|
573
|
+
},
|
|
574
|
+
{
|
|
575
|
+
type: "input",
|
|
576
|
+
name: "id",
|
|
577
|
+
message: "What ID would you like to have for your collection?",
|
|
578
|
+
default: "unique()",
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
type: "list",
|
|
582
|
+
name: "documentSecurity",
|
|
583
|
+
message:
|
|
584
|
+
"Enable document security for configuring permissions for individual documents",
|
|
585
|
+
choices: ["No", "Yes"],
|
|
586
|
+
},
|
|
529
587
|
];
|
|
530
588
|
|
|
531
589
|
export const questionsCreateTable: Question[] = [
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
590
|
+
{
|
|
591
|
+
type: "list",
|
|
592
|
+
name: "method",
|
|
593
|
+
message: "What database would you like to use for your table?",
|
|
594
|
+
choices: ["New", "Existing"],
|
|
595
|
+
when: async () => {
|
|
596
|
+
return localConfig.getTablesDBs().length !== 0;
|
|
540
597
|
},
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
{
|
|
564
|
-
type: "input",
|
|
565
|
-
name: "databaseName",
|
|
566
|
-
message: "What would you like to name your database?",
|
|
567
|
-
default: "My Awesome Database",
|
|
568
|
-
when: (answers: Answers) => (answers.method ?? '').toLowerCase() !== 'existing'
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
type: "search-list",
|
|
601
|
+
name: "database",
|
|
602
|
+
message: "Choose the table database",
|
|
603
|
+
choices: async () => {
|
|
604
|
+
const databases = localConfig.getTablesDBs();
|
|
605
|
+
|
|
606
|
+
let choices = databases.map((database: any, idx: number) => {
|
|
607
|
+
return {
|
|
608
|
+
name: `${database.name} (${database.$id})`,
|
|
609
|
+
value: database.$id,
|
|
610
|
+
};
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
if (choices.length === 0) {
|
|
614
|
+
throw new Error(
|
|
615
|
+
"No databases found. Please create one in project console.",
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
return choices;
|
|
569
620
|
},
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
621
|
+
when: (answers: Answers) =>
|
|
622
|
+
(answers.method ?? "").toLowerCase() === "existing",
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
type: "input",
|
|
626
|
+
name: "databaseName",
|
|
627
|
+
message: "What would you like to name your database?",
|
|
628
|
+
default: "My Awesome Database",
|
|
629
|
+
when: (answers: Answers) =>
|
|
630
|
+
(answers.method ?? "").toLowerCase() !== "existing",
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
type: "input",
|
|
634
|
+
name: "databaseId",
|
|
635
|
+
message: "What ID would you like to have for your database?",
|
|
636
|
+
default: "unique()",
|
|
637
|
+
when: (answers: Answers) =>
|
|
638
|
+
(answers.method ?? "").toLowerCase() !== "existing",
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
type: "input",
|
|
642
|
+
name: "table",
|
|
643
|
+
message: "What would you like to name your table?",
|
|
644
|
+
default: "My Awesome Table",
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
type: "input",
|
|
648
|
+
name: "id",
|
|
649
|
+
message: "What ID would you like to have for your table?",
|
|
650
|
+
default: "unique()",
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
type: "list",
|
|
654
|
+
name: "rowSecurity",
|
|
655
|
+
message:
|
|
656
|
+
"Enable row security for configuring permissions for individual rows",
|
|
657
|
+
choices: ["No", "Yes"],
|
|
658
|
+
},
|
|
595
659
|
];
|
|
596
660
|
|
|
597
661
|
export const questionsCreateMessagingTopic: Question[] = [
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
662
|
+
{
|
|
663
|
+
type: "input",
|
|
664
|
+
name: "topic",
|
|
665
|
+
message: "What would you like to name your messaging topic?",
|
|
666
|
+
default: "My Awesome Topic",
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
type: "input",
|
|
670
|
+
name: "id",
|
|
671
|
+
message: "What ID would you like to have for your messaging topic?",
|
|
672
|
+
default: "unique()",
|
|
673
|
+
},
|
|
610
674
|
];
|
|
611
675
|
|
|
612
676
|
export const questionsPullCollection: Question[] = [
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
677
|
+
{
|
|
678
|
+
type: "checkbox",
|
|
679
|
+
name: "databases",
|
|
680
|
+
message: "From which database would you like to pull collections?",
|
|
681
|
+
validate: (value: any) => validateRequired("collection", value),
|
|
682
|
+
choices: async () => {
|
|
683
|
+
let response = await (await getDatabasesService()).list();
|
|
684
|
+
let databases = response["databases"];
|
|
685
|
+
|
|
686
|
+
if (databases.length <= 0) {
|
|
687
|
+
throw new Error(
|
|
688
|
+
"No databases found. Please create one in project console.",
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
let choices = databases.map((database: any, idx: number) => {
|
|
692
|
+
return {
|
|
693
|
+
name: `${database.name} (${database.$id})`,
|
|
694
|
+
value: database.$id,
|
|
695
|
+
};
|
|
696
|
+
});
|
|
697
|
+
return choices;
|
|
698
|
+
},
|
|
699
|
+
},
|
|
636
700
|
];
|
|
637
701
|
|
|
638
702
|
export const questionsLogin: Question[] = [
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
},
|
|
659
|
-
when: (answers: Answers) => answers.method !== 'select'
|
|
703
|
+
{
|
|
704
|
+
type: "list",
|
|
705
|
+
name: "method",
|
|
706
|
+
message: "What would you like to do?",
|
|
707
|
+
choices: [
|
|
708
|
+
{ name: "Login to an account", value: "login" },
|
|
709
|
+
{ name: "Switch to an account", value: "select" },
|
|
710
|
+
],
|
|
711
|
+
when: () => globalConfig.getSessions().length >= 2,
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
type: "input",
|
|
715
|
+
name: "email",
|
|
716
|
+
message: "Enter your email",
|
|
717
|
+
validate(value: string) {
|
|
718
|
+
if (!value) {
|
|
719
|
+
return "Please enter your email";
|
|
720
|
+
}
|
|
721
|
+
return true;
|
|
660
722
|
},
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
723
|
+
when: (answers: Answers) => answers.method !== "select",
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
type: "password",
|
|
727
|
+
name: "password",
|
|
728
|
+
message: "Enter your password",
|
|
729
|
+
mask: "*",
|
|
730
|
+
validate(value: string) {
|
|
731
|
+
if (!value) {
|
|
732
|
+
return "Please enter your password";
|
|
733
|
+
}
|
|
734
|
+
return true;
|
|
673
735
|
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
736
|
+
when: (answers: Answers) => answers.method !== "select",
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
type: "search-list",
|
|
740
|
+
name: "accountId",
|
|
741
|
+
message: "Select an account to use",
|
|
742
|
+
choices() {
|
|
743
|
+
const sessions = globalConfig.getSessions();
|
|
744
|
+
const current = globalConfig.getCurrentSession();
|
|
745
|
+
|
|
746
|
+
const data: Choice[] = [];
|
|
747
|
+
|
|
748
|
+
const longestEmail = sessions.reduce((prev: any, current: any) =>
|
|
749
|
+
prev && (prev.email ?? "").length > (current.email ?? "").length
|
|
750
|
+
? prev
|
|
751
|
+
: current,
|
|
752
|
+
).email.length;
|
|
753
|
+
|
|
754
|
+
sessions.forEach((session: any) => {
|
|
755
|
+
if (session.email) {
|
|
756
|
+
data.push({
|
|
757
|
+
current: current === session.id,
|
|
758
|
+
value: session.id,
|
|
759
|
+
name: `${session.email.padEnd(longestEmail)} ${current === session.id ? chalk.green.bold("current") : " ".repeat(6)} ${session.endpoint}`,
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
|
|
764
|
+
return data.sort((a, b) => Number(b.current) - Number(a.current));
|
|
699
765
|
},
|
|
766
|
+
when: (answers: Answers) => answers.method === "select",
|
|
767
|
+
},
|
|
700
768
|
];
|
|
701
769
|
|
|
702
770
|
export const questionGetEndpoint: Question[] = [
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
}
|
|
771
|
+
{
|
|
772
|
+
type: "input",
|
|
773
|
+
name: "endpoint",
|
|
774
|
+
message: `Enter the endpoint of your ${SDK_TITLE} server`,
|
|
775
|
+
default: "http://localhost/v1",
|
|
776
|
+
async validate(value: string) {
|
|
777
|
+
if (!value) {
|
|
778
|
+
return "Please enter a valid endpoint.";
|
|
779
|
+
}
|
|
780
|
+
let client = new Client().setEndpoint(value);
|
|
781
|
+
try {
|
|
782
|
+
let response = (await client.call(
|
|
783
|
+
"get",
|
|
784
|
+
new URL(value + "/health/version"),
|
|
785
|
+
)) as { version?: string };
|
|
786
|
+
if (response.version) {
|
|
787
|
+
return true;
|
|
788
|
+
} else {
|
|
789
|
+
throw new Error();
|
|
723
790
|
}
|
|
724
|
-
|
|
791
|
+
} catch (error) {
|
|
792
|
+
return "Invalid endpoint or your Appwrite server is not running as expected.";
|
|
793
|
+
}
|
|
794
|
+
},
|
|
795
|
+
},
|
|
725
796
|
];
|
|
726
797
|
|
|
727
798
|
export const questionsLogout: Question[] = [
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
799
|
+
{
|
|
800
|
+
type: "checkbox",
|
|
801
|
+
name: "accounts",
|
|
802
|
+
message: "Select accounts to logout from",
|
|
803
|
+
validate: (value: any) => validateRequired("account", value),
|
|
804
|
+
choices() {
|
|
805
|
+
const sessions = globalConfig.getSessions();
|
|
806
|
+
const current = globalConfig.getCurrentSession();
|
|
807
|
+
|
|
808
|
+
const data: Choice[] = [];
|
|
809
|
+
|
|
810
|
+
const longestEmail = sessions.reduce((prev: any, current: any) =>
|
|
811
|
+
prev && (prev.email ?? "").length > (current.email ?? "").length
|
|
812
|
+
? prev
|
|
813
|
+
: current,
|
|
814
|
+
).email.length;
|
|
815
|
+
|
|
816
|
+
sessions.forEach((session: any) => {
|
|
817
|
+
if (session.email) {
|
|
818
|
+
data.push({
|
|
819
|
+
current: current === session.id,
|
|
820
|
+
value: session.id,
|
|
821
|
+
name: `${session.email.padEnd(longestEmail)} ${current === session.id ? chalk.green.bold("current") : " ".repeat(6)} ${session.endpoint}`,
|
|
822
|
+
});
|
|
752
823
|
}
|
|
753
|
-
|
|
824
|
+
});
|
|
825
|
+
|
|
826
|
+
return data.sort((a, b) => Number(b.current) - Number(a.current));
|
|
827
|
+
},
|
|
828
|
+
},
|
|
754
829
|
];
|
|
755
830
|
|
|
756
831
|
export const questionsPushResources: Question[] = [
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
832
|
+
{
|
|
833
|
+
type: "list",
|
|
834
|
+
name: "resource",
|
|
835
|
+
message: "Which resources would you like to push?",
|
|
836
|
+
choices: [
|
|
837
|
+
{ name: `Settings ${chalk.blackBright(`(Project)`)}`, value: "settings" },
|
|
838
|
+
{
|
|
839
|
+
name: `Functions ${chalk.blackBright(`(Deployment)`)}`,
|
|
840
|
+
value: "functions",
|
|
841
|
+
},
|
|
842
|
+
{ name: `Tables ${chalk.blackBright(`(TablesDB)`)}`, value: "tables" },
|
|
843
|
+
{ name: `Buckets ${chalk.blackBright(`(Storage)`)}`, value: "buckets" },
|
|
844
|
+
{ name: `Teams ${chalk.blackBright(`(Auth)`)}`, value: "teams" },
|
|
845
|
+
{ name: `Topics ${chalk.blackBright(`(Messaging)`)}`, value: "messages" },
|
|
846
|
+
{
|
|
847
|
+
name: `Collections ${chalk.blackBright(`(Legacy Databases)`)}`,
|
|
848
|
+
value: "collections",
|
|
849
|
+
},
|
|
850
|
+
],
|
|
851
|
+
},
|
|
771
852
|
];
|
|
772
853
|
|
|
773
854
|
export const questionsInitResources: Question[] = [
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
855
|
+
{
|
|
856
|
+
type: "list",
|
|
857
|
+
name: "resource",
|
|
858
|
+
message: "Which resource would you create?",
|
|
859
|
+
choices: [
|
|
860
|
+
{ name: "Function", value: "function" },
|
|
861
|
+
{ name: "Site", value: "site" },
|
|
862
|
+
{ name: "Table", value: "table" },
|
|
863
|
+
{ name: "Bucket", value: "bucket" },
|
|
864
|
+
{ name: "Team", value: "team" },
|
|
865
|
+
{ name: "Topic", value: "message" },
|
|
866
|
+
{ name: "Collection", value: "collection" },
|
|
867
|
+
],
|
|
868
|
+
},
|
|
788
869
|
];
|
|
789
870
|
|
|
790
871
|
export const questionsPushSites: Question[] = [
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
872
|
+
{
|
|
873
|
+
type: "checkbox",
|
|
874
|
+
name: "sites",
|
|
875
|
+
message: "Which sites would you like to push?",
|
|
876
|
+
validate: (value: any) => validateRequired("site", value),
|
|
877
|
+
when: () => localConfig.getSites().length > 0,
|
|
878
|
+
choices: () => {
|
|
879
|
+
let sites = localConfig.getSites();
|
|
880
|
+
checkDeployConditions(localConfig);
|
|
881
|
+
let choices = sites.map((site: any, idx: number) => {
|
|
882
|
+
return {
|
|
883
|
+
name: `${site.name} (${site.$id})`,
|
|
884
|
+
value: site.$id,
|
|
885
|
+
};
|
|
886
|
+
});
|
|
887
|
+
return choices;
|
|
808
888
|
},
|
|
889
|
+
},
|
|
809
890
|
];
|
|
810
891
|
|
|
811
892
|
export const questionsPushFunctions: Question[] = [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
}
|
|
893
|
+
{
|
|
894
|
+
type: "checkbox",
|
|
895
|
+
name: "functions",
|
|
896
|
+
message: "Which functions would you like to push?",
|
|
897
|
+
validate: (value: any) => validateRequired("function", value),
|
|
898
|
+
when: () => localConfig.getFunctions().length > 0,
|
|
899
|
+
choices: () => {
|
|
900
|
+
let functions = localConfig.getFunctions();
|
|
901
|
+
checkDeployConditions(localConfig);
|
|
902
|
+
let choices = functions.map((func: any, idx: number) => {
|
|
903
|
+
return {
|
|
904
|
+
name: `${func.name} (${func.$id})`,
|
|
905
|
+
value: func.$id,
|
|
906
|
+
};
|
|
907
|
+
});
|
|
908
|
+
return choices;
|
|
829
909
|
},
|
|
910
|
+
},
|
|
830
911
|
];
|
|
831
912
|
|
|
832
913
|
export const questionsPushCollections: Question[] = [
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
914
|
+
{
|
|
915
|
+
type: "checkbox",
|
|
916
|
+
name: "collections",
|
|
917
|
+
message: "Which collections would you like to push?",
|
|
918
|
+
validate: (value: any) => validateRequired("collection", value),
|
|
919
|
+
when: () => localConfig.getCollections().length > 0,
|
|
920
|
+
choices: () => {
|
|
921
|
+
let collections = localConfig.getCollections();
|
|
922
|
+
checkDeployConditions(localConfig);
|
|
923
|
+
|
|
924
|
+
return collections.map((collection: any) => {
|
|
925
|
+
return {
|
|
926
|
+
name: `${collection.name} (${collection["databaseId"]} - ${collection["$id"]})`,
|
|
927
|
+
value: `${collection["databaseId"]}|${collection["$id"]}`,
|
|
928
|
+
};
|
|
929
|
+
});
|
|
930
|
+
},
|
|
931
|
+
},
|
|
851
932
|
];
|
|
852
933
|
|
|
853
934
|
export const questionsPushTables: Question[] = [
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
935
|
+
{
|
|
936
|
+
type: "checkbox",
|
|
937
|
+
name: "tables",
|
|
938
|
+
message: "Which tables would you like to push?",
|
|
939
|
+
validate: (value: any) => validateRequired("table", value),
|
|
940
|
+
when: () => localConfig.getTables().length > 0,
|
|
941
|
+
choices: () => {
|
|
942
|
+
let tables = localConfig.getTables();
|
|
943
|
+
checkDeployConditions(localConfig);
|
|
944
|
+
|
|
945
|
+
return tables.map((table: any) => {
|
|
946
|
+
return {
|
|
947
|
+
name: `${table.name} (${table["databaseId"]} - ${table["$id"]})`,
|
|
948
|
+
value: `${table["databaseId"]}|${table["$id"]}`,
|
|
949
|
+
};
|
|
950
|
+
});
|
|
951
|
+
},
|
|
952
|
+
},
|
|
872
953
|
];
|
|
873
954
|
|
|
874
955
|
export const questionPushChanges: Question[] = [
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
956
|
+
{
|
|
957
|
+
type: "input",
|
|
958
|
+
name: "changes",
|
|
959
|
+
message: `Are you sure you want to apply these changes? (YES/NO)`,
|
|
960
|
+
},
|
|
880
961
|
];
|
|
881
962
|
|
|
882
963
|
export const questionPushChangesConfirmation: Question[] = [
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
964
|
+
{
|
|
965
|
+
type: "input",
|
|
966
|
+
name: "changes",
|
|
967
|
+
message: `Please type 'YES' or 'NO':`,
|
|
968
|
+
},
|
|
888
969
|
];
|
|
889
970
|
|
|
890
971
|
export const questionsPushBuckets: Question[] = [
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
972
|
+
{
|
|
973
|
+
type: "checkbox",
|
|
974
|
+
name: "buckets",
|
|
975
|
+
message: "Which buckets would you like to push?",
|
|
976
|
+
validate: (value: any) => validateRequired("bucket", value),
|
|
977
|
+
when: () => localConfig.getBuckets().length > 0,
|
|
978
|
+
choices: () => {
|
|
979
|
+
let buckets = localConfig.getBuckets();
|
|
980
|
+
checkDeployConditions(localConfig);
|
|
981
|
+
|
|
982
|
+
return buckets.map((bucket: any) => {
|
|
983
|
+
return {
|
|
984
|
+
name: `${bucket.name} (${bucket["$id"]})`,
|
|
985
|
+
value: bucket.$id,
|
|
986
|
+
};
|
|
987
|
+
});
|
|
988
|
+
},
|
|
989
|
+
},
|
|
909
990
|
];
|
|
910
991
|
|
|
911
992
|
export const questionsPushMessagingTopics: Question[] = [
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
993
|
+
{
|
|
994
|
+
type: "checkbox",
|
|
995
|
+
name: "topics",
|
|
996
|
+
message: "Which messaging topic would you like to push?",
|
|
997
|
+
validate: (value: any) => validateRequired("topics", value),
|
|
998
|
+
when: () => localConfig.getMessagingTopics().length > 0,
|
|
999
|
+
choices: () => {
|
|
1000
|
+
let topics = localConfig.getMessagingTopics();
|
|
1001
|
+
|
|
1002
|
+
return topics.map((topic: any) => {
|
|
1003
|
+
return {
|
|
1004
|
+
name: `${topic.name} (${topic["$id"]})`,
|
|
1005
|
+
value: topic.$id,
|
|
1006
|
+
};
|
|
1007
|
+
});
|
|
1008
|
+
},
|
|
1009
|
+
},
|
|
929
1010
|
];
|
|
930
1011
|
|
|
931
1012
|
export const questionsGetEntrypoint: Question[] = [
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
return true;
|
|
942
|
-
}
|
|
1013
|
+
{
|
|
1014
|
+
type: "input",
|
|
1015
|
+
name: "entrypoint",
|
|
1016
|
+
message: "Enter the entrypoint",
|
|
1017
|
+
validate(value: string) {
|
|
1018
|
+
if (!value) {
|
|
1019
|
+
return "Please enter your entrypoint";
|
|
1020
|
+
}
|
|
1021
|
+
return true;
|
|
943
1022
|
},
|
|
1023
|
+
},
|
|
944
1024
|
];
|
|
945
1025
|
|
|
946
1026
|
export const questionsPushTeams: Question[] = [
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
}
|
|
1027
|
+
{
|
|
1028
|
+
type: "checkbox",
|
|
1029
|
+
name: "teams",
|
|
1030
|
+
message: "Which teams would you like to push?",
|
|
1031
|
+
validate: (value: any) => validateRequired("team", value),
|
|
1032
|
+
when: () => localConfig.getTeams().length > 0,
|
|
1033
|
+
choices: () => {
|
|
1034
|
+
let teams = localConfig.getTeams();
|
|
1035
|
+
checkDeployConditions(localConfig);
|
|
1036
|
+
|
|
1037
|
+
return teams.map((team: any) => {
|
|
1038
|
+
return {
|
|
1039
|
+
name: `${team.name} (${team["$id"]})`,
|
|
1040
|
+
value: team.$id,
|
|
1041
|
+
};
|
|
1042
|
+
});
|
|
964
1043
|
},
|
|
1044
|
+
},
|
|
965
1045
|
];
|
|
966
1046
|
|
|
967
1047
|
export const questionsListFactors: Question[] = [
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
}
|
|
1048
|
+
{
|
|
1049
|
+
type: "list",
|
|
1050
|
+
name: "factor",
|
|
1051
|
+
message:
|
|
1052
|
+
"Your account is protected by multi-factor authentication. Please choose one for verification.",
|
|
1053
|
+
choices: async () => {
|
|
1054
|
+
let client = await sdkForConsole(false);
|
|
1055
|
+
const accountClient = new Account(client);
|
|
1056
|
+
const factors = await accountClient.listMfaFactors();
|
|
1057
|
+
|
|
1058
|
+
const choices = [
|
|
1059
|
+
{
|
|
1060
|
+
name: `Authenticator app (Get a code from a third-party authenticator app)`,
|
|
1061
|
+
value: "totp",
|
|
1062
|
+
},
|
|
1063
|
+
{
|
|
1064
|
+
name: `Email (Get a security code at your ${SDK_TITLE} email address)`,
|
|
1065
|
+
value: "email",
|
|
1066
|
+
},
|
|
1067
|
+
{
|
|
1068
|
+
name: `SMS (Get a security code on your ${SDK_TITLE} phone number)`,
|
|
1069
|
+
value: "phone",
|
|
1070
|
+
},
|
|
1071
|
+
{
|
|
1072
|
+
name: `Recovery code (Use one of your recovery codes for verification)`,
|
|
1073
|
+
value: "recoveryCode",
|
|
1074
|
+
},
|
|
1075
|
+
].filter((ch) => factors[ch.value] === true);
|
|
1076
|
+
|
|
1077
|
+
return choices;
|
|
1078
|
+
},
|
|
1079
|
+
},
|
|
1001
1080
|
];
|
|
1002
1081
|
|
|
1003
1082
|
export const questionsMFAChallenge: Question[] = [
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1083
|
+
{
|
|
1084
|
+
type: "input",
|
|
1085
|
+
name: "otp",
|
|
1086
|
+
message: "Enter OTP",
|
|
1087
|
+
validate(value: string) {
|
|
1088
|
+
if (!value) {
|
|
1089
|
+
return "Please enter OTP";
|
|
1090
|
+
}
|
|
1091
|
+
return true;
|
|
1092
|
+
},
|
|
1093
|
+
},
|
|
1015
1094
|
];
|
|
1016
1095
|
|
|
1017
1096
|
export const questionsRunFunctions: Question[] = [
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1097
|
+
{
|
|
1098
|
+
type: "list",
|
|
1099
|
+
name: "function",
|
|
1100
|
+
message: "Which function would you like to develop locally?",
|
|
1101
|
+
validate: (value: any) => validateRequired("function", value),
|
|
1102
|
+
choices: () => {
|
|
1103
|
+
let functions = localConfig.getFunctions();
|
|
1104
|
+
if (functions.length === 0) {
|
|
1105
|
+
throw new Error(
|
|
1106
|
+
`No functions found. Use '${EXECUTABLE_NAME} pull functions' to synchronize existing one, or use '${EXECUTABLE_NAME} init function' to create a new one.`,
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
let choices = functions.map((func: any, idx: number) => {
|
|
1110
|
+
return {
|
|
1111
|
+
name: `${func.name} (${func.$id})`,
|
|
1112
|
+
value: func.$id,
|
|
1113
|
+
};
|
|
1114
|
+
});
|
|
1115
|
+
return choices;
|
|
1116
|
+
},
|
|
1117
|
+
},
|
|
1037
1118
|
];
|
|
1038
1119
|
|
|
1039
1120
|
export const questionsCreateSite: Question[] = [
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1121
|
+
{
|
|
1122
|
+
type: "input",
|
|
1123
|
+
name: "name",
|
|
1124
|
+
message: "What would you like to name your site?",
|
|
1125
|
+
default: "My Awesome Site",
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
type: "input",
|
|
1129
|
+
name: "id",
|
|
1130
|
+
message: "What ID would you like to have for your site?",
|
|
1131
|
+
default: "unique()",
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
type: "list",
|
|
1135
|
+
name: "framework",
|
|
1136
|
+
message: "What framework would you like to use?",
|
|
1137
|
+
choices: async () => {
|
|
1138
|
+
let response = await (await getSitesService()).listFrameworks();
|
|
1139
|
+
let frameworks = response["frameworks"];
|
|
1140
|
+
let choices = frameworks.map((framework: any) => {
|
|
1141
|
+
return {
|
|
1142
|
+
name: `${framework.name} (${framework.key})`,
|
|
1143
|
+
value: framework,
|
|
1144
|
+
};
|
|
1145
|
+
});
|
|
1146
|
+
return choices;
|
|
1051
1147
|
},
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
},
|
|
1148
|
+
},
|
|
1149
|
+
{
|
|
1150
|
+
type: "list",
|
|
1151
|
+
name: "specification",
|
|
1152
|
+
message: "What specification would you like to use?",
|
|
1153
|
+
choices: async () => {
|
|
1154
|
+
let response = await (await getSitesService()).listSpecifications();
|
|
1155
|
+
let specifications = response["specifications"];
|
|
1156
|
+
let choices = specifications.map((spec: any) => {
|
|
1157
|
+
return {
|
|
1158
|
+
name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
|
|
1159
|
+
value: spec.slug,
|
|
1160
|
+
disabled: spec.enabled === false ? "Upgrade to use" : false,
|
|
1161
|
+
};
|
|
1162
|
+
});
|
|
1163
|
+
return choices;
|
|
1069
1164
|
},
|
|
1070
|
-
|
|
1071
|
-
type: "list",
|
|
1072
|
-
name: "specification",
|
|
1073
|
-
message: "What specification would you like to use?",
|
|
1074
|
-
choices: async () => {
|
|
1075
|
-
let response = await sitesListSpecifications({
|
|
1076
|
-
parseOutput: false
|
|
1077
|
-
});
|
|
1078
|
-
let specifications = response["specifications"];
|
|
1079
|
-
let choices = specifications.map((spec: any) => {
|
|
1080
|
-
return {
|
|
1081
|
-
name: `${spec.cpus} CPU, ${spec.memory}MB RAM`,
|
|
1082
|
-
value: spec.slug,
|
|
1083
|
-
disabled: spec.enabled === false ? 'Upgrade to use' : false
|
|
1084
|
-
}
|
|
1085
|
-
});
|
|
1086
|
-
return choices;
|
|
1087
|
-
},
|
|
1088
|
-
}
|
|
1165
|
+
},
|
|
1089
1166
|
];
|
|
1090
|
-
|