@salesforce/lds-adapters-cdp-semantic-engine 0.1.0-dev1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +82 -0
- package/dist/es/es2018/cdp-semantic-engine.js +292 -0
- package/dist/es/es2018/types/src/generated/adapters/adapter-utils.d.ts +62 -0
- package/dist/es/es2018/types/src/generated/adapters/executeSemanticQuery.d.ts +25 -0
- package/dist/es/es2018/types/src/generated/artifacts/main.d.ts +1 -0
- package/dist/es/es2018/types/src/generated/artifacts/sfdc.d.ts +2 -0
- package/dist/es/es2018/types/src/generated/resources/getSsotSemanticModelsFormulaMetadata.d.ts +12 -0
- package/dist/es/es2018/types/src/generated/resources/postSemanticEngineGateway.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/resources/postSemanticEngineGatewayNonInteractive.d.ts +22 -0
- package/dist/es/es2018/types/src/generated/types/FormulaMetadataRepresentation.d.ts +37 -0
- package/dist/es/es2018/types/src/generated/types/SemanticFormulaMetadataAuthoringResponseRepresentation.d.ts +29 -0
- package/dist/es/es2018/types/src/generated/types/SemanticQueryRequest.d.ts +56 -0
- package/dist/es/es2018/types/src/generated/types/SemanticQueryResponse.d.ts +54 -0
- package/dist/es/es2018/types/src/generated/types/type-utils.d.ts +32 -0
- package/package.json +66 -0
- package/sfdc/index.d.ts +1 -0
- package/sfdc/index.js +320 -0
- package/src/raml/api.raml +170 -0
- package/src/raml/luvio.raml +24 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IngestPath as $64$luvio_engine_IngestPath, Luvio as $64$luvio_engine_Luvio, Store as $64$luvio_engine_Store, BaseFragment as $64$luvio_engine_BaseFragment, 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 = "4d4e0328a11335c03be11e496d93aee6";
|
|
3
|
+
export declare function validate(obj: any, path?: string): TypeError | null;
|
|
4
|
+
export declare const RepresentationType: string;
|
|
5
|
+
export declare function normalize(input: SemanticQueryRequest, existing: SemanticQueryRequestNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): SemanticQueryRequestNormalized;
|
|
6
|
+
export declare const select: () => $64$luvio_engine_BaseFragment;
|
|
7
|
+
export declare function equals(existing: SemanticQueryRequestNormalized, incoming: SemanticQueryRequestNormalized): 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: SemanticQueryRequest, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
10
|
+
/**
|
|
11
|
+
* Input representation for creating Semantic Query
|
|
12
|
+
*
|
|
13
|
+
* Keys:
|
|
14
|
+
* (none)
|
|
15
|
+
*/
|
|
16
|
+
export interface SemanticQueryRequestNormalized {
|
|
17
|
+
/** caching Level Request */
|
|
18
|
+
cachingLevelRequest?: string;
|
|
19
|
+
/** context */
|
|
20
|
+
context?: {
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
/** Data space */
|
|
24
|
+
dataspace: string;
|
|
25
|
+
/** Group id */
|
|
26
|
+
groupId?: string;
|
|
27
|
+
/** Set SemanticModel */
|
|
28
|
+
semanticModel?: unknown;
|
|
29
|
+
/** Set semanticModelApiName */
|
|
30
|
+
semanticModelApiName?: string;
|
|
31
|
+
/** Set SemanticModelId */
|
|
32
|
+
semanticModelId?: string;
|
|
33
|
+
/** source */
|
|
34
|
+
source: string;
|
|
35
|
+
/** structuredSemanticQuery */
|
|
36
|
+
structuredSemanticQuery: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Input representation for creating Semantic Query
|
|
40
|
+
*
|
|
41
|
+
* Keys:
|
|
42
|
+
* (none)
|
|
43
|
+
*/
|
|
44
|
+
export interface SemanticQueryRequest {
|
|
45
|
+
cachingLevelRequest?: string;
|
|
46
|
+
context?: {
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
dataspace: string;
|
|
50
|
+
groupId?: string;
|
|
51
|
+
semanticModel?: unknown;
|
|
52
|
+
semanticModelApiName?: string;
|
|
53
|
+
semanticModelId?: string;
|
|
54
|
+
source: string;
|
|
55
|
+
structuredSemanticQuery: unknown;
|
|
56
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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, BaseFragment as $64$luvio_engine_BaseFragment, 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 = "c38fccbb9e02dc3907378c42bce24d36";
|
|
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
|
+
status: string;
|
|
8
|
+
}
|
|
9
|
+
export type SemanticQueryResponseNormalizedKeyMetadata = KeyParams & $64$luvio_engine_NormalizedKeyMetadata;
|
|
10
|
+
export type PartialSemanticQueryResponseNormalizedKeyMetadata = 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): SemanticQueryResponseNormalizedKeyMetadata;
|
|
13
|
+
export declare function keyBuilderFromType(luvio: $64$luvio_engine_Luvio, object: SemanticQueryResponse): string;
|
|
14
|
+
export declare function keyBuilderFromType_StructuredKey(luvio: $64$luvio_engine_Luvio, object: SemanticQueryResponse): $64$luvio_engine_NormalizedKeyMetadata;
|
|
15
|
+
export declare function normalize(input: SemanticQueryResponse, existing: SemanticQueryResponseNormalized, path: $64$luvio_engine_IngestPath, luvio: $64$luvio_engine_Luvio, store: $64$luvio_engine_Store, timestamp: number): SemanticQueryResponseNormalized;
|
|
16
|
+
export declare const select: () => $64$luvio_engine_BaseFragment;
|
|
17
|
+
export declare function equals(existing: SemanticQueryResponseNormalized, incoming: SemanticQueryResponseNormalized): 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: SemanticQueryResponse, fullPathFactory: () => string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
20
|
+
/**
|
|
21
|
+
* Represents Semantic Engine query output
|
|
22
|
+
*
|
|
23
|
+
* Keys:
|
|
24
|
+
* status (string): status
|
|
25
|
+
*/
|
|
26
|
+
export interface SemanticQueryResponseNormalized {
|
|
27
|
+
/** cacheLevel */
|
|
28
|
+
cacheLevel?: string;
|
|
29
|
+
/** context */
|
|
30
|
+
context?: {
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
/** Error message */
|
|
34
|
+
errorMessage?: string;
|
|
35
|
+
/** Query Results */
|
|
36
|
+
queryResults: unknown;
|
|
37
|
+
/** Status ENUM */
|
|
38
|
+
status: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Represents Semantic Engine query output
|
|
42
|
+
*
|
|
43
|
+
* Keys:
|
|
44
|
+
* status (string): status
|
|
45
|
+
*/
|
|
46
|
+
export interface SemanticQueryResponse {
|
|
47
|
+
cacheLevel?: string;
|
|
48
|
+
context?: {
|
|
49
|
+
[key: string]: unknown;
|
|
50
|
+
};
|
|
51
|
+
errorMessage?: string;
|
|
52
|
+
queryResults: unknown;
|
|
53
|
+
status: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NormalizedKeyMetadata as $64$luvio_engine_NormalizedKeyMetadata } from '@luvio/engine';
|
|
2
|
+
export declare const ObjectKeys: {
|
|
3
|
+
(o: object): string[];
|
|
4
|
+
(o: {}): string[];
|
|
5
|
+
}, ObjectCreate: {
|
|
6
|
+
(o: object | null): any;
|
|
7
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
8
|
+
}, ObjectAssign: {
|
|
9
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
|
10
|
+
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
11
|
+
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
12
|
+
(target: object, ...sources: any[]): any;
|
|
13
|
+
};
|
|
14
|
+
export declare const ArrayIsArray: (arg: any) => arg is any[];
|
|
15
|
+
export declare const JSONStringify: {
|
|
16
|
+
(value: any, replacer?: ((this: any, key: string, value: any) => any) | undefined, space?: string | number | undefined): string;
|
|
17
|
+
(value: any, replacer?: (string | number)[] | null | undefined, space?: string | number | undefined): string;
|
|
18
|
+
};
|
|
19
|
+
type AllowedPrimitives = boolean | string | number | Date | null;
|
|
20
|
+
type Value<T> = T extends AllowedPrimitives ? T : RecursivePartial<T>;
|
|
21
|
+
export type RecursivePartial<T> = null | {
|
|
22
|
+
[P in keyof T]?: T[P] extends Array<infer U> ? Array<Value<U>> | null : Value<T[P]> | null;
|
|
23
|
+
};
|
|
24
|
+
export declare function equalsArray<U, V extends U[]>(a: V, b: V, equalsItem: (itemA: U, itemB: U) => boolean | void): boolean;
|
|
25
|
+
export declare function equalsObject<U, V extends {
|
|
26
|
+
[key: string]: U;
|
|
27
|
+
}>(a: V, b: V, equalsProp: (propA: U, propB: U) => boolean | void): boolean;
|
|
28
|
+
export declare function createLink(ref: string | $64$luvio_engine_NormalizedKeyMetadata): {
|
|
29
|
+
__ref: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function assignMetadataLink(entry: any, metadataKey: string | $64$luvio_engine_NormalizedKeyMetadata): void;
|
|
32
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/lds-adapters-cdp-semantic-engine",
|
|
3
|
+
"version": "0.1.0-dev1",
|
|
4
|
+
"description": "Execution of Semantic Queries via Semantic Layer",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"main": "dist/es/es2018/cdp-semantic-engine.js",
|
|
7
|
+
"module": "dist/es/es2018/cdp-semantic-engine.js",
|
|
8
|
+
"types": "dist/es/es2018/types/src/generated/artifacts/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"sfdc",
|
|
12
|
+
"src/raml/*"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/es/es2018/types/src/generated/artifacts/main.d.ts",
|
|
17
|
+
"import": "./dist/es/es2018/cdp-semantic-engine.js",
|
|
18
|
+
"require": "./dist/es/es2018/cdp-semantic-engine.js"
|
|
19
|
+
},
|
|
20
|
+
"./sfdc": {
|
|
21
|
+
"types": "./sfdc/index.d.ts",
|
|
22
|
+
"import": "./sfdc/index.js",
|
|
23
|
+
"default": "./sfdc/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"sfdc": {
|
|
27
|
+
"namespace": "lightning",
|
|
28
|
+
"module": "cdpSemanticEngineApi"
|
|
29
|
+
},
|
|
30
|
+
"contributors": [
|
|
31
|
+
"ipervoi@salesforce.com"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "yarn build:services",
|
|
35
|
+
"build:raml": "luvio generate src/raml/luvio.raml src/generated -p '../lds-compiler-plugins'",
|
|
36
|
+
"build:services": "rollup --bundleConfigAsCjs --config rollup.config.js",
|
|
37
|
+
"clean": "rm -rf dist sfdc src/generated",
|
|
38
|
+
"release:core": "../../scripts/release/core.js --adapter=lds-adapters-cdp-semantic-engine",
|
|
39
|
+
"release:corejar": "yarn build && ../core-build/scripts/core.js --adapter=lds-adapters-cdp-semantic-engine",
|
|
40
|
+
"test:unit": "jest"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@salesforce/lds-bindings": "^0.1.0-dev1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@salesforce/lds-compiler-plugins": "^0.1.0-dev1"
|
|
47
|
+
},
|
|
48
|
+
"nx": {
|
|
49
|
+
"targets": {
|
|
50
|
+
"build": {
|
|
51
|
+
"outputs": [
|
|
52
|
+
"{projectRoot}/dist",
|
|
53
|
+
"{projectRoot}/sfdc"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"build:raml": {
|
|
57
|
+
"outputs": [
|
|
58
|
+
"{projectRoot}/src/generated"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"volta": {
|
|
64
|
+
"extends": "../../package.json"
|
|
65
|
+
}
|
|
66
|
+
}
|
package/sfdc/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/es/es2018/types/src/generated/artifacts/sfdc';
|
package/sfdc/index.js
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* ATTENTION!
|
|
9
|
+
* THIS IS A GENERATED FILE FROM https://github.com/salesforce-experience-platform-emu/lds-lightning-platform
|
|
10
|
+
* If you would like to contribute to LDS, please follow the steps outlined in the git repo.
|
|
11
|
+
* Any changes made to this file in p4 will be automatically overwritten.
|
|
12
|
+
* *******************************************************************************************
|
|
13
|
+
*/
|
|
14
|
+
/* proxy-compat-disable */
|
|
15
|
+
import { withDefaultLuvio } from 'force/ldsEngine';
|
|
16
|
+
import { serializeStructuredKey, ingestShape, deepFreeze, StoreKeyMap, createResourceParams as createResourceParams$1, typeCheckConfig as typeCheckConfig$1 } from 'force/luvioEngine';
|
|
17
|
+
|
|
18
|
+
const { hasOwnProperty: ObjectPrototypeHasOwnProperty } = Object.prototype;
|
|
19
|
+
const { keys: ObjectKeys$1, create: ObjectCreate$1 } = Object;
|
|
20
|
+
const { isArray: ArrayIsArray$1 } = Array;
|
|
21
|
+
/**
|
|
22
|
+
* Validates an adapter config is well-formed.
|
|
23
|
+
* @param config The config to validate.
|
|
24
|
+
* @param adapter The adapter validation configuration.
|
|
25
|
+
* @param oneOf The keys the config must contain at least one of.
|
|
26
|
+
* @throws A TypeError if config doesn't satisfy the adapter's config validation.
|
|
27
|
+
*/
|
|
28
|
+
function validateConfig(config, adapter, oneOf) {
|
|
29
|
+
const { displayName } = adapter;
|
|
30
|
+
const { required, optional, unsupported } = adapter.parameters;
|
|
31
|
+
if (config === undefined ||
|
|
32
|
+
required.every(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
33
|
+
throw new TypeError(`adapter ${displayName} configuration must specify ${required.sort().join(', ')}`);
|
|
34
|
+
}
|
|
35
|
+
if (oneOf && oneOf.some(req => ObjectPrototypeHasOwnProperty.call(config, req)) === false) {
|
|
36
|
+
throw new TypeError(`adapter ${displayName} configuration must specify one of ${oneOf.sort().join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
if (unsupported !== undefined &&
|
|
39
|
+
unsupported.some(req => ObjectPrototypeHasOwnProperty.call(config, req))) {
|
|
40
|
+
throw new TypeError(`adapter ${displayName} does not yet support ${unsupported.sort().join(', ')}`);
|
|
41
|
+
}
|
|
42
|
+
const supported = required.concat(optional);
|
|
43
|
+
if (ObjectKeys$1(config).some(key => !supported.includes(key))) {
|
|
44
|
+
throw new TypeError(`adapter ${displayName} configuration supports only ${supported.sort().join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function untrustedIsObject(untrusted) {
|
|
48
|
+
return typeof untrusted === 'object' && untrusted !== null && ArrayIsArray$1(untrusted) === false;
|
|
49
|
+
}
|
|
50
|
+
function areRequiredParametersPresent(config, configPropertyNames) {
|
|
51
|
+
return configPropertyNames.parameters.required.every(req => req in config);
|
|
52
|
+
}
|
|
53
|
+
function generateParamConfigMetadata(name, required, resourceType, typeCheckShape, isArrayShape = false, coerceFn) {
|
|
54
|
+
return {
|
|
55
|
+
name,
|
|
56
|
+
required,
|
|
57
|
+
resourceType,
|
|
58
|
+
typeCheckShape,
|
|
59
|
+
isArrayShape,
|
|
60
|
+
coerceFn,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function buildAdapterValidationConfig(displayName, paramsMeta) {
|
|
64
|
+
const required = paramsMeta.filter(p => p.required).map(p => p.name);
|
|
65
|
+
const optional = paramsMeta.filter(p => !p.required).map(p => p.name);
|
|
66
|
+
return {
|
|
67
|
+
displayName,
|
|
68
|
+
parameters: {
|
|
69
|
+
required,
|
|
70
|
+
optional,
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
const keyPrefix = 'SemanticEngine';
|
|
75
|
+
|
|
76
|
+
const { keys: ObjectKeys, create: ObjectCreate, assign: ObjectAssign } = Object;
|
|
77
|
+
const { isArray: ArrayIsArray } = Array;
|
|
78
|
+
const { stringify: JSONStringify } = JSON;
|
|
79
|
+
function createLink(ref) {
|
|
80
|
+
return {
|
|
81
|
+
__ref: serializeStructuredKey(ref),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const TTL = 100;
|
|
86
|
+
const VERSION = "c38fccbb9e02dc3907378c42bce24d36";
|
|
87
|
+
function validate(obj, path = 'SemanticQueryResponse') {
|
|
88
|
+
const v_error = (() => {
|
|
89
|
+
if (typeof obj !== 'object' || ArrayIsArray(obj) || obj === null) {
|
|
90
|
+
return new TypeError('Expected "object" but received "' + typeof obj + '" (at "' + path + '")');
|
|
91
|
+
}
|
|
92
|
+
if (obj.cacheLevel !== undefined) {
|
|
93
|
+
const obj_cacheLevel = obj.cacheLevel;
|
|
94
|
+
const path_cacheLevel = path + '.cacheLevel';
|
|
95
|
+
if (typeof obj_cacheLevel !== 'string') {
|
|
96
|
+
return new TypeError('Expected "string" but received "' + typeof obj_cacheLevel + '" (at "' + path_cacheLevel + '")');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (obj.context !== undefined) {
|
|
100
|
+
const obj_context = obj.context;
|
|
101
|
+
const path_context = path + '.context';
|
|
102
|
+
if (typeof obj_context !== 'object' || ArrayIsArray(obj_context) || obj_context === null) {
|
|
103
|
+
return new TypeError('Expected "object" but received "' + typeof obj_context + '" (at "' + path_context + '")');
|
|
104
|
+
}
|
|
105
|
+
const obj_context_keys = ObjectKeys(obj_context);
|
|
106
|
+
for (let i = 0; i < obj_context_keys.length; i++) {
|
|
107
|
+
const key = obj_context_keys[i];
|
|
108
|
+
const obj_context_prop = obj_context[key];
|
|
109
|
+
const path_context_prop = path_context + '["' + key + '"]';
|
|
110
|
+
if (obj_context_prop === undefined) {
|
|
111
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_context_prop + '" (at "' + path_context_prop + '")');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (obj.errorMessage !== undefined) {
|
|
116
|
+
const obj_errorMessage = obj.errorMessage;
|
|
117
|
+
const path_errorMessage = path + '.errorMessage';
|
|
118
|
+
if (typeof obj_errorMessage !== 'string') {
|
|
119
|
+
return new TypeError('Expected "string" but received "' + typeof obj_errorMessage + '" (at "' + path_errorMessage + '")');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const obj_queryResults = obj.queryResults;
|
|
123
|
+
const path_queryResults = path + '.queryResults';
|
|
124
|
+
if (obj_queryResults === undefined) {
|
|
125
|
+
return new TypeError('Expected "defined" but received "' + typeof obj_queryResults + '" (at "' + path_queryResults + '")');
|
|
126
|
+
}
|
|
127
|
+
const obj_status = obj.status;
|
|
128
|
+
const path_status = path + '.status';
|
|
129
|
+
if (typeof obj_status !== 'string') {
|
|
130
|
+
return new TypeError('Expected "string" but received "' + typeof obj_status + '" (at "' + path_status + '")');
|
|
131
|
+
}
|
|
132
|
+
})();
|
|
133
|
+
return v_error === undefined ? null : v_error;
|
|
134
|
+
}
|
|
135
|
+
const RepresentationType = 'SemanticQueryResponse';
|
|
136
|
+
function keyBuilder(luvio, config) {
|
|
137
|
+
return keyPrefix + '::' + RepresentationType + ':' + config.status;
|
|
138
|
+
}
|
|
139
|
+
function keyBuilderFromType(luvio, object) {
|
|
140
|
+
const keyParams = {
|
|
141
|
+
status: object.status
|
|
142
|
+
};
|
|
143
|
+
return keyBuilder(luvio, keyParams);
|
|
144
|
+
}
|
|
145
|
+
function normalize(input, existing, path, luvio, store, timestamp) {
|
|
146
|
+
return input;
|
|
147
|
+
}
|
|
148
|
+
const select$1 = function SemanticQueryResponseSelect() {
|
|
149
|
+
return {
|
|
150
|
+
kind: 'Fragment',
|
|
151
|
+
version: VERSION,
|
|
152
|
+
private: [],
|
|
153
|
+
opaque: true
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
function equals(existing, incoming) {
|
|
157
|
+
if (JSONStringify(incoming) !== JSONStringify(existing)) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
const ingest = function SemanticQueryResponseIngest(input, path, luvio, store, timestamp) {
|
|
163
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
164
|
+
const validateError = validate(input);
|
|
165
|
+
if (validateError !== null) {
|
|
166
|
+
throw validateError;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const key = keyBuilderFromType(luvio, input);
|
|
170
|
+
const ttlToUse = TTL;
|
|
171
|
+
ingestShape(input, path, luvio, store, timestamp, ttlToUse, key, normalize, "SemanticEngine", VERSION, RepresentationType, equals);
|
|
172
|
+
return createLink(key);
|
|
173
|
+
};
|
|
174
|
+
function getTypeCacheKeys(rootKeySet, luvio, input, fullPathFactory) {
|
|
175
|
+
// root cache key (uses fullPathFactory if keyBuilderFromType isn't defined)
|
|
176
|
+
const rootKey = keyBuilderFromType(luvio, input);
|
|
177
|
+
rootKeySet.set(rootKey, {
|
|
178
|
+
namespace: keyPrefix,
|
|
179
|
+
representationName: RepresentationType,
|
|
180
|
+
mergeable: false
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function select(luvio, params) {
|
|
185
|
+
return select$1();
|
|
186
|
+
}
|
|
187
|
+
function getResponseCacheKeys(storeKeyMap, luvio, resourceParams, response) {
|
|
188
|
+
getTypeCacheKeys(storeKeyMap, luvio, response);
|
|
189
|
+
}
|
|
190
|
+
function ingestSuccess(luvio, resourceParams, response) {
|
|
191
|
+
const { body } = response;
|
|
192
|
+
const key = keyBuilderFromType(luvio, body);
|
|
193
|
+
luvio.storeIngest(key, ingest, body);
|
|
194
|
+
const snapshot = luvio.storeLookup({
|
|
195
|
+
recordId: key,
|
|
196
|
+
node: select(),
|
|
197
|
+
variables: {},
|
|
198
|
+
});
|
|
199
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
200
|
+
if (snapshot.state !== 'Fulfilled') {
|
|
201
|
+
throw new Error('Invalid network response. Expected resource response to result in Fulfilled snapshot');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
deepFreeze(snapshot.data);
|
|
205
|
+
return snapshot;
|
|
206
|
+
}
|
|
207
|
+
function createResourceRequest(config) {
|
|
208
|
+
const headers = {};
|
|
209
|
+
return {
|
|
210
|
+
baseUri: '/services/data/v66.0',
|
|
211
|
+
basePath: '/semantic-engine/gateway',
|
|
212
|
+
method: 'post',
|
|
213
|
+
body: config.body,
|
|
214
|
+
urlParams: {},
|
|
215
|
+
queryParams: {},
|
|
216
|
+
headers,
|
|
217
|
+
priority: 'normal',
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const adapterName = 'executeSemanticQuery';
|
|
222
|
+
const executeSemanticQuery_ConfigPropertyMetadata = [
|
|
223
|
+
generateParamConfigMetadata('cachingLevelRequest', false, 2 /* Body */, 0 /* String */),
|
|
224
|
+
generateParamConfigMetadata('context', false, 2 /* Body */, 4 /* Unsupported */),
|
|
225
|
+
generateParamConfigMetadata('dataspace', true, 2 /* Body */, 0 /* String */),
|
|
226
|
+
generateParamConfigMetadata('groupId', false, 2 /* Body */, 0 /* String */),
|
|
227
|
+
generateParamConfigMetadata('semanticModel', false, 2 /* Body */, 4 /* Unsupported */),
|
|
228
|
+
generateParamConfigMetadata('semanticModelApiName', false, 2 /* Body */, 0 /* String */),
|
|
229
|
+
generateParamConfigMetadata('semanticModelId', false, 2 /* Body */, 0 /* String */),
|
|
230
|
+
generateParamConfigMetadata('source', true, 2 /* Body */, 0 /* String */),
|
|
231
|
+
generateParamConfigMetadata('structuredSemanticQuery', true, 2 /* Body */, 4 /* Unsupported */),
|
|
232
|
+
];
|
|
233
|
+
const executeSemanticQuery_ConfigPropertyNames = /*#__PURE__*/ buildAdapterValidationConfig(adapterName, executeSemanticQuery_ConfigPropertyMetadata);
|
|
234
|
+
const createResourceParams = /*#__PURE__*/ createResourceParams$1(executeSemanticQuery_ConfigPropertyMetadata);
|
|
235
|
+
function typeCheckConfig(untrustedConfig) {
|
|
236
|
+
const config = {};
|
|
237
|
+
typeCheckConfig$1(untrustedConfig, config, executeSemanticQuery_ConfigPropertyMetadata);
|
|
238
|
+
const untrustedConfig_context = untrustedConfig.context;
|
|
239
|
+
if (untrustedIsObject(untrustedConfig_context)) {
|
|
240
|
+
const untrustedConfig_context_object = {};
|
|
241
|
+
const untrustedConfig_context_keys = Object.keys(untrustedConfig_context);
|
|
242
|
+
for (let i = 0, arrayLength = untrustedConfig_context_keys.length; i < arrayLength; i++) {
|
|
243
|
+
const key = untrustedConfig_context_keys[i];
|
|
244
|
+
const untrustedConfig_context_prop = untrustedConfig_context[key];
|
|
245
|
+
if (untrustedConfig_context_object !== undefined) {
|
|
246
|
+
untrustedConfig_context_object[key] = untrustedConfig_context_prop;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (untrustedConfig_context_object !== undefined && Object.keys(untrustedConfig_context_object).length >= 0) {
|
|
250
|
+
config.context = untrustedConfig_context_object;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
const untrustedConfig_semanticModel = untrustedConfig.semanticModel;
|
|
254
|
+
config.semanticModel = untrustedConfig_semanticModel;
|
|
255
|
+
const untrustedConfig_structuredSemanticQuery = untrustedConfig.structuredSemanticQuery;
|
|
256
|
+
config.structuredSemanticQuery = untrustedConfig_structuredSemanticQuery;
|
|
257
|
+
return config;
|
|
258
|
+
}
|
|
259
|
+
function validateAdapterConfig(untrustedConfig, configPropertyNames) {
|
|
260
|
+
if (!untrustedIsObject(untrustedConfig)) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
264
|
+
validateConfig(untrustedConfig, configPropertyNames);
|
|
265
|
+
}
|
|
266
|
+
const config = typeCheckConfig(untrustedConfig);
|
|
267
|
+
if (!areRequiredParametersPresent(config, configPropertyNames)) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
return config;
|
|
271
|
+
}
|
|
272
|
+
function buildNetworkSnapshot(luvio, config, options) {
|
|
273
|
+
const resourceParams = createResourceParams(config);
|
|
274
|
+
const request = createResourceRequest(resourceParams);
|
|
275
|
+
return luvio.dispatchResourceRequest(request, options)
|
|
276
|
+
.then((response) => {
|
|
277
|
+
return luvio.handleSuccessResponse(() => {
|
|
278
|
+
const snapshot = ingestSuccess(luvio, resourceParams, response);
|
|
279
|
+
return luvio.storeBroadcast().then(() => snapshot);
|
|
280
|
+
}, () => {
|
|
281
|
+
const cache = new StoreKeyMap();
|
|
282
|
+
getResponseCacheKeys(cache, luvio, resourceParams, response.body);
|
|
283
|
+
return cache;
|
|
284
|
+
});
|
|
285
|
+
}, (response) => {
|
|
286
|
+
deepFreeze(response);
|
|
287
|
+
throw response;
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
const executeSemanticQueryAdapterFactory = (luvio) => {
|
|
291
|
+
return function executeSemanticQuery(untrustedConfig) {
|
|
292
|
+
const config = validateAdapterConfig(untrustedConfig, executeSemanticQuery_ConfigPropertyNames);
|
|
293
|
+
// Invalid or incomplete config
|
|
294
|
+
if (config === null) {
|
|
295
|
+
throw new Error('Invalid config for "executeSemanticQuery"');
|
|
296
|
+
}
|
|
297
|
+
return buildNetworkSnapshot(luvio, config);
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
let executeSemanticQuery;
|
|
302
|
+
// Notify Update Available
|
|
303
|
+
function bindExportsTo(luvio) {
|
|
304
|
+
// LDS Adapters
|
|
305
|
+
function unwrapSnapshotData(factory) {
|
|
306
|
+
const adapter = factory(luvio);
|
|
307
|
+
return (config) => adapter(config).then((snapshot) => snapshot.data);
|
|
308
|
+
}
|
|
309
|
+
return {
|
|
310
|
+
executeSemanticQuery: unwrapSnapshotData(executeSemanticQueryAdapterFactory),
|
|
311
|
+
// Imperative GET Adapters
|
|
312
|
+
// Notify Update Availables
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
withDefaultLuvio((luvio) => {
|
|
316
|
+
({ executeSemanticQuery } = bindExportsTo(luvio));
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
export { executeSemanticQuery };
|
|
320
|
+
// version: 0.1.0-dev1-c978a7b010
|