appwrite-cli 11.0.0 → 11.1.1

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.
@@ -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 <%- strict ? toUpperSnakeCase(element) : element %> = '<%- element %>';
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": "11.0.0",
5
+ "version": "11.1.1",
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": "11.0.0",
3
+ "version": "11.1.1",
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/11.0.0/appwrite-cli-win-x64.exe",
9
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.1/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/11.0.0/appwrite-cli-win-arm64.exe",
18
+ "url": "https://github.com/appwrite/sdk-for-cli/releases/download/11.1.1/appwrite-cli-win-arm64.exe",
19
19
  "bin": [
20
20
  [
21
21
  "appwrite-cli-win-arm64.exe",