@salesforce/lds-adapters-sfap-einstein-ai-gateway 1.250.0

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.
Files changed (37) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sfap-einstein-ai-gateway.js +1023 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/getGenerations.d.ts +39 -0
  5. package/dist/es/es2018/types/src/generated/adapters/registerFeedback.d.ts +21 -0
  6. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +4 -0
  8. package/dist/es/es2018/types/src/generated/resources/postAiGptV1Feedback.d.ts +20 -0
  9. package/dist/es/es2018/types/src/generated/resources/postAiGptV1Generations.d.ts +29 -0
  10. package/dist/es/es2018/types/src/generated/types/ChatMessage.d.ts +43 -0
  11. package/dist/es/es2018/types/src/generated/types/ConversationalMemorySettings.d.ts +31 -0
  12. package/dist/es/es2018/types/src/generated/types/Error.d.ts +28 -0
  13. package/dist/es/es2018/types/src/generated/types/FeedbackErrorRepresentation.d.ts +28 -0
  14. package/dist/es/es2018/types/src/generated/types/FeedbackRequest.d.ts +43 -0
  15. package/dist/es/es2018/types/src/generated/types/FeedbackResponse202Representation.d.ts +28 -0
  16. package/dist/es/es2018/types/src/generated/types/FeedbackResponseRepresentation.d.ts +38 -0
  17. package/dist/es/es2018/types/src/generated/types/GenerationDetails.d.ts +32 -0
  18. package/dist/es/es2018/types/src/generated/types/GenerationRequest.d.ts +58 -0
  19. package/dist/es/es2018/types/src/generated/types/GenerationResponse.d.ts +38 -0
  20. package/dist/es/es2018/types/src/generated/types/GenerationResponseGenerations.d.ts +37 -0
  21. package/dist/es/es2018/types/src/generated/types/GenerationSettings.d.ts +46 -0
  22. package/dist/es/es2018/types/src/generated/types/GenerationsErrorRepresentation.d.ts +28 -0
  23. package/dist/es/es2018/types/src/generated/types/HyperLink.d.ts +28 -0
  24. package/dist/es/es2018/types/src/generated/types/LLMProviderDetails.d.ts +43 -0
  25. package/dist/es/es2018/types/src/generated/types/LLMProviderResponse.d.ts +31 -0
  26. package/dist/es/es2018/types/src/generated/types/Links.d.ts +32 -0
  27. package/dist/es/es2018/types/src/generated/types/ModelResponse.d.ts +31 -0
  28. package/dist/es/es2018/types/src/generated/types/PluginGenerationRequest.d.ts +25 -0
  29. package/dist/es/es2018/types/src/generated/types/PluginGenerationResponse.d.ts +25 -0
  30. package/dist/es/es2018/types/src/generated/types/SafetyCategoryScores.d.ts +39 -0
  31. package/dist/es/es2018/types/src/generated/types/SafetyScoreRepresentation.d.ts +31 -0
  32. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  33. package/package.json +66 -0
  34. package/sfdc/index.d.ts +1 -0
  35. package/sfdc/index.js +1062 -0
  36. package/src/raml/api.raml +717 -0
  37. package/src/raml/luvio.raml +27 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1062 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /* *******************************************************************************************
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, typeCheckConfig as typeCheckConfig$2, StoreKeyMap, createResourceParams as createResourceParams$2 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
+ const { stringify: JSONStringify } = JSON;
22
+ const { isArray: ArrayIsArray$1 } = Array;
23
+ /**
24
+ * Validates an adapter config is well-formed.
25
+ * @param config The config to validate.
26
+ * @param adapter The adapter validation configuration.
27
+ * @param oneOf The keys the config must contain at least one of.
28
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
29
+ */
30
+ function validateConfig(config, adapter, oneOf) {
31
+ const { displayName } = adapter;
32
+ const { required, optional, unsupported } = adapter.parameters;
33
+ if (config === undefined ||
34
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
35
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
36
+ }
37
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
38
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
39
+ }
40
+ if (unsupported !== undefined &&
41
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
42
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
43
+ }
44
+ const supported = required.concat(optional);
45
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
46
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
47
+ }
48
+ }
49
+ function untrustedIsObject(untrusted) {
50
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
51
+ }
52
+ function areRequiredParametersPresent(config, configPropertyNames) {
53
+ return configPropertyNames.parameters.required.every(req => req in config);
54
+ }
55
+ const snapshotRefreshOptions = {
56
+ overrides: {
57
+ headers: {
58
+ 'Cache-Control': 'no-cache',
59
+ },
60
+ }
61
+ };
62
+ /**
63
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
64
+ * This is needed because insertion order for JSON.stringify(object) affects output:
65
+ * JSON.stringify({a: 1, b: 2})
66
+ * "{"a":1,"b":2}"
67
+ * JSON.stringify({b: 2, a: 1})
68
+ * "{"b":2,"a":1}"
69
+ * @param data Data to be JSON-stringified.
70
+ * @returns JSON.stringified value with consistent ordering of keys.
71
+ */
72
+ function stableJSONStringify(node) {
73
+ // This is for Date values.
74
+ if (node && node.toJSON && typeof node.toJSON === 'function') {
75
+ // eslint-disable-next-line no-param-reassign
76
+ node = node.toJSON();
77
+ }
78
+ if (node === undefined) {
79
+ return;
80
+ }
81
+ if (typeof node === 'number') {
82
+ return isFinite(node) ? '' + node : 'null';
83
+ }
84
+ if (typeof node !== 'object') {
85
+ return JSONStringify(node);
86
+ }
87
+ let i;
88
+ let out;
89
+ if (ArrayIsArray$1(node)) {
90
+ out = '[';
91
+ for (i = 0; i < node.length; i++) {
92
+ if (i) {
93
+ out += ',';
94
+ }
95
+ out += stableJSONStringify(node[i]) || 'null';
96
+ }
97
+ return out + ']';
98
+ }
99
+ if (node === null) {
100
+ return 'null';
101
+ }
102
+ const keys = ObjectKeys(node).sort();
103
+ out = '';
104
+ for (i = 0; i < keys.length; i++) {
105
+ const key = keys[i];
106
+ const value = stableJSONStringify(node[key]);
107
+ if (!value) {
108
+ continue;
109
+ }
110
+ if (out) {
111
+ out += ',';
112
+ }
113
+ out += JSONStringify(key) + ':' + value;
114
+ }
115
+ return '{' + out + '}';
116
+ }
117
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
118
+ return {
119
+ name,
120
+ required,
121
+ resourceType,
122
+ typeCheckShape,
123
+ isArrayShape,
124
+ coerceFn,
125
+ };
126
+ }
127
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
128
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
129
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
130
+ return {
131
+ displayName,
132
+ parameters: {
133
+ required,
134
+ optional,
135
+ }
136
+ };
137
+ }
138
+ const keyPrefix = 'einstein-ai-gateway';
139
+
140
+ const { isArray: ArrayIsArray } = Array;
141
+ function equalsArray(a, b, equalsItem) {
142
+ const aLength = a.length;
143
+ const bLength = b.length;
144
+ if (aLength !== bLength) {
145
+ return false;
146
+ }
147
+ for (let i = 0; i < aLength; i++) {
148
+ if (equalsItem(a[i], b[i]) === false) {
149
+ return false;
150
+ }
151
+ }
152
+ return true;
153
+ }
154
+ function createLink(ref) {
155
+ return {
156
+ __ref: serializeStructuredKey(ref),
157
+ };
158
+ }
159
+
160
+ const VERSION$4 = "647dd4ada228e1c62a79f1cdb4e44377";
161
+ function validate$4(obj, path = 'SafetyCategoryScores') {
162
+ const v_error = (() => {
163
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
164
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
165
+ }
166
+ if (obj.hate !== undefined) {
167
+ const obj_hate = obj.hate;
168
+ const path_hate = path + '.hate';
169
+ if (typeof obj_hate !== 'number') {
170
+ return new TypeError('Expected "number" but received "' + typeof obj_hate + '" (at "' + path_hate + '")');
171
+ }
172
+ }
173
+ if (obj.identity !== undefined) {
174
+ const obj_identity = obj.identity;
175
+ const path_identity = path + '.identity';
176
+ if (typeof obj_identity !== 'number') {
177
+ return new TypeError('Expected "number" but received "' + typeof obj_identity + '" (at "' + path_identity + '")');
178
+ }
179
+ }
180
+ if (obj.physical !== undefined) {
181
+ const obj_physical = obj.physical;
182
+ const path_physical = path + '.physical';
183
+ if (typeof obj_physical !== 'number') {
184
+ return new TypeError('Expected "number" but received "' + typeof obj_physical + '" (at "' + path_physical + '")');
185
+ }
186
+ }
187
+ if (obj.profanity !== undefined) {
188
+ const obj_profanity = obj.profanity;
189
+ const path_profanity = path + '.profanity';
190
+ if (typeof obj_profanity !== 'number') {
191
+ return new TypeError('Expected "number" but received "' + typeof obj_profanity + '" (at "' + path_profanity + '")');
192
+ }
193
+ }
194
+ if (obj.sexual !== undefined) {
195
+ const obj_sexual = obj.sexual;
196
+ const path_sexual = path + '.sexual';
197
+ if (typeof obj_sexual !== 'number') {
198
+ return new TypeError('Expected "number" but received "' + typeof obj_sexual + '" (at "' + path_sexual + '")');
199
+ }
200
+ }
201
+ if (obj.toxicity !== undefined) {
202
+ const obj_toxicity = obj.toxicity;
203
+ const path_toxicity = path + '.toxicity';
204
+ if (typeof obj_toxicity !== 'number') {
205
+ return new TypeError('Expected "number" but received "' + typeof obj_toxicity + '" (at "' + path_toxicity + '")');
206
+ }
207
+ }
208
+ if (obj.violence !== undefined) {
209
+ const obj_violence = obj.violence;
210
+ const path_violence = path + '.violence';
211
+ if (typeof obj_violence !== 'number') {
212
+ return new TypeError('Expected "number" but received "' + typeof obj_violence + '" (at "' + path_violence + '")');
213
+ }
214
+ }
215
+ })();
216
+ return v_error === undefined ? null : v_error;
217
+ }
218
+ const select$6 = function SafetyCategoryScoresSelect() {
219
+ return {
220
+ kind: 'Fragment',
221
+ version: VERSION$4,
222
+ private: [],
223
+ selections: [
224
+ {
225
+ name: 'hate',
226
+ kind: 'Scalar',
227
+ required: false
228
+ },
229
+ {
230
+ name: 'identity',
231
+ kind: 'Scalar',
232
+ required: false
233
+ },
234
+ {
235
+ name: 'physical',
236
+ kind: 'Scalar',
237
+ required: false
238
+ },
239
+ {
240
+ name: 'profanity',
241
+ kind: 'Scalar',
242
+ required: false
243
+ },
244
+ {
245
+ name: 'sexual',
246
+ kind: 'Scalar',
247
+ required: false
248
+ },
249
+ {
250
+ name: 'toxicity',
251
+ kind: 'Scalar',
252
+ required: false
253
+ },
254
+ {
255
+ name: 'violence',
256
+ kind: 'Scalar',
257
+ required: false
258
+ }
259
+ ]
260
+ };
261
+ };
262
+ function equals$4(existing, incoming) {
263
+ const existing_hate = existing.hate;
264
+ const incoming_hate = incoming.hate;
265
+ // if at least one of these optionals is defined
266
+ if (existing_hate !== undefined || incoming_hate !== undefined) {
267
+ // if one of these is not defined we know the other is defined and therefore
268
+ // not equal
269
+ if (existing_hate === undefined || incoming_hate === undefined) {
270
+ return false;
271
+ }
272
+ if (!(existing_hate === incoming_hate)) {
273
+ return false;
274
+ }
275
+ }
276
+ const existing_identity = existing.identity;
277
+ const incoming_identity = incoming.identity;
278
+ // if at least one of these optionals is defined
279
+ if (existing_identity !== undefined || incoming_identity !== undefined) {
280
+ // if one of these is not defined we know the other is defined and therefore
281
+ // not equal
282
+ if (existing_identity === undefined || incoming_identity === undefined) {
283
+ return false;
284
+ }
285
+ if (!(existing_identity === incoming_identity)) {
286
+ return false;
287
+ }
288
+ }
289
+ const existing_physical = existing.physical;
290
+ const incoming_physical = incoming.physical;
291
+ // if at least one of these optionals is defined
292
+ if (existing_physical !== undefined || incoming_physical !== undefined) {
293
+ // if one of these is not defined we know the other is defined and therefore
294
+ // not equal
295
+ if (existing_physical === undefined || incoming_physical === undefined) {
296
+ return false;
297
+ }
298
+ if (!(existing_physical === incoming_physical)) {
299
+ return false;
300
+ }
301
+ }
302
+ const existing_profanity = existing.profanity;
303
+ const incoming_profanity = incoming.profanity;
304
+ // if at least one of these optionals is defined
305
+ if (existing_profanity !== undefined || incoming_profanity !== undefined) {
306
+ // if one of these is not defined we know the other is defined and therefore
307
+ // not equal
308
+ if (existing_profanity === undefined || incoming_profanity === undefined) {
309
+ return false;
310
+ }
311
+ if (!(existing_profanity === incoming_profanity)) {
312
+ return false;
313
+ }
314
+ }
315
+ const existing_sexual = existing.sexual;
316
+ const incoming_sexual = incoming.sexual;
317
+ // if at least one of these optionals is defined
318
+ if (existing_sexual !== undefined || incoming_sexual !== undefined) {
319
+ // if one of these is not defined we know the other is defined and therefore
320
+ // not equal
321
+ if (existing_sexual === undefined || incoming_sexual === undefined) {
322
+ return false;
323
+ }
324
+ if (!(existing_sexual === incoming_sexual)) {
325
+ return false;
326
+ }
327
+ }
328
+ const existing_toxicity = existing.toxicity;
329
+ const incoming_toxicity = incoming.toxicity;
330
+ // if at least one of these optionals is defined
331
+ if (existing_toxicity !== undefined || incoming_toxicity !== undefined) {
332
+ // if one of these is not defined we know the other is defined and therefore
333
+ // not equal
334
+ if (existing_toxicity === undefined || incoming_toxicity === undefined) {
335
+ return false;
336
+ }
337
+ if (!(existing_toxicity === incoming_toxicity)) {
338
+ return false;
339
+ }
340
+ }
341
+ const existing_violence = existing.violence;
342
+ const incoming_violence = incoming.violence;
343
+ // if at least one of these optionals is defined
344
+ if (existing_violence !== undefined || incoming_violence !== undefined) {
345
+ // if one of these is not defined we know the other is defined and therefore
346
+ // not equal
347
+ if (existing_violence === undefined || incoming_violence === undefined) {
348
+ return false;
349
+ }
350
+ if (!(existing_violence === incoming_violence)) {
351
+ return false;
352
+ }
353
+ }
354
+ return true;
355
+ }
356
+
357
+ const VERSION$3 = "16253d7587aa43b19fae0671874a0667";
358
+ function validate$3(obj, path = 'SafetyScoreRepresentation') {
359
+ const v_error = (() => {
360
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
361
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
362
+ }
363
+ if (obj.category_scores !== undefined) {
364
+ const obj_category_scores = obj.category_scores;
365
+ const path_category_scores = path + '.category_scores';
366
+ const referencepath_category_scoresValidationError = validate$4(obj_category_scores, path_category_scores);
367
+ if (referencepath_category_scoresValidationError !== null) {
368
+ let message = 'Object doesn\'t match SafetyCategoryScores (at "' + path_category_scores + '")\n';
369
+ message += referencepath_category_scoresValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
370
+ return new TypeError(message);
371
+ }
372
+ }
373
+ if (obj.safety_score !== undefined) {
374
+ const obj_safety_score = obj.safety_score;
375
+ const path_safety_score = path + '.safety_score';
376
+ if (typeof obj_safety_score !== 'number') {
377
+ return new TypeError('Expected "number" but received "' + typeof obj_safety_score + '" (at "' + path_safety_score + '")');
378
+ }
379
+ }
380
+ })();
381
+ return v_error === undefined ? null : v_error;
382
+ }
383
+ const select$5 = function SafetyScoreRepresentationSelect() {
384
+ const { selections: SafetyCategoryScores__selections, opaque: SafetyCategoryScores__opaque, } = select$6();
385
+ return {
386
+ kind: 'Fragment',
387
+ version: VERSION$3,
388
+ private: [],
389
+ selections: [
390
+ {
391
+ name: 'category_scores',
392
+ kind: 'Object',
393
+ selections: SafetyCategoryScores__selections,
394
+ required: false
395
+ },
396
+ {
397
+ name: 'safety_score',
398
+ kind: 'Scalar',
399
+ required: false
400
+ }
401
+ ]
402
+ };
403
+ };
404
+ function equals$3(existing, incoming) {
405
+ const existing_safety_score = existing.safety_score;
406
+ const incoming_safety_score = incoming.safety_score;
407
+ // if at least one of these optionals is defined
408
+ if (existing_safety_score !== undefined || incoming_safety_score !== undefined) {
409
+ // if one of these is not defined we know the other is defined and therefore
410
+ // not equal
411
+ if (existing_safety_score === undefined || incoming_safety_score === undefined) {
412
+ return false;
413
+ }
414
+ if (!(existing_safety_score === incoming_safety_score)) {
415
+ return false;
416
+ }
417
+ }
418
+ const existing_category_scores = existing.category_scores;
419
+ const incoming_category_scores = incoming.category_scores;
420
+ // if at least one of these optionals is defined
421
+ if (existing_category_scores !== undefined || incoming_category_scores !== undefined) {
422
+ // if one of these is not defined we know the other is defined and therefore
423
+ // not equal
424
+ if (existing_category_scores === undefined || incoming_category_scores === undefined) {
425
+ return false;
426
+ }
427
+ if (!(equals$4(existing_category_scores, incoming_category_scores))) {
428
+ return false;
429
+ }
430
+ }
431
+ return true;
432
+ }
433
+
434
+ const VERSION$2 = "d8d7906c67f7e6b5d9e80f599c4cb47f";
435
+ function validate$2(obj, path = 'GenerationResponseGenerations') {
436
+ const v_error = (() => {
437
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
438
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
439
+ }
440
+ if (obj.generation_safety_score !== undefined) {
441
+ const obj_generation_safety_score = obj.generation_safety_score;
442
+ const path_generation_safety_score = path + '.generation_safety_score';
443
+ const referencepath_generation_safety_scoreValidationError = validate$3(obj_generation_safety_score, path_generation_safety_score);
444
+ if (referencepath_generation_safety_scoreValidationError !== null) {
445
+ let message = 'Object doesn\'t match SafetyScoreRepresentation (at "' + path_generation_safety_score + '")\n';
446
+ message += referencepath_generation_safety_scoreValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
447
+ return new TypeError(message);
448
+ }
449
+ }
450
+ if (obj.id !== undefined) {
451
+ const obj_id = obj.id;
452
+ const path_id = path + '.id';
453
+ if (typeof obj_id !== 'string') {
454
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
455
+ }
456
+ }
457
+ if (obj.parameters !== undefined) {
458
+ const obj_parameters = obj.parameters;
459
+ const path_parameters = path + '.parameters';
460
+ if (typeof obj_parameters !== 'object' || ArrayIsArray(obj_parameters) || obj_parameters === null) {
461
+ return new TypeError('Expected "object" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
462
+ }
463
+ }
464
+ const obj_text = obj.text;
465
+ const path_text = path + '.text';
466
+ if (typeof obj_text !== 'string') {
467
+ return new TypeError('Expected "string" but received "' + typeof obj_text + '" (at "' + path_text + '")');
468
+ }
469
+ })();
470
+ return v_error === undefined ? null : v_error;
471
+ }
472
+ const select$4 = function GenerationResponseGenerationsSelect() {
473
+ const { selections: SafetyScoreRepresentation__selections, opaque: SafetyScoreRepresentation__opaque, } = select$5();
474
+ return {
475
+ kind: 'Fragment',
476
+ version: VERSION$2,
477
+ private: [],
478
+ selections: [
479
+ {
480
+ name: 'generation_safety_score',
481
+ kind: 'Object',
482
+ selections: SafetyScoreRepresentation__selections,
483
+ required: false
484
+ },
485
+ {
486
+ name: 'id',
487
+ kind: 'Scalar',
488
+ required: false
489
+ },
490
+ {
491
+ name: 'text',
492
+ kind: 'Scalar'
493
+ }
494
+ ]
495
+ };
496
+ };
497
+ function equals$2(existing, incoming) {
498
+ const existing_id = existing.id;
499
+ const incoming_id = incoming.id;
500
+ // if at least one of these optionals is defined
501
+ if (existing_id !== undefined || incoming_id !== undefined) {
502
+ // if one of these is not defined we know the other is defined and therefore
503
+ // not equal
504
+ if (existing_id === undefined || incoming_id === undefined) {
505
+ return false;
506
+ }
507
+ if (!(existing_id === incoming_id)) {
508
+ return false;
509
+ }
510
+ }
511
+ const existing_text = existing.text;
512
+ const incoming_text = incoming.text;
513
+ if (!(existing_text === incoming_text)) {
514
+ return false;
515
+ }
516
+ const existing_generation_safety_score = existing.generation_safety_score;
517
+ const incoming_generation_safety_score = incoming.generation_safety_score;
518
+ // if at least one of these optionals is defined
519
+ if (existing_generation_safety_score !== undefined || incoming_generation_safety_score !== undefined) {
520
+ // if one of these is not defined we know the other is defined and therefore
521
+ // not equal
522
+ if (existing_generation_safety_score === undefined || incoming_generation_safety_score === undefined) {
523
+ return false;
524
+ }
525
+ if (!(equals$3(existing_generation_safety_score, incoming_generation_safety_score))) {
526
+ return false;
527
+ }
528
+ }
529
+ const existing_parameters = existing.parameters;
530
+ const incoming_parameters = incoming.parameters;
531
+ // if at least one of these optionals is defined
532
+ if (existing_parameters !== undefined || incoming_parameters !== undefined) {
533
+ // if one of these is not defined we know the other is defined and therefore
534
+ // not equal
535
+ if (existing_parameters === undefined || incoming_parameters === undefined) {
536
+ return false;
537
+ }
538
+ }
539
+ return true;
540
+ }
541
+
542
+ const VERSION$1 = "31470ce89388a2c22a9c6a5a8a898945";
543
+ function validate$1(obj, path = 'GenerationResponse') {
544
+ const v_error = (() => {
545
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
546
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
547
+ }
548
+ const obj_generations = obj.generations;
549
+ const path_generations = path + '.generations';
550
+ if (!ArrayIsArray(obj_generations)) {
551
+ return new TypeError('Expected "array" but received "' + typeof obj_generations + '" (at "' + path_generations + '")');
552
+ }
553
+ for (let i = 0; i < obj_generations.length; i++) {
554
+ const obj_generations_item = obj_generations[i];
555
+ const path_generations_item = path_generations + '[' + i + ']';
556
+ const referencepath_generations_itemValidationError = validate$2(obj_generations_item, path_generations_item);
557
+ if (referencepath_generations_itemValidationError !== null) {
558
+ let message = 'Object doesn\'t match GenerationResponseGenerations (at "' + path_generations_item + '")\n';
559
+ message += referencepath_generations_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
560
+ return new TypeError(message);
561
+ }
562
+ }
563
+ const obj_id = obj.id;
564
+ const path_id = path + '.id';
565
+ if (typeof obj_id !== 'string') {
566
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
567
+ }
568
+ if (obj.parameters !== undefined) {
569
+ const obj_parameters = obj.parameters;
570
+ const path_parameters = path + '.parameters';
571
+ if (typeof obj_parameters !== 'object' || ArrayIsArray(obj_parameters) || obj_parameters === null) {
572
+ return new TypeError('Expected "object" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
573
+ }
574
+ }
575
+ if (obj.prompt !== undefined) {
576
+ const obj_prompt = obj.prompt;
577
+ const path_prompt = path + '.prompt';
578
+ let obj_prompt_union0 = null;
579
+ const obj_prompt_union0_error = (() => {
580
+ if (typeof obj_prompt !== 'string') {
581
+ return new TypeError('Expected "string" but received "' + typeof obj_prompt + '" (at "' + path_prompt + '")');
582
+ }
583
+ })();
584
+ if (obj_prompt_union0_error != null) {
585
+ obj_prompt_union0 = obj_prompt_union0_error.message;
586
+ }
587
+ let obj_prompt_union1 = null;
588
+ const obj_prompt_union1_error = (() => {
589
+ if (obj_prompt !== null) {
590
+ return new TypeError('Expected "null" but received "' + typeof obj_prompt + '" (at "' + path_prompt + '")');
591
+ }
592
+ })();
593
+ if (obj_prompt_union1_error != null) {
594
+ obj_prompt_union1 = obj_prompt_union1_error.message;
595
+ }
596
+ if (obj_prompt_union0 && obj_prompt_union1) {
597
+ let message = 'Object doesn\'t match union (at "' + path_prompt + '")';
598
+ message += '\n' + obj_prompt_union0.split('\n').map((line) => '\t' + line).join('\n');
599
+ message += '\n' + obj_prompt_union1.split('\n').map((line) => '\t' + line).join('\n');
600
+ return new TypeError(message);
601
+ }
602
+ }
603
+ })();
604
+ return v_error === undefined ? null : v_error;
605
+ }
606
+ const RepresentationType$1 = 'GenerationResponse';
607
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
608
+ return input;
609
+ }
610
+ const select$3 = function GenerationResponseSelect() {
611
+ const { selections: GenerationResponseGenerations__selections, opaque: GenerationResponseGenerations__opaque, } = select$4();
612
+ return {
613
+ kind: 'Fragment',
614
+ version: VERSION$1,
615
+ private: [],
616
+ selections: [
617
+ {
618
+ name: 'generations',
619
+ kind: 'Object',
620
+ plural: true,
621
+ selections: GenerationResponseGenerations__selections
622
+ },
623
+ {
624
+ name: 'id',
625
+ kind: 'Scalar'
626
+ },
627
+ {
628
+ name: 'prompt',
629
+ kind: 'Scalar',
630
+ required: false
631
+ }
632
+ ]
633
+ };
634
+ };
635
+ function equals$1(existing, incoming) {
636
+ const existing_id = existing.id;
637
+ const incoming_id = incoming.id;
638
+ if (!(existing_id === incoming_id)) {
639
+ return false;
640
+ }
641
+ const existing_generations = existing.generations;
642
+ const incoming_generations = incoming.generations;
643
+ const equals_generations_items = equalsArray(existing_generations, incoming_generations, (existing_generations_item, incoming_generations_item) => {
644
+ if (!(equals$2(existing_generations_item, incoming_generations_item))) {
645
+ return false;
646
+ }
647
+ });
648
+ if (equals_generations_items === false) {
649
+ return false;
650
+ }
651
+ const existing_parameters = existing.parameters;
652
+ const incoming_parameters = incoming.parameters;
653
+ // if at least one of these optionals is defined
654
+ if (existing_parameters !== undefined || incoming_parameters !== undefined) {
655
+ // if one of these is not defined we know the other is defined and therefore
656
+ // not equal
657
+ if (existing_parameters === undefined || incoming_parameters === undefined) {
658
+ return false;
659
+ }
660
+ }
661
+ const existing_prompt = existing.prompt;
662
+ const incoming_prompt = incoming.prompt;
663
+ // if at least one of these optionals is defined
664
+ if (existing_prompt !== undefined || incoming_prompt !== undefined) {
665
+ // if one of these is not defined we know the other is defined and therefore
666
+ // not equal
667
+ if (existing_prompt === undefined || incoming_prompt === undefined) {
668
+ return false;
669
+ }
670
+ if (!(existing_prompt === incoming_prompt)) {
671
+ return false;
672
+ }
673
+ }
674
+ return true;
675
+ }
676
+ const ingest$1 = function GenerationResponseIngest(input, path, luvio, store, timestamp) {
677
+ if (process.env.NODE_ENV !== 'production') {
678
+ const validateError = validate$1(input);
679
+ if (validateError !== null) {
680
+ throw validateError;
681
+ }
682
+ }
683
+ const key = path.fullPath;
684
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 100;
685
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "einstein-ai-gateway", VERSION$1, RepresentationType$1, equals$1);
686
+ return createLink(key);
687
+ };
688
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
689
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
690
+ const rootKey = fullPathFactory();
691
+ rootKeySet.set(rootKey, {
692
+ namespace: keyPrefix,
693
+ representationName: RepresentationType$1,
694
+ mergeable: false
695
+ });
696
+ }
697
+
698
+ function select$2(luvio, params) {
699
+ return select$3();
700
+ }
701
+ function keyBuilder$2(luvio, params) {
702
+ return keyPrefix + '::GenerationResponse:(' + 'xClientFeatureId:' + params.headers.xClientFeatureId + ',' + 'xLLMProvider:' + params.headers.xLLMProvider + ',' + 'prompt:' + params.body.prompt + '::' + (params.body.num_generations === undefined ? 'num_generations' : 'num_generations:' + params.body.num_generations) + '::' + (params.body.max_tokens === undefined ? 'max_tokens' : 'max_tokens:' + params.body.max_tokens) + '::' + (params.body.enable_pii_masking === undefined ? 'enable_pii_masking' : 'enable_pii_masking:' + params.body.enable_pii_masking) + '::' + (params.body.temperature === undefined ? 'temperature' : 'temperature:' + params.body.temperature) + '::' + (params.body.stop_sequences === undefined ? 'stop_sequences' : 'stop_sequences:' + params.body.stop_sequences) + '::' + (params.body.frequency_penalty === undefined ? 'frequency_penalty' : 'frequency_penalty:' + params.body.frequency_penalty) + '::' + (params.body.presence_penalty === undefined ? 'presence_penalty' : 'presence_penalty:' + params.body.presence_penalty) + '::' + (params.body.model === undefined ? 'model' : 'model:' + params.body.model) + '::' + stableJSONStringify(params.body.parameters) + '::' + stableJSONStringify(params.body.tags) + ')';
703
+ }
704
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
705
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
706
+ }
707
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
708
+ const { body } = response;
709
+ const key = keyBuilder$2(luvio, resourceParams);
710
+ luvio.storeIngest(key, ingest$1, body);
711
+ const snapshot = luvio.storeLookup({
712
+ recordId: key,
713
+ node: select$2(),
714
+ variables: {},
715
+ }, snapshotRefresh);
716
+ if (process.env.NODE_ENV !== 'production') {
717
+ if (snapshot.state !== 'Fulfilled') {
718
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
719
+ }
720
+ }
721
+ deepFreeze(snapshot.data);
722
+ return snapshot;
723
+ }
724
+ function ingestError(luvio, params, error, snapshotRefresh) {
725
+ const key = keyBuilder$2(luvio, params);
726
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
727
+ luvio.storeIngestError(key, errorSnapshot);
728
+ return errorSnapshot;
729
+ }
730
+ function createResourceRequest$1(config) {
731
+ const headers = {};
732
+ headers['x-client-feature-id'] = config.headers.xClientFeatureId;
733
+ headers['x-LLM-Provider'] = config.headers.xLLMProvider;
734
+ return {
735
+ baseUri: 'api.salesforce.com',
736
+ basePath: '/ai/gpt/v1/generations',
737
+ method: 'post',
738
+ body: config.body,
739
+ urlParams: {},
740
+ queryParams: {},
741
+ headers,
742
+ priority: 'normal',
743
+ };
744
+ }
745
+
746
+ const adapterName$1 = 'getGenerations';
747
+ const getGenerations_ConfigPropertyMetadata = [
748
+ generateParamConfigMetadata('prompt', true, 2 /* Body */, 0 /* String */),
749
+ generateParamConfigMetadata('num_generations', false, 2 /* Body */, 3 /* Integer */),
750
+ generateParamConfigMetadata('max_tokens', false, 2 /* Body */, 3 /* Integer */),
751
+ generateParamConfigMetadata('enable_pii_masking', false, 2 /* Body */, 1 /* Boolean */),
752
+ generateParamConfigMetadata('temperature', false, 2 /* Body */, 2 /* Number */),
753
+ generateParamConfigMetadata('stop_sequences', false, 2 /* Body */, 0 /* String */, true),
754
+ generateParamConfigMetadata('frequency_penalty', false, 2 /* Body */, 2 /* Number */),
755
+ generateParamConfigMetadata('presence_penalty', false, 2 /* Body */, 2 /* Number */),
756
+ generateParamConfigMetadata('model', false, 2 /* Body */, 0 /* String */),
757
+ generateParamConfigMetadata('parameters', false, 2 /* Body */, 4 /* Unsupported */),
758
+ generateParamConfigMetadata('tags', false, 2 /* Body */, 4 /* Unsupported */),
759
+ generateParamConfigMetadata('xClientFeatureId', true, 3 /* Header */, 0 /* String */),
760
+ generateParamConfigMetadata('xLLMProvider', true, 3 /* Header */, 0 /* String */),
761
+ ];
762
+ const getGenerations_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getGenerations_ConfigPropertyMetadata);
763
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getGenerations_ConfigPropertyMetadata);
764
+ function keyBuilder$1(luvio, config) {
765
+ const resourceParams = createResourceParams$1(config);
766
+ return keyBuilder$2(luvio, resourceParams);
767
+ }
768
+ function typeCheckConfig$1(untrustedConfig) {
769
+ const config = {};
770
+ typeCheckConfig$2(untrustedConfig, config, getGenerations_ConfigPropertyMetadata);
771
+ const untrustedConfig_parameters = untrustedConfig.parameters;
772
+ if (untrustedIsObject(untrustedConfig_parameters)) {
773
+ const untrustedConfig_parameters_object = {};
774
+ if (untrustedConfig_parameters_object !== undefined && Object.keys(untrustedConfig_parameters_object).length >= 0) {
775
+ config.parameters = untrustedConfig_parameters_object;
776
+ }
777
+ }
778
+ const untrustedConfig_tags = untrustedConfig.tags;
779
+ if (untrustedIsObject(untrustedConfig_tags)) {
780
+ const untrustedConfig_tags_object = {};
781
+ if (untrustedConfig_tags_object !== undefined && Object.keys(untrustedConfig_tags_object).length >= 0) {
782
+ config.tags = untrustedConfig_tags_object;
783
+ }
784
+ }
785
+ return config;
786
+ }
787
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
788
+ if (!untrustedIsObject(untrustedConfig)) {
789
+ return null;
790
+ }
791
+ if (process.env.NODE_ENV !== 'production') {
792
+ validateConfig(untrustedConfig, configPropertyNames);
793
+ }
794
+ const config = typeCheckConfig$1(untrustedConfig);
795
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
796
+ return null;
797
+ }
798
+ return config;
799
+ }
800
+ function adapterFragment(luvio, config) {
801
+ createResourceParams$1(config);
802
+ return select$2();
803
+ }
804
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
805
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
806
+ config,
807
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
808
+ });
809
+ return luvio.storeBroadcast().then(() => snapshot);
810
+ }
811
+ function onFetchResponseError(luvio, config, resourceParams, response) {
812
+ const snapshot = ingestError(luvio, resourceParams, response, {
813
+ config,
814
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
815
+ });
816
+ return luvio.storeBroadcast().then(() => snapshot);
817
+ }
818
+ function buildNetworkSnapshot$1(luvio, config, options) {
819
+ const resourceParams = createResourceParams$1(config);
820
+ const request = createResourceRequest$1(resourceParams);
821
+ return luvio.dispatchResourceRequest(request, options)
822
+ .then((response) => {
823
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
824
+ const cache = new StoreKeyMap();
825
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
826
+ return cache;
827
+ });
828
+ }, (response) => {
829
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
830
+ });
831
+ }
832
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
833
+ return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, 'get', false);
834
+ }
835
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
836
+ const { luvio, config } = context;
837
+ const selector = {
838
+ recordId: keyBuilder$1(luvio, config),
839
+ node: adapterFragment(luvio, config),
840
+ variables: {},
841
+ };
842
+ const cacheSnapshot = storeLookup(selector, {
843
+ config,
844
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
845
+ });
846
+ return cacheSnapshot;
847
+ }
848
+ const getGenerationsAdapterFactory = (luvio) => function einsteinAiGateway__getGenerations(untrustedConfig, requestContext) {
849
+ const config = validateAdapterConfig$1(untrustedConfig, getGenerations_ConfigPropertyNames);
850
+ // Invalid or incomplete config
851
+ if (config === null) {
852
+ return null;
853
+ }
854
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
855
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
856
+ };
857
+
858
+ const TTL = 100;
859
+ const VERSION = "f29dcf556357658d72f8330fc3a9d1ac";
860
+ function validate(obj, path = 'FeedbackResponseRepresentation') {
861
+ const v_error = (() => {
862
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
863
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
864
+ }
865
+ const obj_message = obj.message;
866
+ const path_message = path + '.message';
867
+ if (typeof obj_message !== 'string') {
868
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
869
+ }
870
+ })();
871
+ return v_error === undefined ? null : v_error;
872
+ }
873
+ const RepresentationType = 'FeedbackResponseRepresentation';
874
+ function keyBuilder(luvio, config) {
875
+ return keyPrefix + '::' + RepresentationType + ':' + config.message;
876
+ }
877
+ function keyBuilderFromType(luvio, object) {
878
+ const keyParams = {
879
+ message: object.message
880
+ };
881
+ return keyBuilder(luvio, keyParams);
882
+ }
883
+ function normalize(input, existing, path, luvio, store, timestamp) {
884
+ return input;
885
+ }
886
+ const select$1 = function FeedbackResponseRepresentationSelect() {
887
+ return {
888
+ kind: 'Fragment',
889
+ version: VERSION,
890
+ private: [],
891
+ selections: [
892
+ {
893
+ name: 'message',
894
+ kind: 'Scalar'
895
+ }
896
+ ]
897
+ };
898
+ };
899
+ function equals(existing, incoming) {
900
+ const existing_message = existing.message;
901
+ const incoming_message = incoming.message;
902
+ if (!(existing_message === incoming_message)) {
903
+ return false;
904
+ }
905
+ return true;
906
+ }
907
+ const ingest = function FeedbackResponseRepresentationIngest(input, path, luvio, store, timestamp) {
908
+ if (process.env.NODE_ENV !== 'production') {
909
+ const validateError = validate(input);
910
+ if (validateError !== null) {
911
+ throw validateError;
912
+ }
913
+ }
914
+ const key = keyBuilderFromType(luvio, input);
915
+ const ttlToUse = TTL;
916
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "einstein-ai-gateway", VERSION, RepresentationType, equals);
917
+ return createLink(key);
918
+ };
919
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
920
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
921
+ const rootKey = keyBuilderFromType(luvio, input);
922
+ rootKeySet.set(rootKey, {
923
+ namespace: keyPrefix,
924
+ representationName: RepresentationType,
925
+ mergeable: false
926
+ });
927
+ }
928
+
929
+ function select(luvio, params) {
930
+ return select$1();
931
+ }
932
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
933
+ getTypeCacheKeys(storeKeyMap, luvio, response);
934
+ }
935
+ function ingestSuccess(luvio, resourceParams, response) {
936
+ const { body } = response;
937
+ const key = keyBuilderFromType(luvio, body);
938
+ luvio.storeIngest(key, ingest, body);
939
+ const snapshot = luvio.storeLookup({
940
+ recordId: key,
941
+ node: select(),
942
+ variables: {},
943
+ });
944
+ if (process.env.NODE_ENV !== 'production') {
945
+ if (snapshot.state !== 'Fulfilled') {
946
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
947
+ }
948
+ }
949
+ deepFreeze(snapshot.data);
950
+ return snapshot;
951
+ }
952
+ function createResourceRequest(config) {
953
+ const headers = {};
954
+ headers['x-client-feature-id'] = config.headers.xClientFeatureId;
955
+ return {
956
+ baseUri: 'api.salesforce.com',
957
+ basePath: '/ai/gpt/v1/feedback',
958
+ method: 'post',
959
+ body: config.body,
960
+ urlParams: {},
961
+ queryParams: {},
962
+ headers,
963
+ priority: 'normal',
964
+ };
965
+ }
966
+
967
+ const adapterName = 'registerFeedback';
968
+ const registerFeedback_ConfigPropertyMetadata = [
969
+ generateParamConfigMetadata('id', true, 2 /* Body */, 0 /* String */),
970
+ generateParamConfigMetadata('generation_id', true, 2 /* Body */, 0 /* String */),
971
+ generateParamConfigMetadata('feedback', false, 2 /* Body */, 0 /* String */),
972
+ generateParamConfigMetadata('feedback_text', false, 2 /* Body */, 0 /* String */),
973
+ generateParamConfigMetadata('source', false, 2 /* Body */, 0 /* String */),
974
+ generateParamConfigMetadata('app_feedback', false, 2 /* Body */, 4 /* Unsupported */),
975
+ generateParamConfigMetadata('xClientFeatureId', true, 3 /* Header */, 0 /* String */),
976
+ ];
977
+ const registerFeedback_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, registerFeedback_ConfigPropertyMetadata);
978
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(registerFeedback_ConfigPropertyMetadata);
979
+ function typeCheckConfig(untrustedConfig) {
980
+ const config = {};
981
+ typeCheckConfig$2(untrustedConfig, config, registerFeedback_ConfigPropertyMetadata);
982
+ const untrustedConfig_app_feedback = untrustedConfig.app_feedback;
983
+ if (untrustedIsObject(untrustedConfig_app_feedback)) {
984
+ const untrustedConfig_app_feedback_object = {};
985
+ if (untrustedConfig_app_feedback_object !== undefined && Object.keys(untrustedConfig_app_feedback_object).length >= 0) {
986
+ config.app_feedback = untrustedConfig_app_feedback_object;
987
+ }
988
+ }
989
+ return config;
990
+ }
991
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
992
+ if (!untrustedIsObject(untrustedConfig)) {
993
+ return null;
994
+ }
995
+ if (process.env.NODE_ENV !== 'production') {
996
+ validateConfig(untrustedConfig, configPropertyNames);
997
+ }
998
+ const config = typeCheckConfig(untrustedConfig);
999
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1000
+ return null;
1001
+ }
1002
+ return config;
1003
+ }
1004
+ function buildNetworkSnapshot(luvio, config, options) {
1005
+ const resourceParams = createResourceParams(config);
1006
+ const request = createResourceRequest(resourceParams);
1007
+ return luvio.dispatchResourceRequest(request, options)
1008
+ .then((response) => {
1009
+ return luvio.handleSuccessResponse(() => {
1010
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1011
+ return luvio.storeBroadcast().then(() => snapshot);
1012
+ }, () => {
1013
+ const cache = new StoreKeyMap();
1014
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1015
+ return cache;
1016
+ });
1017
+ }, (response) => {
1018
+ deepFreeze(response);
1019
+ throw response;
1020
+ });
1021
+ }
1022
+ const registerFeedbackAdapterFactory = (luvio) => {
1023
+ return function registerFeedback(untrustedConfig) {
1024
+ const config = validateAdapterConfig(untrustedConfig, registerFeedback_ConfigPropertyNames);
1025
+ // Invalid or incomplete config
1026
+ if (config === null) {
1027
+ throw new Error('Invalid config for "registerFeedback"');
1028
+ }
1029
+ return buildNetworkSnapshot(luvio, config);
1030
+ };
1031
+ };
1032
+
1033
+ let getGenerations;
1034
+ let registerFeedback;
1035
+ // Imperative GET Adapters
1036
+ let getGenerations_imperative;
1037
+ // Adapter Metadata
1038
+ const getGenerationsMetadata = { apiFamily: 'einsteinai-gateway', name: 'getGenerations' };
1039
+ function bindExportsTo(luvio) {
1040
+ // LDS Adapters
1041
+ const getGenerations_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getGenerations', getGenerationsAdapterFactory), getGenerationsMetadata);
1042
+ function unwrapSnapshotData(factory) {
1043
+ const adapter = factory(luvio);
1044
+ return (config) => adapter(config).then(snapshot => snapshot.data);
1045
+ }
1046
+ return {
1047
+ getGenerations: createWireAdapterConstructor(luvio, getGenerations_ldsAdapter, getGenerationsMetadata),
1048
+ registerFeedback: unwrapSnapshotData(registerFeedbackAdapterFactory),
1049
+ // Imperative GET Adapters
1050
+ getGenerations_imperative: createImperativeAdapter(luvio, getGenerations_ldsAdapter, getGenerationsMetadata)
1051
+ };
1052
+ }
1053
+ withDefaultLuvio((luvio) => {
1054
+ ({
1055
+ getGenerations,
1056
+ registerFeedback,
1057
+ getGenerations_imperative
1058
+ } = bindExportsTo(luvio));
1059
+ });
1060
+
1061
+ export { getGenerations, getGenerations_imperative, registerFeedback };
1062
+ // version: 1.250.0-5e338946c