@fluidframework/odsp-doclib-utils 2.74.0 → 2.81.0-374083
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/odspErrorUtils.d.ts.map +1 -1
- package/dist/odspErrorUtils.js +4 -0
- package/dist/odspErrorUtils.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/eslint.config.mts +4 -23
- package/lib/odspErrorUtils.d.ts.map +1 -1
- package/lib/odspErrorUtils.js +4 -0
- package/lib/odspErrorUtils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/package.json +18 -18
- package/src/odspErrorUtils.ts +4 -0
- package/src/packageVersion.ts +1 -1
- package/.eslintrc.cjs +0 -28
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspErrorUtils.d.ts","sourceRoot":"","sources":["../src/odspErrorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAEN,KAAK,yBAAyB,EAO9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,eAAe,EACpB,YAAY,EAEZ,MAAM,0CAA0C,CAAC;AAQlD;;GAEG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAG1C;;GAEG;AACH,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAG9D;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE;IAE7D,GAAG,EAAE,CAA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AK,CAAA;CAAE,CAY1E;AAGD;;GAEG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,iBAAiB,GAAG,MAAM,EAAE,CAU1E;AAGD;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,EAC1B,QAAQ,CAAC,EAAE,QAAQ,EACnB,YAAY,CAAC,EAAE,MAAM,EACrB,KAAK,GAAE,wBAA6B,GAClC,eAAe,GAAG,SAAS,CAwM7B;AAGD;;GAEG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,QAAQ,CAAC,EAAE,QAAQ,EACnB,UAAU,CAAC,EAAE,MAAM,EAAE,EACrB,KAAK,GAAE,wBAA6B,GAClC,eAAe,GAAG,SAAS,CAkB7B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,wBAAwB,GAC9B,KAAK,CAaP;AAeD;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAE1F;AAGD;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,CAAC,EAAE,OAAO,GACR,CAAC,IAAI,IAAI,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAOxD"}
|
package/dist/odspErrorUtils.js
CHANGED
|
@@ -184,6 +184,10 @@ function createOdspNetworkError(errorMessage, statusCode, retryAfterSeconds, res
|
|
|
184
184
|
error = new internal_2.FluidInvalidSchemaError(errorMessage, driverProps);
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
|
+
if (innerMostErrorCode === "fluidEpochNotProvided") {
|
|
188
|
+
error = new internal_2.RetryableError(errorMessage, internal_3.OdspErrorTypes.usageError, driverProps);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
187
191
|
error = new internal_2.NonRetryableError(errorMessage, internal_1.DriverErrorTypes.genericNetworkError, driverProps);
|
|
188
192
|
break;
|
|
189
193
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspErrorUtils.js","sourceRoot":"","sources":["../src/odspErrorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAA+E;AAC/E,oEAS+C;AAC/C,+EAI0D;AAC1D,uEAIkD;AAElD,+FAA+F;AAC/F,2DAAkE;AAClE,uEAAiE;AACjE,uEAAiE;AAEjE,uCAAuC;AACvC;;GAEG;AACU,QAAA,sBAAsB,GAAG,GAAG,CAAC;AAC1C,8GAA8G;AAC9G,+BAA+B;AAC/B;;GAEG;AACU,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AAE9D,gFAAgF;AAChF;;GAEG;AACH,SAAgB,oCAAoC,CAAC,OAGpD;IAMA,6EAA6E;IAC7E,8CAA8C;IAC9C,MAAM,YAAY,GAAoB;QACrC,EAAE,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE;QACzD,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE;QAClD,EAAE,UAAU,EAAE,mBAAmB,EAAE,OAAO,EAAE,iBAAiB,EAAE;QAC/D,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE;QACrD,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,eAAe,EAAE;QAC3D,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,EAAE;QAC9D,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE;KACtD,CAAC;IACF,MAAM,eAAe,GAA6B;QACjD,iBAAiB,EAAE,IAAA,2BAAgB,EAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CA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AAC;IAClB,CAAC;IACD,OAAO,CAAC,CAAC;AACV,CAAC;AAED,gFAAgF;AAChF;;GAEG;AACH,SAAgB,aAAa,CAAC,CAAU;IACvC,OAAO,KAAK,CAAC,OAAO,CAAE,CAAsC,EAAE,UAAU,CAAC,CAAC;AAC3E,CAAC;AAFD,sCAEC;AAED,gFAAgF;AAChF;;GAEG;AACH,SAAgB,sBAAsB,CACrC,CAAU;IAEV,OAAO,CACN,CAAC,KAAK,IAAI;QACV,OAAO,CAAC,KAAK,QAAQ;QACrB,kBAAkB,IAAI,CAAC;QACvB,OAAQ,CAAsC,EAAE,gBAAgB,KAAK,QAAQ,CAC7E,CAAC;AACH,CAAC;AATD,wDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\ttype DriverErrorTelemetryProps,\n\tFluidInvalidSchemaError,\n\tNonRetryableError,\n\tOnlineStatus,\n\tRetryableError,\n\tcreateGenericNetworkError,\n\tisOnline,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IOdspErrorAugmentations,\n\ttype OdspError,\n\tOdspErrorTypes,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\tLoggingError,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n// odsp-doclib-utils and odsp-driver will always release together and share the same pkgVersion\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { parseAuthErrorClaims } from \"./parseAuthErrorClaims.js\";\nimport { parseAuthErrorTenant } from \"./parseAuthErrorTenant.js\";\n\n// no response, or can't parse response\n/**\n * @internal\n */\nexport const fetchIncorrectResponse = 712;\n// Error code for when the server state is read only and client tries to write. This code is set by the server\n// and is not likely to change.\n/**\n * @internal\n */\nexport const OdspServiceReadOnlyErrorCode = \"serviceReadOnly\";\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function getSPOAndGraphRequestIdsFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}): ITelemetryBaseProperties {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: \"sprequestguid\", logName: \"sprequestguid\" },\n\t\t{ headerName: \"request-id\", logName: \"requestId\" },\n\t\t{ headerName: \"client-request-id\", logName: \"clientRequestId\" },\n\t\t{ headerName: \"x-msedge-ref\", logName: \"xMsedgeRef\" },\n\t\t{ headerName: \"X-Fluid-Retries\", logName: \"serverRetries\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryBaseProperties = {\n\t\tsprequestduration: numberFromString(headers.get(\"sprequestduration\")),\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\tfor (const header of headersToLog) {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t}\n\n\t// x-fluid-telemetry contains a key value pair in the following format:\n\t// x-fluid-telemetry:key1=value1,key2,key3=value3,\n\t// Ex. x-fluid-telemetry:Origin=c\n\tconst fluidTelemetry = headers.get(\"x-fluid-telemetry\");\n\tif (fluidTelemetry !== undefined && fluidTelemetry !== null) {\n\t\tadditionalProps.xFluidTelemetry = fluidTelemetry;\n\t\tconst keyValueMap = fluidTelemetry\n\t\t\t.split(\",\")\n\t\t\t.map((keyValuePair) => keyValuePair.split(\"=\"));\n\t\tfor (const [key, value] of keyValueMap) {\n\t\t\tif (\"Origin\" === key.trim()) {\n\t\t\t\tlet fieldValue: string;\n\t\t\t\tswitch (value?.trim()) {\n\t\t\t\t\tcase \"c\": {\n\t\t\t\t\t\tfieldValue = \"cache\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"g\": {\n\t\t\t\t\t\tfieldValue = \"graph\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tfieldValue = value?.trim();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst logName = \"responseOrigin\";\n\t\t\t\tadditionalProps[logName] = fieldValue;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn additionalProps;\n}\n\n/**\n * Empirically-based model of error response inner error from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponseInnerError {\n\tcode?: string;\n\tinnerError?: OdspErrorResponseInnerError;\n}\n\n/**\n * Empirically-based model of error responses from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponse {\n\terror: OdspErrorResponseInnerError & {\n\t\tmessage: string;\n\t};\n}\n\n/**\n * Error encapsulating the error response from ODSP containing the redirect location when a resource has moved\n *\n * @internal\n */\nexport class OdspRedirectError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectLocation: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectLocation (URL can contain sensitive info)\n\t\tsuper(message, props, new Set([\"redirectLocation\"]));\n\t}\n}\n\n/**\n * Empirically-based type guard for error responses from ODSP\n */\nfunction isOdspErrorResponse(x: unknown): x is OdspErrorResponse {\n\tconst error = (x as Partial<OdspErrorResponse>)?.error;\n\treturn (\n\t\ttypeof error?.message === \"string\" &&\n\t\t(error?.code === undefined || typeof error?.code === \"string\")\n\t);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function tryParseErrorResponse(\n\tresponse: string | undefined,\n): { success: true; errorResponse: OdspErrorResponse } | { success: false } {\n\ttry {\n\t\tif (response !== undefined) {\n\t\t\tconst parsed: unknown = JSON.parse(response);\n\t\t\tif (isOdspErrorResponse(parsed)) {\n\t\t\t\treturn { success: true, errorResponse: parsed };\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore JSON parsing errors\n\t}\n\treturn { success: false };\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function parseFacetCodes(errorResponse: OdspErrorResponse): string[] {\n\tconst stack: string[] = [];\n\tlet error: OdspErrorResponseInnerError | undefined = errorResponse.error;\n\twhile (typeof error === \"object\" && error !== null) {\n\t\tif (error.code !== undefined) {\n\t\t\tstack.unshift(error.code);\n\t\t}\n\t\terror = error.innerError;\n\t}\n\treturn stack;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function createOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterSeconds?: number,\n\tresponse?: Response,\n\tresponseText?: string,\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\tlet error: IFluidErrorBase & OdspError;\n\tconst parseResult = tryParseErrorResponse(responseText);\n\tlet facetCodes: string[] | undefined;\n\tlet innerMostErrorCode: string | undefined;\n\tif (parseResult.success) {\n\t\tconst errorResponse = parseResult.errorResponse;\n\t\t// logging the error response message\n\t\tprops.responseMessage = errorResponse.error.message;\n\t\tfacetCodes = parseFacetCodes(errorResponse);\n\t\tif (facetCodes !== undefined) {\n\t\t\tinnerMostErrorCode = facetCodes[0];\n\t\t\tprops.innerMostErrorCode = innerMostErrorCode;\n\t\t}\n\t}\n\n\tlet redirectLocation: string | undefined;\n\tconst driverProps = { driverVersion, statusCode, ...props };\n\n\tswitch (statusCode) {\n\t\t// The location of file can move on Spo. If the redirect:manual header is added to network call\n\t\t// it causes browser to not handle the redirects. Location header in such cases will contain the new location.\n\t\t// Refer: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n\t\tcase 301:\n\t\tcase 302:\n\t\tcase 303:\n\t\tcase 307:\n\t\tcase 308: {\n\t\t\tredirectLocation = response?.headers.get(\"Location\") ?? undefined;\n\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Don't break here. Let it be a generic network error if redirectLocation is not there.\n\t\tcase 400: {\n\t\t\tif (innerMostErrorCode === \"fluidInvalidSchema\") {\n\t\t\t\terror = new FluidInvalidSchemaError(errorMessage, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 401:\n\t\tcase 403: {\n\t\t\t// The server throws 403 status code with innerMostError code as \"serviceReadOnly\" for cases where the\n\t\t\t// database on server becomes readonly. The driver retries for such cases with exponential backup logic.\n\t\t\tif (innerMostErrorCode === OdspServiceReadOnlyErrorCode) {\n\t\t\t\terror = new RetryableError(errorMessage, OdspErrorTypes.serviceReadOnly, driverProps);\n\t\t\t} else if (\n\t\t\t\tinnerMostErrorCode === \"blockedIPAddress\" ||\n\t\t\t\tinnerMostErrorCode === \"conditionalAccessPolicyEnforced\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\t\"IP Address is blocked\",\n\t\t\t\t\tOdspErrorTypes.blockedIPAddress,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst claims = response?.headers ? parseAuthErrorClaims(response.headers) : undefined;\n\t\t\t\tconst tenantId = response?.headers\n\t\t\t\t\t? parseAuthErrorTenant(response.headers)\n\t\t\t\t\t: undefined;\n\t\t\t\terror = new AuthorizationError(errorMessage, claims, tenantId, driverProps);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 404: {\n\t\t\tif (parseResult.success) {\n\t\t\t\t// The location of file can move on Spo. If the manual redirect prefer header is added to network call\n\t\t\t\t// it returns 404 error instead of 308. Error thrown by server will contain the new redirect location.\n\t\t\t\t// For reference we can look here: \\packages\\drivers\\odsp-driver\\src\\fetchSnapshot.ts\n\t\t\t\tconst responseError = parseResult?.errorResponse?.error;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- TODO: use stronger typing here.\n\t\t\t\tredirectLocation = responseError?.[\"@error.redirectLocation\"];\n\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileNotFoundOrAccessDeniedError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 406: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.unsupportedClientProtocolVersion,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 410: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.cannotCatchUp, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 409: {\n\t\t\t// This status code is sent by the server when the client and server epoch mismatches.\n\t\t\t// The client sets its epoch version in the calls it makes to the server and if that mismatches\n\t\t\t// with the server epoch version, the server throws this error code.\n\t\t\t// This indicates that the file/container has been modified externally.\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 412: {\n\t\t\t// \"Precondition Failed\" error - happens when uploadSummaryWithContext uses wrong parent.\n\t\t\t// Resubmitting same payload is not going to help, so this is non-recoverable failure!\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 413: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.snapshotTooBig, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 414: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tOdspErrorTypes.invalidFileNameError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 423: {\n\t\t\t// File locked\n\t\t\tif (\n\t\t\t\tinnerMostErrorCode === \"resourceLocked\" ||\n\t\t\t\tinnerMostErrorCode === \"resourceCheckedOut\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tDriverErrorTypes.fileIsLocked,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcase 500: {\n\t\t\terror = new RetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 501: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.fluidNotEnabled, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 507: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.outOfStorageError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase fetchIncorrectResponse: {\n\t\t\t// Note that getWithRetryForTokenRefresh will retry it once, then it becomes non-retryable error\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.incorrectServerResponse,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst retryAfterMs =\n\t\t\t\tretryAfterSeconds === undefined ? undefined : retryAfterSeconds * 1000;\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Set this to true as createOdspNetworkError is called to handle error response from service.\n\terror.addTelemetryProperties({ endpointReached: true });\n\tenrichOdspError(error, response, facetCodes, undefined);\n\treturn error;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function enrichOdspError(\n\terror: IFluidErrorBase & OdspError,\n\tresponse?: Response,\n\tfacetCodes?: string[],\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\terror.online = OnlineStatus[isOnline()];\n\tif (facetCodes !== undefined) {\n\t\terror.facetCodes = facetCodes;\n\t}\n\n\tif (response) {\n\t\tprops.responseType = response.type;\n\t\tif (response.headers) {\n\t\t\tconst headers = getSPOAndGraphRequestIdsFromResponse(response.headers);\n\t\t\tfor (const key of Object.keys(headers)) {\n\t\t\t\tprops[key] = headers[key];\n\t\t\t}\n\t\t\terror.serverEpoch = response.headers.get(\"x-fluid-epoch\") ?? undefined;\n\t\t}\n\t}\n\terror.addTelemetryProperties(props);\n\treturn error;\n}\n\n/**\n * Throws network error - an object with a bunch of network related properties\n * @internal\n */\nexport function throwOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tresponse: Response,\n\tresponseText?: string,\n\tprops?: ITelemetryBaseProperties,\n): never {\n\tconst networkError = createOdspNetworkError(\n\t\terrorMessage,\n\t\tstatusCode,\n\t\tnumberFromHeader(response.headers.get(\"retry-after\")) /* retryAfterSeconds */,\n\t\tresponse,\n\t\tresponseText,\n\t\tprops,\n\t);\n\n\tnetworkError.addTelemetryProperties({ odspError: true, storageServiceError: true });\n\n\tthrow networkError;\n}\n\n// eslint-disable-next-line @rushstack/no-new-null\nfunction numberFromHeader(header: string | null): number | undefined {\n\tif (header === null) {\n\t\treturn undefined;\n\t}\n\tconst n = Number(header);\n\tif (Number.isNaN(n)) {\n\t\treturn undefined;\n\t}\n\treturn n;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasFacetCodes(x: unknown): x is Pick<IOdspErrorAugmentations, \"facetCodes\"> {\n\treturn Array.isArray((x as Partial<IOdspErrorAugmentations>)?.facetCodes);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasRedirectionLocation(\n\tx: unknown,\n): x is Pick<IOdspErrorAugmentations, \"redirectLocation\"> {\n\treturn (\n\t\tx !== null &&\n\t\ttypeof x === \"object\" &&\n\t\t\"redirectLocation\" in x &&\n\t\ttypeof (x as Partial<IOdspErrorAugmentations>)?.redirectLocation === \"string\"\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspErrorUtils.js","sourceRoot":"","sources":["../src/odspErrorUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,0EAA+E;AAC/E,oEAS+C;AAC/C,+EAI0D;AAC1D,uEAIkD;AAElD,+FAA+F;AAC/F,2DAAkE;AAClE,uEAAiE;AACjE,uEAAiE;AAEjE,uCAAuC;AACvC;;GAEG;AACU,QAAA,sBAAsB,GAAG,GAAG,CAAC;AAC1C,8GAA8G;AAC9G,+BAA+B;AAC/B;;GAEG;AACU,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AAE9D,gFAAgF;AAChF;;GAEG;AACH,SAAgB,oCAAoC,CAAC,OAGpD;IAMA,6EAA6E;IAC7E,8CAA8C;IAC9C,MAAM,YAAY,GAAoB;QACrC,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ED;;;GAGG;AACH,SAAgB,qBAAqB,CACpC,YAAoB,EACpB,UAAkB,EAClB,QAAkB,EAClB,YAAqB,EACrB,KAAgC;IAEhC,MAAM,YAAY,GAAG,sBAAsB,CAC1C,YAAY,EACZ,UAAU,EACV,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,uBAAuB,EAC7E,QAAQ,EACR,YAAY,EACZ,KAAK,CACL,CAAC;IAEF,YAAY,CAAC,sBAAsB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC;IAEpF,MAAM,YAAY,CAAC;AACpB,CAAC;AAnBD,sDAmBC;AAED,kDAAkD;AAClD,SAAS,gBAAgB,CAAC,MAAqB;IAC9C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACzB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACrB,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,CAAC;AACV,CAAC;AAED,gFAAgF;AAChF;;GAEG;AACH,SAAgB,aAAa,CAAC,CAAU;IACvC,OAAO,KAAK,CAAC,OAAO,CAAE,CAAsC,EAAE,UAAU,CAAC,CAAC;AAC3E,CAAC;AAFD,sCAEC;AAED,gFAAgF;AAChF;;GAEG;AACH,SAAgB,sBAAsB,CACrC,CAAU;IAEV,OAAO,CACN,CAAC,KAAK,IAAI;QACV,OAAO,CAAC,KAAK,QAAQ;QACrB,kBAAkB,IAAI,CAAC;QACvB,OAAQ,CAAsC,EAAE,gBAAgB,KAAK,QAAQ,CAC7E,CAAC;AACH,CAAC;AATD,wDASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\ttype DriverErrorTelemetryProps,\n\tFluidInvalidSchemaError,\n\tNonRetryableError,\n\tOnlineStatus,\n\tRetryableError,\n\tcreateGenericNetworkError,\n\tisOnline,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IOdspErrorAugmentations,\n\ttype OdspError,\n\tOdspErrorTypes,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\tLoggingError,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n// odsp-doclib-utils and odsp-driver will always release together and share the same pkgVersion\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { parseAuthErrorClaims } from \"./parseAuthErrorClaims.js\";\nimport { parseAuthErrorTenant } from \"./parseAuthErrorTenant.js\";\n\n// no response, or can't parse response\n/**\n * @internal\n */\nexport const fetchIncorrectResponse = 712;\n// Error code for when the server state is read only and client tries to write. This code is set by the server\n// and is not likely to change.\n/**\n * @internal\n */\nexport const OdspServiceReadOnlyErrorCode = \"serviceReadOnly\";\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function getSPOAndGraphRequestIdsFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}): ITelemetryBaseProperties {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: \"sprequestguid\", logName: \"sprequestguid\" },\n\t\t{ headerName: \"request-id\", logName: \"requestId\" },\n\t\t{ headerName: \"client-request-id\", logName: \"clientRequestId\" },\n\t\t{ headerName: \"x-msedge-ref\", logName: \"xMsedgeRef\" },\n\t\t{ headerName: \"X-Fluid-Retries\", logName: \"serverRetries\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryBaseProperties = {\n\t\tsprequestduration: numberFromString(headers.get(\"sprequestduration\")),\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\tfor (const header of headersToLog) {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t}\n\n\t// x-fluid-telemetry contains a key value pair in the following format:\n\t// x-fluid-telemetry:key1=value1,key2,key3=value3,\n\t// Ex. x-fluid-telemetry:Origin=c\n\tconst fluidTelemetry = headers.get(\"x-fluid-telemetry\");\n\tif (fluidTelemetry !== undefined && fluidTelemetry !== null) {\n\t\tadditionalProps.xFluidTelemetry = fluidTelemetry;\n\t\tconst keyValueMap = fluidTelemetry\n\t\t\t.split(\",\")\n\t\t\t.map((keyValuePair) => keyValuePair.split(\"=\"));\n\t\tfor (const [key, value] of keyValueMap) {\n\t\t\tif (\"Origin\" === key.trim()) {\n\t\t\t\tlet fieldValue: string;\n\t\t\t\tswitch (value?.trim()) {\n\t\t\t\t\tcase \"c\": {\n\t\t\t\t\t\tfieldValue = \"cache\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"g\": {\n\t\t\t\t\t\tfieldValue = \"graph\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tfieldValue = value?.trim();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst logName = \"responseOrigin\";\n\t\t\t\tadditionalProps[logName] = fieldValue;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn additionalProps;\n}\n\n/**\n * Empirically-based model of error response inner error from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponseInnerError {\n\tcode?: string;\n\tinnerError?: OdspErrorResponseInnerError;\n}\n\n/**\n * Empirically-based model of error responses from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponse {\n\terror: OdspErrorResponseInnerError & {\n\t\tmessage: string;\n\t};\n}\n\n/**\n * Error encapsulating the error response from ODSP containing the redirect location when a resource has moved\n *\n * @internal\n */\nexport class OdspRedirectError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectLocation: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectLocation (URL can contain sensitive info)\n\t\tsuper(message, props, new Set([\"redirectLocation\"]));\n\t}\n}\n\n/**\n * Empirically-based type guard for error responses from ODSP\n */\nfunction isOdspErrorResponse(x: unknown): x is OdspErrorResponse {\n\tconst error = (x as Partial<OdspErrorResponse>)?.error;\n\treturn (\n\t\ttypeof error?.message === \"string\" &&\n\t\t(error?.code === undefined || typeof error?.code === \"string\")\n\t);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function tryParseErrorResponse(\n\tresponse: string | undefined,\n): { success: true; errorResponse: OdspErrorResponse } | { success: false } {\n\ttry {\n\t\tif (response !== undefined) {\n\t\t\tconst parsed: unknown = JSON.parse(response);\n\t\t\tif (isOdspErrorResponse(parsed)) {\n\t\t\t\treturn { success: true, errorResponse: parsed };\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore JSON parsing errors\n\t}\n\treturn { success: false };\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function parseFacetCodes(errorResponse: OdspErrorResponse): string[] {\n\tconst stack: string[] = [];\n\tlet error: OdspErrorResponseInnerError | undefined = errorResponse.error;\n\twhile (typeof error === \"object\" && error !== null) {\n\t\tif (error.code !== undefined) {\n\t\t\tstack.unshift(error.code);\n\t\t}\n\t\terror = error.innerError;\n\t}\n\treturn stack;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function createOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterSeconds?: number,\n\tresponse?: Response,\n\tresponseText?: string,\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\tlet error: IFluidErrorBase & OdspError;\n\tconst parseResult = tryParseErrorResponse(responseText);\n\tlet facetCodes: string[] | undefined;\n\tlet innerMostErrorCode: string | undefined;\n\tif (parseResult.success) {\n\t\tconst errorResponse = parseResult.errorResponse;\n\t\t// logging the error response message\n\t\tprops.responseMessage = errorResponse.error.message;\n\t\tfacetCodes = parseFacetCodes(errorResponse);\n\t\tif (facetCodes !== undefined) {\n\t\t\tinnerMostErrorCode = facetCodes[0];\n\t\t\tprops.innerMostErrorCode = innerMostErrorCode;\n\t\t}\n\t}\n\n\tlet redirectLocation: string | undefined;\n\tconst driverProps = { driverVersion, statusCode, ...props };\n\n\tswitch (statusCode) {\n\t\t// The location of file can move on Spo. If the redirect:manual header is added to network call\n\t\t// it causes browser to not handle the redirects. Location header in such cases will contain the new location.\n\t\t// Refer: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n\t\tcase 301:\n\t\tcase 302:\n\t\tcase 303:\n\t\tcase 307:\n\t\tcase 308: {\n\t\t\tredirectLocation = response?.headers.get(\"Location\") ?? undefined;\n\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Don't break here. Let it be a generic network error if redirectLocation is not there.\n\t\tcase 400: {\n\t\t\tif (innerMostErrorCode === \"fluidInvalidSchema\") {\n\t\t\t\terror = new FluidInvalidSchemaError(errorMessage, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (innerMostErrorCode === \"fluidEpochNotProvided\") {\n\t\t\t\terror = new RetryableError(errorMessage, OdspErrorTypes.usageError, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 401:\n\t\tcase 403: {\n\t\t\t// The server throws 403 status code with innerMostError code as \"serviceReadOnly\" for cases where the\n\t\t\t// database on server becomes readonly. The driver retries for such cases with exponential backup logic.\n\t\t\tif (innerMostErrorCode === OdspServiceReadOnlyErrorCode) {\n\t\t\t\terror = new RetryableError(errorMessage, OdspErrorTypes.serviceReadOnly, driverProps);\n\t\t\t} else if (\n\t\t\t\tinnerMostErrorCode === \"blockedIPAddress\" ||\n\t\t\t\tinnerMostErrorCode === \"conditionalAccessPolicyEnforced\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\t\"IP Address is blocked\",\n\t\t\t\t\tOdspErrorTypes.blockedIPAddress,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst claims = response?.headers ? parseAuthErrorClaims(response.headers) : undefined;\n\t\t\t\tconst tenantId = response?.headers\n\t\t\t\t\t? parseAuthErrorTenant(response.headers)\n\t\t\t\t\t: undefined;\n\t\t\t\terror = new AuthorizationError(errorMessage, claims, tenantId, driverProps);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 404: {\n\t\t\tif (parseResult.success) {\n\t\t\t\t// The location of file can move on Spo. If the manual redirect prefer header is added to network call\n\t\t\t\t// it returns 404 error instead of 308. Error thrown by server will contain the new redirect location.\n\t\t\t\t// For reference we can look here: \\packages\\drivers\\odsp-driver\\src\\fetchSnapshot.ts\n\t\t\t\tconst responseError = parseResult?.errorResponse?.error;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- TODO: use stronger typing here.\n\t\t\t\tredirectLocation = responseError?.[\"@error.redirectLocation\"];\n\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileNotFoundOrAccessDeniedError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 406: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.unsupportedClientProtocolVersion,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 410: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.cannotCatchUp, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 409: {\n\t\t\t// This status code is sent by the server when the client and server epoch mismatches.\n\t\t\t// The client sets its epoch version in the calls it makes to the server and if that mismatches\n\t\t\t// with the server epoch version, the server throws this error code.\n\t\t\t// This indicates that the file/container has been modified externally.\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 412: {\n\t\t\t// \"Precondition Failed\" error - happens when uploadSummaryWithContext uses wrong parent.\n\t\t\t// Resubmitting same payload is not going to help, so this is non-recoverable failure!\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 413: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.snapshotTooBig, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 414: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tOdspErrorTypes.invalidFileNameError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 423: {\n\t\t\t// File locked\n\t\t\tif (\n\t\t\t\tinnerMostErrorCode === \"resourceLocked\" ||\n\t\t\t\tinnerMostErrorCode === \"resourceCheckedOut\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tDriverErrorTypes.fileIsLocked,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcase 500: {\n\t\t\terror = new RetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 501: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.fluidNotEnabled, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 507: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.outOfStorageError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase fetchIncorrectResponse: {\n\t\t\t// Note that getWithRetryForTokenRefresh will retry it once, then it becomes non-retryable error\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.incorrectServerResponse,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst retryAfterMs =\n\t\t\t\tretryAfterSeconds === undefined ? undefined : retryAfterSeconds * 1000;\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Set this to true as createOdspNetworkError is called to handle error response from service.\n\terror.addTelemetryProperties({ endpointReached: true });\n\tenrichOdspError(error, response, facetCodes, undefined);\n\treturn error;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function enrichOdspError(\n\terror: IFluidErrorBase & OdspError,\n\tresponse?: Response,\n\tfacetCodes?: string[],\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\terror.online = OnlineStatus[isOnline()];\n\tif (facetCodes !== undefined) {\n\t\terror.facetCodes = facetCodes;\n\t}\n\n\tif (response) {\n\t\tprops.responseType = response.type;\n\t\tif (response.headers) {\n\t\t\tconst headers = getSPOAndGraphRequestIdsFromResponse(response.headers);\n\t\t\tfor (const key of Object.keys(headers)) {\n\t\t\t\tprops[key] = headers[key];\n\t\t\t}\n\t\t\terror.serverEpoch = response.headers.get(\"x-fluid-epoch\") ?? undefined;\n\t\t}\n\t}\n\terror.addTelemetryProperties(props);\n\treturn error;\n}\n\n/**\n * Throws network error - an object with a bunch of network related properties\n * @internal\n */\nexport function throwOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tresponse: Response,\n\tresponseText?: string,\n\tprops?: ITelemetryBaseProperties,\n): never {\n\tconst networkError = createOdspNetworkError(\n\t\terrorMessage,\n\t\tstatusCode,\n\t\tnumberFromHeader(response.headers.get(\"retry-after\")) /* retryAfterSeconds */,\n\t\tresponse,\n\t\tresponseText,\n\t\tprops,\n\t);\n\n\tnetworkError.addTelemetryProperties({ odspError: true, storageServiceError: true });\n\n\tthrow networkError;\n}\n\n// eslint-disable-next-line @rushstack/no-new-null\nfunction numberFromHeader(header: string | null): number | undefined {\n\tif (header === null) {\n\t\treturn undefined;\n\t}\n\tconst n = Number(header);\n\tif (Number.isNaN(n)) {\n\t\treturn undefined;\n\t}\n\treturn n;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasFacetCodes(x: unknown): x is Pick<IOdspErrorAugmentations, \"facetCodes\"> {\n\treturn Array.isArray((x as Partial<IOdspErrorAugmentations>)?.facetCodes);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasRedirectionLocation(\n\tx: unknown,\n): x is Pick<IOdspErrorAugmentations, \"redirectLocation\"> {\n\treturn (\n\t\tx !== null &&\n\t\ttypeof x === \"object\" &&\n\t\t\"redirectLocation\" in x &&\n\t\ttypeof (x as Partial<IOdspErrorAugmentations>)?.redirectLocation === \"string\"\n\t);\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/odsp-doclib-utils";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.81.0-374083";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/odsp-doclib-utils";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.81.0-374083";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC9C,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC9C,QAAA,UAAU,GAAG,eAAe,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/odsp-doclib-utils\";\nexport const pkgVersion = \"2.81.0-374083\";\n"]}
|
package/eslint.config.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* To regenerate: pnpm tsx scripts/generate-flat-eslint-configs.ts --typescript
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
5
4
|
*/
|
|
5
|
+
|
|
6
6
|
import type { Linter } from "eslint";
|
|
7
7
|
import { recommended } from "../../../common/build/eslint-config-fluid/flat.mts";
|
|
8
8
|
|
|
@@ -13,25 +13,6 @@ const config: Linter.Config[] = [
|
|
|
13
13
|
"@typescript-eslint/no-use-before-define": "off",
|
|
14
14
|
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
15
15
|
"no-case-declarations": "off",
|
|
16
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
17
|
-
"error",
|
|
18
|
-
{
|
|
19
|
-
"fixStyle": "inline-type-imports",
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
files: ["**/*.{ts,tsx}"],
|
|
27
|
-
ignores: ["**/src/test/**", "**/tests/**", "**/*.spec.ts", "**/*.test.ts"],
|
|
28
|
-
rules: {
|
|
29
|
-
"@typescript-eslint/consistent-type-exports": [
|
|
30
|
-
"error",
|
|
31
|
-
{
|
|
32
|
-
"fixMixedExportsWithInlineTypeSpecifier": true,
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
16
|
},
|
|
36
17
|
},
|
|
37
18
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspErrorUtils.d.ts","sourceRoot":"","sources":["../src/odspErrorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAEN,KAAK,yBAAyB,EAO9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,eAAe,EACpB,YAAY,EAEZ,MAAM,0CAA0C,CAAC;AAQlD;;GAEG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAG1C;;GAEG;AACH,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAG9D;;GAEG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE;IAE7D,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC/C,GAAG,wBAAwB,CA4D3B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,2BAA2B,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAA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CAAC,EAAE,MAAM,EACrB,KAAK,GAAE,wBAA6B,GAClC,eAAe,GAAG,SAAS,CAwM7B;AAGD;;GAEG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,QAAQ,CAAC,EAAE,QAAQ,EACnB,UAAU,CAAC,EAAE,MAAM,EAAE,EACrB,KAAK,GAAE,wBAA6B,GAClC,eAAe,GAAG,SAAS,CAkB7B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,wBAAwB,GAC9B,KAAK,CAaP;AAeD;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,IAAI,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAE1F;AAGD;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,CAAC,EAAE,OAAO,GACR,CAAC,IAAI,IAAI,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAOxD"}
|
package/lib/odspErrorUtils.js
CHANGED
|
@@ -177,6 +177,10 @@ export function createOdspNetworkError(errorMessage, statusCode, retryAfterSecon
|
|
|
177
177
|
error = new FluidInvalidSchemaError(errorMessage, driverProps);
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
|
+
if (innerMostErrorCode === "fluidEpochNotProvided") {
|
|
181
|
+
error = new RetryableError(errorMessage, OdspErrorTypes.usageError, driverProps);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
180
184
|
error = new NonRetryableError(errorMessage, DriverErrorTypes.genericNetworkError, driverProps);
|
|
181
185
|
break;
|
|
182
186
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspErrorUtils.js","sourceRoot":"","sources":["../src/odspErrorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO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CAAC;AAED,gFAAgF;AAChF;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,CAAU;IACvC,OAAO,KAAK,CAAC,OAAO,CAAE,CAAsC,EAAE,UAAU,CAAC,CAAC;AAC3E,CAAC;AAED,gFAAgF;AAChF;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACrC,CAAU;IAEV,OAAO,CACN,CAAC,KAAK,IAAI;QACV,OAAO,CAAC,KAAK,QAAQ;QACrB,kBAAkB,IAAI,CAAC;QACvB,OAAQ,CAAsC,EAAE,gBAAgB,KAAK,QAAQ,CAC7E,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\ttype DriverErrorTelemetryProps,\n\tFluidInvalidSchemaError,\n\tNonRetryableError,\n\tOnlineStatus,\n\tRetryableError,\n\tcreateGenericNetworkError,\n\tisOnline,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IOdspErrorAugmentations,\n\ttype OdspError,\n\tOdspErrorTypes,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\tLoggingError,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n// odsp-doclib-utils and odsp-driver will always release together and share the same pkgVersion\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { parseAuthErrorClaims } from \"./parseAuthErrorClaims.js\";\nimport { parseAuthErrorTenant } from \"./parseAuthErrorTenant.js\";\n\n// no response, or can't parse response\n/**\n * @internal\n */\nexport const fetchIncorrectResponse = 712;\n// Error code for when the server state is read only and client tries to write. This code is set by the server\n// and is not likely to change.\n/**\n * @internal\n */\nexport const OdspServiceReadOnlyErrorCode = \"serviceReadOnly\";\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function getSPOAndGraphRequestIdsFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}): ITelemetryBaseProperties {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: \"sprequestguid\", logName: \"sprequestguid\" },\n\t\t{ headerName: \"request-id\", logName: \"requestId\" },\n\t\t{ headerName: \"client-request-id\", logName: \"clientRequestId\" },\n\t\t{ headerName: \"x-msedge-ref\", logName: \"xMsedgeRef\" },\n\t\t{ headerName: \"X-Fluid-Retries\", logName: \"serverRetries\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryBaseProperties = {\n\t\tsprequestduration: numberFromString(headers.get(\"sprequestduration\")),\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\tfor (const header of headersToLog) {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t}\n\n\t// x-fluid-telemetry contains a key value pair in the following format:\n\t// x-fluid-telemetry:key1=value1,key2,key3=value3,\n\t// Ex. x-fluid-telemetry:Origin=c\n\tconst fluidTelemetry = headers.get(\"x-fluid-telemetry\");\n\tif (fluidTelemetry !== undefined && fluidTelemetry !== null) {\n\t\tadditionalProps.xFluidTelemetry = fluidTelemetry;\n\t\tconst keyValueMap = fluidTelemetry\n\t\t\t.split(\",\")\n\t\t\t.map((keyValuePair) => keyValuePair.split(\"=\"));\n\t\tfor (const [key, value] of keyValueMap) {\n\t\t\tif (\"Origin\" === key.trim()) {\n\t\t\t\tlet fieldValue: string;\n\t\t\t\tswitch (value?.trim()) {\n\t\t\t\t\tcase \"c\": {\n\t\t\t\t\t\tfieldValue = \"cache\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"g\": {\n\t\t\t\t\t\tfieldValue = \"graph\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tfieldValue = value?.trim();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst logName = \"responseOrigin\";\n\t\t\t\tadditionalProps[logName] = fieldValue;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn additionalProps;\n}\n\n/**\n * Empirically-based model of error response inner error from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponseInnerError {\n\tcode?: string;\n\tinnerError?: OdspErrorResponseInnerError;\n}\n\n/**\n * Empirically-based model of error responses from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponse {\n\terror: OdspErrorResponseInnerError & {\n\t\tmessage: string;\n\t};\n}\n\n/**\n * Error encapsulating the error response from ODSP containing the redirect location when a resource has moved\n *\n * @internal\n */\nexport class OdspRedirectError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectLocation: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectLocation (URL can contain sensitive info)\n\t\tsuper(message, props, new Set([\"redirectLocation\"]));\n\t}\n}\n\n/**\n * Empirically-based type guard for error responses from ODSP\n */\nfunction isOdspErrorResponse(x: unknown): x is OdspErrorResponse {\n\tconst error = (x as Partial<OdspErrorResponse>)?.error;\n\treturn (\n\t\ttypeof error?.message === \"string\" &&\n\t\t(error?.code === undefined || typeof error?.code === \"string\")\n\t);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function tryParseErrorResponse(\n\tresponse: string | undefined,\n): { success: true; errorResponse: OdspErrorResponse } | { success: false } {\n\ttry {\n\t\tif (response !== undefined) {\n\t\t\tconst parsed: unknown = JSON.parse(response);\n\t\t\tif (isOdspErrorResponse(parsed)) {\n\t\t\t\treturn { success: true, errorResponse: parsed };\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore JSON parsing errors\n\t}\n\treturn { success: false };\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function parseFacetCodes(errorResponse: OdspErrorResponse): string[] {\n\tconst stack: string[] = [];\n\tlet error: OdspErrorResponseInnerError | undefined = errorResponse.error;\n\twhile (typeof error === \"object\" && error !== null) {\n\t\tif (error.code !== undefined) {\n\t\t\tstack.unshift(error.code);\n\t\t}\n\t\terror = error.innerError;\n\t}\n\treturn stack;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function createOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterSeconds?: number,\n\tresponse?: Response,\n\tresponseText?: string,\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\tlet error: IFluidErrorBase & OdspError;\n\tconst parseResult = tryParseErrorResponse(responseText);\n\tlet facetCodes: string[] | undefined;\n\tlet innerMostErrorCode: string | undefined;\n\tif (parseResult.success) {\n\t\tconst errorResponse = parseResult.errorResponse;\n\t\t// logging the error response message\n\t\tprops.responseMessage = errorResponse.error.message;\n\t\tfacetCodes = parseFacetCodes(errorResponse);\n\t\tif (facetCodes !== undefined) {\n\t\t\tinnerMostErrorCode = facetCodes[0];\n\t\t\tprops.innerMostErrorCode = innerMostErrorCode;\n\t\t}\n\t}\n\n\tlet redirectLocation: string | undefined;\n\tconst driverProps = { driverVersion, statusCode, ...props };\n\n\tswitch (statusCode) {\n\t\t// The location of file can move on Spo. If the redirect:manual header is added to network call\n\t\t// it causes browser to not handle the redirects. Location header in such cases will contain the new location.\n\t\t// Refer: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n\t\tcase 301:\n\t\tcase 302:\n\t\tcase 303:\n\t\tcase 307:\n\t\tcase 308: {\n\t\t\tredirectLocation = response?.headers.get(\"Location\") ?? undefined;\n\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Don't break here. Let it be a generic network error if redirectLocation is not there.\n\t\tcase 400: {\n\t\t\tif (innerMostErrorCode === \"fluidInvalidSchema\") {\n\t\t\t\terror = new FluidInvalidSchemaError(errorMessage, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 401:\n\t\tcase 403: {\n\t\t\t// The server throws 403 status code with innerMostError code as \"serviceReadOnly\" for cases where the\n\t\t\t// database on server becomes readonly. The driver retries for such cases with exponential backup logic.\n\t\t\tif (innerMostErrorCode === OdspServiceReadOnlyErrorCode) {\n\t\t\t\terror = new RetryableError(errorMessage, OdspErrorTypes.serviceReadOnly, driverProps);\n\t\t\t} else if (\n\t\t\t\tinnerMostErrorCode === \"blockedIPAddress\" ||\n\t\t\t\tinnerMostErrorCode === \"conditionalAccessPolicyEnforced\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\t\"IP Address is blocked\",\n\t\t\t\t\tOdspErrorTypes.blockedIPAddress,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst claims = response?.headers ? parseAuthErrorClaims(response.headers) : undefined;\n\t\t\t\tconst tenantId = response?.headers\n\t\t\t\t\t? parseAuthErrorTenant(response.headers)\n\t\t\t\t\t: undefined;\n\t\t\t\terror = new AuthorizationError(errorMessage, claims, tenantId, driverProps);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 404: {\n\t\t\tif (parseResult.success) {\n\t\t\t\t// The location of file can move on Spo. If the manual redirect prefer header is added to network call\n\t\t\t\t// it returns 404 error instead of 308. Error thrown by server will contain the new redirect location.\n\t\t\t\t// For reference we can look here: \\packages\\drivers\\odsp-driver\\src\\fetchSnapshot.ts\n\t\t\t\tconst responseError = parseResult?.errorResponse?.error;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- TODO: use stronger typing here.\n\t\t\t\tredirectLocation = responseError?.[\"@error.redirectLocation\"];\n\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileNotFoundOrAccessDeniedError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 406: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.unsupportedClientProtocolVersion,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 410: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.cannotCatchUp, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 409: {\n\t\t\t// This status code is sent by the server when the client and server epoch mismatches.\n\t\t\t// The client sets its epoch version in the calls it makes to the server and if that mismatches\n\t\t\t// with the server epoch version, the server throws this error code.\n\t\t\t// This indicates that the file/container has been modified externally.\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 412: {\n\t\t\t// \"Precondition Failed\" error - happens when uploadSummaryWithContext uses wrong parent.\n\t\t\t// Resubmitting same payload is not going to help, so this is non-recoverable failure!\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 413: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.snapshotTooBig, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 414: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tOdspErrorTypes.invalidFileNameError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 423: {\n\t\t\t// File locked\n\t\t\tif (\n\t\t\t\tinnerMostErrorCode === \"resourceLocked\" ||\n\t\t\t\tinnerMostErrorCode === \"resourceCheckedOut\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tDriverErrorTypes.fileIsLocked,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcase 500: {\n\t\t\terror = new RetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 501: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.fluidNotEnabled, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 507: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.outOfStorageError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase fetchIncorrectResponse: {\n\t\t\t// Note that getWithRetryForTokenRefresh will retry it once, then it becomes non-retryable error\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.incorrectServerResponse,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst retryAfterMs =\n\t\t\t\tretryAfterSeconds === undefined ? undefined : retryAfterSeconds * 1000;\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Set this to true as createOdspNetworkError is called to handle error response from service.\n\terror.addTelemetryProperties({ endpointReached: true });\n\tenrichOdspError(error, response, facetCodes, undefined);\n\treturn error;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function enrichOdspError(\n\terror: IFluidErrorBase & OdspError,\n\tresponse?: Response,\n\tfacetCodes?: string[],\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\terror.online = OnlineStatus[isOnline()];\n\tif (facetCodes !== undefined) {\n\t\terror.facetCodes = facetCodes;\n\t}\n\n\tif (response) {\n\t\tprops.responseType = response.type;\n\t\tif (response.headers) {\n\t\t\tconst headers = getSPOAndGraphRequestIdsFromResponse(response.headers);\n\t\t\tfor (const key of Object.keys(headers)) {\n\t\t\t\tprops[key] = headers[key];\n\t\t\t}\n\t\t\terror.serverEpoch = response.headers.get(\"x-fluid-epoch\") ?? undefined;\n\t\t}\n\t}\n\terror.addTelemetryProperties(props);\n\treturn error;\n}\n\n/**\n * Throws network error - an object with a bunch of network related properties\n * @internal\n */\nexport function throwOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tresponse: Response,\n\tresponseText?: string,\n\tprops?: ITelemetryBaseProperties,\n): never {\n\tconst networkError = createOdspNetworkError(\n\t\terrorMessage,\n\t\tstatusCode,\n\t\tnumberFromHeader(response.headers.get(\"retry-after\")) /* retryAfterSeconds */,\n\t\tresponse,\n\t\tresponseText,\n\t\tprops,\n\t);\n\n\tnetworkError.addTelemetryProperties({ odspError: true, storageServiceError: true });\n\n\tthrow networkError;\n}\n\n// eslint-disable-next-line @rushstack/no-new-null\nfunction numberFromHeader(header: string | null): number | undefined {\n\tif (header === null) {\n\t\treturn undefined;\n\t}\n\tconst n = Number(header);\n\tif (Number.isNaN(n)) {\n\t\treturn undefined;\n\t}\n\treturn n;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasFacetCodes(x: unknown): x is Pick<IOdspErrorAugmentations, \"facetCodes\"> {\n\treturn Array.isArray((x as Partial<IOdspErrorAugmentations>)?.facetCodes);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasRedirectionLocation(\n\tx: unknown,\n): x is Pick<IOdspErrorAugmentations, \"redirectLocation\"> {\n\treturn (\n\t\tx !== null &&\n\t\ttypeof x === \"object\" &&\n\t\t\"redirectLocation\" in x &&\n\t\ttypeof (x as Partial<IOdspErrorAugmentations>)?.redirectLocation === \"string\"\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspErrorUtils.js","sourceRoot":"","sources":["../src/odspErrorUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EACN,kBAAkB,EAElB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,yBAAyB,EACzB,QAAQ,GACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAGN,cAAc,GACd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,YAAY,EACZ,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAElD,+FAA+F;AAC/F,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,oBAAoB,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AkB,IAAI,CAAC;QACvB,OAAQ,CAAsC,EAAE,gBAAgB,KAAK,QAAQ,CAC7E,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tAuthorizationError,\n\ttype DriverErrorTelemetryProps,\n\tFluidInvalidSchemaError,\n\tNonRetryableError,\n\tOnlineStatus,\n\tRetryableError,\n\tcreateGenericNetworkError,\n\tisOnline,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype IOdspErrorAugmentations,\n\ttype OdspError,\n\tOdspErrorTypes,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\tLoggingError,\n\tnumberFromString,\n} from \"@fluidframework/telemetry-utils/internal\";\n\n// odsp-doclib-utils and odsp-driver will always release together and share the same pkgVersion\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { parseAuthErrorClaims } from \"./parseAuthErrorClaims.js\";\nimport { parseAuthErrorTenant } from \"./parseAuthErrorTenant.js\";\n\n// no response, or can't parse response\n/**\n * @internal\n */\nexport const fetchIncorrectResponse = 712;\n// Error code for when the server state is read only and client tries to write. This code is set by the server\n// and is not likely to change.\n/**\n * @internal\n */\nexport const OdspServiceReadOnlyErrorCode = \"serviceReadOnly\";\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function getSPOAndGraphRequestIdsFromResponse(headers: {\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tget: (id: string) => string | undefined | null;\n}): ITelemetryBaseProperties {\n\tinterface LoggingHeader {\n\t\theaderName: string;\n\t\tlogName: string;\n\t}\n\n\t// We rename headers so that otel doesn't scrub them away. Otel doesn't allow\n\t// certain characters in headers including '-'\n\tconst headersToLog: LoggingHeader[] = [\n\t\t{ headerName: \"sprequestguid\", logName: \"sprequestguid\" },\n\t\t{ headerName: \"request-id\", logName: \"requestId\" },\n\t\t{ headerName: \"client-request-id\", logName: \"clientRequestId\" },\n\t\t{ headerName: \"x-msedge-ref\", logName: \"xMsedgeRef\" },\n\t\t{ headerName: \"X-Fluid-Retries\", logName: \"serverRetries\" },\n\t\t{ headerName: \"content-encoding\", logName: \"contentEncoding\" },\n\t\t{ headerName: \"content-type\", logName: \"contentType\" },\n\t];\n\tconst additionalProps: ITelemetryBaseProperties = {\n\t\tsprequestduration: numberFromString(headers.get(\"sprequestduration\")),\n\t\tcontentsize: numberFromString(headers.get(\"content-length\")),\n\t};\n\tfor (const header of headersToLog) {\n\t\tconst headerValue = headers.get(header.headerName);\n\t\tif (headerValue !== undefined && headerValue !== null) {\n\t\t\tadditionalProps[header.logName] = headerValue;\n\t\t}\n\t}\n\n\t// x-fluid-telemetry contains a key value pair in the following format:\n\t// x-fluid-telemetry:key1=value1,key2,key3=value3,\n\t// Ex. x-fluid-telemetry:Origin=c\n\tconst fluidTelemetry = headers.get(\"x-fluid-telemetry\");\n\tif (fluidTelemetry !== undefined && fluidTelemetry !== null) {\n\t\tadditionalProps.xFluidTelemetry = fluidTelemetry;\n\t\tconst keyValueMap = fluidTelemetry\n\t\t\t.split(\",\")\n\t\t\t.map((keyValuePair) => keyValuePair.split(\"=\"));\n\t\tfor (const [key, value] of keyValueMap) {\n\t\t\tif (\"Origin\" === key.trim()) {\n\t\t\t\tlet fieldValue: string;\n\t\t\t\tswitch (value?.trim()) {\n\t\t\t\t\tcase \"c\": {\n\t\t\t\t\t\tfieldValue = \"cache\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"g\": {\n\t\t\t\t\t\tfieldValue = \"graph\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tfieldValue = value?.trim();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconst logName = \"responseOrigin\";\n\t\t\t\tadditionalProps[logName] = fieldValue;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\treturn additionalProps;\n}\n\n/**\n * Empirically-based model of error response inner error from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponseInnerError {\n\tcode?: string;\n\tinnerError?: OdspErrorResponseInnerError;\n}\n\n/**\n * Empirically-based model of error responses from ODSP\n *\n * @internal\n */\nexport interface OdspErrorResponse {\n\terror: OdspErrorResponseInnerError & {\n\t\tmessage: string;\n\t};\n}\n\n/**\n * Error encapsulating the error response from ODSP containing the redirect location when a resource has moved\n *\n * @internal\n */\nexport class OdspRedirectError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = DriverErrorTypes.fileNotFoundOrAccessDeniedError;\n\treadonly canRetry = false;\n\n\tconstructor(\n\t\tmessage: string,\n\t\treadonly redirectLocation: string | undefined,\n\t\tprops: DriverErrorTelemetryProps,\n\t) {\n\t\t// do not log redirectLocation (URL can contain sensitive info)\n\t\tsuper(message, props, new Set([\"redirectLocation\"]));\n\t}\n}\n\n/**\n * Empirically-based type guard for error responses from ODSP\n */\nfunction isOdspErrorResponse(x: unknown): x is OdspErrorResponse {\n\tconst error = (x as Partial<OdspErrorResponse>)?.error;\n\treturn (\n\t\ttypeof error?.message === \"string\" &&\n\t\t(error?.code === undefined || typeof error?.code === \"string\")\n\t);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function tryParseErrorResponse(\n\tresponse: string | undefined,\n): { success: true; errorResponse: OdspErrorResponse } | { success: false } {\n\ttry {\n\t\tif (response !== undefined) {\n\t\t\tconst parsed: unknown = JSON.parse(response);\n\t\t\tif (isOdspErrorResponse(parsed)) {\n\t\t\t\treturn { success: true, errorResponse: parsed };\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore JSON parsing errors\n\t}\n\treturn { success: false };\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function parseFacetCodes(errorResponse: OdspErrorResponse): string[] {\n\tconst stack: string[] = [];\n\tlet error: OdspErrorResponseInnerError | undefined = errorResponse.error;\n\twhile (typeof error === \"object\" && error !== null) {\n\t\tif (error.code !== undefined) {\n\t\t\tstack.unshift(error.code);\n\t\t}\n\t\terror = error.innerError;\n\t}\n\treturn stack;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function createOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterSeconds?: number,\n\tresponse?: Response,\n\tresponseText?: string,\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\tlet error: IFluidErrorBase & OdspError;\n\tconst parseResult = tryParseErrorResponse(responseText);\n\tlet facetCodes: string[] | undefined;\n\tlet innerMostErrorCode: string | undefined;\n\tif (parseResult.success) {\n\t\tconst errorResponse = parseResult.errorResponse;\n\t\t// logging the error response message\n\t\tprops.responseMessage = errorResponse.error.message;\n\t\tfacetCodes = parseFacetCodes(errorResponse);\n\t\tif (facetCodes !== undefined) {\n\t\t\tinnerMostErrorCode = facetCodes[0];\n\t\t\tprops.innerMostErrorCode = innerMostErrorCode;\n\t\t}\n\t}\n\n\tlet redirectLocation: string | undefined;\n\tconst driverProps = { driverVersion, statusCode, ...props };\n\n\tswitch (statusCode) {\n\t\t// The location of file can move on Spo. If the redirect:manual header is added to network call\n\t\t// it causes browser to not handle the redirects. Location header in such cases will contain the new location.\n\t\t// Refer: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n\t\tcase 301:\n\t\tcase 302:\n\t\tcase 303:\n\t\tcase 307:\n\t\tcase 308: {\n\t\t\tredirectLocation = response?.headers.get(\"Location\") ?? undefined;\n\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Don't break here. Let it be a generic network error if redirectLocation is not there.\n\t\tcase 400: {\n\t\t\tif (innerMostErrorCode === \"fluidInvalidSchema\") {\n\t\t\t\terror = new FluidInvalidSchemaError(errorMessage, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (innerMostErrorCode === \"fluidEpochNotProvided\") {\n\t\t\t\terror = new RetryableError(errorMessage, OdspErrorTypes.usageError, driverProps);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 401:\n\t\tcase 403: {\n\t\t\t// The server throws 403 status code with innerMostError code as \"serviceReadOnly\" for cases where the\n\t\t\t// database on server becomes readonly. The driver retries for such cases with exponential backup logic.\n\t\t\tif (innerMostErrorCode === OdspServiceReadOnlyErrorCode) {\n\t\t\t\terror = new RetryableError(errorMessage, OdspErrorTypes.serviceReadOnly, driverProps);\n\t\t\t} else if (\n\t\t\t\tinnerMostErrorCode === \"blockedIPAddress\" ||\n\t\t\t\tinnerMostErrorCode === \"conditionalAccessPolicyEnforced\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\t\"IP Address is blocked\",\n\t\t\t\t\tOdspErrorTypes.blockedIPAddress,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tconst claims = response?.headers ? parseAuthErrorClaims(response.headers) : undefined;\n\t\t\t\tconst tenantId = response?.headers\n\t\t\t\t\t? parseAuthErrorTenant(response.headers)\n\t\t\t\t\t: undefined;\n\t\t\t\terror = new AuthorizationError(errorMessage, claims, tenantId, driverProps);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 404: {\n\t\t\tif (parseResult.success) {\n\t\t\t\t// The location of file can move on Spo. If the manual redirect prefer header is added to network call\n\t\t\t\t// it returns 404 error instead of 308. Error thrown by server will contain the new redirect location.\n\t\t\t\t// For reference we can look here: \\packages\\drivers\\odsp-driver\\src\\fetchSnapshot.ts\n\t\t\t\tconst responseError = parseResult?.errorResponse?.error;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- TODO: use stronger typing here.\n\t\t\t\tredirectLocation = responseError?.[\"@error.redirectLocation\"];\n\t\t\t\tif (redirectLocation !== undefined) {\n\t\t\t\t\terror = new OdspRedirectError(errorMessage, redirectLocation, driverProps);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileNotFoundOrAccessDeniedError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 406: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.unsupportedClientProtocolVersion,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 410: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.cannotCatchUp, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 409: {\n\t\t\t// This status code is sent by the server when the client and server epoch mismatches.\n\t\t\t// The client sets its epoch version in the calls it makes to the server and if that mismatches\n\t\t\t// with the server epoch version, the server throws this error code.\n\t\t\t// This indicates that the file/container has been modified externally.\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 412: {\n\t\t\t// \"Precondition Failed\" error - happens when uploadSummaryWithContext uses wrong parent.\n\t\t\t// Resubmitting same payload is not going to help, so this is non-recoverable failure!\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 413: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.snapshotTooBig, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 414: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tOdspErrorTypes.invalidFileNameError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 423: {\n\t\t\t// File locked\n\t\t\tif (\n\t\t\t\tinnerMostErrorCode === \"resourceLocked\" ||\n\t\t\t\tinnerMostErrorCode === \"resourceCheckedOut\"\n\t\t\t) {\n\t\t\t\terror = new NonRetryableError(\n\t\t\t\t\terrorMessage,\n\t\t\t\t\tDriverErrorTypes.fileIsLocked,\n\t\t\t\t\tdriverProps,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tcase 500: {\n\t\t\terror = new RetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.genericNetworkError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase 501: {\n\t\t\terror = new NonRetryableError(errorMessage, OdspErrorTypes.fluidNotEnabled, driverProps);\n\t\t\tbreak;\n\t\t}\n\t\tcase 507: {\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.outOfStorageError,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tcase fetchIncorrectResponse: {\n\t\t\t// Note that getWithRetryForTokenRefresh will retry it once, then it becomes non-retryable error\n\t\t\terror = new NonRetryableError(\n\t\t\t\terrorMessage,\n\t\t\t\tDriverErrorTypes.incorrectServerResponse,\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst retryAfterMs =\n\t\t\t\tretryAfterSeconds === undefined ? undefined : retryAfterSeconds * 1000;\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tdriverProps,\n\t\t\t);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Set this to true as createOdspNetworkError is called to handle error response from service.\n\terror.addTelemetryProperties({ endpointReached: true });\n\tenrichOdspError(error, response, facetCodes, undefined);\n\treturn error;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function enrichOdspError(\n\terror: IFluidErrorBase & OdspError,\n\tresponse?: Response,\n\tfacetCodes?: string[],\n\tprops: ITelemetryBaseProperties = {},\n): IFluidErrorBase & OdspError {\n\terror.online = OnlineStatus[isOnline()];\n\tif (facetCodes !== undefined) {\n\t\terror.facetCodes = facetCodes;\n\t}\n\n\tif (response) {\n\t\tprops.responseType = response.type;\n\t\tif (response.headers) {\n\t\t\tconst headers = getSPOAndGraphRequestIdsFromResponse(response.headers);\n\t\t\tfor (const key of Object.keys(headers)) {\n\t\t\t\tprops[key] = headers[key];\n\t\t\t}\n\t\t\terror.serverEpoch = response.headers.get(\"x-fluid-epoch\") ?? undefined;\n\t\t}\n\t}\n\terror.addTelemetryProperties(props);\n\treturn error;\n}\n\n/**\n * Throws network error - an object with a bunch of network related properties\n * @internal\n */\nexport function throwOdspNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tresponse: Response,\n\tresponseText?: string,\n\tprops?: ITelemetryBaseProperties,\n): never {\n\tconst networkError = createOdspNetworkError(\n\t\terrorMessage,\n\t\tstatusCode,\n\t\tnumberFromHeader(response.headers.get(\"retry-after\")) /* retryAfterSeconds */,\n\t\tresponse,\n\t\tresponseText,\n\t\tprops,\n\t);\n\n\tnetworkError.addTelemetryProperties({ odspError: true, storageServiceError: true });\n\n\tthrow networkError;\n}\n\n// eslint-disable-next-line @rushstack/no-new-null\nfunction numberFromHeader(header: string | null): number | undefined {\n\tif (header === null) {\n\t\treturn undefined;\n\t}\n\tconst n = Number(header);\n\tif (Number.isNaN(n)) {\n\t\treturn undefined;\n\t}\n\treturn n;\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasFacetCodes(x: unknown): x is Pick<IOdspErrorAugmentations, \"facetCodes\"> {\n\treturn Array.isArray((x as Partial<IOdspErrorAugmentations>)?.facetCodes);\n}\n\n// eslint-disable-next-line jsdoc/require-description -- TODO: Add documentation\n/**\n * @internal\n */\nexport function hasRedirectionLocation(\n\tx: unknown,\n): x is Pick<IOdspErrorAugmentations, \"redirectLocation\"> {\n\treturn (\n\t\tx !== null &&\n\t\ttypeof x === \"object\" &&\n\t\t\"redirectLocation\" in x &&\n\t\ttypeof (x as Partial<IOdspErrorAugmentations>)?.redirectLocation === \"string\"\n\t);\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/odsp-doclib-utils";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.81.0-374083";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,sCAAsC,CAAC;AAC3D,eAAO,MAAM,UAAU,kBAAkB,CAAC"}
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,mCAAmC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,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/odsp-doclib-utils\";\nexport const pkgVersion = \"2.81.0-374083\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-doclib-utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.81.0-374083",
|
|
4
4
|
"description": "ODSP utilities",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,37 +69,37 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "
|
|
73
|
-
"@fluidframework/core-interfaces": "
|
|
74
|
-
"@fluidframework/core-utils": "
|
|
75
|
-
"@fluidframework/driver-definitions": "
|
|
76
|
-
"@fluidframework/driver-utils": "
|
|
77
|
-
"@fluidframework/odsp-driver-definitions": "
|
|
78
|
-
"@fluidframework/telemetry-utils": "
|
|
72
|
+
"@fluid-internal/client-utils": "2.81.0-374083",
|
|
73
|
+
"@fluidframework/core-interfaces": "2.81.0-374083",
|
|
74
|
+
"@fluidframework/core-utils": "2.81.0-374083",
|
|
75
|
+
"@fluidframework/driver-definitions": "2.81.0-374083",
|
|
76
|
+
"@fluidframework/driver-utils": "2.81.0-374083",
|
|
77
|
+
"@fluidframework/odsp-driver-definitions": "2.81.0-374083",
|
|
78
|
+
"@fluidframework/telemetry-utils": "2.81.0-374083",
|
|
79
79
|
"isomorphic-fetch": "^3.0.0"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@arethetypeswrong/cli": "^0.
|
|
82
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
83
83
|
"@biomejs/biome": "~1.9.3",
|
|
84
|
-
"@fluid-internal/mocha-test-setup": "
|
|
85
|
-
"@fluid-tools/build-cli": "^0.
|
|
84
|
+
"@fluid-internal/mocha-test-setup": "2.81.0-374083",
|
|
85
|
+
"@fluid-tools/build-cli": "^0.63.0",
|
|
86
86
|
"@fluidframework/build-common": "^2.0.3",
|
|
87
|
-
"@fluidframework/build-tools": "^0.
|
|
88
|
-
"@fluidframework/eslint-config-fluid": "
|
|
89
|
-
"@fluidframework/odsp-doclib-utils-previous": "npm:@fluidframework/odsp-doclib-utils@2.
|
|
87
|
+
"@fluidframework/build-tools": "^0.63.0",
|
|
88
|
+
"@fluidframework/eslint-config-fluid": "2.81.0-374083",
|
|
89
|
+
"@fluidframework/odsp-doclib-utils-previous": "npm:@fluidframework/odsp-doclib-utils@2.80.0",
|
|
90
90
|
"@microsoft/api-extractor": "7.52.11",
|
|
91
91
|
"@types/isomorphic-fetch": "^0.0.39",
|
|
92
92
|
"@types/mocha": "^10.0.10",
|
|
93
93
|
"@types/node": "^18.19.0",
|
|
94
94
|
"c8": "^10.1.3",
|
|
95
|
-
"concurrently": "^
|
|
95
|
+
"concurrently": "^9.2.1",
|
|
96
96
|
"copyfiles": "^2.4.1",
|
|
97
|
-
"cross-env": "^
|
|
98
|
-
"eslint": "~
|
|
97
|
+
"cross-env": "^10.1.0",
|
|
98
|
+
"eslint": "~9.39.1",
|
|
99
99
|
"jiti": "^2.6.1",
|
|
100
100
|
"mocha": "^10.8.2",
|
|
101
101
|
"mocha-multi-reporters": "^1.5.1",
|
|
102
|
-
"rimraf": "^
|
|
102
|
+
"rimraf": "^6.1.2",
|
|
103
103
|
"typescript": "~5.4.5"
|
|
104
104
|
},
|
|
105
105
|
"typeValidation": {
|
package/src/odspErrorUtils.ts
CHANGED
|
@@ -250,6 +250,10 @@ export function createOdspNetworkError(
|
|
|
250
250
|
error = new FluidInvalidSchemaError(errorMessage, driverProps);
|
|
251
251
|
break;
|
|
252
252
|
}
|
|
253
|
+
if (innerMostErrorCode === "fluidEpochNotProvided") {
|
|
254
|
+
error = new RetryableError(errorMessage, OdspErrorTypes.usageError, driverProps);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
253
257
|
error = new NonRetryableError(
|
|
254
258
|
errorMessage,
|
|
255
259
|
DriverErrorTypes.genericNetworkError,
|
package/src/packageVersion.ts
CHANGED
package/.eslintrc.cjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
extends: [require.resolve("@fluidframework/eslint-config-fluid"), "prettier"],
|
|
8
|
-
parserOptions: {
|
|
9
|
-
project: ["./tsconfig.json", "./src/test/tsconfig.json"],
|
|
10
|
-
},
|
|
11
|
-
rules: {
|
|
12
|
-
"@typescript-eslint/no-use-before-define": "off",
|
|
13
|
-
"@typescript-eslint/strict-boolean-expressions": "off",
|
|
14
|
-
"no-case-declarations": "off",
|
|
15
|
-
|
|
16
|
-
// #region TODO: remove these once eslint-config-fluid has been updated to 5.8.0
|
|
17
|
-
"@typescript-eslint/consistent-type-exports": [
|
|
18
|
-
"error",
|
|
19
|
-
{ fixMixedExportsWithInlineTypeSpecifier: true },
|
|
20
|
-
],
|
|
21
|
-
"@typescript-eslint/consistent-type-imports": [
|
|
22
|
-
"error",
|
|
23
|
-
{ fixStyle: "inline-type-imports" },
|
|
24
|
-
],
|
|
25
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
26
|
-
// #endregion
|
|
27
|
-
},
|
|
28
|
-
};
|