@resconet/qp-bridge 1.4.1-alpha.9 → 1.5.0-alpha.13
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/README.md +311 -299
- package/index.js +1 -1
- package/index.mjs +3380 -3372
- package/lib/qp-bridge-types.d.ts +218 -22
- package/lib/qp-bridge.d.ts +43 -4
- package/package.json +2 -2
package/lib/qp-bridge-types.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { z } from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* Feature version for qp-bridge protocol.
|
|
4
4
|
* Increment this version when making breaking changes to the bridge API.
|
|
5
|
-
* Current version:
|
|
5
|
+
* Current version: 2
|
|
6
6
|
*/
|
|
7
|
-
export declare const QP_BRIDGE_FEATURE_VERSION =
|
|
7
|
+
export declare const QP_BRIDGE_FEATURE_VERSION = 3;
|
|
8
8
|
export declare const qpBridgeBaseMessageSchema: z.ZodObject<{
|
|
9
9
|
type: z.ZodLiteral<"qp-bridge">;
|
|
10
10
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -132,44 +132,50 @@ export declare const responseErrorMessageSchema: z.ZodObject<{
|
|
|
132
132
|
id?: string | undefined;
|
|
133
133
|
instanceId?: string | undefined;
|
|
134
134
|
}>;
|
|
135
|
+
export declare const questionTypeSchema: z.ZodEnum<["imageMedia", "shortText", "longText", "url", "email", "wholeNumber", "decimalNumber", "date", "dateTime", "singleSelect", "multiSelect", "optionSet", "rating", "yesNo", "signature", "lookup"]>;
|
|
135
136
|
export declare const questionSchema: z.ZodObject<{
|
|
137
|
+
type: z.ZodEnum<["imageMedia", "shortText", "longText", "url", "email", "wholeNumber", "decimalNumber", "date", "dateTime", "singleSelect", "multiSelect", "optionSet", "rating", "yesNo", "signature", "lookup"]>;
|
|
136
138
|
semanticColor: z.ZodOptional<z.ZodString>;
|
|
137
|
-
label: z.ZodString
|
|
138
|
-
description: z.ZodString
|
|
139
|
+
label: z.ZodOptional<z.ZodString>;
|
|
140
|
+
description: z.ZodOptional<z.ZodString>;
|
|
139
141
|
disabled: z.ZodBoolean;
|
|
140
142
|
required: z.ZodBoolean;
|
|
141
143
|
hidden: z.ZodBoolean;
|
|
142
144
|
errorMessage: z.ZodOptional<z.ZodString>;
|
|
143
145
|
answer: z.ZodOptional<z.ZodUnknown>;
|
|
144
146
|
}, "strip", z.ZodTypeAny, {
|
|
145
|
-
|
|
146
|
-
description: string;
|
|
147
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
147
148
|
disabled: boolean;
|
|
148
149
|
required: boolean;
|
|
149
150
|
hidden: boolean;
|
|
150
151
|
answer?: unknown;
|
|
151
152
|
semanticColor?: string | undefined;
|
|
153
|
+
label?: string | undefined;
|
|
154
|
+
description?: string | undefined;
|
|
152
155
|
errorMessage?: string | undefined;
|
|
153
156
|
}, {
|
|
154
|
-
|
|
155
|
-
description: string;
|
|
157
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
156
158
|
disabled: boolean;
|
|
157
159
|
required: boolean;
|
|
158
160
|
hidden: boolean;
|
|
159
161
|
answer?: unknown;
|
|
160
162
|
semanticColor?: string | undefined;
|
|
163
|
+
label?: string | undefined;
|
|
164
|
+
description?: string | undefined;
|
|
161
165
|
errorMessage?: string | undefined;
|
|
162
166
|
}>;
|
|
163
167
|
export declare const questionOptionalScheme: z.ZodObject<{
|
|
168
|
+
type: z.ZodOptional<z.ZodEnum<["imageMedia", "shortText", "longText", "url", "email", "wholeNumber", "decimalNumber", "date", "dateTime", "singleSelect", "multiSelect", "optionSet", "rating", "yesNo", "signature", "lookup"]>>;
|
|
164
169
|
semanticColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
165
|
-
label: z.ZodOptional<z.ZodString
|
|
166
|
-
description: z.ZodOptional<z.ZodString
|
|
170
|
+
label: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
171
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
167
172
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
168
173
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
169
174
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
170
175
|
errorMessage: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
171
176
|
answer: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
|
|
172
177
|
}, "strip", z.ZodTypeAny, {
|
|
178
|
+
type?: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup" | undefined;
|
|
173
179
|
answer?: unknown;
|
|
174
180
|
semanticColor?: string | undefined;
|
|
175
181
|
label?: string | undefined;
|
|
@@ -179,6 +185,7 @@ export declare const questionOptionalScheme: z.ZodObject<{
|
|
|
179
185
|
hidden?: boolean | undefined;
|
|
180
186
|
errorMessage?: string | undefined;
|
|
181
187
|
}, {
|
|
188
|
+
type?: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup" | undefined;
|
|
182
189
|
answer?: unknown;
|
|
183
190
|
semanticColor?: string | undefined;
|
|
184
191
|
label?: string | undefined;
|
|
@@ -188,6 +195,44 @@ export declare const questionOptionalScheme: z.ZodObject<{
|
|
|
188
195
|
hidden?: boolean | undefined;
|
|
189
196
|
errorMessage?: string | undefined;
|
|
190
197
|
}>;
|
|
198
|
+
export declare const questionnaireQuestionSchema: z.ZodObject<{
|
|
199
|
+
type: z.ZodEnum<["imageMedia", "shortText", "longText", "url", "email", "wholeNumber", "decimalNumber", "date", "dateTime", "singleSelect", "multiSelect", "optionSet", "rating", "yesNo", "signature", "lookup"]>;
|
|
200
|
+
semanticColor: z.ZodOptional<z.ZodString>;
|
|
201
|
+
label: z.ZodOptional<z.ZodString>;
|
|
202
|
+
description: z.ZodOptional<z.ZodString>;
|
|
203
|
+
disabled: z.ZodBoolean;
|
|
204
|
+
required: z.ZodBoolean;
|
|
205
|
+
hidden: z.ZodBoolean;
|
|
206
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
207
|
+
answer: z.ZodOptional<z.ZodUnknown>;
|
|
208
|
+
} & {
|
|
209
|
+
itemType: z.ZodLiteral<"question">;
|
|
210
|
+
name: z.ZodString;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
213
|
+
disabled: boolean;
|
|
214
|
+
required: boolean;
|
|
215
|
+
hidden: boolean;
|
|
216
|
+
itemType: "question";
|
|
217
|
+
name: string;
|
|
218
|
+
answer?: unknown;
|
|
219
|
+
semanticColor?: string | undefined;
|
|
220
|
+
label?: string | undefined;
|
|
221
|
+
description?: string | undefined;
|
|
222
|
+
errorMessage?: string | undefined;
|
|
223
|
+
}, {
|
|
224
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
225
|
+
disabled: boolean;
|
|
226
|
+
required: boolean;
|
|
227
|
+
hidden: boolean;
|
|
228
|
+
itemType: "question";
|
|
229
|
+
name: string;
|
|
230
|
+
answer?: unknown;
|
|
231
|
+
semanticColor?: string | undefined;
|
|
232
|
+
label?: string | undefined;
|
|
233
|
+
description?: string | undefined;
|
|
234
|
+
errorMessage?: string | undefined;
|
|
235
|
+
}>;
|
|
191
236
|
export declare const mediaItemSchema: z.ZodObject<{
|
|
192
237
|
id: z.ZodString;
|
|
193
238
|
name: z.ZodString;
|
|
@@ -231,9 +276,107 @@ export declare const groupOptionalScheme: z.ZodObject<{
|
|
|
231
276
|
hidden?: boolean | undefined;
|
|
232
277
|
collapsed?: boolean | undefined;
|
|
233
278
|
}>;
|
|
279
|
+
export declare const questionnaireStaticComponentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
280
|
+
itemType: z.ZodLiteral<"staticComponent">;
|
|
281
|
+
type: z.ZodLiteral<"staticDescription">;
|
|
282
|
+
name: z.ZodString;
|
|
283
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
284
|
+
content: z.ZodString;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
type: "staticDescription";
|
|
287
|
+
itemType: "staticComponent";
|
|
288
|
+
name: string;
|
|
289
|
+
content: string;
|
|
290
|
+
hidden?: boolean | undefined;
|
|
291
|
+
}, {
|
|
292
|
+
type: "staticDescription";
|
|
293
|
+
itemType: "staticComponent";
|
|
294
|
+
name: string;
|
|
295
|
+
content: string;
|
|
296
|
+
hidden?: boolean | undefined;
|
|
297
|
+
}>, z.ZodObject<{
|
|
298
|
+
itemType: z.ZodLiteral<"staticComponent">;
|
|
299
|
+
type: z.ZodLiteral<"button">;
|
|
300
|
+
name: z.ZodString;
|
|
301
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
302
|
+
clickText: z.ZodString;
|
|
303
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
304
|
+
semanticColor: z.ZodOptional<z.ZodString>;
|
|
305
|
+
commandName: z.ZodOptional<z.ZodString>;
|
|
306
|
+
commandLabel: z.ZodOptional<z.ZodString>;
|
|
307
|
+
}, "strip", z.ZodTypeAny, {
|
|
308
|
+
type: "button";
|
|
309
|
+
itemType: "staticComponent";
|
|
310
|
+
name: string;
|
|
311
|
+
clickText: string;
|
|
312
|
+
commandName?: string | undefined;
|
|
313
|
+
semanticColor?: string | undefined;
|
|
314
|
+
disabled?: boolean | undefined;
|
|
315
|
+
hidden?: boolean | undefined;
|
|
316
|
+
commandLabel?: string | undefined;
|
|
317
|
+
}, {
|
|
318
|
+
type: "button";
|
|
319
|
+
itemType: "staticComponent";
|
|
320
|
+
name: string;
|
|
321
|
+
clickText: string;
|
|
322
|
+
commandName?: string | undefined;
|
|
323
|
+
semanticColor?: string | undefined;
|
|
324
|
+
disabled?: boolean | undefined;
|
|
325
|
+
hidden?: boolean | undefined;
|
|
326
|
+
commandLabel?: string | undefined;
|
|
327
|
+
}>]>;
|
|
328
|
+
declare const questionnaireGroupBaseSchema: z.ZodObject<{
|
|
329
|
+
label: z.ZodOptional<z.ZodString>;
|
|
330
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
331
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
332
|
+
} & {
|
|
333
|
+
itemType: z.ZodLiteral<"group">;
|
|
334
|
+
name: z.ZodString;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
itemType: "group";
|
|
337
|
+
name: string;
|
|
338
|
+
label?: string | undefined;
|
|
339
|
+
hidden?: boolean | undefined;
|
|
340
|
+
collapsed?: boolean | undefined;
|
|
341
|
+
}, {
|
|
342
|
+
itemType: "group";
|
|
343
|
+
name: string;
|
|
344
|
+
label?: string | undefined;
|
|
345
|
+
hidden?: boolean | undefined;
|
|
346
|
+
collapsed?: boolean | undefined;
|
|
347
|
+
}>;
|
|
348
|
+
declare const questionnaireRepeatableGroupBaseSchema: z.ZodObject<{
|
|
349
|
+
itemType: z.ZodLiteral<"repeatableGroup">;
|
|
350
|
+
name: z.ZodString;
|
|
351
|
+
label: z.ZodOptional<z.ZodString>;
|
|
352
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
353
|
+
}, "strip", z.ZodTypeAny, {
|
|
354
|
+
itemType: "repeatableGroup";
|
|
355
|
+
name: string;
|
|
356
|
+
label?: string | undefined;
|
|
357
|
+
hidden?: boolean | undefined;
|
|
358
|
+
}, {
|
|
359
|
+
itemType: "repeatableGroup";
|
|
360
|
+
name: string;
|
|
361
|
+
label?: string | undefined;
|
|
362
|
+
hidden?: boolean | undefined;
|
|
363
|
+
}>;
|
|
364
|
+
export type QuestionnaireQuestion = z.infer<typeof questionnaireQuestionSchema>;
|
|
365
|
+
export type QuestionnaireStaticComponent = z.infer<typeof questionnaireStaticComponentSchema>;
|
|
366
|
+
export type QuestionnaireGroup = z.infer<typeof questionnaireGroupBaseSchema> & {
|
|
367
|
+
readonly items: readonly QuestionnaireItem[];
|
|
368
|
+
};
|
|
369
|
+
export type QuestionnaireRepeatableGroup = z.infer<typeof questionnaireRepeatableGroupBaseSchema> & {
|
|
370
|
+
readonly groups: readonly QuestionnaireGroup[];
|
|
371
|
+
};
|
|
372
|
+
export type QuestionnaireItem = QuestionnaireQuestion | QuestionnaireGroup | QuestionnaireRepeatableGroup | QuestionnaireStaticComponent;
|
|
373
|
+
export declare const questionnaireItemSchema: z.ZodType<QuestionnaireItem>;
|
|
374
|
+
export declare const questionnaireGroupSchema: z.ZodType<QuestionnaireGroup>;
|
|
375
|
+
export declare const questionnaireRepeatableGroupSchema: z.ZodType<QuestionnaireRepeatableGroup>;
|
|
234
376
|
export declare const questionnaireSchema: z.ZodObject<{
|
|
235
377
|
isNew: z.ZodBoolean;
|
|
236
378
|
id: z.ZodString;
|
|
379
|
+
name: z.ZodString;
|
|
237
380
|
label: z.ZodString;
|
|
238
381
|
description: z.ZodOptional<z.ZodString>;
|
|
239
382
|
regarding: z.ZodOptional<z.ZodObject<{
|
|
@@ -249,9 +392,12 @@ export declare const questionnaireSchema: z.ZodObject<{
|
|
|
249
392
|
name: string;
|
|
250
393
|
entityName: string;
|
|
251
394
|
}>>;
|
|
395
|
+
items: z.ZodArray<z.ZodType<QuestionnaireItem, z.ZodTypeDef, QuestionnaireItem>, "many">;
|
|
252
396
|
}, "strip", z.ZodTypeAny, {
|
|
253
397
|
id: string;
|
|
254
398
|
label: string;
|
|
399
|
+
name: string;
|
|
400
|
+
items: QuestionnaireItem[];
|
|
255
401
|
isNew: boolean;
|
|
256
402
|
description?: string | undefined;
|
|
257
403
|
regarding?: {
|
|
@@ -262,6 +408,8 @@ export declare const questionnaireSchema: z.ZodObject<{
|
|
|
262
408
|
}, {
|
|
263
409
|
id: string;
|
|
264
410
|
label: string;
|
|
411
|
+
name: string;
|
|
412
|
+
items: QuestionnaireItem[];
|
|
265
413
|
isNew: boolean;
|
|
266
414
|
description?: string | undefined;
|
|
267
415
|
regarding?: {
|
|
@@ -302,44 +450,48 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
302
450
|
status: z.ZodLiteral<"success">;
|
|
303
451
|
} & {
|
|
304
452
|
question: z.ZodObject<{
|
|
453
|
+
type: z.ZodEnum<["imageMedia", "shortText", "longText", "url", "email", "wholeNumber", "decimalNumber", "date", "dateTime", "singleSelect", "multiSelect", "optionSet", "rating", "yesNo", "signature", "lookup"]>;
|
|
305
454
|
semanticColor: z.ZodOptional<z.ZodString>;
|
|
306
|
-
label: z.ZodString
|
|
307
|
-
description: z.ZodString
|
|
455
|
+
label: z.ZodOptional<z.ZodString>;
|
|
456
|
+
description: z.ZodOptional<z.ZodString>;
|
|
308
457
|
disabled: z.ZodBoolean;
|
|
309
458
|
required: z.ZodBoolean;
|
|
310
459
|
hidden: z.ZodBoolean;
|
|
311
460
|
errorMessage: z.ZodOptional<z.ZodString>;
|
|
312
461
|
answer: z.ZodOptional<z.ZodUnknown>;
|
|
313
462
|
}, "strip", z.ZodTypeAny, {
|
|
314
|
-
|
|
315
|
-
description: string;
|
|
463
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
316
464
|
disabled: boolean;
|
|
317
465
|
required: boolean;
|
|
318
466
|
hidden: boolean;
|
|
319
467
|
answer?: unknown;
|
|
320
468
|
semanticColor?: string | undefined;
|
|
469
|
+
label?: string | undefined;
|
|
470
|
+
description?: string | undefined;
|
|
321
471
|
errorMessage?: string | undefined;
|
|
322
472
|
}, {
|
|
323
|
-
|
|
324
|
-
description: string;
|
|
473
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
325
474
|
disabled: boolean;
|
|
326
475
|
required: boolean;
|
|
327
476
|
hidden: boolean;
|
|
328
477
|
answer?: unknown;
|
|
329
478
|
semanticColor?: string | undefined;
|
|
479
|
+
label?: string | undefined;
|
|
480
|
+
description?: string | undefined;
|
|
330
481
|
errorMessage?: string | undefined;
|
|
331
482
|
}>;
|
|
332
483
|
}, "strip", z.ZodTypeAny, {
|
|
333
484
|
type: "qp-bridge";
|
|
334
485
|
status: "success";
|
|
335
486
|
question: {
|
|
336
|
-
|
|
337
|
-
description: string;
|
|
487
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
338
488
|
disabled: boolean;
|
|
339
489
|
required: boolean;
|
|
340
490
|
hidden: boolean;
|
|
341
491
|
answer?: unknown;
|
|
342
492
|
semanticColor?: string | undefined;
|
|
493
|
+
label?: string | undefined;
|
|
494
|
+
description?: string | undefined;
|
|
343
495
|
errorMessage?: string | undefined;
|
|
344
496
|
};
|
|
345
497
|
id?: string | undefined;
|
|
@@ -348,13 +500,14 @@ export declare const getQuestionSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
348
500
|
type: "qp-bridge";
|
|
349
501
|
status: "success";
|
|
350
502
|
question: {
|
|
351
|
-
|
|
352
|
-
description: string;
|
|
503
|
+
type: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup";
|
|
353
504
|
disabled: boolean;
|
|
354
505
|
required: boolean;
|
|
355
506
|
hidden: boolean;
|
|
356
507
|
answer?: unknown;
|
|
357
508
|
semanticColor?: string | undefined;
|
|
509
|
+
label?: string | undefined;
|
|
510
|
+
description?: string | undefined;
|
|
358
511
|
errorMessage?: string | undefined;
|
|
359
512
|
};
|
|
360
513
|
id?: string | undefined;
|
|
@@ -370,15 +523,17 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<{
|
|
|
370
523
|
action: z.ZodLiteral<"setQuestion">;
|
|
371
524
|
question: z.ZodString;
|
|
372
525
|
questionData: z.ZodObject<{
|
|
526
|
+
type: z.ZodOptional<z.ZodEnum<["imageMedia", "shortText", "longText", "url", "email", "wholeNumber", "decimalNumber", "date", "dateTime", "singleSelect", "multiSelect", "optionSet", "rating", "yesNo", "signature", "lookup"]>>;
|
|
373
527
|
semanticColor: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
374
|
-
label: z.ZodOptional<z.ZodString
|
|
375
|
-
description: z.ZodOptional<z.ZodString
|
|
528
|
+
label: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
529
|
+
description: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
376
530
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
377
531
|
required: z.ZodOptional<z.ZodBoolean>;
|
|
378
532
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
379
533
|
errorMessage: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
380
534
|
answer: z.ZodOptional<z.ZodOptional<z.ZodUnknown>>;
|
|
381
535
|
}, "strip", z.ZodTypeAny, {
|
|
536
|
+
type?: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup" | undefined;
|
|
382
537
|
answer?: unknown;
|
|
383
538
|
semanticColor?: string | undefined;
|
|
384
539
|
label?: string | undefined;
|
|
@@ -388,6 +543,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<{
|
|
|
388
543
|
hidden?: boolean | undefined;
|
|
389
544
|
errorMessage?: string | undefined;
|
|
390
545
|
}, {
|
|
546
|
+
type?: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup" | undefined;
|
|
391
547
|
answer?: unknown;
|
|
392
548
|
semanticColor?: string | undefined;
|
|
393
549
|
label?: string | undefined;
|
|
@@ -402,6 +558,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<{
|
|
|
402
558
|
question: string;
|
|
403
559
|
action: "setQuestion";
|
|
404
560
|
questionData: {
|
|
561
|
+
type?: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup" | undefined;
|
|
405
562
|
answer?: unknown;
|
|
406
563
|
semanticColor?: string | undefined;
|
|
407
564
|
label?: string | undefined;
|
|
@@ -419,6 +576,7 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<{
|
|
|
419
576
|
question: string;
|
|
420
577
|
action: "setQuestion";
|
|
421
578
|
questionData: {
|
|
579
|
+
type?: "date" | "imageMedia" | "shortText" | "longText" | "url" | "email" | "wholeNumber" | "decimalNumber" | "dateTime" | "singleSelect" | "multiSelect" | "optionSet" | "rating" | "yesNo" | "signature" | "lookup" | undefined;
|
|
422
580
|
answer?: unknown;
|
|
423
581
|
semanticColor?: string | undefined;
|
|
424
582
|
label?: string | undefined;
|
|
@@ -528,6 +686,7 @@ export declare const getQuestionnaireSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
528
686
|
questionnaire: z.ZodObject<{
|
|
529
687
|
isNew: z.ZodBoolean;
|
|
530
688
|
id: z.ZodString;
|
|
689
|
+
name: z.ZodString;
|
|
531
690
|
label: z.ZodString;
|
|
532
691
|
description: z.ZodOptional<z.ZodString>;
|
|
533
692
|
regarding: z.ZodOptional<z.ZodObject<{
|
|
@@ -543,9 +702,12 @@ export declare const getQuestionnaireSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
543
702
|
name: string;
|
|
544
703
|
entityName: string;
|
|
545
704
|
}>>;
|
|
705
|
+
items: z.ZodArray<z.ZodType<QuestionnaireItem, z.ZodTypeDef, QuestionnaireItem>, "many">;
|
|
546
706
|
}, "strip", z.ZodTypeAny, {
|
|
547
707
|
id: string;
|
|
548
708
|
label: string;
|
|
709
|
+
name: string;
|
|
710
|
+
items: QuestionnaireItem[];
|
|
549
711
|
isNew: boolean;
|
|
550
712
|
description?: string | undefined;
|
|
551
713
|
regarding?: {
|
|
@@ -556,6 +718,8 @@ export declare const getQuestionnaireSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
556
718
|
}, {
|
|
557
719
|
id: string;
|
|
558
720
|
label: string;
|
|
721
|
+
name: string;
|
|
722
|
+
items: QuestionnaireItem[];
|
|
559
723
|
isNew: boolean;
|
|
560
724
|
description?: string | undefined;
|
|
561
725
|
regarding?: {
|
|
@@ -570,6 +734,8 @@ export declare const getQuestionnaireSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
570
734
|
questionnaire: {
|
|
571
735
|
id: string;
|
|
572
736
|
label: string;
|
|
737
|
+
name: string;
|
|
738
|
+
items: QuestionnaireItem[];
|
|
573
739
|
isNew: boolean;
|
|
574
740
|
description?: string | undefined;
|
|
575
741
|
regarding?: {
|
|
@@ -586,6 +752,8 @@ export declare const getQuestionnaireSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
586
752
|
questionnaire: {
|
|
587
753
|
id: string;
|
|
588
754
|
label: string;
|
|
755
|
+
name: string;
|
|
756
|
+
items: QuestionnaireItem[];
|
|
589
757
|
isNew: boolean;
|
|
590
758
|
description?: string | undefined;
|
|
591
759
|
regarding?: {
|
|
@@ -639,6 +807,30 @@ export declare const canSaveRequestMessageSchema: z.ZodObject<{
|
|
|
639
807
|
instanceId?: string | undefined;
|
|
640
808
|
featureVersion?: number | undefined;
|
|
641
809
|
}>;
|
|
810
|
+
export declare const postSaveRequestMessageSchema: z.ZodObject<{
|
|
811
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
812
|
+
id: z.ZodOptional<z.ZodString>;
|
|
813
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
814
|
+
} & {
|
|
815
|
+
featureVersion: z.ZodOptional<z.ZodNumber>;
|
|
816
|
+
} & {
|
|
817
|
+
action: z.ZodLiteral<"postSave">;
|
|
818
|
+
answerId: z.ZodString;
|
|
819
|
+
}, "strip", z.ZodTypeAny, {
|
|
820
|
+
type: "qp-bridge";
|
|
821
|
+
action: "postSave";
|
|
822
|
+
answerId: string;
|
|
823
|
+
id?: string | undefined;
|
|
824
|
+
instanceId?: string | undefined;
|
|
825
|
+
featureVersion?: number | undefined;
|
|
826
|
+
}, {
|
|
827
|
+
type: "qp-bridge";
|
|
828
|
+
action: "postSave";
|
|
829
|
+
answerId: string;
|
|
830
|
+
id?: string | undefined;
|
|
831
|
+
instanceId?: string | undefined;
|
|
832
|
+
featureVersion?: number | undefined;
|
|
833
|
+
}>;
|
|
642
834
|
export declare const setGroupRequestMessageSchema: z.ZodObject<{
|
|
643
835
|
type: z.ZodLiteral<"qp-bridge">;
|
|
644
836
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -1020,6 +1212,7 @@ export type QpBridgeBaseMessage = z.infer<typeof qpBridgeBaseMessageSchema>;
|
|
|
1020
1212
|
export type QpBridgeRequestMessage = z.infer<typeof qpBridgeRequestMessageSchema>;
|
|
1021
1213
|
export type ResponseSuccessMessage = z.infer<typeof responseSuccessMessageSchema>;
|
|
1022
1214
|
export type ResponseErrorMessage = z.infer<typeof responseErrorMessageSchema>;
|
|
1215
|
+
export type QuestionType = z.infer<typeof questionTypeSchema>;
|
|
1023
1216
|
export type Question = z.infer<typeof questionSchema>;
|
|
1024
1217
|
export type QuestionOptional = z.infer<typeof questionOptionalScheme>;
|
|
1025
1218
|
export type Group = z.infer<typeof groupSchema>;
|
|
@@ -1048,6 +1241,7 @@ export type SaveQuestionnaireRequestMessage = z.infer<typeof saveQuestionnaireRe
|
|
|
1048
1241
|
export type CompleteAndCloseQuestionnaireRequestMessage = z.infer<typeof completeAndCloseQuestionnaireRequestMessageSchema>;
|
|
1049
1242
|
export type ExecuteCustomCommandRequestMessage = z.infer<typeof executeCustomCommandRequestMessageSchema>;
|
|
1050
1243
|
export type CanSaveRequestMessage = z.infer<typeof canSaveRequestMessageSchema>;
|
|
1244
|
+
export type PostSaveRequestMessage = z.infer<typeof postSaveRequestMessageSchema>;
|
|
1051
1245
|
export type FetchEntitiesRequestMessage = z.infer<typeof fetchEntitiesRequestMessageSchema>;
|
|
1052
1246
|
export type GetEntityByIdRequestMessage = z.infer<typeof getEntityByIdRequestMessageSchema>;
|
|
1053
1247
|
export type SaveEntityRequestMessage = z.infer<typeof saveEntityRequestMessageSchema>;
|
|
@@ -1074,6 +1268,7 @@ export declare function isGetGroupSuccessResponseMessage(data: unknown): data is
|
|
|
1074
1268
|
export declare function isGetQuestionnaireSuccessResponseMessage(data: unknown): data is GetQuestionnaireSuccessResponseMessage;
|
|
1075
1269
|
export declare function isCanSaveSuccessResponseMessage(data: unknown): data is CanSaveSuccessResponseMessage;
|
|
1076
1270
|
export declare function isCanSaveRequestMessage(data: unknown): data is CanSaveRequestMessage;
|
|
1271
|
+
export declare function isPostSaveRequestMessage(data: unknown): data is PostSaveRequestMessage;
|
|
1077
1272
|
export declare function isBusyIndicatorStartRequestMessage(data: unknown): data is BusyIndicatorStartRequestMessage;
|
|
1078
1273
|
export declare function isBusyIndicatorEndRequestMessage(data: unknown): data is BusyIndicatorEndRequestMessage;
|
|
1079
1274
|
export declare function isSaveQuestionnaireRequestMessage(data: unknown): data is SaveQuestionnaireRequestMessage;
|
|
@@ -1089,3 +1284,4 @@ export declare function isSaveEntityRequestMessage(data: unknown): data is SaveE
|
|
|
1089
1284
|
export declare function isRepeatGroupRequestMessage(data: unknown): data is RepeatGroupRequestMessage;
|
|
1090
1285
|
export declare function isAddNewGroupRequestMessage(data: unknown): data is AddNewGroupRequestMessage;
|
|
1091
1286
|
export declare function isDeleteGroupRequestMessage(data: unknown): data is DeleteGroupRequestMessage;
|
|
1287
|
+
export {};
|
package/lib/qp-bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity, Group, GroupOptional, MediaItem, Question, QuestionOptional, Questionnaire } from './qp-bridge-types';
|
|
1
|
+
import { Entity, Group, GroupOptional, MediaItem, Question, QuestionnaireItem, QuestionnaireQuestion, QuestionOptional, Questionnaire } from './qp-bridge-types';
|
|
2
2
|
export type QpBridgeOptions = {
|
|
3
3
|
instanceId?: string;
|
|
4
4
|
};
|
|
@@ -77,19 +77,37 @@ export declare function removeOnSaveMessageHandler(): void;
|
|
|
77
77
|
* The resolved `Questionnaire` object has the following properties:
|
|
78
78
|
* - `isNew` — Whether the questionnaire is a new (unsaved) record.
|
|
79
79
|
* - `id` — Unique identifier (UUID) of the questionnaire record.
|
|
80
|
-
* - `
|
|
80
|
+
* - `name` — Logical questionnaire name.
|
|
81
|
+
* - `label` — Display name of the questionnaire. Kept as an alias for existing bridge consumers.
|
|
81
82
|
* - `description` _(optional)_ — Description or notes for the questionnaire.
|
|
82
83
|
* - `regarding` _(optional)_ — Reference to the related entity this questionnaire is associated with (`entityName`, `id`, `name`).
|
|
84
|
+
* - `items` — Questionnaire item tree in domain-model order. Items can be questions, groups, repeatable groups, or static components.
|
|
83
85
|
*
|
|
84
86
|
* @throws {Error} Throws if the questionnaire is not found or the operation fails.
|
|
85
87
|
* @example
|
|
86
88
|
* ```typescript
|
|
87
89
|
* const questionnaire = await getQuestionnaire();
|
|
88
|
-
* console.log(questionnaire.id);
|
|
89
|
-
* console.log(questionnaire.
|
|
90
|
+
* console.log(questionnaire.id);
|
|
91
|
+
* console.log(questionnaire.items.map(item => item.name));
|
|
92
|
+
* console.log(flattenQuestions(questionnaire).map(question => question.name));
|
|
90
93
|
* ```
|
|
91
94
|
*/
|
|
92
95
|
export declare function getQuestionnaire(options?: QpBridgeOptions): Promise<Questionnaire>;
|
|
96
|
+
export type QuestionnaireItemVisitor = (item: QuestionnaireItem, parents: readonly QuestionnaireItem[]) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Traverses the questionnaire item tree in pre-order and passes parent context to the visitor.
|
|
99
|
+
*
|
|
100
|
+
* Repeatable groups are visited before their group instances.
|
|
101
|
+
*/
|
|
102
|
+
export declare function traverseQuestionnaireItems(questionnaire: Questionnaire, visitor: QuestionnaireItemVisitor): void;
|
|
103
|
+
/**
|
|
104
|
+
* Returns every questionnaire item in tree order.
|
|
105
|
+
*/
|
|
106
|
+
export declare function flattenQuestionnaireItems(questionnaire: Questionnaire): QuestionnaireItem[];
|
|
107
|
+
/**
|
|
108
|
+
* Returns every question from the questionnaire item tree in tree order.
|
|
109
|
+
*/
|
|
110
|
+
export declare function flattenQuestions(questionnaire: Questionnaire): QuestionnaireQuestion[];
|
|
93
111
|
/**
|
|
94
112
|
* Sets the answer for a specific question in the questionnaire.
|
|
95
113
|
*
|
|
@@ -237,6 +255,7 @@ export declare function completeAndCloseQuestionnaire(options?: QpBridgeOptions)
|
|
|
237
255
|
*/
|
|
238
256
|
export declare function executeCustomCommand(commandName: string, options?: QpBridgeOptions): Promise<void>;
|
|
239
257
|
type Validator = () => Promise<boolean>;
|
|
258
|
+
type PostSaveHandler = (answerId: string) => Promise<void> | void;
|
|
240
259
|
/**
|
|
241
260
|
* Registers a handler function to be called when the questionnaire is fully loaded.
|
|
242
261
|
* Useful for performing actions that depend on the questionnaire being ready.
|
|
@@ -298,6 +317,26 @@ export declare function onCommandExecuted(handler: (commandName: string) => void
|
|
|
298
317
|
export declare function onSave(validator: Validator, options?: QpBridgeOptions): {
|
|
299
318
|
cancelSubscription: () => void;
|
|
300
319
|
};
|
|
320
|
+
/**
|
|
321
|
+
* Registers a handler function to be called after the questionnaire is successfully saved.
|
|
322
|
+
* The handler receives the saved answer ID and the save flow waits for all handlers to finish before continuing.
|
|
323
|
+
*
|
|
324
|
+
* @param handler - A function called with the saved answer ID after save.
|
|
325
|
+
* @returns An object with a `cancelSubscription` method to unregister the handler.
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* import { onPostSave } from 'qp-bridge';
|
|
329
|
+
* const { cancelSubscription } = onPostSave(async answerId => {
|
|
330
|
+
* // create related records and set their regarding to answerId
|
|
331
|
+
* });
|
|
332
|
+
*
|
|
333
|
+
* // To stop listening for post-save events:
|
|
334
|
+
* cancelSubscription();
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
export declare function onPostSave(handler: PostSaveHandler, options?: QpBridgeOptions): {
|
|
338
|
+
cancelSubscription: () => void;
|
|
339
|
+
};
|
|
301
340
|
/**
|
|
302
341
|
* Fetches entities from the CRM system using the provided FetchXML query.
|
|
303
342
|
*
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resconet/qp-bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-alpha.13",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"module": "./index.mjs",
|
|
6
6
|
"typings": "./index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"uuid": "^
|
|
8
|
+
"uuid": "^14.0.0",
|
|
9
9
|
"zod": "^3.23.8"
|
|
10
10
|
}
|
|
11
11
|
}
|