@salesforce/lds-adapters-platform-formula 1.270.1 → 1.272.0
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/dist/es/es2018/platform-formula.js +415 -25
- package/dist/es/es2018/types/src/generated/adapters/fixFormula.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/adapters/validateFormula.d.ts +19 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +3 -1
- package/dist/es/es2018/types/src/generated/resources/postConnectFormulaEinsteinFix.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/resources/postConnectFormulaValidate.d.ts +16 -0
- package/dist/es/es2018/types/src/generated/types/FixFormulaInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/FixFormulaRepresentation.d.ts +41 -0
- package/dist/es/es2018/types/src/generated/types/FormulaValidationInputRepresentation.d.ts +40 -0
- package/dist/es/es2018/types/src/generated/types/FormulaValidationRepresentation.d.ts +41 -0
- package/package.json +4 -4
- package/sfdc/index.js +421 -27
- package/src/raml/api.raml +131 -12
- package/src/raml/luvio.raml +22 -4
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$
|
|
7
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from '@luvio/engine';
|
|
8
8
|
|
|
9
9
|
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
10
10
|
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
@@ -71,9 +71,9 @@ function createLink(ref) {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const TTL = 100;
|
|
75
|
-
const VERSION = "c06ad095a0c68e00a7cf4b94f01f937b";
|
|
76
|
-
function validate(obj, path = 'FormulaExplanationRepresentation') {
|
|
74
|
+
const TTL$2 = 100;
|
|
75
|
+
const VERSION$2 = "c06ad095a0c68e00a7cf4b94f01f937b";
|
|
76
|
+
function validate$2(obj, path = 'FormulaExplanationRepresentation') {
|
|
77
77
|
const v_error = (() => {
|
|
78
78
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
79
79
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -91,23 +91,23 @@ function validate(obj, path = 'FormulaExplanationRepresentation') {
|
|
|
91
91
|
})();
|
|
92
92
|
return v_error === undefined ? null : v_error;
|
|
93
93
|
}
|
|
94
|
-
const RepresentationType = 'FormulaExplanationRepresentation';
|
|
95
|
-
function keyBuilder(luvio, config) {
|
|
96
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.generationId;
|
|
94
|
+
const RepresentationType$2 = 'FormulaExplanationRepresentation';
|
|
95
|
+
function keyBuilder$2(luvio, config) {
|
|
96
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.generationId;
|
|
97
97
|
}
|
|
98
|
-
function keyBuilderFromType(luvio, object) {
|
|
98
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
99
99
|
const keyParams = {
|
|
100
100
|
generationId: object.generationId
|
|
101
101
|
};
|
|
102
|
-
return keyBuilder(luvio, keyParams);
|
|
102
|
+
return keyBuilder$2(luvio, keyParams);
|
|
103
103
|
}
|
|
104
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
104
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
105
105
|
return input;
|
|
106
106
|
}
|
|
107
|
-
const select$
|
|
107
|
+
const select$5 = function FormulaExplanationRepresentationSelect() {
|
|
108
108
|
return {
|
|
109
109
|
kind: 'Fragment',
|
|
110
|
-
version: VERSION,
|
|
110
|
+
version: VERSION$2,
|
|
111
111
|
private: [],
|
|
112
112
|
selections: [
|
|
113
113
|
{
|
|
@@ -121,7 +121,7 @@ const select$1 = function FormulaExplanationRepresentationSelect() {
|
|
|
121
121
|
]
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
function equals(existing, incoming) {
|
|
124
|
+
function equals$2(existing, incoming) {
|
|
125
125
|
const existing_explanation = existing.explanation;
|
|
126
126
|
const incoming_explanation = incoming.explanation;
|
|
127
127
|
if (!(existing_explanation === incoming_explanation)) {
|
|
@@ -134,7 +134,396 @@ function equals(existing, incoming) {
|
|
|
134
134
|
}
|
|
135
135
|
return true;
|
|
136
136
|
}
|
|
137
|
-
const ingest = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
137
|
+
const ingest$2 = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
138
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
139
|
+
const validateError = validate$2(input);
|
|
140
|
+
if (validateError !== null) {
|
|
141
|
+
throw validateError;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
145
|
+
const ttlToUse = TTL$2;
|
|
146
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Formula", VERSION$2, RepresentationType$2, equals$2);
|
|
147
|
+
return createLink(key);
|
|
148
|
+
};
|
|
149
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
150
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
151
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
152
|
+
rootKeySet.set(rootKey, {
|
|
153
|
+
namespace: keyPrefix,
|
|
154
|
+
representationName: RepresentationType$2,
|
|
155
|
+
mergeable: false
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function select$4(luvio, params) {
|
|
160
|
+
return select$5();
|
|
161
|
+
}
|
|
162
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
163
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
164
|
+
}
|
|
165
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
166
|
+
const { body } = response;
|
|
167
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
168
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
169
|
+
const snapshot = luvio.storeLookup({
|
|
170
|
+
recordId: key,
|
|
171
|
+
node: select$4(),
|
|
172
|
+
variables: {},
|
|
173
|
+
});
|
|
174
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
175
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
176
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
deepFreeze(snapshot.data);
|
|
180
|
+
return snapshot;
|
|
181
|
+
}
|
|
182
|
+
function createResourceRequest$2(config) {
|
|
183
|
+
const headers = {};
|
|
184
|
+
return {
|
|
185
|
+
baseUri: '/services/data/v61.0',
|
|
186
|
+
basePath: '/connect/formula/einstein/explain',
|
|
187
|
+
method: 'post',
|
|
188
|
+
body: config.body,
|
|
189
|
+
urlParams: {},
|
|
190
|
+
queryParams: {},
|
|
191
|
+
headers,
|
|
192
|
+
priority: 'normal',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const adapterName$2 = 'getExplanation';
|
|
197
|
+
const getExplanation_ConfigPropertyMetadata = [
|
|
198
|
+
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
199
|
+
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
200
|
+
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
201
|
+
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
202
|
+
];
|
|
203
|
+
const getExplanation_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, getExplanation_ConfigPropertyMetadata);
|
|
204
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(getExplanation_ConfigPropertyMetadata);
|
|
205
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
206
|
+
const config = {};
|
|
207
|
+
typeCheckConfig$3(untrustedConfig, config, getExplanation_ConfigPropertyMetadata);
|
|
208
|
+
return config;
|
|
209
|
+
}
|
|
210
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
211
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
215
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
216
|
+
}
|
|
217
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
218
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
return config;
|
|
222
|
+
}
|
|
223
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
224
|
+
const resourceParams = createResourceParams$2(config);
|
|
225
|
+
const request = createResourceRequest$2(resourceParams);
|
|
226
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
227
|
+
.then((response) => {
|
|
228
|
+
return luvio.handleSuccessResponse(() => {
|
|
229
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
230
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
231
|
+
}, () => {
|
|
232
|
+
const cache = new StoreKeyMap();
|
|
233
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
234
|
+
return cache;
|
|
235
|
+
});
|
|
236
|
+
}, (response) => {
|
|
237
|
+
deepFreeze(response);
|
|
238
|
+
throw response;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const getExplanationAdapterFactory = (luvio) => {
|
|
242
|
+
return function getExplanation(untrustedConfig) {
|
|
243
|
+
const config = validateAdapterConfig$2(untrustedConfig, getExplanation_ConfigPropertyNames);
|
|
244
|
+
// Invalid or incomplete config
|
|
245
|
+
if (config === null) {
|
|
246
|
+
throw new Error('Invalid config for "getExplanation"');
|
|
247
|
+
}
|
|
248
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const TTL$1 = 100;
|
|
253
|
+
const VERSION$1 = "fb4a459f302e4d90aa792f35b0525f8f";
|
|
254
|
+
function validate$1(obj, path = 'FixFormulaRepresentation') {
|
|
255
|
+
const v_error = (() => {
|
|
256
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
257
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
258
|
+
}
|
|
259
|
+
const obj_generationId = obj.generationId;
|
|
260
|
+
const path_generationId = path + '.generationId';
|
|
261
|
+
if (typeof obj_generationId !== 'string') {
|
|
262
|
+
return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
|
|
263
|
+
}
|
|
264
|
+
const obj_response = obj.response;
|
|
265
|
+
const path_response = path + '.response';
|
|
266
|
+
if (typeof obj_response !== 'string') {
|
|
267
|
+
return new TypeError('Expected "string" but received "' + typeof obj_response + '" (at "' + path_response + '")');
|
|
268
|
+
}
|
|
269
|
+
})();
|
|
270
|
+
return v_error === undefined ? null : v_error;
|
|
271
|
+
}
|
|
272
|
+
const RepresentationType$1 = 'FixFormulaRepresentation';
|
|
273
|
+
function keyBuilder$1(luvio, config) {
|
|
274
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.generationId;
|
|
275
|
+
}
|
|
276
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
277
|
+
const keyParams = {
|
|
278
|
+
generationId: object.generationId
|
|
279
|
+
};
|
|
280
|
+
return keyBuilder$1(luvio, keyParams);
|
|
281
|
+
}
|
|
282
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
283
|
+
return input;
|
|
284
|
+
}
|
|
285
|
+
const select$3 = function FixFormulaRepresentationSelect() {
|
|
286
|
+
return {
|
|
287
|
+
kind: 'Fragment',
|
|
288
|
+
version: VERSION$1,
|
|
289
|
+
private: [],
|
|
290
|
+
selections: [
|
|
291
|
+
{
|
|
292
|
+
name: 'generationId',
|
|
293
|
+
kind: 'Scalar'
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: 'response',
|
|
297
|
+
kind: 'Scalar'
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
function equals$1(existing, incoming) {
|
|
303
|
+
const existing_generationId = existing.generationId;
|
|
304
|
+
const incoming_generationId = incoming.generationId;
|
|
305
|
+
if (!(existing_generationId === incoming_generationId)) {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
const existing_response = existing.response;
|
|
309
|
+
const incoming_response = incoming.response;
|
|
310
|
+
if (!(existing_response === incoming_response)) {
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
const ingest$1 = function FixFormulaRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
316
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
317
|
+
const validateError = validate$1(input);
|
|
318
|
+
if (validateError !== null) {
|
|
319
|
+
throw validateError;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
323
|
+
const ttlToUse = TTL$1;
|
|
324
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Formula", VERSION$1, RepresentationType$1, equals$1);
|
|
325
|
+
return createLink(key);
|
|
326
|
+
};
|
|
327
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
328
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
329
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
330
|
+
rootKeySet.set(rootKey, {
|
|
331
|
+
namespace: keyPrefix,
|
|
332
|
+
representationName: RepresentationType$1,
|
|
333
|
+
mergeable: false
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function select$2(luvio, params) {
|
|
338
|
+
return select$3();
|
|
339
|
+
}
|
|
340
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
341
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
342
|
+
}
|
|
343
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
344
|
+
const { body } = response;
|
|
345
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
346
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
347
|
+
const snapshot = luvio.storeLookup({
|
|
348
|
+
recordId: key,
|
|
349
|
+
node: select$2(),
|
|
350
|
+
variables: {},
|
|
351
|
+
});
|
|
352
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
353
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
354
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
deepFreeze(snapshot.data);
|
|
358
|
+
return snapshot;
|
|
359
|
+
}
|
|
360
|
+
function createResourceRequest$1(config) {
|
|
361
|
+
const headers = {};
|
|
362
|
+
return {
|
|
363
|
+
baseUri: '/services/data/v61.0',
|
|
364
|
+
basePath: '/connect/formula/einstein/fix',
|
|
365
|
+
method: 'post',
|
|
366
|
+
body: config.body,
|
|
367
|
+
urlParams: {},
|
|
368
|
+
queryParams: {},
|
|
369
|
+
headers,
|
|
370
|
+
priority: 'normal',
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const adapterName$1 = 'fixFormula';
|
|
375
|
+
const fixFormula_ConfigPropertyMetadata = [
|
|
376
|
+
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
377
|
+
generateParamConfigMetadata('fieldName', false, 2 /* Body */, 0 /* String */),
|
|
378
|
+
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
379
|
+
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
380
|
+
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
381
|
+
];
|
|
382
|
+
const fixFormula_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, fixFormula_ConfigPropertyMetadata);
|
|
383
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(fixFormula_ConfigPropertyMetadata);
|
|
384
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
385
|
+
const config = {};
|
|
386
|
+
typeCheckConfig$3(untrustedConfig, config, fixFormula_ConfigPropertyMetadata);
|
|
387
|
+
return config;
|
|
388
|
+
}
|
|
389
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
390
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
394
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
395
|
+
}
|
|
396
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
397
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
return config;
|
|
401
|
+
}
|
|
402
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
403
|
+
const resourceParams = createResourceParams$1(config);
|
|
404
|
+
const request = createResourceRequest$1(resourceParams);
|
|
405
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
406
|
+
.then((response) => {
|
|
407
|
+
return luvio.handleSuccessResponse(() => {
|
|
408
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
409
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
410
|
+
}, () => {
|
|
411
|
+
const cache = new StoreKeyMap();
|
|
412
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
413
|
+
return cache;
|
|
414
|
+
});
|
|
415
|
+
}, (response) => {
|
|
416
|
+
deepFreeze(response);
|
|
417
|
+
throw response;
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
const fixFormulaAdapterFactory = (luvio) => {
|
|
421
|
+
return function fixFormula(untrustedConfig) {
|
|
422
|
+
const config = validateAdapterConfig$1(untrustedConfig, fixFormula_ConfigPropertyNames);
|
|
423
|
+
// Invalid or incomplete config
|
|
424
|
+
if (config === null) {
|
|
425
|
+
throw new Error('Invalid config for "fixFormula"');
|
|
426
|
+
}
|
|
427
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
const TTL = 100;
|
|
432
|
+
const VERSION = "6fae0fe9f113df4590f7d92a6005ddeb";
|
|
433
|
+
function validate(obj, path = 'FormulaValidationRepresentation') {
|
|
434
|
+
const v_error = (() => {
|
|
435
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
436
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
437
|
+
}
|
|
438
|
+
const obj_isFormulaValid = obj.isFormulaValid;
|
|
439
|
+
const path_isFormulaValid = path + '.isFormulaValid';
|
|
440
|
+
if (typeof obj_isFormulaValid !== 'boolean') {
|
|
441
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isFormulaValid + '" (at "' + path_isFormulaValid + '")');
|
|
442
|
+
}
|
|
443
|
+
if (obj.message !== undefined) {
|
|
444
|
+
const obj_message = obj.message;
|
|
445
|
+
const path_message = path + '.message';
|
|
446
|
+
let obj_message_union0 = null;
|
|
447
|
+
const obj_message_union0_error = (() => {
|
|
448
|
+
if (typeof obj_message !== 'string') {
|
|
449
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
450
|
+
}
|
|
451
|
+
})();
|
|
452
|
+
if (obj_message_union0_error != null) {
|
|
453
|
+
obj_message_union0 = obj_message_union0_error.message;
|
|
454
|
+
}
|
|
455
|
+
let obj_message_union1 = null;
|
|
456
|
+
const obj_message_union1_error = (() => {
|
|
457
|
+
if (obj_message !== null) {
|
|
458
|
+
return new TypeError('Expected "null" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
459
|
+
}
|
|
460
|
+
})();
|
|
461
|
+
if (obj_message_union1_error != null) {
|
|
462
|
+
obj_message_union1 = obj_message_union1_error.message;
|
|
463
|
+
}
|
|
464
|
+
if (obj_message_union0 && obj_message_union1) {
|
|
465
|
+
let message = 'Object doesn\'t match union (at "' + path_message + '")';
|
|
466
|
+
message += '\n' + obj_message_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
467
|
+
message += '\n' + obj_message_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
468
|
+
return new TypeError(message);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
})();
|
|
472
|
+
return v_error === undefined ? null : v_error;
|
|
473
|
+
}
|
|
474
|
+
const RepresentationType = 'FormulaValidationRepresentation';
|
|
475
|
+
function keyBuilder(luvio, config) {
|
|
476
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isFormulaValid;
|
|
477
|
+
}
|
|
478
|
+
function keyBuilderFromType(luvio, object) {
|
|
479
|
+
const keyParams = {
|
|
480
|
+
isFormulaValid: object.isFormulaValid
|
|
481
|
+
};
|
|
482
|
+
return keyBuilder(luvio, keyParams);
|
|
483
|
+
}
|
|
484
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
485
|
+
return input;
|
|
486
|
+
}
|
|
487
|
+
const select$1 = function FormulaValidationRepresentationSelect() {
|
|
488
|
+
return {
|
|
489
|
+
kind: 'Fragment',
|
|
490
|
+
version: VERSION,
|
|
491
|
+
private: [],
|
|
492
|
+
selections: [
|
|
493
|
+
{
|
|
494
|
+
name: 'isFormulaValid',
|
|
495
|
+
kind: 'Scalar'
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: 'message',
|
|
499
|
+
kind: 'Scalar',
|
|
500
|
+
required: false
|
|
501
|
+
}
|
|
502
|
+
]
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
function equals(existing, incoming) {
|
|
506
|
+
const existing_isFormulaValid = existing.isFormulaValid;
|
|
507
|
+
const incoming_isFormulaValid = incoming.isFormulaValid;
|
|
508
|
+
if (!(existing_isFormulaValid === incoming_isFormulaValid)) {
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
const existing_message = existing.message;
|
|
512
|
+
const incoming_message = incoming.message;
|
|
513
|
+
// if at least one of these optionals is defined
|
|
514
|
+
if (existing_message !== undefined || incoming_message !== undefined) {
|
|
515
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
516
|
+
// not equal
|
|
517
|
+
if (existing_message === undefined || incoming_message === undefined) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
if (!(existing_message === incoming_message)) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
const ingest = function FormulaValidationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
138
527
|
if (process.env.NODE_ENV !== 'production') {
|
|
139
528
|
const validateError = validate(input);
|
|
140
529
|
if (validateError !== null) {
|
|
@@ -183,7 +572,7 @@ function createResourceRequest(config) {
|
|
|
183
572
|
const headers = {};
|
|
184
573
|
return {
|
|
185
574
|
baseUri: '/services/data/v61.0',
|
|
186
|
-
basePath: '/connect/formula/
|
|
575
|
+
basePath: '/connect/formula/validate',
|
|
187
576
|
method: 'post',
|
|
188
577
|
body: config.body,
|
|
189
578
|
urlParams: {},
|
|
@@ -193,18 +582,19 @@ function createResourceRequest(config) {
|
|
|
193
582
|
};
|
|
194
583
|
}
|
|
195
584
|
|
|
196
|
-
const adapterName = '
|
|
197
|
-
const
|
|
585
|
+
const adapterName = 'validateFormula';
|
|
586
|
+
const validateFormula_ConfigPropertyMetadata = [
|
|
198
587
|
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
588
|
+
generateParamConfigMetadata('fieldName', false, 2 /* Body */, 0 /* String */),
|
|
199
589
|
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
200
590
|
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
201
591
|
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
202
592
|
];
|
|
203
|
-
const
|
|
204
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
593
|
+
const validateFormula_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, validateFormula_ConfigPropertyMetadata);
|
|
594
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(validateFormula_ConfigPropertyMetadata);
|
|
205
595
|
function typeCheckConfig(untrustedConfig) {
|
|
206
596
|
const config = {};
|
|
207
|
-
typeCheckConfig$
|
|
597
|
+
typeCheckConfig$3(untrustedConfig, config, validateFormula_ConfigPropertyMetadata);
|
|
208
598
|
return config;
|
|
209
599
|
}
|
|
210
600
|
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
@@ -238,15 +628,15 @@ function buildNetworkSnapshot(luvio, config, options) {
|
|
|
238
628
|
throw response;
|
|
239
629
|
});
|
|
240
630
|
}
|
|
241
|
-
const
|
|
242
|
-
return function
|
|
243
|
-
const config = validateAdapterConfig(untrustedConfig,
|
|
631
|
+
const validateFormulaAdapterFactory = (luvio) => {
|
|
632
|
+
return function validateFormula(untrustedConfig) {
|
|
633
|
+
const config = validateAdapterConfig(untrustedConfig, validateFormula_ConfigPropertyNames);
|
|
244
634
|
// Invalid or incomplete config
|
|
245
635
|
if (config === null) {
|
|
246
|
-
throw new Error('Invalid config for "
|
|
636
|
+
throw new Error('Invalid config for "validateFormula"');
|
|
247
637
|
}
|
|
248
638
|
return buildNetworkSnapshot(luvio, config);
|
|
249
639
|
};
|
|
250
640
|
};
|
|
251
641
|
|
|
252
|
-
export { getExplanationAdapterFactory };
|
|
642
|
+
export { fixFormulaAdapterFactory, getExplanationAdapterFactory, validateFormulaAdapterFactory };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
|
|
2
|
+
import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
|
|
3
|
+
import { ResourceRequestConfig as resources_postConnectFormulaEinsteinFix_ResourceRequestConfig } from '../resources/postConnectFormulaEinsteinFix';
|
|
4
|
+
import { FixFormulaRepresentation as types_FixFormulaRepresentation_FixFormulaRepresentation } from '../types/FixFormulaRepresentation';
|
|
5
|
+
export declare const adapterName = "fixFormula";
|
|
6
|
+
export declare const fixFormula_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
|
|
7
|
+
export declare const fixFormula_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
|
|
8
|
+
export interface FixFormulaConfig {
|
|
9
|
+
entityName: string;
|
|
10
|
+
fieldName?: string;
|
|
11
|
+
formula: string;
|
|
12
|
+
formulaType: string;
|
|
13
|
+
returnType: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const createResourceParams: (config: FixFormulaConfig) => resources_postConnectFormulaEinsteinFix_ResourceRequestConfig;
|
|
16
|
+
export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<FixFormulaConfig>): adapter$45$utils_Untrusted<FixFormulaConfig>;
|
|
17
|
+
export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): FixFormulaConfig | null;
|
|
18
|
+
export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: FixFormulaConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_FixFormulaRepresentation_FixFormulaRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_FixFormulaRepresentation_FixFormulaRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_FixFormulaRepresentation_FixFormulaRepresentation, any>>;
|
|
19
|
+
export declare const fixFormulaAdapterFactory: $64$luvio_engine_AdapterFactory<FixFormulaConfig, types_FixFormulaRepresentation_FixFormulaRepresentation>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdapterConfigMetadata as $64$luvio_engine_AdapterConfigMetadata, Luvio as $64$luvio_engine_Luvio, DispatchResourceRequestContext as $64$luvio_engine_DispatchResourceRequestContext, AdapterFactory as $64$luvio_engine_AdapterFactory } from '@luvio/engine';
|
|
2
|
+
import { Untrusted as adapter$45$utils_Untrusted, AdapterValidationConfig as adapter$45$utils_AdapterValidationConfig } from './adapter-utils';
|
|
3
|
+
import { ResourceRequestConfig as resources_postConnectFormulaValidate_ResourceRequestConfig } from '../resources/postConnectFormulaValidate';
|
|
4
|
+
import { FormulaValidationRepresentation as types_FormulaValidationRepresentation_FormulaValidationRepresentation } from '../types/FormulaValidationRepresentation';
|
|
5
|
+
export declare const adapterName = "validateFormula";
|
|
6
|
+
export declare const validateFormula_ConfigPropertyMetadata: $64$luvio_engine_AdapterConfigMetadata[];
|
|
7
|
+
export declare const validateFormula_ConfigPropertyNames: adapter$45$utils_AdapterValidationConfig;
|
|
8
|
+
export interface ValidateFormulaConfig {
|
|
9
|
+
entityName: string;
|
|
10
|
+
fieldName?: string;
|
|
11
|
+
formula: string;
|
|
12
|
+
formulaType: string;
|
|
13
|
+
returnType: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const createResourceParams: (config: ValidateFormulaConfig) => resources_postConnectFormulaValidate_ResourceRequestConfig;
|
|
16
|
+
export declare function typeCheckConfig(untrustedConfig: adapter$45$utils_Untrusted<ValidateFormulaConfig>): adapter$45$utils_Untrusted<ValidateFormulaConfig>;
|
|
17
|
+
export declare function validateAdapterConfig(untrustedConfig: unknown, configPropertyNames: adapter$45$utils_AdapterValidationConfig): ValidateFormulaConfig | null;
|
|
18
|
+
export declare function buildNetworkSnapshot(luvio: $64$luvio_engine_Luvio, config: ValidateFormulaConfig, options?: $64$luvio_engine_DispatchResourceRequestContext): Promise<import("@luvio/engine").FulfilledSnapshot<types_FormulaValidationRepresentation_FormulaValidationRepresentation, {}> | import("@luvio/engine").StaleSnapshot<types_FormulaValidationRepresentation_FormulaValidationRepresentation, {}> | import("@luvio/engine").PendingSnapshot<types_FormulaValidationRepresentation_FormulaValidationRepresentation, any>>;
|
|
19
|
+
export declare const validateFormulaAdapterFactory: $64$luvio_engine_AdapterFactory<ValidateFormulaConfig, types_FormulaValidationRepresentation_FormulaValidationRepresentation>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, FetchResponse as $64$luvio_engine_FetchResponse, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
|
|
2
|
+
import { FixFormulaRepresentation as types_FixFormulaRepresentation_FixFormulaRepresentation } from '../types/FixFormulaRepresentation';
|
|
3
|
+
export interface ResourceRequestConfig {
|
|
4
|
+
body: {
|
|
5
|
+
entityName: string;
|
|
6
|
+
fieldName?: string;
|
|
7
|
+
formula: string;
|
|
8
|
+
formulaType: string;
|
|
9
|
+
returnType: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
|
|
13
|
+
export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_FixFormulaRepresentation_FixFormulaRepresentation): void;
|
|
14
|
+
export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_FixFormulaRepresentation_FixFormulaRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_FixFormulaRepresentation_FixFormulaRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_FixFormulaRepresentation_FixFormulaRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_FixFormulaRepresentation_FixFormulaRepresentation, any>;
|
|
15
|
+
export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
|
|
16
|
+
export default createResourceRequest;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Luvio as $64$luvio_engine_Luvio, Fragment as $64$luvio_engine_Fragment, FetchResponse as $64$luvio_engine_FetchResponse, FulfilledSnapshot as $64$luvio_engine_FulfilledSnapshot, StaleSnapshot as $64$luvio_engine_StaleSnapshot, PendingSnapshot as $64$luvio_engine_PendingSnapshot, ResourceRequest as $64$luvio_engine_ResourceRequest } from '@luvio/engine';
|
|
2
|
+
import { FormulaValidationRepresentation as types_FormulaValidationRepresentation_FormulaValidationRepresentation } from '../types/FormulaValidationRepresentation';
|
|
3
|
+
export interface ResourceRequestConfig {
|
|
4
|
+
body: {
|
|
5
|
+
entityName: string;
|
|
6
|
+
fieldName?: string;
|
|
7
|
+
formula: string;
|
|
8
|
+
formulaType: string;
|
|
9
|
+
returnType: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function select(luvio: $64$luvio_engine_Luvio, params: ResourceRequestConfig): $64$luvio_engine_Fragment;
|
|
13
|
+
export declare function getResponseCacheKeys(storeKeyMap: any, luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: types_FormulaValidationRepresentation_FormulaValidationRepresentation): void;
|
|
14
|
+
export declare function ingestSuccess(luvio: $64$luvio_engine_Luvio, resourceParams: ResourceRequestConfig, response: $64$luvio_engine_FetchResponse<types_FormulaValidationRepresentation_FormulaValidationRepresentation>): $64$luvio_engine_FulfilledSnapshot<types_FormulaValidationRepresentation_FormulaValidationRepresentation, {}> | $64$luvio_engine_StaleSnapshot<types_FormulaValidationRepresentation_FormulaValidationRepresentation, {}> | $64$luvio_engine_PendingSnapshot<types_FormulaValidationRepresentation_FormulaValidationRepresentation, any>;
|
|
15
|
+
export declare function createResourceRequest(config: ResourceRequestConfig): $64$luvio_engine_ResourceRequest;
|
|
16
|
+
export default createResourceRequest;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
|
|
2
|
+
export declare const VERSION = "a777b210643fdd906951635d627027a6";
|
|
3
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
4
|
+
export declare const RepresentationType: string;
|
|
5
|
+
export declare function normalize(input: FixFormulaInputRepresentation, existing: FixFormulaInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): FixFormulaInputRepresentationNormalized;
|
|
6
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
7
|
+
export declare function equals(existing: FixFormulaInputRepresentationNormalized, incoming: FixFormulaInputRepresentationNormalized): boolean;
|
|
8
|
+
export declare const ingest: $64$luvio_engine_ResourceIngest;
|
|
9
|
+
export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: FixFormulaInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
10
|
+
/**
|
|
11
|
+
* The input representation for fixing a formula
|
|
12
|
+
*
|
|
13
|
+
* Keys:
|
|
14
|
+
* (none)
|
|
15
|
+
*/
|
|
16
|
+
export interface FixFormulaInputRepresentationNormalized {
|
|
17
|
+
/** Entity Name from the formula builder */
|
|
18
|
+
entityName: string;
|
|
19
|
+
/** Field name if the formula is already saved */
|
|
20
|
+
fieldName?: string;
|
|
21
|
+
/** Formula which needs to be fixed */
|
|
22
|
+
formula: string;
|
|
23
|
+
/** Formula Type */
|
|
24
|
+
formulaType: string;
|
|
25
|
+
/** Return type of the formula */
|
|
26
|
+
returnType: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The input representation for fixing a formula
|
|
30
|
+
*
|
|
31
|
+
* Keys:
|
|
32
|
+
* (none)
|
|
33
|
+
*/
|
|
34
|
+
export interface FixFormulaInputRepresentation {
|
|
35
|
+
entityName: string;
|
|
36
|
+
fieldName?: string;
|
|
37
|
+
formula: string;
|
|
38
|
+
formulaType: string;
|
|
39
|
+
returnType: string;
|
|
40
|
+
}
|