@itwin/presentation-backend 4.6.0-dev.8 → 4.6.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 +20 -1
- package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js +3 -2
- package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/NativePlatform.js +2 -2
- package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
- package/lib/cjs/presentation-backend/Presentation.js +6 -6
- package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManager.js +2 -2
- package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js +1 -1
- package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js +13 -4
- package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
- package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
- package/lib/cjs/presentation-backend/Utils.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js +1 -1
- package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
- package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
- package/package.json +17 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"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IAAI,IAAI,CAAC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE;gBACnJ,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAC9B;iBAAM,IAAI,SAAS,EAAE;gBACpB,OAAO,aAAa,CAAC,QAAQ,CAAC;gBAC9B,OAAO,aAAa,CAAC,oBAAoB,CAAC;gBAC1C,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;aAC9B;SACF;aAAM;YACL,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,IAAA,kDAA4B,EAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpH,MAAM,qBAAqB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAA,kDAA4B,EAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChI,IAAI,kBAAkB,IAAI,qBAAqB,EAAE;gBAC/C,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;aAC7B;SACF;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { parse as parseVersion } from \"semver\";\nimport { Element, IModelDb } from \"@itwin/core-backend\";\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\nimport {\n combineDiagnosticsSeverities,\n compareDiagnosticsSeverities,\n Diagnostics,\n DiagnosticsLogEntry,\n DiagnosticsOptions,\n InstanceKey,\n} from \"@itwin/presentation-common\";\n\nconst presentation = require(\"@itwin/presentation-common/lib/cjs/assets/locales/en/Presentation.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/** @internal */\nexport function getLocalizedStringEN(key: string) {\n let result = presentation;\n const [namespace, identifier] = key.split(\":\", 2);\n if (namespace !== \"Presentation\") {\n return key;\n }\n const keySteps = identifier.split(\".\");\n for (const keyStep of keySteps) {\n if (keyStep in result === false) {\n return key;\n }\n result = result[keyStep];\n }\n return typeof result === \"string\" ? result : key;\n}\n\n/** @internal */\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\n let key: InstanceKey | undefined;\n const query = `SELECT ECClassId FROM ${Element.classFullName} e WHERE ECInstanceId = ?`;\n imodel.withPreparedStatement(query, (stmt) => {\n try {\n stmt.bindId(1, id);\n if (stmt.step() === DbResult.BE_SQLITE_ROW) {\n key = { className: stmt.getValue(0).getClassNameForClassId().replace(\".\", \":\"), id };\n }\n } catch {}\n });\n return key;\n}\n\n/** @internal */\nexport function normalizeVersion(version?: string) {\n if (version) {\n const parsedVersion = parseVersion(version, true);\n if (parsedVersion) {\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\n }\n }\n return \"0.0.0\";\n}\n\n/**\n * A function that received request diagnostics and, optionally, request context.\n * @beta\n */\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\n\n/**\n * Data structure for backend diagnostics options.\n * @beta\n */\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\n /**\n * An optional function to supply request context that'll be passed to [[handler]] when\n * it's called after the request is fulfilled.\n */\n requestContextSupplier?: () => TContext;\n\n /**\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\n * receives request diagnostics as the first argument and, optionally, request context as the\n * second (see [[requestContextSupplier]]).\n */\n handler: BackendDiagnosticsHandler<TContext>;\n}\n\n/**\n * Data structure which contains backend diagnostics options.\n * @public\n */\nexport interface BackendDiagnosticsAttribute {\n /**\n * Backend diagnostics options.\n * @beta\n */\n diagnostics?: BackendDiagnosticsOptions;\n}\n\n/** @internal */\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\n const combinedOptions: DiagnosticsOptions = {};\n options.forEach((d) => {\n if (!d) {\n return;\n }\n if (\n d.perf === true ||\n (typeof d.perf === \"object\" &&\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\n ) {\n combinedOptions.perf = d.perf;\n }\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\n if (combinedDev) {\n combinedOptions.dev = combinedDev;\n }\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\n if (combinedEditor) {\n combinedOptions.editor = combinedEditor;\n }\n });\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\n}\n\n/** @internal */\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\n stripped && options.handler({ logs: stripped }, context);\n}\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\n const stripped: TEntry[] = [];\n diagnostics.forEach((entry) => {\n if (DiagnosticsLogEntry.isScope(entry)) {\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\n const strippedScope = { ...entry, logs: scopeLogs };\n if (!strippedScope.logs) {\n delete strippedScope.logs;\n }\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\n stripped.push(strippedScope);\n } else if (scopeLogs) {\n delete strippedScope.duration;\n delete strippedScope.scopeCreateTimestamp;\n stripped.push(strippedScope);\n }\n } else {\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\n if (matchesDevSeverity || matchesEditorSeverity) {\n stripped.push({ ...entry });\n }\n }\n });\n return stripped.length > 0 ? stripped : undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,mCAA+C;AAC/C,sDAAwD;AACxD,sDAA2D;AAC3D,oEAOoC;AAEpC,MAAM,YAAY,GAAG,OAAO,CAAC,wEAAwE,CAAC,CAAC,CAAC,yDAAyD;AAEjK,gBAAgB;AAChB,SAAgB,oBAAoB,CAAC,GAAW;IAC9C,IAAI,MAAM,GAAG,YAAY,CAAC;IAC1B,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAClD,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC;QACb,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AACnD,CAAC;AAdD,oDAcC;AAED,gBAAgB;AAChB,SAAgB,aAAa,CAAC,MAAgB,EAAE,EAAc;IAC5D,IAAI,GAA4B,CAAC;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ChD,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpD,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { parse as parseVersion } from \"semver\";\nimport { Element, IModelDb } from \"@itwin/core-backend\";\nimport { DbResult, Id64String } from \"@itwin/core-bentley\";\nimport {\n combineDiagnosticsSeverities,\n compareDiagnosticsSeverities,\n Diagnostics,\n DiagnosticsLogEntry,\n DiagnosticsOptions,\n InstanceKey,\n} from \"@itwin/presentation-common\";\n\nconst presentation = require(\"@itwin/presentation-common/lib/cjs/assets/locales/en/Presentation.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/** @internal */\nexport function getLocalizedStringEN(key: string) {\n let result = presentation;\n const [namespace, identifier] = key.split(\":\", 2);\n if (namespace !== \"Presentation\") {\n return key;\n }\n const keySteps = identifier.split(\".\");\n for (const keyStep of keySteps) {\n if (keyStep in result === false) {\n return key;\n }\n result = result[keyStep];\n }\n return typeof result === \"string\" ? result : key;\n}\n\n/** @internal */\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\n let key: InstanceKey | undefined;\n const query = `SELECT ECClassId FROM ${Element.classFullName} e WHERE ECInstanceId = ?`;\n imodel.withPreparedStatement(query, (stmt) => {\n try {\n stmt.bindId(1, id);\n if (stmt.step() === DbResult.BE_SQLITE_ROW) {\n key = { className: stmt.getValue(0).getClassNameForClassId().replace(\".\", \":\"), id };\n }\n } catch {}\n });\n return key;\n}\n\n/** @internal */\nexport function normalizeVersion(version?: string) {\n if (version) {\n const parsedVersion = parseVersion(version, true);\n if (parsedVersion) {\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\n }\n }\n return \"0.0.0\";\n}\n\n/**\n * A function that received request diagnostics and, optionally, request context.\n * @beta\n */\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\n\n/**\n * Data structure for backend diagnostics options.\n * @beta\n */\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\n /**\n * An optional function to supply request context that'll be passed to [[handler]] when\n * it's called after the request is fulfilled.\n */\n requestContextSupplier?: () => TContext;\n\n /**\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\n * receives request diagnostics as the first argument and, optionally, request context as the\n * second (see [[requestContextSupplier]]).\n */\n handler: BackendDiagnosticsHandler<TContext>;\n}\n\n/**\n * Data structure which contains backend diagnostics options.\n * @public\n */\nexport interface BackendDiagnosticsAttribute {\n /**\n * Backend diagnostics options.\n * @beta\n */\n diagnostics?: BackendDiagnosticsOptions;\n}\n\n/** @internal */\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\n const combinedOptions: DiagnosticsOptions = {};\n options.forEach((d) => {\n if (!d) {\n return;\n }\n if (\n d.perf === true ||\n (typeof d.perf === \"object\" &&\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\n ) {\n combinedOptions.perf = d.perf;\n }\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\n if (combinedDev) {\n combinedOptions.dev = combinedDev;\n }\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\n if (combinedEditor) {\n combinedOptions.editor = combinedEditor;\n }\n });\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\n}\n\n/** @internal */\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\n stripped && options.handler({ logs: stripped }, context);\n}\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\n const stripped: TEntry[] = [];\n diagnostics.forEach((entry) => {\n if (DiagnosticsLogEntry.isScope(entry)) {\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\n const strippedScope = { ...entry, logs: scopeLogs };\n if (!strippedScope.logs) {\n delete strippedScope.logs;\n }\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\n stripped.push(strippedScope);\n } else if (scopeLogs) {\n delete strippedScope.duration;\n delete strippedScope.scopeCreateTimestamp;\n stripped.push(strippedScope);\n }\n } else {\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\n if (matchesDevSeverity || matchesEditorSeverity) {\n stripped.push({ ...entry });\n }\n }\n });\n return stripped.length > 0 ? stripped : undefined;\n}\n"]}
|
|
@@ -55,5 +55,5 @@ exports.PresentationRules = PresentationRules;
|
|
|
55
55
|
(function (CodeSpec) {
|
|
56
56
|
CodeSpec["Ruleset"] = "PresentationRules:Ruleset";
|
|
57
57
|
})(CodeSpec = PresentationRules.CodeSpec || (PresentationRules.CodeSpec = {}));
|
|
58
|
-
})(PresentationRules
|
|
58
|
+
})(PresentationRules || (exports.PresentationRules = PresentationRules = {}));
|
|
59
59
|
//# sourceMappingURL=PresentationRulesDomain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationRulesDomain.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAqE;AACrE,mEAAqD;AAErD,gBAAgB;AAChB,MAAa,iBAAkB,SAAQ,qBAAM;IACpC,MAAM,KAAc,UAAU;QACnC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,sBAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"PresentationRulesDomain.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAqE;AACrE,mEAAqD;AAErD,gBAAgB;AAChB,MAAa,iBAAkB,SAAQ,qBAAM;IACpC,MAAM,KAAc,UAAU;QACnC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,sBAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACvE,sBAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAC1C,4BAAa,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AAZD,8CAYC;AAED,gBAAgB;AAChB,0BAA0B;AAC1B,WAAiB,iBAAiB;IAChC,mCAAmC;IACnC,IAAY,QAEX;IAFD,WAAY,QAAQ;QAClB,iDAAqC,CAAA;IACvC,CAAC,EAFW,QAAQ,GAAR,0BAAQ,KAAR,0BAAQ,QAEnB;AACH,CAAC,EALgB,iBAAiB,iCAAjB,iBAAiB,QAKjC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { ClassRegistry, Schema, Schemas } from \"@itwin/core-backend\";\nimport * as RulesetElements from \"./RulesetElements\";\n\n/** @internal */\nexport class PresentationRules extends Schema {\n public static override get schemaName(): string {\n return \"PresentationRules\";\n }\n\n /** Registers this schema and it's elements' classes */\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(PresentationRules.schemaName)) {\n Schemas.registerSchema(PresentationRules);\n ClassRegistry.registerModule(RulesetElements, this);\n }\n }\n}\n\n/** @internal */\n/* istanbul ignore next */\nexport namespace PresentationRules {\n // eslint-disable-line no-redeclare\n export enum CodeSpec {\n Ruleset = \"PresentationRules:Ruleset\",\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RulesetElements.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/RulesetElements.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,sDAAkE;AAClE,oDAA0C;AAE1C,oCAA4C;AAC5C,uEAA8D;AAE9D,gBAAgB;AAChB,MAAa,OAAQ,SAAQ,gCAAiB;IAC5C;;OAEG;IACI,MAAM,KAAc,SAAS;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAAC,QAAkB,EAAE,OAAmB,EAAE,OAA4B;QACnG,IAAI,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"RulesetElements.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/RulesetElements.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,sDAAkE;AAClE,oDAA0C;AAE1C,oCAA4C;AAC5C,uEAA8D;AAE9D,gBAAgB;AAChB,MAAa,OAAQ,SAAQ,gCAAiB;IAC5C;;OAEG;IACI,MAAM,KAAc,SAAS;QAClC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,iBAAiB,CAAC,QAAkB,EAAE,OAAmB,EAAE,OAA4B;QACnG,IAAI,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;QAC3B,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,IAAI,IAAI,IAAA,wBAAgB,EAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,kBAAI,CAAC;YACd,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,2CAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;YACzE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE;YACzB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,0BA0BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Core\n */\n\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { DefinitionElement, IModelDb } from \"@itwin/core-backend\";\nimport { Code } from \"@itwin/core-common\";\nimport { Ruleset as PresentationRuleset } from \"@itwin/presentation-common\";\nimport { normalizeVersion } from \"../Utils\";\nimport { PresentationRules } from \"./PresentationRulesDomain\";\n\n/** @internal */\nexport class Ruleset extends DefinitionElement {\n /**\n * Name of the `Ruleset` element class.\n */\n public static override get className(): string {\n return \"Ruleset\";\n }\n\n /**\n * Generates a unique code for a ruleset\n * @param iModelDb DB the ruleset is supposed to be inserted into\n * @param modelId ID of a the model this ruleset should be created in\n * @param ruleset The ruleset code is being created for\n */\n public static createRulesetCode(iModelDb: IModelDb, modelId: Id64String, ruleset: PresentationRuleset) {\n let codeValue = ruleset.id;\n if (ruleset.version) {\n codeValue += `@${normalizeVersion(ruleset.version)}`;\n }\n\n return new Code({\n spec: iModelDb.codeSpecs.getByName(PresentationRules.CodeSpec.Ruleset).id,\n scope: modelId.toString(),\n value: codeValue,\n });\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-backend",
|
|
3
|
-
"version": "4.6.0
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Backend of iTwin.js Presentation library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"main": "lib/cjs/presentation-backend.js",
|
|
24
24
|
"typings": "lib/cjs/presentation-backend",
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@itwin/core-backend": "^4.6.0
|
|
27
|
-
"@itwin/core-bentley": "^4.6.0
|
|
28
|
-
"@itwin/core-common": "^4.6.0
|
|
29
|
-
"@itwin/core-quantity": "^4.6.0
|
|
30
|
-
"@itwin/ecschema-metadata": "^4.6.0
|
|
31
|
-
"@itwin/presentation-common": "^4.6.0
|
|
26
|
+
"@itwin/core-backend": "^4.6.0",
|
|
27
|
+
"@itwin/core-bentley": "^4.6.0",
|
|
28
|
+
"@itwin/core-common": "^4.6.0",
|
|
29
|
+
"@itwin/core-quantity": "^4.6.0",
|
|
30
|
+
"@itwin/ecschema-metadata": "^4.6.0",
|
|
31
|
+
"@itwin/presentation-common": "^4.6.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@itwin/eslint-plugin": "4.0.
|
|
34
|
+
"@itwin/eslint-plugin": "^4.0.2",
|
|
35
35
|
"@sinonjs/fake-timers": "^11.2.2",
|
|
36
36
|
"@types/chai": "4.3.1",
|
|
37
37
|
"@types/chai-as-promised": "^7",
|
|
@@ -63,15 +63,16 @@
|
|
|
63
63
|
"rimraf": "^3.0.2",
|
|
64
64
|
"sinon": "^17.0.1",
|
|
65
65
|
"sinon-chai": "^3.7.0",
|
|
66
|
+
"source-map-support": "^0.5.6",
|
|
66
67
|
"typemoq": "^2.1.0",
|
|
67
|
-
"typescript": "~5.
|
|
68
|
-
"@itwin/build-tools": "4.6.0
|
|
69
|
-
"@itwin/core-
|
|
70
|
-
"@itwin/core-
|
|
71
|
-
"@itwin/core-
|
|
72
|
-
"@itwin/core-
|
|
73
|
-
"@itwin/ecschema-metadata": "4.6.0
|
|
74
|
-
"@itwin/presentation-common": "4.6.0
|
|
68
|
+
"typescript": "~5.3.3",
|
|
69
|
+
"@itwin/build-tools": "4.6.0",
|
|
70
|
+
"@itwin/core-backend": "4.6.0",
|
|
71
|
+
"@itwin/core-bentley": "4.6.0",
|
|
72
|
+
"@itwin/core-common": "4.6.0",
|
|
73
|
+
"@itwin/core-quantity": "4.6.0",
|
|
74
|
+
"@itwin/ecschema-metadata": "4.6.0",
|
|
75
|
+
"@itwin/presentation-common": "4.6.0"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
77
78
|
"object-hash": "^1.3.1",
|