@salesforce/lds-adapters-platform-formula 1.270.1 → 1.271.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 +236 -25
- package/dist/es/es2018/types/src/generated/adapters/validateFormula.d.ts +19 -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 -1
- package/dist/es/es2018/types/src/generated/resources/postConnectFormulaValidate.d.ts +16 -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 +240 -27
- package/src/raml/api.raml +74 -14
- package/src/raml/luvio.raml +13 -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$2, typeCheckConfig as typeCheckConfig$2 } 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$1 = 100;
|
|
75
|
+
const VERSION$1 = "c06ad095a0c68e00a7cf4b94f01f937b";
|
|
76
|
+
function validate$1(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$1 = 'FormulaExplanationRepresentation';
|
|
95
|
+
function keyBuilder$1(luvio, config) {
|
|
96
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.generationId;
|
|
97
97
|
}
|
|
98
|
-
function keyBuilderFromType(luvio, object) {
|
|
98
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
99
99
|
const keyParams = {
|
|
100
100
|
generationId: object.generationId
|
|
101
101
|
};
|
|
102
|
-
return keyBuilder(luvio, keyParams);
|
|
102
|
+
return keyBuilder$1(luvio, keyParams);
|
|
103
103
|
}
|
|
104
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
104
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
105
105
|
return input;
|
|
106
106
|
}
|
|
107
|
-
const select$
|
|
107
|
+
const select$3 = function FormulaExplanationRepresentationSelect() {
|
|
108
108
|
return {
|
|
109
109
|
kind: 'Fragment',
|
|
110
|
-
version: VERSION,
|
|
110
|
+
version: VERSION$1,
|
|
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$1(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,217 @@ 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$1 = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
138
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
139
|
+
const validateError = validate$1(input);
|
|
140
|
+
if (validateError !== null) {
|
|
141
|
+
throw validateError;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
145
|
+
const ttlToUse = TTL$1;
|
|
146
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Formula", VERSION$1, RepresentationType$1, equals$1);
|
|
147
|
+
return createLink(key);
|
|
148
|
+
};
|
|
149
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
150
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
151
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
152
|
+
rootKeySet.set(rootKey, {
|
|
153
|
+
namespace: keyPrefix,
|
|
154
|
+
representationName: RepresentationType$1,
|
|
155
|
+
mergeable: false
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function select$2(luvio, params) {
|
|
160
|
+
return select$3();
|
|
161
|
+
}
|
|
162
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
163
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
164
|
+
}
|
|
165
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
166
|
+
const { body } = response;
|
|
167
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
168
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
169
|
+
const snapshot = luvio.storeLookup({
|
|
170
|
+
recordId: key,
|
|
171
|
+
node: select$2(),
|
|
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$1(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$1 = '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$1, getExplanation_ConfigPropertyMetadata);
|
|
204
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getExplanation_ConfigPropertyMetadata);
|
|
205
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
206
|
+
const config = {};
|
|
207
|
+
typeCheckConfig$2(untrustedConfig, config, getExplanation_ConfigPropertyMetadata);
|
|
208
|
+
return config;
|
|
209
|
+
}
|
|
210
|
+
function validateAdapterConfig$1(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$1(untrustedConfig);
|
|
218
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
return config;
|
|
222
|
+
}
|
|
223
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
224
|
+
const resourceParams = createResourceParams$1(config);
|
|
225
|
+
const request = createResourceRequest$1(resourceParams);
|
|
226
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
227
|
+
.then((response) => {
|
|
228
|
+
return luvio.handleSuccessResponse(() => {
|
|
229
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
230
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
231
|
+
}, () => {
|
|
232
|
+
const cache = new StoreKeyMap();
|
|
233
|
+
getResponseCacheKeys$1(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$1(untrustedConfig, getExplanation_ConfigPropertyNames);
|
|
244
|
+
// Invalid or incomplete config
|
|
245
|
+
if (config === null) {
|
|
246
|
+
throw new Error('Invalid config for "getExplanation"');
|
|
247
|
+
}
|
|
248
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const TTL = 100;
|
|
253
|
+
const VERSION = "6fae0fe9f113df4590f7d92a6005ddeb";
|
|
254
|
+
function validate(obj, path = 'FormulaValidationRepresentation') {
|
|
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_isFormulaValid = obj.isFormulaValid;
|
|
260
|
+
const path_isFormulaValid = path + '.isFormulaValid';
|
|
261
|
+
if (typeof obj_isFormulaValid !== 'boolean') {
|
|
262
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isFormulaValid + '" (at "' + path_isFormulaValid + '")');
|
|
263
|
+
}
|
|
264
|
+
if (obj.message !== undefined) {
|
|
265
|
+
const obj_message = obj.message;
|
|
266
|
+
const path_message = path + '.message';
|
|
267
|
+
let obj_message_union0 = null;
|
|
268
|
+
const obj_message_union0_error = (() => {
|
|
269
|
+
if (typeof obj_message !== 'string') {
|
|
270
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
271
|
+
}
|
|
272
|
+
})();
|
|
273
|
+
if (obj_message_union0_error != null) {
|
|
274
|
+
obj_message_union0 = obj_message_union0_error.message;
|
|
275
|
+
}
|
|
276
|
+
let obj_message_union1 = null;
|
|
277
|
+
const obj_message_union1_error = (() => {
|
|
278
|
+
if (obj_message !== null) {
|
|
279
|
+
return new TypeError('Expected "null" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
280
|
+
}
|
|
281
|
+
})();
|
|
282
|
+
if (obj_message_union1_error != null) {
|
|
283
|
+
obj_message_union1 = obj_message_union1_error.message;
|
|
284
|
+
}
|
|
285
|
+
if (obj_message_union0 && obj_message_union1) {
|
|
286
|
+
let message = 'Object doesn\'t match union (at "' + path_message + '")';
|
|
287
|
+
message += '\n' + obj_message_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
288
|
+
message += '\n' + obj_message_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
289
|
+
return new TypeError(message);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
})();
|
|
293
|
+
return v_error === undefined ? null : v_error;
|
|
294
|
+
}
|
|
295
|
+
const RepresentationType = 'FormulaValidationRepresentation';
|
|
296
|
+
function keyBuilder(luvio, config) {
|
|
297
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isFormulaValid;
|
|
298
|
+
}
|
|
299
|
+
function keyBuilderFromType(luvio, object) {
|
|
300
|
+
const keyParams = {
|
|
301
|
+
isFormulaValid: object.isFormulaValid
|
|
302
|
+
};
|
|
303
|
+
return keyBuilder(luvio, keyParams);
|
|
304
|
+
}
|
|
305
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
306
|
+
return input;
|
|
307
|
+
}
|
|
308
|
+
const select$1 = function FormulaValidationRepresentationSelect() {
|
|
309
|
+
return {
|
|
310
|
+
kind: 'Fragment',
|
|
311
|
+
version: VERSION,
|
|
312
|
+
private: [],
|
|
313
|
+
selections: [
|
|
314
|
+
{
|
|
315
|
+
name: 'isFormulaValid',
|
|
316
|
+
kind: 'Scalar'
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
name: 'message',
|
|
320
|
+
kind: 'Scalar',
|
|
321
|
+
required: false
|
|
322
|
+
}
|
|
323
|
+
]
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
function equals(existing, incoming) {
|
|
327
|
+
const existing_isFormulaValid = existing.isFormulaValid;
|
|
328
|
+
const incoming_isFormulaValid = incoming.isFormulaValid;
|
|
329
|
+
if (!(existing_isFormulaValid === incoming_isFormulaValid)) {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
const existing_message = existing.message;
|
|
333
|
+
const incoming_message = incoming.message;
|
|
334
|
+
// if at least one of these optionals is defined
|
|
335
|
+
if (existing_message !== undefined || incoming_message !== undefined) {
|
|
336
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
337
|
+
// not equal
|
|
338
|
+
if (existing_message === undefined || incoming_message === undefined) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
if (!(existing_message === incoming_message)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
const ingest = function FormulaValidationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
138
348
|
if (process.env.NODE_ENV !== 'production') {
|
|
139
349
|
const validateError = validate(input);
|
|
140
350
|
if (validateError !== null) {
|
|
@@ -183,7 +393,7 @@ function createResourceRequest(config) {
|
|
|
183
393
|
const headers = {};
|
|
184
394
|
return {
|
|
185
395
|
baseUri: '/services/data/v61.0',
|
|
186
|
-
basePath: '/connect/formula/
|
|
396
|
+
basePath: '/connect/formula/validate',
|
|
187
397
|
method: 'post',
|
|
188
398
|
body: config.body,
|
|
189
399
|
urlParams: {},
|
|
@@ -193,18 +403,19 @@ function createResourceRequest(config) {
|
|
|
193
403
|
};
|
|
194
404
|
}
|
|
195
405
|
|
|
196
|
-
const adapterName = '
|
|
197
|
-
const
|
|
406
|
+
const adapterName = 'validateFormula';
|
|
407
|
+
const validateFormula_ConfigPropertyMetadata = [
|
|
198
408
|
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
409
|
+
generateParamConfigMetadata('fieldName', false, 2 /* Body */, 0 /* String */),
|
|
199
410
|
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
200
411
|
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
201
412
|
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
202
413
|
];
|
|
203
|
-
const
|
|
204
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
414
|
+
const validateFormula_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, validateFormula_ConfigPropertyMetadata);
|
|
415
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$2(validateFormula_ConfigPropertyMetadata);
|
|
205
416
|
function typeCheckConfig(untrustedConfig) {
|
|
206
417
|
const config = {};
|
|
207
|
-
typeCheckConfig$
|
|
418
|
+
typeCheckConfig$2(untrustedConfig, config, validateFormula_ConfigPropertyMetadata);
|
|
208
419
|
return config;
|
|
209
420
|
}
|
|
210
421
|
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
@@ -238,15 +449,15 @@ function buildNetworkSnapshot(luvio, config, options) {
|
|
|
238
449
|
throw response;
|
|
239
450
|
});
|
|
240
451
|
}
|
|
241
|
-
const
|
|
242
|
-
return function
|
|
243
|
-
const config = validateAdapterConfig(untrustedConfig,
|
|
452
|
+
const validateFormulaAdapterFactory = (luvio) => {
|
|
453
|
+
return function validateFormula(untrustedConfig) {
|
|
454
|
+
const config = validateAdapterConfig(untrustedConfig, validateFormula_ConfigPropertyNames);
|
|
244
455
|
// Invalid or incomplete config
|
|
245
456
|
if (config === null) {
|
|
246
|
-
throw new Error('Invalid config for "
|
|
457
|
+
throw new Error('Invalid config for "validateFormula"');
|
|
247
458
|
}
|
|
248
459
|
return buildNetworkSnapshot(luvio, config);
|
|
249
460
|
};
|
|
250
461
|
};
|
|
251
462
|
|
|
252
|
-
export { getExplanationAdapterFactory };
|
|
463
|
+
export { 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_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 { 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 = "f95f5caef5f98eab47c21c9e1035768b";
|
|
3
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
4
|
+
export declare const RepresentationType: string;
|
|
5
|
+
export declare function normalize(input: FormulaValidationInputRepresentation, existing: FormulaValidationInputRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): FormulaValidationInputRepresentationNormalized;
|
|
6
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
7
|
+
export declare function equals(existing: FormulaValidationInputRepresentationNormalized, incoming: FormulaValidationInputRepresentationNormalized): 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: FormulaValidationInputRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
10
|
+
/**
|
|
11
|
+
* The input representation for validating a formula
|
|
12
|
+
*
|
|
13
|
+
* Keys:
|
|
14
|
+
* (none)
|
|
15
|
+
*/
|
|
16
|
+
export interface FormulaValidationInputRepresentationNormalized {
|
|
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 validated */
|
|
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 validating a formula
|
|
30
|
+
*
|
|
31
|
+
* Keys:
|
|
32
|
+
* (none)
|
|
33
|
+
*/
|
|
34
|
+
export interface FormulaValidationInputRepresentation {
|
|
35
|
+
entityName: string;
|
|
36
|
+
fieldName?: string;
|
|
37
|
+
formula: string;
|
|
38
|
+
formulaType: string;
|
|
39
|
+
returnType: string;
|
|
40
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { KeyMetadata as $64$luvio_engine_KeyMetadata, NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata, Luvio as $64$luvio_engine_Luvio, IngestPath as $64$luvio_engine_IngestPath, Store as $64$luvio_engine_Store, FragmentSelection as $64$luvio_engine_FragmentSelection, ResourceIngest as $64$luvio_engine_ResourceIngest, DurableStoreKeyMetadataMap as $64$luvio_engine_DurableStoreKeyMetadataMap } from '@luvio/engine';
|
|
2
|
+
export declare const TTL = 100;
|
|
3
|
+
export declare const VERSION = "6fae0fe9f113df4590f7d92a6005ddeb";
|
|
4
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
5
|
+
export declare const RepresentationType: string;
|
|
6
|
+
export interface KeyParams extends $64$luvio_engine_KeyMetadata {
|
|
7
|
+
isFormulaValid: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type FormulaValidationRepresentationNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
|
|
10
|
+
export type PartialFormulaValidationRepresentationNormalizedKeyMetadata = Partial<KeyParams> & $64$luvio_engine_NormalizedKeyMetadata;
|
|
11
|
+
export declare function keyBuilder(luvio: $64$luvio_engine_Luvio, config: KeyParams): string;
|
|
12
|
+
export declare function keyBuilder_StructuredKey(luvio: $64$luvio_engine_Luvio, config: KeyParams): FormulaValidationRepresentationNormalizedKeyMetadata;
|
|
13
|
+
export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: FormulaValidationRepresentation): string;
|
|
14
|
+
export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: FormulaValidationRepresentation): $64$luvio_engine_NormalizedKeyMetadata;
|
|
15
|
+
export declare function normalize(input: FormulaValidationRepresentation, existing: FormulaValidationRepresentationNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): FormulaValidationRepresentationNormalized;
|
|
16
|
+
export declare const select: () => $64$luvio_engine_FragmentSelection;
|
|
17
|
+
export declare function equals(existing: FormulaValidationRepresentationNormalized, incoming: FormulaValidationRepresentationNormalized): boolean;
|
|
18
|
+
export declare const ingest: $64$luvio_engine_ResourceIngest;
|
|
19
|
+
export declare function getTypeCacheKeys(rootKeySet: $64$luvio_engine_DurableStoreKeyMetadataMap, luvio: $64$luvio_engine_Luvio, input: FormulaValidationRepresentation, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
20
|
+
/**
|
|
21
|
+
* Formula Validation
|
|
22
|
+
*
|
|
23
|
+
* Keys:
|
|
24
|
+
* isFormulaValid (boolean): isFormulaValid
|
|
25
|
+
*/
|
|
26
|
+
export interface FormulaValidationRepresentationNormalized {
|
|
27
|
+
/** Returns if the formula is valid */
|
|
28
|
+
isFormulaValid: boolean;
|
|
29
|
+
/** Failure message if validation was unsuccessful. If validation passes, this should be null/empty */
|
|
30
|
+
message?: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Formula Validation
|
|
34
|
+
*
|
|
35
|
+
* Keys:
|
|
36
|
+
* isFormulaValid (boolean): isFormulaValid
|
|
37
|
+
*/
|
|
38
|
+
export interface FormulaValidationRepresentation {
|
|
39
|
+
isFormulaValid: boolean;
|
|
40
|
+
message?: string | null;
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/lds-adapters-platform-formula",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.271.0",
|
|
4
4
|
"description": "APIs related to core Salesforce Formulas",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"main": "dist/es/es2018/platform-formula.js",
|
|
@@ -40,11 +40,11 @@
|
|
|
40
40
|
"test:unit": "jest"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@salesforce/lds-bindings": "^1.
|
|
43
|
+
"@salesforce/lds-bindings": "^1.271.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@salesforce/lds-compiler-plugins": "^1.
|
|
47
|
-
"@salesforce/lds-karma": "^1.
|
|
46
|
+
"@salesforce/lds-compiler-plugins": "^1.271.0",
|
|
47
|
+
"@salesforce/lds-karma": "^1.271.0"
|
|
48
48
|
},
|
|
49
49
|
"nx": {
|
|
50
50
|
"targets": {
|
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$2, typeCheckConfig as typeCheckConfig$2 } from 'force/luvioEngine';
|
|
17
17
|
|
|
18
18
|
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
19
19
|
const { keys: ObjectKeys, create: ObjectCreate } = Object;
|
|
@@ -80,9 +80,9 @@ function createLink(ref) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
const TTL = 100;
|
|
84
|
-
const VERSION = "c06ad095a0c68e00a7cf4b94f01f937b";
|
|
85
|
-
function validate(obj, path = 'FormulaExplanationRepresentation') {
|
|
83
|
+
const TTL$1 = 100;
|
|
84
|
+
const VERSION$1 = "c06ad095a0c68e00a7cf4b94f01f937b";
|
|
85
|
+
function validate$1(obj, path = 'FormulaExplanationRepresentation') {
|
|
86
86
|
const v_error = (() => {
|
|
87
87
|
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
88
88
|
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
@@ -100,23 +100,23 @@ function validate(obj, path = 'FormulaExplanationRepresentation') {
|
|
|
100
100
|
})();
|
|
101
101
|
return v_error === undefined ? null : v_error;
|
|
102
102
|
}
|
|
103
|
-
const RepresentationType = 'FormulaExplanationRepresentation';
|
|
104
|
-
function keyBuilder(luvio, config) {
|
|
105
|
-
return keyPrefix + '::' + RepresentationType + ':' + config.generationId;
|
|
103
|
+
const RepresentationType$1 = 'FormulaExplanationRepresentation';
|
|
104
|
+
function keyBuilder$1(luvio, config) {
|
|
105
|
+
return keyPrefix + '::' + RepresentationType$1 + ':' + config.generationId;
|
|
106
106
|
}
|
|
107
|
-
function keyBuilderFromType(luvio, object) {
|
|
107
|
+
function keyBuilderFromType$1(luvio, object) {
|
|
108
108
|
const keyParams = {
|
|
109
109
|
generationId: object.generationId
|
|
110
110
|
};
|
|
111
|
-
return keyBuilder(luvio, keyParams);
|
|
111
|
+
return keyBuilder$1(luvio, keyParams);
|
|
112
112
|
}
|
|
113
|
-
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
113
|
+
function normalize$1(input, existing, path, luvio, store, timestamp) {
|
|
114
114
|
return input;
|
|
115
115
|
}
|
|
116
|
-
const select$
|
|
116
|
+
const select$3 = function FormulaExplanationRepresentationSelect() {
|
|
117
117
|
return {
|
|
118
118
|
kind: 'Fragment',
|
|
119
|
-
version: VERSION,
|
|
119
|
+
version: VERSION$1,
|
|
120
120
|
private: [],
|
|
121
121
|
selections: [
|
|
122
122
|
{
|
|
@@ -130,7 +130,7 @@ const select$1 = function FormulaExplanationRepresentationSelect() {
|
|
|
130
130
|
]
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
|
-
function equals(existing, incoming) {
|
|
133
|
+
function equals$1(existing, incoming) {
|
|
134
134
|
const existing_explanation = existing.explanation;
|
|
135
135
|
const incoming_explanation = incoming.explanation;
|
|
136
136
|
if (!(existing_explanation === incoming_explanation)) {
|
|
@@ -143,7 +143,217 @@ function equals(existing, incoming) {
|
|
|
143
143
|
}
|
|
144
144
|
return true;
|
|
145
145
|
}
|
|
146
|
-
const ingest = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
146
|
+
const ingest$1 = function FormulaExplanationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
147
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
148
|
+
const validateError = validate$1(input);
|
|
149
|
+
if (validateError !== null) {
|
|
150
|
+
throw validateError;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const key = keyBuilderFromType$1(luvio, input);
|
|
154
|
+
const ttlToUse = TTL$1;
|
|
155
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize$1, "Formula", VERSION$1, RepresentationType$1, equals$1);
|
|
156
|
+
return createLink(key);
|
|
157
|
+
};
|
|
158
|
+
function getTypeCacheKeys$1(rootKeySet, luvio, input, fullPathFactory) {
|
|
159
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
160
|
+
const rootKey = keyBuilderFromType$1(luvio, input);
|
|
161
|
+
rootKeySet.set(rootKey, {
|
|
162
|
+
namespace: keyPrefix,
|
|
163
|
+
representationName: RepresentationType$1,
|
|
164
|
+
mergeable: false
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function select$2(luvio, params) {
|
|
169
|
+
return select$3();
|
|
170
|
+
}
|
|
171
|
+
function getResponseCacheKeys$1(storeKeyMap, luvio, resourceParams, response) {
|
|
172
|
+
getTypeCacheKeys$1(storeKeyMap, luvio, response);
|
|
173
|
+
}
|
|
174
|
+
function ingestSuccess$1(luvio, resourceParams, response) {
|
|
175
|
+
const { body } = response;
|
|
176
|
+
const key = keyBuilderFromType$1(luvio, body);
|
|
177
|
+
luvio.storeIngest(key, ingest$1, body);
|
|
178
|
+
const snapshot = luvio.storeLookup({
|
|
179
|
+
recordId: key,
|
|
180
|
+
node: select$2(),
|
|
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$1(config) {
|
|
192
|
+
const headers = {};
|
|
193
|
+
return {
|
|
194
|
+
baseUri: '/services/data/v61.0',
|
|
195
|
+
basePath: '/connect/formula/einstein/explain',
|
|
196
|
+
method: 'post',
|
|
197
|
+
body: config.body,
|
|
198
|
+
urlParams: {},
|
|
199
|
+
queryParams: {},
|
|
200
|
+
headers,
|
|
201
|
+
priority: 'normal',
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const adapterName$1 = 'getExplanation';
|
|
206
|
+
const getExplanation_ConfigPropertyMetadata = [
|
|
207
|
+
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
208
|
+
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
209
|
+
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
210
|
+
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
211
|
+
];
|
|
212
|
+
const getExplanation_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName$1, getExplanation_ConfigPropertyMetadata);
|
|
213
|
+
const createResourceParams$1 = /*#__PURE__*/ createResourceParams$2(getExplanation_ConfigPropertyMetadata);
|
|
214
|
+
function typeCheckConfig$1(untrustedConfig) {
|
|
215
|
+
const config = {};
|
|
216
|
+
typeCheckConfig$2(untrustedConfig, config, getExplanation_ConfigPropertyMetadata);
|
|
217
|
+
return config;
|
|
218
|
+
}
|
|
219
|
+
function validateAdapterConfig$1(untrustedConfig, configPropertyNames) {
|
|
220
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
224
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
225
|
+
}
|
|
226
|
+
const config = typeCheckConfig$1(untrustedConfig);
|
|
227
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return config;
|
|
231
|
+
}
|
|
232
|
+
function buildNetworkSnapshot$1(luvio, config, options) {
|
|
233
|
+
const resourceParams = createResourceParams$1(config);
|
|
234
|
+
const request = createResourceRequest$1(resourceParams);
|
|
235
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
236
|
+
.then((response) => {
|
|
237
|
+
return luvio.handleSuccessResponse(() => {
|
|
238
|
+
const snapshot = ingestSuccess$1(luvio, resourceParams, response);
|
|
239
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
240
|
+
}, () => {
|
|
241
|
+
const cache = new StoreKeyMap();
|
|
242
|
+
getResponseCacheKeys$1(cache, luvio, resourceParams, response.body);
|
|
243
|
+
return cache;
|
|
244
|
+
});
|
|
245
|
+
}, (response) => {
|
|
246
|
+
deepFreeze(response);
|
|
247
|
+
throw response;
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
const getExplanationAdapterFactory = (luvio) => {
|
|
251
|
+
return function getExplanation(untrustedConfig) {
|
|
252
|
+
const config = validateAdapterConfig$1(untrustedConfig, getExplanation_ConfigPropertyNames);
|
|
253
|
+
// Invalid or incomplete config
|
|
254
|
+
if (config === null) {
|
|
255
|
+
throw new Error('Invalid config for "getExplanation"');
|
|
256
|
+
}
|
|
257
|
+
return buildNetworkSnapshot$1(luvio, config);
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
const TTL = 100;
|
|
262
|
+
const VERSION = "6fae0fe9f113df4590f7d92a6005ddeb";
|
|
263
|
+
function validate(obj, path = 'FormulaValidationRepresentation') {
|
|
264
|
+
const v_error = (() => {
|
|
265
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
266
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
267
|
+
}
|
|
268
|
+
const obj_isFormulaValid = obj.isFormulaValid;
|
|
269
|
+
const path_isFormulaValid = path + '.isFormulaValid';
|
|
270
|
+
if (typeof obj_isFormulaValid !== 'boolean') {
|
|
271
|
+
return new TypeError('Expected "boolean" but received "' + typeof obj_isFormulaValid + '" (at "' + path_isFormulaValid + '")');
|
|
272
|
+
}
|
|
273
|
+
if (obj.message !== undefined) {
|
|
274
|
+
const obj_message = obj.message;
|
|
275
|
+
const path_message = path + '.message';
|
|
276
|
+
let obj_message_union0 = null;
|
|
277
|
+
const obj_message_union0_error = (() => {
|
|
278
|
+
if (typeof obj_message !== 'string') {
|
|
279
|
+
return new TypeError('Expected "string" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
280
|
+
}
|
|
281
|
+
})();
|
|
282
|
+
if (obj_message_union0_error != null) {
|
|
283
|
+
obj_message_union0 = obj_message_union0_error.message;
|
|
284
|
+
}
|
|
285
|
+
let obj_message_union1 = null;
|
|
286
|
+
const obj_message_union1_error = (() => {
|
|
287
|
+
if (obj_message !== null) {
|
|
288
|
+
return new TypeError('Expected "null" but received "' + typeof obj_message + '" (at "' + path_message + '")');
|
|
289
|
+
}
|
|
290
|
+
})();
|
|
291
|
+
if (obj_message_union1_error != null) {
|
|
292
|
+
obj_message_union1 = obj_message_union1_error.message;
|
|
293
|
+
}
|
|
294
|
+
if (obj_message_union0 && obj_message_union1) {
|
|
295
|
+
let message = 'Object doesn\'t match union (at "' + path_message + '")';
|
|
296
|
+
message += '\n' + obj_message_union0.split('\n').map((line) => '\t' + line).join('\n');
|
|
297
|
+
message += '\n' + obj_message_union1.split('\n').map((line) => '\t' + line).join('\n');
|
|
298
|
+
return new TypeError(message);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
})();
|
|
302
|
+
return v_error === undefined ? null : v_error;
|
|
303
|
+
}
|
|
304
|
+
const RepresentationType = 'FormulaValidationRepresentation';
|
|
305
|
+
function keyBuilder(luvio, config) {
|
|
306
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.isFormulaValid;
|
|
307
|
+
}
|
|
308
|
+
function keyBuilderFromType(luvio, object) {
|
|
309
|
+
const keyParams = {
|
|
310
|
+
isFormulaValid: object.isFormulaValid
|
|
311
|
+
};
|
|
312
|
+
return keyBuilder(luvio, keyParams);
|
|
313
|
+
}
|
|
314
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
315
|
+
return input;
|
|
316
|
+
}
|
|
317
|
+
const select$1 = function FormulaValidationRepresentationSelect() {
|
|
318
|
+
return {
|
|
319
|
+
kind: 'Fragment',
|
|
320
|
+
version: VERSION,
|
|
321
|
+
private: [],
|
|
322
|
+
selections: [
|
|
323
|
+
{
|
|
324
|
+
name: 'isFormulaValid',
|
|
325
|
+
kind: 'Scalar'
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: 'message',
|
|
329
|
+
kind: 'Scalar',
|
|
330
|
+
required: false
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
function equals(existing, incoming) {
|
|
336
|
+
const existing_isFormulaValid = existing.isFormulaValid;
|
|
337
|
+
const incoming_isFormulaValid = incoming.isFormulaValid;
|
|
338
|
+
if (!(existing_isFormulaValid === incoming_isFormulaValid)) {
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
const existing_message = existing.message;
|
|
342
|
+
const incoming_message = incoming.message;
|
|
343
|
+
// if at least one of these optionals is defined
|
|
344
|
+
if (existing_message !== undefined || incoming_message !== undefined) {
|
|
345
|
+
// if one of these is not defined we know the other is defined and therefore
|
|
346
|
+
// not equal
|
|
347
|
+
if (existing_message === undefined || incoming_message === undefined) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
if (!(existing_message === incoming_message)) {
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
const ingest = function FormulaValidationRepresentationIngest(input, path, luvio, store, timestamp) {
|
|
147
357
|
if (process.env.NODE_ENV !== 'production') {
|
|
148
358
|
const validateError = validate(input);
|
|
149
359
|
if (validateError !== null) {
|
|
@@ -192,7 +402,7 @@ function createResourceRequest(config) {
|
|
|
192
402
|
const headers = {};
|
|
193
403
|
return {
|
|
194
404
|
baseUri: '/services/data/v61.0',
|
|
195
|
-
basePath: '/connect/formula/
|
|
405
|
+
basePath: '/connect/formula/validate',
|
|
196
406
|
method: 'post',
|
|
197
407
|
body: config.body,
|
|
198
408
|
urlParams: {},
|
|
@@ -202,18 +412,19 @@ function createResourceRequest(config) {
|
|
|
202
412
|
};
|
|
203
413
|
}
|
|
204
414
|
|
|
205
|
-
const adapterName = '
|
|
206
|
-
const
|
|
415
|
+
const adapterName = 'validateFormula';
|
|
416
|
+
const validateFormula_ConfigPropertyMetadata = [
|
|
207
417
|
generateParamConfigMetadata('entityName', true, 2 /* Body */, 0 /* String */),
|
|
418
|
+
generateParamConfigMetadata('fieldName', false, 2 /* Body */, 0 /* String */),
|
|
208
419
|
generateParamConfigMetadata('formula', true, 2 /* Body */, 0 /* String */),
|
|
209
420
|
generateParamConfigMetadata('formulaType', true, 2 /* Body */, 0 /* String */),
|
|
210
421
|
generateParamConfigMetadata('returnType', true, 2 /* Body */, 0 /* String */),
|
|
211
422
|
];
|
|
212
|
-
const
|
|
213
|
-
const createResourceParams = /*#__PURE__*/ createResourceParams$
|
|
423
|
+
const validateFormula_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, validateFormula_ConfigPropertyMetadata);
|
|
424
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$2(validateFormula_ConfigPropertyMetadata);
|
|
214
425
|
function typeCheckConfig(untrustedConfig) {
|
|
215
426
|
const config = {};
|
|
216
|
-
typeCheckConfig$
|
|
427
|
+
typeCheckConfig$2(untrustedConfig, config, validateFormula_ConfigPropertyMetadata);
|
|
217
428
|
return config;
|
|
218
429
|
}
|
|
219
430
|
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
@@ -247,18 +458,19 @@ function buildNetworkSnapshot(luvio, config, options) {
|
|
|
247
458
|
throw response;
|
|
248
459
|
});
|
|
249
460
|
}
|
|
250
|
-
const
|
|
251
|
-
return function
|
|
252
|
-
const config = validateAdapterConfig(untrustedConfig,
|
|
461
|
+
const validateFormulaAdapterFactory = (luvio) => {
|
|
462
|
+
return function validateFormula(untrustedConfig) {
|
|
463
|
+
const config = validateAdapterConfig(untrustedConfig, validateFormula_ConfigPropertyNames);
|
|
253
464
|
// Invalid or incomplete config
|
|
254
465
|
if (config === null) {
|
|
255
|
-
throw new Error('Invalid config for "
|
|
466
|
+
throw new Error('Invalid config for "validateFormula"');
|
|
256
467
|
}
|
|
257
468
|
return buildNetworkSnapshot(luvio, config);
|
|
258
469
|
};
|
|
259
470
|
};
|
|
260
471
|
|
|
261
472
|
let getExplanation;
|
|
473
|
+
let validateFormula;
|
|
262
474
|
// Notify Update Available
|
|
263
475
|
function bindExportsTo(luvio) {
|
|
264
476
|
// LDS Adapters
|
|
@@ -268,13 +480,14 @@ function bindExportsTo(luvio) {
|
|
|
268
480
|
}
|
|
269
481
|
return {
|
|
270
482
|
getExplanation: unwrapSnapshotData(getExplanationAdapterFactory),
|
|
483
|
+
validateFormula: unwrapSnapshotData(validateFormulaAdapterFactory),
|
|
271
484
|
// Imperative GET Adapters
|
|
272
485
|
// Notify Update Availables
|
|
273
486
|
};
|
|
274
487
|
}
|
|
275
488
|
withDefaultLuvio((luvio) => {
|
|
276
|
-
({ getExplanation } = bindExportsTo(luvio));
|
|
489
|
+
({ getExplanation, validateFormula } = bindExportsTo(luvio));
|
|
277
490
|
});
|
|
278
491
|
|
|
279
|
-
export { getExplanation };
|
|
280
|
-
// version: 1.
|
|
492
|
+
export { getExplanation, validateFormula };
|
|
493
|
+
// version: 1.271.0-c2f810db8
|
package/src/raml/api.raml
CHANGED
|
@@ -64,17 +64,77 @@ types:
|
|
|
64
64
|
generationId:
|
|
65
65
|
description: Generation ID of response from open ai
|
|
66
66
|
type: string
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
67
|
+
FormulaValidationInputRepresentation:
|
|
68
|
+
description: The input representation for validating a formula
|
|
69
|
+
type: object
|
|
70
|
+
properties:
|
|
71
|
+
entityName:
|
|
72
|
+
description: Entity Name from the formula builder
|
|
73
|
+
type: string
|
|
74
|
+
fieldName:
|
|
75
|
+
description: Field name if the formula is already saved
|
|
76
|
+
type: string
|
|
77
|
+
required: false
|
|
78
|
+
formula:
|
|
79
|
+
description: Formula which needs to be validated
|
|
80
|
+
type: string
|
|
81
|
+
formulaType:
|
|
82
|
+
description: Formula Type
|
|
83
|
+
type: string
|
|
84
|
+
enum:
|
|
85
|
+
- CustomField
|
|
86
|
+
- DefaultValue
|
|
87
|
+
- Validation
|
|
88
|
+
returnType:
|
|
89
|
+
description: Return type of the formula
|
|
90
|
+
type: string
|
|
91
|
+
enum:
|
|
92
|
+
- Boolean
|
|
93
|
+
- Currency
|
|
94
|
+
- Date
|
|
95
|
+
- DateTime
|
|
96
|
+
- Number
|
|
97
|
+
- Percent
|
|
98
|
+
- Text
|
|
99
|
+
- Time
|
|
100
|
+
FormulaValidationRepresentation:
|
|
101
|
+
description: Formula Validation
|
|
102
|
+
type: object
|
|
103
|
+
properties:
|
|
104
|
+
isFormulaValid:
|
|
105
|
+
description: Returns if the formula is valid
|
|
106
|
+
type: boolean
|
|
107
|
+
message:
|
|
108
|
+
description: Failure message if validation was unsuccessful. If validation
|
|
109
|
+
passes, this should be null/empty
|
|
110
|
+
type: string | nil
|
|
111
|
+
required: false
|
|
112
|
+
/connect/formula:
|
|
113
|
+
/einstein/explain:
|
|
114
|
+
post:
|
|
115
|
+
displayName: postFormulaExplanation
|
|
116
|
+
description: Gets explanation for a salesforce formula
|
|
117
|
+
responses:
|
|
118
|
+
'200':
|
|
119
|
+
description: Success
|
|
120
|
+
body:
|
|
121
|
+
application/json:
|
|
122
|
+
type: FormulaExplanationRepresentation
|
|
123
|
+
body:
|
|
124
|
+
application/json:
|
|
125
|
+
type: ExplainPromptInputRepresentation
|
|
126
|
+
(oas-body-name): formulaExplainInput
|
|
127
|
+
/validate:
|
|
128
|
+
post:
|
|
129
|
+
displayName: postFormulaValidation
|
|
130
|
+
description: Validates a Salesforce formula
|
|
131
|
+
responses:
|
|
132
|
+
'200':
|
|
133
|
+
description: Success
|
|
134
|
+
body:
|
|
135
|
+
application/json:
|
|
136
|
+
type: FormulaValidationRepresentation
|
|
137
|
+
body:
|
|
138
|
+
application/json:
|
|
139
|
+
type: FormulaValidationInputRepresentation
|
|
140
|
+
(oas-body-name): formulaValidateInput
|
package/src/raml/luvio.raml
CHANGED
|
@@ -12,8 +12,17 @@ types:
|
|
|
12
12
|
(luvio.ttl): 100
|
|
13
13
|
(luvio.key):
|
|
14
14
|
generationId: generationId
|
|
15
|
+
FormulaValidationRepresentation:
|
|
16
|
+
(luvio.ttl): 100
|
|
17
|
+
(luvio.key):
|
|
18
|
+
isFormulaValid: isFormulaValid
|
|
15
19
|
|
|
16
|
-
/connect/formula
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
/connect/formula:
|
|
21
|
+
/einstein/explain:
|
|
22
|
+
post:
|
|
23
|
+
(luvio.adapter):
|
|
24
|
+
name: getExplanation
|
|
25
|
+
/validate:
|
|
26
|
+
post:
|
|
27
|
+
(luvio.adapter):
|
|
28
|
+
name: validateFormula
|