@fluidframework/driver-utils 2.0.0-rc.1.0.3 → 2.0.0-rc.2.0.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/{.eslintrc.js → .eslintrc.cjs} +5 -2
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +32 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/driver-utils.api.md +22 -18
- 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 +8 -4
- package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +7 -7
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/index.d.ts +3 -3
- package/dist/adapters/compression/index.d.ts.map +1 -1
- package/dist/adapters/compression/index.js +7 -7
- 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 +11 -11
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/summaryblob/index.d.ts +1 -1
- package/dist/adapters/compression/summaryblob/index.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/index.js +3 -3
- package/dist/adapters/compression/summaryblob/index.js.map +1 -1
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +6 -6
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +4 -4
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/documentServiceProxy.d.ts +3 -2
- package/dist/documentServiceProxy.d.ts.map +1 -1
- package/dist/documentServiceProxy.js +3 -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 +7 -3
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/driver-utils-alpha.d.ts +6 -2
- package/dist/driver-utils-beta.d.ts +10 -2
- package/dist/driver-utils-public.d.ts +10 -2
- package/dist/driver-utils-untrimmed.d.ts +30 -17
- package/dist/error.d.ts +2 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +1 -3
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +17 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -62
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +3 -2
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +9 -7
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/network.d.ts +13 -10
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +9 -12
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +2 -3
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +3 -3
- package/dist/networkUtils.js.map +1 -1
- package/dist/package.json +3 -0
- 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 +3 -3
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +10 -10
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +4 -4
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/runWithRetry.js +6 -6
- package/dist/runWithRetry.js.map +1 -1
- package/dist/storageUtils.d.ts +13 -0
- package/dist/storageUtils.d.ts.map +1 -0
- package/dist/storageUtils.js +17 -0
- package/dist/storageUtils.js.map +1 -0
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +7 -6
- package/dist/treeConversions.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/adapters/compression/{compressionTypes.d.mts → compressionTypes.d.ts} +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts.map +1 -0
- package/lib/adapters/compression/{compressionTypes.mjs → compressionTypes.js} +1 -1
- package/lib/adapters/compression/compressionTypes.js.map +1 -0
- package/lib/adapters/compression/{documentServiceCompressionAdapter.d.mts → documentServiceCompressionAdapter.d.ts} +3 -3
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -0
- package/lib/adapters/compression/{documentServiceCompressionAdapter.mjs → documentServiceCompressionAdapter.js} +7 -3
- package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -0
- package/lib/adapters/compression/{documentServiceFactoryCompressionAdapter.d.mts → documentServiceFactoryCompressionAdapter.d.ts} +3 -3
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -0
- package/lib/adapters/compression/{documentServiceFactoryCompressionAdapter.mjs → documentServiceFactoryCompressionAdapter.js} +4 -4
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -0
- package/lib/adapters/compression/{index.d.mts → index.d.ts} +4 -4
- package/lib/adapters/compression/index.d.ts.map +1 -0
- package/lib/adapters/compression/{index.mjs → index.js} +4 -4
- package/lib/adapters/compression/index.js.map +1 -0
- package/lib/adapters/compression/summaryblob/{documentStorageServiceSummaryBlobCompressionAdapter.d.mts → documentStorageServiceSummaryBlobCompressionAdapter.d.ts} +3 -3
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -0
- package/lib/adapters/compression/summaryblob/{documentStorageServiceSummaryBlobCompressionAdapter.mjs → documentStorageServiceSummaryBlobCompressionAdapter.js} +3 -3
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -0
- package/lib/adapters/compression/summaryblob/{index.mjs → index.d.ts} +2 -2
- package/lib/adapters/compression/summaryblob/index.d.ts.map +1 -0
- package/lib/adapters/compression/summaryblob/{index.d.mts → index.js} +2 -2
- package/lib/adapters/compression/summaryblob/index.js.map +1 -0
- package/lib/adapters/{index.d.mts → index.d.ts} +3 -3
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/{index.mjs → index.js} +3 -3
- package/lib/adapters/index.js.map +1 -0
- package/lib/adapters/{predefinedAdapters.d.mts → predefinedAdapters.d.ts} +2 -2
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -0
- package/lib/adapters/{predefinedAdapters.mjs → predefinedAdapters.js} +2 -2
- package/lib/adapters/predefinedAdapters.js.map +1 -0
- package/lib/{blob.d.mts → blob.d.ts} +1 -1
- package/lib/blob.d.ts.map +1 -0
- package/lib/{blob.mjs → blob.js} +1 -1
- package/lib/blob.js.map +1 -0
- package/lib/{buildSnapshotTree.d.mts → buildSnapshotTree.d.ts} +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -0
- package/lib/{buildSnapshotTree.mjs → buildSnapshotTree.js} +1 -1
- package/lib/buildSnapshotTree.js.map +1 -0
- package/lib/{documentServiceFactoryProxy.d.mts → documentServiceFactoryProxy.d.ts} +1 -1
- package/lib/documentServiceFactoryProxy.d.ts.map +1 -0
- package/lib/{documentServiceFactoryProxy.mjs → documentServiceFactoryProxy.js} +1 -1
- package/lib/documentServiceFactoryProxy.js.map +1 -0
- package/lib/{documentServiceProxy.d.mts → documentServiceProxy.d.ts} +4 -3
- package/lib/documentServiceProxy.d.ts.map +1 -0
- package/lib/{documentServiceProxy.mjs → documentServiceProxy.js} +4 -2
- package/lib/documentServiceProxy.js.map +1 -0
- package/lib/{documentStorageServiceProxy.d.mts → documentStorageServiceProxy.d.ts} +3 -3
- package/lib/documentStorageServiceProxy.d.ts.map +1 -0
- package/lib/{documentStorageServiceProxy.mjs → documentStorageServiceProxy.js} +8 -4
- package/lib/documentStorageServiceProxy.js.map +1 -0
- package/lib/{driver-utils-alpha.d.mts → driver-utils-alpha.d.ts} +6 -2
- package/lib/{driver-utils-public.d.mts → driver-utils-beta.d.ts} +10 -2
- package/lib/{driver-utils-beta.d.mts → driver-utils-public.d.ts} +10 -2
- package/lib/{driver-utils-untrimmed.d.mts → driver-utils-untrimmed.d.ts} +30 -17
- package/lib/{error.d.mts → error.d.ts} +3 -3
- package/lib/error.d.ts.map +1 -0
- package/lib/{error.mjs → error.js} +3 -4
- package/lib/error.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +18 -17
- package/lib/index.d.ts.map +1 -0
- package/lib/{index.mjs → index.js} +18 -17
- package/lib/index.js.map +1 -0
- package/lib/{insecureUrlResolver.d.mts → insecureUrlResolver.d.ts} +4 -3
- package/lib/insecureUrlResolver.d.ts.map +1 -0
- package/lib/{insecureUrlResolver.mjs → insecureUrlResolver.js} +10 -8
- package/lib/insecureUrlResolver.js.map +1 -0
- package/lib/{messageRecognition.d.mts → messageRecognition.d.ts} +5 -1
- package/lib/messageRecognition.d.ts.map +1 -0
- package/lib/{messageRecognition.mjs → messageRecognition.js} +5 -1
- package/lib/messageRecognition.js.map +1 -0
- package/lib/{network.d.mts → network.d.ts} +14 -11
- package/lib/network.d.ts.map +1 -0
- package/lib/{network.mjs → network.js} +11 -16
- package/lib/network.js.map +1 -0
- package/lib/networkUtils.d.ts +10 -0
- package/lib/networkUtils.d.ts.map +1 -0
- package/lib/{networkUtils.mjs → networkUtils.js} +2 -2
- package/lib/networkUtils.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{parallelRequests.d.mts → parallelRequests.d.ts} +4 -4
- package/lib/parallelRequests.d.ts.map +1 -0
- package/lib/{parallelRequests.mjs → parallelRequests.js} +10 -5
- package/lib/parallelRequests.js.map +1 -0
- package/lib/{prefetchDocumentStorageService.d.mts → prefetchDocumentStorageService.d.ts} +6 -2
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -0
- package/lib/{prefetchDocumentStorageService.mjs → prefetchDocumentStorageService.js} +7 -3
- package/lib/prefetchDocumentStorageService.js.map +1 -0
- package/lib/{rateLimiter.d.mts → rateLimiter.d.ts} +1 -1
- package/lib/rateLimiter.d.ts.map +1 -0
- package/lib/{rateLimiter.mjs → rateLimiter.js} +1 -1
- package/lib/rateLimiter.js.map +1 -0
- package/lib/{readAndParse.d.mts → readAndParse.d.ts} +1 -1
- package/lib/readAndParse.d.ts.map +1 -0
- package/lib/{readAndParse.mjs → readAndParse.js} +1 -1
- package/lib/readAndParse.js.map +1 -0
- package/lib/{runWithRetry.d.mts → runWithRetry.d.ts} +1 -1
- package/lib/runWithRetry.d.ts.map +1 -0
- package/lib/{runWithRetry.mjs → runWithRetry.js} +3 -3
- package/lib/runWithRetry.js.map +1 -0
- package/lib/storageUtils.d.ts +13 -0
- package/lib/storageUtils.d.ts.map +1 -0
- package/lib/storageUtils.js +13 -0
- package/lib/storageUtils.js.map +1 -0
- package/lib/{summaryForCreateNew.d.mts → summaryForCreateNew.d.ts} +1 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -0
- package/lib/{summaryForCreateNew.mjs → summaryForCreateNew.js} +1 -1
- package/lib/summaryForCreateNew.js.map +1 -0
- package/lib/test/insecureUrlResolverTest.spec.js +101 -0
- package/lib/test/insecureUrlResolverTest.spec.js.map +1 -0
- package/lib/test/parallelRequests.spec.js +186 -0
- package/lib/test/parallelRequests.spec.js.map +1 -0
- package/lib/test/rateLimiter.spec.js +85 -0
- package/lib/test/rateLimiter.spec.js.map +1 -0
- package/lib/test/runWithRetry.spec.js +180 -0
- package/lib/test/runWithRetry.spec.js.map +1 -0
- package/lib/test/summaryCompressionData.js +170 -0
- package/lib/test/summaryCompressionData.js.map +1 -0
- package/lib/test/summaryCompresssionTester.spec.js +429 -0
- package/lib/test/summaryCompresssionTester.spec.js.map +1 -0
- package/lib/test/types/validateDriverUtilsPrevious.generated.js +108 -0
- package/lib/test/types/validateDriverUtilsPrevious.generated.js.map +1 -0
- package/lib/{treeConversions.d.mts → treeConversions.d.ts} +1 -1
- package/lib/treeConversions.d.ts.map +1 -0
- package/lib/{treeConversions.mjs → treeConversions.js} +4 -3
- package/lib/treeConversions.js.map +1 -0
- package/package.json +82 -28
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +9 -3
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +4 -4
- package/src/adapters/compression/index.ts +3 -3
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +2 -2
- package/src/adapters/compression/summaryblob/index.ts +1 -1
- package/src/adapters/index.ts +2 -2
- package/src/adapters/predefinedAdapters.ts +1 -1
- package/src/documentServiceProxy.ts +9 -2
- package/src/documentStorageServiceProxy.ts +12 -4
- package/src/error.ts +2 -4
- package/src/index.ts +17 -16
- package/src/insecureUrlResolver.ts +8 -6
- package/src/network.ts +11 -16
- package/src/networkUtils.ts +3 -4
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +11 -11
- package/src/prefetchDocumentStorageService.ts +2 -2
- package/src/runWithRetry.ts +2 -2
- package/src/storageUtils.ts +18 -0
- package/src/treeConversions.ts +3 -2
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/adapters/compression/compressionTypes.d.mts.map +0 -1
- package/lib/adapters/compression/compressionTypes.mjs.map +0 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.mts.map +0 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.mjs.map +0 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.mts.map +0 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.mjs.map +0 -1
- package/lib/adapters/compression/index.d.mts.map +0 -1
- package/lib/adapters/compression/index.mjs.map +0 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.mts.map +0 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.mjs.map +0 -1
- package/lib/adapters/compression/summaryblob/index.d.mts.map +0 -1
- package/lib/adapters/compression/summaryblob/index.mjs.map +0 -1
- package/lib/adapters/index.d.mts.map +0 -1
- package/lib/adapters/index.mjs.map +0 -1
- package/lib/adapters/predefinedAdapters.d.mts.map +0 -1
- package/lib/adapters/predefinedAdapters.mjs.map +0 -1
- package/lib/blob.d.mts.map +0 -1
- package/lib/blob.mjs.map +0 -1
- package/lib/buildSnapshotTree.d.mts.map +0 -1
- package/lib/buildSnapshotTree.mjs.map +0 -1
- package/lib/documentServiceFactoryProxy.d.mts.map +0 -1
- package/lib/documentServiceFactoryProxy.mjs.map +0 -1
- package/lib/documentServiceProxy.d.mts.map +0 -1
- package/lib/documentServiceProxy.mjs.map +0 -1
- package/lib/documentStorageServiceProxy.d.mts.map +0 -1
- package/lib/documentStorageServiceProxy.mjs.map +0 -1
- package/lib/error.d.mts.map +0 -1
- package/lib/error.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/lib/insecureUrlResolver.d.mts.map +0 -1
- package/lib/insecureUrlResolver.mjs.map +0 -1
- package/lib/messageRecognition.d.mts.map +0 -1
- package/lib/messageRecognition.mjs.map +0 -1
- package/lib/network.d.mts.map +0 -1
- package/lib/network.mjs.map +0 -1
- package/lib/networkUtils.d.mts +0 -11
- package/lib/networkUtils.d.mts.map +0 -1
- package/lib/networkUtils.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/parallelRequests.d.mts.map +0 -1
- package/lib/parallelRequests.mjs.map +0 -1
- package/lib/prefetchDocumentStorageService.d.mts.map +0 -1
- package/lib/prefetchDocumentStorageService.mjs.map +0 -1
- package/lib/rateLimiter.d.mts.map +0 -1
- package/lib/rateLimiter.mjs.map +0 -1
- package/lib/readAndParse.d.mts.map +0 -1
- package/lib/readAndParse.mjs.map +0 -1
- package/lib/runWithRetry.d.mts.map +0 -1
- package/lib/runWithRetry.mjs.map +0 -1
- package/lib/summaryForCreateNew.d.mts.map +0 -1
- package/lib/summaryForCreateNew.mjs.map +0 -1
- package/lib/treeConversions.d.mts.map +0 -1
- package/lib/treeConversions.mjs.map +0 -1
|
@@ -16,15 +16,17 @@ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
|
|
|
16
16
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
17
17
|
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
18
18
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISnapshot } from '@fluidframework/driver-definitions';
|
|
20
|
+
import { ISnapshotFetchOptions } from '@fluidframework/driver-definitions';
|
|
19
21
|
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
20
22
|
import { IStream } from '@fluidframework/driver-definitions';
|
|
21
23
|
import { IStreamResult } from '@fluidframework/driver-definitions';
|
|
22
24
|
import { ISummaryContext } from '@fluidframework/driver-definitions';
|
|
23
25
|
import { ISummaryHandle } from '@fluidframework/protocol-definitions';
|
|
24
26
|
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
25
|
-
import {
|
|
27
|
+
import { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
|
|
28
|
+
import { ITelemetryErrorEventExt } from '@fluidframework/telemetry-utils';
|
|
26
29
|
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
27
|
-
import { ITelemetryProperties } from '@fluidframework/core-interfaces';
|
|
28
30
|
import { IThrottlingWarning } from '@fluidframework/driver-definitions';
|
|
29
31
|
import { ITree } from '@fluidframework/protocol-definitions';
|
|
30
32
|
import { ITreeEntry } from '@fluidframework/protocol-definitions';
|
|
@@ -67,7 +69,7 @@ export declare class AttachmentTreeEntry {
|
|
|
67
69
|
export declare class AuthorizationError extends LoggingError implements IAuthorizationError, IFluidErrorBase {
|
|
68
70
|
readonly claims: string | undefined;
|
|
69
71
|
readonly tenantId: string | undefined;
|
|
70
|
-
readonly errorType
|
|
72
|
+
readonly errorType: "authorizationError";
|
|
71
73
|
readonly canRetry = false;
|
|
72
74
|
constructor(message: string, claims: string | undefined, tenantId: string | undefined, props: DriverErrorTelemetryProps);
|
|
73
75
|
}
|
|
@@ -168,8 +170,8 @@ export declare const createWriteError: (message: string, props: DriverErrorTelem
|
|
|
168
170
|
* @internal
|
|
169
171
|
*/
|
|
170
172
|
export declare class DeltaStreamConnectionForbiddenError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
171
|
-
static readonly errorType
|
|
172
|
-
readonly errorType
|
|
173
|
+
static readonly errorType: "deltaStreamConnectionForbidden";
|
|
174
|
+
readonly errorType: "deltaStreamConnectionForbidden";
|
|
173
175
|
readonly canRetry = false;
|
|
174
176
|
readonly storageOnlyReason: string | undefined;
|
|
175
177
|
constructor(message: string, props: DriverErrorTelemetryProps, storageOnlyReason?: string);
|
|
@@ -183,9 +185,9 @@ export declare class DocumentStorageServiceProxy implements IDocumentStorageServ
|
|
|
183
185
|
private _policies;
|
|
184
186
|
set policies(policies: IDocumentStorageServicePolicies | undefined);
|
|
185
187
|
get policies(): IDocumentStorageServicePolicies | undefined;
|
|
186
|
-
get repositoryUrl(): string;
|
|
187
188
|
constructor(internalStorageService: IDocumentStorageService);
|
|
188
189
|
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
|
|
190
|
+
getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
|
|
189
191
|
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>;
|
|
190
192
|
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
191
193
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
@@ -197,7 +199,7 @@ export declare class DocumentStorageServiceProxy implements IDocumentStorageServ
|
|
|
197
199
|
* Telemetry props with driver-specific required properties
|
|
198
200
|
* @internal
|
|
199
201
|
*/
|
|
200
|
-
export declare type DriverErrorTelemetryProps =
|
|
202
|
+
export declare type DriverErrorTelemetryProps = ITelemetryBaseProperties & {
|
|
201
203
|
driverVersion: string | undefined;
|
|
202
204
|
};
|
|
203
205
|
|
|
@@ -211,7 +213,7 @@ export declare const emptyMessageStream: IStream<ISequencedDocumentMessage[]>;
|
|
|
211
213
|
* @internal
|
|
212
214
|
*/
|
|
213
215
|
export declare class FluidInvalidSchemaError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
214
|
-
readonly errorType
|
|
216
|
+
readonly errorType: "fluidInvalidSchema";
|
|
215
217
|
readonly canRetry = false;
|
|
216
218
|
constructor(message: string, props: DriverErrorTelemetryProps);
|
|
217
219
|
}
|
|
@@ -222,7 +224,10 @@ export declare class FluidInvalidSchemaError extends LoggingError implements IDr
|
|
|
222
224
|
*/
|
|
223
225
|
export declare class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
224
226
|
readonly canRetry: boolean;
|
|
225
|
-
|
|
227
|
+
/**
|
|
228
|
+
* {@inheritDoc @fluidframework/telemetry-utils#IFluidErrorBase.errorType}
|
|
229
|
+
*/
|
|
230
|
+
readonly errorType: "genericNetworkError";
|
|
226
231
|
constructor(message: string, canRetry: boolean, props: DriverErrorTelemetryProps);
|
|
227
232
|
}
|
|
228
233
|
|
|
@@ -268,7 +273,7 @@ export declare interface ICompressionStorageConfig {
|
|
|
268
273
|
* http://localhost:8080/<documentId>/<path>.
|
|
269
274
|
*
|
|
270
275
|
* We then need to map that to a Fluid based URL. These are of the form
|
|
271
|
-
*
|
|
276
|
+
* https://orderingUrl/<tenantId>/<documentId>/<path>.
|
|
272
277
|
*
|
|
273
278
|
* The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
|
|
274
279
|
* part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
|
|
@@ -279,11 +284,12 @@ export declare class InsecureUrlResolver implements IUrlResolver {
|
|
|
279
284
|
private readonly hostUrl;
|
|
280
285
|
private readonly ordererUrl;
|
|
281
286
|
private readonly storageUrl;
|
|
287
|
+
private readonly deltaStreamUrl;
|
|
282
288
|
private readonly tenantId;
|
|
283
289
|
private readonly bearer;
|
|
284
290
|
private readonly isForNodeTest;
|
|
285
291
|
private readonly cache;
|
|
286
|
-
constructor(hostUrl: string, ordererUrl: string, storageUrl: string, tenantId: string, bearer: string, isForNodeTest?: boolean);
|
|
292
|
+
constructor(hostUrl: string, ordererUrl: string, storageUrl: string, deltaStreamUrl: string, tenantId: string, bearer: string, isForNodeTest?: boolean);
|
|
287
293
|
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
288
294
|
private resolveHelper;
|
|
289
295
|
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
@@ -329,6 +335,13 @@ export declare interface IProgress {
|
|
|
329
335
|
*/
|
|
330
336
|
export declare function isCombinedAppAndProtocolSummary(summary: ISummaryTree | undefined, ...optionalRootTrees: string[]): summary is CombinedAppAndProtocolSummary;
|
|
331
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Utility API to check if the type of snapshot contents is `ISnapshot`.
|
|
340
|
+
* @internal
|
|
341
|
+
* @param obj - obj whose type needs to be identified.
|
|
342
|
+
*/
|
|
343
|
+
export declare function isInstanceOfISnapshot(obj: ISnapshotTree | ISnapshot | undefined): obj is ISnapshot;
|
|
344
|
+
|
|
332
345
|
/**
|
|
333
346
|
* It tells if we have local connection only - we might not have connection to web.
|
|
334
347
|
* No solution for node.js (other than resolve dns names / ping specific sites)
|
|
@@ -352,7 +365,7 @@ export declare function isRuntimeMessage(message: {
|
|
|
352
365
|
*/
|
|
353
366
|
export declare class LocationRedirectionError extends LoggingError implements ILocationRedirectionError, IFluidErrorBase {
|
|
354
367
|
readonly redirectUrl: IResolvedUrl;
|
|
355
|
-
readonly errorType
|
|
368
|
+
readonly errorType: "locationRedirection";
|
|
356
369
|
readonly canRetry = false;
|
|
357
370
|
constructor(message: string, redirectUrl: IResolvedUrl, props: DriverErrorTelemetryProps);
|
|
358
371
|
}
|
|
@@ -360,7 +373,7 @@ export declare class LocationRedirectionError extends LoggingError implements IL
|
|
|
360
373
|
/**
|
|
361
374
|
* @internal
|
|
362
375
|
*/
|
|
363
|
-
export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event:
|
|
376
|
+
export declare function logNetworkFailure(logger: ITelemetryLoggerExt, event: ITelemetryErrorEventExt, error?: any): void;
|
|
364
377
|
|
|
365
378
|
/**
|
|
366
379
|
* @privateRemarks ADO #1385: staging code changes across layers.
|
|
@@ -426,7 +439,7 @@ export declare class ParallelRequests<T> {
|
|
|
426
439
|
private readonly knewTo;
|
|
427
440
|
private get working();
|
|
428
441
|
get canceled(): boolean;
|
|
429
|
-
constructor(from: number, to: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, requestCallback: (request: number, from: number, to: number, strongTo: boolean, props:
|
|
442
|
+
constructor(from: number, to: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, requestCallback: (request: number, from: number, to: number, strongTo: boolean, props: ITelemetryBaseProperties) => Promise<{
|
|
430
443
|
partial: boolean;
|
|
431
444
|
cancel: boolean;
|
|
432
445
|
payload: T[];
|
|
@@ -516,7 +529,7 @@ export declare function readAndParse<T>(storage: Pick<IDocumentStorageService, "
|
|
|
516
529
|
* @returns Messages fetched
|
|
517
530
|
* @internal
|
|
518
531
|
*/
|
|
519
|
-
export declare function requestOps(get: (from: number, to: number, telemetryProps:
|
|
532
|
+
export declare function requestOps(get: (from: number, to: number, telemetryProps: ITelemetryBaseProperties) => Promise<IDeltasFetchResult>, concurrency: number, fromTotal: number, toTotal: number | undefined, payloadSize: number, logger: ITelemetryLoggerExt, signal?: AbortSignal, scenarioName?: string): IStream<ISequencedDocumentMessage[]>;
|
|
520
533
|
|
|
521
534
|
/**
|
|
522
535
|
* @internal
|
|
@@ -555,7 +568,7 @@ export declare enum SummaryCompressionAlgorithm {
|
|
|
555
568
|
*/
|
|
556
569
|
export declare class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {
|
|
557
570
|
readonly retryAfterSeconds: number;
|
|
558
|
-
readonly errorType
|
|
571
|
+
readonly errorType: "throttlingError";
|
|
559
572
|
readonly canRetry = true;
|
|
560
573
|
constructor(message: string, retryAfterSeconds: number, props: DriverErrorTelemetryProps);
|
|
561
574
|
}
|
|
@@ -582,7 +595,7 @@ export declare class TreeTreeEntry {
|
|
|
582
595
|
* @internal
|
|
583
596
|
*/
|
|
584
597
|
export declare class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
585
|
-
readonly errorType
|
|
598
|
+
readonly errorType: "usageError";
|
|
586
599
|
readonly canRetry = false;
|
|
587
600
|
constructor(message: string);
|
|
588
601
|
}
|
package/dist/error.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { IDriverErrorBase } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { IFluidErrorBase, LoggingError } from "@fluidframework/telemetry-utils";
|
|
7
7
|
/**
|
|
8
8
|
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare class UsageError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {
|
|
12
|
-
readonly errorType
|
|
12
|
+
readonly errorType: "usageError";
|
|
13
13
|
readonly canRetry = false;
|
|
14
14
|
constructor(message: string);
|
|
15
15
|
}
|
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;
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoB,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF;;;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
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.UsageError = void 0;
|
|
8
|
-
// eslint-disable-next-line import/no-deprecated
|
|
9
8
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
10
9
|
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
11
10
|
/**
|
|
@@ -15,8 +14,7 @@ const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
|
15
14
|
class UsageError extends telemetry_utils_1.LoggingError {
|
|
16
15
|
constructor(message) {
|
|
17
16
|
super(message, { usageError: true });
|
|
18
|
-
|
|
19
|
-
this.errorType = driver_definitions_1.DriverErrorType.usageError;
|
|
17
|
+
this.errorType = driver_definitions_1.DriverErrorTypes.usageError;
|
|
20
18
|
this.canRetry = false;
|
|
21
19
|
}
|
|
22
20
|
}
|
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2EAAwF;AACxF,qEAAgF;AAEhF;;;GAGG;AACH,MAAa,UAAW,SAAQ,8BAAY;IAI3C,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAJ7B,cAAS,GAAG,qCAAgB,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 { DriverErrorTypes, IDriverErrorBase } from \"@fluidframework/driver-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\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
|
@@ -2,20 +2,21 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { buildSnapshotTree } from "./buildSnapshotTree";
|
|
6
|
-
export { BlobTreeEntry, TreeTreeEntry, AttachmentTreeEntry } from "./blob";
|
|
7
|
-
export { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
8
|
-
export { UsageError } from "./error";
|
|
9
|
-
export { InsecureUrlResolver } from "./insecureUrlResolver";
|
|
10
|
-
export { canBeCoalescedByService, isRuntimeMessage, MessageType2 } from "./messageRecognition";
|
|
11
|
-
export { AuthorizationError, canRetryOnError, createGenericNetworkError, createWriteError, DeltaStreamConnectionForbiddenError, DriverErrorTelemetryProps, FluidInvalidSchemaError, GenericNetworkError, getRetryDelayFromError, getRetryDelaySecondsFromError, isOnline, LocationRedirectionError, NetworkErrorBasic, NonRetryableError, OnlineStatus, RetryableError, ThrottlingError, } from "./network";
|
|
12
|
-
export { logNetworkFailure } from "./networkUtils";
|
|
13
|
-
export { emptyMessageStream, ParallelRequests, Queue, requestOps, streamFromMessages, streamObserver, } from "./parallelRequests";
|
|
14
|
-
export { PrefetchDocumentStorageService } from "./prefetchDocumentStorageService";
|
|
15
|
-
export { RateLimiter } from "./rateLimiter";
|
|
16
|
-
export { readAndParse } from "./readAndParse";
|
|
17
|
-
export { calculateMaxWaitTime, IProgress, runWithRetry } from "./runWithRetry";
|
|
18
|
-
export { CombinedAppAndProtocolSummary, getDocAttributesFromProtocolSummary, getQuorumValuesFromProtocolSummary, isCombinedAppAndProtocolSummary, } from "./summaryForCreateNew";
|
|
19
|
-
export { convertSummaryTreeToSnapshotITree } from "./treeConversions";
|
|
20
|
-
export { applyStorageCompression, ICompressionStorageConfig, SummaryCompressionAlgorithm, blobHeadersBlobName, } from "./adapters";
|
|
5
|
+
export { buildSnapshotTree } from "./buildSnapshotTree.js";
|
|
6
|
+
export { BlobTreeEntry, TreeTreeEntry, AttachmentTreeEntry } from "./blob.js";
|
|
7
|
+
export { DocumentStorageServiceProxy } from "./documentStorageServiceProxy.js";
|
|
8
|
+
export { UsageError } from "./error.js";
|
|
9
|
+
export { InsecureUrlResolver } from "./insecureUrlResolver.js";
|
|
10
|
+
export { canBeCoalescedByService, isRuntimeMessage, MessageType2 } 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";
|
|
12
|
+
export { logNetworkFailure } from "./networkUtils.js";
|
|
13
|
+
export { emptyMessageStream, ParallelRequests, Queue, requestOps, streamFromMessages, streamObserver, } from "./parallelRequests.js";
|
|
14
|
+
export { PrefetchDocumentStorageService } from "./prefetchDocumentStorageService.js";
|
|
15
|
+
export { RateLimiter } from "./rateLimiter.js";
|
|
16
|
+
export { readAndParse } from "./readAndParse.js";
|
|
17
|
+
export { calculateMaxWaitTime, IProgress, runWithRetry } from "./runWithRetry.js";
|
|
18
|
+
export { CombinedAppAndProtocolSummary, getDocAttributesFromProtocolSummary, getQuorumValuesFromProtocolSummary, isCombinedAppAndProtocolSummary, } from "./summaryForCreateNew.js";
|
|
19
|
+
export { convertSummaryTreeToSnapshotITree } from "./treeConversions.js";
|
|
20
|
+
export { applyStorageCompression, ICompressionStorageConfig, SummaryCompressionAlgorithm, blobHeadersBlobName, } from "./adapters/index.js";
|
|
21
|
+
export { isInstanceOfISnapshot } from "./storageUtils.js";
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
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,
|
|
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;AAC9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 +4,68 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.blobHeadersBlobName = exports.SummaryCompressionAlgorithm = exports.applyStorageCompression = exports.convertSummaryTreeToSnapshotITree = exports.isCombinedAppAndProtocolSummary = exports.getQuorumValuesFromProtocolSummary = exports.getDocAttributesFromProtocolSummary = exports.runWithRetry = exports.calculateMaxWaitTime = exports.readAndParse = exports.RateLimiter = exports.PrefetchDocumentStorageService = exports.streamObserver = exports.streamFromMessages = exports.requestOps = exports.Queue = exports.ParallelRequests = exports.emptyMessageStream = exports.logNetworkFailure = exports.ThrottlingError = exports.RetryableError = exports.OnlineStatus = exports.NonRetryableError = exports.NetworkErrorBasic = exports.LocationRedirectionError = exports.isOnline = exports.getRetryDelaySecondsFromError = exports.getRetryDelayFromError = exports.GenericNetworkError = exports.FluidInvalidSchemaError = exports.DeltaStreamConnectionForbiddenError = exports.createWriteError = exports.createGenericNetworkError = exports.canRetryOnError = exports.AuthorizationError = exports.MessageType2 = exports.isRuntimeMessage = exports.canBeCoalescedByService = exports.InsecureUrlResolver = exports.UsageError = exports.DocumentStorageServiceProxy = exports.AttachmentTreeEntry = exports.TreeTreeEntry = exports.BlobTreeEntry = exports.buildSnapshotTree = void 0;
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "buildSnapshotTree", { enumerable: true, get: function () { return
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "BlobTreeEntry", { enumerable: true, get: function () { return
|
|
12
|
-
Object.defineProperty(exports, "TreeTreeEntry", { enumerable: true, get: function () { return
|
|
13
|
-
Object.defineProperty(exports, "AttachmentTreeEntry", { enumerable: true, get: function () { return
|
|
14
|
-
var
|
|
15
|
-
Object.defineProperty(exports, "DocumentStorageServiceProxy", { enumerable: true, get: function () { return
|
|
16
|
-
var
|
|
17
|
-
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(exports, "InsecureUrlResolver", { enumerable: true, get: function () { return
|
|
20
|
-
var
|
|
21
|
-
Object.defineProperty(exports, "canBeCoalescedByService", { enumerable: true, get: function () { return
|
|
22
|
-
Object.defineProperty(exports, "isRuntimeMessage", { enumerable: true, get: function () { return
|
|
23
|
-
Object.defineProperty(exports, "MessageType2", { enumerable: true, get: function () { return
|
|
24
|
-
var
|
|
25
|
-
Object.defineProperty(exports, "AuthorizationError", { enumerable: true, get: function () { return
|
|
26
|
-
Object.defineProperty(exports, "canRetryOnError", { enumerable: true, get: function () { return
|
|
27
|
-
Object.defineProperty(exports, "createGenericNetworkError", { enumerable: true, get: function () { return
|
|
28
|
-
Object.defineProperty(exports, "createWriteError", { enumerable: true, get: function () { return
|
|
29
|
-
Object.defineProperty(exports, "DeltaStreamConnectionForbiddenError", { enumerable: true, get: function () { return
|
|
30
|
-
Object.defineProperty(exports, "FluidInvalidSchemaError", { enumerable: true, get: function () { return
|
|
31
|
-
Object.defineProperty(exports, "GenericNetworkError", { enumerable: true, get: function () { return
|
|
32
|
-
Object.defineProperty(exports, "getRetryDelayFromError", { enumerable: true, get: function () { return
|
|
33
|
-
Object.defineProperty(exports, "getRetryDelaySecondsFromError", { enumerable: true, get: function () { return
|
|
34
|
-
Object.defineProperty(exports, "isOnline", { enumerable: true, get: function () { return
|
|
35
|
-
Object.defineProperty(exports, "LocationRedirectionError", { enumerable: true, get: function () { return
|
|
36
|
-
Object.defineProperty(exports, "NetworkErrorBasic", { enumerable: true, get: function () { return
|
|
37
|
-
Object.defineProperty(exports, "NonRetryableError", { enumerable: true, get: function () { return
|
|
38
|
-
Object.defineProperty(exports, "OnlineStatus", { enumerable: true, get: function () { return
|
|
39
|
-
Object.defineProperty(exports, "RetryableError", { enumerable: true, get: function () { return
|
|
40
|
-
Object.defineProperty(exports, "ThrottlingError", { enumerable: true, get: function () { return
|
|
41
|
-
var
|
|
42
|
-
Object.defineProperty(exports, "logNetworkFailure", { enumerable: true, get: function () { return
|
|
43
|
-
var
|
|
44
|
-
Object.defineProperty(exports, "emptyMessageStream", { enumerable: true, get: function () { return
|
|
45
|
-
Object.defineProperty(exports, "ParallelRequests", { enumerable: true, get: function () { return
|
|
46
|
-
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return
|
|
47
|
-
Object.defineProperty(exports, "requestOps", { enumerable: true, get: function () { return
|
|
48
|
-
Object.defineProperty(exports, "streamFromMessages", { enumerable: true, get: function () { return
|
|
49
|
-
Object.defineProperty(exports, "streamObserver", { enumerable: true, get: function () { return
|
|
50
|
-
var
|
|
51
|
-
Object.defineProperty(exports, "PrefetchDocumentStorageService", { enumerable: true, get: function () { return
|
|
52
|
-
var
|
|
53
|
-
Object.defineProperty(exports, "RateLimiter", { enumerable: true, get: function () { return
|
|
54
|
-
var
|
|
55
|
-
Object.defineProperty(exports, "readAndParse", { enumerable: true, get: function () { return
|
|
56
|
-
var
|
|
57
|
-
Object.defineProperty(exports, "calculateMaxWaitTime", { enumerable: true, get: function () { return
|
|
58
|
-
Object.defineProperty(exports, "runWithRetry", { enumerable: true, get: function () { return
|
|
59
|
-
var
|
|
60
|
-
Object.defineProperty(exports, "getDocAttributesFromProtocolSummary", { enumerable: true, get: function () { return
|
|
61
|
-
Object.defineProperty(exports, "getQuorumValuesFromProtocolSummary", { enumerable: true, get: function () { return
|
|
62
|
-
Object.defineProperty(exports, "isCombinedAppAndProtocolSummary", { enumerable: true, get: function () { return
|
|
63
|
-
var
|
|
64
|
-
Object.defineProperty(exports, "convertSummaryTreeToSnapshotITree", { enumerable: true, get: function () { return
|
|
65
|
-
var
|
|
66
|
-
Object.defineProperty(exports, "applyStorageCompression", { enumerable: true, get: function () { return
|
|
67
|
-
Object.defineProperty(exports, "SummaryCompressionAlgorithm", { enumerable: true, get: function () { return
|
|
68
|
-
Object.defineProperty(exports, "blobHeadersBlobName", { enumerable: true, get: function () { return
|
|
7
|
+
exports.isInstanceOfISnapshot = exports.blobHeadersBlobName = exports.SummaryCompressionAlgorithm = exports.applyStorageCompression = exports.convertSummaryTreeToSnapshotITree = exports.isCombinedAppAndProtocolSummary = exports.getQuorumValuesFromProtocolSummary = exports.getDocAttributesFromProtocolSummary = exports.runWithRetry = exports.calculateMaxWaitTime = exports.readAndParse = exports.RateLimiter = exports.PrefetchDocumentStorageService = exports.streamObserver = exports.streamFromMessages = exports.requestOps = exports.Queue = exports.ParallelRequests = exports.emptyMessageStream = exports.logNetworkFailure = exports.ThrottlingError = exports.RetryableError = exports.OnlineStatus = exports.NonRetryableError = exports.NetworkErrorBasic = exports.LocationRedirectionError = exports.isOnline = exports.getRetryDelaySecondsFromError = exports.getRetryDelayFromError = exports.GenericNetworkError = exports.FluidInvalidSchemaError = exports.DeltaStreamConnectionForbiddenError = exports.createWriteError = exports.createGenericNetworkError = exports.canRetryOnError = exports.AuthorizationError = exports.MessageType2 = exports.isRuntimeMessage = exports.canBeCoalescedByService = exports.InsecureUrlResolver = exports.UsageError = exports.DocumentStorageServiceProxy = exports.AttachmentTreeEntry = exports.TreeTreeEntry = exports.BlobTreeEntry = exports.buildSnapshotTree = void 0;
|
|
8
|
+
var buildSnapshotTree_js_1 = require("./buildSnapshotTree.js");
|
|
9
|
+
Object.defineProperty(exports, "buildSnapshotTree", { enumerable: true, get: function () { return buildSnapshotTree_js_1.buildSnapshotTree; } });
|
|
10
|
+
var blob_js_1 = require("./blob.js");
|
|
11
|
+
Object.defineProperty(exports, "BlobTreeEntry", { enumerable: true, get: function () { return blob_js_1.BlobTreeEntry; } });
|
|
12
|
+
Object.defineProperty(exports, "TreeTreeEntry", { enumerable: true, get: function () { return blob_js_1.TreeTreeEntry; } });
|
|
13
|
+
Object.defineProperty(exports, "AttachmentTreeEntry", { enumerable: true, get: function () { return blob_js_1.AttachmentTreeEntry; } });
|
|
14
|
+
var documentStorageServiceProxy_js_1 = require("./documentStorageServiceProxy.js");
|
|
15
|
+
Object.defineProperty(exports, "DocumentStorageServiceProxy", { enumerable: true, get: function () { return documentStorageServiceProxy_js_1.DocumentStorageServiceProxy; } });
|
|
16
|
+
var error_js_1 = require("./error.js");
|
|
17
|
+
Object.defineProperty(exports, "UsageError", { enumerable: true, get: function () { return error_js_1.UsageError; } });
|
|
18
|
+
var insecureUrlResolver_js_1 = require("./insecureUrlResolver.js");
|
|
19
|
+
Object.defineProperty(exports, "InsecureUrlResolver", { enumerable: true, get: function () { return insecureUrlResolver_js_1.InsecureUrlResolver; } });
|
|
20
|
+
var messageRecognition_js_1 = require("./messageRecognition.js");
|
|
21
|
+
Object.defineProperty(exports, "canBeCoalescedByService", { enumerable: true, get: function () { return messageRecognition_js_1.canBeCoalescedByService; } });
|
|
22
|
+
Object.defineProperty(exports, "isRuntimeMessage", { enumerable: true, get: function () { return messageRecognition_js_1.isRuntimeMessage; } });
|
|
23
|
+
Object.defineProperty(exports, "MessageType2", { enumerable: true, get: function () { return messageRecognition_js_1.MessageType2; } });
|
|
24
|
+
var network_js_1 = require("./network.js");
|
|
25
|
+
Object.defineProperty(exports, "AuthorizationError", { enumerable: true, get: function () { return network_js_1.AuthorizationError; } });
|
|
26
|
+
Object.defineProperty(exports, "canRetryOnError", { enumerable: true, get: function () { return network_js_1.canRetryOnError; } });
|
|
27
|
+
Object.defineProperty(exports, "createGenericNetworkError", { enumerable: true, get: function () { return network_js_1.createGenericNetworkError; } });
|
|
28
|
+
Object.defineProperty(exports, "createWriteError", { enumerable: true, get: function () { return network_js_1.createWriteError; } });
|
|
29
|
+
Object.defineProperty(exports, "DeltaStreamConnectionForbiddenError", { enumerable: true, get: function () { return network_js_1.DeltaStreamConnectionForbiddenError; } });
|
|
30
|
+
Object.defineProperty(exports, "FluidInvalidSchemaError", { enumerable: true, get: function () { return network_js_1.FluidInvalidSchemaError; } });
|
|
31
|
+
Object.defineProperty(exports, "GenericNetworkError", { enumerable: true, get: function () { return network_js_1.GenericNetworkError; } });
|
|
32
|
+
Object.defineProperty(exports, "getRetryDelayFromError", { enumerable: true, get: function () { return network_js_1.getRetryDelayFromError; } });
|
|
33
|
+
Object.defineProperty(exports, "getRetryDelaySecondsFromError", { enumerable: true, get: function () { return network_js_1.getRetryDelaySecondsFromError; } });
|
|
34
|
+
Object.defineProperty(exports, "isOnline", { enumerable: true, get: function () { return network_js_1.isOnline; } });
|
|
35
|
+
Object.defineProperty(exports, "LocationRedirectionError", { enumerable: true, get: function () { return network_js_1.LocationRedirectionError; } });
|
|
36
|
+
Object.defineProperty(exports, "NetworkErrorBasic", { enumerable: true, get: function () { return network_js_1.NetworkErrorBasic; } });
|
|
37
|
+
Object.defineProperty(exports, "NonRetryableError", { enumerable: true, get: function () { return network_js_1.NonRetryableError; } });
|
|
38
|
+
Object.defineProperty(exports, "OnlineStatus", { enumerable: true, get: function () { return network_js_1.OnlineStatus; } });
|
|
39
|
+
Object.defineProperty(exports, "RetryableError", { enumerable: true, get: function () { return network_js_1.RetryableError; } });
|
|
40
|
+
Object.defineProperty(exports, "ThrottlingError", { enumerable: true, get: function () { return network_js_1.ThrottlingError; } });
|
|
41
|
+
var networkUtils_js_1 = require("./networkUtils.js");
|
|
42
|
+
Object.defineProperty(exports, "logNetworkFailure", { enumerable: true, get: function () { return networkUtils_js_1.logNetworkFailure; } });
|
|
43
|
+
var parallelRequests_js_1 = require("./parallelRequests.js");
|
|
44
|
+
Object.defineProperty(exports, "emptyMessageStream", { enumerable: true, get: function () { return parallelRequests_js_1.emptyMessageStream; } });
|
|
45
|
+
Object.defineProperty(exports, "ParallelRequests", { enumerable: true, get: function () { return parallelRequests_js_1.ParallelRequests; } });
|
|
46
|
+
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return parallelRequests_js_1.Queue; } });
|
|
47
|
+
Object.defineProperty(exports, "requestOps", { enumerable: true, get: function () { return parallelRequests_js_1.requestOps; } });
|
|
48
|
+
Object.defineProperty(exports, "streamFromMessages", { enumerable: true, get: function () { return parallelRequests_js_1.streamFromMessages; } });
|
|
49
|
+
Object.defineProperty(exports, "streamObserver", { enumerable: true, get: function () { return parallelRequests_js_1.streamObserver; } });
|
|
50
|
+
var prefetchDocumentStorageService_js_1 = require("./prefetchDocumentStorageService.js");
|
|
51
|
+
Object.defineProperty(exports, "PrefetchDocumentStorageService", { enumerable: true, get: function () { return prefetchDocumentStorageService_js_1.PrefetchDocumentStorageService; } });
|
|
52
|
+
var rateLimiter_js_1 = require("./rateLimiter.js");
|
|
53
|
+
Object.defineProperty(exports, "RateLimiter", { enumerable: true, get: function () { return rateLimiter_js_1.RateLimiter; } });
|
|
54
|
+
var readAndParse_js_1 = require("./readAndParse.js");
|
|
55
|
+
Object.defineProperty(exports, "readAndParse", { enumerable: true, get: function () { return readAndParse_js_1.readAndParse; } });
|
|
56
|
+
var runWithRetry_js_1 = require("./runWithRetry.js");
|
|
57
|
+
Object.defineProperty(exports, "calculateMaxWaitTime", { enumerable: true, get: function () { return runWithRetry_js_1.calculateMaxWaitTime; } });
|
|
58
|
+
Object.defineProperty(exports, "runWithRetry", { enumerable: true, get: function () { return runWithRetry_js_1.runWithRetry; } });
|
|
59
|
+
var summaryForCreateNew_js_1 = require("./summaryForCreateNew.js");
|
|
60
|
+
Object.defineProperty(exports, "getDocAttributesFromProtocolSummary", { enumerable: true, get: function () { return summaryForCreateNew_js_1.getDocAttributesFromProtocolSummary; } });
|
|
61
|
+
Object.defineProperty(exports, "getQuorumValuesFromProtocolSummary", { enumerable: true, get: function () { return summaryForCreateNew_js_1.getQuorumValuesFromProtocolSummary; } });
|
|
62
|
+
Object.defineProperty(exports, "isCombinedAppAndProtocolSummary", { enumerable: true, get: function () { return summaryForCreateNew_js_1.isCombinedAppAndProtocolSummary; } });
|
|
63
|
+
var treeConversions_js_1 = require("./treeConversions.js");
|
|
64
|
+
Object.defineProperty(exports, "convertSummaryTreeToSnapshotITree", { enumerable: true, get: function () { return treeConversions_js_1.convertSummaryTreeToSnapshotITree; } });
|
|
65
|
+
var index_js_1 = require("./adapters/index.js");
|
|
66
|
+
Object.defineProperty(exports, "applyStorageCompression", { enumerable: true, get: function () { return index_js_1.applyStorageCompression; } });
|
|
67
|
+
Object.defineProperty(exports, "SummaryCompressionAlgorithm", { enumerable: true, get: function () { return index_js_1.SummaryCompressionAlgorithm; } });
|
|
68
|
+
Object.defineProperty(exports, "blobHeadersBlobName", { enumerable: true, get: function () { return index_js_1.blobHeadersBlobName; } });
|
|
69
|
+
var storageUtils_js_1 = require("./storageUtils.js");
|
|
70
|
+
Object.defineProperty(exports, "isInstanceOfISnapshot", { enumerable: true, get: function () { return storageUtils_js_1.isInstanceOfISnapshot; } });
|
|
69
71
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA2D;AAAlD,yHAAA,iBAAiB,OAAA;AAC1B,qCAA8E;AAArE,wGAAA,aAAa,OAAA;AAAE,wGAAA,aAAa,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAC1D,mFAA+E;AAAtE,6IAAA,2BAA2B,OAAA;AACpC,uCAAwC;AAA/B,sGAAA,UAAU,OAAA;AACnB,mEAA+D;AAAtD,6HAAA,mBAAmB,OAAA;AAC5B,iEAAkG;AAAzF,gIAAA,uBAAuB,OAAA;AAAE,yHAAA,gBAAgB,OAAA;AAAE,qHAAA,YAAY,OAAA;AAChE,2CAkBsB;AAjBrB,gHAAA,kBAAkB,OAAA;AAClB,6GAAA,eAAe,OAAA;AACf,uHAAA,yBAAyB,OAAA;AACzB,8GAAA,gBAAgB,OAAA;AAChB,iIAAA,mCAAmC,OAAA;AAEnC,qHAAA,uBAAuB,OAAA;AACvB,iHAAA,mBAAmB,OAAA;AACnB,oHAAA,sBAAsB,OAAA;AACtB,2HAAA,6BAA6B,OAAA;AAC7B,sGAAA,QAAQ,OAAA;AACR,sHAAA,wBAAwB,OAAA;AACxB,+GAAA,iBAAiB,OAAA;AACjB,+GAAA,iBAAiB,OAAA;AACjB,0GAAA,YAAY,OAAA;AACZ,4GAAA,cAAc,OAAA;AACd,6GAAA,eAAe,OAAA;AAEhB,qDAAsD;AAA7C,oHAAA,iBAAiB,OAAA;AAC1B,6DAO+B;AAN9B,yHAAA,kBAAkB,OAAA;AAClB,uHAAA,gBAAgB,OAAA;AAChB,4GAAA,KAAK,OAAA;AACL,iHAAA,UAAU,OAAA;AACV,yHAAA,kBAAkB,OAAA;AAClB,qHAAA,cAAc,OAAA;AAEf,yFAAqF;AAA5E,mJAAA,8BAA8B,OAAA;AACvC,mDAA+C;AAAtC,6GAAA,WAAW,OAAA;AACpB,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,qDAAkF;AAAzE,uHAAA,oBAAoB,OAAA;AAAa,+GAAA,YAAY,OAAA;AACtD,mEAKkC;AAHjC,6IAAA,mCAAmC,OAAA;AACnC,4IAAA,kCAAkC,OAAA;AAClC,yIAAA,+BAA+B,OAAA;AAEhC,2DAAyE;AAAhE,uIAAA,iCAAiC,OAAA;AAC1C,gDAK6B;AAJ5B,mHAAA,uBAAuB,OAAA;AAEvB,uHAAA,2BAA2B,OAAA;AAC3B,+GAAA,mBAAmB,OAAA;AAEpB,qDAA0D;AAAjD,wHAAA,qBAAqB,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 { canBeCoalescedByService, isRuntimeMessage, MessageType2 } from \"./messageRecognition.js\";\nexport {\n\tAuthorizationError,\n\tcanRetryOnError,\n\tcreateGenericNetworkError,\n\tcreateWriteError,\n\tDeltaStreamConnectionForbiddenError,\n\tDriverErrorTelemetryProps,\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, IProgress, runWithRetry } from \"./runWithRetry.js\";\nexport {\n\tCombinedAppAndProtocolSummary,\n\tgetDocAttributesFromProtocolSummary,\n\tgetQuorumValuesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"./summaryForCreateNew.js\";\nexport { convertSummaryTreeToSnapshotITree } from \"./treeConversions.js\";\nexport {\n\tapplyStorageCompression,\n\tICompressionStorageConfig,\n\tSummaryCompressionAlgorithm,\n\tblobHeadersBlobName,\n} from \"./adapters/index.js\";\nexport { isInstanceOfISnapshot } from \"./storageUtils.js\";\n"]}
|
|
@@ -12,7 +12,7 @@ import { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions";
|
|
|
12
12
|
* http://localhost:8080/<documentId>/<path>.
|
|
13
13
|
*
|
|
14
14
|
* We then need to map that to a Fluid based URL. These are of the form
|
|
15
|
-
*
|
|
15
|
+
* https://orderingUrl/<tenantId>/<documentId>/<path>.
|
|
16
16
|
*
|
|
17
17
|
* The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
|
|
18
18
|
* part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
|
|
@@ -23,11 +23,12 @@ export declare class InsecureUrlResolver implements IUrlResolver {
|
|
|
23
23
|
private readonly hostUrl;
|
|
24
24
|
private readonly ordererUrl;
|
|
25
25
|
private readonly storageUrl;
|
|
26
|
+
private readonly deltaStreamUrl;
|
|
26
27
|
private readonly tenantId;
|
|
27
28
|
private readonly bearer;
|
|
28
29
|
private readonly isForNodeTest;
|
|
29
30
|
private readonly cache;
|
|
30
|
-
constructor(hostUrl: string, ordererUrl: string, storageUrl: string, tenantId: string, bearer: string, isForNodeTest?: boolean);
|
|
31
|
+
constructor(hostUrl: string, ordererUrl: string, storageUrl: string, deltaStreamUrl: string, tenantId: string, bearer: string, isForNodeTest?: boolean);
|
|
31
32
|
resolve(request: IRequest): Promise<IResolvedUrl | undefined>;
|
|
32
33
|
private resolveHelper;
|
|
33
34
|
getAbsoluteUrl(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"insecureUrlResolver.d.ts","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,oCAAoC,CAAC;AAG9F;;;;;;;;;;;;;;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,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBrF,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ;CAU1D"}
|
|
@@ -8,7 +8,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.InsecureUrlResolver = void 0;
|
|
11
|
-
const url_1 = require("url");
|
|
12
11
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
13
12
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
14
13
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -20,7 +19,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
20
19
|
* http://localhost:8080/<documentId>/<path>.
|
|
21
20
|
*
|
|
22
21
|
* We then need to map that to a Fluid based URL. These are of the form
|
|
23
|
-
*
|
|
22
|
+
* https://orderingUrl/<tenantId>/<documentId>/<path>.
|
|
24
23
|
*
|
|
25
24
|
* The tenantId/documentId pair defines the 'full' document ID the service makes use of. The path is then an optional
|
|
26
25
|
* part of the URL that the document interprets and maps to a data store. It's exactly similar to how a web service
|
|
@@ -28,10 +27,11 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
28
27
|
* @internal
|
|
29
28
|
*/
|
|
30
29
|
class InsecureUrlResolver {
|
|
31
|
-
constructor(hostUrl, ordererUrl, storageUrl, tenantId, bearer, isForNodeTest = false) {
|
|
30
|
+
constructor(hostUrl, ordererUrl, storageUrl, deltaStreamUrl, tenantId, bearer, isForNodeTest = false) {
|
|
32
31
|
this.hostUrl = hostUrl;
|
|
33
32
|
this.ordererUrl = ordererUrl;
|
|
34
33
|
this.storageUrl = storageUrl;
|
|
34
|
+
this.deltaStreamUrl = deltaStreamUrl;
|
|
35
35
|
this.tenantId = tenantId;
|
|
36
36
|
this.bearer = bearer;
|
|
37
37
|
this.isForNodeTest = isForNodeTest;
|
|
@@ -67,7 +67,7 @@ class InsecureUrlResolver {
|
|
|
67
67
|
const headers = {
|
|
68
68
|
Authorization: `Bearer ${this.bearer}`,
|
|
69
69
|
};
|
|
70
|
-
const resolvedP = axios_1.default.post(`${this.hostUrl}/
|
|
70
|
+
const resolvedP = axios_1.default.post(`${this.hostUrl}/apis/load`, {
|
|
71
71
|
url: request.url,
|
|
72
72
|
}, {
|
|
73
73
|
headers,
|
|
@@ -86,6 +86,7 @@ class InsecureUrlResolver {
|
|
|
86
86
|
const createNewResponse = {
|
|
87
87
|
endpoints: {
|
|
88
88
|
deltaStorageUrl: `${this.ordererUrl}/deltas/${encodedTenantId}/new`,
|
|
89
|
+
deltaStreamUrl: this.deltaStreamUrl,
|
|
89
90
|
ordererUrl: this.ordererUrl,
|
|
90
91
|
storageUrl: `${this.storageUrl}/repos/${encodedTenantId}`,
|
|
91
92
|
},
|
|
@@ -93,7 +94,7 @@ class InsecureUrlResolver {
|
|
|
93
94
|
id: "",
|
|
94
95
|
tokens: {},
|
|
95
96
|
type: "fluid",
|
|
96
|
-
url: `
|
|
97
|
+
url: `https://${host}/${encodedTenantId}/new`,
|
|
97
98
|
};
|
|
98
99
|
return createNewResponse;
|
|
99
100
|
}
|
|
@@ -101,12 +102,13 @@ class InsecureUrlResolver {
|
|
|
101
102
|
const relativePath = !documentRelativePath || documentRelativePath.startsWith("/")
|
|
102
103
|
? documentRelativePath
|
|
103
104
|
: `/${documentRelativePath}`;
|
|
104
|
-
const documentUrl = `
|
|
105
|
+
const documentUrl = `https://${host}/${encodedTenantId}/${encodedDocId}${relativePath}${queryParams}`;
|
|
105
106
|
const deltaStorageUrl = `${this.ordererUrl}/deltas/${encodedTenantId}/${encodedDocId}`;
|
|
106
107
|
const storageUrl = `${this.storageUrl}/repos/${encodedTenantId}`;
|
|
107
108
|
const response = {
|
|
108
109
|
endpoints: {
|
|
109
110
|
deltaStorageUrl,
|
|
111
|
+
deltaStreamUrl: this.deltaStreamUrl,
|
|
110
112
|
ordererUrl: this.ordererUrl,
|
|
111
113
|
storageUrl,
|
|
112
114
|
},
|
|
@@ -118,7 +120,7 @@ class InsecureUrlResolver {
|
|
|
118
120
|
return response;
|
|
119
121
|
}
|
|
120
122
|
async getAbsoluteUrl(resolvedUrl, relativeUrl) {
|
|
121
|
-
const parsedUrl =
|
|
123
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
122
124
|
const [, , documentId] = parsedUrl.pathname?.split("/") ?? [];
|
|
123
125
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
124
126
|
(0, core_utils_1.assert)(!!documentId, 0x273 /* "Invalid document id from parsed URL" */);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insecureUrlResolver.js","sourceRoot":"","sources":["../src/insecureUrlResolver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,6BAA4B;AAC5B,2DAAoD;AAEpD,2EAA8F;AAC9F,kDAA0B;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAa,mBAAmB;IAG/B,YACkB,OAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,QAAgB,EAChB,MAAc,EACd,gBAAyB,KAAK;QAL9B,YAAO,GAAP,OAAO,CAAQ;QACf,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,aAAQ,GA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E;QACzE,IAAA,mBAAM,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;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;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,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD;AAtID,kDAsIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { parse } from \"url\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver, DriverHeader } from \"@fluidframework/driver-definitions\";\nimport Axios from \"axios\";\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 * fluid://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 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 headers = {\n\t\t\t\tAuthorization: `Bearer ${this.bearer}`,\n\t\t\t};\n\t\t\tconst resolvedP = Axios.post<IResolvedUrl>(\n\t\t\t\t`${this.hostUrl}/api/v1/load`,\n\t\t\t\t{\n\t\t\t\t\turl: request.url,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\theaders,\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.cache.set(\n\t\t\t\trequest.url,\n\t\t\t\tresolvedP.then((resolved) => resolved.data),\n\t\t\t);\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) {\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\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: `fluid://${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 = `fluid://${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\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(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = parse(resolvedUrl.url);\n\t\tconst [, , documentId] = parsedUrl.pathname?.split(\"/\") ?? [];\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\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;;;;;;AAEH,2DAAoD;AAEpD,2EAA8F;AAC9F,kDAA0B;AAE1B;;;;;;;;;;;;;;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;Q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IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,AAAD,EAAG,UAAU,CAAC,GAAG,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9D,yEAAyE;QACzE,IAAA,mBAAM,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;YACxB,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACpB;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,iCAAY,CAAC,SAAS,CAAC,EAAE,IAAI;aAC9B;SACD,CAAC;QACF,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD;AAzID,kDAyIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IRequest } from \"@fluidframework/core-interfaces\";\nimport { IResolvedUrl, IUrlResolver, DriverHeader } from \"@fluidframework/driver-definitions\";\nimport Axios from \"axios\";\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 headers = {\n\t\t\t\tAuthorization: `Bearer ${this.bearer}`,\n\t\t\t};\n\t\t\tconst resolvedP = Axios.post<IResolvedUrl>(\n\t\t\t\t`${this.hostUrl}/apis/load`,\n\t\t\t\t{\n\t\t\t\t\turl: request.url,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\theaders,\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.cache.set(\n\t\t\t\trequest.url,\n\t\t\t\tresolvedP.then((resolved) => resolved.data),\n\t\t\t);\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) {\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(resolvedUrl: IResolvedUrl, relativeUrl: string): Promise<string> {\n\t\tconst parsedUrl = new URL(resolvedUrl.url);\n\t\tconst [, , documentId] = parsedUrl.pathname?.split(\"/\") ?? [];\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\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"]}
|