appwrite-cli 13.0.0-rc.1 → 13.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +68 -0
- package/CHANGELOG.md +10 -1
- package/LICENSE.md +1 -1
- package/README.md +3 -3
- package/cli.ts +152 -0
- package/dist/bundle.cjs +95813 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +145 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -142
- package/dist/index.js.map +1 -1
- package/dist/lib/client.d.ts +2 -3
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +57 -45
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/commands/config.d.ts +562 -0
- package/dist/lib/commands/config.d.ts.map +1 -0
- package/dist/lib/commands/config.js +416 -0
- package/dist/lib/commands/config.js.map +1 -0
- package/dist/lib/commands/db.d.ts +34 -0
- package/dist/lib/commands/db.d.ts.map +1 -0
- package/dist/lib/commands/db.js +247 -0
- package/dist/lib/commands/db.js.map +1 -0
- package/dist/lib/commands/errors.d.ts +68 -0
- package/dist/lib/commands/errors.d.ts.map +1 -0
- package/dist/lib/commands/errors.js +72 -0
- package/dist/lib/commands/errors.js.map +1 -0
- package/dist/lib/commands/generic.d.ts +2 -2
- package/dist/lib/commands/generic.d.ts.map +1 -1
- package/dist/lib/commands/generic.js +170 -157
- package/dist/lib/commands/generic.js.map +1 -1
- package/dist/lib/commands/init.d.ts +1 -1
- package/dist/lib/commands/init.d.ts.map +1 -1
- package/dist/lib/commands/init.js +201 -192
- package/dist/lib/commands/init.js.map +1 -1
- package/dist/lib/commands/pull.d.ts +105 -3
- package/dist/lib/commands/pull.d.ts.map +1 -1
- package/dist/lib/commands/pull.js +530 -370
- package/dist/lib/commands/pull.js.map +1 -1
- package/dist/lib/commands/push.d.ts +106 -0
- package/dist/lib/commands/push.d.ts.map +1 -1
- package/dist/lib/commands/push.js +1432 -1830
- package/dist/lib/commands/push.js.map +1 -1
- package/dist/lib/commands/run.d.ts +1 -1
- package/dist/lib/commands/run.d.ts.map +1 -1
- package/dist/lib/commands/run.js +129 -127
- package/dist/lib/commands/run.js.map +1 -1
- package/dist/lib/commands/schema.d.ts +59 -0
- package/dist/lib/commands/schema.d.ts.map +1 -0
- package/dist/lib/commands/schema.js +86 -0
- package/dist/lib/commands/schema.js.map +1 -0
- package/dist/lib/commands/services/account.d.ts +3 -0
- package/dist/lib/commands/services/account.d.ts.map +1 -0
- package/dist/lib/commands/services/account.js +328 -0
- package/dist/lib/commands/services/account.js.map +1 -0
- package/dist/lib/commands/services/console.d.ts +3 -0
- package/dist/lib/commands/services/console.d.ts.map +1 -0
- package/dist/lib/commands/services/console.js +28 -0
- package/dist/lib/commands/services/console.js.map +1 -0
- package/dist/lib/commands/services/databases.d.ts +3 -0
- package/dist/lib/commands/services/databases.d.ts.map +1 -0
- package/dist/lib/commands/services/databases.js +620 -0
- package/dist/lib/commands/services/databases.js.map +1 -0
- package/dist/lib/commands/services/functions.d.ts +3 -0
- package/dist/lib/commands/services/functions.d.ts.map +1 -0
- package/dist/lib/commands/services/functions.js +266 -0
- package/dist/lib/commands/services/functions.js.map +1 -0
- package/dist/lib/commands/services/graphql.d.ts +3 -0
- package/dist/lib/commands/services/graphql.d.ts.map +1 -0
- package/dist/lib/commands/services/graphql.js +28 -0
- package/dist/lib/commands/services/graphql.js.map +1 -0
- package/dist/lib/commands/services/health.d.ts +3 -0
- package/dist/lib/commands/services/health.d.ts.map +1 -0
- package/dist/lib/commands/services/health.js +123 -0
- package/dist/lib/commands/services/health.js.map +1 -0
- package/dist/lib/commands/services/locale.d.ts +3 -0
- package/dist/lib/commands/services/locale.d.ts.map +1 -0
- package/dist/lib/commands/services/locale.js +52 -0
- package/dist/lib/commands/services/locale.js.map +1 -0
- package/dist/lib/commands/services/messaging.d.ts +3 -0
- package/dist/lib/commands/services/messaging.d.ts.map +1 -0
- package/dist/lib/commands/services/messaging.js +505 -0
- package/dist/lib/commands/services/messaging.js.map +1 -0
- package/dist/lib/commands/services/migrations.d.ts +3 -0
- package/dist/lib/commands/services/migrations.d.ts.map +1 -0
- package/dist/lib/commands/services/migrations.js +135 -0
- package/dist/lib/commands/services/migrations.js.map +1 -0
- package/dist/lib/commands/services/project.d.ts +3 -0
- package/dist/lib/commands/services/project.d.ts.map +1 -0
- package/dist/lib/commands/services/project.js +54 -0
- package/dist/lib/commands/services/project.js.map +1 -0
- package/dist/lib/commands/services/projects.d.ts +3 -0
- package/dist/lib/commands/services/projects.d.ts.map +1 -0
- package/dist/lib/commands/services/projects.js +415 -0
- package/dist/lib/commands/services/projects.js.map +1 -0
- package/dist/lib/commands/services/proxy.d.ts +3 -0
- package/dist/lib/commands/services/proxy.d.ts.map +1 -0
- package/dist/lib/commands/services/proxy.js +68 -0
- package/dist/lib/commands/services/proxy.js.map +1 -0
- package/dist/lib/commands/services/sites.d.ts +3 -0
- package/dist/lib/commands/services/sites.d.ts.map +1 -0
- package/dist/lib/commands/services/sites.js +250 -0
- package/dist/lib/commands/services/sites.js.map +1 -0
- package/dist/lib/commands/services/storage.d.ts +3 -0
- package/dist/lib/commands/services/storage.d.ts.map +1 -0
- package/dist/lib/commands/services/storage.js +175 -0
- package/dist/lib/commands/services/storage.js.map +1 -0
- package/dist/lib/commands/services/tables-db.d.ts +3 -0
- package/dist/lib/commands/services/tables-db.d.ts.map +1 -0
- package/dist/lib/commands/services/tables-db.js +613 -0
- package/dist/lib/commands/services/tables-db.js.map +1 -0
- package/dist/lib/commands/services/teams.d.ts +3 -0
- package/dist/lib/commands/services/teams.d.ts.map +1 -0
- package/dist/lib/commands/services/teams.js +123 -0
- package/dist/lib/commands/services/teams.js.map +1 -0
- package/dist/lib/commands/services/tokens.d.ts +3 -0
- package/dist/lib/commands/services/tokens.d.ts.map +1 -0
- package/dist/lib/commands/services/tokens.js +49 -0
- package/dist/lib/commands/services/tokens.js.map +1 -0
- package/dist/lib/commands/services/users.d.ts +3 -0
- package/dist/lib/commands/services/users.d.ts.map +1 -0
- package/dist/lib/commands/services/users.js +312 -0
- package/dist/lib/commands/services/users.js.map +1 -0
- package/dist/lib/commands/services/vcs.d.ts +3 -0
- package/dist/lib/commands/services/vcs.d.ts.map +1 -0
- package/dist/lib/commands/services/vcs.js +87 -0
- package/dist/lib/commands/services/vcs.js.map +1 -0
- package/dist/lib/commands/types.d.ts +1 -1
- package/dist/lib/commands/types.d.ts.map +1 -1
- package/dist/lib/commands/types.js +53 -57
- package/dist/lib/commands/types.js.map +1 -1
- package/dist/lib/commands/update.d.ts +1 -1
- package/dist/lib/commands/update.d.ts.map +1 -1
- package/dist/lib/commands/update.js +69 -69
- package/dist/lib/commands/update.js.map +1 -1
- package/dist/lib/commands/utils/attributes.d.ts +47 -0
- package/dist/lib/commands/utils/attributes.d.ts.map +1 -0
- package/dist/lib/commands/utils/attributes.js +514 -0
- package/dist/lib/commands/utils/attributes.js.map +1 -0
- package/dist/lib/commands/utils/change-approval.d.ts +25 -0
- package/dist/lib/commands/utils/change-approval.d.ts.map +1 -0
- package/dist/lib/commands/utils/change-approval.js +129 -0
- package/dist/lib/commands/utils/change-approval.js.map +1 -0
- package/dist/lib/commands/utils/database-sync.d.ts +10 -0
- package/dist/lib/commands/utils/database-sync.d.ts.map +1 -0
- package/dist/lib/commands/utils/database-sync.js +136 -0
- package/dist/lib/commands/utils/database-sync.js.map +1 -0
- package/dist/lib/commands/utils/deployment.d.ts +34 -0
- package/dist/lib/commands/utils/deployment.d.ts.map +1 -0
- package/dist/lib/commands/utils/deployment.js +109 -0
- package/dist/lib/commands/utils/deployment.js.map +1 -0
- package/dist/lib/commands/utils/error-formatter.d.ts +19 -0
- package/dist/lib/commands/utils/error-formatter.d.ts.map +1 -0
- package/dist/lib/commands/utils/error-formatter.js +333 -0
- package/dist/lib/commands/utils/error-formatter.js.map +1 -0
- package/dist/lib/commands/utils/pools.d.ts +16 -0
- package/dist/lib/commands/utils/pools.d.ts.map +1 -0
- package/dist/lib/commands/utils/pools.js +198 -0
- package/dist/lib/commands/utils/pools.js.map +1 -0
- package/dist/lib/config.d.ts +41 -40
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +264 -239
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +14 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +19 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/emulation/docker.d.ts +4 -12
- package/dist/lib/emulation/docker.d.ts.map +1 -1
- package/dist/lib/emulation/docker.js +159 -142
- package/dist/lib/emulation/docker.js.map +1 -1
- package/dist/lib/emulation/utils.d.ts +1 -1
- package/dist/lib/emulation/utils.d.ts.map +1 -1
- package/dist/lib/emulation/utils.js +55 -58
- package/dist/lib/emulation/utils.js.map +1 -1
- package/dist/lib/id.d.ts +1 -1
- package/dist/lib/id.d.ts.map +1 -1
- package/dist/lib/id.js +13 -18
- package/dist/lib/id.js.map +1 -1
- package/dist/lib/paginate.d.ts +3 -4
- package/dist/lib/paginate.d.ts.map +1 -1
- package/dist/lib/paginate.js +7 -10
- package/dist/lib/paginate.js.map +1 -1
- package/dist/lib/parser.d.ts +1 -1
- package/dist/lib/parser.d.ts.map +1 -1
- package/dist/lib/parser.js +92 -103
- package/dist/lib/parser.js.map +1 -1
- package/dist/lib/questions.d.ts +1 -1
- package/dist/lib/questions.d.ts.map +1 -1
- package/dist/lib/questions.js +381 -385
- package/dist/lib/questions.js.map +1 -1
- package/dist/lib/sdks.d.ts +1 -1
- package/dist/lib/sdks.d.ts.map +1 -1
- package/dist/lib/sdks.js +39 -30
- package/dist/lib/sdks.js.map +1 -1
- package/dist/lib/services.d.ts +13 -0
- package/dist/lib/services.d.ts.map +1 -0
- package/dist/lib/services.js +47 -0
- package/dist/lib/services.js.map +1 -0
- package/dist/lib/spinner.d.ts +1 -1
- package/dist/lib/spinner.d.ts.map +1 -1
- package/dist/lib/spinner.js +25 -27
- package/dist/lib/spinner.js.map +1 -1
- package/dist/lib/type-generation/attribute.d.ts +1 -1
- package/dist/lib/type-generation/attribute.d.ts.map +1 -1
- package/dist/lib/type-generation/attribute.js +14 -17
- package/dist/lib/type-generation/attribute.js.map +1 -1
- package/dist/lib/type-generation/languages/csharp.d.ts +1 -1
- package/dist/lib/type-generation/languages/csharp.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/csharp.js +34 -34
- package/dist/lib/type-generation/languages/csharp.js.map +1 -1
- package/dist/lib/type-generation/languages/dart.d.ts +1 -1
- package/dist/lib/type-generation/languages/dart.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/dart.js +57 -57
- package/dist/lib/type-generation/languages/dart.js.map +1 -1
- package/dist/lib/type-generation/languages/java.d.ts +1 -1
- package/dist/lib/type-generation/languages/java.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/java.js +35 -35
- package/dist/lib/type-generation/languages/java.js.map +1 -1
- package/dist/lib/type-generation/languages/javascript.d.ts +1 -1
- package/dist/lib/type-generation/languages/javascript.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/javascript.js +45 -44
- package/dist/lib/type-generation/languages/javascript.js.map +1 -1
- package/dist/lib/type-generation/languages/kotlin.d.ts +1 -1
- package/dist/lib/type-generation/languages/kotlin.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/kotlin.js +35 -35
- package/dist/lib/type-generation/languages/kotlin.js.map +1 -1
- package/dist/lib/type-generation/languages/language.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/language.js +32 -37
- package/dist/lib/type-generation/languages/language.js.map +1 -1
- package/dist/lib/type-generation/languages/php.d.ts +1 -1
- package/dist/lib/type-generation/languages/php.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/php.js +34 -34
- package/dist/lib/type-generation/languages/php.js.map +1 -1
- package/dist/lib/type-generation/languages/swift.d.ts +1 -1
- package/dist/lib/type-generation/languages/swift.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/swift.js +35 -35
- package/dist/lib/type-generation/languages/swift.js.map +1 -1
- package/dist/lib/type-generation/languages/typescript.d.ts +1 -1
- package/dist/lib/type-generation/languages/typescript.d.ts.map +1 -1
- package/dist/lib/type-generation/languages/typescript.js +49 -46
- package/dist/lib/type-generation/languages/typescript.js.map +1 -1
- package/dist/lib/types.d.ts +38 -108
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +1 -2
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +142 -98
- package/dist/lib/utils.js.map +1 -1
- package/dist/lib/validations.d.ts.map +1 -1
- package/dist/lib/validations.js +2 -6
- package/dist/lib/validations.js.map +1 -1
- package/dist/package.json +68 -0
- package/index.ts +25 -149
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.ts +261 -220
- package/lib/commands/config.ts +494 -0
- package/lib/commands/db.ts +324 -0
- package/lib/commands/errors.ts +93 -0
- package/lib/commands/generic.ts +371 -269
- package/lib/commands/init.ts +631 -519
- package/lib/commands/pull.ts +827 -453
- package/lib/commands/push.ts +2191 -2349
- package/lib/commands/run.ts +382 -302
- package/lib/commands/schema.ts +122 -0
- package/lib/commands/services/account.ts +647 -0
- package/lib/commands/services/console.ts +52 -0
- package/lib/commands/services/databases.ts +1163 -0
- package/lib/commands/services/functions.ts +536 -0
- package/lib/commands/services/graphql.ts +50 -0
- package/lib/commands/services/health.ts +260 -0
- package/lib/commands/services/locale.ts +102 -0
- package/lib/commands/services/messaging.ts +1052 -0
- package/lib/commands/services/migrations.ts +249 -0
- package/lib/commands/services/project.ts +112 -0
- package/lib/commands/services/projects.ts +785 -0
- package/lib/commands/services/proxy.ts +135 -0
- package/lib/commands/services/sites.ts +505 -0
- package/lib/commands/services/storage.ts +338 -0
- package/lib/commands/services/tables-db.ts +1150 -0
- package/lib/commands/services/teams.ts +232 -0
- package/lib/commands/services/tokens.ts +94 -0
- package/lib/commands/services/users.ts +616 -0
- package/lib/commands/services/vcs.ts +165 -0
- package/lib/commands/types.ts +145 -118
- package/lib/commands/update.ts +189 -159
- package/lib/commands/utils/attributes.ts +719 -0
- package/lib/commands/utils/change-approval.ts +186 -0
- package/lib/commands/utils/database-sync.ts +180 -0
- package/lib/commands/utils/deployment.ts +184 -0
- package/lib/commands/utils/error-formatter.ts +417 -0
- package/lib/commands/utils/pools.ts +355 -0
- package/lib/config.ts +766 -687
- package/lib/constants.ts +22 -0
- package/lib/emulation/docker.ts +277 -216
- package/lib/emulation/utils.ts +188 -174
- package/lib/id.ts +23 -23
- package/lib/paginate.ts +69 -55
- package/lib/parser.ts +220 -189
- package/lib/questions.ts +1024 -948
- package/lib/sdks.ts +84 -51
- package/lib/services.ts +72 -0
- package/lib/spinner.ts +112 -99
- package/lib/type-generation/attribute.ts +15 -14
- package/lib/type-generation/languages/csharp.ts +71 -60
- package/lib/type-generation/languages/dart.ts +106 -93
- package/lib/type-generation/languages/java.ts +69 -58
- package/lib/type-generation/languages/javascript.ts +84 -73
- package/lib/type-generation/languages/kotlin.ts +71 -60
- package/lib/type-generation/languages/language.ts +103 -95
- package/lib/type-generation/languages/php.ts +67 -56
- package/lib/type-generation/languages/swift.ts +71 -60
- package/lib/type-generation/languages/typescript.ts +93 -76
- package/lib/types.ts +50 -125
- package/lib/utils.ts +304 -233
- package/lib/validations.ts +17 -14
- package/package.json +31 -22
- package/scoop/appwrite.config.json +3 -3
- package/tsconfig.json +7 -13
- package/.github/workflows/autoclose.yml +0 -11
- package/.github/workflows/npm-publish.yml +0 -49
- package/dist/lib/commands/account.d.ts +0 -379
- package/dist/lib/commands/account.d.ts.map +0 -1
- package/dist/lib/commands/account.js +0 -1228
- package/dist/lib/commands/account.js.map +0 -1
- package/dist/lib/commands/console.d.ts +0 -20
- package/dist/lib/commands/console.d.ts.map +0 -1
- package/dist/lib/commands/console.js +0 -78
- package/dist/lib/commands/console.js.map +0 -1
- package/dist/lib/commands/databases.d.ts +0 -732
- package/dist/lib/commands/databases.d.ts.map +0 -1
- package/dist/lib/commands/databases.js +0 -2196
- package/dist/lib/commands/databases.js.map +0 -1
- package/dist/lib/commands/functions.d.ts +0 -310
- package/dist/lib/commands/functions.d.ts.map +0 -1
- package/dist/lib/commands/functions.js +0 -1100
- package/dist/lib/commands/functions.js.map +0 -1
- package/dist/lib/commands/graphql.d.ts +0 -19
- package/dist/lib/commands/graphql.d.ts.map +0 -1
- package/dist/lib/commands/graphql.js +0 -77
- package/dist/lib/commands/graphql.js.map +0 -1
- package/dist/lib/commands/health.d.ts +0 -153
- package/dist/lib/commands/health.d.ts.map +0 -1
- package/dist/lib/commands/health.js +0 -464
- package/dist/lib/commands/health.js.map +0 -1
- package/dist/lib/commands/locale.d.ts +0 -53
- package/dist/lib/commands/locale.d.ts.map +0 -1
- package/dist/lib/commands/locale.js +0 -165
- package/dist/lib/commands/locale.js.map +0 -1
- package/dist/lib/commands/messaging.d.ts +0 -588
- package/dist/lib/commands/messaging.d.ts.map +0 -1
- package/dist/lib/commands/messaging.js +0 -2042
- package/dist/lib/commands/messaging.js.map +0 -1
- package/dist/lib/commands/migrations.d.ts +0 -150
- package/dist/lib/commands/migrations.d.ts.map +0 -1
- package/dist/lib/commands/migrations.js +0 -524
- package/dist/lib/commands/migrations.js.map +0 -1
- package/dist/lib/commands/organizations.d.ts +0 -11
- package/dist/lib/commands/organizations.d.ts.map +0 -1
- package/dist/lib/commands/organizations.js +0 -31
- package/dist/lib/commands/organizations.js.map +0 -1
- package/dist/lib/commands/project.d.ts +0 -53
- package/dist/lib/commands/project.d.ts.map +0 -1
- package/dist/lib/commands/project.js +0 -176
- package/dist/lib/commands/project.js.map +0 -1
- package/dist/lib/commands/projects.d.ts +0 -516
- package/dist/lib/commands/projects.d.ts.map +0 -1
- package/dist/lib/commands/projects.js +0 -1590
- package/dist/lib/commands/projects.js.map +0 -1
- package/dist/lib/commands/proxy.d.ts +0 -71
- package/dist/lib/commands/proxy.d.ts.map +0 -1
- package/dist/lib/commands/proxy.js +0 -240
- package/dist/lib/commands/proxy.js.map +0 -1
- package/dist/lib/commands/sites.d.ts +0 -296
- package/dist/lib/commands/sites.d.ts.map +0 -1
- package/dist/lib/commands/sites.js +0 -1046
- package/dist/lib/commands/sites.js.map +0 -1
- package/dist/lib/commands/storage.d.ts +0 -170
- package/dist/lib/commands/storage.d.ts.map +0 -1
- package/dist/lib/commands/storage.js +0 -651
- package/dist/lib/commands/storage.js.map +0 -1
- package/dist/lib/commands/tables-db.d.ts +0 -728
- package/dist/lib/commands/tables-db.d.ts.map +0 -1
- package/dist/lib/commands/tables-db.js +0 -2198
- package/dist/lib/commands/tables-db.js.map +0 -1
- package/dist/lib/commands/teams.d.ts +0 -129
- package/dist/lib/commands/teams.d.ts.map +0 -1
- package/dist/lib/commands/teams.js +0 -403
- package/dist/lib/commands/teams.js.map +0 -1
- package/dist/lib/commands/tokens.d.ts +0 -48
- package/dist/lib/commands/tokens.d.ts.map +0 -1
- package/dist/lib/commands/tokens.js +0 -156
- package/dist/lib/commands/tokens.js.map +0 -1
- package/dist/lib/commands/users.d.ts +0 -382
- package/dist/lib/commands/users.d.ts.map +0 -1
- package/dist/lib/commands/users.js +0 -1195
- package/dist/lib/commands/users.js.map +0 -1
- package/dist/lib/commands/vcs.d.ts +0 -92
- package/dist/lib/commands/vcs.d.ts.map +0 -1
- package/dist/lib/commands/vcs.js +0 -276
- package/dist/lib/commands/vcs.js.map +0 -1
- package/dist/lib/exception.d.ts +0 -8
- package/dist/lib/exception.d.ts.map +0 -1
- package/dist/lib/exception.js +0 -16
- package/dist/lib/exception.js.map +0 -1
- package/lib/commands/account.ts +0 -1867
- package/lib/commands/console.ts +0 -112
- package/lib/commands/databases.ts +0 -3272
- package/lib/commands/functions.ts +0 -1587
- package/lib/commands/graphql.ts +0 -110
- package/lib/commands/health.ts +0 -753
- package/lib/commands/locale.ts +0 -270
- package/lib/commands/messaging.ts +0 -2878
- package/lib/commands/migrations.ts +0 -754
- package/lib/commands/organizations.ts +0 -46
- package/lib/commands/project.ts +0 -266
- package/lib/commands/projects.ts +0 -2370
- package/lib/commands/proxy.ts +0 -357
- package/lib/commands/sites.ts +0 -1514
- package/lib/commands/storage.ts +0 -919
- package/lib/commands/tables-db.ts +0 -3260
- package/lib/commands/teams.ts +0 -609
- package/lib/commands/tokens.ts +0 -232
- package/lib/commands/users.ts +0 -1804
- package/lib/commands/vcs.ts +0 -428
- package/lib/exception.ts +0 -20
package/dist/lib/config.js
CHANGED
|
@@ -1,86 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const process = require("process");
|
|
9
|
-
const JSONbig = require("json-bigint");
|
|
1
|
+
import os from "os";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import _path from "path";
|
|
4
|
+
import process from "process";
|
|
5
|
+
import JSONbig from "json-bigint";
|
|
6
|
+
import { createSettingsObject } from "./utils.js";
|
|
7
|
+
import { SDK_TITLE_LOWER } from "./constants.js";
|
|
10
8
|
const JSONBigInt = JSONbig({ storeAsString: false });
|
|
11
|
-
const KeysVars = new Set([
|
|
12
|
-
const KeysSite = new Set([
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
const KeysVars = new Set(["key", "value"]);
|
|
10
|
+
const KeysSite = new Set([
|
|
11
|
+
"path",
|
|
12
|
+
"$id",
|
|
13
|
+
"name",
|
|
14
|
+
"enabled",
|
|
15
|
+
"logging",
|
|
16
|
+
"timeout",
|
|
17
|
+
"framework",
|
|
18
|
+
"buildRuntime",
|
|
19
|
+
"adapter",
|
|
20
|
+
"installCommand",
|
|
21
|
+
"buildCommand",
|
|
22
|
+
"outputDirectory",
|
|
23
|
+
"fallbackFile",
|
|
24
|
+
"specification",
|
|
25
|
+
"vars",
|
|
26
|
+
]);
|
|
27
|
+
const KeysFunction = new Set([
|
|
28
|
+
"path",
|
|
29
|
+
"$id",
|
|
30
|
+
"execute",
|
|
31
|
+
"name",
|
|
32
|
+
"enabled",
|
|
33
|
+
"logging",
|
|
34
|
+
"runtime",
|
|
35
|
+
"specification",
|
|
36
|
+
"scopes",
|
|
37
|
+
"events",
|
|
38
|
+
"schedule",
|
|
39
|
+
"timeout",
|
|
40
|
+
"entrypoint",
|
|
41
|
+
"commands",
|
|
42
|
+
"vars",
|
|
43
|
+
]);
|
|
44
|
+
const KeysDatabase = new Set(["$id", "name", "enabled"]);
|
|
45
|
+
const KeysCollection = new Set([
|
|
46
|
+
"$id",
|
|
47
|
+
"$permissions",
|
|
48
|
+
"databaseId",
|
|
49
|
+
"name",
|
|
50
|
+
"enabled",
|
|
51
|
+
"documentSecurity",
|
|
52
|
+
"attributes",
|
|
53
|
+
"indexes",
|
|
54
|
+
]);
|
|
55
|
+
const KeysTable = new Set([
|
|
56
|
+
"$id",
|
|
57
|
+
"$permissions",
|
|
58
|
+
"databaseId",
|
|
59
|
+
"name",
|
|
60
|
+
"enabled",
|
|
61
|
+
"rowSecurity",
|
|
62
|
+
"columns",
|
|
63
|
+
"indexes",
|
|
64
|
+
]);
|
|
65
|
+
const KeysStorage = new Set([
|
|
66
|
+
"$id",
|
|
67
|
+
"$permissions",
|
|
68
|
+
"fileSecurity",
|
|
69
|
+
"name",
|
|
70
|
+
"enabled",
|
|
71
|
+
"maximumFileSize",
|
|
72
|
+
"allowedFileExtensions",
|
|
73
|
+
"compression",
|
|
74
|
+
"encryption",
|
|
75
|
+
"antivirus",
|
|
76
|
+
]);
|
|
77
|
+
const KeysTopics = new Set(["$id", "name", "subscribe"]);
|
|
78
|
+
const KeysTeams = new Set(["$id", "name"]);
|
|
27
79
|
const KeysAttributes = new Set([
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
80
|
+
"key",
|
|
81
|
+
"type",
|
|
82
|
+
"required",
|
|
83
|
+
"array",
|
|
84
|
+
"size",
|
|
85
|
+
"default",
|
|
34
86
|
// integer and float
|
|
35
|
-
|
|
36
|
-
|
|
87
|
+
"min",
|
|
88
|
+
"max",
|
|
37
89
|
// email, enum, URL, IP, and datetime
|
|
38
|
-
|
|
90
|
+
"format",
|
|
39
91
|
// enum
|
|
40
|
-
|
|
92
|
+
"elements",
|
|
41
93
|
// relationship
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
94
|
+
"relatedCollection",
|
|
95
|
+
"relationType",
|
|
96
|
+
"twoWay",
|
|
97
|
+
"twoWayKey",
|
|
98
|
+
"onDelete",
|
|
99
|
+
"side",
|
|
48
100
|
// Indexes
|
|
49
|
-
|
|
50
|
-
|
|
101
|
+
"attributes",
|
|
102
|
+
"orders",
|
|
51
103
|
// Strings
|
|
52
|
-
|
|
104
|
+
"encrypt",
|
|
53
105
|
]);
|
|
54
|
-
exports.KeysAttributes = KeysAttributes;
|
|
55
106
|
const KeysColumns = new Set([
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
107
|
+
"key",
|
|
108
|
+
"type",
|
|
109
|
+
"required",
|
|
110
|
+
"array",
|
|
111
|
+
"size",
|
|
112
|
+
"default",
|
|
62
113
|
// integer and float
|
|
63
|
-
|
|
64
|
-
|
|
114
|
+
"min",
|
|
115
|
+
"max",
|
|
65
116
|
// email, enum, URL, IP, and datetime
|
|
66
|
-
|
|
117
|
+
"format",
|
|
67
118
|
// enum
|
|
68
|
-
|
|
119
|
+
"elements",
|
|
69
120
|
// relationship
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
121
|
+
"relatedTable",
|
|
122
|
+
"relationType",
|
|
123
|
+
"twoWay",
|
|
124
|
+
"twoWayKey",
|
|
125
|
+
"onDelete",
|
|
126
|
+
"side",
|
|
76
127
|
// Indexes
|
|
77
|
-
|
|
78
|
-
|
|
128
|
+
"columns",
|
|
129
|
+
"orders",
|
|
79
130
|
// Strings
|
|
80
|
-
|
|
131
|
+
"encrypt",
|
|
132
|
+
]);
|
|
133
|
+
const KeyIndexes = new Set(["key", "type", "status", "attributes", "orders"]);
|
|
134
|
+
const KeyIndexesColumns = new Set([
|
|
135
|
+
"key",
|
|
136
|
+
"type",
|
|
137
|
+
"status",
|
|
138
|
+
"columns",
|
|
139
|
+
"orders",
|
|
81
140
|
]);
|
|
82
|
-
const KeyIndexes = new Set(['key', 'type', 'status', 'attributes', 'orders']);
|
|
83
|
-
const KeyIndexesColumns = new Set(['key', 'type', 'status', 'columns', 'orders']);
|
|
84
141
|
function whitelistKeys(value, keys, nestedKeys = {}) {
|
|
85
142
|
if (Array.isArray(value)) {
|
|
86
143
|
const newValue = [];
|
|
@@ -103,6 +160,8 @@ function whitelistKeys(value, keys, nestedKeys = {}) {
|
|
|
103
160
|
return newValue;
|
|
104
161
|
}
|
|
105
162
|
class Config {
|
|
163
|
+
path;
|
|
164
|
+
data;
|
|
106
165
|
constructor(path) {
|
|
107
166
|
this.path = path;
|
|
108
167
|
this.data = {};
|
|
@@ -122,7 +181,9 @@ class Config {
|
|
|
122
181
|
if (!fs.existsSync(dir)) {
|
|
123
182
|
fs.mkdirSync(dir, { recursive: true });
|
|
124
183
|
}
|
|
125
|
-
fs.writeFileSync(this.path, JSONBigInt.stringify(this.data, null, 4), {
|
|
184
|
+
fs.writeFileSync(this.path, JSONBigInt.stringify(this.data, null, 4), {
|
|
185
|
+
mode: 0o600,
|
|
186
|
+
});
|
|
126
187
|
}
|
|
127
188
|
get(key) {
|
|
128
189
|
return this.data[key];
|
|
@@ -163,7 +224,7 @@ class Config {
|
|
|
163
224
|
}
|
|
164
225
|
const entities = this.get(entityType);
|
|
165
226
|
for (let i = 0; i < entities.length; i++) {
|
|
166
|
-
if (entities[i][
|
|
227
|
+
if (entities[i]["$id"] == $id) {
|
|
167
228
|
return entities[i];
|
|
168
229
|
}
|
|
169
230
|
}
|
|
@@ -176,7 +237,7 @@ class Config {
|
|
|
176
237
|
}
|
|
177
238
|
const entities = this.get(entityType);
|
|
178
239
|
for (let i = 0; i < entities.length; i++) {
|
|
179
|
-
if (entities[i][
|
|
240
|
+
if (entities[i]["$id"] == props["$id"]) {
|
|
180
241
|
entities[i] = props;
|
|
181
242
|
this.set(entityType, entities);
|
|
182
243
|
return;
|
|
@@ -187,13 +248,15 @@ class Config {
|
|
|
187
248
|
}
|
|
188
249
|
}
|
|
189
250
|
class Local extends Config {
|
|
251
|
+
static CONFIG_FILE_PATH = `${SDK_TITLE_LOWER}.config.json`;
|
|
252
|
+
static CONFIG_FILE_PATH_LEGACY = `${SDK_TITLE_LOWER}.json`;
|
|
253
|
+
configDirectoryPath = "";
|
|
190
254
|
constructor(path = Local.CONFIG_FILE_PATH, legacyPath = Local.CONFIG_FILE_PATH_LEGACY) {
|
|
191
255
|
let absolutePath = Local.findConfigFile(path) || Local.findConfigFile(legacyPath);
|
|
192
256
|
if (!absolutePath) {
|
|
193
257
|
absolutePath = `${process.cwd()}/${path}`;
|
|
194
258
|
}
|
|
195
259
|
super(absolutePath);
|
|
196
|
-
this.configDirectoryPath = '';
|
|
197
260
|
this.configDirectoryPath = _path.dirname(absolutePath);
|
|
198
261
|
}
|
|
199
262
|
static findConfigFile(filename) {
|
|
@@ -215,24 +278,24 @@ class Local extends Config {
|
|
|
215
278
|
return _path.dirname(this.path);
|
|
216
279
|
}
|
|
217
280
|
getEndpoint() {
|
|
218
|
-
return this.get(
|
|
281
|
+
return this.get("endpoint") || "";
|
|
219
282
|
}
|
|
220
283
|
setEndpoint(endpoint) {
|
|
221
|
-
this.set(
|
|
284
|
+
this.set("endpoint", endpoint);
|
|
222
285
|
}
|
|
223
286
|
getSites() {
|
|
224
|
-
if (!this.has(
|
|
287
|
+
if (!this.has("sites")) {
|
|
225
288
|
return [];
|
|
226
289
|
}
|
|
227
|
-
return this.get(
|
|
290
|
+
return this.get("sites") ?? [];
|
|
228
291
|
}
|
|
229
292
|
getSite($id) {
|
|
230
|
-
if (!this.has(
|
|
293
|
+
if (!this.has("sites")) {
|
|
231
294
|
return {};
|
|
232
295
|
}
|
|
233
|
-
const sites = this.get(
|
|
296
|
+
const sites = this.get("sites") ?? [];
|
|
234
297
|
for (let i = 0; i < sites.length; i++) {
|
|
235
|
-
if (sites[i][
|
|
298
|
+
if (sites[i]["$id"] == $id) {
|
|
236
299
|
return sites[i];
|
|
237
300
|
}
|
|
238
301
|
}
|
|
@@ -242,36 +305,36 @@ class Local extends Config {
|
|
|
242
305
|
props = whitelistKeys(props, KeysSite, {
|
|
243
306
|
vars: KeysVars,
|
|
244
307
|
});
|
|
245
|
-
if (!this.has(
|
|
246
|
-
this.set(
|
|
308
|
+
if (!this.has("sites")) {
|
|
309
|
+
this.set("sites", []);
|
|
247
310
|
}
|
|
248
|
-
const sites = this.get(
|
|
311
|
+
const sites = this.get("sites") ?? [];
|
|
249
312
|
for (let i = 0; i < sites.length; i++) {
|
|
250
|
-
if (sites[i][
|
|
313
|
+
if (sites[i]["$id"] == props["$id"]) {
|
|
251
314
|
sites[i] = {
|
|
252
315
|
...sites[i],
|
|
253
316
|
...props,
|
|
254
317
|
};
|
|
255
|
-
this.set(
|
|
318
|
+
this.set("sites", sites);
|
|
256
319
|
return;
|
|
257
320
|
}
|
|
258
321
|
}
|
|
259
322
|
sites.push(props);
|
|
260
|
-
this.set(
|
|
323
|
+
this.set("sites", sites);
|
|
261
324
|
}
|
|
262
325
|
getFunctions() {
|
|
263
|
-
if (!this.has(
|
|
326
|
+
if (!this.has("functions")) {
|
|
264
327
|
return [];
|
|
265
328
|
}
|
|
266
|
-
return this.get(
|
|
329
|
+
return this.get("functions") ?? [];
|
|
267
330
|
}
|
|
268
331
|
getFunction($id) {
|
|
269
|
-
if (!this.has(
|
|
332
|
+
if (!this.has("functions")) {
|
|
270
333
|
return {};
|
|
271
334
|
}
|
|
272
|
-
const functions = this.get(
|
|
335
|
+
const functions = this.get("functions") ?? [];
|
|
273
336
|
for (let i = 0; i < functions.length; i++) {
|
|
274
|
-
if (functions[i][
|
|
337
|
+
if (functions[i]["$id"] == $id) {
|
|
275
338
|
return functions[i];
|
|
276
339
|
}
|
|
277
340
|
}
|
|
@@ -281,36 +344,36 @@ class Local extends Config {
|
|
|
281
344
|
props = whitelistKeys(props, KeysFunction, {
|
|
282
345
|
vars: KeysVars,
|
|
283
346
|
});
|
|
284
|
-
if (!this.has(
|
|
285
|
-
this.set(
|
|
347
|
+
if (!this.has("functions")) {
|
|
348
|
+
this.set("functions", []);
|
|
286
349
|
}
|
|
287
|
-
const functions = this.get(
|
|
350
|
+
const functions = this.get("functions") ?? [];
|
|
288
351
|
for (let i = 0; i < functions.length; i++) {
|
|
289
|
-
if (functions[i][
|
|
352
|
+
if (functions[i]["$id"] == props["$id"]) {
|
|
290
353
|
functions[i] = {
|
|
291
354
|
...functions[i],
|
|
292
355
|
...props,
|
|
293
356
|
};
|
|
294
|
-
this.set(
|
|
357
|
+
this.set("functions", functions);
|
|
295
358
|
return;
|
|
296
359
|
}
|
|
297
360
|
}
|
|
298
361
|
functions.push(props);
|
|
299
|
-
this.set(
|
|
362
|
+
this.set("functions", functions);
|
|
300
363
|
}
|
|
301
364
|
getCollections() {
|
|
302
|
-
if (!this.has(
|
|
365
|
+
if (!this.has("collections")) {
|
|
303
366
|
return [];
|
|
304
367
|
}
|
|
305
|
-
return this.get(
|
|
368
|
+
return this.get("collections") ?? [];
|
|
306
369
|
}
|
|
307
370
|
getCollection($id) {
|
|
308
|
-
if (!this.has(
|
|
371
|
+
if (!this.has("collections")) {
|
|
309
372
|
return {};
|
|
310
373
|
}
|
|
311
|
-
const collections = this.get(
|
|
374
|
+
const collections = this.get("collections") ?? [];
|
|
312
375
|
for (let i = 0; i < collections.length; i++) {
|
|
313
|
-
if (collections[i][
|
|
376
|
+
if (collections[i]["$id"] == $id) {
|
|
314
377
|
return collections[i];
|
|
315
378
|
}
|
|
316
379
|
}
|
|
@@ -321,33 +384,34 @@ class Local extends Config {
|
|
|
321
384
|
attributes: KeysAttributes,
|
|
322
385
|
indexes: KeyIndexes,
|
|
323
386
|
});
|
|
324
|
-
if (!this.has(
|
|
325
|
-
this.set(
|
|
387
|
+
if (!this.has("collections")) {
|
|
388
|
+
this.set("collections", []);
|
|
326
389
|
}
|
|
327
|
-
const collections = this.get(
|
|
390
|
+
const collections = this.get("collections") ?? [];
|
|
328
391
|
for (let i = 0; i < collections.length; i++) {
|
|
329
|
-
if (collections[i][
|
|
392
|
+
if (collections[i]["$id"] == props["$id"] &&
|
|
393
|
+
collections[i]["databaseId"] == props["databaseId"]) {
|
|
330
394
|
collections[i] = props;
|
|
331
|
-
this.set(
|
|
395
|
+
this.set("collections", collections);
|
|
332
396
|
return;
|
|
333
397
|
}
|
|
334
398
|
}
|
|
335
399
|
collections.push(props);
|
|
336
|
-
this.set(
|
|
400
|
+
this.set("collections", collections);
|
|
337
401
|
}
|
|
338
402
|
getTables() {
|
|
339
|
-
if (!this.has(
|
|
403
|
+
if (!this.has("tables")) {
|
|
340
404
|
return [];
|
|
341
405
|
}
|
|
342
|
-
return this.get(
|
|
406
|
+
return this.get("tables") ?? [];
|
|
343
407
|
}
|
|
344
408
|
getTable($id) {
|
|
345
|
-
if (!this.has(
|
|
409
|
+
if (!this.has("tables")) {
|
|
346
410
|
return {};
|
|
347
411
|
}
|
|
348
|
-
const tables = this.get(
|
|
412
|
+
const tables = this.get("tables") ?? [];
|
|
349
413
|
for (let i = 0; i < tables.length; i++) {
|
|
350
|
-
if (tables[i][
|
|
414
|
+
if (tables[i]["$id"] == $id) {
|
|
351
415
|
return tables[i];
|
|
352
416
|
}
|
|
353
417
|
}
|
|
@@ -358,33 +422,34 @@ class Local extends Config {
|
|
|
358
422
|
columns: KeysColumns,
|
|
359
423
|
indexes: KeyIndexesColumns,
|
|
360
424
|
});
|
|
361
|
-
if (!this.has(
|
|
362
|
-
this.set(
|
|
425
|
+
if (!this.has("tables")) {
|
|
426
|
+
this.set("tables", []);
|
|
363
427
|
}
|
|
364
|
-
const tables = this.get(
|
|
428
|
+
const tables = this.get("tables") ?? [];
|
|
365
429
|
for (let i = 0; i < tables.length; i++) {
|
|
366
|
-
if (tables[i][
|
|
430
|
+
if (tables[i]["$id"] == props["$id"] &&
|
|
431
|
+
tables[i]["databaseId"] == props["databaseId"]) {
|
|
367
432
|
tables[i] = props;
|
|
368
|
-
this.set(
|
|
433
|
+
this.set("tables", tables);
|
|
369
434
|
return;
|
|
370
435
|
}
|
|
371
436
|
}
|
|
372
437
|
tables.push(props);
|
|
373
|
-
this.set(
|
|
438
|
+
this.set("tables", tables);
|
|
374
439
|
}
|
|
375
440
|
getBuckets() {
|
|
376
|
-
if (!this.has(
|
|
441
|
+
if (!this.has("buckets")) {
|
|
377
442
|
return [];
|
|
378
443
|
}
|
|
379
|
-
return this.get(
|
|
444
|
+
return this.get("buckets") ?? [];
|
|
380
445
|
}
|
|
381
446
|
getBucket($id) {
|
|
382
|
-
if (!this.has(
|
|
447
|
+
if (!this.has("buckets")) {
|
|
383
448
|
return {};
|
|
384
449
|
}
|
|
385
|
-
const buckets = this.get(
|
|
450
|
+
const buckets = this.get("buckets") ?? [];
|
|
386
451
|
for (let i = 0; i < buckets.length; i++) {
|
|
387
|
-
if (buckets[i][
|
|
452
|
+
if (buckets[i]["$id"] == $id) {
|
|
388
453
|
return buckets[i];
|
|
389
454
|
}
|
|
390
455
|
}
|
|
@@ -392,85 +457,85 @@ class Local extends Config {
|
|
|
392
457
|
}
|
|
393
458
|
addBucket(props) {
|
|
394
459
|
props = whitelistKeys(props, KeysStorage);
|
|
395
|
-
if (!this.has(
|
|
396
|
-
this.set(
|
|
460
|
+
if (!this.has("buckets")) {
|
|
461
|
+
this.set("buckets", []);
|
|
397
462
|
}
|
|
398
|
-
const buckets = this.get(
|
|
463
|
+
const buckets = this.get("buckets") ?? [];
|
|
399
464
|
for (let i = 0; i < buckets.length; i++) {
|
|
400
|
-
if (buckets[i][
|
|
465
|
+
if (buckets[i]["$id"] == props["$id"]) {
|
|
401
466
|
buckets[i] = props;
|
|
402
|
-
this.set(
|
|
467
|
+
this.set("buckets", buckets);
|
|
403
468
|
return;
|
|
404
469
|
}
|
|
405
470
|
}
|
|
406
471
|
buckets.push(props);
|
|
407
|
-
this.set(
|
|
472
|
+
this.set("buckets", buckets);
|
|
408
473
|
}
|
|
409
474
|
getMessagingTopics() {
|
|
410
|
-
if (!this.has(
|
|
475
|
+
if (!this.has("topics")) {
|
|
411
476
|
return [];
|
|
412
477
|
}
|
|
413
|
-
return this.get(
|
|
478
|
+
return this.get("topics") ?? [];
|
|
414
479
|
}
|
|
415
480
|
getMessagingTopic($id) {
|
|
416
|
-
if (!this.has(
|
|
481
|
+
if (!this.has("topics")) {
|
|
417
482
|
return {};
|
|
418
483
|
}
|
|
419
|
-
const
|
|
420
|
-
for (let i = 0; i <
|
|
421
|
-
if (
|
|
422
|
-
return
|
|
484
|
+
const topics = this.get("topics") ?? [];
|
|
485
|
+
for (let i = 0; i < topics.length; i++) {
|
|
486
|
+
if (topics[i]["$id"] == $id) {
|
|
487
|
+
return topics[i];
|
|
423
488
|
}
|
|
424
489
|
}
|
|
425
490
|
return {};
|
|
426
491
|
}
|
|
427
492
|
addMessagingTopic(props) {
|
|
428
493
|
props = whitelistKeys(props, KeysTopics);
|
|
429
|
-
if (!this.has(
|
|
430
|
-
this.set(
|
|
494
|
+
if (!this.has("topics")) {
|
|
495
|
+
this.set("topics", []);
|
|
431
496
|
}
|
|
432
|
-
const topics = this.get(
|
|
497
|
+
const topics = this.get("topics") ?? [];
|
|
433
498
|
for (let i = 0; i < topics.length; i++) {
|
|
434
|
-
if (topics[i][
|
|
499
|
+
if (topics[i]["$id"] === props["$id"]) {
|
|
435
500
|
topics[i] = props;
|
|
436
|
-
this.set(
|
|
501
|
+
this.set("topics", topics);
|
|
437
502
|
return;
|
|
438
503
|
}
|
|
439
504
|
}
|
|
440
505
|
topics.push(props);
|
|
441
|
-
this.set(
|
|
506
|
+
this.set("topics", topics);
|
|
442
507
|
}
|
|
443
508
|
getTablesDBs() {
|
|
444
|
-
return this._getDBEntities(
|
|
509
|
+
return this._getDBEntities("tablesDB");
|
|
445
510
|
}
|
|
446
511
|
getTablesDB($id) {
|
|
447
|
-
return this._getDBEntity(
|
|
512
|
+
return this._getDBEntity("tablesDB", $id);
|
|
448
513
|
}
|
|
449
514
|
addTablesDB(props) {
|
|
450
|
-
this._addDBEntity(
|
|
515
|
+
this._addDBEntity("tablesDB", props, KeysDatabase);
|
|
451
516
|
}
|
|
452
517
|
getDatabases() {
|
|
453
|
-
return this._getDBEntities(
|
|
518
|
+
return this._getDBEntities("databases");
|
|
454
519
|
}
|
|
455
520
|
getDatabase($id) {
|
|
456
|
-
return this._getDBEntity(
|
|
521
|
+
return this._getDBEntity("databases", $id);
|
|
457
522
|
}
|
|
458
523
|
addDatabase(props) {
|
|
459
|
-
this._addDBEntity(
|
|
524
|
+
this._addDBEntity("databases", props, KeysDatabase);
|
|
460
525
|
}
|
|
461
526
|
getTeams() {
|
|
462
|
-
if (!this.has(
|
|
527
|
+
if (!this.has("teams")) {
|
|
463
528
|
return [];
|
|
464
529
|
}
|
|
465
|
-
return this.get(
|
|
530
|
+
return this.get("teams") ?? [];
|
|
466
531
|
}
|
|
467
532
|
getTeam($id) {
|
|
468
|
-
if (!this.has(
|
|
533
|
+
if (!this.has("teams")) {
|
|
469
534
|
return {};
|
|
470
535
|
}
|
|
471
|
-
const teams = this.get(
|
|
536
|
+
const teams = this.get("teams") ?? [];
|
|
472
537
|
for (let i = 0; i < teams.length; i++) {
|
|
473
|
-
if (teams[i][
|
|
538
|
+
if (teams[i]["$id"] == $id) {
|
|
474
539
|
return teams[i];
|
|
475
540
|
}
|
|
476
541
|
}
|
|
@@ -478,90 +543,72 @@ class Local extends Config {
|
|
|
478
543
|
}
|
|
479
544
|
addTeam(props) {
|
|
480
545
|
props = whitelistKeys(props, KeysTeams);
|
|
481
|
-
if (!this.has(
|
|
482
|
-
this.set(
|
|
546
|
+
if (!this.has("teams")) {
|
|
547
|
+
this.set("teams", []);
|
|
483
548
|
}
|
|
484
|
-
const teams = this.get(
|
|
549
|
+
const teams = this.get("teams") ?? [];
|
|
485
550
|
for (let i = 0; i < teams.length; i++) {
|
|
486
|
-
if (teams[i][
|
|
551
|
+
if (teams[i]["$id"] == props["$id"]) {
|
|
487
552
|
teams[i] = props;
|
|
488
|
-
this.set(
|
|
553
|
+
this.set("teams", teams);
|
|
489
554
|
return;
|
|
490
555
|
}
|
|
491
556
|
}
|
|
492
557
|
teams.push(props);
|
|
493
|
-
this.set(
|
|
558
|
+
this.set("teams", teams);
|
|
494
559
|
}
|
|
495
560
|
getProject() {
|
|
496
|
-
if (!this.has(
|
|
561
|
+
if (!this.has("projectId")) {
|
|
497
562
|
return {};
|
|
498
563
|
}
|
|
499
564
|
return {
|
|
500
|
-
projectId: this.get(
|
|
501
|
-
projectName: this.get(
|
|
502
|
-
projectSettings: this.get(
|
|
565
|
+
projectId: this.get("projectId"),
|
|
566
|
+
projectName: this.get("projectName"),
|
|
567
|
+
projectSettings: this.get("settings"),
|
|
503
568
|
};
|
|
504
569
|
}
|
|
505
|
-
setProject(projectId, projectName =
|
|
506
|
-
this.set(
|
|
507
|
-
if (projectName !==
|
|
508
|
-
this.set(
|
|
570
|
+
setProject(projectId, projectName = "", project) {
|
|
571
|
+
this.set("projectId", projectId);
|
|
572
|
+
if (projectName !== "") {
|
|
573
|
+
this.set("projectName", projectName);
|
|
509
574
|
}
|
|
510
|
-
if (
|
|
575
|
+
if (project === undefined) {
|
|
511
576
|
return;
|
|
512
577
|
}
|
|
513
|
-
this.set(
|
|
514
|
-
}
|
|
515
|
-
createSettingsObject(projectSettings) {
|
|
516
|
-
return {
|
|
517
|
-
services: {
|
|
518
|
-
account: projectSettings.serviceStatusForAccount,
|
|
519
|
-
avatars: projectSettings.serviceStatusForAvatars,
|
|
520
|
-
databases: projectSettings.serviceStatusForDatabases,
|
|
521
|
-
locale: projectSettings.serviceStatusForLocale,
|
|
522
|
-
health: projectSettings.serviceStatusForHealth,
|
|
523
|
-
storage: projectSettings.serviceStatusForStorage,
|
|
524
|
-
teams: projectSettings.serviceStatusForTeams,
|
|
525
|
-
users: projectSettings.serviceStatusForUsers,
|
|
526
|
-
sites: projectSettings.serviceStatusForSites,
|
|
527
|
-
functions: projectSettings.serviceStatusForFunctions,
|
|
528
|
-
graphql: projectSettings.serviceStatusForGraphql,
|
|
529
|
-
messaging: projectSettings.serviceStatusForMessaging,
|
|
530
|
-
},
|
|
531
|
-
auth: {
|
|
532
|
-
methods: {
|
|
533
|
-
jwt: projectSettings.authJWT,
|
|
534
|
-
phone: projectSettings.authPhone,
|
|
535
|
-
invites: projectSettings.authInvites,
|
|
536
|
-
anonymous: projectSettings.authAnonymous,
|
|
537
|
-
'email-otp': projectSettings.authEmailOtp,
|
|
538
|
-
'magic-url': projectSettings.authUsersAuthMagicURL,
|
|
539
|
-
'email-password': projectSettings.authEmailPassword,
|
|
540
|
-
},
|
|
541
|
-
security: {
|
|
542
|
-
duration: projectSettings.authDuration,
|
|
543
|
-
limit: projectSettings.authLimit,
|
|
544
|
-
sessionsLimit: projectSettings.authSessionsLimit,
|
|
545
|
-
passwordHistory: projectSettings.authPasswordHistory,
|
|
546
|
-
passwordDictionary: projectSettings.authPasswordDictionary,
|
|
547
|
-
personalDataCheck: projectSettings.authPersonalDataCheck,
|
|
548
|
-
sessionAlerts: projectSettings.authSessionAlerts,
|
|
549
|
-
mockNumbers: projectSettings.authMockNumbers,
|
|
550
|
-
},
|
|
551
|
-
},
|
|
552
|
-
};
|
|
578
|
+
this.set("settings", createSettingsObject(project));
|
|
553
579
|
}
|
|
554
580
|
}
|
|
555
|
-
Local.CONFIG_FILE_PATH = 'appwrite.config.json';
|
|
556
|
-
Local.CONFIG_FILE_PATH_LEGACY = 'appwrite.json';
|
|
557
581
|
class Global extends Config {
|
|
582
|
+
static CONFIG_FILE_PATH = `.${SDK_TITLE_LOWER}/prefs.json`;
|
|
583
|
+
static PREFERENCE_CURRENT = "current";
|
|
584
|
+
static PREFERENCE_ENDPOINT = "endpoint";
|
|
585
|
+
static PREFERENCE_EMAIL = "email";
|
|
586
|
+
static PREFERENCE_SELF_SIGNED = "selfSigned";
|
|
587
|
+
static PREFERENCE_COOKIE = "cookie";
|
|
588
|
+
static PREFERENCE_PROJECT = "project";
|
|
589
|
+
static PREFERENCE_KEY = "key";
|
|
590
|
+
static PREFERENCE_LOCALE = "locale";
|
|
591
|
+
static PREFERENCE_MODE = "mode";
|
|
592
|
+
static IGNORE_ATTRIBUTES = [
|
|
593
|
+
Global.PREFERENCE_CURRENT,
|
|
594
|
+
Global.PREFERENCE_SELF_SIGNED,
|
|
595
|
+
Global.PREFERENCE_ENDPOINT,
|
|
596
|
+
Global.PREFERENCE_COOKIE,
|
|
597
|
+
Global.PREFERENCE_PROJECT,
|
|
598
|
+
Global.PREFERENCE_KEY,
|
|
599
|
+
Global.PREFERENCE_LOCALE,
|
|
600
|
+
Global.PREFERENCE_MODE,
|
|
601
|
+
];
|
|
602
|
+
static MODE_ADMIN = "admin";
|
|
603
|
+
static MODE_DEFAULT = "default";
|
|
604
|
+
static PROJECT_CONSOLE = "console";
|
|
558
605
|
constructor(path = Global.CONFIG_FILE_PATH) {
|
|
559
606
|
const homeDir = os.homedir();
|
|
560
607
|
super(`${homeDir}/${path}`);
|
|
561
608
|
}
|
|
562
609
|
getCurrentSession() {
|
|
563
610
|
if (!this.has(Global.PREFERENCE_CURRENT)) {
|
|
564
|
-
return
|
|
611
|
+
return "";
|
|
565
612
|
}
|
|
566
613
|
return this.get(Global.PREFERENCE_CURRENT);
|
|
567
614
|
}
|
|
@@ -600,7 +647,7 @@ class Global extends Config {
|
|
|
600
647
|
}
|
|
601
648
|
getEmail() {
|
|
602
649
|
if (!this.hasFrom(Global.PREFERENCE_EMAIL)) {
|
|
603
|
-
return
|
|
650
|
+
return "";
|
|
604
651
|
}
|
|
605
652
|
return this.getFrom(Global.PREFERENCE_EMAIL);
|
|
606
653
|
}
|
|
@@ -609,7 +656,7 @@ class Global extends Config {
|
|
|
609
656
|
}
|
|
610
657
|
getEndpoint() {
|
|
611
658
|
if (!this.hasFrom(Global.PREFERENCE_ENDPOINT)) {
|
|
612
|
-
return
|
|
659
|
+
return "";
|
|
613
660
|
}
|
|
614
661
|
return this.getFrom(Global.PREFERENCE_ENDPOINT);
|
|
615
662
|
}
|
|
@@ -627,7 +674,7 @@ class Global extends Config {
|
|
|
627
674
|
}
|
|
628
675
|
getCookie() {
|
|
629
676
|
if (!this.hasFrom(Global.PREFERENCE_COOKIE)) {
|
|
630
|
-
return
|
|
677
|
+
return "";
|
|
631
678
|
}
|
|
632
679
|
return this.getFrom(Global.PREFERENCE_COOKIE);
|
|
633
680
|
}
|
|
@@ -636,7 +683,7 @@ class Global extends Config {
|
|
|
636
683
|
}
|
|
637
684
|
getProject() {
|
|
638
685
|
if (!this.hasFrom(Global.PREFERENCE_PROJECT)) {
|
|
639
|
-
return
|
|
686
|
+
return "";
|
|
640
687
|
}
|
|
641
688
|
return this.getFrom(Global.PREFERENCE_PROJECT);
|
|
642
689
|
}
|
|
@@ -645,7 +692,7 @@ class Global extends Config {
|
|
|
645
692
|
}
|
|
646
693
|
getKey() {
|
|
647
694
|
if (!this.hasFrom(Global.PREFERENCE_KEY)) {
|
|
648
|
-
return
|
|
695
|
+
return "";
|
|
649
696
|
}
|
|
650
697
|
return this.getFrom(Global.PREFERENCE_KEY);
|
|
651
698
|
}
|
|
@@ -676,29 +723,7 @@ class Global extends Config {
|
|
|
676
723
|
}
|
|
677
724
|
}
|
|
678
725
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
Global.PREFERENCE_EMAIL = 'email';
|
|
683
|
-
Global.PREFERENCE_SELF_SIGNED = 'selfSigned';
|
|
684
|
-
Global.PREFERENCE_COOKIE = 'cookie';
|
|
685
|
-
Global.PREFERENCE_PROJECT = 'project';
|
|
686
|
-
Global.PREFERENCE_KEY = 'key';
|
|
687
|
-
Global.PREFERENCE_LOCALE = 'locale';
|
|
688
|
-
Global.PREFERENCE_MODE = 'mode';
|
|
689
|
-
Global.IGNORE_ATTRIBUTES = [
|
|
690
|
-
Global.PREFERENCE_CURRENT,
|
|
691
|
-
Global.PREFERENCE_SELF_SIGNED,
|
|
692
|
-
Global.PREFERENCE_ENDPOINT,
|
|
693
|
-
Global.PREFERENCE_COOKIE,
|
|
694
|
-
Global.PREFERENCE_PROJECT,
|
|
695
|
-
Global.PREFERENCE_KEY,
|
|
696
|
-
Global.PREFERENCE_LOCALE,
|
|
697
|
-
Global.PREFERENCE_MODE,
|
|
698
|
-
];
|
|
699
|
-
Global.MODE_ADMIN = 'admin';
|
|
700
|
-
Global.MODE_DEFAULT = 'default';
|
|
701
|
-
Global.PROJECT_CONSOLE = 'console';
|
|
702
|
-
exports.localConfig = new Local();
|
|
703
|
-
exports.globalConfig = new Global();
|
|
726
|
+
export const localConfig = new Local();
|
|
727
|
+
export const globalConfig = new Global();
|
|
728
|
+
export { KeysAttributes, KeysSite, KeysFunction, KeysTopics, KeysStorage, KeysTeams, KeysCollection, KeysTable, whitelistKeys, };
|
|
704
729
|
//# sourceMappingURL=config.js.map
|