@salesforce/lds-adapters-industries-context 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 (122) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-context.js +4038 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/createContextAttribute.d.ts +15 -0
  5. package/dist/types/src/generated/adapters/createContextDefinition.d.ts +15 -0
  6. package/dist/types/src/generated/adapters/createContextDefinitionVersion.d.ts +15 -0
  7. package/dist/types/src/generated/adapters/createContextNode.d.ts +15 -0
  8. package/dist/types/src/generated/adapters/deleteContextAttribute.d.ts +13 -0
  9. package/dist/types/src/generated/adapters/deleteContextDefinition.d.ts +13 -0
  10. package/dist/types/src/generated/adapters/deleteContextDefinitionVersion.d.ts +13 -0
  11. package/dist/types/src/generated/adapters/deleteContextNode.d.ts +13 -0
  12. package/dist/types/src/generated/adapters/getContextAttribute.d.ts +27 -0
  13. package/dist/types/src/generated/adapters/getContextDefinition.d.ts +27 -0
  14. package/dist/types/src/generated/adapters/getContextDefinitionInfo.d.ts +27 -0
  15. package/dist/types/src/generated/adapters/getContextDefinitionList.d.ts +25 -0
  16. package/dist/types/src/generated/adapters/getContextDefinitionVersion.d.ts +27 -0
  17. package/dist/types/src/generated/adapters/getContextNode.d.ts +27 -0
  18. package/dist/types/src/generated/adapters/updateContextAttribute.d.ts +16 -0
  19. package/dist/types/src/generated/adapters/updateContextDefinition.d.ts +16 -0
  20. package/dist/types/src/generated/adapters/updateContextDefinitionVersion.d.ts +16 -0
  21. package/dist/types/src/generated/adapters/updateContextNode.d.ts +16 -0
  22. package/dist/types/src/generated/artifacts/main.d.ts +18 -0
  23. package/dist/types/src/generated/artifacts/sfdc.d.ts +30 -0
  24. package/dist/types/src/generated/resources/deleteConnectContextByContextId.d.ts +11 -0
  25. package/dist/types/src/generated/resources/deleteConnectContextInputschemaByContextInputSchemaId.d.ts +11 -0
  26. package/dist/types/src/generated/resources/deleteConnectContextdefinitionAttributenodeByContextAttributeId.d.ts +12 -0
  27. package/dist/types/src/generated/resources/deleteConnectContextdefinitionAttributetagByContextAttributeTagId.d.ts +9 -0
  28. package/dist/types/src/generated/resources/deleteConnectContextdefinitionByContextDefinitionId.d.ts +12 -0
  29. package/dist/types/src/generated/resources/deleteConnectContextdefinitionNodeByContextNodeId.d.ts +12 -0
  30. package/dist/types/src/generated/resources/deleteConnectContextdefinitionVersionByContextDefinitionVersionId.d.ts +12 -0
  31. package/dist/types/src/generated/resources/deleteConnectContextmappingAttributenodeByContextAttributeMappingId.d.ts +11 -0
  32. package/dist/types/src/generated/resources/deleteConnectContextmappingByContextMappingId.d.ts +11 -0
  33. package/dist/types/src/generated/resources/deleteConnectContextmappingNodeByContextNodeMappingId.d.ts +11 -0
  34. package/dist/types/src/generated/resources/getConnectContextByContextId.d.ts +15 -0
  35. package/dist/types/src/generated/resources/getConnectContextInputschemaAttributenodeByContextInputAttributeId.d.ts +15 -0
  36. package/dist/types/src/generated/resources/getConnectContextInputschemaByContextInputSchemaId.d.ts +15 -0
  37. package/dist/types/src/generated/resources/getConnectContextInputschemaNodeByContextInputNodeId.d.ts +15 -0
  38. package/dist/types/src/generated/resources/getConnectContextdefinition.d.ts +12 -0
  39. package/dist/types/src/generated/resources/getConnectContextdefinitionAttributenodeByContextAttributeId.d.ts +16 -0
  40. package/dist/types/src/generated/resources/getConnectContextdefinitionAttributenodeTagsByContextAttributeId.d.ts +15 -0
  41. package/dist/types/src/generated/resources/getConnectContextdefinitionByContextDefinitionId.d.ts +16 -0
  42. package/dist/types/src/generated/resources/getConnectContextdefinitionInfoByContextDefinitionId.d.ts +16 -0
  43. package/dist/types/src/generated/resources/getConnectContextdefinitionNodeByContextNodeId.d.ts +16 -0
  44. package/dist/types/src/generated/resources/getConnectContextdefinitionVersionByContextDefinitionVersionId.d.ts +16 -0
  45. package/dist/types/src/generated/resources/getConnectContextmappingAttributenodeByContextAttributeMappingId.d.ts +15 -0
  46. package/dist/types/src/generated/resources/getConnectContextmappingByContextMappingId.d.ts +15 -0
  47. package/dist/types/src/generated/resources/getConnectContextmappingHydrationdetailByContextAttrHydrationDetailId.d.ts +15 -0
  48. package/dist/types/src/generated/resources/getConnectContextmappingNodeByContextNodeMappingId.d.ts +15 -0
  49. package/dist/types/src/generated/resources/patchConnectContextdefinitionAttributenodeByContextAttributeId.d.ts +16 -0
  50. package/dist/types/src/generated/resources/patchConnectContextdefinitionAttributetagByContextAttributeTagId.d.ts +17 -0
  51. package/dist/types/src/generated/resources/patchConnectContextdefinitionByContextDefinitionId.d.ts +16 -0
  52. package/dist/types/src/generated/resources/patchConnectContextdefinitionNodeByContextNodeId.d.ts +16 -0
  53. package/dist/types/src/generated/resources/patchConnectContextdefinitionVersionByContextDefinitionVersionId.d.ts +16 -0
  54. package/dist/types/src/generated/resources/patchConnectContextmappingAttributenodeByContextAttributeMappingId.d.ts +16 -0
  55. package/dist/types/src/generated/resources/patchConnectContextmappingByContextMappingId.d.ts +15 -0
  56. package/dist/types/src/generated/resources/patchConnectContextmappingNodeByContextNodeMappingId.d.ts +17 -0
  57. package/dist/types/src/generated/resources/postConnectContext.d.ts +13 -0
  58. package/dist/types/src/generated/resources/postConnectContextAttributeByContextId.d.ts +17 -0
  59. package/dist/types/src/generated/resources/postConnectContextClearByContextId.d.ts +15 -0
  60. package/dist/types/src/generated/resources/postConnectContextCloneByContextId.d.ts +12 -0
  61. package/dist/types/src/generated/resources/postConnectContextHydrateByContextId.d.ts +15 -0
  62. package/dist/types/src/generated/resources/postConnectContextInputschema.d.ts +14 -0
  63. package/dist/types/src/generated/resources/postConnectContextQueryByContextId.d.ts +21 -0
  64. package/dist/types/src/generated/resources/postConnectContextdefinition.d.ts +13 -0
  65. package/dist/types/src/generated/resources/postConnectContextdefinitionAttributenode.d.ts +13 -0
  66. package/dist/types/src/generated/resources/postConnectContextdefinitionAttributetag.d.ts +14 -0
  67. package/dist/types/src/generated/resources/postConnectContextdefinitionNode.d.ts +13 -0
  68. package/dist/types/src/generated/resources/postConnectContextdefinitionVersion.d.ts +13 -0
  69. package/dist/types/src/generated/resources/postConnectContextmapping.d.ts +15 -0
  70. package/dist/types/src/generated/resources/postConnectContextmappingAttributenode.d.ts +16 -0
  71. package/dist/types/src/generated/resources/postConnectContextmappingHydrationdetail.d.ts +15 -0
  72. package/dist/types/src/generated/resources/postConnectContextmappingNode.d.ts +17 -0
  73. package/dist/types/src/generated/types/BusinessObjectTypeStructureInputRepresentation.d.ts +41 -0
  74. package/dist/types/src/generated/types/ClearContextNodesInputRepresentation.d.ts +29 -0
  75. package/dist/types/src/generated/types/ContextAttrHydrationDetailInputRepresentation.d.ts +38 -0
  76. package/dist/types/src/generated/types/ContextAttrHydrationDetailRepresentation.d.ts +44 -0
  77. package/dist/types/src/generated/types/ContextAttributeInputRepresentation.d.ts +50 -0
  78. package/dist/types/src/generated/types/ContextAttributeInputWrapperRepresentation.d.ts +29 -0
  79. package/dist/types/src/generated/types/ContextAttributeMappingInputRepresentation.d.ts +41 -0
  80. package/dist/types/src/generated/types/ContextAttributeMappingRepresentation.d.ts +48 -0
  81. package/dist/types/src/generated/types/ContextAttributeRepresentation.d.ts +76 -0
  82. package/dist/types/src/generated/types/ContextAttributeTagInputRepresentation.d.ts +35 -0
  83. package/dist/types/src/generated/types/ContextAttributeTagListRepresentation.d.ts +42 -0
  84. package/dist/types/src/generated/types/ContextAttributeTagRepresentation.d.ts +51 -0
  85. package/dist/types/src/generated/types/ContextDataRecordRepresentation.d.ts +60 -0
  86. package/dist/types/src/generated/types/ContextDefinitionInfoRepresentation.d.ts +51 -0
  87. package/dist/types/src/generated/types/ContextDefinitionInputRepresentation.d.ts +35 -0
  88. package/dist/types/src/generated/types/ContextDefinitionInputWrapperRepresentation.d.ts +29 -0
  89. package/dist/types/src/generated/types/ContextDefinitionListRepresentation.d.ts +43 -0
  90. package/dist/types/src/generated/types/ContextDefinitionRepresentation.d.ts +64 -0
  91. package/dist/types/src/generated/types/ContextDefinitionVersionInputRepresentation.d.ts +50 -0
  92. package/dist/types/src/generated/types/ContextDefinitionVersionInputWrapperRepresentation.d.ts +29 -0
  93. package/dist/types/src/generated/types/ContextDefinitionVersionRepresentation.d.ts +71 -0
  94. package/dist/types/src/generated/types/ContextHydrationInfoInputRepresentation.d.ts +29 -0
  95. package/dist/types/src/generated/types/ContextInfoRepresentation.d.ts +38 -0
  96. package/dist/types/src/generated/types/ContextInputAttributeRepresentation.d.ts +41 -0
  97. package/dist/types/src/generated/types/ContextInputNodeRepresentation.d.ts +48 -0
  98. package/dist/types/src/generated/types/ContextInputRepresentation.d.ts +32 -0
  99. package/dist/types/src/generated/types/ContextInputSchemaInputRepresentation.d.ts +35 -0
  100. package/dist/types/src/generated/types/ContextInputSchemaRepresentation.d.ts +42 -0
  101. package/dist/types/src/generated/types/ContextMappingInputRepresentation.d.ts +38 -0
  102. package/dist/types/src/generated/types/ContextMappingRepresentation.d.ts +55 -0
  103. package/dist/types/src/generated/types/ContextMetaDataInputRepresentation.d.ts +38 -0
  104. package/dist/types/src/generated/types/ContextNodeInputRepresentation.d.ts +44 -0
  105. package/dist/types/src/generated/types/ContextNodeInputWrapperRepresentation.d.ts +29 -0
  106. package/dist/types/src/generated/types/ContextNodeMappingInputRepresentation.d.ts +44 -0
  107. package/dist/types/src/generated/types/ContextNodeMappingRepresentation.d.ts +51 -0
  108. package/dist/types/src/generated/types/ContextNodeRepresentation.d.ts +65 -0
  109. package/dist/types/src/generated/types/ContextOutputRepresentation.d.ts +29 -0
  110. package/dist/types/src/generated/types/ContextQueryRecordRepresentation.d.ts +33 -0
  111. package/dist/types/src/generated/types/ContextQueryResultRepresentation.d.ts +36 -0
  112. package/dist/types/src/generated/types/NodePathAndAttributesInputRepresentation.d.ts +36 -0
  113. package/dist/types/src/generated/types/QueryContextInputRepresentation.d.ts +45 -0
  114. package/dist/types/src/generated/types/UpdateContextAttributesInputRepresentation.d.ts +33 -0
  115. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  116. package/dist/umd/es2018/industries-context.js +4063 -0
  117. package/dist/umd/es5/industries-context.js +4078 -0
  118. package/package.json +68 -0
  119. package/sfdc/index.d.ts +1 -0
  120. package/sfdc/index.js +4349 -0
  121. package/src/raml/api.raml +1506 -0
  122. package/src/raml/luvio.raml +133 -0
@@ -0,0 +1,4038 @@
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 = 'IndustriesContext';
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$8(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$8(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$8(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$6 = 30000;
94
+ const VERSION$6 = "5ded6ac11eaf95f0422141c310d984e3";
95
+ function validate$e(obj, path = 'ContextDefinitionInfoRepresentation') {
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
+ if (obj.activeVersionId !== undefined) {
101
+ const obj_activeVersionId = obj.activeVersionId;
102
+ const path_activeVersionId = path + '.activeVersionId';
103
+ if (typeof obj_activeVersionId !== 'string') {
104
+ return new TypeError('Expected "string" but received "' + typeof obj_activeVersionId + '" (at "' + path_activeVersionId + '")');
105
+ }
106
+ }
107
+ const obj_contextDefinitionId = obj.contextDefinitionId;
108
+ const path_contextDefinitionId = path + '.contextDefinitionId';
109
+ if (typeof obj_contextDefinitionId !== 'string') {
110
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionId + '" (at "' + path_contextDefinitionId + '")');
111
+ }
112
+ const obj_definition = obj.definition;
113
+ const path_definition = path + '.definition';
114
+ if (typeof obj_definition !== 'string') {
115
+ return new TypeError('Expected "string" but received "' + typeof obj_definition + '" (at "' + path_definition + '")');
116
+ }
117
+ const obj_description = obj.description;
118
+ const path_description = path + '.description';
119
+ if (typeof obj_description !== 'string') {
120
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
121
+ }
122
+ if (obj.isSuccess !== undefined) {
123
+ const obj_isSuccess = obj.isSuccess;
124
+ const path_isSuccess = path + '.isSuccess';
125
+ if (typeof obj_isSuccess !== 'boolean') {
126
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
127
+ }
128
+ }
129
+ })();
130
+ return v_error === undefined ? null : v_error;
131
+ }
132
+ const RepresentationType$6 = 'ContextDefinitionInfoRepresentation';
133
+ function keyBuilder$l(luvio, config) {
134
+ return keyPrefix + '::' + RepresentationType$6 + ':' + config.id;
135
+ }
136
+ function keyBuilderFromType$5(luvio, object) {
137
+ const keyParams = {
138
+ id: object.contextDefinitionId
139
+ };
140
+ return keyBuilder$l(luvio, keyParams);
141
+ }
142
+ function normalize$6(input, existing, path, luvio, store, timestamp) {
143
+ return input;
144
+ }
145
+ const select$k = function ContextDefinitionInfoRepresentationSelect() {
146
+ return {
147
+ kind: 'Fragment',
148
+ version: VERSION$6,
149
+ private: [],
150
+ selections: [
151
+ {
152
+ name: 'activeVersionId',
153
+ kind: 'Scalar',
154
+ required: false
155
+ },
156
+ {
157
+ name: 'contextDefinitionId',
158
+ kind: 'Scalar'
159
+ },
160
+ {
161
+ name: 'definition',
162
+ kind: 'Scalar'
163
+ },
164
+ {
165
+ name: 'description',
166
+ kind: 'Scalar'
167
+ },
168
+ {
169
+ name: 'isSuccess',
170
+ kind: 'Scalar',
171
+ required: false
172
+ }
173
+ ]
174
+ };
175
+ };
176
+ function equals$6(existing, incoming) {
177
+ const existing_isSuccess = existing.isSuccess;
178
+ const incoming_isSuccess = incoming.isSuccess;
179
+ // if at least one of these optionals is defined
180
+ if (existing_isSuccess !== undefined || incoming_isSuccess !== undefined) {
181
+ // if one of these is not defined we know the other is defined and therefore
182
+ // not equal
183
+ if (existing_isSuccess === undefined || incoming_isSuccess === undefined) {
184
+ return false;
185
+ }
186
+ if (!(existing_isSuccess === incoming_isSuccess)) {
187
+ return false;
188
+ }
189
+ }
190
+ const existing_activeVersionId = existing.activeVersionId;
191
+ const incoming_activeVersionId = incoming.activeVersionId;
192
+ // if at least one of these optionals is defined
193
+ if (existing_activeVersionId !== undefined || incoming_activeVersionId !== undefined) {
194
+ // if one of these is not defined we know the other is defined and therefore
195
+ // not equal
196
+ if (existing_activeVersionId === undefined || incoming_activeVersionId === undefined) {
197
+ return false;
198
+ }
199
+ if (!(existing_activeVersionId === incoming_activeVersionId)) {
200
+ return false;
201
+ }
202
+ }
203
+ const existing_contextDefinitionId = existing.contextDefinitionId;
204
+ const incoming_contextDefinitionId = incoming.contextDefinitionId;
205
+ if (!(existing_contextDefinitionId === incoming_contextDefinitionId)) {
206
+ return false;
207
+ }
208
+ const existing_definition = existing.definition;
209
+ const incoming_definition = incoming.definition;
210
+ if (!(existing_definition === incoming_definition)) {
211
+ return false;
212
+ }
213
+ const existing_description = existing.description;
214
+ const incoming_description = incoming.description;
215
+ if (!(existing_description === incoming_description)) {
216
+ return false;
217
+ }
218
+ return true;
219
+ }
220
+ const ingest$6 = function ContextDefinitionInfoRepresentationIngest(input, path, luvio, store, timestamp) {
221
+ if (process.env.NODE_ENV !== 'production') {
222
+ const validateError = validate$e(input);
223
+ if (validateError !== null) {
224
+ throw validateError;
225
+ }
226
+ }
227
+ const key = keyBuilderFromType$5(luvio, input);
228
+ const existingRecord = store.readEntry(key);
229
+ const ttlToUse = TTL$6;
230
+ let incomingRecord = normalize$6(input, store.readEntry(key), {
231
+ fullPath: key,
232
+ parent: path.parent,
233
+ propertyName: path.propertyName,
234
+ ttl: ttlToUse
235
+ });
236
+ if (existingRecord === undefined || equals$6(existingRecord, incomingRecord) === false) {
237
+ luvio.storePublish(key, incomingRecord);
238
+ }
239
+ {
240
+ const storeMetadataParams = {
241
+ ttl: ttlToUse,
242
+ namespace: "IndustriesContext",
243
+ version: VERSION$6,
244
+ representationName: RepresentationType$6,
245
+ };
246
+ luvio.publishStoreMetadata(key, storeMetadataParams);
247
+ }
248
+ return createLink(key);
249
+ };
250
+ function getTypeCacheKeys$6(luvio, input, fullPathFactory) {
251
+ const rootKeySet = new StoreKeyMap();
252
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
253
+ const rootKey = keyBuilderFromType$5(luvio, input);
254
+ rootKeySet.set(rootKey, {
255
+ namespace: keyPrefix,
256
+ representationName: RepresentationType$6,
257
+ mergeable: false
258
+ });
259
+ return rootKeySet;
260
+ }
261
+
262
+ const TTL$5 = 10000;
263
+ const VERSION$5 = "4eaf7936c751a49821abb04c4e57d921";
264
+ function validate$d(obj, path = 'ContextDefinitionListRepresentation') {
265
+ const v_error = (() => {
266
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
267
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
268
+ }
269
+ const obj_contextDefinitionList = obj.contextDefinitionList;
270
+ const path_contextDefinitionList = path + '.contextDefinitionList';
271
+ if (!ArrayIsArray(obj_contextDefinitionList)) {
272
+ return new TypeError('Expected "array" but received "' + typeof obj_contextDefinitionList + '" (at "' + path_contextDefinitionList + '")');
273
+ }
274
+ for (let i = 0; i < obj_contextDefinitionList.length; i++) {
275
+ const obj_contextDefinitionList_item = obj_contextDefinitionList[i];
276
+ const path_contextDefinitionList_item = path_contextDefinitionList + '[' + i + ']';
277
+ if (typeof obj_contextDefinitionList_item !== 'object') {
278
+ return new TypeError('Expected "object" but received "' + typeof obj_contextDefinitionList_item + '" (at "' + path_contextDefinitionList_item + '")');
279
+ }
280
+ }
281
+ const obj_isSuccess = obj.isSuccess;
282
+ const path_isSuccess = path + '.isSuccess';
283
+ if (typeof obj_isSuccess !== 'boolean') {
284
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
285
+ }
286
+ })();
287
+ return v_error === undefined ? null : v_error;
288
+ }
289
+ const RepresentationType$5 = 'ContextDefinitionListRepresentation';
290
+ function normalize$5(input, existing, path, luvio, store, timestamp) {
291
+ const input_contextDefinitionList = input.contextDefinitionList;
292
+ const input_contextDefinitionList_id = path.fullPath + '__contextDefinitionList';
293
+ for (let i = 0; i < input_contextDefinitionList.length; i++) {
294
+ const input_contextDefinitionList_item = input_contextDefinitionList[i];
295
+ let input_contextDefinitionList_item_id = input_contextDefinitionList_id + '__' + i;
296
+ input_contextDefinitionList[i] = ingest$6(input_contextDefinitionList_item, {
297
+ fullPath: input_contextDefinitionList_item_id,
298
+ propertyName: i,
299
+ parent: {
300
+ data: input,
301
+ key: path.fullPath,
302
+ existing: existing,
303
+ },
304
+ ttl: path.ttl
305
+ }, luvio, store);
306
+ }
307
+ return input;
308
+ }
309
+ const select$j = function ContextDefinitionListRepresentationSelect() {
310
+ return {
311
+ kind: 'Fragment',
312
+ version: VERSION$5,
313
+ private: [],
314
+ selections: [
315
+ {
316
+ name: 'contextDefinitionList',
317
+ kind: 'Link',
318
+ plural: true,
319
+ fragment: select$k()
320
+ },
321
+ {
322
+ name: 'isSuccess',
323
+ kind: 'Scalar'
324
+ }
325
+ ]
326
+ };
327
+ };
328
+ function equals$5(existing, incoming) {
329
+ const existing_isSuccess = existing.isSuccess;
330
+ const incoming_isSuccess = incoming.isSuccess;
331
+ if (!(existing_isSuccess === incoming_isSuccess)) {
332
+ return false;
333
+ }
334
+ const existing_contextDefinitionList = existing.contextDefinitionList;
335
+ const incoming_contextDefinitionList = incoming.contextDefinitionList;
336
+ const equals_contextDefinitionList_items = equalsArray(existing_contextDefinitionList, incoming_contextDefinitionList, (existing_contextDefinitionList_item, incoming_contextDefinitionList_item) => {
337
+ if (!(existing_contextDefinitionList_item.__ref === incoming_contextDefinitionList_item.__ref)) {
338
+ return false;
339
+ }
340
+ });
341
+ if (equals_contextDefinitionList_items === false) {
342
+ return false;
343
+ }
344
+ return true;
345
+ }
346
+ const ingest$5 = function ContextDefinitionListRepresentationIngest(input, path, luvio, store, timestamp) {
347
+ if (process.env.NODE_ENV !== 'production') {
348
+ const validateError = validate$d(input);
349
+ if (validateError !== null) {
350
+ throw validateError;
351
+ }
352
+ }
353
+ const key = path.fullPath;
354
+ const existingRecord = store.readEntry(key);
355
+ const ttlToUse = TTL$5;
356
+ let incomingRecord = normalize$5(input, store.readEntry(key), {
357
+ fullPath: key,
358
+ parent: path.parent,
359
+ propertyName: path.propertyName,
360
+ ttl: ttlToUse
361
+ }, luvio, store);
362
+ if (existingRecord === undefined || equals$5(existingRecord, incomingRecord) === false) {
363
+ luvio.storePublish(key, incomingRecord);
364
+ }
365
+ {
366
+ const storeMetadataParams = {
367
+ ttl: ttlToUse,
368
+ namespace: "IndustriesContext",
369
+ version: VERSION$5,
370
+ representationName: RepresentationType$5,
371
+ };
372
+ luvio.publishStoreMetadata(key, storeMetadataParams);
373
+ }
374
+ return createLink(key);
375
+ };
376
+ function getTypeCacheKeys$5(luvio, input, fullPathFactory) {
377
+ const rootKeySet = new StoreKeyMap();
378
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
379
+ const rootKey = fullPathFactory();
380
+ rootKeySet.set(rootKey, {
381
+ namespace: keyPrefix,
382
+ representationName: RepresentationType$5,
383
+ mergeable: false
384
+ });
385
+ const input_contextDefinitionList_length = input.contextDefinitionList.length;
386
+ for (let i = 0; i < input_contextDefinitionList_length; i++) {
387
+ rootKeySet.merge(getTypeCacheKeys$6(luvio, input.contextDefinitionList[i]));
388
+ }
389
+ return rootKeySet;
390
+ }
391
+
392
+ function select$i(luvio, params) {
393
+ return select$j();
394
+ }
395
+ function keyBuilder$k(luvio, params) {
396
+ return keyPrefix + '::ContextDefinitionListRepresentation:(' + ')';
397
+ }
398
+ function getResponseCacheKeys$h(luvio, resourceParams, response) {
399
+ return getTypeCacheKeys$5(luvio, response, () => keyBuilder$k());
400
+ }
401
+ function ingestSuccess$d(luvio, resourceParams, response, snapshotRefresh) {
402
+ const { body } = response;
403
+ const key = keyBuilder$k();
404
+ luvio.storeIngest(key, ingest$5, body);
405
+ const snapshot = luvio.storeLookup({
406
+ recordId: key,
407
+ node: select$i(),
408
+ variables: {},
409
+ }, snapshotRefresh);
410
+ if (process.env.NODE_ENV !== 'production') {
411
+ if (snapshot.state !== 'Fulfilled') {
412
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
413
+ }
414
+ }
415
+ return snapshot;
416
+ }
417
+ function ingestError$5(luvio, params, error, snapshotRefresh) {
418
+ const key = keyBuilder$k();
419
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
420
+ const storeMetadataParams = {
421
+ ttl: TTL$5,
422
+ namespace: keyPrefix,
423
+ version: VERSION$5,
424
+ representationName: RepresentationType$5
425
+ };
426
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
427
+ return errorSnapshot;
428
+ }
429
+ function createResourceRequest$h(config) {
430
+ const headers = {};
431
+ return {
432
+ baseUri: '/services/data/v58.0',
433
+ basePath: '/connect/contextdefinition',
434
+ method: 'get',
435
+ body: null,
436
+ urlParams: {},
437
+ queryParams: {},
438
+ headers,
439
+ priority: 'normal',
440
+ };
441
+ }
442
+
443
+ const getContextDefinitionList_ConfigPropertyNames = {
444
+ displayName: 'getContextDefinitionList',
445
+ parameters: {
446
+ required: [],
447
+ optional: []
448
+ }
449
+ };
450
+ function createResourceParams$h(config) {
451
+ const resourceParams = {};
452
+ return resourceParams;
453
+ }
454
+ function keyBuilder$j(luvio, config) {
455
+ return keyBuilder$k();
456
+ }
457
+ function typeCheckConfig$h(untrustedConfig) {
458
+ const config = {};
459
+ return config;
460
+ }
461
+ function validateAdapterConfig$h(untrustedConfig, configPropertyNames) {
462
+ if (!untrustedIsObject(untrustedConfig)) {
463
+ return null;
464
+ }
465
+ if (process.env.NODE_ENV !== 'production') {
466
+ validateConfig(untrustedConfig, configPropertyNames);
467
+ }
468
+ const config = typeCheckConfig$h();
469
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
470
+ return null;
471
+ }
472
+ return config;
473
+ }
474
+ function adapterFragment$5(luvio, config) {
475
+ return select$i();
476
+ }
477
+ function onFetchResponseSuccess$5(luvio, config, resourceParams, response) {
478
+ const snapshot = ingestSuccess$d(luvio, resourceParams, response, {
479
+ config,
480
+ resolve: () => buildNetworkSnapshot$h(luvio, config, snapshotRefreshOptions)
481
+ });
482
+ return luvio.storeBroadcast().then(() => snapshot);
483
+ }
484
+ function onFetchResponseError$5(luvio, config, resourceParams, response) {
485
+ const snapshot = ingestError$5(luvio, resourceParams, response, {
486
+ config,
487
+ resolve: () => buildNetworkSnapshot$h(luvio, config, snapshotRefreshOptions)
488
+ });
489
+ return luvio.storeBroadcast().then(() => snapshot);
490
+ }
491
+ function buildNetworkSnapshot$h(luvio, config, options) {
492
+ const resourceParams = createResourceParams$h();
493
+ const request = createResourceRequest$h();
494
+ return luvio.dispatchResourceRequest(request, options)
495
+ .then((response) => {
496
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$5(luvio, config, resourceParams, response), () => getResponseCacheKeys$h(luvio, resourceParams, response.body));
497
+ }, (response) => {
498
+ return luvio.handleErrorResponse(() => onFetchResponseError$5(luvio, config, resourceParams, response));
499
+ });
500
+ }
501
+ function buildNetworkSnapshotCachePolicy$5(context, coercedAdapterRequestContext) {
502
+ const { luvio, config } = context;
503
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
504
+ const dispatchOptions = {
505
+ resourceRequestContext: {
506
+ requestCorrelator,
507
+ luvioRequestMethod: undefined,
508
+ },
509
+ eventObservers
510
+ };
511
+ if (networkPriority !== 'normal') {
512
+ dispatchOptions.overrides = {
513
+ priority: networkPriority
514
+ };
515
+ }
516
+ return buildNetworkSnapshot$h(luvio, config, dispatchOptions);
517
+ }
518
+ function buildCachedSnapshotCachePolicy$5(context, storeLookup) {
519
+ const { luvio, config } = context;
520
+ const selector = {
521
+ recordId: keyBuilder$j(),
522
+ node: adapterFragment$5(),
523
+ variables: {},
524
+ };
525
+ const cacheSnapshot = storeLookup(selector, {
526
+ config,
527
+ resolve: () => buildNetworkSnapshot$h(luvio, config, snapshotRefreshOptions)
528
+ });
529
+ return cacheSnapshot;
530
+ }
531
+ const getContextDefinitionListAdapterFactory = (luvio) => function IndustriesContext__getContextDefinitionList(untrustedConfig, requestContext) {
532
+ const config = validateAdapterConfig$h(untrustedConfig, getContextDefinitionList_ConfigPropertyNames);
533
+ // Invalid or incomplete config
534
+ if (config === null) {
535
+ return null;
536
+ }
537
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
538
+ buildCachedSnapshotCachePolicy$5, buildNetworkSnapshotCachePolicy$5);
539
+ };
540
+
541
+ function validate$c(obj, path = 'ContextDefinitionInputRepresentation') {
542
+ const v_error = (() => {
543
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
544
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
545
+ }
546
+ if (obj.definition !== undefined) {
547
+ const obj_definition = obj.definition;
548
+ const path_definition = path + '.definition';
549
+ if (typeof obj_definition !== 'string') {
550
+ return new TypeError('Expected "string" but received "' + typeof obj_definition + '" (at "' + path_definition + '")');
551
+ }
552
+ }
553
+ if (obj.description !== undefined) {
554
+ const obj_description = obj.description;
555
+ const path_description = path + '.description';
556
+ if (typeof obj_description !== 'string') {
557
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
558
+ }
559
+ }
560
+ if (obj.developerName !== undefined) {
561
+ const obj_developerName = obj.developerName;
562
+ const path_developerName = path + '.developerName';
563
+ if (typeof obj_developerName !== 'string') {
564
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
565
+ }
566
+ }
567
+ })();
568
+ return v_error === undefined ? null : v_error;
569
+ }
570
+
571
+ function select$h(luvio, params) {
572
+ return select$k();
573
+ }
574
+ function getResponseCacheKeys$g(luvio, resourceParams, response) {
575
+ return getTypeCacheKeys$6(luvio, response);
576
+ }
577
+ function ingestSuccess$c(luvio, resourceParams, response) {
578
+ const { body } = response;
579
+ const key = keyBuilderFromType$5(luvio, body);
580
+ luvio.storeIngest(key, ingest$6, body);
581
+ const snapshot = luvio.storeLookup({
582
+ recordId: key,
583
+ node: select$h(),
584
+ variables: {},
585
+ });
586
+ if (process.env.NODE_ENV !== 'production') {
587
+ if (snapshot.state !== 'Fulfilled') {
588
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
589
+ }
590
+ }
591
+ return snapshot;
592
+ }
593
+ function createResourceRequest$g(config) {
594
+ const headers = {};
595
+ return {
596
+ baseUri: '/services/data/v58.0',
597
+ basePath: '/connect/contextdefinition',
598
+ method: 'post',
599
+ body: config.body,
600
+ urlParams: {},
601
+ queryParams: {},
602
+ headers,
603
+ priority: 'normal',
604
+ };
605
+ }
606
+
607
+ const createContextDefinition_ConfigPropertyNames = {
608
+ displayName: 'createContextDefinition',
609
+ parameters: {
610
+ required: ['contextDefinitionInput'],
611
+ optional: []
612
+ }
613
+ };
614
+ function createResourceParams$g(config) {
615
+ const resourceParams = {
616
+ body: {
617
+ contextDefinitionInput: config.contextDefinitionInput
618
+ }
619
+ };
620
+ return resourceParams;
621
+ }
622
+ function typeCheckConfig$g(untrustedConfig) {
623
+ const config = {};
624
+ const untrustedConfig_contextDefinitionInput = untrustedConfig.contextDefinitionInput;
625
+ const referenceContextDefinitionInputRepresentationValidationError = validate$c(untrustedConfig_contextDefinitionInput);
626
+ if (referenceContextDefinitionInputRepresentationValidationError === null) {
627
+ config.contextDefinitionInput = untrustedConfig_contextDefinitionInput;
628
+ }
629
+ return config;
630
+ }
631
+ function validateAdapterConfig$g(untrustedConfig, configPropertyNames) {
632
+ if (!untrustedIsObject(untrustedConfig)) {
633
+ return null;
634
+ }
635
+ if (process.env.NODE_ENV !== 'production') {
636
+ validateConfig(untrustedConfig, configPropertyNames);
637
+ }
638
+ const config = typeCheckConfig$g(untrustedConfig);
639
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
640
+ return null;
641
+ }
642
+ return config;
643
+ }
644
+ function buildNetworkSnapshot$g(luvio, config, options) {
645
+ const resourceParams = createResourceParams$g(config);
646
+ const request = createResourceRequest$g(resourceParams);
647
+ return luvio.dispatchResourceRequest(request, options)
648
+ .then((response) => {
649
+ return luvio.handleSuccessResponse(() => {
650
+ const snapshot = ingestSuccess$c(luvio, resourceParams, response);
651
+ return luvio.storeBroadcast().then(() => snapshot);
652
+ }, () => getResponseCacheKeys$g(luvio, resourceParams, response.body));
653
+ }, (response) => {
654
+ deepFreeze$8(response);
655
+ throw response;
656
+ });
657
+ }
658
+ const createContextDefinitionAdapterFactory = (luvio) => {
659
+ return function createContextDefinition(untrustedConfig) {
660
+ const config = validateAdapterConfig$g(untrustedConfig, createContextDefinition_ConfigPropertyNames);
661
+ // Invalid or incomplete config
662
+ if (config === null) {
663
+ throw new Error('Invalid config for "createContextDefinition"');
664
+ }
665
+ return buildNetworkSnapshot$g(luvio, config);
666
+ };
667
+ };
668
+
669
+ function validate$b(obj, path = 'ContextAttributeInputRepresentation') {
670
+ const v_error = (() => {
671
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
672
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
673
+ }
674
+ if (obj.attributeTags !== undefined) {
675
+ const obj_attributeTags = obj.attributeTags;
676
+ const path_attributeTags = path + '.attributeTags';
677
+ if (!ArrayIsArray(obj_attributeTags)) {
678
+ return new TypeError('Expected "array" but received "' + typeof obj_attributeTags + '" (at "' + path_attributeTags + '")');
679
+ }
680
+ for (let i = 0; i < obj_attributeTags.length; i++) {
681
+ const obj_attributeTags_item = obj_attributeTags[i];
682
+ const path_attributeTags_item = path_attributeTags + '[' + i + ']';
683
+ if (typeof obj_attributeTags_item !== 'object' || ArrayIsArray(obj_attributeTags_item) || obj_attributeTags_item === null) {
684
+ return new TypeError('Expected "object" but received "' + typeof obj_attributeTags_item + '" (at "' + path_attributeTags_item + '")');
685
+ }
686
+ }
687
+ }
688
+ if (obj.dataType !== undefined) {
689
+ const obj_dataType = obj.dataType;
690
+ const path_dataType = path + '.dataType';
691
+ if (typeof obj_dataType !== 'string') {
692
+ return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
693
+ }
694
+ }
695
+ if (obj.fieldType !== undefined) {
696
+ const obj_fieldType = obj.fieldType;
697
+ const path_fieldType = path + '.fieldType';
698
+ if (typeof obj_fieldType !== 'string') {
699
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldType + '" (at "' + path_fieldType + '")');
700
+ }
701
+ }
702
+ if (obj.isFinal !== undefined) {
703
+ const obj_isFinal = obj.isFinal;
704
+ const path_isFinal = path + '.isFinal';
705
+ if (typeof obj_isFinal !== 'boolean') {
706
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isFinal + '" (at "' + path_isFinal + '")');
707
+ }
708
+ }
709
+ if (obj.isKey !== undefined) {
710
+ const obj_isKey = obj.isKey;
711
+ const path_isKey = path + '.isKey';
712
+ if (typeof obj_isKey !== 'boolean') {
713
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isKey + '" (at "' + path_isKey + '")');
714
+ }
715
+ }
716
+ if (obj.isValue !== undefined) {
717
+ const obj_isValue = obj.isValue;
718
+ const path_isValue = path + '.isValue';
719
+ if (typeof obj_isValue !== 'boolean') {
720
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isValue + '" (at "' + path_isValue + '")');
721
+ }
722
+ }
723
+ if (obj.name !== undefined) {
724
+ const obj_name = obj.name;
725
+ const path_name = path + '.name';
726
+ if (typeof obj_name !== 'string') {
727
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
728
+ }
729
+ }
730
+ if (obj.parentNodeId !== undefined) {
731
+ const obj_parentNodeId = obj.parentNodeId;
732
+ const path_parentNodeId = path + '.parentNodeId';
733
+ if (typeof obj_parentNodeId !== 'string') {
734
+ return new TypeError('Expected "string" but received "' + typeof obj_parentNodeId + '" (at "' + path_parentNodeId + '")');
735
+ }
736
+ }
737
+ })();
738
+ return v_error === undefined ? null : v_error;
739
+ }
740
+
741
+ const TTL$4 = 30000;
742
+ const VERSION$4 = "60e01dae1235ff9bc96afee43e91620c";
743
+ function validate$a(obj, path = 'ContextAttributeTagRepresentation') {
744
+ const v_error = (() => {
745
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
746
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
747
+ }
748
+ const obj_contextAttributeId = obj.contextAttributeId;
749
+ const path_contextAttributeId = path + '.contextAttributeId';
750
+ if (typeof obj_contextAttributeId !== 'string') {
751
+ return new TypeError('Expected "string" but received "' + typeof obj_contextAttributeId + '" (at "' + path_contextAttributeId + '")');
752
+ }
753
+ const obj_contextAttributeTagId = obj.contextAttributeTagId;
754
+ const path_contextAttributeTagId = path + '.contextAttributeTagId';
755
+ if (typeof obj_contextAttributeTagId !== 'string') {
756
+ return new TypeError('Expected "string" but received "' + typeof obj_contextAttributeTagId + '" (at "' + path_contextAttributeTagId + '")');
757
+ }
758
+ const obj_contextNodeId = obj.contextNodeId;
759
+ const path_contextNodeId = path + '.contextNodeId';
760
+ if (typeof obj_contextNodeId !== 'string') {
761
+ return new TypeError('Expected "string" but received "' + typeof obj_contextNodeId + '" (at "' + path_contextNodeId + '")');
762
+ }
763
+ const obj_isSuccess = obj.isSuccess;
764
+ const path_isSuccess = path + '.isSuccess';
765
+ if (typeof obj_isSuccess !== 'boolean') {
766
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
767
+ }
768
+ const obj_name = obj.name;
769
+ const path_name = path + '.name';
770
+ if (typeof obj_name !== 'string') {
771
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
772
+ }
773
+ })();
774
+ return v_error === undefined ? null : v_error;
775
+ }
776
+ const RepresentationType$4 = 'ContextAttributeTagRepresentation';
777
+ function keyBuilder$i(luvio, config) {
778
+ return keyPrefix + '::' + RepresentationType$4 + ':' + config.id;
779
+ }
780
+ function keyBuilderFromType$4(luvio, object) {
781
+ const keyParams = {
782
+ id: object.contextAttributeTagId
783
+ };
784
+ return keyBuilder$i(luvio, keyParams);
785
+ }
786
+ function normalize$4(input, existing, path, luvio, store, timestamp) {
787
+ return input;
788
+ }
789
+ const select$g = function ContextAttributeTagRepresentationSelect() {
790
+ return {
791
+ kind: 'Fragment',
792
+ version: VERSION$4,
793
+ private: [],
794
+ selections: [
795
+ {
796
+ name: 'contextAttributeId',
797
+ kind: 'Scalar'
798
+ },
799
+ {
800
+ name: 'contextAttributeTagId',
801
+ kind: 'Scalar'
802
+ },
803
+ {
804
+ name: 'contextNodeId',
805
+ kind: 'Scalar'
806
+ },
807
+ {
808
+ name: 'isSuccess',
809
+ kind: 'Scalar'
810
+ },
811
+ {
812
+ name: 'name',
813
+ kind: 'Scalar'
814
+ }
815
+ ]
816
+ };
817
+ };
818
+ function equals$4(existing, incoming) {
819
+ const existing_isSuccess = existing.isSuccess;
820
+ const incoming_isSuccess = incoming.isSuccess;
821
+ if (!(existing_isSuccess === incoming_isSuccess)) {
822
+ return false;
823
+ }
824
+ const existing_contextAttributeId = existing.contextAttributeId;
825
+ const incoming_contextAttributeId = incoming.contextAttributeId;
826
+ if (!(existing_contextAttributeId === incoming_contextAttributeId)) {
827
+ return false;
828
+ }
829
+ const existing_contextAttributeTagId = existing.contextAttributeTagId;
830
+ const incoming_contextAttributeTagId = incoming.contextAttributeTagId;
831
+ if (!(existing_contextAttributeTagId === incoming_contextAttributeTagId)) {
832
+ return false;
833
+ }
834
+ const existing_contextNodeId = existing.contextNodeId;
835
+ const incoming_contextNodeId = incoming.contextNodeId;
836
+ if (!(existing_contextNodeId === incoming_contextNodeId)) {
837
+ return false;
838
+ }
839
+ const existing_name = existing.name;
840
+ const incoming_name = incoming.name;
841
+ if (!(existing_name === incoming_name)) {
842
+ return false;
843
+ }
844
+ return true;
845
+ }
846
+ function deepFreeze$7(input) {
847
+ ObjectFreeze(input);
848
+ }
849
+ const ingest$4 = function ContextAttributeTagRepresentationIngest(input, path, luvio, store, timestamp) {
850
+ if (process.env.NODE_ENV !== 'production') {
851
+ const validateError = validate$a(input);
852
+ if (validateError !== null) {
853
+ throw validateError;
854
+ }
855
+ }
856
+ const key = keyBuilderFromType$4(luvio, input);
857
+ const existingRecord = store.readEntry(key);
858
+ const ttlToUse = TTL$4;
859
+ let incomingRecord = normalize$4(input, store.readEntry(key), {
860
+ fullPath: key,
861
+ parent: path.parent,
862
+ propertyName: path.propertyName,
863
+ ttl: ttlToUse
864
+ });
865
+ if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
866
+ luvio.storePublish(key, incomingRecord);
867
+ }
868
+ {
869
+ const storeMetadataParams = {
870
+ ttl: ttlToUse,
871
+ namespace: "IndustriesContext",
872
+ version: VERSION$4,
873
+ representationName: RepresentationType$4,
874
+ };
875
+ luvio.publishStoreMetadata(key, storeMetadataParams);
876
+ }
877
+ return createLink(key);
878
+ };
879
+ function getTypeCacheKeys$4(luvio, input, fullPathFactory) {
880
+ const rootKeySet = new StoreKeyMap();
881
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
882
+ const rootKey = keyBuilderFromType$4(luvio, input);
883
+ rootKeySet.set(rootKey, {
884
+ namespace: keyPrefix,
885
+ representationName: RepresentationType$4,
886
+ mergeable: false
887
+ });
888
+ return rootKeySet;
889
+ }
890
+
891
+ const TTL$3 = 30000;
892
+ const VERSION$3 = "07b953190ccdfc99b3c6245b4ab37939";
893
+ function validate$9(obj, path = 'ContextAttributeRepresentation') {
894
+ const v_error = (() => {
895
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
896
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
897
+ }
898
+ const obj_attributeTags = obj.attributeTags;
899
+ const path_attributeTags = path + '.attributeTags';
900
+ if (!ArrayIsArray(obj_attributeTags)) {
901
+ return new TypeError('Expected "array" but received "' + typeof obj_attributeTags + '" (at "' + path_attributeTags + '")');
902
+ }
903
+ for (let i = 0; i < obj_attributeTags.length; i++) {
904
+ const obj_attributeTags_item = obj_attributeTags[i];
905
+ const path_attributeTags_item = path_attributeTags + '[' + i + ']';
906
+ if (typeof obj_attributeTags_item !== 'object') {
907
+ return new TypeError('Expected "object" but received "' + typeof obj_attributeTags_item + '" (at "' + path_attributeTags_item + '")');
908
+ }
909
+ }
910
+ const obj_contextAttributeId = obj.contextAttributeId;
911
+ const path_contextAttributeId = path + '.contextAttributeId';
912
+ if (typeof obj_contextAttributeId !== 'string') {
913
+ return new TypeError('Expected "string" but received "' + typeof obj_contextAttributeId + '" (at "' + path_contextAttributeId + '")');
914
+ }
915
+ const obj_dataType = obj.dataType;
916
+ const path_dataType = path + '.dataType';
917
+ if (typeof obj_dataType !== 'string') {
918
+ return new TypeError('Expected "string" but received "' + typeof obj_dataType + '" (at "' + path_dataType + '")');
919
+ }
920
+ const obj_fieldType = obj.fieldType;
921
+ const path_fieldType = path + '.fieldType';
922
+ if (typeof obj_fieldType !== 'string') {
923
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldType + '" (at "' + path_fieldType + '")');
924
+ }
925
+ const obj_isFinal = obj.isFinal;
926
+ const path_isFinal = path + '.isFinal';
927
+ if (typeof obj_isFinal !== 'boolean') {
928
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isFinal + '" (at "' + path_isFinal + '")');
929
+ }
930
+ if (obj.isKey !== undefined) {
931
+ const obj_isKey = obj.isKey;
932
+ const path_isKey = path + '.isKey';
933
+ if (typeof obj_isKey !== 'boolean') {
934
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isKey + '" (at "' + path_isKey + '")');
935
+ }
936
+ }
937
+ if (obj.isSuccess !== undefined) {
938
+ const obj_isSuccess = obj.isSuccess;
939
+ const path_isSuccess = path + '.isSuccess';
940
+ if (typeof obj_isSuccess !== 'boolean') {
941
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
942
+ }
943
+ }
944
+ if (obj.isValue !== undefined) {
945
+ const obj_isValue = obj.isValue;
946
+ const path_isValue = path + '.isValue';
947
+ if (typeof obj_isValue !== 'boolean') {
948
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isValue + '" (at "' + path_isValue + '")');
949
+ }
950
+ }
951
+ const obj_name = obj.name;
952
+ const path_name = path + '.name';
953
+ if (typeof obj_name !== 'string') {
954
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
955
+ }
956
+ const obj_parentNodeId = obj.parentNodeId;
957
+ const path_parentNodeId = path + '.parentNodeId';
958
+ if (typeof obj_parentNodeId !== 'string') {
959
+ return new TypeError('Expected "string" but received "' + typeof obj_parentNodeId + '" (at "' + path_parentNodeId + '")');
960
+ }
961
+ })();
962
+ return v_error === undefined ? null : v_error;
963
+ }
964
+ const RepresentationType$3 = 'ContextAttributeRepresentation';
965
+ function keyBuilder$h(luvio, config) {
966
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.id;
967
+ }
968
+ function keyBuilderFromType$3(luvio, object) {
969
+ const keyParams = {
970
+ id: object.contextAttributeId
971
+ };
972
+ return keyBuilder$h(luvio, keyParams);
973
+ }
974
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
975
+ const input_attributeTags = input.attributeTags;
976
+ const input_attributeTags_id = path.fullPath + '__attributeTags';
977
+ for (let i = 0; i < input_attributeTags.length; i++) {
978
+ const input_attributeTags_item = input_attributeTags[i];
979
+ let input_attributeTags_item_id = input_attributeTags_id + '__' + i;
980
+ input_attributeTags[i] = ingest$4(input_attributeTags_item, {
981
+ fullPath: input_attributeTags_item_id,
982
+ propertyName: i,
983
+ parent: {
984
+ data: input,
985
+ key: path.fullPath,
986
+ existing: existing,
987
+ },
988
+ ttl: path.ttl
989
+ }, luvio, store);
990
+ }
991
+ return input;
992
+ }
993
+ const select$f = function ContextAttributeRepresentationSelect() {
994
+ return {
995
+ kind: 'Fragment',
996
+ version: VERSION$3,
997
+ private: [],
998
+ selections: [
999
+ {
1000
+ name: 'attributeTags',
1001
+ kind: 'Link',
1002
+ plural: true,
1003
+ fragment: select$g()
1004
+ },
1005
+ {
1006
+ name: 'contextAttributeId',
1007
+ kind: 'Scalar'
1008
+ },
1009
+ {
1010
+ name: 'dataType',
1011
+ kind: 'Scalar'
1012
+ },
1013
+ {
1014
+ name: 'fieldType',
1015
+ kind: 'Scalar'
1016
+ },
1017
+ {
1018
+ name: 'isFinal',
1019
+ kind: 'Scalar'
1020
+ },
1021
+ {
1022
+ name: 'isKey',
1023
+ kind: 'Scalar',
1024
+ required: false
1025
+ },
1026
+ {
1027
+ name: 'isSuccess',
1028
+ kind: 'Scalar',
1029
+ required: false
1030
+ },
1031
+ {
1032
+ name: 'isValue',
1033
+ kind: 'Scalar',
1034
+ required: false
1035
+ },
1036
+ {
1037
+ name: 'name',
1038
+ kind: 'Scalar'
1039
+ },
1040
+ {
1041
+ name: 'parentNodeId',
1042
+ kind: 'Scalar'
1043
+ }
1044
+ ]
1045
+ };
1046
+ };
1047
+ function equals$3(existing, incoming) {
1048
+ const existing_isFinal = existing.isFinal;
1049
+ const incoming_isFinal = incoming.isFinal;
1050
+ if (!(existing_isFinal === incoming_isFinal)) {
1051
+ return false;
1052
+ }
1053
+ const existing_isKey = existing.isKey;
1054
+ const incoming_isKey = incoming.isKey;
1055
+ // if at least one of these optionals is defined
1056
+ if (existing_isKey !== undefined || incoming_isKey !== undefined) {
1057
+ // if one of these is not defined we know the other is defined and therefore
1058
+ // not equal
1059
+ if (existing_isKey === undefined || incoming_isKey === undefined) {
1060
+ return false;
1061
+ }
1062
+ if (!(existing_isKey === incoming_isKey)) {
1063
+ return false;
1064
+ }
1065
+ }
1066
+ const existing_isSuccess = existing.isSuccess;
1067
+ const incoming_isSuccess = incoming.isSuccess;
1068
+ // if at least one of these optionals is defined
1069
+ if (existing_isSuccess !== undefined || incoming_isSuccess !== undefined) {
1070
+ // if one of these is not defined we know the other is defined and therefore
1071
+ // not equal
1072
+ if (existing_isSuccess === undefined || incoming_isSuccess === undefined) {
1073
+ return false;
1074
+ }
1075
+ if (!(existing_isSuccess === incoming_isSuccess)) {
1076
+ return false;
1077
+ }
1078
+ }
1079
+ const existing_isValue = existing.isValue;
1080
+ const incoming_isValue = incoming.isValue;
1081
+ // if at least one of these optionals is defined
1082
+ if (existing_isValue !== undefined || incoming_isValue !== undefined) {
1083
+ // if one of these is not defined we know the other is defined and therefore
1084
+ // not equal
1085
+ if (existing_isValue === undefined || incoming_isValue === undefined) {
1086
+ return false;
1087
+ }
1088
+ if (!(existing_isValue === incoming_isValue)) {
1089
+ return false;
1090
+ }
1091
+ }
1092
+ const existing_contextAttributeId = existing.contextAttributeId;
1093
+ const incoming_contextAttributeId = incoming.contextAttributeId;
1094
+ if (!(existing_contextAttributeId === incoming_contextAttributeId)) {
1095
+ return false;
1096
+ }
1097
+ const existing_dataType = existing.dataType;
1098
+ const incoming_dataType = incoming.dataType;
1099
+ if (!(existing_dataType === incoming_dataType)) {
1100
+ return false;
1101
+ }
1102
+ const existing_fieldType = existing.fieldType;
1103
+ const incoming_fieldType = incoming.fieldType;
1104
+ if (!(existing_fieldType === incoming_fieldType)) {
1105
+ return false;
1106
+ }
1107
+ const existing_name = existing.name;
1108
+ const incoming_name = incoming.name;
1109
+ if (!(existing_name === incoming_name)) {
1110
+ return false;
1111
+ }
1112
+ const existing_parentNodeId = existing.parentNodeId;
1113
+ const incoming_parentNodeId = incoming.parentNodeId;
1114
+ if (!(existing_parentNodeId === incoming_parentNodeId)) {
1115
+ return false;
1116
+ }
1117
+ const existing_attributeTags = existing.attributeTags;
1118
+ const incoming_attributeTags = incoming.attributeTags;
1119
+ const equals_attributeTags_items = equalsArray(existing_attributeTags, incoming_attributeTags, (existing_attributeTags_item, incoming_attributeTags_item) => {
1120
+ if (!(existing_attributeTags_item.__ref === incoming_attributeTags_item.__ref)) {
1121
+ return false;
1122
+ }
1123
+ });
1124
+ if (equals_attributeTags_items === false) {
1125
+ return false;
1126
+ }
1127
+ return true;
1128
+ }
1129
+ function deepFreeze$6(input) {
1130
+ const input_attributeTags = input.attributeTags;
1131
+ for (let i = 0; i < input_attributeTags.length; i++) {
1132
+ const input_attributeTags_item = input_attributeTags[i];
1133
+ deepFreeze$7(input_attributeTags_item);
1134
+ }
1135
+ ObjectFreeze(input_attributeTags);
1136
+ ObjectFreeze(input);
1137
+ }
1138
+ const ingest$3 = function ContextAttributeRepresentationIngest(input, path, luvio, store, timestamp) {
1139
+ if (process.env.NODE_ENV !== 'production') {
1140
+ const validateError = validate$9(input);
1141
+ if (validateError !== null) {
1142
+ throw validateError;
1143
+ }
1144
+ }
1145
+ const key = keyBuilderFromType$3(luvio, input);
1146
+ const existingRecord = store.readEntry(key);
1147
+ const ttlToUse = TTL$3;
1148
+ let incomingRecord = normalize$3(input, store.readEntry(key), {
1149
+ fullPath: key,
1150
+ parent: path.parent,
1151
+ propertyName: path.propertyName,
1152
+ ttl: ttlToUse
1153
+ }, luvio, store);
1154
+ if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
1155
+ luvio.storePublish(key, incomingRecord);
1156
+ }
1157
+ {
1158
+ const storeMetadataParams = {
1159
+ ttl: ttlToUse,
1160
+ namespace: "IndustriesContext",
1161
+ version: VERSION$3,
1162
+ representationName: RepresentationType$3,
1163
+ };
1164
+ luvio.publishStoreMetadata(key, storeMetadataParams);
1165
+ }
1166
+ return createLink(key);
1167
+ };
1168
+ function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
1169
+ const rootKeySet = new StoreKeyMap();
1170
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1171
+ const rootKey = keyBuilderFromType$3(luvio, input);
1172
+ rootKeySet.set(rootKey, {
1173
+ namespace: keyPrefix,
1174
+ representationName: RepresentationType$3,
1175
+ mergeable: false
1176
+ });
1177
+ const input_attributeTags_length = input.attributeTags.length;
1178
+ for (let i = 0; i < input_attributeTags_length; i++) {
1179
+ rootKeySet.merge(getTypeCacheKeys$4(luvio, input.attributeTags[i]));
1180
+ }
1181
+ return rootKeySet;
1182
+ }
1183
+
1184
+ function select$e(luvio, params) {
1185
+ return select$f();
1186
+ }
1187
+ function getResponseCacheKeys$f(luvio, resourceParams, response) {
1188
+ return getTypeCacheKeys$3(luvio, response);
1189
+ }
1190
+ function ingestSuccess$b(luvio, resourceParams, response) {
1191
+ const { body } = response;
1192
+ const key = keyBuilderFromType$3(luvio, body);
1193
+ luvio.storeIngest(key, ingest$3, body);
1194
+ const snapshot = luvio.storeLookup({
1195
+ recordId: key,
1196
+ node: select$e(),
1197
+ variables: {},
1198
+ });
1199
+ if (process.env.NODE_ENV !== 'production') {
1200
+ if (snapshot.state !== 'Fulfilled') {
1201
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1202
+ }
1203
+ }
1204
+ return snapshot;
1205
+ }
1206
+ function createResourceRequest$f(config) {
1207
+ const headers = {};
1208
+ return {
1209
+ baseUri: '/services/data/v58.0',
1210
+ basePath: '/connect/contextdefinition/attributenode',
1211
+ method: 'post',
1212
+ body: config.body,
1213
+ urlParams: {},
1214
+ queryParams: {},
1215
+ headers,
1216
+ priority: 'normal',
1217
+ };
1218
+ }
1219
+
1220
+ const createContextAttribute_ConfigPropertyNames = {
1221
+ displayName: 'createContextAttribute',
1222
+ parameters: {
1223
+ required: ['contextAttributeInput'],
1224
+ optional: []
1225
+ }
1226
+ };
1227
+ function createResourceParams$f(config) {
1228
+ const resourceParams = {
1229
+ body: {
1230
+ contextAttributeInput: config.contextAttributeInput
1231
+ }
1232
+ };
1233
+ return resourceParams;
1234
+ }
1235
+ function typeCheckConfig$f(untrustedConfig) {
1236
+ const config = {};
1237
+ const untrustedConfig_contextAttributeInput = untrustedConfig.contextAttributeInput;
1238
+ const referenceContextAttributeInputRepresentationValidationError = validate$b(untrustedConfig_contextAttributeInput);
1239
+ if (referenceContextAttributeInputRepresentationValidationError === null) {
1240
+ config.contextAttributeInput = untrustedConfig_contextAttributeInput;
1241
+ }
1242
+ return config;
1243
+ }
1244
+ function validateAdapterConfig$f(untrustedConfig, configPropertyNames) {
1245
+ if (!untrustedIsObject(untrustedConfig)) {
1246
+ return null;
1247
+ }
1248
+ if (process.env.NODE_ENV !== 'production') {
1249
+ validateConfig(untrustedConfig, configPropertyNames);
1250
+ }
1251
+ const config = typeCheckConfig$f(untrustedConfig);
1252
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1253
+ return null;
1254
+ }
1255
+ return config;
1256
+ }
1257
+ function buildNetworkSnapshot$f(luvio, config, options) {
1258
+ const resourceParams = createResourceParams$f(config);
1259
+ const request = createResourceRequest$f(resourceParams);
1260
+ return luvio.dispatchResourceRequest(request, options)
1261
+ .then((response) => {
1262
+ return luvio.handleSuccessResponse(() => {
1263
+ const snapshot = ingestSuccess$b(luvio, resourceParams, response);
1264
+ return luvio.storeBroadcast().then(() => snapshot);
1265
+ }, () => getResponseCacheKeys$f(luvio, resourceParams, response.body));
1266
+ }, (response) => {
1267
+ deepFreeze$8(response);
1268
+ throw response;
1269
+ });
1270
+ }
1271
+ const createContextAttributeAdapterFactory = (luvio) => {
1272
+ return function createContextAttribute(untrustedConfig) {
1273
+ const config = validateAdapterConfig$f(untrustedConfig, createContextAttribute_ConfigPropertyNames);
1274
+ // Invalid or incomplete config
1275
+ if (config === null) {
1276
+ throw new Error('Invalid config for "createContextAttribute"');
1277
+ }
1278
+ return buildNetworkSnapshot$f(luvio, config);
1279
+ };
1280
+ };
1281
+
1282
+ function keyBuilder$g(luvio, params) {
1283
+ return keyBuilder$h(luvio, {
1284
+ id: params.urlParams.contextAttributeId
1285
+ });
1286
+ }
1287
+ function getResponseCacheKeys$e(luvio, resourceParams) {
1288
+ const key = keyBuilder$g(luvio, resourceParams);
1289
+ const cacheKeyMap = new StoreKeyMap();
1290
+ cacheKeyMap.set(key, {
1291
+ namespace: keyPrefix,
1292
+ representationName: RepresentationType$3,
1293
+ mergeable: false
1294
+ });
1295
+ return cacheKeyMap;
1296
+ }
1297
+ function evictSuccess$3(luvio, resourceParams) {
1298
+ const key = keyBuilder$g(luvio, resourceParams);
1299
+ luvio.storeEvict(key);
1300
+ }
1301
+ function createResourceRequest$e(config) {
1302
+ const headers = {};
1303
+ return {
1304
+ baseUri: '/services/data/v58.0',
1305
+ basePath: '/connect/contextdefinition/attributenode/' + config.urlParams.contextAttributeId + '',
1306
+ method: 'delete',
1307
+ body: null,
1308
+ urlParams: config.urlParams,
1309
+ queryParams: {},
1310
+ headers,
1311
+ priority: 'normal',
1312
+ };
1313
+ }
1314
+
1315
+ const adapterName$3 = 'deleteContextAttribute';
1316
+ const deleteContextAttribute_ConfigPropertyNames = {
1317
+ displayName: 'deleteContextAttribute',
1318
+ parameters: {
1319
+ required: ['contextAttributeId'],
1320
+ optional: []
1321
+ }
1322
+ };
1323
+ function createResourceParams$e(config) {
1324
+ const resourceParams = {
1325
+ urlParams: {
1326
+ contextAttributeId: config.contextAttributeId
1327
+ }
1328
+ };
1329
+ return resourceParams;
1330
+ }
1331
+ function typeCheckConfig$e(untrustedConfig) {
1332
+ const config = {};
1333
+ const untrustedConfig_contextAttributeId = untrustedConfig.contextAttributeId;
1334
+ if (typeof untrustedConfig_contextAttributeId === 'string') {
1335
+ config.contextAttributeId = untrustedConfig_contextAttributeId;
1336
+ }
1337
+ return config;
1338
+ }
1339
+ function validateAdapterConfig$e(untrustedConfig, configPropertyNames) {
1340
+ if (!untrustedIsObject(untrustedConfig)) {
1341
+ return null;
1342
+ }
1343
+ if (process.env.NODE_ENV !== 'production') {
1344
+ validateConfig(untrustedConfig, configPropertyNames);
1345
+ }
1346
+ const config = typeCheckConfig$e(untrustedConfig);
1347
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1348
+ return null;
1349
+ }
1350
+ return config;
1351
+ }
1352
+ function buildNetworkSnapshot$e(luvio, config, options) {
1353
+ const resourceParams = createResourceParams$e(config);
1354
+ const request = createResourceRequest$e(resourceParams);
1355
+ return luvio.dispatchResourceRequest(request, options)
1356
+ .then(() => {
1357
+ return luvio.handleSuccessResponse(() => {
1358
+ evictSuccess$3(luvio, resourceParams);
1359
+ return luvio.storeBroadcast();
1360
+ }, () => getResponseCacheKeys$e(luvio, resourceParams));
1361
+ }, (response) => {
1362
+ deepFreeze$8(response);
1363
+ throw response;
1364
+ });
1365
+ }
1366
+ const deleteContextAttributeAdapterFactory = (luvio) => {
1367
+ return function IndustriesContextdeleteContextAttribute(untrustedConfig) {
1368
+ const config = validateAdapterConfig$e(untrustedConfig, deleteContextAttribute_ConfigPropertyNames);
1369
+ // Invalid or incomplete config
1370
+ if (config === null) {
1371
+ throw new Error(`Invalid config for "${adapterName$3}"`);
1372
+ }
1373
+ return buildNetworkSnapshot$e(luvio, config);
1374
+ };
1375
+ };
1376
+
1377
+ function select$d(luvio, params) {
1378
+ return select$f();
1379
+ }
1380
+ function keyBuilder$f(luvio, params) {
1381
+ return keyBuilder$h(luvio, {
1382
+ id: params.urlParams.contextAttributeId
1383
+ });
1384
+ }
1385
+ function getResponseCacheKeys$d(luvio, resourceParams, response) {
1386
+ return getTypeCacheKeys$3(luvio, response);
1387
+ }
1388
+ function ingestSuccess$a(luvio, resourceParams, response, snapshotRefresh) {
1389
+ const { body } = response;
1390
+ const key = keyBuilder$f(luvio, resourceParams);
1391
+ luvio.storeIngest(key, ingest$3, body);
1392
+ const snapshot = luvio.storeLookup({
1393
+ recordId: key,
1394
+ node: select$d(),
1395
+ variables: {},
1396
+ }, snapshotRefresh);
1397
+ if (process.env.NODE_ENV !== 'production') {
1398
+ if (snapshot.state !== 'Fulfilled') {
1399
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1400
+ }
1401
+ }
1402
+ return snapshot;
1403
+ }
1404
+ function ingestError$4(luvio, params, error, snapshotRefresh) {
1405
+ const key = keyBuilder$f(luvio, params);
1406
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1407
+ const storeMetadataParams = {
1408
+ ttl: TTL$3,
1409
+ namespace: keyPrefix,
1410
+ version: VERSION$3,
1411
+ representationName: RepresentationType$3
1412
+ };
1413
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1414
+ return errorSnapshot;
1415
+ }
1416
+ function createResourceRequest$d(config) {
1417
+ const headers = {};
1418
+ return {
1419
+ baseUri: '/services/data/v58.0',
1420
+ basePath: '/connect/contextdefinition/attributenode/' + config.urlParams.contextAttributeId + '',
1421
+ method: 'get',
1422
+ body: null,
1423
+ urlParams: config.urlParams,
1424
+ queryParams: {},
1425
+ headers,
1426
+ priority: 'normal',
1427
+ };
1428
+ }
1429
+
1430
+ const getContextAttribute_ConfigPropertyNames = {
1431
+ displayName: 'getContextAttribute',
1432
+ parameters: {
1433
+ required: ['contextAttributeId'],
1434
+ optional: []
1435
+ }
1436
+ };
1437
+ function createResourceParams$d(config) {
1438
+ const resourceParams = {
1439
+ urlParams: {
1440
+ contextAttributeId: config.contextAttributeId
1441
+ }
1442
+ };
1443
+ return resourceParams;
1444
+ }
1445
+ function keyBuilder$e(luvio, config) {
1446
+ const resourceParams = createResourceParams$d(config);
1447
+ return keyBuilder$f(luvio, resourceParams);
1448
+ }
1449
+ function typeCheckConfig$d(untrustedConfig) {
1450
+ const config = {};
1451
+ const untrustedConfig_contextAttributeId = untrustedConfig.contextAttributeId;
1452
+ if (typeof untrustedConfig_contextAttributeId === 'string') {
1453
+ config.contextAttributeId = untrustedConfig_contextAttributeId;
1454
+ }
1455
+ return config;
1456
+ }
1457
+ function validateAdapterConfig$d(untrustedConfig, configPropertyNames) {
1458
+ if (!untrustedIsObject(untrustedConfig)) {
1459
+ return null;
1460
+ }
1461
+ if (process.env.NODE_ENV !== 'production') {
1462
+ validateConfig(untrustedConfig, configPropertyNames);
1463
+ }
1464
+ const config = typeCheckConfig$d(untrustedConfig);
1465
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1466
+ return null;
1467
+ }
1468
+ return config;
1469
+ }
1470
+ function adapterFragment$4(luvio, config) {
1471
+ createResourceParams$d(config);
1472
+ return select$d();
1473
+ }
1474
+ function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
1475
+ const snapshot = ingestSuccess$a(luvio, resourceParams, response, {
1476
+ config,
1477
+ resolve: () => buildNetworkSnapshot$d(luvio, config, snapshotRefreshOptions)
1478
+ });
1479
+ return luvio.storeBroadcast().then(() => snapshot);
1480
+ }
1481
+ function onFetchResponseError$4(luvio, config, resourceParams, response) {
1482
+ const snapshot = ingestError$4(luvio, resourceParams, response, {
1483
+ config,
1484
+ resolve: () => buildNetworkSnapshot$d(luvio, config, snapshotRefreshOptions)
1485
+ });
1486
+ return luvio.storeBroadcast().then(() => snapshot);
1487
+ }
1488
+ function buildNetworkSnapshot$d(luvio, config, options) {
1489
+ const resourceParams = createResourceParams$d(config);
1490
+ const request = createResourceRequest$d(resourceParams);
1491
+ return luvio.dispatchResourceRequest(request, options)
1492
+ .then((response) => {
1493
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$4(luvio, config, resourceParams, response), () => getResponseCacheKeys$d(luvio, resourceParams, response.body));
1494
+ }, (response) => {
1495
+ return luvio.handleErrorResponse(() => onFetchResponseError$4(luvio, config, resourceParams, response));
1496
+ });
1497
+ }
1498
+ function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
1499
+ const { luvio, config } = context;
1500
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1501
+ const dispatchOptions = {
1502
+ resourceRequestContext: {
1503
+ requestCorrelator,
1504
+ luvioRequestMethod: undefined,
1505
+ },
1506
+ eventObservers
1507
+ };
1508
+ if (networkPriority !== 'normal') {
1509
+ dispatchOptions.overrides = {
1510
+ priority: networkPriority
1511
+ };
1512
+ }
1513
+ return buildNetworkSnapshot$d(luvio, config, dispatchOptions);
1514
+ }
1515
+ function buildCachedSnapshotCachePolicy$4(context, storeLookup) {
1516
+ const { luvio, config } = context;
1517
+ const selector = {
1518
+ recordId: keyBuilder$e(luvio, config),
1519
+ node: adapterFragment$4(luvio, config),
1520
+ variables: {},
1521
+ };
1522
+ const cacheSnapshot = storeLookup(selector, {
1523
+ config,
1524
+ resolve: () => buildNetworkSnapshot$d(luvio, config, snapshotRefreshOptions)
1525
+ });
1526
+ return cacheSnapshot;
1527
+ }
1528
+ const getContextAttributeAdapterFactory = (luvio) => function IndustriesContext__getContextAttribute(untrustedConfig, requestContext) {
1529
+ const config = validateAdapterConfig$d(untrustedConfig, getContextAttribute_ConfigPropertyNames);
1530
+ // Invalid or incomplete config
1531
+ if (config === null) {
1532
+ return null;
1533
+ }
1534
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1535
+ buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
1536
+ };
1537
+
1538
+ function select$c(luvio, params) {
1539
+ return select$f();
1540
+ }
1541
+ function getResponseCacheKeys$c(luvio, resourceParams, response) {
1542
+ return getTypeCacheKeys$3(luvio, response);
1543
+ }
1544
+ function ingestSuccess$9(luvio, resourceParams, response) {
1545
+ const { body } = response;
1546
+ const key = keyBuilderFromType$3(luvio, body);
1547
+ luvio.storeIngest(key, ingest$3, body);
1548
+ const snapshot = luvio.storeLookup({
1549
+ recordId: key,
1550
+ node: select$c(),
1551
+ variables: {},
1552
+ });
1553
+ if (process.env.NODE_ENV !== 'production') {
1554
+ if (snapshot.state !== 'Fulfilled') {
1555
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1556
+ }
1557
+ }
1558
+ return snapshot;
1559
+ }
1560
+ function createResourceRequest$c(config) {
1561
+ const headers = {};
1562
+ return {
1563
+ baseUri: '/services/data/v58.0',
1564
+ basePath: '/connect/contextdefinition/attributenode/' + config.urlParams.contextAttributeId + '',
1565
+ method: 'patch',
1566
+ body: config.body,
1567
+ urlParams: config.urlParams,
1568
+ queryParams: {},
1569
+ headers,
1570
+ priority: 'normal',
1571
+ };
1572
+ }
1573
+
1574
+ const updateContextAttribute_ConfigPropertyNames = {
1575
+ displayName: 'updateContextAttribute',
1576
+ parameters: {
1577
+ required: ['contextAttributeId', 'contextAttributeInput'],
1578
+ optional: []
1579
+ }
1580
+ };
1581
+ function createResourceParams$c(config) {
1582
+ const resourceParams = {
1583
+ urlParams: {
1584
+ contextAttributeId: config.contextAttributeId
1585
+ },
1586
+ body: {
1587
+ contextAttributeInput: config.contextAttributeInput
1588
+ }
1589
+ };
1590
+ return resourceParams;
1591
+ }
1592
+ function typeCheckConfig$c(untrustedConfig) {
1593
+ const config = {};
1594
+ const untrustedConfig_contextAttributeId = untrustedConfig.contextAttributeId;
1595
+ if (typeof untrustedConfig_contextAttributeId === 'string') {
1596
+ config.contextAttributeId = untrustedConfig_contextAttributeId;
1597
+ }
1598
+ const untrustedConfig_contextAttributeInput = untrustedConfig.contextAttributeInput;
1599
+ const referenceContextAttributeInputRepresentationValidationError = validate$b(untrustedConfig_contextAttributeInput);
1600
+ if (referenceContextAttributeInputRepresentationValidationError === null) {
1601
+ config.contextAttributeInput = untrustedConfig_contextAttributeInput;
1602
+ }
1603
+ return config;
1604
+ }
1605
+ function validateAdapterConfig$c(untrustedConfig, configPropertyNames) {
1606
+ if (!untrustedIsObject(untrustedConfig)) {
1607
+ return null;
1608
+ }
1609
+ if (process.env.NODE_ENV !== 'production') {
1610
+ validateConfig(untrustedConfig, configPropertyNames);
1611
+ }
1612
+ const config = typeCheckConfig$c(untrustedConfig);
1613
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1614
+ return null;
1615
+ }
1616
+ return config;
1617
+ }
1618
+ function buildNetworkSnapshot$c(luvio, config, options) {
1619
+ const resourceParams = createResourceParams$c(config);
1620
+ const request = createResourceRequest$c(resourceParams);
1621
+ return luvio.dispatchResourceRequest(request, options)
1622
+ .then((response) => {
1623
+ return luvio.handleSuccessResponse(() => {
1624
+ const snapshot = ingestSuccess$9(luvio, resourceParams, response);
1625
+ return luvio.storeBroadcast().then(() => snapshot);
1626
+ }, () => getResponseCacheKeys$c(luvio, resourceParams, response.body));
1627
+ }, (response) => {
1628
+ deepFreeze$8(response);
1629
+ throw response;
1630
+ });
1631
+ }
1632
+ const updateContextAttributeAdapterFactory = (luvio) => {
1633
+ return function updateContextAttribute(untrustedConfig) {
1634
+ const config = validateAdapterConfig$c(untrustedConfig, updateContextAttribute_ConfigPropertyNames);
1635
+ // Invalid or incomplete config
1636
+ if (config === null) {
1637
+ throw new Error('Invalid config for "updateContextAttribute"');
1638
+ }
1639
+ return buildNetworkSnapshot$c(luvio, config);
1640
+ };
1641
+ };
1642
+
1643
+ function select$b(luvio, params) {
1644
+ return select$k();
1645
+ }
1646
+ function keyBuilder$d(luvio, params) {
1647
+ return keyBuilder$l(luvio, {
1648
+ id: params.urlParams.contextDefinitionId
1649
+ });
1650
+ }
1651
+ function getResponseCacheKeys$b(luvio, resourceParams, response) {
1652
+ return getTypeCacheKeys$6(luvio, response);
1653
+ }
1654
+ function ingestSuccess$8(luvio, resourceParams, response, snapshotRefresh) {
1655
+ const { body } = response;
1656
+ const key = keyBuilder$d(luvio, resourceParams);
1657
+ luvio.storeIngest(key, ingest$6, body);
1658
+ const snapshot = luvio.storeLookup({
1659
+ recordId: key,
1660
+ node: select$b(),
1661
+ variables: {},
1662
+ }, snapshotRefresh);
1663
+ if (process.env.NODE_ENV !== 'production') {
1664
+ if (snapshot.state !== 'Fulfilled') {
1665
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1666
+ }
1667
+ }
1668
+ return snapshot;
1669
+ }
1670
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
1671
+ const key = keyBuilder$d(luvio, params);
1672
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1673
+ const storeMetadataParams = {
1674
+ ttl: TTL$6,
1675
+ namespace: keyPrefix,
1676
+ version: VERSION$6,
1677
+ representationName: RepresentationType$6
1678
+ };
1679
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1680
+ return errorSnapshot;
1681
+ }
1682
+ function createResourceRequest$b(config) {
1683
+ const headers = {};
1684
+ return {
1685
+ baseUri: '/services/data/v58.0',
1686
+ basePath: '/connect/contextdefinition/info/' + config.urlParams.contextDefinitionId + '',
1687
+ method: 'get',
1688
+ body: null,
1689
+ urlParams: config.urlParams,
1690
+ queryParams: {},
1691
+ headers,
1692
+ priority: 'normal',
1693
+ };
1694
+ }
1695
+
1696
+ const getContextDefinitionInfo_ConfigPropertyNames = {
1697
+ displayName: 'getContextDefinitionInfo',
1698
+ parameters: {
1699
+ required: ['contextDefinitionId'],
1700
+ optional: []
1701
+ }
1702
+ };
1703
+ function createResourceParams$b(config) {
1704
+ const resourceParams = {
1705
+ urlParams: {
1706
+ contextDefinitionId: config.contextDefinitionId
1707
+ }
1708
+ };
1709
+ return resourceParams;
1710
+ }
1711
+ function keyBuilder$c(luvio, config) {
1712
+ const resourceParams = createResourceParams$b(config);
1713
+ return keyBuilder$d(luvio, resourceParams);
1714
+ }
1715
+ function typeCheckConfig$b(untrustedConfig) {
1716
+ const config = {};
1717
+ const untrustedConfig_contextDefinitionId = untrustedConfig.contextDefinitionId;
1718
+ if (typeof untrustedConfig_contextDefinitionId === 'string') {
1719
+ config.contextDefinitionId = untrustedConfig_contextDefinitionId;
1720
+ }
1721
+ return config;
1722
+ }
1723
+ function validateAdapterConfig$b(untrustedConfig, configPropertyNames) {
1724
+ if (!untrustedIsObject(untrustedConfig)) {
1725
+ return null;
1726
+ }
1727
+ if (process.env.NODE_ENV !== 'production') {
1728
+ validateConfig(untrustedConfig, configPropertyNames);
1729
+ }
1730
+ const config = typeCheckConfig$b(untrustedConfig);
1731
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1732
+ return null;
1733
+ }
1734
+ return config;
1735
+ }
1736
+ function adapterFragment$3(luvio, config) {
1737
+ createResourceParams$b(config);
1738
+ return select$b();
1739
+ }
1740
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
1741
+ const snapshot = ingestSuccess$8(luvio, resourceParams, response, {
1742
+ config,
1743
+ resolve: () => buildNetworkSnapshot$b(luvio, config, snapshotRefreshOptions)
1744
+ });
1745
+ return luvio.storeBroadcast().then(() => snapshot);
1746
+ }
1747
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
1748
+ const snapshot = ingestError$3(luvio, resourceParams, response, {
1749
+ config,
1750
+ resolve: () => buildNetworkSnapshot$b(luvio, config, snapshotRefreshOptions)
1751
+ });
1752
+ return luvio.storeBroadcast().then(() => snapshot);
1753
+ }
1754
+ function buildNetworkSnapshot$b(luvio, config, options) {
1755
+ const resourceParams = createResourceParams$b(config);
1756
+ const request = createResourceRequest$b(resourceParams);
1757
+ return luvio.dispatchResourceRequest(request, options)
1758
+ .then((response) => {
1759
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$3(luvio, config, resourceParams, response), () => getResponseCacheKeys$b(luvio, resourceParams, response.body));
1760
+ }, (response) => {
1761
+ return luvio.handleErrorResponse(() => onFetchResponseError$3(luvio, config, resourceParams, response));
1762
+ });
1763
+ }
1764
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
1765
+ const { luvio, config } = context;
1766
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
1767
+ const dispatchOptions = {
1768
+ resourceRequestContext: {
1769
+ requestCorrelator,
1770
+ luvioRequestMethod: undefined,
1771
+ },
1772
+ eventObservers
1773
+ };
1774
+ if (networkPriority !== 'normal') {
1775
+ dispatchOptions.overrides = {
1776
+ priority: networkPriority
1777
+ };
1778
+ }
1779
+ return buildNetworkSnapshot$b(luvio, config, dispatchOptions);
1780
+ }
1781
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
1782
+ const { luvio, config } = context;
1783
+ const selector = {
1784
+ recordId: keyBuilder$c(luvio, config),
1785
+ node: adapterFragment$3(luvio, config),
1786
+ variables: {},
1787
+ };
1788
+ const cacheSnapshot = storeLookup(selector, {
1789
+ config,
1790
+ resolve: () => buildNetworkSnapshot$b(luvio, config, snapshotRefreshOptions)
1791
+ });
1792
+ return cacheSnapshot;
1793
+ }
1794
+ const getContextDefinitionInfoAdapterFactory = (luvio) => function IndustriesContext__getContextDefinitionInfo(untrustedConfig, requestContext) {
1795
+ const config = validateAdapterConfig$b(untrustedConfig, getContextDefinitionInfo_ConfigPropertyNames);
1796
+ // Invalid or incomplete config
1797
+ if (config === null) {
1798
+ return null;
1799
+ }
1800
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1801
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
1802
+ };
1803
+
1804
+ function validate$8(obj, path = 'ContextNodeInputRepresentation') {
1805
+ const v_error = (() => {
1806
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1807
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1808
+ }
1809
+ if (obj.attributes !== undefined) {
1810
+ const obj_attributes = obj.attributes;
1811
+ const path_attributes = path + '.attributes';
1812
+ if (!ArrayIsArray(obj_attributes)) {
1813
+ return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
1814
+ }
1815
+ for (let i = 0; i < obj_attributes.length; i++) {
1816
+ const obj_attributes_item = obj_attributes[i];
1817
+ const path_attributes_item = path_attributes + '[' + i + ']';
1818
+ if (typeof obj_attributes_item !== 'object' || ArrayIsArray(obj_attributes_item) || obj_attributes_item === null) {
1819
+ return new TypeError('Expected "object" but received "' + typeof obj_attributes_item + '" (at "' + path_attributes_item + '")');
1820
+ }
1821
+ }
1822
+ }
1823
+ if (obj.childNodes !== undefined) {
1824
+ const obj_childNodes = obj.childNodes;
1825
+ const path_childNodes = path + '.childNodes';
1826
+ if (!ArrayIsArray(obj_childNodes)) {
1827
+ return new TypeError('Expected "array" but received "' + typeof obj_childNodes + '" (at "' + path_childNodes + '")');
1828
+ }
1829
+ for (let i = 0; i < obj_childNodes.length; i++) {
1830
+ const obj_childNodes_item = obj_childNodes[i];
1831
+ const path_childNodes_item = path_childNodes + '[' + i + ']';
1832
+ if (typeof obj_childNodes_item !== 'object' || ArrayIsArray(obj_childNodes_item) || obj_childNodes_item === null) {
1833
+ return new TypeError('Expected "object" but received "' + typeof obj_childNodes_item + '" (at "' + path_childNodes_item + '")');
1834
+ }
1835
+ }
1836
+ }
1837
+ const obj_contextDefinitionVersionId = obj.contextDefinitionVersionId;
1838
+ const path_contextDefinitionVersionId = path + '.contextDefinitionVersionId';
1839
+ if (typeof obj_contextDefinitionVersionId !== 'string') {
1840
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionVersionId + '" (at "' + path_contextDefinitionVersionId + '")');
1841
+ }
1842
+ if (obj.isTransposable !== undefined) {
1843
+ const obj_isTransposable = obj.isTransposable;
1844
+ const path_isTransposable = path + '.isTransposable';
1845
+ if (typeof obj_isTransposable !== 'boolean') {
1846
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isTransposable + '" (at "' + path_isTransposable + '")');
1847
+ }
1848
+ }
1849
+ const obj_name = obj.name;
1850
+ const path_name = path + '.name';
1851
+ if (typeof obj_name !== 'string') {
1852
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
1853
+ }
1854
+ if (obj.parentNodeId !== undefined) {
1855
+ const obj_parentNodeId = obj.parentNodeId;
1856
+ const path_parentNodeId = path + '.parentNodeId';
1857
+ if (typeof obj_parentNodeId !== 'string') {
1858
+ return new TypeError('Expected "string" but received "' + typeof obj_parentNodeId + '" (at "' + path_parentNodeId + '")');
1859
+ }
1860
+ }
1861
+ })();
1862
+ return v_error === undefined ? null : v_error;
1863
+ }
1864
+
1865
+ const TTL$2 = 30000;
1866
+ const VERSION$2 = "c2d43b78f118eaf92b53cec62f704b4b";
1867
+ function validate$7(obj, path = 'ContextNodeRepresentation') {
1868
+ const v_error = (() => {
1869
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1870
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1871
+ }
1872
+ const obj_attributes = obj.attributes;
1873
+ const path_attributes = path + '.attributes';
1874
+ if (!ArrayIsArray(obj_attributes)) {
1875
+ return new TypeError('Expected "array" but received "' + typeof obj_attributes + '" (at "' + path_attributes + '")');
1876
+ }
1877
+ for (let i = 0; i < obj_attributes.length; i++) {
1878
+ const obj_attributes_item = obj_attributes[i];
1879
+ const path_attributes_item = path_attributes + '[' + i + ']';
1880
+ const referencepath_attributes_itemValidationError = validate$9(obj_attributes_item, path_attributes_item);
1881
+ if (referencepath_attributes_itemValidationError !== null) {
1882
+ let message = 'Object doesn\'t match ContextAttributeRepresentation (at "' + path_attributes_item + '")\n';
1883
+ message += referencepath_attributes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1884
+ return new TypeError(message);
1885
+ }
1886
+ }
1887
+ const obj_childNodes = obj.childNodes;
1888
+ const path_childNodes = path + '.childNodes';
1889
+ if (!ArrayIsArray(obj_childNodes)) {
1890
+ return new TypeError('Expected "array" but received "' + typeof obj_childNodes + '" (at "' + path_childNodes + '")');
1891
+ }
1892
+ for (let i = 0; i < obj_childNodes.length; i++) {
1893
+ const obj_childNodes_item = obj_childNodes[i];
1894
+ const path_childNodes_item = path_childNodes + '[' + i + ']';
1895
+ const referencepath_childNodes_itemValidationError = validate$7(obj_childNodes_item, path_childNodes_item);
1896
+ if (referencepath_childNodes_itemValidationError !== null) {
1897
+ let message = 'Object doesn\'t match ContextNodeRepresentation (at "' + path_childNodes_item + '")\n';
1898
+ message += referencepath_childNodes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1899
+ return new TypeError(message);
1900
+ }
1901
+ }
1902
+ const obj_contextDefinitionVersionId = obj.contextDefinitionVersionId;
1903
+ const path_contextDefinitionVersionId = path + '.contextDefinitionVersionId';
1904
+ if (typeof obj_contextDefinitionVersionId !== 'string') {
1905
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionVersionId + '" (at "' + path_contextDefinitionVersionId + '")');
1906
+ }
1907
+ const obj_contextNodeId = obj.contextNodeId;
1908
+ const path_contextNodeId = path + '.contextNodeId';
1909
+ if (typeof obj_contextNodeId !== 'string') {
1910
+ return new TypeError('Expected "string" but received "' + typeof obj_contextNodeId + '" (at "' + path_contextNodeId + '")');
1911
+ }
1912
+ if (obj.isSuccess !== undefined) {
1913
+ const obj_isSuccess = obj.isSuccess;
1914
+ const path_isSuccess = path + '.isSuccess';
1915
+ if (typeof obj_isSuccess !== 'boolean') {
1916
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
1917
+ }
1918
+ }
1919
+ if (obj.isTransposable !== undefined) {
1920
+ const obj_isTransposable = obj.isTransposable;
1921
+ const path_isTransposable = path + '.isTransposable';
1922
+ if (typeof obj_isTransposable !== 'boolean') {
1923
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isTransposable + '" (at "' + path_isTransposable + '")');
1924
+ }
1925
+ }
1926
+ const obj_name = obj.name;
1927
+ const path_name = path + '.name';
1928
+ if (typeof obj_name !== 'string') {
1929
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
1930
+ }
1931
+ if (obj.parentNodeId !== undefined) {
1932
+ const obj_parentNodeId = obj.parentNodeId;
1933
+ const path_parentNodeId = path + '.parentNodeId';
1934
+ if (typeof obj_parentNodeId !== 'string') {
1935
+ return new TypeError('Expected "string" but received "' + typeof obj_parentNodeId + '" (at "' + path_parentNodeId + '")');
1936
+ }
1937
+ }
1938
+ const obj_tags = obj.tags;
1939
+ const path_tags = path + '.tags';
1940
+ if (!ArrayIsArray(obj_tags)) {
1941
+ return new TypeError('Expected "array" but received "' + typeof obj_tags + '" (at "' + path_tags + '")');
1942
+ }
1943
+ for (let i = 0; i < obj_tags.length; i++) {
1944
+ const obj_tags_item = obj_tags[i];
1945
+ const path_tags_item = path_tags + '[' + i + ']';
1946
+ const referencepath_tags_itemValidationError = validate$a(obj_tags_item, path_tags_item);
1947
+ if (referencepath_tags_itemValidationError !== null) {
1948
+ let message = 'Object doesn\'t match ContextAttributeTagRepresentation (at "' + path_tags_item + '")\n';
1949
+ message += referencepath_tags_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
1950
+ return new TypeError(message);
1951
+ }
1952
+ }
1953
+ })();
1954
+ return v_error === undefined ? null : v_error;
1955
+ }
1956
+ const RepresentationType$2 = 'ContextNodeRepresentation';
1957
+ function keyBuilder$b(luvio, config) {
1958
+ return keyPrefix + '::' + RepresentationType$2 + ':' + config.id;
1959
+ }
1960
+ function keyBuilderFromType$2(luvio, object) {
1961
+ const keyParams = {
1962
+ id: object.contextNodeId
1963
+ };
1964
+ return keyBuilder$b(luvio, keyParams);
1965
+ }
1966
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
1967
+ return input;
1968
+ }
1969
+ const select$a = function ContextNodeRepresentationSelect() {
1970
+ return {
1971
+ kind: 'Fragment',
1972
+ version: VERSION$2,
1973
+ private: [],
1974
+ opaque: true
1975
+ };
1976
+ };
1977
+ function equals$2(existing, incoming) {
1978
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
1979
+ return false;
1980
+ }
1981
+ return true;
1982
+ }
1983
+ function deepFreeze$5(input) {
1984
+ const input_attributes = input.attributes;
1985
+ for (let i = 0; i < input_attributes.length; i++) {
1986
+ const input_attributes_item = input_attributes[i];
1987
+ deepFreeze$6(input_attributes_item);
1988
+ }
1989
+ ObjectFreeze(input_attributes);
1990
+ const input_childNodes = input.childNodes;
1991
+ for (let i = 0; i < input_childNodes.length; i++) {
1992
+ const input_childNodes_item = input_childNodes[i];
1993
+ deepFreeze$5(input_childNodes_item);
1994
+ }
1995
+ ObjectFreeze(input_childNodes);
1996
+ const input_tags = input.tags;
1997
+ for (let i = 0; i < input_tags.length; i++) {
1998
+ const input_tags_item = input_tags[i];
1999
+ deepFreeze$7(input_tags_item);
2000
+ }
2001
+ ObjectFreeze(input_tags);
2002
+ ObjectFreeze(input);
2003
+ }
2004
+ const ingest$2 = function ContextNodeRepresentationIngest(input, path, luvio, store, timestamp) {
2005
+ if (process.env.NODE_ENV !== 'production') {
2006
+ const validateError = validate$7(input);
2007
+ if (validateError !== null) {
2008
+ throw validateError;
2009
+ }
2010
+ }
2011
+ const key = keyBuilderFromType$2(luvio, input);
2012
+ const existingRecord = store.readEntry(key);
2013
+ const ttlToUse = TTL$2;
2014
+ let incomingRecord = normalize$2(input, store.readEntry(key), {
2015
+ fullPath: key,
2016
+ parent: path.parent,
2017
+ propertyName: path.propertyName,
2018
+ ttl: ttlToUse
2019
+ });
2020
+ deepFreeze$5(input);
2021
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
2022
+ luvio.storePublish(key, incomingRecord);
2023
+ }
2024
+ {
2025
+ const storeMetadataParams = {
2026
+ ttl: ttlToUse,
2027
+ namespace: "IndustriesContext",
2028
+ version: VERSION$2,
2029
+ representationName: RepresentationType$2,
2030
+ };
2031
+ luvio.publishStoreMetadata(key, storeMetadataParams);
2032
+ }
2033
+ return createLink(key);
2034
+ };
2035
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
2036
+ const rootKeySet = new StoreKeyMap();
2037
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2038
+ const rootKey = keyBuilderFromType$2(luvio, input);
2039
+ rootKeySet.set(rootKey, {
2040
+ namespace: keyPrefix,
2041
+ representationName: RepresentationType$2,
2042
+ mergeable: false
2043
+ });
2044
+ return rootKeySet;
2045
+ }
2046
+
2047
+ function select$9(luvio, params) {
2048
+ return select$a();
2049
+ }
2050
+ function getResponseCacheKeys$a(luvio, resourceParams, response) {
2051
+ return getTypeCacheKeys$2(luvio, response);
2052
+ }
2053
+ function ingestSuccess$7(luvio, resourceParams, response) {
2054
+ const { body } = response;
2055
+ const key = keyBuilderFromType$2(luvio, body);
2056
+ luvio.storeIngest(key, ingest$2, body);
2057
+ const snapshot = luvio.storeLookup({
2058
+ recordId: key,
2059
+ node: select$9(),
2060
+ variables: {},
2061
+ });
2062
+ if (process.env.NODE_ENV !== 'production') {
2063
+ if (snapshot.state !== 'Fulfilled') {
2064
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2065
+ }
2066
+ }
2067
+ return snapshot;
2068
+ }
2069
+ function createResourceRequest$a(config) {
2070
+ const headers = {};
2071
+ return {
2072
+ baseUri: '/services/data/v58.0',
2073
+ basePath: '/connect/contextdefinition/node',
2074
+ method: 'post',
2075
+ body: config.body,
2076
+ urlParams: {},
2077
+ queryParams: {},
2078
+ headers,
2079
+ priority: 'normal',
2080
+ };
2081
+ }
2082
+
2083
+ const createContextNode_ConfigPropertyNames = {
2084
+ displayName: 'createContextNode',
2085
+ parameters: {
2086
+ required: ['contextNodeInput'],
2087
+ optional: []
2088
+ }
2089
+ };
2090
+ function createResourceParams$a(config) {
2091
+ const resourceParams = {
2092
+ body: {
2093
+ contextNodeInput: config.contextNodeInput
2094
+ }
2095
+ };
2096
+ return resourceParams;
2097
+ }
2098
+ function typeCheckConfig$a(untrustedConfig) {
2099
+ const config = {};
2100
+ const untrustedConfig_contextNodeInput = untrustedConfig.contextNodeInput;
2101
+ const referenceContextNodeInputRepresentationValidationError = validate$8(untrustedConfig_contextNodeInput);
2102
+ if (referenceContextNodeInputRepresentationValidationError === null) {
2103
+ config.contextNodeInput = untrustedConfig_contextNodeInput;
2104
+ }
2105
+ return config;
2106
+ }
2107
+ function validateAdapterConfig$a(untrustedConfig, configPropertyNames) {
2108
+ if (!untrustedIsObject(untrustedConfig)) {
2109
+ return null;
2110
+ }
2111
+ if (process.env.NODE_ENV !== 'production') {
2112
+ validateConfig(untrustedConfig, configPropertyNames);
2113
+ }
2114
+ const config = typeCheckConfig$a(untrustedConfig);
2115
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2116
+ return null;
2117
+ }
2118
+ return config;
2119
+ }
2120
+ function buildNetworkSnapshot$a(luvio, config, options) {
2121
+ const resourceParams = createResourceParams$a(config);
2122
+ const request = createResourceRequest$a(resourceParams);
2123
+ return luvio.dispatchResourceRequest(request, options)
2124
+ .then((response) => {
2125
+ return luvio.handleSuccessResponse(() => {
2126
+ const snapshot = ingestSuccess$7(luvio, resourceParams, response);
2127
+ return luvio.storeBroadcast().then(() => snapshot);
2128
+ }, () => getResponseCacheKeys$a(luvio, resourceParams, response.body));
2129
+ }, (response) => {
2130
+ deepFreeze$8(response);
2131
+ throw response;
2132
+ });
2133
+ }
2134
+ const createContextNodeAdapterFactory = (luvio) => {
2135
+ return function createContextNode(untrustedConfig) {
2136
+ const config = validateAdapterConfig$a(untrustedConfig, createContextNode_ConfigPropertyNames);
2137
+ // Invalid or incomplete config
2138
+ if (config === null) {
2139
+ throw new Error('Invalid config for "createContextNode"');
2140
+ }
2141
+ return buildNetworkSnapshot$a(luvio, config);
2142
+ };
2143
+ };
2144
+
2145
+ function keyBuilder$a(luvio, params) {
2146
+ return keyBuilder$b(luvio, {
2147
+ id: params.urlParams.contextNodeId
2148
+ });
2149
+ }
2150
+ function getResponseCacheKeys$9(luvio, resourceParams) {
2151
+ const key = keyBuilder$a(luvio, resourceParams);
2152
+ const cacheKeyMap = new StoreKeyMap();
2153
+ cacheKeyMap.set(key, {
2154
+ namespace: keyPrefix,
2155
+ representationName: RepresentationType$2,
2156
+ mergeable: false
2157
+ });
2158
+ return cacheKeyMap;
2159
+ }
2160
+ function evictSuccess$2(luvio, resourceParams) {
2161
+ const key = keyBuilder$a(luvio, resourceParams);
2162
+ luvio.storeEvict(key);
2163
+ }
2164
+ function createResourceRequest$9(config) {
2165
+ const headers = {};
2166
+ return {
2167
+ baseUri: '/services/data/v58.0',
2168
+ basePath: '/connect/contextdefinition/node/' + config.urlParams.contextNodeId + '',
2169
+ method: 'delete',
2170
+ body: null,
2171
+ urlParams: config.urlParams,
2172
+ queryParams: {},
2173
+ headers,
2174
+ priority: 'normal',
2175
+ };
2176
+ }
2177
+
2178
+ const adapterName$2 = 'deleteContextNode';
2179
+ const deleteContextNode_ConfigPropertyNames = {
2180
+ displayName: 'deleteContextNode',
2181
+ parameters: {
2182
+ required: ['contextNodeId'],
2183
+ optional: []
2184
+ }
2185
+ };
2186
+ function createResourceParams$9(config) {
2187
+ const resourceParams = {
2188
+ urlParams: {
2189
+ contextNodeId: config.contextNodeId
2190
+ }
2191
+ };
2192
+ return resourceParams;
2193
+ }
2194
+ function typeCheckConfig$9(untrustedConfig) {
2195
+ const config = {};
2196
+ const untrustedConfig_contextNodeId = untrustedConfig.contextNodeId;
2197
+ if (typeof untrustedConfig_contextNodeId === 'string') {
2198
+ config.contextNodeId = untrustedConfig_contextNodeId;
2199
+ }
2200
+ return config;
2201
+ }
2202
+ function validateAdapterConfig$9(untrustedConfig, configPropertyNames) {
2203
+ if (!untrustedIsObject(untrustedConfig)) {
2204
+ return null;
2205
+ }
2206
+ if (process.env.NODE_ENV !== 'production') {
2207
+ validateConfig(untrustedConfig, configPropertyNames);
2208
+ }
2209
+ const config = typeCheckConfig$9(untrustedConfig);
2210
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2211
+ return null;
2212
+ }
2213
+ return config;
2214
+ }
2215
+ function buildNetworkSnapshot$9(luvio, config, options) {
2216
+ const resourceParams = createResourceParams$9(config);
2217
+ const request = createResourceRequest$9(resourceParams);
2218
+ return luvio.dispatchResourceRequest(request, options)
2219
+ .then(() => {
2220
+ return luvio.handleSuccessResponse(() => {
2221
+ evictSuccess$2(luvio, resourceParams);
2222
+ return luvio.storeBroadcast();
2223
+ }, () => getResponseCacheKeys$9(luvio, resourceParams));
2224
+ }, (response) => {
2225
+ deepFreeze$8(response);
2226
+ throw response;
2227
+ });
2228
+ }
2229
+ const deleteContextNodeAdapterFactory = (luvio) => {
2230
+ return function IndustriesContextdeleteContextNode(untrustedConfig) {
2231
+ const config = validateAdapterConfig$9(untrustedConfig, deleteContextNode_ConfigPropertyNames);
2232
+ // Invalid or incomplete config
2233
+ if (config === null) {
2234
+ throw new Error(`Invalid config for "${adapterName$2}"`);
2235
+ }
2236
+ return buildNetworkSnapshot$9(luvio, config);
2237
+ };
2238
+ };
2239
+
2240
+ function select$8(luvio, params) {
2241
+ return select$a();
2242
+ }
2243
+ function keyBuilder$9(luvio, params) {
2244
+ return keyBuilder$b(luvio, {
2245
+ id: params.urlParams.contextNodeId
2246
+ });
2247
+ }
2248
+ function getResponseCacheKeys$8(luvio, resourceParams, response) {
2249
+ return getTypeCacheKeys$2(luvio, response);
2250
+ }
2251
+ function ingestSuccess$6(luvio, resourceParams, response, snapshotRefresh) {
2252
+ const { body } = response;
2253
+ const key = keyBuilder$9(luvio, resourceParams);
2254
+ luvio.storeIngest(key, ingest$2, body);
2255
+ const snapshot = luvio.storeLookup({
2256
+ recordId: key,
2257
+ node: select$8(),
2258
+ variables: {},
2259
+ }, snapshotRefresh);
2260
+ if (process.env.NODE_ENV !== 'production') {
2261
+ if (snapshot.state !== 'Fulfilled') {
2262
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2263
+ }
2264
+ }
2265
+ return snapshot;
2266
+ }
2267
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
2268
+ const key = keyBuilder$9(luvio, params);
2269
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
2270
+ const storeMetadataParams = {
2271
+ ttl: TTL$2,
2272
+ namespace: keyPrefix,
2273
+ version: VERSION$2,
2274
+ representationName: RepresentationType$2
2275
+ };
2276
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
2277
+ return errorSnapshot;
2278
+ }
2279
+ function createResourceRequest$8(config) {
2280
+ const headers = {};
2281
+ return {
2282
+ baseUri: '/services/data/v58.0',
2283
+ basePath: '/connect/contextdefinition/node/' + config.urlParams.contextNodeId + '',
2284
+ method: 'get',
2285
+ body: null,
2286
+ urlParams: config.urlParams,
2287
+ queryParams: {},
2288
+ headers,
2289
+ priority: 'normal',
2290
+ };
2291
+ }
2292
+
2293
+ const getContextNode_ConfigPropertyNames = {
2294
+ displayName: 'getContextNode',
2295
+ parameters: {
2296
+ required: ['contextNodeId'],
2297
+ optional: []
2298
+ }
2299
+ };
2300
+ function createResourceParams$8(config) {
2301
+ const resourceParams = {
2302
+ urlParams: {
2303
+ contextNodeId: config.contextNodeId
2304
+ }
2305
+ };
2306
+ return resourceParams;
2307
+ }
2308
+ function keyBuilder$8(luvio, config) {
2309
+ const resourceParams = createResourceParams$8(config);
2310
+ return keyBuilder$9(luvio, resourceParams);
2311
+ }
2312
+ function typeCheckConfig$8(untrustedConfig) {
2313
+ const config = {};
2314
+ const untrustedConfig_contextNodeId = untrustedConfig.contextNodeId;
2315
+ if (typeof untrustedConfig_contextNodeId === 'string') {
2316
+ config.contextNodeId = untrustedConfig_contextNodeId;
2317
+ }
2318
+ return config;
2319
+ }
2320
+ function validateAdapterConfig$8(untrustedConfig, configPropertyNames) {
2321
+ if (!untrustedIsObject(untrustedConfig)) {
2322
+ return null;
2323
+ }
2324
+ if (process.env.NODE_ENV !== 'production') {
2325
+ validateConfig(untrustedConfig, configPropertyNames);
2326
+ }
2327
+ const config = typeCheckConfig$8(untrustedConfig);
2328
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2329
+ return null;
2330
+ }
2331
+ return config;
2332
+ }
2333
+ function adapterFragment$2(luvio, config) {
2334
+ createResourceParams$8(config);
2335
+ return select$8();
2336
+ }
2337
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
2338
+ const snapshot = ingestSuccess$6(luvio, resourceParams, response, {
2339
+ config,
2340
+ resolve: () => buildNetworkSnapshot$8(luvio, config, snapshotRefreshOptions)
2341
+ });
2342
+ return luvio.storeBroadcast().then(() => snapshot);
2343
+ }
2344
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
2345
+ const snapshot = ingestError$2(luvio, resourceParams, response, {
2346
+ config,
2347
+ resolve: () => buildNetworkSnapshot$8(luvio, config, snapshotRefreshOptions)
2348
+ });
2349
+ return luvio.storeBroadcast().then(() => snapshot);
2350
+ }
2351
+ function buildNetworkSnapshot$8(luvio, config, options) {
2352
+ const resourceParams = createResourceParams$8(config);
2353
+ const request = createResourceRequest$8(resourceParams);
2354
+ return luvio.dispatchResourceRequest(request, options)
2355
+ .then((response) => {
2356
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$2(luvio, config, resourceParams, response), () => getResponseCacheKeys$8(luvio, resourceParams, response.body));
2357
+ }, (response) => {
2358
+ return luvio.handleErrorResponse(() => onFetchResponseError$2(luvio, config, resourceParams, response));
2359
+ });
2360
+ }
2361
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
2362
+ const { luvio, config } = context;
2363
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
2364
+ const dispatchOptions = {
2365
+ resourceRequestContext: {
2366
+ requestCorrelator,
2367
+ luvioRequestMethod: undefined,
2368
+ },
2369
+ eventObservers
2370
+ };
2371
+ if (networkPriority !== 'normal') {
2372
+ dispatchOptions.overrides = {
2373
+ priority: networkPriority
2374
+ };
2375
+ }
2376
+ return buildNetworkSnapshot$8(luvio, config, dispatchOptions);
2377
+ }
2378
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
2379
+ const { luvio, config } = context;
2380
+ const selector = {
2381
+ recordId: keyBuilder$8(luvio, config),
2382
+ node: adapterFragment$2(luvio, config),
2383
+ variables: {},
2384
+ };
2385
+ const cacheSnapshot = storeLookup(selector, {
2386
+ config,
2387
+ resolve: () => buildNetworkSnapshot$8(luvio, config, snapshotRefreshOptions)
2388
+ });
2389
+ return cacheSnapshot;
2390
+ }
2391
+ const getContextNodeAdapterFactory = (luvio) => function IndustriesContext__getContextNode(untrustedConfig, requestContext) {
2392
+ const config = validateAdapterConfig$8(untrustedConfig, getContextNode_ConfigPropertyNames);
2393
+ // Invalid or incomplete config
2394
+ if (config === null) {
2395
+ return null;
2396
+ }
2397
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
2398
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
2399
+ };
2400
+
2401
+ function select$7(luvio, params) {
2402
+ return select$a();
2403
+ }
2404
+ function getResponseCacheKeys$7(luvio, resourceParams, response) {
2405
+ return getTypeCacheKeys$2(luvio, response);
2406
+ }
2407
+ function ingestSuccess$5(luvio, resourceParams, response) {
2408
+ const { body } = response;
2409
+ const key = keyBuilderFromType$2(luvio, body);
2410
+ luvio.storeIngest(key, ingest$2, body);
2411
+ const snapshot = luvio.storeLookup({
2412
+ recordId: key,
2413
+ node: select$7(),
2414
+ variables: {},
2415
+ });
2416
+ if (process.env.NODE_ENV !== 'production') {
2417
+ if (snapshot.state !== 'Fulfilled') {
2418
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2419
+ }
2420
+ }
2421
+ return snapshot;
2422
+ }
2423
+ function createResourceRequest$7(config) {
2424
+ const headers = {};
2425
+ return {
2426
+ baseUri: '/services/data/v58.0',
2427
+ basePath: '/connect/contextdefinition/node/' + config.urlParams.contextNodeId + '',
2428
+ method: 'patch',
2429
+ body: config.body,
2430
+ urlParams: config.urlParams,
2431
+ queryParams: {},
2432
+ headers,
2433
+ priority: 'normal',
2434
+ };
2435
+ }
2436
+
2437
+ const updateContextNode_ConfigPropertyNames = {
2438
+ displayName: 'updateContextNode',
2439
+ parameters: {
2440
+ required: ['contextNodeId', 'contextNodeInput'],
2441
+ optional: []
2442
+ }
2443
+ };
2444
+ function createResourceParams$7(config) {
2445
+ const resourceParams = {
2446
+ urlParams: {
2447
+ contextNodeId: config.contextNodeId
2448
+ },
2449
+ body: {
2450
+ contextNodeInput: config.contextNodeInput
2451
+ }
2452
+ };
2453
+ return resourceParams;
2454
+ }
2455
+ function typeCheckConfig$7(untrustedConfig) {
2456
+ const config = {};
2457
+ const untrustedConfig_contextNodeId = untrustedConfig.contextNodeId;
2458
+ if (typeof untrustedConfig_contextNodeId === 'string') {
2459
+ config.contextNodeId = untrustedConfig_contextNodeId;
2460
+ }
2461
+ const untrustedConfig_contextNodeInput = untrustedConfig.contextNodeInput;
2462
+ const referenceContextNodeInputRepresentationValidationError = validate$8(untrustedConfig_contextNodeInput);
2463
+ if (referenceContextNodeInputRepresentationValidationError === null) {
2464
+ config.contextNodeInput = untrustedConfig_contextNodeInput;
2465
+ }
2466
+ return config;
2467
+ }
2468
+ function validateAdapterConfig$7(untrustedConfig, configPropertyNames) {
2469
+ if (!untrustedIsObject(untrustedConfig)) {
2470
+ return null;
2471
+ }
2472
+ if (process.env.NODE_ENV !== 'production') {
2473
+ validateConfig(untrustedConfig, configPropertyNames);
2474
+ }
2475
+ const config = typeCheckConfig$7(untrustedConfig);
2476
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2477
+ return null;
2478
+ }
2479
+ return config;
2480
+ }
2481
+ function buildNetworkSnapshot$7(luvio, config, options) {
2482
+ const resourceParams = createResourceParams$7(config);
2483
+ const request = createResourceRequest$7(resourceParams);
2484
+ return luvio.dispatchResourceRequest(request, options)
2485
+ .then((response) => {
2486
+ return luvio.handleSuccessResponse(() => {
2487
+ const snapshot = ingestSuccess$5(luvio, resourceParams, response);
2488
+ return luvio.storeBroadcast().then(() => snapshot);
2489
+ }, () => getResponseCacheKeys$7(luvio, resourceParams, response.body));
2490
+ }, (response) => {
2491
+ deepFreeze$8(response);
2492
+ throw response;
2493
+ });
2494
+ }
2495
+ const updateContextNodeAdapterFactory = (luvio) => {
2496
+ return function updateContextNode(untrustedConfig) {
2497
+ const config = validateAdapterConfig$7(untrustedConfig, updateContextNode_ConfigPropertyNames);
2498
+ // Invalid or incomplete config
2499
+ if (config === null) {
2500
+ throw new Error('Invalid config for "updateContextNode"');
2501
+ }
2502
+ return buildNetworkSnapshot$7(luvio, config);
2503
+ };
2504
+ };
2505
+
2506
+ function validate$6(obj, path = 'ContextDefinitionVersionInputRepresentation') {
2507
+ const v_error = (() => {
2508
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2509
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2510
+ }
2511
+ const obj_contextDefinitionId = obj.contextDefinitionId;
2512
+ const path_contextDefinitionId = path + '.contextDefinitionId';
2513
+ if (typeof obj_contextDefinitionId !== 'string') {
2514
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionId + '" (at "' + path_contextDefinitionId + '")');
2515
+ }
2516
+ if (obj.contextMappings !== undefined) {
2517
+ const obj_contextMappings = obj.contextMappings;
2518
+ const path_contextMappings = path + '.contextMappings';
2519
+ if (!ArrayIsArray(obj_contextMappings)) {
2520
+ return new TypeError('Expected "array" but received "' + typeof obj_contextMappings + '" (at "' + path_contextMappings + '")');
2521
+ }
2522
+ for (let i = 0; i < obj_contextMappings.length; i++) {
2523
+ const obj_contextMappings_item = obj_contextMappings[i];
2524
+ const path_contextMappings_item = path_contextMappings + '[' + i + ']';
2525
+ if (typeof obj_contextMappings_item !== 'object' || ArrayIsArray(obj_contextMappings_item) || obj_contextMappings_item === null) {
2526
+ return new TypeError('Expected "object" but received "' + typeof obj_contextMappings_item + '" (at "' + path_contextMappings_item + '")');
2527
+ }
2528
+ }
2529
+ }
2530
+ if (obj.contextNodes !== undefined) {
2531
+ const obj_contextNodes = obj.contextNodes;
2532
+ const path_contextNodes = path + '.contextNodes';
2533
+ if (!ArrayIsArray(obj_contextNodes)) {
2534
+ return new TypeError('Expected "array" but received "' + typeof obj_contextNodes + '" (at "' + path_contextNodes + '")');
2535
+ }
2536
+ for (let i = 0; i < obj_contextNodes.length; i++) {
2537
+ const obj_contextNodes_item = obj_contextNodes[i];
2538
+ const path_contextNodes_item = path_contextNodes + '[' + i + ']';
2539
+ if (typeof obj_contextNodes_item !== 'object' || ArrayIsArray(obj_contextNodes_item) || obj_contextNodes_item === null) {
2540
+ return new TypeError('Expected "object" but received "' + typeof obj_contextNodes_item + '" (at "' + path_contextNodes_item + '")');
2541
+ }
2542
+ }
2543
+ }
2544
+ if (obj.definition !== undefined) {
2545
+ const obj_definition = obj.definition;
2546
+ const path_definition = path + '.definition';
2547
+ if (typeof obj_definition !== 'string') {
2548
+ return new TypeError('Expected "string" but received "' + typeof obj_definition + '" (at "' + path_definition + '")');
2549
+ }
2550
+ }
2551
+ if (obj.description !== undefined) {
2552
+ const obj_description = obj.description;
2553
+ const path_description = path + '.description';
2554
+ if (typeof obj_description !== 'string') {
2555
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
2556
+ }
2557
+ }
2558
+ if (obj.endDate !== undefined) {
2559
+ const obj_endDate = obj.endDate;
2560
+ const path_endDate = path + '.endDate';
2561
+ if (typeof obj_endDate !== 'string') {
2562
+ return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
2563
+ }
2564
+ }
2565
+ if (obj.isActive !== undefined) {
2566
+ const obj_isActive = obj.isActive;
2567
+ const path_isActive = path + '.isActive';
2568
+ if (typeof obj_isActive !== 'boolean') {
2569
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isActive + '" (at "' + path_isActive + '")');
2570
+ }
2571
+ }
2572
+ if (obj.startDate !== undefined) {
2573
+ const obj_startDate = obj.startDate;
2574
+ const path_startDate = path + '.startDate';
2575
+ if (typeof obj_startDate !== 'string') {
2576
+ return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
2577
+ }
2578
+ }
2579
+ })();
2580
+ return v_error === undefined ? null : v_error;
2581
+ }
2582
+
2583
+ function validate$5(obj, path = 'ContextAttrHydrationDetailRepresentation') {
2584
+ const v_error = (() => {
2585
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2586
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2587
+ }
2588
+ const obj_contextAttrHydrationDetailId = obj.contextAttrHydrationDetailId;
2589
+ const path_contextAttrHydrationDetailId = path + '.contextAttrHydrationDetailId';
2590
+ if (typeof obj_contextAttrHydrationDetailId !== 'string') {
2591
+ return new TypeError('Expected "string" but received "' + typeof obj_contextAttrHydrationDetailId + '" (at "' + path_contextAttrHydrationDetailId + '")');
2592
+ }
2593
+ const obj_isSuccess = obj.isSuccess;
2594
+ const path_isSuccess = path + '.isSuccess';
2595
+ if (typeof obj_isSuccess !== 'boolean') {
2596
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
2597
+ }
2598
+ const obj_parentDetails = obj.parentDetails;
2599
+ const path_parentDetails = path + '.parentDetails';
2600
+ if (!ArrayIsArray(obj_parentDetails)) {
2601
+ return new TypeError('Expected "array" but received "' + typeof obj_parentDetails + '" (at "' + path_parentDetails + '")');
2602
+ }
2603
+ for (let i = 0; i < obj_parentDetails.length; i++) {
2604
+ const obj_parentDetails_item = obj_parentDetails[i];
2605
+ const path_parentDetails_item = path_parentDetails + '[' + i + ']';
2606
+ const referencepath_parentDetails_itemValidationError = validate$5(obj_parentDetails_item, path_parentDetails_item);
2607
+ if (referencepath_parentDetails_itemValidationError !== null) {
2608
+ let message = 'Object doesn\'t match ContextAttrHydrationDetailRepresentation (at "' + path_parentDetails_item + '")\n';
2609
+ message += referencepath_parentDetails_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2610
+ return new TypeError(message);
2611
+ }
2612
+ }
2613
+ const obj_parentMappingAttributeId = obj.parentMappingAttributeId;
2614
+ const path_parentMappingAttributeId = path + '.parentMappingAttributeId';
2615
+ if (typeof obj_parentMappingAttributeId !== 'string') {
2616
+ return new TypeError('Expected "string" but received "' + typeof obj_parentMappingAttributeId + '" (at "' + path_parentMappingAttributeId + '")');
2617
+ }
2618
+ const obj_queryAttribute = obj.queryAttribute;
2619
+ const path_queryAttribute = path + '.queryAttribute';
2620
+ if (typeof obj_queryAttribute !== 'string') {
2621
+ return new TypeError('Expected "string" but received "' + typeof obj_queryAttribute + '" (at "' + path_queryAttribute + '")');
2622
+ }
2623
+ const obj_sObjectDomain = obj.sObjectDomain;
2624
+ const path_sObjectDomain = path + '.sObjectDomain';
2625
+ if (typeof obj_sObjectDomain !== 'string') {
2626
+ return new TypeError('Expected "string" but received "' + typeof obj_sObjectDomain + '" (at "' + path_sObjectDomain + '")');
2627
+ }
2628
+ })();
2629
+ return v_error === undefined ? null : v_error;
2630
+ }
2631
+ function deepFreeze$4(input) {
2632
+ const input_parentDetails = input.parentDetails;
2633
+ for (let i = 0; i < input_parentDetails.length; i++) {
2634
+ const input_parentDetails_item = input_parentDetails[i];
2635
+ deepFreeze$4(input_parentDetails_item);
2636
+ }
2637
+ ObjectFreeze(input_parentDetails);
2638
+ ObjectFreeze(input);
2639
+ }
2640
+
2641
+ function validate$4(obj, path = 'ContextAttributeMappingRepresentation') {
2642
+ const v_error = (() => {
2643
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2644
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2645
+ }
2646
+ const obj_contextAttrHydrationDetailList = obj.contextAttrHydrationDetailList;
2647
+ const path_contextAttrHydrationDetailList = path + '.contextAttrHydrationDetailList';
2648
+ if (!ArrayIsArray(obj_contextAttrHydrationDetailList)) {
2649
+ return new TypeError('Expected "array" but received "' + typeof obj_contextAttrHydrationDetailList + '" (at "' + path_contextAttrHydrationDetailList + '")');
2650
+ }
2651
+ for (let i = 0; i < obj_contextAttrHydrationDetailList.length; i++) {
2652
+ const obj_contextAttrHydrationDetailList_item = obj_contextAttrHydrationDetailList[i];
2653
+ const path_contextAttrHydrationDetailList_item = path_contextAttrHydrationDetailList + '[' + i + ']';
2654
+ const referencepath_contextAttrHydrationDetailList_itemValidationError = validate$5(obj_contextAttrHydrationDetailList_item, path_contextAttrHydrationDetailList_item);
2655
+ if (referencepath_contextAttrHydrationDetailList_itemValidationError !== null) {
2656
+ let message = 'Object doesn\'t match ContextAttrHydrationDetailRepresentation (at "' + path_contextAttrHydrationDetailList_item + '")\n';
2657
+ message += referencepath_contextAttrHydrationDetailList_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2658
+ return new TypeError(message);
2659
+ }
2660
+ }
2661
+ const obj_contextAttributeId = obj.contextAttributeId;
2662
+ const path_contextAttributeId = path + '.contextAttributeId';
2663
+ if (typeof obj_contextAttributeId !== 'string') {
2664
+ return new TypeError('Expected "string" but received "' + typeof obj_contextAttributeId + '" (at "' + path_contextAttributeId + '")');
2665
+ }
2666
+ const obj_contextAttributeMappingId = obj.contextAttributeMappingId;
2667
+ const path_contextAttributeMappingId = path + '.contextAttributeMappingId';
2668
+ if (typeof obj_contextAttributeMappingId !== 'string') {
2669
+ return new TypeError('Expected "string" but received "' + typeof obj_contextAttributeMappingId + '" (at "' + path_contextAttributeMappingId + '")');
2670
+ }
2671
+ const obj_contextInputAttributeId = obj.contextInputAttributeId;
2672
+ const path_contextInputAttributeId = path + '.contextInputAttributeId';
2673
+ if (typeof obj_contextInputAttributeId !== 'string') {
2674
+ return new TypeError('Expected "string" but received "' + typeof obj_contextInputAttributeId + '" (at "' + path_contextInputAttributeId + '")');
2675
+ }
2676
+ const obj_hydrationSource = obj.hydrationSource;
2677
+ const path_hydrationSource = path + '.hydrationSource';
2678
+ if (typeof obj_hydrationSource !== 'string') {
2679
+ return new TypeError('Expected "string" but received "' + typeof obj_hydrationSource + '" (at "' + path_hydrationSource + '")');
2680
+ }
2681
+ const obj_isSuccess = obj.isSuccess;
2682
+ const path_isSuccess = path + '.isSuccess';
2683
+ if (typeof obj_isSuccess !== 'boolean') {
2684
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
2685
+ }
2686
+ const obj_parentNodeMappingId = obj.parentNodeMappingId;
2687
+ const path_parentNodeMappingId = path + '.parentNodeMappingId';
2688
+ if (typeof obj_parentNodeMappingId !== 'string') {
2689
+ return new TypeError('Expected "string" but received "' + typeof obj_parentNodeMappingId + '" (at "' + path_parentNodeMappingId + '")');
2690
+ }
2691
+ })();
2692
+ return v_error === undefined ? null : v_error;
2693
+ }
2694
+ function deepFreeze$3(input) {
2695
+ const input_contextAttrHydrationDetailList = input.contextAttrHydrationDetailList;
2696
+ for (let i = 0; i < input_contextAttrHydrationDetailList.length; i++) {
2697
+ const input_contextAttrHydrationDetailList_item = input_contextAttrHydrationDetailList[i];
2698
+ deepFreeze$4(input_contextAttrHydrationDetailList_item);
2699
+ }
2700
+ ObjectFreeze(input_contextAttrHydrationDetailList);
2701
+ ObjectFreeze(input);
2702
+ }
2703
+
2704
+ function validate$3(obj, path = 'ContextNodeMappingRepresentation') {
2705
+ const v_error = (() => {
2706
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2707
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2708
+ }
2709
+ const obj_attributeMappings = obj.attributeMappings;
2710
+ const path_attributeMappings = path + '.attributeMappings';
2711
+ if (!ArrayIsArray(obj_attributeMappings)) {
2712
+ return new TypeError('Expected "array" but received "' + typeof obj_attributeMappings + '" (at "' + path_attributeMappings + '")');
2713
+ }
2714
+ for (let i = 0; i < obj_attributeMappings.length; i++) {
2715
+ const obj_attributeMappings_item = obj_attributeMappings[i];
2716
+ const path_attributeMappings_item = path_attributeMappings + '[' + i + ']';
2717
+ const referencepath_attributeMappings_itemValidationError = validate$4(obj_attributeMappings_item, path_attributeMappings_item);
2718
+ if (referencepath_attributeMappings_itemValidationError !== null) {
2719
+ let message = 'Object doesn\'t match ContextAttributeMappingRepresentation (at "' + path_attributeMappings_item + '")\n';
2720
+ message += referencepath_attributeMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2721
+ return new TypeError(message);
2722
+ }
2723
+ }
2724
+ const obj_businessObjectTypeId = obj.businessObjectTypeId;
2725
+ const path_businessObjectTypeId = path + '.businessObjectTypeId';
2726
+ if (typeof obj_businessObjectTypeId !== 'string') {
2727
+ return new TypeError('Expected "string" but received "' + typeof obj_businessObjectTypeId + '" (at "' + path_businessObjectTypeId + '")');
2728
+ }
2729
+ const obj_contextInputNodeId = obj.contextInputNodeId;
2730
+ const path_contextInputNodeId = path + '.contextInputNodeId';
2731
+ if (typeof obj_contextInputNodeId !== 'string') {
2732
+ return new TypeError('Expected "string" but received "' + typeof obj_contextInputNodeId + '" (at "' + path_contextInputNodeId + '")');
2733
+ }
2734
+ const obj_contextMappingId = obj.contextMappingId;
2735
+ const path_contextMappingId = path + '.contextMappingId';
2736
+ if (typeof obj_contextMappingId !== 'string') {
2737
+ return new TypeError('Expected "string" but received "' + typeof obj_contextMappingId + '" (at "' + path_contextMappingId + '")');
2738
+ }
2739
+ const obj_contextNodeId = obj.contextNodeId;
2740
+ const path_contextNodeId = path + '.contextNodeId';
2741
+ if (typeof obj_contextNodeId !== 'string') {
2742
+ return new TypeError('Expected "string" but received "' + typeof obj_contextNodeId + '" (at "' + path_contextNodeId + '")');
2743
+ }
2744
+ const obj_contextNodeMappingId = obj.contextNodeMappingId;
2745
+ const path_contextNodeMappingId = path + '.contextNodeMappingId';
2746
+ if (typeof obj_contextNodeMappingId !== 'string') {
2747
+ return new TypeError('Expected "string" but received "' + typeof obj_contextNodeMappingId + '" (at "' + path_contextNodeMappingId + '")');
2748
+ }
2749
+ const obj_isSuccess = obj.isSuccess;
2750
+ const path_isSuccess = path + '.isSuccess';
2751
+ if (typeof obj_isSuccess !== 'boolean') {
2752
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
2753
+ }
2754
+ const obj_sObjectName = obj.sObjectName;
2755
+ const path_sObjectName = path + '.sObjectName';
2756
+ if (typeof obj_sObjectName !== 'string') {
2757
+ return new TypeError('Expected "string" but received "' + typeof obj_sObjectName + '" (at "' + path_sObjectName + '")');
2758
+ }
2759
+ })();
2760
+ return v_error === undefined ? null : v_error;
2761
+ }
2762
+ function deepFreeze$2(input) {
2763
+ const input_attributeMappings = input.attributeMappings;
2764
+ for (let i = 0; i < input_attributeMappings.length; i++) {
2765
+ const input_attributeMappings_item = input_attributeMappings[i];
2766
+ deepFreeze$3(input_attributeMappings_item);
2767
+ }
2768
+ ObjectFreeze(input_attributeMappings);
2769
+ ObjectFreeze(input);
2770
+ }
2771
+
2772
+ function validate$2(obj, path = 'ContextMappingRepresentation') {
2773
+ const v_error = (() => {
2774
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2775
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2776
+ }
2777
+ const obj_contextDefinitionVersionId = obj.contextDefinitionVersionId;
2778
+ const path_contextDefinitionVersionId = path + '.contextDefinitionVersionId';
2779
+ if (typeof obj_contextDefinitionVersionId !== 'string') {
2780
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionVersionId + '" (at "' + path_contextDefinitionVersionId + '")');
2781
+ }
2782
+ const obj_contextMappingId = obj.contextMappingId;
2783
+ const path_contextMappingId = path + '.contextMappingId';
2784
+ if (typeof obj_contextMappingId !== 'string') {
2785
+ return new TypeError('Expected "string" but received "' + typeof obj_contextMappingId + '" (at "' + path_contextMappingId + '")');
2786
+ }
2787
+ const obj_contextNodeMappings = obj.contextNodeMappings;
2788
+ const path_contextNodeMappings = path + '.contextNodeMappings';
2789
+ if (!ArrayIsArray(obj_contextNodeMappings)) {
2790
+ return new TypeError('Expected "array" but received "' + typeof obj_contextNodeMappings + '" (at "' + path_contextNodeMappings + '")');
2791
+ }
2792
+ for (let i = 0; i < obj_contextNodeMappings.length; i++) {
2793
+ const obj_contextNodeMappings_item = obj_contextNodeMappings[i];
2794
+ const path_contextNodeMappings_item = path_contextNodeMappings + '[' + i + ']';
2795
+ const referencepath_contextNodeMappings_itemValidationError = validate$3(obj_contextNodeMappings_item, path_contextNodeMappings_item);
2796
+ if (referencepath_contextNodeMappings_itemValidationError !== null) {
2797
+ let message = 'Object doesn\'t match ContextNodeMappingRepresentation (at "' + path_contextNodeMappings_item + '")\n';
2798
+ message += referencepath_contextNodeMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2799
+ return new TypeError(message);
2800
+ }
2801
+ }
2802
+ const obj_description = obj.description;
2803
+ const path_description = path + '.description';
2804
+ if (typeof obj_description !== 'string') {
2805
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
2806
+ }
2807
+ const obj_isSuccess = obj.isSuccess;
2808
+ const path_isSuccess = path + '.isSuccess';
2809
+ if (typeof obj_isSuccess !== 'boolean') {
2810
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
2811
+ }
2812
+ const obj_name = obj.name;
2813
+ const path_name = path + '.name';
2814
+ if (typeof obj_name !== 'string') {
2815
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
2816
+ }
2817
+ })();
2818
+ return v_error === undefined ? null : v_error;
2819
+ }
2820
+ function deepFreeze$1(input) {
2821
+ const input_contextNodeMappings = input.contextNodeMappings;
2822
+ for (let i = 0; i < input_contextNodeMappings.length; i++) {
2823
+ const input_contextNodeMappings_item = input_contextNodeMappings[i];
2824
+ deepFreeze$2(input_contextNodeMappings_item);
2825
+ }
2826
+ ObjectFreeze(input_contextNodeMappings);
2827
+ ObjectFreeze(input);
2828
+ }
2829
+
2830
+ const TTL$1 = 30000;
2831
+ const VERSION$1 = "83a62f2a41f46f52ba3d412d65504cd7";
2832
+ function validate$1(obj, path = 'ContextDefinitionVersionRepresentation') {
2833
+ const v_error = (() => {
2834
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2835
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2836
+ }
2837
+ const obj_contextDefinitionId = obj.contextDefinitionId;
2838
+ const path_contextDefinitionId = path + '.contextDefinitionId';
2839
+ if (typeof obj_contextDefinitionId !== 'string') {
2840
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionId + '" (at "' + path_contextDefinitionId + '")');
2841
+ }
2842
+ const obj_contextDefinitionVersionId = obj.contextDefinitionVersionId;
2843
+ const path_contextDefinitionVersionId = path + '.contextDefinitionVersionId';
2844
+ if (typeof obj_contextDefinitionVersionId !== 'string') {
2845
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionVersionId + '" (at "' + path_contextDefinitionVersionId + '")');
2846
+ }
2847
+ const obj_contextMappings = obj.contextMappings;
2848
+ const path_contextMappings = path + '.contextMappings';
2849
+ if (!ArrayIsArray(obj_contextMappings)) {
2850
+ return new TypeError('Expected "array" but received "' + typeof obj_contextMappings + '" (at "' + path_contextMappings + '")');
2851
+ }
2852
+ for (let i = 0; i < obj_contextMappings.length; i++) {
2853
+ const obj_contextMappings_item = obj_contextMappings[i];
2854
+ const path_contextMappings_item = path_contextMappings + '[' + i + ']';
2855
+ const referencepath_contextMappings_itemValidationError = validate$2(obj_contextMappings_item, path_contextMappings_item);
2856
+ if (referencepath_contextMappings_itemValidationError !== null) {
2857
+ let message = 'Object doesn\'t match ContextMappingRepresentation (at "' + path_contextMappings_item + '")\n';
2858
+ message += referencepath_contextMappings_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2859
+ return new TypeError(message);
2860
+ }
2861
+ }
2862
+ const obj_contextNodes = obj.contextNodes;
2863
+ const path_contextNodes = path + '.contextNodes';
2864
+ if (!ArrayIsArray(obj_contextNodes)) {
2865
+ return new TypeError('Expected "array" but received "' + typeof obj_contextNodes + '" (at "' + path_contextNodes + '")');
2866
+ }
2867
+ for (let i = 0; i < obj_contextNodes.length; i++) {
2868
+ const obj_contextNodes_item = obj_contextNodes[i];
2869
+ const path_contextNodes_item = path_contextNodes + '[' + i + ']';
2870
+ const referencepath_contextNodes_itemValidationError = validate$7(obj_contextNodes_item, path_contextNodes_item);
2871
+ if (referencepath_contextNodes_itemValidationError !== null) {
2872
+ let message = 'Object doesn\'t match ContextNodeRepresentation (at "' + path_contextNodes_item + '")\n';
2873
+ message += referencepath_contextNodes_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
2874
+ return new TypeError(message);
2875
+ }
2876
+ }
2877
+ if (obj.definition !== undefined) {
2878
+ const obj_definition = obj.definition;
2879
+ const path_definition = path + '.definition';
2880
+ if (typeof obj_definition !== 'string') {
2881
+ return new TypeError('Expected "string" but received "' + typeof obj_definition + '" (at "' + path_definition + '")');
2882
+ }
2883
+ }
2884
+ if (obj.description !== undefined) {
2885
+ const obj_description = obj.description;
2886
+ const path_description = path + '.description';
2887
+ if (typeof obj_description !== 'string') {
2888
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
2889
+ }
2890
+ }
2891
+ if (obj.endDate !== undefined) {
2892
+ const obj_endDate = obj.endDate;
2893
+ const path_endDate = path + '.endDate';
2894
+ if (typeof obj_endDate !== 'string') {
2895
+ return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
2896
+ }
2897
+ }
2898
+ const obj_isActive = obj.isActive;
2899
+ const path_isActive = path + '.isActive';
2900
+ if (typeof obj_isActive !== 'boolean') {
2901
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isActive + '" (at "' + path_isActive + '")');
2902
+ }
2903
+ if (obj.isSuccess !== undefined) {
2904
+ const obj_isSuccess = obj.isSuccess;
2905
+ const path_isSuccess = path + '.isSuccess';
2906
+ if (typeof obj_isSuccess !== 'boolean') {
2907
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
2908
+ }
2909
+ }
2910
+ if (obj.startDate !== undefined) {
2911
+ const obj_startDate = obj.startDate;
2912
+ const path_startDate = path + '.startDate';
2913
+ if (typeof obj_startDate !== 'string') {
2914
+ return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
2915
+ }
2916
+ }
2917
+ if (obj.versionNumber !== undefined) {
2918
+ const obj_versionNumber = obj.versionNumber;
2919
+ const path_versionNumber = path + '.versionNumber';
2920
+ if (typeof obj_versionNumber !== 'number' || (typeof obj_versionNumber === 'number' && Math.floor(obj_versionNumber) !== obj_versionNumber)) {
2921
+ return new TypeError('Expected "integer" but received "' + typeof obj_versionNumber + '" (at "' + path_versionNumber + '")');
2922
+ }
2923
+ }
2924
+ })();
2925
+ return v_error === undefined ? null : v_error;
2926
+ }
2927
+ const RepresentationType$1 = 'ContextDefinitionVersionRepresentation';
2928
+ function keyBuilder$7(luvio, config) {
2929
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.id;
2930
+ }
2931
+ function keyBuilderFromType$1(luvio, object) {
2932
+ const keyParams = {
2933
+ id: object.contextDefinitionVersionId
2934
+ };
2935
+ return keyBuilder$7(luvio, keyParams);
2936
+ }
2937
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
2938
+ return input;
2939
+ }
2940
+ const select$6 = function ContextDefinitionVersionRepresentationSelect() {
2941
+ return {
2942
+ kind: 'Fragment',
2943
+ version: VERSION$1,
2944
+ private: [],
2945
+ opaque: true
2946
+ };
2947
+ };
2948
+ function equals$1(existing, incoming) {
2949
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
2950
+ return false;
2951
+ }
2952
+ return true;
2953
+ }
2954
+ function deepFreeze(input) {
2955
+ const input_contextMappings = input.contextMappings;
2956
+ for (let i = 0; i < input_contextMappings.length; i++) {
2957
+ const input_contextMappings_item = input_contextMappings[i];
2958
+ deepFreeze$1(input_contextMappings_item);
2959
+ }
2960
+ ObjectFreeze(input_contextMappings);
2961
+ const input_contextNodes = input.contextNodes;
2962
+ for (let i = 0; i < input_contextNodes.length; i++) {
2963
+ const input_contextNodes_item = input_contextNodes[i];
2964
+ deepFreeze$5(input_contextNodes_item);
2965
+ }
2966
+ ObjectFreeze(input_contextNodes);
2967
+ ObjectFreeze(input);
2968
+ }
2969
+ const ingest$1 = function ContextDefinitionVersionRepresentationIngest(input, path, luvio, store, timestamp) {
2970
+ if (process.env.NODE_ENV !== 'production') {
2971
+ const validateError = validate$1(input);
2972
+ if (validateError !== null) {
2973
+ throw validateError;
2974
+ }
2975
+ }
2976
+ const key = keyBuilderFromType$1(luvio, input);
2977
+ const existingRecord = store.readEntry(key);
2978
+ const ttlToUse = TTL$1;
2979
+ let incomingRecord = normalize$1(input, store.readEntry(key), {
2980
+ fullPath: key,
2981
+ parent: path.parent,
2982
+ propertyName: path.propertyName,
2983
+ ttl: ttlToUse
2984
+ });
2985
+ deepFreeze(input);
2986
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
2987
+ luvio.storePublish(key, incomingRecord);
2988
+ }
2989
+ {
2990
+ const storeMetadataParams = {
2991
+ ttl: ttlToUse,
2992
+ namespace: "IndustriesContext",
2993
+ version: VERSION$1,
2994
+ representationName: RepresentationType$1,
2995
+ };
2996
+ luvio.publishStoreMetadata(key, storeMetadataParams);
2997
+ }
2998
+ return createLink(key);
2999
+ };
3000
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
3001
+ const rootKeySet = new StoreKeyMap();
3002
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
3003
+ const rootKey = keyBuilderFromType$1(luvio, input);
3004
+ rootKeySet.set(rootKey, {
3005
+ namespace: keyPrefix,
3006
+ representationName: RepresentationType$1,
3007
+ mergeable: false
3008
+ });
3009
+ return rootKeySet;
3010
+ }
3011
+
3012
+ function select$5(luvio, params) {
3013
+ return select$6();
3014
+ }
3015
+ function getResponseCacheKeys$6(luvio, resourceParams, response) {
3016
+ return getTypeCacheKeys$1(luvio, response);
3017
+ }
3018
+ function ingestSuccess$4(luvio, resourceParams, response) {
3019
+ const { body } = response;
3020
+ const key = keyBuilderFromType$1(luvio, body);
3021
+ luvio.storeIngest(key, ingest$1, body);
3022
+ const snapshot = luvio.storeLookup({
3023
+ recordId: key,
3024
+ node: select$5(),
3025
+ variables: {},
3026
+ });
3027
+ if (process.env.NODE_ENV !== 'production') {
3028
+ if (snapshot.state !== 'Fulfilled') {
3029
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3030
+ }
3031
+ }
3032
+ return snapshot;
3033
+ }
3034
+ function createResourceRequest$6(config) {
3035
+ const headers = {};
3036
+ return {
3037
+ baseUri: '/services/data/v58.0',
3038
+ basePath: '/connect/contextdefinition/version',
3039
+ method: 'post',
3040
+ body: config.body,
3041
+ urlParams: {},
3042
+ queryParams: {},
3043
+ headers,
3044
+ priority: 'normal',
3045
+ };
3046
+ }
3047
+
3048
+ const createContextDefinitionVersion_ConfigPropertyNames = {
3049
+ displayName: 'createContextDefinitionVersion',
3050
+ parameters: {
3051
+ required: ['contextDefinitionVersionInput'],
3052
+ optional: []
3053
+ }
3054
+ };
3055
+ function createResourceParams$6(config) {
3056
+ const resourceParams = {
3057
+ body: {
3058
+ contextDefinitionVersionInput: config.contextDefinitionVersionInput
3059
+ }
3060
+ };
3061
+ return resourceParams;
3062
+ }
3063
+ function typeCheckConfig$6(untrustedConfig) {
3064
+ const config = {};
3065
+ const untrustedConfig_contextDefinitionVersionInput = untrustedConfig.contextDefinitionVersionInput;
3066
+ const referenceContextDefinitionVersionInputRepresentationValidationError = validate$6(untrustedConfig_contextDefinitionVersionInput);
3067
+ if (referenceContextDefinitionVersionInputRepresentationValidationError === null) {
3068
+ config.contextDefinitionVersionInput = untrustedConfig_contextDefinitionVersionInput;
3069
+ }
3070
+ return config;
3071
+ }
3072
+ function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
3073
+ if (!untrustedIsObject(untrustedConfig)) {
3074
+ return null;
3075
+ }
3076
+ if (process.env.NODE_ENV !== 'production') {
3077
+ validateConfig(untrustedConfig, configPropertyNames);
3078
+ }
3079
+ const config = typeCheckConfig$6(untrustedConfig);
3080
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3081
+ return null;
3082
+ }
3083
+ return config;
3084
+ }
3085
+ function buildNetworkSnapshot$6(luvio, config, options) {
3086
+ const resourceParams = createResourceParams$6(config);
3087
+ const request = createResourceRequest$6(resourceParams);
3088
+ return luvio.dispatchResourceRequest(request, options)
3089
+ .then((response) => {
3090
+ return luvio.handleSuccessResponse(() => {
3091
+ const snapshot = ingestSuccess$4(luvio, resourceParams, response);
3092
+ return luvio.storeBroadcast().then(() => snapshot);
3093
+ }, () => getResponseCacheKeys$6(luvio, resourceParams, response.body));
3094
+ }, (response) => {
3095
+ deepFreeze$8(response);
3096
+ throw response;
3097
+ });
3098
+ }
3099
+ const createContextDefinitionVersionAdapterFactory = (luvio) => {
3100
+ return function createContextDefinitionVersion(untrustedConfig) {
3101
+ const config = validateAdapterConfig$6(untrustedConfig, createContextDefinitionVersion_ConfigPropertyNames);
3102
+ // Invalid or incomplete config
3103
+ if (config === null) {
3104
+ throw new Error('Invalid config for "createContextDefinitionVersion"');
3105
+ }
3106
+ return buildNetworkSnapshot$6(luvio, config);
3107
+ };
3108
+ };
3109
+
3110
+ function keyBuilder$6(luvio, params) {
3111
+ return keyBuilder$7(luvio, {
3112
+ id: params.urlParams.contextDefinitionVersionId
3113
+ });
3114
+ }
3115
+ function getResponseCacheKeys$5(luvio, resourceParams) {
3116
+ const key = keyBuilder$6(luvio, resourceParams);
3117
+ const cacheKeyMap = new StoreKeyMap();
3118
+ cacheKeyMap.set(key, {
3119
+ namespace: keyPrefix,
3120
+ representationName: RepresentationType$1,
3121
+ mergeable: false
3122
+ });
3123
+ return cacheKeyMap;
3124
+ }
3125
+ function evictSuccess$1(luvio, resourceParams) {
3126
+ const key = keyBuilder$6(luvio, resourceParams);
3127
+ luvio.storeEvict(key);
3128
+ }
3129
+ function createResourceRequest$5(config) {
3130
+ const headers = {};
3131
+ return {
3132
+ baseUri: '/services/data/v58.0',
3133
+ basePath: '/connect/contextdefinition/version/' + config.urlParams.contextDefinitionVersionId + '',
3134
+ method: 'delete',
3135
+ body: null,
3136
+ urlParams: config.urlParams,
3137
+ queryParams: {},
3138
+ headers,
3139
+ priority: 'normal',
3140
+ };
3141
+ }
3142
+
3143
+ const adapterName$1 = 'deleteContextDefinitionVersion';
3144
+ const deleteContextDefinitionVersion_ConfigPropertyNames = {
3145
+ displayName: 'deleteContextDefinitionVersion',
3146
+ parameters: {
3147
+ required: ['contextDefinitionVersionId'],
3148
+ optional: []
3149
+ }
3150
+ };
3151
+ function createResourceParams$5(config) {
3152
+ const resourceParams = {
3153
+ urlParams: {
3154
+ contextDefinitionVersionId: config.contextDefinitionVersionId
3155
+ }
3156
+ };
3157
+ return resourceParams;
3158
+ }
3159
+ function typeCheckConfig$5(untrustedConfig) {
3160
+ const config = {};
3161
+ const untrustedConfig_contextDefinitionVersionId = untrustedConfig.contextDefinitionVersionId;
3162
+ if (typeof untrustedConfig_contextDefinitionVersionId === 'string') {
3163
+ config.contextDefinitionVersionId = untrustedConfig_contextDefinitionVersionId;
3164
+ }
3165
+ return config;
3166
+ }
3167
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
3168
+ if (!untrustedIsObject(untrustedConfig)) {
3169
+ return null;
3170
+ }
3171
+ if (process.env.NODE_ENV !== 'production') {
3172
+ validateConfig(untrustedConfig, configPropertyNames);
3173
+ }
3174
+ const config = typeCheckConfig$5(untrustedConfig);
3175
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3176
+ return null;
3177
+ }
3178
+ return config;
3179
+ }
3180
+ function buildNetworkSnapshot$5(luvio, config, options) {
3181
+ const resourceParams = createResourceParams$5(config);
3182
+ const request = createResourceRequest$5(resourceParams);
3183
+ return luvio.dispatchResourceRequest(request, options)
3184
+ .then(() => {
3185
+ return luvio.handleSuccessResponse(() => {
3186
+ evictSuccess$1(luvio, resourceParams);
3187
+ return luvio.storeBroadcast();
3188
+ }, () => getResponseCacheKeys$5(luvio, resourceParams));
3189
+ }, (response) => {
3190
+ deepFreeze$8(response);
3191
+ throw response;
3192
+ });
3193
+ }
3194
+ const deleteContextDefinitionVersionAdapterFactory = (luvio) => {
3195
+ return function IndustriesContextdeleteContextDefinitionVersion(untrustedConfig) {
3196
+ const config = validateAdapterConfig$5(untrustedConfig, deleteContextDefinitionVersion_ConfigPropertyNames);
3197
+ // Invalid or incomplete config
3198
+ if (config === null) {
3199
+ throw new Error(`Invalid config for "${adapterName$1}"`);
3200
+ }
3201
+ return buildNetworkSnapshot$5(luvio, config);
3202
+ };
3203
+ };
3204
+
3205
+ function select$4(luvio, params) {
3206
+ return select$6();
3207
+ }
3208
+ function keyBuilder$5(luvio, params) {
3209
+ return keyBuilder$7(luvio, {
3210
+ id: params.urlParams.contextDefinitionVersionId
3211
+ });
3212
+ }
3213
+ function getResponseCacheKeys$4(luvio, resourceParams, response) {
3214
+ return getTypeCacheKeys$1(luvio, response);
3215
+ }
3216
+ function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
3217
+ const { body } = response;
3218
+ const key = keyBuilder$5(luvio, resourceParams);
3219
+ luvio.storeIngest(key, ingest$1, body);
3220
+ const snapshot = luvio.storeLookup({
3221
+ recordId: key,
3222
+ node: select$4(),
3223
+ variables: {},
3224
+ }, snapshotRefresh);
3225
+ if (process.env.NODE_ENV !== 'production') {
3226
+ if (snapshot.state !== 'Fulfilled') {
3227
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3228
+ }
3229
+ }
3230
+ return snapshot;
3231
+ }
3232
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
3233
+ const key = keyBuilder$5(luvio, params);
3234
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
3235
+ const storeMetadataParams = {
3236
+ ttl: TTL$1,
3237
+ namespace: keyPrefix,
3238
+ version: VERSION$1,
3239
+ representationName: RepresentationType$1
3240
+ };
3241
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
3242
+ return errorSnapshot;
3243
+ }
3244
+ function createResourceRequest$4(config) {
3245
+ const headers = {};
3246
+ return {
3247
+ baseUri: '/services/data/v58.0',
3248
+ basePath: '/connect/contextdefinition/version/' + config.urlParams.contextDefinitionVersionId + '',
3249
+ method: 'get',
3250
+ body: null,
3251
+ urlParams: config.urlParams,
3252
+ queryParams: {},
3253
+ headers,
3254
+ priority: 'normal',
3255
+ };
3256
+ }
3257
+
3258
+ const getContextDefinitionVersion_ConfigPropertyNames = {
3259
+ displayName: 'getContextDefinitionVersion',
3260
+ parameters: {
3261
+ required: ['contextDefinitionVersionId'],
3262
+ optional: []
3263
+ }
3264
+ };
3265
+ function createResourceParams$4(config) {
3266
+ const resourceParams = {
3267
+ urlParams: {
3268
+ contextDefinitionVersionId: config.contextDefinitionVersionId
3269
+ }
3270
+ };
3271
+ return resourceParams;
3272
+ }
3273
+ function keyBuilder$4(luvio, config) {
3274
+ const resourceParams = createResourceParams$4(config);
3275
+ return keyBuilder$5(luvio, resourceParams);
3276
+ }
3277
+ function typeCheckConfig$4(untrustedConfig) {
3278
+ const config = {};
3279
+ const untrustedConfig_contextDefinitionVersionId = untrustedConfig.contextDefinitionVersionId;
3280
+ if (typeof untrustedConfig_contextDefinitionVersionId === 'string') {
3281
+ config.contextDefinitionVersionId = untrustedConfig_contextDefinitionVersionId;
3282
+ }
3283
+ return config;
3284
+ }
3285
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
3286
+ if (!untrustedIsObject(untrustedConfig)) {
3287
+ return null;
3288
+ }
3289
+ if (process.env.NODE_ENV !== 'production') {
3290
+ validateConfig(untrustedConfig, configPropertyNames);
3291
+ }
3292
+ const config = typeCheckConfig$4(untrustedConfig);
3293
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3294
+ return null;
3295
+ }
3296
+ return config;
3297
+ }
3298
+ function adapterFragment$1(luvio, config) {
3299
+ createResourceParams$4(config);
3300
+ return select$4();
3301
+ }
3302
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
3303
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
3304
+ config,
3305
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
3306
+ });
3307
+ return luvio.storeBroadcast().then(() => snapshot);
3308
+ }
3309
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
3310
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
3311
+ config,
3312
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
3313
+ });
3314
+ return luvio.storeBroadcast().then(() => snapshot);
3315
+ }
3316
+ function buildNetworkSnapshot$4(luvio, config, options) {
3317
+ const resourceParams = createResourceParams$4(config);
3318
+ const request = createResourceRequest$4(resourceParams);
3319
+ return luvio.dispatchResourceRequest(request, options)
3320
+ .then((response) => {
3321
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => getResponseCacheKeys$4(luvio, resourceParams, response.body));
3322
+ }, (response) => {
3323
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
3324
+ });
3325
+ }
3326
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
3327
+ const { luvio, config } = context;
3328
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
3329
+ const dispatchOptions = {
3330
+ resourceRequestContext: {
3331
+ requestCorrelator,
3332
+ luvioRequestMethod: undefined,
3333
+ },
3334
+ eventObservers
3335
+ };
3336
+ if (networkPriority !== 'normal') {
3337
+ dispatchOptions.overrides = {
3338
+ priority: networkPriority
3339
+ };
3340
+ }
3341
+ return buildNetworkSnapshot$4(luvio, config, dispatchOptions);
3342
+ }
3343
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
3344
+ const { luvio, config } = context;
3345
+ const selector = {
3346
+ recordId: keyBuilder$4(luvio, config),
3347
+ node: adapterFragment$1(luvio, config),
3348
+ variables: {},
3349
+ };
3350
+ const cacheSnapshot = storeLookup(selector, {
3351
+ config,
3352
+ resolve: () => buildNetworkSnapshot$4(luvio, config, snapshotRefreshOptions)
3353
+ });
3354
+ return cacheSnapshot;
3355
+ }
3356
+ const getContextDefinitionVersionAdapterFactory = (luvio) => function IndustriesContext__getContextDefinitionVersion(untrustedConfig, requestContext) {
3357
+ const config = validateAdapterConfig$4(untrustedConfig, getContextDefinitionVersion_ConfigPropertyNames);
3358
+ // Invalid or incomplete config
3359
+ if (config === null) {
3360
+ return null;
3361
+ }
3362
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
3363
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
3364
+ };
3365
+
3366
+ function select$3(luvio, params) {
3367
+ return select$6();
3368
+ }
3369
+ function getResponseCacheKeys$3(luvio, resourceParams, response) {
3370
+ return getTypeCacheKeys$1(luvio, response);
3371
+ }
3372
+ function ingestSuccess$2(luvio, resourceParams, response) {
3373
+ const { body } = response;
3374
+ const key = keyBuilderFromType$1(luvio, body);
3375
+ luvio.storeIngest(key, ingest$1, body);
3376
+ const snapshot = luvio.storeLookup({
3377
+ recordId: key,
3378
+ node: select$3(),
3379
+ variables: {},
3380
+ });
3381
+ if (process.env.NODE_ENV !== 'production') {
3382
+ if (snapshot.state !== 'Fulfilled') {
3383
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3384
+ }
3385
+ }
3386
+ return snapshot;
3387
+ }
3388
+ function createResourceRequest$3(config) {
3389
+ const headers = {};
3390
+ return {
3391
+ baseUri: '/services/data/v58.0',
3392
+ basePath: '/connect/contextdefinition/version/' + config.urlParams.contextDefinitionVersionId + '',
3393
+ method: 'patch',
3394
+ body: config.body,
3395
+ urlParams: config.urlParams,
3396
+ queryParams: {},
3397
+ headers,
3398
+ priority: 'normal',
3399
+ };
3400
+ }
3401
+
3402
+ const updateContextDefinitionVersion_ConfigPropertyNames = {
3403
+ displayName: 'updateContextDefinitionVersion',
3404
+ parameters: {
3405
+ required: ['contextDefinitionVersionId', 'contextDefinitionVersionInput'],
3406
+ optional: []
3407
+ }
3408
+ };
3409
+ function createResourceParams$3(config) {
3410
+ const resourceParams = {
3411
+ urlParams: {
3412
+ contextDefinitionVersionId: config.contextDefinitionVersionId
3413
+ },
3414
+ body: {
3415
+ contextDefinitionVersionInput: config.contextDefinitionVersionInput
3416
+ }
3417
+ };
3418
+ return resourceParams;
3419
+ }
3420
+ function typeCheckConfig$3(untrustedConfig) {
3421
+ const config = {};
3422
+ const untrustedConfig_contextDefinitionVersionId = untrustedConfig.contextDefinitionVersionId;
3423
+ if (typeof untrustedConfig_contextDefinitionVersionId === 'string') {
3424
+ config.contextDefinitionVersionId = untrustedConfig_contextDefinitionVersionId;
3425
+ }
3426
+ const untrustedConfig_contextDefinitionVersionInput = untrustedConfig.contextDefinitionVersionInput;
3427
+ const referenceContextDefinitionVersionInputRepresentationValidationError = validate$6(untrustedConfig_contextDefinitionVersionInput);
3428
+ if (referenceContextDefinitionVersionInputRepresentationValidationError === null) {
3429
+ config.contextDefinitionVersionInput = untrustedConfig_contextDefinitionVersionInput;
3430
+ }
3431
+ return config;
3432
+ }
3433
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
3434
+ if (!untrustedIsObject(untrustedConfig)) {
3435
+ return null;
3436
+ }
3437
+ if (process.env.NODE_ENV !== 'production') {
3438
+ validateConfig(untrustedConfig, configPropertyNames);
3439
+ }
3440
+ const config = typeCheckConfig$3(untrustedConfig);
3441
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3442
+ return null;
3443
+ }
3444
+ return config;
3445
+ }
3446
+ function buildNetworkSnapshot$3(luvio, config, options) {
3447
+ const resourceParams = createResourceParams$3(config);
3448
+ const request = createResourceRequest$3(resourceParams);
3449
+ return luvio.dispatchResourceRequest(request, options)
3450
+ .then((response) => {
3451
+ return luvio.handleSuccessResponse(() => {
3452
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response);
3453
+ return luvio.storeBroadcast().then(() => snapshot);
3454
+ }, () => getResponseCacheKeys$3(luvio, resourceParams, response.body));
3455
+ }, (response) => {
3456
+ deepFreeze$8(response);
3457
+ throw response;
3458
+ });
3459
+ }
3460
+ const updateContextDefinitionVersionAdapterFactory = (luvio) => {
3461
+ return function updateContextDefinitionVersion(untrustedConfig) {
3462
+ const config = validateAdapterConfig$3(untrustedConfig, updateContextDefinitionVersion_ConfigPropertyNames);
3463
+ // Invalid or incomplete config
3464
+ if (config === null) {
3465
+ throw new Error('Invalid config for "updateContextDefinitionVersion"');
3466
+ }
3467
+ return buildNetworkSnapshot$3(luvio, config);
3468
+ };
3469
+ };
3470
+
3471
+ const TTL = 30000;
3472
+ const VERSION = "fea3658cfe2699ab96f7f7fec5d4ce9e";
3473
+ function validate(obj, path = 'ContextDefinitionRepresentation') {
3474
+ const v_error = (() => {
3475
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3476
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3477
+ }
3478
+ if (obj.activeVersionId !== undefined) {
3479
+ const obj_activeVersionId = obj.activeVersionId;
3480
+ const path_activeVersionId = path + '.activeVersionId';
3481
+ if (typeof obj_activeVersionId !== 'string') {
3482
+ return new TypeError('Expected "string" but received "' + typeof obj_activeVersionId + '" (at "' + path_activeVersionId + '")');
3483
+ }
3484
+ }
3485
+ const obj_contextDefinitionId = obj.contextDefinitionId;
3486
+ const path_contextDefinitionId = path + '.contextDefinitionId';
3487
+ if (typeof obj_contextDefinitionId !== 'string') {
3488
+ return new TypeError('Expected "string" but received "' + typeof obj_contextDefinitionId + '" (at "' + path_contextDefinitionId + '")');
3489
+ }
3490
+ const obj_contextDefinitionVersionList = obj.contextDefinitionVersionList;
3491
+ const path_contextDefinitionVersionList = path + '.contextDefinitionVersionList';
3492
+ if (!ArrayIsArray(obj_contextDefinitionVersionList)) {
3493
+ return new TypeError('Expected "array" but received "' + typeof obj_contextDefinitionVersionList + '" (at "' + path_contextDefinitionVersionList + '")');
3494
+ }
3495
+ for (let i = 0; i < obj_contextDefinitionVersionList.length; i++) {
3496
+ const obj_contextDefinitionVersionList_item = obj_contextDefinitionVersionList[i];
3497
+ const path_contextDefinitionVersionList_item = path_contextDefinitionVersionList + '[' + i + ']';
3498
+ if (typeof obj_contextDefinitionVersionList_item !== 'object') {
3499
+ return new TypeError('Expected "object" but received "' + typeof obj_contextDefinitionVersionList_item + '" (at "' + path_contextDefinitionVersionList_item + '")');
3500
+ }
3501
+ }
3502
+ const obj_definition = obj.definition;
3503
+ const path_definition = path + '.definition';
3504
+ if (typeof obj_definition !== 'string') {
3505
+ return new TypeError('Expected "string" but received "' + typeof obj_definition + '" (at "' + path_definition + '")');
3506
+ }
3507
+ const obj_description = obj.description;
3508
+ const path_description = path + '.description';
3509
+ if (typeof obj_description !== 'string') {
3510
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
3511
+ }
3512
+ const obj_isSuccess = obj.isSuccess;
3513
+ const path_isSuccess = path + '.isSuccess';
3514
+ if (typeof obj_isSuccess !== 'boolean') {
3515
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
3516
+ }
3517
+ })();
3518
+ return v_error === undefined ? null : v_error;
3519
+ }
3520
+ const RepresentationType = 'ContextDefinitionRepresentation';
3521
+ function keyBuilder$3(luvio, config) {
3522
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
3523
+ }
3524
+ function keyBuilderFromType(luvio, object) {
3525
+ const keyParams = {
3526
+ id: object.contextDefinitionId
3527
+ };
3528
+ return keyBuilder$3(luvio, keyParams);
3529
+ }
3530
+ function normalize(input, existing, path, luvio, store, timestamp) {
3531
+ const input_contextDefinitionVersionList = input.contextDefinitionVersionList;
3532
+ const input_contextDefinitionVersionList_id = path.fullPath + '__contextDefinitionVersionList';
3533
+ for (let i = 0; i < input_contextDefinitionVersionList.length; i++) {
3534
+ const input_contextDefinitionVersionList_item = input_contextDefinitionVersionList[i];
3535
+ let input_contextDefinitionVersionList_item_id = input_contextDefinitionVersionList_id + '__' + i;
3536
+ input_contextDefinitionVersionList[i] = ingest$1(input_contextDefinitionVersionList_item, {
3537
+ fullPath: input_contextDefinitionVersionList_item_id,
3538
+ propertyName: i,
3539
+ parent: {
3540
+ data: input,
3541
+ key: path.fullPath,
3542
+ existing: existing,
3543
+ },
3544
+ ttl: path.ttl
3545
+ }, luvio, store);
3546
+ }
3547
+ return input;
3548
+ }
3549
+ const select$2 = function ContextDefinitionRepresentationSelect() {
3550
+ return {
3551
+ kind: 'Fragment',
3552
+ version: VERSION,
3553
+ private: [],
3554
+ selections: [
3555
+ {
3556
+ name: 'activeVersionId',
3557
+ kind: 'Scalar',
3558
+ required: false
3559
+ },
3560
+ {
3561
+ name: 'contextDefinitionId',
3562
+ kind: 'Scalar'
3563
+ },
3564
+ {
3565
+ name: 'contextDefinitionVersionList',
3566
+ kind: 'Link',
3567
+ plural: true,
3568
+ fragment: select$6()
3569
+ },
3570
+ {
3571
+ name: 'definition',
3572
+ kind: 'Scalar'
3573
+ },
3574
+ {
3575
+ name: 'description',
3576
+ kind: 'Scalar'
3577
+ },
3578
+ {
3579
+ name: 'isSuccess',
3580
+ kind: 'Scalar'
3581
+ }
3582
+ ]
3583
+ };
3584
+ };
3585
+ function equals(existing, incoming) {
3586
+ const existing_isSuccess = existing.isSuccess;
3587
+ const incoming_isSuccess = incoming.isSuccess;
3588
+ if (!(existing_isSuccess === incoming_isSuccess)) {
3589
+ return false;
3590
+ }
3591
+ const existing_activeVersionId = existing.activeVersionId;
3592
+ const incoming_activeVersionId = incoming.activeVersionId;
3593
+ // if at least one of these optionals is defined
3594
+ if (existing_activeVersionId !== undefined || incoming_activeVersionId !== undefined) {
3595
+ // if one of these is not defined we know the other is defined and therefore
3596
+ // not equal
3597
+ if (existing_activeVersionId === undefined || incoming_activeVersionId === undefined) {
3598
+ return false;
3599
+ }
3600
+ if (!(existing_activeVersionId === incoming_activeVersionId)) {
3601
+ return false;
3602
+ }
3603
+ }
3604
+ const existing_contextDefinitionId = existing.contextDefinitionId;
3605
+ const incoming_contextDefinitionId = incoming.contextDefinitionId;
3606
+ if (!(existing_contextDefinitionId === incoming_contextDefinitionId)) {
3607
+ return false;
3608
+ }
3609
+ const existing_definition = existing.definition;
3610
+ const incoming_definition = incoming.definition;
3611
+ if (!(existing_definition === incoming_definition)) {
3612
+ return false;
3613
+ }
3614
+ const existing_description = existing.description;
3615
+ const incoming_description = incoming.description;
3616
+ if (!(existing_description === incoming_description)) {
3617
+ return false;
3618
+ }
3619
+ const existing_contextDefinitionVersionList = existing.contextDefinitionVersionList;
3620
+ const incoming_contextDefinitionVersionList = incoming.contextDefinitionVersionList;
3621
+ const equals_contextDefinitionVersionList_items = equalsArray(existing_contextDefinitionVersionList, incoming_contextDefinitionVersionList, (existing_contextDefinitionVersionList_item, incoming_contextDefinitionVersionList_item) => {
3622
+ if (!(existing_contextDefinitionVersionList_item.__ref === incoming_contextDefinitionVersionList_item.__ref)) {
3623
+ return false;
3624
+ }
3625
+ });
3626
+ if (equals_contextDefinitionVersionList_items === false) {
3627
+ return false;
3628
+ }
3629
+ return true;
3630
+ }
3631
+ const ingest = function ContextDefinitionRepresentationIngest(input, path, luvio, store, timestamp) {
3632
+ if (process.env.NODE_ENV !== 'production') {
3633
+ const validateError = validate(input);
3634
+ if (validateError !== null) {
3635
+ throw validateError;
3636
+ }
3637
+ }
3638
+ const key = keyBuilderFromType(luvio, input);
3639
+ const existingRecord = store.readEntry(key);
3640
+ const ttlToUse = TTL;
3641
+ let incomingRecord = normalize(input, store.readEntry(key), {
3642
+ fullPath: key,
3643
+ parent: path.parent,
3644
+ propertyName: path.propertyName,
3645
+ ttl: ttlToUse
3646
+ }, luvio, store);
3647
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
3648
+ luvio.storePublish(key, incomingRecord);
3649
+ }
3650
+ {
3651
+ const storeMetadataParams = {
3652
+ ttl: ttlToUse,
3653
+ namespace: "IndustriesContext",
3654
+ version: VERSION,
3655
+ representationName: RepresentationType,
3656
+ };
3657
+ luvio.publishStoreMetadata(key, storeMetadataParams);
3658
+ }
3659
+ return createLink(key);
3660
+ };
3661
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
3662
+ const rootKeySet = new StoreKeyMap();
3663
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
3664
+ const rootKey = keyBuilderFromType(luvio, input);
3665
+ rootKeySet.set(rootKey, {
3666
+ namespace: keyPrefix,
3667
+ representationName: RepresentationType,
3668
+ mergeable: false
3669
+ });
3670
+ const input_contextDefinitionVersionList_length = input.contextDefinitionVersionList.length;
3671
+ for (let i = 0; i < input_contextDefinitionVersionList_length; i++) {
3672
+ rootKeySet.merge(getTypeCacheKeys$1(luvio, input.contextDefinitionVersionList[i]));
3673
+ }
3674
+ return rootKeySet;
3675
+ }
3676
+
3677
+ function keyBuilder$2(luvio, params) {
3678
+ return keyBuilder$3(luvio, {
3679
+ id: params.urlParams.contextDefinitionId
3680
+ });
3681
+ }
3682
+ function getResponseCacheKeys$2(luvio, resourceParams) {
3683
+ const key = keyBuilder$2(luvio, resourceParams);
3684
+ const cacheKeyMap = new StoreKeyMap();
3685
+ cacheKeyMap.set(key, {
3686
+ namespace: keyPrefix,
3687
+ representationName: RepresentationType,
3688
+ mergeable: false
3689
+ });
3690
+ return cacheKeyMap;
3691
+ }
3692
+ function evictSuccess(luvio, resourceParams) {
3693
+ const key = keyBuilder$2(luvio, resourceParams);
3694
+ luvio.storeEvict(key);
3695
+ }
3696
+ function createResourceRequest$2(config) {
3697
+ const headers = {};
3698
+ return {
3699
+ baseUri: '/services/data/v58.0',
3700
+ basePath: '/connect/contextdefinition/' + config.urlParams.contextDefinitionId + '',
3701
+ method: 'delete',
3702
+ body: null,
3703
+ urlParams: config.urlParams,
3704
+ queryParams: {},
3705
+ headers,
3706
+ priority: 'normal',
3707
+ };
3708
+ }
3709
+
3710
+ const adapterName = 'deleteContextDefinition';
3711
+ const deleteContextDefinition_ConfigPropertyNames = {
3712
+ displayName: 'deleteContextDefinition',
3713
+ parameters: {
3714
+ required: ['contextDefinitionId'],
3715
+ optional: []
3716
+ }
3717
+ };
3718
+ function createResourceParams$2(config) {
3719
+ const resourceParams = {
3720
+ urlParams: {
3721
+ contextDefinitionId: config.contextDefinitionId
3722
+ }
3723
+ };
3724
+ return resourceParams;
3725
+ }
3726
+ function typeCheckConfig$2(untrustedConfig) {
3727
+ const config = {};
3728
+ const untrustedConfig_contextDefinitionId = untrustedConfig.contextDefinitionId;
3729
+ if (typeof untrustedConfig_contextDefinitionId === 'string') {
3730
+ config.contextDefinitionId = untrustedConfig_contextDefinitionId;
3731
+ }
3732
+ return config;
3733
+ }
3734
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
3735
+ if (!untrustedIsObject(untrustedConfig)) {
3736
+ return null;
3737
+ }
3738
+ if (process.env.NODE_ENV !== 'production') {
3739
+ validateConfig(untrustedConfig, configPropertyNames);
3740
+ }
3741
+ const config = typeCheckConfig$2(untrustedConfig);
3742
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3743
+ return null;
3744
+ }
3745
+ return config;
3746
+ }
3747
+ function buildNetworkSnapshot$2(luvio, config, options) {
3748
+ const resourceParams = createResourceParams$2(config);
3749
+ const request = createResourceRequest$2(resourceParams);
3750
+ return luvio.dispatchResourceRequest(request, options)
3751
+ .then(() => {
3752
+ return luvio.handleSuccessResponse(() => {
3753
+ evictSuccess(luvio, resourceParams);
3754
+ return luvio.storeBroadcast();
3755
+ }, () => getResponseCacheKeys$2(luvio, resourceParams));
3756
+ }, (response) => {
3757
+ deepFreeze$8(response);
3758
+ throw response;
3759
+ });
3760
+ }
3761
+ const deleteContextDefinitionAdapterFactory = (luvio) => {
3762
+ return function IndustriesContextdeleteContextDefinition(untrustedConfig) {
3763
+ const config = validateAdapterConfig$2(untrustedConfig, deleteContextDefinition_ConfigPropertyNames);
3764
+ // Invalid or incomplete config
3765
+ if (config === null) {
3766
+ throw new Error(`Invalid config for "${adapterName}"`);
3767
+ }
3768
+ return buildNetworkSnapshot$2(luvio, config);
3769
+ };
3770
+ };
3771
+
3772
+ function select$1(luvio, params) {
3773
+ return select$2();
3774
+ }
3775
+ function keyBuilder$1(luvio, params) {
3776
+ return keyBuilder$3(luvio, {
3777
+ id: params.urlParams.contextDefinitionId
3778
+ });
3779
+ }
3780
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
3781
+ return getTypeCacheKeys(luvio, response);
3782
+ }
3783
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
3784
+ const { body } = response;
3785
+ const key = keyBuilder$1(luvio, resourceParams);
3786
+ luvio.storeIngest(key, ingest, body);
3787
+ const snapshot = luvio.storeLookup({
3788
+ recordId: key,
3789
+ node: select$1(),
3790
+ variables: {},
3791
+ }, snapshotRefresh);
3792
+ if (process.env.NODE_ENV !== 'production') {
3793
+ if (snapshot.state !== 'Fulfilled') {
3794
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3795
+ }
3796
+ }
3797
+ return snapshot;
3798
+ }
3799
+ function ingestError(luvio, params, error, snapshotRefresh) {
3800
+ const key = keyBuilder$1(luvio, params);
3801
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
3802
+ const storeMetadataParams = {
3803
+ ttl: TTL,
3804
+ namespace: keyPrefix,
3805
+ version: VERSION,
3806
+ representationName: RepresentationType
3807
+ };
3808
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
3809
+ return errorSnapshot;
3810
+ }
3811
+ function createResourceRequest$1(config) {
3812
+ const headers = {};
3813
+ return {
3814
+ baseUri: '/services/data/v58.0',
3815
+ basePath: '/connect/contextdefinition/' + config.urlParams.contextDefinitionId + '',
3816
+ method: 'get',
3817
+ body: null,
3818
+ urlParams: config.urlParams,
3819
+ queryParams: {},
3820
+ headers,
3821
+ priority: 'normal',
3822
+ };
3823
+ }
3824
+
3825
+ const getContextDefinition_ConfigPropertyNames = {
3826
+ displayName: 'getContextDefinition',
3827
+ parameters: {
3828
+ required: ['contextDefinitionId'],
3829
+ optional: []
3830
+ }
3831
+ };
3832
+ function createResourceParams$1(config) {
3833
+ const resourceParams = {
3834
+ urlParams: {
3835
+ contextDefinitionId: config.contextDefinitionId
3836
+ }
3837
+ };
3838
+ return resourceParams;
3839
+ }
3840
+ function keyBuilder(luvio, config) {
3841
+ const resourceParams = createResourceParams$1(config);
3842
+ return keyBuilder$1(luvio, resourceParams);
3843
+ }
3844
+ function typeCheckConfig$1(untrustedConfig) {
3845
+ const config = {};
3846
+ const untrustedConfig_contextDefinitionId = untrustedConfig.contextDefinitionId;
3847
+ if (typeof untrustedConfig_contextDefinitionId === 'string') {
3848
+ config.contextDefinitionId = untrustedConfig_contextDefinitionId;
3849
+ }
3850
+ return config;
3851
+ }
3852
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
3853
+ if (!untrustedIsObject(untrustedConfig)) {
3854
+ return null;
3855
+ }
3856
+ if (process.env.NODE_ENV !== 'production') {
3857
+ validateConfig(untrustedConfig, configPropertyNames);
3858
+ }
3859
+ const config = typeCheckConfig$1(untrustedConfig);
3860
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3861
+ return null;
3862
+ }
3863
+ return config;
3864
+ }
3865
+ function adapterFragment(luvio, config) {
3866
+ createResourceParams$1(config);
3867
+ return select$1();
3868
+ }
3869
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
3870
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
3871
+ config,
3872
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
3873
+ });
3874
+ return luvio.storeBroadcast().then(() => snapshot);
3875
+ }
3876
+ function onFetchResponseError(luvio, config, resourceParams, response) {
3877
+ const snapshot = ingestError(luvio, resourceParams, response, {
3878
+ config,
3879
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
3880
+ });
3881
+ return luvio.storeBroadcast().then(() => snapshot);
3882
+ }
3883
+ function buildNetworkSnapshot$1(luvio, config, options) {
3884
+ const resourceParams = createResourceParams$1(config);
3885
+ const request = createResourceRequest$1(resourceParams);
3886
+ return luvio.dispatchResourceRequest(request, options)
3887
+ .then((response) => {
3888
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
3889
+ }, (response) => {
3890
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
3891
+ });
3892
+ }
3893
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
3894
+ const { luvio, config } = context;
3895
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
3896
+ const dispatchOptions = {
3897
+ resourceRequestContext: {
3898
+ requestCorrelator,
3899
+ luvioRequestMethod: undefined,
3900
+ },
3901
+ eventObservers
3902
+ };
3903
+ if (networkPriority !== 'normal') {
3904
+ dispatchOptions.overrides = {
3905
+ priority: networkPriority
3906
+ };
3907
+ }
3908
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
3909
+ }
3910
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
3911
+ const { luvio, config } = context;
3912
+ const selector = {
3913
+ recordId: keyBuilder(luvio, config),
3914
+ node: adapterFragment(luvio, config),
3915
+ variables: {},
3916
+ };
3917
+ const cacheSnapshot = storeLookup(selector, {
3918
+ config,
3919
+ resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
3920
+ });
3921
+ return cacheSnapshot;
3922
+ }
3923
+ const getContextDefinitionAdapterFactory = (luvio) => function IndustriesContext__getContextDefinition(untrustedConfig, requestContext) {
3924
+ const config = validateAdapterConfig$1(untrustedConfig, getContextDefinition_ConfigPropertyNames);
3925
+ // Invalid or incomplete config
3926
+ if (config === null) {
3927
+ return null;
3928
+ }
3929
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
3930
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
3931
+ };
3932
+
3933
+ function select(luvio, params) {
3934
+ return select$k();
3935
+ }
3936
+ function getResponseCacheKeys(luvio, resourceParams, response) {
3937
+ return getTypeCacheKeys$6(luvio, response);
3938
+ }
3939
+ function ingestSuccess(luvio, resourceParams, response) {
3940
+ const { body } = response;
3941
+ const key = keyBuilderFromType$5(luvio, body);
3942
+ luvio.storeIngest(key, ingest$6, body);
3943
+ const snapshot = luvio.storeLookup({
3944
+ recordId: key,
3945
+ node: select(),
3946
+ variables: {},
3947
+ });
3948
+ if (process.env.NODE_ENV !== 'production') {
3949
+ if (snapshot.state !== 'Fulfilled') {
3950
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3951
+ }
3952
+ }
3953
+ return snapshot;
3954
+ }
3955
+ function createResourceRequest(config) {
3956
+ const headers = {};
3957
+ return {
3958
+ baseUri: '/services/data/v58.0',
3959
+ basePath: '/connect/contextdefinition/' + config.urlParams.contextDefinitionId + '',
3960
+ method: 'patch',
3961
+ body: config.body,
3962
+ urlParams: config.urlParams,
3963
+ queryParams: {},
3964
+ headers,
3965
+ priority: 'normal',
3966
+ };
3967
+ }
3968
+
3969
+ const updateContextDefinition_ConfigPropertyNames = {
3970
+ displayName: 'updateContextDefinition',
3971
+ parameters: {
3972
+ required: ['contextDefinitionId', 'contextDefinitionInput'],
3973
+ optional: []
3974
+ }
3975
+ };
3976
+ function createResourceParams(config) {
3977
+ const resourceParams = {
3978
+ urlParams: {
3979
+ contextDefinitionId: config.contextDefinitionId
3980
+ },
3981
+ body: {
3982
+ contextDefinitionInput: config.contextDefinitionInput
3983
+ }
3984
+ };
3985
+ return resourceParams;
3986
+ }
3987
+ function typeCheckConfig(untrustedConfig) {
3988
+ const config = {};
3989
+ const untrustedConfig_contextDefinitionId = untrustedConfig.contextDefinitionId;
3990
+ if (typeof untrustedConfig_contextDefinitionId === 'string') {
3991
+ config.contextDefinitionId = untrustedConfig_contextDefinitionId;
3992
+ }
3993
+ const untrustedConfig_contextDefinitionInput = untrustedConfig.contextDefinitionInput;
3994
+ const referenceContextDefinitionInputRepresentationValidationError = validate$c(untrustedConfig_contextDefinitionInput);
3995
+ if (referenceContextDefinitionInputRepresentationValidationError === null) {
3996
+ config.contextDefinitionInput = untrustedConfig_contextDefinitionInput;
3997
+ }
3998
+ return config;
3999
+ }
4000
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
4001
+ if (!untrustedIsObject(untrustedConfig)) {
4002
+ return null;
4003
+ }
4004
+ if (process.env.NODE_ENV !== 'production') {
4005
+ validateConfig(untrustedConfig, configPropertyNames);
4006
+ }
4007
+ const config = typeCheckConfig(untrustedConfig);
4008
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
4009
+ return null;
4010
+ }
4011
+ return config;
4012
+ }
4013
+ function buildNetworkSnapshot(luvio, config, options) {
4014
+ const resourceParams = createResourceParams(config);
4015
+ const request = createResourceRequest(resourceParams);
4016
+ return luvio.dispatchResourceRequest(request, options)
4017
+ .then((response) => {
4018
+ return luvio.handleSuccessResponse(() => {
4019
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
4020
+ return luvio.storeBroadcast().then(() => snapshot);
4021
+ }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
4022
+ }, (response) => {
4023
+ deepFreeze$8(response);
4024
+ throw response;
4025
+ });
4026
+ }
4027
+ const updateContextDefinitionAdapterFactory = (luvio) => {
4028
+ return function updateContextDefinition(untrustedConfig) {
4029
+ const config = validateAdapterConfig(untrustedConfig, updateContextDefinition_ConfigPropertyNames);
4030
+ // Invalid or incomplete config
4031
+ if (config === null) {
4032
+ throw new Error('Invalid config for "updateContextDefinition"');
4033
+ }
4034
+ return buildNetworkSnapshot(luvio, config);
4035
+ };
4036
+ };
4037
+
4038
+ export { createContextAttributeAdapterFactory, createContextDefinitionAdapterFactory, createContextDefinitionVersionAdapterFactory, createContextNodeAdapterFactory, deleteContextAttributeAdapterFactory, deleteContextDefinitionAdapterFactory, deleteContextDefinitionVersionAdapterFactory, deleteContextNodeAdapterFactory, getContextAttributeAdapterFactory, getContextDefinitionAdapterFactory, getContextDefinitionInfoAdapterFactory, getContextDefinitionListAdapterFactory, getContextDefinitionVersionAdapterFactory, getContextNodeAdapterFactory, updateContextAttributeAdapterFactory, updateContextDefinitionAdapterFactory, updateContextDefinitionVersionAdapterFactory, updateContextNodeAdapterFactory };