@itwin/presentation-backend 5.1.0-dev.5 → 5.1.0-dev.52

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 (45) hide show
  1. package/CHANGELOG.md +71 -1
  2. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts +9 -9
  3. package/lib/cjs/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
  4. package/lib/cjs/presentation-backend/BackendLoggerCategory.js +9 -9
  5. package/lib/cjs/presentation-backend/BackendLoggerCategory.js.map +1 -1
  6. package/lib/cjs/presentation-backend/Presentation.d.ts +3 -3
  7. package/lib/cjs/presentation-backend/Presentation.js.map +1 -1
  8. package/lib/cjs/presentation-backend/PresentationManager.d.ts +19 -8
  9. package/lib/cjs/presentation-backend/PresentationManager.d.ts.map +1 -1
  10. package/lib/cjs/presentation-backend/PresentationManager.js +27 -18
  11. package/lib/cjs/presentation-backend/PresentationManager.js.map +1 -1
  12. package/lib/cjs/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
  13. package/lib/cjs/presentation-backend/PresentationManagerDetail.js +16 -8
  14. package/lib/cjs/presentation-backend/PresentationManagerDetail.js.map +1 -1
  15. package/lib/cjs/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  16. package/lib/cjs/presentation-backend/PresentationRpcImpl.js +3 -16
  17. package/lib/cjs/presentation-backend/PresentationRpcImpl.js.map +1 -1
  18. package/lib/cjs/presentation-backend/SelectionScopesHelper.js.map +1 -1
  19. package/lib/cjs/presentation-backend/Utils.d.ts.map +1 -1
  20. package/lib/cjs/presentation-backend/Utils.js.map +1 -1
  21. package/lib/cjs/presentation-backend.js +20 -0
  22. package/lib/cjs/presentation-backend.js.map +1 -1
  23. package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts +9 -9
  24. package/lib/esm/presentation-backend/BackendLoggerCategory.d.ts.map +1 -1
  25. package/lib/esm/presentation-backend/BackendLoggerCategory.js +9 -9
  26. package/lib/esm/presentation-backend/BackendLoggerCategory.js.map +1 -1
  27. package/lib/esm/presentation-backend/Presentation.d.ts +3 -3
  28. package/lib/esm/presentation-backend/Presentation.js.map +1 -1
  29. package/lib/esm/presentation-backend/PresentationManager.d.ts +19 -8
  30. package/lib/esm/presentation-backend/PresentationManager.d.ts.map +1 -1
  31. package/lib/esm/presentation-backend/PresentationManager.js +27 -18
  32. package/lib/esm/presentation-backend/PresentationManager.js.map +1 -1
  33. package/lib/esm/presentation-backend/PresentationManagerDetail.d.ts.map +1 -1
  34. package/lib/esm/presentation-backend/PresentationManagerDetail.js +11 -3
  35. package/lib/esm/presentation-backend/PresentationManagerDetail.js.map +1 -1
  36. package/lib/esm/presentation-backend/PresentationRpcImpl.d.ts.map +1 -1
  37. package/lib/esm/presentation-backend/PresentationRpcImpl.js +5 -18
  38. package/lib/esm/presentation-backend/PresentationRpcImpl.js.map +1 -1
  39. package/lib/esm/presentation-backend/SelectionScopesHelper.js.map +1 -1
  40. package/lib/esm/presentation-backend/Utils.d.ts.map +1 -1
  41. package/lib/esm/presentation-backend/Utils.js +2 -2
  42. package/lib/esm/presentation-backend/Utils.js.map +1 -1
  43. package/lib/esm/presentation-backend.js +20 -0
  44. package/lib/esm/presentation-backend.js.map +1 -1
  45. package/package.json +15 -14
@@ -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,EAEL,mBAAmB,GAGpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,qCAAqC,CAAC;AAC7C,kEAAkE;AAClE,OAAO,mBAAmB,MAAM,yDAAyD,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEhH,gBAAgB;AAChB,MAA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AK,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 {\n Diagnostics,\n DiagnosticsLogEntry,\n DiagnosticsOptions,\n InstanceKey,\n} from \"@itwin/presentation-common\";\nimport {\n combineDiagnosticsSeverities,\n compareDiagnosticsSeverities,\n} 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
+ {"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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AAI,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"]}
@@ -18,4 +18,24 @@ export { RulesetEmbedder } from "./presentation-backend/RulesetEmbedder.js";
18
18
  * Types related to logging in this package.
19
19
  */
20
20
  export { PresentationBackendLoggerCategory, PresentationBackendNativeLoggerCategory } from "./presentation-backend/BackendLoggerCategory.js";
21
+ const globalSymbolPresentationBackend = Symbol.for("itwin.presentation.backend.globals");
22
+ if (globalThis[globalSymbolPresentationBackend]) {
23
+ // Get the stack trace from when the module was first loaded
24
+ const firstLoadStack = globalThis[globalSymbolPresentationBackend].stack;
25
+ const error = new Error("Multiple @itwin/presentation-backend imports detected! This may happen if:\n" +
26
+ "- You have multiple versions of the package installed\n" +
27
+ "- Your bundling configuration is incorrect\n" +
28
+ "- You're importing from both ESM and CommonJS versions");
29
+ /* eslint-disable no-console */
30
+ console.error("Duplicate @itwin/presentation-backend import:", error);
31
+ console.error("First import occurred at:", firstLoadStack);
32
+ console.error("Current import occurred at:", error.stack);
33
+ /* eslint-enable no-console */
34
+ throw error;
35
+ }
36
+ else {
37
+ globalThis[globalSymbolPresentationBackend] = {
38
+ stack: new Error().stack,
39
+ };
40
+ }
21
41
  //# sourceMappingURL=presentation-backend.js.map
@@ -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","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"]}
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.1.0-dev.5",
3
+ "version": "5.1.0-dev.52",
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.1.0-dev.5",
40
- "@itwin/core-bentley": "5.1.0-dev.5",
41
- "@itwin/core-common": "5.1.0-dev.5",
42
- "@itwin/core-quantity": "5.1.0-dev.5",
43
- "@itwin/ecschema-metadata": "5.1.0-dev.5",
44
- "@itwin/presentation-common": "5.1.0-dev.5"
39
+ "@itwin/core-backend": "5.1.0-dev.52",
40
+ "@itwin/core-bentley": "5.1.0-dev.52",
41
+ "@itwin/core-common": "5.1.0-dev.52",
42
+ "@itwin/presentation-common": "5.1.0-dev.52",
43
+ "@itwin/ecschema-metadata": "5.1.0-dev.52",
44
+ "@itwin/core-quantity": "5.1.0-dev.52"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@itwin/eslint-plugin": "5.0.0-dev.1",
@@ -76,16 +76,17 @@
76
76
  "sinon-chai": "^3.7.0",
77
77
  "typemoq": "^2.1.0",
78
78
  "typescript": "~5.6.2",
79
- "@itwin/build-tools": "5.1.0-dev.5",
80
- "@itwin/core-backend": "5.1.0-dev.5",
81
- "@itwin/core-quantity": "5.1.0-dev.5",
82
- "@itwin/ecschema-metadata": "5.1.0-dev.5",
83
- "@itwin/core-common": "5.1.0-dev.5",
84
- "@itwin/core-bentley": "5.1.0-dev.5",
85
- "@itwin/presentation-common": "5.1.0-dev.5",
79
+ "@itwin/build-tools": "5.1.0-dev.52",
80
+ "@itwin/ecschema-metadata": "5.1.0-dev.52",
81
+ "@itwin/core-backend": "5.1.0-dev.52",
82
+ "@itwin/core-bentley": "5.1.0-dev.52",
83
+ "@itwin/core-quantity": "5.1.0-dev.52",
84
+ "@itwin/core-common": "5.1.0-dev.52",
85
+ "@itwin/presentation-common": "5.1.0-dev.52",
86
86
  "internal-tools": "3.0.0-dev.69"
87
87
  },
88
88
  "dependencies": {
89
+ "@itwin/presentation-shared": "^1.2.1",
89
90
  "object-hash": "^1.3.1",
90
91
  "rxjs": "^7.8.1",
91
92
  "rxjs-for-await": "^1.0.0",