@salesforce/lds-adapters-service-data-category 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-data-category.js +617 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getCategoryGroups.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectDataCategoryCategoryGroup.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/types/DataCategoryGroupCollectionRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/DataCategoryGroupRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/DataCategoryRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +74 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +648 -0
- package/src/raml/api.raml +83 -0
- package/src/raml/luvio.raml +14 -0
|
@@ -0,0 +1,617 @@
|
|
|
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$1, StoreKeyMap, createResourceParams as createResourceParams$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 buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
52
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
53
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
54
|
+
return {
|
|
55
|
+
displayName,
|
|
56
|
+
parameters: {
|
|
57
|
+
required,
|
|
58
|
+
optional,
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const keyPrefix = 'DataCategory';
|
|
63
|
+
|
|
64
|
+
const { isArray: ArrayIsArray } = Array;
|
|
65
|
+
const { stringify: JSONStringify } = JSON;
|
|
66
|
+
function equalsArray(a, b, equalsItem) {
|
|
67
|
+
const aLength = a.length;
|
|
68
|
+
const bLength = b.length;
|
|
69
|
+
if (aLength !== bLength) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
for (let i = 0; i < aLength; i++) {
|
|
73
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
function createLink(ref) {
|
|
80
|
+
return {
|
|
81
|
+
__ref: serializeStructuredKey(ref),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const VERSION$2 = "a1b37afe14d9e9799b7a3ee007ce69f6";
|
|
86
|
+
function validate$2(obj, path = 'DataCategoryRepresentation') {
|
|
87
|
+
const v_error = (() => {
|
|
88
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
89
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
90
|
+
}
|
|
91
|
+
if (obj.categoryName !== undefined) {
|
|
92
|
+
const obj_categoryName = obj.categoryName;
|
|
93
|
+
const path_categoryName = path + '.categoryName';
|
|
94
|
+
let obj_categoryName_union0 = null;
|
|
95
|
+
const obj_categoryName_union0_error = (() => {
|
|
96
|
+
if (typeof obj_categoryName !== 'string') {
|
|
97
|
+
return new TypeError('Expected "string" but received "' + typeof obj_categoryName + '" (at "' + path_categoryName + '")');
|
|
98
|
+
}
|
|
99
|
+
})();
|
|
100
|
+
if (obj_categoryName_union0_error != null) {
|
|
101
|
+
obj_categoryName_union0 = obj_categoryName_union0_error.message;
|
|
102
|
+
}
|
|
103
|
+
let obj_categoryName_union1 = null;
|
|
104
|
+
const obj_categoryName_union1_error = (() => {
|
|
105
|
+
if (obj_categoryName !== null) {
|
|
106
|
+
return new TypeError('Expected "null" but received "' + typeof obj_categoryName + '" (at "' + path_categoryName + '")');
|
|
107
|
+
}
|
|
108
|
+
})();
|
|
109
|
+
if (obj_categoryName_union1_error != null) {
|
|
110
|
+
obj_categoryName_union1 = obj_categoryName_union1_error.message;
|
|
111
|
+
}
|
|
112
|
+
if (obj_categoryName_union0 && obj_categoryName_union1) {
|
|
113
|
+
let message = 'Object doesn\'t match union (at "' + path_categoryName + '")';
|
|
114
|
+
message += '\n' + obj_categoryName_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
115
|
+
message += '\n' + obj_categoryName_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
116
|
+
return new TypeError(message);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const obj_childCategories = obj.childCategories;
|
|
120
|
+
const path_childCategories = path + '.childCategories';
|
|
121
|
+
if (!ArrayIsArray(obj_childCategories)) {
|
|
122
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childCategories + '" (at "' + path_childCategories + '")');
|
|
123
|
+
}
|
|
124
|
+
for (let i = 0; i < obj_childCategories.length; i++) {
|
|
125
|
+
const obj_childCategories_item = obj_childCategories[i];
|
|
126
|
+
const path_childCategories_item = path_childCategories + '[' + i + ']';
|
|
127
|
+
if (obj_childCategories_item === undefined) {
|
|
128
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_childCategories_item + '" (at "' + path_childCategories_item + '")');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (obj.label !== undefined) {
|
|
132
|
+
const obj_label = obj.label;
|
|
133
|
+
const path_label = path + '.label';
|
|
134
|
+
let obj_label_union0 = null;
|
|
135
|
+
const obj_label_union0_error = (() => {
|
|
136
|
+
if (typeof obj_label !== 'string') {
|
|
137
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
138
|
+
}
|
|
139
|
+
})();
|
|
140
|
+
if (obj_label_union0_error != null) {
|
|
141
|
+
obj_label_union0 = obj_label_union0_error.message;
|
|
142
|
+
}
|
|
143
|
+
let obj_label_union1 = null;
|
|
144
|
+
const obj_label_union1_error = (() => {
|
|
145
|
+
if (obj_label !== null) {
|
|
146
|
+
return new TypeError('Expected "null" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
147
|
+
}
|
|
148
|
+
})();
|
|
149
|
+
if (obj_label_union1_error != null) {
|
|
150
|
+
obj_label_union1 = obj_label_union1_error.message;
|
|
151
|
+
}
|
|
152
|
+
if (obj_label_union0 && obj_label_union1) {
|
|
153
|
+
let message = 'Object doesn\'t match union (at "' + path_label + '")';
|
|
154
|
+
message += '\n' + obj_label_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
155
|
+
message += '\n' + obj_label_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
156
|
+
return new TypeError(message);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
})();
|
|
160
|
+
return v_error === undefined ? null : v_error;
|
|
161
|
+
}
|
|
162
|
+
const select$3 = function DataCategoryRepresentationSelect() {
|
|
163
|
+
return {
|
|
164
|
+
kind: 'Fragment',
|
|
165
|
+
version: VERSION$2,
|
|
166
|
+
private: [],
|
|
167
|
+
selections: [
|
|
168
|
+
{
|
|
169
|
+
name: 'categoryName',
|
|
170
|
+
kind: 'Scalar',
|
|
171
|
+
required: false
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'childCategories',
|
|
175
|
+
kind: 'Object',
|
|
176
|
+
// any
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: 'label',
|
|
180
|
+
kind: 'Scalar',
|
|
181
|
+
required: false
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
function equals$2(existing, incoming) {
|
|
187
|
+
const existing_categoryName = existing.categoryName;
|
|
188
|
+
const incoming_categoryName = incoming.categoryName;
|
|
189
|
+
// if at least one of these optionals is defined
|
|
190
|
+
if (existing_categoryName !== undefined || incoming_categoryName !== undefined) {
|
|
191
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
192
|
+
// not equal
|
|
193
|
+
if (existing_categoryName === undefined || incoming_categoryName === undefined) {
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
if (!(existing_categoryName === incoming_categoryName)) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const existing_childCategories = existing.childCategories;
|
|
201
|
+
const incoming_childCategories = incoming.childCategories;
|
|
202
|
+
const equals_childCategories_items = equalsArray(existing_childCategories, incoming_childCategories, (existing_childCategories_item, incoming_childCategories_item) => {
|
|
203
|
+
if (JSONStringify(incoming_childCategories_item) !== JSONStringify(existing_childCategories_item)) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
if (equals_childCategories_items === false) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
const existing_label = existing.label;
|
|
211
|
+
const incoming_label = incoming.label;
|
|
212
|
+
// if at least one of these optionals is defined
|
|
213
|
+
if (existing_label !== undefined || incoming_label !== undefined) {
|
|
214
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
215
|
+
// not equal
|
|
216
|
+
if (existing_label === undefined || incoming_label === undefined) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
if (!(existing_label === incoming_label)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const VERSION$1 = "8e3eb3ae1204429eabbe1e783ca072f7";
|
|
227
|
+
function validate$1(obj, path = 'DataCategoryGroupRepresentation') {
|
|
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_categoryGroupName = obj.categoryGroupName;
|
|
233
|
+
const path_categoryGroupName = path + '.categoryGroupName';
|
|
234
|
+
if (typeof obj_categoryGroupName !== 'string') {
|
|
235
|
+
return new TypeError('Expected "string" but received "' + typeof obj_categoryGroupName + '" (at "' + path_categoryGroupName + '")');
|
|
236
|
+
}
|
|
237
|
+
if (obj.description !== undefined) {
|
|
238
|
+
const obj_description = obj.description;
|
|
239
|
+
const path_description = path + '.description';
|
|
240
|
+
let obj_description_union0 = null;
|
|
241
|
+
const obj_description_union0_error = (() => {
|
|
242
|
+
if (typeof obj_description !== 'string') {
|
|
243
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
244
|
+
}
|
|
245
|
+
})();
|
|
246
|
+
if (obj_description_union0_error != null) {
|
|
247
|
+
obj_description_union0 = obj_description_union0_error.message;
|
|
248
|
+
}
|
|
249
|
+
let obj_description_union1 = null;
|
|
250
|
+
const obj_description_union1_error = (() => {
|
|
251
|
+
if (obj_description !== null) {
|
|
252
|
+
return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
253
|
+
}
|
|
254
|
+
})();
|
|
255
|
+
if (obj_description_union1_error != null) {
|
|
256
|
+
obj_description_union1 = obj_description_union1_error.message;
|
|
257
|
+
}
|
|
258
|
+
if (obj_description_union0 && obj_description_union1) {
|
|
259
|
+
let message = 'Object doesn\'t match union (at "' + path_description + '")';
|
|
260
|
+
message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
261
|
+
message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
262
|
+
return new TypeError(message);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (obj.label !== undefined) {
|
|
266
|
+
const obj_label = obj.label;
|
|
267
|
+
const path_label = path + '.label';
|
|
268
|
+
let obj_label_union0 = null;
|
|
269
|
+
const obj_label_union0_error = (() => {
|
|
270
|
+
if (typeof obj_label !== 'string') {
|
|
271
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
272
|
+
}
|
|
273
|
+
})();
|
|
274
|
+
if (obj_label_union0_error != null) {
|
|
275
|
+
obj_label_union0 = obj_label_union0_error.message;
|
|
276
|
+
}
|
|
277
|
+
let obj_label_union1 = null;
|
|
278
|
+
const obj_label_union1_error = (() => {
|
|
279
|
+
if (obj_label !== null) {
|
|
280
|
+
return new TypeError('Expected "null" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
281
|
+
}
|
|
282
|
+
})();
|
|
283
|
+
if (obj_label_union1_error != null) {
|
|
284
|
+
obj_label_union1 = obj_label_union1_error.message;
|
|
285
|
+
}
|
|
286
|
+
if (obj_label_union0 && obj_label_union1) {
|
|
287
|
+
let message = 'Object doesn\'t match union (at "' + path_label + '")';
|
|
288
|
+
message += '\n' + obj_label_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
289
|
+
message += '\n' + obj_label_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
290
|
+
return new TypeError(message);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (obj.rootCategory !== undefined) {
|
|
294
|
+
const obj_rootCategory = obj.rootCategory;
|
|
295
|
+
const path_rootCategory = path + '.rootCategory';
|
|
296
|
+
let obj_rootCategory_union0 = null;
|
|
297
|
+
const obj_rootCategory_union0_error = (() => {
|
|
298
|
+
const referencepath_rootCategoryValidationError = validate$2(obj_rootCategory, path_rootCategory);
|
|
299
|
+
if (referencepath_rootCategoryValidationError !== null) {
|
|
300
|
+
let message = 'Object doesn\'t match DataCategoryRepresentation (at "' + path_rootCategory + '")\n';
|
|
301
|
+
message += referencepath_rootCategoryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
302
|
+
return new TypeError(message);
|
|
303
|
+
}
|
|
304
|
+
})();
|
|
305
|
+
if (obj_rootCategory_union0_error != null) {
|
|
306
|
+
obj_rootCategory_union0 = obj_rootCategory_union0_error.message;
|
|
307
|
+
}
|
|
308
|
+
let obj_rootCategory_union1 = null;
|
|
309
|
+
const obj_rootCategory_union1_error = (() => {
|
|
310
|
+
if (obj_rootCategory !== null) {
|
|
311
|
+
return new TypeError('Expected "null" but received "' + typeof obj_rootCategory + '" (at "' + path_rootCategory + '")');
|
|
312
|
+
}
|
|
313
|
+
})();
|
|
314
|
+
if (obj_rootCategory_union1_error != null) {
|
|
315
|
+
obj_rootCategory_union1 = obj_rootCategory_union1_error.message;
|
|
316
|
+
}
|
|
317
|
+
if (obj_rootCategory_union0 && obj_rootCategory_union1) {
|
|
318
|
+
let message = 'Object doesn\'t match union (at "' + path_rootCategory + '")';
|
|
319
|
+
message += '\n' + obj_rootCategory_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
320
|
+
message += '\n' + obj_rootCategory_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
321
|
+
return new TypeError(message);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
})();
|
|
325
|
+
return v_error === undefined ? null : v_error;
|
|
326
|
+
}
|
|
327
|
+
const select$2 = function DataCategoryGroupRepresentationSelect() {
|
|
328
|
+
const { selections: DataCategoryRepresentation__selections, opaque: DataCategoryRepresentation__opaque, } = select$3();
|
|
329
|
+
return {
|
|
330
|
+
kind: 'Fragment',
|
|
331
|
+
version: VERSION$1,
|
|
332
|
+
private: [],
|
|
333
|
+
selections: [
|
|
334
|
+
{
|
|
335
|
+
name: 'categoryGroupName',
|
|
336
|
+
kind: 'Scalar'
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'description',
|
|
340
|
+
kind: 'Scalar',
|
|
341
|
+
required: false
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: 'label',
|
|
345
|
+
kind: 'Scalar',
|
|
346
|
+
required: false
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: 'rootCategory',
|
|
350
|
+
kind: 'Object',
|
|
351
|
+
nullable: true,
|
|
352
|
+
selections: DataCategoryRepresentation__selections,
|
|
353
|
+
required: false
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
function equals$1(existing, incoming) {
|
|
359
|
+
const existing_categoryGroupName = existing.categoryGroupName;
|
|
360
|
+
const incoming_categoryGroupName = incoming.categoryGroupName;
|
|
361
|
+
if (!(existing_categoryGroupName === incoming_categoryGroupName)) {
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
const existing_description = existing.description;
|
|
365
|
+
const incoming_description = incoming.description;
|
|
366
|
+
// if at least one of these optionals is defined
|
|
367
|
+
if (existing_description !== undefined || incoming_description !== undefined) {
|
|
368
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
369
|
+
// not equal
|
|
370
|
+
if (existing_description === undefined || incoming_description === undefined) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
if (!(existing_description === incoming_description)) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const existing_label = existing.label;
|
|
378
|
+
const incoming_label = incoming.label;
|
|
379
|
+
// if at least one of these optionals is defined
|
|
380
|
+
if (existing_label !== undefined || incoming_label !== undefined) {
|
|
381
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
382
|
+
// not equal
|
|
383
|
+
if (existing_label === undefined || incoming_label === undefined) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
if (!(existing_label === incoming_label)) {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
const existing_rootCategory = existing.rootCategory;
|
|
391
|
+
const incoming_rootCategory = incoming.rootCategory;
|
|
392
|
+
// if at least one of these optionals is defined
|
|
393
|
+
if (existing_rootCategory !== undefined || incoming_rootCategory !== undefined) {
|
|
394
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
395
|
+
// not equal
|
|
396
|
+
if (existing_rootCategory === undefined || incoming_rootCategory === undefined) {
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
if (!(existing_rootCategory === incoming_rootCategory
|
|
400
|
+
|| (existing_rootCategory != null &&
|
|
401
|
+
incoming_rootCategory != null &&
|
|
402
|
+
equals$2(existing_rootCategory, incoming_rootCategory)))) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
const VERSION = "db13362abaa16e37af68b2073902b190";
|
|
410
|
+
function validate(obj, path = 'DataCategoryGroupCollectionRepresentation') {
|
|
411
|
+
const v_error = (() => {
|
|
412
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
413
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
414
|
+
}
|
|
415
|
+
const obj_dataCategoryGroups = obj.dataCategoryGroups;
|
|
416
|
+
const path_dataCategoryGroups = path + '.dataCategoryGroups';
|
|
417
|
+
if (!ArrayIsArray(obj_dataCategoryGroups)) {
|
|
418
|
+
return new TypeError('Expected "array" but received "' + typeof obj_dataCategoryGroups + '" (at "' + path_dataCategoryGroups + '")');
|
|
419
|
+
}
|
|
420
|
+
for (let i = 0; i < obj_dataCategoryGroups.length; i++) {
|
|
421
|
+
const obj_dataCategoryGroups_item = obj_dataCategoryGroups[i];
|
|
422
|
+
const path_dataCategoryGroups_item = path_dataCategoryGroups + '[' + i + ']';
|
|
423
|
+
const referencepath_dataCategoryGroups_itemValidationError = validate$1(obj_dataCategoryGroups_item, path_dataCategoryGroups_item);
|
|
424
|
+
if (referencepath_dataCategoryGroups_itemValidationError !== null) {
|
|
425
|
+
let message = 'Object doesn\'t match DataCategoryGroupRepresentation (at "' + path_dataCategoryGroups_item + '")\n';
|
|
426
|
+
message += referencepath_dataCategoryGroups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
427
|
+
return new TypeError(message);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
})();
|
|
431
|
+
return v_error === undefined ? null : v_error;
|
|
432
|
+
}
|
|
433
|
+
const RepresentationType = 'DataCategoryGroupCollectionRepresentation';
|
|
434
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
435
|
+
return input;
|
|
436
|
+
}
|
|
437
|
+
const select$1 = function DataCategoryGroupCollectionRepresentationSelect() {
|
|
438
|
+
const { selections: DataCategoryGroupRepresentation__selections, opaque: DataCategoryGroupRepresentation__opaque, } = select$2();
|
|
439
|
+
return {
|
|
440
|
+
kind: 'Fragment',
|
|
441
|
+
version: VERSION,
|
|
442
|
+
private: [],
|
|
443
|
+
selections: [
|
|
444
|
+
{
|
|
445
|
+
name: 'dataCategoryGroups',
|
|
446
|
+
kind: 'Object',
|
|
447
|
+
plural: true,
|
|
448
|
+
selections: DataCategoryGroupRepresentation__selections
|
|
449
|
+
}
|
|
450
|
+
]
|
|
451
|
+
};
|
|
452
|
+
};
|
|
453
|
+
function equals(existing, incoming) {
|
|
454
|
+
const existing_dataCategoryGroups = existing.dataCategoryGroups;
|
|
455
|
+
const incoming_dataCategoryGroups = incoming.dataCategoryGroups;
|
|
456
|
+
const equals_dataCategoryGroups_items = equalsArray(existing_dataCategoryGroups, incoming_dataCategoryGroups, (existing_dataCategoryGroups_item, incoming_dataCategoryGroups_item) => {
|
|
457
|
+
if (!(equals$1(existing_dataCategoryGroups_item, incoming_dataCategoryGroups_item))) {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
if (equals_dataCategoryGroups_items === false) {
|
|
462
|
+
return false;
|
|
463
|
+
}
|
|
464
|
+
return true;
|
|
465
|
+
}
|
|
466
|
+
const ingest = function DataCategoryGroupCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
467
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
468
|
+
const validateError = validate(input);
|
|
469
|
+
if (validateError !== null) {
|
|
470
|
+
throw validateError;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const key = path.fullPath;
|
|
474
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 900000;
|
|
475
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "DataCategory", VERSION, RepresentationType, equals);
|
|
476
|
+
return createLink(key);
|
|
477
|
+
};
|
|
478
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
479
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
480
|
+
const rootKey = fullPathFactory();
|
|
481
|
+
rootKeySet.set(rootKey, {
|
|
482
|
+
namespace: keyPrefix,
|
|
483
|
+
representationName: RepresentationType,
|
|
484
|
+
mergeable: false
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function select(luvio, params) {
|
|
489
|
+
return select$1();
|
|
490
|
+
}
|
|
491
|
+
function keyBuilder$1(luvio, params) {
|
|
492
|
+
return keyPrefix + '::DataCategoryGroupCollectionRepresentation:(' + ')';
|
|
493
|
+
}
|
|
494
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
495
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1());
|
|
496
|
+
}
|
|
497
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
498
|
+
const { body } = response;
|
|
499
|
+
const key = keyBuilder$1();
|
|
500
|
+
luvio.storeIngest(key, ingest, body);
|
|
501
|
+
const snapshot = luvio.storeLookup({
|
|
502
|
+
recordId: key,
|
|
503
|
+
node: select(),
|
|
504
|
+
variables: {},
|
|
505
|
+
}, snapshotRefresh);
|
|
506
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
507
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
508
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
deepFreeze(snapshot.data);
|
|
512
|
+
return snapshot;
|
|
513
|
+
}
|
|
514
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
515
|
+
const key = keyBuilder$1();
|
|
516
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
517
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
518
|
+
return errorSnapshot;
|
|
519
|
+
}
|
|
520
|
+
function createResourceRequest(config) {
|
|
521
|
+
const headers = {};
|
|
522
|
+
return {
|
|
523
|
+
baseUri: '/services/data/v66.0',
|
|
524
|
+
basePath: '/connect/data-category/category-group',
|
|
525
|
+
method: 'get',
|
|
526
|
+
body: null,
|
|
527
|
+
urlParams: {},
|
|
528
|
+
queryParams: {},
|
|
529
|
+
headers,
|
|
530
|
+
priority: 'normal',
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
const adapterName = 'getCategoryGroups';
|
|
535
|
+
const getCategoryGroups_ConfigPropertyMetadata = [];
|
|
536
|
+
const getCategoryGroups_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCategoryGroups_ConfigPropertyMetadata);
|
|
537
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(getCategoryGroups_ConfigPropertyMetadata);
|
|
538
|
+
function keyBuilder(luvio, config) {
|
|
539
|
+
createResourceParams(config);
|
|
540
|
+
return keyBuilder$1();
|
|
541
|
+
}
|
|
542
|
+
function typeCheckConfig(untrustedConfig) {
|
|
543
|
+
const config = {};
|
|
544
|
+
return config;
|
|
545
|
+
}
|
|
546
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
547
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
551
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
552
|
+
}
|
|
553
|
+
const config = typeCheckConfig();
|
|
554
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
555
|
+
return null;
|
|
556
|
+
}
|
|
557
|
+
return config;
|
|
558
|
+
}
|
|
559
|
+
function adapterFragment(luvio, config) {
|
|
560
|
+
createResourceParams(config);
|
|
561
|
+
return select();
|
|
562
|
+
}
|
|
563
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
564
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
565
|
+
config,
|
|
566
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
567
|
+
});
|
|
568
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
569
|
+
}
|
|
570
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
571
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
572
|
+
config,
|
|
573
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
574
|
+
});
|
|
575
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
576
|
+
}
|
|
577
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
578
|
+
const resourceParams = createResourceParams(config);
|
|
579
|
+
const request = createResourceRequest();
|
|
580
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
581
|
+
.then((response) => {
|
|
582
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
583
|
+
const cache = new StoreKeyMap();
|
|
584
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
585
|
+
return cache;
|
|
586
|
+
});
|
|
587
|
+
}, (response) => {
|
|
588
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
592
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
593
|
+
}
|
|
594
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
595
|
+
const { luvio, config } = context;
|
|
596
|
+
const selector = {
|
|
597
|
+
recordId: keyBuilder(luvio, config),
|
|
598
|
+
node: adapterFragment(luvio, config),
|
|
599
|
+
variables: {},
|
|
600
|
+
};
|
|
601
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
602
|
+
config,
|
|
603
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
604
|
+
});
|
|
605
|
+
return cacheSnapshot;
|
|
606
|
+
}
|
|
607
|
+
const getCategoryGroupsAdapterFactory = (luvio) => function DataCategory__getCategoryGroups(untrustedConfig, requestContext) {
|
|
608
|
+
const config = validateAdapterConfig(untrustedConfig, getCategoryGroups_ConfigPropertyNames);
|
|
609
|
+
// Invalid or incomplete config
|
|
610
|
+
if (config === null) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
614
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
export { getCategoryGroupsAdapterFactory };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Adapter as $64$luvio_engine_Adapter, Snapshot as $64$luvio_engine_Snapshot, UnfulfilledSnapshot as $64$luvio_engine_UnfulfilledSnapshot, AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata } from '@luvio/engine';
|
|
2
|
+
export declare const ObjectPrototypeHasOwnProperty: (v: PropertyKey) => boolean;
|
|
3
|
+
declare const ObjectKeys: {
|
|
4
|
+
(o: object): string[];
|
|
5
|
+
(o: {}): string[];
|
|
6
|
+
}, ObjectCreate: {
|
|
7
|
+
(o: object | null): any;
|
|
8
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
9
|
+
};
|
|
10
|
+
export { ObjectCreate, ObjectKeys };
|
|
11
|
+
export declare const ArrayIsArray: (arg: any) => arg is any[];
|
|
12
|
+
export declare const ArrayPrototypePush: (...items: any[]) => number;
|
|
13
|
+
export interface AdapterValidationConfig {
|
|
14
|
+
displayName: string;
|
|
15
|
+
parameters: {
|
|
16
|
+
required: string[];
|
|
17
|
+
optional: string[];
|
|
18
|
+
unsupported?: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Validates an adapter config is well-formed.
|
|
23
|
+
* @param config The config to validate.
|
|
24
|
+
* @param adapter The adapter validation configuration.
|
|
25
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
26
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateConfig<T>(config: Untrusted<T>, adapter: AdapterValidationConfig, oneOf?: string[]): void;
|
|
29
|
+
export declare function untrustedIsObject<Base>(untrusted: unknown): untrusted is Untrusted<Base>;
|
|
30
|
+
export type UncoercedConfiguration<Base, Options extends {
|
|
31
|
+
[key in keyof Base]?: any;
|
|
32
|
+
}> = {
|
|
33
|
+
[Key in keyof Base]?: Base[Key] | Options[Key];
|
|
34
|
+
};
|
|
35
|
+
export type Untrusted<Base> = Partial<Base>;
|
|
36
|
+
export declare function areRequiredParametersPresent<T>(config: any, configPropertyNames: AdapterValidationConfig): config is T;
|
|
37
|
+
export declare function refreshable<C, D, R>(adapter: $64$luvio_engine_Adapter<C, D>, resolve: (config: unknown) => Promise<$64$luvio_engine_Snapshot<R>>): $64$luvio_engine_Adapter<C, D>;
|
|
38
|
+
export declare const SNAPSHOT_STATE_FULFILLED = "Fulfilled";
|
|
39
|
+
export declare const SNAPSHOT_STATE_UNFULFILLED = "Unfulfilled";
|
|
40
|
+
export declare const snapshotRefreshOptions: {
|
|
41
|
+
overrides: {
|
|
42
|
+
headers: {
|
|
43
|
+
'Cache-Control': string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* A deterministic JSON stringify implementation. Heavily adapted from https://github.com/epoberezkin/fast-json-stable-stringify.
|
|
49
|
+
* This is needed because insertion order for JSON.stringify(object) affects output:
|
|
50
|
+
* JSON.stringify({a: 1, b: 2})
|
|
51
|
+
* "{"a":1,"b":2}"
|
|
52
|
+
* JSON.stringify({b: 2, a: 1})
|
|
53
|
+
* "{"b":2,"a":1}"
|
|
54
|
+
* @param data Data to be JSON-stringified.
|
|
55
|
+
* @returns JSON.stringified value with consistent ordering of keys.
|
|
56
|
+
*/
|
|
57
|
+
export declare function stableJSONStringify(node: any): string | undefined;
|
|
58
|
+
export declare function getFetchResponseStatusText(status: number): string;
|
|
59
|
+
export declare function isUnfulfilledSnapshot<T, U>(snapshot: $64$luvio_engine_Snapshot<T, U>): snapshot is $64$luvio_engine_UnfulfilledSnapshot<T, U>;
|
|
60
|
+
export declare function generateParamConfigMetadata(name: string, required: boolean, resourceType: $64$luvio_engine_AdapterConfigMetadata['resourceType'], typeCheckShape: $64$luvio_engine_AdapterConfigMetadata['typeCheckShape'], isArrayShape?: boolean, coerceFn?: (v: unknown) => unknown): $64$luvio_engine_AdapterConfigMetadata;
|
|
61
|
+
export declare function buildAdapterValidationConfig(displayName: string, paramsMeta: $64$luvio_engine_AdapterConfigMetadata[]): AdapterValidationConfig;
|
|
62
|
+
export declare const keyPrefix = "DataCategory";
|