@salesforce/lds-adapters-industries-cpq 1.124.2 → 1.124.4
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-cpq.js +425 -425
- package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
- package/dist/{types → es/es2018/types}/src/generated/adapters/preview.d.ts +15 -15
- package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +1 -1
- package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +2 -2
- package/dist/{types → es/es2018/types}/src/generated/resources/postConnectCpqPreview.d.ts +13 -13
- package/dist/{types → es/es2018/types}/src/generated/types/CpqBaseListOutputRepresentation.d.ts +71 -71
- package/dist/{types → es/es2018/types}/src/generated/types/PreviewInputRepresentation.d.ts +46 -46
- package/dist/{types → es/es2018/types}/src/generated/types/PreviewInputRepresentationWrapper.d.ts +30 -30
- package/dist/{types → es/es2018/types}/src/generated/types/ProductConfigurationInputRepresentation.d.ts +32 -32
- 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 +441 -441
- package/dist/umd/es2018/industries-cpq.js +0 -456
- package/dist/umd/es5/industries-cpq.js +0 -459
|
@@ -6,443 +6,443 @@
|
|
|
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 = 'cpq';
|
|
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$1(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$1(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$1(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$1(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$1(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$1(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$2(obj, path = 'ProductConfigurationInputRepresentation') {
|
|
74
|
-
const v_error = (() => {
|
|
75
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
76
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
77
|
-
}
|
|
78
|
-
if (obj.configuration !== undefined) {
|
|
79
|
-
const obj_configuration = obj.configuration;
|
|
80
|
-
const path_configuration = path + '.configuration';
|
|
81
|
-
if (typeof obj_configuration !== 'object' || ArrayIsArray(obj_configuration) || obj_configuration === null) {
|
|
82
|
-
return new TypeError('Expected "object" but received "' + typeof obj_configuration + '" (at "' + path_configuration + '")');
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (obj.productId !== undefined) {
|
|
86
|
-
const obj_productId = obj.productId;
|
|
87
|
-
const path_productId = path + '.productId';
|
|
88
|
-
if (typeof obj_productId !== 'string') {
|
|
89
|
-
return new TypeError('Expected "string" but received "' + typeof obj_productId + '" (at "' + path_productId + '")');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
})();
|
|
93
|
-
return v_error === undefined ? null : v_error;
|
|
73
|
+
function validate$2(obj, path = 'ProductConfigurationInputRepresentation') {
|
|
74
|
+
const v_error = (() => {
|
|
75
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
76
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
77
|
+
}
|
|
78
|
+
if (obj.configuration !== undefined) {
|
|
79
|
+
const obj_configuration = obj.configuration;
|
|
80
|
+
const path_configuration = path + '.configuration';
|
|
81
|
+
if (typeof obj_configuration !== 'object' || ArrayIsArray(obj_configuration) || obj_configuration === null) {
|
|
82
|
+
return new TypeError('Expected "object" but received "' + typeof obj_configuration + '" (at "' + path_configuration + '")');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (obj.productId !== undefined) {
|
|
86
|
+
const obj_productId = obj.productId;
|
|
87
|
+
const path_productId = path + '.productId';
|
|
88
|
+
if (typeof obj_productId !== 'string') {
|
|
89
|
+
return new TypeError('Expected "string" but received "' + typeof obj_productId + '" (at "' + path_productId + '")');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
})();
|
|
93
|
+
return v_error === undefined ? null : v_error;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
function validate$1(obj, path = 'PreviewInputRepresentation') {
|
|
97
|
-
const v_error = (() => {
|
|
98
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
99
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
100
|
-
}
|
|
101
|
-
if (obj.cartId !== undefined) {
|
|
102
|
-
const obj_cartId = obj.cartId;
|
|
103
|
-
const path_cartId = path + '.cartId';
|
|
104
|
-
if (typeof obj_cartId !== 'string') {
|
|
105
|
-
return new TypeError('Expected "string" but received "' + typeof obj_cartId + '" (at "' + path_cartId + '")');
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
if (obj.configuredItems !== undefined) {
|
|
109
|
-
const obj_configuredItems = obj.configuredItems;
|
|
110
|
-
const path_configuredItems = path + '.configuredItems';
|
|
111
|
-
if (!ArrayIsArray(obj_configuredItems)) {
|
|
112
|
-
return new TypeError('Expected "array" but received "' + typeof obj_configuredItems + '" (at "' + path_configuredItems + '")');
|
|
113
|
-
}
|
|
114
|
-
for (let i = 0; i < obj_configuredItems.length; i++) {
|
|
115
|
-
const obj_configuredItems_item = obj_configuredItems[i];
|
|
116
|
-
const path_configuredItems_item = path_configuredItems + '[' + i + ']';
|
|
117
|
-
const referencepath_configuredItems_itemValidationError = validate$2(obj_configuredItems_item, path_configuredItems_item);
|
|
118
|
-
if (referencepath_configuredItems_itemValidationError !== null) {
|
|
119
|
-
let message = 'Object doesn\'t match ProductConfigurationInputRepresentation (at "' + path_configuredItems_item + '")\n';
|
|
120
|
-
message += referencepath_configuredItems_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
121
|
-
return new TypeError(message);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
if (obj.correlationId !== undefined) {
|
|
126
|
-
const obj_correlationId = obj.correlationId;
|
|
127
|
-
const path_correlationId = path + '.correlationId';
|
|
128
|
-
if (typeof obj_correlationId !== 'string') {
|
|
129
|
-
return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (obj.customFields !== undefined) {
|
|
133
|
-
const obj_customFields = obj.customFields;
|
|
134
|
-
const path_customFields = path + '.customFields';
|
|
135
|
-
if (typeof obj_customFields !== 'object' || ArrayIsArray(obj_customFields) || obj_customFields === null) {
|
|
136
|
-
return new TypeError('Expected "object" but received "' + typeof obj_customFields + '" (at "' + path_customFields + '")');
|
|
137
|
-
}
|
|
138
|
-
const obj_customFields_keys = ObjectKeys(obj_customFields);
|
|
139
|
-
for (let i = 0; i < obj_customFields_keys.length; i++) {
|
|
140
|
-
const key = obj_customFields_keys[i];
|
|
141
|
-
const obj_customFields_prop = obj_customFields[key];
|
|
142
|
-
const path_customFields_prop = path_customFields + '["' + key + '"]';
|
|
143
|
-
if (typeof obj_customFields_prop !== 'string') {
|
|
144
|
-
return new TypeError('Expected "string" but received "' + typeof obj_customFields_prop + '" (at "' + path_customFields_prop + '")');
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (obj.userContext !== undefined) {
|
|
149
|
-
const obj_userContext = obj.userContext;
|
|
150
|
-
const path_userContext = path + '.userContext';
|
|
151
|
-
if (typeof obj_userContext !== 'object' || ArrayIsArray(obj_userContext) || obj_userContext === null) {
|
|
152
|
-
return new TypeError('Expected "object" but received "' + typeof obj_userContext + '" (at "' + path_userContext + '")');
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
})();
|
|
156
|
-
return v_error === undefined ? null : v_error;
|
|
96
|
+
function validate$1(obj, path = 'PreviewInputRepresentation') {
|
|
97
|
+
const v_error = (() => {
|
|
98
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
99
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
100
|
+
}
|
|
101
|
+
if (obj.cartId !== undefined) {
|
|
102
|
+
const obj_cartId = obj.cartId;
|
|
103
|
+
const path_cartId = path + '.cartId';
|
|
104
|
+
if (typeof obj_cartId !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_cartId + '" (at "' + path_cartId + '")');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (obj.configuredItems !== undefined) {
|
|
109
|
+
const obj_configuredItems = obj.configuredItems;
|
|
110
|
+
const path_configuredItems = path + '.configuredItems';
|
|
111
|
+
if (!ArrayIsArray(obj_configuredItems)) {
|
|
112
|
+
return new TypeError('Expected "array" but received "' + typeof obj_configuredItems + '" (at "' + path_configuredItems + '")');
|
|
113
|
+
}
|
|
114
|
+
for (let i = 0; i < obj_configuredItems.length; i++) {
|
|
115
|
+
const obj_configuredItems_item = obj_configuredItems[i];
|
|
116
|
+
const path_configuredItems_item = path_configuredItems + '[' + i + ']';
|
|
117
|
+
const referencepath_configuredItems_itemValidationError = validate$2(obj_configuredItems_item, path_configuredItems_item);
|
|
118
|
+
if (referencepath_configuredItems_itemValidationError !== null) {
|
|
119
|
+
let message = 'Object doesn\'t match ProductConfigurationInputRepresentation (at "' + path_configuredItems_item + '")\n';
|
|
120
|
+
message += referencepath_configuredItems_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
121
|
+
return new TypeError(message);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (obj.correlationId !== undefined) {
|
|
126
|
+
const obj_correlationId = obj.correlationId;
|
|
127
|
+
const path_correlationId = path + '.correlationId';
|
|
128
|
+
if (typeof obj_correlationId !== 'string') {
|
|
129
|
+
return new TypeError('Expected "string" but received "' + typeof obj_correlationId + '" (at "' + path_correlationId + '")');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (obj.customFields !== undefined) {
|
|
133
|
+
const obj_customFields = obj.customFields;
|
|
134
|
+
const path_customFields = path + '.customFields';
|
|
135
|
+
if (typeof obj_customFields !== 'object' || ArrayIsArray(obj_customFields) || obj_customFields === null) {
|
|
136
|
+
return new TypeError('Expected "object" but received "' + typeof obj_customFields + '" (at "' + path_customFields + '")');
|
|
137
|
+
}
|
|
138
|
+
const obj_customFields_keys = ObjectKeys(obj_customFields);
|
|
139
|
+
for (let i = 0; i < obj_customFields_keys.length; i++) {
|
|
140
|
+
const key = obj_customFields_keys[i];
|
|
141
|
+
const obj_customFields_prop = obj_customFields[key];
|
|
142
|
+
const path_customFields_prop = path_customFields + '["' + key + '"]';
|
|
143
|
+
if (typeof obj_customFields_prop !== 'string') {
|
|
144
|
+
return new TypeError('Expected "string" but received "' + typeof obj_customFields_prop + '" (at "' + path_customFields_prop + '")');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (obj.userContext !== undefined) {
|
|
149
|
+
const obj_userContext = obj.userContext;
|
|
150
|
+
const path_userContext = path + '.userContext';
|
|
151
|
+
if (typeof obj_userContext !== 'object' || ArrayIsArray(obj_userContext) || obj_userContext === null) {
|
|
152
|
+
return new TypeError('Expected "object" but received "' + typeof obj_userContext + '" (at "' + path_userContext + '")');
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
})();
|
|
156
|
+
return v_error === undefined ? null : v_error;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
const TTL = 1000;
|
|
160
|
-
const VERSION = "5f42d9d8a2278fc45355868ea236f9c6";
|
|
161
|
-
function validate(obj, path = 'CpqBaseListOutputRepresentation') {
|
|
162
|
-
const v_error = (() => {
|
|
163
|
-
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
164
|
-
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
165
|
-
}
|
|
166
|
-
if (obj.errorCode !== undefined) {
|
|
167
|
-
const obj_errorCode = obj.errorCode;
|
|
168
|
-
const path_errorCode = path + '.errorCode';
|
|
169
|
-
if (typeof obj_errorCode !== 'string') {
|
|
170
|
-
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (obj.errorDetails !== undefined) {
|
|
174
|
-
const obj_errorDetails = obj.errorDetails;
|
|
175
|
-
const path_errorDetails = path + '.errorDetails';
|
|
176
|
-
if (typeof obj_errorDetails !== 'string') {
|
|
177
|
-
return new TypeError('Expected "string" but received "' + typeof obj_errorDetails + '" (at "' + path_errorDetails + '")');
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
if (obj.errorMessage !== undefined) {
|
|
181
|
-
const obj_errorMessage = obj.errorMessage;
|
|
182
|
-
const path_errorMessage = path + '.errorMessage';
|
|
183
|
-
if (typeof obj_errorMessage !== 'string') {
|
|
184
|
-
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
if (obj.limit !== undefined) {
|
|
188
|
-
const obj_limit = obj.limit;
|
|
189
|
-
const path_limit = path + '.limit';
|
|
190
|
-
if (typeof obj_limit !== 'number' || (typeof obj_limit === 'number' && Math.floor(obj_limit) !== obj_limit)) {
|
|
191
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_limit + '" (at "' + path_limit + '")');
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
if (obj.offSet !== undefined) {
|
|
195
|
-
const obj_offSet = obj.offSet;
|
|
196
|
-
const path_offSet = path + '.offSet';
|
|
197
|
-
if (typeof obj_offSet !== 'number' || (typeof obj_offSet === 'number' && Math.floor(obj_offSet) !== obj_offSet)) {
|
|
198
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_offSet + '" (at "' + path_offSet + '")');
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (obj.query !== undefined) {
|
|
202
|
-
const obj_query = obj.query;
|
|
203
|
-
const path_query = path + '.query';
|
|
204
|
-
if (typeof obj_query !== 'object' || ArrayIsArray(obj_query) || obj_query === null) {
|
|
205
|
-
return new TypeError('Expected "object" but received "' + typeof obj_query + '" (at "' + path_query + '")');
|
|
206
|
-
}
|
|
207
|
-
const obj_query_keys = ObjectKeys(obj_query);
|
|
208
|
-
for (let i = 0; i < obj_query_keys.length; i++) {
|
|
209
|
-
const key = obj_query_keys[i];
|
|
210
|
-
const obj_query_prop = obj_query[key];
|
|
211
|
-
const path_query_prop = path_query + '["' + key + '"]';
|
|
212
|
-
if (typeof obj_query_prop !== 'object' || ArrayIsArray(obj_query_prop) || obj_query_prop === null) {
|
|
213
|
-
return new TypeError('Expected "object" but received "' + typeof obj_query_prop + '" (at "' + path_query_prop + '")');
|
|
214
|
-
}
|
|
215
|
-
const obj_query_prop_keys = ObjectKeys(obj_query_prop);
|
|
216
|
-
for (let i = 0; i < obj_query_prop_keys.length; i++) {
|
|
217
|
-
const key = obj_query_prop_keys[i];
|
|
218
|
-
const obj_query_prop_prop = obj_query_prop[key];
|
|
219
|
-
const path_query_prop_prop = path_query_prop + '["' + key + '"]';
|
|
220
|
-
if (typeof obj_query_prop_prop !== 'object' || ArrayIsArray(obj_query_prop_prop) || obj_query_prop_prop === null) {
|
|
221
|
-
return new TypeError('Expected "object" but received "' + typeof obj_query_prop_prop + '" (at "' + path_query_prop_prop + '")');
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
const obj_result = obj.result;
|
|
227
|
-
const path_result = path + '.result';
|
|
228
|
-
if (!ArrayIsArray(obj_result)) {
|
|
229
|
-
return new TypeError('Expected "array" but received "' + typeof obj_result + '" (at "' + path_result + '")');
|
|
230
|
-
}
|
|
231
|
-
for (let i = 0; i < obj_result.length; i++) {
|
|
232
|
-
const obj_result_item = obj_result[i];
|
|
233
|
-
const path_result_item = path_result + '[' + i + ']';
|
|
234
|
-
if (obj_result_item === undefined) {
|
|
235
|
-
return new TypeError('Expected "defined" but received "' + typeof obj_result_item + '" (at "' + path_result_item + '")');
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
const obj_status = obj.status;
|
|
239
|
-
const path_status = path + '.status';
|
|
240
|
-
if (typeof obj_status !== 'string') {
|
|
241
|
-
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
242
|
-
}
|
|
243
|
-
if (obj.total !== undefined) {
|
|
244
|
-
const obj_total = obj.total;
|
|
245
|
-
const path_total = path + '.total';
|
|
246
|
-
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
247
|
-
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
})();
|
|
251
|
-
return v_error === undefined ? null : v_error;
|
|
252
|
-
}
|
|
253
|
-
const RepresentationType = 'CpqBaseListOutputRepresentation';
|
|
254
|
-
function keyBuilder(luvio, config) {
|
|
255
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.message;
|
|
256
|
-
}
|
|
257
|
-
function keyBuilderFromType(luvio, object) {
|
|
258
|
-
const keyParams = {
|
|
259
|
-
message: object.status
|
|
260
|
-
};
|
|
261
|
-
return keyBuilder(luvio, keyParams);
|
|
262
|
-
}
|
|
263
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
264
|
-
return input;
|
|
265
|
-
}
|
|
266
|
-
const select$1 = function CpqBaseListOutputRepresentationSelect() {
|
|
267
|
-
return {
|
|
268
|
-
kind: 'Fragment',
|
|
269
|
-
version: VERSION,
|
|
270
|
-
private: [],
|
|
271
|
-
opaque: true
|
|
272
|
-
};
|
|
273
|
-
};
|
|
274
|
-
function equals(existing, incoming) {
|
|
275
|
-
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
return true;
|
|
279
|
-
}
|
|
280
|
-
function deepFreeze(input) {
|
|
281
|
-
const input_query = input.query;
|
|
282
|
-
if (input_query !== undefined) {
|
|
283
|
-
const input_query_keys = Object.keys(input_query);
|
|
284
|
-
const input_query_length = input_query_keys.length;
|
|
285
|
-
for (let i = 0; i < input_query_length; i++) {
|
|
286
|
-
const key = input_query_keys[i];
|
|
287
|
-
const input_query_prop = input_query[key];
|
|
288
|
-
const input_query_prop_keys = Object.keys(input_query_prop);
|
|
289
|
-
const input_query_prop_length = input_query_prop_keys.length;
|
|
290
|
-
for (let i = 0; i < input_query_prop_length; i++) {
|
|
291
|
-
const key = input_query_prop_keys[i];
|
|
292
|
-
const input_query_prop_prop = input_query_prop[key];
|
|
293
|
-
ObjectFreeze(input_query_prop_prop);
|
|
294
|
-
}
|
|
295
|
-
ObjectFreeze(input_query_prop);
|
|
296
|
-
}
|
|
297
|
-
ObjectFreeze(input_query);
|
|
298
|
-
}
|
|
299
|
-
const input_result = input.result;
|
|
300
|
-
for (let i = 0; i < input_result.length; i++) {
|
|
301
|
-
const input_result_item = input_result[i];
|
|
302
|
-
deepFreeze$1(input_result_item);
|
|
303
|
-
}
|
|
304
|
-
ObjectFreeze(input_result);
|
|
305
|
-
ObjectFreeze(input);
|
|
306
|
-
}
|
|
307
|
-
const ingest = function CpqBaseListOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
308
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
309
|
-
const validateError = validate(input);
|
|
310
|
-
if (validateError !== null) {
|
|
311
|
-
throw validateError;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
const key = keyBuilderFromType(luvio, input);
|
|
315
|
-
const existingRecord = store.readEntry(key);
|
|
316
|
-
const ttlToUse = TTL;
|
|
317
|
-
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
318
|
-
fullPath: key,
|
|
319
|
-
parent: path.parent,
|
|
320
|
-
propertyName: path.propertyName,
|
|
321
|
-
ttl: ttlToUse
|
|
322
|
-
});
|
|
323
|
-
deepFreeze(input);
|
|
324
|
-
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
325
|
-
luvio.storePublish(key, incomingRecord);
|
|
326
|
-
}
|
|
327
|
-
{
|
|
328
|
-
const storeMetadataParams = {
|
|
329
|
-
ttl: ttlToUse,
|
|
330
|
-
namespace: "cpq",
|
|
331
|
-
version: VERSION,
|
|
332
|
-
representationName: RepresentationType,
|
|
333
|
-
};
|
|
334
|
-
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
335
|
-
}
|
|
336
|
-
return createLink(key);
|
|
337
|
-
};
|
|
338
|
-
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
339
|
-
const rootKeySet = new StoreKeyMap();
|
|
340
|
-
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
341
|
-
const rootKey = keyBuilderFromType(luvio, input);
|
|
342
|
-
rootKeySet.set(rootKey, {
|
|
343
|
-
namespace: keyPrefix,
|
|
344
|
-
representationName: RepresentationType,
|
|
345
|
-
mergeable: false
|
|
346
|
-
});
|
|
347
|
-
return rootKeySet;
|
|
159
|
+
const TTL = 1000;
|
|
160
|
+
const VERSION = "5f42d9d8a2278fc45355868ea236f9c6";
|
|
161
|
+
function validate(obj, path = 'CpqBaseListOutputRepresentation') {
|
|
162
|
+
const v_error = (() => {
|
|
163
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
164
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
165
|
+
}
|
|
166
|
+
if (obj.errorCode !== undefined) {
|
|
167
|
+
const obj_errorCode = obj.errorCode;
|
|
168
|
+
const path_errorCode = path + '.errorCode';
|
|
169
|
+
if (typeof obj_errorCode !== 'string') {
|
|
170
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (obj.errorDetails !== undefined) {
|
|
174
|
+
const obj_errorDetails = obj.errorDetails;
|
|
175
|
+
const path_errorDetails = path + '.errorDetails';
|
|
176
|
+
if (typeof obj_errorDetails !== 'string') {
|
|
177
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorDetails + '" (at "' + path_errorDetails + '")');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (obj.errorMessage !== undefined) {
|
|
181
|
+
const obj_errorMessage = obj.errorMessage;
|
|
182
|
+
const path_errorMessage = path + '.errorMessage';
|
|
183
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
184
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (obj.limit !== undefined) {
|
|
188
|
+
const obj_limit = obj.limit;
|
|
189
|
+
const path_limit = path + '.limit';
|
|
190
|
+
if (typeof obj_limit !== 'number' || (typeof obj_limit === 'number' && Math.floor(obj_limit) !== obj_limit)) {
|
|
191
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_limit + '" (at "' + path_limit + '")');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (obj.offSet !== undefined) {
|
|
195
|
+
const obj_offSet = obj.offSet;
|
|
196
|
+
const path_offSet = path + '.offSet';
|
|
197
|
+
if (typeof obj_offSet !== 'number' || (typeof obj_offSet === 'number' && Math.floor(obj_offSet) !== obj_offSet)) {
|
|
198
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_offSet + '" (at "' + path_offSet + '")');
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (obj.query !== undefined) {
|
|
202
|
+
const obj_query = obj.query;
|
|
203
|
+
const path_query = path + '.query';
|
|
204
|
+
if (typeof obj_query !== 'object' || ArrayIsArray(obj_query) || obj_query === null) {
|
|
205
|
+
return new TypeError('Expected "object" but received "' + typeof obj_query + '" (at "' + path_query + '")');
|
|
206
|
+
}
|
|
207
|
+
const obj_query_keys = ObjectKeys(obj_query);
|
|
208
|
+
for (let i = 0; i < obj_query_keys.length; i++) {
|
|
209
|
+
const key = obj_query_keys[i];
|
|
210
|
+
const obj_query_prop = obj_query[key];
|
|
211
|
+
const path_query_prop = path_query + '["' + key + '"]';
|
|
212
|
+
if (typeof obj_query_prop !== 'object' || ArrayIsArray(obj_query_prop) || obj_query_prop === null) {
|
|
213
|
+
return new TypeError('Expected "object" but received "' + typeof obj_query_prop + '" (at "' + path_query_prop + '")');
|
|
214
|
+
}
|
|
215
|
+
const obj_query_prop_keys = ObjectKeys(obj_query_prop);
|
|
216
|
+
for (let i = 0; i < obj_query_prop_keys.length; i++) {
|
|
217
|
+
const key = obj_query_prop_keys[i];
|
|
218
|
+
const obj_query_prop_prop = obj_query_prop[key];
|
|
219
|
+
const path_query_prop_prop = path_query_prop + '["' + key + '"]';
|
|
220
|
+
if (typeof obj_query_prop_prop !== 'object' || ArrayIsArray(obj_query_prop_prop) || obj_query_prop_prop === null) {
|
|
221
|
+
return new TypeError('Expected "object" but received "' + typeof obj_query_prop_prop + '" (at "' + path_query_prop_prop + '")');
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const obj_result = obj.result;
|
|
227
|
+
const path_result = path + '.result';
|
|
228
|
+
if (!ArrayIsArray(obj_result)) {
|
|
229
|
+
return new TypeError('Expected "array" but received "' + typeof obj_result + '" (at "' + path_result + '")');
|
|
230
|
+
}
|
|
231
|
+
for (let i = 0; i < obj_result.length; i++) {
|
|
232
|
+
const obj_result_item = obj_result[i];
|
|
233
|
+
const path_result_item = path_result + '[' + i + ']';
|
|
234
|
+
if (obj_result_item === undefined) {
|
|
235
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_result_item + '" (at "' + path_result_item + '")');
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const obj_status = obj.status;
|
|
239
|
+
const path_status = path + '.status';
|
|
240
|
+
if (typeof obj_status !== 'string') {
|
|
241
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
242
|
+
}
|
|
243
|
+
if (obj.total !== undefined) {
|
|
244
|
+
const obj_total = obj.total;
|
|
245
|
+
const path_total = path + '.total';
|
|
246
|
+
if (typeof obj_total !== 'number' || (typeof obj_total === 'number' && Math.floor(obj_total) !== obj_total)) {
|
|
247
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_total + '" (at "' + path_total + '")');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
})();
|
|
251
|
+
return v_error === undefined ? null : v_error;
|
|
252
|
+
}
|
|
253
|
+
const RepresentationType = 'CpqBaseListOutputRepresentation';
|
|
254
|
+
function keyBuilder(luvio, config) {
|
|
255
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.message;
|
|
256
|
+
}
|
|
257
|
+
function keyBuilderFromType(luvio, object) {
|
|
258
|
+
const keyParams = {
|
|
259
|
+
message: object.status
|
|
260
|
+
};
|
|
261
|
+
return keyBuilder(luvio, keyParams);
|
|
262
|
+
}
|
|
263
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
264
|
+
return input;
|
|
265
|
+
}
|
|
266
|
+
const select$1 = function CpqBaseListOutputRepresentationSelect() {
|
|
267
|
+
return {
|
|
268
|
+
kind: 'Fragment',
|
|
269
|
+
version: VERSION,
|
|
270
|
+
private: [],
|
|
271
|
+
opaque: true
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
function equals(existing, incoming) {
|
|
275
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
function deepFreeze(input) {
|
|
281
|
+
const input_query = input.query;
|
|
282
|
+
if (input_query !== undefined) {
|
|
283
|
+
const input_query_keys = Object.keys(input_query);
|
|
284
|
+
const input_query_length = input_query_keys.length;
|
|
285
|
+
for (let i = 0; i < input_query_length; i++) {
|
|
286
|
+
const key = input_query_keys[i];
|
|
287
|
+
const input_query_prop = input_query[key];
|
|
288
|
+
const input_query_prop_keys = Object.keys(input_query_prop);
|
|
289
|
+
const input_query_prop_length = input_query_prop_keys.length;
|
|
290
|
+
for (let i = 0; i < input_query_prop_length; i++) {
|
|
291
|
+
const key = input_query_prop_keys[i];
|
|
292
|
+
const input_query_prop_prop = input_query_prop[key];
|
|
293
|
+
ObjectFreeze(input_query_prop_prop);
|
|
294
|
+
}
|
|
295
|
+
ObjectFreeze(input_query_prop);
|
|
296
|
+
}
|
|
297
|
+
ObjectFreeze(input_query);
|
|
298
|
+
}
|
|
299
|
+
const input_result = input.result;
|
|
300
|
+
for (let i = 0; i < input_result.length; i++) {
|
|
301
|
+
const input_result_item = input_result[i];
|
|
302
|
+
deepFreeze$1(input_result_item);
|
|
303
|
+
}
|
|
304
|
+
ObjectFreeze(input_result);
|
|
305
|
+
ObjectFreeze(input);
|
|
306
|
+
}
|
|
307
|
+
const ingest = function CpqBaseListOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
308
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
309
|
+
const validateError = validate(input);
|
|
310
|
+
if (validateError !== null) {
|
|
311
|
+
throw validateError;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const key = keyBuilderFromType(luvio, input);
|
|
315
|
+
const existingRecord = store.readEntry(key);
|
|
316
|
+
const ttlToUse = TTL;
|
|
317
|
+
let incomingRecord = normalize(input, store.readEntry(key), {
|
|
318
|
+
fullPath: key,
|
|
319
|
+
parent: path.parent,
|
|
320
|
+
propertyName: path.propertyName,
|
|
321
|
+
ttl: ttlToUse
|
|
322
|
+
});
|
|
323
|
+
deepFreeze(input);
|
|
324
|
+
if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
|
|
325
|
+
luvio.storePublish(key, incomingRecord);
|
|
326
|
+
}
|
|
327
|
+
{
|
|
328
|
+
const storeMetadataParams = {
|
|
329
|
+
ttl: ttlToUse,
|
|
330
|
+
namespace: "cpq",
|
|
331
|
+
version: VERSION,
|
|
332
|
+
representationName: RepresentationType,
|
|
333
|
+
};
|
|
334
|
+
luvio.publishStoreMetadata(key, storeMetadataParams);
|
|
335
|
+
}
|
|
336
|
+
return createLink(key);
|
|
337
|
+
};
|
|
338
|
+
function getTypeCacheKeys(luvio, input, fullPathFactory) {
|
|
339
|
+
const rootKeySet = new StoreKeyMap();
|
|
340
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
341
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
342
|
+
rootKeySet.set(rootKey, {
|
|
343
|
+
namespace: keyPrefix,
|
|
344
|
+
representationName: RepresentationType,
|
|
345
|
+
mergeable: false
|
|
346
|
+
});
|
|
347
|
+
return rootKeySet;
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
function select(luvio, params) {
|
|
351
|
-
return select$1();
|
|
352
|
-
}
|
|
353
|
-
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
354
|
-
return getTypeCacheKeys(luvio, response);
|
|
355
|
-
}
|
|
356
|
-
function ingestSuccess(luvio, resourceParams, response) {
|
|
357
|
-
const { body } = response;
|
|
358
|
-
const key = keyBuilderFromType(luvio, body);
|
|
359
|
-
luvio.storeIngest(key, ingest, body);
|
|
360
|
-
const snapshot = luvio.storeLookup({
|
|
361
|
-
recordId: key,
|
|
362
|
-
node: select(),
|
|
363
|
-
variables: {},
|
|
364
|
-
});
|
|
365
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
366
|
-
if (snapshot.state !== 'Fulfilled') {
|
|
367
|
-
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return snapshot;
|
|
371
|
-
}
|
|
372
|
-
function createResourceRequest(config) {
|
|
373
|
-
const headers = {};
|
|
374
|
-
return {
|
|
375
|
-
baseUri: '/services/data/v58.0',
|
|
376
|
-
basePath: '/connect/cpq/preview',
|
|
377
|
-
method: 'post',
|
|
378
|
-
body: config.body,
|
|
379
|
-
urlParams: {},
|
|
380
|
-
queryParams: {},
|
|
381
|
-
headers,
|
|
382
|
-
priority: 'normal',
|
|
383
|
-
};
|
|
350
|
+
function select(luvio, params) {
|
|
351
|
+
return select$1();
|
|
352
|
+
}
|
|
353
|
+
function getResponseCacheKeys(luvio, resourceParams, response) {
|
|
354
|
+
return getTypeCacheKeys(luvio, response);
|
|
355
|
+
}
|
|
356
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
357
|
+
const { body } = response;
|
|
358
|
+
const key = keyBuilderFromType(luvio, body);
|
|
359
|
+
luvio.storeIngest(key, ingest, body);
|
|
360
|
+
const snapshot = luvio.storeLookup({
|
|
361
|
+
recordId: key,
|
|
362
|
+
node: select(),
|
|
363
|
+
variables: {},
|
|
364
|
+
});
|
|
365
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
366
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
367
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
return snapshot;
|
|
371
|
+
}
|
|
372
|
+
function createResourceRequest(config) {
|
|
373
|
+
const headers = {};
|
|
374
|
+
return {
|
|
375
|
+
baseUri: '/services/data/v58.0',
|
|
376
|
+
basePath: '/connect/cpq/preview',
|
|
377
|
+
method: 'post',
|
|
378
|
+
body: config.body,
|
|
379
|
+
urlParams: {},
|
|
380
|
+
queryParams: {},
|
|
381
|
+
headers,
|
|
382
|
+
priority: 'normal',
|
|
383
|
+
};
|
|
384
384
|
}
|
|
385
385
|
|
|
386
|
-
const preview_ConfigPropertyNames = {
|
|
387
|
-
displayName: 'preview',
|
|
388
|
-
parameters: {
|
|
389
|
-
required: ['previewInput'],
|
|
390
|
-
optional: []
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
function createResourceParams(config) {
|
|
394
|
-
const resourceParams = {
|
|
395
|
-
body: {
|
|
396
|
-
previewInput: config.previewInput
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
return resourceParams;
|
|
400
|
-
}
|
|
401
|
-
function typeCheckConfig(untrustedConfig) {
|
|
402
|
-
const config = {};
|
|
403
|
-
const untrustedConfig_previewInput = untrustedConfig.previewInput;
|
|
404
|
-
const referencePreviewInputRepresentationValidationError = validate$1(untrustedConfig_previewInput);
|
|
405
|
-
if (referencePreviewInputRepresentationValidationError === null) {
|
|
406
|
-
config.previewInput = untrustedConfig_previewInput;
|
|
407
|
-
}
|
|
408
|
-
return config;
|
|
409
|
-
}
|
|
410
|
-
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
411
|
-
if (!untrustedIsObject(untrustedConfig)) {
|
|
412
|
-
return null;
|
|
413
|
-
}
|
|
414
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
415
|
-
validateConfig(untrustedConfig, configPropertyNames);
|
|
416
|
-
}
|
|
417
|
-
const config = typeCheckConfig(untrustedConfig);
|
|
418
|
-
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
return config;
|
|
422
|
-
}
|
|
423
|
-
function buildNetworkSnapshot(luvio, config, options) {
|
|
424
|
-
const resourceParams = createResourceParams(config);
|
|
425
|
-
const request = createResourceRequest(resourceParams);
|
|
426
|
-
return luvio.dispatchResourceRequest(request, options)
|
|
427
|
-
.then((response) => {
|
|
428
|
-
return luvio.handleSuccessResponse(() => {
|
|
429
|
-
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
430
|
-
return luvio.storeBroadcast().then(() => snapshot);
|
|
431
|
-
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
432
|
-
}, (response) => {
|
|
433
|
-
deepFreeze$1(response);
|
|
434
|
-
throw response;
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
const previewAdapterFactory = (luvio) => {
|
|
438
|
-
return function preview(untrustedConfig) {
|
|
439
|
-
const config = validateAdapterConfig(untrustedConfig, preview_ConfigPropertyNames);
|
|
440
|
-
// Invalid or incomplete config
|
|
441
|
-
if (config === null) {
|
|
442
|
-
throw new Error('Invalid config for "preview"');
|
|
443
|
-
}
|
|
444
|
-
return buildNetworkSnapshot(luvio, config);
|
|
445
|
-
};
|
|
386
|
+
const preview_ConfigPropertyNames = {
|
|
387
|
+
displayName: 'preview',
|
|
388
|
+
parameters: {
|
|
389
|
+
required: ['previewInput'],
|
|
390
|
+
optional: []
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
function createResourceParams(config) {
|
|
394
|
+
const resourceParams = {
|
|
395
|
+
body: {
|
|
396
|
+
previewInput: config.previewInput
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
return resourceParams;
|
|
400
|
+
}
|
|
401
|
+
function typeCheckConfig(untrustedConfig) {
|
|
402
|
+
const config = {};
|
|
403
|
+
const untrustedConfig_previewInput = untrustedConfig.previewInput;
|
|
404
|
+
const referencePreviewInputRepresentationValidationError = validate$1(untrustedConfig_previewInput);
|
|
405
|
+
if (referencePreviewInputRepresentationValidationError === null) {
|
|
406
|
+
config.previewInput = untrustedConfig_previewInput;
|
|
407
|
+
}
|
|
408
|
+
return config;
|
|
409
|
+
}
|
|
410
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
411
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
412
|
+
return null;
|
|
413
|
+
}
|
|
414
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
415
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
416
|
+
}
|
|
417
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
418
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
return config;
|
|
422
|
+
}
|
|
423
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
424
|
+
const resourceParams = createResourceParams(config);
|
|
425
|
+
const request = createResourceRequest(resourceParams);
|
|
426
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
427
|
+
.then((response) => {
|
|
428
|
+
return luvio.handleSuccessResponse(() => {
|
|
429
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
430
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
431
|
+
}, () => getResponseCacheKeys(luvio, resourceParams, response.body));
|
|
432
|
+
}, (response) => {
|
|
433
|
+
deepFreeze$1(response);
|
|
434
|
+
throw response;
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
const previewAdapterFactory = (luvio) => {
|
|
438
|
+
return function preview(untrustedConfig) {
|
|
439
|
+
const config = validateAdapterConfig(untrustedConfig, preview_ConfigPropertyNames);
|
|
440
|
+
// Invalid or incomplete config
|
|
441
|
+
if (config === null) {
|
|
442
|
+
throw new Error('Invalid config for "preview"');
|
|
443
|
+
}
|
|
444
|
+
return buildNetworkSnapshot(luvio, config);
|
|
445
|
+
};
|
|
446
446
|
};
|
|
447
447
|
|
|
448
448
|
export { previewAdapterFactory };
|