@constructive-sdk/cli 0.9.2 → 0.10.1

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 (276) hide show
  1. package/README.md +0 -8
  2. package/admin/cli/commands/app-level-requirement.js +0 -2
  3. package/admin/cli/commands/app-level.js +0 -2
  4. package/admin/cli/commands/app-permission.js +0 -2
  5. package/admin/cli/commands/invite.js +0 -2
  6. package/admin/cli/commands/membership-type.js +0 -3
  7. package/admin/cli/commands/org-chart-edge-grant.js +3 -3
  8. package/admin/cli/commands/org-chart-edge.js +0 -2
  9. package/admin/cli/commands/org-invite.js +0 -2
  10. package/admin/cli/commands/org-permission.js +0 -2
  11. package/admin/orm/input-types.d.ts +33 -127
  12. package/auth/cli/commands/audit-log.js +0 -2
  13. package/auth/cli/commands/connected-account.js +0 -3
  14. package/auth/cli/commands/crypto-address.js +0 -2
  15. package/auth/cli/commands/phone-number.js +0 -3
  16. package/auth/cli/commands.js +7 -7
  17. package/auth/cli/executor.d.ts +3 -3
  18. package/auth/orm/index.d.ts +6 -6
  19. package/auth/orm/index.js +6 -6
  20. package/auth/orm/input-types.d.ts +279 -327
  21. package/auth/orm/input-types.js +9 -1
  22. package/auth/orm/models/index.d.ts +3 -3
  23. package/auth/orm/models/index.js +7 -7
  24. package/esm/admin/cli/commands/app-level-requirement.js +0 -2
  25. package/esm/admin/cli/commands/app-level.js +0 -2
  26. package/esm/admin/cli/commands/app-permission.js +0 -2
  27. package/esm/admin/cli/commands/invite.js +0 -2
  28. package/esm/admin/cli/commands/membership-type.js +0 -3
  29. package/esm/admin/cli/commands/org-chart-edge-grant.js +3 -3
  30. package/esm/admin/cli/commands/org-chart-edge.js +0 -2
  31. package/esm/admin/cli/commands/org-invite.js +0 -2
  32. package/esm/admin/cli/commands/org-permission.js +0 -2
  33. package/esm/admin/orm/input-types.d.ts +33 -127
  34. package/esm/auth/cli/commands/audit-log.js +0 -2
  35. package/esm/auth/cli/commands/connected-account.js +0 -3
  36. package/esm/auth/cli/commands/crypto-address.js +0 -2
  37. package/esm/auth/cli/commands/phone-number.js +0 -3
  38. package/esm/auth/cli/commands.js +7 -7
  39. package/esm/auth/cli/executor.d.ts +3 -3
  40. package/esm/auth/orm/index.d.ts +6 -6
  41. package/esm/auth/orm/index.js +6 -6
  42. package/esm/auth/orm/input-types.d.ts +279 -327
  43. package/esm/auth/orm/input-types.js +9 -1
  44. package/esm/auth/orm/models/index.d.ts +3 -3
  45. package/esm/auth/orm/models/index.js +3 -3
  46. package/esm/index.d.ts +3 -3
  47. package/esm/index.js +3 -3
  48. package/esm/objects/cli/commands/commit.js +0 -2
  49. package/esm/objects/cli/commands/ref.js +0 -2
  50. package/esm/objects/cli/commands/store.js +0 -2
  51. package/esm/objects/orm/input-types.d.ts +17 -48
  52. package/esm/public/cli/commands/accept-database-transfer.d.ts +8 -0
  53. package/esm/public/cli/commands/accept-database-transfer.js +34 -0
  54. package/esm/public/cli/commands/api-module.js +0 -2
  55. package/esm/public/cli/commands/api.js +0 -5
  56. package/esm/public/cli/commands/app-level-requirement.js +0 -2
  57. package/esm/public/cli/commands/app-level.js +0 -2
  58. package/esm/public/cli/commands/app-permission.js +0 -2
  59. package/esm/public/cli/commands/app.js +0 -4
  60. package/esm/public/cli/commands/ast-migration.js +0 -2
  61. package/esm/public/cli/commands/audit-log.js +0 -2
  62. package/esm/public/cli/commands/blueprint-template.d.ts +8 -0
  63. package/esm/public/cli/commands/blueprint-template.js +549 -0
  64. package/esm/public/cli/commands/{uuid-module.d.ts → blueprint.d.ts} +1 -1
  65. package/esm/public/cli/commands/blueprint.js +484 -0
  66. package/esm/public/cli/commands/cancel-database-transfer.d.ts +8 -0
  67. package/esm/public/cli/commands/cancel-database-transfer.js +34 -0
  68. package/esm/public/cli/commands/check-constraint.js +0 -4
  69. package/esm/public/cli/commands/commit.js +0 -2
  70. package/esm/public/cli/commands/connected-account.js +0 -3
  71. package/esm/public/cli/commands/connected-accounts-module.js +0 -2
  72. package/esm/public/cli/commands/construct-blueprint.d.ts +8 -0
  73. package/esm/public/cli/commands/construct-blueprint.js +34 -0
  74. package/esm/public/cli/commands/copy-template-to-blueprint.d.ts +8 -0
  75. package/esm/public/cli/commands/copy-template-to-blueprint.js +34 -0
  76. package/esm/public/cli/commands/crypto-address.js +0 -2
  77. package/esm/public/cli/commands/crypto-addresses-module.js +0 -3
  78. package/esm/public/cli/commands/crypto-auth-module.js +0 -7
  79. package/esm/public/cli/commands/database-provision-module.js +0 -6
  80. package/esm/public/cli/commands/database-transfer.d.ts +8 -0
  81. package/esm/public/cli/commands/database-transfer.js +425 -0
  82. package/esm/public/cli/commands/database.js +0 -4
  83. package/esm/public/cli/commands/default-privilege.js +0 -4
  84. package/esm/public/cli/commands/denormalized-table-field.js +0 -2
  85. package/esm/public/cli/commands/emails-module.js +0 -2
  86. package/esm/public/cli/commands/embedding-chunk.d.ts +8 -0
  87. package/esm/public/cli/commands/embedding-chunk.js +513 -0
  88. package/esm/public/cli/commands/encrypted-secrets-module.js +0 -2
  89. package/{public/cli/commands/uuid-module.d.ts → esm/public/cli/commands/enum.d.ts} +1 -1
  90. package/esm/public/cli/commands/{uuid-module.js → enum.js} +175 -33
  91. package/esm/public/cli/commands/field-module.js +0 -2
  92. package/esm/public/cli/commands/field.js +21 -7
  93. package/esm/public/cli/commands/foreign-key-constraint.js +0 -7
  94. package/esm/public/cli/commands/hierarchy-module.js +0 -11
  95. package/esm/public/cli/commands/index.js +0 -4
  96. package/esm/public/cli/commands/invite.js +0 -2
  97. package/esm/public/cli/commands/invites-module.js +0 -5
  98. package/esm/public/cli/commands/levels-module.js +0 -16
  99. package/esm/public/cli/commands/limits-module.js +0 -10
  100. package/esm/public/cli/commands/membership-type.js +0 -3
  101. package/esm/public/cli/commands/membership-types-module.js +0 -2
  102. package/esm/public/cli/commands/memberships-module.js +0 -13
  103. package/esm/public/cli/commands/node-type-registry.js +0 -6
  104. package/esm/public/cli/commands/org-chart-edge-grant.js +3 -3
  105. package/esm/public/cli/commands/org-chart-edge.js +0 -2
  106. package/esm/public/cli/commands/org-invite.js +0 -2
  107. package/esm/public/cli/commands/org-permission.js +0 -2
  108. package/esm/public/cli/commands/permissions-module.js +0 -8
  109. package/esm/public/cli/commands/phone-number.js +0 -3
  110. package/esm/public/cli/commands/phone-numbers-module.js +0 -2
  111. package/esm/public/cli/commands/policy.js +0 -6
  112. package/esm/public/cli/commands/primary-key-constraint.js +0 -4
  113. package/esm/public/cli/commands/profiles-module.js +0 -6
  114. package/esm/public/cli/commands/ref.js +0 -2
  115. package/esm/public/cli/commands/reject-database-transfer.d.ts +8 -0
  116. package/esm/public/cli/commands/reject-database-transfer.js +34 -0
  117. package/esm/public/cli/commands/relation-provision.js +63 -11
  118. package/esm/public/cli/commands/rls-module.js +0 -5
  119. package/esm/public/cli/commands/schema-grant.js +0 -2
  120. package/esm/public/cli/commands/schema.js +0 -6
  121. package/esm/public/cli/commands/secrets-module.js +0 -2
  122. package/esm/public/cli/commands/secure-table-provision.js +0 -6
  123. package/esm/public/cli/commands/sessions-module.js +0 -4
  124. package/esm/public/cli/commands/site-metadatum.js +0 -3
  125. package/esm/public/cli/commands/site-module.js +0 -2
  126. package/esm/public/cli/commands/site.js +0 -4
  127. package/esm/public/cli/commands/sql-migration.js +0 -7
  128. package/esm/public/cli/commands/store.js +0 -2
  129. package/esm/public/cli/commands/table-grant.js +0 -3
  130. package/esm/public/cli/commands/table-template-module.js +0 -3
  131. package/esm/public/cli/commands/table.js +0 -7
  132. package/esm/public/cli/commands/trigger-function.js +0 -3
  133. package/esm/public/cli/commands/trigger.js +0 -5
  134. package/esm/public/cli/commands/unique-constraint.js +0 -5
  135. package/esm/public/cli/commands/user-auth-module.js +0 -17
  136. package/esm/public/cli/commands/users-module.js +0 -3
  137. package/esm/public/cli/commands/view-grant.js +0 -3
  138. package/esm/public/cli/commands/view-rule.js +0 -4
  139. package/esm/public/cli/commands/view.js +0 -5
  140. package/esm/public/cli/commands.js +53 -35
  141. package/esm/public/cli/executor.d.ts +68 -39
  142. package/esm/public/orm/index.d.ts +81 -48
  143. package/esm/public/orm/index.js +26 -18
  144. package/esm/public/orm/input-types.d.ts +2447 -2980
  145. package/esm/public/orm/input-types.js +26 -1
  146. package/esm/public/orm/models/blueprint.d.ts +56 -0
  147. package/esm/public/orm/models/blueprint.js +94 -0
  148. package/esm/public/orm/models/blueprintTemplate.d.ts +56 -0
  149. package/esm/public/orm/models/blueprintTemplate.js +94 -0
  150. package/esm/public/orm/models/databaseTransfer.d.ts +56 -0
  151. package/esm/public/orm/models/databaseTransfer.js +94 -0
  152. package/esm/public/orm/models/embeddingChunk.d.ts +56 -0
  153. package/esm/public/orm/models/embeddingChunk.js +94 -0
  154. package/esm/public/orm/models/enum.d.ts +56 -0
  155. package/esm/public/orm/models/{uuidModule.js → enum.js} +23 -23
  156. package/esm/public/orm/models/index.d.ts +13 -9
  157. package/esm/public/orm/models/index.js +13 -9
  158. package/esm/public/orm/mutation/index.d.ts +98 -50
  159. package/esm/public/orm/mutation/index.js +126 -66
  160. package/index.d.ts +3 -3
  161. package/index.js +8 -8
  162. package/objects/cli/commands/commit.js +0 -2
  163. package/objects/cli/commands/ref.js +0 -2
  164. package/objects/cli/commands/store.js +0 -2
  165. package/objects/orm/input-types.d.ts +17 -48
  166. package/package.json +3 -3
  167. package/public/cli/commands/accept-database-transfer.d.ts +8 -0
  168. package/public/cli/commands/accept-database-transfer.js +36 -0
  169. package/public/cli/commands/api-module.js +0 -2
  170. package/public/cli/commands/api.js +0 -5
  171. package/public/cli/commands/app-level-requirement.js +0 -2
  172. package/public/cli/commands/app-level.js +0 -2
  173. package/public/cli/commands/app-permission.js +0 -2
  174. package/public/cli/commands/app.js +0 -4
  175. package/public/cli/commands/ast-migration.js +0 -2
  176. package/public/cli/commands/audit-log.js +0 -2
  177. package/public/cli/commands/blueprint-template.d.ts +8 -0
  178. package/public/cli/commands/blueprint-template.js +551 -0
  179. package/public/cli/commands/blueprint.d.ts +8 -0
  180. package/public/cli/commands/blueprint.js +486 -0
  181. package/public/cli/commands/cancel-database-transfer.d.ts +8 -0
  182. package/public/cli/commands/cancel-database-transfer.js +36 -0
  183. package/public/cli/commands/check-constraint.js +0 -4
  184. package/public/cli/commands/commit.js +0 -2
  185. package/public/cli/commands/connected-account.js +0 -3
  186. package/public/cli/commands/connected-accounts-module.js +0 -2
  187. package/public/cli/commands/construct-blueprint.d.ts +8 -0
  188. package/public/cli/commands/construct-blueprint.js +36 -0
  189. package/public/cli/commands/copy-template-to-blueprint.d.ts +8 -0
  190. package/public/cli/commands/copy-template-to-blueprint.js +36 -0
  191. package/public/cli/commands/crypto-address.js +0 -2
  192. package/public/cli/commands/crypto-addresses-module.js +0 -3
  193. package/public/cli/commands/crypto-auth-module.js +0 -7
  194. package/public/cli/commands/database-provision-module.js +0 -6
  195. package/public/cli/commands/database-transfer.d.ts +8 -0
  196. package/public/cli/commands/database-transfer.js +427 -0
  197. package/public/cli/commands/database.js +0 -4
  198. package/public/cli/commands/default-privilege.js +0 -4
  199. package/public/cli/commands/denormalized-table-field.js +0 -2
  200. package/public/cli/commands/emails-module.js +0 -2
  201. package/public/cli/commands/embedding-chunk.d.ts +8 -0
  202. package/public/cli/commands/embedding-chunk.js +515 -0
  203. package/public/cli/commands/encrypted-secrets-module.js +0 -2
  204. package/public/cli/commands/enum.d.ts +8 -0
  205. package/public/cli/commands/{uuid-module.js → enum.js} +175 -33
  206. package/public/cli/commands/field-module.js +0 -2
  207. package/public/cli/commands/field.js +21 -7
  208. package/public/cli/commands/foreign-key-constraint.js +0 -7
  209. package/public/cli/commands/hierarchy-module.js +0 -11
  210. package/public/cli/commands/index.js +0 -4
  211. package/public/cli/commands/invite.js +0 -2
  212. package/public/cli/commands/invites-module.js +0 -5
  213. package/public/cli/commands/levels-module.js +0 -16
  214. package/public/cli/commands/limits-module.js +0 -10
  215. package/public/cli/commands/membership-type.js +0 -3
  216. package/public/cli/commands/membership-types-module.js +0 -2
  217. package/public/cli/commands/memberships-module.js +0 -13
  218. package/public/cli/commands/node-type-registry.js +0 -6
  219. package/public/cli/commands/org-chart-edge-grant.js +3 -3
  220. package/public/cli/commands/org-chart-edge.js +0 -2
  221. package/public/cli/commands/org-invite.js +0 -2
  222. package/public/cli/commands/org-permission.js +0 -2
  223. package/public/cli/commands/permissions-module.js +0 -8
  224. package/public/cli/commands/phone-number.js +0 -3
  225. package/public/cli/commands/phone-numbers-module.js +0 -2
  226. package/public/cli/commands/policy.js +0 -6
  227. package/public/cli/commands/primary-key-constraint.js +0 -4
  228. package/public/cli/commands/profiles-module.js +0 -6
  229. package/public/cli/commands/ref.js +0 -2
  230. package/public/cli/commands/reject-database-transfer.d.ts +8 -0
  231. package/public/cli/commands/reject-database-transfer.js +36 -0
  232. package/public/cli/commands/relation-provision.js +63 -11
  233. package/public/cli/commands/rls-module.js +0 -5
  234. package/public/cli/commands/schema-grant.js +0 -2
  235. package/public/cli/commands/schema.js +0 -6
  236. package/public/cli/commands/secrets-module.js +0 -2
  237. package/public/cli/commands/secure-table-provision.js +0 -6
  238. package/public/cli/commands/sessions-module.js +0 -4
  239. package/public/cli/commands/site-metadatum.js +0 -3
  240. package/public/cli/commands/site-module.js +0 -2
  241. package/public/cli/commands/site.js +0 -4
  242. package/public/cli/commands/sql-migration.js +0 -7
  243. package/public/cli/commands/store.js +0 -2
  244. package/public/cli/commands/table-grant.js +0 -3
  245. package/public/cli/commands/table-template-module.js +0 -3
  246. package/public/cli/commands/table.js +0 -7
  247. package/public/cli/commands/trigger-function.js +0 -3
  248. package/public/cli/commands/trigger.js +0 -5
  249. package/public/cli/commands/unique-constraint.js +0 -5
  250. package/public/cli/commands/user-auth-module.js +0 -17
  251. package/public/cli/commands/users-module.js +0 -3
  252. package/public/cli/commands/view-grant.js +0 -3
  253. package/public/cli/commands/view-rule.js +0 -4
  254. package/public/cli/commands/view.js +0 -5
  255. package/public/cli/commands.js +53 -35
  256. package/public/cli/executor.d.ts +68 -39
  257. package/public/orm/index.d.ts +81 -48
  258. package/public/orm/index.js +26 -18
  259. package/public/orm/input-types.d.ts +2447 -2980
  260. package/public/orm/input-types.js +26 -1
  261. package/public/orm/models/blueprint.d.ts +56 -0
  262. package/public/orm/models/blueprint.js +98 -0
  263. package/public/orm/models/blueprintTemplate.d.ts +56 -0
  264. package/public/orm/models/blueprintTemplate.js +98 -0
  265. package/public/orm/models/databaseTransfer.d.ts +56 -0
  266. package/public/orm/models/databaseTransfer.js +98 -0
  267. package/public/orm/models/embeddingChunk.d.ts +56 -0
  268. package/public/orm/models/embeddingChunk.js +98 -0
  269. package/public/orm/models/enum.d.ts +56 -0
  270. package/public/orm/models/{uuidModule.js → enum.js} +25 -25
  271. package/public/orm/models/index.d.ts +13 -9
  272. package/public/orm/models/index.js +29 -21
  273. package/public/orm/mutation/index.d.ts +98 -50
  274. package/public/orm/mutation/index.js +126 -66
  275. package/esm/public/orm/models/uuidModule.d.ts +0 -56
  276. package/public/orm/models/uuidModule.d.ts +0 -56
@@ -0,0 +1,549 @@
1
+ /**
2
+ * CLI commands for BlueprintTemplate
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, stripUndefined } from '../utils';
9
+ const fieldSchema = {
10
+ id: 'uuid',
11
+ name: 'string',
12
+ version: 'string',
13
+ displayName: 'string',
14
+ description: 'string',
15
+ ownerId: 'uuid',
16
+ visibility: 'string',
17
+ categories: 'string',
18
+ tags: 'string',
19
+ definition: 'json',
20
+ definitionSchemaVersion: 'string',
21
+ source: 'string',
22
+ complexity: 'string',
23
+ copyCount: 'int',
24
+ forkCount: 'int',
25
+ forkedFromId: 'uuid',
26
+ definitionHash: 'uuid',
27
+ tableHashes: 'json',
28
+ createdAt: 'string',
29
+ updatedAt: 'string',
30
+ };
31
+ const usage = '\nblueprint-template <command>\n\nCommands:\n list List all blueprintTemplate records\n get Get a blueprintTemplate by ID\n create Create a new blueprintTemplate\n update Update an existing blueprintTemplate\n delete Delete a blueprintTemplate\n\n --help, -h Show this help message\n';
32
+ export 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 } = 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', '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 '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 client = getClient();
71
+ const result = await client.blueprintTemplate
72
+ .findMany({
73
+ select: {
74
+ id: true,
75
+ name: true,
76
+ version: true,
77
+ displayName: true,
78
+ description: true,
79
+ ownerId: true,
80
+ visibility: true,
81
+ categories: true,
82
+ tags: true,
83
+ definition: true,
84
+ definitionSchemaVersion: true,
85
+ source: true,
86
+ complexity: true,
87
+ copyCount: true,
88
+ forkCount: true,
89
+ forkedFromId: true,
90
+ definitionHash: true,
91
+ tableHashes: true,
92
+ createdAt: true,
93
+ updatedAt: true,
94
+ },
95
+ })
96
+ .execute();
97
+ console.log(JSON.stringify(result, null, 2));
98
+ }
99
+ catch (error) {
100
+ console.error('Failed to list records.');
101
+ if (error instanceof Error) {
102
+ console.error(error.message);
103
+ }
104
+ process.exit(1);
105
+ }
106
+ }
107
+ async function handleGet(argv, prompter) {
108
+ try {
109
+ const answers = await prompter.prompt(argv, [
110
+ {
111
+ type: 'text',
112
+ name: 'id',
113
+ message: 'id',
114
+ required: true,
115
+ },
116
+ ]);
117
+ const client = getClient();
118
+ const result = await client.blueprintTemplate
119
+ .findOne({
120
+ id: answers.id,
121
+ select: {
122
+ id: true,
123
+ name: true,
124
+ version: true,
125
+ displayName: true,
126
+ description: true,
127
+ ownerId: true,
128
+ visibility: true,
129
+ categories: true,
130
+ tags: true,
131
+ definition: true,
132
+ definitionSchemaVersion: true,
133
+ source: true,
134
+ complexity: true,
135
+ copyCount: true,
136
+ forkCount: true,
137
+ forkedFromId: true,
138
+ definitionHash: true,
139
+ tableHashes: true,
140
+ createdAt: true,
141
+ updatedAt: true,
142
+ },
143
+ })
144
+ .execute();
145
+ console.log(JSON.stringify(result, null, 2));
146
+ }
147
+ catch (error) {
148
+ console.error('Record not found.');
149
+ if (error instanceof Error) {
150
+ console.error(error.message);
151
+ }
152
+ process.exit(1);
153
+ }
154
+ }
155
+ async function handleCreate(argv, prompter) {
156
+ try {
157
+ const rawAnswers = await prompter.prompt(argv, [
158
+ {
159
+ type: 'text',
160
+ name: 'name',
161
+ message: 'name',
162
+ required: true,
163
+ },
164
+ {
165
+ type: 'text',
166
+ name: 'version',
167
+ message: 'version',
168
+ required: false,
169
+ skipPrompt: true,
170
+ },
171
+ {
172
+ type: 'text',
173
+ name: 'displayName',
174
+ message: 'displayName',
175
+ required: true,
176
+ },
177
+ {
178
+ type: 'text',
179
+ name: 'description',
180
+ message: 'description',
181
+ required: false,
182
+ skipPrompt: true,
183
+ },
184
+ {
185
+ type: 'text',
186
+ name: 'ownerId',
187
+ message: 'ownerId',
188
+ required: true,
189
+ },
190
+ {
191
+ type: 'text',
192
+ name: 'visibility',
193
+ message: 'visibility',
194
+ required: false,
195
+ skipPrompt: true,
196
+ },
197
+ {
198
+ type: 'text',
199
+ name: 'categories',
200
+ message: 'categories',
201
+ required: false,
202
+ skipPrompt: true,
203
+ },
204
+ {
205
+ type: 'text',
206
+ name: 'tags',
207
+ message: 'tags',
208
+ required: false,
209
+ skipPrompt: true,
210
+ },
211
+ {
212
+ type: 'json',
213
+ name: 'definition',
214
+ message: 'definition',
215
+ required: true,
216
+ },
217
+ {
218
+ type: 'text',
219
+ name: 'definitionSchemaVersion',
220
+ message: 'definitionSchemaVersion',
221
+ required: false,
222
+ skipPrompt: true,
223
+ },
224
+ {
225
+ type: 'text',
226
+ name: 'source',
227
+ message: 'source',
228
+ required: false,
229
+ skipPrompt: true,
230
+ },
231
+ {
232
+ type: 'text',
233
+ name: 'complexity',
234
+ message: 'complexity',
235
+ required: false,
236
+ skipPrompt: true,
237
+ },
238
+ {
239
+ type: 'text',
240
+ name: 'copyCount',
241
+ message: 'copyCount',
242
+ required: false,
243
+ skipPrompt: true,
244
+ },
245
+ {
246
+ type: 'text',
247
+ name: 'forkCount',
248
+ message: 'forkCount',
249
+ required: false,
250
+ skipPrompt: true,
251
+ },
252
+ {
253
+ type: 'text',
254
+ name: 'forkedFromId',
255
+ message: 'forkedFromId',
256
+ required: false,
257
+ skipPrompt: true,
258
+ },
259
+ {
260
+ type: 'text',
261
+ name: 'definitionHash',
262
+ message: 'definitionHash',
263
+ required: false,
264
+ skipPrompt: true,
265
+ },
266
+ {
267
+ type: 'json',
268
+ name: 'tableHashes',
269
+ message: 'tableHashes',
270
+ required: false,
271
+ skipPrompt: true,
272
+ },
273
+ ]);
274
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
275
+ const cleanedData = stripUndefined(answers, fieldSchema);
276
+ const client = getClient();
277
+ const result = await client.blueprintTemplate
278
+ .create({
279
+ data: {
280
+ name: cleanedData.name,
281
+ version: cleanedData.version,
282
+ displayName: cleanedData.displayName,
283
+ description: cleanedData.description,
284
+ ownerId: cleanedData.ownerId,
285
+ visibility: cleanedData.visibility,
286
+ categories: cleanedData.categories,
287
+ tags: cleanedData.tags,
288
+ definition: cleanedData.definition,
289
+ definitionSchemaVersion: cleanedData.definitionSchemaVersion,
290
+ source: cleanedData.source,
291
+ complexity: cleanedData.complexity,
292
+ copyCount: cleanedData.copyCount,
293
+ forkCount: cleanedData.forkCount,
294
+ forkedFromId: cleanedData.forkedFromId,
295
+ definitionHash: cleanedData.definitionHash,
296
+ tableHashes: cleanedData.tableHashes,
297
+ },
298
+ select: {
299
+ id: true,
300
+ name: true,
301
+ version: true,
302
+ displayName: true,
303
+ description: true,
304
+ ownerId: true,
305
+ visibility: true,
306
+ categories: true,
307
+ tags: true,
308
+ definition: true,
309
+ definitionSchemaVersion: true,
310
+ source: true,
311
+ complexity: true,
312
+ copyCount: true,
313
+ forkCount: true,
314
+ forkedFromId: true,
315
+ definitionHash: true,
316
+ tableHashes: true,
317
+ createdAt: true,
318
+ updatedAt: true,
319
+ },
320
+ })
321
+ .execute();
322
+ console.log(JSON.stringify(result, null, 2));
323
+ }
324
+ catch (error) {
325
+ console.error('Failed to create record.');
326
+ if (error instanceof Error) {
327
+ console.error(error.message);
328
+ }
329
+ process.exit(1);
330
+ }
331
+ }
332
+ async function handleUpdate(argv, prompter) {
333
+ try {
334
+ const rawAnswers = await prompter.prompt(argv, [
335
+ {
336
+ type: 'text',
337
+ name: 'id',
338
+ message: 'id',
339
+ required: true,
340
+ },
341
+ {
342
+ type: 'text',
343
+ name: 'name',
344
+ message: 'name',
345
+ required: false,
346
+ },
347
+ {
348
+ type: 'text',
349
+ name: 'version',
350
+ message: 'version',
351
+ required: false,
352
+ skipPrompt: true,
353
+ },
354
+ {
355
+ type: 'text',
356
+ name: 'displayName',
357
+ message: 'displayName',
358
+ required: false,
359
+ },
360
+ {
361
+ type: 'text',
362
+ name: 'description',
363
+ message: 'description',
364
+ required: false,
365
+ skipPrompt: true,
366
+ },
367
+ {
368
+ type: 'text',
369
+ name: 'ownerId',
370
+ message: 'ownerId',
371
+ required: false,
372
+ },
373
+ {
374
+ type: 'text',
375
+ name: 'visibility',
376
+ message: 'visibility',
377
+ required: false,
378
+ skipPrompt: true,
379
+ },
380
+ {
381
+ type: 'text',
382
+ name: 'categories',
383
+ message: 'categories',
384
+ required: false,
385
+ skipPrompt: true,
386
+ },
387
+ {
388
+ type: 'text',
389
+ name: 'tags',
390
+ message: 'tags',
391
+ required: false,
392
+ skipPrompt: true,
393
+ },
394
+ {
395
+ type: 'json',
396
+ name: 'definition',
397
+ message: 'definition',
398
+ required: false,
399
+ },
400
+ {
401
+ type: 'text',
402
+ name: 'definitionSchemaVersion',
403
+ message: 'definitionSchemaVersion',
404
+ required: false,
405
+ skipPrompt: true,
406
+ },
407
+ {
408
+ type: 'text',
409
+ name: 'source',
410
+ message: 'source',
411
+ required: false,
412
+ skipPrompt: true,
413
+ },
414
+ {
415
+ type: 'text',
416
+ name: 'complexity',
417
+ message: 'complexity',
418
+ required: false,
419
+ skipPrompt: true,
420
+ },
421
+ {
422
+ type: 'text',
423
+ name: 'copyCount',
424
+ message: 'copyCount',
425
+ required: false,
426
+ skipPrompt: true,
427
+ },
428
+ {
429
+ type: 'text',
430
+ name: 'forkCount',
431
+ message: 'forkCount',
432
+ required: false,
433
+ skipPrompt: true,
434
+ },
435
+ {
436
+ type: 'text',
437
+ name: 'forkedFromId',
438
+ message: 'forkedFromId',
439
+ required: false,
440
+ skipPrompt: true,
441
+ },
442
+ {
443
+ type: 'text',
444
+ name: 'definitionHash',
445
+ message: 'definitionHash',
446
+ required: false,
447
+ skipPrompt: true,
448
+ },
449
+ {
450
+ type: 'json',
451
+ name: 'tableHashes',
452
+ message: 'tableHashes',
453
+ required: false,
454
+ skipPrompt: true,
455
+ },
456
+ ]);
457
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
458
+ const cleanedData = stripUndefined(answers, fieldSchema);
459
+ const client = getClient();
460
+ const result = await client.blueprintTemplate
461
+ .update({
462
+ where: {
463
+ id: answers.id,
464
+ },
465
+ data: {
466
+ name: cleanedData.name,
467
+ version: cleanedData.version,
468
+ displayName: cleanedData.displayName,
469
+ description: cleanedData.description,
470
+ ownerId: cleanedData.ownerId,
471
+ visibility: cleanedData.visibility,
472
+ categories: cleanedData.categories,
473
+ tags: cleanedData.tags,
474
+ definition: cleanedData.definition,
475
+ definitionSchemaVersion: cleanedData.definitionSchemaVersion,
476
+ source: cleanedData.source,
477
+ complexity: cleanedData.complexity,
478
+ copyCount: cleanedData.copyCount,
479
+ forkCount: cleanedData.forkCount,
480
+ forkedFromId: cleanedData.forkedFromId,
481
+ definitionHash: cleanedData.definitionHash,
482
+ tableHashes: cleanedData.tableHashes,
483
+ },
484
+ select: {
485
+ id: true,
486
+ name: true,
487
+ version: true,
488
+ displayName: true,
489
+ description: true,
490
+ ownerId: true,
491
+ visibility: true,
492
+ categories: true,
493
+ tags: true,
494
+ definition: true,
495
+ definitionSchemaVersion: true,
496
+ source: true,
497
+ complexity: true,
498
+ copyCount: true,
499
+ forkCount: true,
500
+ forkedFromId: true,
501
+ definitionHash: true,
502
+ tableHashes: true,
503
+ createdAt: true,
504
+ updatedAt: true,
505
+ },
506
+ })
507
+ .execute();
508
+ console.log(JSON.stringify(result, null, 2));
509
+ }
510
+ catch (error) {
511
+ console.error('Failed to update record.');
512
+ if (error instanceof Error) {
513
+ console.error(error.message);
514
+ }
515
+ process.exit(1);
516
+ }
517
+ }
518
+ async function handleDelete(argv, prompter) {
519
+ try {
520
+ const rawAnswers = await prompter.prompt(argv, [
521
+ {
522
+ type: 'text',
523
+ name: 'id',
524
+ message: 'id',
525
+ required: true,
526
+ },
527
+ ]);
528
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
529
+ const client = getClient();
530
+ const result = await client.blueprintTemplate
531
+ .delete({
532
+ where: {
533
+ id: answers.id,
534
+ },
535
+ select: {
536
+ id: true,
537
+ },
538
+ })
539
+ .execute();
540
+ console.log(JSON.stringify(result, null, 2));
541
+ }
542
+ catch (error) {
543
+ console.error('Failed to delete record.');
544
+ if (error instanceof Error) {
545
+ console.error(error.message);
546
+ }
547
+ process.exit(1);
548
+ }
549
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CLI commands for UuidModule
2
+ * CLI commands for Blueprint
3
3
  * @generated by @constructive-io/graphql-codegen
4
4
  * DO NOT EDIT - changes will be overwritten
5
5
  */