appwrite-cli 11.1.0 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +2 -2
- package/docs/examples/functions/create-template-deployment.md +2 -1
- package/docs/examples/migrations/create-csv-export.md +0 -1
- package/docs/examples/sites/create-template-deployment.md +2 -1
- package/install.ps1 +2 -2
- package/install.sh +1 -1
- package/lib/client.js +2 -2
- package/lib/commands/functions.js +11 -6
- package/lib/commands/migrations.js +2 -7
- package/lib/commands/projects.js +2 -2
- package/lib/commands/sites.js +12 -7
- package/lib/commands/storage.js +14 -4
- package/lib/commands/tables-db.js +2 -2
- package/lib/parser.js +1 -1
- package/lib/type-generation/languages/csharp.js +8 -8
- package/lib/type-generation/languages/dart.js +7 -7
- package/lib/type-generation/languages/java.js +7 -7
- package/lib/type-generation/languages/kotlin.js +4 -4
- package/lib/type-generation/languages/php.js +9 -9
- package/lib/type-generation/languages/swift.js +8 -8
- package/lib/type-generation/languages/typescript.js +4 -4
- package/package.json +1 -1
- package/scoop/appwrite.config.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 12.0.0
|
|
4
|
+
|
|
5
|
+
* Change `create-deployment-template`'s `version` parameter to `type` and `reference`. eg. usage - `create-deployment-template --type tag --reference 1.0.0`
|
|
6
|
+
* Remove `bucket-id` parameter from `create-csv-export` command
|
|
7
|
+
* Allow enabling or disabling of image `transformations` in a bucket
|
|
8
|
+
* Fix type generation for `point`, `lineString` and `polygon` columns
|
|
9
|
+
|
|
10
|
+
## 11.1.1
|
|
11
|
+
|
|
12
|
+
* Fix duplicate `enums` during type generation by prefixing them with table name. For example, `enum MyEnum` will now be generated as `enum MyTableMyEnum` to avoid conflicts.
|
|
13
|
+
|
|
3
14
|
## 11.1.0
|
|
4
15
|
|
|
5
16
|
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
$ appwrite -v
|
|
32
|
-
|
|
32
|
+
12.0.0
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Install using prebuilt binaries
|
|
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
|
|
|
60
60
|
Once the installation completes, you can verify your install using
|
|
61
61
|
```
|
|
62
62
|
$ appwrite -v
|
|
63
|
-
|
|
63
|
+
12.0.0
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
## Getting Started
|
package/install.ps1
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
# You can use "View source" of this page to see the full script.
|
|
14
14
|
|
|
15
15
|
# REPO
|
|
16
|
-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
17
|
-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
16
|
+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/12.0.0/appwrite-cli-win-x64.exe"
|
|
17
|
+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/12.0.0/appwrite-cli-win-arm64.exe"
|
|
18
18
|
|
|
19
19
|
$APPWRITE_BINARY_NAME = "appwrite.exe"
|
|
20
20
|
|
package/install.sh
CHANGED
|
@@ -97,7 +97,7 @@ printSuccess() {
|
|
|
97
97
|
downloadBinary() {
|
|
98
98
|
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
|
|
99
99
|
|
|
100
|
-
GITHUB_LATEST_VERSION="
|
|
100
|
+
GITHUB_LATEST_VERSION="12.0.0"
|
|
101
101
|
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
|
|
102
102
|
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
|
|
103
103
|
|
package/lib/client.js
CHANGED
|
@@ -16,8 +16,8 @@ class Client {
|
|
|
16
16
|
'x-sdk-name': 'Command Line',
|
|
17
17
|
'x-sdk-platform': 'console',
|
|
18
18
|
'x-sdk-language': 'cli',
|
|
19
|
-
'x-sdk-version': '
|
|
20
|
-
'user-agent' : `AppwriteCLI/
|
|
19
|
+
'x-sdk-version': '12.0.0',
|
|
20
|
+
'user-agent' : `AppwriteCLI/12.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
|
|
21
21
|
'X-Appwrite-Response-Format' : '1.8.0',
|
|
22
22
|
};
|
|
23
23
|
}
|
|
@@ -819,7 +819,8 @@ const functionsCreateDuplicateDeployment = async ({functionId,deploymentId,build
|
|
|
819
819
|
* @property {string} repository Repository name of the template.
|
|
820
820
|
* @property {string} owner The name of the owner of the template.
|
|
821
821
|
* @property {string} rootDirectory Path to function code in the template repo.
|
|
822
|
-
* @property {
|
|
822
|
+
* @property {TemplateReferenceType} type Type for the reference provided. Can be commit, branch, or tag
|
|
823
|
+
* @property {string} reference Reference value, can be a commit hash, branch name, or release tag
|
|
823
824
|
* @property {boolean} activate Automatically activate the deployment when it is finished building.
|
|
824
825
|
* @property {boolean} overrideForCli
|
|
825
826
|
* @property {boolean} parseOutput
|
|
@@ -829,7 +830,7 @@ const functionsCreateDuplicateDeployment = async ({functionId,deploymentId,build
|
|
|
829
830
|
/**
|
|
830
831
|
* @param {FunctionsCreateTemplateDeploymentRequestParams} params
|
|
831
832
|
*/
|
|
832
|
-
const functionsCreateTemplateDeployment = async ({functionId,repository,owner,rootDirectory,
|
|
833
|
+
const functionsCreateTemplateDeployment = async ({functionId,repository,owner,rootDirectory,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
833
834
|
let client = !sdk ? await sdkForProject() :
|
|
834
835
|
sdk;
|
|
835
836
|
let apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId);
|
|
@@ -843,8 +844,11 @@ const functionsCreateTemplateDeployment = async ({functionId,repository,owner,ro
|
|
|
843
844
|
if (typeof rootDirectory !== 'undefined') {
|
|
844
845
|
payload['rootDirectory'] = rootDirectory;
|
|
845
846
|
}
|
|
846
|
-
if (typeof
|
|
847
|
-
payload['
|
|
847
|
+
if (typeof type !== 'undefined') {
|
|
848
|
+
payload['type'] = type;
|
|
849
|
+
}
|
|
850
|
+
if (typeof reference !== 'undefined') {
|
|
851
|
+
payload['reference'] = reference;
|
|
848
852
|
}
|
|
849
853
|
if (typeof activate !== 'undefined') {
|
|
850
854
|
payload['activate'] = activate;
|
|
@@ -866,7 +870,7 @@ const functionsCreateTemplateDeployment = async ({functionId,repository,owner,ro
|
|
|
866
870
|
/**
|
|
867
871
|
* @typedef {Object} FunctionsCreateVcsDeploymentRequestParams
|
|
868
872
|
* @property {string} functionId Function ID.
|
|
869
|
-
* @property {
|
|
873
|
+
* @property {VCSReferenceType} type Type of reference passed. Allowed values are: branch, commit
|
|
870
874
|
* @property {string} reference VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
|
|
871
875
|
* @property {boolean} activate Automatically activate the deployment when it is finished building.
|
|
872
876
|
* @property {boolean} overrideForCli
|
|
@@ -1565,7 +1569,8 @@ functions
|
|
|
1565
1569
|
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
|
|
1566
1570
|
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
|
|
1567
1571
|
.requiredOption(`--root-directory <root-directory>`, `Path to function code in the template repo.`)
|
|
1568
|
-
.requiredOption(`--
|
|
1572
|
+
.requiredOption(`--type <type>`, `Type for the reference provided. Can be commit, branch, or tag`)
|
|
1573
|
+
.requiredOption(`--reference <reference>`, `Reference value, can be a commit hash, branch name, or release tag`)
|
|
1569
1574
|
.option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
|
|
1570
1575
|
.action(actionRunner(functionsCreateTemplateDeployment))
|
|
1571
1576
|
|
|
@@ -172,7 +172,6 @@ const migrationsGetAppwriteReport = async ({resources,endpoint,projectID,key,par
|
|
|
172
172
|
/**
|
|
173
173
|
* @typedef {Object} MigrationsCreateCSVExportRequestParams
|
|
174
174
|
* @property {string} resourceId Composite ID in the format {databaseId:collectionId}, identifying a collection within a database to export.
|
|
175
|
-
* @property {string} bucketId Storage bucket unique ID where the exported CSV will be stored.
|
|
176
175
|
* @property {string} filename The name of the file to be created for the export, excluding the .csv extension.
|
|
177
176
|
* @property {string[]} columns List of attributes to export. If empty, all attributes will be exported. You can use the '*' wildcard to export all attributes from the collection.
|
|
178
177
|
* @property {string[]} queries Array of query strings generated using the Query class provided by the SDK to filter documents to export. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.
|
|
@@ -189,7 +188,7 @@ const migrationsGetAppwriteReport = async ({resources,endpoint,projectID,key,par
|
|
|
189
188
|
/**
|
|
190
189
|
* @param {MigrationsCreateCSVExportRequestParams} params
|
|
191
190
|
*/
|
|
192
|
-
const migrationsCreateCSVExport = async ({resourceId,
|
|
191
|
+
const migrationsCreateCSVExport = async ({resourceId,filename,columns,queries,delimiter,enclosure,escape,header,notify,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
193
192
|
let client = !sdk ? await sdkForProject() :
|
|
194
193
|
sdk;
|
|
195
194
|
let apiPath = '/migrations/csv/exports';
|
|
@@ -197,9 +196,6 @@ const migrationsCreateCSVExport = async ({resourceId,bucketId,filename,columns,q
|
|
|
197
196
|
if (typeof resourceId !== 'undefined') {
|
|
198
197
|
payload['resourceId'] = resourceId;
|
|
199
198
|
}
|
|
200
|
-
if (typeof bucketId !== 'undefined') {
|
|
201
|
-
payload['bucketId'] = bucketId;
|
|
202
|
-
}
|
|
203
199
|
if (typeof filename !== 'undefined') {
|
|
204
200
|
payload['filename'] = filename;
|
|
205
201
|
}
|
|
@@ -712,9 +708,8 @@ migrations
|
|
|
712
708
|
|
|
713
709
|
migrations
|
|
714
710
|
.command(`create-csv-export`)
|
|
715
|
-
.description(`Export documents to a CSV file from your Appwrite database. This endpoint allows you to export documents to a CSV file stored in an
|
|
711
|
+
.description(`Export documents to a CSV file from your Appwrite database. This endpoint allows you to export documents to a CSV file stored in a secure internal bucket. You'll receive an email with a download link when the export is complete.`)
|
|
716
712
|
.requiredOption(`--resource-id <resource-id>`, `Composite ID in the format {databaseId:collectionId}, identifying a collection within a database to export.`)
|
|
717
|
-
.requiredOption(`--bucket-id <bucket-id>`, `Storage bucket unique ID where the exported CSV will be stored.`)
|
|
718
713
|
.requiredOption(`--filename <filename>`, `The name of the file to be created for the export, excluding the .csv extension.`)
|
|
719
714
|
.option(`--columns [columns...]`, `List of attributes to export. If empty, all attributes will be exported. You can use the '*' wildcard to export all attributes from the collection.`)
|
|
720
715
|
.option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK to filter documents to export. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long.`)
|
package/lib/commands/projects.js
CHANGED
|
@@ -2322,7 +2322,7 @@ projects
|
|
|
2322
2322
|
.description(`Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project.`)
|
|
2323
2323
|
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
2324
2324
|
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
|
|
2325
|
-
.
|
|
2325
|
+
.option(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 scopes are allowed.`)
|
|
2326
2326
|
.option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`)
|
|
2327
2327
|
.action(actionRunner(projectsCreateKey))
|
|
2328
2328
|
|
|
@@ -2340,7 +2340,7 @@ projects
|
|
|
2340
2340
|
.requiredOption(`--project-id <project-id>`, `Project unique ID.`)
|
|
2341
2341
|
.requiredOption(`--key-id <key-id>`, `Key unique ID.`)
|
|
2342
2342
|
.requiredOption(`--name <name>`, `Key name. Max length: 128 chars.`)
|
|
2343
|
-
.
|
|
2343
|
+
.option(`--scopes [scopes...]`, `Key scopes list. Maximum of 100 events are allowed.`)
|
|
2344
2344
|
.option(`--expire <expire>`, `Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.`)
|
|
2345
2345
|
.action(actionRunner(projectsUpdateKey))
|
|
2346
2346
|
|
package/lib/commands/sites.js
CHANGED
|
@@ -813,7 +813,8 @@ const sitesCreateDuplicateDeployment = async ({siteId,deploymentId,parseOutput =
|
|
|
813
813
|
* @property {string} repository Repository name of the template.
|
|
814
814
|
* @property {string} owner The name of the owner of the template.
|
|
815
815
|
* @property {string} rootDirectory Path to site code in the template repo.
|
|
816
|
-
* @property {
|
|
816
|
+
* @property {TemplateReferenceType} type Type for the reference provided. Can be commit, branch, or tag
|
|
817
|
+
* @property {string} reference Reference value, can be a commit hash, branch name, or release tag
|
|
817
818
|
* @property {boolean} activate Automatically activate the deployment when it is finished building.
|
|
818
819
|
* @property {boolean} overrideForCli
|
|
819
820
|
* @property {boolean} parseOutput
|
|
@@ -823,7 +824,7 @@ const sitesCreateDuplicateDeployment = async ({siteId,deploymentId,parseOutput =
|
|
|
823
824
|
/**
|
|
824
825
|
* @param {SitesCreateTemplateDeploymentRequestParams} params
|
|
825
826
|
*/
|
|
826
|
-
const sitesCreateTemplateDeployment = async ({siteId,repository,owner,rootDirectory,
|
|
827
|
+
const sitesCreateTemplateDeployment = async ({siteId,repository,owner,rootDirectory,type,reference,activate,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
827
828
|
let client = !sdk ? await sdkForProject() :
|
|
828
829
|
sdk;
|
|
829
830
|
let apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId);
|
|
@@ -837,8 +838,11 @@ const sitesCreateTemplateDeployment = async ({siteId,repository,owner,rootDirect
|
|
|
837
838
|
if (typeof rootDirectory !== 'undefined') {
|
|
838
839
|
payload['rootDirectory'] = rootDirectory;
|
|
839
840
|
}
|
|
840
|
-
if (typeof
|
|
841
|
-
payload['
|
|
841
|
+
if (typeof type !== 'undefined') {
|
|
842
|
+
payload['type'] = type;
|
|
843
|
+
}
|
|
844
|
+
if (typeof reference !== 'undefined') {
|
|
845
|
+
payload['reference'] = reference;
|
|
842
846
|
}
|
|
843
847
|
if (typeof activate !== 'undefined') {
|
|
844
848
|
payload['activate'] = activate;
|
|
@@ -860,7 +864,7 @@ const sitesCreateTemplateDeployment = async ({siteId,repository,owner,rootDirect
|
|
|
860
864
|
/**
|
|
861
865
|
* @typedef {Object} SitesCreateVcsDeploymentRequestParams
|
|
862
866
|
* @property {string} siteId Site ID.
|
|
863
|
-
* @property {
|
|
867
|
+
* @property {VCSReferenceType} type Type of reference passed. Allowed values are: branch, commit
|
|
864
868
|
* @property {string} reference VCS reference to create deployment from. Depending on type this can be: branch name, commit hash
|
|
865
869
|
* @property {boolean} activate Automatically activate the deployment when it is finished building.
|
|
866
870
|
* @property {boolean} overrideForCli
|
|
@@ -1478,7 +1482,7 @@ sites
|
|
|
1478
1482
|
|
|
1479
1483
|
sites
|
|
1480
1484
|
.command(`create-deployment`)
|
|
1481
|
-
.description(`Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the
|
|
1485
|
+
.description(`Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID.`)
|
|
1482
1486
|
.requiredOption(`--site-id <site-id>`, `Site ID.`)
|
|
1483
1487
|
.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.`)
|
|
1484
1488
|
.requiredOption(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
|
|
@@ -1501,7 +1505,8 @@ sites
|
|
|
1501
1505
|
.requiredOption(`--repository <repository>`, `Repository name of the template.`)
|
|
1502
1506
|
.requiredOption(`--owner <owner>`, `The name of the owner of the template.`)
|
|
1503
1507
|
.requiredOption(`--root-directory <root-directory>`, `Path to site code in the template repo.`)
|
|
1504
|
-
.requiredOption(`--
|
|
1508
|
+
.requiredOption(`--type <type>`, `Type for the reference provided. Can be commit, branch, or tag`)
|
|
1509
|
+
.requiredOption(`--reference <reference>`, `Reference value, can be a commit hash, branch name, or release tag`)
|
|
1505
1510
|
.option(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))
|
|
1506
1511
|
.action(actionRunner(sitesCreateTemplateDeployment))
|
|
1507
1512
|
|
package/lib/commands/storage.js
CHANGED
|
@@ -41,7 +41,7 @@ const storage = new Command("storage").description(commandDescriptions['storage'
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @typedef {Object} StorageListBucketsRequestParams
|
|
44
|
-
* @property {string[]} 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus
|
|
44
|
+
* @property {string[]} 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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
|
|
45
45
|
* @property {string} search Search term to filter your list results. Max length: 256 chars.
|
|
46
46
|
* @property {boolean} total When set to false, the total count returned will be 0 and will not be calculated.
|
|
47
47
|
* @property {boolean} overrideForCli
|
|
@@ -95,6 +95,7 @@ const storageListBuckets = async ({queries,search,total,parseOutput = true, over
|
|
|
95
95
|
* @property {Compression} compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
|
|
96
96
|
* @property {boolean} encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
|
|
97
97
|
* @property {boolean} antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
|
|
98
|
+
* @property {boolean} transformations Are image transformations enabled?
|
|
98
99
|
* @property {boolean} overrideForCli
|
|
99
100
|
* @property {boolean} parseOutput
|
|
100
101
|
* @property {libClient | undefined} sdk
|
|
@@ -103,7 +104,7 @@ const storageListBuckets = async ({queries,search,total,parseOutput = true, over
|
|
|
103
104
|
/**
|
|
104
105
|
* @param {StorageCreateBucketRequestParams} params
|
|
105
106
|
*/
|
|
106
|
-
const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
107
|
+
const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,transformations,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
107
108
|
let client = !sdk ? await sdkForProject() :
|
|
108
109
|
sdk;
|
|
109
110
|
let apiPath = '/storage/buckets';
|
|
@@ -140,6 +141,9 @@ const storageCreateBucket = async ({bucketId,name,permissions,fileSecurity,enabl
|
|
|
140
141
|
if (typeof antivirus !== 'undefined') {
|
|
141
142
|
payload['antivirus'] = antivirus;
|
|
142
143
|
}
|
|
144
|
+
if (typeof transformations !== 'undefined') {
|
|
145
|
+
payload['transformations'] = transformations;
|
|
146
|
+
}
|
|
143
147
|
|
|
144
148
|
let response = undefined;
|
|
145
149
|
|
|
@@ -199,6 +203,7 @@ const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = f
|
|
|
199
203
|
* @property {Compression} compression Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
|
|
200
204
|
* @property {boolean} encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
|
|
201
205
|
* @property {boolean} antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
|
|
206
|
+
* @property {boolean} transformations Are image transformations enabled?
|
|
202
207
|
* @property {boolean} overrideForCli
|
|
203
208
|
* @property {boolean} parseOutput
|
|
204
209
|
* @property {libClient | undefined} sdk
|
|
@@ -207,7 +212,7 @@ const storageGetBucket = async ({bucketId,parseOutput = true, overrideForCli = f
|
|
|
207
212
|
/**
|
|
208
213
|
* @param {StorageUpdateBucketRequestParams} params
|
|
209
214
|
*/
|
|
210
|
-
const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
215
|
+
const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabled,maximumFileSize,allowedFileExtensions,compression,encryption,antivirus,transformations,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
|
|
211
216
|
let client = !sdk ? await sdkForProject() :
|
|
212
217
|
sdk;
|
|
213
218
|
let apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
@@ -241,6 +246,9 @@ const storageUpdateBucket = async ({bucketId,name,permissions,fileSecurity,enabl
|
|
|
241
246
|
if (typeof antivirus !== 'undefined') {
|
|
242
247
|
payload['antivirus'] = antivirus;
|
|
243
248
|
}
|
|
249
|
+
if (typeof transformations !== 'undefined') {
|
|
250
|
+
payload['transformations'] = transformations;
|
|
251
|
+
}
|
|
244
252
|
|
|
245
253
|
let response = undefined;
|
|
246
254
|
|
|
@@ -821,7 +829,7 @@ const storageGetBucketUsage = async ({bucketId,range,parseOutput = true, overrid
|
|
|
821
829
|
storage
|
|
822
830
|
.command(`list-buckets`)
|
|
823
831
|
.description(`Get a list of all the storage buckets. You can use the query params to filter your results.`)
|
|
824
|
-
.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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus`)
|
|
832
|
+
.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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations`)
|
|
825
833
|
.option(`--search <search>`, `Search term to filter your list results. Max length: 256 chars.`)
|
|
826
834
|
.option(`--total [value]`, `When set to false, the total count returned will be 0 and will not be calculated.`, (value) => value === undefined ? true : parseBool(value))
|
|
827
835
|
.option(`--console`, `Get the resource console url`)
|
|
@@ -840,6 +848,7 @@ storage
|
|
|
840
848
|
.option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
|
|
841
849
|
.option(`--encryption [value]`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
|
|
842
850
|
.option(`--antivirus [value]`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
|
|
851
|
+
.option(`--transformations [value]`, `Are image transformations enabled?`, (value) => value === undefined ? true : parseBool(value))
|
|
843
852
|
.action(actionRunner(storageCreateBucket))
|
|
844
853
|
|
|
845
854
|
storage
|
|
@@ -862,6 +871,7 @@ storage
|
|
|
862
871
|
.option(`--compression <compression>`, `Compression algorithm choosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled`)
|
|
863
872
|
.option(`--encryption [value]`, `Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
|
|
864
873
|
.option(`--antivirus [value]`, `Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled`, (value) => value === undefined ? true : parseBool(value))
|
|
874
|
+
.option(`--transformations [value]`, `Are image transformations enabled?`, (value) => value === undefined ? true : parseBool(value))
|
|
865
875
|
.action(actionRunner(storageUpdateBucket))
|
|
866
876
|
|
|
867
877
|
storage
|
|
@@ -602,7 +602,7 @@ const tablesDBGetTable = async ({databaseId,tableId,parseOutput = true, override
|
|
|
602
602
|
* @property {string} tableId Table ID.
|
|
603
603
|
* @property {string} name Table name. Max length: 128 chars.
|
|
604
604
|
* @property {string[]} permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
605
|
-
* @property {boolean} rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table
|
|
605
|
+
* @property {boolean} rowSecurity Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
606
606
|
* @property {boolean} enabled Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.
|
|
607
607
|
* @property {boolean} overrideForCli
|
|
608
608
|
* @property {boolean} parseOutput
|
|
@@ -2965,7 +2965,7 @@ tablesDB
|
|
|
2965
2965
|
.requiredOption(`--table-id <table-id>`, `Table ID.`)
|
|
2966
2966
|
.requiredOption(`--name <name>`, `Table name. Max length: 128 chars.`)
|
|
2967
2967
|
.option(`--permissions [permissions...]`, `An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
|
|
2968
|
-
.option(`--row-security [value]`, `Enables configuring permissions for individual rows. A user needs one of row or table
|
|
2968
|
+
.option(`--row-security [value]`, `Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions).`, (value) => value === undefined ? true : parseBool(value))
|
|
2969
2969
|
.option(`--enabled [value]`, `Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
|
|
2970
2970
|
.action(actionRunner(tablesDBUpdateTable))
|
|
2971
2971
|
|
package/lib/parser.js
CHANGED
|
@@ -122,7 +122,7 @@ const parseError = (err) => {
|
|
|
122
122
|
} catch {
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
const version = '
|
|
125
|
+
const version = '12.0.0';
|
|
126
126
|
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
|
|
127
127
|
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud()}`;
|
|
128
128
|
|
|
@@ -3,7 +3,7 @@ const { AttributeType } = require('../attribute');
|
|
|
3
3
|
const { LanguageMeta } = require("./language");
|
|
4
4
|
|
|
5
5
|
class CSharp extends LanguageMeta {
|
|
6
|
-
getType(attribute, collections) {
|
|
6
|
+
getType(attribute, collections, collectionName) {
|
|
7
7
|
let type = "";
|
|
8
8
|
switch (attribute.type) {
|
|
9
9
|
case AttributeType.STRING:
|
|
@@ -11,7 +11,7 @@ class CSharp extends LanguageMeta {
|
|
|
11
11
|
case AttributeType.DATETIME:
|
|
12
12
|
type = "string";
|
|
13
13
|
if (attribute.format === AttributeType.ENUM) {
|
|
14
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
14
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
15
15
|
}
|
|
16
16
|
break;
|
|
17
17
|
case AttributeType.INTEGER:
|
|
@@ -60,7 +60,7 @@ namespace Appwrite.Models
|
|
|
60
60
|
<% for (const attribute of collection.attributes) { -%>
|
|
61
61
|
<% if (attribute.format === 'enum') { -%>
|
|
62
62
|
|
|
63
|
-
public enum <%- toPascalCase(attribute.key) %> {
|
|
63
|
+
public enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
|
|
64
64
|
<% for (const [index, element] of Object.entries(attribute.elements) ) { -%>
|
|
65
65
|
[JsonPropertyName("<%- element %>")]
|
|
66
66
|
<%- toPascalCase(element) %><% if (index < attribute.elements.length - 1) { %>,<% } %>
|
|
@@ -72,13 +72,13 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
72
72
|
{
|
|
73
73
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
74
74
|
[JsonPropertyName("<%- attribute.key %>")]
|
|
75
|
-
public <%- getType(attribute, collections) %> <%= toPascalCase(attribute.key) %> { get; private set; }
|
|
75
|
+
public <%- getType(attribute, collections, collection.name) %> <%= toPascalCase(attribute.key) %> { get; private set; }
|
|
76
76
|
|
|
77
77
|
<% } -%>
|
|
78
78
|
|
|
79
79
|
public <%= toPascalCase(collection.name) %>(
|
|
80
80
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
81
|
-
<%- getType(attribute, collections) %> <%= toCamelCase(attribute.key) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
81
|
+
<%- getType(attribute, collections, collection.name) %> <%= toCamelCase(attribute.key) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
82
82
|
<% } -%>
|
|
83
83
|
)
|
|
84
84
|
{
|
|
@@ -93,9 +93,9 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
93
93
|
// ENUM
|
|
94
94
|
if (attribute.format === 'enum') {
|
|
95
95
|
if (attribute.array) {
|
|
96
|
-
-%>((IEnumerable<object>)map["<%- attribute.key %>"]).Select(e => Enum.Parse<Models.<%- toPascalCase(attribute.key) %>>(e.ToString()!, true)).ToList()<%
|
|
96
|
+
-%>((IEnumerable<object>)map["<%- attribute.key %>"]).Select(e => Enum.Parse<Models.<%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>>(e.ToString()!, true)).ToList()<%
|
|
97
97
|
} else {
|
|
98
|
-
-%>Enum.Parse<Models.<%- toPascalCase(attribute.key) %>>(map["<%- attribute.key %>"].ToString()!, true)<%
|
|
98
|
+
-%>Enum.Parse<Models.<%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>>(map["<%- attribute.key %>"].ToString()!, true)<%
|
|
99
99
|
}
|
|
100
100
|
// RELATIONSHIP
|
|
101
101
|
} else if (attribute.type === 'relationship') {
|
|
@@ -122,7 +122,7 @@ public class <%= toPascalCase(collection.name) %>
|
|
|
122
122
|
} else if (attribute.type === 'double') {
|
|
123
123
|
-%><%- !attribute.required ? 'map["' + attribute.key + '"] == null ? null : ' : '' %>Convert.ToDouble(map["<%- attribute.key %>"])<%
|
|
124
124
|
} else if (attribute.type === 'boolean') {
|
|
125
|
-
-%>(<%- getType(attribute, collections) %>)map["<%- attribute.key %>"]<%
|
|
125
|
+
-%>(<%- getType(attribute, collections, collection.name) %>)map["<%- attribute.key %>"]<%
|
|
126
126
|
} else if (attribute.type === 'string' || attribute.type === 'datetime' || attribute.type === 'email') {
|
|
127
127
|
-%>map["<%- attribute.key %>"]<%- !attribute.required ? '?' : '' %>.ToString()<%- attribute.required ? '!' : ''%><%
|
|
128
128
|
} else {
|
|
@@ -40,7 +40,7 @@ class Dart extends LanguageMeta {
|
|
|
40
40
|
return 'appwrite';
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
getType(attribute, collections) {
|
|
43
|
+
getType(attribute, collections, collectionName) {
|
|
44
44
|
let type = "";
|
|
45
45
|
switch (attribute.type) {
|
|
46
46
|
case AttributeType.STRING:
|
|
@@ -48,7 +48,7 @@ class Dart extends LanguageMeta {
|
|
|
48
48
|
case AttributeType.DATETIME:
|
|
49
49
|
type = "String";
|
|
50
50
|
if (attribute.format === AttributeType.ENUM) {
|
|
51
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
51
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
52
52
|
}
|
|
53
53
|
break;
|
|
54
54
|
case AttributeType.INTEGER:
|
|
@@ -103,7 +103,7 @@ import '<%- toSnakeCase(related.name) %>.dart';
|
|
|
103
103
|
|
|
104
104
|
<% for (const attribute of __attrs) { -%>
|
|
105
105
|
<% if (attribute.format === '${AttributeType.ENUM}') { -%>
|
|
106
|
-
enum <%- toPascalCase(attribute.key) %> {
|
|
106
|
+
enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
|
|
107
107
|
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
108
108
|
<%- strict ? toCamelCase(element) : element %><% if (index < attribute.elements.length - 1) { -%>,<% } %>
|
|
109
109
|
<% } -%>
|
|
@@ -113,7 +113,7 @@ enum <%- toPascalCase(attribute.key) %> {
|
|
|
113
113
|
<% } -%>
|
|
114
114
|
class <%= toPascalCase(collection.name) %> {
|
|
115
115
|
<% for (const [index, attribute] of Object.entries(__attrs)) { -%>
|
|
116
|
-
<%- getType(attribute, collections) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
116
|
+
<%- getType(attribute, collections, collection.name) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
117
117
|
<% } -%>
|
|
118
118
|
|
|
119
119
|
<%= toPascalCase(collection.name) %>({
|
|
@@ -128,10 +128,10 @@ class <%= toPascalCase(collection.name) %> {
|
|
|
128
128
|
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (attribute.type === '${AttributeType.STRING}' || attribute.type === '${AttributeType.EMAIL}' || attribute.type === '${AttributeType.DATETIME}') { -%>
|
|
129
129
|
<% if (attribute.format === '${AttributeType.ENUM}') { -%>
|
|
130
130
|
<% if (attribute.array) { -%>
|
|
131
|
-
(map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.name == e)).toList()<% } else { -%>
|
|
131
|
+
(map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.name == e)).toList()<% } else { -%>
|
|
132
132
|
<% if (!attribute.required) { -%>
|
|
133
|
-
map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
|
|
134
|
-
<%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
|
|
133
|
+
map['<%= attribute.key %>'] != null ? <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
|
|
134
|
+
<%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
|
|
135
135
|
<% } -%>
|
|
136
136
|
<% } else { -%>
|
|
137
137
|
<% if (attribute.array) { -%>
|
|
@@ -3,7 +3,7 @@ const { AttributeType } = require('../attribute');
|
|
|
3
3
|
const { LanguageMeta } = require("./language");
|
|
4
4
|
|
|
5
5
|
class Java extends LanguageMeta {
|
|
6
|
-
getType(attribute, collections) {
|
|
6
|
+
getType(attribute, collections, collectionName) {
|
|
7
7
|
let type = "";
|
|
8
8
|
switch (attribute.type) {
|
|
9
9
|
case AttributeType.STRING:
|
|
@@ -11,7 +11,7 @@ class Java extends LanguageMeta {
|
|
|
11
11
|
case AttributeType.DATETIME:
|
|
12
12
|
type = "String";
|
|
13
13
|
if (attribute.format === AttributeType.ENUM) {
|
|
14
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
14
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
15
15
|
}
|
|
16
16
|
break;
|
|
17
17
|
case AttributeType.INTEGER:
|
|
@@ -61,7 +61,7 @@ public class <%- toPascalCase(collection.name) %> {
|
|
|
61
61
|
<% for (const attribute of collection.attributes) { -%>
|
|
62
62
|
<% if (attribute.format === 'enum') { -%>
|
|
63
63
|
|
|
64
|
-
public enum <%- toPascalCase(attribute.key) %> {
|
|
64
|
+
public enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
|
|
65
65
|
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
66
66
|
<%- strict ? toUpperSnakeCase(element) : element %><%- index < attribute.elements.length - 1 ? ',' : ';' %>
|
|
67
67
|
<% } -%>
|
|
@@ -70,7 +70,7 @@ public class <%- toPascalCase(collection.name) %> {
|
|
|
70
70
|
<% } -%>
|
|
71
71
|
<% } -%>
|
|
72
72
|
<% for (const attribute of collection.attributes) { -%>
|
|
73
|
-
private <%- getType(attribute, collections) %> <%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
73
|
+
private <%- getType(attribute, collections, collection.name) %> <%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
74
74
|
<% } -%>
|
|
75
75
|
|
|
76
76
|
public <%- toPascalCase(collection.name) %>() {
|
|
@@ -78,7 +78,7 @@ public class <%- toPascalCase(collection.name) %> {
|
|
|
78
78
|
|
|
79
79
|
public <%- toPascalCase(collection.name) %>(
|
|
80
80
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
81
|
-
<%- getType(attribute, collections) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %><%- index < collection.attributes.length - 1 ? ',' : '' %>
|
|
81
|
+
<%- getType(attribute, collections, collection.name) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %><%- index < collection.attributes.length - 1 ? ',' : '' %>
|
|
82
82
|
<% } -%>
|
|
83
83
|
) {
|
|
84
84
|
<% for (const attribute of collection.attributes) { -%>
|
|
@@ -87,11 +87,11 @@ public class <%- toPascalCase(collection.name) %> {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
<% for (const attribute of collection.attributes) { -%>
|
|
90
|
-
public <%- getType(attribute, collections) %> get<%- toPascalCase(attribute.key) %>() {
|
|
90
|
+
public <%- getType(attribute, collections, collection.name) %> get<%- toPascalCase(attribute.key) %>() {
|
|
91
91
|
return <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
public void set<%- toPascalCase(attribute.key) %>(<%- getType(attribute, collections) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>) {
|
|
94
|
+
public void set<%- toPascalCase(attribute.key) %>(<%- getType(attribute, collections, collection.name) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>) {
|
|
95
95
|
this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -3,7 +3,7 @@ const { AttributeType } = require('../attribute');
|
|
|
3
3
|
const { LanguageMeta } = require("./language");
|
|
4
4
|
|
|
5
5
|
class Kotlin extends LanguageMeta {
|
|
6
|
-
getType(attribute, collections) {
|
|
6
|
+
getType(attribute, collections, collectionName) {
|
|
7
7
|
let type = "";
|
|
8
8
|
switch (attribute.type) {
|
|
9
9
|
case AttributeType.STRING:
|
|
@@ -11,7 +11,7 @@ class Kotlin extends LanguageMeta {
|
|
|
11
11
|
case AttributeType.DATETIME:
|
|
12
12
|
type = "String";
|
|
13
13
|
if (attribute.format === AttributeType.ENUM) {
|
|
14
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
14
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
15
15
|
}
|
|
16
16
|
break;
|
|
17
17
|
case AttributeType.INTEGER:
|
|
@@ -61,7 +61,7 @@ import <%- toPascalCase(collections.find(c => c.$id === attribute.relatedCollect
|
|
|
61
61
|
|
|
62
62
|
<% for (const attribute of collection.attributes) { -%>
|
|
63
63
|
<% if (attribute.format === 'enum') { -%>
|
|
64
|
-
enum class <%- toPascalCase(attribute.key) %> {
|
|
64
|
+
enum class <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
|
|
65
65
|
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
66
66
|
<%- strict ? toUpperSnakeCase(element) : element %><%- index < attribute.elements.length - 1 ? ',' : '' %>
|
|
67
67
|
<% } -%>
|
|
@@ -71,7 +71,7 @@ enum class <%- toPascalCase(attribute.key) %> {
|
|
|
71
71
|
<% } -%>
|
|
72
72
|
data class <%- toPascalCase(collection.name) %>(
|
|
73
73
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
74
|
-
val <%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
74
|
+
val <%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections, collection.name) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
75
75
|
<% } -%>
|
|
76
76
|
)
|
|
77
77
|
`;
|
|
@@ -3,7 +3,7 @@ const { AttributeType } = require('../attribute');
|
|
|
3
3
|
const { LanguageMeta } = require("./language");
|
|
4
4
|
|
|
5
5
|
class PHP extends LanguageMeta {
|
|
6
|
-
getType(attribute, collections) {
|
|
6
|
+
getType(attribute, collections, collectionName) {
|
|
7
7
|
if (attribute.array) {
|
|
8
8
|
return "array";
|
|
9
9
|
}
|
|
@@ -14,7 +14,7 @@ class PHP extends LanguageMeta {
|
|
|
14
14
|
case AttributeType.DATETIME:
|
|
15
15
|
type = "string";
|
|
16
16
|
if (attribute.format === AttributeType.ENUM) {
|
|
17
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
17
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
18
18
|
}
|
|
19
19
|
break;
|
|
20
20
|
case AttributeType.INTEGER:
|
|
@@ -60,9 +60,9 @@ use Appwrite\\Models\\<%- toPascalCase(collections.find(c => c.$id === attribute
|
|
|
60
60
|
<% } -%>
|
|
61
61
|
<% for (const attribute of collection.attributes) { -%>
|
|
62
62
|
<% if (attribute.format === 'enum') { -%>
|
|
63
|
-
enum <%- toPascalCase(attribute.key) %>: string {
|
|
63
|
+
enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>: string {
|
|
64
64
|
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
65
|
-
case <%-
|
|
65
|
+
case <%- toUpperSnakeCase(element) %> = '<%- element %>';
|
|
66
66
|
<% } -%>
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -70,15 +70,15 @@ enum <%- toPascalCase(attribute.key) %>: string {
|
|
|
70
70
|
<% } -%>
|
|
71
71
|
class <%- toPascalCase(collection.name) %> {
|
|
72
72
|
<% for (const attribute of collection.attributes ){ -%>
|
|
73
|
-
private <%- getType(attribute, collections) %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
73
|
+
private <%- getType(attribute, collections, collection.name) %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
74
74
|
<% } -%>
|
|
75
75
|
|
|
76
76
|
public function __construct(
|
|
77
77
|
<% for (const attribute of collection.attributes ){ -%>
|
|
78
78
|
<% if (attribute.required) { -%>
|
|
79
|
-
<%- getType(attribute, collections).replace('|null', '') %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %><% if (collection.attributes.indexOf(attribute) < collection.attributes.length - 1) { %>,<% } %>
|
|
79
|
+
<%- getType(attribute, collections, collection.name).replace('|null', '') %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %><% if (collection.attributes.indexOf(attribute) < collection.attributes.length - 1) { %>,<% } %>
|
|
80
80
|
<% } else { -%>
|
|
81
|
-
?<%- getType(attribute, collections).replace('|null', '') %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %> = null<% if (collection.attributes.indexOf(attribute) < collection.attributes.length - 1) { %>,<% } %>
|
|
81
|
+
?<%- getType(attribute, collections, collection.name).replace('|null', '') %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %> = null<% if (collection.attributes.indexOf(attribute) < collection.attributes.length - 1) { %>,<% } %>
|
|
82
82
|
<% } -%>
|
|
83
83
|
<% } -%>
|
|
84
84
|
) {
|
|
@@ -88,11 +88,11 @@ class <%- toPascalCase(collection.name) %> {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
91
|
-
public function get<%- toPascalCase(attribute.key) %>(): <%- getType(attribute, collections) %> {
|
|
91
|
+
public function get<%- toPascalCase(attribute.key) %>(): <%- getType(attribute, collections, collection.name) %> {
|
|
92
92
|
return $this-><%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
public function set<%- toPascalCase(attribute.key) %>(<%- getType(attribute, collections) %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %>): void {
|
|
95
|
+
public function set<%- toPascalCase(attribute.key) %>(<%- getType(attribute, collections, collection.name) %> $<%- strict ? toCamelCase(attribute.key) : attribute.key %>): void {
|
|
96
96
|
$this-><%- strict ? toCamelCase(attribute.key) : attribute.key %> = $<%- strict ? toCamelCase(attribute.key) : attribute.key %>;
|
|
97
97
|
}
|
|
98
98
|
<% if (index < collection.attributes.length - 1) { %>
|
|
@@ -3,7 +3,7 @@ const { AttributeType } = require('../attribute');
|
|
|
3
3
|
const { LanguageMeta } = require("./language");
|
|
4
4
|
|
|
5
5
|
class Swift extends LanguageMeta {
|
|
6
|
-
getType(attribute, collections) {
|
|
6
|
+
getType(attribute, collections, collectionName) {
|
|
7
7
|
let type = "";
|
|
8
8
|
switch (attribute.type) {
|
|
9
9
|
case AttributeType.STRING:
|
|
@@ -11,7 +11,7 @@ class Swift extends LanguageMeta {
|
|
|
11
11
|
case AttributeType.DATETIME:
|
|
12
12
|
type = "String";
|
|
13
13
|
if (attribute.format === AttributeType.ENUM) {
|
|
14
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
14
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
15
15
|
}
|
|
16
16
|
break;
|
|
17
17
|
case AttributeType.INTEGER:
|
|
@@ -53,7 +53,7 @@ class Swift extends LanguageMeta {
|
|
|
53
53
|
|
|
54
54
|
<% for (const attribute of collection.attributes) { -%>
|
|
55
55
|
<% if (attribute.format === 'enum') { -%>
|
|
56
|
-
public enum <%- toPascalCase(attribute.key) %>: String, Codable, CaseIterable {
|
|
56
|
+
public enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>: String, Codable, CaseIterable {
|
|
57
57
|
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
|
|
58
58
|
case <%- strict ? toCamelCase(element) : element %> = "<%- element %>"
|
|
59
59
|
<% } -%>
|
|
@@ -63,7 +63,7 @@ public enum <%- toPascalCase(attribute.key) %>: String, Codable, CaseIterable {
|
|
|
63
63
|
<% } -%>
|
|
64
64
|
public class <%- toPascalCase(collection.name) %>: Codable {
|
|
65
65
|
<% for (const attribute of collection.attributes) { -%>
|
|
66
|
-
public let <%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections) %>
|
|
66
|
+
public let <%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections, collection.name) %>
|
|
67
67
|
<% } %>
|
|
68
68
|
enum CodingKeys: String, CodingKey {
|
|
69
69
|
<% for (const attribute of collection.attributes) { -%>
|
|
@@ -73,7 +73,7 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
73
73
|
|
|
74
74
|
public init(
|
|
75
75
|
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
|
|
76
|
-
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
76
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- getType(attribute, collections, collection.name) %><% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
77
77
|
<% } -%>
|
|
78
78
|
) {
|
|
79
79
|
<% for (const attribute of collection.attributes) { -%>
|
|
@@ -86,9 +86,9 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
86
86
|
|
|
87
87
|
<% for (const attribute of collection.attributes) { -%>
|
|
88
88
|
<% if (!(!attribute.required && attribute.default === null)) { -%>
|
|
89
|
-
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = try container.decode(<%- getType(attribute, collections).replace('?', '') %>.self, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
89
|
+
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = try container.decode(<%- getType(attribute, collections, collection.name).replace('?', '') %>.self, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
90
90
|
<% } else { -%>
|
|
91
|
-
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = try container.decodeIfPresent(<%- getType(attribute, collections).replace('?', '') %>.self, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
91
|
+
self.<%- strict ? toCamelCase(attribute.key) : attribute.key %> = try container.decodeIfPresent(<%- getType(attribute, collections, collection.name).replace('?', '') %>.self, forKey: .<%- strict ? toCamelCase(attribute.key) : attribute.key %>)
|
|
92
92
|
<% } -%>
|
|
93
93
|
<% } -%>
|
|
94
94
|
}
|
|
@@ -144,7 +144,7 @@ public class <%- toPascalCase(collection.name) %>: Codable {
|
|
|
144
144
|
<% if ((attribute.type === 'string' || attribute.type === 'email' || attribute.type === 'datetime') && attribute.format !== 'enum') { -%>
|
|
145
145
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> String<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
146
146
|
<% } else if (attribute.type === 'string' && attribute.format === 'enum') { -%>
|
|
147
|
-
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- toPascalCase(attribute.key) %>(rawValue: map["<%- attribute.key %>"] as! String)!<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
147
|
+
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %>(rawValue: map["<%- attribute.key %>"] as! String)!<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
148
148
|
<% } else if (attribute.type === 'integer') { -%>
|
|
149
149
|
<%- strict ? toCamelCase(attribute.key) : attribute.key %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Int<% if (index < collection.attributes.length - 1) { %>,<% } %>
|
|
150
150
|
<% } else if (attribute.type === 'float') { -%>
|
|
@@ -6,7 +6,7 @@ const { AttributeType } = require('../attribute');
|
|
|
6
6
|
const { LanguageMeta } = require("./language");
|
|
7
7
|
|
|
8
8
|
class TypeScript extends LanguageMeta {
|
|
9
|
-
getType(attribute, collections) {
|
|
9
|
+
getType(attribute, collections, collectionName) {
|
|
10
10
|
let type = ""
|
|
11
11
|
switch (attribute.type) {
|
|
12
12
|
case AttributeType.STRING:
|
|
@@ -16,7 +16,7 @@ class TypeScript extends LanguageMeta {
|
|
|
16
16
|
case AttributeType.URL:
|
|
17
17
|
type = "string";
|
|
18
18
|
if (attribute.format === AttributeType.ENUM) {
|
|
19
|
-
type = LanguageMeta.toPascalCase(attribute.key);
|
|
19
|
+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
|
|
20
20
|
}
|
|
21
21
|
break;
|
|
22
22
|
case AttributeType.INTEGER:
|
|
@@ -77,7 +77,7 @@ class TypeScript extends LanguageMeta {
|
|
|
77
77
|
<% for (const collection of collections) { -%>
|
|
78
78
|
<% for (const attribute of collection.attributes) { -%>
|
|
79
79
|
<% if (attribute.format === 'enum') { -%>
|
|
80
|
-
export enum <%- toPascalCase(attribute.key) %> {
|
|
80
|
+
export enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
|
|
81
81
|
<% const entries = Object.entries(attribute.elements); -%>
|
|
82
82
|
<% for (let i = 0; i < entries.length; i++) { -%>
|
|
83
83
|
<%- toUpperSnakeCase(entries[i][1]) %> = "<%- entries[i][1] %>"<% if (i !== entries.length - 1) { %>,<% } %>
|
|
@@ -92,7 +92,7 @@ export type <%- toPascalCase(collection.name) %> = Models.Row & {
|
|
|
92
92
|
<% for (const attribute of collection.attributes) { -%>
|
|
93
93
|
<% const propertyName = strict ? toCamelCase(attribute.key) : attribute.key; -%>
|
|
94
94
|
<% const isValidIdentifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(propertyName); -%>
|
|
95
|
-
<% if (isValidIdentifier) { %><%- propertyName %><% } else { %>"<%- propertyName %>"<% } %>: <%- getType(attribute, collections) %>;
|
|
95
|
+
<% if (isValidIdentifier) { %><%- propertyName %><% } else { %>"<%- propertyName %>"<% } %>: <%- getType(attribute, collections, collection.name) %>;
|
|
96
96
|
<% } -%>
|
|
97
97
|
}<% if (index < collections.length - 1) { %>
|
|
98
98
|
<% } %>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "appwrite-cli",
|
|
3
3
|
"homepage": "https://appwrite.io/support",
|
|
4
4
|
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "12.0.0",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/ScoopInstaller/Scoop/master/schema.json",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "The Appwrite CLI is a command-line application that allows you to interact with Appwrite and perform server-side tasks using your terminal.",
|
|
5
5
|
"homepage": "https://github.com/appwrite/sdk-for-cli",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"architecture": {
|
|
8
8
|
"64bit": {
|
|
9
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
9
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/12.0.0/appwrite-cli-win-x64.exe",
|
|
10
10
|
"bin": [
|
|
11
11
|
[
|
|
12
12
|
"appwrite-cli-win-x64.exe",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
17
|
"arm64": {
|
|
18
|
-
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/
|
|
18
|
+
"url": "https://github.com/appwrite/sdk-for-cli/releases/download/12.0.0/appwrite-cli-win-arm64.exe",
|
|
19
19
|
"bin": [
|
|
20
20
|
[
|
|
21
21
|
"appwrite-cli-win-arm64.exe",
|