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
|
@@ -1,1587 +0,0 @@
|
|
|
1
|
-
import fs = require('fs');
|
|
2
|
-
import pathLib = require('path');
|
|
3
|
-
import tar = require('tar');
|
|
4
|
-
import ignore = require('ignore');
|
|
5
|
-
import { promisify } from 'util';
|
|
6
|
-
import Client from '../client';
|
|
7
|
-
import { getAllFiles, showConsoleLink } from '../utils';
|
|
8
|
-
import { Command } from 'commander';
|
|
9
|
-
import { sdkForProject, sdkForConsole } from '../sdks';
|
|
10
|
-
import { parse, actionRunner, parseInteger, parseBool, commandDescriptions, success, log, warn } from '../parser';
|
|
11
|
-
import { localConfig, globalConfig } from '../config';
|
|
12
|
-
import { File } from 'undici';
|
|
13
|
-
import { ReadableStream } from 'stream/web';
|
|
14
|
-
|
|
15
|
-
function convertReadStreamToReadableStream(readStream: fs.ReadStream): ReadableStream {
|
|
16
|
-
return new ReadableStream({
|
|
17
|
-
start(controller) {
|
|
18
|
-
readStream.on("data", (chunk: Buffer) => {
|
|
19
|
-
controller.enqueue(chunk);
|
|
20
|
-
});
|
|
21
|
-
readStream.on("end", () => {
|
|
22
|
-
controller.close();
|
|
23
|
-
});
|
|
24
|
-
readStream.on("error", (err: Error) => {
|
|
25
|
-
controller.error(err);
|
|
26
|
-
});
|
|
27
|
-
},
|
|
28
|
-
cancel() {
|
|
29
|
-
readStream.destroy();
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const functions = new Command("functions").description(commandDescriptions['functions'] ?? '').configureHelp({
|
|
35
|
-
helpWidth: process.stdout.columns || 80
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
interface FunctionsListRequestParams {
|
|
39
|
-
queries?: string[];
|
|
40
|
-
search?: string;
|
|
41
|
-
total?: boolean;
|
|
42
|
-
overrideForCli?: boolean;
|
|
43
|
-
parseOutput?: boolean;
|
|
44
|
-
sdk?: Client;
|
|
45
|
-
console?: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const functionsList = async ({queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListRequestParams): Promise<any> => {
|
|
49
|
-
let client = !sdk ? await sdkForProject() :
|
|
50
|
-
sdk;
|
|
51
|
-
let apiPath = '/functions';
|
|
52
|
-
let payload = {};
|
|
53
|
-
if (typeof queries !== 'undefined') {
|
|
54
|
-
payload['queries'] = queries;
|
|
55
|
-
}
|
|
56
|
-
if (typeof search !== 'undefined') {
|
|
57
|
-
payload['search'] = search;
|
|
58
|
-
}
|
|
59
|
-
if (typeof total !== 'undefined') {
|
|
60
|
-
payload['total'] = total;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
let response = undefined;
|
|
64
|
-
|
|
65
|
-
response = await client.call('get', apiPath, {
|
|
66
|
-
}, payload);
|
|
67
|
-
|
|
68
|
-
if (parseOutput) {
|
|
69
|
-
if(showConsole) {
|
|
70
|
-
showConsoleLink('functions', 'list');
|
|
71
|
-
} else {
|
|
72
|
-
parse(response)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return response;
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
interface FunctionsCreateRequestParams {
|
|
80
|
-
functionId: string;
|
|
81
|
-
name: string;
|
|
82
|
-
runtime: Runtime;
|
|
83
|
-
execute?: string[];
|
|
84
|
-
events?: string[];
|
|
85
|
-
schedule?: string;
|
|
86
|
-
timeout?: number;
|
|
87
|
-
enabled?: boolean;
|
|
88
|
-
logging?: boolean;
|
|
89
|
-
entrypoint?: string;
|
|
90
|
-
commands?: string;
|
|
91
|
-
scopes?: string[];
|
|
92
|
-
installationId?: string;
|
|
93
|
-
providerRepositoryId?: string;
|
|
94
|
-
providerBranch?: string;
|
|
95
|
-
providerSilentMode?: boolean;
|
|
96
|
-
providerRootDirectory?: string;
|
|
97
|
-
specification?: string;
|
|
98
|
-
overrideForCli?: boolean;
|
|
99
|
-
parseOutput?: boolean;
|
|
100
|
-
sdk?: Client;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export const functionsCreate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateRequestParams): Promise<any> => {
|
|
104
|
-
let client = !sdk ? await sdkForProject() :
|
|
105
|
-
sdk;
|
|
106
|
-
let apiPath = '/functions';
|
|
107
|
-
let payload = {};
|
|
108
|
-
if (typeof functionId !== 'undefined') {
|
|
109
|
-
payload['functionId'] = functionId;
|
|
110
|
-
}
|
|
111
|
-
if (typeof name !== 'undefined') {
|
|
112
|
-
payload['name'] = name;
|
|
113
|
-
}
|
|
114
|
-
if (typeof runtime !== 'undefined') {
|
|
115
|
-
payload['runtime'] = runtime;
|
|
116
|
-
}
|
|
117
|
-
execute = execute === true ? [] : execute;
|
|
118
|
-
if (typeof execute !== 'undefined') {
|
|
119
|
-
payload['execute'] = execute;
|
|
120
|
-
}
|
|
121
|
-
events = events === true ? [] : events;
|
|
122
|
-
if (typeof events !== 'undefined') {
|
|
123
|
-
payload['events'] = events;
|
|
124
|
-
}
|
|
125
|
-
if (typeof schedule !== 'undefined') {
|
|
126
|
-
payload['schedule'] = schedule;
|
|
127
|
-
}
|
|
128
|
-
if (typeof timeout !== 'undefined') {
|
|
129
|
-
payload['timeout'] = timeout;
|
|
130
|
-
}
|
|
131
|
-
if (typeof enabled !== 'undefined') {
|
|
132
|
-
payload['enabled'] = enabled;
|
|
133
|
-
}
|
|
134
|
-
if (typeof logging !== 'undefined') {
|
|
135
|
-
payload['logging'] = logging;
|
|
136
|
-
}
|
|
137
|
-
if (typeof entrypoint !== 'undefined') {
|
|
138
|
-
payload['entrypoint'] = entrypoint;
|
|
139
|
-
}
|
|
140
|
-
if (typeof commands !== 'undefined') {
|
|
141
|
-
payload['commands'] = commands;
|
|
142
|
-
}
|
|
143
|
-
scopes = scopes === true ? [] : scopes;
|
|
144
|
-
if (typeof scopes !== 'undefined') {
|
|
145
|
-
payload['scopes'] = scopes;
|
|
146
|
-
}
|
|
147
|
-
if (typeof installationId !== 'undefined') {
|
|
148
|
-
payload['installationId'] = installationId;
|
|
149
|
-
}
|
|
150
|
-
if (typeof providerRepositoryId !== 'undefined') {
|
|
151
|
-
payload['providerRepositoryId'] = providerRepositoryId;
|
|
152
|
-
}
|
|
153
|
-
if (typeof providerBranch !== 'undefined') {
|
|
154
|
-
payload['providerBranch'] = providerBranch;
|
|
155
|
-
}
|
|
156
|
-
if (typeof providerSilentMode !== 'undefined') {
|
|
157
|
-
payload['providerSilentMode'] = providerSilentMode;
|
|
158
|
-
}
|
|
159
|
-
if (typeof providerRootDirectory !== 'undefined') {
|
|
160
|
-
payload['providerRootDirectory'] = providerRootDirectory;
|
|
161
|
-
}
|
|
162
|
-
if (typeof specification !== 'undefined') {
|
|
163
|
-
payload['specification'] = specification;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
let response = undefined;
|
|
167
|
-
|
|
168
|
-
response = await client.call('post', apiPath, {
|
|
169
|
-
'content-type': 'application/json',
|
|
170
|
-
}, payload);
|
|
171
|
-
|
|
172
|
-
if (parseOutput) {
|
|
173
|
-
parse(response)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
return response;
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
interface FunctionsListRuntimesRequestParams {
|
|
180
|
-
overrideForCli?: boolean;
|
|
181
|
-
parseOutput?: boolean;
|
|
182
|
-
sdk?: Client;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export const functionsListRuntimes = async ({parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsListRuntimesRequestParams): Promise<any> => {
|
|
186
|
-
let client = !sdk ? await sdkForProject() :
|
|
187
|
-
sdk;
|
|
188
|
-
let apiPath = '/functions/runtimes';
|
|
189
|
-
let payload = {};
|
|
190
|
-
|
|
191
|
-
let response = undefined;
|
|
192
|
-
|
|
193
|
-
response = await client.call('get', apiPath, {
|
|
194
|
-
}, payload);
|
|
195
|
-
|
|
196
|
-
if (parseOutput) {
|
|
197
|
-
parse(response)
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return response;
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
interface FunctionsListSpecificationsRequestParams {
|
|
204
|
-
overrideForCli?: boolean;
|
|
205
|
-
parseOutput?: boolean;
|
|
206
|
-
sdk?: Client;
|
|
207
|
-
console?: boolean;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export const functionsListSpecifications = async ({parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListSpecificationsRequestParams): Promise<any> => {
|
|
211
|
-
let client = !sdk ? await sdkForProject() :
|
|
212
|
-
sdk;
|
|
213
|
-
let apiPath = '/functions/specifications';
|
|
214
|
-
let payload = {};
|
|
215
|
-
|
|
216
|
-
let response = undefined;
|
|
217
|
-
|
|
218
|
-
response = await client.call('get', apiPath, {
|
|
219
|
-
}, payload);
|
|
220
|
-
|
|
221
|
-
if (parseOutput) {
|
|
222
|
-
if(showConsole) {
|
|
223
|
-
showConsoleLink('functions', 'listSpecifications');
|
|
224
|
-
} else {
|
|
225
|
-
parse(response)
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return response;
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
interface FunctionsListTemplatesRequestParams {
|
|
233
|
-
runtimes?: string[];
|
|
234
|
-
useCases?: string[];
|
|
235
|
-
limit?: number;
|
|
236
|
-
offset?: number;
|
|
237
|
-
total?: boolean;
|
|
238
|
-
overrideForCli?: boolean;
|
|
239
|
-
parseOutput?: boolean;
|
|
240
|
-
sdk?: Client;
|
|
241
|
-
console?: boolean;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export const functionsListTemplates = async ({runtimes,useCases,limit,offset,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListTemplatesRequestParams): Promise<any> => {
|
|
245
|
-
let client = !sdk ? await sdkForProject() :
|
|
246
|
-
sdk;
|
|
247
|
-
let apiPath = '/functions/templates';
|
|
248
|
-
let payload = {};
|
|
249
|
-
if (typeof runtimes !== 'undefined') {
|
|
250
|
-
payload['runtimes'] = runtimes;
|
|
251
|
-
}
|
|
252
|
-
if (typeof useCases !== 'undefined') {
|
|
253
|
-
payload['useCases'] = useCases;
|
|
254
|
-
}
|
|
255
|
-
if (typeof limit !== 'undefined') {
|
|
256
|
-
payload['limit'] = limit;
|
|
257
|
-
}
|
|
258
|
-
if (typeof offset !== 'undefined') {
|
|
259
|
-
payload['offset'] = offset;
|
|
260
|
-
}
|
|
261
|
-
if (typeof total !== 'undefined') {
|
|
262
|
-
payload['total'] = total;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
let response = undefined;
|
|
266
|
-
|
|
267
|
-
response = await client.call('get', apiPath, {
|
|
268
|
-
}, payload);
|
|
269
|
-
|
|
270
|
-
if (parseOutput) {
|
|
271
|
-
if(showConsole) {
|
|
272
|
-
showConsoleLink('functions', 'listTemplates');
|
|
273
|
-
} else {
|
|
274
|
-
parse(response)
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
return response;
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
interface FunctionsGetTemplateRequestParams {
|
|
282
|
-
templateId: string;
|
|
283
|
-
overrideForCli?: boolean;
|
|
284
|
-
parseOutput?: boolean;
|
|
285
|
-
sdk?: Client;
|
|
286
|
-
console?: boolean;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
export const functionsGetTemplate = async ({templateId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetTemplateRequestParams): Promise<any> => {
|
|
290
|
-
let client = !sdk ? await sdkForProject() :
|
|
291
|
-
sdk;
|
|
292
|
-
let apiPath = '/functions/templates/{templateId}'.replace('{templateId}', templateId);
|
|
293
|
-
let payload = {};
|
|
294
|
-
|
|
295
|
-
let response = undefined;
|
|
296
|
-
|
|
297
|
-
response = await client.call('get', apiPath, {
|
|
298
|
-
}, payload);
|
|
299
|
-
|
|
300
|
-
if (parseOutput) {
|
|
301
|
-
if(showConsole) {
|
|
302
|
-
showConsoleLink('functions', 'getTemplate', templateId);
|
|
303
|
-
} else {
|
|
304
|
-
parse(response)
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
return response;
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
interface FunctionsListUsageRequestParams {
|
|
312
|
-
range?: UsageRange;
|
|
313
|
-
overrideForCli?: boolean;
|
|
314
|
-
parseOutput?: boolean;
|
|
315
|
-
sdk?: Client;
|
|
316
|
-
console?: boolean;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export const functionsListUsage = async ({range,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListUsageRequestParams): Promise<any> => {
|
|
320
|
-
let client = !sdk ? await sdkForProject() :
|
|
321
|
-
sdk;
|
|
322
|
-
let apiPath = '/functions/usage';
|
|
323
|
-
let payload = {};
|
|
324
|
-
if (typeof range !== 'undefined') {
|
|
325
|
-
payload['range'] = range;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
let response = undefined;
|
|
329
|
-
|
|
330
|
-
response = await client.call('get', apiPath, {
|
|
331
|
-
}, payload);
|
|
332
|
-
|
|
333
|
-
if (parseOutput) {
|
|
334
|
-
if(showConsole) {
|
|
335
|
-
showConsoleLink('functions', 'listUsage');
|
|
336
|
-
} else {
|
|
337
|
-
parse(response)
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return response;
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
interface FunctionsGetRequestParams {
|
|
345
|
-
functionId: string;
|
|
346
|
-
overrideForCli?: boolean;
|
|
347
|
-
parseOutput?: boolean;
|
|
348
|
-
sdk?: Client;
|
|
349
|
-
console?: boolean;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
export const functionsGet = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetRequestParams): Promise<any> => {
|
|
353
|
-
let client = !sdk ? await sdkForProject() :
|
|
354
|
-
sdk;
|
|
355
|
-
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
356
|
-
let payload = {};
|
|
357
|
-
|
|
358
|
-
let response = undefined;
|
|
359
|
-
|
|
360
|
-
response = await client.call('get', apiPath, {
|
|
361
|
-
}, payload);
|
|
362
|
-
|
|
363
|
-
if (parseOutput) {
|
|
364
|
-
if(showConsole) {
|
|
365
|
-
showConsoleLink('functions', 'get', functionId);
|
|
366
|
-
} else {
|
|
367
|
-
parse(response)
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return response;
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
interface FunctionsUpdateRequestParams {
|
|
375
|
-
functionId: string;
|
|
376
|
-
name: string;
|
|
377
|
-
runtime?: Runtime;
|
|
378
|
-
execute?: string[];
|
|
379
|
-
events?: string[];
|
|
380
|
-
schedule?: string;
|
|
381
|
-
timeout?: number;
|
|
382
|
-
enabled?: boolean;
|
|
383
|
-
logging?: boolean;
|
|
384
|
-
entrypoint?: string;
|
|
385
|
-
commands?: string;
|
|
386
|
-
scopes?: string[];
|
|
387
|
-
installationId?: string;
|
|
388
|
-
providerRepositoryId?: string;
|
|
389
|
-
providerBranch?: string;
|
|
390
|
-
providerSilentMode?: boolean;
|
|
391
|
-
providerRootDirectory?: string;
|
|
392
|
-
specification?: string;
|
|
393
|
-
overrideForCli?: boolean;
|
|
394
|
-
parseOutput?: boolean;
|
|
395
|
-
sdk?: Client;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
export const functionsUpdate = async ({functionId,name,runtime,execute,events,schedule,timeout,enabled,logging,entrypoint,commands,scopes,installationId,providerRepositoryId,providerBranch,providerSilentMode,providerRootDirectory,specification,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateRequestParams): Promise<any> => {
|
|
399
|
-
let client = !sdk ? await sdkForProject() :
|
|
400
|
-
sdk;
|
|
401
|
-
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
402
|
-
let payload = {};
|
|
403
|
-
if (typeof name !== 'undefined') {
|
|
404
|
-
payload['name'] = name;
|
|
405
|
-
}
|
|
406
|
-
if (typeof runtime !== 'undefined') {
|
|
407
|
-
payload['runtime'] = runtime;
|
|
408
|
-
}
|
|
409
|
-
execute = execute === true ? [] : execute;
|
|
410
|
-
if (typeof execute !== 'undefined') {
|
|
411
|
-
payload['execute'] = execute;
|
|
412
|
-
}
|
|
413
|
-
events = events === true ? [] : events;
|
|
414
|
-
if (typeof events !== 'undefined') {
|
|
415
|
-
payload['events'] = events;
|
|
416
|
-
}
|
|
417
|
-
if (typeof schedule !== 'undefined') {
|
|
418
|
-
payload['schedule'] = schedule;
|
|
419
|
-
}
|
|
420
|
-
if (typeof timeout !== 'undefined') {
|
|
421
|
-
payload['timeout'] = timeout;
|
|
422
|
-
}
|
|
423
|
-
if (typeof enabled !== 'undefined') {
|
|
424
|
-
payload['enabled'] = enabled;
|
|
425
|
-
}
|
|
426
|
-
if (typeof logging !== 'undefined') {
|
|
427
|
-
payload['logging'] = logging;
|
|
428
|
-
}
|
|
429
|
-
if (typeof entrypoint !== 'undefined') {
|
|
430
|
-
payload['entrypoint'] = entrypoint;
|
|
431
|
-
}
|
|
432
|
-
if (typeof commands !== 'undefined') {
|
|
433
|
-
payload['commands'] = commands;
|
|
434
|
-
}
|
|
435
|
-
scopes = scopes === true ? [] : scopes;
|
|
436
|
-
if (typeof scopes !== 'undefined') {
|
|
437
|
-
payload['scopes'] = scopes;
|
|
438
|
-
}
|
|
439
|
-
if (typeof installationId !== 'undefined') {
|
|
440
|
-
payload['installationId'] = installationId;
|
|
441
|
-
}
|
|
442
|
-
if (typeof providerRepositoryId !== 'undefined') {
|
|
443
|
-
payload['providerRepositoryId'] = providerRepositoryId;
|
|
444
|
-
}
|
|
445
|
-
if (typeof providerBranch !== 'undefined') {
|
|
446
|
-
payload['providerBranch'] = providerBranch;
|
|
447
|
-
}
|
|
448
|
-
if (typeof providerSilentMode !== 'undefined') {
|
|
449
|
-
payload['providerSilentMode'] = providerSilentMode;
|
|
450
|
-
}
|
|
451
|
-
if (typeof providerRootDirectory !== 'undefined') {
|
|
452
|
-
payload['providerRootDirectory'] = providerRootDirectory;
|
|
453
|
-
}
|
|
454
|
-
if (typeof specification !== 'undefined') {
|
|
455
|
-
payload['specification'] = specification;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
let response = undefined;
|
|
459
|
-
|
|
460
|
-
response = await client.call('put', apiPath, {
|
|
461
|
-
'content-type': 'application/json',
|
|
462
|
-
}, payload);
|
|
463
|
-
|
|
464
|
-
if (parseOutput) {
|
|
465
|
-
parse(response)
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
return response;
|
|
469
|
-
|
|
470
|
-
}
|
|
471
|
-
interface FunctionsDeleteRequestParams {
|
|
472
|
-
functionId: string;
|
|
473
|
-
overrideForCli?: boolean;
|
|
474
|
-
parseOutput?: boolean;
|
|
475
|
-
sdk?: Client;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
export const functionsDelete = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteRequestParams): Promise<any> => {
|
|
479
|
-
let client = !sdk ? await sdkForProject() :
|
|
480
|
-
sdk;
|
|
481
|
-
let apiPath = '/functions/{functionId}'.replace('{functionId}', functionId);
|
|
482
|
-
let payload = {};
|
|
483
|
-
|
|
484
|
-
let response = undefined;
|
|
485
|
-
|
|
486
|
-
response = await client.call('delete', apiPath, {
|
|
487
|
-
'content-type': 'application/json',
|
|
488
|
-
}, payload);
|
|
489
|
-
|
|
490
|
-
if (parseOutput) {
|
|
491
|
-
parse(response)
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
return response;
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
interface FunctionsUpdateFunctionDeploymentRequestParams {
|
|
498
|
-
functionId: string;
|
|
499
|
-
deploymentId: string;
|
|
500
|
-
overrideForCli?: boolean;
|
|
501
|
-
parseOutput?: boolean;
|
|
502
|
-
sdk?: Client;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
export const functionsUpdateFunctionDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateFunctionDeploymentRequestParams): Promise<any> => {
|
|
506
|
-
let client = !sdk ? await sdkForProject() :
|
|
507
|
-
sdk;
|
|
508
|
-
let apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId);
|
|
509
|
-
let payload = {};
|
|
510
|
-
if (typeof deploymentId !== 'undefined') {
|
|
511
|
-
payload['deploymentId'] = deploymentId;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
let response = undefined;
|
|
515
|
-
|
|
516
|
-
response = await client.call('patch', apiPath, {
|
|
517
|
-
'content-type': 'application/json',
|
|
518
|
-
}, payload);
|
|
519
|
-
|
|
520
|
-
if (parseOutput) {
|
|
521
|
-
parse(response)
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return response;
|
|
525
|
-
|
|
526
|
-
}
|
|
527
|
-
interface FunctionsListDeploymentsRequestParams {
|
|
528
|
-
functionId: string;
|
|
529
|
-
queries?: string[];
|
|
530
|
-
search?: string;
|
|
531
|
-
total?: boolean;
|
|
532
|
-
overrideForCli?: boolean;
|
|
533
|
-
parseOutput?: boolean;
|
|
534
|
-
sdk?: Client;
|
|
535
|
-
console?: boolean;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
export const functionsListDeployments = async ({functionId,queries,search,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListDeploymentsRequestParams): Promise<any> => {
|
|
539
|
-
let client = !sdk ? await sdkForProject() :
|
|
540
|
-
sdk;
|
|
541
|
-
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
542
|
-
let payload = {};
|
|
543
|
-
if (typeof queries !== 'undefined') {
|
|
544
|
-
payload['queries'] = queries;
|
|
545
|
-
}
|
|
546
|
-
if (typeof search !== 'undefined') {
|
|
547
|
-
payload['search'] = search;
|
|
548
|
-
}
|
|
549
|
-
if (typeof total !== 'undefined') {
|
|
550
|
-
payload['total'] = total;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
let response = undefined;
|
|
554
|
-
|
|
555
|
-
response = await client.call('get', apiPath, {
|
|
556
|
-
}, payload);
|
|
557
|
-
|
|
558
|
-
if (parseOutput) {
|
|
559
|
-
if(showConsole) {
|
|
560
|
-
showConsoleLink('functions', 'listDeployments', functionId);
|
|
561
|
-
} else {
|
|
562
|
-
parse(response)
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
return response;
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
interface FunctionsCreateDeploymentRequestParams {
|
|
570
|
-
functionId: string;
|
|
571
|
-
code: string;
|
|
572
|
-
activate: boolean;
|
|
573
|
-
entrypoint?: string;
|
|
574
|
-
commands?: string;
|
|
575
|
-
overrideForCli?: boolean;
|
|
576
|
-
parseOutput?: boolean;
|
|
577
|
-
sdk?: Client;
|
|
578
|
-
onProgress?: (progress: number) => void;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
export const functionsCreateDeployment = async ({functionId,code,activate,entrypoint,commands,parseOutput = true, overrideForCli = false, sdk = undefined,onProgress = () => {}}: FunctionsCreateDeploymentRequestParams): Promise<any> => {
|
|
582
|
-
let client = !sdk ? await sdkForProject() :
|
|
583
|
-
sdk;
|
|
584
|
-
let apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId);
|
|
585
|
-
let payload = {};
|
|
586
|
-
if (typeof entrypoint !== 'undefined') {
|
|
587
|
-
payload['entrypoint'] = entrypoint;
|
|
588
|
-
}
|
|
589
|
-
if (typeof commands !== 'undefined') {
|
|
590
|
-
payload['commands'] = commands;
|
|
591
|
-
}
|
|
592
|
-
const folderPath = fs.realpathSync(code);
|
|
593
|
-
if (!fs.lstatSync(folderPath).isDirectory()) {
|
|
594
|
-
throw new Error('The path is not a directory.');
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
const ignorer = ignore();
|
|
598
|
-
|
|
599
|
-
const resourceId = functionId;
|
|
600
|
-
const resourceConfig = localConfig.getFunction(resourceId);
|
|
601
|
-
|
|
602
|
-
ignorer.add('.appwrite');
|
|
603
|
-
|
|
604
|
-
if (resourceConfig.ignore) {
|
|
605
|
-
ignorer.add(resourceConfig.ignore);
|
|
606
|
-
} else if (fs.existsSync(pathLib.join(code, '.gitignore'))) {
|
|
607
|
-
ignorer.add(fs.readFileSync(pathLib.join(code, '.gitignore')).toString());
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
const files = getAllFiles(code).map((file) => pathLib.relative(code, file)).filter((file) => !ignorer.ignores(file));
|
|
611
|
-
|
|
612
|
-
const archiveFileName = `functions-${resourceId}-code.tar.gz`;
|
|
613
|
-
|
|
614
|
-
await tar
|
|
615
|
-
.create({
|
|
616
|
-
gzip: true,
|
|
617
|
-
sync: true,
|
|
618
|
-
cwd: folderPath,
|
|
619
|
-
file: archiveFileName
|
|
620
|
-
}, files);
|
|
621
|
-
|
|
622
|
-
let archivePath = fs.realpathSync(archiveFileName)
|
|
623
|
-
if (typeof archivePath !== 'undefined') {
|
|
624
|
-
payload['code'] = archivePath;
|
|
625
|
-
code = archivePath;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
const filePath = fs.realpathSync(code);
|
|
629
|
-
const nodeStream = fs.createReadStream(filePath);
|
|
630
|
-
const stream = convertReadStreamToReadableStream(nodeStream);
|
|
631
|
-
|
|
632
|
-
if (typeof filePath !== 'undefined') {
|
|
633
|
-
code = { type: 'file', stream, filename: pathLib.basename(filePath), size: fs.statSync(filePath).size };
|
|
634
|
-
payload['code'] = code
|
|
635
|
-
}
|
|
636
|
-
if (typeof activate !== 'undefined') {
|
|
637
|
-
payload['activate'] = activate;
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
const size = code.size;
|
|
641
|
-
|
|
642
|
-
const apiHeaders = {
|
|
643
|
-
'content-type': 'multipart/form-data',
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
let id = undefined;
|
|
647
|
-
let response = undefined;
|
|
648
|
-
|
|
649
|
-
let chunksUploaded = 0;
|
|
650
|
-
|
|
651
|
-
let currentChunk = 1;
|
|
652
|
-
let currentPosition = 0;
|
|
653
|
-
let uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
|
|
654
|
-
|
|
655
|
-
const uploadChunk = async (lastUpload = false) => {
|
|
656
|
-
if(currentChunk <= chunksUploaded) {
|
|
657
|
-
return;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
const start = ((currentChunk - 1) * client.CHUNK_SIZE);
|
|
661
|
-
let end = start + currentPosition - 1;
|
|
662
|
-
|
|
663
|
-
if(!lastUpload || currentChunk !== 1) {
|
|
664
|
-
apiHeaders['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
let uploadableChunkTrimmed;
|
|
668
|
-
|
|
669
|
-
if(currentPosition + 1 >= client.CHUNK_SIZE) {
|
|
670
|
-
uploadableChunkTrimmed = uploadableChunk;
|
|
671
|
-
} else {
|
|
672
|
-
uploadableChunkTrimmed = new Uint8Array(currentPosition);
|
|
673
|
-
for(let i = 0; i <= currentPosition; i++) {
|
|
674
|
-
uploadableChunkTrimmed[i] = uploadableChunk[i];
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
if (id) {
|
|
679
|
-
apiHeaders['x-appwrite-id'] = id;
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
payload['code'] = { type: 'file', file: new File([uploadableChunkTrimmed], code.filename), filename: code.filename };
|
|
683
|
-
|
|
684
|
-
response = await client.call('post', apiPath, apiHeaders, payload);
|
|
685
|
-
|
|
686
|
-
if (!id) {
|
|
687
|
-
id = response['$id'];
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (onProgress !== null) {
|
|
691
|
-
onProgress({
|
|
692
|
-
$id: response['$id'],
|
|
693
|
-
progress: Math.min((currentChunk) * client.CHUNK_SIZE, size) / size * 100,
|
|
694
|
-
sizeUploaded: end+1,
|
|
695
|
-
chunksTotal: response['chunksTotal'],
|
|
696
|
-
chunksUploaded: response['chunksUploaded']
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
|
|
701
|
-
currentChunk++;
|
|
702
|
-
currentPosition = 0;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
for await (const chunk of code.stream) {
|
|
706
|
-
for(const b of chunk) {
|
|
707
|
-
uploadableChunk[currentPosition] = b;
|
|
708
|
-
|
|
709
|
-
currentPosition++;
|
|
710
|
-
if(currentPosition >= client.CHUNK_SIZE) {
|
|
711
|
-
await uploadChunk();
|
|
712
|
-
currentPosition = 0;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
if (currentPosition > 0) { // Check if there's any remaining data for the last chunk
|
|
718
|
-
await uploadChunk(true);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
await fs.unlink(filePath,()=>{});
|
|
722
|
-
|
|
723
|
-
if (parseOutput) {
|
|
724
|
-
parse(response)
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
return response;
|
|
728
|
-
}
|
|
729
|
-
interface FunctionsCreateDuplicateDeploymentRequestParams {
|
|
730
|
-
functionId: string;
|
|
731
|
-
deploymentId: string;
|
|
732
|
-
buildId?: string;
|
|
733
|
-
overrideForCli?: boolean;
|
|
734
|
-
parseOutput?: boolean;
|
|
735
|
-
sdk?: Client;
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
export const functionsCreateDuplicateDeployment = async ({functionId,deploymentId,buildId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateDuplicateDeploymentRequestParams): Promise<any> => {
|
|
739
|
-
let client = !sdk ? await sdkForProject() :
|
|
740
|
-
sdk;
|
|
741
|
-
let apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId);
|
|
742
|
-
let payload = {};
|
|
743
|
-
if (typeof deploymentId !== 'undefined') {
|
|
744
|
-
payload['deploymentId'] = deploymentId;
|
|
745
|
-
}
|
|
746
|
-
if (typeof buildId !== 'undefined') {
|
|
747
|
-
payload['buildId'] = buildId;
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
let response = undefined;
|
|
751
|
-
|
|
752
|
-
response = await client.call('post', apiPath, {
|
|
753
|
-
'content-type': 'application/json',
|
|
754
|
-
}, payload);
|
|
755
|
-
|
|
756
|
-
if (parseOutput) {
|
|
757
|
-
parse(response)
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
return response;
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
interface FunctionsCreateTemplateDeploymentRequestParams {
|
|
764
|
-
functionId: string;
|
|
765
|
-
repository: string;
|
|
766
|
-
owner: string;
|
|
767
|
-
rootDirectory: string;
|
|
768
|
-
type: TemplateReferenceType;
|
|
769
|
-
reference: string;
|
|
770
|
-
activate?: boolean;
|
|
771
|
-
overrideForCli?: boolean;
|
|
772
|
-
parseOutput?: boolean;
|
|
773
|
-
sdk?: Client;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
export const functionsCreateTemplateDeployment = async ({functionId,repository,owner,rootDirectory,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateTemplateDeploymentRequestParams): Promise<any> => {
|
|
777
|
-
let client = !sdk ? await sdkForProject() :
|
|
778
|
-
sdk;
|
|
779
|
-
let apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId);
|
|
780
|
-
let payload = {};
|
|
781
|
-
if (typeof repository !== 'undefined') {
|
|
782
|
-
payload['repository'] = repository;
|
|
783
|
-
}
|
|
784
|
-
if (typeof owner !== 'undefined') {
|
|
785
|
-
payload['owner'] = owner;
|
|
786
|
-
}
|
|
787
|
-
if (typeof rootDirectory !== 'undefined') {
|
|
788
|
-
payload['rootDirectory'] = rootDirectory;
|
|
789
|
-
}
|
|
790
|
-
if (typeof type !== 'undefined') {
|
|
791
|
-
payload['type'] = type;
|
|
792
|
-
}
|
|
793
|
-
if (typeof reference !== 'undefined') {
|
|
794
|
-
payload['reference'] = reference;
|
|
795
|
-
}
|
|
796
|
-
if (typeof activate !== 'undefined') {
|
|
797
|
-
payload['activate'] = activate;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
let response = undefined;
|
|
801
|
-
|
|
802
|
-
response = await client.call('post', apiPath, {
|
|
803
|
-
'content-type': 'application/json',
|
|
804
|
-
}, payload);
|
|
805
|
-
|
|
806
|
-
if (parseOutput) {
|
|
807
|
-
parse(response)
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
return response;
|
|
811
|
-
|
|
812
|
-
}
|
|
813
|
-
interface FunctionsCreateVcsDeploymentRequestParams {
|
|
814
|
-
functionId: string;
|
|
815
|
-
type: VCSReferenceType;
|
|
816
|
-
reference: string;
|
|
817
|
-
activate?: boolean;
|
|
818
|
-
overrideForCli?: boolean;
|
|
819
|
-
parseOutput?: boolean;
|
|
820
|
-
sdk?: Client;
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
export const functionsCreateVcsDeployment = async ({functionId,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateVcsDeploymentRequestParams): Promise<any> => {
|
|
824
|
-
let client = !sdk ? await sdkForProject() :
|
|
825
|
-
sdk;
|
|
826
|
-
let apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId);
|
|
827
|
-
let payload = {};
|
|
828
|
-
if (typeof type !== 'undefined') {
|
|
829
|
-
payload['type'] = type;
|
|
830
|
-
}
|
|
831
|
-
if (typeof reference !== 'undefined') {
|
|
832
|
-
payload['reference'] = reference;
|
|
833
|
-
}
|
|
834
|
-
if (typeof activate !== 'undefined') {
|
|
835
|
-
payload['activate'] = activate;
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
let response = undefined;
|
|
839
|
-
|
|
840
|
-
response = await client.call('post', apiPath, {
|
|
841
|
-
'content-type': 'application/json',
|
|
842
|
-
}, payload);
|
|
843
|
-
|
|
844
|
-
if (parseOutput) {
|
|
845
|
-
parse(response)
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
return response;
|
|
849
|
-
|
|
850
|
-
}
|
|
851
|
-
interface FunctionsGetDeploymentRequestParams {
|
|
852
|
-
functionId: string;
|
|
853
|
-
deploymentId: string;
|
|
854
|
-
overrideForCli?: boolean;
|
|
855
|
-
parseOutput?: boolean;
|
|
856
|
-
sdk?: Client;
|
|
857
|
-
console?: boolean;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
export const functionsGetDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetDeploymentRequestParams): Promise<any> => {
|
|
861
|
-
let client = !sdk ? await sdkForProject() :
|
|
862
|
-
sdk;
|
|
863
|
-
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
864
|
-
let payload = {};
|
|
865
|
-
|
|
866
|
-
let response = undefined;
|
|
867
|
-
|
|
868
|
-
response = await client.call('get', apiPath, {
|
|
869
|
-
}, payload);
|
|
870
|
-
|
|
871
|
-
if (parseOutput) {
|
|
872
|
-
if(showConsole) {
|
|
873
|
-
showConsoleLink('functions', 'getDeployment', functionId, deploymentId);
|
|
874
|
-
} else {
|
|
875
|
-
parse(response)
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
return response;
|
|
880
|
-
|
|
881
|
-
}
|
|
882
|
-
interface FunctionsDeleteDeploymentRequestParams {
|
|
883
|
-
functionId: string;
|
|
884
|
-
deploymentId: string;
|
|
885
|
-
overrideForCli?: boolean;
|
|
886
|
-
parseOutput?: boolean;
|
|
887
|
-
sdk?: Client;
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
export const functionsDeleteDeployment = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteDeploymentRequestParams): Promise<any> => {
|
|
891
|
-
let client = !sdk ? await sdkForProject() :
|
|
892
|
-
sdk;
|
|
893
|
-
let apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
894
|
-
let payload = {};
|
|
895
|
-
|
|
896
|
-
let response = undefined;
|
|
897
|
-
|
|
898
|
-
response = await client.call('delete', apiPath, {
|
|
899
|
-
'content-type': 'application/json',
|
|
900
|
-
}, payload);
|
|
901
|
-
|
|
902
|
-
if (parseOutput) {
|
|
903
|
-
parse(response)
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
return response;
|
|
907
|
-
|
|
908
|
-
}
|
|
909
|
-
interface FunctionsGetDeploymentDownloadRequestParams {
|
|
910
|
-
functionId: string;
|
|
911
|
-
deploymentId: string;
|
|
912
|
-
type?: DeploymentDownloadType;
|
|
913
|
-
overrideForCli?: boolean;
|
|
914
|
-
parseOutput?: boolean;
|
|
915
|
-
sdk?: Client;
|
|
916
|
-
destination?: string;
|
|
917
|
-
console?: boolean;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
export const functionsGetDeploymentDownload = async ({functionId,deploymentId,type,parseOutput = true, overrideForCli = false, sdk = undefined, destination, console: showConsole}: FunctionsGetDeploymentDownloadRequestParams): Promise<any> => {
|
|
921
|
-
let client = !sdk ? await sdkForProject() :
|
|
922
|
-
sdk;
|
|
923
|
-
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
924
|
-
let payload = {};
|
|
925
|
-
if (typeof type !== 'undefined') {
|
|
926
|
-
payload['type'] = type;
|
|
927
|
-
}
|
|
928
|
-
if (!overrideForCli) {
|
|
929
|
-
payload['project'] = localConfig.getProject().projectId
|
|
930
|
-
payload['key'] = globalConfig.getKey();
|
|
931
|
-
const queryParams = new URLSearchParams(payload);
|
|
932
|
-
apiPath = `${globalConfig.getEndpoint()}${apiPath}?${queryParams.toString()}`;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
let response = undefined;
|
|
936
|
-
|
|
937
|
-
response = await client.call('get', apiPath, {
|
|
938
|
-
}, payload, 'arraybuffer');
|
|
939
|
-
|
|
940
|
-
if (overrideForCli) {
|
|
941
|
-
response = Buffer.from(response);
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
fs.writeFileSync(destination, response);
|
|
945
|
-
if (parseOutput) {
|
|
946
|
-
if(showConsole) {
|
|
947
|
-
showConsoleLink('functions', 'getDeploymentDownload', functionId, deploymentId);
|
|
948
|
-
} else {
|
|
949
|
-
parse(response)
|
|
950
|
-
}
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
return response;
|
|
954
|
-
|
|
955
|
-
}
|
|
956
|
-
interface FunctionsUpdateDeploymentStatusRequestParams {
|
|
957
|
-
functionId: string;
|
|
958
|
-
deploymentId: string;
|
|
959
|
-
overrideForCli?: boolean;
|
|
960
|
-
parseOutput?: boolean;
|
|
961
|
-
sdk?: Client;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
export const functionsUpdateDeploymentStatus = async ({functionId,deploymentId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateDeploymentStatusRequestParams): Promise<any> => {
|
|
965
|
-
let client = !sdk ? await sdkForProject() :
|
|
966
|
-
sdk;
|
|
967
|
-
let apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId);
|
|
968
|
-
let payload = {};
|
|
969
|
-
|
|
970
|
-
let response = undefined;
|
|
971
|
-
|
|
972
|
-
response = await client.call('patch', apiPath, {
|
|
973
|
-
'content-type': 'application/json',
|
|
974
|
-
}, payload);
|
|
975
|
-
|
|
976
|
-
if (parseOutput) {
|
|
977
|
-
parse(response)
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
return response;
|
|
981
|
-
|
|
982
|
-
}
|
|
983
|
-
interface FunctionsListExecutionsRequestParams {
|
|
984
|
-
functionId: string;
|
|
985
|
-
queries?: string[];
|
|
986
|
-
total?: boolean;
|
|
987
|
-
overrideForCli?: boolean;
|
|
988
|
-
parseOutput?: boolean;
|
|
989
|
-
sdk?: Client;
|
|
990
|
-
console?: boolean;
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
export const functionsListExecutions = async ({functionId,queries,total,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsListExecutionsRequestParams): Promise<any> => {
|
|
994
|
-
let client = !sdk ? await sdkForProject() :
|
|
995
|
-
sdk;
|
|
996
|
-
let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
997
|
-
let payload = {};
|
|
998
|
-
if (typeof queries !== 'undefined') {
|
|
999
|
-
payload['queries'] = queries;
|
|
1000
|
-
}
|
|
1001
|
-
if (typeof total !== 'undefined') {
|
|
1002
|
-
payload['total'] = total;
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
let response = undefined;
|
|
1006
|
-
|
|
1007
|
-
response = await client.call('get', apiPath, {
|
|
1008
|
-
}, payload);
|
|
1009
|
-
|
|
1010
|
-
if (parseOutput) {
|
|
1011
|
-
if(showConsole) {
|
|
1012
|
-
showConsoleLink('functions', 'listExecutions', functionId);
|
|
1013
|
-
} else {
|
|
1014
|
-
parse(response)
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
return response;
|
|
1019
|
-
|
|
1020
|
-
}
|
|
1021
|
-
interface FunctionsCreateExecutionRequestParams {
|
|
1022
|
-
functionId: string;
|
|
1023
|
-
body?: string;
|
|
1024
|
-
async?: boolean;
|
|
1025
|
-
xpath?: string;
|
|
1026
|
-
method?: ExecutionMethod;
|
|
1027
|
-
headers?: object;
|
|
1028
|
-
scheduledAt?: string;
|
|
1029
|
-
overrideForCli?: boolean;
|
|
1030
|
-
parseOutput?: boolean;
|
|
1031
|
-
sdk?: Client;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
export const functionsCreateExecution = async ({functionId,body,async,xpath,method,headers,scheduledAt,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateExecutionRequestParams): Promise<any> => {
|
|
1035
|
-
let client = !sdk ? await sdkForProject() :
|
|
1036
|
-
sdk;
|
|
1037
|
-
let apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId);
|
|
1038
|
-
let payload = {};
|
|
1039
|
-
if (typeof body !== 'undefined') {
|
|
1040
|
-
payload['body'] = body;
|
|
1041
|
-
}
|
|
1042
|
-
if (typeof async !== 'undefined') {
|
|
1043
|
-
payload['async'] = async;
|
|
1044
|
-
}
|
|
1045
|
-
if (typeof xpath !== 'undefined') {
|
|
1046
|
-
payload['path'] = xpath;
|
|
1047
|
-
}
|
|
1048
|
-
if (typeof method !== 'undefined') {
|
|
1049
|
-
payload['method'] = method;
|
|
1050
|
-
}
|
|
1051
|
-
if (typeof headers !== 'undefined') {
|
|
1052
|
-
payload['headers'] = JSON.parse(headers);
|
|
1053
|
-
}
|
|
1054
|
-
if (typeof scheduledAt !== 'undefined') {
|
|
1055
|
-
payload['scheduledAt'] = scheduledAt;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
let response = undefined;
|
|
1059
|
-
|
|
1060
|
-
response = await client.call('post', apiPath, {
|
|
1061
|
-
'content-type': 'application/json',
|
|
1062
|
-
}, payload);
|
|
1063
|
-
|
|
1064
|
-
if (parseOutput) {
|
|
1065
|
-
parse(response)
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
return response;
|
|
1069
|
-
|
|
1070
|
-
}
|
|
1071
|
-
interface FunctionsGetExecutionRequestParams {
|
|
1072
|
-
functionId: string;
|
|
1073
|
-
executionId: string;
|
|
1074
|
-
overrideForCli?: boolean;
|
|
1075
|
-
parseOutput?: boolean;
|
|
1076
|
-
sdk?: Client;
|
|
1077
|
-
console?: boolean;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
export const functionsGetExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined, console: showConsole}: FunctionsGetExecutionRequestParams): Promise<any> => {
|
|
1081
|
-
let client = !sdk ? await sdkForProject() :
|
|
1082
|
-
sdk;
|
|
1083
|
-
let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
1084
|
-
let payload = {};
|
|
1085
|
-
|
|
1086
|
-
let response = undefined;
|
|
1087
|
-
|
|
1088
|
-
response = await client.call('get', apiPath, {
|
|
1089
|
-
}, payload);
|
|
1090
|
-
|
|
1091
|
-
if (parseOutput) {
|
|
1092
|
-
if(showConsole) {
|
|
1093
|
-
showConsoleLink('functions', 'getExecution', functionId, executionId);
|
|
1094
|
-
} else {
|
|
1095
|
-
parse(response)
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
|
-
return response;
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
interface FunctionsDeleteExecutionRequestParams {
|
|
1103
|
-
functionId: string;
|
|
1104
|
-
executionId: string;
|
|
1105
|
-
overrideForCli?: boolean;
|
|
1106
|
-
parseOutput?: boolean;
|
|
1107
|
-
sdk?: Client;
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
export const functionsDeleteExecution = async ({functionId,executionId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteExecutionRequestParams): Promise<any> => {
|
|
1111
|
-
let client = !sdk ? await sdkForProject() :
|
|
1112
|
-
sdk;
|
|
1113
|
-
let apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId);
|
|
1114
|
-
let payload = {};
|
|
1115
|
-
|
|
1116
|
-
let response = undefined;
|
|
1117
|
-
|
|
1118
|
-
response = await client.call('delete', apiPath, {
|
|
1119
|
-
'content-type': 'application/json',
|
|
1120
|
-
}, payload);
|
|
1121
|
-
|
|
1122
|
-
if (parseOutput) {
|
|
1123
|
-
parse(response)
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
return response;
|
|
1127
|
-
|
|
1128
|
-
}
|
|
1129
|
-
interface FunctionsGetUsageRequestParams {
|
|
1130
|
-
functionId: string;
|
|
1131
|
-
range?: UsageRange;
|
|
1132
|
-
overrideForCli?: boolean;
|
|
1133
|
-
parseOutput?: boolean;
|
|
1134
|
-
sdk?: Client;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
export const functionsGetUsage = async ({functionId,range,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsGetUsageRequestParams): Promise<any> => {
|
|
1138
|
-
let client = !sdk ? await sdkForProject() :
|
|
1139
|
-
sdk;
|
|
1140
|
-
let apiPath = '/functions/{functionId}/usage'.replace('{functionId}', functionId);
|
|
1141
|
-
let payload = {};
|
|
1142
|
-
if (typeof range !== 'undefined') {
|
|
1143
|
-
payload['range'] = range;
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
let response = undefined;
|
|
1147
|
-
|
|
1148
|
-
response = await client.call('get', apiPath, {
|
|
1149
|
-
}, payload);
|
|
1150
|
-
|
|
1151
|
-
if (parseOutput) {
|
|
1152
|
-
parse(response)
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
return response;
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1158
|
-
interface FunctionsListVariablesRequestParams {
|
|
1159
|
-
functionId: string;
|
|
1160
|
-
overrideForCli?: boolean;
|
|
1161
|
-
parseOutput?: boolean;
|
|
1162
|
-
sdk?: Client;
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
export const functionsListVariables = async ({functionId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsListVariablesRequestParams): Promise<any> => {
|
|
1166
|
-
let client = !sdk ? await sdkForProject() :
|
|
1167
|
-
sdk;
|
|
1168
|
-
let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
1169
|
-
let payload = {};
|
|
1170
|
-
|
|
1171
|
-
let response = undefined;
|
|
1172
|
-
|
|
1173
|
-
response = await client.call('get', apiPath, {
|
|
1174
|
-
}, payload);
|
|
1175
|
-
|
|
1176
|
-
if (parseOutput) {
|
|
1177
|
-
parse(response)
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
return response;
|
|
1181
|
-
|
|
1182
|
-
}
|
|
1183
|
-
interface FunctionsCreateVariableRequestParams {
|
|
1184
|
-
functionId: string;
|
|
1185
|
-
key: string;
|
|
1186
|
-
value: string;
|
|
1187
|
-
secret?: boolean;
|
|
1188
|
-
overrideForCli?: boolean;
|
|
1189
|
-
parseOutput?: boolean;
|
|
1190
|
-
sdk?: Client;
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
export const functionsCreateVariable = async ({functionId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsCreateVariableRequestParams): Promise<any> => {
|
|
1194
|
-
let client = !sdk ? await sdkForProject() :
|
|
1195
|
-
sdk;
|
|
1196
|
-
let apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId);
|
|
1197
|
-
let payload = {};
|
|
1198
|
-
if (typeof key !== 'undefined') {
|
|
1199
|
-
payload['key'] = key;
|
|
1200
|
-
}
|
|
1201
|
-
if (typeof value !== 'undefined') {
|
|
1202
|
-
payload['value'] = value;
|
|
1203
|
-
}
|
|
1204
|
-
if (typeof secret !== 'undefined') {
|
|
1205
|
-
payload['secret'] = secret;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
let response = undefined;
|
|
1209
|
-
|
|
1210
|
-
response = await client.call('post', apiPath, {
|
|
1211
|
-
'content-type': 'application/json',
|
|
1212
|
-
}, payload);
|
|
1213
|
-
|
|
1214
|
-
if (parseOutput) {
|
|
1215
|
-
parse(response)
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
return response;
|
|
1219
|
-
|
|
1220
|
-
}
|
|
1221
|
-
interface FunctionsGetVariableRequestParams {
|
|
1222
|
-
functionId: string;
|
|
1223
|
-
variableId: string;
|
|
1224
|
-
overrideForCli?: boolean;
|
|
1225
|
-
parseOutput?: boolean;
|
|
1226
|
-
sdk?: Client;
|
|
1227
|
-
}
|
|
1228
|
-
|
|
1229
|
-
export const functionsGetVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsGetVariableRequestParams): Promise<any> => {
|
|
1230
|
-
let client = !sdk ? await sdkForProject() :
|
|
1231
|
-
sdk;
|
|
1232
|
-
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
1233
|
-
let payload = {};
|
|
1234
|
-
|
|
1235
|
-
let response = undefined;
|
|
1236
|
-
|
|
1237
|
-
response = await client.call('get', apiPath, {
|
|
1238
|
-
}, payload);
|
|
1239
|
-
|
|
1240
|
-
if (parseOutput) {
|
|
1241
|
-
parse(response)
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
return response;
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1247
|
-
interface FunctionsUpdateVariableRequestParams {
|
|
1248
|
-
functionId: string;
|
|
1249
|
-
variableId: string;
|
|
1250
|
-
key: string;
|
|
1251
|
-
value?: string;
|
|
1252
|
-
secret?: boolean;
|
|
1253
|
-
overrideForCli?: boolean;
|
|
1254
|
-
parseOutput?: boolean;
|
|
1255
|
-
sdk?: Client;
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
export const functionsUpdateVariable = async ({functionId,variableId,key,value,secret,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsUpdateVariableRequestParams): Promise<any> => {
|
|
1259
|
-
let client = !sdk ? await sdkForProject() :
|
|
1260
|
-
sdk;
|
|
1261
|
-
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
1262
|
-
let payload = {};
|
|
1263
|
-
if (typeof key !== 'undefined') {
|
|
1264
|
-
payload['key'] = key;
|
|
1265
|
-
}
|
|
1266
|
-
if (typeof value !== 'undefined') {
|
|
1267
|
-
payload['value'] = value;
|
|
1268
|
-
}
|
|
1269
|
-
if (typeof secret !== 'undefined') {
|
|
1270
|
-
payload['secret'] = secret;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
let response = undefined;
|
|
1274
|
-
|
|
1275
|
-
response = await client.call('put', apiPath, {
|
|
1276
|
-
'content-type': 'application/json',
|
|
1277
|
-
}, payload);
|
|
1278
|
-
|
|
1279
|
-
if (parseOutput) {
|
|
1280
|
-
parse(response)
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
return response;
|
|
1284
|
-
|
|
1285
|
-
}
|
|
1286
|
-
interface FunctionsDeleteVariableRequestParams {
|
|
1287
|
-
functionId: string;
|
|
1288
|
-
variableId: string;
|
|
1289
|
-
overrideForCli?: boolean;
|
|
1290
|
-
parseOutput?: boolean;
|
|
1291
|
-
sdk?: Client;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
export const functionsDeleteVariable = async ({functionId,variableId,parseOutput = true, overrideForCli = false, sdk = undefined}: FunctionsDeleteVariableRequestParams): Promise<any> => {
|
|
1295
|
-
let client = !sdk ? await sdkForProject() :
|
|
1296
|
-
sdk;
|
|
1297
|
-
let apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId);
|
|
1298
|
-
let payload = {};
|
|
1299
|
-
|
|
1300
|
-
let response = undefined;
|
|
1301
|
-
|
|
1302
|
-
response = await client.call('delete', apiPath, {
|
|
1303
|
-
'content-type': 'application/json',
|
|
1304
|
-
}, payload);
|
|
1305
|
-
|
|
1306
|
-
if (parseOutput) {
|
|
1307
|
-
parse(response)
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
return response;
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
functions
|
|
1314
|
-
.command(`list`)
|
|
1315
|
-
.description(`Get a list of all the project's functions. You can use the query params to filter your results.`)
|
|
1316
|
-
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId`)
|
|
1317
|
-
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
1318
|
-
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1319
|
-
.option(`--console`, `Get the resource console url`)
|
|
1320
|
-
.action(actionRunner(functionsList))
|
|
1321
|
-
|
|
1322
|
-
functions
|
|
1323
|
-
.command(`create`)
|
|
1324
|
-
.description(`Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API.`)
|
|
1325
|
-
.requiredOption(`--function-id <function-id>`, `Function ID. Choose a custom ID or generate a random ID with 'ID.unique()'. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.`)
|
|
1326
|
-
.requiredOption(`--name <name>`, `Function name. Max length: 128 chars.`)
|
|
1327
|
-
.requiredOption(`--runtime <runtime>`, `Execution runtime.`)
|
|
1328
|
-
.option(`--execute [execute...]`, `An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`)
|
|
1329
|
-
.option(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
1330
|
-
.option(`--schedule <schedule>`, `Schedule CRON syntax.`)
|
|
1331
|
-
.option(`--timeout <timeout>`, `Function maximum execution time in seconds.`, parseInteger)
|
|
1332
|
-
.option(`--enabled [value]`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1333
|
-
.option(`--logging [value]`, `When disabled, executions will exclude logs and errors, and will be slightly faster.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1334
|
-
.option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
|
|
1335
|
-
.option(`--commands <commands>`, `Build Commands.`)
|
|
1336
|
-
.option(`--scopes [scopes...]`, `List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
|
|
1337
|
-
.option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Control System) deployment.`)
|
|
1338
|
-
.option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function.`)
|
|
1339
|
-
.option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function.`)
|
|
1340
|
-
.option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1341
|
-
.option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
|
|
1342
|
-
.option(`--specification <specification>`, `Runtime specification for the function and builds.`)
|
|
1343
|
-
.action(actionRunner(functionsCreate))
|
|
1344
|
-
|
|
1345
|
-
functions
|
|
1346
|
-
.command(`list-runtimes`)
|
|
1347
|
-
.description(`Get a list of all runtimes that are currently active on your instance.`)
|
|
1348
|
-
.action(actionRunner(functionsListRuntimes))
|
|
1349
|
-
|
|
1350
|
-
functions
|
|
1351
|
-
.command(`list-specifications`)
|
|
1352
|
-
.description(`List allowed function specifications for this instance.`)
|
|
1353
|
-
.option(`--console`, `Get the resource console url`)
|
|
1354
|
-
.action(actionRunner(functionsListSpecifications))
|
|
1355
|
-
|
|
1356
|
-
functions
|
|
1357
|
-
.command(`list-templates`)
|
|
1358
|
-
.description(`List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
1359
|
-
.option(`--runtimes [runtimes...]`, `List of runtimes allowed for filtering function templates. Maximum of 100 runtimes are allowed.`)
|
|
1360
|
-
.option(`--use-cases [use-cases...]`, `List of use cases allowed for filtering function templates. Maximum of 100 use cases are allowed.`)
|
|
1361
|
-
.option(`--limit <limit>`, `Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.`, parseInteger)
|
|
1362
|
-
.option(`--offset <offset>`, `Offset the list of returned templates. Maximum offset is 5000.`, parseInteger)
|
|
1363
|
-
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1364
|
-
.option(`--console`, `Get the resource console url`)
|
|
1365
|
-
.action(actionRunner(functionsListTemplates))
|
|
1366
|
-
|
|
1367
|
-
functions
|
|
1368
|
-
.command(`get-template`)
|
|
1369
|
-
.description(`Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method.`)
|
|
1370
|
-
.requiredOption(`--template-id <template-id>`, `Template ID.`)
|
|
1371
|
-
.option(`--console`, `Get the resource console url`)
|
|
1372
|
-
.action(actionRunner(functionsGetTemplate))
|
|
1373
|
-
|
|
1374
|
-
functions
|
|
1375
|
-
.command(`list-usage`)
|
|
1376
|
-
.description(`Get usage metrics and statistics for all functions in the project. View statistics including total deployments, builds, logs, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days.`)
|
|
1377
|
-
.option(`--range <range>`, `Date range.`)
|
|
1378
|
-
.option(`--console`, `Get the resource console url`)
|
|
1379
|
-
.action(actionRunner(functionsListUsage))
|
|
1380
|
-
|
|
1381
|
-
functions
|
|
1382
|
-
.command(`get`)
|
|
1383
|
-
.description(`Get a function by its unique ID.`)
|
|
1384
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1385
|
-
.option(`--console`, `Get the resource console url`)
|
|
1386
|
-
.action(actionRunner(functionsGet))
|
|
1387
|
-
|
|
1388
|
-
functions
|
|
1389
|
-
.command(`update`)
|
|
1390
|
-
.description(`Update function by its unique ID.`)
|
|
1391
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1392
|
-
.requiredOption(`--name <name>`, `Function name. Max length: 128 chars.`)
|
|
1393
|
-
.option(`--runtime <runtime>`, `Execution runtime.`)
|
|
1394
|
-
.option(`--execute [execute...]`, `An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.`)
|
|
1395
|
-
.option(`--events [events...]`, `Events list. Maximum of 100 events are allowed.`)
|
|
1396
|
-
.option(`--schedule <schedule>`, `Schedule CRON syntax.`)
|
|
1397
|
-
.option(`--timeout <timeout>`, `Maximum execution time in seconds.`, parseInteger)
|
|
1398
|
-
.option(`--enabled [value]`, `Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1399
|
-
.option(`--logging [value]`, `When disabled, executions will exclude logs and errors, and will be slightly faster.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1400
|
-
.option(`--entrypoint <entrypoint>`, `Entrypoint File. This path is relative to the "providerRootDirectory".`)
|
|
1401
|
-
.option(`--commands <commands>`, `Build Commands.`)
|
|
1402
|
-
.option(`--scopes [scopes...]`, `List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed.`)
|
|
1403
|
-
.option(`--installation-id <installation-id>`, `Appwrite Installation ID for VCS (Version Controle System) deployment.`)
|
|
1404
|
-
.option(`--provider-repository-id <provider-repository-id>`, `Repository ID of the repo linked to the function`)
|
|
1405
|
-
.option(`--provider-branch <provider-branch>`, `Production branch for the repo linked to the function`)
|
|
1406
|
-
.option(`--provider-silent-mode [value]`, `Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1407
|
-
.option(`--provider-root-directory <provider-root-directory>`, `Path to function code in the linked repo.`)
|
|
1408
|
-
.option(`--specification <specification>`, `Runtime specification for the function and builds.`)
|
|
1409
|
-
.action(actionRunner(functionsUpdate))
|
|
1410
|
-
|
|
1411
|
-
functions
|
|
1412
|
-
.command(`delete`)
|
|
1413
|
-
.description(`Delete a function by its unique ID.`)
|
|
1414
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1415
|
-
.action(actionRunner(functionsDelete))
|
|
1416
|
-
|
|
1417
|
-
functions
|
|
1418
|
-
.command(`update-function-deployment`)
|
|
1419
|
-
.description(`Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function.`)
|
|
1420
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1421
|
-
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1422
|
-
.action(actionRunner(functionsUpdateFunctionDeployment))
|
|
1423
|
-
|
|
1424
|
-
functions
|
|
1425
|
-
.command(`list-deployments`)
|
|
1426
|
-
.description(`Get a list of all the function's code deployments. You can use the query params to filter your results.`)
|
|
1427
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1428
|
-
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: buildSize, sourceSize, totalSize, buildDuration, status, activate, type`)
|
|
1429
|
-
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
1430
|
-
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1431
|
-
.option(`--console`, `Get the resource console url`)
|
|
1432
|
-
.action(actionRunner(functionsListDeployments))
|
|
1433
|
-
|
|
1434
|
-
functions
|
|
1435
|
-
.command(`create-deployment`)
|
|
1436
|
-
.description(`Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). Use the "command" param to set the entrypoint used to execute your code.`)
|
|
1437
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1438
|
-
.requiredOption(`--code <code>`, `Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.`)
|
|
1439
|
-
.requiredOption(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1440
|
-
.option(`--entrypoint <entrypoint>`, `Entrypoint File.`)
|
|
1441
|
-
.option(`--commands <commands>`, `Build Commands.`)
|
|
1442
|
-
.action(actionRunner(functionsCreateDeployment))
|
|
1443
|
-
|
|
1444
|
-
functions
|
|
1445
|
-
.command(`create-duplicate-deployment`)
|
|
1446
|
-
.description(`Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build.`)
|
|
1447
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1448
|
-
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1449
|
-
.option(`--build-id <build-id>`, `Build unique ID.`)
|
|
1450
|
-
.action(actionRunner(functionsCreateDuplicateDeployment))
|
|
1451
|
-
|
|
1452
|
-
functions
|
|
1453
|
-
.command(`create-template-deployment`)
|
|
1454
|
-
.description(`Create a deployment based on a template. Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details.`)
|
|
1455
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1456
|
-
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
|
|
1457
|
-
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
|
|
1458
|
-
.requiredOption(`--root-directory <root-directory>`, `Path to function code in the template repo.`)
|
|
1459
|
-
.requiredOption(`--type <type>`, `Type for the reference provided. Can be commit, branch, or tag`)
|
|
1460
|
-
.requiredOption(`--reference <reference>`, `Reference value, can be a commit hash, branch name, or release tag`)
|
|
1461
|
-
.option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1462
|
-
.action(actionRunner(functionsCreateTemplateDeployment))
|
|
1463
|
-
|
|
1464
|
-
functions
|
|
1465
|
-
.command(`create-vcs-deployment`)
|
|
1466
|
-
.description(`Create a deployment when a function is connected to VCS. This endpoint lets you create deployment from a branch, commit, or a tag.`)
|
|
1467
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1468
|
-
.requiredOption(`--type <type>`, `Type of reference passed. Allowed values are: branch, commit`)
|
|
1469
|
-
.requiredOption(`--reference <reference>`, `VCS reference to create deployment from. Depending on type this can be: branch name, commit hash`)
|
|
1470
|
-
.option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1471
|
-
.action(actionRunner(functionsCreateVcsDeployment))
|
|
1472
|
-
|
|
1473
|
-
functions
|
|
1474
|
-
.command(`get-deployment`)
|
|
1475
|
-
.description(`Get a function deployment by its unique ID.`)
|
|
1476
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1477
|
-
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1478
|
-
.option(`--console`, `Get the resource console url`)
|
|
1479
|
-
.action(actionRunner(functionsGetDeployment))
|
|
1480
|
-
|
|
1481
|
-
functions
|
|
1482
|
-
.command(`delete-deployment`)
|
|
1483
|
-
.description(`Delete a code deployment by its unique ID.`)
|
|
1484
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1485
|
-
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1486
|
-
.action(actionRunner(functionsDeleteDeployment))
|
|
1487
|
-
|
|
1488
|
-
functions
|
|
1489
|
-
.command(`get-deployment-download`)
|
|
1490
|
-
.description(`Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.`)
|
|
1491
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1492
|
-
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1493
|
-
.option(`--type <type>`, `Deployment file to download. Can be: "source", "output".`)
|
|
1494
|
-
.requiredOption(`--destination <path>`, `output file path.`)
|
|
1495
|
-
.option(`--console`, `Get the resource console url`)
|
|
1496
|
-
.action(actionRunner(functionsGetDeploymentDownload))
|
|
1497
|
-
|
|
1498
|
-
functions
|
|
1499
|
-
.command(`update-deployment-status`)
|
|
1500
|
-
.description(`Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details.`)
|
|
1501
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1502
|
-
.requiredOption(`--deployment-id <deployment-id>`, `Deployment ID.`)
|
|
1503
|
-
.action(actionRunner(functionsUpdateDeploymentStatus))
|
|
1504
|
-
|
|
1505
|
-
functions
|
|
1506
|
-
.command(`list-executions`)
|
|
1507
|
-
.description(`Get a list of all the current user function execution logs. You can use the query params to filter your results.`)
|
|
1508
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1509
|
-
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId`)
|
|
1510
|
-
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1511
|
-
.option(`--console`, `Get the resource console url`)
|
|
1512
|
-
.action(actionRunner(functionsListExecutions))
|
|
1513
|
-
|
|
1514
|
-
functions
|
|
1515
|
-
.command(`create-execution`)
|
|
1516
|
-
.description(`Trigger a function execution. The returned object will return you the current execution status. You can ping the 'Get Execution' endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.`)
|
|
1517
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1518
|
-
.option(`--body <body>`, `HTTP body of execution. Default value is empty string.`)
|
|
1519
|
-
.option(`--async [value]`, `Execute code in the background. Default value is false.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1520
|
-
.option(`--xpath <xpath>`, `HTTP path of execution. Path can include query params. Default value is /`)
|
|
1521
|
-
.option(`--method <method>`, `HTTP method of execution. Default value is POST.`)
|
|
1522
|
-
.option(`--headers <headers>`, `HTTP headers of execution. Defaults to empty.`)
|
|
1523
|
-
.option(`--scheduled-at <scheduled-at>`, `Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.`)
|
|
1524
|
-
.action(actionRunner(functionsCreateExecution))
|
|
1525
|
-
|
|
1526
|
-
functions
|
|
1527
|
-
.command(`get-execution`)
|
|
1528
|
-
.description(`Get a function execution log by its unique ID.`)
|
|
1529
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1530
|
-
.requiredOption(`--execution-id <execution-id>`, `Execution ID.`)
|
|
1531
|
-
.option(`--console`, `Get the resource console url`)
|
|
1532
|
-
.action(actionRunner(functionsGetExecution))
|
|
1533
|
-
|
|
1534
|
-
functions
|
|
1535
|
-
.command(`delete-execution`)
|
|
1536
|
-
.description(`Delete a function execution by its unique ID.`)
|
|
1537
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1538
|
-
.requiredOption(`--execution-id <execution-id>`, `Execution ID.`)
|
|
1539
|
-
.action(actionRunner(functionsDeleteExecution))
|
|
1540
|
-
|
|
1541
|
-
functions
|
|
1542
|
-
.command(`get-usage`)
|
|
1543
|
-
.description(`Get usage metrics and statistics for a for a specific function. View statistics including total deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days.`)
|
|
1544
|
-
.requiredOption(`--function-id <function-id>`, `Function ID.`)
|
|
1545
|
-
.option(`--range <range>`, `Date range.`)
|
|
1546
|
-
.action(actionRunner(functionsGetUsage))
|
|
1547
|
-
|
|
1548
|
-
functions
|
|
1549
|
-
.command(`list-variables`)
|
|
1550
|
-
.description(`Get a list of all variables of a specific function.`)
|
|
1551
|
-
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
|
|
1552
|
-
.action(actionRunner(functionsListVariables))
|
|
1553
|
-
|
|
1554
|
-
functions
|
|
1555
|
-
.command(`create-variable`)
|
|
1556
|
-
.description(`Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables.`)
|
|
1557
|
-
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
|
|
1558
|
-
.requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
|
|
1559
|
-
.requiredOption(`--value <value>`, `Variable value. Max length: 8192 chars.`)
|
|
1560
|
-
.option(`--secret [value]`, `Secret variables can be updated or deleted, but only functions can read them during build and runtime.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1561
|
-
.action(actionRunner(functionsCreateVariable))
|
|
1562
|
-
|
|
1563
|
-
functions
|
|
1564
|
-
.command(`get-variable`)
|
|
1565
|
-
.description(`Get a variable by its unique ID.`)
|
|
1566
|
-
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
|
|
1567
|
-
.requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
|
|
1568
|
-
.action(actionRunner(functionsGetVariable))
|
|
1569
|
-
|
|
1570
|
-
functions
|
|
1571
|
-
.command(`update-variable`)
|
|
1572
|
-
.description(`Update variable by its unique ID.`)
|
|
1573
|
-
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
|
|
1574
|
-
.requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
|
|
1575
|
-
.requiredOption(`--key <key>`, `Variable key. Max length: 255 chars.`)
|
|
1576
|
-
.option(`--value <value>`, `Variable value. Max length: 8192 chars.`)
|
|
1577
|
-
.option(`--secret [value]`, `Secret variables can be updated or deleted, but only functions can read them during build and runtime.`, (value: string | undefined) => value === undefined ? true : parseBool(value))
|
|
1578
|
-
.action(actionRunner(functionsUpdateVariable))
|
|
1579
|
-
|
|
1580
|
-
functions
|
|
1581
|
-
.command(`delete-variable`)
|
|
1582
|
-
.description(`Delete a variable by its unique ID.`)
|
|
1583
|
-
.requiredOption(`--function-id <function-id>`, `Function unique ID.`)
|
|
1584
|
-
.requiredOption(`--variable-id <variable-id>`, `Variable unique ID.`)
|
|
1585
|
-
.action(actionRunner(functionsDeleteVariable))
|
|
1586
|
-
|
|
1587
|
-
|