@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,604 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * CLI commands for ResourceModule
5
+ * @generated by @constructive-io/graphql-codegen
6
+ * DO NOT EDIT - changes will be overwritten
7
+ */
8
+ const inquirerer_1 = require("inquirerer");
9
+ const executor_1 = require("../executor");
10
+ const utils_1 = require("../utils");
11
+ const fieldSchema = {
12
+ id: 'uuid',
13
+ databaseId: 'uuid',
14
+ schemaId: 'uuid',
15
+ privateSchemaId: 'uuid',
16
+ publicSchemaName: 'string',
17
+ privateSchemaName: 'string',
18
+ resourcesTableId: 'uuid',
19
+ resourceEventsTableId: 'uuid',
20
+ resourcesTableName: 'string',
21
+ resourceEventsTableName: 'string',
22
+ apiName: 'string',
23
+ privateApiName: 'string',
24
+ scope: 'string',
25
+ prefix: 'string',
26
+ entityTableId: 'uuid',
27
+ namespaceModuleId: 'uuid',
28
+ policies: 'json',
29
+ provisions: 'json',
30
+ defaultPermissions: 'string',
31
+ };
32
+ const usage = '\nresource-module <command>\n\nCommands:\n list List resourceModule records\n find-first Find first matching resourceModule record\n get Get a resourceModule by ID\n create Create a new resourceModule\n update Update an existing resourceModule\n delete Delete a resourceModule\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';
33
+ exports.default = async (argv, prompter, _options) => {
34
+ if (argv.help || argv.h) {
35
+ console.log(usage);
36
+ process.exit(0);
37
+ }
38
+ const { first: subcommand, newArgv } = (0, inquirerer_1.extractFirst)(argv);
39
+ if (!subcommand) {
40
+ const answer = await prompter.prompt(argv, [
41
+ {
42
+ type: 'autocomplete',
43
+ name: 'subcommand',
44
+ message: 'What do you want to do?',
45
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
46
+ },
47
+ ]);
48
+ return handleTableSubcommand(answer.subcommand, newArgv, prompter);
49
+ }
50
+ return handleTableSubcommand(subcommand, newArgv, prompter);
51
+ };
52
+ async function handleTableSubcommand(subcommand, argv, prompter) {
53
+ switch (subcommand) {
54
+ case 'list':
55
+ return handleList(argv, prompter);
56
+ case 'find-first':
57
+ return handleFindFirst(argv, prompter);
58
+ case 'get':
59
+ return handleGet(argv, prompter);
60
+ case 'create':
61
+ return handleCreate(argv, prompter);
62
+ case 'update':
63
+ return handleUpdate(argv, prompter);
64
+ case 'delete':
65
+ return handleDelete(argv, prompter);
66
+ default:
67
+ console.log(usage);
68
+ process.exit(1);
69
+ }
70
+ }
71
+ async function handleList(argv, _prompter) {
72
+ try {
73
+ const defaultSelect = {
74
+ id: true,
75
+ databaseId: true,
76
+ schemaId: true,
77
+ privateSchemaId: true,
78
+ publicSchemaName: true,
79
+ privateSchemaName: true,
80
+ resourcesTableId: true,
81
+ resourceEventsTableId: true,
82
+ resourcesTableName: true,
83
+ resourceEventsTableName: true,
84
+ apiName: true,
85
+ privateApiName: true,
86
+ scope: true,
87
+ prefix: true,
88
+ entityTableId: true,
89
+ namespaceModuleId: true,
90
+ policies: true,
91
+ provisions: true,
92
+ defaultPermissions: true,
93
+ };
94
+ const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
95
+ const client = (0, executor_1.getClient)();
96
+ const result = await client.resourceModule.findMany(findManyArgs).execute();
97
+ console.log(JSON.stringify(result, null, 2));
98
+ }
99
+ catch (error) {
100
+ console.error('Failed to list records.');
101
+ if (error instanceof Error) {
102
+ console.error(error.message);
103
+ }
104
+ process.exit(1);
105
+ }
106
+ }
107
+ async function handleFindFirst(argv, _prompter) {
108
+ try {
109
+ const defaultSelect = {
110
+ id: true,
111
+ databaseId: true,
112
+ schemaId: true,
113
+ privateSchemaId: true,
114
+ publicSchemaName: true,
115
+ privateSchemaName: true,
116
+ resourcesTableId: true,
117
+ resourceEventsTableId: true,
118
+ resourcesTableName: true,
119
+ resourceEventsTableName: true,
120
+ apiName: true,
121
+ privateApiName: true,
122
+ scope: true,
123
+ prefix: true,
124
+ entityTableId: true,
125
+ namespaceModuleId: true,
126
+ policies: true,
127
+ provisions: true,
128
+ defaultPermissions: true,
129
+ };
130
+ const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
131
+ const client = (0, executor_1.getClient)();
132
+ const result = await client.resourceModule.findFirst(findFirstArgs).execute();
133
+ console.log(JSON.stringify(result, null, 2));
134
+ }
135
+ catch (error) {
136
+ console.error('Failed to find record.');
137
+ if (error instanceof Error) {
138
+ console.error(error.message);
139
+ }
140
+ process.exit(1);
141
+ }
142
+ }
143
+ async function handleGet(argv, prompter) {
144
+ try {
145
+ const answers = await prompter.prompt(argv, [
146
+ {
147
+ type: 'text',
148
+ name: 'id',
149
+ message: 'id',
150
+ required: true,
151
+ },
152
+ ]);
153
+ const client = (0, executor_1.getClient)();
154
+ const result = await client.resourceModule
155
+ .findOne({
156
+ id: answers.id,
157
+ select: {
158
+ id: true,
159
+ databaseId: true,
160
+ schemaId: true,
161
+ privateSchemaId: true,
162
+ publicSchemaName: true,
163
+ privateSchemaName: true,
164
+ resourcesTableId: true,
165
+ resourceEventsTableId: true,
166
+ resourcesTableName: true,
167
+ resourceEventsTableName: true,
168
+ apiName: true,
169
+ privateApiName: true,
170
+ scope: true,
171
+ prefix: true,
172
+ entityTableId: true,
173
+ namespaceModuleId: true,
174
+ policies: true,
175
+ provisions: true,
176
+ defaultPermissions: true,
177
+ },
178
+ })
179
+ .execute();
180
+ console.log(JSON.stringify(result, null, 2));
181
+ }
182
+ catch (error) {
183
+ console.error('Record not found.');
184
+ if (error instanceof Error) {
185
+ console.error(error.message);
186
+ }
187
+ process.exit(1);
188
+ }
189
+ }
190
+ async function handleCreate(argv, prompter) {
191
+ try {
192
+ const rawAnswers = await prompter.prompt(argv, [
193
+ {
194
+ type: 'text',
195
+ name: 'databaseId',
196
+ message: 'databaseId',
197
+ required: true,
198
+ },
199
+ {
200
+ type: 'text',
201
+ name: 'schemaId',
202
+ message: 'schemaId',
203
+ required: false,
204
+ skipPrompt: true,
205
+ },
206
+ {
207
+ type: 'text',
208
+ name: 'privateSchemaId',
209
+ message: 'privateSchemaId',
210
+ required: false,
211
+ skipPrompt: true,
212
+ },
213
+ {
214
+ type: 'text',
215
+ name: 'publicSchemaName',
216
+ message: 'publicSchemaName',
217
+ required: false,
218
+ skipPrompt: true,
219
+ },
220
+ {
221
+ type: 'text',
222
+ name: 'privateSchemaName',
223
+ message: 'privateSchemaName',
224
+ required: false,
225
+ skipPrompt: true,
226
+ },
227
+ {
228
+ type: 'text',
229
+ name: 'resourcesTableId',
230
+ message: 'resourcesTableId',
231
+ required: false,
232
+ skipPrompt: true,
233
+ },
234
+ {
235
+ type: 'text',
236
+ name: 'resourceEventsTableId',
237
+ message: 'resourceEventsTableId',
238
+ required: false,
239
+ skipPrompt: true,
240
+ },
241
+ {
242
+ type: 'text',
243
+ name: 'resourcesTableName',
244
+ message: 'resourcesTableName',
245
+ required: false,
246
+ skipPrompt: true,
247
+ },
248
+ {
249
+ type: 'text',
250
+ name: 'resourceEventsTableName',
251
+ message: 'resourceEventsTableName',
252
+ required: false,
253
+ skipPrompt: true,
254
+ },
255
+ {
256
+ type: 'text',
257
+ name: 'apiName',
258
+ message: 'apiName',
259
+ required: false,
260
+ skipPrompt: true,
261
+ },
262
+ {
263
+ type: 'text',
264
+ name: 'privateApiName',
265
+ message: 'privateApiName',
266
+ required: false,
267
+ skipPrompt: true,
268
+ },
269
+ {
270
+ type: 'text',
271
+ name: 'scope',
272
+ message: 'scope',
273
+ required: false,
274
+ skipPrompt: true,
275
+ },
276
+ {
277
+ type: 'text',
278
+ name: 'prefix',
279
+ message: 'prefix',
280
+ required: false,
281
+ skipPrompt: true,
282
+ },
283
+ {
284
+ type: 'text',
285
+ name: 'entityTableId',
286
+ message: 'entityTableId',
287
+ required: false,
288
+ skipPrompt: true,
289
+ },
290
+ {
291
+ type: 'text',
292
+ name: 'namespaceModuleId',
293
+ message: 'namespaceModuleId',
294
+ required: false,
295
+ skipPrompt: true,
296
+ },
297
+ {
298
+ type: 'json',
299
+ name: 'policies',
300
+ message: 'policies',
301
+ required: false,
302
+ skipPrompt: true,
303
+ },
304
+ {
305
+ type: 'json',
306
+ name: 'provisions',
307
+ message: 'provisions',
308
+ required: false,
309
+ skipPrompt: true,
310
+ },
311
+ {
312
+ type: 'text',
313
+ name: 'defaultPermissions',
314
+ message: 'defaultPermissions',
315
+ required: false,
316
+ skipPrompt: true,
317
+ },
318
+ ]);
319
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
320
+ const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
321
+ const client = (0, executor_1.getClient)();
322
+ const result = await client.resourceModule
323
+ .create({
324
+ data: {
325
+ databaseId: cleanedData.databaseId,
326
+ schemaId: cleanedData.schemaId,
327
+ privateSchemaId: cleanedData.privateSchemaId,
328
+ publicSchemaName: cleanedData.publicSchemaName,
329
+ privateSchemaName: cleanedData.privateSchemaName,
330
+ resourcesTableId: cleanedData.resourcesTableId,
331
+ resourceEventsTableId: cleanedData.resourceEventsTableId,
332
+ resourcesTableName: cleanedData.resourcesTableName,
333
+ resourceEventsTableName: cleanedData.resourceEventsTableName,
334
+ apiName: cleanedData.apiName,
335
+ privateApiName: cleanedData.privateApiName,
336
+ scope: cleanedData.scope,
337
+ prefix: cleanedData.prefix,
338
+ entityTableId: cleanedData.entityTableId,
339
+ namespaceModuleId: cleanedData.namespaceModuleId,
340
+ policies: cleanedData.policies,
341
+ provisions: cleanedData.provisions,
342
+ defaultPermissions: cleanedData.defaultPermissions,
343
+ },
344
+ select: {
345
+ id: true,
346
+ databaseId: true,
347
+ schemaId: true,
348
+ privateSchemaId: true,
349
+ publicSchemaName: true,
350
+ privateSchemaName: true,
351
+ resourcesTableId: true,
352
+ resourceEventsTableId: true,
353
+ resourcesTableName: true,
354
+ resourceEventsTableName: true,
355
+ apiName: true,
356
+ privateApiName: true,
357
+ scope: true,
358
+ prefix: true,
359
+ entityTableId: true,
360
+ namespaceModuleId: true,
361
+ policies: true,
362
+ provisions: true,
363
+ defaultPermissions: true,
364
+ },
365
+ })
366
+ .execute();
367
+ console.log(JSON.stringify(result, null, 2));
368
+ }
369
+ catch (error) {
370
+ console.error('Failed to create record.');
371
+ if (error instanceof Error) {
372
+ console.error(error.message);
373
+ }
374
+ process.exit(1);
375
+ }
376
+ }
377
+ async function handleUpdate(argv, prompter) {
378
+ try {
379
+ const rawAnswers = await prompter.prompt(argv, [
380
+ {
381
+ type: 'text',
382
+ name: 'id',
383
+ message: 'id',
384
+ required: true,
385
+ },
386
+ {
387
+ type: 'text',
388
+ name: 'databaseId',
389
+ message: 'databaseId',
390
+ required: false,
391
+ },
392
+ {
393
+ type: 'text',
394
+ name: 'schemaId',
395
+ message: 'schemaId',
396
+ required: false,
397
+ skipPrompt: true,
398
+ },
399
+ {
400
+ type: 'text',
401
+ name: 'privateSchemaId',
402
+ message: 'privateSchemaId',
403
+ required: false,
404
+ skipPrompt: true,
405
+ },
406
+ {
407
+ type: 'text',
408
+ name: 'publicSchemaName',
409
+ message: 'publicSchemaName',
410
+ required: false,
411
+ skipPrompt: true,
412
+ },
413
+ {
414
+ type: 'text',
415
+ name: 'privateSchemaName',
416
+ message: 'privateSchemaName',
417
+ required: false,
418
+ skipPrompt: true,
419
+ },
420
+ {
421
+ type: 'text',
422
+ name: 'resourcesTableId',
423
+ message: 'resourcesTableId',
424
+ required: false,
425
+ skipPrompt: true,
426
+ },
427
+ {
428
+ type: 'text',
429
+ name: 'resourceEventsTableId',
430
+ message: 'resourceEventsTableId',
431
+ required: false,
432
+ skipPrompt: true,
433
+ },
434
+ {
435
+ type: 'text',
436
+ name: 'resourcesTableName',
437
+ message: 'resourcesTableName',
438
+ required: false,
439
+ skipPrompt: true,
440
+ },
441
+ {
442
+ type: 'text',
443
+ name: 'resourceEventsTableName',
444
+ message: 'resourceEventsTableName',
445
+ required: false,
446
+ skipPrompt: true,
447
+ },
448
+ {
449
+ type: 'text',
450
+ name: 'apiName',
451
+ message: 'apiName',
452
+ required: false,
453
+ skipPrompt: true,
454
+ },
455
+ {
456
+ type: 'text',
457
+ name: 'privateApiName',
458
+ message: 'privateApiName',
459
+ required: false,
460
+ skipPrompt: true,
461
+ },
462
+ {
463
+ type: 'text',
464
+ name: 'scope',
465
+ message: 'scope',
466
+ required: false,
467
+ skipPrompt: true,
468
+ },
469
+ {
470
+ type: 'text',
471
+ name: 'prefix',
472
+ message: 'prefix',
473
+ required: false,
474
+ skipPrompt: true,
475
+ },
476
+ {
477
+ type: 'text',
478
+ name: 'entityTableId',
479
+ message: 'entityTableId',
480
+ required: false,
481
+ skipPrompt: true,
482
+ },
483
+ {
484
+ type: 'text',
485
+ name: 'namespaceModuleId',
486
+ message: 'namespaceModuleId',
487
+ required: false,
488
+ skipPrompt: true,
489
+ },
490
+ {
491
+ type: 'json',
492
+ name: 'policies',
493
+ message: 'policies',
494
+ required: false,
495
+ skipPrompt: true,
496
+ },
497
+ {
498
+ type: 'json',
499
+ name: 'provisions',
500
+ message: 'provisions',
501
+ required: false,
502
+ skipPrompt: true,
503
+ },
504
+ {
505
+ type: 'text',
506
+ name: 'defaultPermissions',
507
+ message: 'defaultPermissions',
508
+ required: false,
509
+ skipPrompt: true,
510
+ },
511
+ ]);
512
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
513
+ const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
514
+ const client = (0, executor_1.getClient)();
515
+ const result = await client.resourceModule
516
+ .update({
517
+ where: {
518
+ id: answers.id,
519
+ },
520
+ data: {
521
+ databaseId: cleanedData.databaseId,
522
+ schemaId: cleanedData.schemaId,
523
+ privateSchemaId: cleanedData.privateSchemaId,
524
+ publicSchemaName: cleanedData.publicSchemaName,
525
+ privateSchemaName: cleanedData.privateSchemaName,
526
+ resourcesTableId: cleanedData.resourcesTableId,
527
+ resourceEventsTableId: cleanedData.resourceEventsTableId,
528
+ resourcesTableName: cleanedData.resourcesTableName,
529
+ resourceEventsTableName: cleanedData.resourceEventsTableName,
530
+ apiName: cleanedData.apiName,
531
+ privateApiName: cleanedData.privateApiName,
532
+ scope: cleanedData.scope,
533
+ prefix: cleanedData.prefix,
534
+ entityTableId: cleanedData.entityTableId,
535
+ namespaceModuleId: cleanedData.namespaceModuleId,
536
+ policies: cleanedData.policies,
537
+ provisions: cleanedData.provisions,
538
+ defaultPermissions: cleanedData.defaultPermissions,
539
+ },
540
+ select: {
541
+ id: true,
542
+ databaseId: true,
543
+ schemaId: true,
544
+ privateSchemaId: true,
545
+ publicSchemaName: true,
546
+ privateSchemaName: true,
547
+ resourcesTableId: true,
548
+ resourceEventsTableId: true,
549
+ resourcesTableName: true,
550
+ resourceEventsTableName: true,
551
+ apiName: true,
552
+ privateApiName: true,
553
+ scope: true,
554
+ prefix: true,
555
+ entityTableId: true,
556
+ namespaceModuleId: true,
557
+ policies: true,
558
+ provisions: true,
559
+ defaultPermissions: true,
560
+ },
561
+ })
562
+ .execute();
563
+ console.log(JSON.stringify(result, null, 2));
564
+ }
565
+ catch (error) {
566
+ console.error('Failed to update record.');
567
+ if (error instanceof Error) {
568
+ console.error(error.message);
569
+ }
570
+ process.exit(1);
571
+ }
572
+ }
573
+ async function handleDelete(argv, prompter) {
574
+ try {
575
+ const rawAnswers = await prompter.prompt(argv, [
576
+ {
577
+ type: 'text',
578
+ name: 'id',
579
+ message: 'id',
580
+ required: true,
581
+ },
582
+ ]);
583
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
584
+ const client = (0, executor_1.getClient)();
585
+ const result = await client.resourceModule
586
+ .delete({
587
+ where: {
588
+ id: answers.id,
589
+ },
590
+ select: {
591
+ id: true,
592
+ },
593
+ })
594
+ .execute();
595
+ console.log(JSON.stringify(result, null, 2));
596
+ }
597
+ catch (error) {
598
+ console.error('Failed to delete record.');
599
+ if (error instanceof Error) {
600
+ console.error(error.message);
601
+ }
602
+ process.exit(1);
603
+ }
604
+ }