@resconet/qp-bridge 1.4.1-alpha.11 → 1.5.0-alpha.12
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 +282 -302
- package/index.js +1 -1
- package/index.mjs +588 -559
- package/lib/qp-bridge-types.d.ts +27 -1
- package/lib/qp-bridge.d.ts +21 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,6 +72,7 @@ await setAnswer("numericQuestion", 42);
|
|
|
72
72
|
- [onQuestionnaireLoaded](#onquestionnaireloaded)
|
|
73
73
|
- [onCommandExecuted](#oncommandexecuted)
|
|
74
74
|
- [onSave](#onsave)
|
|
75
|
+
- [onPostSave](#onpostsave)
|
|
75
76
|
- [fetchEntities](#fetchentities)
|
|
76
77
|
- [getEntityById](#getentitybyid)
|
|
77
78
|
- [createNewEntity](#createnewentity)
|
|
@@ -84,26 +85,25 @@ await setAnswer("numericQuestion", 42);
|
|
|
84
85
|
|
|
85
86
|
Creates a MediaItem from the provided parameters and content.
|
|
86
87
|
|
|
87
|
-
| Function
|
|
88
|
-
|
|
|
88
|
+
| Function | Type |
|
|
89
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
89
90
|
| `createMediaItem` | `{ (name: string, mimeType: string, content: File): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: Blob): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: string): { ...; }; (name: string, mimeType:...` |
|
|
90
91
|
|
|
91
92
|
Parameters:
|
|
92
93
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
94
|
+
- `name`: - Name of the media item.
|
|
95
|
+
- `mimeType`: - MIME type of the media item.
|
|
96
|
+
- `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
|
|
97
|
+
- `id`: - Optional id for the media item. If not provided, a UUID will be generated.
|
|
98
|
+
- `name`: - Name of the media item.
|
|
99
|
+
- `mimeType`: - MIME type of the media item.
|
|
100
|
+
- `content`: - Content as Blob.
|
|
101
|
+
- `name`: - Name of the media item.
|
|
102
|
+
- `mimeType`: - MIME type of the media item.
|
|
103
|
+
- `content`: - Content as base64 string or binary string.
|
|
104
|
+
- `name`: - Name of the media item.
|
|
105
|
+
- `mimeType`: - MIME type of the media item.
|
|
106
|
+
- `content`: - Content as ArrayBuffer.
|
|
107
107
|
|
|
108
108
|
Returns:
|
|
109
109
|
|
|
@@ -113,26 +113,25 @@ MediaItem object with blobUrl generated from the content.
|
|
|
113
113
|
|
|
114
114
|
Creates a MediaItem from the provided parameters and content.
|
|
115
115
|
|
|
116
|
-
| Function
|
|
117
|
-
|
|
|
116
|
+
| Function | Type |
|
|
117
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
118
118
|
| `createMediaItem` | `{ (name: string, mimeType: string, content: File): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: Blob): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: string): { ...; }; (name: string, mimeType:...` |
|
|
119
119
|
|
|
120
120
|
Parameters:
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
- `name`: - Name of the media item.
|
|
123
|
+
- `mimeType`: - MIME type of the media item.
|
|
124
|
+
- `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
|
|
125
|
+
- `id`: - Optional id for the media item. If not provided, a UUID will be generated.
|
|
126
|
+
- `name`: - Name of the media item.
|
|
127
|
+
- `mimeType`: - MIME type of the media item.
|
|
128
|
+
- `content`: - Content as Blob.
|
|
129
|
+
- `name`: - Name of the media item.
|
|
130
|
+
- `mimeType`: - MIME type of the media item.
|
|
131
|
+
- `content`: - Content as base64 string or binary string.
|
|
132
|
+
- `name`: - Name of the media item.
|
|
133
|
+
- `mimeType`: - MIME type of the media item.
|
|
134
|
+
- `content`: - Content as ArrayBuffer.
|
|
136
135
|
|
|
137
136
|
Returns:
|
|
138
137
|
|
|
@@ -142,26 +141,25 @@ MediaItem object with blobUrl generated from the content.
|
|
|
142
141
|
|
|
143
142
|
Creates a MediaItem from the provided parameters and content.
|
|
144
143
|
|
|
145
|
-
| Function
|
|
146
|
-
|
|
|
144
|
+
| Function | Type |
|
|
145
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
147
146
|
| `createMediaItem` | `{ (name: string, mimeType: string, content: File): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: Blob): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: string): { ...; }; (name: string, mimeType:...` |
|
|
148
147
|
|
|
149
148
|
Parameters:
|
|
150
149
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
150
|
+
- `name`: - Name of the media item.
|
|
151
|
+
- `mimeType`: - MIME type of the media item.
|
|
152
|
+
- `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
|
|
153
|
+
- `id`: - Optional id for the media item. If not provided, a UUID will be generated.
|
|
154
|
+
- `name`: - Name of the media item.
|
|
155
|
+
- `mimeType`: - MIME type of the media item.
|
|
156
|
+
- `content`: - Content as Blob.
|
|
157
|
+
- `name`: - Name of the media item.
|
|
158
|
+
- `mimeType`: - MIME type of the media item.
|
|
159
|
+
- `content`: - Content as base64 string or binary string.
|
|
160
|
+
- `name`: - Name of the media item.
|
|
161
|
+
- `mimeType`: - MIME type of the media item.
|
|
162
|
+
- `content`: - Content as ArrayBuffer.
|
|
165
163
|
|
|
166
164
|
Returns:
|
|
167
165
|
|
|
@@ -171,26 +169,25 @@ MediaItem object with blobUrl generated from the content.
|
|
|
171
169
|
|
|
172
170
|
Creates a MediaItem from the provided parameters and content.
|
|
173
171
|
|
|
174
|
-
| Function
|
|
175
|
-
|
|
|
172
|
+
| Function | Type |
|
|
173
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
176
174
|
| `createMediaItem` | `{ (name: string, mimeType: string, content: File): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: Blob): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: string): { ...; }; (name: string, mimeType:...` |
|
|
177
175
|
|
|
178
176
|
Parameters:
|
|
179
177
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
178
|
+
- `name`: - Name of the media item.
|
|
179
|
+
- `mimeType`: - MIME type of the media item.
|
|
180
|
+
- `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
|
|
181
|
+
- `id`: - Optional id for the media item. If not provided, a UUID will be generated.
|
|
182
|
+
- `name`: - Name of the media item.
|
|
183
|
+
- `mimeType`: - MIME type of the media item.
|
|
184
|
+
- `content`: - Content as Blob.
|
|
185
|
+
- `name`: - Name of the media item.
|
|
186
|
+
- `mimeType`: - MIME type of the media item.
|
|
187
|
+
- `content`: - Content as base64 string or binary string.
|
|
188
|
+
- `name`: - Name of the media item.
|
|
189
|
+
- `mimeType`: - MIME type of the media item.
|
|
190
|
+
- `content`: - Content as ArrayBuffer.
|
|
194
191
|
|
|
195
192
|
Returns:
|
|
196
193
|
|
|
@@ -200,26 +197,25 @@ MediaItem object with blobUrl generated from the content.
|
|
|
200
197
|
|
|
201
198
|
Creates a MediaItem from the provided parameters and content.
|
|
202
199
|
|
|
203
|
-
| Function
|
|
204
|
-
|
|
|
200
|
+
| Function | Type |
|
|
201
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
205
202
|
| `createMediaItem` | `{ (name: string, mimeType: string, content: File): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: Blob): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: string): { ...; }; (name: string, mimeType:...` |
|
|
206
203
|
|
|
207
204
|
Parameters:
|
|
208
205
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
206
|
+
- `name`: - Name of the media item.
|
|
207
|
+
- `mimeType`: - MIME type of the media item.
|
|
208
|
+
- `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
|
|
209
|
+
- `id`: - Optional id for the media item. If not provided, a UUID will be generated.
|
|
210
|
+
- `name`: - Name of the media item.
|
|
211
|
+
- `mimeType`: - MIME type of the media item.
|
|
212
|
+
- `content`: - Content as Blob.
|
|
213
|
+
- `name`: - Name of the media item.
|
|
214
|
+
- `mimeType`: - MIME type of the media item.
|
|
215
|
+
- `content`: - Content as base64 string or binary string.
|
|
216
|
+
- `name`: - Name of the media item.
|
|
217
|
+
- `mimeType`: - MIME type of the media item.
|
|
218
|
+
- `content`: - Content as ArrayBuffer.
|
|
223
219
|
|
|
224
220
|
Returns:
|
|
225
221
|
|
|
@@ -229,26 +225,25 @@ MediaItem object with blobUrl generated from the content.
|
|
|
229
225
|
|
|
230
226
|
Creates a MediaItem from the provided parameters and content.
|
|
231
227
|
|
|
232
|
-
| Function
|
|
233
|
-
|
|
|
228
|
+
| Function | Type |
|
|
229
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
234
230
|
| `createMediaItem` | `{ (name: string, mimeType: string, content: File): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: Blob): { id: string; name: string; mimeType: string; blobUrl: string; }; (name: string, mimeType: string, content: string): { ...; }; (name: string, mimeType:...` |
|
|
235
231
|
|
|
236
232
|
Parameters:
|
|
237
233
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
234
|
+
- `name`: - Name of the media item.
|
|
235
|
+
- `mimeType`: - MIME type of the media item.
|
|
236
|
+
- `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
|
|
237
|
+
- `id`: - Optional id for the media item. If not provided, a UUID will be generated.
|
|
238
|
+
- `name`: - Name of the media item.
|
|
239
|
+
- `mimeType`: - MIME type of the media item.
|
|
240
|
+
- `content`: - Content as Blob.
|
|
241
|
+
- `name`: - Name of the media item.
|
|
242
|
+
- `mimeType`: - MIME type of the media item.
|
|
243
|
+
- `content`: - Content as base64 string or binary string.
|
|
244
|
+
- `name`: - Name of the media item.
|
|
245
|
+
- `mimeType`: - MIME type of the media item.
|
|
246
|
+
- `content`: - Content as ArrayBuffer.
|
|
252
247
|
|
|
253
248
|
Returns:
|
|
254
249
|
|
|
@@ -258,21 +253,20 @@ MediaItem object with blobUrl generated from the content.
|
|
|
258
253
|
|
|
259
254
|
Updates a MediaItem with the provided changes.
|
|
260
255
|
|
|
261
|
-
| Function
|
|
262
|
-
|
|
|
256
|
+
| Function | Type |
|
|
257
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
263
258
|
| `updateMediaItem` | `{ (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { content: File; }): { id: string; name: string; mimeType: string; blobUrl: string; }; (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { ...; }): { ...; }; (mediaItem: { ...; }, updates: { ...` |
|
|
264
259
|
|
|
265
260
|
Parameters:
|
|
266
261
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
262
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
263
|
+
- `updates`: - Object containing properties to update (name, mimeType, content).
|
|
264
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
265
|
+
- `updates`: - Object containing content as Blob.
|
|
266
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
267
|
+
- `updates`: - Object containing content as base64 string or binary string.
|
|
268
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
269
|
+
- `updates`: - Object containing content as ArrayBuffer.
|
|
276
270
|
|
|
277
271
|
Returns:
|
|
278
272
|
|
|
@@ -282,21 +276,20 @@ Updated MediaItem object.
|
|
|
282
276
|
|
|
283
277
|
Updates a MediaItem with the provided changes.
|
|
284
278
|
|
|
285
|
-
| Function
|
|
286
|
-
|
|
|
279
|
+
| Function | Type |
|
|
280
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
287
281
|
| `updateMediaItem` | `{ (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { content: File; }): { id: string; name: string; mimeType: string; blobUrl: string; }; (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { ...; }): { ...; }; (mediaItem: { ...; }, updates: { ...` |
|
|
288
282
|
|
|
289
283
|
Parameters:
|
|
290
284
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
285
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
286
|
+
- `updates`: - Object containing properties to update (name, mimeType, content).
|
|
287
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
288
|
+
- `updates`: - Object containing content as Blob.
|
|
289
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
290
|
+
- `updates`: - Object containing content as base64 string or binary string.
|
|
291
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
292
|
+
- `updates`: - Object containing content as ArrayBuffer.
|
|
300
293
|
|
|
301
294
|
Returns:
|
|
302
295
|
|
|
@@ -306,21 +299,20 @@ Updated MediaItem object.
|
|
|
306
299
|
|
|
307
300
|
Updates a MediaItem with the provided changes.
|
|
308
301
|
|
|
309
|
-
| Function
|
|
310
|
-
|
|
|
302
|
+
| Function | Type |
|
|
303
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
311
304
|
| `updateMediaItem` | `{ (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { content: File; }): { id: string; name: string; mimeType: string; blobUrl: string; }; (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { ...; }): { ...; }; (mediaItem: { ...; }, updates: { ...` |
|
|
312
305
|
|
|
313
306
|
Parameters:
|
|
314
307
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
308
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
309
|
+
- `updates`: - Object containing properties to update (name, mimeType, content).
|
|
310
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
311
|
+
- `updates`: - Object containing content as Blob.
|
|
312
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
313
|
+
- `updates`: - Object containing content as base64 string or binary string.
|
|
314
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
315
|
+
- `updates`: - Object containing content as ArrayBuffer.
|
|
324
316
|
|
|
325
317
|
Returns:
|
|
326
318
|
|
|
@@ -330,21 +322,20 @@ Updated MediaItem object.
|
|
|
330
322
|
|
|
331
323
|
Updates a MediaItem with the provided changes.
|
|
332
324
|
|
|
333
|
-
| Function
|
|
334
|
-
|
|
|
325
|
+
| Function | Type |
|
|
326
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
335
327
|
| `updateMediaItem` | `{ (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { content: File; }): { id: string; name: string; mimeType: string; blobUrl: string; }; (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { ...; }): { ...; }; (mediaItem: { ...; }, updates: { ...` |
|
|
336
328
|
|
|
337
329
|
Parameters:
|
|
338
330
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
331
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
332
|
+
- `updates`: - Object containing properties to update (name, mimeType, content).
|
|
333
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
334
|
+
- `updates`: - Object containing content as Blob.
|
|
335
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
336
|
+
- `updates`: - Object containing content as base64 string or binary string.
|
|
337
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
338
|
+
- `updates`: - Object containing content as ArrayBuffer.
|
|
348
339
|
|
|
349
340
|
Returns:
|
|
350
341
|
|
|
@@ -354,21 +345,20 @@ Updated MediaItem object.
|
|
|
354
345
|
|
|
355
346
|
Updates a MediaItem with the provided changes.
|
|
356
347
|
|
|
357
|
-
| Function
|
|
358
|
-
|
|
|
348
|
+
| Function | Type |
|
|
349
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
359
350
|
| `updateMediaItem` | `{ (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { content: File; }): { id: string; name: string; mimeType: string; blobUrl: string; }; (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { ...; }): { ...; }; (mediaItem: { ...; }, updates: { ...` |
|
|
360
351
|
|
|
361
352
|
Parameters:
|
|
362
353
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
354
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
355
|
+
- `updates`: - Object containing properties to update (name, mimeType, content).
|
|
356
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
357
|
+
- `updates`: - Object containing content as Blob.
|
|
358
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
359
|
+
- `updates`: - Object containing content as base64 string or binary string.
|
|
360
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
361
|
+
- `updates`: - Object containing content as ArrayBuffer.
|
|
372
362
|
|
|
373
363
|
Returns:
|
|
374
364
|
|
|
@@ -378,21 +368,20 @@ Updated MediaItem object.
|
|
|
378
368
|
|
|
379
369
|
Updates a MediaItem with the provided changes.
|
|
380
370
|
|
|
381
|
-
| Function
|
|
382
|
-
|
|
|
371
|
+
| Function | Type |
|
|
372
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
383
373
|
| `updateMediaItem` | `{ (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { content: File; }): { id: string; name: string; mimeType: string; blobUrl: string; }; (mediaItem: { id: string; name: string; mimeType: string; blobUrl: string; }, updates: { ...; }): { ...; }; (mediaItem: { ...; }, updates: { ...` |
|
|
384
374
|
|
|
385
375
|
Parameters:
|
|
386
376
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
377
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
378
|
+
- `updates`: - Object containing properties to update (name, mimeType, content).
|
|
379
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
380
|
+
- `updates`: - Object containing content as Blob.
|
|
381
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
382
|
+
- `updates`: - Object containing content as base64 string or binary string.
|
|
383
|
+
- `mediaItem`: - The original MediaItem to update.
|
|
384
|
+
- `updates`: - Object containing content as ArrayBuffer.
|
|
396
385
|
|
|
397
386
|
Returns:
|
|
398
387
|
|
|
@@ -400,22 +389,22 @@ Updated MediaItem object.
|
|
|
400
389
|
|
|
401
390
|
### initOnSaveMessageHandler
|
|
402
391
|
|
|
403
|
-
| Function
|
|
404
|
-
|
|
|
392
|
+
| Function | Type |
|
|
393
|
+
| -------------------------- | ------------ |
|
|
405
394
|
| `initOnSaveMessageHandler` | `() => void` |
|
|
406
395
|
|
|
407
396
|
### removeOnSaveMessageHandler
|
|
408
397
|
|
|
409
|
-
| Function
|
|
410
|
-
|
|
|
398
|
+
| Function | Type |
|
|
399
|
+
| ---------------------------- | ------------ |
|
|
411
400
|
| `removeOnSaveMessageHandler` | `() => void` |
|
|
412
401
|
|
|
413
402
|
### getQuestionnaire
|
|
414
403
|
|
|
415
404
|
Retrieves a questionnaire on which the user is currently working.
|
|
416
405
|
|
|
417
|
-
| Function
|
|
418
|
-
|
|
|
406
|
+
| Function | Type |
|
|
407
|
+
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
419
408
|
| `getQuestionnaire` | `(options?: QpBridgeOptions or undefined) => Promise<{ id: string; name: string; isNew: boolean; label: string; items: QuestionnaireItem[]; description?: string or undefined; regarding?: { ...; } or undefined; }>` |
|
|
420
409
|
|
|
421
410
|
Returns:
|
|
@@ -423,6 +412,7 @@ Returns:
|
|
|
423
412
|
A promise that resolves to the questionnaire object.
|
|
424
413
|
|
|
425
414
|
The resolved `Questionnaire` object has the following properties:
|
|
415
|
+
|
|
426
416
|
- `isNew` — Whether the questionnaire is a new (unsaved) record.
|
|
427
417
|
- `id` — Unique identifier (UUID) of the questionnaire record.
|
|
428
418
|
- `name` — Logical questionnaire name.
|
|
@@ -440,46 +430,44 @@ console.log(questionnaire.items.map(item => item.name));
|
|
|
440
430
|
console.log(flattenQuestions(questionnaire).map(question => question.name));
|
|
441
431
|
```
|
|
442
432
|
|
|
443
|
-
|
|
444
433
|
### traverseQuestionnaireItems
|
|
445
434
|
|
|
446
435
|
Traverses the questionnaire item tree in pre-order and passes parent context to the visitor.
|
|
447
436
|
|
|
448
437
|
Repeatable groups are visited before their group instances.
|
|
449
438
|
|
|
450
|
-
| Function
|
|
451
|
-
|
|
|
439
|
+
| Function | Type |
|
|
440
|
+
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
452
441
|
| `traverseQuestionnaireItems` | `(questionnaire: { id: string; name: string; isNew: boolean; label: string; items: QuestionnaireItem[]; description?: string or undefined; regarding?: { id: string; name: string; entityName: string; } or undefined; }, visitor: QuestionnaireItemVisitor) => void` |
|
|
453
442
|
|
|
454
443
|
### flattenQuestionnaireItems
|
|
455
444
|
|
|
456
445
|
Returns every questionnaire item in tree order.
|
|
457
446
|
|
|
458
|
-
| Function
|
|
459
|
-
|
|
|
447
|
+
| Function | Type |
|
|
448
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
460
449
|
| `flattenQuestionnaireItems` | `(questionnaire: { id: string; name: string; isNew: boolean; label: string; items: QuestionnaireItem[]; description?: string or undefined; regarding?: { id: string; name: string; entityName: string; } or undefined; }) => QuestionnaireItem[]` |
|
|
461
450
|
|
|
462
451
|
### flattenQuestions
|
|
463
452
|
|
|
464
453
|
Returns every question from the questionnaire item tree in tree order.
|
|
465
454
|
|
|
466
|
-
| Function
|
|
467
|
-
|
|
|
455
|
+
| Function | Type |
|
|
456
|
+
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
468
457
|
| `flattenQuestions` | `(questionnaire: { id: string; name: string; isNew: boolean; label: string; items: QuestionnaireItem[]; description?: string or undefined; regarding?: { id: string; name: string; entityName: string; } or undefined; }) => { ...; }[]` |
|
|
469
458
|
|
|
470
459
|
### setAnswer
|
|
471
460
|
|
|
472
461
|
Sets the answer for a specific question in the questionnaire.
|
|
473
462
|
|
|
474
|
-
| Function
|
|
475
|
-
|
|
|
463
|
+
| Function | Type |
|
|
464
|
+
| ----------- | -------------------------------------------------------------------------------------------------- |
|
|
476
465
|
| `setAnswer` | `(questionName: string, answer: unknown, options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
477
466
|
|
|
478
467
|
Parameters:
|
|
479
468
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
469
|
+
- `questionName`: - Name of the question for which the answer is being set.
|
|
470
|
+
- `answer`: - The answer to set for the question. Can be any type.
|
|
483
471
|
|
|
484
472
|
Returns:
|
|
485
473
|
|
|
@@ -487,28 +475,25 @@ A promise that resolves when the answer has been successfully set.
|
|
|
487
475
|
|
|
488
476
|
References:
|
|
489
477
|
|
|
490
|
-
|
|
491
|
-
|
|
478
|
+
- onAnswerChange
|
|
492
479
|
|
|
493
480
|
Examples:
|
|
494
481
|
|
|
495
482
|
```typescript
|
|
496
|
-
await setAnswer(
|
|
483
|
+
await setAnswer("favoriteColor", "blue");
|
|
497
484
|
```
|
|
498
485
|
|
|
499
|
-
|
|
500
486
|
### getQuestion
|
|
501
487
|
|
|
502
488
|
Retrieves a question by its name from the questionnaire.
|
|
503
489
|
|
|
504
|
-
| Function
|
|
505
|
-
|
|
|
490
|
+
| Function | Type |
|
|
491
|
+
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
506
492
|
| `getQuestion` | `(name: string, options?: QpBridgeOptions or undefined) => Promise<{ label: string; description: string; disabled: boolean; required: boolean; hidden: boolean; semanticColor?: string or undefined; errorMessage?: string or undefined; answer?: unknown; }>` |
|
|
507
493
|
|
|
508
494
|
Parameters:
|
|
509
495
|
|
|
510
|
-
|
|
511
|
-
|
|
496
|
+
- `name`: - The name of the question to retrieve.
|
|
512
497
|
|
|
513
498
|
Returns:
|
|
514
499
|
|
|
@@ -517,24 +502,22 @@ A promise that resolves to the question object.
|
|
|
517
502
|
Examples:
|
|
518
503
|
|
|
519
504
|
```typescript
|
|
520
|
-
const question = await getQuestion(
|
|
505
|
+
const question = await getQuestion("favoriteColor");
|
|
521
506
|
console.log(question.label); // Outputs the label of the question
|
|
522
507
|
```
|
|
523
508
|
|
|
524
|
-
|
|
525
509
|
### setQuestion
|
|
526
510
|
|
|
527
511
|
Updates a question in the questionnaire.
|
|
528
512
|
|
|
529
|
-
| Function
|
|
530
|
-
|
|
|
513
|
+
| Function | Type |
|
|
514
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
531
515
|
| `setQuestion` | `(name: string, questionData: { label?: string or undefined; description?: string or undefined; semanticColor?: string or undefined; disabled?: boolean or undefined; required?: boolean or undefined; hidden?: boolean or undefined; errorMessage?: string or undefined; answer?: unknown; }, options?: QpBridgeOptions or undefined)...` |
|
|
532
516
|
|
|
533
517
|
Parameters:
|
|
534
518
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
519
|
+
- `name`: - The name of the question to update. This is a unique identifier and cannot be changed.
|
|
520
|
+
- `questionData`: - The updated question data excluding the name property.
|
|
538
521
|
|
|
539
522
|
Returns:
|
|
540
523
|
|
|
@@ -543,22 +526,20 @@ A promise that resolves when the question has been successfully updated.
|
|
|
543
526
|
Examples:
|
|
544
527
|
|
|
545
528
|
```typescript
|
|
546
|
-
await setQuestion(
|
|
529
|
+
await setQuestion("favoriteColor", { label: "What is your favorite color?" });
|
|
547
530
|
```
|
|
548
531
|
|
|
549
|
-
|
|
550
532
|
### getGroup
|
|
551
533
|
|
|
552
534
|
Retrieves a group by its name from the questionnaire.
|
|
553
535
|
|
|
554
|
-
| Function
|
|
555
|
-
| ---------- |
|
|
536
|
+
| Function | Type |
|
|
537
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
556
538
|
| `getGroup` | `(name: string, options?: QpBridgeOptions or undefined) => Promise<{ label: string; hidden: boolean; collapsed: boolean; }>` |
|
|
557
539
|
|
|
558
540
|
Parameters:
|
|
559
541
|
|
|
560
|
-
|
|
561
|
-
|
|
542
|
+
- `name`: - The name of the group to retrieve.
|
|
562
543
|
|
|
563
544
|
Returns:
|
|
564
545
|
|
|
@@ -567,26 +548,24 @@ A promise that resolves to the group object.
|
|
|
567
548
|
Examples:
|
|
568
549
|
|
|
569
550
|
```typescript
|
|
570
|
-
const group = await getGroup(
|
|
551
|
+
const group = await getGroup("personalInfo");
|
|
571
552
|
console.log(group.label); // Outputs the label of the group
|
|
572
553
|
console.log(group.hidden); // Outputs whether the group is hidden
|
|
573
554
|
console.log(group.collapsed); // Outputs whether the group is collapsed
|
|
574
555
|
```
|
|
575
556
|
|
|
576
|
-
|
|
577
557
|
### setGroup
|
|
578
558
|
|
|
579
559
|
Updates a group in the questionnaire.
|
|
580
560
|
|
|
581
|
-
| Function
|
|
582
|
-
| ---------- |
|
|
561
|
+
| Function | Type |
|
|
562
|
+
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
583
563
|
| `setGroup` | `(name: string, groupData: { label?: string or undefined; hidden?: boolean or undefined; collapsed?: boolean or undefined; }, options?: QpBridgeOptions or undefined) => Promise<...>` |
|
|
584
564
|
|
|
585
565
|
Parameters:
|
|
586
566
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
567
|
+
- `name`: - The name of the group to update. This is a unique identifier and cannot be changed.
|
|
568
|
+
- `groupData`: - The updated group data excluding the name property.
|
|
590
569
|
|
|
591
570
|
Returns:
|
|
592
571
|
|
|
@@ -595,51 +574,47 @@ A promise that resolves when the group has been successfully updated.
|
|
|
595
574
|
Examples:
|
|
596
575
|
|
|
597
576
|
```typescript
|
|
598
|
-
await setGroup(
|
|
577
|
+
await setGroup("personalInfo", { label: "Personal Information", hidden: false, collapsed: true });
|
|
599
578
|
```
|
|
600
579
|
|
|
601
|
-
|
|
602
580
|
### onAnswerChange
|
|
603
581
|
|
|
604
582
|
Subscribes to changes in answers for questions.
|
|
605
583
|
Calls the provided listener whenever an answer changes in the questionnaire.
|
|
606
584
|
|
|
607
|
-
| Function
|
|
608
|
-
|
|
|
585
|
+
| Function | Type |
|
|
586
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
609
587
|
| `onAnswerChange` | `(listener: (question: string, answer: unknown) => void, options?: QpBridgeOptions or undefined) => { cancelSubscription: () => void; }` |
|
|
610
588
|
|
|
611
589
|
Parameters:
|
|
612
590
|
|
|
613
|
-
|
|
614
|
-
|
|
591
|
+
- `listener`: - A function that will be called with the question name and the new answer whenever an answer changes.
|
|
615
592
|
|
|
616
593
|
Examples:
|
|
617
594
|
|
|
618
595
|
```typescript
|
|
619
|
-
import { onAnswerChange } from
|
|
596
|
+
import { onAnswerChange } from "qp-bridge";
|
|
620
597
|
const { cancelSubscription } = onAnswerChange((question, answer) => {
|
|
621
|
-
|
|
622
|
-
|
|
598
|
+
console.log(`Answer for ${question} changed to:`, answer);
|
|
599
|
+
});
|
|
623
600
|
|
|
624
601
|
// To stop listening for changes:
|
|
625
602
|
cancelSubscription();
|
|
626
603
|
```
|
|
627
604
|
|
|
628
|
-
|
|
629
605
|
### withBusyIndicator
|
|
630
606
|
|
|
631
607
|
Wraps an asynchronous action with a busy indicator in the host application.
|
|
632
608
|
Shows a loading indicator during the execution of the provided action,
|
|
633
609
|
ensuring the UI reflects the busy state appropriately.
|
|
634
610
|
|
|
635
|
-
| Function
|
|
636
|
-
|
|
|
611
|
+
| Function | Type |
|
|
612
|
+
| ------------------- | ------------------------------------------------------------------------------------- |
|
|
637
613
|
| `withBusyIndicator` | `<T>(action: () => Promise<T>, options?: QpBridgeOptions or undefined) => Promise<T>` |
|
|
638
614
|
|
|
639
615
|
Parameters:
|
|
640
616
|
|
|
641
|
-
|
|
642
|
-
|
|
617
|
+
- `action`: - A function returning a promise whose execution should be wrapped.
|
|
643
618
|
|
|
644
619
|
Returns:
|
|
645
620
|
|
|
@@ -649,20 +624,19 @@ Examples:
|
|
|
649
624
|
|
|
650
625
|
```typescript
|
|
651
626
|
const result = await withBusyIndicator(async () => {
|
|
652
|
-
await setAnswer(
|
|
653
|
-
return
|
|
627
|
+
await setAnswer("favoriteColor", "blue");
|
|
628
|
+
return "done";
|
|
654
629
|
});
|
|
655
630
|
console.log(result); // 'done'
|
|
656
631
|
```
|
|
657
632
|
|
|
658
|
-
|
|
659
633
|
### saveQuestionnaire
|
|
660
634
|
|
|
661
635
|
Saves the current questionnaire state.
|
|
662
636
|
Triggers a save operation for the questionnaire data.
|
|
663
637
|
|
|
664
|
-
| Function
|
|
665
|
-
|
|
|
638
|
+
| Function | Type |
|
|
639
|
+
| ------------------- | ----------------------------------------------------------- |
|
|
666
640
|
| `saveQuestionnaire` | `(options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
667
641
|
|
|
668
642
|
Returns:
|
|
@@ -673,17 +647,16 @@ Examples:
|
|
|
673
647
|
|
|
674
648
|
```typescript
|
|
675
649
|
await saveQuestionnaire();
|
|
676
|
-
console.log(
|
|
650
|
+
console.log("Questionnaire saved successfully");
|
|
677
651
|
```
|
|
678
652
|
|
|
679
|
-
|
|
680
653
|
### completeAndCloseQuestionnaire
|
|
681
654
|
|
|
682
655
|
Completes and closes the current questionnaire.
|
|
683
656
|
Triggers the complete and close operation for the questionnaire.
|
|
684
657
|
|
|
685
|
-
| Function
|
|
686
|
-
|
|
|
658
|
+
| Function | Type |
|
|
659
|
+
| ------------------------------- | ----------------------------------------------------------- |
|
|
687
660
|
| `completeAndCloseQuestionnaire` | `(options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
688
661
|
|
|
689
662
|
Returns:
|
|
@@ -694,23 +667,21 @@ Examples:
|
|
|
694
667
|
|
|
695
668
|
```typescript
|
|
696
669
|
await completeAndCloseQuestionnaire();
|
|
697
|
-
console.log(
|
|
670
|
+
console.log("Questionnaire completed and closed successfully");
|
|
698
671
|
```
|
|
699
672
|
|
|
700
|
-
|
|
701
673
|
### executeCustomCommand
|
|
702
674
|
|
|
703
675
|
Executes a custom command by its name.
|
|
704
676
|
Triggers the execution of any user-defined command in the questionnaire.
|
|
705
677
|
|
|
706
|
-
| Function
|
|
707
|
-
|
|
|
678
|
+
| Function | Type |
|
|
679
|
+
| ---------------------- | -------------------------------------------------------------------------------- |
|
|
708
680
|
| `executeCustomCommand` | `(commandName: string, options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
709
681
|
|
|
710
682
|
Parameters:
|
|
711
683
|
|
|
712
|
-
|
|
713
|
-
|
|
684
|
+
- `commandName`: - The name of the command to execute.
|
|
714
685
|
|
|
715
686
|
Returns:
|
|
716
687
|
|
|
@@ -719,24 +690,22 @@ A promise that resolves when the command has been successfully executed.
|
|
|
719
690
|
Examples:
|
|
720
691
|
|
|
721
692
|
```typescript
|
|
722
|
-
await executeCustomCommand(
|
|
723
|
-
console.log(
|
|
693
|
+
await executeCustomCommand("MyCustomCommand");
|
|
694
|
+
console.log("Custom command executed successfully");
|
|
724
695
|
```
|
|
725
696
|
|
|
726
|
-
|
|
727
697
|
### onQuestionnaireLoaded
|
|
728
698
|
|
|
729
699
|
Registers a handler function to be called when the questionnaire is fully loaded.
|
|
730
700
|
Useful for performing actions that depend on the questionnaire being ready.
|
|
731
701
|
|
|
732
|
-
| Function
|
|
733
|
-
|
|
|
702
|
+
| Function | Type |
|
|
703
|
+
| ----------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
734
704
|
| `onQuestionnaireLoaded` | `(handler: () => void, options?: QpBridgeOptions or undefined) => { cancelSubscription: () => void; }` |
|
|
735
705
|
|
|
736
706
|
Parameters:
|
|
737
707
|
|
|
738
|
-
|
|
739
|
-
|
|
708
|
+
- `handler`: - A function to be called when the questionnaire is loaded.
|
|
740
709
|
|
|
741
710
|
Returns:
|
|
742
711
|
|
|
@@ -745,29 +714,27 @@ An object with a `cancelSubscription` method to unregister the handler.
|
|
|
745
714
|
Examples:
|
|
746
715
|
|
|
747
716
|
```typescript
|
|
748
|
-
import { onQuestionnaireLoaded } from
|
|
717
|
+
import { onQuestionnaireLoaded } from "qp-bridge";
|
|
749
718
|
const { cancelSubscription } = onQuestionnaireLoaded(() => {
|
|
750
|
-
console.log(
|
|
719
|
+
console.log("Questionnaire is fully loaded");
|
|
751
720
|
});
|
|
752
721
|
|
|
753
722
|
// To stop listening for questionnaire load events:
|
|
754
723
|
cancelSubscription();
|
|
755
724
|
```
|
|
756
725
|
|
|
757
|
-
|
|
758
726
|
### onCommandExecuted
|
|
759
727
|
|
|
760
728
|
Registers a handler function to be called when a command is executed.
|
|
761
729
|
Useful for reacting to custom command executions within the questionnaire.
|
|
762
730
|
|
|
763
|
-
| Function
|
|
764
|
-
|
|
|
731
|
+
| Function | Type |
|
|
732
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
765
733
|
| `onCommandExecuted` | `(handler: (commandName: string) => void, options?: QpBridgeOptions or undefined) => { cancelSubscription: () => void; }` |
|
|
766
734
|
|
|
767
735
|
Parameters:
|
|
768
736
|
|
|
769
|
-
|
|
770
|
-
|
|
737
|
+
- `handler`: - A function that receives the name of the executed command.
|
|
771
738
|
|
|
772
739
|
Returns:
|
|
773
740
|
|
|
@@ -776,8 +743,8 @@ An object with a `cancelSubscription` method to unregister the handler.
|
|
|
776
743
|
Examples:
|
|
777
744
|
|
|
778
745
|
```typescript
|
|
779
|
-
import { onCommandExecuted } from
|
|
780
|
-
const { cancelSubscription } = onCommandExecuted(
|
|
746
|
+
import { onCommandExecuted } from "qp-bridge";
|
|
747
|
+
const { cancelSubscription } = onCommandExecuted(commandName => {
|
|
781
748
|
console.log(`Command executed: ${commandName}`);
|
|
782
749
|
});
|
|
783
750
|
|
|
@@ -785,20 +752,18 @@ const { cancelSubscription } = onCommandExecuted((commandName) => {
|
|
|
785
752
|
cancelSubscription();
|
|
786
753
|
```
|
|
787
754
|
|
|
788
|
-
|
|
789
755
|
### onSave
|
|
790
756
|
|
|
791
757
|
Registers a validator function to be called when a save event occurs.
|
|
792
758
|
Useful for validating data before saving the questionnaire.
|
|
793
759
|
|
|
794
|
-
| Function | Type
|
|
795
|
-
|
|
|
760
|
+
| Function | Type |
|
|
761
|
+
| -------- | ------------------------------------------------------------------------------------------------------- |
|
|
796
762
|
| `onSave` | `(validator: Validator, options?: QpBridgeOptions or undefined) => { cancelSubscription: () => void; }` |
|
|
797
763
|
|
|
798
764
|
Parameters:
|
|
799
765
|
|
|
800
|
-
|
|
801
|
-
|
|
766
|
+
- `validator`: - A function returning a Promise resolving to a boolean indicating if the save is valid.
|
|
802
767
|
|
|
803
768
|
Returns:
|
|
804
769
|
|
|
@@ -807,7 +772,7 @@ An object with a `cancelSubscription` method to unregister the validator.
|
|
|
807
772
|
Examples:
|
|
808
773
|
|
|
809
774
|
```typescript
|
|
810
|
-
import { onSave } from
|
|
775
|
+
import { onSave } from "qp-bridge";
|
|
811
776
|
const { cancelSubscription } = onSave(async () => {
|
|
812
777
|
// perform validation logic
|
|
813
778
|
return true;
|
|
@@ -817,19 +782,46 @@ const { cancelSubscription } = onSave(async () => {
|
|
|
817
782
|
cancelSubscription();
|
|
818
783
|
```
|
|
819
784
|
|
|
785
|
+
### onPostSave
|
|
786
|
+
|
|
787
|
+
Registers a handler function to be called after the questionnaire is successfully saved.
|
|
788
|
+
The handler receives the saved answer ID and the save flow waits for all handlers to finish before continuing.
|
|
789
|
+
|
|
790
|
+
| Function | Type |
|
|
791
|
+
| ------------ | ----------------------------------------------------------------------------------------------------------- |
|
|
792
|
+
| `onPostSave` | `(handler: PostSaveHandler, options?: QpBridgeOptions or undefined) => { cancelSubscription: () => void; }` |
|
|
793
|
+
|
|
794
|
+
Parameters:
|
|
795
|
+
|
|
796
|
+
- `handler`: - A function called with the saved answer ID after save.
|
|
797
|
+
|
|
798
|
+
Returns:
|
|
799
|
+
|
|
800
|
+
An object with a `cancelSubscription` method to unregister the handler.
|
|
801
|
+
|
|
802
|
+
Examples:
|
|
803
|
+
|
|
804
|
+
```typescript
|
|
805
|
+
import { onPostSave } from "qp-bridge";
|
|
806
|
+
const { cancelSubscription } = onPostSave(async answerId => {
|
|
807
|
+
// create related records and set their regarding to answerId
|
|
808
|
+
});
|
|
809
|
+
|
|
810
|
+
// To stop listening for post-save events:
|
|
811
|
+
cancelSubscription();
|
|
812
|
+
```
|
|
820
813
|
|
|
821
814
|
### fetchEntities
|
|
822
815
|
|
|
823
816
|
Fetches entities from the CRM system using the provided FetchXML query.
|
|
824
817
|
|
|
825
|
-
| Function
|
|
826
|
-
|
|
|
818
|
+
| Function | Type |
|
|
819
|
+
| --------------- | -------------------------------------------------------------------------------------------------- |
|
|
827
820
|
| `fetchEntities` | `(fetchXml: string, options?: QpBridgeOptions or undefined) => Promise<Record<string, unknown>[]>` |
|
|
828
821
|
|
|
829
822
|
Parameters:
|
|
830
823
|
|
|
831
|
-
|
|
832
|
-
|
|
824
|
+
- `fetchXml`: - The FetchXML query string to execute.
|
|
833
825
|
|
|
834
826
|
Returns:
|
|
835
827
|
|
|
@@ -848,20 +840,18 @@ const entities = await fetchEntities(fetchXml);
|
|
|
848
840
|
console.log(entities); // Array of contact entities
|
|
849
841
|
```
|
|
850
842
|
|
|
851
|
-
|
|
852
843
|
### getEntityById
|
|
853
844
|
|
|
854
845
|
Retrieves a single entity by its name and ID from the CRM system.
|
|
855
846
|
|
|
856
|
-
| Function
|
|
857
|
-
|
|
|
847
|
+
| Function | Type |
|
|
848
|
+
| --------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
858
849
|
| `getEntityById` | `(entityName: string, id: string, options?: QpBridgeOptions or undefined) => Promise<Record<string, unknown>>` |
|
|
859
850
|
|
|
860
851
|
Parameters:
|
|
861
852
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
853
|
+
- `entityName`: - The name of the entity to retrieve (e.g., "contact", "account").
|
|
854
|
+
- `id`: - The unique identifier of the entity.
|
|
865
855
|
|
|
866
856
|
Returns:
|
|
867
857
|
|
|
@@ -870,47 +860,44 @@ A promise that resolves to the entity object.
|
|
|
870
860
|
Examples:
|
|
871
861
|
|
|
872
862
|
```typescript
|
|
873
|
-
const contact = await getEntityById(
|
|
863
|
+
const contact = await getEntityById("contact", "12345678-1234-1234-1234-123456789abc");
|
|
874
864
|
console.log(contact.attributes.firstname); // Entity firstname attribute
|
|
875
865
|
```
|
|
876
866
|
|
|
877
|
-
|
|
878
867
|
### createNewEntity
|
|
879
868
|
|
|
880
869
|
Creates a new entity marker that can be enriched before saving.
|
|
881
870
|
The returned entity is flagged with `isNew` so the host can distinguish new records.
|
|
882
871
|
|
|
883
|
-
| Function
|
|
884
|
-
|
|
|
872
|
+
| Function | Type |
|
|
873
|
+
| ----------------- | ------------------------------- |
|
|
885
874
|
| `createNewEntity` | `() => Record<string, unknown>` |
|
|
886
875
|
|
|
887
876
|
### saveEntity
|
|
888
877
|
|
|
889
878
|
Persists an entity through the bridge. Supports both new and existing entities.
|
|
890
879
|
|
|
891
|
-
| Function
|
|
892
|
-
|
|
|
880
|
+
| Function | Type |
|
|
881
|
+
| ------------ | -------------------------------------------------------------------------------------------- |
|
|
893
882
|
| `saveEntity` | `(entity: Record<string, unknown>, options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
894
883
|
|
|
895
884
|
Parameters:
|
|
896
885
|
|
|
897
|
-
|
|
898
|
-
|
|
886
|
+
- `entity`: - Entity payload; include `isNew` for newly created entities.
|
|
899
887
|
|
|
900
888
|
### repeatGroup
|
|
901
889
|
|
|
902
890
|
Repeats a specific group within a repeatable group by creating a copy of the group at the specified index.
|
|
903
891
|
The parent group must be a repeatable group and the index must refer to an existing group instance.
|
|
904
892
|
|
|
905
|
-
| Function
|
|
906
|
-
|
|
|
893
|
+
| Function | Type |
|
|
894
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
907
895
|
| `repeatGroup` | `(repeatableGroupName: string, groupIndex: number, options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
908
896
|
|
|
909
897
|
Parameters:
|
|
910
898
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
899
|
+
- `repeatableGroupName`: - The name of the parent repeatable group.
|
|
900
|
+
- `groupIndex`: - The index (0-based) of the group instance to repeat.
|
|
914
901
|
|
|
915
902
|
Returns:
|
|
916
903
|
|
|
@@ -919,24 +906,22 @@ A promise that resolves when the group has been successfully repeated.
|
|
|
919
906
|
Examples:
|
|
920
907
|
|
|
921
908
|
```typescript
|
|
922
|
-
await repeatGroup(
|
|
923
|
-
console.log(
|
|
909
|
+
await repeatGroup("personalInfoRepeatable", 1);
|
|
910
|
+
console.log("Group repeated successfully");
|
|
924
911
|
```
|
|
925
912
|
|
|
926
|
-
|
|
927
913
|
### addNewGroup
|
|
928
914
|
|
|
929
915
|
Adds a new group instance to a repeatable group.
|
|
930
916
|
The specified name must refer to a repeatable group.
|
|
931
917
|
|
|
932
|
-
| Function
|
|
933
|
-
|
|
|
918
|
+
| Function | Type |
|
|
919
|
+
| ------------- | ---------------------------------------------------------------------------------------- |
|
|
934
920
|
| `addNewGroup` | `(repeatableGroupName: string, options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
935
921
|
|
|
936
922
|
Parameters:
|
|
937
923
|
|
|
938
|
-
|
|
939
|
-
|
|
924
|
+
- `repeatableGroupName`: - The name of the repeatable group to add a new instance to.
|
|
940
925
|
|
|
941
926
|
Returns:
|
|
942
927
|
|
|
@@ -945,25 +930,23 @@ A promise that resolves when the new group has been successfully added.
|
|
|
945
930
|
Examples:
|
|
946
931
|
|
|
947
932
|
```typescript
|
|
948
|
-
await addNewGroup(
|
|
949
|
-
console.log(
|
|
933
|
+
await addNewGroup("personalInfoRepeatable");
|
|
934
|
+
console.log("New group added successfully");
|
|
950
935
|
```
|
|
951
936
|
|
|
952
|
-
|
|
953
937
|
### deleteGroup
|
|
954
938
|
|
|
955
939
|
Deletes a specific group instance from a repeatable group by index.
|
|
956
940
|
The parent group must be a repeatable group and the index must refer to an existing group instance.
|
|
957
941
|
|
|
958
|
-
| Function
|
|
959
|
-
|
|
|
942
|
+
| Function | Type |
|
|
943
|
+
| ------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
960
944
|
| `deleteGroup` | `(repeatableGroupName: string, groupIndex: number, options?: QpBridgeOptions or undefined) => Promise<void>` |
|
|
961
945
|
|
|
962
946
|
Parameters:
|
|
963
947
|
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
948
|
+
- `repeatableGroupName`: - The name of the parent repeatable group.
|
|
949
|
+
- `groupIndex`: - The index (0-based) of the group instance to delete.
|
|
967
950
|
|
|
968
951
|
Returns:
|
|
969
952
|
|
|
@@ -972,11 +955,8 @@ A promise that resolves when the group has been successfully deleted.
|
|
|
972
955
|
Examples:
|
|
973
956
|
|
|
974
957
|
```typescript
|
|
975
|
-
await deleteGroup(
|
|
976
|
-
console.log(
|
|
958
|
+
await deleteGroup("personalInfoRepeatable", 1);
|
|
959
|
+
console.log("Group deleted successfully");
|
|
977
960
|
```
|
|
978
961
|
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
962
|
<!-- TSDOC_END -->
|