@fluidframework/telemetry-utils 2.0.0-dev-rc.5.0.0.268409 → 2.0.0-dev-rc.5.0.0.270987

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.
Files changed (66) hide show
  1. package/api-report/telemetry-utils.alpha.api.md +1 -1
  2. package/api-report/telemetry-utils.beta.api.md +1 -1
  3. package/api-report/telemetry-utils.public.api.md +1 -1
  4. package/biome.jsonc +4 -0
  5. package/dist/config.js +3 -1
  6. package/dist/config.js.map +1 -1
  7. package/dist/error.d.ts +1 -1
  8. package/dist/error.d.ts.map +1 -1
  9. package/dist/error.js +10 -9
  10. package/dist/error.js.map +1 -1
  11. package/dist/errorLogging.d.ts +0 -4
  12. package/dist/errorLogging.d.ts.map +1 -1
  13. package/dist/errorLogging.js +8 -27
  14. package/dist/errorLogging.js.map +1 -1
  15. package/dist/eventEmitterWithErrorHandling.js +1 -0
  16. package/dist/eventEmitterWithErrorHandling.js.map +1 -1
  17. package/dist/fluidErrorBase.d.ts +0 -6
  18. package/dist/fluidErrorBase.d.ts.map +1 -1
  19. package/dist/fluidErrorBase.js +1 -12
  20. package/dist/fluidErrorBase.js.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/logger.js +19 -7
  26. package/dist/logger.js.map +1 -1
  27. package/dist/mockLogger.js +2 -1
  28. package/dist/mockLogger.js.map +1 -1
  29. package/dist/sampledTelemetryHelper.js +7 -2
  30. package/dist/sampledTelemetryHelper.js.map +1 -1
  31. package/dist/thresholdCounter.js +3 -0
  32. package/dist/thresholdCounter.js.map +1 -1
  33. package/lib/config.js +3 -1
  34. package/lib/config.js.map +1 -1
  35. package/lib/error.d.ts +1 -1
  36. package/lib/error.d.ts.map +1 -1
  37. package/lib/error.js +10 -9
  38. package/lib/error.js.map +1 -1
  39. package/lib/errorLogging.d.ts +0 -4
  40. package/lib/errorLogging.d.ts.map +1 -1
  41. package/lib/errorLogging.js +9 -28
  42. package/lib/errorLogging.js.map +1 -1
  43. package/lib/eventEmitterWithErrorHandling.js +1 -0
  44. package/lib/eventEmitterWithErrorHandling.js.map +1 -1
  45. package/lib/fluidErrorBase.d.ts +0 -6
  46. package/lib/fluidErrorBase.d.ts.map +1 -1
  47. package/lib/fluidErrorBase.js +0 -10
  48. package/lib/fluidErrorBase.js.map +1 -1
  49. package/lib/index.d.ts +1 -1
  50. package/lib/index.d.ts.map +1 -1
  51. package/lib/index.js +1 -1
  52. package/lib/index.js.map +1 -1
  53. package/lib/logger.js +19 -7
  54. package/lib/logger.js.map +1 -1
  55. package/lib/mockLogger.js +2 -1
  56. package/lib/mockLogger.js.map +1 -1
  57. package/lib/sampledTelemetryHelper.js +7 -2
  58. package/lib/sampledTelemetryHelper.js.map +1 -1
  59. package/lib/thresholdCounter.js +3 -0
  60. package/lib/thresholdCounter.js.map +1 -1
  61. package/package.json +18 -10
  62. package/src/error.ts +1 -1
  63. package/src/errorLogging.ts +2 -32
  64. package/src/fluidErrorBase.ts +0 -15
  65. package/src/index.ts +1 -6
  66. package/tsconfig.json +2 -0
@@ -7,12 +7,7 @@ import type { ITelemetryBaseProperties, Tagged } from "@fluidframework/core-inte
7
7
  import type { ILoggingError } from "@fluidframework/core-interfaces/internal";
8
8
  import { v4 as uuid } from "uuid";
9
9
 
10
- import {
11
- IFluidErrorBase,
12
- hasErrorInstanceId,
13
- isFluidError,
14
- isValidLegacyError,
15
- } from "./fluidErrorBase.js";
10
+ import { IFluidErrorBase, hasErrorInstanceId, isFluidError } from "./fluidErrorBase.js";
16
11
  import { convertToBasePropertyType } from "./logger.js";
17
12
  import type {
18
13
  ITelemetryLoggerExt,
@@ -111,19 +106,6 @@ export interface IFluidErrorAnnotations {
111
106
  props?: ITelemetryBaseProperties;
112
107
  }
113
108
 
114
- /**
115
- * For backwards compatibility with pre-errorInstanceId valid errors
116
- */
117
- function patchLegacyError(
118
- legacyError: Omit<IFluidErrorBase, "errorInstanceId">,
119
- ): asserts legacyError is IFluidErrorBase {
120
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
121
- const patchMe: { -readonly [P in "errorInstanceId"]?: IFluidErrorBase[P] } = legacyError as any;
122
- if (patchMe.errorInstanceId === undefined) {
123
- patchMe.errorInstanceId = uuid();
124
- }
125
- }
126
-
127
109
  /**
128
110
  * Normalize the given error yielding a valid Fluid Error
129
111
  * @returns A valid Fluid Error with any provided annotations applied
@@ -136,11 +118,6 @@ export function normalizeError(
136
118
  error: unknown,
137
119
  annotations: IFluidErrorAnnotations = {},
138
120
  ): IFluidErrorBase {
139
- // Back-compat, while IFluidErrorBase is rolled out
140
- if (isValidLegacyError(error)) {
141
- patchLegacyError(error);
142
- }
143
-
144
121
  if (isFluidError(error)) {
145
122
  // We can simply add the telemetry props to the error and return it
146
123
  error.addTelemetryProperties(annotations.props ?? {});
@@ -339,7 +316,7 @@ export function isExternalError(error: unknown): boolean {
339
316
  }
340
317
  return false;
341
318
  }
342
- return !isValidLegacyError(error);
319
+ return true;
343
320
  }
344
321
 
345
322
  /**
@@ -400,13 +377,6 @@ export class LoggingError
400
377
  this._errorInstanceId = id;
401
378
  }
402
379
 
403
- /**
404
- * Backwards compatibility to appease {@link isFluidError} in old code that may handle this error.
405
- */
406
- // @ts-expect-error - This field shouldn't be referenced in the current version, but needs to exist at runtime.
407
- // eslint-disable-next-line @typescript-eslint/prefer-as-const
408
- private readonly fluidErrorCode: "-" = "-";
409
-
410
380
  /**
411
381
  * Create a new LoggingError
412
382
  * @param message - Error message to use for Error base class
@@ -96,18 +96,3 @@ export function isFluidError(error: unknown): error is IFluidErrorBase {
96
96
  hasTelemetryPropFunctions(error)
97
97
  );
98
98
  }
99
-
100
- /**
101
- * Type guard for old standard of valid/known errors.
102
- *
103
- * @internal
104
- */
105
- export function isValidLegacyError(
106
- error: unknown,
107
- ): error is Omit<IFluidErrorBase, "errorInstanceId"> {
108
- return (
109
- typeof (error as Partial<IFluidErrorBase>)?.errorType === "string" &&
110
- typeof (error as Partial<IFluidErrorBase>)?.message === "string" &&
111
- hasTelemetryPropFunctions(error)
112
- );
113
- }
package/src/index.ts CHANGED
@@ -43,12 +43,7 @@ export {
43
43
  raiseConnectedEvent,
44
44
  safeRaiseEvent,
45
45
  } from "./events.js";
46
- export {
47
- hasErrorInstanceId,
48
- IFluidErrorBase,
49
- isFluidError,
50
- isValidLegacyError,
51
- } from "./fluidErrorBase.js";
46
+ export { hasErrorInstanceId, IFluidErrorBase, isFluidError } from "./fluidErrorBase.js";
52
47
  export {
53
48
  eventNamespaceSeparator,
54
49
  createChildLogger,
package/tsconfig.json CHANGED
@@ -4,6 +4,8 @@
4
4
  "compilerOptions": {
5
5
  "rootDir": "./src",
6
6
  "outDir": "./lib",
7
+ "exactOptionalPropertyTypes": false,
8
+ "noUncheckedIndexedAccess": false,
7
9
  },
8
10
  "include": ["src/**/*"],
9
11
  }