@salesforce/lds-adapters-service-data-category 1.224.0
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 +453 -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 +37 -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 +67 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +485 -0
- package/src/raml/api.raml +78 -0
- package/src/raml/luvio.raml +14 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/* *******************************************************************************************
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$1, StoreKeyMap, createResourceParams as createResourceParams$1 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
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 = 'DataCategory';
|
|
73
|
+
|
|
74
|
+
const { isArray: ArrayIsArray } = Array;
|
|
75
|
+
const { stringify: JSONStringify } = JSON;
|
|
76
|
+
function equalsArray(a, b, equalsItem) {
|
|
77
|
+
const aLength = a.length;
|
|
78
|
+
const bLength = b.length;
|
|
79
|
+
if (aLength !== bLength) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
for (let i = 0; i < aLength; i++) {
|
|
83
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
function createLink(ref) {
|
|
90
|
+
return {
|
|
91
|
+
__ref: serializeStructuredKey(ref),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const VERSION$2 = "ccff9545652601c1888a16f5eb7ae564";
|
|
96
|
+
function validate$2(obj, path = 'DataCategoryRepresentation') {
|
|
97
|
+
const v_error = (() => {
|
|
98
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
99
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
100
|
+
}
|
|
101
|
+
const obj_categoryName = obj.categoryName;
|
|
102
|
+
const path_categoryName = path + '.categoryName';
|
|
103
|
+
if (typeof obj_categoryName !== 'string') {
|
|
104
|
+
return new TypeError('Expected "string" but received "' + typeof obj_categoryName + '" (at "' + path_categoryName + '")');
|
|
105
|
+
}
|
|
106
|
+
const obj_childCategories = obj.childCategories;
|
|
107
|
+
const path_childCategories = path + '.childCategories';
|
|
108
|
+
if (!ArrayIsArray(obj_childCategories)) {
|
|
109
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childCategories + '" (at "' + path_childCategories + '")');
|
|
110
|
+
}
|
|
111
|
+
for (let i = 0; i < obj_childCategories.length; i++) {
|
|
112
|
+
const obj_childCategories_item = obj_childCategories[i];
|
|
113
|
+
const path_childCategories_item = path_childCategories + '[' + i + ']';
|
|
114
|
+
if (obj_childCategories_item === undefined) {
|
|
115
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_childCategories_item + '" (at "' + path_childCategories_item + '")');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const obj_label = obj.label;
|
|
119
|
+
const path_label = path + '.label';
|
|
120
|
+
if (typeof obj_label !== 'string') {
|
|
121
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
124
|
+
return v_error === undefined ? null : v_error;
|
|
125
|
+
}
|
|
126
|
+
const select$3 = function DataCategoryRepresentationSelect() {
|
|
127
|
+
return {
|
|
128
|
+
kind: 'Fragment',
|
|
129
|
+
version: VERSION$2,
|
|
130
|
+
private: [],
|
|
131
|
+
selections: [
|
|
132
|
+
{
|
|
133
|
+
name: 'categoryName',
|
|
134
|
+
kind: 'Scalar'
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'childCategories',
|
|
138
|
+
kind: 'Object',
|
|
139
|
+
// any
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'label',
|
|
143
|
+
kind: 'Scalar'
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
function equals$2(existing, incoming) {
|
|
149
|
+
const existing_categoryName = existing.categoryName;
|
|
150
|
+
const incoming_categoryName = incoming.categoryName;
|
|
151
|
+
if (!(existing_categoryName === incoming_categoryName)) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const existing_label = existing.label;
|
|
155
|
+
const incoming_label = incoming.label;
|
|
156
|
+
if (!(existing_label === incoming_label)) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const existing_childCategories = existing.childCategories;
|
|
160
|
+
const incoming_childCategories = incoming.childCategories;
|
|
161
|
+
const equals_childCategories_items = equalsArray(existing_childCategories, incoming_childCategories, (existing_childCategories_item, incoming_childCategories_item) => {
|
|
162
|
+
if (JSONStringify(incoming_childCategories_item) !== JSONStringify(existing_childCategories_item)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
if (equals_childCategories_items === false) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const VERSION$1 = "bb3ad8223c9402993b9efe107748e116";
|
|
173
|
+
function validate$1(obj, path = 'DataCategoryGroupRepresentation') {
|
|
174
|
+
const v_error = (() => {
|
|
175
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
176
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
177
|
+
}
|
|
178
|
+
const obj_categoryGroupName = obj.categoryGroupName;
|
|
179
|
+
const path_categoryGroupName = path + '.categoryGroupName';
|
|
180
|
+
if (typeof obj_categoryGroupName !== 'string') {
|
|
181
|
+
return new TypeError('Expected "string" but received "' + typeof obj_categoryGroupName + '" (at "' + path_categoryGroupName + '")');
|
|
182
|
+
}
|
|
183
|
+
const obj_description = obj.description;
|
|
184
|
+
const path_description = path + '.description';
|
|
185
|
+
if (typeof obj_description !== 'string') {
|
|
186
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
187
|
+
}
|
|
188
|
+
const obj_label = obj.label;
|
|
189
|
+
const path_label = path + '.label';
|
|
190
|
+
if (typeof obj_label !== 'string') {
|
|
191
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
192
|
+
}
|
|
193
|
+
const obj_rootCategory = obj.rootCategory;
|
|
194
|
+
const path_rootCategory = path + '.rootCategory';
|
|
195
|
+
const referencepath_rootCategoryValidationError = validate$2(obj_rootCategory, path_rootCategory);
|
|
196
|
+
if (referencepath_rootCategoryValidationError !== null) {
|
|
197
|
+
let message = 'Object doesn\'t match DataCategoryRepresentation (at "' + path_rootCategory + '")\n';
|
|
198
|
+
message += referencepath_rootCategoryValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
199
|
+
return new TypeError(message);
|
|
200
|
+
}
|
|
201
|
+
})();
|
|
202
|
+
return v_error === undefined ? null : v_error;
|
|
203
|
+
}
|
|
204
|
+
const select$2 = function DataCategoryGroupRepresentationSelect() {
|
|
205
|
+
const { selections: DataCategoryRepresentation__selections, opaque: DataCategoryRepresentation__opaque, } = select$3();
|
|
206
|
+
return {
|
|
207
|
+
kind: 'Fragment',
|
|
208
|
+
version: VERSION$1,
|
|
209
|
+
private: [],
|
|
210
|
+
selections: [
|
|
211
|
+
{
|
|
212
|
+
name: 'categoryGroupName',
|
|
213
|
+
kind: 'Scalar'
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'description',
|
|
217
|
+
kind: 'Scalar'
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: 'label',
|
|
221
|
+
kind: 'Scalar'
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'rootCategory',
|
|
225
|
+
kind: 'Object',
|
|
226
|
+
selections: DataCategoryRepresentation__selections
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
function equals$1(existing, incoming) {
|
|
232
|
+
const existing_categoryGroupName = existing.categoryGroupName;
|
|
233
|
+
const incoming_categoryGroupName = incoming.categoryGroupName;
|
|
234
|
+
if (!(existing_categoryGroupName === incoming_categoryGroupName)) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
const existing_description = existing.description;
|
|
238
|
+
const incoming_description = incoming.description;
|
|
239
|
+
if (!(existing_description === incoming_description)) {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
const existing_label = existing.label;
|
|
243
|
+
const incoming_label = incoming.label;
|
|
244
|
+
if (!(existing_label === incoming_label)) {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
const existing_rootCategory = existing.rootCategory;
|
|
248
|
+
const incoming_rootCategory = incoming.rootCategory;
|
|
249
|
+
if (!(equals$2(existing_rootCategory, incoming_rootCategory))) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const VERSION = "db13362abaa16e37af68b2073902b190";
|
|
256
|
+
function validate(obj, path = 'DataCategoryGroupCollectionRepresentation') {
|
|
257
|
+
const v_error = (() => {
|
|
258
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
259
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
260
|
+
}
|
|
261
|
+
const obj_dataCategoryGroups = obj.dataCategoryGroups;
|
|
262
|
+
const path_dataCategoryGroups = path + '.dataCategoryGroups';
|
|
263
|
+
if (!ArrayIsArray(obj_dataCategoryGroups)) {
|
|
264
|
+
return new TypeError('Expected "array" but received "' + typeof obj_dataCategoryGroups + '" (at "' + path_dataCategoryGroups + '")');
|
|
265
|
+
}
|
|
266
|
+
for (let i = 0; i < obj_dataCategoryGroups.length; i++) {
|
|
267
|
+
const obj_dataCategoryGroups_item = obj_dataCategoryGroups[i];
|
|
268
|
+
const path_dataCategoryGroups_item = path_dataCategoryGroups + '[' + i + ']';
|
|
269
|
+
const referencepath_dataCategoryGroups_itemValidationError = validate$1(obj_dataCategoryGroups_item, path_dataCategoryGroups_item);
|
|
270
|
+
if (referencepath_dataCategoryGroups_itemValidationError !== null) {
|
|
271
|
+
let message = 'Object doesn\'t match DataCategoryGroupRepresentation (at "' + path_dataCategoryGroups_item + '")\n';
|
|
272
|
+
message += referencepath_dataCategoryGroups_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
273
|
+
return new TypeError(message);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
})();
|
|
277
|
+
return v_error === undefined ? null : v_error;
|
|
278
|
+
}
|
|
279
|
+
const RepresentationType = 'DataCategoryGroupCollectionRepresentation';
|
|
280
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
281
|
+
return input;
|
|
282
|
+
}
|
|
283
|
+
const select$1 = function DataCategoryGroupCollectionRepresentationSelect() {
|
|
284
|
+
const { selections: DataCategoryGroupRepresentation__selections, opaque: DataCategoryGroupRepresentation__opaque, } = select$2();
|
|
285
|
+
return {
|
|
286
|
+
kind: 'Fragment',
|
|
287
|
+
version: VERSION,
|
|
288
|
+
private: [],
|
|
289
|
+
selections: [
|
|
290
|
+
{
|
|
291
|
+
name: 'dataCategoryGroups',
|
|
292
|
+
kind: 'Object',
|
|
293
|
+
plural: true,
|
|
294
|
+
selections: DataCategoryGroupRepresentation__selections
|
|
295
|
+
}
|
|
296
|
+
]
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
function equals(existing, incoming) {
|
|
300
|
+
const existing_dataCategoryGroups = existing.dataCategoryGroups;
|
|
301
|
+
const incoming_dataCategoryGroups = incoming.dataCategoryGroups;
|
|
302
|
+
const equals_dataCategoryGroups_items = equalsArray(existing_dataCategoryGroups, incoming_dataCategoryGroups, (existing_dataCategoryGroups_item, incoming_dataCategoryGroups_item) => {
|
|
303
|
+
if (!(equals$1(existing_dataCategoryGroups_item, incoming_dataCategoryGroups_item))) {
|
|
304
|
+
return false;
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
if (equals_dataCategoryGroups_items === false) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
const ingest = function DataCategoryGroupCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
313
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
314
|
+
const validateError = validate(input);
|
|
315
|
+
if (validateError !== null) {
|
|
316
|
+
throw validateError;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
const key = path.fullPath;
|
|
320
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 900000;
|
|
321
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "DataCategory", VERSION, RepresentationType, equals);
|
|
322
|
+
return createLink(key);
|
|
323
|
+
};
|
|
324
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
325
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
326
|
+
const rootKey = fullPathFactory();
|
|
327
|
+
rootKeySet.set(rootKey, {
|
|
328
|
+
namespace: keyPrefix,
|
|
329
|
+
representationName: RepresentationType,
|
|
330
|
+
mergeable: false
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function select(luvio, params) {
|
|
335
|
+
return select$1();
|
|
336
|
+
}
|
|
337
|
+
function keyBuilder$1(luvio, params) {
|
|
338
|
+
return keyPrefix + '::DataCategoryGroupCollectionRepresentation:(' + ')';
|
|
339
|
+
}
|
|
340
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
341
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1());
|
|
342
|
+
}
|
|
343
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
344
|
+
const { body } = response;
|
|
345
|
+
const key = keyBuilder$1();
|
|
346
|
+
luvio.storeIngest(key, ingest, body);
|
|
347
|
+
const snapshot = luvio.storeLookup({
|
|
348
|
+
recordId: key,
|
|
349
|
+
node: select(),
|
|
350
|
+
variables: {},
|
|
351
|
+
}, snapshotRefresh);
|
|
352
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
353
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
354
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
deepFreeze(snapshot.data);
|
|
358
|
+
return snapshot;
|
|
359
|
+
}
|
|
360
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
361
|
+
const key = keyBuilder$1();
|
|
362
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
363
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
364
|
+
return errorSnapshot;
|
|
365
|
+
}
|
|
366
|
+
function createResourceRequest(config) {
|
|
367
|
+
const headers = {};
|
|
368
|
+
return {
|
|
369
|
+
baseUri: '/services/data/v59.0',
|
|
370
|
+
basePath: '/connect/data-category/category-group',
|
|
371
|
+
method: 'get',
|
|
372
|
+
body: null,
|
|
373
|
+
urlParams: {},
|
|
374
|
+
queryParams: {},
|
|
375
|
+
headers,
|
|
376
|
+
priority: 'normal',
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
const adapterName = 'getCategoryGroups';
|
|
381
|
+
const getCategoryGroups_ConfigPropertyMetadata = [];
|
|
382
|
+
const getCategoryGroups_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCategoryGroups_ConfigPropertyMetadata);
|
|
383
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(getCategoryGroups_ConfigPropertyMetadata);
|
|
384
|
+
function keyBuilder(luvio, config) {
|
|
385
|
+
createResourceParams(config);
|
|
386
|
+
return keyBuilder$1();
|
|
387
|
+
}
|
|
388
|
+
function typeCheckConfig(untrustedConfig) {
|
|
389
|
+
const config = {};
|
|
390
|
+
return config;
|
|
391
|
+
}
|
|
392
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
393
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
397
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
398
|
+
}
|
|
399
|
+
const config = typeCheckConfig();
|
|
400
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
return config;
|
|
404
|
+
}
|
|
405
|
+
function adapterFragment(luvio, config) {
|
|
406
|
+
createResourceParams(config);
|
|
407
|
+
return select();
|
|
408
|
+
}
|
|
409
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
410
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
411
|
+
config,
|
|
412
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
413
|
+
});
|
|
414
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
415
|
+
}
|
|
416
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
417
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
418
|
+
config,
|
|
419
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
420
|
+
});
|
|
421
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
422
|
+
}
|
|
423
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
424
|
+
const resourceParams = createResourceParams(config);
|
|
425
|
+
const request = createResourceRequest();
|
|
426
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
427
|
+
.then((response) => {
|
|
428
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
429
|
+
const cache = new StoreKeyMap();
|
|
430
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
431
|
+
return cache;
|
|
432
|
+
});
|
|
433
|
+
}, (response) => {
|
|
434
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
438
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
439
|
+
}
|
|
440
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
441
|
+
const { luvio, config } = context;
|
|
442
|
+
const selector = {
|
|
443
|
+
recordId: keyBuilder(luvio, config),
|
|
444
|
+
node: adapterFragment(luvio, config),
|
|
445
|
+
variables: {},
|
|
446
|
+
};
|
|
447
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
448
|
+
config,
|
|
449
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
450
|
+
});
|
|
451
|
+
return cacheSnapshot;
|
|
452
|
+
}
|
|
453
|
+
const getCategoryGroupsAdapterFactory = (luvio) => function DataCategory__getCategoryGroups(untrustedConfig, requestContext) {
|
|
454
|
+
const config = validateAdapterConfig(untrustedConfig, getCategoryGroups_ConfigPropertyNames);
|
|
455
|
+
// Invalid or incomplete config
|
|
456
|
+
if (config === null) {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
460
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
let getCategoryGroups;
|
|
464
|
+
// Imperative GET Adapters
|
|
465
|
+
let getCategoryGroups_imperative;
|
|
466
|
+
// Adapter Metadata
|
|
467
|
+
const getCategoryGroupsMetadata = { apiFamily: 'DataCategory', name: 'getCategoryGroups' };
|
|
468
|
+
function bindExportsTo(luvio) {
|
|
469
|
+
// LDS Adapters
|
|
470
|
+
const getCategoryGroups_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCategoryGroups', getCategoryGroupsAdapterFactory), getCategoryGroupsMetadata);
|
|
471
|
+
return {
|
|
472
|
+
getCategoryGroups: createWireAdapterConstructor(luvio, getCategoryGroups_ldsAdapter, getCategoryGroupsMetadata),
|
|
473
|
+
// Imperative GET Adapters
|
|
474
|
+
getCategoryGroups_imperative: createImperativeAdapter(luvio, getCategoryGroups_ldsAdapter, getCategoryGroupsMetadata)
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
withDefaultLuvio((luvio) => {
|
|
478
|
+
({
|
|
479
|
+
getCategoryGroups,
|
|
480
|
+
getCategoryGroups_imperative
|
|
481
|
+
} = bindExportsTo(luvio));
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
export { getCategoryGroups, getCategoryGroups_imperative };
|
|
485
|
+
// version: 1.224.0-b4cf8fe20
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '59.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v59.0
|
|
10
|
+
securitySchemes:
|
|
11
|
+
OAuth2:
|
|
12
|
+
type: OAuth 2.0
|
|
13
|
+
settings:
|
|
14
|
+
authorizationUri: https://example.com/oauth/authorize
|
|
15
|
+
accessTokenUri: ''
|
|
16
|
+
authorizationGrants:
|
|
17
|
+
- implicit
|
|
18
|
+
annotationTypes:
|
|
19
|
+
oas-readOnly:
|
|
20
|
+
type: boolean
|
|
21
|
+
allowedTargets: TypeDeclaration
|
|
22
|
+
oas-collectionFormat:
|
|
23
|
+
type: string
|
|
24
|
+
oas-body-name:
|
|
25
|
+
type: string
|
|
26
|
+
allowedTargets: TypeDeclaration
|
|
27
|
+
types:
|
|
28
|
+
DataCategoryGroupCollectionRepresentation:
|
|
29
|
+
description: Data Category Group Collection Representation
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
dataCategoryGroups:
|
|
33
|
+
description: Collection of Data Category Groups
|
|
34
|
+
type: array
|
|
35
|
+
items:
|
|
36
|
+
type: DataCategoryGroupRepresentation
|
|
37
|
+
DataCategoryGroupRepresentation:
|
|
38
|
+
description: Data Category Group Representation
|
|
39
|
+
type: object
|
|
40
|
+
properties:
|
|
41
|
+
categoryGroupName:
|
|
42
|
+
description: Developer Name of the Data Category Group
|
|
43
|
+
type: string
|
|
44
|
+
description:
|
|
45
|
+
description: Description of the Data Category Group
|
|
46
|
+
type: string
|
|
47
|
+
label:
|
|
48
|
+
description: Label of the Data Category Group
|
|
49
|
+
type: string
|
|
50
|
+
rootCategory:
|
|
51
|
+
description: Root Category of the Data Category Group
|
|
52
|
+
type: DataCategoryRepresentation
|
|
53
|
+
DataCategoryRepresentation:
|
|
54
|
+
description: Data Category Representation
|
|
55
|
+
type: object
|
|
56
|
+
properties:
|
|
57
|
+
categoryName:
|
|
58
|
+
description: Developer Name of the Data Category
|
|
59
|
+
type: string
|
|
60
|
+
childCategories:
|
|
61
|
+
description: List of child data categories
|
|
62
|
+
type: array
|
|
63
|
+
items:
|
|
64
|
+
type: any # This is a workaround because recursive (tree) representations aren't supported in Luvio, even though they're supported in Connect API
|
|
65
|
+
label:
|
|
66
|
+
description: Label of the Data Category
|
|
67
|
+
type: string
|
|
68
|
+
/connect:
|
|
69
|
+
/data-category/category-group:
|
|
70
|
+
get:
|
|
71
|
+
displayName: getCategoryGroups
|
|
72
|
+
description: Returns all active data category groups and their child categories
|
|
73
|
+
responses:
|
|
74
|
+
'200':
|
|
75
|
+
description: Success
|
|
76
|
+
body:
|
|
77
|
+
application/json:
|
|
78
|
+
type: DataCategoryGroupCollectionRepresentation
|