@pristine-ts/common 2.0.4 → 2.0.6

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 (132) hide show
  1. package/dist/lib/cjs/contexts/event-context.js.map +1 -1
  2. package/dist/lib/cjs/decorators/traced.decorator.js +38 -2
  3. package/dist/lib/cjs/decorators/traced.decorator.js.map +1 -1
  4. package/dist/lib/cjs/errors/bad-request.error.js +15 -0
  5. package/dist/lib/cjs/errors/bad-request.error.js.map +1 -0
  6. package/dist/lib/cjs/errors/config.error.js +20 -0
  7. package/dist/lib/cjs/errors/config.error.js.map +1 -0
  8. package/dist/lib/cjs/errors/conflict.error.js +15 -0
  9. package/dist/lib/cjs/errors/conflict.error.js.map +1 -0
  10. package/dist/lib/cjs/errors/errors.js +14 -1
  11. package/dist/lib/cjs/errors/errors.js.map +1 -1
  12. package/dist/lib/cjs/errors/exit-code.enum.js +50 -0
  13. package/dist/lib/cjs/errors/exit-code.enum.js.map +1 -0
  14. package/dist/lib/cjs/errors/forbidden.error.js +15 -0
  15. package/dist/lib/cjs/errors/forbidden.error.js.map +1 -0
  16. package/dist/lib/cjs/errors/internal.error.js +19 -0
  17. package/dist/lib/cjs/errors/internal.error.js.map +1 -0
  18. package/dist/lib/cjs/errors/not-found.error.js +15 -0
  19. package/dist/lib/cjs/errors/not-found.error.js.map +1 -0
  20. package/dist/lib/cjs/errors/pristine-error-code.enum.js +37 -0
  21. package/dist/lib/cjs/errors/pristine-error-code.enum.js.map +1 -0
  22. package/dist/lib/cjs/errors/pristine-error-kind.enum.js +29 -0
  23. package/dist/lib/cjs/errors/pristine-error-kind.enum.js.map +1 -0
  24. package/dist/lib/cjs/errors/pristine-error-options.interface.js +3 -0
  25. package/dist/lib/cjs/errors/pristine-error-options.interface.js.map +1 -0
  26. package/dist/lib/cjs/errors/pristine.error.js +109 -0
  27. package/dist/lib/cjs/errors/pristine.error.js.map +1 -0
  28. package/dist/lib/cjs/errors/unauthorized.error.js +15 -0
  29. package/dist/lib/cjs/errors/unauthorized.error.js.map +1 -0
  30. package/dist/lib/cjs/errors/usage.error.js +18 -0
  31. package/dist/lib/cjs/errors/usage.error.js.map +1 -0
  32. package/dist/lib/cjs/errors/validation.error.js +15 -0
  33. package/dist/lib/cjs/errors/validation.error.js.map +1 -0
  34. package/dist/lib/cjs/managers/event-context.manager.js +9 -0
  35. package/dist/lib/cjs/managers/event-context.manager.js.map +1 -1
  36. package/dist/lib/cjs/models/models.js +2 -1
  37. package/dist/lib/cjs/models/models.js.map +1 -1
  38. package/dist/lib/cjs/models/span-lifecycle-owner.interface.js +3 -0
  39. package/dist/lib/cjs/models/span-lifecycle-owner.interface.js.map +1 -0
  40. package/dist/lib/cjs/models/span-marker.model.js +34 -0
  41. package/dist/lib/cjs/models/span-marker.model.js.map +1 -0
  42. package/dist/lib/cjs/models/span.model.js +5 -2
  43. package/dist/lib/cjs/models/span.model.js.map +1 -1
  44. package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  45. package/dist/lib/cjs/utils/utils.js +0 -1
  46. package/dist/lib/cjs/utils/utils.js.map +1 -1
  47. package/dist/lib/esm/contexts/event-context.js.map +1 -1
  48. package/dist/lib/esm/decorators/traced.decorator.js +38 -2
  49. package/dist/lib/esm/decorators/traced.decorator.js.map +1 -1
  50. package/dist/lib/esm/errors/bad-request.error.js +11 -0
  51. package/dist/lib/esm/errors/bad-request.error.js.map +1 -0
  52. package/dist/lib/esm/errors/config.error.js +16 -0
  53. package/dist/lib/esm/errors/config.error.js.map +1 -0
  54. package/dist/lib/esm/errors/conflict.error.js +11 -0
  55. package/dist/lib/esm/errors/conflict.error.js.map +1 -0
  56. package/dist/lib/esm/errors/errors.js +14 -1
  57. package/dist/lib/esm/errors/errors.js.map +1 -1
  58. package/dist/lib/esm/errors/exit-code.enum.js +47 -0
  59. package/dist/lib/esm/errors/exit-code.enum.js.map +1 -0
  60. package/dist/lib/esm/errors/forbidden.error.js +11 -0
  61. package/dist/lib/esm/errors/forbidden.error.js.map +1 -0
  62. package/dist/lib/esm/errors/internal.error.js +15 -0
  63. package/dist/lib/esm/errors/internal.error.js.map +1 -0
  64. package/dist/lib/esm/errors/not-found.error.js +11 -0
  65. package/dist/lib/esm/errors/not-found.error.js.map +1 -0
  66. package/dist/lib/esm/errors/pristine-error-code.enum.js +34 -0
  67. package/dist/lib/esm/errors/pristine-error-code.enum.js.map +1 -0
  68. package/dist/lib/esm/errors/pristine-error-kind.enum.js +26 -0
  69. package/dist/lib/esm/errors/pristine-error-kind.enum.js.map +1 -0
  70. package/dist/lib/esm/errors/pristine-error-options.interface.js +2 -0
  71. package/dist/lib/esm/errors/pristine-error-options.interface.js.map +1 -0
  72. package/dist/lib/esm/errors/pristine.error.js +105 -0
  73. package/dist/lib/esm/errors/pristine.error.js.map +1 -0
  74. package/dist/lib/esm/errors/unauthorized.error.js +11 -0
  75. package/dist/lib/esm/errors/unauthorized.error.js.map +1 -0
  76. package/dist/lib/esm/errors/usage.error.js +14 -0
  77. package/dist/lib/esm/errors/usage.error.js.map +1 -0
  78. package/dist/lib/esm/errors/validation.error.js +11 -0
  79. package/dist/lib/esm/errors/validation.error.js.map +1 -0
  80. package/dist/lib/esm/managers/event-context.manager.js +9 -0
  81. package/dist/lib/esm/managers/event-context.manager.js.map +1 -1
  82. package/dist/lib/esm/models/models.js +2 -1
  83. package/dist/lib/esm/models/models.js.map +1 -1
  84. package/dist/lib/esm/models/span-lifecycle-owner.interface.js +2 -0
  85. package/dist/lib/esm/models/span-lifecycle-owner.interface.js.map +1 -0
  86. package/dist/lib/esm/models/span-marker.model.js +30 -0
  87. package/dist/lib/esm/models/span-marker.model.js.map +1 -0
  88. package/dist/lib/esm/models/span.model.js +5 -2
  89. package/dist/lib/esm/models/span.model.js.map +1 -1
  90. package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
  91. package/dist/lib/esm/utils/utils.js +0 -1
  92. package/dist/lib/esm/utils/utils.js.map +1 -1
  93. package/dist/types/contexts/event-context.d.ts +12 -4
  94. package/dist/types/errors/bad-request.error.d.ts +8 -0
  95. package/dist/types/errors/config.error.d.ts +13 -0
  96. package/dist/types/errors/conflict.error.d.ts +8 -0
  97. package/dist/types/errors/errors.d.ts +14 -1
  98. package/dist/types/errors/exit-code.enum.d.ts +45 -0
  99. package/dist/types/errors/forbidden.error.d.ts +8 -0
  100. package/dist/types/errors/internal.error.d.ts +12 -0
  101. package/dist/types/errors/not-found.error.d.ts +8 -0
  102. package/dist/types/errors/pristine-error-code.enum.d.ts +32 -0
  103. package/dist/types/errors/pristine-error-kind.enum.d.ts +24 -0
  104. package/dist/types/errors/pristine-error-options.interface.d.ts +59 -0
  105. package/dist/types/errors/pristine.error.d.ts +78 -0
  106. package/dist/types/errors/unauthorized.error.d.ts +8 -0
  107. package/dist/types/errors/usage.error.d.ts +11 -0
  108. package/dist/types/errors/validation.error.d.ts +8 -0
  109. package/dist/types/interfaces/module.interface.d.ts +26 -0
  110. package/dist/types/interfaces/tracing-manager.interface.d.ts +7 -7
  111. package/dist/types/managers/event-context.manager.d.ts +4 -0
  112. package/dist/types/models/models.d.ts +2 -1
  113. package/dist/types/models/span-lifecycle-owner.interface.d.ts +11 -0
  114. package/dist/types/models/span-marker.model.d.ts +36 -0
  115. package/dist/types/models/span.model.d.ts +7 -12
  116. package/dist/types/utils/utils.d.ts +0 -1
  117. package/package.json +2 -2
  118. package/dist/lib/cjs/errors/loggable.error.js +0 -19
  119. package/dist/lib/cjs/errors/loggable.error.js.map +0 -1
  120. package/dist/lib/cjs/models/span-event.model.js +0 -28
  121. package/dist/lib/cjs/models/span-event.model.js.map +0 -1
  122. package/dist/lib/cjs/utils/span-runner.js +0 -117
  123. package/dist/lib/cjs/utils/span-runner.js.map +0 -1
  124. package/dist/lib/esm/errors/loggable.error.js +0 -15
  125. package/dist/lib/esm/errors/loggable.error.js.map +0 -1
  126. package/dist/lib/esm/models/span-event.model.js +0 -24
  127. package/dist/lib/esm/models/span-event.model.js.map +0 -1
  128. package/dist/lib/esm/utils/span-runner.js +0 -113
  129. package/dist/lib/esm/utils/span-runner.js.map +0 -1
  130. package/dist/types/errors/loggable.error.d.ts +0 -8
  131. package/dist/types/models/span-event.model.d.ts +0 -30
  132. package/dist/types/utils/span-runner.d.ts +0 -55
@@ -1 +1 @@
1
- {"version":3,"file":"event-context.js","sourceRoot":"","sources":["../../../../src/contexts/event-context.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAY;CAmBxB;AAnBD,oCAmBC"}
1
+ {"version":3,"file":"event-context.js","sourceRoot":"","sources":["../../../../src/contexts/event-context.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;GAeG;AACH,MAAa,YAAY;CA2BxB;AA3BD,oCA2BC"}
@@ -1,7 +1,16 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.traced = traced;
4
- const span_runner_1 = require("../utils/span-runner");
13
+ const event_context_manager_1 = require("../managers/event-context.manager");
5
14
  /**
6
15
  * Method decorator that wraps the decorated method in a span. The span is automatically
7
16
  * ended when the method returns or throws, and the `TracingManager` is auto-resolved
@@ -57,7 +66,34 @@ function traced(spanName) {
57
66
  const className = (_c = (_b = (_a = target === null || target === void 0 ? void 0 : target.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : target === null || target === void 0 ? void 0 : target.name) !== null && _c !== void 0 ? _c : "anonymous";
58
67
  const resolvedName = spanName !== null && spanName !== void 0 ? spanName : `${className}.${String(propertyKey)}`;
59
68
  descriptor.value = function (...args) {
60
- return span_runner_1.spanRunner.runWithSpan(resolvedName, () => original.apply(this, args));
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const tracingManager = event_context_manager_1.EventContextManager.tracingManager();
71
+ if (tracingManager === undefined) {
72
+ // No active EventContext (unit test, background work, kernel boot before the
73
+ // pipeline runs). Run the original unchanged — tracing must never throw or
74
+ // alter semantics.
75
+ return yield original.apply(this, args);
76
+ }
77
+ const span = tracingManager.startSpan(resolvedName);
78
+ try {
79
+ return yield original.apply(this, args);
80
+ }
81
+ catch (error) {
82
+ // Annotate the span with error info so it surfaces in the rendered tree
83
+ // without forcing the caller to remember to add it themselves. `span.context`
84
+ // is string-typed by design (cheap to serialize), so we coerce.
85
+ if (error instanceof Error) {
86
+ span.context = Object.assign(Object.assign({}, span.context), { error: "true", errorName: error.name, errorMessage: error.message });
87
+ }
88
+ else {
89
+ span.context = Object.assign(Object.assign({}, span.context), { error: "true", errorName: "non-error-throw", errorMessage: String(error) });
90
+ }
91
+ throw error;
92
+ }
93
+ finally {
94
+ span.end();
95
+ }
96
+ });
61
97
  };
62
98
  return descriptor;
63
99
  };
@@ -1 +1 @@
1
- {"version":3,"file":"traced.decorator.js","sourceRoot":"","sources":["../../../../src/decorators/traced.decorator.ts"],"names":[],"mappings":";;AAyCA,wBAsBC;AA/DD,sDAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,SAAgB,MAAM,CAAC,QAAiB;IACtC,OAAO,CAAC,MAAW,EAAE,WAA4B,EAAE,UAA8B,EAAE,EAAE;;QACnF,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YACnC,+EAA+E;YAC/E,4EAA4E;YAC5E,4BAA4B;YAC5B,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AEF,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BadRequestError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /** 400. Caller sent malformed/invalid input. CLI exit `ExitCode.DataError` (65). */
9
+ class BadRequestError extends pristine_error_1.PristineError {
10
+ constructor(message, options = {}) {
11
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.BadRequest, httpStatus: 400, exitCode: exit_code_enum_1.ExitCode.DataError, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
12
+ }
13
+ }
14
+ exports.BadRequestError = BadRequestError;
15
+ //# sourceMappingURL=bad-request.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bad-request.error.js","sourceRoot":"","sources":["../../../../src/errors/bad-request.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D,oFAAoF;AACpF,MAAa,eAAgB,SAAQ,8BAAa;IAChD,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,SAAS,EACjF,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,0CAQC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfigError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /**
9
+ * Configuration loading / parsing / validation failure. No `httpStatus` — config errors
10
+ * shouldn't be exposed to HTTP callers, so the responder will treat them as 500 with
11
+ * sanitized message. CLI exit `ExitCode.Configuration` (78). Marked `SystemError` so the
12
+ * message isn't surfaced verbatim in production HTTP responses.
13
+ */
14
+ class ConfigError extends pristine_error_1.PristineError {
15
+ constructor(message, options = {}) {
16
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.ConfigError, exitCode: exit_code_enum_1.ExitCode.Configuration, kind: pristine_error_kind_enum_1.PristineErrorKind.SystemError }, options));
17
+ }
18
+ }
19
+ exports.ConfigError = ConfigError;
20
+ //# sourceMappingURL=config.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.error.js","sourceRoot":"","sources":["../../../../src/errors/config.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,8BAAa;IAC5C,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,WAAW,EAAE,QAAQ,EAAE,yBAAQ,CAAC,aAAa,EACrE,IAAI,EAAE,4CAAiB,CAAC,WAAW,IAChC,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,kCAQC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConflictError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /** 409. Operation conflicts with existing state (duplicate, version mismatch, etc.). */
9
+ class ConflictError extends pristine_error_1.PristineError {
10
+ constructor(message, options = {}) {
11
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.Conflict, httpStatus: 409, exitCode: exit_code_enum_1.ExitCode.Error, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
12
+ }
13
+ }
14
+ exports.ConflictError = ConflictError;
15
+ //# sourceMappingURL=conflict.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conflict.error.js","sourceRoot":"","sources":["../../../../src/errors/conflict.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D,wFAAwF;AACxF,MAAa,aAAc,SAAQ,8BAAa;IAC9C,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,KAAK,EAC3E,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,sCAQC"}
@@ -14,5 +14,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./loggable.error"), exports);
17
+ __exportStar(require("./bad-request.error"), exports);
18
+ __exportStar(require("./config.error"), exports);
19
+ __exportStar(require("./conflict.error"), exports);
20
+ __exportStar(require("./exit-code.enum"), exports);
21
+ __exportStar(require("./forbidden.error"), exports);
22
+ __exportStar(require("./internal.error"), exports);
23
+ __exportStar(require("./not-found.error"), exports);
24
+ __exportStar(require("./pristine-error-code.enum"), exports);
25
+ __exportStar(require("./pristine-error-kind.enum"), exports);
26
+ __exportStar(require("./pristine-error-options.interface"), exports);
27
+ __exportStar(require("./pristine.error"), exports);
28
+ __exportStar(require("./unauthorized.error"), exports);
29
+ __exportStar(require("./usage.error"), exports);
30
+ __exportStar(require("./validation.error"), exports);
18
31
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/errors/errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AACjC,oDAAkC;AAClC,6DAA2C;AAC3C,6DAA2C;AAC3C,qEAAmD;AACnD,mDAAiC;AACjC,uDAAqC;AACrC,gDAA8B;AAC9B,qDAAmC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExitCode = void 0;
4
+ /**
5
+ * Standard process exit codes, drawn from BSD's `sysexits.h` conventions. Surfaced by
6
+ * `CliErrorReporter` and `PristineError.options.exitCode` so shell pipelines can branch on
7
+ * meaningful failure categories rather than the binary "0 or non-zero" distinction.
8
+ *
9
+ * **Use the enum for framework-standard codes.** Consumers can pass raw numbers for any
10
+ * custom exit code — `PristineErrorOptions.exitCode` is typed `ExitCode | number`.
11
+ *
12
+ * Note that exit codes ≥ 64 (`Usage` and above) follow the `sysexits.h` registered
13
+ * meanings; lower codes (1, etc.) are conventional but not standardized.
14
+ *
15
+ * ```ts
16
+ * throw new ConfigError("Missing DATABASE_URL", {
17
+ * exitCode: ExitCode.Configuration, // 78 — picked up by shells aware of sysexits.h
18
+ * });
19
+ *
20
+ * throw new UsageError("Unknown flag --foo", {
21
+ * exitCode: ExitCode.Usage, // 64
22
+ * });
23
+ * ```
24
+ */
25
+ var ExitCode;
26
+ (function (ExitCode) {
27
+ /** Successful termination. */
28
+ ExitCode[ExitCode["Success"] = 0] = "Success";
29
+ /** Generic error. Default fallback for user-facing errors that don't specify a code. */
30
+ ExitCode[ExitCode["Error"] = 1] = "Error";
31
+ /** Command-line usage error (`EX_USAGE`). Bad flags, missing required args, unknown commands. */
32
+ ExitCode[ExitCode["Usage"] = 64] = "Usage";
33
+ /** Input data malformed (`EX_DATAERR`). Validation failed, body unparseable. */
34
+ ExitCode[ExitCode["DataError"] = 65] = "DataError";
35
+ /** Internal software error (`EX_SOFTWARE`). Default fallback for system errors. */
36
+ ExitCode[ExitCode["Software"] = 70] = "Software";
37
+ /** Can't create user output file (`EX_CANTCREAT`). */
38
+ ExitCode[ExitCode["Cantcreat"] = 73] = "Cantcreat";
39
+ /** Input/output error (`EX_IOERR`). */
40
+ ExitCode[ExitCode["IoError"] = 74] = "IoError";
41
+ /** Temporary failure, retry might succeed (`EX_TEMPFAIL`). */
42
+ ExitCode[ExitCode["Temporary"] = 75] = "Temporary";
43
+ /** Remote error in protocol (`EX_PROTOCOL`). */
44
+ ExitCode[ExitCode["Protocol"] = 76] = "Protocol";
45
+ /** Permission denied (`EX_NOPERM`). Authentication / authorization failures. */
46
+ ExitCode[ExitCode["NoPermission"] = 77] = "NoPermission";
47
+ /** Configuration error (`EX_CONFIG`). Missing or invalid config. */
48
+ ExitCode[ExitCode["Configuration"] = 78] = "Configuration";
49
+ })(ExitCode || (exports.ExitCode = ExitCode = {}));
50
+ //# sourceMappingURL=exit-code.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exit-code.enum.js","sourceRoot":"","sources":["../../../../src/errors/exit-code.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAY,QAiCX;AAjCD,WAAY,QAAQ;IAClB,8BAA8B;IAC9B,6CAAmB,CAAA;IAEnB,wFAAwF;IACxF,yCAAmB,CAAA;IAEnB,iGAAiG;IACjG,0CAAoB,CAAA;IAEpB,gFAAgF;IAChF,kDAAoB,CAAA;IAEpB,mFAAmF;IACnF,gDAAoB,CAAA;IAEpB,sDAAsD;IACtD,kDAAoB,CAAA;IAEpB,uCAAuC;IACvC,8CAAoB,CAAA;IAEpB,8DAA8D;IAC9D,kDAAoB,CAAA;IAEpB,gDAAgD;IAChD,gDAAoB,CAAA;IAEpB,gFAAgF;IAChF,wDAAoB,CAAA;IAEpB,oEAAoE;IACpE,0DAAoB,CAAA;AACtB,CAAC,EAjCW,QAAQ,wBAAR,QAAQ,QAiCnB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ForbiddenError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /** 403. Caller is authenticated but lacks permission. CLI exit `ExitCode.NoPermission` (77). */
9
+ class ForbiddenError extends pristine_error_1.PristineError {
10
+ constructor(message = "Forbidden", options = {}) {
11
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.Forbidden, httpStatus: 403, exitCode: exit_code_enum_1.ExitCode.NoPermission, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
12
+ }
13
+ }
14
+ exports.ForbiddenError = ForbiddenError;
15
+ //# sourceMappingURL=forbidden.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forbidden.error.js","sourceRoot":"","sources":["../../../../src/errors/forbidden.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D,gGAAgG;AAChG,MAAa,cAAe,SAAQ,8BAAa;IAC/C,YAAY,UAAkB,WAAW,EAAE,UAA2B,EAAE;QACtE,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,YAAY,EACnF,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,wCAQC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InternalError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /**
9
+ * Catch-all for framework/system bugs that shouldn't be exposed verbatim. 500.
10
+ * CLI exit `ExitCode.Software` (70). `SystemError` triggers message sanitization in
11
+ * production mode.
12
+ */
13
+ class InternalError extends pristine_error_1.PristineError {
14
+ constructor(message = "Internal error", options = {}) {
15
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.InternalError, httpStatus: 500, exitCode: exit_code_enum_1.ExitCode.Software, kind: pristine_error_kind_enum_1.PristineErrorKind.SystemError }, options));
16
+ }
17
+ }
18
+ exports.InternalError = InternalError;
19
+ //# sourceMappingURL=internal.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.error.js","sourceRoot":"","sources":["../../../../src/errors/internal.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D;;;;GAIG;AACH,MAAa,aAAc,SAAQ,8BAAa;IAC9C,YAAY,UAAkB,gBAAgB,EAAE,UAA2B,EAAE;QAC3E,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,aAAa,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,QAAQ,EACnF,IAAI,EAAE,4CAAiB,CAAC,WAAW,IAChC,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,sCAQC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotFoundError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /** 404. Resource doesn't exist. CLI exit `ExitCode.Error` (1). */
9
+ class NotFoundError extends pristine_error_1.PristineError {
10
+ constructor(message, options = {}) {
11
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.NotFound, httpStatus: 404, exitCode: exit_code_enum_1.ExitCode.Error, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
12
+ }
13
+ }
14
+ exports.NotFoundError = NotFoundError;
15
+ //# sourceMappingURL=not-found.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-found.error.js","sourceRoot":"","sources":["../../../../src/errors/not-found.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D,kEAAkE;AAClE,MAAa,aAAc,SAAQ,8BAAa;IAC9C,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,KAAK,EAC3E,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,sCAQC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PristineErrorCode = void 0;
4
+ /**
5
+ * Standard error-code catalog used across the framework. Each value is a `SCREAMING_SNAKE_CASE`
6
+ * slug surfaced in the HTTP response body (`{"code": ...}`) and on CLI stderr (`✗ CODE: ...`).
7
+ *
8
+ * **Use the enum members for framework-standard cases.** Consumers can add their own
9
+ * domain-specific codes by passing a plain string — `PristineErrorOptions.code` is typed
10
+ * `PristineErrorCode | string` so both the enum and free-form strings get autocomplete-
11
+ * friendly type checking.
12
+ *
13
+ * ```ts
14
+ * throw new PristineError("Token expired", {
15
+ * code: "TOKEN_EXPIRED", // consumer-defined code
16
+ * httpStatus: 401,
17
+ * });
18
+ *
19
+ * throw new PristineError("Item missing", {
20
+ * code: PristineErrorCode.NotFound, // framework-standard code
21
+ * httpStatus: 404,
22
+ * });
23
+ * ```
24
+ */
25
+ var PristineErrorCode;
26
+ (function (PristineErrorCode) {
27
+ PristineErrorCode["BadRequest"] = "BAD_REQUEST";
28
+ PristineErrorCode["Unauthorized"] = "UNAUTHORIZED";
29
+ PristineErrorCode["Forbidden"] = "FORBIDDEN";
30
+ PristineErrorCode["NotFound"] = "NOT_FOUND";
31
+ PristineErrorCode["Conflict"] = "CONFLICT";
32
+ PristineErrorCode["ValidationFailed"] = "VALIDATION_FAILED";
33
+ PristineErrorCode["ConfigError"] = "CONFIG_ERROR";
34
+ PristineErrorCode["UsageError"] = "USAGE_ERROR";
35
+ PristineErrorCode["InternalError"] = "INTERNAL_ERROR";
36
+ })(PristineErrorCode || (exports.PristineErrorCode = PristineErrorCode = {}));
37
+ //# sourceMappingURL=pristine-error-code.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pristine-error-code.enum.js","sourceRoot":"","sources":["../../../../src/errors/pristine-error-code.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B,+CAAiC,CAAA;IACjC,kDAAkC,CAAA;IAClC,4CAA+B,CAAA;IAC/B,2CAA+B,CAAA;IAC/B,0CAA8B,CAAA;IAC9B,2DAAuC,CAAA;IACvC,iDAAkC,CAAA;IAClC,+CAAiC,CAAA;IACjC,qDAAoC,CAAA;AACtC,CAAC,EAVW,iBAAiB,iCAAjB,iBAAiB,QAU5B"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PristineErrorKind = void 0;
4
+ /**
5
+ * Categorizes a `PristineError` by who caused it. Replaces the older `expected: boolean`
6
+ * field, whose meaning ("expected by whom?") wasn't self-explanatory.
7
+ *
8
+ * The kind drives how the channel reporters render the error in production mode:
9
+ *
10
+ * - `UserError`: caller did something wrong. Message is safe to expose verbatim;
11
+ * structured details surface as-is. HTTP responses use the carried `httpStatus`
12
+ * (typically 4xx). CLI stderr shows the message and details.
13
+ *
14
+ * - `SystemError`: framework or downstream bug — not the caller's fault. In production
15
+ * mode the message is replaced with a generic "Internal Server Error" / "Internal Error"
16
+ * so internal details never leak to clients. Stack and cause chain are still logged
17
+ * internally via the LogHandler for operators. In development mode (`PRISTINE_ENV=dev`)
18
+ * the full message surfaces.
19
+ *
20
+ * Default is `UserError` — most thrown errors in framework and application code are caller-
21
+ * induced. `PristineError.from(unknown)` marks raw `Error` and non-Error throws as
22
+ * `SystemError` since they didn't opt into the typed contract.
23
+ */
24
+ var PristineErrorKind;
25
+ (function (PristineErrorKind) {
26
+ PristineErrorKind["UserError"] = "user-error";
27
+ PristineErrorKind["SystemError"] = "system-error";
28
+ })(PristineErrorKind || (exports.PristineErrorKind = PristineErrorKind = {}));
29
+ //# sourceMappingURL=pristine-error-kind.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pristine-error-kind.enum.js","sourceRoot":"","sources":["../../../../src/errors/pristine-error-kind.enum.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,6CAA0B,CAAA;IAC1B,iDAA4B,CAAA;AAC9B,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=pristine-error-options.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pristine-error-options.interface.js","sourceRoot":"","sources":["../../../../src/errors/pristine-error-options.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PristineError = void 0;
4
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
5
+ /**
6
+ * Single error base for the entire framework. Replaces the old `LoggableError` +
7
+ * `HttpError` + ad-hoc subclass hierarchy.
8
+ *
9
+ * **What it gives you**:
10
+ * - A structured `options` bag (`code`, `httpStatus`, `exitCode`, `details`, `cause`,
11
+ * `kind`) read by both the HTTP and CLI channel reporters.
12
+ * - Automatic `error.name = ClassName` for subclasses.
13
+ * - Automatic prototype-chain fix via `new.target.prototype` — subclasses never need to
14
+ * repeat the `Object.setPrototypeOf(this, FooError.prototype)` incantation, AND
15
+ * `instanceof` works correctly for direct/standard-library/custom subclasses at any
16
+ * depth (verified by spec).
17
+ * - Standard `Error.cause` propagation (Node 16.9+ native).
18
+ *
19
+ * **Subclass form** when a named class makes `instanceof` checks read better:
20
+ *
21
+ * ```ts
22
+ * export class TokenExpiredError extends UnauthorizedError {
23
+ * constructor(tokenId: string) {
24
+ * super("The token has expired", {
25
+ * code: "TOKEN_EXPIRED",
26
+ * details: { tokenId },
27
+ * });
28
+ * }
29
+ * }
30
+ * // ...
31
+ * try { ... }
32
+ * catch (e) { if (e instanceof TokenExpiredError) ... } // works.
33
+ * ```
34
+ *
35
+ * **Direct form** when the call site self-documents:
36
+ *
37
+ * ```ts
38
+ * throw new PristineError(`User '${id}' not found`, {
39
+ * code: PristineErrorCode.NotFound,
40
+ * httpStatus: 404,
41
+ * details: { resource: "User", id },
42
+ * });
43
+ * ```
44
+ *
45
+ * **Re-throw with enrichment** when catching, adding context, and re-throwing. Use the
46
+ * standard `cause` chain rather than mutating the original — this preserves the original
47
+ * error's identity for tooling that walks `error.cause`:
48
+ *
49
+ * ```ts
50
+ * try { await dispatcher.dispatch(event); }
51
+ * catch (cause) {
52
+ * throw new PristineError("Event dispatch failed", {
53
+ * code: "EVENT_DISPATCH_FAILED",
54
+ * kind: PristineErrorKind.SystemError,
55
+ * cause,
56
+ * details: { eventId: event.id },
57
+ * });
58
+ * }
59
+ * ```
60
+ */
61
+ class PristineError extends Error {
62
+ constructor(message, options = {}) {
63
+ // Use the standard Error.cause slot so any tooling that knows the standard chain
64
+ // (debuggers, V8's default Error formatting, OpenTelemetry's exception recording)
65
+ // picks it up automatically. We don't need a custom `originalError` slot.
66
+ super(message, { cause: options.cause });
67
+ // `new.target` is the actual class being constructed (subclass or PristineError
68
+ // itself). Using it for both `name` and `setPrototypeOf` means subclasses never need
69
+ // to repeat the boilerplate, and `instanceof` works correctly at every depth.
70
+ this.name = new.target.name;
71
+ Object.setPrototypeOf(this, new.target.prototype);
72
+ // `kind: UserError` is the default — most thrown errors are caller-induced. System
73
+ // errors get marked explicitly via `kind: PristineErrorKind.SystemError` (or by
74
+ // `PristineError.from` for unknown throws).
75
+ this.options = Object.assign({ kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options);
76
+ }
77
+ /**
78
+ * Normalizes any thrown value into a `PristineError`. The chokepoint that every channel
79
+ * reporter funnels through before rendering, so the reporters never need to handle
80
+ * unknown shapes.
81
+ *
82
+ * - `PristineError` instances pass through unchanged.
83
+ * - `Error` instances are wrapped with `kind: SystemError` and propagated as `cause` —
84
+ * the wrapper preserves the original message and stack for `mode === Development`
85
+ * rendering.
86
+ * - Anything else (strings, numbers, `throw {someObject}`) is coerced via `String(...)`
87
+ * into a message with `kind: SystemError`.
88
+ *
89
+ * The standard `Error.cause` chain is preserved: if the input has a `cause`, it stays
90
+ * on the wrapper (which itself has the input as its cause), so a debugger walking
91
+ * `error.cause.cause.cause` sees the full history.
92
+ */
93
+ static from(error) {
94
+ if (error instanceof PristineError) {
95
+ return error;
96
+ }
97
+ if (error instanceof Error) {
98
+ return new PristineError(error.message, {
99
+ cause: error,
100
+ kind: pristine_error_kind_enum_1.PristineErrorKind.SystemError,
101
+ });
102
+ }
103
+ return new PristineError(String(error), {
104
+ kind: pristine_error_kind_enum_1.PristineErrorKind.SystemError,
105
+ });
106
+ }
107
+ }
108
+ exports.PristineError = PristineError;
109
+ //# sourceMappingURL=pristine.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pristine.error.js","sourceRoot":"","sources":["../../../../src/errors/pristine.error.ts"],"names":[],"mappings":";;;AAAA,yEAA6D;AAG7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,aAAc,SAAQ,KAAK;IAGtC,YAAY,OAAe,EAAE,UAAgC,EAAE;QAC7D,iFAAiF;QACjF,kFAAkF;QAClF,0EAA0E;QAC1E,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAEzC,gFAAgF;QAChF,qFAAqF;QACrF,8EAA8E;QAC9E,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,mFAAmF;QACnF,gFAAgF;QAChF,4CAA4C;QAC5C,IAAI,CAAC,OAAO,mBAAK,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAAK,OAAO,CAAE,CAAC;IACnE,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,IAAI,CAAC,KAAc;QACxB,IAAI,KAAK,YAAY,aAAa,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE;gBACtC,KAAK,EAAE,KAAK;gBACZ,IAAI,EAAE,4CAAiB,CAAC,WAAW;aACpC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACtC,IAAI,EAAE,4CAAiB,CAAC,WAAW;SACpC,CAAC,CAAC;IACL,CAAC;CACF;AAnDD,sCAmDC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnauthorizedError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /** 401. Caller is not authenticated. CLI exit `ExitCode.NoPermission` (77). */
9
+ class UnauthorizedError extends pristine_error_1.PristineError {
10
+ constructor(message = "Unauthorized", options = {}) {
11
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.Unauthorized, httpStatus: 401, exitCode: exit_code_enum_1.ExitCode.NoPermission, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
12
+ }
13
+ }
14
+ exports.UnauthorizedError = UnauthorizedError;
15
+ //# sourceMappingURL=unauthorized.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unauthorized.error.js","sourceRoot":"","sources":["../../../../src/errors/unauthorized.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D,+EAA+E;AAC/E,MAAa,iBAAkB,SAAQ,8BAAa;IAClD,YAAY,UAAkB,cAAc,EAAE,UAA2B,EAAE;QACzE,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,YAAY,EACtF,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,8CAQC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UsageError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /**
9
+ * CLI-only — bad command-line usage (wrong flag, missing required arg, unknown command).
10
+ * No `httpStatus`. CLI exit `ExitCode.Usage` (64).
11
+ */
12
+ class UsageError extends pristine_error_1.PristineError {
13
+ constructor(message, options = {}) {
14
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.UsageError, exitCode: exit_code_enum_1.ExitCode.Usage, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
15
+ }
16
+ }
17
+ exports.UsageError = UsageError;
18
+ //# sourceMappingURL=usage.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage.error.js","sourceRoot":"","sources":["../../../../src/errors/usage.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D;;;GAGG;AACH,MAAa,UAAW,SAAQ,8BAAa;IAC3C,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,UAAU,EAAE,QAAQ,EAAE,yBAAQ,CAAC,KAAK,EAC5D,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,gCAQC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationError = void 0;
4
+ const exit_code_enum_1 = require("./exit-code.enum");
5
+ const pristine_error_1 = require("./pristine.error");
6
+ const pristine_error_code_enum_1 = require("./pristine-error-code.enum");
7
+ const pristine_error_kind_enum_1 = require("./pristine-error-kind.enum");
8
+ /** 422. Input parsed but failed semantic validation. CLI exit `ExitCode.DataError` (65). */
9
+ class ValidationError extends pristine_error_1.PristineError {
10
+ constructor(message, options = {}) {
11
+ super(message, Object.assign({ code: pristine_error_code_enum_1.PristineErrorCode.ValidationFailed, httpStatus: 422, exitCode: exit_code_enum_1.ExitCode.DataError, kind: pristine_error_kind_enum_1.PristineErrorKind.UserError }, options));
12
+ }
13
+ }
14
+ exports.ValidationError = ValidationError;
15
+ //# sourceMappingURL=validation.error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.error.js","sourceRoot":"","sources":["../../../../src/errors/validation.error.ts"],"names":[],"mappings":";;;AAAA,qDAA0C;AAC1C,qDAA+C;AAC/C,yEAA6D;AAC7D,yEAA6D;AAK7D,4FAA4F;AAC5F,MAAa,eAAgB,SAAQ,8BAAa;IAChD,YAAY,OAAe,EAAE,UAA2B,EAAE;QACxD,KAAK,CAAC,OAAO,kBACX,IAAI,EAAE,4CAAiB,CAAC,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,QAAQ,EAAE,yBAAQ,CAAC,SAAS,EACvF,IAAI,EAAE,4CAAiB,CAAC,SAAS,IAC9B,OAAO,EACV,CAAC;IACL,CAAC;CACF;AARD,0CAQC"}
@@ -56,6 +56,11 @@ let EventContextManager = EventContextManager_1 = class EventContextManager {
56
56
  var _a;
57
57
  return (_a = this.current()) === null || _a === void 0 ? void 0 : _a.container;
58
58
  }
59
+ /** Convenience: the `TracingManager` that owns this event's trace, or `undefined`. */
60
+ tracingManager() {
61
+ var _a;
62
+ return (_a = this.current()) === null || _a === void 0 ? void 0 : _a.tracingManager;
63
+ }
59
64
  /**
60
65
  * Returns a wrapped version of `fn` that restores the current context on call. Use
61
66
  * when you need to spawn work that escapes the natural async chain (e.g. a callback
@@ -91,6 +96,10 @@ let EventContextManager = EventContextManager_1 = class EventContextManager {
91
96
  var _a;
92
97
  return (_a = EventContextManager_1.current()) === null || _a === void 0 ? void 0 : _a.container;
93
98
  }
99
+ static tracingManager() {
100
+ var _a;
101
+ return (_a = EventContextManager_1.current()) === null || _a === void 0 ? void 0 : _a.tracingManager;
102
+ }
94
103
  static bind(fn) {
95
104
  const ctx = EventContextManager_1.current();
96
105
  if (ctx === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"event-context.manager.js","sourceRoot":"","sources":["../../../../src/managers/event-context.manager.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6CAA8C;AAC9C,uCAAyD;AAGzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAU9B,GAAG,CAAI,GAAiB,EAAE,EAAwB;QAChD,OAAO,qBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED;iDAC6C;IAC7C,OAAO;QACL,OAAO,qBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC5C,CAAC;IAED,wEAAwE;IACxE,OAAO;;QACL,OAAO,MAAA,IAAI,CAAC,OAAO,EAAE,0CAAE,OAAO,CAAC;IACjC,CAAC;IAED,wEAAwE;IACxE,OAAO;;QACL,OAAO,MAAA,IAAI,CAAC,OAAO,EAAE,0CAAE,OAAO,CAAC;IACjC,CAAC;IAED,qEAAqE;IACrE,SAAS;;QACP,OAAO,MAAA,IAAI,CAAC,OAAO,EAAE,0CAAE,SAAS,CAAC;IACnC,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,CAAoC,EAAK;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,qBAAmB,CAAC,GAAG,CAAC;QACpC,OAAO,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAM,CAAC;IACpE,CAAC;IAED,kFAAkF;IAClF,+EAA+E;IAC/E,+EAA+E;IAC/E,uBAAuB;IAEvB,MAAM,CAAC,OAAO;QACZ,OAAO,qBAAmB,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,OAAO;;QACZ,OAAO,MAAA,qBAAmB,CAAC,OAAO,EAAE,0CAAE,OAAO,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,OAAO;;QACZ,OAAO,MAAA,qBAAmB,CAAC,OAAO,EAAE,0CAAE,OAAO,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,SAAS;;QACd,OAAO,MAAA,qBAAmB,CAAC,OAAO,EAAE,0CAAE,SAAS,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,IAAI,CAAoC,EAAK;QAClD,MAAM,GAAG,GAAG,qBAAmB,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,qBAAmB,CAAC,GAAG,CAAC;QACpC,OAAO,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAM,CAAC;IACpE,CAAC;;AA7EU,kDAAmB;AACN,uBAAG,GAAG,IAAI,+BAAiB,EAAgB,AAAxC,CAAyC;8BADzD,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;GACA,mBAAmB,CA8E/B"}
1
+ {"version":3,"file":"event-context.manager.js","sourceRoot":"","sources":["../../../../src/managers/event-context.manager.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6CAA8C;AAC9C,uCAAyD;AAIzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEI,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAU9B,GAAG,CAAI,GAAiB,EAAE,EAAwB;QA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O;;QACZ,OAAO,MAAA,qBAAmB,CAAC,OAAO,EAAE,0CAAE,OAAO,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,SAAS;;QACd,OAAO,MAAA,qBAAmB,CAAC,OAAO,EAAE,0CAAE,SAAS,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,cAAc;;QACnB,OAAO,MAAA,qBAAmB,CAAC,OAAO,EAAE,0CAAE,cAAc,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,IAAI,CAAoC,EAAK;QAClD,MAAM,GAAG,GAAG,qBAAmB,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,qBAAmB,CAAC,GAAG,CAAC;QACpC,OAAO,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAM,CAAC;IACpE,CAAC;;AAtFU,kDAAmB;AACN,uBAAG,GAAG,IAAI,+BAAiB,EAAgB,AAAxC,CAAyC;8BADzD,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;GACA,mBAAmB,CAuF/B"}
@@ -16,7 +16,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./request"), exports);
18
18
  __exportStar(require("./response"), exports);
19
- __exportStar(require("./span-event.model"), exports);
19
+ __exportStar(require("./span-lifecycle-owner.interface"), exports);
20
+ __exportStar(require("./span-marker.model"), exports);
20
21
  __exportStar(require("./span.model"), exports);
21
22
  __exportStar(require("./trace.model"), exports);
22
23
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,qDAAmC;AACnC,+CAA6B;AAC7B,gDAA8B"}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/models/models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,mEAAiD;AACjD,sDAAoC;AACpC,+CAA6B;AAC7B,gDAA8B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=span-lifecycle-owner.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"span-lifecycle-owner.interface.js","sourceRoot":"","sources":["../../../../src/models/span-lifecycle-owner.interface.ts"],"names":[],"mappings":""}