@constructive-sdk/cli 0.12.7 → 0.12.8

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 (333) hide show
  1. package/admin/cli/commands/app-achievement.js +38 -15
  2. package/admin/cli/commands/app-admin-grant.js +38 -15
  3. package/admin/cli/commands/app-grant.js +40 -16
  4. package/admin/cli/commands/app-level-requirement.js +42 -17
  5. package/admin/cli/commands/app-level.js +40 -16
  6. package/admin/cli/commands/app-limit-default.js +32 -12
  7. package/admin/cli/commands/app-limit.js +36 -14
  8. package/admin/cli/commands/app-membership-default.js +40 -16
  9. package/admin/cli/commands/app-membership.js +58 -25
  10. package/admin/cli/commands/app-owner-grant.js +38 -15
  11. package/admin/cli/commands/app-permission-default.js +30 -11
  12. package/admin/cli/commands/app-permission.js +36 -14
  13. package/admin/cli/commands/app-step.js +38 -15
  14. package/admin/cli/commands/claimed-invite.js +38 -15
  15. package/admin/cli/commands/invite.js +50 -21
  16. package/admin/cli/commands/membership-type.js +34 -13
  17. package/admin/cli/commands/org-admin-grant.js +40 -16
  18. package/admin/cli/commands/org-chart-edge-grant.js +44 -18
  19. package/admin/cli/commands/org-chart-edge.js +42 -17
  20. package/admin/cli/commands/org-claimed-invite.js +40 -16
  21. package/admin/cli/commands/org-get-managers-record.js +30 -11
  22. package/admin/cli/commands/org-get-subordinates-record.js +30 -11
  23. package/admin/cli/commands/org-grant.js +42 -17
  24. package/admin/cli/commands/org-invite.js +54 -23
  25. package/admin/cli/commands/org-limit-default.js +32 -12
  26. package/admin/cli/commands/org-limit.js +38 -15
  27. package/admin/cli/commands/org-member.js +34 -13
  28. package/admin/cli/commands/org-membership-default.js +44 -18
  29. package/admin/cli/commands/org-membership.js +58 -25
  30. package/admin/cli/commands/org-owner-grant.js +40 -16
  31. package/admin/cli/commands/org-permission-default.js +32 -12
  32. package/admin/cli/commands/org-permission.js +36 -14
  33. package/admin/cli/utils.d.ts +38 -0
  34. package/admin/cli/utils.js +96 -0
  35. package/auth/cli/commands/audit-log.js +42 -17
  36. package/auth/cli/commands/connected-account.js +42 -17
  37. package/auth/cli/commands/crypto-address.js +40 -16
  38. package/auth/cli/commands/email.js +40 -16
  39. package/auth/cli/commands/phone-number.js +42 -17
  40. package/auth/cli/commands/role-type.js +30 -11
  41. package/auth/cli/commands/user.js +80 -16
  42. package/auth/cli/utils.d.ts +38 -0
  43. package/auth/cli/utils.js +96 -0
  44. package/esm/admin/cli/commands/app-achievement.js +39 -16
  45. package/esm/admin/cli/commands/app-admin-grant.js +39 -16
  46. package/esm/admin/cli/commands/app-grant.js +41 -17
  47. package/esm/admin/cli/commands/app-level-requirement.js +43 -18
  48. package/esm/admin/cli/commands/app-level.js +41 -17
  49. package/esm/admin/cli/commands/app-limit-default.js +33 -13
  50. package/esm/admin/cli/commands/app-limit.js +37 -15
  51. package/esm/admin/cli/commands/app-membership-default.js +41 -17
  52. package/esm/admin/cli/commands/app-membership.js +59 -26
  53. package/esm/admin/cli/commands/app-owner-grant.js +39 -16
  54. package/esm/admin/cli/commands/app-permission-default.js +31 -12
  55. package/esm/admin/cli/commands/app-permission.js +37 -15
  56. package/esm/admin/cli/commands/app-step.js +39 -16
  57. package/esm/admin/cli/commands/claimed-invite.js +39 -16
  58. package/esm/admin/cli/commands/invite.js +51 -22
  59. package/esm/admin/cli/commands/membership-type.js +35 -14
  60. package/esm/admin/cli/commands/org-admin-grant.js +41 -17
  61. package/esm/admin/cli/commands/org-chart-edge-grant.js +45 -19
  62. package/esm/admin/cli/commands/org-chart-edge.js +43 -18
  63. package/esm/admin/cli/commands/org-claimed-invite.js +41 -17
  64. package/esm/admin/cli/commands/org-get-managers-record.js +31 -12
  65. package/esm/admin/cli/commands/org-get-subordinates-record.js +31 -12
  66. package/esm/admin/cli/commands/org-grant.js +43 -18
  67. package/esm/admin/cli/commands/org-invite.js +55 -24
  68. package/esm/admin/cli/commands/org-limit-default.js +33 -13
  69. package/esm/admin/cli/commands/org-limit.js +39 -16
  70. package/esm/admin/cli/commands/org-member.js +35 -14
  71. package/esm/admin/cli/commands/org-membership-default.js +45 -19
  72. package/esm/admin/cli/commands/org-membership.js +59 -26
  73. package/esm/admin/cli/commands/org-owner-grant.js +41 -17
  74. package/esm/admin/cli/commands/org-permission-default.js +33 -13
  75. package/esm/admin/cli/commands/org-permission.js +37 -15
  76. package/esm/admin/cli/utils.d.ts +38 -0
  77. package/esm/admin/cli/utils.js +90 -0
  78. package/esm/auth/cli/commands/audit-log.js +43 -18
  79. package/esm/auth/cli/commands/connected-account.js +43 -18
  80. package/esm/auth/cli/commands/crypto-address.js +41 -17
  81. package/esm/auth/cli/commands/email.js +41 -17
  82. package/esm/auth/cli/commands/phone-number.js +43 -18
  83. package/esm/auth/cli/commands/role-type.js +31 -12
  84. package/esm/auth/cli/commands/user.js +81 -17
  85. package/esm/auth/cli/utils.d.ts +38 -0
  86. package/esm/auth/cli/utils.js +90 -0
  87. package/esm/objects/cli/commands/commit.js +45 -19
  88. package/esm/objects/cli/commands/get-all-record.js +31 -12
  89. package/esm/objects/cli/commands/object.js +41 -17
  90. package/esm/objects/cli/commands/ref.js +37 -15
  91. package/esm/objects/cli/commands/store.js +37 -15
  92. package/esm/objects/cli/utils.d.ts +38 -0
  93. package/esm/objects/cli/utils.js +90 -0
  94. package/esm/public/cli/commands/api-module.js +37 -15
  95. package/esm/public/cli/commands/api-schema.js +35 -14
  96. package/esm/public/cli/commands/api.js +41 -17
  97. package/esm/public/cli/commands/app-achievement.js +39 -16
  98. package/esm/public/cli/commands/app-admin-grant.js +39 -16
  99. package/esm/public/cli/commands/app-grant.js +41 -17
  100. package/esm/public/cli/commands/app-level-requirement.js +43 -18
  101. package/esm/public/cli/commands/app-level.js +41 -17
  102. package/esm/public/cli/commands/app-limit-default.js +33 -13
  103. package/esm/public/cli/commands/app-limit.js +37 -15
  104. package/esm/public/cli/commands/app-membership-default.js +41 -17
  105. package/esm/public/cli/commands/app-membership.js +59 -26
  106. package/esm/public/cli/commands/app-owner-grant.js +39 -16
  107. package/esm/public/cli/commands/app-permission-default.js +31 -12
  108. package/esm/public/cli/commands/app-permission.js +37 -15
  109. package/esm/public/cli/commands/app-step.js +39 -16
  110. package/esm/public/cli/commands/app.js +45 -19
  111. package/esm/public/cli/commands/ast-migration.js +53 -23
  112. package/esm/public/cli/commands/audit-log.js +43 -18
  113. package/esm/public/cli/commands/blueprint-template.js +67 -30
  114. package/esm/public/cli/commands/blueprint.js +61 -27
  115. package/esm/public/cli/commands/check-constraint.js +55 -24
  116. package/esm/public/cli/commands/claimed-invite.js +39 -16
  117. package/esm/public/cli/commands/commit.js +45 -19
  118. package/esm/public/cli/commands/connected-account.js +43 -18
  119. package/esm/public/cli/commands/connected-accounts-module.js +41 -17
  120. package/esm/public/cli/commands/crypto-address.js +41 -17
  121. package/esm/public/cli/commands/crypto-addresses-module.js +43 -18
  122. package/esm/public/cli/commands/crypto-auth-module.js +55 -24
  123. package/esm/public/cli/commands/database-provision-module.js +55 -24
  124. package/esm/public/cli/commands/database-transfer.js +55 -24
  125. package/esm/public/cli/commands/database.js +43 -18
  126. package/esm/public/cli/commands/default-ids-module.js +31 -12
  127. package/esm/public/cli/commands/default-privilege.js +41 -17
  128. package/esm/public/cli/commands/denormalized-table-field.js +51 -22
  129. package/esm/public/cli/commands/domain.js +39 -16
  130. package/esm/public/cli/commands/email.js +41 -17
  131. package/esm/public/cli/commands/emails-module.js +41 -17
  132. package/esm/public/cli/commands/embedding-chunk.js +63 -28
  133. package/esm/public/cli/commands/encrypted-secrets-module.js +37 -15
  134. package/esm/public/cli/commands/enum.js +51 -22
  135. package/esm/public/cli/commands/field.js +75 -34
  136. package/esm/public/cli/commands/foreign-key-constraint.js +63 -28
  137. package/esm/public/cli/commands/full-text-search.js +45 -19
  138. package/esm/public/cli/commands/get-all-record.js +31 -12
  139. package/esm/public/cli/commands/hierarchy-module.js +67 -30
  140. package/esm/public/cli/commands/index.js +65 -29
  141. package/esm/public/cli/commands/invite.js +51 -22
  142. package/esm/public/cli/commands/invites-module.js +55 -24
  143. package/esm/public/cli/commands/levels-module.js +79 -36
  144. package/esm/public/cli/commands/limits-module.js +63 -28
  145. package/esm/public/cli/commands/membership-type.js +35 -14
  146. package/esm/public/cli/commands/membership-types-module.js +37 -15
  147. package/esm/public/cli/commands/memberships-module.js +89 -41
  148. package/esm/public/cli/commands/migrate-file.js +33 -13
  149. package/esm/public/cli/commands/node-type-registry.js +89 -19
  150. package/esm/public/cli/commands/object.js +41 -17
  151. package/esm/public/cli/commands/org-admin-grant.js +41 -17
  152. package/esm/public/cli/commands/org-chart-edge-grant.js +45 -19
  153. package/esm/public/cli/commands/org-chart-edge.js +43 -18
  154. package/esm/public/cli/commands/org-claimed-invite.js +41 -17
  155. package/esm/public/cli/commands/org-get-managers-record.js +31 -12
  156. package/esm/public/cli/commands/org-get-subordinates-record.js +31 -12
  157. package/esm/public/cli/commands/org-grant.js +43 -18
  158. package/esm/public/cli/commands/org-invite.js +55 -24
  159. package/esm/public/cli/commands/org-limit-default.js +33 -13
  160. package/esm/public/cli/commands/org-limit.js +39 -16
  161. package/esm/public/cli/commands/org-member.js +35 -14
  162. package/esm/public/cli/commands/org-membership-default.js +45 -19
  163. package/esm/public/cli/commands/org-membership.js +59 -26
  164. package/esm/public/cli/commands/org-owner-grant.js +41 -17
  165. package/esm/public/cli/commands/org-permission-default.js +33 -13
  166. package/esm/public/cli/commands/org-permission.js +37 -15
  167. package/esm/public/cli/commands/permissions-module.js +61 -27
  168. package/esm/public/cli/commands/phone-number.js +43 -18
  169. package/esm/public/cli/commands/phone-numbers-module.js +41 -17
  170. package/esm/public/cli/commands/policy.js +61 -27
  171. package/esm/public/cli/commands/primary-key-constraint.js +53 -23
  172. package/esm/public/cli/commands/profiles-module.js +63 -28
  173. package/esm/public/cli/commands/ref.js +37 -15
  174. package/esm/public/cli/commands/relation-provision.js +89 -41
  175. package/esm/public/cli/commands/rls-module.js +49 -21
  176. package/esm/public/cli/commands/role-type.js +31 -12
  177. package/esm/public/cli/commands/schema-grant.js +39 -16
  178. package/esm/public/cli/commands/schema.js +55 -24
  179. package/esm/public/cli/commands/secrets-module.js +37 -15
  180. package/esm/public/cli/commands/secure-table-provision.js +63 -28
  181. package/esm/public/cli/commands/sessions-module.js +49 -21
  182. package/esm/public/cli/commands/site-metadatum.js +39 -16
  183. package/esm/public/cli/commands/site-module.js +37 -15
  184. package/esm/public/cli/commands/site-theme.js +35 -14
  185. package/esm/public/cli/commands/site.js +45 -19
  186. package/esm/public/cli/commands/sql-action.js +53 -23
  187. package/esm/public/cli/commands/store.js +37 -15
  188. package/esm/public/cli/commands/table-grant.js +45 -19
  189. package/esm/public/cli/commands/table-template-module.js +45 -19
  190. package/esm/public/cli/commands/table.js +65 -29
  191. package/esm/public/cli/commands/trigger-function.js +39 -16
  192. package/esm/public/cli/commands/trigger.js +53 -23
  193. package/esm/public/cli/commands/unique-constraint.js +55 -24
  194. package/esm/public/cli/commands/user-auth-module.js +79 -36
  195. package/esm/public/cli/commands/user.js +81 -17
  196. package/esm/public/cli/commands/users-module.js +41 -17
  197. package/esm/public/cli/commands/view-grant.js +41 -17
  198. package/esm/public/cli/commands/view-rule.js +39 -16
  199. package/esm/public/cli/commands/view-table.js +35 -14
  200. package/esm/public/cli/commands/view.js +59 -26
  201. package/esm/public/cli/commands.js +3 -3
  202. package/esm/public/cli/executor.d.ts +1 -1
  203. package/esm/public/cli/utils.d.ts +38 -0
  204. package/esm/public/cli/utils.js +90 -0
  205. package/esm/public/orm/index.d.ts +2 -2
  206. package/esm/public/orm/index.js +2 -2
  207. package/esm/public/orm/input-types.d.ts +161 -147
  208. package/esm/public/orm/models/index.d.ts +1 -1
  209. package/esm/public/orm/models/index.js +1 -1
  210. package/objects/cli/commands/commit.js +44 -18
  211. package/objects/cli/commands/get-all-record.js +30 -11
  212. package/objects/cli/commands/object.js +40 -16
  213. package/objects/cli/commands/ref.js +36 -14
  214. package/objects/cli/commands/store.js +36 -14
  215. package/objects/cli/utils.d.ts +38 -0
  216. package/objects/cli/utils.js +96 -0
  217. package/package.json +3 -3
  218. package/public/cli/commands/api-module.js +36 -14
  219. package/public/cli/commands/api-schema.js +34 -13
  220. package/public/cli/commands/api.js +40 -16
  221. package/public/cli/commands/app-achievement.js +38 -15
  222. package/public/cli/commands/app-admin-grant.js +38 -15
  223. package/public/cli/commands/app-grant.js +40 -16
  224. package/public/cli/commands/app-level-requirement.js +42 -17
  225. package/public/cli/commands/app-level.js +40 -16
  226. package/public/cli/commands/app-limit-default.js +32 -12
  227. package/public/cli/commands/app-limit.js +36 -14
  228. package/public/cli/commands/app-membership-default.js +40 -16
  229. package/public/cli/commands/app-membership.js +58 -25
  230. package/public/cli/commands/app-owner-grant.js +38 -15
  231. package/public/cli/commands/app-permission-default.js +30 -11
  232. package/public/cli/commands/app-permission.js +36 -14
  233. package/public/cli/commands/app-step.js +38 -15
  234. package/public/cli/commands/app.js +44 -18
  235. package/public/cli/commands/ast-migration.js +52 -22
  236. package/public/cli/commands/audit-log.js +42 -17
  237. package/public/cli/commands/blueprint-template.js +66 -29
  238. package/public/cli/commands/blueprint.js +60 -26
  239. package/public/cli/commands/check-constraint.js +54 -23
  240. package/public/cli/commands/claimed-invite.js +38 -15
  241. package/public/cli/commands/commit.js +44 -18
  242. package/public/cli/commands/connected-account.js +42 -17
  243. package/public/cli/commands/connected-accounts-module.js +40 -16
  244. package/public/cli/commands/crypto-address.js +40 -16
  245. package/public/cli/commands/crypto-addresses-module.js +42 -17
  246. package/public/cli/commands/crypto-auth-module.js +54 -23
  247. package/public/cli/commands/database-provision-module.js +54 -23
  248. package/public/cli/commands/database-transfer.js +54 -23
  249. package/public/cli/commands/database.js +42 -17
  250. package/public/cli/commands/default-ids-module.js +30 -11
  251. package/public/cli/commands/default-privilege.js +40 -16
  252. package/public/cli/commands/denormalized-table-field.js +50 -21
  253. package/public/cli/commands/domain.js +38 -15
  254. package/public/cli/commands/email.js +40 -16
  255. package/public/cli/commands/emails-module.js +40 -16
  256. package/public/cli/commands/embedding-chunk.js +62 -27
  257. package/public/cli/commands/encrypted-secrets-module.js +36 -14
  258. package/public/cli/commands/enum.js +50 -21
  259. package/public/cli/commands/field.js +74 -33
  260. package/public/cli/commands/foreign-key-constraint.js +62 -27
  261. package/public/cli/commands/full-text-search.js +44 -18
  262. package/public/cli/commands/get-all-record.js +30 -11
  263. package/public/cli/commands/hierarchy-module.js +66 -29
  264. package/public/cli/commands/index.js +64 -28
  265. package/public/cli/commands/invite.js +50 -21
  266. package/public/cli/commands/invites-module.js +54 -23
  267. package/public/cli/commands/levels-module.js +78 -35
  268. package/public/cli/commands/limits-module.js +62 -27
  269. package/public/cli/commands/membership-type.js +34 -13
  270. package/public/cli/commands/membership-types-module.js +36 -14
  271. package/public/cli/commands/memberships-module.js +88 -40
  272. package/public/cli/commands/migrate-file.js +32 -12
  273. package/public/cli/commands/node-type-registry.js +88 -18
  274. package/public/cli/commands/object.js +40 -16
  275. package/public/cli/commands/org-admin-grant.js +40 -16
  276. package/public/cli/commands/org-chart-edge-grant.js +44 -18
  277. package/public/cli/commands/org-chart-edge.js +42 -17
  278. package/public/cli/commands/org-claimed-invite.js +40 -16
  279. package/public/cli/commands/org-get-managers-record.js +30 -11
  280. package/public/cli/commands/org-get-subordinates-record.js +30 -11
  281. package/public/cli/commands/org-grant.js +42 -17
  282. package/public/cli/commands/org-invite.js +54 -23
  283. package/public/cli/commands/org-limit-default.js +32 -12
  284. package/public/cli/commands/org-limit.js +38 -15
  285. package/public/cli/commands/org-member.js +34 -13
  286. package/public/cli/commands/org-membership-default.js +44 -18
  287. package/public/cli/commands/org-membership.js +58 -25
  288. package/public/cli/commands/org-owner-grant.js +40 -16
  289. package/public/cli/commands/org-permission-default.js +32 -12
  290. package/public/cli/commands/org-permission.js +36 -14
  291. package/public/cli/commands/permissions-module.js +60 -26
  292. package/public/cli/commands/phone-number.js +42 -17
  293. package/public/cli/commands/phone-numbers-module.js +40 -16
  294. package/public/cli/commands/policy.js +60 -26
  295. package/public/cli/commands/primary-key-constraint.js +52 -22
  296. package/public/cli/commands/profiles-module.js +62 -27
  297. package/public/cli/commands/ref.js +36 -14
  298. package/public/cli/commands/relation-provision.js +88 -40
  299. package/public/cli/commands/rls-module.js +48 -20
  300. package/public/cli/commands/role-type.js +30 -11
  301. package/public/cli/commands/schema-grant.js +38 -15
  302. package/public/cli/commands/schema.js +54 -23
  303. package/public/cli/commands/secrets-module.js +36 -14
  304. package/public/cli/commands/secure-table-provision.js +62 -27
  305. package/public/cli/commands/sessions-module.js +48 -20
  306. package/public/cli/commands/site-metadatum.js +38 -15
  307. package/public/cli/commands/site-module.js +36 -14
  308. package/public/cli/commands/site-theme.js +34 -13
  309. package/public/cli/commands/site.js +44 -18
  310. package/public/cli/commands/sql-action.js +52 -22
  311. package/public/cli/commands/store.js +36 -14
  312. package/public/cli/commands/table-grant.js +44 -18
  313. package/public/cli/commands/table-template-module.js +44 -18
  314. package/public/cli/commands/table.js +64 -28
  315. package/public/cli/commands/trigger-function.js +38 -15
  316. package/public/cli/commands/trigger.js +52 -22
  317. package/public/cli/commands/unique-constraint.js +54 -23
  318. package/public/cli/commands/user-auth-module.js +78 -35
  319. package/public/cli/commands/user.js +80 -16
  320. package/public/cli/commands/users-module.js +40 -16
  321. package/public/cli/commands/view-grant.js +40 -16
  322. package/public/cli/commands/view-rule.js +38 -15
  323. package/public/cli/commands/view-table.js +34 -13
  324. package/public/cli/commands/view.js +58 -25
  325. package/public/cli/commands.js +3 -3
  326. package/public/cli/executor.d.ts +1 -1
  327. package/public/cli/utils.d.ts +38 -0
  328. package/public/cli/utils.js +96 -0
  329. package/public/orm/index.d.ts +2 -2
  330. package/public/orm/index.js +2 -2
  331. package/public/orm/input-types.d.ts +161 -147
  332. package/public/orm/models/index.d.ts +1 -1
  333. package/public/orm/models/index.js +4 -4
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { extractFirst } from 'inquirerer';
7
7
  import { getClient } from '../executor';
8
- import { coerceAnswers, stripUndefined } from '../utils';
8
+ import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
9
9
  const fieldSchema = {
10
10
  id: 'uuid',
11
11
  message: 'string',
@@ -17,7 +17,7 @@ const fieldSchema = {
17
17
  treeId: 'uuid',
18
18
  date: 'string',
19
19
  };
20
- const usage = '\ncommit <command>\n\nCommands:\n list List all commit records\n get Get a commit by ID\n create Create a new commit\n update Update an existing commit\n delete Delete a commit\n\n --help, -h Show this help message\n';
20
+ const usage = '\ncommit <command>\n\nCommands:\n list List commit records\n find-first Find first matching commit record\n get Get a commit by ID\n create Create a new commit\n update Update an existing commit\n delete Delete a commit\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\n --help, -h Show this help message\n';
21
21
  export default async (argv, prompter, _options) => {
22
22
  if (argv.help || argv.h) {
23
23
  console.log(usage);
@@ -30,7 +30,7 @@ export default async (argv, prompter, _options) => {
30
30
  type: 'autocomplete',
31
31
  name: 'subcommand',
32
32
  message: 'What do you want to do?',
33
- options: ['list', 'get', 'create', 'update', 'delete'],
33
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
34
34
  },
35
35
  ]);
36
36
  return handleTableSubcommand(answer.subcommand, newArgv, prompter);
@@ -41,6 +41,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
41
41
  switch (subcommand) {
42
42
  case 'list':
43
43
  return handleList(argv, prompter);
44
+ case 'find-first':
45
+ return handleFindFirst(argv, prompter);
44
46
  case 'get':
45
47
  return handleGet(argv, prompter);
46
48
  case 'create':
@@ -54,24 +56,22 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
54
56
  process.exit(1);
55
57
  }
56
58
  }
57
- async function handleList(_argv, _prompter) {
59
+ async function handleList(argv, _prompter) {
58
60
  try {
61
+ const defaultSelect = {
62
+ id: true,
63
+ message: true,
64
+ databaseId: true,
65
+ storeId: true,
66
+ parentIds: true,
67
+ authorId: true,
68
+ committerId: true,
69
+ treeId: true,
70
+ date: true,
71
+ };
72
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
59
73
  const client = getClient();
60
- const result = await client.commit
61
- .findMany({
62
- select: {
63
- id: true,
64
- message: true,
65
- databaseId: true,
66
- storeId: true,
67
- parentIds: true,
68
- authorId: true,
69
- committerId: true,
70
- treeId: true,
71
- date: true,
72
- },
73
- })
74
- .execute();
74
+ const result = await client.commit.findMany(findManyArgs).execute();
75
75
  console.log(JSON.stringify(result, null, 2));
76
76
  }
77
77
  catch (error) {
@@ -82,6 +82,32 @@ async function handleList(_argv, _prompter) {
82
82
  process.exit(1);
83
83
  }
84
84
  }
85
+ async function handleFindFirst(argv, _prompter) {
86
+ try {
87
+ const defaultSelect = {
88
+ id: true,
89
+ message: true,
90
+ databaseId: true,
91
+ storeId: true,
92
+ parentIds: true,
93
+ authorId: true,
94
+ committerId: true,
95
+ treeId: true,
96
+ date: true,
97
+ };
98
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
99
+ const client = getClient();
100
+ const result = await client.commit.findFirst(findFirstArgs).execute();
101
+ console.log(JSON.stringify(result, null, 2));
102
+ }
103
+ catch (error) {
104
+ console.error('Failed to find record.');
105
+ if (error instanceof Error) {
106
+ console.error(error.message);
107
+ }
108
+ process.exit(1);
109
+ }
110
+ }
85
111
  async function handleGet(argv, prompter) {
86
112
  try {
87
113
  const answers = await prompter.prompt(argv, [
@@ -5,12 +5,12 @@
5
5
  */
6
6
  import { extractFirst } from 'inquirerer';
7
7
  import { getClient } from '../executor';
8
- import { coerceAnswers, stripUndefined } from '../utils';
8
+ import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
9
9
  const fieldSchema = {
10
10
  path: 'string',
11
11
  data: 'json',
12
12
  };
13
- const usage = '\nget-all-record <command>\n\nCommands:\n list List all getAllRecord records\n create Create a new getAllRecord\n\n --help, -h Show this help message\n';
13
+ const usage = '\nget-all-record <command>\n\nCommands:\n list List getAllRecord records\n find-first Find first matching getAllRecord record\n create Create a new getAllRecord\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\n --help, -h Show this help message\n';
14
14
  export default async (argv, prompter, _options) => {
15
15
  if (argv.help || argv.h) {
16
16
  console.log(usage);
@@ -23,7 +23,7 @@ export default async (argv, prompter, _options) => {
23
23
  type: 'autocomplete',
24
24
  name: 'subcommand',
25
25
  message: 'What do you want to do?',
26
- options: ['list', 'create'],
26
+ options: ['list', 'find-first', 'create'],
27
27
  },
28
28
  ]);
29
29
  return handleTableSubcommand(answer.subcommand, newArgv, prompter);
@@ -34,6 +34,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
34
34
  switch (subcommand) {
35
35
  case 'list':
36
36
  return handleList(argv, prompter);
37
+ case 'find-first':
38
+ return handleFindFirst(argv, prompter);
37
39
  case 'create':
38
40
  return handleCreate(argv, prompter);
39
41
  default:
@@ -41,17 +43,15 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
41
43
  process.exit(1);
42
44
  }
43
45
  }
44
- async function handleList(_argv, _prompter) {
46
+ async function handleList(argv, _prompter) {
45
47
  try {
48
+ const defaultSelect = {
49
+ path: true,
50
+ data: true,
51
+ };
52
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
46
53
  const client = getClient();
47
- const result = await client.getAllRecord
48
- .findMany({
49
- select: {
50
- path: true,
51
- data: true,
52
- },
53
- })
54
- .execute();
54
+ const result = await client.getAllRecord.findMany(findManyArgs).execute();
55
55
  console.log(JSON.stringify(result, null, 2));
56
56
  }
57
57
  catch (error) {
@@ -62,6 +62,25 @@ async function handleList(_argv, _prompter) {
62
62
  process.exit(1);
63
63
  }
64
64
  }
65
+ async function handleFindFirst(argv, _prompter) {
66
+ try {
67
+ const defaultSelect = {
68
+ path: true,
69
+ data: true,
70
+ };
71
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
72
+ const client = getClient();
73
+ const result = await client.getAllRecord.findFirst(findFirstArgs).execute();
74
+ console.log(JSON.stringify(result, null, 2));
75
+ }
76
+ catch (error) {
77
+ console.error('Failed to find record.');
78
+ if (error instanceof Error) {
79
+ console.error(error.message);
80
+ }
81
+ process.exit(1);
82
+ }
83
+ }
65
84
  async function handleCreate(argv, prompter) {
66
85
  try {
67
86
  const rawAnswers = await prompter.prompt(argv, [
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { extractFirst } from 'inquirerer';
7
7
  import { getClient } from '../executor';
8
- import { coerceAnswers, stripUndefined } from '../utils';
8
+ import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
9
9
  const fieldSchema = {
10
10
  hashUuid: 'uuid',
11
11
  id: 'uuid',
@@ -16,7 +16,7 @@ const fieldSchema = {
16
16
  frzn: 'boolean',
17
17
  createdAt: 'string',
18
18
  };
19
- const usage = '\nobject <command>\n\nCommands:\n list List all object records\n get Get a object by ID\n create Create a new object\n update Update an existing object\n delete Delete a object\n\n --help, -h Show this help message\n';
19
+ const usage = '\nobject <command>\n\nCommands:\n list List object records\n find-first Find first matching object record\n get Get a object by ID\n create Create a new object\n update Update an existing object\n delete Delete a object\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\n --help, -h Show this help message\n';
20
20
  export default async (argv, prompter, _options) => {
21
21
  if (argv.help || argv.h) {
22
22
  console.log(usage);
@@ -29,7 +29,7 @@ export default async (argv, prompter, _options) => {
29
29
  type: 'autocomplete',
30
30
  name: 'subcommand',
31
31
  message: 'What do you want to do?',
32
- options: ['list', 'get', 'create', 'update', 'delete'],
32
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
33
33
  },
34
34
  ]);
35
35
  return handleTableSubcommand(answer.subcommand, newArgv, prompter);
@@ -40,6 +40,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
40
40
  switch (subcommand) {
41
41
  case 'list':
42
42
  return handleList(argv, prompter);
43
+ case 'find-first':
44
+ return handleFindFirst(argv, prompter);
43
45
  case 'get':
44
46
  return handleGet(argv, prompter);
45
47
  case 'create':
@@ -53,22 +55,20 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
53
55
  process.exit(1);
54
56
  }
55
57
  }
56
- async function handleList(_argv, _prompter) {
58
+ async function handleList(argv, _prompter) {
57
59
  try {
60
+ const defaultSelect = {
61
+ id: true,
62
+ databaseId: true,
63
+ kids: true,
64
+ ktree: true,
65
+ data: true,
66
+ frzn: true,
67
+ createdAt: true,
68
+ };
69
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
58
70
  const client = getClient();
59
- const result = await client.object
60
- .findMany({
61
- select: {
62
- id: true,
63
- databaseId: true,
64
- kids: true,
65
- ktree: true,
66
- data: true,
67
- frzn: true,
68
- createdAt: true,
69
- },
70
- })
71
- .execute();
71
+ const result = await client.object.findMany(findManyArgs).execute();
72
72
  console.log(JSON.stringify(result, null, 2));
73
73
  }
74
74
  catch (error) {
@@ -79,6 +79,30 @@ async function handleList(_argv, _prompter) {
79
79
  process.exit(1);
80
80
  }
81
81
  }
82
+ async function handleFindFirst(argv, _prompter) {
83
+ try {
84
+ const defaultSelect = {
85
+ id: true,
86
+ databaseId: true,
87
+ kids: true,
88
+ ktree: true,
89
+ data: true,
90
+ frzn: true,
91
+ createdAt: true,
92
+ };
93
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
94
+ const client = getClient();
95
+ const result = await client.object.findFirst(findFirstArgs).execute();
96
+ console.log(JSON.stringify(result, null, 2));
97
+ }
98
+ catch (error) {
99
+ console.error('Failed to find record.');
100
+ if (error instanceof Error) {
101
+ console.error(error.message);
102
+ }
103
+ process.exit(1);
104
+ }
105
+ }
82
106
  async function handleGet(argv, prompter) {
83
107
  try {
84
108
  const answers = await prompter.prompt(argv, [
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { extractFirst } from 'inquirerer';
7
7
  import { getClient } from '../executor';
8
- import { coerceAnswers, stripUndefined } from '../utils';
8
+ import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
9
9
  const fieldSchema = {
10
10
  id: 'uuid',
11
11
  name: 'string',
@@ -13,7 +13,7 @@ const fieldSchema = {
13
13
  storeId: 'uuid',
14
14
  commitId: 'uuid',
15
15
  };
16
- const usage = '\nref <command>\n\nCommands:\n list List all ref records\n get Get a ref by ID\n create Create a new ref\n update Update an existing ref\n delete Delete a ref\n\n --help, -h Show this help message\n';
16
+ const usage = '\nref <command>\n\nCommands:\n list List ref records\n find-first Find first matching ref record\n get Get a ref by ID\n create Create a new ref\n update Update an existing ref\n delete Delete a ref\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\n --help, -h Show this help message\n';
17
17
  export default async (argv, prompter, _options) => {
18
18
  if (argv.help || argv.h) {
19
19
  console.log(usage);
@@ -26,7 +26,7 @@ export default async (argv, prompter, _options) => {
26
26
  type: 'autocomplete',
27
27
  name: 'subcommand',
28
28
  message: 'What do you want to do?',
29
- options: ['list', 'get', 'create', 'update', 'delete'],
29
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
30
30
  },
31
31
  ]);
32
32
  return handleTableSubcommand(answer.subcommand, newArgv, prompter);
@@ -37,6 +37,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
37
37
  switch (subcommand) {
38
38
  case 'list':
39
39
  return handleList(argv, prompter);
40
+ case 'find-first':
41
+ return handleFindFirst(argv, prompter);
40
42
  case 'get':
41
43
  return handleGet(argv, prompter);
42
44
  case 'create':
@@ -50,20 +52,18 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
50
52
  process.exit(1);
51
53
  }
52
54
  }
53
- async function handleList(_argv, _prompter) {
55
+ async function handleList(argv, _prompter) {
54
56
  try {
57
+ const defaultSelect = {
58
+ id: true,
59
+ name: true,
60
+ databaseId: true,
61
+ storeId: true,
62
+ commitId: true,
63
+ };
64
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
55
65
  const client = getClient();
56
- const result = await client.ref
57
- .findMany({
58
- select: {
59
- id: true,
60
- name: true,
61
- databaseId: true,
62
- storeId: true,
63
- commitId: true,
64
- },
65
- })
66
- .execute();
66
+ const result = await client.ref.findMany(findManyArgs).execute();
67
67
  console.log(JSON.stringify(result, null, 2));
68
68
  }
69
69
  catch (error) {
@@ -74,6 +74,28 @@ async function handleList(_argv, _prompter) {
74
74
  process.exit(1);
75
75
  }
76
76
  }
77
+ async function handleFindFirst(argv, _prompter) {
78
+ try {
79
+ const defaultSelect = {
80
+ id: true,
81
+ name: true,
82
+ databaseId: true,
83
+ storeId: true,
84
+ commitId: true,
85
+ };
86
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
87
+ const client = getClient();
88
+ const result = await client.ref.findFirst(findFirstArgs).execute();
89
+ console.log(JSON.stringify(result, null, 2));
90
+ }
91
+ catch (error) {
92
+ console.error('Failed to find record.');
93
+ if (error instanceof Error) {
94
+ console.error(error.message);
95
+ }
96
+ process.exit(1);
97
+ }
98
+ }
77
99
  async function handleGet(argv, prompter) {
78
100
  try {
79
101
  const answers = await prompter.prompt(argv, [
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { extractFirst } from 'inquirerer';
7
7
  import { getClient } from '../executor';
8
- import { coerceAnswers, stripUndefined } from '../utils';
8
+ import { coerceAnswers, parseFindFirstArgs, parseFindManyArgs, stripUndefined } from '../utils';
9
9
  const fieldSchema = {
10
10
  id: 'uuid',
11
11
  name: 'string',
@@ -13,7 +13,7 @@ const fieldSchema = {
13
13
  hash: 'uuid',
14
14
  createdAt: 'string',
15
15
  };
16
- const usage = '\nstore <command>\n\nCommands:\n list List all store records\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\n\n --help, -h Show this help message\n';
16
+ const usage = '\nstore <command>\n\nCommands:\n list List store records\n find-first Find first matching store record\n get Get a store by ID\n create Create a new store\n update Update an existing store\n delete Delete a store\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\n --help, -h Show this help message\n';
17
17
  export default async (argv, prompter, _options) => {
18
18
  if (argv.help || argv.h) {
19
19
  console.log(usage);
@@ -26,7 +26,7 @@ export default async (argv, prompter, _options) => {
26
26
  type: 'autocomplete',
27
27
  name: 'subcommand',
28
28
  message: 'What do you want to do?',
29
- options: ['list', 'get', 'create', 'update', 'delete'],
29
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
30
30
  },
31
31
  ]);
32
32
  return handleTableSubcommand(answer.subcommand, newArgv, prompter);
@@ -37,6 +37,8 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
37
37
  switch (subcommand) {
38
38
  case 'list':
39
39
  return handleList(argv, prompter);
40
+ case 'find-first':
41
+ return handleFindFirst(argv, prompter);
40
42
  case 'get':
41
43
  return handleGet(argv, prompter);
42
44
  case 'create':
@@ -50,20 +52,18 @@ async function handleTableSubcommand(subcommand, argv, prompter) {
50
52
  process.exit(1);
51
53
  }
52
54
  }
53
- async function handleList(_argv, _prompter) {
55
+ async function handleList(argv, _prompter) {
54
56
  try {
57
+ const defaultSelect = {
58
+ id: true,
59
+ name: true,
60
+ databaseId: true,
61
+ hash: true,
62
+ createdAt: true,
63
+ };
64
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
55
65
  const client = getClient();
56
- const result = await client.store
57
- .findMany({
58
- select: {
59
- id: true,
60
- name: true,
61
- databaseId: true,
62
- hash: true,
63
- createdAt: true,
64
- },
65
- })
66
- .execute();
66
+ const result = await client.store.findMany(findManyArgs).execute();
67
67
  console.log(JSON.stringify(result, null, 2));
68
68
  }
69
69
  catch (error) {
@@ -74,6 +74,28 @@ async function handleList(_argv, _prompter) {
74
74
  process.exit(1);
75
75
  }
76
76
  }
77
+ async function handleFindFirst(argv, _prompter) {
78
+ try {
79
+ const defaultSelect = {
80
+ id: true,
81
+ name: true,
82
+ databaseId: true,
83
+ hash: true,
84
+ createdAt: true,
85
+ };
86
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
87
+ const client = getClient();
88
+ const result = await client.store.findFirst(findFirstArgs).execute();
89
+ console.log(JSON.stringify(result, null, 2));
90
+ }
91
+ catch (error) {
92
+ console.error('Failed to find record.');
93
+ if (error instanceof Error) {
94
+ console.error(error.message);
95
+ }
96
+ process.exit(1);
97
+ }
98
+ }
77
99
  async function handleGet(argv, prompter) {
78
100
  try {
79
101
  const answers = await prompter.prompt(argv, [
@@ -47,4 +47,42 @@ export declare function unflattenDotNotation(answers: Record<string, unknown>):
47
47
  * @param paths - Comma-separated dot-notation field paths (e.g. 'clientMutationId,result.accessToken')
48
48
  * @returns The nested select object for the ORM
49
49
  */
50
+ /**
51
+ * Parse a CLI flag as an integer.
52
+ * Handles minimist delivering numbers or strings depending on the input.
53
+ * Returns undefined when the flag is missing or not a valid number.
54
+ */
55
+ export declare function parseIntFlag(argv: Record<string, unknown>, name: string): number | undefined;
56
+ /**
57
+ * Parse a CLI flag as a string.
58
+ * Returns undefined when the flag is missing or not a string.
59
+ */
60
+ export declare function parseStringFlag(argv: Record<string, unknown>, name: string): string | undefined;
61
+ /**
62
+ * Parse --orderBy flag as a comma-separated list of enum values.
63
+ * e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC']
64
+ */
65
+ export declare function parseOrderByFlag(argv: Record<string, unknown>): string[] | undefined;
66
+ /**
67
+ * Parse --select flag into a select object, falling back to a default.
68
+ * e.g. --select id,name → { id: true, name: true }
69
+ */
70
+ export declare function parseSelectFlag(argv: Record<string, unknown>, defaultSelect: Record<string, unknown>): Record<string, unknown>;
71
+ /**
72
+ * Build the full findManyArgs object from CLI argv.
73
+ * Parses all pagination, filtering, ordering, and field selection flags
74
+ * in one call. Accepts an optional `extraWhere` to merge with dot-notation
75
+ * --where flags (used by the search handler to inject search clauses).
76
+ *
77
+ * @example
78
+ * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true });
79
+ * const result = await client.user.findMany(findManyArgs).execute();
80
+ */
81
+ export declare function parseFindManyArgs<T = Record<string, unknown>>(argv: Record<string, unknown>, defaultSelect: Record<string, unknown>, extraWhere?: Record<string, unknown>): T;
82
+ /**
83
+ * Build findFirst args from CLI argv.
84
+ * Like parseFindManyArgs but only includes select, where, and condition
85
+ * (no pagination flags — findFirst returns the first matching record).
86
+ */
87
+ export declare function parseFindFirstArgs<T = Record<string, unknown>>(argv: Record<string, unknown>, defaultSelect: Record<string, unknown>): T;
50
88
  export declare function buildSelectFromPaths(paths: string): Record<string, unknown>;
@@ -153,6 +153,96 @@ export function unflattenDotNotation(answers) {
153
153
  * @param paths - Comma-separated dot-notation field paths (e.g. 'clientMutationId,result.accessToken')
154
154
  * @returns The nested select object for the ORM
155
155
  */
156
+ /**
157
+ * Parse a CLI flag as an integer.
158
+ * Handles minimist delivering numbers or strings depending on the input.
159
+ * Returns undefined when the flag is missing or not a valid number.
160
+ */
161
+ export function parseIntFlag(argv, name) {
162
+ const val = argv[name];
163
+ if (typeof val === 'number')
164
+ return val;
165
+ if (typeof val === 'string') {
166
+ const n = parseInt(val, 10);
167
+ return isNaN(n) ? undefined : n;
168
+ }
169
+ return undefined;
170
+ }
171
+ /**
172
+ * Parse a CLI flag as a string.
173
+ * Returns undefined when the flag is missing or not a string.
174
+ */
175
+ export function parseStringFlag(argv, name) {
176
+ const val = argv[name];
177
+ return typeof val === 'string' ? val : undefined;
178
+ }
179
+ /**
180
+ * Parse --orderBy flag as a comma-separated list of enum values.
181
+ * e.g. --orderBy NAME_ASC,CREATED_AT_DESC → ['NAME_ASC', 'CREATED_AT_DESC']
182
+ */
183
+ export function parseOrderByFlag(argv) {
184
+ const val = argv.orderBy;
185
+ return typeof val === 'string' ? val.split(',') : undefined;
186
+ }
187
+ /**
188
+ * Parse --select flag into a select object, falling back to a default.
189
+ * e.g. --select id,name → { id: true, name: true }
190
+ */
191
+ export function parseSelectFlag(argv, defaultSelect) {
192
+ const raw = argv.select;
193
+ return typeof raw === 'string' ? buildSelectFromPaths(raw) : defaultSelect;
194
+ }
195
+ /**
196
+ * Build the full findManyArgs object from CLI argv.
197
+ * Parses all pagination, filtering, ordering, and field selection flags
198
+ * in one call. Accepts an optional `extraWhere` to merge with dot-notation
199
+ * --where flags (used by the search handler to inject search clauses).
200
+ *
201
+ * @example
202
+ * const findManyArgs = parseFindManyArgs(argv, { id: true, name: true });
203
+ * const result = await client.user.findMany(findManyArgs).execute();
204
+ */
205
+ export function parseFindManyArgs(argv, defaultSelect, extraWhere) {
206
+ const limit = parseIntFlag(argv, 'limit');
207
+ const last = parseIntFlag(argv, 'last');
208
+ const offset = parseIntFlag(argv, 'offset');
209
+ const after = parseStringFlag(argv, 'after');
210
+ const before = parseStringFlag(argv, 'before');
211
+ const select = parseSelectFlag(argv, defaultSelect);
212
+ const parsed = unflattenDotNotation(argv);
213
+ const where = (parsed.where ?? extraWhere)
214
+ ? { ...(extraWhere ?? {}), ...(parsed.where ?? {}) }
215
+ : undefined;
216
+ const condition = parsed.condition;
217
+ const orderBy = parseOrderByFlag(argv);
218
+ return {
219
+ select,
220
+ ...(limit !== undefined ? { first: limit } : {}),
221
+ ...(after !== undefined ? { after } : {}),
222
+ ...(last !== undefined ? { last } : {}),
223
+ ...(before !== undefined ? { before } : {}),
224
+ ...(offset !== undefined ? { offset } : {}),
225
+ ...(where !== undefined ? { where } : {}),
226
+ ...(condition !== undefined ? { condition } : {}),
227
+ ...(orderBy !== undefined ? { orderBy } : {}),
228
+ };
229
+ }
230
+ /**
231
+ * Build findFirst args from CLI argv.
232
+ * Like parseFindManyArgs but only includes select, where, and condition
233
+ * (no pagination flags — findFirst returns the first matching record).
234
+ */
235
+ export function parseFindFirstArgs(argv, defaultSelect) {
236
+ const select = parseSelectFlag(argv, defaultSelect);
237
+ const parsed = unflattenDotNotation(argv);
238
+ const where = parsed.where;
239
+ const condition = parsed.condition;
240
+ return {
241
+ select,
242
+ ...(where !== undefined ? { where } : {}),
243
+ ...(condition !== undefined ? { condition } : {}),
244
+ };
245
+ }
156
246
  export function buildSelectFromPaths(paths) {
157
247
  const result = {};
158
248
  const trimmedPaths = paths