@resconet/qp-bridge 1.1.0 → 1.1.1-alpha.31
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.
- package/index.js +1 -1
- package/index.mjs +1400 -1569
- package/lib/qp-bridge-types.d.ts +114 -79
- package/lib/qp-bridge.d.ts +40 -0
- package/package.json +6 -6
package/lib/qp-bridge-types.d.ts
CHANGED
|
@@ -9,14 +9,14 @@ export declare const qpBridgeMessageSchema: z.ZodObject<{
|
|
|
9
9
|
type: "qp-bridge";
|
|
10
10
|
id?: string | undefined;
|
|
11
11
|
}>;
|
|
12
|
-
export declare const onAnswerChangeMessageSchema: z.ZodObject<
|
|
12
|
+
export declare const onAnswerChangeMessageSchema: z.ZodObject<{
|
|
13
13
|
type: z.ZodLiteral<"qp-bridge">;
|
|
14
14
|
id: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}
|
|
15
|
+
} & {
|
|
16
16
|
status: z.ZodLiteral<"answerChanged">;
|
|
17
17
|
question: z.ZodString;
|
|
18
18
|
answer: z.ZodUnknown;
|
|
19
|
-
}
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
type: "qp-bridge";
|
|
21
21
|
status: "answerChanged";
|
|
22
22
|
question: string;
|
|
@@ -29,12 +29,43 @@ export declare const onAnswerChangeMessageSchema: z.ZodObject<z.objectUtil.exten
|
|
|
29
29
|
id?: string | undefined;
|
|
30
30
|
answer?: unknown;
|
|
31
31
|
}>;
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const commandExecutedMessageSchema: z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
34
|
+
id: z.ZodOptional<z.ZodString>;
|
|
35
|
+
} & {
|
|
36
|
+
action: z.ZodLiteral<"commandExecuted">;
|
|
37
|
+
commandName: z.ZodString;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
type: "qp-bridge";
|
|
40
|
+
action: "commandExecuted";
|
|
41
|
+
commandName: string;
|
|
42
|
+
id?: string | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
type: "qp-bridge";
|
|
45
|
+
action: "commandExecuted";
|
|
46
|
+
commandName: string;
|
|
47
|
+
id?: string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const questionnaireLoadedMessageSchema: z.ZodObject<{
|
|
33
50
|
type: z.ZodLiteral<"qp-bridge">;
|
|
34
51
|
id: z.ZodOptional<z.ZodString>;
|
|
52
|
+
} & {
|
|
53
|
+
action: z.ZodLiteral<"questionnaireLoaded">;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
type: "qp-bridge";
|
|
56
|
+
action: "questionnaireLoaded";
|
|
57
|
+
id?: string | undefined;
|
|
35
58
|
}, {
|
|
59
|
+
type: "qp-bridge";
|
|
60
|
+
action: "questionnaireLoaded";
|
|
61
|
+
id?: string | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const responseSuccessMessageSchema: z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
65
|
+
id: z.ZodOptional<z.ZodString>;
|
|
66
|
+
} & {
|
|
36
67
|
status: z.ZodLiteral<"success">;
|
|
37
|
-
}
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
69
|
type: "qp-bridge";
|
|
39
70
|
status: "success";
|
|
40
71
|
id?: string | undefined;
|
|
@@ -43,13 +74,13 @@ export declare const responseSuccessMessageSchema: z.ZodObject<z.objectUtil.exte
|
|
|
43
74
|
status: "success";
|
|
44
75
|
id?: string | undefined;
|
|
45
76
|
}>;
|
|
46
|
-
export declare const responseErrorMessageSchema: z.ZodObject<
|
|
77
|
+
export declare const responseErrorMessageSchema: z.ZodObject<{
|
|
47
78
|
type: z.ZodLiteral<"qp-bridge">;
|
|
48
79
|
id: z.ZodOptional<z.ZodString>;
|
|
49
|
-
}
|
|
80
|
+
} & {
|
|
50
81
|
status: z.ZodLiteral<"error">;
|
|
51
82
|
message: z.ZodString;
|
|
52
|
-
}
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
84
|
type: "qp-bridge";
|
|
54
85
|
status: "error";
|
|
55
86
|
message: string;
|
|
@@ -159,13 +190,13 @@ export declare const groupOptionalScheme: z.ZodObject<{
|
|
|
159
190
|
hidden?: boolean | undefined;
|
|
160
191
|
collapsed?: boolean | undefined;
|
|
161
192
|
}>;
|
|
162
|
-
export declare const getQuestionRequestMessageSchema: z.ZodObject<
|
|
193
|
+
export declare const getQuestionRequestMessageSchema: z.ZodObject<{
|
|
163
194
|
type: z.ZodLiteral<"qp-bridge">;
|
|
164
195
|
id: z.ZodOptional<z.ZodString>;
|
|
165
|
-
}
|
|
196
|
+
} & {
|
|
166
197
|
action: z.ZodLiteral<"getQuestion">;
|
|
167
198
|
question: z.ZodString;
|
|
168
|
-
}
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
200
|
type: "qp-bridge";
|
|
170
201
|
question: string;
|
|
171
202
|
action: "getQuestion";
|
|
@@ -176,12 +207,12 @@ export declare const getQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
176
207
|
action: "getQuestion";
|
|
177
208
|
id?: string | undefined;
|
|
178
209
|
}>;
|
|
179
|
-
export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<
|
|
210
|
+
export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<{
|
|
180
211
|
type: z.ZodLiteral<"qp-bridge">;
|
|
181
212
|
id: z.ZodOptional<z.ZodString>;
|
|
182
|
-
}
|
|
213
|
+
} & {
|
|
183
214
|
status: z.ZodLiteral<"success">;
|
|
184
|
-
}
|
|
215
|
+
} & {
|
|
185
216
|
question: z.ZodObject<{
|
|
186
217
|
semanticColor: z.ZodOptional<z.ZodString>;
|
|
187
218
|
label: z.ZodString;
|
|
@@ -210,7 +241,7 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<z.obje
|
|
|
210
241
|
semanticColor?: string | undefined;
|
|
211
242
|
errorMessage?: string | undefined;
|
|
212
243
|
}>;
|
|
213
|
-
}
|
|
244
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
245
|
type: "qp-bridge";
|
|
215
246
|
status: "success";
|
|
216
247
|
question: {
|
|
@@ -239,10 +270,10 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<z.obje
|
|
|
239
270
|
};
|
|
240
271
|
id?: string | undefined;
|
|
241
272
|
}>;
|
|
242
|
-
export declare const setQuestionRequestMessageSchema: z.ZodObject<
|
|
273
|
+
export declare const setQuestionRequestMessageSchema: z.ZodObject<{
|
|
243
274
|
type: z.ZodLiteral<"qp-bridge">;
|
|
244
275
|
id: z.ZodOptional<z.ZodString>;
|
|
245
|
-
}
|
|
276
|
+
} & {
|
|
246
277
|
action: z.ZodLiteral<"setQuestion">;
|
|
247
278
|
question: z.ZodString;
|
|
248
279
|
questionData: z.ZodObject<{
|
|
@@ -273,7 +304,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
273
304
|
hidden?: boolean | undefined;
|
|
274
305
|
errorMessage?: string | undefined;
|
|
275
306
|
}>;
|
|
276
|
-
}
|
|
307
|
+
}, "strip", z.ZodTypeAny, {
|
|
277
308
|
type: "qp-bridge";
|
|
278
309
|
question: string;
|
|
279
310
|
action: "setQuestion";
|
|
@@ -304,13 +335,13 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
304
335
|
};
|
|
305
336
|
id?: string | undefined;
|
|
306
337
|
}>;
|
|
307
|
-
export declare const getGroupRequestMessageSchema: z.ZodObject<
|
|
338
|
+
export declare const getGroupRequestMessageSchema: z.ZodObject<{
|
|
308
339
|
type: z.ZodLiteral<"qp-bridge">;
|
|
309
340
|
id: z.ZodOptional<z.ZodString>;
|
|
310
|
-
}
|
|
341
|
+
} & {
|
|
311
342
|
action: z.ZodLiteral<"getGroup">;
|
|
312
343
|
group: z.ZodString;
|
|
313
|
-
}
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
314
345
|
type: "qp-bridge";
|
|
315
346
|
action: "getGroup";
|
|
316
347
|
group: string;
|
|
@@ -321,12 +352,12 @@ export declare const getGroupRequestMessageSchema: z.ZodObject<z.objectUtil.exte
|
|
|
321
352
|
group: string;
|
|
322
353
|
id?: string | undefined;
|
|
323
354
|
}>;
|
|
324
|
-
export declare const getGroupSuccessResponseMessageSchema: z.ZodObject<
|
|
355
|
+
export declare const getGroupSuccessResponseMessageSchema: z.ZodObject<{
|
|
325
356
|
type: z.ZodLiteral<"qp-bridge">;
|
|
326
357
|
id: z.ZodOptional<z.ZodString>;
|
|
327
|
-
}
|
|
358
|
+
} & {
|
|
328
359
|
status: z.ZodLiteral<"success">;
|
|
329
|
-
}
|
|
360
|
+
} & {
|
|
330
361
|
group: z.ZodObject<{
|
|
331
362
|
label: z.ZodString;
|
|
332
363
|
hidden: z.ZodBoolean;
|
|
@@ -340,7 +371,7 @@ export declare const getGroupSuccessResponseMessageSchema: z.ZodObject<z.objectU
|
|
|
340
371
|
hidden: boolean;
|
|
341
372
|
collapsed: boolean;
|
|
342
373
|
}>;
|
|
343
|
-
}
|
|
374
|
+
}, "strip", z.ZodTypeAny, {
|
|
344
375
|
type: "qp-bridge";
|
|
345
376
|
status: "success";
|
|
346
377
|
group: {
|
|
@@ -359,14 +390,14 @@ export declare const getGroupSuccessResponseMessageSchema: z.ZodObject<z.objectU
|
|
|
359
390
|
};
|
|
360
391
|
id?: string | undefined;
|
|
361
392
|
}>;
|
|
362
|
-
export declare const canSaveSuccessResponseMessageSchema: z.ZodObject<
|
|
393
|
+
export declare const canSaveSuccessResponseMessageSchema: z.ZodObject<{
|
|
363
394
|
type: z.ZodLiteral<"qp-bridge">;
|
|
364
395
|
id: z.ZodOptional<z.ZodString>;
|
|
365
|
-
}
|
|
396
|
+
} & {
|
|
366
397
|
status: z.ZodLiteral<"success">;
|
|
367
|
-
}
|
|
398
|
+
} & {
|
|
368
399
|
canSave: z.ZodBoolean;
|
|
369
|
-
}
|
|
400
|
+
}, "strip", z.ZodTypeAny, {
|
|
370
401
|
type: "qp-bridge";
|
|
371
402
|
status: "success";
|
|
372
403
|
canSave: boolean;
|
|
@@ -377,12 +408,12 @@ export declare const canSaveSuccessResponseMessageSchema: z.ZodObject<z.objectUt
|
|
|
377
408
|
canSave: boolean;
|
|
378
409
|
id?: string | undefined;
|
|
379
410
|
}>;
|
|
380
|
-
export declare const canSaveRequestMessageSchema: z.ZodObject<
|
|
411
|
+
export declare const canSaveRequestMessageSchema: z.ZodObject<{
|
|
381
412
|
type: z.ZodLiteral<"qp-bridge">;
|
|
382
413
|
id: z.ZodOptional<z.ZodString>;
|
|
383
|
-
}
|
|
414
|
+
} & {
|
|
384
415
|
action: z.ZodLiteral<"canSave">;
|
|
385
|
-
}
|
|
416
|
+
}, "strip", z.ZodTypeAny, {
|
|
386
417
|
type: "qp-bridge";
|
|
387
418
|
action: "canSave";
|
|
388
419
|
id?: string | undefined;
|
|
@@ -391,10 +422,10 @@ export declare const canSaveRequestMessageSchema: z.ZodObject<z.objectUtil.exten
|
|
|
391
422
|
action: "canSave";
|
|
392
423
|
id?: string | undefined;
|
|
393
424
|
}>;
|
|
394
|
-
export declare const setGroupRequestMessageSchema: z.ZodObject<
|
|
425
|
+
export declare const setGroupRequestMessageSchema: z.ZodObject<{
|
|
395
426
|
type: z.ZodLiteral<"qp-bridge">;
|
|
396
427
|
id: z.ZodOptional<z.ZodString>;
|
|
397
|
-
}
|
|
428
|
+
} & {
|
|
398
429
|
action: z.ZodLiteral<"setGroup">;
|
|
399
430
|
group: z.ZodString;
|
|
400
431
|
groupData: z.ZodObject<{
|
|
@@ -410,7 +441,7 @@ export declare const setGroupRequestMessageSchema: z.ZodObject<z.objectUtil.exte
|
|
|
410
441
|
hidden?: boolean | undefined;
|
|
411
442
|
collapsed?: boolean | undefined;
|
|
412
443
|
}>;
|
|
413
|
-
}
|
|
444
|
+
}, "strip", z.ZodTypeAny, {
|
|
414
445
|
type: "qp-bridge";
|
|
415
446
|
action: "setGroup";
|
|
416
447
|
group: string;
|
|
@@ -431,14 +462,14 @@ export declare const setGroupRequestMessageSchema: z.ZodObject<z.objectUtil.exte
|
|
|
431
462
|
};
|
|
432
463
|
id?: string | undefined;
|
|
433
464
|
}>;
|
|
434
|
-
export declare const setAnswerRequestMessageSchema: z.ZodObject<
|
|
465
|
+
export declare const setAnswerRequestMessageSchema: z.ZodObject<{
|
|
435
466
|
type: z.ZodLiteral<"qp-bridge">;
|
|
436
467
|
id: z.ZodOptional<z.ZodString>;
|
|
437
|
-
}
|
|
468
|
+
} & {
|
|
438
469
|
action: z.ZodLiteral<"setAnswer">;
|
|
439
470
|
question: z.ZodString;
|
|
440
471
|
answer: z.ZodUnknown;
|
|
441
|
-
}
|
|
472
|
+
}, "strip", z.ZodTypeAny, {
|
|
442
473
|
type: "qp-bridge";
|
|
443
474
|
question: string;
|
|
444
475
|
action: "setAnswer";
|
|
@@ -451,12 +482,12 @@ export declare const setAnswerRequestMessageSchema: z.ZodObject<z.objectUtil.ext
|
|
|
451
482
|
id?: string | undefined;
|
|
452
483
|
answer?: unknown;
|
|
453
484
|
}>;
|
|
454
|
-
export declare const busyIndicatorStartRequestMessageSchema: z.ZodObject<
|
|
485
|
+
export declare const busyIndicatorStartRequestMessageSchema: z.ZodObject<{
|
|
455
486
|
type: z.ZodLiteral<"qp-bridge">;
|
|
456
487
|
id: z.ZodOptional<z.ZodString>;
|
|
457
|
-
}
|
|
488
|
+
} & {
|
|
458
489
|
action: z.ZodLiteral<"busyIndicatorStart">;
|
|
459
|
-
}
|
|
490
|
+
}, "strip", z.ZodTypeAny, {
|
|
460
491
|
type: "qp-bridge";
|
|
461
492
|
action: "busyIndicatorStart";
|
|
462
493
|
id?: string | undefined;
|
|
@@ -465,12 +496,12 @@ export declare const busyIndicatorStartRequestMessageSchema: z.ZodObject<z.objec
|
|
|
465
496
|
action: "busyIndicatorStart";
|
|
466
497
|
id?: string | undefined;
|
|
467
498
|
}>;
|
|
468
|
-
export declare const busyIndicatorEndRequestMessageSchema: z.ZodObject<
|
|
499
|
+
export declare const busyIndicatorEndRequestMessageSchema: z.ZodObject<{
|
|
469
500
|
type: z.ZodLiteral<"qp-bridge">;
|
|
470
501
|
id: z.ZodOptional<z.ZodString>;
|
|
471
|
-
}
|
|
502
|
+
} & {
|
|
472
503
|
action: z.ZodLiteral<"busyIndicatorEnd">;
|
|
473
|
-
}
|
|
504
|
+
}, "strip", z.ZodTypeAny, {
|
|
474
505
|
type: "qp-bridge";
|
|
475
506
|
action: "busyIndicatorEnd";
|
|
476
507
|
id?: string | undefined;
|
|
@@ -479,12 +510,12 @@ export declare const busyIndicatorEndRequestMessageSchema: z.ZodObject<z.objectU
|
|
|
479
510
|
action: "busyIndicatorEnd";
|
|
480
511
|
id?: string | undefined;
|
|
481
512
|
}>;
|
|
482
|
-
export declare const saveQuestionnaireRequestMessageSchema: z.ZodObject<
|
|
513
|
+
export declare const saveQuestionnaireRequestMessageSchema: z.ZodObject<{
|
|
483
514
|
type: z.ZodLiteral<"qp-bridge">;
|
|
484
515
|
id: z.ZodOptional<z.ZodString>;
|
|
485
|
-
}
|
|
516
|
+
} & {
|
|
486
517
|
action: z.ZodLiteral<"saveQuestionnaire">;
|
|
487
|
-
}
|
|
518
|
+
}, "strip", z.ZodTypeAny, {
|
|
488
519
|
type: "qp-bridge";
|
|
489
520
|
action: "saveQuestionnaire";
|
|
490
521
|
id?: string | undefined;
|
|
@@ -493,12 +524,12 @@ export declare const saveQuestionnaireRequestMessageSchema: z.ZodObject<z.object
|
|
|
493
524
|
action: "saveQuestionnaire";
|
|
494
525
|
id?: string | undefined;
|
|
495
526
|
}>;
|
|
496
|
-
export declare const completeAndCloseQuestionnaireRequestMessageSchema: z.ZodObject<
|
|
527
|
+
export declare const completeAndCloseQuestionnaireRequestMessageSchema: z.ZodObject<{
|
|
497
528
|
type: z.ZodLiteral<"qp-bridge">;
|
|
498
529
|
id: z.ZodOptional<z.ZodString>;
|
|
499
|
-
}
|
|
530
|
+
} & {
|
|
500
531
|
action: z.ZodLiteral<"completeAndCloseQuestionnaire">;
|
|
501
|
-
}
|
|
532
|
+
}, "strip", z.ZodTypeAny, {
|
|
502
533
|
type: "qp-bridge";
|
|
503
534
|
action: "completeAndCloseQuestionnaire";
|
|
504
535
|
id?: string | undefined;
|
|
@@ -507,13 +538,13 @@ export declare const completeAndCloseQuestionnaireRequestMessageSchema: z.ZodObj
|
|
|
507
538
|
action: "completeAndCloseQuestionnaire";
|
|
508
539
|
id?: string | undefined;
|
|
509
540
|
}>;
|
|
510
|
-
export declare const executeCustomCommandRequestMessageSchema: z.ZodObject<
|
|
541
|
+
export declare const executeCustomCommandRequestMessageSchema: z.ZodObject<{
|
|
511
542
|
type: z.ZodLiteral<"qp-bridge">;
|
|
512
543
|
id: z.ZodOptional<z.ZodString>;
|
|
513
|
-
}
|
|
544
|
+
} & {
|
|
514
545
|
action: z.ZodLiteral<"executeCustomCommand">;
|
|
515
546
|
commandName: z.ZodString;
|
|
516
|
-
}
|
|
547
|
+
}, "strip", z.ZodTypeAny, {
|
|
517
548
|
type: "qp-bridge";
|
|
518
549
|
action: "executeCustomCommand";
|
|
519
550
|
commandName: string;
|
|
@@ -524,13 +555,13 @@ export declare const executeCustomCommandRequestMessageSchema: z.ZodObject<z.obj
|
|
|
524
555
|
commandName: string;
|
|
525
556
|
id?: string | undefined;
|
|
526
557
|
}>;
|
|
527
|
-
export declare const fetchEntitiesRequestMessageSchema: z.ZodObject<
|
|
558
|
+
export declare const fetchEntitiesRequestMessageSchema: z.ZodObject<{
|
|
528
559
|
type: z.ZodLiteral<"qp-bridge">;
|
|
529
560
|
id: z.ZodOptional<z.ZodString>;
|
|
530
|
-
}
|
|
561
|
+
} & {
|
|
531
562
|
action: z.ZodLiteral<"fetchEntities">;
|
|
532
563
|
fetchXml: z.ZodString;
|
|
533
|
-
}
|
|
564
|
+
}, "strip", z.ZodTypeAny, {
|
|
534
565
|
type: "qp-bridge";
|
|
535
566
|
action: "fetchEntities";
|
|
536
567
|
fetchXml: string;
|
|
@@ -541,14 +572,14 @@ export declare const fetchEntitiesRequestMessageSchema: z.ZodObject<z.objectUtil
|
|
|
541
572
|
fetchXml: string;
|
|
542
573
|
id?: string | undefined;
|
|
543
574
|
}>;
|
|
544
|
-
export declare const fetchEntitiesSuccessResponseMessageSchema: z.ZodObject<
|
|
575
|
+
export declare const fetchEntitiesSuccessResponseMessageSchema: z.ZodObject<{
|
|
545
576
|
type: z.ZodLiteral<"qp-bridge">;
|
|
546
577
|
id: z.ZodOptional<z.ZodString>;
|
|
547
|
-
}
|
|
578
|
+
} & {
|
|
548
579
|
status: z.ZodLiteral<"success">;
|
|
549
|
-
}
|
|
580
|
+
} & {
|
|
550
581
|
entities: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
551
|
-
}
|
|
582
|
+
}, "strip", z.ZodTypeAny, {
|
|
552
583
|
type: "qp-bridge";
|
|
553
584
|
status: "success";
|
|
554
585
|
entities: Record<string, unknown>[];
|
|
@@ -559,14 +590,14 @@ export declare const fetchEntitiesSuccessResponseMessageSchema: z.ZodObject<z.ob
|
|
|
559
590
|
entities: Record<string, unknown>[];
|
|
560
591
|
id?: string | undefined;
|
|
561
592
|
}>;
|
|
562
|
-
export declare const getEntityByIdRequestMessageSchema: z.ZodObject<
|
|
593
|
+
export declare const getEntityByIdRequestMessageSchema: z.ZodObject<{
|
|
563
594
|
type: z.ZodLiteral<"qp-bridge">;
|
|
564
595
|
id: z.ZodOptional<z.ZodString>;
|
|
565
|
-
}
|
|
596
|
+
} & {
|
|
566
597
|
action: z.ZodLiteral<"getEntityById">;
|
|
567
598
|
entityName: z.ZodString;
|
|
568
599
|
entityId: z.ZodString;
|
|
569
|
-
}
|
|
600
|
+
}, "strip", z.ZodTypeAny, {
|
|
570
601
|
type: "qp-bridge";
|
|
571
602
|
action: "getEntityById";
|
|
572
603
|
entityName: string;
|
|
@@ -579,14 +610,14 @@ export declare const getEntityByIdRequestMessageSchema: z.ZodObject<z.objectUtil
|
|
|
579
610
|
entityId: string;
|
|
580
611
|
id?: string | undefined;
|
|
581
612
|
}>;
|
|
582
|
-
export declare const getEntityByIdSuccessResponseMessageSchema: z.ZodObject<
|
|
613
|
+
export declare const getEntityByIdSuccessResponseMessageSchema: z.ZodObject<{
|
|
583
614
|
type: z.ZodLiteral<"qp-bridge">;
|
|
584
615
|
id: z.ZodOptional<z.ZodString>;
|
|
585
|
-
}
|
|
616
|
+
} & {
|
|
586
617
|
status: z.ZodLiteral<"success">;
|
|
587
|
-
}
|
|
618
|
+
} & {
|
|
588
619
|
entity: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
589
|
-
}
|
|
620
|
+
}, "strip", z.ZodTypeAny, {
|
|
590
621
|
type: "qp-bridge";
|
|
591
622
|
status: "success";
|
|
592
623
|
entity: Record<string, unknown>;
|
|
@@ -597,13 +628,13 @@ export declare const getEntityByIdSuccessResponseMessageSchema: z.ZodObject<z.ob
|
|
|
597
628
|
entity: Record<string, unknown>;
|
|
598
629
|
id?: string | undefined;
|
|
599
630
|
}>;
|
|
600
|
-
export declare const saveEntityRequestMessageSchema: z.ZodObject<
|
|
631
|
+
export declare const saveEntityRequestMessageSchema: z.ZodObject<{
|
|
601
632
|
type: z.ZodLiteral<"qp-bridge">;
|
|
602
633
|
id: z.ZodOptional<z.ZodString>;
|
|
603
|
-
}
|
|
634
|
+
} & {
|
|
604
635
|
action: z.ZodLiteral<"saveEntity">;
|
|
605
636
|
entity: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
606
|
-
}
|
|
637
|
+
}, "strip", z.ZodTypeAny, {
|
|
607
638
|
type: "qp-bridge";
|
|
608
639
|
action: "saveEntity";
|
|
609
640
|
entity: Record<string, unknown>;
|
|
@@ -614,14 +645,14 @@ export declare const saveEntityRequestMessageSchema: z.ZodObject<z.objectUtil.ex
|
|
|
614
645
|
entity: Record<string, unknown>;
|
|
615
646
|
id?: string | undefined;
|
|
616
647
|
}>;
|
|
617
|
-
export declare const repeatGroupRequestMessageSchema: z.ZodObject<
|
|
648
|
+
export declare const repeatGroupRequestMessageSchema: z.ZodObject<{
|
|
618
649
|
type: z.ZodLiteral<"qp-bridge">;
|
|
619
650
|
id: z.ZodOptional<z.ZodString>;
|
|
620
|
-
}
|
|
651
|
+
} & {
|
|
621
652
|
action: z.ZodLiteral<"repeatGroup">;
|
|
622
653
|
parentGroupName: z.ZodString;
|
|
623
654
|
groupIndex: z.ZodNumber;
|
|
624
|
-
}
|
|
655
|
+
}, "strip", z.ZodTypeAny, {
|
|
625
656
|
type: "qp-bridge";
|
|
626
657
|
action: "repeatGroup";
|
|
627
658
|
parentGroupName: string;
|
|
@@ -634,13 +665,13 @@ export declare const repeatGroupRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
634
665
|
groupIndex: number;
|
|
635
666
|
id?: string | undefined;
|
|
636
667
|
}>;
|
|
637
|
-
export declare const addNewGroupRequestMessageSchema: z.ZodObject<
|
|
668
|
+
export declare const addNewGroupRequestMessageSchema: z.ZodObject<{
|
|
638
669
|
type: z.ZodLiteral<"qp-bridge">;
|
|
639
670
|
id: z.ZodOptional<z.ZodString>;
|
|
640
|
-
}
|
|
671
|
+
} & {
|
|
641
672
|
action: z.ZodLiteral<"addNewGroup">;
|
|
642
673
|
groupName: z.ZodString;
|
|
643
|
-
}
|
|
674
|
+
}, "strip", z.ZodTypeAny, {
|
|
644
675
|
type: "qp-bridge";
|
|
645
676
|
action: "addNewGroup";
|
|
646
677
|
groupName: string;
|
|
@@ -651,14 +682,14 @@ export declare const addNewGroupRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
651
682
|
groupName: string;
|
|
652
683
|
id?: string | undefined;
|
|
653
684
|
}>;
|
|
654
|
-
export declare const deleteGroupRequestMessageSchema: z.ZodObject<
|
|
685
|
+
export declare const deleteGroupRequestMessageSchema: z.ZodObject<{
|
|
655
686
|
type: z.ZodLiteral<"qp-bridge">;
|
|
656
687
|
id: z.ZodOptional<z.ZodString>;
|
|
657
|
-
}
|
|
688
|
+
} & {
|
|
658
689
|
action: z.ZodLiteral<"deleteGroup">;
|
|
659
690
|
parentGroupName: z.ZodString;
|
|
660
691
|
groupIndex: z.ZodNumber;
|
|
661
|
-
}
|
|
692
|
+
}, "strip", z.ZodTypeAny, {
|
|
662
693
|
type: "qp-bridge";
|
|
663
694
|
action: "deleteGroup";
|
|
664
695
|
parentGroupName: string;
|
|
@@ -681,6 +712,8 @@ export type GroupOptional = z.infer<typeof groupOptionalScheme>;
|
|
|
681
712
|
export type MediaItem = z.infer<typeof mediaItemSchema>;
|
|
682
713
|
export type Entity = z.infer<typeof entitySchema>;
|
|
683
714
|
export type OnAnswerChangeMessage = z.infer<typeof onAnswerChangeMessageSchema>;
|
|
715
|
+
export type CommandExecutedMessage = z.infer<typeof commandExecutedMessageSchema>;
|
|
716
|
+
export type QuestionnaireLoadedMessage = z.infer<typeof questionnaireLoadedMessageSchema>;
|
|
684
717
|
export type GetQuestionSuccessResponseMessage = z.infer<typeof getQuestionSuccessResponseMessageSchema>;
|
|
685
718
|
export type GetGroupSuccessResponseMessage = z.infer<typeof getGroupSuccessResponseMessageSchema>;
|
|
686
719
|
export type CanSaveSuccessResponseMessage = z.infer<typeof canSaveSuccessResponseMessageSchema>;
|
|
@@ -706,6 +739,8 @@ export type DeleteGroupRequestMessage = z.infer<typeof deleteGroupRequestMessage
|
|
|
706
739
|
export type WithBusyIndicatorRequestMessage = BusyIndicatorStartRequestMessage | BusyIndicatorEndRequestMessage;
|
|
707
740
|
export declare function isMediaItem(data: unknown): data is MediaItem;
|
|
708
741
|
export declare function isOnAnswerChangeMessage(data: unknown): data is OnAnswerChangeMessage;
|
|
742
|
+
export declare function isCommandExecutedMessage(data: unknown): data is CommandExecutedMessage;
|
|
743
|
+
export declare function isQuestionnaireLoadedMessage(data: unknown): data is QuestionnaireLoadedMessage;
|
|
709
744
|
export declare function isQpBridgeMessage(data: unknown): data is QpBridgeMessage;
|
|
710
745
|
export declare function isSuccessMessage(data: unknown): data is ResponseSuccessMessage;
|
|
711
746
|
export declare function isErrorMessage(data: unknown): data is ResponseErrorMessage;
|
package/lib/qp-bridge.d.ts
CHANGED
|
@@ -211,6 +211,46 @@ export declare function completeAndCloseQuestionnaire(): Promise<void>;
|
|
|
211
211
|
*/
|
|
212
212
|
export declare function executeCustomCommand(commandName: string): Promise<void>;
|
|
213
213
|
type Validator = () => Promise<boolean>;
|
|
214
|
+
/**
|
|
215
|
+
* Registers a handler function to be called when the questionnaire is fully loaded.
|
|
216
|
+
* Useful for performing actions that depend on the questionnaire being ready.
|
|
217
|
+
*
|
|
218
|
+
* @param handler - A function to be called when the questionnaire is loaded.
|
|
219
|
+
* @returns An object with a `cancelSubscription` method to unregister the handler.
|
|
220
|
+
* @example
|
|
221
|
+
* ```typescript
|
|
222
|
+
* import { onQuestionnaireLoaded } from 'qp-bridge';
|
|
223
|
+
* const { cancelSubscription } = onQuestionnaireLoaded(() => {
|
|
224
|
+
* console.log('Questionnaire is fully loaded');
|
|
225
|
+
* });
|
|
226
|
+
*
|
|
227
|
+
* // To stop listening for questionnaire load events:
|
|
228
|
+
* cancelSubscription();
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare function onQuestionnaireLoaded(handler: () => void): {
|
|
232
|
+
cancelSubscription: () => void;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Registers a handler function to be called when a command is executed.
|
|
236
|
+
* Useful for reacting to custom command executions within the questionnaire.
|
|
237
|
+
*
|
|
238
|
+
* @param handler - A function that receives the name of the executed command.
|
|
239
|
+
* @returns An object with a `cancelSubscription` method to unregister the handler.
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* import { onCommandExecuted } from 'qp-bridge';
|
|
243
|
+
* const { cancelSubscription } = onCommandExecuted((commandName) => {
|
|
244
|
+
* console.log(`Command executed: ${commandName}`);
|
|
245
|
+
* });
|
|
246
|
+
*
|
|
247
|
+
* // To stop listening for command executions:
|
|
248
|
+
* cancelSubscription();
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
export declare function onCommandExecuted(handler: (commandName: string) => void): {
|
|
252
|
+
cancelSubscription: () => void;
|
|
253
|
+
};
|
|
214
254
|
/**
|
|
215
255
|
* Registers a validator function to be called when a save event occurs.
|
|
216
256
|
* Useful for validating data before saving the questionnaire.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resconet/qp-bridge",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"dependencies": {
|
|
5
|
-
"zod": "^3.23.8",
|
|
6
|
-
"uuid": "^9.0.1"
|
|
7
|
-
},
|
|
3
|
+
"version": "1.1.1-alpha.31",
|
|
8
4
|
"main": "./index.js",
|
|
9
5
|
"module": "./index.mjs",
|
|
10
|
-
"typings": "./index.d.ts"
|
|
6
|
+
"typings": "./index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"uuid": "^9.0.1",
|
|
9
|
+
"zod": "^3.23.8"
|
|
10
|
+
}
|
|
11
11
|
}
|