@fluidframework/container-utils
Advanced tools
+9
-11
@@ -7,12 +7,10 @@ /*! | ||
| module.exports = { | ||
| "extends": [ | ||
| require.resolve("@fluidframework/eslint-config-fluid"), "prettier" | ||
| ], | ||
| "parserOptions": { | ||
| "project": ["./tsconfig.json", "./src/test/tsconfig.json"] | ||
| }, | ||
| "rules": { | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| "@typescript-eslint/strict-boolean-expressions": "off", | ||
| } | ||
| } | ||
| extends: [require.resolve("@fluidframework/eslint-config-fluid/minimal"), "prettier"], | ||
| parserOptions: { | ||
| project: ["./tsconfig.json", "./src/test/tsconfig.json"], | ||
| }, | ||
| rules: { | ||
| "@typescript-eslint/no-non-null-assertion": "off", | ||
| "@typescript-eslint/strict-boolean-expressions": "off", | ||
| }, | ||
| }; |
+2
-2
@@ -6,5 +6,5 @@ /*! | ||
| 'use strict'; | ||
| "use strict"; | ||
| const getFluidTestMochaConfig = require('@fluidframework/mocha-test-setup/mocharc-common'); | ||
| const getFluidTestMochaConfig = require("@fluidframework/mocha-test-setup/mocharc-common"); | ||
@@ -11,0 +11,0 @@ const packageDir = __dirname; |
| { | ||
| "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
| "extends": "@fluidframework/build-common/api-extractor-common-report.json" | ||
| "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", | ||
| "extends": "@fluidframework/build-common/api-extractor-common-report.json" | ||
| } |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,WAAW,EACd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,YAAY,EACZ,eAAe,EAMlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,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encedMessage) { | ||
| const props = Object.assign({ dataProcessingError: 1, dataProcessingCodepath }, (sequencedMessage === undefined ? undefined : (0, exports.extractSafePropertiesFromMessage)(sequencedMessage))); | ||
| const props = Object.assign({ dataProcessingError: 1, dataProcessingCodepath }, (sequencedMessage === undefined | ||
| ? undefined | ||
| : (0, exports.extractSafePropertiesFromMessage)(sequencedMessage))); | ||
| const normalizedError = (0, telemetry_utils_1.normalizeError)(originalError, { props }); | ||
| // Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
| // but if so they are still suitable to be wrapped as DataProcessingError. | ||
| if ((0, telemetry_utils_1.isExternalError)(normalizedError) || normalizedError.errorType === telemetry_utils_1.NORMALIZED_ERROR_TYPE) { | ||
| if ((0, telemetry_utils_1.isExternalError)(normalizedError) || | ||
| normalizedError.errorType === telemetry_utils_1.NORMALIZED_ERROR_TYPE) { | ||
| // Create a new DataProcessingError to wrap this external error | ||
@@ -114,0 +117,0 @@ const dataProcessingError = (0, telemetry_utils_1.wrapError)(normalizedError, (message) => new DataProcessingError(message)); |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFAM+C;AAC/C,qEAQyC;AAIzC;;GAEG;AACH,MAAa,YAAa,SAAQ,8BAAY;IAG1C;;;;;OAKG;IACH,YACI,OAAe,EACN,KAAW,EACpB,KAA4B;QAE5B,mCAAmC;QACnC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAJjC,UAAK,GAAL,KAAK,CAAM;QAVf,cAAS,GAAG,0CAAkB,CAAC,YAAY,CAAC;IAerD,CAAC;CACJ;AAjBD,oCAiBC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,8BAAY;IAG/C,YACI,OAAe,EACN,iBAAyB,EAClC,KAA4B;QAE5B,KAAK,CAAC,OAAO,EAAE,KA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M,gCAAgC,GAAG,CAAC,OAAkC,EAAE,EAAE,CAAC,CAAC;IACrF,eAAe,EAAE,OAAO,CAAC,QAAQ;IACjC,qBAAqB,EAAE,OAAO,CAAC,cAAc;IAC7C,2BAA2B,EAAE,OAAO,CAAC,oBAAoB;IACzD,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;IAC/D,4BAA4B,EAAE,OAAO,CAAC,qBAAqB;IAC3D,gBAAgB,EAAE,OAAO,CAAC,SAAS;CACtC,CAAC,CAAC;AAPU,QAAA,gCAAgC,oCAO1C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ContainerErrorType,\n IGenericError,\n IErrorBase,\n IThrottlingWarning,\n IUsageError,\n} from \"@fluidframework/container-definitions\";\nimport {\n LoggingError,\n IFluidErrorBase,\n normalizeError,\n wrapError,\n wrapErrorAndLog,\n isExternalError,\n NORMALIZED_ERROR_TYPE,\n} from \"@fluidframework/telemetry-utils\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n readonly errorType = ContainerErrorType.genericError;\n\n /**\n * Create a new GenericError\n * @param message - Error message\n * @param error - inner error object\n * @param props - Telemetry props to include when the error is logged\n */\n constructor(\n message: string,\n readonly error?: any,\n props?: ITelemetryProperties,\n ) {\n // Don't try to log the inner error\n super(message, props, new Set([\"error\"]));\n }\n}\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = ContainerErrorType.throttlingError;\n\n private constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props?: ITelemetryProperties,\n ) {\n super(message, props);\n }\n\n /**\n * Wrap the given error as a ThrottlingWarning\n * Only preserves the error message, and applies the given retry after to the new warning object\n */\n static wrap(\n error: unknown,\n retryAfterSeconds: number,\n logger: ITelemetryLogger,\n ): IThrottlingWarning {\n const newErrorFn =\n (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n return wrapErrorAndLog(error, newErrorFn, logger);\n }\n}\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n readonly errorType = ContainerErrorType.usageError;\n\n constructor(\n message: string,\n ) {\n super(message, { usageError: true });\n }\n}\n\n/** Error indicating that a client's session has reached its time limit and is closed. */\nexport class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {\n readonly errorType = ContainerErrorType.clientSessionExpiredError;\n\n constructor(\n message: string,\n readonly expiryMs: number,\n ) {\n super(message, { timeoutMs: expiryMs });\n }\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n readonly errorType = ContainerErrorType.dataCorruptionError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n props: ITelemetryProperties,\n ) {\n super(message, { ...props, dataProcessingError: 1 });\n }\n}\n\n/**\n * DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service.\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from DataCorruptionError in that this may be a transient error that will not repro in another\n * client or session.\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n readonly errorType = ContainerErrorType.dataProcessingError;\n readonly canRetry = false;\n\n private constructor(errorMessage: string) {\n super(errorMessage);\n }\n\n /** Create a new DataProcessingError detected and raised with the FF code */\n static create(\n errorMessage: string,\n dataProcessingCodepath: string,\n sequencedMessage?: ISequencedDocumentMessage,\n props: ITelemetryProperties = {},\n ) {\n const dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n errorMessage,\n dataProcessingCodepath,\n sequencedMessage);\n dataProcessingError.addTelemetryProperties(props);\n\n return dataProcessingError;\n }\n\n /**\n * Wrap the given error in a DataProcessingError, unless the error is already of a known type\n * with the exception of a normalized LoggingError, which will still be wrapped.\n * In either case, the error will have some relevant properties added for telemetry\n * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n * one day we will move away from throwing these errors but rather we'll return them.\n * But an unrecognized error needs to be classified as DataProcessingError.\n * @param originalError - error to be converted\n * @param dataProcessingCodepath - which codepath failed while processing data\n * @param sequencedMessage - Sequenced message to include info about via telemetry props\n * @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error\n */\n static wrapIfUnrecognized(\n originalError: any,\n dataProcessingCodepath: string,\n sequencedMessage?: ISequencedDocumentMessage,\n ): IFluidErrorBase {\n const props = {\n dataProcessingError: 1,\n dataProcessingCodepath,\n ...(sequencedMessage === undefined ? undefined : extractSafePropertiesFromMessage(sequencedMessage)),\n };\n\n const normalizedError = normalizeError(originalError, { props });\n // Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n // but if so they are still suitable to be wrapped as DataProcessingError.\n if (isExternalError(normalizedError) || normalizedError.errorType === NORMALIZED_ERROR_TYPE) {\n // Create a new DataProcessingError to wrap this external error\n const dataProcessingError =\n wrapError(normalizedError, (message: string) => new DataProcessingError(message));\n\n // Copy over the props above and any others added to this error since first being normalized\n dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n return dataProcessingError;\n }\n return normalizedError;\n }\n}\n\nexport const extractSafePropertiesFromMessage = (message: ISequencedDocumentMessage) => ({\n messageClientId: message.clientId,\n messageSequenceNumber: message.sequenceNumber,\n messageClientSequenceNumber: message.clientSequenceNumber,\n messageReferenceSequenceNumber: message.referenceSequenceNumber,\n messageMinimumSequenceNumber: message.minimumSequenceNumber,\n messageTimestamp: message.timestamp,\n});\n"]} | ||
| {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iFA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AC,CAAC;QACjE,uEAAuE;QACvE,0EAA0E;QAC1E,IACC,IAAA,iCAAe,EAAC,eAAe,CAAC;YAChC,eAAe,CAAC,SAAS,KAAK,uCAAqB,EAClD;YACD,+DAA+D;YAC/D,MAAM,mBAAmB,GAAG,IAAA,2BAAS,EACpC,eAAe,EACf,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,OAAO,CAAC,CACrD,CAAC;YAEF,4FAA4F;YAC5F,mBAAmB,CAAC,sBAAsB,CAAC,eAAe,CAAC,sBAAsB,EAAE,CAAC,CAAC;YAErF,OAAO,mBAAmB,CAAC;SAC3B;QACD,OAAO,eAAe,CAAC;IACxB,CAAC;CACD;AAtED,kDAsEC;AAEM,MAAM,gCAAgC,GAAG,CAAC,OAAkC,EAAE,EAAE,CAAC,CAAC;IACxF,eAAe,EAAE,OAAO,CAAC,QAAQ;IACjC,qBAAqB,EAAE,OAAO,CAAC,cAAc;IAC7C,2BAA2B,EAAE,OAAO,CAAC,oBAAoB;IACzD,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;IAC/D,4BAA4B,EAAE,OAAO,CAAC,qBAAqB;IAC3D,gBAAgB,EAAE,OAAO,CAAC,SAAS;CACnC,CAAC,CAAC;AAPU,QAAA,gCAAgC,oCAO1C","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tContainerErrorType,\n\tIGenericError,\n\tIErrorBase,\n\tIThrottlingWarning,\n\tIUsageError,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tLoggingError,\n\tIFluidErrorBase,\n\tnormalizeError,\n\twrapError,\n\twrapErrorAndLog,\n\tisExternalError,\n\tNORMALIZED_ERROR_TYPE,\n} from \"@fluidframework/telemetry-utils\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.genericError;\n\n\t/**\n\t * Create a new GenericError\n\t * @param message - Error message\n\t * @param error - inner error object\n\t * @param props - Telemetry props to include when the error is logged\n\t */\n\tconstructor(message: string, readonly error?: any, props?: ITelemetryProperties) {\n\t\t// Don't try to log the inner error\n\t\tsuper(message, props, new Set([\"error\"]));\n\t}\n}\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.throttlingError;\n\n\tprivate constructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops?: ITelemetryProperties,\n\t) {\n\t\tsuper(message, props);\n\t}\n\n\t/**\n\t * Wrap the given error as a ThrottlingWarning\n\t * Only preserves the error message, and applies the given retry after to the new warning object\n\t */\n\tstatic wrap(\n\t\terror: unknown,\n\t\tretryAfterSeconds: number,\n\t\tlogger: ITelemetryLogger,\n\t): IThrottlingWarning {\n\t\tconst newErrorFn = (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n\t\treturn wrapErrorAndLog(error, newErrorFn, logger);\n\t}\n}\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.usageError;\n\n\tconstructor(message: string) {\n\t\tsuper(message, { usageError: true });\n\t}\n}\n\n/** Error indicating that a client's session has reached its time limit and is closed. */\nexport class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.clientSessionExpiredError;\n\n\tconstructor(message: string, readonly expiryMs: number) {\n\t\tsuper(message, { timeoutMs: expiryMs });\n\t}\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.dataCorruptionError;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: ITelemetryProperties) {\n\t\tsuper(message, { ...props, dataProcessingError: 1 });\n\t}\n}\n\n/**\n * DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service.\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from DataCorruptionError in that this may be a transient error that will not repro in another\n * client or session.\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.dataProcessingError;\n\treadonly canRetry = false;\n\n\tprivate constructor(errorMessage: string) {\n\t\tsuper(errorMessage);\n\t}\n\n\t/** Create a new DataProcessingError detected and raised with the FF code */\n\tstatic create(\n\t\terrorMessage: string,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t\tprops: ITelemetryProperties = {},\n\t) {\n\t\tconst dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n\t\t\terrorMessage,\n\t\t\tdataProcessingCodepath,\n\t\t\tsequencedMessage,\n\t\t);\n\t\tdataProcessingError.addTelemetryProperties(props);\n\n\t\treturn dataProcessingError;\n\t}\n\n\t/**\n\t * Wrap the given error in a DataProcessingError, unless the error is already of a known type\n\t * with the exception of a normalized LoggingError, which will still be wrapped.\n\t * In either case, the error will have some relevant properties added for telemetry\n\t * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n\t * one day we will move away from throwing these errors but rather we'll return them.\n\t * But an unrecognized error needs to be classified as DataProcessingError.\n\t * @param originalError - error to be converted\n\t * @param dataProcessingCodepath - which codepath failed while processing data\n\t * @param sequencedMessage - Sequenced message to include info about via telemetry props\n\t * @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error\n\t */\n\tstatic wrapIfUnrecognized(\n\t\toriginalError: any,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t): IFluidErrorBase {\n\t\tconst props = {\n\t\t\tdataProcessingError: 1,\n\t\t\tdataProcessingCodepath,\n\t\t\t...(sequencedMessage === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extractSafePropertiesFromMessage(sequencedMessage)),\n\t\t};\n\n\t\tconst normalizedError = normalizeError(originalError, { props });\n\t\t// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n\t\t// but if so they are still suitable to be wrapped as DataProcessingError.\n\t\tif (\n\t\t\tisExternalError(normalizedError) ||\n\t\t\tnormalizedError.errorType === NORMALIZED_ERROR_TYPE\n\t\t) {\n\t\t\t// Create a new DataProcessingError to wrap this external error\n\t\t\tconst dataProcessingError = wrapError(\n\t\t\t\tnormalizedError,\n\t\t\t\t(message: string) => new DataProcessingError(message),\n\t\t\t);\n\n\t\t\t// Copy over the props above and any others added to this error since first being normalized\n\t\t\tdataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n\t\t\treturn dataProcessingError;\n\t\t}\n\t\treturn normalizedError;\n\t}\n}\n\nexport const extractSafePropertiesFromMessage = (message: ISequencedDocumentMessage) => ({\n\tmessageClientId: message.clientId,\n\tmessageSequenceNumber: message.sequenceNumber,\n\tmessageClientSequenceNumber: message.clientSequenceNumber,\n\tmessageReferenceSequenceNumber: message.referenceSequenceNumber,\n\tmessageMinimumSequenceNumber: message.minimumSequenceNumber,\n\tmessageTimestamp: message.timestamp,\n});\n"]} |
@@ -8,3 +8,3 @@ /*! | ||
| export declare const pkgName = "@fluidframework/container-utils"; | ||
| export declare const pkgVersion = "2.0.0-dev.2.3.0.115467"; | ||
| export declare const pkgVersion = "2.0.0-dev.3.1.0.125672"; | ||
| //# sourceMappingURL=packageVersion.d.ts.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
| exports.pkgName = "@fluidframework/container-utils"; | ||
| exports.pkgVersion = "2.0.0-dev.2.3.0.115467"; | ||
| exports.pkgVersion = "2.0.0-dev.3.1.0.125672"; | ||
| //# sourceMappingURL=packageVersion.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,wBAAwB,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/container-utils\";\nexport const pkgVersion = \"2.0.0-dev.2.3.0.115467\";\n"]} | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,iCAAiC,CAAC;AAC5C,QAAA,UAAU,GAAG,wBAAwB,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/container-utils\";\nexport const pkgVersion = \"2.0.0-dev.3.1.0.125672\";\n"]} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,WAAW,EACd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,YAAY,EACZ,eAAe,EAMlB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF;;GAEG;AACH,qBAAa,YAAa,SAAQ,YAAa,YAAW,aAAa,EAAE,eAAe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Aa,YAAW,WAAW,EAAE,eAAe;IACnF,QAAQ,CAAC,SAAS,iCAAiC;gBAEvC,OAAO,EAAE,MAAM;CAG3B;AAED,yFAAyF;AACzF,qBAAa,yBAA0B,SAAQ,YAAa,YAAW,eAAe;IAGxD,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAFtD,QAAQ,CAAC,SAAS,gDAAgD;gBAEtD,OAAO,EAAE,MAAM,EAAW,QAAQ,EAAE,MAAM;CAGtD;AAED;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,YAAa,YAAW,UAAU,EAAE,eAAe;IAC3F,QAAQ,CAAC,SAAS,0CAA0C;IAC5D,QAAQ,CAAC,QAAQ,SAAS;gBAEd,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB;CAGxD;AAED;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,YAAa,YAAW,UAAU,EAAE,eAAe;IAC3F,QAAQ,CAAC,SAAS,0CAA0C;IAC5D,QAAQ,CAAC,QAAQ,SAAS;IAE1B,OAAO;IAIP,4EAA4E;IAC5E,MAAM,CAAC,MAAM,CACZ,YAAY,EAAE,MAAM,EACpB,sBAAsB,EAAE,MAAM,EAC9B,gBAAgB,CAAC,EAAE,yBAAyB,EAC5C,KAAK,GAAE,oBAAyB;IAYjC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,kBAAkB,CACxB,aAAa,EAAE,GAAG,EAClB,sBAAsB,EAAE,MAAM,EAC9B,gBAAgB,CAAC,EAAE,yBAAyB,GAC1C,eAAe;CA6BlB;AAED,eAAO,MAAM,gCAAgC,YAAa,yBAAyB;;;;;;;CAOjF,CAAC"} |
+5
-2
@@ -99,7 +99,10 @@ /*! | ||
| static wrapIfUnrecognized(originalError, dataProcessingCodepath, sequencedMessage) { | ||
| const props = Object.assign({ dataProcessingError: 1, dataProcessingCodepath }, (sequencedMessage === undefined ? undefined : extractSafePropertiesFromMessage(sequencedMessage))); | ||
| const props = Object.assign({ dataProcessingError: 1, dataProcessingCodepath }, (sequencedMessage === undefined | ||
| ? undefined | ||
| : extractSafePropertiesFromMessage(sequencedMessage))); | ||
| const normalizedError = normalizeError(originalError, { props }); | ||
| // Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
| // but if so they are still suitable to be wrapped as DataProcessingError. | ||
| if (isExternalError(normalizedError) || normalizedError.errorType === NORMALIZED_ERROR_TYPE) { | ||
| if (isExternalError(normalizedError) || | ||
| normalizedError.errorType === NORMALIZED_ERROR_TYPE) { | ||
| // Create a new DataProcessingError to wrap this external error | ||
@@ -106,0 +109,0 @@ const dataProcessingError = wrapError(normalizedError, (message) => new DataProcessingError(message)); |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,kBAAkB,GAKrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACH,YAAY,EAEZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EACf,qBAAqB,GACxB,MAAM,iCAAiC,CAAC;AAIzC;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAG1C;;;;;OAKG;IACH,YACI,OAAe,EACN,KAAW,EACpB,KAA4B;QAE5B,mCAAmC;QACnC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAJjC,UAAK,GAAL,KAAK,CAAM;QAVf,cAAS,GAAG,kBAAkB,CAAC,YAAY,CAAC;IAerD,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAG/C,YACI,OAAe,EACN,iBAAyB,EAClC,KAA4B;QAE5B,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAHb,sBAAiB,GAAjB,iBAAiB,CAAQ;QAJ7B,cAAS,GAAG,kBAAkB,CAAC,eAAe,CAAC;IAQxD,CAAC;IAED;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E,OAAO,CAAC,uBAAuB;IAC/D,4BAA4B,EAAE,OAAO,CAAC,qBAAqB;IAC3D,gBAAgB,EAAE,OAAO,CAAC,SAAS;CACtC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n ContainerErrorType,\n IGenericError,\n IErrorBase,\n IThrottlingWarning,\n IUsageError,\n} from \"@fluidframework/container-definitions\";\nimport {\n LoggingError,\n IFluidErrorBase,\n normalizeError,\n wrapError,\n wrapErrorAndLog,\n isExternalError,\n NORMALIZED_ERROR_TYPE,\n} from \"@fluidframework/telemetry-utils\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n readonly errorType = ContainerErrorType.genericError;\n\n /**\n * Create a new GenericError\n * @param message - Error message\n * @param error - inner error object\n * @param props - Telemetry props to include when the error is logged\n */\n constructor(\n message: string,\n readonly error?: any,\n props?: ITelemetryProperties,\n ) {\n // Don't try to log the inner error\n super(message, props, new Set([\"error\"]));\n }\n}\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n readonly errorType = ContainerErrorType.throttlingError;\n\n private constructor(\n message: string,\n readonly retryAfterSeconds: number,\n props?: ITelemetryProperties,\n ) {\n super(message, props);\n }\n\n /**\n * Wrap the given error as a ThrottlingWarning\n * Only preserves the error message, and applies the given retry after to the new warning object\n */\n static wrap(\n error: unknown,\n retryAfterSeconds: number,\n logger: ITelemetryLogger,\n ): IThrottlingWarning {\n const newErrorFn =\n (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n return wrapErrorAndLog(error, newErrorFn, logger);\n }\n}\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n readonly errorType = ContainerErrorType.usageError;\n\n constructor(\n message: string,\n ) {\n super(message, { usageError: true });\n }\n}\n\n/** Error indicating that a client's session has reached its time limit and is closed. */\nexport class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {\n readonly errorType = ContainerErrorType.clientSessionExpiredError;\n\n constructor(\n message: string,\n readonly expiryMs: number,\n ) {\n super(message, { timeoutMs: expiryMs });\n }\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n readonly errorType = ContainerErrorType.dataCorruptionError;\n readonly canRetry = false;\n\n constructor(\n message: string,\n props: ITelemetryProperties,\n ) {\n super(message, { ...props, dataProcessingError: 1 });\n }\n}\n\n/**\n * DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service.\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from DataCorruptionError in that this may be a transient error that will not repro in another\n * client or session.\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n readonly errorType = ContainerErrorType.dataProcessingError;\n readonly canRetry = false;\n\n private constructor(errorMessage: string) {\n super(errorMessage);\n }\n\n /** Create a new DataProcessingError detected and raised with the FF code */\n static create(\n errorMessage: string,\n dataProcessingCodepath: string,\n sequencedMessage?: ISequencedDocumentMessage,\n props: ITelemetryProperties = {},\n ) {\n const dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n errorMessage,\n dataProcessingCodepath,\n sequencedMessage);\n dataProcessingError.addTelemetryProperties(props);\n\n return dataProcessingError;\n }\n\n /**\n * Wrap the given error in a DataProcessingError, unless the error is already of a known type\n * with the exception of a normalized LoggingError, which will still be wrapped.\n * In either case, the error will have some relevant properties added for telemetry\n * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n * one day we will move away from throwing these errors but rather we'll return them.\n * But an unrecognized error needs to be classified as DataProcessingError.\n * @param originalError - error to be converted\n * @param dataProcessingCodepath - which codepath failed while processing data\n * @param sequencedMessage - Sequenced message to include info about via telemetry props\n * @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error\n */\n static wrapIfUnrecognized(\n originalError: any,\n dataProcessingCodepath: string,\n sequencedMessage?: ISequencedDocumentMessage,\n ): IFluidErrorBase {\n const props = {\n dataProcessingError: 1,\n dataProcessingCodepath,\n ...(sequencedMessage === undefined ? undefined : extractSafePropertiesFromMessage(sequencedMessage)),\n };\n\n const normalizedError = normalizeError(originalError, { props });\n // Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n // but if so they are still suitable to be wrapped as DataProcessingError.\n if (isExternalError(normalizedError) || normalizedError.errorType === NORMALIZED_ERROR_TYPE) {\n // Create a new DataProcessingError to wrap this external error\n const dataProcessingError =\n wrapError(normalizedError, (message: string) => new DataProcessingError(message));\n\n // Copy over the props above and any others added to this error since first being normalized\n dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n return dataProcessingError;\n }\n return normalizedError;\n }\n}\n\nexport const extractSafePropertiesFromMessage = (message: ISequencedDocumentMessage) => ({\n messageClientId: message.clientId,\n messageSequenceNumber: message.sequenceNumber,\n messageClientSequenceNumber: message.clientSequenceNumber,\n messageReferenceSequenceNumber: message.referenceSequenceNumber,\n messageMinimumSequenceNumber: message.minimumSequenceNumber,\n messageTimestamp: message.timestamp,\n});\n"]} | ||
| {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,kBAAkB,GAKlB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,YAAY,EAEZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EACf,qBAAqB,GACrB,MAAM,iCAAiC,CAAC;AAIzC;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAG7C;;;;;OAKG;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BAAmB,GAAG,SAAS,CACpC,eAAe,EACf,CAAC,OAAe,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,OAAO,CAAC,CACrD,CAAC;YAEF,4FAA4F;YAC5F,mBAAmB,CAAC,sBAAsB,CAAC,eAAe,CAAC,sBAAsB,EAAE,CAAC,CAAC;YAErF,OAAO,mBAAmB,CAAC;SAC3B;QACD,OAAO,eAAe,CAAC;IACxB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,OAAkC,EAAE,EAAE,CAAC,CAAC;IACxF,eAAe,EAAE,OAAO,CAAC,QAAQ;IACjC,qBAAqB,EAAE,OAAO,CAAC,cAAc;IAC7C,2BAA2B,EAAE,OAAO,CAAC,oBAAoB;IACzD,8BAA8B,EAAE,OAAO,CAAC,uBAAuB;IAC/D,4BAA4B,EAAE,OAAO,CAAC,qBAAqB;IAC3D,gBAAgB,EAAE,OAAO,CAAC,SAAS;CACnC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tContainerErrorType,\n\tIGenericError,\n\tIErrorBase,\n\tIThrottlingWarning,\n\tIUsageError,\n} from \"@fluidframework/container-definitions\";\nimport {\n\tLoggingError,\n\tIFluidErrorBase,\n\tnormalizeError,\n\twrapError,\n\twrapErrorAndLog,\n\tisExternalError,\n\tNORMALIZED_ERROR_TYPE,\n} from \"@fluidframework/telemetry-utils\";\nimport { ITelemetryLogger, ITelemetryProperties } from \"@fluidframework/common-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n */\nexport class GenericError extends LoggingError implements IGenericError, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.genericError;\n\n\t/**\n\t * Create a new GenericError\n\t * @param message - Error message\n\t * @param error - inner error object\n\t * @param props - Telemetry props to include when the error is logged\n\t */\n\tconstructor(message: string, readonly error?: any, props?: ITelemetryProperties) {\n\t\t// Don't try to log the inner error\n\t\tsuper(message, props, new Set([\"error\"]));\n\t}\n}\n\n/**\n * Warning emitted when requests to storage are being throttled.\n */\nexport class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.throttlingError;\n\n\tprivate constructor(\n\t\tmessage: string,\n\t\treadonly retryAfterSeconds: number,\n\t\tprops?: ITelemetryProperties,\n\t) {\n\t\tsuper(message, props);\n\t}\n\n\t/**\n\t * Wrap the given error as a ThrottlingWarning\n\t * Only preserves the error message, and applies the given retry after to the new warning object\n\t */\n\tstatic wrap(\n\t\terror: unknown,\n\t\tretryAfterSeconds: number,\n\t\tlogger: ITelemetryLogger,\n\t): IThrottlingWarning {\n\t\tconst newErrorFn = (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds);\n\t\treturn wrapErrorAndLog(error, newErrorFn, logger);\n\t}\n}\n\n/** Error indicating an API is being used improperly resulting in an invalid operation. */\nexport class UsageError extends LoggingError implements IUsageError, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.usageError;\n\n\tconstructor(message: string) {\n\t\tsuper(message, { usageError: true });\n\t}\n}\n\n/** Error indicating that a client's session has reached its time limit and is closed. */\nexport class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.clientSessionExpiredError;\n\n\tconstructor(message: string, readonly expiryMs: number) {\n\t\tsuper(message, { timeoutMs: expiryMs });\n\t}\n}\n\n/**\n * DataCorruptionError indicates that we encountered definitive evidence that the data at rest\n * backing this container is corrupted, and this container would never be expected to load properly again\n */\nexport class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.dataCorruptionError;\n\treadonly canRetry = false;\n\n\tconstructor(message: string, props: ITelemetryProperties) {\n\t\tsuper(message, { ...props, dataProcessingError: 1 });\n\t}\n}\n\n/**\n * DataProcessingError indicates we hit a fatal error while processing incoming data from the Fluid Service.\n * The error will often originate in the dataStore or DDS implementation that is responding to incoming changes.\n * This differs from DataCorruptionError in that this may be a transient error that will not repro in another\n * client or session.\n */\nexport class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase {\n\treadonly errorType = ContainerErrorType.dataProcessingError;\n\treadonly canRetry = false;\n\n\tprivate constructor(errorMessage: string) {\n\t\tsuper(errorMessage);\n\t}\n\n\t/** Create a new DataProcessingError detected and raised with the FF code */\n\tstatic create(\n\t\terrorMessage: string,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t\tprops: ITelemetryProperties = {},\n\t) {\n\t\tconst dataProcessingError = DataProcessingError.wrapIfUnrecognized(\n\t\t\terrorMessage,\n\t\t\tdataProcessingCodepath,\n\t\t\tsequencedMessage,\n\t\t);\n\t\tdataProcessingError.addTelemetryProperties(props);\n\n\t\treturn dataProcessingError;\n\t}\n\n\t/**\n\t * Wrap the given error in a DataProcessingError, unless the error is already of a known type\n\t * with the exception of a normalized LoggingError, which will still be wrapped.\n\t * In either case, the error will have some relevant properties added for telemetry\n\t * We wrap conditionally since known error types represent well-understood failure modes, and ideally\n\t * one day we will move away from throwing these errors but rather we'll return them.\n\t * But an unrecognized error needs to be classified as DataProcessingError.\n\t * @param originalError - error to be converted\n\t * @param dataProcessingCodepath - which codepath failed while processing data\n\t * @param sequencedMessage - Sequenced message to include info about via telemetry props\n\t * @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error\n\t */\n\tstatic wrapIfUnrecognized(\n\t\toriginalError: any,\n\t\tdataProcessingCodepath: string,\n\t\tsequencedMessage?: ISequencedDocumentMessage,\n\t): IFluidErrorBase {\n\t\tconst props = {\n\t\t\tdataProcessingError: 1,\n\t\t\tdataProcessingCodepath,\n\t\t\t...(sequencedMessage === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extractSafePropertiesFromMessage(sequencedMessage)),\n\t\t};\n\n\t\tconst normalizedError = normalizeError(originalError, { props });\n\t\t// Note that other errors may have the NORMALIZED_ERROR_TYPE errorType,\n\t\t// but if so they are still suitable to be wrapped as DataProcessingError.\n\t\tif (\n\t\t\tisExternalError(normalizedError) ||\n\t\t\tnormalizedError.errorType === NORMALIZED_ERROR_TYPE\n\t\t) {\n\t\t\t// Create a new DataProcessingError to wrap this external error\n\t\t\tconst dataProcessingError = wrapError(\n\t\t\t\tnormalizedError,\n\t\t\t\t(message: string) => new DataProcessingError(message),\n\t\t\t);\n\n\t\t\t// Copy over the props above and any others added to this error since first being normalized\n\t\t\tdataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties());\n\n\t\t\treturn dataProcessingError;\n\t\t}\n\t\treturn normalizedError;\n\t}\n}\n\nexport const extractSafePropertiesFromMessage = (message: ISequencedDocumentMessage) => ({\n\tmessageClientId: message.clientId,\n\tmessageSequenceNumber: message.sequenceNumber,\n\tmessageClientSequenceNumber: message.clientSequenceNumber,\n\tmessageReferenceSequenceNumber: message.referenceSequenceNumber,\n\tmessageMinimumSequenceNumber: message.minimumSequenceNumber,\n\tmessageTimestamp: message.timestamp,\n});\n"]} |
@@ -8,3 +8,3 @@ /*! | ||
| export declare const pkgName = "@fluidframework/container-utils"; | ||
| export declare const pkgVersion = "2.0.0-dev.2.3.0.115467"; | ||
| export declare const pkgVersion = "2.0.0-dev.3.1.0.125672"; | ||
| //# sourceMappingURL=packageVersion.d.ts.map |
@@ -8,3 +8,3 @@ /*! | ||
| export const pkgName = "@fluidframework/container-utils"; | ||
| export const pkgVersion = "2.0.0-dev.2.3.0.115467"; | ||
| export const pkgVersion = "2.0.0-dev.3.1.0.125672"; | ||
| //# sourceMappingURL=packageVersion.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,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/container-utils\";\nexport const pkgVersion = \"2.0.0-dev.2.3.0.115467\";\n"]} | ||
| {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,iCAAiC,CAAC;AACzD,MAAM,CAAC,MAAM,UAAU,GAAG,wBAAwB,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/container-utils\";\nexport const pkgVersion = \"2.0.0-dev.3.1.0.125672\";\n"]} |
+16
-15
| { | ||
| "name": "@fluidframework/container-utils", | ||
| "version": "2.0.0-dev.2.3.0.115467", | ||
| "version": "2.0.0-dev.3.1.0.125672", | ||
| "description": "Fluid container utils", | ||
@@ -32,4 +32,4 @@ "homepage": "https://fluidframework.com", | ||
| "format": "npm run prettier:fix", | ||
| "lint": "npm run eslint", | ||
| "lint:fix": "npm run eslint:fix", | ||
| "lint": "npm run prettier && npm run eslint", | ||
| "lint:fix": "npm run prettier:fix && npm run eslint:fix", | ||
| "prettier": "prettier --check . --ignore-path ../../../.prettierignore", | ||
@@ -69,18 +69,18 @@ "prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore", | ||
| "@fluidframework/common-utils": "^1.0.0", | ||
| "@fluidframework/container-definitions": ">=2.0.0-dev.2.3.0.115467 <2.0.0-dev.3.0.0", | ||
| "@fluidframework/container-definitions": ">=2.0.0-dev.3.1.0.125672 <2.0.0-dev.4.0.0", | ||
| "@fluidframework/protocol-definitions": "^1.1.0", | ||
| "@fluidframework/telemetry-utils": ">=2.0.0-dev.2.3.0.115467 <2.0.0-dev.3.0.0" | ||
| "@fluidframework/telemetry-utils": ">=2.0.0-dev.3.1.0.125672 <2.0.0-dev.4.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@fluid-tools/build-cli": "^0.7.0", | ||
| "@fluid-tools/build-cli": "^0.8.0", | ||
| "@fluidframework/build-common": "^1.1.0", | ||
| "@fluidframework/build-tools": "^0.7.0", | ||
| "@fluidframework/container-utils-previous": "npm:@fluidframework/container-utils@2.0.0-internal.2.2.0", | ||
| "@fluidframework/eslint-config-fluid": "^1.2.0", | ||
| "@fluidframework/mocha-test-setup": ">=2.0.0-dev.2.3.0.115467 <2.0.0-dev.3.0.0", | ||
| "@fluidframework/test-runtime-utils": ">=2.0.0-dev.2.3.0.115467 <2.0.0-dev.3.0.0", | ||
| "@fluidframework/build-tools": "^0.8.0", | ||
| "@fluidframework/container-utils-previous": "npm:@fluidframework/container-utils@2.0.0-internal.3.0.0", | ||
| "@fluidframework/eslint-config-fluid": "^2.0.0", | ||
| "@fluidframework/mocha-test-setup": ">=2.0.0-dev.3.1.0.125672 <2.0.0-dev.4.0.0", | ||
| "@fluidframework/test-runtime-utils": ">=2.0.0-dev.3.1.0.125672 <2.0.0-dev.4.0.0", | ||
| "@microsoft/api-extractor": "^7.22.2", | ||
| "@rushstack/eslint-config": "^2.5.1", | ||
| "@types/mocha": "^9.1.1", | ||
| "@types/node": "^14.18.0", | ||
| "@types/node": "^14.18.36", | ||
| "concurrently": "^6.2.0", | ||
@@ -97,7 +97,8 @@ "copyfiles": "^2.4.1", | ||
| "typeValidation": { | ||
| "version": "2.0.0-internal.2.3.0", | ||
| "baselineRange": ">=2.0.0-internal.2.2.0 <2.0.0-internal.2.3.0", | ||
| "baselineVersion": "2.0.0-internal.2.2.0", | ||
| "version": "2.0.0-internal.3.1.0", | ||
| "previousVersionStyle": "~previousMinor", | ||
| "baselineRange": ">=2.0.0-internal.3.0.0 <2.0.0-internal.3.1.0", | ||
| "baselineVersion": "2.0.0-internal.3.0.0", | ||
| "broken": {} | ||
| } | ||
| } |
@@ -7,3 +7,3 @@ /*! | ||
| module.exports = { | ||
| ...require("@fluidframework/build-common/prettier.config.cjs"), | ||
| ...require("@fluidframework/build-common/prettier.config.cjs"), | ||
| }; |
+124
-129
@@ -7,16 +7,16 @@ /*! | ||
| import { | ||
| ContainerErrorType, | ||
| IGenericError, | ||
| IErrorBase, | ||
| IThrottlingWarning, | ||
| IUsageError, | ||
| ContainerErrorType, | ||
| IGenericError, | ||
| IErrorBase, | ||
| IThrottlingWarning, | ||
| IUsageError, | ||
| } from "@fluidframework/container-definitions"; | ||
| import { | ||
| LoggingError, | ||
| IFluidErrorBase, | ||
| normalizeError, | ||
| wrapError, | ||
| wrapErrorAndLog, | ||
| isExternalError, | ||
| NORMALIZED_ERROR_TYPE, | ||
| LoggingError, | ||
| IFluidErrorBase, | ||
| normalizeError, | ||
| wrapError, | ||
| wrapErrorAndLog, | ||
| isExternalError, | ||
| NORMALIZED_ERROR_TYPE, | ||
| } from "@fluidframework/telemetry-utils"; | ||
@@ -30,18 +30,14 @@ import { ITelemetryLogger, ITelemetryProperties } from "@fluidframework/common-definitions"; | ||
| export class GenericError extends LoggingError implements IGenericError, IFluidErrorBase { | ||
| readonly errorType = ContainerErrorType.genericError; | ||
| readonly errorType = ContainerErrorType.genericError; | ||
| /** | ||
| * Create a new GenericError | ||
| * @param message - Error message | ||
| * @param error - inner error object | ||
| * @param props - Telemetry props to include when the error is logged | ||
| */ | ||
| constructor( | ||
| message: string, | ||
| readonly error?: any, | ||
| props?: ITelemetryProperties, | ||
| ) { | ||
| // Don't try to log the inner error | ||
| super(message, props, new Set(["error"])); | ||
| } | ||
| /** | ||
| * Create a new GenericError | ||
| * @param message - Error message | ||
| * @param error - inner error object | ||
| * @param props - Telemetry props to include when the error is logged | ||
| */ | ||
| constructor(message: string, readonly error?: any, props?: ITelemetryProperties) { | ||
| // Don't try to log the inner error | ||
| super(message, props, new Set(["error"])); | ||
| } | ||
| } | ||
@@ -53,25 +49,24 @@ | ||
| export class ThrottlingWarning extends LoggingError implements IThrottlingWarning, IFluidErrorBase { | ||
| readonly errorType = ContainerErrorType.throttlingError; | ||
| readonly errorType = ContainerErrorType.throttlingError; | ||
| private constructor( | ||
| message: string, | ||
| readonly retryAfterSeconds: number, | ||
| props?: ITelemetryProperties, | ||
| ) { | ||
| super(message, props); | ||
| } | ||
| private constructor( | ||
| message: string, | ||
| readonly retryAfterSeconds: number, | ||
| props?: ITelemetryProperties, | ||
| ) { | ||
| super(message, props); | ||
| } | ||
| /** | ||
| * Wrap the given error as a ThrottlingWarning | ||
| * Only preserves the error message, and applies the given retry after to the new warning object | ||
| */ | ||
| static wrap( | ||
| error: unknown, | ||
| retryAfterSeconds: number, | ||
| logger: ITelemetryLogger, | ||
| ): IThrottlingWarning { | ||
| const newErrorFn = | ||
| (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds); | ||
| return wrapErrorAndLog(error, newErrorFn, logger); | ||
| } | ||
| /** | ||
| * Wrap the given error as a ThrottlingWarning | ||
| * Only preserves the error message, and applies the given retry after to the new warning object | ||
| */ | ||
| static wrap( | ||
| error: unknown, | ||
| retryAfterSeconds: number, | ||
| logger: ITelemetryLogger, | ||
| ): IThrottlingWarning { | ||
| const newErrorFn = (errMsg: string) => new ThrottlingWarning(errMsg, retryAfterSeconds); | ||
| return wrapErrorAndLog(error, newErrorFn, logger); | ||
| } | ||
| } | ||
@@ -81,9 +76,7 @@ | ||
| export class UsageError extends LoggingError implements IUsageError, IFluidErrorBase { | ||
| readonly errorType = ContainerErrorType.usageError; | ||
| readonly errorType = ContainerErrorType.usageError; | ||
| constructor( | ||
| message: string, | ||
| ) { | ||
| super(message, { usageError: true }); | ||
| } | ||
| constructor(message: string) { | ||
| super(message, { usageError: true }); | ||
| } | ||
| } | ||
@@ -93,10 +86,7 @@ | ||
| export class ClientSessionExpiredError extends LoggingError implements IFluidErrorBase { | ||
| readonly errorType = ContainerErrorType.clientSessionExpiredError; | ||
| readonly errorType = ContainerErrorType.clientSessionExpiredError; | ||
| constructor( | ||
| message: string, | ||
| readonly expiryMs: number, | ||
| ) { | ||
| super(message, { timeoutMs: expiryMs }); | ||
| } | ||
| constructor(message: string, readonly expiryMs: number) { | ||
| super(message, { timeoutMs: expiryMs }); | ||
| } | ||
| } | ||
@@ -109,11 +99,8 @@ | ||
| export class DataCorruptionError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
| readonly errorType = ContainerErrorType.dataCorruptionError; | ||
| readonly canRetry = false; | ||
| readonly errorType = ContainerErrorType.dataCorruptionError; | ||
| readonly canRetry = false; | ||
| constructor( | ||
| message: string, | ||
| props: ITelemetryProperties, | ||
| ) { | ||
| super(message, { ...props, dataProcessingError: 1 }); | ||
| } | ||
| constructor(message: string, props: ITelemetryProperties) { | ||
| super(message, { ...props, dataProcessingError: 1 }); | ||
| } | ||
| } | ||
@@ -128,72 +115,80 @@ | ||
| export class DataProcessingError extends LoggingError implements IErrorBase, IFluidErrorBase { | ||
| readonly errorType = ContainerErrorType.dataProcessingError; | ||
| readonly canRetry = false; | ||
| readonly errorType = ContainerErrorType.dataProcessingError; | ||
| readonly canRetry = false; | ||
| private constructor(errorMessage: string) { | ||
| super(errorMessage); | ||
| } | ||
| private constructor(errorMessage: string) { | ||
| super(errorMessage); | ||
| } | ||
| /** Create a new DataProcessingError detected and raised with the FF code */ | ||
| static create( | ||
| errorMessage: string, | ||
| dataProcessingCodepath: string, | ||
| sequencedMessage?: ISequencedDocumentMessage, | ||
| props: ITelemetryProperties = {}, | ||
| ) { | ||
| const dataProcessingError = DataProcessingError.wrapIfUnrecognized( | ||
| errorMessage, | ||
| dataProcessingCodepath, | ||
| sequencedMessage); | ||
| dataProcessingError.addTelemetryProperties(props); | ||
| /** Create a new DataProcessingError detected and raised with the FF code */ | ||
| static create( | ||
| errorMessage: string, | ||
| dataProcessingCodepath: string, | ||
| sequencedMessage?: ISequencedDocumentMessage, | ||
| props: ITelemetryProperties = {}, | ||
| ) { | ||
| const dataProcessingError = DataProcessingError.wrapIfUnrecognized( | ||
| errorMessage, | ||
| dataProcessingCodepath, | ||
| sequencedMessage, | ||
| ); | ||
| dataProcessingError.addTelemetryProperties(props); | ||
| return dataProcessingError; | ||
| } | ||
| return dataProcessingError; | ||
| } | ||
| /** | ||
| * Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
| * with the exception of a normalized LoggingError, which will still be wrapped. | ||
| * In either case, the error will have some relevant properties added for telemetry | ||
| * We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
| * one day we will move away from throwing these errors but rather we'll return them. | ||
| * But an unrecognized error needs to be classified as DataProcessingError. | ||
| * @param originalError - error to be converted | ||
| * @param dataProcessingCodepath - which codepath failed while processing data | ||
| * @param sequencedMessage - Sequenced message to include info about via telemetry props | ||
| * @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
| */ | ||
| static wrapIfUnrecognized( | ||
| originalError: any, | ||
| dataProcessingCodepath: string, | ||
| sequencedMessage?: ISequencedDocumentMessage, | ||
| ): IFluidErrorBase { | ||
| const props = { | ||
| dataProcessingError: 1, | ||
| dataProcessingCodepath, | ||
| ...(sequencedMessage === undefined ? undefined : extractSafePropertiesFromMessage(sequencedMessage)), | ||
| }; | ||
| /** | ||
| * Wrap the given error in a DataProcessingError, unless the error is already of a known type | ||
| * with the exception of a normalized LoggingError, which will still be wrapped. | ||
| * In either case, the error will have some relevant properties added for telemetry | ||
| * We wrap conditionally since known error types represent well-understood failure modes, and ideally | ||
| * one day we will move away from throwing these errors but rather we'll return them. | ||
| * But an unrecognized error needs to be classified as DataProcessingError. | ||
| * @param originalError - error to be converted | ||
| * @param dataProcessingCodepath - which codepath failed while processing data | ||
| * @param sequencedMessage - Sequenced message to include info about via telemetry props | ||
| * @returns Either a new DataProcessingError, or (if wrapping is deemed unnecessary) the given error | ||
| */ | ||
| static wrapIfUnrecognized( | ||
| originalError: any, | ||
| dataProcessingCodepath: string, | ||
| sequencedMessage?: ISequencedDocumentMessage, | ||
| ): IFluidErrorBase { | ||
| const props = { | ||
| dataProcessingError: 1, | ||
| dataProcessingCodepath, | ||
| ...(sequencedMessage === undefined | ||
| ? undefined | ||
| : extractSafePropertiesFromMessage(sequencedMessage)), | ||
| }; | ||
| const normalizedError = normalizeError(originalError, { props }); | ||
| // Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
| // but if so they are still suitable to be wrapped as DataProcessingError. | ||
| if (isExternalError(normalizedError) || normalizedError.errorType === NORMALIZED_ERROR_TYPE) { | ||
| // Create a new DataProcessingError to wrap this external error | ||
| const dataProcessingError = | ||
| wrapError(normalizedError, (message: string) => new DataProcessingError(message)); | ||
| const normalizedError = normalizeError(originalError, { props }); | ||
| // Note that other errors may have the NORMALIZED_ERROR_TYPE errorType, | ||
| // but if so they are still suitable to be wrapped as DataProcessingError. | ||
| if ( | ||
| isExternalError(normalizedError) || | ||
| normalizedError.errorType === NORMALIZED_ERROR_TYPE | ||
| ) { | ||
| // Create a new DataProcessingError to wrap this external error | ||
| const dataProcessingError = wrapError( | ||
| normalizedError, | ||
| (message: string) => new DataProcessingError(message), | ||
| ); | ||
| // Copy over the props above and any others added to this error since first being normalized | ||
| dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties()); | ||
| // Copy over the props above and any others added to this error since first being normalized | ||
| dataProcessingError.addTelemetryProperties(normalizedError.getTelemetryProperties()); | ||
| return dataProcessingError; | ||
| } | ||
| return normalizedError; | ||
| } | ||
| return dataProcessingError; | ||
| } | ||
| return normalizedError; | ||
| } | ||
| } | ||
| export const extractSafePropertiesFromMessage = (message: ISequencedDocumentMessage) => ({ | ||
| messageClientId: message.clientId, | ||
| messageSequenceNumber: message.sequenceNumber, | ||
| messageClientSequenceNumber: message.clientSequenceNumber, | ||
| messageReferenceSequenceNumber: message.referenceSequenceNumber, | ||
| messageMinimumSequenceNumber: message.minimumSequenceNumber, | ||
| messageTimestamp: message.timestamp, | ||
| messageClientId: message.clientId, | ||
| messageSequenceNumber: message.sequenceNumber, | ||
| messageClientSequenceNumber: message.clientSequenceNumber, | ||
| messageReferenceSequenceNumber: message.referenceSequenceNumber, | ||
| messageMinimumSequenceNumber: message.minimumSequenceNumber, | ||
| messageTimestamp: message.timestamp, | ||
| }); |
@@ -9,2 +9,2 @@ /*! | ||
| export const pkgName = "@fluidframework/container-utils"; | ||
| export const pkgVersion = "2.0.0-dev.2.3.0.115467"; | ||
| export const pkgVersion = "2.0.0-dev.3.1.0.125672"; |
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "./lib", | ||
| "module": "esnext" | ||
| }, | ||
| } | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "./lib", | ||
| "module": "esnext", | ||
| }, | ||
| } |
+9
-13
| { | ||
| "extends": "@fluidframework/build-common/ts-common-config.json", | ||
| "exclude": [ | ||
| "src/test/**/*" | ||
| ], | ||
| "compilerOptions": { | ||
| "rootDir": "./src", | ||
| "outDir": "./dist", | ||
| "composite": true | ||
| }, | ||
| "include": [ | ||
| "src/**/*" | ||
| ] | ||
| } | ||
| "extends": "@fluidframework/build-common/ts-common-config.json", | ||
| "exclude": ["src/test/**/*"], | ||
| "compilerOptions": { | ||
| "rootDir": "./src", | ||
| "outDir": "./dist", | ||
| "composite": true, | ||
| }, | ||
| "include": ["src/**/*"], | ||
| } |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
67994
-1.97%737
-0.41%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated
Updated