@constructive-sdk/cli 0.17.1 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/admin/cli/commands/app-invite.js +22 -0
  2. package/admin/cli/commands/app-limit-default.js +22 -0
  3. package/admin/cli/commands/{confirm-upload.d.ts → app-limit-event.d.ts} +1 -1
  4. package/admin/cli/commands/app-limit-event.js +212 -0
  5. package/admin/cli/commands/app-limit.js +66 -0
  6. package/admin/cli/commands/app-membership.js +0 -22
  7. package/admin/cli/commands/org-invite.js +22 -0
  8. package/{esm/admin/cli/commands/confirm-upload.d.ts → admin/cli/commands/org-limit-aggregate.d.ts} +1 -1
  9. package/admin/cli/commands/org-limit-aggregate.js +362 -0
  10. package/admin/cli/commands/org-limit-default.js +22 -0
  11. package/{auth/cli/commands/confirm-upload.d.ts → admin/cli/commands/org-limit-event.d.ts} +1 -1
  12. package/admin/cli/commands/org-limit-event.js +212 -0
  13. package/admin/cli/commands/org-limit.js +66 -0
  14. package/admin/cli/commands/org-membership-setting.js +44 -0
  15. package/admin/cli/commands.js +25 -21
  16. package/admin/cli/executor.d.ts +12 -14
  17. package/admin/orm/index.d.ts +24 -23
  18. package/admin/orm/index.js +24 -18
  19. package/admin/orm/input-types.d.ts +1297 -839
  20. package/admin/orm/models/appLimitEvent.d.ts +32 -0
  21. package/admin/orm/models/appLimitEvent.js +55 -0
  22. package/admin/orm/models/index.d.ts +12 -9
  23. package/admin/orm/models/index.js +25 -19
  24. package/admin/orm/models/orgLimitAggregate.d.ts +56 -0
  25. package/admin/orm/models/orgLimitAggregate.js +100 -0
  26. package/admin/orm/models/orgLimitEvent.d.ts +32 -0
  27. package/admin/orm/models/orgLimitEvent.js +55 -0
  28. package/admin/orm/mutation/index.d.ts +1 -15
  29. package/admin/orm/mutation/index.js +0 -12
  30. package/auth/cli/commands.js +1 -3
  31. package/auth/cli/executor.d.ts +0 -5
  32. package/auth/orm/index.d.ts +0 -5
  33. package/auth/orm/input-types.d.ts +0 -20
  34. package/auth/orm/mutation/index.d.ts +1 -15
  35. package/auth/orm/mutation/index.js +0 -12
  36. package/esm/admin/cli/commands/app-invite.js +22 -0
  37. package/esm/admin/cli/commands/app-limit-default.js +22 -0
  38. package/esm/{auth/cli/commands/confirm-upload.d.ts → admin/cli/commands/app-limit-event.d.ts} +1 -1
  39. package/esm/admin/cli/commands/app-limit-event.js +210 -0
  40. package/esm/admin/cli/commands/app-limit.js +66 -0
  41. package/esm/admin/cli/commands/app-membership.js +0 -22
  42. package/esm/admin/cli/commands/org-invite.js +22 -0
  43. package/esm/admin/cli/commands/org-limit-aggregate.d.ts +8 -0
  44. package/esm/admin/cli/commands/org-limit-aggregate.js +360 -0
  45. package/esm/admin/cli/commands/org-limit-default.js +22 -0
  46. package/esm/admin/cli/commands/org-limit-event.d.ts +8 -0
  47. package/esm/admin/cli/commands/org-limit-event.js +210 -0
  48. package/esm/admin/cli/commands/org-limit.js +66 -0
  49. package/esm/admin/cli/commands/org-membership-setting.js +44 -0
  50. package/esm/admin/cli/commands.js +25 -21
  51. package/esm/admin/cli/executor.d.ts +12 -14
  52. package/esm/admin/orm/index.d.ts +24 -23
  53. package/esm/admin/orm/index.js +24 -18
  54. package/esm/admin/orm/input-types.d.ts +1297 -839
  55. package/esm/admin/orm/models/appLimitEvent.d.ts +32 -0
  56. package/esm/admin/orm/models/appLimitEvent.js +51 -0
  57. package/esm/admin/orm/models/index.d.ts +12 -9
  58. package/esm/admin/orm/models/index.js +12 -9
  59. package/esm/admin/orm/models/orgLimitAggregate.d.ts +56 -0
  60. package/esm/admin/orm/models/orgLimitAggregate.js +96 -0
  61. package/esm/admin/orm/models/orgLimitEvent.d.ts +32 -0
  62. package/esm/admin/orm/models/orgLimitEvent.js +51 -0
  63. package/esm/admin/orm/mutation/index.d.ts +1 -15
  64. package/esm/admin/orm/mutation/index.js +0 -12
  65. package/esm/auth/cli/commands.js +1 -3
  66. package/esm/auth/cli/executor.d.ts +0 -5
  67. package/esm/auth/orm/index.d.ts +0 -5
  68. package/esm/auth/orm/input-types.d.ts +0 -20
  69. package/esm/auth/orm/mutation/index.d.ts +1 -15
  70. package/esm/auth/orm/mutation/index.js +0 -12
  71. package/esm/objects/cli/commands.js +1 -3
  72. package/esm/objects/cli/executor.d.ts +0 -5
  73. package/esm/objects/orm/index.d.ts +0 -5
  74. package/esm/objects/orm/input-types.d.ts +0 -20
  75. package/esm/objects/orm/mutation/index.d.ts +1 -15
  76. package/esm/objects/orm/mutation/index.js +0 -12
  77. package/esm/public/cli/commands/agent-message.d.ts +8 -0
  78. package/esm/public/cli/commands/agent-message.js +324 -0
  79. package/esm/public/cli/commands/agent-task.d.ts +8 -0
  80. package/esm/public/cli/commands/agent-task.js +368 -0
  81. package/esm/public/cli/commands/agent-thread.d.ts +8 -0
  82. package/esm/public/cli/commands/agent-thread.js +372 -0
  83. package/esm/public/cli/commands/app-invite.js +22 -0
  84. package/esm/public/cli/commands/app-limit-default.js +22 -0
  85. package/esm/public/cli/commands/app-limit-event.d.ts +8 -0
  86. package/esm/public/cli/commands/app-limit-event.js +210 -0
  87. package/esm/public/cli/commands/app-limit.js +66 -0
  88. package/esm/public/cli/commands/app-membership.js +0 -22
  89. package/esm/public/cli/commands/billing-module.d.ts +8 -0
  90. package/esm/public/cli/commands/billing-module.js +492 -0
  91. package/esm/public/cli/commands/limits-module.js +22 -0
  92. package/esm/public/cli/commands/node-type-registry.d.ts +8 -0
  93. package/esm/public/cli/commands/node-type-registry.js +343 -0
  94. package/esm/public/cli/commands/org-invite.js +22 -0
  95. package/esm/public/cli/commands/org-limit-aggregate.d.ts +8 -0
  96. package/esm/public/cli/commands/org-limit-aggregate.js +360 -0
  97. package/esm/public/cli/commands/org-limit-default.js +22 -0
  98. package/esm/public/cli/commands/org-limit-event.d.ts +8 -0
  99. package/esm/public/cli/commands/org-limit-event.js +210 -0
  100. package/esm/public/cli/commands/org-limit.js +66 -0
  101. package/esm/public/cli/commands/org-membership-setting.js +44 -0
  102. package/esm/public/cli/commands/plans-module.d.ts +8 -0
  103. package/esm/public/cli/commands/plans-module.js +426 -0
  104. package/esm/public/cli/commands/profiles-module.js +44 -0
  105. package/esm/public/cli/commands/storage-module.js +22 -44
  106. package/esm/public/cli/commands.js +45 -29
  107. package/esm/public/cli/executor.d.ts +38 -34
  108. package/esm/public/orm/index.d.ts +56 -43
  109. package/esm/public/orm/index.js +36 -18
  110. package/esm/public/orm/input-types.d.ts +2983 -1112
  111. package/esm/public/orm/input-types.js +9 -0
  112. package/esm/public/orm/models/agentMessage.d.ts +56 -0
  113. package/esm/public/orm/models/agentMessage.js +96 -0
  114. package/esm/public/orm/models/agentTask.d.ts +56 -0
  115. package/esm/public/orm/models/agentTask.js +96 -0
  116. package/esm/public/orm/models/agentThread.d.ts +56 -0
  117. package/esm/public/orm/models/agentThread.js +96 -0
  118. package/esm/public/orm/models/appLimitEvent.d.ts +32 -0
  119. package/esm/public/orm/models/appLimitEvent.js +51 -0
  120. package/esm/public/orm/models/billingModule.d.ts +56 -0
  121. package/esm/public/orm/models/billingModule.js +96 -0
  122. package/esm/public/orm/models/index.d.ts +18 -9
  123. package/esm/public/orm/models/index.js +18 -9
  124. package/esm/public/orm/models/nodeTypeRegistry.d.ts +56 -0
  125. package/esm/public/orm/models/nodeTypeRegistry.js +96 -0
  126. package/esm/public/orm/models/orgLimitAggregate.d.ts +56 -0
  127. package/esm/public/orm/models/orgLimitAggregate.js +96 -0
  128. package/esm/public/orm/models/orgLimitEvent.d.ts +32 -0
  129. package/esm/public/orm/models/orgLimitEvent.js +51 -0
  130. package/esm/public/orm/models/plansModule.d.ts +56 -0
  131. package/esm/public/orm/models/plansModule.js +96 -0
  132. package/esm/public/orm/mutation/index.d.ts +17 -31
  133. package/esm/public/orm/mutation/index.js +24 -36
  134. package/esm/public/orm/query/index.d.ts +28 -28
  135. package/esm/public/orm/query/index.js +48 -48
  136. package/objects/cli/commands.js +1 -3
  137. package/objects/cli/executor.d.ts +0 -5
  138. package/objects/orm/index.d.ts +0 -5
  139. package/objects/orm/input-types.d.ts +0 -20
  140. package/objects/orm/mutation/index.d.ts +1 -15
  141. package/objects/orm/mutation/index.js +0 -12
  142. package/package.json +4 -4
  143. package/public/cli/commands/agent-message.d.ts +8 -0
  144. package/public/cli/commands/agent-message.js +326 -0
  145. package/public/cli/commands/agent-task.d.ts +8 -0
  146. package/public/cli/commands/agent-task.js +370 -0
  147. package/public/cli/commands/agent-thread.d.ts +8 -0
  148. package/public/cli/commands/agent-thread.js +374 -0
  149. package/public/cli/commands/app-invite.js +22 -0
  150. package/public/cli/commands/app-limit-default.js +22 -0
  151. package/public/cli/commands/app-limit-event.d.ts +8 -0
  152. package/public/cli/commands/app-limit-event.js +212 -0
  153. package/public/cli/commands/app-limit.js +66 -0
  154. package/public/cli/commands/app-membership.js +0 -22
  155. package/public/cli/commands/billing-module.d.ts +8 -0
  156. package/public/cli/commands/billing-module.js +494 -0
  157. package/public/cli/commands/limits-module.js +22 -0
  158. package/public/cli/commands/node-type-registry.d.ts +8 -0
  159. package/public/cli/commands/node-type-registry.js +345 -0
  160. package/public/cli/commands/org-invite.js +22 -0
  161. package/public/cli/commands/org-limit-aggregate.d.ts +8 -0
  162. package/public/cli/commands/org-limit-aggregate.js +362 -0
  163. package/public/cli/commands/org-limit-default.js +22 -0
  164. package/public/cli/commands/org-limit-event.d.ts +8 -0
  165. package/public/cli/commands/org-limit-event.js +212 -0
  166. package/public/cli/commands/org-limit.js +66 -0
  167. package/public/cli/commands/org-membership-setting.js +44 -0
  168. package/public/cli/commands/plans-module.d.ts +8 -0
  169. package/public/cli/commands/plans-module.js +428 -0
  170. package/public/cli/commands/profiles-module.js +44 -0
  171. package/public/cli/commands/storage-module.js +22 -44
  172. package/public/cli/commands.js +45 -29
  173. package/public/cli/executor.d.ts +38 -34
  174. package/public/orm/index.d.ts +56 -43
  175. package/public/orm/index.js +36 -18
  176. package/public/orm/input-types.d.ts +2983 -1112
  177. package/public/orm/input-types.js +9 -0
  178. package/public/orm/models/agentMessage.d.ts +56 -0
  179. package/public/orm/models/agentMessage.js +100 -0
  180. package/public/orm/models/agentTask.d.ts +56 -0
  181. package/public/orm/models/agentTask.js +100 -0
  182. package/public/orm/models/agentThread.d.ts +56 -0
  183. package/public/orm/models/agentThread.js +100 -0
  184. package/public/orm/models/appLimitEvent.d.ts +32 -0
  185. package/public/orm/models/appLimitEvent.js +55 -0
  186. package/public/orm/models/billingModule.d.ts +56 -0
  187. package/public/orm/models/billingModule.js +100 -0
  188. package/public/orm/models/index.d.ts +18 -9
  189. package/public/orm/models/index.js +39 -21
  190. package/public/orm/models/nodeTypeRegistry.d.ts +56 -0
  191. package/public/orm/models/nodeTypeRegistry.js +100 -0
  192. package/public/orm/models/orgLimitAggregate.d.ts +56 -0
  193. package/public/orm/models/orgLimitAggregate.js +100 -0
  194. package/public/orm/models/orgLimitEvent.d.ts +32 -0
  195. package/public/orm/models/orgLimitEvent.js +55 -0
  196. package/public/orm/models/plansModule.d.ts +56 -0
  197. package/public/orm/models/plansModule.js +100 -0
  198. package/public/orm/mutation/index.d.ts +17 -31
  199. package/public/orm/mutation/index.js +24 -36
  200. package/public/orm/query/index.d.ts +28 -28
  201. package/public/orm/query/index.js +48 -48
  202. package/admin/cli/commands/confirm-upload.js +0 -36
  203. package/auth/cli/commands/confirm-upload.js +0 -36
  204. package/esm/admin/cli/commands/confirm-upload.js +0 -34
  205. package/esm/auth/cli/commands/confirm-upload.js +0 -34
  206. package/esm/objects/cli/commands/confirm-upload.d.ts +0 -8
  207. package/esm/objects/cli/commands/confirm-upload.js +0 -34
  208. package/esm/public/cli/commands/confirm-upload.d.ts +0 -8
  209. package/esm/public/cli/commands/confirm-upload.js +0 -34
  210. package/objects/cli/commands/confirm-upload.d.ts +0 -8
  211. package/objects/cli/commands/confirm-upload.js +0 -36
  212. package/public/cli/commands/confirm-upload.d.ts +0 -8
  213. package/public/cli/commands/confirm-upload.js +0 -36
@@ -73,11 +73,6 @@ export declare function getClient(contextName?: string): {
73
73
  } & import("..").StrictSelect<S, import("../orm/input-types").RequestUploadUrlPayloadSelect>) => import("..").QueryBuilder<{
74
74
  requestUploadUrl: import("..").InferSelectResult<import("../orm/input-types").RequestUploadUrlPayload, S> | null;
75
75
  }>;
76
- confirmUpload: <S extends import("../orm/input-types").ConfirmUploadPayloadSelect>(args: import("../orm/mutation").ConfirmUploadVariables, options: {
77
- select: S;
78
- } & import("..").StrictSelect<S, import("../orm/input-types").ConfirmUploadPayloadSelect>) => import("..").QueryBuilder<{
79
- confirmUpload: import("..").InferSelectResult<import("../orm/input-types").ConfirmUploadPayload, S> | null;
80
- }>;
81
76
  provisionBucket: <S extends import("../orm/input-types").ProvisionBucketPayloadSelect>(args: import("../orm/mutation").ProvisionBucketVariables, options: {
82
77
  select: S;
83
78
  } & import("..").StrictSelect<S, import("../orm/input-types").ProvisionBucketPayloadSelect>) => import("..").QueryBuilder<{
@@ -109,11 +109,6 @@ export declare function createClient(config: OrmClientConfig): {
109
109
  } & import("./select-types").StrictSelect<S, import("./input-types").RequestUploadUrlPayloadSelect>) => import("./query-builder").QueryBuilder<{
110
110
  requestUploadUrl: import("./select-types").InferSelectResult<import("./input-types").RequestUploadUrlPayload, S> | null;
111
111
  }>;
112
- confirmUpload: <S extends import("./input-types").ConfirmUploadPayloadSelect>(args: import("./mutation").ConfirmUploadVariables, options: {
113
- select: S;
114
- } & import("./select-types").StrictSelect<S, import("./input-types").ConfirmUploadPayloadSelect>) => import("./query-builder").QueryBuilder<{
115
- confirmUpload: import("./select-types").InferSelectResult<import("./input-types").ConfirmUploadPayload, S> | null;
116
- }>;
117
112
  provisionBucket: <S extends import("./input-types").ProvisionBucketPayloadSelect>(args: import("./mutation").ProvisionBucketVariables, options: {
118
113
  select: S;
119
114
  } & import("./select-types").StrictSelect<S, import("./input-types").ProvisionBucketPayloadSelect>) => import("./query-builder").QueryBuilder<{
@@ -648,10 +648,6 @@ export interface RequestUploadUrlInput {
648
648
  /** Original filename (optional, for display and Content-Disposition) */
649
649
  filename?: string;
650
650
  }
651
- export interface ConfirmUploadInput {
652
- /** The file ID returned by requestUploadUrl */
653
- fileId: string;
654
- }
655
651
  export interface ProvisionBucketInput {
656
652
  /** The logical bucket key (e.g., "public", "private") */
657
653
  bucketKey: string;
@@ -751,8 +747,6 @@ export interface RequestUploadUrlPayload {
751
747
  deduplicated: boolean;
752
748
  /** Presigned URL expiry time (null if deduplicated) */
753
749
  expiresAt?: string | null;
754
- /** File status — 'pending' for fresh uploads, 'ready' or 'processed' for deduplicated files. Clients can use this to know immediately whether the file is usable. */
755
- status: string;
756
750
  }
757
751
  export type RequestUploadUrlPayloadSelect = {
758
752
  uploadUrl?: boolean;
@@ -760,20 +754,6 @@ export type RequestUploadUrlPayloadSelect = {
760
754
  key?: boolean;
761
755
  deduplicated?: boolean;
762
756
  expiresAt?: boolean;
763
- status?: boolean;
764
- };
765
- export interface ConfirmUploadPayload {
766
- /** The confirmed file ID */
767
- fileId: string;
768
- /** New file status */
769
- status: string;
770
- /** Whether confirmation succeeded */
771
- success: boolean;
772
- }
773
- export type ConfirmUploadPayloadSelect = {
774
- fileId?: boolean;
775
- status?: boolean;
776
- success?: boolean;
777
757
  };
778
758
  export interface ProvisionBucketPayload {
779
759
  /** Whether provisioning succeeded */
@@ -6,7 +6,7 @@
6
6
  import { OrmClient } from '../client';
7
7
  import { QueryBuilder } from '../query-builder';
8
8
  import type { InferSelectResult, StrictSelect } from '../select-types';
9
- import type { FreezeObjectsInput, InitEmptyRepoInput, RemoveNodeAtPathInput, SetDataAtPathInput, SetPropsAndCommitInput, InsertNodeAtPathInput, UpdateNodeAtPathInput, SetAndCommitInput, RequestUploadUrlInput, ConfirmUploadInput, ProvisionBucketInput, FreezeObjectsPayload, InitEmptyRepoPayload, RemoveNodeAtPathPayload, SetDataAtPathPayload, SetPropsAndCommitPayload, InsertNodeAtPathPayload, UpdateNodeAtPathPayload, SetAndCommitPayload, RequestUploadUrlPayload, ConfirmUploadPayload, ProvisionBucketPayload, FreezeObjectsPayloadSelect, InitEmptyRepoPayloadSelect, RemoveNodeAtPathPayloadSelect, SetDataAtPathPayloadSelect, SetPropsAndCommitPayloadSelect, InsertNodeAtPathPayloadSelect, UpdateNodeAtPathPayloadSelect, SetAndCommitPayloadSelect, RequestUploadUrlPayloadSelect, ConfirmUploadPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
9
+ import type { FreezeObjectsInput, InitEmptyRepoInput, RemoveNodeAtPathInput, SetDataAtPathInput, SetPropsAndCommitInput, InsertNodeAtPathInput, UpdateNodeAtPathInput, SetAndCommitInput, RequestUploadUrlInput, ProvisionBucketInput, FreezeObjectsPayload, InitEmptyRepoPayload, RemoveNodeAtPathPayload, SetDataAtPathPayload, SetPropsAndCommitPayload, InsertNodeAtPathPayload, UpdateNodeAtPathPayload, SetAndCommitPayload, RequestUploadUrlPayload, ProvisionBucketPayload, FreezeObjectsPayloadSelect, InitEmptyRepoPayloadSelect, RemoveNodeAtPathPayloadSelect, SetDataAtPathPayloadSelect, SetPropsAndCommitPayloadSelect, InsertNodeAtPathPayloadSelect, UpdateNodeAtPathPayloadSelect, SetAndCommitPayloadSelect, RequestUploadUrlPayloadSelect, ProvisionBucketPayloadSelect } from '../input-types';
10
10
  export interface FreezeObjectsVariables {
11
11
  input: FreezeObjectsInput;
12
12
  }
@@ -41,15 +41,6 @@ existing file ID and deduplicated=true with no uploadUrl.
41
41
  export interface RequestUploadUrlVariables {
42
42
  input: RequestUploadUrlInput;
43
43
  }
44
- /**
45
- * Variables for confirmUpload
46
- * Confirm that a file has been uploaded to S3.
47
- Verifies the object exists in S3, checks content-type,
48
- and transitions the file status from 'pending' to 'ready'.
49
- */
50
- export interface ConfirmUploadVariables {
51
- input: ConfirmUploadInput;
52
- }
53
44
  /**
54
45
  * Variables for provisionBucket
55
46
  * Provision an S3 bucket for a logical bucket in the database.
@@ -106,11 +97,6 @@ export declare function createMutationOperations(client: OrmClient): {
106
97
  } & StrictSelect<S, RequestUploadUrlPayloadSelect>) => QueryBuilder<{
107
98
  requestUploadUrl: InferSelectResult<RequestUploadUrlPayload, S> | null;
108
99
  }>;
109
- confirmUpload: <S extends ConfirmUploadPayloadSelect>(args: ConfirmUploadVariables, options: {
110
- select: S;
111
- } & StrictSelect<S, ConfirmUploadPayloadSelect>) => QueryBuilder<{
112
- confirmUpload: InferSelectResult<ConfirmUploadPayload, S> | null;
113
- }>;
114
100
  provisionBucket: <S extends ProvisionBucketPayloadSelect>(args: ProvisionBucketVariables, options: {
115
101
  select: S;
116
102
  } & StrictSelect<S, ProvisionBucketPayloadSelect>) => QueryBuilder<{
@@ -110,18 +110,6 @@ export function createMutationOperations(client) {
110
110
  },
111
111
  ], connectionFieldsMap, 'RequestUploadUrlPayload'),
112
112
  }),
113
- confirmUpload: (args, options) => new QueryBuilder({
114
- client,
115
- operation: 'mutation',
116
- operationName: 'ConfirmUpload',
117
- fieldName: 'confirmUpload',
118
- ...buildCustomDocument('mutation', 'ConfirmUpload', 'confirmUpload', options.select, args, [
119
- {
120
- name: 'input',
121
- type: 'ConfirmUploadInput!',
122
- },
123
- ], connectionFieldsMap, 'ConfirmUploadPayload'),
124
- }),
125
113
  provisionBucket: (args, options) => new QueryBuilder({
126
114
  client,
127
115
  operation: 'mutation',
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI commands for AgentMessage
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import { CLIOptions, Inquirerer } from 'inquirerer';
7
+ declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
8
+ export default _default;
@@ -0,0 +1,324 @@
1
+ /**
2
+ * CLI commands for AgentMessage
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
+ threadId: 'uuid',
11
+ entityId: 'uuid',
12
+ authorRole: 'string',
13
+ id: 'uuid',
14
+ createdAt: 'string',
15
+ updatedAt: 'string',
16
+ ownerId: 'uuid',
17
+ parts: 'json',
18
+ };
19
+ const usage = '\nagent-message <command>\n\nCommands:\n list List agentMessage records\n find-first Find first matching agentMessage record\n get Get a agentMessage by ID\n create Create a new agentMessage\n update Update an existing agentMessage\n delete Delete a agentMessage\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
+ export default async (argv, prompter, _options) => {
21
+ if (argv.help || argv.h) {
22
+ console.log(usage);
23
+ process.exit(0);
24
+ }
25
+ const { first: subcommand, newArgv } = extractFirst(argv);
26
+ if (!subcommand) {
27
+ const answer = await prompter.prompt(argv, [
28
+ {
29
+ type: 'autocomplete',
30
+ name: 'subcommand',
31
+ message: 'What do you want to do?',
32
+ options: ['list', 'find-first', 'get', 'create', 'update', 'delete'],
33
+ },
34
+ ]);
35
+ return handleTableSubcommand(answer.subcommand, newArgv, prompter);
36
+ }
37
+ return handleTableSubcommand(subcommand, newArgv, prompter);
38
+ };
39
+ async function handleTableSubcommand(subcommand, argv, prompter) {
40
+ switch (subcommand) {
41
+ case 'list':
42
+ return handleList(argv, prompter);
43
+ case 'find-first':
44
+ return handleFindFirst(argv, prompter);
45
+ case 'get':
46
+ return handleGet(argv, prompter);
47
+ case 'create':
48
+ return handleCreate(argv, prompter);
49
+ case 'update':
50
+ return handleUpdate(argv, prompter);
51
+ case 'delete':
52
+ return handleDelete(argv, prompter);
53
+ default:
54
+ console.log(usage);
55
+ process.exit(1);
56
+ }
57
+ }
58
+ async function handleList(argv, _prompter) {
59
+ try {
60
+ const defaultSelect = {
61
+ threadId: true,
62
+ entityId: true,
63
+ authorRole: true,
64
+ id: true,
65
+ createdAt: true,
66
+ updatedAt: true,
67
+ ownerId: true,
68
+ parts: true,
69
+ };
70
+ const findManyArgs = parseFindManyArgs(argv, defaultSelect);
71
+ const client = getClient();
72
+ const result = await client.agentMessage.findMany(findManyArgs).execute();
73
+ console.log(JSON.stringify(result, null, 2));
74
+ }
75
+ catch (error) {
76
+ console.error('Failed to list records.');
77
+ if (error instanceof Error) {
78
+ console.error(error.message);
79
+ }
80
+ process.exit(1);
81
+ }
82
+ }
83
+ async function handleFindFirst(argv, _prompter) {
84
+ try {
85
+ const defaultSelect = {
86
+ threadId: true,
87
+ entityId: true,
88
+ authorRole: true,
89
+ id: true,
90
+ createdAt: true,
91
+ updatedAt: true,
92
+ ownerId: true,
93
+ parts: true,
94
+ };
95
+ const findFirstArgs = parseFindFirstArgs(argv, defaultSelect);
96
+ const client = getClient();
97
+ const result = await client.agentMessage.findFirst(findFirstArgs).execute();
98
+ console.log(JSON.stringify(result, null, 2));
99
+ }
100
+ catch (error) {
101
+ console.error('Failed to find record.');
102
+ if (error instanceof Error) {
103
+ console.error(error.message);
104
+ }
105
+ process.exit(1);
106
+ }
107
+ }
108
+ async function handleGet(argv, prompter) {
109
+ try {
110
+ const answers = await prompter.prompt(argv, [
111
+ {
112
+ type: 'text',
113
+ name: 'id',
114
+ message: 'id',
115
+ required: true,
116
+ },
117
+ ]);
118
+ const client = getClient();
119
+ const result = await client.agentMessage
120
+ .findOne({
121
+ id: answers.id,
122
+ select: {
123
+ threadId: true,
124
+ entityId: true,
125
+ authorRole: true,
126
+ id: true,
127
+ createdAt: true,
128
+ updatedAt: true,
129
+ ownerId: true,
130
+ parts: true,
131
+ },
132
+ })
133
+ .execute();
134
+ console.log(JSON.stringify(result, null, 2));
135
+ }
136
+ catch (error) {
137
+ console.error('Record not found.');
138
+ if (error instanceof Error) {
139
+ console.error(error.message);
140
+ }
141
+ process.exit(1);
142
+ }
143
+ }
144
+ async function handleCreate(argv, prompter) {
145
+ try {
146
+ const rawAnswers = await prompter.prompt(argv, [
147
+ {
148
+ type: 'text',
149
+ name: 'threadId',
150
+ message: 'threadId',
151
+ required: true,
152
+ },
153
+ {
154
+ type: 'text',
155
+ name: 'entityId',
156
+ message: 'entityId',
157
+ required: true,
158
+ },
159
+ {
160
+ type: 'text',
161
+ name: 'authorRole',
162
+ message: 'authorRole',
163
+ required: true,
164
+ },
165
+ {
166
+ type: 'text',
167
+ name: 'ownerId',
168
+ message: 'ownerId',
169
+ required: false,
170
+ skipPrompt: true,
171
+ },
172
+ {
173
+ type: 'json',
174
+ name: 'parts',
175
+ message: 'parts',
176
+ required: false,
177
+ skipPrompt: true,
178
+ },
179
+ ]);
180
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
181
+ const cleanedData = stripUndefined(answers, fieldSchema);
182
+ const client = getClient();
183
+ const result = await client.agentMessage
184
+ .create({
185
+ data: {
186
+ threadId: cleanedData.threadId,
187
+ entityId: cleanedData.entityId,
188
+ authorRole: cleanedData.authorRole,
189
+ ownerId: cleanedData.ownerId,
190
+ parts: cleanedData.parts,
191
+ },
192
+ select: {
193
+ threadId: true,
194
+ entityId: true,
195
+ authorRole: true,
196
+ id: true,
197
+ createdAt: true,
198
+ updatedAt: true,
199
+ ownerId: true,
200
+ parts: true,
201
+ },
202
+ })
203
+ .execute();
204
+ console.log(JSON.stringify(result, null, 2));
205
+ }
206
+ catch (error) {
207
+ console.error('Failed to create record.');
208
+ if (error instanceof Error) {
209
+ console.error(error.message);
210
+ }
211
+ process.exit(1);
212
+ }
213
+ }
214
+ async function handleUpdate(argv, prompter) {
215
+ try {
216
+ const rawAnswers = await prompter.prompt(argv, [
217
+ {
218
+ type: 'text',
219
+ name: 'id',
220
+ message: 'id',
221
+ required: true,
222
+ },
223
+ {
224
+ type: 'text',
225
+ name: 'threadId',
226
+ message: 'threadId',
227
+ required: false,
228
+ },
229
+ {
230
+ type: 'text',
231
+ name: 'entityId',
232
+ message: 'entityId',
233
+ required: false,
234
+ },
235
+ {
236
+ type: 'text',
237
+ name: 'authorRole',
238
+ message: 'authorRole',
239
+ required: false,
240
+ },
241
+ {
242
+ type: 'text',
243
+ name: 'ownerId',
244
+ message: 'ownerId',
245
+ required: false,
246
+ skipPrompt: true,
247
+ },
248
+ {
249
+ type: 'json',
250
+ name: 'parts',
251
+ message: 'parts',
252
+ required: false,
253
+ skipPrompt: true,
254
+ },
255
+ ]);
256
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
257
+ const cleanedData = stripUndefined(answers, fieldSchema);
258
+ const client = getClient();
259
+ const result = await client.agentMessage
260
+ .update({
261
+ where: {
262
+ id: answers.id,
263
+ },
264
+ data: {
265
+ threadId: cleanedData.threadId,
266
+ entityId: cleanedData.entityId,
267
+ authorRole: cleanedData.authorRole,
268
+ ownerId: cleanedData.ownerId,
269
+ parts: cleanedData.parts,
270
+ },
271
+ select: {
272
+ threadId: true,
273
+ entityId: true,
274
+ authorRole: true,
275
+ id: true,
276
+ createdAt: true,
277
+ updatedAt: true,
278
+ ownerId: true,
279
+ parts: true,
280
+ },
281
+ })
282
+ .execute();
283
+ console.log(JSON.stringify(result, null, 2));
284
+ }
285
+ catch (error) {
286
+ console.error('Failed to update record.');
287
+ if (error instanceof Error) {
288
+ console.error(error.message);
289
+ }
290
+ process.exit(1);
291
+ }
292
+ }
293
+ async function handleDelete(argv, prompter) {
294
+ try {
295
+ const rawAnswers = await prompter.prompt(argv, [
296
+ {
297
+ type: 'text',
298
+ name: 'id',
299
+ message: 'id',
300
+ required: true,
301
+ },
302
+ ]);
303
+ const answers = coerceAnswers(rawAnswers, fieldSchema);
304
+ const client = getClient();
305
+ const result = await client.agentMessage
306
+ .delete({
307
+ where: {
308
+ id: answers.id,
309
+ },
310
+ select: {
311
+ id: true,
312
+ },
313
+ })
314
+ .execute();
315
+ console.log(JSON.stringify(result, null, 2));
316
+ }
317
+ catch (error) {
318
+ console.error('Failed to delete record.');
319
+ if (error instanceof Error) {
320
+ console.error(error.message);
321
+ }
322
+ process.exit(1);
323
+ }
324
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI commands for AgentTask
3
+ * @generated by @constructive-io/graphql-codegen
4
+ * DO NOT EDIT - changes will be overwritten
5
+ */
6
+ import { CLIOptions, Inquirerer } from 'inquirerer';
7
+ declare const _default: (argv: Partial<Record<string, unknown>>, prompter: Inquirerer, _options: CLIOptions) => Promise<void>;
8
+ export default _default;