@salesforce/lds-adapters-sales-enablement-program 1.100.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/sales-enablement-program.js +1584 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/getProgramTemplate.d.ts +26 -0
  5. package/dist/types/src/generated/adapters/getProgramTemplates.d.ts +25 -0
  6. package/dist/types/src/generated/artifacts/main.d.ts +2 -0
  7. package/dist/types/src/generated/artifacts/sfdc.d.ts +5 -0
  8. package/dist/types/src/generated/resources/deleteConnectEnablementMeasure.d.ts +8 -0
  9. package/dist/types/src/generated/resources/deleteConnectEnablementMeasureByMeasureId.d.ts +11 -0
  10. package/dist/types/src/generated/resources/getConnectEnablementMeasure.d.ts +12 -0
  11. package/dist/types/src/generated/resources/getConnectEnablementMeasureByMeasureId.d.ts +15 -0
  12. package/dist/types/src/generated/resources/getConnectEnablementMeasureCloneActionBySourceMeasureId.d.ts +15 -0
  13. package/dist/types/src/generated/resources/getConnectEnablementProgramByEnablementProgramId.d.ts +15 -0
  14. package/dist/types/src/generated/resources/getConnectEnablementProgramDescribeByEnablementProgramId.d.ts +15 -0
  15. package/dist/types/src/generated/resources/getConnectEnablementProgramSummaryAssigned.d.ts +12 -0
  16. package/dist/types/src/generated/resources/getConnectEnablementProgramSummaryByEnablementProgramId.d.ts +15 -0
  17. package/dist/types/src/generated/resources/getConnectEnablementProgramTemplate.d.ts +12 -0
  18. package/dist/types/src/generated/resources/getConnectEnablementProgramTemplateByProgramTemplateName.d.ts +15 -0
  19. package/dist/types/src/generated/resources/getConnectEnablementProgramsDescribeByEnablementProgramId.d.ts +15 -0
  20. package/dist/types/src/generated/resources/patchConnectEnablementMeasure.d.ts +10 -0
  21. package/dist/types/src/generated/resources/patchConnectEnablementMeasureByMeasureId.d.ts +13 -0
  22. package/dist/types/src/generated/resources/patchConnectEnablementProgram.d.ts +14 -0
  23. package/dist/types/src/generated/resources/patchConnectEnablementPrograms.d.ts +14 -0
  24. package/dist/types/src/generated/resources/patchConnectEnablementProgramsByEnablementProgramId.d.ts +17 -0
  25. package/dist/types/src/generated/resources/postConnectEnablementMeasure.d.ts +20 -0
  26. package/dist/types/src/generated/resources/postConnectEnablementMeasureByMeasureId.d.ts +23 -0
  27. package/dist/types/src/generated/resources/postConnectEnablementProgram.d.ts +17 -0
  28. package/dist/types/src/generated/resources/postConnectEnablementProgramStatus.d.ts +13 -0
  29. package/dist/types/src/generated/resources/postConnectEnablementProgramStatusByEnablementProgramId.d.ts +16 -0
  30. package/dist/types/src/generated/resources/postConnectEnablementPrograms.d.ts +17 -0
  31. package/dist/types/src/generated/resources/postConnectEnablementProgramsByEnablementProgramId.d.ts +20 -0
  32. package/dist/types/src/generated/resources/postConnectEnablementProgramsStatus.d.ts +13 -0
  33. package/dist/types/src/generated/resources/postConnectEnablementProgramsStatusByEnablementProgramId.d.ts +16 -0
  34. package/dist/types/src/generated/resources/putConnectEnablementMeasure.d.ts +17 -0
  35. package/dist/types/src/generated/resources/putConnectEnablementMeasureByMeasureId.d.ts +20 -0
  36. package/dist/types/src/generated/types/AbstractEnablementProgramRepresentation.d.ts +49 -0
  37. package/dist/types/src/generated/types/AbstractEnablementProgramTaskRepresentation.d.ts +95 -0
  38. package/dist/types/src/generated/types/EnablementMeasureFilterInputRepresentation.d.ts +41 -0
  39. package/dist/types/src/generated/types/EnablementMeasureFilterRepresentation.d.ts +41 -0
  40. package/dist/types/src/generated/types/EnablementMeasureIdRepresentation.d.ts +29 -0
  41. package/dist/types/src/generated/types/EnablementMeasureInputRepresentation.d.ts +53 -0
  42. package/dist/types/src/generated/types/EnablementMeasureObjectInputRepresentation.d.ts +50 -0
  43. package/dist/types/src/generated/types/EnablementMeasureObjectRepresentation.d.ts +51 -0
  44. package/dist/types/src/generated/types/EnablementMeasureRepresentation.d.ts +63 -0
  45. package/dist/types/src/generated/types/EnablementMeasureStatusInputRepresentation.d.ts +32 -0
  46. package/dist/types/src/generated/types/EnablementProgramInputRepresentation.d.ts +44 -0
  47. package/dist/types/src/generated/types/EnablementProgramRepresentation.d.ts +56 -0
  48. package/dist/types/src/generated/types/EnablementProgramRuntimeRepresentation.d.ts +64 -0
  49. package/dist/types/src/generated/types/EnablementProgramRuntimeTaskRepresentation.d.ts +107 -0
  50. package/dist/types/src/generated/types/EnablementProgramSectionInputRepresentation.d.ts +44 -0
  51. package/dist/types/src/generated/types/EnablementProgramSectionRepresentation.d.ts +42 -0
  52. package/dist/types/src/generated/types/EnablementProgramStatusRepresentation.d.ts +32 -0
  53. package/dist/types/src/generated/types/EnablementProgramStatusUpdateInputRepresentation.d.ts +32 -0
  54. package/dist/types/src/generated/types/EnablementProgramSummaryItemRepresentation.d.ts +47 -0
  55. package/dist/types/src/generated/types/EnablementProgramSummaryListRepresentation.d.ts +30 -0
  56. package/dist/types/src/generated/types/EnablementProgramSummaryRepresentation.d.ts +52 -0
  57. package/dist/types/src/generated/types/EnablementProgramSummarySectionRepresentation.d.ts +32 -0
  58. package/dist/types/src/generated/types/EnablementProgramSummaryTaskRepresentation.d.ts +64 -0
  59. package/dist/types/src/generated/types/EnablementProgramTaskInputRepresentation.d.ts +77 -0
  60. package/dist/types/src/generated/types/EnablementProgramTaskRepresentation.d.ts +96 -0
  61. package/dist/types/src/generated/types/ProgramTaskWarningRepresentation.d.ts +35 -0
  62. package/dist/types/src/generated/types/ProgramTemplateInfoRepresentation.d.ts +35 -0
  63. package/dist/types/src/generated/types/ProgramTemplateListRepresentation.d.ts +31 -0
  64. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  65. package/dist/umd/es2018/sales-enablement-program.js +1593 -0
  66. package/dist/umd/es5/sales-enablement-program.js +1598 -0
  67. package/package.json +71 -0
  68. package/sfdc/index.d.ts +1 -0
  69. package/sfdc/index.js +1624 -0
  70. package/src/raml/api.raml +1406 -0
  71. package/src/raml/luvio.raml +25 -0
@@ -0,0 +1,1598 @@
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.salesEnablementProgram = {}, global.engine));
11
+ })(this, (function (exports, engine) { 'use strict';
12
+
13
+ var ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
14
+ var ObjectKeys = Object.keys;
15
+ var ArrayIsArray$1 = Array.isArray;
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
+ var displayName = adapter.displayName;
25
+ var _a = adapter.parameters, required = _a.required, optional = _a.optional, unsupported = _a.unsupported;
26
+ if (config === undefined ||
27
+ required.every(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
28
+ throw new TypeError("adapter ".concat(displayName, " configuration must specify ").concat(required.sort().join(', ')));
29
+ }
30
+ if (oneOf && oneOf.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); }) === false) {
31
+ throw new TypeError("adapter ".concat(displayName, " configuration must specify one of ").concat(oneOf.sort().join(', ')));
32
+ }
33
+ if (unsupported !== undefined &&
34
+ unsupported.some(function (req) { return ObjectPrototypeHasOwnProperty.call(config, req); })) {
35
+ throw new TypeError("adapter ".concat(displayName, " does not yet support ").concat(unsupported.sort().join(', ')));
36
+ }
37
+ var supported = required.concat(optional);
38
+ if (ObjectKeys(config).some(function (key) { return !supported.includes(key); })) {
39
+ throw new TypeError("adapter ".concat(displayName, " configuration supports only ").concat(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(function (req) { return req in config; });
47
+ }
48
+ var snapshotRefreshOptions = {
49
+ overrides: {
50
+ headers: {
51
+ 'Cache-Control': 'no-cache',
52
+ },
53
+ }
54
+ };
55
+ var keyPrefix = 'enablement-program';
56
+
57
+ var ArrayIsArray = Array.isArray;
58
+ var JSONStringify = JSON.stringify;
59
+ function equalsArray(a, b, equalsItem) {
60
+ var aLength = a.length;
61
+ var bLength = b.length;
62
+ if (aLength !== bLength) {
63
+ return false;
64
+ }
65
+ for (var i = 0; i < aLength; i++) {
66
+ if (equalsItem(a[i], b[i]) === false) {
67
+ return false;
68
+ }
69
+ }
70
+ return true;
71
+ }
72
+ function createLink(ref) {
73
+ return {
74
+ __ref: engine.serializeStructuredKey(ref),
75
+ };
76
+ }
77
+
78
+ var VERSION$4 = "49baef9cf75c51988988655e614683e0";
79
+ function validate$4(obj, path) {
80
+ if (path === void 0) { path = 'ProgramTemplateInfoRepresentation'; }
81
+ var v_error = (function () {
82
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
83
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
84
+ }
85
+ var obj_developerName = obj.developerName;
86
+ var path_developerName = path + '.developerName';
87
+ if (typeof obj_developerName !== 'string') {
88
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
89
+ }
90
+ var obj_iconUrl = obj.iconUrl;
91
+ var path_iconUrl = path + '.iconUrl';
92
+ if (typeof obj_iconUrl !== 'string') {
93
+ return new TypeError('Expected "string" but received "' + typeof obj_iconUrl + '" (at "' + path_iconUrl + '")');
94
+ }
95
+ var obj_label = obj.label;
96
+ var path_label = path + '.label';
97
+ if (typeof obj_label !== 'string') {
98
+ return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
99
+ }
100
+ })();
101
+ return v_error === undefined ? null : v_error;
102
+ }
103
+ var select$6 = function ProgramTemplateInfoRepresentationSelect() {
104
+ return {
105
+ kind: 'Fragment',
106
+ version: VERSION$4,
107
+ private: [],
108
+ selections: [
109
+ {
110
+ name: 'developerName',
111
+ kind: 'Scalar'
112
+ },
113
+ {
114
+ name: 'iconUrl',
115
+ kind: 'Scalar'
116
+ },
117
+ {
118
+ name: 'label',
119
+ kind: 'Scalar'
120
+ }
121
+ ]
122
+ };
123
+ };
124
+ function equals$4(existing, incoming) {
125
+ var existing_developerName = existing.developerName;
126
+ var incoming_developerName = incoming.developerName;
127
+ if (!(existing_developerName === incoming_developerName)) {
128
+ return false;
129
+ }
130
+ var existing_iconUrl = existing.iconUrl;
131
+ var incoming_iconUrl = incoming.iconUrl;
132
+ if (!(existing_iconUrl === incoming_iconUrl)) {
133
+ return false;
134
+ }
135
+ var existing_label = existing.label;
136
+ var incoming_label = incoming.label;
137
+ if (!(existing_label === incoming_label)) {
138
+ return false;
139
+ }
140
+ return true;
141
+ }
142
+
143
+ var TTL$1 = 604800000;
144
+ var VERSION$3 = "8872f2ed6b73d2c5ebf14059ff6642de";
145
+ function validate$3(obj, path) {
146
+ if (path === void 0) { path = 'ProgramTemplateListRepresentation'; }
147
+ var v_error = (function () {
148
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
149
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
150
+ }
151
+ var obj_programTemplateList = obj.programTemplateList;
152
+ var path_programTemplateList = path + '.programTemplateList';
153
+ if (!ArrayIsArray(obj_programTemplateList)) {
154
+ return new TypeError('Expected "array" but received "' + typeof obj_programTemplateList + '" (at "' + path_programTemplateList + '")');
155
+ }
156
+ for (var i = 0; i < obj_programTemplateList.length; i++) {
157
+ var obj_programTemplateList_item = obj_programTemplateList[i];
158
+ var path_programTemplateList_item = path_programTemplateList + '[' + i + ']';
159
+ var referencepath_programTemplateList_itemValidationError = validate$4(obj_programTemplateList_item, path_programTemplateList_item);
160
+ if (referencepath_programTemplateList_itemValidationError !== null) {
161
+ var message = 'Object doesn\'t match ProgramTemplateInfoRepresentation (at "' + path_programTemplateList_item + '")\n';
162
+ message += referencepath_programTemplateList_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
163
+ return new TypeError(message);
164
+ }
165
+ }
166
+ })();
167
+ return v_error === undefined ? null : v_error;
168
+ }
169
+ var RepresentationType$1 = 'ProgramTemplateListRepresentation';
170
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
171
+ return input;
172
+ }
173
+ var select$5 = function ProgramTemplateListRepresentationSelect() {
174
+ var _a = select$6(), ProgramTemplateInfoRepresentation__selections = _a.selections;
175
+ return {
176
+ kind: 'Fragment',
177
+ version: VERSION$3,
178
+ private: [],
179
+ selections: [
180
+ {
181
+ name: 'programTemplateList',
182
+ kind: 'Object',
183
+ plural: true,
184
+ selections: ProgramTemplateInfoRepresentation__selections
185
+ }
186
+ ]
187
+ };
188
+ };
189
+ function equals$3(existing, incoming) {
190
+ var existing_programTemplateList = existing.programTemplateList;
191
+ var incoming_programTemplateList = incoming.programTemplateList;
192
+ var equals_programTemplateList_items = equalsArray(existing_programTemplateList, incoming_programTemplateList, function (existing_programTemplateList_item, incoming_programTemplateList_item) {
193
+ if (!(equals$4(existing_programTemplateList_item, incoming_programTemplateList_item))) {
194
+ return false;
195
+ }
196
+ });
197
+ if (equals_programTemplateList_items === false) {
198
+ return false;
199
+ }
200
+ return true;
201
+ }
202
+ var ingest$1 = function ProgramTemplateListRepresentationIngest(input, path, luvio, store, timestamp) {
203
+ if (process.env.NODE_ENV !== 'production') {
204
+ var validateError = validate$3(input);
205
+ if (validateError !== null) {
206
+ throw validateError;
207
+ }
208
+ }
209
+ var key = path.fullPath;
210
+ var existingRecord = store.readEntry(key);
211
+ var ttlToUse = TTL$1;
212
+ var incomingRecord = normalize$1(input, store.readEntry(key), {
213
+ fullPath: key,
214
+ parent: path.parent,
215
+ propertyName: path.propertyName,
216
+ ttl: ttlToUse
217
+ });
218
+ if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
219
+ luvio.storePublish(key, incomingRecord);
220
+ }
221
+ {
222
+ var storeMetadataParams = {
223
+ ttl: ttlToUse,
224
+ namespace: "enablement-program",
225
+ version: VERSION$3,
226
+ representationName: RepresentationType$1,
227
+ };
228
+ luvio.publishStoreMetadata(key, storeMetadataParams);
229
+ }
230
+ return createLink(key);
231
+ };
232
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
233
+ var rootKeySet = new engine.StoreKeyMap();
234
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
235
+ var rootKey = fullPathFactory();
236
+ rootKeySet.set(rootKey, {
237
+ namespace: keyPrefix,
238
+ representationName: RepresentationType$1,
239
+ mergeable: false
240
+ });
241
+ return rootKeySet;
242
+ }
243
+
244
+ function select$4(luvio, params) {
245
+ return select$5();
246
+ }
247
+ function keyBuilder$3(luvio, params) {
248
+ return keyPrefix + '::ProgramTemplateListRepresentation:(' + ')';
249
+ }
250
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
251
+ return getTypeCacheKeys$1(luvio, response, function () { return keyBuilder$3(); });
252
+ }
253
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
254
+ var body = response.body;
255
+ var key = keyBuilder$3();
256
+ luvio.storeIngest(key, ingest$1, body);
257
+ var snapshot = luvio.storeLookup({
258
+ recordId: key,
259
+ node: select$4(),
260
+ variables: {},
261
+ }, snapshotRefresh);
262
+ if (process.env.NODE_ENV !== 'production') {
263
+ if (snapshot.state !== 'Fulfilled') {
264
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
265
+ }
266
+ }
267
+ return snapshot;
268
+ }
269
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
270
+ var key = keyBuilder$3();
271
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
272
+ var storeMetadataParams = {
273
+ ttl: TTL$1,
274
+ namespace: keyPrefix,
275
+ version: VERSION$3,
276
+ representationName: RepresentationType$1
277
+ };
278
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
279
+ return errorSnapshot;
280
+ }
281
+ function createResourceRequest$1(config) {
282
+ var headers = {};
283
+ return {
284
+ baseUri: '/services/data/v58.0',
285
+ basePath: '/connect/enablement/programTemplate',
286
+ method: 'get',
287
+ body: null,
288
+ urlParams: {},
289
+ queryParams: {},
290
+ headers: headers,
291
+ priority: 'normal',
292
+ };
293
+ }
294
+
295
+ var getProgramTemplates_ConfigPropertyNames = {
296
+ displayName: 'getProgramTemplates',
297
+ parameters: {
298
+ required: [],
299
+ optional: []
300
+ }
301
+ };
302
+ function createResourceParams$1(config) {
303
+ var resourceParams = {};
304
+ return resourceParams;
305
+ }
306
+ function keyBuilder$2(luvio, config) {
307
+ return keyBuilder$3();
308
+ }
309
+ function typeCheckConfig$1(untrustedConfig) {
310
+ var config = {};
311
+ return config;
312
+ }
313
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
314
+ if (!untrustedIsObject(untrustedConfig)) {
315
+ return null;
316
+ }
317
+ if (process.env.NODE_ENV !== 'production') {
318
+ validateConfig(untrustedConfig, configPropertyNames);
319
+ }
320
+ var config = typeCheckConfig$1();
321
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
322
+ return null;
323
+ }
324
+ return config;
325
+ }
326
+ function adapterFragment$1(luvio, config) {
327
+ return select$4();
328
+ }
329
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
330
+ var snapshot = ingestSuccess$1(luvio, resourceParams, response, {
331
+ config: config,
332
+ resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
333
+ });
334
+ return luvio.storeBroadcast().then(function () { return snapshot; });
335
+ }
336
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
337
+ var snapshot = ingestError$1(luvio, resourceParams, response, {
338
+ config: config,
339
+ resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
340
+ });
341
+ return luvio.storeBroadcast().then(function () { return snapshot; });
342
+ }
343
+ function buildNetworkSnapshot$1(luvio, config, options) {
344
+ var resourceParams = createResourceParams$1();
345
+ var request = createResourceRequest$1();
346
+ return luvio.dispatchResourceRequest(request, options)
347
+ .then(function (response) {
348
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess$1(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$1(luvio, resourceParams, response.body); });
349
+ }, function (response) {
350
+ return luvio.handleErrorResponse(function () { return onFetchResponseError$1(luvio, config, resourceParams, response); });
351
+ });
352
+ }
353
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
354
+ var luvio = context.luvio, config = context.config;
355
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
356
+ var dispatchOptions = {
357
+ resourceRequestContext: {
358
+ requestCorrelator: requestCorrelator,
359
+ luvioRequestMethod: undefined,
360
+ },
361
+ eventObservers: eventObservers
362
+ };
363
+ if (networkPriority !== 'normal') {
364
+ dispatchOptions.overrides = {
365
+ priority: networkPriority
366
+ };
367
+ }
368
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
369
+ }
370
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
371
+ var luvio = context.luvio, config = context.config;
372
+ var selector = {
373
+ recordId: keyBuilder$2(),
374
+ node: adapterFragment$1(),
375
+ variables: {},
376
+ };
377
+ var cacheSnapshot = storeLookup(selector, {
378
+ config: config,
379
+ resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
380
+ });
381
+ return cacheSnapshot;
382
+ }
383
+ var getProgramTemplatesAdapterFactory = function (luvio) { return function enablementProgram__getProgramTemplates(untrustedConfig, requestContext) {
384
+ var config = validateAdapterConfig$1(untrustedConfig, getProgramTemplates_ConfigPropertyNames);
385
+ // Invalid or incomplete config
386
+ if (config === null) {
387
+ return null;
388
+ }
389
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
390
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
391
+ }; };
392
+
393
+ var VERSION$2 = "d0d53cd500692d4a3a54a68f8fd5a349";
394
+ function validate$2(obj, path) {
395
+ if (path === void 0) { path = 'AbstractEnablementProgramTaskRepresentation'; }
396
+ var v_error = (function () {
397
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
398
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
399
+ }
400
+ var obj_contentType = obj.contentType;
401
+ var path_contentType = path + '.contentType';
402
+ var obj_contentType_union0 = null;
403
+ var obj_contentType_union0_error = (function () {
404
+ if (typeof obj_contentType !== 'string') {
405
+ return new TypeError('Expected "string" but received "' + typeof obj_contentType + '" (at "' + path_contentType + '")');
406
+ }
407
+ })();
408
+ if (obj_contentType_union0_error != null) {
409
+ obj_contentType_union0 = obj_contentType_union0_error.message;
410
+ }
411
+ var obj_contentType_union1 = null;
412
+ var obj_contentType_union1_error = (function () {
413
+ if (obj_contentType !== null) {
414
+ return new TypeError('Expected "null" but received "' + typeof obj_contentType + '" (at "' + path_contentType + '")');
415
+ }
416
+ })();
417
+ if (obj_contentType_union1_error != null) {
418
+ obj_contentType_union1 = obj_contentType_union1_error.message;
419
+ }
420
+ if (obj_contentType_union0 && obj_contentType_union1) {
421
+ var message = 'Object doesn\'t match union (at "' + path_contentType + '")';
422
+ message += '\n' + obj_contentType_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
423
+ message += '\n' + obj_contentType_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
424
+ return new TypeError(message);
425
+ }
426
+ var obj_description = obj.description;
427
+ var path_description = path + '.description';
428
+ if (typeof obj_description !== 'string') {
429
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
430
+ }
431
+ var obj_developerName = obj.developerName;
432
+ var path_developerName = path + '.developerName';
433
+ if (typeof obj_developerName !== 'string') {
434
+ return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
435
+ }
436
+ var obj_durationCount = obj.durationCount;
437
+ var path_durationCount = path + '.durationCount';
438
+ var obj_durationCount_union0 = null;
439
+ var obj_durationCount_union0_error = (function () {
440
+ if (typeof obj_durationCount !== 'number' || (typeof obj_durationCount === 'number' && Math.floor(obj_durationCount) !== obj_durationCount)) {
441
+ return new TypeError('Expected "integer" but received "' + typeof obj_durationCount + '" (at "' + path_durationCount + '")');
442
+ }
443
+ })();
444
+ if (obj_durationCount_union0_error != null) {
445
+ obj_durationCount_union0 = obj_durationCount_union0_error.message;
446
+ }
447
+ var obj_durationCount_union1 = null;
448
+ var obj_durationCount_union1_error = (function () {
449
+ if (obj_durationCount !== null) {
450
+ return new TypeError('Expected "null" but received "' + typeof obj_durationCount + '" (at "' + path_durationCount + '")');
451
+ }
452
+ })();
453
+ if (obj_durationCount_union1_error != null) {
454
+ obj_durationCount_union1 = obj_durationCount_union1_error.message;
455
+ }
456
+ if (obj_durationCount_union0 && obj_durationCount_union1) {
457
+ var message = 'Object doesn\'t match union (at "' + path_durationCount + '")';
458
+ message += '\n' + obj_durationCount_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
459
+ message += '\n' + obj_durationCount_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
460
+ return new TypeError(message);
461
+ }
462
+ var obj_enablementProgramSectionId = obj.enablementProgramSectionId;
463
+ var path_enablementProgramSectionId = path + '.enablementProgramSectionId';
464
+ var obj_enablementProgramSectionId_union0 = null;
465
+ var obj_enablementProgramSectionId_union0_error = (function () {
466
+ if (typeof obj_enablementProgramSectionId !== 'string') {
467
+ return new TypeError('Expected "string" but received "' + typeof obj_enablementProgramSectionId + '" (at "' + path_enablementProgramSectionId + '")');
468
+ }
469
+ })();
470
+ if (obj_enablementProgramSectionId_union0_error != null) {
471
+ obj_enablementProgramSectionId_union0 = obj_enablementProgramSectionId_union0_error.message;
472
+ }
473
+ var obj_enablementProgramSectionId_union1 = null;
474
+ var obj_enablementProgramSectionId_union1_error = (function () {
475
+ if (obj_enablementProgramSectionId !== null) {
476
+ return new TypeError('Expected "null" but received "' + typeof obj_enablementProgramSectionId + '" (at "' + path_enablementProgramSectionId + '")');
477
+ }
478
+ })();
479
+ if (obj_enablementProgramSectionId_union1_error != null) {
480
+ obj_enablementProgramSectionId_union1 = obj_enablementProgramSectionId_union1_error.message;
481
+ }
482
+ if (obj_enablementProgramSectionId_union0 && obj_enablementProgramSectionId_union1) {
483
+ var message = 'Object doesn\'t match union (at "' + path_enablementProgramSectionId + '")';
484
+ message += '\n' + obj_enablementProgramSectionId_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
485
+ message += '\n' + obj_enablementProgramSectionId_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
486
+ return new TypeError(message);
487
+ }
488
+ var obj_enablementRoomId = obj.enablementRoomId;
489
+ var path_enablementRoomId = path + '.enablementRoomId';
490
+ var obj_enablementRoomId_union0 = null;
491
+ var obj_enablementRoomId_union0_error = (function () {
492
+ if (typeof obj_enablementRoomId !== 'string') {
493
+ return new TypeError('Expected "string" but received "' + typeof obj_enablementRoomId + '" (at "' + path_enablementRoomId + '")');
494
+ }
495
+ })();
496
+ if (obj_enablementRoomId_union0_error != null) {
497
+ obj_enablementRoomId_union0 = obj_enablementRoomId_union0_error.message;
498
+ }
499
+ var obj_enablementRoomId_union1 = null;
500
+ var obj_enablementRoomId_union1_error = (function () {
501
+ if (obj_enablementRoomId !== null) {
502
+ return new TypeError('Expected "null" but received "' + typeof obj_enablementRoomId + '" (at "' + path_enablementRoomId + '")');
503
+ }
504
+ })();
505
+ if (obj_enablementRoomId_union1_error != null) {
506
+ obj_enablementRoomId_union1 = obj_enablementRoomId_union1_error.message;
507
+ }
508
+ if (obj_enablementRoomId_union0 && obj_enablementRoomId_union1) {
509
+ var message = 'Object doesn\'t match union (at "' + path_enablementRoomId + '")';
510
+ message += '\n' + obj_enablementRoomId_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
511
+ message += '\n' + obj_enablementRoomId_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
512
+ return new TypeError(message);
513
+ }
514
+ var obj_id = obj.id;
515
+ var path_id = path + '.id';
516
+ var obj_id_union0 = null;
517
+ var obj_id_union0_error = (function () {
518
+ if (typeof obj_id !== 'string') {
519
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
520
+ }
521
+ })();
522
+ if (obj_id_union0_error != null) {
523
+ obj_id_union0 = obj_id_union0_error.message;
524
+ }
525
+ var obj_id_union1 = null;
526
+ var obj_id_union1_error = (function () {
527
+ if (obj_id !== null) {
528
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
529
+ }
530
+ })();
531
+ if (obj_id_union1_error != null) {
532
+ obj_id_union1 = obj_id_union1_error.message;
533
+ }
534
+ if (obj_id_union0 && obj_id_union1) {
535
+ var message = 'Object doesn\'t match union (at "' + path_id + '")';
536
+ message += '\n' + obj_id_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
537
+ message += '\n' + obj_id_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
538
+ return new TypeError(message);
539
+ }
540
+ var obj_isMilestoneAnOutcome = obj.isMilestoneAnOutcome;
541
+ var path_isMilestoneAnOutcome = path + '.isMilestoneAnOutcome';
542
+ var obj_isMilestoneAnOutcome_union0 = null;
543
+ var obj_isMilestoneAnOutcome_union0_error = (function () {
544
+ if (typeof obj_isMilestoneAnOutcome !== 'boolean') {
545
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isMilestoneAnOutcome + '" (at "' + path_isMilestoneAnOutcome + '")');
546
+ }
547
+ })();
548
+ if (obj_isMilestoneAnOutcome_union0_error != null) {
549
+ obj_isMilestoneAnOutcome_union0 = obj_isMilestoneAnOutcome_union0_error.message;
550
+ }
551
+ var obj_isMilestoneAnOutcome_union1 = null;
552
+ var obj_isMilestoneAnOutcome_union1_error = (function () {
553
+ if (obj_isMilestoneAnOutcome !== null) {
554
+ return new TypeError('Expected "null" but received "' + typeof obj_isMilestoneAnOutcome + '" (at "' + path_isMilestoneAnOutcome + '")');
555
+ }
556
+ })();
557
+ if (obj_isMilestoneAnOutcome_union1_error != null) {
558
+ obj_isMilestoneAnOutcome_union1 = obj_isMilestoneAnOutcome_union1_error.message;
559
+ }
560
+ if (obj_isMilestoneAnOutcome_union0 && obj_isMilestoneAnOutcome_union1) {
561
+ var message = 'Object doesn\'t match union (at "' + path_isMilestoneAnOutcome + '")';
562
+ message += '\n' + obj_isMilestoneAnOutcome_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
563
+ message += '\n' + obj_isMilestoneAnOutcome_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
564
+ return new TypeError(message);
565
+ }
566
+ var obj_learningItemDescription = obj.learningItemDescription;
567
+ var path_learningItemDescription = path + '.learningItemDescription';
568
+ var obj_learningItemDescription_union0 = null;
569
+ var obj_learningItemDescription_union0_error = (function () {
570
+ if (typeof obj_learningItemDescription !== 'string') {
571
+ return new TypeError('Expected "string" but received "' + typeof obj_learningItemDescription + '" (at "' + path_learningItemDescription + '")');
572
+ }
573
+ })();
574
+ if (obj_learningItemDescription_union0_error != null) {
575
+ obj_learningItemDescription_union0 = obj_learningItemDescription_union0_error.message;
576
+ }
577
+ var obj_learningItemDescription_union1 = null;
578
+ var obj_learningItemDescription_union1_error = (function () {
579
+ if (obj_learningItemDescription !== null) {
580
+ return new TypeError('Expected "null" but received "' + typeof obj_learningItemDescription + '" (at "' + path_learningItemDescription + '")');
581
+ }
582
+ })();
583
+ if (obj_learningItemDescription_union1_error != null) {
584
+ obj_learningItemDescription_union1 = obj_learningItemDescription_union1_error.message;
585
+ }
586
+ if (obj_learningItemDescription_union0 && obj_learningItemDescription_union1) {
587
+ var message = 'Object doesn\'t match union (at "' + path_learningItemDescription + '")';
588
+ message += '\n' + obj_learningItemDescription_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
589
+ message += '\n' + obj_learningItemDescription_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
590
+ return new TypeError(message);
591
+ }
592
+ var obj_learningItemIconUrl = obj.learningItemIconUrl;
593
+ var path_learningItemIconUrl = path + '.learningItemIconUrl';
594
+ var obj_learningItemIconUrl_union0 = null;
595
+ var obj_learningItemIconUrl_union0_error = (function () {
596
+ if (typeof obj_learningItemIconUrl !== 'string') {
597
+ return new TypeError('Expected "string" but received "' + typeof obj_learningItemIconUrl + '" (at "' + path_learningItemIconUrl + '")');
598
+ }
599
+ })();
600
+ if (obj_learningItemIconUrl_union0_error != null) {
601
+ obj_learningItemIconUrl_union0 = obj_learningItemIconUrl_union0_error.message;
602
+ }
603
+ var obj_learningItemIconUrl_union1 = null;
604
+ var obj_learningItemIconUrl_union1_error = (function () {
605
+ if (obj_learningItemIconUrl !== null) {
606
+ return new TypeError('Expected "null" but received "' + typeof obj_learningItemIconUrl + '" (at "' + path_learningItemIconUrl + '")');
607
+ }
608
+ })();
609
+ if (obj_learningItemIconUrl_union1_error != null) {
610
+ obj_learningItemIconUrl_union1 = obj_learningItemIconUrl_union1_error.message;
611
+ }
612
+ if (obj_learningItemIconUrl_union0 && obj_learningItemIconUrl_union1) {
613
+ var message = 'Object doesn\'t match union (at "' + path_learningItemIconUrl + '")';
614
+ message += '\n' + obj_learningItemIconUrl_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
615
+ message += '\n' + obj_learningItemIconUrl_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
616
+ return new TypeError(message);
617
+ }
618
+ var obj_learningItemId = obj.learningItemId;
619
+ var path_learningItemId = path + '.learningItemId';
620
+ var obj_learningItemId_union0 = null;
621
+ var obj_learningItemId_union0_error = (function () {
622
+ if (typeof obj_learningItemId !== 'string') {
623
+ return new TypeError('Expected "string" but received "' + typeof obj_learningItemId + '" (at "' + path_learningItemId + '")');
624
+ }
625
+ })();
626
+ if (obj_learningItemId_union0_error != null) {
627
+ obj_learningItemId_union0 = obj_learningItemId_union0_error.message;
628
+ }
629
+ var obj_learningItemId_union1 = null;
630
+ var obj_learningItemId_union1_error = (function () {
631
+ if (obj_learningItemId !== null) {
632
+ return new TypeError('Expected "null" but received "' + typeof obj_learningItemId + '" (at "' + path_learningItemId + '")');
633
+ }
634
+ })();
635
+ if (obj_learningItemId_union1_error != null) {
636
+ obj_learningItemId_union1 = obj_learningItemId_union1_error.message;
637
+ }
638
+ if (obj_learningItemId_union0 && obj_learningItemId_union1) {
639
+ var message = 'Object doesn\'t match union (at "' + path_learningItemId + '")';
640
+ message += '\n' + obj_learningItemId_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
641
+ message += '\n' + obj_learningItemId_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
642
+ return new TypeError(message);
643
+ }
644
+ var obj_learningItemRelatedContentId = obj.learningItemRelatedContentId;
645
+ var path_learningItemRelatedContentId = path + '.learningItemRelatedContentId';
646
+ var obj_learningItemRelatedContentId_union0 = null;
647
+ var obj_learningItemRelatedContentId_union0_error = (function () {
648
+ if (typeof obj_learningItemRelatedContentId !== 'string') {
649
+ return new TypeError('Expected "string" but received "' + typeof obj_learningItemRelatedContentId + '" (at "' + path_learningItemRelatedContentId + '")');
650
+ }
651
+ })();
652
+ if (obj_learningItemRelatedContentId_union0_error != null) {
653
+ obj_learningItemRelatedContentId_union0 = obj_learningItemRelatedContentId_union0_error.message;
654
+ }
655
+ var obj_learningItemRelatedContentId_union1 = null;
656
+ var obj_learningItemRelatedContentId_union1_error = (function () {
657
+ if (obj_learningItemRelatedContentId !== null) {
658
+ return new TypeError('Expected "null" but received "' + typeof obj_learningItemRelatedContentId + '" (at "' + path_learningItemRelatedContentId + '")');
659
+ }
660
+ })();
661
+ if (obj_learningItemRelatedContentId_union1_error != null) {
662
+ obj_learningItemRelatedContentId_union1 = obj_learningItemRelatedContentId_union1_error.message;
663
+ }
664
+ if (obj_learningItemRelatedContentId_union0 && obj_learningItemRelatedContentId_union1) {
665
+ var message = 'Object doesn\'t match union (at "' + path_learningItemRelatedContentId + '")';
666
+ message += '\n' + obj_learningItemRelatedContentId_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
667
+ message += '\n' + obj_learningItemRelatedContentId_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
668
+ return new TypeError(message);
669
+ }
670
+ var obj_learningItemTitle = obj.learningItemTitle;
671
+ var path_learningItemTitle = path + '.learningItemTitle';
672
+ var obj_learningItemTitle_union0 = null;
673
+ var obj_learningItemTitle_union0_error = (function () {
674
+ if (typeof obj_learningItemTitle !== 'string') {
675
+ return new TypeError('Expected "string" but received "' + typeof obj_learningItemTitle + '" (at "' + path_learningItemTitle + '")');
676
+ }
677
+ })();
678
+ if (obj_learningItemTitle_union0_error != null) {
679
+ obj_learningItemTitle_union0 = obj_learningItemTitle_union0_error.message;
680
+ }
681
+ var obj_learningItemTitle_union1 = null;
682
+ var obj_learningItemTitle_union1_error = (function () {
683
+ if (obj_learningItemTitle !== null) {
684
+ return new TypeError('Expected "null" but received "' + typeof obj_learningItemTitle + '" (at "' + path_learningItemTitle + '")');
685
+ }
686
+ })();
687
+ if (obj_learningItemTitle_union1_error != null) {
688
+ obj_learningItemTitle_union1 = obj_learningItemTitle_union1_error.message;
689
+ }
690
+ if (obj_learningItemTitle_union0 && obj_learningItemTitle_union1) {
691
+ var message = 'Object doesn\'t match union (at "' + path_learningItemTitle + '")';
692
+ message += '\n' + obj_learningItemTitle_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
693
+ message += '\n' + obj_learningItemTitle_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
694
+ return new TypeError(message);
695
+ }
696
+ var obj_learningItemUrl = obj.learningItemUrl;
697
+ var path_learningItemUrl = path + '.learningItemUrl';
698
+ var obj_learningItemUrl_union0 = null;
699
+ var obj_learningItemUrl_union0_error = (function () {
700
+ if (typeof obj_learningItemUrl !== 'string') {
701
+ return new TypeError('Expected "string" but received "' + typeof obj_learningItemUrl + '" (at "' + path_learningItemUrl + '")');
702
+ }
703
+ })();
704
+ if (obj_learningItemUrl_union0_error != null) {
705
+ obj_learningItemUrl_union0 = obj_learningItemUrl_union0_error.message;
706
+ }
707
+ var obj_learningItemUrl_union1 = null;
708
+ var obj_learningItemUrl_union1_error = (function () {
709
+ if (obj_learningItemUrl !== null) {
710
+ return new TypeError('Expected "null" but received "' + typeof obj_learningItemUrl + '" (at "' + path_learningItemUrl + '")');
711
+ }
712
+ })();
713
+ if (obj_learningItemUrl_union1_error != null) {
714
+ obj_learningItemUrl_union1 = obj_learningItemUrl_union1_error.message;
715
+ }
716
+ if (obj_learningItemUrl_union0 && obj_learningItemUrl_union1) {
717
+ var message = 'Object doesn\'t match union (at "' + path_learningItemUrl + '")';
718
+ message += '\n' + obj_learningItemUrl_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
719
+ message += '\n' + obj_learningItemUrl_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
720
+ return new TypeError(message);
721
+ }
722
+ var obj_measureId = obj.measureId;
723
+ var path_measureId = path + '.measureId';
724
+ var obj_measureId_union0 = null;
725
+ var obj_measureId_union0_error = (function () {
726
+ if (typeof obj_measureId !== 'string') {
727
+ return new TypeError('Expected "string" but received "' + typeof obj_measureId + '" (at "' + path_measureId + '")');
728
+ }
729
+ })();
730
+ if (obj_measureId_union0_error != null) {
731
+ obj_measureId_union0 = obj_measureId_union0_error.message;
732
+ }
733
+ var obj_measureId_union1 = null;
734
+ var obj_measureId_union1_error = (function () {
735
+ if (obj_measureId !== null) {
736
+ return new TypeError('Expected "null" but received "' + typeof obj_measureId + '" (at "' + path_measureId + '")');
737
+ }
738
+ })();
739
+ if (obj_measureId_union1_error != null) {
740
+ obj_measureId_union1 = obj_measureId_union1_error.message;
741
+ }
742
+ if (obj_measureId_union0 && obj_measureId_union1) {
743
+ var message = 'Object doesn\'t match union (at "' + path_measureId + '")';
744
+ message += '\n' + obj_measureId_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
745
+ message += '\n' + obj_measureId_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
746
+ return new TypeError(message);
747
+ }
748
+ obj.milestoneTarget;
749
+ var obj_minimumSampleSize = obj.minimumSampleSize;
750
+ var path_minimumSampleSize = path + '.minimumSampleSize';
751
+ var obj_minimumSampleSize_union0 = null;
752
+ var obj_minimumSampleSize_union0_error = (function () {
753
+ if (typeof obj_minimumSampleSize !== 'number' || (typeof obj_minimumSampleSize === 'number' && Math.floor(obj_minimumSampleSize) !== obj_minimumSampleSize)) {
754
+ return new TypeError('Expected "integer" but received "' + typeof obj_minimumSampleSize + '" (at "' + path_minimumSampleSize + '")');
755
+ }
756
+ })();
757
+ if (obj_minimumSampleSize_union0_error != null) {
758
+ obj_minimumSampleSize_union0 = obj_minimumSampleSize_union0_error.message;
759
+ }
760
+ var obj_minimumSampleSize_union1 = null;
761
+ var obj_minimumSampleSize_union1_error = (function () {
762
+ if (obj_minimumSampleSize !== null) {
763
+ return new TypeError('Expected "null" but received "' + typeof obj_minimumSampleSize + '" (at "' + path_minimumSampleSize + '")');
764
+ }
765
+ })();
766
+ if (obj_minimumSampleSize_union1_error != null) {
767
+ obj_minimumSampleSize_union1 = obj_minimumSampleSize_union1_error.message;
768
+ }
769
+ if (obj_minimumSampleSize_union0 && obj_minimumSampleSize_union1) {
770
+ var message = 'Object doesn\'t match union (at "' + path_minimumSampleSize + '")';
771
+ message += '\n' + obj_minimumSampleSize_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
772
+ message += '\n' + obj_minimumSampleSize_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
773
+ return new TypeError(message);
774
+ }
775
+ var obj_name = obj.name;
776
+ var path_name = path + '.name';
777
+ if (typeof obj_name !== 'string') {
778
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
779
+ }
780
+ var obj_programDay = obj.programDay;
781
+ var path_programDay = path + '.programDay';
782
+ if (typeof obj_programDay !== 'number' || (typeof obj_programDay === 'number' && Math.floor(obj_programDay) !== obj_programDay)) {
783
+ return new TypeError('Expected "integer" but received "' + typeof obj_programDay + '" (at "' + path_programDay + '")');
784
+ }
785
+ var obj_sequenceNumber = obj.sequenceNumber;
786
+ var path_sequenceNumber = path + '.sequenceNumber';
787
+ if (typeof obj_sequenceNumber !== 'number' || (typeof obj_sequenceNumber === 'number' && Math.floor(obj_sequenceNumber) !== obj_sequenceNumber)) {
788
+ return new TypeError('Expected "integer" but received "' + typeof obj_sequenceNumber + '" (at "' + path_sequenceNumber + '")');
789
+ }
790
+ var obj_taskCategory = obj.taskCategory;
791
+ var path_taskCategory = path + '.taskCategory';
792
+ if (typeof obj_taskCategory !== 'string') {
793
+ return new TypeError('Expected "string" but received "' + typeof obj_taskCategory + '" (at "' + path_taskCategory + '")');
794
+ }
795
+ var obj_taskSubCategory = obj.taskSubCategory;
796
+ var path_taskSubCategory = path + '.taskSubCategory';
797
+ if (typeof obj_taskSubCategory !== 'string') {
798
+ return new TypeError('Expected "string" but received "' + typeof obj_taskSubCategory + '" (at "' + path_taskSubCategory + '")');
799
+ }
800
+ var obj_warnings = obj.warnings;
801
+ var path_warnings = path + '.warnings';
802
+ if (obj_warnings === undefined) {
803
+ return new TypeError('Expected "defined" but received "' + typeof obj_warnings + '" (at "' + path_warnings + '")');
804
+ }
805
+ })();
806
+ return v_error === undefined ? null : v_error;
807
+ }
808
+ var select$3 = function AbstractEnablementProgramTaskRepresentationSelect() {
809
+ return {
810
+ kind: 'Fragment',
811
+ version: VERSION$2,
812
+ private: [],
813
+ selections: [
814
+ {
815
+ name: 'contentType',
816
+ kind: 'Scalar'
817
+ },
818
+ {
819
+ name: 'description',
820
+ kind: 'Scalar'
821
+ },
822
+ {
823
+ name: 'developerName',
824
+ kind: 'Scalar'
825
+ },
826
+ {
827
+ name: 'durationCount',
828
+ kind: 'Scalar'
829
+ },
830
+ {
831
+ name: 'enablementProgramSectionId',
832
+ kind: 'Scalar'
833
+ },
834
+ {
835
+ name: 'enablementRoomId',
836
+ kind: 'Scalar'
837
+ },
838
+ {
839
+ name: 'id',
840
+ kind: 'Scalar'
841
+ },
842
+ {
843
+ name: 'isMilestoneAnOutcome',
844
+ kind: 'Scalar'
845
+ },
846
+ {
847
+ name: 'learningItemDescription',
848
+ kind: 'Scalar'
849
+ },
850
+ {
851
+ name: 'learningItemIconUrl',
852
+ kind: 'Scalar'
853
+ },
854
+ {
855
+ name: 'learningItemId',
856
+ kind: 'Scalar'
857
+ },
858
+ {
859
+ name: 'learningItemRelatedContentId',
860
+ kind: 'Scalar'
861
+ },
862
+ {
863
+ name: 'learningItemTitle',
864
+ kind: 'Scalar'
865
+ },
866
+ {
867
+ name: 'learningItemUrl',
868
+ kind: 'Scalar'
869
+ },
870
+ {
871
+ name: 'measureId',
872
+ kind: 'Scalar'
873
+ },
874
+ {
875
+ name: 'milestoneTarget',
876
+ kind: 'Scalar'
877
+ },
878
+ {
879
+ name: 'minimumSampleSize',
880
+ kind: 'Scalar'
881
+ },
882
+ {
883
+ name: 'name',
884
+ kind: 'Scalar'
885
+ },
886
+ {
887
+ name: 'programDay',
888
+ kind: 'Scalar'
889
+ },
890
+ {
891
+ name: 'sequenceNumber',
892
+ kind: 'Scalar'
893
+ },
894
+ {
895
+ name: 'taskCategory',
896
+ kind: 'Scalar'
897
+ },
898
+ {
899
+ name: 'taskSubCategory',
900
+ kind: 'Scalar'
901
+ },
902
+ {
903
+ name: 'warnings',
904
+ kind: 'Object',
905
+ // any
906
+ }
907
+ ]
908
+ };
909
+ };
910
+ function equals$2(existing, incoming) {
911
+ var existing_programDay = existing.programDay;
912
+ var incoming_programDay = incoming.programDay;
913
+ if (!(existing_programDay === incoming_programDay)) {
914
+ return false;
915
+ }
916
+ var existing_sequenceNumber = existing.sequenceNumber;
917
+ var incoming_sequenceNumber = incoming.sequenceNumber;
918
+ if (!(existing_sequenceNumber === incoming_sequenceNumber)) {
919
+ return false;
920
+ }
921
+ var existing_description = existing.description;
922
+ var incoming_description = incoming.description;
923
+ if (!(existing_description === incoming_description)) {
924
+ return false;
925
+ }
926
+ var existing_developerName = existing.developerName;
927
+ var incoming_developerName = incoming.developerName;
928
+ if (!(existing_developerName === incoming_developerName)) {
929
+ return false;
930
+ }
931
+ var existing_name = existing.name;
932
+ var incoming_name = incoming.name;
933
+ if (!(existing_name === incoming_name)) {
934
+ return false;
935
+ }
936
+ var existing_taskCategory = existing.taskCategory;
937
+ var incoming_taskCategory = incoming.taskCategory;
938
+ if (!(existing_taskCategory === incoming_taskCategory)) {
939
+ return false;
940
+ }
941
+ var existing_taskSubCategory = existing.taskSubCategory;
942
+ var incoming_taskSubCategory = incoming.taskSubCategory;
943
+ if (!(existing_taskSubCategory === incoming_taskSubCategory)) {
944
+ return false;
945
+ }
946
+ var existing_milestoneTarget = existing.milestoneTarget;
947
+ var incoming_milestoneTarget = incoming.milestoneTarget;
948
+ if (!(existing_milestoneTarget === incoming_milestoneTarget)) {
949
+ return false;
950
+ }
951
+ var existing_contentType = existing.contentType;
952
+ var incoming_contentType = incoming.contentType;
953
+ if (!(existing_contentType === incoming_contentType)) {
954
+ return false;
955
+ }
956
+ var existing_durationCount = existing.durationCount;
957
+ var incoming_durationCount = incoming.durationCount;
958
+ if (!(existing_durationCount === incoming_durationCount)) {
959
+ return false;
960
+ }
961
+ var existing_enablementProgramSectionId = existing.enablementProgramSectionId;
962
+ var incoming_enablementProgramSectionId = incoming.enablementProgramSectionId;
963
+ if (!(existing_enablementProgramSectionId === incoming_enablementProgramSectionId)) {
964
+ return false;
965
+ }
966
+ var existing_enablementRoomId = existing.enablementRoomId;
967
+ var incoming_enablementRoomId = incoming.enablementRoomId;
968
+ if (!(existing_enablementRoomId === incoming_enablementRoomId)) {
969
+ return false;
970
+ }
971
+ var existing_id = existing.id;
972
+ var incoming_id = incoming.id;
973
+ if (!(existing_id === incoming_id)) {
974
+ return false;
975
+ }
976
+ var existing_isMilestoneAnOutcome = existing.isMilestoneAnOutcome;
977
+ var incoming_isMilestoneAnOutcome = incoming.isMilestoneAnOutcome;
978
+ if (!(existing_isMilestoneAnOutcome === incoming_isMilestoneAnOutcome)) {
979
+ return false;
980
+ }
981
+ var existing_learningItemDescription = existing.learningItemDescription;
982
+ var incoming_learningItemDescription = incoming.learningItemDescription;
983
+ if (!(existing_learningItemDescription === incoming_learningItemDescription)) {
984
+ return false;
985
+ }
986
+ var existing_learningItemIconUrl = existing.learningItemIconUrl;
987
+ var incoming_learningItemIconUrl = incoming.learningItemIconUrl;
988
+ if (!(existing_learningItemIconUrl === incoming_learningItemIconUrl)) {
989
+ return false;
990
+ }
991
+ var existing_learningItemId = existing.learningItemId;
992
+ var incoming_learningItemId = incoming.learningItemId;
993
+ if (!(existing_learningItemId === incoming_learningItemId)) {
994
+ return false;
995
+ }
996
+ var existing_learningItemRelatedContentId = existing.learningItemRelatedContentId;
997
+ var incoming_learningItemRelatedContentId = incoming.learningItemRelatedContentId;
998
+ if (!(existing_learningItemRelatedContentId === incoming_learningItemRelatedContentId)) {
999
+ return false;
1000
+ }
1001
+ var existing_learningItemTitle = existing.learningItemTitle;
1002
+ var incoming_learningItemTitle = incoming.learningItemTitle;
1003
+ if (!(existing_learningItemTitle === incoming_learningItemTitle)) {
1004
+ return false;
1005
+ }
1006
+ var existing_learningItemUrl = existing.learningItemUrl;
1007
+ var incoming_learningItemUrl = incoming.learningItemUrl;
1008
+ if (!(existing_learningItemUrl === incoming_learningItemUrl)) {
1009
+ return false;
1010
+ }
1011
+ var existing_measureId = existing.measureId;
1012
+ var incoming_measureId = incoming.measureId;
1013
+ if (!(existing_measureId === incoming_measureId)) {
1014
+ return false;
1015
+ }
1016
+ var existing_minimumSampleSize = existing.minimumSampleSize;
1017
+ var incoming_minimumSampleSize = incoming.minimumSampleSize;
1018
+ if (!(existing_minimumSampleSize === incoming_minimumSampleSize)) {
1019
+ return false;
1020
+ }
1021
+ var existing_warnings = existing.warnings;
1022
+ var incoming_warnings = incoming.warnings;
1023
+ if (JSONStringify(incoming_warnings) !== JSONStringify(existing_warnings)) {
1024
+ return false;
1025
+ }
1026
+ return true;
1027
+ }
1028
+
1029
+ var VERSION$1 = "1a04a332b32cf015d23bb89ffcca76e9";
1030
+ function validate$1(obj, path) {
1031
+ if (path === void 0) { path = 'EnablementProgramSectionRepresentation'; }
1032
+ var v_error = (function () {
1033
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1034
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1035
+ }
1036
+ var obj_description = obj.description;
1037
+ var path_description = path + '.description';
1038
+ var obj_description_union0 = null;
1039
+ var obj_description_union0_error = (function () {
1040
+ if (typeof obj_description !== 'string') {
1041
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
1042
+ }
1043
+ })();
1044
+ if (obj_description_union0_error != null) {
1045
+ obj_description_union0 = obj_description_union0_error.message;
1046
+ }
1047
+ var obj_description_union1 = null;
1048
+ var obj_description_union1_error = (function () {
1049
+ if (obj_description !== null) {
1050
+ return new TypeError('Expected "null" but received "' + typeof obj_description + '" (at "' + path_description + '")');
1051
+ }
1052
+ })();
1053
+ if (obj_description_union1_error != null) {
1054
+ obj_description_union1 = obj_description_union1_error.message;
1055
+ }
1056
+ if (obj_description_union0 && obj_description_union1) {
1057
+ var message = 'Object doesn\'t match union (at "' + path_description + '")';
1058
+ message += '\n' + obj_description_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1059
+ message += '\n' + obj_description_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1060
+ return new TypeError(message);
1061
+ }
1062
+ var obj_id = obj.id;
1063
+ var path_id = path + '.id';
1064
+ var obj_id_union0 = null;
1065
+ var obj_id_union0_error = (function () {
1066
+ if (typeof obj_id !== 'string') {
1067
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1068
+ }
1069
+ })();
1070
+ if (obj_id_union0_error != null) {
1071
+ obj_id_union0 = obj_id_union0_error.message;
1072
+ }
1073
+ var obj_id_union1 = null;
1074
+ var obj_id_union1_error = (function () {
1075
+ if (obj_id !== null) {
1076
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1077
+ }
1078
+ })();
1079
+ if (obj_id_union1_error != null) {
1080
+ obj_id_union1 = obj_id_union1_error.message;
1081
+ }
1082
+ if (obj_id_union0 && obj_id_union1) {
1083
+ var message = 'Object doesn\'t match union (at "' + path_id + '")';
1084
+ message += '\n' + obj_id_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1085
+ message += '\n' + obj_id_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1086
+ return new TypeError(message);
1087
+ }
1088
+ var obj_name = obj.name;
1089
+ var path_name = path + '.name';
1090
+ if (typeof obj_name !== 'string') {
1091
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
1092
+ }
1093
+ var obj_sequenceNumber = obj.sequenceNumber;
1094
+ var path_sequenceNumber = path + '.sequenceNumber';
1095
+ if (typeof obj_sequenceNumber !== 'number' || (typeof obj_sequenceNumber === 'number' && Math.floor(obj_sequenceNumber) !== obj_sequenceNumber)) {
1096
+ return new TypeError('Expected "integer" but received "' + typeof obj_sequenceNumber + '" (at "' + path_sequenceNumber + '")');
1097
+ }
1098
+ var obj_tasks = obj.tasks;
1099
+ var path_tasks = path + '.tasks';
1100
+ if (!ArrayIsArray(obj_tasks)) {
1101
+ return new TypeError('Expected "array" but received "' + typeof obj_tasks + '" (at "' + path_tasks + '")');
1102
+ }
1103
+ for (var i = 0; i < obj_tasks.length; i++) {
1104
+ var obj_tasks_item = obj_tasks[i];
1105
+ var path_tasks_item = path_tasks + '[' + i + ']';
1106
+ var referencepath_tasks_itemValidationError = validate$2(obj_tasks_item, path_tasks_item);
1107
+ if (referencepath_tasks_itemValidationError !== null) {
1108
+ var message = 'Object doesn\'t match AbstractEnablementProgramTaskRepresentation (at "' + path_tasks_item + '")\n';
1109
+ message += referencepath_tasks_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1110
+ return new TypeError(message);
1111
+ }
1112
+ }
1113
+ })();
1114
+ return v_error === undefined ? null : v_error;
1115
+ }
1116
+ var select$2 = function EnablementProgramSectionRepresentationSelect() {
1117
+ var _a = select$3(), AbstractEnablementProgramTaskRepresentation__selections = _a.selections;
1118
+ return {
1119
+ kind: 'Fragment',
1120
+ version: VERSION$1,
1121
+ private: [],
1122
+ selections: [
1123
+ {
1124
+ name: 'description',
1125
+ kind: 'Scalar'
1126
+ },
1127
+ {
1128
+ name: 'id',
1129
+ kind: 'Scalar'
1130
+ },
1131
+ {
1132
+ name: 'name',
1133
+ kind: 'Scalar'
1134
+ },
1135
+ {
1136
+ name: 'sequenceNumber',
1137
+ kind: 'Scalar'
1138
+ },
1139
+ {
1140
+ name: 'tasks',
1141
+ kind: 'Object',
1142
+ plural: true,
1143
+ selections: AbstractEnablementProgramTaskRepresentation__selections
1144
+ }
1145
+ ]
1146
+ };
1147
+ };
1148
+ function equals$1(existing, incoming) {
1149
+ var existing_sequenceNumber = existing.sequenceNumber;
1150
+ var incoming_sequenceNumber = incoming.sequenceNumber;
1151
+ if (!(existing_sequenceNumber === incoming_sequenceNumber)) {
1152
+ return false;
1153
+ }
1154
+ var existing_name = existing.name;
1155
+ var incoming_name = incoming.name;
1156
+ if (!(existing_name === incoming_name)) {
1157
+ return false;
1158
+ }
1159
+ var existing_description = existing.description;
1160
+ var incoming_description = incoming.description;
1161
+ if (!(existing_description === incoming_description)) {
1162
+ return false;
1163
+ }
1164
+ var existing_id = existing.id;
1165
+ var incoming_id = incoming.id;
1166
+ if (!(existing_id === incoming_id)) {
1167
+ return false;
1168
+ }
1169
+ var existing_tasks = existing.tasks;
1170
+ var incoming_tasks = incoming.tasks;
1171
+ var equals_tasks_items = equalsArray(existing_tasks, incoming_tasks, function (existing_tasks_item, incoming_tasks_item) {
1172
+ if (!(equals$2(existing_tasks_item, incoming_tasks_item))) {
1173
+ return false;
1174
+ }
1175
+ });
1176
+ if (equals_tasks_items === false) {
1177
+ return false;
1178
+ }
1179
+ return true;
1180
+ }
1181
+
1182
+ var TTL = 604800000;
1183
+ var VERSION = "f9ce8118e1ad936cda186804d38b9037";
1184
+ function validate(obj, path) {
1185
+ if (path === void 0) { path = 'EnablementProgramRepresentation'; }
1186
+ var v_error = (function () {
1187
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1188
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1189
+ }
1190
+ var obj_description = obj.description;
1191
+ var path_description = path + '.description';
1192
+ if (typeof obj_description !== 'string') {
1193
+ return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
1194
+ }
1195
+ var obj_id = obj.id;
1196
+ var path_id = path + '.id';
1197
+ var obj_id_union0 = null;
1198
+ var obj_id_union0_error = (function () {
1199
+ if (typeof obj_id !== 'string') {
1200
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1201
+ }
1202
+ })();
1203
+ if (obj_id_union0_error != null) {
1204
+ obj_id_union0 = obj_id_union0_error.message;
1205
+ }
1206
+ var obj_id_union1 = null;
1207
+ var obj_id_union1_error = (function () {
1208
+ if (obj_id !== null) {
1209
+ return new TypeError('Expected "null" but received "' + typeof obj_id + '" (at "' + path_id + '")');
1210
+ }
1211
+ })();
1212
+ if (obj_id_union1_error != null) {
1213
+ obj_id_union1 = obj_id_union1_error.message;
1214
+ }
1215
+ if (obj_id_union0 && obj_id_union1) {
1216
+ var message = 'Object doesn\'t match union (at "' + path_id + '")';
1217
+ message += '\n' + obj_id_union0.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1218
+ message += '\n' + obj_id_union1.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1219
+ return new TypeError(message);
1220
+ }
1221
+ var obj_isOutcomeBased = obj.isOutcomeBased;
1222
+ var path_isOutcomeBased = path + '.isOutcomeBased';
1223
+ if (typeof obj_isOutcomeBased !== 'boolean') {
1224
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isOutcomeBased + '" (at "' + path_isOutcomeBased + '")');
1225
+ }
1226
+ var obj_isTemplate = obj.isTemplate;
1227
+ var path_isTemplate = path + '.isTemplate';
1228
+ if (typeof obj_isTemplate !== 'boolean') {
1229
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isTemplate + '" (at "' + path_isTemplate + '")');
1230
+ }
1231
+ var obj_name = obj.name;
1232
+ var path_name = path + '.name';
1233
+ if (typeof obj_name !== 'string') {
1234
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
1235
+ }
1236
+ var obj_sections = obj.sections;
1237
+ var path_sections = path + '.sections';
1238
+ if (!ArrayIsArray(obj_sections)) {
1239
+ return new TypeError('Expected "array" but received "' + typeof obj_sections + '" (at "' + path_sections + '")');
1240
+ }
1241
+ for (var i = 0; i < obj_sections.length; i++) {
1242
+ var obj_sections_item = obj_sections[i];
1243
+ var path_sections_item = path_sections + '[' + i + ']';
1244
+ var referencepath_sections_itemValidationError = validate$1(obj_sections_item, path_sections_item);
1245
+ if (referencepath_sections_itemValidationError !== null) {
1246
+ var message = 'Object doesn\'t match EnablementProgramSectionRepresentation (at "' + path_sections_item + '")\n';
1247
+ message += referencepath_sections_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1248
+ return new TypeError(message);
1249
+ }
1250
+ }
1251
+ var obj_status = obj.status;
1252
+ var path_status = path + '.status';
1253
+ if (typeof obj_status !== 'string') {
1254
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
1255
+ }
1256
+ var obj_systemModStamp = obj.systemModStamp;
1257
+ var path_systemModStamp = path + '.systemModStamp';
1258
+ if (typeof obj_systemModStamp !== 'string') {
1259
+ return new TypeError('Expected "string" but received "' + typeof obj_systemModStamp + '" (at "' + path_systemModStamp + '")');
1260
+ }
1261
+ var obj_tasks = obj.tasks;
1262
+ var path_tasks = path + '.tasks';
1263
+ if (!ArrayIsArray(obj_tasks)) {
1264
+ return new TypeError('Expected "array" but received "' + typeof obj_tasks + '" (at "' + path_tasks + '")');
1265
+ }
1266
+ for (var i = 0; i < obj_tasks.length; i++) {
1267
+ var obj_tasks_item = obj_tasks[i];
1268
+ var path_tasks_item = path_tasks + '[' + i + ']';
1269
+ var referencepath_tasks_itemValidationError = validate$2(obj_tasks_item, path_tasks_item);
1270
+ if (referencepath_tasks_itemValidationError !== null) {
1271
+ var message = 'Object doesn\'t match AbstractEnablementProgramTaskRepresentation (at "' + path_tasks_item + '")\n';
1272
+ message += referencepath_tasks_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1273
+ return new TypeError(message);
1274
+ }
1275
+ }
1276
+ })();
1277
+ return v_error === undefined ? null : v_error;
1278
+ }
1279
+ var RepresentationType = 'EnablementProgramRepresentation';
1280
+ function normalize(input, existing, path, luvio, store, timestamp) {
1281
+ return input;
1282
+ }
1283
+ var select$1 = function EnablementProgramRepresentationSelect() {
1284
+ var _a = select$2(), EnablementProgramSectionRepresentation__selections = _a.selections;
1285
+ var _b = select$3(), AbstractEnablementProgramTaskRepresentation__selections = _b.selections;
1286
+ return {
1287
+ kind: 'Fragment',
1288
+ version: VERSION,
1289
+ private: [],
1290
+ selections: [
1291
+ {
1292
+ name: 'description',
1293
+ kind: 'Scalar'
1294
+ },
1295
+ {
1296
+ name: 'id',
1297
+ kind: 'Scalar'
1298
+ },
1299
+ {
1300
+ name: 'isOutcomeBased',
1301
+ kind: 'Scalar'
1302
+ },
1303
+ {
1304
+ name: 'isTemplate',
1305
+ kind: 'Scalar'
1306
+ },
1307
+ {
1308
+ name: 'name',
1309
+ kind: 'Scalar'
1310
+ },
1311
+ {
1312
+ name: 'sections',
1313
+ kind: 'Object',
1314
+ plural: true,
1315
+ selections: EnablementProgramSectionRepresentation__selections
1316
+ },
1317
+ {
1318
+ name: 'status',
1319
+ kind: 'Scalar'
1320
+ },
1321
+ {
1322
+ name: 'systemModStamp',
1323
+ kind: 'Scalar'
1324
+ },
1325
+ {
1326
+ name: 'tasks',
1327
+ kind: 'Object',
1328
+ plural: true,
1329
+ selections: AbstractEnablementProgramTaskRepresentation__selections
1330
+ }
1331
+ ]
1332
+ };
1333
+ };
1334
+ function equals(existing, incoming) {
1335
+ var existing_isOutcomeBased = existing.isOutcomeBased;
1336
+ var incoming_isOutcomeBased = incoming.isOutcomeBased;
1337
+ if (!(existing_isOutcomeBased === incoming_isOutcomeBased)) {
1338
+ return false;
1339
+ }
1340
+ var existing_isTemplate = existing.isTemplate;
1341
+ var incoming_isTemplate = incoming.isTemplate;
1342
+ if (!(existing_isTemplate === incoming_isTemplate)) {
1343
+ return false;
1344
+ }
1345
+ var existing_description = existing.description;
1346
+ var incoming_description = incoming.description;
1347
+ if (!(existing_description === incoming_description)) {
1348
+ return false;
1349
+ }
1350
+ var existing_name = existing.name;
1351
+ var incoming_name = incoming.name;
1352
+ if (!(existing_name === incoming_name)) {
1353
+ return false;
1354
+ }
1355
+ var existing_status = existing.status;
1356
+ var incoming_status = incoming.status;
1357
+ if (!(existing_status === incoming_status)) {
1358
+ return false;
1359
+ }
1360
+ var existing_systemModStamp = existing.systemModStamp;
1361
+ var incoming_systemModStamp = incoming.systemModStamp;
1362
+ if (!(existing_systemModStamp === incoming_systemModStamp)) {
1363
+ return false;
1364
+ }
1365
+ var existing_id = existing.id;
1366
+ var incoming_id = incoming.id;
1367
+ if (!(existing_id === incoming_id)) {
1368
+ return false;
1369
+ }
1370
+ var existing_sections = existing.sections;
1371
+ var incoming_sections = incoming.sections;
1372
+ var equals_sections_items = equalsArray(existing_sections, incoming_sections, function (existing_sections_item, incoming_sections_item) {
1373
+ if (!(equals$1(existing_sections_item, incoming_sections_item))) {
1374
+ return false;
1375
+ }
1376
+ });
1377
+ if (equals_sections_items === false) {
1378
+ return false;
1379
+ }
1380
+ var existing_tasks = existing.tasks;
1381
+ var incoming_tasks = incoming.tasks;
1382
+ var equals_tasks_items = equalsArray(existing_tasks, incoming_tasks, function (existing_tasks_item, incoming_tasks_item) {
1383
+ if (!(equals$2(existing_tasks_item, incoming_tasks_item))) {
1384
+ return false;
1385
+ }
1386
+ });
1387
+ if (equals_tasks_items === false) {
1388
+ return false;
1389
+ }
1390
+ return true;
1391
+ }
1392
+ var ingest = function EnablementProgramRepresentationIngest(input, path, luvio, store, timestamp) {
1393
+ if (process.env.NODE_ENV !== 'production') {
1394
+ var validateError = validate(input);
1395
+ if (validateError !== null) {
1396
+ throw validateError;
1397
+ }
1398
+ }
1399
+ var key = path.fullPath;
1400
+ var existingRecord = store.readEntry(key);
1401
+ var ttlToUse = TTL;
1402
+ var incomingRecord = normalize(input, store.readEntry(key), {
1403
+ fullPath: key,
1404
+ parent: path.parent,
1405
+ propertyName: path.propertyName,
1406
+ ttl: ttlToUse
1407
+ });
1408
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
1409
+ luvio.storePublish(key, incomingRecord);
1410
+ }
1411
+ {
1412
+ var storeMetadataParams = {
1413
+ ttl: ttlToUse,
1414
+ namespace: "enablement-program",
1415
+ version: VERSION,
1416
+ representationName: RepresentationType,
1417
+ };
1418
+ luvio.publishStoreMetadata(key, storeMetadataParams);
1419
+ }
1420
+ return createLink(key);
1421
+ };
1422
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
1423
+ var rootKeySet = new engine.StoreKeyMap();
1424
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1425
+ var rootKey = fullPathFactory();
1426
+ rootKeySet.set(rootKey, {
1427
+ namespace: keyPrefix,
1428
+ representationName: RepresentationType,
1429
+ mergeable: false
1430
+ });
1431
+ return rootKeySet;
1432
+ }
1433
+
1434
+ function select(luvio, params) {
1435
+ return select$1();
1436
+ }
1437
+ function keyBuilder$1(luvio, params) {
1438
+ return keyPrefix + '::EnablementProgramRepresentation:(' + 'programTemplateName:' + params.urlParams.programTemplateName + ')';
1439
+ }
1440
+ function getResponseCacheKeys(luvio, resourceParams, response) {
1441
+ return getTypeCacheKeys(luvio, response, function () { return keyBuilder$1(luvio, resourceParams); });
1442
+ }
1443
+ function ingestSuccess(luvio, resourceParams, response, snapshotRefresh) {
1444
+ var body = response.body;
1445
+ var key = keyBuilder$1(luvio, resourceParams);
1446
+ luvio.storeIngest(key, ingest, body);
1447
+ var snapshot = luvio.storeLookup({
1448
+ recordId: key,
1449
+ node: select(),
1450
+ variables: {},
1451
+ }, snapshotRefresh);
1452
+ if (process.env.NODE_ENV !== 'production') {
1453
+ if (snapshot.state !== 'Fulfilled') {
1454
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1455
+ }
1456
+ }
1457
+ return snapshot;
1458
+ }
1459
+ function ingestError(luvio, params, error, snapshotRefresh) {
1460
+ var key = keyBuilder$1(luvio, params);
1461
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1462
+ var storeMetadataParams = {
1463
+ ttl: TTL,
1464
+ namespace: keyPrefix,
1465
+ version: VERSION,
1466
+ representationName: RepresentationType
1467
+ };
1468
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1469
+ return errorSnapshot;
1470
+ }
1471
+ function createResourceRequest(config) {
1472
+ var headers = {};
1473
+ return {
1474
+ baseUri: '/services/data/v58.0',
1475
+ basePath: '/connect/enablement/programTemplate/' + config.urlParams.programTemplateName + '',
1476
+ method: 'get',
1477
+ body: null,
1478
+ urlParams: config.urlParams,
1479
+ queryParams: {},
1480
+ headers: headers,
1481
+ priority: 'normal',
1482
+ };
1483
+ }
1484
+
1485
+ var getProgramTemplate_ConfigPropertyNames = {
1486
+ displayName: 'getProgramTemplate',
1487
+ parameters: {
1488
+ required: ['programTemplateName'],
1489
+ optional: []
1490
+ }
1491
+ };
1492
+ function createResourceParams(config) {
1493
+ var resourceParams = {
1494
+ urlParams: {
1495
+ programTemplateName: config.programTemplateName
1496
+ }
1497
+ };
1498
+ return resourceParams;
1499
+ }
1500
+ function keyBuilder(luvio, config) {
1501
+ var resourceParams = createResourceParams(config);
1502
+ return keyBuilder$1(luvio, resourceParams);
1503
+ }
1504
+ function typeCheckConfig(untrustedConfig) {
1505
+ var config = {};
1506
+ var untrustedConfig_programTemplateName = untrustedConfig.programTemplateName;
1507
+ if (typeof untrustedConfig_programTemplateName === 'string') {
1508
+ config.programTemplateName = untrustedConfig_programTemplateName;
1509
+ }
1510
+ return config;
1511
+ }
1512
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
1513
+ if (!untrustedIsObject(untrustedConfig)) {
1514
+ return null;
1515
+ }
1516
+ if (process.env.NODE_ENV !== 'production') {
1517
+ validateConfig(untrustedConfig, configPropertyNames);
1518
+ }
1519
+ var config = typeCheckConfig(untrustedConfig);
1520
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1521
+ return null;
1522
+ }
1523
+ return config;
1524
+ }
1525
+ function adapterFragment(luvio, config) {
1526
+ createResourceParams(config);
1527
+ return select();
1528
+ }
1529
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
1530
+ var snapshot = ingestSuccess(luvio, resourceParams, response, {
1531
+ config: config,
1532
+ resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
1533
+ });
1534
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1535
+ }
1536
+ function onFetchResponseError(luvio, config, resourceParams, response) {
1537
+ var snapshot = ingestError(luvio, resourceParams, response, {
1538
+ config: config,
1539
+ resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
1540
+ });
1541
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1542
+ }
1543
+ function buildNetworkSnapshot(luvio, config, options) {
1544
+ var resourceParams = createResourceParams(config);
1545
+ var request = createResourceRequest(resourceParams);
1546
+ return luvio.dispatchResourceRequest(request, options)
1547
+ .then(function (response) {
1548
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
1549
+ }, function (response) {
1550
+ return luvio.handleErrorResponse(function () { return onFetchResponseError(luvio, config, resourceParams, response); });
1551
+ });
1552
+ }
1553
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
1554
+ var luvio = context.luvio, config = context.config;
1555
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
1556
+ var dispatchOptions = {
1557
+ resourceRequestContext: {
1558
+ requestCorrelator: requestCorrelator,
1559
+ luvioRequestMethod: undefined,
1560
+ },
1561
+ eventObservers: eventObservers
1562
+ };
1563
+ if (networkPriority !== 'normal') {
1564
+ dispatchOptions.overrides = {
1565
+ priority: networkPriority
1566
+ };
1567
+ }
1568
+ return buildNetworkSnapshot(luvio, config, dispatchOptions);
1569
+ }
1570
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
1571
+ var luvio = context.luvio, config = context.config;
1572
+ var selector = {
1573
+ recordId: keyBuilder(luvio, config),
1574
+ node: adapterFragment(luvio, config),
1575
+ variables: {},
1576
+ };
1577
+ var cacheSnapshot = storeLookup(selector, {
1578
+ config: config,
1579
+ resolve: function () { return buildNetworkSnapshot(luvio, config, snapshotRefreshOptions); }
1580
+ });
1581
+ return cacheSnapshot;
1582
+ }
1583
+ var getProgramTemplateAdapterFactory = function (luvio) { return function enablementProgram__getProgramTemplate(untrustedConfig, requestContext) {
1584
+ var config = validateAdapterConfig(untrustedConfig, getProgramTemplate_ConfigPropertyNames);
1585
+ // Invalid or incomplete config
1586
+ if (config === null) {
1587
+ return null;
1588
+ }
1589
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
1590
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
1591
+ }; };
1592
+
1593
+ exports.getProgramTemplateAdapterFactory = getProgramTemplateAdapterFactory;
1594
+ exports.getProgramTemplatesAdapterFactory = getProgramTemplatesAdapterFactory;
1595
+
1596
+ Object.defineProperty(exports, '__esModule', { value: true });
1597
+
1598
+ }));