@itwin/core-backend 4.5.0-dev.8 → 4.6.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -1
- package/LICENSE.md +1 -1
- package/lib/cjs/BackendHubAccess.d.ts +1 -1
- package/lib/cjs/BackendHubAccess.d.ts.map +1 -1
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +4 -3
- package/lib/cjs/CheckpointManager.d.ts.map +1 -1
- package/lib/cjs/CheckpointManager.js +37 -28
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +3 -1
- package/lib/cjs/CloudSqlite.d.ts.map +1 -1
- package/lib/cjs/CloudSqlite.js +6 -3
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/Element.d.ts +6 -0
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +7 -1
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +32 -27
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +159 -30
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelHost.d.ts +0 -2
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +1 -5
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts.map +1 -1
- package/lib/cjs/IpcHost.js +3 -0
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts.map +1 -1
- package/lib/cjs/TileStorage.js +9 -1
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/rpc/web/logging.d.ts.map +1 -1
- package/lib/cjs/rpc/web/logging.js +0 -2
- package/lib/cjs/rpc/web/logging.js.map +1 -1
- package/lib/cjs/rpc/web/response.d.ts.map +1 -1
- package/lib/cjs/rpc/web/response.js +16 -0
- package/lib/cjs/rpc/web/response.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +12 -13
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +107 -123
- package/lib/cjs/workspace/Workspace.d.ts.map +1 -1
- package/lib/cjs/workspace/Workspace.js +132 -155
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +13 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oDAc4B;AAE5B,4CAA4C;AAE5C,SAAS,iBAAiB,CAAC,QAA2B,EAAE,OAA6B,EAAE,WAAkC,EAAE,GAAuB;IAChJ,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,8BAAgB,CAAC,QAAQ,CAAC;IACrF,iJAAiJ;IACjJ,kJAAkJ;IAElJ,yFAAyF;IACzF,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,qCAAuB,CAAC,SAAS,EAAE;QACpE,gDAAgD;QAChD,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE;YACtD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,qBAAqB,EAAE;YACpE,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,oBAAoB,EAAE;YACnE,qKA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AC,SAAS,EAAE;QACrD,YAAY,GAAG,kBAAkB,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KACrD;SAAM,IAAI,aAAa,KAAK,4BAAc,CAAC,MAAM,EAAE;QAClD,YAAY,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;KAC7C;SAAM;QACL,YAAY,GAAG,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KAChD;IAED,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,CAAC;IACvD,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAE/B,IAAI,WAAW,CAAC,gBAAgB,IAAI,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE;QACnF,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;QACpC,MAAM,oBAAoB,GAAG,CAAC,YAAY,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3G,YAAY,GAAG,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;KACxD;IAED,6GAA6G;IAC7G,iCAAiC;IACjC,IAAI,YAAY,YAAY,MAAM,EAAE;QAClC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACxB;SAAM;QACL,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KACxB;AACH,CAAC;AArCD,oCAqCC","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 {\n HttpServerRequest,\n HttpServerResponse,\n ReadableFormData,\n RpcContentType,\n RpcMultipart,\n RpcProtocol,\n RpcRequestFulfillment,\n RpcRequestStatus,\n RpcResponseCacheControl,\n SerializedRpcRequest,\n WEB_RPC_CONSTANTS,\n WebAppRpcProtocol,\n WebAppRpcRequest,\n} from \"@itwin/core-common\";\n\n/* eslint-disable deprecation/deprecation */\n\nfunction configureResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, res: HttpServerResponse) {\n const success = protocol.getStatus(fulfillment.status) === RpcRequestStatus.Resolved;\n // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.\n // This will allow browsers to use stale cached responses while also revalidating with the router, allowing us to start up a backend if necessary.\n\n // RPC Caching Service uses the s-maxage header to determine the TTL for the redis cache.\n const oneHourInSeconds = 3600;\n if (success && request.caching === RpcResponseCacheControl.Immutable) {\n // If response size is > 50 MB, do not cache it.\n if (fulfillment.result.objects.length > (50 * 10 ** 7)) {\n res.set(\"Cache-Control\", \"no-store\");\n } else if (request.operation.operationName === \"generateTileContent\") {\n res.set(\"Cache-Control\", \"no-store\");\n } else if (request.operation.operationName === \"getConnectionProps\") {\n // GetConnectionprops can't be cached on the browser longer than the lifespan of the backend. The lifespan of backend may shrink too. Keep it at 1 second to be safe.\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=1, immutable`);\n } else if (request.operation.operationName === \"getTileCacheContainerUrl\") {\n // getTileCacheContainerUrl returns a SAS with an expiry of 23:59:59. We can't exceed that time when setting the max-age.\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 23}, max-age=${oneHourInSeconds * 23}, immutable`);\n } else {\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=${oneHourInSeconds * 48}, immutable`);\n }\n }\n\n if (fulfillment.retry) {\n res.set(\"Retry-After\", fulfillment.retry);\n }\n}\n\nfunction configureText(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): string {\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.TEXT);\n return (fulfillment.status === 204) ? \"\" : fulfillment.result.objects;\n}\n\nfunction configureBinary(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): Buffer {\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.BINARY);\n const data = fulfillment.result.data[0];\n return Buffer.isBuffer(data) ? data : Buffer.from(data);\n}\n\nfunction configureMultipart(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): ReadableFormData {\n const response = RpcMultipart.createStream(fulfillment.result);\n const headers = response.getHeaders();\n for (const header in headers) {\n if (headers.hasOwnProperty(header)) {\n res.set(header, headers[header]);\n }\n }\n\n return response;\n}\n\nfunction configureStream(fulfillment: RpcRequestFulfillment) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return fulfillment.result.stream!;\n}\n\n/** @internal */\nexport async function sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse) {\n const versionHeader = protocol.protocolVersionHeaderName;\n if (versionHeader && RpcProtocol.protocolVersion) {\n res.set(versionHeader, RpcProtocol.protocolVersion.toString());\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { Readable, Stream } = await import(/* webpackIgnore: true */ \"stream\");\n const { createGzip } = await import(/* webpackIgnore: true */ \"zlib\");\n\n const transportType = WebAppRpcRequest.computeTransportType(fulfillment.result, fulfillment.rawResult);\n let responseBody;\n if (transportType === RpcContentType.Binary) {\n responseBody = configureBinary(fulfillment, res);\n } else if (transportType === RpcContentType.Multipart) {\n responseBody = configureMultipart(fulfillment, res);\n } else if (transportType === RpcContentType.Stream) {\n responseBody = configureStream(fulfillment);\n } else {\n responseBody = configureText(fulfillment, res);\n }\n\n configureResponse(protocol, request, fulfillment, res);\n res.status(fulfillment.status);\n\n if (fulfillment.allowCompression && req.header(\"Accept-Encoding\")?.includes(\"gzip\")) {\n res.set(\"Content-Encoding\", \"gzip\");\n const readableResponseBody = (responseBody instanceof Stream) ? responseBody : Readable.from(responseBody);\n responseBody = readableResponseBody.pipe(createGzip());\n }\n\n // This check should in theory look for instances of Readable, but that would break backend implementation at\n // core/backend/src/RpcBackend.ts\n if (responseBody instanceof Stream) {\n responseBody.pipe(res);\n } else {\n res.send(responseBody);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../../src/rpc/web/response.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAC7C,oDAe4B;AAE5B,4CAA4C;AAE5C,SAAS,iBAAiB,CAAC,QAA2B,EAAE,OAA6B,EAAE,WAAkC,EAAE,GAAuB;IAChJ,MAAM,OAAO,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,8BAAgB,CAAC,QAAQ,CAAC;IACrF,iJAAiJ;IACjJ,kJAAkJ;IAElJ,yFAAyF;IACzF,MAAM,gBAAgB,GAAG,IAAI,CAAC;IAC9B,IAAI,OAAO,IAAI,OAAO,CAAC,OAAO,KAAK,qCAAuB,CAAC,SAAS,EAAE;QACpE,gDAAgD;QAChD,IAAI,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE;YACtD,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,qBAAqB,EAAE;YACpE,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;SACtC;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,KAAK,oBAAoB,EAAE;YACnE,qKAAqK;YACrK,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,gBAAgB,GAAG,EAAE,wBAAwB,CAAC,CAAC;SACrF;aAAM,IAAI,OAAO,CAAC,SAAS,CAAC,aAAa,K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S,CAAC,CAAC,CAAC,SAAS;KAC1D,CAAC;IAEF,IAAI,UAAU,GAAG,GAAG;QAClB,qBAAM,CAAC,OAAO,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,QAAQ,CAAC,CAAC;;QAErG,qBAAM,CAAC,QAAQ,CAAC,kCAAoB,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,QAAQ,CAAC,CAAC;AAC1G,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 RpcInterface\n */\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport {\n CommonLoggerCategory,\n HttpServerRequest,\n HttpServerResponse,\n ReadableFormData,\n RpcContentType,\n RpcMultipart,\n RpcProtocol,\n RpcRequestFulfillment,\n RpcRequestStatus,\n RpcResponseCacheControl,\n SerializedRpcRequest,\n WEB_RPC_CONSTANTS,\n WebAppRpcProtocol,\n WebAppRpcRequest,\n} from \"@itwin/core-common\";\n\n/* eslint-disable deprecation/deprecation */\n\nfunction configureResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, res: HttpServerResponse) {\n const success = protocol.getStatus(fulfillment.status) === RpcRequestStatus.Resolved;\n // TODO: Use stale-while-revalidate in cache headers. This needs to be tested, and does not currently have support in the router/caching-service.\n // This will allow browsers to use stale cached responses while also revalidating with the router, allowing us to start up a backend if necessary.\n\n // RPC Caching Service uses the s-maxage header to determine the TTL for the redis cache.\n const oneHourInSeconds = 3600;\n if (success && request.caching === RpcResponseCacheControl.Immutable) {\n // If response size is > 50 MB, do not cache it.\n if (fulfillment.result.objects.length > (50 * 10 ** 7)) {\n res.set(\"Cache-Control\", \"no-store\");\n } else if (request.operation.operationName === \"generateTileContent\") {\n res.set(\"Cache-Control\", \"no-store\");\n } else if (request.operation.operationName === \"getConnectionProps\") {\n // GetConnectionprops can't be cached on the browser longer than the lifespan of the backend. The lifespan of backend may shrink too. Keep it at 1 second to be safe.\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=1, immutable`);\n } else if (request.operation.operationName === \"getTileCacheContainerUrl\") {\n // getTileCacheContainerUrl returns a SAS with an expiry of 23:59:59. We can't exceed that time when setting the max-age.\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 23}, max-age=${oneHourInSeconds * 23}, immutable`);\n } else {\n res.set(\"Cache-Control\", `s-maxage=${oneHourInSeconds * 24}, max-age=${oneHourInSeconds * 48}, immutable`);\n }\n }\n\n if (fulfillment.retry) {\n res.set(\"Retry-After\", fulfillment.retry);\n }\n}\n\nfunction configureText(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): string {\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.TEXT);\n return (fulfillment.status === 204) ? \"\" : fulfillment.result.objects;\n}\n\nfunction configureBinary(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): Buffer {\n res.set(WEB_RPC_CONSTANTS.CONTENT, WEB_RPC_CONSTANTS.BINARY);\n const data = fulfillment.result.data[0];\n return Buffer.isBuffer(data) ? data : Buffer.from(data);\n}\n\nfunction configureMultipart(fulfillment: RpcRequestFulfillment, res: HttpServerResponse): ReadableFormData {\n const response = RpcMultipart.createStream(fulfillment.result);\n const headers = response.getHeaders();\n for (const header in headers) {\n if (headers.hasOwnProperty(header)) {\n res.set(header, headers[header]);\n }\n }\n\n return response;\n}\n\nfunction configureStream(fulfillment: RpcRequestFulfillment) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return fulfillment.result.stream!;\n}\n\n/** @internal */\nexport async function sendResponse(protocol: WebAppRpcProtocol, request: SerializedRpcRequest, fulfillment: RpcRequestFulfillment, req: HttpServerRequest, res: HttpServerResponse) {\n logResponse(request, fulfillment.status, fulfillment.rawResult);\n\n const versionHeader = protocol.protocolVersionHeaderName;\n if (versionHeader && RpcProtocol.protocolVersion) {\n res.set(versionHeader, RpcProtocol.protocolVersion.toString());\n }\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { Readable, Stream } = await import(/* webpackIgnore: true */ \"stream\");\n const { createGzip } = await import(/* webpackIgnore: true */ \"zlib\");\n\n const transportType = WebAppRpcRequest.computeTransportType(fulfillment.result, fulfillment.rawResult);\n let responseBody;\n if (transportType === RpcContentType.Binary) {\n responseBody = configureBinary(fulfillment, res);\n } else if (transportType === RpcContentType.Multipart) {\n responseBody = configureMultipart(fulfillment, res);\n } else if (transportType === RpcContentType.Stream) {\n responseBody = configureStream(fulfillment);\n } else {\n responseBody = configureText(fulfillment, res);\n }\n\n configureResponse(protocol, request, fulfillment, res);\n res.status(fulfillment.status);\n\n if (fulfillment.allowCompression && req.header(\"Accept-Encoding\")?.includes(\"gzip\")) {\n res.set(\"Content-Encoding\", \"gzip\");\n const readableResponseBody = (responseBody instanceof Stream) ? responseBody : Readable.from(responseBody);\n responseBody = readableResponseBody.pipe(createGzip());\n }\n\n // This check should in theory look for instances of Readable, but that would break backend implementation at\n // core/backend/src/RpcBackend.ts\n if (responseBody instanceof Stream) {\n responseBody.pipe(res);\n } else {\n res.send(responseBody);\n }\n}\n\nfunction logResponse(request: SerializedRpcRequest, statusCode: number, resultObj: unknown) {\n const metadata = {\n ActivityId: request.id, // eslint-disable-line @typescript-eslint/naming-convention\n method: request.method,\n path: request.path,\n operation: request.operation,\n statusCode,\n error: resultObj instanceof Error ? resultObj : undefined,\n };\n\n if (statusCode < 400)\n Logger.logInfo(CommonLoggerCategory.RpcInterfaceBackend, \"RPC over HTTP success response\", metadata);\n else\n Logger.logError(CommonLoggerCategory.RpcInterfaceBackend, \"RPC over HTTP failure response\", metadata);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcBriefcaseUtility.d.ts","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":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AAC;WAgEpG,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAC7K;;OAEG;WAEiB,eAAe,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAQ1L"}
|
|
@@ -99,7 +99,7 @@ class RpcBriefcaseUtility {
|
|
|
99
99
|
static async findOpenIModel(accessToken, iModel) {
|
|
100
100
|
const iModelDb = IModelDb_1.IModelDb.findByKey(iModel.key);
|
|
101
101
|
// call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.
|
|
102
|
-
await iModelDb.
|
|
102
|
+
await iModelDb.refreshContainerForRpc(accessToken);
|
|
103
103
|
return iModelDb;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
@@ -108,41 +108,40 @@ class RpcBriefcaseUtility {
|
|
|
108
108
|
*/
|
|
109
109
|
static async open(args) {
|
|
110
110
|
const { activity, tokenProps, syncMode } = args;
|
|
111
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "RpcBriefcaseUtility.open",
|
|
111
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "RpcBriefcaseUtility.open", tokenProps);
|
|
112
112
|
const timeout = args.timeout ?? 1000;
|
|
113
113
|
if (syncMode === core_common_1.SyncMode.PullOnly || syncMode === core_common_1.SyncMode.PullAndPush) {
|
|
114
114
|
const briefcaseDb = await core_bentley_1.BeDuration.race(timeout, this.openBriefcase(args));
|
|
115
115
|
if (briefcaseDb === undefined) {
|
|
116
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "Open briefcase - pending",
|
|
116
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Open briefcase - pending", tokenProps);
|
|
117
117
|
throw new core_common_1.RpcPendingResponse(); // eslint-disable-line deprecation/deprecation
|
|
118
118
|
}
|
|
119
119
|
// note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen
|
|
120
120
|
return briefcaseDb;
|
|
121
121
|
}
|
|
122
|
-
(
|
|
123
|
-
|
|
124
|
-
(0, core_bentley_1.assert)(undefined !== tokenProps.changeset);
|
|
122
|
+
if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)
|
|
123
|
+
throw new core_common_1.IModelError(core_bentley_1.IModelStatus.BadArg, "invalid arguments");
|
|
125
124
|
const checkpoint = {
|
|
126
125
|
iModelId: tokenProps.iModelId,
|
|
127
126
|
iTwinId: tokenProps.iTwinId,
|
|
128
127
|
changeset: tokenProps.changeset,
|
|
129
128
|
accessToken: activity.accessToken,
|
|
130
129
|
};
|
|
131
|
-
// opening a checkpoint
|
|
130
|
+
// opening a checkpoint.
|
|
132
131
|
let db;
|
|
133
132
|
// first check if it's already open
|
|
134
133
|
db = IModelDb_1.SnapshotDb.tryFindByKey(CheckpointManager_1.CheckpointManager.getKey(checkpoint));
|
|
135
134
|
if (db) {
|
|
136
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "Checkpoint was already open",
|
|
135
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Checkpoint was already open", tokenProps);
|
|
137
136
|
return db;
|
|
138
137
|
}
|
|
139
138
|
try {
|
|
140
139
|
// now try V2 checkpoint
|
|
141
|
-
db = await IModelDb_1.SnapshotDb.
|
|
142
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "using V2 checkpoint
|
|
140
|
+
db = await IModelDb_1.SnapshotDb.openCheckpointFromRpc(checkpoint);
|
|
141
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "using V2 checkpoint", tokenProps);
|
|
143
142
|
}
|
|
144
143
|
catch (e) {
|
|
145
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "unable to open V2 checkpoint - falling back to V1 checkpoint",
|
|
144
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "unable to open V2 checkpoint - falling back to V1 checkpoint", { error: core_bentley_1.BentleyError.getErrorProps(e), ...tokenProps });
|
|
146
145
|
// this isn't a v2 checkpoint. Set up a race between the specified timeout period and the open. Throw an RpcPendingResponse exception if the timeout happens first.
|
|
147
146
|
const request = {
|
|
148
147
|
checkpoint,
|
|
@@ -151,10 +150,10 @@ class RpcBriefcaseUtility {
|
|
|
151
150
|
};
|
|
152
151
|
db = await core_bentley_1.BeDuration.race(timeout, CheckpointManager_1.V1CheckpointManager.getCheckpointDb(request));
|
|
153
152
|
if (db === undefined) {
|
|
154
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "Open V1 checkpoint - pending",
|
|
153
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Open V1 checkpoint - pending", tokenProps);
|
|
155
154
|
throw new core_common_1.RpcPendingResponse(); // eslint-disable-line deprecation/deprecation
|
|
156
155
|
}
|
|
157
|
-
core_bentley_1.Logger.logTrace(loggerCategory, "Opened V1 checkpoint",
|
|
156
|
+
core_bentley_1.Logger.logTrace(loggerCategory, "Opened V1 checkpoint", tokenProps);
|
|
158
157
|
}
|
|
159
158
|
return db;
|
|
160
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0G;AAC1G,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAA+F;AAC/F,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAE3C,MAAM,cAAc,GAAW,6CAAqB,CAAC,QAAQ,CAAC;AAW9D;;;GAGG;AACH,MAAa,mBAAmB;IAEtB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAyB;QAC5D,MAAM,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AC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,mDAAmD;QACnD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA/Gc,sCAAkB,GAAsC,IAAI,GAAG,EAAE,CAAC;AA7DtE,kDAAmB","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 { AccessToken, assert, BeDuration, BentleyError, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager, CheckpointProps, V1CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity; // eslint-disable-line deprecation/deprecation\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost.hubAccess.getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined)\n return briefcaseDb as BriefcaseDb;\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainer(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & {syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async open(args: DownloadAndOpenArgs & {syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", () => ({ ...tokenProps }));\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", () => ({ ...tokenProps }));\n throw new RpcPendingResponse(); // eslint-disable-line deprecation/deprecation\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n\n assert(undefined !== tokenProps.iModelId);\n assert(undefined !== tokenProps.iTwinId);\n assert(undefined !== tokenProps.changeset);\n\n const checkpoint: CheckpointProps = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint, readonly.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", () => ({ ...tokenProps }));\n return db;\n }\n\n try {\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointV2(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint briefcase\", () => ({ ...tokenProps }));\n } catch (e) {\n Logger.logTrace(loggerCategory, \"unable to open V2 checkpoint - falling back to V1 checkpoint\", () => ({ error: BentleyError.getErrorProps(e), ...tokenProps }));\n\n // this isn't a v2 checkpoint. Set up a race between the specified timeout period and the open. Throw an RpcPendingResponse exception if the timeout happens first.\n const request = {\n checkpoint,\n localFile: V1CheckpointManager.getFileName(checkpoint),\n aliasFiles: [],\n };\n db = await BeDuration.race(timeout, V1CheckpointManager.getCheckpointDb(request));\n\n if (db === undefined) {\n Logger.logTrace(loggerCategory, \"Open V1 checkpoint - pending\", () => ({ ...tokenProps }));\n throw new RpcPendingResponse(); // eslint-disable-line deprecation/deprecation\n }\n Logger.logTrace(loggerCategory, \"Opened V1 checkpoint\", () => ({ ...tokenProps }));\n }\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> { // eslint-disable-line deprecation/deprecation\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line deprecation/deprecation\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"RpcBriefcaseUtility.js","sourceRoot":"","sources":["../../../src/rpc-impl/RpcBriefcaseUtility.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0G;AAC1G,oDAE4B;AAC5B,oEAAiE;AACjE,0DAA+E;AAC/E,4DAA8E;AAC9E,0CAAgE;AAChE,8CAA2C;AAC3C,8CAA2C;AAE3C,MAAM,cAAc,GAAW,6CAAqB,CAAC,QAAQ,CAAC;AAW9D;;;GAGG;AACH,MAAa,mBAAmB;IAEtB,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,IAAyB;QAC5D,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;QACtC,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QACzC,IAAA,qBAAM,EAAC,SAAS,KAAK,UAAU,CAAC,QAAQ,CAAC,CAAC;QAE1C,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACrC,IAAI,cAAwB,CAAC;QAC7B,IAAI,IAAI,CAAC,QAAQ,KAAK,sBAA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AE;aACf,CAAC;YACF,EAAE,GAAG,MAAM,yBAAU,CAAC,IAAI,CAAC,OAAO,EAAE,uCAAmB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;YAElF,IAAI,EAAE,KAAK,SAAS,EAAE;gBACpB,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,8BAA8B,EAAE,UAAU,CAAC,CAAC;gBAC5E,MAAM,IAAI,gCAAkB,EAAE,CAAC,CAAC,8CAA8C;aAC/E;YACD,qBAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,sBAAsB,EAAE,UAAU,CAAC,CAAC;SACrE;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAQM,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAqB,EAAE,UAA8B,EAAE,QAAkB,EAAE,UAAkB,IAAI;QACnI,IAAI,UAAU,CAAC,QAAQ;YACrB,MAAM,uBAAU,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAChE,mDAAmD;QACnD,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjF,CAAC;;AA7Gc,sCAAkB,GAAsC,IAAI,GAAG,EAAE,CAAC;AA7DtE,kDAAmB","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 { AccessToken, assert, BeDuration, BentleyError, IModelStatus, Logger } from \"@itwin/core-bentley\";\nimport {\n BriefcaseProps, IModelConnectionProps, IModelError, IModelRpcOpenProps, IModelRpcProps, IModelVersion, RpcActivity, RpcPendingResponse, SyncMode,\n} from \"@itwin/core-common\";\nimport { BackendLoggerCategory } from \"../BackendLoggerCategory\";\nimport { BriefcaseManager, RequestNewBriefcaseArg } from \"../BriefcaseManager\";\nimport { CheckpointManager, V1CheckpointManager } from \"../CheckpointManager\";\nimport { BriefcaseDb, IModelDb, SnapshotDb } from \"../IModelDb\";\nimport { IModelHost } from \"../IModelHost\";\nimport { IModelJsFs } from \"../IModelJsFs\";\n\nconst loggerCategory: string = BackendLoggerCategory.IModelDb;\n\n/** @internal */\nexport interface DownloadAndOpenArgs {\n activity: RpcActivity; // eslint-disable-line deprecation/deprecation\n tokenProps: IModelRpcOpenProps;\n syncMode: SyncMode;\n fileNameResolvers?: ((arg: BriefcaseProps) => string)[];\n timeout?: number;\n forceDownload?: boolean;\n}\n/**\n * Utility to open the iModel for RPC interfaces\n * @internal\n */\nexport class RpcBriefcaseUtility {\n\n private static async downloadAndOpen(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const { activity, tokenProps } = args;\n const accessToken = activity.accessToken;\n assert(undefined !== tokenProps.iModelId);\n\n const iModelId = tokenProps.iModelId;\n let myBriefcaseIds: number[];\n if (args.syncMode === SyncMode.PullOnly) {\n myBriefcaseIds = [0]; // PullOnly means briefcaseId 0\n } else {\n // check with iModelHub and see if we already have acquired any briefcaseIds\n myBriefcaseIds = await IModelHost.hubAccess.getMyBriefcaseIds({ accessToken, iModelId });\n }\n\n const resolvers = args.fileNameResolvers ?? [(arg) => BriefcaseManager.getFileName(arg)];\n\n // see if we can open any of the briefcaseIds we already acquired from iModelHub\n if (resolvers) {\n for (const resolver of resolvers) {\n for (const briefcaseId of myBriefcaseIds) {\n const fileName = resolver({ briefcaseId, iModelId });\n if (IModelJsFs.existsSync(fileName)) {\n const briefcaseDb = BriefcaseDb.findByFilename(fileName);\n if (briefcaseDb !== undefined)\n return briefcaseDb as BriefcaseDb;\n try {\n if (args.forceDownload)\n throw new Error(); // causes delete below\n const db = await BriefcaseDb.open({ fileName });\n if (db.changeset.id !== tokenProps.changeset?.id) {\n assert(undefined !== tokenProps.changeset);\n const toIndex = tokenProps.changeset?.index ??\n (await IModelHost.hubAccess.getChangesetFromVersion({ accessToken, iModelId, version: IModelVersion.asOfChangeSet(tokenProps.changeset.id) })).index;\n await BriefcaseManager.pullAndApplyChangesets(db, { accessToken, toIndex });\n }\n return db;\n } catch (error: any) {\n if (!(error.errorNumber === IModelStatus.AlreadyOpen))\n // somehow we have this briefcaseId and the file exists, but we can't open it. Delete it.\n await BriefcaseManager.deleteBriefcaseFiles(fileName, accessToken);\n }\n }\n }\n }\n }\n\n // no local briefcase available. Download one and open it.\n assert(undefined !== tokenProps.iTwinId);\n const request: RequestNewBriefcaseArg = {\n accessToken,\n iTwinId: tokenProps.iTwinId,\n iModelId,\n briefcaseId: args.syncMode === SyncMode.PullOnly ? 0 : undefined, // if briefcaseId is undefined, we'll acquire a new one.\n };\n\n const props = await BriefcaseManager.downloadBriefcase(request);\n return BriefcaseDb.open(props);\n }\n\n private static _briefcasePromises: Map<string, Promise<BriefcaseDb>> = new Map();\n private static async openBriefcase(args: DownloadAndOpenArgs): Promise<BriefcaseDb> {\n const key = `${args.tokenProps.iModelId}:${args.tokenProps.changeset?.id}:${args.tokenProps.changeset?.index}:${args.syncMode}`;\n const cachedPromise = this._briefcasePromises.get(key);\n if (cachedPromise)\n return cachedPromise;\n\n try {\n const briefcasePromise = this.downloadAndOpen(args); // save the fact that we're working on downloading so if we timeout, we'll reuse this request.\n this._briefcasePromises.set(key, briefcasePromise);\n return await briefcasePromise;\n } finally {\n this._briefcasePromises.delete(key); // the download and open is now done\n }\n }\n\n /** find a previously opened iModel for RPC.\n * @param accessToken necessary (only) for V2 checkpoints to refresh access token in daemon if it has expired. We use the accessToken of the current RPC request\n * to refresh the daemon, even though it will be used for all authorized users.\n * @param the IModelRpcProps to locate the opened iModel.\n */\n public static async findOpenIModel(accessToken: AccessToken, iModel: IModelRpcProps) {\n const iModelDb = IModelDb.findByKey(iModel.key);\n\n // call refreshContainer, just in case this is a V2 checkpoint whose sasToken is about to expire, or its default transaction is about to be restarted.\n await iModelDb.refreshContainerForRpc(accessToken);\n return iModelDb;\n }\n\n public static async open(args: DownloadAndOpenArgs & { syncMode: SyncMode.FixedVersion }): Promise<IModelDb>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async open(args: DownloadAndOpenArgs & { syncMode: Exclude<SyncMode, \"FixedVersion\"> }): Promise<IModelDb>;\n /**\n * Download and open a checkpoint or briefcase, ensuring the operation completes within a default timeout. If the time to open exceeds the timeout period,\n * a RpcPendingResponse exception is thrown\n */\n public static async open(args: DownloadAndOpenArgs): Promise<IModelDb> {\n const { activity, tokenProps, syncMode } = args;\n Logger.logTrace(loggerCategory, \"RpcBriefcaseUtility.open\", tokenProps);\n\n const timeout = args.timeout ?? 1000;\n if (syncMode === SyncMode.PullOnly || syncMode === SyncMode.PullAndPush) {\n const briefcaseDb = await BeDuration.race(timeout, this.openBriefcase(args));\n\n if (briefcaseDb === undefined) {\n Logger.logTrace(loggerCategory, \"Open briefcase - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line deprecation/deprecation\n }\n // note: usage is logged in the function BriefcaseManager.downloadNewBriefcaseAndOpen\n return briefcaseDb;\n }\n if (!tokenProps.iModelId || !tokenProps.iTwinId || !tokenProps.changeset)\n throw new IModelError(IModelStatus.BadArg, \"invalid arguments\");\n\n const checkpoint = {\n iModelId: tokenProps.iModelId,\n iTwinId: tokenProps.iTwinId,\n changeset: tokenProps.changeset,\n accessToken: activity.accessToken,\n };\n\n // opening a checkpoint.\n let db: SnapshotDb | void;\n // first check if it's already open\n db = SnapshotDb.tryFindByKey(CheckpointManager.getKey(checkpoint));\n if (db) {\n Logger.logTrace(loggerCategory, \"Checkpoint was already open\", tokenProps);\n return db;\n }\n\n try {\n // now try V2 checkpoint\n db = await SnapshotDb.openCheckpointFromRpc(checkpoint);\n Logger.logTrace(loggerCategory, \"using V2 checkpoint\", tokenProps);\n } catch (e) {\n Logger.logTrace(loggerCategory, \"unable to open V2 checkpoint - falling back to V1 checkpoint\", { error: BentleyError.getErrorProps(e), ...tokenProps });\n\n // this isn't a v2 checkpoint. Set up a race between the specified timeout period and the open. Throw an RpcPendingResponse exception if the timeout happens first.\n const request = {\n checkpoint,\n localFile: V1CheckpointManager.getFileName(checkpoint),\n aliasFiles: [],\n };\n db = await BeDuration.race(timeout, V1CheckpointManager.getCheckpointDb(request));\n\n if (db === undefined) {\n Logger.logTrace(loggerCategory, \"Open V1 checkpoint - pending\", tokenProps);\n throw new RpcPendingResponse(); // eslint-disable-line deprecation/deprecation\n }\n Logger.logTrace(loggerCategory, \"Opened V1 checkpoint\", tokenProps);\n }\n\n return db;\n }\n\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode.FixedVersion, timeout?: number): Promise<IModelConnectionProps>;\n /**\n * @deprecated in 4.4.0 - only `SyncMode.FixedVersion` should be used in RPC backends\n */\n // eslint-disable-next-line @typescript-eslint/unified-signatures -- these are separate to explicitly deprecate some SyncMode members.\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: Exclude<SyncMode, \"FixedVersion\">, timeout?: number): Promise<IModelConnectionProps>;\n public static async openWithTimeout(activity: RpcActivity, tokenProps: IModelRpcOpenProps, syncMode: SyncMode, timeout: number = 1000): Promise<IModelConnectionProps> { // eslint-disable-line deprecation/deprecation\n if (tokenProps.iModelId)\n await IModelHost.tileStorage?.initialize(tokenProps.iModelId);\n // eslint-disable-next-line deprecation/deprecation\n return (await this.open({ activity, tokenProps, syncMode, timeout })).toJSON();\n }\n\n}\n"]}
|
|
@@ -6,11 +6,11 @@ import { LocalDirName, LocalFileName } from "@itwin/core-common";
|
|
|
6
6
|
import { CloudSqlite } from "../CloudSqlite";
|
|
7
7
|
import { SQLiteDb } from "../SQLiteDb";
|
|
8
8
|
import { Settings, SettingsPriority } from "./Settings";
|
|
9
|
+
import type { IModelJsNative } from "@bentley/imodeljs-native";
|
|
9
10
|
/** The Settings used by Workspace api
|
|
10
11
|
* @beta
|
|
11
12
|
*/
|
|
12
13
|
export declare const WorkspaceSetting: {
|
|
13
|
-
Accounts: string;
|
|
14
14
|
Containers: string;
|
|
15
15
|
Databases: string;
|
|
16
16
|
};
|
|
@@ -40,6 +40,28 @@ export declare namespace WorkspaceContainer {
|
|
|
40
40
|
* @returns a Promise that resolves to the AccessToken for the container.
|
|
41
41
|
*/
|
|
42
42
|
type TokenFunc = (props: Props) => Promise<AccessToken>;
|
|
43
|
+
function validateDbName(dbName: WorkspaceDb.DbName): void;
|
|
44
|
+
/**
|
|
45
|
+
* Validate that a WorkspaceContainer.Id is valid.
|
|
46
|
+
* The rules for ContainerIds (from Azure, see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata):
|
|
47
|
+
* - may only contain lower case letters, numbers or dashes
|
|
48
|
+
* - may not start or end with with a dash nor have more than one dash in a row
|
|
49
|
+
* - may not be shorter than 3 or longer than 63 characters
|
|
50
|
+
*/
|
|
51
|
+
function validateContainerId(id: WorkspaceContainer.Id): void;
|
|
52
|
+
/** @internal */
|
|
53
|
+
function validateVersion(version?: WorkspaceDb.Version): string;
|
|
54
|
+
/**
|
|
55
|
+
* Parse the name stored in a WorkspaceContainer into the dbName and version number. A single WorkspaceContainer may hold
|
|
56
|
+
* many versions of the same WorkspaceDb. The name of the Db in the WorkspaceContainer is in the format "name:version". This
|
|
57
|
+
* function splits them into separate strings.
|
|
58
|
+
*/
|
|
59
|
+
function parseDbFileName(dbFileName: WorkspaceDb.DbFullName): {
|
|
60
|
+
dbName: WorkspaceDb.DbName;
|
|
61
|
+
version: WorkspaceDb.Version;
|
|
62
|
+
};
|
|
63
|
+
/** Create a dbName for a WorkspaceDb from its base name and version. This will be in the format "name:version" */
|
|
64
|
+
function makeDbFileName(dbName: WorkspaceDb.DbName, version?: WorkspaceDb.Version): WorkspaceDb.DbName;
|
|
43
65
|
}
|
|
44
66
|
/** @beta */
|
|
45
67
|
export declare namespace WorkspaceDb {
|
|
@@ -64,6 +86,12 @@ export declare namespace WorkspaceDb {
|
|
|
64
86
|
* @see semver.ReleaseType
|
|
65
87
|
*/
|
|
66
88
|
type VersionIncrement = "major" | "minor" | "patch";
|
|
89
|
+
/** file extension for local WorkspaceDbs
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
const fileExt = "itwin-workspace";
|
|
93
|
+
/** construct a new instance of a WorkspaceDb */
|
|
94
|
+
function construct(props: WorkspaceDb.Props, container: WorkspaceContainer): WorkspaceDb;
|
|
67
95
|
}
|
|
68
96
|
/** Types used to identify Workspace resources
|
|
69
97
|
* @beta
|
|
@@ -99,11 +127,18 @@ export interface WorkspaceDb {
|
|
|
99
127
|
readonly onClose: BeEvent<() => void>;
|
|
100
128
|
/** Name by which a WorkspaceDb may be opened. This will be either a local file name or the name of a database in a cloud container */
|
|
101
129
|
readonly dbFileName: string;
|
|
130
|
+
/** the SQLiteDb for this WorkspaceDb*/
|
|
131
|
+
readonly sqliteDb: SQLiteDb;
|
|
132
|
+
open(): void;
|
|
133
|
+
close(): void;
|
|
102
134
|
/** Get a string resource from this WorkspaceDb, if present. */
|
|
103
135
|
getString(rscName: WorkspaceResource.Name): string | undefined;
|
|
104
136
|
/** Get a blob resource from this WorkspaceDb, if present. */
|
|
105
137
|
getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
|
|
106
|
-
/**
|
|
138
|
+
/** Get a BlobIO reader for a blob WorkspaceResource.
|
|
139
|
+
* @note when finished, caller *must* call `close` on the BlobIO.
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
107
142
|
getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
|
|
108
143
|
/**
|
|
109
144
|
* Extract a local copy of a file resource from this WorkspaceDb, if present.
|
|
@@ -128,7 +163,12 @@ export interface WorkspaceDb {
|
|
|
128
163
|
* @returns a `CloudSqlite.CloudPrefetch` object that can be used to await and/or cancel the prefetch.
|
|
129
164
|
* @throws if this WorkspaceDb is not from a `CloudContainer`.
|
|
130
165
|
*/
|
|
131
|
-
prefetch(): CloudSqlite.CloudPrefetch;
|
|
166
|
+
prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;
|
|
167
|
+
/** @internal */
|
|
168
|
+
queryFileResource(rscName: WorkspaceResource.Name): {
|
|
169
|
+
localFileName: LocalFileName;
|
|
170
|
+
info: IModelJsNative.EmbedFileQuery;
|
|
171
|
+
} | undefined;
|
|
132
172
|
}
|
|
133
173
|
/** The properties of the CloudCache used for Workspaces.
|
|
134
174
|
* @beta
|
|
@@ -197,10 +237,18 @@ export interface Workspace {
|
|
|
197
237
|
/** Close this Workspace. All WorkspaceContainers are dropped. */
|
|
198
238
|
close(): void;
|
|
199
239
|
}
|
|
240
|
+
/** @beta */
|
|
241
|
+
export declare namespace Workspace {
|
|
242
|
+
/** @internal */
|
|
243
|
+
function construct(settings: Settings, opts?: WorkspaceOpts): Workspace;
|
|
244
|
+
}
|
|
200
245
|
/**
|
|
201
|
-
* A WorkspaceContainer holds WorkspaceDbs.
|
|
202
|
-
*
|
|
203
|
-
*
|
|
246
|
+
* A WorkspaceContainer is a type of `CloudSqlite.CloudContainer` that holds WorkspaceDbs. Normally a WorkspaceContainer will hold (many versions of) a single WorkspaceDb.
|
|
247
|
+
* Each version of a WorkspaceDb is treated as immutable after it is created and is stored in the WorkspaceContainer indefinitely. That means that
|
|
248
|
+
* older versions of the WorkspaceDb may continue to be used, for example by archived projects. For programmers familiar with [NPM](https://www.npmjs.com/), this is conceptually
|
|
249
|
+
* similar and versioning follows the same rules as NPM using [Semantic Versioning](https://semver.org/).
|
|
250
|
+
* @note It is possible to store more than one WorkspaceDb in the same WorkspaceContainer, but access rights are administered per WorkspaceContainer.
|
|
251
|
+
* That is, if a user has rights to access a WorkspaceContainer, that right applies to all WorkspaceDbs in the WorkspaceContainer.
|
|
204
252
|
* @beta
|
|
205
253
|
*/
|
|
206
254
|
export interface WorkspaceContainer {
|
|
@@ -210,137 +258,43 @@ export interface WorkspaceContainer {
|
|
|
210
258
|
readonly id: WorkspaceContainer.Id;
|
|
211
259
|
/** Workspace holding this WorkspaceContainer. */
|
|
212
260
|
readonly workspace: Workspace;
|
|
213
|
-
/** CloudContainer for this WorkspaceContainer (`undefined` if this is a local WorkspaceContainer.)
|
|
214
|
-
* @internal
|
|
215
|
-
*/
|
|
261
|
+
/** CloudContainer for this WorkspaceContainer (`undefined` if this is a local WorkspaceContainer.) */
|
|
216
262
|
readonly cloudContainer?: CloudSqlite.CloudContainer;
|
|
217
263
|
/** @internal */
|
|
218
|
-
addWorkspaceDb(toAdd:
|
|
219
|
-
/**
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/** Close and remove a currently opened [[WorkspaceDb]] from this Workspace. */
|
|
224
|
-
dropWorkspaceDb(container: WorkspaceDb): void;
|
|
225
|
-
/** Close this WorkspaceContainer. All currently opened WorkspaceDbs are dropped. */
|
|
226
|
-
close(): void;
|
|
227
|
-
}
|
|
228
|
-
/** @internal */
|
|
229
|
-
export declare class ITwinWorkspace implements Workspace {
|
|
230
|
-
private _containers;
|
|
231
|
-
readonly containerDir: LocalDirName;
|
|
232
|
-
readonly settings: Settings;
|
|
233
|
-
private _cloudCache?;
|
|
234
|
-
getCloudCache(): CloudSqlite.CloudCache;
|
|
235
|
-
constructor(settings: Settings, opts?: WorkspaceOpts);
|
|
236
|
-
addContainer(toAdd: ITwinWorkspaceContainer): void;
|
|
237
|
-
findContainer(containerId: WorkspaceContainer.Id): ITwinWorkspaceContainer | undefined;
|
|
238
|
-
getContainer(props: WorkspaceContainer.Props): WorkspaceContainer;
|
|
239
|
-
getWorkspaceDbFromProps(dbProps: WorkspaceDb.Props, containerProps: WorkspaceContainer.Props): WorkspaceDb;
|
|
240
|
-
getWorkspaceDb(dbAlias: string): Promise<WorkspaceDb>;
|
|
241
|
-
loadSettingsDictionary(settingRsc: WorkspaceResource.Name, db: WorkspaceDb, priority: SettingsPriority): void;
|
|
242
|
-
close(): void;
|
|
243
|
-
resolveContainer(containerName: string): WorkspaceContainer.Props;
|
|
244
|
-
resolveDatabase(databaseName: string): WorkspaceDb.Props & WorkspaceContainer.Alias;
|
|
245
|
-
}
|
|
246
|
-
/** @internal */
|
|
247
|
-
export declare class ITwinWorkspaceContainer implements WorkspaceContainer {
|
|
248
|
-
readonly workspace: ITwinWorkspace;
|
|
249
|
-
readonly filesDir: LocalDirName;
|
|
250
|
-
readonly id: WorkspaceContainer.Id;
|
|
251
|
-
readonly cloudContainer?: CloudSqlite.CloudContainer | undefined;
|
|
252
|
-
private _wsDbs;
|
|
253
|
-
get dirName(): string;
|
|
254
|
-
static noLeadingOrTrailingSpaces(name: string, msg: string): void;
|
|
255
|
-
/** rules for ContainerIds (from Azure, see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata)
|
|
256
|
-
* - may only contain lower case letters, numbers or dashes
|
|
257
|
-
* - may not start or end with with a dash nor have more than one dash in a row
|
|
258
|
-
* - may not be shorter than 3 or longer than 63 characters
|
|
264
|
+
addWorkspaceDb(toAdd: WorkspaceDbImpl): void;
|
|
265
|
+
/**
|
|
266
|
+
* Find the appropriate version of a WorkspaceDb in this WorkspaceContainer based on the SemVer rule
|
|
267
|
+
* in the `WorkspaceDb.Props`.
|
|
268
|
+
* If no version satisfying the WorkspaceDb.Props rules exists, throws an exception.
|
|
259
269
|
*/
|
|
260
|
-
|
|
261
|
-
static validateDbName(dbName: WorkspaceDb.DbName): void;
|
|
262
|
-
constructor(workspace: ITwinWorkspace, props: WorkspaceContainer.Props);
|
|
263
|
-
static validateVersion(version?: WorkspaceDb.Version): string;
|
|
264
|
-
static parseDbFileName(dbFileName: WorkspaceDb.DbFullName): {
|
|
265
|
-
dbName: WorkspaceDb.DbName;
|
|
266
|
-
version: WorkspaceDb.Version;
|
|
267
|
-
};
|
|
268
|
-
static makeDbFileName(dbName: WorkspaceDb.DbName, version?: WorkspaceDb.Version): WorkspaceDb.DbName;
|
|
269
|
-
static resolveCloudFileName(cloudContainer: CloudSqlite.CloudContainer, props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
|
|
270
|
+
resolveDbFileName(props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
|
|
270
271
|
/**
|
|
271
|
-
* Create a copy of an existing [[WorkspaceDb]] in
|
|
272
|
-
*
|
|
272
|
+
* Create a copy of an existing [[WorkspaceDb]] in this WorkspaceContainer with a new version number. This function is used
|
|
273
|
+
* by administrator tools that modify Workspaces. This requires that the write lock on the container be held. The copy should be modified with
|
|
274
|
+
* new content before the write lock is released, and thereafter should never be modified again.
|
|
273
275
|
* @param fromProps Properties that describe the source WorkspaceDb for the new version
|
|
274
276
|
* @param versionType The type of version increment to apply to the existing version.
|
|
275
|
-
* @note
|
|
276
|
-
* new content before the write lock is released, and thereafter should never be modified again.
|
|
277
|
+
* @note The copy actually shares all of the data with the original, but with copy-on-write if/when data in the new WorkspaceDb is modified.
|
|
277
278
|
*/
|
|
278
|
-
|
|
279
|
-
oldName:
|
|
280
|
-
newName:
|
|
279
|
+
makeNewVersion(fromProps: WorkspaceDb.Props, versionType: WorkspaceDb.VersionIncrement): Promise<{
|
|
280
|
+
oldName: WorkspaceDb.DbName;
|
|
281
|
+
newName: WorkspaceDb.DbName;
|
|
281
282
|
}>;
|
|
282
|
-
/**
|
|
283
|
-
* Convert a WorkspaceDb.Props specification into a DbFileName. For cloud-based containers, this resolves to the dbName, incorporating the appropriate
|
|
284
|
-
* version. For file-based containers, this returns a local filename of a WorkspaceDb file with the extension ".itwin-workspace"
|
|
285
|
-
*/
|
|
286
|
-
resolveDbFileName(props: WorkspaceDb.Props): WorkspaceDb.DbFullName;
|
|
287
|
-
addWorkspaceDb(toAdd: ITwinWorkspaceDb): void;
|
|
283
|
+
/** find or open a WorkspaceDb from this WorkspaceContainer. */
|
|
288
284
|
getWorkspaceDb(props: WorkspaceDb.Props): WorkspaceDb;
|
|
289
|
-
|
|
285
|
+
/** Close and remove a currently opened [[WorkspaceDb]] from this Workspace. */
|
|
286
|
+
closeWorkspaceDb(container: WorkspaceDb): void;
|
|
287
|
+
/** Close this WorkspaceContainer. All currently opened WorkspaceDbs are dropped. */
|
|
290
288
|
close(): void;
|
|
291
|
-
/** Delete all local files extracted by [[WorkspaceDb.getFile]] for this container. */
|
|
292
|
-
purgeContainerFiles(): void;
|
|
293
289
|
}
|
|
294
290
|
/**
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
/** file extension for local WorkspaceDbs */
|
|
300
|
-
static readonly fileExt = "itwin-workspace";
|
|
301
|
-
/** the SQLiteDb for this WorkspaceDb*/
|
|
302
|
-
readonly sqliteDb: SQLiteDb;
|
|
303
|
-
/** the base WorkspaceDb name, without directory, extension, or version information. */
|
|
304
|
-
readonly dbName: WorkspaceDb.DbName;
|
|
305
|
-
/** The WorkspaceContainer holding this WorkspaceDb */
|
|
306
|
-
readonly container: WorkspaceContainer;
|
|
307
|
-
/** called before db is closed */
|
|
308
|
-
readonly onClose: BeEvent<() => void>;
|
|
309
|
-
/** either a local file name or the name of the file in a cloud container, including version identifier */
|
|
310
|
-
dbFileName: string;
|
|
311
|
-
/** true if this WorkspaceDb is currently open */
|
|
312
|
-
get isOpen(): boolean;
|
|
313
|
-
queryFileResource(rscName: WorkspaceResource.Name): {
|
|
314
|
-
localFileName: string;
|
|
315
|
-
info: import("@bentley/imodeljs-native").IModelJsNative.EmbedFileQuery;
|
|
316
|
-
} | undefined;
|
|
317
|
-
constructor(props: WorkspaceDb.Props, container: WorkspaceContainer);
|
|
318
|
-
open(): void;
|
|
319
|
-
close(): void;
|
|
320
|
-
getString(rscName: WorkspaceResource.Name): string | undefined;
|
|
321
|
-
/** Get a BlobIO reader for a blob WorkspaceResource.
|
|
322
|
-
* @note when finished, caller *must* call `close` on the BlobIO.
|
|
323
|
-
*/
|
|
324
|
-
getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
|
|
325
|
-
getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
|
|
326
|
-
getFile(rscName: WorkspaceResource.Name, targetFileName?: LocalFileName): LocalFileName | undefined;
|
|
327
|
-
prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* An editable [[WorkspaceDb]]. This is used by administrators for creating and modifying `WorkspaceDb`s.
|
|
331
|
-
* For cloud-backed containers, the write token must be obtained before this class may be used. Only one user at at time
|
|
332
|
-
* may be editing.
|
|
333
|
-
* @internal
|
|
291
|
+
* An editable [[WorkspaceDb]]. This is used only by tools to allow administrators to create and modify `WorkspaceDb`s.
|
|
292
|
+
* For CloudSqlite Workspaces, the write token must be obtained before the methods in this interface may be used. Normally
|
|
293
|
+
* only admins will have write access to Workspaces. Only one admin at at time may be editing a Workspace.
|
|
294
|
+
* @beta
|
|
334
295
|
*/
|
|
335
|
-
export
|
|
336
|
-
private static validateResourceName;
|
|
337
|
-
private validateResourceSize;
|
|
338
|
-
open(): void;
|
|
339
|
-
private getFileModifiedTime;
|
|
340
|
-
private performWriteSql;
|
|
296
|
+
export interface EditableWorkspaceDb extends WorkspaceDb {
|
|
341
297
|
createDb(version?: string): Promise<void>;
|
|
342
|
-
/** Create a new, empty, EditableWorkspaceDb for importing Workspace resources. */
|
|
343
|
-
static createEmpty(fileName: LocalFileName): void;
|
|
344
298
|
/** Add a new string resource to this WorkspaceDb.
|
|
345
299
|
* @param rscName The name of the string resource.
|
|
346
300
|
* @param val The string to save.
|
|
@@ -386,4 +340,34 @@ export declare class EditableWorkspaceDb extends ITwinWorkspaceDb {
|
|
|
386
340
|
/** Remove a file resource. */
|
|
387
341
|
removeFile(rscName: WorkspaceResource.Name): void;
|
|
388
342
|
}
|
|
343
|
+
/** @beta */
|
|
344
|
+
export declare namespace EditableWorkspaceDb {
|
|
345
|
+
/** construct a new instance of an EditableWorkspaceDb */
|
|
346
|
+
function construct(props: WorkspaceDb.Props, container: WorkspaceContainer): EditableWorkspaceDb;
|
|
347
|
+
/** Create a new, empty, EditableWorkspaceDb file on the local filesystem for importing Workspace resources. */
|
|
348
|
+
function createEmpty(fileName: LocalFileName): void;
|
|
349
|
+
}
|
|
350
|
+
/** Implementation of WorkspaceDb */
|
|
351
|
+
declare class WorkspaceDbImpl implements WorkspaceDb {
|
|
352
|
+
readonly sqliteDb: SQLiteDb;
|
|
353
|
+
readonly dbName: WorkspaceDb.DbName;
|
|
354
|
+
readonly container: WorkspaceContainer;
|
|
355
|
+
readonly onClose: BeEvent<() => void>;
|
|
356
|
+
dbFileName: string;
|
|
357
|
+
/** true if this WorkspaceDb is currently open */
|
|
358
|
+
get isOpen(): boolean;
|
|
359
|
+
queryFileResource(rscName: WorkspaceResource.Name): {
|
|
360
|
+
localFileName: LocalFileName;
|
|
361
|
+
info: IModelJsNative.EmbedFileQuery;
|
|
362
|
+
} | undefined;
|
|
363
|
+
constructor(props: WorkspaceDb.Props, container: WorkspaceContainer);
|
|
364
|
+
open(): void;
|
|
365
|
+
close(): void;
|
|
366
|
+
getString(rscName: WorkspaceResource.Name): string | undefined;
|
|
367
|
+
getBlobReader(rscName: WorkspaceResource.Name): SQLiteDb.BlobIO;
|
|
368
|
+
getBlob(rscName: WorkspaceResource.Name): Uint8Array | undefined;
|
|
369
|
+
getFile(rscName: WorkspaceResource.Name, targetFileName?: LocalFileName): LocalFileName | undefined;
|
|
370
|
+
prefetch(opts?: CloudSqlite.PrefetchProps): CloudSqlite.CloudPrefetch;
|
|
371
|
+
}
|
|
372
|
+
export {};
|
|
389
373
|
//# sourceMappingURL=Workspace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Workspace.d.ts","sourceRoot":"","sources":["../../../src/workspace/Workspace.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAE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