@itwin/presentation-backend 5.4.0-dev.6 → 5.4.0-dev.7

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  3. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js +14 -14
  4. package/lib/cjs/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  5. package/lib/cjs/presentation-backend/InternalSymbols.js.map +1 -1
  6. package/lib/cjs/presentation-backend/NativePlatform.js.map +1 -1
  7. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  8. package/lib/cjs/presentation-backend/PresentationIpcHandler.js.map +1 -1
  9. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  10. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  11. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  12. package/lib/cjs/presentation-backend/RulesetEmbedder.js +3 -3
  13. package/lib/cjs/presentation-backend/RulesetEmbedder.js.map +1 -1
  14. package/lib/cjs/presentation-backend/RulesetManager.js.map +1 -1
  15. package/lib/cjs/presentation-backend/RulesetVariablesManager.js.map +1 -1
  16. package/lib/cjs/presentation-backend/SelectionScopesHelper.js +16 -16
  17. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  18. package/lib/cjs/presentation-backend/TemporaryStorage.js.map +1 -1
  19. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  20. package/lib/cjs/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  21. package/lib/cjs/presentation-backend/domain/RulesetElements.js.map +1 -1
  22. package/lib/cjs/presentation-backend-internal.js.map +1 -1
  23. package/lib/cjs/presentation-backend.js.map +1 -1
  24. package/lib/esm/presentation-backend/BackendLoggerCategory.js.map +1 -1
  25. package/lib/esm/presentation-backend/ElementPropertiesHelper.js +14 -14
  26. package/lib/esm/presentation-backend/ElementPropertiesHelper.js.map +1 -1
  27. package/lib/esm/presentation-backend/InternalSymbols.js.map +1 -1
  28. package/lib/esm/presentation-backend/NativePlatform.js.map +1 -1
  29. package/lib/esm/presentation-backend/Presentation.js.map +1 -1
  30. package/lib/esm/presentation-backend/PresentationIpcHandler.js.map +1 -1
  31. package/lib/esm/presentation-backend/PresentationManager.js.map +1 -1
  32. package/lib/esm/presentation-backend/PresentationManagerDetail.js.map +1 -1
  33. package/lib/esm/presentation-backend/PresentationRpcImpl.js.map +1 -1
  34. package/lib/esm/presentation-backend/RulesetEmbedder.js +3 -3
  35. package/lib/esm/presentation-backend/RulesetEmbedder.js.map +1 -1
  36. package/lib/esm/presentation-backend/RulesetManager.js.map +1 -1
  37. package/lib/esm/presentation-backend/RulesetVariablesManager.js.map +1 -1
  38. package/lib/esm/presentation-backend/SelectionScopesHelper.js +16 -16
  39. package/lib/esm/presentation-backend/SelectionScopesHelper.js.map +1 -1
  40. package/lib/esm/presentation-backend/TemporaryStorage.js.map +1 -1
  41. package/lib/esm/presentation-backend/Utils.js.map +1 -1
  42. package/lib/esm/presentation-backend/domain/PresentationRulesDomain.js.map +1 -1
  43. package/lib/esm/presentation-backend/domain/RulesetElements.js.map +1 -1
  44. package/lib/esm/presentation-backend-internal.js.map +1 -1
  45. package/lib/esm/presentation-backend.js.map +1 -1
  46. package/package.json +15 -15
@@ -1 +1 @@
1
- {"version":3,"file":"TemporaryStorage.js","sourceRoot":"","sources":["../../../src/presentation-backend/TemporaryStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAmDnF;;;;;GAKG;AACH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAkB;IACtB,OAAO,CAAiC;IAClC,KAAK,CAA2B;IAEhD;;OAEG;IACH,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AE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAWD;;;;;GAKG;AACH,MAAM,OAAO,4BAAgC,SAAQ,gBAAmB;IAC7C,KAAK,CAAuC;IAErE;;OAEG;IACH,YAAY,KAA2C;QACrD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACa,QAAQ,CAAC,EAAU;QACjC,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,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 { assert } from \"@itwin/core-bentley\";\r\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Configuration properties for [[TemporaryStorage]].\r\n * @internal\r\n */\r\nexport interface TemporaryStorageProps<T> {\r\n /** A method that's called for every value before it's removed from storage */\r\n cleanupHandler?: (id: string, value: T, reason: \"timeout\" | \"dispose\" | \"request\") => void;\r\n\r\n onDisposedSingle?: (id: string) => void;\r\n onDisposedAll?: () => void;\r\n\r\n /**\r\n * An interval at which the storage attempts to clean up its values.\r\n * When `0` or `undefined` is specified, values are not cleaned up\r\n * automatically and cleanup has to be initiated manually by calling\r\n * [[TemporaryStorage.disposeOutdatedValues]].\r\n */\r\n cleanupInterval?: number;\r\n\r\n /**\r\n * Shortest period of time which the value should be kept in storage\r\n * unused before it's cleaned up.\r\n *\r\n * `undefined` means the values may be kept unused in the storage indefinitely.\r\n * `0` means the values are removed from the storage on every cleanup (either manual\r\n * call to [[TemporaryStorage.disposeOutdatedValues]] or scheduled (controlled\r\n * by [[cleanupInterval]])).\r\n */\r\n unusedValueLifetime?: number;\r\n\r\n /**\r\n * The maximum period of time which the value should be kept in storage\r\n * before it's cleaned up. The time is measured from the moment the value is added\r\n * to the storage.\r\n *\r\n * `undefined` means the values may be kept indefinitely. `0` means they're removed\r\n * up on every cleanup (either manual call to [[TemporaryStorage.disposeOutdatedValues]]\r\n * or scheduled (controlled by [[cleanupInterval]])).\r\n */\r\n maxValueLifetime?: number;\r\n}\r\n\r\n/** Value with know last used time */\r\ninterface TemporaryValue<T> {\r\n created: Date;\r\n lastUsed: Date;\r\n value: T;\r\n}\r\n\r\n/**\r\n * Storage for values that get removed from it after being unused (not-requested\r\n * for a specified amount of time).\r\n *\r\n * @internal\r\n */\r\nexport class TemporaryStorage<T> implements Disposable {\r\n private _timer?: NodeJS.Timeout;\r\n protected _values: Map<string, TemporaryValue<T>>;\r\n public readonly props: TemporaryStorageProps<T>;\r\n\r\n /**\r\n * Constructor. Creates the storage using supplied params.\r\n */\r\n constructor(props: TemporaryStorageProps<T>) {\r\n this.props = props;\r\n this._values = new Map<string, TemporaryValue<T>>();\r\n if (this.props.cleanupInterval) {\r\n this._timer = setInterval(this.disposeOutdatedValues, this.props.cleanupInterval);\r\n }\r\n }\r\n\r\n /**\r\n * Destructor. Must be called to clean up the stored values\r\n * and other resources\r\n */\r\n public [Symbol.dispose]() {\r\n if (this._timer) {\r\n clearInterval(this._timer);\r\n }\r\n\r\n if (this.props.cleanupHandler) {\r\n this._values.forEach((v, id) => {\r\n this.props.cleanupHandler!(id, v.value, \"dispose\");\r\n });\r\n }\r\n this._values.clear();\r\n this.props.onDisposedAll && this.props.onDisposedAll();\r\n }\r\n\r\n /**\r\n * Cleans up values that are currently outdated (based\r\n * on their max and unused value lifetimes specified through [[Props]]).\r\n */\r\n public disposeOutdatedValues = () => {\r\n const now = new Date().getTime();\r\n const valuesToDispose: string[] = [];\r\n for (const [key, entry] of this._values.entries()) {\r\n if (this.props.maxValueLifetime !== undefined) {\r\n if (this.props.maxValueLifetime === 0 || now - entry.created.getTime() > this.props.maxValueLifetime) {\r\n valuesToDispose.push(key);\r\n continue;\r\n }\r\n }\r\n if (this.props.unusedValueLifetime !== undefined) {\r\n if (this.props.unusedValueLifetime === 0 || now - entry.lastUsed.getTime() > this.props.unusedValueLifetime) {\r\n valuesToDispose.push(key);\r\n continue;\r\n }\r\n }\r\n }\r\n for (const id of valuesToDispose) {\r\n this.deleteExistingEntry(id, true);\r\n }\r\n };\r\n\r\n private deleteExistingEntry(id: string, isTimeout: boolean) {\r\n assert(this._values.has(id));\r\n this.props.cleanupHandler && this.props.cleanupHandler(id, this._values.get(id)!.value, isTimeout ? \"timeout\" : \"request\");\r\n this._values.delete(id);\r\n this.props.onDisposedSingle && this.props.onDisposedSingle(id);\r\n }\r\n\r\n /**\r\n * Get a value from the storage.\r\n *\r\n * **Note:** requesting a value with this method updates it's last used time.\r\n */\r\n public getValue(id: string): T | undefined {\r\n if (this._values.has(id)) {\r\n const v = this._values.get(id)!;\r\n v.lastUsed = new Date();\r\n return v.value;\r\n }\r\n return undefined;\r\n }\r\n\r\n public notifyValueUsed(id: string) {\r\n const entry = this._values.get(id);\r\n if (entry) {\r\n entry.lastUsed = new Date();\r\n }\r\n }\r\n\r\n /**\r\n * Adds a value into the storage.\r\n * @throws An error when trying to add a value with ID that's already stored in the storage.\r\n */\r\n public addValue(id: string, value: T) {\r\n if (this._values.has(id)) {\r\n throw new PresentationError(PresentationStatus.InvalidArgument, `A value with given ID \"${id}\" already exists in this storage.`);\r\n }\r\n this._values.set(id, { value, created: new Date(), lastUsed: new Date() });\r\n }\r\n\r\n /** Deletes a value with given id. */\r\n public deleteValue(id: string) {\r\n if (this._values.has(id)) {\r\n this.deleteExistingEntry(id, false);\r\n }\r\n }\r\n\r\n /**\r\n * Get all values currently in this storage.\r\n *\r\n * **Note:** requesting values with this method **doesn't**\r\n * update their last used times.\r\n */\r\n public get values(): T[] {\r\n const values = new Array<T>();\r\n for (const v of this._values.values()) {\r\n values.push(v.value);\r\n }\r\n return values;\r\n }\r\n}\r\n\r\n/**\r\n * Configuration properties for [[FactoryBasedTemporaryStorage]].\r\n * @internal\r\n */\r\nexport interface FactoryBasedTemporaryStorageProps<T> extends TemporaryStorageProps<T> {\r\n /** A factory method that creates a stored value given it's identifier */\r\n factory: (id: string, onValueUsed: () => void) => T;\r\n}\r\n\r\n/**\r\n * Storage for values that get removed from it after being unused (not-requested\r\n * for a specified amount of time).\r\n *\r\n * @internal\r\n */\r\nexport class FactoryBasedTemporaryStorage<T> extends TemporaryStorage<T> {\r\n public override readonly props: FactoryBasedTemporaryStorageProps<T>;\r\n\r\n /**\r\n * Constructor. Creates the storage using supplied params.\r\n */\r\n constructor(props: FactoryBasedTemporaryStorageProps<T>) {\r\n super(props);\r\n this.props = props;\r\n }\r\n\r\n /**\r\n * Get a value from the storage. If the value with the specified id\r\n * doesn't exist, it gets created.\r\n *\r\n * **Note:** requesting a value with this method updates it's last used time.\r\n */\r\n public override getValue(id: string): T {\r\n const existingValue = super.getValue(id);\r\n if (existingValue) {\r\n return existingValue;\r\n }\r\n\r\n const value = this.props.factory(id, () => this.notifyValueUsed(id));\r\n this.addValue(id, value);\r\n return value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TemporaryStorage.js","sourceRoot":"","sources":["../../../src/presentation-backend/TemporaryStorage.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qB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EAAE,EAAE,KAAK,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,IAAW,MAAM;QACf,MAAM,MAAM,GAAG,IAAI,KAAK,EAAK,CAAC;QAC9B,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAWD;;;;;GAKG;AACH,MAAM,OAAO,4BAAgC,SAAQ,gBAAmB;IAC7C,KAAK,CAAuC;IAErE;;OAEG;IACH,YAAY,KAA2C;QACrD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACa,QAAQ,CAAC,EAAU;QACjC,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;CACF","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 { assert } from \"@itwin/core-bentley\";\nimport { PresentationError, PresentationStatus } from \"@itwin/presentation-common\";\n\n/**\n * Configuration properties for [[TemporaryStorage]].\n * @internal\n */\nexport interface TemporaryStorageProps<T> {\n /** A method that's called for every value before it's removed from storage */\n cleanupHandler?: (id: string, value: T, reason: \"timeout\" | \"dispose\" | \"request\") => void;\n\n onDisposedSingle?: (id: string) => void;\n onDisposedAll?: () => void;\n\n /**\n * An interval at which the storage attempts to clean up its values.\n * When `0` or `undefined` is specified, values are not cleaned up\n * automatically and cleanup has to be initiated manually by calling\n * [[TemporaryStorage.disposeOutdatedValues]].\n */\n cleanupInterval?: number;\n\n /**\n * Shortest period of time which the value should be kept in storage\n * unused before it's cleaned up.\n *\n * `undefined` means the values may be kept unused in the storage indefinitely.\n * `0` means the values are removed from the storage on every cleanup (either manual\n * call to [[TemporaryStorage.disposeOutdatedValues]] or scheduled (controlled\n * by [[cleanupInterval]])).\n */\n unusedValueLifetime?: number;\n\n /**\n * The maximum period of time which the value should be kept in storage\n * before it's cleaned up. The time is measured from the moment the value is added\n * to the storage.\n *\n * `undefined` means the values may be kept indefinitely. `0` means they're removed\n * up on every cleanup (either manual call to [[TemporaryStorage.disposeOutdatedValues]]\n * or scheduled (controlled by [[cleanupInterval]])).\n */\n maxValueLifetime?: number;\n}\n\n/** Value with know last used time */\ninterface TemporaryValue<T> {\n created: Date;\n lastUsed: Date;\n value: T;\n}\n\n/**\n * Storage for values that get removed from it after being unused (not-requested\n * for a specified amount of time).\n *\n * @internal\n */\nexport class TemporaryStorage<T> implements Disposable {\n private _timer?: NodeJS.Timeout;\n protected _values: Map<string, TemporaryValue<T>>;\n public readonly props: TemporaryStorageProps<T>;\n\n /**\n * Constructor. Creates the storage using supplied params.\n */\n constructor(props: TemporaryStorageProps<T>) {\n this.props = props;\n this._values = new Map<string, TemporaryValue<T>>();\n if (this.props.cleanupInterval) {\n this._timer = setInterval(this.disposeOutdatedValues, this.props.cleanupInterval);\n }\n }\n\n /**\n * Destructor. Must be called to clean up the stored values\n * and other resources\n */\n public [Symbol.dispose]() {\n if (this._timer) {\n clearInterval(this._timer);\n }\n\n if (this.props.cleanupHandler) {\n this._values.forEach((v, id) => {\n this.props.cleanupHandler!(id, v.value, \"dispose\");\n });\n }\n this._values.clear();\n this.props.onDisposedAll && this.props.onDisposedAll();\n }\n\n /**\n * Cleans up values that are currently outdated (based\n * on their max and unused value lifetimes specified through [[Props]]).\n */\n public disposeOutdatedValues = () => {\n const now = new Date().getTime();\n const valuesToDispose: string[] = [];\n for (const [key, entry] of this._values.entries()) {\n if (this.props.maxValueLifetime !== undefined) {\n if (this.props.maxValueLifetime === 0 || now - entry.created.getTime() > this.props.maxValueLifetime) {\n valuesToDispose.push(key);\n continue;\n }\n }\n if (this.props.unusedValueLifetime !== undefined) {\n if (this.props.unusedValueLifetime === 0 || now - entry.lastUsed.getTime() > this.props.unusedValueLifetime) {\n valuesToDispose.push(key);\n continue;\n }\n }\n }\n for (const id of valuesToDispose) {\n this.deleteExistingEntry(id, true);\n }\n };\n\n private deleteExistingEntry(id: string, isTimeout: boolean) {\n assert(this._values.has(id));\n this.props.cleanupHandler && this.props.cleanupHandler(id, this._values.get(id)!.value, isTimeout ? \"timeout\" : \"request\");\n this._values.delete(id);\n this.props.onDisposedSingle && this.props.onDisposedSingle(id);\n }\n\n /**\n * Get a value from the storage.\n *\n * **Note:** requesting a value with this method updates it's last used time.\n */\n public getValue(id: string): T | undefined {\n if (this._values.has(id)) {\n const v = this._values.get(id)!;\n v.lastUsed = new Date();\n return v.value;\n }\n return undefined;\n }\n\n public notifyValueUsed(id: string) {\n const entry = this._values.get(id);\n if (entry) {\n entry.lastUsed = new Date();\n }\n }\n\n /**\n * Adds a value into the storage.\n * @throws An error when trying to add a value with ID that's already stored in the storage.\n */\n public addValue(id: string, value: T) {\n if (this._values.has(id)) {\n throw new PresentationError(PresentationStatus.InvalidArgument, `A value with given ID \"${id}\" already exists in this storage.`);\n }\n this._values.set(id, { value, created: new Date(), lastUsed: new Date() });\n }\n\n /** Deletes a value with given id. */\n public deleteValue(id: string) {\n if (this._values.has(id)) {\n this.deleteExistingEntry(id, false);\n }\n }\n\n /**\n * Get all values currently in this storage.\n *\n * **Note:** requesting values with this method **doesn't**\n * update their last used times.\n */\n public get values(): T[] {\n const values = new Array<T>();\n for (const v of this._values.values()) {\n values.push(v.value);\n }\n return values;\n }\n}\n\n/**\n * Configuration properties for [[FactoryBasedTemporaryStorage]].\n * @internal\n */\nexport interface FactoryBasedTemporaryStorageProps<T> extends TemporaryStorageProps<T> {\n /** A factory method that creates a stored value given it's identifier */\n factory: (id: string, onValueUsed: () => void) => T;\n}\n\n/**\n * Storage for values that get removed from it after being unused (not-requested\n * for a specified amount of time).\n *\n * @internal\n */\nexport class FactoryBasedTemporaryStorage<T> extends TemporaryStorage<T> {\n public override readonly props: FactoryBasedTemporaryStorageProps<T>;\n\n /**\n * Constructor. Creates the storage using supplied params.\n */\n constructor(props: FactoryBasedTemporaryStorageProps<T>) {\n super(props);\n this.props = props;\n }\n\n /**\n * Get a value from the storage. If the value with the specified id\n * doesn't exist, it gets created.\n *\n * **Note:** requesting a value with this method updates it's last used time.\n */\n public override getValue(id: string): T {\n const existingValue = super.getValue(id);\n if (existingValue) {\n return existingValue;\n }\n\n const value = this.props.factory(id, () => this.notifyValueUsed(id));\n this.addValue(id, value);\n return value;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/presentation-backend/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,sDAAsD;AACtD;;GAEG;AAEH,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG/C,OAAO,EAAe,mBAAmB,EAAmC,MAAM,4BAA4B,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACjH,kEAAkE;AAClE,OAAO,mBAAmB,MAAM,yDAAyD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhH,gBAAgB;AAChB,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,IAAI,MAAM,GAAoB,mBAAmB,CAAC;IA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AAC;YACpH,MAAM,qBAAqB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChI,IAAI,kBAAkB,IAAI,qBAAqB,EAAE,CAAC;gBAChD,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":["/*---------------------------------------------------------------------------------------------\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/* eslint-disable @typescript-eslint/ban-ts-comment */\r\n/** @packageDocumentation\r\n * @module Core\r\n */\r\n\r\nimport { parse as parseVersion } from \"semver\";\r\nimport { IModelDb } from \"@itwin/core-backend\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { Diagnostics, DiagnosticsLogEntry, DiagnosticsOptions, InstanceKey } from \"@itwin/presentation-common\";\r\nimport { combineDiagnosticsSeverities, compareDiagnosticsSeverities } from \"@itwin/presentation-common/internal\";\r\n// @ts-ignore TS complains about `with` in CJS builds, but not ESM\r\nimport presentationStrings from \"@itwin/presentation-common/locales/en/Presentation.json\" with { type: \"json\" };\r\n\r\n/** @internal */\r\nexport function getLocalizedStringEN(key: string) {\r\n let result: object | string = presentationStrings;\r\n const [namespace, identifier] = key.split(\":\", 2);\r\n if (namespace !== \"Presentation\") {\r\n return key;\r\n }\r\n const keySteps = identifier.split(\".\");\r\n for (const keyStep of keySteps) {\r\n if (typeof result !== \"object\" || keyStep in result === false) {\r\n return key;\r\n }\r\n result = result[keyStep as keyof typeof result];\r\n }\r\n return typeof result === \"string\" ? result : key;\r\n}\r\n\r\n/** @internal */\r\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\r\n const className = imodel.elements.tryGetElementProps(id)?.classFullName;\r\n return className ? { className, id } : undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function normalizeVersion(version?: string) {\r\n if (version) {\r\n const parsedVersion = parseVersion(version, true);\r\n if (parsedVersion) {\r\n return `${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}`;\r\n }\r\n }\r\n return \"0.0.0\";\r\n}\r\n\r\n/**\r\n * A function that received request diagnostics and, optionally, request context.\r\n * @public\r\n */\r\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\r\n\r\n/**\r\n * Data structure for backend diagnostics options.\r\n * @public\r\n */\r\nexport interface BackendDiagnosticsOptions<TContext = any> extends DiagnosticsOptions {\r\n /**\r\n * An optional function to supply request context that'll be passed to [[handler]] when\r\n * it's called after the request is fulfilled.\r\n */\r\n requestContextSupplier?: () => TContext;\r\n\r\n /**\r\n * Request diagnostics handler function that is called after the request is fulfilled. The handler\r\n * receives request diagnostics as the first argument and, optionally, request context as the\r\n * second (see [[requestContextSupplier]]).\r\n */\r\n handler: BackendDiagnosticsHandler<TContext>;\r\n}\r\n\r\n/**\r\n * Data structure which contains backend diagnostics options.\r\n * @public\r\n */\r\nexport interface BackendDiagnosticsAttribute {\r\n /**\r\n * Backend diagnostics options.\r\n * @public\r\n */\r\n diagnostics?: BackendDiagnosticsOptions;\r\n}\r\n\r\n/** @internal */\r\nexport function combineDiagnosticsOptions(...options: Array<BackendDiagnosticsOptions | undefined>): DiagnosticsOptions | undefined {\r\n const combinedOptions: DiagnosticsOptions = {};\r\n options.forEach((d) => {\r\n if (!d) {\r\n return;\r\n }\r\n if (\r\n d.perf === true ||\r\n (typeof d.perf === \"object\" &&\r\n (!combinedOptions.perf || (typeof combinedOptions.perf === \"object\" && d.perf.minimumDuration < combinedOptions.perf.minimumDuration)))\r\n ) {\r\n combinedOptions.perf = d.perf;\r\n }\r\n const combinedDev = combineDiagnosticsSeverities(d.dev, combinedOptions.dev);\r\n if (combinedDev) {\r\n combinedOptions.dev = combinedDev;\r\n }\r\n const combinedEditor = combineDiagnosticsSeverities(d.editor, combinedOptions.editor);\r\n if (combinedEditor) {\r\n combinedOptions.editor = combinedEditor;\r\n }\r\n });\r\n return combinedOptions.dev || combinedOptions.editor || combinedOptions.perf ? combinedOptions : undefined;\r\n}\r\n\r\n/** @internal */\r\nexport function reportDiagnostics<TContext>(diagnostics: Diagnostics, options: BackendDiagnosticsOptions<TContext>, context?: TContext) {\r\n const stripped = diagnostics.logs ? stripDiagnostics(options, diagnostics.logs) : undefined;\r\n stripped && options.handler({ logs: stripped }, context);\r\n}\r\nfunction stripDiagnostics<TEntry extends DiagnosticsLogEntry>(options: DiagnosticsOptions, diagnostics: TEntry[]) {\r\n const stripped: TEntry[] = [];\r\n diagnostics.forEach((entry) => {\r\n if (DiagnosticsLogEntry.isScope(entry)) {\r\n const scopeLogs = stripDiagnostics(options, entry.logs ?? []);\r\n const strippedScope = { ...entry, logs: scopeLogs };\r\n if (!strippedScope.logs) {\r\n delete strippedScope.logs;\r\n }\r\n if (entry.duration !== undefined && (options.perf === true || (typeof options.perf === \"object\" && entry.duration >= options.perf.minimumDuration))) {\r\n stripped.push(strippedScope);\r\n } else if (scopeLogs) {\r\n delete strippedScope.duration;\r\n delete strippedScope.scopeCreateTimestamp;\r\n stripped.push(strippedScope);\r\n }\r\n } else {\r\n const matchesDevSeverity = entry.severity.dev && compareDiagnosticsSeverities(entry.severity.dev, options.dev) >= 0;\r\n const matchesEditorSeverity = entry.severity.editor && compareDiagnosticsSeverities(entry.severity.editor, options.editor) >= 0;\r\n if (matchesDevSeverity || matchesEditorSeverity) {\r\n stripped.push({ ...entry });\r\n }\r\n }\r\n });\r\n return stripped.length > 0 ? stripped : undefined;\r\n}\r\n"]}
1
+ {"version":3,"file":"Utils.js","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I,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC;gBACpJ,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/B,CAAC;iBAAM,IAAI,SAAS,EAAE,CAAC;gBACrB,OAAO,aAAa,CAAC,QAAQ,CAAC;gBAC9B,OAAO,aAAa,CAAC,oBAAoB,CAAC;gBAC1C,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,kBAAkB,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpH,MAAM,qBAAqB,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,IAAI,4BAA4B,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChI,IAAI,kBAAkB,IAAI,qBAAqB,EAAE,CAAC;gBAChD,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/* eslint-disable @typescript-eslint/ban-ts-comment */\n/** @packageDocumentation\n * @module Core\n */\n\nimport { parse as parseVersion } from \"semver\";\nimport { IModelDb } from \"@itwin/core-backend\";\nimport { Id64String } from \"@itwin/core-bentley\";\nimport { Diagnostics, DiagnosticsLogEntry, DiagnosticsOptions, InstanceKey } from \"@itwin/presentation-common\";\nimport { combineDiagnosticsSeverities, compareDiagnosticsSeverities } from \"@itwin/presentation-common/internal\";\n// @ts-ignore TS complains about `with` in CJS builds, but not ESM\nimport presentationStrings from \"@itwin/presentation-common/locales/en/Presentation.json\" with { type: \"json\" };\n\n/** @internal */\nexport function getLocalizedStringEN(key: string) {\n let result: object | string = presentationStrings;\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 (typeof result !== \"object\" || keyStep in result === false) {\n return key;\n }\n result = result[keyStep as keyof typeof result];\n }\n return typeof result === \"string\" ? result : key;\n}\n\n/** @internal */\nexport function getElementKey(imodel: IModelDb, id: Id64String): InstanceKey | undefined {\n const className = imodel.elements.tryGetElementProps(id)?.classFullName;\n return className ? { className, id } : undefined;\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 * @public\n */\nexport type BackendDiagnosticsHandler<TContext = any> = (logs: Diagnostics, requestContext?: TContext) => void;\n\n/**\n * Data structure for backend diagnostics options.\n * @public\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 * @public\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 +1 @@
1
- {"version":3,"file":"PresentationRulesDomain.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AAExD,gBAAgB;AAChB,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IACpC,MAAM,KAAc,UAAU;QACnC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACvE,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAC1C,aAAa,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AAED,gBAAgB;AAChB,sBAAsB;AACtB,WAAiB,iBAAiB;IAChC,IAAY,QAEX;IAFD,WAAY,QAAQ;QAClB,iDAAqC,CAAA;IACvC,CAAC,EAFW,QAAQ,GAAR,0BAAQ,KAAR,0BAAQ,QAEnB;AACH,CAAC,EAJgB,iBAAiB,KAAjB,iBAAiB,QAIjC","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 { ClassRegistry, Schema, Schemas } from \"@itwin/core-backend\";\r\nimport * as RulesetElements from \"./RulesetElements.js\";\r\n\r\n/** @internal */\r\nexport class PresentationRules extends Schema {\r\n public static override get schemaName(): string {\r\n return \"PresentationRules\";\r\n }\r\n\r\n /** Registers this schema and it's elements' classes */\r\n public static registerSchema() {\r\n if (this !== Schemas.getRegisteredSchema(PresentationRules.schemaName)) {\r\n Schemas.registerSchema(PresentationRules);\r\n ClassRegistry.registerModule(RulesetElements, this);\r\n }\r\n }\r\n}\r\n\r\n/** @internal */\r\n/* c8 ignore next 5 */\r\nexport namespace PresentationRules {\r\n export enum CodeSpec {\r\n Ruleset = \"PresentationRules:Ruleset\",\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"PresentationRulesDomain.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/PresentationRulesDomain.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AAExD,gBAAgB;AAChB,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IACpC,MAAM,KAAc,UAAU;QACnC,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,uDAAuD;IAChD,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACvE,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;YAC1C,aAAa,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF;AAED,gBAAgB;AAChB,sBAAsB;AACtB,WAAiB,iBAAiB;IAChC,IAAY,QAEX;IAFD,WAAY,QAAQ;QAClB,iDAAqC,CAAA;IACvC,CAAC,EAFW,QAAQ,GAAR,0BAAQ,KAAR,0BAAQ,QAEnB;AACH,CAAC,EAJgB,iBAAiB,KAAjB,iBAAiB,QAIjC","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.js\";\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/* c8 ignore next 5 */\nexport namespace PresentationRules {\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,OAAO,EAAE,iBAAiB,EAAY,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,gBAAgB;AAChB,MAAM,OAAO,OAAQ,SAAQ,iBAAiB;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,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,IAAI,CAAC;YACd,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;YACzE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE;YACzB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;IACL,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 { Id64String } from \"@itwin/core-bentley\";\r\nimport { DefinitionElement, IModelDb } from \"@itwin/core-backend\";\r\nimport { Code } from \"@itwin/core-common\";\r\nimport { Ruleset as PresentationRuleset } from \"@itwin/presentation-common\";\r\nimport { normalizeVersion } from \"../Utils.js\";\r\nimport { PresentationRules } from \"./PresentationRulesDomain.js\";\r\n\r\n/** @internal */\r\nexport class Ruleset extends DefinitionElement {\r\n /**\r\n * Name of the `Ruleset` element class.\r\n */\r\n public static override get className(): string {\r\n return \"Ruleset\";\r\n }\r\n\r\n /**\r\n * Generates a unique code for a ruleset\r\n * @param iModelDb DB the ruleset is supposed to be inserted into\r\n * @param modelId ID of a the model this ruleset should be created in\r\n * @param ruleset The ruleset code is being created for\r\n */\r\n public static createRulesetCode(iModelDb: IModelDb, modelId: Id64String, ruleset: PresentationRuleset) {\r\n let codeValue = ruleset.id;\r\n if (ruleset.version) {\r\n codeValue += `@${normalizeVersion(ruleset.version)}`;\r\n }\r\n\r\n return new Code({\r\n spec: iModelDb.codeSpecs.getByName(PresentationRules.CodeSpec.Ruleset).id,\r\n scope: modelId.toString(),\r\n value: codeValue,\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"RulesetElements.js","sourceRoot":"","sources":["../../../../src/presentation-backend/domain/RulesetElements.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAY,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,gBAAgB;AAChB,MAAM,OAAO,OAAQ,SAAQ,iBAAiB;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,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,IAAI,CAAC;YACd,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;YACzE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE;YACzB,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;IACL,CAAC;CACF","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.js\";\nimport { PresentationRules } from \"./PresentationRulesDomain.js\";\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-backend-internal.js","sourceRoot":"","sources":["../../src/presentation-backend-internal.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,yFAAyF;AACzF,qHAAqH;AAErH,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,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\r\n// WARNING: This barrel file exports internal APIs only for use by Presentation packages.\r\n// They should not be used outside of these packages. These APIs may be broken or removed at any time without notice.\r\n\r\nexport { _presentation_manager_detail } from \"./presentation-backend/InternalSymbols.js\";\r\n"]}
1
+ {"version":3,"file":"presentation-backend-internal.js","sourceRoot":"","sources":["../../src/presentation-backend-internal.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,yFAAyF;AACzF,qHAAqH;AAErH,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,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\n// WARNING: This barrel file exports internal APIs only for use by Presentation packages.\n// They should not be used outside of these packages. These APIs may be broken or removed at any time without notice.\n\nexport { _presentation_manager_detail } from \"./presentation-backend/InternalSymbols.js\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-backend.js","sourceRoot":"","sources":["../../src/presentation-backend.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AACH,OAAO,EAAoF,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACxJ,OAAO,EACL,kBAAkB,EAWlB,mBAAmB,GACpB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAA8C,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAGxH;;;;;GAKG;AACH,OAAO,EAAE,iCAAiC,EAAE,uCAAuC,EAAE,MAAM,iDAAiD,CAAC;AAE7I,MAAM,+BAA+B,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AACzF,IAAK,UAAkB,CAAC,+BAA+B,CAAC,EAAE,CAAC;IACzD,4DAA4D;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,+BAA+B,CAAC,CAAC,KAAK,CAAC;IAElF,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,8EAA8E;QAC5E,yDAAyD;QACzD,8CAA8C;QAC9C,wDAAwD,CAC3D,CAAC;IAEF,+BAA+B;IAC/B,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;IACtE,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,8BAA8B;IAE9B,MAAM,KAAK,CAAC;AACd,CAAC;KAAM,CAAC;IACL,UAAkB,CAAC,+BAA+B,CAAC,GAAG;QACrD,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;KACzB,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/**\r\n * @module Core\r\n *\r\n * @docs-group-description Core\r\n * Common types used for retrieving presentation data from iModels.\r\n */\r\nexport { PresentationProps, MultiManagerPresentationProps, SingleManagerPresentationProps, Presentation } from \"./presentation-backend/Presentation.js\";\r\nexport {\r\n HierarchyCacheMode,\r\n HierarchyCacheConfig,\r\n MemoryHierarchyCacheConfig,\r\n DiskHierarchyCacheConfig,\r\n HybridCacheConfig,\r\n ContentCacheConfig,\r\n PresentationManagerCachingConfig,\r\n UnitSystemFormat,\r\n MultiElementPropertiesResponse,\r\n PresentationAssetsRootConfig,\r\n PresentationManagerProps,\r\n PresentationManager,\r\n} from \"./presentation-backend/PresentationManager.js\";\r\nexport { RulesetManager } from \"./presentation-backend/RulesetManager.js\";\r\nexport { RulesetVariablesManager } from \"./presentation-backend/RulesetVariablesManager.js\";\r\nexport { RulesetInsertOptions, RulesetEmbedderProps, RulesetEmbedder } from \"./presentation-backend/RulesetEmbedder.js\";\r\nexport { BackendDiagnosticsHandler, BackendDiagnosticsOptions, BackendDiagnosticsAttribute } from \"./presentation-backend/Utils.js\";\r\n\r\n/**\r\n * @module Logging\r\n *\r\n * @docs-group-description Logging\r\n * Types related to logging in this package.\r\n */\r\nexport { PresentationBackendLoggerCategory, PresentationBackendNativeLoggerCategory } from \"./presentation-backend/BackendLoggerCategory.js\";\r\n\r\nconst globalSymbolPresentationBackend = Symbol.for(\"itwin.presentation.backend.globals\");\r\nif ((globalThis as any)[globalSymbolPresentationBackend]) {\r\n // Get the stack trace from when the module was first loaded\r\n const firstLoadStack = (globalThis as any)[globalSymbolPresentationBackend].stack;\r\n\r\n const error = new Error(\r\n \"Multiple @itwin/presentation-backend imports detected! This may happen if:\\n\" +\r\n \"- You have multiple versions of the package installed\\n\" +\r\n \"- Your bundling configuration is incorrect\\n\" +\r\n \"- You're importing from both ESM and CommonJS versions\",\r\n );\r\n\r\n /* eslint-disable no-console */\r\n console.error(\"Duplicate @itwin/presentation-backend import:\", error);\r\n console.error(\"First import occurred at:\", firstLoadStack);\r\n console.error(\"Current import occurred at:\", error.stack);\r\n /* eslint-enable no-console */\r\n\r\n throw error;\r\n} else {\r\n (globalThis as any)[globalSymbolPresentationBackend] = {\r\n stack: new Error().stack,\r\n };\r\n}"]}
1
+ {"version":3,"file":"presentation-backend.js","sourceRoot":"","sources":["../../src/presentation-backend.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;;;;GAKG;AACH,OAAO,EAAoF,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACxJ,OAAO,EACL,kBAAkB,EAWlB,mBAAmB,GACpB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAA8C,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAGxH;;;;;GAKG;AACH,OAAO,EAAE,iCAAiC,EAAE,uCAAuC,EAAE,MAAM,iDAAiD,CAAC;AAE7I,MAAM,+BAA+B,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AACzF,IAAK,UAAkB,CAAC,+BAA+B,CAAC,EAAE,CAAC;IACzD,4DAA4D;IAC5D,MAAM,cAAc,GAAI,UAAkB,CAAC,+BAA+B,CAAC,CAAC,KAAK,CAAC;IAElF,MAAM,KAAK,GAAG,IAAI,KAAK,CACrB,8EAA8E;QAC5E,yDAAyD;QACzD,8CAA8C;QAC9C,wDAAwD,CAC3D,CAAC;IAEF,+BAA+B;IAC/B,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;IACtE,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,8BAA8B;IAE9B,MAAM,KAAK,CAAC;AACd,CAAC;KAAM,CAAC;IACL,UAAkB,CAAC,+BAA+B,CAAC,GAAG;QACrD,KAAK,EAAE,IAAI,KAAK,EAAE,CAAC,KAAK;KACzB,CAAC;AACJ,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/**\n * @module Core\n *\n * @docs-group-description Core\n * Common types used for retrieving presentation data from iModels.\n */\nexport { PresentationProps, MultiManagerPresentationProps, SingleManagerPresentationProps, Presentation } from \"./presentation-backend/Presentation.js\";\nexport {\n HierarchyCacheMode,\n HierarchyCacheConfig,\n MemoryHierarchyCacheConfig,\n DiskHierarchyCacheConfig,\n HybridCacheConfig,\n ContentCacheConfig,\n PresentationManagerCachingConfig,\n UnitSystemFormat,\n MultiElementPropertiesResponse,\n PresentationAssetsRootConfig,\n PresentationManagerProps,\n PresentationManager,\n} from \"./presentation-backend/PresentationManager.js\";\nexport { RulesetManager } from \"./presentation-backend/RulesetManager.js\";\nexport { RulesetVariablesManager } from \"./presentation-backend/RulesetVariablesManager.js\";\nexport { RulesetInsertOptions, RulesetEmbedderProps, RulesetEmbedder } from \"./presentation-backend/RulesetEmbedder.js\";\nexport { BackendDiagnosticsHandler, BackendDiagnosticsOptions, BackendDiagnosticsAttribute } from \"./presentation-backend/Utils.js\";\n\n/**\n * @module Logging\n *\n * @docs-group-description Logging\n * Types related to logging in this package.\n */\nexport { PresentationBackendLoggerCategory, PresentationBackendNativeLoggerCategory } from \"./presentation-backend/BackendLoggerCategory.js\";\n\nconst globalSymbolPresentationBackend = Symbol.for(\"itwin.presentation.backend.globals\");\nif ((globalThis as any)[globalSymbolPresentationBackend]) {\n // Get the stack trace from when the module was first loaded\n const firstLoadStack = (globalThis as any)[globalSymbolPresentationBackend].stack;\n\n const error = new Error(\n \"Multiple @itwin/presentation-backend imports detected! This may happen if:\\n\" +\n \"- You have multiple versions of the package installed\\n\" +\n \"- Your bundling configuration is incorrect\\n\" +\n \"- You're importing from both ESM and CommonJS versions\",\n );\n\n /* eslint-disable no-console */\n console.error(\"Duplicate @itwin/presentation-backend import:\", error);\n console.error(\"First import occurred at:\", firstLoadStack);\n console.error(\"Current import occurred at:\", error.stack);\n /* eslint-enable no-console */\n\n throw error;\n} else {\n (globalThis as any)[globalSymbolPresentationBackend] = {\n stack: new Error().stack,\n };\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/presentation-backend",
3
- "version": "5.4.0-dev.6",
3
+ "version": "5.4.0-dev.7",
4
4
  "description": "Backend of iTwin.js Presentation library",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -36,12 +36,12 @@
36
36
  "./package.json": "./package.json"
37
37
  },
38
38
  "peerDependencies": {
39
- "@itwin/core-backend": "5.4.0-dev.6",
40
- "@itwin/presentation-common": "5.4.0-dev.6",
41
- "@itwin/core-bentley": "5.4.0-dev.6",
42
- "@itwin/core-common": "5.4.0-dev.6",
43
- "@itwin/core-quantity": "5.4.0-dev.6",
44
- "@itwin/ecschema-metadata": "5.4.0-dev.6"
39
+ "@itwin/core-bentley": "5.4.0-dev.7",
40
+ "@itwin/core-backend": "5.4.0-dev.7",
41
+ "@itwin/ecschema-metadata": "5.4.0-dev.7",
42
+ "@itwin/presentation-common": "5.4.0-dev.7",
43
+ "@itwin/core-common": "5.4.0-dev.7",
44
+ "@itwin/core-quantity": "5.4.0-dev.7"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@itwin/eslint-plugin": "5.2.2-dev.2",
@@ -76,14 +76,14 @@
76
76
  "sinon-chai": "^3.7.0",
77
77
  "typemoq": "^2.1.0",
78
78
  "typescript": "~5.6.2",
79
- "@itwin/build-tools": "5.4.0-dev.6",
80
- "@itwin/core-quantity": "5.4.0-dev.6",
81
- "@itwin/core-backend": "5.4.0-dev.6",
82
- "@itwin/presentation-common": "5.4.0-dev.6",
83
- "@itwin/core-common": "5.4.0-dev.6",
84
- "@itwin/core-bentley": "5.4.0-dev.6",
85
- "@itwin/ecschema-metadata": "5.4.0-dev.6",
86
- "internal-tools": "3.0.0-dev.69"
79
+ "@itwin/build-tools": "5.4.0-dev.7",
80
+ "@itwin/ecschema-metadata": "5.4.0-dev.7",
81
+ "@itwin/core-bentley": "5.4.0-dev.7",
82
+ "@itwin/presentation-common": "5.4.0-dev.7",
83
+ "@itwin/core-backend": "5.4.0-dev.7",
84
+ "@itwin/core-common": "5.4.0-dev.7",
85
+ "internal-tools": "3.0.0-dev.69",
86
+ "@itwin/core-quantity": "5.4.0-dev.7"
87
87
  },
88
88
  "dependencies": {
89
89
  "@itwin/presentation-shared": "^1.2.1",