@itwin/ecschema-rpcinterface-tests 5.9.1 → 5.9.2

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.
@@ -158463,12 +158463,12 @@ class QuantityFormatter {
158463
158463
  const effectiveSystem = args.system ?? this._activeUnitSystem;
158464
158464
  return this._formatSpecsRegistry.get(args.name)?.get(args.persistenceUnitName)?.get(effectiveSystem);
158465
158465
  }
158466
- /** Create a cacheable handle to formatting specs for a specific KoQ and persistence unit.
158467
- * The handle auto-refreshes when the QuantityFormatter reloads. Call `dispose()` when done.
158466
+ /** Create a handle to formatting specs for a specific KoQ and persistence unit.
158467
+ * The handle reads the current specs from the formatter on access. Call `dispose()` when done.
158468
158468
  *
158469
158469
  * @param koqName - The KindOfQuantity name (e.g., "DefaultToolsUnits.LENGTH")
158470
158470
  * @param persistenceUnit - The persistence unit name (e.g., "Units.M")
158471
- * @returns A FormatSpecHandle that auto-updates on reload
158471
+ * @returns A FormatSpecHandle that reflects current formatter state
158472
158472
  * @beta
158473
158473
  */
158474
158474
  getFormatSpecHandle(koqName, persistenceUnit, system) {
@@ -158496,12 +158496,17 @@ class QuantityFormatter {
158496
158496
  formatProps,
158497
158497
  formatName: name,
158498
158498
  });
158499
- if (!this._formatSpecsRegistry.has(name))
158500
- this._formatSpecsRegistry.set(name, new Map());
158501
- const unitMap = this._formatSpecsRegistry.get(name);
158502
- if (!unitMap.has(persistenceUnitName))
158503
- unitMap.set(persistenceUnitName, new Map());
158504
- unitMap.get(persistenceUnitName).set(effectiveSystem, { formatterSpec, parserSpec });
158499
+ let unitMap = this._formatSpecsRegistry.get(name);
158500
+ if (!unitMap) {
158501
+ unitMap = new Map();
158502
+ this._formatSpecsRegistry.set(name, unitMap);
158503
+ }
158504
+ let systemMap = unitMap.get(persistenceUnitName);
158505
+ if (!systemMap) {
158506
+ systemMap = new Map();
158507
+ unitMap.set(persistenceUnitName, systemMap);
158508
+ }
158509
+ systemMap.set(effectiveSystem, { formatterSpec, parserSpec });
158505
158510
  }
158506
158511
  else {
158507
158512
  throw new Error(`Unable to find format properties for ${name} with persistence unit ${persistenceUnitName}`);
@@ -308916,19 +308921,17 @@ __webpack_require__.r(__webpack_exports__);
308916
308921
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
308917
308922
  * See LICENSE.md in the project root for license terms and full copyright notice.
308918
308923
  *--------------------------------------------------------------------------------------------*/
308919
- /** A cacheable handle to formatting and parsing specs for a specific KoQ and persistence unit.
308920
- * Automatically refreshes when the QuantityFormatter reloads. Use [[QuantityFormatter.getFormatSpecHandle]]
308924
+ /** A handle to formatting and parsing specs for a specific KoQ and persistence unit.
308925
+ * Reads the current specs from the provider on access. Use [[QuantityFormatter.getFormatSpecHandle]]
308921
308926
  * to create instances.
308922
308927
  *
308923
308928
  * When formatting is not yet ready, [[format]] returns a `value.toString()` fallback.
308924
- * Call [[dispose]] when the handle is no longer needed to unsubscribe from reload events.
308929
+ * Dispose the handle when it is no longer needed to invalidate it.
308925
308930
  *
308926
308931
  * @beta
308927
308932
  */
308928
308933
  class FormatSpecHandle {
308929
- _formatterSpec;
308930
- _parserSpec;
308931
- _removeListener;
308934
+ _disposed = false;
308932
308935
  _provider;
308933
308936
  _koqName;
308934
308937
  _persistenceUnit;
@@ -308939,10 +308942,6 @@ class FormatSpecHandle {
308939
308942
  this._koqName = args.name;
308940
308943
  this._persistenceUnit = args.persistenceUnitName;
308941
308944
  this._system = args.system;
308942
- this._removeListener = args.provider.onFormattingReady.addListener(() => {
308943
- this._refresh();
308944
- });
308945
- this._refresh();
308946
308945
  }
308947
308946
  /** The KoQ name this handle is keyed to. */
308948
308947
  get koqName() { return this._koqName; }
@@ -308951,47 +308950,35 @@ class FormatSpecHandle {
308951
308950
  /** The unit system this handle is pinned to, or `undefined` for the active system. */
308952
308951
  get system() { return this._system; }
308953
308952
  /** The current FormatterSpec, or undefined if not yet loaded. */
308954
- get formatterSpec() { return this._formatterSpec; }
308953
+ get formatterSpec() { return this._getEntry()?.formatterSpec; }
308955
308954
  /** The current ParserSpec, or undefined if not yet loaded. */
308956
- get parserSpec() { return this._parserSpec; }
308955
+ get parserSpec() { return this._getEntry()?.parserSpec; }
308957
308956
  /** Format a quantity value using the current spec.
308958
308957
  * If the formatter is not yet ready, returns `value.toString()` as a fallback.
308959
308958
  * @param value - The numeric value to format.
308960
308959
  * @returns The formatted string.
308961
308960
  */
308962
308961
  format(value) {
308963
- if (!this._formatterSpec)
308962
+ const formatterSpec = this.formatterSpec;
308963
+ if (!formatterSpec)
308964
308964
  return value.toString();
308965
- return this._provider.formatQuantity(value, this._formatterSpec);
308965
+ return this._provider.formatQuantity(value, formatterSpec);
308966
308966
  }
308967
- /** Unsubscribe from reload events and clear cached specs.
308968
- * Idempotent and safe to call during a pending reload.
308967
+ /** Invalidate this handle.
308968
+ * Idempotent and safe to call multiple times.
308969
+ * No additional teardown is required because the handle owns no external resources.
308969
308970
  */
308970
308971
  [Symbol.dispose]() {
308971
- if (this._removeListener) {
308972
- this._removeListener();
308973
- this._removeListener = undefined;
308974
- }
308975
- this._formatterSpec = undefined;
308976
- this._parserSpec = undefined;
308972
+ this._disposed = true;
308977
308973
  }
308978
- _refresh() {
308979
- // Guard against mid-emission callbacks after dispose() — event may still fire during iteration.
308980
- if (!this._removeListener)
308981
- return;
308982
- const entry = this._provider.getSpecsByNameAndUnit({
308974
+ _getEntry() {
308975
+ if (this._disposed)
308976
+ return undefined;
308977
+ return this._provider.getSpecsByNameAndUnit({
308983
308978
  name: this._koqName,
308984
308979
  persistenceUnitName: this._persistenceUnit,
308985
308980
  system: this._system,
308986
308981
  });
308987
- if (entry) {
308988
- this._formatterSpec = entry.formatterSpec;
308989
- this._parserSpec = entry.parserSpec;
308990
- }
308991
- else {
308992
- this._formatterSpec = undefined;
308993
- this._parserSpec = undefined;
308994
- }
308995
308982
  }
308996
308983
  }
308997
308984
 
@@ -327364,7 +327351,7 @@ var loadLanguages = instance.loadLanguages;
327364
327351
  /***/ ((module) => {
327365
327352
 
327366
327353
  "use strict";
327367
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.9.1","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts && npm run -s extract","extract":"betools extract --fileExt=ts --extractFrom=./src/test/example-code --recursive --out=../../generated-docs/extract","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@bentley/aec-units-schema":"^1.0.3","@bentley/formats-schema":"^1.0.0","@bentley/units-schema":"^1.0.9","@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"^6.0.0","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.5.0","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"~4.3.4","@loaders.gl/draco":"~4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
327354
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.9.2","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts && npm run -s extract","extract":"betools extract --fileExt=ts --extractFrom=./src/test/example-code --recursive --out=../../generated-docs/extract","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@bentley/aec-units-schema":"^1.0.3","@bentley/formats-schema":"^1.0.0","@bentley/units-schema":"^1.0.9","@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"^6.0.0","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.5.0","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"~4.3.4","@loaders.gl/draco":"~4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
327368
327355
 
327369
327356
  /***/ })
327370
327357