@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
@@ -0,0 +1,580 @@
1
+ /**
2
+ * CLI commands for FunctionInvocationModule
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
+ privateSchemaId: 'uuid',
14
+ publicSchemaName: 'string',
15
+ privateSchemaName: 'string',
16
+ invocationsTableId: 'uuid',
17
+ executionLogsTableId: 'uuid',
18
+ invocationsTableName: 'string',
19
+ executionLogsTableName: 'string',
20
+ apiName: 'string',
21
+ privateApiName: 'string',
22
+ scope: 'string',
23
+ prefix: 'string',
24
+ entityTableId: 'uuid',
25
+ policies: 'json',
26
+ provisions: 'json',
27
+ defaultPermissions: 'string',
28
+ };
29
+ const usage = '\nfunction-invocation-module <command>\n\nCommands:\n list List functionInvocationModule records\n find-first Find first matching functionInvocationModule record\n get Get a functionInvocationModule by ID\n create Create a new functionInvocationModule\n update Update an existing functionInvocationModule\n delete Delete a functionInvocationModule\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
+ privateSchemaId: true,
75
+ publicSchemaName: true,
76
+ privateSchemaName: true,
77
+ invocationsTableId: true,
78
+ executionLogsTableId: true,
79
+ invocationsTableName: true,
80
+ executionLogsTableName: true,
81
+ apiName: true,
82
+ privateApiName: true,
83
+ scope: true,
84
+ prefix: true,
85
+ entityTableId: true,
86
+ policies: true,
87
+ provisions: true,
88
+ defaultPermissions: true,
89
+ };
90
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
91
+ const client = getClient();
92
+ const result = await client.functionInvocationModule.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
+ privateSchemaId: true,
110
+ publicSchemaName: true,
111
+ privateSchemaName: true,
112
+ invocationsTableId: true,
113
+ executionLogsTableId: true,
114
+ invocationsTableName: true,
115
+ executionLogsTableName: true,
116
+ apiName: true,
117
+ privateApiName: true,
118
+ scope: true,
119
+ prefix: true,
120
+ entityTableId: true,
121
+ policies: true,
122
+ provisions: true,
123
+ defaultPermissions: true,
124
+ };
125
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
126
+ const client = getClient();
127
+ const result = await client.functionInvocationModule.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.functionInvocationModule
150
+ .findOne({
151
+ id: answers.id,
152
+ select: {
153
+ id: true,
154
+ databaseId: true,
155
+ schemaId: true,
156
+ privateSchemaId: true,
157
+ publicSchemaName: true,
158
+ privateSchemaName: true,
159
+ invocationsTableId: true,
160
+ executionLogsTableId: true,
161
+ invocationsTableName: true,
162
+ executionLogsTableName: true,
163
+ apiName: true,
164
+ privateApiName: true,
165
+ scope: true,
166
+ prefix: true,
167
+ entityTableId: true,
168
+ policies: true,
169
+ provisions: true,
170
+ defaultPermissions: 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: 'privateSchemaId',
203
+ message: 'privateSchemaId',
204
+ required: false,
205
+ skipPrompt: true,
206
+ },
207
+ {
208
+ type: 'text',
209
+ name: 'publicSchemaName',
210
+ message: 'publicSchemaName',
211
+ required: false,
212
+ skipPrompt: true,
213
+ },
214
+ {
215
+ type: 'text',
216
+ name: 'privateSchemaName',
217
+ message: 'privateSchemaName',
218
+ required: false,
219
+ skipPrompt: true,
220
+ },
221
+ {
222
+ type: 'text',
223
+ name: 'invocationsTableId',
224
+ message: 'invocationsTableId',
225
+ required: false,
226
+ skipPrompt: true,
227
+ },
228
+ {
229
+ type: 'text',
230
+ name: 'executionLogsTableId',
231
+ message: 'executionLogsTableId',
232
+ required: false,
233
+ skipPrompt: true,
234
+ },
235
+ {
236
+ type: 'text',
237
+ name: 'invocationsTableName',
238
+ message: 'invocationsTableName',
239
+ required: false,
240
+ skipPrompt: true,
241
+ },
242
+ {
243
+ type: 'text',
244
+ name: 'executionLogsTableName',
245
+ message: 'executionLogsTableName',
246
+ required: false,
247
+ skipPrompt: true,
248
+ },
249
+ {
250
+ type: 'text',
251
+ name: 'apiName',
252
+ message: 'apiName',
253
+ required: false,
254
+ skipPrompt: true,
255
+ },
256
+ {
257
+ type: 'text',
258
+ name: 'privateApiName',
259
+ message: 'privateApiName',
260
+ required: false,
261
+ skipPrompt: true,
262
+ },
263
+ {
264
+ type: 'text',
265
+ name: 'scope',
266
+ message: 'scope',
267
+ required: false,
268
+ skipPrompt: true,
269
+ },
270
+ {
271
+ type: 'text',
272
+ name: 'prefix',
273
+ message: 'prefix',
274
+ required: false,
275
+ skipPrompt: true,
276
+ },
277
+ {
278
+ type: 'text',
279
+ name: 'entityTableId',
280
+ message: 'entityTableId',
281
+ required: false,
282
+ skipPrompt: true,
283
+ },
284
+ {
285
+ type: 'json',
286
+ name: 'policies',
287
+ message: 'policies',
288
+ required: false,
289
+ skipPrompt: true,
290
+ },
291
+ {
292
+ type: 'json',
293
+ name: 'provisions',
294
+ message: 'provisions',
295
+ required: false,
296
+ skipPrompt: true,
297
+ },
298
+ {
299
+ type: 'text',
300
+ name: 'defaultPermissions',
301
+ message: 'defaultPermissions',
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.functionInvocationModule
310
+ .create({
311
+ data: {
312
+ databaseId: cleanedData.databaseId,
313
+ schemaId: cleanedData.schemaId,
314
+ privateSchemaId: cleanedData.privateSchemaId,
315
+ publicSchemaName: cleanedData.publicSchemaName,
316
+ privateSchemaName: cleanedData.privateSchemaName,
317
+ invocationsTableId: cleanedData.invocationsTableId,
318
+ executionLogsTableId: cleanedData.executionLogsTableId,
319
+ invocationsTableName: cleanedData.invocationsTableName,
320
+ executionLogsTableName: cleanedData.executionLogsTableName,
321
+ apiName: cleanedData.apiName,
322
+ privateApiName: cleanedData.privateApiName,
323
+ scope: cleanedData.scope,
324
+ prefix: cleanedData.prefix,
325
+ entityTableId: cleanedData.entityTableId,
326
+ policies: cleanedData.policies,
327
+ provisions: cleanedData.provisions,
328
+ defaultPermissions: cleanedData.defaultPermissions,
329
+ },
330
+ select: {
331
+ id: true,
332
+ databaseId: true,
333
+ schemaId: true,
334
+ privateSchemaId: true,
335
+ publicSchemaName: true,
336
+ privateSchemaName: true,
337
+ invocationsTableId: true,
338
+ executionLogsTableId: true,
339
+ invocationsTableName: true,
340
+ executionLogsTableName: true,
341
+ apiName: true,
342
+ privateApiName: true,
343
+ scope: true,
344
+ prefix: true,
345
+ entityTableId: true,
346
+ policies: true,
347
+ provisions: true,
348
+ defaultPermissions: 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: 'privateSchemaId',
387
+ message: 'privateSchemaId',
388
+ required: false,
389
+ skipPrompt: true,
390
+ },
391
+ {
392
+ type: 'text',
393
+ name: 'publicSchemaName',
394
+ message: 'publicSchemaName',
395
+ required: false,
396
+ skipPrompt: true,
397
+ },
398
+ {
399
+ type: 'text',
400
+ name: 'privateSchemaName',
401
+ message: 'privateSchemaName',
402
+ required: false,
403
+ skipPrompt: true,
404
+ },
405
+ {
406
+ type: 'text',
407
+ name: 'invocationsTableId',
408
+ message: 'invocationsTableId',
409
+ required: false,
410
+ skipPrompt: true,
411
+ },
412
+ {
413
+ type: 'text',
414
+ name: 'executionLogsTableId',
415
+ message: 'executionLogsTableId',
416
+ required: false,
417
+ skipPrompt: true,
418
+ },
419
+ {
420
+ type: 'text',
421
+ name: 'invocationsTableName',
422
+ message: 'invocationsTableName',
423
+ required: false,
424
+ skipPrompt: true,
425
+ },
426
+ {
427
+ type: 'text',
428
+ name: 'executionLogsTableName',
429
+ message: 'executionLogsTableName',
430
+ required: false,
431
+ skipPrompt: true,
432
+ },
433
+ {
434
+ type: 'text',
435
+ name: 'apiName',
436
+ message: 'apiName',
437
+ required: false,
438
+ skipPrompt: true,
439
+ },
440
+ {
441
+ type: 'text',
442
+ name: 'privateApiName',
443
+ message: 'privateApiName',
444
+ required: false,
445
+ skipPrompt: true,
446
+ },
447
+ {
448
+ type: 'text',
449
+ name: 'scope',
450
+ message: 'scope',
451
+ required: false,
452
+ skipPrompt: true,
453
+ },
454
+ {
455
+ type: 'text',
456
+ name: 'prefix',
457
+ message: 'prefix',
458
+ required: false,
459
+ skipPrompt: true,
460
+ },
461
+ {
462
+ type: 'text',
463
+ name: 'entityTableId',
464
+ message: 'entityTableId',
465
+ required: false,
466
+ skipPrompt: true,
467
+ },
468
+ {
469
+ type: 'json',
470
+ name: 'policies',
471
+ message: 'policies',
472
+ required: false,
473
+ skipPrompt: true,
474
+ },
475
+ {
476
+ type: 'json',
477
+ name: 'provisions',
478
+ message: 'provisions',
479
+ required: false,
480
+ skipPrompt: true,
481
+ },
482
+ {
483
+ type: 'text',
484
+ name: 'defaultPermissions',
485
+ message: 'defaultPermissions',
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.functionInvocationModule
494
+ .update({
495
+ where: {
496
+ id: answers.id,
497
+ },
498
+ data: {
499
+ databaseId: cleanedData.databaseId,
500
+ schemaId: cleanedData.schemaId,
501
+ privateSchemaId: cleanedData.privateSchemaId,
502
+ publicSchemaName: cleanedData.publicSchemaName,
503
+ privateSchemaName: cleanedData.privateSchemaName,
504
+ invocationsTableId: cleanedData.invocationsTableId,
505
+ executionLogsTableId: cleanedData.executionLogsTableId,
506
+ invocationsTableName: cleanedData.invocationsTableName,
507
+ executionLogsTableName: cleanedData.executionLogsTableName,
508
+ apiName: cleanedData.apiName,
509
+ privateApiName: cleanedData.privateApiName,
510
+ scope: cleanedData.scope,
511
+ prefix: cleanedData.prefix,
512
+ entityTableId: cleanedData.entityTableId,
513
+ policies: cleanedData.policies,
514
+ provisions: cleanedData.provisions,
515
+ defaultPermissions: cleanedData.defaultPermissions,
516
+ },
517
+ select: {
518
+ id: true,
519
+ databaseId: true,
520
+ schemaId: true,
521
+ privateSchemaId: true,
522
+ publicSchemaName: true,
523
+ privateSchemaName: true,
524
+ invocationsTableId: true,
525
+ executionLogsTableId: true,
526
+ invocationsTableName: true,
527
+ executionLogsTableName: true,
528
+ apiName: true,
529
+ privateApiName: true,
530
+ scope: true,
531
+ prefix: true,
532
+ entityTableId: true,
533
+ policies: true,
534
+ provisions: true,
535
+ defaultPermissions: 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.functionInvocationModule
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
+ }