@uapkg/diagnostics 1.2.0 → 1.3.1

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 (81) hide show
  1. package/dist/base/Diagnostic.d.ts +22 -19
  2. package/dist/base/Diagnostic.d.ts.map +1 -1
  3. package/dist/base/Diagnostic.js +23 -24
  4. package/dist/base/Diagnostic.js.map +1 -1
  5. package/dist/base/DiagnosticBag.d.ts +32 -29
  6. package/dist/base/DiagnosticBag.d.ts.map +1 -1
  7. package/dist/base/DiagnosticBag.js +75 -76
  8. package/dist/base/DiagnosticBag.js.map +1 -1
  9. package/dist/base/DiagnosticFingerprint.d.ts +10 -8
  10. package/dist/base/DiagnosticFingerprint.d.ts.map +1 -1
  11. package/dist/base/DiagnosticFingerprint.js +18 -19
  12. package/dist/base/DiagnosticFingerprint.js.map +1 -1
  13. package/dist/base/DiagnosticLevel.d.ts +4 -1
  14. package/dist/base/DiagnosticLevel.d.ts.map +1 -1
  15. package/dist/base/DiagnosticLevel.js +1 -2
  16. package/dist/base/Result.d.ts +15 -12
  17. package/dist/base/Result.d.ts.map +1 -1
  18. package/dist/base/Result.js +28 -16
  19. package/dist/base/Result.js.map +1 -1
  20. package/dist/config/ConfigDiagnostics.d.ts +36 -33
  21. package/dist/config/ConfigDiagnostics.d.ts.map +1 -1
  22. package/dist/config/ConfigDiagnostics.js +51 -41
  23. package/dist/config/ConfigDiagnostics.js.map +1 -1
  24. package/dist/controlPlane/ControlPlaneDiagnostics.d.ts +22 -19
  25. package/dist/controlPlane/ControlPlaneDiagnostics.d.ts.map +1 -1
  26. package/dist/controlPlane/ControlPlaneDiagnostics.js +11 -7
  27. package/dist/controlPlane/ControlPlaneDiagnostics.js.map +1 -1
  28. package/dist/general/GeneralDiagnostics.d.ts +16 -13
  29. package/dist/general/GeneralDiagnostics.d.ts.map +1 -1
  30. package/dist/general/GeneralDiagnostics.js +34 -27
  31. package/dist/general/GeneralDiagnostics.js.map +1 -1
  32. package/dist/index.d.ts +20 -33
  33. package/dist/index.js +19 -20
  34. package/dist/installer/InstallerDiagnostics.d.ts +41 -38
  35. package/dist/installer/InstallerDiagnostics.d.ts.map +1 -1
  36. package/dist/installer/InstallerDiagnostics.js +86 -56
  37. package/dist/installer/InstallerDiagnostics.js.map +1 -1
  38. package/dist/manifest/ManifestDiagnostics.d.ts +50 -47
  39. package/dist/manifest/ManifestDiagnostics.d.ts.map +1 -1
  40. package/dist/manifest/ManifestDiagnostics.js +99 -80
  41. package/dist/manifest/ManifestDiagnostics.js.map +1 -1
  42. package/dist/pack/PackDiagnostics.d.ts +31 -28
  43. package/dist/pack/PackDiagnostics.d.ts.map +1 -1
  44. package/dist/pack/PackDiagnostics.js +70 -64
  45. package/dist/pack/PackDiagnostics.js.map +1 -1
  46. package/dist/postinstall/PostinstallDiagnostics.d.ts +35 -32
  47. package/dist/postinstall/PostinstallDiagnostics.d.ts.map +1 -1
  48. package/dist/postinstall/PostinstallDiagnostics.js +75 -52
  49. package/dist/postinstall/PostinstallDiagnostics.js.map +1 -1
  50. package/dist/publishing/PublishingDiagnostics.d.ts +78 -0
  51. package/dist/publishing/PublishingDiagnostics.d.ts.map +1 -0
  52. package/dist/publishing/PublishingDiagnostics.js +14 -0
  53. package/dist/publishing/PublishingDiagnostics.js.map +1 -0
  54. package/dist/registry/RegistryDiagnostics.d.ts +51 -48
  55. package/dist/registry/RegistryDiagnostics.d.ts.map +1 -1
  56. package/dist/registry/RegistryDiagnostics.js +106 -82
  57. package/dist/registry/RegistryDiagnostics.js.map +1 -1
  58. package/dist/registryTools/RegistryToolsDiagnostics.d.ts +97 -94
  59. package/dist/registryTools/RegistryToolsDiagnostics.d.ts.map +1 -1
  60. package/dist/registryTools/RegistryToolsDiagnostics.js +91 -40
  61. package/dist/registryTools/RegistryToolsDiagnostics.js.map +1 -1
  62. package/dist/resolver/ResolverDiagnostics.d.ts +27 -24
  63. package/dist/resolver/ResolverDiagnostics.d.ts.map +1 -1
  64. package/dist/resolver/ResolverDiagnostics.js +59 -43
  65. package/dist/resolver/ResolverDiagnostics.js.map +1 -1
  66. package/dist/safety/SafetyDiagnostics.d.ts +19 -16
  67. package/dist/safety/SafetyDiagnostics.d.ts.map +1 -1
  68. package/dist/safety/SafetyDiagnostics.js +38 -26
  69. package/dist/safety/SafetyDiagnostics.js.map +1 -1
  70. package/dist/spec/SpecDiagnostics.d.ts +17 -14
  71. package/dist/spec/SpecDiagnostics.d.ts.map +1 -1
  72. package/dist/spec/SpecDiagnostics.js +37 -27
  73. package/dist/spec/SpecDiagnostics.js.map +1 -1
  74. package/dist/types.d.ts +20 -16
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/types.js +1 -2
  77. package/package.json +14 -16
  78. package/dist/base/DiagnosticLevel.js.map +0 -1
  79. package/dist/index.d.ts.map +0 -1
  80. package/dist/index.js.map +0 -1
  81. package/dist/types.js.map +0 -1
@@ -1,5 +1,6 @@
1
- import type { DiagnosticLevel } from './DiagnosticLevel.js';
2
- export type DiagnosticEmitPolicy = 'always' | 'once';
1
+ import { DiagnosticLevel } from "./DiagnosticLevel.js";
2
+ //#region src/base/Diagnostic.d.ts
3
+ type DiagnosticEmitPolicy = 'always' | 'once';
3
4
  /**
4
5
  * Base shape for all diagnostics. Every concrete diagnostic must extend this
5
6
  * interface, discriminating on `code` so that `data` is always strongly typed.
@@ -7,24 +8,26 @@ export type DiagnosticEmitPolicy = 'always' | 'once';
7
8
  * @typeParam C - The string literal diagnostic code.
8
9
  * @typeParam D - The shape of the typed data payload (defaults to `undefined`).
9
10
  */
10
- export interface DiagnosticBase<C extends string = string, D = undefined> {
11
- /** Severity of this diagnostic. */
12
- readonly level: DiagnosticLevel;
13
- /** Stable, machine-readable code used for discrimination. */
14
- readonly code: C;
15
- /** Human-readable summary. */
16
- readonly message: string;
17
- /** Actionable hint shown to the user. */
18
- readonly hint?: string;
19
- /** Emit strategy for user-facing reporting. */
20
- readonly emitPolicy?: DiagnosticEmitPolicy;
21
- /** Stable dedupe key used when `emitPolicy` is `once`. */
22
- readonly emitFingerprint?: string;
23
- /** Strongly typed payload whose shape is determined by `code`. */
24
- readonly data: D;
11
+ interface DiagnosticBase<C extends string = string, D = undefined> {
12
+ /** Severity of this diagnostic. */
13
+ readonly level: DiagnosticLevel;
14
+ /** Stable, machine-readable code used for discrimination. */
15
+ readonly code: C;
16
+ /** Human-readable summary. */
17
+ readonly message: string;
18
+ /** Actionable hint shown to the user. */
19
+ readonly hint?: string;
20
+ /** Emit strategy for user-facing reporting. */
21
+ readonly emitPolicy?: DiagnosticEmitPolicy;
22
+ /** Stable dedupe key used when `emitPolicy` is `once`. */
23
+ readonly emitFingerprint?: string;
24
+ /** Strongly typed payload whose shape is determined by `code`. */
25
+ readonly data: D;
25
26
  }
26
27
  /** Create an error-level diagnostic. */
27
- export declare function createDiagnostic<C extends string, D = undefined>(code: C, level: DiagnosticLevel, message: string, data: D, hint?: string, options?: {
28
- readonly emitPolicy?: DiagnosticEmitPolicy;
28
+ declare function createDiagnostic<C extends string, D = undefined>(code: C, level: DiagnosticLevel, message: string, data: D, hint?: string, options?: {
29
+ readonly emitPolicy?: DiagnosticEmitPolicy;
29
30
  }): DiagnosticBase<C, D>;
31
+ //#endregion
32
+ export { DiagnosticBase, DiagnosticEmitPolicy, createDiagnostic };
30
33
  //# sourceMappingURL=Diagnostic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostic.d.ts","sourceRoot":"","sources":["../../src/base/Diagnostic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,SAAS;IACtE,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAEhC,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAEjB,8BAA8B;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB,+CAA+C;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAE3C,0DAA0D;IAC1D,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;CAClB;AAMD,wCAAwC;AACxC,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,SAAS,EAC9D,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,CAAC,EACP,IAAI,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;CAC5C,GACA,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAsBtB"}
1
+ {"version":3,"file":"Diagnostic.d.ts","names":[],"sources":["../../src/base/Diagnostic.ts"],"mappings":";;KAGY;;;;;;;;UASK,eAAe,2BAA2B;;WAEhD,OAAO;;WAGP,MAAM;;WAGN;;WAGA;;WAGA,aAAa;;WAGb;;WAGA,MAAM;;;iBAQD,iBAAiB,kBAAkB,eACjD,MAAM,GACN,OAAO,iBACP,iBACA,MAAM,GACN,eACA;WACW,aAAa;IAEvB,eAAe,GAAG"}
@@ -1,27 +1,26 @@
1
- import { createDiagnosticFingerprint } from './DiagnosticFingerprint.js';
2
- // ---------------------------------------------------------------------------
3
- // Convenience helpers to construct a diagnostic without specifying every field
4
- // ---------------------------------------------------------------------------
1
+ import { createDiagnosticFingerprint } from "./DiagnosticFingerprint.js";
2
+
3
+ //#region src/base/Diagnostic.ts
5
4
  /** Create an error-level diagnostic. */
6
- export function createDiagnostic(code, level, message, data, hint, options) {
7
- const emitPolicy = options?.emitPolicy;
8
- const emitFingerprint = emitPolicy === 'once'
9
- ? createDiagnosticFingerprint({
10
- level,
11
- code,
12
- message,
13
- hint,
14
- data,
15
- })
16
- : undefined;
17
- return {
18
- level,
19
- code,
20
- message,
21
- data,
22
- hint,
23
- emitPolicy,
24
- emitFingerprint,
25
- };
5
+ function createDiagnostic(code, level, message, data, hint, options) {
6
+ const emitPolicy = options?.emitPolicy;
7
+ return {
8
+ level,
9
+ code,
10
+ message,
11
+ data,
12
+ hint,
13
+ emitPolicy,
14
+ emitFingerprint: emitPolicy === "once" ? createDiagnosticFingerprint({
15
+ level,
16
+ code,
17
+ message,
18
+ hint,
19
+ data
20
+ }) : void 0
21
+ };
26
22
  }
23
+
24
+ //#endregion
25
+ export { createDiagnostic };
27
26
  //# sourceMappingURL=Diagnostic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Diagnostic.js","sourceRoot":"","sources":["../../src/base/Diagnostic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAmCzE,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAE9E,wCAAwC;AACxC,MAAM,UAAU,gBAAgB,CAC9B,IAAO,EACP,KAAsB,EACtB,OAAe,EACf,IAAO,EACP,IAAa,EACb,OAEC;IAED,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,CAAC;IACvC,MAAM,eAAe,GACnB,UAAU,KAAK,MAAM;QACnB,CAAC,CAAC,2BAA2B,CAAC;YAC1B,KAAK;YACL,IAAI;YACJ,OAAO;YACP,IAAI;YACJ,IAAI;SACL,CAAC;QACJ,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACL,KAAK;QACL,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,IAAI;QACJ,UAAU;QACV,eAAe;KAChB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"Diagnostic.js","names":[],"sources":["../../src/base/Diagnostic.ts"],"sourcesContent":["import { createDiagnosticFingerprint } from './DiagnosticFingerprint.js';\nimport type { DiagnosticLevel } from './DiagnosticLevel.js';\n\nexport type DiagnosticEmitPolicy = 'always' | 'once';\n\n/**\n * Base shape for all diagnostics. Every concrete diagnostic must extend this\n * interface, discriminating on `code` so that `data` is always strongly typed.\n *\n * @typeParam C - The string literal diagnostic code.\n * @typeParam D - The shape of the typed data payload (defaults to `undefined`).\n */\nexport interface DiagnosticBase<C extends string = string, D = undefined> {\n /** Severity of this diagnostic. */\n readonly level: DiagnosticLevel;\n\n /** Stable, machine-readable code used for discrimination. */\n readonly code: C;\n\n /** Human-readable summary. */\n readonly message: string;\n\n /** Actionable hint shown to the user. */\n readonly hint?: string;\n\n /** Emit strategy for user-facing reporting. */\n readonly emitPolicy?: DiagnosticEmitPolicy;\n\n /** Stable dedupe key used when `emitPolicy` is `once`. */\n readonly emitFingerprint?: string;\n\n /** Strongly typed payload whose shape is determined by `code`. */\n readonly data: D;\n}\n\n// ---------------------------------------------------------------------------\n// Convenience helpers to construct a diagnostic without specifying every field\n// ---------------------------------------------------------------------------\n\n/** Create an error-level diagnostic. */\nexport function createDiagnostic<C extends string, D = undefined>(\n code: C,\n level: DiagnosticLevel,\n message: string,\n data: D,\n hint?: string,\n options?: {\n readonly emitPolicy?: DiagnosticEmitPolicy;\n },\n): DiagnosticBase<C, D> {\n const emitPolicy = options?.emitPolicy;\n const emitFingerprint =\n emitPolicy === 'once'\n ? createDiagnosticFingerprint({\n level,\n code,\n message,\n hint,\n data,\n })\n : undefined;\n\n return {\n level,\n code,\n message,\n data,\n hint,\n emitPolicy,\n emitFingerprint,\n };\n}\n"],"mappings":";;;;AAwCA,SAAgB,iBACd,MACA,OACA,SACA,MACA,MACA,SAGsB;CACtB,MAAM,aAAa,SAAS;CAY5B,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA,iBAjBA,eAAe,SACX,4BAA4B;GAC1B;GACA;GACA;GACA;GACA;EACF,CAAC,IACD;CAUN;AACF"}
@@ -1,6 +1,7 @@
1
- import type { Diagnostic } from '../types.js';
2
- import type { DiagnosticLevel } from './DiagnosticLevel.js';
3
- import { type Result } from './Result.js';
1
+ import { DiagnosticLevel } from "./DiagnosticLevel.js";
2
+ import { Diagnostic } from "../types.js";
3
+ import { Result } from "./Result.js";
4
+ //#region src/base/DiagnosticBag.d.ts
4
5
  /**
5
6
  * Mutable accumulator for diagnostics produced during an operation.
6
7
  *
@@ -12,31 +13,33 @@ import { type Result } from './Result.js';
12
13
  * return bag.toResult(value);
13
14
  * ```
14
15
  */
15
- export declare class DiagnosticBag {
16
- private readonly items;
17
- /** Number of diagnostics collected so far. */
18
- get length(): number;
19
- /** Add a pre-built diagnostic. */
20
- add(diagnostic: Diagnostic): this;
21
- /** Shorthand: add an error-level diagnostic. */
22
- addError<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this;
23
- /** Shorthand: add a warning-level diagnostic. */
24
- addWarning<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this;
25
- /** Shorthand: add an info-level diagnostic. */
26
- addInfo<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this;
27
- /** Merge another bag's diagnostics into this one. */
28
- merge(other: DiagnosticBag): this;
29
- /** Merge a readonly diagnostic array into this bag. */
30
- mergeArray(diagnostics: readonly Diagnostic[]): this;
31
- /** True if at least one diagnostic has level `error`. */
32
- hasErrors(): boolean;
33
- /** True if at least one diagnostic has the given level. */
34
- hasLevel(level: DiagnosticLevel): boolean;
35
- /** Return all collected diagnostics as a readonly array. */
36
- all(): readonly Diagnostic[];
37
- /** Build a successful `Result<T>` carrying accumulated diagnostics. */
38
- toResult<T>(value: T): Result<T>;
39
- /** Build a failed `Result` from the accumulated diagnostics. */
40
- toFailure(): Result<never>;
16
+ declare class DiagnosticBag {
17
+ private readonly items;
18
+ /** Number of diagnostics collected so far. */
19
+ get length(): number;
20
+ /** Add a pre-built diagnostic. */
21
+ add(diagnostic: Diagnostic): this;
22
+ /** Shorthand: add an error-level diagnostic. */
23
+ addError<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this;
24
+ /** Shorthand: add a warning-level diagnostic. */
25
+ addWarning<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this;
26
+ /** Shorthand: add an info-level diagnostic. */
27
+ addInfo<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this;
28
+ /** Merge another bag's diagnostics into this one. */
29
+ merge(other: DiagnosticBag): this;
30
+ /** Merge a readonly diagnostic array into this bag. */
31
+ mergeArray(diagnostics: readonly Diagnostic[]): this;
32
+ /** True if at least one diagnostic has level `error`. */
33
+ hasErrors(): boolean;
34
+ /** True if at least one diagnostic has the given level. */
35
+ hasLevel(level: DiagnosticLevel): boolean;
36
+ /** Return all collected diagnostics as a readonly array. */
37
+ all(): readonly Diagnostic[];
38
+ /** Build a successful `Result<T>` carrying accumulated diagnostics. */
39
+ toResult<T>(value: T): Result<T>;
40
+ /** Build a failed `Result` from the accumulated diagnostics. */
41
+ toFailure(): Result<never>;
41
42
  }
43
+ //#endregion
44
+ export { DiagnosticBag };
42
45
  //# sourceMappingURL=DiagnosticBag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticBag.d.ts","sourceRoot":"","sources":["../../src/base/DiagnosticBag.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAY,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAE1C,8CAA8C;IAC9C,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,kCAAkC;IAClC,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAKjC,gDAAgD;IAChD,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAKjG,iDAAiD;IACjD,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAKnG,+CAA+C;IAC/C,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhG,qDAAqD;IACrD,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAOjC,uDAAuD;IACvD,UAAU,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI;IAOpD,yDAAyD;IACzD,SAAS,IAAI,OAAO;IAIpB,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO;IAIzC,4DAA4D;IAC5D,GAAG,IAAI,SAAS,UAAU,EAAE;IAI5B,uEAAuE;IACvE,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAOhC,gEAAgE;IAChE,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC;CAG3B"}
1
+ {"version":3,"file":"DiagnosticBag.d.ts","names":[],"sources":["../../src/base/DiagnosticBag.ts"],"mappings":";;;;;;;;;;;;;;;cAgBa;mBACM;;MAGb;;EAKJ,IAAI,YAAY;;EAMhB,SAAS,kBAAkB,eAAe,MAAM,GAAG,iBAAiB,MAAM,GAAG;;EAM7E,WAAW,kBAAkB,eAAe,MAAM,GAAG,iBAAiB,MAAM,GAAG;;EAM/E,QAAQ,kBAAkB,eAAe,MAAM,GAAG,iBAAiB,MAAM,GAAG;;EAM5E,MAAM,OAAO;;EAQb,WAAW,sBAAsB;;EAQjC;;EAKA,SAAS,OAAO;;EAKhB,gBAAgB;;EAKhB,SAAS,GAAG,OAAO,IAAI,OAAO;;EAQ9B,aAAa"}
@@ -1,78 +1,77 @@
1
- import { createDiagnostic } from './Diagnostic.js';
2
- import { fail, ok } from './Result.js';
1
+ import { createDiagnostic } from "./Diagnostic.js";
2
+ import { fail, ok } from "./Result.js";
3
+
4
+ //#region src/base/DiagnosticBag.ts
3
5
  /**
4
- * Mutable accumulator for diagnostics produced during an operation.
5
- *
6
- * Typical usage:
7
- * ```ts
8
- * const bag = new DiagnosticBag();
9
- * bag.addError('MY_CODE', 'Something broke', undefined, 'Try X');
10
- * if (bag.hasErrors()) return bag.toFailure();
11
- * return bag.toResult(value);
12
- * ```
13
- */
14
- export class DiagnosticBag {
15
- items = [];
16
- /** Number of diagnostics collected so far. */
17
- get length() {
18
- return this.items.length;
19
- }
20
- /** Add a pre-built diagnostic. */
21
- add(diagnostic) {
22
- this.items.push(diagnostic);
23
- return this;
24
- }
25
- /** Shorthand: add an error-level diagnostic. */
26
- addError(code, message, data, hint) {
27
- this.items.push(createDiagnostic(code, 'error', message, data, hint));
28
- return this;
29
- }
30
- /** Shorthand: add a warning-level diagnostic. */
31
- addWarning(code, message, data, hint) {
32
- this.items.push(createDiagnostic(code, 'warning', message, data, hint));
33
- return this;
34
- }
35
- /** Shorthand: add an info-level diagnostic. */
36
- addInfo(code, message, data, hint) {
37
- this.items.push(createDiagnostic(code, 'info', message, data, hint));
38
- return this;
39
- }
40
- /** Merge another bag's diagnostics into this one. */
41
- merge(other) {
42
- for (const d of other.items) {
43
- this.items.push(d);
44
- }
45
- return this;
46
- }
47
- /** Merge a readonly diagnostic array into this bag. */
48
- mergeArray(diagnostics) {
49
- for (const d of diagnostics) {
50
- this.items.push(d);
51
- }
52
- return this;
53
- }
54
- /** True if at least one diagnostic has level `error`. */
55
- hasErrors() {
56
- return this.items.some((d) => d.level === 'error');
57
- }
58
- /** True if at least one diagnostic has the given level. */
59
- hasLevel(level) {
60
- return this.items.some((d) => d.level === level);
61
- }
62
- /** Return all collected diagnostics as a readonly array. */
63
- all() {
64
- return this.items;
65
- }
66
- /** Build a successful `Result<T>` carrying accumulated diagnostics. */
67
- toResult(value) {
68
- if (this.hasErrors()) {
69
- return fail(this.items);
70
- }
71
- return ok(value, this.items);
72
- }
73
- /** Build a failed `Result` from the accumulated diagnostics. */
74
- toFailure() {
75
- return fail(this.items);
76
- }
77
- }
6
+ * Mutable accumulator for diagnostics produced during an operation.
7
+ *
8
+ * Typical usage:
9
+ * ```ts
10
+ * const bag = new DiagnosticBag();
11
+ * bag.addError('MY_CODE', 'Something broke', undefined, 'Try X');
12
+ * if (bag.hasErrors()) return bag.toFailure();
13
+ * return bag.toResult(value);
14
+ * ```
15
+ */
16
+ var DiagnosticBag = class {
17
+ items = [];
18
+ /** Number of diagnostics collected so far. */
19
+ get length() {
20
+ return this.items.length;
21
+ }
22
+ /** Add a pre-built diagnostic. */
23
+ add(diagnostic) {
24
+ this.items.push(diagnostic);
25
+ return this;
26
+ }
27
+ /** Shorthand: add an error-level diagnostic. */
28
+ addError(code, message, data, hint) {
29
+ this.items.push(createDiagnostic(code, "error", message, data, hint));
30
+ return this;
31
+ }
32
+ /** Shorthand: add a warning-level diagnostic. */
33
+ addWarning(code, message, data, hint) {
34
+ this.items.push(createDiagnostic(code, "warning", message, data, hint));
35
+ return this;
36
+ }
37
+ /** Shorthand: add an info-level diagnostic. */
38
+ addInfo(code, message, data, hint) {
39
+ this.items.push(createDiagnostic(code, "info", message, data, hint));
40
+ return this;
41
+ }
42
+ /** Merge another bag's diagnostics into this one. */
43
+ merge(other) {
44
+ for (const d of other.items) this.items.push(d);
45
+ return this;
46
+ }
47
+ /** Merge a readonly diagnostic array into this bag. */
48
+ mergeArray(diagnostics) {
49
+ for (const d of diagnostics) this.items.push(d);
50
+ return this;
51
+ }
52
+ /** True if at least one diagnostic has level `error`. */
53
+ hasErrors() {
54
+ return this.items.some((d) => d.level === "error");
55
+ }
56
+ /** True if at least one diagnostic has the given level. */
57
+ hasLevel(level) {
58
+ return this.items.some((d) => d.level === level);
59
+ }
60
+ /** Return all collected diagnostics as a readonly array. */
61
+ all() {
62
+ return this.items;
63
+ }
64
+ /** Build a successful `Result<T>` carrying accumulated diagnostics. */
65
+ toResult(value) {
66
+ if (this.hasErrors()) return fail(this.items);
67
+ return ok(value, this.items);
68
+ }
69
+ /** Build a failed `Result` from the accumulated diagnostics. */
70
+ toFailure() {
71
+ return fail(this.items);
72
+ }
73
+ };
74
+
75
+ //#endregion
76
+ export { DiagnosticBag };
78
77
  //# sourceMappingURL=DiagnosticBag.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticBag.js","sourceRoot":"","sources":["../../src/base/DiagnosticBag.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAE,IAAI,EAAE,EAAE,EAAe,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,aAAa;IACP,KAAK,GAAiB,EAAE,CAAC;IAE1C,8CAA8C;IAC9C,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,kCAAkC;IAClC,GAAG,CAAC,UAAsB;QACxB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gDAAgD;IAChD,QAAQ,CAAkC,IAAO,EAAE,OAAe,EAAE,IAAO,EAAE,IAAa;QACxF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAe,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iDAAiD;IACjD,UAAU,CAAkC,IAAO,EAAE,OAAe,EAAE,IAAO,EAAE,IAAa;QAC1F,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAe,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+CAA+C;IAC/C,OAAO,CAAkC,IAAO,EAAE,OAAe,EAAE,IAAO,EAAE,IAAa;QACvF,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAe,CAAC,CAAC;QACnF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qDAAqD;IACrD,KAAK,CAAC,KAAoB;QACxB,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uDAAuD;IACvD,UAAU,CAAC,WAAkC;QAC3C,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yDAAyD;IACzD,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,2DAA2D;IAC3D,QAAQ,CAAC,KAAsB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,4DAA4D;IAC5D,GAAG;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,uEAAuE;IACvE,QAAQ,CAAI,KAAQ;QAClB,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,gEAAgE;IAChE,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF"}
1
+ {"version":3,"file":"DiagnosticBag.js","names":[],"sources":["../../src/base/DiagnosticBag.ts"],"sourcesContent":["import type { Diagnostic } from '../types.js';\nimport { createDiagnostic } from './Diagnostic.js';\nimport type { DiagnosticLevel } from './DiagnosticLevel.js';\nimport { fail, ok, type Result } from './Result.js';\n\n/**\n * Mutable accumulator for diagnostics produced during an operation.\n *\n * Typical usage:\n * ```ts\n * const bag = new DiagnosticBag();\n * bag.addError('MY_CODE', 'Something broke', undefined, 'Try X');\n * if (bag.hasErrors()) return bag.toFailure();\n * return bag.toResult(value);\n * ```\n */\nexport class DiagnosticBag {\n private readonly items: Diagnostic[] = [];\n\n /** Number of diagnostics collected so far. */\n get length(): number {\n return this.items.length;\n }\n\n /** Add a pre-built diagnostic. */\n add(diagnostic: Diagnostic): this {\n this.items.push(diagnostic);\n return this;\n }\n\n /** Shorthand: add an error-level diagnostic. */\n addError<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'error', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Shorthand: add a warning-level diagnostic. */\n addWarning<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'warning', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Shorthand: add an info-level diagnostic. */\n addInfo<C extends string, D = undefined>(code: C, message: string, data: D, hint?: string): this {\n this.items.push(createDiagnostic(code, 'info', message, data, hint) as Diagnostic);\n return this;\n }\n\n /** Merge another bag's diagnostics into this one. */\n merge(other: DiagnosticBag): this {\n for (const d of other.items) {\n this.items.push(d);\n }\n return this;\n }\n\n /** Merge a readonly diagnostic array into this bag. */\n mergeArray(diagnostics: readonly Diagnostic[]): this {\n for (const d of diagnostics) {\n this.items.push(d);\n }\n return this;\n }\n\n /** True if at least one diagnostic has level `error`. */\n hasErrors(): boolean {\n return this.items.some((d) => d.level === 'error');\n }\n\n /** True if at least one diagnostic has the given level. */\n hasLevel(level: DiagnosticLevel): boolean {\n return this.items.some((d) => d.level === level);\n }\n\n /** Return all collected diagnostics as a readonly array. */\n all(): readonly Diagnostic[] {\n return this.items;\n }\n\n /** Build a successful `Result<T>` carrying accumulated diagnostics. */\n toResult<T>(value: T): Result<T> {\n if (this.hasErrors()) {\n return fail(this.items);\n }\n return ok(value, this.items);\n }\n\n /** Build a failed `Result` from the accumulated diagnostics. */\n toFailure(): Result<never> {\n return fail(this.items);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,gBAAb,MAA2B;CACzB,AAAiB,QAAsB,CAAC;;CAGxC,IAAI,SAAiB;EACnB,OAAO,KAAK,MAAM;CACpB;;CAGA,IAAI,YAA8B;EAChC,KAAK,MAAM,KAAK,UAAU;EAC1B,OAAO;CACT;;CAGA,SAA0C,MAAS,SAAiB,MAAS,MAAqB;EAChG,KAAK,MAAM,KAAK,iBAAiB,MAAM,SAAS,SAAS,MAAM,IAAI,CAAe;EAClF,OAAO;CACT;;CAGA,WAA4C,MAAS,SAAiB,MAAS,MAAqB;EAClG,KAAK,MAAM,KAAK,iBAAiB,MAAM,WAAW,SAAS,MAAM,IAAI,CAAe;EACpF,OAAO;CACT;;CAGA,QAAyC,MAAS,SAAiB,MAAS,MAAqB;EAC/F,KAAK,MAAM,KAAK,iBAAiB,MAAM,QAAQ,SAAS,MAAM,IAAI,CAAe;EACjF,OAAO;CACT;;CAGA,MAAM,OAA4B;EAChC,KAAK,MAAM,KAAK,MAAM,OACpB,KAAK,MAAM,KAAK,CAAC;EAEnB,OAAO;CACT;;CAGA,WAAW,aAA0C;EACnD,KAAK,MAAM,KAAK,aACd,KAAK,MAAM,KAAK,CAAC;EAEnB,OAAO;CACT;;CAGA,YAAqB;EACnB,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,UAAU,OAAO;CACnD;;CAGA,SAAS,OAAiC;EACxC,OAAO,KAAK,MAAM,MAAM,MAAM,EAAE,UAAU,KAAK;CACjD;;CAGA,MAA6B;EAC3B,OAAO,KAAK;CACd;;CAGA,SAAY,OAAqB;EAC/B,IAAI,KAAK,UAAU,GACjB,OAAO,KAAK,KAAK,KAAK;EAExB,OAAO,GAAG,OAAO,KAAK,KAAK;CAC7B;;CAGA,YAA2B;EACzB,OAAO,KAAK,KAAK,KAAK;CACxB;AACF"}
@@ -1,11 +1,13 @@
1
- import type { DiagnosticLevel } from './DiagnosticLevel.js';
1
+ import { DiagnosticLevel } from "./DiagnosticLevel.js";
2
+ //#region src/base/DiagnosticFingerprint.d.ts
2
3
  interface FingerprintInput {
3
- readonly level: DiagnosticLevel;
4
- readonly code: string;
5
- readonly message: string;
6
- readonly hint?: string;
7
- readonly data: unknown;
4
+ readonly level: DiagnosticLevel;
5
+ readonly code: string;
6
+ readonly message: string;
7
+ readonly hint?: string;
8
+ readonly data: unknown;
8
9
  }
9
- export declare function createDiagnosticFingerprint(input: FingerprintInput): string;
10
- export {};
10
+ declare function createDiagnosticFingerprint(input: FingerprintInput): string;
11
+ //#endregion
12
+ export { createDiagnosticFingerprint };
11
13
  //# sourceMappingURL=DiagnosticFingerprint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticFingerprint.d.ts","sourceRoot":"","sources":["../../src/base/DiagnosticFingerprint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,gBAAgB;IACxB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAU3E"}
1
+ {"version":3,"file":"DiagnosticFingerprint.d.ts","names":[],"sources":["../../src/base/DiagnosticFingerprint.ts"],"mappings":";;UAGU;WACC,OAAO;WACP;WACA;WACA;WACA;;iBAGK,4BAA4B,OAAO"}
@@ -1,23 +1,22 @@
1
- import { createHash } from 'node:crypto';
2
- export function createDiagnosticFingerprint(input) {
3
- const serialized = stableSerialize({
4
- level: input.level,
5
- code: input.code,
6
- message: input.message,
7
- hint: input.hint ?? null,
8
- data: input.data ?? null,
9
- });
10
- return createHash('sha256').update(serialized).digest('hex');
1
+ import { createHash } from "node:crypto";
2
+
3
+ //#region src/base/DiagnosticFingerprint.ts
4
+ function createDiagnosticFingerprint(input) {
5
+ const serialized = stableSerialize({
6
+ level: input.level,
7
+ code: input.code,
8
+ message: input.message,
9
+ hint: input.hint ?? null,
10
+ data: input.data ?? null
11
+ });
12
+ return createHash("sha256").update(serialized).digest("hex");
11
13
  }
12
14
  function stableSerialize(value) {
13
- if (value === null || typeof value !== 'object') {
14
- return JSON.stringify(value);
15
- }
16
- if (Array.isArray(value)) {
17
- return `[${value.map((item) => stableSerialize(item)).join(',')}]`;
18
- }
19
- const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
20
- const body = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`).join(',');
21
- return `{${body}}`;
15
+ if (value === null || typeof value !== "object") return JSON.stringify(value);
16
+ if (Array.isArray(value)) return `[${value.map((item) => stableSerialize(item)).join(",")}]`;
17
+ return `{${Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`).join(",")}}`;
22
18
  }
19
+
20
+ //#endregion
21
+ export { createDiagnosticFingerprint };
23
22
  //# sourceMappingURL=DiagnosticFingerprint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticFingerprint.js","sourceRoot":"","sources":["../../src/base/DiagnosticFingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAWzC,MAAM,UAAU,2BAA2B,CAAC,KAAuB;IACjE,MAAM,UAAU,GAAG,eAAe,CAAC;QACjC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,IAAI;QACxB,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,IAAI;KACzB,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACrE,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IACxG,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvG,OAAO,IAAI,IAAI,GAAG,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"DiagnosticFingerprint.js","names":[],"sources":["../../src/base/DiagnosticFingerprint.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport type { DiagnosticLevel } from './DiagnosticLevel.js';\n\ninterface FingerprintInput {\n readonly level: DiagnosticLevel;\n readonly code: string;\n readonly message: string;\n readonly hint?: string;\n readonly data: unknown;\n}\n\nexport function createDiagnosticFingerprint(input: FingerprintInput): string {\n const serialized = stableSerialize({\n level: input.level,\n code: input.code,\n message: input.message,\n hint: input.hint ?? null,\n data: input.data ?? null,\n });\n\n return createHash('sha256').update(serialized).digest('hex');\n}\n\nfunction stableSerialize(value: unknown): string {\n if (value === null || typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n if (Array.isArray(value)) {\n return `[${value.map((item) => stableSerialize(item)).join(',')}]`;\n }\n\n const entries = Object.entries(value as Record<string, unknown>).sort(([a], [b]) => a.localeCompare(b));\n const body = entries.map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`).join(',');\n return `{${body}}`;\n}\n"],"mappings":";;;AAWA,SAAgB,4BAA4B,OAAiC;CAC3E,MAAM,aAAa,gBAAgB;EACjC,OAAO,MAAM;EACb,MAAM,MAAM;EACZ,SAAS,MAAM;EACf,MAAM,MAAM,QAAQ;EACpB,MAAM,MAAM,QAAQ;CACtB,CAAC;CAED,OAAO,WAAW,QAAQ,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,OAAO,KAAK;AAC7D;AAEA,SAAS,gBAAgB,OAAwB;CAC/C,IAAI,UAAU,QAAQ,OAAO,UAAU,UACrC,OAAO,KAAK,UAAU,KAAK;CAG7B,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,IAAI,MAAM,KAAK,SAAS,gBAAgB,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;CAKlE,OAAO,IAFS,OAAO,QAAQ,KAAgC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAClF,CAAC,CAAC,KAAK,CAAC,KAAK,UAAU,GAAG,KAAK,UAAU,GAAG,EAAE,GAAG,gBAAgB,IAAI,GAAG,CAAC,CAAC,KAAK,GACpF,EAAE;AAClB"}
@@ -1,3 +1,4 @@
1
+ //#region src/base/DiagnosticLevel.d.ts
1
2
  /**
2
3
  * Diagnostic severity levels.
3
4
  *
@@ -5,5 +6,7 @@
5
6
  * - `warning` – operation can continue but something is concerning
6
7
  * - `info` – informational only
7
8
  */
8
- export type DiagnosticLevel = 'error' | 'warning' | 'info';
9
+ type DiagnosticLevel = 'error' | 'warning' | 'info';
10
+ //#endregion
11
+ export { DiagnosticLevel };
9
12
  //# sourceMappingURL=DiagnosticLevel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DiagnosticLevel.d.ts","sourceRoot":"","sources":["../../src/base/DiagnosticLevel.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC"}
1
+ {"version":3,"file":"DiagnosticLevel.d.ts","names":[],"sources":["../../src/base/DiagnosticLevel.ts"],"mappings":";;;;;;;;KAOY"}
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=DiagnosticLevel.js.map
1
+ export { };
@@ -1,24 +1,27 @@
1
- import type { Diagnostic } from '../types.js';
1
+ import { Diagnostic } from "../types.js";
2
+ //#region src/base/Result.d.ts
2
3
  /** Successful result carrying a value and optional diagnostics. */
3
- export interface ResultOk<T> {
4
- readonly ok: true;
5
- readonly value: T;
6
- readonly diagnostics: readonly Diagnostic[];
4
+ interface ResultOk<T> {
5
+ readonly ok: true;
6
+ readonly value: T;
7
+ readonly diagnostics: readonly Diagnostic[];
7
8
  }
8
9
  /** Failed result carrying at least one diagnostic. */
9
- export interface ResultFail {
10
- readonly ok: false;
11
- readonly diagnostics: readonly Diagnostic[];
10
+ interface ResultFail {
11
+ readonly ok: false;
12
+ readonly diagnostics: readonly Diagnostic[];
12
13
  }
13
14
  /** Discriminated union returned by every fallible uapkg operation. */
14
- export type Result<T> = ResultOk<T> | ResultFail;
15
+ type Result<T> = ResultOk<T> | ResultFail;
15
16
  /** Create a successful result. */
16
- export declare function ok<T>(value: T, diagnostics?: readonly Diagnostic[]): ResultOk<T>;
17
+ declare function ok<T>(value: T, diagnostics?: readonly Diagnostic[]): ResultOk<T>;
17
18
  /** Create a failed result. */
18
- export declare function fail(diagnostics: readonly Diagnostic[]): ResultFail;
19
+ declare function fail(diagnostics: readonly Diagnostic[]): ResultFail;
19
20
  /**
20
21
  * Build a result from a diagnostics array and an optional value.
21
22
  * If any diagnostic has level `error`, the result is a failure.
22
23
  */
23
- export declare function fromDiagnostics<T>(diagnostics: readonly Diagnostic[], value?: T): Result<T>;
24
+ declare function fromDiagnostics<T>(diagnostics: readonly Diagnostic[], value?: T): Result<T>;
25
+ //#endregion
26
+ export { Result, ResultFail, ResultOk, fail, fromDiagnostics, ok };
24
27
  //# sourceMappingURL=Result.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Result.d.ts","sourceRoot":"","sources":["../../src/base/Result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9C,mEAAmE;AACnE,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED,sEAAsE;AACtE,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;AAMjD,kCAAkC;AAClC,wBAAgB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,WAAW,GAAE,SAAS,UAAU,EAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,CAEpF;AAED,8BAA8B;AAC9B,wBAAgB,IAAI,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,CAEnE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,EAAE,SAAS,UAAU,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAM3F"}
1
+ {"version":3,"file":"Result.d.ts","names":[],"sources":["../../src/base/Result.ts"],"mappings":";;;UAOiB,SAAS;WACf;WACA,OAAO;WACP,sBAAsB;;;UAIhB;WACN;WACA,sBAAsB;;;KAIrB,OAAO,KAAK,SAAS,KAAK;;iBAOtB,GAAG,GAAG,OAAO,GAAG,uBAAsB,eAAoB,SAAS;;iBAKnE,KAAK,sBAAsB,eAAe;;;;;iBAQ1C,gBAAgB,GAAG,sBAAsB,cAAc,QAAQ,IAAI,OAAO"}
@@ -1,23 +1,35 @@
1
- // ---------------------------------------------------------------------------
2
- // Factory helpers
3
- // ---------------------------------------------------------------------------
1
+ //#region src/base/Result.ts
4
2
  /** Create a successful result. */
5
- export function ok(value, diagnostics = []) {
6
- return { ok: true, value, diagnostics };
3
+ function ok(value, diagnostics = []) {
4
+ return {
5
+ ok: true,
6
+ value,
7
+ diagnostics
8
+ };
7
9
  }
8
10
  /** Create a failed result. */
9
- export function fail(diagnostics) {
10
- return { ok: false, diagnostics };
11
+ function fail(diagnostics) {
12
+ return {
13
+ ok: false,
14
+ diagnostics
15
+ };
11
16
  }
12
17
  /**
13
- * Build a result from a diagnostics array and an optional value.
14
- * If any diagnostic has level `error`, the result is a failure.
15
- */
16
- export function fromDiagnostics(diagnostics, value) {
17
- const hasError = diagnostics.some((d) => d.level === 'error');
18
- if (hasError || value === undefined) {
19
- return { ok: false, diagnostics };
20
- }
21
- return { ok: true, value, diagnostics };
18
+ * Build a result from a diagnostics array and an optional value.
19
+ * If any diagnostic has level `error`, the result is a failure.
20
+ */
21
+ function fromDiagnostics(diagnostics, value) {
22
+ if (diagnostics.some((d) => d.level === "error") || value === void 0) return {
23
+ ok: false,
24
+ diagnostics
25
+ };
26
+ return {
27
+ ok: true,
28
+ value,
29
+ diagnostics
30
+ };
22
31
  }
32
+
33
+ //#endregion
34
+ export { fail, fromDiagnostics, ok };
23
35
  //# sourceMappingURL=Result.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Result.js","sourceRoot":"","sources":["../../src/base/Result.ts"],"names":[],"mappings":"AAsBA,8EAA8E;AAC9E,kBAAkB;AAClB,8EAA8E;AAE9E,kCAAkC;AAClC,MAAM,UAAU,EAAE,CAAI,KAAQ,EAAE,cAAqC,EAAE;IACrE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC1C,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,IAAI,CAAC,WAAkC;IACrD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAI,WAAkC,EAAE,KAAS;IAC9E,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;IAC9D,IAAI,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;IACpC,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"Result.js","names":[],"sources":["../../src/base/Result.ts"],"sourcesContent":["import type { Diagnostic } from '../types.js';\n\n// ---------------------------------------------------------------------------\n// Result<T> — the universal return type for fallible operations.\n// ---------------------------------------------------------------------------\n\n/** Successful result carrying a value and optional diagnostics. */\nexport interface ResultOk<T> {\n readonly ok: true;\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** Failed result carrying at least one diagnostic. */\nexport interface ResultFail {\n readonly ok: false;\n readonly diagnostics: readonly Diagnostic[];\n}\n\n/** Discriminated union returned by every fallible uapkg operation. */\nexport type Result<T> = ResultOk<T> | ResultFail;\n\n// ---------------------------------------------------------------------------\n// Factory helpers\n// ---------------------------------------------------------------------------\n\n/** Create a successful result. */\nexport function ok<T>(value: T, diagnostics: readonly Diagnostic[] = []): ResultOk<T> {\n return { ok: true, value, diagnostics };\n}\n\n/** Create a failed result. */\nexport function fail(diagnostics: readonly Diagnostic[]): ResultFail {\n return { ok: false, diagnostics };\n}\n\n/**\n * Build a result from a diagnostics array and an optional value.\n * If any diagnostic has level `error`, the result is a failure.\n */\nexport function fromDiagnostics<T>(diagnostics: readonly Diagnostic[], value?: T): Result<T> {\n const hasError = diagnostics.some((d) => d.level === 'error');\n if (hasError || value === undefined) {\n return { ok: false, diagnostics };\n }\n return { ok: true, value, diagnostics };\n}\n"],"mappings":";;AA2BA,SAAgB,GAAM,OAAU,cAAqC,CAAC,GAAgB;CACpF,OAAO;EAAE,IAAI;EAAM;EAAO;CAAY;AACxC;;AAGA,SAAgB,KAAK,aAAgD;CACnE,OAAO;EAAE,IAAI;EAAO;CAAY;AAClC;;;;;AAMA,SAAgB,gBAAmB,aAAoC,OAAsB;CAE3F,IADiB,YAAY,MAAM,MAAM,EAAE,UAAU,OAC1C,KAAK,UAAU,QACxB,OAAO;EAAE,IAAI;EAAO;CAAY;CAElC,OAAO;EAAE,IAAI;EAAM;EAAO;CAAY;AACxC"}