@resconet/qp-bridge 1.4.0 → 1.4.1-alpha.11
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 +36 -4
- package/index.js +1 -1
- package/index.mjs +853 -697
- package/lib/qp-bridge-types.d.ts +192 -22
- package/lib/qp-bridge.d.ts +22 -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 = 2;
|
|
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?: {
|
|
@@ -1020,6 +1188,7 @@ export type QpBridgeBaseMessage = z.infer<typeof qpBridgeBaseMessageSchema>;
|
|
|
1020
1188
|
export type QpBridgeRequestMessage = z.infer<typeof qpBridgeRequestMessageSchema>;
|
|
1021
1189
|
export type ResponseSuccessMessage = z.infer<typeof responseSuccessMessageSchema>;
|
|
1022
1190
|
export type ResponseErrorMessage = z.infer<typeof responseErrorMessageSchema>;
|
|
1191
|
+
export type QuestionType = z.infer<typeof questionTypeSchema>;
|
|
1023
1192
|
export type Question = z.infer<typeof questionSchema>;
|
|
1024
1193
|
export type QuestionOptional = z.infer<typeof questionOptionalScheme>;
|
|
1025
1194
|
export type Group = z.infer<typeof groupSchema>;
|
|
@@ -1089,3 +1258,4 @@ export declare function isSaveEntityRequestMessage(data: unknown): data is SaveE
|
|
|
1089
1258
|
export declare function isRepeatGroupRequestMessage(data: unknown): data is RepeatGroupRequestMessage;
|
|
1090
1259
|
export declare function isAddNewGroupRequestMessage(data: unknown): data is AddNewGroupRequestMessage;
|
|
1091
1260
|
export declare function isDeleteGroupRequestMessage(data: unknown): data is DeleteGroupRequestMessage;
|
|
1261
|
+
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
|
*
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resconet/qp-bridge",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1-alpha.11",
|
|
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
|
}
|