@salesforce/lds-adapters-industries-sustainability-dgf 0.1.0-dev1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-sustainability-dgf.js +621 -0
  3. package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
  4. package/dist/es/es2018/types/src/generated/adapters/computeDataGapFillers.d.ts +16 -0
  5. package/dist/es/es2018/types/src/generated/adapters/identifyDateIssues.d.ts +16 -0
  6. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
  7. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -0
  8. package/dist/es/es2018/types/src/generated/resources/postConnectSustainabilityDgfComputeDatagapFillers.d.ts +13 -0
  9. package/dist/es/es2018/types/src/generated/resources/postConnectSustainabilityDgfIdentifyDateIssues.d.ts +13 -0
  10. package/dist/es/es2018/types/src/generated/types/FilterInputRepresentation.d.ts +31 -0
  11. package/dist/es/es2018/types/src/generated/types/SustainabilityDGFDataGapFillerInputRepresentation.d.ts +35 -0
  12. package/dist/es/es2018/types/src/generated/types/SustainabilityDGFDataGapFillerInputWrapperRepresentation.d.ts +29 -0
  13. package/dist/es/es2018/types/src/generated/types/SustainabilityDGFDataGapFillerRepresentation.d.ts +45 -0
  14. package/dist/es/es2018/types/src/generated/types/SustainabilityDataGapRecordRepresentation.d.ts +36 -0
  15. package/dist/es/es2018/types/src/generated/types/SustainabilityDateIssueInputRepresentation.d.ts +35 -0
  16. package/dist/es/es2018/types/src/generated/types/SustainabilityDateIssueInputWrapperRepresentation.d.ts +29 -0
  17. package/dist/es/es2018/types/src/generated/types/SustainabilityDateIssueRepresentation.d.ts +50 -0
  18. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  19. package/package.json +70 -0
  20. package/sfdc/index.d.ts +1 -0
  21. package/sfdc/index.js +651 -0
  22. package/src/raml/api.raml +170 -0
  23. package/src/raml/luvio.raml +28 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,651 @@
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 { withDefaultLuvio } from 'force/ldsEngine';
16
+ import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$2 } from 'force/luvioEngine';
17
+
18
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
19
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
20
+ const { isArray: ArrayIsArray$1 } = Array;
21
+ /**
22
+ * Validates an adapter config is well-formed.
23
+ * @param config The config to validate.
24
+ * @param adapter The adapter validation configuration.
25
+ * @param oneOf The keys the config must contain at least one of.
26
+ * @throws A TypeError if config doesn't satisfy the adapter's config validation.
27
+ */
28
+ function validateConfig(config, adapter, oneOf) {
29
+ const { displayName } = adapter;
30
+ const { required, optional, unsupported } = adapter.parameters;
31
+ if (config === undefined ||
32
+ required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
33
+ throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
34
+ }
35
+ if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
36
+ throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
37
+ }
38
+ if (unsupported !== undefined &&
39
+ unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
40
+ throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
41
+ }
42
+ const supported = required.concat(optional);
43
+ if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
44
+ throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
45
+ }
46
+ }
47
+ function untrustedIsObject(untrusted) {
48
+ return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
49
+ }
50
+ function areRequiredParametersPresent(config, configPropertyNames) {
51
+ return configPropertyNames.parameters.required.every(req => req in config);
52
+ }
53
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
54
+ return {
55
+ name,
56
+ required,
57
+ resourceType,
58
+ typeCheckShape,
59
+ isArrayShape,
60
+ coerceFn,
61
+ };
62
+ }
63
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
64
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
65
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
66
+ return {
67
+ displayName,
68
+ parameters: {
69
+ required,
70
+ optional,
71
+ }
72
+ };
73
+ }
74
+ const keyPrefix = 'sustainability-dgf';
75
+
76
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
77
+ const { isArray: ArrayIsArray } = Array;
78
+ const { stringify: JSONStringify } = JSON;
79
+ function createLink(ref) {
80
+ return {
81
+ __ref: serializeStructuredKey(ref),
82
+ };
83
+ }
84
+
85
+ function validate$5(obj, path = 'FilterInputRepresentation') {
86
+ const v_error = (() => {
87
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
88
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
89
+ }
90
+ const obj_item = obj.item;
91
+ const path_item = path + '.item';
92
+ if (typeof obj_item !== 'string') {
93
+ return new TypeError('Expected "string" but received "' + typeof obj_item + '" (at "' + path_item + '")');
94
+ }
95
+ const obj_value = obj.value;
96
+ const path_value = path + '.value';
97
+ if (typeof obj_value !== 'string') {
98
+ return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
99
+ }
100
+ })();
101
+ return v_error === undefined ? null : v_error;
102
+ }
103
+
104
+ function validate$4(obj, path = 'SustainabilityDGFDataGapFillerInputRepresentation') {
105
+ const v_error = (() => {
106
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
107
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
108
+ }
109
+ if (obj.filters !== undefined) {
110
+ const obj_filters = obj.filters;
111
+ const path_filters = path + '.filters';
112
+ if (!ArrayIsArray(obj_filters)) {
113
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
114
+ }
115
+ for (let i = 0; i < obj_filters.length; i++) {
116
+ const obj_filters_item = obj_filters[i];
117
+ const path_filters_item = path_filters + '[' + i + ']';
118
+ const referencepath_filters_itemValidationError = validate$5(obj_filters_item, path_filters_item);
119
+ if (referencepath_filters_itemValidationError !== null) {
120
+ let message = 'Object doesn\'t match FilterInputRepresentation (at "' + path_filters_item + '")\n';
121
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
122
+ return new TypeError(message);
123
+ }
124
+ }
125
+ }
126
+ const obj_methods = obj.methods;
127
+ const path_methods = path + '.methods';
128
+ if (!ArrayIsArray(obj_methods)) {
129
+ return new TypeError('Expected "array" but received "' + typeof obj_methods + '" (at "' + path_methods + '")');
130
+ }
131
+ for (let i = 0; i < obj_methods.length; i++) {
132
+ const obj_methods_item = obj_methods[i];
133
+ const path_methods_item = path_methods + '[' + i + ']';
134
+ if (typeof obj_methods_item !== 'string') {
135
+ return new TypeError('Expected "string" but received "' + typeof obj_methods_item + '" (at "' + path_methods_item + '")');
136
+ }
137
+ }
138
+ const obj_recordId = obj.recordId;
139
+ const path_recordId = path + '.recordId';
140
+ if (typeof obj_recordId !== 'string') {
141
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
142
+ }
143
+ })();
144
+ return v_error === undefined ? null : v_error;
145
+ }
146
+
147
+ function validate$3(obj, path = 'SustainabilityDataGapRecordRepresentation') {
148
+ const v_error = (() => {
149
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
150
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
151
+ }
152
+ const obj_fillValues = obj.fillValues;
153
+ const path_fillValues = path + '.fillValues';
154
+ if (typeof obj_fillValues !== 'object' || ArrayIsArray(obj_fillValues) || obj_fillValues === null) {
155
+ return new TypeError('Expected "object" but received "' + typeof obj_fillValues + '" (at "' + path_fillValues + '")');
156
+ }
157
+ const obj_fillValues_keys = ObjectKeys(obj_fillValues);
158
+ for (let i = 0; i < obj_fillValues_keys.length; i++) {
159
+ const key = obj_fillValues_keys[i];
160
+ const obj_fillValues_prop = obj_fillValues[key];
161
+ const path_fillValues_prop = path_fillValues + '["' + key + '"]';
162
+ if (typeof obj_fillValues_prop !== 'object' || ArrayIsArray(obj_fillValues_prop) || obj_fillValues_prop === null) {
163
+ return new TypeError('Expected "object" but received "' + typeof obj_fillValues_prop + '" (at "' + path_fillValues_prop + '")');
164
+ }
165
+ const obj_fillValues_prop_keys = ObjectKeys(obj_fillValues_prop);
166
+ for (let i = 0; i < obj_fillValues_prop_keys.length; i++) {
167
+ const key = obj_fillValues_prop_keys[i];
168
+ const obj_fillValues_prop_prop = obj_fillValues_prop[key];
169
+ const path_fillValues_prop_prop = path_fillValues_prop + '["' + key + '"]';
170
+ let obj_fillValues_prop_prop_union0 = null;
171
+ const obj_fillValues_prop_prop_union0_error = (() => {
172
+ if (typeof obj_fillValues_prop_prop !== 'string') {
173
+ return new TypeError('Expected "string" but received "' + typeof obj_fillValues_prop_prop + '" (at "' + path_fillValues_prop_prop + '")');
174
+ }
175
+ })();
176
+ if (obj_fillValues_prop_prop_union0_error != null) {
177
+ obj_fillValues_prop_prop_union0 = obj_fillValues_prop_prop_union0_error.message;
178
+ }
179
+ let obj_fillValues_prop_prop_union1 = null;
180
+ const obj_fillValues_prop_prop_union1_error = (() => {
181
+ if (typeof obj_fillValues_prop_prop !== 'boolean') {
182
+ return new TypeError('Expected "boolean" but received "' + typeof obj_fillValues_prop_prop + '" (at "' + path_fillValues_prop_prop + '")');
183
+ }
184
+ })();
185
+ if (obj_fillValues_prop_prop_union1_error != null) {
186
+ obj_fillValues_prop_prop_union1 = obj_fillValues_prop_prop_union1_error.message;
187
+ }
188
+ let obj_fillValues_prop_prop_union2 = null;
189
+ const obj_fillValues_prop_prop_union2_error = (() => {
190
+ if (typeof obj_fillValues_prop_prop !== 'number') {
191
+ return new TypeError('Expected "number" but received "' + typeof obj_fillValues_prop_prop + '" (at "' + path_fillValues_prop_prop + '")');
192
+ }
193
+ })();
194
+ if (obj_fillValues_prop_prop_union2_error != null) {
195
+ obj_fillValues_prop_prop_union2 = obj_fillValues_prop_prop_union2_error.message;
196
+ }
197
+ if (obj_fillValues_prop_prop_union0 && obj_fillValues_prop_prop_union1 && obj_fillValues_prop_prop_union2) {
198
+ let message = 'Object doesn\'t match union (at "' + path_fillValues_prop_prop + '")';
199
+ message += '\n' + obj_fillValues_prop_prop_union0.split('\n').map((line) => '\t' + line).join('\n');
200
+ message += '\n' + obj_fillValues_prop_prop_union1.split('\n').map((line) => '\t' + line).join('\n');
201
+ message += '\n' + obj_fillValues_prop_prop_union2.split('\n').map((line) => '\t' + line).join('\n');
202
+ return new TypeError(message);
203
+ }
204
+ }
205
+ }
206
+ })();
207
+ return v_error === undefined ? null : v_error;
208
+ }
209
+
210
+ const TTL$1 = 300;
211
+ const VERSION$1 = "20f60d76914da6f322a4b2e4293fe338";
212
+ function validate$2(obj, path = 'SustainabilityDGFDataGapFillerRepresentation') {
213
+ const v_error = (() => {
214
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
215
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
216
+ }
217
+ const obj_code = obj.code;
218
+ const path_code = path + '.code';
219
+ if (typeof obj_code !== 'number' || (typeof obj_code === 'number' && Math.floor(obj_code) !== obj_code)) {
220
+ return new TypeError('Expected "integer" but received "' + typeof obj_code + '" (at "' + path_code + '")');
221
+ }
222
+ const obj_gaps = obj.gaps;
223
+ const path_gaps = path + '.gaps';
224
+ if (!ArrayIsArray(obj_gaps)) {
225
+ return new TypeError('Expected "array" but received "' + typeof obj_gaps + '" (at "' + path_gaps + '")');
226
+ }
227
+ for (let i = 0; i < obj_gaps.length; i++) {
228
+ const obj_gaps_item = obj_gaps[i];
229
+ const path_gaps_item = path_gaps + '[' + i + ']';
230
+ const referencepath_gaps_itemValidationError = validate$3(obj_gaps_item, path_gaps_item);
231
+ if (referencepath_gaps_itemValidationError !== null) {
232
+ let message = 'Object doesn\'t match SustainabilityDataGapRecordRepresentation (at "' + path_gaps_item + '")\n';
233
+ message += referencepath_gaps_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
234
+ return new TypeError(message);
235
+ }
236
+ }
237
+ const obj_message = obj.message;
238
+ const path_message = path + '.message';
239
+ if (typeof obj_message !== 'string') {
240
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
241
+ }
242
+ })();
243
+ return v_error === undefined ? null : v_error;
244
+ }
245
+ const RepresentationType$1 = 'SustainabilityDGFDataGapFillerRepresentation';
246
+ function keyBuilder$1(luvio, config) {
247
+ return keyPrefix + '::' + RepresentationType$1 + ':' + config.message;
248
+ }
249
+ function keyBuilderFromType$1(luvio, object) {
250
+ const keyParams = {
251
+ message: object.message
252
+ };
253
+ return keyBuilder$1(luvio, keyParams);
254
+ }
255
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
256
+ return input;
257
+ }
258
+ const select$3 = function SustainabilityDGFDataGapFillerRepresentationSelect() {
259
+ return {
260
+ kind: 'Fragment',
261
+ version: VERSION$1,
262
+ private: [],
263
+ opaque: true
264
+ };
265
+ };
266
+ function equals$1(existing, incoming) {
267
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
268
+ return false;
269
+ }
270
+ return true;
271
+ }
272
+ const ingest$1 = function SustainabilityDGFDataGapFillerRepresentationIngest(input, path, luvio, store, timestamp) {
273
+ if (process.env.NODE_ENV !== 'production') {
274
+ const validateError = validate$2(input);
275
+ if (validateError !== null) {
276
+ throw validateError;
277
+ }
278
+ }
279
+ const key = keyBuilderFromType$1(luvio, input);
280
+ const ttlToUse = TTL$1;
281
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "sustainability-dgf", VERSION$1, RepresentationType$1, equals$1);
282
+ return createLink(key);
283
+ };
284
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
285
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
286
+ const rootKey = keyBuilderFromType$1(luvio, input);
287
+ rootKeySet.set(rootKey, {
288
+ namespace: keyPrefix,
289
+ representationName: RepresentationType$1,
290
+ mergeable: false
291
+ });
292
+ }
293
+
294
+ function select$2(luvio, params) {
295
+ return select$3();
296
+ }
297
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
298
+ getTypeCacheKeys$1(storeKeyMap, luvio, response);
299
+ }
300
+ function ingestSuccess$1(luvio, resourceParams, response) {
301
+ const { body } = response;
302
+ const key = keyBuilderFromType$1(luvio, body);
303
+ luvio.storeIngest(key, ingest$1, body);
304
+ const snapshot = luvio.storeLookup({
305
+ recordId: key,
306
+ node: select$2(),
307
+ variables: {},
308
+ });
309
+ if (process.env.NODE_ENV !== 'production') {
310
+ if (snapshot.state !== 'Fulfilled') {
311
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
312
+ }
313
+ }
314
+ deepFreeze(snapshot.data);
315
+ return snapshot;
316
+ }
317
+ function createResourceRequest$1(config) {
318
+ const headers = {};
319
+ return {
320
+ baseUri: '/services/data/v66.0',
321
+ basePath: '/connect/sustainability/dgf/compute-datagap-fillers',
322
+ method: 'post',
323
+ body: config.body,
324
+ urlParams: {},
325
+ queryParams: {},
326
+ headers,
327
+ priority: 'normal',
328
+ };
329
+ }
330
+
331
+ const adapterName$1 = 'computeDataGapFillers';
332
+ const computeDataGapFillers_ConfigPropertyMetadata = [
333
+ generateParamConfigMetadata('dataGapInput', true, 2 /* Body */, 4 /* Unsupported */),
334
+ ];
335
+ const computeDataGapFillers_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, computeDataGapFillers_ConfigPropertyMetadata);
336
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(computeDataGapFillers_ConfigPropertyMetadata);
337
+ function typeCheckConfig$1(untrustedConfig) {
338
+ const config = {};
339
+ const untrustedConfig_dataGapInput = untrustedConfig.dataGapInput;
340
+ const referenceSustainabilityDGFDataGapFillerInputRepresentationValidationError = validate$4(untrustedConfig_dataGapInput);
341
+ if (referenceSustainabilityDGFDataGapFillerInputRepresentationValidationError === null) {
342
+ config.dataGapInput = untrustedConfig_dataGapInput;
343
+ }
344
+ return config;
345
+ }
346
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
347
+ if (!untrustedIsObject(untrustedConfig)) {
348
+ return null;
349
+ }
350
+ if (process.env.NODE_ENV !== 'production') {
351
+ validateConfig(untrustedConfig, configPropertyNames);
352
+ }
353
+ const config = typeCheckConfig$1(untrustedConfig);
354
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
355
+ return null;
356
+ }
357
+ return config;
358
+ }
359
+ function buildNetworkSnapshot$1(luvio, config, options) {
360
+ const resourceParams = createResourceParams$1(config);
361
+ const request = createResourceRequest$1(resourceParams);
362
+ return luvio.dispatchResourceRequest(request, options)
363
+ .then((response) => {
364
+ return luvio.handleSuccessResponse(() => {
365
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
366
+ return luvio.storeBroadcast().then(() => snapshot);
367
+ }, () => {
368
+ const cache = new StoreKeyMap();
369
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
370
+ return cache;
371
+ });
372
+ }, (response) => {
373
+ deepFreeze(response);
374
+ throw response;
375
+ });
376
+ }
377
+ const computeDataGapFillersAdapterFactory = (luvio) => {
378
+ return function computeDataGapFillers(untrustedConfig) {
379
+ const config = validateAdapterConfig$1(untrustedConfig, computeDataGapFillers_ConfigPropertyNames);
380
+ // Invalid or incomplete config
381
+ if (config === null) {
382
+ throw new Error('Invalid config for "computeDataGapFillers"');
383
+ }
384
+ return buildNetworkSnapshot$1(luvio, config);
385
+ };
386
+ };
387
+
388
+ function validate$1(obj, path = 'SustainabilityDateIssueInputRepresentation') {
389
+ const v_error = (() => {
390
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
391
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
392
+ }
393
+ if (obj.filters !== undefined) {
394
+ const obj_filters = obj.filters;
395
+ const path_filters = path + '.filters';
396
+ if (!ArrayIsArray(obj_filters)) {
397
+ return new TypeError('Expected "array" but received "' + typeof obj_filters + '" (at "' + path_filters + '")');
398
+ }
399
+ for (let i = 0; i < obj_filters.length; i++) {
400
+ const obj_filters_item = obj_filters[i];
401
+ const path_filters_item = path_filters + '[' + i + ']';
402
+ const referencepath_filters_itemValidationError = validate$5(obj_filters_item, path_filters_item);
403
+ if (referencepath_filters_itemValidationError !== null) {
404
+ let message = 'Object doesn\'t match FilterInputRepresentation (at "' + path_filters_item + '")\n';
405
+ message += referencepath_filters_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
406
+ return new TypeError(message);
407
+ }
408
+ }
409
+ }
410
+ const obj_recordId = obj.recordId;
411
+ const path_recordId = path + '.recordId';
412
+ if (typeof obj_recordId !== 'string') {
413
+ return new TypeError('Expected "string" but received "' + typeof obj_recordId + '" (at "' + path_recordId + '")');
414
+ }
415
+ const obj_types = obj.types;
416
+ const path_types = path + '.types';
417
+ if (!ArrayIsArray(obj_types)) {
418
+ return new TypeError('Expected "array" but received "' + typeof obj_types + '" (at "' + path_types + '")');
419
+ }
420
+ for (let i = 0; i < obj_types.length; i++) {
421
+ const obj_types_item = obj_types[i];
422
+ const path_types_item = path_types + '[' + i + ']';
423
+ if (typeof obj_types_item !== 'string') {
424
+ return new TypeError('Expected "string" but received "' + typeof obj_types_item + '" (at "' + path_types_item + '")');
425
+ }
426
+ }
427
+ })();
428
+ return v_error === undefined ? null : v_error;
429
+ }
430
+
431
+ const TTL = 300;
432
+ const VERSION = "8555aaa71a1d572ef3ee97ea43fd694c";
433
+ function validate(obj, path = 'SustainabilityDateIssueRepresentation') {
434
+ const v_error = (() => {
435
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
436
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
437
+ }
438
+ const obj_code = obj.code;
439
+ const path_code = path + '.code';
440
+ if (typeof obj_code !== 'number' || (typeof obj_code === 'number' && Math.floor(obj_code) !== obj_code)) {
441
+ return new TypeError('Expected "integer" but received "' + typeof obj_code + '" (at "' + path_code + '")');
442
+ }
443
+ const obj_message = obj.message;
444
+ const path_message = path + '.message';
445
+ if (typeof obj_message !== 'string') {
446
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
447
+ }
448
+ const obj_missingDatesRecords = obj.missingDatesRecords;
449
+ const path_missingDatesRecords = path + '.missingDatesRecords';
450
+ if (!ArrayIsArray(obj_missingDatesRecords)) {
451
+ return new TypeError('Expected "array" but received "' + typeof obj_missingDatesRecords + '" (at "' + path_missingDatesRecords + '")');
452
+ }
453
+ for (let i = 0; i < obj_missingDatesRecords.length; i++) {
454
+ const obj_missingDatesRecords_item = obj_missingDatesRecords[i];
455
+ const path_missingDatesRecords_item = path_missingDatesRecords + '[' + i + ']';
456
+ if (typeof obj_missingDatesRecords_item !== 'string') {
457
+ return new TypeError('Expected "string" but received "' + typeof obj_missingDatesRecords_item + '" (at "' + path_missingDatesRecords_item + '")');
458
+ }
459
+ }
460
+ const obj_outOfDateRangeRecords = obj.outOfDateRangeRecords;
461
+ const path_outOfDateRangeRecords = path + '.outOfDateRangeRecords';
462
+ if (!ArrayIsArray(obj_outOfDateRangeRecords)) {
463
+ return new TypeError('Expected "array" but received "' + typeof obj_outOfDateRangeRecords + '" (at "' + path_outOfDateRangeRecords + '")');
464
+ }
465
+ for (let i = 0; i < obj_outOfDateRangeRecords.length; i++) {
466
+ const obj_outOfDateRangeRecords_item = obj_outOfDateRangeRecords[i];
467
+ const path_outOfDateRangeRecords_item = path_outOfDateRangeRecords + '[' + i + ']';
468
+ if (typeof obj_outOfDateRangeRecords_item !== 'string') {
469
+ return new TypeError('Expected "string" but received "' + typeof obj_outOfDateRangeRecords_item + '" (at "' + path_outOfDateRangeRecords_item + '")');
470
+ }
471
+ }
472
+ const obj_overlappingDatesRecords = obj.overlappingDatesRecords;
473
+ const path_overlappingDatesRecords = path + '.overlappingDatesRecords';
474
+ if (!ArrayIsArray(obj_overlappingDatesRecords)) {
475
+ return new TypeError('Expected "array" but received "' + typeof obj_overlappingDatesRecords + '" (at "' + path_overlappingDatesRecords + '")');
476
+ }
477
+ for (let i = 0; i < obj_overlappingDatesRecords.length; i++) {
478
+ const obj_overlappingDatesRecords_item = obj_overlappingDatesRecords[i];
479
+ const path_overlappingDatesRecords_item = path_overlappingDatesRecords + '[' + i + ']';
480
+ if (typeof obj_overlappingDatesRecords_item !== 'string') {
481
+ return new TypeError('Expected "string" but received "' + typeof obj_overlappingDatesRecords_item + '" (at "' + path_overlappingDatesRecords_item + '")');
482
+ }
483
+ }
484
+ })();
485
+ return v_error === undefined ? null : v_error;
486
+ }
487
+ const RepresentationType = 'SustainabilityDateIssueRepresentation';
488
+ function keyBuilder(luvio, config) {
489
+ return keyPrefix + '::' + RepresentationType + ':' + config.message;
490
+ }
491
+ function keyBuilderFromType(luvio, object) {
492
+ const keyParams = {
493
+ message: object.message
494
+ };
495
+ return keyBuilder(luvio, keyParams);
496
+ }
497
+ function normalize(input, existing, path, luvio, store, timestamp) {
498
+ return input;
499
+ }
500
+ const select$1 = function SustainabilityDateIssueRepresentationSelect() {
501
+ return {
502
+ kind: 'Fragment',
503
+ version: VERSION,
504
+ private: [],
505
+ opaque: true
506
+ };
507
+ };
508
+ function equals(existing, incoming) {
509
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
510
+ return false;
511
+ }
512
+ return true;
513
+ }
514
+ const ingest = function SustainabilityDateIssueRepresentationIngest(input, path, luvio, store, timestamp) {
515
+ if (process.env.NODE_ENV !== 'production') {
516
+ const validateError = validate(input);
517
+ if (validateError !== null) {
518
+ throw validateError;
519
+ }
520
+ }
521
+ const key = keyBuilderFromType(luvio, input);
522
+ const ttlToUse = TTL;
523
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "sustainability-dgf", VERSION, RepresentationType, equals);
524
+ return createLink(key);
525
+ };
526
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
527
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
528
+ const rootKey = keyBuilderFromType(luvio, input);
529
+ rootKeySet.set(rootKey, {
530
+ namespace: keyPrefix,
531
+ representationName: RepresentationType,
532
+ mergeable: false
533
+ });
534
+ }
535
+
536
+ function select(luvio, params) {
537
+ return select$1();
538
+ }
539
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
540
+ getTypeCacheKeys(storeKeyMap, luvio, response);
541
+ }
542
+ function ingestSuccess(luvio, resourceParams, response) {
543
+ const { body } = response;
544
+ const key = keyBuilderFromType(luvio, body);
545
+ luvio.storeIngest(key, ingest, body);
546
+ const snapshot = luvio.storeLookup({
547
+ recordId: key,
548
+ node: select(),
549
+ variables: {},
550
+ });
551
+ if (process.env.NODE_ENV !== 'production') {
552
+ if (snapshot.state !== 'Fulfilled') {
553
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
554
+ }
555
+ }
556
+ deepFreeze(snapshot.data);
557
+ return snapshot;
558
+ }
559
+ function createResourceRequest(config) {
560
+ const headers = {};
561
+ return {
562
+ baseUri: '/services/data/v66.0',
563
+ basePath: '/connect/sustainability/dgf/identify-date-issues',
564
+ method: 'post',
565
+ body: config.body,
566
+ urlParams: {},
567
+ queryParams: {},
568
+ headers,
569
+ priority: 'normal',
570
+ };
571
+ }
572
+
573
+ const adapterName = 'identifyDateIssues';
574
+ const identifyDateIssues_ConfigPropertyMetadata = [
575
+ generateParamConfigMetadata('dateIssueInput', true, 2 /* Body */, 4 /* Unsupported */),
576
+ ];
577
+ const identifyDateIssues_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, identifyDateIssues_ConfigPropertyMetadata);
578
+ const createResourceParams = /*#__PURE__*/ createResourceParams$2(identifyDateIssues_ConfigPropertyMetadata);
579
+ function typeCheckConfig(untrustedConfig) {
580
+ const config = {};
581
+ const untrustedConfig_dateIssueInput = untrustedConfig.dateIssueInput;
582
+ const referenceSustainabilityDateIssueInputRepresentationValidationError = validate$1(untrustedConfig_dateIssueInput);
583
+ if (referenceSustainabilityDateIssueInputRepresentationValidationError === null) {
584
+ config.dateIssueInput = untrustedConfig_dateIssueInput;
585
+ }
586
+ return config;
587
+ }
588
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
589
+ if (!untrustedIsObject(untrustedConfig)) {
590
+ return null;
591
+ }
592
+ if (process.env.NODE_ENV !== 'production') {
593
+ validateConfig(untrustedConfig, configPropertyNames);
594
+ }
595
+ const config = typeCheckConfig(untrustedConfig);
596
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
597
+ return null;
598
+ }
599
+ return config;
600
+ }
601
+ function buildNetworkSnapshot(luvio, config, options) {
602
+ const resourceParams = createResourceParams(config);
603
+ const request = createResourceRequest(resourceParams);
604
+ return luvio.dispatchResourceRequest(request, options)
605
+ .then((response) => {
606
+ return luvio.handleSuccessResponse(() => {
607
+ const snapshot = ingestSuccess(luvio, resourceParams, response);
608
+ return luvio.storeBroadcast().then(() => snapshot);
609
+ }, () => {
610
+ const cache = new StoreKeyMap();
611
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
612
+ return cache;
613
+ });
614
+ }, (response) => {
615
+ deepFreeze(response);
616
+ throw response;
617
+ });
618
+ }
619
+ const identifyDateIssuesAdapterFactory = (luvio) => {
620
+ return function identifyDateIssues(untrustedConfig) {
621
+ const config = validateAdapterConfig(untrustedConfig, identifyDateIssues_ConfigPropertyNames);
622
+ // Invalid or incomplete config
623
+ if (config === null) {
624
+ throw new Error('Invalid config for "identifyDateIssues"');
625
+ }
626
+ return buildNetworkSnapshot(luvio, config);
627
+ };
628
+ };
629
+
630
+ let computeDataGapFillers;
631
+ let identifyDateIssues;
632
+ // Notify Update Available
633
+ function bindExportsTo(luvio) {
634
+ // LDS Adapters
635
+ function unwrapSnapshotData(factory) {
636
+ const adapter = factory(luvio);
637
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
638
+ }
639
+ return {
640
+ computeDataGapFillers: unwrapSnapshotData(computeDataGapFillersAdapterFactory),
641
+ identifyDateIssues: unwrapSnapshotData(identifyDateIssuesAdapterFactory),
642
+ // Imperative GET Adapters
643
+ // Notify Update Availables
644
+ };
645
+ }
646
+ withDefaultLuvio((luvio) => {
647
+ ({ computeDataGapFillers, identifyDateIssues } = bindExportsTo(luvio));
648
+ });
649
+
650
+ export { computeDataGapFillers, identifyDateIssues };
651
+ // version: 0.1.0-dev1-c978a7b010