Skip to content

Commit

Permalink
@bentley/imodeljs-native 3.3.3 (#3832)
Browse files Browse the repository at this point in the history
* test native fixes for roundtripping placement when no geometry is present (#3642)

* move up equalWithFpTolerance and add test for placement geometry json roundtrip

* remove dead imports from development

* rush change

Co-authored-by: Michael Belousov <MichaelBelousov@users.noreply.github.com>

* close transformer state dumps even if overrides threw an error (#3612) (#3656)

* close transformer state dumps even if producing them threw an error

Co-authored-by: Michael Belousov <MichaelBelousov@users.noreply.github.com>

Co-authored-by: Michael Belousov <MichaelBelousov@users.noreply.github.com>

* fix failing test due to (previous) rounding error in queryModelRange (#3675)

* UI: Optimize creating subjects hierarchy in Models Tree (#3671)

* Bump tile format version (#3732)

* Add support for CloudSqlite (#3747)

* work on cloud containers

* make workspace containers use CloudSqlite

* wip

* workspace editor with new CloudSqlite

* support CloudContainers for opening SQLiteDbs

* add tests for CloudSqlite

* test anonymous access

* add tests for using CloudCache guid for write locks

* work on download checkpoint

* more download testing

* allow creating and opening SQLiteDbs with params

* cloud workspace tests

* rework resolveContainerName

* add WorkspaceDb versioning

* fix tests

* lint errors

* enable checksums for block names

* add makeVersion command to WorkspaceEditor

* documentation cleanup

* documentation cleanup

* add --noPrompt for initializeWorkspace

* support "@" scripts

* fix package file

* cleanup

* don't allow writes to workspaceDbs unless they have been versioned in the current txn

* fix tests

* rename container.attach to container.connect

* fix tests

* add detach arg to disconnect

* separate detach and disconnect

* allow offline usage

* collate nocase for listDb

* add detach command to WorkpsaceEditor

* show "friendly" file sizes

* add version for testing cloud gcs

* renames for customuri api

* workspace settings

* checkForChanges is not async

* get tests working

* load extra gcs databases stored in iModel settings

* work on loading settings

* work on settings

* read all settings and schema files at startup

* fix tests

* old->newV2props, add test for daemon, start working on supporting v2checkpoint without daemon

* doc cleanup

* don't rename V2CheckpointAccessProps members

* fixes, Nick please review

* doc cleanup

* wip

* merge

* fix tests

* cleanup lint warnings

* Add some tests, more changes around cache / blockcache_dir

* doc

* Add two env variables, prefetchbeforeopen, prefetchafteropen for testing. add non null assertions to some failing tests

* wip

* lint errors

* fix tests

* validate settings against schema

* validate array entries

* validate setting schemas

* workspace documentation

* afds

* rename curl debugging option

* wip

* time prefetch

* make editor functions async

* workspaceEditor doc

* document @ scripts

* workspaceEditor doc

* @ script examples

* cleanup

* new sqlite code for prefetch

* prefetch testing

* cleanup

* add a PREFETCH_TIMe env variable

* make WorkspaceDb.prefetch return the prefetch object

* wip

* merge

* update @types/chai

* add prefetch_nrequests

* use parseSync for Yargs

* log time taken for prefetch always

* lint errors

* allow choosing nRequests for prefetch testing

* don't use env variables, switch to app settings to determine a prefetch

* improve prefetch logging

* lint errors

* cleanup

* allow importDb to supply extension for input file

* use CloudContainer.blockSize

* lint errors

* use https for gcs data url

Co-authored-by: nick.tessier <22119573+nick4598@users.noreply.github.com>

* Fix requestElementGraphics (#3748)

* Add tests for `computeSchemaChecksum` (#3733)

* Functionality to generate sha1 hash for schema xml

* consuming iModelHost

* Adding static function to the schema class

* Made the hash generation as separate functionality due to circular import issue

* removed unnecessary import

* function name updated with lint fixes

* Moving changes to IModelHost

* Documentation removed

* combined test

* line space added back

* changelogs added

* Presentation: Avoid counting target instances when calling getContentDescriptor RPC operation (#3816)

* how about we avoid running rush update on imodel02 branch.

* fix up core-backend

* fix CheckpointManager test.

* Delete core-transformer's HubMock

Temporarily comment out TileCache tests.

* unused imports.

* fix TileCache.test.ts merge

* extract-api; doc TODOs

* lint

* invalid doc links.

* Fix presentation-backend test

* remove unncessary dependencies from map-layers-auth

* re-remove merge-restored removed deepEqualWithFpTolerance impl

* Lock down ts-node to 10.8.0 for now because istanbuljs/nyc#1473

* fix slash direction

* Lock superagent down to 7.1.3 because 7.1.6 has core-full-stack-test integration test failures in electron.

* String.replaceAll no existe.

* remove unnecessary pretest script that triggers an nyc bug

* fix test errors

* extract-api, lint

* remove temporary test setting for gcs

* fix lint error

Co-authored-by: Michael Belousov <mike.belousov@bentley.com>
Co-authored-by: Michael Belousov <MichaelBelousov@users.noreply.github.com>
Co-authored-by: NancyMcCallB <45079789+NancyMcCallB@users.noreply.github.com>
Co-authored-by: imodeljs-admin <38288322+imodeljs-admin@users.noreply.github.com>
Co-authored-by: Robert Lukasonok <70327485+roluk@users.noreply.github.com>
Co-authored-by: Caleb Shafer <31107829+calebmshafer@users.noreply.github.com>
Co-authored-by: Arun George <aruniverse@users.noreply.github.com>
Co-authored-by: johnnyd710 <19596966+johnnyd710@users.noreply.github.com>
Co-authored-by: Bill Steinbock <65047615+bsteinbk@users.noreply.github.com>
Co-authored-by: Mark Schlosser <47000437+markschlosseratbentley@users.noreply.github.com>
Co-authored-by: Michel D'Astous <mdastous-bentley@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: bbastings <65233531+bbastings@users.noreply.github.com>
Co-authored-by: Arun George <11051042+aruniverse@users.noreply.github.com>
Co-authored-by: kckst8 <6283674+kckst8@users.noreply.github.com>
Co-authored-by: AlainRobertAtBentley <73677355+AlainRobertAtBentley@users.noreply.github.com>
Co-authored-by: Alina Paliulionytė <67429235+Alina657@users.noreply.github.com>
Co-authored-by: Alina Paliulionyte <Alina657@users.noreply.github.com>
Co-authored-by: Daniel Toby <41296254+DanielToby@users.noreply.github.com>
Co-authored-by: kabentley <33296803+kabentley@users.noreply.github.com>
Co-authored-by: Grigas <35135765+grigasp@users.noreply.github.com>
Co-authored-by: nick.tessier <22119573+nick4598@users.noreply.github.com>
Co-authored-by: naveedkhan8067 <38525837+naveedkhan8067@users.noreply.github.com>
  • Loading branch information
2 parents 0656cdd + 0fd1035 commit 1bb80a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 85 deletions.
8 changes: 4 additions & 4 deletions packages/test-app/package.json
Expand Up @@ -28,17 +28,17 @@
"dotenv": "^10.0.0",
"dotenv-expand": "^5.1.0",
"fs-extra": "^8.1.0",
"yargs": "^16.0.0"
"yargs": "^17.4.0"
},
"devDependencies": {
"@itwin/build-tools": "workspace:*",
"@itwin/eslint-plugin": "workspace:*",
"@itwin/projects-client": "^0.6.0",
"@types/chai": "^4.1.4",
"@types/chai": "4.3.1",
"@types/mocha": "^8.2.2",
"@types/fs-extra": "^4.0.7",
"@types/node": "16.11.7",
"@types/yargs": "^12.0.5",
"@types/yargs": "^17.0.10",
"cross-env": "^5.1.4",
"eslint": "^7.11.0",
"internal-tools": "workspace:*",
Expand All @@ -52,4 +52,4 @@
],
"extends": "plugin:@itwin/itwinjs-recommended"
}
}
}
4 changes: 2 additions & 2 deletions packages/test-app/src/Main.ts
Expand Up @@ -19,7 +19,7 @@ import * as dotenvExpand from "dotenv-expand";

void (async () => {
try {
const envResult = dotenv.config({ path: path.resolve(__dirname, "../.env")});
const envResult = dotenv.config({ path: path.resolve(__dirname, "../.env") });
if (!envResult.error) {
dotenvExpand(envResult);
}
Expand Down Expand Up @@ -184,7 +184,7 @@ void (async () => {
default: false,
},
})
.parse();
.parseSync();

IModelHubUtils.setHubEnvironment(args.hub);

Expand Down
6 changes: 3 additions & 3 deletions packages/transformer/package.json
Expand Up @@ -54,11 +54,11 @@
"@itwin/core-geometry": "workspace:*",
"@itwin/ecschema-metadata": "workspace:*",
"@itwin/eslint-plugin": "workspace:*",
"@types/chai": "^4.1.4",
"@types/chai": "4.3.1",
"@types/chai-as-promised": "^7",
"@types/mocha": "^8.2.2",
"@types/node": "16.11.7",
"@types/semver": "^5.5.0",
"@types/semver": "^7.3.9",
"@types/sinon": "^9.0.0",
"chai": "^4.1.2",
"chai-as-promised": "^7",
Expand All @@ -72,7 +72,7 @@
"typescript": "~4.4.0"
},
"dependencies": {
"semver": "^5.5.0"
"semver": "^7.3.5"
},
"nyc": {
"extends": "./node_modules/@itwin/build-tools/.nycrc"
Expand Down
81 changes: 5 additions & 76 deletions packages/transformer/src/test/IModelTransformerUtils.ts
Expand Up @@ -3,11 +3,11 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { assert, Assertion, expect, util } from "chai";
import { assert, expect } from "chai";
import * as path from "path";
import { AccessToken, CompressedId64Set, DbResult, Guid, Id64, Id64Set, Id64String, Mutable } from "@itwin/core-bentley";
import { Schema } from "@itwin/ecschema-metadata";
import { Geometry, Point3d, Transform, YawPitchRollAngles } from "@itwin/core-geometry";
import { Point3d, Transform, YawPitchRollAngles } from "@itwin/core-geometry";
import {
AuxCoordSystem, AuxCoordSystem2d, CategorySelector, DefinitionModel, DisplayStyle3d, DrawingCategory, DrawingGraphicRepresentsElement,
ECSqlStatement, Element, ElementAspect, ElementMultiAspect, ElementRefersToElements, ElementUniqueAspect, Entity, ExternalSourceAspect, FunctionalSchema,
Expand All @@ -24,77 +24,6 @@ import {
import { IModelExporter, IModelExportHandler, IModelImporter, IModelTransformer } from "../core-transformer";
import { KnownTestLocations } from "./KnownTestLocations";

interface DeepEqualWithFpToleranceOpts {
tolerance?: number;
/** e.g. consider {x: undefined} and {} as deeply equal */
considerNonExistingAndUndefinedEqual?: boolean;
}

declare global {
namespace Chai {
interface Deep {
// might be better to implement .approximately.deep.equal, but this is simpler
equalWithFpTolerance(actual: any, options?: DeepEqualWithFpToleranceOpts): Assertion;
}
}
}

const isAlmostEqualNumber: (a: number, b: number, tol: number) => boolean = Geometry.isSameCoordinate;

export function deepEqualWithFpTolerance(
a: any,
b: any,
options: DeepEqualWithFpToleranceOpts = {},
): boolean {
if (options.tolerance === undefined) options.tolerance = 1e-10;
if (a === b) return true;
if (typeof a !== typeof b) return false;
switch (typeof a) {
case "number":
return isAlmostEqualNumber(a, b, options.tolerance);
case "string":
case "boolean":
case "function":
case "symbol":
case "undefined":
return false; // these objects can only be strict equal which was already tested
case "object":
if ((a === null) !== (b === null)) return false;
const aSize = Object.keys(a).filter((k) => options.considerNonExistingAndUndefinedEqual && a[k] !== undefined).length;
const bSize = Object.keys(b).filter((k) => options.considerNonExistingAndUndefinedEqual && b[k] !== undefined).length;
return aSize === bSize && Object.keys(a).every(
(key) =>
(key in b || options.considerNonExistingAndUndefinedEqual) &&
deepEqualWithFpTolerance(a[key], b[key], options)
);
default: // bigint unhandled
throw Error("unhandled deep compare type");
}
}

Assertion.addMethod(
"equalWithFpTolerance",
function equalWithFpTolerance(
expected: any,
options: DeepEqualWithFpToleranceOpts = {}
) {
if (options.tolerance === undefined) options.tolerance = 1e-10;
const actual = this._obj;
const isDeep = util.flag(this, "deep");
this.assert(
isDeep
? deepEqualWithFpTolerance(expected, actual, options)
: isAlmostEqualNumber(expected, actual, options.tolerance),
`expected ${isDeep ? "deep equality of " : " "
}#{exp} and #{act} with a tolerance of ${options.tolerance}`,
`expected ${isDeep ? "deep inequality of " : " "
}#{exp} and #{act} with a tolerance of ${options.tolerance}`,
expected,
actual
);
}
);

export class HubWrappers extends BackendTestUtils.HubWrappers {
protected static override get hubMock() { return HubMock; }
}
Expand Down Expand Up @@ -356,7 +285,7 @@ export async function assertIdentityTransformation(
);
} else if (!propChangesAllowed) {
// kept for conditional breakpoints
const _propEq = deepEqualWithFpTolerance(targetElem.asAny[propName], sourceElem.asAny[propName]);
const _propEq = BackendTestUtils.deepEqualWithFpTolerance(targetElem.asAny[propName], sourceElem.asAny[propName]);
expect(targetElem.asAny[propName]).to.deep.equalWithFpTolerance(
sourceElem.asAny[propName]
);
Expand Down Expand Up @@ -406,7 +335,7 @@ export async function assertIdentityTransformation(
}
// END jsonProperties TRANSFORMATION EXCEPTIONS
// kept for conditional breakpoints
const _eq = deepEqualWithFpTolerance(
const _eq = BackendTestUtils.deepEqualWithFpTolerance(
expectedSourceElemJsonProps,
targetElem.jsonProperties,
{ considerNonExistingAndUndefinedEqual: true }
Expand Down Expand Up @@ -475,7 +404,7 @@ export async function assertIdentityTransformation(
targetModelIds.add(targetModelId);
targetToSourceModelsMap.set(targetModel, sourceModel);
const expectedSourceModelJsonProps = { ...sourceModel.jsonProperties };
const _eq = deepEqualWithFpTolerance(
const _eq = BackendTestUtils.deepEqualWithFpTolerance(
expectedSourceModelJsonProps,
targetModel.jsonProperties,
);
Expand Down

0 comments on commit 1bb80a5

Please sign in to comment.