@constructive-sdk/cli 0.29.1 → 0.29.2

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