@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
package/sfdc/index.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
/* proxy-compat-disable */
|
|
15
15
|
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
16
|
-
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$
|
|
16
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$3, typeCheckConfig as typeCheckConfig$3 } from 'force/luvioEngine';
|
|
17
17
|
|
|
18
18
|
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
19
19
|
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
@@ -80,9 +80,188 @@ function createLink(ref) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const TTL = 100;
|
|
84
|
-
const VERSION = "
|
|
85
|
-
function validate(obj, path = '
|
|
83
|
+
const TTL$2 = 100;
|
|
84
|
+
const VERSION$2 = "fb4a459f302e4d90aa792f35b0525f8f";
|
|
85
|
+
function validate$2(obj, path = 'FixFormulaRepresentation') {
|
|
86
|
+
const v_error = (() => {
|
|
87
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
88
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
89
|
+
}
|
|
90
|
+
const obj_generationId = obj.generationId;
|
|
91
|
+
const path_generationId = path + '.generationId';
|
|
92
|
+
if (typeof obj_generationId !== 'string') {
|
|
93
|
+
return new TypeError('Expected "string" but received "' + typeof obj_generationId + '" (at "' + path_generationId + '")');
|
|
94
|
+
}
|
|
95
|
+
const obj_response = obj.response;
|
|
96
|
+
const path_response = path + '.response';
|
|
97
|
+
if (typeof obj_response !== 'string') {
|
|
98
|
+
return new TypeError('Expected "string" but received "' + typeof obj_response + '" (at "' + path_response + '")');
|
|
99
|
+
}
|
|
100
|
+
})();
|
|
101
|
+
return v_error === undefined ? null : v_error;
|
|
102
|
+
}
|
|
103
|
+
const RepresentationType$2 = 'FixFormulaRepresentation';
|
|
104
|
+
function keyBuilder$2(luvio, config) {
|
|
105
|
+
return keyPrefix + '::' + RepresentationType$2 + ':' + config.generationId;
|
|
106
|
+
}
|
|
107
|
+
function keyBuilderFromType$2(luvio, object) {
|
|
108
|
+
const keyParams = {
|
|
109
|
+
generationId: object.generationId
|
|
110
|
+
};
|
|
111
|
+
return keyBuilder$2(luvio, keyParams);
|
|
112
|
+
}
|
|
113
|
+
function normalize$2(input, existing, path, luvio, store, timestamp) {
|
|
114
|
+
return input;
|
|
115
|
+
}
|
|
116
|
+
const select$5 = function FixFormulaRepresentationSelect() {
|
|
117
|
+
return {
|
|
118
|
+
kind: 'Fragment',
|
|
119
|
+
version: VERSION$2,
|
|
120
|
+
private: [],
|
|
121
|
+
selections: [
|
|
122
|
+
{
|
|
123
|
+
name: 'generationId',
|
|
124
|
+
kind: 'Scalar'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: 'response',
|
|
128
|
+
kind: 'Scalar'
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
function equals$2(existing, incoming) {
|
|
134
|
+
const existing_generationId = existing.generationId;
|
|
135
|
+
const incoming_generationId = incoming.generationId;
|
|
136
|
+
if (!(existing_generationId === incoming_generationId)) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
const existing_response = existing.response;
|
|
140
|
+
const incoming_response = incoming.response;
|
|
141
|
+
if (!(existing_response === incoming_response)) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
const ingest$2 = function FixFormulaRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
147
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
148
|
+
const validateError = validate$2(input);
|
|
149
|
+
if (validateError !== null) {
|
|
150
|
+
throw validateError;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const key = keyBuilderFromType$2(luvio, input);
|
|
154
|
+
const ttlToUse = TTL$2;
|
|
155
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$2, "Formula", VERSION$2, RepresentationType$2, equals$2);
|
|
156
|
+
return createLink(key);
|
|
157
|
+
};
|
|
158
|
+
function getTypeCacheKeys$2(rootKeySet, luvio, input, fullPathFactory) {
|
|
159
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
160
|
+
const rootKey = keyBuilderFromType$2(luvio, input);
|
|
161
|
+
rootKeySet.set(rootKey, {
|
|
162
|
+
namespace: keyPrefix,
|
|
163
|
+
representationName: RepresentationType$2,
|
|
164
|
+
mergeable: false
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function select$4(luvio, params) {
|
|
169
|
+
return select$5();
|
|
170
|
+
}
|
|
171
|
+
function getResponseCacheKeys$2(storeKeyMap, luvio, resourceParams, response) {
|
|
172
|
+
getTypeCacheKeys$2(storeKeyMap, luvio, response);
|
|
173
|
+
}
|
|
174
|
+
function ingestSuccess$2(luvio, resourceParams, response) {
|
|
175
|
+
const { body } = response;
|
|
176
|
+
const key = keyBuilderFromType$2(luvio, body);
|
|
177
|
+
luvio.storeIngest(key, ingest$2, body);
|
|
178
|
+
const snapshot = luvio.storeLookup({
|
|
179
|
+
recordId: key,
|
|
180
|
+
node: select$4(),
|
|
181
|
+
variables: {},
|
|
182
|
+
});
|
|
183
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
184
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
185
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
deepFreeze(snapshot.data);
|
|
189
|
+
return snapshot;
|
|
190
|
+
}
|
|
191
|
+
function createResourceRequest$2(config) {
|
|
192
|
+
const headers = {};
|
|
193
|
+
return {
|
|
194
|
+
baseUri: '/services/data/v61.0',
|
|
195
|
+
basePath: '/connect/formula/einstein/fix',
|
|
196
|
+
method: 'post',
|
|
197
|
+
body: config.body,
|
|
198
|
+
urlParams: {},
|
|
199
|
+
queryParams: {},
|
|
200
|
+
headers,
|
|
201
|
+
priority: 'normal',
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const adapterName$2 = 'fixFormula';
|
|
206
|
+
const fixFormula_ConfigPropertyMetadata = [
|
|
207
|
+
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
208
|
+
generateParamConfigMetadata('fieldName', false, 2 /* Body */, 0 /* String */),
|
|
209
|
+
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
210
|
+
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
211
|
+
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
212
|
+
];
|
|
213
|
+
const fixFormula_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$2, fixFormula_ConfigPropertyMetadata);
|
|
214
|
+
const createResourceParams$2 = /*#__PURE__*/ createResourceParams$3(fixFormula_ConfigPropertyMetadata);
|
|
215
|
+
function typeCheckConfig$2(untrustedConfig) {
|
|
216
|
+
const config = {};
|
|
217
|
+
typeCheckConfig$3(untrustedConfig, config, fixFormula_ConfigPropertyMetadata);
|
|
218
|
+
return config;
|
|
219
|
+
}
|
|
220
|
+
function validateAdapterConfig$2(untrustedConfig, configPropertyNames) {
|
|
221
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
226
|
+
}
|
|
227
|
+
const config = typeCheckConfig$2(untrustedConfig);
|
|
228
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return config;
|
|
232
|
+
}
|
|
233
|
+
function buildNetworkSnapshot$2(luvio, config, options) {
|
|
234
|
+
const resourceParams = createResourceParams$2(config);
|
|
235
|
+
const request = createResourceRequest$2(resourceParams);
|
|
236
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
237
|
+
.then((response) => {
|
|
238
|
+
return luvio.handleSuccessResponse(() => {
|
|
239
|
+
const snapshot = ingestSuccess$2(luvio, resourceParams, response);
|
|
240
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
241
|
+
}, () => {
|
|
242
|
+
const cache = new StoreKeyMap();
|
|
243
|
+
getResponseCacheKeys$2(cache, luvio, resourceParams, response.body);
|
|
244
|
+
return cache;
|
|
245
|
+
});
|
|
246
|
+
}, (response) => {
|
|
247
|
+
deepFreeze(response);
|
|
248
|
+
throw response;
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const fixFormulaAdapterFactory = (luvio) => {
|
|
252
|
+
return function fixFormula(untrustedConfig) {
|
|
253
|
+
const config = validateAdapterConfig$2(untrustedConfig, fixFormula_ConfigPropertyNames);
|
|
254
|
+
// Invalid or incomplete config
|
|
255
|
+
if (config === null) {
|
|
256
|
+
throw new Error('Invalid config for "fixFormula"');
|
|
257
|
+
}
|
|
258
|
+
return buildNetworkSnapshot$2(luvio, config);
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const TTL$1 = 100;
|
|
263
|
+
const VERSION$1 = "c06ad095a0c68e00a7cf4b94f01f937b";
|
|
264
|
+
function validate$1(obj, path = 'FormulaExplanationRepresentation') {
|
|
86
265
|
const v_error = (() => {
|
|
87
266
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
88
267
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -100,23 +279,23 @@ function validate(obj, path = 'FormulaExplanationRepresentation') {
|
|
|
100
279
|
})();
|
|
101
280
|
return v_error === undefined ? null : v_error;
|
|
102
281
|
}
|
|
103
|
-
const RepresentationType = 'FormulaExplanationRepresentation';
|
|
104
|
-
function keyBuilder(luvio, config) {
|
|
105
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.generationId;
|
|
282
|
+
const RepresentationType$1 = 'FormulaExplanationRepresentation';
|
|
283
|
+
function keyBuilder$1(luvio, config) {
|
|
284
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.generationId;
|
|
106
285
|
}
|
|
107
|
-
function keyBuilderFromType(luvio, object) {
|
|
286
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
108
287
|
const keyParams = {
|
|
109
288
|
generationId: object.generationId
|
|
110
289
|
};
|
|
111
|
-
return keyBuilder(luvio, keyParams);
|
|
290
|
+
return keyBuilder$1(luvio, keyParams);
|
|
112
291
|
}
|
|
113
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
292
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
114
293
|
return input;
|
|
115
294
|
}
|
|
116
|
-
const select$
|
|
295
|
+
const select$3 = function FormulaExplanationRepresentationSelect() {
|
|
117
296
|
return {
|
|
118
297
|
kind: 'Fragment',
|
|
119
|
-
version: VERSION,
|
|
298
|
+
version: VERSION$1,
|
|
120
299
|
private: [],
|
|
121
300
|
selections: [
|
|
122
301
|
{
|
|
@@ -130,7 +309,7 @@ const select$1 = function FormulaExplanationRepresentationSelect() {
|
|
|
130
309
|
]
|
|
131
310
|
};
|
|
132
311
|
};
|
|
133
|
-
function equals(existing, incoming) {
|
|
312
|
+
function equals$1(existing, incoming) {
|
|
134
313
|
const existing_explanation = existing.explanation;
|
|
135
314
|
const incoming_explanation = incoming.explanation;
|
|
136
315
|
if (!(existing_explanation === incoming_explanation)) {
|
|
@@ -143,7 +322,217 @@ function equals(existing, incoming) {
|
|
|
143
322
|
}
|
|
144
323
|
return true;
|
|
145
324
|
}
|
|
146
|
-
const ingest = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
325
|
+
const ingest$1 = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
326
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
327
|
+
const validateError = validate$1(input);
|
|
328
|
+
if (validateError !== null) {
|
|
329
|
+
throw validateError;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
333
|
+
const ttlToUse = TTL$1;
|
|
334
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Formula", VERSION$1, RepresentationType$1, equals$1);
|
|
335
|
+
return createLink(key);
|
|
336
|
+
};
|
|
337
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
338
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
339
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
340
|
+
rootKeySet.set(rootKey, {
|
|
341
|
+
namespace: keyPrefix,
|
|
342
|
+
representationName: RepresentationType$1,
|
|
343
|
+
mergeable: false
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function select$2(luvio, params) {
|
|
348
|
+
return select$3();
|
|
349
|
+
}
|
|
350
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
351
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
352
|
+
}
|
|
353
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
354
|
+
const { body } = response;
|
|
355
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
356
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
357
|
+
const snapshot = luvio.storeLookup({
|
|
358
|
+
recordId: key,
|
|
359
|
+
node: select$2(),
|
|
360
|
+
variables: {},
|
|
361
|
+
});
|
|
362
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
363
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
364
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
deepFreeze(snapshot.data);
|
|
368
|
+
return snapshot;
|
|
369
|
+
}
|
|
370
|
+
function createResourceRequest$1(config) {
|
|
371
|
+
const headers = {};
|
|
372
|
+
return {
|
|
373
|
+
baseUri: '/services/data/v61.0',
|
|
374
|
+
basePath: '/connect/formula/einstein/explain',
|
|
375
|
+
method: 'post',
|
|
376
|
+
body: config.body,
|
|
377
|
+
urlParams: {},
|
|
378
|
+
queryParams: {},
|
|
379
|
+
headers,
|
|
380
|
+
priority: 'normal',
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
const adapterName$1 = 'getExplanation';
|
|
385
|
+
const getExplanation_ConfigPropertyMetadata = [
|
|
386
|
+
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
387
|
+
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
388
|
+
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
389
|
+
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
390
|
+
];
|
|
391
|
+
const getExplanation_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getExplanation_ConfigPropertyMetadata);
|
|
392
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$3(getExplanation_ConfigPropertyMetadata);
|
|
393
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
394
|
+
const config = {};
|
|
395
|
+
typeCheckConfig$3(untrustedConfig, config, getExplanation_ConfigPropertyMetadata);
|
|
396
|
+
return config;
|
|
397
|
+
}
|
|
398
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
399
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
400
|
+
return null;
|
|
401
|
+
}
|
|
402
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
403
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
404
|
+
}
|
|
405
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
406
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
return config;
|
|
410
|
+
}
|
|
411
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
412
|
+
const resourceParams = createResourceParams$1(config);
|
|
413
|
+
const request = createResourceRequest$1(resourceParams);
|
|
414
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
415
|
+
.then((response) => {
|
|
416
|
+
return luvio.handleSuccessResponse(() => {
|
|
417
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
418
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
419
|
+
}, () => {
|
|
420
|
+
const cache = new StoreKeyMap();
|
|
421
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
422
|
+
return cache;
|
|
423
|
+
});
|
|
424
|
+
}, (response) => {
|
|
425
|
+
deepFreeze(response);
|
|
426
|
+
throw response;
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
const getExplanationAdapterFactory = (luvio) => {
|
|
430
|
+
return function getExplanation(untrustedConfig) {
|
|
431
|
+
const config = validateAdapterConfig$1(untrustedConfig, getExplanation_ConfigPropertyNames);
|
|
432
|
+
// Invalid or incomplete config
|
|
433
|
+
if (config === null) {
|
|
434
|
+
throw new Error('Invalid config for "getExplanation"');
|
|
435
|
+
}
|
|
436
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
437
|
+
};
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const TTL = 100;
|
|
441
|
+
const VERSION = "6fae0fe9f113df4590f7d92a6005ddeb";
|
|
442
|
+
function validate(obj, path = 'FormulaValidationRepresentation') {
|
|
443
|
+
const v_error = (() => {
|
|
444
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
445
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
446
|
+
}
|
|
447
|
+
const obj_isFormulaValid = obj.isFormulaValid;
|
|
448
|
+
const path_isFormulaValid = path + '.isFormulaValid';
|
|
449
|
+
if (typeof obj_isFormulaValid !== 'boolean') {
|
|
450
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isFormulaValid + '" (at "' + path_isFormulaValid + '")');
|
|
451
|
+
}
|
|
452
|
+
if (obj.message !== undefined) {
|
|
453
|
+
const obj_message = obj.message;
|
|
454
|
+
const path_message = path + '.message';
|
|
455
|
+
let obj_message_union0 = null;
|
|
456
|
+
const obj_message_union0_error = (() => {
|
|
457
|
+
if (typeof obj_message !== 'string') {
|
|
458
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
459
|
+
}
|
|
460
|
+
})();
|
|
461
|
+
if (obj_message_union0_error != null) {
|
|
462
|
+
obj_message_union0 = obj_message_union0_error.message;
|
|
463
|
+
}
|
|
464
|
+
let obj_message_union1 = null;
|
|
465
|
+
const obj_message_union1_error = (() => {
|
|
466
|
+
if (obj_message !== null) {
|
|
467
|
+
return new TypeError('Expected "null" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
468
|
+
}
|
|
469
|
+
})();
|
|
470
|
+
if (obj_message_union1_error != null) {
|
|
471
|
+
obj_message_union1 = obj_message_union1_error.message;
|
|
472
|
+
}
|
|
473
|
+
if (obj_message_union0 && obj_message_union1) {
|
|
474
|
+
let message = 'Object doesn\'t match union (at "' + path_message + '")';
|
|
475
|
+
message += '\n' + obj_message_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
476
|
+
message += '\n' + obj_message_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
477
|
+
return new TypeError(message);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
})();
|
|
481
|
+
return v_error === undefined ? null : v_error;
|
|
482
|
+
}
|
|
483
|
+
const RepresentationType = 'FormulaValidationRepresentation';
|
|
484
|
+
function keyBuilder(luvio, config) {
|
|
485
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isFormulaValid;
|
|
486
|
+
}
|
|
487
|
+
function keyBuilderFromType(luvio, object) {
|
|
488
|
+
const keyParams = {
|
|
489
|
+
isFormulaValid: object.isFormulaValid
|
|
490
|
+
};
|
|
491
|
+
return keyBuilder(luvio, keyParams);
|
|
492
|
+
}
|
|
493
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
494
|
+
return input;
|
|
495
|
+
}
|
|
496
|
+
const select$1 = function FormulaValidationRepresentationSelect() {
|
|
497
|
+
return {
|
|
498
|
+
kind: 'Fragment',
|
|
499
|
+
version: VERSION,
|
|
500
|
+
private: [],
|
|
501
|
+
selections: [
|
|
502
|
+
{
|
|
503
|
+
name: 'isFormulaValid',
|
|
504
|
+
kind: 'Scalar'
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name: 'message',
|
|
508
|
+
kind: 'Scalar',
|
|
509
|
+
required: false
|
|
510
|
+
}
|
|
511
|
+
]
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
function equals(existing, incoming) {
|
|
515
|
+
const existing_isFormulaValid = existing.isFormulaValid;
|
|
516
|
+
const incoming_isFormulaValid = incoming.isFormulaValid;
|
|
517
|
+
if (!(existing_isFormulaValid === incoming_isFormulaValid)) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
const existing_message = existing.message;
|
|
521
|
+
const incoming_message = incoming.message;
|
|
522
|
+
// if at least one of these optionals is defined
|
|
523
|
+
if (existing_message !== undefined || incoming_message !== undefined) {
|
|
524
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
525
|
+
// not equal
|
|
526
|
+
if (existing_message === undefined || incoming_message === undefined) {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
if (!(existing_message === incoming_message)) {
|
|
530
|
+
return false;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
const ingest = function FormulaValidationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
147
536
|
if (process.env.NODE_ENV !== 'production') {
|
|
148
537
|
const validateError = validate(input);
|
|
149
538
|
if (validateError !== null) {
|
|
@@ -192,7 +581,7 @@ function createResourceRequest(config) {
|
|
|
192
581
|
const headers = {};
|
|
193
582
|
return {
|
|
194
583
|
baseUri: '/services/data/v61.0',
|
|
195
|
-
basePath: '/connect/formula/
|
|
584
|
+
basePath: '/connect/formula/validate',
|
|
196
585
|
method: 'post',
|
|
197
586
|
body: config.body,
|
|
198
587
|
urlParams: {},
|
|
@@ -202,18 +591,19 @@ function createResourceRequest(config) {
|
|
|
202
591
|
};
|
|
203
592
|
}
|
|
204
593
|
|
|
205
|
-
const adapterName = '
|
|
206
|
-
const
|
|
594
|
+
const adapterName = 'validateFormula';
|
|
595
|
+
const validateFormula_ConfigPropertyMetadata = [
|
|
207
596
|
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
597
|
+
generateParamConfigMetadata('fieldName', false, 2 /* Body */, 0 /* String */),
|
|
208
598
|
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
209
599
|
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
210
600
|
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
211
601
|
];
|
|
212
|
-
const
|
|
213
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
602
|
+
const validateFormula_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, validateFormula_ConfigPropertyMetadata);
|
|
603
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$3(validateFormula_ConfigPropertyMetadata);
|
|
214
604
|
function typeCheckConfig(untrustedConfig) {
|
|
215
605
|
const config = {};
|
|
216
|
-
typeCheckConfig$
|
|
606
|
+
typeCheckConfig$3(untrustedConfig, config, validateFormula_ConfigPropertyMetadata);
|
|
217
607
|
return config;
|
|
218
608
|
}
|
|
219
609
|
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
@@ -247,18 +637,20 @@ function buildNetworkSnapshot(luvio, config, options) {
|
|
|
247
637
|
throw response;
|
|
248
638
|
});
|
|
249
639
|
}
|
|
250
|
-
const
|
|
251
|
-
return function
|
|
252
|
-
const config = validateAdapterConfig(untrustedConfig,
|
|
640
|
+
const validateFormulaAdapterFactory = (luvio) => {
|
|
641
|
+
return function validateFormula(untrustedConfig) {
|
|
642
|
+
const config = validateAdapterConfig(untrustedConfig, validateFormula_ConfigPropertyNames);
|
|
253
643
|
// Invalid or incomplete config
|
|
254
644
|
if (config === null) {
|
|
255
|
-
throw new Error('Invalid config for "
|
|
645
|
+
throw new Error('Invalid config for "validateFormula"');
|
|
256
646
|
}
|
|
257
647
|
return buildNetworkSnapshot(luvio, config);
|
|
258
648
|
};
|
|
259
649
|
};
|
|
260
650
|
|
|
651
|
+
let fixFormula;
|
|
261
652
|
let getExplanation;
|
|
653
|
+
let validateFormula;
|
|
262
654
|
// Notify Update Available
|
|
263
655
|
function bindExportsTo(luvio) {
|
|
264
656
|
// LDS Adapters
|
|
@@ -267,14 +659,16 @@ function bindExportsTo(luvio) {
|
|
|
267
659
|
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
268
660
|
}
|
|
269
661
|
return {
|
|
662
|
+
fixFormula: unwrapSnapshotData(fixFormulaAdapterFactory),
|
|
270
663
|
getExplanation: unwrapSnapshotData(getExplanationAdapterFactory),
|
|
664
|
+
validateFormula: unwrapSnapshotData(validateFormulaAdapterFactory),
|
|
271
665
|
// Imperative GET Adapters
|
|
272
666
|
// Notify Update Availables
|
|
273
667
|
};
|
|
274
668
|
}
|
|
275
669
|
withDefaultLuvio((luvio) => {
|
|
276
|
-
({ getExplanation } = bindExportsTo(luvio));
|
|
670
|
+
({ fixFormula, getExplanation, validateFormula } = bindExportsTo(luvio));
|
|
277
671
|
});
|
|
278
672
|
|
|
279
|
-
export { getExplanation };
|
|
280
|
-
// version: 1.
|
|
673
|
+
export { fixFormula, getExplanation, validateFormula };
|
|
674
|
+
// version: 1.272.0-579ff1ba0
|
package/src/raml/api.raml
CHANGED
|
@@ -54,6 +54,50 @@ types:
|
|
|
54
54
|
- Percent
|
|
55
55
|
- Text
|
|
56
56
|
- Time
|
|
57
|
+
FixFormulaInputRepresentation:
|
|
58
|
+
description: The input representation for fixing a formula
|
|
59
|
+
type: object
|
|
60
|
+
properties:
|
|
61
|
+
entityName:
|
|
62
|
+
description: Entity Name from the formula builder
|
|
63
|
+
type: string
|
|
64
|
+
fieldName:
|
|
65
|
+
description: Field name if the formula is already saved
|
|
66
|
+
type: string
|
|
67
|
+
required: false
|
|
68
|
+
formula:
|
|
69
|
+
description: Formula which needs to be fixed
|
|
70
|
+
type: string
|
|
71
|
+
formulaType:
|
|
72
|
+
description: Formula Type
|
|
73
|
+
type: string
|
|
74
|
+
enum:
|
|
75
|
+
- CustomField
|
|
76
|
+
- DefaultValue
|
|
77
|
+
- Validation
|
|
78
|
+
returnType:
|
|
79
|
+
description: Return type of the formula
|
|
80
|
+
type: string
|
|
81
|
+
enum:
|
|
82
|
+
- Boolean
|
|
83
|
+
- Currency
|
|
84
|
+
- Date
|
|
85
|
+
- DateTime
|
|
86
|
+
- Number
|
|
87
|
+
- Percent
|
|
88
|
+
- Text
|
|
89
|
+
- Time
|
|
90
|
+
FixFormulaRepresentation:
|
|
91
|
+
description: Fix Formula
|
|
92
|
+
type: object
|
|
93
|
+
properties:
|
|
94
|
+
generationId:
|
|
95
|
+
description: Einstein generationId. If formula is valid, this should be null/empty
|
|
96
|
+
type: string
|
|
97
|
+
response:
|
|
98
|
+
description: Fixed formula if the formula is invalid. If formula is valid,
|
|
99
|
+
returns error response
|
|
100
|
+
type: string
|
|
57
101
|
FormulaExplanationRepresentation:
|
|
58
102
|
description: Formula Explanation
|
|
59
103
|
type: object
|
|
@@ -64,17 +108,92 @@ types:
|
|
|
64
108
|
generationId:
|
|
65
109
|
description: Generation ID of response from open ai
|
|
66
110
|
type: string
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
111
|
+
FormulaValidationInputRepresentation:
|
|
112
|
+
description: The input representation for validating a formula
|
|
113
|
+
type: object
|
|
114
|
+
properties:
|
|
115
|
+
entityName:
|
|
116
|
+
description: Entity Name from the formula builder
|
|
117
|
+
type: string
|
|
118
|
+
fieldName:
|
|
119
|
+
description: Field name if the formula is already saved
|
|
120
|
+
type: string
|
|
121
|
+
required: false
|
|
122
|
+
formula:
|
|
123
|
+
description: Formula which needs to be validated
|
|
124
|
+
type: string
|
|
125
|
+
formulaType:
|
|
126
|
+
description: Formula Type
|
|
127
|
+
type: string
|
|
128
|
+
enum:
|
|
129
|
+
- CustomField
|
|
130
|
+
- DefaultValue
|
|
131
|
+
- Validation
|
|
132
|
+
returnType:
|
|
133
|
+
description: Return type of the formula
|
|
134
|
+
type: string
|
|
135
|
+
enum:
|
|
136
|
+
- Boolean
|
|
137
|
+
- Currency
|
|
138
|
+
- Date
|
|
139
|
+
- DateTime
|
|
140
|
+
- Number
|
|
141
|
+
- Percent
|
|
142
|
+
- Text
|
|
143
|
+
- Time
|
|
144
|
+
FormulaValidationRepresentation:
|
|
145
|
+
description: Formula Validation
|
|
146
|
+
type: object
|
|
147
|
+
properties:
|
|
148
|
+
isFormulaValid:
|
|
149
|
+
description: Returns if the formula is valid
|
|
150
|
+
type: boolean
|
|
151
|
+
message:
|
|
152
|
+
description: Failure message if validation was unsuccessful. If validation
|
|
153
|
+
passes, this should be null/empty
|
|
154
|
+
type: string | nil
|
|
155
|
+
required: false
|
|
156
|
+
/connect/formula:
|
|
157
|
+
/einstein:
|
|
158
|
+
/explain:
|
|
159
|
+
post:
|
|
160
|
+
displayName: postFormulaExplanation
|
|
161
|
+
description: Gets explanation for a salesforce formula
|
|
162
|
+
responses:
|
|
163
|
+
'200':
|
|
164
|
+
description: Success
|
|
165
|
+
body:
|
|
166
|
+
application/json:
|
|
167
|
+
type: FormulaExplanationRepresentation
|
|
168
|
+
body:
|
|
169
|
+
application/json:
|
|
170
|
+
type: ExplainPromptInputRepresentation
|
|
171
|
+
(oas-body-name): formulaExplainInput
|
|
172
|
+
/fix:
|
|
173
|
+
post:
|
|
174
|
+
displayName: postFormulaFix
|
|
175
|
+
description: Fixes a Salesforce formula
|
|
176
|
+
responses:
|
|
177
|
+
'200':
|
|
178
|
+
description: Success
|
|
179
|
+
body:
|
|
180
|
+
application/json:
|
|
181
|
+
type: FixFormulaRepresentation
|
|
74
182
|
body:
|
|
75
183
|
application/json:
|
|
76
|
-
type:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
184
|
+
type: FixFormulaInputRepresentation
|
|
185
|
+
(oas-body-name): formulaFixInput
|
|
186
|
+
/validate:
|
|
187
|
+
post:
|
|
188
|
+
displayName: postFormulaValidation
|
|
189
|
+
description: Validates a Salesforce formula
|
|
190
|
+
responses:
|
|
191
|
+
'200':
|
|
192
|
+
description: Success
|
|
193
|
+
body:
|
|
194
|
+
application/json:
|
|
195
|
+
type: FormulaValidationRepresentation
|
|
196
|
+
body:
|
|
197
|
+
application/json:
|
|
198
|
+
type: FormulaValidationInputRepresentation
|
|
199
|
+
(oas-body-name): formulaValidateInput
|