@salesforce/lds-adapters-analytics-wave-private 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 (26) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/analytics-wave-private.js +1364 -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/createDashboard.d.ts +22 -0
  5. package/dist/es/es2018/types/src/generated/adapters/executeSoqlQueryPost.d.ts +27 -0
  6. package/dist/es/es2018/types/src/generated/adapters/executeTemplateSetupPlan.d.ts +16 -0
  7. package/dist/es/es2018/types/src/generated/adapters/getTemplateSetupPlan.d.ts +29 -0
  8. package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
  9. package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +8 -0
  10. package/dist/es/es2018/types/src/generated/resources/getWaveTemplatesPlansByPlanNameAndTemplateIdOrApiName.d.ts +17 -0
  11. package/dist/es/es2018/types/src/generated/resources/postWaveDashboards.d.ts +19 -0
  12. package/dist/es/es2018/types/src/generated/resources/postWaveSoql.d.ts +15 -0
  13. package/dist/es/es2018/types/src/generated/resources/postWaveTemplatesPlansByPlanNameAndTemplateIdOrApiName.d.ts +13 -0
  14. package/dist/es/es2018/types/src/generated/types/BaseDashboardInputRepresentation.d.ts +47 -0
  15. package/dist/es/es2018/types/src/generated/types/DashboardRepresentation.d.ts +40 -0
  16. package/dist/es/es2018/types/src/generated/types/SoqlQueryInputRepresentation.d.ts +28 -0
  17. package/dist/es/es2018/types/src/generated/types/SoqlQueryResultRepresentation.d.ts +35 -0
  18. package/dist/es/es2018/types/src/generated/types/TemplateSetupJobRepresentation.d.ts +41 -0
  19. package/dist/es/es2018/types/src/generated/types/TemplateSetupPlanRepresentation.d.ts +60 -0
  20. package/dist/es/es2018/types/src/generated/types/TemplateSetupTaskRepresentation.d.ts +55 -0
  21. package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
  22. package/package.json +75 -0
  23. package/sfdc/index.d.ts +1 -0
  24. package/sfdc/index.js +1460 -0
  25. package/src/raml/api.raml +278 -0
  26. package/src/raml/luvio.raml +43 -0
package/sfdc/index.js ADDED
@@ -0,0 +1,1460 @@
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, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$4, typeCheckConfig as typeCheckConfig$4, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2 } from 'force/luvioEngine';
18
+
19
+ const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
20
+ const { keys: ObjectKeys$1, create: ObjectCreate$1 } = 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$1(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
+ function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
62
+ return {
63
+ name,
64
+ required,
65
+ resourceType,
66
+ typeCheckShape,
67
+ isArrayShape,
68
+ coerceFn,
69
+ };
70
+ }
71
+ function buildAdapterValidationConfig(displayName, paramsMeta) {
72
+ const required = paramsMeta.filter(p => p.required).map(p => p.name);
73
+ const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
74
+ return {
75
+ displayName,
76
+ parameters: {
77
+ required,
78
+ optional,
79
+ }
80
+ };
81
+ }
82
+ const keyPrefix = 'WAVE';
83
+
84
+ const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
85
+ const { isArray: ArrayIsArray } = Array;
86
+ const { stringify: JSONStringify } = JSON;
87
+ function equalsArray(a, b, equalsItem) {
88
+ const aLength = a.length;
89
+ const bLength = b.length;
90
+ if (aLength !== bLength) {
91
+ return false;
92
+ }
93
+ for (let i = 0; i < aLength; i++) {
94
+ if (equalsItem(a[i], b[i]) === false) {
95
+ return false;
96
+ }
97
+ }
98
+ return true;
99
+ }
100
+ function equalsObject(a, b, equalsProp) {
101
+ const aKeys = ObjectKeys(a).sort();
102
+ const bKeys = ObjectKeys(b).sort();
103
+ const aKeysLength = aKeys.length;
104
+ const bKeysLength = bKeys.length;
105
+ if (aKeysLength !== bKeysLength) {
106
+ return false;
107
+ }
108
+ for (let i = 0; i < aKeys.length; i++) {
109
+ const key = aKeys[i];
110
+ if (key !== bKeys[i]) {
111
+ return false;
112
+ }
113
+ if (equalsProp(a[key], b[key]) === false) {
114
+ return false;
115
+ }
116
+ }
117
+ return true;
118
+ }
119
+ function createLink(ref) {
120
+ return {
121
+ __ref: serializeStructuredKey(ref),
122
+ };
123
+ }
124
+
125
+ const TTL$2 = 5000;
126
+ const VERSION$4 = "699a5919410241df24d74fe9ab64fdd8";
127
+ function validate$4(obj, path = 'DashboardRepresentation') {
128
+ const v_error = (() => {
129
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
130
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
131
+ }
132
+ const obj_keys = ObjectKeys(obj);
133
+ for (let i = 0; i < obj_keys.length; i++) {
134
+ const key = obj_keys[i];
135
+ const obj_prop = obj[key];
136
+ const path_prop = path + '["' + key + '"]';
137
+ if (obj_prop === undefined) {
138
+ return new TypeError('Expected "defined" but received "' + typeof obj_prop + '" (at "' + path_prop + '")');
139
+ }
140
+ }
141
+ const obj_id = obj.id;
142
+ const path_id = path + '.id';
143
+ let obj_id_union0 = null;
144
+ const obj_id_union0_error = (() => {
145
+ if (typeof obj_id !== 'string') {
146
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
147
+ }
148
+ })();
149
+ if (obj_id_union0_error != null) {
150
+ obj_id_union0 = obj_id_union0_error.message;
151
+ }
152
+ let obj_id_union1 = null;
153
+ const obj_id_union1_error = (() => {
154
+ if (obj_id !== null) {
155
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
156
+ }
157
+ })();
158
+ if (obj_id_union1_error != null) {
159
+ obj_id_union1 = obj_id_union1_error.message;
160
+ }
161
+ if (obj_id_union0 && obj_id_union1) {
162
+ let message = 'Object doesn\'t match union (at "' + path_id + '")';
163
+ message += '\n' + obj_id_union0.split('\n').map((line) => '\t' + line).join('\n');
164
+ message += '\n' + obj_id_union1.split('\n').map((line) => '\t' + line).join('\n');
165
+ return new TypeError(message);
166
+ }
167
+ })();
168
+ return v_error === undefined ? null : v_error;
169
+ }
170
+ const RepresentationType$2 = 'DashboardRepresentation';
171
+ function keyBuilder$5(luvio, config) {
172
+ return keyPrefix + '::' + RepresentationType$2 + ':' + (config.id === null ? '' : config.id);
173
+ }
174
+ function keyBuilderFromType$1(luvio, object) {
175
+ const keyParams = {
176
+ id: object.id
177
+ };
178
+ return keyBuilder$5(luvio, keyParams);
179
+ }
180
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
181
+ return input;
182
+ }
183
+ const select$8 = function DashboardRepresentationSelect() {
184
+ return {
185
+ kind: 'Fragment',
186
+ version: VERSION$4,
187
+ private: [],
188
+ selections: [
189
+ {
190
+ name: 'id',
191
+ kind: 'Scalar'
192
+ }
193
+ ]
194
+ };
195
+ };
196
+ function equals$4(existing, incoming) {
197
+ const equals_props = equalsObject(existing, incoming, (existing_prop, incoming_prop) => {
198
+ if (JSONStringify(incoming_prop) !== JSONStringify(existing_prop)) {
199
+ return false;
200
+ }
201
+ });
202
+ if (equals_props === false) {
203
+ return false;
204
+ }
205
+ return true;
206
+ }
207
+ const ingest$2 = function DashboardRepresentationIngest(input, path, luvio, store, timestamp) {
208
+ if (process.env.NODE_ENV !== 'production') {
209
+ const validateError = validate$4(input);
210
+ if (validateError !== null) {
211
+ throw validateError;
212
+ }
213
+ }
214
+ const key = keyBuilderFromType$1(luvio, input);
215
+ const ttlToUse = TTL$2;
216
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "WAVE", VERSION$4, RepresentationType$2, equals$4);
217
+ return createLink(key);
218
+ };
219
+ function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
220
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
221
+ const rootKey = keyBuilderFromType$1(luvio, input);
222
+ rootKeySet.set(rootKey, {
223
+ namespace: keyPrefix,
224
+ representationName: RepresentationType$2,
225
+ mergeable: false
226
+ });
227
+ }
228
+
229
+ function select$7(luvio, params) {
230
+ return select$8();
231
+ }
232
+ function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
233
+ getTypeCacheKeys$2(storeKeyMap, luvio, response);
234
+ }
235
+ function ingestSuccess$3(luvio, resourceParams, response) {
236
+ const { body } = response;
237
+ const key = keyBuilderFromType$1(luvio, body);
238
+ luvio.storeIngest(key, ingest$2, body);
239
+ const snapshot = luvio.storeLookup({
240
+ recordId: key,
241
+ node: select$7(),
242
+ variables: {},
243
+ });
244
+ if (process.env.NODE_ENV !== 'production') {
245
+ if (snapshot.state !== 'Fulfilled') {
246
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
247
+ }
248
+ }
249
+ deepFreeze(snapshot.data);
250
+ return snapshot;
251
+ }
252
+ function createResourceRequest$3(config) {
253
+ const headers = {};
254
+ return {
255
+ baseUri: '/services/data/v66.0',
256
+ basePath: '/wave/dashboards',
257
+ method: 'post',
258
+ body: config.body,
259
+ urlParams: {},
260
+ queryParams: {},
261
+ headers,
262
+ priority: 'normal',
263
+ };
264
+ }
265
+
266
+ const adapterName$3 = 'createDashboard';
267
+ const createDashboard_ConfigPropertyMetadata = [
268
+ generateParamConfigMetadata('folder', true, 2 /* Body */, 4 /* Unsupported */),
269
+ generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
270
+ generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
271
+ generateParamConfigMetadata('description', true, 2 /* Body */, 0 /* String */),
272
+ generateParamConfigMetadata('templateSourceId', true, 2 /* Body */, 0 /* String */),
273
+ generateParamConfigMetadata('templateValues', true, 2 /* Body */, 4 /* Unsupported */),
274
+ ];
275
+ const createDashboard_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createDashboard_ConfigPropertyMetadata);
276
+ const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(createDashboard_ConfigPropertyMetadata);
277
+ function typeCheckConfig$3(untrustedConfig) {
278
+ const config = {};
279
+ typeCheckConfig$4(untrustedConfig, config, createDashboard_ConfigPropertyMetadata);
280
+ const untrustedConfig_folder = untrustedConfig.folder;
281
+ config.folder = untrustedConfig_folder;
282
+ const untrustedConfig_templateValues = untrustedConfig.templateValues;
283
+ if (untrustedIsObject(untrustedConfig_templateValues)) {
284
+ const untrustedConfig_templateValues_object = {};
285
+ const untrustedConfig_templateValues_keys = Object.keys(untrustedConfig_templateValues);
286
+ for (let i = 0, arrayLength = untrustedConfig_templateValues_keys.length; i < arrayLength; i++) {
287
+ const key = untrustedConfig_templateValues_keys[i];
288
+ const untrustedConfig_templateValues_prop = untrustedConfig_templateValues[key];
289
+ if (untrustedConfig_templateValues_object !== undefined) {
290
+ untrustedConfig_templateValues_object[key] = untrustedConfig_templateValues_prop;
291
+ }
292
+ }
293
+ if (untrustedConfig_templateValues_object !== undefined && Object.keys(untrustedConfig_templateValues_object).length >= 0) {
294
+ config.templateValues = untrustedConfig_templateValues_object;
295
+ }
296
+ }
297
+ return config;
298
+ }
299
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
300
+ if (!untrustedIsObject(untrustedConfig)) {
301
+ return null;
302
+ }
303
+ if (process.env.NODE_ENV !== 'production') {
304
+ validateConfig(untrustedConfig, configPropertyNames);
305
+ }
306
+ const config = typeCheckConfig$3(untrustedConfig);
307
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
308
+ return null;
309
+ }
310
+ return config;
311
+ }
312
+ function buildNetworkSnapshot$3(luvio, config, options) {
313
+ const resourceParams = createResourceParams$3(config);
314
+ const request = createResourceRequest$3(resourceParams);
315
+ return luvio.dispatchResourceRequest(request, options)
316
+ .then((response) => {
317
+ return luvio.handleSuccessResponse(() => {
318
+ const snapshot = ingestSuccess$3(luvio, resourceParams, response);
319
+ return luvio.storeBroadcast().then(() => snapshot);
320
+ }, () => {
321
+ const cache = new StoreKeyMap();
322
+ getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
323
+ return cache;
324
+ });
325
+ }, (response) => {
326
+ deepFreeze(response);
327
+ throw response;
328
+ });
329
+ }
330
+ const createDashboardAdapterFactory = (luvio) => {
331
+ return function createDashboard(untrustedConfig) {
332
+ const config = validateAdapterConfig$3(untrustedConfig, createDashboard_ConfigPropertyNames);
333
+ // Invalid or incomplete config
334
+ if (config === null) {
335
+ throw new Error('Invalid config for "createDashboard"');
336
+ }
337
+ return buildNetworkSnapshot$3(luvio, config);
338
+ };
339
+ };
340
+
341
+ const TTL$1 = 5000;
342
+ const VERSION$3 = "f4d046d44230e53375ee20bbd2483a1f";
343
+ function validate$3(obj, path = 'SoqlQueryResultRepresentation') {
344
+ const v_error = (() => {
345
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
346
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
347
+ }
348
+ const obj_keys = ObjectKeys(obj);
349
+ for (let i = 0; i < obj_keys.length; i++) {
350
+ const key = obj_keys[i];
351
+ const obj_prop = obj[key];
352
+ const path_prop = path + '["' + key + '"]';
353
+ if (obj_prop === undefined) {
354
+ return new TypeError('Expected "defined" but received "' + typeof obj_prop + '" (at "' + path_prop + '")');
355
+ }
356
+ }
357
+ if (obj.done !== undefined) {
358
+ const obj_done = obj.done;
359
+ const path_done = path + '.done';
360
+ if (typeof obj_done !== 'boolean') {
361
+ return new TypeError('Expected "boolean" but received "' + typeof obj_done + '" (at "' + path_done + '")');
362
+ }
363
+ }
364
+ const obj_records = obj.records;
365
+ const path_records = path + '.records';
366
+ if (!ArrayIsArray(obj_records)) {
367
+ return new TypeError('Expected "array" but received "' + typeof obj_records + '" (at "' + path_records + '")');
368
+ }
369
+ for (let i = 0; i < obj_records.length; i++) {
370
+ const obj_records_item = obj_records[i];
371
+ const path_records_item = path_records + '[' + i + ']';
372
+ if (obj_records_item === undefined) {
373
+ return new TypeError('Expected "defined" but received "' + typeof obj_records_item + '" (at "' + path_records_item + '")');
374
+ }
375
+ }
376
+ if (obj.totalSize !== undefined) {
377
+ const obj_totalSize = obj.totalSize;
378
+ const path_totalSize = path + '.totalSize';
379
+ if (typeof obj_totalSize !== 'number') {
380
+ return new TypeError('Expected "number" but received "' + typeof obj_totalSize + '" (at "' + path_totalSize + '")');
381
+ }
382
+ }
383
+ })();
384
+ return v_error === undefined ? null : v_error;
385
+ }
386
+ const RepresentationType$1 = 'SoqlQueryResultRepresentation';
387
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
388
+ return input;
389
+ }
390
+ const select$6 = function SoqlQueryResultRepresentationSelect() {
391
+ return {
392
+ kind: 'Fragment',
393
+ version: VERSION$3,
394
+ private: [],
395
+ opaque: true
396
+ };
397
+ };
398
+ function equals$3(existing, incoming) {
399
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
400
+ return false;
401
+ }
402
+ return true;
403
+ }
404
+ const ingest$1 = function SoqlQueryResultRepresentationIngest(input, path, luvio, store, timestamp) {
405
+ if (process.env.NODE_ENV !== 'production') {
406
+ const validateError = validate$3(input);
407
+ if (validateError !== null) {
408
+ throw validateError;
409
+ }
410
+ }
411
+ const key = path.fullPath;
412
+ const ttlToUse = TTL$1;
413
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "WAVE", VERSION$3, RepresentationType$1, equals$3);
414
+ return createLink(key);
415
+ };
416
+ function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
417
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
418
+ const rootKey = fullPathFactory();
419
+ rootKeySet.set(rootKey, {
420
+ namespace: keyPrefix,
421
+ representationName: RepresentationType$1,
422
+ mergeable: false
423
+ });
424
+ }
425
+
426
+ function select$5(luvio, params) {
427
+ return select$6();
428
+ }
429
+ function keyBuilder$4(luvio, params) {
430
+ return keyPrefix + '::SoqlQueryResultRepresentation:(' + 'query:' + params.body.query + ')';
431
+ }
432
+ function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
433
+ getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
434
+ }
435
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
436
+ const { body } = response;
437
+ const key = keyBuilder$4(luvio, resourceParams);
438
+ luvio.storeIngest(key, ingest$1, body);
439
+ const snapshot = luvio.storeLookup({
440
+ recordId: key,
441
+ node: select$5(),
442
+ variables: {},
443
+ }, snapshotRefresh);
444
+ if (process.env.NODE_ENV !== 'production') {
445
+ if (snapshot.state !== 'Fulfilled') {
446
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
447
+ }
448
+ }
449
+ deepFreeze(snapshot.data);
450
+ return snapshot;
451
+ }
452
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
453
+ const key = keyBuilder$4(luvio, params);
454
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
455
+ const storeMetadataParams = {
456
+ ttl: TTL$1,
457
+ namespace: keyPrefix,
458
+ version: VERSION$3,
459
+ representationName: RepresentationType$1
460
+ };
461
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
462
+ return errorSnapshot;
463
+ }
464
+ function createResourceRequest$2(config) {
465
+ const headers = {};
466
+ return {
467
+ baseUri: '/services/data/v66.0',
468
+ basePath: '/wave/soql',
469
+ method: 'post',
470
+ body: config.body,
471
+ urlParams: {},
472
+ queryParams: {},
473
+ headers,
474
+ priority: 'normal',
475
+ };
476
+ }
477
+
478
+ const adapterName$2 = 'executeSoqlQueryPost';
479
+ const executeSoqlQueryPost_ConfigPropertyMetadata = [
480
+ generateParamConfigMetadata('query', true, 2 /* Body */, 0 /* String */),
481
+ ];
482
+ const executeSoqlQueryPost_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, executeSoqlQueryPost_ConfigPropertyMetadata);
483
+ const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(executeSoqlQueryPost_ConfigPropertyMetadata);
484
+ function keyBuilder$3(luvio, config) {
485
+ const resourceParams = createResourceParams$2(config);
486
+ return keyBuilder$4(luvio, resourceParams);
487
+ }
488
+ function typeCheckConfig$2(untrustedConfig) {
489
+ const config = {};
490
+ typeCheckConfig$4(untrustedConfig, config, executeSoqlQueryPost_ConfigPropertyMetadata);
491
+ return config;
492
+ }
493
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
494
+ if (!untrustedIsObject(untrustedConfig)) {
495
+ return null;
496
+ }
497
+ if (process.env.NODE_ENV !== 'production') {
498
+ validateConfig(untrustedConfig, configPropertyNames);
499
+ }
500
+ const config = typeCheckConfig$2(untrustedConfig);
501
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
502
+ return null;
503
+ }
504
+ return config;
505
+ }
506
+ function adapterFragment$1(luvio, config) {
507
+ createResourceParams$2(config);
508
+ return select$5();
509
+ }
510
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
511
+ const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
512
+ config,
513
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
514
+ });
515
+ return luvio.storeBroadcast().then(() => snapshot);
516
+ }
517
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
518
+ const snapshot = ingestError$1(luvio, resourceParams, response, {
519
+ config,
520
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
521
+ });
522
+ return luvio.storeBroadcast().then(() => snapshot);
523
+ }
524
+ function buildNetworkSnapshot$2(luvio, config, options) {
525
+ const resourceParams = createResourceParams$2(config);
526
+ const request = createResourceRequest$2(resourceParams);
527
+ return luvio.dispatchResourceRequest(request, options)
528
+ .then((response) => {
529
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
530
+ const cache = new StoreKeyMap();
531
+ getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
532
+ return cache;
533
+ });
534
+ }, (response) => {
535
+ return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
536
+ });
537
+ }
538
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
539
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, 'get', false);
540
+ }
541
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
542
+ const { luvio, config } = context;
543
+ const selector = {
544
+ recordId: keyBuilder$3(luvio, config),
545
+ node: adapterFragment$1(luvio, config),
546
+ variables: {},
547
+ };
548
+ const cacheSnapshot = storeLookup(selector, {
549
+ config,
550
+ resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
551
+ });
552
+ return cacheSnapshot;
553
+ }
554
+ const executeSoqlQueryPostAdapterFactory = (luvio) => function WAVE__executeSoqlQueryPost(untrustedConfig, requestContext) {
555
+ const config = validateAdapterConfig$2(untrustedConfig, executeSoqlQueryPost_ConfigPropertyNames);
556
+ // Invalid or incomplete config
557
+ if (config === null) {
558
+ return null;
559
+ }
560
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
561
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
562
+ };
563
+
564
+ const VERSION$2 = "8414479b5bce7ab7da1015deb3422035";
565
+ function validate$2(obj, path = 'TemplateSetupTaskRepresentation') {
566
+ const v_error = (() => {
567
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
568
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
569
+ }
570
+ if (obj.description !== undefined) {
571
+ const obj_description = obj.description;
572
+ const path_description = path + '.description';
573
+ if (typeof obj_description !== 'string') {
574
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
575
+ }
576
+ }
577
+ if (obj.details !== undefined) {
578
+ const obj_details = obj.details;
579
+ const path_details = path + '.details';
580
+ if (typeof obj_details !== 'string') {
581
+ return new TypeError('Expected "string" but received "' + typeof obj_details + '" (at "' + path_details + '")');
582
+ }
583
+ }
584
+ if (obj.duration !== undefined) {
585
+ obj.duration;
586
+ }
587
+ if (obj.enabled !== undefined) {
588
+ const obj_enabled = obj.enabled;
589
+ const path_enabled = path + '.enabled';
590
+ if (typeof obj_enabled !== 'boolean') {
591
+ return new TypeError('Expected "boolean" but received "' + typeof obj_enabled + '" (at "' + path_enabled + '")');
592
+ }
593
+ }
594
+ if (obj.endDate !== undefined) {
595
+ const obj_endDate = obj.endDate;
596
+ const path_endDate = path + '.endDate';
597
+ if (typeof obj_endDate !== 'string') {
598
+ return new TypeError('Expected "string" but received "' + typeof obj_endDate + '" (at "' + path_endDate + '")');
599
+ }
600
+ }
601
+ if (obj.error !== undefined) {
602
+ const obj_error = obj.error;
603
+ const path_error = path + '.error';
604
+ if (typeof obj_error !== 'string') {
605
+ return new TypeError('Expected "string" but received "' + typeof obj_error + '" (at "' + path_error + '")');
606
+ }
607
+ }
608
+ const obj_name = obj.name;
609
+ const path_name = path + '.name';
610
+ if (typeof obj_name !== 'string') {
611
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
612
+ }
613
+ if (obj.setupUrl !== undefined) {
614
+ const obj_setupUrl = obj.setupUrl;
615
+ const path_setupUrl = path + '.setupUrl';
616
+ if (typeof obj_setupUrl !== 'string') {
617
+ return new TypeError('Expected "string" but received "' + typeof obj_setupUrl + '" (at "' + path_setupUrl + '")');
618
+ }
619
+ }
620
+ if (obj.startDate !== undefined) {
621
+ const obj_startDate = obj.startDate;
622
+ const path_startDate = path + '.startDate';
623
+ if (typeof obj_startDate !== 'string') {
624
+ return new TypeError('Expected "string" but received "' + typeof obj_startDate + '" (at "' + path_startDate + '")');
625
+ }
626
+ }
627
+ const obj_status = obj.status;
628
+ const path_status = path + '.status';
629
+ if (typeof obj_status !== 'string') {
630
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
631
+ }
632
+ })();
633
+ return v_error === undefined ? null : v_error;
634
+ }
635
+ const select$4 = function TemplateSetupTaskRepresentationSelect() {
636
+ return {
637
+ kind: 'Fragment',
638
+ version: VERSION$2,
639
+ private: [],
640
+ selections: [
641
+ {
642
+ name: 'description',
643
+ kind: 'Scalar',
644
+ required: false
645
+ },
646
+ {
647
+ name: 'details',
648
+ kind: 'Scalar',
649
+ required: false
650
+ },
651
+ {
652
+ name: 'duration',
653
+ kind: 'Scalar',
654
+ required: false
655
+ },
656
+ {
657
+ name: 'enabled',
658
+ kind: 'Scalar',
659
+ required: false
660
+ },
661
+ {
662
+ name: 'endDate',
663
+ kind: 'Scalar',
664
+ required: false
665
+ },
666
+ {
667
+ name: 'error',
668
+ kind: 'Scalar',
669
+ required: false
670
+ },
671
+ {
672
+ name: 'name',
673
+ kind: 'Scalar'
674
+ },
675
+ {
676
+ name: 'setupUrl',
677
+ kind: 'Scalar',
678
+ required: false
679
+ },
680
+ {
681
+ name: 'startDate',
682
+ kind: 'Scalar',
683
+ required: false
684
+ },
685
+ {
686
+ name: 'status',
687
+ kind: 'Scalar'
688
+ }
689
+ ]
690
+ };
691
+ };
692
+ function equals$2(existing, incoming) {
693
+ const existing_enabled = existing.enabled;
694
+ const incoming_enabled = incoming.enabled;
695
+ // if at least one of these optionals is defined
696
+ if (existing_enabled !== undefined || incoming_enabled !== undefined) {
697
+ // if one of these is not defined we know the other is defined and therefore
698
+ // not equal
699
+ if (existing_enabled === undefined || incoming_enabled === undefined) {
700
+ return false;
701
+ }
702
+ if (!(existing_enabled === incoming_enabled)) {
703
+ return false;
704
+ }
705
+ }
706
+ const existing_description = existing.description;
707
+ const incoming_description = incoming.description;
708
+ // if at least one of these optionals is defined
709
+ if (existing_description !== undefined || incoming_description !== undefined) {
710
+ // if one of these is not defined we know the other is defined and therefore
711
+ // not equal
712
+ if (existing_description === undefined || incoming_description === undefined) {
713
+ return false;
714
+ }
715
+ if (!(existing_description === incoming_description)) {
716
+ return false;
717
+ }
718
+ }
719
+ const existing_details = existing.details;
720
+ const incoming_details = incoming.details;
721
+ // if at least one of these optionals is defined
722
+ if (existing_details !== undefined || incoming_details !== undefined) {
723
+ // if one of these is not defined we know the other is defined and therefore
724
+ // not equal
725
+ if (existing_details === undefined || incoming_details === undefined) {
726
+ return false;
727
+ }
728
+ if (!(existing_details === incoming_details)) {
729
+ return false;
730
+ }
731
+ }
732
+ const existing_endDate = existing.endDate;
733
+ const incoming_endDate = incoming.endDate;
734
+ // if at least one of these optionals is defined
735
+ if (existing_endDate !== undefined || incoming_endDate !== undefined) {
736
+ // if one of these is not defined we know the other is defined and therefore
737
+ // not equal
738
+ if (existing_endDate === undefined || incoming_endDate === undefined) {
739
+ return false;
740
+ }
741
+ if (!(existing_endDate === incoming_endDate)) {
742
+ return false;
743
+ }
744
+ }
745
+ const existing_error = existing.error;
746
+ const incoming_error = incoming.error;
747
+ // if at least one of these optionals is defined
748
+ if (existing_error !== undefined || incoming_error !== undefined) {
749
+ // if one of these is not defined we know the other is defined and therefore
750
+ // not equal
751
+ if (existing_error === undefined || incoming_error === undefined) {
752
+ return false;
753
+ }
754
+ if (!(existing_error === incoming_error)) {
755
+ return false;
756
+ }
757
+ }
758
+ const existing_name = existing.name;
759
+ const incoming_name = incoming.name;
760
+ if (!(existing_name === incoming_name)) {
761
+ return false;
762
+ }
763
+ const existing_setupUrl = existing.setupUrl;
764
+ const incoming_setupUrl = incoming.setupUrl;
765
+ // if at least one of these optionals is defined
766
+ if (existing_setupUrl !== undefined || incoming_setupUrl !== undefined) {
767
+ // if one of these is not defined we know the other is defined and therefore
768
+ // not equal
769
+ if (existing_setupUrl === undefined || incoming_setupUrl === undefined) {
770
+ return false;
771
+ }
772
+ if (!(existing_setupUrl === incoming_setupUrl)) {
773
+ return false;
774
+ }
775
+ }
776
+ const existing_startDate = existing.startDate;
777
+ const incoming_startDate = incoming.startDate;
778
+ // if at least one of these optionals is defined
779
+ if (existing_startDate !== undefined || incoming_startDate !== undefined) {
780
+ // if one of these is not defined we know the other is defined and therefore
781
+ // not equal
782
+ if (existing_startDate === undefined || incoming_startDate === undefined) {
783
+ return false;
784
+ }
785
+ if (!(existing_startDate === incoming_startDate)) {
786
+ return false;
787
+ }
788
+ }
789
+ const existing_status = existing.status;
790
+ const incoming_status = incoming.status;
791
+ if (!(existing_status === incoming_status)) {
792
+ return false;
793
+ }
794
+ const existing_duration = existing.duration;
795
+ const incoming_duration = incoming.duration;
796
+ // if at least one of these optionals is defined
797
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
798
+ // if one of these is not defined we know the other is defined and therefore
799
+ // not equal
800
+ if (existing_duration === undefined || incoming_duration === undefined) {
801
+ return false;
802
+ }
803
+ if (!(existing_duration === incoming_duration)) {
804
+ return false;
805
+ }
806
+ }
807
+ return true;
808
+ }
809
+
810
+ const VERSION$1 = "902a8640d811c60e0dd88853dfbfe319";
811
+ function validate$1(obj, path = 'TemplateSetupJobRepresentation') {
812
+ const v_error = (() => {
813
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
814
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
815
+ }
816
+ if (obj.description !== undefined) {
817
+ const obj_description = obj.description;
818
+ const path_description = path + '.description';
819
+ if (typeof obj_description !== 'string') {
820
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
821
+ }
822
+ }
823
+ if (obj.duration !== undefined) {
824
+ obj.duration;
825
+ }
826
+ const obj_name = obj.name;
827
+ const path_name = path + '.name';
828
+ if (typeof obj_name !== 'string') {
829
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
830
+ }
831
+ const obj_status = obj.status;
832
+ const path_status = path + '.status';
833
+ if (typeof obj_status !== 'string') {
834
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
835
+ }
836
+ const obj_tasks = obj.tasks;
837
+ const path_tasks = path + '.tasks';
838
+ if (!ArrayIsArray(obj_tasks)) {
839
+ return new TypeError('Expected "array" but received "' + typeof obj_tasks + '" (at "' + path_tasks + '")');
840
+ }
841
+ for (let i = 0; i < obj_tasks.length; i++) {
842
+ const obj_tasks_item = obj_tasks[i];
843
+ const path_tasks_item = path_tasks + '[' + i + ']';
844
+ const referencepath_tasks_itemValidationError = validate$2(obj_tasks_item, path_tasks_item);
845
+ if (referencepath_tasks_itemValidationError !== null) {
846
+ let message = 'Object doesn\'t match TemplateSetupTaskRepresentation (at "' + path_tasks_item + '")\n';
847
+ message += referencepath_tasks_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
848
+ return new TypeError(message);
849
+ }
850
+ }
851
+ })();
852
+ return v_error === undefined ? null : v_error;
853
+ }
854
+ const select$3 = function TemplateSetupJobRepresentationSelect() {
855
+ const { selections: TemplateSetupTaskRepresentation__selections, opaque: TemplateSetupTaskRepresentation__opaque, } = select$4();
856
+ return {
857
+ kind: 'Fragment',
858
+ version: VERSION$1,
859
+ private: [],
860
+ selections: [
861
+ {
862
+ name: 'description',
863
+ kind: 'Scalar',
864
+ required: false
865
+ },
866
+ {
867
+ name: 'duration',
868
+ kind: 'Scalar',
869
+ required: false
870
+ },
871
+ {
872
+ name: 'name',
873
+ kind: 'Scalar'
874
+ },
875
+ {
876
+ name: 'status',
877
+ kind: 'Scalar'
878
+ },
879
+ {
880
+ name: 'tasks',
881
+ kind: 'Object',
882
+ plural: true,
883
+ selections: TemplateSetupTaskRepresentation__selections
884
+ }
885
+ ]
886
+ };
887
+ };
888
+ function equals$1(existing, incoming) {
889
+ const existing_description = existing.description;
890
+ const incoming_description = incoming.description;
891
+ // if at least one of these optionals is defined
892
+ if (existing_description !== undefined || incoming_description !== undefined) {
893
+ // if one of these is not defined we know the other is defined and therefore
894
+ // not equal
895
+ if (existing_description === undefined || incoming_description === undefined) {
896
+ return false;
897
+ }
898
+ if (!(existing_description === incoming_description)) {
899
+ return false;
900
+ }
901
+ }
902
+ const existing_name = existing.name;
903
+ const incoming_name = incoming.name;
904
+ if (!(existing_name === incoming_name)) {
905
+ return false;
906
+ }
907
+ const existing_status = existing.status;
908
+ const incoming_status = incoming.status;
909
+ if (!(existing_status === incoming_status)) {
910
+ return false;
911
+ }
912
+ const existing_duration = existing.duration;
913
+ const incoming_duration = incoming.duration;
914
+ // if at least one of these optionals is defined
915
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
916
+ // if one of these is not defined we know the other is defined and therefore
917
+ // not equal
918
+ if (existing_duration === undefined || incoming_duration === undefined) {
919
+ return false;
920
+ }
921
+ if (!(existing_duration === incoming_duration)) {
922
+ return false;
923
+ }
924
+ }
925
+ const existing_tasks = existing.tasks;
926
+ const incoming_tasks = incoming.tasks;
927
+ const equals_tasks_items = equalsArray(existing_tasks, incoming_tasks, (existing_tasks_item, incoming_tasks_item) => {
928
+ if (!(equals$2(existing_tasks_item, incoming_tasks_item))) {
929
+ return false;
930
+ }
931
+ });
932
+ if (equals_tasks_items === false) {
933
+ return false;
934
+ }
935
+ return true;
936
+ }
937
+
938
+ const TTL = 1000;
939
+ const VERSION = "21fb8a334009879b4efd92014fb2c9b6";
940
+ function validate(obj, path = 'TemplateSetupPlanRepresentation') {
941
+ const v_error = (() => {
942
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
943
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
944
+ }
945
+ if (obj.description !== undefined) {
946
+ const obj_description = obj.description;
947
+ const path_description = path + '.description';
948
+ if (typeof obj_description !== 'string') {
949
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
950
+ }
951
+ }
952
+ if (obj.details !== undefined) {
953
+ const obj_details = obj.details;
954
+ const path_details = path + '.details';
955
+ if (typeof obj_details !== 'string') {
956
+ return new TypeError('Expected "string" but received "' + typeof obj_details + '" (at "' + path_details + '")');
957
+ }
958
+ }
959
+ if (obj.duration !== undefined) {
960
+ obj.duration;
961
+ }
962
+ const obj_jobs = obj.jobs;
963
+ const path_jobs = path + '.jobs';
964
+ if (!ArrayIsArray(obj_jobs)) {
965
+ return new TypeError('Expected "array" but received "' + typeof obj_jobs + '" (at "' + path_jobs + '")');
966
+ }
967
+ for (let i = 0; i < obj_jobs.length; i++) {
968
+ const obj_jobs_item = obj_jobs[i];
969
+ const path_jobs_item = path_jobs + '[' + i + ']';
970
+ const referencepath_jobs_itemValidationError = validate$1(obj_jobs_item, path_jobs_item);
971
+ if (referencepath_jobs_itemValidationError !== null) {
972
+ let message = 'Object doesn\'t match TemplateSetupJobRepresentation (at "' + path_jobs_item + '")\n';
973
+ message += referencepath_jobs_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
974
+ return new TypeError(message);
975
+ }
976
+ }
977
+ const obj_name = obj.name;
978
+ const path_name = path + '.name';
979
+ if (typeof obj_name !== 'string') {
980
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
981
+ }
982
+ const obj_status = obj.status;
983
+ const path_status = path + '.status';
984
+ if (typeof obj_status !== 'string') {
985
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
986
+ }
987
+ const obj_templateId = obj.templateId;
988
+ const path_templateId = path + '.templateId';
989
+ if (typeof obj_templateId !== 'string') {
990
+ return new TypeError('Expected "string" but received "' + typeof obj_templateId + '" (at "' + path_templateId + '")');
991
+ }
992
+ })();
993
+ return v_error === undefined ? null : v_error;
994
+ }
995
+ const RepresentationType = 'TemplateSetupPlanRepresentation';
996
+ function keyBuilder$2(luvio, config) {
997
+ return keyPrefix + '::' + RepresentationType + ':' + config.templateId + ':' + config.planName;
998
+ }
999
+ function keyBuilderFromType(luvio, object) {
1000
+ const keyParams = {
1001
+ templateId: object.templateId,
1002
+ planName: object.name
1003
+ };
1004
+ return keyBuilder$2(luvio, keyParams);
1005
+ }
1006
+ function normalize(input, existing, path, luvio, store, timestamp) {
1007
+ return input;
1008
+ }
1009
+ const select$2 = function TemplateSetupPlanRepresentationSelect() {
1010
+ const { selections: TemplateSetupJobRepresentation__selections, opaque: TemplateSetupJobRepresentation__opaque, } = select$3();
1011
+ return {
1012
+ kind: 'Fragment',
1013
+ version: VERSION,
1014
+ private: [],
1015
+ selections: [
1016
+ {
1017
+ name: 'description',
1018
+ kind: 'Scalar',
1019
+ required: false
1020
+ },
1021
+ {
1022
+ name: 'details',
1023
+ kind: 'Scalar',
1024
+ required: false
1025
+ },
1026
+ {
1027
+ name: 'duration',
1028
+ kind: 'Scalar',
1029
+ required: false
1030
+ },
1031
+ {
1032
+ name: 'jobs',
1033
+ kind: 'Object',
1034
+ plural: true,
1035
+ selections: TemplateSetupJobRepresentation__selections
1036
+ },
1037
+ {
1038
+ name: 'name',
1039
+ kind: 'Scalar'
1040
+ },
1041
+ {
1042
+ name: 'status',
1043
+ kind: 'Scalar'
1044
+ },
1045
+ {
1046
+ name: 'templateId',
1047
+ kind: 'Scalar'
1048
+ }
1049
+ ]
1050
+ };
1051
+ };
1052
+ function equals(existing, incoming) {
1053
+ const existing_description = existing.description;
1054
+ const incoming_description = incoming.description;
1055
+ // if at least one of these optionals is defined
1056
+ if (existing_description !== undefined || incoming_description !== undefined) {
1057
+ // if one of these is not defined we know the other is defined and therefore
1058
+ // not equal
1059
+ if (existing_description === undefined || incoming_description === undefined) {
1060
+ return false;
1061
+ }
1062
+ if (!(existing_description === incoming_description)) {
1063
+ return false;
1064
+ }
1065
+ }
1066
+ const existing_details = existing.details;
1067
+ const incoming_details = incoming.details;
1068
+ // if at least one of these optionals is defined
1069
+ if (existing_details !== undefined || incoming_details !== undefined) {
1070
+ // if one of these is not defined we know the other is defined and therefore
1071
+ // not equal
1072
+ if (existing_details === undefined || incoming_details === undefined) {
1073
+ return false;
1074
+ }
1075
+ if (!(existing_details === incoming_details)) {
1076
+ return false;
1077
+ }
1078
+ }
1079
+ const existing_name = existing.name;
1080
+ const incoming_name = incoming.name;
1081
+ if (!(existing_name === incoming_name)) {
1082
+ return false;
1083
+ }
1084
+ const existing_status = existing.status;
1085
+ const incoming_status = incoming.status;
1086
+ if (!(existing_status === incoming_status)) {
1087
+ return false;
1088
+ }
1089
+ const existing_templateId = existing.templateId;
1090
+ const incoming_templateId = incoming.templateId;
1091
+ if (!(existing_templateId === incoming_templateId)) {
1092
+ return false;
1093
+ }
1094
+ const existing_duration = existing.duration;
1095
+ const incoming_duration = incoming.duration;
1096
+ // if at least one of these optionals is defined
1097
+ if (existing_duration !== undefined || incoming_duration !== undefined) {
1098
+ // if one of these is not defined we know the other is defined and therefore
1099
+ // not equal
1100
+ if (existing_duration === undefined || incoming_duration === undefined) {
1101
+ return false;
1102
+ }
1103
+ if (!(existing_duration === incoming_duration)) {
1104
+ return false;
1105
+ }
1106
+ }
1107
+ const existing_jobs = existing.jobs;
1108
+ const incoming_jobs = incoming.jobs;
1109
+ const equals_jobs_items = equalsArray(existing_jobs, incoming_jobs, (existing_jobs_item, incoming_jobs_item) => {
1110
+ if (!(equals$1(existing_jobs_item, incoming_jobs_item))) {
1111
+ return false;
1112
+ }
1113
+ });
1114
+ if (equals_jobs_items === false) {
1115
+ return false;
1116
+ }
1117
+ return true;
1118
+ }
1119
+ const ingest = function TemplateSetupPlanRepresentationIngest(input, path, luvio, store, timestamp) {
1120
+ if (process.env.NODE_ENV !== 'production') {
1121
+ const validateError = validate(input);
1122
+ if (validateError !== null) {
1123
+ throw validateError;
1124
+ }
1125
+ }
1126
+ const key = keyBuilderFromType(luvio, input);
1127
+ const ttlToUse = TTL;
1128
+ ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "WAVE", VERSION, RepresentationType, equals);
1129
+ return createLink(key);
1130
+ };
1131
+ function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
1132
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1133
+ const rootKey = keyBuilderFromType(luvio, input);
1134
+ rootKeySet.set(rootKey, {
1135
+ namespace: keyPrefix,
1136
+ representationName: RepresentationType,
1137
+ mergeable: false
1138
+ });
1139
+ }
1140
+
1141
+ function select$1(luvio, params) {
1142
+ return select$2();
1143
+ }
1144
+ function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
1145
+ getTypeCacheKeys(storeKeyMap, luvio, response);
1146
+ }
1147
+ function ingestSuccess$1(luvio, resourceParams, response) {
1148
+ const { body } = response;
1149
+ const key = keyBuilderFromType(luvio, body);
1150
+ luvio.storeIngest(key, ingest, body);
1151
+ const snapshot = luvio.storeLookup({
1152
+ recordId: key,
1153
+ node: select$1(),
1154
+ variables: {},
1155
+ });
1156
+ if (process.env.NODE_ENV !== 'production') {
1157
+ if (snapshot.state !== 'Fulfilled') {
1158
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1159
+ }
1160
+ }
1161
+ deepFreeze(snapshot.data);
1162
+ return snapshot;
1163
+ }
1164
+ function createResourceRequest$1(config) {
1165
+ const headers = {};
1166
+ return {
1167
+ baseUri: '/services/data/v66.0',
1168
+ basePath: '/wave/templates/' + config.urlParams.templateIdOrApiName + '/plans/' + config.urlParams.planName + '',
1169
+ method: 'post',
1170
+ body: null,
1171
+ urlParams: config.urlParams,
1172
+ queryParams: {},
1173
+ headers,
1174
+ priority: 'normal',
1175
+ };
1176
+ }
1177
+
1178
+ const adapterName$1 = 'executeTemplateSetupPlan';
1179
+ const executeTemplateSetupPlan_ConfigPropertyMetadata = [
1180
+ generateParamConfigMetadata('planName', true, 0 /* UrlParameter */, 0 /* String */),
1181
+ generateParamConfigMetadata('templateIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
1182
+ ];
1183
+ const executeTemplateSetupPlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, executeTemplateSetupPlan_ConfigPropertyMetadata);
1184
+ const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(executeTemplateSetupPlan_ConfigPropertyMetadata);
1185
+ function typeCheckConfig$1(untrustedConfig) {
1186
+ const config = {};
1187
+ typeCheckConfig$4(untrustedConfig, config, executeTemplateSetupPlan_ConfigPropertyMetadata);
1188
+ return config;
1189
+ }
1190
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
1191
+ if (!untrustedIsObject(untrustedConfig)) {
1192
+ return null;
1193
+ }
1194
+ if (process.env.NODE_ENV !== 'production') {
1195
+ validateConfig(untrustedConfig, configPropertyNames);
1196
+ }
1197
+ const config = typeCheckConfig$1(untrustedConfig);
1198
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1199
+ return null;
1200
+ }
1201
+ return config;
1202
+ }
1203
+ function buildNetworkSnapshot$1(luvio, config, options) {
1204
+ const resourceParams = createResourceParams$1(config);
1205
+ const request = createResourceRequest$1(resourceParams);
1206
+ return luvio.dispatchResourceRequest(request, options)
1207
+ .then((response) => {
1208
+ return luvio.handleSuccessResponse(() => {
1209
+ const snapshot = ingestSuccess$1(luvio, resourceParams, response);
1210
+ return luvio.storeBroadcast().then(() => snapshot);
1211
+ }, () => {
1212
+ const cache = new StoreKeyMap();
1213
+ getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
1214
+ return cache;
1215
+ });
1216
+ }, (response) => {
1217
+ deepFreeze(response);
1218
+ throw response;
1219
+ });
1220
+ }
1221
+ const executeTemplateSetupPlanAdapterFactory = (luvio) => {
1222
+ return function executeTemplateSetupPlan(untrustedConfig) {
1223
+ const config = validateAdapterConfig$1(untrustedConfig, executeTemplateSetupPlan_ConfigPropertyNames);
1224
+ // Invalid or incomplete config
1225
+ if (config === null) {
1226
+ throw new Error('Invalid config for "executeTemplateSetupPlan"');
1227
+ }
1228
+ return buildNetworkSnapshot$1(luvio, config);
1229
+ };
1230
+ };
1231
+
1232
+ function select(luvio, params) {
1233
+ return select$2();
1234
+ }
1235
+ function keyBuilder$1(luvio, params) {
1236
+ return keyBuilder$2(luvio, {
1237
+ templateId: params.urlParams.templateIdOrApiName,
1238
+ planName: params.urlParams.planName
1239
+ });
1240
+ }
1241
+ function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
1242
+ getTypeCacheKeys(storeKeyMap, luvio, response);
1243
+ }
1244
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1245
+ const { body } = response;
1246
+ const key = keyBuilder$1(luvio, resourceParams);
1247
+ luvio.storeIngest(key, ingest, body);
1248
+ const snapshot = luvio.storeLookup({
1249
+ recordId: key,
1250
+ node: select(),
1251
+ variables: {},
1252
+ }, snapshotRefresh);
1253
+ if (process.env.NODE_ENV !== 'production') {
1254
+ if (snapshot.state !== 'Fulfilled') {
1255
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1256
+ }
1257
+ }
1258
+ deepFreeze(snapshot.data);
1259
+ return snapshot;
1260
+ }
1261
+ function ingestError(luvio, params, error, snapshotRefresh) {
1262
+ const key = keyBuilder$1(luvio, params);
1263
+ const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1264
+ const storeMetadataParams = {
1265
+ ttl: TTL,
1266
+ namespace: keyPrefix,
1267
+ version: VERSION,
1268
+ representationName: RepresentationType
1269
+ };
1270
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1271
+ return errorSnapshot;
1272
+ }
1273
+ function createResourceRequest(config) {
1274
+ const headers = {};
1275
+ return {
1276
+ baseUri: '/services/data/v66.0',
1277
+ basePath: '/wave/templates/' + config.urlParams.templateIdOrApiName + '/plans/' + config.urlParams.planName + '',
1278
+ method: 'get',
1279
+ body: null,
1280
+ urlParams: config.urlParams,
1281
+ queryParams: {},
1282
+ headers,
1283
+ priority: 'normal',
1284
+ };
1285
+ }
1286
+ function createResourceRequestFromRepresentation(representation) {
1287
+ const config = {
1288
+ urlParams: {},
1289
+ };
1290
+ config.urlParams.templateIdOrApiName = representation.templateId;
1291
+ config.urlParams.planName = representation.name;
1292
+ return createResourceRequest(config);
1293
+ }
1294
+
1295
+ const adapterName = 'getTemplateSetupPlan';
1296
+ const getTemplateSetupPlan_ConfigPropertyMetadata = [
1297
+ generateParamConfigMetadata('planName', true, 0 /* UrlParameter */, 0 /* String */),
1298
+ generateParamConfigMetadata('templateIdOrApiName', true, 0 /* UrlParameter */, 0 /* String */),
1299
+ ];
1300
+ const getTemplateSetupPlan_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, getTemplateSetupPlan_ConfigPropertyMetadata);
1301
+ const createResourceParams = /*#__PURE__*/ createResourceParams$4(getTemplateSetupPlan_ConfigPropertyMetadata);
1302
+ function keyBuilder(luvio, config) {
1303
+ const resourceParams = createResourceParams(config);
1304
+ return keyBuilder$1(luvio, resourceParams);
1305
+ }
1306
+ function typeCheckConfig(untrustedConfig) {
1307
+ const config = {};
1308
+ typeCheckConfig$4(untrustedConfig, config, getTemplateSetupPlan_ConfigPropertyMetadata);
1309
+ return config;
1310
+ }
1311
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1312
+ if (!untrustedIsObject(untrustedConfig)) {
1313
+ return null;
1314
+ }
1315
+ if (process.env.NODE_ENV !== 'production') {
1316
+ validateConfig(untrustedConfig, configPropertyNames);
1317
+ }
1318
+ const config = typeCheckConfig(untrustedConfig);
1319
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1320
+ return null;
1321
+ }
1322
+ return config;
1323
+ }
1324
+ function adapterFragment(luvio, config) {
1325
+ createResourceParams(config);
1326
+ return select();
1327
+ }
1328
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1329
+ const snapshot = ingestSuccess(luvio, resourceParams, response, {
1330
+ config,
1331
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1332
+ });
1333
+ return luvio.storeBroadcast().then(() => snapshot);
1334
+ }
1335
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1336
+ const snapshot = ingestError(luvio, resourceParams, response, {
1337
+ config,
1338
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1339
+ });
1340
+ return luvio.storeBroadcast().then(() => snapshot);
1341
+ }
1342
+ function buildNetworkSnapshot(luvio, config, options) {
1343
+ const resourceParams = createResourceParams(config);
1344
+ const request = createResourceRequest(resourceParams);
1345
+ return luvio.dispatchResourceRequest(request, options)
1346
+ .then((response) => {
1347
+ return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
1348
+ const cache = new StoreKeyMap();
1349
+ getResponseCacheKeys(cache, luvio, resourceParams, response.body);
1350
+ return cache;
1351
+ });
1352
+ }, (response) => {
1353
+ return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
1354
+ });
1355
+ }
1356
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1357
+ return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot, undefined, false);
1358
+ }
1359
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1360
+ const { luvio, config } = context;
1361
+ const selector = {
1362
+ recordId: keyBuilder(luvio, config),
1363
+ node: adapterFragment(luvio, config),
1364
+ variables: {},
1365
+ };
1366
+ const cacheSnapshot = storeLookup(selector, {
1367
+ config,
1368
+ resolve: () => buildNetworkSnapshot(luvio, config, snapshotRefreshOptions)
1369
+ });
1370
+ return cacheSnapshot;
1371
+ }
1372
+ const getTemplateSetupPlanAdapterFactory = (luvio) => function WAVE__getTemplateSetupPlan(untrustedConfig, requestContext) {
1373
+ const config = validateAdapterConfig(untrustedConfig, getTemplateSetupPlan_ConfigPropertyNames);
1374
+ // Invalid or incomplete config
1375
+ if (config === null) {
1376
+ return null;
1377
+ }
1378
+ return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
1379
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1380
+ };
1381
+ const notifyChangeFactory = (luvio, options) => {
1382
+ return function getWaveTemplatesPlansByPlanNameAndTemplateIdOrApiNameNotifyChange(configs) {
1383
+ const keys = configs.map(c => keyBuilder$2(luvio, c));
1384
+ luvio.getNotifyChangeStoreEntries(keys).then(entries => {
1385
+ for (let i = 0, len = entries.length; i < len; i++) {
1386
+ const { key, record: val } = entries[i];
1387
+ const refreshRequest = createResourceRequestFromRepresentation(val);
1388
+ luvio.dispatchResourceRequest(refreshRequest, options)
1389
+ .then((response) => {
1390
+ return luvio.handleSuccessResponse(() => {
1391
+ const { body } = response;
1392
+ luvio.storeIngest(key, ingest, body);
1393
+ return luvio.storeBroadcast();
1394
+ }, () => {
1395
+ const cache = new StoreKeyMap();
1396
+ getTypeCacheKeys(cache, luvio, response.body);
1397
+ return cache;
1398
+ });
1399
+ }, (error) => {
1400
+ return luvio.handleErrorResponse(() => {
1401
+ const errorSnapshot = luvio.errorSnapshot(error);
1402
+ luvio.storeIngestError(key, errorSnapshot, {
1403
+ ttl: TTL,
1404
+ namespace: keyPrefix,
1405
+ version: VERSION,
1406
+ representationName: RepresentationType
1407
+ });
1408
+ return luvio.storeBroadcast().then(() => errorSnapshot);
1409
+ });
1410
+ });
1411
+ }
1412
+ });
1413
+ };
1414
+ };
1415
+
1416
+ let createDashboard;
1417
+ let executeSoqlQueryPost;
1418
+ let executeTemplateSetupPlan;
1419
+ let getTemplateSetupPlan;
1420
+ let getTemplateSetupPlanNotifyChange;
1421
+ // Imperative GET Adapters
1422
+ let executeSoqlQueryPost_imperative;
1423
+ let getTemplateSetupPlan_imperative;
1424
+ const executeSoqlQueryPostMetadata = { apiFamily: 'WAVE', name: 'executeSoqlQueryPost', ttl: 5000 };
1425
+ const getTemplateSetupPlanMetadata = { apiFamily: 'WAVE', name: 'getTemplateSetupPlan', ttl: 1000 };
1426
+ // Notify Update Available
1427
+ function bindExportsTo(luvio) {
1428
+ // LDS Adapters
1429
+ const executeSoqlQueryPost_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'executeSoqlQueryPost', executeSoqlQueryPostAdapterFactory), executeSoqlQueryPostMetadata);
1430
+ const getTemplateSetupPlan_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getTemplateSetupPlan', getTemplateSetupPlanAdapterFactory), getTemplateSetupPlanMetadata);
1431
+ function unwrapSnapshotData(factory) {
1432
+ const adapter = factory(luvio);
1433
+ return (config) => adapter(config).then((snapshot) => snapshot.data);
1434
+ }
1435
+ return {
1436
+ createDashboard: unwrapSnapshotData(createDashboardAdapterFactory),
1437
+ executeSoqlQueryPost: createWireAdapterConstructor(luvio, executeSoqlQueryPost_ldsAdapter, executeSoqlQueryPostMetadata),
1438
+ executeTemplateSetupPlan: unwrapSnapshotData(executeTemplateSetupPlanAdapterFactory),
1439
+ getTemplateSetupPlan: createWireAdapterConstructor(luvio, getTemplateSetupPlan_ldsAdapter, getTemplateSetupPlanMetadata),
1440
+ getTemplateSetupPlanNotifyChange: createLDSAdapter(luvio, 'getTemplateSetupPlanNotifyChange', notifyChangeFactory),
1441
+ // Imperative GET Adapters
1442
+ executeSoqlQueryPost_imperative: createImperativeAdapter(luvio, executeSoqlQueryPost_ldsAdapter, executeSoqlQueryPostMetadata),
1443
+ getTemplateSetupPlan_imperative: createImperativeAdapter(luvio, getTemplateSetupPlan_ldsAdapter, getTemplateSetupPlanMetadata),
1444
+ // Notify Update Availables
1445
+ };
1446
+ }
1447
+ withDefaultLuvio((luvio) => {
1448
+ ({
1449
+ createDashboard,
1450
+ executeSoqlQueryPost,
1451
+ executeTemplateSetupPlan,
1452
+ getTemplateSetupPlan,
1453
+ getTemplateSetupPlanNotifyChange,
1454
+ executeSoqlQueryPost_imperative,
1455
+ getTemplateSetupPlan_imperative,
1456
+ } = bindExportsTo(luvio));
1457
+ });
1458
+
1459
+ export { createDashboard, executeSoqlQueryPost, executeSoqlQueryPost_imperative, executeTemplateSetupPlan, getTemplateSetupPlan, getTemplateSetupPlanNotifyChange, getTemplateSetupPlan_imperative };
1460
+ // version: 0.1.0-dev1-c978a7b010