@salesforce/lds-adapters-industries-eri 0.131.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.
package/LICENSE.txt ADDED
@@ -0,0 +1,82 @@
1
+ Terms of Use
2
+
3
+ Copyright 2022 Salesforce, Inc. All rights reserved.
4
+
5
+ These Terms of Use govern the download, installation, and/or use of this
6
+ software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
7
+ last updated on April 15, 2022, and constitute a legally binding
8
+ agreement between you and Salesforce. If you do not agree to these Terms of
9
+ Use, do not install or use the Software.
10
+
11
+ Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
12
+ copyright license to reproduce, prepare derivative works of, publicly
13
+ display, publicly perform, sublicense, and distribute the Software and
14
+ derivative works subject to these Terms. These Terms shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ Subject to the limited rights expressly granted hereunder, Salesforce
18
+ reserves all rights, title, and interest in and to all intellectual
19
+ property subsisting in the Software. No rights are granted to you hereunder
20
+ other than as expressly set forth herein. Users residing in countries on
21
+ the United States Office of Foreign Assets Control sanction list, or which
22
+ are otherwise subject to a US export embargo, may not use the Software.
23
+
24
+ Implementation of the Software may require development work, for which you
25
+ are responsible. The Software may contain bugs, errors and
26
+ incompatibilities and is made available on an AS IS basis without support,
27
+ updates, or service level commitments.
28
+
29
+ Salesforce reserves the right at any time to modify, suspend, or
30
+ discontinue, the Software (or any part thereof) with or without notice. You
31
+ agree that Salesforce shall not be liable to you or to any third party for
32
+ any modification, suspension, or discontinuance.
33
+
34
+ You agree to defend Salesforce against any claim, demand, suit or
35
+ proceeding made or brought against Salesforce by a third party arising out
36
+ of or accruing from (a) your use of the Software, and (b) any application
37
+ you develop with the Software that infringes any copyright, trademark,
38
+ trade secret, trade dress, patent, or other intellectual property right of
39
+ any person or defames any person or violates their rights of publicity or
40
+ privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
41
+ from any damages, attorney fees, and costs finally awarded against
42
+ Salesforce as a result of, or for any amounts paid by Salesforce under a
43
+ settlement approved by you in writing of, a Claim Against Salesforce,
44
+ provided Salesforce (x) promptly gives you written notice of the Claim
45
+ Against Salesforce, (y) gives you sole control of the defense and
46
+ settlement of the Claim Against Salesforce (except that you may not settle
47
+ any Claim Against Salesforce unless it unconditionally releases Salesforce
48
+ of all liability), and (z) gives you all reasonable assistance, at your
49
+ expense.
50
+
51
+ WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
52
+ SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
54
+ INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
55
+ PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
56
+ OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
57
+ CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
58
+ HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
59
+
60
+ These Terms of Use shall be governed exclusively by the internal laws of
61
+ the State of California, without regard to its conflicts of laws
62
+ rules. Each party hereby consents to the exclusive jurisdiction of the
63
+ state and federal courts located in San Francisco County, California to
64
+ adjudicate any dispute arising out of or relating to these Terms of Use and
65
+ the download, installation, and/or use of the Software. Except as expressly
66
+ stated herein, these Terms of Use constitute the entire agreement between
67
+ the parties, and supersede all prior and contemporaneous agreements,
68
+ proposals, or representations, written or oral, concerning their subject
69
+ matter. No modification, amendment, or waiver of any provision of these
70
+ Terms of Use shall be effective unless it is by an update to these Terms of
71
+ Use that Salesforce makes available, or is in writing and signed by the
72
+ party against whom the modification, amendment, or waiver is to be
73
+ asserted.
74
+
75
+ Data Privacy: Salesforce may collect, process, and store device,
76
+ system, and other information related to your use of the Software. This
77
+ information includes, but is not limited to, IP address, user metrics, and
78
+ other data ("Usage Data"). Salesforce may use Usage Data for analytics,
79
+ product development, and marketing purposes. You acknowledge that files
80
+ generated in conjunction with the Software may contain sensitive or
81
+ confidential data, and you are solely responsible for anonymizing and
82
+ protecting such data.
@@ -0,0 +1,528 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ import { serializeStructuredKey, StoreKeyMap } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
11
+ const { isArray: ArrayIsArray$1 } = Array;
12
+ /**
13
+ * Validates an adapter config is well-formed.
14
+ * @param config The config to validate.
15
+ * @param adapter The adapter validation configuration.
16
+ * @param oneOf The keys the config must contain at least one of.
17
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
18
+ */
19
+ function validateConfig(config, adapter, oneOf) {
20
+ const { displayName } = adapter;
21
+ const { required, optional, unsupported } = adapter.parameters;
22
+ if (config === undefined ||
23
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
24
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
25
+ }
26
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
27
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
28
+ }
29
+ if (unsupported !== undefined &&
30
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
31
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
32
+ }
33
+ const supported = required.concat(optional);
34
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
35
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
36
+ }
37
+ }
38
+ function untrustedIsObject(untrusted) {
39
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
40
+ }
41
+ function areRequiredParametersPresent(config, configPropertyNames) {
42
+ return configPropertyNames.parameters.required.every(req => req in config);
43
+ }
44
+ const keyPrefix = 'eri';
45
+
46
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
47
+ const { isArray: ArrayIsArray } = Array;
48
+ const { stringify: JSONStringify } = JSON;
49
+ function deepFreeze$3(value) {
50
+ // No need to freeze primitives
51
+ if (typeof value !== 'object' || value === null) {
52
+ return;
53
+ }
54
+ if (ArrayIsArray(value)) {
55
+ for (let i = 0, len = value.length; i < len; i += 1) {
56
+ deepFreeze$3(value[i]);
57
+ }
58
+ }
59
+ else {
60
+ const keys = ObjectKeys(value);
61
+ for (let i = 0, len = keys.length; i < len; i += 1) {
62
+ deepFreeze$3(value[keys[i]]);
63
+ }
64
+ }
65
+ ObjectFreeze(value);
66
+ }
67
+ function createLink(ref) {
68
+ return {
69
+ __ref: serializeStructuredKey(ref),
70
+ };
71
+ }
72
+
73
+ function validate$4(obj, path = 'FollowingInfoInputRepresentation') {
74
+ const v_error = (() => {
75
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
76
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
77
+ }
78
+ if (obj.demo !== undefined) {
79
+ const obj_demo = obj.demo;
80
+ const path_demo = path + '.demo';
81
+ if (typeof obj_demo !== 'boolean') {
82
+ return new TypeError('Expected "boolean" but received "' + typeof obj_demo + '" (at "' + path_demo + '")');
83
+ }
84
+ }
85
+ if (obj.filterTypes !== undefined) {
86
+ const obj_filterTypes = obj.filterTypes;
87
+ const path_filterTypes = path + '.filterTypes';
88
+ if (!ArrayIsArray(obj_filterTypes)) {
89
+ return new TypeError('Expected "array" but received "' + typeof obj_filterTypes + '" (at "' + path_filterTypes + '")');
90
+ }
91
+ for (let i = 0; i < obj_filterTypes.length; i++) {
92
+ const obj_filterTypes_item = obj_filterTypes[i];
93
+ const path_filterTypes_item = path_filterTypes + '[' + i + ']';
94
+ if (typeof obj_filterTypes_item !== 'string') {
95
+ return new TypeError('Expected "string" but received "' + typeof obj_filterTypes_item + '" (at "' + path_filterTypes_item + '")');
96
+ }
97
+ }
98
+ }
99
+ if (obj.hasNext !== undefined) {
100
+ const obj_hasNext = obj.hasNext;
101
+ const path_hasNext = path + '.hasNext';
102
+ if (typeof obj_hasNext !== 'boolean') {
103
+ return new TypeError('Expected "boolean" but received "' + typeof obj_hasNext + '" (at "' + path_hasNext + '")');
104
+ }
105
+ }
106
+ if (obj.page !== undefined) {
107
+ const obj_page = obj.page;
108
+ const path_page = path + '.page';
109
+ if (typeof obj_page !== 'number' || (typeof obj_page === 'number' && Math.floor(obj_page) !== obj_page)) {
110
+ return new TypeError('Expected "integer" but received "' + typeof obj_page + '" (at "' + path_page + '")');
111
+ }
112
+ }
113
+ if (obj.recordIds !== undefined) {
114
+ const obj_recordIds = obj.recordIds;
115
+ const path_recordIds = path + '.recordIds';
116
+ if (!ArrayIsArray(obj_recordIds)) {
117
+ return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
118
+ }
119
+ for (let i = 0; i < obj_recordIds.length; i++) {
120
+ const obj_recordIds_item = obj_recordIds[i];
121
+ const path_recordIds_item = path_recordIds + '[' + i + ']';
122
+ if (typeof obj_recordIds_item !== 'string') {
123
+ return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
124
+ }
125
+ }
126
+ }
127
+ })();
128
+ return v_error === undefined ? null : v_error;
129
+ }
130
+
131
+ function validate$3(obj, path = 'ERIDigestInputRepresentation') {
132
+ const v_error = (() => {
133
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
134
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
135
+ }
136
+ const obj_following = obj.following;
137
+ const path_following = path + '.following';
138
+ const referencepath_followingValidationError = validate$4(obj_following, path_following);
139
+ if (referencepath_followingValidationError !== null) {
140
+ let message = 'Object doesn\'t match FollowingInfoInputRepresentation (at "' + path_following + '")\n';
141
+ message += referencepath_followingValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
142
+ return new TypeError(message);
143
+ }
144
+ })();
145
+ return v_error === undefined ? null : v_error;
146
+ }
147
+
148
+ function validate$2(obj, path = 'FollowingInfo') {
149
+ const v_error = (() => {
150
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
151
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
152
+ }
153
+ const obj_filterTypes = obj.filterTypes;
154
+ const path_filterTypes = path + '.filterTypes';
155
+ if (!ArrayIsArray(obj_filterTypes)) {
156
+ return new TypeError('Expected "array" but received "' + typeof obj_filterTypes + '" (at "' + path_filterTypes + '")');
157
+ }
158
+ for (let i = 0; i < obj_filterTypes.length; i++) {
159
+ const obj_filterTypes_item = obj_filterTypes[i];
160
+ const path_filterTypes_item = path_filterTypes + '[' + i + ']';
161
+ if (typeof obj_filterTypes_item !== 'string') {
162
+ return new TypeError('Expected "string" but received "' + typeof obj_filterTypes_item + '" (at "' + path_filterTypes_item + '")');
163
+ }
164
+ }
165
+ const obj_page = obj.page;
166
+ const path_page = path + '.page';
167
+ if (typeof obj_page !== 'number' || (typeof obj_page === 'number' && Math.floor(obj_page) !== obj_page)) {
168
+ return new TypeError('Expected "integer" but received "' + typeof obj_page + '" (at "' + path_page + '")');
169
+ }
170
+ const obj_recordIds = obj.recordIds;
171
+ const path_recordIds = path + '.recordIds';
172
+ if (!ArrayIsArray(obj_recordIds)) {
173
+ return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
174
+ }
175
+ for (let i = 0; i < obj_recordIds.length; i++) {
176
+ const obj_recordIds_item = obj_recordIds[i];
177
+ const path_recordIds_item = path_recordIds + '[' + i + ']';
178
+ if (typeof obj_recordIds_item !== 'string') {
179
+ return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
180
+ }
181
+ }
182
+ })();
183
+ return v_error === undefined ? null : v_error;
184
+ }
185
+ function deepFreeze$2(input) {
186
+ const input_filterTypes = input.filterTypes;
187
+ ObjectFreeze(input_filterTypes);
188
+ const input_recordIds = input.recordIds;
189
+ ObjectFreeze(input_recordIds);
190
+ ObjectFreeze(input);
191
+ }
192
+
193
+ function validate$1(obj, path = 'DigestNotification') {
194
+ const v_error = (() => {
195
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
196
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
197
+ }
198
+ const obj_fields = obj.fields;
199
+ const path_fields = path + '.fields';
200
+ if (!ArrayIsArray(obj_fields)) {
201
+ return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
202
+ }
203
+ for (let i = 0; i < obj_fields.length; i++) {
204
+ const obj_fields_item = obj_fields[i];
205
+ const path_fields_item = path_fields + '[' + i + ']';
206
+ if (typeof obj_fields_item !== 'object' || ArrayIsArray(obj_fields_item) || obj_fields_item === null) {
207
+ return new TypeError('Expected "object" but received "' + typeof obj_fields_item + '" (at "' + path_fields_item + '")');
208
+ }
209
+ const obj_fields_item_keys = ObjectKeys(obj_fields_item);
210
+ for (let i = 0; i < obj_fields_item_keys.length; i++) {
211
+ const key = obj_fields_item_keys[i];
212
+ const obj_fields_item_prop = obj_fields_item[key];
213
+ const path_fields_item_prop = path_fields_item + '["' + key + '"]';
214
+ if (typeof obj_fields_item_prop !== 'string') {
215
+ return new TypeError('Expected "string" but received "' + typeof obj_fields_item_prop + '" (at "' + path_fields_item_prop + '")');
216
+ }
217
+ }
218
+ }
219
+ const obj_id = obj.id;
220
+ const path_id = path + '.id';
221
+ if (typeof obj_id !== 'string') {
222
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
223
+ }
224
+ const obj_name = obj.name;
225
+ const path_name = path + '.name';
226
+ if (typeof obj_name !== 'string') {
227
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
228
+ }
229
+ const obj_navigationLink = obj.navigationLink;
230
+ const path_navigationLink = path + '.navigationLink';
231
+ if (typeof obj_navigationLink !== 'string') {
232
+ return new TypeError('Expected "string" but received "' + typeof obj_navigationLink + '" (at "' + path_navigationLink + '")');
233
+ }
234
+ if (obj.read !== undefined) {
235
+ const obj_read = obj.read;
236
+ const path_read = path + '.read';
237
+ if (typeof obj_read !== 'boolean') {
238
+ return new TypeError('Expected "boolean" but received "' + typeof obj_read + '" (at "' + path_read + '")');
239
+ }
240
+ }
241
+ const obj_recordId = obj.recordId;
242
+ const path_recordId = path + '.recordId';
243
+ if (typeof obj_recordId !== 'string') {
244
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
245
+ }
246
+ if (obj.recordTypeId !== undefined) {
247
+ const obj_recordTypeId = obj.recordTypeId;
248
+ const path_recordTypeId = path + '.recordTypeId';
249
+ if (typeof obj_recordTypeId !== 'string') {
250
+ return new TypeError('Expected "string" but received "' + typeof obj_recordTypeId + '" (at "' + path_recordTypeId + '")');
251
+ }
252
+ }
253
+ const obj_sobjectType = obj.sobjectType;
254
+ const path_sobjectType = path + '.sobjectType';
255
+ if (typeof obj_sobjectType !== 'string') {
256
+ return new TypeError('Expected "string" but received "' + typeof obj_sobjectType + '" (at "' + path_sobjectType + '")');
257
+ }
258
+ const obj_sobjectTypeLabel = obj.sobjectTypeLabel;
259
+ const path_sobjectTypeLabel = path + '.sobjectTypeLabel';
260
+ if (typeof obj_sobjectTypeLabel !== 'string') {
261
+ return new TypeError('Expected "string" but received "' + typeof obj_sobjectTypeLabel + '" (at "' + path_sobjectTypeLabel + '")');
262
+ }
263
+ const obj_timeStamp = obj.timeStamp;
264
+ const path_timeStamp = path + '.timeStamp';
265
+ if (typeof obj_timeStamp !== 'string') {
266
+ return new TypeError('Expected "string" but received "' + typeof obj_timeStamp + '" (at "' + path_timeStamp + '")');
267
+ }
268
+ const obj_type = obj.type;
269
+ const path_type = path + '.type';
270
+ if (typeof obj_type !== 'string') {
271
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
272
+ }
273
+ })();
274
+ return v_error === undefined ? null : v_error;
275
+ }
276
+ function deepFreeze$1(input) {
277
+ const input_fields = input.fields;
278
+ for (let i = 0; i < input_fields.length; i++) {
279
+ const input_fields_item = input_fields[i];
280
+ const input_fields_item_keys = Object.keys(input_fields_item);
281
+ const input_fields_item_length = input_fields_item_keys.length;
282
+ for (let i = 0; i < input_fields_item_length; i++) {
283
+ input_fields_item_keys[i];
284
+ }
285
+ ObjectFreeze(input_fields_item);
286
+ }
287
+ ObjectFreeze(input_fields);
288
+ ObjectFreeze(input);
289
+ }
290
+
291
+ const TTL = 1000;
292
+ const VERSION = "954674f4e56dd5b956cf98542401fda9";
293
+ function validate(obj, path = 'ERIDigestOutputRepresentation') {
294
+ const v_error = (() => {
295
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
296
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
297
+ }
298
+ if (obj.errorMsg !== undefined) {
299
+ const obj_errorMsg = obj.errorMsg;
300
+ const path_errorMsg = path + '.errorMsg';
301
+ if (typeof obj_errorMsg !== 'string') {
302
+ return new TypeError('Expected "string" but received "' + typeof obj_errorMsg + '" (at "' + path_errorMsg + '")');
303
+ }
304
+ }
305
+ if (obj.following !== undefined) {
306
+ const obj_following = obj.following;
307
+ const path_following = path + '.following';
308
+ const referencepath_followingValidationError = validate$2(obj_following, path_following);
309
+ if (referencepath_followingValidationError !== null) {
310
+ let message = 'Object doesn\'t match FollowingInfo (at "' + path_following + '")\n';
311
+ message += referencepath_followingValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
312
+ return new TypeError(message);
313
+ }
314
+ }
315
+ if (obj.notifications !== undefined) {
316
+ const obj_notifications = obj.notifications;
317
+ const path_notifications = path + '.notifications';
318
+ if (!ArrayIsArray(obj_notifications)) {
319
+ return new TypeError('Expected "array" but received "' + typeof obj_notifications + '" (at "' + path_notifications + '")');
320
+ }
321
+ for (let i = 0; i < obj_notifications.length; i++) {
322
+ const obj_notifications_item = obj_notifications[i];
323
+ const path_notifications_item = path_notifications + '[' + i + ']';
324
+ const referencepath_notifications_itemValidationError = validate$1(obj_notifications_item, path_notifications_item);
325
+ if (referencepath_notifications_itemValidationError !== null) {
326
+ let message = 'Object doesn\'t match DigestNotification (at "' + path_notifications_item + '")\n';
327
+ message += referencepath_notifications_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
328
+ return new TypeError(message);
329
+ }
330
+ }
331
+ }
332
+ const obj_requestSucceeded = obj.requestSucceeded;
333
+ const path_requestSucceeded = path + '.requestSucceeded';
334
+ if (typeof obj_requestSucceeded !== 'boolean') {
335
+ return new TypeError('Expected "boolean" but received "' + typeof obj_requestSucceeded + '" (at "' + path_requestSucceeded + '")');
336
+ }
337
+ const obj_statusCode = obj.statusCode;
338
+ const path_statusCode = path + '.statusCode';
339
+ if (typeof obj_statusCode !== 'string') {
340
+ return new TypeError('Expected "string" but received "' + typeof obj_statusCode + '" (at "' + path_statusCode + '")');
341
+ }
342
+ })();
343
+ return v_error === undefined ? null : v_error;
344
+ }
345
+ const RepresentationType = 'ERIDigestOutputRepresentation';
346
+ function keyBuilder(luvio, config) {
347
+ return keyPrefix + '::' + RepresentationType + ':' + config.isSuccess;
348
+ }
349
+ function keyBuilderFromType(luvio, object) {
350
+ const keyParams = {
351
+ isSuccess: object.requestSucceeded
352
+ };
353
+ return keyBuilder(luvio, keyParams);
354
+ }
355
+ function normalize(input, existing, path, luvio, store, timestamp) {
356
+ return input;
357
+ }
358
+ const select$1 = function ERIDigestOutputRepresentationSelect() {
359
+ return {
360
+ kind: 'Fragment',
361
+ version: VERSION,
362
+ private: [],
363
+ opaque: true
364
+ };
365
+ };
366
+ function equals(existing, incoming) {
367
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
368
+ return false;
369
+ }
370
+ return true;
371
+ }
372
+ function deepFreeze(input) {
373
+ const input_following = input.following;
374
+ if (input_following !== undefined) {
375
+ deepFreeze$2(input_following);
376
+ }
377
+ const input_notifications = input.notifications;
378
+ if (input_notifications !== undefined) {
379
+ for (let i = 0; i < input_notifications.length; i++) {
380
+ const input_notifications_item = input_notifications[i];
381
+ deepFreeze$1(input_notifications_item);
382
+ }
383
+ ObjectFreeze(input_notifications);
384
+ }
385
+ ObjectFreeze(input);
386
+ }
387
+ const ingest = function ERIDigestOutputRepresentationIngest(input, path, luvio, store, timestamp) {
388
+ if (process.env.NODE_ENV !== 'production') {
389
+ const validateError = validate(input);
390
+ if (validateError !== null) {
391
+ throw validateError;
392
+ }
393
+ }
394
+ const key = keyBuilderFromType(luvio, input);
395
+ const existingRecord = store.readEntry(key);
396
+ const ttlToUse = TTL;
397
+ let incomingRecord = normalize(input, store.readEntry(key), {
398
+ fullPath: key,
399
+ parent: path.parent,
400
+ propertyName: path.propertyName,
401
+ ttl: ttlToUse
402
+ });
403
+ deepFreeze(input);
404
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
405
+ luvio.storePublish(key, incomingRecord);
406
+ }
407
+ {
408
+ const storeMetadataParams = {
409
+ ttl: ttlToUse,
410
+ namespace: "eri",
411
+ version: VERSION,
412
+ representationName: RepresentationType,
413
+ };
414
+ luvio.publishStoreMetadata(key, storeMetadataParams);
415
+ }
416
+ return createLink(key);
417
+ };
418
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
419
+ const rootKeySet = new StoreKeyMap();
420
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
421
+ const rootKey = keyBuilderFromType(luvio, input);
422
+ rootKeySet.set(rootKey, {
423
+ namespace: keyPrefix,
424
+ representationName: RepresentationType,
425
+ mergeable: false
426
+ });
427
+ return rootKeySet;
428
+ }
429
+
430
+ function select(luvio, params) {
431
+ return select$1();
432
+ }
433
+ function getResponseCacheKeys(luvio, resourceParams, response) {
434
+ return getTypeCacheKeys(luvio, response);
435
+ }
436
+ function ingestSuccess(luvio, resourceParams, response) {
437
+ const { body } = response;
438
+ const key = keyBuilderFromType(luvio, body);
439
+ luvio.storeIngest(key, ingest, body);
440
+ const snapshot = luvio.storeLookup({
441
+ recordId: key,
442
+ node: select(),
443
+ variables: {},
444
+ });
445
+ if (process.env.NODE_ENV !== 'production') {
446
+ if (snapshot.state !== 'Fulfilled') {
447
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
448
+ }
449
+ }
450
+ return snapshot;
451
+ }
452
+ function createResourceRequest(config) {
453
+ const headers = {};
454
+ return {
455
+ baseUri: '/services/data/v58.0',
456
+ basePath: '/connect/eri/digest',
457
+ method: 'post',
458
+ body: config.body,
459
+ urlParams: {},
460
+ queryParams: {},
461
+ headers,
462
+ priority: 'normal',
463
+ };
464
+ }
465
+
466
+ const getERIDigest_ConfigPropertyNames = {
467
+ displayName: 'getERIDigest',
468
+ parameters: {
469
+ required: ['eriDigestInput'],
470
+ optional: []
471
+ }
472
+ };
473
+ function createResourceParams(config) {
474
+ const resourceParams = {
475
+ body: {
476
+ eriDigestInput: config.eriDigestInput
477
+ }
478
+ };
479
+ return resourceParams;
480
+ }
481
+ function typeCheckConfig(untrustedConfig) {
482
+ const config = {};
483
+ const untrustedConfig_eriDigestInput = untrustedConfig.eriDigestInput;
484
+ const referenceERIDigestInputRepresentationValidationError = validate$3(untrustedConfig_eriDigestInput);
485
+ if (referenceERIDigestInputRepresentationValidationError === null) {
486
+ config.eriDigestInput = untrustedConfig_eriDigestInput;
487
+ }
488
+ return config;
489
+ }
490
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
491
+ if (!untrustedIsObject(untrustedConfig)) {
492
+ return null;
493
+ }
494
+ if (process.env.NODE_ENV !== 'production') {
495
+ validateConfig(untrustedConfig, configPropertyNames);
496
+ }
497
+ const config = typeCheckConfig(untrustedConfig);
498
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
499
+ return null;
500
+ }
501
+ return config;
502
+ }
503
+ function buildNetworkSnapshot(luvio, config, options) {
504
+ const resourceParams = createResourceParams(config);
505
+ const request = createResourceRequest(resourceParams);
506
+ return luvio.dispatchResourceRequest(request, options)
507
+ .then((response) => {
508
+ return luvio.handleSuccessResponse(() => {
509
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
510
+ return luvio.storeBroadcast().then(() => snapshot);
511
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
512
+ }, (response) => {
513
+ deepFreeze$3(response);
514
+ throw response;
515
+ });
516
+ }
517
+ const getERIDigestAdapterFactory = (luvio) => {
518
+ return function getERIDigest(untrustedConfig) {
519
+ const config = validateAdapterConfig(untrustedConfig, getERIDigest_ConfigPropertyNames);
520
+ // Invalid or incomplete config
521
+ if (config === null) {
522
+ throw new Error('Invalid config for "getERIDigest"');
523
+ }
524
+ return buildNetworkSnapshot(luvio, config);
525
+ };
526
+ };
527
+
528
+ export { getERIDigestAdapterFactory };
@@ -0,0 +1,66 @@
1
+ import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot } from '@luvio/engine';
2
+ export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
3
+ declare const ObjectKeys: {
4
+ (o: object): string[];
5
+ (o: {}): string[];
6
+ }, ObjectFreeze: {
7
+ <T extends Function>(f: T): T;
8
+ <T_1 extends {
9
+ [idx: string]: object | U | null | undefined;
10
+ }, U extends string | number | bigint | boolean | symbol>(o: T_1): Readonly<T_1>;
11
+ <T_2>(o: T_2): Readonly<T_2>;
12
+ }, ObjectCreate: {
13
+ (o: object | null): any;
14
+ (o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
15
+ };
16
+ export { ObjectFreeze, ObjectCreate, ObjectKeys };
17
+ export declare const ArrayIsArray: (arg: any) => arg is any[];
18
+ export declare const ArrayPrototypePush: (...items: any[]) => number;
19
+ export interface AdapterValidationConfig {
20
+ displayName: string;
21
+ parameters: {
22
+ required: string[];
23
+ optional: string[];
24
+ unsupported?: string[];
25
+ };
26
+ }
27
+ /**
28
+ * Validates an adapter config is well-formed.
29
+ * @param config The config to validate.
30
+ * @param adapter The adapter validation configuration.
31
+ * @param oneOf The keys the config must contain at least one of.
32
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
33
+ */
34
+ export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
35
+ export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
36
+ export type UncoercedConfiguration<Base, Options extends {
37
+ [key in keyof Base]?: any;
38
+ }> = {
39
+ [Key in keyof Base]?: Base[Key] | Options[Key];
40
+ };
41
+ export type Untrusted<Base> = Partial<Base>;
42
+ export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
43
+ export declare function refreshable<C, D, R>(adapter: $64$luvio_engine_Adapter<C, D>, resolve: (config: unknown) => Promise<$64$luvio_engine_Snapshot<R>>): $64$luvio_engine_Adapter<C, D>;
44
+ export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
45
+ export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
46
+ export declare const snapshotRefreshOptions: {
47
+ overrides: {
48
+ headers: {
49
+ 'Cache-Control': string;
50
+ };
51
+ };
52
+ };
53
+ /**
54
+ * A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
55
+ * This is needed because insertion order for JSON.stringify(object) affects output:
56
+ * JSON.stringify({a: 1, b: 2})
57
+ * "{"a":1,"b":2}"
58
+ * JSON.stringify({b: 2, a: 1})
59
+ * "{"b":2,"a":1}"
60
+ * @param data Data to be JSON-stringified.
61
+ * @returns JSON.stringified value with consistent ordering of keys.
62
+ */
63
+ export declare function stableJSONStringify(node: any): string | undefined;
64
+ export declare function getFetchResponseStatusText(status: number): string;
65
+ export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
66
+ export declare const keyPrefix = "eri";