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