@itwin/presentation-backend 5.0.0-dev.11 → 5.0.0-dev.110
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 +61 -1
- package/lib/cjs/package.json +1 -0
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts +31 -4
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +161 -56
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/InternalSymbols.d.ts +5 -0
- package/lib/cjs/presentation-backend/InternalSymbols.d.ts.map +1 -0
- package/lib/cjs/presentation-backend/InternalSymbols.js +16 -0
- package/lib/cjs/presentation-backend/InternalSymbols.js.map +1 -0
- package/lib/cjs/presentation-backend/NativePlatform.d.ts +2 -2
- package/lib/cjs/presentation-backend/NativePlatform.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.js +5 -3
- package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.d.ts +2 -7
- package/lib/cjs/presentation-backend/Presentation.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.js +40 -29
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts +3 -3
- package/lib/cjs/presentation-backend/PresentationIpcHandler.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationIpcHandler.js +5 -7
- package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.d.ts +13 -90
- package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +79 -130
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts +19 -10
- package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js +83 -76
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts +11 -11
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +110 -118
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.js +23 -24
- package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.d.ts +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.js +2 -1
- package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts +1 -1
- package/lib/cjs/presentation-backend/RulesetVariablesManager.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js +2 -0
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts +2 -4
- package/lib/cjs/presentation-backend/SelectionScopesHelper.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js +70 -83
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/TemporaryStorage.d.ts +2 -3
- package/lib/cjs/presentation-backend/TemporaryStorage.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/TemporaryStorage.js +30 -28
- package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
- package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js +15 -21
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +2 -2
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/RulesetElements.js +4 -4
- package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
- package/lib/cjs/presentation-backend-internal.d.ts +2 -0
- package/lib/cjs/presentation-backend-internal.d.ts.map +1 -0
- package/lib/cjs/presentation-backend-internal.js +12 -0
- package/lib/cjs/presentation-backend-internal.js.map +1 -0
- package/lib/cjs/presentation-backend.d.ts +7 -7
- package/lib/cjs/presentation-backend.d.ts.map +1 -1
- package/lib/cjs/presentation-backend.js +11 -21
- package/lib/cjs/presentation-backend.js.map +1 -1
- package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts +62 -0
- package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts.map +1 -0
- package/lib/esm/presentation-backend/BackendLoggerCategory.js +69 -0
- package/lib/esm/presentation-backend/BackendLoggerCategory.js.map +1 -0
- package/lib/esm/presentation-backend/ElementPropertiesHelper.d.ts +45 -0
- package/lib/esm/presentation-backend/ElementPropertiesHelper.d.ts.map +1 -0
- package/lib/esm/presentation-backend/ElementPropertiesHelper.js +187 -0
- package/lib/esm/presentation-backend/ElementPropertiesHelper.js.map +1 -0
- package/lib/esm/presentation-backend/InternalSymbols.d.ts +5 -0
- package/lib/esm/presentation-backend/InternalSymbols.d.ts.map +1 -0
- package/lib/esm/presentation-backend/InternalSymbols.js +13 -0
- package/lib/esm/presentation-backend/InternalSymbols.js.map +1 -0
- package/lib/esm/presentation-backend/NativePlatform.d.ts +89 -0
- package/lib/esm/presentation-backend/NativePlatform.d.ts.map +1 -0
- package/lib/esm/presentation-backend/NativePlatform.js +156 -0
- package/lib/esm/presentation-backend/NativePlatform.js.map +1 -0
- package/lib/esm/presentation-backend/Presentation.d.ts +97 -0
- package/lib/esm/presentation-backend/Presentation.d.ts.map +1 -0
- package/lib/esm/presentation-backend/Presentation.js +147 -0
- package/lib/esm/presentation-backend/Presentation.js.map +1 -0
- package/lib/esm/presentation-backend/PresentationIpcHandler.d.ts +12 -0
- package/lib/esm/presentation-backend/PresentationIpcHandler.d.ts.map +1 -0
- package/lib/esm/presentation-backend/PresentationIpcHandler.js +25 -0
- package/lib/esm/presentation-backend/PresentationIpcHandler.js.map +1 -0
- package/lib/esm/presentation-backend/PresentationManager.d.ts +387 -0
- package/lib/esm/presentation-backend/PresentationManager.d.ts.map +1 -0
- package/lib/esm/presentation-backend/PresentationManager.js +352 -0
- package/lib/esm/presentation-backend/PresentationManager.js.map +1 -0
- package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts +74 -0
- package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts.map +1 -0
- package/lib/esm/presentation-backend/PresentationManagerDetail.js +446 -0
- package/lib/esm/presentation-backend/PresentationManagerDetail.js.map +1 -0
- package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts +63 -0
- package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts.map +1 -0
- package/lib/esm/presentation-backend/PresentationRpcImpl.js +409 -0
- package/lib/esm/presentation-backend/PresentationRpcImpl.js.map +1 -0
- package/lib/esm/presentation-backend/RulesetEmbedder.d.ts +109 -0
- package/lib/esm/presentation-backend/RulesetEmbedder.d.ts.map +1 -0
- package/lib/esm/presentation-backend/RulesetEmbedder.js +269 -0
- package/lib/esm/presentation-backend/RulesetEmbedder.js.map +1 -0
- package/lib/esm/presentation-backend/RulesetManager.d.ts +54 -0
- package/lib/esm/presentation-backend/RulesetManager.d.ts.map +1 -0
- package/lib/esm/presentation-backend/RulesetManager.js +74 -0
- package/lib/esm/presentation-backend/RulesetManager.js.map +1 -0
- package/lib/esm/presentation-backend/RulesetVariablesManager.d.ts +141 -0
- package/lib/esm/presentation-backend/RulesetVariablesManager.d.ts.map +1 -0
- package/lib/esm/presentation-backend/RulesetVariablesManager.js +140 -0
- package/lib/esm/presentation-backend/RulesetVariablesManager.js.map +1 -0
- package/lib/esm/presentation-backend/SelectionScopesHelper.d.ts +27 -0
- package/lib/esm/presentation-backend/SelectionScopesHelper.d.ts.map +1 -0
- package/lib/esm/presentation-backend/SelectionScopesHelper.js +227 -0
- package/lib/esm/presentation-backend/SelectionScopesHelper.js.map +1 -0
- package/lib/esm/presentation-backend/TemporaryStorage.d.ts +123 -0
- package/lib/esm/presentation-backend/TemporaryStorage.d.ts.map +1 -0
- package/lib/esm/presentation-backend/TemporaryStorage.js +157 -0
- package/lib/esm/presentation-backend/TemporaryStorage.js.map +1 -0
- package/lib/esm/presentation-backend/Utils.d.ts +50 -0
- package/lib/esm/presentation-backend/Utils.d.ts.map +1 -0
- package/lib/esm/presentation-backend/Utils.js +101 -0
- package/lib/esm/presentation-backend/Utils.js.map +1 -0
- package/lib/esm/presentation-backend/domain/PresentationRulesDomain.d.ts +17 -0
- package/lib/esm/presentation-backend/domain/PresentationRulesDomain.d.ts.map +1 -0
- package/lib/esm/presentation-backend/domain/PresentationRulesDomain.js +31 -0
- package/lib/esm/presentation-backend/domain/PresentationRulesDomain.js.map +1 -0
- package/lib/esm/presentation-backend/domain/RulesetElements.d.ts +22 -0
- package/lib/esm/presentation-backend/domain/RulesetElements.d.ts.map +1 -0
- package/lib/esm/presentation-backend/domain/RulesetElements.js +38 -0
- package/lib/esm/presentation-backend/domain/RulesetElements.js.map +1 -0
- package/lib/esm/presentation-backend/primary-presentation-rules/ElementProperties.PresentationRuleSet.json +14 -0
- package/lib/esm/presentation-backend/supplemental-presentation-rules/BisCore.PresentationRuleSet.json +701 -0
- package/lib/esm/presentation-backend/supplemental-presentation-rules/Functional.PresentationRuleSet.json +139 -0
- package/lib/esm/presentation-backend-internal.d.ts +2 -0
- package/lib/esm/presentation-backend-internal.d.ts.map +1 -0
- package/lib/esm/presentation-backend-internal.js +8 -0
- package/lib/esm/presentation-backend-internal.js.map +1 -0
- package/lib/esm/presentation-backend.d.ts +20 -0
- package/lib/esm/presentation-backend.d.ts.map +1 -0
- package/lib/esm/presentation-backend.js +21 -0
- package/lib/esm/presentation-backend.js.map +1 -0
- package/package.json +42 -35
|
@@ -0,0 +1,269 @@
|
|
|
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
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Core
|
|
7
|
+
*/
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import { gt as versionGt, gte as versionGte, lt as versionLt } from "semver";
|
|
10
|
+
import { DefinitionModel, DefinitionPartition, KnownLocations, Subject } from "@itwin/core-backend";
|
|
11
|
+
import { assert } from "@itwin/core-bentley";
|
|
12
|
+
import { BisCodeSpec, Code, CodeScopeSpec, CodeSpec, IModel, QueryBinder, QueryRowFormat, } from "@itwin/core-common";
|
|
13
|
+
import { PresentationRules } from "./domain/PresentationRulesDomain.js";
|
|
14
|
+
import * as RulesetElements from "./domain/RulesetElements.js";
|
|
15
|
+
import { normalizeVersion } from "./Utils.js";
|
|
16
|
+
/**
|
|
17
|
+
* An API for embedding presentation rulesets into iModels.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export class RulesetEmbedder {
|
|
21
|
+
_imodel;
|
|
22
|
+
_parentSubjectId;
|
|
23
|
+
_schemaPath = path.join(KnownLocations.nativeAssetsDir, "ECSchemas/Domain/PresentationRules.ecschema.xml");
|
|
24
|
+
_rulesetModelName = "PresentationRules";
|
|
25
|
+
_rulesetSubjectName = "PresentationRules";
|
|
26
|
+
/**
|
|
27
|
+
* Constructs RulesetEmbedder
|
|
28
|
+
*/
|
|
29
|
+
constructor(props) {
|
|
30
|
+
PresentationRules.registerSchema();
|
|
31
|
+
this._imodel = props.imodel;
|
|
32
|
+
this._parentSubjectId = props.parentSubjectId ?? IModel.rootSubjectId;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Inserts a ruleset into iModel.
|
|
36
|
+
* @param ruleset Ruleset to insert.
|
|
37
|
+
* @param options Options for inserting a ruleset.
|
|
38
|
+
* @returns ID of inserted ruleset element or, if insertion was skipped, ID of existing ruleset with the same ID and highest version.
|
|
39
|
+
*/
|
|
40
|
+
async insertRuleset(ruleset, options) {
|
|
41
|
+
const normalizedOptions = normalizeRulesetInsertOptions(options);
|
|
42
|
+
const rulesetVersion = normalizeVersion(ruleset.version);
|
|
43
|
+
// ensure imodel has PresentationRules schema and required CodeSpecs
|
|
44
|
+
await this.handleElementOperationPrerequisites();
|
|
45
|
+
// find all rulesets with the same ID
|
|
46
|
+
const rulesetsWithSameId = [];
|
|
47
|
+
const query = `
|
|
48
|
+
SELECT ECInstanceId, JsonProperties
|
|
49
|
+
FROM ${RulesetElements.Ruleset.schema.name}.${RulesetElements.Ruleset.className}
|
|
50
|
+
WHERE json_extract(JsonProperties, '$.jsonProperties.id') = :rulesetId`;
|
|
51
|
+
const reader = this._imodel.createQueryReader(query, QueryBinder.from({ rulesetId: ruleset.id }), { rowFormat: QueryRowFormat.UseJsPropertyNames });
|
|
52
|
+
while (await reader.step()) {
|
|
53
|
+
const row = reader.current.toRow();
|
|
54
|
+
const existingRulesetElementId = row.id;
|
|
55
|
+
const existingRuleset = JSON.parse(row.jsonProperties).jsonProperties;
|
|
56
|
+
rulesetsWithSameId.push({
|
|
57
|
+
id: existingRulesetElementId,
|
|
58
|
+
ruleset: existingRuleset,
|
|
59
|
+
normalizedVersion: normalizeVersion(existingRuleset.version),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
// check if we need to do anything at all
|
|
63
|
+
const shouldSkip = (normalizedOptions.skip === "same-id" && rulesetsWithSameId.length > 0) ||
|
|
64
|
+
(normalizedOptions.skip === "same-id-and-version-eq" && rulesetsWithSameId.some((entry) => entry.normalizedVersion === rulesetVersion)) ||
|
|
65
|
+
(normalizedOptions.skip === "same-id-and-version-gte" && rulesetsWithSameId.some((entry) => versionGte(entry.normalizedVersion, rulesetVersion)));
|
|
66
|
+
if (shouldSkip) {
|
|
67
|
+
// we're not inserting anything - return ID of the ruleset element with the highest version
|
|
68
|
+
const rulesetEntryWithHighestVersion = rulesetsWithSameId.reduce((highest, curr) => {
|
|
69
|
+
if (!highest.ruleset.version || (curr.ruleset.version && versionGt(curr.ruleset.version, highest.ruleset.version))) {
|
|
70
|
+
return curr;
|
|
71
|
+
}
|
|
72
|
+
return highest;
|
|
73
|
+
}, rulesetsWithSameId[0]);
|
|
74
|
+
return rulesetEntryWithHighestVersion.id;
|
|
75
|
+
}
|
|
76
|
+
// if requested, delete existing rulesets
|
|
77
|
+
const rulesetsToRemove = [];
|
|
78
|
+
const shouldRemove = (_, normalizedVersion) => {
|
|
79
|
+
switch (normalizedOptions.replaceVersions) {
|
|
80
|
+
case "all":
|
|
81
|
+
return normalizedVersion !== rulesetVersion;
|
|
82
|
+
case "all-lower":
|
|
83
|
+
return normalizedVersion !== rulesetVersion && versionLt(normalizedVersion, rulesetVersion);
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
};
|
|
87
|
+
rulesetsWithSameId.forEach((entry) => {
|
|
88
|
+
if (shouldRemove(entry.ruleset, entry.normalizedVersion)) {
|
|
89
|
+
rulesetsToRemove.push(entry.id);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
this._imodel.elements.deleteElement(rulesetsToRemove);
|
|
93
|
+
// attempt to update ruleset with same ID and version
|
|
94
|
+
const exactMatch = rulesetsWithSameId.find((curr) => curr.normalizedVersion === rulesetVersion);
|
|
95
|
+
if (exactMatch !== undefined) {
|
|
96
|
+
return this.updateRuleset(exactMatch.id, ruleset, normalizedOptions.onEntityUpdate);
|
|
97
|
+
}
|
|
98
|
+
// no exact match found - insert a new ruleset element
|
|
99
|
+
const model = await this.getOrCreateRulesetModel(normalizedOptions.onEntityInsert);
|
|
100
|
+
const rulesetCode = RulesetElements.Ruleset.createRulesetCode(this._imodel, model.id, ruleset);
|
|
101
|
+
return this.insertNewRuleset(ruleset, model, rulesetCode, normalizedOptions.onEntityInsert);
|
|
102
|
+
}
|
|
103
|
+
async updateRuleset(elementId, ruleset, callbacks) {
|
|
104
|
+
const existingRulesetElement = this._imodel.elements.tryGetElement(elementId);
|
|
105
|
+
assert(existingRulesetElement !== undefined);
|
|
106
|
+
existingRulesetElement.jsonProperties.jsonProperties = ruleset;
|
|
107
|
+
await this.updateElement(existingRulesetElement, callbacks);
|
|
108
|
+
this._imodel.saveChanges();
|
|
109
|
+
return existingRulesetElement.id;
|
|
110
|
+
}
|
|
111
|
+
async insertNewRuleset(ruleset, model, rulesetCode, callbacks) {
|
|
112
|
+
const props = {
|
|
113
|
+
model: model.id,
|
|
114
|
+
code: rulesetCode,
|
|
115
|
+
classFullName: RulesetElements.Ruleset.classFullName,
|
|
116
|
+
jsonProperties: { jsonProperties: ruleset },
|
|
117
|
+
};
|
|
118
|
+
const element = await this.insertElement(props, callbacks);
|
|
119
|
+
this._imodel.saveChanges();
|
|
120
|
+
return element.id;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get all rulesets embedded in the iModel.
|
|
124
|
+
*/
|
|
125
|
+
async getRulesets() {
|
|
126
|
+
if (!this._imodel.containsClass(RulesetElements.Ruleset.classFullName)) {
|
|
127
|
+
return [];
|
|
128
|
+
}
|
|
129
|
+
const rulesetList = [];
|
|
130
|
+
for await (const row of this._imodel.createQueryReader(`SELECT ECInstanceId AS id FROM ${RulesetElements.Ruleset.classFullName}`)) {
|
|
131
|
+
const rulesetElement = this._imodel.elements.getElement({ id: row.id });
|
|
132
|
+
const ruleset = rulesetElement.jsonProperties.jsonProperties;
|
|
133
|
+
rulesetList.push(ruleset);
|
|
134
|
+
}
|
|
135
|
+
return rulesetList;
|
|
136
|
+
}
|
|
137
|
+
async getOrCreateRulesetModel(callbacks) {
|
|
138
|
+
const rulesetModel = this.queryRulesetModel();
|
|
139
|
+
if (undefined !== rulesetModel) {
|
|
140
|
+
return rulesetModel;
|
|
141
|
+
}
|
|
142
|
+
const rulesetSubject = await this.insertSubject(callbacks);
|
|
143
|
+
const definitionPartition = await this.insertDefinitionPartition(rulesetSubject, callbacks);
|
|
144
|
+
return this.insertDefinitionModel(definitionPartition, callbacks);
|
|
145
|
+
}
|
|
146
|
+
queryRulesetModel() {
|
|
147
|
+
const definitionPartition = this.queryDefinitionPartition();
|
|
148
|
+
if (undefined === definitionPartition) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
return this._imodel.models.getSubModel(definitionPartition.id);
|
|
152
|
+
}
|
|
153
|
+
queryDefinitionPartition() {
|
|
154
|
+
const subject = this.querySubject();
|
|
155
|
+
if (undefined === subject) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
return this._imodel.elements.tryGetElement(DefinitionPartition.createCode(this._imodel, subject.id, this._rulesetModelName));
|
|
159
|
+
}
|
|
160
|
+
querySubject() {
|
|
161
|
+
const parent = this._imodel.elements.getElement(this._parentSubjectId);
|
|
162
|
+
const codeSpec = this._imodel.codeSpecs.getByName(BisCodeSpec.subject);
|
|
163
|
+
const code = new Code({
|
|
164
|
+
spec: codeSpec.id,
|
|
165
|
+
scope: parent.id,
|
|
166
|
+
value: this._rulesetSubjectName,
|
|
167
|
+
});
|
|
168
|
+
return this._imodel.elements.tryGetElement(code);
|
|
169
|
+
}
|
|
170
|
+
async insertDefinitionModel(definitionPartition, callbacks) {
|
|
171
|
+
const modelProps = {
|
|
172
|
+
modeledElement: definitionPartition,
|
|
173
|
+
name: this._rulesetModelName,
|
|
174
|
+
classFullName: DefinitionModel.classFullName,
|
|
175
|
+
isPrivate: true,
|
|
176
|
+
};
|
|
177
|
+
return this.insertModel(modelProps, callbacks);
|
|
178
|
+
}
|
|
179
|
+
async insertDefinitionPartition(rulesetSubject, callbacks) {
|
|
180
|
+
const partitionCode = DefinitionPartition.createCode(this._imodel, rulesetSubject.id, this._rulesetModelName);
|
|
181
|
+
const definitionPartitionProps = {
|
|
182
|
+
parent: {
|
|
183
|
+
id: rulesetSubject.id,
|
|
184
|
+
relClassName: "BisCore:SubjectOwnsPartitionElements",
|
|
185
|
+
},
|
|
186
|
+
model: rulesetSubject.model,
|
|
187
|
+
code: partitionCode,
|
|
188
|
+
classFullName: DefinitionPartition.classFullName,
|
|
189
|
+
};
|
|
190
|
+
return this.insertElement(definitionPartitionProps, callbacks);
|
|
191
|
+
}
|
|
192
|
+
async insertSubject(callbacks) {
|
|
193
|
+
const parent = this._imodel.elements.getElement(this._parentSubjectId);
|
|
194
|
+
const codeSpec = this._imodel.codeSpecs.getByName(BisCodeSpec.subject);
|
|
195
|
+
const subjectCode = new Code({
|
|
196
|
+
spec: codeSpec.id,
|
|
197
|
+
scope: parent.id,
|
|
198
|
+
value: this._rulesetSubjectName,
|
|
199
|
+
});
|
|
200
|
+
const subjectProps = {
|
|
201
|
+
classFullName: Subject.classFullName,
|
|
202
|
+
model: parent.model,
|
|
203
|
+
parent: {
|
|
204
|
+
id: parent.id,
|
|
205
|
+
relClassName: "BisCore:SubjectOwnsSubjects",
|
|
206
|
+
},
|
|
207
|
+
code: subjectCode,
|
|
208
|
+
};
|
|
209
|
+
return this.insertElement(subjectProps, callbacks);
|
|
210
|
+
}
|
|
211
|
+
async handleElementOperationPrerequisites() {
|
|
212
|
+
if (this._imodel.containsClass(RulesetElements.Ruleset.classFullName)) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
// import PresentationRules ECSchema
|
|
216
|
+
await this._imodel.importSchemas([this._schemaPath]);
|
|
217
|
+
// insert CodeSpec for ruleset elements
|
|
218
|
+
this._imodel.codeSpecs.insert(CodeSpec.create(this._imodel, PresentationRules.CodeSpec.Ruleset, CodeScopeSpec.Type.Model));
|
|
219
|
+
this._imodel.saveChanges();
|
|
220
|
+
}
|
|
221
|
+
async insertElement(props, callbacks) {
|
|
222
|
+
const element = this._imodel.elements.createElement(props);
|
|
223
|
+
/* c8 ignore next */
|
|
224
|
+
await callbacks?.onBeforeInsert(element);
|
|
225
|
+
try {
|
|
226
|
+
return this._imodel.elements.getElement(element.insert());
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
/* c8 ignore next */
|
|
230
|
+
await callbacks?.onAfterInsert(element);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async insertModel(props, callbacks) {
|
|
234
|
+
const model = this._imodel.models.createModel(props);
|
|
235
|
+
/* c8 ignore next */
|
|
236
|
+
await callbacks?.onBeforeInsert(model);
|
|
237
|
+
try {
|
|
238
|
+
model.id = model.insert();
|
|
239
|
+
return model;
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
/* c8 ignore next */
|
|
243
|
+
await callbacks?.onAfterInsert(model);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
async updateElement(element, callbacks) {
|
|
247
|
+
/* c8 ignore next */
|
|
248
|
+
await callbacks?.onBeforeUpdate(element);
|
|
249
|
+
try {
|
|
250
|
+
element.update();
|
|
251
|
+
}
|
|
252
|
+
finally {
|
|
253
|
+
/* c8 ignore next */
|
|
254
|
+
await callbacks?.onAfterUpdate(element);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function normalizeRulesetInsertOptions(options) {
|
|
259
|
+
if (options === undefined) {
|
|
260
|
+
return { skip: "same-id-and-version-eq", replaceVersions: "exact" };
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
skip: options.skip ?? "same-id-and-version-eq",
|
|
264
|
+
replaceVersions: options.replaceVersions ?? "exact",
|
|
265
|
+
onEntityUpdate: options.onEntityUpdate,
|
|
266
|
+
onEntityInsert: options.onEntityInsert,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=RulesetEmbedder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RulesetEmbedder.js","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetEmbedder.ts"],"names":[],"mapp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T,oBAAoB;YACpB,MAAM,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,KAAiB,EAAE,SAA2B;QACtE,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACrD,oBAAoB;QACpB,MAAM,SAAS,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC;YACH,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,oBAAoB;YACpB,MAAM,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,OAAgB,EAAE,SAA2B;QACvE,oBAAoB;QACpB,MAAM,SAAS,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,CAAC;gBAAS,CAAC;YACT,oBAAoB;YACpB,MAAM,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;CACF;AAED,SAAS,6BAA6B,CAAC,OAA8B;IACnE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,EAAE,IAAI,EAAE,wBAAwB,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC;IACtE,CAAC;IAED,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,wBAAwB;QAC9C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,OAAO;QACnD,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport * as path from \"path\";\r\nimport { gt as versionGt, gte as versionGte, lt as versionLt } from \"semver\";\r\nimport { DefinitionElement, DefinitionModel, DefinitionPartition, Element, Entity, IModelDb, KnownLocations, Model, Subject } from \"@itwin/core-backend\";\r\nimport { assert, Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n BisCodeSpec,\r\n Code,\r\n CodeScopeSpec,\r\n CodeSpec,\r\n DefinitionElementProps,\r\n ElementProps,\r\n IModel,\r\n InformationPartitionElementProps,\r\n ModelProps,\r\n QueryBinder,\r\n QueryRowFormat,\r\n SubjectProps,\r\n} from \"@itwin/core-common\";\r\nimport { Ruleset } from \"@itwin/presentation-common\";\r\nimport { PresentationRules } from \"./domain/PresentationRulesDomain.js\";\r\nimport * as RulesetElements from \"./domain/RulesetElements.js\";\r\nimport { normalizeVersion } from \"./Utils.js\";\r\n\r\n/**\r\n * Interface for callbacks which will be called before and after Element/Model updates\r\n * @public\r\n */\r\ninterface UpdateCallbacks {\r\n onBeforeUpdate: (props: Entity) => Promise<void>;\r\n onAfterUpdate: (props: Entity) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Interface for callbacks which will be called before and after Element/Model is inserted\r\n * @public\r\n */\r\ninterface InsertCallbacks {\r\n onBeforeInsert: (props: Entity) => Promise<void>;\r\n onAfterInsert: (props: Entity) => Promise<void>;\r\n}\r\n\r\n/**\r\n * Options for [[RulesetEmbedder.insertRuleset]] operation.\r\n * @public\r\n */\r\nexport interface RulesetInsertOptions {\r\n /**\r\n * When should insertion be skipped:\r\n * - `same-id` - if iModel already contains a ruleset with the same id and **any** version\r\n * - `same-id-and-version-eq` - if iModel already contains a ruleset with same id and version\r\n * - `same-id-and-version-gte` - if iModel already contains a ruleset with same id and\r\n * version greater or equal to version of the inserted ruleset.\r\n *\r\n * Defaults to `same-id-and-version-eq`.\r\n */\r\n skip?: \"never\" | \"same-id\" | \"same-id-and-version-eq\" | \"same-id-and-version-gte\";\r\n\r\n /**\r\n * Which existing versions of rulesets with same id should be replaced when we insert a new one:\r\n * - `all` - replace all rulesets with same id.\r\n * - `all-lower` - replace rulesets with same id and version lower than the version of inserted ruleset.\r\n * - `exact` - replace only the ruleset whose id and version matches the inserted ruleset.\r\n *\r\n * Defaults to `exact`.\r\n */\r\n replaceVersions?: \"all\" | \"all-lower\" | \"exact\";\r\n\r\n /**\r\n * Callbacks that will be called before and after `Entity` updates\r\n */\r\n onEntityUpdate?: UpdateCallbacks;\r\n\r\n /**\r\n * Callbacks that will be called before and after `Entity` is inserted\r\n */\r\n onEntityInsert?: InsertCallbacks;\r\n}\r\n\r\n/**\r\n * Properties for creating a `RulesetEmbedder` instance.\r\n * @public\r\n */\r\nexport interface RulesetEmbedderProps {\r\n /** iModel to embed rulesets to */\r\n imodel: IModelDb;\r\n /**\r\n * An ID of existing subject under which presentation ruleset will be located or created.\r\n * Defaults to 'IModel.rootSubjectId'.\r\n */\r\n parentSubjectId?: Id64String;\r\n}\r\n\r\n/**\r\n * An API for embedding presentation rulesets into iModels.\r\n * @public\r\n */\r\nexport class RulesetEmbedder {\r\n private _imodel: IModelDb;\r\n private _parentSubjectId: Id64String;\r\n private readonly _schemaPath = path.join(KnownLocations.nativeAssetsDir, \"ECSchemas/Domain/PresentationRules.ecschema.xml\");\r\n private readonly _rulesetModelName = \"PresentationRules\";\r\n private readonly _rulesetSubjectName = \"PresentationRules\";\r\n\r\n /**\r\n * Constructs RulesetEmbedder\r\n */\r\n public constructor(props: RulesetEmbedderProps) {\r\n PresentationRules.registerSchema();\r\n this._imodel = props.imodel;\r\n this._parentSubjectId = props.parentSubjectId ?? IModel.rootSubjectId;\r\n }\r\n\r\n /**\r\n * Inserts a ruleset into iModel.\r\n * @param ruleset Ruleset to insert.\r\n * @param options Options for inserting a ruleset.\r\n * @returns ID of inserted ruleset element or, if insertion was skipped, ID of existing ruleset with the same ID and highest version.\r\n */\r\n public async insertRuleset(ruleset: Ruleset, options?: RulesetInsertOptions): Promise<Id64String> {\r\n const normalizedOptions = normalizeRulesetInsertOptions(options);\r\n const rulesetVersion = normalizeVersion(ruleset.version);\r\n\r\n // ensure imodel has PresentationRules schema and required CodeSpecs\r\n await this.handleElementOperationPrerequisites();\r\n\r\n // find all rulesets with the same ID\r\n const rulesetsWithSameId: Array<{\r\n ruleset: Ruleset;\r\n id: Id64String;\r\n normalizedVersion: string;\r\n }> = [];\r\n const query = `\r\n SELECT ECInstanceId, JsonProperties\r\n FROM ${RulesetElements.Ruleset.schema.name}.${RulesetElements.Ruleset.className}\r\n WHERE json_extract(JsonProperties, '$.jsonProperties.id') = :rulesetId`;\r\n const reader = this._imodel.createQueryReader(query, QueryBinder.from({ rulesetId: ruleset.id }), { rowFormat: QueryRowFormat.UseJsPropertyNames });\r\n while (await reader.step()) {\r\n const row = reader.current.toRow();\r\n const existingRulesetElementId: Id64String = row.id;\r\n const existingRuleset: Ruleset = JSON.parse(row.jsonProperties).jsonProperties;\r\n rulesetsWithSameId.push({\r\n id: existingRulesetElementId,\r\n ruleset: existingRuleset,\r\n normalizedVersion: normalizeVersion(existingRuleset.version),\r\n });\r\n }\r\n\r\n // check if we need to do anything at all\r\n const shouldSkip =\r\n (normalizedOptions.skip === \"same-id\" && rulesetsWithSameId.length > 0) ||\r\n (normalizedOptions.skip === \"same-id-and-version-eq\" && rulesetsWithSameId.some((entry) => entry.normalizedVersion === rulesetVersion)) ||\r\n (normalizedOptions.skip === \"same-id-and-version-gte\" && rulesetsWithSameId.some((entry) => versionGte(entry.normalizedVersion, rulesetVersion)));\r\n if (shouldSkip) {\r\n // we're not inserting anything - return ID of the ruleset element with the highest version\r\n const rulesetEntryWithHighestVersion = rulesetsWithSameId.reduce((highest, curr) => {\r\n if (!highest.ruleset.version || (curr.ruleset.version && versionGt(curr.ruleset.version, highest.ruleset.version))) {\r\n return curr;\r\n }\r\n return highest;\r\n }, rulesetsWithSameId[0]);\r\n return rulesetEntryWithHighestVersion.id;\r\n }\r\n\r\n // if requested, delete existing rulesets\r\n const rulesetsToRemove: Id64String[] = [];\r\n const shouldRemove = (_: Ruleset, normalizedVersion: string): boolean => {\r\n switch (normalizedOptions.replaceVersions) {\r\n case \"all\":\r\n return normalizedVersion !== rulesetVersion;\r\n case \"all-lower\":\r\n return normalizedVersion !== rulesetVersion && versionLt(normalizedVersion, rulesetVersion);\r\n }\r\n return false;\r\n };\r\n rulesetsWithSameId.forEach((entry) => {\r\n if (shouldRemove(entry.ruleset, entry.normalizedVersion)) {\r\n rulesetsToRemove.push(entry.id);\r\n }\r\n });\r\n this._imodel.elements.deleteElement(rulesetsToRemove);\r\n\r\n // attempt to update ruleset with same ID and version\r\n const exactMatch = rulesetsWithSameId.find((curr) => curr.normalizedVersion === rulesetVersion);\r\n if (exactMatch !== undefined) {\r\n return this.updateRuleset(exactMatch.id, ruleset, normalizedOptions.onEntityUpdate);\r\n }\r\n\r\n // no exact match found - insert a new ruleset element\r\n const model = await this.getOrCreateRulesetModel(normalizedOptions.onEntityInsert);\r\n const rulesetCode = RulesetElements.Ruleset.createRulesetCode(this._imodel, model.id, ruleset);\r\n return this.insertNewRuleset(ruleset, model, rulesetCode, normalizedOptions.onEntityInsert);\r\n }\r\n\r\n private async updateRuleset(elementId: Id64String, ruleset: Ruleset, callbacks?: UpdateCallbacks) {\r\n const existingRulesetElement = this._imodel.elements.tryGetElement<DefinitionElement>(elementId);\r\n assert(existingRulesetElement !== undefined);\r\n existingRulesetElement.jsonProperties.jsonProperties = ruleset;\r\n\r\n await this.updateElement(existingRulesetElement, callbacks);\r\n\r\n this._imodel.saveChanges();\r\n return existingRulesetElement.id;\r\n }\r\n\r\n private async insertNewRuleset(ruleset: Ruleset, model: Model, rulesetCode: Code, callbacks?: InsertCallbacks): Promise<Id64String> {\r\n const props: DefinitionElementProps = {\r\n model: model.id,\r\n code: rulesetCode,\r\n classFullName: RulesetElements.Ruleset.classFullName,\r\n jsonProperties: { jsonProperties: ruleset },\r\n };\r\n\r\n const element = await this.insertElement(props, callbacks);\r\n this._imodel.saveChanges();\r\n return element.id;\r\n }\r\n\r\n /**\r\n * Get all rulesets embedded in the iModel.\r\n */\r\n public async getRulesets(): Promise<Ruleset[]> {\r\n if (!this._imodel.containsClass(RulesetElements.Ruleset.classFullName)) {\r\n return [];\r\n }\r\n\r\n const rulesetList: Ruleset[] = [];\r\n for await (const row of this._imodel.createQueryReader(`SELECT ECInstanceId AS id FROM ${RulesetElements.Ruleset.classFullName}`)) {\r\n const rulesetElement = this._imodel.elements.getElement({ id: row.id });\r\n const ruleset = rulesetElement.jsonProperties.jsonProperties;\r\n rulesetList.push(ruleset);\r\n }\r\n return rulesetList;\r\n }\r\n\r\n private async getOrCreateRulesetModel(callbacks?: InsertCallbacks): Promise<DefinitionModel> {\r\n const rulesetModel = this.queryRulesetModel();\r\n if (undefined !== rulesetModel) {\r\n return rulesetModel;\r\n }\r\n\r\n const rulesetSubject = await this.insertSubject(callbacks);\r\n const definitionPartition = await this.insertDefinitionPartition(rulesetSubject, callbacks);\r\n return this.insertDefinitionModel(definitionPartition, callbacks);\r\n }\r\n\r\n private queryRulesetModel(): DefinitionModel | undefined {\r\n const definitionPartition = this.queryDefinitionPartition();\r\n if (undefined === definitionPartition) {\r\n return undefined;\r\n }\r\n\r\n return this._imodel.models.getSubModel(definitionPartition.id);\r\n }\r\n\r\n private queryDefinitionPartition(): DefinitionPartition | undefined {\r\n const subject = this.querySubject();\r\n if (undefined === subject) {\r\n return undefined;\r\n }\r\n\r\n return this._imodel.elements.tryGetElement<DefinitionPartition>(DefinitionPartition.createCode(this._imodel, subject.id, this._rulesetModelName));\r\n }\r\n\r\n private querySubject(): Subject | undefined {\r\n const parent = this._imodel.elements.getElement<Subject>(this._parentSubjectId);\r\n const codeSpec: CodeSpec = this._imodel.codeSpecs.getByName(BisCodeSpec.subject);\r\n const code = new Code({\r\n spec: codeSpec.id,\r\n scope: parent.id,\r\n value: this._rulesetSubjectName,\r\n });\r\n\r\n return this._imodel.elements.tryGetElement<Subject>(code);\r\n }\r\n\r\n private async insertDefinitionModel(definitionPartition: DefinitionPartition, callbacks?: InsertCallbacks): Promise<DefinitionModel> {\r\n const modelProps: ModelProps = {\r\n modeledElement: definitionPartition,\r\n name: this._rulesetModelName,\r\n classFullName: DefinitionModel.classFullName,\r\n isPrivate: true,\r\n };\r\n\r\n return this.insertModel(modelProps, callbacks);\r\n }\r\n\r\n private async insertDefinitionPartition(rulesetSubject: Subject, callbacks?: InsertCallbacks): Promise<DefinitionPartition> {\r\n const partitionCode = DefinitionPartition.createCode(this._imodel, rulesetSubject.id, this._rulesetModelName);\r\n const definitionPartitionProps: InformationPartitionElementProps = {\r\n parent: {\r\n id: rulesetSubject.id,\r\n relClassName: \"BisCore:SubjectOwnsPartitionElements\",\r\n },\r\n model: rulesetSubject.model,\r\n code: partitionCode,\r\n classFullName: DefinitionPartition.classFullName,\r\n };\r\n\r\n return this.insertElement(definitionPartitionProps, callbacks);\r\n }\r\n\r\n private async insertSubject(callbacks?: InsertCallbacks): Promise<Subject> {\r\n const parent = this._imodel.elements.getElement<Subject>(this._parentSubjectId);\r\n const codeSpec: CodeSpec = this._imodel.codeSpecs.getByName(BisCodeSpec.subject);\r\n const subjectCode = new Code({\r\n spec: codeSpec.id,\r\n scope: parent.id,\r\n value: this._rulesetSubjectName,\r\n });\r\n const subjectProps: SubjectProps = {\r\n classFullName: Subject.classFullName,\r\n model: parent.model,\r\n parent: {\r\n id: parent.id,\r\n relClassName: \"BisCore:SubjectOwnsSubjects\",\r\n },\r\n code: subjectCode,\r\n };\r\n\r\n return this.insertElement(subjectProps, callbacks);\r\n }\r\n\r\n private async handleElementOperationPrerequisites(): Promise<void> {\r\n if (this._imodel.containsClass(RulesetElements.Ruleset.classFullName)) {\r\n return;\r\n }\r\n\r\n // import PresentationRules ECSchema\r\n await this._imodel.importSchemas([this._schemaPath]);\r\n\r\n // insert CodeSpec for ruleset elements\r\n this._imodel.codeSpecs.insert(CodeSpec.create(this._imodel, PresentationRules.CodeSpec.Ruleset, CodeScopeSpec.Type.Model));\r\n\r\n this._imodel.saveChanges();\r\n }\r\n\r\n private async insertElement<TProps extends ElementProps>(props: TProps, callbacks?: InsertCallbacks): Promise<Element> {\r\n const element = this._imodel.elements.createElement(props);\r\n /* c8 ignore next */\r\n await callbacks?.onBeforeInsert(element);\r\n try {\r\n return this._imodel.elements.getElement(element.insert());\r\n } finally {\r\n /* c8 ignore next */\r\n await callbacks?.onAfterInsert(element);\r\n }\r\n }\r\n\r\n private async insertModel(props: ModelProps, callbacks?: InsertCallbacks): Promise<Model> {\r\n const model = this._imodel.models.createModel(props);\r\n /* c8 ignore next */\r\n await callbacks?.onBeforeInsert(model);\r\n try {\r\n model.id = model.insert();\r\n return model;\r\n } finally {\r\n /* c8 ignore next */\r\n await callbacks?.onAfterInsert(model);\r\n }\r\n }\r\n\r\n private async updateElement(element: Element, callbacks?: UpdateCallbacks) {\r\n /* c8 ignore next */\r\n await callbacks?.onBeforeUpdate(element);\r\n try {\r\n element.update();\r\n } finally {\r\n /* c8 ignore next */\r\n await callbacks?.onAfterUpdate(element);\r\n }\r\n }\r\n}\r\n\r\nfunction normalizeRulesetInsertOptions(options?: RulesetInsertOptions): RulesetInsertOptions {\r\n if (options === undefined) {\r\n return { skip: \"same-id-and-version-eq\", replaceVersions: \"exact\" };\r\n }\r\n\r\n return {\r\n skip: options.skip ?? \"same-id-and-version-eq\",\r\n replaceVersions: options.replaceVersions ?? \"exact\",\r\n onEntityUpdate: options.onEntityUpdate,\r\n onEntityInsert: options.onEntityInsert,\r\n };\r\n}\r\n"]}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Core
|
|
3
|
+
*/
|
|
4
|
+
import { RegisteredRuleset, Ruleset } from "@itwin/presentation-common";
|
|
5
|
+
import { NativePlatformDefinition } from "./NativePlatform.js";
|
|
6
|
+
/**
|
|
7
|
+
* Presentation ruleset registry.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface RulesetManager {
|
|
11
|
+
/**
|
|
12
|
+
* Get a ruleset with the specified id.
|
|
13
|
+
*/
|
|
14
|
+
get(id: string): RegisteredRuleset | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Register the supplied ruleset
|
|
17
|
+
*/
|
|
18
|
+
add(ruleset: Ruleset): RegisteredRuleset;
|
|
19
|
+
/**
|
|
20
|
+
* Unregister the supplied ruleset
|
|
21
|
+
*/
|
|
22
|
+
remove(ruleset: RegisteredRuleset | [string, string]): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Remove all rulesets registered in this session.
|
|
25
|
+
*/
|
|
26
|
+
clear(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Presentation ruleset registry implementation.
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare class RulesetManagerImpl implements RulesetManager {
|
|
33
|
+
private _getNativePlatform;
|
|
34
|
+
private _registeredRulesets;
|
|
35
|
+
constructor(getNativePlatform: () => NativePlatformDefinition);
|
|
36
|
+
/**
|
|
37
|
+
* Get a ruleset with the specified id.
|
|
38
|
+
*/
|
|
39
|
+
get(id: string): RegisteredRuleset | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Register the supplied ruleset
|
|
42
|
+
*/
|
|
43
|
+
add(ruleset: Ruleset): RegisteredRuleset;
|
|
44
|
+
/**
|
|
45
|
+
* Unregister the supplied ruleset
|
|
46
|
+
*/
|
|
47
|
+
remove(ruleset: RegisteredRuleset | [string, string]): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Remove all rulesets registered in this session.
|
|
50
|
+
*/
|
|
51
|
+
clear(): void;
|
|
52
|
+
private saveRuleset;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=RulesetManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RulesetManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAE/C;;OAEG;IACH,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAAC;IAEzC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;IAE/D;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,cAAc;IACvD,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,mBAAmB,CAAwC;gBAEvD,iBAAiB,EAAE,MAAM,wBAAwB;IAI7D;;OAEG;IACI,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAcrD;;OAEG;IACI,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB;IAU/C;;OAEG;IACI,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO;IAcrE;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB,OAAO,CAAC,WAAW;CAKpB"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Core
|
|
7
|
+
*/
|
|
8
|
+
import { RegisteredRuleset } from "@itwin/presentation-common";
|
|
9
|
+
/**
|
|
10
|
+
* Presentation ruleset registry implementation.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export class RulesetManagerImpl {
|
|
14
|
+
_getNativePlatform;
|
|
15
|
+
_registeredRulesets = new Map();
|
|
16
|
+
constructor(getNativePlatform) {
|
|
17
|
+
this._getNativePlatform = getNativePlatform;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a ruleset with the specified id.
|
|
21
|
+
*/
|
|
22
|
+
get(id) {
|
|
23
|
+
const foundRuleset = this._registeredRulesets.get(id);
|
|
24
|
+
if (foundRuleset) {
|
|
25
|
+
return foundRuleset;
|
|
26
|
+
}
|
|
27
|
+
const serializedRulesetsArray = this._getNativePlatform().getRulesets(id).result;
|
|
28
|
+
const rulesetsArray = JSON.parse(serializedRulesetsArray);
|
|
29
|
+
if (0 === rulesetsArray.length) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return this.saveRuleset(rulesetsArray[0].ruleset, rulesetsArray[0].hash, (ruleset) => this.remove(ruleset));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Register the supplied ruleset
|
|
36
|
+
*/
|
|
37
|
+
add(ruleset) {
|
|
38
|
+
const foundRuleset = this._registeredRulesets.get(ruleset.id);
|
|
39
|
+
if (foundRuleset) {
|
|
40
|
+
return foundRuleset;
|
|
41
|
+
}
|
|
42
|
+
const hash = this._getNativePlatform().addRuleset(JSON.stringify(ruleset)).result;
|
|
43
|
+
return this.saveRuleset(ruleset, hash, (r) => this.remove(r));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Unregister the supplied ruleset
|
|
47
|
+
*/
|
|
48
|
+
remove(ruleset) {
|
|
49
|
+
let rulesetId, rulesetIdentifier;
|
|
50
|
+
if (Array.isArray(ruleset)) {
|
|
51
|
+
rulesetId = ruleset[0];
|
|
52
|
+
rulesetIdentifier = ruleset[1];
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
rulesetId = ruleset.id;
|
|
56
|
+
rulesetIdentifier = ruleset.uniqueIdentifier;
|
|
57
|
+
}
|
|
58
|
+
this._registeredRulesets.delete(rulesetId);
|
|
59
|
+
return this._getNativePlatform().removeRuleset(rulesetId, rulesetIdentifier).result;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Remove all rulesets registered in this session.
|
|
63
|
+
*/
|
|
64
|
+
clear() {
|
|
65
|
+
this._getNativePlatform().clearRulesets();
|
|
66
|
+
this._registeredRulesets.clear();
|
|
67
|
+
}
|
|
68
|
+
saveRuleset(ruleset, hash, disposeFunc) {
|
|
69
|
+
const newRuleset = new RegisteredRuleset(ruleset, hash, disposeFunc);
|
|
70
|
+
this._registeredRulesets.set(newRuleset.id, newRuleset);
|
|
71
|
+
return newRuleset;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=RulesetManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RulesetManager.js","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetManager.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,iBAAiB,EAAW,MAAM,4BAA4B,CAAC;AA6BxE;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,kBAAkB,CAAiC;IACnD,mBAAmB,GAAG,IAAI,GAAG,EAA6B,CAAC;IAEnE,YAAY,iBAAiD;QAC3D,IAAI,CAAC,kBAAkB,GAAG,iBAAiB,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,EAAU;QACnB,MAAM,YAAY,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,YAAY,CAAC;QACtB,CAAC;QAED,M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E,CAAC;YACvB,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC,MAAM,CAAC;IACtF,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,kBAAkB,EAAE,CAAC,aAAa,EAAE,CAAC;QAC1C,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;IACnC,CAAC;IAEO,WAAW,CAAC,OAAgB,EAAE,IAAY,EAAE,WAAiD;QACnG,MAAM,UAAU,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACrE,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n * See LICENSE.md in the project root for license terms and full copyright notice.\r\n *--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { RegisteredRuleset, Ruleset } from \"@itwin/presentation-common\";\r\nimport { NativePlatformDefinition } from \"./NativePlatform.js\";\r\n\r\n/**\r\n * Presentation ruleset registry.\r\n * @public\r\n */\r\nexport interface RulesetManager {\r\n /**\r\n * Get a ruleset with the specified id.\r\n */\r\n get(id: string): RegisteredRuleset | undefined;\r\n\r\n /**\r\n * Register the supplied ruleset\r\n */\r\n add(ruleset: Ruleset): RegisteredRuleset;\r\n\r\n /**\r\n * Unregister the supplied ruleset\r\n */\r\n remove(ruleset: RegisteredRuleset | [string, string]): boolean;\r\n\r\n /**\r\n * Remove all rulesets registered in this session.\r\n */\r\n clear(): void;\r\n}\r\n\r\n/**\r\n * Presentation ruleset registry implementation.\r\n * @internal\r\n */\r\nexport class RulesetManagerImpl implements RulesetManager {\r\n private _getNativePlatform: () => NativePlatformDefinition;\r\n private _registeredRulesets = new Map<string, RegisteredRuleset>();\r\n\r\n constructor(getNativePlatform: () => NativePlatformDefinition) {\r\n this._getNativePlatform = getNativePlatform;\r\n }\r\n\r\n /**\r\n * Get a ruleset with the specified id.\r\n */\r\n public get(id: string): RegisteredRuleset | undefined {\r\n const foundRuleset = this._registeredRulesets.get(id);\r\n if (foundRuleset) {\r\n return foundRuleset;\r\n }\r\n\r\n const serializedRulesetsArray = this._getNativePlatform().getRulesets(id).result;\r\n const rulesetsArray: RulesetResponseJson[] = JSON.parse(serializedRulesetsArray);\r\n if (0 === rulesetsArray.length) {\r\n return undefined;\r\n }\r\n return this.saveRuleset(rulesetsArray[0].ruleset, rulesetsArray[0].hash, (ruleset: RegisteredRuleset) => this.remove(ruleset));\r\n }\r\n\r\n /**\r\n * Register the supplied ruleset\r\n */\r\n public add(ruleset: Ruleset): RegisteredRuleset {\r\n const foundRuleset = this._registeredRulesets.get(ruleset.id);\r\n if (foundRuleset) {\r\n return foundRuleset;\r\n }\r\n\r\n const hash = this._getNativePlatform().addRuleset(JSON.stringify(ruleset)).result;\r\n return this.saveRuleset(ruleset, hash, (r: RegisteredRuleset) => this.remove(r));\r\n }\r\n\r\n /**\r\n * Unregister the supplied ruleset\r\n */\r\n public remove(ruleset: RegisteredRuleset | [string, string]): boolean {\r\n let rulesetId, rulesetIdentifier: string;\r\n if (Array.isArray(ruleset)) {\r\n rulesetId = ruleset[0];\r\n rulesetIdentifier = ruleset[1];\r\n } else {\r\n rulesetId = ruleset.id;\r\n rulesetIdentifier = ruleset.uniqueIdentifier;\r\n }\r\n\r\n this._registeredRulesets.delete(rulesetId);\r\n return this._getNativePlatform().removeRuleset(rulesetId, rulesetIdentifier).result;\r\n }\r\n\r\n /**\r\n * Remove all rulesets registered in this session.\r\n */\r\n public clear(): void {\r\n this._getNativePlatform().clearRulesets();\r\n this._registeredRulesets.clear();\r\n }\r\n\r\n private saveRuleset(ruleset: Ruleset, hash: string, disposeFunc: (ruleset: RegisteredRuleset) => void) {\r\n const newRuleset = new RegisteredRuleset(ruleset, hash, disposeFunc);\r\n this._registeredRulesets.set(newRuleset.id, newRuleset);\r\n return newRuleset;\r\n }\r\n}\r\n\r\ninterface RulesetResponseJson {\r\n ruleset: Ruleset;\r\n hash: string;\r\n}\r\n"]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Core
|
|
3
|
+
*/
|
|
4
|
+
import { Id64String } from "@itwin/core-bentley";
|
|
5
|
+
import { VariableValue, VariableValueTypes } from "@itwin/presentation-common";
|
|
6
|
+
import { NativePlatformDefinition } from "./NativePlatform.js";
|
|
7
|
+
/**
|
|
8
|
+
* Presentation ruleset variables registry.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface RulesetVariablesManager {
|
|
12
|
+
/** Gets a value of the specified type and ID */
|
|
13
|
+
getValue(variableId: string, type: VariableValueTypes): VariableValue;
|
|
14
|
+
/** Sets a value of the specified type */
|
|
15
|
+
setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
16
|
+
/** Unsets variable with given id. */
|
|
17
|
+
unset(variableId: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves `string` variable value.
|
|
20
|
+
* Returns empty string if variable does not exist or does not convert to string.
|
|
21
|
+
*/
|
|
22
|
+
getString(variableId: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Sets `string` variable value
|
|
25
|
+
*/
|
|
26
|
+
setString(variableId: string, value: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves `boolean` variable value.
|
|
29
|
+
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
30
|
+
*/
|
|
31
|
+
getBool(variableId: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Sets `boolean` variable value
|
|
34
|
+
*/
|
|
35
|
+
setBool(variableId: string, value: boolean): void;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves `number` variable value.
|
|
38
|
+
* Returns `0` if variable does not exist or does not convert to integer.
|
|
39
|
+
*/
|
|
40
|
+
getInt(variableId: string): number;
|
|
41
|
+
/**
|
|
42
|
+
* Sets `number` variable value
|
|
43
|
+
*/
|
|
44
|
+
setInt(variableId: string, value: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves `number[]` variable value.
|
|
47
|
+
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
48
|
+
*/
|
|
49
|
+
getInts(variableId: string): number[];
|
|
50
|
+
/**
|
|
51
|
+
* Sets `number[]` variable value
|
|
52
|
+
*/
|
|
53
|
+
setInts(variableId: string, value: number[]): void;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves `Id64String` variable value.
|
|
56
|
+
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
57
|
+
*/
|
|
58
|
+
getId64(variableId: string): Id64String;
|
|
59
|
+
/**
|
|
60
|
+
* Sets `Id64String` variable value
|
|
61
|
+
*/
|
|
62
|
+
setId64(variableId: string, value: Id64String): void;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves `Id64String[]` variable value.
|
|
65
|
+
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
66
|
+
*/
|
|
67
|
+
getId64s(variableId: string): Id64String[];
|
|
68
|
+
/**
|
|
69
|
+
* Sets `Id64String[]` variable value
|
|
70
|
+
*/
|
|
71
|
+
setId64s(variableId: string, value: Id64String[]): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Presentation ruleset variables registry implementation.
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export declare class RulesetVariablesManagerImpl implements RulesetVariablesManager {
|
|
78
|
+
private _getNativePlatform;
|
|
79
|
+
private _rulesetId;
|
|
80
|
+
constructor(getNativeAddon: () => NativePlatformDefinition, rulesetId: string);
|
|
81
|
+
setValueInternal(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
82
|
+
getValueInternal(variableId: string, type: VariableValueTypes): VariableValue;
|
|
83
|
+
setValue(variableId: string, type: VariableValueTypes, value: VariableValue): void;
|
|
84
|
+
unset(variableId: string): void;
|
|
85
|
+
getValue(variableId: string, type: VariableValueTypes): VariableValue;
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves `string` variable value.
|
|
88
|
+
* Returns empty string if variable does not exist or does not convert to string.
|
|
89
|
+
*/
|
|
90
|
+
getString(variableId: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* Sets `string` variable value
|
|
93
|
+
*/
|
|
94
|
+
setString(variableId: string, value: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Retrieves `boolean` variable value.
|
|
97
|
+
* Returns `false` if variable does not exist or does not convert to boolean.
|
|
98
|
+
*/
|
|
99
|
+
getBool(variableId: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Sets `boolean` variable value
|
|
102
|
+
*/
|
|
103
|
+
setBool(variableId: string, value: boolean): void;
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves `number` variable value.
|
|
106
|
+
* Returns `0` if variable does not exist or does not convert to integer.
|
|
107
|
+
*/
|
|
108
|
+
getInt(variableId: string): number;
|
|
109
|
+
/**
|
|
110
|
+
* Sets `number` variable value
|
|
111
|
+
*/
|
|
112
|
+
setInt(variableId: string, value: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieves `number[]` variable value.
|
|
115
|
+
* Returns empty array if variable does not exist or does not convert to integer array.
|
|
116
|
+
*/
|
|
117
|
+
getInts(variableId: string): number[];
|
|
118
|
+
/**
|
|
119
|
+
* Sets `number[]` variable value
|
|
120
|
+
*/
|
|
121
|
+
setInts(variableId: string, value: number[]): void;
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves `Id64String` variable value.
|
|
124
|
+
* Returns invalid Id64String if variable does not exist or does not convert to Id64String.
|
|
125
|
+
*/
|
|
126
|
+
getId64(variableId: string): Id64String;
|
|
127
|
+
/**
|
|
128
|
+
* Sets `Id64String` variable value
|
|
129
|
+
*/
|
|
130
|
+
setId64(variableId: string, value: Id64String): void;
|
|
131
|
+
/**
|
|
132
|
+
* Retrieves `Id64String[]` variable value.
|
|
133
|
+
* Returns empty array if variable does not exist or does not convert to Id64String array.
|
|
134
|
+
*/
|
|
135
|
+
getId64s(variableId: string): Id64String[];
|
|
136
|
+
/**
|
|
137
|
+
* Sets `Id64String[]` variable value
|
|
138
|
+
*/
|
|
139
|
+
setId64s(variableId: string, value: Id64String[]): void;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=RulesetVariablesManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RulesetVariablesManager.d.ts","sourceRoot":"","sources":["../../../src/presentation-backend/RulesetVariablesManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,aAAa,CAAC;IACtE,yCAAyC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACnF,qCAAqC;IACrC,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;OAGG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;I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