@itwin/imodel-transformer 1.0.0-dev.9 → 1.0.1-customchanges.0

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.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,37 @@
1
1
  # Change Log - @itwin/imodel-transformer
2
2
 
3
- This log was last generated on Wed, 06 Dec 2023 15:24:30 GMT and should not be manually modified.
3
+ <!-- This log was last generated on Mon, 04 Nov 2024 14:45:46 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.0.0
8
+
9
+ Mon, 04 Nov 2024 14:45:46 GMT
10
+
11
+ ### Patches
12
+
13
+ - skipPropagateChangesToRootElements should be default true ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
14
+ - Fixed BigMap class to implement Map (instead of extending it). Added missing method implementations. ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
15
+
16
+ ### Changes
17
+
18
+ - save reverse sync version for process all transformations ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
19
+ - remove deprecated for 3.x, 0.1.x, 0.1.0 ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
20
+ - 1.0.0-dev.0 ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
21
+ - move to one getter for synchronizationVersion, bust a potential cached synchronizationVersion whenever we make changes to targetscopeprovenance, and only save changes if handleUnsafeMigrate makes changes not just if unsafe migrate is enabled ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
22
+ - Revert "save and push changes after transformer is complete (#153)" ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
23
+ - add more cases to support preserveElementIdsForFiltering options ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
24
+ - In itwinjs versions 4.6.0 and greater DefinitionContainers are now deleted as if they were DefinitionPartitions. Made a change to onDeleteModel to treat definitinocontainers as if they were definitionpartitions ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
25
+ - Support setting the reversesync and sync version when unsafe-migrate is set. Also fix bug with haselementchangedcache ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
26
+ - add alternative schemaToXmlString ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
27
+ - no longer track partially commited element references ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
28
+ - only store deleted ESAS of kind 'Element' in processChangesets ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
29
+ - improve error messages for mismatching peer dependencies ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
30
+ - Make processAll and processChanges private, expose a public process function and let people pass isSync to constructor of imodeltransformer ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
31
+ - ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
32
+ - in findTargetEntityId, special case the repositoryModel such that we ignore any remappings and just set the target to the repositoryModelId ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
33
+ - add extract-api.yaml ([commit](https://github.com/iTwin/transformer/commit/f91dcaa8e6d560b288a7ea3ed9203182bb870740))
34
+
7
35
  ## 0.4.3
8
36
 
9
37
  Wed, 06 Dec 2023 15:24:30 GMT
package/README.md CHANGED
@@ -31,3 +31,20 @@ require("https").get("https://registry.npmjs.org/@itwin/imodel-transformer", r=>
31
31
  }))
32
32
  EOF
33
33
  ```
34
+
35
+ ## Environment Variables
36
+
37
+ ### TRANSFORMER_NO_STRICT_DEP_CHECK
38
+
39
+ Set this variable to `1` to disable strict dependency checks in `packages/transformer/src/transformer.ts`. The strict dependency check validates that the version of @itwinjs/core-backend provided falls in the range defined by the peerDependencies of the transformer package.
40
+
41
+ ### SUGGEST_TRANSFORMER_VERSIONS
42
+
43
+ Set this variable to `1` to enable `packages/transformer/src/transformer.ts` to suggest compatible versions if dependencies are not in the specified peer dependency range of this package.
44
+
45
+ ```dotenv
46
+ # Disable strict dependency checks in transformer.ts
47
+ TRANSFORMER_NO_STRICT_DEP_CHECK=1
48
+
49
+ # Enable version suggestions in transformer.ts
50
+ SUGGEST_TRANSFORMER_VERSIONS=1
@@ -1 +1 @@
1
- {"version":3,"file":"BranchProvenanceInitializer.d.ts","sourceRoot":"","sources":["../../src/BranchProvenanceInitializer.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,QAAQ,EAGT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAY,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAS7E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,MAAM,EAAE,QAAQ,CAAC;IACjB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,MAAM,EAAE,QAAQ,CAAC;IACjB;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,kBAAkB,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,EAAE,UAAU,CAAC;IACjC,sBAAsB,EAAE,UAAU,CAAC;IACnC,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC,CA+J/B"}
1
+ {"version":3,"file":"BranchProvenanceInitializer.d.ts","sourceRoot":"","sources":["../../src/BranchProvenanceInitializer.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,QAAQ,EAGT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAY,UAAU,EAAoB,MAAM,qBAAqB,CAAC;AAS7E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,MAAM,EAAE,QAAQ,CAAC;IACjB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,MAAM,EAAE,QAAQ,CAAC;IACjB;;;;;;;OAOG;IACH,uBAAuB,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,kBAAkB,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,oBAAoB,EAAE,UAAU,CAAC;IACjC,sBAAsB,EAAE,UAAU,CAAC;IACnC,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED;;GAEG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,oBAAoB,CAAC,CAkK/B"}
@@ -18,6 +18,7 @@ async function initializeBranchProvenance(args) {
18
18
  if (args.createFedGuidsForMaster) {
19
19
  // FIXME<LOW>: Consider enforcing that the master and branch dbs passed as part of ProvenanceInitArgs to this function
20
20
  // are identical. https://github.com/iTwin/imodel-transformer/issues/138
21
+ /* eslint-disable deprecation/deprecation */
21
22
  args.master.withSqliteStatement(`
22
23
  UPDATE bis_Element
23
24
  SET FederationGuid=randomblob(16)
@@ -50,6 +51,7 @@ async function initializeBranchProvenance(args) {
50
51
  // eslint-disable-next-line @itwin/no-internal
51
52
  assert(res === core_bentley_1.DbResult.BE_SQLITE_ERROR, args.branch.nativeDb.getLastError());
52
53
  });
54
+ /* eslint-enable deprecation/deprecation */
53
55
  args.branch.performCheckpoint();
54
56
  const reopenBranch = makeDbReopener(args.branch);
55
57
  // close dbs because element cache could be invalid
@@ -1 +1 @@
1
- {"version":3,"file":"BranchProvenanceInitializer.js","sourceRoot":"","sources":["../../src/BranchProvenanceInitializer.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,sDAO6B;AAC7B,sDAA6E;AAC7E,oDAI4B;AAC5B,iCAAiC;AACjC,2DAAwD;AACxD,6BAAoC;AAoCpC;;GAEG;AACI,KAAK,UAAU,0BAA0B,CAC9C,IAAwB;IAExB,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACjC,sHAAsH;QACtH,wEAAwE;QACxE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAC7B;;;;OAIC;QACD,8CAA8C;QAC9C,CAAC,CAAC,EAAE,EAAE,CACJ,MAAM,CACJ,CAAC,CAAC,IAAI,EAAE,KAAK,uBAAQ,CAAC,cAAc,EACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,CACpC,CACJ,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACxC,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,eAAe;QACpC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAC7B,oBAAoB,IAAA,mBAAa,EAAC,GAAG,UAAU,EAAE,CAAC,qBAAqB;QACvE,8CAA8C;QAC9C,CAAC,CAAC,EAAE,EAAE,CACJ,MAAM,CACJ,CAAC,CAAC,IAAI,EAAE,KAAK,uBAAQ,CAAC,cAAc,EACpC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,CACpC,CACJ,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAC7B;;;;;;QAME;QACF,8CAA8C;QAC9C,CAAC,CAAC,EAAE,EAAE,CACJ,MAAM,CACJ,CAAC,CAAC,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AAI,EAAE,YAAY,0BAAW;QAC3B,QAAQ,GAAG,KAAK,EAAE,IAAI,GAAG,YAAY,EAAE,EAAE,CACvC,0BAAW,CAAC,IAAI,CAAC;YACf,QAAQ,EAAE,MAAM;YAChB,QAAQ,EAAE,IAAI,KAAK,uBAAQ,CAAC,QAAQ;SACrC,CAAC,CAAC;SACF,IAAI,EAAE,YAAY,2BAAY;QACjC,QAAQ,GAAG,CAAC,IAAI,GAAG,YAAY,EAAE,EAAE,CAAC,2BAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;;QACrE,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC,IAAI,iBAAiB,CAAC,CAAC;IACrE,OAAO,QAAQ,CAAC;AAClB,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 *--------------------------------------------------------------------------------------------*/\nimport {\n BriefcaseDb,\n ExternalSource,\n ExternalSourceIsInRepository,\n IModelDb,\n RepositoryLink,\n StandaloneDb,\n} from \"@itwin/core-backend\";\nimport { DbResult, Id64String, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport {\n Code,\n ExternalSourceProps,\n RepositoryLinkProps,\n} from \"@itwin/core-common\";\nimport * as assert from \"assert\";\nimport { IModelTransformer } from \"./IModelTransformer\";\nimport { pathToFileURL } from \"url\";\n/**\n * @alpha\n */\nexport interface ProvenanceInitArgs {\n /** the master iModel which is the source of the provenance */\n master: IModelDb;\n /** the canonical url of the master iModel */\n masterUrl?: string;\n /** the description of the master iModel */\n masterDescription?: string;\n /**\n * @param {IModelDb} branchDb - the branch iModel which is the container of the provenance\n * Must be opened Read/Write\n */\n branch: IModelDb;\n /**\n * insert Federation Guids in all lacking elements in the master database, which will prevent\n * needing to insert External Source Aspects for provenance tracking\n * @note requires a read/write master\n * @note closes both the master and branch iModels to reset caches, so you must reopen them.\n * If you pass `\"keep-reopened-db\"`, this object's `master` and `branch` properties will\n * be set to new, open databases.\n */\n createFedGuidsForMaster?: true | false | \"keep-reopened-db\";\n}\n\n/**\n * @alpha\n */\nexport interface ProvenanceInitResult {\n targetScopeElementId: Id64String;\n masterExternalSourceId: Id64String;\n masterRepositoryLinkId: Id64String;\n}\n\n/**\n * @alpha\n */\nexport async function initializeBranchProvenance(\n args: ProvenanceInitArgs\n): Promise<ProvenanceInitResult> {\n if (args.createFedGuidsForMaster) {\n // FIXME<LOW>: Consider enforcing that the master and branch dbs passed as part of ProvenanceInitArgs to this function\n // are identical. https://github.com/iTwin/imodel-transformer/issues/138\n args.master.withSqliteStatement(\n `\n UPDATE bis_Element\n SET FederationGuid=randomblob(16)\n WHERE FederationGuid IS NULL\n `,\n // eslint-disable-next-line @itwin/no-internal\n (s) =>\n assert(\n s.step() === DbResult.BE_SQLITE_DONE,\n args.branch.nativeDb.getLastError()\n )\n );\n const masterPath = args.master.pathName;\n const reopenMaster = makeDbReopener(args.master);\n args.master.close(); // prevent busy\n args.branch.withSqliteStatement(\n `ATTACH DATABASE '${pathToFileURL(`${masterPath}`)}?mode=ro' AS master`,\n // eslint-disable-next-line @itwin/no-internal\n (s) =>\n assert(\n s.step() === DbResult.BE_SQLITE_DONE,\n args.branch.nativeDb.getLastError()\n )\n );\n args.branch.withSqliteStatement(\n `\n UPDATE main.bis_Element\n SET FederationGuid = (\n SELECT m.FederationGuid\n FROM master.bis_Element m\n WHERE m.Id=main.bis_Element.Id\n )`,\n // eslint-disable-next-line @itwin/no-internal\n (s) =>\n assert(\n s.step() === DbResult.BE_SQLITE_DONE,\n args.branch.nativeDb.getLastError()\n )\n );\n args.branch.clearCaches(); // statements write lock attached db (clearing statement cache does not fix this)\n args.branch.saveChanges();\n args.branch.withSqliteStatement(\"DETACH DATABASE master\", (s) => {\n const res = s.step();\n if (res !== DbResult.BE_SQLITE_DONE)\n Logger.logTrace(\n \"initializeBranchProvenance\",\n `Error detaching db (we will close anyway): ${args.branch.nativeDb.getLastError()}`\n );\n // this is the case until native side changes\n // eslint-disable-next-line @itwin/no-internal\n assert(\n res === DbResult.BE_SQLITE_ERROR,\n args.branch.nativeDb.getLastError()\n );\n });\n args.branch.performCheckpoint();\n\n const reopenBranch = makeDbReopener(args.branch);\n // close dbs because element cache could be invalid\n args.branch.close();\n [args.master, args.branch] = await Promise.all([\n reopenMaster(),\n reopenBranch(),\n ]);\n }\n\n // create an external source and owning repository link to use as our *Target Scope Element* for future synchronizations\n const masterRepoLinkId = args.branch.elements.insertElement({\n classFullName: RepositoryLink.classFullName,\n code: RepositoryLink.createCode(\n args.branch,\n IModelDb.repositoryModelId,\n \"example-code-value\"\n ),\n model: IModelDb.repositoryModelId,\n url: args.masterUrl,\n format: \"iModel\",\n repositoryGuid: args.master.iModelId,\n description: args.masterDescription,\n } as RepositoryLinkProps);\n\n const masterExternalSourceId = args.branch.elements.insertElement({\n classFullName: ExternalSource.classFullName,\n model: IModelDb.rootSubjectId,\n code: Code.createEmpty(),\n repository: new ExternalSourceIsInRepository(masterRepoLinkId),\n /* eslint-disable @typescript-eslint/no-var-requires */\n connectorName: require(\"../../package.json\").name,\n connectorVersion: require(\"../../package.json\").version,\n /* eslint-enable @typescript-eslint/no-var-requires */\n } as ExternalSourceProps);\n\n const fedGuidLessElemsSql = `\n SELECT ECInstanceId AS id\n FROM Bis.Element\n WHERE FederationGuid IS NULL\n AND ECInstanceId NOT IN (0x1, 0xe, 0x10) /* ignore special elems */\n `;\n const elemReader = args.branch.createQueryReader(\n fedGuidLessElemsSql,\n undefined,\n { usePrimaryConn: true }\n );\n while (await elemReader.step()) {\n const id: string = elemReader.current.toRow().id;\n const aspectProps = IModelTransformer.initElementProvenanceOptions(id, id, {\n isReverseSynchronization: false,\n targetScopeElementId: masterExternalSourceId,\n sourceDb: args.master,\n targetDb: args.branch,\n });\n args.branch.elements.insertAspect(aspectProps);\n }\n\n const fedGuidLessRelsSql = `\n SELECT erte.ECInstanceId as id\n FROM Bis.ElementRefersToElements erte\n JOIN bis.Element se\n ON se.ECInstanceId=erte.SourceECInstanceId\n JOIN bis.Element te\n ON te.ECInstanceId=erte.TargetECInstanceId\n WHERE se.FederationGuid IS NULL\n OR te.FederationGuid IS NULL`;\n const relReader = args.branch.createQueryReader(\n fedGuidLessRelsSql,\n undefined,\n { usePrimaryConn: true }\n );\n while (await relReader.step()) {\n const id: string = relReader.current.toRow().id;\n const aspectProps = IModelTransformer.initRelationshipProvenanceOptions(\n id,\n id,\n {\n isReverseSynchronization: false,\n targetScopeElementId: masterExternalSourceId,\n sourceDb: args.master,\n targetDb: args.branch,\n forceOldRelationshipProvenanceMethod: false,\n }\n );\n args.branch.elements.insertAspect(aspectProps);\n }\n\n if (args.createFedGuidsForMaster === true) {\n args.master.close();\n args.branch.close();\n }\n\n return {\n targetScopeElementId: masterExternalSourceId,\n masterExternalSourceId,\n masterRepositoryLinkId: masterRepoLinkId,\n };\n}\n\nfunction makeDbReopener(db: IModelDb) {\n const originalMode = db.isReadonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const dbPath = db.pathName;\n let reopenDb: (mode?: OpenMode) => IModelDb | Promise<IModelDb>;\n if (db instanceof BriefcaseDb)\n reopenDb = async (mode = originalMode) =>\n BriefcaseDb.open({\n fileName: dbPath,\n readonly: mode === OpenMode.Readonly,\n });\n else if (db instanceof StandaloneDb)\n reopenDb = (mode = originalMode) => StandaloneDb.openFile(dbPath, mode);\n else assert(false, `db type '${db.constructor.name}' not supported`);\n return reopenDb;\n}\n"]}
1
+ {"version":3,"file":"BranchProvenanceInitializer.js","sourceRoot":"","sources":["../../src/BranchProvenanceInitializer.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG,sDAO6B;AAC7B,sDAA6E;AAC7E,oDAI4B;AAC5B,iCAAiC;AACjC,2DAAwD;AACxD,6BAAoC;AAoCpC;;GAEG;AACI,KAAK,UAAU,0BAA0B,CAC9C,IAAwB;IAExB,IAAI,IAAI,CAAC,uBAAuB,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AY,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;;QACrE,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,CAAC,WAAW,CAAC,IAAI,iBAAiB,CAAC,CAAC;IACrE,OAAO,QAAQ,CAAC;AAClB,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 *--------------------------------------------------------------------------------------------*/\nimport {\n BriefcaseDb,\n ExternalSource,\n ExternalSourceIsInRepository,\n IModelDb,\n RepositoryLink,\n StandaloneDb,\n} from \"@itwin/core-backend\";\nimport { DbResult, Id64String, Logger, OpenMode } from \"@itwin/core-bentley\";\nimport {\n Code,\n ExternalSourceProps,\n RepositoryLinkProps,\n} from \"@itwin/core-common\";\nimport * as assert from \"assert\";\nimport { IModelTransformer } from \"./IModelTransformer\";\nimport { pathToFileURL } from \"url\";\n/**\n * @alpha\n */\nexport interface ProvenanceInitArgs {\n /** the master iModel which is the source of the provenance */\n master: IModelDb;\n /** the canonical url of the master iModel */\n masterUrl?: string;\n /** the description of the master iModel */\n masterDescription?: string;\n /**\n * @param {IModelDb} branchDb - the branch iModel which is the container of the provenance\n * Must be opened Read/Write\n */\n branch: IModelDb;\n /**\n * insert Federation Guids in all lacking elements in the master database, which will prevent\n * needing to insert External Source Aspects for provenance tracking\n * @note requires a read/write master\n * @note closes both the master and branch iModels to reset caches, so you must reopen them.\n * If you pass `\"keep-reopened-db\"`, this object's `master` and `branch` properties will\n * be set to new, open databases.\n */\n createFedGuidsForMaster?: true | false | \"keep-reopened-db\";\n}\n\n/**\n * @alpha\n */\nexport interface ProvenanceInitResult {\n targetScopeElementId: Id64String;\n masterExternalSourceId: Id64String;\n masterRepositoryLinkId: Id64String;\n}\n\n/**\n * @alpha\n */\nexport async function initializeBranchProvenance(\n args: ProvenanceInitArgs\n): Promise<ProvenanceInitResult> {\n if (args.createFedGuidsForMaster) {\n // FIXME<LOW>: Consider enforcing that the master and branch dbs passed as part of ProvenanceInitArgs to this function\n // are identical. https://github.com/iTwin/imodel-transformer/issues/138\n /* eslint-disable deprecation/deprecation */\n args.master.withSqliteStatement(\n `\n UPDATE bis_Element\n SET FederationGuid=randomblob(16)\n WHERE FederationGuid IS NULL\n `,\n // eslint-disable-next-line @itwin/no-internal\n (s) =>\n assert(\n s.step() === DbResult.BE_SQLITE_DONE,\n args.branch.nativeDb.getLastError()\n )\n );\n const masterPath = args.master.pathName;\n const reopenMaster = makeDbReopener(args.master);\n args.master.close(); // prevent busy\n args.branch.withSqliteStatement(\n `ATTACH DATABASE '${pathToFileURL(`${masterPath}`)}?mode=ro' AS master`,\n // eslint-disable-next-line @itwin/no-internal\n (s) =>\n assert(\n s.step() === DbResult.BE_SQLITE_DONE,\n args.branch.nativeDb.getLastError()\n )\n );\n args.branch.withSqliteStatement(\n `\n UPDATE main.bis_Element\n SET FederationGuid = (\n SELECT m.FederationGuid\n FROM master.bis_Element m\n WHERE m.Id=main.bis_Element.Id\n )`,\n\n // eslint-disable-next-line @itwin/no-internal\n (s) =>\n assert(\n s.step() === DbResult.BE_SQLITE_DONE,\n args.branch.nativeDb.getLastError()\n )\n );\n args.branch.clearCaches(); // statements write lock attached db (clearing statement cache does not fix this)\n args.branch.saveChanges();\n args.branch.withSqliteStatement(\"DETACH DATABASE master\", (s) => {\n const res = s.step();\n if (res !== DbResult.BE_SQLITE_DONE)\n Logger.logTrace(\n \"initializeBranchProvenance\",\n `Error detaching db (we will close anyway): ${args.branch.nativeDb.getLastError()}`\n );\n // this is the case until native side changes\n // eslint-disable-next-line @itwin/no-internal\n assert(\n res === DbResult.BE_SQLITE_ERROR,\n args.branch.nativeDb.getLastError()\n );\n });\n /* eslint-enable deprecation/deprecation */\n args.branch.performCheckpoint();\n\n const reopenBranch = makeDbReopener(args.branch);\n // close dbs because element cache could be invalid\n args.branch.close();\n [args.master, args.branch] = await Promise.all([\n reopenMaster(),\n reopenBranch(),\n ]);\n }\n\n // create an external source and owning repository link to use as our *Target Scope Element* for future synchronizations\n const masterRepoLinkId = args.branch.elements.insertElement({\n classFullName: RepositoryLink.classFullName,\n code: RepositoryLink.createCode(\n args.branch,\n IModelDb.repositoryModelId,\n \"example-code-value\"\n ),\n model: IModelDb.repositoryModelId,\n url: args.masterUrl,\n format: \"iModel\",\n repositoryGuid: args.master.iModelId,\n description: args.masterDescription,\n } as RepositoryLinkProps);\n\n const masterExternalSourceId = args.branch.elements.insertElement({\n classFullName: ExternalSource.classFullName,\n model: IModelDb.rootSubjectId,\n code: Code.createEmpty(),\n repository: new ExternalSourceIsInRepository(masterRepoLinkId),\n /* eslint-disable @typescript-eslint/no-var-requires */\n connectorName: require(\"../../package.json\").name,\n connectorVersion: require(\"../../package.json\").version,\n /* eslint-enable @typescript-eslint/no-var-requires */\n } as ExternalSourceProps);\n\n const fedGuidLessElemsSql = `\n SELECT ECInstanceId AS id\n FROM Bis.Element\n WHERE FederationGuid IS NULL\n AND ECInstanceId NOT IN (0x1, 0xe, 0x10) /* ignore special elems */\n `;\n const elemReader = args.branch.createQueryReader(\n fedGuidLessElemsSql,\n undefined,\n { usePrimaryConn: true }\n );\n while (await elemReader.step()) {\n const id: string = elemReader.current.toRow().id;\n const aspectProps = IModelTransformer.initElementProvenanceOptions(id, id, {\n isReverseSynchronization: false,\n targetScopeElementId: masterExternalSourceId,\n sourceDb: args.master,\n targetDb: args.branch,\n });\n args.branch.elements.insertAspect(aspectProps);\n }\n\n const fedGuidLessRelsSql = `\n SELECT erte.ECInstanceId as id\n FROM Bis.ElementRefersToElements erte\n JOIN bis.Element se\n ON se.ECInstanceId=erte.SourceECInstanceId\n JOIN bis.Element te\n ON te.ECInstanceId=erte.TargetECInstanceId\n WHERE se.FederationGuid IS NULL\n OR te.FederationGuid IS NULL`;\n const relReader = args.branch.createQueryReader(\n fedGuidLessRelsSql,\n undefined,\n { usePrimaryConn: true }\n );\n while (await relReader.step()) {\n const id: string = relReader.current.toRow().id;\n const aspectProps = IModelTransformer.initRelationshipProvenanceOptions(\n id,\n id,\n {\n isReverseSynchronization: false,\n targetScopeElementId: masterExternalSourceId,\n sourceDb: args.master,\n targetDb: args.branch,\n forceOldRelationshipProvenanceMethod: false,\n }\n );\n args.branch.elements.insertAspect(aspectProps);\n }\n\n if (args.createFedGuidsForMaster === true) {\n args.master.close();\n args.branch.close();\n }\n\n return {\n targetScopeElementId: masterExternalSourceId,\n masterExternalSourceId,\n masterRepositoryLinkId: masterRepoLinkId,\n };\n}\n\nfunction makeDbReopener(db: IModelDb) {\n const originalMode = db.isReadonly ? OpenMode.Readonly : OpenMode.ReadWrite;\n const dbPath = db.pathName;\n let reopenDb: (mode?: OpenMode) => IModelDb | Promise<IModelDb>;\n if (db instanceof BriefcaseDb)\n reopenDb = async (mode = originalMode) =>\n BriefcaseDb.open({\n fileName: dbPath,\n readonly: mode === OpenMode.Readonly,\n });\n else if (db instanceof StandaloneDb)\n reopenDb = (mode = originalMode) => StandaloneDb.openFile(dbPath, mode);\n else assert(false, `db type '${db.constructor.name}' not supported`);\n return reopenDb;\n}\n"]}
@@ -7,7 +7,7 @@ import { EntityReference } from "@itwin/core-common";
7
7
  import { ConcreteEntity, ConcreteEntityProps, IModelDb } from "@itwin/core-backend";
8
8
  /** @internal */
9
9
  export declare namespace EntityUnifier {
10
- export function getReadableType(entity: ConcreteEntity): "element" | "element aspect" | "relationship" | "unknown entity type";
10
+ export function getReadableType(entity: ConcreteEntity): "element" | "relationship" | "element aspect" | "unknown entity type";
11
11
  type EntityUpdater = (entityProps: ConcreteEntityProps) => void;
12
12
  /** needs to return a widened type otherwise typescript complains when result is used with a narrow type */
13
13
  export function updaterFor(db: IModelDb, entity: ConcreteEntity): EntityUpdater;
@@ -1,11 +1,10 @@
1
1
  /** @packageDocumentation
2
2
  * @module iModels
3
3
  */
4
- import { BriefcaseDb, ChangedECInstance, Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, IModelDb, IModelJsNative, Model, Relationship } from "@itwin/core-backend";
5
- import { AccessToken, Id64String } from "@itwin/core-bentley";
4
+ import { BriefcaseDb, ChangedECInstance, Element, ElementAspect, ElementMultiAspect, ElementUniqueAspect, IModelDb, IModelJsNative, Model, Relationship, SqliteChangeOp } from "@itwin/core-backend";
5
+ import { Id64String } from "@itwin/core-bentley";
6
6
  import { ChangesetFileProps, CodeSpec, FontProps } from "@itwin/core-common";
7
7
  import { Schema, SchemaKey } from "@itwin/ecschema-metadata";
8
- import type { InitOptions } from "./IModelTransformer";
9
8
  import { ElementAspectsHandler, ExportElementAspectsStrategy } from "./ExportElementAspectsStrategy";
10
9
  /**
11
10
  * @beta
@@ -25,7 +24,7 @@ export type ExporterInitOptions = ExportChangesOptions;
25
24
  * Arguments for [[IModelExporter.exportChanges]]
26
25
  * @public
27
26
  */
28
- export type ExportChangesOptions = Omit<InitOptions, "startChangeset"> & {
27
+ export type ExportChangesOptions = {
29
28
  skipPropagateChangesToRootElements?: boolean;
30
29
  } /**
31
30
  * an array of ChangesetFileProps which are used to read the changesets and populate the ChangedInstanceIds using [[ChangedInstanceIds.initialize]] in [[IModelExporter.exportChanges]]
@@ -96,7 +95,9 @@ export declare abstract class IModelExportHandler {
96
95
  * @note This method can optionally be overridden to exclude an individual Element (and its children and ElementAspects) from the export. The base implementation always returns `true`.
97
96
  */
98
97
  shouldExportElement(_element: Element): boolean;
99
- /** Called when element is skipped instead of exported. */
98
+ /** Called when element is skipped instead of exported.
99
+ * @note When an element is skipped, exporter will not export any of its child elements. Because of this, [[onSkipElement]] will not be invoked for any children of a "skipped" element.
100
+ */
100
101
  onSkipElement(_elementId: Id64String): void;
101
102
  /** Called when an element should be exported.
102
103
  * @param element The element to export
@@ -197,7 +198,7 @@ export declare class IModelExporter {
197
198
  private _sourceDbChanges?;
198
199
  /**
199
200
  * Retrieve the cached entity change information.
200
- * @note This will only be initialized after [IModelExporter.exportChanges] is invoked.
201
+ * @note This will only be initialized after [IModelExporter.exportChanges] is invoked or [IModelExporter.initialize] is called.
201
202
  */
202
203
  get sourceDbChanges(): ChangedInstanceIds | undefined;
203
204
  /** The handler called by this IModelExporter. */
@@ -229,6 +230,16 @@ export declare class IModelExporter {
229
230
  * you pass to [[IModelExporter.exportChanges]]
230
231
  */
231
232
  initialize(options: ExporterInitOptions): Promise<void>;
233
+ /**
234
+ * This function is called by the transformer as it is about to process the changesets passed to it in [[IModelTransformOptions.argsForProcessChanges]].
235
+ * This would be after the exporter has already processed the same set of changesets passed to the transformer in [[IModelTransformOptions.argsForProcessChanges]].
236
+ * This function should be used to modify the exporter's sourceDbChanges, if necessary, using [[ChangedInstanceIds.addCustomChange]]. See [[ChangedInstanceIds.addCustomChange]] for more information.
237
+ * @note [[IModelExporter.sourceDbChanges]] will only be defined if the transformer was called with [[IModelTransformOptions.argsForProcessChanges]].
238
+ * @note If defined, sourceDbChanges will already be populated with the changesets passed to the transformer, if any when this function is called by the transformer.
239
+ * @note The transformer will have built up the remap table between the source and target iModels before calling this function. This means that functions like [[IModelTransformer.context.findTargetElementId]] will return meaningful results.
240
+ * @note Its expected that this function be overridden by a subclass of exporter if it needs to modify sourceDbChanges.
241
+ */
242
+ addCustomChanges(): void;
232
243
  /** Register the handler that will be called by IModelExporter. */
233
244
  registerHandler(handler: IModelExportHandler): void;
234
245
  /** Add a rule to exclude a CodeSpec */
@@ -255,8 +266,6 @@ export declare class IModelExporter {
255
266
  * for consecutive calls
256
267
  */
257
268
  exportChanges(args?: ExportChangesOptions): Promise<void>;
258
- /** @deprecated in 0.1.x, use a single [[ExportChangesOptions]] object instead */
259
- exportChanges(accessToken?: AccessToken, startChangesetId?: string, args?: ExportChangesOptions): Promise<void>;
260
269
  private _resetChangeDataOnExport;
261
270
  /** Export schemas from the source iModel.
262
271
  * @note This must be called separately from [[exportAll]] or [[exportChanges]].
@@ -333,13 +342,13 @@ export declare class IModelExporter {
333
342
  }
334
343
  /**
335
344
  * Arguments for [[ChangedInstanceIds.initialize]]
336
- * @beta
345
+ * @public
337
346
  */
338
347
  export type ChangedInstanceIdsInitOptions = ExportChangesOptions & {
339
348
  iModel: BriefcaseDb;
340
349
  };
341
350
  /** Class for holding change information.
342
- * @beta
351
+ * @public
343
352
  */
344
353
  export declare class ChangedInstanceOps {
345
354
  insertIds: Set<string>;
@@ -347,10 +356,22 @@ export declare class ChangedInstanceOps {
347
356
  deleteIds: Set<string>;
348
357
  /** Initializes the object from IModelJsNative.ChangedInstanceOpsProps. */
349
358
  addFromJson(val: IModelJsNative.ChangedInstanceOpsProps | undefined): void;
359
+ get isEmpty(): boolean;
360
+ }
361
+ export type ChangedInstanceType = "codeSpec" | "model" | "element" | "aspect" | "relationship" | "font";
362
+ /**
363
+ * Interface to describe a 'custom' change. A custom change is one which isn't found by reading changesets, but instead added by a user calling the 'addCustomChange' API on the ChangedInstanceIds instance.
364
+ * The purpose a custom change would serve is to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
365
+ */
366
+ export interface ChangedInstanceCustomRelationshipData {
367
+ sourceIdOfRelationship: Id64String;
368
+ targetIdOfRelationship: Id64String;
369
+ ecClassId: Id64String;
370
+ classFullName: string;
350
371
  }
351
372
  /**
352
373
  * Class for discovering modified elements between 2 versions of an iModel.
353
- * @beta
374
+ * @public
354
375
  */
355
376
  export declare class ChangedInstanceIds {
356
377
  codeSpec: ChangedInstanceOps;
@@ -364,6 +385,11 @@ export declare class ChangedInstanceIds {
364
385
  private _elementSubclassIds?;
365
386
  private _aspectSubclassIds?;
366
387
  private _relationshipSubclassIds?;
388
+ private _relationshipSubclassIdsToSkip?;
389
+ private _ecClassIdsToClassFullNames?;
390
+ /** c${string} is used to represent codeSpecs since they do not currently have a representation in the EntityReference class. This map holds information passed to the 'addCustom' functions. */
391
+ private _entityReferenceToCustomDataMap;
392
+ private _hasCustomChanges;
367
393
  private _db;
368
394
  constructor(db: IModelDb);
369
395
  private setupECClassIds;
@@ -373,6 +399,8 @@ export declare class ChangedInstanceIds {
373
399
  private isAspect;
374
400
  private isModel;
375
401
  private isElement;
402
+ get hasCustomChanges(): boolean;
403
+ get isEmpty(): boolean;
376
404
  /**
377
405
  * Adds the provided [[ChangedECInstance]] to the appropriate set of changes by class type (codeSpec, model, element, aspect, or relationship) maintained by this instance of ChangedInstanceIds.
378
406
  * If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
@@ -380,9 +408,70 @@ export declare class ChangedInstanceIds {
380
408
  * @param change ChangedECInstance which has the ECInstanceId, changeType (insert, update, delete) and ECClassId of the changed entity
381
409
  */
382
410
  addChange(change: ChangedECInstance): Promise<void>;
411
+ /**
412
+ * Adds the provided change to the element changes maintained by this instance of ChangedInstanceIds
413
+ * If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
414
+ * from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
415
+ * @note element changes will also cause the element's model to be marked as updated in [[ChangedInstanceIds.model]], so that the element does not get skipped by the transformer.
416
+ * @note It is the responsibility of the caller to ensure that the provided id is, in fact an element.
417
+ * @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
418
+ */
419
+ addCustomElementChange(changeType: SqliteChangeOp, id: Id64String): void;
420
+ /**
421
+ * Adds the provided change to the codespec changes maintained by this instance of ChangedInstanceIds
422
+ * If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
423
+ * from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
424
+ * @note It is the responsibility of the caller to ensure that the provided id is, in fact a codespec.
425
+ * @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
426
+ */
427
+ addCustomCodeSpecChange(changeType: SqliteChangeOp, id: Id64String): void;
428
+ /**
429
+ * Adds the provided change to the model changes maintained by this instance of ChangedInstanceIds
430
+ * If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
431
+ * from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
432
+ * @note It is the responsibility of the caller to ensure that the provided id is, in fact a model.
433
+ * @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
434
+ */
435
+ addCustomModelChange(changeType: SqliteChangeOp, id: Id64String): void;
436
+ /**
437
+ * Adds the provided change to the aspect changes maintained by this instance of ChangedInstanceIds
438
+ * If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
439
+ * from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
440
+ * @note It is the responsibility of the caller to ensure that the provided id is, in fact an aspect.
441
+ * @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
442
+ */
443
+ addCustomAspectChange(changeType: SqliteChangeOp, id: Id64String): void;
444
+ /**
445
+ * TODO: Think more about permutations of model updated / inserted / deleted. Can you delete a model without deleting its elements?
446
+ * What if model delete but custom change si to insert element into target?
447
+ * // It is possible and apparently occasionally sensical to delete a model without deleting its underlying element.
448
+ // - If only the model is deleted, [[initFromExternalSourceAspects]] will have already remapped the underlying element since it still exists.
449
+ // - If both were deleted, [[remapDeletedSourceEntities]] will find and remap the deleted element making this operation valid
450
+ * TODO: If the element is a custom delete we probably shouldnt be calling this?
451
+ * There is an optimization in [IModelExporter.exportModelContents] which doesn't try to export elements within a model unless the model itself is part of
452
+ * the sourceDbChanges. This method is used in addCustomChange to add the model to the updatedIds set so that the custom element changes are exported.
453
+ */
454
+ private addModelToUpdated;
455
+ /** TODO: Maybe relationships only? maybe not. */
456
+ getCustomRelationshipDataFromId(id: Id64String, type: ChangedInstanceType): ChangedInstanceCustomRelationshipData | undefined;
457
+ /**
458
+ * Adds the provided change to the set of relationship changes maintained by this instance of ChangedInstanceIds.
459
+ * If the same ECInstanceId is seen multiple times, the changedInstanceIds will be modified accordingly, i.e. if an id 'x' was updated but now we see 'x' was deleted, we will remove 'x'
460
+ * from the set of updatedIds and add it to the set of deletedIds for the appropriate class type.
461
+ * @note In most cases, this method does not need to be called. Its only for consumers to mimic changes as if they were found in a changeset, which should only be useful in certain cases such as the changing of filter criteria for a preexisting master branch relationship.
462
+ * @throws if the ecClassId is NOT a relationship classId
463
+ * @param ecClassId class id of the custom change
464
+ * @param changeType insert, update or delete
465
+ * @param id ECInstanceID of the custom change
466
+ * @param sourceECInstanceId source ECInstanceId of the relationship
467
+ * @param targetECInstanceId target ECInstanceId of the relationship
468
+ */
469
+ addCustomRelationshipChange(ecClassId: string, changeType: SqliteChangeOp, id: Id64String, sourceECInstanceId: Id64String, targetECInstanceId: Id64String): Promise<void>;
470
+ private getClassFullNameFromECClassId;
383
471
  private handleChange;
384
472
  /**
385
473
  * Initializes a new ChangedInstanceIds object with information taken from a range of changesets.
474
+ * @public
386
475
  */
387
476
  static initialize(opts: ChangedInstanceIdsInitOptions): Promise<ChangedInstanceIds | undefined>;
388
477
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IModelExporter.d.ts","sourceRoot":"","sources":["../../src/IModelExporter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EACL,WAAW,EAEX,iBAAiB,EAKjB,OAAO,EACP,aAAa,EACb,kBAAkB,EAElB,mBAAmB,EAEnB,QAAQ,EAER,cAAc,EACd,KAAK,EAGL,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,WAAW,EAGX,UAAU,EAIX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,SAAS,EA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