@constructive-sdk/cli 0.29.1 → 0.29.3

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.
Files changed (199) hide show
  1. package/api/cli/commands/api.js +44 -0
  2. package/api/cli/commands/check-constraint.js +0 -22
  3. package/api/cli/commands/composite-type.js +0 -22
  4. package/api/cli/commands/database-setting.js +44 -0
  5. package/api/cli/commands/domain.js +66 -0
  6. package/api/cli/commands/enum.js +0 -22
  7. package/api/cli/commands/field.js +0 -22
  8. package/api/cli/commands/foreign-key-constraint.js +0 -22
  9. package/api/cli/commands/index.js +0 -22
  10. package/api/cli/commands/policy.js +0 -22
  11. package/api/cli/commands/primary-key-constraint.js +0 -22
  12. package/api/cli/commands/schema.js +0 -22
  13. package/api/cli/commands/site.js +44 -0
  14. package/api/cli/commands/spatial-relation.js +0 -22
  15. package/api/cli/commands/table.js +0 -22
  16. package/api/cli/commands/trigger.js +0 -22
  17. package/api/cli/commands/unique-constraint.js +0 -22
  18. package/api/cli/commands/view.js +0 -22
  19. package/api/orm/input-types.d.ts +144 -171
  20. package/auth/cli/commands/create-org-api-key.d.ts +8 -0
  21. package/auth/cli/commands/create-org-api-key.js +36 -0
  22. package/auth/cli/commands/create-org-principal.d.ts +8 -0
  23. package/auth/cli/commands/create-org-principal.js +36 -0
  24. package/auth/cli/commands/delete-org-principal.d.ts +8 -0
  25. package/auth/cli/commands/delete-org-principal.js +36 -0
  26. package/auth/cli/commands/org-api-key-list.d.ts +8 -0
  27. package/auth/cli/commands/org-api-key-list.js +224 -0
  28. package/auth/cli/commands/principal-entity.d.ts +8 -0
  29. package/auth/cli/commands/principal-entity.js +282 -0
  30. package/auth/cli/commands/principal-scope-override.d.ts +8 -0
  31. package/auth/cli/commands/principal-scope-override.js +171 -0
  32. package/auth/cli/commands/principal.d.ts +8 -0
  33. package/auth/cli/commands/principal.js +171 -0
  34. package/auth/cli/commands/revoke-org-api-key.d.ts +8 -0
  35. package/auth/cli/commands/revoke-org-api-key.js +36 -0
  36. package/auth/cli/commands.js +19 -3
  37. package/auth/cli/executor.d.ts +28 -4
  38. package/auth/orm/index.d.ts +32 -4
  39. package/auth/orm/index.js +8 -0
  40. package/auth/orm/input-types.d.ts +915 -145
  41. package/auth/orm/input-types.js +7 -0
  42. package/auth/orm/models/index.d.ts +4 -0
  43. package/auth/orm/models/index.js +9 -1
  44. package/auth/orm/models/orgApiKeyList.d.ts +36 -0
  45. package/auth/orm/models/orgApiKeyList.js +80 -0
  46. package/auth/orm/models/principal.d.ts +45 -0
  47. package/auth/orm/models/principal.js +93 -0
  48. package/auth/orm/models/principalEntity.d.ts +54 -0
  49. package/auth/orm/models/principalEntity.js +104 -0
  50. package/auth/orm/models/principalScopeOverride.d.ts +36 -0
  51. package/auth/orm/models/principalScopeOverride.js +80 -0
  52. package/auth/orm/mutation/index.d.ts +33 -1
  53. package/auth/orm/mutation/index.js +48 -0
  54. package/auth/orm/query/index.d.ts +4 -4
  55. package/auth/orm/query/index.js +7 -7
  56. package/compute/cli/commands/function-graph-execution.js +0 -22
  57. package/compute/cli/commands/function-graph.js +0 -20
  58. package/compute/cli/commands/platform-namespace-event.d.ts +8 -0
  59. package/compute/cli/commands/platform-namespace-event.js +510 -0
  60. package/compute/cli/commands/platform-namespace.d.ts +8 -0
  61. package/compute/cli/commands/platform-namespace.js +436 -0
  62. package/compute/cli/commands/resource-event.d.ts +8 -0
  63. package/compute/cli/commands/resource-event.js +356 -0
  64. package/compute/cli/commands/resource.d.ts +8 -0
  65. package/compute/cli/commands/resource.js +520 -0
  66. package/compute/cli/commands.js +13 -5
  67. package/compute/cli/executor.d.ts +10 -6
  68. package/compute/orm/index.d.ts +15 -7
  69. package/compute/orm/index.js +10 -2
  70. package/compute/orm/input-types.d.ts +1159 -221
  71. package/compute/orm/input-types.js +4 -0
  72. package/compute/orm/models/index.d.ts +5 -1
  73. package/compute/orm/models/index.js +11 -3
  74. package/compute/orm/models/platformNamespace.d.ts +54 -0
  75. package/compute/orm/models/platformNamespace.js +104 -0
  76. package/compute/orm/models/platformNamespaceEvent.d.ts +56 -0
  77. package/compute/orm/models/platformNamespaceEvent.js +107 -0
  78. package/compute/orm/models/resource.d.ts +54 -0
  79. package/compute/orm/models/resource.js +104 -0
  80. package/compute/orm/models/resourceEvent.d.ts +56 -0
  81. package/compute/orm/models/resourceEvent.js +107 -0
  82. package/compute/orm/mutation/index.d.ts +9 -9
  83. package/compute/orm/mutation/index.js +12 -12
  84. package/esm/api/cli/commands/api.js +44 -0
  85. package/esm/api/cli/commands/check-constraint.js +0 -22
  86. package/esm/api/cli/commands/composite-type.js +0 -22
  87. package/esm/api/cli/commands/database-setting.js +44 -0
  88. package/esm/api/cli/commands/domain.js +66 -0
  89. package/esm/api/cli/commands/enum.js +0 -22
  90. package/esm/api/cli/commands/field.js +0 -22
  91. package/esm/api/cli/commands/foreign-key-constraint.js +0 -22
  92. package/esm/api/cli/commands/index.js +0 -22
  93. package/esm/api/cli/commands/policy.js +0 -22
  94. package/esm/api/cli/commands/primary-key-constraint.js +0 -22
  95. package/esm/api/cli/commands/schema.js +0 -22
  96. package/esm/api/cli/commands/site.js +44 -0
  97. package/esm/api/cli/commands/spatial-relation.js +0 -22
  98. package/esm/api/cli/commands/table.js +0 -22
  99. package/esm/api/cli/commands/trigger.js +0 -22
  100. package/esm/api/cli/commands/unique-constraint.js +0 -22
  101. package/esm/api/cli/commands/view.js +0 -22
  102. package/esm/api/orm/input-types.d.ts +144 -171
  103. package/esm/auth/cli/commands/create-org-api-key.d.ts +8 -0
  104. package/esm/auth/cli/commands/create-org-api-key.js +34 -0
  105. package/esm/auth/cli/commands/create-org-principal.d.ts +8 -0
  106. package/esm/auth/cli/commands/create-org-principal.js +34 -0
  107. package/esm/auth/cli/commands/delete-org-principal.d.ts +8 -0
  108. package/esm/auth/cli/commands/delete-org-principal.js +34 -0
  109. package/esm/auth/cli/commands/org-api-key-list.d.ts +8 -0
  110. package/esm/auth/cli/commands/org-api-key-list.js +222 -0
  111. package/esm/auth/cli/commands/principal-entity.d.ts +8 -0
  112. package/esm/auth/cli/commands/principal-entity.js +280 -0
  113. package/esm/auth/cli/commands/principal-scope-override.d.ts +8 -0
  114. package/esm/auth/cli/commands/principal-scope-override.js +169 -0
  115. package/esm/auth/cli/commands/principal.d.ts +8 -0
  116. package/esm/auth/cli/commands/principal.js +169 -0
  117. package/esm/auth/cli/commands/revoke-org-api-key.d.ts +8 -0
  118. package/esm/auth/cli/commands/revoke-org-api-key.js +34 -0
  119. package/esm/auth/cli/commands.js +19 -3
  120. package/esm/auth/cli/executor.d.ts +28 -4
  121. package/esm/auth/orm/index.d.ts +32 -4
  122. package/esm/auth/orm/index.js +8 -0
  123. package/esm/auth/orm/input-types.d.ts +915 -145
  124. package/esm/auth/orm/input-types.js +7 -0
  125. package/esm/auth/orm/models/index.d.ts +4 -0
  126. package/esm/auth/orm/models/index.js +4 -0
  127. package/esm/auth/orm/models/orgApiKeyList.d.ts +36 -0
  128. package/esm/auth/orm/models/orgApiKeyList.js +76 -0
  129. package/esm/auth/orm/models/principal.d.ts +45 -0
  130. package/esm/auth/orm/models/principal.js +89 -0
  131. package/esm/auth/orm/models/principalEntity.d.ts +54 -0
  132. package/esm/auth/orm/models/principalEntity.js +100 -0
  133. package/esm/auth/orm/models/principalScopeOverride.d.ts +36 -0
  134. package/esm/auth/orm/models/principalScopeOverride.js +76 -0
  135. package/esm/auth/orm/mutation/index.d.ts +33 -1
  136. package/esm/auth/orm/mutation/index.js +48 -0
  137. package/esm/auth/orm/query/index.d.ts +4 -4
  138. package/esm/auth/orm/query/index.js +7 -7
  139. package/esm/compute/cli/commands/function-graph-execution.js +0 -22
  140. package/esm/compute/cli/commands/function-graph.js +0 -20
  141. package/esm/compute/cli/commands/platform-namespace-event.d.ts +8 -0
  142. package/esm/compute/cli/commands/platform-namespace-event.js +508 -0
  143. package/esm/compute/cli/commands/platform-namespace.d.ts +8 -0
  144. package/esm/compute/cli/commands/platform-namespace.js +434 -0
  145. package/esm/compute/cli/commands/resource-event.d.ts +8 -0
  146. package/esm/compute/cli/commands/resource-event.js +354 -0
  147. package/esm/compute/cli/commands/resource.d.ts +8 -0
  148. package/esm/compute/cli/commands/resource.js +518 -0
  149. package/esm/compute/cli/commands.js +13 -5
  150. package/esm/compute/cli/executor.d.ts +10 -6
  151. package/esm/compute/orm/index.d.ts +15 -7
  152. package/esm/compute/orm/index.js +10 -2
  153. package/esm/compute/orm/input-types.d.ts +1159 -221
  154. package/esm/compute/orm/input-types.js +4 -0
  155. package/esm/compute/orm/models/index.d.ts +5 -1
  156. package/esm/compute/orm/models/index.js +5 -1
  157. package/esm/compute/orm/models/platformNamespace.d.ts +54 -0
  158. package/esm/compute/orm/models/platformNamespace.js +100 -0
  159. package/esm/compute/orm/models/platformNamespaceEvent.d.ts +56 -0
  160. package/esm/compute/orm/models/platformNamespaceEvent.js +103 -0
  161. package/esm/compute/orm/models/resource.d.ts +54 -0
  162. package/esm/compute/orm/models/resource.js +100 -0
  163. package/esm/compute/orm/models/resourceEvent.d.ts +56 -0
  164. package/esm/compute/orm/models/resourceEvent.js +103 -0
  165. package/esm/compute/orm/mutation/index.d.ts +9 -9
  166. package/esm/compute/orm/mutation/index.js +12 -12
  167. package/esm/modules/cli/commands/merkle-store-module.js +22 -0
  168. package/esm/modules/cli/commands/principal-auth-module.d.ts +8 -0
  169. package/esm/modules/cli/commands/principal-auth-module.js +580 -0
  170. package/esm/modules/cli/commands/resource-module.d.ts +8 -0
  171. package/esm/modules/cli/commands/resource-module.js +602 -0
  172. package/esm/modules/cli/commands.js +9 -5
  173. package/esm/modules/cli/executor.d.ts +4 -2
  174. package/esm/modules/orm/index.d.ts +8 -4
  175. package/esm/modules/orm/index.js +8 -4
  176. package/esm/modules/orm/input-types.d.ts +868 -411
  177. package/esm/modules/orm/models/index.d.ts +4 -2
  178. package/esm/modules/orm/models/index.js +4 -2
  179. package/esm/modules/orm/models/principalAuthModule.d.ts +54 -0
  180. package/esm/modules/orm/models/principalAuthModule.js +100 -0
  181. package/esm/modules/orm/models/resourceModule.d.ts +54 -0
  182. package/esm/modules/orm/models/resourceModule.js +100 -0
  183. package/modules/cli/commands/merkle-store-module.js +22 -0
  184. package/modules/cli/commands/principal-auth-module.d.ts +8 -0
  185. package/modules/cli/commands/principal-auth-module.js +582 -0
  186. package/modules/cli/commands/resource-module.d.ts +8 -0
  187. package/modules/cli/commands/resource-module.js +604 -0
  188. package/modules/cli/commands.js +9 -5
  189. package/modules/cli/executor.d.ts +4 -2
  190. package/modules/orm/index.d.ts +8 -4
  191. package/modules/orm/index.js +8 -4
  192. package/modules/orm/input-types.d.ts +868 -411
  193. package/modules/orm/models/index.d.ts +4 -2
  194. package/modules/orm/models/index.js +10 -6
  195. package/modules/orm/models/principalAuthModule.d.ts +54 -0
  196. package/modules/orm/models/principalAuthModule.js +104 -0
  197. package/modules/orm/models/resourceModule.d.ts +54 -0
  198. package/modules/orm/models/resourceModule.js +104 -0
  199. package/package.json +5 -5
@@ -0,0 +1,434 @@
1
+ /**
2
+ * CLI commands for PlatformNamespace
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import { extractFirst } from 'inquirerer';
7
+ import { getClient } from '../executor';
8
+ import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
9
+ const fieldSchema = {
10
+ id: 'uuid',
11
+ createdAt: 'string',
12
+ updatedAt: 'string',
13
+ name: 'string',
14
+ namespaceName: 'string',
15
+ description: 'string',
16
+ isActive: 'boolean',
17
+ labels: 'json',
18
+ annotations: 'json',
19
+ databaseId: 'uuid',
20
+ sourceDatabaseId: 'uuid',
21
+ sourceScope: 'string',
22
+ isManaged: 'boolean',
23
+ };
24
+ const usage = '\nplatform-namespace <command>\n\nCommands:\n list List platformNamespace records\n find-first Find first matching platformNamespace record\n get Get a platformNamespace by ID\n create Create a new platformNamespace\n update Update an existing platformNamespace\n delete Delete a platformNamespace\n\nList Options:\n --limit <n> Max number of records to return (forward pagination)\n --last <n> Number of records from the end (backward pagination)\n --after <cursor> Cursor for forward pagination\n --before <cursor> Cursor for backward pagination\n --offset <n> Number of records to skip\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.name.equalTo foo)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\nFind-First Options:\n --select <fields> Comma-separated list of fields to return\n --where.<field>.<op> Filter (dot-notation, e.g. --where.status.equalTo active)\n --condition.<f>.<op> Condition filter (dot-notation)\n --orderBy <values> Comma-separated ordering values (e.g. NAME_ASC,CREATED_AT_DESC)\n\n --help, -h Show this help message\n';
25
+ export default async (argv, prompter, _options) => {
26
+ if (argv.help || argv.h) {
27
+ console.log(usage);
28
+ process.exit(0);
29
+ }
30
+ const { first: subcommand, newArgv } = extractFirst(argv);
31
+ if (!subcommand) {
32
+ const answer = await prompter.prompt(argv, [
33
+ {
34
+ type: 'autocomplete',
35
+ name: 'subcommand',
36
+ message: 'What do you want to do?',
37
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
38
+ },
39
+ ]);
40
+ return handleTableSubcommand(answer.subcommand, newArgv, prompter);
41
+ }
42
+ return handleTableSubcommand(subcommand, newArgv, prompter);
43
+ };
44
+ async function handleTableSubcommand(subcommand, argv, prompter) {
45
+ switch (subcommand) {
46
+ case 'list':
47
+ return handleList(argv, prompter);
48
+ case 'find-first':
49
+ return handleFindFirst(argv, prompter);
50
+ case 'get':
51
+ return handleGet(argv, prompter);
52
+ case 'create':
53
+ return handleCreate(argv, prompter);
54
+ case 'update':
55
+ return handleUpdate(argv, prompter);
56
+ case 'delete':
57
+ return handleDelete(argv, prompter);
58
+ default:
59
+ console.log(usage);
60
+ process.exit(1);
61
+ }
62
+ }
63
+ async function handleList(argv, _prompter) {
64
+ try {
65
+ const defaultSelect = {
66
+ id: true,
67
+ createdAt: true,
68
+ updatedAt: true,
69
+ name: true,
70
+ namespaceName: true,
71
+ description: true,
72
+ isActive: true,
73
+ labels: true,
74
+ annotations: true,
75
+ databaseId: true,
76
+ sourceDatabaseId: true,
77
+ sourceScope: true,
78
+ isManaged: true,
79
+ };
80
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
81
+ const client = getClient();
82
+ const result = await client.platformNamespace.findMany(findManyArgs).execute();
83
+ console.log(JSON.stringify(result, null, 2));
84
+ }
85
+ catch (error) {
86
+ console.error('Failed to list records.');
87
+ if (error instanceof Error) {
88
+ console.error(error.message);
89
+ }
90
+ process.exit(1);
91
+ }
92
+ }
93
+ async function handleFindFirst(argv, _prompter) {
94
+ try {
95
+ const defaultSelect = {
96
+ id: true,
97
+ createdAt: true,
98
+ updatedAt: true,
99
+ name: true,
100
+ namespaceName: true,
101
+ description: true,
102
+ isActive: true,
103
+ labels: true,
104
+ annotations: true,
105
+ databaseId: true,
106
+ sourceDatabaseId: true,
107
+ sourceScope: true,
108
+ isManaged: true,
109
+ };
110
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
111
+ const client = getClient();
112
+ const result = await client.platformNamespace.findFirst(findFirstArgs).execute();
113
+ console.log(JSON.stringify(result, null, 2));
114
+ }
115
+ catch (error) {
116
+ console.error('Failed to find record.');
117
+ if (error instanceof Error) {
118
+ console.error(error.message);
119
+ }
120
+ process.exit(1);
121
+ }
122
+ }
123
+ async function handleGet(argv, prompter) {
124
+ try {
125
+ const answers = await prompter.prompt(argv, [
126
+ {
127
+ type: 'text',
128
+ name: 'id',
129
+ message: 'id',
130
+ required: true,
131
+ },
132
+ ]);
133
+ const client = getClient();
134
+ const result = await client.platformNamespace
135
+ .findOne({
136
+ id: answers.id,
137
+ select: {
138
+ id: true,
139
+ createdAt: true,
140
+ updatedAt: true,
141
+ name: true,
142
+ namespaceName: true,
143
+ description: true,
144
+ isActive: true,
145
+ labels: true,
146
+ annotations: true,
147
+ databaseId: true,
148
+ sourceDatabaseId: true,
149
+ sourceScope: true,
150
+ isManaged: true,
151
+ },
152
+ })
153
+ .execute();
154
+ console.log(JSON.stringify(result, null, 2));
155
+ }
156
+ catch (error) {
157
+ console.error('Record not found.');
158
+ if (error instanceof Error) {
159
+ console.error(error.message);
160
+ }
161
+ process.exit(1);
162
+ }
163
+ }
164
+ async function handleCreate(argv, prompter) {
165
+ try {
166
+ const rawAnswers = await prompter.prompt(argv, [
167
+ {
168
+ type: 'text',
169
+ name: 'name',
170
+ message: 'name',
171
+ required: true,
172
+ },
173
+ {
174
+ type: 'text',
175
+ name: 'namespaceName',
176
+ message: 'namespaceName',
177
+ required: true,
178
+ },
179
+ {
180
+ type: 'text',
181
+ name: 'description',
182
+ message: 'description',
183
+ required: false,
184
+ skipPrompt: true,
185
+ },
186
+ {
187
+ type: 'boolean',
188
+ name: 'isActive',
189
+ message: 'isActive',
190
+ required: false,
191
+ skipPrompt: true,
192
+ },
193
+ {
194
+ type: 'json',
195
+ name: 'labels',
196
+ message: 'labels',
197
+ required: false,
198
+ skipPrompt: true,
199
+ },
200
+ {
201
+ type: 'json',
202
+ name: 'annotations',
203
+ message: 'annotations',
204
+ required: false,
205
+ skipPrompt: true,
206
+ },
207
+ {
208
+ type: 'text',
209
+ name: 'databaseId',
210
+ message: 'databaseId',
211
+ required: true,
212
+ },
213
+ {
214
+ type: 'text',
215
+ name: 'sourceDatabaseId',
216
+ message: 'sourceDatabaseId',
217
+ required: false,
218
+ skipPrompt: true,
219
+ },
220
+ {
221
+ type: 'text',
222
+ name: 'sourceScope',
223
+ message: 'sourceScope',
224
+ required: false,
225
+ skipPrompt: true,
226
+ },
227
+ {
228
+ type: 'boolean',
229
+ name: 'isManaged',
230
+ message: 'isManaged',
231
+ required: false,
232
+ skipPrompt: true,
233
+ },
234
+ ]);
235
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
236
+ const cleanedData = stripUndefined(answers, fieldSchema);
237
+ const client = getClient();
238
+ const result = await client.platformNamespace
239
+ .create({
240
+ data: {
241
+ name: cleanedData.name,
242
+ namespaceName: cleanedData.namespaceName,
243
+ description: cleanedData.description,
244
+ isActive: cleanedData.isActive,
245
+ labels: cleanedData.labels,
246
+ annotations: cleanedData.annotations,
247
+ databaseId: cleanedData.databaseId,
248
+ sourceDatabaseId: cleanedData.sourceDatabaseId,
249
+ sourceScope: cleanedData.sourceScope,
250
+ isManaged: cleanedData.isManaged,
251
+ },
252
+ select: {
253
+ id: true,
254
+ createdAt: true,
255
+ updatedAt: true,
256
+ name: true,
257
+ namespaceName: true,
258
+ description: true,
259
+ isActive: true,
260
+ labels: true,
261
+ annotations: true,
262
+ databaseId: true,
263
+ sourceDatabaseId: true,
264
+ sourceScope: true,
265
+ isManaged: true,
266
+ },
267
+ })
268
+ .execute();
269
+ console.log(JSON.stringify(result, null, 2));
270
+ }
271
+ catch (error) {
272
+ console.error('Failed to create record.');
273
+ if (error instanceof Error) {
274
+ console.error(error.message);
275
+ }
276
+ process.exit(1);
277
+ }
278
+ }
279
+ async function handleUpdate(argv, prompter) {
280
+ try {
281
+ const rawAnswers = await prompter.prompt(argv, [
282
+ {
283
+ type: 'text',
284
+ name: 'id',
285
+ message: 'id',
286
+ required: true,
287
+ },
288
+ {
289
+ type: 'text',
290
+ name: 'name',
291
+ message: 'name',
292
+ required: false,
293
+ },
294
+ {
295
+ type: 'text',
296
+ name: 'namespaceName',
297
+ message: 'namespaceName',
298
+ required: false,
299
+ },
300
+ {
301
+ type: 'text',
302
+ name: 'description',
303
+ message: 'description',
304
+ required: false,
305
+ skipPrompt: true,
306
+ },
307
+ {
308
+ type: 'boolean',
309
+ name: 'isActive',
310
+ message: 'isActive',
311
+ required: false,
312
+ skipPrompt: true,
313
+ },
314
+ {
315
+ type: 'json',
316
+ name: 'labels',
317
+ message: 'labels',
318
+ required: false,
319
+ skipPrompt: true,
320
+ },
321
+ {
322
+ type: 'json',
323
+ name: 'annotations',
324
+ message: 'annotations',
325
+ required: false,
326
+ skipPrompt: true,
327
+ },
328
+ {
329
+ type: 'text',
330
+ name: 'databaseId',
331
+ message: 'databaseId',
332
+ required: false,
333
+ },
334
+ {
335
+ type: 'text',
336
+ name: 'sourceDatabaseId',
337
+ message: 'sourceDatabaseId',
338
+ required: false,
339
+ skipPrompt: true,
340
+ },
341
+ {
342
+ type: 'text',
343
+ name: 'sourceScope',
344
+ message: 'sourceScope',
345
+ required: false,
346
+ skipPrompt: true,
347
+ },
348
+ {
349
+ type: 'boolean',
350
+ name: 'isManaged',
351
+ message: 'isManaged',
352
+ required: false,
353
+ skipPrompt: true,
354
+ },
355
+ ]);
356
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
357
+ const cleanedData = stripUndefined(answers, fieldSchema);
358
+ const client = getClient();
359
+ const result = await client.platformNamespace
360
+ .update({
361
+ where: {
362
+ id: answers.id,
363
+ },
364
+ data: {
365
+ name: cleanedData.name,
366
+ namespaceName: cleanedData.namespaceName,
367
+ description: cleanedData.description,
368
+ isActive: cleanedData.isActive,
369
+ labels: cleanedData.labels,
370
+ annotations: cleanedData.annotations,
371
+ databaseId: cleanedData.databaseId,
372
+ sourceDatabaseId: cleanedData.sourceDatabaseId,
373
+ sourceScope: cleanedData.sourceScope,
374
+ isManaged: cleanedData.isManaged,
375
+ },
376
+ select: {
377
+ id: true,
378
+ createdAt: true,
379
+ updatedAt: true,
380
+ name: true,
381
+ namespaceName: true,
382
+ description: true,
383
+ isActive: true,
384
+ labels: true,
385
+ annotations: true,
386
+ databaseId: true,
387
+ sourceDatabaseId: true,
388
+ sourceScope: true,
389
+ isManaged: true,
390
+ },
391
+ })
392
+ .execute();
393
+ console.log(JSON.stringify(result, null, 2));
394
+ }
395
+ catch (error) {
396
+ console.error('Failed to update record.');
397
+ if (error instanceof Error) {
398
+ console.error(error.message);
399
+ }
400
+ process.exit(1);
401
+ }
402
+ }
403
+ async function handleDelete(argv, prompter) {
404
+ try {
405
+ const rawAnswers = await prompter.prompt(argv, [
406
+ {
407
+ type: 'text',
408
+ name: 'id',
409
+ message: 'id',
410
+ required: true,
411
+ },
412
+ ]);
413
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
414
+ const client = getClient();
415
+ const result = await client.platformNamespace
416
+ .delete({
417
+ where: {
418
+ id: answers.id,
419
+ },
420
+ select: {
421
+ id: true,
422
+ },
423
+ })
424
+ .execute();
425
+ console.log(JSON.stringify(result, null, 2));
426
+ }
427
+ catch (error) {
428
+ console.error('Failed to delete record.');
429
+ if (error instanceof Error) {
430
+ console.error(error.message);
431
+ }
432
+ process.exit(1);
433
+ }
434
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI commands for ResourceEvent
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import { CLIOptions, Inquirerer } from 'inquirerer';
7
+ declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
8
+ export default _default;