@itwin/rpcinterface-full-stack-tests 5.3.0-dev.3 → 5.3.0-dev.4

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.
@@ -185298,10 +185298,14 @@ class StandardQuantityTypeDefinition {
185298
185298
  */
185299
185299
  class QuantityTypeFormatsProvider {
185300
185300
  onFormatsChanged = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
185301
+ _removeListeners = [];
185301
185302
  constructor() {
185302
- _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
185303
+ this._removeListeners.push(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
185303
185304
  this.onFormatsChanged.raiseEvent({ formatsChanged: "all" });
185304
- });
185305
+ }));
185306
+ }
185307
+ [Symbol.dispose]() {
185308
+ this._removeListeners.forEach(listener => listener());
185305
185309
  }
185306
185310
  _kindOfQuantityMap = new Map([
185307
185311
  ["AecUnits.LENGTH", QuantityType.Length],
@@ -334943,8 +334947,8 @@ class Formatter {
334943
334947
  */
334944
334948
  static formatComposite(magnitude, spec) {
334945
334949
  const compositeStrings = [];
334946
- // Caller will deal with appending +||-||() value sign as specified by formatting options so just format positive value
334947
- let posMagnitude = Math.abs(magnitude);
334950
+ let isNegative = false;
334951
+ let remainingMagnitude = magnitude;
334948
334952
  for (let i = 0; i < spec.unitConversions.length; i++) {
334949
334953
  const currentLabel = spec.unitConversions[i].label;
334950
334954
  const unitConversion = spec.unitConversions[i].conversion;
@@ -334954,40 +334958,43 @@ class Formatter {
334954
334958
  throw new _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError(_Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);
334955
334959
  let unitValue = 0.0;
334956
334960
  if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Ratio) {
334957
- if (1 !== spec.format.units.length)
334961
+ if (1 !== (spec.format.units?.length ?? 0))
334958
334962
  throw new _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError(_Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvalidCompositeFormat, `The Format '${spec.format.name}' with type 'ratio' must have exactly one unit.`);
334959
334963
  try {
334960
- unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
334964
+ unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(remainingMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
334961
334965
  }
334962
334966
  catch (e) {
334963
334967
  // The "InvertingZero" error is thrown when the value is zero and the conversion factor is inverted.
334964
334968
  // For ratio, we actually want to support this corner case and return "1:0" as the formatted value.
334965
334969
  if (e instanceof _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError && e.errorNumber === _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvertingZero) {
334966
- return "1:0";
334970
+ return { componentText: "1:0", isNegative: false };
334967
334971
  }
334968
334972
  }
334969
334973
  compositeStrings.push(this.formatRatio(unitValue, spec));
334974
+ isNegative = unitValue < 0;
334970
334975
  continue;
334971
334976
  }
334972
- unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(posMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
334977
+ unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(remainingMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
334973
334978
  if (0 === i) {
334979
+ // Only set isNegative from the first (major) unit conversion
334980
+ isNegative = unitValue < 0;
334974
334981
  const precisionScale = Math.pow(10, 8); // use a fixed round off precision of 8 to avoid loss of precision in actual magnitude
334975
334982
  unitValue = Math.floor(unitValue * precisionScale + FPV_ROUNDFACTOR) / precisionScale;
334976
334983
  if ((Math.abs(unitValue) < 0.0001) && spec.format.hasFormatTraitSet(_FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatTraits.ZeroEmpty))
334977
- return "";
334984
+ return { componentText: "", isNegative: false };
334978
334985
  }
334979
- if (i < spec.format.units.length - 1) {
334980
- const wholePart = Math.floor(unitValue);
334981
- const componentText = Formatter.formatCompositePart(wholePart, false, currentLabel, spec);
334982
- posMagnitude = unitValue - wholePart;
334986
+ if (i < (spec.format.units?.length ?? 0) - 1) {
334987
+ const wholePart = Math.trunc(unitValue);
334988
+ const componentText = Formatter.formatCompositePart(Math.abs(wholePart), false, currentLabel, spec);
334989
+ remainingMagnitude = unitValue - wholePart;
334983
334990
  compositeStrings.push(componentText);
334984
334991
  }
334985
334992
  else {
334986
- const componentText = Formatter.formatCompositePart(unitValue, true, currentLabel, spec);
334993
+ const componentText = Formatter.formatCompositePart(Math.abs(unitValue), true, currentLabel, spec);
334987
334994
  compositeStrings.push(componentText);
334988
334995
  }
334989
334996
  }
334990
- return compositeStrings.join(spec.format.spacerOrDefault);
334997
+ return { componentText: compositeStrings.join(spec.format.spacerOrDefault), isNegative };
334991
334998
  }
334992
334999
  /** Format a quantity value into a single text string. Imitate how formatting done by server method NumericFormatSpec::FormatDouble.
334993
335000
  * @param magnitude quantity value
@@ -335116,45 +335123,58 @@ class Formatter {
335116
335123
  }
335117
335124
  return value;
335118
335125
  }
335119
- /** Format a quantity value into a single text string based on the current format specification of this class.
335120
- * @param magnitude defines the value to spec.format.
335121
- * @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.
335126
+ /** Helper function to apply sign formatting based on showSignOption
335127
+ * @param isNegative whether the value should be treated as negative
335128
+ * @param showSignOption the sign display option
335129
+ * @param formatType the format type (to handle bearing/azimuth exceptions)
335130
+ * @returns object containing prefix and suffix strings
335122
335131
  */
335123
- static formatQuantity(magnitude, spec) {
335124
- const valueIsNegative = magnitude < 0.0;
335132
+ static applySignFormatting(isNegative, showSignOption, formatType) {
335125
335133
  let prefix = "";
335126
335134
  let suffix = "";
335127
- let formattedValue = "";
335128
- if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing || spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
335129
- const result = this.processBearingAndAzimuth(magnitude, spec);
335130
- magnitude = result.magnitude;
335131
- prefix = result.prefix ?? "";
335132
- suffix = result.suffix ?? "";
335133
- }
335134
- switch (spec.format.showSignOption) {
335135
+ switch (showSignOption) {
335135
335136
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.NegativeParentheses:
335136
- if (valueIsNegative) {
335137
- prefix += "(";
335138
- suffix = `)${suffix}`;
335137
+ if (isNegative) {
335138
+ prefix = "(";
335139
+ suffix = ")";
335139
335140
  }
335140
335141
  break;
335141
335142
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.OnlyNegative:
335142
- if (valueIsNegative && spec.format.type !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing && spec.format.type !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth)
335143
- prefix += "-";
335143
+ if (isNegative && formatType !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing && formatType !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
335144
+ prefix = "-";
335145
+ }
335144
335146
  break;
335145
335147
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.SignAlways:
335146
- if (valueIsNegative)
335147
- prefix += "-";
335148
- else
335149
- prefix += "+";
335148
+ prefix = isNegative ? "-" : "+";
335150
335149
  break;
335151
335150
  case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.NoSign:
335152
335151
  default:
335153
335152
  break;
335154
335153
  }
335154
+ return { prefix, suffix };
335155
+ }
335156
+ /** Format a quantity value into a single text string based on the current format specification of this class.
335157
+ * @param magnitude defines the value to spec.format.
335158
+ * @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.
335159
+ */
335160
+ static formatQuantity(magnitude, spec) {
335161
+ let valueIsNegative = magnitude < 0.0;
335162
+ let prefix = "";
335163
+ let suffix = "";
335164
+ let formattedValue = "";
335165
+ // Handle bearing/azimuth special formatting
335166
+ if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing || spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
335167
+ const result = this.processBearingAndAzimuth(magnitude, spec);
335168
+ magnitude = result.magnitude;
335169
+ prefix = result.prefix ?? "";
335170
+ suffix = result.suffix ?? "";
335171
+ }
335155
335172
  let formattedMagnitude = "";
335156
335173
  if (spec.format.hasUnits) {
335157
- formattedMagnitude = Formatter.formatComposite(magnitude, spec);
335174
+ const compositeResult = Formatter.formatComposite(magnitude, spec);
335175
+ formattedMagnitude = compositeResult.componentText;
335176
+ // Override the sign detection with the composite conversion result
335177
+ valueIsNegative = compositeResult.isNegative;
335158
335178
  }
335159
335179
  else {
335160
335180
  // unitless quantity
@@ -335165,7 +335185,12 @@ class Formatter {
335165
335185
  else
335166
335186
  formattedMagnitude = formattedMagnitude + spec.format.uomSeparator + spec.unitConversions[0].label;
335167
335187
  }
335188
+ // For unitless quantities, keep original sign detection
335168
335189
  }
335190
+ // Apply sign formatting based on the final determined sign
335191
+ const signFormatting = this.applySignFormatting(valueIsNegative, spec.format.showSignOption, spec.format.type);
335192
+ prefix += signFormatting.prefix;
335193
+ suffix = signFormatting.suffix + suffix;
335169
335194
  // add Sign prefix and suffix as necessary
335170
335195
  if ((prefix.length > 0 || suffix.length > 0) && formattedMagnitude.length > 0)
335171
335196
  formattedValue = prefix + formattedMagnitude + suffix;
@@ -335186,7 +335211,8 @@ class Formatter {
335186
335211
  magnitude -= quarterRevolution;
335187
335212
  quadrant++;
335188
335213
  }
335189
- let prefix, suffix;
335214
+ let prefix = "";
335215
+ let suffix = "";
335190
335216
  // Quadrants are
335191
335217
  // 3 0
335192
335218
  // 2 1
@@ -335213,7 +335239,7 @@ class Formatter {
335213
335239
  prefix = "N";
335214
335240
  }
335215
335241
  }
335216
- return { magnitude, prefix, suffix: suffix };
335242
+ return { magnitude, prefix, suffix };
335217
335243
  }
335218
335244
  if (type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
335219
335245
  let azimuthBase = 0; // default base is North
@@ -337680,7 +337706,7 @@ class TestContext {
337680
337706
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
337681
337707
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
337682
337708
  await core_frontend_1.NoRenderApp.startup({
337683
- applicationVersion: "5.3.0-dev.3",
337709
+ applicationVersion: "5.3.0-dev.4",
337684
337710
  applicationId: this.settings.gprid,
337685
337711
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.serviceAuthToken),
337686
337712
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
@@ -362947,7 +362973,7 @@ var loadLanguages = instance.loadLanguages;
362947
362973
  /***/ ((module) => {
362948
362974
 
362949
362975
  "use strict";
362950
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.3.0-dev.3","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","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":{"@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/eslint-plugin":"5.2.2-dev.2","@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.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","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/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@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"}}');
362976
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.3.0-dev.4","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","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":{"@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/eslint-plugin":"5.2.2-dev.2","@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.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","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/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@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"}}');
362951
362977
 
362952
362978
  /***/ }),
362953
362979