@salesforce/lds-adapters-platform-named-credential 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/platform-named-credential.js +1545 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createCredential.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/adapters/deleteCredential.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/getCredential.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/adapters/getExternalCredentials.d.ts +26 -0
- package/dist/es/es2018/types/src/generated/adapters/getOAuthCredentialAuthUrl.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/adapters/updateCredential.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +6 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +9 -0
- package/dist/es/es2018/types/src/generated/resources/deleteNamedCredentialsCredential.d.ts +14 -0
- package/dist/es/es2018/types/src/generated/resources/getNamedCredentialsCredential.d.ts +17 -0
- package/dist/es/es2018/types/src/generated/resources/getNamedCredentialsExternalCredentials.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/getNamedCredentialsExternalCredentialsByDeveloperName.d.ts +15 -0
- package/dist/es/es2018/types/src/generated/resources/postNamedCredentialsCredential.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postNamedCredentialsCredentialAuthUrlOAuth.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/resources/putNamedCredentialsCredential.d.ts +13 -0
- package/dist/es/es2018/types/src/generated/types/CredentialInputRepresentation.d.ts +47 -0
- package/dist/es/es2018/types/src/generated/types/CredentialInputRepresentationWrapper.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/CredentialMapRepresentation.d.ts +32 -0
- package/dist/es/es2018/types/src/generated/types/CredentialRepresentation.d.ts +67 -0
- package/dist/es/es2018/types/src/generated/types/CredentialValueRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ExternalCredentialListRepresentation.d.ts +38 -0
- package/dist/es/es2018/types/src/generated/types/ExternalCredentialPrincipalRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/ExternalCredentialRepresentation.d.ts +54 -0
- package/dist/es/es2018/types/src/generated/types/NamedCredentialRepresentation.d.ts +31 -0
- package/dist/es/es2018/types/src/generated/types/OAuthCredentialAuthUrlInputRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/OAuthCredentialAuthUrlInputRepresentationWrapper.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/OAuthCredentialAuthUrlRepresentation.d.ts +46 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +76 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +1605 -0
- package/src/raml/api.raml +406 -0
- package/src/raml/luvio.raml +53 -0
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,1605 @@
|
|
|
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$6, typeCheckConfig as typeCheckConfig$6, buildNetworkSnapshotCachePolicy as buildNetworkSnapshotCachePolicy$2 } from 'force/luvioEngine';
|
|
18
|
+
|
|
19
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
20
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
21
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
22
|
+
/**
|
|
23
|
+
* Validates an adapter config is well-formed.
|
|
24
|
+
* @param config The config to validate.
|
|
25
|
+
* @param adapter The adapter validation configuration.
|
|
26
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
27
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
28
|
+
*/
|
|
29
|
+
function validateConfig(config, adapter, oneOf) {
|
|
30
|
+
const { displayName } = adapter;
|
|
31
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
32
|
+
if (config === undefined ||
|
|
33
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
34
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
37
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
38
|
+
}
|
|
39
|
+
if (unsupported !== undefined &&
|
|
40
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
41
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
const supported = required.concat(optional);
|
|
44
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
45
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function untrustedIsObject(untrusted) {
|
|
49
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
50
|
+
}
|
|
51
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
52
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
53
|
+
}
|
|
54
|
+
const snapshotRefreshOptions = {
|
|
55
|
+
overrides: {
|
|
56
|
+
headers: {
|
|
57
|
+
'Cache-Control': 'no-cache',
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
required,
|
|
65
|
+
resourceType,
|
|
66
|
+
typeCheckShape,
|
|
67
|
+
isArrayShape,
|
|
68
|
+
coerceFn,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
72
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
73
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
74
|
+
return {
|
|
75
|
+
displayName,
|
|
76
|
+
parameters: {
|
|
77
|
+
required,
|
|
78
|
+
optional,
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const keyPrefix = 'named-credential';
|
|
83
|
+
|
|
84
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
85
|
+
const { isArray: ArrayIsArray } = Array;
|
|
86
|
+
const { stringify: JSONStringify } = JSON;
|
|
87
|
+
function equalsArray(a, b, equalsItem) {
|
|
88
|
+
const aLength = a.length;
|
|
89
|
+
const bLength = b.length;
|
|
90
|
+
if (aLength !== bLength) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
for (let i = 0; i < aLength; i++) {
|
|
94
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
function createLink(ref) {
|
|
101
|
+
return {
|
|
102
|
+
__ref: serializeStructuredKey(ref),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function validate$8(obj, path = 'CredentialInputRepresentation') {
|
|
107
|
+
const v_error = (() => {
|
|
108
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
109
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
110
|
+
}
|
|
111
|
+
if (obj.authenticationProtocol !== undefined) {
|
|
112
|
+
const obj_authenticationProtocol = obj.authenticationProtocol;
|
|
113
|
+
const path_authenticationProtocol = path + '.authenticationProtocol';
|
|
114
|
+
if (typeof obj_authenticationProtocol !== 'string') {
|
|
115
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocol + '" (at "' + path_authenticationProtocol + '")');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (obj.authenticationProtocolVariant !== undefined) {
|
|
119
|
+
const obj_authenticationProtocolVariant = obj.authenticationProtocolVariant;
|
|
120
|
+
const path_authenticationProtocolVariant = path + '.authenticationProtocolVariant';
|
|
121
|
+
if (typeof obj_authenticationProtocolVariant !== 'string') {
|
|
122
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocolVariant + '" (at "' + path_authenticationProtocolVariant + '")');
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const obj_credentials = obj.credentials;
|
|
126
|
+
const path_credentials = path + '.credentials';
|
|
127
|
+
if (typeof obj_credentials !== 'object' || ArrayIsArray(obj_credentials) || obj_credentials === null) {
|
|
128
|
+
return new TypeError('Expected "object" but received "' + typeof obj_credentials + '" (at "' + path_credentials + '")');
|
|
129
|
+
}
|
|
130
|
+
const obj_credentials_keys = ObjectKeys(obj_credentials);
|
|
131
|
+
for (let i = 0; i < obj_credentials_keys.length; i++) {
|
|
132
|
+
const key = obj_credentials_keys[i];
|
|
133
|
+
const obj_credentials_prop = obj_credentials[key];
|
|
134
|
+
const path_credentials_prop = path_credentials + '["' + key + '"]';
|
|
135
|
+
if (typeof obj_credentials_prop !== 'object' || ArrayIsArray(obj_credentials_prop) || obj_credentials_prop === null) {
|
|
136
|
+
return new TypeError('Expected "object" but received "' + typeof obj_credentials_prop + '" (at "' + path_credentials_prop + '")');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const obj_externalCredential = obj.externalCredential;
|
|
140
|
+
const path_externalCredential = path + '.externalCredential';
|
|
141
|
+
if (typeof obj_externalCredential !== 'string') {
|
|
142
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
|
|
143
|
+
}
|
|
144
|
+
const obj_principalName = obj.principalName;
|
|
145
|
+
const path_principalName = path + '.principalName';
|
|
146
|
+
if (typeof obj_principalName !== 'string') {
|
|
147
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
148
|
+
}
|
|
149
|
+
const obj_principalType = obj.principalType;
|
|
150
|
+
const path_principalType = path + '.principalType';
|
|
151
|
+
if (typeof obj_principalType !== 'string') {
|
|
152
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
|
|
153
|
+
}
|
|
154
|
+
})();
|
|
155
|
+
return v_error === undefined ? null : v_error;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function validate$7(obj, path = 'CredentialValueRepresentation') {
|
|
159
|
+
const v_error = (() => {
|
|
160
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
161
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
162
|
+
}
|
|
163
|
+
const obj_encrypted = obj.encrypted;
|
|
164
|
+
const path_encrypted = path + '.encrypted';
|
|
165
|
+
if (typeof obj_encrypted !== 'boolean') {
|
|
166
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_encrypted + '" (at "' + path_encrypted + '")');
|
|
167
|
+
}
|
|
168
|
+
if (obj.revision !== undefined) {
|
|
169
|
+
const obj_revision = obj.revision;
|
|
170
|
+
const path_revision = path + '.revision';
|
|
171
|
+
let obj_revision_union0 = null;
|
|
172
|
+
const obj_revision_union0_error = (() => {
|
|
173
|
+
if (typeof obj_revision !== 'number' || (typeof obj_revision === 'number' && Math.floor(obj_revision) !== obj_revision)) {
|
|
174
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_revision + '" (at "' + path_revision + '")');
|
|
175
|
+
}
|
|
176
|
+
})();
|
|
177
|
+
if (obj_revision_union0_error != null) {
|
|
178
|
+
obj_revision_union0 = obj_revision_union0_error.message;
|
|
179
|
+
}
|
|
180
|
+
let obj_revision_union1 = null;
|
|
181
|
+
const obj_revision_union1_error = (() => {
|
|
182
|
+
if (obj_revision !== null) {
|
|
183
|
+
return new TypeError('Expected "null" but received "' + typeof obj_revision + '" (at "' + path_revision + '")');
|
|
184
|
+
}
|
|
185
|
+
})();
|
|
186
|
+
if (obj_revision_union1_error != null) {
|
|
187
|
+
obj_revision_union1 = obj_revision_union1_error.message;
|
|
188
|
+
}
|
|
189
|
+
if (obj_revision_union0 && obj_revision_union1) {
|
|
190
|
+
let message = 'Object doesn\'t match union (at "' + path_revision + '")';
|
|
191
|
+
message += '\n' + obj_revision_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
192
|
+
message += '\n' + obj_revision_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
193
|
+
return new TypeError(message);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (obj.value !== undefined) {
|
|
197
|
+
const obj_value = obj.value;
|
|
198
|
+
const path_value = path + '.value';
|
|
199
|
+
let obj_value_union0 = null;
|
|
200
|
+
const obj_value_union0_error = (() => {
|
|
201
|
+
if (typeof obj_value !== 'string') {
|
|
202
|
+
return new TypeError('Expected "string" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
203
|
+
}
|
|
204
|
+
})();
|
|
205
|
+
if (obj_value_union0_error != null) {
|
|
206
|
+
obj_value_union0 = obj_value_union0_error.message;
|
|
207
|
+
}
|
|
208
|
+
let obj_value_union1 = null;
|
|
209
|
+
const obj_value_union1_error = (() => {
|
|
210
|
+
if (obj_value !== null) {
|
|
211
|
+
return new TypeError('Expected "null" but received "' + typeof obj_value + '" (at "' + path_value + '")');
|
|
212
|
+
}
|
|
213
|
+
})();
|
|
214
|
+
if (obj_value_union1_error != null) {
|
|
215
|
+
obj_value_union1 = obj_value_union1_error.message;
|
|
216
|
+
}
|
|
217
|
+
if (obj_value_union0 && obj_value_union1) {
|
|
218
|
+
let message = 'Object doesn\'t match union (at "' + path_value + '")';
|
|
219
|
+
message += '\n' + obj_value_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
220
|
+
message += '\n' + obj_value_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
221
|
+
return new TypeError(message);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
})();
|
|
225
|
+
return v_error === undefined ? null : v_error;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const TTL = 100;
|
|
229
|
+
const VERSION$5 = "cea79b36245bc9456aff9b5c491058d0";
|
|
230
|
+
function validate$6(obj, path = 'CredentialRepresentation') {
|
|
231
|
+
const v_error = (() => {
|
|
232
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
233
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
234
|
+
}
|
|
235
|
+
if (obj.authenticationProtocol !== undefined) {
|
|
236
|
+
const obj_authenticationProtocol = obj.authenticationProtocol;
|
|
237
|
+
const path_authenticationProtocol = path + '.authenticationProtocol';
|
|
238
|
+
if (typeof obj_authenticationProtocol !== 'string') {
|
|
239
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocol + '" (at "' + path_authenticationProtocol + '")');
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (obj.authenticationProtocolVariant !== undefined) {
|
|
243
|
+
const obj_authenticationProtocolVariant = obj.authenticationProtocolVariant;
|
|
244
|
+
const path_authenticationProtocolVariant = path + '.authenticationProtocolVariant';
|
|
245
|
+
if (typeof obj_authenticationProtocolVariant !== 'string') {
|
|
246
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocolVariant + '" (at "' + path_authenticationProtocolVariant + '")');
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const obj_authenticationStatus = obj.authenticationStatus;
|
|
250
|
+
const path_authenticationStatus = path + '.authenticationStatus';
|
|
251
|
+
if (typeof obj_authenticationStatus !== 'string') {
|
|
252
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationStatus + '" (at "' + path_authenticationStatus + '")');
|
|
253
|
+
}
|
|
254
|
+
const obj_credentials = obj.credentials;
|
|
255
|
+
const path_credentials = path + '.credentials';
|
|
256
|
+
if (typeof obj_credentials !== 'object' || ArrayIsArray(obj_credentials) || obj_credentials === null) {
|
|
257
|
+
return new TypeError('Expected "object" but received "' + typeof obj_credentials + '" (at "' + path_credentials + '")');
|
|
258
|
+
}
|
|
259
|
+
const obj_credentials_keys = ObjectKeys(obj_credentials);
|
|
260
|
+
for (let i = 0; i < obj_credentials_keys.length; i++) {
|
|
261
|
+
const key = obj_credentials_keys[i];
|
|
262
|
+
const obj_credentials_prop = obj_credentials[key];
|
|
263
|
+
const path_credentials_prop = path_credentials + '["' + key + '"]';
|
|
264
|
+
const referencepath_credentials_propValidationError = validate$7(obj_credentials_prop, path_credentials_prop);
|
|
265
|
+
if (referencepath_credentials_propValidationError !== null) {
|
|
266
|
+
let message = 'Object doesn\'t match CredentialValueRepresentation (at "' + path_credentials_prop + '")\n';
|
|
267
|
+
message += referencepath_credentials_propValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
268
|
+
return new TypeError(message);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const obj_externalCredential = obj.externalCredential;
|
|
272
|
+
const path_externalCredential = path + '.externalCredential';
|
|
273
|
+
if (typeof obj_externalCredential !== 'string') {
|
|
274
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
|
|
275
|
+
}
|
|
276
|
+
const obj_principalName = obj.principalName;
|
|
277
|
+
const path_principalName = path + '.principalName';
|
|
278
|
+
let obj_principalName_union0 = null;
|
|
279
|
+
const obj_principalName_union0_error = (() => {
|
|
280
|
+
if (typeof obj_principalName !== 'string') {
|
|
281
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
282
|
+
}
|
|
283
|
+
})();
|
|
284
|
+
if (obj_principalName_union0_error != null) {
|
|
285
|
+
obj_principalName_union0 = obj_principalName_union0_error.message;
|
|
286
|
+
}
|
|
287
|
+
let obj_principalName_union1 = null;
|
|
288
|
+
const obj_principalName_union1_error = (() => {
|
|
289
|
+
if (obj_principalName !== null) {
|
|
290
|
+
return new TypeError('Expected "null" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
291
|
+
}
|
|
292
|
+
})();
|
|
293
|
+
if (obj_principalName_union1_error != null) {
|
|
294
|
+
obj_principalName_union1 = obj_principalName_union1_error.message;
|
|
295
|
+
}
|
|
296
|
+
if (obj_principalName_union0 && obj_principalName_union1) {
|
|
297
|
+
let message = 'Object doesn\'t match union (at "' + path_principalName + '")';
|
|
298
|
+
message += '\n' + obj_principalName_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
299
|
+
message += '\n' + obj_principalName_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
300
|
+
return new TypeError(message);
|
|
301
|
+
}
|
|
302
|
+
const obj_principalType = obj.principalType;
|
|
303
|
+
const path_principalType = path + '.principalType';
|
|
304
|
+
if (typeof obj_principalType !== 'string') {
|
|
305
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
|
|
306
|
+
}
|
|
307
|
+
})();
|
|
308
|
+
return v_error === undefined ? null : v_error;
|
|
309
|
+
}
|
|
310
|
+
const RepresentationType$3 = 'CredentialRepresentation';
|
|
311
|
+
function keyBuilder$7(luvio, config) {
|
|
312
|
+
return keyPrefix + '::' + RepresentationType$3 + ':' + config.externalCredential + ':' + config.principalType + ':' + (config.principalName === null ? '' : config.principalName);
|
|
313
|
+
}
|
|
314
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
315
|
+
const keyParams = {
|
|
316
|
+
externalCredential: object.externalCredential,
|
|
317
|
+
principalType: object.principalType,
|
|
318
|
+
principalName: object.principalName
|
|
319
|
+
};
|
|
320
|
+
return keyBuilder$7(luvio, keyParams);
|
|
321
|
+
}
|
|
322
|
+
function normalize$3(input, existing, path, luvio, store, timestamp) {
|
|
323
|
+
return input;
|
|
324
|
+
}
|
|
325
|
+
const select$a = function CredentialRepresentationSelect() {
|
|
326
|
+
return {
|
|
327
|
+
kind: 'Fragment',
|
|
328
|
+
version: VERSION$5,
|
|
329
|
+
private: [],
|
|
330
|
+
opaque: true
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
function equals$5(existing, incoming) {
|
|
334
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
const ingest$3 = function CredentialRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
340
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
341
|
+
const validateError = validate$6(input);
|
|
342
|
+
if (validateError !== null) {
|
|
343
|
+
throw validateError;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
347
|
+
const ttlToUse = TTL;
|
|
348
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$3, "named-credential", VERSION$5, RepresentationType$3, equals$5);
|
|
349
|
+
return createLink(key);
|
|
350
|
+
};
|
|
351
|
+
function getTypeCacheKeys$3(rootKeySet, luvio, input, fullPathFactory) {
|
|
352
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
353
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
354
|
+
rootKeySet.set(rootKey, {
|
|
355
|
+
namespace: keyPrefix,
|
|
356
|
+
representationName: RepresentationType$3,
|
|
357
|
+
mergeable: false
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function select$9(luvio, params) {
|
|
362
|
+
return select$a();
|
|
363
|
+
}
|
|
364
|
+
function getResponseCacheKeys$5(storeKeyMap, luvio, resourceParams, response) {
|
|
365
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
366
|
+
}
|
|
367
|
+
function ingestSuccess$4(luvio, resourceParams, response) {
|
|
368
|
+
const { body } = response;
|
|
369
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
370
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
371
|
+
const snapshot = luvio.storeLookup({
|
|
372
|
+
recordId: key,
|
|
373
|
+
node: select$9(),
|
|
374
|
+
variables: {},
|
|
375
|
+
});
|
|
376
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
377
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
378
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
deepFreeze(snapshot.data);
|
|
382
|
+
return snapshot;
|
|
383
|
+
}
|
|
384
|
+
function createResourceRequest$5(config) {
|
|
385
|
+
const headers = {};
|
|
386
|
+
return {
|
|
387
|
+
baseUri: '/services/data/v66.0',
|
|
388
|
+
basePath: '/named-credentials/credential',
|
|
389
|
+
method: 'post',
|
|
390
|
+
body: config.body,
|
|
391
|
+
urlParams: {},
|
|
392
|
+
queryParams: config.queryParams,
|
|
393
|
+
headers,
|
|
394
|
+
priority: 'normal',
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const adapterName$5 = 'createCredential';
|
|
399
|
+
const createCredential_ConfigPropertyMetadata = [
|
|
400
|
+
generateParamConfigMetadata('action', false, 1 /* QueryParameter */, 0 /* String */),
|
|
401
|
+
generateParamConfigMetadata('requestBody', true, 2 /* Body */, 4 /* Unsupported */),
|
|
402
|
+
];
|
|
403
|
+
const createCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$5, createCredential_ConfigPropertyMetadata);
|
|
404
|
+
const createResourceParams$5 = /*#__PURE__*/ createResourceParams$6(createCredential_ConfigPropertyMetadata);
|
|
405
|
+
function typeCheckConfig$5(untrustedConfig) {
|
|
406
|
+
const config = {};
|
|
407
|
+
typeCheckConfig$6(untrustedConfig, config, createCredential_ConfigPropertyMetadata);
|
|
408
|
+
const untrustedConfig_requestBody = untrustedConfig.requestBody;
|
|
409
|
+
const referenceCredentialInputRepresentationValidationError = validate$8(untrustedConfig_requestBody);
|
|
410
|
+
if (referenceCredentialInputRepresentationValidationError === null) {
|
|
411
|
+
config.requestBody = untrustedConfig_requestBody;
|
|
412
|
+
}
|
|
413
|
+
return config;
|
|
414
|
+
}
|
|
415
|
+
function validateAdapterConfig$5(untrustedConfig, configPropertyNames) {
|
|
416
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
420
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
421
|
+
}
|
|
422
|
+
const config = typeCheckConfig$5(untrustedConfig);
|
|
423
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
return config;
|
|
427
|
+
}
|
|
428
|
+
function buildNetworkSnapshot$5(luvio, config, options) {
|
|
429
|
+
const resourceParams = createResourceParams$5(config);
|
|
430
|
+
const request = createResourceRequest$5(resourceParams);
|
|
431
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
432
|
+
.then((response) => {
|
|
433
|
+
return luvio.handleSuccessResponse(() => {
|
|
434
|
+
const snapshot = ingestSuccess$4(luvio, resourceParams, response);
|
|
435
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
436
|
+
}, () => {
|
|
437
|
+
const cache = new StoreKeyMap();
|
|
438
|
+
getResponseCacheKeys$5(cache, luvio, resourceParams, response.body);
|
|
439
|
+
return cache;
|
|
440
|
+
});
|
|
441
|
+
}, (response) => {
|
|
442
|
+
deepFreeze(response);
|
|
443
|
+
throw response;
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
const createCredentialAdapterFactory = (luvio) => {
|
|
447
|
+
return function createCredential(untrustedConfig) {
|
|
448
|
+
const config = validateAdapterConfig$5(untrustedConfig, createCredential_ConfigPropertyNames);
|
|
449
|
+
// Invalid or incomplete config
|
|
450
|
+
if (config === null) {
|
|
451
|
+
throw new Error('Invalid config for "createCredential"');
|
|
452
|
+
}
|
|
453
|
+
return buildNetworkSnapshot$5(luvio, config);
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
function keyBuilder$6(luvio, params) {
|
|
458
|
+
return keyBuilder$7(luvio, {
|
|
459
|
+
externalCredential: params.queryParams.externalCredential || '',
|
|
460
|
+
principalType: params.queryParams.principalType || '',
|
|
461
|
+
principalName: params.queryParams.principalName || ''
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function getResponseCacheKeys$4(cacheKeyMap, luvio, resourceParams) {
|
|
465
|
+
const key = keyBuilder$6(luvio, resourceParams);
|
|
466
|
+
cacheKeyMap.set(key, {
|
|
467
|
+
namespace: keyPrefix,
|
|
468
|
+
representationName: RepresentationType$3,
|
|
469
|
+
mergeable: false
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function evictSuccess(luvio, resourceParams) {
|
|
473
|
+
const key = keyBuilder$6(luvio, resourceParams);
|
|
474
|
+
luvio.storeEvict(key);
|
|
475
|
+
}
|
|
476
|
+
function createResourceRequest$4(config) {
|
|
477
|
+
const headers = {};
|
|
478
|
+
return {
|
|
479
|
+
baseUri: '/services/data/v66.0',
|
|
480
|
+
basePath: '/named-credentials/credential',
|
|
481
|
+
method: 'delete',
|
|
482
|
+
body: null,
|
|
483
|
+
urlParams: {},
|
|
484
|
+
queryParams: config.queryParams,
|
|
485
|
+
headers,
|
|
486
|
+
priority: 'normal',
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const adapterName$4 = 'deleteCredential';
|
|
491
|
+
const deleteCredential_ConfigPropertyMetadata = [
|
|
492
|
+
generateParamConfigMetadata('externalCredential', false, 1 /* QueryParameter */, 0 /* String */),
|
|
493
|
+
generateParamConfigMetadata('principalName', false, 1 /* QueryParameter */, 0 /* String */),
|
|
494
|
+
generateParamConfigMetadata('principalType', false, 1 /* QueryParameter */, 0 /* String */),
|
|
495
|
+
];
|
|
496
|
+
const deleteCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$4, deleteCredential_ConfigPropertyMetadata);
|
|
497
|
+
const createResourceParams$4 = /*#__PURE__*/ createResourceParams$6(deleteCredential_ConfigPropertyMetadata);
|
|
498
|
+
function typeCheckConfig$4(untrustedConfig) {
|
|
499
|
+
const config = {};
|
|
500
|
+
typeCheckConfig$6(untrustedConfig, config, deleteCredential_ConfigPropertyMetadata);
|
|
501
|
+
return config;
|
|
502
|
+
}
|
|
503
|
+
function validateAdapterConfig$4(untrustedConfig, configPropertyNames) {
|
|
504
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
508
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
509
|
+
}
|
|
510
|
+
const config = typeCheckConfig$4(untrustedConfig);
|
|
511
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
512
|
+
return null;
|
|
513
|
+
}
|
|
514
|
+
return config;
|
|
515
|
+
}
|
|
516
|
+
function buildNetworkSnapshot$4(luvio, config, options) {
|
|
517
|
+
const resourceParams = createResourceParams$4(config);
|
|
518
|
+
const request = createResourceRequest$4(resourceParams);
|
|
519
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
520
|
+
.then(() => {
|
|
521
|
+
return luvio.handleSuccessResponse(() => {
|
|
522
|
+
evictSuccess(luvio, resourceParams);
|
|
523
|
+
return luvio.storeBroadcast();
|
|
524
|
+
}, () => {
|
|
525
|
+
const cache = new StoreKeyMap();
|
|
526
|
+
getResponseCacheKeys$4(cache, luvio, resourceParams);
|
|
527
|
+
return cache;
|
|
528
|
+
});
|
|
529
|
+
}, (response) => {
|
|
530
|
+
deepFreeze(response);
|
|
531
|
+
throw response;
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
const deleteCredentialAdapterFactory = (luvio) => {
|
|
535
|
+
return function namedCredentialdeleteCredential(untrustedConfig) {
|
|
536
|
+
const config = validateAdapterConfig$4(untrustedConfig, deleteCredential_ConfigPropertyNames);
|
|
537
|
+
// Invalid or incomplete config
|
|
538
|
+
if (config === null) {
|
|
539
|
+
throw new Error(`Invalid config for "${adapterName$4}"`);
|
|
540
|
+
}
|
|
541
|
+
return buildNetworkSnapshot$4(luvio, config);
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
function select$8(luvio, params) {
|
|
546
|
+
return select$a();
|
|
547
|
+
}
|
|
548
|
+
function keyBuilder$5(luvio, params) {
|
|
549
|
+
return keyBuilder$7(luvio, {
|
|
550
|
+
externalCredential: params.queryParams.externalCredential || '',
|
|
551
|
+
principalType: params.queryParams.principalType || '',
|
|
552
|
+
principalName: params.queryParams.principalName || ''
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function getResponseCacheKeys$3(storeKeyMap, luvio, resourceParams, response) {
|
|
556
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
557
|
+
}
|
|
558
|
+
function ingestSuccess$3(luvio, resourceParams, response, snapshotRefresh) {
|
|
559
|
+
const { body } = response;
|
|
560
|
+
const key = keyBuilder$5(luvio, resourceParams);
|
|
561
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
562
|
+
const snapshot = luvio.storeLookup({
|
|
563
|
+
recordId: key,
|
|
564
|
+
node: select$8(),
|
|
565
|
+
variables: {},
|
|
566
|
+
}, snapshotRefresh);
|
|
567
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
568
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
569
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
deepFreeze(snapshot.data);
|
|
573
|
+
return snapshot;
|
|
574
|
+
}
|
|
575
|
+
function ingestError$1(luvio, params, error, snapshotRefresh) {
|
|
576
|
+
const key = keyBuilder$5(luvio, params);
|
|
577
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
578
|
+
const storeMetadataParams = {
|
|
579
|
+
ttl: TTL,
|
|
580
|
+
namespace: keyPrefix,
|
|
581
|
+
version: VERSION$5,
|
|
582
|
+
representationName: RepresentationType$3
|
|
583
|
+
};
|
|
584
|
+
luvio.storeIngestError(key, errorSnapshot, storeMetadataParams);
|
|
585
|
+
return errorSnapshot;
|
|
586
|
+
}
|
|
587
|
+
function createResourceRequest$3(config) {
|
|
588
|
+
const headers = {};
|
|
589
|
+
return {
|
|
590
|
+
baseUri: '/services/data/v66.0',
|
|
591
|
+
basePath: '/named-credentials/credential',
|
|
592
|
+
method: 'get',
|
|
593
|
+
body: null,
|
|
594
|
+
urlParams: {},
|
|
595
|
+
queryParams: config.queryParams,
|
|
596
|
+
headers,
|
|
597
|
+
priority: 'normal',
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const adapterName$3 = 'getCredential';
|
|
602
|
+
const getCredential_ConfigPropertyMetadata = [
|
|
603
|
+
generateParamConfigMetadata('externalCredential', false, 1 /* QueryParameter */, 0 /* String */),
|
|
604
|
+
generateParamConfigMetadata('principalName', false, 1 /* QueryParameter */, 0 /* String */),
|
|
605
|
+
generateParamConfigMetadata('principalType', false, 1 /* QueryParameter */, 0 /* String */),
|
|
606
|
+
];
|
|
607
|
+
const getCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$3, getCredential_ConfigPropertyMetadata);
|
|
608
|
+
const createResourceParams$3 = /*#__PURE__*/ createResourceParams$6(getCredential_ConfigPropertyMetadata);
|
|
609
|
+
function keyBuilder$4(luvio, config) {
|
|
610
|
+
const resourceParams = createResourceParams$3(config);
|
|
611
|
+
return keyBuilder$5(luvio, resourceParams);
|
|
612
|
+
}
|
|
613
|
+
function typeCheckConfig$3(untrustedConfig) {
|
|
614
|
+
const config = {};
|
|
615
|
+
typeCheckConfig$6(untrustedConfig, config, getCredential_ConfigPropertyMetadata);
|
|
616
|
+
return config;
|
|
617
|
+
}
|
|
618
|
+
function validateAdapterConfig$3(untrustedConfig, configPropertyNames) {
|
|
619
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
623
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
624
|
+
}
|
|
625
|
+
const config = typeCheckConfig$3(untrustedConfig);
|
|
626
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
return config;
|
|
630
|
+
}
|
|
631
|
+
function adapterFragment$1(luvio, config) {
|
|
632
|
+
createResourceParams$3(config);
|
|
633
|
+
return select$8();
|
|
634
|
+
}
|
|
635
|
+
function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
|
|
636
|
+
const snapshot = ingestSuccess$3(luvio, resourceParams, response, {
|
|
637
|
+
config,
|
|
638
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
639
|
+
});
|
|
640
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
641
|
+
}
|
|
642
|
+
function onFetchResponseError$1(luvio, config, resourceParams, response) {
|
|
643
|
+
const snapshot = ingestError$1(luvio, resourceParams, response, {
|
|
644
|
+
config,
|
|
645
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
646
|
+
});
|
|
647
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
648
|
+
}
|
|
649
|
+
function buildNetworkSnapshot$3(luvio, config, options) {
|
|
650
|
+
const resourceParams = createResourceParams$3(config);
|
|
651
|
+
const request = createResourceRequest$3(resourceParams);
|
|
652
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
653
|
+
.then((response) => {
|
|
654
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess$1(luvio, config, resourceParams, response), () => {
|
|
655
|
+
const cache = new StoreKeyMap();
|
|
656
|
+
getResponseCacheKeys$3(cache, luvio, resourceParams, response.body);
|
|
657
|
+
return cache;
|
|
658
|
+
});
|
|
659
|
+
}, (response) => {
|
|
660
|
+
return luvio.handleErrorResponse(() => onFetchResponseError$1(luvio, config, resourceParams, response));
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
function buildNetworkSnapshotCachePolicy$1(context, coercedAdapterRequestContext) {
|
|
664
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$3, undefined, false);
|
|
665
|
+
}
|
|
666
|
+
function buildCachedSnapshotCachePolicy$1(context, storeLookup) {
|
|
667
|
+
const { luvio, config } = context;
|
|
668
|
+
const selector = {
|
|
669
|
+
recordId: keyBuilder$4(luvio, config),
|
|
670
|
+
node: adapterFragment$1(luvio, config),
|
|
671
|
+
variables: {},
|
|
672
|
+
};
|
|
673
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
674
|
+
config,
|
|
675
|
+
resolve: () => buildNetworkSnapshot$3(luvio, config, snapshotRefreshOptions)
|
|
676
|
+
});
|
|
677
|
+
return cacheSnapshot;
|
|
678
|
+
}
|
|
679
|
+
const getCredentialAdapterFactory = (luvio) => function namedCredential__getCredential(untrustedConfig, requestContext) {
|
|
680
|
+
const config = validateAdapterConfig$3(untrustedConfig, getCredential_ConfigPropertyNames);
|
|
681
|
+
// Invalid or incomplete config
|
|
682
|
+
if (config === null) {
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
686
|
+
buildCachedSnapshotCachePolicy$1, buildNetworkSnapshotCachePolicy$1);
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
const VERSION$4 = "8273df0ef3d3fc086107b780cd8d0cb8";
|
|
690
|
+
function validate$5(obj, path = 'ExternalCredentialPrincipalRepresentation') {
|
|
691
|
+
const v_error = (() => {
|
|
692
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
693
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
694
|
+
}
|
|
695
|
+
const obj_authenticationStatus = obj.authenticationStatus;
|
|
696
|
+
const path_authenticationStatus = path + '.authenticationStatus';
|
|
697
|
+
if (typeof obj_authenticationStatus !== 'string') {
|
|
698
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationStatus + '" (at "' + path_authenticationStatus + '")');
|
|
699
|
+
}
|
|
700
|
+
const obj_principalName = obj.principalName;
|
|
701
|
+
const path_principalName = path + '.principalName';
|
|
702
|
+
let obj_principalName_union0 = null;
|
|
703
|
+
const obj_principalName_union0_error = (() => {
|
|
704
|
+
if (typeof obj_principalName !== 'string') {
|
|
705
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
706
|
+
}
|
|
707
|
+
})();
|
|
708
|
+
if (obj_principalName_union0_error != null) {
|
|
709
|
+
obj_principalName_union0 = obj_principalName_union0_error.message;
|
|
710
|
+
}
|
|
711
|
+
let obj_principalName_union1 = null;
|
|
712
|
+
const obj_principalName_union1_error = (() => {
|
|
713
|
+
if (obj_principalName !== null) {
|
|
714
|
+
return new TypeError('Expected "null" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
715
|
+
}
|
|
716
|
+
})();
|
|
717
|
+
if (obj_principalName_union1_error != null) {
|
|
718
|
+
obj_principalName_union1 = obj_principalName_union1_error.message;
|
|
719
|
+
}
|
|
720
|
+
if (obj_principalName_union0 && obj_principalName_union1) {
|
|
721
|
+
let message = 'Object doesn\'t match union (at "' + path_principalName + '")';
|
|
722
|
+
message += '\n' + obj_principalName_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
723
|
+
message += '\n' + obj_principalName_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
724
|
+
return new TypeError(message);
|
|
725
|
+
}
|
|
726
|
+
const obj_principalType = obj.principalType;
|
|
727
|
+
const path_principalType = path + '.principalType';
|
|
728
|
+
if (typeof obj_principalType !== 'string') {
|
|
729
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
|
|
730
|
+
}
|
|
731
|
+
})();
|
|
732
|
+
return v_error === undefined ? null : v_error;
|
|
733
|
+
}
|
|
734
|
+
const select$7 = function ExternalCredentialPrincipalRepresentationSelect() {
|
|
735
|
+
return {
|
|
736
|
+
kind: 'Fragment',
|
|
737
|
+
version: VERSION$4,
|
|
738
|
+
private: [],
|
|
739
|
+
selections: [
|
|
740
|
+
{
|
|
741
|
+
name: 'authenticationStatus',
|
|
742
|
+
kind: 'Scalar'
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: 'principalName',
|
|
746
|
+
kind: 'Scalar'
|
|
747
|
+
},
|
|
748
|
+
{
|
|
749
|
+
name: 'principalType',
|
|
750
|
+
kind: 'Scalar'
|
|
751
|
+
}
|
|
752
|
+
]
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
function equals$4(existing, incoming) {
|
|
756
|
+
const existing_authenticationStatus = existing.authenticationStatus;
|
|
757
|
+
const incoming_authenticationStatus = incoming.authenticationStatus;
|
|
758
|
+
if (!(existing_authenticationStatus === incoming_authenticationStatus)) {
|
|
759
|
+
return false;
|
|
760
|
+
}
|
|
761
|
+
const existing_principalType = existing.principalType;
|
|
762
|
+
const incoming_principalType = incoming.principalType;
|
|
763
|
+
if (!(existing_principalType === incoming_principalType)) {
|
|
764
|
+
return false;
|
|
765
|
+
}
|
|
766
|
+
const existing_principalName = existing.principalName;
|
|
767
|
+
const incoming_principalName = incoming.principalName;
|
|
768
|
+
if (!(existing_principalName === incoming_principalName)) {
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
return true;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
const VERSION$3 = "95db03e0e8990cc8f51f006ccf355bf9";
|
|
775
|
+
function validate$4(obj, path = 'NamedCredentialRepresentation') {
|
|
776
|
+
const v_error = (() => {
|
|
777
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
778
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
779
|
+
}
|
|
780
|
+
const obj_developerName = obj.developerName;
|
|
781
|
+
const path_developerName = path + '.developerName';
|
|
782
|
+
if (typeof obj_developerName !== 'string') {
|
|
783
|
+
return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
|
|
784
|
+
}
|
|
785
|
+
const obj_masterLabel = obj.masterLabel;
|
|
786
|
+
const path_masterLabel = path + '.masterLabel';
|
|
787
|
+
if (typeof obj_masterLabel !== 'string') {
|
|
788
|
+
return new TypeError('Expected "string" but received "' + typeof obj_masterLabel + '" (at "' + path_masterLabel + '")');
|
|
789
|
+
}
|
|
790
|
+
})();
|
|
791
|
+
return v_error === undefined ? null : v_error;
|
|
792
|
+
}
|
|
793
|
+
const select$6 = function NamedCredentialRepresentationSelect() {
|
|
794
|
+
return {
|
|
795
|
+
kind: 'Fragment',
|
|
796
|
+
version: VERSION$3,
|
|
797
|
+
private: [],
|
|
798
|
+
selections: [
|
|
799
|
+
{
|
|
800
|
+
name: 'developerName',
|
|
801
|
+
kind: 'Scalar'
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: 'masterLabel',
|
|
805
|
+
kind: 'Scalar'
|
|
806
|
+
}
|
|
807
|
+
]
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
function equals$3(existing, incoming) {
|
|
811
|
+
const existing_developerName = existing.developerName;
|
|
812
|
+
const incoming_developerName = incoming.developerName;
|
|
813
|
+
if (!(existing_developerName === incoming_developerName)) {
|
|
814
|
+
return false;
|
|
815
|
+
}
|
|
816
|
+
const existing_masterLabel = existing.masterLabel;
|
|
817
|
+
const incoming_masterLabel = incoming.masterLabel;
|
|
818
|
+
if (!(existing_masterLabel === incoming_masterLabel)) {
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
return true;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
const VERSION$2 = "fd37a032d72e3491fe4d211486a3fea1";
|
|
825
|
+
function validate$3(obj, path = 'ExternalCredentialRepresentation') {
|
|
826
|
+
const v_error = (() => {
|
|
827
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
828
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
829
|
+
}
|
|
830
|
+
const obj_authenticationProtocol = obj.authenticationProtocol;
|
|
831
|
+
const path_authenticationProtocol = path + '.authenticationProtocol';
|
|
832
|
+
if (typeof obj_authenticationProtocol !== 'string') {
|
|
833
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationProtocol + '" (at "' + path_authenticationProtocol + '")');
|
|
834
|
+
}
|
|
835
|
+
const obj_authenticationStatus = obj.authenticationStatus;
|
|
836
|
+
const path_authenticationStatus = path + '.authenticationStatus';
|
|
837
|
+
if (typeof obj_authenticationStatus !== 'string') {
|
|
838
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationStatus + '" (at "' + path_authenticationStatus + '")');
|
|
839
|
+
}
|
|
840
|
+
const obj_developerName = obj.developerName;
|
|
841
|
+
const path_developerName = path + '.developerName';
|
|
842
|
+
if (typeof obj_developerName !== 'string') {
|
|
843
|
+
return new TypeError('Expected "string" but received "' + typeof obj_developerName + '" (at "' + path_developerName + '")');
|
|
844
|
+
}
|
|
845
|
+
const obj_masterLabel = obj.masterLabel;
|
|
846
|
+
const path_masterLabel = path + '.masterLabel';
|
|
847
|
+
if (typeof obj_masterLabel !== 'string') {
|
|
848
|
+
return new TypeError('Expected "string" but received "' + typeof obj_masterLabel + '" (at "' + path_masterLabel + '")');
|
|
849
|
+
}
|
|
850
|
+
const obj_principals = obj.principals;
|
|
851
|
+
const path_principals = path + '.principals';
|
|
852
|
+
if (!ArrayIsArray(obj_principals)) {
|
|
853
|
+
return new TypeError('Expected "array" but received "' + typeof obj_principals + '" (at "' + path_principals + '")');
|
|
854
|
+
}
|
|
855
|
+
for (let i = 0; i < obj_principals.length; i++) {
|
|
856
|
+
const obj_principals_item = obj_principals[i];
|
|
857
|
+
const path_principals_item = path_principals + '[' + i + ']';
|
|
858
|
+
const referencepath_principals_itemValidationError = validate$5(obj_principals_item, path_principals_item);
|
|
859
|
+
if (referencepath_principals_itemValidationError !== null) {
|
|
860
|
+
let message = 'Object doesn\'t match ExternalCredentialPrincipalRepresentation (at "' + path_principals_item + '")\n';
|
|
861
|
+
message += referencepath_principals_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
862
|
+
return new TypeError(message);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
const obj_relatedNamedCredentials = obj.relatedNamedCredentials;
|
|
866
|
+
const path_relatedNamedCredentials = path + '.relatedNamedCredentials';
|
|
867
|
+
if (!ArrayIsArray(obj_relatedNamedCredentials)) {
|
|
868
|
+
return new TypeError('Expected "array" but received "' + typeof obj_relatedNamedCredentials + '" (at "' + path_relatedNamedCredentials + '")');
|
|
869
|
+
}
|
|
870
|
+
for (let i = 0; i < obj_relatedNamedCredentials.length; i++) {
|
|
871
|
+
const obj_relatedNamedCredentials_item = obj_relatedNamedCredentials[i];
|
|
872
|
+
const path_relatedNamedCredentials_item = path_relatedNamedCredentials + '[' + i + ']';
|
|
873
|
+
const referencepath_relatedNamedCredentials_itemValidationError = validate$4(obj_relatedNamedCredentials_item, path_relatedNamedCredentials_item);
|
|
874
|
+
if (referencepath_relatedNamedCredentials_itemValidationError !== null) {
|
|
875
|
+
let message = 'Object doesn\'t match NamedCredentialRepresentation (at "' + path_relatedNamedCredentials_item + '")\n';
|
|
876
|
+
message += referencepath_relatedNamedCredentials_itemValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
877
|
+
return new TypeError(message);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
})();
|
|
881
|
+
return v_error === undefined ? null : v_error;
|
|
882
|
+
}
|
|
883
|
+
const RepresentationType$2 = 'ExternalCredentialRepresentation';
|
|
884
|
+
function keyBuilder$3(luvio, config) {
|
|
885
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.developerName;
|
|
886
|
+
}
|
|
887
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
888
|
+
const keyParams = {
|
|
889
|
+
developerName: object.developerName
|
|
890
|
+
};
|
|
891
|
+
return keyBuilder$3(luvio, keyParams);
|
|
892
|
+
}
|
|
893
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
894
|
+
return input;
|
|
895
|
+
}
|
|
896
|
+
const select$5 = function ExternalCredentialRepresentationSelect() {
|
|
897
|
+
const { selections: ExternalCredentialPrincipalRepresentation__selections, opaque: ExternalCredentialPrincipalRepresentation__opaque, } = select$7();
|
|
898
|
+
const { selections: NamedCredentialRepresentation__selections, opaque: NamedCredentialRepresentation__opaque, } = select$6();
|
|
899
|
+
return {
|
|
900
|
+
kind: 'Fragment',
|
|
901
|
+
version: VERSION$2,
|
|
902
|
+
private: [],
|
|
903
|
+
selections: [
|
|
904
|
+
{
|
|
905
|
+
name: 'authenticationProtocol',
|
|
906
|
+
kind: 'Scalar'
|
|
907
|
+
},
|
|
908
|
+
{
|
|
909
|
+
name: 'authenticationStatus',
|
|
910
|
+
kind: 'Scalar'
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
name: 'developerName',
|
|
914
|
+
kind: 'Scalar'
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
name: 'masterLabel',
|
|
918
|
+
kind: 'Scalar'
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
name: 'principals',
|
|
922
|
+
kind: 'Object',
|
|
923
|
+
plural: true,
|
|
924
|
+
selections: ExternalCredentialPrincipalRepresentation__selections
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: 'relatedNamedCredentials',
|
|
928
|
+
kind: 'Object',
|
|
929
|
+
plural: true,
|
|
930
|
+
selections: NamedCredentialRepresentation__selections
|
|
931
|
+
}
|
|
932
|
+
]
|
|
933
|
+
};
|
|
934
|
+
};
|
|
935
|
+
function equals$2(existing, incoming) {
|
|
936
|
+
const existing_authenticationProtocol = existing.authenticationProtocol;
|
|
937
|
+
const incoming_authenticationProtocol = incoming.authenticationProtocol;
|
|
938
|
+
if (!(existing_authenticationProtocol === incoming_authenticationProtocol)) {
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
const existing_authenticationStatus = existing.authenticationStatus;
|
|
942
|
+
const incoming_authenticationStatus = incoming.authenticationStatus;
|
|
943
|
+
if (!(existing_authenticationStatus === incoming_authenticationStatus)) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
const existing_developerName = existing.developerName;
|
|
947
|
+
const incoming_developerName = incoming.developerName;
|
|
948
|
+
if (!(existing_developerName === incoming_developerName)) {
|
|
949
|
+
return false;
|
|
950
|
+
}
|
|
951
|
+
const existing_masterLabel = existing.masterLabel;
|
|
952
|
+
const incoming_masterLabel = incoming.masterLabel;
|
|
953
|
+
if (!(existing_masterLabel === incoming_masterLabel)) {
|
|
954
|
+
return false;
|
|
955
|
+
}
|
|
956
|
+
const existing_principals = existing.principals;
|
|
957
|
+
const incoming_principals = incoming.principals;
|
|
958
|
+
const equals_principals_items = equalsArray(existing_principals, incoming_principals, (existing_principals_item, incoming_principals_item) => {
|
|
959
|
+
if (!(equals$4(existing_principals_item, incoming_principals_item))) {
|
|
960
|
+
return false;
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
if (equals_principals_items === false) {
|
|
964
|
+
return false;
|
|
965
|
+
}
|
|
966
|
+
const existing_relatedNamedCredentials = existing.relatedNamedCredentials;
|
|
967
|
+
const incoming_relatedNamedCredentials = incoming.relatedNamedCredentials;
|
|
968
|
+
const equals_relatedNamedCredentials_items = equalsArray(existing_relatedNamedCredentials, incoming_relatedNamedCredentials, (existing_relatedNamedCredentials_item, incoming_relatedNamedCredentials_item) => {
|
|
969
|
+
if (!(equals$3(existing_relatedNamedCredentials_item, incoming_relatedNamedCredentials_item))) {
|
|
970
|
+
return false;
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
if (equals_relatedNamedCredentials_items === false) {
|
|
974
|
+
return false;
|
|
975
|
+
}
|
|
976
|
+
return true;
|
|
977
|
+
}
|
|
978
|
+
const ingest$2 = function ExternalCredentialRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
979
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
980
|
+
const validateError = validate$3(input);
|
|
981
|
+
if (validateError !== null) {
|
|
982
|
+
throw validateError;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
986
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
|
|
987
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "named-credential", VERSION$2, RepresentationType$2, equals$2);
|
|
988
|
+
return createLink(key);
|
|
989
|
+
};
|
|
990
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
991
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
992
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
993
|
+
rootKeySet.set(rootKey, {
|
|
994
|
+
namespace: keyPrefix,
|
|
995
|
+
representationName: RepresentationType$2,
|
|
996
|
+
mergeable: false
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
const VERSION$1 = "81417919a5a3d6b3e4fc26ab05d87aea";
|
|
1001
|
+
function validate$2(obj, path = 'ExternalCredentialListRepresentation') {
|
|
1002
|
+
const v_error = (() => {
|
|
1003
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1004
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1005
|
+
}
|
|
1006
|
+
const obj_externalCredentials = obj.externalCredentials;
|
|
1007
|
+
const path_externalCredentials = path + '.externalCredentials';
|
|
1008
|
+
if (!ArrayIsArray(obj_externalCredentials)) {
|
|
1009
|
+
return new TypeError('Expected "array" but received "' + typeof obj_externalCredentials + '" (at "' + path_externalCredentials + '")');
|
|
1010
|
+
}
|
|
1011
|
+
for (let i = 0; i < obj_externalCredentials.length; i++) {
|
|
1012
|
+
const obj_externalCredentials_item = obj_externalCredentials[i];
|
|
1013
|
+
const path_externalCredentials_item = path_externalCredentials + '[' + i + ']';
|
|
1014
|
+
if (typeof obj_externalCredentials_item !== 'object' || Array.isArray(obj_externalCredentials_item)) {
|
|
1015
|
+
return new TypeError('Expected "object" but received "' + typeof obj_externalCredentials_item + '" (at "' + path_externalCredentials_item + '")');
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
})();
|
|
1019
|
+
return v_error === undefined ? null : v_error;
|
|
1020
|
+
}
|
|
1021
|
+
const RepresentationType$1 = 'ExternalCredentialListRepresentation';
|
|
1022
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
1023
|
+
const input_externalCredentials = input.externalCredentials;
|
|
1024
|
+
const input_externalCredentials_id = path.fullPath + '__externalCredentials';
|
|
1025
|
+
for (let i = 0; i < input_externalCredentials.length; i++) {
|
|
1026
|
+
const input_externalCredentials_item = input_externalCredentials[i];
|
|
1027
|
+
let input_externalCredentials_item_id = input_externalCredentials_id + '__' + i;
|
|
1028
|
+
input_externalCredentials[i] = ingest$2(input_externalCredentials_item, {
|
|
1029
|
+
fullPath: input_externalCredentials_item_id,
|
|
1030
|
+
propertyName: i,
|
|
1031
|
+
parent: {
|
|
1032
|
+
data: input,
|
|
1033
|
+
key: path.fullPath,
|
|
1034
|
+
existing: existing,
|
|
1035
|
+
},
|
|
1036
|
+
ttl: path.ttl
|
|
1037
|
+
}, luvio, store, timestamp);
|
|
1038
|
+
}
|
|
1039
|
+
return input;
|
|
1040
|
+
}
|
|
1041
|
+
const select$4 = function ExternalCredentialListRepresentationSelect() {
|
|
1042
|
+
return {
|
|
1043
|
+
kind: 'Fragment',
|
|
1044
|
+
version: VERSION$1,
|
|
1045
|
+
private: [],
|
|
1046
|
+
selections: [
|
|
1047
|
+
{
|
|
1048
|
+
name: 'externalCredentials',
|
|
1049
|
+
kind: 'Link',
|
|
1050
|
+
plural: true,
|
|
1051
|
+
fragment: select$5()
|
|
1052
|
+
}
|
|
1053
|
+
]
|
|
1054
|
+
};
|
|
1055
|
+
};
|
|
1056
|
+
function equals$1(existing, incoming) {
|
|
1057
|
+
const existing_externalCredentials = existing.externalCredentials;
|
|
1058
|
+
const incoming_externalCredentials = incoming.externalCredentials;
|
|
1059
|
+
const equals_externalCredentials_items = equalsArray(existing_externalCredentials, incoming_externalCredentials, (existing_externalCredentials_item, incoming_externalCredentials_item) => {
|
|
1060
|
+
if (!(existing_externalCredentials_item.__ref === incoming_externalCredentials_item.__ref)) {
|
|
1061
|
+
return false;
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
if (equals_externalCredentials_items === false) {
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
const ingest$1 = function ExternalCredentialListRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1070
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1071
|
+
const validateError = validate$2(input);
|
|
1072
|
+
if (validateError !== null) {
|
|
1073
|
+
throw validateError;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
const key = path.fullPath;
|
|
1077
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
|
|
1078
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "named-credential", VERSION$1, RepresentationType$1, equals$1);
|
|
1079
|
+
return createLink(key);
|
|
1080
|
+
};
|
|
1081
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
1082
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1083
|
+
const rootKey = fullPathFactory();
|
|
1084
|
+
rootKeySet.set(rootKey, {
|
|
1085
|
+
namespace: keyPrefix,
|
|
1086
|
+
representationName: RepresentationType$1,
|
|
1087
|
+
mergeable: false
|
|
1088
|
+
});
|
|
1089
|
+
const input_externalCredentials_length = input.externalCredentials.length;
|
|
1090
|
+
for (let i = 0; i < input_externalCredentials_length; i++) {
|
|
1091
|
+
getTypeCacheKeys$2(rootKeySet, luvio, input.externalCredentials[i]);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
function select$3(luvio, params) {
|
|
1096
|
+
return select$4();
|
|
1097
|
+
}
|
|
1098
|
+
function keyBuilder$2(luvio, params) {
|
|
1099
|
+
return keyPrefix + '::ExternalCredentialListRepresentation:(' + ')';
|
|
1100
|
+
}
|
|
1101
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
1102
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response, () => keyBuilder$2());
|
|
1103
|
+
}
|
|
1104
|
+
function ingestSuccess$2(luvio, resourceParams, response, snapshotRefresh) {
|
|
1105
|
+
const { body } = response;
|
|
1106
|
+
const key = keyBuilder$2();
|
|
1107
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
1108
|
+
const snapshot = luvio.storeLookup({
|
|
1109
|
+
recordId: key,
|
|
1110
|
+
node: select$3(),
|
|
1111
|
+
variables: {},
|
|
1112
|
+
}, snapshotRefresh);
|
|
1113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1114
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1115
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
deepFreeze(snapshot.data);
|
|
1119
|
+
return snapshot;
|
|
1120
|
+
}
|
|
1121
|
+
function ingestError(luvio, params, error, snapshotRefresh) {
|
|
1122
|
+
const key = keyBuilder$2();
|
|
1123
|
+
const errorSnapshot = luvio.errorSnapshot(error, snapshotRefresh);
|
|
1124
|
+
luvio.storeIngestError(key, errorSnapshot);
|
|
1125
|
+
return errorSnapshot;
|
|
1126
|
+
}
|
|
1127
|
+
function createResourceRequest$2(config) {
|
|
1128
|
+
const headers = {};
|
|
1129
|
+
return {
|
|
1130
|
+
baseUri: '/services/data/v66.0',
|
|
1131
|
+
basePath: '/named-credentials/external-credentials',
|
|
1132
|
+
method: 'get',
|
|
1133
|
+
body: null,
|
|
1134
|
+
urlParams: {},
|
|
1135
|
+
queryParams: {},
|
|
1136
|
+
headers,
|
|
1137
|
+
priority: 'normal',
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
const adapterName$2 = 'getExternalCredentials';
|
|
1142
|
+
const getExternalCredentials_ConfigPropertyMetadata = [];
|
|
1143
|
+
const getExternalCredentials_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getExternalCredentials_ConfigPropertyMetadata);
|
|
1144
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$6(getExternalCredentials_ConfigPropertyMetadata);
|
|
1145
|
+
function keyBuilder$1(luvio, config) {
|
|
1146
|
+
createResourceParams$2(config);
|
|
1147
|
+
return keyBuilder$2();
|
|
1148
|
+
}
|
|
1149
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
1150
|
+
const config = {};
|
|
1151
|
+
return config;
|
|
1152
|
+
}
|
|
1153
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
1154
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1155
|
+
return null;
|
|
1156
|
+
}
|
|
1157
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1158
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1159
|
+
}
|
|
1160
|
+
const config = typeCheckConfig$2();
|
|
1161
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
return config;
|
|
1165
|
+
}
|
|
1166
|
+
function adapterFragment(luvio, config) {
|
|
1167
|
+
createResourceParams$2(config);
|
|
1168
|
+
return select$3();
|
|
1169
|
+
}
|
|
1170
|
+
function onFetchResponseSuccess(luvio, config, resourceParams, response) {
|
|
1171
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response, {
|
|
1172
|
+
config,
|
|
1173
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1174
|
+
});
|
|
1175
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1176
|
+
}
|
|
1177
|
+
function onFetchResponseError(luvio, config, resourceParams, response) {
|
|
1178
|
+
const snapshot = ingestError(luvio, resourceParams, response, {
|
|
1179
|
+
config,
|
|
1180
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1181
|
+
});
|
|
1182
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1183
|
+
}
|
|
1184
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
1185
|
+
const resourceParams = createResourceParams$2(config);
|
|
1186
|
+
const request = createResourceRequest$2();
|
|
1187
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1188
|
+
.then((response) => {
|
|
1189
|
+
return luvio.handleSuccessResponse(() => onFetchResponseSuccess(luvio, config, resourceParams, response), () => {
|
|
1190
|
+
const cache = new StoreKeyMap();
|
|
1191
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
1192
|
+
return cache;
|
|
1193
|
+
});
|
|
1194
|
+
}, (response) => {
|
|
1195
|
+
return luvio.handleErrorResponse(() => onFetchResponseError(luvio, config, resourceParams, response));
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
function buildNetworkSnapshotCachePolicy(context, coercedAdapterRequestContext) {
|
|
1199
|
+
return buildNetworkSnapshotCachePolicy$2(context, coercedAdapterRequestContext, buildNetworkSnapshot$2, undefined, false);
|
|
1200
|
+
}
|
|
1201
|
+
function buildCachedSnapshotCachePolicy(context, storeLookup) {
|
|
1202
|
+
const { luvio, config } = context;
|
|
1203
|
+
const selector = {
|
|
1204
|
+
recordId: keyBuilder$1(luvio, config),
|
|
1205
|
+
node: adapterFragment(luvio, config),
|
|
1206
|
+
variables: {},
|
|
1207
|
+
};
|
|
1208
|
+
const cacheSnapshot = storeLookup(selector, {
|
|
1209
|
+
config,
|
|
1210
|
+
resolve: () => buildNetworkSnapshot$2(luvio, config, snapshotRefreshOptions)
|
|
1211
|
+
});
|
|
1212
|
+
return cacheSnapshot;
|
|
1213
|
+
}
|
|
1214
|
+
const getExternalCredentialsAdapterFactory = (luvio) => function namedCredential__getExternalCredentials(untrustedConfig, requestContext) {
|
|
1215
|
+
const config = validateAdapterConfig$2(untrustedConfig, getExternalCredentials_ConfigPropertyNames);
|
|
1216
|
+
// Invalid or incomplete config
|
|
1217
|
+
if (config === null) {
|
|
1218
|
+
return null;
|
|
1219
|
+
}
|
|
1220
|
+
return luvio.applyCachePolicy((requestContext || {}), { config, luvio }, // BuildSnapshotContext
|
|
1221
|
+
buildCachedSnapshotCachePolicy, buildNetworkSnapshotCachePolicy);
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
function validate$1(obj, path = 'OAuthCredentialAuthUrlInputRepresentation') {
|
|
1225
|
+
const v_error = (() => {
|
|
1226
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1227
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1228
|
+
}
|
|
1229
|
+
const obj_externalCredential = obj.externalCredential;
|
|
1230
|
+
const path_externalCredential = path + '.externalCredential';
|
|
1231
|
+
if (typeof obj_externalCredential !== 'string') {
|
|
1232
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
|
|
1233
|
+
}
|
|
1234
|
+
const obj_principalName = obj.principalName;
|
|
1235
|
+
const path_principalName = path + '.principalName';
|
|
1236
|
+
if (typeof obj_principalName !== 'string') {
|
|
1237
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
1238
|
+
}
|
|
1239
|
+
const obj_principalType = obj.principalType;
|
|
1240
|
+
const path_principalType = path + '.principalType';
|
|
1241
|
+
if (typeof obj_principalType !== 'string') {
|
|
1242
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
|
|
1243
|
+
}
|
|
1244
|
+
if (obj.returnUrl !== undefined) {
|
|
1245
|
+
const obj_returnUrl = obj.returnUrl;
|
|
1246
|
+
const path_returnUrl = path + '.returnUrl';
|
|
1247
|
+
if (typeof obj_returnUrl !== 'string') {
|
|
1248
|
+
return new TypeError('Expected "string" but received "' + typeof obj_returnUrl + '" (at "' + path_returnUrl + '")');
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
})();
|
|
1252
|
+
return v_error === undefined ? null : v_error;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
const VERSION = "1e72de165572264bf8309eccfc284fd6";
|
|
1256
|
+
function validate(obj, path = 'OAuthCredentialAuthUrlRepresentation') {
|
|
1257
|
+
const v_error = (() => {
|
|
1258
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
1259
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
1260
|
+
}
|
|
1261
|
+
const obj_authenticationUrl = obj.authenticationUrl;
|
|
1262
|
+
const path_authenticationUrl = path + '.authenticationUrl';
|
|
1263
|
+
if (typeof obj_authenticationUrl !== 'string') {
|
|
1264
|
+
return new TypeError('Expected "string" but received "' + typeof obj_authenticationUrl + '" (at "' + path_authenticationUrl + '")');
|
|
1265
|
+
}
|
|
1266
|
+
const obj_externalCredential = obj.externalCredential;
|
|
1267
|
+
const path_externalCredential = path + '.externalCredential';
|
|
1268
|
+
if (typeof obj_externalCredential !== 'string') {
|
|
1269
|
+
return new TypeError('Expected "string" but received "' + typeof obj_externalCredential + '" (at "' + path_externalCredential + '")');
|
|
1270
|
+
}
|
|
1271
|
+
const obj_principalName = obj.principalName;
|
|
1272
|
+
const path_principalName = path + '.principalName';
|
|
1273
|
+
if (typeof obj_principalName !== 'string') {
|
|
1274
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalName + '" (at "' + path_principalName + '")');
|
|
1275
|
+
}
|
|
1276
|
+
const obj_principalType = obj.principalType;
|
|
1277
|
+
const path_principalType = path + '.principalType';
|
|
1278
|
+
if (typeof obj_principalType !== 'string') {
|
|
1279
|
+
return new TypeError('Expected "string" but received "' + typeof obj_principalType + '" (at "' + path_principalType + '")');
|
|
1280
|
+
}
|
|
1281
|
+
})();
|
|
1282
|
+
return v_error === undefined ? null : v_error;
|
|
1283
|
+
}
|
|
1284
|
+
const RepresentationType = 'OAuthCredentialAuthUrlRepresentation';
|
|
1285
|
+
function keyBuilder(luvio, config) {
|
|
1286
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.authenticationUrl;
|
|
1287
|
+
}
|
|
1288
|
+
function keyBuilderFromType(luvio, object) {
|
|
1289
|
+
const keyParams = {
|
|
1290
|
+
authenticationUrl: object.authenticationUrl
|
|
1291
|
+
};
|
|
1292
|
+
return keyBuilder(luvio, keyParams);
|
|
1293
|
+
}
|
|
1294
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
1295
|
+
return input;
|
|
1296
|
+
}
|
|
1297
|
+
const select$2 = function OAuthCredentialAuthUrlRepresentationSelect() {
|
|
1298
|
+
return {
|
|
1299
|
+
kind: 'Fragment',
|
|
1300
|
+
version: VERSION,
|
|
1301
|
+
private: [],
|
|
1302
|
+
selections: [
|
|
1303
|
+
{
|
|
1304
|
+
name: 'authenticationUrl',
|
|
1305
|
+
kind: 'Scalar'
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
name: 'externalCredential',
|
|
1309
|
+
kind: 'Scalar'
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
name: 'principalName',
|
|
1313
|
+
kind: 'Scalar'
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
name: 'principalType',
|
|
1317
|
+
kind: 'Scalar'
|
|
1318
|
+
}
|
|
1319
|
+
]
|
|
1320
|
+
};
|
|
1321
|
+
};
|
|
1322
|
+
function equals(existing, incoming) {
|
|
1323
|
+
const existing_authenticationUrl = existing.authenticationUrl;
|
|
1324
|
+
const incoming_authenticationUrl = incoming.authenticationUrl;
|
|
1325
|
+
if (!(existing_authenticationUrl === incoming_authenticationUrl)) {
|
|
1326
|
+
return false;
|
|
1327
|
+
}
|
|
1328
|
+
const existing_externalCredential = existing.externalCredential;
|
|
1329
|
+
const incoming_externalCredential = incoming.externalCredential;
|
|
1330
|
+
if (!(existing_externalCredential === incoming_externalCredential)) {
|
|
1331
|
+
return false;
|
|
1332
|
+
}
|
|
1333
|
+
const existing_principalName = existing.principalName;
|
|
1334
|
+
const incoming_principalName = incoming.principalName;
|
|
1335
|
+
if (!(existing_principalName === incoming_principalName)) {
|
|
1336
|
+
return false;
|
|
1337
|
+
}
|
|
1338
|
+
const existing_principalType = existing.principalType;
|
|
1339
|
+
const incoming_principalType = incoming.principalType;
|
|
1340
|
+
if (!(existing_principalType === incoming_principalType)) {
|
|
1341
|
+
return false;
|
|
1342
|
+
}
|
|
1343
|
+
return true;
|
|
1344
|
+
}
|
|
1345
|
+
const ingest = function OAuthCredentialAuthUrlRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
1346
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1347
|
+
const validateError = validate(input);
|
|
1348
|
+
if (validateError !== null) {
|
|
1349
|
+
throw validateError;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
const key = keyBuilderFromType(luvio, input);
|
|
1353
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 300000;
|
|
1354
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "named-credential", VERSION, RepresentationType, equals);
|
|
1355
|
+
return createLink(key);
|
|
1356
|
+
};
|
|
1357
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
1358
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
1359
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
1360
|
+
rootKeySet.set(rootKey, {
|
|
1361
|
+
namespace: keyPrefix,
|
|
1362
|
+
representationName: RepresentationType,
|
|
1363
|
+
mergeable: false
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
function select$1(luvio, params) {
|
|
1368
|
+
return select$2();
|
|
1369
|
+
}
|
|
1370
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
1371
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
1372
|
+
}
|
|
1373
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
1374
|
+
const { body } = response;
|
|
1375
|
+
const key = keyBuilderFromType(luvio, body);
|
|
1376
|
+
luvio.storeIngest(key, ingest, body);
|
|
1377
|
+
const snapshot = luvio.storeLookup({
|
|
1378
|
+
recordId: key,
|
|
1379
|
+
node: select$1(),
|
|
1380
|
+
variables: {},
|
|
1381
|
+
});
|
|
1382
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1383
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1384
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
deepFreeze(snapshot.data);
|
|
1388
|
+
return snapshot;
|
|
1389
|
+
}
|
|
1390
|
+
function createResourceRequest$1(config) {
|
|
1391
|
+
const headers = {};
|
|
1392
|
+
return {
|
|
1393
|
+
baseUri: '/services/data/v66.0',
|
|
1394
|
+
basePath: '/named-credentials/credential/auth-url/o-auth',
|
|
1395
|
+
method: 'post',
|
|
1396
|
+
body: config.body,
|
|
1397
|
+
urlParams: {},
|
|
1398
|
+
queryParams: {},
|
|
1399
|
+
headers,
|
|
1400
|
+
priority: 'normal',
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
const adapterName$1 = 'getOAuthCredentialAuthUrl';
|
|
1405
|
+
const getOAuthCredentialAuthUrl_ConfigPropertyMetadata = [
|
|
1406
|
+
generateParamConfigMetadata('requestBody', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1407
|
+
];
|
|
1408
|
+
const getOAuthCredentialAuthUrl_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getOAuthCredentialAuthUrl_ConfigPropertyMetadata);
|
|
1409
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$6(getOAuthCredentialAuthUrl_ConfigPropertyMetadata);
|
|
1410
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
1411
|
+
const config = {};
|
|
1412
|
+
const untrustedConfig_requestBody = untrustedConfig.requestBody;
|
|
1413
|
+
const referenceOAuthCredentialAuthUrlInputRepresentationValidationError = validate$1(untrustedConfig_requestBody);
|
|
1414
|
+
if (referenceOAuthCredentialAuthUrlInputRepresentationValidationError === null) {
|
|
1415
|
+
config.requestBody = untrustedConfig_requestBody;
|
|
1416
|
+
}
|
|
1417
|
+
return config;
|
|
1418
|
+
}
|
|
1419
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
1420
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1421
|
+
return null;
|
|
1422
|
+
}
|
|
1423
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1424
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1425
|
+
}
|
|
1426
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
1427
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1428
|
+
return null;
|
|
1429
|
+
}
|
|
1430
|
+
return config;
|
|
1431
|
+
}
|
|
1432
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
1433
|
+
const resourceParams = createResourceParams$1(config);
|
|
1434
|
+
const request = createResourceRequest$1(resourceParams);
|
|
1435
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1436
|
+
.then((response) => {
|
|
1437
|
+
return luvio.handleSuccessResponse(() => {
|
|
1438
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
1439
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1440
|
+
}, () => {
|
|
1441
|
+
const cache = new StoreKeyMap();
|
|
1442
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
1443
|
+
return cache;
|
|
1444
|
+
});
|
|
1445
|
+
}, (response) => {
|
|
1446
|
+
deepFreeze(response);
|
|
1447
|
+
throw response;
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
const getOAuthCredentialAuthUrlAdapterFactory = (luvio) => {
|
|
1451
|
+
return function getOAuthCredentialAuthUrl(untrustedConfig) {
|
|
1452
|
+
const config = validateAdapterConfig$1(untrustedConfig, getOAuthCredentialAuthUrl_ConfigPropertyNames);
|
|
1453
|
+
// Invalid or incomplete config
|
|
1454
|
+
if (config === null) {
|
|
1455
|
+
throw new Error('Invalid config for "getOAuthCredentialAuthUrl"');
|
|
1456
|
+
}
|
|
1457
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
1458
|
+
};
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
function select(luvio, params) {
|
|
1462
|
+
return select$a();
|
|
1463
|
+
}
|
|
1464
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
1465
|
+
getTypeCacheKeys$3(storeKeyMap, luvio, response);
|
|
1466
|
+
}
|
|
1467
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
1468
|
+
const { body } = response;
|
|
1469
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
1470
|
+
luvio.storeIngest(key, ingest$3, body);
|
|
1471
|
+
const snapshot = luvio.storeLookup({
|
|
1472
|
+
recordId: key,
|
|
1473
|
+
node: select(),
|
|
1474
|
+
variables: {},
|
|
1475
|
+
});
|
|
1476
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1477
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
1478
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
deepFreeze(snapshot.data);
|
|
1482
|
+
return snapshot;
|
|
1483
|
+
}
|
|
1484
|
+
function createResourceRequest(config) {
|
|
1485
|
+
const headers = {};
|
|
1486
|
+
return {
|
|
1487
|
+
baseUri: '/services/data/v66.0',
|
|
1488
|
+
basePath: '/named-credentials/credential',
|
|
1489
|
+
method: 'put',
|
|
1490
|
+
body: config.body,
|
|
1491
|
+
urlParams: {},
|
|
1492
|
+
queryParams: {},
|
|
1493
|
+
headers,
|
|
1494
|
+
priority: 'normal',
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
const adapterName = 'updateCredential';
|
|
1499
|
+
const updateCredential_ConfigPropertyMetadata = [
|
|
1500
|
+
generateParamConfigMetadata('requestBody', true, 2 /* Body */, 4 /* Unsupported */),
|
|
1501
|
+
];
|
|
1502
|
+
const updateCredential_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, updateCredential_ConfigPropertyMetadata);
|
|
1503
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$6(updateCredential_ConfigPropertyMetadata);
|
|
1504
|
+
function typeCheckConfig(untrustedConfig) {
|
|
1505
|
+
const config = {};
|
|
1506
|
+
const untrustedConfig_requestBody = untrustedConfig.requestBody;
|
|
1507
|
+
const referenceCredentialInputRepresentationValidationError = validate$8(untrustedConfig_requestBody);
|
|
1508
|
+
if (referenceCredentialInputRepresentationValidationError === null) {
|
|
1509
|
+
config.requestBody = untrustedConfig_requestBody;
|
|
1510
|
+
}
|
|
1511
|
+
return config;
|
|
1512
|
+
}
|
|
1513
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
1514
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
1515
|
+
return null;
|
|
1516
|
+
}
|
|
1517
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1518
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
1519
|
+
}
|
|
1520
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
1521
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
1522
|
+
return null;
|
|
1523
|
+
}
|
|
1524
|
+
return config;
|
|
1525
|
+
}
|
|
1526
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
1527
|
+
const resourceParams = createResourceParams(config);
|
|
1528
|
+
const request = createResourceRequest(resourceParams);
|
|
1529
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
1530
|
+
.then((response) => {
|
|
1531
|
+
return luvio.handleSuccessResponse(() => {
|
|
1532
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
1533
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
1534
|
+
}, () => {
|
|
1535
|
+
const cache = new StoreKeyMap();
|
|
1536
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
1537
|
+
return cache;
|
|
1538
|
+
});
|
|
1539
|
+
}, (response) => {
|
|
1540
|
+
deepFreeze(response);
|
|
1541
|
+
throw response;
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
const updateCredentialAdapterFactory = (luvio) => {
|
|
1545
|
+
return function updateCredential(untrustedConfig) {
|
|
1546
|
+
const config = validateAdapterConfig(untrustedConfig, updateCredential_ConfigPropertyNames);
|
|
1547
|
+
// Invalid or incomplete config
|
|
1548
|
+
if (config === null) {
|
|
1549
|
+
throw new Error('Invalid config for "updateCredential"');
|
|
1550
|
+
}
|
|
1551
|
+
return buildNetworkSnapshot(luvio, config);
|
|
1552
|
+
};
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
let createCredential;
|
|
1556
|
+
let deleteCredential;
|
|
1557
|
+
let getCredential;
|
|
1558
|
+
let getExternalCredentials;
|
|
1559
|
+
let getOAuthCredentialAuthUrl;
|
|
1560
|
+
let updateCredential;
|
|
1561
|
+
// Imperative GET Adapters
|
|
1562
|
+
let getCredential_imperative;
|
|
1563
|
+
let getExternalCredentials_imperative;
|
|
1564
|
+
const getCredentialMetadata = { apiFamily: 'namedcredential', name: 'getCredential', ttl: 100 };
|
|
1565
|
+
const getExternalCredentialsMetadata = {
|
|
1566
|
+
apiFamily: 'namedcredential',
|
|
1567
|
+
name: 'getExternalCredentials',
|
|
1568
|
+
};
|
|
1569
|
+
// Notify Update Available
|
|
1570
|
+
function bindExportsTo(luvio) {
|
|
1571
|
+
// LDS Adapters
|
|
1572
|
+
const getCredential_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getCredential', getCredentialAdapterFactory), getCredentialMetadata);
|
|
1573
|
+
const getExternalCredentials_ldsAdapter = createInstrumentedAdapter(createLDSAdapter(luvio, 'getExternalCredentials', getExternalCredentialsAdapterFactory), getExternalCredentialsMetadata);
|
|
1574
|
+
function unwrapSnapshotData(factory) {
|
|
1575
|
+
const adapter = factory(luvio);
|
|
1576
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
1577
|
+
}
|
|
1578
|
+
return {
|
|
1579
|
+
createCredential: unwrapSnapshotData(createCredentialAdapterFactory),
|
|
1580
|
+
deleteCredential: createLDSAdapter(luvio, adapterName$4, deleteCredentialAdapterFactory),
|
|
1581
|
+
getCredential: createWireAdapterConstructor(luvio, getCredential_ldsAdapter, getCredentialMetadata),
|
|
1582
|
+
getExternalCredentials: createWireAdapterConstructor(luvio, getExternalCredentials_ldsAdapter, getExternalCredentialsMetadata),
|
|
1583
|
+
getOAuthCredentialAuthUrl: unwrapSnapshotData(getOAuthCredentialAuthUrlAdapterFactory),
|
|
1584
|
+
updateCredential: unwrapSnapshotData(updateCredentialAdapterFactory),
|
|
1585
|
+
// Imperative GET Adapters
|
|
1586
|
+
getCredential_imperative: createImperativeAdapter(luvio, getCredential_ldsAdapter, getCredentialMetadata),
|
|
1587
|
+
getExternalCredentials_imperative: createImperativeAdapter(luvio, getExternalCredentials_ldsAdapter, getExternalCredentialsMetadata),
|
|
1588
|
+
// Notify Update Availables
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
withDefaultLuvio((luvio) => {
|
|
1592
|
+
({
|
|
1593
|
+
createCredential,
|
|
1594
|
+
deleteCredential,
|
|
1595
|
+
getCredential,
|
|
1596
|
+
getExternalCredentials,
|
|
1597
|
+
getOAuthCredentialAuthUrl,
|
|
1598
|
+
updateCredential,
|
|
1599
|
+
getCredential_imperative,
|
|
1600
|
+
getExternalCredentials_imperative,
|
|
1601
|
+
} = bindExportsTo(luvio));
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
export { createCredential, deleteCredential, getCredential, getCredential_imperative, getExternalCredentials, getExternalCredentials_imperative, getOAuthCredentialAuthUrl, updateCredential };
|
|
1605
|
+
// version: 0.1.0-dev1-c978a7b010
|