@fluidframework/driver-utils 2.81.0 → 2.82.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 +4 -0
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +4 -4
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/index.d.ts +1 -1
- package/dist/adapters/compression/index.d.ts.map +1 -1
- package/dist/adapters/compression/index.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +15 -11
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +3 -3
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +4 -1
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/blob.d.ts +2 -1
- package/dist/blob.d.ts.map +1 -1
- package/dist/blob.js +3 -1
- package/dist/blob.js.map +1 -1
- package/dist/buildSnapshotTree.d.ts +1 -1
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/buildSnapshotTree.js.map +1 -1
- package/dist/cacheUtils.js +1 -1
- package/dist/cacheUtils.js.map +1 -1
- package/dist/documentServiceFactoryProxy.d.ts +3 -3
- package/dist/documentServiceFactoryProxy.d.ts.map +1 -1
- package/dist/documentServiceFactoryProxy.js.map +1 -1
- package/dist/documentServiceProxy.d.ts +3 -3
- package/dist/documentServiceProxy.d.ts.map +1 -1
- package/dist/documentServiceProxy.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +2 -2
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +3 -1
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/error.d.ts +2 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +2 -2
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +4 -4
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/messageRecognition.d.ts +3 -1
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +2 -0
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +10 -6
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +18 -3
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +4 -3
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +6 -0
- package/dist/networkUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +8 -4
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +24 -21
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +8 -10
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/protocol/gitHelper.d.ts +1 -1
- package/dist/protocol/gitHelper.d.ts.map +1 -1
- package/dist/protocol/gitHelper.js +12 -6
- package/dist/protocol/gitHelper.js.map +1 -1
- package/dist/readAndParse.d.ts +1 -1
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/readAndParse.js.map +1 -1
- package/dist/runWithRetry.d.ts +4 -2
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/runWithRetry.js +14 -11
- package/dist/runWithRetry.js.map +1 -1
- package/dist/storageUtils.d.ts +1 -1
- package/dist/storageUtils.d.ts.map +1 -1
- package/dist/storageUtils.js.map +1 -1
- package/dist/summaryForCreateNew.d.ts +2 -2
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/summaryForCreateNew.js.map +1 -1
- package/dist/treeConversions.d.ts +2 -2
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +3 -1
- package/dist/treeConversions.js.map +1 -1
- package/eslint.config.mts +2 -2
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts +2 -2
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +4 -4
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/lib/adapters/compression/index.d.ts +1 -1
- package/lib/adapters/compression/index.d.ts.map +1 -1
- package/lib/adapters/compression/index.js.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +15 -11
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/lib/adapters/index.d.ts +1 -1
- package/lib/adapters/index.d.ts.map +1 -1
- package/lib/adapters/index.js.map +1 -1
- package/lib/adapters/predefinedAdapters.d.ts +3 -3
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -1
- package/lib/adapters/predefinedAdapters.js +4 -1
- package/lib/adapters/predefinedAdapters.js.map +1 -1
- package/lib/blob.d.ts +2 -1
- package/lib/blob.d.ts.map +1 -1
- package/lib/blob.js +4 -2
- package/lib/blob.js.map +1 -1
- package/lib/buildSnapshotTree.d.ts +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -1
- package/lib/buildSnapshotTree.js.map +1 -1
- package/lib/cacheUtils.js +1 -1
- package/lib/cacheUtils.js.map +1 -1
- package/lib/documentServiceFactoryProxy.d.ts +3 -3
- package/lib/documentServiceFactoryProxy.d.ts.map +1 -1
- package/lib/documentServiceFactoryProxy.js.map +1 -1
- package/lib/documentServiceProxy.d.ts +3 -3
- package/lib/documentServiceProxy.d.ts.map +1 -1
- package/lib/documentServiceProxy.js.map +1 -1
- package/lib/documentStorageServiceProxy.d.ts +2 -2
- package/lib/documentStorageServiceProxy.d.ts.map +1 -1
- package/lib/documentStorageServiceProxy.js +3 -1
- package/lib/documentStorageServiceProxy.js.map +1 -1
- package/lib/error.d.ts +2 -2
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/insecureUrlResolver.d.ts +2 -2
- package/lib/insecureUrlResolver.d.ts.map +1 -1
- package/lib/insecureUrlResolver.js +4 -4
- package/lib/insecureUrlResolver.js.map +1 -1
- package/lib/messageRecognition.d.ts +3 -1
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +2 -0
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +10 -6
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js +18 -3
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +4 -3
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +6 -0
- package/lib/networkUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/parallelRequests.d.ts +8 -4
- package/lib/parallelRequests.d.ts.map +1 -1
- package/lib/parallelRequests.js +24 -21
- package/lib/parallelRequests.js.map +1 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -1
- package/lib/prefetchDocumentStorageService.js +8 -10
- package/lib/prefetchDocumentStorageService.js.map +1 -1
- package/lib/protocol/gitHelper.d.ts +1 -1
- package/lib/protocol/gitHelper.d.ts.map +1 -1
- package/lib/protocol/gitHelper.js +12 -6
- package/lib/protocol/gitHelper.js.map +1 -1
- package/lib/readAndParse.d.ts +1 -1
- package/lib/readAndParse.d.ts.map +1 -1
- package/lib/readAndParse.js.map +1 -1
- package/lib/runWithRetry.d.ts +4 -2
- package/lib/runWithRetry.d.ts.map +1 -1
- package/lib/runWithRetry.js +15 -12
- package/lib/runWithRetry.js.map +1 -1
- package/lib/storageUtils.d.ts +1 -1
- package/lib/storageUtils.d.ts.map +1 -1
- package/lib/storageUtils.js.map +1 -1
- package/lib/summaryForCreateNew.d.ts +2 -2
- package/lib/summaryForCreateNew.d.ts.map +1 -1
- package/lib/summaryForCreateNew.js +1 -1
- package/lib/summaryForCreateNew.js.map +1 -1
- package/lib/treeConversions.d.ts +2 -2
- package/lib/treeConversions.d.ts.map +1 -1
- package/lib/treeConversions.js +3 -1
- package/lib/treeConversions.js.map +1 -1
- package/package.json +11 -10
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +2 -2
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +4 -4
- package/src/adapters/compression/index.ts +1 -1
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +25 -21
- package/src/adapters/index.ts +1 -1
- package/src/adapters/predefinedAdapters.ts +7 -4
- package/src/blob.ts +3 -7
- package/src/buildSnapshotTree.ts +6 -6
- package/src/cacheUtils.ts +1 -1
- package/src/documentServiceFactoryProxy.ts +3 -3
- package/src/documentServiceProxy.ts +3 -3
- package/src/documentStorageServiceProxy.ts +4 -2
- package/src/error.ts +2 -2
- package/src/index.ts +4 -4
- package/src/insecureUrlResolver.ts +7 -7
- package/src/messageRecognition.ts +4 -2
- package/src/network.ts +26 -12
- package/src/networkUtils.ts +12 -4
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +33 -30
- package/src/prefetchDocumentStorageService.ts +10 -10
- package/src/protocol/gitHelper.ts +15 -9
- package/src/readAndParse.ts +1 -1
- package/src/runWithRetry.ts +20 -14
- package/src/storageUtils.ts +1 -1
- package/src/summaryForCreateNew.ts +5 -1
- package/src/treeConversions.ts +5 -3
- package/biome.jsonc +0 -4
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
|
-
import { IClient } from "@fluidframework/driver-definitions";
|
|
7
|
-
import { IDocumentDeltaConnection, IDocumentDeltaStorageService, IDocumentService, IDocumentServiceEvents, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import type { IClient } from "@fluidframework/driver-definitions";
|
|
7
|
+
import type { IDocumentDeltaConnection, IDocumentDeltaStorageService, IDocumentService, IDocumentServiceEvents, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
8
8
|
/**
|
|
9
9
|
* This abstract class implements IDocumentService interface. It uses delegation pattern.
|
|
10
10
|
* It delegates all calls to IDocumentService implementation passed to constructor.
|
|
@@ -16,7 +16,7 @@ export declare abstract class DocumentServiceProxy extends TypedEventEmitter<IDo
|
|
|
16
16
|
connectToStorage(): Promise<IDocumentStorageService>;
|
|
17
17
|
connectToDeltaStorage(): Promise<IDocumentDeltaStorageService>;
|
|
18
18
|
connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection>;
|
|
19
|
-
dispose(error?:
|
|
19
|
+
dispose(error?: unknown): void;
|
|
20
20
|
get resolvedUrl(): IResolvedUrl;
|
|
21
21
|
}
|
|
22
22
|
//# sourceMappingURL=documentServiceProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"documentServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EACX,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,MAAM,6CAA6C,CAAC;AAErD;;;GAGG;AAEH,8BAAsB,oBACrB,SAAQ,iBAAiB,CAAC,sBAAsB,CAChD,YAAW,gBAAgB;IAEf,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,gBAAgB;IAIvD,IAAW,OAAO,IAAI,gBAAgB,CAErC;IAEY,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIpD,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAI9D,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI9E,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAIrC,IAAW,WAAW,IAAI,YAAY,CAErC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentServiceProxy.js","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAWjE;;;GAGG;AAEH,MAAsB,oBACrB,SAAQ,gCAAyC;IAGjD,YAA6B,QAA0B;QACtD,KAAK,EAAE,CAAC;QADoB,aAAQ,GAAR,QAAQ,CAAkB;IAEvD,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAEM,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"documentServiceProxy.js","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAWjE;;;GAGG;AAEH,MAAsB,oBACrB,SAAQ,gCAAyC;IAGjD,YAA6B,QAA0B;QACtD,KAAK,EAAE,CAAC;QADoB,aAAQ,GAAR,QAAQ,CAAkB;IAEvD,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAEM,OAAO,CAAC,KAAe;QAC7B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IAClC,CAAC;CACD;AA/BD,oDA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * This abstract class implements IDocumentService interface. It uses delegation pattern.\n * It delegates all calls to IDocumentService implementation passed to constructor.\n */\n\nexport abstract class DocumentServiceProxy\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor(private readonly _service: IDocumentService) {\n\t\tsuper();\n\t}\n\n\tpublic get service(): IDocumentService {\n\t\treturn this._service;\n\t}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this._service.connectToStorage();\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn this._service.connectToDeltaStorage();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\treturn this._service.connectToDeltaStream(client);\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\tthis._service.dispose(error);\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this._service.resolvedUrl;\n\t}\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISnapshot, ISnapshotFetchOptions, ISummaryContext, ICreateBlobResponse, ISnapshotTree, IVersion } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
|
|
6
|
+
import type { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISnapshot, ISnapshotFetchOptions, ISummaryContext, ICreateBlobResponse, ISnapshotTree, IVersion } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,KAAK,EACX,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,MAAM,6CAA6C,CAAC;AAGrD;;GAEG;AACH,qBAAa,2BAA4B,YAAW,uBAAuB;IAW9D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB;IAV9E,OAAO,CAAC,SAAS,CAA8C;IAE/D,IAAW,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,GAAG,SAAS,EAExE;IAED,IAAW,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEjE;gBAE8B,sBAAsB,EAAE,uBAAuB;IAEjE,eAAe,CAC3B,OAAO,CAAC,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GAEnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAInB,WAAW,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAS7E,WAAW,CAEvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAST,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAIL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI/D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAG/D"}
|
|
@@ -28,7 +28,9 @@ class DocumentStorageServiceProxy {
|
|
|
28
28
|
}
|
|
29
29
|
throw new internal_1.UsageError("getSnapshot api should exist on internal storage in documentStorageServiceProxy class");
|
|
30
30
|
}
|
|
31
|
-
async getVersions(
|
|
31
|
+
async getVersions(
|
|
32
|
+
// eslint-disable-next-line @rushstack/no-new-null
|
|
33
|
+
versionId, count, scenarioName, fetchSource) {
|
|
32
34
|
return this.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource);
|
|
33
35
|
}
|
|
34
36
|
async uploadSummaryWithContext(summary, context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAcH,uEAAsE;AAEtE;;GAEG;A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ACb,YAAqB,EACrB,WAAyB;QAEzB,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAC7C,SAAS,EACT,KAAK,EACL,YAAY,EACZ,WAAW,CACX,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACpC,OAAqB,EACrB,OAAwB;QAExB,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAc;QACnC,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACD;AA/DD,kEA+DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISummaryHandle, ISummaryTree } from \"@fluidframework/driver-definitions\";\nimport type {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tIVersion,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * @internal\n */\nexport class DocumentStorageServiceProxy implements IDocumentStorageService {\n\tprivate _policies: IDocumentStorageServicePolicies | undefined;\n\n\tpublic set policies(policies: IDocumentStorageServicePolicies | undefined) {\n\t\tthis._policies = policies;\n\t}\n\n\tpublic get policies(): IDocumentStorageServicePolicies | undefined {\n\t\treturn this._policies ?? this.internalStorageService.policies;\n\t}\n\n\tconstructor(protected readonly internalStorageService: IDocumentStorageService) {}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this.internalStorageService.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tif (this.internalStorageService.getSnapshot !== undefined) {\n\t\t\treturn this.internalStorageService.getSnapshot(snapshotFetchOptions);\n\t\t}\n\t\tthrow new UsageError(\n\t\t\t\"getSnapshot api should exist on internal storage in documentStorageServiceProxy class\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.internalStorageService.getVersions(\n\t\t\tversionId,\n\t\t\tcount,\n\t\t\tscenarioName,\n\t\t\tfetchSource,\n\t\t);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this.internalStorageService.uploadSummaryWithContext(summary, context);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.internalStorageService.downloadSummary(handle);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.internalStorageService.createBlob(file);\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.internalStorageService.readBlob(blobId);\n\t}\n}\n"]}
|
package/dist/error.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IDriverErrorBase } from "@fluidframework/driver-definitions/internal";
|
|
6
|
-
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils/internal";
|
|
5
|
+
import { type IDriverErrorBase } from "@fluidframework/driver-definitions/internal";
|
|
6
|
+
import { type IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils/internal";
|
|
7
7
|
/**
|
|
8
8
|
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
9
9
|
* @internal
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,gBAAgB,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,gBAAgB,EACrB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE9F;;;GAGG;AACH,qBAAa,UAAW,SAAQ,YAAa,YAAW,gBAAgB,EAAE,eAAe;IACxF,QAAQ,CAAC,SAAS,eAA+B;IACjD,QAAQ,CAAC,QAAQ,SAAS;gBAEd,OAAO,EAAE,MAAM;CAG3B"}
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAGqD;AACrD,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAGqD;AACrD,uEAA8F;AAE9F;;;GAGG;AACH,MAAa,UAAW,SAAQ,uBAAY;IAI3C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAJ7B,cAAS,GAAG,2BAAgB,CAAC,UAAU,CAAC;QACxC,aAAQ,GAAG,KAAK,CAAC;IAI1B,CAAC;CACD;AAPD,gCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverErrorTypes,\n\ttype IDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { type IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n * @internal\n */\nexport class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n\treadonly errorType = DriverErrorTypes.usageError;\n\treadonly canRetry = false;\n\n\tconstructor(message: string) {\n\t\tsuper(message, { usageError: true });\n\t}\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,16 +8,16 @@ export { DocumentStorageServiceProxy } from "./documentStorageServiceProxy.js";
|
|
|
8
8
|
export { UsageError } from "./error.js";
|
|
9
9
|
export { InsecureUrlResolver } from "./insecureUrlResolver.js";
|
|
10
10
|
export { canBeCoalescedByService, isRuntimeMessage, } from "./messageRecognition.js";
|
|
11
|
-
export { AuthorizationError, canRetryOnError, createGenericNetworkError, createWriteError, DeltaStreamConnectionForbiddenError, DriverErrorTelemetryProps, FluidInvalidSchemaError, GenericNetworkError, getRetryDelayFromError, getRetryDelaySecondsFromError, isOnline, LocationRedirectionError, NetworkErrorBasic, NonRetryableError, OnlineStatus, RetryableError, ThrottlingError, } from "./network.js";
|
|
11
|
+
export { AuthorizationError, canRetryOnError, createGenericNetworkError, createWriteError, DeltaStreamConnectionForbiddenError, type DriverErrorTelemetryProps, FluidInvalidSchemaError, GenericNetworkError, getRetryDelayFromError, getRetryDelaySecondsFromError, isOnline, LocationRedirectionError, NetworkErrorBasic, NonRetryableError, OnlineStatus, RetryableError, ThrottlingError, } from "./network.js";
|
|
12
12
|
export { logNetworkFailure } from "./networkUtils.js";
|
|
13
13
|
export { emptyMessageStream, ParallelRequests, Queue, requestOps, streamFromMessages, streamObserver, } from "./parallelRequests.js";
|
|
14
14
|
export { PrefetchDocumentStorageService } from "./prefetchDocumentStorageService.js";
|
|
15
15
|
export { RateLimiter } from "./rateLimiter.js";
|
|
16
16
|
export { readAndParse } from "./readAndParse.js";
|
|
17
|
-
export { calculateMaxWaitTime, IProgress, runWithRetry } from "./runWithRetry.js";
|
|
18
|
-
export { CombinedAppAndProtocolSummary, getDocAttributesFromProtocolSummary, getQuorumValuesFromProtocolSummary, isCombinedAppAndProtocolSummary, } from "./summaryForCreateNew.js";
|
|
17
|
+
export { calculateMaxWaitTime, type IProgress, runWithRetry } from "./runWithRetry.js";
|
|
18
|
+
export { type CombinedAppAndProtocolSummary, getDocAttributesFromProtocolSummary, getQuorumValuesFromProtocolSummary, isCombinedAppAndProtocolSummary, } from "./summaryForCreateNew.js";
|
|
19
19
|
export { convertSummaryTreeToSnapshotITree } from "./treeConversions.js";
|
|
20
|
-
export { applyStorageCompression, ICompressionStorageConfig, SummaryCompressionAlgorithm, blobHeadersBlobName, } from "./adapters/index.js";
|
|
20
|
+
export { applyStorageCompression, type ICompressionStorageConfig, SummaryCompressionAlgorithm, blobHeadersBlobName, } from "./adapters/index.js";
|
|
21
21
|
export { getSnapshotTree, isInstanceOfISnapshot } from "./storageUtils.js";
|
|
22
22
|
export { buildGitTreeHierarchy, getGitMode, getGitType } from "./protocol/index.js";
|
|
23
23
|
export { getKeyForCacheEntry, maximumCacheDurationMs } from "./cacheUtils.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AA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,sBAAsB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { buildSnapshotTree } from \"./buildSnapshotTree.js\";\nexport { BlobTreeEntry, TreeTreeEntry, AttachmentTreeEntry } from \"./blob.js\";\nexport { DocumentStorageServiceProxy } from \"./documentStorageServiceProxy.js\";\nexport { UsageError } from \"./error.js\";\nexport { InsecureUrlResolver } from \"./insecureUrlResolver.js\";\nexport {\n\tcanBeCoalescedByService,\n\tisRuntimeMessage,\n} from \"./messageRecognition.js\";\nexport {\n\tAuthorizationError,\n\tcanRetryOnError,\n\tcreateGenericNetworkError,\n\tcreateWriteError,\n\tDeltaStreamConnectionForbiddenError,\n\ttype DriverErrorTelemetryProps,\n\tFluidInvalidSchemaError,\n\tGenericNetworkError,\n\tgetRetryDelayFromError,\n\tgetRetryDelaySecondsFromError,\n\tisOnline,\n\tLocationRedirectionError,\n\tNetworkErrorBasic,\n\tNonRetryableError,\n\tOnlineStatus,\n\tRetryableError,\n\tThrottlingError,\n} from \"./network.js\";\nexport { logNetworkFailure } from \"./networkUtils.js\";\nexport {\n\temptyMessageStream,\n\tParallelRequests,\n\tQueue,\n\trequestOps,\n\tstreamFromMessages,\n\tstreamObserver,\n} from \"./parallelRequests.js\";\nexport { PrefetchDocumentStorageService } from \"./prefetchDocumentStorageService.js\";\nexport { RateLimiter } from \"./rateLimiter.js\";\nexport { readAndParse } from \"./readAndParse.js\";\nexport { calculateMaxWaitTime, type IProgress, runWithRetry } from \"./runWithRetry.js\";\nexport {\n\ttype CombinedAppAndProtocolSummary,\n\tgetDocAttributesFromProtocolSummary,\n\tgetQuorumValuesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"./summaryForCreateNew.js\";\nexport { convertSummaryTreeToSnapshotITree } from \"./treeConversions.js\";\nexport {\n\tapplyStorageCompression,\n\ttype ICompressionStorageConfig,\n\tSummaryCompressionAlgorithm,\n\tblobHeadersBlobName,\n} from \"./adapters/index.js\";\nexport { getSnapshotTree, isInstanceOfISnapshot } from \"./storageUtils.js\";\nexport { buildGitTreeHierarchy, getGitMode, getGitType } from \"./protocol/index.js\";\nexport { getKeyForCacheEntry, maximumCacheDurationMs } from \"./cacheUtils.js\";\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import type { IRequest } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IResolvedUrl, type IUrlResolver } from "@fluidframework/driver-definitions/internal";
|
|
7
7
|
/**
|
|
8
8
|
* As the name implies this is not secure and should not be used in production. It simply makes the example easier
|
|
9
9
|
* to get up and running.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"insecureUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,MAAM,6CAA6C,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,YAAW,YAAY;IAItD,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAT/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4C;gBAGhD,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,aAAa,GAAE,OAAe;IAGnC,OAAO,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC;IA+C1E,OAAO,CAAC,aAAa;IAmDR,cAAc,CAC1B,WAAW,EAAE,YAAY,EACzB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;IAgBX,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ;CAU1D"}
|
|
@@ -45,12 +45,12 @@ class InsecureUrlResolver {
|
|
|
45
45
|
// If hosts match then we use the local tenant information. Otherwise we make a REST call out to the hosting
|
|
46
46
|
// service using our bearer token.
|
|
47
47
|
if (this.isForNodeTest) {
|
|
48
|
-
const [, documentId, tmpRelativePath] = parsedUrl.pathname.
|
|
48
|
+
const [, documentId, tmpRelativePath] = parsedUrl.pathname.slice(1).split("/");
|
|
49
49
|
const relativePath = tmpRelativePath ?? "";
|
|
50
50
|
return this.resolveHelper(documentId, relativePath, parsedUrl.search);
|
|
51
51
|
}
|
|
52
52
|
else if (parsedUrl.host === window.location.host) {
|
|
53
|
-
const fullPath = parsedUrl.pathname.
|
|
53
|
+
const fullPath = parsedUrl.pathname.slice(1);
|
|
54
54
|
const documentId = fullPath.split("/")[0];
|
|
55
55
|
const documentRelativePath = fullPath.slice(documentId.length);
|
|
56
56
|
return this.resolveHelper(documentId, documentRelativePath);
|
|
@@ -124,11 +124,11 @@ class InsecureUrlResolver {
|
|
|
124
124
|
}
|
|
125
125
|
async getAbsoluteUrl(resolvedUrl, relativeUrl) {
|
|
126
126
|
const parsedUrl = new URL(resolvedUrl.url);
|
|
127
|
-
const
|
|
127
|
+
const documentId = (parsedUrl.pathname?.split("/") ?? [])[2];
|
|
128
128
|
(0, internal_1.assert)(!!documentId, 0x273 /* "Invalid document id from parsed URL" */);
|
|
129
129
|
let url = relativeUrl;
|
|
130
130
|
if (url.startsWith("/")) {
|
|
131
|
-
url = url.
|
|
131
|
+
url = url.slice(1);
|
|
132
132
|
}
|
|
133
133
|
return `${this.hostUrl}/${encodeURIComponent(this.tenantId)}/${encodeURIComponent(documentId)}/${url}`;
|
|
134
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureUrlResolver.js","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,0EAIqD;AAErD;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAmB;IAG/B,YACkB,OAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,cAAsB,EACtB,QAAgB,EAChB,MAAc,EACd,gBAAyB,KAAK;QAN9B,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,mBAAc,GAAd,cAAc,CAAQ;QACtB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,kBAAa,GAAb,aAAa,CAAiB;QAT/B,UAAK,GAAG,IAAI,GAAG,EAAiC,CAAC;IAU/D,CAAC;IAEG,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,yEAAyE;QACzE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,uBAAY,CAAC,SAAS,CAAC,EAAE,CAAC;YAC/C,MAAM,CAAC,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/C,MAAM,YAAY,GAAG,I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AAA,iBAAM,EAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAExE,IAAI,GAAG,GAAG,WAAW,CAAC;QACtB,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QAED,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,kBAAkB,CAChF,UAAU,CACV,IAAI,GAAG,EAAE,CAAC;IACZ,CAAC;IAEM,sBAAsB,CAAC,QAAiB;QAC9C,MAAM,gBAAgB,GAAa;YAClC,yEAAyE;YACzE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,aAAa,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;YACrE,OAAO,EAAE;gBACR,CAAC,uBAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD;AA5ID,kDA4IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tDriverHeader,\n\tIResolvedUrl,\n\tIUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n *\n * In our example we run a simple web server via webpack-dev-server. This defines a URL format of the form\n * http://localhost:8080/<documentId>/<path>.\n *\n * We then need to map that to a Fluid based URL. These are of the form\n * https://orderingUrl/<tenantId>/<documentId>/<path>.\n *\n * The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional\n * part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service\n * works or a router inside of a single page app framework.\n * @internal\n */\nexport class InsecureUrlResolver implements IUrlResolver {\n\tprivate readonly cache = new Map<string, Promise<IResolvedUrl>>();\n\n\tconstructor(\n\t\tprivate readonly hostUrl: string,\n\t\tprivate readonly ordererUrl: string,\n\t\tprivate readonly storageUrl: string,\n\t\tprivate readonly deltaStreamUrl: string,\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly bearer: string,\n\t\tprivate readonly isForNodeTest: boolean = false,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (request.headers?.[DriverHeader.createNew]) {\n\t\t\tconst [, queryString] = request.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst fileName = searchParams.get(\"fileName\");\n\t\t\treturn this.resolveHelper(fileName);\n\t\t}\n\t\tconst parsedUrl = new URL(request.url);\n\t\t// If hosts match then we use the local tenant information. Otherwise we make a REST call out to the hosting\n\t\t// service using our bearer token.\n\t\tif (this.isForNodeTest) {\n\t\t\tconst [, documentId, tmpRelativePath] = parsedUrl.pathname.substr(1).split(\"/\");\n\t\t\tconst relativePath = tmpRelativePath ?? \"\";\n\t\t\treturn this.resolveHelper(documentId, relativePath, parsedUrl.search);\n\t\t} else if (parsedUrl.host === window.location.host) {\n\t\t\tconst fullPath = parsedUrl.pathname.substr(1);\n\t\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\t\tconst documentRelativePath = fullPath.slice(documentId.length);\n\t\t\treturn this.resolveHelper(documentId, documentRelativePath);\n\t\t} else {\n\t\t\tconst maybeResolvedUrl = this.cache.get(request.url);\n\t\t\tif (maybeResolvedUrl) {\n\t\t\t\treturn maybeResolvedUrl;\n\t\t\t}\n\n\t\t\tconst resolvedP = fetch(`${this.hostUrl}/apis/load`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${this.bearer}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\turl: request.url,\n\t\t\t\t}),\n\t\t\t}).then(async (response) => {\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`HTTP error! status: ${response.status}`);\n\t\t\t\t}\n\t\t\t\treturn response.json() as Promise<IResolvedUrl>;\n\t\t\t});\n\t\t\tthis.cache.set(request.url, resolvedP);\n\n\t\t\treturn this.cache.get(request.url);\n\t\t}\n\t}\n\n\tprivate resolveHelper(\n\t\tdocumentId: string | null,\n\t\tdocumentRelativePath: string = \"\",\n\t\tqueryParams: string = \"\",\n\t): IResolvedUrl {\n\t\tconst encodedTenantId = encodeURIComponent(this.tenantId);\n\t\tconst host = new URL(this.ordererUrl).host;\n\t\t// when the document ID is not provided we need to resolve a special create new document URL.\n\t\t// the actual container ID will be generated by the driver.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (!documentId) {\n\t\t\tconst createNewResponse: IResolvedUrl = {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${this.ordererUrl}/deltas/${encodedTenantId}/new`,\n\t\t\t\t\tdeltaStreamUrl: this.deltaStreamUrl,\n\t\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\t\tstorageUrl: `${this.storageUrl}/repos/${encodedTenantId}`,\n\t\t\t\t},\n\t\t\t\t// document ID is ignored by the driver for new container requests\n\t\t\t\tid: \"\",\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `https://${host}/${encodedTenantId}/new`,\n\t\t\t};\n\t\t\treturn createNewResponse;\n\t\t}\n\t\tconst encodedDocId = encodeURIComponent(documentId);\n\t\tconst relativePath =\n\t\t\t!documentRelativePath || documentRelativePath.startsWith(\"/\")\n\t\t\t\t? documentRelativePath\n\t\t\t\t: `/${documentRelativePath}`;\n\t\tconst documentUrl = `https://${host}/${encodedTenantId}/${encodedDocId}${relativePath}${queryParams}`;\n\n\t\tconst deltaStorageUrl = `${this.ordererUrl}/deltas/${encodedTenantId}/${encodedDocId}`;\n\t\tconst storageUrl = `${this.storageUrl}/repos/${encodedTenantId}`;\n\n\t\tconst response: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tdeltaStreamUrl: this.deltaStreamUrl,\n\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\tstorageUrl,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t\treturn response;\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tconst [, , documentId] = parsedUrl.pathname?.split(\"/\") ?? [];\n\n\t\tassert(!!documentId, 0x273 /* \"Invalid document id from parsed URL\" */);\n\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.substr(1);\n\t\t}\n\n\t\treturn `${this.hostUrl}/${encodeURIComponent(this.tenantId)}/${encodeURIComponent(\n\t\t\tdocumentId,\n\t\t)}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(fileName?: string): IRequest {\n\t\tconst createNewRequest: IRequest = {\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\turl: fileName ? `${this.hostUrl}?fileName=${fileName}` : this.hostUrl,\n\t\t\theaders: {\n\t\t\t\t[DriverHeader.createNew]: true,\n\t\t\t},\n\t\t};\n\t\treturn createNewRequest;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"insecureUrlResolver.js","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,kEAA6D;AAC7D,0EAIqD;AAErD;;;;;;;;;;;;;;GA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,CAAC,OAAO;YACrE,OAAO,EAAE;gBACR,CAAC,uBAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD;AA5ID,kDA4IC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tDriverHeader,\n\ttype IResolvedUrl,\n\ttype IUrlResolver,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * As the name implies this is not secure and should not be used in production. It simply makes the example easier\n * to get up and running.\n *\n * In our example we run a simple web server via webpack-dev-server. This defines a URL format of the form\n * http://localhost:8080/<documentId>/<path>.\n *\n * We then need to map that to a Fluid based URL. These are of the form\n * https://orderingUrl/<tenantId>/<documentId>/<path>.\n *\n * The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional\n * part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service\n * works or a router inside of a single page app framework.\n * @internal\n */\nexport class InsecureUrlResolver implements IUrlResolver {\n\tprivate readonly cache = new Map<string, Promise<IResolvedUrl>>();\n\n\tconstructor(\n\t\tprivate readonly hostUrl: string,\n\t\tprivate readonly ordererUrl: string,\n\t\tprivate readonly storageUrl: string,\n\t\tprivate readonly deltaStreamUrl: string,\n\t\tprivate readonly tenantId: string,\n\t\tprivate readonly bearer: string,\n\t\tprivate readonly isForNodeTest: boolean = false,\n\t) {}\n\n\tpublic async resolve(request: IRequest): Promise<IResolvedUrl | undefined> {\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (request.headers?.[DriverHeader.createNew]) {\n\t\t\tconst [, queryString] = request.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst fileName = searchParams.get(\"fileName\");\n\t\t\treturn this.resolveHelper(fileName);\n\t\t}\n\t\tconst parsedUrl = new URL(request.url);\n\t\t// If hosts match then we use the local tenant information. Otherwise we make a REST call out to the hosting\n\t\t// service using our bearer token.\n\t\tif (this.isForNodeTest) {\n\t\t\tconst [, documentId, tmpRelativePath] = parsedUrl.pathname.slice(1).split(\"/\");\n\t\t\tconst relativePath = tmpRelativePath ?? \"\";\n\t\t\treturn this.resolveHelper(documentId, relativePath, parsedUrl.search);\n\t\t} else if (parsedUrl.host === window.location.host) {\n\t\t\tconst fullPath = parsedUrl.pathname.slice(1);\n\t\t\tconst documentId = fullPath.split(\"/\")[0];\n\t\t\tconst documentRelativePath = fullPath.slice(documentId.length);\n\t\t\treturn this.resolveHelper(documentId, documentRelativePath);\n\t\t} else {\n\t\t\tconst maybeResolvedUrl = this.cache.get(request.url);\n\t\t\tif (maybeResolvedUrl) {\n\t\t\t\treturn maybeResolvedUrl;\n\t\t\t}\n\n\t\t\tconst resolvedP = fetch(`${this.hostUrl}/apis/load`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${this.bearer}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\turl: request.url,\n\t\t\t\t}),\n\t\t\t}).then(async (response) => {\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`HTTP error! status: ${response.status}`);\n\t\t\t\t}\n\t\t\t\treturn response.json() as Promise<IResolvedUrl>;\n\t\t\t});\n\t\t\tthis.cache.set(request.url, resolvedP);\n\n\t\t\treturn this.cache.get(request.url);\n\t\t}\n\t}\n\n\tprivate resolveHelper(\n\t\tdocumentId: string | null,\n\t\tdocumentRelativePath: string = \"\",\n\t\tqueryParams: string = \"\",\n\t): IResolvedUrl {\n\t\tconst encodedTenantId = encodeURIComponent(this.tenantId);\n\t\tconst host = new URL(this.ordererUrl).host;\n\t\t// when the document ID is not provided we need to resolve a special create new document URL.\n\t\t// the actual container ID will be generated by the driver.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tif (!documentId) {\n\t\t\tconst createNewResponse: IResolvedUrl = {\n\t\t\t\tendpoints: {\n\t\t\t\t\tdeltaStorageUrl: `${this.ordererUrl}/deltas/${encodedTenantId}/new`,\n\t\t\t\t\tdeltaStreamUrl: this.deltaStreamUrl,\n\t\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\t\tstorageUrl: `${this.storageUrl}/repos/${encodedTenantId}`,\n\t\t\t\t},\n\t\t\t\t// document ID is ignored by the driver for new container requests\n\t\t\t\tid: \"\",\n\t\t\t\ttokens: {},\n\t\t\t\ttype: \"fluid\",\n\t\t\t\turl: `https://${host}/${encodedTenantId}/new`,\n\t\t\t};\n\t\t\treturn createNewResponse;\n\t\t}\n\t\tconst encodedDocId = encodeURIComponent(documentId);\n\t\tconst relativePath =\n\t\t\t!documentRelativePath || documentRelativePath.startsWith(\"/\")\n\t\t\t\t? documentRelativePath\n\t\t\t\t: `/${documentRelativePath}`;\n\t\tconst documentUrl = `https://${host}/${encodedTenantId}/${encodedDocId}${relativePath}${queryParams}`;\n\n\t\tconst deltaStorageUrl = `${this.ordererUrl}/deltas/${encodedTenantId}/${encodedDocId}`;\n\t\tconst storageUrl = `${this.storageUrl}/repos/${encodedTenantId}`;\n\n\t\tconst response: IResolvedUrl = {\n\t\t\tendpoints: {\n\t\t\t\tdeltaStorageUrl,\n\t\t\t\tdeltaStreamUrl: this.deltaStreamUrl,\n\t\t\t\tordererUrl: this.ordererUrl,\n\t\t\t\tstorageUrl,\n\t\t\t},\n\t\t\tid: documentId,\n\t\t\ttokens: {},\n\t\t\ttype: \"fluid\",\n\t\t\turl: documentUrl,\n\t\t};\n\t\treturn response;\n\t}\n\n\tpublic async getAbsoluteUrl(\n\t\tresolvedUrl: IResolvedUrl,\n\t\trelativeUrl: string,\n\t): Promise<string> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tconst documentId = (parsedUrl.pathname?.split(\"/\") ?? [])[2];\n\n\t\tassert(!!documentId, 0x273 /* \"Invalid document id from parsed URL\" */);\n\n\t\tlet url = relativeUrl;\n\t\tif (url.startsWith(\"/\")) {\n\t\t\turl = url.slice(1);\n\t\t}\n\n\t\treturn `${this.hostUrl}/${encodeURIComponent(this.tenantId)}/${encodeURIComponent(\n\t\t\tdocumentId,\n\t\t)}/${url}`;\n\t}\n\n\tpublic createCreateNewRequest(fileName?: string): IRequest {\n\t\tconst createNewRequest: IRequest = {\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\turl: fileName ? `${this.hostUrl}?fileName=${fileName}` : this.hostUrl,\n\t\t\theaders: {\n\t\t\t\t[DriverHeader.createNew]: true,\n\t\t\t},\n\t\t};\n\t\treturn createNewRequest;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ISequencedDocumentMessage, IDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
5
|
+
import { type ISequencedDocumentMessage, type IDocumentMessage } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Tells if message was sent by container runtime
|
|
8
8
|
* @privateRemarks ADO #1385: To be moved to container-definitions
|
|
@@ -13,6 +13,8 @@ export declare function isRuntimeMessage(message: {
|
|
|
13
13
|
type: string;
|
|
14
14
|
}): boolean;
|
|
15
15
|
/**
|
|
16
|
+
* Whether the message can be coalesced by the relay service.
|
|
17
|
+
*
|
|
16
18
|
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
17
19
|
* @internal
|
|
18
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,yBAAyB,
|
|
1
|
+
{"version":3,"file":"messageRecognition.d.ts","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EAErB,MAAM,6CAA6C,CAAC;AAErD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,yBAAyB,GAAG,gBAAgB,GACnD,OAAO,CAIT"}
|
|
@@ -17,6 +17,8 @@ function isRuntimeMessage(message) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.isRuntimeMessage = isRuntimeMessage;
|
|
19
19
|
/**
|
|
20
|
+
* Whether the message can be coalesced by the relay service.
|
|
21
|
+
*
|
|
20
22
|
* @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts
|
|
21
23
|
* @internal
|
|
22
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAIqD;AAErD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,sBAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAFD,4CAEC;AAED
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,0EAIqD;AAErD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,sBAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAFD,4CAEC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,sBAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,sBAAW,CAAC,MAAM,CAAC;AACjF,CAAC;AAND,0DAMC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\ttype ISequencedDocumentMessage,\n\ttype IDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Tells if message was sent by container runtime\n * @privateRemarks ADO #1385: To be moved to container-definitions\n * @returns whether the message is a runtime message\n * @internal\n */\nexport function isRuntimeMessage(message: { type: string }): boolean {\n\treturn message.type === MessageType.Operation;\n}\n\n/**\n * Whether the message can be coalesced by the relay service.\n *\n * @privateRemarks ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\n * @internal\n */\nexport function canBeCoalescedByService(\n\tmessage: ISequencedDocumentMessage | IDocumentMessage,\n): boolean {\n\t// This assumes that in the future relay service may implement coalescing of accept messages,\n\t// same way it was doing coalescing of immediate noops in the past.\n\treturn message.type === MessageType.NoOp || message.type === MessageType.Accept;\n}\n"]}
|
package/dist/network.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
|
-
import { IAuthorizationError, ILocationRedirectionError, IResolvedUrl, IThrottlingWarning, IDriverErrorBase } from "@fluidframework/driver-definitions/internal";
|
|
7
|
-
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils/internal";
|
|
5
|
+
import type { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
6
|
+
import { type IAuthorizationError, type ILocationRedirectionError, type IResolvedUrl, type IThrottlingWarning, type IDriverErrorBase } from "@fluidframework/driver-definitions/internal";
|
|
7
|
+
import { type IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
@@ -110,10 +110,14 @@ export declare class ThrottlingError extends LoggingError implements IThrottling
|
|
|
110
110
|
constructor(message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
+
* Creates a non-retryable write error.
|
|
114
|
+
*
|
|
113
115
|
* @internal
|
|
114
116
|
*/
|
|
115
117
|
export declare const createWriteError: (message: string, props: DriverErrorTelemetryProps) => NonRetryableError<"writeError">;
|
|
116
118
|
/**
|
|
119
|
+
* Creates a generic network error, either throttling or non-throttling based on the provided retry information.
|
|
120
|
+
*
|
|
117
121
|
* @internal
|
|
118
122
|
*/
|
|
119
123
|
export declare function createGenericNetworkError(message: string, retryInfo: {
|
|
@@ -126,15 +130,15 @@ export declare function createGenericNetworkError(message: string, retryInfo: {
|
|
|
126
130
|
* @param error - The error to inspect for ability to retry
|
|
127
131
|
* @internal
|
|
128
132
|
*/
|
|
129
|
-
export declare const canRetryOnError: (error:
|
|
133
|
+
export declare const canRetryOnError: (error: unknown) => boolean;
|
|
130
134
|
/**
|
|
131
135
|
* Check retryAfterSeconds property on error
|
|
132
136
|
* @internal
|
|
133
137
|
*/
|
|
134
|
-
export declare const getRetryDelaySecondsFromError: (error:
|
|
138
|
+
export declare const getRetryDelaySecondsFromError: (error: unknown) => number | undefined;
|
|
135
139
|
/**
|
|
136
140
|
* Check retryAfterSeconds property on error and convert to ms
|
|
137
141
|
* @internal
|
|
138
142
|
*/
|
|
139
|
-
export declare const getRetryDelayFromError: (error:
|
|
143
|
+
export declare const getRetryDelayFromError: (error: unknown) => number | undefined;
|
|
140
144
|
//# sourceMappingURL=network.d.ts.map
|
package/dist/network.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE9F;;GAEG;AACH,oBAAY,YAAY;IACvB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,OAAO,IAAA;CACP;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,YAAY,CASvC;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,wBAAwB,GAAG;IAClE,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,qBAAa,mBACZ,SAAQ,YACR,YAAW,gBAAgB,EAAE,eAAe;IAS3C,QAAQ,CAAC,QAAQ,EAAE,OAAO;IAP3B;;OAEG;IACH,QAAQ,CAAC,SAAS,wBAAwC;gBAGzD,OAAO,EAAE,MAAM,EACN,QAAQ,EAAE,OAAO,EAC1B,KAAK,EAAE,yBAAyB;CAIjC;AAED;;;GAGG;AACH,qBAAa,uBACZ,SAAQ,YACR,YAAW,gBAAgB,EAAE,eAAe;IAE5C,QAAQ,CAAC,SAAS,uBAAuC;IACzD,QAAQ,CAAC,QAAQ,SAAS;gBAEd,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,yBAAyB;CAG7D;AAED;;GAEG;AACH,qBAAa,mCACZ,SAAQ,YACR,YAAW,gBAAgB,EAAE,eAAe;IAE5C,MAAM,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|
147
147
|
}
|
|
148
148
|
exports.ThrottlingError = ThrottlingError;
|
|
149
149
|
/**
|
|
150
|
+
* Creates a non-retryable write error.
|
|
151
|
+
*
|
|
150
152
|
* @internal
|
|
151
153
|
*/
|
|
152
154
|
const createWriteError = (message, props) => new NonRetryableError(message, internal_1.DriverErrorTypes.writeError, props);
|
|
153
155
|
exports.createWriteError = createWriteError;
|
|
154
156
|
/**
|
|
157
|
+
* Creates a generic network error, either throttling or non-throttling based on the provided retry information.
|
|
158
|
+
*
|
|
155
159
|
* @internal
|
|
156
160
|
*/
|
|
157
161
|
function createGenericNetworkError(message, retryInfo, props) {
|
|
@@ -167,18 +171,29 @@ exports.createGenericNetworkError = createGenericNetworkError;
|
|
|
167
171
|
* @param error - The error to inspect for ability to retry
|
|
168
172
|
* @internal
|
|
169
173
|
*/
|
|
170
|
-
const canRetryOnError = (error) => error
|
|
174
|
+
const canRetryOnError = (error) => typeof error === "object" &&
|
|
175
|
+
error !== null &&
|
|
176
|
+
error.canRetry === true;
|
|
171
177
|
exports.canRetryOnError = canRetryOnError;
|
|
172
178
|
/**
|
|
173
179
|
* Check retryAfterSeconds property on error
|
|
174
180
|
* @internal
|
|
175
181
|
*/
|
|
176
|
-
const getRetryDelaySecondsFromError = (error) =>
|
|
182
|
+
const getRetryDelaySecondsFromError = (error) => {
|
|
183
|
+
if (typeof error === "object" && error !== null) {
|
|
184
|
+
const retryAfterSeconds = error.retryAfterSeconds;
|
|
185
|
+
return typeof retryAfterSeconds === "number" ? retryAfterSeconds : undefined;
|
|
186
|
+
}
|
|
187
|
+
return undefined;
|
|
188
|
+
};
|
|
177
189
|
exports.getRetryDelaySecondsFromError = getRetryDelaySecondsFromError;
|
|
178
190
|
/**
|
|
179
191
|
* Check retryAfterSeconds property on error and convert to ms
|
|
180
192
|
* @internal
|
|
181
193
|
*/
|
|
182
|
-
const getRetryDelayFromError = (error) =>
|
|
194
|
+
const getRetryDelayFromError = (error) => {
|
|
195
|
+
const retryAfterSeconds = (0, exports.getRetryDelaySecondsFromError)(error);
|
|
196
|
+
return retryAfterSeconds === undefined ? undefined : retryAfterSeconds * 1000;
|
|
197
|
+
};
|
|
183
198
|
exports.getRetryDelayFromError = getRetryDelayFromError;
|
|
184
199
|
//# sourceMappingURL=network.js.map
|
package/dist/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAOqD;AACrD,uEAAyF;AAEzF;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACR,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED;;;;;GAKG;AACH,SAAgB,QAAQ;IACvB,IACC,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EACpC,CAAC;QACF,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;IACtE,CAAC;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAC7B,CAAC;AATD,4BASC;AAUD;;;GAGG;AACH,MAAa,mBACZ,SAAQ,uBAAY;IAQpB,YACC,OAAe,EACN,QAAiB,EAC1B,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,aAAQ,GAAR,QAAQ,CAAS;QAP3B;;WAEG;QACM,cAAS,GAAG,2BAAgB,CAAC,mBAAmB,CAAC;IAQ1D,CAAC;CACD;AAhBD,kDAgBC;AAED;;;GAGG;AACH,MAAa,uBACZ,SAAQ,uBAAY;IAMpB,YAAY,OAAe,EAAE,KAAgC;QAC5D,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAJd,cAAS,GAAG,2BAAgB,C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AU,EAAE,KAAK,CAAC,CAAC;AAJvD,QAAA,gBAAgB,oBAIuC;AAEpE;;GAEG;AACH,SAAgB,yBAAyB,CACxC,OAAe,EACf,SAAuD,EACvD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QAChE,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AATD,8DASC;AAED;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAApE,QAAA,eAAe,mBAAqD;AAEjF;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC/E,KAAK,EAAE,iBAAuC,CAAC;AADnC,QAAA,6BAA6B,iCACM;AAEhD;;;GAGG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CACxE,KAAK,EAAE,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AADxE,QAAA,sBAAsB,0BACkD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tIAuthorizationError,\n\tILocationRedirectionError,\n\tIResolvedUrl,\n\tIThrottlingWarning,\n\tDriverErrorTypes,\n\tIDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * @internal\n */\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\n}\n\n/**\n * It tells if we have local connection only - we might not have connection to web.\n * No solution for node.js (other than resolve dns names / ping specific sites)\n * Can also use window.addEventListener(\"online\" / \"offline\")\n * @internal\n */\nexport function isOnline(): OnlineStatus {\n\tif (\n\t\ttypeof navigator === \"object\" &&\n\t\tnavigator !== null &&\n\t\ttypeof navigator.onLine === \"boolean\"\n\t) {\n\t\treturn navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n\t}\n\treturn OnlineStatus.Unknown;\n}\n\n/**\n * Telemetry props with driver-specific required properties\n * @internal\n */\nexport type DriverErrorTelemetryProps = ITelemetryBaseProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n * @internal\n */\nexport class GenericNetworkError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\t/**\n\t * {@inheritDoc @fluidframework/telemetry-utils#IFluidErrorBase.errorType}\n\t */\n\treadonly errorType = DriverErrorTypes.genericNetworkError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n * @internal\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\tstatic readonly errorType = DriverErrorTypes.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\treadonly storageOnlyReason: string | undefined;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t\tthis.storageOnlyReason = storageOnlyReason;\n\t}\n}\n\n/**\n * @internal\n */\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.authorizationError;\n\n\t// These properties are not assigned in this class, but instead assigned in the super constructor.\n\t// When targeting ES 2022 or later, TypeScript would generate ES6 class fields for these properties if they did not use \"declare\".\n\t// That would override the own properties dynamically created in the super constructor\n\t// resulting in these properties always holding `undefined` instead of their desired values.\n\t// To prevent this undesired overriding,\n\t// these are declared using `declare` to indicate this definition is only for the TypeScript typing,\n\t// and the actual fields come from elsewhere.\n\tdeclare readonly claims?: string;\n\tdeclare readonly tenantId?: string;\n\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tclaims: string | undefined,\n\t\ttenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tif (claims !== undefined) {\n\t\t\tprops.claims = claims;\n\t\t}\n\t\tif (tenantId !== undefined) {\n\t\t\tprops.tenantId = tenantId;\n\t\t}\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\n/**\n * @internal\n */\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.locationRedirection;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectUrl: IResolvedUrl,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectURL\n\t\tsuper(message, props, new Set([\"redirectUrl\"]));\n\t}\n}\n\n/**\n * @internal\n */\nexport class NetworkErrorBasic<T extends string>\n\textends LoggingError\n\timplements IFluidErrorBase\n{\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n * @internal\n */\nexport class ThrottlingError\n\textends LoggingError\n\timplements IThrottlingWarning, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.throttlingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport const createWriteError = (\n\tmessage: string,\n\tprops: DriverErrorTelemetryProps,\n): NonRetryableError<\"writeError\"> =>\n\tnew NonRetryableError(message, DriverErrorTypes.writeError, props);\n\n/**\n * @internal\n */\nexport function createGenericNetworkError(\n\tmessage: string,\n\tretryInfo: { canRetry: boolean; retryAfterMs?: number },\n\tprops: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n\tif (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n\t\treturn new ThrottlingError(message, retryInfo.retryAfterMs / 1000, props);\n\t}\n\treturn new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n * @internal\n */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/**\n * Check retryAfterSeconds property on error\n * @internal\n */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/**\n * Check retryAfterSeconds property on error and convert to ms\n * @internal\n */\nexport const getRetryDelayFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAOqD;AACrD,uEAA8F;AAE9F;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACR,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED;;;;;GAKG;AACH,SAAgB,QAAQ;IACvB,IACC,OAAO,SAAS,KAAK,QAAQ;QAC7B,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,CAAC,MAAM,KAAK,SAAS,EACpC,CAAC;QACF,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;IACtE,CAAC;IACD,OAAO,YAAY,CAAC,OAAO,CAAC;AAC7B,CAAC;AATD,4BASC;AAUD;;;GAGG;AACH,MAAa,mBACZ,SAAQ,uBAAY;IAQpB,YACC,OAAe,EACN,QAAiB,EAC1B,KAAgC;QAEhC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,aAAQ,GAAR,QAAQ,CAAS;QAP3B;;WAEG;QACM,cAAS,GAAG,2BAAgB,CAAC,mBAAmB,CAAC;IAQ1D,CAAC;CACD;AAhBD,kDAgBC;AAED;;;GAGG;AACH,MAAa,uBACZ,SAAQ,uBAAY;IAMpB,YAAY,OAAe,EAAE,KAAgC;QAC5D,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAJd,cAAS,GAAG,2BAAgB,CA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E,CAAC,CAAC;AAHW,QAAA,sBAAsB,0BAGjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport {\n\tDriverErrorTypes,\n\ttype IAuthorizationError,\n\ttype ILocationRedirectionError,\n\ttype IResolvedUrl,\n\ttype IThrottlingWarning,\n\ttype IDriverErrorBase,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { type IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * @internal\n */\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\n}\n\n/**\n * It tells if we have local connection only - we might not have connection to web.\n * No solution for node.js (other than resolve dns names / ping specific sites)\n * Can also use window.addEventListener(\"online\" / \"offline\")\n * @internal\n */\nexport function isOnline(): OnlineStatus {\n\tif (\n\t\ttypeof navigator === \"object\" &&\n\t\tnavigator !== null &&\n\t\ttypeof navigator.onLine === \"boolean\"\n\t) {\n\t\treturn navigator.onLine ? OnlineStatus.Online : OnlineStatus.Offline;\n\t}\n\treturn OnlineStatus.Unknown;\n}\n\n/**\n * Telemetry props with driver-specific required properties\n * @internal\n */\nexport type DriverErrorTelemetryProps = ITelemetryBaseProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n * @internal\n */\nexport class GenericNetworkError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\t/**\n\t * {@inheritDoc @fluidframework/telemetry-utils#IFluidErrorBase.errorType}\n\t */\n\treadonly errorType = DriverErrorTypes.genericNetworkError;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n * @internal\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\tstatic readonly errorType = DriverErrorTypes.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\treadonly storageOnlyReason: string | undefined;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t\tthis.storageOnlyReason = storageOnlyReason;\n\t}\n}\n\n/**\n * @internal\n */\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.authorizationError;\n\n\t// These properties are not assigned in this class, but instead assigned in the super constructor.\n\t// When targeting ES 2022 or later, TypeScript would generate ES6 class fields for these properties if they did not use \"declare\".\n\t// That would override the own properties dynamically created in the super constructor\n\t// resulting in these properties always holding `undefined` instead of their desired values.\n\t// To prevent this undesired overriding,\n\t// these are declared using `declare` to indicate this definition is only for the TypeScript typing,\n\t// and the actual fields come from elsewhere.\n\tdeclare readonly claims?: string;\n\tdeclare readonly tenantId?: string;\n\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\tclaims: string | undefined,\n\t\ttenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tif (claims !== undefined) {\n\t\t\tprops.claims = claims;\n\t\t}\n\t\tif (tenantId !== undefined) {\n\t\t\tprops.tenantId = tenantId;\n\t\t}\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\n/**\n * @internal\n */\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.locationRedirection;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectUrl: IResolvedUrl,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectURL\n\t\tsuper(message, props, new Set([\"redirectUrl\"]));\n\t}\n}\n\n/**\n * @internal\n */\nexport class NetworkErrorBasic<T extends string>\n\textends LoggingError\n\timplements IFluidErrorBase\n{\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\treadonly canRetry: boolean,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\n/**\n * @internal\n */\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly errorType: T,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n * @internal\n */\nexport class ThrottlingError\n\textends LoggingError\n\timplements IThrottlingWarning, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorTypes.throttlingError;\n\treadonly canRetry = true;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * Creates a non-retryable write error.\n *\n * @internal\n */\nexport const createWriteError = (\n\tmessage: string,\n\tprops: DriverErrorTelemetryProps,\n): NonRetryableError<\"writeError\"> =>\n\tnew NonRetryableError(message, DriverErrorTypes.writeError, props);\n\n/**\n * Creates a generic network error, either throttling or non-throttling based on the provided retry information.\n *\n * @internal\n */\nexport function createGenericNetworkError(\n\tmessage: string,\n\tretryInfo: { canRetry: boolean; retryAfterMs?: number },\n\tprops: DriverErrorTelemetryProps,\n): ThrottlingError | GenericNetworkError {\n\tif (retryInfo.retryAfterMs !== undefined && retryInfo.canRetry) {\n\t\treturn new ThrottlingError(message, retryInfo.retryAfterMs / 1000, props);\n\t}\n\treturn new GenericNetworkError(message, retryInfo.canRetry, props);\n}\n\n/**\n * Check if a connection error can be retried. Unless explicitly allowed, retry is disallowed.\n * I.e. asserts or unexpected exceptions in our code result in container failure.\n * @param error - The error to inspect for ability to retry\n * @internal\n */\nexport const canRetryOnError = (error: unknown): boolean =>\n\ttypeof error === \"object\" &&\n\terror !== null &&\n\t(error as { canRetry?: boolean }).canRetry === true;\n\n/**\n * Check retryAfterSeconds property on error\n * @internal\n */\nexport const getRetryDelaySecondsFromError = (error: unknown): number | undefined => {\n\tif (typeof error === \"object\" && error !== null) {\n\t\tconst retryAfterSeconds = (error as { retryAfterSeconds?: unknown }).retryAfterSeconds;\n\t\treturn typeof retryAfterSeconds === \"number\" ? retryAfterSeconds : undefined;\n\t}\n\treturn undefined;\n};\n\n/**\n * Check retryAfterSeconds property on error and convert to ms\n * @internal\n */\nexport const getRetryDelayFromError = (error: unknown): number | undefined => {\n\tconst retryAfterSeconds = getRetryDelaySecondsFromError(error);\n\treturn retryAfterSeconds === undefined ? undefined : retryAfterSeconds * 1000;\n};\n"]}
|
package/dist/networkUtils.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type { ITelemetryErrorEventExt } from "@fluidframework/telemetry-utils/internal";
|
|
6
|
-
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
5
|
+
import type { ITelemetryErrorEventExt, ITelemetryLoggerExt } from "@fluidframework/telemetry-utils/internal";
|
|
7
6
|
/**
|
|
7
|
+
* Logs a network failure with additional context about online status and retry capability for the provided event.
|
|
8
|
+
*
|
|
8
9
|
* @internal
|
|
9
10
|
*/
|
|
10
|
-
export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEventExt, error?:
|
|
11
|
+
export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEventExt, error?: unknown): void;
|
|
11
12
|
//# sourceMappingURL=networkUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,0CAA0C,CAAC;AAIlD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,uBAAuB,EAC9B,KAAK,CAAC,EAAE,OAAO,GACb,IAAI,CAsBN"}
|
package/dist/networkUtils.js
CHANGED
|
@@ -7,17 +7,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.logNetworkFailure = void 0;
|
|
8
8
|
const network_js_1 = require("./network.js");
|
|
9
9
|
/**
|
|
10
|
+
* Logs a network failure with additional context about online status and retry capability for the provided event.
|
|
11
|
+
*
|
|
10
12
|
* @internal
|
|
11
13
|
*/
|
|
12
14
|
function logNetworkFailure(logger, event, error) {
|
|
13
15
|
const newEvent = { ...event };
|
|
16
|
+
// TODO: better typing
|
|
14
17
|
const errorOnlineProp = error?.online;
|
|
15
18
|
newEvent.online =
|
|
16
19
|
typeof errorOnlineProp === "string" ? errorOnlineProp : network_js_1.OnlineStatus[(0, network_js_1.isOnline)()];
|
|
17
20
|
if (typeof navigator === "object" && navigator !== null) {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any -- TODO: use a real type
|
|
18
22
|
const nav = navigator;
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
19
24
|
const connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;
|
|
20
25
|
if (connection !== null && typeof connection === "object") {
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
21
27
|
newEvent.connectionType = connection.type;
|
|
22
28
|
}
|
|
23
29
|
}
|
package/dist/networkUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,6CAAuE;AAEvE;;;;GAIG;AACH,SAAgB,iBAAiB,CAChC,MAA2B,EAC3B,KAA8B,EAC9B,KAAe;IAEf,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;IAE9B,sBAAsB;IACtB,MAAM,eAAe,GAAI,KAA8B,EAAE,MAAM,CAAC;IAChE,QAAQ,CAAC,MAAM;QACd,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,yBAAY,CAAC,IAAA,qBAAQ,GAAE,CAAC,CAAC;IAElF,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACzD,gIAAgI;QAChI,MAAM,GAAG,GAAG,SAAgB,CAAC;QAC7B,+GAA+G;QAC/G,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC3D,+GAA+G;YAC/G,QAAQ,CAAC,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;QAC3C,CAAC;IACF,CAAC;IAED,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,GAAG,IAAA,4BAAe,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AA1BD,8CA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tITelemetryErrorEventExt,\n\tITelemetryLoggerExt,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { OnlineStatus, canRetryOnError, isOnline } from \"./network.js\";\n\n/**\n * Logs a network failure with additional context about online status and retry capability for the provided event.\n *\n * @internal\n */\nexport function logNetworkFailure(\n\tlogger: ITelemetryLoggerExt,\n\tevent: ITelemetryErrorEventExt,\n\terror?: unknown,\n): void {\n\tconst newEvent = { ...event };\n\n\t// TODO: better typing\n\tconst errorOnlineProp = (error as { online?: unknown })?.online;\n\tnewEvent.online =\n\t\ttypeof errorOnlineProp === \"string\" ? errorOnlineProp : OnlineStatus[isOnline()];\n\n\tif (typeof navigator === \"object\" && navigator !== null) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any -- TODO: use a real type\n\t\tconst nav = navigator as any;\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\tconst connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;\n\t\tif (connection !== null && typeof connection === \"object\") {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access\n\t\t\tnewEvent.connectionType = connection.type;\n\t\t}\n\t}\n\n\t// non-retryable errors are fatal and should be logged as errors\n\tnewEvent.category = canRetryOnError(error) ? \"generic\" : \"error\";\n\tlogger.sendTelemetryEvent(newEvent, error);\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.82.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/driver-utils";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.82.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|