@salesforce/lds-adapters-marketing-cdp 1.140.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/marketing-cdp.js +843 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +60 -0
  4. package/dist/es/es2018/types/src/generated/adapters/createAdg.d.ts +20 -0
  5. package/dist/es/es2018/types/src/generated/adapters/deleteAdg.d.ts +13 -0
  6. package/dist/es/es2018/types/src/generated/adapters/getAdg.d.ts +28 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +3 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +6 -0
  9. package/dist/es/es2018/types/src/generated/resources/deleteSsotApplicationDataGraphsByAdgName.d.ts +12 -0
  10. package/dist/es/es2018/types/src/generated/resources/getSsotApplicationDataGraphsByAdgName.d.ts +16 -0
  11. package/dist/es/es2018/types/src/generated/resources/postSsotApplicationDataGraphs.d.ts +18 -0
  12. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphDataRecencyInputRepresentation.d.ts +37 -0
  13. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphFieldInputRepresentation.d.ts +31 -0
  14. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphFieldOutputRepresentation.d.ts +31 -0
  15. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphInputRepresentation.d.ts +46 -0
  16. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphOutputRepresentation.d.ts +55 -0
  17. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphPathToParentInputRepresentation.d.ts +31 -0
  18. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphPathToParentOutputRepresentation.d.ts +31 -0
  19. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphRecencyCriteriaOutputRepresentation.d.ts +37 -0
  20. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphSourceInputRepresentation.d.ts +41 -0
  21. package/dist/es/es2018/types/src/generated/types/CdpApplicationDataGraphSourceObjectOutputRepresentation.d.ts +42 -0
  22. package/dist/es/es2018/types/src/generated/types/CdpObjectBaseInputRepresentation.d.ts +40 -0
  23. package/dist/es/es2018/types/src/generated/types/CdpObjectBaseOutputRepresentation.d.ts +64 -0
  24. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  25. package/package.json +68 -0
  26. package/sfdc/index.d.ts +1 -0
  27. package/sfdc/index.js +919 -0
  28. package/src/raml/api.raml +320 -0
  29. package/src/raml/luvio.raml +41 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,919 @@
1
+ /**
2
+ * Copyright (c) 2022, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+
7
+ /* *******************************************************************************************
8
+ * ATTENTION!
9
+ * THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
10
+ * If you would like to contribute to LDS, please follow the steps outlined in the git repo.
11
+ * Any changes made to this file in p4 will be automatically overwritten.
12
+ * *******************************************************************************************
13
+ */
14
+ /* proxy-compat-disable */
15
+ import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
16
+ import { withDefaultLuvio } from 'force/ldsEngine';
17
+ import { serializeStructuredKey, StoreKeyMap, deepFreeze } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys, create: ObjectCreate } = Object;
21
+ const { isArray: ArrayIsArray$1 } = Array;
22
+ /**
23
+ * Validates an adapter config is well-formed.
24
+ * @param config The config to validate.
25
+ * @param adapter The adapter validation configuration.
26
+ * @param oneOf The keys the config must contain at least one of.
27
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
28
+ */
29
+ function validateConfig(config, adapter, oneOf) {
30
+ const { displayName } = adapter;
31
+ const { required, optional, unsupported } = adapter.parameters;
32
+ if (config === undefined ||
33
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
34
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
35
+ }
36
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
37
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
38
+ }
39
+ if (unsupported !== undefined &&
40
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
41
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
42
+ }
43
+ const supported = required.concat(optional);
44
+ if (ObjectKeys(config).some(key => !supported.includes(key))) {
45
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
46
+ }
47
+ }
48
+ function untrustedIsObject(untrusted) {
49
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
50
+ }
51
+ function areRequiredParametersPresent(config, configPropertyNames) {
52
+ return configPropertyNames.parameters.required.every(req => req in config);
53
+ }
54
+ const snapshotRefreshOptions = {
55
+ overrides: {
56
+ headers: {
57
+ 'Cache-Control': 'no-cache',
58
+ },
59
+ }
60
+ };
61
+ const keyPrefix = 'CDP';
62
+
63
+ const { isArray: ArrayIsArray } = Array;
64
+ const { stringify: JSONStringify } = JSON;
65
+ function createLink(ref) {
66
+ return {
67
+ __ref: serializeStructuredKey(ref),
68
+ };
69
+ }
70
+
71
+ function validate$5(obj, path = 'CdpObjectBaseOutputRepresentation') {
72
+ const v_error = (() => {
73
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
74
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
75
+ }
76
+ if (obj.createdBy !== undefined) {
77
+ const obj_createdBy = obj.createdBy;
78
+ const path_createdBy = path + '.createdBy';
79
+ if (typeof obj_createdBy !== 'string') {
80
+ return new TypeError('Expected "string" but received "' + typeof obj_createdBy + '" (at "' + path_createdBy + '")');
81
+ }
82
+ }
83
+ if (obj.createdDate !== undefined) {
84
+ const obj_createdDate = obj.createdDate;
85
+ const path_createdDate = path + '.createdDate';
86
+ if (typeof obj_createdDate !== 'string') {
87
+ return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
88
+ }
89
+ }
90
+ if (obj.dataspaceName !== undefined) {
91
+ const obj_dataspaceName = obj.dataspaceName;
92
+ const path_dataspaceName = path + '.dataspaceName';
93
+ if (typeof obj_dataspaceName !== 'string') {
94
+ return new TypeError('Expected "string" but received "' + typeof obj_dataspaceName + '" (at "' + path_dataspaceName + '")');
95
+ }
96
+ }
97
+ if (obj.description !== undefined) {
98
+ const obj_description = obj.description;
99
+ const path_description = path + '.description';
100
+ if (typeof obj_description !== 'string') {
101
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
102
+ }
103
+ }
104
+ if (obj.id !== undefined) {
105
+ const obj_id = obj.id;
106
+ const path_id = path + '.id';
107
+ if (typeof obj_id !== 'string') {
108
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
109
+ }
110
+ }
111
+ const obj_kind = obj.kind;
112
+ const path_kind = path + '.kind';
113
+ if (typeof obj_kind !== 'string') {
114
+ return new TypeError('Expected "string" but received "' + typeof obj_kind + '" (at "' + path_kind + '")');
115
+ }
116
+ if (obj.label !== undefined) {
117
+ const obj_label = obj.label;
118
+ const path_label = path + '.label';
119
+ if (typeof obj_label !== 'string') {
120
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
121
+ }
122
+ }
123
+ if (obj.modifiedBy !== undefined) {
124
+ const obj_modifiedBy = obj.modifiedBy;
125
+ const path_modifiedBy = path + '.modifiedBy';
126
+ if (typeof obj_modifiedBy !== 'string') {
127
+ return new TypeError('Expected "string" but received "' + typeof obj_modifiedBy + '" (at "' + path_modifiedBy + '")');
128
+ }
129
+ }
130
+ if (obj.modifiedDate !== undefined) {
131
+ const obj_modifiedDate = obj.modifiedDate;
132
+ const path_modifiedDate = path + '.modifiedDate';
133
+ if (typeof obj_modifiedDate !== 'string') {
134
+ return new TypeError('Expected "string" but received "' + typeof obj_modifiedDate + '" (at "' + path_modifiedDate + '")');
135
+ }
136
+ }
137
+ const obj_name = obj.name;
138
+ const path_name = path + '.name';
139
+ if (typeof obj_name !== 'string') {
140
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
141
+ }
142
+ })();
143
+ return v_error === undefined ? null : v_error;
144
+ }
145
+ const RepresentationType$1 = 'CdpObjectBaseOutputRepresentation';
146
+ function keyBuilder$4(luvio, config) {
147
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.name;
148
+ }
149
+ function keyBuilderFromType$1(luvio, object) {
150
+ const keyParams = {
151
+ name: object.name
152
+ };
153
+ return keyBuilder$4(luvio, keyParams);
154
+ }
155
+ function equals$2(existing, incoming) {
156
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
157
+ return false;
158
+ }
159
+ return true;
160
+ }
161
+
162
+ function validate$4(obj, path = 'CdpApplicationDataGraphFieldOutputRepresentation') {
163
+ const v_error = (() => {
164
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
165
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
166
+ }
167
+ const obj_isKeyColumn = obj.isKeyColumn;
168
+ const path_isKeyColumn = path + '.isKeyColumn';
169
+ if (typeof obj_isKeyColumn !== 'boolean') {
170
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isKeyColumn + '" (at "' + path_isKeyColumn + '")');
171
+ }
172
+ const obj_sourceFieldName = obj.sourceFieldName;
173
+ const path_sourceFieldName = path + '.sourceFieldName';
174
+ if (typeof obj_sourceFieldName !== 'string') {
175
+ return new TypeError('Expected "string" but received "' + typeof obj_sourceFieldName + '" (at "' + path_sourceFieldName + '")');
176
+ }
177
+ })();
178
+ return v_error === undefined ? null : v_error;
179
+ }
180
+
181
+ function validate$3(obj, path = 'CdpApplicationDataGraphPathToParentOutputRepresentation') {
182
+ const v_error = (() => {
183
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
184
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
185
+ }
186
+ const obj_fieldName = obj.fieldName;
187
+ const path_fieldName = path + '.fieldName';
188
+ if (typeof obj_fieldName !== 'string') {
189
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
190
+ }
191
+ const obj_parentFieldName = obj.parentFieldName;
192
+ const path_parentFieldName = path + '.parentFieldName';
193
+ if (typeof obj_parentFieldName !== 'string') {
194
+ return new TypeError('Expected "string" but received "' + typeof obj_parentFieldName + '" (at "' + path_parentFieldName + '")');
195
+ }
196
+ })();
197
+ return v_error === undefined ? null : v_error;
198
+ }
199
+
200
+ function validate$2(obj, path = 'CdpApplicationDataGraphRecencyCriteriaOutputRepresentation') {
201
+ const v_error = (() => {
202
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
203
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
204
+ }
205
+ const obj_fieldName = obj.fieldName;
206
+ const path_fieldName = path + '.fieldName';
207
+ if (typeof obj_fieldName !== 'string') {
208
+ return new TypeError('Expected "string" but received "' + typeof obj_fieldName + '" (at "' + path_fieldName + '")');
209
+ }
210
+ const obj_value = obj.value;
211
+ const path_value = path + '.value';
212
+ if (typeof obj_value !== 'number' || (typeof obj_value === 'number' && Math.floor(obj_value) !== obj_value)) {
213
+ return new TypeError('Expected "integer" but received "' + typeof obj_value + '" (at "' + path_value + '")');
214
+ }
215
+ const obj_valueType = obj.valueType;
216
+ const path_valueType = path + '.valueType';
217
+ if (typeof obj_valueType !== 'string') {
218
+ return new TypeError('Expected "string" but received "' + typeof obj_valueType + '" (at "' + path_valueType + '")');
219
+ }
220
+ const obj_valueUnit = obj.valueUnit;
221
+ const path_valueUnit = path + '.valueUnit';
222
+ if (typeof obj_valueUnit !== 'string') {
223
+ return new TypeError('Expected "string" but received "' + typeof obj_valueUnit + '" (at "' + path_valueUnit + '")');
224
+ }
225
+ })();
226
+ return v_error === undefined ? null : v_error;
227
+ }
228
+
229
+ function validate$1(obj, path = 'CdpApplicationDataGraphSourceObjectOutputRepresentation') {
230
+ const v_error = (() => {
231
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
232
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
233
+ }
234
+ const obj_fields = obj.fields;
235
+ const path_fields = path + '.fields';
236
+ if (!ArrayIsArray(obj_fields)) {
237
+ return new TypeError('Expected "array" but received "' + typeof obj_fields + '" (at "' + path_fields + '")');
238
+ }
239
+ for (let i = 0; i < obj_fields.length; i++) {
240
+ const obj_fields_item = obj_fields[i];
241
+ const path_fields_item = path_fields + '[' + i + ']';
242
+ const referencepath_fields_itemValidationError = validate$4(obj_fields_item, path_fields_item);
243
+ if (referencepath_fields_itemValidationError !== null) {
244
+ let message = 'Object doesn\'t match CdpApplicationDataGraphFieldOutputRepresentation (at "' + path_fields_item + '")\n';
245
+ message += referencepath_fields_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
246
+ return new TypeError(message);
247
+ }
248
+ }
249
+ if (obj.path !== undefined) {
250
+ const obj_path = obj.path;
251
+ const path_path = path + '.path';
252
+ if (!ArrayIsArray(obj_path)) {
253
+ return new TypeError('Expected "array" but received "' + typeof obj_path + '" (at "' + path_path + '")');
254
+ }
255
+ for (let i = 0; i < obj_path.length; i++) {
256
+ const obj_path_item = obj_path[i];
257
+ const path_path_item = path_path + '[' + i + ']';
258
+ const referencepath_path_itemValidationError = validate$3(obj_path_item, path_path_item);
259
+ if (referencepath_path_itemValidationError !== null) {
260
+ let message = 'Object doesn\'t match CdpApplicationDataGraphPathToParentOutputRepresentation (at "' + path_path_item + '")\n';
261
+ message += referencepath_path_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
262
+ return new TypeError(message);
263
+ }
264
+ }
265
+ }
266
+ if (obj.recencyCriteria !== undefined) {
267
+ const obj_recencyCriteria = obj.recencyCriteria;
268
+ const path_recencyCriteria = path + '.recencyCriteria';
269
+ const referencepath_recencyCriteriaValidationError = validate$2(obj_recencyCriteria, path_recencyCriteria);
270
+ if (referencepath_recencyCriteriaValidationError !== null) {
271
+ let message = 'Object doesn\'t match CdpApplicationDataGraphRecencyCriteriaOutputRepresentation (at "' + path_recencyCriteria + '")\n';
272
+ message += referencepath_recencyCriteriaValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
273
+ return new TypeError(message);
274
+ }
275
+ }
276
+ const obj_relatedObjects = obj.relatedObjects;
277
+ const path_relatedObjects = path + '.relatedObjects';
278
+ if (!ArrayIsArray(obj_relatedObjects)) {
279
+ return new TypeError('Expected "array" but received "' + typeof obj_relatedObjects + '" (at "' + path_relatedObjects + '")');
280
+ }
281
+ for (let i = 0; i < obj_relatedObjects.length; i++) {
282
+ const obj_relatedObjects_item = obj_relatedObjects[i];
283
+ const path_relatedObjects_item = path_relatedObjects + '[' + i + ']';
284
+ if (obj_relatedObjects_item === undefined) {
285
+ return new TypeError('Expected "defined" but received "' + typeof obj_relatedObjects_item + '" (at "' + path_relatedObjects_item + '")');
286
+ }
287
+ }
288
+ const obj_type = obj.type;
289
+ const path_type = path + '.type';
290
+ if (typeof obj_type !== 'string') {
291
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
292
+ }
293
+ })();
294
+ return v_error === undefined ? null : v_error;
295
+ }
296
+ function equals$1(existing, incoming) {
297
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
298
+ return false;
299
+ }
300
+ return true;
301
+ }
302
+
303
+ const VERSION = "4b0a63cfd4548d05f499d3b760f52560";
304
+ function validate(obj, path = 'CdpApplicationDataGraphOutputRepresentation') {
305
+ const validateCdpObjectBaseOutputRepresentation_validateError = validate$5(obj, path);
306
+ if (validateCdpObjectBaseOutputRepresentation_validateError !== null) {
307
+ return validateCdpObjectBaseOutputRepresentation_validateError;
308
+ }
309
+ const v_error = (() => {
310
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
311
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
312
+ }
313
+ const obj_extendedProperties = obj.extendedProperties;
314
+ const path_extendedProperties = path + '.extendedProperties';
315
+ if (typeof obj_extendedProperties !== 'string') {
316
+ return new TypeError('Expected "string" but received "' + typeof obj_extendedProperties + '" (at "' + path_extendedProperties + '")');
317
+ }
318
+ const obj_idDmoName = obj.idDmoName;
319
+ const path_idDmoName = path + '.idDmoName';
320
+ if (typeof obj_idDmoName !== 'string') {
321
+ return new TypeError('Expected "string" but received "' + typeof obj_idDmoName + '" (at "' + path_idDmoName + '")');
322
+ }
323
+ const obj_primaryObjectName = obj.primaryObjectName;
324
+ const path_primaryObjectName = path + '.primaryObjectName';
325
+ if (typeof obj_primaryObjectName !== 'string') {
326
+ return new TypeError('Expected "string" but received "' + typeof obj_primaryObjectName + '" (at "' + path_primaryObjectName + '")');
327
+ }
328
+ const obj_primaryObjectType = obj.primaryObjectType;
329
+ const path_primaryObjectType = path + '.primaryObjectType';
330
+ if (typeof obj_primaryObjectType !== 'string') {
331
+ return new TypeError('Expected "string" but received "' + typeof obj_primaryObjectType + '" (at "' + path_primaryObjectType + '")');
332
+ }
333
+ const obj_sourceObject = obj.sourceObject;
334
+ const path_sourceObject = path + '.sourceObject';
335
+ const referencepath_sourceObjectValidationError = validate$1(obj_sourceObject, path_sourceObject);
336
+ if (referencepath_sourceObjectValidationError !== null) {
337
+ let message = 'Object doesn\'t match CdpApplicationDataGraphSourceObjectOutputRepresentation (at "' + path_sourceObject + '")\n';
338
+ message += referencepath_sourceObjectValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
339
+ return new TypeError(message);
340
+ }
341
+ const obj_status = obj.status;
342
+ const path_status = path + '.status';
343
+ if (typeof obj_status !== 'string') {
344
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
345
+ }
346
+ const obj_valuesDmoName = obj.valuesDmoName;
347
+ const path_valuesDmoName = path + '.valuesDmoName';
348
+ if (typeof obj_valuesDmoName !== 'string') {
349
+ return new TypeError('Expected "string" but received "' + typeof obj_valuesDmoName + '" (at "' + path_valuesDmoName + '")');
350
+ }
351
+ const obj_version = obj.version;
352
+ const path_version = path + '.version';
353
+ if (typeof obj_version !== 'string') {
354
+ return new TypeError('Expected "string" but received "' + typeof obj_version + '" (at "' + path_version + '")');
355
+ }
356
+ })();
357
+ return v_error === undefined ? null : v_error;
358
+ }
359
+ const RepresentationType = 'CdpApplicationDataGraphOutputRepresentation';
360
+ function keyBuilder$3(luvio, config) {
361
+ return keyBuilder$4(luvio, config);
362
+ }
363
+ function keyBuilderFromType(luvio, object) {
364
+ return keyBuilderFromType$1(luvio, object);
365
+ }
366
+ function normalize(input, existing, path, luvio, store, timestamp) {
367
+ return input;
368
+ }
369
+ const select$2 = function CdpApplicationDataGraphOutputRepresentationSelect() {
370
+ return {
371
+ kind: 'Fragment',
372
+ version: VERSION,
373
+ private: [],
374
+ opaque: true
375
+ };
376
+ };
377
+ function equals(existing, incoming) {
378
+ if (equals$2(existing, incoming) === false) {
379
+ return false;
380
+ }
381
+ const existing_extendedProperties = existing.extendedProperties;
382
+ const incoming_extendedProperties = incoming.extendedProperties;
383
+ if (!(existing_extendedProperties === incoming_extendedProperties)) {
384
+ return false;
385
+ }
386
+ const existing_idDmoName = existing.idDmoName;
387
+ const incoming_idDmoName = incoming.idDmoName;
388
+ if (!(existing_idDmoName === incoming_idDmoName)) {
389
+ return false;
390
+ }
391
+ const existing_primaryObjectName = existing.primaryObjectName;
392
+ const incoming_primaryObjectName = incoming.primaryObjectName;
393
+ if (!(existing_primaryObjectName === incoming_primaryObjectName)) {
394
+ return false;
395
+ }
396
+ const existing_primaryObjectType = existing.primaryObjectType;
397
+ const incoming_primaryObjectType = incoming.primaryObjectType;
398
+ if (!(existing_primaryObjectType === incoming_primaryObjectType)) {
399
+ return false;
400
+ }
401
+ const existing_status = existing.status;
402
+ const incoming_status = incoming.status;
403
+ if (!(existing_status === incoming_status)) {
404
+ return false;
405
+ }
406
+ const existing_valuesDmoName = existing.valuesDmoName;
407
+ const incoming_valuesDmoName = incoming.valuesDmoName;
408
+ if (!(existing_valuesDmoName === incoming_valuesDmoName)) {
409
+ return false;
410
+ }
411
+ const existing_version = existing.version;
412
+ const incoming_version = incoming.version;
413
+ if (!(existing_version === incoming_version)) {
414
+ return false;
415
+ }
416
+ const existing_sourceObject = existing.sourceObject;
417
+ const incoming_sourceObject = incoming.sourceObject;
418
+ if (!(equals$1(existing_sourceObject, incoming_sourceObject))) {
419
+ return false;
420
+ }
421
+ return true;
422
+ }
423
+ const ingest = function CdpApplicationDataGraphOutputRepresentationIngest(input, path, luvio, store, timestamp) {
424
+ if (process.env.NODE_ENV !== 'production') {
425
+ const validateError = validate(input);
426
+ if (validateError !== null) {
427
+ throw validateError;
428
+ }
429
+ }
430
+ const key = keyBuilderFromType(luvio, input);
431
+ const existingRecord = store.readEntry(key);
432
+ const ttlToUse = path.ttl !== undefined ? path.ttl : 3000000;
433
+ let incomingRecord = normalize(input, store.readEntry(key), {
434
+ fullPath: key,
435
+ parent: path.parent,
436
+ propertyName: path.propertyName,
437
+ ttl: ttlToUse
438
+ });
439
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
440
+ luvio.storePublish(key, incomingRecord);
441
+ }
442
+ if (ttlToUse !== undefined) {
443
+ const storeMetadataParams = {
444
+ ttl: ttlToUse,
445
+ namespace: "CDP",
446
+ version: VERSION,
447
+ representationName: RepresentationType,
448
+ };
449
+ luvio.publishStoreMetadata(key, storeMetadataParams);
450
+ }
451
+ return createLink(key);
452
+ };
453
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
454
+ const rootKeySet = new StoreKeyMap();
455
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
456
+ const rootKey = keyBuilderFromType(luvio, input);
457
+ rootKeySet.set(rootKey, {
458
+ namespace: keyPrefix,
459
+ representationName: RepresentationType$1,
460
+ mergeable: false
461
+ });
462
+ return rootKeySet;
463
+ }
464
+
465
+ function select$1(luvio, params) {
466
+ return select$2();
467
+ }
468
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
469
+ return getTypeCacheKeys(luvio, response);
470
+ }
471
+ function ingestSuccess$1(luvio, resourceParams, response) {
472
+ const { body } = response;
473
+ const key = keyBuilderFromType(luvio, body);
474
+ luvio.storeIngest(key, ingest, body);
475
+ const snapshot = luvio.storeLookup({
476
+ recordId: key,
477
+ node: select$1(),
478
+ variables: {},
479
+ });
480
+ if (process.env.NODE_ENV !== 'production') {
481
+ if (snapshot.state !== 'Fulfilled') {
482
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
483
+ }
484
+ }
485
+ deepFreeze(snapshot.data);
486
+ return snapshot;
487
+ }
488
+ function createResourceRequest$2(config) {
489
+ const headers = {};
490
+ return {
491
+ baseUri: '/services/data/v58.0',
492
+ basePath: '/ssot/application-data-graphs',
493
+ method: 'post',
494
+ body: config.body,
495
+ urlParams: {},
496
+ queryParams: {},
497
+ headers,
498
+ priority: 'normal',
499
+ };
500
+ }
501
+
502
+ const createAdg_ConfigPropertyNames = {
503
+ displayName: 'createAdg',
504
+ parameters: {
505
+ required: ['primaryObjectName', 'primaryObjectType', 'sourceObject'],
506
+ optional: ['dataspaceName', 'description', 'label', 'name']
507
+ }
508
+ };
509
+ function createResourceParams$2(config) {
510
+ const resourceParams = {
511
+ body: {
512
+ primaryObjectName: config.primaryObjectName, primaryObjectType: config.primaryObjectType, sourceObject: config.sourceObject
513
+ }
514
+ };
515
+ if (config['dataspaceName'] !== undefined) {
516
+ resourceParams.body['dataspaceName'] = config['dataspaceName'];
517
+ }
518
+ if (config['description'] !== undefined) {
519
+ resourceParams.body['description'] = config['description'];
520
+ }
521
+ if (config['label'] !== undefined) {
522
+ resourceParams.body['label'] = config['label'];
523
+ }
524
+ if (config['name'] !== undefined) {
525
+ resourceParams.body['name'] = config['name'];
526
+ }
527
+ return resourceParams;
528
+ }
529
+ function typeCheckConfig$2(untrustedConfig) {
530
+ const config = {};
531
+ const untrustedConfig_dataspaceName = untrustedConfig.dataspaceName;
532
+ if (typeof untrustedConfig_dataspaceName === 'string') {
533
+ config.dataspaceName = untrustedConfig_dataspaceName;
534
+ }
535
+ const untrustedConfig_description = untrustedConfig.description;
536
+ if (typeof untrustedConfig_description === 'string') {
537
+ config.description = untrustedConfig_description;
538
+ }
539
+ const untrustedConfig_label = untrustedConfig.label;
540
+ if (typeof untrustedConfig_label === 'string') {
541
+ config.label = untrustedConfig_label;
542
+ }
543
+ const untrustedConfig_name = untrustedConfig.name;
544
+ if (typeof untrustedConfig_name === 'string') {
545
+ config.name = untrustedConfig_name;
546
+ }
547
+ const untrustedConfig_primaryObjectName = untrustedConfig.primaryObjectName;
548
+ if (typeof untrustedConfig_primaryObjectName === 'string') {
549
+ config.primaryObjectName = untrustedConfig_primaryObjectName;
550
+ }
551
+ const untrustedConfig_primaryObjectType = untrustedConfig.primaryObjectType;
552
+ if (typeof untrustedConfig_primaryObjectType === 'string') {
553
+ config.primaryObjectType = untrustedConfig_primaryObjectType;
554
+ }
555
+ const untrustedConfig_sourceObject = untrustedConfig.sourceObject;
556
+ if (untrustedIsObject(untrustedConfig_sourceObject)) {
557
+ const untrustedConfig_sourceObject_object = {};
558
+ if (untrustedConfig_sourceObject_object !== undefined && Object.keys(untrustedConfig_sourceObject_object).length >= 0) {
559
+ config.sourceObject = untrustedConfig_sourceObject_object;
560
+ }
561
+ }
562
+ return config;
563
+ }
564
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
565
+ if (!untrustedIsObject(untrustedConfig)) {
566
+ return null;
567
+ }
568
+ if (process.env.NODE_ENV !== 'production') {
569
+ validateConfig(untrustedConfig, configPropertyNames);
570
+ }
571
+ const config = typeCheckConfig$2(untrustedConfig);
572
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
573
+ return null;
574
+ }
575
+ return config;
576
+ }
577
+ function buildNetworkSnapshot$2(luvio, config, options) {
578
+ const resourceParams = createResourceParams$2(config);
579
+ const request = createResourceRequest$2(resourceParams);
580
+ return luvio.dispatchResourceRequest(request, options)
581
+ .then((response) => {
582
+ return luvio.handleSuccessResponse(() => {
583
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
584
+ return luvio.storeBroadcast().then(() => snapshot);
585
+ }, () => getResponseCacheKeys$2(luvio, resourceParams, response.body));
586
+ }, (response) => {
587
+ deepFreeze(response);
588
+ throw response;
589
+ });
590
+ }
591
+ const createAdgAdapterFactory = (luvio) => {
592
+ return function createAdg(untrustedConfig) {
593
+ const config = validateAdapterConfig$2(untrustedConfig, createAdg_ConfigPropertyNames);
594
+ // Invalid or incomplete config
595
+ if (config === null) {
596
+ throw new Error('Invalid config for "createAdg"');
597
+ }
598
+ return buildNetworkSnapshot$2(luvio, config);
599
+ };
600
+ };
601
+
602
+ function keyBuilder$2(luvio, params) {
603
+ return keyBuilder$3(luvio, {
604
+ name: params.urlParams.adgName
605
+ });
606
+ }
607
+ function getResponseCacheKeys$1(luvio, resourceParams) {
608
+ const key = keyBuilder$2(luvio, resourceParams);
609
+ const cacheKeyMap = new StoreKeyMap();
610
+ cacheKeyMap.set(key, {
611
+ namespace: keyPrefix,
612
+ representationName: RepresentationType,
613
+ mergeable: false
614
+ });
615
+ return cacheKeyMap;
616
+ }
617
+ function evictSuccess(luvio, resourceParams) {
618
+ const key = keyBuilder$2(luvio, resourceParams);
619
+ luvio.storeEvict(key);
620
+ }
621
+ function createResourceRequest$1(config) {
622
+ const headers = {};
623
+ return {
624
+ baseUri: '/services/data/v58.0',
625
+ basePath: '/ssot/application-data-graphs/' + config.urlParams.adgName + '',
626
+ method: 'delete',
627
+ body: null,
628
+ urlParams: config.urlParams,
629
+ queryParams: {},
630
+ headers,
631
+ priority: 'normal',
632
+ };
633
+ }
634
+
635
+ const adapterName = 'deleteAdg';
636
+ const deleteAdg_ConfigPropertyNames = {
637
+ displayName: 'deleteAdg',
638
+ parameters: {
639
+ required: ['adgName'],
640
+ optional: []
641
+ }
642
+ };
643
+ function createResourceParams$1(config) {
644
+ const resourceParams = {
645
+ urlParams: {
646
+ adgName: config.adgName
647
+ }
648
+ };
649
+ return resourceParams;
650
+ }
651
+ function typeCheckConfig$1(untrustedConfig) {
652
+ const config = {};
653
+ const untrustedConfig_adgName = untrustedConfig.adgName;
654
+ if (typeof untrustedConfig_adgName === 'string') {
655
+ config.adgName = untrustedConfig_adgName;
656
+ }
657
+ return config;
658
+ }
659
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
660
+ if (!untrustedIsObject(untrustedConfig)) {
661
+ return null;
662
+ }
663
+ if (process.env.NODE_ENV !== 'production') {
664
+ validateConfig(untrustedConfig, configPropertyNames);
665
+ }
666
+ const config = typeCheckConfig$1(untrustedConfig);
667
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
668
+ return null;
669
+ }
670
+ return config;
671
+ }
672
+ function buildNetworkSnapshot$1(luvio, config, options) {
673
+ const resourceParams = createResourceParams$1(config);
674
+ const request = createResourceRequest$1(resourceParams);
675
+ return luvio.dispatchResourceRequest(request, options)
676
+ .then(() => {
677
+ return luvio.handleSuccessResponse(() => {
678
+ evictSuccess(luvio, resourceParams);
679
+ return luvio.storeBroadcast();
680
+ }, () => getResponseCacheKeys$1(luvio, resourceParams));
681
+ }, (response) => {
682
+ deepFreeze(response);
683
+ throw response;
684
+ });
685
+ }
686
+ const deleteAdgAdapterFactory = (luvio) => {
687
+ return function CDPdeleteAdg(untrustedConfig) {
688
+ const config = validateAdapterConfig$1(untrustedConfig, deleteAdg_ConfigPropertyNames);
689
+ // Invalid or incomplete config
690
+ if (config === null) {
691
+ throw new Error(`Invalid config for "${adapterName}"`);
692
+ }
693
+ return buildNetworkSnapshot$1(luvio, config);
694
+ };
695
+ };
696
+
697
+ function select(luvio, params) {
698
+ return select$2();
699
+ }
700
+ function keyBuilder$1(luvio, params) {
701
+ return keyBuilder$3(luvio, {
702
+ name: params.urlParams.adgName
703
+ });
704
+ }
705
+ function getResponseCacheKeys(luvio, resourceParams, response) {
706
+ return getTypeCacheKeys(luvio, response);
707
+ }
708
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
709
+ const { body } = response;
710
+ const key = keyBuilder$1(luvio, resourceParams);
711
+ luvio.storeIngest(key, ingest, body);
712
+ const snapshot = luvio.storeLookup({
713
+ recordId: key,
714
+ node: select(),
715
+ variables: {},
716
+ }, snapshotRefresh);
717
+ if (process.env.NODE_ENV !== 'production') {
718
+ if (snapshot.state !== 'Fulfilled') {
719
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
720
+ }
721
+ }
722
+ deepFreeze(snapshot.data);
723
+ return snapshot;
724
+ }
725
+ function ingestError(luvio, params, error, snapshotRefresh) {
726
+ const key = keyBuilder$1(luvio, params);
727
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
728
+ luvio.storeIngestError(key, errorSnapshot);
729
+ return errorSnapshot;
730
+ }
731
+ function createResourceRequest(config) {
732
+ const headers = {};
733
+ return {
734
+ baseUri: '/services/data/v58.0',
735
+ basePath: '/ssot/application-data-graphs/' + config.urlParams.adgName + '',
736
+ method: 'get',
737
+ body: null,
738
+ urlParams: config.urlParams,
739
+ queryParams: {},
740
+ headers,
741
+ priority: 'normal',
742
+ };
743
+ }
744
+ function createResourceRequestFromRepresentation(representation) {
745
+ const config = {
746
+ urlParams: {},
747
+ };
748
+ config.urlParams.adgName = representation.name;
749
+ return createResourceRequest(config);
750
+ }
751
+
752
+ const getAdg_ConfigPropertyNames = {
753
+ displayName: 'getAdg',
754
+ parameters: {
755
+ required: ['adgName'],
756
+ optional: []
757
+ }
758
+ };
759
+ function createResourceParams(config) {
760
+ const resourceParams = {
761
+ urlParams: {
762
+ adgName: config.adgName
763
+ }
764
+ };
765
+ return resourceParams;
766
+ }
767
+ function keyBuilder(luvio, config) {
768
+ const resourceParams = createResourceParams(config);
769
+ return keyBuilder$1(luvio, resourceParams);
770
+ }
771
+ function typeCheckConfig(untrustedConfig) {
772
+ const config = {};
773
+ const untrustedConfig_adgName = untrustedConfig.adgName;
774
+ if (typeof untrustedConfig_adgName === 'string') {
775
+ config.adgName = untrustedConfig_adgName;
776
+ }
777
+ return config;
778
+ }
779
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
780
+ if (!untrustedIsObject(untrustedConfig)) {
781
+ return null;
782
+ }
783
+ if (process.env.NODE_ENV !== 'production') {
784
+ validateConfig(untrustedConfig, configPropertyNames);
785
+ }
786
+ const config = typeCheckConfig(untrustedConfig);
787
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
788
+ return null;
789
+ }
790
+ return config;
791
+ }
792
+ function adapterFragment(luvio, config) {
793
+ createResourceParams(config);
794
+ return select();
795
+ }
796
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
797
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
798
+ config,
799
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
800
+ });
801
+ return luvio.storeBroadcast().then(() => snapshot);
802
+ }
803
+ function onFetchResponseError(luvio, config, resourceParams, response) {
804
+ const snapshot = ingestError(luvio, resourceParams, response, {
805
+ config,
806
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
807
+ });
808
+ return luvio.storeBroadcast().then(() => snapshot);
809
+ }
810
+ function buildNetworkSnapshot(luvio, config, options) {
811
+ const resourceParams = createResourceParams(config);
812
+ const request = createResourceRequest(resourceParams);
813
+ return luvio.dispatchResourceRequest(request, options)
814
+ .then((response) => {
815
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => getResponseCacheKeys(luvio, resourceParams, response.body));
816
+ }, (response) => {
817
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
818
+ });
819
+ }
820
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
821
+ const { luvio, config } = context;
822
+ const { networkPriority, requestCorrelator, eventObservers } = coercedAdapterRequestContext;
823
+ const dispatchOptions = {
824
+ resourceRequestContext: {
825
+ requestCorrelator,
826
+ luvioRequestMethod: undefined,
827
+ },
828
+ eventObservers
829
+ };
830
+ if (networkPriority !== 'normal') {
831
+ dispatchOptions.overrides = {
832
+ priority: networkPriority
833
+ };
834
+ }
835
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
836
+ }
837
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
838
+ const { luvio, config } = context;
839
+ const selector = {
840
+ recordId: keyBuilder(luvio, config),
841
+ node: adapterFragment(luvio, config),
842
+ variables: {},
843
+ };
844
+ const cacheSnapshot = storeLookup(selector, {
845
+ config,
846
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
847
+ });
848
+ return cacheSnapshot;
849
+ }
850
+ const getAdgAdapterFactory = (luvio) => function CDP__getAdg(untrustedConfig, requestContext) {
851
+ const config = validateAdapterConfig(untrustedConfig, getAdg_ConfigPropertyNames);
852
+ // Invalid or incomplete config
853
+ if (config === null) {
854
+ return null;
855
+ }
856
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
857
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
858
+ };
859
+ const notifyChangeFactory = (luvio, options) => {
860
+ return function getSsotApplicationDataGraphsByAdgNameNotifyChange(configs) {
861
+ const keys = configs.map(c => keyBuilder$3(luvio, c));
862
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
863
+ for (let i = 0, len = entries.length; i < len; i++) {
864
+ const { key, record: val } = entries[i];
865
+ const refreshRequest = createResourceRequestFromRepresentation(val);
866
+ luvio.dispatchResourceRequest(refreshRequest, options)
867
+ .then((response) => {
868
+ return luvio.handleSuccessResponse(() => {
869
+ const { body } = response;
870
+ luvio.storeIngest(key, ingest, body);
871
+ return luvio.storeBroadcast();
872
+ }, () => getTypeCacheKeys(luvio, response.body));
873
+ }, (error) => {
874
+ return luvio.handleErrorResponse(() => {
875
+ const errorSnapshot = luvio.errorSnapshot(error);
876
+ luvio.storeIngestError(key, errorSnapshot, undefined);
877
+ return luvio.storeBroadcast().then(() => errorSnapshot);
878
+ });
879
+ });
880
+ }
881
+ });
882
+ };
883
+ };
884
+
885
+ let createAdg;
886
+ let deleteAdg;
887
+ let getAdg;
888
+ let getAdgNotifyChange;
889
+ // Imperative GET Adapters
890
+ let getAdg_imperative;
891
+ const getAdgMetadata = { apiFamily: 'CDP', name: 'getAdg' };
892
+ function bindExportsTo(luvio) {
893
+ // LDS Adapters
894
+ const getAdg_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getAdg', getAdgAdapterFactory), getAdgMetadata);
895
+ function unwrapSnapshotData(factory) {
896
+ const adapter = factory(luvio);
897
+ return (config) => adapter(config).then(snapshot => snapshot.data);
898
+ }
899
+ return {
900
+ createAdg: unwrapSnapshotData(createAdgAdapterFactory),
901
+ deleteAdg: createLDSAdapter(luvio, adapterName, deleteAdgAdapterFactory),
902
+ getAdg: createWireAdapterConstructor(luvio, getAdg_ldsAdapter, getAdgMetadata),
903
+ getAdgNotifyChange: createLDSAdapter(luvio, 'getAdgNotifyChange', notifyChangeFactory),
904
+ // Imperative GET Adapters
905
+ getAdg_imperative: createImperativeAdapter(luvio, getAdg_ldsAdapter, getAdgMetadata)
906
+ };
907
+ }
908
+ withDefaultLuvio((luvio) => {
909
+ ({
910
+ createAdg,
911
+ deleteAdg,
912
+ getAdg,
913
+ getAdgNotifyChange,
914
+ getAdg_imperative
915
+ } = bindExportsTo(luvio));
916
+ });
917
+
918
+ export { createAdg, deleteAdg, getAdg, getAdgNotifyChange, getAdg_imperative };
919
+ // version: 1.140.0-255a5f374