@channel.io/app-sdk-core 0.18.2 → 0.19.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.
@@ -1,4 +1,599 @@
1
+ import { z } from "zod";
1
2
  import type { FunctionDefinition, RegisteredFunction } from "../types/function.js";
3
+ export declare const FunctionUserInputOptionSchema: z.ZodObject<{
4
+ value: z.ZodString;
5
+ label: z.ZodString;
6
+ exclusive: z.ZodOptional<z.ZodBoolean>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ value: string;
9
+ label: string;
10
+ exclusive?: boolean | undefined;
11
+ }, {
12
+ value: string;
13
+ label: string;
14
+ exclusive?: boolean | undefined;
15
+ }>;
16
+ export declare const FunctionUserInputQuestionSchema: z.ZodDiscriminatedUnion<"inputType", [z.ZodObject<{
17
+ inputType: z.ZodLiteral<"singleSelect">;
18
+ options: z.ZodArray<z.ZodObject<{
19
+ value: z.ZodString;
20
+ label: z.ZodString;
21
+ exclusive: z.ZodOptional<z.ZodBoolean>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ value: string;
24
+ label: string;
25
+ exclusive?: boolean | undefined;
26
+ }, {
27
+ value: string;
28
+ label: string;
29
+ exclusive?: boolean | undefined;
30
+ }>, "many">;
31
+ key: z.ZodString;
32
+ label: z.ZodString;
33
+ prompt: z.ZodString;
34
+ required: z.ZodBoolean;
35
+ }, "strip", z.ZodTypeAny, {
36
+ options: {
37
+ value: string;
38
+ label: string;
39
+ exclusive?: boolean | undefined;
40
+ }[];
41
+ required: boolean;
42
+ label: string;
43
+ inputType: "singleSelect";
44
+ key: string;
45
+ prompt: string;
46
+ }, {
47
+ options: {
48
+ value: string;
49
+ label: string;
50
+ exclusive?: boolean | undefined;
51
+ }[];
52
+ required: boolean;
53
+ label: string;
54
+ inputType: "singleSelect";
55
+ key: string;
56
+ prompt: string;
57
+ }>, z.ZodObject<{
58
+ inputType: z.ZodLiteral<"multiSelect">;
59
+ minSelections: z.ZodOptional<z.ZodNumber>;
60
+ maxSelections: z.ZodOptional<z.ZodNumber>;
61
+ options: z.ZodArray<z.ZodObject<{
62
+ value: z.ZodString;
63
+ label: z.ZodString;
64
+ exclusive: z.ZodOptional<z.ZodBoolean>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ value: string;
67
+ label: string;
68
+ exclusive?: boolean | undefined;
69
+ }, {
70
+ value: string;
71
+ label: string;
72
+ exclusive?: boolean | undefined;
73
+ }>, "many">;
74
+ key: z.ZodString;
75
+ label: z.ZodString;
76
+ prompt: z.ZodString;
77
+ required: z.ZodBoolean;
78
+ }, "strip", z.ZodTypeAny, {
79
+ options: {
80
+ value: string;
81
+ label: string;
82
+ exclusive?: boolean | undefined;
83
+ }[];
84
+ required: boolean;
85
+ label: string;
86
+ inputType: "multiSelect";
87
+ key: string;
88
+ prompt: string;
89
+ minSelections?: number | undefined;
90
+ maxSelections?: number | undefined;
91
+ }, {
92
+ options: {
93
+ value: string;
94
+ label: string;
95
+ exclusive?: boolean | undefined;
96
+ }[];
97
+ required: boolean;
98
+ label: string;
99
+ inputType: "multiSelect";
100
+ key: string;
101
+ prompt: string;
102
+ minSelections?: number | undefined;
103
+ maxSelections?: number | undefined;
104
+ }>, z.ZodObject<{
105
+ inputType: z.ZodLiteral<"text">;
106
+ placeholder: z.ZodOptional<z.ZodString>;
107
+ minLength: z.ZodOptional<z.ZodNumber>;
108
+ maxLength: z.ZodOptional<z.ZodNumber>;
109
+ key: z.ZodString;
110
+ label: z.ZodString;
111
+ prompt: z.ZodString;
112
+ required: z.ZodBoolean;
113
+ }, "strip", z.ZodTypeAny, {
114
+ required: boolean;
115
+ label: string;
116
+ inputType: "text";
117
+ key: string;
118
+ prompt: string;
119
+ minLength?: number | undefined;
120
+ maxLength?: number | undefined;
121
+ placeholder?: string | undefined;
122
+ }, {
123
+ required: boolean;
124
+ label: string;
125
+ inputType: "text";
126
+ key: string;
127
+ prompt: string;
128
+ minLength?: number | undefined;
129
+ maxLength?: number | undefined;
130
+ placeholder?: string | undefined;
131
+ }>, z.ZodObject<{
132
+ inputType: z.ZodLiteral<"date">;
133
+ min: z.ZodOptional<z.ZodString>;
134
+ max: z.ZodOptional<z.ZodString>;
135
+ key: z.ZodString;
136
+ label: z.ZodString;
137
+ prompt: z.ZodString;
138
+ required: z.ZodBoolean;
139
+ }, "strip", z.ZodTypeAny, {
140
+ required: boolean;
141
+ label: string;
142
+ inputType: "date";
143
+ key: string;
144
+ prompt: string;
145
+ min?: string | undefined;
146
+ max?: string | undefined;
147
+ }, {
148
+ required: boolean;
149
+ label: string;
150
+ inputType: "date";
151
+ key: string;
152
+ prompt: string;
153
+ min?: string | undefined;
154
+ max?: string | undefined;
155
+ }>, z.ZodObject<{
156
+ inputType: z.ZodLiteral<"number">;
157
+ min: z.ZodOptional<z.ZodNumber>;
158
+ max: z.ZodOptional<z.ZodNumber>;
159
+ step: z.ZodOptional<z.ZodNumber>;
160
+ placeholder: z.ZodOptional<z.ZodString>;
161
+ key: z.ZodString;
162
+ label: z.ZodString;
163
+ prompt: z.ZodString;
164
+ required: z.ZodBoolean;
165
+ }, "strip", z.ZodTypeAny, {
166
+ required: boolean;
167
+ label: string;
168
+ inputType: "number";
169
+ key: string;
170
+ prompt: string;
171
+ placeholder?: string | undefined;
172
+ min?: number | undefined;
173
+ max?: number | undefined;
174
+ step?: number | undefined;
175
+ }, {
176
+ required: boolean;
177
+ label: string;
178
+ inputType: "number";
179
+ key: string;
180
+ prompt: string;
181
+ placeholder?: string | undefined;
182
+ min?: number | undefined;
183
+ max?: number | undefined;
184
+ step?: number | undefined;
185
+ }>]>;
186
+ export declare const FunctionUserInputAnswerSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>;
187
+ export declare const FunctionUserInputAnswersSchema: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString, "many">]>>;
188
+ export declare const NeedsUserInputResultSchema: z.ZodEffects<z.ZodObject<{
189
+ type: z.ZodLiteral<"needsUserInput">;
190
+ requestId: z.ZodString;
191
+ questions: z.ZodArray<z.ZodDiscriminatedUnion<"inputType", [z.ZodObject<{
192
+ inputType: z.ZodLiteral<"singleSelect">;
193
+ options: z.ZodArray<z.ZodObject<{
194
+ value: z.ZodString;
195
+ label: z.ZodString;
196
+ exclusive: z.ZodOptional<z.ZodBoolean>;
197
+ }, "strip", z.ZodTypeAny, {
198
+ value: string;
199
+ label: string;
200
+ exclusive?: boolean | undefined;
201
+ }, {
202
+ value: string;
203
+ label: string;
204
+ exclusive?: boolean | undefined;
205
+ }>, "many">;
206
+ key: z.ZodString;
207
+ label: z.ZodString;
208
+ prompt: z.ZodString;
209
+ required: z.ZodBoolean;
210
+ }, "strip", z.ZodTypeAny, {
211
+ options: {
212
+ value: string;
213
+ label: string;
214
+ exclusive?: boolean | undefined;
215
+ }[];
216
+ required: boolean;
217
+ label: string;
218
+ inputType: "singleSelect";
219
+ key: string;
220
+ prompt: string;
221
+ }, {
222
+ options: {
223
+ value: string;
224
+ label: string;
225
+ exclusive?: boolean | undefined;
226
+ }[];
227
+ required: boolean;
228
+ label: string;
229
+ inputType: "singleSelect";
230
+ key: string;
231
+ prompt: string;
232
+ }>, z.ZodObject<{
233
+ inputType: z.ZodLiteral<"multiSelect">;
234
+ minSelections: z.ZodOptional<z.ZodNumber>;
235
+ maxSelections: z.ZodOptional<z.ZodNumber>;
236
+ options: z.ZodArray<z.ZodObject<{
237
+ value: z.ZodString;
238
+ label: z.ZodString;
239
+ exclusive: z.ZodOptional<z.ZodBoolean>;
240
+ }, "strip", z.ZodTypeAny, {
241
+ value: string;
242
+ label: string;
243
+ exclusive?: boolean | undefined;
244
+ }, {
245
+ value: string;
246
+ label: string;
247
+ exclusive?: boolean | undefined;
248
+ }>, "many">;
249
+ key: z.ZodString;
250
+ label: z.ZodString;
251
+ prompt: z.ZodString;
252
+ required: z.ZodBoolean;
253
+ }, "strip", z.ZodTypeAny, {
254
+ options: {
255
+ value: string;
256
+ label: string;
257
+ exclusive?: boolean | undefined;
258
+ }[];
259
+ required: boolean;
260
+ label: string;
261
+ inputType: "multiSelect";
262
+ key: string;
263
+ prompt: string;
264
+ minSelections?: number | undefined;
265
+ maxSelections?: number | undefined;
266
+ }, {
267
+ options: {
268
+ value: string;
269
+ label: string;
270
+ exclusive?: boolean | undefined;
271
+ }[];
272
+ required: boolean;
273
+ label: string;
274
+ inputType: "multiSelect";
275
+ key: string;
276
+ prompt: string;
277
+ minSelections?: number | undefined;
278
+ maxSelections?: number | undefined;
279
+ }>, z.ZodObject<{
280
+ inputType: z.ZodLiteral<"text">;
281
+ placeholder: z.ZodOptional<z.ZodString>;
282
+ minLength: z.ZodOptional<z.ZodNumber>;
283
+ maxLength: z.ZodOptional<z.ZodNumber>;
284
+ key: z.ZodString;
285
+ label: z.ZodString;
286
+ prompt: z.ZodString;
287
+ required: z.ZodBoolean;
288
+ }, "strip", z.ZodTypeAny, {
289
+ required: boolean;
290
+ label: string;
291
+ inputType: "text";
292
+ key: string;
293
+ prompt: string;
294
+ minLength?: number | undefined;
295
+ maxLength?: number | undefined;
296
+ placeholder?: string | undefined;
297
+ }, {
298
+ required: boolean;
299
+ label: string;
300
+ inputType: "text";
301
+ key: string;
302
+ prompt: string;
303
+ minLength?: number | undefined;
304
+ maxLength?: number | undefined;
305
+ placeholder?: string | undefined;
306
+ }>, z.ZodObject<{
307
+ inputType: z.ZodLiteral<"date">;
308
+ min: z.ZodOptional<z.ZodString>;
309
+ max: z.ZodOptional<z.ZodString>;
310
+ key: z.ZodString;
311
+ label: z.ZodString;
312
+ prompt: z.ZodString;
313
+ required: z.ZodBoolean;
314
+ }, "strip", z.ZodTypeAny, {
315
+ required: boolean;
316
+ label: string;
317
+ inputType: "date";
318
+ key: string;
319
+ prompt: string;
320
+ min?: string | undefined;
321
+ max?: string | undefined;
322
+ }, {
323
+ required: boolean;
324
+ label: string;
325
+ inputType: "date";
326
+ key: string;
327
+ prompt: string;
328
+ min?: string | undefined;
329
+ max?: string | undefined;
330
+ }>, z.ZodObject<{
331
+ inputType: z.ZodLiteral<"number">;
332
+ min: z.ZodOptional<z.ZodNumber>;
333
+ max: z.ZodOptional<z.ZodNumber>;
334
+ step: z.ZodOptional<z.ZodNumber>;
335
+ placeholder: z.ZodOptional<z.ZodString>;
336
+ key: z.ZodString;
337
+ label: z.ZodString;
338
+ prompt: z.ZodString;
339
+ required: z.ZodBoolean;
340
+ }, "strip", z.ZodTypeAny, {
341
+ required: boolean;
342
+ label: string;
343
+ inputType: "number";
344
+ key: string;
345
+ prompt: string;
346
+ placeholder?: string | undefined;
347
+ min?: number | undefined;
348
+ max?: number | undefined;
349
+ step?: number | undefined;
350
+ }, {
351
+ required: boolean;
352
+ label: string;
353
+ inputType: "number";
354
+ key: string;
355
+ prompt: string;
356
+ placeholder?: string | undefined;
357
+ min?: number | undefined;
358
+ max?: number | undefined;
359
+ step?: number | undefined;
360
+ }>]>, "many">;
361
+ continuationToken: z.ZodString;
362
+ message: z.ZodOptional<z.ZodString>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ type: "needsUserInput";
365
+ requestId: string;
366
+ questions: ({
367
+ options: {
368
+ value: string;
369
+ label: string;
370
+ exclusive?: boolean | undefined;
371
+ }[];
372
+ required: boolean;
373
+ label: string;
374
+ inputType: "singleSelect";
375
+ key: string;
376
+ prompt: string;
377
+ } | {
378
+ options: {
379
+ value: string;
380
+ label: string;
381
+ exclusive?: boolean | undefined;
382
+ }[];
383
+ required: boolean;
384
+ label: string;
385
+ inputType: "multiSelect";
386
+ key: string;
387
+ prompt: string;
388
+ minSelections?: number | undefined;
389
+ maxSelections?: number | undefined;
390
+ } | {
391
+ required: boolean;
392
+ label: string;
393
+ inputType: "text";
394
+ key: string;
395
+ prompt: string;
396
+ minLength?: number | undefined;
397
+ maxLength?: number | undefined;
398
+ placeholder?: string | undefined;
399
+ } | {
400
+ required: boolean;
401
+ label: string;
402
+ inputType: "date";
403
+ key: string;
404
+ prompt: string;
405
+ min?: string | undefined;
406
+ max?: string | undefined;
407
+ } | {
408
+ required: boolean;
409
+ label: string;
410
+ inputType: "number";
411
+ key: string;
412
+ prompt: string;
413
+ placeholder?: string | undefined;
414
+ min?: number | undefined;
415
+ max?: number | undefined;
416
+ step?: number | undefined;
417
+ })[];
418
+ continuationToken: string;
419
+ message?: string | undefined;
420
+ }, {
421
+ type: "needsUserInput";
422
+ requestId: string;
423
+ questions: ({
424
+ options: {
425
+ value: string;
426
+ label: string;
427
+ exclusive?: boolean | undefined;
428
+ }[];
429
+ required: boolean;
430
+ label: string;
431
+ inputType: "singleSelect";
432
+ key: string;
433
+ prompt: string;
434
+ } | {
435
+ options: {
436
+ value: string;
437
+ label: string;
438
+ exclusive?: boolean | undefined;
439
+ }[];
440
+ required: boolean;
441
+ label: string;
442
+ inputType: "multiSelect";
443
+ key: string;
444
+ prompt: string;
445
+ minSelections?: number | undefined;
446
+ maxSelections?: number | undefined;
447
+ } | {
448
+ required: boolean;
449
+ label: string;
450
+ inputType: "text";
451
+ key: string;
452
+ prompt: string;
453
+ minLength?: number | undefined;
454
+ maxLength?: number | undefined;
455
+ placeholder?: string | undefined;
456
+ } | {
457
+ required: boolean;
458
+ label: string;
459
+ inputType: "date";
460
+ key: string;
461
+ prompt: string;
462
+ min?: string | undefined;
463
+ max?: string | undefined;
464
+ } | {
465
+ required: boolean;
466
+ label: string;
467
+ inputType: "number";
468
+ key: string;
469
+ prompt: string;
470
+ placeholder?: string | undefined;
471
+ min?: number | undefined;
472
+ max?: number | undefined;
473
+ step?: number | undefined;
474
+ })[];
475
+ continuationToken: string;
476
+ message?: string | undefined;
477
+ }>, {
478
+ type: "needsUserInput";
479
+ requestId: string;
480
+ questions: ({
481
+ options: {
482
+ value: string;
483
+ label: string;
484
+ exclusive?: boolean | undefined;
485
+ }[];
486
+ required: boolean;
487
+ label: string;
488
+ inputType: "singleSelect";
489
+ key: string;
490
+ prompt: string;
491
+ } | {
492
+ options: {
493
+ value: string;
494
+ label: string;
495
+ exclusive?: boolean | undefined;
496
+ }[];
497
+ required: boolean;
498
+ label: string;
499
+ inputType: "multiSelect";
500
+ key: string;
501
+ prompt: string;
502
+ minSelections?: number | undefined;
503
+ maxSelections?: number | undefined;
504
+ } | {
505
+ required: boolean;
506
+ label: string;
507
+ inputType: "text";
508
+ key: string;
509
+ prompt: string;
510
+ minLength?: number | undefined;
511
+ maxLength?: number | undefined;
512
+ placeholder?: string | undefined;
513
+ } | {
514
+ required: boolean;
515
+ label: string;
516
+ inputType: "date";
517
+ key: string;
518
+ prompt: string;
519
+ min?: string | undefined;
520
+ max?: string | undefined;
521
+ } | {
522
+ required: boolean;
523
+ label: string;
524
+ inputType: "number";
525
+ key: string;
526
+ prompt: string;
527
+ placeholder?: string | undefined;
528
+ min?: number | undefined;
529
+ max?: number | undefined;
530
+ step?: number | undefined;
531
+ })[];
532
+ continuationToken: string;
533
+ message?: string | undefined;
534
+ }, {
535
+ type: "needsUserInput";
536
+ requestId: string;
537
+ questions: ({
538
+ options: {
539
+ value: string;
540
+ label: string;
541
+ exclusive?: boolean | undefined;
542
+ }[];
543
+ required: boolean;
544
+ label: string;
545
+ inputType: "singleSelect";
546
+ key: string;
547
+ prompt: string;
548
+ } | {
549
+ options: {
550
+ value: string;
551
+ label: string;
552
+ exclusive?: boolean | undefined;
553
+ }[];
554
+ required: boolean;
555
+ label: string;
556
+ inputType: "multiSelect";
557
+ key: string;
558
+ prompt: string;
559
+ minSelections?: number | undefined;
560
+ maxSelections?: number | undefined;
561
+ } | {
562
+ required: boolean;
563
+ label: string;
564
+ inputType: "text";
565
+ key: string;
566
+ prompt: string;
567
+ minLength?: number | undefined;
568
+ maxLength?: number | undefined;
569
+ placeholder?: string | undefined;
570
+ } | {
571
+ required: boolean;
572
+ label: string;
573
+ inputType: "date";
574
+ key: string;
575
+ prompt: string;
576
+ min?: string | undefined;
577
+ max?: string | undefined;
578
+ } | {
579
+ required: boolean;
580
+ label: string;
581
+ inputType: "number";
582
+ key: string;
583
+ prompt: string;
584
+ placeholder?: string | undefined;
585
+ min?: number | undefined;
586
+ max?: number | undefined;
587
+ step?: number | undefined;
588
+ })[];
589
+ continuationToken: string;
590
+ message?: string | undefined;
591
+ }>;
592
+ export type FunctionUserInputOption = z.infer<typeof FunctionUserInputOptionSchema>;
593
+ export type FunctionUserInputQuestion = z.infer<typeof FunctionUserInputQuestionSchema>;
594
+ export type FunctionUserInputAnswer = z.infer<typeof FunctionUserInputAnswerSchema>;
595
+ export type FunctionUserInputAnswers = z.infer<typeof FunctionUserInputAnswersSchema>;
596
+ export type NeedsUserInputResult = z.infer<typeof NeedsUserInputResultSchema>;
2
597
  /**
3
598
  * Create a registered function from a definition
4
599
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/schemas/function.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAmB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAGpG;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,kBAAkB,GAC7B,kBAAkB,CA+BpB"}
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/schemas/function.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAmB,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAMpG,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAIxC,CAAC;AASH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkC1C,CAAC;AAEH,eAAO,MAAM,6BAA6B,yEAIxC,CAAC;AAEH,eAAO,MAAM,8BAA8B,mGAG1C,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsFnC,CAAC;AAEL,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACpF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AACtF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,kBAAkB,GAC7B,kBAAkB,CA+BpB"}