@salesforce/lds-adapters-industries-interesttagging 1.100.2

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 (49) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-interesttagging.js +1585 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/createInterestTagEntityAssignment.d.ts +21 -0
  5. package/dist/types/src/generated/adapters/getInterestTagEntityAssignments.d.ts +30 -0
  6. package/dist/types/src/generated/adapters/getTagCategoriesByTagId.d.ts +30 -0
  7. package/dist/types/src/generated/adapters/getTagsByCategoryId.d.ts +30 -0
  8. package/dist/types/src/generated/adapters/getTagsByRecordId.d.ts +30 -0
  9. package/dist/types/src/generated/artifacts/main.d.ts +5 -0
  10. package/dist/types/src/generated/artifacts/sfdc.d.ts +10 -0
  11. package/dist/types/src/generated/resources/deleteConnectInterestTagsTags.d.ts +11 -0
  12. package/dist/types/src/generated/resources/deleteConnectInterestTagsTagsByTagId.d.ts +14 -0
  13. package/dist/types/src/generated/resources/getConnectInterestTagsAssignments.d.ts +18 -0
  14. package/dist/types/src/generated/resources/getConnectInterestTagsAssignmentsEntityByRecordId.d.ts +21 -0
  15. package/dist/types/src/generated/resources/getConnectInterestTagsAssignmentsTagByTagId.d.ts +21 -0
  16. package/dist/types/src/generated/resources/getConnectInterestTagsCategories.d.ts +19 -0
  17. package/dist/types/src/generated/resources/getConnectInterestTagsTags.d.ts +19 -0
  18. package/dist/types/src/generated/resources/getConnectInterestTagsTagsByTagId.d.ts +22 -0
  19. package/dist/types/src/generated/resources/patchConnectInterestTagsTags.d.ts +12 -0
  20. package/dist/types/src/generated/resources/patchConnectInterestTagsTagsByTagId.d.ts +15 -0
  21. package/dist/types/src/generated/resources/postConnectInterestTagsAssignments.d.ts +19 -0
  22. package/dist/types/src/generated/resources/postConnectInterestTagsAssignmentsTagByTagId.d.ts +22 -0
  23. package/dist/types/src/generated/resources/postConnectInterestTagsTags.d.ts +12 -0
  24. package/dist/types/src/generated/resources/postConnectInterestTagsTagsByTagId.d.ts +15 -0
  25. package/dist/types/src/generated/types/InterestTagAssignmentInputRepresentation.d.ts +44 -0
  26. package/dist/types/src/generated/types/InterestTagAssignmentOutputRepresentation.d.ts +51 -0
  27. package/dist/types/src/generated/types/InterestTagCreateCollectionOutputRepresentation.d.ts +30 -0
  28. package/dist/types/src/generated/types/InterestTagCreateInputListRepresentation.d.ts +29 -0
  29. package/dist/types/src/generated/types/InterestTagCreateInputRepresentation.d.ts +38 -0
  30. package/dist/types/src/generated/types/InterestTagCreateResult.d.ts +38 -0
  31. package/dist/types/src/generated/types/InterestTagListRepresentation.d.ts +31 -0
  32. package/dist/types/src/generated/types/InterestTagRepresentation.d.ts +39 -0
  33. package/dist/types/src/generated/types/InterestTagUpdateInputRepresentation.d.ts +38 -0
  34. package/dist/types/src/generated/types/InterestTagUpdateOutputRepresentation.d.ts +32 -0
  35. package/dist/types/src/generated/types/RecordsForTag.d.ts +32 -0
  36. package/dist/types/src/generated/types/TagCategoryListRepresentation.d.ts +30 -0
  37. package/dist/types/src/generated/types/TagCategoryRepresentation.d.ts +35 -0
  38. package/dist/types/src/generated/types/TagCategoryWithParentRepresentation.d.ts +44 -0
  39. package/dist/types/src/generated/types/TagRecordAssignment.d.ts +38 -0
  40. package/dist/types/src/generated/types/TagRecordAssignmentCollectionRepresentation.d.ts +30 -0
  41. package/dist/types/src/generated/types/TagsForRecord.d.ts +32 -0
  42. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  43. package/dist/umd/es2018/industries-interesttagging.js +1597 -0
  44. package/dist/umd/es5/industries-interesttagging.js +1605 -0
  45. package/package.json +70 -0
  46. package/sfdc/index.d.ts +1 -0
  47. package/sfdc/index.js +1647 -0
  48. package/src/raml/api.raml +529 -0
  49. package/src/raml/luvio.raml +43 -0
@@ -0,0 +1,1585 @@
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, StoreKeyMap } from '@luvio/engine';
8
+
9
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
10
+ const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = 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$1(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
+ const keyPrefix = 'interesttagging';
52
+
53
+ const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
54
+ const { isArray: ArrayIsArray } = Array;
55
+ const { stringify: JSONStringify } = JSON;
56
+ function equalsArray(a, b, equalsItem) {
57
+ const aLength = a.length;
58
+ const bLength = b.length;
59
+ if (aLength !== bLength) {
60
+ return false;
61
+ }
62
+ for (let i = 0; i < aLength; i++) {
63
+ if (equalsItem(a[i], b[i]) === false) {
64
+ return false;
65
+ }
66
+ }
67
+ return true;
68
+ }
69
+ function deepFreeze$4(value) {
70
+ // No need to freeze primitives
71
+ if (typeof value !== 'object' || value === null) {
72
+ return;
73
+ }
74
+ if (ArrayIsArray(value)) {
75
+ for (let i = 0, len = value.length; i < len; i += 1) {
76
+ deepFreeze$4(value[i]);
77
+ }
78
+ }
79
+ else {
80
+ const keys = ObjectKeys(value);
81
+ for (let i = 0, len = keys.length; i < len; i += 1) {
82
+ deepFreeze$4(value[keys[i]]);
83
+ }
84
+ }
85
+ ObjectFreeze(value);
86
+ }
87
+ function createLink(ref) {
88
+ return {
89
+ __ref: serializeStructuredKey(ref),
90
+ };
91
+ }
92
+
93
+ const TTL$1 = 10000;
94
+ const VERSION$5 = "d1e3c71d06accea875e9f0c6f41bd7bd";
95
+ function validate$7(obj, path = 'InterestTagAssignmentOutputRepresentation') {
96
+ const v_error = (() => {
97
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
98
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
99
+ }
100
+ const obj_errors = obj.errors;
101
+ const path_errors = path + '.errors';
102
+ if (!ArrayIsArray(obj_errors)) {
103
+ return new TypeError('Expected "array" but received "' + typeof obj_errors + '" (at "' + path_errors + '")');
104
+ }
105
+ for (let i = 0; i < obj_errors.length; i++) {
106
+ const obj_errors_item = obj_errors[i];
107
+ const path_errors_item = path_errors + '[' + i + ']';
108
+ if (typeof obj_errors_item !== 'string') {
109
+ return new TypeError('Expected "string" but received "' + typeof obj_errors_item + '" (at "' + path_errors_item + '")');
110
+ }
111
+ }
112
+ const obj_isCreated = obj.isCreated;
113
+ const path_isCreated = path + '.isCreated';
114
+ if (typeof obj_isCreated !== 'boolean') {
115
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isCreated + '" (at "' + path_isCreated + '")');
116
+ }
117
+ const obj_isSuccess = obj.isSuccess;
118
+ const path_isSuccess = path + '.isSuccess';
119
+ if (typeof obj_isSuccess !== 'boolean') {
120
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
121
+ }
122
+ })();
123
+ return v_error === undefined ? null : v_error;
124
+ }
125
+ const RepresentationType$3 = 'InterestTagAssignmentOutputRepresentation';
126
+ function keyBuilder$8(luvio, config) {
127
+ return keyPrefix + '::' + RepresentationType$3 + ':' + '[' + config.errors.join(',') + ']' + ':' + config.isCreated + ':' + config.isSuccess;
128
+ }
129
+ function keyBuilderFromType(luvio, object) {
130
+ const keyParams = {
131
+ errors: object.errors,
132
+ isCreated: object.isCreated,
133
+ isSuccess: object.isSuccess
134
+ };
135
+ return keyBuilder$8(luvio, keyParams);
136
+ }
137
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
138
+ return input;
139
+ }
140
+ const select$a = function InterestTagAssignmentOutputRepresentationSelect() {
141
+ return {
142
+ kind: 'Fragment',
143
+ version: VERSION$5,
144
+ private: [],
145
+ opaque: true
146
+ };
147
+ };
148
+ function equals$5(existing, incoming) {
149
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
150
+ return false;
151
+ }
152
+ return true;
153
+ }
154
+ function deepFreeze$3(input) {
155
+ const input_errors = input.errors;
156
+ ObjectFreeze(input_errors);
157
+ ObjectFreeze(input);
158
+ }
159
+ const ingest$3 = function InterestTagAssignmentOutputRepresentationIngest(input, path, luvio, store, timestamp) {
160
+ if (process.env.NODE_ENV !== 'production') {
161
+ const validateError = validate$7(input);
162
+ if (validateError !== null) {
163
+ throw validateError;
164
+ }
165
+ }
166
+ const key = keyBuilderFromType(luvio, input);
167
+ const existingRecord = store.readEntry(key);
168
+ const ttlToUse = TTL$1;
169
+ let incomingRecord = normalize$3(input, store.readEntry(key), {
170
+ fullPath: key,
171
+ parent: path.parent,
172
+ propertyName: path.propertyName,
173
+ ttl: ttlToUse
174
+ });
175
+ deepFreeze$3(input);
176
+ if (existingRecord === undefined || equals$5(existingRecord, incomingRecord) === false) {
177
+ luvio.storePublish(key, incomingRecord);
178
+ }
179
+ {
180
+ const storeMetadataParams = {
181
+ ttl: ttlToUse,
182
+ namespace: "interesttagging",
183
+ version: VERSION$5,
184
+ representationName: RepresentationType$3,
185
+ };
186
+ luvio.publishStoreMetadata(key, storeMetadataParams);
187
+ }
188
+ return createLink(key);
189
+ };
190
+ function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
191
+ const rootKeySet = new StoreKeyMap();
192
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
193
+ const rootKey = keyBuilderFromType(luvio, input);
194
+ rootKeySet.set(rootKey, {
195
+ namespace: keyPrefix,
196
+ representationName: RepresentationType$3,
197
+ mergeable: false
198
+ });
199
+ return rootKeySet;
200
+ }
201
+
202
+ function select$9(luvio, params) {
203
+ return select$a();
204
+ }
205
+ function getResponseCacheKeys$4(luvio, resourceParams, response) {
206
+ return getTypeCacheKeys$3(luvio, response);
207
+ }
208
+ function ingestSuccess$4(luvio, resourceParams, response) {
209
+ const { body } = response;
210
+ const key = keyBuilderFromType(luvio, body);
211
+ luvio.storeIngest(key, ingest$3, body);
212
+ const snapshot = luvio.storeLookup({
213
+ recordId: key,
214
+ node: select$9(),
215
+ variables: {},
216
+ });
217
+ if (process.env.NODE_ENV !== 'production') {
218
+ if (snapshot.state !== 'Fulfilled') {
219
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
220
+ }
221
+ }
222
+ return snapshot;
223
+ }
224
+ function createResourceRequest$4(config) {
225
+ const headers = {};
226
+ return {
227
+ baseUri: '/services/data/v58.0',
228
+ basePath: '/connect/interest-tags/assignments',
229
+ method: 'post',
230
+ body: config.body,
231
+ urlParams: {},
232
+ queryParams: {},
233
+ headers,
234
+ priority: 'normal',
235
+ };
236
+ }
237
+
238
+ const createInterestTagEntityAssignment_ConfigPropertyNames = {
239
+ displayName: 'createInterestTagEntityAssignment',
240
+ parameters: {
241
+ required: ['recordsForTag', 'tagsForRecord'],
242
+ optional: []
243
+ }
244
+ };
245
+ function createResourceParams$4(config) {
246
+ const resourceParams = {
247
+ body: {
248
+ recordsForTag: config.recordsForTag, tagsForRecord: config.tagsForRecord
249
+ }
250
+ };
251
+ return resourceParams;
252
+ }
253
+ function typeCheckConfig$4(untrustedConfig) {
254
+ const config = {};
255
+ const untrustedConfig_recordsForTag = untrustedConfig.recordsForTag;
256
+ if (untrustedIsObject(untrustedConfig_recordsForTag)) {
257
+ const untrustedConfig_recordsForTag_object = {};
258
+ const untrustedConfig_recordsForTag_TagId = untrustedConfig_recordsForTag.TagId;
259
+ if (typeof untrustedConfig_recordsForTag_TagId === 'string') {
260
+ untrustedConfig_recordsForTag_object.TagId = untrustedConfig_recordsForTag_TagId;
261
+ }
262
+ const untrustedConfig_recordsForTag_RecordIds = untrustedConfig_recordsForTag.RecordIds;
263
+ if (ArrayIsArray$1(untrustedConfig_recordsForTag_RecordIds)) {
264
+ const untrustedConfig_recordsForTag_RecordIds_array = [];
265
+ for (let i = 0, arrayLength = untrustedConfig_recordsForTag_RecordIds.length; i < arrayLength; i++) {
266
+ const untrustedConfig_recordsForTag_RecordIds_item = untrustedConfig_recordsForTag_RecordIds[i];
267
+ if (typeof untrustedConfig_recordsForTag_RecordIds_item === 'string') {
268
+ untrustedConfig_recordsForTag_RecordIds_array.push(untrustedConfig_recordsForTag_RecordIds_item);
269
+ }
270
+ }
271
+ untrustedConfig_recordsForTag_object.RecordIds = untrustedConfig_recordsForTag_RecordIds_array;
272
+ }
273
+ if (untrustedConfig_recordsForTag_object !== undefined && Object.keys(untrustedConfig_recordsForTag_object).length >= 0) {
274
+ config.recordsForTag = untrustedConfig_recordsForTag_object;
275
+ }
276
+ }
277
+ const untrustedConfig_tagsForRecord = untrustedConfig.tagsForRecord;
278
+ if (untrustedIsObject(untrustedConfig_tagsForRecord)) {
279
+ const untrustedConfig_tagsForRecord_object = {};
280
+ const untrustedConfig_tagsForRecord_RecordId = untrustedConfig_tagsForRecord.RecordId;
281
+ if (typeof untrustedConfig_tagsForRecord_RecordId === 'string') {
282
+ untrustedConfig_tagsForRecord_object.RecordId = untrustedConfig_tagsForRecord_RecordId;
283
+ }
284
+ const untrustedConfig_tagsForRecord_TagIds = untrustedConfig_tagsForRecord.TagIds;
285
+ if (ArrayIsArray$1(untrustedConfig_tagsForRecord_TagIds)) {
286
+ const untrustedConfig_tagsForRecord_TagIds_array = [];
287
+ for (let i = 0, arrayLength = untrustedConfig_tagsForRecord_TagIds.length; i < arrayLength; i++) {
288
+ const untrustedConfig_tagsForRecord_TagIds_item = untrustedConfig_tagsForRecord_TagIds[i];
289
+ if (typeof untrustedConfig_tagsForRecord_TagIds_item === 'string') {
290
+ untrustedConfig_tagsForRecord_TagIds_array.push(untrustedConfig_tagsForRecord_TagIds_item);
291
+ }
292
+ }
293
+ untrustedConfig_tagsForRecord_object.TagIds = untrustedConfig_tagsForRecord_TagIds_array;
294
+ }
295
+ if (untrustedConfig_tagsForRecord_object !== undefined && Object.keys(untrustedConfig_tagsForRecord_object).length >= 0) {
296
+ config.tagsForRecord = untrustedConfig_tagsForRecord_object;
297
+ }
298
+ }
299
+ return config;
300
+ }
301
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
302
+ if (!untrustedIsObject(untrustedConfig)) {
303
+ return null;
304
+ }
305
+ if (process.env.NODE_ENV !== 'production') {
306
+ validateConfig(untrustedConfig, configPropertyNames);
307
+ }
308
+ const config = typeCheckConfig$4(untrustedConfig);
309
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
310
+ return null;
311
+ }
312
+ return config;
313
+ }
314
+ function buildNetworkSnapshot$4(luvio, config, options) {
315
+ const resourceParams = createResourceParams$4(config);
316
+ const request = createResourceRequest$4(resourceParams);
317
+ return luvio.dispatchResourceRequest(request, options)
318
+ .then((response) => {
319
+ return luvio.handleSuccessResponse(() => {
320
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response);
321
+ return luvio.storeBroadcast().then(() => snapshot);
322
+ }, () => getResponseCacheKeys$4(luvio, resourceParams, response.body));
323
+ }, (response) => {
324
+ deepFreeze$4(response);
325
+ throw response;
326
+ });
327
+ }
328
+ const createInterestTagEntityAssignmentAdapterFactory = (luvio) => {
329
+ return function createInterestTagEntityAssignment(untrustedConfig) {
330
+ const config = validateAdapterConfig$4(untrustedConfig, createInterestTagEntityAssignment_ConfigPropertyNames);
331
+ // Invalid or incomplete config
332
+ if (config === null) {
333
+ throw new Error('Invalid config for "createInterestTagEntityAssignment"');
334
+ }
335
+ return buildNetworkSnapshot$4(luvio, config);
336
+ };
337
+ };
338
+
339
+ function validate$6(obj, path = 'TagCategoryRepresentation') {
340
+ const v_error = (() => {
341
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
342
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
343
+ }
344
+ const obj_categoryId = obj.categoryId;
345
+ const path_categoryId = path + '.categoryId';
346
+ if (typeof obj_categoryId !== 'string') {
347
+ return new TypeError('Expected "string" but received "' + typeof obj_categoryId + '" (at "' + path_categoryId + '")');
348
+ }
349
+ const obj_icon = obj.icon;
350
+ const path_icon = path + '.icon';
351
+ if (typeof obj_icon !== 'string') {
352
+ return new TypeError('Expected "string" but received "' + typeof obj_icon + '" (at "' + path_icon + '")');
353
+ }
354
+ const obj_name = obj.name;
355
+ const path_name = path + '.name';
356
+ if (typeof obj_name !== 'string') {
357
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
358
+ }
359
+ })();
360
+ return v_error === undefined ? null : v_error;
361
+ }
362
+ function deepFreeze$2(input) {
363
+ ObjectFreeze(input);
364
+ }
365
+
366
+ function validate$5(obj, path = 'InterestTagRepresentation') {
367
+ const v_error = (() => {
368
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
369
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
370
+ }
371
+ const obj_categories = obj.categories;
372
+ const path_categories = path + '.categories';
373
+ if (!ArrayIsArray(obj_categories)) {
374
+ return new TypeError('Expected "array" but received "' + typeof obj_categories + '" (at "' + path_categories + '")');
375
+ }
376
+ for (let i = 0; i < obj_categories.length; i++) {
377
+ const obj_categories_item = obj_categories[i];
378
+ const path_categories_item = path_categories + '[' + i + ']';
379
+ const referencepath_categories_itemValidationError = validate$6(obj_categories_item, path_categories_item);
380
+ if (referencepath_categories_itemValidationError !== null) {
381
+ let message = 'Object doesn\'t match TagCategoryRepresentation (at "' + path_categories_item + '")\n';
382
+ message += referencepath_categories_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
383
+ return new TypeError(message);
384
+ }
385
+ }
386
+ const obj_name = obj.name;
387
+ const path_name = path + '.name';
388
+ if (typeof obj_name !== 'string') {
389
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
390
+ }
391
+ const obj_recordAssignmentId = obj.recordAssignmentId;
392
+ const path_recordAssignmentId = path + '.recordAssignmentId';
393
+ if (typeof obj_recordAssignmentId !== 'string') {
394
+ return new TypeError('Expected "string" but received "' + typeof obj_recordAssignmentId + '" (at "' + path_recordAssignmentId + '")');
395
+ }
396
+ const obj_tagId = obj.tagId;
397
+ const path_tagId = path + '.tagId';
398
+ if (typeof obj_tagId !== 'string') {
399
+ return new TypeError('Expected "string" but received "' + typeof obj_tagId + '" (at "' + path_tagId + '")');
400
+ }
401
+ })();
402
+ return v_error === undefined ? null : v_error;
403
+ }
404
+ function deepFreeze$1(input) {
405
+ const input_categories = input.categories;
406
+ for (let i = 0; i < input_categories.length; i++) {
407
+ const input_categories_item = input_categories[i];
408
+ deepFreeze$2(input_categories_item);
409
+ }
410
+ ObjectFreeze(input_categories);
411
+ ObjectFreeze(input);
412
+ }
413
+
414
+ const TTL = 10000;
415
+ const VERSION$4 = "a7f32ea47ff9fb394c6f9e13003a5595";
416
+ function validate$4(obj, path = 'InterestTagListRepresentation') {
417
+ const v_error = (() => {
418
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
419
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
420
+ }
421
+ const obj_tags = obj.tags;
422
+ const path_tags = path + '.tags';
423
+ if (!ArrayIsArray(obj_tags)) {
424
+ return new TypeError('Expected "array" but received "' + typeof obj_tags + '" (at "' + path_tags + '")');
425
+ }
426
+ for (let i = 0; i < obj_tags.length; i++) {
427
+ const obj_tags_item = obj_tags[i];
428
+ const path_tags_item = path_tags + '[' + i + ']';
429
+ const referencepath_tags_itemValidationError = validate$5(obj_tags_item, path_tags_item);
430
+ if (referencepath_tags_itemValidationError !== null) {
431
+ let message = 'Object doesn\'t match InterestTagRepresentation (at "' + path_tags_item + '")\n';
432
+ message += referencepath_tags_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
433
+ return new TypeError(message);
434
+ }
435
+ }
436
+ })();
437
+ return v_error === undefined ? null : v_error;
438
+ }
439
+ const RepresentationType$2 = 'InterestTagListRepresentation';
440
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
441
+ return input;
442
+ }
443
+ const select$8 = function InterestTagListRepresentationSelect() {
444
+ return {
445
+ kind: 'Fragment',
446
+ version: VERSION$4,
447
+ private: [],
448
+ opaque: true
449
+ };
450
+ };
451
+ function equals$4(existing, incoming) {
452
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
453
+ return false;
454
+ }
455
+ return true;
456
+ }
457
+ function deepFreeze(input) {
458
+ const input_tags = input.tags;
459
+ for (let i = 0; i < input_tags.length; i++) {
460
+ const input_tags_item = input_tags[i];
461
+ deepFreeze$1(input_tags_item);
462
+ }
463
+ ObjectFreeze(input_tags);
464
+ ObjectFreeze(input);
465
+ }
466
+ const ingest$2 = function InterestTagListRepresentationIngest(input, path, luvio, store, timestamp) {
467
+ if (process.env.NODE_ENV !== 'production') {
468
+ const validateError = validate$4(input);
469
+ if (validateError !== null) {
470
+ throw validateError;
471
+ }
472
+ }
473
+ const key = path.fullPath;
474
+ const existingRecord = store.readEntry(key);
475
+ const ttlToUse = TTL;
476
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
477
+ fullPath: key,
478
+ parent: path.parent,
479
+ propertyName: path.propertyName,
480
+ ttl: ttlToUse
481
+ });
482
+ deepFreeze(input);
483
+ if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
484
+ luvio.storePublish(key, incomingRecord);
485
+ }
486
+ {
487
+ const storeMetadataParams = {
488
+ ttl: ttlToUse,
489
+ namespace: "interesttagging",
490
+ version: VERSION$4,
491
+ representationName: RepresentationType$2,
492
+ };
493
+ luvio.publishStoreMetadata(key, storeMetadataParams);
494
+ }
495
+ return createLink(key);
496
+ };
497
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
498
+ const rootKeySet = new StoreKeyMap();
499
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
500
+ const rootKey = fullPathFactory();
501
+ rootKeySet.set(rootKey, {
502
+ namespace: keyPrefix,
503
+ representationName: RepresentationType$2,
504
+ mergeable: false
505
+ });
506
+ return rootKeySet;
507
+ }
508
+
509
+ function select$7(luvio, params) {
510
+ return select$8();
511
+ }
512
+ function keyBuilder$7(luvio, params) {
513
+ return keyPrefix + '::InterestTagListRepresentation:(' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderBy:' + params.queryParams.orderBy + ',' + 'sort:' + params.queryParams.sort + ',' + 'recordId:' + params.urlParams.recordId + ')';
514
+ }
515
+ function getResponseCacheKeys$3(luvio, resourceParams, response) {
516
+ return getTypeCacheKeys$2(luvio, response, () => keyBuilder$7(luvio, resourceParams));
517
+ }
518
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
519
+ const { body } = response;
520
+ const key = keyBuilder$7(luvio, resourceParams);
521
+ luvio.storeIngest(key, ingest$2, body);
522
+ const snapshot = luvio.storeLookup({
523
+ recordId: key,
524
+ node: select$7(),
525
+ variables: {},
526
+ }, snapshotRefresh);
527
+ if (process.env.NODE_ENV !== 'production') {
528
+ if (snapshot.state !== 'Fulfilled') {
529
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
530
+ }
531
+ }
532
+ return snapshot;
533
+ }
534
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
535
+ const key = keyBuilder$7(luvio, params);
536
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
537
+ const storeMetadataParams = {
538
+ ttl: TTL,
539
+ namespace: keyPrefix,
540
+ version: VERSION$4,
541
+ representationName: RepresentationType$2
542
+ };
543
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
544
+ return errorSnapshot;
545
+ }
546
+ function createResourceRequest$3(config) {
547
+ const headers = {};
548
+ return {
549
+ baseUri: '/services/data/v58.0',
550
+ basePath: '/connect/interest-tags/assignments/entity/' + config.urlParams.recordId + '',
551
+ method: 'get',
552
+ body: null,
553
+ urlParams: config.urlParams,
554
+ queryParams: config.queryParams,
555
+ headers,
556
+ priority: 'normal',
557
+ };
558
+ }
559
+
560
+ const getTagsByRecordId_ConfigPropertyNames = {
561
+ displayName: 'getTagsByRecordId',
562
+ parameters: {
563
+ required: ['recordId'],
564
+ optional: ['limit', 'offset', 'orderBy', 'sort']
565
+ }
566
+ };
567
+ function createResourceParams$3(config) {
568
+ const resourceParams = {
569
+ urlParams: {
570
+ recordId: config.recordId
571
+ },
572
+ queryParams: {
573
+ limit: config.limit, offset: config.offset, orderBy: config.orderBy, sort: config.sort
574
+ }
575
+ };
576
+ return resourceParams;
577
+ }
578
+ function keyBuilder$6(luvio, config) {
579
+ const resourceParams = createResourceParams$3(config);
580
+ return keyBuilder$7(luvio, resourceParams);
581
+ }
582
+ function typeCheckConfig$3(untrustedConfig) {
583
+ const config = {};
584
+ const untrustedConfig_recordId = untrustedConfig.recordId;
585
+ if (typeof untrustedConfig_recordId === 'string') {
586
+ config.recordId = untrustedConfig_recordId;
587
+ }
588
+ const untrustedConfig_limit = untrustedConfig.limit;
589
+ if (typeof untrustedConfig_limit === 'number' && Math.floor(untrustedConfig_limit) === untrustedConfig_limit) {
590
+ config.limit = untrustedConfig_limit;
591
+ }
592
+ const untrustedConfig_offset = untrustedConfig.offset;
593
+ if (typeof untrustedConfig_offset === 'number' && Math.floor(untrustedConfig_offset) === untrustedConfig_offset) {
594
+ config.offset = untrustedConfig_offset;
595
+ }
596
+ const untrustedConfig_orderBy = untrustedConfig.orderBy;
597
+ if (typeof untrustedConfig_orderBy === 'string') {
598
+ config.orderBy = untrustedConfig_orderBy;
599
+ }
600
+ const untrustedConfig_sort = untrustedConfig.sort;
601
+ if (typeof untrustedConfig_sort === 'string') {
602
+ config.sort = untrustedConfig_sort;
603
+ }
604
+ return config;
605
+ }
606
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
607
+ if (!untrustedIsObject(untrustedConfig)) {
608
+ return null;
609
+ }
610
+ if (process.env.NODE_ENV !== 'production') {
611
+ validateConfig(untrustedConfig, configPropertyNames);
612
+ }
613
+ const config = typeCheckConfig$3(untrustedConfig);
614
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
615
+ return null;
616
+ }
617
+ return config;
618
+ }
619
+ function adapterFragment$3(luvio, config) {
620
+ createResourceParams$3(config);
621
+ return select$7();
622
+ }
623
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
624
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
625
+ config,
626
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
627
+ });
628
+ return luvio.storeBroadcast().then(() => snapshot);
629
+ }
630
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
631
+ const snapshot = ingestError$3(luvio, resourceParams, response, {
632
+ config,
633
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
634
+ });
635
+ return luvio.storeBroadcast().then(() => snapshot);
636
+ }
637
+ function buildNetworkSnapshot$3(luvio, config, options) {
638
+ const resourceParams = createResourceParams$3(config);
639
+ const request = createResourceRequest$3(resourceParams);
640
+ return luvio.dispatchResourceRequest(request, options)
641
+ .then((response) => {
642
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => getResponseCacheKeys$3(luvio, resourceParams, response.body));
643
+ }, (response) => {
644
+ return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
645
+ });
646
+ }
647
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
648
+ const { luvio, config } = context;
649
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
650
+ const dispatchOptions = {
651
+ resourceRequestContext: {
652
+ requestCorrelator,
653
+ luvioRequestMethod: undefined,
654
+ },
655
+ eventObservers
656
+ };
657
+ if (networkPriority !== 'normal') {
658
+ dispatchOptions.overrides = {
659
+ priority: networkPriority
660
+ };
661
+ }
662
+ return buildNetworkSnapshot$3(luvio, config, dispatchOptions);
663
+ }
664
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
665
+ const { luvio, config } = context;
666
+ const selector = {
667
+ recordId: keyBuilder$6(luvio, config),
668
+ node: adapterFragment$3(luvio, config),
669
+ variables: {},
670
+ };
671
+ const cacheSnapshot = storeLookup(selector, {
672
+ config,
673
+ resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
674
+ });
675
+ return cacheSnapshot;
676
+ }
677
+ const getTagsByRecordIdAdapterFactory = (luvio) => function interesttagging__getTagsByRecordId(untrustedConfig, requestContext) {
678
+ const config = validateAdapterConfig$3(untrustedConfig, getTagsByRecordId_ConfigPropertyNames);
679
+ // Invalid or incomplete config
680
+ if (config === null) {
681
+ return null;
682
+ }
683
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
684
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
685
+ };
686
+
687
+ const VERSION$3 = "bead7737d6de24db2005f390553ce4bf";
688
+ function validate$3(obj, path = 'TagRecordAssignment') {
689
+ const v_error = (() => {
690
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
691
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
692
+ }
693
+ const obj_assignmentId = obj.assignmentId;
694
+ const path_assignmentId = path + '.assignmentId';
695
+ if (typeof obj_assignmentId !== 'string') {
696
+ return new TypeError('Expected "string" but received "' + typeof obj_assignmentId + '" (at "' + path_assignmentId + '")');
697
+ }
698
+ const obj_objectName = obj.objectName;
699
+ const path_objectName = path + '.objectName';
700
+ if (typeof obj_objectName !== 'string') {
701
+ return new TypeError('Expected "string" but received "' + typeof obj_objectName + '" (at "' + path_objectName + '")');
702
+ }
703
+ const obj_recordId = obj.recordId;
704
+ const path_recordId = path + '.recordId';
705
+ if (typeof obj_recordId !== 'string') {
706
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
707
+ }
708
+ const obj_recordName = obj.recordName;
709
+ const path_recordName = path + '.recordName';
710
+ if (typeof obj_recordName !== 'string') {
711
+ return new TypeError('Expected "string" but received "' + typeof obj_recordName + '" (at "' + path_recordName + '")');
712
+ }
713
+ })();
714
+ return v_error === undefined ? null : v_error;
715
+ }
716
+ const select$6 = function TagRecordAssignmentSelect() {
717
+ return {
718
+ kind: 'Fragment',
719
+ version: VERSION$3,
720
+ private: [],
721
+ selections: [
722
+ {
723
+ name: 'assignmentId',
724
+ kind: 'Scalar'
725
+ },
726
+ {
727
+ name: 'objectName',
728
+ kind: 'Scalar'
729
+ },
730
+ {
731
+ name: 'recordId',
732
+ kind: 'Scalar'
733
+ },
734
+ {
735
+ name: 'recordName',
736
+ kind: 'Scalar'
737
+ }
738
+ ]
739
+ };
740
+ };
741
+ function equals$3(existing, incoming) {
742
+ const existing_assignmentId = existing.assignmentId;
743
+ const incoming_assignmentId = incoming.assignmentId;
744
+ if (!(existing_assignmentId === incoming_assignmentId)) {
745
+ return false;
746
+ }
747
+ const existing_objectName = existing.objectName;
748
+ const incoming_objectName = incoming.objectName;
749
+ if (!(existing_objectName === incoming_objectName)) {
750
+ return false;
751
+ }
752
+ const existing_recordId = existing.recordId;
753
+ const incoming_recordId = incoming.recordId;
754
+ if (!(existing_recordId === incoming_recordId)) {
755
+ return false;
756
+ }
757
+ const existing_recordName = existing.recordName;
758
+ const incoming_recordName = incoming.recordName;
759
+ if (!(existing_recordName === incoming_recordName)) {
760
+ return false;
761
+ }
762
+ return true;
763
+ }
764
+
765
+ const VERSION$2 = "2c249834bed42974b83ef01b3abacb2c";
766
+ function validate$2(obj, path = 'TagRecordAssignmentCollectionRepresentation') {
767
+ const v_error = (() => {
768
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
769
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
770
+ }
771
+ const obj_assignments = obj.assignments;
772
+ const path_assignments = path + '.assignments';
773
+ if (!ArrayIsArray(obj_assignments)) {
774
+ return new TypeError('Expected "array" but received "' + typeof obj_assignments + '" (at "' + path_assignments + '")');
775
+ }
776
+ for (let i = 0; i < obj_assignments.length; i++) {
777
+ const obj_assignments_item = obj_assignments[i];
778
+ const path_assignments_item = path_assignments + '[' + i + ']';
779
+ const referencepath_assignments_itemValidationError = validate$3(obj_assignments_item, path_assignments_item);
780
+ if (referencepath_assignments_itemValidationError !== null) {
781
+ let message = 'Object doesn\'t match TagRecordAssignment (at "' + path_assignments_item + '")\n';
782
+ message += referencepath_assignments_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
783
+ return new TypeError(message);
784
+ }
785
+ }
786
+ })();
787
+ return v_error === undefined ? null : v_error;
788
+ }
789
+ const RepresentationType$1 = 'TagRecordAssignmentCollectionRepresentation';
790
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
791
+ return input;
792
+ }
793
+ const select$5 = function TagRecordAssignmentCollectionRepresentationSelect() {
794
+ const { selections: TagRecordAssignment__selections, opaque: TagRecordAssignment__opaque, } = select$6();
795
+ return {
796
+ kind: 'Fragment',
797
+ version: VERSION$2,
798
+ private: [],
799
+ selections: [
800
+ {
801
+ name: 'assignments',
802
+ kind: 'Object',
803
+ plural: true,
804
+ selections: TagRecordAssignment__selections
805
+ }
806
+ ]
807
+ };
808
+ };
809
+ function equals$2(existing, incoming) {
810
+ const existing_assignments = existing.assignments;
811
+ const incoming_assignments = incoming.assignments;
812
+ const equals_assignments_items = equalsArray(existing_assignments, incoming_assignments, (existing_assignments_item, incoming_assignments_item) => {
813
+ if (!(equals$3(existing_assignments_item, incoming_assignments_item))) {
814
+ return false;
815
+ }
816
+ });
817
+ if (equals_assignments_items === false) {
818
+ return false;
819
+ }
820
+ return true;
821
+ }
822
+ const ingest$1 = function TagRecordAssignmentCollectionRepresentationIngest(input, path, luvio, store, timestamp) {
823
+ if (process.env.NODE_ENV !== 'production') {
824
+ const validateError = validate$2(input);
825
+ if (validateError !== null) {
826
+ throw validateError;
827
+ }
828
+ }
829
+ const key = path.fullPath;
830
+ const existingRecord = store.readEntry(key);
831
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
832
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
833
+ fullPath: key,
834
+ parent: path.parent,
835
+ propertyName: path.propertyName,
836
+ ttl: ttlToUse
837
+ });
838
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
839
+ luvio.storePublish(key, incomingRecord);
840
+ }
841
+ if (ttlToUse !== undefined) {
842
+ const storeMetadataParams = {
843
+ ttl: ttlToUse,
844
+ namespace: "interesttagging",
845
+ version: VERSION$2,
846
+ representationName: RepresentationType$1,
847
+ };
848
+ luvio.publishStoreMetadata(key, storeMetadataParams);
849
+ }
850
+ return createLink(key);
851
+ };
852
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
853
+ const rootKeySet = new StoreKeyMap();
854
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
855
+ const rootKey = fullPathFactory();
856
+ rootKeySet.set(rootKey, {
857
+ namespace: keyPrefix,
858
+ representationName: RepresentationType$1,
859
+ mergeable: false
860
+ });
861
+ return rootKeySet;
862
+ }
863
+
864
+ function select$4(luvio, params) {
865
+ return select$5();
866
+ }
867
+ function keyBuilder$5(luvio, params) {
868
+ return keyPrefix + '::TagRecordAssignmentCollectionRepresentation:(' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderBy:' + params.queryParams.orderBy + ',' + 'sort:' + params.queryParams.sort + ',' + 'tagId:' + params.urlParams.tagId + ')';
869
+ }
870
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
871
+ return getTypeCacheKeys$1(luvio, response, () => keyBuilder$5(luvio, resourceParams));
872
+ }
873
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
874
+ const { body } = response;
875
+ const key = keyBuilder$5(luvio, resourceParams);
876
+ luvio.storeIngest(key, ingest$1, body);
877
+ const snapshot = luvio.storeLookup({
878
+ recordId: key,
879
+ node: select$4(),
880
+ variables: {},
881
+ }, snapshotRefresh);
882
+ if (process.env.NODE_ENV !== 'production') {
883
+ if (snapshot.state !== 'Fulfilled') {
884
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
885
+ }
886
+ }
887
+ return snapshot;
888
+ }
889
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
890
+ const key = keyBuilder$5(luvio, params);
891
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
892
+ luvio.storeIngestError(key, errorSnapshot);
893
+ return errorSnapshot;
894
+ }
895
+ function createResourceRequest$2(config) {
896
+ const headers = {};
897
+ return {
898
+ baseUri: '/services/data/v58.0',
899
+ basePath: '/connect/interest-tags/assignments/tag/' + config.urlParams.tagId + '',
900
+ method: 'get',
901
+ body: null,
902
+ urlParams: config.urlParams,
903
+ queryParams: config.queryParams,
904
+ headers,
905
+ priority: 'normal',
906
+ };
907
+ }
908
+
909
+ const getInterestTagEntityAssignments_ConfigPropertyNames = {
910
+ displayName: 'getInterestTagEntityAssignments',
911
+ parameters: {
912
+ required: ['tagId'],
913
+ optional: ['limit', 'offset', 'orderBy', 'sort']
914
+ }
915
+ };
916
+ function createResourceParams$2(config) {
917
+ const resourceParams = {
918
+ urlParams: {
919
+ tagId: config.tagId
920
+ },
921
+ queryParams: {
922
+ limit: config.limit, offset: config.offset, orderBy: config.orderBy, sort: config.sort
923
+ }
924
+ };
925
+ return resourceParams;
926
+ }
927
+ function keyBuilder$4(luvio, config) {
928
+ const resourceParams = createResourceParams$2(config);
929
+ return keyBuilder$5(luvio, resourceParams);
930
+ }
931
+ function typeCheckConfig$2(untrustedConfig) {
932
+ const config = {};
933
+ const untrustedConfig_tagId = untrustedConfig.tagId;
934
+ if (typeof untrustedConfig_tagId === 'string') {
935
+ config.tagId = untrustedConfig_tagId;
936
+ }
937
+ const untrustedConfig_limit = untrustedConfig.limit;
938
+ if (typeof untrustedConfig_limit === 'number' && Math.floor(untrustedConfig_limit) === untrustedConfig_limit) {
939
+ config.limit = untrustedConfig_limit;
940
+ }
941
+ const untrustedConfig_offset = untrustedConfig.offset;
942
+ if (typeof untrustedConfig_offset === 'number' && Math.floor(untrustedConfig_offset) === untrustedConfig_offset) {
943
+ config.offset = untrustedConfig_offset;
944
+ }
945
+ const untrustedConfig_orderBy = untrustedConfig.orderBy;
946
+ if (typeof untrustedConfig_orderBy === 'string') {
947
+ config.orderBy = untrustedConfig_orderBy;
948
+ }
949
+ const untrustedConfig_sort = untrustedConfig.sort;
950
+ if (typeof untrustedConfig_sort === 'string') {
951
+ config.sort = untrustedConfig_sort;
952
+ }
953
+ return config;
954
+ }
955
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
956
+ if (!untrustedIsObject(untrustedConfig)) {
957
+ return null;
958
+ }
959
+ if (process.env.NODE_ENV !== 'production') {
960
+ validateConfig(untrustedConfig, configPropertyNames);
961
+ }
962
+ const config = typeCheckConfig$2(untrustedConfig);
963
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
964
+ return null;
965
+ }
966
+ return config;
967
+ }
968
+ function adapterFragment$2(luvio, config) {
969
+ createResourceParams$2(config);
970
+ return select$4();
971
+ }
972
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
973
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
974
+ config,
975
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
976
+ });
977
+ return luvio.storeBroadcast().then(() => snapshot);
978
+ }
979
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
980
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
981
+ config,
982
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
983
+ });
984
+ return luvio.storeBroadcast().then(() => snapshot);
985
+ }
986
+ function buildNetworkSnapshot$2(luvio, config, options) {
987
+ const resourceParams = createResourceParams$2(config);
988
+ const request = createResourceRequest$2(resourceParams);
989
+ return luvio.dispatchResourceRequest(request, options)
990
+ .then((response) => {
991
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
992
+ }, (response) => {
993
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
994
+ });
995
+ }
996
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
997
+ const { luvio, config } = context;
998
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
999
+ const dispatchOptions = {
1000
+ resourceRequestContext: {
1001
+ requestCorrelator,
1002
+ luvioRequestMethod: undefined,
1003
+ },
1004
+ eventObservers
1005
+ };
1006
+ if (networkPriority !== 'normal') {
1007
+ dispatchOptions.overrides = {
1008
+ priority: networkPriority
1009
+ };
1010
+ }
1011
+ return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
1012
+ }
1013
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
1014
+ const { luvio, config } = context;
1015
+ const selector = {
1016
+ recordId: keyBuilder$4(luvio, config),
1017
+ node: adapterFragment$2(luvio, config),
1018
+ variables: {},
1019
+ };
1020
+ const cacheSnapshot = storeLookup(selector, {
1021
+ config,
1022
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
1023
+ });
1024
+ return cacheSnapshot;
1025
+ }
1026
+ const getInterestTagEntityAssignmentsAdapterFactory = (luvio) => function interesttagging__getInterestTagEntityAssignments(untrustedConfig, requestContext) {
1027
+ const config = validateAdapterConfig$2(untrustedConfig, getInterestTagEntityAssignments_ConfigPropertyNames);
1028
+ // Invalid or incomplete config
1029
+ if (config === null) {
1030
+ return null;
1031
+ }
1032
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1033
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
1034
+ };
1035
+
1036
+ const VERSION$1 = "2dcce5f2b607682447018f5b9db9cd4d";
1037
+ function validate$1(obj, path = 'TagCategoryWithParentRepresentation') {
1038
+ const v_error = (() => {
1039
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1040
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1041
+ }
1042
+ const obj_categoryId = obj.categoryId;
1043
+ const path_categoryId = path + '.categoryId';
1044
+ if (typeof obj_categoryId !== 'string') {
1045
+ return new TypeError('Expected "string" but received "' + typeof obj_categoryId + '" (at "' + path_categoryId + '")');
1046
+ }
1047
+ const obj_icon = obj.icon;
1048
+ const path_icon = path + '.icon';
1049
+ if (typeof obj_icon !== 'string') {
1050
+ return new TypeError('Expected "string" but received "' + typeof obj_icon + '" (at "' + path_icon + '")');
1051
+ }
1052
+ const obj_name = obj.name;
1053
+ const path_name = path + '.name';
1054
+ if (typeof obj_name !== 'string') {
1055
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
1056
+ }
1057
+ const obj_parentCategoryId = obj.parentCategoryId;
1058
+ const path_parentCategoryId = path + '.parentCategoryId';
1059
+ if (typeof obj_parentCategoryId !== 'string') {
1060
+ return new TypeError('Expected "string" but received "' + typeof obj_parentCategoryId + '" (at "' + path_parentCategoryId + '")');
1061
+ }
1062
+ const obj_parentCategoryName = obj.parentCategoryName;
1063
+ const path_parentCategoryName = path + '.parentCategoryName';
1064
+ if (typeof obj_parentCategoryName !== 'string') {
1065
+ return new TypeError('Expected "string" but received "' + typeof obj_parentCategoryName + '" (at "' + path_parentCategoryName + '")');
1066
+ }
1067
+ const obj_tagCategoryAssignmentId = obj.tagCategoryAssignmentId;
1068
+ const path_tagCategoryAssignmentId = path + '.tagCategoryAssignmentId';
1069
+ if (typeof obj_tagCategoryAssignmentId !== 'string') {
1070
+ return new TypeError('Expected "string" but received "' + typeof obj_tagCategoryAssignmentId + '" (at "' + path_tagCategoryAssignmentId + '")');
1071
+ }
1072
+ })();
1073
+ return v_error === undefined ? null : v_error;
1074
+ }
1075
+ const select$3 = function TagCategoryWithParentRepresentationSelect() {
1076
+ return {
1077
+ kind: 'Fragment',
1078
+ version: VERSION$1,
1079
+ private: [],
1080
+ selections: [
1081
+ {
1082
+ name: 'categoryId',
1083
+ kind: 'Scalar'
1084
+ },
1085
+ {
1086
+ name: 'icon',
1087
+ kind: 'Scalar'
1088
+ },
1089
+ {
1090
+ name: 'name',
1091
+ kind: 'Scalar'
1092
+ },
1093
+ {
1094
+ name: 'parentCategoryId',
1095
+ kind: 'Scalar'
1096
+ },
1097
+ {
1098
+ name: 'parentCategoryName',
1099
+ kind: 'Scalar'
1100
+ },
1101
+ {
1102
+ name: 'tagCategoryAssignmentId',
1103
+ kind: 'Scalar'
1104
+ }
1105
+ ]
1106
+ };
1107
+ };
1108
+ function equals$1(existing, incoming) {
1109
+ const existing_categoryId = existing.categoryId;
1110
+ const incoming_categoryId = incoming.categoryId;
1111
+ if (!(existing_categoryId === incoming_categoryId)) {
1112
+ return false;
1113
+ }
1114
+ const existing_icon = existing.icon;
1115
+ const incoming_icon = incoming.icon;
1116
+ if (!(existing_icon === incoming_icon)) {
1117
+ return false;
1118
+ }
1119
+ const existing_name = existing.name;
1120
+ const incoming_name = incoming.name;
1121
+ if (!(existing_name === incoming_name)) {
1122
+ return false;
1123
+ }
1124
+ const existing_parentCategoryId = existing.parentCategoryId;
1125
+ const incoming_parentCategoryId = incoming.parentCategoryId;
1126
+ if (!(existing_parentCategoryId === incoming_parentCategoryId)) {
1127
+ return false;
1128
+ }
1129
+ const existing_parentCategoryName = existing.parentCategoryName;
1130
+ const incoming_parentCategoryName = incoming.parentCategoryName;
1131
+ if (!(existing_parentCategoryName === incoming_parentCategoryName)) {
1132
+ return false;
1133
+ }
1134
+ const existing_tagCategoryAssignmentId = existing.tagCategoryAssignmentId;
1135
+ const incoming_tagCategoryAssignmentId = incoming.tagCategoryAssignmentId;
1136
+ if (!(existing_tagCategoryAssignmentId === incoming_tagCategoryAssignmentId)) {
1137
+ return false;
1138
+ }
1139
+ return true;
1140
+ }
1141
+
1142
+ const VERSION = "9b56734fafb1d500056d1c1cdb6fe22d";
1143
+ function validate(obj, path = 'TagCategoryListRepresentation') {
1144
+ const v_error = (() => {
1145
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1146
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1147
+ }
1148
+ const obj_categories = obj.categories;
1149
+ const path_categories = path + '.categories';
1150
+ if (!ArrayIsArray(obj_categories)) {
1151
+ return new TypeError('Expected "array" but received "' + typeof obj_categories + '" (at "' + path_categories + '")');
1152
+ }
1153
+ for (let i = 0; i < obj_categories.length; i++) {
1154
+ const obj_categories_item = obj_categories[i];
1155
+ const path_categories_item = path_categories + '[' + i + ']';
1156
+ const referencepath_categories_itemValidationError = validate$1(obj_categories_item, path_categories_item);
1157
+ if (referencepath_categories_itemValidationError !== null) {
1158
+ let message = 'Object doesn\'t match TagCategoryWithParentRepresentation (at "' + path_categories_item + '")\n';
1159
+ message += referencepath_categories_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1160
+ return new TypeError(message);
1161
+ }
1162
+ }
1163
+ })();
1164
+ return v_error === undefined ? null : v_error;
1165
+ }
1166
+ const RepresentationType = 'TagCategoryListRepresentation';
1167
+ function normalize(input, existing, path, luvio, store, timestamp) {
1168
+ return input;
1169
+ }
1170
+ const select$2 = function TagCategoryListRepresentationSelect() {
1171
+ const { selections: TagCategoryWithParentRepresentation__selections, opaque: TagCategoryWithParentRepresentation__opaque, } = select$3();
1172
+ return {
1173
+ kind: 'Fragment',
1174
+ version: VERSION,
1175
+ private: [],
1176
+ selections: [
1177
+ {
1178
+ name: 'categories',
1179
+ kind: 'Object',
1180
+ plural: true,
1181
+ selections: TagCategoryWithParentRepresentation__selections
1182
+ }
1183
+ ]
1184
+ };
1185
+ };
1186
+ function equals(existing, incoming) {
1187
+ const existing_categories = existing.categories;
1188
+ const incoming_categories = incoming.categories;
1189
+ const equals_categories_items = equalsArray(existing_categories, incoming_categories, (existing_categories_item, incoming_categories_item) => {
1190
+ if (!(equals$1(existing_categories_item, incoming_categories_item))) {
1191
+ return false;
1192
+ }
1193
+ });
1194
+ if (equals_categories_items === false) {
1195
+ return false;
1196
+ }
1197
+ return true;
1198
+ }
1199
+ const ingest = function TagCategoryListRepresentationIngest(input, path, luvio, store, timestamp) {
1200
+ if (process.env.NODE_ENV !== 'production') {
1201
+ const validateError = validate(input);
1202
+ if (validateError !== null) {
1203
+ throw validateError;
1204
+ }
1205
+ }
1206
+ const key = path.fullPath;
1207
+ const existingRecord = store.readEntry(key);
1208
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
1209
+ let incomingRecord = normalize(input, store.readEntry(key), {
1210
+ fullPath: key,
1211
+ parent: path.parent,
1212
+ propertyName: path.propertyName,
1213
+ ttl: ttlToUse
1214
+ });
1215
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
1216
+ luvio.storePublish(key, incomingRecord);
1217
+ }
1218
+ if (ttlToUse !== undefined) {
1219
+ const storeMetadataParams = {
1220
+ ttl: ttlToUse,
1221
+ namespace: "interesttagging",
1222
+ version: VERSION,
1223
+ representationName: RepresentationType,
1224
+ };
1225
+ luvio.publishStoreMetadata(key, storeMetadataParams);
1226
+ }
1227
+ return createLink(key);
1228
+ };
1229
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
1230
+ const rootKeySet = new StoreKeyMap();
1231
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1232
+ const rootKey = fullPathFactory();
1233
+ rootKeySet.set(rootKey, {
1234
+ namespace: keyPrefix,
1235
+ representationName: RepresentationType,
1236
+ mergeable: false
1237
+ });
1238
+ return rootKeySet;
1239
+ }
1240
+
1241
+ function select$1(luvio, params) {
1242
+ return select$2();
1243
+ }
1244
+ function keyBuilder$3(luvio, params) {
1245
+ return keyPrefix + '::TagCategoryListRepresentation:(' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderBy:' + params.queryParams.orderBy + ',' + 'sort:' + params.queryParams.sort + ',' + 'tagId:' + params.queryParams.tagId + ')';
1246
+ }
1247
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
1248
+ return getTypeCacheKeys(luvio, response, () => keyBuilder$3(luvio, resourceParams));
1249
+ }
1250
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
1251
+ const { body } = response;
1252
+ const key = keyBuilder$3(luvio, resourceParams);
1253
+ luvio.storeIngest(key, ingest, body);
1254
+ const snapshot = luvio.storeLookup({
1255
+ recordId: key,
1256
+ node: select$1(),
1257
+ variables: {},
1258
+ }, snapshotRefresh);
1259
+ if (process.env.NODE_ENV !== 'production') {
1260
+ if (snapshot.state !== 'Fulfilled') {
1261
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1262
+ }
1263
+ }
1264
+ return snapshot;
1265
+ }
1266
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
1267
+ const key = keyBuilder$3(luvio, params);
1268
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1269
+ luvio.storeIngestError(key, errorSnapshot);
1270
+ return errorSnapshot;
1271
+ }
1272
+ function createResourceRequest$1(config) {
1273
+ const headers = {};
1274
+ return {
1275
+ baseUri: '/services/data/v58.0',
1276
+ basePath: '/connect/interest-tags/categories',
1277
+ method: 'get',
1278
+ body: null,
1279
+ urlParams: {},
1280
+ queryParams: config.queryParams,
1281
+ headers,
1282
+ priority: 'normal',
1283
+ };
1284
+ }
1285
+
1286
+ const getTagCategoriesByTagId_ConfigPropertyNames = {
1287
+ displayName: 'getTagCategoriesByTagId',
1288
+ parameters: {
1289
+ required: [],
1290
+ optional: ['limit', 'offset', 'orderBy', 'sort', 'tagId']
1291
+ }
1292
+ };
1293
+ function createResourceParams$1(config) {
1294
+ const resourceParams = {
1295
+ queryParams: {
1296
+ limit: config.limit, offset: config.offset, orderBy: config.orderBy, sort: config.sort, tagId: config.tagId
1297
+ }
1298
+ };
1299
+ return resourceParams;
1300
+ }
1301
+ function keyBuilder$2(luvio, config) {
1302
+ const resourceParams = createResourceParams$1(config);
1303
+ return keyBuilder$3(luvio, resourceParams);
1304
+ }
1305
+ function typeCheckConfig$1(untrustedConfig) {
1306
+ const config = {};
1307
+ const untrustedConfig_limit = untrustedConfig.limit;
1308
+ if (typeof untrustedConfig_limit === 'number' && Math.floor(untrustedConfig_limit) === untrustedConfig_limit) {
1309
+ config.limit = untrustedConfig_limit;
1310
+ }
1311
+ const untrustedConfig_offset = untrustedConfig.offset;
1312
+ if (typeof untrustedConfig_offset === 'number' && Math.floor(untrustedConfig_offset) === untrustedConfig_offset) {
1313
+ config.offset = untrustedConfig_offset;
1314
+ }
1315
+ const untrustedConfig_orderBy = untrustedConfig.orderBy;
1316
+ if (typeof untrustedConfig_orderBy === 'string') {
1317
+ config.orderBy = untrustedConfig_orderBy;
1318
+ }
1319
+ const untrustedConfig_sort = untrustedConfig.sort;
1320
+ if (typeof untrustedConfig_sort === 'string') {
1321
+ config.sort = untrustedConfig_sort;
1322
+ }
1323
+ const untrustedConfig_tagId = untrustedConfig.tagId;
1324
+ if (typeof untrustedConfig_tagId === 'string') {
1325
+ config.tagId = untrustedConfig_tagId;
1326
+ }
1327
+ return config;
1328
+ }
1329
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1330
+ if (!untrustedIsObject(untrustedConfig)) {
1331
+ return null;
1332
+ }
1333
+ if (process.env.NODE_ENV !== 'production') {
1334
+ validateConfig(untrustedConfig, configPropertyNames);
1335
+ }
1336
+ const config = typeCheckConfig$1(untrustedConfig);
1337
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1338
+ return null;
1339
+ }
1340
+ return config;
1341
+ }
1342
+ function adapterFragment$1(luvio, config) {
1343
+ createResourceParams$1(config);
1344
+ return select$1();
1345
+ }
1346
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
1347
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
1348
+ config,
1349
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1350
+ });
1351
+ return luvio.storeBroadcast().then(() => snapshot);
1352
+ }
1353
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
1354
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
1355
+ config,
1356
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1357
+ });
1358
+ return luvio.storeBroadcast().then(() => snapshot);
1359
+ }
1360
+ function buildNetworkSnapshot$1(luvio, config, options) {
1361
+ const resourceParams = createResourceParams$1(config);
1362
+ const request = createResourceRequest$1(resourceParams);
1363
+ return luvio.dispatchResourceRequest(request, options)
1364
+ .then((response) => {
1365
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
1366
+ }, (response) => {
1367
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
1368
+ });
1369
+ }
1370
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
1371
+ const { luvio, config } = context;
1372
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1373
+ const dispatchOptions = {
1374
+ resourceRequestContext: {
1375
+ requestCorrelator,
1376
+ luvioRequestMethod: undefined,
1377
+ },
1378
+ eventObservers
1379
+ };
1380
+ if (networkPriority !== 'normal') {
1381
+ dispatchOptions.overrides = {
1382
+ priority: networkPriority
1383
+ };
1384
+ }
1385
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
1386
+ }
1387
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
1388
+ const { luvio, config } = context;
1389
+ const selector = {
1390
+ recordId: keyBuilder$2(luvio, config),
1391
+ node: adapterFragment$1(luvio, config),
1392
+ variables: {},
1393
+ };
1394
+ const cacheSnapshot = storeLookup(selector, {
1395
+ config,
1396
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
1397
+ });
1398
+ return cacheSnapshot;
1399
+ }
1400
+ const getTagCategoriesByTagIdAdapterFactory = (luvio) => function interesttagging__getTagCategoriesByTagId(untrustedConfig, requestContext) {
1401
+ const config = validateAdapterConfig$1(untrustedConfig, getTagCategoriesByTagId_ConfigPropertyNames);
1402
+ // Invalid or incomplete config
1403
+ if (config === null) {
1404
+ return null;
1405
+ }
1406
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1407
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
1408
+ };
1409
+
1410
+ function select(luvio, params) {
1411
+ return select$8();
1412
+ }
1413
+ function keyBuilder$1(luvio, params) {
1414
+ return keyPrefix + '::InterestTagListRepresentation:(' + 'categoryId:' + params.queryParams.categoryId + ',' + 'limit:' + params.queryParams.limit + ',' + 'offset:' + params.queryParams.offset + ',' + 'orderBy:' + params.queryParams.orderBy + ',' + 'sort:' + params.queryParams.sort + ')';
1415
+ }
1416
+ function getResponseCacheKeys(luvio, resourceParams, response) {
1417
+ return getTypeCacheKeys$2(luvio, response, () => keyBuilder$1(luvio, resourceParams));
1418
+ }
1419
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1420
+ const { body } = response;
1421
+ const key = keyBuilder$1(luvio, resourceParams);
1422
+ luvio.storeIngest(key, ingest$2, body);
1423
+ const snapshot = luvio.storeLookup({
1424
+ recordId: key,
1425
+ node: select(),
1426
+ variables: {},
1427
+ }, snapshotRefresh);
1428
+ if (process.env.NODE_ENV !== 'production') {
1429
+ if (snapshot.state !== 'Fulfilled') {
1430
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1431
+ }
1432
+ }
1433
+ return snapshot;
1434
+ }
1435
+ function ingestError(luvio, params, error, snapshotRefresh) {
1436
+ const key = keyBuilder$1(luvio, params);
1437
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1438
+ const storeMetadataParams = {
1439
+ ttl: TTL,
1440
+ namespace: keyPrefix,
1441
+ version: VERSION$4,
1442
+ representationName: RepresentationType$2
1443
+ };
1444
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1445
+ return errorSnapshot;
1446
+ }
1447
+ function createResourceRequest(config) {
1448
+ const headers = {};
1449
+ return {
1450
+ baseUri: '/services/data/v58.0',
1451
+ basePath: '/connect/interest-tags/tags',
1452
+ method: 'get',
1453
+ body: null,
1454
+ urlParams: {},
1455
+ queryParams: config.queryParams,
1456
+ headers,
1457
+ priority: 'normal',
1458
+ };
1459
+ }
1460
+
1461
+ const getTagsByCategoryId_ConfigPropertyNames = {
1462
+ displayName: 'getTagsByCategoryId',
1463
+ parameters: {
1464
+ required: [],
1465
+ optional: ['categoryId', 'limit', 'offset', 'orderBy', 'sort']
1466
+ }
1467
+ };
1468
+ function createResourceParams(config) {
1469
+ const resourceParams = {
1470
+ queryParams: {
1471
+ categoryId: config.categoryId, limit: config.limit, offset: config.offset, orderBy: config.orderBy, sort: config.sort
1472
+ }
1473
+ };
1474
+ return resourceParams;
1475
+ }
1476
+ function keyBuilder(luvio, config) {
1477
+ const resourceParams = createResourceParams(config);
1478
+ return keyBuilder$1(luvio, resourceParams);
1479
+ }
1480
+ function typeCheckConfig(untrustedConfig) {
1481
+ const config = {};
1482
+ const untrustedConfig_categoryId = untrustedConfig.categoryId;
1483
+ if (typeof untrustedConfig_categoryId === 'string') {
1484
+ config.categoryId = untrustedConfig_categoryId;
1485
+ }
1486
+ const untrustedConfig_limit = untrustedConfig.limit;
1487
+ if (typeof untrustedConfig_limit === 'number' && Math.floor(untrustedConfig_limit) === untrustedConfig_limit) {
1488
+ config.limit = untrustedConfig_limit;
1489
+ }
1490
+ const untrustedConfig_offset = untrustedConfig.offset;
1491
+ if (typeof untrustedConfig_offset === 'number' && Math.floor(untrustedConfig_offset) === untrustedConfig_offset) {
1492
+ config.offset = untrustedConfig_offset;
1493
+ }
1494
+ const untrustedConfig_orderBy = untrustedConfig.orderBy;
1495
+ if (typeof untrustedConfig_orderBy === 'string') {
1496
+ config.orderBy = untrustedConfig_orderBy;
1497
+ }
1498
+ const untrustedConfig_sort = untrustedConfig.sort;
1499
+ if (typeof untrustedConfig_sort === 'string') {
1500
+ config.sort = untrustedConfig_sort;
1501
+ }
1502
+ return config;
1503
+ }
1504
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1505
+ if (!untrustedIsObject(untrustedConfig)) {
1506
+ return null;
1507
+ }
1508
+ if (process.env.NODE_ENV !== 'production') {
1509
+ validateConfig(untrustedConfig, configPropertyNames);
1510
+ }
1511
+ const config = typeCheckConfig(untrustedConfig);
1512
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1513
+ return null;
1514
+ }
1515
+ return config;
1516
+ }
1517
+ function adapterFragment(luvio, config) {
1518
+ createResourceParams(config);
1519
+ return select();
1520
+ }
1521
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1522
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1523
+ config,
1524
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1525
+ });
1526
+ return luvio.storeBroadcast().then(() => snapshot);
1527
+ }
1528
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1529
+ const snapshot = ingestError(luvio, resourceParams, response, {
1530
+ config,
1531
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1532
+ });
1533
+ return luvio.storeBroadcast().then(() => snapshot);
1534
+ }
1535
+ function buildNetworkSnapshot(luvio, config, options) {
1536
+ const resourceParams = createResourceParams(config);
1537
+ const request = createResourceRequest(resourceParams);
1538
+ return luvio.dispatchResourceRequest(request, options)
1539
+ .then((response) => {
1540
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
1541
+ }, (response) => {
1542
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1543
+ });
1544
+ }
1545
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1546
+ const { luvio, config } = context;
1547
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1548
+ const dispatchOptions = {
1549
+ resourceRequestContext: {
1550
+ requestCorrelator,
1551
+ luvioRequestMethod: undefined,
1552
+ },
1553
+ eventObservers
1554
+ };
1555
+ if (networkPriority !== 'normal') {
1556
+ dispatchOptions.overrides = {
1557
+ priority: networkPriority
1558
+ };
1559
+ }
1560
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
1561
+ }
1562
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1563
+ const { luvio, config } = context;
1564
+ const selector = {
1565
+ recordId: keyBuilder(luvio, config),
1566
+ node: adapterFragment(luvio, config),
1567
+ variables: {},
1568
+ };
1569
+ const cacheSnapshot = storeLookup(selector, {
1570
+ config,
1571
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1572
+ });
1573
+ return cacheSnapshot;
1574
+ }
1575
+ const getTagsByCategoryIdAdapterFactory = (luvio) => function interesttagging__getTagsByCategoryId(untrustedConfig, requestContext) {
1576
+ const config = validateAdapterConfig(untrustedConfig, getTagsByCategoryId_ConfigPropertyNames);
1577
+ // Invalid or incomplete config
1578
+ if (config === null) {
1579
+ return null;
1580
+ }
1581
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1582
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1583
+ };
1584
+
1585
+ export { createInterestTagEntityAssignmentAdapterFactory, getInterestTagEntityAssignmentsAdapterFactory, getTagCategoriesByTagIdAdapterFactory, getTagsByCategoryIdAdapterFactory, getTagsByRecordIdAdapterFactory };