@itwin/presentation-shared 2.0.0-alpha.9 → 2.0.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/CHANGELOG.md +675 -0
- package/README.md +59 -27
- package/lib/presentation-shared.d.ts +24 -0
- package/lib/presentation-shared.d.ts.map +1 -0
- package/lib/presentation-shared.js +22 -0
- package/lib/presentation-shared.js.map +1 -0
- package/lib/shared/ConcatenatedValue.d.ts.map +1 -0
- package/lib/shared/ConcatenatedValue.js.map +1 -0
- package/lib/{cjs/shared → shared}/ECSqlCore.d.ts +16 -2
- package/lib/shared/ECSqlCore.d.ts.map +1 -0
- package/lib/shared/ECSqlCore.js +37 -0
- package/lib/shared/ECSqlCore.js.map +1 -0
- package/lib/shared/EachValueFrom.d.ts +30 -0
- package/lib/shared/EachValueFrom.d.ts.map +1 -0
- package/lib/shared/EachValueFrom.js +115 -0
- package/lib/shared/EachValueFrom.js.map +1 -0
- package/lib/shared/Event.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/Event.js.map +1 -1
- package/lib/shared/Formatting.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/Formatting.js +10 -6
- package/lib/shared/Formatting.js.map +1 -0
- package/lib/shared/HiddenClasses.d.ts +21 -0
- package/lib/shared/HiddenClasses.d.ts.map +1 -0
- package/lib/shared/HiddenClasses.js +52 -0
- package/lib/shared/HiddenClasses.js.map +1 -0
- package/lib/{cjs/shared → shared}/InstanceLabelSelectClauseFactory.d.ts +3 -63
- package/lib/shared/InstanceLabelSelectClauseFactory.d.ts.map +1 -0
- package/lib/shared/InstanceLabelSelectClauseFactory.js +27 -0
- package/lib/shared/InstanceLabelSelectClauseFactory.js.map +1 -0
- package/lib/shared/Logging.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/Logging.js +2 -1
- package/lib/shared/Logging.js.map +1 -0
- package/lib/shared/MappedTypes.d.ts +55 -0
- package/lib/shared/MappedTypes.d.ts.map +1 -0
- package/lib/shared/MappedTypes.js.map +1 -0
- package/lib/shared/Metadata.d.ts +572 -0
- package/lib/shared/Metadata.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/Metadata.js +7 -3
- package/lib/shared/Metadata.js.map +1 -0
- package/lib/{cjs/shared → shared}/Utils.d.ts +0 -6
- package/lib/shared/Utils.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/Utils.js +16 -21
- package/lib/shared/Utils.js.map +1 -0
- package/lib/shared/Values.d.ts +144 -0
- package/lib/shared/Values.d.ts.map +1 -0
- package/lib/shared/Values.js +121 -0
- package/lib/shared/Values.js.map +1 -0
- package/lib/shared/ecsql-snippets/ECSqlHiddenClassesSnippets.d.ts +40 -0
- package/lib/shared/ecsql-snippets/ECSqlHiddenClassesSnippets.d.ts.map +1 -0
- package/lib/shared/ecsql-snippets/ECSqlHiddenClassesSnippets.js +66 -0
- package/lib/shared/ecsql-snippets/ECSqlHiddenClassesSnippets.js.map +1 -0
- package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts +174 -0
- package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts.map +1 -0
- package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.js +177 -0
- package/lib/shared/ecsql-snippets/ECSqlJoinSnippets.js.map +1 -0
- package/lib/{cjs/shared → shared}/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts +9 -1
- package/lib/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts.map +1 -0
- package/lib/{esm/shared → shared}/ecsql-snippets/ECSqlValueSelectorSnippets.js +22 -8
- package/lib/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js.map +1 -0
- package/lib/shared/ecsql-snippets/index.d.ts +4 -0
- package/lib/shared/ecsql-snippets/index.d.ts.map +1 -0
- package/lib/shared/ecsql-snippets/index.js +8 -0
- package/lib/shared/ecsql-snippets/index.js.map +1 -0
- package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.d.ts +17 -0
- package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.d.ts.map +1 -0
- package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.js +48 -0
- package/lib/shared/instance-label-factory-impls/BisInstanceLabelSelectClauseFactory.js.map +1 -0
- package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.d.ts +39 -0
- package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.d.ts.map +1 -0
- package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.js +60 -0
- package/lib/shared/instance-label-factory-impls/ClassBasedInstanceLabelSelectClauseFactory.js.map +1 -0
- package/lib/shared/instance-label-factory-impls/DefaultInstanceLabelSelectClauseFactory.d.ts +12 -0
- package/lib/shared/instance-label-factory-impls/DefaultInstanceLabelSelectClauseFactory.d.ts.map +1 -0
- package/lib/shared/instance-label-factory-impls/DefaultInstanceLabelSelectClauseFactory.js +37 -0
- package/lib/shared/instance-label-factory-impls/DefaultInstanceLabelSelectClauseFactory.js.map +1 -0
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.Rules.d.ts +198 -0
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.Rules.d.ts.map +1 -0
- package/lib/{esm/shared/ECSqlCore.js → shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.Rules.js} +4 -1
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.Rules.js.map +1 -0
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.d.ts +34 -0
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.d.ts.map +1 -0
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.js +332 -0
- package/lib/shared/instance-label-factory-impls/IModelInstanceLabelSelectClauseFactory.js.map +1 -0
- package/lib/shared/instance-label-factory-impls/Utils.d.ts +7 -0
- package/lib/shared/instance-label-factory-impls/Utils.d.ts.map +1 -0
- package/lib/shared/instance-label-factory-impls/Utils.js +21 -0
- package/lib/shared/instance-label-factory-impls/Utils.js.map +1 -0
- package/package.json +22 -31
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/presentation-shared.d.ts +0 -17
- package/lib/cjs/presentation-shared.d.ts.map +0 -1
- package/lib/cjs/presentation-shared.js +0 -71
- package/lib/cjs/presentation-shared.js.map +0 -1
- package/lib/cjs/shared/ConcatenatedValue.d.ts.map +0 -1
- package/lib/cjs/shared/ConcatenatedValue.js +0 -49
- package/lib/cjs/shared/ConcatenatedValue.js.map +0 -1
- package/lib/cjs/shared/ECSqlCore.d.ts.map +0 -1
- package/lib/cjs/shared/ECSqlCore.js +0 -7
- package/lib/cjs/shared/ECSqlCore.js.map +0 -1
- package/lib/cjs/shared/Event.d.ts.map +0 -1
- package/lib/cjs/shared/Event.js +0 -7
- package/lib/cjs/shared/Event.js.map +0 -1
- package/lib/cjs/shared/Formatting.d.ts.map +0 -1
- package/lib/cjs/shared/Formatting.js +0 -114
- package/lib/cjs/shared/Formatting.js.map +0 -1
- package/lib/cjs/shared/InstanceLabelSelectClauseFactory.d.ts.map +0 -1
- package/lib/cjs/shared/InstanceLabelSelectClauseFactory.js +0 -166
- package/lib/cjs/shared/InstanceLabelSelectClauseFactory.js.map +0 -1
- package/lib/cjs/shared/Logging.d.ts.map +0 -1
- package/lib/cjs/shared/Logging.js +0 -20
- package/lib/cjs/shared/Logging.js.map +0 -1
- package/lib/cjs/shared/MappedTypes.d.ts +0 -17
- package/lib/cjs/shared/MappedTypes.d.ts.map +0 -1
- package/lib/cjs/shared/MappedTypes.js +0 -7
- package/lib/cjs/shared/MappedTypes.js.map +0 -1
- package/lib/cjs/shared/Metadata.d.ts +0 -294
- package/lib/cjs/shared/Metadata.d.ts.map +0 -1
- package/lib/cjs/shared/Metadata.js +0 -53
- package/lib/cjs/shared/Metadata.js.map +0 -1
- package/lib/cjs/shared/Utils.d.ts.map +0 -1
- package/lib/cjs/shared/Utils.js +0 -113
- package/lib/cjs/shared/Utils.js.map +0 -1
- package/lib/cjs/shared/Values.d.ts +0 -107
- package/lib/cjs/shared/Values.d.ts.map +0 -1
- package/lib/cjs/shared/Values.js +0 -155
- package/lib/cjs/shared/Values.js.map +0 -1
- package/lib/cjs/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts +0 -51
- package/lib/cjs/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts.map +0 -1
- package/lib/cjs/shared/ecsql-snippets/ECSqlJoinSnippets.js +0 -140
- package/lib/cjs/shared/ecsql-snippets/ECSqlJoinSnippets.js.map +0 -1
- package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts.map +0 -1
- package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js +0 -260
- package/lib/cjs/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js.map +0 -1
- package/lib/cjs/shared/ecsql-snippets/index.d.ts +0 -3
- package/lib/cjs/shared/ecsql-snippets/index.d.ts.map +0 -1
- package/lib/cjs/shared/ecsql-snippets/index.js +0 -18
- package/lib/cjs/shared/ecsql-snippets/index.js.map +0 -1
- package/lib/esm/presentation-shared.d.ts +0 -17
- package/lib/esm/presentation-shared.d.ts.map +0 -1
- package/lib/esm/presentation-shared.js +0 -14
- package/lib/esm/presentation-shared.js.map +0 -1
- package/lib/esm/shared/ConcatenatedValue.d.ts +0 -46
- package/lib/esm/shared/ConcatenatedValue.d.ts.map +0 -1
- package/lib/esm/shared/ConcatenatedValue.js.map +0 -1
- package/lib/esm/shared/ECSqlCore.d.ts +0 -94
- package/lib/esm/shared/ECSqlCore.d.ts.map +0 -1
- package/lib/esm/shared/ECSqlCore.js.map +0 -1
- package/lib/esm/shared/Event.d.ts +0 -27
- package/lib/esm/shared/Event.d.ts.map +0 -1
- package/lib/esm/shared/Formatting.d.ts +0 -44
- package/lib/esm/shared/Formatting.d.ts.map +0 -1
- package/lib/esm/shared/Formatting.js.map +0 -1
- package/lib/esm/shared/InstanceLabelSelectClauseFactory.d.ts +0 -133
- package/lib/esm/shared/InstanceLabelSelectClauseFactory.d.ts.map +0 -1
- package/lib/esm/shared/InstanceLabelSelectClauseFactory.js +0 -160
- package/lib/esm/shared/InstanceLabelSelectClauseFactory.js.map +0 -1
- package/lib/esm/shared/Logging.d.ts +0 -27
- package/lib/esm/shared/Logging.d.ts.map +0 -1
- package/lib/esm/shared/Logging.js.map +0 -1
- package/lib/esm/shared/MappedTypes.d.ts +0 -17
- package/lib/esm/shared/MappedTypes.d.ts.map +0 -1
- package/lib/esm/shared/MappedTypes.js.map +0 -1
- package/lib/esm/shared/Metadata.d.ts +0 -294
- package/lib/esm/shared/Metadata.d.ts.map +0 -1
- package/lib/esm/shared/Metadata.js.map +0 -1
- package/lib/esm/shared/Utils.d.ts +0 -66
- package/lib/esm/shared/Utils.d.ts.map +0 -1
- package/lib/esm/shared/Utils.js.map +0 -1
- package/lib/esm/shared/Values.d.ts +0 -107
- package/lib/esm/shared/Values.d.ts.map +0 -1
- package/lib/esm/shared/Values.js +0 -152
- package/lib/esm/shared/Values.js.map +0 -1
- package/lib/esm/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts +0 -51
- package/lib/esm/shared/ecsql-snippets/ECSqlJoinSnippets.d.ts.map +0 -1
- package/lib/esm/shared/ecsql-snippets/ECSqlJoinSnippets.js +0 -137
- package/lib/esm/shared/ecsql-snippets/ECSqlJoinSnippets.js.map +0 -1
- package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts +0 -122
- package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.d.ts.map +0 -1
- package/lib/esm/shared/ecsql-snippets/ECSqlValueSelectorSnippets.js.map +0 -1
- package/lib/esm/shared/ecsql-snippets/index.d.ts +0 -3
- package/lib/esm/shared/ecsql-snippets/index.d.ts.map +0 -1
- package/lib/esm/shared/ecsql-snippets/index.js +0 -7
- package/lib/esm/shared/ecsql-snippets/index.js.map +0 -1
- /package/lib/{cjs/shared → shared}/ConcatenatedValue.d.ts +0 -0
- /package/lib/{esm/shared → shared}/ConcatenatedValue.js +0 -0
- /package/lib/{cjs/shared → shared}/Event.d.ts +0 -0
- /package/lib/{esm/shared → shared}/Event.js +0 -0
- /package/lib/{cjs/shared → shared}/Formatting.d.ts +0 -0
- /package/lib/{cjs/shared → shared}/Logging.d.ts +0 -0
- /package/lib/{esm/shared → shared}/MappedTypes.js +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { assert } from "@itwin/core-bentley";
|
|
5
6
|
/**
|
|
6
7
|
* An utility to parse schema and class names from full class name, where
|
|
7
8
|
* schema and class names are separated by either `:` or `.`.
|
|
@@ -10,11 +11,22 @@
|
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
13
|
export function parseFullClassName(fullClassName) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let idx = fullClassName.indexOf(".");
|
|
15
|
+
let includesDot = true;
|
|
16
|
+
if (idx <= 0) {
|
|
17
|
+
includesDot = false;
|
|
18
|
+
idx = fullClassName.indexOf(":");
|
|
19
|
+
if (idx <= 0) {
|
|
20
|
+
throw new Error(`Invalid full class name: ${fullClassName}`);
|
|
21
|
+
}
|
|
16
22
|
}
|
|
17
|
-
|
|
23
|
+
assert(() => {
|
|
24
|
+
return (idx < fullClassName.length - 1 &&
|
|
25
|
+
(includesDot
|
|
26
|
+
? fullClassName.lastIndexOf(".") === idx && fullClassName.indexOf(":") === -1
|
|
27
|
+
: fullClassName.lastIndexOf(":") === idx));
|
|
28
|
+
}, `Invalid full class name: ${fullClassName}`);
|
|
29
|
+
return { schemaName: fullClassName.slice(0, idx), className: fullClassName.slice(idx + 1) };
|
|
18
30
|
}
|
|
19
31
|
/**
|
|
20
32
|
* An utility to normalize full class name from either `SchemaName:ClassName` or
|
|
@@ -27,25 +39,8 @@ export function normalizeFullClassName(fullClassName) {
|
|
|
27
39
|
const { schemaName, className } = parseFullClassName(fullClassName);
|
|
28
40
|
return `${schemaName}.${className}`;
|
|
29
41
|
}
|
|
30
|
-
/**
|
|
31
|
-
* An utility that compares two full class names in a case insensitive way, ignoring different
|
|
32
|
-
* supported schema-class name separators (`.` or `:`).
|
|
33
|
-
* @public
|
|
34
|
-
*/
|
|
35
|
-
export function compareFullClassNames(lhs, rhs) {
|
|
36
|
-
const parsed = {
|
|
37
|
-
lhs: parseFullClassName(lhs),
|
|
38
|
-
rhs: parseFullClassName(rhs),
|
|
39
|
-
};
|
|
40
|
-
const schemaCompare = parsed.lhs.schemaName.toLocaleLowerCase().localeCompare(parsed.rhs.schemaName.toLocaleLowerCase());
|
|
41
|
-
if (schemaCompare !== 0) {
|
|
42
|
-
return schemaCompare;
|
|
43
|
-
}
|
|
44
|
-
return parsed.lhs.className.toLocaleLowerCase().localeCompare(parsed.rhs.className.toLocaleLowerCase());
|
|
45
|
-
}
|
|
46
42
|
/** @public */
|
|
47
43
|
export function trimWhitespace(str) {
|
|
48
|
-
/* c8 ignore next 3 */
|
|
49
44
|
if (!str) {
|
|
50
45
|
return str;
|
|
51
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../src/shared/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI7C;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,aAAqB;IACtD,IAAI,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACb,WAAW,GAAG,KAAK,CAAC;QACpB,GAAG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U,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,6BAA6B;SACtD,IAAI,EAAE,CAAC,CAAC,qDAAqD;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,0CAA0C,CAAC,mBAAmB,GAAG,EAAE;IACjF,IAAI,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,OAAO,GAA8B,EAAE;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACnC,IAAI,OAAO,GAAG,mBAAmB,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,iBAAiB,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACnC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,MAAM,MAAM,GAAG,CAAC,UAAU,GAAG,SAAS,CAAC,GAAG,QAAQ,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { Id64String } from "@itwin/core-bentley";
|
|
2
|
+
import type { ConcatenatedValue } from "./ConcatenatedValue.js";
|
|
3
|
+
import type { EC, PrimitiveValueType } from "./Metadata.js";
|
|
4
|
+
/**
|
|
5
|
+
* A data structure uniquely identifying an ECInstance in an iModel.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface InstanceKey {
|
|
9
|
+
/** Full class name in format `SchemaName.ClassName` */
|
|
10
|
+
className: EC.FullClassNameDotNotation;
|
|
11
|
+
/** ECInstance ID */
|
|
12
|
+
id: Id64String;
|
|
13
|
+
}
|
|
14
|
+
/** @public */
|
|
15
|
+
export declare namespace InstanceKey {
|
|
16
|
+
/**
|
|
17
|
+
* Checks whether the two given instance keys are equal.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
function equals(lhs: InstanceKey, rhs: InstanceKey): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Compares two given instance keys.
|
|
23
|
+
* @returns
|
|
24
|
+
*- `0` if they are equal
|
|
25
|
+
*- `negative value` if lhs key is less than rhs key
|
|
26
|
+
*- `positive value` if lhs key is more than rhs key
|
|
27
|
+
*/
|
|
28
|
+
function compare(lhs: InstanceKey, rhs: InstanceKey): number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A data structure for a 2d point.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export interface Point2dValue {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A data structure for a 3d point.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export interface Point3dValue {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
z: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A union for all supported primitive value types.
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
export type PrimitiveValue = Id64String | string | number | boolean | Date | Point2dValue | Point3dValue;
|
|
52
|
+
/** @public */
|
|
53
|
+
export declare namespace PrimitiveValue {
|
|
54
|
+
/**
|
|
55
|
+
* Checks whether the given value is a `Point2dValue`.
|
|
56
|
+
* @note Since `Point3dValue` is a superset of `Point2dValue`, this function will return `true` for `Point3dValue` as well.
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
function isPoint2d(value: PrimitiveValue): value is Point2dValue;
|
|
60
|
+
/**
|
|
61
|
+
* Checks whether the given value is a `Point3dValue`.
|
|
62
|
+
* @public
|
|
63
|
+
*/
|
|
64
|
+
function isPoint3d(value: PrimitiveValue): value is Point3dValue;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A type for a primitive value, its type and, optionally, its extended type.
|
|
68
|
+
* @note Use `TypedPrimitiveValue.create` to create an instance of this type.
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export type TypedPrimitiveValue = ({
|
|
72
|
+
value: number;
|
|
73
|
+
type: Extract<PrimitiveValueType, "Double">;
|
|
74
|
+
koqName?: string;
|
|
75
|
+
} | {
|
|
76
|
+
value: number;
|
|
77
|
+
type: Extract<PrimitiveValueType, "Integer">;
|
|
78
|
+
koqName?: string;
|
|
79
|
+
} | {
|
|
80
|
+
value: number;
|
|
81
|
+
type: Extract<PrimitiveValueType, "Long">;
|
|
82
|
+
koqName?: string;
|
|
83
|
+
} | {
|
|
84
|
+
value: boolean;
|
|
85
|
+
type: Extract<PrimitiveValueType, "Boolean">;
|
|
86
|
+
} | {
|
|
87
|
+
value: Id64String;
|
|
88
|
+
type: Extract<PrimitiveValueType, "Id">;
|
|
89
|
+
} | {
|
|
90
|
+
value: string;
|
|
91
|
+
type: Extract<PrimitiveValueType, "String">;
|
|
92
|
+
} | {
|
|
93
|
+
value: number | string | Date;
|
|
94
|
+
type: Extract<PrimitiveValueType, "DateTime">;
|
|
95
|
+
} | {
|
|
96
|
+
value: Point2dValue;
|
|
97
|
+
type: Extract<PrimitiveValueType, "Point2d">;
|
|
98
|
+
} | {
|
|
99
|
+
value: Point3dValue;
|
|
100
|
+
type: Extract<PrimitiveValueType, "Point3d">;
|
|
101
|
+
}) & {
|
|
102
|
+
extendedType?: string;
|
|
103
|
+
};
|
|
104
|
+
/** @public */
|
|
105
|
+
export declare namespace TypedPrimitiveValue {
|
|
106
|
+
/**
|
|
107
|
+
* A function for a creating a `TypedPrimitiveValue` object.
|
|
108
|
+
* @throws Error if primitive type and value are incompatible.
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
function create<TValue extends PrimitiveValue, TType extends PrimitiveValueType>(value: TValue, type: TType, koqName?: string, extendedType?: string): Extract<TypedPrimitiveValue, {
|
|
112
|
+
type: TType;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A composite value representing a struct (named record with member values).
|
|
117
|
+
* @public
|
|
118
|
+
*/
|
|
119
|
+
export interface StructValue {
|
|
120
|
+
[memberName: string]: Value;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A composite value representing an array of values.
|
|
124
|
+
* @public
|
|
125
|
+
*/
|
|
126
|
+
export type ArrayValue = Value[];
|
|
127
|
+
/**
|
|
128
|
+
* A value representing a navigation value pointing to another instance.
|
|
129
|
+
* @public
|
|
130
|
+
*/
|
|
131
|
+
export interface NavigationValue {
|
|
132
|
+
/**
|
|
133
|
+
* Key of the instance the navigation value points to.
|
|
134
|
+
*/
|
|
135
|
+
key: InstanceKey;
|
|
136
|
+
/** Unformatted label of the instance the navigation value points to. */
|
|
137
|
+
label: ConcatenatedValue | string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Any value that can be assigned to an ECInstance — a primitive, struct, array, navigation value, or undefined (null/empty).
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
export type Value = PrimitiveValue | StructValue | ArrayValue | NavigationValue | undefined;
|
|
144
|
+
//# sourceMappingURL=Values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Values.d.ts","sourceRoot":"","sources":["../../src/shared/Values.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,EAAE,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE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gD/C;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,EAAE,CAAC;AAEjC;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC;IACjB,wEAAwE;IACxE,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,cAAc,GAAG,WAAW,GAAG,UAAU,GAAG,eAAe,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { compareStrings, Id64 } from "@itwin/core-bentley";
|
|
6
|
+
/** @public */
|
|
7
|
+
export var InstanceKey;
|
|
8
|
+
(function (InstanceKey) {
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether the two given instance keys are equal.
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
function equals(lhs, rhs) {
|
|
14
|
+
return compare(lhs, rhs) === 0;
|
|
15
|
+
}
|
|
16
|
+
InstanceKey.equals = equals;
|
|
17
|
+
/**
|
|
18
|
+
* Compares two given instance keys.
|
|
19
|
+
* @returns
|
|
20
|
+
*- `0` if they are equal
|
|
21
|
+
*- `negative value` if lhs key is less than rhs key
|
|
22
|
+
*- `positive value` if lhs key is more than rhs key
|
|
23
|
+
*/
|
|
24
|
+
function compare(lhs, rhs) {
|
|
25
|
+
const classNameCompareResult = compareStrings(lhs.className, rhs.className);
|
|
26
|
+
if (classNameCompareResult !== 0) {
|
|
27
|
+
return classNameCompareResult;
|
|
28
|
+
}
|
|
29
|
+
return compareStrings(lhs.id, rhs.id);
|
|
30
|
+
}
|
|
31
|
+
InstanceKey.compare = compare;
|
|
32
|
+
})(InstanceKey || (InstanceKey = {}));
|
|
33
|
+
/** @public */
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
35
|
+
export var PrimitiveValue;
|
|
36
|
+
(function (PrimitiveValue) {
|
|
37
|
+
/**
|
|
38
|
+
* Checks whether the given value is a `Point2dValue`.
|
|
39
|
+
* @note Since `Point3dValue` is a superset of `Point2dValue`, this function will return `true` for `Point3dValue` as well.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
function isPoint2d(value) {
|
|
43
|
+
if (typeof value !== "object") {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return "x" in value && "y" in value;
|
|
47
|
+
}
|
|
48
|
+
PrimitiveValue.isPoint2d = isPoint2d;
|
|
49
|
+
/**
|
|
50
|
+
* Checks whether the given value is a `Point3dValue`.
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
function isPoint3d(value) {
|
|
54
|
+
if (typeof value !== "object") {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
return "x" in value && "y" in value && "z" in value;
|
|
58
|
+
}
|
|
59
|
+
PrimitiveValue.isPoint3d = isPoint3d;
|
|
60
|
+
})(PrimitiveValue || (PrimitiveValue = {}));
|
|
61
|
+
/** @public */
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
63
|
+
export var TypedPrimitiveValue;
|
|
64
|
+
(function (TypedPrimitiveValue) {
|
|
65
|
+
/**
|
|
66
|
+
* A function for a creating a `TypedPrimitiveValue` object.
|
|
67
|
+
* @throws Error if primitive type and value are incompatible.
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
function create(value, type, koqName, extendedType) {
|
|
71
|
+
// The function's return type narrows `TypedPrimitiveValue` based on the generic `TType`. TypeScript can't verify that the
|
|
72
|
+
// objects created below satisfy that narrowed type, because narrowing the `type`/`value` variables via control flow doesn't
|
|
73
|
+
// narrow the `TType` type parameter itself (it stays generic within the function body). So we build the value with a concrete
|
|
74
|
+
// `TypedPrimitiveValue` return type - which TypeScript does check branch-by-branch - and apply the narrowing with a single
|
|
75
|
+
// cast at the boundary, rather than casting every `return` statement individually.
|
|
76
|
+
return (function () {
|
|
77
|
+
switch (type) {
|
|
78
|
+
case "Double":
|
|
79
|
+
case "Integer":
|
|
80
|
+
case "Long":
|
|
81
|
+
if (typeof value === "number") {
|
|
82
|
+
return { type, koqName, extendedType, value };
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
case "Boolean":
|
|
86
|
+
if (typeof value === "boolean") {
|
|
87
|
+
return { type, extendedType, value };
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
case "Id":
|
|
91
|
+
if (typeof value === "string" && Id64.isId64(value)) {
|
|
92
|
+
return { type, extendedType, value };
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
case "String":
|
|
96
|
+
if (typeof value === "string") {
|
|
97
|
+
return { type, extendedType, value };
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case "DateTime":
|
|
101
|
+
if (typeof value === "string" || typeof value === "number" || value instanceof Date) {
|
|
102
|
+
return { type, extendedType, value };
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case "Point3d":
|
|
106
|
+
if (PrimitiveValue.isPoint3d(value)) {
|
|
107
|
+
return { type, extendedType, value };
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
case "Point2d":
|
|
111
|
+
if (PrimitiveValue.isPoint2d(value)) {
|
|
112
|
+
return { type, extendedType, value };
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
throw new Error(`PrimitiveValueType ${type} isn't compatible with value ${JSON.stringify(value)}`);
|
|
117
|
+
})();
|
|
118
|
+
}
|
|
119
|
+
TypedPrimitiveValue.create = create;
|
|
120
|
+
})(TypedPrimitiveValue || (TypedPrimitiveValue = {}));
|
|
121
|
+
//# sourceMappingURL=Values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Values.js","sourceRoot":"","sources":["../../src/shared/Values.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAiB3D,cAAc;AACd,MAAM,KAAW,WAAW,CAsB3B;AAtBD,WAAiB,WAAW;IAC1B;;;OAGG;IACH,SAAgB,MAAM,CAAC,GAAgB,EAAE,GAAgB;QACvD,OAAO,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAFe,YAAA,MAAM,SAErB,CAAA;IACD;;;;;;OAMG;IACH,SAAgB,OAAO,CAAC,GAAgB,EAAE,GAAgB;QACxD,MAAM,sBAAsB,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;QAC5E,IAAI,sBAAsB,KAAK,CAAC,EAAE,CAAC;YACjC,OAAO,sBAAsB,CAAC;QAChC,CAAC;QACD,OAAO,cAAc,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IANe,YAAA,OAAO,UAMtB,CAAA;AACH,CAAC,EAtBgB,WAAW,KAAX,WAAW,QAsB3B;AA2BD,cAAc;AACd,2DAA2D;AAC3D,MAAM,KAAW,cAAc,CAuB9B;AAvBD,WAAiB,cAAc;IAC7B;;;;OAIG;IACH,SAAgB,SAAS,CAAC,KAAqB;QAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,CAAC;IACtC,CAAC;IALe,eAAA,SAAS,YAKxB,CAAA;IAED;;;OAGG;IACH,SAAgB,SAAS,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YAAY,EAAE,KAAK,EAAE,CAAC;oBACvC,CAAC;oBACD,MAAM;gBACR,KAAK,UAAU;oBACb,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;wBACpF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;oBACvC,CAAC;oBACD,MAAM;gBACR,KAAK,SAAS;oBACZ,IAAI,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;wBACpC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;oBACvC,CAAC;oBACD,MAAM;gBACR,KAAK,SAAS;oBACZ,IAAI,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;wBACpC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;oBACvC,CAAC;oBACD,MAAM;YACV,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,gCAAgC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrG,CAAC,CAAC,EAAmD,CAAC;IACxD,CAAC;IArDe,oBAAA,MAAM,SAqDrB,CAAA;AACH,CAAC,EA5DgB,mBAAmB,KAAnB,mBAAmB,QA4DnC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { EC, ECSchemaProvider } from "../Metadata.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a filter that excludes instances of classes hidden through `CoreCustomAttributes.HiddenClass` or
|
|
4
|
+
* `CoreCustomAttributes.HiddenSchema` custom attributes, relative to the given base class:
|
|
5
|
+
* - The base class is the visibility boundary: `HiddenClass` attributes on it and on its own base classes are ignored,
|
|
6
|
+
* so it is never excluded, even if it's hidden. Its derived classes are excluded or included according to the rules
|
|
7
|
+
* described by `HiddenClassesTreeNode`.
|
|
8
|
+
* - Classes outside the base class' hierarchy are not affected, so the filter may be applied to queries selecting
|
|
9
|
+
* the base class, its derived class, or a broader class.
|
|
10
|
+
* - The base class should be the class the query is meant to select. When the query's `FROM` class gets specialized,
|
|
11
|
+
* e.g. by an instance filter, still pass the original class - otherwise, specializing to a hidden class would
|
|
12
|
+
* include its instances.
|
|
13
|
+
*
|
|
14
|
+
* The hidden classes tree is requested from `schemaProvider` once, when creating the filter, and errors are
|
|
15
|
+
* propagated. Caching the tree is the provider's responsibility, so create the filter when building queries and
|
|
16
|
+
* reuse it for all aliases within the same operation, rather than holding on to it.
|
|
17
|
+
*
|
|
18
|
+
* Usage example:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const filter = await ECSql.createHiddenClassesFilter({ schemaProvider, baseClassName: "BisCore.GeometricElement3d" });
|
|
22
|
+
* const whereClause = filter.createWhereClause("e");
|
|
23
|
+
* const ecsql = `SELECT e.ECInstanceId FROM bis.GeometricElement3d e ${whereClause ? `WHERE ${whereClause}` : ""}`;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare function createHiddenClassesFilter(props: {
|
|
29
|
+
/** Schema provider used to get the hidden classes tree of the base class. */
|
|
30
|
+
schemaProvider: Pick<ECSchemaProvider, "getHiddenClassesTree">;
|
|
31
|
+
/** Full name of the class, relative to which classes are hidden. */
|
|
32
|
+
baseClassName: EC.FullClassNameDotNotation;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
/**
|
|
35
|
+
* Creates an ECSQL condition (without the `WHERE` keyword) that excludes instances of hidden classes, selected
|
|
36
|
+
* under the given alias. Returns an empty string when nothing needs to be excluded.
|
|
37
|
+
*/
|
|
38
|
+
createWhereClause(classAlias: string): string;
|
|
39
|
+
}>;
|
|
40
|
+
//# sourceMappingURL=ECSqlHiddenClassesSnippets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ECSqlHiddenClassesSnippets.d.ts","sourceRoot":"","sources":["../../../src/shared/ecsql-snippets/ECSqlHiddenClassesSnippets.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAElF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,yBAAyB,CAAC,KAAK,EAAE;IACrD,6EAA6E;IAC7E,cAAc,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;IAC/D,oEAAoE;IACpE,aAAa,EAAE,EAAE,CAAC,wBAAwB,CAAC;CAC5C,GAAG,OAAO,CAAC;IACV;;;OAGG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/C,CAAC,CAGD"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { createClassSelector } from "./ECSqlValueSelectorSnippets.js";
|
|
6
|
+
/**
|
|
7
|
+
* Creates a filter that excludes instances of classes hidden through `CoreCustomAttributes.HiddenClass` or
|
|
8
|
+
* `CoreCustomAttributes.HiddenSchema` custom attributes, relative to the given base class:
|
|
9
|
+
* - The base class is the visibility boundary: `HiddenClass` attributes on it and on its own base classes are ignored,
|
|
10
|
+
* so it is never excluded, even if it's hidden. Its derived classes are excluded or included according to the rules
|
|
11
|
+
* described by `HiddenClassesTreeNode`.
|
|
12
|
+
* - Classes outside the base class' hierarchy are not affected, so the filter may be applied to queries selecting
|
|
13
|
+
* the base class, its derived class, or a broader class.
|
|
14
|
+
* - The base class should be the class the query is meant to select. When the query's `FROM` class gets specialized,
|
|
15
|
+
* e.g. by an instance filter, still pass the original class - otherwise, specializing to a hidden class would
|
|
16
|
+
* include its instances.
|
|
17
|
+
*
|
|
18
|
+
* The hidden classes tree is requested from `schemaProvider` once, when creating the filter, and errors are
|
|
19
|
+
* propagated. Caching the tree is the provider's responsibility, so create the filter when building queries and
|
|
20
|
+
* reuse it for all aliases within the same operation, rather than holding on to it.
|
|
21
|
+
*
|
|
22
|
+
* Usage example:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* const filter = await ECSql.createHiddenClassesFilter({ schemaProvider, baseClassName: "BisCore.GeometricElement3d" });
|
|
26
|
+
* const whereClause = filter.createWhereClause("e");
|
|
27
|
+
* const ecsql = `SELECT e.ECInstanceId FROM bis.GeometricElement3d e ${whereClause ? `WHERE ${whereClause}` : ""}`;
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export async function createHiddenClassesFilter(props) {
|
|
33
|
+
const tree = await props.schemaProvider.getHiddenClassesTree(props.baseClassName);
|
|
34
|
+
return { createWhereClause: (classAlias) => createHiddenClassesWhereClause({ tree, classAlias }) };
|
|
35
|
+
}
|
|
36
|
+
function createHiddenClassesWhereClause(props) {
|
|
37
|
+
// Instances of the selected class are visible by default, so root `show` nodes are redundant - only their
|
|
38
|
+
// hidden descendants restrict anything.
|
|
39
|
+
const rootNodes = getRestrictingRootNodes(props.tree);
|
|
40
|
+
return createHideClause(rootNodes, props.classAlias) ?? "";
|
|
41
|
+
}
|
|
42
|
+
function getRestrictingRootNodes(nodes) {
|
|
43
|
+
return nodes.flatMap((node) => (node.state === "show" ? getRestrictingRootNodes(node.children) : [node]));
|
|
44
|
+
}
|
|
45
|
+
/** Creates a clause that excludes the given hidden nodes, except for their shown descendants. */
|
|
46
|
+
function createHideClause(nodes, classAlias) {
|
|
47
|
+
if (nodes.length === 0) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const hideClause = `[${classAlias}].[ECClassId] IS NOT (${createClassesList(nodes)})`;
|
|
51
|
+
const showClause = createShowClause(nodes.flatMap(({ children }) => children), classAlias);
|
|
52
|
+
return showClause ? `(${hideClause} OR ${showClause})` : hideClause;
|
|
53
|
+
}
|
|
54
|
+
/** Creates a clause that includes the given shown nodes, except for their hidden descendants. */
|
|
55
|
+
function createShowClause(nodes, classAlias) {
|
|
56
|
+
if (nodes.length === 0) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
const showClause = `[${classAlias}].[ECClassId] IS (${createClassesList(nodes)})`;
|
|
60
|
+
const hideClause = createHideClause(nodes.flatMap(({ children }) => children), classAlias);
|
|
61
|
+
return hideClause ? `(${showClause} AND ${hideClause})` : showClause;
|
|
62
|
+
}
|
|
63
|
+
function createClassesList(nodes) {
|
|
64
|
+
return nodes.map(({ fullName }) => createClassSelector(fullName)).join(", ");
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=ECSqlHiddenClassesSnippets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ECSqlHiddenClassesSnippets.js","sourceRoot":"","sources":["../../../src/shared/ecsql-snippets/ECSqlHiddenClassesSnippets.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAKtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,KAK/C;IAOC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAClF,OAAO,EAAE,iBAAiB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,8BAA8B,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;AACrG,CAAC;AAED,SAAS,8BAA8B,CAAC,KAGvC;IACC,0GAA0G;IAC1G,wCAAwC;IACxC,MAAM,SAAS,GAAG,uBAAuB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtD,OAAO,gBAAgB,CAAC,SA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AQ,UAAU,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;AACvE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAA4C;IACrE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { ECSqlBinding } from "../ECSqlCore.js";
|
|
2
|
+
import type { EC, ECSchemaProvider, RelationshipPath, RelationshipPathStep } from "../Metadata.js";
|
|
3
|
+
/**
|
|
4
|
+
* Describes a single JOIN step from source to target through a relationship.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
interface JoinRelationshipPathStep extends RelationshipPathStep {
|
|
8
|
+
sourceAlias: string;
|
|
9
|
+
targetAlias: string;
|
|
10
|
+
relationshipAlias: string;
|
|
11
|
+
joinType?: "inner" | "outer";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Describes a path of JOINs from source to target.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
type JoinRelationshipPath = RelationshipPath<JoinRelationshipPathStep>;
|
|
18
|
+
/**
|
|
19
|
+
* Props for `createRelationshipPathJoinClause` and `createRelationshipPathJoinInfo`.
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
export interface CreateRelationshipPathJoinClauseProps {
|
|
23
|
+
schemaProvider: ECSchemaProvider;
|
|
24
|
+
path: JoinRelationshipPath;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A join onto a plain class table.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
interface JoinTargetClass {
|
|
31
|
+
kind: "class";
|
|
32
|
+
className: EC.FullClassNameDotNotation;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A join onto a pre-joined relationship subquery (the outer link-table case), i.e.
|
|
36
|
+
* `(SELECT [rel].* FROM [relationship] [rel] INNER JOIN [target] [t] ON <innerJoinCondition>)`.
|
|
37
|
+
* Rendering emits the subquery; the outer target is a separate `RelationshipJoinInfo` entry.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
interface JoinTargetRelationshipSelect {
|
|
41
|
+
kind: "relationship-select";
|
|
42
|
+
relationshipClassName: EC.FullClassNameDotNotation;
|
|
43
|
+
relationshipAlias: string;
|
|
44
|
+
/** The class inner-joined inside the subquery, its alias, and the inner `ON` condition. */
|
|
45
|
+
innerTarget: JoinTargetClass;
|
|
46
|
+
innerTargetAlias: string;
|
|
47
|
+
innerJoinCondition: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One concrete JOIN clause rendered as either `INNER JOIN ... ON ...` or `LEFT OUTER JOIN ... ON ...`.
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
interface RelationshipJoinInfo {
|
|
54
|
+
joinType: "inner" | "outer";
|
|
55
|
+
/** What is joined: a class table, or (outer link-table case) a nested relationship SELECT. */
|
|
56
|
+
joinTarget: JoinTargetClass | JoinTargetRelationshipSelect;
|
|
57
|
+
/** Alias assigned to the joined table. */
|
|
58
|
+
joinAlias: string;
|
|
59
|
+
/** The `ON` condition expression (without the `ON` keyword). */
|
|
60
|
+
joinCondition: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Per-path-step resolution info that is not tied to a specific JOIN clause.
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
interface RelationshipPathStepJoinInfo {
|
|
67
|
+
/**
|
|
68
|
+
* The ordered JOIN clauses to emit — one entry per JOIN. A path step contributes 1 (navigation
|
|
69
|
+
* property) or 2 (link-table) entries. Note the join-table count is not `joins.length`: an
|
|
70
|
+
* outer link-table entry (`JoinTargetRelationshipSelect`) wraps a subquery that itself joins the
|
|
71
|
+
* relationship + target.
|
|
72
|
+
*/
|
|
73
|
+
joins: RelationshipJoinInfo[];
|
|
74
|
+
/**
|
|
75
|
+
* An ECSQL selector that yields the step's concrete relationship `ECClassId` for the actual data
|
|
76
|
+
* row being traversed. The concept is the same for every step; only the expression differs by how
|
|
77
|
+
* the relationship is represented:
|
|
78
|
+
* - link-table step: `[relationship_alias].[ECClassId]` (the joined relationship table),
|
|
79
|
+
* - navigation-property step: `[owner_alias].[navigation_property_name].[RelECClassId]`, where the
|
|
80
|
+
* owner alias is the source or target of the step depending on the navigation property direction.
|
|
81
|
+
*
|
|
82
|
+
* Note: for `outer` joins the relationship row / navigation value may be `NULL` when nothing is
|
|
83
|
+
* related, in which case this selector yields `NULL`.
|
|
84
|
+
*/
|
|
85
|
+
relationshipClassIdSelector: string;
|
|
86
|
+
/**
|
|
87
|
+
* An ECSQL selector that yields the step's concrete source `ECClassId` for the actual data row
|
|
88
|
+
* being traversed, i.e. `[source_alias].[ECClassId]` of the class the step is joined from.
|
|
89
|
+
*/
|
|
90
|
+
sourceClassIdSelector: string;
|
|
91
|
+
/**
|
|
92
|
+
* An ECSQL selector that yields the step's concrete target `ECClassId` for the actual data row
|
|
93
|
+
* being traversed, i.e. `[target_alias].[ECClassId]` of the class the step is joined to.
|
|
94
|
+
*
|
|
95
|
+
* Note: for `outer` joins the target row may be `NULL` when nothing is related, in which case this
|
|
96
|
+
* selector yields `NULL`.
|
|
97
|
+
*/
|
|
98
|
+
targetClassIdSelector: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A resolved, render-ready description of a relationship-path JOIN, as a flat, ordered list of
|
|
102
|
+
* concrete join clauses. Produced by `createRelationshipPathJoinInfo`; consumed by the
|
|
103
|
+
* `createRelationshipPathJoinClause` render overload.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
interface RelationshipPathJoinInfo {
|
|
107
|
+
/** Per-path-step resolution info, one entry per input path step, in path order. */
|
|
108
|
+
steps: RelationshipPathStepJoinInfo[];
|
|
109
|
+
/** `instanceFilter` bindings collected across all steps, or `undefined` when none. */
|
|
110
|
+
bindings?: Record<string, ECSqlBinding>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolves a relationship path into a `RelationshipPathJoinInfo` (schema-reading pass; produces no ECSQL).
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
export declare function createRelationshipPathJoinInfo(props: CreateRelationshipPathJoinClauseProps): Promise<RelationshipPathJoinInfo>;
|
|
117
|
+
/**
|
|
118
|
+
* Result of `createRelationshipPathJoinClause`.
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
interface RelationshipPathJoinClauseResult {
|
|
122
|
+
joins: string;
|
|
123
|
+
bindings?: Record<string, ECSqlBinding>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Creates an ECSQL JOIN snippet for given relationships' path.
|
|
127
|
+
*
|
|
128
|
+
* When a step specifies `instanceFilter`, its resolved expression is appended as an `AND`
|
|
129
|
+
* condition to the target class JOIN's `ON` clause. In the outer-join case the condition also
|
|
130
|
+
* appears on the `INNER JOIN` inside the subquery so the pre-joined subquery is already
|
|
131
|
+
* filtered. Bindings declared in `instanceFilter.bindings` across all steps are collected
|
|
132
|
+
* and returned alongside the SQL string.
|
|
133
|
+
*
|
|
134
|
+
* Possible results:
|
|
135
|
+
* - When the relationship is represented by a navigation property on either source or target:
|
|
136
|
+
* ```SQL
|
|
137
|
+
* INNER JOIN [target_schema_name].[target_class_name] [target_alias] ON [target_alias].[navigation_property_name].[Id] = [source_alias].[ECInstanceId]
|
|
138
|
+
* ```
|
|
139
|
+
* - When outer joining through a non-navigation-property relationship:
|
|
140
|
+
* ```SQL
|
|
141
|
+
* LEFT OUTER JOIN (
|
|
142
|
+
* SELECT [relationship_alias].*
|
|
143
|
+
* FROM [relationship_schema_name].[relationship_class_name] [relationship_alias]
|
|
144
|
+
* INNER JOIN [target_schema_name].[target_class_name] [target_alias] ON [target_alias].[ECInstanceId] = [relationship_alias].[TargetECInstanceId]
|
|
145
|
+
* ) [relationship_alias] ON [relationship_alias].[SourceECInstanceId] = [source_alias].[ECInstanceId]
|
|
146
|
+
* LEFT OUTER JOIN [target_schema_name].[target_class_name] [target_alias] ON [target_alias].[ECInstanceId] = [relationship_alias].[TargetECInstanceId]
|
|
147
|
+
* ```
|
|
148
|
+
* - When inner joining through a non-navigation-property relationship:
|
|
149
|
+
* ```SQL
|
|
150
|
+
* INNER JOIN [relationship_schema_name].[relationship_class_name] [relationship_alias] ON [relationship_alias].[SourceECInstanceId] = [source_alias].[ECInstanceId]
|
|
151
|
+
* INNER JOIN [target_schema_name].[target_class_name] [target_alias] ON [target_alias].[ECInstanceId] = [relationship_alias].[TargetECInstanceId]
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* @returns An object containing:
|
|
155
|
+
* - `joins`: the ECSQL JOIN clause string to embed in a query.
|
|
156
|
+
* - `bindings`: ECSQL parameter bindings collected from `instanceFilter.bindings` across all steps,
|
|
157
|
+
* or `undefined` if no step specified any bindings.
|
|
158
|
+
* @public
|
|
159
|
+
*/
|
|
160
|
+
export declare function createRelationshipPathJoinClause(props: CreateRelationshipPathJoinClauseProps): Promise<RelationshipPathJoinClauseResult>;
|
|
161
|
+
/**
|
|
162
|
+
* Render a pre-resolved `RelationshipPathJoinInfo` into an ECSQL JOIN clause (sync, no schema access).
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
export declare function createRelationshipPathJoinClause(props: RenderRelationshipPathJoinClauseProps): RelationshipPathJoinClauseResult;
|
|
166
|
+
/**
|
|
167
|
+
* Props for `createRelationshipPathJoinClause` overload that renders a pre-resolved `RelationshipPathJoinInfo` (sync, no schema access).
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
type RenderRelationshipPathJoinClauseProps = Pick<RelationshipPathJoinInfo, "bindings"> & {
|
|
171
|
+
steps: Array<Pick<RelationshipPathJoinInfo["steps"][number], "joins">>;
|
|
172
|
+
};
|
|
173
|
+
export {};
|
|
174
|
+
//# sourceMappingURL=ECSqlJoinSnippets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ECSqlJoinSnippets.d.ts","sourceRoot":"","sources":["../../../src/shared/ecsql-snippets/ECSqlJoinSnippets.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEnG;;;GAGG;AACH,UAAU,wBAAyB,SAAQ,oBAAoB;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,KAAK,oBAAoB,GAAG,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,qCAAqC;IACpD,cAAc,EAAE,gBAAgB,CAAC;IACjC,IAAI,EAAE,oBAAoB,CAAC;CAC5B;AAED;;;GAGG;AACH,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC;CACxC;AAED;;;;;GAKG;AACH,UAAU,4BAA4B;IACpC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,qBAAqB,EAAE,EAAE,CAAC,wBAAwB,CAAC;IACnD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2FAA2F;IAC3F,WAAW,EAAE,eAAe,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,8FAA8F;IAC9F,UAAU,EAAE,eAAe,GAAG,4BA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