@salesforce/lds-adapters-industries-externaldocument 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/industries-externaldocument.js +947 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createExternalDocument.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/getExternalDocument.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/getExternalDocumentUsers.d.ts +28 -0
- package/dist/es/es2018/types/src/generated/adapters/saveExternalDocument.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +4 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +7 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectExternalDocument.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/getConnectExternalDocumentUsers.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectExternalDocument.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/putConnectExternalDocumentSave.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/types/DocumentAuthoredContentRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocCreationInputRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocCreationInputRepresentationWrapper.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocCreationOutputRepresentation.d.ts +47 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocumentMetadataRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocumentOutputRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocumentUsersListOutputRepresentation.d.ts +36 -0
- package/dist/es/es2018/types/src/generated/types/ExternalDocumentUsersOutputRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/ObjectReferenceRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ParentContentRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/ReviewerRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/SaveExternalDocumentInputRepresentation.d.ts +35 -0
- package/dist/es/es2018/types/src/generated/types/SaveExternalDocumentInputRepresentationWrapper.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/SaveExternalDocumentRepresentation.d.ts +44 -0
- package/dist/es/es2018/types/src/generated/types/UsagesRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +74 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1006 -0
- package/src/raml/api.raml +323 -0
- package/src/raml/luvio.raml +75 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,1006 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { createInstrumentedAdapter, createLDSAdapter, createWireAdapterConstructor, createImperativeAdapter } from 'force/ldsBindings';
|
|
16
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
17
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$4, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2, typeCheckConfig as typeCheckConfig$4 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'ExternalDocument';
|
|
83
|
+
|
|
84
|
+
const { isArray: ArrayIsArray } = Array;
|
|
85
|
+
const { stringify: JSONStringify } = JSON;
|
|
86
|
+
function createLink(ref) {
|
|
87
|
+
return {
|
|
88
|
+
__ref: serializeStructuredKey(ref),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function validate$6(obj, path = 'ExternalDocCreationInputRepresentation') {
|
|
93
|
+
const v_error = (() => {
|
|
94
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
95
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
96
|
+
}
|
|
97
|
+
const obj_contentVersionId = obj.contentVersionId;
|
|
98
|
+
const path_contentVersionId = path + '.contentVersionId';
|
|
99
|
+
if (typeof obj_contentVersionId !== 'string') {
|
|
100
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentVersionId + '" (at "' + path_contentVersionId + '")');
|
|
101
|
+
}
|
|
102
|
+
const obj_documentNamePrefix = obj.documentNamePrefix;
|
|
103
|
+
const path_documentNamePrefix = path + '.documentNamePrefix';
|
|
104
|
+
if (typeof obj_documentNamePrefix !== 'string') {
|
|
105
|
+
return new TypeError('Expected "string" but received "' + typeof obj_documentNamePrefix + '" (at "' + path_documentNamePrefix + '")');
|
|
106
|
+
}
|
|
107
|
+
const obj_isAsync = obj.isAsync;
|
|
108
|
+
const path_isAsync = path + '.isAsync';
|
|
109
|
+
if (typeof obj_isAsync !== 'string') {
|
|
110
|
+
return new TypeError('Expected "string" but received "' + typeof obj_isAsync + '" (at "' + path_isAsync + '")');
|
|
111
|
+
}
|
|
112
|
+
const obj_refObjectId = obj.refObjectId;
|
|
113
|
+
const path_refObjectId = path + '.refObjectId';
|
|
114
|
+
if (typeof obj_refObjectId !== 'string') {
|
|
115
|
+
return new TypeError('Expected "string" but received "' + typeof obj_refObjectId + '" (at "' + path_refObjectId + '")');
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
118
|
+
return v_error === undefined ? null : v_error;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const TTL$3 = 60000;
|
|
122
|
+
const VERSION$3 = "62b6ff2897ad48f08a170ff28e50d628";
|
|
123
|
+
function validate$5(obj, path = 'ExternalDocCreationOutputRepresentation') {
|
|
124
|
+
const v_error = (() => {
|
|
125
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
126
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
127
|
+
}
|
|
128
|
+
const obj_externalDocumentDetails = obj.externalDocumentDetails;
|
|
129
|
+
const path_externalDocumentDetails = path + '.externalDocumentDetails';
|
|
130
|
+
if (typeof obj_externalDocumentDetails !== 'object' || ArrayIsArray(obj_externalDocumentDetails) || obj_externalDocumentDetails === null) {
|
|
131
|
+
return new TypeError('Expected "object" but received "' + typeof obj_externalDocumentDetails + '" (at "' + path_externalDocumentDetails + '")');
|
|
132
|
+
}
|
|
133
|
+
const obj_isSuccess = obj.isSuccess;
|
|
134
|
+
const path_isSuccess = path + '.isSuccess';
|
|
135
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
136
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
137
|
+
}
|
|
138
|
+
const obj_message = obj.message;
|
|
139
|
+
const path_message = path + '.message';
|
|
140
|
+
if (typeof obj_message !== 'string') {
|
|
141
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
142
|
+
}
|
|
143
|
+
const obj_ssoLinkUrl = obj.ssoLinkUrl;
|
|
144
|
+
const path_ssoLinkUrl = path + '.ssoLinkUrl';
|
|
145
|
+
if (typeof obj_ssoLinkUrl !== 'string') {
|
|
146
|
+
return new TypeError('Expected "string" but received "' + typeof obj_ssoLinkUrl + '" (at "' + path_ssoLinkUrl + '")');
|
|
147
|
+
}
|
|
148
|
+
})();
|
|
149
|
+
return v_error === undefined ? null : v_error;
|
|
150
|
+
}
|
|
151
|
+
const RepresentationType$3 = 'ExternalDocCreationOutputRepresentation';
|
|
152
|
+
function keyBuilder$5(luvio, config) {
|
|
153
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.isSuccess;
|
|
154
|
+
}
|
|
155
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
156
|
+
const keyParams = {
|
|
157
|
+
isSuccess: object.isSuccess
|
|
158
|
+
};
|
|
159
|
+
return keyBuilder$5(luvio, keyParams);
|
|
160
|
+
}
|
|
161
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
162
|
+
return input;
|
|
163
|
+
}
|
|
164
|
+
const select$7 = function ExternalDocCreationOutputRepresentationSelect() {
|
|
165
|
+
return {
|
|
166
|
+
kind: 'Fragment',
|
|
167
|
+
version: VERSION$3,
|
|
168
|
+
private: [],
|
|
169
|
+
opaque: true
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
function equals$3(existing, incoming) {
|
|
173
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
const ingest$3 = function ExternalDocCreationOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
179
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
180
|
+
const validateError = validate$5(input);
|
|
181
|
+
if (validateError !== null) {
|
|
182
|
+
throw validateError;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
186
|
+
const ttlToUse = TTL$3;
|
|
187
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "ExternalDocument", VERSION$3, RepresentationType$3, equals$3);
|
|
188
|
+
return createLink(key);
|
|
189
|
+
};
|
|
190
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
191
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
192
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
193
|
+
rootKeySet.set(rootKey, {
|
|
194
|
+
namespace: keyPrefix,
|
|
195
|
+
representationName: RepresentationType$3,
|
|
196
|
+
mergeable: false
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function select$6(luvio, params) {
|
|
201
|
+
return select$7();
|
|
202
|
+
}
|
|
203
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
204
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
205
|
+
}
|
|
206
|
+
function ingestSuccess$3(luvio, resourceParams, response) {
|
|
207
|
+
const { body } = response;
|
|
208
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
209
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
210
|
+
const snapshot = luvio.storeLookup({
|
|
211
|
+
recordId: key,
|
|
212
|
+
node: select$6(),
|
|
213
|
+
variables: {},
|
|
214
|
+
});
|
|
215
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
216
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
217
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
deepFreeze(snapshot.data);
|
|
221
|
+
return snapshot;
|
|
222
|
+
}
|
|
223
|
+
function createResourceRequest$3(config) {
|
|
224
|
+
const headers = {};
|
|
225
|
+
return {
|
|
226
|
+
baseUri: '/services/data/v66.0',
|
|
227
|
+
basePath: '/connect/external-document',
|
|
228
|
+
method: 'post',
|
|
229
|
+
body: config.body,
|
|
230
|
+
urlParams: {},
|
|
231
|
+
queryParams: {},
|
|
232
|
+
headers,
|
|
233
|
+
priority: 'normal',
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const adapterName$3 = 'createExternalDocument';
|
|
238
|
+
const createExternalDocument_ConfigPropertyMetadata = [
|
|
239
|
+
generateParamConfigMetadata('createExternalDocumentInput', true, 2 /* Body */, 4 /* Unsupported */),
|
|
240
|
+
];
|
|
241
|
+
const createExternalDocument_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, createExternalDocument_ConfigPropertyMetadata);
|
|
242
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$4(createExternalDocument_ConfigPropertyMetadata);
|
|
243
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
244
|
+
const config = {};
|
|
245
|
+
const untrustedConfig_createExternalDocumentInput = untrustedConfig.createExternalDocumentInput;
|
|
246
|
+
const referenceExternalDocCreationInputRepresentationValidationError = validate$6(untrustedConfig_createExternalDocumentInput);
|
|
247
|
+
if (referenceExternalDocCreationInputRepresentationValidationError === null) {
|
|
248
|
+
config.createExternalDocumentInput = untrustedConfig_createExternalDocumentInput;
|
|
249
|
+
}
|
|
250
|
+
return config;
|
|
251
|
+
}
|
|
252
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
253
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
256
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
257
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
258
|
+
}
|
|
259
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
260
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return config;
|
|
264
|
+
}
|
|
265
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
266
|
+
const resourceParams = createResourceParams$3(config);
|
|
267
|
+
const request = createResourceRequest$3(resourceParams);
|
|
268
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
269
|
+
.then((response) => {
|
|
270
|
+
return luvio.handleSuccessResponse(() => {
|
|
271
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response);
|
|
272
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
273
|
+
}, () => {
|
|
274
|
+
const cache = new StoreKeyMap();
|
|
275
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
276
|
+
return cache;
|
|
277
|
+
});
|
|
278
|
+
}, (response) => {
|
|
279
|
+
deepFreeze(response);
|
|
280
|
+
throw response;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const createExternalDocumentAdapterFactory = (luvio) => {
|
|
284
|
+
return function createExternalDocument(untrustedConfig) {
|
|
285
|
+
const config = validateAdapterConfig$3(untrustedConfig, createExternalDocument_ConfigPropertyNames);
|
|
286
|
+
// Invalid or incomplete config
|
|
287
|
+
if (config === null) {
|
|
288
|
+
throw new Error('Invalid config for "createExternalDocument"');
|
|
289
|
+
}
|
|
290
|
+
return buildNetworkSnapshot$3(luvio, config);
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const TTL$2 = 60000;
|
|
295
|
+
const VERSION$2 = "641dbe0f048b436a2f7b34ac9bf1ddd1";
|
|
296
|
+
function validate$4(obj, path = 'ExternalDocumentOutputRepresentation') {
|
|
297
|
+
const v_error = (() => {
|
|
298
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
299
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
300
|
+
}
|
|
301
|
+
const obj_contentVersionId = obj.contentVersionId;
|
|
302
|
+
const path_contentVersionId = path + '.contentVersionId';
|
|
303
|
+
if (typeof obj_contentVersionId !== 'string') {
|
|
304
|
+
return new TypeError('Expected "string" but received "' + typeof obj_contentVersionId + '" (at "' + path_contentVersionId + '")');
|
|
305
|
+
}
|
|
306
|
+
const obj_externalDocumentId = obj.externalDocumentId;
|
|
307
|
+
const path_externalDocumentId = path + '.externalDocumentId';
|
|
308
|
+
if (typeof obj_externalDocumentId !== 'string') {
|
|
309
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalDocumentId + '" (at "' + path_externalDocumentId + '")');
|
|
310
|
+
}
|
|
311
|
+
const obj_externalUserId = obj.externalUserId;
|
|
312
|
+
const path_externalUserId = path + '.externalUserId';
|
|
313
|
+
if (typeof obj_externalUserId !== 'string') {
|
|
314
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalUserId + '" (at "' + path_externalUserId + '")');
|
|
315
|
+
}
|
|
316
|
+
const obj_referenceObject = obj.referenceObject;
|
|
317
|
+
const path_referenceObject = path + '.referenceObject';
|
|
318
|
+
if (typeof obj_referenceObject !== 'string') {
|
|
319
|
+
return new TypeError('Expected "string" but received "' + typeof obj_referenceObject + '" (at "' + path_referenceObject + '")');
|
|
320
|
+
}
|
|
321
|
+
const obj_referenceObjectId = obj.referenceObjectId;
|
|
322
|
+
const path_referenceObjectId = path + '.referenceObjectId';
|
|
323
|
+
if (typeof obj_referenceObjectId !== 'string') {
|
|
324
|
+
return new TypeError('Expected "string" but received "' + typeof obj_referenceObjectId + '" (at "' + path_referenceObjectId + '")');
|
|
325
|
+
}
|
|
326
|
+
const obj_url = obj.url;
|
|
327
|
+
const path_url = path + '.url';
|
|
328
|
+
if (typeof obj_url !== 'string') {
|
|
329
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
330
|
+
}
|
|
331
|
+
})();
|
|
332
|
+
return v_error === undefined ? null : v_error;
|
|
333
|
+
}
|
|
334
|
+
const RepresentationType$2 = 'ExternalDocumentOutputRepresentation';
|
|
335
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
336
|
+
return input;
|
|
337
|
+
}
|
|
338
|
+
const select$5 = function ExternalDocumentOutputRepresentationSelect() {
|
|
339
|
+
return {
|
|
340
|
+
kind: 'Fragment',
|
|
341
|
+
version: VERSION$2,
|
|
342
|
+
private: [],
|
|
343
|
+
opaque: true
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
function equals$2(existing, incoming) {
|
|
347
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
const ingest$2 = function ExternalDocumentOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
353
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
354
|
+
const validateError = validate$4(input);
|
|
355
|
+
if (validateError !== null) {
|
|
356
|
+
throw validateError;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const key = path.fullPath;
|
|
360
|
+
const ttlToUse = TTL$2;
|
|
361
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "ExternalDocument", VERSION$2, RepresentationType$2, equals$2);
|
|
362
|
+
return createLink(key);
|
|
363
|
+
};
|
|
364
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
365
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
366
|
+
const rootKey = fullPathFactory();
|
|
367
|
+
rootKeySet.set(rootKey, {
|
|
368
|
+
namespace: keyPrefix,
|
|
369
|
+
representationName: RepresentationType$2,
|
|
370
|
+
mergeable: false
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function select$4(luvio, params) {
|
|
375
|
+
return select$5();
|
|
376
|
+
}
|
|
377
|
+
function keyBuilder$4(luvio, params) {
|
|
378
|
+
return keyPrefix + '::ExternalDocumentOutputRepresentation:(' + 'externalDocumentId:' + params.queryParams.externalDocumentId + ',' + 'refObjectId:' + params.queryParams.refObjectId + ')';
|
|
379
|
+
}
|
|
380
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
381
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response, () => keyBuilder$4(luvio, resourceParams));
|
|
382
|
+
}
|
|
383
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
384
|
+
const { body } = response;
|
|
385
|
+
const key = keyBuilder$4(luvio, resourceParams);
|
|
386
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
387
|
+
const snapshot = luvio.storeLookup({
|
|
388
|
+
recordId: key,
|
|
389
|
+
node: select$4(),
|
|
390
|
+
variables: {},
|
|
391
|
+
}, snapshotRefresh);
|
|
392
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
393
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
394
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
deepFreeze(snapshot.data);
|
|
398
|
+
return snapshot;
|
|
399
|
+
}
|
|
400
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
401
|
+
const key = keyBuilder$4(luvio, params);
|
|
402
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
403
|
+
const storeMetadataParams = {
|
|
404
|
+
ttl: TTL$2,
|
|
405
|
+
namespace: keyPrefix,
|
|
406
|
+
version: VERSION$2,
|
|
407
|
+
representationName: RepresentationType$2
|
|
408
|
+
};
|
|
409
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
410
|
+
return errorSnapshot;
|
|
411
|
+
}
|
|
412
|
+
function createResourceRequest$2(config) {
|
|
413
|
+
const headers = {};
|
|
414
|
+
return {
|
|
415
|
+
baseUri: '/services/data/v66.0',
|
|
416
|
+
basePath: '/connect/external-document',
|
|
417
|
+
method: 'get',
|
|
418
|
+
body: null,
|
|
419
|
+
urlParams: {},
|
|
420
|
+
queryParams: config.queryParams,
|
|
421
|
+
headers,
|
|
422
|
+
priority: 'normal',
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
const adapterName$2 = 'getExternalDocument';
|
|
427
|
+
const oneOfConfigPropertiesIdentifier = [
|
|
428
|
+
'externalDocumentId',
|
|
429
|
+
'refObjectId'
|
|
430
|
+
];
|
|
431
|
+
const getExternalDocument_ConfigPropertyMetadata = [
|
|
432
|
+
generateParamConfigMetadata('externalDocumentId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
433
|
+
generateParamConfigMetadata('refObjectId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
434
|
+
];
|
|
435
|
+
const getExternalDocument_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getExternalDocument_ConfigPropertyMetadata);
|
|
436
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$4(getExternalDocument_ConfigPropertyMetadata);
|
|
437
|
+
function keyBuilder$3(luvio, config) {
|
|
438
|
+
const resourceParams = createResourceParams$2(config);
|
|
439
|
+
return keyBuilder$4(luvio, resourceParams);
|
|
440
|
+
}
|
|
441
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
442
|
+
const config = {};
|
|
443
|
+
typeCheckConfig$4(untrustedConfig, config, getExternalDocument_ConfigPropertyMetadata);
|
|
444
|
+
return config;
|
|
445
|
+
}
|
|
446
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
447
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
451
|
+
validateConfig(untrustedConfig, configPropertyNames, oneOfConfigPropertiesIdentifier);
|
|
452
|
+
}
|
|
453
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
454
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
if (config.externalDocumentId === undefined &&
|
|
458
|
+
config.refObjectId === undefined) {
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
return config;
|
|
462
|
+
}
|
|
463
|
+
function adapterFragment$1(luvio, config) {
|
|
464
|
+
createResourceParams$2(config);
|
|
465
|
+
return select$4();
|
|
466
|
+
}
|
|
467
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
468
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
469
|
+
config,
|
|
470
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
471
|
+
});
|
|
472
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
473
|
+
}
|
|
474
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
475
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
476
|
+
config,
|
|
477
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
478
|
+
});
|
|
479
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
480
|
+
}
|
|
481
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
482
|
+
const resourceParams = createResourceParams$2(config);
|
|
483
|
+
const request = createResourceRequest$2(resourceParams);
|
|
484
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
485
|
+
.then((response) => {
|
|
486
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
487
|
+
const cache = new StoreKeyMap();
|
|
488
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
489
|
+
return cache;
|
|
490
|
+
});
|
|
491
|
+
}, (response) => {
|
|
492
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
496
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
497
|
+
}
|
|
498
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
499
|
+
const { luvio, config } = context;
|
|
500
|
+
const selector = {
|
|
501
|
+
recordId: keyBuilder$3(luvio, config),
|
|
502
|
+
node: adapterFragment$1(luvio, config),
|
|
503
|
+
variables: {},
|
|
504
|
+
};
|
|
505
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
506
|
+
config,
|
|
507
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
508
|
+
});
|
|
509
|
+
return cacheSnapshot;
|
|
510
|
+
}
|
|
511
|
+
const getExternalDocumentAdapterFactory = (luvio) => function ExternalDocument__getExternalDocument(untrustedConfig, requestContext) {
|
|
512
|
+
const config = validateAdapterConfig$2(untrustedConfig, getExternalDocument_ConfigPropertyNames);
|
|
513
|
+
// Invalid or incomplete config
|
|
514
|
+
if (config === null) {
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
518
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
function validate$3(obj, path = 'ExternalDocumentUsersOutputRepresentation') {
|
|
522
|
+
const v_error = (() => {
|
|
523
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
524
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
525
|
+
}
|
|
526
|
+
const obj_displayName = obj.displayName;
|
|
527
|
+
const path_displayName = path + '.displayName';
|
|
528
|
+
if (typeof obj_displayName !== 'string') {
|
|
529
|
+
return new TypeError('Expected "string" but received "' + typeof obj_displayName + '" (at "' + path_displayName + '")');
|
|
530
|
+
}
|
|
531
|
+
const obj_documentUserId = obj.documentUserId;
|
|
532
|
+
const path_documentUserId = path + '.documentUserId';
|
|
533
|
+
if (typeof obj_documentUserId !== 'string') {
|
|
534
|
+
return new TypeError('Expected "string" but received "' + typeof obj_documentUserId + '" (at "' + path_documentUserId + '")');
|
|
535
|
+
}
|
|
536
|
+
const obj_email = obj.email;
|
|
537
|
+
const path_email = path + '.email';
|
|
538
|
+
if (typeof obj_email !== 'string') {
|
|
539
|
+
return new TypeError('Expected "string" but received "' + typeof obj_email + '" (at "' + path_email + '")');
|
|
540
|
+
}
|
|
541
|
+
})();
|
|
542
|
+
return v_error === undefined ? null : v_error;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
const TTL$1 = 60000;
|
|
546
|
+
const VERSION$1 = "2ab4b143223f447d344e1c9628013030";
|
|
547
|
+
function validate$2(obj, path = 'ExternalDocumentUsersListOutputRepresentation') {
|
|
548
|
+
const v_error = (() => {
|
|
549
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
550
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
551
|
+
}
|
|
552
|
+
if (obj.code !== undefined) {
|
|
553
|
+
const obj_code = obj.code;
|
|
554
|
+
const path_code = path + '.code';
|
|
555
|
+
if (typeof obj_code !== 'string') {
|
|
556
|
+
return new TypeError('Expected "string" but received "' + typeof obj_code + '" (at "' + path_code + '")');
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (obj.message !== undefined) {
|
|
560
|
+
const obj_message = obj.message;
|
|
561
|
+
const path_message = path + '.message';
|
|
562
|
+
if (typeof obj_message !== 'string') {
|
|
563
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const obj_users = obj.users;
|
|
567
|
+
const path_users = path + '.users';
|
|
568
|
+
if (!ArrayIsArray(obj_users)) {
|
|
569
|
+
return new TypeError('Expected "array" but received "' + typeof obj_users + '" (at "' + path_users + '")');
|
|
570
|
+
}
|
|
571
|
+
for (let i = 0; i < obj_users.length; i++) {
|
|
572
|
+
const obj_users_item = obj_users[i];
|
|
573
|
+
const path_users_item = path_users + '[' + i + ']';
|
|
574
|
+
const referencepath_users_itemValidationError = validate$3(obj_users_item, path_users_item);
|
|
575
|
+
if (referencepath_users_itemValidationError !== null) {
|
|
576
|
+
let message = 'Object doesn\'t match ExternalDocumentUsersOutputRepresentation (at "' + path_users_item + '")\n';
|
|
577
|
+
message += referencepath_users_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
578
|
+
return new TypeError(message);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
})();
|
|
582
|
+
return v_error === undefined ? null : v_error;
|
|
583
|
+
}
|
|
584
|
+
const RepresentationType$1 = 'ExternalDocumentUsersListOutputRepresentation';
|
|
585
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
586
|
+
return input;
|
|
587
|
+
}
|
|
588
|
+
const select$3 = function ExternalDocumentUsersListOutputRepresentationSelect() {
|
|
589
|
+
return {
|
|
590
|
+
kind: 'Fragment',
|
|
591
|
+
version: VERSION$1,
|
|
592
|
+
private: [],
|
|
593
|
+
opaque: true
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
function equals$1(existing, incoming) {
|
|
597
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
return true;
|
|
601
|
+
}
|
|
602
|
+
const ingest$1 = function ExternalDocumentUsersListOutputRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
603
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
604
|
+
const validateError = validate$2(input);
|
|
605
|
+
if (validateError !== null) {
|
|
606
|
+
throw validateError;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
const key = path.fullPath;
|
|
610
|
+
const ttlToUse = TTL$1;
|
|
611
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "ExternalDocument", VERSION$1, RepresentationType$1, equals$1);
|
|
612
|
+
return createLink(key);
|
|
613
|
+
};
|
|
614
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
615
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
616
|
+
const rootKey = fullPathFactory();
|
|
617
|
+
rootKeySet.set(rootKey, {
|
|
618
|
+
namespace: keyPrefix,
|
|
619
|
+
representationName: RepresentationType$1,
|
|
620
|
+
mergeable: false
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
function select$2(luvio, params) {
|
|
625
|
+
return select$3();
|
|
626
|
+
}
|
|
627
|
+
function keyBuilder$2(luvio, params) {
|
|
628
|
+
return keyPrefix + '::ExternalDocumentUsersListOutputRepresentation:(' + 'externalDocumentId:' + params.queryParams.externalDocumentId + ',' + 'startsWith:' + params.queryParams.startsWith + ')';
|
|
629
|
+
}
|
|
630
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
631
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2(luvio, resourceParams));
|
|
632
|
+
}
|
|
633
|
+
function ingestSuccess$1(luvio, resourceParams, response, snapshotRefresh) {
|
|
634
|
+
const { body } = response;
|
|
635
|
+
const key = keyBuilder$2(luvio, resourceParams);
|
|
636
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
637
|
+
const snapshot = luvio.storeLookup({
|
|
638
|
+
recordId: key,
|
|
639
|
+
node: select$2(),
|
|
640
|
+
variables: {},
|
|
641
|
+
}, snapshotRefresh);
|
|
642
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
643
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
644
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
deepFreeze(snapshot.data);
|
|
648
|
+
return snapshot;
|
|
649
|
+
}
|
|
650
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
651
|
+
const key = keyBuilder$2(luvio, params);
|
|
652
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
653
|
+
const storeMetadataParams = {
|
|
654
|
+
ttl: TTL$1,
|
|
655
|
+
namespace: keyPrefix,
|
|
656
|
+
version: VERSION$1,
|
|
657
|
+
representationName: RepresentationType$1
|
|
658
|
+
};
|
|
659
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
660
|
+
return errorSnapshot;
|
|
661
|
+
}
|
|
662
|
+
function createResourceRequest$1(config) {
|
|
663
|
+
const headers = {};
|
|
664
|
+
return {
|
|
665
|
+
baseUri: '/services/data/v66.0',
|
|
666
|
+
basePath: '/connect/external-document/users',
|
|
667
|
+
method: 'get',
|
|
668
|
+
body: null,
|
|
669
|
+
urlParams: {},
|
|
670
|
+
queryParams: config.queryParams,
|
|
671
|
+
headers,
|
|
672
|
+
priority: 'normal',
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const adapterName$1 = 'getExternalDocumentUsers';
|
|
677
|
+
const getExternalDocumentUsers_ConfigPropertyMetadata = [
|
|
678
|
+
generateParamConfigMetadata('externalDocumentId', false, 1 /* QueryParameter */, 0 /* String */),
|
|
679
|
+
generateParamConfigMetadata('startsWith', false, 1 /* QueryParameter */, 0 /* String */),
|
|
680
|
+
];
|
|
681
|
+
const getExternalDocumentUsers_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getExternalDocumentUsers_ConfigPropertyMetadata);
|
|
682
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$4(getExternalDocumentUsers_ConfigPropertyMetadata);
|
|
683
|
+
function keyBuilder$1(luvio, config) {
|
|
684
|
+
const resourceParams = createResourceParams$1(config);
|
|
685
|
+
return keyBuilder$2(luvio, resourceParams);
|
|
686
|
+
}
|
|
687
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
688
|
+
const config = {};
|
|
689
|
+
typeCheckConfig$4(untrustedConfig, config, getExternalDocumentUsers_ConfigPropertyMetadata);
|
|
690
|
+
return config;
|
|
691
|
+
}
|
|
692
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
693
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
697
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
698
|
+
}
|
|
699
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
700
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
701
|
+
return null;
|
|
702
|
+
}
|
|
703
|
+
return config;
|
|
704
|
+
}
|
|
705
|
+
function adapterFragment(luvio, config) {
|
|
706
|
+
createResourceParams$1(config);
|
|
707
|
+
return select$2();
|
|
708
|
+
}
|
|
709
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
710
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response, {
|
|
711
|
+
config,
|
|
712
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
713
|
+
});
|
|
714
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
715
|
+
}
|
|
716
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
717
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
718
|
+
config,
|
|
719
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
720
|
+
});
|
|
721
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
722
|
+
}
|
|
723
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
724
|
+
const resourceParams = createResourceParams$1(config);
|
|
725
|
+
const request = createResourceRequest$1(resourceParams);
|
|
726
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
727
|
+
.then((response) => {
|
|
728
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
729
|
+
const cache = new StoreKeyMap();
|
|
730
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
731
|
+
return cache;
|
|
732
|
+
});
|
|
733
|
+
}, (response) => {
|
|
734
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
738
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$1, undefined, false);
|
|
739
|
+
}
|
|
740
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
741
|
+
const { luvio, config } = context;
|
|
742
|
+
const selector = {
|
|
743
|
+
recordId: keyBuilder$1(luvio, config),
|
|
744
|
+
node: adapterFragment(luvio, config),
|
|
745
|
+
variables: {},
|
|
746
|
+
};
|
|
747
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
748
|
+
config,
|
|
749
|
+
resolve: () => buildNetworkSnapshot$1(luvio, config, snapshotRefreshOptions)
|
|
750
|
+
});
|
|
751
|
+
return cacheSnapshot;
|
|
752
|
+
}
|
|
753
|
+
const getExternalDocumentUsersAdapterFactory = (luvio) => function ExternalDocument__getExternalDocumentUsers(untrustedConfig, requestContext) {
|
|
754
|
+
const config = validateAdapterConfig$1(untrustedConfig, getExternalDocumentUsers_ConfigPropertyNames);
|
|
755
|
+
// Invalid or incomplete config
|
|
756
|
+
if (config === null) {
|
|
757
|
+
return null;
|
|
758
|
+
}
|
|
759
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
760
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
function validate$1(obj, path = 'SaveExternalDocumentInputRepresentation') {
|
|
764
|
+
const v_error = (() => {
|
|
765
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
766
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
767
|
+
}
|
|
768
|
+
const obj_externalDocumentId = obj.externalDocumentId;
|
|
769
|
+
const path_externalDocumentId = path + '.externalDocumentId';
|
|
770
|
+
if (typeof obj_externalDocumentId !== 'string') {
|
|
771
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalDocumentId + '" (at "' + path_externalDocumentId + '")');
|
|
772
|
+
}
|
|
773
|
+
const obj_isAsync = obj.isAsync;
|
|
774
|
+
const path_isAsync = path + '.isAsync';
|
|
775
|
+
if (typeof obj_isAsync !== 'boolean') {
|
|
776
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isAsync + '" (at "' + path_isAsync + '")');
|
|
777
|
+
}
|
|
778
|
+
const obj_metadata = obj.metadata;
|
|
779
|
+
const path_metadata = path + '.metadata';
|
|
780
|
+
if (typeof obj_metadata !== 'object' || ArrayIsArray(obj_metadata) || obj_metadata === null) {
|
|
781
|
+
return new TypeError('Expected "object" but received "' + typeof obj_metadata + '" (at "' + path_metadata + '")');
|
|
782
|
+
}
|
|
783
|
+
})();
|
|
784
|
+
return v_error === undefined ? null : v_error;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
const TTL = 60000;
|
|
788
|
+
const VERSION = "0073b6a90cebc73156c21fe3fd09256a";
|
|
789
|
+
function validate(obj, path = 'SaveExternalDocumentRepresentation') {
|
|
790
|
+
const v_error = (() => {
|
|
791
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
792
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
793
|
+
}
|
|
794
|
+
const obj_id = obj.id;
|
|
795
|
+
const path_id = path + '.id';
|
|
796
|
+
if (typeof obj_id !== 'string') {
|
|
797
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
798
|
+
}
|
|
799
|
+
const obj_isSuccess = obj.isSuccess;
|
|
800
|
+
const path_isSuccess = path + '.isSuccess';
|
|
801
|
+
if (typeof obj_isSuccess !== 'boolean') {
|
|
802
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isSuccess + '" (at "' + path_isSuccess + '")');
|
|
803
|
+
}
|
|
804
|
+
if (obj.message !== undefined) {
|
|
805
|
+
const obj_message = obj.message;
|
|
806
|
+
const path_message = path + '.message';
|
|
807
|
+
if (typeof obj_message !== 'string') {
|
|
808
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
})();
|
|
812
|
+
return v_error === undefined ? null : v_error;
|
|
813
|
+
}
|
|
814
|
+
const RepresentationType = 'SaveExternalDocumentRepresentation';
|
|
815
|
+
function keyBuilder(luvio, config) {
|
|
816
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
817
|
+
}
|
|
818
|
+
function keyBuilderFromType(luvio, object) {
|
|
819
|
+
const keyParams = {
|
|
820
|
+
id: object.id
|
|
821
|
+
};
|
|
822
|
+
return keyBuilder(luvio, keyParams);
|
|
823
|
+
}
|
|
824
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
825
|
+
return input;
|
|
826
|
+
}
|
|
827
|
+
const select$1 = function SaveExternalDocumentRepresentationSelect() {
|
|
828
|
+
return {
|
|
829
|
+
kind: 'Fragment',
|
|
830
|
+
version: VERSION,
|
|
831
|
+
private: [],
|
|
832
|
+
opaque: true
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
function equals(existing, incoming) {
|
|
836
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
837
|
+
return false;
|
|
838
|
+
}
|
|
839
|
+
return true;
|
|
840
|
+
}
|
|
841
|
+
const ingest = function SaveExternalDocumentRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
842
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
843
|
+
const validateError = validate(input);
|
|
844
|
+
if (validateError !== null) {
|
|
845
|
+
throw validateError;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
const key = keyBuilderFromType(luvio, input);
|
|
849
|
+
const ttlToUse = TTL;
|
|
850
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "ExternalDocument", VERSION, RepresentationType, equals);
|
|
851
|
+
return createLink(key);
|
|
852
|
+
};
|
|
853
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
854
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
855
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
856
|
+
rootKeySet.set(rootKey, {
|
|
857
|
+
namespace: keyPrefix,
|
|
858
|
+
representationName: RepresentationType,
|
|
859
|
+
mergeable: false
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
function select(luvio, params) {
|
|
864
|
+
return select$1();
|
|
865
|
+
}
|
|
866
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
867
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
868
|
+
}
|
|
869
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
870
|
+
const { body } = response;
|
|
871
|
+
const key = keyBuilderFromType(luvio, body);
|
|
872
|
+
luvio.storeIngest(key, ingest, body);
|
|
873
|
+
const snapshot = luvio.storeLookup({
|
|
874
|
+
recordId: key,
|
|
875
|
+
node: select(),
|
|
876
|
+
variables: {},
|
|
877
|
+
});
|
|
878
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
879
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
880
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
deepFreeze(snapshot.data);
|
|
884
|
+
return snapshot;
|
|
885
|
+
}
|
|
886
|
+
function createResourceRequest(config) {
|
|
887
|
+
const headers = {};
|
|
888
|
+
return {
|
|
889
|
+
baseUri: '/services/data/v66.0',
|
|
890
|
+
basePath: '/connect/external-document/save',
|
|
891
|
+
method: 'put',
|
|
892
|
+
body: config.body,
|
|
893
|
+
urlParams: {},
|
|
894
|
+
queryParams: {},
|
|
895
|
+
headers,
|
|
896
|
+
priority: 'normal',
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
const adapterName = 'saveExternalDocument';
|
|
901
|
+
const saveExternalDocument_ConfigPropertyMetadata = [
|
|
902
|
+
generateParamConfigMetadata('saveExternalDocumentInput', true, 2 /* Body */, 4 /* Unsupported */),
|
|
903
|
+
];
|
|
904
|
+
const saveExternalDocument_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, saveExternalDocument_ConfigPropertyMetadata);
|
|
905
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$4(saveExternalDocument_ConfigPropertyMetadata);
|
|
906
|
+
function typeCheckConfig(untrustedConfig) {
|
|
907
|
+
const config = {};
|
|
908
|
+
const untrustedConfig_saveExternalDocumentInput = untrustedConfig.saveExternalDocumentInput;
|
|
909
|
+
const referenceSaveExternalDocumentInputRepresentationValidationError = validate$1(untrustedConfig_saveExternalDocumentInput);
|
|
910
|
+
if (referenceSaveExternalDocumentInputRepresentationValidationError === null) {
|
|
911
|
+
config.saveExternalDocumentInput = untrustedConfig_saveExternalDocumentInput;
|
|
912
|
+
}
|
|
913
|
+
return config;
|
|
914
|
+
}
|
|
915
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
916
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
917
|
+
return null;
|
|
918
|
+
}
|
|
919
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
920
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
921
|
+
}
|
|
922
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
923
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
924
|
+
return null;
|
|
925
|
+
}
|
|
926
|
+
return config;
|
|
927
|
+
}
|
|
928
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
929
|
+
const resourceParams = createResourceParams(config);
|
|
930
|
+
const request = createResourceRequest(resourceParams);
|
|
931
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
932
|
+
.then((response) => {
|
|
933
|
+
return luvio.handleSuccessResponse(() => {
|
|
934
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
935
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
936
|
+
}, () => {
|
|
937
|
+
const cache = new StoreKeyMap();
|
|
938
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
939
|
+
return cache;
|
|
940
|
+
});
|
|
941
|
+
}, (response) => {
|
|
942
|
+
deepFreeze(response);
|
|
943
|
+
throw response;
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
const saveExternalDocumentAdapterFactory = (luvio) => {
|
|
947
|
+
return function saveExternalDocument(untrustedConfig) {
|
|
948
|
+
const config = validateAdapterConfig(untrustedConfig, saveExternalDocument_ConfigPropertyNames);
|
|
949
|
+
// Invalid or incomplete config
|
|
950
|
+
if (config === null) {
|
|
951
|
+
throw new Error('Invalid config for "saveExternalDocument"');
|
|
952
|
+
}
|
|
953
|
+
return buildNetworkSnapshot(luvio, config);
|
|
954
|
+
};
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
let createExternalDocument;
|
|
958
|
+
let getExternalDocument;
|
|
959
|
+
let getExternalDocumentUsers;
|
|
960
|
+
let saveExternalDocument;
|
|
961
|
+
// Imperative GET Adapters
|
|
962
|
+
let getExternalDocument_imperative;
|
|
963
|
+
let getExternalDocumentUsers_imperative;
|
|
964
|
+
const getExternalDocumentMetadata = {
|
|
965
|
+
apiFamily: 'ExternalDocument',
|
|
966
|
+
name: 'getExternalDocument',
|
|
967
|
+
ttl: 60000,
|
|
968
|
+
};
|
|
969
|
+
const getExternalDocumentUsersMetadata = {
|
|
970
|
+
apiFamily: 'ExternalDocument',
|
|
971
|
+
name: 'getExternalDocumentUsers',
|
|
972
|
+
ttl: 60000,
|
|
973
|
+
};
|
|
974
|
+
// Notify Update Available
|
|
975
|
+
function bindExportsTo(luvio) {
|
|
976
|
+
// LDS Adapters
|
|
977
|
+
const getExternalDocument_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getExternalDocument', getExternalDocumentAdapterFactory), getExternalDocumentMetadata);
|
|
978
|
+
const getExternalDocumentUsers_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getExternalDocumentUsers', getExternalDocumentUsersAdapterFactory), getExternalDocumentUsersMetadata);
|
|
979
|
+
function unwrapSnapshotData(factory) {
|
|
980
|
+
const adapter = factory(luvio);
|
|
981
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
982
|
+
}
|
|
983
|
+
return {
|
|
984
|
+
createExternalDocument: unwrapSnapshotData(createExternalDocumentAdapterFactory),
|
|
985
|
+
getExternalDocument: createWireAdapterConstructor(luvio, getExternalDocument_ldsAdapter, getExternalDocumentMetadata),
|
|
986
|
+
getExternalDocumentUsers: createWireAdapterConstructor(luvio, getExternalDocumentUsers_ldsAdapter, getExternalDocumentUsersMetadata),
|
|
987
|
+
saveExternalDocument: unwrapSnapshotData(saveExternalDocumentAdapterFactory),
|
|
988
|
+
// Imperative GET Adapters
|
|
989
|
+
getExternalDocument_imperative: createImperativeAdapter(luvio, getExternalDocument_ldsAdapter, getExternalDocumentMetadata),
|
|
990
|
+
getExternalDocumentUsers_imperative: createImperativeAdapter(luvio, getExternalDocumentUsers_ldsAdapter, getExternalDocumentUsersMetadata),
|
|
991
|
+
// Notify Update Availables
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
withDefaultLuvio((luvio) => {
|
|
995
|
+
({
|
|
996
|
+
createExternalDocument,
|
|
997
|
+
getExternalDocument,
|
|
998
|
+
getExternalDocumentUsers,
|
|
999
|
+
saveExternalDocument,
|
|
1000
|
+
getExternalDocument_imperative,
|
|
1001
|
+
getExternalDocumentUsers_imperative,
|
|
1002
|
+
} = bindExportsTo(luvio));
|
|
1003
|
+
});
|
|
1004
|
+
|
|
1005
|
+
export { createExternalDocument, getExternalDocument, getExternalDocumentUsers, getExternalDocumentUsers_imperative, getExternalDocument_imperative, saveExternalDocument };
|
|
1006
|
+
// version: 0.1.0-dev1-c978a7b010
|