cvx-kit 0.0.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 (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +200 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +1 -0
  4. package/dist/auth.d.mts +353 -0
  5. package/dist/auth.mjs +2 -0
  6. package/dist/auth.mjs.map +1 -0
  7. package/dist/components/approvals/_generated/api.d.mts +47 -0
  8. package/dist/components/approvals/_generated/api.mjs +2 -0
  9. package/dist/components/approvals/_generated/api.mjs.map +1 -0
  10. package/dist/components/approvals/_generated/component.d.mts +297 -0
  11. package/dist/components/approvals/_generated/component.mjs +1 -0
  12. package/dist/components/approvals/_generated/dataModel.d.mts +41 -0
  13. package/dist/components/approvals/_generated/dataModel.mjs +1 -0
  14. package/dist/components/approvals/_generated/server.d.mts +116 -0
  15. package/dist/components/approvals/_generated/server.mjs +2 -0
  16. package/dist/components/approvals/_generated/server.mjs.map +1 -0
  17. package/dist/components/approvals/audit.d.mts +40 -0
  18. package/dist/components/approvals/audit.mjs +2 -0
  19. package/dist/components/approvals/audit.mjs.map +1 -0
  20. package/dist/components/approvals/client.d.mts +98 -0
  21. package/dist/components/approvals/client.mjs +2 -0
  22. package/dist/components/approvals/client.mjs.map +1 -0
  23. package/dist/components/approvals/constants.d.mts +31 -0
  24. package/dist/components/approvals/constants.mjs +2 -0
  25. package/dist/components/approvals/constants.mjs.map +1 -0
  26. package/dist/components/approvals/convex.config.d.mts +5 -0
  27. package/dist/components/approvals/convex.config.mjs +2 -0
  28. package/dist/components/approvals/convex.config.mjs.map +1 -0
  29. package/dist/components/approvals/decisions.d.mts +61 -0
  30. package/dist/components/approvals/decisions.mjs +2 -0
  31. package/dist/components/approvals/decisions.mjs.map +1 -0
  32. package/dist/components/approvals/functions.d.mts +9 -0
  33. package/dist/components/approvals/functions.mjs +2 -0
  34. package/dist/components/approvals/functions.mjs.map +1 -0
  35. package/dist/components/approvals/requests.d.mts +323 -0
  36. package/dist/components/approvals/requests.mjs +2 -0
  37. package/dist/components/approvals/requests.mjs.map +1 -0
  38. package/dist/components/approvals/schema.d.mts +376 -0
  39. package/dist/components/approvals/schema.mjs +2 -0
  40. package/dist/components/approvals/schema.mjs.map +1 -0
  41. package/dist/components/approvals/validators.d.mts +302 -0
  42. package/dist/components/approvals/validators.mjs +2 -0
  43. package/dist/components/approvals/validators.mjs.map +1 -0
  44. package/dist/components/approvals/workflow.d.mts +11 -0
  45. package/dist/components/approvals/workflow.mjs +2 -0
  46. package/dist/components/approvals/workflow.mjs.map +1 -0
  47. package/dist/components/approvals/workflow_steps.d.mts +83 -0
  48. package/dist/components/approvals/workflow_steps.mjs +2 -0
  49. package/dist/components/approvals/workflow_steps.mjs.map +1 -0
  50. package/dist/components/foundation/_generated/api.d.mts +40 -0
  51. package/dist/components/foundation/_generated/api.mjs +2 -0
  52. package/dist/components/foundation/_generated/api.mjs.map +1 -0
  53. package/dist/components/foundation/_generated/component.d.mts +21 -0
  54. package/dist/components/foundation/_generated/component.mjs +1 -0
  55. package/dist/components/foundation/_generated/dataModel.d.mts +41 -0
  56. package/dist/components/foundation/_generated/dataModel.mjs +1 -0
  57. package/dist/components/foundation/_generated/server.d.mts +116 -0
  58. package/dist/components/foundation/_generated/server.mjs +2 -0
  59. package/dist/components/foundation/_generated/server.mjs.map +1 -0
  60. package/dist/components/foundation/client.d.mts +93 -0
  61. package/dist/components/foundation/client.mjs +2 -0
  62. package/dist/components/foundation/client.mjs.map +1 -0
  63. package/dist/components/foundation/convex.config.d.mts +5 -0
  64. package/dist/components/foundation/convex.config.mjs +2 -0
  65. package/dist/components/foundation/convex.config.mjs.map +1 -0
  66. package/dist/components/foundation/functions.d.mts +8 -0
  67. package/dist/components/foundation/functions.mjs +2 -0
  68. package/dist/components/foundation/functions.mjs.map +1 -0
  69. package/dist/components/foundation/modules/command/command.d.mts +47 -0
  70. package/dist/components/foundation/modules/command/command.mjs +2 -0
  71. package/dist/components/foundation/modules/command/command.mjs.map +1 -0
  72. package/dist/components/foundation/modules/observability/observability.d.mts +31 -0
  73. package/dist/components/foundation/modules/observability/observability.mjs +2 -0
  74. package/dist/components/foundation/modules/observability/observability.mjs.map +1 -0
  75. package/dist/components/foundation/modules/query/query.d.mts +24 -0
  76. package/dist/components/foundation/modules/query/query.mjs +2 -0
  77. package/dist/components/foundation/modules/query/query.mjs.map +1 -0
  78. package/dist/components/foundation/result.d.mts +27 -0
  79. package/dist/components/foundation/result.mjs +2 -0
  80. package/dist/components/foundation/result.mjs.map +1 -0
  81. package/dist/components/foundation/schema.d.mts +6 -0
  82. package/dist/components/foundation/schema.mjs +2 -0
  83. package/dist/components/foundation/schema.mjs.map +1 -0
  84. package/dist/components/foundation/telemetry.d.mts +9 -0
  85. package/dist/components/foundation/telemetry.mjs +2 -0
  86. package/dist/components/foundation/telemetry.mjs.map +1 -0
  87. package/dist/errors.d.mts +24 -0
  88. package/dist/errors.mjs +2 -0
  89. package/dist/errors.mjs.map +1 -0
  90. package/dist/index.d.mts +6 -0
  91. package/dist/index.mjs +1 -0
  92. package/dist/triggers.d.mts +27 -0
  93. package/dist/triggers.mjs +2 -0
  94. package/dist/triggers.mjs.map +1 -0
  95. package/dist/zod-table.d.mts +124 -0
  96. package/dist/zod-table.mjs +2 -0
  97. package/dist/zod-table.mjs.map +1 -0
  98. package/package.json +108 -0
  99. package/src/auth.ts +360 -0
  100. package/src/components/approvals/_generated/api.ts +69 -0
  101. package/src/components/approvals/_generated/component.ts +335 -0
  102. package/src/components/approvals/_generated/dataModel.ts +60 -0
  103. package/src/components/approvals/_generated/server.ts +156 -0
  104. package/src/components/approvals/audit.ts +148 -0
  105. package/src/components/approvals/client.ts +321 -0
  106. package/src/components/approvals/constants.ts +51 -0
  107. package/src/components/approvals/convex.config.ts +10 -0
  108. package/src/components/approvals/decisions.ts +376 -0
  109. package/src/components/approvals/functions.ts +27 -0
  110. package/src/components/approvals/requests.ts +240 -0
  111. package/src/components/approvals/schema.ts +23 -0
  112. package/src/components/approvals/validators.ts +272 -0
  113. package/src/components/approvals/workflow.ts +204 -0
  114. package/src/components/approvals/workflow_steps.ts +189 -0
  115. package/src/components/foundation/_generated/api.ts +62 -0
  116. package/src/components/foundation/_generated/component.ts +29 -0
  117. package/src/components/foundation/_generated/dataModel.ts +60 -0
  118. package/src/components/foundation/_generated/server.ts +156 -0
  119. package/src/components/foundation/client.ts +190 -0
  120. package/src/components/foundation/convex.config.ts +3 -0
  121. package/src/components/foundation/functions.ts +10 -0
  122. package/src/components/foundation/modules/command/__tests__/command.test.ts +106 -0
  123. package/src/components/foundation/modules/command/command.ts +154 -0
  124. package/src/components/foundation/modules/observability/__tests__/observability.test.ts +79 -0
  125. package/src/components/foundation/modules/observability/observability.ts +95 -0
  126. package/src/components/foundation/modules/query/__tests__/query.test.ts +25 -0
  127. package/src/components/foundation/modules/query/query.ts +47 -0
  128. package/src/components/foundation/result.ts +77 -0
  129. package/src/components/foundation/schema.ts +4 -0
  130. package/src/components/foundation/telemetry.ts +23 -0
  131. package/src/errors.ts +25 -0
  132. package/src/index.ts +41 -0
  133. package/src/test.ts +36 -0
  134. package/src/triggers.ts +90 -0
  135. package/src/zod-table.ts +197 -0
@@ -0,0 +1,376 @@
1
+ //#region src/components/approvals/schema.d.ts
2
+ declare const _default: import("convex/server").SchemaDefinition<{
3
+ approvalRuns: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
+ scopeRef: string;
5
+ resourceType: string;
6
+ resourceRef: string;
7
+ requester: {
8
+ actorRef: string;
9
+ capabilities: string[];
10
+ metadata?: {
11
+ [x: string]: string;
12
+ } | undefined;
13
+ };
14
+ metadata?: {
15
+ [x: string]: string;
16
+ } | undefined;
17
+ workflow: {
18
+ schemaVersion: 1;
19
+ compatibilityKey: string;
20
+ name: string;
21
+ steps: ({
22
+ kind: "mutation";
23
+ key: string;
24
+ callback: {
25
+ kind: "mutation";
26
+ handle: string;
27
+ retry: boolean;
28
+ };
29
+ } | {
30
+ kind: "action";
31
+ key: string;
32
+ callback: {
33
+ kind: "action";
34
+ handle: string;
35
+ retry: boolean;
36
+ };
37
+ } | {
38
+ kind: "notify";
39
+ key: string;
40
+ callback: {
41
+ kind: "action";
42
+ handle: string;
43
+ retry: boolean;
44
+ };
45
+ } | {
46
+ kind: "decision";
47
+ key: string;
48
+ decisions: ("approved" | "rejected")[];
49
+ quorum: {
50
+ kind: "count";
51
+ approvals: number;
52
+ };
53
+ makerChecker: boolean;
54
+ expiresAfterMs?: number | undefined;
55
+ } | {
56
+ kind: "branch";
57
+ key: string;
58
+ approvedStepKey: string;
59
+ rejectedStepKey: string;
60
+ })[];
61
+ };
62
+ state: "approved" | "canceled" | "expired" | "pending" | "rejected";
63
+ currentStepKey?: string | undefined;
64
+ executionFailedStepKey?: string | undefined;
65
+ expiresAt?: number | undefined;
66
+ workflowId?: string | undefined;
67
+ createdAt: number;
68
+ updatedAt: number;
69
+ terminalAt?: number | undefined;
70
+ }, {
71
+ scopeRef: import("convex/values").VString<string, "required">;
72
+ resourceType: import("convex/values").VString<string, "required">;
73
+ resourceRef: import("convex/values").VString<string, "required">;
74
+ requester: import("convex/values").VObject<{
75
+ actorRef: string;
76
+ capabilities: string[];
77
+ metadata?: {
78
+ [x: string]: string;
79
+ } | undefined;
80
+ }, {
81
+ actorRef: import("convex/values").VString<string, "required">;
82
+ capabilities: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
83
+ metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
84
+ }, "required", "actorRef" | "capabilities" | "metadata" | `metadata.${string}`>;
85
+ metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
86
+ workflow: import("convex/values").VObject<{
87
+ schemaVersion: 1;
88
+ compatibilityKey: string;
89
+ name: string;
90
+ steps: ({
91
+ kind: "mutation";
92
+ key: string;
93
+ callback: {
94
+ kind: "mutation";
95
+ handle: string;
96
+ retry: boolean;
97
+ };
98
+ } | {
99
+ kind: "action";
100
+ key: string;
101
+ callback: {
102
+ kind: "action";
103
+ handle: string;
104
+ retry: boolean;
105
+ };
106
+ } | {
107
+ kind: "notify";
108
+ key: string;
109
+ callback: {
110
+ kind: "action";
111
+ handle: string;
112
+ retry: boolean;
113
+ };
114
+ } | {
115
+ kind: "decision";
116
+ key: string;
117
+ decisions: ("approved" | "rejected")[];
118
+ quorum: {
119
+ kind: "count";
120
+ approvals: number;
121
+ };
122
+ makerChecker: boolean;
123
+ expiresAfterMs?: number | undefined;
124
+ } | {
125
+ kind: "branch";
126
+ key: string;
127
+ approvedStepKey: string;
128
+ rejectedStepKey: string;
129
+ })[];
130
+ }, {
131
+ schemaVersion: import("convex/values").VLiteral<1, "required">;
132
+ compatibilityKey: import("convex/values").VString<string, "required">;
133
+ name: import("convex/values").VString<string, "required">;
134
+ steps: import("convex/values").VArray<({
135
+ kind: "mutation";
136
+ key: string;
137
+ callback: {
138
+ kind: "mutation";
139
+ handle: string;
140
+ retry: boolean;
141
+ };
142
+ } | {
143
+ kind: "action";
144
+ key: string;
145
+ callback: {
146
+ kind: "action";
147
+ handle: string;
148
+ retry: boolean;
149
+ };
150
+ } | {
151
+ kind: "notify";
152
+ key: string;
153
+ callback: {
154
+ kind: "action";
155
+ handle: string;
156
+ retry: boolean;
157
+ };
158
+ } | {
159
+ kind: "decision";
160
+ key: string;
161
+ decisions: ("approved" | "rejected")[];
162
+ quorum: {
163
+ kind: "count";
164
+ approvals: number;
165
+ };
166
+ makerChecker: boolean;
167
+ expiresAfterMs?: number | undefined;
168
+ } | {
169
+ kind: "branch";
170
+ key: string;
171
+ approvedStepKey: string;
172
+ rejectedStepKey: string;
173
+ })[], import("convex/values").VUnion<{
174
+ kind: "mutation";
175
+ key: string;
176
+ callback: {
177
+ kind: "mutation";
178
+ handle: string;
179
+ retry: boolean;
180
+ };
181
+ } | {
182
+ kind: "action";
183
+ key: string;
184
+ callback: {
185
+ kind: "action";
186
+ handle: string;
187
+ retry: boolean;
188
+ };
189
+ } | {
190
+ kind: "notify";
191
+ key: string;
192
+ callback: {
193
+ kind: "action";
194
+ handle: string;
195
+ retry: boolean;
196
+ };
197
+ } | {
198
+ kind: "decision";
199
+ key: string;
200
+ decisions: ("approved" | "rejected")[];
201
+ quorum: {
202
+ kind: "count";
203
+ approvals: number;
204
+ };
205
+ makerChecker: boolean;
206
+ expiresAfterMs?: number | undefined;
207
+ } | {
208
+ kind: "branch";
209
+ key: string;
210
+ approvedStepKey: string;
211
+ rejectedStepKey: string;
212
+ }, [import("convex/values").VUnion<{
213
+ kind: "mutation";
214
+ key: string;
215
+ callback: {
216
+ kind: "mutation";
217
+ handle: string;
218
+ retry: boolean;
219
+ };
220
+ } | {
221
+ kind: "action";
222
+ key: string;
223
+ callback: {
224
+ kind: "action";
225
+ handle: string;
226
+ retry: boolean;
227
+ };
228
+ }, [import("convex/values").VObject<{
229
+ kind: "mutation";
230
+ key: string;
231
+ callback: {
232
+ kind: "mutation";
233
+ handle: string;
234
+ retry: boolean;
235
+ };
236
+ }, {
237
+ kind: import("convex/values").VLiteral<"mutation", "required">;
238
+ key: import("convex/values").VString<string, "required">;
239
+ callback: import("convex/values").VObject<{
240
+ kind: "mutation";
241
+ handle: string;
242
+ retry: boolean;
243
+ }, {
244
+ kind: import("convex/values").VLiteral<"mutation", "required">;
245
+ handle: import("convex/values").VString<string, "required">;
246
+ retry: import("convex/values").VBoolean<boolean, "required">;
247
+ }, "required", "handle" | "kind" | "retry">;
248
+ }, "required", "callback" | "callback.handle" | "callback.kind" | "callback.retry" | "key" | "kind">, import("convex/values").VObject<{
249
+ kind: "action";
250
+ key: string;
251
+ callback: {
252
+ kind: "action";
253
+ handle: string;
254
+ retry: boolean;
255
+ };
256
+ }, {
257
+ kind: import("convex/values").VLiteral<"action", "required">;
258
+ key: import("convex/values").VString<string, "required">;
259
+ callback: import("convex/values").VObject<{
260
+ kind: "action";
261
+ handle: string;
262
+ retry: boolean;
263
+ }, {
264
+ kind: import("convex/values").VLiteral<"action", "required">;
265
+ handle: import("convex/values").VString<string, "required">;
266
+ retry: import("convex/values").VBoolean<boolean, "required">;
267
+ }, "required", "handle" | "kind" | "retry">;
268
+ }, "required", "callback" | "callback.handle" | "callback.kind" | "callback.retry" | "key" | "kind">], "required", "callback" | "callback.handle" | "callback.kind" | "callback.retry" | "key" | "kind">, import("convex/values").VObject<{
269
+ kind: "notify";
270
+ key: string;
271
+ callback: {
272
+ kind: "action";
273
+ handle: string;
274
+ retry: boolean;
275
+ };
276
+ }, {
277
+ kind: import("convex/values").VLiteral<"notify", "required">;
278
+ key: import("convex/values").VString<string, "required">;
279
+ callback: import("convex/values").VObject<{
280
+ kind: "action";
281
+ handle: string;
282
+ retry: boolean;
283
+ }, {
284
+ kind: import("convex/values").VLiteral<"action", "required">;
285
+ handle: import("convex/values").VString<string, "required">;
286
+ retry: import("convex/values").VBoolean<boolean, "required">;
287
+ }, "required", "handle" | "kind" | "retry">;
288
+ }, "required", "callback" | "callback.handle" | "callback.kind" | "callback.retry" | "key" | "kind">, import("convex/values").VObject<{
289
+ kind: "decision";
290
+ key: string;
291
+ decisions: ("approved" | "rejected")[];
292
+ quorum: {
293
+ kind: "count";
294
+ approvals: number;
295
+ };
296
+ makerChecker: boolean;
297
+ expiresAfterMs?: number | undefined;
298
+ }, {
299
+ kind: import("convex/values").VLiteral<"decision", "required">;
300
+ key: import("convex/values").VString<string, "required">;
301
+ decisions: import("convex/values").VArray<("approved" | "rejected")[], import("convex/values").VUnion<"approved" | "rejected", (import("convex/values").VLiteral<"approved", "required"> | import("convex/values").VLiteral<"rejected", "required">)[], "required", never>, "required">;
302
+ quorum: import("convex/values").VObject<{
303
+ kind: "count";
304
+ approvals: number;
305
+ }, {
306
+ kind: import("convex/values").VUnion<"count", import("convex/values").VLiteral<"count", "required">[], "required", never>;
307
+ approvals: import("convex/values").VFloat64<number, "required">;
308
+ }, "required", "approvals" | "kind">;
309
+ makerChecker: import("convex/values").VBoolean<boolean, "required">;
310
+ expiresAfterMs: import("convex/values").VFloat64<number | undefined, "optional">;
311
+ }, "required", "decisions" | "expiresAfterMs" | "key" | "kind" | "makerChecker" | "quorum" | "quorum.approvals" | "quorum.kind">, import("convex/values").VObject<{
312
+ kind: "branch";
313
+ key: string;
314
+ approvedStepKey: string;
315
+ rejectedStepKey: string;
316
+ }, {
317
+ kind: import("convex/values").VLiteral<"branch", "required">;
318
+ key: import("convex/values").VString<string, "required">;
319
+ approvedStepKey: import("convex/values").VString<string, "required">;
320
+ rejectedStepKey: import("convex/values").VString<string, "required">;
321
+ }, "required", "approvedStepKey" | "key" | "kind" | "rejectedStepKey">], "required", "approvedStepKey" | "callback" | "callback.handle" | "callback.kind" | "callback.retry" | "decisions" | "expiresAfterMs" | "key" | "kind" | "makerChecker" | "quorum" | "quorum.approvals" | "quorum.kind" | "rejectedStepKey">, "required">;
322
+ }, "required", "compatibilityKey" | "name" | "schemaVersion" | "steps">;
323
+ state: import("convex/values").VUnion<"approved" | "canceled" | "expired" | "pending" | "rejected", (import("convex/values").VLiteral<"approved", "required"> | import("convex/values").VLiteral<"canceled", "required"> | import("convex/values").VLiteral<"expired", "required"> | import("convex/values").VLiteral<"pending", "required"> | import("convex/values").VLiteral<"rejected", "required">)[], "required", never>;
324
+ currentStepKey: import("convex/values").VString<string | undefined, "optional">;
325
+ executionFailedStepKey: import("convex/values").VString<string | undefined, "optional">;
326
+ expiresAt: import("convex/values").VFloat64<number | undefined, "optional">;
327
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
328
+ createdAt: import("convex/values").VFloat64<number, "required">;
329
+ updatedAt: import("convex/values").VFloat64<number, "required">;
330
+ terminalAt: import("convex/values").VFloat64<number | undefined, "optional">;
331
+ }, "required", "createdAt" | "currentStepKey" | "executionFailedStepKey" | "expiresAt" | "metadata" | "requester" | "requester.actorRef" | "requester.capabilities" | "requester.metadata" | "resourceRef" | "resourceType" | "scopeRef" | "state" | "terminalAt" | "updatedAt" | "workflow" | "workflow.compatibilityKey" | "workflow.name" | "workflow.schemaVersion" | "workflow.steps" | "workflowId" | `metadata.${string}` | `requester.metadata.${string}`>, {
332
+ by_resourceType_and_resourceRef: ["resourceType", "resourceRef", "_creationTime"];
333
+ by_scopeRef_and_state: ["scopeRef", "state", "_creationTime"];
334
+ by_state_and_expiresAt: ["state", "expiresAt", "_creationTime"];
335
+ }, {}, {}>;
336
+ approvalDecisions: import("convex/server").TableDefinition<import("convex/values").VObject<{
337
+ runId: string & {
338
+ __tableName: "approvalRuns";
339
+ };
340
+ stepKey: string;
341
+ actor: {
342
+ actorRef: string;
343
+ capabilities: string[];
344
+ metadata?: {
345
+ [x: string]: string;
346
+ } | undefined;
347
+ };
348
+ decision: "approved" | "rejected";
349
+ reason?: string | undefined;
350
+ decidedAt: number;
351
+ }, {
352
+ runId: import("convex/values").VId<import("convex/values").GenericId<"approvalRuns">, "required">;
353
+ stepKey: import("convex/values").VString<string, "required">;
354
+ actor: import("convex/values").VObject<{
355
+ actorRef: string;
356
+ capabilities: string[];
357
+ metadata?: {
358
+ [x: string]: string;
359
+ } | undefined;
360
+ }, {
361
+ actorRef: import("convex/values").VString<string, "required">;
362
+ capabilities: import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">;
363
+ metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
364
+ }, "required", "actorRef" | "capabilities" | "metadata" | `metadata.${string}`>;
365
+ decision: import("convex/values").VUnion<"approved" | "rejected", (import("convex/values").VLiteral<"approved", "required"> | import("convex/values").VLiteral<"rejected", "required">)[], "required", never>;
366
+ reason: import("convex/values").VString<string | undefined, "optional">;
367
+ decidedAt: import("convex/values").VFloat64<number, "required">;
368
+ }, "required", "actor" | "actor.actorRef" | "actor.capabilities" | "actor.metadata" | "decidedAt" | "decision" | "reason" | "runId" | "stepKey" | `actor.metadata.${string}`>, {
369
+ by_runId_and_decidedAt: ["runId", "decidedAt", "_creationTime"];
370
+ by_runId_and_stepKey_and_actor_actorRef: ["runId", "stepKey", "actor.actorRef", "_creationTime"];
371
+ by_runId_and_stepKey_and_decidedAt: ["runId", "stepKey", "decidedAt", "_creationTime"];
372
+ }, {}, {}>;
373
+ }, true>;
374
+ //#endregion
375
+ export { _default as default };
376
+ //# sourceMappingURL=schema.d.mts.map
@@ -0,0 +1,2 @@
1
+ import{approvalDecisionDocument as e,approvalRunDocument as t}from"./validators.mjs";import{zodToConvex as n}from"convex-helpers/server/zod4";import{defineSchema as r,defineTable as i}from"convex/server";var a=r({approvalRuns:i(n(t)).index(`by_resourceType_and_resourceRef`,[`resourceType`,`resourceRef`]).index(`by_scopeRef_and_state`,[`scopeRef`,`state`]).index(`by_state_and_expiresAt`,[`state`,`expiresAt`]),approvalDecisions:i(n(e)).index(`by_runId_and_stepKey_and_actor_actorRef`,[`runId`,`stepKey`,`actor.actorRef`]).index(`by_runId_and_stepKey_and_decidedAt`,[`runId`,`stepKey`,`decidedAt`]).index(`by_runId_and_decidedAt`,[`runId`,`decidedAt`])});export{a as default};
2
+ //# sourceMappingURL=schema.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../../../src/components/approvals/schema.ts"],"sourcesContent":["import { zodToConvex } from 'convex-helpers/server/zod4'\nimport { defineSchema, defineTable } from 'convex/server'\n\nimport { approvalDecisionDocument, approvalRunDocument } from './validators'\n\nexport default defineSchema({\n\tapprovalRuns: defineTable(zodToConvex(approvalRunDocument))\n\t\t.index('by_resourceType_and_resourceRef', ['resourceType', 'resourceRef'])\n\t\t.index('by_scopeRef_and_state', ['scopeRef', 'state'])\n\t\t.index('by_state_and_expiresAt', ['state', 'expiresAt']),\n\tapprovalDecisions: defineTable(zodToConvex(approvalDecisionDocument))\n\t\t.index('by_runId_and_stepKey_and_actor_actorRef', [\n\t\t\t'runId',\n\t\t\t'stepKey',\n\t\t\t'actor.actorRef',\n\t\t])\n\t\t.index('by_runId_and_stepKey_and_decidedAt', [\n\t\t\t'runId',\n\t\t\t'stepKey',\n\t\t\t'decidedAt',\n\t\t])\n\t\t.index('by_runId_and_decidedAt', ['runId', 'decidedAt']),\n})\n"],"mappings":"4MAKA,IAAA,EAAe,EAAa,CAC3B,aAAc,EAAY,EAAY,CAAmB,CAAC,CAAC,CACzD,MAAM,kCAAmC,CAAC,eAAgB,aAAa,CAAC,CAAC,CACzE,MAAM,wBAAyB,CAAC,WAAY,OAAO,CAAC,CAAC,CACrD,MAAM,yBAA0B,CAAC,QAAS,WAAW,CAAC,EACxD,kBAAmB,EAAY,EAAY,CAAwB,CAAC,CAAC,CACnE,MAAM,0CAA2C,CACjD,QACA,UACA,gBACD,CAAC,CAAC,CACD,MAAM,qCAAsC,CAC5C,QACA,UACA,WACD,CAAC,CAAC,CACD,MAAM,yBAA0B,CAAC,QAAS,WAAW,CAAC,CACzD,CAAC"}
@@ -0,0 +1,302 @@
1
+ import { z } from "zod";
2
+ declare namespace validators_d_exports {
3
+ export { ApprovalActor, ApprovalMetadata, ApprovalWorkflowDescriptor, approvalActionCallback, approvalActor, approvalBranchStep, approvalCallback, approvalCallbackKind, approvalCallbackStep, approvalDecision, approvalDecisionDocument, approvalDecisionStep, approvalMetadata, approvalMutationCallback, approvalName, approvalNotifyStep, approvalQuorum, approvalQuorumKind, approvalReason, approvalReference, approvalRunDocument, approvalRunState, approvalStepKind, approvalWorkflowDescriptor, approvalWorkflowStep };
4
+ }
5
+ declare const approvalRunState: z.ZodEnum<{
6
+ approved: "approved";
7
+ canceled: "canceled";
8
+ expired: "expired";
9
+ pending: "pending";
10
+ rejected: "rejected";
11
+ }>;
12
+ declare const approvalDecision: z.ZodEnum<{
13
+ approved: "approved";
14
+ rejected: "rejected";
15
+ }>;
16
+ declare const approvalStepKind: z.ZodEnum<{
17
+ action: "action";
18
+ branch: "branch";
19
+ decision: "decision";
20
+ mutation: "mutation";
21
+ notify: "notify";
22
+ }>;
23
+ declare const approvalCallbackKind: z.ZodEnum<{
24
+ action: "action";
25
+ mutation: "mutation";
26
+ }>;
27
+ declare const approvalQuorumKind: z.ZodEnum<{
28
+ count: "count";
29
+ }>;
30
+ declare const approvalReference: z.ZodString;
31
+ declare const approvalName: z.ZodString;
32
+ declare const approvalReason: z.ZodString;
33
+ declare const approvalMetadata: z.ZodRecord<z.ZodString, z.ZodString>;
34
+ declare const approvalActor: z.ZodObject<{
35
+ actorRef: z.ZodString;
36
+ capabilities: z.ZodArray<z.ZodString>;
37
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
38
+ }, z.core.$strict>;
39
+ declare const approvalMutationCallback: z.ZodObject<{
40
+ kind: z.ZodLiteral<"mutation">;
41
+ handle: z.ZodString;
42
+ retry: z.ZodBoolean;
43
+ }, z.core.$strict>;
44
+ declare const approvalActionCallback: z.ZodObject<{
45
+ kind: z.ZodLiteral<"action">;
46
+ handle: z.ZodString;
47
+ retry: z.ZodBoolean;
48
+ }, z.core.$strict>;
49
+ declare const approvalCallback: z.ZodDiscriminatedUnion<[z.ZodObject<{
50
+ kind: z.ZodLiteral<"mutation">;
51
+ handle: z.ZodString;
52
+ retry: z.ZodBoolean;
53
+ }, z.core.$strict>, z.ZodObject<{
54
+ kind: z.ZodLiteral<"action">;
55
+ handle: z.ZodString;
56
+ retry: z.ZodBoolean;
57
+ }, z.core.$strict>], "kind">;
58
+ declare const approvalQuorum: z.ZodObject<{
59
+ kind: z.ZodEnum<{
60
+ count: "count";
61
+ }>;
62
+ approvals: z.ZodNumber;
63
+ }, z.core.$strict>;
64
+ declare const approvalCallbackStep: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
+ kind: z.ZodLiteral<"mutation">;
66
+ key: z.ZodString;
67
+ callback: z.ZodObject<{
68
+ kind: z.ZodLiteral<"mutation">;
69
+ handle: z.ZodString;
70
+ retry: z.ZodBoolean;
71
+ }, z.core.$strict>;
72
+ }, z.core.$strict>, z.ZodObject<{
73
+ kind: z.ZodLiteral<"action">;
74
+ key: z.ZodString;
75
+ callback: z.ZodObject<{
76
+ kind: z.ZodLiteral<"action">;
77
+ handle: z.ZodString;
78
+ retry: z.ZodBoolean;
79
+ }, z.core.$strict>;
80
+ }, z.core.$strict>], "kind">;
81
+ declare const approvalNotifyStep: z.ZodObject<{
82
+ kind: z.ZodLiteral<"notify">;
83
+ key: z.ZodString;
84
+ callback: z.ZodObject<{
85
+ kind: z.ZodLiteral<"action">;
86
+ handle: z.ZodString;
87
+ retry: z.ZodBoolean;
88
+ }, z.core.$strict>;
89
+ }, z.core.$strict>;
90
+ declare const approvalDecisionStep: z.ZodObject<{
91
+ kind: z.ZodLiteral<"decision">;
92
+ key: z.ZodString;
93
+ decisions: z.ZodArray<z.ZodEnum<{
94
+ approved: "approved";
95
+ rejected: "rejected";
96
+ }>>;
97
+ quorum: z.ZodObject<{
98
+ kind: z.ZodEnum<{
99
+ count: "count";
100
+ }>;
101
+ approvals: z.ZodNumber;
102
+ }, z.core.$strict>;
103
+ makerChecker: z.ZodBoolean;
104
+ expiresAfterMs: z.ZodOptional<z.ZodNumber>;
105
+ }, z.core.$strict>;
106
+ declare const approvalBranchStep: z.ZodObject<{
107
+ kind: z.ZodLiteral<"branch">;
108
+ key: z.ZodString;
109
+ approvedStepKey: z.ZodString;
110
+ rejectedStepKey: z.ZodString;
111
+ }, z.core.$strict>;
112
+ declare const approvalWorkflowStep: z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
113
+ kind: z.ZodLiteral<"mutation">;
114
+ key: z.ZodString;
115
+ callback: z.ZodObject<{
116
+ kind: z.ZodLiteral<"mutation">;
117
+ handle: z.ZodString;
118
+ retry: z.ZodBoolean;
119
+ }, z.core.$strict>;
120
+ }, z.core.$strict>, z.ZodObject<{
121
+ kind: z.ZodLiteral<"action">;
122
+ key: z.ZodString;
123
+ callback: z.ZodObject<{
124
+ kind: z.ZodLiteral<"action">;
125
+ handle: z.ZodString;
126
+ retry: z.ZodBoolean;
127
+ }, z.core.$strict>;
128
+ }, z.core.$strict>], "kind">, z.ZodObject<{
129
+ kind: z.ZodLiteral<"notify">;
130
+ key: z.ZodString;
131
+ callback: z.ZodObject<{
132
+ kind: z.ZodLiteral<"action">;
133
+ handle: z.ZodString;
134
+ retry: z.ZodBoolean;
135
+ }, z.core.$strict>;
136
+ }, z.core.$strict>, z.ZodObject<{
137
+ kind: z.ZodLiteral<"decision">;
138
+ key: z.ZodString;
139
+ decisions: z.ZodArray<z.ZodEnum<{
140
+ approved: "approved";
141
+ rejected: "rejected";
142
+ }>>;
143
+ quorum: z.ZodObject<{
144
+ kind: z.ZodEnum<{
145
+ count: "count";
146
+ }>;
147
+ approvals: z.ZodNumber;
148
+ }, z.core.$strict>;
149
+ makerChecker: z.ZodBoolean;
150
+ expiresAfterMs: z.ZodOptional<z.ZodNumber>;
151
+ }, z.core.$strict>, z.ZodObject<{
152
+ kind: z.ZodLiteral<"branch">;
153
+ key: z.ZodString;
154
+ approvedStepKey: z.ZodString;
155
+ rejectedStepKey: z.ZodString;
156
+ }, z.core.$strict>], "kind">;
157
+ declare const approvalWorkflowDescriptor: z.ZodObject<{
158
+ schemaVersion: z.ZodLiteral<1>;
159
+ compatibilityKey: z.ZodString;
160
+ name: z.ZodString;
161
+ steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
162
+ kind: z.ZodLiteral<"mutation">;
163
+ key: z.ZodString;
164
+ callback: z.ZodObject<{
165
+ kind: z.ZodLiteral<"mutation">;
166
+ handle: z.ZodString;
167
+ retry: z.ZodBoolean;
168
+ }, z.core.$strict>;
169
+ }, z.core.$strict>, z.ZodObject<{
170
+ kind: z.ZodLiteral<"action">;
171
+ key: z.ZodString;
172
+ callback: z.ZodObject<{
173
+ kind: z.ZodLiteral<"action">;
174
+ handle: z.ZodString;
175
+ retry: z.ZodBoolean;
176
+ }, z.core.$strict>;
177
+ }, z.core.$strict>], "kind">, z.ZodObject<{
178
+ kind: z.ZodLiteral<"notify">;
179
+ key: z.ZodString;
180
+ callback: z.ZodObject<{
181
+ kind: z.ZodLiteral<"action">;
182
+ handle: z.ZodString;
183
+ retry: z.ZodBoolean;
184
+ }, z.core.$strict>;
185
+ }, z.core.$strict>, z.ZodObject<{
186
+ kind: z.ZodLiteral<"decision">;
187
+ key: z.ZodString;
188
+ decisions: z.ZodArray<z.ZodEnum<{
189
+ approved: "approved";
190
+ rejected: "rejected";
191
+ }>>;
192
+ quorum: z.ZodObject<{
193
+ kind: z.ZodEnum<{
194
+ count: "count";
195
+ }>;
196
+ approvals: z.ZodNumber;
197
+ }, z.core.$strict>;
198
+ makerChecker: z.ZodBoolean;
199
+ expiresAfterMs: z.ZodOptional<z.ZodNumber>;
200
+ }, z.core.$strict>, z.ZodObject<{
201
+ kind: z.ZodLiteral<"branch">;
202
+ key: z.ZodString;
203
+ approvedStepKey: z.ZodString;
204
+ rejectedStepKey: z.ZodString;
205
+ }, z.core.$strict>], "kind">>;
206
+ }, z.core.$strict>;
207
+ declare const approvalRunDocument: z.ZodObject<{
208
+ scopeRef: z.ZodString;
209
+ resourceType: z.ZodString;
210
+ resourceRef: z.ZodString;
211
+ requester: z.ZodObject<{
212
+ actorRef: z.ZodString;
213
+ capabilities: z.ZodArray<z.ZodString>;
214
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
215
+ }, z.core.$strict>;
216
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
217
+ workflow: z.ZodObject<{
218
+ schemaVersion: z.ZodLiteral<1>;
219
+ compatibilityKey: z.ZodString;
220
+ name: z.ZodString;
221
+ steps: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodDiscriminatedUnion<[z.ZodObject<{
222
+ kind: z.ZodLiteral<"mutation">;
223
+ key: z.ZodString;
224
+ callback: z.ZodObject<{
225
+ kind: z.ZodLiteral<"mutation">;
226
+ handle: z.ZodString;
227
+ retry: z.ZodBoolean;
228
+ }, z.core.$strict>;
229
+ }, z.core.$strict>, z.ZodObject<{
230
+ kind: z.ZodLiteral<"action">;
231
+ key: z.ZodString;
232
+ callback: z.ZodObject<{
233
+ kind: z.ZodLiteral<"action">;
234
+ handle: z.ZodString;
235
+ retry: z.ZodBoolean;
236
+ }, z.core.$strict>;
237
+ }, z.core.$strict>], "kind">, z.ZodObject<{
238
+ kind: z.ZodLiteral<"notify">;
239
+ key: z.ZodString;
240
+ callback: z.ZodObject<{
241
+ kind: z.ZodLiteral<"action">;
242
+ handle: z.ZodString;
243
+ retry: z.ZodBoolean;
244
+ }, z.core.$strict>;
245
+ }, z.core.$strict>, z.ZodObject<{
246
+ kind: z.ZodLiteral<"decision">;
247
+ key: z.ZodString;
248
+ decisions: z.ZodArray<z.ZodEnum<{
249
+ approved: "approved";
250
+ rejected: "rejected";
251
+ }>>;
252
+ quorum: z.ZodObject<{
253
+ kind: z.ZodEnum<{
254
+ count: "count";
255
+ }>;
256
+ approvals: z.ZodNumber;
257
+ }, z.core.$strict>;
258
+ makerChecker: z.ZodBoolean;
259
+ expiresAfterMs: z.ZodOptional<z.ZodNumber>;
260
+ }, z.core.$strict>, z.ZodObject<{
261
+ kind: z.ZodLiteral<"branch">;
262
+ key: z.ZodString;
263
+ approvedStepKey: z.ZodString;
264
+ rejectedStepKey: z.ZodString;
265
+ }, z.core.$strict>], "kind">>;
266
+ }, z.core.$strict>;
267
+ state: z.ZodEnum<{
268
+ approved: "approved";
269
+ canceled: "canceled";
270
+ expired: "expired";
271
+ pending: "pending";
272
+ rejected: "rejected";
273
+ }>;
274
+ currentStepKey: z.ZodOptional<z.ZodString>;
275
+ executionFailedStepKey: z.ZodOptional<z.ZodString>;
276
+ expiresAt: z.ZodOptional<z.ZodNumber>;
277
+ workflowId: z.ZodOptional<z.ZodString>;
278
+ createdAt: z.ZodNumber;
279
+ updatedAt: z.ZodNumber;
280
+ terminalAt: z.ZodOptional<z.ZodNumber>;
281
+ }, z.core.$strict>;
282
+ declare const approvalDecisionDocument: z.ZodObject<{
283
+ runId: import("convex-helpers/server/zod4").Zid<"approvalRuns">;
284
+ stepKey: z.ZodString;
285
+ actor: z.ZodObject<{
286
+ actorRef: z.ZodString;
287
+ capabilities: z.ZodArray<z.ZodString>;
288
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
289
+ }, z.core.$strict>;
290
+ decision: z.ZodEnum<{
291
+ approved: "approved";
292
+ rejected: "rejected";
293
+ }>;
294
+ reason: z.ZodOptional<z.ZodString>;
295
+ decidedAt: z.ZodNumber;
296
+ }, z.core.$strict>;
297
+ type ApprovalWorkflowDescriptor = z.infer<typeof approvalWorkflowDescriptor>;
298
+ type ApprovalActor = z.infer<typeof approvalActor>;
299
+ type ApprovalMetadata = z.infer<typeof approvalMetadata>;
300
+ //#endregion
301
+ export { ApprovalActor, ApprovalMetadata, ApprovalWorkflowDescriptor, approvalActionCallback, approvalActor, approvalBranchStep, approvalCallback, approvalCallbackKind, approvalCallbackStep, approvalDecision, approvalDecisionDocument, approvalDecisionStep, approvalMetadata, approvalMutationCallback, approvalName, approvalNotifyStep, approvalQuorum, approvalQuorumKind, approvalReason, approvalReference, approvalRunDocument, approvalRunState, approvalStepKind, approvalWorkflowDescriptor, approvalWorkflowStep, validators_d_exports };
302
+ //# sourceMappingURL=validators.d.mts.map