@itwin/core-backend 4.0.0-dev.24 → 4.0.0-dev.28
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 +71 -66
- package/lib/cjs/AliCloudStorageService.d.ts +23 -23
- package/lib/cjs/AliCloudStorageService.js +71 -71
- package/lib/cjs/AliCloudStorageService.js.map +1 -1
- package/lib/cjs/BackendHubAccess.d.ts +224 -224
- package/lib/cjs/BackendHubAccess.js +41 -41
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
- package/lib/cjs/BackendLoggerCategory.js +99 -99
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts +21 -21
- package/lib/cjs/BisCoreSchema.js +60 -60
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +170 -170
- package/lib/cjs/BriefcaseManager.js +408 -414
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +153 -153
- package/lib/cjs/Category.js +243 -243
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
- package/lib/cjs/ChangeSummaryManager.js +446 -447
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +99 -99
- package/lib/cjs/ChangedElementsDb.js +165 -165
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.d.ts +39 -39
- package/lib/cjs/ChangedElementsManager.js +88 -88
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +121 -121
- package/lib/cjs/CheckpointManager.js +348 -349
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +79 -79
- package/lib/cjs/ClassRegistry.js +249 -250
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +350 -350
- package/lib/cjs/CloudSqlite.js +153 -153
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CloudStorageBackend.d.ts +58 -58
- package/lib/cjs/CloudStorageBackend.js +170 -173
- package/lib/cjs/CloudStorageBackend.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +396 -396
- package/lib/cjs/CodeService.js +63 -63
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +55 -55
- package/lib/cjs/CodeSpecs.js +124 -124
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts +13 -13
- package/lib/cjs/ConcurrentQuery.js +36 -36
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.d.ts +21 -21
- package/lib/cjs/CustomViewState3dCreator.js +81 -81
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.d.ts +73 -73
- package/lib/cjs/DevTools.js +156 -156
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +106 -106
- package/lib/cjs/DisplayStyle.js +253 -256
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +191 -191
- package/lib/cjs/ECDb.js +348 -350
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
- package/lib/cjs/ECSchemaXmlContext.js +41 -41
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +473 -473
- package/lib/cjs/ECSqlStatement.js +791 -791
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +1109 -1109
- package/lib/cjs/Element.js +1419 -1427
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +179 -179
- package/lib/cjs/ElementAspect.js +211 -211
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts +9 -9
- package/lib/cjs/ElementGraphics.js +41 -41
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +162 -162
- package/lib/cjs/ElementTreeWalker.js +409 -409
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +106 -106
- package/lib/cjs/Entity.js +134 -134
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.d.ts +49 -49
- package/lib/cjs/EntityReferences.js +95 -95
- package/lib/cjs/EntityReferences.js.map +1 -1
- package/lib/cjs/ExportGraphics.d.ts +317 -317
- package/lib/cjs/ExportGraphics.js +208 -208
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +96 -96
- package/lib/cjs/ExternalSource.js +131 -131
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +19 -19
- package/lib/cjs/GeoCoordConfig.js +85 -85
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.d.ts +4 -4
- package/lib/cjs/GeometrySummary.js +380 -380
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.d.ts +94 -94
- package/lib/cjs/HubMock.js +220 -222
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +8 -8
- package/lib/cjs/IModelCloneContext.js +15 -15
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +1210 -1196
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +2377 -2392
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +89 -89
- package/lib/cjs/IModelElementCloneContext.js +159 -159
- package/lib/cjs/IModelElementCloneContext.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +369 -369
- package/lib/cjs/IModelHost.js +488 -496
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts +62 -62
- package/lib/cjs/IModelJsFs.js +139 -140
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts +104 -104
- package/lib/cjs/IpcHost.js +276 -278
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +311 -311
- package/lib/cjs/LineStyle.js +295 -295
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +162 -162
- package/lib/cjs/LocalHub.js +580 -585
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
- package/lib/cjs/LocalhostIpcHost.js +79 -81
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +131 -131
- package/lib/cjs/Material.js +180 -181
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +392 -392
- package/lib/cjs/Model.js +485 -485
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.d.ts +51 -51
- package/lib/cjs/NativeAppStorage.js +202 -202
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts +52 -52
- package/lib/cjs/NativeHost.js +160 -163
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +156 -156
- package/lib/cjs/NavigationRelationship.js +225 -225
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts +51 -51
- package/lib/cjs/PromiseMemoizer.js +101 -101
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +132 -132
- package/lib/cjs/PropertyStore.js +11 -11
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +416 -416
- package/lib/cjs/Relationship.js +494 -494
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.d.ts +5 -5
- package/lib/cjs/RpcBackend.js +32 -32
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +219 -219
- package/lib/cjs/SQLiteDb.js +212 -214
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +55 -55
- package/lib/cjs/Schema.js +83 -83
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.d.ts +57 -57
- package/lib/cjs/ServerBasedLocks.js +168 -168
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +360 -360
- package/lib/cjs/SqliteStatement.js +586 -586
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/Texture.d.ts +58 -58
- package/lib/cjs/Texture.js +82 -82
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +18 -18
- package/lib/cjs/TileStorage.js +87 -90
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +202 -202
- package/lib/cjs/TxnManager.js +356 -356
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +439 -439
- package/lib/cjs/ViewDefinition.js +646 -646
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts +13 -13
- package/lib/cjs/ViewStateHydrator.js +103 -103
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
- package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
- package/lib/cjs/core-backend.d.ts +184 -184
- package/lib/cjs/core-backend.js +204 -204
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
- package/lib/cjs/domains/FunctionalElements.js +145 -145
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
- package/lib/cjs/domains/FunctionalSchema.js +40 -40
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +177 -177
- package/lib/cjs/domains/GenericElements.js +263 -263
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.d.ts +10 -10
- package/lib/cjs/domains/GenericSchema.js +28 -28
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/rpc/multipart.d.ts +11 -11
- package/lib/cjs/rpc/multipart.js +71 -71
- package/lib/cjs/rpc/multipart.js.map +1 -1
- package/lib/cjs/rpc/tracing.d.ts +28 -28
- package/lib/cjs/rpc/tracing.js +73 -74
- package/lib/cjs/rpc/tracing.js.map +1 -1
- package/lib/cjs/rpc/web/logging.d.ts +9 -9
- package/lib/cjs/rpc/web/logging.js +43 -43
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/request.d.ts +6 -6
- package/lib/cjs/rpc/web/request.js +73 -74
- package/lib/cjs/rpc/web/request.js.map +1 -1
- package/lib/cjs/rpc/web/response.d.ts +6 -6
- package/lib/cjs/rpc/web/response.js +105 -106
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +47 -47
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +293 -294
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +202 -205
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +166 -168
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +42 -43
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +186 -186
- package/lib/cjs/workspace/Settings.js +154 -155
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
- package/lib/cjs/workspace/SettingsSchemas.js +190 -191
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +414 -414
- package/lib/cjs/workspace/Workspace.js +537 -543
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module Schema
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.GenericSchema = void 0;
|
|
11
|
-
const path = require("path");
|
|
12
|
-
const ClassRegistry_1 = require("../ClassRegistry");
|
|
13
|
-
const IModelHost_1 = require("../IModelHost");
|
|
14
|
-
const Schema_1 = require("../Schema");
|
|
15
|
-
const elementsModule = require("./GenericElements");
|
|
16
|
-
/** @public */
|
|
17
|
-
class GenericSchema extends Schema_1.Schema {
|
|
18
|
-
static get schemaName() { return "Generic"; }
|
|
19
|
-
static get schemaFilePath() { return path.join(IModelHost_1.KnownLocations.nativeAssetsDir, "ECSchemas", "Dgn", `${GenericSchema.schemaName}.ecschema.xml`); }
|
|
20
|
-
static registerSchema() {
|
|
21
|
-
if (this !== Schema_1.Schemas.getRegisteredSchema(this.schemaName)) {
|
|
22
|
-
Schema_1.Schemas.unregisterSchema(this.schemaName);
|
|
23
|
-
Schema_1.Schemas.registerSchema(this);
|
|
24
|
-
ClassRegistry_1.ClassRegistry.registerModule(elementsModule, this);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.GenericSchema = GenericSchema;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module Schema
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.GenericSchema = void 0;
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const ClassRegistry_1 = require("../ClassRegistry");
|
|
13
|
+
const IModelHost_1 = require("../IModelHost");
|
|
14
|
+
const Schema_1 = require("../Schema");
|
|
15
|
+
const elementsModule = require("./GenericElements");
|
|
16
|
+
/** @public */
|
|
17
|
+
class GenericSchema extends Schema_1.Schema {
|
|
18
|
+
static get schemaName() { return "Generic"; }
|
|
19
|
+
static get schemaFilePath() { return path.join(IModelHost_1.KnownLocations.nativeAssetsDir, "ECSchemas", "Dgn", `${GenericSchema.schemaName}.ecschema.xml`); }
|
|
20
|
+
static registerSchema() {
|
|
21
|
+
if (this !== Schema_1.Schemas.getRegisteredSchema(this.schemaName)) {
|
|
22
|
+
Schema_1.Schemas.unregisterSchema(this.schemaName);
|
|
23
|
+
Schema_1.Schemas.registerSchema(this);
|
|
24
|
+
ClassRegistry_1.ClassRegistry.registerModule(elementsModule, this);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.GenericSchema = GenericSchema;
|
|
29
29
|
//# sourceMappingURL=GenericSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAVD,sCAUC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"GenericSchema.js","sourceRoot":"","sources":["../../../src/domains/GenericSchema.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,6BAA6B;AAC7B,oDAAiD;AACjD,8CAA+C;AAC/C,sCAA4C;AAC5C,oDAAoD;AAEpD,cAAc;AACd,MAAa,aAAc,SAAQ,eAAM;IAChC,MAAM,KAAc,UAAU,KAAa,OAAO,SAAS,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,cAAc,KAAa,OAAO,IAAI,CAAC,IAAI,CAAC,2BAAc,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,UAAU,eAAe,CAAC,CAAC,CAAC,CAAC;IACzJ,MAAM,CAAC,cAAc;QAC1B,IAAI,IAAI,KAAK,gBAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;YACzD,gBAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAC1C,gBAAO,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC7B,6BAAa,CAAC,cAAc,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;SACpD;IACH,CAAC;CACF;AAVD,sCAUC","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 Schema\n */\n\nimport * as path from \"path\";\nimport { ClassRegistry } from \"../ClassRegistry\";\nimport { KnownLocations } from \"../IModelHost\";\nimport { Schema, Schemas } from \"../Schema\";\nimport * as elementsModule from \"./GenericElements\";\n\n/** @public */\nexport class GenericSchema extends Schema {\n public static override get schemaName(): string { return \"Generic\"; }\n public static get schemaFilePath(): string { return path.join(KnownLocations.nativeAssetsDir, \"ECSchemas\", \"Dgn\", `${GenericSchema.schemaName}.ecschema.xml`); }\n public static registerSchema() {\n if (this !== Schemas.getRegisteredSchema(this.schemaName)) {\n Schemas.unregisterSchema(this.schemaName);\n Schemas.registerSchema(this);\n ClassRegistry.registerModule(elementsModule, this);\n }\n }\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module RpcInterface
|
|
3
|
-
*/
|
|
4
|
-
import { FormDataCommon, HttpServerRequest, RpcSerializedValue } from "@itwin/core-common";
|
|
5
|
-
import * as FormData from "form-data";
|
|
6
|
-
/** @internal */
|
|
7
|
-
export declare function createMultipartStream(value: RpcSerializedValue): FormData;
|
|
8
|
-
/** @internal */
|
|
9
|
-
export declare function parseMultipartRequest(req: HttpServerRequest): Promise<RpcSerializedValue>;
|
|
10
|
-
/** @internal */
|
|
11
|
-
export declare function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void;
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module RpcInterface
|
|
3
|
+
*/
|
|
4
|
+
import { FormDataCommon, HttpServerRequest, RpcSerializedValue } from "@itwin/core-common";
|
|
5
|
+
import * as FormData from "form-data";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function createMultipartStream(value: RpcSerializedValue): FormData;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function parseMultipartRequest(req: HttpServerRequest): Promise<RpcSerializedValue>;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue): void;
|
|
12
12
|
//# sourceMappingURL=multipart.d.ts.map
|
package/lib/cjs/rpc/multipart.js
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.appendToMultipartForm = exports.parseMultipartRequest = exports.createMultipartStream = void 0;
|
|
11
|
-
const core_common_1 = require("@itwin/core-common");
|
|
12
|
-
const FormData = require("form-data");
|
|
13
|
-
const multiparty = require("multiparty");
|
|
14
|
-
/* eslint-disable deprecation/deprecation */
|
|
15
|
-
/** @internal */
|
|
16
|
-
function createMultipartStream(value) {
|
|
17
|
-
const form = new FormData();
|
|
18
|
-
core_common_1.RpcMultipart.writeValueToForm(form, value);
|
|
19
|
-
// Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work
|
|
20
|
-
// fine for now.
|
|
21
|
-
return form;
|
|
22
|
-
}
|
|
23
|
-
exports.createMultipartStream = createMultipartStream;
|
|
24
|
-
/** @internal */
|
|
25
|
-
async function parseMultipartRequest(req) {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
const form = new multiparty.Form({ maxFieldsSize: Infinity });
|
|
28
|
-
form.on("error", (err) => {
|
|
29
|
-
reject(err);
|
|
30
|
-
});
|
|
31
|
-
const value = core_common_1.RpcSerializedValue.create();
|
|
32
|
-
const data = {};
|
|
33
|
-
form.on("part", (part) => {
|
|
34
|
-
part.on("data", (chunk) => {
|
|
35
|
-
if (part.name === "objects") {
|
|
36
|
-
value.objects += chunk.toString();
|
|
37
|
-
}
|
|
38
|
-
else if (Buffer.isBuffer(chunk)) {
|
|
39
|
-
if (!data[part.name]) {
|
|
40
|
-
data[part.name] = { size: 0, chunks: [] };
|
|
41
|
-
}
|
|
42
|
-
data[part.name].size += chunk.byteLength;
|
|
43
|
-
data[part.name].chunks.push(chunk);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Unknown input.");
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
form.on("close", () => {
|
|
51
|
-
let i = 0;
|
|
52
|
-
for (;;) {
|
|
53
|
-
const part = data[`data-${i}`];
|
|
54
|
-
if (!part) {
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
value.data.push(Buffer.concat(part.chunks, part.size));
|
|
58
|
-
++i;
|
|
59
|
-
}
|
|
60
|
-
resolve(value);
|
|
61
|
-
});
|
|
62
|
-
form.parse(req);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
exports.parseMultipartRequest = parseMultipartRequest;
|
|
66
|
-
/** @internal */
|
|
67
|
-
function appendToMultipartForm(i, form, value) {
|
|
68
|
-
const buf = value.data[i];
|
|
69
|
-
form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
|
|
70
|
-
}
|
|
71
|
-
exports.appendToMultipartForm = appendToMultipartForm;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.appendToMultipartForm = exports.parseMultipartRequest = exports.createMultipartStream = void 0;
|
|
11
|
+
const core_common_1 = require("@itwin/core-common");
|
|
12
|
+
const FormData = require("form-data");
|
|
13
|
+
const multiparty = require("multiparty");
|
|
14
|
+
/* eslint-disable deprecation/deprecation */
|
|
15
|
+
/** @internal */
|
|
16
|
+
function createMultipartStream(value) {
|
|
17
|
+
const form = new FormData();
|
|
18
|
+
core_common_1.RpcMultipart.writeValueToForm(form, value);
|
|
19
|
+
// Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work
|
|
20
|
+
// fine for now.
|
|
21
|
+
return form;
|
|
22
|
+
}
|
|
23
|
+
exports.createMultipartStream = createMultipartStream;
|
|
24
|
+
/** @internal */
|
|
25
|
+
async function parseMultipartRequest(req) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const form = new multiparty.Form({ maxFieldsSize: Infinity });
|
|
28
|
+
form.on("error", (err) => {
|
|
29
|
+
reject(err);
|
|
30
|
+
});
|
|
31
|
+
const value = core_common_1.RpcSerializedValue.create();
|
|
32
|
+
const data = {};
|
|
33
|
+
form.on("part", (part) => {
|
|
34
|
+
part.on("data", (chunk) => {
|
|
35
|
+
if (part.name === "objects") {
|
|
36
|
+
value.objects += chunk.toString();
|
|
37
|
+
}
|
|
38
|
+
else if (Buffer.isBuffer(chunk)) {
|
|
39
|
+
if (!data[part.name]) {
|
|
40
|
+
data[part.name] = { size: 0, chunks: [] };
|
|
41
|
+
}
|
|
42
|
+
data[part.name].size += chunk.byteLength;
|
|
43
|
+
data[part.name].chunks.push(chunk);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new core_common_1.IModelError(core_common_1.BentleyStatus.ERROR, "Unknown input.");
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
form.on("close", () => {
|
|
51
|
+
let i = 0;
|
|
52
|
+
for (;;) {
|
|
53
|
+
const part = data[`data-${i}`];
|
|
54
|
+
if (!part) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
value.data.push(Buffer.concat(part.chunks, part.size));
|
|
58
|
+
++i;
|
|
59
|
+
}
|
|
60
|
+
resolve(value);
|
|
61
|
+
});
|
|
62
|
+
form.parse(req);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.parseMultipartRequest = parseMultipartRequest;
|
|
66
|
+
/** @internal */
|
|
67
|
+
function appendToMultipartForm(i, form, value) {
|
|
68
|
+
const buf = value.data[i];
|
|
69
|
+
form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));
|
|
70
|
+
}
|
|
71
|
+
exports.appendToMultipartForm = appendToMultipartForm;
|
|
72
72
|
//# sourceMappingURL=multipart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":"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","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"multipart.js","sourceRoot":"","sources":["../../../src/rpc/multipart.ts"],"names":[],"mappings":"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","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 RpcInterface\n */\n\nimport { BentleyStatus, FormDataCommon, HttpServerRequest, IModelError, RpcMultipart, RpcSerializedValue } from \"@itwin/core-common\";\nimport * as FormData from \"form-data\";\nimport * as multiparty from \"multiparty\";\n\n/* eslint-disable deprecation/deprecation */\n\n/** @internal */\nexport function createMultipartStream(value: RpcSerializedValue) {\n const form = new FormData();\n RpcMultipart.writeValueToForm(form, value);\n // Type information for FormData is lying. It actually extends Stream but not Readable, although it appears to work\n // fine for now.\n return form;\n}\n\n/** @internal */\nexport async function parseMultipartRequest(req: HttpServerRequest) {\n return new Promise<RpcSerializedValue>((resolve, reject) => {\n const form = new multiparty.Form({ maxFieldsSize: Infinity });\n form.on(\"error\", (err) => {\n reject(err);\n });\n\n const value = RpcSerializedValue.create();\n const data: { [index: string]: { size: number, chunks: Buffer[] } } = {};\n\n form.on(\"part\", (part: multiparty.Part) => {\n part.on(\"data\", (chunk: string | Buffer) => {\n if (part.name === \"objects\") {\n value.objects += chunk.toString();\n } else if (Buffer.isBuffer(chunk)) {\n if (!data[part.name]) {\n data[part.name] = { size: 0, chunks: [] };\n }\n\n data[part.name].size += chunk.byteLength;\n data[part.name].chunks.push(chunk);\n } else {\n throw new IModelError(BentleyStatus.ERROR, \"Unknown input.\");\n }\n });\n });\n\n form.on(\"close\", () => {\n let i = 0;\n for (; ;) {\n const part = data[`data-${i}`];\n if (!part) {\n break;\n }\n\n value.data.push(Buffer.concat(part.chunks, part.size));\n ++i;\n }\n\n resolve(value);\n });\n\n form.parse(req);\n });\n}\n\n/** @internal */\nexport function appendToMultipartForm(i: number, form: FormDataCommon, value: RpcSerializedValue) {\n const buf = value.data[i];\n form.append(`data-${i}`, Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength));\n}\n"]}
|
package/lib/cjs/rpc/tracing.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module RpcInterface
|
|
3
|
-
*/
|
|
4
|
-
import { RpcActivity } from "@itwin/core-common";
|
|
5
|
-
/**
|
|
6
|
-
* Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
|
|
7
|
-
* class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
|
|
8
|
-
* of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
|
|
9
|
-
* from the RpcActivity.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export declare class RpcTrace {
|
|
13
|
-
private static _storage;
|
|
14
|
-
/** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
|
|
15
|
-
* RpcActivity in the current call stack.
|
|
16
|
-
* */
|
|
17
|
-
static get currentActivity(): RpcActivity | undefined;
|
|
18
|
-
/** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
|
|
19
|
-
* exists in the current call stack.
|
|
20
|
-
* */
|
|
21
|
-
static get expectCurrentActivity(): RpcActivity;
|
|
22
|
-
/** Start the processing of an RpcActivity. */
|
|
23
|
-
static run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
|
|
24
|
-
/** Start the processing of an RpcActivity inside an OpenTelemetry span */
|
|
25
|
-
static runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
|
|
26
|
-
}
|
|
27
|
-
/** @internal */
|
|
28
|
-
export declare function initializeTracing(enableOpenTelemetry?: boolean): void;
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module RpcInterface
|
|
3
|
+
*/
|
|
4
|
+
import { RpcActivity } from "@itwin/core-common";
|
|
5
|
+
/**
|
|
6
|
+
* Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
|
|
7
|
+
* class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
|
|
8
|
+
* of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
|
|
9
|
+
* from the RpcActivity.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare class RpcTrace {
|
|
13
|
+
private static _storage;
|
|
14
|
+
/** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
|
|
15
|
+
* RpcActivity in the current call stack.
|
|
16
|
+
* */
|
|
17
|
+
static get currentActivity(): RpcActivity | undefined;
|
|
18
|
+
/** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
|
|
19
|
+
* exists in the current call stack.
|
|
20
|
+
* */
|
|
21
|
+
static get expectCurrentActivity(): RpcActivity;
|
|
22
|
+
/** Start the processing of an RpcActivity. */
|
|
23
|
+
static run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
|
|
24
|
+
/** Start the processing of an RpcActivity inside an OpenTelemetry span */
|
|
25
|
+
static runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T>;
|
|
26
|
+
}
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare function initializeTracing(enableOpenTelemetry?: boolean): void;
|
|
29
29
|
//# sourceMappingURL=tracing.d.ts.map
|
package/lib/cjs/rpc/tracing.js
CHANGED
|
@@ -1,75 +1,74 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.initializeTracing = exports.RpcTrace = void 0;
|
|
11
|
-
// cspell:ignore calltrace
|
|
12
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
|
-
const core_common_1 = require("@itwin/core-common");
|
|
14
|
-
const async_hooks_1 = require("async_hooks");
|
|
15
|
-
const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
|
|
16
|
-
const IModelHost_1 = require("../IModelHost");
|
|
17
|
-
/* eslint-disable deprecation/deprecation */
|
|
18
|
-
/**
|
|
19
|
-
* Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
|
|
20
|
-
* class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
|
|
21
|
-
* of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
|
|
22
|
-
* from the RpcActivity.
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
class RpcTrace {
|
|
26
|
-
/** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
|
|
27
|
-
* RpcActivity in the current call stack.
|
|
28
|
-
* */
|
|
29
|
-
static get currentActivity() {
|
|
30
|
-
return RpcTrace._storage.getStore();
|
|
31
|
-
}
|
|
32
|
-
/** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
|
|
33
|
-
* exists in the current call stack.
|
|
34
|
-
* */
|
|
35
|
-
static get expectCurrentActivity() {
|
|
36
|
-
(0, core_bentley_1.assert)(undefined !== RpcTrace.currentActivity);
|
|
37
|
-
return RpcTrace.currentActivity;
|
|
38
|
-
}
|
|
39
|
-
/** Start the processing of an RpcActivity. */
|
|
40
|
-
static async run(activity, fn) {
|
|
41
|
-
return RpcTrace._storage.run(activity, fn);
|
|
42
|
-
}
|
|
43
|
-
/** Start the processing of an RpcActivity inside an OpenTelemetry span */
|
|
44
|
-
static async runWithSpan(activity, fn) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
core_bentley_1.Logger.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
exports.initializeTracing = initializeTracing;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.initializeTracing = exports.RpcTrace = void 0;
|
|
11
|
+
// cspell:ignore calltrace
|
|
12
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
|
+
const core_common_1 = require("@itwin/core-common");
|
|
14
|
+
const async_hooks_1 = require("async_hooks");
|
|
15
|
+
const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
|
|
16
|
+
const IModelHost_1 = require("../IModelHost");
|
|
17
|
+
/* eslint-disable deprecation/deprecation */
|
|
18
|
+
/**
|
|
19
|
+
* Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this
|
|
20
|
+
* class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending
|
|
21
|
+
* of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken
|
|
22
|
+
* from the RpcActivity.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
class RpcTrace {
|
|
26
|
+
/** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no
|
|
27
|
+
* RpcActivity in the current call stack.
|
|
28
|
+
* */
|
|
29
|
+
static get currentActivity() {
|
|
30
|
+
return RpcTrace._storage.getStore();
|
|
31
|
+
}
|
|
32
|
+
/** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity
|
|
33
|
+
* exists in the current call stack.
|
|
34
|
+
* */
|
|
35
|
+
static get expectCurrentActivity() {
|
|
36
|
+
(0, core_bentley_1.assert)(undefined !== RpcTrace.currentActivity);
|
|
37
|
+
return RpcTrace.currentActivity;
|
|
38
|
+
}
|
|
39
|
+
/** Start the processing of an RpcActivity. */
|
|
40
|
+
static async run(activity, fn) {
|
|
41
|
+
return RpcTrace._storage.run(activity, fn);
|
|
42
|
+
}
|
|
43
|
+
/** Start the processing of an RpcActivity inside an OpenTelemetry span */
|
|
44
|
+
static async runWithSpan(activity, fn) {
|
|
45
|
+
return core_bentley_1.Tracing.withSpan(activity.rpcMethod ?? "unknown RPC method", async () => RpcTrace.run(activity, fn), {
|
|
46
|
+
attributes: { ...core_common_1.RpcInvocation.sanitizeForLog(activity) },
|
|
47
|
+
kind: core_bentley_1.SpanKind.SERVER,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.RpcTrace = RpcTrace;
|
|
52
|
+
RpcTrace._storage = new async_hooks_1.AsyncLocalStorage();
|
|
53
|
+
/** @internal */
|
|
54
|
+
function initializeTracing(enableOpenTelemetry = false) {
|
|
55
|
+
core_common_1.RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer
|
|
56
|
+
if (enableOpenTelemetry) {
|
|
57
|
+
try {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
59
|
+
const api = require("@opentelemetry/api");
|
|
60
|
+
const tracer = api.trace.getTracer("@itwin/core-backend", IModelHost_1.IModelHost.backendVersion);
|
|
61
|
+
core_bentley_1.Tracing.enableOpenTelemetry(tracer, api);
|
|
62
|
+
core_common_1.RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
66
|
+
core_bentley_1.Logger.logError(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, "Failed to initialize OpenTelemetry");
|
|
67
|
+
core_bentley_1.Logger.logException(BackendLoggerCategory_1.BackendLoggerCategory.IModelHost, e);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// set up static logger metadata to include current RpcActivity information for logs during rpc processing
|
|
71
|
+
core_bentley_1.Logger.staticMetaData.set("rpc", () => core_common_1.RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));
|
|
72
|
+
}
|
|
73
|
+
exports.initializeTracing = initializeTracing;
|
|
75
74
|
//# sourceMappingURL=tracing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0BAA0B;AAE1B,sDAAwE;AACxE,oDAAgE;AAChE,6CAAgD;AAChD,oEAAiE;AACjE,8CAA2C;AAE3C,4CAA4C;AAE5C;;;;;;GAMG;AACH,MAAa,QAAQ;IAGnB;;SAEK;IACE,MAAM,KAAK,eAAe;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAA6B,CAAC;IACjE,CAAC;IAED;;SAEK;IACE,MAAM,KAAK,qBAAqB;QACrC,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IAED,8CAA8C;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAI,QAAqB,EAAE,EAAoB;QACpE,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,QAAqB,EAAE,EAAoB
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/rpc/tracing.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,0BAA0B;AAE1B,sDAAwE;AACxE,oDAAgE;AAChE,6CAAgD;AAChD,oEAAiE;AACjE,8CAA2C;AAE3C,4CAA4C;AAE5C;;;;;;GAMG;AACH,MAAa,QAAQ;IAGnB;;SAEK;IACE,MAAM,KAAK,eAAe;QAC/B,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAA6B,CAAC;IACjE,CAAC;IAED;;SAEK;IACE,MAAM,KAAK,qBAAqB;QACrC,IAAA,qBAAM,EAAC,SAAS,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC,eAAe,CAAC;IAClC,CAAC;IAED,8CAA8C;IACvC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAI,QAAqB,EAAE,EAAoB;QACpE,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,0EAA0E;IACnE,MAAM,CAAC,KAAK,CAAC,WAAW,CAAI,QAAqB,EAAE,EAAoB;QAC5E,OAAO,sBAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,IAAI,oBAAoB,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE;YAC1G,UAAU,EAAE,EAAE,GAAG,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;YACzD,IAAI,EAAE,uBAAQ,CAAC,MAAM;SACtB,CAAC,CAAC;IACL,CAAC;;AA7BH,4BA8BC;AA7BgB,iBAAQ,GAAG,IAAI,+BAAiB,EAAE,CAAC;AA+BpD,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,sBAA+B,KAAK;IACpE,2BAAa,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,mDAAmD;IAE7F,IAAI,mBAAmB,EAAE;QACvB,IAAI;YACF,8DAA8D;YAC9D,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;YAC1C,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,qBAAqB,EAAE,uBAAU,CAAC,cAAc,CAAC,CAAC;YACrF,sBAAO,CAAC,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACzC,2BAAa,CAAC,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC,mEAAmE;SACtH;QAAC,OAAO,CAAC,EAAE;YACV,gEAAgE;YAChE,qBAAM,CAAC,QAAQ,CAAC,6CAAqB,CAAC,UAAU,EAAE,oCAAoC,CAAC,CAAC;YACxF,qBAAM,CAAC,YAAY,CAAC,6CAAqB,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;SAC1D;KACF;IAED,0GAA0G;IAC1G,qBAAM,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,2BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;AACjG,CAAC;AAnBD,8CAmBC","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 RpcInterface\n */\n\n// cspell:ignore calltrace\n\nimport { assert, Logger, SpanKind, Tracing } from \"@itwin/core-bentley\";\nimport { RpcActivity, RpcInvocation } from \"@itwin/core-common\";\nimport { AsyncLocalStorage } from \"async_hooks\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { IModelHost } from \"../IModelHost\";\n\n/* eslint-disable deprecation/deprecation */\n\n/**\n * Utility for tracing Rpc activity processing. When multiple Rpc requests are being processed asynchronously, this\n * class can be used to correlate the current calltrace with the originating RpcActivity. This is used for automatic appending\n * of RpcActivity to log messages emitted during Rpc processing. It may also be used to retrieve the user accessToken\n * from the RpcActivity.\n * @public\n */\nexport class RpcTrace {\n private static _storage = new AsyncLocalStorage();\n\n /** Get the [RpcActivity]($common) for the currently executing async, or `undefined` if there is no\n * RpcActivity in the current call stack.\n * */\n public static get currentActivity(): RpcActivity | undefined {\n return RpcTrace._storage.getStore() as RpcActivity | undefined;\n }\n\n /** Get the [RpcActivity]($common) for the currently executing async. Asserts that the RpcActivity\n * exists in the current call stack.\n * */\n public static get expectCurrentActivity(): RpcActivity {\n assert(undefined !== RpcTrace.currentActivity);\n return RpcTrace.currentActivity;\n }\n\n /** Start the processing of an RpcActivity. */\n public static async run<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\n return RpcTrace._storage.run(activity, fn);\n }\n\n /** Start the processing of an RpcActivity inside an OpenTelemetry span */\n public static async runWithSpan<T>(activity: RpcActivity, fn: () => Promise<T>): Promise<T> {\n return Tracing.withSpan(activity.rpcMethod ?? \"unknown RPC method\", async () => RpcTrace.run(activity, fn), {\n attributes: { ...RpcInvocation.sanitizeForLog(activity) },\n kind: SpanKind.SERVER,\n });\n }\n}\n\n/** @internal */\nexport function initializeTracing(enableOpenTelemetry: boolean = false) {\n RpcInvocation.runActivity = RpcTrace.run; // redirect the invocation processing to the tracer\n\n if (enableOpenTelemetry) {\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const api = require(\"@opentelemetry/api\");\n const tracer = api.trace.getTracer(\"@itwin/core-backend\", IModelHost.backendVersion);\n Tracing.enableOpenTelemetry(tracer, api);\n RpcInvocation.runActivity = RpcTrace.runWithSpan; // wrap invocation in an OpenTelemetry span in addition to RpcTrace\n } catch (e) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Logger.logError(BackendLoggerCategory.IModelHost, \"Failed to initialize OpenTelemetry\");\n Logger.logException(BackendLoggerCategory.IModelHost, e);\n }\n }\n\n // set up static logger metadata to include current RpcActivity information for logs during rpc processing\n Logger.staticMetaData.set(\"rpc\", () => RpcInvocation.sanitizeForLog(RpcTrace.currentActivity));\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module RpcInterface
|
|
3
|
-
*/
|
|
4
|
-
import { RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from "@itwin/core-common";
|
|
5
|
-
export declare class WebAppRpcLoggingBackend extends WebAppRpcLogging {
|
|
6
|
-
protected logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void>;
|
|
7
|
-
protected getHostname(): string;
|
|
8
|
-
private logErrorBackend;
|
|
9
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module RpcInterface
|
|
3
|
+
*/
|
|
4
|
+
import { RpcInvocation, RpcProtocolEvent, WebAppRpcLogging } from "@itwin/core-common";
|
|
5
|
+
export declare class WebAppRpcLoggingBackend extends WebAppRpcLogging {
|
|
6
|
+
protected logProtocolEvent(event: RpcProtocolEvent, object: RpcInvocation): Promise<void>;
|
|
7
|
+
protected getHostname(): string;
|
|
8
|
+
private logErrorBackend;
|
|
9
|
+
}
|
|
10
10
|
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.WebAppRpcLoggingBackend = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const core_common_1 = require("@itwin/core-common");
|
|
13
|
-
const os = require("os");
|
|
14
|
-
/* eslint-disable deprecation/deprecation */
|
|
15
|
-
class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
|
|
16
|
-
async logProtocolEvent(event, object) {
|
|
17
|
-
switch (event) {
|
|
18
|
-
case core_common_1.RpcProtocolEvent.RequestReceived: return this.logRequest(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
|
|
19
|
-
case core_common_1.RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend("RpcInterface.backend.error", object);
|
|
20
|
-
case core_common_1.RpcProtocolEvent.BackendResponseCreated: return this.logResponse(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
getHostname() {
|
|
24
|
-
return os.hostname();
|
|
25
|
-
}
|
|
26
|
-
async logErrorBackend(message, invocation) {
|
|
27
|
-
const operationDescriptor = this.buildOperationDescriptor(invocation.operation);
|
|
28
|
-
const pathIds = this.findPathIds(invocation.request.path);
|
|
29
|
-
const result = await invocation.result;
|
|
30
|
-
const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
|
|
31
|
-
core_bentley_1.Logger.logInfo(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
|
|
32
|
-
method: invocation.request.method,
|
|
33
|
-
path: invocation.request.path,
|
|
34
|
-
status: invocation.status,
|
|
35
|
-
errorMessage,
|
|
36
|
-
// Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
|
|
37
|
-
ActivityId: invocation.request.id,
|
|
38
|
-
MachineName: this.getHostname(),
|
|
39
|
-
...pathIds,
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.WebAppRpcLoggingBackend = WebAppRpcLoggingBackend;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.WebAppRpcLoggingBackend = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const core_common_1 = require("@itwin/core-common");
|
|
13
|
+
const os = require("os");
|
|
14
|
+
/* eslint-disable deprecation/deprecation */
|
|
15
|
+
class WebAppRpcLoggingBackend extends core_common_1.WebAppRpcLogging {
|
|
16
|
+
async logProtocolEvent(event, object) {
|
|
17
|
+
switch (event) {
|
|
18
|
+
case core_common_1.RpcProtocolEvent.RequestReceived: return this.logRequest(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.request", object.request);
|
|
19
|
+
case core_common_1.RpcProtocolEvent.BackendErrorOccurred: return this.logErrorBackend("RpcInterface.backend.error", object);
|
|
20
|
+
case core_common_1.RpcProtocolEvent.BackendResponseCreated: return this.logResponse(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, "RpcInterface.backend.response", object.request, object.status, object.elapsed);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
getHostname() {
|
|
24
|
+
return os.hostname();
|
|
25
|
+
}
|
|
26
|
+
async logErrorBackend(message, invocation) {
|
|
27
|
+
const operationDescriptor = this.buildOperationDescriptor(invocation.operation);
|
|
28
|
+
const pathIds = this.findPathIds(invocation.request.path);
|
|
29
|
+
const result = await invocation.result;
|
|
30
|
+
const errorMessage = result.message ? result.message : result.objects; // Can be an error or an RpcSerializedValue
|
|
31
|
+
core_bentley_1.Logger.logInfo(core_common_1.CommonLoggerCategory.RpcInterfaceBackend, `${message}.${operationDescriptor}`, () => ({
|
|
32
|
+
method: invocation.request.method,
|
|
33
|
+
path: invocation.request.path,
|
|
34
|
+
status: invocation.status,
|
|
35
|
+
errorMessage,
|
|
36
|
+
// Alert! The following properties are required by Bentley DevOps standards. Do not change their names!
|
|
37
|
+
ActivityId: invocation.request.id,
|
|
38
|
+
MachineName: this.getHostname(),
|
|
39
|
+
...pathIds,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.WebAppRpcLoggingBackend = WebAppRpcLoggingBackend;
|
|
44
44
|
//# sourceMappingURL=logging.js.map
|