@itwin/core-backend 5.9.0-dev.9 → 5.9.1
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 +45 -1
- package/lib/cjs/BriefcaseManager.d.ts +14 -62
- package/lib/cjs/BriefcaseManager.d.ts.map +1 -1
- package/lib/cjs/BriefcaseManager.js +29 -159
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +4 -4
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts +9 -1
- package/lib/cjs/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/cjs/ChangesetECAdaptor.js +7 -1
- package/lib/cjs/ChangesetECAdaptor.js.map +1 -1
- package/lib/cjs/ChangesetReader.d.ts +186 -0
- package/lib/cjs/ChangesetReader.d.ts.map +1 -0
- package/lib/cjs/ChangesetReader.js +372 -0
- package/lib/cjs/ChangesetReader.js.map +1 -0
- package/lib/cjs/ChangesetReaderTypes.d.ts +120 -0
- package/lib/cjs/ChangesetReaderTypes.d.ts.map +1 -0
- package/lib/cjs/ChangesetReaderTypes.js +23 -0
- package/lib/cjs/ChangesetReaderTypes.js.map +1 -0
- package/lib/cjs/CloudSqlite.d.ts +1 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +68 -13
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +3 -3
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +2 -2
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts.map +1 -1
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/EditTxn.d.ts +55 -1
- package/lib/cjs/EditTxn.d.ts.map +1 -1
- package/lib/cjs/EditTxn.js +43 -1
- package/lib/cjs/EditTxn.js.map +1 -1
- package/lib/cjs/Element.d.ts +79 -10
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +38 -2
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +1 -1
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +5 -5
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +2 -2
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeographicCRSServices.d.ts +15 -0
- package/lib/cjs/GeographicCRSServices.d.ts.map +1 -1
- package/lib/cjs/GeographicCRSServices.js +13 -4
- package/lib/cjs/GeographicCRSServices.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +31 -23
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +44 -25
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelIncrementalSchemaLocater.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts +2 -0
- package/lib/cjs/IModelJsFs.d.ts.map +1 -1
- package/lib/cjs/IModelJsFs.js +14 -0
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +20 -9
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +6 -6
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/Material.d.ts +1 -1
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +40 -6
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +24 -0
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/PartialChangeUnifier.d.ts +77 -0
- package/lib/cjs/PartialChangeUnifier.d.ts.map +1 -0
- package/lib/cjs/PartialChangeUnifier.js +234 -0
- package/lib/cjs/PartialChangeUnifier.js.map +1 -0
- package/lib/cjs/Relationship.d.ts +10 -10
- package/lib/cjs/Relationship.js +6 -6
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/SheetIndex.d.ts +4 -4
- package/lib/cjs/SheetIndex.d.ts.map +1 -1
- package/lib/cjs/SheetIndex.js.map +1 -1
- package/lib/cjs/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/cjs/SqliteChangesetReader.js +1 -1
- package/lib/cjs/SqliteChangesetReader.js.map +1 -1
- package/lib/cjs/Texture.d.ts +1 -1
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +17 -0
- package/lib/cjs/TxnManager.d.ts.map +1 -1
- package/lib/cjs/TxnManager.js +120 -13
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +25 -13
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +77 -25
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStore.d.ts.map +1 -1
- package/lib/cjs/ViewStore.js +63 -21
- package/lib/cjs/ViewStore.js.map +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/cjs/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/cjs/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/cjs/core-backend.d.ts +3 -0
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +3 -0
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +2 -2
- package/lib/cjs/domains/GenericElements.d.ts.map +1 -1
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.d.ts +2 -2
- package/lib/cjs/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/cjs/internal/ChannelAdmin.js.map +1 -1
- package/lib/cjs/internal/IntegrityCheck.d.ts +10 -10
- package/lib/cjs/internal/IntegrityCheck.js +22 -22
- package/lib/cjs/internal/IntegrityCheck.js.map +1 -1
- package/lib/cjs/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +6 -4
- package/lib/cjs/workspace/Settings.d.ts.map +1 -1
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/esm/BriefcaseManager.d.ts +14 -62
- package/lib/esm/BriefcaseManager.d.ts.map +1 -1
- package/lib/esm/BriefcaseManager.js +30 -160
- package/lib/esm/BriefcaseManager.js.map +1 -1
- package/lib/esm/Category.d.ts +4 -4
- package/lib/esm/Category.js.map +1 -1
- package/lib/esm/ChangesetECAdaptor.d.ts +9 -1
- package/lib/esm/ChangesetECAdaptor.d.ts.map +1 -1
- package/lib/esm/ChangesetECAdaptor.js +7 -1
- package/lib/esm/ChangesetECAdaptor.js.map +1 -1
- package/lib/esm/ChangesetReader.d.ts +186 -0
- package/lib/esm/ChangesetReader.d.ts.map +1 -0
- package/lib/esm/ChangesetReader.js +368 -0
- package/lib/esm/ChangesetReader.js.map +1 -0
- package/lib/esm/ChangesetReaderTypes.d.ts +120 -0
- package/lib/esm/ChangesetReaderTypes.d.ts.map +1 -0
- package/lib/esm/ChangesetReaderTypes.js +20 -0
- package/lib/esm/ChangesetReaderTypes.js.map +1 -0
- package/lib/esm/CloudSqlite.d.ts +1 -1
- package/lib/esm/CloudSqlite.d.ts.map +1 -1
- package/lib/esm/CloudSqlite.js +69 -14
- package/lib/esm/CloudSqlite.js.map +1 -1
- package/lib/esm/CodeSpecs.d.ts +3 -3
- package/lib/esm/CodeSpecs.js.map +1 -1
- package/lib/esm/ConcurrentQuery.js.map +1 -1
- package/lib/esm/DevTools.js.map +1 -1
- package/lib/esm/DisplayStyle.d.ts +2 -2
- package/lib/esm/DisplayStyle.js.map +1 -1
- package/lib/esm/ECSqlStatement.d.ts.map +1 -1
- package/lib/esm/ECSqlStatement.js.map +1 -1
- package/lib/esm/EditTxn.d.ts +55 -1
- package/lib/esm/EditTxn.d.ts.map +1 -1
- package/lib/esm/EditTxn.js +43 -1
- package/lib/esm/EditTxn.js.map +1 -1
- package/lib/esm/Element.d.ts +79 -10
- package/lib/esm/Element.d.ts.map +1 -1
- package/lib/esm/Element.js +38 -2
- package/lib/esm/Element.js.map +1 -1
- package/lib/esm/ElementAspect.d.ts +1 -1
- package/lib/esm/ElementAspect.js.map +1 -1
- package/lib/esm/ElementGraphics.js.map +1 -1
- package/lib/esm/ElementTreeWalker.d.ts +5 -5
- package/lib/esm/ElementTreeWalker.js.map +1 -1
- package/lib/esm/ExternalSource.d.ts +2 -2
- package/lib/esm/ExternalSource.d.ts.map +1 -1
- package/lib/esm/ExternalSource.js.map +1 -1
- package/lib/esm/GeographicCRSServices.d.ts +15 -0
- package/lib/esm/GeographicCRSServices.d.ts.map +1 -1
- package/lib/esm/GeographicCRSServices.js +12 -4
- package/lib/esm/GeographicCRSServices.js.map +1 -1
- package/lib/esm/IModelDb.d.ts +31 -23
- package/lib/esm/IModelDb.d.ts.map +1 -1
- package/lib/esm/IModelDb.js +45 -26
- package/lib/esm/IModelDb.js.map +1 -1
- package/lib/esm/IModelIncrementalSchemaLocater.js.map +1 -1
- package/lib/esm/IModelJsFs.d.ts +2 -0
- package/lib/esm/IModelJsFs.d.ts.map +1 -1
- package/lib/esm/IModelJsFs.js +14 -0
- package/lib/esm/IModelJsFs.js.map +1 -1
- package/lib/esm/IpcHost.d.ts.map +1 -1
- package/lib/esm/IpcHost.js +20 -9
- package/lib/esm/IpcHost.js.map +1 -1
- package/lib/esm/LineStyle.d.ts +6 -6
- package/lib/esm/LineStyle.js.map +1 -1
- package/lib/esm/Material.d.ts +1 -1
- package/lib/esm/Material.js.map +1 -1
- package/lib/esm/Model.d.ts +40 -6
- package/lib/esm/Model.d.ts.map +1 -1
- package/lib/esm/Model.js +24 -0
- package/lib/esm/Model.js.map +1 -1
- package/lib/esm/PartialChangeUnifier.d.ts +77 -0
- package/lib/esm/PartialChangeUnifier.d.ts.map +1 -0
- package/lib/esm/PartialChangeUnifier.js +230 -0
- package/lib/esm/PartialChangeUnifier.js.map +1 -0
- package/lib/esm/Relationship.d.ts +10 -10
- package/lib/esm/Relationship.js +6 -6
- package/lib/esm/Relationship.js.map +1 -1
- package/lib/esm/SheetIndex.d.ts +4 -4
- package/lib/esm/SheetIndex.d.ts.map +1 -1
- package/lib/esm/SheetIndex.js.map +1 -1
- package/lib/esm/SqliteChangesetReader.d.ts.map +1 -1
- package/lib/esm/SqliteChangesetReader.js +1 -1
- package/lib/esm/SqliteChangesetReader.js.map +1 -1
- package/lib/esm/Texture.d.ts +1 -1
- package/lib/esm/Texture.js.map +1 -1
- package/lib/esm/TxnManager.d.ts +17 -0
- package/lib/esm/TxnManager.d.ts.map +1 -1
- package/lib/esm/TxnManager.js +121 -14
- package/lib/esm/TxnManager.js.map +1 -1
- package/lib/esm/ViewDefinition.d.ts +25 -13
- package/lib/esm/ViewDefinition.d.ts.map +1 -1
- package/lib/esm/ViewDefinition.js +78 -26
- package/lib/esm/ViewDefinition.js.map +1 -1
- package/lib/esm/ViewStore.d.ts.map +1 -1
- package/lib/esm/ViewStore.js +64 -22
- package/lib/esm/ViewStore.js.map +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.d.ts +1 -1
- package/lib/esm/annotations/ElementDrivesTextAnnotation.js.map +1 -1
- package/lib/esm/annotations/TextAnnotationElement.js.map +1 -1
- package/lib/esm/core-backend.d.ts +3 -0
- package/lib/esm/core-backend.d.ts.map +1 -1
- package/lib/esm/core-backend.js +3 -0
- package/lib/esm/core-backend.js.map +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts +1 -1
- package/lib/esm/domains/FunctionalElements.d.ts.map +1 -1
- package/lib/esm/domains/FunctionalElements.js.map +1 -1
- package/lib/esm/domains/GenericElements.d.ts +2 -2
- package/lib/esm/domains/GenericElements.d.ts.map +1 -1
- package/lib/esm/domains/GenericElements.js.map +1 -1
- package/lib/esm/internal/ChannelAdmin.d.ts +2 -2
- package/lib/esm/internal/ChannelAdmin.d.ts.map +1 -1
- package/lib/esm/internal/ChannelAdmin.js.map +1 -1
- package/lib/esm/internal/IntegrityCheck.d.ts +10 -10
- package/lib/esm/internal/IntegrityCheck.js +22 -22
- package/lib/esm/internal/IntegrityCheck.js.map +1 -1
- package/lib/esm/internal/workspace/WorkspaceImpl.js.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.d.ts.map +1 -1
- package/lib/esm/test/ElementDrivesElement.test.js.map +1 -1
- package/lib/esm/test/IModelTestUtils.d.ts +1 -0
- package/lib/esm/test/IModelTestUtils.d.ts.map +1 -1
- package/lib/esm/test/IModelTestUtils.js +5 -0
- package/lib/esm/test/IModelTestUtils.js.map +1 -1
- package/lib/esm/test/IpcHost.test.js +112 -0
- package/lib/esm/test/IpcHost.test.js.map +1 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js +0 -1
- package/lib/esm/test/annotations/LeaderGeometry.test.js.map +1 -1
- package/lib/esm/test/ecsql/dataset/ECSqlDatasets.js.map +1 -1
- package/lib/esm/test/ecsql/src/ECSqlTestRunner.test.js.map +1 -1
- package/lib/esm/test/element/DeleteDefinitionElements.test.js +819 -26
- package/lib/esm/test/element/DeleteDefinitionElements.test.js.map +1 -1
- package/lib/esm/test/element/ElementRoundTrip.test.js +144 -3
- package/lib/esm/test/element/ElementRoundTrip.test.js.map +1 -1
- package/lib/esm/test/element/SheetInformationAspect.test.js.map +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js +1 -1
- package/lib/esm/test/hubaccess/Rebase.test.js.map +1 -1
- package/lib/esm/test/hubaccess/SemanticRebase.test.js +2242 -68
- package/lib/esm/test/hubaccess/SemanticRebase.test.js.map +1 -1
- package/lib/esm/test/imodel/IModel.test.js +1 -1
- package/lib/esm/test/imodel/IModel.test.js.map +1 -1
- package/lib/esm/test/imodel/SchemaXmlImport.test.js +64 -0
- package/lib/esm/test/imodel/SchemaXmlImport.test.js.map +1 -1
- package/lib/esm/test/misc/GeoServices.test.js +43 -1
- package/lib/esm/test/misc/GeoServices.test.js.map +1 -1
- package/lib/esm/test/sheetindex/SheetIndex.test.js.map +1 -1
- package/lib/esm/test/standalone/ChangesetReader.test.js +4184 -1654
- package/lib/esm/test/standalone/ChangesetReader.test.js.map +1 -1
- package/lib/esm/test/standalone/DeleteElements.test.d.ts +2 -0
- package/lib/esm/test/standalone/DeleteElements.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/DeleteElements.test.js +625 -0
- package/lib/esm/test/standalone/DeleteElements.test.js.map +1 -0
- package/lib/esm/test/standalone/GeometryStream.test.js.map +1 -1
- package/lib/esm/test/standalone/IntegrityCheck.test.js +214 -5
- package/lib/esm/test/standalone/IntegrityCheck.test.js.map +1 -1
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.d.ts +2 -0
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.d.ts.map +1 -0
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js +1862 -0
- package/lib/esm/test/standalone/SQliteChangesetReaderAndChangesetECAdaptor.test.js.map +1 -0
- package/lib/esm/test/standalone/TxnManager.test.js +90 -0
- package/lib/esm/test/standalone/TxnManager.test.js.map +1 -1
- package/lib/esm/test/standalone/ViewDefinition.test.js +18 -7
- package/lib/esm/test/standalone/ViewDefinition.test.js.map +1 -1
- package/lib/esm/test/standalone/Workspace.test.js.map +1 -1
- package/lib/esm/workspace/Settings.d.ts +6 -4
- package/lib/esm/workspace/Settings.d.ts.map +1 -1
- package/lib/esm/workspace/Settings.js.map +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelIncrementalSchemaLocater.js","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,gEAAoI;AACpI,oDAAiE;AAGjE;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,sCAAkB;IACnD,OAAO,CAAW;IAEnC;;;;OAIG;IACH,YAAY,MAAgB,EAAE,OAAmC;QAC/D,KAAK,CAAC,OAAO,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,cAAc,CAAC,SAAoB;QACjD,iFAAiF;QACjF,iFAAiF;QACjF,eAAe;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE;YACtD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"IModelIncrementalSchemaLocater.js","sourceRoot":"","sources":["../../src/IModelIncrementalSchemaLocater.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AAChG;;GAEG;AACH,gEAAoI;AACpI,oDAAiE;AAGjE;;;GAGG;AACH,MAAa,8BAA+B,SAAQ,sCAAkB;IACnD,OAAO,CAAW;IAEnC;;;;OAIG;IACH,YAAY,MAAgB,EAAE,OAAmC;QAC/D,KAAK,CAAC,OAAO,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,cAAc,CAAC,SAAoB;QACjD,iFAAiF;QACjF,iFAAiF;QACjF,eAAe;QACf,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE;YACtD,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,KAAU,EAAE,CAAC;gBAClB,MAAM,CAAC,KAAc,CAAC,CAAC;YACzB,CAAC;QACH,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACT,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,YAAY,CAAO,KAAa,EAAE,OAA2B;QAC3E,MAAM,eAAe,GAAG,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAW,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAEzG,OAAO,IAAI,CAAC,OAAO;aAChB,iBAAiB,CAAC,KAAK,EAAE,eAAe,EAAE;YACzC,SAAS,EAAE,4BAAc,CAAC,qBAAqB;YAC/C,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;SACjC,CAAC;aACD,OAAO,EAAE,CAAC;IACf,CAAC;CACF;AAhDD,wEAgDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module iModels\n */\nimport { ECSqlQueryOptions, ECSqlSchemaLocater, ECSqlSchemaLocaterOptions, SchemaKey, SchemaProps } from \"@itwin/ecschema-metadata\";\nimport { QueryBinder, QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelDb } from \"./IModelDb\";\n\n/**\n * A [[ECSqlSchemaLocater]]($ecschema-metadata) implementation that uses the [[IModelDb]] to load schemas incrementally.\n * @beta\n */\nexport class IModelIncrementalSchemaLocater extends ECSqlSchemaLocater {\n private readonly _iModel: IModelDb;\n\n /**\n * Constructs a new IModelIncrementalSchemaLocater instance.\n * @param iModel The [[IModelDb]] to query.\n * @param options Optional [[ECSqlSchemaLocaterOptions]]($ecschema-metadata).\n */\n constructor(iModel: IModelDb, options?: ECSqlSchemaLocaterOptions) {\n super(options ?? { useMultipleQueries: true });\n this._iModel = iModel;\n }\n\n /**\n * Gets [[SchemaProps]]($ecschema-metadata) for the given [[SchemaKey]]($ecschema-metadata).\n * This is the full schema json with all elements that are defined in the schema.\n * @param schemaKey The key of the schema to be resolved.\n */\n protected async getSchemaProps(schemaKey: SchemaKey): Promise<SchemaProps | undefined> {\n // To keep the main thread from being blocked in sync loading cases the resolving\n // is triggered through a timeout. Even if there is no delay, it improves loading\n // time by ~3x.\n return new Promise((resolve, reject) => setTimeout(() => {\n try {\n resolve(this._iModel.getSchemaProps(schemaKey.name));\n }\n catch (error: any) {\n reject(error as Error);\n }\n }, 0));\n }\n\n /**\n * Executes an ECSql query against the IModelDb.\n * @param query The query to execute\n * @param options The [[ECSqlQueryOptions]]($ecschema-metadata) to use.\n * @returns A promise that resolves to read-only array of type TRow.\n */\n protected async executeQuery<TRow>(query: string, options?: ECSqlQueryOptions): Promise<ReadonlyArray<TRow>> {\n const queryParameters = options && options.parameters ? QueryBinder.from(options.parameters) : undefined;\n\n return this._iModel\n .createQueryReader(query, queryParameters, {\n rowFormat: QueryRowFormat.UseECSqlPropertyNames,\n limit: { count: options?.limit },\n })\n .toArray();\n }\n}"]}
|
package/lib/cjs/IModelJsFs.d.ts
CHANGED
|
@@ -39,6 +39,8 @@ export declare class IModelJsFs {
|
|
|
39
39
|
static readFileSync(pathname: string): string | Buffer;
|
|
40
40
|
/** Read file with encoding */
|
|
41
41
|
static readFileWithEncodingSync(pathname: string, encoding: BufferEncoding): string;
|
|
42
|
+
/** Reads a file line by line as an async iterable, without loading the entire file into memory. */
|
|
43
|
+
static readLines(pathname: string): AsyncGenerator<string>;
|
|
42
44
|
/** Test if the current user has permission to write to a file. */
|
|
43
45
|
private static isFileWritable;
|
|
44
46
|
/** Get information about a file. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelJsFs.d.ts","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IModelJsFs.d.ts","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,qBAAa,eAAe;IAEjB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,OAAO;IACpB,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,OAAO;IACjB,cAAc,EAAE,OAAO;IACvB,UAAU,EAAE,OAAO;gBARnB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,OAAO,EACpB,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,cAAc,EAAE,OAAO,EACvB,UAAU,EAAE,OAAO;CAE7B;AAED;;GAEG;AACH,qBAAa,UAAU;IAErB,oCAAoC;WACtB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAEnD,qBAAqB;WACP,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEhD,mDAAmD;WACrC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEhD,0BAA0B;WACZ,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAE/C,0BAA0B;WACZ,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAE/C,uBAAuB;WACT,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,KAAK,GAAE,MAAY,GAAG,IAAI;IAEnG,wBAAwB;WACV,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAEjE,4BAA4B;WACd,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAEnE,6JAA6J;WAC/I,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE;IAErD,gBAAgB;WACF,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAE7D,8BAA8B;WAChB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM;IAE1F,mGAAmG;WAC9E,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;IAYxE,kEAAkE;IAClE,OAAO,CAAC,MAAM,CAAC,cAAc;IAS7B,oCAAoC;WACtB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAiBtE;;;;;OAKG;WACW,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAc3E;;;;OAIG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI;IAkBnG,uEAAuE;WACzD,kBAAkB,CAAC,OAAO,EAAE,MAAM;IAehD,sCAAsC;WACxB,YAAY,CAAC,OAAO,EAAE,MAAM;CAc3C"}
|
package/lib/cjs/IModelJsFs.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.IModelJsFs = exports.IModelJsFsStats = void 0;
|
|
|
10
10
|
*/
|
|
11
11
|
// cspell: ignore wflag
|
|
12
12
|
const fs = require("fs-extra");
|
|
13
|
+
const readline = require("readline");
|
|
13
14
|
const path = require("path");
|
|
14
15
|
/* TODO: define File Mode Constants: S_IWUSR, et al. */
|
|
15
16
|
/** Information about a file. See [[IModelJsFs.lstatSync]]
|
|
@@ -64,6 +65,19 @@ class IModelJsFs {
|
|
|
64
65
|
static readFileSync(pathname) { return fs.readFileSync(pathname); }
|
|
65
66
|
/** Read file with encoding */
|
|
66
67
|
static readFileWithEncodingSync(pathname, encoding) { return fs.readFileSync(pathname, { encoding }); }
|
|
68
|
+
/** Reads a file line by line as an async iterable, without loading the entire file into memory. */
|
|
69
|
+
static async *readLines(pathname) {
|
|
70
|
+
const stream = fs.createReadStream(pathname);
|
|
71
|
+
const rl = readline.createInterface({ input: stream, crlfDelay: Infinity });
|
|
72
|
+
try {
|
|
73
|
+
for await (const line of rl)
|
|
74
|
+
yield line;
|
|
75
|
+
}
|
|
76
|
+
finally {
|
|
77
|
+
rl.close();
|
|
78
|
+
stream.destroy();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
67
81
|
/** Test if the current user has permission to write to a file. */
|
|
68
82
|
static isFileWritable(pathname) {
|
|
69
83
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelJsFs.js","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,uBAAuB;AAEvB,+BAA+B;AAC/B,6BAA6B;AAE7B,uDAAuD;AACvD;;GAEG;AACH,MAAa,eAAe;IAEjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IATT,YACS,IAAY,EACZ,OAAe,EACf,OAAe,EACf,WAAmB,EACnB,WAAoB,EACpB,MAAe,EACf,QAAiB,EACjB,cAAuB,EACvB,UAAmB;QARnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAS;QACf,aAAQ,GAAR,QAAQ,CAAS;QACjB,mBAAc,GAAd,cA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AC;IACL,CAAC;IAED,uEAAuE;IAChE,MAAM,CAAC,kBAAkB,CAAC,OAAe;QAC9C,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;YAChC,OAAO;QACT,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,UAAU,KAAK,OAAO;YACxB,UAAU,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,4EAA4E;YAC5E,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ;gBACxB,MAAM,GAAG,CAAC;QACd,CAAC;IACH,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAC,YAAY,CAAC,OAAe;QACxC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;YACjC,OAAO;QAET,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,QAAgB,EAAE,KAAc,EAAE,EAAE;YACnE,IAAI,KAAK,EAAE,CAAC;gBACV,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAClC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAzID,gCAyIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Portability\n */\n\n// cspell: ignore wflag\n\nimport * as fs from \"fs-extra\";\nimport * as path from \"path\";\n\n/* TODO: define File Mode Constants: S_IWUSR, et al. */\n/** Information about a file. See [[IModelJsFs.lstatSync]]\n * @public\n */\nexport class IModelJsFsStats {\n constructor(\n public size: number,\n public atimeMs: number,\n public mtimeMs: number,\n public birthtimeMs: number,\n public isDirectory: boolean,\n public isFile: boolean,\n public isSocket: boolean,\n public isSymbolicLink: boolean,\n public isReadOnly: boolean,\n ) { }\n}\n\n/** File system operations that are defined on all platforms. See also [[Platform]] and [[KnownLocations]]\n * @public\n */\nexport class IModelJsFs {\n\n /** Does file or directory exist? */\n public static existsSync(pathname: string): boolean { return fs.existsSync(pathname); }\n\n /** Delete a file. */\n public static unlinkSync(pathname: string): void { fs.unlinkSync(pathname); }\n\n /** Delete a file or remove a directory (rm -r). */\n public static removeSync(pathname: string): void { fs.removeSync(pathname); }\n\n /** Create a directory. */\n public static mkdirSync(pathname: string): void { fs.mkdirSync(pathname); }\n\n /** Remove a directory. */\n public static rmdirSync(pathname: string): void { fs.rmdirSync(pathname); }\n\n /** Write to a file. */\n public static writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = \"w\"): void { fs.writeFileSync(pathname, data, { flag: wflag }); }\n\n /** Append to a file. */\n public static appendFileSync(pathname: string, str: string): void { fs.appendFileSync(pathname, str); }\n\n /** Make a copy of a file */\n public static copySync(src: string, dest: string, opts?: any): void { fs.copySync(src, dest, opts); }\n\n /** Gets the file and directory names in the specified directory. Excludes \".\" and \"..\". Returns an empty array if the specified directory does not exist. */\n public static readdirSync(pathname: string): string[] { return fs.existsSync(pathname) ? fs.readdirSync(pathname) : []; }\n\n /** Read file */\n public static readFileSync(pathname: string): string | Buffer { return fs.readFileSync(pathname); }\n\n /** Read file with encoding */\n public static readFileWithEncodingSync(pathname: string, encoding: BufferEncoding): string { return fs.readFileSync(pathname, { encoding }); }\n\n /** Test if the current user has permission to write to a file. */\n private static isFileWritable(pathname: string): boolean {\n try {\n fs.accessSync(pathname, fs.constants.W_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n /** Get information about a file. */\n public static lstatSync(pathname: string): IModelJsFsStats | undefined {\n const stats = fs.lstatSync(pathname);\n if (stats === undefined)\n return undefined;\n\n return new IModelJsFsStats(\n stats.size,\n stats.atime.getTime(),\n stats.mtime.getTime(),\n stats.birthtime.getTime(),\n stats.isDirectory(),\n stats.isFile(),\n stats.isSocket(),\n stats.isSymbolicLink(),\n !IModelJsFs.isFileWritable(pathname));\n }\n\n /**\n * Finds files recursively based on a pattern\n * @param rootDir Directory from where to start searching for files.\n * @param pattern A Regex that would be match to basename of files including extension\n * @returns list of file that match the pattern.\n */\n public static recursiveFindSync(rootDir: string, pattern: RegExp): string[] {\n const files: string[] = [];\n IModelJsFs.walkDirSync(rootDir, (pathname: string, isDir: boolean) => {\n if (!isDir) {\n const fileName = path.basename(pathname);\n if (pattern.test(fileName)) {\n files.push(pathname);\n }\n }\n return true;\n });\n return files;\n }\n\n /**\n * Walks a directory in breadth first fashion\n * @param rootDir directory from where the traversal starts\n * @param cb callback that would be called with full path of file or directory\n */\n public static walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void {\n const subDir = [];\n for (const childPath of IModelJsFs.readdirSync(rootDir)) {\n const fullPath = path.join(rootDir, childPath);\n const isDir = IModelJsFs.lstatSync(fullPath)?.isDirectory;\n if (!cb(fullPath, isDir ?? false)) {\n return;\n }\n // Need to check if the directory still exists in case the callback has deleted it.\n if (isDir && IModelJsFs.existsSync(fullPath)) {\n subDir.push(fullPath);\n }\n }\n subDir.forEach((v) => {\n IModelJsFs.walkDirSync(v, cb);\n });\n }\n\n /** Create a directory, recursively setting up the path as necessary */\n public static recursiveMkDirSync(dirPath: string) {\n if (IModelJsFs.existsSync(dirPath))\n return;\n const parentPath = path.dirname(dirPath);\n if (parentPath !== dirPath)\n IModelJsFs.recursiveMkDirSync(parentPath);\n try {\n IModelJsFs.mkdirSync(dirPath);\n } catch (err: any) {\n // Ignore the error if the folder has been created since the existence check\n if (err?.code !== \"EEXIST\")\n throw err;\n }\n }\n\n /** Remove a directory, recursively */\n public static purgeDirSync(dirPath: string) {\n if (!IModelJsFs.existsSync(dirPath))\n return;\n\n IModelJsFs.walkDirSync(dirPath, (pathName: string, isDir: boolean) => {\n if (isDir) {\n IModelJsFs.purgeDirSync(pathName);\n IModelJsFs.removeSync(pathName);\n } else {\n IModelJsFs.unlinkSync(pathName);\n }\n return true;\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModelJsFs.js","sourceRoot":"","sources":["../../src/IModelJsFs.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,uBAAuB;AAEvB,+BAA+B;AAC/B,qCAAqC;AACrC,6BAA6B;AAE7B,uDAAuD;AACvD;;GAEG;AACH,MAAa,eAAe;IAEjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IATT,YACS,IAAY,EACZ,OAAe,EACf,OAAe,EACf,WAAmB,EACnB,WAAoB,EACpB,MAAe,EACf,QAAiB,EACjB,cAAuB,EACvB,UAAmB;QARnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;QACf,YAAO,GAAP,OAAO,CAAQ;QACf,gBAAW,GAAX,WAAW,CAAQ;QACnB,gBAAW,GAAX,WAAW,CAAS;QACpB,WAAM,GAAN,MAAM,CAAS;QACf,aAAQ,GAAR,QAAQ,CAAS;QACjB,mBAAc,GAAd,cAAc,CAAS;QACvB,eAAU,GAAV,UAAU,CAAS;IACxB,CAAC;CACN;AAZD,0CAYC;AAED;;GAEG;AACH,MAAa,UAAU;IAErB,oCAAoC;IAC7B,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAa,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEvF,qBAAqB;IACd,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAU,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE7E,mDAAmD;IAC5C,MAAM,CAAC,UAAU,CAAC,QAAgB,IAAU,EAAE,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CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,uEAAuE;IAChE,MAAM,CAAC,kBAAkB,CAAC,OAAe;QAC9C,IAAI,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;YAChC,OAAO;QACT,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,UAAU,KAAK,OAAO;YACxB,UAAU,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,4EAA4E;YAC5E,IAAI,GAAG,EAAE,IAAI,KAAK,QAAQ;gBACxB,MAAM,GAAG,CAAC;QACd,CAAC;IACH,CAAC;IAED,sCAAsC;IAC/B,MAAM,CAAC,YAAY,CAAC,OAAe;QACxC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC;YACjC,OAAO;QAET,UAAU,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,QAAgB,EAAE,KAAc,EAAE,EAAE;YACnE,IAAI,KAAK,EAAE,CAAC;gBACV,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;gBAClC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtJD,gCAsJC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module Portability\n */\n\n// cspell: ignore wflag\n\nimport * as fs from \"fs-extra\";\nimport * as readline from \"readline\";\nimport * as path from \"path\";\n\n/* TODO: define File Mode Constants: S_IWUSR, et al. */\n/** Information about a file. See [[IModelJsFs.lstatSync]]\n * @public\n */\nexport class IModelJsFsStats {\n constructor(\n public size: number,\n public atimeMs: number,\n public mtimeMs: number,\n public birthtimeMs: number,\n public isDirectory: boolean,\n public isFile: boolean,\n public isSocket: boolean,\n public isSymbolicLink: boolean,\n public isReadOnly: boolean,\n ) { }\n}\n\n/** File system operations that are defined on all platforms. See also [[Platform]] and [[KnownLocations]]\n * @public\n */\nexport class IModelJsFs {\n\n /** Does file or directory exist? */\n public static existsSync(pathname: string): boolean { return fs.existsSync(pathname); }\n\n /** Delete a file. */\n public static unlinkSync(pathname: string): void { fs.unlinkSync(pathname); }\n\n /** Delete a file or remove a directory (rm -r). */\n public static removeSync(pathname: string): void { fs.removeSync(pathname); }\n\n /** Create a directory. */\n public static mkdirSync(pathname: string): void { fs.mkdirSync(pathname); }\n\n /** Remove a directory. */\n public static rmdirSync(pathname: string): void { fs.rmdirSync(pathname); }\n\n /** Write to a file. */\n public static writeFileSync(pathname: string, data: string | Uint8Array, wflag: string = \"w\"): void { fs.writeFileSync(pathname, data, { flag: wflag }); }\n\n /** Append to a file. */\n public static appendFileSync(pathname: string, str: string): void { fs.appendFileSync(pathname, str); }\n\n /** Make a copy of a file */\n public static copySync(src: string, dest: string, opts?: any): void { fs.copySync(src, dest, opts); }\n\n /** Gets the file and directory names in the specified directory. Excludes \".\" and \"..\". Returns an empty array if the specified directory does not exist. */\n public static readdirSync(pathname: string): string[] { return fs.existsSync(pathname) ? fs.readdirSync(pathname) : []; }\n\n /** Read file */\n public static readFileSync(pathname: string): string | Buffer { return fs.readFileSync(pathname); }\n\n /** Read file with encoding */\n public static readFileWithEncodingSync(pathname: string, encoding: BufferEncoding): string { return fs.readFileSync(pathname, { encoding }); }\n\n /** Reads a file line by line as an async iterable, without loading the entire file into memory. */\n public static async *readLines(pathname: string): AsyncGenerator<string> {\n const stream = fs.createReadStream(pathname);\n const rl = readline.createInterface({ input: stream, crlfDelay: Infinity });\n try {\n for await (const line of rl)\n yield line;\n } finally {\n rl.close();\n stream.destroy();\n }\n }\n\n /** Test if the current user has permission to write to a file. */\n private static isFileWritable(pathname: string): boolean {\n try {\n fs.accessSync(pathname, fs.constants.W_OK);\n return true;\n } catch {\n return false;\n }\n }\n\n /** Get information about a file. */\n public static lstatSync(pathname: string): IModelJsFsStats | undefined {\n const stats = fs.lstatSync(pathname);\n if (stats === undefined)\n return undefined;\n\n return new IModelJsFsStats(\n stats.size,\n stats.atime.getTime(),\n stats.mtime.getTime(),\n stats.birthtime.getTime(),\n stats.isDirectory(),\n stats.isFile(),\n stats.isSocket(),\n stats.isSymbolicLink(),\n !IModelJsFs.isFileWritable(pathname));\n }\n\n /**\n * Finds files recursively based on a pattern\n * @param rootDir Directory from where to start searching for files.\n * @param pattern A Regex that would be match to basename of files including extension\n * @returns list of file that match the pattern.\n */\n public static recursiveFindSync(rootDir: string, pattern: RegExp): string[] {\n const files: string[] = [];\n IModelJsFs.walkDirSync(rootDir, (pathname: string, isDir: boolean) => {\n if (!isDir) {\n const fileName = path.basename(pathname);\n if (pattern.test(fileName)) {\n files.push(pathname);\n }\n }\n return true;\n });\n return files;\n }\n\n /**\n * Walks a directory in breadth first fashion\n * @param rootDir directory from where the traversal starts\n * @param cb callback that would be called with full path of file or directory\n */\n public static walkDirSync(rootDir: string, cb: (pathname: string, isDir: boolean) => boolean): void {\n const subDir = [];\n for (const childPath of IModelJsFs.readdirSync(rootDir)) {\n const fullPath = path.join(rootDir, childPath);\n const isDir = IModelJsFs.lstatSync(fullPath)?.isDirectory;\n if (!cb(fullPath, isDir ?? false)) {\n return;\n }\n // Need to check if the directory still exists in case the callback has deleted it.\n if (isDir && IModelJsFs.existsSync(fullPath)) {\n subDir.push(fullPath);\n }\n }\n subDir.forEach((v) => {\n IModelJsFs.walkDirSync(v, cb);\n });\n }\n\n /** Create a directory, recursively setting up the path as necessary */\n public static recursiveMkDirSync(dirPath: string) {\n if (IModelJsFs.existsSync(dirPath))\n return;\n const parentPath = path.dirname(dirPath);\n if (parentPath !== dirPath)\n IModelJsFs.recursiveMkDirSync(parentPath);\n try {\n IModelJsFs.mkdirSync(dirPath);\n } catch (err: any) {\n // Ignore the error if the folder has been created since the existence check\n if (err?.code !== \"EEXIST\")\n throw err;\n }\n }\n\n /** Remove a directory, recursively */\n public static purgeDirSync(dirPath: string) {\n if (!IModelJsFs.existsSync(dirPath))\n return;\n\n IModelJsFs.walkDirSync(dirPath, (pathName: string, isDir: boolean) => {\n if (isDir) {\n IModelJsFs.purgeDirSync(pathName);\n IModelJsFs.removeSync(pathName);\n } else {\n IModelJsFs.unlinkSync(pathName);\n }\n return true;\n });\n }\n}\n"]}
|
package/lib/cjs/IpcHost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcHost.d.ts","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAEgC,yBAAyB,EAC7B,mBAAmB,EAAmB,WAAW,EAAE,gBAAgB,EACtB,cAAc,EACjD,gBAAgB,EAC5D,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAwB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAc,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAK7D;;;IAGI;AACJ,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,OAAO,CAAC,EAAE;QACR,wGAAwG;QACxG,MAAM,CAAC,EAAE,gBAAgB,CAAC;QAE1B,iDAAiD;QACjD,UAAU,CAAC,EAAE;YACX,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,CAAC;KACH,CAAC;CACH;AAED;;;;GAIG;AACH,qBAAa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,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAa9I"}
|
package/lib/cjs/IpcHost.js
CHANGED
|
@@ -140,19 +140,37 @@ class IpcHandler {
|
|
|
140
140
|
visited.add(e);
|
|
141
141
|
try {
|
|
142
142
|
const serialized = { ...e };
|
|
143
|
+
for (const sym of Object.getOwnPropertySymbols(serialized))
|
|
144
|
+
delete serialized[sym]; // symbol-keyed properties cannot be structured-cloned
|
|
143
145
|
if (e instanceof Error) {
|
|
144
146
|
serialized.message = e.message; // NB: .message and .stack are non-enumerable on Error instances
|
|
145
147
|
if (includeStack)
|
|
146
148
|
serialized.stack = e.stack;
|
|
149
|
+
// Error.cause is typically non-enumerable and must be copied explicitly.
|
|
150
|
+
if (Object.prototype.hasOwnProperty.call(e, "cause"))
|
|
151
|
+
serialized.cause = e.cause;
|
|
152
|
+
}
|
|
153
|
+
if (e instanceof core_bentley_1.BentleyError) {
|
|
154
|
+
serialized.iTwinErrorId = e.iTwinErrorId;
|
|
155
|
+
if (e.hasMetaData)
|
|
156
|
+
serialized.loggingMetadata = e.loggingMetadata;
|
|
157
|
+
delete serialized._metaData;
|
|
147
158
|
}
|
|
148
159
|
// Only recurse into Error instances and plain objects — not class instances like Date or Buffer.
|
|
149
160
|
const shouldRecurse = (val) => val instanceof Error || (core_bentley_1.JsonUtils.isObject(val) && Object.getPrototypeOf(val) === Object.prototype);
|
|
161
|
+
const isSerializableLeaf = (val) => {
|
|
162
|
+
const t = typeof val;
|
|
163
|
+
return val === null || val === undefined || val instanceof Date
|
|
164
|
+
|| t === "string" || t === "number" || t === "boolean";
|
|
165
|
+
};
|
|
150
166
|
for (const key of Object.keys(serialized)) {
|
|
151
167
|
const val = serialized[key];
|
|
152
168
|
if (Array.isArray(val))
|
|
153
|
-
serialized[key] = val.map((item) => shouldRecurse(item) ? serializeError(item, includeStack, visited) : item);
|
|
169
|
+
serialized[key] = val.map((item) => shouldRecurse(item) ? serializeError(item, includeStack, visited) : isSerializableLeaf(item) ? item : undefined);
|
|
154
170
|
else if (shouldRecurse(val))
|
|
155
171
|
serialized[key] = serializeError(val, includeStack, visited);
|
|
172
|
+
else if (!isSerializableLeaf(val))
|
|
173
|
+
delete serialized[key]; // strip non-cloneable values (functions, class instances, etc.)
|
|
156
174
|
}
|
|
157
175
|
return serialized;
|
|
158
176
|
}
|
|
@@ -161,14 +179,7 @@ class IpcHandler {
|
|
|
161
179
|
visited.delete(e);
|
|
162
180
|
}
|
|
163
181
|
};
|
|
164
|
-
|
|
165
|
-
if (err instanceof core_bentley_1.BentleyError) {
|
|
166
|
-
ret.error.iTwinErrorId = err.iTwinErrorId;
|
|
167
|
-
if (err.hasMetaData)
|
|
168
|
-
ret.error.loggingMetadata = err.loggingMetadata;
|
|
169
|
-
delete ret.error._metaData;
|
|
170
|
-
}
|
|
171
|
-
return ret;
|
|
182
|
+
return { error: serializeError(err, !IpcHost.noStack) };
|
|
172
183
|
}
|
|
173
184
|
});
|
|
174
185
|
}
|
package/lib/cjs/IpcHost.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IpcHost.js","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAuXH,4DAaC;AAjYD,sDAAgH;AAChH,oDAM4B;AAC5B,2DAAuE;AACvE,yCAA6E;AAC7E,6CAA6D;AAC7D,8DAAyD;AACzD,gDAA6D;AAC7D,oEAAyE;AAmBzE;;;;GAIG;AACH,MAAa,OAAO;IACX,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,MAAM,CAAC,IAAI,CAA+B;IAClD,2EAA2E;IACnE,MAAM,KAAK,GAAG,KAAuB,OAAO,IAAI,CAAC,IAAK,CAAC,CAAC,CAAC,CAAC,+DAA+D;IACjI,gIAAgI;IACzH,MAAM,KAAK,OAAO,KAAc,OAAO,SAAS,KAAK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,IAAuB;QACjE,OAAO,sBAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjE,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAAC,GAAW;QACxC,OAAO,mBAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,IAAkB;QAC9C,OAAO,6BAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,IAAsB,EAAE,UAAgC,EAAE,gBAAyB;IAC1H,MAAM,QAAQ,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,+DAA+D;IACzG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YACvC,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { assert, BentleyError, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps,\n ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,\n ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,\n OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, ReinstateTxnArgs, RemoveFunction, ReverseTxnArgs, SnapshotOpenOptions,\n StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,\n} from \"@itwin/core-common\";\nimport { ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from \"./IModelDb\";\nimport { IModelHost, IModelHostOptions } from \"./IModelHost\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { _implicitTxn, _nativeDb } from \"./internal/Symbols\";\nimport { cancelTileContentRequests } from \"./rpc-impl/IModelTileRpcImpl\";\n\n/**\n * Options for [[IpcHost.startup]]\n * @public\n */\nexport interface IpcHostOpts {\n iModelHost?: IModelHostOptions;\n ipcHost?: {\n /** The Ipc socket to use for communications with frontend. Allows undefined only for headless tests. */\n socket?: IpcSocketBackend;\n\n /** don't send stack information on exceptions */\n exceptions?: {\n noStack?: boolean;\n };\n };\n}\n\n/**\n * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.\n * @note if either end terminates, the other must too.\n * @public\n */\nexport class IpcHost {\n public static noStack = false;\n private static _ipc: IpcSocketBackend | undefined;\n /** Get the implementation of the [IpcSocketBackend]($common) interface. */\n private static get ipc(): IpcSocketBackend { return this._ipc!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\n /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Send a message to the frontend over an Ipc channel.\n * @param channel the name of the channel matching the name registered with [[IpcApp.addListener]].\n * @param data The content of the message.\n */\n public static send(channel: string, ...data: any[]): void {\n this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[Frontend.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @note returns A function to call to remove the handler.\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n return this.ipc.handle(iTwinChannel(channel), handler);\n }\n /**\n * Establish a handler to receive messages sent via [[IpcApp.send]].\n * @param channel The name of the channel for the messages.\n * @param listener A function called when messages are sent over `channel`\n * @note returns A function to call to remove the listener.\n */\n public static addListener(channel: string, listener: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), listener);\n }\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener): void {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n private static notify(channel: string, briefcase: BriefcaseDb | StandaloneDb, methodName: string, ...args: any[]) {\n if (this.isValid)\n return this.send(`${channel}/${briefcase.key}`, methodName, ...args);\n }\n\n /** @internal */\n public static notifyIpcFrontend<T extends keyof IpcAppNotifications>(methodName: T, ...args: Parameters<IpcAppNotifications[T]>) {\n return IpcHost.send(ipcAppChannels.appNotify, methodName, ...args);\n }\n\n /** @internal */\n public static notifyTxns<T extends keyof TxnNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<TxnNotifications[T]>) {\n this.notify(ipcAppChannels.txns, briefcase, methodName, ...args);\n }\n\n /** @internal */\n public static notifyEditingScope<T extends keyof EditingScopeNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<EditingScopeNotifications[T]>) {\n this.notify(ipcAppChannels.editingScope, briefcase, methodName, ...args);\n }\n\n /**\n * Start the backend of an Ipc app.\n * @param opt\n * @note this method calls [[IModelHost.startup]] internally.\n */\n public static async startup(opt?: IpcHostOpts): Promise<void> {\n this._ipc = opt?.ipcHost?.socket;\n if (opt?.ipcHost?.exceptions?.noStack)\n this.noStack = true;\n\n if (this.isValid) { // for tests, we use IpcHost but don't have a frontend\n IpcAppHandler.register();\n }\n\n await IModelHost.startup(opt?.iModelHost);\n }\n\n /** Shutdown IpcHost backend. Also calls [[IModelHost.shutdown]] */\n public static async shutdown(): Promise<void> {\n this._ipc = undefined;\n await IModelHost.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @public\n */\nexport abstract class IpcHandler {\n /**\n * All subclasses *must* implement this method to specify their channel name.\n *\n * Channel names are the key that connects Handlers and senders. The channel name of IpcHandlers must exactly match the name used by senders.\n * By convention, channel names should be prefixed by a *namespace* (e.g. `${appName}/`)\n * unique enough to disambiguate them from channels for other apps that may be running in the same processes.\n */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, subsequent calls replace the previous ones.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n const prohibitedFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf({}));\n\n return IpcHost.handle(impl.channelName, async (_evt: Event, funcName: string, ...args: any[]): Promise<IpcInvokeReturn> => {\n try {\n if (prohibitedFunctions.includes(funcName))\n throw new Error(`Method \"${funcName}\" not available for channel: ${impl.channelName}`);\n\n const func = (impl as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${impl.constructor.name}.${funcName}\" not found on IpcHandler registered for channel: ${impl.channelName}`);\n\n return { result: await func.call(impl, ...args) };\n } catch (err: unknown) {\n\n if (!JsonUtils.isObject(err)) // if the exception isn't an object, just forward it\n return { error: err as any };\n\n const serializeError = (e: any, includeStack: boolean, visited = new WeakSet<object>()): any => {\n if (visited.has(e))\n return undefined;\n visited.add(e);\n try {\n const serialized: any = { ...e };\n if (e instanceof Error) {\n serialized.message = e.message; // NB: .message and .stack are non-enumerable on Error instances\n if (includeStack)\n serialized.stack = e.stack;\n }\n // Only recurse into Error instances and plain objects — not class instances like Date or Buffer.\n const shouldRecurse = (val: any) => val instanceof Error || (JsonUtils.isObject(val) && Object.getPrototypeOf(val) === Object.prototype);\n for (const key of Object.keys(serialized)) {\n const val = serialized[key];\n if (Array.isArray(val))\n serialized[key] = val.map((item) => shouldRecurse(item) ? serializeError(item, includeStack, visited) : item);\n else if (shouldRecurse(val))\n serialized[key] = serializeError(val, includeStack, visited);\n }\n return serialized;\n } finally {\n // Remove from the stack so a sibling branch can still serialize this object.\n visited.delete(e);\n }\n };\n\n const ret = { error: serializeError(err, !IpcHost.noStack) };\n\n if (err instanceof BentleyError) {\n ret.error.iTwinErrorId = err.iTwinErrorId;\n if (err.hasMetaData)\n ret.error.loggingMetadata = err.loggingMetadata;\n delete ret.error._metaData;\n }\n return ret;\n }\n });\n }\n}\n\n/**\n * Implementation of IpcAppFunctions\n */\nclass IpcAppHandler extends IpcHandler implements IpcAppFunctions {\n public get channelName() { return ipcAppChannels.functions; }\n\n private _iModelKeyToPullStatus = new Map<string, ProgressStatus>();\n\n public async log(_timestamp: number, level: LogLevel, category: string, message: string, metaData?: any): Promise<void> {\n switch (level) {\n case LogLevel.Error:\n Logger.logError(category, message, metaData);\n break;\n case LogLevel.Info:\n Logger.logInfo(category, message, metaData);\n break;\n case LogLevel.Trace:\n Logger.logTrace(category, message, metaData);\n break;\n case LogLevel.Warning:\n Logger.logWarning(category, message, metaData);\n break;\n }\n }\n\n public async cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\n return cancelTileContentRequests(tokenProps, contentIds);\n }\n public async cancelElementGraphicsRequests(key: string, requestIds: string[]): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].cancelElementGraphicsRequests(requestIds);\n }\n public async openBriefcase(args: OpenBriefcaseProps): Promise<BriefcaseConnectionProps> {\n const db = await BriefcaseDb.open(args);\n return db.toJSON();\n }\n public async openCheckpoint(checkpoint: OpenCheckpointArgs): Promise<IModelConnectionProps> {\n return (await SnapshotDb.openCheckpoint(checkpoint)).getConnectionProps();\n }\n public async openStandalone(filePath: string, openMode: OpenMode, opts?: StandaloneOpenOptions): Promise<IModelConnectionProps> {\n return StandaloneDb.openFile(filePath, openMode, opts).getConnectionProps();\n }\n public async openSnapshot(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) { // eslint-disable-line @typescript-eslint/no-deprecated\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath); // eslint-disable-line @typescript-eslint/no-deprecated\n if (!resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n public async closeIModel(key: string): Promise<void> {\n IModelDb.findByKey(key).close();\n }\n public async saveChanges(key: string, description?: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].saveChanges(description);\n }\n public async abandonChanges(key: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].abandonChanges();\n }\n public async hasPendingTxns(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].hasPendingTxns();\n }\n\n public async isUndoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isUndoPossible();\n }\n public async isRedoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isRedoPossible();\n }\n public async getUndoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getUndoString();\n }\n public async getRedoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getRedoString();\n }\n\n public async pullChanges(key: string, toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Continue);\n const checkAbort = () => this._iModelKeyToPullStatus.get(key) ?? ProgressStatus.Continue;\n\n let onProgress: ProgressFunction | undefined;\n if (options?.reportProgress) {\n const progressCallback: ProgressFunction = (loaded, total) => {\n IpcHost.send(getPullChangesIpcChannel(iModelDb.iModelId), { loaded, total });\n return checkAbort();\n };\n onProgress = throttleProgressCallback(progressCallback, checkAbort, options?.progressInterval);\n } else if (options?.enableCancellation) {\n onProgress = checkAbort;\n }\n\n try {\n await iModelDb.pullChanges({ toIndex, onProgress });\n } finally {\n this._iModelKeyToPullStatus.delete(key);\n }\n\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n public async cancelPullChangesRequest(key: string): Promise<void> {\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Abort);\n }\n\n public async pushChanges(key: string, description: string): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n await iModelDb.pushChanges({ description });\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n\n public async toggleGraphicalEditingScope(key: string, startSession: boolean): Promise<boolean> {\n const val: IModelJsNative.ErrorStatusOrResult<any, boolean> = IModelDb.findByKey(key)[_nativeDb].setGeometricModelTrackingEnabled(startSession);\n if (val.error)\n throw new IModelError(val.error.status, \"Failed to toggle graphical editing scope\");\n assert(undefined !== val.result);\n return val.result;\n }\n public async isGraphicalEditingSupported(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();\n }\n\n public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reverseTxns(numOperations);\n }\n\n public async reverseTxnsAsync(key: string, numOperations: number, args?: ReverseTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reverseTxnsAsync(numOperations, args);\n }\n\n public async reverseAllTxn(key: string): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reverseAll();\n }\n\n public async reverseAllTxnsAsync(key: string, args?: ReverseTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reverseAllTxnsAsync(args);\n }\n\n public async reinstateTxn(key: string): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reinstateTxn();\n }\n\n public async reinstateTxnAsync(key: string, args?: ReinstateTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reinstateTxnAsync(args);\n }\n\n public async restartTxnSession(key: string): Promise<void> {\n return IModelDb.findByKey(key).restartTxnSession();\n }\n\n public async queryConcurrency(pool: \"io\" | \"cpu\"): Promise<number> {\n return IModelNative.platform.queryConcurrency(pool);\n }\n}\n\n/**\n * Prevents progress callback being called more frequently when provided interval.\n * @internal\n */\nexport function throttleProgressCallback(func: ProgressFunction, checkAbort: () => ProgressStatus, progressInterval?: number): ProgressFunction {\n const interval = progressInterval ?? 250; // by default, only send progress events every 250 milliseconds\n let nextTime = Date.now() + interval;\n const progressCallback: ProgressFunction = (loaded, total) => {\n const now = Date.now();\n if (loaded >= total || now >= nextTime) {\n nextTime = now + interval;\n return func(loaded, total);\n }\n return checkAbort();\n };\n\n return progressCallback;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IpcHost.js","sourceRoot":"","sources":["../../src/IpcHost.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAuYH,4DAaC;AAjZD,sDAAgH;AAChH,oDAM4B;AAC5B,2DAAuE;AACvE,yCAA6E;AAC7E,6CAA6D;AAC7D,8DAAyD;AACzD,gDAA6D;AAC7D,oEAAyE;AAmBzE;;;;GAIG;AACH,MAAa,OAAO;IACX,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,MAAM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;GAGG;AACH,SAAgB,wBAAwB,CAAC,IAAsB,EAAE,UAAgC,EAAE,gBAAyB;IAC1H,MAAM,QAAQ,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,+DAA+D;IACzG,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,gBAAgB,GAAqB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YACvC,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC;YAC1B,OAAO,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module NativeApp\n */\n\nimport { IModelJsNative } from \"@bentley/imodeljs-native\";\nimport { assert, BentleyError, IModelStatus, JsonUtils, Logger, LogLevel, OpenMode } from \"@itwin/core-bentley\";\nimport {\n BriefcaseConnectionProps,\n ChangesetIndex, ChangesetIndexAndId, EditingScopeNotifications, getPullChangesIpcChannel, IModelConnectionProps, IModelError, IModelNotFoundResponse, IModelRpcProps,\n ipcAppChannels, IpcAppFunctions, IpcAppNotifications, IpcInvokeReturn, IpcListener, IpcSocketBackend, iTwinChannel,\n OpenBriefcaseProps, OpenCheckpointArgs, PullChangesOptions, ReinstateTxnArgs, RemoveFunction, ReverseTxnArgs, SnapshotOpenOptions,\n StandaloneOpenOptions, TileTreeContentIds, TxnNotifications,\n} from \"@itwin/core-common\";\nimport { ProgressFunction, ProgressStatus } from \"./CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb, StandaloneDb } from \"./IModelDb\";\nimport { IModelHost, IModelHostOptions } from \"./IModelHost\";\nimport { IModelNative } from \"./internal/NativePlatform\";\nimport { _implicitTxn, _nativeDb } from \"./internal/Symbols\";\nimport { cancelTileContentRequests } from \"./rpc-impl/IModelTileRpcImpl\";\n\n/**\n * Options for [[IpcHost.startup]]\n * @public\n */\nexport interface IpcHostOpts {\n iModelHost?: IModelHostOptions;\n ipcHost?: {\n /** The Ipc socket to use for communications with frontend. Allows undefined only for headless tests. */\n socket?: IpcSocketBackend;\n\n /** don't send stack information on exceptions */\n exceptions?: {\n noStack?: boolean;\n };\n };\n}\n\n/**\n * Used by applications that have a dedicated backend. IpcHosts may send messages to their corresponding IpcApp.\n * @note if either end terminates, the other must too.\n * @public\n */\nexport class IpcHost {\n public static noStack = false;\n private static _ipc: IpcSocketBackend | undefined;\n /** Get the implementation of the [IpcSocketBackend]($common) interface. */\n private static get ipc(): IpcSocketBackend { return this._ipc!; } // eslint-disable-line @typescript-eslint/no-non-null-assertion\n /** Determine whether Ipc is available for this backend. This will only be true if [[startup]] has been called on this class. */\n public static get isValid(): boolean { return undefined !== this._ipc; }\n\n /**\n * Send a message to the frontend over an Ipc channel.\n * @param channel the name of the channel matching the name registered with [[IpcApp.addListener]].\n * @param data The content of the message.\n */\n public static send(channel: string, ...data: any[]): void {\n this.ipc.send(iTwinChannel(channel), ...data);\n }\n\n /**\n * Establish a handler for an Ipc channel to receive [[Frontend.invoke]] calls\n * @param channel The name of the channel for this handler.\n * @param handler A function that supplies the implementation for `channel`\n * @note returns A function to call to remove the handler.\n */\n public static handle(channel: string, handler: (...args: any[]) => Promise<any>): RemoveFunction {\n return this.ipc.handle(iTwinChannel(channel), handler);\n }\n /**\n * Establish a handler to receive messages sent via [[IpcApp.send]].\n * @param channel The name of the channel for the messages.\n * @param listener A function called when messages are sent over `channel`\n * @note returns A function to call to remove the listener.\n */\n public static addListener(channel: string, listener: IpcListener): RemoveFunction {\n return this.ipc.addListener(iTwinChannel(channel), listener);\n }\n /**\n * Remove a previously registered listener\n * @param channel The name of the channel for the listener previously registered with [[addListener]]\n * @param listener The function passed to [[addListener]]\n */\n public static removeListener(channel: string, listener: IpcListener): void {\n this.ipc.removeListener(iTwinChannel(channel), listener);\n }\n\n private static notify(channel: string, briefcase: BriefcaseDb | StandaloneDb, methodName: string, ...args: any[]) {\n if (this.isValid)\n return this.send(`${channel}/${briefcase.key}`, methodName, ...args);\n }\n\n /** @internal */\n public static notifyIpcFrontend<T extends keyof IpcAppNotifications>(methodName: T, ...args: Parameters<IpcAppNotifications[T]>) {\n return IpcHost.send(ipcAppChannels.appNotify, methodName, ...args);\n }\n\n /** @internal */\n public static notifyTxns<T extends keyof TxnNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<TxnNotifications[T]>) {\n this.notify(ipcAppChannels.txns, briefcase, methodName, ...args);\n }\n\n /** @internal */\n public static notifyEditingScope<T extends keyof EditingScopeNotifications>(briefcase: BriefcaseDb | StandaloneDb, methodName: T, ...args: Parameters<EditingScopeNotifications[T]>) {\n this.notify(ipcAppChannels.editingScope, briefcase, methodName, ...args);\n }\n\n /**\n * Start the backend of an Ipc app.\n * @param opt\n * @note this method calls [[IModelHost.startup]] internally.\n */\n public static async startup(opt?: IpcHostOpts): Promise<void> {\n this._ipc = opt?.ipcHost?.socket;\n if (opt?.ipcHost?.exceptions?.noStack)\n this.noStack = true;\n\n if (this.isValid) { // for tests, we use IpcHost but don't have a frontend\n IpcAppHandler.register();\n }\n\n await IModelHost.startup(opt?.iModelHost);\n }\n\n /** Shutdown IpcHost backend. Also calls [[IModelHost.shutdown]] */\n public static async shutdown(): Promise<void> {\n this._ipc = undefined;\n await IModelHost.shutdown();\n }\n}\n\n/**\n * Base class for all implementations of an Ipc interface.\n *\n * Create a subclass to implement your Ipc interface. Your class should be declared like this:\n * ```ts\n * class MyHandler extends IpcHandler implements MyInterface\n * ```\n * to ensure all methods and signatures are correct.\n *\n * Then, call `MyClass.register` at startup to connect your class to your channel.\n * @public\n */\nexport abstract class IpcHandler {\n /**\n * All subclasses *must* implement this method to specify their channel name.\n *\n * Channel names are the key that connects Handlers and senders. The channel name of IpcHandlers must exactly match the name used by senders.\n * By convention, channel names should be prefixed by a *namespace* (e.g. `${appName}/`)\n * unique enough to disambiguate them from channels for other apps that may be running in the same processes.\n */\n public abstract get channelName(): string;\n\n /**\n * Register this class as the handler for methods on its channel. This static method creates a new instance\n * that becomes the handler and is `this` when its methods are called.\n * @returns A function that can be called to remove the handler.\n * @note this method should only be called once per channel. If it is called multiple times, subsequent calls replace the previous ones.\n */\n public static register(): RemoveFunction {\n const impl = new (this as any)() as IpcHandler; // create an instance of subclass. \"as any\" is necessary because base class is abstract\n const prohibitedFunctions = Object.getOwnPropertyNames(Object.getPrototypeOf({}));\n\n return IpcHost.handle(impl.channelName, async (_evt: Event, funcName: string, ...args: any[]): Promise<IpcInvokeReturn> => {\n try {\n if (prohibitedFunctions.includes(funcName))\n throw new Error(`Method \"${funcName}\" not available for channel: ${impl.channelName}`);\n\n const func = (impl as any)[funcName];\n if (typeof func !== \"function\")\n throw new IModelError(IModelStatus.FunctionNotFound, `Method \"${impl.constructor.name}.${funcName}\" not found on IpcHandler registered for channel: ${impl.channelName}`);\n\n return { result: await func.call(impl, ...args) };\n } catch (err: unknown) {\n\n if (!JsonUtils.isObject(err)) // if the exception isn't an object, just forward it\n return { error: err };\n\n const serializeError = (e: any, includeStack: boolean, visited = new WeakSet<object>()): any => {\n if (visited.has(e))\n return undefined;\n visited.add(e);\n try {\n const serialized: any = { ...e };\n\n for (const sym of Object.getOwnPropertySymbols(serialized))\n delete serialized[sym]; // symbol-keyed properties cannot be structured-cloned\n\n if (e instanceof Error) {\n serialized.message = e.message; // NB: .message and .stack are non-enumerable on Error instances\n if (includeStack)\n serialized.stack = e.stack;\n\n // Error.cause is typically non-enumerable and must be copied explicitly.\n if (Object.prototype.hasOwnProperty.call(e, \"cause\"))\n serialized.cause = (e as { cause?: unknown }).cause;\n }\n\n if (e instanceof BentleyError) {\n serialized.iTwinErrorId = e.iTwinErrorId;\n if (e.hasMetaData)\n serialized.loggingMetadata = e.loggingMetadata;\n delete serialized._metaData;\n }\n\n // Only recurse into Error instances and plain objects — not class instances like Date or Buffer.\n const shouldRecurse = (val: any) => val instanceof Error || (JsonUtils.isObject(val) && Object.getPrototypeOf(val) === Object.prototype);\n const isSerializableLeaf = (val: unknown): boolean => {\n const t = typeof val;\n return val === null || val === undefined || val instanceof Date\n || t === \"string\" || t === \"number\" || t === \"boolean\";\n };\n for (const key of Object.keys(serialized)) {\n const val = serialized[key];\n if (Array.isArray(val))\n serialized[key] = val.map((item) => shouldRecurse(item) ? serializeError(item, includeStack, visited) : isSerializableLeaf(item) ? item : undefined);\n else if (shouldRecurse(val))\n serialized[key] = serializeError(val, includeStack, visited);\n else if (!isSerializableLeaf(val))\n delete serialized[key]; // strip non-cloneable values (functions, class instances, etc.)\n }\n\n return serialized;\n } finally {\n // Remove from the stack so a sibling branch can still serialize this object.\n visited.delete(e);\n }\n };\n\n return { error: serializeError(err, !IpcHost.noStack) };\n }\n });\n }\n}\n\n/**\n * Implementation of IpcAppFunctions\n */\nclass IpcAppHandler extends IpcHandler implements IpcAppFunctions {\n public get channelName() { return ipcAppChannels.functions; }\n\n private _iModelKeyToPullStatus = new Map<string, ProgressStatus>();\n\n public async log(_timestamp: number, level: LogLevel, category: string, message: string, metaData?: any): Promise<void> {\n switch (level) {\n case LogLevel.Error:\n Logger.logError(category, message, metaData);\n break;\n case LogLevel.Info:\n Logger.logInfo(category, message, metaData);\n break;\n case LogLevel.Trace:\n Logger.logTrace(category, message, metaData);\n break;\n case LogLevel.Warning:\n Logger.logWarning(category, message, metaData);\n break;\n }\n }\n\n public async cancelTileContentRequests(tokenProps: IModelRpcProps, contentIds: TileTreeContentIds[]): Promise<void> {\n return cancelTileContentRequests(tokenProps, contentIds);\n }\n public async cancelElementGraphicsRequests(key: string, requestIds: string[]): Promise<void> {\n return IModelDb.findByKey(key)[_nativeDb].cancelElementGraphicsRequests(requestIds);\n }\n public async openBriefcase(args: OpenBriefcaseProps): Promise<BriefcaseConnectionProps> {\n const db = await BriefcaseDb.open(args);\n return db.toJSON();\n }\n public async openCheckpoint(checkpoint: OpenCheckpointArgs): Promise<IModelConnectionProps> {\n return (await SnapshotDb.openCheckpoint(checkpoint)).getConnectionProps();\n }\n public async openStandalone(filePath: string, openMode: OpenMode, opts?: StandaloneOpenOptions): Promise<IModelConnectionProps> {\n return StandaloneDb.openFile(filePath, openMode, opts).getConnectionProps();\n }\n public async openSnapshot(filePath: string, opts?: SnapshotOpenOptions): Promise<IModelConnectionProps> {\n let resolvedFileName: string | undefined = filePath;\n if (IModelHost.snapshotFileNameResolver) { // eslint-disable-line @typescript-eslint/no-deprecated\n resolvedFileName = IModelHost.snapshotFileNameResolver.tryResolveFileName(filePath); // eslint-disable-line @typescript-eslint/no-deprecated\n if (!resolvedFileName)\n throw new IModelNotFoundResponse(); // eslint-disable-line @typescript-eslint/only-throw-error\n }\n return SnapshotDb.openFile(resolvedFileName, opts).getConnectionProps();\n }\n public async closeIModel(key: string): Promise<void> {\n IModelDb.findByKey(key).close();\n }\n public async saveChanges(key: string, description?: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].saveChanges(description);\n }\n public async abandonChanges(key: string): Promise<void> {\n IModelDb.findByKey(key)[_implicitTxn].abandonChanges();\n }\n public async hasPendingTxns(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].hasPendingTxns();\n }\n\n public async isUndoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isUndoPossible();\n }\n public async isRedoPossible(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isRedoPossible();\n }\n public async getUndoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getUndoString();\n }\n public async getRedoString(key: string): Promise<string> {\n return IModelDb.findByKey(key)[_nativeDb].getRedoString();\n }\n\n public async pullChanges(key: string, toIndex?: ChangesetIndex, options?: PullChangesOptions): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Continue);\n const checkAbort = () => this._iModelKeyToPullStatus.get(key) ?? ProgressStatus.Continue;\n\n let onProgress: ProgressFunction | undefined;\n if (options?.reportProgress) {\n const progressCallback: ProgressFunction = (loaded, total) => {\n IpcHost.send(getPullChangesIpcChannel(iModelDb.iModelId), { loaded, total });\n return checkAbort();\n };\n onProgress = throttleProgressCallback(progressCallback, checkAbort, options?.progressInterval);\n } else if (options?.enableCancellation) {\n onProgress = checkAbort;\n }\n\n try {\n await iModelDb.pullChanges({ toIndex, onProgress });\n } finally {\n this._iModelKeyToPullStatus.delete(key);\n }\n\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n public async cancelPullChangesRequest(key: string): Promise<void> {\n this._iModelKeyToPullStatus.set(key, ProgressStatus.Abort);\n }\n\n public async pushChanges(key: string, description: string): Promise<ChangesetIndexAndId> {\n const iModelDb = BriefcaseDb.findByKey(key);\n await iModelDb.pushChanges({ description });\n return iModelDb.changeset as ChangesetIndexAndId;\n }\n\n public async toggleGraphicalEditingScope(key: string, startSession: boolean): Promise<boolean> {\n const val: IModelJsNative.ErrorStatusOrResult<any, boolean> = IModelDb.findByKey(key)[_nativeDb].setGeometricModelTrackingEnabled(startSession);\n if (val.error)\n throw new IModelError(val.error.status, \"Failed to toggle graphical editing scope\");\n assert(undefined !== val.result);\n return val.result;\n }\n public async isGraphicalEditingSupported(key: string): Promise<boolean> {\n return IModelDb.findByKey(key)[_nativeDb].isGeometricModelTrackingSupported();\n }\n\n public async reverseTxns(key: string, numOperations: number): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reverseTxns(numOperations);\n }\n\n public async reverseTxnsAsync(key: string, numOperations: number, args?: ReverseTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reverseTxnsAsync(numOperations, args);\n }\n\n public async reverseAllTxn(key: string): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reverseAll();\n }\n\n public async reverseAllTxnsAsync(key: string, args?: ReverseTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reverseAllTxnsAsync(args);\n }\n\n public async reinstateTxn(key: string): Promise<IModelStatus> {\n return BriefcaseDb.findByKey(key).txns.reinstateTxn();\n }\n\n public async reinstateTxnAsync(key: string, args?: ReinstateTxnArgs): Promise<void> {\n return BriefcaseDb.findByKey(key).txns.reinstateTxnAsync(args);\n }\n\n public async restartTxnSession(key: string): Promise<void> {\n return IModelDb.findByKey(key).restartTxnSession();\n }\n\n public async queryConcurrency(pool: \"io\" | \"cpu\"): Promise<number> {\n return IModelNative.platform.queryConcurrency(pool);\n }\n}\n\n/**\n * Prevents progress callback being called more frequently when provided interval.\n * @internal\n */\nexport function throttleProgressCallback(func: ProgressFunction, checkAbort: () => ProgressStatus, progressInterval?: number): ProgressFunction {\n const interval = progressInterval ?? 250; // by default, only send progress events every 250 milliseconds\n let nextTime = Date.now() + interval;\n const progressCallback: ProgressFunction = (loaded, total) => {\n const now = Date.now();\n if (loaded >= total || now >= nextTime) {\n nextTime = now + interval;\n return func(loaded, total);\n }\n return checkAbort();\n };\n\n return progressCallback;\n}\n"]}
|
package/lib/cjs/LineStyle.d.ts
CHANGED
|
@@ -279,7 +279,7 @@ export declare namespace LineStyleDefinition {
|
|
|
279
279
|
*/
|
|
280
280
|
static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;
|
|
281
281
|
/** Create a file property for a new stroke pattern component.
|
|
282
|
-
* @deprecated Use createStrokePatternComponent(txn, ...) instead.
|
|
282
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStrokePatternComponent(txn, ...) instead.
|
|
283
283
|
*/
|
|
284
284
|
static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;
|
|
285
285
|
/** Create a file property for a new point symbol component using an explicit EditTxn.
|
|
@@ -289,7 +289,7 @@ export declare namespace LineStyleDefinition {
|
|
|
289
289
|
static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;
|
|
290
290
|
/** Create a file property for a new point symbol component.
|
|
291
291
|
* If base and size parameters are not supplied, queries GeometryPart by id to set them.
|
|
292
|
-
* @deprecated Use createPointSymbolComponent(txn, ...) instead.
|
|
292
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createPointSymbolComponent(txn, ...) instead.
|
|
293
293
|
*/
|
|
294
294
|
static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;
|
|
295
295
|
/** Create a file property for a new stroke point component using an explicit EditTxn.
|
|
@@ -297,7 +297,7 @@ export declare namespace LineStyleDefinition {
|
|
|
297
297
|
*/
|
|
298
298
|
static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;
|
|
299
299
|
/** Create a file property for a new stroke point component.
|
|
300
|
-
* @deprecated Use createStrokePointComponent(txn, ...) instead.
|
|
300
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStrokePointComponent(txn, ...) instead.
|
|
301
301
|
*/
|
|
302
302
|
static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;
|
|
303
303
|
/** Create a file property for a new compound component using an explicit EditTxn.
|
|
@@ -305,7 +305,7 @@ export declare namespace LineStyleDefinition {
|
|
|
305
305
|
*/
|
|
306
306
|
static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;
|
|
307
307
|
/** Create a file property for a new compound component.
|
|
308
|
-
* @deprecated Use createCompoundComponent(txn, ...) instead.
|
|
308
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createCompoundComponent(txn, ...) instead.
|
|
309
309
|
*/
|
|
310
310
|
static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;
|
|
311
311
|
/** Create a file property for a new raster image component using an explicit EditTxn.
|
|
@@ -313,7 +313,7 @@ export declare namespace LineStyleDefinition {
|
|
|
313
313
|
*/
|
|
314
314
|
static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;
|
|
315
315
|
/** Create a file property for a new raster image component.
|
|
316
|
-
* @deprecated Use createRasterComponent(txn, ...) instead.
|
|
316
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createRasterComponent(txn, ...) instead.
|
|
317
317
|
*/
|
|
318
318
|
static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;
|
|
319
319
|
/** Query for an existing line style with the supplied name. */
|
|
@@ -325,7 +325,7 @@ export declare namespace LineStyleDefinition {
|
|
|
325
325
|
static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;
|
|
326
326
|
/** Insert a new line style with the supplied name.
|
|
327
327
|
* @throws [[IModelError]] if unable to insert the line style definition element.
|
|
328
|
-
* @deprecated Use createStyle(txn, ...) instead.
|
|
328
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStyle(txn, ...) instead.
|
|
329
329
|
*/
|
|
330
330
|
static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;
|
|
331
331
|
/** Get the name that can be use to query for an existing continuous line style. */
|
package/lib/cjs/LineStyle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,oDAAgG;AAChG,uCAAoC;AACpC,uCAAoD;AAEpD,gDAAkD;AAElD,SAAS,qBAAqB,CAAC,UAAsB;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wB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,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,MAAM,CAAC,sBAAY,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjK,CAAC;KACF;IArMY,yBAAK,QAqMjB,CAAA;AACH,CAAC,EA7dgB,mBAAmB,mCAAnB,mBAAmB,QA6dnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\nimport { EditTxn } from \"./EditTxn\";\nimport { GeometryPart, LineStyle } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _implicitTxn } from \"./internal/Symbols\";\n\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\n switch (linePixels) {\n case LinePixels.Code1:\n return 1;\n case LinePixels.Code2:\n return 2;\n case LinePixels.Code3:\n return 3;\n case LinePixels.Code4:\n return 4;\n case LinePixels.Code5:\n return 5;\n case LinePixels.Code6:\n return 6;\n case LinePixels.Code7:\n return 7;\n default:\n return -1; // Invalid value...\n }\n}\n\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\n * There are three varieties of line styles:\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\n * - A style that uses a texture.\n *\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\n * by file property id and type and is saved as a dictionary element.\n * @public\n */\nexport namespace LineStyleDefinition {\n\n /** Line style component type identifiers */\n export enum ComponentType {\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\n PointSymbol = 1,\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\n Compound = 2,\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\n StrokePattern = 3,\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\n StrokePoint = 4,\n /** Component type for [[LinePixels]], never saved as a file property */\n Internal = 6,\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\n RasterImage = 7,\n }\n\n /** Mask of values for StrokeMode */\n export enum StrokeMode {\n /** Stroke represents a blank space */\n Gap = 0x00,\n /** Stroke represents a solid dash */\n Dash = 0x01,\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\n Ray = 0x02,\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\n Scale = 0x04,\n /** Invert stroke in first stroke pattern */\n FirstInvert = 0x08,\n /** Invert stroke in last stroke pattern */\n LastInvert = 0x10,\n }\n\n /** Define constant width or tapered strokes with distance specified in meters */\n export enum StrokeWidth {\n /** Stroke draws as one pixel wide line */\n None = 0,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\n Left = 1,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\n Right = 2,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\n Full = 3,\n }\n\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\n * StrokeCap indicates the number of vectors in the arc.\n */\n export enum StrokeCap {\n /** Stroke displays as a closed polygon */\n Closed = 0,\n /** Stroke displays lines at specified width instead of a polygon */\n Open = 1,\n /** Stroke length extended by half the stroke width */\n Extended = 2,\n /** Stroke end cap is a hexagon */\n Hexagon = 3,\n /** Stroke end cap is an octagon */\n Octagon = 4,\n /** Stroke end cap is a decagon */\n Decagon = 5,\n /** Stroke end cap is an arc */\n Arc = 30,\n }\n\n /** A stroke representing either a dash or gap in a stroke pattern */\n export interface StrokeProps {\n /** Length of stroke in meters */\n length: number;\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n orgWidth?: number;\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n endWidth?: number;\n /** Type and behavior of stroke */\n strokeMode?: StrokeMode;\n /** How to apply orgWidth and endWidth to stroke */\n widthMode?: StrokeWidth;\n /** Appearance of stroke end cap */\n capMode?: StrokeCap;\n }\n\n export type Strokes = StrokeProps[];\n\n /** Options to control how stroke pattern is applied to underlying curve */\n export enum StrokePatternOptions {\n /** Use default stroke behavior */\n None = 0x00,\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\n AutoPhase = 0x01,\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\n Iteration = 0x08,\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\n Segment = 0x10,\n /** Center the line style and stretch the ends */\n CenterStretch = 0x20,\n }\n\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\n */\n export interface StrokePatternProps {\n /** Name for this stroke pattern */\n descr: string;\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\n phase?: number;\n /** Options mask for this stroke pattern */\n options?: StrokePatternOptions;\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\n maxIter?: number;\n /** Array of strokes, maximum number that will be used is 32 */\n strokes: Strokes;\n }\n\n /** Flags to identify point symbol behavior */\n export enum PointSymbolFlags {\n /** Default symbol behavior */\n None = 0x0,\n /** Symbol includes 3d geometry */\n Is3d = 0x01,\n /** Symbol does not allow scaling */\n NoScale = 0x02,\n }\n\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\n */\n export interface PointSymbolProps {\n /** GeometryPart Id to use as a pattern symbol */\n geomPartId: Id64String;\n /** GeometryPart.bbox.low.x */\n baseX?: number;\n /** GeometryPart.bbox.low.y */\n baseY?: number;\n /** GeometryPart.bbox.low.z */\n baseZ?: number;\n /** GeometryPart.bbox.high.x */\n sizeX?: number;\n /** GeometryPart.bbox.high.y */\n sizeY?: number;\n /** GeometryPart.bbox.high.z */\n sizeZ?: number;\n /** Symbol behavior flags */\n symFlags?: PointSymbolFlags;\n /** Symbol scale, defaults to 1 */\n scale?: number;\n }\n\n /** Symbol options for location, orientation, and behavior */\n export enum SymbolOptions {\n /** No point symbol */\n None = 0x00,\n /** Symbol at origin of stroke */\n Origin = 0x01,\n /** Symbol at end of stroke */\n End = 0x02,\n /** symbol at center of stroke */\n Center = 0x03,\n /** Symbol at curve start point */\n CurveOrigin = 0x0004,\n /** Symbol at curve end point */\n CurveEnd = 0x0008,\n /** Symbol at each vertex */\n CurveVertex = 0x0010,\n /** Adjust symbol rotation left->right */\n AdjustRotation = 0x0020,\n /** Angle of symbol not relative to stroke direction */\n AbsoluteRotation = 0x0040,\n /** No scale on variable strokes */\n NoScale = 0x0100,\n /** No clip on partial strokes */\n NoClip = 0x0200,\n /** No partial strokes */\n NoPartial = 0x0400,\n /** Project partial origin */\n ProjectOrigin = 0x0800,\n /** Use color from symbol instead of inheriting curve color */\n UseColor = 0x4000,\n /** Use weight from symbol instead of inheriting curve weight */\n UseWeight = 0x8000,\n }\n\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\n export interface SymbolProps {\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\n symId: number;\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\n symType?: ComponentType;\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\n strokeNum?: number;\n /** Symbol x offset distance in meters */\n xOffset?: number;\n /** Symbol y offset distance in meters */\n yOffset?: number;\n /** Symbol rotation in radians */\n angle?: number;\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\n mod1?: SymbolOptions;\n }\n\n export type Symbols = SymbolProps[];\n\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\n */\n export interface StrokePointProps {\n /** Name for this stroke point component */\n descr: string;\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\n lcId: number;\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\n lcType?: ComponentType;\n /** Array of symbols */\n symbols: Symbols;\n }\n\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\n * A raster component identifies a texture for a line style.\n */\n export interface RasterImageProps {\n /** Name for this raster image component */\n descr: string;\n /** Raster width */\n x: number;\n /** Raster height */\n y: number;\n /** True width flag */\n trueWidth?: number;\n /** Raster flags */\n flags?: number;\n /** The file property id of raster image */\n imageId?: number;\n }\n\n /** Identifies a component by file property id and type */\n export interface ComponentProps {\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\n id: number;\n /** The type of component for specified file property id */\n type: ComponentType;\n /** Offset distance for this component, default is 0 */\n offset?: number;\n }\n\n export type Components = ComponentProps[];\n\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\n */\n export interface CompoundProps {\n comps: Components;\n }\n\n /** Flags to describe a style or control style behavior */\n export enum StyleFlags {\n /** Use defaults */\n None = 0x00,\n /** Only snap to center line and not individual strokes and symbols of line style */\n NoSnap = 0x04,\n /** Style represents a continuous line with width (determined by looking at components if not set) */\n Continuous = 0x08,\n /** Style represents physical geometry and should be scaled as such */\n Physical = 0x80,\n }\n\n /** The line style definition element data */\n export interface StyleProps {\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\n compId: number;\n /** The type of component for specified file property id */\n compType: ComponentType;\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\n flags?: StyleFlags;\n /** Style scale, defaults to 1 */\n unitDef?: number;\n }\n\n /** Helper methods for creating and querying line styles */\n export class Utils {\n /** Create a file property for a new stroke pattern component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;\n /** Create a file property for a new stroke pattern component.\n * @deprecated Use createStrokePatternComponent(txn, ...) instead.\n */\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;\n public static createStrokePatternComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePatternProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\n }\n\n /** Create a file property for a new point symbol component using an explicit EditTxn.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @beta\n */\n public static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;\n /** Create a file property for a new point symbol component.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @deprecated Use createPointSymbolComponent(txn, ...) instead.\n */\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;\n public static createPointSymbolComponent(txnOrIModel: EditTxn | IModelDb, props: PointSymbolProps): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n // if part extents weren't supplied, set them up now.\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\n if (!geomPart)\n return undefined;\n\n props.baseX = geomPart.bbox.low.x;\n props.baseY = geomPart.bbox.low.y;\n props.baseZ = geomPart.bbox.low.z;\n\n props.sizeX = geomPart.bbox.high.x;\n props.sizeY = geomPart.bbox.high.y;\n props.sizeZ = geomPart.bbox.high.z;\n }\n\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\n }\n\n /** Create a file property for a new stroke point component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;\n /** Create a file property for a new stroke point component.\n * @deprecated Use createStrokePointComponent(txn, ...) instead.\n */\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;\n public static createStrokePointComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePointProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\n }\n\n /** Create a file property for a new compound component using an explicit EditTxn.\n * @beta\n */\n public static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;\n /** Create a file property for a new compound component.\n * @deprecated Use createCompoundComponent(txn, ...) instead.\n */\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;\n public static createCompoundComponent(txnOrIModel: EditTxn | IModelDb, props: CompoundProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.Compound };\n }\n\n /** Create a file property for a new raster image component using an explicit EditTxn.\n * @beta\n */\n public static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n /** Create a file property for a new raster image component.\n * @deprecated Use createRasterComponent(txn, ...) instead.\n */\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n public static createRasterComponent(txnOrIModel: EditTxn | IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\n txn.saveFileProperty(rasterFileProps, undefined, image);\n props.imageId = rasterFileProps.id;\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\n }\n\n /** Query for an existing line style with the supplied name. */\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\n }\n\n /** Insert a new line style with the supplied name using an explicit EditTxn.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n /** Insert a new line style with the supplied name.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @deprecated Use createStyle(txn, ...) instead.\n */\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n public static createStyle(txnOrIModel: EditTxn | IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const imodel = txn.iModel;\n if (undefined === props.flags)\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\n\n const lsProps: LineStyleProps = {\n classFullName: \"BisCore:LineStyle\",\n model: scopeModelId,\n code: LineStyle.createCode(imodel, scopeModelId, name),\n data: JSON.stringify(props),\n };\n\n return txn.insertElement(lsProps);\n }\n\n /** Get the name that can be use to query for an existing continuous line style. */\n public static getContinuousStyleName(width?: number): string {\n if (width === undefined)\n return \"Continuous\";\n\n return `Continuous-${width}`;\n }\n\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\n * There are 2 ways to define a continuous line style:\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\n * - Width is specified in the style.\n * - Defined using a single stroke component that is a long dash.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String {\n const writeTxn = txn ?? imodel[_implicitTxn];\n const name = this.getContinuousStyleName(width);\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n if (undefined !== lsId)\n return lsId;\n\n if (width === undefined)\n return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n\n const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\n if (undefined === strokePatternData)\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\n\n return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n }\n\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\n */\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n return undefined;\n\n return `LinePixelsCodeNumber-${lineCode}`;\n }\n\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\n\n const name = `LinePixelsCodeNumber-${lineCode}`;\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LineStyle.js","sourceRoot":"","sources":["../../src/LineStyle.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA+D;AAC/D,oDAAgG;AAChG,uCAAoC;AACpC,uCAAoD;AAEpD,gDAAkD;AAElD,SAAS,qBAAqB,CAAC,UAAsB;IACnD,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX,KAAK,wBAAU,CAAC,KAAK;YACnB,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB;IAClC,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,IAAiB,mBAAmB,CA6dnC;AA7dD,WAAiB,mBAAmB;IAElC,4CAA4C;IAC5C,IAAY,aAaX;IAbD,WAAY,aAAa;QACvB,kEAAkE;QAClE,+DAAe,CAAA;QACf,+DAA+D;QAC/D,yD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AiB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QACtL,CAAC;QAED;;UAEE;QACK,MAAM,CAAC,sBAAsB,CAAC,UAAsB;YACzD,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,OAAO,SAAS,CAAC;YAEnB,OAAO,wBAAwB,QAAQ,EAAE,CAAC;QAC5C,CAAC;QAED;;;;;;WAMG;QACI,MAAM,CAAC,0BAA0B,CAAC,MAAgB,EAAE,YAAwB,EAAE,UAAsB,EAAE,GAAa;YACxH,MAAM,QAAQ,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;YACnD,IAAI,CAAC,CAAC,KAAK,QAAQ;gBACjB,MAAM,IAAI,yBAAW,CAAC,2BAAY,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;YAEnE,MAAM,IAAI,GAAG,wBAAwB,QAAQ,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI,MAAM,CAAC,sBAAY,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjK,CAAC;KACF;IArMY,yBAAK,QAqMjB,CAAA;AACH,CAAC,EA7dgB,mBAAmB,mCAAnB,mBAAmB,QA6dnC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module ElementGeometry\n */\n\nimport { Id64String, IModelStatus } from \"@itwin/core-bentley\";\nimport { FilePropertyProps, IModelError, LinePixels, LineStyleProps } from \"@itwin/core-common\";\nimport { EditTxn } from \"./EditTxn\";\nimport { GeometryPart, LineStyle } from \"./Element\";\nimport { IModelDb } from \"./IModelDb\";\nimport { _implicitTxn } from \"./internal/Symbols\";\n\nfunction getLinePixelsLineCode(linePixels: LinePixels): number {\n switch (linePixels) {\n case LinePixels.Code1:\n return 1;\n case LinePixels.Code2:\n return 2;\n case LinePixels.Code3:\n return 3;\n case LinePixels.Code4:\n return 4;\n case LinePixels.Code5:\n return 5;\n case LinePixels.Code6:\n return 6;\n case LinePixels.Code7:\n return 7;\n default:\n return -1; // Invalid value...\n }\n}\n\n/** A line style definition is a uniquely named pattern that repeats as it is displayed along a curve path. In the absence of a line style, curve display is limited to solid lines with a width in pixels.\n * There are three varieties of line styles:\n * - A style described by a stroke pattern (series of dashes and gaps) that may also include symbol graphics.\n * - A style using pre-defined pixel bit patterns [[LinePixels]] for dashed display (Code1-Code7).\n * - A style that uses a texture.\n *\n * A definition is defined by one or more components. A component is saved as a \"file property\" and can be referenced by other components. The line style definition references a component\n * by file property id and type and is saved as a dictionary element.\n * @public\n */\nexport namespace LineStyleDefinition {\n\n /** Line style component type identifiers */\n export enum ComponentType {\n /** Component type for [[LineStyleDefinition.PointSymbolProps]] */\n PointSymbol = 1,\n /** Component type for [[LineStyleDefinition.CompoundProps]] */\n Compound = 2,\n /** Component type for [[LineStyleDefinition.StrokePatternProps]] */\n StrokePattern = 3,\n /** Component type for [[LineStyleDefinition.StrokePointProps]] */\n StrokePoint = 4,\n /** Component type for [[LinePixels]], never saved as a file property */\n Internal = 6,\n /** Component type for [[LineStyleDefinition.RasterImageProps]] */\n RasterImage = 7,\n }\n\n /** Mask of values for StrokeMode */\n export enum StrokeMode {\n /** Stroke represents a blank space */\n Gap = 0x00,\n /** Stroke represents a solid dash */\n Dash = 0x01,\n /** Treat stroke as rigid and continue past a corner to complete the stroke as opposed to breaking at the corner */\n Ray = 0x02,\n /** Stroke length can be stretched when [[LineStyleDefinition.StrokePatternOptions.Iteration]] and [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] options are set, applicable to both Gap and Dash strokes */\n Scale = 0x04,\n /** Invert stroke in first stroke pattern */\n FirstInvert = 0x08,\n /** Invert stroke in last stroke pattern */\n LastInvert = 0x10,\n }\n\n /** Define constant width or tapered strokes with distance specified in meters */\n export enum StrokeWidth {\n /** Stroke draws as one pixel wide line */\n None = 0,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to left side of stroke */\n Left = 1,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to right side of stroke */\n Right = 2,\n /** Half [[LineStyleDefinition.StrokeProps.orgWidth]] and [[LineStyleDefinition.StrokeProps.endWidth]] applied to both sides of stroke */\n Full = 3,\n }\n\n /** Controls appearance of stroke end caps. If StrokeCap is >= Hexagon, the end cap is stroked as an arc and the value of\n * StrokeCap indicates the number of vectors in the arc.\n */\n export enum StrokeCap {\n /** Stroke displays as a closed polygon */\n Closed = 0,\n /** Stroke displays lines at specified width instead of a polygon */\n Open = 1,\n /** Stroke length extended by half the stroke width */\n Extended = 2,\n /** Stroke end cap is a hexagon */\n Hexagon = 3,\n /** Stroke end cap is an octagon */\n Octagon = 4,\n /** Stroke end cap is a decagon */\n Decagon = 5,\n /** Stroke end cap is an arc */\n Arc = 30,\n }\n\n /** A stroke representing either a dash or gap in a stroke pattern */\n export interface StrokeProps {\n /** Length of stroke in meters */\n length: number;\n /** Width at start of stroke. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n orgWidth?: number;\n /** Width at end of stroke, same as start width if not present. Behavior controlled by [[LineStyleDefinition.StrokeWidth]], choose value other than [[LineStyleDefinition.StrokeWidth.None]] */\n endWidth?: number;\n /** Type and behavior of stroke */\n strokeMode?: StrokeMode;\n /** How to apply orgWidth and endWidth to stroke */\n widthMode?: StrokeWidth;\n /** Appearance of stroke end cap */\n capMode?: StrokeCap;\n }\n\n export type Strokes = StrokeProps[];\n\n /** Options to control how stroke pattern is applied to underlying curve */\n export enum StrokePatternOptions {\n /** Use default stroke behavior */\n None = 0x00,\n /** [[LineStyleDefinition.StrokePatternProps.phase]] represents fractional distance into first stroke of pattern */\n AutoPhase = 0x01,\n /** Use [[LineStyleDefinition.StrokePatternProps.maxIter]] to limit the number of iterations of the stroke pattern */\n Iteration = 0x08,\n /** Single segment mode restarts the stroke pattern at corners instead of continuing around corners */\n Segment = 0x10,\n /** Center the line style and stretch the ends */\n CenterStretch = 0x20,\n }\n\n /** Stroke pattern component definition [[LineStyleDefinition.ComponentType.StrokePattern]].\n * A stroke pattern component consists of a series of dashes and gaps having specified lengths and widths in meters. Simple dash-dot type line styles that do not\n * include point symbols can be created by referencing a stroke pattern component by its file property id.\n */\n export interface StrokePatternProps {\n /** Name for this stroke pattern */\n descr: string;\n /** Skip into the pattern before starting to draw. Value treated as fraction of the first stroke when [[LineStyleDefinition.StrokePatternOptions.AutoPhase]] set. Value used as distance when [[LineStyleDefinition.StrokePatternOptions.CenterStretch]] is not set. */\n phase?: number;\n /** Options mask for this stroke pattern */\n options?: StrokePatternOptions;\n /** The entire stroke pattern will be repeated no more than maxIter on curve or segment when [[LineStyleDefinition.StrokePatternOptions.Iteration]] is set and stroke pattern includes stretchable strokes. */\n maxIter?: number;\n /** Array of strokes, maximum number that will be used is 32 */\n strokes: Strokes;\n }\n\n /** Flags to identify point symbol behavior */\n export enum PointSymbolFlags {\n /** Default symbol behavior */\n None = 0x0,\n /** Symbol includes 3d geometry */\n Is3d = 0x01,\n /** Symbol does not allow scaling */\n NoScale = 0x02,\n }\n\n /** Point symbol component definition [[LineStyleDefinition.ComponentType.PointSymbol]].\n * A point symbol component identifies a GeometryPart for reference by a [[LineStyleDefinition.SymbolProps]].\n */\n export interface PointSymbolProps {\n /** GeometryPart Id to use as a pattern symbol */\n geomPartId: Id64String;\n /** GeometryPart.bbox.low.x */\n baseX?: number;\n /** GeometryPart.bbox.low.y */\n baseY?: number;\n /** GeometryPart.bbox.low.z */\n baseZ?: number;\n /** GeometryPart.bbox.high.x */\n sizeX?: number;\n /** GeometryPart.bbox.high.y */\n sizeY?: number;\n /** GeometryPart.bbox.high.z */\n sizeZ?: number;\n /** Symbol behavior flags */\n symFlags?: PointSymbolFlags;\n /** Symbol scale, defaults to 1 */\n scale?: number;\n }\n\n /** Symbol options for location, orientation, and behavior */\n export enum SymbolOptions {\n /** No point symbol */\n None = 0x00,\n /** Symbol at origin of stroke */\n Origin = 0x01,\n /** Symbol at end of stroke */\n End = 0x02,\n /** symbol at center of stroke */\n Center = 0x03,\n /** Symbol at curve start point */\n CurveOrigin = 0x0004,\n /** Symbol at curve end point */\n CurveEnd = 0x0008,\n /** Symbol at each vertex */\n CurveVertex = 0x0010,\n /** Adjust symbol rotation left->right */\n AdjustRotation = 0x0020,\n /** Angle of symbol not relative to stroke direction */\n AbsoluteRotation = 0x0040,\n /** No scale on variable strokes */\n NoScale = 0x0100,\n /** No clip on partial strokes */\n NoClip = 0x0200,\n /** No partial strokes */\n NoPartial = 0x0400,\n /** Project partial origin */\n ProjectOrigin = 0x0800,\n /** Use color from symbol instead of inheriting curve color */\n UseColor = 0x4000,\n /** Use weight from symbol instead of inheriting curve weight */\n UseWeight = 0x8000,\n }\n\n /** Identifies a symbol and its location and orientation relative to a stroke pattern */\n export interface SymbolProps {\n /** The file property id of the symbol component, assumed to be [[LineStyleDefinition.ComponentType.PointSymbol]] if symType is undefined. */\n symId: number;\n /** The component type, leave undefined if symId is a [[LineStyleDefinition.ComponentType.PointSymbol]] */\n symType?: ComponentType;\n /** The 0 based stroke index for base stroke pattern [[LineStyleDefinition.ComponentType.StrokePattern]] component */\n strokeNum?: number;\n /** Symbol x offset distance in meters */\n xOffset?: number;\n /** Symbol y offset distance in meters */\n yOffset?: number;\n /** Symbol rotation in radians */\n angle?: number;\n /** Must set location for symbol as default value is [[LineStyleDefinition.SymbolOptions.None]] */\n mod1?: SymbolOptions;\n }\n\n export type Symbols = SymbolProps[];\n\n /** Stroke point component definition [[LineStyleDefinition.ComponentType.StrokePoint]].\n * A stroke point component identifies the locations of point symbol components relative to a base stroke pattern component.\n */\n export interface StrokePointProps {\n /** Name for this stroke point component */\n descr: string;\n /** The file property id of the stroke component, assumed to be [[LineStyleDefinition.ComponentType.StrokePattern]] if lcType is undefined */\n lcId: number;\n /** The component type, leave undefined if lcId is a [[LineStyleDefinition.ComponentType.StrokePattern]] */\n lcType?: ComponentType;\n /** Array of symbols */\n symbols: Symbols;\n }\n\n /** Raster component definition [[LineStyleDefinition.ComponentType.RasterImage]].\n * A raster component identifies a texture for a line style.\n */\n export interface RasterImageProps {\n /** Name for this raster image component */\n descr: string;\n /** Raster width */\n x: number;\n /** Raster height */\n y: number;\n /** True width flag */\n trueWidth?: number;\n /** Raster flags */\n flags?: number;\n /** The file property id of raster image */\n imageId?: number;\n }\n\n /** Identifies a component by file property id and type */\n export interface ComponentProps {\n /** The file property id of [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.StrokePoint]] component */\n id: number;\n /** The type of component for specified file property id */\n type: ComponentType;\n /** Offset distance for this component, default is 0 */\n offset?: number;\n }\n\n export type Components = ComponentProps[];\n\n /** Compound component definition [[LineStyleDefinition.ComponentType.Compound]].\n * A compound component is used to link stroke pattern and stroke point components to create a style that displays dashes, gaps, and symbols.\n */\n export interface CompoundProps {\n comps: Components;\n }\n\n /** Flags to describe a style or control style behavior */\n export enum StyleFlags {\n /** Use defaults */\n None = 0x00,\n /** Only snap to center line and not individual strokes and symbols of line style */\n NoSnap = 0x04,\n /** Style represents a continuous line with width (determined by looking at components if not set) */\n Continuous = 0x08,\n /** Style represents physical geometry and should be scaled as such */\n Physical = 0x80,\n }\n\n /** The line style definition element data */\n export interface StyleProps {\n /** The file property id for either a [[LineStyleDefinition.ComponentType.StrokePattern]] or [[LineStyleDefinition.ComponentType.Compound]] component */\n compId: number;\n /** The type of component for specified file property id */\n compType: ComponentType;\n /** Style behavior flags. Defaults to [[LineStyleDefinition.StyleFlags.NoSnap]] if left undefined */\n flags?: StyleFlags;\n /** Style scale, defaults to 1 */\n unitDef?: number;\n }\n\n /** Helper methods for creating and querying line styles */\n export class Utils {\n /** Create a file property for a new stroke pattern component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePatternComponent(txn: EditTxn, props: StrokePatternProps): StyleProps;\n /** Create a file property for a new stroke pattern component.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStrokePatternComponent(txn, ...) instead.\n */\n public static createStrokePatternComponent(iModel: IModelDb, props: StrokePatternProps): StyleProps;\n public static createStrokePatternComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePatternProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LineCodeV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePattern };\n }\n\n /** Create a file property for a new point symbol component using an explicit EditTxn.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @beta\n */\n public static createPointSymbolComponent(txn: EditTxn, props: PointSymbolProps): StyleProps | undefined;\n /** Create a file property for a new point symbol component.\n * If base and size parameters are not supplied, queries GeometryPart by id to set them.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createPointSymbolComponent(txn, ...) instead.\n */\n public static createPointSymbolComponent(iModel: IModelDb, props: PointSymbolProps): StyleProps | undefined;\n public static createPointSymbolComponent(txnOrIModel: EditTxn | IModelDb, props: PointSymbolProps): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n // if part extents weren't supplied, set them up now.\n if (!props.baseX && !props.baseY && !props.baseZ && !props.sizeX && !props.sizeY && !props.sizeZ) {\n const geomPart = iModel.elements.getElement<GeometryPart>(props.geomPartId);\n if (!geomPart)\n return undefined;\n\n props.baseX = geomPart.bbox.low.x;\n props.baseY = geomPart.bbox.low.y;\n props.baseZ = geomPart.bbox.low.z;\n\n props.sizeX = geomPart.bbox.high.x;\n props.sizeY = geomPart.bbox.high.y;\n props.sizeZ = geomPart.bbox.high.z;\n }\n\n const fileProps: FilePropertyProps = { name: \"PointSymV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.PointSymbol };\n }\n\n /** Create a file property for a new stroke point component using an explicit EditTxn.\n * @beta\n */\n public static createStrokePointComponent(txn: EditTxn, props: StrokePointProps): StyleProps;\n /** Create a file property for a new stroke point component.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStrokePointComponent(txn, ...) instead.\n */\n public static createStrokePointComponent(iModel: IModelDb, props: StrokePointProps): StyleProps;\n public static createStrokePointComponent(txnOrIModel: EditTxn | IModelDb, props: StrokePointProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"LinePointV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.StrokePoint };\n }\n\n /** Create a file property for a new compound component using an explicit EditTxn.\n * @beta\n */\n public static createCompoundComponent(txn: EditTxn, props: CompoundProps): StyleProps;\n /** Create a file property for a new compound component.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createCompoundComponent(txn, ...) instead.\n */\n public static createCompoundComponent(iModel: IModelDb, props: CompoundProps): StyleProps;\n public static createCompoundComponent(txnOrIModel: EditTxn | IModelDb, props: CompoundProps): StyleProps {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const fileProps: FilePropertyProps = { name: \"CompoundV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = txn.iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.Compound };\n }\n\n /** Create a file property for a new raster image component using an explicit EditTxn.\n * @beta\n */\n public static createRasterComponent(txn: EditTxn, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n /** Create a file property for a new raster image component.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createRasterComponent(txn, ...) instead.\n */\n public static createRasterComponent(iModel: IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined;\n public static createRasterComponent(txnOrIModel: EditTxn | IModelDb, props: RasterImageProps, image: Uint8Array): StyleProps | undefined {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const iModel = txn.iModel;\n const rasterFileProps: FilePropertyProps = { name: \"RasterImageV1\", namespace: \"dgn_LStyle\" };\n rasterFileProps.id = iModel.queryNextAvailableFileProperty(rasterFileProps);\n txn.saveFileProperty(rasterFileProps, undefined, image);\n props.imageId = rasterFileProps.id;\n const fileProps: FilePropertyProps = { name: \"RasterComponentV1\", namespace: \"dgn_LStyle\" };\n fileProps.id = iModel.queryNextAvailableFileProperty(fileProps);\n txn.saveFileProperty(fileProps, JSON.stringify(props));\n return { compId: fileProps.id, compType: ComponentType.RasterImage };\n }\n\n /** Query for an existing line style with the supplied name. */\n public static queryStyle(imodel: IModelDb, scopeModelId: Id64String, name: string): Id64String | undefined {\n return imodel.elements.queryElementIdByCode(LineStyle.createCode(imodel, scopeModelId, name));\n }\n\n /** Insert a new line style with the supplied name using an explicit EditTxn.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static createStyle(txn: EditTxn, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n /** Insert a new line style with the supplied name.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use createStyle(txn, ...) instead.\n */\n public static createStyle(imodel: IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String;\n public static createStyle(txnOrIModel: EditTxn | IModelDb, scopeModelId: Id64String, name: string, props: StyleProps): Id64String {\n const txn = txnOrIModel instanceof EditTxn ? txnOrIModel : txnOrIModel[_implicitTxn];\n const imodel = txn.iModel;\n if (undefined === props.flags)\n props.flags = StyleFlags.NoSnap; // If flags weren't supplied, default to not snapping to stroke geometry.\n\n const lsProps: LineStyleProps = {\n classFullName: \"BisCore:LineStyle\",\n model: scopeModelId,\n code: LineStyle.createCode(imodel, scopeModelId, name),\n data: JSON.stringify(props),\n };\n\n return txn.insertElement(lsProps);\n }\n\n /** Get the name that can be use to query for an existing continuous line style. */\n public static getContinuousStyleName(width?: number): string {\n if (width === undefined)\n return \"Continuous\";\n\n return `Continuous-${width}`;\n }\n\n /** Query for a continuous line style that can be used to create curves with physical width instead of weight in pixels and create one if it does not already exist.\n * There are 2 ways to define a continuous line style:\n * - Width is not specified in the style itself and instead will be supplied as an override for each curve that is drawn.\n * - Defined using [[LineStyleDefinition.ComponentType.Internal]] with component id 0 [[LinePixels.Solid]] which has special behavior of being affected by width overrides.\n * - Width is specified in the style.\n * - Defined using a single stroke component that is a long dash.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateContinuousStyle(imodel: IModelDb, scopeModelId: Id64String, width?: number, txn?: EditTxn): Id64String {\n const writeTxn = txn ?? imodel[_implicitTxn];\n const name = this.getContinuousStyleName(width);\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n if (undefined !== lsId)\n return lsId;\n\n if (width === undefined)\n return this.createStyle(writeTxn, scopeModelId, name, { compId: 0, compType: ComponentType.Internal, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n\n const strokePatternData = this.createStrokePatternComponent(writeTxn, { descr: name, strokes: [{ length: 1e37, orgWidth: width, strokeMode: StrokeMode.Dash, widthMode: StrokeWidth.Full }] });\n if (undefined === strokePatternData)\n throw new IModelError(IModelStatus.BadArg, \"Unable to insert stroke component\");\n\n return this.createStyle(writeTxn, scopeModelId, name, { compId: strokePatternData.compId, compType: strokePatternData.compType, flags: StyleFlags.Continuous | StyleFlags.NoSnap });\n }\n\n /** Get the name that can be use to query for an existing [[LinePixels]] line style.\n * @note Returns undefined for line pixels value that is not Code1 to Code7.\n */\n public static getLinePixelsStyleName(linePixels: LinePixels): string | undefined {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n return undefined;\n\n return `LinePixelsCodeNumber-${lineCode}`;\n }\n\n /** Query for a line style using the supplied [[LinePixels]] value (Code1-Code7) and create one if it does not already exist.\n * Most applications should instead use [[createStrokePatternComponent]] to define a style with physical dash and gap lengths.\n * Unlike other components, [[LineStyleDefinition.ComponentType.Internal]] uses the line code as the compId instead of a file property id.\n * @param txn Optional explicit EditTxn to use if the style must be created.\n * @throws [[IModelError]] if supplied an invalid [[LinePixels]] value or if unable to insert the line style definition element.\n * @beta\n */\n public static getOrCreateLinePixelsStyle(imodel: IModelDb, scopeModelId: Id64String, linePixels: LinePixels, txn?: EditTxn): Id64String {\n const lineCode = getLinePixelsLineCode(linePixels);\n if (-1 === lineCode)\n throw new IModelError(IModelStatus.BadArg, \"Invalid LinePixels\");\n\n const name = `LinePixelsCodeNumber-${lineCode}`;\n const lsId = this.queryStyle(imodel, scopeModelId, name);\n return (undefined === lsId ? this.createStyle(txn ?? imodel[_implicitTxn], scopeModelId, name, { compId: lineCode, compType: ComponentType.Internal }) : lsId);\n }\n }\n}\n"]}
|
package/lib/cjs/Material.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export declare class RenderMaterialElement extends DefinitionElement {
|
|
|
88
88
|
static insert(txn: EditTxn, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
|
|
89
89
|
/**
|
|
90
90
|
* Insert a new RenderMaterial into a model.
|
|
91
|
-
* @deprecated Use RenderMaterialElement.insert(txn, ...) instead.
|
|
91
|
+
* @deprecated in 5.1.9 - will not be removed until after 2027-05-04. Use RenderMaterialElement.insert(txn, ...) instead.
|
|
92
92
|
*/
|
|
93
93
|
static insert(iModelDb: IModelDb, definitionModelId: Id64String, materialName: string, params: RenderMaterialElementParams): Id64String;
|
|
94
94
|
/** @beta */
|