@salesforce/lds-adapters-industries-clm 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 (64) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/es/es2018/industries-clm.js +3243 -0
  3. package/dist/types/src/generated/adapters/adapter-utils.d.ts +66 -0
  4. package/dist/types/src/generated/adapters/checkIn.d.ts +14 -0
  5. package/dist/types/src/generated/adapters/checkoutContractDocumentVersion.d.ts +16 -0
  6. package/dist/types/src/generated/adapters/createContractDocumentVersionAndInitializeGenerateDocumentProcess.d.ts +16 -0
  7. package/dist/types/src/generated/adapters/deleteAttachment.d.ts +14 -0
  8. package/dist/types/src/generated/adapters/executeContractAction.d.ts +16 -0
  9. package/dist/types/src/generated/adapters/getContentDocument.d.ts +27 -0
  10. package/dist/types/src/generated/adapters/getContractActions.d.ts +27 -0
  11. package/dist/types/src/generated/adapters/getContractDocumentVersion.d.ts +27 -0
  12. package/dist/types/src/generated/adapters/getDocumentGenerationProcessDetails.d.ts +26 -0
  13. package/dist/types/src/generated/adapters/getTemplates.d.ts +30 -0
  14. package/dist/types/src/generated/adapters/lockContractDocumentVersion.d.ts +14 -0
  15. package/dist/types/src/generated/adapters/saveExternalDocument.d.ts +15 -0
  16. package/dist/types/src/generated/adapters/unlock.d.ts +14 -0
  17. package/dist/types/src/generated/adapters/updateContractDocumentVersionWithTemplate.d.ts +16 -0
  18. package/dist/types/src/generated/artifacts/main.d.ts +14 -0
  19. package/dist/types/src/generated/artifacts/sfdc.d.ts +22 -0
  20. package/dist/types/src/generated/resources/deleteConnectClmContractDocumentVersionContentDocumentsByContractDocumentVersionId.d.ts +15 -0
  21. package/dist/types/src/generated/resources/getConnectClmContractContractActionsByContractId.d.ts +16 -0
  22. package/dist/types/src/generated/resources/getConnectClmContractContractDocumentVersionByContractId.d.ts +18 -0
  23. package/dist/types/src/generated/resources/getConnectClmContractDocumentVersionContentDocumentsByContractDocumentVersionId.d.ts +16 -0
  24. package/dist/types/src/generated/resources/getConnectClmDocumentGenerationProcessStatus.d.ts +15 -0
  25. package/dist/types/src/generated/resources/getConnectClmDocumentTemplate.d.ts +19 -0
  26. package/dist/types/src/generated/resources/patchConnectClmContract.d.ts +10 -0
  27. package/dist/types/src/generated/resources/patchConnectClmContractByContractId.d.ts +16 -0
  28. package/dist/types/src/generated/resources/patchConnectClmContractDocumentVersionByContractDocumentVersionId.d.ts +16 -0
  29. package/dist/types/src/generated/resources/patchConnectClmContractDocumentVersionCheckInByContractDocumentVersionId.d.ts +12 -0
  30. package/dist/types/src/generated/resources/patchConnectClmContractDocumentVersionLockByContractDocumentVersionId.d.ts +12 -0
  31. package/dist/types/src/generated/resources/patchConnectClmContractDocumentVersionUnlockByContractDocumentVersionId.d.ts +12 -0
  32. package/dist/types/src/generated/resources/patchConnectClmExternalDocumentResource.d.ts +13 -0
  33. package/dist/types/src/generated/resources/postConnectClmContract.d.ts +13 -0
  34. package/dist/types/src/generated/resources/postConnectClmContractContractDocumentVersionByContractId.d.ts +16 -0
  35. package/dist/types/src/generated/resources/postConnectClmContractDocumentVersionCheckoutByContractDocumentVersionId.d.ts +16 -0
  36. package/dist/types/src/generated/types/ContentDocumentListRepresentation.d.ts +43 -0
  37. package/dist/types/src/generated/types/ContentDocumentRepresentation.d.ts +47 -0
  38. package/dist/types/src/generated/types/ContractActionInputRepresentation.d.ts +39 -0
  39. package/dist/types/src/generated/types/ContractActionInputRepresentationWrapper.d.ts +30 -0
  40. package/dist/types/src/generated/types/ContractActionListRepresentation.d.ts +43 -0
  41. package/dist/types/src/generated/types/ContractActionRepresentation.d.ts +51 -0
  42. package/dist/types/src/generated/types/ContractDocumentVersionRepresentation.d.ts +78 -0
  43. package/dist/types/src/generated/types/ContractDocumentVersionsListRepresentation.d.ts +34 -0
  44. package/dist/types/src/generated/types/ContractInputRepresentation.d.ts +35 -0
  45. package/dist/types/src/generated/types/ContractInputRepresentationWrapper.d.ts +30 -0
  46. package/dist/types/src/generated/types/ContractOutputResponseRepresentation.d.ts +29 -0
  47. package/dist/types/src/generated/types/DocumentGenerateRepresentation.d.ts +49 -0
  48. package/dist/types/src/generated/types/DocumentGenerationProcessStatusRepresentation.d.ts +48 -0
  49. package/dist/types/src/generated/types/GenericOutputRepresentation.d.ts +42 -0
  50. package/dist/types/src/generated/types/SaveExternalDocumentInputRepresentation.d.ts +29 -0
  51. package/dist/types/src/generated/types/SaveExternalDocumentInputRepresentationWrapper.d.ts +30 -0
  52. package/dist/types/src/generated/types/SaveExternalDocumentRepresentation.d.ts +45 -0
  53. package/dist/types/src/generated/types/TemplateInputRepresentation.d.ts +35 -0
  54. package/dist/types/src/generated/types/TemplateInputRepresentationWrapper.d.ts +30 -0
  55. package/dist/types/src/generated/types/TemplateListRepresentation.d.ts +37 -0
  56. package/dist/types/src/generated/types/TemplateRepresentation.d.ts +41 -0
  57. package/dist/types/src/generated/types/type-utils.d.ts +39 -0
  58. package/dist/umd/es2018/industries-clm.js +3264 -0
  59. package/dist/umd/es5/industries-clm.js +3279 -0
  60. package/package.json +67 -0
  61. package/sfdc/index.d.ts +1 -0
  62. package/sfdc/index.js +3417 -0
  63. package/src/raml/api.raml +649 -0
  64. package/src/raml/luvio.raml +173 -0
@@ -0,0 +1,3279 @@
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.industriesClm = {}, global.engine));
11
+ })(this, (function (exports, engine) { 'use strict';
12
+
13
+ var ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
14
+ var ObjectKeys$1 = 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$1(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 = 'clm';
56
+
57
+ var ObjectFreeze = Object.freeze, ObjectKeys = Object.keys;
58
+ var ArrayIsArray = Array.isArray;
59
+ var JSONStringify = JSON.stringify;
60
+ function equalsArray(a, b, equalsItem) {
61
+ var aLength = a.length;
62
+ var bLength = b.length;
63
+ if (aLength !== bLength) {
64
+ return false;
65
+ }
66
+ for (var i = 0; i < aLength; i++) {
67
+ if (equalsItem(a[i], b[i]) === false) {
68
+ return false;
69
+ }
70
+ }
71
+ return true;
72
+ }
73
+ function deepFreeze$b(value) {
74
+ // No need to freeze primitives
75
+ if (typeof value !== 'object' || value === null) {
76
+ return;
77
+ }
78
+ if (ArrayIsArray(value)) {
79
+ for (var i = 0, len = value.length; i < len; i += 1) {
80
+ deepFreeze$b(value[i]);
81
+ }
82
+ }
83
+ else {
84
+ var keys = ObjectKeys(value);
85
+ for (var i = 0, len = keys.length; i < len; i += 1) {
86
+ deepFreeze$b(value[keys[i]]);
87
+ }
88
+ }
89
+ ObjectFreeze(value);
90
+ }
91
+ function createLink(ref) {
92
+ return {
93
+ __ref: engine.serializeStructuredKey(ref),
94
+ };
95
+ }
96
+
97
+ function validate$e(obj, path) {
98
+ if (path === void 0) { path = 'ContractDocumentVersionRepresentation'; }
99
+ var v_error = (function () {
100
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
101
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
102
+ }
103
+ var obj_contractDocumentVersionId = obj.contractDocumentVersionId;
104
+ var path_contractDocumentVersionId = path + '.contractDocumentVersionId';
105
+ if (typeof obj_contractDocumentVersionId !== 'string') {
106
+ return new TypeError('Expected "string" but received "' + typeof obj_contractDocumentVersionId + '" (at "' + path_contractDocumentVersionId + '")');
107
+ }
108
+ var obj_contractId = obj.contractId;
109
+ var path_contractId = path + '.contractId';
110
+ if (typeof obj_contractId !== 'string') {
111
+ return new TypeError('Expected "string" but received "' + typeof obj_contractId + '" (at "' + path_contractId + '")');
112
+ }
113
+ if (obj.createdByFullName !== undefined) {
114
+ var obj_createdByFullName = obj.createdByFullName;
115
+ var path_createdByFullName = path + '.createdByFullName';
116
+ if (typeof obj_createdByFullName !== 'string') {
117
+ return new TypeError('Expected "string" but received "' + typeof obj_createdByFullName + '" (at "' + path_createdByFullName + '")');
118
+ }
119
+ }
120
+ var obj_createdDate = obj.createdDate;
121
+ var path_createdDate = path + '.createdDate';
122
+ if (typeof obj_createdDate !== 'string') {
123
+ return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
124
+ }
125
+ if (obj.creationProcessType !== undefined) {
126
+ var obj_creationProcessType = obj.creationProcessType;
127
+ var path_creationProcessType = path + '.creationProcessType';
128
+ if (typeof obj_creationProcessType !== 'string') {
129
+ return new TypeError('Expected "string" but received "' + typeof obj_creationProcessType + '" (at "' + path_creationProcessType + '")');
130
+ }
131
+ }
132
+ if (obj.documentTemplateId !== undefined) {
133
+ var obj_documentTemplateId = obj.documentTemplateId;
134
+ var path_documentTemplateId = path + '.documentTemplateId';
135
+ if (typeof obj_documentTemplateId !== 'string') {
136
+ return new TypeError('Expected "string" but received "' + typeof obj_documentTemplateId + '" (at "' + path_documentTemplateId + '")');
137
+ }
138
+ }
139
+ var obj_isDocumentVersionLocked = obj.isDocumentVersionLocked;
140
+ var path_isDocumentVersionLocked = path + '.isDocumentVersionLocked';
141
+ if (typeof obj_isDocumentVersionLocked !== 'boolean') {
142
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isDocumentVersionLocked + '" (at "' + path_isDocumentVersionLocked + '")');
143
+ }
144
+ var obj_lastModifiedDate = obj.lastModifiedDate;
145
+ var path_lastModifiedDate = path + '.lastModifiedDate';
146
+ if (typeof obj_lastModifiedDate !== 'string') {
147
+ return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
148
+ }
149
+ if (obj.lockType !== undefined) {
150
+ var obj_lockType = obj.lockType;
151
+ var path_lockType = path + '.lockType';
152
+ if (typeof obj_lockType !== 'string') {
153
+ return new TypeError('Expected "string" but received "' + typeof obj_lockType + '" (at "' + path_lockType + '")');
154
+ }
155
+ }
156
+ if (obj.lockedByUserName !== undefined) {
157
+ var obj_lockedByUserName = obj.lockedByUserName;
158
+ var path_lockedByUserName = path + '.lockedByUserName';
159
+ if (typeof obj_lockedByUserName !== 'string') {
160
+ return new TypeError('Expected "string" but received "' + typeof obj_lockedByUserName + '" (at "' + path_lockedByUserName + '")');
161
+ }
162
+ }
163
+ var obj_name = obj.name;
164
+ var path_name = path + '.name';
165
+ if (typeof obj_name !== 'string') {
166
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
167
+ }
168
+ var obj_status = obj.status;
169
+ var path_status = path + '.status';
170
+ if (typeof obj_status !== 'string') {
171
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
172
+ }
173
+ var obj_versionNumber = obj.versionNumber;
174
+ var path_versionNumber = path + '.versionNumber';
175
+ if (typeof obj_versionNumber !== 'string') {
176
+ return new TypeError('Expected "string" but received "' + typeof obj_versionNumber + '" (at "' + path_versionNumber + '")');
177
+ }
178
+ })();
179
+ return v_error === undefined ? null : v_error;
180
+ }
181
+ function deepFreeze$a(input) {
182
+ ObjectFreeze(input);
183
+ }
184
+
185
+ var TTL$6 = 60000;
186
+ var VERSION$8 = "a824de2ee1cbb2f1e15ea8114da78d95";
187
+ function validate$d(obj, path) {
188
+ if (path === void 0) { path = 'ContractDocumentVersionsListRepresentation'; }
189
+ var v_error = (function () {
190
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
191
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
192
+ }
193
+ var obj_contractId = obj.contractId;
194
+ var path_contractId = path + '.contractId';
195
+ if (typeof obj_contractId !== 'string') {
196
+ return new TypeError('Expected "string" but received "' + typeof obj_contractId + '" (at "' + path_contractId + '")');
197
+ }
198
+ if (obj.data !== undefined) {
199
+ var obj_data = obj.data;
200
+ var path_data = path + '.data';
201
+ if (!ArrayIsArray(obj_data)) {
202
+ return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
203
+ }
204
+ for (var i = 0; i < obj_data.length; i++) {
205
+ var obj_data_item = obj_data[i];
206
+ var path_data_item = path_data + '[' + i + ']';
207
+ var referencepath_data_itemValidationError = validate$e(obj_data_item, path_data_item);
208
+ if (referencepath_data_itemValidationError !== null) {
209
+ var message = 'Object doesn\'t match ContractDocumentVersionRepresentation (at "' + path_data_item + '")\n';
210
+ message += referencepath_data_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
211
+ return new TypeError(message);
212
+ }
213
+ }
214
+ }
215
+ })();
216
+ return v_error === undefined ? null : v_error;
217
+ }
218
+ var RepresentationType$7 = 'ContractDocumentVersionsListRepresentation';
219
+ function normalize$7(input, existing, path, luvio, store, timestamp) {
220
+ return input;
221
+ }
222
+ var select$l = function ContractDocumentVersionsListRepresentationSelect() {
223
+ return {
224
+ kind: 'Fragment',
225
+ version: VERSION$8,
226
+ private: [],
227
+ opaque: true
228
+ };
229
+ };
230
+ function equals$8(existing, incoming) {
231
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
232
+ return false;
233
+ }
234
+ return true;
235
+ }
236
+ function deepFreeze$9(input) {
237
+ var input_data = input.data;
238
+ if (input_data !== undefined) {
239
+ for (var i = 0; i < input_data.length; i++) {
240
+ var input_data_item = input_data[i];
241
+ deepFreeze$a(input_data_item);
242
+ }
243
+ ObjectFreeze(input_data);
244
+ }
245
+ ObjectFreeze(input);
246
+ }
247
+ var ingest$7 = function ContractDocumentVersionsListRepresentationIngest(input, path, luvio, store, timestamp) {
248
+ if (process.env.NODE_ENV !== 'production') {
249
+ var validateError = validate$d(input);
250
+ if (validateError !== null) {
251
+ throw validateError;
252
+ }
253
+ }
254
+ var key = path.fullPath;
255
+ var existingRecord = store.readEntry(key);
256
+ var ttlToUse = TTL$6;
257
+ var incomingRecord = normalize$7(input, store.readEntry(key), {
258
+ fullPath: key,
259
+ parent: path.parent,
260
+ propertyName: path.propertyName,
261
+ ttl: ttlToUse
262
+ });
263
+ deepFreeze$9(input);
264
+ if (existingRecord === undefined || equals$8(existingRecord, incomingRecord) === false) {
265
+ luvio.storePublish(key, incomingRecord);
266
+ }
267
+ {
268
+ var storeMetadataParams = {
269
+ ttl: ttlToUse,
270
+ namespace: "clm",
271
+ version: VERSION$8,
272
+ representationName: RepresentationType$7,
273
+ };
274
+ luvio.publishStoreMetadata(key, storeMetadataParams);
275
+ }
276
+ return createLink(key);
277
+ };
278
+ function getTypeCacheKeys$7(luvio, input, fullPathFactory) {
279
+ var rootKeySet = new engine.StoreKeyMap();
280
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
281
+ var rootKey = fullPathFactory();
282
+ rootKeySet.set(rootKey, {
283
+ namespace: keyPrefix,
284
+ representationName: RepresentationType$7,
285
+ mergeable: false
286
+ });
287
+ return rootKeySet;
288
+ }
289
+
290
+ function select$k(luvio, params) {
291
+ return select$l();
292
+ }
293
+ function keyBuilder$f(luvio, params) {
294
+ return keyPrefix + '::ContractDocumentVersionsListRepresentation:(' + 'contractDocumentVersionId:' + params.queryParams.contractDocumentVersionId + ',' + 'contractId:' + params.urlParams.contractId + ')';
295
+ }
296
+ function getResponseCacheKeys$d(luvio, resourceParams, response) {
297
+ return getTypeCacheKeys$7(luvio, response, function () { return keyBuilder$f(luvio, resourceParams); });
298
+ }
299
+ function ingestSuccess$c(luvio, resourceParams, response, snapshotRefresh) {
300
+ var body = response.body;
301
+ var key = keyBuilder$f(luvio, resourceParams);
302
+ luvio.storeIngest(key, ingest$7, body);
303
+ var snapshot = luvio.storeLookup({
304
+ recordId: key,
305
+ node: select$k(),
306
+ variables: {},
307
+ }, snapshotRefresh);
308
+ if (process.env.NODE_ENV !== 'production') {
309
+ if (snapshot.state !== 'Fulfilled') {
310
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
311
+ }
312
+ }
313
+ return snapshot;
314
+ }
315
+ function ingestError$4(luvio, params, error, snapshotRefresh) {
316
+ var key = keyBuilder$f(luvio, params);
317
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
318
+ var storeMetadataParams = {
319
+ ttl: TTL$6,
320
+ namespace: keyPrefix,
321
+ version: VERSION$8,
322
+ representationName: RepresentationType$7
323
+ };
324
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
325
+ return errorSnapshot;
326
+ }
327
+ function createResourceRequest$d(config) {
328
+ var headers = {};
329
+ return {
330
+ baseUri: '/services/data/v58.0',
331
+ basePath: '/connect/clm/contract/' + config.urlParams.contractId + '/contract-document-version',
332
+ method: 'get',
333
+ body: null,
334
+ urlParams: config.urlParams,
335
+ queryParams: config.queryParams,
336
+ headers: headers,
337
+ priority: 'normal',
338
+ };
339
+ }
340
+
341
+ var getContractDocumentVersion_ConfigPropertyNames = {
342
+ displayName: 'getContractDocumentVersion',
343
+ parameters: {
344
+ required: ['contractId'],
345
+ optional: ['contractDocumentVersionId']
346
+ }
347
+ };
348
+ function createResourceParams$d(config) {
349
+ var resourceParams = {
350
+ urlParams: {
351
+ contractId: config.contractId
352
+ },
353
+ queryParams: {
354
+ contractDocumentVersionId: config.contractDocumentVersionId
355
+ }
356
+ };
357
+ return resourceParams;
358
+ }
359
+ function keyBuilder$e(luvio, config) {
360
+ var resourceParams = createResourceParams$d(config);
361
+ return keyBuilder$f(luvio, resourceParams);
362
+ }
363
+ function typeCheckConfig$d(untrustedConfig) {
364
+ var config = {};
365
+ var untrustedConfig_contractId = untrustedConfig.contractId;
366
+ if (typeof untrustedConfig_contractId === 'string') {
367
+ config.contractId = untrustedConfig_contractId;
368
+ }
369
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
370
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
371
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
372
+ }
373
+ return config;
374
+ }
375
+ function validateAdapterConfig$d(untrustedConfig, configPropertyNames) {
376
+ if (!untrustedIsObject(untrustedConfig)) {
377
+ return null;
378
+ }
379
+ if (process.env.NODE_ENV !== 'production') {
380
+ validateConfig(untrustedConfig, configPropertyNames);
381
+ }
382
+ var config = typeCheckConfig$d(untrustedConfig);
383
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
384
+ return null;
385
+ }
386
+ return config;
387
+ }
388
+ function adapterFragment$4(luvio, config) {
389
+ createResourceParams$d(config);
390
+ return select$k();
391
+ }
392
+ function onFetchResponseSuccess$4(luvio, config, resourceParams, response) {
393
+ var snapshot = ingestSuccess$c(luvio, resourceParams, response, {
394
+ config: config,
395
+ resolve: function () { return buildNetworkSnapshot$d(luvio, config, snapshotRefreshOptions); }
396
+ });
397
+ return luvio.storeBroadcast().then(function () { return snapshot; });
398
+ }
399
+ function onFetchResponseError$4(luvio, config, resourceParams, response) {
400
+ var snapshot = ingestError$4(luvio, resourceParams, response, {
401
+ config: config,
402
+ resolve: function () { return buildNetworkSnapshot$d(luvio, config, snapshotRefreshOptions); }
403
+ });
404
+ return luvio.storeBroadcast().then(function () { return snapshot; });
405
+ }
406
+ function buildNetworkSnapshot$d(luvio, config, options) {
407
+ var resourceParams = createResourceParams$d(config);
408
+ var request = createResourceRequest$d(resourceParams);
409
+ return luvio.dispatchResourceRequest(request, options)
410
+ .then(function (response) {
411
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess$4(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$d(luvio, resourceParams, response.body); });
412
+ }, function (response) {
413
+ return luvio.handleErrorResponse(function () { return onFetchResponseError$4(luvio, config, resourceParams, response); });
414
+ });
415
+ }
416
+ function buildNetworkSnapshotCachePolicy$4(context, coercedAdapterRequestContext) {
417
+ var luvio = context.luvio, config = context.config;
418
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
419
+ var dispatchOptions = {
420
+ resourceRequestContext: {
421
+ requestCorrelator: requestCorrelator,
422
+ luvioRequestMethod: undefined,
423
+ },
424
+ eventObservers: eventObservers
425
+ };
426
+ if (networkPriority !== 'normal') {
427
+ dispatchOptions.overrides = {
428
+ priority: networkPriority
429
+ };
430
+ }
431
+ return buildNetworkSnapshot$d(luvio, config, dispatchOptions);
432
+ }
433
+ function buildCachedSnapshotCachePolicy$4(context, storeLookup) {
434
+ var luvio = context.luvio, config = context.config;
435
+ var selector = {
436
+ recordId: keyBuilder$e(luvio, config),
437
+ node: adapterFragment$4(luvio, config),
438
+ variables: {},
439
+ };
440
+ var cacheSnapshot = storeLookup(selector, {
441
+ config: config,
442
+ resolve: function () { return buildNetworkSnapshot$d(luvio, config, snapshotRefreshOptions); }
443
+ });
444
+ return cacheSnapshot;
445
+ }
446
+ var getContractDocumentVersionAdapterFactory = function (luvio) { return function clm__getContractDocumentVersion(untrustedConfig, requestContext) {
447
+ var config = validateAdapterConfig$d(untrustedConfig, getContractDocumentVersion_ConfigPropertyNames);
448
+ // Invalid or incomplete config
449
+ if (config === null) {
450
+ return null;
451
+ }
452
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
453
+ buildCachedSnapshotCachePolicy$4, buildNetworkSnapshotCachePolicy$4);
454
+ }; };
455
+
456
+ function validate$c(obj, path) {
457
+ if (path === void 0) { path = 'TemplateInputRepresentation'; }
458
+ var v_error = (function () {
459
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
460
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
461
+ }
462
+ if (obj.pdfDocumentId !== undefined) {
463
+ var obj_pdfDocumentId = obj.pdfDocumentId;
464
+ var path_pdfDocumentId = path + '.pdfDocumentId';
465
+ if (typeof obj_pdfDocumentId !== 'string') {
466
+ return new TypeError('Expected "string" but received "' + typeof obj_pdfDocumentId + '" (at "' + path_pdfDocumentId + '")');
467
+ }
468
+ }
469
+ var obj_templateId = obj.templateId;
470
+ var path_templateId = path + '.templateId';
471
+ if (typeof obj_templateId !== 'string') {
472
+ return new TypeError('Expected "string" but received "' + typeof obj_templateId + '" (at "' + path_templateId + '")');
473
+ }
474
+ if (obj.wordDocumentId !== undefined) {
475
+ var obj_wordDocumentId = obj.wordDocumentId;
476
+ var path_wordDocumentId = path + '.wordDocumentId';
477
+ if (typeof obj_wordDocumentId !== 'string') {
478
+ return new TypeError('Expected "string" but received "' + typeof obj_wordDocumentId + '" (at "' + path_wordDocumentId + '")');
479
+ }
480
+ }
481
+ })();
482
+ return v_error === undefined ? null : v_error;
483
+ }
484
+
485
+ var VERSION$7 = "f874339705636326163a82467da64b36";
486
+ function validate$b(obj, path) {
487
+ if (path === void 0) { path = 'ContentDocumentRepresentation'; }
488
+ var v_error = (function () {
489
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
490
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
491
+ }
492
+ var obj_contentDocumentId = obj.contentDocumentId;
493
+ var path_contentDocumentId = path + '.contentDocumentId';
494
+ if (typeof obj_contentDocumentId !== 'string') {
495
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDocumentId + '" (at "' + path_contentDocumentId + '")');
496
+ }
497
+ if (obj.contentDocumentLinkId !== undefined) {
498
+ var obj_contentDocumentLinkId = obj.contentDocumentLinkId;
499
+ var path_contentDocumentLinkId = path + '.contentDocumentLinkId';
500
+ if (typeof obj_contentDocumentLinkId !== 'string') {
501
+ return new TypeError('Expected "string" but received "' + typeof obj_contentDocumentLinkId + '" (at "' + path_contentDocumentLinkId + '")');
502
+ }
503
+ }
504
+ var obj_contractDocumentVersionId = obj.contractDocumentVersionId;
505
+ var path_contractDocumentVersionId = path + '.contractDocumentVersionId';
506
+ if (typeof obj_contractDocumentVersionId !== 'string') {
507
+ return new TypeError('Expected "string" but received "' + typeof obj_contractDocumentVersionId + '" (at "' + path_contractDocumentVersionId + '")');
508
+ }
509
+ var obj_createdDate = obj.createdDate;
510
+ var path_createdDate = path + '.createdDate';
511
+ if (typeof obj_createdDate !== 'string') {
512
+ return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
513
+ }
514
+ if (obj.fileExtension !== undefined) {
515
+ var obj_fileExtension = obj.fileExtension;
516
+ var path_fileExtension = path + '.fileExtension';
517
+ if (typeof obj_fileExtension !== 'string') {
518
+ return new TypeError('Expected "string" but received "' + typeof obj_fileExtension + '" (at "' + path_fileExtension + '")');
519
+ }
520
+ }
521
+ var obj_lastModifiedDate = obj.lastModifiedDate;
522
+ var path_lastModifiedDate = path + '.lastModifiedDate';
523
+ if (typeof obj_lastModifiedDate !== 'string') {
524
+ return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
525
+ }
526
+ var obj_title = obj.title;
527
+ var path_title = path + '.title';
528
+ if (typeof obj_title !== 'string') {
529
+ return new TypeError('Expected "string" but received "' + typeof obj_title + '" (at "' + path_title + '")');
530
+ }
531
+ })();
532
+ return v_error === undefined ? null : v_error;
533
+ }
534
+ var select$j = function ContentDocumentRepresentationSelect() {
535
+ return {
536
+ kind: 'Fragment',
537
+ version: VERSION$7,
538
+ private: [],
539
+ selections: [
540
+ {
541
+ name: 'contentDocumentId',
542
+ kind: 'Scalar'
543
+ },
544
+ {
545
+ name: 'contentDocumentLinkId',
546
+ kind: 'Scalar',
547
+ required: false
548
+ },
549
+ {
550
+ name: 'contractDocumentVersionId',
551
+ kind: 'Scalar'
552
+ },
553
+ {
554
+ name: 'createdDate',
555
+ kind: 'Scalar'
556
+ },
557
+ {
558
+ name: 'fileExtension',
559
+ kind: 'Scalar',
560
+ required: false
561
+ },
562
+ {
563
+ name: 'lastModifiedDate',
564
+ kind: 'Scalar'
565
+ },
566
+ {
567
+ name: 'title',
568
+ kind: 'Scalar'
569
+ }
570
+ ]
571
+ };
572
+ };
573
+ function equals$7(existing, incoming) {
574
+ var existing_contentDocumentId = existing.contentDocumentId;
575
+ var incoming_contentDocumentId = incoming.contentDocumentId;
576
+ if (!(existing_contentDocumentId === incoming_contentDocumentId)) {
577
+ return false;
578
+ }
579
+ var existing_contentDocumentLinkId = existing.contentDocumentLinkId;
580
+ var incoming_contentDocumentLinkId = incoming.contentDocumentLinkId;
581
+ // if at least one of these optionals is defined
582
+ if (existing_contentDocumentLinkId !== undefined || incoming_contentDocumentLinkId !== undefined) {
583
+ // if one of these is not defined we know the other is defined and therefore
584
+ // not equal
585
+ if (existing_contentDocumentLinkId === undefined || incoming_contentDocumentLinkId === undefined) {
586
+ return false;
587
+ }
588
+ if (!(existing_contentDocumentLinkId === incoming_contentDocumentLinkId)) {
589
+ return false;
590
+ }
591
+ }
592
+ var existing_contractDocumentVersionId = existing.contractDocumentVersionId;
593
+ var incoming_contractDocumentVersionId = incoming.contractDocumentVersionId;
594
+ if (!(existing_contractDocumentVersionId === incoming_contractDocumentVersionId)) {
595
+ return false;
596
+ }
597
+ var existing_createdDate = existing.createdDate;
598
+ var incoming_createdDate = incoming.createdDate;
599
+ if (!(existing_createdDate === incoming_createdDate)) {
600
+ return false;
601
+ }
602
+ var existing_fileExtension = existing.fileExtension;
603
+ var incoming_fileExtension = incoming.fileExtension;
604
+ // if at least one of these optionals is defined
605
+ if (existing_fileExtension !== undefined || incoming_fileExtension !== undefined) {
606
+ // if one of these is not defined we know the other is defined and therefore
607
+ // not equal
608
+ if (existing_fileExtension === undefined || incoming_fileExtension === undefined) {
609
+ return false;
610
+ }
611
+ if (!(existing_fileExtension === incoming_fileExtension)) {
612
+ return false;
613
+ }
614
+ }
615
+ var existing_lastModifiedDate = existing.lastModifiedDate;
616
+ var incoming_lastModifiedDate = incoming.lastModifiedDate;
617
+ if (!(existing_lastModifiedDate === incoming_lastModifiedDate)) {
618
+ return false;
619
+ }
620
+ var existing_title = existing.title;
621
+ var incoming_title = incoming.title;
622
+ if (!(existing_title === incoming_title)) {
623
+ return false;
624
+ }
625
+ return true;
626
+ }
627
+ function deepFreeze$8(input) {
628
+ ObjectFreeze(input);
629
+ }
630
+
631
+ var TTL$5 = 60000;
632
+ var VERSION$6 = "520b4f1213b0e08b197d18564d0a2432";
633
+ function validate$a(obj, path) {
634
+ if (path === void 0) { path = 'DocumentGenerateRepresentation'; }
635
+ var v_error = (function () {
636
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
637
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
638
+ }
639
+ if (obj.contentDocuments !== undefined) {
640
+ var obj_contentDocuments = obj.contentDocuments;
641
+ var path_contentDocuments = path + '.contentDocuments';
642
+ if (!ArrayIsArray(obj_contentDocuments)) {
643
+ return new TypeError('Expected "array" but received "' + typeof obj_contentDocuments + '" (at "' + path_contentDocuments + '")');
644
+ }
645
+ for (var i = 0; i < obj_contentDocuments.length; i++) {
646
+ var obj_contentDocuments_item = obj_contentDocuments[i];
647
+ var path_contentDocuments_item = path_contentDocuments + '[' + i + ']';
648
+ var referencepath_contentDocuments_itemValidationError = validate$b(obj_contentDocuments_item, path_contentDocuments_item);
649
+ if (referencepath_contentDocuments_itemValidationError !== null) {
650
+ var message = 'Object doesn\'t match ContentDocumentRepresentation (at "' + path_contentDocuments_item + '")\n';
651
+ message += referencepath_contentDocuments_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
652
+ return new TypeError(message);
653
+ }
654
+ }
655
+ }
656
+ var obj_contractDocumentVersionId = obj.contractDocumentVersionId;
657
+ var path_contractDocumentVersionId = path + '.contractDocumentVersionId';
658
+ if (typeof obj_contractDocumentVersionId !== 'string') {
659
+ return new TypeError('Expected "string" but received "' + typeof obj_contractDocumentVersionId + '" (at "' + path_contractDocumentVersionId + '")');
660
+ }
661
+ var obj_contractId = obj.contractId;
662
+ var path_contractId = path + '.contractId';
663
+ if (typeof obj_contractId !== 'string') {
664
+ return new TypeError('Expected "string" but received "' + typeof obj_contractId + '" (at "' + path_contractId + '")');
665
+ }
666
+ if (obj.jobId !== undefined) {
667
+ var obj_jobId = obj.jobId;
668
+ var path_jobId = path + '.jobId';
669
+ if (typeof obj_jobId !== 'string') {
670
+ return new TypeError('Expected "string" but received "' + typeof obj_jobId + '" (at "' + path_jobId + '")');
671
+ }
672
+ }
673
+ })();
674
+ return v_error === undefined ? null : v_error;
675
+ }
676
+ var RepresentationType$6 = 'DocumentGenerateRepresentation';
677
+ function keyBuilder$d(luvio, config) {
678
+ return keyPrefix + '::' + RepresentationType$6 + ':' + config.contractId;
679
+ }
680
+ function keyBuilderFromType$4(luvio, object) {
681
+ var keyParams = {
682
+ contractId: object.contractId
683
+ };
684
+ return keyBuilder$d(luvio, keyParams);
685
+ }
686
+ function normalize$6(input, existing, path, luvio, store, timestamp) {
687
+ return input;
688
+ }
689
+ var select$i = function DocumentGenerateRepresentationSelect() {
690
+ return {
691
+ kind: 'Fragment',
692
+ version: VERSION$6,
693
+ private: [],
694
+ opaque: true
695
+ };
696
+ };
697
+ function equals$6(existing, incoming) {
698
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
699
+ return false;
700
+ }
701
+ return true;
702
+ }
703
+ function deepFreeze$7(input) {
704
+ var input_contentDocuments = input.contentDocuments;
705
+ if (input_contentDocuments !== undefined) {
706
+ for (var i = 0; i < input_contentDocuments.length; i++) {
707
+ var input_contentDocuments_item = input_contentDocuments[i];
708
+ deepFreeze$8(input_contentDocuments_item);
709
+ }
710
+ ObjectFreeze(input_contentDocuments);
711
+ }
712
+ ObjectFreeze(input);
713
+ }
714
+ var ingest$6 = function DocumentGenerateRepresentationIngest(input, path, luvio, store, timestamp) {
715
+ if (process.env.NODE_ENV !== 'production') {
716
+ var validateError = validate$a(input);
717
+ if (validateError !== null) {
718
+ throw validateError;
719
+ }
720
+ }
721
+ var key = keyBuilderFromType$4(luvio, input);
722
+ var existingRecord = store.readEntry(key);
723
+ var ttlToUse = TTL$5;
724
+ var incomingRecord = normalize$6(input, store.readEntry(key), {
725
+ fullPath: key,
726
+ parent: path.parent,
727
+ propertyName: path.propertyName,
728
+ ttl: ttlToUse
729
+ });
730
+ deepFreeze$7(input);
731
+ if (existingRecord === undefined || equals$6(existingRecord, incomingRecord) === false) {
732
+ luvio.storePublish(key, incomingRecord);
733
+ }
734
+ {
735
+ var storeMetadataParams = {
736
+ ttl: ttlToUse,
737
+ namespace: "clm",
738
+ version: VERSION$6,
739
+ representationName: RepresentationType$6,
740
+ };
741
+ luvio.publishStoreMetadata(key, storeMetadataParams);
742
+ }
743
+ return createLink(key);
744
+ };
745
+ function getTypeCacheKeys$6(luvio, input, fullPathFactory) {
746
+ var rootKeySet = new engine.StoreKeyMap();
747
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
748
+ var rootKey = keyBuilderFromType$4(luvio, input);
749
+ rootKeySet.set(rootKey, {
750
+ namespace: keyPrefix,
751
+ representationName: RepresentationType$6,
752
+ mergeable: false
753
+ });
754
+ return rootKeySet;
755
+ }
756
+
757
+ function select$h(luvio, params) {
758
+ return select$i();
759
+ }
760
+ function getResponseCacheKeys$c(luvio, resourceParams, response) {
761
+ return getTypeCacheKeys$6(luvio, response);
762
+ }
763
+ function ingestSuccess$b(luvio, resourceParams, response) {
764
+ var body = response.body;
765
+ var key = keyBuilderFromType$4(luvio, body);
766
+ luvio.storeIngest(key, ingest$6, body);
767
+ var snapshot = luvio.storeLookup({
768
+ recordId: key,
769
+ node: select$h(),
770
+ variables: {},
771
+ });
772
+ if (process.env.NODE_ENV !== 'production') {
773
+ if (snapshot.state !== 'Fulfilled') {
774
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
775
+ }
776
+ }
777
+ return snapshot;
778
+ }
779
+ function createResourceRequest$c(config) {
780
+ var headers = {};
781
+ return {
782
+ baseUri: '/services/data/v58.0',
783
+ basePath: '/connect/clm/contract/' + config.urlParams.contractId + '/contract-document-version',
784
+ method: 'post',
785
+ body: config.body,
786
+ urlParams: config.urlParams,
787
+ queryParams: {},
788
+ headers: headers,
789
+ priority: 'normal',
790
+ };
791
+ }
792
+
793
+ var createContractDocumentVersionAndInitializeGenerateDocumentProcess_ConfigPropertyNames = {
794
+ displayName: 'createContractDocumentVersionAndInitializeGenerateDocumentProcess',
795
+ parameters: {
796
+ required: ['contractId', 'templateInput'],
797
+ optional: []
798
+ }
799
+ };
800
+ function createResourceParams$c(config) {
801
+ var resourceParams = {
802
+ urlParams: {
803
+ contractId: config.contractId
804
+ },
805
+ body: {
806
+ templateInput: config.templateInput
807
+ }
808
+ };
809
+ return resourceParams;
810
+ }
811
+ function typeCheckConfig$c(untrustedConfig) {
812
+ var config = {};
813
+ var untrustedConfig_contractId = untrustedConfig.contractId;
814
+ if (typeof untrustedConfig_contractId === 'string') {
815
+ config.contractId = untrustedConfig_contractId;
816
+ }
817
+ var untrustedConfig_templateInput = untrustedConfig.templateInput;
818
+ var referenceTemplateInputRepresentationValidationError = validate$c(untrustedConfig_templateInput);
819
+ if (referenceTemplateInputRepresentationValidationError === null) {
820
+ config.templateInput = untrustedConfig_templateInput;
821
+ }
822
+ return config;
823
+ }
824
+ function validateAdapterConfig$c(untrustedConfig, configPropertyNames) {
825
+ if (!untrustedIsObject(untrustedConfig)) {
826
+ return null;
827
+ }
828
+ if (process.env.NODE_ENV !== 'production') {
829
+ validateConfig(untrustedConfig, configPropertyNames);
830
+ }
831
+ var config = typeCheckConfig$c(untrustedConfig);
832
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
833
+ return null;
834
+ }
835
+ return config;
836
+ }
837
+ function buildNetworkSnapshot$c(luvio, config, options) {
838
+ var resourceParams = createResourceParams$c(config);
839
+ var request = createResourceRequest$c(resourceParams);
840
+ return luvio.dispatchResourceRequest(request, options)
841
+ .then(function (response) {
842
+ return luvio.handleSuccessResponse(function () {
843
+ var snapshot = ingestSuccess$b(luvio, resourceParams, response);
844
+ return luvio.storeBroadcast().then(function () { return snapshot; });
845
+ }, function () { return getResponseCacheKeys$c(luvio, resourceParams, response.body); });
846
+ }, function (response) {
847
+ deepFreeze$b(response);
848
+ throw response;
849
+ });
850
+ }
851
+ var createContractDocumentVersionAndInitializeGenerateDocumentProcessAdapterFactory = function (luvio) {
852
+ return function createContractDocumentVersionAndInitializeGenerateDocumentProcess(untrustedConfig) {
853
+ var config = validateAdapterConfig$c(untrustedConfig, createContractDocumentVersionAndInitializeGenerateDocumentProcess_ConfigPropertyNames);
854
+ // Invalid or incomplete config
855
+ if (config === null) {
856
+ throw new Error('Invalid config for "createContractDocumentVersionAndInitializeGenerateDocumentProcess"');
857
+ }
858
+ return buildNetworkSnapshot$c(luvio, config);
859
+ };
860
+ };
861
+
862
+ function validate$9(obj, path) {
863
+ if (path === void 0) { path = 'ContractActionInputRepresentation'; }
864
+ var v_error = (function () {
865
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
866
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
867
+ }
868
+ if (obj.actionApiName !== undefined) {
869
+ var obj_actionApiName = obj.actionApiName;
870
+ var path_actionApiName = path + '.actionApiName';
871
+ if (typeof obj_actionApiName !== 'string') {
872
+ return new TypeError('Expected "string" but received "' + typeof obj_actionApiName + '" (at "' + path_actionApiName + '")');
873
+ }
874
+ }
875
+ if (obj.actionData !== undefined) {
876
+ var obj_actionData = obj.actionData;
877
+ var path_actionData = path + '.actionData';
878
+ if (typeof obj_actionData !== 'object' || ArrayIsArray(obj_actionData) || obj_actionData === null) {
879
+ return new TypeError('Expected "object" but received "' + typeof obj_actionData + '" (at "' + path_actionData + '")');
880
+ }
881
+ var obj_actionData_keys = ObjectKeys(obj_actionData);
882
+ for (var i = 0; i < obj_actionData_keys.length; i++) {
883
+ var key = obj_actionData_keys[i];
884
+ var obj_actionData_prop = obj_actionData[key];
885
+ var path_actionData_prop = path_actionData + '["' + key + '"]';
886
+ if (typeof obj_actionData_prop !== 'string') {
887
+ return new TypeError('Expected "string" but received "' + typeof obj_actionData_prop + '" (at "' + path_actionData_prop + '")');
888
+ }
889
+ }
890
+ }
891
+ if (obj.actionId !== undefined) {
892
+ var obj_actionId = obj.actionId;
893
+ var path_actionId = path + '.actionId';
894
+ if (typeof obj_actionId !== 'string') {
895
+ return new TypeError('Expected "string" but received "' + typeof obj_actionId + '" (at "' + path_actionId + '")');
896
+ }
897
+ }
898
+ })();
899
+ return v_error === undefined ? null : v_error;
900
+ }
901
+
902
+ var TTL$4 = 60000;
903
+ var VERSION$5 = "c8652b5c3ad8c532087704340d3cad55";
904
+ function validate$8(obj, path) {
905
+ if (path === void 0) { path = 'GenericOutputRepresentation'; }
906
+ var v_error = (function () {
907
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
908
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
909
+ }
910
+ var obj_id = obj.id;
911
+ var path_id = path + '.id';
912
+ if (typeof obj_id !== 'string') {
913
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
914
+ }
915
+ if (obj.isSuccess !== undefined) {
916
+ var obj_isSuccess = obj.isSuccess;
917
+ var path_isSuccess = path + '.isSuccess';
918
+ if (typeof obj_isSuccess !== 'boolean') {
919
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
920
+ }
921
+ }
922
+ })();
923
+ return v_error === undefined ? null : v_error;
924
+ }
925
+ var RepresentationType$5 = 'GenericOutputRepresentation';
926
+ function keyBuilder$c(luvio, config) {
927
+ return keyPrefix + '::' + RepresentationType$5 + ':' + config.id;
928
+ }
929
+ function keyBuilderFromType$3(luvio, object) {
930
+ var keyParams = {
931
+ id: object.id
932
+ };
933
+ return keyBuilder$c(luvio, keyParams);
934
+ }
935
+ function normalize$5(input, existing, path, luvio, store, timestamp) {
936
+ return input;
937
+ }
938
+ var select$g = function GenericOutputRepresentationSelect() {
939
+ return {
940
+ kind: 'Fragment',
941
+ version: VERSION$5,
942
+ private: [],
943
+ opaque: true
944
+ };
945
+ };
946
+ function equals$5(existing, incoming) {
947
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
948
+ return false;
949
+ }
950
+ return true;
951
+ }
952
+ function deepFreeze$6(input) {
953
+ ObjectFreeze(input);
954
+ }
955
+ var ingest$5 = function GenericOutputRepresentationIngest(input, path, luvio, store, timestamp) {
956
+ if (process.env.NODE_ENV !== 'production') {
957
+ var validateError = validate$8(input);
958
+ if (validateError !== null) {
959
+ throw validateError;
960
+ }
961
+ }
962
+ var key = keyBuilderFromType$3(luvio, input);
963
+ var existingRecord = store.readEntry(key);
964
+ var ttlToUse = TTL$4;
965
+ var incomingRecord = normalize$5(input, store.readEntry(key), {
966
+ fullPath: key,
967
+ parent: path.parent,
968
+ propertyName: path.propertyName,
969
+ ttl: ttlToUse
970
+ });
971
+ deepFreeze$6(input);
972
+ if (existingRecord === undefined || equals$5(existingRecord, incomingRecord) === false) {
973
+ luvio.storePublish(key, incomingRecord);
974
+ }
975
+ {
976
+ var storeMetadataParams = {
977
+ ttl: ttlToUse,
978
+ namespace: "clm",
979
+ version: VERSION$5,
980
+ representationName: RepresentationType$5,
981
+ };
982
+ luvio.publishStoreMetadata(key, storeMetadataParams);
983
+ }
984
+ return createLink(key);
985
+ };
986
+ function getTypeCacheKeys$5(luvio, input, fullPathFactory) {
987
+ var rootKeySet = new engine.StoreKeyMap();
988
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
989
+ var rootKey = keyBuilderFromType$3(luvio, input);
990
+ rootKeySet.set(rootKey, {
991
+ namespace: keyPrefix,
992
+ representationName: RepresentationType$5,
993
+ mergeable: false
994
+ });
995
+ return rootKeySet;
996
+ }
997
+
998
+ function select$f(luvio, params) {
999
+ return select$g();
1000
+ }
1001
+ function getResponseCacheKeys$b(luvio, resourceParams, response) {
1002
+ return getTypeCacheKeys$5(luvio, response);
1003
+ }
1004
+ function ingestSuccess$a(luvio, resourceParams, response) {
1005
+ var body = response.body;
1006
+ var key = keyBuilderFromType$3(luvio, body);
1007
+ luvio.storeIngest(key, ingest$5, body);
1008
+ var snapshot = luvio.storeLookup({
1009
+ recordId: key,
1010
+ node: select$f(),
1011
+ variables: {},
1012
+ });
1013
+ if (process.env.NODE_ENV !== 'production') {
1014
+ if (snapshot.state !== 'Fulfilled') {
1015
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1016
+ }
1017
+ }
1018
+ return snapshot;
1019
+ }
1020
+ function createResourceRequest$b(config) {
1021
+ var headers = {};
1022
+ return {
1023
+ baseUri: '/services/data/v58.0',
1024
+ basePath: '/connect/clm/contract/' + config.urlParams.contractId + '',
1025
+ method: 'patch',
1026
+ body: config.body,
1027
+ urlParams: config.urlParams,
1028
+ queryParams: {},
1029
+ headers: headers,
1030
+ priority: 'normal',
1031
+ };
1032
+ }
1033
+
1034
+ var executeContractAction_ConfigPropertyNames = {
1035
+ displayName: 'executeContractAction',
1036
+ parameters: {
1037
+ required: ['contractId', 'actionInput'],
1038
+ optional: []
1039
+ }
1040
+ };
1041
+ function createResourceParams$b(config) {
1042
+ var resourceParams = {
1043
+ urlParams: {
1044
+ contractId: config.contractId
1045
+ },
1046
+ body: {
1047
+ actionInput: config.actionInput
1048
+ }
1049
+ };
1050
+ return resourceParams;
1051
+ }
1052
+ function typeCheckConfig$b(untrustedConfig) {
1053
+ var config = {};
1054
+ var untrustedConfig_contractId = untrustedConfig.contractId;
1055
+ if (typeof untrustedConfig_contractId === 'string') {
1056
+ config.contractId = untrustedConfig_contractId;
1057
+ }
1058
+ var untrustedConfig_actionInput = untrustedConfig.actionInput;
1059
+ var referenceContractActionInputRepresentationValidationError = validate$9(untrustedConfig_actionInput);
1060
+ if (referenceContractActionInputRepresentationValidationError === null) {
1061
+ config.actionInput = untrustedConfig_actionInput;
1062
+ }
1063
+ return config;
1064
+ }
1065
+ function validateAdapterConfig$b(untrustedConfig, configPropertyNames) {
1066
+ if (!untrustedIsObject(untrustedConfig)) {
1067
+ return null;
1068
+ }
1069
+ if (process.env.NODE_ENV !== 'production') {
1070
+ validateConfig(untrustedConfig, configPropertyNames);
1071
+ }
1072
+ var config = typeCheckConfig$b(untrustedConfig);
1073
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1074
+ return null;
1075
+ }
1076
+ return config;
1077
+ }
1078
+ function buildNetworkSnapshot$b(luvio, config, options) {
1079
+ var resourceParams = createResourceParams$b(config);
1080
+ var request = createResourceRequest$b(resourceParams);
1081
+ return luvio.dispatchResourceRequest(request, options)
1082
+ .then(function (response) {
1083
+ return luvio.handleSuccessResponse(function () {
1084
+ var snapshot = ingestSuccess$a(luvio, resourceParams, response);
1085
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1086
+ }, function () { return getResponseCacheKeys$b(luvio, resourceParams, response.body); });
1087
+ }, function (response) {
1088
+ deepFreeze$b(response);
1089
+ throw response;
1090
+ });
1091
+ }
1092
+ var executeContractActionAdapterFactory = function (luvio) {
1093
+ return function executeContractAction(untrustedConfig) {
1094
+ var config = validateAdapterConfig$b(untrustedConfig, executeContractAction_ConfigPropertyNames);
1095
+ // Invalid or incomplete config
1096
+ if (config === null) {
1097
+ throw new Error('Invalid config for "executeContractAction"');
1098
+ }
1099
+ return buildNetworkSnapshot$b(luvio, config);
1100
+ };
1101
+ };
1102
+
1103
+ function validate$7(obj, path) {
1104
+ if (path === void 0) { path = 'ContractActionRepresentation'; }
1105
+ var v_error = (function () {
1106
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1107
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1108
+ }
1109
+ var obj_actionId = obj.actionId;
1110
+ var path_actionId = path + '.actionId';
1111
+ if (typeof obj_actionId !== 'string') {
1112
+ return new TypeError('Expected "string" but received "' + typeof obj_actionId + '" (at "' + path_actionId + '")');
1113
+ }
1114
+ if (obj.actionType !== undefined) {
1115
+ var obj_actionType = obj.actionType;
1116
+ var path_actionType = path + '.actionType';
1117
+ if (typeof obj_actionType !== 'string') {
1118
+ return new TypeError('Expected "string" but received "' + typeof obj_actionType + '" (at "' + path_actionType + '")');
1119
+ }
1120
+ }
1121
+ var obj_apiName = obj.apiName;
1122
+ var path_apiName = path + '.apiName';
1123
+ if (typeof obj_apiName !== 'string') {
1124
+ return new TypeError('Expected "string" but received "' + typeof obj_apiName + '" (at "' + path_apiName + '")');
1125
+ }
1126
+ if (obj.invocableClassName !== undefined) {
1127
+ var obj_invocableClassName = obj.invocableClassName;
1128
+ var path_invocableClassName = path + '.invocableClassName';
1129
+ if (typeof obj_invocableClassName !== 'string') {
1130
+ return new TypeError('Expected "string" but received "' + typeof obj_invocableClassName + '" (at "' + path_invocableClassName + '")');
1131
+ }
1132
+ }
1133
+ if (obj.invocableMethodName !== undefined) {
1134
+ var obj_invocableMethodName = obj.invocableMethodName;
1135
+ var path_invocableMethodName = path + '.invocableMethodName';
1136
+ if (typeof obj_invocableMethodName !== 'string') {
1137
+ return new TypeError('Expected "string" but received "' + typeof obj_invocableMethodName + '" (at "' + path_invocableMethodName + '")');
1138
+ }
1139
+ }
1140
+ if (obj.referenceObject !== undefined) {
1141
+ var obj_referenceObject = obj.referenceObject;
1142
+ var path_referenceObject = path + '.referenceObject';
1143
+ if (typeof obj_referenceObject !== 'string') {
1144
+ return new TypeError('Expected "string" but received "' + typeof obj_referenceObject + '" (at "' + path_referenceObject + '")');
1145
+ }
1146
+ }
1147
+ if (obj.referenceObjectId !== undefined) {
1148
+ var obj_referenceObjectId = obj.referenceObjectId;
1149
+ var path_referenceObjectId = path + '.referenceObjectId';
1150
+ if (typeof obj_referenceObjectId !== 'string') {
1151
+ return new TypeError('Expected "string" but received "' + typeof obj_referenceObjectId + '" (at "' + path_referenceObjectId + '")');
1152
+ }
1153
+ }
1154
+ var obj_uiText = obj.uiText;
1155
+ var path_uiText = path + '.uiText';
1156
+ if (typeof obj_uiText !== 'string') {
1157
+ return new TypeError('Expected "string" but received "' + typeof obj_uiText + '" (at "' + path_uiText + '")');
1158
+ }
1159
+ })();
1160
+ return v_error === undefined ? null : v_error;
1161
+ }
1162
+ function deepFreeze$5(input) {
1163
+ ObjectFreeze(input);
1164
+ }
1165
+
1166
+ var TTL$3 = 60000;
1167
+ var VERSION$4 = "2caf5349dc6c6aa44ef471df00f65bbd";
1168
+ function validate$6(obj, path) {
1169
+ if (path === void 0) { path = 'ContractActionListRepresentation'; }
1170
+ var v_error = (function () {
1171
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1172
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1173
+ }
1174
+ var obj_actions = obj.actions;
1175
+ var path_actions = path + '.actions';
1176
+ if (!ArrayIsArray(obj_actions)) {
1177
+ return new TypeError('Expected "array" but received "' + typeof obj_actions + '" (at "' + path_actions + '")');
1178
+ }
1179
+ for (var i = 0; i < obj_actions.length; i++) {
1180
+ var obj_actions_item = obj_actions[i];
1181
+ var path_actions_item = path_actions + '[' + i + ']';
1182
+ var referencepath_actions_itemValidationError = validate$7(obj_actions_item, path_actions_item);
1183
+ if (referencepath_actions_itemValidationError !== null) {
1184
+ var message = 'Object doesn\'t match ContractActionRepresentation (at "' + path_actions_item + '")\n';
1185
+ message += referencepath_actions_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1186
+ return new TypeError(message);
1187
+ }
1188
+ }
1189
+ var obj_contractId = obj.contractId;
1190
+ var path_contractId = path + '.contractId';
1191
+ if (typeof obj_contractId !== 'string') {
1192
+ return new TypeError('Expected "string" but received "' + typeof obj_contractId + '" (at "' + path_contractId + '")');
1193
+ }
1194
+ })();
1195
+ return v_error === undefined ? null : v_error;
1196
+ }
1197
+ var RepresentationType$4 = 'ContractActionListRepresentation';
1198
+ function keyBuilder$b(luvio, config) {
1199
+ return keyPrefix + '::' + RepresentationType$4 + ':' + config.contractId;
1200
+ }
1201
+ function keyBuilderFromType$2(luvio, object) {
1202
+ var keyParams = {
1203
+ contractId: object.contractId
1204
+ };
1205
+ return keyBuilder$b(luvio, keyParams);
1206
+ }
1207
+ function normalize$4(input, existing, path, luvio, store, timestamp) {
1208
+ return input;
1209
+ }
1210
+ var select$e = function ContractActionListRepresentationSelect() {
1211
+ return {
1212
+ kind: 'Fragment',
1213
+ version: VERSION$4,
1214
+ private: [],
1215
+ opaque: true
1216
+ };
1217
+ };
1218
+ function equals$4(existing, incoming) {
1219
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
1220
+ return false;
1221
+ }
1222
+ return true;
1223
+ }
1224
+ function deepFreeze$4(input) {
1225
+ var input_actions = input.actions;
1226
+ for (var i = 0; i < input_actions.length; i++) {
1227
+ var input_actions_item = input_actions[i];
1228
+ deepFreeze$5(input_actions_item);
1229
+ }
1230
+ ObjectFreeze(input_actions);
1231
+ ObjectFreeze(input);
1232
+ }
1233
+ var ingest$4 = function ContractActionListRepresentationIngest(input, path, luvio, store, timestamp) {
1234
+ if (process.env.NODE_ENV !== 'production') {
1235
+ var validateError = validate$6(input);
1236
+ if (validateError !== null) {
1237
+ throw validateError;
1238
+ }
1239
+ }
1240
+ var key = keyBuilderFromType$2(luvio, input);
1241
+ var existingRecord = store.readEntry(key);
1242
+ var ttlToUse = TTL$3;
1243
+ var incomingRecord = normalize$4(input, store.readEntry(key), {
1244
+ fullPath: key,
1245
+ parent: path.parent,
1246
+ propertyName: path.propertyName,
1247
+ ttl: ttlToUse
1248
+ });
1249
+ deepFreeze$4(input);
1250
+ if (existingRecord === undefined || equals$4(existingRecord, incomingRecord) === false) {
1251
+ luvio.storePublish(key, incomingRecord);
1252
+ }
1253
+ {
1254
+ var storeMetadataParams = {
1255
+ ttl: ttlToUse,
1256
+ namespace: "clm",
1257
+ version: VERSION$4,
1258
+ representationName: RepresentationType$4,
1259
+ };
1260
+ luvio.publishStoreMetadata(key, storeMetadataParams);
1261
+ }
1262
+ return createLink(key);
1263
+ };
1264
+ function getTypeCacheKeys$4(luvio, input, fullPathFactory) {
1265
+ var rootKeySet = new engine.StoreKeyMap();
1266
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1267
+ var rootKey = keyBuilderFromType$2(luvio, input);
1268
+ rootKeySet.set(rootKey, {
1269
+ namespace: keyPrefix,
1270
+ representationName: RepresentationType$4,
1271
+ mergeable: false
1272
+ });
1273
+ return rootKeySet;
1274
+ }
1275
+
1276
+ function select$d(luvio, params) {
1277
+ return select$e();
1278
+ }
1279
+ function keyBuilder$a(luvio, params) {
1280
+ return keyBuilder$b(luvio, {
1281
+ contractId: params.urlParams.contractId
1282
+ });
1283
+ }
1284
+ function getResponseCacheKeys$a(luvio, resourceParams, response) {
1285
+ return getTypeCacheKeys$4(luvio, response);
1286
+ }
1287
+ function ingestSuccess$9(luvio, resourceParams, response, snapshotRefresh) {
1288
+ var body = response.body;
1289
+ var key = keyBuilder$a(luvio, resourceParams);
1290
+ luvio.storeIngest(key, ingest$4, body);
1291
+ var snapshot = luvio.storeLookup({
1292
+ recordId: key,
1293
+ node: select$d(),
1294
+ variables: {},
1295
+ }, snapshotRefresh);
1296
+ if (process.env.NODE_ENV !== 'production') {
1297
+ if (snapshot.state !== 'Fulfilled') {
1298
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1299
+ }
1300
+ }
1301
+ return snapshot;
1302
+ }
1303
+ function ingestError$3(luvio, params, error, snapshotRefresh) {
1304
+ var key = keyBuilder$a(luvio, params);
1305
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1306
+ var storeMetadataParams = {
1307
+ ttl: TTL$3,
1308
+ namespace: keyPrefix,
1309
+ version: VERSION$4,
1310
+ representationName: RepresentationType$4
1311
+ };
1312
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1313
+ return errorSnapshot;
1314
+ }
1315
+ function createResourceRequest$a(config) {
1316
+ var headers = {};
1317
+ return {
1318
+ baseUri: '/services/data/v58.0',
1319
+ basePath: '/connect/clm/contract/' + config.urlParams.contractId + '/contract-actions',
1320
+ method: 'get',
1321
+ body: null,
1322
+ urlParams: config.urlParams,
1323
+ queryParams: {},
1324
+ headers: headers,
1325
+ priority: 'normal',
1326
+ };
1327
+ }
1328
+
1329
+ var getContractActions_ConfigPropertyNames = {
1330
+ displayName: 'getContractActions',
1331
+ parameters: {
1332
+ required: ['contractId'],
1333
+ optional: []
1334
+ }
1335
+ };
1336
+ function createResourceParams$a(config) {
1337
+ var resourceParams = {
1338
+ urlParams: {
1339
+ contractId: config.contractId
1340
+ }
1341
+ };
1342
+ return resourceParams;
1343
+ }
1344
+ function keyBuilder$9(luvio, config) {
1345
+ var resourceParams = createResourceParams$a(config);
1346
+ return keyBuilder$a(luvio, resourceParams);
1347
+ }
1348
+ function typeCheckConfig$a(untrustedConfig) {
1349
+ var config = {};
1350
+ var untrustedConfig_contractId = untrustedConfig.contractId;
1351
+ if (typeof untrustedConfig_contractId === 'string') {
1352
+ config.contractId = untrustedConfig_contractId;
1353
+ }
1354
+ return config;
1355
+ }
1356
+ function validateAdapterConfig$a(untrustedConfig, configPropertyNames) {
1357
+ if (!untrustedIsObject(untrustedConfig)) {
1358
+ return null;
1359
+ }
1360
+ if (process.env.NODE_ENV !== 'production') {
1361
+ validateConfig(untrustedConfig, configPropertyNames);
1362
+ }
1363
+ var config = typeCheckConfig$a(untrustedConfig);
1364
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1365
+ return null;
1366
+ }
1367
+ return config;
1368
+ }
1369
+ function adapterFragment$3(luvio, config) {
1370
+ createResourceParams$a(config);
1371
+ return select$d();
1372
+ }
1373
+ function onFetchResponseSuccess$3(luvio, config, resourceParams, response) {
1374
+ var snapshot = ingestSuccess$9(luvio, resourceParams, response, {
1375
+ config: config,
1376
+ resolve: function () { return buildNetworkSnapshot$a(luvio, config, snapshotRefreshOptions); }
1377
+ });
1378
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1379
+ }
1380
+ function onFetchResponseError$3(luvio, config, resourceParams, response) {
1381
+ var snapshot = ingestError$3(luvio, resourceParams, response, {
1382
+ config: config,
1383
+ resolve: function () { return buildNetworkSnapshot$a(luvio, config, snapshotRefreshOptions); }
1384
+ });
1385
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1386
+ }
1387
+ function buildNetworkSnapshot$a(luvio, config, options) {
1388
+ var resourceParams = createResourceParams$a(config);
1389
+ var request = createResourceRequest$a(resourceParams);
1390
+ return luvio.dispatchResourceRequest(request, options)
1391
+ .then(function (response) {
1392
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess$3(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$a(luvio, resourceParams, response.body); });
1393
+ }, function (response) {
1394
+ return luvio.handleErrorResponse(function () { return onFetchResponseError$3(luvio, config, resourceParams, response); });
1395
+ });
1396
+ }
1397
+ function buildNetworkSnapshotCachePolicy$3(context, coercedAdapterRequestContext) {
1398
+ var luvio = context.luvio, config = context.config;
1399
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
1400
+ var dispatchOptions = {
1401
+ resourceRequestContext: {
1402
+ requestCorrelator: requestCorrelator,
1403
+ luvioRequestMethod: undefined,
1404
+ },
1405
+ eventObservers: eventObservers
1406
+ };
1407
+ if (networkPriority !== 'normal') {
1408
+ dispatchOptions.overrides = {
1409
+ priority: networkPriority
1410
+ };
1411
+ }
1412
+ return buildNetworkSnapshot$a(luvio, config, dispatchOptions);
1413
+ }
1414
+ function buildCachedSnapshotCachePolicy$3(context, storeLookup) {
1415
+ var luvio = context.luvio, config = context.config;
1416
+ var selector = {
1417
+ recordId: keyBuilder$9(luvio, config),
1418
+ node: adapterFragment$3(luvio, config),
1419
+ variables: {},
1420
+ };
1421
+ var cacheSnapshot = storeLookup(selector, {
1422
+ config: config,
1423
+ resolve: function () { return buildNetworkSnapshot$a(luvio, config, snapshotRefreshOptions); }
1424
+ });
1425
+ return cacheSnapshot;
1426
+ }
1427
+ var getContractActionsAdapterFactory = function (luvio) { return function clm__getContractActions(untrustedConfig, requestContext) {
1428
+ var config = validateAdapterConfig$a(untrustedConfig, getContractActions_ConfigPropertyNames);
1429
+ // Invalid or incomplete config
1430
+ if (config === null) {
1431
+ return null;
1432
+ }
1433
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
1434
+ buildCachedSnapshotCachePolicy$3, buildNetworkSnapshotCachePolicy$3);
1435
+ }; };
1436
+
1437
+ function select$c(luvio, params) {
1438
+ return select$i();
1439
+ }
1440
+ function getResponseCacheKeys$9(luvio, resourceParams, response) {
1441
+ return getTypeCacheKeys$6(luvio, response);
1442
+ }
1443
+ function ingestSuccess$8(luvio, resourceParams, response) {
1444
+ var body = response.body;
1445
+ var key = keyBuilderFromType$4(luvio, body);
1446
+ luvio.storeIngest(key, ingest$6, body);
1447
+ var snapshot = luvio.storeLookup({
1448
+ recordId: key,
1449
+ node: select$c(),
1450
+ variables: {},
1451
+ });
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 createResourceRequest$9(config) {
1460
+ var headers = {};
1461
+ return {
1462
+ baseUri: '/services/data/v58.0',
1463
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '',
1464
+ method: 'patch',
1465
+ body: config.body,
1466
+ urlParams: config.urlParams,
1467
+ queryParams: {},
1468
+ headers: headers,
1469
+ priority: 'normal',
1470
+ };
1471
+ }
1472
+
1473
+ var updateContractDocumentVersionWithTemplate_ConfigPropertyNames = {
1474
+ displayName: 'updateContractDocumentVersionWithTemplate',
1475
+ parameters: {
1476
+ required: ['contractDocumentVersionId', 'templateInput'],
1477
+ optional: []
1478
+ }
1479
+ };
1480
+ function createResourceParams$9(config) {
1481
+ var resourceParams = {
1482
+ urlParams: {
1483
+ contractDocumentVersionId: config.contractDocumentVersionId
1484
+ },
1485
+ body: {
1486
+ templateInput: config.templateInput
1487
+ }
1488
+ };
1489
+ return resourceParams;
1490
+ }
1491
+ function typeCheckConfig$9(untrustedConfig) {
1492
+ var config = {};
1493
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
1494
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
1495
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
1496
+ }
1497
+ var untrustedConfig_templateInput = untrustedConfig.templateInput;
1498
+ var referenceTemplateInputRepresentationValidationError = validate$c(untrustedConfig_templateInput);
1499
+ if (referenceTemplateInputRepresentationValidationError === null) {
1500
+ config.templateInput = untrustedConfig_templateInput;
1501
+ }
1502
+ return config;
1503
+ }
1504
+ function validateAdapterConfig$9(untrustedConfig, configPropertyNames) {
1505
+ if (!untrustedIsObject(untrustedConfig)) {
1506
+ return null;
1507
+ }
1508
+ if (process.env.NODE_ENV !== 'production') {
1509
+ validateConfig(untrustedConfig, configPropertyNames);
1510
+ }
1511
+ var config = typeCheckConfig$9(untrustedConfig);
1512
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1513
+ return null;
1514
+ }
1515
+ return config;
1516
+ }
1517
+ function buildNetworkSnapshot$9(luvio, config, options) {
1518
+ var resourceParams = createResourceParams$9(config);
1519
+ var request = createResourceRequest$9(resourceParams);
1520
+ return luvio.dispatchResourceRequest(request, options)
1521
+ .then(function (response) {
1522
+ return luvio.handleSuccessResponse(function () {
1523
+ var snapshot = ingestSuccess$8(luvio, resourceParams, response);
1524
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1525
+ }, function () { return getResponseCacheKeys$9(luvio, resourceParams, response.body); });
1526
+ }, function (response) {
1527
+ deepFreeze$b(response);
1528
+ throw response;
1529
+ });
1530
+ }
1531
+ var updateContractDocumentVersionWithTemplateAdapterFactory = function (luvio) {
1532
+ return function updateContractDocumentVersionWithTemplate(untrustedConfig) {
1533
+ var config = validateAdapterConfig$9(untrustedConfig, updateContractDocumentVersionWithTemplate_ConfigPropertyNames);
1534
+ // Invalid or incomplete config
1535
+ if (config === null) {
1536
+ throw new Error('Invalid config for "updateContractDocumentVersionWithTemplate"');
1537
+ }
1538
+ return buildNetworkSnapshot$9(luvio, config);
1539
+ };
1540
+ };
1541
+
1542
+ function select$b(luvio, params) {
1543
+ return select$g();
1544
+ }
1545
+ function getResponseCacheKeys$8(luvio, resourceParams, response) {
1546
+ return getTypeCacheKeys$5(luvio, response);
1547
+ }
1548
+ function ingestSuccess$7(luvio, resourceParams, response) {
1549
+ var body = response.body;
1550
+ var key = keyBuilderFromType$3(luvio, body);
1551
+ luvio.storeIngest(key, ingest$5, body);
1552
+ var snapshot = luvio.storeLookup({
1553
+ recordId: key,
1554
+ node: select$b(),
1555
+ variables: {},
1556
+ });
1557
+ if (process.env.NODE_ENV !== 'production') {
1558
+ if (snapshot.state !== 'Fulfilled') {
1559
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1560
+ }
1561
+ }
1562
+ return snapshot;
1563
+ }
1564
+ function createResourceRequest$8(config) {
1565
+ var headers = {};
1566
+ return {
1567
+ baseUri: '/services/data/v58.0',
1568
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '/checkIn',
1569
+ method: 'patch',
1570
+ body: null,
1571
+ urlParams: config.urlParams,
1572
+ queryParams: {},
1573
+ headers: headers,
1574
+ priority: 'normal',
1575
+ };
1576
+ }
1577
+
1578
+ var checkIn_ConfigPropertyNames = {
1579
+ displayName: 'checkIn',
1580
+ parameters: {
1581
+ required: ['contractDocumentVersionId'],
1582
+ optional: []
1583
+ }
1584
+ };
1585
+ function createResourceParams$8(config) {
1586
+ var resourceParams = {
1587
+ urlParams: {
1588
+ contractDocumentVersionId: config.contractDocumentVersionId
1589
+ }
1590
+ };
1591
+ return resourceParams;
1592
+ }
1593
+ function typeCheckConfig$8(untrustedConfig) {
1594
+ var config = {};
1595
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
1596
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
1597
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
1598
+ }
1599
+ return config;
1600
+ }
1601
+ function validateAdapterConfig$8(untrustedConfig, configPropertyNames) {
1602
+ if (!untrustedIsObject(untrustedConfig)) {
1603
+ return null;
1604
+ }
1605
+ if (process.env.NODE_ENV !== 'production') {
1606
+ validateConfig(untrustedConfig, configPropertyNames);
1607
+ }
1608
+ var config = typeCheckConfig$8(untrustedConfig);
1609
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1610
+ return null;
1611
+ }
1612
+ return config;
1613
+ }
1614
+ function buildNetworkSnapshot$8(luvio, config, options) {
1615
+ var resourceParams = createResourceParams$8(config);
1616
+ var request = createResourceRequest$8(resourceParams);
1617
+ return luvio.dispatchResourceRequest(request, options)
1618
+ .then(function (response) {
1619
+ return luvio.handleSuccessResponse(function () {
1620
+ var snapshot = ingestSuccess$7(luvio, resourceParams, response);
1621
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1622
+ }, function () { return getResponseCacheKeys$8(luvio, resourceParams, response.body); });
1623
+ }, function (response) {
1624
+ deepFreeze$b(response);
1625
+ throw response;
1626
+ });
1627
+ }
1628
+ var checkInAdapterFactory = function (luvio) {
1629
+ return function checkIn(untrustedConfig) {
1630
+ var config = validateAdapterConfig$8(untrustedConfig, checkIn_ConfigPropertyNames);
1631
+ // Invalid or incomplete config
1632
+ if (config === null) {
1633
+ throw new Error('Invalid config for "checkIn"');
1634
+ }
1635
+ return buildNetworkSnapshot$8(luvio, config);
1636
+ };
1637
+ };
1638
+
1639
+ function select$a(luvio, params) {
1640
+ return select$i();
1641
+ }
1642
+ function getResponseCacheKeys$7(luvio, resourceParams, response) {
1643
+ return getTypeCacheKeys$6(luvio, response);
1644
+ }
1645
+ function ingestSuccess$6(luvio, resourceParams, response) {
1646
+ var body = response.body;
1647
+ var key = keyBuilderFromType$4(luvio, body);
1648
+ luvio.storeIngest(key, ingest$6, body);
1649
+ var snapshot = luvio.storeLookup({
1650
+ recordId: key,
1651
+ node: select$a(),
1652
+ variables: {},
1653
+ });
1654
+ if (process.env.NODE_ENV !== 'production') {
1655
+ if (snapshot.state !== 'Fulfilled') {
1656
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1657
+ }
1658
+ }
1659
+ return snapshot;
1660
+ }
1661
+ function createResourceRequest$7(config) {
1662
+ var headers = {};
1663
+ return {
1664
+ baseUri: '/services/data/v58.0',
1665
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '/checkout',
1666
+ method: 'post',
1667
+ body: config.body,
1668
+ urlParams: config.urlParams,
1669
+ queryParams: {},
1670
+ headers: headers,
1671
+ priority: 'normal',
1672
+ };
1673
+ }
1674
+
1675
+ var checkoutContractDocumentVersion_ConfigPropertyNames = {
1676
+ displayName: 'checkoutContractDocumentVersion',
1677
+ parameters: {
1678
+ required: ['contractDocumentVersionId', 'templateInput'],
1679
+ optional: []
1680
+ }
1681
+ };
1682
+ function createResourceParams$7(config) {
1683
+ var resourceParams = {
1684
+ urlParams: {
1685
+ contractDocumentVersionId: config.contractDocumentVersionId
1686
+ },
1687
+ body: {
1688
+ templateInput: config.templateInput
1689
+ }
1690
+ };
1691
+ return resourceParams;
1692
+ }
1693
+ function typeCheckConfig$7(untrustedConfig) {
1694
+ var config = {};
1695
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
1696
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
1697
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
1698
+ }
1699
+ var untrustedConfig_templateInput = untrustedConfig.templateInput;
1700
+ var referenceTemplateInputRepresentationValidationError = validate$c(untrustedConfig_templateInput);
1701
+ if (referenceTemplateInputRepresentationValidationError === null) {
1702
+ config.templateInput = untrustedConfig_templateInput;
1703
+ }
1704
+ return config;
1705
+ }
1706
+ function validateAdapterConfig$7(untrustedConfig, configPropertyNames) {
1707
+ if (!untrustedIsObject(untrustedConfig)) {
1708
+ return null;
1709
+ }
1710
+ if (process.env.NODE_ENV !== 'production') {
1711
+ validateConfig(untrustedConfig, configPropertyNames);
1712
+ }
1713
+ var config = typeCheckConfig$7(untrustedConfig);
1714
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1715
+ return null;
1716
+ }
1717
+ return config;
1718
+ }
1719
+ function buildNetworkSnapshot$7(luvio, config, options) {
1720
+ var resourceParams = createResourceParams$7(config);
1721
+ var request = createResourceRequest$7(resourceParams);
1722
+ return luvio.dispatchResourceRequest(request, options)
1723
+ .then(function (response) {
1724
+ return luvio.handleSuccessResponse(function () {
1725
+ var snapshot = ingestSuccess$6(luvio, resourceParams, response);
1726
+ return luvio.storeBroadcast().then(function () { return snapshot; });
1727
+ }, function () { return getResponseCacheKeys$7(luvio, resourceParams, response.body); });
1728
+ }, function (response) {
1729
+ deepFreeze$b(response);
1730
+ throw response;
1731
+ });
1732
+ }
1733
+ var checkoutContractDocumentVersionAdapterFactory = function (luvio) {
1734
+ return function checkoutContractDocumentVersion(untrustedConfig) {
1735
+ var config = validateAdapterConfig$7(untrustedConfig, checkoutContractDocumentVersion_ConfigPropertyNames);
1736
+ // Invalid or incomplete config
1737
+ if (config === null) {
1738
+ throw new Error('Invalid config for "checkoutContractDocumentVersion"');
1739
+ }
1740
+ return buildNetworkSnapshot$7(luvio, config);
1741
+ };
1742
+ };
1743
+
1744
+ var TTL$2 = 60000;
1745
+ var VERSION$3 = "dce4365dead9ca97204892d274fbf1b7";
1746
+ function validate$5(obj, path) {
1747
+ if (path === void 0) { path = 'ContentDocumentListRepresentation'; }
1748
+ var v_error = (function () {
1749
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
1750
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
1751
+ }
1752
+ var obj_contractDocumentVersionId = obj.contractDocumentVersionId;
1753
+ var path_contractDocumentVersionId = path + '.contractDocumentVersionId';
1754
+ if (typeof obj_contractDocumentVersionId !== 'string') {
1755
+ return new TypeError('Expected "string" but received "' + typeof obj_contractDocumentVersionId + '" (at "' + path_contractDocumentVersionId + '")');
1756
+ }
1757
+ if (obj.data !== undefined) {
1758
+ var obj_data = obj.data;
1759
+ var path_data = path + '.data';
1760
+ if (!ArrayIsArray(obj_data)) {
1761
+ return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
1762
+ }
1763
+ for (var i = 0; i < obj_data.length; i++) {
1764
+ var obj_data_item = obj_data[i];
1765
+ var path_data_item = path_data + '[' + i + ']';
1766
+ var referencepath_data_itemValidationError = validate$b(obj_data_item, path_data_item);
1767
+ if (referencepath_data_itemValidationError !== null) {
1768
+ var message = 'Object doesn\'t match ContentDocumentRepresentation (at "' + path_data_item + '")\n';
1769
+ message += referencepath_data_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
1770
+ return new TypeError(message);
1771
+ }
1772
+ }
1773
+ }
1774
+ })();
1775
+ return v_error === undefined ? null : v_error;
1776
+ }
1777
+ var RepresentationType$3 = 'ContentDocumentListRepresentation';
1778
+ function keyBuilder$8(luvio, config) {
1779
+ return keyPrefix + '::' + RepresentationType$3 + ':' + config.contractDocumentVersionId;
1780
+ }
1781
+ function keyBuilderFromType$1(luvio, object) {
1782
+ var keyParams = {
1783
+ contractDocumentVersionId: object.contractDocumentVersionId
1784
+ };
1785
+ return keyBuilder$8(luvio, keyParams);
1786
+ }
1787
+ function normalize$3(input, existing, path, luvio, store, timestamp) {
1788
+ return input;
1789
+ }
1790
+ var select$9 = function ContentDocumentListRepresentationSelect() {
1791
+ return {
1792
+ kind: 'Fragment',
1793
+ version: VERSION$3,
1794
+ private: [],
1795
+ opaque: true
1796
+ };
1797
+ };
1798
+ function equals$3(existing, incoming) {
1799
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
1800
+ return false;
1801
+ }
1802
+ return true;
1803
+ }
1804
+ function deepFreeze$3(input) {
1805
+ var input_data = input.data;
1806
+ if (input_data !== undefined) {
1807
+ for (var i = 0; i < input_data.length; i++) {
1808
+ var input_data_item = input_data[i];
1809
+ deepFreeze$8(input_data_item);
1810
+ }
1811
+ ObjectFreeze(input_data);
1812
+ }
1813
+ ObjectFreeze(input);
1814
+ }
1815
+ var ingest$3 = function ContentDocumentListRepresentationIngest(input, path, luvio, store, timestamp) {
1816
+ if (process.env.NODE_ENV !== 'production') {
1817
+ var validateError = validate$5(input);
1818
+ if (validateError !== null) {
1819
+ throw validateError;
1820
+ }
1821
+ }
1822
+ var key = keyBuilderFromType$1(luvio, input);
1823
+ var existingRecord = store.readEntry(key);
1824
+ var ttlToUse = TTL$2;
1825
+ var incomingRecord = normalize$3(input, store.readEntry(key), {
1826
+ fullPath: key,
1827
+ parent: path.parent,
1828
+ propertyName: path.propertyName,
1829
+ ttl: ttlToUse
1830
+ });
1831
+ deepFreeze$3(input);
1832
+ if (existingRecord === undefined || equals$3(existingRecord, incomingRecord) === false) {
1833
+ luvio.storePublish(key, incomingRecord);
1834
+ }
1835
+ {
1836
+ var storeMetadataParams = {
1837
+ ttl: ttlToUse,
1838
+ namespace: "clm",
1839
+ version: VERSION$3,
1840
+ representationName: RepresentationType$3,
1841
+ };
1842
+ luvio.publishStoreMetadata(key, storeMetadataParams);
1843
+ }
1844
+ return createLink(key);
1845
+ };
1846
+ function getTypeCacheKeys$3(luvio, input, fullPathFactory) {
1847
+ var rootKeySet = new engine.StoreKeyMap();
1848
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
1849
+ var rootKey = keyBuilderFromType$1(luvio, input);
1850
+ rootKeySet.set(rootKey, {
1851
+ namespace: keyPrefix,
1852
+ representationName: RepresentationType$3,
1853
+ mergeable: false
1854
+ });
1855
+ return rootKeySet;
1856
+ }
1857
+
1858
+ function keyBuilder$7(luvio, params) {
1859
+ return keyBuilder$8(luvio, {
1860
+ contractDocumentVersionId: params.urlParams.contractDocumentVersionId
1861
+ });
1862
+ }
1863
+ function getResponseCacheKeys$6(luvio, resourceParams) {
1864
+ var key = keyBuilder$7(luvio, resourceParams);
1865
+ var cacheKeyMap = new engine.StoreKeyMap();
1866
+ cacheKeyMap.set(key, {
1867
+ namespace: keyPrefix,
1868
+ representationName: RepresentationType$3,
1869
+ mergeable: false
1870
+ });
1871
+ return cacheKeyMap;
1872
+ }
1873
+ function evictSuccess(luvio, resourceParams) {
1874
+ var key = keyBuilder$7(luvio, resourceParams);
1875
+ luvio.storeEvict(key);
1876
+ }
1877
+ function createResourceRequest$6(config) {
1878
+ var headers = {};
1879
+ return {
1880
+ baseUri: '/services/data/v58.0',
1881
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '/content-documents',
1882
+ method: 'delete',
1883
+ body: null,
1884
+ urlParams: config.urlParams,
1885
+ queryParams: config.queryParams,
1886
+ headers: headers,
1887
+ priority: 'normal',
1888
+ };
1889
+ }
1890
+
1891
+ var adapterName = 'deleteAttachment';
1892
+ var deleteAttachment_ConfigPropertyNames = {
1893
+ displayName: 'deleteAttachment',
1894
+ parameters: {
1895
+ required: ['contractDocumentVersionId'],
1896
+ optional: ['contentDocumentId']
1897
+ }
1898
+ };
1899
+ function createResourceParams$6(config) {
1900
+ var resourceParams = {
1901
+ urlParams: {
1902
+ contractDocumentVersionId: config.contractDocumentVersionId
1903
+ },
1904
+ queryParams: {
1905
+ contentDocumentId: config.contentDocumentId
1906
+ }
1907
+ };
1908
+ return resourceParams;
1909
+ }
1910
+ function typeCheckConfig$6(untrustedConfig) {
1911
+ var config = {};
1912
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
1913
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
1914
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
1915
+ }
1916
+ var untrustedConfig_contentDocumentId = untrustedConfig.contentDocumentId;
1917
+ if (typeof untrustedConfig_contentDocumentId === 'string') {
1918
+ config.contentDocumentId = untrustedConfig_contentDocumentId;
1919
+ }
1920
+ return config;
1921
+ }
1922
+ function validateAdapterConfig$6(untrustedConfig, configPropertyNames) {
1923
+ if (!untrustedIsObject(untrustedConfig)) {
1924
+ return null;
1925
+ }
1926
+ if (process.env.NODE_ENV !== 'production') {
1927
+ validateConfig(untrustedConfig, configPropertyNames);
1928
+ }
1929
+ var config = typeCheckConfig$6(untrustedConfig);
1930
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
1931
+ return null;
1932
+ }
1933
+ return config;
1934
+ }
1935
+ function buildNetworkSnapshot$6(luvio, config, options) {
1936
+ var resourceParams = createResourceParams$6(config);
1937
+ var request = createResourceRequest$6(resourceParams);
1938
+ return luvio.dispatchResourceRequest(request, options)
1939
+ .then(function () {
1940
+ return luvio.handleSuccessResponse(function () {
1941
+ evictSuccess(luvio, resourceParams);
1942
+ return luvio.storeBroadcast();
1943
+ }, function () { return getResponseCacheKeys$6(luvio, resourceParams); });
1944
+ }, function (response) {
1945
+ deepFreeze$b(response);
1946
+ throw response;
1947
+ });
1948
+ }
1949
+ var deleteAttachmentAdapterFactory = function (luvio) {
1950
+ return function clmdeleteAttachment(untrustedConfig) {
1951
+ var config = validateAdapterConfig$6(untrustedConfig, deleteAttachment_ConfigPropertyNames);
1952
+ // Invalid or incomplete config
1953
+ if (config === null) {
1954
+ throw new Error("Invalid config for \"".concat(adapterName, "\""));
1955
+ }
1956
+ return buildNetworkSnapshot$6(luvio, config);
1957
+ };
1958
+ };
1959
+
1960
+ function select$8(luvio, params) {
1961
+ return select$9();
1962
+ }
1963
+ function keyBuilder$6(luvio, params) {
1964
+ return keyBuilder$8(luvio, {
1965
+ contractDocumentVersionId: params.urlParams.contractDocumentVersionId
1966
+ });
1967
+ }
1968
+ function getResponseCacheKeys$5(luvio, resourceParams, response) {
1969
+ return getTypeCacheKeys$3(luvio, response);
1970
+ }
1971
+ function ingestSuccess$5(luvio, resourceParams, response, snapshotRefresh) {
1972
+ var body = response.body;
1973
+ var key = keyBuilder$6(luvio, resourceParams);
1974
+ luvio.storeIngest(key, ingest$3, body);
1975
+ var snapshot = luvio.storeLookup({
1976
+ recordId: key,
1977
+ node: select$8(),
1978
+ variables: {},
1979
+ }, snapshotRefresh);
1980
+ if (process.env.NODE_ENV !== 'production') {
1981
+ if (snapshot.state !== 'Fulfilled') {
1982
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
1983
+ }
1984
+ }
1985
+ return snapshot;
1986
+ }
1987
+ function ingestError$2(luvio, params, error, snapshotRefresh) {
1988
+ var key = keyBuilder$6(luvio, params);
1989
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
1990
+ var storeMetadataParams = {
1991
+ ttl: TTL$2,
1992
+ namespace: keyPrefix,
1993
+ version: VERSION$3,
1994
+ representationName: RepresentationType$3
1995
+ };
1996
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
1997
+ return errorSnapshot;
1998
+ }
1999
+ function createResourceRequest$5(config) {
2000
+ var headers = {};
2001
+ return {
2002
+ baseUri: '/services/data/v58.0',
2003
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '/content-documents',
2004
+ method: 'get',
2005
+ body: null,
2006
+ urlParams: config.urlParams,
2007
+ queryParams: {},
2008
+ headers: headers,
2009
+ priority: 'normal',
2010
+ };
2011
+ }
2012
+
2013
+ var getContentDocument_ConfigPropertyNames = {
2014
+ displayName: 'getContentDocument',
2015
+ parameters: {
2016
+ required: ['contractDocumentVersionId'],
2017
+ optional: []
2018
+ }
2019
+ };
2020
+ function createResourceParams$5(config) {
2021
+ var resourceParams = {
2022
+ urlParams: {
2023
+ contractDocumentVersionId: config.contractDocumentVersionId
2024
+ }
2025
+ };
2026
+ return resourceParams;
2027
+ }
2028
+ function keyBuilder$5(luvio, config) {
2029
+ var resourceParams = createResourceParams$5(config);
2030
+ return keyBuilder$6(luvio, resourceParams);
2031
+ }
2032
+ function typeCheckConfig$5(untrustedConfig) {
2033
+ var config = {};
2034
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
2035
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
2036
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
2037
+ }
2038
+ return config;
2039
+ }
2040
+ function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
2041
+ if (!untrustedIsObject(untrustedConfig)) {
2042
+ return null;
2043
+ }
2044
+ if (process.env.NODE_ENV !== 'production') {
2045
+ validateConfig(untrustedConfig, configPropertyNames);
2046
+ }
2047
+ var config = typeCheckConfig$5(untrustedConfig);
2048
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2049
+ return null;
2050
+ }
2051
+ return config;
2052
+ }
2053
+ function adapterFragment$2(luvio, config) {
2054
+ createResourceParams$5(config);
2055
+ return select$8();
2056
+ }
2057
+ function onFetchResponseSuccess$2(luvio, config, resourceParams, response) {
2058
+ var snapshot = ingestSuccess$5(luvio, resourceParams, response, {
2059
+ config: config,
2060
+ resolve: function () { return buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions); }
2061
+ });
2062
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2063
+ }
2064
+ function onFetchResponseError$2(luvio, config, resourceParams, response) {
2065
+ var snapshot = ingestError$2(luvio, resourceParams, response, {
2066
+ config: config,
2067
+ resolve: function () { return buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions); }
2068
+ });
2069
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2070
+ }
2071
+ function buildNetworkSnapshot$5(luvio, config, options) {
2072
+ var resourceParams = createResourceParams$5(config);
2073
+ var request = createResourceRequest$5(resourceParams);
2074
+ return luvio.dispatchResourceRequest(request, options)
2075
+ .then(function (response) {
2076
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess$2(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$5(luvio, resourceParams, response.body); });
2077
+ }, function (response) {
2078
+ return luvio.handleErrorResponse(function () { return onFetchResponseError$2(luvio, config, resourceParams, response); });
2079
+ });
2080
+ }
2081
+ function buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext) {
2082
+ var luvio = context.luvio, config = context.config;
2083
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
2084
+ var dispatchOptions = {
2085
+ resourceRequestContext: {
2086
+ requestCorrelator: requestCorrelator,
2087
+ luvioRequestMethod: undefined,
2088
+ },
2089
+ eventObservers: eventObservers
2090
+ };
2091
+ if (networkPriority !== 'normal') {
2092
+ dispatchOptions.overrides = {
2093
+ priority: networkPriority
2094
+ };
2095
+ }
2096
+ return buildNetworkSnapshot$5(luvio, config, dispatchOptions);
2097
+ }
2098
+ function buildCachedSnapshotCachePolicy$2(context, storeLookup) {
2099
+ var luvio = context.luvio, config = context.config;
2100
+ var selector = {
2101
+ recordId: keyBuilder$5(luvio, config),
2102
+ node: adapterFragment$2(luvio, config),
2103
+ variables: {},
2104
+ };
2105
+ var cacheSnapshot = storeLookup(selector, {
2106
+ config: config,
2107
+ resolve: function () { return buildNetworkSnapshot$5(luvio, config, snapshotRefreshOptions); }
2108
+ });
2109
+ return cacheSnapshot;
2110
+ }
2111
+ var getContentDocumentAdapterFactory = function (luvio) { return function clm__getContentDocument(untrustedConfig, requestContext) {
2112
+ var config = validateAdapterConfig$5(untrustedConfig, getContentDocument_ConfigPropertyNames);
2113
+ // Invalid or incomplete config
2114
+ if (config === null) {
2115
+ return null;
2116
+ }
2117
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
2118
+ buildCachedSnapshotCachePolicy$2, buildNetworkSnapshotCachePolicy$2);
2119
+ }; };
2120
+
2121
+ function select$7(luvio, params) {
2122
+ return select$g();
2123
+ }
2124
+ function getResponseCacheKeys$4(luvio, resourceParams, response) {
2125
+ return getTypeCacheKeys$5(luvio, response);
2126
+ }
2127
+ function ingestSuccess$4(luvio, resourceParams, response) {
2128
+ var body = response.body;
2129
+ var key = keyBuilderFromType$3(luvio, body);
2130
+ luvio.storeIngest(key, ingest$5, body);
2131
+ var snapshot = luvio.storeLookup({
2132
+ recordId: key,
2133
+ node: select$7(),
2134
+ variables: {},
2135
+ });
2136
+ if (process.env.NODE_ENV !== 'production') {
2137
+ if (snapshot.state !== 'Fulfilled') {
2138
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2139
+ }
2140
+ }
2141
+ return snapshot;
2142
+ }
2143
+ function createResourceRequest$4(config) {
2144
+ var headers = {};
2145
+ return {
2146
+ baseUri: '/services/data/v58.0',
2147
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '/lock',
2148
+ method: 'patch',
2149
+ body: null,
2150
+ urlParams: config.urlParams,
2151
+ queryParams: {},
2152
+ headers: headers,
2153
+ priority: 'normal',
2154
+ };
2155
+ }
2156
+
2157
+ var lockContractDocumentVersion_ConfigPropertyNames = {
2158
+ displayName: 'lockContractDocumentVersion',
2159
+ parameters: {
2160
+ required: ['contractDocumentVersionId'],
2161
+ optional: []
2162
+ }
2163
+ };
2164
+ function createResourceParams$4(config) {
2165
+ var resourceParams = {
2166
+ urlParams: {
2167
+ contractDocumentVersionId: config.contractDocumentVersionId
2168
+ }
2169
+ };
2170
+ return resourceParams;
2171
+ }
2172
+ function typeCheckConfig$4(untrustedConfig) {
2173
+ var config = {};
2174
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
2175
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
2176
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
2177
+ }
2178
+ return config;
2179
+ }
2180
+ function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
2181
+ if (!untrustedIsObject(untrustedConfig)) {
2182
+ return null;
2183
+ }
2184
+ if (process.env.NODE_ENV !== 'production') {
2185
+ validateConfig(untrustedConfig, configPropertyNames);
2186
+ }
2187
+ var config = typeCheckConfig$4(untrustedConfig);
2188
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2189
+ return null;
2190
+ }
2191
+ return config;
2192
+ }
2193
+ function buildNetworkSnapshot$4(luvio, config, options) {
2194
+ var resourceParams = createResourceParams$4(config);
2195
+ var request = createResourceRequest$4(resourceParams);
2196
+ return luvio.dispatchResourceRequest(request, options)
2197
+ .then(function (response) {
2198
+ return luvio.handleSuccessResponse(function () {
2199
+ var snapshot = ingestSuccess$4(luvio, resourceParams, response);
2200
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2201
+ }, function () { return getResponseCacheKeys$4(luvio, resourceParams, response.body); });
2202
+ }, function (response) {
2203
+ deepFreeze$b(response);
2204
+ throw response;
2205
+ });
2206
+ }
2207
+ var lockContractDocumentVersionAdapterFactory = function (luvio) {
2208
+ return function lockContractDocumentVersion(untrustedConfig) {
2209
+ var config = validateAdapterConfig$4(untrustedConfig, lockContractDocumentVersion_ConfigPropertyNames);
2210
+ // Invalid or incomplete config
2211
+ if (config === null) {
2212
+ throw new Error('Invalid config for "lockContractDocumentVersion"');
2213
+ }
2214
+ return buildNetworkSnapshot$4(luvio, config);
2215
+ };
2216
+ };
2217
+
2218
+ function select$6(luvio, params) {
2219
+ return select$g();
2220
+ }
2221
+ function getResponseCacheKeys$3(luvio, resourceParams, response) {
2222
+ return getTypeCacheKeys$5(luvio, response);
2223
+ }
2224
+ function ingestSuccess$3(luvio, resourceParams, response) {
2225
+ var body = response.body;
2226
+ var key = keyBuilderFromType$3(luvio, body);
2227
+ luvio.storeIngest(key, ingest$5, body);
2228
+ var snapshot = luvio.storeLookup({
2229
+ recordId: key,
2230
+ node: select$6(),
2231
+ variables: {},
2232
+ });
2233
+ if (process.env.NODE_ENV !== 'production') {
2234
+ if (snapshot.state !== 'Fulfilled') {
2235
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2236
+ }
2237
+ }
2238
+ return snapshot;
2239
+ }
2240
+ function createResourceRequest$3(config) {
2241
+ var headers = {};
2242
+ return {
2243
+ baseUri: '/services/data/v58.0',
2244
+ basePath: '/connect/clm/contract-document-version/' + config.urlParams.contractDocumentVersionId + '/unlock',
2245
+ method: 'patch',
2246
+ body: null,
2247
+ urlParams: config.urlParams,
2248
+ queryParams: {},
2249
+ headers: headers,
2250
+ priority: 'normal',
2251
+ };
2252
+ }
2253
+
2254
+ var unlock_ConfigPropertyNames = {
2255
+ displayName: 'unlock',
2256
+ parameters: {
2257
+ required: ['contractDocumentVersionId'],
2258
+ optional: []
2259
+ }
2260
+ };
2261
+ function createResourceParams$3(config) {
2262
+ var resourceParams = {
2263
+ urlParams: {
2264
+ contractDocumentVersionId: config.contractDocumentVersionId
2265
+ }
2266
+ };
2267
+ return resourceParams;
2268
+ }
2269
+ function typeCheckConfig$3(untrustedConfig) {
2270
+ var config = {};
2271
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
2272
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
2273
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
2274
+ }
2275
+ return config;
2276
+ }
2277
+ function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
2278
+ if (!untrustedIsObject(untrustedConfig)) {
2279
+ return null;
2280
+ }
2281
+ if (process.env.NODE_ENV !== 'production') {
2282
+ validateConfig(untrustedConfig, configPropertyNames);
2283
+ }
2284
+ var config = typeCheckConfig$3(untrustedConfig);
2285
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2286
+ return null;
2287
+ }
2288
+ return config;
2289
+ }
2290
+ function buildNetworkSnapshot$3(luvio, config, options) {
2291
+ var resourceParams = createResourceParams$3(config);
2292
+ var request = createResourceRequest$3(resourceParams);
2293
+ return luvio.dispatchResourceRequest(request, options)
2294
+ .then(function (response) {
2295
+ return luvio.handleSuccessResponse(function () {
2296
+ var snapshot = ingestSuccess$3(luvio, resourceParams, response);
2297
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2298
+ }, function () { return getResponseCacheKeys$3(luvio, resourceParams, response.body); });
2299
+ }, function (response) {
2300
+ deepFreeze$b(response);
2301
+ throw response;
2302
+ });
2303
+ }
2304
+ var unlockAdapterFactory = function (luvio) {
2305
+ return function unlock(untrustedConfig) {
2306
+ var config = validateAdapterConfig$3(untrustedConfig, unlock_ConfigPropertyNames);
2307
+ // Invalid or incomplete config
2308
+ if (config === null) {
2309
+ throw new Error('Invalid config for "unlock"');
2310
+ }
2311
+ return buildNetworkSnapshot$3(luvio, config);
2312
+ };
2313
+ };
2314
+
2315
+ var VERSION$2 = "108316884026f0999c72cbecfb179629";
2316
+ function validate$4(obj, path) {
2317
+ if (path === void 0) { path = 'DocumentGenerationProcessStatusRepresentation'; }
2318
+ var v_error = (function () {
2319
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2320
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2321
+ }
2322
+ if (obj.contentDocuments !== undefined) {
2323
+ var obj_contentDocuments = obj.contentDocuments;
2324
+ var path_contentDocuments = path + '.contentDocuments';
2325
+ if (!ArrayIsArray(obj_contentDocuments)) {
2326
+ return new TypeError('Expected "array" but received "' + typeof obj_contentDocuments + '" (at "' + path_contentDocuments + '")');
2327
+ }
2328
+ for (var i = 0; i < obj_contentDocuments.length; i++) {
2329
+ var obj_contentDocuments_item = obj_contentDocuments[i];
2330
+ var path_contentDocuments_item = path_contentDocuments + '[' + i + ']';
2331
+ var referencepath_contentDocuments_itemValidationError = validate$b(obj_contentDocuments_item, path_contentDocuments_item);
2332
+ if (referencepath_contentDocuments_itemValidationError !== null) {
2333
+ var message = 'Object doesn\'t match ContentDocumentRepresentation (at "' + path_contentDocuments_item + '")\n';
2334
+ message += referencepath_contentDocuments_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
2335
+ return new TypeError(message);
2336
+ }
2337
+ }
2338
+ }
2339
+ var obj_contractDocumentVersionId = obj.contractDocumentVersionId;
2340
+ var path_contractDocumentVersionId = path + '.contractDocumentVersionId';
2341
+ if (typeof obj_contractDocumentVersionId !== 'string') {
2342
+ return new TypeError('Expected "string" but received "' + typeof obj_contractDocumentVersionId + '" (at "' + path_contractDocumentVersionId + '")');
2343
+ }
2344
+ if (obj.documentGenerationProcessId !== undefined) {
2345
+ var obj_documentGenerationProcessId = obj.documentGenerationProcessId;
2346
+ var path_documentGenerationProcessId = path + '.documentGenerationProcessId';
2347
+ if (typeof obj_documentGenerationProcessId !== 'string') {
2348
+ return new TypeError('Expected "string" but received "' + typeof obj_documentGenerationProcessId + '" (at "' + path_documentGenerationProcessId + '")');
2349
+ }
2350
+ }
2351
+ if (obj.documentUrl !== undefined) {
2352
+ var obj_documentUrl = obj.documentUrl;
2353
+ var path_documentUrl = path + '.documentUrl';
2354
+ if (typeof obj_documentUrl !== 'string') {
2355
+ return new TypeError('Expected "string" but received "' + typeof obj_documentUrl + '" (at "' + path_documentUrl + '")');
2356
+ }
2357
+ }
2358
+ if (obj.name !== undefined) {
2359
+ var obj_name = obj.name;
2360
+ var path_name = path + '.name';
2361
+ if (typeof obj_name !== 'string') {
2362
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
2363
+ }
2364
+ }
2365
+ if (obj.responseText !== undefined) {
2366
+ var obj_responseText = obj.responseText;
2367
+ var path_responseText = path + '.responseText';
2368
+ if (typeof obj_responseText !== 'string') {
2369
+ return new TypeError('Expected "string" but received "' + typeof obj_responseText + '" (at "' + path_responseText + '")');
2370
+ }
2371
+ }
2372
+ if (obj.status !== undefined) {
2373
+ var obj_status = obj.status;
2374
+ var path_status = path + '.status';
2375
+ if (typeof obj_status !== 'string') {
2376
+ return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
2377
+ }
2378
+ }
2379
+ })();
2380
+ return v_error === undefined ? null : v_error;
2381
+ }
2382
+ var RepresentationType$2 = 'DocumentGenerationProcessStatusRepresentation';
2383
+ function normalize$2(input, existing, path, luvio, store, timestamp) {
2384
+ return input;
2385
+ }
2386
+ var select$5 = function DocumentGenerationProcessStatusRepresentationSelect() {
2387
+ var _a = select$j(), ContentDocumentRepresentation__selections = _a.selections;
2388
+ return {
2389
+ kind: 'Fragment',
2390
+ version: VERSION$2,
2391
+ private: [],
2392
+ selections: [
2393
+ {
2394
+ name: 'contentDocuments',
2395
+ kind: 'Object',
2396
+ plural: true,
2397
+ selections: ContentDocumentRepresentation__selections,
2398
+ required: false
2399
+ },
2400
+ {
2401
+ name: 'contractDocumentVersionId',
2402
+ kind: 'Scalar'
2403
+ },
2404
+ {
2405
+ name: 'documentGenerationProcessId',
2406
+ kind: 'Scalar',
2407
+ required: false
2408
+ },
2409
+ {
2410
+ name: 'documentUrl',
2411
+ kind: 'Scalar',
2412
+ required: false
2413
+ },
2414
+ {
2415
+ name: 'name',
2416
+ kind: 'Scalar',
2417
+ required: false
2418
+ },
2419
+ {
2420
+ name: 'responseText',
2421
+ kind: 'Scalar',
2422
+ required: false
2423
+ },
2424
+ {
2425
+ name: 'status',
2426
+ kind: 'Scalar',
2427
+ required: false
2428
+ }
2429
+ ]
2430
+ };
2431
+ };
2432
+ function equals$2(existing, incoming) {
2433
+ var existing_contractDocumentVersionId = existing.contractDocumentVersionId;
2434
+ var incoming_contractDocumentVersionId = incoming.contractDocumentVersionId;
2435
+ if (!(existing_contractDocumentVersionId === incoming_contractDocumentVersionId)) {
2436
+ return false;
2437
+ }
2438
+ var existing_documentGenerationProcessId = existing.documentGenerationProcessId;
2439
+ var incoming_documentGenerationProcessId = incoming.documentGenerationProcessId;
2440
+ // if at least one of these optionals is defined
2441
+ if (existing_documentGenerationProcessId !== undefined || incoming_documentGenerationProcessId !== undefined) {
2442
+ // if one of these is not defined we know the other is defined and therefore
2443
+ // not equal
2444
+ if (existing_documentGenerationProcessId === undefined || incoming_documentGenerationProcessId === undefined) {
2445
+ return false;
2446
+ }
2447
+ if (!(existing_documentGenerationProcessId === incoming_documentGenerationProcessId)) {
2448
+ return false;
2449
+ }
2450
+ }
2451
+ var existing_documentUrl = existing.documentUrl;
2452
+ var incoming_documentUrl = incoming.documentUrl;
2453
+ // if at least one of these optionals is defined
2454
+ if (existing_documentUrl !== undefined || incoming_documentUrl !== undefined) {
2455
+ // if one of these is not defined we know the other is defined and therefore
2456
+ // not equal
2457
+ if (existing_documentUrl === undefined || incoming_documentUrl === undefined) {
2458
+ return false;
2459
+ }
2460
+ if (!(existing_documentUrl === incoming_documentUrl)) {
2461
+ return false;
2462
+ }
2463
+ }
2464
+ var existing_name = existing.name;
2465
+ var incoming_name = incoming.name;
2466
+ // if at least one of these optionals is defined
2467
+ if (existing_name !== undefined || incoming_name !== undefined) {
2468
+ // if one of these is not defined we know the other is defined and therefore
2469
+ // not equal
2470
+ if (existing_name === undefined || incoming_name === undefined) {
2471
+ return false;
2472
+ }
2473
+ if (!(existing_name === incoming_name)) {
2474
+ return false;
2475
+ }
2476
+ }
2477
+ var existing_responseText = existing.responseText;
2478
+ var incoming_responseText = incoming.responseText;
2479
+ // if at least one of these optionals is defined
2480
+ if (existing_responseText !== undefined || incoming_responseText !== undefined) {
2481
+ // if one of these is not defined we know the other is defined and therefore
2482
+ // not equal
2483
+ if (existing_responseText === undefined || incoming_responseText === undefined) {
2484
+ return false;
2485
+ }
2486
+ if (!(existing_responseText === incoming_responseText)) {
2487
+ return false;
2488
+ }
2489
+ }
2490
+ var existing_status = existing.status;
2491
+ var incoming_status = incoming.status;
2492
+ // if at least one of these optionals is defined
2493
+ if (existing_status !== undefined || incoming_status !== undefined) {
2494
+ // if one of these is not defined we know the other is defined and therefore
2495
+ // not equal
2496
+ if (existing_status === undefined || incoming_status === undefined) {
2497
+ return false;
2498
+ }
2499
+ if (!(existing_status === incoming_status)) {
2500
+ return false;
2501
+ }
2502
+ }
2503
+ var existing_contentDocuments = existing.contentDocuments;
2504
+ var incoming_contentDocuments = incoming.contentDocuments;
2505
+ // if at least one of these optionals is defined
2506
+ if (existing_contentDocuments !== undefined || incoming_contentDocuments !== undefined) {
2507
+ // if one of these is not defined we know the other is defined and therefore
2508
+ // not equal
2509
+ if (existing_contentDocuments === undefined || incoming_contentDocuments === undefined) {
2510
+ return false;
2511
+ }
2512
+ var equals_contentDocuments_items = equalsArray(existing_contentDocuments, incoming_contentDocuments, function (existing_contentDocuments_item, incoming_contentDocuments_item) {
2513
+ if (!(equals$7(existing_contentDocuments_item, incoming_contentDocuments_item))) {
2514
+ return false;
2515
+ }
2516
+ });
2517
+ if (equals_contentDocuments_items === false) {
2518
+ return false;
2519
+ }
2520
+ }
2521
+ return true;
2522
+ }
2523
+ var ingest$2 = function DocumentGenerationProcessStatusRepresentationIngest(input, path, luvio, store, timestamp) {
2524
+ if (process.env.NODE_ENV !== 'production') {
2525
+ var validateError = validate$4(input);
2526
+ if (validateError !== null) {
2527
+ throw validateError;
2528
+ }
2529
+ }
2530
+ var key = path.fullPath;
2531
+ var existingRecord = store.readEntry(key);
2532
+ var ttlToUse = path.ttl !== undefined ? path.ttl : 360000;
2533
+ var incomingRecord = normalize$2(input, store.readEntry(key), {
2534
+ fullPath: key,
2535
+ parent: path.parent,
2536
+ propertyName: path.propertyName,
2537
+ ttl: ttlToUse
2538
+ });
2539
+ if (existingRecord === undefined || equals$2(existingRecord, incomingRecord) === false) {
2540
+ luvio.storePublish(key, incomingRecord);
2541
+ }
2542
+ if (ttlToUse !== undefined) {
2543
+ var storeMetadataParams = {
2544
+ ttl: ttlToUse,
2545
+ namespace: "clm",
2546
+ version: VERSION$2,
2547
+ representationName: RepresentationType$2,
2548
+ };
2549
+ luvio.publishStoreMetadata(key, storeMetadataParams);
2550
+ }
2551
+ return createLink(key);
2552
+ };
2553
+ function getTypeCacheKeys$2(luvio, input, fullPathFactory) {
2554
+ var rootKeySet = new engine.StoreKeyMap();
2555
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2556
+ var rootKey = fullPathFactory();
2557
+ rootKeySet.set(rootKey, {
2558
+ namespace: keyPrefix,
2559
+ representationName: RepresentationType$2,
2560
+ mergeable: false
2561
+ });
2562
+ return rootKeySet;
2563
+ }
2564
+
2565
+ function select$4(luvio, params) {
2566
+ return select$5();
2567
+ }
2568
+ function keyBuilder$4(luvio, params) {
2569
+ return keyPrefix + '::DocumentGenerationProcessStatusRepresentation:(' + 'contractDocumentVersionId:' + params.queryParams.contractDocumentVersionId + ')';
2570
+ }
2571
+ function getResponseCacheKeys$2(luvio, resourceParams, response) {
2572
+ return getTypeCacheKeys$2(luvio, response, function () { return keyBuilder$4(luvio, resourceParams); });
2573
+ }
2574
+ function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
2575
+ var body = response.body;
2576
+ var key = keyBuilder$4(luvio, resourceParams);
2577
+ luvio.storeIngest(key, ingest$2, body);
2578
+ var snapshot = luvio.storeLookup({
2579
+ recordId: key,
2580
+ node: select$4(),
2581
+ variables: {},
2582
+ }, snapshotRefresh);
2583
+ if (process.env.NODE_ENV !== 'production') {
2584
+ if (snapshot.state !== 'Fulfilled') {
2585
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2586
+ }
2587
+ }
2588
+ return snapshot;
2589
+ }
2590
+ function ingestError$1(luvio, params, error, snapshotRefresh) {
2591
+ var key = keyBuilder$4(luvio, params);
2592
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
2593
+ luvio.storeIngestError(key, errorSnapshot);
2594
+ return errorSnapshot;
2595
+ }
2596
+ function createResourceRequest$2(config) {
2597
+ var headers = {};
2598
+ return {
2599
+ baseUri: '/services/data/v58.0',
2600
+ basePath: '/connect/clm/document-generation-process/status',
2601
+ method: 'get',
2602
+ body: null,
2603
+ urlParams: {},
2604
+ queryParams: config.queryParams,
2605
+ headers: headers,
2606
+ priority: 'normal',
2607
+ };
2608
+ }
2609
+
2610
+ var getDocumentGenerationProcessDetails_ConfigPropertyNames = {
2611
+ displayName: 'getDocumentGenerationProcessDetails',
2612
+ parameters: {
2613
+ required: [],
2614
+ optional: ['contractDocumentVersionId']
2615
+ }
2616
+ };
2617
+ function createResourceParams$2(config) {
2618
+ var resourceParams = {
2619
+ queryParams: {
2620
+ contractDocumentVersionId: config.contractDocumentVersionId
2621
+ }
2622
+ };
2623
+ return resourceParams;
2624
+ }
2625
+ function keyBuilder$3(luvio, config) {
2626
+ var resourceParams = createResourceParams$2(config);
2627
+ return keyBuilder$4(luvio, resourceParams);
2628
+ }
2629
+ function typeCheckConfig$2(untrustedConfig) {
2630
+ var config = {};
2631
+ var untrustedConfig_contractDocumentVersionId = untrustedConfig.contractDocumentVersionId;
2632
+ if (typeof untrustedConfig_contractDocumentVersionId === 'string') {
2633
+ config.contractDocumentVersionId = untrustedConfig_contractDocumentVersionId;
2634
+ }
2635
+ return config;
2636
+ }
2637
+ function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
2638
+ if (!untrustedIsObject(untrustedConfig)) {
2639
+ return null;
2640
+ }
2641
+ if (process.env.NODE_ENV !== 'production') {
2642
+ validateConfig(untrustedConfig, configPropertyNames);
2643
+ }
2644
+ var config = typeCheckConfig$2(untrustedConfig);
2645
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2646
+ return null;
2647
+ }
2648
+ return config;
2649
+ }
2650
+ function adapterFragment$1(luvio, config) {
2651
+ createResourceParams$2(config);
2652
+ return select$4();
2653
+ }
2654
+ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
2655
+ var snapshot = ingestSuccess$2(luvio, resourceParams, response, {
2656
+ config: config,
2657
+ resolve: function () { return buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions); }
2658
+ });
2659
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2660
+ }
2661
+ function onFetchResponseError$1(luvio, config, resourceParams, response) {
2662
+ var snapshot = ingestError$1(luvio, resourceParams, response, {
2663
+ config: config,
2664
+ resolve: function () { return buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions); }
2665
+ });
2666
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2667
+ }
2668
+ function buildNetworkSnapshot$2(luvio, config, options) {
2669
+ var resourceParams = createResourceParams$2(config);
2670
+ var request = createResourceRequest$2(resourceParams);
2671
+ return luvio.dispatchResourceRequest(request, options)
2672
+ .then(function (response) {
2673
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess$1(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$2(luvio, resourceParams, response.body); });
2674
+ }, function (response) {
2675
+ return luvio.handleErrorResponse(function () { return onFetchResponseError$1(luvio, config, resourceParams, response); });
2676
+ });
2677
+ }
2678
+ function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
2679
+ var luvio = context.luvio, config = context.config;
2680
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
2681
+ var dispatchOptions = {
2682
+ resourceRequestContext: {
2683
+ requestCorrelator: requestCorrelator,
2684
+ luvioRequestMethod: undefined,
2685
+ },
2686
+ eventObservers: eventObservers
2687
+ };
2688
+ if (networkPriority !== 'normal') {
2689
+ dispatchOptions.overrides = {
2690
+ priority: networkPriority
2691
+ };
2692
+ }
2693
+ return buildNetworkSnapshot$2(luvio, config, dispatchOptions);
2694
+ }
2695
+ function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
2696
+ var luvio = context.luvio, config = context.config;
2697
+ var selector = {
2698
+ recordId: keyBuilder$3(luvio, config),
2699
+ node: adapterFragment$1(luvio, config),
2700
+ variables: {},
2701
+ };
2702
+ var cacheSnapshot = storeLookup(selector, {
2703
+ config: config,
2704
+ resolve: function () { return buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions); }
2705
+ });
2706
+ return cacheSnapshot;
2707
+ }
2708
+ var getDocumentGenerationProcessDetailsAdapterFactory = function (luvio) { return function clm__getDocumentGenerationProcessDetails(untrustedConfig, requestContext) {
2709
+ var config = validateAdapterConfig$2(untrustedConfig, getDocumentGenerationProcessDetails_ConfigPropertyNames);
2710
+ // Invalid or incomplete config
2711
+ if (config === null) {
2712
+ return null;
2713
+ }
2714
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
2715
+ buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
2716
+ }; };
2717
+
2718
+ function validate$3(obj, path) {
2719
+ if (path === void 0) { path = 'TemplateRepresentation'; }
2720
+ var v_error = (function () {
2721
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2722
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2723
+ }
2724
+ var obj_id = obj.id;
2725
+ var path_id = path + '.id';
2726
+ if (typeof obj_id !== 'string') {
2727
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
2728
+ }
2729
+ var obj_isActive = obj.isActive;
2730
+ var path_isActive = path + '.isActive';
2731
+ if (typeof obj_isActive !== 'boolean') {
2732
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isActive + '" (at "' + path_isActive + '")');
2733
+ }
2734
+ var obj_name = obj.name;
2735
+ var path_name = path + '.name';
2736
+ if (typeof obj_name !== 'string') {
2737
+ return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
2738
+ }
2739
+ var obj_type = obj.type;
2740
+ var path_type = path + '.type';
2741
+ if (typeof obj_type !== 'string') {
2742
+ return new TypeError('Expected "string" but received "' + typeof obj_type + '" (at "' + path_type + '")');
2743
+ }
2744
+ var obj_version = obj.version;
2745
+ var path_version = path + '.version';
2746
+ if (typeof obj_version !== 'number' || (typeof obj_version === 'number' && Math.floor(obj_version) !== obj_version)) {
2747
+ return new TypeError('Expected "integer" but received "' + typeof obj_version + '" (at "' + path_version + '")');
2748
+ }
2749
+ })();
2750
+ return v_error === undefined ? null : v_error;
2751
+ }
2752
+ function deepFreeze$2(input) {
2753
+ ObjectFreeze(input);
2754
+ }
2755
+
2756
+ var TTL$1 = 60000;
2757
+ var VERSION$1 = "f3cbbe481890c87cbcb6b12993f6383c";
2758
+ function validate$2(obj, path) {
2759
+ if (path === void 0) { path = 'TemplateListRepresentation'; }
2760
+ var v_error = (function () {
2761
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
2762
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
2763
+ }
2764
+ if (obj.code !== undefined) {
2765
+ var obj_code = obj.code;
2766
+ var path_code = path + '.code';
2767
+ if (typeof obj_code !== 'string') {
2768
+ return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
2769
+ }
2770
+ }
2771
+ var obj_data = obj.data;
2772
+ var path_data = path + '.data';
2773
+ if (!ArrayIsArray(obj_data)) {
2774
+ return new TypeError('Expected "array" but received "' + typeof obj_data + '" (at "' + path_data + '")');
2775
+ }
2776
+ for (var i = 0; i < obj_data.length; i++) {
2777
+ var obj_data_item = obj_data[i];
2778
+ var path_data_item = path_data + '[' + i + ']';
2779
+ var referencepath_data_itemValidationError = validate$3(obj_data_item, path_data_item);
2780
+ if (referencepath_data_itemValidationError !== null) {
2781
+ var message = 'Object doesn\'t match TemplateRepresentation (at "' + path_data_item + '")\n';
2782
+ message += referencepath_data_itemValidationError.message.split('\n').map(function (line) { return '\t' + line; }).join('\n');
2783
+ return new TypeError(message);
2784
+ }
2785
+ }
2786
+ if (obj.message !== undefined) {
2787
+ var obj_message = obj.message;
2788
+ var path_message = path + '.message';
2789
+ if (typeof obj_message !== 'string') {
2790
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
2791
+ }
2792
+ }
2793
+ })();
2794
+ return v_error === undefined ? null : v_error;
2795
+ }
2796
+ var RepresentationType$1 = 'TemplateListRepresentation';
2797
+ function normalize$1(input, existing, path, luvio, store, timestamp) {
2798
+ return input;
2799
+ }
2800
+ var select$3 = function TemplateListRepresentationSelect() {
2801
+ return {
2802
+ kind: 'Fragment',
2803
+ version: VERSION$1,
2804
+ private: [],
2805
+ opaque: true
2806
+ };
2807
+ };
2808
+ function equals$1(existing, incoming) {
2809
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
2810
+ return false;
2811
+ }
2812
+ return true;
2813
+ }
2814
+ function deepFreeze$1(input) {
2815
+ var input_data = input.data;
2816
+ for (var i = 0; i < input_data.length; i++) {
2817
+ var input_data_item = input_data[i];
2818
+ deepFreeze$2(input_data_item);
2819
+ }
2820
+ ObjectFreeze(input_data);
2821
+ ObjectFreeze(input);
2822
+ }
2823
+ var ingest$1 = function TemplateListRepresentationIngest(input, path, luvio, store, timestamp) {
2824
+ if (process.env.NODE_ENV !== 'production') {
2825
+ var validateError = validate$2(input);
2826
+ if (validateError !== null) {
2827
+ throw validateError;
2828
+ }
2829
+ }
2830
+ var key = path.fullPath;
2831
+ var existingRecord = store.readEntry(key);
2832
+ var ttlToUse = TTL$1;
2833
+ var incomingRecord = normalize$1(input, store.readEntry(key), {
2834
+ fullPath: key,
2835
+ parent: path.parent,
2836
+ propertyName: path.propertyName,
2837
+ ttl: ttlToUse
2838
+ });
2839
+ deepFreeze$1(input);
2840
+ if (existingRecord === undefined || equals$1(existingRecord, incomingRecord) === false) {
2841
+ luvio.storePublish(key, incomingRecord);
2842
+ }
2843
+ {
2844
+ var storeMetadataParams = {
2845
+ ttl: ttlToUse,
2846
+ namespace: "clm",
2847
+ version: VERSION$1,
2848
+ representationName: RepresentationType$1,
2849
+ };
2850
+ luvio.publishStoreMetadata(key, storeMetadataParams);
2851
+ }
2852
+ return createLink(key);
2853
+ };
2854
+ function getTypeCacheKeys$1(luvio, input, fullPathFactory) {
2855
+ var rootKeySet = new engine.StoreKeyMap();
2856
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
2857
+ var rootKey = fullPathFactory();
2858
+ rootKeySet.set(rootKey, {
2859
+ namespace: keyPrefix,
2860
+ representationName: RepresentationType$1,
2861
+ mergeable: false
2862
+ });
2863
+ return rootKeySet;
2864
+ }
2865
+
2866
+ function select$2(luvio, params) {
2867
+ return select$3();
2868
+ }
2869
+ function keyBuilder$2(luvio, params) {
2870
+ return keyPrefix + '::TemplateListRepresentation:(' + 'isActive:' + params.queryParams.isActive + ',' + 'type:' + params.queryParams.type + ',' + 'usageType:' + params.queryParams.usageType + ',' + 'contractId:' + params.queryParams.contractId + ',' + 'documentTemplateTypes:' + params.queryParams.documentTemplateTypes + ')';
2871
+ }
2872
+ function getResponseCacheKeys$1(luvio, resourceParams, response) {
2873
+ return getTypeCacheKeys$1(luvio, response, function () { return keyBuilder$2(luvio, resourceParams); });
2874
+ }
2875
+ function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
2876
+ var body = response.body;
2877
+ var key = keyBuilder$2(luvio, resourceParams);
2878
+ luvio.storeIngest(key, ingest$1, body);
2879
+ var snapshot = luvio.storeLookup({
2880
+ recordId: key,
2881
+ node: select$2(),
2882
+ variables: {},
2883
+ }, snapshotRefresh);
2884
+ if (process.env.NODE_ENV !== 'production') {
2885
+ if (snapshot.state !== 'Fulfilled') {
2886
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
2887
+ }
2888
+ }
2889
+ return snapshot;
2890
+ }
2891
+ function ingestError(luvio, params, error, snapshotRefresh) {
2892
+ var key = keyBuilder$2(luvio, params);
2893
+ var errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
2894
+ var storeMetadataParams = {
2895
+ ttl: TTL$1,
2896
+ namespace: keyPrefix,
2897
+ version: VERSION$1,
2898
+ representationName: RepresentationType$1
2899
+ };
2900
+ luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
2901
+ return errorSnapshot;
2902
+ }
2903
+ function createResourceRequest$1(config) {
2904
+ var headers = {};
2905
+ return {
2906
+ baseUri: '/services/data/v58.0',
2907
+ basePath: '/connect/clm/document-template',
2908
+ method: 'get',
2909
+ body: null,
2910
+ urlParams: {},
2911
+ queryParams: config.queryParams,
2912
+ headers: headers,
2913
+ priority: 'normal',
2914
+ };
2915
+ }
2916
+
2917
+ var getTemplates_ConfigPropertyNames = {
2918
+ displayName: 'getTemplates',
2919
+ parameters: {
2920
+ required: [],
2921
+ optional: ['isActive', 'type', 'usageType', 'contractId', 'documentTemplateTypes']
2922
+ }
2923
+ };
2924
+ function createResourceParams$1(config) {
2925
+ var resourceParams = {
2926
+ queryParams: {
2927
+ isActive: config.isActive, type: config.type, usageType: config.usageType, contractId: config.contractId, documentTemplateTypes: config.documentTemplateTypes
2928
+ }
2929
+ };
2930
+ return resourceParams;
2931
+ }
2932
+ function keyBuilder$1(luvio, config) {
2933
+ var resourceParams = createResourceParams$1(config);
2934
+ return keyBuilder$2(luvio, resourceParams);
2935
+ }
2936
+ function typeCheckConfig$1(untrustedConfig) {
2937
+ var config = {};
2938
+ var untrustedConfig_isActive = untrustedConfig.isActive;
2939
+ if (typeof untrustedConfig_isActive === 'boolean') {
2940
+ config.isActive = untrustedConfig_isActive;
2941
+ }
2942
+ var untrustedConfig_type = untrustedConfig.type;
2943
+ if (typeof untrustedConfig_type === 'string') {
2944
+ config.type = untrustedConfig_type;
2945
+ }
2946
+ var untrustedConfig_usageType = untrustedConfig.usageType;
2947
+ if (typeof untrustedConfig_usageType === 'string') {
2948
+ config.usageType = untrustedConfig_usageType;
2949
+ }
2950
+ var untrustedConfig_contractId = untrustedConfig.contractId;
2951
+ if (typeof untrustedConfig_contractId === 'string') {
2952
+ config.contractId = untrustedConfig_contractId;
2953
+ }
2954
+ var untrustedConfig_documentTemplateTypes = untrustedConfig.documentTemplateTypes;
2955
+ if (ArrayIsArray$1(untrustedConfig_documentTemplateTypes)) {
2956
+ var untrustedConfig_documentTemplateTypes_array = [];
2957
+ for (var i = 0, arrayLength = untrustedConfig_documentTemplateTypes.length; i < arrayLength; i++) {
2958
+ var untrustedConfig_documentTemplateTypes_item = untrustedConfig_documentTemplateTypes[i];
2959
+ if (typeof untrustedConfig_documentTemplateTypes_item === 'string') {
2960
+ untrustedConfig_documentTemplateTypes_array.push(untrustedConfig_documentTemplateTypes_item);
2961
+ }
2962
+ }
2963
+ config.documentTemplateTypes = untrustedConfig_documentTemplateTypes_array;
2964
+ }
2965
+ return config;
2966
+ }
2967
+ function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
2968
+ if (!untrustedIsObject(untrustedConfig)) {
2969
+ return null;
2970
+ }
2971
+ if (process.env.NODE_ENV !== 'production') {
2972
+ validateConfig(untrustedConfig, configPropertyNames);
2973
+ }
2974
+ var config = typeCheckConfig$1(untrustedConfig);
2975
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
2976
+ return null;
2977
+ }
2978
+ return config;
2979
+ }
2980
+ function adapterFragment(luvio, config) {
2981
+ createResourceParams$1(config);
2982
+ return select$2();
2983
+ }
2984
+ function onFetchResponseSuccess(luvio, config, resourceParams, response) {
2985
+ var snapshot = ingestSuccess$1(luvio, resourceParams, response, {
2986
+ config: config,
2987
+ resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
2988
+ });
2989
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2990
+ }
2991
+ function onFetchResponseError(luvio, config, resourceParams, response) {
2992
+ var snapshot = ingestError(luvio, resourceParams, response, {
2993
+ config: config,
2994
+ resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
2995
+ });
2996
+ return luvio.storeBroadcast().then(function () { return snapshot; });
2997
+ }
2998
+ function buildNetworkSnapshot$1(luvio, config, options) {
2999
+ var resourceParams = createResourceParams$1(config);
3000
+ var request = createResourceRequest$1(resourceParams);
3001
+ return luvio.dispatchResourceRequest(request, options)
3002
+ .then(function (response) {
3003
+ return luvio.handleSuccessResponse(function () { return onFetchResponseSuccess(luvio, config, resourceParams, response); }, function () { return getResponseCacheKeys$1(luvio, resourceParams, response.body); });
3004
+ }, function (response) {
3005
+ return luvio.handleErrorResponse(function () { return onFetchResponseError(luvio, config, resourceParams, response); });
3006
+ });
3007
+ }
3008
+ function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
3009
+ var luvio = context.luvio, config = context.config;
3010
+ var networkPriority = coercedAdapterRequestContext.networkPriority, requestCorrelator = coercedAdapterRequestContext.requestCorrelator, eventObservers = coercedAdapterRequestContext.eventObservers;
3011
+ var dispatchOptions = {
3012
+ resourceRequestContext: {
3013
+ requestCorrelator: requestCorrelator,
3014
+ luvioRequestMethod: undefined,
3015
+ },
3016
+ eventObservers: eventObservers
3017
+ };
3018
+ if (networkPriority !== 'normal') {
3019
+ dispatchOptions.overrides = {
3020
+ priority: networkPriority
3021
+ };
3022
+ }
3023
+ return buildNetworkSnapshot$1(luvio, config, dispatchOptions);
3024
+ }
3025
+ function buildCachedSnapshotCachePolicy(context, storeLookup) {
3026
+ var luvio = context.luvio, config = context.config;
3027
+ var selector = {
3028
+ recordId: keyBuilder$1(luvio, config),
3029
+ node: adapterFragment(luvio, config),
3030
+ variables: {},
3031
+ };
3032
+ var cacheSnapshot = storeLookup(selector, {
3033
+ config: config,
3034
+ resolve: function () { return buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions); }
3035
+ });
3036
+ return cacheSnapshot;
3037
+ }
3038
+ var getTemplatesAdapterFactory = function (luvio) { return function clm__getTemplates(untrustedConfig, requestContext) {
3039
+ var config = validateAdapterConfig$1(untrustedConfig, getTemplates_ConfigPropertyNames);
3040
+ // Invalid or incomplete config
3041
+ if (config === null) {
3042
+ return null;
3043
+ }
3044
+ return luvio.applyCachePolicy((requestContext || {}), { config: config, luvio: luvio }, // BuildSnapshotContext
3045
+ buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
3046
+ }; };
3047
+
3048
+ function validate$1(obj, path) {
3049
+ if (path === void 0) { path = 'SaveExternalDocumentInputRepresentation'; }
3050
+ var v_error = (function () {
3051
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3052
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3053
+ }
3054
+ var obj_extDocumentId = obj.extDocumentId;
3055
+ var path_extDocumentId = path + '.extDocumentId';
3056
+ if (typeof obj_extDocumentId !== 'string') {
3057
+ return new TypeError('Expected "string" but received "' + typeof obj_extDocumentId + '" (at "' + path_extDocumentId + '")');
3058
+ }
3059
+ })();
3060
+ return v_error === undefined ? null : v_error;
3061
+ }
3062
+
3063
+ var TTL = 60000;
3064
+ var VERSION = "0073b6a90cebc73156c21fe3fd09256a";
3065
+ function validate(obj, path) {
3066
+ if (path === void 0) { path = 'SaveExternalDocumentRepresentation'; }
3067
+ var v_error = (function () {
3068
+ if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
3069
+ return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
3070
+ }
3071
+ var obj_id = obj.id;
3072
+ var path_id = path + '.id';
3073
+ if (typeof obj_id !== 'string') {
3074
+ return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
3075
+ }
3076
+ var obj_isSuccess = obj.isSuccess;
3077
+ var path_isSuccess = path + '.isSuccess';
3078
+ if (typeof obj_isSuccess !== 'boolean') {
3079
+ return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
3080
+ }
3081
+ if (obj.message !== undefined) {
3082
+ var obj_message = obj.message;
3083
+ var path_message = path + '.message';
3084
+ if (typeof obj_message !== 'string') {
3085
+ return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
3086
+ }
3087
+ }
3088
+ })();
3089
+ return v_error === undefined ? null : v_error;
3090
+ }
3091
+ var RepresentationType = 'SaveExternalDocumentRepresentation';
3092
+ function keyBuilder(luvio, config) {
3093
+ return keyPrefix + '::' + RepresentationType + ':' + config.id;
3094
+ }
3095
+ function keyBuilderFromType(luvio, object) {
3096
+ var keyParams = {
3097
+ id: object.id
3098
+ };
3099
+ return keyBuilder(luvio, keyParams);
3100
+ }
3101
+ function normalize(input, existing, path, luvio, store, timestamp) {
3102
+ return input;
3103
+ }
3104
+ var select$1 = function SaveExternalDocumentRepresentationSelect() {
3105
+ return {
3106
+ kind: 'Fragment',
3107
+ version: VERSION,
3108
+ private: [],
3109
+ opaque: true
3110
+ };
3111
+ };
3112
+ function equals(existing, incoming) {
3113
+ if (JSONStringify(incoming) !== JSONStringify(existing)) {
3114
+ return false;
3115
+ }
3116
+ return true;
3117
+ }
3118
+ function deepFreeze(input) {
3119
+ ObjectFreeze(input);
3120
+ }
3121
+ var ingest = function SaveExternalDocumentRepresentationIngest(input, path, luvio, store, timestamp) {
3122
+ if (process.env.NODE_ENV !== 'production') {
3123
+ var validateError = validate(input);
3124
+ if (validateError !== null) {
3125
+ throw validateError;
3126
+ }
3127
+ }
3128
+ var key = keyBuilderFromType(luvio, input);
3129
+ var existingRecord = store.readEntry(key);
3130
+ var ttlToUse = TTL;
3131
+ var incomingRecord = normalize(input, store.readEntry(key), {
3132
+ fullPath: key,
3133
+ parent: path.parent,
3134
+ propertyName: path.propertyName,
3135
+ ttl: ttlToUse
3136
+ });
3137
+ deepFreeze(input);
3138
+ if (existingRecord === undefined || equals(existingRecord, incomingRecord) === false) {
3139
+ luvio.storePublish(key, incomingRecord);
3140
+ }
3141
+ {
3142
+ var storeMetadataParams = {
3143
+ ttl: ttlToUse,
3144
+ namespace: "clm",
3145
+ version: VERSION,
3146
+ representationName: RepresentationType,
3147
+ };
3148
+ luvio.publishStoreMetadata(key, storeMetadataParams);
3149
+ }
3150
+ return createLink(key);
3151
+ };
3152
+ function getTypeCacheKeys(luvio, input, fullPathFactory) {
3153
+ var rootKeySet = new engine.StoreKeyMap();
3154
+ // root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
3155
+ var rootKey = keyBuilderFromType(luvio, input);
3156
+ rootKeySet.set(rootKey, {
3157
+ namespace: keyPrefix,
3158
+ representationName: RepresentationType,
3159
+ mergeable: false
3160
+ });
3161
+ return rootKeySet;
3162
+ }
3163
+
3164
+ function select(luvio, params) {
3165
+ return select$1();
3166
+ }
3167
+ function getResponseCacheKeys(luvio, resourceParams, response) {
3168
+ return getTypeCacheKeys(luvio, response);
3169
+ }
3170
+ function ingestSuccess(luvio, resourceParams, response) {
3171
+ var body = response.body;
3172
+ var key = keyBuilderFromType(luvio, body);
3173
+ luvio.storeIngest(key, ingest, body);
3174
+ var snapshot = luvio.storeLookup({
3175
+ recordId: key,
3176
+ node: select(),
3177
+ variables: {},
3178
+ });
3179
+ if (process.env.NODE_ENV !== 'production') {
3180
+ if (snapshot.state !== 'Fulfilled') {
3181
+ throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
3182
+ }
3183
+ }
3184
+ return snapshot;
3185
+ }
3186
+ function createResourceRequest(config) {
3187
+ var headers = {};
3188
+ return {
3189
+ baseUri: '/services/data/v58.0',
3190
+ basePath: '/connect/clm/external-document-resource',
3191
+ method: 'patch',
3192
+ body: config.body,
3193
+ urlParams: {},
3194
+ queryParams: {},
3195
+ headers: headers,
3196
+ priority: 'normal',
3197
+ };
3198
+ }
3199
+
3200
+ var saveExternalDocument_ConfigPropertyNames = {
3201
+ displayName: 'saveExternalDocument',
3202
+ parameters: {
3203
+ required: ['externalDocumentInput'],
3204
+ optional: []
3205
+ }
3206
+ };
3207
+ function createResourceParams(config) {
3208
+ var resourceParams = {
3209
+ body: {
3210
+ externalDocumentInput: config.externalDocumentInput
3211
+ }
3212
+ };
3213
+ return resourceParams;
3214
+ }
3215
+ function typeCheckConfig(untrustedConfig) {
3216
+ var config = {};
3217
+ var untrustedConfig_externalDocumentInput = untrustedConfig.externalDocumentInput;
3218
+ var referenceSaveExternalDocumentInputRepresentationValidationError = validate$1(untrustedConfig_externalDocumentInput);
3219
+ if (referenceSaveExternalDocumentInputRepresentationValidationError === null) {
3220
+ config.externalDocumentInput = untrustedConfig_externalDocumentInput;
3221
+ }
3222
+ return config;
3223
+ }
3224
+ function validateAdapterConfig(untrustedConfig, configPropertyNames) {
3225
+ if (!untrustedIsObject(untrustedConfig)) {
3226
+ return null;
3227
+ }
3228
+ if (process.env.NODE_ENV !== 'production') {
3229
+ validateConfig(untrustedConfig, configPropertyNames);
3230
+ }
3231
+ var config = typeCheckConfig(untrustedConfig);
3232
+ if (!areRequiredParametersPresent(config, configPropertyNames)) {
3233
+ return null;
3234
+ }
3235
+ return config;
3236
+ }
3237
+ function buildNetworkSnapshot(luvio, config, options) {
3238
+ var resourceParams = createResourceParams(config);
3239
+ var request = createResourceRequest(resourceParams);
3240
+ return luvio.dispatchResourceRequest(request, options)
3241
+ .then(function (response) {
3242
+ return luvio.handleSuccessResponse(function () {
3243
+ var snapshot = ingestSuccess(luvio, resourceParams, response);
3244
+ return luvio.storeBroadcast().then(function () { return snapshot; });
3245
+ }, function () { return getResponseCacheKeys(luvio, resourceParams, response.body); });
3246
+ }, function (response) {
3247
+ deepFreeze$b(response);
3248
+ throw response;
3249
+ });
3250
+ }
3251
+ var saveExternalDocumentAdapterFactory = function (luvio) {
3252
+ return function saveExternalDocument(untrustedConfig) {
3253
+ var config = validateAdapterConfig(untrustedConfig, saveExternalDocument_ConfigPropertyNames);
3254
+ // Invalid or incomplete config
3255
+ if (config === null) {
3256
+ throw new Error('Invalid config for "saveExternalDocument"');
3257
+ }
3258
+ return buildNetworkSnapshot(luvio, config);
3259
+ };
3260
+ };
3261
+
3262
+ exports.checkInAdapterFactory = checkInAdapterFactory;
3263
+ exports.checkoutContractDocumentVersionAdapterFactory = checkoutContractDocumentVersionAdapterFactory;
3264
+ exports.createContractDocumentVersionAndInitializeGenerateDocumentProcessAdapterFactory = createContractDocumentVersionAndInitializeGenerateDocumentProcessAdapterFactory;
3265
+ exports.deleteAttachmentAdapterFactory = deleteAttachmentAdapterFactory;
3266
+ exports.executeContractActionAdapterFactory = executeContractActionAdapterFactory;
3267
+ exports.getContentDocumentAdapterFactory = getContentDocumentAdapterFactory;
3268
+ exports.getContractActionsAdapterFactory = getContractActionsAdapterFactory;
3269
+ exports.getContractDocumentVersionAdapterFactory = getContractDocumentVersionAdapterFactory;
3270
+ exports.getDocumentGenerationProcessDetailsAdapterFactory = getDocumentGenerationProcessDetailsAdapterFactory;
3271
+ exports.getTemplatesAdapterFactory = getTemplatesAdapterFactory;
3272
+ exports.lockContractDocumentVersionAdapterFactory = lockContractDocumentVersionAdapterFactory;
3273
+ exports.saveExternalDocumentAdapterFactory = saveExternalDocumentAdapterFactory;
3274
+ exports.unlockAdapterFactory = unlockAdapterFactory;
3275
+ exports.updateContractDocumentVersionWithTemplateAdapterFactory = updateContractDocumentVersionWithTemplateAdapterFactory;
3276
+
3277
+ Object.defineProperty(exports, '__esModule', { value: true });
3278
+
3279
+ }));