@salesforce/lds-adapters-industries-epc 1.100.2

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 (26) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-epc.js +603 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/createProductAttributeDefinition.d.ts +15 -0
  5. package/dist/types/src/generated/adapters/deactivate.d.ts +15 -0
  6. package/dist/types/src/generated/artifacts/main.d.ts +2 -0
  7. package/dist/types/src/generated/artifacts/sfdc.d.ts +3 -0
  8. package/dist/types/src/generated/resources/patchConnectEpcActionsDeactivate.d.ts +13 -0
  9. package/dist/types/src/generated/resources/postConnectEpcProductAttributeDefinition.d.ts +13 -0
  10. package/dist/types/src/generated/types/DeactivateInputRepresentation.d.ts +35 -0
  11. package/dist/types/src/generated/types/DeactivateInputRepresentationWrapper.d.ts +30 -0
  12. package/dist/types/src/generated/types/ErrorOutputRepresentation.d.ts +35 -0
  13. package/dist/types/src/generated/types/ProductAttributeDefinitionInputRepresentation.d.ts +35 -0
  14. package/dist/types/src/generated/types/ProductAttributeDefinitionListInputRepresentation.d.ts +29 -0
  15. package/dist/types/src/generated/types/ProductAttributeDefinitionListInputRepresentationWrapper.d.ts +30 -0
  16. package/dist/types/src/generated/types/ProductAttributeDefinitionListRepresentation.d.ts +43 -0
  17. package/dist/types/src/generated/types/ProductAttributeDefinitionRepresentation.d.ts +32 -0
  18. package/dist/types/src/generated/types/RecordIdMapOutputRepresentation.d.ts +43 -0
  19. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  20. package/dist/umd/es2018/industries-epc.js +612 -0
  21. package/dist/umd/es5/industries-epc.js +618 -0
  22. package/package.json +70 -0
  23. package/sfdc/index.d.ts +1 -0
  24. package/sfdc/index.js +633 -0
  25. package/src/raml/api.raml +170 -0
  26. package/src/raml/luvio.raml +29 -0
@@ -0,0 +1,612 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ (function (global, factory) {
8
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
9
+ typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
10
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.industriesEpc = {}, global.engine));
11
+ })(this, (function (exports, engine) { 'use strict';
12
+
13
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
14
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
15
+ const { isArray: ArrayIsArray$1 } = Array;
16
+ /**
17
+ * Validates an adapter config is well-formed.
18
+ * @param config The config to validate.
19
+ * @param adapter The adapter validation configuration.
20
+ * @param oneOf The keys the config must contain at least one of.
21
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
22
+ */
23
+ function validateConfig(config, adapter, oneOf) {
24
+ const { displayName } = adapter;
25
+ const { required, optional, unsupported } = adapter.parameters;
26
+ if (config === undefined ||
27
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
28
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
29
+ }
30
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
31
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
32
+ }
33
+ if (unsupported !== undefined &&
34
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
35
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
36
+ }
37
+ const supported = required.concat(optional);
38
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
39
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
40
+ }
41
+ }
42
+ function untrustedIsObject(untrusted) {
43
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
44
+ }
45
+ function areRequiredParametersPresent(config, configPropertyNames) {
46
+ return configPropertyNames.parameters.required.every(req => req in config);
47
+ }
48
+ const keyPrefix = 'epc';
49
+
50
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
51
+ const { isArray: ArrayIsArray } = Array;
52
+ const { stringify: JSONStringify } = JSON;
53
+ function deepFreeze$4(value) {
54
+ // No need to freeze primitives
55
+ if (typeof value !== 'object' || value === null) {
56
+ return;
57
+ }
58
+ if (ArrayIsArray(value)) {
59
+ for (let i = 0, len = value.length; i < len; i += 1) {
60
+ deepFreeze$4(value[i]);
61
+ }
62
+ }
63
+ else {
64
+ const keys = ObjectKeys(value);
65
+ for (let i = 0, len = keys.length; i < len; i += 1) {
66
+ deepFreeze$4(value[keys[i]]);
67
+ }
68
+ }
69
+ ObjectFreeze(value);
70
+ }
71
+ function createLink(ref) {
72
+ return {
73
+ __ref: engine.serializeStructuredKey(ref),
74
+ };
75
+ }
76
+
77
+ function validate$5(obj, path = 'DeactivateInputRepresentation') {
78
+ const v_error = (() => {
79
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
80
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
81
+ }
82
+ const obj_entityName = obj.entityName;
83
+ const path_entityName = path + '.entityName';
84
+ if (typeof obj_entityName !== 'string') {
85
+ return new TypeError('Expected "string" but received "' + typeof obj_entityName + '" (at "' + path_entityName + '")');
86
+ }
87
+ if (obj.parentRecordId !== undefined) {
88
+ const obj_parentRecordId = obj.parentRecordId;
89
+ const path_parentRecordId = path + '.parentRecordId';
90
+ if (typeof obj_parentRecordId !== 'string') {
91
+ return new TypeError('Expected "string" but received "' + typeof obj_parentRecordId + '" (at "' + path_parentRecordId + '")');
92
+ }
93
+ }
94
+ const obj_recordIds = obj.recordIds;
95
+ const path_recordIds = path + '.recordIds';
96
+ if (!ArrayIsArray(obj_recordIds)) {
97
+ return new TypeError('Expected "array" but received "' + typeof obj_recordIds + '" (at "' + path_recordIds + '")');
98
+ }
99
+ for (let i = 0; i < obj_recordIds.length; i++) {
100
+ const obj_recordIds_item = obj_recordIds[i];
101
+ const path_recordIds_item = path_recordIds + '[' + i + ']';
102
+ if (typeof obj_recordIds_item !== 'string') {
103
+ return new TypeError('Expected "string" but received "' + typeof obj_recordIds_item + '" (at "' + path_recordIds_item + '")');
104
+ }
105
+ }
106
+ })();
107
+ return v_error === undefined ? null : v_error;
108
+ }
109
+
110
+ function validate$4(obj, path = 'ErrorOutputRepresentation') {
111
+ const v_error = (() => {
112
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
113
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
114
+ }
115
+ const obj_details = obj.details;
116
+ const path_details = path + '.details';
117
+ if (!ArrayIsArray(obj_details)) {
118
+ return new TypeError('Expected "array" but received "' + typeof obj_details + '" (at "' + path_details + '")');
119
+ }
120
+ for (let i = 0; i < obj_details.length; i++) {
121
+ const obj_details_item = obj_details[i];
122
+ const path_details_item = path_details + '[' + i + ']';
123
+ if (typeof obj_details_item !== 'string') {
124
+ return new TypeError('Expected "string" but received "' + typeof obj_details_item + '" (at "' + path_details_item + '")');
125
+ }
126
+ }
127
+ const obj_message = obj.message;
128
+ const path_message = path + '.message';
129
+ if (typeof obj_message !== 'string') {
130
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
131
+ }
132
+ const obj_reason = obj.reason;
133
+ const path_reason = path + '.reason';
134
+ if (typeof obj_reason !== 'string') {
135
+ return new TypeError('Expected "string" but received "' + typeof obj_reason + '" (at "' + path_reason + '")');
136
+ }
137
+ })();
138
+ return v_error === undefined ? null : v_error;
139
+ }
140
+ function deepFreeze$3(input) {
141
+ const input_details = input.details;
142
+ ObjectFreeze(input_details);
143
+ ObjectFreeze(input);
144
+ }
145
+
146
+ const TTL$1 = 6000;
147
+ const VERSION$1 = "67abdeaa299bae24f468fd2e78cd1e1e";
148
+ function validate$3(obj, path = 'RecordIdMapOutputRepresentation') {
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_errors = obj.errors;
154
+ const path_errors = path + '.errors';
155
+ if (!ArrayIsArray(obj_errors)) {
156
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
157
+ }
158
+ for (let i = 0; i < obj_errors.length; i++) {
159
+ const obj_errors_item = obj_errors[i];
160
+ const path_errors_item = path_errors + '[' + i + ']';
161
+ const referencepath_errors_itemValidationError = validate$4(obj_errors_item, path_errors_item);
162
+ if (referencepath_errors_itemValidationError !== null) {
163
+ let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
164
+ message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
165
+ return new TypeError(message);
166
+ }
167
+ }
168
+ const obj_status = obj.status;
169
+ const path_status = path + '.status';
170
+ if (typeof obj_status !== 'string') {
171
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
172
+ }
173
+ })();
174
+ return v_error === undefined ? null : v_error;
175
+ }
176
+ const RepresentationType$1 = 'RecordIdMapOutputRepresentation';
177
+ function keyBuilder$1(luvio, config) {
178
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.message;
179
+ }
180
+ function keyBuilderFromType$1(luvio, object) {
181
+ const keyParams = {
182
+ message: object.status
183
+ };
184
+ return keyBuilder$1(luvio, keyParams);
185
+ }
186
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
187
+ return input;
188
+ }
189
+ const select$3 = function RecordIdMapOutputRepresentationSelect() {
190
+ return {
191
+ kind: 'Fragment',
192
+ version: VERSION$1,
193
+ private: [],
194
+ opaque: true
195
+ };
196
+ };
197
+ function equals$1(existing, incoming) {
198
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
199
+ return false;
200
+ }
201
+ return true;
202
+ }
203
+ function deepFreeze$2(input) {
204
+ const input_errors = input.errors;
205
+ for (let i = 0; i < input_errors.length; i++) {
206
+ const input_errors_item = input_errors[i];
207
+ deepFreeze$3(input_errors_item);
208
+ }
209
+ ObjectFreeze(input_errors);
210
+ ObjectFreeze(input);
211
+ }
212
+ const ingest$1 = function RecordIdMapOutputRepresentationIngest(input, path, luvio, store, timestamp) {
213
+ if (process.env.NODE_ENV !== 'production') {
214
+ const validateError = validate$3(input);
215
+ if (validateError !== null) {
216
+ throw validateError;
217
+ }
218
+ }
219
+ const key = keyBuilderFromType$1(luvio, input);
220
+ const existingRecord = store.readEntry(key);
221
+ const ttlToUse = TTL$1;
222
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
223
+ fullPath: key,
224
+ parent: path.parent,
225
+ propertyName: path.propertyName,
226
+ ttl: ttlToUse
227
+ });
228
+ deepFreeze$2(input);
229
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
230
+ luvio.storePublish(key, incomingRecord);
231
+ }
232
+ {
233
+ const storeMetadataParams = {
234
+ ttl: ttlToUse,
235
+ namespace: "epc",
236
+ version: VERSION$1,
237
+ representationName: RepresentationType$1,
238
+ };
239
+ luvio.publishStoreMetadata(key, storeMetadataParams);
240
+ }
241
+ return createLink(key);
242
+ };
243
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
244
+ const rootKeySet = new engine.StoreKeyMap();
245
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
246
+ const rootKey = keyBuilderFromType$1(luvio, input);
247
+ rootKeySet.set(rootKey, {
248
+ namespace: keyPrefix,
249
+ representationName: RepresentationType$1,
250
+ mergeable: false
251
+ });
252
+ return rootKeySet;
253
+ }
254
+
255
+ function select$2(luvio, params) {
256
+ return select$3();
257
+ }
258
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
259
+ return getTypeCacheKeys$1(luvio, response);
260
+ }
261
+ function ingestSuccess$1(luvio, resourceParams, response) {
262
+ const { body } = response;
263
+ const key = keyBuilderFromType$1(luvio, body);
264
+ luvio.storeIngest(key, ingest$1, body);
265
+ const snapshot = luvio.storeLookup({
266
+ recordId: key,
267
+ node: select$2(),
268
+ variables: {},
269
+ });
270
+ if (process.env.NODE_ENV !== 'production') {
271
+ if (snapshot.state !== 'Fulfilled') {
272
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
273
+ }
274
+ }
275
+ return snapshot;
276
+ }
277
+ function createResourceRequest$1(config) {
278
+ const headers = {};
279
+ return {
280
+ baseUri: '/services/data/v58.0',
281
+ basePath: '/connect/epc/actions/deactivate',
282
+ method: 'patch',
283
+ body: config.body,
284
+ urlParams: {},
285
+ queryParams: {},
286
+ headers,
287
+ priority: 'normal',
288
+ };
289
+ }
290
+
291
+ const deactivate_ConfigPropertyNames = {
292
+ displayName: 'deactivate',
293
+ parameters: {
294
+ required: ['deactivateInputPayload'],
295
+ optional: []
296
+ }
297
+ };
298
+ function createResourceParams$1(config) {
299
+ const resourceParams = {
300
+ body: {
301
+ deactivateInputPayload: config.deactivateInputPayload
302
+ }
303
+ };
304
+ return resourceParams;
305
+ }
306
+ function typeCheckConfig$1(untrustedConfig) {
307
+ const config = {};
308
+ const untrustedConfig_deactivateInputPayload = untrustedConfig.deactivateInputPayload;
309
+ const referenceDeactivateInputRepresentationValidationError = validate$5(untrustedConfig_deactivateInputPayload);
310
+ if (referenceDeactivateInputRepresentationValidationError === null) {
311
+ config.deactivateInputPayload = untrustedConfig_deactivateInputPayload;
312
+ }
313
+ return config;
314
+ }
315
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
316
+ if (!untrustedIsObject(untrustedConfig)) {
317
+ return null;
318
+ }
319
+ if (process.env.NODE_ENV !== 'production') {
320
+ validateConfig(untrustedConfig, configPropertyNames);
321
+ }
322
+ const config = typeCheckConfig$1(untrustedConfig);
323
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
324
+ return null;
325
+ }
326
+ return config;
327
+ }
328
+ function buildNetworkSnapshot$1(luvio, config, options) {
329
+ const resourceParams = createResourceParams$1(config);
330
+ const request = createResourceRequest$1(resourceParams);
331
+ return luvio.dispatchResourceRequest(request, options)
332
+ .then((response) => {
333
+ return luvio.handleSuccessResponse(() => {
334
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
335
+ return luvio.storeBroadcast().then(() => snapshot);
336
+ }, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
337
+ }, (response) => {
338
+ deepFreeze$4(response);
339
+ throw response;
340
+ });
341
+ }
342
+ const deactivateAdapterFactory = (luvio) => {
343
+ return function deactivate(untrustedConfig) {
344
+ const config = validateAdapterConfig$1(untrustedConfig, deactivate_ConfigPropertyNames);
345
+ // Invalid or incomplete config
346
+ if (config === null) {
347
+ throw new Error('Invalid config for "deactivate"');
348
+ }
349
+ return buildNetworkSnapshot$1(luvio, config);
350
+ };
351
+ };
352
+
353
+ function validate$2(obj, path = 'ProductAttributeDefinitionListInputRepresentation') {
354
+ const v_error = (() => {
355
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
356
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
357
+ }
358
+ const obj_productAttributeDefinitions = obj.productAttributeDefinitions;
359
+ const path_productAttributeDefinitions = path + '.productAttributeDefinitions';
360
+ if (!ArrayIsArray(obj_productAttributeDefinitions)) {
361
+ return new TypeError('Expected "array" but received "' + typeof obj_productAttributeDefinitions + '" (at "' + path_productAttributeDefinitions + '")');
362
+ }
363
+ for (let i = 0; i < obj_productAttributeDefinitions.length; i++) {
364
+ const obj_productAttributeDefinitions_item = obj_productAttributeDefinitions[i];
365
+ const path_productAttributeDefinitions_item = path_productAttributeDefinitions + '[' + i + ']';
366
+ if (typeof obj_productAttributeDefinitions_item !== 'object' || ArrayIsArray(obj_productAttributeDefinitions_item) || obj_productAttributeDefinitions_item === null) {
367
+ return new TypeError('Expected "object" but received "' + typeof obj_productAttributeDefinitions_item + '" (at "' + path_productAttributeDefinitions_item + '")');
368
+ }
369
+ }
370
+ })();
371
+ return v_error === undefined ? null : v_error;
372
+ }
373
+
374
+ function validate$1(obj, path = 'ProductAttributeDefinitionRepresentation') {
375
+ const v_error = (() => {
376
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
377
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
378
+ }
379
+ if (obj.attributeDefinitionName !== undefined) {
380
+ const obj_attributeDefinitionName = obj.attributeDefinitionName;
381
+ const path_attributeDefinitionName = path + '.attributeDefinitionName';
382
+ if (typeof obj_attributeDefinitionName !== 'string') {
383
+ return new TypeError('Expected "string" but received "' + typeof obj_attributeDefinitionName + '" (at "' + path_attributeDefinitionName + '")');
384
+ }
385
+ }
386
+ if (obj.recordId !== undefined) {
387
+ const obj_recordId = obj.recordId;
388
+ const path_recordId = path + '.recordId';
389
+ if (typeof obj_recordId !== 'string') {
390
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
391
+ }
392
+ }
393
+ })();
394
+ return v_error === undefined ? null : v_error;
395
+ }
396
+ function deepFreeze$1(input) {
397
+ ObjectFreeze(input);
398
+ }
399
+
400
+ const TTL = 6000;
401
+ const VERSION = "e67d3c8569b9667eac98cc1a9840041c";
402
+ function validate(obj, path = 'ProductAttributeDefinitionListRepresentation') {
403
+ const v_error = (() => {
404
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
405
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
406
+ }
407
+ const obj_data = obj.data;
408
+ const path_data = path + '.data';
409
+ if (!ArrayIsArray(obj_data)) {
410
+ return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
411
+ }
412
+ for (let i = 0; i < obj_data.length; i++) {
413
+ const obj_data_item = obj_data[i];
414
+ const path_data_item = path_data + '[' + i + ']';
415
+ const referencepath_data_itemValidationError = validate$1(obj_data_item, path_data_item);
416
+ if (referencepath_data_itemValidationError !== null) {
417
+ let message = 'Object doesn\'t match ProductAttributeDefinitionRepresentation (at "' + path_data_item + '")\n';
418
+ message += referencepath_data_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
419
+ return new TypeError(message);
420
+ }
421
+ }
422
+ const obj_message = obj.message;
423
+ const path_message = path + '.message';
424
+ if (typeof obj_message !== 'string') {
425
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
426
+ }
427
+ })();
428
+ return v_error === undefined ? null : v_error;
429
+ }
430
+ const RepresentationType = 'ProductAttributeDefinitionListRepresentation';
431
+ function keyBuilder(luvio, config) {
432
+ return keyPrefix + '::' + RepresentationType + ':' + config.message;
433
+ }
434
+ function keyBuilderFromType(luvio, object) {
435
+ const keyParams = {
436
+ message: object.message
437
+ };
438
+ return keyBuilder(luvio, keyParams);
439
+ }
440
+ function normalize(input, existing, path, luvio, store, timestamp) {
441
+ return input;
442
+ }
443
+ const select$1 = function ProductAttributeDefinitionListRepresentationSelect() {
444
+ return {
445
+ kind: 'Fragment',
446
+ version: VERSION,
447
+ private: [],
448
+ opaque: true
449
+ };
450
+ };
451
+ function equals(existing, incoming) {
452
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
453
+ return false;
454
+ }
455
+ return true;
456
+ }
457
+ function deepFreeze(input) {
458
+ const input_data = input.data;
459
+ for (let i = 0; i < input_data.length; i++) {
460
+ const input_data_item = input_data[i];
461
+ deepFreeze$1(input_data_item);
462
+ }
463
+ ObjectFreeze(input_data);
464
+ ObjectFreeze(input);
465
+ }
466
+ const ingest = function ProductAttributeDefinitionListRepresentationIngest(input, path, luvio, store, timestamp) {
467
+ if (process.env.NODE_ENV !== 'production') {
468
+ const validateError = validate(input);
469
+ if (validateError !== null) {
470
+ throw validateError;
471
+ }
472
+ }
473
+ const key = keyBuilderFromType(luvio, input);
474
+ const existingRecord = store.readEntry(key);
475
+ const ttlToUse = TTL;
476
+ let incomingRecord = normalize(input, store.readEntry(key), {
477
+ fullPath: key,
478
+ parent: path.parent,
479
+ propertyName: path.propertyName,
480
+ ttl: ttlToUse
481
+ });
482
+ deepFreeze(input);
483
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
484
+ luvio.storePublish(key, incomingRecord);
485
+ }
486
+ {
487
+ const storeMetadataParams = {
488
+ ttl: ttlToUse,
489
+ namespace: "epc",
490
+ version: VERSION,
491
+ representationName: RepresentationType,
492
+ };
493
+ luvio.publishStoreMetadata(key, storeMetadataParams);
494
+ }
495
+ return createLink(key);
496
+ };
497
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
498
+ const rootKeySet = new engine.StoreKeyMap();
499
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
500
+ const rootKey = keyBuilderFromType(luvio, input);
501
+ rootKeySet.set(rootKey, {
502
+ namespace: keyPrefix,
503
+ representationName: RepresentationType,
504
+ mergeable: false
505
+ });
506
+ return rootKeySet;
507
+ }
508
+
509
+ function select(luvio, params) {
510
+ return select$1();
511
+ }
512
+ function getResponseCacheKeys(luvio, resourceParams, response) {
513
+ return getTypeCacheKeys(luvio, response);
514
+ }
515
+ function ingestSuccess(luvio, resourceParams, response) {
516
+ const { body } = response;
517
+ const key = keyBuilderFromType(luvio, body);
518
+ luvio.storeIngest(key, ingest, body);
519
+ const snapshot = luvio.storeLookup({
520
+ recordId: key,
521
+ node: select(),
522
+ variables: {},
523
+ });
524
+ if (process.env.NODE_ENV !== 'production') {
525
+ if (snapshot.state !== 'Fulfilled') {
526
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
527
+ }
528
+ }
529
+ return snapshot;
530
+ }
531
+ function createResourceRequest(config) {
532
+ const headers = {};
533
+ return {
534
+ baseUri: '/services/data/v58.0',
535
+ basePath: '/connect/epc/product-attribute-definition',
536
+ method: 'post',
537
+ body: config.body,
538
+ urlParams: {},
539
+ queryParams: {},
540
+ headers,
541
+ priority: 'normal',
542
+ };
543
+ }
544
+
545
+ const createProductAttributeDefinition_ConfigPropertyNames = {
546
+ displayName: 'createProductAttributeDefinition',
547
+ parameters: {
548
+ required: ['productAttributeDefinitionListInputPayload'],
549
+ optional: []
550
+ }
551
+ };
552
+ function createResourceParams(config) {
553
+ const resourceParams = {
554
+ body: {
555
+ productAttributeDefinitionListInputPayload: config.productAttributeDefinitionListInputPayload
556
+ }
557
+ };
558
+ return resourceParams;
559
+ }
560
+ function typeCheckConfig(untrustedConfig) {
561
+ const config = {};
562
+ const untrustedConfig_productAttributeDefinitionListInputPayload = untrustedConfig.productAttributeDefinitionListInputPayload;
563
+ const referenceProductAttributeDefinitionListInputRepresentationValidationError = validate$2(untrustedConfig_productAttributeDefinitionListInputPayload);
564
+ if (referenceProductAttributeDefinitionListInputRepresentationValidationError === null) {
565
+ config.productAttributeDefinitionListInputPayload = untrustedConfig_productAttributeDefinitionListInputPayload;
566
+ }
567
+ return config;
568
+ }
569
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
570
+ if (!untrustedIsObject(untrustedConfig)) {
571
+ return null;
572
+ }
573
+ if (process.env.NODE_ENV !== 'production') {
574
+ validateConfig(untrustedConfig, configPropertyNames);
575
+ }
576
+ const config = typeCheckConfig(untrustedConfig);
577
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
578
+ return null;
579
+ }
580
+ return config;
581
+ }
582
+ function buildNetworkSnapshot(luvio, config, options) {
583
+ const resourceParams = createResourceParams(config);
584
+ const request = createResourceRequest(resourceParams);
585
+ return luvio.dispatchResourceRequest(request, options)
586
+ .then((response) => {
587
+ return luvio.handleSuccessResponse(() => {
588
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
589
+ return luvio.storeBroadcast().then(() => snapshot);
590
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
591
+ }, (response) => {
592
+ deepFreeze$4(response);
593
+ throw response;
594
+ });
595
+ }
596
+ const createProductAttributeDefinitionAdapterFactory = (luvio) => {
597
+ return function createProductAttributeDefinition(untrustedConfig) {
598
+ const config = validateAdapterConfig(untrustedConfig, createProductAttributeDefinition_ConfigPropertyNames);
599
+ // Invalid or incomplete config
600
+ if (config === null) {
601
+ throw new Error('Invalid config for "createProductAttributeDefinition"');
602
+ }
603
+ return buildNetworkSnapshot(luvio, config);
604
+ };
605
+ };
606
+
607
+ exports.createProductAttributeDefinitionAdapterFactory = createProductAttributeDefinitionAdapterFactory;
608
+ exports.deactivateAdapterFactory = deactivateAdapterFactory;
609
+
610
+ Object.defineProperty(exports, '__esModule', { value: true });
611
+
612
+ }));