@salesforce/lds-adapters-revenue-billing-batch 1.124.2 → 1.124.4

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 (26) hide show
  1. package/dist/es/es2018/revenue-billing-batch.js +597 -597
  2. package/dist/{types → es/es2018/types}/src/generated/adapters/adapter-utils.d.ts +66 -66
  3. package/dist/{types → es/es2018/types}/src/generated/adapters/createInvoicesBatchScheduler.d.ts +15 -15
  4. package/dist/{types → es/es2018/types}/src/generated/adapters/createPaymentsBatchScheduler.d.ts +15 -15
  5. package/dist/{types → es/es2018/types}/src/generated/artifacts/main.d.ts +2 -2
  6. package/dist/{types → es/es2018/types}/src/generated/artifacts/sfdc.d.ts +3 -3
  7. package/dist/{types → es/es2018/types}/src/generated/resources/postCommerceInvoicingInvoiceSchedulers.d.ts +13 -13
  8. package/dist/{types → es/es2018/types}/src/generated/resources/postCommercePaymentsPaymentSchedulers.d.ts +13 -13
  9. package/dist/{types → es/es2018/types}/src/generated/types/BatchFilterCriteriaInputRepresentation.d.ts +35 -35
  10. package/dist/{types → es/es2018/types}/src/generated/types/BatchInvoiceSchedulerInputRepresentation.d.ts +30 -30
  11. package/dist/{types → es/es2018/types}/src/generated/types/BatchInvoiceSchedulerInputWrapperRepresentation.d.ts +29 -29
  12. package/dist/{types → es/es2018/types}/src/generated/types/BillingBatchSchedulerRepresentation.d.ts +29 -29
  13. package/dist/{types → es/es2018/types}/src/generated/types/InvoicesBatchSchedulerOutputRepresentation.d.ts +40 -40
  14. package/dist/{types → es/es2018/types}/src/generated/types/PaymentRunBatchFilterCriteriaInputRepresentation.d.ts +33 -33
  15. package/dist/{types → es/es2018/types}/src/generated/types/PaymentRunBatchFilterCriteriaInputRepresentations.d.ts +29 -29
  16. package/dist/{types → es/es2018/types}/src/generated/types/PaymentsBatchSchedulerInputRepresentation.d.ts +33 -33
  17. package/dist/{types → es/es2018/types}/src/generated/types/PaymentsBatchSchedulerInputWrapperRepresentation.d.ts +29 -29
  18. package/dist/{types → es/es2018/types}/src/generated/types/PaymentsBatchSchedulerOutputRepresentation.d.ts +40 -40
  19. package/dist/{types → es/es2018/types}/src/generated/types/ScheduleOptionsInputRepresentation.d.ts +47 -47
  20. package/dist/{types → es/es2018/types}/src/generated/types/ScheduleOptionsInputRepresentationForInvoice.d.ts +50 -50
  21. package/dist/{types → es/es2018/types}/src/generated/types/type-utils.d.ts +39 -39
  22. package/package.json +5 -5
  23. package/sfdc/index.d.ts +1 -1
  24. package/sfdc/index.js +616 -616
  25. package/dist/umd/es2018/revenue-billing-batch.js +0 -641
  26. package/dist/umd/es5/revenue-billing-batch.js +0 -648
@@ -1,641 +0,0 @@
1
- /**
2
- * Copyright (c) 2022, Salesforce, Inc.,
3
- * All rights reserved.
4
- * For full license text, see the LICENSE.txt file
5
- */
6
-
7
- (function (global, factory) {
8
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@luvio/engine')) :
9
- typeof define === 'function' && define.amd ? define(['exports', '@luvio/engine'], factory) :
10
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["revenueBilling-batch"] = {}, global.engine));
11
- })(this, (function (exports, engine) { 'use strict';
12
-
13
- const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
14
- const { keys: ObjectKeys$1, freeze: ObjectFreeze$1, create: ObjectCreate$1 } = Object;
15
- const { isArray: ArrayIsArray$1 } = Array;
16
- /**
17
- * Validates an adapter config is well-formed.
18
- * @param config The config to validate.
19
- * @param adapter The adapter validation configuration.
20
- * @param oneOf The keys the config must contain at least one of.
21
- * @throws A TypeError if config doesn't satisfy the adapter's config validation.
22
- */
23
- function validateConfig(config, adapter, oneOf) {
24
- const { displayName } = adapter;
25
- const { required, optional, unsupported } = adapter.parameters;
26
- if (config === undefined ||
27
- required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
28
- throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
29
- }
30
- if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
31
- throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
32
- }
33
- if (unsupported !== undefined &&
34
- unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
35
- throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
36
- }
37
- const supported = required.concat(optional);
38
- if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
39
- throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
40
- }
41
- }
42
- function untrustedIsObject(untrusted) {
43
- return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
44
- }
45
- function areRequiredParametersPresent(config, configPropertyNames) {
46
- return configPropertyNames.parameters.required.every(req => req in config);
47
- }
48
- const keyPrefix = 'BillingBatch';
49
-
50
- const { freeze: ObjectFreeze, keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
51
- const { isArray: ArrayIsArray } = Array;
52
- const { stringify: JSONStringify } = JSON;
53
- function deepFreeze$3(value) {
54
- // No need to freeze primitives
55
- if (typeof value !== 'object' || value === null) {
56
- return;
57
- }
58
- if (ArrayIsArray(value)) {
59
- for (let i = 0, len = value.length; i < len; i += 1) {
60
- deepFreeze$3(value[i]);
61
- }
62
- }
63
- else {
64
- const keys = ObjectKeys(value);
65
- for (let i = 0, len = keys.length; i < len; i += 1) {
66
- deepFreeze$3(value[keys[i]]);
67
- }
68
- }
69
- ObjectFreeze(value);
70
- }
71
- function createLink(ref) {
72
- return {
73
- __ref: engine.serializeStructuredKey(ref),
74
- };
75
- }
76
-
77
- function validate$6(obj, path = 'ScheduleOptionsInputRepresentation') {
78
- const v_error = (() => {
79
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
80
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
81
- }
82
- if (obj.endDate !== undefined) {
83
- const obj_endDate = obj.endDate;
84
- const path_endDate = path + '.endDate';
85
- if (typeof obj_endDate !== 'string') {
86
- return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
87
- }
88
- }
89
- const obj_frequencyCadence = obj.frequencyCadence;
90
- const path_frequencyCadence = path + '.frequencyCadence';
91
- if (typeof obj_frequencyCadence !== 'string') {
92
- return new TypeError('Expected "string" but received "' + typeof obj_frequencyCadence + '" (at "' + path_frequencyCadence + '")');
93
- }
94
- const obj_preferredTime = obj.preferredTime;
95
- const path_preferredTime = path + '.preferredTime';
96
- if (typeof obj_preferredTime !== 'string') {
97
- return new TypeError('Expected "string" but received "' + typeof obj_preferredTime + '" (at "' + path_preferredTime + '")');
98
- }
99
- if (obj.recursEveryMonthOnDay !== undefined) {
100
- const obj_recursEveryMonthOnDay = obj.recursEveryMonthOnDay;
101
- const path_recursEveryMonthOnDay = path + '.recursEveryMonthOnDay';
102
- if (typeof obj_recursEveryMonthOnDay !== 'string') {
103
- return new TypeError('Expected "string" but received "' + typeof obj_recursEveryMonthOnDay + '" (at "' + path_recursEveryMonthOnDay + '")');
104
- }
105
- }
106
- const obj_schedulerName = obj.schedulerName;
107
- const path_schedulerName = path + '.schedulerName';
108
- if (typeof obj_schedulerName !== 'string') {
109
- return new TypeError('Expected "string" but received "' + typeof obj_schedulerName + '" (at "' + path_schedulerName + '")');
110
- }
111
- const obj_startDate = obj.startDate;
112
- const path_startDate = path + '.startDate';
113
- if (typeof obj_startDate !== 'string') {
114
- return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
115
- }
116
- const obj_status = obj.status;
117
- const path_status = path + '.status';
118
- if (typeof obj_status !== 'string') {
119
- return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
120
- }
121
- })();
122
- return v_error === undefined ? null : v_error;
123
- }
124
-
125
- function validate$5(obj, path = 'PaymentsBatchSchedulerInputRepresentation') {
126
- const validateScheduleOptionsInputRepresentation_validateError = validate$6(obj, path);
127
- if (validateScheduleOptionsInputRepresentation_validateError !== null) {
128
- return validateScheduleOptionsInputRepresentation_validateError;
129
- }
130
- const v_error = (() => {
131
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
132
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
133
- }
134
- if (obj.criteriaMatchType !== undefined) {
135
- const obj_criteriaMatchType = obj.criteriaMatchType;
136
- const path_criteriaMatchType = path + '.criteriaMatchType';
137
- if (typeof obj_criteriaMatchType !== 'string') {
138
- return new TypeError('Expected "string" but received "' + typeof obj_criteriaMatchType + '" (at "' + path_criteriaMatchType + '")');
139
- }
140
- }
141
- if (obj.filterCriteria !== undefined) {
142
- const obj_filterCriteria = obj.filterCriteria;
143
- const path_filterCriteria = path + '.filterCriteria';
144
- if (!ArrayIsArray(obj_filterCriteria)) {
145
- return new TypeError('Expected "array" but received "' + typeof obj_filterCriteria + '" (at "' + path_filterCriteria + '")');
146
- }
147
- for (let i = 0; i < obj_filterCriteria.length; i++) {
148
- const obj_filterCriteria_item = obj_filterCriteria[i];
149
- const path_filterCriteria_item = path_filterCriteria + '[' + i + ']';
150
- if (typeof obj_filterCriteria_item !== 'object' || ArrayIsArray(obj_filterCriteria_item) || obj_filterCriteria_item === null) {
151
- return new TypeError('Expected "object" but received "' + typeof obj_filterCriteria_item + '" (at "' + path_filterCriteria_item + '")');
152
- }
153
- }
154
- }
155
- })();
156
- return v_error === undefined ? null : v_error;
157
- }
158
-
159
- function validate$4(obj, path = 'BillingBatchSchedulerRepresentation') {
160
- const v_error = (() => {
161
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
162
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
163
- }
164
- const obj_id = obj.id;
165
- const path_id = path + '.id';
166
- if (typeof obj_id !== 'string') {
167
- return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
168
- }
169
- })();
170
- return v_error === undefined ? null : v_error;
171
- }
172
- function deepFreeze$2(input) {
173
- ObjectFreeze(input);
174
- }
175
-
176
- const TTL$1 = 1000;
177
- const VERSION$1 = "eff71edc32270b9a1e6e1779cb811c3c";
178
- function validate$3(obj, path = 'PaymentsBatchSchedulerOutputRepresentation') {
179
- const v_error = (() => {
180
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
181
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
182
- }
183
- const obj_billingBatchScheduler = obj.billingBatchScheduler;
184
- const path_billingBatchScheduler = path + '.billingBatchScheduler';
185
- const referencepath_billingBatchSchedulerValidationError = validate$4(obj_billingBatchScheduler, path_billingBatchScheduler);
186
- if (referencepath_billingBatchSchedulerValidationError !== null) {
187
- let message = 'Object doesn\'t match BillingBatchSchedulerRepresentation (at "' + path_billingBatchScheduler + '")\n';
188
- message += referencepath_billingBatchSchedulerValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
189
- return new TypeError(message);
190
- }
191
- })();
192
- return v_error === undefined ? null : v_error;
193
- }
194
- const RepresentationType$1 = 'PaymentsBatchSchedulerOutputRepresentation';
195
- function keyBuilder$1(luvio, config) {
196
- return keyPrefix + '::' + RepresentationType$1 + ':' + config.billingBatchSchedulerId;
197
- }
198
- function keyBuilderFromType$1(luvio, object) {
199
- const keyParams = {
200
- billingBatchSchedulerId: object.billingBatchScheduler.id
201
- };
202
- return keyBuilder$1(luvio, keyParams);
203
- }
204
- function normalize$1(input, existing, path, luvio, store, timestamp) {
205
- return input;
206
- }
207
- const select$3 = function PaymentsBatchSchedulerOutputRepresentationSelect() {
208
- return {
209
- kind: 'Fragment',
210
- version: VERSION$1,
211
- private: [],
212
- opaque: true
213
- };
214
- };
215
- function equals$1(existing, incoming) {
216
- if (JSONStringify(incoming) !== JSONStringify(existing)) {
217
- return false;
218
- }
219
- return true;
220
- }
221
- function deepFreeze$1(input) {
222
- const input_billingBatchScheduler = input.billingBatchScheduler;
223
- deepFreeze$2(input_billingBatchScheduler);
224
- ObjectFreeze(input);
225
- }
226
- const ingest$1 = function PaymentsBatchSchedulerOutputRepresentationIngest(input, path, luvio, store, timestamp) {
227
- if (process.env.NODE_ENV !== 'production') {
228
- const validateError = validate$3(input);
229
- if (validateError !== null) {
230
- throw validateError;
231
- }
232
- }
233
- const key = keyBuilderFromType$1(luvio, input);
234
- const existingRecord = store.readEntry(key);
235
- const ttlToUse = TTL$1;
236
- let incomingRecord = normalize$1(input, store.readEntry(key), {
237
- fullPath: key,
238
- parent: path.parent,
239
- propertyName: path.propertyName,
240
- ttl: ttlToUse
241
- });
242
- deepFreeze$1(input);
243
- if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
244
- luvio.storePublish(key, incomingRecord);
245
- }
246
- {
247
- const storeMetadataParams = {
248
- ttl: ttlToUse,
249
- namespace: "BillingBatch",
250
- version: VERSION$1,
251
- representationName: RepresentationType$1,
252
- };
253
- luvio.publishStoreMetadata(key, storeMetadataParams);
254
- }
255
- return createLink(key);
256
- };
257
- function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
258
- const rootKeySet = new engine.StoreKeyMap();
259
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
260
- const rootKey = keyBuilderFromType$1(luvio, input);
261
- rootKeySet.set(rootKey, {
262
- namespace: keyPrefix,
263
- representationName: RepresentationType$1,
264
- mergeable: false
265
- });
266
- return rootKeySet;
267
- }
268
-
269
- function select$2(luvio, params) {
270
- return select$3();
271
- }
272
- function getResponseCacheKeys$1(luvio, resourceParams, response) {
273
- return getTypeCacheKeys$1(luvio, response);
274
- }
275
- function ingestSuccess$1(luvio, resourceParams, response) {
276
- const { body } = response;
277
- const key = keyBuilderFromType$1(luvio, body);
278
- luvio.storeIngest(key, ingest$1, body);
279
- const snapshot = luvio.storeLookup({
280
- recordId: key,
281
- node: select$2(),
282
- variables: {},
283
- });
284
- if (process.env.NODE_ENV !== 'production') {
285
- if (snapshot.state !== 'Fulfilled') {
286
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
287
- }
288
- }
289
- return snapshot;
290
- }
291
- function createResourceRequest$1(config) {
292
- const headers = {};
293
- return {
294
- baseUri: '/services/data/v58.0',
295
- basePath: '/commerce/payments/payment-schedulers',
296
- method: 'post',
297
- body: config.body,
298
- urlParams: {},
299
- queryParams: {},
300
- headers,
301
- priority: 'normal',
302
- };
303
- }
304
-
305
- const createPaymentsBatchScheduler_ConfigPropertyNames = {
306
- displayName: 'createPaymentsBatchScheduler',
307
- parameters: {
308
- required: ['PaymentsBatchSchedulerInput'],
309
- optional: []
310
- }
311
- };
312
- function createResourceParams$1(config) {
313
- const resourceParams = {
314
- body: {
315
- PaymentsBatchSchedulerInput: config.PaymentsBatchSchedulerInput
316
- }
317
- };
318
- return resourceParams;
319
- }
320
- function typeCheckConfig$1(untrustedConfig) {
321
- const config = {};
322
- const untrustedConfig_PaymentsBatchSchedulerInput = untrustedConfig.PaymentsBatchSchedulerInput;
323
- const referencePaymentsBatchSchedulerInputRepresentationValidationError = validate$5(untrustedConfig_PaymentsBatchSchedulerInput);
324
- if (referencePaymentsBatchSchedulerInputRepresentationValidationError === null) {
325
- config.PaymentsBatchSchedulerInput = untrustedConfig_PaymentsBatchSchedulerInput;
326
- }
327
- return config;
328
- }
329
- function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
330
- if (!untrustedIsObject(untrustedConfig)) {
331
- return null;
332
- }
333
- if (process.env.NODE_ENV !== 'production') {
334
- validateConfig(untrustedConfig, configPropertyNames);
335
- }
336
- const config = typeCheckConfig$1(untrustedConfig);
337
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
338
- return null;
339
- }
340
- return config;
341
- }
342
- function buildNetworkSnapshot$1(luvio, config, options) {
343
- const resourceParams = createResourceParams$1(config);
344
- const request = createResourceRequest$1(resourceParams);
345
- return luvio.dispatchResourceRequest(request, options)
346
- .then((response) => {
347
- return luvio.handleSuccessResponse(() => {
348
- const snapshot = ingestSuccess$1(luvio, resourceParams, response);
349
- return luvio.storeBroadcast().then(() => snapshot);
350
- }, () => getResponseCacheKeys$1(luvio, resourceParams, response.body));
351
- }, (response) => {
352
- deepFreeze$3(response);
353
- throw response;
354
- });
355
- }
356
- const createPaymentsBatchSchedulerAdapterFactory = (luvio) => {
357
- return function createPaymentsBatchScheduler(untrustedConfig) {
358
- const config = validateAdapterConfig$1(untrustedConfig, createPaymentsBatchScheduler_ConfigPropertyNames);
359
- // Invalid or incomplete config
360
- if (config === null) {
361
- throw new Error('Invalid config for "createPaymentsBatchScheduler"');
362
- }
363
- return buildNetworkSnapshot$1(luvio, config);
364
- };
365
- };
366
-
367
- function validate$2(obj, path = 'ScheduleOptionsInputRepresentationForInvoice') {
368
- const v_error = (() => {
369
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
370
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
371
- }
372
- if (obj.endDate !== undefined) {
373
- const obj_endDate = obj.endDate;
374
- const path_endDate = path + '.endDate';
375
- if (typeof obj_endDate !== 'string') {
376
- return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
377
- }
378
- }
379
- const obj_frequencyCadence = obj.frequencyCadence;
380
- const path_frequencyCadence = path + '.frequencyCadence';
381
- if (typeof obj_frequencyCadence !== 'string') {
382
- return new TypeError('Expected "string" but received "' + typeof obj_frequencyCadence + '" (at "' + path_frequencyCadence + '")');
383
- }
384
- const obj_frequencyCadenceOptions = obj.frequencyCadenceOptions;
385
- const path_frequencyCadenceOptions = path + '.frequencyCadenceOptions';
386
- if (typeof obj_frequencyCadenceOptions !== 'object' || ArrayIsArray(obj_frequencyCadenceOptions) || obj_frequencyCadenceOptions === null) {
387
- return new TypeError('Expected "object" but received "' + typeof obj_frequencyCadenceOptions + '" (at "' + path_frequencyCadenceOptions + '")');
388
- }
389
- const obj_preferredTime = obj.preferredTime;
390
- const path_preferredTime = path + '.preferredTime';
391
- if (typeof obj_preferredTime !== 'string') {
392
- return new TypeError('Expected "string" but received "' + typeof obj_preferredTime + '" (at "' + path_preferredTime + '")');
393
- }
394
- const obj_schedulerName = obj.schedulerName;
395
- const path_schedulerName = path + '.schedulerName';
396
- if (typeof obj_schedulerName !== 'string') {
397
- return new TypeError('Expected "string" but received "' + typeof obj_schedulerName + '" (at "' + path_schedulerName + '")');
398
- }
399
- const obj_startDate = obj.startDate;
400
- const path_startDate = path + '.startDate';
401
- if (typeof obj_startDate !== 'string') {
402
- return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
403
- }
404
- const obj_status = obj.status;
405
- const path_status = path + '.status';
406
- if (typeof obj_status !== 'string') {
407
- return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
408
- }
409
- const obj_timezone = obj.timezone;
410
- const path_timezone = path + '.timezone';
411
- if (typeof obj_timezone !== 'string') {
412
- return new TypeError('Expected "string" but received "' + typeof obj_timezone + '" (at "' + path_timezone + '")');
413
- }
414
- })();
415
- return v_error === undefined ? null : v_error;
416
- }
417
-
418
- function validate$1(obj, path = 'BatchInvoiceSchedulerInputRepresentation') {
419
- const validateScheduleOptionsInputRepresentationForInvoice_validateError = validate$2(obj, path);
420
- if (validateScheduleOptionsInputRepresentationForInvoice_validateError !== null) {
421
- return validateScheduleOptionsInputRepresentationForInvoice_validateError;
422
- }
423
- const v_error = (() => {
424
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
425
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
426
- }
427
- if (obj.filterCriteria !== undefined) {
428
- const obj_filterCriteria = obj.filterCriteria;
429
- const path_filterCriteria = path + '.filterCriteria';
430
- if (!ArrayIsArray(obj_filterCriteria)) {
431
- return new TypeError('Expected "array" but received "' + typeof obj_filterCriteria + '" (at "' + path_filterCriteria + '")');
432
- }
433
- for (let i = 0; i < obj_filterCriteria.length; i++) {
434
- const obj_filterCriteria_item = obj_filterCriteria[i];
435
- const path_filterCriteria_item = path_filterCriteria + '[' + i + ']';
436
- if (typeof obj_filterCriteria_item !== 'object' || ArrayIsArray(obj_filterCriteria_item) || obj_filterCriteria_item === null) {
437
- return new TypeError('Expected "object" but received "' + typeof obj_filterCriteria_item + '" (at "' + path_filterCriteria_item + '")');
438
- }
439
- }
440
- }
441
- })();
442
- return v_error === undefined ? null : v_error;
443
- }
444
-
445
- const TTL = 1000;
446
- const VERSION = "15c358b0b4903143c526f63f4010b958";
447
- function validate(obj, path = 'InvoicesBatchSchedulerOutputRepresentation') {
448
- const v_error = (() => {
449
- if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
450
- return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
451
- }
452
- const obj_billingBatchScheduler = obj.billingBatchScheduler;
453
- const path_billingBatchScheduler = path + '.billingBatchScheduler';
454
- const referencepath_billingBatchSchedulerValidationError = validate$4(obj_billingBatchScheduler, path_billingBatchScheduler);
455
- if (referencepath_billingBatchSchedulerValidationError !== null) {
456
- let message = 'Object doesn\'t match BillingBatchSchedulerRepresentation (at "' + path_billingBatchScheduler + '")\n';
457
- message += referencepath_billingBatchSchedulerValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
458
- return new TypeError(message);
459
- }
460
- })();
461
- return v_error === undefined ? null : v_error;
462
- }
463
- const RepresentationType = 'InvoicesBatchSchedulerOutputRepresentation';
464
- function keyBuilder(luvio, config) {
465
- return keyPrefix + '::' + RepresentationType + ':' + config.billingBatchSchedulerId;
466
- }
467
- function keyBuilderFromType(luvio, object) {
468
- const keyParams = {
469
- billingBatchSchedulerId: object.billingBatchScheduler.id
470
- };
471
- return keyBuilder(luvio, keyParams);
472
- }
473
- function normalize(input, existing, path, luvio, store, timestamp) {
474
- return input;
475
- }
476
- const select$1 = function InvoicesBatchSchedulerOutputRepresentationSelect() {
477
- return {
478
- kind: 'Fragment',
479
- version: VERSION,
480
- private: [],
481
- opaque: true
482
- };
483
- };
484
- function equals(existing, incoming) {
485
- if (JSONStringify(incoming) !== JSONStringify(existing)) {
486
- return false;
487
- }
488
- return true;
489
- }
490
- function deepFreeze(input) {
491
- const input_billingBatchScheduler = input.billingBatchScheduler;
492
- deepFreeze$2(input_billingBatchScheduler);
493
- ObjectFreeze(input);
494
- }
495
- const ingest = function InvoicesBatchSchedulerOutputRepresentationIngest(input, path, luvio, store, timestamp) {
496
- if (process.env.NODE_ENV !== 'production') {
497
- const validateError = validate(input);
498
- if (validateError !== null) {
499
- throw validateError;
500
- }
501
- }
502
- const key = keyBuilderFromType(luvio, input);
503
- const existingRecord = store.readEntry(key);
504
- const ttlToUse = TTL;
505
- let incomingRecord = normalize(input, store.readEntry(key), {
506
- fullPath: key,
507
- parent: path.parent,
508
- propertyName: path.propertyName,
509
- ttl: ttlToUse
510
- });
511
- deepFreeze(input);
512
- if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
513
- luvio.storePublish(key, incomingRecord);
514
- }
515
- {
516
- const storeMetadataParams = {
517
- ttl: ttlToUse,
518
- namespace: "BillingBatch",
519
- version: VERSION,
520
- representationName: RepresentationType,
521
- };
522
- luvio.publishStoreMetadata(key, storeMetadataParams);
523
- }
524
- return createLink(key);
525
- };
526
- function getTypeCacheKeys(luvio, input, fullPathFactory) {
527
- const rootKeySet = new engine.StoreKeyMap();
528
- // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
529
- const rootKey = keyBuilderFromType(luvio, input);
530
- rootKeySet.set(rootKey, {
531
- namespace: keyPrefix,
532
- representationName: RepresentationType,
533
- mergeable: false
534
- });
535
- return rootKeySet;
536
- }
537
-
538
- function select(luvio, params) {
539
- return select$1();
540
- }
541
- function getResponseCacheKeys(luvio, resourceParams, response) {
542
- return getTypeCacheKeys(luvio, response);
543
- }
544
- function ingestSuccess(luvio, resourceParams, response) {
545
- const { body } = response;
546
- const key = keyBuilderFromType(luvio, body);
547
- luvio.storeIngest(key, ingest, body);
548
- const snapshot = luvio.storeLookup({
549
- recordId: key,
550
- node: select(),
551
- variables: {},
552
- });
553
- if (process.env.NODE_ENV !== 'production') {
554
- if (snapshot.state !== 'Fulfilled') {
555
- throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
556
- }
557
- }
558
- return snapshot;
559
- }
560
- function createResourceRequest(config) {
561
- const headers = {};
562
- return {
563
- baseUri: '/services/data/v58.0',
564
- basePath: '/commerce/invoicing/invoice-schedulers',
565
- method: 'post',
566
- body: config.body,
567
- urlParams: {},
568
- queryParams: {},
569
- headers,
570
- priority: 'normal',
571
- };
572
- }
573
-
574
- const createInvoicesBatchScheduler_ConfigPropertyNames = {
575
- displayName: 'createInvoicesBatchScheduler',
576
- parameters: {
577
- required: ['BatchInvoiceSchedulerInput'],
578
- optional: []
579
- }
580
- };
581
- function createResourceParams(config) {
582
- const resourceParams = {
583
- body: {
584
- BatchInvoiceSchedulerInput: config.BatchInvoiceSchedulerInput
585
- }
586
- };
587
- return resourceParams;
588
- }
589
- function typeCheckConfig(untrustedConfig) {
590
- const config = {};
591
- const untrustedConfig_BatchInvoiceSchedulerInput = untrustedConfig.BatchInvoiceSchedulerInput;
592
- const referenceBatchInvoiceSchedulerInputRepresentationValidationError = validate$1(untrustedConfig_BatchInvoiceSchedulerInput);
593
- if (referenceBatchInvoiceSchedulerInputRepresentationValidationError === null) {
594
- config.BatchInvoiceSchedulerInput = untrustedConfig_BatchInvoiceSchedulerInput;
595
- }
596
- return config;
597
- }
598
- function validateAdapterConfig(untrustedConfig, configPropertyNames) {
599
- if (!untrustedIsObject(untrustedConfig)) {
600
- return null;
601
- }
602
- if (process.env.NODE_ENV !== 'production') {
603
- validateConfig(untrustedConfig, configPropertyNames);
604
- }
605
- const config = typeCheckConfig(untrustedConfig);
606
- if (!areRequiredParametersPresent(config, configPropertyNames)) {
607
- return null;
608
- }
609
- return config;
610
- }
611
- function buildNetworkSnapshot(luvio, config, options) {
612
- const resourceParams = createResourceParams(config);
613
- const request = createResourceRequest(resourceParams);
614
- return luvio.dispatchResourceRequest(request, options)
615
- .then((response) => {
616
- return luvio.handleSuccessResponse(() => {
617
- const snapshot = ingestSuccess(luvio, resourceParams, response);
618
- return luvio.storeBroadcast().then(() => snapshot);
619
- }, () => getResponseCacheKeys(luvio, resourceParams, response.body));
620
- }, (response) => {
621
- deepFreeze$3(response);
622
- throw response;
623
- });
624
- }
625
- const createInvoicesBatchSchedulerAdapterFactory = (luvio) => {
626
- return function createInvoicesBatchScheduler(untrustedConfig) {
627
- const config = validateAdapterConfig(untrustedConfig, createInvoicesBatchScheduler_ConfigPropertyNames);
628
- // Invalid or incomplete config
629
- if (config === null) {
630
- throw new Error('Invalid config for "createInvoicesBatchScheduler"');
631
- }
632
- return buildNetworkSnapshot(luvio, config);
633
- };
634
- };
635
-
636
- exports.createInvoicesBatchSchedulerAdapterFactory = createInvoicesBatchSchedulerAdapterFactory;
637
- exports.createPaymentsBatchSchedulerAdapterFactory = createPaymentsBatchSchedulerAdapterFactory;
638
-
639
- Object.defineProperty(exports, '__esModule', { value: true });
640
-
641
- }));