@constructive-sdk/cli 0.25.9 → 0.25.11

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 (229) hide show
  1. package/admin/cli/commands/app-admin-grant.js +3 -1
  2. package/admin/cli/commands/app-grant.js +3 -1
  3. package/admin/cli/commands/app-invite.js +44 -0
  4. package/admin/cli/commands/app-owner-grant.js +3 -1
  5. package/admin/cli/commands/app-permission-default-grant.d.ts +8 -0
  6. package/admin/cli/commands/app-permission-default-grant.js +286 -0
  7. package/admin/cli/commands/app-permission-default-permission.d.ts +8 -0
  8. package/admin/cli/commands/app-permission-default-permission.js +242 -0
  9. package/admin/cli/commands/org-admin-grant.js +3 -1
  10. package/admin/cli/commands/org-grant.js +3 -1
  11. package/admin/cli/commands/org-invite.js +44 -0
  12. package/admin/cli/commands/org-owner-grant.js +3 -1
  13. package/admin/cli/commands/org-permission-default-grant.d.ts +8 -0
  14. package/admin/cli/commands/org-permission-default-grant.js +306 -0
  15. package/admin/cli/commands/org-permission-default-permission.d.ts +8 -0
  16. package/admin/cli/commands/org-permission-default-permission.js +262 -0
  17. package/admin/cli/commands.js +11 -3
  18. package/admin/cli/executor.d.ts +5 -1
  19. package/admin/orm/index.d.ts +10 -2
  20. package/admin/orm/index.js +10 -2
  21. package/admin/orm/input-types.d.ts +1611 -230
  22. package/admin/orm/input-types.js +9 -1
  23. package/admin/orm/models/appPermissionDefaultGrant.d.ts +54 -0
  24. package/admin/orm/models/appPermissionDefaultGrant.js +104 -0
  25. package/admin/orm/models/appPermissionDefaultPermission.d.ts +54 -0
  26. package/admin/orm/models/appPermissionDefaultPermission.js +104 -0
  27. package/admin/orm/models/index.d.ts +5 -1
  28. package/admin/orm/models/index.js +11 -3
  29. package/admin/orm/models/orgPermissionDefaultGrant.d.ts +54 -0
  30. package/admin/orm/models/orgPermissionDefaultGrant.js +104 -0
  31. package/admin/orm/models/orgPermissionDefaultPermission.d.ts +54 -0
  32. package/admin/orm/models/orgPermissionDefaultPermission.js +104 -0
  33. package/agent/cli/commands/agent-message.js +34 -12
  34. package/agent/cli/commands/agent-task.js +12 -12
  35. package/agent/cli/embedder.d.ts +5 -0
  36. package/agent/cli/embedder.js +46 -9
  37. package/agent/orm/input-types.d.ts +289 -47
  38. package/agent/orm/input-types.js +1 -0
  39. package/api/cli/commands/check-constraint.js +0 -22
  40. package/api/cli/commands/composite-type.d.ts +8 -0
  41. package/api/cli/commands/composite-type.js +424 -0
  42. package/api/cli/commands/enum.js +0 -22
  43. package/api/cli/commands/field.js +0 -22
  44. package/api/cli/commands/foreign-key-constraint.js +0 -22
  45. package/api/cli/commands/index.js +0 -22
  46. package/api/cli/commands/policy.js +0 -22
  47. package/api/cli/commands/primary-key-constraint.js +0 -22
  48. package/api/cli/commands/schema.js +0 -22
  49. package/api/cli/commands/spatial-relation.js +0 -22
  50. package/api/cli/commands/table.js +6 -28
  51. package/api/cli/commands/trigger.js +0 -22
  52. package/api/cli/commands/unique-constraint.js +0 -22
  53. package/api/cli/commands/view-table.js +22 -0
  54. package/api/cli/commands/view.js +0 -22
  55. package/api/cli/commands.js +3 -1
  56. package/api/cli/executor.d.ts +1 -0
  57. package/api/orm/index.d.ts +2 -0
  58. package/api/orm/index.js +2 -0
  59. package/api/orm/input-types.d.ts +1064 -125
  60. package/api/orm/input-types.js +3 -0
  61. package/api/orm/models/compositeType.d.ts +54 -0
  62. package/api/orm/models/compositeType.js +104 -0
  63. package/api/orm/models/index.d.ts +1 -0
  64. package/api/orm/models/index.js +3 -1
  65. package/auth/cli/commands/link-identity.d.ts +8 -0
  66. package/auth/cli/commands/link-identity.js +36 -0
  67. package/auth/cli/commands/sign-in-sms-otp.d.ts +8 -0
  68. package/auth/cli/commands/sign-in-sms-otp.js +36 -0
  69. package/auth/cli/commands/sign-up-sms.d.ts +8 -0
  70. package/auth/cli/commands/sign-up-sms.js +36 -0
  71. package/auth/cli/commands.js +7 -1
  72. package/auth/cli/executor.d.ts +15 -0
  73. package/auth/orm/index.d.ts +15 -0
  74. package/auth/orm/input-types.d.ts +197 -1
  75. package/auth/orm/mutation/index.d.ts +25 -1
  76. package/auth/orm/mutation/index.js +36 -0
  77. package/esm/admin/cli/commands/app-admin-grant.js +3 -1
  78. package/esm/admin/cli/commands/app-grant.js +3 -1
  79. package/esm/admin/cli/commands/app-invite.js +44 -0
  80. package/esm/admin/cli/commands/app-owner-grant.js +3 -1
  81. package/esm/admin/cli/commands/app-permission-default-grant.d.ts +8 -0
  82. package/esm/admin/cli/commands/app-permission-default-grant.js +284 -0
  83. package/esm/admin/cli/commands/app-permission-default-permission.d.ts +8 -0
  84. package/esm/admin/cli/commands/app-permission-default-permission.js +240 -0
  85. package/esm/admin/cli/commands/org-admin-grant.js +3 -1
  86. package/esm/admin/cli/commands/org-grant.js +3 -1
  87. package/esm/admin/cli/commands/org-invite.js +44 -0
  88. package/esm/admin/cli/commands/org-owner-grant.js +3 -1
  89. package/esm/admin/cli/commands/org-permission-default-grant.d.ts +8 -0
  90. package/esm/admin/cli/commands/org-permission-default-grant.js +304 -0
  91. package/esm/admin/cli/commands/org-permission-default-permission.d.ts +8 -0
  92. package/esm/admin/cli/commands/org-permission-default-permission.js +260 -0
  93. package/esm/admin/cli/commands.js +11 -3
  94. package/esm/admin/cli/executor.d.ts +5 -1
  95. package/esm/admin/orm/index.d.ts +10 -2
  96. package/esm/admin/orm/index.js +10 -2
  97. package/esm/admin/orm/input-types.d.ts +1611 -230
  98. package/esm/admin/orm/input-types.js +9 -1
  99. package/esm/admin/orm/models/appPermissionDefaultGrant.d.ts +54 -0
  100. package/esm/admin/orm/models/appPermissionDefaultGrant.js +100 -0
  101. package/esm/admin/orm/models/appPermissionDefaultPermission.d.ts +54 -0
  102. package/esm/admin/orm/models/appPermissionDefaultPermission.js +100 -0
  103. package/esm/admin/orm/models/index.d.ts +5 -1
  104. package/esm/admin/orm/models/index.js +5 -1
  105. package/esm/admin/orm/models/orgPermissionDefaultGrant.d.ts +54 -0
  106. package/esm/admin/orm/models/orgPermissionDefaultGrant.js +100 -0
  107. package/esm/admin/orm/models/orgPermissionDefaultPermission.d.ts +54 -0
  108. package/esm/admin/orm/models/orgPermissionDefaultPermission.js +100 -0
  109. package/esm/agent/cli/commands/agent-message.js +34 -12
  110. package/esm/agent/cli/commands/agent-task.js +12 -12
  111. package/esm/agent/cli/embedder.d.ts +5 -0
  112. package/esm/agent/cli/embedder.js +10 -2
  113. package/esm/agent/orm/input-types.d.ts +289 -47
  114. package/esm/agent/orm/input-types.js +1 -0
  115. package/esm/api/cli/commands/check-constraint.js +0 -22
  116. package/esm/api/cli/commands/composite-type.d.ts +8 -0
  117. package/esm/api/cli/commands/composite-type.js +422 -0
  118. package/esm/api/cli/commands/enum.js +0 -22
  119. package/esm/api/cli/commands/field.js +0 -22
  120. package/esm/api/cli/commands/foreign-key-constraint.js +0 -22
  121. package/esm/api/cli/commands/index.js +0 -22
  122. package/esm/api/cli/commands/policy.js +0 -22
  123. package/esm/api/cli/commands/primary-key-constraint.js +0 -22
  124. package/esm/api/cli/commands/schema.js +0 -22
  125. package/esm/api/cli/commands/spatial-relation.js +0 -22
  126. package/esm/api/cli/commands/table.js +6 -28
  127. package/esm/api/cli/commands/trigger.js +0 -22
  128. package/esm/api/cli/commands/unique-constraint.js +0 -22
  129. package/esm/api/cli/commands/view-table.js +22 -0
  130. package/esm/api/cli/commands/view.js +0 -22
  131. package/esm/api/cli/commands.js +3 -1
  132. package/esm/api/cli/executor.d.ts +1 -0
  133. package/esm/api/orm/index.d.ts +2 -0
  134. package/esm/api/orm/index.js +2 -0
  135. package/esm/api/orm/input-types.d.ts +1064 -125
  136. package/esm/api/orm/input-types.js +3 -0
  137. package/esm/api/orm/models/compositeType.d.ts +54 -0
  138. package/esm/api/orm/models/compositeType.js +100 -0
  139. package/esm/api/orm/models/index.d.ts +1 -0
  140. package/esm/api/orm/models/index.js +1 -0
  141. package/esm/auth/cli/commands/link-identity.d.ts +8 -0
  142. package/esm/auth/cli/commands/link-identity.js +34 -0
  143. package/esm/auth/cli/commands/sign-in-sms-otp.d.ts +8 -0
  144. package/esm/auth/cli/commands/sign-in-sms-otp.js +34 -0
  145. package/esm/auth/cli/commands/sign-up-sms.d.ts +8 -0
  146. package/esm/auth/cli/commands/sign-up-sms.js +34 -0
  147. package/esm/auth/cli/commands.js +7 -1
  148. package/esm/auth/cli/executor.d.ts +15 -0
  149. package/esm/auth/orm/index.d.ts +15 -0
  150. package/esm/auth/orm/input-types.d.ts +197 -1
  151. package/esm/auth/orm/mutation/index.d.ts +25 -1
  152. package/esm/auth/orm/mutation/index.js +36 -0
  153. package/esm/modules/cli/commands/agent-module.js +88 -0
  154. package/esm/modules/cli/commands/billing-module.js +66 -0
  155. package/esm/modules/cli/commands/compute-log-module.js +44 -0
  156. package/esm/modules/cli/commands/config-secrets-module.js +44 -0
  157. package/esm/modules/cli/commands/db-usage-module.js +66 -0
  158. package/esm/modules/cli/commands/entity-type-provision.js +0 -44
  159. package/esm/modules/cli/commands/events-module.js +66 -0
  160. package/esm/modules/cli/commands/function-invocation-module.d.ts +8 -0
  161. package/esm/modules/cli/commands/function-invocation-module.js +580 -0
  162. package/esm/modules/cli/commands/function-module.js +22 -198
  163. package/esm/modules/cli/commands/graph-module.js +22 -0
  164. package/esm/modules/cli/commands/hierarchy-module.js +22 -0
  165. package/esm/modules/cli/commands/identity-providers-module.js +44 -0
  166. package/esm/modules/cli/commands/inference-log-module.js +44 -0
  167. package/esm/modules/cli/commands/invites-module.js +44 -0
  168. package/esm/modules/cli/commands/limits-module.js +44 -0
  169. package/esm/modules/cli/commands/memberships-module.js +88 -0
  170. package/esm/modules/cli/commands/merkle-store-module.js +22 -0
  171. package/esm/modules/cli/commands/namespace-module.js +22 -0
  172. package/esm/modules/cli/commands/notifications-module.js +88 -0
  173. package/esm/modules/cli/commands/permissions-module.js +44 -0
  174. package/esm/modules/cli/commands/plans-module.js +44 -0
  175. package/esm/modules/cli/commands/profiles-module.js +44 -0
  176. package/esm/modules/cli/commands/rate-limit-meters-module.js +66 -0
  177. package/esm/modules/cli/commands/storage-log-module.js +44 -0
  178. package/esm/modules/cli/commands/storage-module.js +66 -0
  179. package/esm/modules/cli/commands/transfer-log-module.js +44 -0
  180. package/esm/modules/cli/commands.js +29 -27
  181. package/esm/modules/cli/executor.d.ts +14 -13
  182. package/esm/modules/orm/index.d.ts +28 -26
  183. package/esm/modules/orm/index.js +28 -26
  184. package/esm/modules/orm/input-types.d.ts +4485 -2514
  185. package/esm/modules/orm/models/functionInvocationModule.d.ts +54 -0
  186. package/esm/modules/orm/models/functionInvocationModule.js +100 -0
  187. package/esm/modules/orm/models/index.d.ts +14 -13
  188. package/esm/modules/orm/models/index.js +14 -13
  189. package/esm/objects/orm/input-types.d.ts +62 -0
  190. package/esm/usage/orm/input-types.d.ts +314 -19
  191. package/modules/cli/commands/agent-module.js +88 -0
  192. package/modules/cli/commands/billing-module.js +66 -0
  193. package/modules/cli/commands/compute-log-module.js +44 -0
  194. package/modules/cli/commands/config-secrets-module.js +44 -0
  195. package/modules/cli/commands/db-usage-module.js +66 -0
  196. package/modules/cli/commands/entity-type-provision.js +0 -44
  197. package/modules/cli/commands/events-module.js +66 -0
  198. package/modules/cli/commands/function-invocation-module.d.ts +8 -0
  199. package/modules/cli/commands/function-invocation-module.js +582 -0
  200. package/modules/cli/commands/function-module.js +22 -198
  201. package/modules/cli/commands/graph-module.js +22 -0
  202. package/modules/cli/commands/hierarchy-module.js +22 -0
  203. package/modules/cli/commands/identity-providers-module.js +44 -0
  204. package/modules/cli/commands/inference-log-module.js +44 -0
  205. package/modules/cli/commands/invites-module.js +44 -0
  206. package/modules/cli/commands/limits-module.js +44 -0
  207. package/modules/cli/commands/memberships-module.js +88 -0
  208. package/modules/cli/commands/merkle-store-module.js +22 -0
  209. package/modules/cli/commands/namespace-module.js +22 -0
  210. package/modules/cli/commands/notifications-module.js +88 -0
  211. package/modules/cli/commands/permissions-module.js +44 -0
  212. package/modules/cli/commands/plans-module.js +44 -0
  213. package/modules/cli/commands/profiles-module.js +44 -0
  214. package/modules/cli/commands/rate-limit-meters-module.js +66 -0
  215. package/modules/cli/commands/storage-log-module.js +44 -0
  216. package/modules/cli/commands/storage-module.js +66 -0
  217. package/modules/cli/commands/transfer-log-module.js +44 -0
  218. package/modules/cli/commands.js +29 -27
  219. package/modules/cli/executor.d.ts +14 -13
  220. package/modules/orm/index.d.ts +28 -26
  221. package/modules/orm/index.js +28 -26
  222. package/modules/orm/input-types.d.ts +4485 -2514
  223. package/modules/orm/models/functionInvocationModule.d.ts +54 -0
  224. package/modules/orm/models/functionInvocationModule.js +104 -0
  225. package/modules/orm/models/index.d.ts +14 -13
  226. package/modules/orm/models/index.js +30 -28
  227. package/objects/orm/input-types.d.ts +62 -0
  228. package/package.json +4 -4
  229. package/usage/orm/input-types.d.ts +314 -19
@@ -149,7 +149,8 @@ async function handleCreate(argv, prompter) {
149
149
  type: 'text',
150
150
  name: 'actorId',
151
151
  message: 'actorId',
152
- required: true,
152
+ required: false,
153
+ skipPrompt: true,
153
154
  },
154
155
  {
155
156
  type: 'text',
@@ -210,6 +211,7 @@ async function handleUpdate(argv, prompter) {
210
211
  name: 'actorId',
211
212
  message: 'actorId',
212
213
  required: false,
214
+ skipPrompt: true,
213
215
  },
214
216
  {
215
217
  type: 'text',
@@ -160,7 +160,8 @@ async function handleCreate(argv, prompter) {
160
160
  type: 'text',
161
161
  name: 'actorId',
162
162
  message: 'actorId',
163
- required: true,
163
+ required: false,
164
+ skipPrompt: true,
164
165
  },
165
166
  {
166
167
  type: 'text',
@@ -230,6 +231,7 @@ async function handleUpdate(argv, prompter) {
230
231
  name: 'actorId',
231
232
  message: 'actorId',
232
233
  required: false,
234
+ skipPrompt: true,
233
235
  },
234
236
  {
235
237
  type: 'text',
@@ -10,7 +10,9 @@ const executor_1 = require("../executor");
10
10
  const utils_1 = require("../utils");
11
11
  const fieldSchema = {
12
12
  id: 'uuid',
13
+ channel: 'string',
13
14
  email: 'string',
15
+ phone: 'string',
14
16
  senderId: 'uuid',
15
17
  inviteToken: 'string',
16
18
  inviteValid: 'boolean',
@@ -66,7 +68,9 @@ async function handleList(argv, _prompter) {
66
68
  try {
67
69
  const defaultSelect = {
68
70
  id: true,
71
+ channel: true,
69
72
  email: true,
73
+ phone: true,
70
74
  senderId: true,
71
75
  inviteToken: true,
72
76
  inviteValid: true,
@@ -96,7 +100,9 @@ async function handleFindFirst(argv, _prompter) {
96
100
  try {
97
101
  const defaultSelect = {
98
102
  id: true,
103
+ channel: true,
99
104
  email: true,
105
+ phone: true,
100
106
  senderId: true,
101
107
  inviteToken: true,
102
108
  inviteValid: true,
@@ -138,7 +144,9 @@ async function handleGet(argv, prompter) {
138
144
  id: answers.id,
139
145
  select: {
140
146
  id: true,
147
+ channel: true,
141
148
  email: true,
149
+ phone: true,
142
150
  senderId: true,
143
151
  inviteToken: true,
144
152
  inviteValid: true,
@@ -166,6 +174,13 @@ async function handleGet(argv, prompter) {
166
174
  async function handleCreate(argv, prompter) {
167
175
  try {
168
176
  const rawAnswers = await prompter.prompt(argv, [
177
+ {
178
+ type: 'text',
179
+ name: 'channel',
180
+ message: 'channel',
181
+ required: false,
182
+ skipPrompt: true,
183
+ },
169
184
  {
170
185
  type: 'text',
171
186
  name: 'email',
@@ -173,6 +188,13 @@ async function handleCreate(argv, prompter) {
173
188
  required: false,
174
189
  skipPrompt: true,
175
190
  },
191
+ {
192
+ type: 'text',
193
+ name: 'phone',
194
+ message: 'phone',
195
+ required: false,
196
+ skipPrompt: true,
197
+ },
176
198
  {
177
199
  type: 'text',
178
200
  name: 'senderId',
@@ -243,7 +265,9 @@ async function handleCreate(argv, prompter) {
243
265
  const result = await client.appInvite
244
266
  .create({
245
267
  data: {
268
+ channel: cleanedData.channel,
246
269
  email: cleanedData.email,
270
+ phone: cleanedData.phone,
247
271
  senderId: cleanedData.senderId,
248
272
  inviteToken: cleanedData.inviteToken,
249
273
  inviteValid: cleanedData.inviteValid,
@@ -256,7 +280,9 @@ async function handleCreate(argv, prompter) {
256
280
  },
257
281
  select: {
258
282
  id: true,
283
+ channel: true,
259
284
  email: true,
285
+ phone: true,
260
286
  senderId: true,
261
287
  inviteToken: true,
262
288
  inviteValid: true,
@@ -290,6 +316,13 @@ async function handleUpdate(argv, prompter) {
290
316
  message: 'id',
291
317
  required: true,
292
318
  },
319
+ {
320
+ type: 'text',
321
+ name: 'channel',
322
+ message: 'channel',
323
+ required: false,
324
+ skipPrompt: true,
325
+ },
293
326
  {
294
327
  type: 'text',
295
328
  name: 'email',
@@ -297,6 +330,13 @@ async function handleUpdate(argv, prompter) {
297
330
  required: false,
298
331
  skipPrompt: true,
299
332
  },
333
+ {
334
+ type: 'text',
335
+ name: 'phone',
336
+ message: 'phone',
337
+ required: false,
338
+ skipPrompt: true,
339
+ },
300
340
  {
301
341
  type: 'text',
302
342
  name: 'senderId',
@@ -370,7 +410,9 @@ async function handleUpdate(argv, prompter) {
370
410
  id: answers.id,
371
411
  },
372
412
  data: {
413
+ channel: cleanedData.channel,
373
414
  email: cleanedData.email,
415
+ phone: cleanedData.phone,
374
416
  senderId: cleanedData.senderId,
375
417
  inviteToken: cleanedData.inviteToken,
376
418
  inviteValid: cleanedData.inviteValid,
@@ -383,7 +425,9 @@ async function handleUpdate(argv, prompter) {
383
425
  },
384
426
  select: {
385
427
  id: true,
428
+ channel: true,
386
429
  email: true,
430
+ phone: true,
387
431
  senderId: true,
388
432
  inviteToken: true,
389
433
  inviteValid: true,
@@ -149,7 +149,8 @@ async function handleCreate(argv, prompter) {
149
149
  type: 'text',
150
150
  name: 'actorId',
151
151
  message: 'actorId',
152
- required: true,
152
+ required: false,
153
+ skipPrompt: true,
153
154
  },
154
155
  {
155
156
  type: 'text',
@@ -210,6 +211,7 @@ async function handleUpdate(argv, prompter) {
210
211
  name: 'actorId',
211
212
  message: 'actorId',
212
213
  required: false,
214
+ skipPrompt: true,
213
215
  },
214
216
  {
215
217
  type: 'text',
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI commands for AppPermissionDefaultGrant
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;
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * CLI commands for AppPermissionDefaultGrant
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
+ permissionId: 'uuid',
14
+ isGrant: 'boolean',
15
+ grantorId: 'uuid',
16
+ createdAt: 'string',
17
+ updatedAt: 'string',
18
+ };
19
+ const usage = '\napp-permission-default-grant <command>\n\nCommands:\n list List appPermissionDefaultGrant records\n find-first Find first matching appPermissionDefaultGrant record\n get Get a appPermissionDefaultGrant by ID\n create Create a new appPermissionDefaultGrant\n update Update an existing appPermissionDefaultGrant\n delete Delete a appPermissionDefaultGrant\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';
20
+ exports.default = async (argv, prompter, _options) => {
21
+ if (argv.help || argv.h) {
22
+ console.log(usage);
23
+ process.exit(0);
24
+ }
25
+ const { first: subcommand, newArgv } = (0, inquirerer_1.extractFirst)(argv);
26
+ if (!subcommand) {
27
+ const answer = await prompter.prompt(argv, [
28
+ {
29
+ type: 'autocomplete',
30
+ name: 'subcommand',
31
+ message: 'What do you want to do?',
32
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
33
+ },
34
+ ]);
35
+ return handleTableSubcommand(answer.subcommand, newArgv, prompter);
36
+ }
37
+ return handleTableSubcommand(subcommand, newArgv, prompter);
38
+ };
39
+ async function handleTableSubcommand(subcommand, argv, prompter) {
40
+ switch (subcommand) {
41
+ case 'list':
42
+ return handleList(argv, prompter);
43
+ case 'find-first':
44
+ return handleFindFirst(argv, prompter);
45
+ case 'get':
46
+ return handleGet(argv, prompter);
47
+ case 'create':
48
+ return handleCreate(argv, prompter);
49
+ case 'update':
50
+ return handleUpdate(argv, prompter);
51
+ case 'delete':
52
+ return handleDelete(argv, prompter);
53
+ default:
54
+ console.log(usage);
55
+ process.exit(1);
56
+ }
57
+ }
58
+ async function handleList(argv, _prompter) {
59
+ try {
60
+ const defaultSelect = {
61
+ id: true,
62
+ permissionId: true,
63
+ isGrant: true,
64
+ grantorId: true,
65
+ createdAt: true,
66
+ updatedAt: true,
67
+ };
68
+ const findManyArgs = (0, utils_1.parseFindManyArgs)(argv, defaultSelect);
69
+ const client = (0, executor_1.getClient)();
70
+ const result = await client.appPermissionDefaultGrant.findMany(findManyArgs).execute();
71
+ console.log(JSON.stringify(result, null, 2));
72
+ }
73
+ catch (error) {
74
+ console.error('Failed to list records.');
75
+ if (error instanceof Error) {
76
+ console.error(error.message);
77
+ }
78
+ process.exit(1);
79
+ }
80
+ }
81
+ async function handleFindFirst(argv, _prompter) {
82
+ try {
83
+ const defaultSelect = {
84
+ id: true,
85
+ permissionId: true,
86
+ isGrant: true,
87
+ grantorId: true,
88
+ createdAt: true,
89
+ updatedAt: true,
90
+ };
91
+ const findFirstArgs = (0, utils_1.parseFindFirstArgs)(argv, defaultSelect);
92
+ const client = (0, executor_1.getClient)();
93
+ const result = await client.appPermissionDefaultGrant.findFirst(findFirstArgs).execute();
94
+ console.log(JSON.stringify(result, null, 2));
95
+ }
96
+ catch (error) {
97
+ console.error('Failed to find record.');
98
+ if (error instanceof Error) {
99
+ console.error(error.message);
100
+ }
101
+ process.exit(1);
102
+ }
103
+ }
104
+ async function handleGet(argv, prompter) {
105
+ try {
106
+ const answers = await prompter.prompt(argv, [
107
+ {
108
+ type: 'text',
109
+ name: 'id',
110
+ message: 'id',
111
+ required: true,
112
+ },
113
+ ]);
114
+ const client = (0, executor_1.getClient)();
115
+ const result = await client.appPermissionDefaultGrant
116
+ .findOne({
117
+ id: answers.id,
118
+ select: {
119
+ id: true,
120
+ permissionId: true,
121
+ isGrant: true,
122
+ grantorId: true,
123
+ createdAt: true,
124
+ updatedAt: true,
125
+ },
126
+ })
127
+ .execute();
128
+ console.log(JSON.stringify(result, null, 2));
129
+ }
130
+ catch (error) {
131
+ console.error('Record not found.');
132
+ if (error instanceof Error) {
133
+ console.error(error.message);
134
+ }
135
+ process.exit(1);
136
+ }
137
+ }
138
+ async function handleCreate(argv, prompter) {
139
+ try {
140
+ const rawAnswers = await prompter.prompt(argv, [
141
+ {
142
+ type: 'text',
143
+ name: 'permissionId',
144
+ message: 'permissionId',
145
+ required: true,
146
+ },
147
+ {
148
+ type: 'boolean',
149
+ name: 'isGrant',
150
+ message: 'isGrant',
151
+ required: false,
152
+ skipPrompt: true,
153
+ },
154
+ {
155
+ type: 'text',
156
+ name: 'grantorId',
157
+ message: 'grantorId',
158
+ required: false,
159
+ skipPrompt: true,
160
+ },
161
+ ]);
162
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
163
+ const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
164
+ const client = (0, executor_1.getClient)();
165
+ const result = await client.appPermissionDefaultGrant
166
+ .create({
167
+ data: {
168
+ permissionId: cleanedData.permissionId,
169
+ isGrant: cleanedData.isGrant,
170
+ grantorId: cleanedData.grantorId,
171
+ },
172
+ select: {
173
+ id: true,
174
+ permissionId: true,
175
+ isGrant: true,
176
+ grantorId: true,
177
+ createdAt: true,
178
+ updatedAt: true,
179
+ },
180
+ })
181
+ .execute();
182
+ console.log(JSON.stringify(result, null, 2));
183
+ }
184
+ catch (error) {
185
+ console.error('Failed to create record.');
186
+ if (error instanceof Error) {
187
+ console.error(error.message);
188
+ }
189
+ process.exit(1);
190
+ }
191
+ }
192
+ async function handleUpdate(argv, prompter) {
193
+ try {
194
+ const rawAnswers = await prompter.prompt(argv, [
195
+ {
196
+ type: 'text',
197
+ name: 'id',
198
+ message: 'id',
199
+ required: true,
200
+ },
201
+ {
202
+ type: 'text',
203
+ name: 'permissionId',
204
+ message: 'permissionId',
205
+ required: false,
206
+ },
207
+ {
208
+ type: 'boolean',
209
+ name: 'isGrant',
210
+ message: 'isGrant',
211
+ required: false,
212
+ skipPrompt: true,
213
+ },
214
+ {
215
+ type: 'text',
216
+ name: 'grantorId',
217
+ message: 'grantorId',
218
+ required: false,
219
+ skipPrompt: true,
220
+ },
221
+ ]);
222
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
223
+ const cleanedData = (0, utils_1.stripUndefined)(answers, fieldSchema);
224
+ const client = (0, executor_1.getClient)();
225
+ const result = await client.appPermissionDefaultGrant
226
+ .update({
227
+ where: {
228
+ id: answers.id,
229
+ },
230
+ data: {
231
+ permissionId: cleanedData.permissionId,
232
+ isGrant: cleanedData.isGrant,
233
+ grantorId: cleanedData.grantorId,
234
+ },
235
+ select: {
236
+ id: true,
237
+ permissionId: true,
238
+ isGrant: true,
239
+ grantorId: true,
240
+ createdAt: true,
241
+ updatedAt: true,
242
+ },
243
+ })
244
+ .execute();
245
+ console.log(JSON.stringify(result, null, 2));
246
+ }
247
+ catch (error) {
248
+ console.error('Failed to update record.');
249
+ if (error instanceof Error) {
250
+ console.error(error.message);
251
+ }
252
+ process.exit(1);
253
+ }
254
+ }
255
+ async function handleDelete(argv, prompter) {
256
+ try {
257
+ const rawAnswers = await prompter.prompt(argv, [
258
+ {
259
+ type: 'text',
260
+ name: 'id',
261
+ message: 'id',
262
+ required: true,
263
+ },
264
+ ]);
265
+ const answers = (0, utils_1.coerceAnswers)(rawAnswers, fieldSchema);
266
+ const client = (0, executor_1.getClient)();
267
+ const result = await client.appPermissionDefaultGrant
268
+ .delete({
269
+ where: {
270
+ id: answers.id,
271
+ },
272
+ select: {
273
+ id: true,
274
+ },
275
+ })
276
+ .execute();
277
+ console.log(JSON.stringify(result, null, 2));
278
+ }
279
+ catch (error) {
280
+ console.error('Failed to delete record.');
281
+ if (error instanceof Error) {
282
+ console.error(error.message);
283
+ }
284
+ process.exit(1);
285
+ }
286
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI commands for AppPermissionDefaultPermission
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;