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