@salesforce/lds-adapters-platform-content-taxonomy 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.
Files changed (29) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/platform-content-taxonomy.js +1261 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/createTerm.d.ts +18 -0
  5. package/dist/es/es2018/types/src/generated/adapters/deleteTerm.d.ts +17 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getTerm.d.ts +29 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getTerms.d.ts +31 -0
  8. package/dist/es/es2018/types/src/generated/adapters/searchTerms.d.ts +31 -0
  9. package/dist/es/es2018/types/src/generated/adapters/updateTerm.d.ts +19 -0
  10. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +6 -0
  11. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +11 -0
  12. package/dist/es/es2018/types/src/generated/resources/deleteConnectContentTaxonomyTermsByTaxonomyIdAndTermId.d.ts +17 -0
  13. package/dist/es/es2018/types/src/generated/resources/getConnectContentTaxonomyTerms.d.ts +19 -0
  14. package/dist/es/es2018/types/src/generated/resources/getConnectContentTaxonomyTermsByTaxonomyIdAndTermId.d.ts +17 -0
  15. package/dist/es/es2018/types/src/generated/resources/getConnectContentTaxonomyTermsSearch.d.ts +19 -0
  16. package/dist/es/es2018/types/src/generated/resources/patchConnectContentTaxonomyTermsByTaxonomyIdAndTermId.d.ts +18 -0
  17. package/dist/es/es2018/types/src/generated/resources/postConnectContentTaxonomyTermsByTaxonomyId.d.ts +17 -0
  18. package/dist/es/es2018/types/src/generated/types/ContentTaxonomyPathFragmentRepresentation.d.ts +41 -0
  19. package/dist/es/es2018/types/src/generated/types/ContentTaxonomyPathRepresentation.d.ts +36 -0
  20. package/dist/es/es2018/types/src/generated/types/ContentTaxonomyTermCollectionRepresentation.d.ts +36 -0
  21. package/dist/es/es2018/types/src/generated/types/ContentTaxonomyTermInputRepresentation.d.ts +35 -0
  22. package/dist/es/es2018/types/src/generated/types/ContentTaxonomyTermRepresentation.d.ts +70 -0
  23. package/dist/es/es2018/types/src/generated/types/ContentTaxonomyUserSummary.d.ts +44 -0
  24. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  25. package/package.json +66 -0
  26. package/sfdc/index.d.ts +1 -0
  27. package/sfdc/index.js +1367 -0
  28. package/src/raml/api.raml +267 -0
  29. package/src/raml/luvio.raml +57 -0
@@ -0,0 +1,1261 @@
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$3, typeCheckConfig as typeCheckConfig$6, StoreKeyMap, createResourceParams as createResourceParams$6 } 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 = 'content-taxonomy';
73
+
74
+ const { isArray: ArrayIsArray } = Array;
75
+ const { stringify: JSONStringify } = JSON;
76
+ function createLink(ref) {
77
+ return {
78
+ __ref: serializeStructuredKey(ref),
79
+ };
80
+ }
81
+
82
+ function validate$4(obj, path = 'ContentTaxonomyUserSummary') {
83
+ const v_error = (() => {
84
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
85
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
86
+ }
87
+ const obj_id = obj.id;
88
+ const path_id = path + '.id';
89
+ if (typeof obj_id !== 'string') {
90
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
91
+ }
92
+ const obj_name = obj.name;
93
+ const path_name = path + '.name';
94
+ if (typeof obj_name !== 'string') {
95
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
96
+ }
97
+ const obj_url = obj.url;
98
+ const path_url = path + '.url';
99
+ let obj_url_union0 = null;
100
+ const obj_url_union0_error = (() => {
101
+ if (typeof obj_url !== 'string') {
102
+ return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
103
+ }
104
+ })();
105
+ if (obj_url_union0_error != null) {
106
+ obj_url_union0 = obj_url_union0_error.message;
107
+ }
108
+ let obj_url_union1 = null;
109
+ const obj_url_union1_error = (() => {
110
+ if (obj_url !== null) {
111
+ return new TypeError('Expected "null" but received "' + typeof obj_url + '" (at "' + path_url + '")');
112
+ }
113
+ })();
114
+ if (obj_url_union1_error != null) {
115
+ obj_url_union1 = obj_url_union1_error.message;
116
+ }
117
+ if (obj_url_union0 && obj_url_union1) {
118
+ let message = 'Object doesn\'t match union (at "' + path_url + '")';
119
+ message += '\n' + obj_url_union0.split('\n').map((line) => '\t' + line).join('\n');
120
+ message += '\n' + obj_url_union1.split('\n').map((line) => '\t' + line).join('\n');
121
+ return new TypeError(message);
122
+ }
123
+ })();
124
+ return v_error === undefined ? null : v_error;
125
+ }
126
+
127
+ function validate$3(obj, path = 'ContentTaxonomyPathFragmentRepresentation') {
128
+ const v_error = (() => {
129
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
130
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
131
+ }
132
+ const obj_id = obj.id;
133
+ const path_id = path + '.id';
134
+ if (typeof obj_id !== 'string') {
135
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
136
+ }
137
+ const obj_label = obj.label;
138
+ const path_label = path + '.label';
139
+ if (typeof obj_label !== 'string') {
140
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
141
+ }
142
+ })();
143
+ return v_error === undefined ? null : v_error;
144
+ }
145
+
146
+ function validate$2(obj, path = 'ContentTaxonomyPathRepresentation') {
147
+ const v_error = (() => {
148
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
149
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
150
+ }
151
+ const obj_label = obj.label;
152
+ const path_label = path + '.label';
153
+ if (typeof obj_label !== 'string') {
154
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
155
+ }
156
+ const obj_taxonomyFragment = obj.taxonomyFragment;
157
+ const path_taxonomyFragment = path + '.taxonomyFragment';
158
+ const referencepath_taxonomyFragmentValidationError = validate$3(obj_taxonomyFragment, path_taxonomyFragment);
159
+ if (referencepath_taxonomyFragmentValidationError !== null) {
160
+ let message = 'Object doesn\'t match ContentTaxonomyPathFragmentRepresentation (at "' + path_taxonomyFragment + '")\n';
161
+ message += referencepath_taxonomyFragmentValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
162
+ return new TypeError(message);
163
+ }
164
+ const obj_termFragments = obj.termFragments;
165
+ const path_termFragments = path + '.termFragments';
166
+ if (!ArrayIsArray(obj_termFragments)) {
167
+ return new TypeError('Expected "array" but received "' + typeof obj_termFragments + '" (at "' + path_termFragments + '")');
168
+ }
169
+ for (let i = 0; i < obj_termFragments.length; i++) {
170
+ const obj_termFragments_item = obj_termFragments[i];
171
+ const path_termFragments_item = path_termFragments + '[' + i + ']';
172
+ const referencepath_termFragments_itemValidationError = validate$3(obj_termFragments_item, path_termFragments_item);
173
+ if (referencepath_termFragments_itemValidationError !== null) {
174
+ let message = 'Object doesn\'t match ContentTaxonomyPathFragmentRepresentation (at "' + path_termFragments_item + '")\n';
175
+ message += referencepath_termFragments_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
176
+ return new TypeError(message);
177
+ }
178
+ }
179
+ })();
180
+ return v_error === undefined ? null : v_error;
181
+ }
182
+
183
+ const TTL$1 = 100;
184
+ const VERSION$1 = "9861aac63d27c0ee5c1c0708df316215";
185
+ function validate$1(obj, path = 'ContentTaxonomyTermRepresentation') {
186
+ const v_error = (() => {
187
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
188
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
189
+ }
190
+ const obj_childTerms = obj.childTerms;
191
+ const path_childTerms = path + '.childTerms';
192
+ if (!ArrayIsArray(obj_childTerms)) {
193
+ return new TypeError('Expected "array" but received "' + typeof obj_childTerms + '" (at "' + path_childTerms + '")');
194
+ }
195
+ for (let i = 0; i < obj_childTerms.length; i++) {
196
+ const obj_childTerms_item = obj_childTerms[i];
197
+ const path_childTerms_item = path_childTerms + '[' + i + ']';
198
+ const referencepath_childTerms_itemValidationError = validate$1(obj_childTerms_item, path_childTerms_item);
199
+ if (referencepath_childTerms_itemValidationError !== null) {
200
+ let message = 'Object doesn\'t match ContentTaxonomyTermRepresentation (at "' + path_childTerms_item + '")\n';
201
+ message += referencepath_childTerms_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
202
+ return new TypeError(message);
203
+ }
204
+ }
205
+ const obj_createdBy = obj.createdBy;
206
+ const path_createdBy = path + '.createdBy';
207
+ let obj_createdBy_union0 = null;
208
+ const obj_createdBy_union0_error = (() => {
209
+ const referencepath_createdByValidationError = validate$4(obj_createdBy, path_createdBy);
210
+ if (referencepath_createdByValidationError !== null) {
211
+ let message = 'Object doesn\'t match ContentTaxonomyUserSummary (at "' + path_createdBy + '")\n';
212
+ message += referencepath_createdByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
213
+ return new TypeError(message);
214
+ }
215
+ })();
216
+ if (obj_createdBy_union0_error != null) {
217
+ obj_createdBy_union0 = obj_createdBy_union0_error.message;
218
+ }
219
+ let obj_createdBy_union1 = null;
220
+ const obj_createdBy_union1_error = (() => {
221
+ if (obj_createdBy !== null) {
222
+ return new TypeError('Expected "null" but received "' + typeof obj_createdBy + '" (at "' + path_createdBy + '")');
223
+ }
224
+ })();
225
+ if (obj_createdBy_union1_error != null) {
226
+ obj_createdBy_union1 = obj_createdBy_union1_error.message;
227
+ }
228
+ if (obj_createdBy_union0 && obj_createdBy_union1) {
229
+ let message = 'Object doesn\'t match union (at "' + path_createdBy + '")';
230
+ message += '\n' + obj_createdBy_union0.split('\n').map((line) => '\t' + line).join('\n');
231
+ message += '\n' + obj_createdBy_union1.split('\n').map((line) => '\t' + line).join('\n');
232
+ return new TypeError(message);
233
+ }
234
+ const obj_createdDate = obj.createdDate;
235
+ const path_createdDate = path + '.createdDate';
236
+ let obj_createdDate_union0 = null;
237
+ const obj_createdDate_union0_error = (() => {
238
+ if (typeof obj_createdDate !== 'string') {
239
+ return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
240
+ }
241
+ })();
242
+ if (obj_createdDate_union0_error != null) {
243
+ obj_createdDate_union0 = obj_createdDate_union0_error.message;
244
+ }
245
+ let obj_createdDate_union1 = null;
246
+ const obj_createdDate_union1_error = (() => {
247
+ if (obj_createdDate !== null) {
248
+ return new TypeError('Expected "null" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
249
+ }
250
+ })();
251
+ if (obj_createdDate_union1_error != null) {
252
+ obj_createdDate_union1 = obj_createdDate_union1_error.message;
253
+ }
254
+ if (obj_createdDate_union0 && obj_createdDate_union1) {
255
+ let message = 'Object doesn\'t match union (at "' + path_createdDate + '")';
256
+ message += '\n' + obj_createdDate_union0.split('\n').map((line) => '\t' + line).join('\n');
257
+ message += '\n' + obj_createdDate_union1.split('\n').map((line) => '\t' + line).join('\n');
258
+ return new TypeError(message);
259
+ }
260
+ const obj_description = obj.description;
261
+ const path_description = path + '.description';
262
+ let obj_description_union0 = null;
263
+ const obj_description_union0_error = (() => {
264
+ if (typeof obj_description !== 'string') {
265
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
266
+ }
267
+ })();
268
+ if (obj_description_union0_error != null) {
269
+ obj_description_union0 = obj_description_union0_error.message;
270
+ }
271
+ let obj_description_union1 = null;
272
+ const obj_description_union1_error = (() => {
273
+ if (obj_description !== null) {
274
+ return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
275
+ }
276
+ })();
277
+ if (obj_description_union1_error != null) {
278
+ obj_description_union1 = obj_description_union1_error.message;
279
+ }
280
+ if (obj_description_union0 && obj_description_union1) {
281
+ let message = 'Object doesn\'t match union (at "' + path_description + '")';
282
+ message += '\n' + obj_description_union0.split('\n').map((line) => '\t' + line).join('\n');
283
+ message += '\n' + obj_description_union1.split('\n').map((line) => '\t' + line).join('\n');
284
+ return new TypeError(message);
285
+ }
286
+ const obj_id = obj.id;
287
+ const path_id = path + '.id';
288
+ if (typeof obj_id !== 'string') {
289
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
290
+ }
291
+ const obj_isLeafTerm = obj.isLeafTerm;
292
+ const path_isLeafTerm = path + '.isLeafTerm';
293
+ let obj_isLeafTerm_union0 = null;
294
+ const obj_isLeafTerm_union0_error = (() => {
295
+ if (typeof obj_isLeafTerm !== 'boolean') {
296
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isLeafTerm + '" (at "' + path_isLeafTerm + '")');
297
+ }
298
+ })();
299
+ if (obj_isLeafTerm_union0_error != null) {
300
+ obj_isLeafTerm_union0 = obj_isLeafTerm_union0_error.message;
301
+ }
302
+ let obj_isLeafTerm_union1 = null;
303
+ const obj_isLeafTerm_union1_error = (() => {
304
+ if (obj_isLeafTerm !== null) {
305
+ return new TypeError('Expected "null" but received "' + typeof obj_isLeafTerm + '" (at "' + path_isLeafTerm + '")');
306
+ }
307
+ })();
308
+ if (obj_isLeafTerm_union1_error != null) {
309
+ obj_isLeafTerm_union1 = obj_isLeafTerm_union1_error.message;
310
+ }
311
+ if (obj_isLeafTerm_union0 && obj_isLeafTerm_union1) {
312
+ let message = 'Object doesn\'t match union (at "' + path_isLeafTerm + '")';
313
+ message += '\n' + obj_isLeafTerm_union0.split('\n').map((line) => '\t' + line).join('\n');
314
+ message += '\n' + obj_isLeafTerm_union1.split('\n').map((line) => '\t' + line).join('\n');
315
+ return new TypeError(message);
316
+ }
317
+ const obj_label = obj.label;
318
+ const path_label = path + '.label';
319
+ if (typeof obj_label !== 'string') {
320
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
321
+ }
322
+ const obj_lastModifiedBy = obj.lastModifiedBy;
323
+ const path_lastModifiedBy = path + '.lastModifiedBy';
324
+ let obj_lastModifiedBy_union0 = null;
325
+ const obj_lastModifiedBy_union0_error = (() => {
326
+ const referencepath_lastModifiedByValidationError = validate$4(obj_lastModifiedBy, path_lastModifiedBy);
327
+ if (referencepath_lastModifiedByValidationError !== null) {
328
+ let message = 'Object doesn\'t match ContentTaxonomyUserSummary (at "' + path_lastModifiedBy + '")\n';
329
+ message += referencepath_lastModifiedByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
330
+ return new TypeError(message);
331
+ }
332
+ })();
333
+ if (obj_lastModifiedBy_union0_error != null) {
334
+ obj_lastModifiedBy_union0 = obj_lastModifiedBy_union0_error.message;
335
+ }
336
+ let obj_lastModifiedBy_union1 = null;
337
+ const obj_lastModifiedBy_union1_error = (() => {
338
+ if (obj_lastModifiedBy !== null) {
339
+ return new TypeError('Expected "null" but received "' + typeof obj_lastModifiedBy + '" (at "' + path_lastModifiedBy + '")');
340
+ }
341
+ })();
342
+ if (obj_lastModifiedBy_union1_error != null) {
343
+ obj_lastModifiedBy_union1 = obj_lastModifiedBy_union1_error.message;
344
+ }
345
+ if (obj_lastModifiedBy_union0 && obj_lastModifiedBy_union1) {
346
+ let message = 'Object doesn\'t match union (at "' + path_lastModifiedBy + '")';
347
+ message += '\n' + obj_lastModifiedBy_union0.split('\n').map((line) => '\t' + line).join('\n');
348
+ message += '\n' + obj_lastModifiedBy_union1.split('\n').map((line) => '\t' + line).join('\n');
349
+ return new TypeError(message);
350
+ }
351
+ const obj_lastModifiedDate = obj.lastModifiedDate;
352
+ const path_lastModifiedDate = path + '.lastModifiedDate';
353
+ let obj_lastModifiedDate_union0 = null;
354
+ const obj_lastModifiedDate_union0_error = (() => {
355
+ if (typeof obj_lastModifiedDate !== 'string') {
356
+ return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
357
+ }
358
+ })();
359
+ if (obj_lastModifiedDate_union0_error != null) {
360
+ obj_lastModifiedDate_union0 = obj_lastModifiedDate_union0_error.message;
361
+ }
362
+ let obj_lastModifiedDate_union1 = null;
363
+ const obj_lastModifiedDate_union1_error = (() => {
364
+ if (obj_lastModifiedDate !== null) {
365
+ return new TypeError('Expected "null" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
366
+ }
367
+ })();
368
+ if (obj_lastModifiedDate_union1_error != null) {
369
+ obj_lastModifiedDate_union1 = obj_lastModifiedDate_union1_error.message;
370
+ }
371
+ if (obj_lastModifiedDate_union0 && obj_lastModifiedDate_union1) {
372
+ let message = 'Object doesn\'t match union (at "' + path_lastModifiedDate + '")';
373
+ message += '\n' + obj_lastModifiedDate_union0.split('\n').map((line) => '\t' + line).join('\n');
374
+ message += '\n' + obj_lastModifiedDate_union1.split('\n').map((line) => '\t' + line).join('\n');
375
+ return new TypeError(message);
376
+ }
377
+ const obj_parentTerms = obj.parentTerms;
378
+ const path_parentTerms = path + '.parentTerms';
379
+ if (!ArrayIsArray(obj_parentTerms)) {
380
+ return new TypeError('Expected "array" but received "' + typeof obj_parentTerms + '" (at "' + path_parentTerms + '")');
381
+ }
382
+ for (let i = 0; i < obj_parentTerms.length; i++) {
383
+ const obj_parentTerms_item = obj_parentTerms[i];
384
+ const path_parentTerms_item = path_parentTerms + '[' + i + ']';
385
+ const referencepath_parentTerms_itemValidationError = validate$1(obj_parentTerms_item, path_parentTerms_item);
386
+ if (referencepath_parentTerms_itemValidationError !== null) {
387
+ let message = 'Object doesn\'t match ContentTaxonomyTermRepresentation (at "' + path_parentTerms_item + '")\n';
388
+ message += referencepath_parentTerms_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
389
+ return new TypeError(message);
390
+ }
391
+ }
392
+ const obj_pathsFromRoot = obj.pathsFromRoot;
393
+ const path_pathsFromRoot = path + '.pathsFromRoot';
394
+ if (!ArrayIsArray(obj_pathsFromRoot)) {
395
+ return new TypeError('Expected "array" but received "' + typeof obj_pathsFromRoot + '" (at "' + path_pathsFromRoot + '")');
396
+ }
397
+ for (let i = 0; i < obj_pathsFromRoot.length; i++) {
398
+ const obj_pathsFromRoot_item = obj_pathsFromRoot[i];
399
+ const path_pathsFromRoot_item = path_pathsFromRoot + '[' + i + ']';
400
+ const referencepath_pathsFromRoot_itemValidationError = validate$2(obj_pathsFromRoot_item, path_pathsFromRoot_item);
401
+ if (referencepath_pathsFromRoot_itemValidationError !== null) {
402
+ let message = 'Object doesn\'t match ContentTaxonomyPathRepresentation (at "' + path_pathsFromRoot_item + '")\n';
403
+ message += referencepath_pathsFromRoot_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
404
+ return new TypeError(message);
405
+ }
406
+ }
407
+ })();
408
+ return v_error === undefined ? null : v_error;
409
+ }
410
+ const RepresentationType$1 = 'ContentTaxonomyTermRepresentation';
411
+ function keyBuilder$7(luvio, config) {
412
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
413
+ }
414
+ function keyBuilderFromType(luvio, object) {
415
+ const keyParams = {
416
+ id: object.id
417
+ };
418
+ return keyBuilder$7(luvio, keyParams);
419
+ }
420
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
421
+ return input;
422
+ }
423
+ const select$6 = function ContentTaxonomyTermRepresentationSelect() {
424
+ return {
425
+ kind: 'Fragment',
426
+ version: VERSION$1,
427
+ private: [],
428
+ opaque: true
429
+ };
430
+ };
431
+ function equals$1(existing, incoming) {
432
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
433
+ return false;
434
+ }
435
+ return true;
436
+ }
437
+ const ingest$1 = function ContentTaxonomyTermRepresentationIngest(input, path, luvio, store, timestamp) {
438
+ if (process.env.NODE_ENV !== 'production') {
439
+ const validateError = validate$1(input);
440
+ if (validateError !== null) {
441
+ throw validateError;
442
+ }
443
+ }
444
+ const key = keyBuilderFromType(luvio, input);
445
+ const ttlToUse = TTL$1;
446
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "content-taxonomy", VERSION$1, RepresentationType$1, equals$1);
447
+ return createLink(key);
448
+ };
449
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
450
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
451
+ const rootKey = keyBuilderFromType(luvio, input);
452
+ rootKeySet.set(rootKey, {
453
+ namespace: keyPrefix,
454
+ representationName: RepresentationType$1,
455
+ mergeable: false
456
+ });
457
+ }
458
+
459
+ const TTL = 100;
460
+ const VERSION = "bf2f880bd13018a781060bce49e7443e";
461
+ function validate(obj, path = 'ContentTaxonomyTermCollectionRepresentation') {
462
+ const v_error = (() => {
463
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
464
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
465
+ }
466
+ const obj_currentPageUrl = obj.currentPageUrl;
467
+ const path_currentPageUrl = path + '.currentPageUrl';
468
+ if (typeof obj_currentPageUrl !== 'string') {
469
+ return new TypeError('Expected "string" but received "' + typeof obj_currentPageUrl + '" (at "' + path_currentPageUrl + '")');
470
+ }
471
+ const obj_nextPageUrl = obj.nextPageUrl;
472
+ const path_nextPageUrl = path + '.nextPageUrl';
473
+ if (typeof obj_nextPageUrl !== 'string') {
474
+ return new TypeError('Expected "string" but received "' + typeof obj_nextPageUrl + '" (at "' + path_nextPageUrl + '")');
475
+ }
476
+ const obj_terms = obj.terms;
477
+ const path_terms = path + '.terms';
478
+ if (!ArrayIsArray(obj_terms)) {
479
+ return new TypeError('Expected "array" but received "' + typeof obj_terms + '" (at "' + path_terms + '")');
480
+ }
481
+ for (let i = 0; i < obj_terms.length; i++) {
482
+ const obj_terms_item = obj_terms[i];
483
+ const path_terms_item = path_terms + '[' + i + ']';
484
+ const referencepath_terms_itemValidationError = validate$1(obj_terms_item, path_terms_item);
485
+ if (referencepath_terms_itemValidationError !== null) {
486
+ let message = 'Object doesn\'t match ContentTaxonomyTermRepresentation (at "' + path_terms_item + '")\n';
487
+ message += referencepath_terms_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
488
+ return new TypeError(message);
489
+ }
490
+ }
491
+ })();
492
+ return v_error === undefined ? null : v_error;
493
+ }
494
+ const RepresentationType = 'ContentTaxonomyTermCollectionRepresentation';
495
+ function normalize(input, existing, path, luvio, store, timestamp) {
496
+ return input;
497
+ }
498
+ const select$5 = function ContentTaxonomyTermCollectionRepresentationSelect() {
499
+ return {
500
+ kind: 'Fragment',
501
+ version: VERSION,
502
+ private: [],
503
+ opaque: true
504
+ };
505
+ };
506
+ function equals(existing, incoming) {
507
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
508
+ return false;
509
+ }
510
+ return true;
511
+ }
512
+ const ingest = function ContentTaxonomyTermCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
513
+ if (process.env.NODE_ENV !== 'production') {
514
+ const validateError = validate(input);
515
+ if (validateError !== null) {
516
+ throw validateError;
517
+ }
518
+ }
519
+ const key = path.fullPath;
520
+ const ttlToUse = TTL;
521
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "content-taxonomy", VERSION, RepresentationType, equals);
522
+ return createLink(key);
523
+ };
524
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
525
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
526
+ const rootKey = fullPathFactory();
527
+ rootKeySet.set(rootKey, {
528
+ namespace: keyPrefix,
529
+ representationName: RepresentationType,
530
+ mergeable: false
531
+ });
532
+ }
533
+
534
+ function select$4(luvio, params) {
535
+ return select$5();
536
+ }
537
+ function keyBuilder$6(luvio, params) {
538
+ return keyPrefix + '::ContentTaxonomyTermCollectionRepresentation:(' + 'depth:' + params.queryParams.depth + ',' + 'includeMetadata:' + params.queryParams.includeMetadata + ',' + 'includePaths:' + params.queryParams.includePaths + ',' + 'initialTerms:' + params.queryParams.initialTerms + ',' + 'taxonomyId:' + params.queryParams.taxonomyId + ')';
539
+ }
540
+ function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
541
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$6(luvio, resourceParams));
542
+ }
543
+ function ingestSuccess$4(luvio, resourceParams, response, snapshotRefresh) {
544
+ const { body } = response;
545
+ const key = keyBuilder$6(luvio, resourceParams);
546
+ luvio.storeIngest(key, ingest, body);
547
+ const snapshot = luvio.storeLookup({
548
+ recordId: key,
549
+ node: select$4(),
550
+ variables: {},
551
+ }, snapshotRefresh);
552
+ if (process.env.NODE_ENV !== 'production') {
553
+ if (snapshot.state !== 'Fulfilled') {
554
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
555
+ }
556
+ }
557
+ deepFreeze(snapshot.data);
558
+ return snapshot;
559
+ }
560
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
561
+ const key = keyBuilder$6(luvio, params);
562
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
563
+ const storeMetadataParams = {
564
+ ttl: TTL,
565
+ namespace: keyPrefix,
566
+ version: VERSION,
567
+ representationName: RepresentationType
568
+ };
569
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
570
+ return errorSnapshot;
571
+ }
572
+ function createResourceRequest$5(config) {
573
+ const headers = {};
574
+ return {
575
+ baseUri: '/services/data/v66.0',
576
+ basePath: '/connect/content-taxonomy/terms',
577
+ method: 'get',
578
+ body: null,
579
+ urlParams: {},
580
+ queryParams: config.queryParams,
581
+ headers,
582
+ priority: 'normal',
583
+ };
584
+ }
585
+
586
+ const adapterName$5 = 'getTerms';
587
+ const getTerms_ConfigPropertyMetadata = [
588
+ generateParamConfigMetadata('depth', false, 1 /* QueryParameter */, 3 /* Integer */),
589
+ generateParamConfigMetadata('includeMetadata', false, 1 /* QueryParameter */, 1 /* Boolean */),
590
+ generateParamConfigMetadata('includePaths', false, 1 /* QueryParameter */, 1 /* Boolean */),
591
+ generateParamConfigMetadata('initialTerms', false, 1 /* QueryParameter */, 0 /* String */, true),
592
+ generateParamConfigMetadata('taxonomyId', true, 1 /* QueryParameter */, 0 /* String */),
593
+ ];
594
+ const getTerms_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, getTerms_ConfigPropertyMetadata);
595
+ const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(getTerms_ConfigPropertyMetadata);
596
+ function keyBuilder$5(luvio, config) {
597
+ const resourceParams = createResourceParams$5(config);
598
+ return keyBuilder$6(luvio, resourceParams);
599
+ }
600
+ function typeCheckConfig$5(untrustedConfig) {
601
+ const config = {};
602
+ typeCheckConfig$6(untrustedConfig, config, getTerms_ConfigPropertyMetadata);
603
+ return config;
604
+ }
605
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
606
+ if (!untrustedIsObject(untrustedConfig)) {
607
+ return null;
608
+ }
609
+ if (process.env.NODE_ENV !== 'production') {
610
+ validateConfig(untrustedConfig, configPropertyNames);
611
+ }
612
+ const config = typeCheckConfig$5(untrustedConfig);
613
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
614
+ return null;
615
+ }
616
+ return config;
617
+ }
618
+ function adapterFragment$2(luvio, config) {
619
+ createResourceParams$5(config);
620
+ return select$4();
621
+ }
622
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
623
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response, {
624
+ config,
625
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
626
+ });
627
+ return luvio.storeBroadcast().then(() => snapshot);
628
+ }
629
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
630
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
631
+ config,
632
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
633
+ });
634
+ return luvio.storeBroadcast().then(() => snapshot);
635
+ }
636
+ function buildNetworkSnapshot$5(luvio, config, options) {
637
+ const resourceParams = createResourceParams$5(config);
638
+ const request = createResourceRequest$5(resourceParams);
639
+ return luvio.dispatchResourceRequest(request, options)
640
+ .then((response) => {
641
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => {
642
+ const cache = new StoreKeyMap();
643
+ getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
644
+ return cache;
645
+ });
646
+ }, (response) => {
647
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
648
+ });
649
+ }
650
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
651
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$5, undefined, false);
652
+ }
653
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
654
+ const { luvio, config } = context;
655
+ const selector = {
656
+ recordId: keyBuilder$5(luvio, config),
657
+ node: adapterFragment$2(luvio, config),
658
+ variables: {},
659
+ };
660
+ const cacheSnapshot = storeLookup(selector, {
661
+ config,
662
+ resolve: () => buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions)
663
+ });
664
+ return cacheSnapshot;
665
+ }
666
+ const getTermsAdapterFactory = (luvio) => function contentTaxonomy__getTerms(untrustedConfig, requestContext) {
667
+ const config = validateAdapterConfig$5(untrustedConfig, getTerms_ConfigPropertyNames);
668
+ // Invalid or incomplete config
669
+ if (config === null) {
670
+ return null;
671
+ }
672
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
673
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
674
+ };
675
+
676
+ function select$3(luvio, params) {
677
+ return select$5();
678
+ }
679
+ function keyBuilder$4(luvio, params) {
680
+ return keyPrefix + '::ContentTaxonomyTermCollectionRepresentation:(' + 'includeMetadata:' + params.queryParams.includeMetadata + ',' + 'page:' + params.queryParams.page + ',' + 'pageSize:' + params.queryParams.pageSize + ',' + 'queryText:' + params.queryParams.queryText + ',' + 'taxonomyIds:' + params.queryParams.taxonomyIds + ')';
681
+ }
682
+ function getResponseCacheKeys$4(storeKeyMap, luvio, resourceParams, response) {
683
+ getTypeCacheKeys(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
684
+ }
685
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
686
+ const { body } = response;
687
+ const key = keyBuilder$4(luvio, resourceParams);
688
+ luvio.storeIngest(key, ingest, body);
689
+ const snapshot = luvio.storeLookup({
690
+ recordId: key,
691
+ node: select$3(),
692
+ variables: {},
693
+ }, snapshotRefresh);
694
+ if (process.env.NODE_ENV !== 'production') {
695
+ if (snapshot.state !== 'Fulfilled') {
696
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
697
+ }
698
+ }
699
+ deepFreeze(snapshot.data);
700
+ return snapshot;
701
+ }
702
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
703
+ const key = keyBuilder$4(luvio, params);
704
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
705
+ const storeMetadataParams = {
706
+ ttl: TTL,
707
+ namespace: keyPrefix,
708
+ version: VERSION,
709
+ representationName: RepresentationType
710
+ };
711
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
712
+ return errorSnapshot;
713
+ }
714
+ function createResourceRequest$4(config) {
715
+ const headers = {};
716
+ return {
717
+ baseUri: '/services/data/v66.0',
718
+ basePath: '/connect/content-taxonomy/terms/search',
719
+ method: 'get',
720
+ body: null,
721
+ urlParams: {},
722
+ queryParams: config.queryParams,
723
+ headers,
724
+ priority: 'normal',
725
+ };
726
+ }
727
+
728
+ const adapterName$4 = 'searchTerms';
729
+ const searchTerms_ConfigPropertyMetadata = [
730
+ generateParamConfigMetadata('includeMetadata', false, 1 /* QueryParameter */, 1 /* Boolean */),
731
+ generateParamConfigMetadata('page', false, 1 /* QueryParameter */, 3 /* Integer */),
732
+ generateParamConfigMetadata('pageSize', false, 1 /* QueryParameter */, 3 /* Integer */),
733
+ generateParamConfigMetadata('queryText', false, 1 /* QueryParameter */, 0 /* String */),
734
+ generateParamConfigMetadata('taxonomyIds', false, 1 /* QueryParameter */, 0 /* String */, true),
735
+ ];
736
+ const searchTerms_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, searchTerms_ConfigPropertyMetadata);
737
+ const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(searchTerms_ConfigPropertyMetadata);
738
+ function keyBuilder$3(luvio, config) {
739
+ const resourceParams = createResourceParams$4(config);
740
+ return keyBuilder$4(luvio, resourceParams);
741
+ }
742
+ function typeCheckConfig$4(untrustedConfig) {
743
+ const config = {};
744
+ typeCheckConfig$6(untrustedConfig, config, searchTerms_ConfigPropertyMetadata);
745
+ return config;
746
+ }
747
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
748
+ if (!untrustedIsObject(untrustedConfig)) {
749
+ return null;
750
+ }
751
+ if (process.env.NODE_ENV !== 'production') {
752
+ validateConfig(untrustedConfig, configPropertyNames);
753
+ }
754
+ const config = typeCheckConfig$4(untrustedConfig);
755
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
756
+ return null;
757
+ }
758
+ return config;
759
+ }
760
+ function adapterFragment$1(luvio, config) {
761
+ createResourceParams$4(config);
762
+ return select$3();
763
+ }
764
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
765
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
766
+ config,
767
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
768
+ });
769
+ return luvio.storeBroadcast().then(() => snapshot);
770
+ }
771
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
772
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
773
+ config,
774
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
775
+ });
776
+ return luvio.storeBroadcast().then(() => snapshot);
777
+ }
778
+ function buildNetworkSnapshot$4(luvio, config, options) {
779
+ const resourceParams = createResourceParams$4(config);
780
+ const request = createResourceRequest$4(resourceParams);
781
+ return luvio.dispatchResourceRequest(request, options)
782
+ .then((response) => {
783
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
784
+ const cache = new StoreKeyMap();
785
+ getResponseCacheKeys$4(cache, luvio, resourceParams, response.body);
786
+ return cache;
787
+ });
788
+ }, (response) => {
789
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
790
+ });
791
+ }
792
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
793
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$4, undefined, false);
794
+ }
795
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
796
+ const { luvio, config } = context;
797
+ const selector = {
798
+ recordId: keyBuilder$3(luvio, config),
799
+ node: adapterFragment$1(luvio, config),
800
+ variables: {},
801
+ };
802
+ const cacheSnapshot = storeLookup(selector, {
803
+ config,
804
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
805
+ });
806
+ return cacheSnapshot;
807
+ }
808
+ const searchTermsAdapterFactory = (luvio) => function contentTaxonomy__searchTerms(untrustedConfig, requestContext) {
809
+ const config = validateAdapterConfig$4(untrustedConfig, searchTerms_ConfigPropertyNames);
810
+ // Invalid or incomplete config
811
+ if (config === null) {
812
+ return null;
813
+ }
814
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
815
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
816
+ };
817
+
818
+ function select$2(luvio, params) {
819
+ return select$6();
820
+ }
821
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
822
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
823
+ }
824
+ function ingestSuccess$2(luvio, resourceParams, response) {
825
+ const { body } = response;
826
+ const key = keyBuilderFromType(luvio, body);
827
+ luvio.storeIngest(key, ingest$1, body);
828
+ const snapshot = luvio.storeLookup({
829
+ recordId: key,
830
+ node: select$2(),
831
+ variables: {},
832
+ });
833
+ if (process.env.NODE_ENV !== 'production') {
834
+ if (snapshot.state !== 'Fulfilled') {
835
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
836
+ }
837
+ }
838
+ deepFreeze(snapshot.data);
839
+ return snapshot;
840
+ }
841
+ function createResourceRequest$3(config) {
842
+ const headers = {};
843
+ return {
844
+ baseUri: '/services/data/v66.0',
845
+ basePath: '/connect/content-taxonomy/' + config.urlParams.taxonomyId + '/terms',
846
+ method: 'post',
847
+ body: config.body,
848
+ urlParams: config.urlParams,
849
+ queryParams: {},
850
+ headers,
851
+ priority: 'normal',
852
+ };
853
+ }
854
+
855
+ const adapterName$3 = 'createTerm';
856
+ const createTerm_ConfigPropertyMetadata = [
857
+ generateParamConfigMetadata('taxonomyId', true, 0 /* UrlParameter */, 0 /* String */),
858
+ generateParamConfigMetadata('description', false, 2 /* Body */, 4 /* Unsupported */),
859
+ generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
860
+ generateParamConfigMetadata('parentTermId', false, 2 /* Body */, 4 /* Unsupported */),
861
+ ];
862
+ const createTerm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createTerm_ConfigPropertyMetadata);
863
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(createTerm_ConfigPropertyMetadata);
864
+ function typeCheckConfig$3(untrustedConfig) {
865
+ const config = {};
866
+ typeCheckConfig$6(untrustedConfig, config, createTerm_ConfigPropertyMetadata);
867
+ const untrustedConfig_description = untrustedConfig.description;
868
+ if (typeof untrustedConfig_description === 'string') {
869
+ config.description = untrustedConfig_description;
870
+ }
871
+ if (untrustedConfig_description === null) {
872
+ config.description = untrustedConfig_description;
873
+ }
874
+ const untrustedConfig_parentTermId = untrustedConfig.parentTermId;
875
+ if (typeof untrustedConfig_parentTermId === 'string') {
876
+ config.parentTermId = untrustedConfig_parentTermId;
877
+ }
878
+ if (untrustedConfig_parentTermId === null) {
879
+ config.parentTermId = untrustedConfig_parentTermId;
880
+ }
881
+ return config;
882
+ }
883
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
884
+ if (!untrustedIsObject(untrustedConfig)) {
885
+ return null;
886
+ }
887
+ if (process.env.NODE_ENV !== 'production') {
888
+ validateConfig(untrustedConfig, configPropertyNames);
889
+ }
890
+ const config = typeCheckConfig$3(untrustedConfig);
891
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
892
+ return null;
893
+ }
894
+ return config;
895
+ }
896
+ function buildNetworkSnapshot$3(luvio, config, options) {
897
+ const resourceParams = createResourceParams$3(config);
898
+ const request = createResourceRequest$3(resourceParams);
899
+ return luvio.dispatchResourceRequest(request, options)
900
+ .then((response) => {
901
+ return luvio.handleSuccessResponse(() => {
902
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
903
+ return luvio.storeBroadcast().then(() => snapshot);
904
+ }, () => {
905
+ const cache = new StoreKeyMap();
906
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
907
+ return cache;
908
+ });
909
+ }, (response) => {
910
+ deepFreeze(response);
911
+ throw response;
912
+ });
913
+ }
914
+ const createTermAdapterFactory = (luvio) => {
915
+ return function createTerm(untrustedConfig) {
916
+ const config = validateAdapterConfig$3(untrustedConfig, createTerm_ConfigPropertyNames);
917
+ // Invalid or incomplete config
918
+ if (config === null) {
919
+ throw new Error('Invalid config for "createTerm"');
920
+ }
921
+ return buildNetworkSnapshot$3(luvio, config);
922
+ };
923
+ };
924
+
925
+ function keyBuilder$2(luvio, params) {
926
+ return keyBuilder$7(luvio, {
927
+ id: params.urlParams.termId
928
+ });
929
+ }
930
+ function getResponseCacheKeys$2(cacheKeyMap, luvio, resourceParams) {
931
+ const key = keyBuilder$2(luvio, resourceParams);
932
+ cacheKeyMap.set(key, {
933
+ namespace: keyPrefix,
934
+ representationName: RepresentationType$1,
935
+ mergeable: false
936
+ });
937
+ }
938
+ function evictSuccess(luvio, resourceParams) {
939
+ const key = keyBuilder$2(luvio, resourceParams);
940
+ luvio.storeEvict(key);
941
+ }
942
+ function createResourceRequest$2(config) {
943
+ const headers = {};
944
+ return {
945
+ baseUri: '/services/data/v66.0',
946
+ basePath: '/connect/content-taxonomy/' + config.urlParams.taxonomyId + '/terms/' + config.urlParams.termId + '',
947
+ method: 'delete',
948
+ body: null,
949
+ urlParams: config.urlParams,
950
+ queryParams: config.queryParams,
951
+ headers,
952
+ priority: 'normal',
953
+ };
954
+ }
955
+
956
+ const adapterName$2 = 'deleteTerm';
957
+ const deleteTerm_ConfigPropertyMetadata = [
958
+ generateParamConfigMetadata('taxonomyId', true, 0 /* UrlParameter */, 0 /* String */),
959
+ generateParamConfigMetadata('termId', true, 0 /* UrlParameter */, 0 /* String */),
960
+ generateParamConfigMetadata('deleteChildren', false, 1 /* QueryParameter */, 1 /* Boolean */),
961
+ generateParamConfigMetadata('newParentTerm', false, 1 /* QueryParameter */, 0 /* String */),
962
+ ];
963
+ const deleteTerm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, deleteTerm_ConfigPropertyMetadata);
964
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(deleteTerm_ConfigPropertyMetadata);
965
+ function typeCheckConfig$2(untrustedConfig) {
966
+ const config = {};
967
+ typeCheckConfig$6(untrustedConfig, config, deleteTerm_ConfigPropertyMetadata);
968
+ return config;
969
+ }
970
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
971
+ if (!untrustedIsObject(untrustedConfig)) {
972
+ return null;
973
+ }
974
+ if (process.env.NODE_ENV !== 'production') {
975
+ validateConfig(untrustedConfig, configPropertyNames);
976
+ }
977
+ const config = typeCheckConfig$2(untrustedConfig);
978
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
979
+ return null;
980
+ }
981
+ return config;
982
+ }
983
+ function buildNetworkSnapshot$2(luvio, config, options) {
984
+ const resourceParams = createResourceParams$2(config);
985
+ const request = createResourceRequest$2(resourceParams);
986
+ return luvio.dispatchResourceRequest(request, options)
987
+ .then(() => {
988
+ return luvio.handleSuccessResponse(() => {
989
+ evictSuccess(luvio, resourceParams);
990
+ return luvio.storeBroadcast();
991
+ }, () => {
992
+ const cache = new StoreKeyMap();
993
+ getResponseCacheKeys$2(cache, luvio, resourceParams);
994
+ return cache;
995
+ });
996
+ }, (response) => {
997
+ deepFreeze(response);
998
+ throw response;
999
+ });
1000
+ }
1001
+ const deleteTermAdapterFactory = (luvio) => {
1002
+ return function contentTaxonomydeleteTerm(untrustedConfig) {
1003
+ const config = validateAdapterConfig$2(untrustedConfig, deleteTerm_ConfigPropertyNames);
1004
+ // Invalid or incomplete config
1005
+ if (config === null) {
1006
+ throw new Error(`Invalid config for "${adapterName$2}"`);
1007
+ }
1008
+ return buildNetworkSnapshot$2(luvio, config);
1009
+ };
1010
+ };
1011
+
1012
+ function select$1(luvio, params) {
1013
+ return select$6();
1014
+ }
1015
+ function keyBuilder$1(luvio, params) {
1016
+ return keyBuilder$7(luvio, {
1017
+ id: params.urlParams.termId
1018
+ });
1019
+ }
1020
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1021
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1022
+ }
1023
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1024
+ const { body } = response;
1025
+ const key = keyBuilder$1(luvio, resourceParams);
1026
+ luvio.storeIngest(key, ingest$1, body);
1027
+ const snapshot = luvio.storeLookup({
1028
+ recordId: key,
1029
+ node: select$1(),
1030
+ variables: {},
1031
+ }, snapshotRefresh);
1032
+ if (process.env.NODE_ENV !== 'production') {
1033
+ if (snapshot.state !== 'Fulfilled') {
1034
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1035
+ }
1036
+ }
1037
+ deepFreeze(snapshot.data);
1038
+ return snapshot;
1039
+ }
1040
+ function ingestError(luvio, params, error, snapshotRefresh) {
1041
+ const key = keyBuilder$1(luvio, params);
1042
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1043
+ const storeMetadataParams = {
1044
+ ttl: TTL$1,
1045
+ namespace: keyPrefix,
1046
+ version: VERSION$1,
1047
+ representationName: RepresentationType$1
1048
+ };
1049
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1050
+ return errorSnapshot;
1051
+ }
1052
+ function createResourceRequest$1(config) {
1053
+ const headers = {};
1054
+ return {
1055
+ baseUri: '/services/data/v66.0',
1056
+ basePath: '/connect/content-taxonomy/' + config.urlParams.taxonomyId + '/terms/' + config.urlParams.termId + '',
1057
+ method: 'get',
1058
+ body: null,
1059
+ urlParams: config.urlParams,
1060
+ queryParams: {},
1061
+ headers,
1062
+ priority: 'normal',
1063
+ };
1064
+ }
1065
+
1066
+ const adapterName$1 = 'getTerm';
1067
+ const getTerm_ConfigPropertyMetadata = [
1068
+ generateParamConfigMetadata('taxonomyId', true, 0 /* UrlParameter */, 0 /* String */),
1069
+ generateParamConfigMetadata('termId', true, 0 /* UrlParameter */, 0 /* String */),
1070
+ ];
1071
+ const getTerm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getTerm_ConfigPropertyMetadata);
1072
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getTerm_ConfigPropertyMetadata);
1073
+ function keyBuilder(luvio, config) {
1074
+ const resourceParams = createResourceParams$1(config);
1075
+ return keyBuilder$1(luvio, resourceParams);
1076
+ }
1077
+ function typeCheckConfig$1(untrustedConfig) {
1078
+ const config = {};
1079
+ typeCheckConfig$6(untrustedConfig, config, getTerm_ConfigPropertyMetadata);
1080
+ return config;
1081
+ }
1082
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1083
+ if (!untrustedIsObject(untrustedConfig)) {
1084
+ return null;
1085
+ }
1086
+ if (process.env.NODE_ENV !== 'production') {
1087
+ validateConfig(untrustedConfig, configPropertyNames);
1088
+ }
1089
+ const config = typeCheckConfig$1(untrustedConfig);
1090
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1091
+ return null;
1092
+ }
1093
+ return config;
1094
+ }
1095
+ function adapterFragment(luvio, config) {
1096
+ createResourceParams$1(config);
1097
+ return select$1();
1098
+ }
1099
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1100
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1101
+ config,
1102
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1103
+ });
1104
+ return luvio.storeBroadcast().then(() => snapshot);
1105
+ }
1106
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1107
+ const snapshot = ingestError(luvio, resourceParams, response, {
1108
+ config,
1109
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1110
+ });
1111
+ return luvio.storeBroadcast().then(() => snapshot);
1112
+ }
1113
+ function buildNetworkSnapshot$1(luvio, config, options) {
1114
+ const resourceParams = createResourceParams$1(config);
1115
+ const request = createResourceRequest$1(resourceParams);
1116
+ return luvio.dispatchResourceRequest(request, options)
1117
+ .then((response) => {
1118
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1119
+ const cache = new StoreKeyMap();
1120
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1121
+ return cache;
1122
+ });
1123
+ }, (response) => {
1124
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1125
+ });
1126
+ }
1127
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1128
+ return buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
1129
+ }
1130
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1131
+ const { luvio, config } = context;
1132
+ const selector = {
1133
+ recordId: keyBuilder(luvio, config),
1134
+ node: adapterFragment(luvio, config),
1135
+ variables: {},
1136
+ };
1137
+ const cacheSnapshot = storeLookup(selector, {
1138
+ config,
1139
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1140
+ });
1141
+ return cacheSnapshot;
1142
+ }
1143
+ const getTermAdapterFactory = (luvio) => function contentTaxonomy__getTerm(untrustedConfig, requestContext) {
1144
+ const config = validateAdapterConfig$1(untrustedConfig, getTerm_ConfigPropertyNames);
1145
+ // Invalid or incomplete config
1146
+ if (config === null) {
1147
+ return null;
1148
+ }
1149
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1150
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1151
+ };
1152
+
1153
+ function select(luvio, params) {
1154
+ return select$6();
1155
+ }
1156
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1157
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
1158
+ }
1159
+ function ingestSuccess(luvio, resourceParams, response) {
1160
+ const { body } = response;
1161
+ const key = keyBuilderFromType(luvio, body);
1162
+ luvio.storeIngest(key, ingest$1, body);
1163
+ const snapshot = luvio.storeLookup({
1164
+ recordId: key,
1165
+ node: select(),
1166
+ variables: {},
1167
+ });
1168
+ if (process.env.NODE_ENV !== 'production') {
1169
+ if (snapshot.state !== 'Fulfilled') {
1170
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1171
+ }
1172
+ }
1173
+ deepFreeze(snapshot.data);
1174
+ return snapshot;
1175
+ }
1176
+ function createResourceRequest(config) {
1177
+ const headers = {};
1178
+ return {
1179
+ baseUri: '/services/data/v66.0',
1180
+ basePath: '/connect/content-taxonomy/' + config.urlParams.taxonomyId + '/terms/' + config.urlParams.termId + '',
1181
+ method: 'patch',
1182
+ body: config.body,
1183
+ urlParams: config.urlParams,
1184
+ queryParams: {},
1185
+ headers,
1186
+ priority: 'normal',
1187
+ };
1188
+ }
1189
+
1190
+ const adapterName = 'updateTerm';
1191
+ const updateTerm_ConfigPropertyMetadata = [
1192
+ generateParamConfigMetadata('taxonomyId', true, 0 /* UrlParameter */, 0 /* String */),
1193
+ generateParamConfigMetadata('termId', true, 0 /* UrlParameter */, 0 /* String */),
1194
+ generateParamConfigMetadata('description', false, 2 /* Body */, 4 /* Unsupported */),
1195
+ generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
1196
+ generateParamConfigMetadata('parentTermId', false, 2 /* Body */, 4 /* Unsupported */),
1197
+ ];
1198
+ const updateTerm_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateTerm_ConfigPropertyMetadata);
1199
+ const createResourceParams = /*#__PURE__*/ createResourceParams$6(updateTerm_ConfigPropertyMetadata);
1200
+ function typeCheckConfig(untrustedConfig) {
1201
+ const config = {};
1202
+ typeCheckConfig$6(untrustedConfig, config, updateTerm_ConfigPropertyMetadata);
1203
+ const untrustedConfig_description = untrustedConfig.description;
1204
+ if (typeof untrustedConfig_description === 'string') {
1205
+ config.description = untrustedConfig_description;
1206
+ }
1207
+ if (untrustedConfig_description === null) {
1208
+ config.description = untrustedConfig_description;
1209
+ }
1210
+ const untrustedConfig_parentTermId = untrustedConfig.parentTermId;
1211
+ if (typeof untrustedConfig_parentTermId === 'string') {
1212
+ config.parentTermId = untrustedConfig_parentTermId;
1213
+ }
1214
+ if (untrustedConfig_parentTermId === null) {
1215
+ config.parentTermId = untrustedConfig_parentTermId;
1216
+ }
1217
+ return config;
1218
+ }
1219
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1220
+ if (!untrustedIsObject(untrustedConfig)) {
1221
+ return null;
1222
+ }
1223
+ if (process.env.NODE_ENV !== 'production') {
1224
+ validateConfig(untrustedConfig, configPropertyNames);
1225
+ }
1226
+ const config = typeCheckConfig(untrustedConfig);
1227
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1228
+ return null;
1229
+ }
1230
+ return config;
1231
+ }
1232
+ function buildNetworkSnapshot(luvio, config, options) {
1233
+ const resourceParams = createResourceParams(config);
1234
+ const request = createResourceRequest(resourceParams);
1235
+ return luvio.dispatchResourceRequest(request, options)
1236
+ .then((response) => {
1237
+ return luvio.handleSuccessResponse(() => {
1238
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
1239
+ return luvio.storeBroadcast().then(() => snapshot);
1240
+ }, () => {
1241
+ const cache = new StoreKeyMap();
1242
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1243
+ return cache;
1244
+ });
1245
+ }, (response) => {
1246
+ deepFreeze(response);
1247
+ throw response;
1248
+ });
1249
+ }
1250
+ const updateTermAdapterFactory = (luvio) => {
1251
+ return function updateTerm(untrustedConfig) {
1252
+ const config = validateAdapterConfig(untrustedConfig, updateTerm_ConfigPropertyNames);
1253
+ // Invalid or incomplete config
1254
+ if (config === null) {
1255
+ throw new Error('Invalid config for "updateTerm"');
1256
+ }
1257
+ return buildNetworkSnapshot(luvio, config);
1258
+ };
1259
+ };
1260
+
1261
+ export { createTermAdapterFactory, deleteTermAdapterFactory, getTermAdapterFactory, getTermsAdapterFactory, searchTermsAdapterFactory, updateTermAdapterFactory };