@webpieces/core-util 0.3.263 → 0.3.265

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 (67) hide show
  1. package/package.json +1 -1
  2. package/src/http/ContextReader.d.ts +37 -0
  3. package/src/http/ContextReader.js +3 -0
  4. package/src/http/ContextReader.js.map +1 -0
  5. package/src/http/HeaderMethods.d.ts +71 -0
  6. package/src/http/HeaderMethods.js +124 -0
  7. package/src/http/HeaderMethods.js.map +1 -0
  8. package/src/http/HeaderRegistry.d.ts +58 -0
  9. package/src/http/HeaderRegistry.js +121 -0
  10. package/src/http/HeaderRegistry.js.map +1 -0
  11. package/src/http/HeaderTypes.d.ts +29 -0
  12. package/src/http/HeaderTypes.js +33 -0
  13. package/src/http/HeaderTypes.js.map +1 -0
  14. package/src/http/LogApiCall.d.ts +41 -0
  15. package/src/http/LogApiCall.js +83 -0
  16. package/src/http/LogApiCall.js.map +1 -0
  17. package/src/http/PlatformHeader.d.ts +51 -0
  18. package/src/http/PlatformHeader.js +63 -0
  19. package/src/http/PlatformHeader.js.map +1 -0
  20. package/src/http/PlatformHeadersExtension.d.ts +51 -0
  21. package/src/http/PlatformHeadersExtension.js +59 -0
  22. package/src/http/PlatformHeadersExtension.js.map +1 -0
  23. package/src/http/WebpiecesCoreHeaders.d.ts +62 -0
  24. package/src/http/WebpiecesCoreHeaders.js +87 -0
  25. package/src/http/WebpiecesCoreHeaders.js.map +1 -0
  26. package/src/http/datetime.d.ts +284 -0
  27. package/src/http/datetime.js +270 -0
  28. package/src/http/datetime.js.map +1 -0
  29. package/src/http/decorators.d.ts +212 -0
  30. package/src/http/decorators.js +365 -0
  31. package/src/http/decorators.js.map +1 -0
  32. package/src/http/errors.d.ts +118 -0
  33. package/src/http/errors.js +189 -0
  34. package/src/http/errors.js.map +1 -0
  35. package/src/http/recorder/DoNotRecord.d.ts +22 -0
  36. package/src/http/recorder/DoNotRecord.js +39 -0
  37. package/src/http/recorder/DoNotRecord.js.map +1 -0
  38. package/src/http/recorder/RecordSerializer.d.ts +39 -0
  39. package/src/http/recorder/RecordSerializer.js +80 -0
  40. package/src/http/recorder/RecordSerializer.js.map +1 -0
  41. package/src/http/recorder/RecordedEndpoint.d.ts +49 -0
  42. package/src/http/recorder/RecordedEndpoint.js +66 -0
  43. package/src/http/recorder/RecordedEndpoint.js.map +1 -0
  44. package/src/http/recorder/TestCaseRecorder.d.ts +36 -0
  45. package/src/http/recorder/TestCaseRecorder.js +16 -0
  46. package/src/http/recorder/TestCaseRecorder.js.map +1 -0
  47. package/src/http/validators.d.ts +41 -0
  48. package/src/http/validators.js +3 -0
  49. package/src/http/validators.js.map +1 -0
  50. package/src/index.d.ts +22 -0
  51. package/src/index.js +102 -1
  52. package/src/index.js.map +1 -1
  53. package/src/logging/ConsoleLogger.d.ts +25 -0
  54. package/src/logging/ConsoleLogger.js +43 -0
  55. package/src/logging/ConsoleLogger.js.map +1 -0
  56. package/src/logging/ConsoleLoggerFactory.d.ts +13 -0
  57. package/src/logging/ConsoleLoggerFactory.js +24 -0
  58. package/src/logging/ConsoleLoggerFactory.js.map +1 -0
  59. package/src/logging/LogManager.d.ts +36 -0
  60. package/src/logging/LogManager.js +46 -0
  61. package/src/logging/LogManager.js.map +1 -0
  62. package/src/logging/Logger.d.ts +36 -0
  63. package/src/logging/Logger.js +3 -0
  64. package/src/logging/Logger.js.map +1 -0
  65. package/src/logging/LoggerFactory.d.ts +16 -0
  66. package/src/logging/LoggerFactory.js +3 -0
  67. package/src/logging/LoggerFactory.js.map +1 -0
@@ -0,0 +1,118 @@
1
+ /**
2
+ * HTTP Error classes for webpieces-ts.
3
+ * These errors are used throughout the framework for consistent error handling.
4
+ */
5
+ /**
6
+ * ProtocolError - Data class for error response body.
7
+ * This is what gets serialized and sent to the client.
8
+ */
9
+ export declare class ProtocolError {
10
+ message?: string;
11
+ subType?: string;
12
+ field?: string;
13
+ waitSeconds?: number;
14
+ name?: string;
15
+ guiAlertMessage?: string;
16
+ errorCode?: string;
17
+ }
18
+ /**
19
+ * HttpError - Base error class with HTTP status code.
20
+ * All specific HTTP errors extend this class.
21
+ */
22
+ export declare class HttpError extends Error {
23
+ code: number;
24
+ subType?: string;
25
+ readonly httpCause?: Error;
26
+ constructor(message: string, code: number, subType?: string, cause?: Error);
27
+ }
28
+ export declare const ENTITY_NOT_FOUND = "EntityNotFoundError";
29
+ export declare const WRONG_LOGIN_TYPE = "wrongLoginType";
30
+ export declare const WRONG_LOGIN = "wronglogin";
31
+ export declare const NOT_APPROVED = "notapproved";
32
+ export declare const EMAIL_NOT_CONFIRMED = "email_not_confirmed";
33
+ export declare const WRONG_DOMAIN = "wrongdomain";
34
+ export declare const WRONG_COMPANY = "wrongcompany";
35
+ export declare const NO_REG_CODE = "noregcode";
36
+ /**
37
+ * HttpNotFoundError - 404 Not Found.
38
+ */
39
+ export declare class HttpNotFoundError extends HttpError {
40
+ constructor(message: string, cause?: Error);
41
+ }
42
+ /**
43
+ * EndpointNotFoundError - 404 for missing endpoints.
44
+ */
45
+ export declare class EndpointNotFoundError extends HttpNotFoundError {
46
+ constructor(message: string, cause?: Error);
47
+ }
48
+ /**
49
+ * HttpBadRequestError - 400 Bad Request.
50
+ * Used for validation errors with optional field and GUI message.
51
+ */
52
+ export declare class HttpBadRequestError extends HttpError {
53
+ field?: string;
54
+ guiMessage?: string;
55
+ constructor(message: string, field?: string, guiMessage?: string, cause?: Error);
56
+ }
57
+ /**
58
+ * HttpUnauthorizedError - 401 Unauthorized.
59
+ */
60
+ export declare class HttpUnauthorizedError extends HttpError {
61
+ constructor(message: string, subType?: string, cause?: Error);
62
+ }
63
+ /**
64
+ * HttpForbiddenError - 403 Forbidden.
65
+ */
66
+ export declare class HttpForbiddenError extends HttpError {
67
+ constructor(message: string, cause?: Error);
68
+ }
69
+ /**
70
+ * HttpTimeoutError - 408 Request Timeout.
71
+ */
72
+ export declare class HttpTimeoutError extends HttpError {
73
+ constructor(message: string, cause?: Error);
74
+ }
75
+ /**
76
+ * HttpBadGatewayError - 502 Bad Gateway.
77
+ */
78
+ export declare class HttpBadGatewayError extends HttpError {
79
+ constructor(message: string, cause?: Error);
80
+ }
81
+ /**
82
+ * HttpGatewayTimeoutError - 504 Gateway Timeout.
83
+ * SHOULD NOT BE USED SERVER SIDE SINCE ALBs will return 504 and it will not be translated
84
+ * to json body 'ProtocolError'.
85
+ */
86
+ export declare class HttpGatewayTimeoutError extends HttpError {
87
+ constructor(message: string, cause?: Error);
88
+ }
89
+ /**
90
+ * HttpInternalServerError - 500 Internal Server Error.
91
+ */
92
+ export declare class HttpInternalServerError extends HttpError {
93
+ constructor(message: string, cause?: Error);
94
+ }
95
+ /**
96
+ * HttpVendorError - 598 Vendor Error.
97
+ * Custom status code for vendor/external service errors with retry hint.
98
+ */
99
+ export declare class HttpVendorError extends HttpError {
100
+ waitSeconds: number;
101
+ constructor(message: string, waitSeconds?: number, cause?: Error);
102
+ }
103
+ /**
104
+ * HttpUserError - User validation error with 2xx status code.
105
+ *
106
+ * Uses HTTP 266 (non-standard 2xx code) intentionally because:
107
+ * 1. User validation errors are "successful" from server perspective - user just made a mistake
108
+ * 2. Browser DevTools show 4xx/5xx codes in RED, which is confusing for user validation
109
+ * 3. Allows error to propagate up the stack via throw without triggering error monitoring
110
+ * 4. Avoids polluting logs with "errors" that are actually expected user behavior
111
+ *
112
+ * This is a deliberate design pattern - do NOT change to 4xx codes.
113
+ * Examples: "Email already exists", "Invalid password format", "Required field missing"
114
+ */
115
+ export declare class HttpUserError extends HttpError {
116
+ errorCode?: string;
117
+ constructor(message: string, errorCode?: string, cause?: Error);
118
+ }
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ /**
3
+ * HTTP Error classes for webpieces-ts.
4
+ * These errors are used throughout the framework for consistent error handling.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.HttpUserError = exports.HttpVendorError = exports.HttpInternalServerError = exports.HttpGatewayTimeoutError = exports.HttpBadGatewayError = exports.HttpTimeoutError = exports.HttpForbiddenError = exports.HttpUnauthorizedError = exports.HttpBadRequestError = exports.EndpointNotFoundError = exports.HttpNotFoundError = exports.NO_REG_CODE = exports.WRONG_COMPANY = exports.WRONG_DOMAIN = exports.EMAIL_NOT_CONFIRMED = exports.NOT_APPROVED = exports.WRONG_LOGIN = exports.WRONG_LOGIN_TYPE = exports.ENTITY_NOT_FOUND = exports.HttpError = exports.ProtocolError = void 0;
8
+ /**
9
+ * ProtocolError - Data class for error response body.
10
+ * This is what gets serialized and sent to the client.
11
+ */
12
+ class ProtocolError {
13
+ message;
14
+ subType;
15
+ field;
16
+ waitSeconds;
17
+ name;
18
+ guiAlertMessage;
19
+ errorCode;
20
+ }
21
+ exports.ProtocolError = ProtocolError;
22
+ /**
23
+ * HttpError - Base error class with HTTP status code.
24
+ * All specific HTTP errors extend this class.
25
+ */
26
+ class HttpError extends Error {
27
+ code;
28
+ subType;
29
+ httpCause;
30
+ constructor(message, code, subType, cause) {
31
+ super(message);
32
+ this.code = code;
33
+ this.subType = subType;
34
+ this.httpCause = cause;
35
+ }
36
+ }
37
+ exports.HttpError = HttpError;
38
+ // Error subtype constants
39
+ exports.ENTITY_NOT_FOUND = 'EntityNotFoundError';
40
+ exports.WRONG_LOGIN_TYPE = 'wrongLoginType';
41
+ exports.WRONG_LOGIN = 'wronglogin';
42
+ exports.NOT_APPROVED = 'notapproved';
43
+ exports.EMAIL_NOT_CONFIRMED = 'email_not_confirmed';
44
+ exports.WRONG_DOMAIN = 'wrongdomain';
45
+ exports.WRONG_COMPANY = 'wrongcompany';
46
+ exports.NO_REG_CODE = 'noregcode';
47
+ /**
48
+ * HttpNotFoundError - 404 Not Found.
49
+ */
50
+ class HttpNotFoundError extends HttpError {
51
+ constructor(message, cause) {
52
+ super(message, 404, undefined, cause);
53
+ this.name = exports.ENTITY_NOT_FOUND;
54
+ Object.setPrototypeOf(this, new.target.prototype);
55
+ }
56
+ }
57
+ exports.HttpNotFoundError = HttpNotFoundError;
58
+ /**
59
+ * EndpointNotFoundError - 404 for missing endpoints.
60
+ */
61
+ class EndpointNotFoundError extends HttpNotFoundError {
62
+ constructor(message, cause) {
63
+ super(message, cause);
64
+ this.name = 'EndpointNotFoundError';
65
+ Object.setPrototypeOf(this, new.target.prototype);
66
+ }
67
+ }
68
+ exports.EndpointNotFoundError = EndpointNotFoundError;
69
+ /**
70
+ * HttpBadRequestError - 400 Bad Request.
71
+ * Used for validation errors with optional field and GUI message.
72
+ */
73
+ class HttpBadRequestError extends HttpError {
74
+ field;
75
+ guiMessage;
76
+ constructor(message, field, guiMessage, cause) {
77
+ super(message, 400, undefined, cause);
78
+ this.name = 'BadRequest';
79
+ this.field = field;
80
+ this.guiMessage = guiMessage;
81
+ Object.setPrototypeOf(this, new.target.prototype);
82
+ }
83
+ }
84
+ exports.HttpBadRequestError = HttpBadRequestError;
85
+ /**
86
+ * HttpUnauthorizedError - 401 Unauthorized.
87
+ */
88
+ class HttpUnauthorizedError extends HttpError {
89
+ constructor(message, subType, cause) {
90
+ super(message, 401, subType, cause);
91
+ this.name = 'Unauthorized';
92
+ Object.setPrototypeOf(this, new.target.prototype);
93
+ }
94
+ }
95
+ exports.HttpUnauthorizedError = HttpUnauthorizedError;
96
+ /**
97
+ * HttpForbiddenError - 403 Forbidden.
98
+ */
99
+ class HttpForbiddenError extends HttpError {
100
+ constructor(message, cause) {
101
+ super(message, 403, undefined, cause);
102
+ this.name = 'Forbidden';
103
+ Object.setPrototypeOf(this, new.target.prototype);
104
+ }
105
+ }
106
+ exports.HttpForbiddenError = HttpForbiddenError;
107
+ /**
108
+ * HttpTimeoutError - 408 Request Timeout.
109
+ */
110
+ class HttpTimeoutError extends HttpError {
111
+ constructor(message, cause) {
112
+ super(message, 408, undefined, cause);
113
+ this.name = 'Timeout';
114
+ Object.setPrototypeOf(this, new.target.prototype);
115
+ }
116
+ }
117
+ exports.HttpTimeoutError = HttpTimeoutError;
118
+ /**
119
+ * HttpBadGatewayError - 502 Bad Gateway.
120
+ */
121
+ class HttpBadGatewayError extends HttpError {
122
+ constructor(message, cause) {
123
+ super(message, 502, undefined, cause);
124
+ this.name = 'HttpBadGatewayError';
125
+ Object.setPrototypeOf(this, new.target.prototype);
126
+ }
127
+ }
128
+ exports.HttpBadGatewayError = HttpBadGatewayError;
129
+ /**
130
+ * HttpGatewayTimeoutError - 504 Gateway Timeout.
131
+ * SHOULD NOT BE USED SERVER SIDE SINCE ALBs will return 504 and it will not be translated
132
+ * to json body 'ProtocolError'.
133
+ */
134
+ class HttpGatewayTimeoutError extends HttpError {
135
+ constructor(message, cause) {
136
+ super(message, 504, undefined, cause);
137
+ this.name = 'HttpGatewayTimeoutError';
138
+ Object.setPrototypeOf(this, new.target.prototype);
139
+ }
140
+ }
141
+ exports.HttpGatewayTimeoutError = HttpGatewayTimeoutError;
142
+ /**
143
+ * HttpInternalServerError - 500 Internal Server Error.
144
+ */
145
+ class HttpInternalServerError extends HttpError {
146
+ constructor(message, cause) {
147
+ super(message, 500, undefined, cause);
148
+ this.name = 'InternalServerError';
149
+ Object.setPrototypeOf(this, new.target.prototype);
150
+ }
151
+ }
152
+ exports.HttpInternalServerError = HttpInternalServerError;
153
+ /**
154
+ * HttpVendorError - 598 Vendor Error.
155
+ * Custom status code for vendor/external service errors with retry hint.
156
+ */
157
+ class HttpVendorError extends HttpError {
158
+ waitSeconds;
159
+ constructor(message, waitSeconds = 30, cause) {
160
+ super(message, 598, undefined, cause);
161
+ this.waitSeconds = waitSeconds;
162
+ this.name = 'VendorError';
163
+ Object.setPrototypeOf(this, new.target.prototype);
164
+ }
165
+ }
166
+ exports.HttpVendorError = HttpVendorError;
167
+ /**
168
+ * HttpUserError - User validation error with 2xx status code.
169
+ *
170
+ * Uses HTTP 266 (non-standard 2xx code) intentionally because:
171
+ * 1. User validation errors are "successful" from server perspective - user just made a mistake
172
+ * 2. Browser DevTools show 4xx/5xx codes in RED, which is confusing for user validation
173
+ * 3. Allows error to propagate up the stack via throw without triggering error monitoring
174
+ * 4. Avoids polluting logs with "errors" that are actually expected user behavior
175
+ *
176
+ * This is a deliberate design pattern - do NOT change to 4xx codes.
177
+ * Examples: "Email already exists", "Invalid password format", "Required field missing"
178
+ */
179
+ class HttpUserError extends HttpError {
180
+ errorCode;
181
+ constructor(message, errorCode, cause) {
182
+ super(message, 266, 'USER_ERROR', cause);
183
+ this.name = 'UserError';
184
+ this.errorCode = errorCode;
185
+ Object.setPrototypeOf(this, new.target.prototype);
186
+ }
187
+ }
188
+ exports.HttpUserError = HttpUserError;
189
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACH,MAAa,aAAa;IACf,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,KAAK,CAAU;IACf,WAAW,CAAU;IACrB,IAAI,CAAU;IACd,eAAe,CAAU;IACzB,SAAS,CAAU;CAC7B;AARD,sCAQC;AAED;;;GAGG;AACH,MAAa,SAAU,SAAQ,KAAK;IACzB,IAAI,CAAS;IACb,OAAO,CAAU;IACR,SAAS,CAAS;IAElC,YACI,OAAe,EACf,IAAY,EACZ,OAAgB,EAChB,KAAa;QAEb,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;CACJ;AAhBD,8BAgBC;AAED,0BAA0B;AACb,QAAA,gBAAgB,GAAG,qBAAqB,CAAC;AACzC,QAAA,gBAAgB,GAAG,gBAAgB,CAAC;AACpC,QAAA,WAAW,GAAG,YAAY,CAAC;AAC3B,QAAA,YAAY,GAAG,aAAa,CAAC;AAC7B,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,YAAY,GAAG,aAAa,CAA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D,CAAC;CACJ;AATD,sCASC","sourcesContent":["/**\n * HTTP Error classes for webpieces-ts.\n * These errors are used throughout the framework for consistent error handling.\n */\n\n/**\n * ProtocolError - Data class for error response body.\n * This is what gets serialized and sent to the client.\n */\nexport class ProtocolError {\n public message?: string;\n public subType?: string;\n public field?: string;\n public waitSeconds?: number;\n public name?: string;\n public guiAlertMessage?: string;\n public errorCode?: string;\n}\n\n/**\n * HttpError - Base error class with HTTP status code.\n * All specific HTTP errors extend this class.\n */\nexport class HttpError extends Error {\n public code: number;\n public subType?: string;\n public readonly httpCause?: Error;\n\n constructor(\n message: string,\n code: number,\n subType?: string,\n cause?: Error,\n ) {\n super(message);\n this.code = code;\n this.subType = subType;\n this.httpCause = cause;\n }\n}\n\n// Error subtype constants\nexport const ENTITY_NOT_FOUND = 'EntityNotFoundError';\nexport const WRONG_LOGIN_TYPE = 'wrongLoginType';\nexport const WRONG_LOGIN = 'wronglogin';\nexport const NOT_APPROVED = 'notapproved';\nexport const EMAIL_NOT_CONFIRMED = 'email_not_confirmed';\nexport const WRONG_DOMAIN = 'wrongdomain';\nexport const WRONG_COMPANY = 'wrongcompany';\nexport const NO_REG_CODE = 'noregcode';\n\n/**\n * HttpNotFoundError - 404 Not Found.\n */\nexport class HttpNotFoundError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 404, undefined, cause);\n this.name = ENTITY_NOT_FOUND;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * EndpointNotFoundError - 404 for missing endpoints.\n */\nexport class EndpointNotFoundError extends HttpNotFoundError {\n constructor(message: string, cause?: Error) {\n super(message, cause);\n this.name = 'EndpointNotFoundError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpBadRequestError - 400 Bad Request.\n * Used for validation errors with optional field and GUI message.\n */\nexport class HttpBadRequestError extends HttpError {\n public field?: string;\n public guiMessage?: string;\n\n constructor(message: string, field?: string, guiMessage?: string, cause?: Error) {\n super(message, 400, undefined, cause);\n this.name = 'BadRequest';\n this.field = field;\n this.guiMessage = guiMessage;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpUnauthorizedError - 401 Unauthorized.\n */\nexport class HttpUnauthorizedError extends HttpError {\n constructor(message: string, subType?: string, cause?: Error) {\n super(message, 401, subType, cause);\n this.name = 'Unauthorized';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpForbiddenError - 403 Forbidden.\n */\nexport class HttpForbiddenError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 403, undefined, cause);\n this.name = 'Forbidden';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpTimeoutError - 408 Request Timeout.\n */\nexport class HttpTimeoutError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 408, undefined, cause);\n this.name = 'Timeout';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpBadGatewayError - 502 Bad Gateway.\n */\nexport class HttpBadGatewayError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 502, undefined, cause);\n this.name = 'HttpBadGatewayError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpGatewayTimeoutError - 504 Gateway Timeout.\n * SHOULD NOT BE USED SERVER SIDE SINCE ALBs will return 504 and it will not be translated\n * to json body 'ProtocolError'.\n */\nexport class HttpGatewayTimeoutError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 504, undefined, cause);\n this.name = 'HttpGatewayTimeoutError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpInternalServerError - 500 Internal Server Error.\n */\nexport class HttpInternalServerError extends HttpError {\n constructor(message: string, cause?: Error) {\n super(message, 500, undefined, cause);\n this.name = 'InternalServerError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpVendorError - 598 Vendor Error.\n * Custom status code for vendor/external service errors with retry hint.\n */\nexport class HttpVendorError extends HttpError {\n constructor(\n message: string,\n public waitSeconds = 30,\n cause?: Error,\n ) {\n super(message, 598, undefined, cause);\n this.name = 'VendorError';\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * HttpUserError - User validation error with 2xx status code.\n *\n * Uses HTTP 266 (non-standard 2xx code) intentionally because:\n * 1. User validation errors are \"successful\" from server perspective - user just made a mistake\n * 2. Browser DevTools show 4xx/5xx codes in RED, which is confusing for user validation\n * 3. Allows error to propagate up the stack via throw without triggering error monitoring\n * 4. Avoids polluting logs with \"errors\" that are actually expected user behavior\n *\n * This is a deliberate design pattern - do NOT change to 4xx codes.\n * Examples: \"Email already exists\", \"Invalid password format\", \"Required field missing\"\n */\nexport class HttpUserError extends HttpError {\n public errorCode?: string;\n\n constructor(message: string, errorCode?: string, cause?: Error) {\n super(message, 266, 'USER_ERROR', cause);\n this.name = 'UserError';\n this.errorCode = errorCode;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import 'reflect-metadata';
2
+ /**
3
+ * @DoNotRecord - Property decorator marking a DTO field that must be omitted
4
+ * from recorded fixtures (port of Java @DoNotRecord).
5
+ *
6
+ * Use for volatile or sensitive fields (timestamps, generated ids, secrets)
7
+ * that would make recorded assertions flaky or leak data:
8
+ *
9
+ * ```typescript
10
+ * export class FetchValueResponse {
11
+ * value?: string;
12
+ * @DoNotRecord()
13
+ * timestamp?: number; // omitted from fixtures + generated assertions
14
+ * }
15
+ * ```
16
+ */
17
+ export declare function DoNotRecord(): PropertyDecorator;
18
+ /**
19
+ * Field names marked @DoNotRecord on the instance's class (empty for plain
20
+ * objects / interface-typed DTOs, which cannot carry decorators).
21
+ */
22
+ export declare function getDoNotRecordFields(instance: object): string[];
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DoNotRecord = DoNotRecord;
4
+ exports.getDoNotRecordFields = getDoNotRecordFields;
5
+ require("reflect-metadata");
6
+ const DO_NOT_RECORD_KEY = 'webpieces:do-not-record';
7
+ /**
8
+ * @DoNotRecord - Property decorator marking a DTO field that must be omitted
9
+ * from recorded fixtures (port of Java @DoNotRecord).
10
+ *
11
+ * Use for volatile or sensitive fields (timestamps, generated ids, secrets)
12
+ * that would make recorded assertions flaky or leak data:
13
+ *
14
+ * ```typescript
15
+ * export class FetchValueResponse {
16
+ * value?: string;
17
+ * @DoNotRecord()
18
+ * timestamp?: number; // omitted from fixtures + generated assertions
19
+ * }
20
+ * ```
21
+ */
22
+ function DoNotRecord() {
23
+ return (target, propertyKey) => {
24
+ const existing = Reflect.getMetadata(DO_NOT_RECORD_KEY, target.constructor) || [];
25
+ existing.push(String(propertyKey));
26
+ Reflect.defineMetadata(DO_NOT_RECORD_KEY, existing, target.constructor);
27
+ };
28
+ }
29
+ /**
30
+ * Field names marked @DoNotRecord on the instance's class (empty for plain
31
+ * objects / interface-typed DTOs, which cannot carry decorators).
32
+ */
33
+ function getDoNotRecordFields(instance) {
34
+ if (!instance || typeof instance !== 'object') {
35
+ return [];
36
+ }
37
+ return Reflect.getMetadata(DO_NOT_RECORD_KEY, instance.constructor) || [];
38
+ }
39
+ //# sourceMappingURL=DoNotRecord.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DoNotRecord.js","sourceRoot":"","sources":["../../../../../../../packages/core/core-util/src/http/recorder/DoNotRecord.ts"],"names":[],"mappings":";;AAmBA,kCAMC;AAMD,oDAKC;AApCD,4BAA0B;AAE1B,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,WAAW;IACvB,OAAO,CAAC,MAAc,EAAE,WAA4B,EAAQ,EAAE;QAC1D,MAAM,QAAQ,GAAa,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC5F,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;QACnC,OAAO,CAAC,cAAc,CAAC,iBAAiB,EAAE,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5E,CAAC,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,QAAgB;IACjD,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,EAAE,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;AAC9E,CAAC","sourcesContent":["import 'reflect-metadata';\n\nconst DO_NOT_RECORD_KEY = 'webpieces:do-not-record';\n\n/**\n * @DoNotRecord - Property decorator marking a DTO field that must be omitted\n * from recorded fixtures (port of Java @DoNotRecord).\n *\n * Use for volatile or sensitive fields (timestamps, generated ids, secrets)\n * that would make recorded assertions flaky or leak data:\n *\n * ```typescript\n * export class FetchValueResponse {\n * value?: string;\n * @DoNotRecord()\n * timestamp?: number; // omitted from fixtures + generated assertions\n * }\n * ```\n */\nexport function DoNotRecord(): PropertyDecorator {\n return (target: object, propertyKey: string | symbol): void => {\n const existing: string[] = Reflect.getMetadata(DO_NOT_RECORD_KEY, target.constructor) || [];\n existing.push(String(propertyKey));\n Reflect.defineMetadata(DO_NOT_RECORD_KEY, existing, target.constructor);\n };\n}\n\n/**\n * Field names marked @DoNotRecord on the instance's class (empty for plain\n * objects / interface-typed DTOs, which cannot carry decorators).\n */\nexport function getDoNotRecordFields(instance: object): string[] {\n if (!instance || typeof instance !== 'object') {\n return [];\n }\n return Reflect.getMetadata(DO_NOT_RECORD_KEY, instance.constructor) || [];\n}\n"]}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * RecordSerializer - JSON (de)serialization for recorded fixtures.
3
+ *
4
+ * Handles the cases plain JSON.stringify gets wrong for test fixtures:
5
+ * - Map values -> { __type: 'Map', entries: [...] } (revived back to Map)
6
+ * - Error values -> { __type: 'Error', name, message }
7
+ * - Fields marked @DoNotRecord on class DTOs are omitted
8
+ * - Dates serialize to ISO strings naturally (Date.prototype.toJSON)
9
+ *
10
+ * Fixtures stay diffable, human-editable JSON - the stable artifact that a
11
+ * generated spec (or an AI writing a spec) consumes.
12
+ */
13
+ export declare class RecordSerializer {
14
+ /**
15
+ * Serialize a recorded value/test case to pretty-printed JSON.
16
+ */
17
+ serialize(value: unknown): string;
18
+ /**
19
+ * Parse fixture JSON back, reviving Map markers.
20
+ */
21
+ deserialize<T>(json: string): T;
22
+ }
23
+ /**
24
+ * Wire format for Map values inside fixtures.
25
+ */
26
+ export declare class SerializedMap {
27
+ readonly entries: [unknown, unknown][];
28
+ readonly __type = "Map";
29
+ constructor(entries: [unknown, unknown][]);
30
+ }
31
+ /**
32
+ * Wire format for Error values inside fixtures.
33
+ */
34
+ export declare class SerializedError {
35
+ readonly name: string;
36
+ readonly message: string;
37
+ readonly __type = "Error";
38
+ constructor(name: string, message: string);
39
+ }
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SerializedError = exports.SerializedMap = exports.RecordSerializer = void 0;
4
+ const DoNotRecord_1 = require("./DoNotRecord");
5
+ /**
6
+ * RecordSerializer - JSON (de)serialization for recorded fixtures.
7
+ *
8
+ * Handles the cases plain JSON.stringify gets wrong for test fixtures:
9
+ * - Map values -> { __type: 'Map', entries: [...] } (revived back to Map)
10
+ * - Error values -> { __type: 'Error', name, message }
11
+ * - Fields marked @DoNotRecord on class DTOs are omitted
12
+ * - Dates serialize to ISO strings naturally (Date.prototype.toJSON)
13
+ *
14
+ * Fixtures stay diffable, human-editable JSON - the stable artifact that a
15
+ * generated spec (or an AI writing a spec) consumes.
16
+ */
17
+ class RecordSerializer {
18
+ /**
19
+ * Serialize a recorded value/test case to pretty-printed JSON.
20
+ */
21
+ // webpieces-disable no-any-unknown -- serializer accepts arbitrary recorded DTOs
22
+ serialize(value) {
23
+ // webpieces-disable no-any-unknown -- JSON replacer is inherently untyped
24
+ return JSON.stringify(value, function (key, val) {
25
+ // `this` is the object containing `key` - consult @DoNotRecord on it
26
+ if (key !== '' && this && typeof this === 'object' && !Array.isArray(this)) {
27
+ const skipped = (0, DoNotRecord_1.getDoNotRecordFields)(this);
28
+ if (skipped.includes(key)) {
29
+ return undefined;
30
+ }
31
+ }
32
+ if (val instanceof Map) {
33
+ return new SerializedMap(Array.from(val.entries()));
34
+ }
35
+ if (val instanceof Error) {
36
+ return new SerializedError(val.name, val.message);
37
+ }
38
+ return val;
39
+ }, 2);
40
+ }
41
+ /**
42
+ * Parse fixture JSON back, reviving Map markers.
43
+ */
44
+ deserialize(json) {
45
+ // webpieces-disable no-any-unknown -- JSON reviver is inherently untyped
46
+ return JSON.parse(json, (key, val) => {
47
+ if (val && typeof val === 'object' && val.__type === 'Map') {
48
+ return new Map(val.entries);
49
+ }
50
+ return val;
51
+ });
52
+ }
53
+ }
54
+ exports.RecordSerializer = RecordSerializer;
55
+ /**
56
+ * Wire format for Map values inside fixtures.
57
+ */
58
+ class SerializedMap {
59
+ entries;
60
+ __type = 'Map';
61
+ // webpieces-disable no-any-unknown -- Map entries carry arbitrary recorded values
62
+ constructor(entries) {
63
+ this.entries = entries;
64
+ }
65
+ }
66
+ exports.SerializedMap = SerializedMap;
67
+ /**
68
+ * Wire format for Error values inside fixtures.
69
+ */
70
+ class SerializedError {
71
+ name;
72
+ message;
73
+ __type = 'Error';
74
+ constructor(name, message) {
75
+ this.name = name;
76
+ this.message = message;
77
+ }
78
+ }
79
+ exports.SerializedError = SerializedError;
80
+ //# sourceMappingURL=RecordSerializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordSerializer.js","sourceRoot":"","sources":["../../../../../../../packages/core/core-util/src/http/recorder/RecordSerializer.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD;;;;;;;;;;;GAWG;AACH,MAAa,gBAAgB;IACzB;;OAEG;IACH,iFAAiF;IAC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G,KAAK,CAAC;IACxB,kFAAkF;IAClF,YAA4B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;IAAG,CAAC;CAChE;AAJD,sCAIC;AAED;;GAEG;AACH,MAAa,eAAe;IAGJ;IACA;IAHX,MAAM,GAAG,OAAO,CAAC;IAC1B,YACoB,IAAY,EACZ,OAAe;QADf,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;IAChC,CAAC;CACP;AAND,0CAMC","sourcesContent":["import { getDoNotRecordFields } from './DoNotRecord';\n\n/**\n * RecordSerializer - JSON (de)serialization for recorded fixtures.\n *\n * Handles the cases plain JSON.stringify gets wrong for test fixtures:\n * - Map values -> { __type: 'Map', entries: [...] } (revived back to Map)\n * - Error values -> { __type: 'Error', name, message }\n * - Fields marked @DoNotRecord on class DTOs are omitted\n * - Dates serialize to ISO strings naturally (Date.prototype.toJSON)\n *\n * Fixtures stay diffable, human-editable JSON - the stable artifact that a\n * generated spec (or an AI writing a spec) consumes.\n */\nexport class RecordSerializer {\n /**\n * Serialize a recorded value/test case to pretty-printed JSON.\n */\n // webpieces-disable no-any-unknown -- serializer accepts arbitrary recorded DTOs\n serialize(value: unknown): string {\n // webpieces-disable no-any-unknown -- JSON replacer is inherently untyped\n return JSON.stringify(value, function (this: any, key: string, val: unknown): unknown {\n // `this` is the object containing `key` - consult @DoNotRecord on it\n if (key !== '' && this && typeof this === 'object' && !Array.isArray(this)) {\n const skipped = getDoNotRecordFields(this);\n if (skipped.includes(key)) {\n return undefined;\n }\n }\n if (val instanceof Map) {\n return new SerializedMap(Array.from(val.entries()));\n }\n if (val instanceof Error) {\n return new SerializedError(val.name, val.message);\n }\n return val;\n }, 2);\n }\n\n /**\n * Parse fixture JSON back, reviving Map markers.\n */\n deserialize<T>(json: string): T {\n // webpieces-disable no-any-unknown -- JSON reviver is inherently untyped\n return JSON.parse(json, (key: string, val: unknown): unknown => {\n if (val && typeof val === 'object' && (val as SerializedMap).__type === 'Map') {\n return new Map((val as SerializedMap).entries);\n }\n return val;\n }) as T;\n }\n}\n\n/**\n * Wire format for Map values inside fixtures.\n */\nexport class SerializedMap {\n readonly __type = 'Map';\n // webpieces-disable no-any-unknown -- Map entries carry arbitrary recorded values\n constructor(public readonly entries: [unknown, unknown][]) {}\n}\n\n/**\n * Wire format for Error values inside fixtures.\n */\nexport class SerializedError {\n readonly __type = 'Error';\n constructor(\n public readonly name: string,\n public readonly message: string,\n ) {}\n}\n"]}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * RecordedError - Serializable capture of a thrown error.
3
+ * Per CLAUDE.md: data-only structure = class.
4
+ */
5
+ export declare class RecordedError {
6
+ readonly name: string;
7
+ readonly message: string;
8
+ constructor(name: string, message: string);
9
+ }
10
+ /**
11
+ * RecordedEndpoint - One captured API invocation (port of Java EndpointInfo).
12
+ *
13
+ * Captures the server endpoint that was hit OR a downstream call made while
14
+ * serving it (outbound HTTP client call or in-process recordable() api).
15
+ */
16
+ export declare class RecordedEndpoint {
17
+ /** Api class name, e.g. 'SaveApi' or 'RemoteApi'. */
18
+ readonly apiName: string;
19
+ /** Method invoked, e.g. 'save'. */
20
+ readonly methodName: string;
21
+ /** Arguments passed (the request DTO(s)). */
22
+ readonly args: unknown[];
23
+ /** Masked snapshot of the magic context headers at call time. */
24
+ readonly ctxSnapshot?: Record<string, string> | undefined;
25
+ /** Response returned on success (JSON-serializable DTO). */
26
+ successResponse?: unknown;
27
+ /** Error thrown on failure. */
28
+ failureResponse?: RecordedError;
29
+ constructor(
30
+ /** Api class name, e.g. 'SaveApi' or 'RemoteApi'. */
31
+ apiName: string,
32
+ /** Method invoked, e.g. 'save'. */
33
+ methodName: string,
34
+ /** Arguments passed (the request DTO(s)). */
35
+ args: unknown[],
36
+ /** Masked snapshot of the magic context headers at call time. */
37
+ ctxSnapshot?: Record<string, string> | undefined);
38
+ }
39
+ /**
40
+ * RecordedTestCase - The full capture for one inbound request: the server
41
+ * endpoint plus every downstream call it triggered (which become the mocks
42
+ * in the generated test).
43
+ */
44
+ export declare class RecordedTestCase {
45
+ readonly serverEndpoint: RecordedEndpoint;
46
+ readonly downstreamCalls: RecordedEndpoint[];
47
+ readonly recordedAt: string;
48
+ constructor(serverEndpoint: RecordedEndpoint, downstreamCalls: RecordedEndpoint[], recordedAt: string);
49
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordedTestCase = exports.RecordedEndpoint = exports.RecordedError = void 0;
4
+ /**
5
+ * RecordedError - Serializable capture of a thrown error.
6
+ * Per CLAUDE.md: data-only structure = class.
7
+ */
8
+ class RecordedError {
9
+ name;
10
+ message;
11
+ constructor(name, message) {
12
+ this.name = name;
13
+ this.message = message;
14
+ }
15
+ }
16
+ exports.RecordedError = RecordedError;
17
+ /**
18
+ * RecordedEndpoint - One captured API invocation (port of Java EndpointInfo).
19
+ *
20
+ * Captures the server endpoint that was hit OR a downstream call made while
21
+ * serving it (outbound HTTP client call or in-process recordable() api).
22
+ */
23
+ class RecordedEndpoint {
24
+ apiName;
25
+ methodName;
26
+ args;
27
+ ctxSnapshot;
28
+ /** Response returned on success (JSON-serializable DTO). */
29
+ // webpieces-disable no-any-unknown -- recorded DTOs are api-specific, erased here
30
+ successResponse;
31
+ /** Error thrown on failure. */
32
+ failureResponse;
33
+ constructor(
34
+ /** Api class name, e.g. 'SaveApi' or 'RemoteApi'. */
35
+ apiName,
36
+ /** Method invoked, e.g. 'save'. */
37
+ methodName,
38
+ /** Arguments passed (the request DTO(s)). */
39
+ // webpieces-disable no-any-unknown -- recorded DTOs are api-specific, erased here
40
+ args,
41
+ /** Masked snapshot of the magic context headers at call time. */
42
+ ctxSnapshot) {
43
+ this.apiName = apiName;
44
+ this.methodName = methodName;
45
+ this.args = args;
46
+ this.ctxSnapshot = ctxSnapshot;
47
+ }
48
+ }
49
+ exports.RecordedEndpoint = RecordedEndpoint;
50
+ /**
51
+ * RecordedTestCase - The full capture for one inbound request: the server
52
+ * endpoint plus every downstream call it triggered (which become the mocks
53
+ * in the generated test).
54
+ */
55
+ class RecordedTestCase {
56
+ serverEndpoint;
57
+ downstreamCalls;
58
+ recordedAt;
59
+ constructor(serverEndpoint, downstreamCalls, recordedAt) {
60
+ this.serverEndpoint = serverEndpoint;
61
+ this.downstreamCalls = downstreamCalls;
62
+ this.recordedAt = recordedAt;
63
+ }
64
+ }
65
+ exports.RecordedTestCase = RecordedTestCase;
66
+ //# sourceMappingURL=RecordedEndpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecordedEndpoint.js","sourceRoot":"","sources":["../../../../../../../packages/core/core-util/src/http/recorder/RecordedEndpoint.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,MAAa,aAAa;IAEF;IACA;IAFpB,YACoB,IAAY,EACZ,OAAe;QADf,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAQ;IAChC,CAAC;CACP;AALD,sCAKC;AAED;;;;;GAKG;AACH,MAAa,gBAAgB;IAUL;IAEA;IAGA;IAEA;IAhBpB,4DAA4D;IAC5D,kFAAkF;IAC3E,eAAe,CAAW;IAEjC,+BAA+B;IACxB,eAAe,CAAiB;IAEvC;IACI,qDAAqD;IACrC,OAAe;IAC/B,mCAAmC;IACnB,UAAkB;IAClC,6CAA6C;IAC7C,kFAAkF;IAClE,IAAe;IAC/B,iEAAiE;IACjD,WAAoC;QAPpC,YAAO,GAAP,OAAO,CAAQ;QAEf,eAAU,GAAV,UAAU,CAAQ;QAGlB,SAAI,GAAJ,IAAI,CAAW;QAEf,gBAAW,GAAX,WAAW,CAAyB;IACrD,CAAC;CACP;AAnBD,4CAmBC;AAED;;;;GAIG;AACH,MAAa,gBAAgB;IAEL;IACA;IACA;IAHpB,YACoB,cAAgC,EAChC,eAAmC,EACnC,UAAkB;QAFlB,mBAAc,GAAd,cAAc,CAAkB;QAChC,oBAAe,GAAf,eAAe,CAAoB;QACnC,eAAU,GAAV,UAAU,CAAQ;IACnC,CAAC;CACP;AAND,4CAMC","sourcesContent":["/**\n * RecordedError - Serializable capture of a thrown error.\n * Per CLAUDE.md: data-only structure = class.\n */\nexport class RecordedError {\n constructor(\n public readonly name: string,\n public readonly message: string,\n ) {}\n}\n\n/**\n * RecordedEndpoint - One captured API invocation (port of Java EndpointInfo).\n *\n * Captures the server endpoint that was hit OR a downstream call made while\n * serving it (outbound HTTP client call or in-process recordable() api).\n */\nexport class RecordedEndpoint {\n /** Response returned on success (JSON-serializable DTO). */\n // webpieces-disable no-any-unknown -- recorded DTOs are api-specific, erased here\n public successResponse?: unknown;\n\n /** Error thrown on failure. */\n public failureResponse?: RecordedError;\n\n constructor(\n /** Api class name, e.g. 'SaveApi' or 'RemoteApi'. */\n public readonly apiName: string,\n /** Method invoked, e.g. 'save'. */\n public readonly methodName: string,\n /** Arguments passed (the request DTO(s)). */\n // webpieces-disable no-any-unknown -- recorded DTOs are api-specific, erased here\n public readonly args: unknown[],\n /** Masked snapshot of the magic context headers at call time. */\n public readonly ctxSnapshot?: Record<string, string>,\n ) {}\n}\n\n/**\n * RecordedTestCase - The full capture for one inbound request: the server\n * endpoint plus every downstream call it triggered (which become the mocks\n * in the generated test).\n */\nexport class RecordedTestCase {\n constructor(\n public readonly serverEndpoint: RecordedEndpoint,\n public readonly downstreamCalls: RecordedEndpoint[],\n public readonly recordedAt: string,\n ) {}\n}\n"]}