@fluidframework/driver-utils 2.0.0-internal.3.4.0 → 2.0.0-internal.4.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/dist/index.d.ts +3 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -21
- package/dist/index.js.map +1 -1
- package/dist/messageRecognition.d.ts +0 -20
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/messageRecognition.js +1 -37
- package/dist/messageRecognition.js.map +1 -1
- package/dist/network.d.ts +0 -15
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +0 -12
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +1 -34
- 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/lib/index.d.ts +3 -10
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -9
- package/lib/index.js.map +1 -1
- package/lib/messageRecognition.d.ts +0 -20
- package/lib/messageRecognition.d.ts.map +1 -1
- package/lib/messageRecognition.js +0 -35
- package/lib/messageRecognition.js.map +1 -1
- package/lib/network.d.ts +0 -15
- package/lib/network.d.ts.map +1 -1
- package/lib/network.js.map +1 -1
- package/lib/networkUtils.d.ts +0 -12
- package/lib/networkUtils.d.ts.map +1 -1
- package/lib/networkUtils.js +0 -32
- 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/package.json +64 -7
- package/src/index.ts +2 -19
- package/src/messageRecognition.ts +0 -36
- package/src/network.ts +0 -16
- package/src/networkUtils.ts +0 -34
- package/src/packageVersion.ts +1 -1
- package/dist/blobAggregationStorage.d.ts +0 -56
- package/dist/blobAggregationStorage.d.ts.map +0 -1
- package/dist/blobAggregationStorage.js +0 -327
- package/dist/blobAggregationStorage.js.map +0 -1
- package/dist/blobCacheStorageService.d.ts +0 -27
- package/dist/blobCacheStorageService.d.ts.map +0 -1
- package/dist/blobCacheStorageService.js +0 -40
- package/dist/blobCacheStorageService.js.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts +0 -18
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.js +0 -25
- package/dist/emptyDocumentDeltaStorageService.js.map +0 -1
- package/dist/mapWithExpiration.d.ts +0 -75
- package/dist/mapWithExpiration.d.ts.map +0 -1
- package/dist/mapWithExpiration.js +0 -146
- package/dist/mapWithExpiration.js.map +0 -1
- package/dist/multiDocumentServiceFactory.d.ts +0 -34
- package/dist/multiDocumentServiceFactory.d.ts.map +0 -1
- package/dist/multiDocumentServiceFactory.js +0 -81
- package/dist/multiDocumentServiceFactory.js.map +0 -1
- package/dist/multiUrlResolver.d.ts +0 -34
- package/dist/multiUrlResolver.d.ts.map +0 -1
- package/dist/multiUrlResolver.js +0 -59
- package/dist/multiUrlResolver.js.map +0 -1
- package/dist/treeUtils.d.ts +0 -72
- package/dist/treeUtils.d.ts.map +0 -1
- package/dist/treeUtils.js +0 -102
- package/dist/treeUtils.js.map +0 -1
- package/lib/blobAggregationStorage.d.ts +0 -56
- package/lib/blobAggregationStorage.d.ts.map +0 -1
- package/lib/blobAggregationStorage.js +0 -322
- package/lib/blobAggregationStorage.js.map +0 -1
- package/lib/blobCacheStorageService.d.ts +0 -27
- package/lib/blobCacheStorageService.d.ts.map +0 -1
- package/lib/blobCacheStorageService.js +0 -36
- package/lib/blobCacheStorageService.js.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts +0 -18
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.js +0 -21
- package/lib/emptyDocumentDeltaStorageService.js.map +0 -1
- package/lib/mapWithExpiration.d.ts +0 -75
- package/lib/mapWithExpiration.d.ts.map +0 -1
- package/lib/mapWithExpiration.js +0 -142
- package/lib/mapWithExpiration.js.map +0 -1
- package/lib/multiDocumentServiceFactory.d.ts +0 -34
- package/lib/multiDocumentServiceFactory.d.ts.map +0 -1
- package/lib/multiDocumentServiceFactory.js +0 -77
- package/lib/multiDocumentServiceFactory.js.map +0 -1
- package/lib/multiUrlResolver.d.ts +0 -34
- package/lib/multiUrlResolver.d.ts.map +0 -1
- package/lib/multiUrlResolver.js +0 -54
- package/lib/multiUrlResolver.js.map +0 -1
- package/lib/treeUtils.d.ts +0 -72
- package/lib/treeUtils.d.ts.map +0 -1
- package/lib/treeUtils.js +0 -97
- package/lib/treeUtils.js.map +0 -1
- package/src/blobAggregationStorage.ts +0 -430
- package/src/blobCacheStorageService.ts +0 -46
- package/src/emptyDocumentDeltaStorageService.ts +0 -30
- package/src/mapWithExpiration.ts +0 -165
- package/src/multiDocumentServiceFactory.ts +0 -109
- package/src/multiUrlResolver.ts +0 -62
- package/src/treeUtils.ts +0 -128
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED,
|
|
1
|
+
{"version":3,"file":"messageRecognition.js","sourceRoot":"","sources":["../src/messageRecognition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAGN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAyB;IACzD,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED,iDAAiD;AACjD,kDAAkD;AAClD,MAAM,CAAN,IAAY,YAEX;AAFD,WAAY,YAAY;IACvB,iCAAiB,CAAA;AAClB,CAAC,EAFW,YAAY,KAAZ,YAAY,QAEvB;AAED,mEAAmE;AACnE,MAAM,UAAU,uBAAuB,CACtC,OAAqD;IAErD,6FAA6F;IAC7F,mEAAmE;IACnE,OAAO,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CAAC,MAAM,CAAC;AAClF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n\tMessageType,\n} from \"@fluidframework/protocol-definitions\";\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 */\nexport function isRuntimeMessage(message: { type: string }): boolean {\n\treturn message.type === MessageType.Operation;\n}\n\n// ADO #1385: staging code changes across layers.\n// Eventually to be replaced by MessageType.accept\nexport enum MessageType2 {\n\tAccept = \"accept\",\n}\n\n// ADO #1385: To be moved to packages/protocol-base/src/protocol.ts\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 === MessageType2.Accept;\n}\n"]}
|
package/lib/network.d.ts
CHANGED
|
@@ -11,21 +11,6 @@ export declare enum OnlineStatus {
|
|
|
11
11
|
Unknown = 2
|
|
12
12
|
}
|
|
13
13
|
export declare function isOnline(): OnlineStatus;
|
|
14
|
-
/**
|
|
15
|
-
* Interface describing errors and warnings raised by any driver code.
|
|
16
|
-
* Not expected to be implemented by a class or an object literal, but rather used in place of
|
|
17
|
-
* any or unknown in various function signatures that pass errors around.
|
|
18
|
-
*
|
|
19
|
-
* "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
|
|
20
|
-
* It will be either DriverErrorType or the specific driver's specialized error type enum,
|
|
21
|
-
* but we can't reference a specific driver's error type enum in this code.
|
|
22
|
-
*
|
|
23
|
-
* @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that
|
|
24
|
-
* it can used from the base to upper layers.
|
|
25
|
-
*/
|
|
26
|
-
export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
|
|
27
|
-
readonly errorType: string;
|
|
28
|
-
}
|
|
29
14
|
/** Telemetry props with driver-specific required properties */
|
|
30
15
|
export declare type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
31
16
|
driverVersion: string | undefined;
|
package/lib/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,EACN,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,oBAAY,YAAY;IACvB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,OAAO,IAAA;CACP;AAKD,wBAAgB,QAAQ,IAAI,YAAY,CASvC;AAED
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,oBAAY,YAAY;I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AAU,yBAAyB,CACxC,OAAe,EACf,SAAuD,EACvD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC/D,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAEjF,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC/E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AAEhD,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CACxE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIThrottlingWarning,\n\tIDriverErrorBase,\n\tIAuthorizationError,\n\tDriverErrorType,\n\tILocationRedirectionError,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\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\")\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 * Interface describing errors and warnings raised by any driver code.\n * Not expected to be implemented by a class or an object literal, but rather used in place of\n * any or unknown in various function signatures that pass errors around.\n *\n * \"Any\" in the interface name is a nod to the fact that errorType has lost its type constraint.\n * It will be either DriverErrorType or the specific driver's specialized error type enum,\n * but we can't reference a specific driver's error type enum in this code.\n *\n * @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that\n * it can used from the base to upper layers.\n */\nexport interface IAnyDriverError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: string;\n}\n\n/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n\treadonly errorType = DriverErrorType.genericNetworkError;\n\n\tconstructor(message: string, readonly canRetry: boolean, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\tstatic readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t}\n}\n\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.authorizationError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly claims: string | undefined,\n\t\treadonly tenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.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\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\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\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\treadonly errorType = DriverErrorType.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\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n\tnew NonRetryableError(message, DriverErrorType.writeError, props);\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 */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\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;AAEH,OAAO,EAIN,eAAe,GAGf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAmB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEhF,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACvB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,qDAAO,CAAA;AACR,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,mFAAmF;AACnF,+EAA+E;AAC/E,6DAA6D;AAC7D,MAAM,UAAU,QAAQ;IACvB,IACC,OAAO,SAAS,KAAK,QAAQ;QAC7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BAAiB,GAAjB,iBAAiB,CAAQ;QAL1B,cAAS,GAAG,eAAe,CAAC,eAAe,CAAC;QAC5C,aAAQ,GAAG,IAAI,CAAC;IAQzB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,KAAgC,EAAE,EAAE,CACrF,IAAI,iBAAiB,CAAC,OAAO,EAAE,eAAe,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAEnE,MAAM,UAAU,yBAAyB,CACxC,OAAe,EACf,SAAuD,EACvD,KAAgC;IAEhC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,IAAI,SAAS,CAAC,QAAQ,EAAE;QAC/D,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,YAAY,GAAG,IAAI,EAAE,KAAK,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAU,EAAW,EAAE,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,MAAK,IAAI,CAAC;AAEjF,gDAAgD;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,KAAU,EAAsB,EAAE,CAC/E,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAuC,CAAC;AAEhD,kEAAkE;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAU,EAAsB,EAAE,CACxE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,MAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIThrottlingWarning,\n\tIDriverErrorBase,\n\tIAuthorizationError,\n\tDriverErrorType,\n\tILocationRedirectionError,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { IFluidErrorBase, LoggingError } from \"@fluidframework/telemetry-utils\";\n\nexport enum OnlineStatus {\n\tOffline,\n\tOnline,\n\tUnknown,\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\")\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/** Telemetry props with driver-specific required properties */\nexport type DriverErrorTelemetryProps = ITelemetryProperties & {\n\tdriverVersion: string | undefined;\n};\n\n/**\n * Generic network error class.\n */\nexport class GenericNetworkError extends LoggingError implements IDriverErrorBase, IFluidErrorBase {\n\treadonly errorType = DriverErrorType.genericNetworkError;\n\n\tconstructor(message: string, readonly canRetry: boolean, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\n/**\n * FluidInvalidSchema error class.\n */\nexport class FluidInvalidSchemaError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.fluidInvalidSchema;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, props);\n\t}\n}\n\nexport class DeltaStreamConnectionForbiddenError\n\textends LoggingError\n\timplements IDriverErrorBase, IFluidErrorBase\n{\n\tstatic readonly errorType = DriverErrorType.deltaStreamConnectionForbidden;\n\treadonly errorType = DeltaStreamConnectionForbiddenError.errorType;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, { ...props, statusCode: 400 });\n\t}\n}\n\nexport class AuthorizationError\n\textends LoggingError\n\timplements IAuthorizationError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.authorizationError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly claims: string | undefined,\n\t\treadonly tenantId: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// don't log claims or tenantId\n\t\tsuper(message, props, new Set([\"claims\", \"tenantId\"]));\n\t}\n}\n\nexport class LocationRedirectionError\n\textends LoggingError\n\timplements ILocationRedirectionError, IFluidErrorBase\n{\n\treadonly errorType = DriverErrorType.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\nexport class NetworkErrorBasic<T extends string> extends LoggingError implements IFluidErrorBase {\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\nexport class NonRetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, false, props);\n\t}\n}\n\nexport class RetryableError<T extends string> extends NetworkErrorBasic<T> {\n\tconstructor(message: string, readonly errorType: T, props: DriverErrorTelemetryProps) {\n\t\tsuper(message, errorType, true, props);\n\t}\n}\n\n/**\n * Throttling error class - used to communicate all throttling errors\n */\nexport class ThrottlingError extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\treadonly errorType = DriverErrorType.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\nexport const createWriteError = (message: string, props: DriverErrorTelemetryProps) =>\n\tnew NonRetryableError(message, DriverErrorType.writeError, props);\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 */\nexport const canRetryOnError = (error: any): boolean => error?.canRetry === true;\n\n/** Check retryAfterSeconds property on error */\nexport const getRetryDelaySecondsFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds as number | undefined;\n\n/** Check retryAfterSeconds property on error and convert to ms */\nexport const getRetryDelayFromError = (error: any): number | undefined =>\n\terror?.retryAfterSeconds !== undefined ? error.retryAfterSeconds * 1000 : undefined;\n"]}
|
package/lib/networkUtils.d.ts
CHANGED
|
@@ -4,16 +4,4 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ITelemetryErrorEvent, ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
6
6
|
export declare function logNetworkFailure(logger: ITelemetryLogger, event: ITelemetryErrorEvent, error?: any): void;
|
|
7
|
-
/**
|
|
8
|
-
* Wait for browser to get to connected state.
|
|
9
|
-
* If connected, waits minimum of minDelay anyway (between network retries)
|
|
10
|
-
* If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal
|
|
11
|
-
* Note that browsers will have false positives (like having Hyper-V adapter on machine,
|
|
12
|
-
* or machine connected to router that is not connected to internet)
|
|
13
|
-
* But there should be no false negatives.
|
|
14
|
-
* The only exception - Opera returns false when user enters "Work Offline" mode, regardless of actual connectivity.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated - 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
17
|
-
*/
|
|
18
|
-
export declare function waitForConnectedState(minDelay: number): Promise<void>;
|
|
19
7
|
//# 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,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,oBAAoB,EAC3B,KAAK,CAAC,EAAE,GAAG,QAmBX
|
|
1
|
+
{"version":3,"file":"networkUtils.d.ts","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG5F,wBAAgB,iBAAiB,CAChC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,oBAAoB,EAC3B,KAAK,CAAC,EAAE,GAAG,QAmBX"}
|
package/lib/networkUtils.js
CHANGED
|
@@ -20,36 +20,4 @@ export function logNetworkFailure(logger, event, error) {
|
|
|
20
20
|
newEvent.category = canRetryOnError(error) ? "generic" : "error";
|
|
21
21
|
logger.sendTelemetryEvent(newEvent, error);
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Wait for browser to get to connected state.
|
|
25
|
-
* If connected, waits minimum of minDelay anyway (between network retries)
|
|
26
|
-
* If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal
|
|
27
|
-
* Note that browsers will have false positives (like having Hyper-V adapter on machine,
|
|
28
|
-
* or machine connected to router that is not connected to internet)
|
|
29
|
-
* But there should be no false negatives.
|
|
30
|
-
* The only exception - Opera returns false when user enters "Work Offline" mode, regardless of actual connectivity.
|
|
31
|
-
*
|
|
32
|
-
* @deprecated - 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
33
|
-
*/
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
35
|
-
export function waitForConnectedState(minDelay) {
|
|
36
|
-
// Use this frequency to poll even when we are offline and able to setup online/offline listener
|
|
37
|
-
// This is mostly safety net
|
|
38
|
-
const offlinePollFrequency = 30000;
|
|
39
|
-
return new Promise((resolve) => {
|
|
40
|
-
let listener = resolve;
|
|
41
|
-
let delay = minDelay;
|
|
42
|
-
if (isOnline() === OnlineStatus.Offline) {
|
|
43
|
-
if ((window === null || window === void 0 ? void 0 : window.addEventListener) !== undefined) {
|
|
44
|
-
listener = () => {
|
|
45
|
-
resolve();
|
|
46
|
-
window.removeEventListener("online", listener);
|
|
47
|
-
};
|
|
48
|
-
window.addEventListener("online", listener, false);
|
|
49
|
-
delay = Math.max(minDelay, offlinePollFrequency);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
setTimeout(listener, delay);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
23
|
//# sourceMappingURL=networkUtils.js.map
|
package/lib/networkUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networkUtils.js","sourceRoot":"","sources":["../src/networkUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEpE,MAAM,UAAU,iBAAiB,CAChC,MAAwB,EACxB,KAA2B,EAC3B,KAAW;;IAEX,MAAM,QAAQ,qBAAQ,KAAK,CAAE,CAAC;IAE9B,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC;IACrC,QAAQ,CAAC,MAAM;QACd,OAAO,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,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GAAG,CAAC,gBAAgB,CAAC;QAC/E,IAAI,UAAU,KAAK,IAAI,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;YAC1D,QAAQ,CAAC,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;SAC1C;KACD;IAED,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IACjE,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryErrorEvent, ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { isOnline, OnlineStatus, canRetryOnError } from \"./network\";\n\nexport function logNetworkFailure(\n\tlogger: ITelemetryLogger,\n\tevent: ITelemetryErrorEvent,\n\terror?: any,\n) {\n\tconst newEvent = { ...event };\n\n\tconst errorOnlineProp = error.online;\n\tnewEvent.online =\n\t\ttypeof errorOnlineProp === \"string\" ? errorOnlineProp : OnlineStatus[isOnline()];\n\n\tif (typeof navigator === \"object\" && navigator !== null) {\n\t\tconst nav = navigator as any;\n\t\tconst connection = nav.connection ?? nav.mozConnection ?? nav.webkitConnection;\n\t\tif (connection !== null && typeof connection === \"object\") {\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/lib/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.0.0-internal.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.4.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export const pkgName = "@fluidframework/driver-utils";
|
|
8
|
-
export const pkgVersion = "2.0.0-internal.
|
|
8
|
+
export const pkgVersion = "2.0.0-internal.4.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,8BAA8B,CAAC;AACtD,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-utils\";\nexport const pkgVersion = \"2.0.0-internal.4.0.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "2.0.0-internal.
|
|
3
|
+
"version": "2.0.0-internal.4.0.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@fluidframework/common-definitions": "^0.20.1",
|
|
39
39
|
"@fluidframework/common-utils": "^1.1.1",
|
|
40
|
-
"@fluidframework/core-interfaces": "
|
|
41
|
-
"@fluidframework/driver-definitions": "
|
|
40
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.4.0.0 <2.0.0-internal.5.0.0",
|
|
41
|
+
"@fluidframework/driver-definitions": ">=2.0.0-internal.4.0.0 <2.0.0-internal.5.0.0",
|
|
42
42
|
"@fluidframework/gitresources": "^0.1038.4000",
|
|
43
43
|
"@fluidframework/protocol-base": "^0.1038.4000",
|
|
44
44
|
"@fluidframework/protocol-definitions": "^1.1.0",
|
|
45
|
-
"@fluidframework/telemetry-utils": "
|
|
45
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.4.0.0 <2.0.0-internal.5.0.0",
|
|
46
46
|
"axios": "^0.26.0",
|
|
47
47
|
"url": "^0.11.0",
|
|
48
48
|
"uuid": "^8.3.1"
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@fluidframework/build-tools": "^0.13.0",
|
|
54
54
|
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.3.2.0",
|
|
55
55
|
"@fluidframework/eslint-config-fluid": "^2.0.0",
|
|
56
|
-
"@fluidframework/mocha-test-setup": "
|
|
57
|
-
"@fluidframework/runtime-utils": "
|
|
56
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.4.0.0 <2.0.0-internal.5.0.0",
|
|
57
|
+
"@fluidframework/runtime-utils": ">=2.0.0-internal.4.0.0 <2.0.0-internal.5.0.0",
|
|
58
58
|
"@microsoft/api-extractor": "^7.34.4",
|
|
59
59
|
"@types/mocha": "^9.1.1",
|
|
60
60
|
"@types/node": "^14.18.38",
|
|
@@ -71,7 +71,64 @@
|
|
|
71
71
|
"typescript": "~4.5.5"
|
|
72
72
|
},
|
|
73
73
|
"typeValidation": {
|
|
74
|
-
"broken": {
|
|
74
|
+
"broken": {
|
|
75
|
+
"RemovedClassDeclaration_MapWithExpiration": {
|
|
76
|
+
"backCompat": false,
|
|
77
|
+
"forwardCompat": false
|
|
78
|
+
},
|
|
79
|
+
"RemovedClassDeclaration_MultiUrlResolver": {
|
|
80
|
+
"backCompat": false,
|
|
81
|
+
"forwardCompat": false
|
|
82
|
+
},
|
|
83
|
+
"RemovedFunctionDeclaration_configurableUrlResolver": {
|
|
84
|
+
"backCompat": false,
|
|
85
|
+
"forwardCompat": false
|
|
86
|
+
},
|
|
87
|
+
"RemovedClassDeclaration_MultiDocumentServiceFactory": {
|
|
88
|
+
"backCompat": false,
|
|
89
|
+
"forwardCompat": false
|
|
90
|
+
},
|
|
91
|
+
"RemovedClassDeclaration_BlobCacheStorageService": {
|
|
92
|
+
"backCompat": false,
|
|
93
|
+
"forwardCompat": false
|
|
94
|
+
},
|
|
95
|
+
"RemovedClassDeclaration_EmptyDocumentDeltaStorageService": {
|
|
96
|
+
"backCompat": false,
|
|
97
|
+
"forwardCompat": false
|
|
98
|
+
},
|
|
99
|
+
"RemovedInterfaceDeclaration_ISummaryTreeAssemblerProps": {
|
|
100
|
+
"backCompat": false,
|
|
101
|
+
"forwardCompat": false
|
|
102
|
+
},
|
|
103
|
+
"RemovedClassDeclaration_SummaryTreeAssembler": {
|
|
104
|
+
"backCompat": false,
|
|
105
|
+
"forwardCompat": false
|
|
106
|
+
},
|
|
107
|
+
"RemovedFunctionDeclaration_convertSnapshotAndBlobsToSummaryTree": {
|
|
108
|
+
"backCompat": false,
|
|
109
|
+
"forwardCompat": false
|
|
110
|
+
},
|
|
111
|
+
"RemovedFunctionDeclaration_waitForConnectedState": {
|
|
112
|
+
"backCompat": false,
|
|
113
|
+
"forwardCompat": false
|
|
114
|
+
},
|
|
115
|
+
"RemovedClassDeclaration_BlobAggregationStorage": {
|
|
116
|
+
"backCompat": false,
|
|
117
|
+
"forwardCompat": false
|
|
118
|
+
},
|
|
119
|
+
"RemovedClassDeclaration_SnapshotExtractor": {
|
|
120
|
+
"backCompat": false,
|
|
121
|
+
"forwardCompat": false
|
|
122
|
+
},
|
|
123
|
+
"RemovedFunctionDeclaration_isUnpackedRuntimeMessage": {
|
|
124
|
+
"backCompat": false,
|
|
125
|
+
"forwardCompat": false
|
|
126
|
+
},
|
|
127
|
+
"RemovedInterfaceDeclaration_IAnyDriverError": {
|
|
128
|
+
"backCompat": false,
|
|
129
|
+
"forwardCompat": false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
75
132
|
},
|
|
76
133
|
"scripts": {
|
|
77
134
|
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
package/src/index.ts
CHANGED
|
@@ -3,23 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export { BlobAggregationStorage, SnapshotExtractor } from "./blobAggregationStorage";
|
|
7
|
-
export { BlobCacheStorageService } from "./blobCacheStorageService";
|
|
8
6
|
export { buildSnapshotTree } from "./buildSnapshotTree";
|
|
9
7
|
export { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
10
|
-
export { EmptyDocumentDeltaStorageService } from "./emptyDocumentDeltaStorageService";
|
|
11
8
|
export { UsageError } from "./error";
|
|
12
9
|
export { ensureFluidResolvedUrl, isFluidResolvedUrl } from "./fluidResolvedUrl";
|
|
13
10
|
export { InsecureUrlResolver } from "./insecureUrlResolver";
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
canBeCoalescedByService,
|
|
17
|
-
isRuntimeMessage,
|
|
18
|
-
isUnpackedRuntimeMessage,
|
|
19
|
-
MessageType2,
|
|
20
|
-
} from "./messageRecognition";
|
|
21
|
-
export { MultiDocumentServiceFactory } from "./multiDocumentServiceFactory";
|
|
22
|
-
export { configurableUrlResolver, MultiUrlResolver } from "./multiUrlResolver";
|
|
11
|
+
export { canBeCoalescedByService, isRuntimeMessage, MessageType2 } from "./messageRecognition";
|
|
23
12
|
export {
|
|
24
13
|
AuthorizationError,
|
|
25
14
|
canRetryOnError,
|
|
@@ -31,7 +20,6 @@ export {
|
|
|
31
20
|
GenericNetworkError,
|
|
32
21
|
getRetryDelayFromError,
|
|
33
22
|
getRetryDelaySecondsFromError,
|
|
34
|
-
IAnyDriverError,
|
|
35
23
|
isOnline,
|
|
36
24
|
LocationRedirectionError,
|
|
37
25
|
NetworkErrorBasic,
|
|
@@ -40,7 +28,7 @@ export {
|
|
|
40
28
|
RetryableError,
|
|
41
29
|
ThrottlingError,
|
|
42
30
|
} from "./network";
|
|
43
|
-
export { logNetworkFailure
|
|
31
|
+
export { logNetworkFailure } from "./networkUtils";
|
|
44
32
|
export {
|
|
45
33
|
emptyMessageStream,
|
|
46
34
|
ParallelRequests,
|
|
@@ -61,8 +49,3 @@ export {
|
|
|
61
49
|
isCombinedAppAndProtocolSummary,
|
|
62
50
|
} from "./summaryForCreateNew";
|
|
63
51
|
export { convertSummaryTreeToSnapshotITree } from "./treeConversions";
|
|
64
|
-
export {
|
|
65
|
-
convertSnapshotAndBlobsToSummaryTree,
|
|
66
|
-
ISummaryTreeAssemblerProps,
|
|
67
|
-
SummaryTreeAssembler,
|
|
68
|
-
} from "./treeUtils";
|
|
@@ -17,42 +17,6 @@ export function isRuntimeMessage(message: { type: string }): boolean {
|
|
|
17
17
|
return message.type === MessageType.Operation;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
enum RuntimeMessage {
|
|
21
|
-
FluidDataStoreOp = "component",
|
|
22
|
-
Attach = "attach",
|
|
23
|
-
ChunkedOp = "chunkedOp",
|
|
24
|
-
BlobAttach = "blobAttach",
|
|
25
|
-
Rejoin = "rejoin",
|
|
26
|
-
Alias = "alias",
|
|
27
|
-
Operation = "op",
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Determines whether or not the message type is one of the following: (legacy)
|
|
32
|
-
*
|
|
33
|
-
* - "component"
|
|
34
|
-
*
|
|
35
|
-
* - "attach"
|
|
36
|
-
*
|
|
37
|
-
* - "chunkedOp"
|
|
38
|
-
*
|
|
39
|
-
* - "blobAttach"
|
|
40
|
-
*
|
|
41
|
-
* - "rejoin"
|
|
42
|
-
*
|
|
43
|
-
* - "alias"
|
|
44
|
-
*
|
|
45
|
-
* - "op"
|
|
46
|
-
*
|
|
47
|
-
* @deprecated This API should not be used.
|
|
48
|
-
*/
|
|
49
|
-
export function isUnpackedRuntimeMessage(message: ISequencedDocumentMessage): boolean {
|
|
50
|
-
if ((Object.values(RuntimeMessage) as string[]).includes(message.type)) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
20
|
// ADO #1385: staging code changes across layers.
|
|
57
21
|
// Eventually to be replaced by MessageType.accept
|
|
58
22
|
export enum MessageType2 {
|
package/src/network.ts
CHANGED
|
@@ -34,22 +34,6 @@ export function isOnline(): OnlineStatus {
|
|
|
34
34
|
return OnlineStatus.Unknown;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Interface describing errors and warnings raised by any driver code.
|
|
39
|
-
* Not expected to be implemented by a class or an object literal, but rather used in place of
|
|
40
|
-
* any or unknown in various function signatures that pass errors around.
|
|
41
|
-
*
|
|
42
|
-
* "Any" in the interface name is a nod to the fact that errorType has lost its type constraint.
|
|
43
|
-
* It will be either DriverErrorType or the specific driver's specialized error type enum,
|
|
44
|
-
* but we can't reference a specific driver's error type enum in this code.
|
|
45
|
-
*
|
|
46
|
-
* @deprecated - In favour of {@link @fluidframework/driver-definitions#IAnyDriverError} so that
|
|
47
|
-
* it can used from the base to upper layers.
|
|
48
|
-
*/
|
|
49
|
-
export interface IAnyDriverError extends Omit<IDriverErrorBase, "errorType"> {
|
|
50
|
-
readonly errorType: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
37
|
/** Telemetry props with driver-specific required properties */
|
|
54
38
|
export type DriverErrorTelemetryProps = ITelemetryProperties & {
|
|
55
39
|
driverVersion: string | undefined;
|
package/src/networkUtils.ts
CHANGED
|
@@ -29,37 +29,3 @@ export function logNetworkFailure(
|
|
|
29
29
|
newEvent.category = canRetryOnError(error) ? "generic" : "error";
|
|
30
30
|
logger.sendTelemetryEvent(newEvent, error);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Wait for browser to get to connected state.
|
|
35
|
-
* If connected, waits minimum of minDelay anyway (between network retries)
|
|
36
|
-
* If disconnected, polls every 30 seconds anyway, to make sure we are not getting stuck because of wrong signal
|
|
37
|
-
* Note that browsers will have false positives (like having Hyper-V adapter on machine,
|
|
38
|
-
* or machine connected to router that is not connected to internet)
|
|
39
|
-
* But there should be no false negatives.
|
|
40
|
-
* The only exception - Opera returns false when user enters "Work Offline" mode, regardless of actual connectivity.
|
|
41
|
-
*
|
|
42
|
-
* @deprecated - 2.0.0-internal.3.2.0 Not recommended for general purpose use.
|
|
43
|
-
*/
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
45
|
-
export function waitForConnectedState(minDelay: number): Promise<void> {
|
|
46
|
-
// Use this frequency to poll even when we are offline and able to setup online/offline listener
|
|
47
|
-
// This is mostly safety net
|
|
48
|
-
const offlinePollFrequency = 30000;
|
|
49
|
-
|
|
50
|
-
return new Promise((resolve) => {
|
|
51
|
-
let listener: () => void = resolve;
|
|
52
|
-
let delay = minDelay;
|
|
53
|
-
if (isOnline() === OnlineStatus.Offline) {
|
|
54
|
-
if (window?.addEventListener !== undefined) {
|
|
55
|
-
listener = () => {
|
|
56
|
-
resolve();
|
|
57
|
-
window.removeEventListener("online", listener);
|
|
58
|
-
};
|
|
59
|
-
window.addEventListener("online", listener, false);
|
|
60
|
-
delay = Math.max(minDelay, offlinePollFrequency);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
setTimeout(listener, delay);
|
|
64
|
-
});
|
|
65
|
-
}
|
package/src/packageVersion.ts
CHANGED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
|
-
import { ITelemetryLogger } from "@fluidframework/common-definitions";
|
|
8
|
-
/**
|
|
9
|
-
* Base class that deals with unpacking snapshots (in place) containing aggregated blobs
|
|
10
|
-
* It relies on abstract methods for reads and storing unpacked blobs.
|
|
11
|
-
*
|
|
12
|
-
* @deprecated This class was introduced experimentally and is no longer used.
|
|
13
|
-
*/
|
|
14
|
-
export declare abstract class SnapshotExtractor {
|
|
15
|
-
protected readonly aggregatedBlobName = "__big";
|
|
16
|
-
protected readonly virtualIdPrefix = "__";
|
|
17
|
-
protected virtualIdCounter: number;
|
|
18
|
-
protected getNextVirtualId(): string;
|
|
19
|
-
abstract getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;
|
|
20
|
-
abstract setBlob(id: string, tree: ISnapshotTree, content: string): any;
|
|
21
|
-
unpackSnapshotCore(snapshot: ISnapshotTree, level?: number): Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Snapshot packer and extractor.
|
|
25
|
-
* When summary is written it will find and aggregate small blobs into bigger blobs
|
|
26
|
-
* When snapshot is read, it will unpack aggregated blobs and provide them transparently to caller.
|
|
27
|
-
*
|
|
28
|
-
* @deprecated This class was introduced experimentally and is no longer used.
|
|
29
|
-
*/
|
|
30
|
-
export declare class BlobAggregationStorage extends SnapshotExtractor implements IDocumentStorageService {
|
|
31
|
-
private readonly storage;
|
|
32
|
-
private readonly logger;
|
|
33
|
-
private readonly allowPacking;
|
|
34
|
-
private readonly packingLevel;
|
|
35
|
-
private readonly blobCutOffSize?;
|
|
36
|
-
static readonly fullDataStoreSummaries = true;
|
|
37
|
-
protected loadedFromSummary: boolean;
|
|
38
|
-
protected virtualBlobs: Map<string, ArrayBufferLike>;
|
|
39
|
-
static wrap(storage: IDocumentStorageService, logger: ITelemetryLogger, allowPacking?: boolean, packingLevel?: number): BlobAggregationStorage;
|
|
40
|
-
static unpackSnapshot(snapshot: ISnapshotTree): Promise<void>;
|
|
41
|
-
get policies(): IDocumentStorageServicePolicies | undefined;
|
|
42
|
-
unpackSnapshot(snapshot: ISnapshotTree): Promise<void>;
|
|
43
|
-
protected constructor(storage: IDocumentStorageService, logger: ITelemetryLogger, allowPacking: boolean, packingLevel: number, blobCutOffSize?: number | undefined);
|
|
44
|
-
setBlob(id: string, tree: ISnapshotTree, content: string): void;
|
|
45
|
-
getBlob(id: string, tree: ISnapshotTree): Promise<ArrayBufferLike>;
|
|
46
|
-
get repositoryUrl(): string;
|
|
47
|
-
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>;
|
|
48
|
-
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
49
|
-
createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse>;
|
|
50
|
-
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
51
|
-
readBlob(id: string): Promise<ArrayBufferLike>;
|
|
52
|
-
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
53
|
-
private compressSmallBlobs;
|
|
54
|
-
protected isRealStorageId(id: string): boolean;
|
|
55
|
-
}
|
|
56
|
-
//# sour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