Skip to content

Commit c2c9a5c

Browse files
authored
Merge pull request #180 from appwrite/dev-chirag
chore: regenerate sdk
2 parents 1d89283 + 40a6b4b commit c2c9a5c

File tree

16 files changed

+143
-143
lines changed

16 files changed

+143
-143
lines changed

CHANGELOG.md

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

3+
## 8.2.2
4+
5+
* Fix object comparison logic when pushing settings
6+
* Type generation fixes:
7+
* Dart: Fixed import casing to snake_case, removed `extends Document` and hardcoded attributes, removed unnecessary imports
8+
* Java: Fixed indentation to 4 spaces, updated imports to `java.util.Objects`, fixed enum casing in strict mode as per [Oracle official docs](https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html)
9+
* Javascript: Updated optional values formatting from `|null` to `| null`
10+
* Kotlin: Fixed indentation to 4 spaces per [Kotlinlang official docs](https://kotlinlang.org/docs/coding-conventions.html#indentation)
11+
* PHP: Fixed indentation to 4 spaces per [PHP Fig official docs](https://www.php-fig.org/psr/psr-2/)
12+
* Swift: Fixed indentation to 4 spaces, improved `decodeIfPresent` usage for optionals, added missing `public` to `init` method
13+
* Typescript: Fixed indentation to 4 spaces per [Typescript coding guidelines](https://github.com/microsoft/TypeScript/wiki/Coding-guidelines)
14+
315
## 8.2.1
416

517
* Added `--with-variables` option to the Sites command for adding/updating environment variables

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-
8.2.1
32+
8.2.2
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-
8.2.1
63+
8.2.2
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/8.2.1/appwrite-cli-win-x64.exe"
17-
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/8.2.1/appwrite-cli-win-arm64.exe"
16+
$GITHUB_x64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/8.2.2/appwrite-cli-win-x64.exe"
17+
$GITHUB_arm64_URL = "https://github.com/appwrite/sdk-for-cli/releases/download/8.2.2/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="8.2.1"
100+
GITHUB_LATEST_VERSION="8.2.2"
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': '8.2.1',
20-
'user-agent' : `AppwriteCLI/8.2.1 (${os.type()} ${os.version()}; ${os.arch()})`,
19+
'x-sdk-version': '8.2.2',
20+
'user-agent' : `AppwriteCLI/8.2.2 (${os.type()} ${os.version()}; ${os.arch()})`,
2121
'X-Appwrite-Response-Format' : '1.7.0',
2222
};
2323
}

lib/commands/push.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,17 @@ const getObjectChanges = (remote, local, index, what) => {
417417

418418
if (remote[index] && local[index]) {
419419
for (let [service, status] of Object.entries(remote[index])) {
420-
if (status !== local[index][service]) {
421-
changes.push({ group: what, setting: service, remote: chalk.red(status), local: chalk.green(local[index][service]) })
420+
const localValue = local[index][service];
421+
let valuesEqual = false;
422+
423+
if (Array.isArray(status) && Array.isArray(localValue)) {
424+
valuesEqual = JSON.stringify(status) === JSON.stringify(localValue);
425+
} else {
426+
valuesEqual = status === localValue;
427+
}
428+
429+
if (!valuesEqual) {
430+
changes.push({ group: what, setting: service, remote: chalk.red(status), local: chalk.green(localValue) })
422431
}
423432
}
424433
}

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 = '8.2.1';
125+
const version = '8.2.2';
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/dart.js

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ class Dart extends LanguageMeta {
8383
}
8484

8585
getTemplate() {
86-
return `import 'package:${this.getPackageName()}/models.dart';
87-
<% for (const attribute of collection.attributes) { -%>
86+
return `<% for (const attribute of collection.attributes) { -%>
8887
<% if (attribute.type === 'relationship') { -%>
89-
import '<%- attribute.relatedCollection.toLowerCase() %>.dart';
88+
import '<%- toSnakeCase(attribute.relatedCollection) %>.dart';
9089
9190
<% } -%>
9291
<% } -%>
@@ -103,33 +102,19 @@ enum <%- toPascalCase(attribute.key) %> {
103102
104103
<% } -%>
105104
<% } -%>
106-
class <%= toPascalCase(collection.name) %> extends Document {
105+
class <%= toPascalCase(collection.name) %> {
107106
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
108107
<%- getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
109108
<% } -%>
110109
111110
<%= toPascalCase(collection.name) %>({
112-
required super.$id,
113-
required super.$collectionId,
114-
required super.$databaseId,
115-
required super.$createdAt,
116-
required super.$updatedAt,
117-
required super.$permissions,
118-
required super.data,
119111
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
120112
<% if (attribute.required) { %>required <% } %>this.<%= strict ? toCamelCase(attribute.key) : attribute.key %><% if (index < collection.attributes.length - 1) { %>,<% } %>
121113
<% } -%>
122114
});
123115
124116
factory <%= toPascalCase(collection.name) %>.fromMap(Map<String, dynamic> map) {
125117
return <%= toPascalCase(collection.name) %>(
126-
$id: map['\\$id'].toString(),
127-
$collectionId: map['\\$collectionId'].toString(),
128-
$databaseId: map['\\$databaseId'].toString(),
129-
$createdAt: map['\\$createdAt'].toString(),
130-
$updatedAt: map['\\$updatedAt'].toString(),
131-
$permissions: List<String>.from(map['\\$permissions'] ?? []),
132-
data: map,
133118
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
134119
<%= strict ? toCamelCase(attribute.key) : attribute.key %>: <% if (attribute.type === 'string' || attribute.type === 'email' || attribute.type === 'datetime') { -%>
135120
<% if (attribute.format === 'enum') { -%>
@@ -180,12 +165,6 @@ map['<%= attribute.key %>'] != null ? <%- toPascalCase(attribute.relatedCollecti
180165
181166
Map<String, dynamic> toMap() {
182167
return {
183-
"\\$id": $id,
184-
"\\$collectionId": $collectionId,
185-
"\\$databaseId": $databaseId,
186-
"\\$createdAt": $createdAt,
187-
"\\$updatedAt": $updatedAt,
188-
"\\$permissions": $permissions,
189168
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
190169
"<%= attribute.key %>": <% if (attribute.type === 'relationship') { -%>
191170
<% if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') { -%>

lib/type-generation/languages/java.js

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Java extends LanguageMeta {
5050
* You can regenerate it by running \`appwrite types -l java ${this.getCurrentDirectory()}\`.
5151
*/
5252
53-
import java.util.*;
53+
import java.util.Objects;
5454
<% for (const attribute of collection.attributes) { -%>
5555
<% if (attribute.type === 'relationship') { -%>
5656
import io.appwrite.models.<%- toPascalCase(attribute.relatedCollection) %>;
@@ -61,63 +61,63 @@ 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(attribute.key) %> {
6565
<% for (const [index, element] of Object.entries(attribute.elements)) { -%>
66-
<%- strict ? toSnakeCase(element) : element %><%- index < attribute.elements.length - 1 ? ',' : ';' %>
66+
<%- strict ? toUpperSnakeCase(element) : element %><%- index < attribute.elements.length - 1 ? ',' : ';' %>
6767
<% } -%>
68-
}
68+
}
6969
7070
<% } -%>
7171
<% } -%>
7272
<% for (const attribute of collection.attributes) { -%>
73-
private <%- getType(attribute) %> <%- strict ? toCamelCase(attribute.key) : attribute.key %>;
73+
private <%- getType(attribute) %> <%- strict ? toCamelCase(attribute.key) : attribute.key %>;
7474
<% } -%>
7575
76-
public <%- toPascalCase(collection.name) %>() {
77-
}
76+
public <%- toPascalCase(collection.name) %>() {
77+
}
7878
79-
public <%- toPascalCase(collection.name) %>(
79+
public <%- toPascalCase(collection.name) %>(
8080
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
81-
<%- getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %><%- index < collection.attributes.length - 1 ? ',' : '' %>
81+
<%- getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %><%- index < collection.attributes.length - 1 ? ',' : '' %>
8282
<% } -%>
83-
) {
83+
) {
8484
<% for (const attribute of collection.attributes) { -%>
85-
this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
85+
this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
8686
<% } -%>
87-
}
87+
}
8888
8989
<% for (const attribute of collection.attributes) { -%>
90-
public <%- getType(attribute) %> get<%- toPascalCase(attribute.key) %>() {
91-
return <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
92-
}
90+
public <%- getType(attribute) %> get<%- toPascalCase(attribute.key) %>() {
91+
return <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
92+
}
9393
94-
public void set<%- toPascalCase(attribute.key) %>(<%- getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>) {
95-
this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
96-
}
94+
public void set<%- toPascalCase(attribute.key) %>(<%- getType(attribute) %> <%= strict ? toCamelCase(attribute.key) : attribute.key %>) {
95+
this.<%= strict ? toCamelCase(attribute.key) : attribute.key %> = <%= strict ? toCamelCase(attribute.key) : attribute.key %>;
96+
}
9797
9898
<% } -%>
99-
@Override
100-
public boolean equals(Object obj) {
101-
if (this == obj) return true;
102-
if (obj == null || getClass() != obj.getClass()) return false;
103-
<%- toPascalCase(collection.name) %> that = (<%- toPascalCase(collection.name) %>) obj;
104-
return <% collection.attributes.forEach((attr, index) => { %>Objects.equals(<%= toCamelCase(attr.key) %>, that.<%= toCamelCase(attr.key) %>)<% if (index < collection.attributes.length - 1) { %> &&
99+
@Override
100+
public boolean equals(Object obj) {
101+
if (this == obj) return true;
102+
if (obj == null || getClass() != obj.getClass()) return false;
103+
<%- toPascalCase(collection.name) %> that = (<%- toPascalCase(collection.name) %>) obj;
104+
return <% collection.attributes.forEach((attr, index) => { %>Objects.equals(<%= toCamelCase(attr.key) %>, that.<%= toCamelCase(attr.key) %>)<% if (index < collection.attributes.length - 1) { %> &&
105105
<% } }); %>;
106-
}
106+
}
107107
108-
@Override
109-
public int hashCode() {
110-
return Objects.hash(<%= collection.attributes.map(attr => toCamelCase(attr.key)).join(', ') %>);
111-
}
108+
@Override
109+
public int hashCode() {
110+
return Objects.hash(<%= collection.attributes.map(attr => toCamelCase(attr.key)).join(', ') %>);
111+
}
112112
113-
@Override
114-
public String toString() {
115-
return "<%- toPascalCase(collection.name) %>{" +
116-
<% for (const attribute of collection.attributes) { -%>
117-
"<%= strict ? toCamelCase(attribute.key) : attribute.key %>=" + <%= strict ? toCamelCase(attribute.key) : attribute.key %> +
113+
@Override
114+
public String toString() {
115+
return "<%- toPascalCase(collection.name) %>{" +
116+
<% for (const [index, attribute] of Object.entries(collection.attributes)) { -%>
117+
"<%= strict ? toCamelCase(attribute.key) : attribute.key %>=" + <%= strict ? toCamelCase(attribute.key) : attribute.key %> +<% if (index < collection.attributes.length - 1) { %> ", " +<% } %>
118118
<% } -%>
119-
'}';
120-
}
119+
'}';
120+
}
121121
}
122122
`;
123123
}

lib/type-generation/languages/javascript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class JavaScript extends LanguageMeta {
4141
type += "[]";
4242
}
4343
if (!attribute.required && attribute.default === null) {
44-
type += "|null";
44+
type += " | null";
4545
}
4646
return type;
4747
}

0 commit comments

Comments
 (0)