Skip to content

Commit 20a6015

Browse files
authored
Merge pull request #217 from appwrite/dev
feat: Command Line SDK update for version 11.1.1
2 parents 9961632 + 91d46f0 commit 20a6015

File tree

16 files changed

+64
-60
lines changed

16 files changed

+64
-60
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 11.1.1
4+
5+
* 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.
6+
37
## 11.1.0
48

59
* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Once the installation is complete, you can verify the install using
2929

3030
```sh
3131
$ appwrite -v
32-
11.1.0
32+
11.1.1
3333
```
3434

3535
### Install using prebuilt binaries
@@ -60,7 +60,7 @@ $ scoop install https://raw.githubusercontent.com/appwrite/sdk-for-cli/master/sc
6060
Once the installation completes, you can verify your install using
6161
```
6262
$ appwrite -v
63-
11.1.0
63+
11.1.1
6464
```
6565

6666
## Getting Started

install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# You can use "View source" of this page to see the full script.
1414

1515
# REPO
16-
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.0/appwrite-cli-win-x64.exe"
17-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.0/appwrite-cli-win-arm64.exe"
16+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.1/appwrite-cli-win-x64.exe"
17+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.1/appwrite-cli-win-arm64.exe"
1818

1919
$APPWRITE_BINARY_NAME = "appwrite.exe"
2020

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ printSuccess() {
9797
downloadBinary() {
9898
echo "[2/4] Downloading executable for $OS ($ARCH) ..."
9999

100-
GITHUB_LATEST_VERSION="11.1.0"
100+
GITHUB_LATEST_VERSION="11.1.1"
101101
GITHUB_FILE="appwrite-cli-${OS}-${ARCH}"
102102
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY_NAME/releases/download/$GITHUB_LATEST_VERSION/$GITHUB_FILE"
103103

lib/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ class Client {
1616
'x-sdk-name': 'Command Line',
1717
'x-sdk-platform': 'console',
1818
'x-sdk-language': 'cli',
19-
'x-sdk-version': '11.1.0',
20-
'user-agent' : `AppwriteCLI/11.1.0 (${os.type()} ${os.version()}; ${os.arch()})`,
19+
'x-sdk-version': '11.1.1',
20+
'user-agent' : `AppwriteCLI/11.1.1 (${os.type()} ${os.version()}; ${os.arch()})`,
2121
'X-Appwrite-Response-Format' : '1.8.0',
2222
};
2323
}

lib/commands/sites.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,7 @@ sites
14781478

14791479
sites
14801480
.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 function's deployment to use your new deployment ID.`)
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 site's deployment to use your new deployment ID.`)
14821482
.requiredOption(`--site-id <site-id>`, `Site ID.`)
14831483
.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.`)
14841484
.requiredOption(`--activate [value]`, `Automatically activate the deployment when it is finished building.`, (value) => value === undefined ? true : parseBool(value))

lib/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const parseError = (err) => {
122122
} catch {
123123
}
124124

125-
const version = '11.1.0';
125+
const version = '11.1.1';
126126
const stepsToReproduce = `Running \`appwrite ${cliConfig.reportData.data.args.join(' ')}\``;
127127
const yourEnvironment = `CLI version: ${version}\nOperation System: ${os.type()}\nAppwrite version: ${appwriteVersion}\nIs Cloud: ${isCloud()}`;
128128

lib/type-generation/languages/csharp.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ const { AttributeType } = require('../attribute');
33
const { LanguageMeta } = require("./language");
44

55
class CSharp extends LanguageMeta {
6-
getType(attribute, collections) {
6+
getType(attribute, collections, collectionName) {
77
let type = "";
88
switch (attribute.type) {
99
case AttributeType.STRING:
1010
case AttributeType.EMAIL:
1111
case AttributeType.DATETIME:
1212
type = "string";
1313
if (attribute.format === AttributeType.ENUM) {
14-
type = LanguageMeta.toPascalCase(attribute.key);
14+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
1515
}
1616
break;
1717
case AttributeType.INTEGER:
@@ -60,7 +60,7 @@ namespace Appwrite.Models
6060
<% for (const attribute of collection.attributes) { -%>
6161
<% if (attribute.format === 'enum') { -%>
6262
63-
public enum <%- toPascalCase(attribute.key) %> {
63+
public enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
6464
<% for (const [index, element] of Object.entries(attribute.elements) ) { -%>
6565
[JsonPropertyName("<%- element %>")]
6666
<%- toPascalCase(element) %><% if (index < attribute.elements.length - 1) { %>,<% } %>
@@ -72,13 +72,13 @@ public class <%= toPascalCase(collection.name) %>
7272
{
7373
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
7474
[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; }
7676
7777
<% } -%>
7878
7979
public <%= toPascalCase(collection.name) %>(
8080
<% 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) { %>,<% } %>
8282
<% } -%>
8383
)
8484
{
@@ -93,9 +93,9 @@ public class <%= toPascalCase(collection.name) %>
9393
// ENUM
9494
if (attribute.format === 'enum') {
9595
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()<%
9797
} 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)<%
9999
}
100100
// RELATIONSHIP
101101
} else if (attribute.type === 'relationship') {
@@ -122,7 +122,7 @@ public class <%= toPascalCase(collection.name) %>
122122
} else if (attribute.type === 'double') {
123123
-%><%- !attribute.required ? 'map["' + attribute.key + '"] == null ? null : ' : '' %>Convert.ToDouble(map["<%- attribute.key %>"])<%
124124
} else if (attribute.type === 'boolean') {
125-
-%>(<%- getType(attribute, collections) %>)map["<%- attribute.key %>"]<%
125+
-%>(<%- getType(attribute, collections, collection.name) %>)map["<%- attribute.key %>"]<%
126126
} else if (attribute.type === 'string' || attribute.type === 'datetime' || attribute.type === 'email') {
127127
-%>map["<%- attribute.key %>"]<%- !attribute.required ? '?' : '' %>.ToString()<%- attribute.required ? '!' : ''%><%
128128
} else {

lib/type-generation/languages/dart.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ class Dart extends LanguageMeta {
4040
return 'appwrite';
4141
}
4242

43-
getType(attribute, collections) {
43+
getType(attribute, collections, collectionName) {
4444
let type = "";
4545
switch (attribute.type) {
4646
case AttributeType.STRING:
4747
case AttributeType.EMAIL:
4848
case AttributeType.DATETIME:
4949
type = "String";
5050
if (attribute.format === AttributeType.ENUM) {
51-
type = LanguageMeta.toPascalCase(attribute.key);
51+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
5252
}
5353
break;
5454
case AttributeType.INTEGER:
@@ -103,7 +103,7 @@ import '<%- toSnakeCase(related.name) %>.dart';
103103
104104
<% for (const attribute of __attrs) { -%>
105105
<% if (attribute.format === '${AttributeType.ENUM}') { -%>
106-
enum <%- toPascalCase(attribute.key) %> {
106+
enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
107107
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
108108
<%- strict ? toCamelCase(element) : element %><% if (index < attribute.elements.length - 1) { -%>,<% } %>
109109
<% } -%>
@@ -113,7 +113,7 @@ enum <%- toPascalCase(attribute.key) %> {
113113
<% } -%>
114114
class <%= toPascalCase(collection.name) %> {
115115
<% 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 %>;
117117
<% } -%>
118118
119119
<%= toPascalCase(collection.name) %>({
@@ -128,10 +128,10 @@ class <%= toPascalCase(collection.name) %> {
128128
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (attribute.type === '${AttributeType.STRING}' || attribute.type === '${AttributeType.EMAIL}' || attribute.type === '${AttributeType.DATETIME}') { -%>
129129
<% if (attribute.format === '${AttributeType.ENUM}') { -%>
130130
<% 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 { -%>
132132
<% 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 %>'])<% } -%>
135135
<% } -%>
136136
<% } else { -%>
137137
<% if (attribute.array) { -%>

lib/type-generation/languages/java.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ const { AttributeType } = require('../attribute');
33
const { LanguageMeta } = require("./language");
44

55
class Java extends LanguageMeta {
6-
getType(attribute, collections) {
6+
getType(attribute, collections, collectionName) {
77
let type = "";
88
switch (attribute.type) {
99
case AttributeType.STRING:
1010
case AttributeType.EMAIL:
1111
case AttributeType.DATETIME:
1212
type = "String";
1313
if (attribute.format === AttributeType.ENUM) {
14-
type = LanguageMeta.toPascalCase(attribute.key);
14+
type = LanguageMeta.toPascalCase(collectionName) + LanguageMeta.toPascalCase(attribute.key);
1515
}
1616
break;
1717
case AttributeType.INTEGER:
@@ -61,7 +61,7 @@ public class <%- toPascalCase(collection.name) %> {
6161
<% for (const attribute of collection.attributes) { -%>
6262
<% if (attribute.format === 'enum') { -%>
6363
64-
public enum <%- toPascalCase(attribute.key) %> {
64+
public enum <%- toPascalCase(collection.name) %><%- toPascalCase(attribute.key) %> {
6565
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
6666
<%- strict ? toUpperSnakeCase(element) : element %><%- index < attribute.elements.length - 1 ? ',' : ';' %>
6767
<% } -%>
@@ -70,15 +70,15 @@ public class <%- toPascalCase(collection.name) %> {
7070
<% } -%>
7171
<% } -%>
7272
<% 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 %>;
7474
<% } -%>
7575
7676
public <%- toPascalCase(collection.name) %>() {
7777
}
7878
7979
public <%- toPascalCase(collection.name) %>(
8080
<% 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 ? ',' : '' %>
8282
<% } -%>
8383
) {
8484
<% for (const attribute of collection.attributes) { -%>
@@ -87,11 +87,11 @@ public class <%- toPascalCase(collection.name) %> {
8787
}
8888
8989
<% 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) %>() {
9191
return <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
9292
}
9393
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 %>) {
9595
this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
9696
}
9797

0 commit comments

Comments
 (0)