@salesforce/lds-adapters-industries-decisiontable 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-decisiontable.js +1920 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getDecisionTable.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/getDecisionTableFile.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getDecisionTableRows.d.ts +30 -0
- package/dist/es/es2018/types/src/generated/adapters/getDecisionTableTemplate.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/getDecisionTableTemplateList.d.ts +27 -0
- package/dist/es/es2018/types/src/generated/adapters/postDecisionTableFile.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/adapters/postDecisionTableRows.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +7 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectBusinessRulesDecisionTableDataByDecisionTableId.d.ts +20 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectBusinessRulesDecisionTableDefinitionsByDecisionTableId.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectBusinessRulesDecisionTableFileByDecisionTableId.d.ts +18 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectBusinessRulesDecisionTableTemplates.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectBusinessRulesDecisionTableTemplatesByTemplateName.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectBusinessRulesDecisionTableDataByDecisionTableId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectBusinessRulesDecisionTableFileByDecisionTableId.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableDataOutputRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableDefinitionOutputRepresentation.d.ts +73 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableFileInputRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableFileOutputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableOutputRepresentation.d.ts +39 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableParameterOutputRepresentation.d.ts +65 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableRowInputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableRowOutputRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableRowsListInputRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableRowsListOutputRepresentation.d.ts +33 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableSourceCriteriaOutputRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableTemplateDefinitionOutputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableTemplateOutputRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/DecisionTableTemplatesListOutputRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ErrorOutputRepresentation.d.ts +43 -0
- package/dist/es/es2018/types/src/generated/types/ErrorParametersOutputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/ErrorTargetsOutputRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +2016 -0
- package/src/raml/api.raml +599 -0
- package/src/raml/luvio.raml +82 -0
|
@@ -0,0 +1,1920 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$5, typeCheckConfig as typeCheckConfig$7, StoreKeyMap, createResourceParams as createResourceParams$7 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
const snapshotRefreshOptions = {
|
|
45
|
+
overrides: {
|
|
46
|
+
headers: {
|
|
47
|
+
'Cache-Control': 'no-cache',
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
52
|
+
return {
|
|
53
|
+
name,
|
|
54
|
+
required,
|
|
55
|
+
resourceType,
|
|
56
|
+
typeCheckShape,
|
|
57
|
+
isArrayShape,
|
|
58
|
+
coerceFn,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
62
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
63
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
64
|
+
return {
|
|
65
|
+
displayName,
|
|
66
|
+
parameters: {
|
|
67
|
+
required,
|
|
68
|
+
optional,
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const keyPrefix = 'DecisionTable';
|
|
73
|
+
|
|
74
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
75
|
+
const { isArray: ArrayIsArray } = Array;
|
|
76
|
+
const { stringify: JSONStringify } = JSON;
|
|
77
|
+
function createLink(ref) {
|
|
78
|
+
return {
|
|
79
|
+
__ref: serializeStructuredKey(ref),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function validate$e(obj, path = 'DecisionTableParameterOutputRepresentation') {
|
|
84
|
+
const v_error = (() => {
|
|
85
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
86
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
87
|
+
}
|
|
88
|
+
if (obj.columnMapping !== undefined) {
|
|
89
|
+
const obj_columnMapping = obj.columnMapping;
|
|
90
|
+
const path_columnMapping = path + '.columnMapping';
|
|
91
|
+
if (typeof obj_columnMapping !== 'string') {
|
|
92
|
+
return new TypeError('Expected "string" but received "' + typeof obj_columnMapping + '" (at "' + path_columnMapping + '")');
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (obj.dataType !== undefined) {
|
|
96
|
+
const obj_dataType = obj.dataType;
|
|
97
|
+
const path_dataType = path + '.dataType';
|
|
98
|
+
if (typeof obj_dataType !== 'string') {
|
|
99
|
+
return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (obj.decimalScale !== undefined) {
|
|
103
|
+
const obj_decimalScale = obj.decimalScale;
|
|
104
|
+
const path_decimalScale = path + '.decimalScale';
|
|
105
|
+
if (typeof obj_decimalScale !== 'number' || (typeof obj_decimalScale === 'number' && Math.floor(obj_decimalScale) !== obj_decimalScale)) {
|
|
106
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_decimalScale + '" (at "' + path_decimalScale + '")');
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (obj.domainEntity !== undefined) {
|
|
110
|
+
const obj_domainEntity = obj.domainEntity;
|
|
111
|
+
const path_domainEntity = path + '.domainEntity';
|
|
112
|
+
if (typeof obj_domainEntity !== 'string') {
|
|
113
|
+
return new TypeError('Expected "string" but received "' + typeof obj_domainEntity + '" (at "' + path_domainEntity + '")');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (obj.fieldName !== undefined) {
|
|
117
|
+
const obj_fieldName = obj.fieldName;
|
|
118
|
+
const path_fieldName = path + '.fieldName';
|
|
119
|
+
if (typeof obj_fieldName !== 'string') {
|
|
120
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (obj.isGroupByField !== undefined) {
|
|
124
|
+
const obj_isGroupByField = obj.isGroupByField;
|
|
125
|
+
const path_isGroupByField = path + '.isGroupByField';
|
|
126
|
+
if (typeof obj_isGroupByField !== 'boolean') {
|
|
127
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isGroupByField + '" (at "' + path_isGroupByField + '")');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (obj.isPriority !== undefined) {
|
|
131
|
+
const obj_isPriority = obj.isPriority;
|
|
132
|
+
const path_isPriority = path + '.isPriority';
|
|
133
|
+
if (typeof obj_isPriority !== 'boolean') {
|
|
134
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isPriority + '" (at "' + path_isPriority + '")');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (obj.isRequired !== undefined) {
|
|
138
|
+
const obj_isRequired = obj.isRequired;
|
|
139
|
+
const path_isRequired = path + '.isRequired';
|
|
140
|
+
if (typeof obj_isRequired !== 'boolean') {
|
|
141
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isRequired + '" (at "' + path_isRequired + '")');
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (obj.maxlength !== undefined) {
|
|
145
|
+
const obj_maxlength = obj.maxlength;
|
|
146
|
+
const path_maxlength = path + '.maxlength';
|
|
147
|
+
if (typeof obj_maxlength !== 'number' || (typeof obj_maxlength === 'number' && Math.floor(obj_maxlength) !== obj_maxlength)) {
|
|
148
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_maxlength + '" (at "' + path_maxlength + '")');
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (obj.operator !== undefined) {
|
|
152
|
+
const obj_operator = obj.operator;
|
|
153
|
+
const path_operator = path + '.operator';
|
|
154
|
+
if (typeof obj_operator !== 'string') {
|
|
155
|
+
return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (obj.sequence !== undefined) {
|
|
159
|
+
const obj_sequence = obj.sequence;
|
|
160
|
+
const path_sequence = path + '.sequence';
|
|
161
|
+
if (typeof obj_sequence !== 'number' || (typeof obj_sequence === 'number' && Math.floor(obj_sequence) !== obj_sequence)) {
|
|
162
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_sequence + '" (at "' + path_sequence + '")');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (obj.sortType !== undefined) {
|
|
166
|
+
const obj_sortType = obj.sortType;
|
|
167
|
+
const path_sortType = path + '.sortType';
|
|
168
|
+
if (typeof obj_sortType !== 'string') {
|
|
169
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sortType + '" (at "' + path_sortType + '")');
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (obj.usage !== undefined) {
|
|
173
|
+
const obj_usage = obj.usage;
|
|
174
|
+
const path_usage = path + '.usage';
|
|
175
|
+
if (typeof obj_usage !== 'string') {
|
|
176
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usage + '" (at "' + path_usage + '")');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
})();
|
|
180
|
+
return v_error === undefined ? null : v_error;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function validate$d(obj, path = 'DecisionTableSourceCriteriaOutputRepresentation') {
|
|
184
|
+
const v_error = (() => {
|
|
185
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
186
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
187
|
+
}
|
|
188
|
+
if (obj.operator !== undefined) {
|
|
189
|
+
const obj_operator = obj.operator;
|
|
190
|
+
const path_operator = path + '.operator';
|
|
191
|
+
if (typeof obj_operator !== 'string') {
|
|
192
|
+
return new TypeError('Expected "string" but received "' + typeof obj_operator + '" (at "' + path_operator + '")');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (obj.sequenceNumber !== undefined) {
|
|
196
|
+
const obj_sequenceNumber = obj.sequenceNumber;
|
|
197
|
+
const path_sequenceNumber = path + '.sequenceNumber';
|
|
198
|
+
if (typeof obj_sequenceNumber !== 'number' || (typeof obj_sequenceNumber === 'number' && Math.floor(obj_sequenceNumber) !== obj_sequenceNumber)) {
|
|
199
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_sequenceNumber + '" (at "' + path_sequenceNumber + '")');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (obj.sourceFieldName !== undefined) {
|
|
203
|
+
const obj_sourceFieldName = obj.sourceFieldName;
|
|
204
|
+
const path_sourceFieldName = path + '.sourceFieldName';
|
|
205
|
+
if (typeof obj_sourceFieldName !== 'string') {
|
|
206
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceFieldName + '" (at "' + path_sourceFieldName + '")');
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (obj.value !== undefined) {
|
|
210
|
+
const obj_value = obj.value;
|
|
211
|
+
const path_value = path + '.value';
|
|
212
|
+
if (typeof obj_value !== 'string') {
|
|
213
|
+
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (obj.valueType !== undefined) {
|
|
217
|
+
const obj_valueType = obj.valueType;
|
|
218
|
+
const path_valueType = path + '.valueType';
|
|
219
|
+
if (typeof obj_valueType !== 'string') {
|
|
220
|
+
return new TypeError('Expected "string" but received "' + typeof obj_valueType + '" (at "' + path_valueType + '")');
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
})();
|
|
224
|
+
return v_error === undefined ? null : v_error;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function validate$c(obj, path = 'DecisionTableDefinitionOutputRepresentation') {
|
|
228
|
+
const v_error = (() => {
|
|
229
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
230
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
231
|
+
}
|
|
232
|
+
if (obj.collectOperator !== undefined) {
|
|
233
|
+
const obj_collectOperator = obj.collectOperator;
|
|
234
|
+
const path_collectOperator = path + '.collectOperator';
|
|
235
|
+
if (typeof obj_collectOperator !== 'string') {
|
|
236
|
+
return new TypeError('Expected "string" but received "' + typeof obj_collectOperator + '" (at "' + path_collectOperator + '")');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (obj.conditionCriteria !== undefined) {
|
|
240
|
+
const obj_conditionCriteria = obj.conditionCriteria;
|
|
241
|
+
const path_conditionCriteria = path + '.conditionCriteria';
|
|
242
|
+
if (typeof obj_conditionCriteria !== 'string') {
|
|
243
|
+
return new TypeError('Expected "string" but received "' + typeof obj_conditionCriteria + '" (at "' + path_conditionCriteria + '")');
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (obj.conditionType !== undefined) {
|
|
247
|
+
const obj_conditionType = obj.conditionType;
|
|
248
|
+
const path_conditionType = path + '.conditionType';
|
|
249
|
+
if (typeof obj_conditionType !== 'string') {
|
|
250
|
+
return new TypeError('Expected "string" but received "' + typeof obj_conditionType + '" (at "' + path_conditionType + '")');
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (obj.decisionResultPolicy !== undefined) {
|
|
254
|
+
const obj_decisionResultPolicy = obj.decisionResultPolicy;
|
|
255
|
+
const path_decisionResultPolicy = path + '.decisionResultPolicy';
|
|
256
|
+
if (typeof obj_decisionResultPolicy !== 'string') {
|
|
257
|
+
return new TypeError('Expected "string" but received "' + typeof obj_decisionResultPolicy + '" (at "' + path_decisionResultPolicy + '")');
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (obj.description !== undefined) {
|
|
261
|
+
const obj_description = obj.description;
|
|
262
|
+
const path_description = path + '.description';
|
|
263
|
+
if (typeof obj_description !== 'string') {
|
|
264
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (obj.fullName !== undefined) {
|
|
268
|
+
const obj_fullName = obj.fullName;
|
|
269
|
+
const path_fullName = path + '.fullName';
|
|
270
|
+
if (typeof obj_fullName !== 'string') {
|
|
271
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fullName + '" (at "' + path_fullName + '")');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (obj.id !== undefined) {
|
|
275
|
+
const obj_id = obj.id;
|
|
276
|
+
const path_id = path + '.id';
|
|
277
|
+
if (typeof obj_id !== 'string') {
|
|
278
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const obj_parameters = obj.parameters;
|
|
282
|
+
const path_parameters = path + '.parameters';
|
|
283
|
+
if (!ArrayIsArray(obj_parameters)) {
|
|
284
|
+
return new TypeError('Expected "array" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
|
|
285
|
+
}
|
|
286
|
+
for (let i = 0; i < obj_parameters.length; i++) {
|
|
287
|
+
const obj_parameters_item = obj_parameters[i];
|
|
288
|
+
const path_parameters_item = path_parameters + '[' + i + ']';
|
|
289
|
+
const referencepath_parameters_itemValidationError = validate$e(obj_parameters_item, path_parameters_item);
|
|
290
|
+
if (referencepath_parameters_itemValidationError !== null) {
|
|
291
|
+
let message = 'Object doesn\'t match DecisionTableParameterOutputRepresentation (at "' + path_parameters_item + '")\n';
|
|
292
|
+
message += referencepath_parameters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
293
|
+
return new TypeError(message);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (obj.setupName !== undefined) {
|
|
297
|
+
const obj_setupName = obj.setupName;
|
|
298
|
+
const path_setupName = path + '.setupName';
|
|
299
|
+
if (typeof obj_setupName !== 'string') {
|
|
300
|
+
return new TypeError('Expected "string" but received "' + typeof obj_setupName + '" (at "' + path_setupName + '")');
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const obj_sourceCriteria = obj.sourceCriteria;
|
|
304
|
+
const path_sourceCriteria = path + '.sourceCriteria';
|
|
305
|
+
if (!ArrayIsArray(obj_sourceCriteria)) {
|
|
306
|
+
return new TypeError('Expected "array" but received "' + typeof obj_sourceCriteria + '" (at "' + path_sourceCriteria + '")');
|
|
307
|
+
}
|
|
308
|
+
for (let i = 0; i < obj_sourceCriteria.length; i++) {
|
|
309
|
+
const obj_sourceCriteria_item = obj_sourceCriteria[i];
|
|
310
|
+
const path_sourceCriteria_item = path_sourceCriteria + '[' + i + ']';
|
|
311
|
+
const referencepath_sourceCriteria_itemValidationError = validate$d(obj_sourceCriteria_item, path_sourceCriteria_item);
|
|
312
|
+
if (referencepath_sourceCriteria_itemValidationError !== null) {
|
|
313
|
+
let message = 'Object doesn\'t match DecisionTableSourceCriteriaOutputRepresentation (at "' + path_sourceCriteria_item + '")\n';
|
|
314
|
+
message += referencepath_sourceCriteria_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
315
|
+
return new TypeError(message);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (obj.sourceObject !== undefined) {
|
|
319
|
+
const obj_sourceObject = obj.sourceObject;
|
|
320
|
+
const path_sourceObject = path + '.sourceObject';
|
|
321
|
+
if (typeof obj_sourceObject !== 'string') {
|
|
322
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceObject + '" (at "' + path_sourceObject + '")');
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (obj.sourceType !== undefined) {
|
|
326
|
+
const obj_sourceType = obj.sourceType;
|
|
327
|
+
const path_sourceType = path + '.sourceType';
|
|
328
|
+
if (typeof obj_sourceType !== 'string') {
|
|
329
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceType + '" (at "' + path_sourceType + '")');
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
if (obj.sourceconditionLogic !== undefined) {
|
|
333
|
+
const obj_sourceconditionLogic = obj.sourceconditionLogic;
|
|
334
|
+
const path_sourceconditionLogic = path + '.sourceconditionLogic';
|
|
335
|
+
if (typeof obj_sourceconditionLogic !== 'string') {
|
|
336
|
+
return new TypeError('Expected "string" but received "' + typeof obj_sourceconditionLogic + '" (at "' + path_sourceconditionLogic + '")');
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
if (obj.status !== undefined) {
|
|
340
|
+
const obj_status = obj.status;
|
|
341
|
+
const path_status = path + '.status';
|
|
342
|
+
if (typeof obj_status !== 'string') {
|
|
343
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (obj.usageType !== undefined) {
|
|
347
|
+
const obj_usageType = obj.usageType;
|
|
348
|
+
const path_usageType = path + '.usageType';
|
|
349
|
+
if (typeof obj_usageType !== 'string') {
|
|
350
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usageType + '" (at "' + path_usageType + '")');
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
})();
|
|
354
|
+
return v_error === undefined ? null : v_error;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const TTL$5 = 1000;
|
|
358
|
+
const VERSION$5 = "21435364536c593ed8b8972af7d154d5";
|
|
359
|
+
function validate$b(obj, path = 'DecisionTableOutputRepresentation') {
|
|
360
|
+
const v_error = (() => {
|
|
361
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
362
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
363
|
+
}
|
|
364
|
+
if (obj.code !== undefined) {
|
|
365
|
+
const obj_code = obj.code;
|
|
366
|
+
const path_code = path + '.code';
|
|
367
|
+
if (typeof obj_code !== 'string') {
|
|
368
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
const obj_decisionTable = obj.decisionTable;
|
|
372
|
+
const path_decisionTable = path + '.decisionTable';
|
|
373
|
+
const referencepath_decisionTableValidationError = validate$c(obj_decisionTable, path_decisionTable);
|
|
374
|
+
if (referencepath_decisionTableValidationError !== null) {
|
|
375
|
+
let message = 'Object doesn\'t match DecisionTableDefinitionOutputRepresentation (at "' + path_decisionTable + '")\n';
|
|
376
|
+
message += referencepath_decisionTableValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
377
|
+
return new TypeError(message);
|
|
378
|
+
}
|
|
379
|
+
if (obj.isSuccess !== undefined) {
|
|
380
|
+
const obj_isSuccess = obj.isSuccess;
|
|
381
|
+
const path_isSuccess = path + '.isSuccess';
|
|
382
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
383
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
if (obj.message !== undefined) {
|
|
387
|
+
const obj_message = obj.message;
|
|
388
|
+
const path_message = path + '.message';
|
|
389
|
+
if (typeof obj_message !== 'string') {
|
|
390
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
})();
|
|
394
|
+
return v_error === undefined ? null : v_error;
|
|
395
|
+
}
|
|
396
|
+
const RepresentationType$5 = 'DecisionTableOutputRepresentation';
|
|
397
|
+
function normalize$5(input, existing, path, luvio, store, timestamp) {
|
|
398
|
+
return input;
|
|
399
|
+
}
|
|
400
|
+
const select$c = function DecisionTableOutputRepresentationSelect() {
|
|
401
|
+
return {
|
|
402
|
+
kind: 'Fragment',
|
|
403
|
+
version: VERSION$5,
|
|
404
|
+
private: [],
|
|
405
|
+
opaque: true
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
function equals$5(existing, incoming) {
|
|
409
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
return true;
|
|
413
|
+
}
|
|
414
|
+
const ingest$5 = function DecisionTableOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
415
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
416
|
+
const validateError = validate$b(input);
|
|
417
|
+
if (validateError !== null) {
|
|
418
|
+
throw validateError;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
const key = path.fullPath;
|
|
422
|
+
const ttlToUse = TTL$5;
|
|
423
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$5, "DecisionTable", VERSION$5, RepresentationType$5, equals$5);
|
|
424
|
+
return createLink(key);
|
|
425
|
+
};
|
|
426
|
+
function getTypeCacheKeys$5(rootKeySet, luvio, input, fullPathFactory) {
|
|
427
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
428
|
+
const rootKey = fullPathFactory();
|
|
429
|
+
rootKeySet.set(rootKey, {
|
|
430
|
+
namespace: keyPrefix,
|
|
431
|
+
representationName: RepresentationType$5,
|
|
432
|
+
mergeable: false
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function select$b(luvio, params) {
|
|
437
|
+
return select$c();
|
|
438
|
+
}
|
|
439
|
+
function keyBuilder$b(luvio, params) {
|
|
440
|
+
return keyPrefix + '::DecisionTableOutputRepresentation:(' + 'decisionTableId:' + params.urlParams.decisionTableId + ')';
|
|
441
|
+
}
|
|
442
|
+
function getResponseCacheKeys$6(storeKeyMap, luvio, resourceParams, response) {
|
|
443
|
+
getTypeCacheKeys$5(storeKeyMap, luvio, response, () => keyBuilder$b(luvio, resourceParams));
|
|
444
|
+
}
|
|
445
|
+
function ingestSuccess$6(luvio, resourceParams, response, snapshotRefresh) {
|
|
446
|
+
const { body } = response;
|
|
447
|
+
const key = keyBuilder$b(luvio, resourceParams);
|
|
448
|
+
luvio.storeIngest(key, ingest$5, body);
|
|
449
|
+
const snapshot = luvio.storeLookup({
|
|
450
|
+
recordId: key,
|
|
451
|
+
node: select$b(),
|
|
452
|
+
variables: {},
|
|
453
|
+
}, snapshotRefresh);
|
|
454
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
455
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
456
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
deepFreeze(snapshot.data);
|
|
460
|
+
return snapshot;
|
|
461
|
+
}
|
|
462
|
+
function ingestError$4(luvio, params, error, snapshotRefresh) {
|
|
463
|
+
const key = keyBuilder$b(luvio, params);
|
|
464
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
465
|
+
const storeMetadataParams = {
|
|
466
|
+
ttl: TTL$5,
|
|
467
|
+
namespace: keyPrefix,
|
|
468
|
+
version: VERSION$5,
|
|
469
|
+
representationName: RepresentationType$5
|
|
470
|
+
};
|
|
471
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
472
|
+
return errorSnapshot;
|
|
473
|
+
}
|
|
474
|
+
function createResourceRequest$6(config) {
|
|
475
|
+
const headers = {};
|
|
476
|
+
return {
|
|
477
|
+
baseUri: '/services/data/v66.0',
|
|
478
|
+
basePath: '/connect/business-rules/decision-table/definitions/' + config.urlParams.decisionTableId + '',
|
|
479
|
+
method: 'get',
|
|
480
|
+
body: null,
|
|
481
|
+
urlParams: config.urlParams,
|
|
482
|
+
queryParams: {},
|
|
483
|
+
headers,
|
|
484
|
+
priority: 'normal',
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
const adapterName$6 = 'getDecisionTable';
|
|
489
|
+
const getDecisionTable_ConfigPropertyMetadata = [
|
|
490
|
+
generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
491
|
+
];
|
|
492
|
+
const getDecisionTable_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$6, getDecisionTable_ConfigPropertyMetadata);
|
|
493
|
+
const createResourceParams$6 = /*#__PURE__*/ createResourceParams$7(getDecisionTable_ConfigPropertyMetadata);
|
|
494
|
+
function keyBuilder$a(luvio, config) {
|
|
495
|
+
const resourceParams = createResourceParams$6(config);
|
|
496
|
+
return keyBuilder$b(luvio, resourceParams);
|
|
497
|
+
}
|
|
498
|
+
function typeCheckConfig$6(untrustedConfig) {
|
|
499
|
+
const config = {};
|
|
500
|
+
typeCheckConfig$7(untrustedConfig, config, getDecisionTable_ConfigPropertyMetadata);
|
|
501
|
+
return config;
|
|
502
|
+
}
|
|
503
|
+
function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
|
|
504
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
508
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
509
|
+
}
|
|
510
|
+
const config = typeCheckConfig$6(untrustedConfig);
|
|
511
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
return config;
|
|
515
|
+
}
|
|
516
|
+
function adapterFragment$4(luvio, config) {
|
|
517
|
+
createResourceParams$6(config);
|
|
518
|
+
return select$b();
|
|
519
|
+
}
|
|
520
|
+
function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
|
|
521
|
+
const snapshot = ingestSuccess$6(luvio, resourceParams, response, {
|
|
522
|
+
config,
|
|
523
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
524
|
+
});
|
|
525
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
526
|
+
}
|
|
527
|
+
function onFetchResponseError$4(luvio, config, resourceParams, response) {
|
|
528
|
+
const snapshot = ingestError$4(luvio, resourceParams, response, {
|
|
529
|
+
config,
|
|
530
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
531
|
+
});
|
|
532
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
533
|
+
}
|
|
534
|
+
function buildNetworkSnapshot$6(luvio, config, options) {
|
|
535
|
+
const resourceParams = createResourceParams$6(config);
|
|
536
|
+
const request = createResourceRequest$6(resourceParams);
|
|
537
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
538
|
+
.then((response) => {
|
|
539
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$4(luvio, config, resourceParams, response), () => {
|
|
540
|
+
const cache = new StoreKeyMap();
|
|
541
|
+
getResponseCacheKeys$6(cache, luvio, resourceParams, response.body);
|
|
542
|
+
return cache;
|
|
543
|
+
});
|
|
544
|
+
}, (response) => {
|
|
545
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$4(luvio, config, resourceParams, response));
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
|
|
549
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$6, undefined, false);
|
|
550
|
+
}
|
|
551
|
+
function buildCachedSnapshotCachePolicy$4(context, storeLookup) {
|
|
552
|
+
const { luvio, config } = context;
|
|
553
|
+
const selector = {
|
|
554
|
+
recordId: keyBuilder$a(luvio, config),
|
|
555
|
+
node: adapterFragment$4(luvio, config),
|
|
556
|
+
variables: {},
|
|
557
|
+
};
|
|
558
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
559
|
+
config,
|
|
560
|
+
resolve: () => buildNetworkSnapshot$6(luvio, config, snapshotRefreshOptions)
|
|
561
|
+
});
|
|
562
|
+
return cacheSnapshot;
|
|
563
|
+
}
|
|
564
|
+
const getDecisionTableAdapterFactory = (luvio) => function DecisionTable__getDecisionTable(untrustedConfig, requestContext) {
|
|
565
|
+
const config = validateAdapterConfig$6(untrustedConfig, getDecisionTable_ConfigPropertyNames);
|
|
566
|
+
// Invalid or incomplete config
|
|
567
|
+
if (config === null) {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
571
|
+
buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
function validate$a(obj, path = 'DecisionTableTemplateOutputRepresentation') {
|
|
575
|
+
const v_error = (() => {
|
|
576
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
577
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
578
|
+
}
|
|
579
|
+
if (obj.location !== undefined) {
|
|
580
|
+
const obj_location = obj.location;
|
|
581
|
+
const path_location = path + '.location';
|
|
582
|
+
if (typeof obj_location !== 'string') {
|
|
583
|
+
return new TypeError('Expected "string" but received "' + typeof obj_location + '" (at "' + path_location + '")');
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
if (obj.templateName !== undefined) {
|
|
587
|
+
const obj_templateName = obj.templateName;
|
|
588
|
+
const path_templateName = path + '.templateName';
|
|
589
|
+
if (typeof obj_templateName !== 'string') {
|
|
590
|
+
return new TypeError('Expected "string" but received "' + typeof obj_templateName + '" (at "' + path_templateName + '")');
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (obj.usageType !== undefined) {
|
|
594
|
+
const obj_usageType = obj.usageType;
|
|
595
|
+
const path_usageType = path + '.usageType';
|
|
596
|
+
if (typeof obj_usageType !== 'string') {
|
|
597
|
+
return new TypeError('Expected "string" but received "' + typeof obj_usageType + '" (at "' + path_usageType + '")');
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
})();
|
|
601
|
+
return v_error === undefined ? null : v_error;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function validate$9(obj, path = 'ErrorParametersOutputRepresentation') {
|
|
605
|
+
const v_error = (() => {
|
|
606
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
607
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
608
|
+
}
|
|
609
|
+
if (obj.name !== undefined) {
|
|
610
|
+
const obj_name = obj.name;
|
|
611
|
+
const path_name = path + '.name';
|
|
612
|
+
if (typeof obj_name !== 'string') {
|
|
613
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
if (obj.value !== undefined) {
|
|
617
|
+
const obj_value = obj.value;
|
|
618
|
+
const path_value = path + '.value';
|
|
619
|
+
if (typeof obj_value !== 'string') {
|
|
620
|
+
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
})();
|
|
624
|
+
return v_error === undefined ? null : v_error;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
function validate$8(obj, path = 'ErrorTargetsOutputRepresentation') {
|
|
628
|
+
const v_error = (() => {
|
|
629
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
630
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
631
|
+
}
|
|
632
|
+
if (obj.reference !== undefined) {
|
|
633
|
+
const obj_reference = obj.reference;
|
|
634
|
+
const path_reference = path + '.reference';
|
|
635
|
+
if (typeof obj_reference !== 'string') {
|
|
636
|
+
return new TypeError('Expected "string" but received "' + typeof obj_reference + '" (at "' + path_reference + '")');
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (obj.type !== undefined) {
|
|
640
|
+
const obj_type = obj.type;
|
|
641
|
+
const path_type = path + '.type';
|
|
642
|
+
if (typeof obj_type !== 'string') {
|
|
643
|
+
return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
})();
|
|
647
|
+
return v_error === undefined ? null : v_error;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
function validate$7(obj, path = 'ErrorOutputRepresentation') {
|
|
651
|
+
const v_error = (() => {
|
|
652
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
653
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
654
|
+
}
|
|
655
|
+
if (obj.errorCode !== undefined) {
|
|
656
|
+
const obj_errorCode = obj.errorCode;
|
|
657
|
+
const path_errorCode = path + '.errorCode';
|
|
658
|
+
if (typeof obj_errorCode !== 'string') {
|
|
659
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
if (obj.message !== undefined) {
|
|
663
|
+
const obj_message = obj.message;
|
|
664
|
+
const path_message = path + '.message';
|
|
665
|
+
if (typeof obj_message !== 'string') {
|
|
666
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (obj.messageCode !== undefined) {
|
|
670
|
+
const obj_messageCode = obj.messageCode;
|
|
671
|
+
const path_messageCode = path + '.messageCode';
|
|
672
|
+
if (typeof obj_messageCode !== 'string') {
|
|
673
|
+
return new TypeError('Expected "string" but received "' + typeof obj_messageCode + '" (at "' + path_messageCode + '")');
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (obj.parameters !== undefined) {
|
|
677
|
+
const obj_parameters = obj.parameters;
|
|
678
|
+
const path_parameters = path + '.parameters';
|
|
679
|
+
if (!ArrayIsArray(obj_parameters)) {
|
|
680
|
+
return new TypeError('Expected "array" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
|
|
681
|
+
}
|
|
682
|
+
for (let i = 0; i < obj_parameters.length; i++) {
|
|
683
|
+
const obj_parameters_item = obj_parameters[i];
|
|
684
|
+
const path_parameters_item = path_parameters + '[' + i + ']';
|
|
685
|
+
const referencepath_parameters_itemValidationError = validate$9(obj_parameters_item, path_parameters_item);
|
|
686
|
+
if (referencepath_parameters_itemValidationError !== null) {
|
|
687
|
+
let message = 'Object doesn\'t match ErrorParametersOutputRepresentation (at "' + path_parameters_item + '")\n';
|
|
688
|
+
message += referencepath_parameters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
689
|
+
return new TypeError(message);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (obj.targets !== undefined) {
|
|
694
|
+
const obj_targets = obj.targets;
|
|
695
|
+
const path_targets = path + '.targets';
|
|
696
|
+
if (!ArrayIsArray(obj_targets)) {
|
|
697
|
+
return new TypeError('Expected "array" but received "' + typeof obj_targets + '" (at "' + path_targets + '")');
|
|
698
|
+
}
|
|
699
|
+
for (let i = 0; i < obj_targets.length; i++) {
|
|
700
|
+
const obj_targets_item = obj_targets[i];
|
|
701
|
+
const path_targets_item = path_targets + '[' + i + ']';
|
|
702
|
+
const referencepath_targets_itemValidationError = validate$8(obj_targets_item, path_targets_item);
|
|
703
|
+
if (referencepath_targets_itemValidationError !== null) {
|
|
704
|
+
let message = 'Object doesn\'t match ErrorTargetsOutputRepresentation (at "' + path_targets_item + '")\n';
|
|
705
|
+
message += referencepath_targets_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
706
|
+
return new TypeError(message);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
})();
|
|
711
|
+
return v_error === undefined ? null : v_error;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
const TTL$4 = 1000;
|
|
715
|
+
const VERSION$4 = "a2891bd122ab9f728d5937bf70b9f600";
|
|
716
|
+
function validate$6(obj, path = 'DecisionTableTemplatesListOutputRepresentation') {
|
|
717
|
+
const v_error = (() => {
|
|
718
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
719
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
720
|
+
}
|
|
721
|
+
if (obj.decisionTableTemplates !== undefined) {
|
|
722
|
+
const obj_decisionTableTemplates = obj.decisionTableTemplates;
|
|
723
|
+
const path_decisionTableTemplates = path + '.decisionTableTemplates';
|
|
724
|
+
if (!ArrayIsArray(obj_decisionTableTemplates)) {
|
|
725
|
+
return new TypeError('Expected "array" but received "' + typeof obj_decisionTableTemplates + '" (at "' + path_decisionTableTemplates + '")');
|
|
726
|
+
}
|
|
727
|
+
for (let i = 0; i < obj_decisionTableTemplates.length; i++) {
|
|
728
|
+
const obj_decisionTableTemplates_item = obj_decisionTableTemplates[i];
|
|
729
|
+
const path_decisionTableTemplates_item = path_decisionTableTemplates + '[' + i + ']';
|
|
730
|
+
const referencepath_decisionTableTemplates_itemValidationError = validate$a(obj_decisionTableTemplates_item, path_decisionTableTemplates_item);
|
|
731
|
+
if (referencepath_decisionTableTemplates_itemValidationError !== null) {
|
|
732
|
+
let message = 'Object doesn\'t match DecisionTableTemplateOutputRepresentation (at "' + path_decisionTableTemplates_item + '")\n';
|
|
733
|
+
message += referencepath_decisionTableTemplates_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
734
|
+
return new TypeError(message);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (obj.errors !== undefined) {
|
|
739
|
+
const obj_errors = obj.errors;
|
|
740
|
+
const path_errors = path + '.errors';
|
|
741
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
742
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
743
|
+
}
|
|
744
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
745
|
+
const obj_errors_item = obj_errors[i];
|
|
746
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
747
|
+
const referencepath_errors_itemValidationError = validate$7(obj_errors_item, path_errors_item);
|
|
748
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
749
|
+
let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
|
|
750
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
751
|
+
return new TypeError(message);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
})();
|
|
756
|
+
return v_error === undefined ? null : v_error;
|
|
757
|
+
}
|
|
758
|
+
const RepresentationType$4 = 'DecisionTableTemplatesListOutputRepresentation';
|
|
759
|
+
function normalize$4(input, existing, path, luvio, store, timestamp) {
|
|
760
|
+
return input;
|
|
761
|
+
}
|
|
762
|
+
const select$a = function DecisionTableTemplatesListOutputRepresentationSelect() {
|
|
763
|
+
return {
|
|
764
|
+
kind: 'Fragment',
|
|
765
|
+
version: VERSION$4,
|
|
766
|
+
private: [],
|
|
767
|
+
opaque: true
|
|
768
|
+
};
|
|
769
|
+
};
|
|
770
|
+
function equals$4(existing, incoming) {
|
|
771
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
const ingest$4 = function DecisionTableTemplatesListOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
777
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
778
|
+
const validateError = validate$6(input);
|
|
779
|
+
if (validateError !== null) {
|
|
780
|
+
throw validateError;
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
const key = path.fullPath;
|
|
784
|
+
const ttlToUse = TTL$4;
|
|
785
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$4, "DecisionTable", VERSION$4, RepresentationType$4, equals$4);
|
|
786
|
+
return createLink(key);
|
|
787
|
+
};
|
|
788
|
+
function getTypeCacheKeys$4(rootKeySet, luvio, input, fullPathFactory) {
|
|
789
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
790
|
+
const rootKey = fullPathFactory();
|
|
791
|
+
rootKeySet.set(rootKey, {
|
|
792
|
+
namespace: keyPrefix,
|
|
793
|
+
representationName: RepresentationType$4,
|
|
794
|
+
mergeable: false
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function select$9(luvio, params) {
|
|
799
|
+
return select$a();
|
|
800
|
+
}
|
|
801
|
+
function keyBuilder$9(luvio, params) {
|
|
802
|
+
return keyPrefix + '::DecisionTableTemplatesListOutputRepresentation:(' + 'usageType:' + params.queryParams.usageType + ')';
|
|
803
|
+
}
|
|
804
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
805
|
+
getTypeCacheKeys$4(storeKeyMap, luvio, response, () => keyBuilder$9(luvio, resourceParams));
|
|
806
|
+
}
|
|
807
|
+
function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
|
|
808
|
+
const { body } = response;
|
|
809
|
+
const key = keyBuilder$9(luvio, resourceParams);
|
|
810
|
+
luvio.storeIngest(key, ingest$4, body);
|
|
811
|
+
const snapshot = luvio.storeLookup({
|
|
812
|
+
recordId: key,
|
|
813
|
+
node: select$9(),
|
|
814
|
+
variables: {},
|
|
815
|
+
}, snapshotRefresh);
|
|
816
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
817
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
818
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
deepFreeze(snapshot.data);
|
|
822
|
+
return snapshot;
|
|
823
|
+
}
|
|
824
|
+
function ingestError$3(luvio, params, error, snapshotRefresh) {
|
|
825
|
+
const key = keyBuilder$9(luvio, params);
|
|
826
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
827
|
+
const storeMetadataParams = {
|
|
828
|
+
ttl: TTL$4,
|
|
829
|
+
namespace: keyPrefix,
|
|
830
|
+
version: VERSION$4,
|
|
831
|
+
representationName: RepresentationType$4
|
|
832
|
+
};
|
|
833
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
834
|
+
return errorSnapshot;
|
|
835
|
+
}
|
|
836
|
+
function createResourceRequest$5(config) {
|
|
837
|
+
const headers = {};
|
|
838
|
+
return {
|
|
839
|
+
baseUri: '/services/data/v66.0',
|
|
840
|
+
basePath: '/connect/business-rules/decision-table/templates',
|
|
841
|
+
method: 'get',
|
|
842
|
+
body: null,
|
|
843
|
+
urlParams: {},
|
|
844
|
+
queryParams: config.queryParams,
|
|
845
|
+
headers,
|
|
846
|
+
priority: 'normal',
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
const adapterName$5 = 'getDecisionTableTemplateList';
|
|
851
|
+
const getDecisionTableTemplateList_ConfigPropertyMetadata = [
|
|
852
|
+
generateParamConfigMetadata('usageType', false, 1 /* QueryParameter */, 0 /* String */),
|
|
853
|
+
];
|
|
854
|
+
const getDecisionTableTemplateList_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getDecisionTableTemplateList_ConfigPropertyMetadata);
|
|
855
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$7(getDecisionTableTemplateList_ConfigPropertyMetadata);
|
|
856
|
+
function keyBuilder$8(luvio, config) {
|
|
857
|
+
const resourceParams = createResourceParams$5(config);
|
|
858
|
+
return keyBuilder$9(luvio, resourceParams);
|
|
859
|
+
}
|
|
860
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
861
|
+
const config = {};
|
|
862
|
+
typeCheckConfig$7(untrustedConfig, config, getDecisionTableTemplateList_ConfigPropertyMetadata);
|
|
863
|
+
return config;
|
|
864
|
+
}
|
|
865
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
866
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
867
|
+
return null;
|
|
868
|
+
}
|
|
869
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
870
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
871
|
+
}
|
|
872
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
873
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
return config;
|
|
877
|
+
}
|
|
878
|
+
function adapterFragment$3(luvio, config) {
|
|
879
|
+
createResourceParams$5(config);
|
|
880
|
+
return select$9();
|
|
881
|
+
}
|
|
882
|
+
function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
|
|
883
|
+
const snapshot = ingestSuccess$5(luvio, resourceParams, response, {
|
|
884
|
+
config,
|
|
885
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
886
|
+
});
|
|
887
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
888
|
+
}
|
|
889
|
+
function onFetchResponseError$3(luvio, config, resourceParams, response) {
|
|
890
|
+
const snapshot = ingestError$3(luvio, resourceParams, response, {
|
|
891
|
+
config,
|
|
892
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
893
|
+
});
|
|
894
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
895
|
+
}
|
|
896
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
897
|
+
const resourceParams = createResourceParams$5(config);
|
|
898
|
+
const request = createResourceRequest$5(resourceParams);
|
|
899
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
900
|
+
.then((response) => {
|
|
901
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => {
|
|
902
|
+
const cache = new StoreKeyMap();
|
|
903
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
904
|
+
return cache;
|
|
905
|
+
});
|
|
906
|
+
}, (response) => {
|
|
907
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
|
|
911
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
|
|
912
|
+
}
|
|
913
|
+
function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
|
|
914
|
+
const { luvio, config } = context;
|
|
915
|
+
const selector = {
|
|
916
|
+
recordId: keyBuilder$8(luvio, config),
|
|
917
|
+
node: adapterFragment$3(luvio, config),
|
|
918
|
+
variables: {},
|
|
919
|
+
};
|
|
920
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
921
|
+
config,
|
|
922
|
+
resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
|
|
923
|
+
});
|
|
924
|
+
return cacheSnapshot;
|
|
925
|
+
}
|
|
926
|
+
const getDecisionTableTemplateListAdapterFactory = (luvio) => function DecisionTable__getDecisionTableTemplateList(untrustedConfig, requestContext) {
|
|
927
|
+
const config = validateAdapterConfig$5(untrustedConfig, getDecisionTableTemplateList_ConfigPropertyNames);
|
|
928
|
+
// Invalid or incomplete config
|
|
929
|
+
if (config === null) {
|
|
930
|
+
return null;
|
|
931
|
+
}
|
|
932
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
933
|
+
buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
const TTL$3 = 1000;
|
|
937
|
+
const VERSION$3 = "9a106f486843ccdb3e85594fb33ef97f";
|
|
938
|
+
function validate$5(obj, path = 'DecisionTableTemplateDefinitionOutputRepresentation') {
|
|
939
|
+
const v_error = (() => {
|
|
940
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
941
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
942
|
+
}
|
|
943
|
+
if (obj.decisionTableTemplate !== undefined) {
|
|
944
|
+
const obj_decisionTableTemplate = obj.decisionTableTemplate;
|
|
945
|
+
const path_decisionTableTemplate = path + '.decisionTableTemplate';
|
|
946
|
+
const referencepath_decisionTableTemplateValidationError = validate$c(obj_decisionTableTemplate, path_decisionTableTemplate);
|
|
947
|
+
if (referencepath_decisionTableTemplateValidationError !== null) {
|
|
948
|
+
let message = 'Object doesn\'t match DecisionTableDefinitionOutputRepresentation (at "' + path_decisionTableTemplate + '")\n';
|
|
949
|
+
message += referencepath_decisionTableTemplateValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
950
|
+
return new TypeError(message);
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
if (obj.errors !== undefined) {
|
|
954
|
+
const obj_errors = obj.errors;
|
|
955
|
+
const path_errors = path + '.errors';
|
|
956
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
957
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
958
|
+
}
|
|
959
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
960
|
+
const obj_errors_item = obj_errors[i];
|
|
961
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
962
|
+
const referencepath_errors_itemValidationError = validate$7(obj_errors_item, path_errors_item);
|
|
963
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
964
|
+
let message = 'Object doesn\'t match ErrorOutputRepresentation (at "' + path_errors_item + '")\n';
|
|
965
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
966
|
+
return new TypeError(message);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
})();
|
|
971
|
+
return v_error === undefined ? null : v_error;
|
|
972
|
+
}
|
|
973
|
+
const RepresentationType$3 = 'DecisionTableTemplateDefinitionOutputRepresentation';
|
|
974
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
975
|
+
return input;
|
|
976
|
+
}
|
|
977
|
+
const select$8 = function DecisionTableTemplateDefinitionOutputRepresentationSelect() {
|
|
978
|
+
return {
|
|
979
|
+
kind: 'Fragment',
|
|
980
|
+
version: VERSION$3,
|
|
981
|
+
private: [],
|
|
982
|
+
opaque: true
|
|
983
|
+
};
|
|
984
|
+
};
|
|
985
|
+
function equals$3(existing, incoming) {
|
|
986
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
987
|
+
return false;
|
|
988
|
+
}
|
|
989
|
+
return true;
|
|
990
|
+
}
|
|
991
|
+
const ingest$3 = function DecisionTableTemplateDefinitionOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
992
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
993
|
+
const validateError = validate$5(input);
|
|
994
|
+
if (validateError !== null) {
|
|
995
|
+
throw validateError;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
const key = path.fullPath;
|
|
999
|
+
const ttlToUse = TTL$3;
|
|
1000
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "DecisionTable", VERSION$3, RepresentationType$3, equals$3);
|
|
1001
|
+
return createLink(key);
|
|
1002
|
+
};
|
|
1003
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
1004
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1005
|
+
const rootKey = fullPathFactory();
|
|
1006
|
+
rootKeySet.set(rootKey, {
|
|
1007
|
+
namespace: keyPrefix,
|
|
1008
|
+
representationName: RepresentationType$3,
|
|
1009
|
+
mergeable: false
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
function select$7(luvio, params) {
|
|
1014
|
+
return select$8();
|
|
1015
|
+
}
|
|
1016
|
+
function keyBuilder$7(luvio, params) {
|
|
1017
|
+
return keyPrefix + '::DecisionTableTemplateDefinitionOutputRepresentation:(' + 'templateName:' + params.urlParams.templateName + ')';
|
|
1018
|
+
}
|
|
1019
|
+
function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
|
|
1020
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response, () => keyBuilder$7(luvio, resourceParams));
|
|
1021
|
+
}
|
|
1022
|
+
function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
|
|
1023
|
+
const { body } = response;
|
|
1024
|
+
const key = keyBuilder$7(luvio, resourceParams);
|
|
1025
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1026
|
+
const snapshot = luvio.storeLookup({
|
|
1027
|
+
recordId: key,
|
|
1028
|
+
node: select$7(),
|
|
1029
|
+
variables: {},
|
|
1030
|
+
}, snapshotRefresh);
|
|
1031
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1032
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1033
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
deepFreeze(snapshot.data);
|
|
1037
|
+
return snapshot;
|
|
1038
|
+
}
|
|
1039
|
+
function ingestError$2(luvio, params, error, snapshotRefresh) {
|
|
1040
|
+
const key = keyBuilder$7(luvio, params);
|
|
1041
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1042
|
+
const storeMetadataParams = {
|
|
1043
|
+
ttl: TTL$3,
|
|
1044
|
+
namespace: keyPrefix,
|
|
1045
|
+
version: VERSION$3,
|
|
1046
|
+
representationName: RepresentationType$3
|
|
1047
|
+
};
|
|
1048
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1049
|
+
return errorSnapshot;
|
|
1050
|
+
}
|
|
1051
|
+
function createResourceRequest$4(config) {
|
|
1052
|
+
const headers = {};
|
|
1053
|
+
return {
|
|
1054
|
+
baseUri: '/services/data/v66.0',
|
|
1055
|
+
basePath: '/connect/business-rules/decision-table/templates/' + config.urlParams.templateName + '',
|
|
1056
|
+
method: 'get',
|
|
1057
|
+
body: null,
|
|
1058
|
+
urlParams: config.urlParams,
|
|
1059
|
+
queryParams: {},
|
|
1060
|
+
headers,
|
|
1061
|
+
priority: 'normal',
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
const adapterName$4 = 'getDecisionTableTemplate';
|
|
1066
|
+
const getDecisionTableTemplate_ConfigPropertyMetadata = [
|
|
1067
|
+
generateParamConfigMetadata('templateName', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1068
|
+
];
|
|
1069
|
+
const getDecisionTableTemplate_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, getDecisionTableTemplate_ConfigPropertyMetadata);
|
|
1070
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$7(getDecisionTableTemplate_ConfigPropertyMetadata);
|
|
1071
|
+
function keyBuilder$6(luvio, config) {
|
|
1072
|
+
const resourceParams = createResourceParams$4(config);
|
|
1073
|
+
return keyBuilder$7(luvio, resourceParams);
|
|
1074
|
+
}
|
|
1075
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
1076
|
+
const config = {};
|
|
1077
|
+
typeCheckConfig$7(untrustedConfig, config, getDecisionTableTemplate_ConfigPropertyMetadata);
|
|
1078
|
+
return config;
|
|
1079
|
+
}
|
|
1080
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
1081
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1082
|
+
return null;
|
|
1083
|
+
}
|
|
1084
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1085
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1086
|
+
}
|
|
1087
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
1088
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1089
|
+
return null;
|
|
1090
|
+
}
|
|
1091
|
+
return config;
|
|
1092
|
+
}
|
|
1093
|
+
function adapterFragment$2(luvio, config) {
|
|
1094
|
+
createResourceParams$4(config);
|
|
1095
|
+
return select$7();
|
|
1096
|
+
}
|
|
1097
|
+
function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
|
|
1098
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
|
|
1099
|
+
config,
|
|
1100
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
1101
|
+
});
|
|
1102
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1103
|
+
}
|
|
1104
|
+
function onFetchResponseError$2(luvio, config, resourceParams, response) {
|
|
1105
|
+
const snapshot = ingestError$2(luvio, resourceParams, response, {
|
|
1106
|
+
config,
|
|
1107
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
1108
|
+
});
|
|
1109
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1110
|
+
}
|
|
1111
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
1112
|
+
const resourceParams = createResourceParams$4(config);
|
|
1113
|
+
const request = createResourceRequest$4(resourceParams);
|
|
1114
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1115
|
+
.then((response) => {
|
|
1116
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
|
|
1117
|
+
const cache = new StoreKeyMap();
|
|
1118
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
|
|
1119
|
+
return cache;
|
|
1120
|
+
});
|
|
1121
|
+
}, (response) => {
|
|
1122
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
|
|
1126
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
|
|
1127
|
+
}
|
|
1128
|
+
function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
|
|
1129
|
+
const { luvio, config } = context;
|
|
1130
|
+
const selector = {
|
|
1131
|
+
recordId: keyBuilder$6(luvio, config),
|
|
1132
|
+
node: adapterFragment$2(luvio, config),
|
|
1133
|
+
variables: {},
|
|
1134
|
+
};
|
|
1135
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1136
|
+
config,
|
|
1137
|
+
resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
|
|
1138
|
+
});
|
|
1139
|
+
return cacheSnapshot;
|
|
1140
|
+
}
|
|
1141
|
+
const getDecisionTableTemplateAdapterFactory = (luvio) => function DecisionTable__getDecisionTableTemplate(untrustedConfig, requestContext) {
|
|
1142
|
+
const config = validateAdapterConfig$4(untrustedConfig, getDecisionTableTemplate_ConfigPropertyNames);
|
|
1143
|
+
// Invalid or incomplete config
|
|
1144
|
+
if (config === null) {
|
|
1145
|
+
return null;
|
|
1146
|
+
}
|
|
1147
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1148
|
+
buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
function validate$4(obj, path = 'DecisionTableRowInputRepresentation') {
|
|
1152
|
+
const v_error = (() => {
|
|
1153
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1154
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1155
|
+
}
|
|
1156
|
+
const obj_action = obj.action;
|
|
1157
|
+
const path_action = path + '.action';
|
|
1158
|
+
if (typeof obj_action !== 'string') {
|
|
1159
|
+
return new TypeError('Expected "string" but received "' + typeof obj_action + '" (at "' + path_action + '")');
|
|
1160
|
+
}
|
|
1161
|
+
const obj_id = obj.id;
|
|
1162
|
+
const path_id = path + '.id';
|
|
1163
|
+
if (typeof obj_id !== 'string') {
|
|
1164
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1165
|
+
}
|
|
1166
|
+
const obj_rowData = obj.rowData;
|
|
1167
|
+
const path_rowData = path + '.rowData';
|
|
1168
|
+
if (typeof obj_rowData !== 'object' || ArrayIsArray(obj_rowData) || obj_rowData === null) {
|
|
1169
|
+
return new TypeError('Expected "object" but received "' + typeof obj_rowData + '" (at "' + path_rowData + '")');
|
|
1170
|
+
}
|
|
1171
|
+
const obj_rowData_keys = ObjectKeys(obj_rowData);
|
|
1172
|
+
for (let i = 0; i < obj_rowData_keys.length; i++) {
|
|
1173
|
+
const key = obj_rowData_keys[i];
|
|
1174
|
+
const obj_rowData_prop = obj_rowData[key];
|
|
1175
|
+
const path_rowData_prop = path_rowData + '["' + key + '"]';
|
|
1176
|
+
if (obj_rowData_prop === undefined) {
|
|
1177
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_rowData_prop + '" (at "' + path_rowData_prop + '")');
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
})();
|
|
1181
|
+
return v_error === undefined ? null : v_error;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
const TTL$2 = 1000;
|
|
1185
|
+
const VERSION$2 = "58833f5bd113747199f0032242bf21b6";
|
|
1186
|
+
function validate$3(obj, path = 'DecisionTableDataOutputRepresentation') {
|
|
1187
|
+
const v_error = (() => {
|
|
1188
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1189
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1190
|
+
}
|
|
1191
|
+
const obj_errorFileId = obj.errorFileId;
|
|
1192
|
+
const path_errorFileId = path + '.errorFileId';
|
|
1193
|
+
if (typeof obj_errorFileId !== 'string') {
|
|
1194
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorFileId + '" (at "' + path_errorFileId + '")');
|
|
1195
|
+
}
|
|
1196
|
+
if (obj.errors !== undefined) {
|
|
1197
|
+
const obj_errors = obj.errors;
|
|
1198
|
+
const path_errors = path + '.errors';
|
|
1199
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
1200
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
1201
|
+
}
|
|
1202
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
1203
|
+
const obj_errors_item = obj_errors[i];
|
|
1204
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
1205
|
+
if (typeof obj_errors_item !== 'string') {
|
|
1206
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errors_item + '" (at "' + path_errors_item + '")');
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
})();
|
|
1211
|
+
return v_error === undefined ? null : v_error;
|
|
1212
|
+
}
|
|
1213
|
+
const RepresentationType$2 = 'DecisionTableDataOutputRepresentation';
|
|
1214
|
+
function keyBuilder$5(luvio, config) {
|
|
1215
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.errorFileId;
|
|
1216
|
+
}
|
|
1217
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
1218
|
+
const keyParams = {
|
|
1219
|
+
errorFileId: object.errorFileId
|
|
1220
|
+
};
|
|
1221
|
+
return keyBuilder$5(luvio, keyParams);
|
|
1222
|
+
}
|
|
1223
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
1224
|
+
return input;
|
|
1225
|
+
}
|
|
1226
|
+
const select$6 = function DecisionTableDataOutputRepresentationSelect() {
|
|
1227
|
+
return {
|
|
1228
|
+
kind: 'Fragment',
|
|
1229
|
+
version: VERSION$2,
|
|
1230
|
+
private: [],
|
|
1231
|
+
opaque: true
|
|
1232
|
+
};
|
|
1233
|
+
};
|
|
1234
|
+
function equals$2(existing, incoming) {
|
|
1235
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1236
|
+
return false;
|
|
1237
|
+
}
|
|
1238
|
+
return true;
|
|
1239
|
+
}
|
|
1240
|
+
const ingest$2 = function DecisionTableDataOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1241
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1242
|
+
const validateError = validate$3(input);
|
|
1243
|
+
if (validateError !== null) {
|
|
1244
|
+
throw validateError;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
1248
|
+
const ttlToUse = TTL$2;
|
|
1249
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "DecisionTable", VERSION$2, RepresentationType$2, equals$2);
|
|
1250
|
+
return createLink(key);
|
|
1251
|
+
};
|
|
1252
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
1253
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1254
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
1255
|
+
rootKeySet.set(rootKey, {
|
|
1256
|
+
namespace: keyPrefix,
|
|
1257
|
+
representationName: RepresentationType$2,
|
|
1258
|
+
mergeable: false
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
function select$5(luvio, params) {
|
|
1263
|
+
return select$6();
|
|
1264
|
+
}
|
|
1265
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
1266
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
1267
|
+
}
|
|
1268
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
1269
|
+
const { body } = response;
|
|
1270
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
1271
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
1272
|
+
const snapshot = luvio.storeLookup({
|
|
1273
|
+
recordId: key,
|
|
1274
|
+
node: select$5(),
|
|
1275
|
+
variables: {},
|
|
1276
|
+
});
|
|
1277
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1278
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1279
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
deepFreeze(snapshot.data);
|
|
1283
|
+
return snapshot;
|
|
1284
|
+
}
|
|
1285
|
+
function createResourceRequest$3(config) {
|
|
1286
|
+
const headers = {};
|
|
1287
|
+
return {
|
|
1288
|
+
baseUri: '/services/data/v66.0',
|
|
1289
|
+
basePath: '/connect/business-rules/decision-table/' + config.urlParams.decisionTableId + '/data',
|
|
1290
|
+
method: 'post',
|
|
1291
|
+
body: config.body,
|
|
1292
|
+
urlParams: config.urlParams,
|
|
1293
|
+
queryParams: {},
|
|
1294
|
+
headers,
|
|
1295
|
+
priority: 'normal',
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
const adapterName$3 = 'postDecisionTableRows';
|
|
1300
|
+
const postDecisionTableRows_ConfigPropertyMetadata = [
|
|
1301
|
+
generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1302
|
+
generateParamConfigMetadata('rows', false, 2 /* Body */, 4 /* Unsupported */, true),
|
|
1303
|
+
];
|
|
1304
|
+
const postDecisionTableRows_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, postDecisionTableRows_ConfigPropertyMetadata);
|
|
1305
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$7(postDecisionTableRows_ConfigPropertyMetadata);
|
|
1306
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
1307
|
+
const config = {};
|
|
1308
|
+
typeCheckConfig$7(untrustedConfig, config, postDecisionTableRows_ConfigPropertyMetadata);
|
|
1309
|
+
const untrustedConfig_rows = untrustedConfig.rows;
|
|
1310
|
+
if (ArrayIsArray$1(untrustedConfig_rows)) {
|
|
1311
|
+
const untrustedConfig_rows_array = [];
|
|
1312
|
+
for (let i = 0, arrayLength = untrustedConfig_rows.length; i < arrayLength; i++) {
|
|
1313
|
+
const untrustedConfig_rows_item = untrustedConfig_rows[i];
|
|
1314
|
+
const referenceDecisionTableRowInputRepresentationValidationError = validate$4(untrustedConfig_rows_item);
|
|
1315
|
+
if (referenceDecisionTableRowInputRepresentationValidationError === null) {
|
|
1316
|
+
untrustedConfig_rows_array.push(untrustedConfig_rows_item);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
config.rows = untrustedConfig_rows_array;
|
|
1320
|
+
}
|
|
1321
|
+
return config;
|
|
1322
|
+
}
|
|
1323
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
1324
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1325
|
+
return null;
|
|
1326
|
+
}
|
|
1327
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1328
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1329
|
+
}
|
|
1330
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
1331
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1332
|
+
return null;
|
|
1333
|
+
}
|
|
1334
|
+
return config;
|
|
1335
|
+
}
|
|
1336
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
1337
|
+
const resourceParams = createResourceParams$3(config);
|
|
1338
|
+
const request = createResourceRequest$3(resourceParams);
|
|
1339
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1340
|
+
.then((response) => {
|
|
1341
|
+
return luvio.handleSuccessResponse(() => {
|
|
1342
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
1343
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1344
|
+
}, () => {
|
|
1345
|
+
const cache = new StoreKeyMap();
|
|
1346
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
1347
|
+
return cache;
|
|
1348
|
+
});
|
|
1349
|
+
}, (response) => {
|
|
1350
|
+
deepFreeze(response);
|
|
1351
|
+
throw response;
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
const postDecisionTableRowsAdapterFactory = (luvio) => {
|
|
1355
|
+
return function postDecisionTableRows(untrustedConfig) {
|
|
1356
|
+
const config = validateAdapterConfig$3(untrustedConfig, postDecisionTableRows_ConfigPropertyNames);
|
|
1357
|
+
// Invalid or incomplete config
|
|
1358
|
+
if (config === null) {
|
|
1359
|
+
throw new Error('Invalid config for "postDecisionTableRows"');
|
|
1360
|
+
}
|
|
1361
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
1362
|
+
};
|
|
1363
|
+
};
|
|
1364
|
+
|
|
1365
|
+
function validate$2(obj, path = 'DecisionTableRowOutputRepresentation') {
|
|
1366
|
+
const v_error = (() => {
|
|
1367
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1368
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1369
|
+
}
|
|
1370
|
+
const obj_id = obj.id;
|
|
1371
|
+
const path_id = path + '.id';
|
|
1372
|
+
if (typeof obj_id !== 'string') {
|
|
1373
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
1374
|
+
}
|
|
1375
|
+
const obj_rowData = obj.rowData;
|
|
1376
|
+
const path_rowData = path + '.rowData';
|
|
1377
|
+
if (typeof obj_rowData !== 'object' || ArrayIsArray(obj_rowData) || obj_rowData === null) {
|
|
1378
|
+
return new TypeError('Expected "object" but received "' + typeof obj_rowData + '" (at "' + path_rowData + '")');
|
|
1379
|
+
}
|
|
1380
|
+
const obj_rowData_keys = ObjectKeys(obj_rowData);
|
|
1381
|
+
for (let i = 0; i < obj_rowData_keys.length; i++) {
|
|
1382
|
+
const key = obj_rowData_keys[i];
|
|
1383
|
+
const obj_rowData_prop = obj_rowData[key];
|
|
1384
|
+
const path_rowData_prop = path_rowData + '["' + key + '"]';
|
|
1385
|
+
if (obj_rowData_prop === undefined) {
|
|
1386
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_rowData_prop + '" (at "' + path_rowData_prop + '")');
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
})();
|
|
1390
|
+
return v_error === undefined ? null : v_error;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
const TTL$1 = 1000;
|
|
1394
|
+
const VERSION$1 = "10dd31535fc5c028227867bd30804643";
|
|
1395
|
+
function validate$1(obj, path = 'DecisionTableRowsListOutputRepresentation') {
|
|
1396
|
+
const v_error = (() => {
|
|
1397
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1398
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1399
|
+
}
|
|
1400
|
+
const obj_rows = obj.rows;
|
|
1401
|
+
const path_rows = path + '.rows';
|
|
1402
|
+
if (!ArrayIsArray(obj_rows)) {
|
|
1403
|
+
return new TypeError('Expected "array" but received "' + typeof obj_rows + '" (at "' + path_rows + '")');
|
|
1404
|
+
}
|
|
1405
|
+
for (let i = 0; i < obj_rows.length; i++) {
|
|
1406
|
+
const obj_rows_item = obj_rows[i];
|
|
1407
|
+
const path_rows_item = path_rows + '[' + i + ']';
|
|
1408
|
+
const referencepath_rows_itemValidationError = validate$2(obj_rows_item, path_rows_item);
|
|
1409
|
+
if (referencepath_rows_itemValidationError !== null) {
|
|
1410
|
+
let message = 'Object doesn\'t match DecisionTableRowOutputRepresentation (at "' + path_rows_item + '")\n';
|
|
1411
|
+
message += referencepath_rows_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
1412
|
+
return new TypeError(message);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
const obj_totalRows = obj.totalRows;
|
|
1416
|
+
const path_totalRows = path + '.totalRows';
|
|
1417
|
+
let obj_totalRows_union0 = null;
|
|
1418
|
+
const obj_totalRows_union0_error = (() => {
|
|
1419
|
+
if (typeof obj_totalRows !== 'number' || (typeof obj_totalRows === 'number' && Math.floor(obj_totalRows) !== obj_totalRows)) {
|
|
1420
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_totalRows + '" (at "' + path_totalRows + '")');
|
|
1421
|
+
}
|
|
1422
|
+
})();
|
|
1423
|
+
if (obj_totalRows_union0_error != null) {
|
|
1424
|
+
obj_totalRows_union0 = obj_totalRows_union0_error.message;
|
|
1425
|
+
}
|
|
1426
|
+
let obj_totalRows_union1 = null;
|
|
1427
|
+
const obj_totalRows_union1_error = (() => {
|
|
1428
|
+
if (obj_totalRows !== null) {
|
|
1429
|
+
return new TypeError('Expected "null" but received "' + typeof obj_totalRows + '" (at "' + path_totalRows + '")');
|
|
1430
|
+
}
|
|
1431
|
+
})();
|
|
1432
|
+
if (obj_totalRows_union1_error != null) {
|
|
1433
|
+
obj_totalRows_union1 = obj_totalRows_union1_error.message;
|
|
1434
|
+
}
|
|
1435
|
+
if (obj_totalRows_union0 && obj_totalRows_union1) {
|
|
1436
|
+
let message = 'Object doesn\'t match union (at "' + path_totalRows + '")';
|
|
1437
|
+
message += '\n' + obj_totalRows_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
1438
|
+
message += '\n' + obj_totalRows_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
1439
|
+
return new TypeError(message);
|
|
1440
|
+
}
|
|
1441
|
+
})();
|
|
1442
|
+
return v_error === undefined ? null : v_error;
|
|
1443
|
+
}
|
|
1444
|
+
const RepresentationType$1 = 'DecisionTableRowsListOutputRepresentation';
|
|
1445
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1446
|
+
return input;
|
|
1447
|
+
}
|
|
1448
|
+
const select$4 = function DecisionTableRowsListOutputRepresentationSelect() {
|
|
1449
|
+
return {
|
|
1450
|
+
kind: 'Fragment',
|
|
1451
|
+
version: VERSION$1,
|
|
1452
|
+
private: [],
|
|
1453
|
+
opaque: true
|
|
1454
|
+
};
|
|
1455
|
+
};
|
|
1456
|
+
function equals$1(existing, incoming) {
|
|
1457
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
return true;
|
|
1461
|
+
}
|
|
1462
|
+
const ingest$1 = function DecisionTableRowsListOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1463
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1464
|
+
const validateError = validate$1(input);
|
|
1465
|
+
if (validateError !== null) {
|
|
1466
|
+
throw validateError;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
const key = path.fullPath;
|
|
1470
|
+
const ttlToUse = TTL$1;
|
|
1471
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "DecisionTable", VERSION$1, RepresentationType$1, equals$1);
|
|
1472
|
+
return createLink(key);
|
|
1473
|
+
};
|
|
1474
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1475
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1476
|
+
const rootKey = fullPathFactory();
|
|
1477
|
+
rootKeySet.set(rootKey, {
|
|
1478
|
+
namespace: keyPrefix,
|
|
1479
|
+
representationName: RepresentationType$1,
|
|
1480
|
+
mergeable: false
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
function select$3(luvio, params) {
|
|
1485
|
+
return select$4();
|
|
1486
|
+
}
|
|
1487
|
+
function keyBuilder$4(luvio, params) {
|
|
1488
|
+
return keyPrefix + '::DecisionTableRowsListOutputRepresentation:(' + 'filter:' + params.queryParams.filter + ',' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'decisionTableId:' + params.urlParams.decisionTableId + ')';
|
|
1489
|
+
}
|
|
1490
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1491
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
|
|
1492
|
+
}
|
|
1493
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1494
|
+
const { body } = response;
|
|
1495
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
1496
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1497
|
+
const snapshot = luvio.storeLookup({
|
|
1498
|
+
recordId: key,
|
|
1499
|
+
node: select$3(),
|
|
1500
|
+
variables: {},
|
|
1501
|
+
}, snapshotRefresh);
|
|
1502
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1503
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1504
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
deepFreeze(snapshot.data);
|
|
1508
|
+
return snapshot;
|
|
1509
|
+
}
|
|
1510
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
1511
|
+
const key = keyBuilder$4(luvio, params);
|
|
1512
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1513
|
+
const storeMetadataParams = {
|
|
1514
|
+
ttl: TTL$1,
|
|
1515
|
+
namespace: keyPrefix,
|
|
1516
|
+
version: VERSION$1,
|
|
1517
|
+
representationName: RepresentationType$1
|
|
1518
|
+
};
|
|
1519
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1520
|
+
return errorSnapshot;
|
|
1521
|
+
}
|
|
1522
|
+
function createResourceRequest$2(config) {
|
|
1523
|
+
const headers = {};
|
|
1524
|
+
return {
|
|
1525
|
+
baseUri: '/services/data/v66.0',
|
|
1526
|
+
basePath: '/connect/business-rules/decision-table/' + config.urlParams.decisionTableId + '/data',
|
|
1527
|
+
method: 'get',
|
|
1528
|
+
body: null,
|
|
1529
|
+
urlParams: config.urlParams,
|
|
1530
|
+
queryParams: config.queryParams,
|
|
1531
|
+
headers,
|
|
1532
|
+
priority: 'normal',
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
const adapterName$2 = 'getDecisionTableRows';
|
|
1537
|
+
const getDecisionTableRows_ConfigPropertyMetadata = [
|
|
1538
|
+
generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1539
|
+
generateParamConfigMetadata('filter', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1540
|
+
generateParamConfigMetadata('limit', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1541
|
+
generateParamConfigMetadata('offset', false, 1 /* QueryParameter */, 3 /* Integer */),
|
|
1542
|
+
];
|
|
1543
|
+
const getDecisionTableRows_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getDecisionTableRows_ConfigPropertyMetadata);
|
|
1544
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$7(getDecisionTableRows_ConfigPropertyMetadata);
|
|
1545
|
+
function keyBuilder$3(luvio, config) {
|
|
1546
|
+
const resourceParams = createResourceParams$2(config);
|
|
1547
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
1548
|
+
}
|
|
1549
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1550
|
+
const config = {};
|
|
1551
|
+
typeCheckConfig$7(untrustedConfig, config, getDecisionTableRows_ConfigPropertyMetadata);
|
|
1552
|
+
return config;
|
|
1553
|
+
}
|
|
1554
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1555
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1556
|
+
return null;
|
|
1557
|
+
}
|
|
1558
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1559
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1560
|
+
}
|
|
1561
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
1562
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1563
|
+
return null;
|
|
1564
|
+
}
|
|
1565
|
+
return config;
|
|
1566
|
+
}
|
|
1567
|
+
function adapterFragment$1(luvio, config) {
|
|
1568
|
+
createResourceParams$2(config);
|
|
1569
|
+
return select$3();
|
|
1570
|
+
}
|
|
1571
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
1572
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1573
|
+
config,
|
|
1574
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1575
|
+
});
|
|
1576
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1577
|
+
}
|
|
1578
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
1579
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
1580
|
+
config,
|
|
1581
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1582
|
+
});
|
|
1583
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1584
|
+
}
|
|
1585
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1586
|
+
const resourceParams = createResourceParams$2(config);
|
|
1587
|
+
const request = createResourceRequest$2(resourceParams);
|
|
1588
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1589
|
+
.then((response) => {
|
|
1590
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
1591
|
+
const cache = new StoreKeyMap();
|
|
1592
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1593
|
+
return cache;
|
|
1594
|
+
});
|
|
1595
|
+
}, (response) => {
|
|
1596
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
1600
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1601
|
+
}
|
|
1602
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
1603
|
+
const { luvio, config } = context;
|
|
1604
|
+
const selector = {
|
|
1605
|
+
recordId: keyBuilder$3(luvio, config),
|
|
1606
|
+
node: adapterFragment$1(luvio, config),
|
|
1607
|
+
variables: {},
|
|
1608
|
+
};
|
|
1609
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1610
|
+
config,
|
|
1611
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1612
|
+
});
|
|
1613
|
+
return cacheSnapshot;
|
|
1614
|
+
}
|
|
1615
|
+
const getDecisionTableRowsAdapterFactory = (luvio) => function DecisionTable__getDecisionTableRows(untrustedConfig, requestContext) {
|
|
1616
|
+
const config = validateAdapterConfig$2(untrustedConfig, getDecisionTableRows_ConfigPropertyNames);
|
|
1617
|
+
// Invalid or incomplete config
|
|
1618
|
+
if (config === null) {
|
|
1619
|
+
return null;
|
|
1620
|
+
}
|
|
1621
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1622
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
const TTL = 1000;
|
|
1626
|
+
const VERSION = "581abdd509fd88568bfa17b4a220d8db";
|
|
1627
|
+
function validate(obj, path = 'DecisionTableFileOutputRepresentation') {
|
|
1628
|
+
const v_error = (() => {
|
|
1629
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1630
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1631
|
+
}
|
|
1632
|
+
const obj_message = obj.message;
|
|
1633
|
+
const path_message = path + '.message';
|
|
1634
|
+
if (typeof obj_message !== 'string') {
|
|
1635
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
1636
|
+
}
|
|
1637
|
+
})();
|
|
1638
|
+
return v_error === undefined ? null : v_error;
|
|
1639
|
+
}
|
|
1640
|
+
const RepresentationType = 'DecisionTableFileOutputRepresentation';
|
|
1641
|
+
function keyBuilder$2(luvio, config) {
|
|
1642
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.message;
|
|
1643
|
+
}
|
|
1644
|
+
function keyBuilderFromType(luvio, object) {
|
|
1645
|
+
const keyParams = {
|
|
1646
|
+
message: object.message
|
|
1647
|
+
};
|
|
1648
|
+
return keyBuilder$2(luvio, keyParams);
|
|
1649
|
+
}
|
|
1650
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1651
|
+
return input;
|
|
1652
|
+
}
|
|
1653
|
+
const select$2 = function DecisionTableFileOutputRepresentationSelect() {
|
|
1654
|
+
return {
|
|
1655
|
+
kind: 'Fragment',
|
|
1656
|
+
version: VERSION,
|
|
1657
|
+
private: [],
|
|
1658
|
+
opaque: true
|
|
1659
|
+
};
|
|
1660
|
+
};
|
|
1661
|
+
function equals(existing, incoming) {
|
|
1662
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
1663
|
+
return false;
|
|
1664
|
+
}
|
|
1665
|
+
return true;
|
|
1666
|
+
}
|
|
1667
|
+
const ingest = function DecisionTableFileOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1668
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1669
|
+
const validateError = validate(input);
|
|
1670
|
+
if (validateError !== null) {
|
|
1671
|
+
throw validateError;
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1675
|
+
const ttlToUse = TTL;
|
|
1676
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "DecisionTable", VERSION, RepresentationType, equals);
|
|
1677
|
+
return createLink(key);
|
|
1678
|
+
};
|
|
1679
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1680
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1681
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1682
|
+
rootKeySet.set(rootKey, {
|
|
1683
|
+
namespace: keyPrefix,
|
|
1684
|
+
representationName: RepresentationType,
|
|
1685
|
+
mergeable: false
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
function select$1(luvio, params) {
|
|
1690
|
+
return select$2();
|
|
1691
|
+
}
|
|
1692
|
+
function keyBuilder$1(luvio, params) {
|
|
1693
|
+
return keyPrefix + '::DecisionTableFileOutputRepresentation:(' + 'filter:' + params.queryParams.filter + ',' + 'decisionTableId:' + params.urlParams.decisionTableId + ')';
|
|
1694
|
+
}
|
|
1695
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1696
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1697
|
+
}
|
|
1698
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
1699
|
+
const { body } = response;
|
|
1700
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
1701
|
+
luvio.storeIngest(key, ingest, body);
|
|
1702
|
+
const snapshot = luvio.storeLookup({
|
|
1703
|
+
recordId: key,
|
|
1704
|
+
node: select$1(),
|
|
1705
|
+
variables: {},
|
|
1706
|
+
}, snapshotRefresh);
|
|
1707
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1708
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1709
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
deepFreeze(snapshot.data);
|
|
1713
|
+
return snapshot;
|
|
1714
|
+
}
|
|
1715
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1716
|
+
const key = keyBuilder$1(luvio, params);
|
|
1717
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1718
|
+
const storeMetadataParams = {
|
|
1719
|
+
ttl: TTL,
|
|
1720
|
+
namespace: keyPrefix,
|
|
1721
|
+
version: VERSION,
|
|
1722
|
+
representationName: RepresentationType
|
|
1723
|
+
};
|
|
1724
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
1725
|
+
return errorSnapshot;
|
|
1726
|
+
}
|
|
1727
|
+
function createResourceRequest$1(config) {
|
|
1728
|
+
const headers = {};
|
|
1729
|
+
return {
|
|
1730
|
+
baseUri: '/services/data/v66.0',
|
|
1731
|
+
basePath: '/connect/business-rules/decision-table/' + config.urlParams.decisionTableId + '/file',
|
|
1732
|
+
method: 'get',
|
|
1733
|
+
body: null,
|
|
1734
|
+
urlParams: config.urlParams,
|
|
1735
|
+
queryParams: config.queryParams,
|
|
1736
|
+
headers,
|
|
1737
|
+
priority: 'normal',
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
const adapterName$1 = 'getDecisionTableFile';
|
|
1742
|
+
const getDecisionTableFile_ConfigPropertyMetadata = [
|
|
1743
|
+
generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1744
|
+
generateParamConfigMetadata('filter', false, 1 /* QueryParameter */, 0 /* String */),
|
|
1745
|
+
];
|
|
1746
|
+
const getDecisionTableFile_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getDecisionTableFile_ConfigPropertyMetadata);
|
|
1747
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$7(getDecisionTableFile_ConfigPropertyMetadata);
|
|
1748
|
+
function keyBuilder(luvio, config) {
|
|
1749
|
+
const resourceParams = createResourceParams$1(config);
|
|
1750
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
1751
|
+
}
|
|
1752
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1753
|
+
const config = {};
|
|
1754
|
+
typeCheckConfig$7(untrustedConfig, config, getDecisionTableFile_ConfigPropertyMetadata);
|
|
1755
|
+
return config;
|
|
1756
|
+
}
|
|
1757
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1758
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1759
|
+
return null;
|
|
1760
|
+
}
|
|
1761
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1762
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1763
|
+
}
|
|
1764
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1765
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1766
|
+
return null;
|
|
1767
|
+
}
|
|
1768
|
+
return config;
|
|
1769
|
+
}
|
|
1770
|
+
function adapterFragment(luvio, config) {
|
|
1771
|
+
createResourceParams$1(config);
|
|
1772
|
+
return select$1();
|
|
1773
|
+
}
|
|
1774
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1775
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
1776
|
+
config,
|
|
1777
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1778
|
+
});
|
|
1779
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1780
|
+
}
|
|
1781
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1782
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1783
|
+
config,
|
|
1784
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1785
|
+
});
|
|
1786
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1787
|
+
}
|
|
1788
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1789
|
+
const resourceParams = createResourceParams$1(config);
|
|
1790
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1791
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1792
|
+
.then((response) => {
|
|
1793
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1794
|
+
const cache = new StoreKeyMap();
|
|
1795
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1796
|
+
return cache;
|
|
1797
|
+
});
|
|
1798
|
+
}, (response) => {
|
|
1799
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1803
|
+
return buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
1804
|
+
}
|
|
1805
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1806
|
+
const { luvio, config } = context;
|
|
1807
|
+
const selector = {
|
|
1808
|
+
recordId: keyBuilder(luvio, config),
|
|
1809
|
+
node: adapterFragment(luvio, config),
|
|
1810
|
+
variables: {},
|
|
1811
|
+
};
|
|
1812
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1813
|
+
config,
|
|
1814
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
1815
|
+
});
|
|
1816
|
+
return cacheSnapshot;
|
|
1817
|
+
}
|
|
1818
|
+
const getDecisionTableFileAdapterFactory = (luvio) => function DecisionTable__getDecisionTableFile(untrustedConfig, requestContext) {
|
|
1819
|
+
const config = validateAdapterConfig$1(untrustedConfig, getDecisionTableFile_ConfigPropertyNames);
|
|
1820
|
+
// Invalid or incomplete config
|
|
1821
|
+
if (config === null) {
|
|
1822
|
+
return null;
|
|
1823
|
+
}
|
|
1824
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1825
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1826
|
+
};
|
|
1827
|
+
|
|
1828
|
+
function select(luvio, params) {
|
|
1829
|
+
return select$2();
|
|
1830
|
+
}
|
|
1831
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1832
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1833
|
+
}
|
|
1834
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1835
|
+
const { body } = response;
|
|
1836
|
+
const key = keyBuilderFromType(luvio, body);
|
|
1837
|
+
luvio.storeIngest(key, ingest, body);
|
|
1838
|
+
const snapshot = luvio.storeLookup({
|
|
1839
|
+
recordId: key,
|
|
1840
|
+
node: select(),
|
|
1841
|
+
variables: {},
|
|
1842
|
+
});
|
|
1843
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1844
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1845
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
deepFreeze(snapshot.data);
|
|
1849
|
+
return snapshot;
|
|
1850
|
+
}
|
|
1851
|
+
function createResourceRequest(config) {
|
|
1852
|
+
const headers = {};
|
|
1853
|
+
return {
|
|
1854
|
+
baseUri: '/services/data/v66.0',
|
|
1855
|
+
basePath: '/connect/business-rules/decision-table/' + config.urlParams.decisionTableId + '/file',
|
|
1856
|
+
method: 'post',
|
|
1857
|
+
body: config.body,
|
|
1858
|
+
urlParams: config.urlParams,
|
|
1859
|
+
queryParams: {},
|
|
1860
|
+
headers,
|
|
1861
|
+
priority: 'normal',
|
|
1862
|
+
};
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
const adapterName = 'postDecisionTableFile';
|
|
1866
|
+
const postDecisionTableFile_ConfigPropertyMetadata = [
|
|
1867
|
+
generateParamConfigMetadata('decisionTableId', true, 0 /* UrlParameter */, 0 /* String */),
|
|
1868
|
+
generateParamConfigMetadata('deleteAllRows', false, 2 /* Body */, 1 /* Boolean */),
|
|
1869
|
+
generateParamConfigMetadata('fileId', true, 2 /* Body */, 0 /* String */),
|
|
1870
|
+
];
|
|
1871
|
+
const postDecisionTableFile_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, postDecisionTableFile_ConfigPropertyMetadata);
|
|
1872
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$7(postDecisionTableFile_ConfigPropertyMetadata);
|
|
1873
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1874
|
+
const config = {};
|
|
1875
|
+
typeCheckConfig$7(untrustedConfig, config, postDecisionTableFile_ConfigPropertyMetadata);
|
|
1876
|
+
return config;
|
|
1877
|
+
}
|
|
1878
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1879
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1880
|
+
return null;
|
|
1881
|
+
}
|
|
1882
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1883
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1884
|
+
}
|
|
1885
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1886
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1887
|
+
return null;
|
|
1888
|
+
}
|
|
1889
|
+
return config;
|
|
1890
|
+
}
|
|
1891
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1892
|
+
const resourceParams = createResourceParams(config);
|
|
1893
|
+
const request = createResourceRequest(resourceParams);
|
|
1894
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1895
|
+
.then((response) => {
|
|
1896
|
+
return luvio.handleSuccessResponse(() => {
|
|
1897
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1898
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1899
|
+
}, () => {
|
|
1900
|
+
const cache = new StoreKeyMap();
|
|
1901
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1902
|
+
return cache;
|
|
1903
|
+
});
|
|
1904
|
+
}, (response) => {
|
|
1905
|
+
deepFreeze(response);
|
|
1906
|
+
throw response;
|
|
1907
|
+
});
|
|
1908
|
+
}
|
|
1909
|
+
const postDecisionTableFileAdapterFactory = (luvio) => {
|
|
1910
|
+
return function postDecisionTableFile(untrustedConfig) {
|
|
1911
|
+
const config = validateAdapterConfig(untrustedConfig, postDecisionTableFile_ConfigPropertyNames);
|
|
1912
|
+
// Invalid or incomplete config
|
|
1913
|
+
if (config === null) {
|
|
1914
|
+
throw new Error('Invalid config for "postDecisionTableFile"');
|
|
1915
|
+
}
|
|
1916
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1917
|
+
};
|
|
1918
|
+
};
|
|
1919
|
+
|
|
1920
|
+
export { getDecisionTableAdapterFactory, getDecisionTableFileAdapterFactory, getDecisionTableRowsAdapterFactory, getDecisionTableTemplateAdapterFactory, getDecisionTableTemplateListAdapterFactory, postDecisionTableFileAdapterFactory, postDecisionTableRowsAdapterFactory };
|