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