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