robotrock 0.1.0 → 0.2.0

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.
@@ -0,0 +1,631 @@
1
+ import { z } from 'zod';
2
+
3
+ interface JSONSchema7 {
4
+ $id?: string;
5
+ $ref?: string;
6
+ $schema?: string;
7
+ $comment?: string;
8
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[];
9
+ enum?: unknown[];
10
+ const?: unknown;
11
+ multipleOf?: number;
12
+ maximum?: number;
13
+ exclusiveMaximum?: number;
14
+ minimum?: number;
15
+ exclusiveMinimum?: number;
16
+ maxLength?: number;
17
+ minLength?: number;
18
+ pattern?: string;
19
+ format?: string;
20
+ items?: JSONSchema7 | JSONSchema7[];
21
+ additionalItems?: JSONSchema7 | boolean;
22
+ maxItems?: number;
23
+ minItems?: number;
24
+ uniqueItems?: boolean;
25
+ contains?: JSONSchema7;
26
+ maxProperties?: number;
27
+ minProperties?: number;
28
+ required?: string[];
29
+ properties?: Record<string, JSONSchema7>;
30
+ patternProperties?: Record<string, JSONSchema7>;
31
+ additionalProperties?: JSONSchema7 | boolean;
32
+ dependencies?: Record<string, JSONSchema7 | string[]>;
33
+ propertyNames?: JSONSchema7;
34
+ if?: JSONSchema7;
35
+ then?: JSONSchema7;
36
+ else?: JSONSchema7;
37
+ allOf?: JSONSchema7[];
38
+ anyOf?: JSONSchema7[];
39
+ oneOf?: JSONSchema7[];
40
+ not?: JSONSchema7;
41
+ title?: string;
42
+ description?: string;
43
+ default?: unknown;
44
+ readOnly?: boolean;
45
+ writeOnly?: boolean;
46
+ examples?: unknown[];
47
+ }
48
+ type JSONSchema7TypeName = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
49
+ type ExtendedJSONSchema7 = JSONSchema7 & {
50
+ enumNames?: string[];
51
+ [key: string]: unknown;
52
+ };
53
+ type UiSchema = {
54
+ "ui:widget"?: string;
55
+ "ui:title"?: string;
56
+ "ui:description"?: string;
57
+ "ui:placeholder"?: string;
58
+ "ui:options"?: Record<string, unknown>;
59
+ [key: string]: unknown;
60
+ };
61
+ declare const webhookHandlerSchema: z.ZodObject<{
62
+ type: z.ZodLiteral<"webhook">;
63
+ url: z.ZodEffects<z.ZodString, string, string>;
64
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ type: "webhook";
67
+ url: string;
68
+ headers: Record<string, string>;
69
+ }, {
70
+ type: "webhook";
71
+ url: string;
72
+ headers: Record<string, string>;
73
+ }>;
74
+ declare const triggerHandlerSchema: z.ZodObject<{
75
+ url: z.ZodEffects<z.ZodString, string, string>;
76
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
77
+ } & {
78
+ type: z.ZodLiteral<"trigger">;
79
+ tokenId: z.ZodString;
80
+ }, "strip", z.ZodTypeAny, {
81
+ type: "trigger";
82
+ url: string;
83
+ headers: Record<string, string>;
84
+ tokenId: string;
85
+ }, {
86
+ type: "trigger";
87
+ url: string;
88
+ headers: Record<string, string>;
89
+ tokenId: string;
90
+ }>;
91
+ declare const handlerSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
92
+ type: z.ZodLiteral<"webhook">;
93
+ url: z.ZodEffects<z.ZodString, string, string>;
94
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
95
+ }, "strip", z.ZodTypeAny, {
96
+ type: "webhook";
97
+ url: string;
98
+ headers: Record<string, string>;
99
+ }, {
100
+ type: "webhook";
101
+ url: string;
102
+ headers: Record<string, string>;
103
+ }>, z.ZodObject<{
104
+ url: z.ZodEffects<z.ZodString, string, string>;
105
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
106
+ } & {
107
+ type: z.ZodLiteral<"trigger">;
108
+ tokenId: z.ZodString;
109
+ }, "strip", z.ZodTypeAny, {
110
+ type: "trigger";
111
+ url: string;
112
+ headers: Record<string, string>;
113
+ tokenId: string;
114
+ }, {
115
+ type: "trigger";
116
+ url: string;
117
+ headers: Record<string, string>;
118
+ tokenId: string;
119
+ }>]>;
120
+ declare const taskActionSchema: z.ZodObject<{
121
+ id: z.ZodString;
122
+ title: z.ZodString;
123
+ description: z.ZodOptional<z.ZodString>;
124
+ schema: z.ZodOptional<z.ZodType<ExtendedJSONSchema7, z.ZodTypeDef, ExtendedJSONSchema7>>;
125
+ ui: z.ZodOptional<z.ZodType<UiSchema, z.ZodTypeDef, UiSchema>>;
126
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
127
+ handlers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
128
+ type: z.ZodLiteral<"webhook">;
129
+ url: z.ZodEffects<z.ZodString, string, string>;
130
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ type: "webhook";
133
+ url: string;
134
+ headers: Record<string, string>;
135
+ }, {
136
+ type: "webhook";
137
+ url: string;
138
+ headers: Record<string, string>;
139
+ }>, z.ZodObject<{
140
+ url: z.ZodEffects<z.ZodString, string, string>;
141
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
142
+ } & {
143
+ type: z.ZodLiteral<"trigger">;
144
+ tokenId: z.ZodString;
145
+ }, "strip", z.ZodTypeAny, {
146
+ type: "trigger";
147
+ url: string;
148
+ headers: Record<string, string>;
149
+ tokenId: string;
150
+ }, {
151
+ type: "trigger";
152
+ url: string;
153
+ headers: Record<string, string>;
154
+ tokenId: string;
155
+ }>]>, "many">>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ id: string;
158
+ title: string;
159
+ description?: string | undefined;
160
+ schema?: ExtendedJSONSchema7 | undefined;
161
+ ui?: UiSchema | undefined;
162
+ data?: Record<string, unknown> | undefined;
163
+ handlers?: ({
164
+ type: "webhook";
165
+ url: string;
166
+ headers: Record<string, string>;
167
+ } | {
168
+ type: "trigger";
169
+ url: string;
170
+ headers: Record<string, string>;
171
+ tokenId: string;
172
+ })[] | undefined;
173
+ }, {
174
+ id: string;
175
+ title: string;
176
+ description?: string | undefined;
177
+ schema?: ExtendedJSONSchema7 | undefined;
178
+ ui?: UiSchema | undefined;
179
+ data?: Record<string, unknown> | undefined;
180
+ handlers?: ({
181
+ type: "webhook";
182
+ url: string;
183
+ headers: Record<string, string>;
184
+ } | {
185
+ type: "trigger";
186
+ url: string;
187
+ headers: Record<string, string>;
188
+ tokenId: string;
189
+ })[] | undefined;
190
+ }>;
191
+ declare const taskContextSchema: z.ZodObject<{
192
+ app: z.ZodOptional<z.ZodString>;
193
+ type: z.ZodString;
194
+ name: z.ZodString;
195
+ description: z.ZodOptional<z.ZodString>;
196
+ validUntil: z.ZodOptional<z.ZodString>;
197
+ context: z.ZodOptional<z.ZodObject<{
198
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
199
+ ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Record<string, unknown>, z.ZodTypeDef, Record<string, unknown>>>>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ data: Record<string, unknown>;
202
+ ui?: Record<string, Record<string, unknown>> | undefined;
203
+ }, {
204
+ data: Record<string, unknown>;
205
+ ui?: Record<string, Record<string, unknown>> | undefined;
206
+ }>>;
207
+ version: z.ZodOptional<z.ZodLiteral<2>>;
208
+ actions: z.ZodArray<z.ZodObject<{
209
+ id: z.ZodString;
210
+ title: z.ZodString;
211
+ description: z.ZodOptional<z.ZodString>;
212
+ schema: z.ZodOptional<z.ZodType<ExtendedJSONSchema7, z.ZodTypeDef, ExtendedJSONSchema7>>;
213
+ ui: z.ZodOptional<z.ZodType<UiSchema, z.ZodTypeDef, UiSchema>>;
214
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
215
+ handlers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
216
+ type: z.ZodLiteral<"webhook">;
217
+ url: z.ZodEffects<z.ZodString, string, string>;
218
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ type: "webhook";
221
+ url: string;
222
+ headers: Record<string, string>;
223
+ }, {
224
+ type: "webhook";
225
+ url: string;
226
+ headers: Record<string, string>;
227
+ }>, z.ZodObject<{
228
+ url: z.ZodEffects<z.ZodString, string, string>;
229
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
230
+ } & {
231
+ type: z.ZodLiteral<"trigger">;
232
+ tokenId: z.ZodString;
233
+ }, "strip", z.ZodTypeAny, {
234
+ type: "trigger";
235
+ url: string;
236
+ headers: Record<string, string>;
237
+ tokenId: string;
238
+ }, {
239
+ type: "trigger";
240
+ url: string;
241
+ headers: Record<string, string>;
242
+ tokenId: string;
243
+ }>]>, "many">>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ id: string;
246
+ title: string;
247
+ description?: string | undefined;
248
+ schema?: ExtendedJSONSchema7 | undefined;
249
+ ui?: UiSchema | undefined;
250
+ data?: Record<string, unknown> | undefined;
251
+ handlers?: ({
252
+ type: "webhook";
253
+ url: string;
254
+ headers: Record<string, string>;
255
+ } | {
256
+ type: "trigger";
257
+ url: string;
258
+ headers: Record<string, string>;
259
+ tokenId: string;
260
+ })[] | undefined;
261
+ }, {
262
+ id: string;
263
+ title: string;
264
+ description?: string | undefined;
265
+ schema?: ExtendedJSONSchema7 | undefined;
266
+ ui?: UiSchema | undefined;
267
+ data?: Record<string, unknown> | undefined;
268
+ handlers?: ({
269
+ type: "webhook";
270
+ url: string;
271
+ headers: Record<string, string>;
272
+ } | {
273
+ type: "trigger";
274
+ url: string;
275
+ headers: Record<string, string>;
276
+ tokenId: string;
277
+ })[] | undefined;
278
+ }>, "many">;
279
+ }, "strip", z.ZodTypeAny, {
280
+ type: string;
281
+ name: string;
282
+ actions: {
283
+ id: string;
284
+ title: string;
285
+ description?: string | undefined;
286
+ schema?: ExtendedJSONSchema7 | undefined;
287
+ ui?: UiSchema | undefined;
288
+ data?: Record<string, unknown> | undefined;
289
+ handlers?: ({
290
+ type: "webhook";
291
+ url: string;
292
+ headers: Record<string, string>;
293
+ } | {
294
+ type: "trigger";
295
+ url: string;
296
+ headers: Record<string, string>;
297
+ tokenId: string;
298
+ })[] | undefined;
299
+ }[];
300
+ description?: string | undefined;
301
+ app?: string | undefined;
302
+ validUntil?: string | undefined;
303
+ context?: {
304
+ data: Record<string, unknown>;
305
+ ui?: Record<string, Record<string, unknown>> | undefined;
306
+ } | undefined;
307
+ version?: 2 | undefined;
308
+ }, {
309
+ type: string;
310
+ name: string;
311
+ actions: {
312
+ id: string;
313
+ title: string;
314
+ description?: string | undefined;
315
+ schema?: ExtendedJSONSchema7 | undefined;
316
+ ui?: UiSchema | undefined;
317
+ data?: Record<string, unknown> | undefined;
318
+ handlers?: ({
319
+ type: "webhook";
320
+ url: string;
321
+ headers: Record<string, string>;
322
+ } | {
323
+ type: "trigger";
324
+ url: string;
325
+ headers: Record<string, string>;
326
+ tokenId: string;
327
+ })[] | undefined;
328
+ }[];
329
+ description?: string | undefined;
330
+ app?: string | undefined;
331
+ validUntil?: string | undefined;
332
+ context?: {
333
+ data: Record<string, unknown>;
334
+ ui?: Record<string, Record<string, unknown>> | undefined;
335
+ } | undefined;
336
+ version?: 2 | undefined;
337
+ }>;
338
+ /** Assignment targets at task create (not stored in task context JSON). */
339
+ declare const assignToSchema: z.ZodEffects<z.ZodObject<{
340
+ users: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
341
+ groups: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
342
+ }, "strip", z.ZodTypeAny, {
343
+ users?: string[] | undefined;
344
+ groups?: string[] | undefined;
345
+ }, {
346
+ users?: string[] | undefined;
347
+ groups?: string[] | undefined;
348
+ }>, {
349
+ users?: string[] | undefined;
350
+ groups?: string[] | undefined;
351
+ }, {
352
+ users?: string[] | undefined;
353
+ groups?: string[] | undefined;
354
+ }>;
355
+ declare const createTaskBodySchema: z.ZodObject<{
356
+ app: z.ZodOptional<z.ZodString>;
357
+ type: z.ZodString;
358
+ name: z.ZodString;
359
+ description: z.ZodOptional<z.ZodString>;
360
+ validUntil: z.ZodOptional<z.ZodString>;
361
+ context: z.ZodOptional<z.ZodObject<{
362
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
363
+ ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<Record<string, unknown>, z.ZodTypeDef, Record<string, unknown>>>>;
364
+ }, "strip", z.ZodTypeAny, {
365
+ data: Record<string, unknown>;
366
+ ui?: Record<string, Record<string, unknown>> | undefined;
367
+ }, {
368
+ data: Record<string, unknown>;
369
+ ui?: Record<string, Record<string, unknown>> | undefined;
370
+ }>>;
371
+ version: z.ZodOptional<z.ZodLiteral<2>>;
372
+ actions: z.ZodArray<z.ZodObject<{
373
+ id: z.ZodString;
374
+ title: z.ZodString;
375
+ description: z.ZodOptional<z.ZodString>;
376
+ schema: z.ZodOptional<z.ZodType<ExtendedJSONSchema7, z.ZodTypeDef, ExtendedJSONSchema7>>;
377
+ ui: z.ZodOptional<z.ZodType<UiSchema, z.ZodTypeDef, UiSchema>>;
378
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
379
+ handlers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
380
+ type: z.ZodLiteral<"webhook">;
381
+ url: z.ZodEffects<z.ZodString, string, string>;
382
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ type: "webhook";
385
+ url: string;
386
+ headers: Record<string, string>;
387
+ }, {
388
+ type: "webhook";
389
+ url: string;
390
+ headers: Record<string, string>;
391
+ }>, z.ZodObject<{
392
+ url: z.ZodEffects<z.ZodString, string, string>;
393
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
394
+ } & {
395
+ type: z.ZodLiteral<"trigger">;
396
+ tokenId: z.ZodString;
397
+ }, "strip", z.ZodTypeAny, {
398
+ type: "trigger";
399
+ url: string;
400
+ headers: Record<string, string>;
401
+ tokenId: string;
402
+ }, {
403
+ type: "trigger";
404
+ url: string;
405
+ headers: Record<string, string>;
406
+ tokenId: string;
407
+ }>]>, "many">>;
408
+ }, "strip", z.ZodTypeAny, {
409
+ id: string;
410
+ title: string;
411
+ description?: string | undefined;
412
+ schema?: ExtendedJSONSchema7 | undefined;
413
+ ui?: UiSchema | undefined;
414
+ data?: Record<string, unknown> | undefined;
415
+ handlers?: ({
416
+ type: "webhook";
417
+ url: string;
418
+ headers: Record<string, string>;
419
+ } | {
420
+ type: "trigger";
421
+ url: string;
422
+ headers: Record<string, string>;
423
+ tokenId: string;
424
+ })[] | undefined;
425
+ }, {
426
+ id: string;
427
+ title: string;
428
+ description?: string | undefined;
429
+ schema?: ExtendedJSONSchema7 | undefined;
430
+ ui?: UiSchema | undefined;
431
+ data?: Record<string, unknown> | undefined;
432
+ handlers?: ({
433
+ type: "webhook";
434
+ url: string;
435
+ headers: Record<string, string>;
436
+ } | {
437
+ type: "trigger";
438
+ url: string;
439
+ headers: Record<string, string>;
440
+ tokenId: string;
441
+ })[] | undefined;
442
+ }>, "many">;
443
+ } & {
444
+ assignTo: z.ZodOptional<z.ZodEffects<z.ZodObject<{
445
+ users: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
446
+ groups: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
447
+ }, "strip", z.ZodTypeAny, {
448
+ users?: string[] | undefined;
449
+ groups?: string[] | undefined;
450
+ }, {
451
+ users?: string[] | undefined;
452
+ groups?: string[] | undefined;
453
+ }>, {
454
+ users?: string[] | undefined;
455
+ groups?: string[] | undefined;
456
+ }, {
457
+ users?: string[] | undefined;
458
+ groups?: string[] | undefined;
459
+ }>>;
460
+ }, "strip", z.ZodTypeAny, {
461
+ type: string;
462
+ name: string;
463
+ actions: {
464
+ id: string;
465
+ title: string;
466
+ description?: string | undefined;
467
+ schema?: ExtendedJSONSchema7 | undefined;
468
+ ui?: UiSchema | undefined;
469
+ data?: Record<string, unknown> | undefined;
470
+ handlers?: ({
471
+ type: "webhook";
472
+ url: string;
473
+ headers: Record<string, string>;
474
+ } | {
475
+ type: "trigger";
476
+ url: string;
477
+ headers: Record<string, string>;
478
+ tokenId: string;
479
+ })[] | undefined;
480
+ }[];
481
+ description?: string | undefined;
482
+ app?: string | undefined;
483
+ validUntil?: string | undefined;
484
+ context?: {
485
+ data: Record<string, unknown>;
486
+ ui?: Record<string, Record<string, unknown>> | undefined;
487
+ } | undefined;
488
+ version?: 2 | undefined;
489
+ assignTo?: {
490
+ users?: string[] | undefined;
491
+ groups?: string[] | undefined;
492
+ } | undefined;
493
+ }, {
494
+ type: string;
495
+ name: string;
496
+ actions: {
497
+ id: string;
498
+ title: string;
499
+ description?: string | undefined;
500
+ schema?: ExtendedJSONSchema7 | undefined;
501
+ ui?: UiSchema | undefined;
502
+ data?: Record<string, unknown> | undefined;
503
+ handlers?: ({
504
+ type: "webhook";
505
+ url: string;
506
+ headers: Record<string, string>;
507
+ } | {
508
+ type: "trigger";
509
+ url: string;
510
+ headers: Record<string, string>;
511
+ tokenId: string;
512
+ })[] | undefined;
513
+ }[];
514
+ description?: string | undefined;
515
+ app?: string | undefined;
516
+ validUntil?: string | undefined;
517
+ context?: {
518
+ data: Record<string, unknown>;
519
+ ui?: Record<string, Record<string, unknown>> | undefined;
520
+ } | undefined;
521
+ version?: 2 | undefined;
522
+ assignTo?: {
523
+ users?: string[] | undefined;
524
+ groups?: string[] | undefined;
525
+ } | undefined;
526
+ }>;
527
+ type AssignToInput = z.infer<typeof assignToSchema>;
528
+ type CreateTaskBodyInput = z.input<typeof createTaskBodySchema>;
529
+ type CreateTaskBody = z.output<typeof createTaskBodySchema>;
530
+ type TaskContextInput = z.input<typeof taskContextSchema>;
531
+ type TaskContextOutput = z.output<typeof taskContextSchema>;
532
+ type TaskContext = TaskContextOutput;
533
+ type TaskAction = z.infer<typeof taskActionSchema>;
534
+ type WebhookHandler = z.infer<typeof webhookHandlerSchema>;
535
+ type TriggerHandler = z.infer<typeof triggerHandlerSchema>;
536
+ type Handler = z.infer<typeof handlerSchema>;
537
+ type InferObjectProperties<Props, Req extends PropertyKey> = Props extends Record<string, unknown> ? ({
538
+ [K in keyof Props as K extends Req ? K : never]-?: InferJsonSchema7<Props[K]>;
539
+ } & {
540
+ [K in keyof Props as K extends Req ? never : K]?: InferJsonSchema7<Props[K]>;
541
+ } extends infer O ? {
542
+ [K in keyof O]: O[K];
543
+ } : never) : Record<string, unknown>;
544
+ type RequiredKeys<S> = S extends {
545
+ readonly required: readonly string[];
546
+ } ? S["required"][number] : never;
547
+ type InferJsonSchema7<S> = [S] extends [undefined] ? Record<string, never> : S extends {
548
+ readonly const: infer C;
549
+ } ? C : S extends {
550
+ readonly enum: readonly (infer E)[];
551
+ } ? E : S extends {
552
+ readonly type: "object";
553
+ readonly properties?: infer Props;
554
+ } ? InferObjectProperties<Props, RequiredKeys<S>> : S extends {
555
+ readonly type: "object";
556
+ readonly properties?: undefined;
557
+ } ? Record<string, unknown> : S extends {
558
+ readonly type: "array";
559
+ readonly items?: infer Items;
560
+ } ? Items extends readonly unknown[] ? InferJsonSchema7<Items[number]>[] : Items extends object ? InferJsonSchema7<Items>[] : unknown[] : S extends {
561
+ readonly type: "string";
562
+ } ? string : S extends {
563
+ readonly type: "number";
564
+ } | {
565
+ readonly type: "integer";
566
+ } ? number : S extends {
567
+ readonly type: "boolean";
568
+ } ? boolean : unknown;
569
+ type TaskStatus = "pending" | "open" | "handled" | "expired";
570
+ interface TaskResponse {
571
+ success: boolean;
572
+ task: {
573
+ taskId: string;
574
+ status: "pending" | "open";
575
+ context: TaskContext;
576
+ validUntil: string;
577
+ submittedAt: string;
578
+ };
579
+ message: string;
580
+ }
581
+ interface Task {
582
+ id: string;
583
+ createdAt: Date;
584
+ status: TaskStatus;
585
+ context: TaskContext;
586
+ validUntil: number;
587
+ handledAt?: number;
588
+ handled?: {
589
+ action: {
590
+ id: string;
591
+ data: unknown;
592
+ };
593
+ handledBy?: string;
594
+ userId?: string;
595
+ token?: string;
596
+ };
597
+ }
598
+ type InferActionData<T extends {
599
+ schema?: unknown;
600
+ }> = [
601
+ Exclude<T["schema"], undefined>
602
+ ] extends [
603
+ never
604
+ ] ? Record<string, never> : Exclude<T["schema"], undefined> extends infer S ? InferJsonSchema7<S> : Record<string, never>;
605
+ type TupleElementIndices<T extends readonly unknown[]> = T extends readonly [
606
+ unknown,
607
+ ...unknown[]
608
+ ] ? Exclude<keyof T, keyof unknown[]> : number;
609
+ interface TaskResult<T = Record<string, unknown>> {
610
+ actionId: string;
611
+ data: T;
612
+ handledBy?: string;
613
+ handledAt: Date;
614
+ }
615
+ interface ApprovalResult<T = Record<string, unknown>> extends TaskResult<T> {
616
+ taskId: string;
617
+ }
618
+ type DiscriminatedApprovalResult<TActions extends readonly {
619
+ id: string;
620
+ schema?: unknown;
621
+ }[]> = {
622
+ [I in TupleElementIndices<TActions>]: TActions[I] extends {
623
+ id: string;
624
+ schema?: unknown;
625
+ } ? Omit<ApprovalResult<InferActionData<TActions[I]>>, "actionId" | "data"> & {
626
+ actionId: TActions[I]["id"];
627
+ data: InferActionData<TActions[I]>;
628
+ } : never;
629
+ }[TupleElementIndices<TActions>];
630
+
631
+ export { type ApprovalResult, type AssignToInput, type CreateTaskBody, type CreateTaskBodyInput, type DiscriminatedApprovalResult, type ExtendedJSONSchema7, type Handler, type InferActionData, type InferJsonSchema7, type JSONSchema7, type JSONSchema7TypeName, type Task, type TaskAction, type TaskContext, type TaskContextInput, type TaskContextOutput, type TaskResponse, type TaskResult, type TaskStatus, type TriggerHandler, type TupleElementIndices, type UiSchema, type WebhookHandler, assignToSchema, createTaskBodySchema, taskContextSchema };
@@ -0,0 +1,11 @@
1
+ import {
2
+ assignToSchema,
3
+ createTaskBodySchema,
4
+ taskContextSchema
5
+ } from "../chunk-7FVE6OYZ.js";
6
+ export {
7
+ assignToSchema,
8
+ createTaskBodySchema,
9
+ taskContextSchema
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}