appwrite-cli 8.0.0 → 8.0.2

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/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
- 8.0.0
32
+ 8.0.2
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
- 8.0.0
63
+ 8.0.2
64
64
  ```
65
65
 
66
66
  ## Getting Started
@@ -1,4 +1,6 @@
1
1
  appwrite proxy createRedirectRule \
2
2
  --domain '' \
3
3
  --url https://example.com \
4
- --statusCode 301
4
+ --statusCode 301 \
5
+ --resourceId <RESOURCE_ID> \
6
+ --resourceType site
@@ -2,3 +2,4 @@ appwrite vcs getRepositoryContents \
2
2
  --installationId <INSTALLATION_ID> \
3
3
  --providerRepositoryId <PROVIDER_REPOSITORY_ID> \
4
4
 
5
+
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/8.0.0/appwrite-cli-win-x64.exe"
17
- $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/8.0.0/appwrite-cli-win-arm64.exe"
16
+ $GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/8.0.2/appwrite-cli-win-x64.exe"
17
+ $GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/8.0.2/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="8.0.0"
100
+ GITHUB_LATEST_VERSION="8.0.2"
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': '8.0.0',
20
- 'user-agent' : `AppwriteCLI/8.0.0 (${os.type()} ${os.version()}; ${os.arch()})`,
19
+ 'x-sdk-version': '8.0.2',
20
+ 'user-agent' : `AppwriteCLI/8.0.2 (${os.type()} ${os.version()}; ${os.arch()})`,
21
21
  'X-Appwrite-Response-Format' : '1.7.0',
22
22
  };
23
23
  }
@@ -2668,7 +2668,7 @@ databases
2668
2668
 
2669
2669
  databases
2670
2670
  .command(`upsert-documents`)
2671
- .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. `)
2671
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.`)
2672
2672
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2673
2673
  .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2674
2674
  .requiredOption(`--documents [documents...]`, `Array of document data as JSON objects. May contain partial documents.`)
@@ -2676,7 +2676,7 @@ databases
2676
2676
 
2677
2677
  databases
2678
2678
  .command(`update-documents`)
2679
- .description(`Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.`)
2679
+ .description(`**WARNING: Experimental Feature** - This endpoint is experimental and not yet officially supported. It may be subject to breaking changes or removal in future versions. Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated.`)
2680
2680
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
2681
2681
  .requiredOption(`--collection-id <collection-id>`, `Collection ID.`)
2682
2682
  .option(`--data <data>`, `Document data as JSON object. Include only attribute and value pairs to be updated.`)
@@ -157,6 +157,8 @@ const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = t
157
157
  * @property {string} domain Domain name.
158
158
  * @property {string} url Target URL of redirection
159
159
  * @property {StatusCode} statusCode Status code of redirection
160
+ * @property {string} resourceId ID of parent resource.
161
+ * @property {ProxyResourceType} resourceType Type of parent resource.
160
162
  * @property {boolean} overrideForCli
161
163
  * @property {boolean} parseOutput
162
164
  * @property {libClient | undefined} sdk
@@ -165,7 +167,7 @@ const proxyCreateFunctionRule = async ({domain,functionId,branch,parseOutput = t
165
167
  /**
166
168
  * @param {ProxyCreateRedirectRuleRequestParams} params
167
169
  */
168
- const proxyCreateRedirectRule = async ({domain,url,statusCode,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
170
+ const proxyCreateRedirectRule = async ({domain,url,statusCode,resourceId,resourceType,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
169
171
  let client = !sdk ? await sdkForProject() :
170
172
  sdk;
171
173
  let apiPath = '/proxy/rules/redirect';
@@ -179,6 +181,12 @@ const proxyCreateRedirectRule = async ({domain,url,statusCode,parseOutput = true
179
181
  if (typeof statusCode !== 'undefined') {
180
182
  payload['statusCode'] = statusCode;
181
183
  }
184
+ if (typeof resourceId !== 'undefined') {
185
+ payload['resourceId'] = resourceId;
186
+ }
187
+ if (typeof resourceType !== 'undefined') {
188
+ payload['resourceType'] = resourceType;
189
+ }
182
190
 
183
191
  let response = undefined;
184
192
 
@@ -355,6 +363,8 @@ proxy
355
363
  .requiredOption(`--domain <domain>`, `Domain name.`)
356
364
  .requiredOption(`--url <url>`, `Target URL of redirection`)
357
365
  .requiredOption(`--status-code <status-code>`, `Status code of redirection`)
366
+ .requiredOption(`--resource-id <resource-id>`, `ID of parent resource.`)
367
+ .requiredOption(`--resource-type <resource-type>`, `Type of parent resource.`)
358
368
  .action(actionRunner(proxyCreateRedirectRule))
359
369
 
360
370
  proxy
@@ -226,6 +226,7 @@ const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,pa
226
226
  * @property {string} installationId Installation Id
227
227
  * @property {string} providerRepositoryId Repository Id
228
228
  * @property {string} providerRootDirectory Path to get contents of nested directory
229
+ * @property {string} providerReference Git reference (branch, tag, commit) to get contents from
229
230
  * @property {boolean} overrideForCli
230
231
  * @property {boolean} parseOutput
231
232
  * @property {libClient | undefined} sdk
@@ -234,7 +235,7 @@ const vcsListRepositoryBranches = async ({installationId,providerRepositoryId,pa
234
235
  /**
235
236
  * @param {VcsGetRepositoryContentsRequestParams} params
236
237
  */
237
- const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,providerRootDirectory,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
238
+ const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,providerRootDirectory,providerReference,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
238
239
  let client = !sdk ? await sdkForProject() :
239
240
  sdk;
240
241
  let apiPath = '/vcs/github/installations/{installationId}/providerRepositories/{providerRepositoryId}/contents'.replace('{installationId}', installationId).replace('{providerRepositoryId}', providerRepositoryId);
@@ -242,6 +243,9 @@ const vcsGetRepositoryContents = async ({installationId,providerRepositoryId,pro
242
243
  if (typeof providerRootDirectory !== 'undefined') {
243
244
  payload['providerRootDirectory'] = providerRootDirectory;
244
245
  }
246
+ if (typeof providerReference !== 'undefined') {
247
+ payload['providerReference'] = providerReference;
248
+ }
245
249
 
246
250
  let response = undefined;
247
251
 
@@ -435,6 +439,7 @@ vcs
435
439
  .requiredOption(`--installation-id <installation-id>`, `Installation Id`)
436
440
  .requiredOption(`--provider-repository-id <provider-repository-id>`, `Repository Id`)
437
441
  .option(`--provider-root-directory <provider-root-directory>`, `Path to get contents of nested directory`)
442
+ .option(`--provider-reference <provider-reference>`, `Git reference (branch, tag, commit) to get contents from`)
438
443
  .action(actionRunner(vcsGetRepositoryContents))
439
444
 
440
445
  vcs
package/lib/parser.js CHANGED
@@ -120,7 +120,7 @@ const parseError = (err) => {
120
120
  } catch {
121
121
  }
122
122
 
123
- const version = '8.0.0';
123
+ const version = '8.0.2';
124
124
  const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
125
125
  const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud}`;
126
126
 
@@ -52,7 +52,7 @@ import '<%- attribute.relatedCollection.toLowerCase() %>.dart';
52
52
  <% if (attribute.format === 'enum') { -%>
53
53
  enum <%- toPascalCase(attribute.key) %> {
54
54
  <% for (const element of attribute.elements) { -%>
55
- <%- element %>,
55
+ <%- toSnakeCase(element) %>,
56
56
  <% } -%>
57
57
  }
58
58
 
@@ -78,7 +78,7 @@ class <%= toPascalCase(collection.name) %> {
78
78
  (map['<%= attribute.key %>'] as List<dynamic>?)?.map((e) => <%- toPascalCase(attribute.key) %>.values.firstWhere((element) => element.name == e)).toList()<% if (!attribute.required) { %> ?? []<% } -%>
79
79
  <% } else { -%>
80
80
  <% if (!attribute.required) { -%>
81
- map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull : null<% } else { -%>
81
+ map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.key) %>.values.where((e) => e.name == map['<%= attribute.key %>']).firstOrNull() : null<% } else { -%>
82
82
  <%- toPascalCase(attribute.key) %>.values.firstWhere((e) => e.name == map['<%= attribute.key %>'])<% } -%>
83
83
  <% } -%>
84
84
  <% } else { -%>
@@ -44,7 +44,7 @@ class Java extends LanguageMeta {
44
44
  import java.util.*;
45
45
  <% for (const attribute of collection.attributes) { -%>
46
46
  <% if (attribute.type === 'relationship') { -%>
47
- import <%- toPascalCase(attribute.relatedCollection) %>;
47
+ import io.appwrite.models.<%- toPascalCase(attribute.relatedCollection) %>;
48
48
 
49
49
  <% } -%>
50
50
  <% } -%>
@@ -54,7 +54,7 @@ public class <%- toPascalCase(collection.name) %> {
54
54
 
55
55
  public enum <%- toPascalCase(attribute.key) %> {
56
56
  <% for (const [index, element] of Object.entries(attribute.elements)) { -%>
57
- <%- element %><%- index < attribute.elements.length - 1 ? ',' : ';' %>
57
+ <%- toSnakeCase(element) %><%- index < attribute.elements.length - 1 ? ',' : ';' %>
58
58
  <% } -%>
59
59
  }
60
60
 
@@ -54,7 +54,7 @@ import <%- toPascalCase(attribute.relatedCollection) %>
54
54
  <% if (attribute.format === 'enum') { -%>
55
55
  enum class <%- toPascalCase(attribute.key) %> {
56
56
  <% for (const [index, element] of Object.entries(attribute.elements)) { -%>
57
- <%- element %><%- index < attribute.elements.length - 1 ? ',' : '' %>
57
+ <%- toUpperSnakeCase(element) %><%- index < attribute.elements.length - 1 ? ',' : '' %>
58
58
  <% } -%>
59
59
  }
60
60
 
@@ -53,9 +53,9 @@ use Appwrite\\Models\\<%- toPascalCase(attribute.relatedCollection) %>;
53
53
  <% } -%>
54
54
  <% for (const attribute of collection.attributes) { -%>
55
55
  <% if (attribute.format === 'enum') { -%>
56
- enum <%- toPascalCase(attribute.key) %> {
56
+ enum <%- toPascalCase(attribute.key) %>: string {
57
57
  <% for (const [index, element] of Object.entries(attribute.elements)) { -%>
58
- case <%- element.toUpperCase() %> = '<%- element %>';
58
+ case <%- toUpperSnakeCase(element) %> = '<%- element %>';
59
59
  <% } -%>
60
60
  }
61
61
 
@@ -48,7 +48,7 @@ class Swift extends LanguageMeta {
48
48
  <% if (attribute.format === 'enum') { -%>
49
49
  public enum <%- toPascalCase(attribute.key) %>: String, Codable, CaseIterable {
50
50
  <% for (const [index, element] of Object.entries(attribute.elements)) { -%>
51
- case <%- element %> = "<%- element %>"
51
+ case <%- toSnakeCase(element) %> = "<%- element %>"
52
52
  <% } -%>
53
53
  }
54
54
 
@@ -116,7 +116,11 @@ public class <%- toPascalCase(collection.name) %>: Codable {
116
116
  return <%- toPascalCase(collection.name) %>(
117
117
  <% for (const attribute of collection.attributes) { -%>
118
118
  <% if (attribute.type === 'relationship') { -%>
119
+ <% if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') { -%>
120
+ <%- toCamelCase(attribute.key) %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [<%- toPascalCase(attribute.relatedCollection) %>]<% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
121
+ <% } else { -%>
119
122
  <%- toCamelCase(attribute.key) %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> <%- toPascalCase(attribute.relatedCollection) %><% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
123
+ <% } -%>
120
124
  <% } else if (attribute.array) { -%>
121
125
  <% if (attribute.type === 'string') { -%>
122
126
  <%- toCamelCase(attribute.key) %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [String]<% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
@@ -130,8 +134,10 @@ public class <%- toPascalCase(collection.name) %>: Codable {
130
134
  <%- toCamelCase(attribute.key) %>: (map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> [[String: Any]])<% if (!attribute.required) { %>?<% } %>.map { <%- toPascalCase(attribute.type) %>.from(map: $0) }<% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
131
135
  <% } -%>
132
136
  <% } else { -%>
133
- <% if (attribute.type === 'string' || attribute.type === 'email' || attribute.type === 'datetime' || attribute.type === 'enum') { -%>
137
+ <% if ((attribute.type === 'string' || attribute.type === 'email' || attribute.type === 'datetime') && attribute.format !== 'enum') { -%>
134
138
  <%- toCamelCase(attribute.key) %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> String<% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
139
+ <% } else if (attribute.type === 'string' && attribute.format === 'enum') { -%>
140
+ <%- toCamelCase(attribute.key) %>: <%- toPascalCase(attribute.key) %>(rawValue: map["<%- attribute.key %>"] as! String)!<% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
135
141
  <% } else if (attribute.type === 'integer') { -%>
136
142
  <%- toCamelCase(attribute.key) %>: map["<%- attribute.key %>"] as<% if (!attribute.required) { %>?<% } else { %>!<% } %> Int<% if (attribute !== collection.attributes[collection.attributes.length - 1]) { %>,<% } %>
137
143
  <% } else if (attribute.type === 'float') { -%>
@@ -72,18 +72,20 @@ class TypeScript extends LanguageMeta {
72
72
  <% if (attribute.format === 'enum') { -%>
73
73
  export enum <%- toPascalCase(attribute.key) %> {
74
74
  <% for (const [index, element] of Object.entries(attribute.elements)) { -%>
75
- <%- element.toUpperCase() %> = "<%- element %>",
75
+ <%- toUpperSnakeCase(element) %> = "<%- element %>",
76
76
  <% } -%>
77
77
  }
78
+
78
79
  <% } -%>
79
80
  <% } -%>
80
81
  <% } -%>
81
- <% for (const collection of collections) { %>
82
+ <% for (const collection of collections) { -%>
82
83
  export type <%- toPascalCase(collection.name) %> = Models.Document & {
83
84
  <% for (const attribute of collection.attributes) { -%>
84
85
  <%- toCamelCase(attribute.key) %>: <%- getType(attribute) %>;
85
86
  <% } -%>
86
87
  }
88
+
87
89
  <% } %>`;
88
90
  }
89
91
 
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": "8.0.0",
5
+ "version": "8.0.2",
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": "8.0.0",
3
+ "version": "8.0.2",
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/8.0.0/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/8.0.2/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/8.0.0/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/8.0.2/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",