@resconet/qp-bridge 1.3.2-alpha.4 → 1.4.0-alpha.6
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 +48 -19
- package/index.js +1 -1
- package/index.mjs +397 -355
- package/lib/qp-bridge-types.d.ts +144 -0
- package/lib/qp-bridge.d.ts +22 -1
- package/package.json +1 -1
package/lib/qp-bridge-types.d.ts
CHANGED
|
@@ -231,6 +231,45 @@ export declare const groupOptionalScheme: z.ZodObject<{
|
|
|
231
231
|
hidden?: boolean | undefined;
|
|
232
232
|
collapsed?: boolean | undefined;
|
|
233
233
|
}>;
|
|
234
|
+
export declare const questionnaireSchema: z.ZodObject<{
|
|
235
|
+
isNew: z.ZodBoolean;
|
|
236
|
+
id: z.ZodString;
|
|
237
|
+
label: z.ZodString;
|
|
238
|
+
description: z.ZodOptional<z.ZodString>;
|
|
239
|
+
regarding: z.ZodOptional<z.ZodObject<{
|
|
240
|
+
entityName: z.ZodString;
|
|
241
|
+
id: z.ZodString;
|
|
242
|
+
name: z.ZodString;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
id: string;
|
|
245
|
+
name: string;
|
|
246
|
+
entityName: string;
|
|
247
|
+
}, {
|
|
248
|
+
id: string;
|
|
249
|
+
name: string;
|
|
250
|
+
entityName: string;
|
|
251
|
+
}>>;
|
|
252
|
+
}, "strip", z.ZodTypeAny, {
|
|
253
|
+
id: string;
|
|
254
|
+
label: string;
|
|
255
|
+
isNew: boolean;
|
|
256
|
+
description?: string | undefined;
|
|
257
|
+
regarding?: {
|
|
258
|
+
id: string;
|
|
259
|
+
name: string;
|
|
260
|
+
entityName: string;
|
|
261
|
+
} | undefined;
|
|
262
|
+
}, {
|
|
263
|
+
id: string;
|
|
264
|
+
label: string;
|
|
265
|
+
isNew: boolean;
|
|
266
|
+
description?: string | undefined;
|
|
267
|
+
regarding?: {
|
|
268
|
+
id: string;
|
|
269
|
+
name: string;
|
|
270
|
+
entityName: string;
|
|
271
|
+
} | undefined;
|
|
272
|
+
}>;
|
|
234
273
|
export declare const getQuestionRequestMessageSchema: z.ZodObject<{
|
|
235
274
|
type: z.ZodLiteral<"qp-bridge">;
|
|
236
275
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -458,6 +497,106 @@ export declare const getGroupSuccessResponseMessageSchema: z.ZodObject<{
|
|
|
458
497
|
id?: string | undefined;
|
|
459
498
|
instanceId?: string | undefined;
|
|
460
499
|
}>;
|
|
500
|
+
export declare const getQuestionnaireRequestMessageSchema: z.ZodObject<{
|
|
501
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
502
|
+
id: z.ZodOptional<z.ZodString>;
|
|
503
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
504
|
+
} & {
|
|
505
|
+
featureVersion: z.ZodOptional<z.ZodNumber>;
|
|
506
|
+
} & {
|
|
507
|
+
action: z.ZodLiteral<"getQuestionnaire">;
|
|
508
|
+
}, "strip", z.ZodTypeAny, {
|
|
509
|
+
type: "qp-bridge";
|
|
510
|
+
action: "getQuestionnaire";
|
|
511
|
+
id?: string | undefined;
|
|
512
|
+
instanceId?: string | undefined;
|
|
513
|
+
featureVersion?: number | undefined;
|
|
514
|
+
}, {
|
|
515
|
+
type: "qp-bridge";
|
|
516
|
+
action: "getQuestionnaire";
|
|
517
|
+
id?: string | undefined;
|
|
518
|
+
instanceId?: string | undefined;
|
|
519
|
+
featureVersion?: number | undefined;
|
|
520
|
+
}>;
|
|
521
|
+
export declare const getQuestionnaireSuccessResponseMessageSchema: z.ZodObject<{
|
|
522
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
523
|
+
id: z.ZodOptional<z.ZodString>;
|
|
524
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
525
|
+
} & {
|
|
526
|
+
status: z.ZodLiteral<"success">;
|
|
527
|
+
} & {
|
|
528
|
+
questionnaire: z.ZodObject<{
|
|
529
|
+
isNew: z.ZodBoolean;
|
|
530
|
+
id: z.ZodString;
|
|
531
|
+
label: z.ZodString;
|
|
532
|
+
description: z.ZodOptional<z.ZodString>;
|
|
533
|
+
regarding: z.ZodOptional<z.ZodObject<{
|
|
534
|
+
entityName: z.ZodString;
|
|
535
|
+
id: z.ZodString;
|
|
536
|
+
name: z.ZodString;
|
|
537
|
+
}, "strip", z.ZodTypeAny, {
|
|
538
|
+
id: string;
|
|
539
|
+
name: string;
|
|
540
|
+
entityName: string;
|
|
541
|
+
}, {
|
|
542
|
+
id: string;
|
|
543
|
+
name: string;
|
|
544
|
+
entityName: string;
|
|
545
|
+
}>>;
|
|
546
|
+
}, "strip", z.ZodTypeAny, {
|
|
547
|
+
id: string;
|
|
548
|
+
label: string;
|
|
549
|
+
isNew: boolean;
|
|
550
|
+
description?: string | undefined;
|
|
551
|
+
regarding?: {
|
|
552
|
+
id: string;
|
|
553
|
+
name: string;
|
|
554
|
+
entityName: string;
|
|
555
|
+
} | undefined;
|
|
556
|
+
}, {
|
|
557
|
+
id: string;
|
|
558
|
+
label: string;
|
|
559
|
+
isNew: boolean;
|
|
560
|
+
description?: string | undefined;
|
|
561
|
+
regarding?: {
|
|
562
|
+
id: string;
|
|
563
|
+
name: string;
|
|
564
|
+
entityName: string;
|
|
565
|
+
} | undefined;
|
|
566
|
+
}>;
|
|
567
|
+
}, "strip", z.ZodTypeAny, {
|
|
568
|
+
type: "qp-bridge";
|
|
569
|
+
status: "success";
|
|
570
|
+
questionnaire: {
|
|
571
|
+
id: string;
|
|
572
|
+
label: string;
|
|
573
|
+
isNew: boolean;
|
|
574
|
+
description?: string | undefined;
|
|
575
|
+
regarding?: {
|
|
576
|
+
id: string;
|
|
577
|
+
name: string;
|
|
578
|
+
entityName: string;
|
|
579
|
+
} | undefined;
|
|
580
|
+
};
|
|
581
|
+
id?: string | undefined;
|
|
582
|
+
instanceId?: string | undefined;
|
|
583
|
+
}, {
|
|
584
|
+
type: "qp-bridge";
|
|
585
|
+
status: "success";
|
|
586
|
+
questionnaire: {
|
|
587
|
+
id: string;
|
|
588
|
+
label: string;
|
|
589
|
+
isNew: boolean;
|
|
590
|
+
description?: string | undefined;
|
|
591
|
+
regarding?: {
|
|
592
|
+
id: string;
|
|
593
|
+
name: string;
|
|
594
|
+
entityName: string;
|
|
595
|
+
} | undefined;
|
|
596
|
+
};
|
|
597
|
+
id?: string | undefined;
|
|
598
|
+
instanceId?: string | undefined;
|
|
599
|
+
}>;
|
|
461
600
|
export declare const canSaveSuccessResponseMessageSchema: z.ZodObject<{
|
|
462
601
|
type: z.ZodLiteral<"qp-bridge">;
|
|
463
602
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -884,6 +1023,7 @@ export type ResponseErrorMessage = z.infer<typeof responseErrorMessageSchema>;
|
|
|
884
1023
|
export type Question = z.infer<typeof questionSchema>;
|
|
885
1024
|
export type QuestionOptional = z.infer<typeof questionOptionalScheme>;
|
|
886
1025
|
export type Group = z.infer<typeof groupSchema>;
|
|
1026
|
+
export type Questionnaire = z.infer<typeof questionnaireSchema>;
|
|
887
1027
|
export type GroupOptional = z.infer<typeof groupOptionalScheme>;
|
|
888
1028
|
export type MediaItem = z.infer<typeof mediaItemSchema>;
|
|
889
1029
|
export type Entity = z.infer<typeof entitySchema>;
|
|
@@ -892,12 +1032,14 @@ export type CommandExecutedMessage = z.infer<typeof commandExecutedMessageSchema
|
|
|
892
1032
|
export type QuestionnaireLoadedMessage = z.infer<typeof questionnaireLoadedMessageSchema>;
|
|
893
1033
|
export type GetQuestionSuccessResponseMessage = z.infer<typeof getQuestionSuccessResponseMessageSchema>;
|
|
894
1034
|
export type GetGroupSuccessResponseMessage = z.infer<typeof getGroupSuccessResponseMessageSchema>;
|
|
1035
|
+
export type GetQuestionnaireSuccessResponseMessage = z.infer<typeof getQuestionnaireSuccessResponseMessageSchema>;
|
|
895
1036
|
export type CanSaveSuccessResponseMessage = z.infer<typeof canSaveSuccessResponseMessageSchema>;
|
|
896
1037
|
export type FetchEntitiesSuccessResponseMessage = z.infer<typeof fetchEntitiesSuccessResponseMessageSchema>;
|
|
897
1038
|
export type GetEntityByIdSuccessResponseMessage = z.infer<typeof getEntityByIdSuccessResponseMessageSchema>;
|
|
898
1039
|
export type SetAnswerRequestMessage = z.infer<typeof setAnswerRequestMessageSchema>;
|
|
899
1040
|
export type GetQuestionRequestMessage = z.infer<typeof getQuestionRequestMessageSchema>;
|
|
900
1041
|
export type GetGroupRequestMessage = z.infer<typeof getGroupRequestMessageSchema>;
|
|
1042
|
+
export type GetQuestionnaireRequestMessage = z.infer<typeof getQuestionnaireRequestMessageSchema>;
|
|
901
1043
|
export type SetQuestionRequestMessage = z.infer<typeof setQuestionRequestMessageSchema>;
|
|
902
1044
|
export type SetGroupRequestMessage = z.infer<typeof setGroupRequestMessageSchema>;
|
|
903
1045
|
export type BusyIndicatorStartRequestMessage = z.infer<typeof busyIndicatorStartRequestMessageSchema>;
|
|
@@ -927,7 +1069,9 @@ export declare function isSetAnswerRequestMessage(data: unknown): data is SetAns
|
|
|
927
1069
|
export declare function isSetQuestionRequestMessage(data: unknown): data is SetQuestionRequestMessage;
|
|
928
1070
|
export declare function isSetGroupRequestMessage(data: unknown): data is SetGroupRequestMessage;
|
|
929
1071
|
export declare function isGetGroupRequestMessage(data: unknown): data is GetGroupRequestMessage;
|
|
1072
|
+
export declare function isGetQuestionnaireRequestMessage(data: unknown): data is GetQuestionnaireRequestMessage;
|
|
930
1073
|
export declare function isGetGroupSuccessResponseMessage(data: unknown): data is GetGroupSuccessResponseMessage;
|
|
1074
|
+
export declare function isGetQuestionnaireSuccessResponseMessage(data: unknown): data is GetQuestionnaireSuccessResponseMessage;
|
|
931
1075
|
export declare function isCanSaveSuccessResponseMessage(data: unknown): data is CanSaveSuccessResponseMessage;
|
|
932
1076
|
export declare function isCanSaveRequestMessage(data: unknown): data is CanSaveRequestMessage;
|
|
933
1077
|
export declare function isBusyIndicatorStartRequestMessage(data: unknown): data is BusyIndicatorStartRequestMessage;
|
package/lib/qp-bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Entity, Group, GroupOptional, MediaItem, Question, QuestionOptional } from './qp-bridge-types';
|
|
1
|
+
import { Entity, Group, GroupOptional, MediaItem, Question, QuestionOptional, Questionnaire } from './qp-bridge-types';
|
|
2
2
|
export type QpBridgeOptions = {
|
|
3
3
|
instanceId?: string;
|
|
4
4
|
};
|
|
@@ -69,6 +69,27 @@ export declare function updateMediaItem(mediaItem: MediaItem, updates: Partial<{
|
|
|
69
69
|
}>): MediaItem;
|
|
70
70
|
export declare function initOnSaveMessageHandler(): void;
|
|
71
71
|
export declare function removeOnSaveMessageHandler(): void;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves a questionnaire on which the user is currently working.
|
|
74
|
+
*
|
|
75
|
+
* @returns {Promise<Questionnaire>} A promise that resolves to the questionnaire object.
|
|
76
|
+
*
|
|
77
|
+
* The resolved `Questionnaire` object has the following properties:
|
|
78
|
+
* - `isNew` — Whether the questionnaire is a new (unsaved) record.
|
|
79
|
+
* - `id` — Unique identifier (UUID) of the questionnaire record.
|
|
80
|
+
* - `label` — Display name of the questionnaire.
|
|
81
|
+
* - `description` _(optional)_ — Description or notes for the questionnaire.
|
|
82
|
+
* - `regarding` _(optional)_ — Reference to the related entity this questionnaire is associated with (`entityName`, `id`, `name`).
|
|
83
|
+
*
|
|
84
|
+
* @throws {Error} Throws if the questionnaire is not found or the operation fails.
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const questionnaire = await getQuestionnaire();
|
|
88
|
+
* console.log(questionnaire.id); // Outputs the ID of the questionnaire
|
|
89
|
+
* console.log(questionnaire.isNew); // Outputs whether the questionnaire is new
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function getQuestionnaire(options?: QpBridgeOptions): Promise<Questionnaire>;
|
|
72
93
|
/**
|
|
73
94
|
* Sets the answer for a specific question in the questionnaire.
|
|
74
95
|
*
|