@resconet/qp-bridge 0.0.1-alpha.18 → 0.0.1-alpha.20

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 CHANGED
@@ -41,6 +41,18 @@ await setAnswer("numericQuestion", 42);
41
41
 
42
42
  ## Functions
43
43
 
44
+ - [createMediaItem](#createmediaitem)
45
+ - [createMediaItem](#createmediaitem)
46
+ - [createMediaItem](#createmediaitem)
47
+ - [createMediaItem](#createmediaitem)
48
+ - [createMediaItem](#createmediaitem)
49
+ - [createMediaItem](#createmediaitem)
50
+ - [updateMediaItem](#updatemediaitem)
51
+ - [updateMediaItem](#updatemediaitem)
52
+ - [updateMediaItem](#updatemediaitem)
53
+ - [updateMediaItem](#updatemediaitem)
54
+ - [updateMediaItem](#updatemediaitem)
55
+ - [updateMediaItem](#updatemediaitem)
44
56
  - [setAnswer](#setanswer)
45
57
  - [getQuestion](#getquestion)
46
58
  - [setQuestion](#setquestion)
@@ -52,6 +64,326 @@ await setAnswer("numericQuestion", 42);
52
64
  - [completeAndCloseQuestionnaire](#completeandclosequestionnaire)
53
65
  - [executeCustomCommand](#executecustomcommand)
54
66
  - [onSave](#onsave)
67
+ - [fetchEntities](#fetchentities)
68
+ - [getEntityById](#getentitybyid)
69
+
70
+ ### createMediaItem
71
+
72
+ Creates a MediaItem from the provided parameters and content.
73
+
74
+ | Function | Type |
75
+ | ---------- | ---------- |
76
+ | `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:...` |
77
+
78
+ Parameters:
79
+
80
+ * `name`: - Name of the media item.
81
+ * `mimeType`: - MIME type of the media item.
82
+ * `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
83
+ * `id`: - Optional id for the media item. If not provided, a UUID will be generated.
84
+ * `name`: - Name of the media item.
85
+ * `mimeType`: - MIME type of the media item.
86
+ * `content`: - Content as Blob.
87
+ * `name`: - Name of the media item.
88
+ * `mimeType`: - MIME type of the media item.
89
+ * `content`: - Content as base64 string or binary string.
90
+ * `name`: - Name of the media item.
91
+ * `mimeType`: - MIME type of the media item.
92
+ * `content`: - Content as ArrayBuffer.
93
+
94
+
95
+ Returns:
96
+
97
+ MediaItem object with blobUrl generated from the content.
98
+
99
+ ### createMediaItem
100
+
101
+ Creates a MediaItem from the provided parameters and content.
102
+
103
+ | Function | Type |
104
+ | ---------- | ---------- |
105
+ | `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:...` |
106
+
107
+ Parameters:
108
+
109
+ * `name`: - Name of the media item.
110
+ * `mimeType`: - MIME type of the media item.
111
+ * `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
112
+ * `id`: - Optional id for the media item. If not provided, a UUID will be generated.
113
+ * `name`: - Name of the media item.
114
+ * `mimeType`: - MIME type of the media item.
115
+ * `content`: - Content as Blob.
116
+ * `name`: - Name of the media item.
117
+ * `mimeType`: - MIME type of the media item.
118
+ * `content`: - Content as base64 string or binary string.
119
+ * `name`: - Name of the media item.
120
+ * `mimeType`: - MIME type of the media item.
121
+ * `content`: - Content as ArrayBuffer.
122
+
123
+
124
+ Returns:
125
+
126
+ MediaItem object with blobUrl generated from the content.
127
+
128
+ ### createMediaItem
129
+
130
+ Creates a MediaItem from the provided parameters and content.
131
+
132
+ | Function | Type |
133
+ | ---------- | ---------- |
134
+ | `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:...` |
135
+
136
+ Parameters:
137
+
138
+ * `name`: - Name of the media item.
139
+ * `mimeType`: - MIME type of the media item.
140
+ * `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
141
+ * `id`: - Optional id for the media item. If not provided, a UUID will be generated.
142
+ * `name`: - Name of the media item.
143
+ * `mimeType`: - MIME type of the media item.
144
+ * `content`: - Content as Blob.
145
+ * `name`: - Name of the media item.
146
+ * `mimeType`: - MIME type of the media item.
147
+ * `content`: - Content as base64 string or binary string.
148
+ * `name`: - Name of the media item.
149
+ * `mimeType`: - MIME type of the media item.
150
+ * `content`: - Content as ArrayBuffer.
151
+
152
+
153
+ Returns:
154
+
155
+ MediaItem object with blobUrl generated from the content.
156
+
157
+ ### createMediaItem
158
+
159
+ Creates a MediaItem from the provided parameters and content.
160
+
161
+ | Function | Type |
162
+ | ---------- | ---------- |
163
+ | `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:...` |
164
+
165
+ Parameters:
166
+
167
+ * `name`: - Name of the media item.
168
+ * `mimeType`: - MIME type of the media item.
169
+ * `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
170
+ * `id`: - Optional id for the media item. If not provided, a UUID will be generated.
171
+ * `name`: - Name of the media item.
172
+ * `mimeType`: - MIME type of the media item.
173
+ * `content`: - Content as Blob.
174
+ * `name`: - Name of the media item.
175
+ * `mimeType`: - MIME type of the media item.
176
+ * `content`: - Content as base64 string or binary string.
177
+ * `name`: - Name of the media item.
178
+ * `mimeType`: - MIME type of the media item.
179
+ * `content`: - Content as ArrayBuffer.
180
+
181
+
182
+ Returns:
183
+
184
+ MediaItem object with blobUrl generated from the content.
185
+
186
+ ### createMediaItem
187
+
188
+ Creates a MediaItem from the provided parameters and content.
189
+
190
+ | Function | Type |
191
+ | ---------- | ---------- |
192
+ | `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:...` |
193
+
194
+ Parameters:
195
+
196
+ * `name`: - Name of the media item.
197
+ * `mimeType`: - MIME type of the media item.
198
+ * `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
199
+ * `id`: - Optional id for the media item. If not provided, a UUID will be generated.
200
+ * `name`: - Name of the media item.
201
+ * `mimeType`: - MIME type of the media item.
202
+ * `content`: - Content as Blob.
203
+ * `name`: - Name of the media item.
204
+ * `mimeType`: - MIME type of the media item.
205
+ * `content`: - Content as base64 string or binary string.
206
+ * `name`: - Name of the media item.
207
+ * `mimeType`: - MIME type of the media item.
208
+ * `content`: - Content as ArrayBuffer.
209
+
210
+
211
+ Returns:
212
+
213
+ MediaItem object with blobUrl generated from the content.
214
+
215
+ ### createMediaItem
216
+
217
+ Creates a MediaItem from the provided parameters and content.
218
+
219
+ | Function | Type |
220
+ | ---------- | ---------- |
221
+ | `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:...` |
222
+
223
+ Parameters:
224
+
225
+ * `name`: - Name of the media item.
226
+ * `mimeType`: - MIME type of the media item.
227
+ * `content`: - Content as File, Blob, base64 string, or ArrayBuffer.
228
+ * `id`: - Optional id for the media item. If not provided, a UUID will be generated.
229
+ * `name`: - Name of the media item.
230
+ * `mimeType`: - MIME type of the media item.
231
+ * `content`: - Content as Blob.
232
+ * `name`: - Name of the media item.
233
+ * `mimeType`: - MIME type of the media item.
234
+ * `content`: - Content as base64 string or binary string.
235
+ * `name`: - Name of the media item.
236
+ * `mimeType`: - MIME type of the media item.
237
+ * `content`: - Content as ArrayBuffer.
238
+
239
+
240
+ Returns:
241
+
242
+ MediaItem object with blobUrl generated from the content.
243
+
244
+ ### updateMediaItem
245
+
246
+ Updates a MediaItem with the provided changes. If content is provided, blobUrl will be updated accordingly.
247
+
248
+ | Function | Type |
249
+ | ---------- | ---------- |
250
+ | `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: { ...` |
251
+
252
+ Parameters:
253
+
254
+ * `mediaItem`: - The original MediaItem to update.
255
+ * `updates`: - Object containing properties to update (name, mimeType, content).
256
+ * `mediaItem`: - The original MediaItem to update.
257
+ * `updates`: - Object containing content as Blob.
258
+ * `mediaItem`: - The original MediaItem to update.
259
+ * `updates`: - Object containing content as base64 string or binary string.
260
+ * `mediaItem`: - The original MediaItem to update.
261
+ * `updates`: - Object containing content as ArrayBuffer.
262
+
263
+
264
+ Returns:
265
+
266
+ Updated MediaItem object.
267
+
268
+ ### updateMediaItem
269
+
270
+ Updates a MediaItem with the provided changes. If content is provided, blobUrl will be updated accordingly.
271
+
272
+ | Function | Type |
273
+ | ---------- | ---------- |
274
+ | `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: { ...` |
275
+
276
+ Parameters:
277
+
278
+ * `mediaItem`: - The original MediaItem to update.
279
+ * `updates`: - Object containing properties to update (name, mimeType, content).
280
+ * `mediaItem`: - The original MediaItem to update.
281
+ * `updates`: - Object containing content as Blob.
282
+ * `mediaItem`: - The original MediaItem to update.
283
+ * `updates`: - Object containing content as base64 string or binary string.
284
+ * `mediaItem`: - The original MediaItem to update.
285
+ * `updates`: - Object containing content as ArrayBuffer.
286
+
287
+
288
+ Returns:
289
+
290
+ Updated MediaItem object.
291
+
292
+ ### updateMediaItem
293
+
294
+ Updates a MediaItem with the provided changes. If content is provided, blobUrl will be updated accordingly.
295
+
296
+ | Function | Type |
297
+ | ---------- | ---------- |
298
+ | `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: { ...` |
299
+
300
+ Parameters:
301
+
302
+ * `mediaItem`: - The original MediaItem to update.
303
+ * `updates`: - Object containing properties to update (name, mimeType, content).
304
+ * `mediaItem`: - The original MediaItem to update.
305
+ * `updates`: - Object containing content as Blob.
306
+ * `mediaItem`: - The original MediaItem to update.
307
+ * `updates`: - Object containing content as base64 string or binary string.
308
+ * `mediaItem`: - The original MediaItem to update.
309
+ * `updates`: - Object containing content as ArrayBuffer.
310
+
311
+
312
+ Returns:
313
+
314
+ Updated MediaItem object.
315
+
316
+ ### updateMediaItem
317
+
318
+ Updates a MediaItem with the provided changes. If content is provided, blobUrl will be updated accordingly.
319
+
320
+ | Function | Type |
321
+ | ---------- | ---------- |
322
+ | `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: { ...` |
323
+
324
+ Parameters:
325
+
326
+ * `mediaItem`: - The original MediaItem to update.
327
+ * `updates`: - Object containing properties to update (name, mimeType, content).
328
+ * `mediaItem`: - The original MediaItem to update.
329
+ * `updates`: - Object containing content as Blob.
330
+ * `mediaItem`: - The original MediaItem to update.
331
+ * `updates`: - Object containing content as base64 string or binary string.
332
+ * `mediaItem`: - The original MediaItem to update.
333
+ * `updates`: - Object containing content as ArrayBuffer.
334
+
335
+
336
+ Returns:
337
+
338
+ Updated MediaItem object.
339
+
340
+ ### updateMediaItem
341
+
342
+ Updates a MediaItem with the provided changes. If content is provided, blobUrl will be updated accordingly.
343
+
344
+ | Function | Type |
345
+ | ---------- | ---------- |
346
+ | `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: { ...` |
347
+
348
+ Parameters:
349
+
350
+ * `mediaItem`: - The original MediaItem to update.
351
+ * `updates`: - Object containing properties to update (name, mimeType, content).
352
+ * `mediaItem`: - The original MediaItem to update.
353
+ * `updates`: - Object containing content as Blob.
354
+ * `mediaItem`: - The original MediaItem to update.
355
+ * `updates`: - Object containing content as base64 string or binary string.
356
+ * `mediaItem`: - The original MediaItem to update.
357
+ * `updates`: - Object containing content as ArrayBuffer.
358
+
359
+
360
+ Returns:
361
+
362
+ Updated MediaItem object.
363
+
364
+ ### updateMediaItem
365
+
366
+ Updates a MediaItem with the provided changes. If content is provided, blobUrl will be updated accordingly.
367
+
368
+ | Function | Type |
369
+ | ---------- | ---------- |
370
+ | `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: { ...` |
371
+
372
+ Parameters:
373
+
374
+ * `mediaItem`: - The original MediaItem to update.
375
+ * `updates`: - Object containing properties to update (name, mimeType, content).
376
+ * `mediaItem`: - The original MediaItem to update.
377
+ * `updates`: - Object containing content as Blob.
378
+ * `mediaItem`: - The original MediaItem to update.
379
+ * `updates`: - Object containing content as base64 string or binary string.
380
+ * `mediaItem`: - The original MediaItem to update.
381
+ * `updates`: - Object containing content as ArrayBuffer.
382
+
383
+
384
+ Returns:
385
+
386
+ Updated MediaItem object.
55
387
 
56
388
  ### setAnswer
57
389
 
@@ -337,6 +669,63 @@ cancelSubscription();
337
669
  ```
338
670
 
339
671
 
672
+ ### fetchEntities
673
+
674
+ Fetches entities from the CRM system using the provided FetchXML query.
675
+
676
+ | Function | Type |
677
+ | ---------- | ---------- |
678
+ | `fetchEntities` | `(fetchXml: string) => Promise<{ id: string; entityName: string; attributes: Record<string, unknown>; }[]>` |
679
+
680
+ Parameters:
681
+
682
+ * `fetchXml`: - The FetchXML query string to execute.
683
+
684
+
685
+ Returns:
686
+
687
+ A promise that resolves to an array of entities.
688
+
689
+ Examples:
690
+
691
+ ```typescript
692
+ const fetchXml = `<fetch top="10">
693
+ <entity name="contact">
694
+ <attribute name="firstname" />
695
+ <attribute name="lastname" />
696
+ </entity>
697
+ </fetch>`;
698
+ const entities = await fetchEntities(fetchXml);
699
+ console.log(entities); // Array of contact entities
700
+ ```
701
+
702
+
703
+ ### getEntityById
704
+
705
+ Retrieves a single entity by its name and ID from the CRM system.
706
+
707
+ | Function | Type |
708
+ | ---------- | ---------- |
709
+ | `getEntityById` | `(entityName: string, id: string) => Promise<{ id: string; entityName: string; attributes: Record<string, unknown>; }>` |
710
+
711
+ Parameters:
712
+
713
+ * `entityName`: - The name of the entity to retrieve (e.g., "contact", "account").
714
+ * `id`: - The unique identifier of the entity.
715
+
716
+
717
+ Returns:
718
+
719
+ A promise that resolves to the entity object.
720
+
721
+ Examples:
722
+
723
+ ```typescript
724
+ const contact = await getEntityById('contact', '12345678-1234-1234-1234-123456789abc');
725
+ console.log(contact.attributes.firstname); // Entity firstname attribute
726
+ ```
727
+
728
+
340
729
 
341
730
 
342
731
  <!-- TSDOC_END -->