@salesforce/lds-adapters-service-servicecatalogcategory 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-servicecatalogcategory.js +489 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/getCategories.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/getConnectServiceAutomationServiceCatalogCategories.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/types/SvcCatalogCategoryDetailOutputRepresentation.d.ts +46 -0
- package/dist/es/es2018/types/src/generated/types/SvcCatalogCategoryHeaderOutputRepresentation.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/types/SvcCatalogCategoryOutputRepresentation.d.ts +42 -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 +520 -0
- package/src/raml/api.raml +77 -0
- package/src/raml/luvio.raml +18 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
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 = 'ServiceCatalogCategory';
|
|
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 = "0c90894d50304b5803a39c61891825ad";
|
|
96
|
+
function validate$2(obj, path = 'SvcCatalogCategoryHeaderOutputRepresentation') {
|
|
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_useDataCategory = obj.useDataCategory;
|
|
102
|
+
const path_useDataCategory = path + '.useDataCategory';
|
|
103
|
+
if (typeof obj_useDataCategory !== 'boolean') {
|
|
104
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_useDataCategory + '" (at "' + path_useDataCategory + '")');
|
|
105
|
+
}
|
|
106
|
+
})();
|
|
107
|
+
return v_error === undefined ? null : v_error;
|
|
108
|
+
}
|
|
109
|
+
const select$3 = function SvcCatalogCategoryHeaderOutputRepresentationSelect() {
|
|
110
|
+
return {
|
|
111
|
+
kind: 'Fragment',
|
|
112
|
+
version: VERSION$2,
|
|
113
|
+
private: [],
|
|
114
|
+
selections: [
|
|
115
|
+
{
|
|
116
|
+
name: 'useDataCategory',
|
|
117
|
+
kind: 'Scalar'
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
function equals$2(existing, incoming) {
|
|
123
|
+
const existing_useDataCategory = existing.useDataCategory;
|
|
124
|
+
const incoming_useDataCategory = incoming.useDataCategory;
|
|
125
|
+
if (!(existing_useDataCategory === incoming_useDataCategory)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const VERSION$1 = "b9310dc0f51e25349574116e9d25e3eb";
|
|
132
|
+
function validate$1(obj, path = 'SvcCatalogCategoryDetailOutputRepresentation') {
|
|
133
|
+
const v_error = (() => {
|
|
134
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
135
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
136
|
+
}
|
|
137
|
+
const obj_childCategories = obj.childCategories;
|
|
138
|
+
const path_childCategories = path + '.childCategories';
|
|
139
|
+
if (!ArrayIsArray(obj_childCategories)) {
|
|
140
|
+
return new TypeError('Expected "array" but received "' + typeof obj_childCategories + '" (at "' + path_childCategories + '")');
|
|
141
|
+
}
|
|
142
|
+
for (let i = 0; i < obj_childCategories.length; i++) {
|
|
143
|
+
const obj_childCategories_item = obj_childCategories[i];
|
|
144
|
+
const path_childCategories_item = path_childCategories + '[' + i + ']';
|
|
145
|
+
if (obj_childCategories_item === undefined) {
|
|
146
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_childCategories_item + '" (at "' + path_childCategories_item + '")');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const obj_label = obj.label;
|
|
150
|
+
const path_label = path + '.label';
|
|
151
|
+
if (typeof obj_label !== 'string') {
|
|
152
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
153
|
+
}
|
|
154
|
+
const obj_name = obj.name;
|
|
155
|
+
const path_name = path + '.name';
|
|
156
|
+
if (typeof obj_name !== 'string') {
|
|
157
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
158
|
+
}
|
|
159
|
+
const obj_sortOrder = obj.sortOrder;
|
|
160
|
+
const path_sortOrder = path + '.sortOrder';
|
|
161
|
+
if (typeof obj_sortOrder !== 'number' || (typeof obj_sortOrder === 'number' && Math.floor(obj_sortOrder) !== obj_sortOrder)) {
|
|
162
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_sortOrder + '" (at "' + path_sortOrder + '")');
|
|
163
|
+
}
|
|
164
|
+
})();
|
|
165
|
+
return v_error === undefined ? null : v_error;
|
|
166
|
+
}
|
|
167
|
+
const RepresentationType$1 = 'SvcCatalogCategoryDetailOutputRepresentation';
|
|
168
|
+
function keyBuilder$2(luvio, config) {
|
|
169
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.name;
|
|
170
|
+
}
|
|
171
|
+
function keyBuilderFromType(luvio, object) {
|
|
172
|
+
const keyParams = {
|
|
173
|
+
name: object.name
|
|
174
|
+
};
|
|
175
|
+
return keyBuilder$2(luvio, keyParams);
|
|
176
|
+
}
|
|
177
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
178
|
+
return input;
|
|
179
|
+
}
|
|
180
|
+
const select$2 = function SvcCatalogCategoryDetailOutputRepresentationSelect() {
|
|
181
|
+
return {
|
|
182
|
+
kind: 'Fragment',
|
|
183
|
+
version: VERSION$1,
|
|
184
|
+
private: [],
|
|
185
|
+
selections: [
|
|
186
|
+
{
|
|
187
|
+
name: 'childCategories',
|
|
188
|
+
kind: 'Object',
|
|
189
|
+
// any
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
name: 'label',
|
|
193
|
+
kind: 'Scalar'
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: 'name',
|
|
197
|
+
kind: 'Scalar'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'sortOrder',
|
|
201
|
+
kind: 'Scalar'
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
function equals$1(existing, incoming) {
|
|
207
|
+
const existing_sortOrder = existing.sortOrder;
|
|
208
|
+
const incoming_sortOrder = incoming.sortOrder;
|
|
209
|
+
if (!(existing_sortOrder === incoming_sortOrder)) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
const existing_label = existing.label;
|
|
213
|
+
const incoming_label = incoming.label;
|
|
214
|
+
if (!(existing_label === incoming_label)) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
const existing_name = existing.name;
|
|
218
|
+
const incoming_name = incoming.name;
|
|
219
|
+
if (!(existing_name === incoming_name)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
const existing_childCategories = existing.childCategories;
|
|
223
|
+
const incoming_childCategories = incoming.childCategories;
|
|
224
|
+
const equals_childCategories_items = equalsArray(existing_childCategories, incoming_childCategories, (existing_childCategories_item, incoming_childCategories_item) => {
|
|
225
|
+
if (JSONStringify(incoming_childCategories_item) !== JSONStringify(existing_childCategories_item)) {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
if (equals_childCategories_items === false) {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
const ingest$1 = function SvcCatalogCategoryDetailOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
235
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
236
|
+
const validateError = validate$1(input);
|
|
237
|
+
if (validateError !== null) {
|
|
238
|
+
throw validateError;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
const key = keyBuilderFromType(luvio, input);
|
|
242
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 900000;
|
|
243
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "ServiceCatalogCategory", VERSION$1, RepresentationType$1, equals$1);
|
|
244
|
+
return createLink(key);
|
|
245
|
+
};
|
|
246
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
247
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
248
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
249
|
+
rootKeySet.set(rootKey, {
|
|
250
|
+
namespace: keyPrefix,
|
|
251
|
+
representationName: RepresentationType$1,
|
|
252
|
+
mergeable: false
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const VERSION = "a4ab1912141e7143ca0bb2de3af49bc5";
|
|
257
|
+
function validate(obj, path = 'SvcCatalogCategoryOutputRepresentation') {
|
|
258
|
+
const v_error = (() => {
|
|
259
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
260
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
261
|
+
}
|
|
262
|
+
const obj_categories = obj.categories;
|
|
263
|
+
const path_categories = path + '.categories';
|
|
264
|
+
if (!ArrayIsArray(obj_categories)) {
|
|
265
|
+
return new TypeError('Expected "array" but received "' + typeof obj_categories + '" (at "' + path_categories + '")');
|
|
266
|
+
}
|
|
267
|
+
for (let i = 0; i < obj_categories.length; i++) {
|
|
268
|
+
const obj_categories_item = obj_categories[i];
|
|
269
|
+
const path_categories_item = path_categories + '[' + i + ']';
|
|
270
|
+
if (typeof obj_categories_item !== 'object' || Array.isArray(obj_categories_item)) {
|
|
271
|
+
return new TypeError('Expected "object" but received "' + typeof obj_categories_item + '" (at "' + path_categories_item + '")');
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const obj_header = obj.header;
|
|
275
|
+
const path_header = path + '.header';
|
|
276
|
+
const referencepath_headerValidationError = validate$2(obj_header, path_header);
|
|
277
|
+
if (referencepath_headerValidationError !== null) {
|
|
278
|
+
let message = 'Object doesn\'t match SvcCatalogCategoryHeaderOutputRepresentation (at "' + path_header + '")\n';
|
|
279
|
+
message += referencepath_headerValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
280
|
+
return new TypeError(message);
|
|
281
|
+
}
|
|
282
|
+
})();
|
|
283
|
+
return v_error === undefined ? null : v_error;
|
|
284
|
+
}
|
|
285
|
+
const RepresentationType = 'SvcCatalogCategoryOutputRepresentation';
|
|
286
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
287
|
+
const input_categories = input.categories;
|
|
288
|
+
const input_categories_id = path.fullPath + '__categories';
|
|
289
|
+
for (let i = 0; i < input_categories.length; i++) {
|
|
290
|
+
const input_categories_item = input_categories[i];
|
|
291
|
+
let input_categories_item_id = input_categories_id + '__' + i;
|
|
292
|
+
input_categories[i] = ingest$1(input_categories_item, {
|
|
293
|
+
fullPath: input_categories_item_id,
|
|
294
|
+
propertyName: i,
|
|
295
|
+
parent: {
|
|
296
|
+
data: input,
|
|
297
|
+
key: path.fullPath,
|
|
298
|
+
existing: existing,
|
|
299
|
+
},
|
|
300
|
+
ttl: path.ttl
|
|
301
|
+
}, luvio, store, timestamp);
|
|
302
|
+
}
|
|
303
|
+
return input;
|
|
304
|
+
}
|
|
305
|
+
const select$1 = function SvcCatalogCategoryOutputRepresentationSelect() {
|
|
306
|
+
const { selections: SvcCatalogCategoryHeaderOutputRepresentation__selections, opaque: SvcCatalogCategoryHeaderOutputRepresentation__opaque, } = select$3();
|
|
307
|
+
return {
|
|
308
|
+
kind: 'Fragment',
|
|
309
|
+
version: VERSION,
|
|
310
|
+
private: [],
|
|
311
|
+
selections: [
|
|
312
|
+
{
|
|
313
|
+
name: 'categories',
|
|
314
|
+
kind: 'Link',
|
|
315
|
+
plural: true,
|
|
316
|
+
fragment: select$2()
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'header',
|
|
320
|
+
kind: 'Object',
|
|
321
|
+
selections: SvcCatalogCategoryHeaderOutputRepresentation__selections
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
function equals(existing, incoming) {
|
|
327
|
+
const existing_categories = existing.categories;
|
|
328
|
+
const incoming_categories = incoming.categories;
|
|
329
|
+
const equals_categories_items = equalsArray(existing_categories, incoming_categories, (existing_categories_item, incoming_categories_item) => {
|
|
330
|
+
if (!(existing_categories_item.__ref === incoming_categories_item.__ref)) {
|
|
331
|
+
return false;
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
if (equals_categories_items === false) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
const existing_header = existing.header;
|
|
338
|
+
const incoming_header = incoming.header;
|
|
339
|
+
if (!(equals$2(existing_header, incoming_header))) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
344
|
+
const ingest = function SvcCatalogCategoryOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
345
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
346
|
+
const validateError = validate(input);
|
|
347
|
+
if (validateError !== null) {
|
|
348
|
+
throw validateError;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const key = path.fullPath;
|
|
352
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 900000;
|
|
353
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "ServiceCatalogCategory", VERSION, RepresentationType, equals);
|
|
354
|
+
return createLink(key);
|
|
355
|
+
};
|
|
356
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
357
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
358
|
+
const rootKey = fullPathFactory();
|
|
359
|
+
rootKeySet.set(rootKey, {
|
|
360
|
+
namespace: keyPrefix,
|
|
361
|
+
representationName: RepresentationType,
|
|
362
|
+
mergeable: false
|
|
363
|
+
});
|
|
364
|
+
const input_categories_length = input.categories.length;
|
|
365
|
+
for (let i = 0; i < input_categories_length; i++) {
|
|
366
|
+
getTypeCacheKeys$1(rootKeySet, luvio, input.categories[i]);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function select(luvio, params) {
|
|
371
|
+
return select$1();
|
|
372
|
+
}
|
|
373
|
+
function keyBuilder$1(luvio, params) {
|
|
374
|
+
return keyPrefix + '::SvcCatalogCategoryOutputRepresentation:(' + ')';
|
|
375
|
+
}
|
|
376
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
377
|
+
getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$1());
|
|
378
|
+
}
|
|
379
|
+
function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
|
|
380
|
+
const { body } = response;
|
|
381
|
+
const key = keyBuilder$1();
|
|
382
|
+
luvio.storeIngest(key, ingest, body);
|
|
383
|
+
const snapshot = luvio.storeLookup({
|
|
384
|
+
recordId: key,
|
|
385
|
+
node: select(),
|
|
386
|
+
variables: {},
|
|
387
|
+
}, snapshotRefresh);
|
|
388
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
389
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
390
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
deepFreeze(snapshot.data);
|
|
394
|
+
return snapshot;
|
|
395
|
+
}
|
|
396
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
397
|
+
const key = keyBuilder$1();
|
|
398
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
399
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
400
|
+
return errorSnapshot;
|
|
401
|
+
}
|
|
402
|
+
function createResourceRequest(config) {
|
|
403
|
+
const headers = {};
|
|
404
|
+
return {
|
|
405
|
+
baseUri: '/services/data/v66.0',
|
|
406
|
+
basePath: '/connect/service-automation/service-catalog/categories',
|
|
407
|
+
method: 'get',
|
|
408
|
+
body: null,
|
|
409
|
+
urlParams: {},
|
|
410
|
+
queryParams: {},
|
|
411
|
+
headers,
|
|
412
|
+
priority: 'normal',
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
const adapterName = 'getCategories';
|
|
417
|
+
const getCategories_ConfigPropertyMetadata = [];
|
|
418
|
+
const getCategories_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getCategories_ConfigPropertyMetadata);
|
|
419
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(getCategories_ConfigPropertyMetadata);
|
|
420
|
+
function keyBuilder(luvio, config) {
|
|
421
|
+
createResourceParams(config);
|
|
422
|
+
return keyBuilder$1();
|
|
423
|
+
}
|
|
424
|
+
function typeCheckConfig(untrustedConfig) {
|
|
425
|
+
const config = {};
|
|
426
|
+
return config;
|
|
427
|
+
}
|
|
428
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
429
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
433
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
434
|
+
}
|
|
435
|
+
const config = typeCheckConfig();
|
|
436
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
return config;
|
|
440
|
+
}
|
|
441
|
+
function adapterFragment(luvio, config) {
|
|
442
|
+
createResourceParams(config);
|
|
443
|
+
return select();
|
|
444
|
+
}
|
|
445
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
446
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response, {
|
|
447
|
+
config,
|
|
448
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
449
|
+
});
|
|
450
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
451
|
+
}
|
|
452
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
453
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
454
|
+
config,
|
|
455
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
456
|
+
});
|
|
457
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
458
|
+
}
|
|
459
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
460
|
+
const resourceParams = createResourceParams(config);
|
|
461
|
+
const request = createResourceRequest();
|
|
462
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
463
|
+
.then((response) => {
|
|
464
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
465
|
+
const cache = new StoreKeyMap();
|
|
466
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
467
|
+
return cache;
|
|
468
|
+
});
|
|
469
|
+
}, (response) => {
|
|
470
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
474
|
+
return buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
|
|
475
|
+
}
|
|
476
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
477
|
+
const { luvio, config } = context;
|
|
478
|
+
const selector = {
|
|
479
|
+
recordId: keyBuilder(luvio, config),
|
|
480
|
+
node: adapterFragment(luvio, config),
|
|
481
|
+
variables: {},
|
|
482
|
+
};
|
|
483
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
484
|
+
config,
|
|
485
|
+
resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
|
|
486
|
+
});
|
|
487
|
+
return cacheSnapshot;
|
|
488
|
+
}
|
|
489
|
+
const getCategoriesAdapterFactory = (luvio) => function ServiceCatalogCategory__getCategories(untrustedConfig, requestContext) {
|
|
490
|
+
const config = validateAdapterConfig(untrustedConfig, getCategories_ConfigPropertyNames);
|
|
491
|
+
// Invalid or incomplete config
|
|
492
|
+
if (config === null) {
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
496
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
let getCategories;
|
|
500
|
+
// Imperative GET Adapters
|
|
501
|
+
let getCategories_imperative;
|
|
502
|
+
// Adapter Metadata
|
|
503
|
+
const getCategoriesMetadata = { apiFamily: 'ServiceCatalogCategory', name: 'getCategories' };
|
|
504
|
+
// Notify Update Available
|
|
505
|
+
function bindExportsTo(luvio) {
|
|
506
|
+
// LDS Adapters
|
|
507
|
+
const getCategories_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCategories', getCategoriesAdapterFactory), getCategoriesMetadata);
|
|
508
|
+
return {
|
|
509
|
+
getCategories: createWireAdapterConstructor(luvio, getCategories_ldsAdapter, getCategoriesMetadata),
|
|
510
|
+
// Imperative GET Adapters
|
|
511
|
+
getCategories_imperative: createImperativeAdapter(luvio, getCategories_ldsAdapter, getCategoriesMetadata),
|
|
512
|
+
// Notify Update Availables
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
withDefaultLuvio((luvio) => {
|
|
516
|
+
({ getCategories, getCategories_imperative } = bindExportsTo(luvio));
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
export { getCategories, getCategories_imperative };
|
|
520
|
+
// version: 0.1.0-dev1-c978a7b010
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#%RAML 1.0
|
|
2
|
+
securedBy:
|
|
3
|
+
- OAuth2
|
|
4
|
+
title: Salesforce Connect API
|
|
5
|
+
version: '60.0'
|
|
6
|
+
mediaType: application/json
|
|
7
|
+
protocols:
|
|
8
|
+
- https
|
|
9
|
+
baseUri: /services/data/v66.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
|
+
SvcCatalogCategoryDetailOutputRepresentation:
|
|
29
|
+
description: Represents a category detail
|
|
30
|
+
type: object
|
|
31
|
+
properties:
|
|
32
|
+
childCategories:
|
|
33
|
+
description: The list of child categories
|
|
34
|
+
type: array
|
|
35
|
+
items:
|
|
36
|
+
type: any # the recursive structure is not yet supported
|
|
37
|
+
# type: SvcCatalogCategoryDetailOutputRepresentation
|
|
38
|
+
label:
|
|
39
|
+
description: The label of the category
|
|
40
|
+
type: string
|
|
41
|
+
name:
|
|
42
|
+
description: The name of the category
|
|
43
|
+
type: string
|
|
44
|
+
sortOrder:
|
|
45
|
+
description: The order of the category relatively to siblings
|
|
46
|
+
type: integer
|
|
47
|
+
SvcCatalogCategoryHeaderOutputRepresentation:
|
|
48
|
+
description: Represents the configuration information for catalog categories of
|
|
49
|
+
an org
|
|
50
|
+
type: object
|
|
51
|
+
properties:
|
|
52
|
+
useDataCategory:
|
|
53
|
+
description: Flag to indicate if the categories are sourced from Data Categories
|
|
54
|
+
or Service Catalog Categories
|
|
55
|
+
type: boolean
|
|
56
|
+
SvcCatalogCategoryOutputRepresentation:
|
|
57
|
+
description: Represents the category configuration and details of an org
|
|
58
|
+
type: object
|
|
59
|
+
properties:
|
|
60
|
+
categories:
|
|
61
|
+
description: The list of categories retrieved from the org
|
|
62
|
+
type: array
|
|
63
|
+
items:
|
|
64
|
+
type: SvcCatalogCategoryDetailOutputRepresentation
|
|
65
|
+
header:
|
|
66
|
+
description: The header information for category configuration in the org
|
|
67
|
+
type: SvcCatalogCategoryHeaderOutputRepresentation
|
|
68
|
+
/connect/service-automation/service-catalog/categories:
|
|
69
|
+
get:
|
|
70
|
+
displayName: getCategories
|
|
71
|
+
description: Returns the categories of an org for service catalog
|
|
72
|
+
responses:
|
|
73
|
+
'200':
|
|
74
|
+
description: Success
|
|
75
|
+
body:
|
|
76
|
+
application/json:
|
|
77
|
+
type: SvcCatalogCategoryOutputRepresentation
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#%RAML 1.0 Overlay
|
|
2
|
+
extends: ./api.raml
|
|
3
|
+
|
|
4
|
+
uses:
|
|
5
|
+
luvio: luvio://annotations.raml
|
|
6
|
+
|
|
7
|
+
(luvio.keyPrefix): 'ServiceCatalogCategory'
|
|
8
|
+
(luvio.ttl): 900000
|
|
9
|
+
|
|
10
|
+
types:
|
|
11
|
+
SvcCatalogCategoryDetailOutputRepresentation:
|
|
12
|
+
(luvio.key):
|
|
13
|
+
name: name
|
|
14
|
+
|
|
15
|
+
/connect/service-automation/service-catalog/categories:
|
|
16
|
+
get:
|
|
17
|
+
(luvio.adapter):
|
|
18
|
+
name: getCategories
|