@salesforce/lds-adapters-cdp-byoc 1.332.0-dev18
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/cdp-byoc.js +714 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/createCustomCodeDeployment.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/resources/postSsotDataCustomCode.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/types/CdpUserRepresentation.d.ts +34 -0
- package/dist/es/es2018/types/src/generated/types/CustomCodeDeploymentInputRepresentation.d.ts +65 -0
- package/dist/es/es2018/types/src/generated/types/CustomCodeDeploymentRepresentation.d.ts +99 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +742 -0
- package/src/raml/api.raml +220 -0
- package/src/raml/luvio.raml +25 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from '@luvio/engine';
|
|
8
|
+
|
|
9
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
11
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
12
|
+
/**
|
|
13
|
+
* Validates an adapter config is well-formed.
|
|
14
|
+
* @param config The config to validate.
|
|
15
|
+
* @param adapter The adapter validation configuration.
|
|
16
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
17
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
18
|
+
*/
|
|
19
|
+
function validateConfig(config, adapter, oneOf) {
|
|
20
|
+
const { displayName } = adapter;
|
|
21
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
22
|
+
if (config === undefined ||
|
|
23
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
24
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
25
|
+
}
|
|
26
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
27
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
28
|
+
}
|
|
29
|
+
if (unsupported !== undefined &&
|
|
30
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
31
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
32
|
+
}
|
|
33
|
+
const supported = required.concat(optional);
|
|
34
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
35
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function untrustedIsObject(untrusted) {
|
|
39
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
40
|
+
}
|
|
41
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
42
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
43
|
+
}
|
|
44
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
45
|
+
return {
|
|
46
|
+
name,
|
|
47
|
+
required,
|
|
48
|
+
resourceType,
|
|
49
|
+
typeCheckShape,
|
|
50
|
+
isArrayShape,
|
|
51
|
+
coerceFn,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
55
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
56
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
57
|
+
return {
|
|
58
|
+
displayName,
|
|
59
|
+
parameters: {
|
|
60
|
+
required,
|
|
61
|
+
optional,
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const keyPrefix = 'byoc';
|
|
66
|
+
|
|
67
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
68
|
+
const { isArray: ArrayIsArray } = Array;
|
|
69
|
+
function equalsArray(a, b, equalsItem) {
|
|
70
|
+
const aLength = a.length;
|
|
71
|
+
const bLength = b.length;
|
|
72
|
+
if (aLength !== bLength) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
for (let i = 0; i < aLength; i++) {
|
|
76
|
+
if (equalsItem(a[i], b[i]) === false) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
function equalsObject(a, b, equalsProp) {
|
|
83
|
+
const aKeys = ObjectKeys(a).sort();
|
|
84
|
+
const bKeys = ObjectKeys(b).sort();
|
|
85
|
+
const aKeysLength = aKeys.length;
|
|
86
|
+
const bKeysLength = bKeys.length;
|
|
87
|
+
if (aKeysLength !== bKeysLength) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
for (let i = 0; i < aKeys.length; i++) {
|
|
91
|
+
const key = aKeys[i];
|
|
92
|
+
if (key !== bKeys[i]) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
if (equalsProp(a[key], b[key]) === false) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function createLink(ref) {
|
|
102
|
+
return {
|
|
103
|
+
__ref: serializeStructuredKey(ref),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const VERSION$1 = "2fe1bfd9fd1c6a94767d2ea000d6d318";
|
|
108
|
+
function validate$1(obj, path = 'CdpUserRepresentation') {
|
|
109
|
+
const v_error = (() => {
|
|
110
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
111
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
112
|
+
}
|
|
113
|
+
const obj_id = obj.id;
|
|
114
|
+
const path_id = path + '.id';
|
|
115
|
+
if (typeof obj_id !== 'string') {
|
|
116
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
117
|
+
}
|
|
118
|
+
const obj_name = obj.name;
|
|
119
|
+
const path_name = path + '.name';
|
|
120
|
+
if (typeof obj_name !== 'string') {
|
|
121
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
122
|
+
}
|
|
123
|
+
const obj_profilePhotoUrl = obj.profilePhotoUrl;
|
|
124
|
+
const path_profilePhotoUrl = path + '.profilePhotoUrl';
|
|
125
|
+
if (typeof obj_profilePhotoUrl !== 'string') {
|
|
126
|
+
return new TypeError('Expected "string" but received "' + typeof obj_profilePhotoUrl + '" (at "' + path_profilePhotoUrl + '")');
|
|
127
|
+
}
|
|
128
|
+
})();
|
|
129
|
+
return v_error === undefined ? null : v_error;
|
|
130
|
+
}
|
|
131
|
+
const select$2 = function CdpUserRepresentationSelect() {
|
|
132
|
+
return {
|
|
133
|
+
kind: 'Fragment',
|
|
134
|
+
version: VERSION$1,
|
|
135
|
+
private: [],
|
|
136
|
+
selections: [
|
|
137
|
+
{
|
|
138
|
+
name: 'id',
|
|
139
|
+
kind: 'Scalar'
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'name',
|
|
143
|
+
kind: 'Scalar'
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: 'profilePhotoUrl',
|
|
147
|
+
kind: 'Scalar'
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
function equals$1(existing, incoming) {
|
|
153
|
+
const existing_id = existing.id;
|
|
154
|
+
const incoming_id = incoming.id;
|
|
155
|
+
if (!(existing_id === incoming_id)) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
const existing_name = existing.name;
|
|
159
|
+
const incoming_name = incoming.name;
|
|
160
|
+
if (!(existing_name === incoming_name)) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
const existing_profilePhotoUrl = existing.profilePhotoUrl;
|
|
164
|
+
const incoming_profilePhotoUrl = incoming.profilePhotoUrl;
|
|
165
|
+
if (!(existing_profilePhotoUrl === incoming_profilePhotoUrl)) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const VERSION = "bc7c21323d31a68bdc0ef7484dc4fa2b";
|
|
172
|
+
function validate(obj, path = 'CustomCodeDeploymentRepresentation') {
|
|
173
|
+
const v_error = (() => {
|
|
174
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
175
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
176
|
+
}
|
|
177
|
+
const obj_codeType = obj.codeType;
|
|
178
|
+
const path_codeType = path + '.codeType';
|
|
179
|
+
if (typeof obj_codeType !== 'string') {
|
|
180
|
+
return new TypeError('Expected "string" but received "' + typeof obj_codeType + '" (at "' + path_codeType + '")');
|
|
181
|
+
}
|
|
182
|
+
const obj_computeType = obj.computeType;
|
|
183
|
+
const path_computeType = path + '.computeType';
|
|
184
|
+
if (typeof obj_computeType !== 'string') {
|
|
185
|
+
return new TypeError('Expected "string" but received "' + typeof obj_computeType + '" (at "' + path_computeType + '")');
|
|
186
|
+
}
|
|
187
|
+
const obj_createdBy = obj.createdBy;
|
|
188
|
+
const path_createdBy = path + '.createdBy';
|
|
189
|
+
const referencepath_createdByValidationError = validate$1(obj_createdBy, path_createdBy);
|
|
190
|
+
if (referencepath_createdByValidationError !== null) {
|
|
191
|
+
let message = 'Object doesn\'t match CdpUserRepresentation (at "' + path_createdBy + '")\n';
|
|
192
|
+
message += referencepath_createdByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
193
|
+
return new TypeError(message);
|
|
194
|
+
}
|
|
195
|
+
const obj_createdDate = obj.createdDate;
|
|
196
|
+
const path_createdDate = path + '.createdDate';
|
|
197
|
+
if (typeof obj_createdDate !== 'string') {
|
|
198
|
+
return new TypeError('Expected "string" but received "' + typeof obj_createdDate + '" (at "' + path_createdDate + '")');
|
|
199
|
+
}
|
|
200
|
+
if (obj.deploymentFailureCode !== undefined) {
|
|
201
|
+
const obj_deploymentFailureCode = obj.deploymentFailureCode;
|
|
202
|
+
const path_deploymentFailureCode = path + '.deploymentFailureCode';
|
|
203
|
+
if (typeof obj_deploymentFailureCode !== 'number' || (typeof obj_deploymentFailureCode === 'number' && Math.floor(obj_deploymentFailureCode) !== obj_deploymentFailureCode)) {
|
|
204
|
+
return new TypeError('Expected "integer" but received "' + typeof obj_deploymentFailureCode + '" (at "' + path_deploymentFailureCode + '")');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (obj.deploymentFailureReason !== undefined) {
|
|
208
|
+
const obj_deploymentFailureReason = obj.deploymentFailureReason;
|
|
209
|
+
const path_deploymentFailureReason = path + '.deploymentFailureReason';
|
|
210
|
+
if (typeof obj_deploymentFailureReason !== 'string') {
|
|
211
|
+
return new TypeError('Expected "string" but received "' + typeof obj_deploymentFailureReason + '" (at "' + path_deploymentFailureReason + '")');
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const obj_deploymentStatus = obj.deploymentStatus;
|
|
215
|
+
const path_deploymentStatus = path + '.deploymentStatus';
|
|
216
|
+
if (typeof obj_deploymentStatus !== 'string') {
|
|
217
|
+
return new TypeError('Expected "string" but received "' + typeof obj_deploymentStatus + '" (at "' + path_deploymentStatus + '")');
|
|
218
|
+
}
|
|
219
|
+
if (obj.description !== undefined) {
|
|
220
|
+
const obj_description = obj.description;
|
|
221
|
+
const path_description = path + '.description';
|
|
222
|
+
if (typeof obj_description !== 'string') {
|
|
223
|
+
return new TypeError('Expected "string" but received "' + typeof obj_description + '" (at "' + path_description + '")');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const obj_fileUploadUrl = obj.fileUploadUrl;
|
|
227
|
+
const path_fileUploadUrl = path + '.fileUploadUrl';
|
|
228
|
+
if (typeof obj_fileUploadUrl !== 'string') {
|
|
229
|
+
return new TypeError('Expected "string" but received "' + typeof obj_fileUploadUrl + '" (at "' + path_fileUploadUrl + '")');
|
|
230
|
+
}
|
|
231
|
+
if (obj.functionInvokeOptions !== undefined) {
|
|
232
|
+
const obj_functionInvokeOptions = obj.functionInvokeOptions;
|
|
233
|
+
const path_functionInvokeOptions = path + '.functionInvokeOptions';
|
|
234
|
+
if (!ArrayIsArray(obj_functionInvokeOptions)) {
|
|
235
|
+
return new TypeError('Expected "array" but received "' + typeof obj_functionInvokeOptions + '" (at "' + path_functionInvokeOptions + '")');
|
|
236
|
+
}
|
|
237
|
+
for (let i = 0; i < obj_functionInvokeOptions.length; i++) {
|
|
238
|
+
const obj_functionInvokeOptions_item = obj_functionInvokeOptions[i];
|
|
239
|
+
const path_functionInvokeOptions_item = path_functionInvokeOptions + '[' + i + ']';
|
|
240
|
+
if (typeof obj_functionInvokeOptions_item !== 'string') {
|
|
241
|
+
return new TypeError('Expected "string" but received "' + typeof obj_functionInvokeOptions_item + '" (at "' + path_functionInvokeOptions_item + '")');
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const obj_id = obj.id;
|
|
246
|
+
const path_id = path + '.id';
|
|
247
|
+
if (typeof obj_id !== 'string') {
|
|
248
|
+
return new TypeError('Expected "string" but received "' + typeof obj_id + '" (at "' + path_id + '")');
|
|
249
|
+
}
|
|
250
|
+
const obj_label = obj.label;
|
|
251
|
+
const path_label = path + '.label';
|
|
252
|
+
if (typeof obj_label !== 'string') {
|
|
253
|
+
return new TypeError('Expected "string" but received "' + typeof obj_label + '" (at "' + path_label + '")');
|
|
254
|
+
}
|
|
255
|
+
const obj_lastModifiedBy = obj.lastModifiedBy;
|
|
256
|
+
const path_lastModifiedBy = path + '.lastModifiedBy';
|
|
257
|
+
const referencepath_lastModifiedByValidationError = validate$1(obj_lastModifiedBy, path_lastModifiedBy);
|
|
258
|
+
if (referencepath_lastModifiedByValidationError !== null) {
|
|
259
|
+
let message = 'Object doesn\'t match CdpUserRepresentation (at "' + path_lastModifiedBy + '")\n';
|
|
260
|
+
message += referencepath_lastModifiedByValidationError.message.split('\n').map((line) => '\t' + line).join('\n');
|
|
261
|
+
return new TypeError(message);
|
|
262
|
+
}
|
|
263
|
+
const obj_lastModifiedDate = obj.lastModifiedDate;
|
|
264
|
+
const path_lastModifiedDate = path + '.lastModifiedDate';
|
|
265
|
+
if (typeof obj_lastModifiedDate !== 'string') {
|
|
266
|
+
return new TypeError('Expected "string" but received "' + typeof obj_lastModifiedDate + '" (at "' + path_lastModifiedDate + '")');
|
|
267
|
+
}
|
|
268
|
+
const obj_name = obj.name;
|
|
269
|
+
const path_name = path + '.name';
|
|
270
|
+
if (typeof obj_name !== 'string') {
|
|
271
|
+
return new TypeError('Expected "string" but received "' + typeof obj_name + '" (at "' + path_name + '")');
|
|
272
|
+
}
|
|
273
|
+
if (obj.namespace !== undefined) {
|
|
274
|
+
const obj_namespace = obj.namespace;
|
|
275
|
+
const path_namespace = path + '.namespace';
|
|
276
|
+
if (typeof obj_namespace !== 'string') {
|
|
277
|
+
return new TypeError('Expected "string" but received "' + typeof obj_namespace + '" (at "' + path_namespace + '")');
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const obj_parameters = obj.parameters;
|
|
281
|
+
const path_parameters = path + '.parameters';
|
|
282
|
+
if (typeof obj_parameters !== 'object' || ArrayIsArray(obj_parameters) || obj_parameters === null) {
|
|
283
|
+
return new TypeError('Expected "object" but received "' + typeof obj_parameters + '" (at "' + path_parameters + '")');
|
|
284
|
+
}
|
|
285
|
+
const obj_parameters_keys = ObjectKeys(obj_parameters);
|
|
286
|
+
for (let i = 0; i < obj_parameters_keys.length; i++) {
|
|
287
|
+
const key = obj_parameters_keys[i];
|
|
288
|
+
const obj_parameters_prop = obj_parameters[key];
|
|
289
|
+
const path_parameters_prop = path_parameters + '["' + key + '"]';
|
|
290
|
+
if (typeof obj_parameters_prop !== 'string') {
|
|
291
|
+
return new TypeError('Expected "string" but received "' + typeof obj_parameters_prop + '" (at "' + path_parameters_prop + '")');
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const obj_status = obj.status;
|
|
295
|
+
const path_status = path + '.status';
|
|
296
|
+
if (typeof obj_status !== 'string') {
|
|
297
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
298
|
+
}
|
|
299
|
+
const obj_url = obj.url;
|
|
300
|
+
const path_url = path + '.url';
|
|
301
|
+
if (typeof obj_url !== 'string') {
|
|
302
|
+
return new TypeError('Expected "string" but received "' + typeof obj_url + '" (at "' + path_url + '")');
|
|
303
|
+
}
|
|
304
|
+
const obj_version = obj.version;
|
|
305
|
+
const path_version = path + '.version';
|
|
306
|
+
if (typeof obj_version !== 'string') {
|
|
307
|
+
return new TypeError('Expected "string" but received "' + typeof obj_version + '" (at "' + path_version + '")');
|
|
308
|
+
}
|
|
309
|
+
})();
|
|
310
|
+
return v_error === undefined ? null : v_error;
|
|
311
|
+
}
|
|
312
|
+
const RepresentationType = 'CustomCodeDeploymentRepresentation';
|
|
313
|
+
function keyBuilder(luvio, config) {
|
|
314
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.id;
|
|
315
|
+
}
|
|
316
|
+
function keyBuilderFromType(luvio, object) {
|
|
317
|
+
const keyParams = {
|
|
318
|
+
id: object.id
|
|
319
|
+
};
|
|
320
|
+
return keyBuilder(luvio, keyParams);
|
|
321
|
+
}
|
|
322
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
323
|
+
return input;
|
|
324
|
+
}
|
|
325
|
+
const select$1 = function CustomCodeDeploymentRepresentationSelect() {
|
|
326
|
+
const { selections: CdpUserRepresentation__selections, opaque: CdpUserRepresentation__opaque, } = select$2();
|
|
327
|
+
return {
|
|
328
|
+
kind: 'Fragment',
|
|
329
|
+
version: VERSION,
|
|
330
|
+
private: [],
|
|
331
|
+
selections: [
|
|
332
|
+
{
|
|
333
|
+
name: 'codeType',
|
|
334
|
+
kind: 'Scalar'
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: 'computeType',
|
|
338
|
+
kind: 'Scalar'
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: 'createdBy',
|
|
342
|
+
kind: 'Object',
|
|
343
|
+
selections: CdpUserRepresentation__selections
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: 'createdDate',
|
|
347
|
+
kind: 'Scalar'
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
name: 'deploymentFailureCode',
|
|
351
|
+
kind: 'Scalar',
|
|
352
|
+
required: false
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: 'deploymentFailureReason',
|
|
356
|
+
kind: 'Scalar',
|
|
357
|
+
required: false
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: 'deploymentStatus',
|
|
361
|
+
kind: 'Scalar'
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: 'description',
|
|
365
|
+
kind: 'Scalar',
|
|
366
|
+
required: false
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: 'fileUploadUrl',
|
|
370
|
+
kind: 'Scalar'
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: 'functionInvokeOptions',
|
|
374
|
+
kind: 'Scalar',
|
|
375
|
+
plural: true,
|
|
376
|
+
required: false
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: 'id',
|
|
380
|
+
kind: 'Scalar'
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: 'label',
|
|
384
|
+
kind: 'Scalar'
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
name: 'lastModifiedBy',
|
|
388
|
+
kind: 'Object',
|
|
389
|
+
selections: CdpUserRepresentation__selections
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
name: 'lastModifiedDate',
|
|
393
|
+
kind: 'Scalar'
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: 'name',
|
|
397
|
+
kind: 'Scalar'
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
name: 'namespace',
|
|
401
|
+
kind: 'Scalar',
|
|
402
|
+
required: false
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
name: 'parameters',
|
|
406
|
+
kind: 'Scalar',
|
|
407
|
+
map: true
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: 'status',
|
|
411
|
+
kind: 'Scalar'
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
name: 'url',
|
|
415
|
+
kind: 'Scalar'
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: 'version',
|
|
419
|
+
kind: 'Scalar'
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
function equals(existing, incoming) {
|
|
425
|
+
const existing_deploymentFailureCode = existing.deploymentFailureCode;
|
|
426
|
+
const incoming_deploymentFailureCode = incoming.deploymentFailureCode;
|
|
427
|
+
// if at least one of these optionals is defined
|
|
428
|
+
if (existing_deploymentFailureCode !== undefined || incoming_deploymentFailureCode !== undefined) {
|
|
429
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
430
|
+
// not equal
|
|
431
|
+
if (existing_deploymentFailureCode === undefined || incoming_deploymentFailureCode === undefined) {
|
|
432
|
+
return false;
|
|
433
|
+
}
|
|
434
|
+
if (!(existing_deploymentFailureCode === incoming_deploymentFailureCode)) {
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
const existing_codeType = existing.codeType;
|
|
439
|
+
const incoming_codeType = incoming.codeType;
|
|
440
|
+
if (!(existing_codeType === incoming_codeType)) {
|
|
441
|
+
return false;
|
|
442
|
+
}
|
|
443
|
+
const existing_computeType = existing.computeType;
|
|
444
|
+
const incoming_computeType = incoming.computeType;
|
|
445
|
+
if (!(existing_computeType === incoming_computeType)) {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
const existing_createdDate = existing.createdDate;
|
|
449
|
+
const incoming_createdDate = incoming.createdDate;
|
|
450
|
+
if (!(existing_createdDate === incoming_createdDate)) {
|
|
451
|
+
return false;
|
|
452
|
+
}
|
|
453
|
+
const existing_deploymentFailureReason = existing.deploymentFailureReason;
|
|
454
|
+
const incoming_deploymentFailureReason = incoming.deploymentFailureReason;
|
|
455
|
+
// if at least one of these optionals is defined
|
|
456
|
+
if (existing_deploymentFailureReason !== undefined || incoming_deploymentFailureReason !== undefined) {
|
|
457
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
458
|
+
// not equal
|
|
459
|
+
if (existing_deploymentFailureReason === undefined || incoming_deploymentFailureReason === undefined) {
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
if (!(existing_deploymentFailureReason === incoming_deploymentFailureReason)) {
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
const existing_deploymentStatus = existing.deploymentStatus;
|
|
467
|
+
const incoming_deploymentStatus = incoming.deploymentStatus;
|
|
468
|
+
if (!(existing_deploymentStatus === incoming_deploymentStatus)) {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
const existing_description = existing.description;
|
|
472
|
+
const incoming_description = incoming.description;
|
|
473
|
+
// if at least one of these optionals is defined
|
|
474
|
+
if (existing_description !== undefined || incoming_description !== undefined) {
|
|
475
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
476
|
+
// not equal
|
|
477
|
+
if (existing_description === undefined || incoming_description === undefined) {
|
|
478
|
+
return false;
|
|
479
|
+
}
|
|
480
|
+
if (!(existing_description === incoming_description)) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
const existing_fileUploadUrl = existing.fileUploadUrl;
|
|
485
|
+
const incoming_fileUploadUrl = incoming.fileUploadUrl;
|
|
486
|
+
if (!(existing_fileUploadUrl === incoming_fileUploadUrl)) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
const existing_id = existing.id;
|
|
490
|
+
const incoming_id = incoming.id;
|
|
491
|
+
if (!(existing_id === incoming_id)) {
|
|
492
|
+
return false;
|
|
493
|
+
}
|
|
494
|
+
const existing_label = existing.label;
|
|
495
|
+
const incoming_label = incoming.label;
|
|
496
|
+
if (!(existing_label === incoming_label)) {
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
const existing_lastModifiedDate = existing.lastModifiedDate;
|
|
500
|
+
const incoming_lastModifiedDate = incoming.lastModifiedDate;
|
|
501
|
+
if (!(existing_lastModifiedDate === incoming_lastModifiedDate)) {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
const existing_name = existing.name;
|
|
505
|
+
const incoming_name = incoming.name;
|
|
506
|
+
if (!(existing_name === incoming_name)) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
const existing_namespace = existing.namespace;
|
|
510
|
+
const incoming_namespace = incoming.namespace;
|
|
511
|
+
// if at least one of these optionals is defined
|
|
512
|
+
if (existing_namespace !== undefined || incoming_namespace !== undefined) {
|
|
513
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
514
|
+
// not equal
|
|
515
|
+
if (existing_namespace === undefined || incoming_namespace === undefined) {
|
|
516
|
+
return false;
|
|
517
|
+
}
|
|
518
|
+
if (!(existing_namespace === incoming_namespace)) {
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const existing_status = existing.status;
|
|
523
|
+
const incoming_status = incoming.status;
|
|
524
|
+
if (!(existing_status === incoming_status)) {
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
const existing_url = existing.url;
|
|
528
|
+
const incoming_url = incoming.url;
|
|
529
|
+
if (!(existing_url === incoming_url)) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
const existing_version = existing.version;
|
|
533
|
+
const incoming_version = incoming.version;
|
|
534
|
+
if (!(existing_version === incoming_version)) {
|
|
535
|
+
return false;
|
|
536
|
+
}
|
|
537
|
+
const existing_createdBy = existing.createdBy;
|
|
538
|
+
const incoming_createdBy = incoming.createdBy;
|
|
539
|
+
if (!(equals$1(existing_createdBy, incoming_createdBy))) {
|
|
540
|
+
return false;
|
|
541
|
+
}
|
|
542
|
+
const existing_functionInvokeOptions = existing.functionInvokeOptions;
|
|
543
|
+
const incoming_functionInvokeOptions = incoming.functionInvokeOptions;
|
|
544
|
+
// if at least one of these optionals is defined
|
|
545
|
+
if (existing_functionInvokeOptions !== undefined || incoming_functionInvokeOptions !== undefined) {
|
|
546
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
547
|
+
// not equal
|
|
548
|
+
if (existing_functionInvokeOptions === undefined || incoming_functionInvokeOptions === undefined) {
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
const equals_functionInvokeOptions_items = equalsArray(existing_functionInvokeOptions, incoming_functionInvokeOptions, (existing_functionInvokeOptions_item, incoming_functionInvokeOptions_item) => {
|
|
552
|
+
if (!(existing_functionInvokeOptions_item === incoming_functionInvokeOptions_item)) {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
if (equals_functionInvokeOptions_items === false) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
const existing_lastModifiedBy = existing.lastModifiedBy;
|
|
561
|
+
const incoming_lastModifiedBy = incoming.lastModifiedBy;
|
|
562
|
+
if (!(equals$1(existing_lastModifiedBy, incoming_lastModifiedBy))) {
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
const existing_parameters = existing.parameters;
|
|
566
|
+
const incoming_parameters = incoming.parameters;
|
|
567
|
+
const equals_parameters_props = equalsObject(existing_parameters, incoming_parameters, (existing_parameters_prop, incoming_parameters_prop) => {
|
|
568
|
+
if (!(existing_parameters_prop === incoming_parameters_prop)) {
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
if (equals_parameters_props === false) {
|
|
573
|
+
return false;
|
|
574
|
+
}
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
const ingest = function CustomCodeDeploymentRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
578
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
579
|
+
const validateError = validate(input);
|
|
580
|
+
if (validateError !== null) {
|
|
581
|
+
throw validateError;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
const key = keyBuilderFromType(luvio, input);
|
|
585
|
+
const ttlToUse = path.ttl !== undefined ? path.ttl : 60000;
|
|
586
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "byoc", VERSION, RepresentationType, equals);
|
|
587
|
+
return createLink(key);
|
|
588
|
+
};
|
|
589
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
590
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
591
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
592
|
+
rootKeySet.set(rootKey, {
|
|
593
|
+
namespace: keyPrefix,
|
|
594
|
+
representationName: RepresentationType,
|
|
595
|
+
mergeable: false
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function select(luvio, params) {
|
|
600
|
+
return select$1();
|
|
601
|
+
}
|
|
602
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
603
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
604
|
+
}
|
|
605
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
606
|
+
const { body } = response;
|
|
607
|
+
const key = keyBuilderFromType(luvio, body);
|
|
608
|
+
luvio.storeIngest(key, ingest, body);
|
|
609
|
+
const snapshot = luvio.storeLookup({
|
|
610
|
+
recordId: key,
|
|
611
|
+
node: select(),
|
|
612
|
+
variables: {},
|
|
613
|
+
});
|
|
614
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
615
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
616
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
deepFreeze(snapshot.data);
|
|
620
|
+
return snapshot;
|
|
621
|
+
}
|
|
622
|
+
function createResourceRequest(config) {
|
|
623
|
+
const headers = {};
|
|
624
|
+
return {
|
|
625
|
+
baseUri: '/services/data/v63.0',
|
|
626
|
+
basePath: '/ssot/data-custom-code',
|
|
627
|
+
method: 'post',
|
|
628
|
+
body: config.body,
|
|
629
|
+
urlParams: {},
|
|
630
|
+
queryParams: {},
|
|
631
|
+
headers,
|
|
632
|
+
priority: 'normal',
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const adapterName = 'createCustomCodeDeployment';
|
|
637
|
+
const createCustomCodeDeployment_ConfigPropertyMetadata = [
|
|
638
|
+
generateParamConfigMetadata('codeType', false, 2 /* Body */, 0 /* String */),
|
|
639
|
+
generateParamConfigMetadata('computeType', true, 2 /* Body */, 0 /* String */),
|
|
640
|
+
generateParamConfigMetadata('description', false, 2 /* Body */, 0 /* String */),
|
|
641
|
+
generateParamConfigMetadata('id', false, 2 /* Body */, 0 /* String */),
|
|
642
|
+
generateParamConfigMetadata('label', true, 2 /* Body */, 0 /* String */),
|
|
643
|
+
generateParamConfigMetadata('name', true, 2 /* Body */, 0 /* String */),
|
|
644
|
+
generateParamConfigMetadata('namespace', false, 2 /* Body */, 0 /* String */),
|
|
645
|
+
generateParamConfigMetadata('parameters', false, 2 /* Body */, 4 /* Unsupported */),
|
|
646
|
+
generateParamConfigMetadata('version', true, 2 /* Body */, 0 /* String */),
|
|
647
|
+
];
|
|
648
|
+
const createCustomCodeDeployment_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, createCustomCodeDeployment_ConfigPropertyMetadata);
|
|
649
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(createCustomCodeDeployment_ConfigPropertyMetadata);
|
|
650
|
+
function typeCheckConfig(untrustedConfig) {
|
|
651
|
+
const config = {};
|
|
652
|
+
typeCheckConfig$1(untrustedConfig, config, createCustomCodeDeployment_ConfigPropertyMetadata);
|
|
653
|
+
const untrustedConfig_parameters = untrustedConfig.parameters;
|
|
654
|
+
if (untrustedIsObject(untrustedConfig_parameters)) {
|
|
655
|
+
const untrustedConfig_parameters_object = {};
|
|
656
|
+
const untrustedConfig_parameters_keys = Object.keys(untrustedConfig_parameters);
|
|
657
|
+
for (let i = 0, arrayLength = untrustedConfig_parameters_keys.length; i < arrayLength; i++) {
|
|
658
|
+
const key = untrustedConfig_parameters_keys[i];
|
|
659
|
+
const untrustedConfig_parameters_prop = untrustedConfig_parameters[key];
|
|
660
|
+
if (typeof untrustedConfig_parameters_prop === 'string') {
|
|
661
|
+
if (untrustedConfig_parameters_object !== undefined) {
|
|
662
|
+
untrustedConfig_parameters_object[key] = untrustedConfig_parameters_prop;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
if (untrustedConfig_parameters_object !== undefined && Object.keys(untrustedConfig_parameters_object).length >= 0) {
|
|
667
|
+
config.parameters = untrustedConfig_parameters_object;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return config;
|
|
671
|
+
}
|
|
672
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
673
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
676
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
677
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
678
|
+
}
|
|
679
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
680
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
return config;
|
|
684
|
+
}
|
|
685
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
686
|
+
const resourceParams = createResourceParams(config);
|
|
687
|
+
const request = createResourceRequest(resourceParams);
|
|
688
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
689
|
+
.then((response) => {
|
|
690
|
+
return luvio.handleSuccessResponse(() => {
|
|
691
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
692
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
693
|
+
}, () => {
|
|
694
|
+
const cache = new StoreKeyMap();
|
|
695
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
696
|
+
return cache;
|
|
697
|
+
});
|
|
698
|
+
}, (response) => {
|
|
699
|
+
deepFreeze(response);
|
|
700
|
+
throw response;
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
const createCustomCodeDeploymentAdapterFactory = (luvio) => {
|
|
704
|
+
return function createCustomCodeDeployment(untrustedConfig) {
|
|
705
|
+
const config = validateAdapterConfig(untrustedConfig, createCustomCodeDeployment_ConfigPropertyNames);
|
|
706
|
+
// Invalid or incomplete config
|
|
707
|
+
if (config === null) {
|
|
708
|
+
throw new Error('Invalid config for "createCustomCodeDeployment"');
|
|
709
|
+
}
|
|
710
|
+
return buildNetworkSnapshot(luvio, config);
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
export { createCustomCodeDeploymentAdapterFactory };
|