@salesforce/lds-adapters-service-basesetup 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/service-basesetup.js +879 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/enableFeatureSet.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/adapters/getFeatureSetDetail.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +5 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectBaseSetupFeatureSetDetail.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectBaseSetupEnableFeatureSet.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/types/EnableFeatureSetInputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/EnableFeatureSetOutputRepresentation.d.ts +48 -0
- package/dist/es/es2018/types/src/generated/types/FeatureRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/FeatureSetErrorRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/FeatureSetRepresentation.d.ts +51 -0
- package/dist/es/es2018/types/src/generated/types/FeatureStatusRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +67 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +958 -0
- package/src/raml/api.raml +170 -0
- package/src/raml/luvio.raml +28 -0
|
@@ -0,0 +1,879 @@
|
|
|
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, StoreKeyMap, createResourceParams as createResourceParams$2, typeCheckConfig as typeCheckConfig$2, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys, create: ObjectCreate } = 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(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 = 'basesetup';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
function equalsArray(a, b, equalsItem) {
|
|
76
|
+
const aLength = a.length;
|
|
77
|
+
const bLength = b.length;
|
|
78
|
+
if (aLength !== bLength) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
for (let i = 0; i < aLength; i++) {
|
|
82
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
function createLink(ref) {
|
|
89
|
+
return {
|
|
90
|
+
__ref: serializeStructuredKey(ref),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const VERSION$4 = "57736b1397735a74a85726a28b18413d";
|
|
95
|
+
function validate$4(obj, path = 'FeatureSetErrorRepresentation') {
|
|
96
|
+
const v_error = (() => {
|
|
97
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
98
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
99
|
+
}
|
|
100
|
+
const obj_errorCode = obj.errorCode;
|
|
101
|
+
const path_errorCode = path + '.errorCode';
|
|
102
|
+
if (typeof obj_errorCode !== 'string') {
|
|
103
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorCode + '" (at "' + path_errorCode + '")');
|
|
104
|
+
}
|
|
105
|
+
const obj_errorMessage = obj.errorMessage;
|
|
106
|
+
const path_errorMessage = path + '.errorMessage';
|
|
107
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
108
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
return v_error === undefined ? null : v_error;
|
|
112
|
+
}
|
|
113
|
+
const select$6 = function FeatureSetErrorRepresentationSelect() {
|
|
114
|
+
return {
|
|
115
|
+
kind: 'Fragment',
|
|
116
|
+
version: VERSION$4,
|
|
117
|
+
private: [],
|
|
118
|
+
selections: [
|
|
119
|
+
{
|
|
120
|
+
name: 'errorCode',
|
|
121
|
+
kind: 'Scalar'
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'errorMessage',
|
|
125
|
+
kind: 'Scalar'
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
function equals$4(existing, incoming) {
|
|
131
|
+
const existing_errorCode = existing.errorCode;
|
|
132
|
+
const incoming_errorCode = incoming.errorCode;
|
|
133
|
+
if (!(existing_errorCode === incoming_errorCode)) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
const existing_errorMessage = existing.errorMessage;
|
|
137
|
+
const incoming_errorMessage = incoming.errorMessage;
|
|
138
|
+
if (!(existing_errorMessage === incoming_errorMessage)) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const VERSION$3 = "fdf09db1e294f390c748746b14b00ea8";
|
|
145
|
+
function validate$3(obj, path = 'FeatureStatusRepresentation') {
|
|
146
|
+
const v_error = (() => {
|
|
147
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
148
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
149
|
+
}
|
|
150
|
+
const obj_errors = obj.errors;
|
|
151
|
+
const path_errors = path + '.errors';
|
|
152
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
153
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
154
|
+
}
|
|
155
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
156
|
+
const obj_errors_item = obj_errors[i];
|
|
157
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
158
|
+
const referencepath_errors_itemValidationError = validate$4(obj_errors_item, path_errors_item);
|
|
159
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
160
|
+
let message = 'Object doesn\'t match FeatureSetErrorRepresentation (at "' + path_errors_item + '")\n';
|
|
161
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
162
|
+
return new TypeError(message);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const obj_featureApiName = obj.featureApiName;
|
|
166
|
+
const path_featureApiName = path + '.featureApiName';
|
|
167
|
+
if (typeof obj_featureApiName !== 'string') {
|
|
168
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureApiName + '" (at "' + path_featureApiName + '")');
|
|
169
|
+
}
|
|
170
|
+
const obj_featureStatus = obj.featureStatus;
|
|
171
|
+
const path_featureStatus = path + '.featureStatus';
|
|
172
|
+
if (typeof obj_featureStatus !== 'string') {
|
|
173
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureStatus + '" (at "' + path_featureStatus + '")');
|
|
174
|
+
}
|
|
175
|
+
})();
|
|
176
|
+
return v_error === undefined ? null : v_error;
|
|
177
|
+
}
|
|
178
|
+
const select$5 = function FeatureStatusRepresentationSelect() {
|
|
179
|
+
const { selections: FeatureSetErrorRepresentation__selections, opaque: FeatureSetErrorRepresentation__opaque, } = select$6();
|
|
180
|
+
return {
|
|
181
|
+
kind: 'Fragment',
|
|
182
|
+
version: VERSION$3,
|
|
183
|
+
private: [],
|
|
184
|
+
selections: [
|
|
185
|
+
{
|
|
186
|
+
name: 'errors',
|
|
187
|
+
kind: 'Object',
|
|
188
|
+
plural: true,
|
|
189
|
+
selections: FeatureSetErrorRepresentation__selections
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'featureApiName',
|
|
193
|
+
kind: 'Scalar'
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'featureStatus',
|
|
197
|
+
kind: 'Scalar'
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
function equals$3(existing, incoming) {
|
|
203
|
+
const existing_featureApiName = existing.featureApiName;
|
|
204
|
+
const incoming_featureApiName = incoming.featureApiName;
|
|
205
|
+
if (!(existing_featureApiName === incoming_featureApiName)) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
const existing_featureStatus = existing.featureStatus;
|
|
209
|
+
const incoming_featureStatus = incoming.featureStatus;
|
|
210
|
+
if (!(existing_featureStatus === incoming_featureStatus)) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
const existing_errors = existing.errors;
|
|
214
|
+
const incoming_errors = incoming.errors;
|
|
215
|
+
const equals_errors_items = equalsArray(existing_errors, incoming_errors, (existing_errors_item, incoming_errors_item) => {
|
|
216
|
+
if (!(equals$4(existing_errors_item, incoming_errors_item))) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
if (equals_errors_items === false) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const VERSION$2 = "83652c37c36b03098220a8a09f67bef0";
|
|
227
|
+
function validate$2(obj, path = 'EnableFeatureSetOutputRepresentation') {
|
|
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
|
+
const obj_errors = obj.errors;
|
|
233
|
+
const path_errors = path + '.errors';
|
|
234
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
235
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
236
|
+
}
|
|
237
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
238
|
+
const obj_errors_item = obj_errors[i];
|
|
239
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
240
|
+
const referencepath_errors_itemValidationError = validate$4(obj_errors_item, path_errors_item);
|
|
241
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
242
|
+
let message = 'Object doesn\'t match FeatureSetErrorRepresentation (at "' + path_errors_item + '")\n';
|
|
243
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
244
|
+
return new TypeError(message);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const obj_featureSetApiName = obj.featureSetApiName;
|
|
248
|
+
const path_featureSetApiName = path + '.featureSetApiName';
|
|
249
|
+
if (typeof obj_featureSetApiName !== 'string') {
|
|
250
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureSetApiName + '" (at "' + path_featureSetApiName + '")');
|
|
251
|
+
}
|
|
252
|
+
const obj_featureSetStatus = obj.featureSetStatus;
|
|
253
|
+
const path_featureSetStatus = path + '.featureSetStatus';
|
|
254
|
+
if (typeof obj_featureSetStatus !== 'string') {
|
|
255
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureSetStatus + '" (at "' + path_featureSetStatus + '")');
|
|
256
|
+
}
|
|
257
|
+
const obj_featureStatusList = obj.featureStatusList;
|
|
258
|
+
const path_featureStatusList = path + '.featureStatusList';
|
|
259
|
+
if (!ArrayIsArray(obj_featureStatusList)) {
|
|
260
|
+
return new TypeError('Expected "array" but received "' + typeof obj_featureStatusList + '" (at "' + path_featureStatusList + '")');
|
|
261
|
+
}
|
|
262
|
+
for (let i = 0; i < obj_featureStatusList.length; i++) {
|
|
263
|
+
const obj_featureStatusList_item = obj_featureStatusList[i];
|
|
264
|
+
const path_featureStatusList_item = path_featureStatusList + '[' + i + ']';
|
|
265
|
+
const referencepath_featureStatusList_itemValidationError = validate$3(obj_featureStatusList_item, path_featureStatusList_item);
|
|
266
|
+
if (referencepath_featureStatusList_itemValidationError !== null) {
|
|
267
|
+
let message = 'Object doesn\'t match FeatureStatusRepresentation (at "' + path_featureStatusList_item + '")\n';
|
|
268
|
+
message += referencepath_featureStatusList_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
269
|
+
return new TypeError(message);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
})();
|
|
273
|
+
return v_error === undefined ? null : v_error;
|
|
274
|
+
}
|
|
275
|
+
const RepresentationType$1 = 'EnableFeatureSetOutputRepresentation';
|
|
276
|
+
function keyBuilder$3(luvio, config) {
|
|
277
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.featureSetApiName;
|
|
278
|
+
}
|
|
279
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
280
|
+
const keyParams = {
|
|
281
|
+
featureSetApiName: object.featureSetApiName
|
|
282
|
+
};
|
|
283
|
+
return keyBuilder$3(luvio, keyParams);
|
|
284
|
+
}
|
|
285
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
286
|
+
return input;
|
|
287
|
+
}
|
|
288
|
+
const select$4 = function EnableFeatureSetOutputRepresentationSelect() {
|
|
289
|
+
const { selections: FeatureSetErrorRepresentation__selections, opaque: FeatureSetErrorRepresentation__opaque, } = select$6();
|
|
290
|
+
const { selections: FeatureStatusRepresentation__selections, opaque: FeatureStatusRepresentation__opaque, } = select$5();
|
|
291
|
+
return {
|
|
292
|
+
kind: 'Fragment',
|
|
293
|
+
version: VERSION$2,
|
|
294
|
+
private: [],
|
|
295
|
+
selections: [
|
|
296
|
+
{
|
|
297
|
+
name: 'errors',
|
|
298
|
+
kind: 'Object',
|
|
299
|
+
plural: true,
|
|
300
|
+
selections: FeatureSetErrorRepresentation__selections
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
name: 'featureSetApiName',
|
|
304
|
+
kind: 'Scalar'
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'featureSetStatus',
|
|
308
|
+
kind: 'Scalar'
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: 'featureStatusList',
|
|
312
|
+
kind: 'Object',
|
|
313
|
+
plural: true,
|
|
314
|
+
selections: FeatureStatusRepresentation__selections
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
function equals$2(existing, incoming) {
|
|
320
|
+
const existing_featureSetApiName = existing.featureSetApiName;
|
|
321
|
+
const incoming_featureSetApiName = incoming.featureSetApiName;
|
|
322
|
+
if (!(existing_featureSetApiName === incoming_featureSetApiName)) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
const existing_featureSetStatus = existing.featureSetStatus;
|
|
326
|
+
const incoming_featureSetStatus = incoming.featureSetStatus;
|
|
327
|
+
if (!(existing_featureSetStatus === incoming_featureSetStatus)) {
|
|
328
|
+
return false;
|
|
329
|
+
}
|
|
330
|
+
const existing_errors = existing.errors;
|
|
331
|
+
const incoming_errors = incoming.errors;
|
|
332
|
+
const equals_errors_items = equalsArray(existing_errors, incoming_errors, (existing_errors_item, incoming_errors_item) => {
|
|
333
|
+
if (!(equals$4(existing_errors_item, incoming_errors_item))) {
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
if (equals_errors_items === false) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
const existing_featureStatusList = existing.featureStatusList;
|
|
341
|
+
const incoming_featureStatusList = incoming.featureStatusList;
|
|
342
|
+
const equals_featureStatusList_items = equalsArray(existing_featureStatusList, incoming_featureStatusList, (existing_featureStatusList_item, incoming_featureStatusList_item) => {
|
|
343
|
+
if (!(equals$3(existing_featureStatusList_item, incoming_featureStatusList_item))) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
if (equals_featureStatusList_items === false) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
const ingest$1 = function EnableFeatureSetOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
353
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
354
|
+
const validateError = validate$2(input);
|
|
355
|
+
if (validateError !== null) {
|
|
356
|
+
throw validateError;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
360
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 100;
|
|
361
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "basesetup", VERSION$2, RepresentationType$1, equals$2);
|
|
362
|
+
return createLink(key);
|
|
363
|
+
};
|
|
364
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
365
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
366
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
367
|
+
rootKeySet.set(rootKey, {
|
|
368
|
+
namespace: keyPrefix,
|
|
369
|
+
representationName: RepresentationType$1,
|
|
370
|
+
mergeable: false
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function select$3(luvio, params) {
|
|
375
|
+
return select$4();
|
|
376
|
+
}
|
|
377
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
378
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
379
|
+
}
|
|
380
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
381
|
+
const { body } = response;
|
|
382
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
383
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
384
|
+
const snapshot = luvio.storeLookup({
|
|
385
|
+
recordId: key,
|
|
386
|
+
node: select$3(),
|
|
387
|
+
variables: {},
|
|
388
|
+
});
|
|
389
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
390
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
391
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
deepFreeze(snapshot.data);
|
|
395
|
+
return snapshot;
|
|
396
|
+
}
|
|
397
|
+
function createResourceRequest$1(config) {
|
|
398
|
+
const headers = {};
|
|
399
|
+
return {
|
|
400
|
+
baseUri: '/services/data/v66.0',
|
|
401
|
+
basePath: '/connect/base-setup/enableFeatureSet',
|
|
402
|
+
method: 'post',
|
|
403
|
+
body: config.body,
|
|
404
|
+
urlParams: {},
|
|
405
|
+
queryParams: {},
|
|
406
|
+
headers,
|
|
407
|
+
priority: 'normal',
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const adapterName$1 = 'enableFeatureSet';
|
|
412
|
+
const enableFeatureSet_ConfigPropertyMetadata = [
|
|
413
|
+
generateParamConfigMetadata('additionalInfo', true, 2 /* Body */, 4 /* Unsupported */),
|
|
414
|
+
generateParamConfigMetadata('featureApiName', true, 2 /* Body */, 0 /* String */),
|
|
415
|
+
generateParamConfigMetadata('featureSetApiName', true, 2 /* Body */, 0 /* String */),
|
|
416
|
+
];
|
|
417
|
+
const enableFeatureSet_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, enableFeatureSet_ConfigPropertyMetadata);
|
|
418
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(enableFeatureSet_ConfigPropertyMetadata);
|
|
419
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
420
|
+
const config = {};
|
|
421
|
+
typeCheckConfig$2(untrustedConfig, config, enableFeatureSet_ConfigPropertyMetadata);
|
|
422
|
+
const untrustedConfig_additionalInfo = untrustedConfig.additionalInfo;
|
|
423
|
+
if (untrustedIsObject(untrustedConfig_additionalInfo)) {
|
|
424
|
+
const untrustedConfig_additionalInfo_object = {};
|
|
425
|
+
const untrustedConfig_additionalInfo_keys = Object.keys(untrustedConfig_additionalInfo);
|
|
426
|
+
for (let i = 0, arrayLength = untrustedConfig_additionalInfo_keys.length; i < arrayLength; i++) {
|
|
427
|
+
const key = untrustedConfig_additionalInfo_keys[i];
|
|
428
|
+
const untrustedConfig_additionalInfo_prop = untrustedConfig_additionalInfo[key];
|
|
429
|
+
if (untrustedIsObject(untrustedConfig_additionalInfo_prop)) {
|
|
430
|
+
const untrustedConfig_additionalInfo_prop_object = {};
|
|
431
|
+
if (untrustedConfig_additionalInfo_prop_object !== undefined && Object.keys(untrustedConfig_additionalInfo_prop_object).length >= 0) {
|
|
432
|
+
if (untrustedConfig_additionalInfo_object !== undefined) {
|
|
433
|
+
untrustedConfig_additionalInfo_object[key] = untrustedConfig_additionalInfo_prop_object;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (untrustedConfig_additionalInfo_object !== undefined && Object.keys(untrustedConfig_additionalInfo_object).length >= 0) {
|
|
439
|
+
config.additionalInfo = untrustedConfig_additionalInfo_object;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return config;
|
|
443
|
+
}
|
|
444
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
445
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
446
|
+
return null;
|
|
447
|
+
}
|
|
448
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
449
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
450
|
+
}
|
|
451
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
452
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
return config;
|
|
456
|
+
}
|
|
457
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
458
|
+
const resourceParams = createResourceParams$1(config);
|
|
459
|
+
const request = createResourceRequest$1(resourceParams);
|
|
460
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
461
|
+
.then((response) => {
|
|
462
|
+
return luvio.handleSuccessResponse(() => {
|
|
463
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
464
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
465
|
+
}, () => {
|
|
466
|
+
const cache = new StoreKeyMap();
|
|
467
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
468
|
+
return cache;
|
|
469
|
+
});
|
|
470
|
+
}, (response) => {
|
|
471
|
+
deepFreeze(response);
|
|
472
|
+
throw response;
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
const enableFeatureSetAdapterFactory = (luvio) => {
|
|
476
|
+
return function enableFeatureSet(untrustedConfig) {
|
|
477
|
+
const config = validateAdapterConfig$1(untrustedConfig, enableFeatureSet_ConfigPropertyNames);
|
|
478
|
+
// Invalid or incomplete config
|
|
479
|
+
if (config === null) {
|
|
480
|
+
throw new Error('Invalid config for "enableFeatureSet"');
|
|
481
|
+
}
|
|
482
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
const VERSION$1 = "ca4ec8cd4e622433088678cab5c86b05";
|
|
487
|
+
function validate$1(obj, path = 'FeatureRepresentation') {
|
|
488
|
+
const v_error = (() => {
|
|
489
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
490
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
491
|
+
}
|
|
492
|
+
const obj_errors = obj.errors;
|
|
493
|
+
const path_errors = path + '.errors';
|
|
494
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
495
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
496
|
+
}
|
|
497
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
498
|
+
const obj_errors_item = obj_errors[i];
|
|
499
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
500
|
+
const referencepath_errors_itemValidationError = validate$4(obj_errors_item, path_errors_item);
|
|
501
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
502
|
+
let message = 'Object doesn\'t match FeatureSetErrorRepresentation (at "' + path_errors_item + '")\n';
|
|
503
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
504
|
+
return new TypeError(message);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
const obj_featureApiName = obj.featureApiName;
|
|
508
|
+
const path_featureApiName = path + '.featureApiName';
|
|
509
|
+
if (typeof obj_featureApiName !== 'string') {
|
|
510
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureApiName + '" (at "' + path_featureApiName + '")');
|
|
511
|
+
}
|
|
512
|
+
const obj_featureStatus = obj.featureStatus;
|
|
513
|
+
const path_featureStatus = path + '.featureStatus';
|
|
514
|
+
if (typeof obj_featureStatus !== 'string') {
|
|
515
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureStatus + '" (at "' + path_featureStatus + '")');
|
|
516
|
+
}
|
|
517
|
+
const obj_reExecuteFeature = obj.reExecuteFeature;
|
|
518
|
+
const path_reExecuteFeature = path + '.reExecuteFeature';
|
|
519
|
+
if (typeof obj_reExecuteFeature !== 'boolean') {
|
|
520
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_reExecuteFeature + '" (at "' + path_reExecuteFeature + '")');
|
|
521
|
+
}
|
|
522
|
+
})();
|
|
523
|
+
return v_error === undefined ? null : v_error;
|
|
524
|
+
}
|
|
525
|
+
const select$2 = function FeatureRepresentationSelect() {
|
|
526
|
+
const { selections: FeatureSetErrorRepresentation__selections, opaque: FeatureSetErrorRepresentation__opaque, } = select$6();
|
|
527
|
+
return {
|
|
528
|
+
kind: 'Fragment',
|
|
529
|
+
version: VERSION$1,
|
|
530
|
+
private: [],
|
|
531
|
+
selections: [
|
|
532
|
+
{
|
|
533
|
+
name: 'errors',
|
|
534
|
+
kind: 'Object',
|
|
535
|
+
plural: true,
|
|
536
|
+
selections: FeatureSetErrorRepresentation__selections
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
name: 'featureApiName',
|
|
540
|
+
kind: 'Scalar'
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: 'featureStatus',
|
|
544
|
+
kind: 'Scalar'
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
name: 'reExecuteFeature',
|
|
548
|
+
kind: 'Scalar'
|
|
549
|
+
}
|
|
550
|
+
]
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
function equals$1(existing, incoming) {
|
|
554
|
+
const existing_reExecuteFeature = existing.reExecuteFeature;
|
|
555
|
+
const incoming_reExecuteFeature = incoming.reExecuteFeature;
|
|
556
|
+
if (!(existing_reExecuteFeature === incoming_reExecuteFeature)) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
const existing_featureApiName = existing.featureApiName;
|
|
560
|
+
const incoming_featureApiName = incoming.featureApiName;
|
|
561
|
+
if (!(existing_featureApiName === incoming_featureApiName)) {
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
const existing_featureStatus = existing.featureStatus;
|
|
565
|
+
const incoming_featureStatus = incoming.featureStatus;
|
|
566
|
+
if (!(existing_featureStatus === incoming_featureStatus)) {
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
const existing_errors = existing.errors;
|
|
570
|
+
const incoming_errors = incoming.errors;
|
|
571
|
+
const equals_errors_items = equalsArray(existing_errors, incoming_errors, (existing_errors_item, incoming_errors_item) => {
|
|
572
|
+
if (!(equals$4(existing_errors_item, incoming_errors_item))) {
|
|
573
|
+
return false;
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
if (equals_errors_items === false) {
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const VERSION = "0970fea00fb709ac6da6352a070b6436";
|
|
583
|
+
function validate(obj, path = 'FeatureSetRepresentation') {
|
|
584
|
+
const v_error = (() => {
|
|
585
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
586
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
587
|
+
}
|
|
588
|
+
const obj_description = obj.description;
|
|
589
|
+
const path_description = path + '.description';
|
|
590
|
+
if (typeof obj_description !== 'string') {
|
|
591
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
592
|
+
}
|
|
593
|
+
const obj_errors = obj.errors;
|
|
594
|
+
const path_errors = path + '.errors';
|
|
595
|
+
if (!ArrayIsArray(obj_errors)) {
|
|
596
|
+
return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
|
|
597
|
+
}
|
|
598
|
+
for (let i = 0; i < obj_errors.length; i++) {
|
|
599
|
+
const obj_errors_item = obj_errors[i];
|
|
600
|
+
const path_errors_item = path_errors + '[' + i + ']';
|
|
601
|
+
const referencepath_errors_itemValidationError = validate$4(obj_errors_item, path_errors_item);
|
|
602
|
+
if (referencepath_errors_itemValidationError !== null) {
|
|
603
|
+
let message = 'Object doesn\'t match FeatureSetErrorRepresentation (at "' + path_errors_item + '")\n';
|
|
604
|
+
message += referencepath_errors_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
605
|
+
return new TypeError(message);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
const obj_featureSetApiName = obj.featureSetApiName;
|
|
609
|
+
const path_featureSetApiName = path + '.featureSetApiName';
|
|
610
|
+
if (typeof obj_featureSetApiName !== 'string') {
|
|
611
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureSetApiName + '" (at "' + path_featureSetApiName + '")');
|
|
612
|
+
}
|
|
613
|
+
const obj_featureSetStatus = obj.featureSetStatus;
|
|
614
|
+
const path_featureSetStatus = path + '.featureSetStatus';
|
|
615
|
+
if (typeof obj_featureSetStatus !== 'string') {
|
|
616
|
+
return new TypeError('Expected "string" but received "' + typeof obj_featureSetStatus + '" (at "' + path_featureSetStatus + '")');
|
|
617
|
+
}
|
|
618
|
+
const obj_features = obj.features;
|
|
619
|
+
const path_features = path + '.features';
|
|
620
|
+
if (!ArrayIsArray(obj_features)) {
|
|
621
|
+
return new TypeError('Expected "array" but received "' + typeof obj_features + '" (at "' + path_features + '")');
|
|
622
|
+
}
|
|
623
|
+
for (let i = 0; i < obj_features.length; i++) {
|
|
624
|
+
const obj_features_item = obj_features[i];
|
|
625
|
+
const path_features_item = path_features + '[' + i + ']';
|
|
626
|
+
const referencepath_features_itemValidationError = validate$1(obj_features_item, path_features_item);
|
|
627
|
+
if (referencepath_features_itemValidationError !== null) {
|
|
628
|
+
let message = 'Object doesn\'t match FeatureRepresentation (at "' + path_features_item + '")\n';
|
|
629
|
+
message += referencepath_features_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
630
|
+
return new TypeError(message);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
})();
|
|
634
|
+
return v_error === undefined ? null : v_error;
|
|
635
|
+
}
|
|
636
|
+
const RepresentationType = 'FeatureSetRepresentation';
|
|
637
|
+
function keyBuilder$2(luvio, config) {
|
|
638
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.featureSetApiName;
|
|
639
|
+
}
|
|
640
|
+
function keyBuilderFromType(luvio, object) {
|
|
641
|
+
const keyParams = {
|
|
642
|
+
featureSetApiName: object.featureSetApiName
|
|
643
|
+
};
|
|
644
|
+
return keyBuilder$2(luvio, keyParams);
|
|
645
|
+
}
|
|
646
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
647
|
+
return input;
|
|
648
|
+
}
|
|
649
|
+
const select$1 = function FeatureSetRepresentationSelect() {
|
|
650
|
+
const { selections: FeatureSetErrorRepresentation__selections, opaque: FeatureSetErrorRepresentation__opaque, } = select$6();
|
|
651
|
+
const { selections: FeatureRepresentation__selections, opaque: FeatureRepresentation__opaque, } = select$2();
|
|
652
|
+
return {
|
|
653
|
+
kind: 'Fragment',
|
|
654
|
+
version: VERSION,
|
|
655
|
+
private: [],
|
|
656
|
+
selections: [
|
|
657
|
+
{
|
|
658
|
+
name: 'description',
|
|
659
|
+
kind: 'Scalar'
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
name: 'errors',
|
|
663
|
+
kind: 'Object',
|
|
664
|
+
plural: true,
|
|
665
|
+
selections: FeatureSetErrorRepresentation__selections
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: 'featureSetApiName',
|
|
669
|
+
kind: 'Scalar'
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
name: 'featureSetStatus',
|
|
673
|
+
kind: 'Scalar'
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
name: 'features',
|
|
677
|
+
kind: 'Object',
|
|
678
|
+
plural: true,
|
|
679
|
+
selections: FeatureRepresentation__selections
|
|
680
|
+
}
|
|
681
|
+
]
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
function equals(existing, incoming) {
|
|
685
|
+
const existing_description = existing.description;
|
|
686
|
+
const incoming_description = incoming.description;
|
|
687
|
+
if (!(existing_description === incoming_description)) {
|
|
688
|
+
return false;
|
|
689
|
+
}
|
|
690
|
+
const existing_featureSetApiName = existing.featureSetApiName;
|
|
691
|
+
const incoming_featureSetApiName = incoming.featureSetApiName;
|
|
692
|
+
if (!(existing_featureSetApiName === incoming_featureSetApiName)) {
|
|
693
|
+
return false;
|
|
694
|
+
}
|
|
695
|
+
const existing_featureSetStatus = existing.featureSetStatus;
|
|
696
|
+
const incoming_featureSetStatus = incoming.featureSetStatus;
|
|
697
|
+
if (!(existing_featureSetStatus === incoming_featureSetStatus)) {
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
const existing_errors = existing.errors;
|
|
701
|
+
const incoming_errors = incoming.errors;
|
|
702
|
+
const equals_errors_items = equalsArray(existing_errors, incoming_errors, (existing_errors_item, incoming_errors_item) => {
|
|
703
|
+
if (!(equals$4(existing_errors_item, incoming_errors_item))) {
|
|
704
|
+
return false;
|
|
705
|
+
}
|
|
706
|
+
});
|
|
707
|
+
if (equals_errors_items === false) {
|
|
708
|
+
return false;
|
|
709
|
+
}
|
|
710
|
+
const existing_features = existing.features;
|
|
711
|
+
const incoming_features = incoming.features;
|
|
712
|
+
const equals_features_items = equalsArray(existing_features, incoming_features, (existing_features_item, incoming_features_item) => {
|
|
713
|
+
if (!(equals$1(existing_features_item, incoming_features_item))) {
|
|
714
|
+
return false;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
if (equals_features_items === false) {
|
|
718
|
+
return false;
|
|
719
|
+
}
|
|
720
|
+
return true;
|
|
721
|
+
}
|
|
722
|
+
const ingest = function FeatureSetRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
723
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
724
|
+
const validateError = validate(input);
|
|
725
|
+
if (validateError !== null) {
|
|
726
|
+
throw validateError;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
const key = keyBuilderFromType(luvio, input);
|
|
730
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 100;
|
|
731
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "basesetup", VERSION, RepresentationType, equals);
|
|
732
|
+
return createLink(key);
|
|
733
|
+
};
|
|
734
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
735
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
736
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
737
|
+
rootKeySet.set(rootKey, {
|
|
738
|
+
namespace: keyPrefix,
|
|
739
|
+
representationName: RepresentationType,
|
|
740
|
+
mergeable: false
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
function select(luvio, params) {
|
|
745
|
+
return select$1();
|
|
746
|
+
}
|
|
747
|
+
function keyBuilder$1(luvio, params) {
|
|
748
|
+
return keyBuilder$2(luvio, {
|
|
749
|
+
featureSetApiName: params.queryParams.featureSetApiName
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
753
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
754
|
+
}
|
|
755
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
756
|
+
const { body } = response;
|
|
757
|
+
const key = keyBuilder$1(luvio, resourceParams);
|
|
758
|
+
luvio.storeIngest(key, ingest, body);
|
|
759
|
+
const snapshot = luvio.storeLookup({
|
|
760
|
+
recordId: key,
|
|
761
|
+
node: select(),
|
|
762
|
+
variables: {},
|
|
763
|
+
}, snapshotRefresh);
|
|
764
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
765
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
766
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
deepFreeze(snapshot.data);
|
|
770
|
+
return snapshot;
|
|
771
|
+
}
|
|
772
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
773
|
+
const key = keyBuilder$1(luvio, params);
|
|
774
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
775
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
776
|
+
return errorSnapshot;
|
|
777
|
+
}
|
|
778
|
+
function createResourceRequest(config) {
|
|
779
|
+
const headers = {};
|
|
780
|
+
return {
|
|
781
|
+
baseUri: '/services/data/v66.0',
|
|
782
|
+
basePath: '/connect/base-setup/featureSetDetail',
|
|
783
|
+
method: 'get',
|
|
784
|
+
body: null,
|
|
785
|
+
urlParams: {},
|
|
786
|
+
queryParams: config.queryParams,
|
|
787
|
+
headers,
|
|
788
|
+
priority: 'normal',
|
|
789
|
+
};
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const adapterName = 'getFeatureSetDetail';
|
|
793
|
+
const getFeatureSetDetail_ConfigPropertyMetadata = [
|
|
794
|
+
generateParamConfigMetadata('featureApiNames', false, 1 /* QueryParameter */, 0 /* String */, true),
|
|
795
|
+
generateParamConfigMetadata('featureSetApiName', true, 1 /* QueryParameter */, 0 /* String */),
|
|
796
|
+
];
|
|
797
|
+
const getFeatureSetDetail_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getFeatureSetDetail_ConfigPropertyMetadata);
|
|
798
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$2(getFeatureSetDetail_ConfigPropertyMetadata);
|
|
799
|
+
function keyBuilder(luvio, config) {
|
|
800
|
+
const resourceParams = createResourceParams(config);
|
|
801
|
+
return keyBuilder$1(luvio, resourceParams);
|
|
802
|
+
}
|
|
803
|
+
function typeCheckConfig(untrustedConfig) {
|
|
804
|
+
const config = {};
|
|
805
|
+
typeCheckConfig$2(untrustedConfig, config, getFeatureSetDetail_ConfigPropertyMetadata);
|
|
806
|
+
return config;
|
|
807
|
+
}
|
|
808
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
809
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
810
|
+
return null;
|
|
811
|
+
}
|
|
812
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
813
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
814
|
+
}
|
|
815
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
816
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
817
|
+
return null;
|
|
818
|
+
}
|
|
819
|
+
return config;
|
|
820
|
+
}
|
|
821
|
+
function adapterFragment(luvio, config) {
|
|
822
|
+
createResourceParams(config);
|
|
823
|
+
return select();
|
|
824
|
+
}
|
|
825
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
826
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
827
|
+
config,
|
|
828
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
829
|
+
});
|
|
830
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
831
|
+
}
|
|
832
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
833
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
834
|
+
config,
|
|
835
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
836
|
+
});
|
|
837
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
838
|
+
}
|
|
839
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
840
|
+
const resourceParams = createResourceParams(config);
|
|
841
|
+
const request = createResourceRequest(resourceParams);
|
|
842
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
843
|
+
.then((response) => {
|
|
844
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
845
|
+
const cache = new StoreKeyMap();
|
|
846
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
847
|
+
return cache;
|
|
848
|
+
});
|
|
849
|
+
}, (response) => {
|
|
850
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
854
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
855
|
+
}
|
|
856
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
857
|
+
const { luvio, config } = context;
|
|
858
|
+
const selector = {
|
|
859
|
+
recordId: keyBuilder(luvio, config),
|
|
860
|
+
node: adapterFragment(luvio, config),
|
|
861
|
+
variables: {},
|
|
862
|
+
};
|
|
863
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
864
|
+
config,
|
|
865
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
866
|
+
});
|
|
867
|
+
return cacheSnapshot;
|
|
868
|
+
}
|
|
869
|
+
const getFeatureSetDetailAdapterFactory = (luvio) => function basesetup__getFeatureSetDetail(untrustedConfig, requestContext) {
|
|
870
|
+
const config = validateAdapterConfig(untrustedConfig, getFeatureSetDetail_ConfigPropertyNames);
|
|
871
|
+
// Invalid or incomplete config
|
|
872
|
+
if (config === null) {
|
|
873
|
+
return null;
|
|
874
|
+
}
|
|
875
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
876
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
export { enableFeatureSetAdapterFactory, getFeatureSetDetailAdapterFactory };
|