@webpieces/core-util 0.4.894 → 0.4.896
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.
- package/package.json +1 -1
- package/src/errors/ApiError.d.ts +27 -1
- package/src/errors/ApiError.js +37 -1
- package/src/errors/ApiError.js.map +1 -1
- package/src/errors/ApiErrorCodec.js +5 -0
- package/src/errors/ApiErrorCodec.js.map +1 -1
- package/src/errors/ReceivedApiErrorRule.d.ts +6 -2
- package/src/errors/ReceivedApiErrorRule.js +6 -2
- package/src/errors/ReceivedApiErrorRule.js.map +1 -1
- package/src/errors/index.d.ts +1 -1
- package/src/errors/index.js +2 -1
- package/src/errors/index.js.map +1 -1
- package/src/http/ApiCallInfo.d.ts +3 -3
- package/src/http/ApiCallInfo.js +1 -1
- package/src/http/ApiCallInfo.js.map +1 -1
- package/src/http/ApiErrorHttpStatus.js +3 -0
- package/src/http/ApiErrorHttpStatus.js.map +1 -1
- package/src/http/CallRegistry.d.ts +31 -8
- package/src/http/CallRegistry.js +93 -7
- package/src/http/CallRegistry.js.map +1 -1
- package/src/http/CallRegistryCompileAssertions.js +9 -0
- package/src/http/CallRegistryCompileAssertions.js.map +1 -1
- package/src/http/ClientRegistry.d.ts +25 -23
- package/src/http/ClientRegistry.js +33 -31
- package/src/http/ClientRegistry.js.map +1 -1
- package/src/http/ErrorClassifier.d.ts +64 -0
- package/src/http/ErrorClassifier.js +39 -0
- package/src/http/ErrorClassifier.js.map +1 -0
- package/src/http/LogApiCall.d.ts +2 -18
- package/src/http/LogApiCall.js +7 -24
- package/src/http/LogApiCall.js.map +1 -1
- package/src/http/RetryStrategy.d.ts +32 -0
- package/src/http/RetryStrategy.js +96 -0
- package/src/http/RetryStrategy.js.map +1 -0
- package/src/http/TransportDefault.d.ts +25 -0
- package/src/http/TransportDefault.js +31 -0
- package/src/http/TransportDefault.js.map +1 -0
- package/src/http/WebpiecesDefaultErrorClassifier.d.ts +42 -0
- package/src/http/WebpiecesDefaultErrorClassifier.js +87 -0
- package/src/http/WebpiecesDefaultErrorClassifier.js.map +1 -0
- package/src/index.d.ts +7 -4
- package/src/index.js +13 -7
- package/src/index.js.map +1 -1
- package/src/http/FailureClassifier.d.ts +0 -48
- package/src/http/FailureClassifier.js +0 -19
- package/src/http/FailureClassifier.js.map +0 -1
- package/src/http/WebpiecesDefaultFailureClassifier.d.ts +0 -40
- package/src/http/WebpiecesDefaultFailureClassifier.js +0 -67
- package/src/http/WebpiecesDefaultFailureClassifier.js.map +0 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEBPIECES_DEFAULT_ERROR_CLASSIFIER = exports.WebpiecesDefaultErrorClassifier = void 0;
|
|
4
|
+
const ApiError_1 = require("../errors/ApiError");
|
|
5
|
+
const OAuthProtocolError_1 = require("../oauth/OAuthProtocolError");
|
|
6
|
+
const ErrorClassifier_1 = require("./ErrorClassifier");
|
|
7
|
+
/**
|
|
8
|
+
* The webpieces built-in {@link ErrorClassifier} — the terminal tier, used when no per-apiClass
|
|
9
|
+
* classifier and no app default claims an error. Two tables, one per question:
|
|
10
|
+
*
|
|
11
|
+
* # 1. EXPECTED or not — "are things WORKING?"
|
|
12
|
+
*
|
|
13
|
+
* NOT "was it an HTTP 4xx vs 5xx" — the two differ (see 408). Classification is by portable Error
|
|
14
|
+
* TYPE, never by transport: this runs over in-process calls, queue handlers and HTTP through one code
|
|
15
|
+
* path and only ever sees a thrown Error.
|
|
16
|
+
*
|
|
17
|
+
* - ApiEndUserError (266): ALWAYS expected, server OR client — an expected "user made a mistake".
|
|
18
|
+
* - SERVER — a healthy server correctly rejecting a CLIENT'S mistake is metrics NOISE, not a failure:
|
|
19
|
+
* ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403), ApiNotFoundError
|
|
20
|
+
* (404), ApiConflictError (409), ApiPreconditionFailedError (412), ApiUnsupportedMediaTypeError
|
|
21
|
+
* (415), ApiUnprocessableError (422), an ApiCodedError whose `isCallerError()` is true (below 500,
|
|
22
|
+
* except 408/429), and an OAuthProtocolError below 500 (a refused grant is the OAuth protocol
|
|
23
|
+
* working, #1176). ApiRequestTimeoutError (408) is deliberately absent: the client may NEVER have
|
|
24
|
+
* seen the response.
|
|
25
|
+
* - CLIENT: receiving ANY error except 266 means the outbound call failed — never expected here.
|
|
26
|
+
* (An external client whose 404 means "miss" registers its own classifier for that.)
|
|
27
|
+
*
|
|
28
|
+
* # 2. TRANSIENT or FAILURE — "may repeating it work?"
|
|
29
|
+
*
|
|
30
|
+
* The kind table that used to live inside the MCP renderer:
|
|
31
|
+
*
|
|
32
|
+
* - TRANSIENT: request-timeout (408), dependency-timeout (504, incl. a client's own
|
|
33
|
+
* `ApiCallTimeoutError`), bad-gateway (502 proxy), unavailable (503), rate-limited (429),
|
|
34
|
+
* dependency-backoff, connection, and an ApiCodedError of 408/429.
|
|
35
|
+
* - FAILURE: everything else — a received 4xx (our bug), implementation, not-implemented (501), a
|
|
36
|
+
* generic dependency defect, and {@link ApiRetriesExhaustedError}, which is checked FIRST: it is an
|
|
37
|
+
* `ApiDependencyError`, and classifying it transient would let every layer above retry again.
|
|
38
|
+
*/
|
|
39
|
+
class WebpiecesDefaultErrorClassifier {
|
|
40
|
+
/** Terminal tier — NEVER returns undefined. */
|
|
41
|
+
classify(error, methodInfo) {
|
|
42
|
+
if (this.isExpected(error, methodInfo)) {
|
|
43
|
+
return ErrorClassifier_1.CallOutcome.EXPECTED;
|
|
44
|
+
}
|
|
45
|
+
return this.isTransient(error) ? ErrorClassifier_1.CallOutcome.TRANSIENT_FAILURE : ErrorClassifier_1.CallOutcome.FAILURE;
|
|
46
|
+
}
|
|
47
|
+
isExpected(error, methodInfo) {
|
|
48
|
+
// 266 is the one error that is never a failure, on either side.
|
|
49
|
+
if (error instanceof ApiError_1.ApiEndUserError) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
// A client that RECEIVED any other error made a failed call.
|
|
53
|
+
if (methodInfo.side !== 'server') {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return (error instanceof ApiError_1.ApiBadRequestError ||
|
|
57
|
+
error instanceof ApiError_1.ApiUnauthorizedError ||
|
|
58
|
+
error instanceof ApiError_1.ApiForbiddenError ||
|
|
59
|
+
error instanceof ApiError_1.ApiNotFoundError ||
|
|
60
|
+
error instanceof ApiError_1.ApiConflictError ||
|
|
61
|
+
error instanceof ApiError_1.ApiUnprocessableError ||
|
|
62
|
+
error instanceof ApiError_1.ApiPreconditionFailedError ||
|
|
63
|
+
error instanceof ApiError_1.ApiUnsupportedMediaTypeError ||
|
|
64
|
+
(error instanceof ApiError_1.ApiCodedError && error.isCallerError()) ||
|
|
65
|
+
(error instanceof OAuthProtocolError_1.OAuthProtocolError && error.isCallerError()));
|
|
66
|
+
}
|
|
67
|
+
isTransient(error) {
|
|
68
|
+
// FIRST: a lower layer already retried. Never transient, or every layer above retries too.
|
|
69
|
+
if (error instanceof ApiError_1.ApiRetriesExhaustedError) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
if (error instanceof ApiError_1.ApiCodedError) {
|
|
73
|
+
return error.statusCode === 408 || error.statusCode === 429;
|
|
74
|
+
}
|
|
75
|
+
return (error instanceof ApiError_1.ApiRequestTimeoutError ||
|
|
76
|
+
error instanceof ApiError_1.ApiDependencyTimeoutError ||
|
|
77
|
+
error instanceof ApiError_1.ApiBadGatewayError ||
|
|
78
|
+
error instanceof ApiError_1.ApiUnavailableError ||
|
|
79
|
+
error instanceof ApiError_1.ApiRateLimitedError ||
|
|
80
|
+
error instanceof ApiError_1.ApiDependencyBackoffError ||
|
|
81
|
+
error instanceof ApiError_1.ApiConnectionError);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.WebpiecesDefaultErrorClassifier = WebpiecesDefaultErrorClassifier;
|
|
85
|
+
/** Process-wide built-in instance — stateless, so one shared instance is enough. */
|
|
86
|
+
exports.WEBPIECES_DEFAULT_ERROR_CLASSIFIER = new WebpiecesDefaultErrorClassifier();
|
|
87
|
+
//# sourceMappingURL=WebpiecesDefaultErrorClassifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebpiecesDefaultErrorClassifier.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/WebpiecesDefaultErrorClassifier.ts"],"names":[],"mappings":";;;AAAA,iDAmB4B;AAC5B,oEAAiE;AAEjE,uDAAiE;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAa,+BAA+B;IACxC,+CAA+C;IAC/C,QAAQ,CAAC,KAAY,EAAE,UAAyB;QAC5C,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,CAAC;YACrC,OAAO,6BAAW,CAAC,QAAQ,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,6BAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,6BAAW,CAAC,OAAO,CAAC;IACzF,CAAC;IAEO,UAAU,CAAC,KAAY,EAAE,UAAyB;QACtD,gEAAgE;QAChE,IAAI,KAAK,YAAY,0BAAe,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,6DAA6D;QAC7D,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,OAAO,CACH,KAAK,YAAY,6BAAkB;YACnC,KAAK,YAAY,+BAAoB;YACrC,KAAK,YAAY,4BAAiB;YAClC,KAAK,YAAY,2BAAgB;YACjC,KAAK,YAAY,2BAAgB;YACjC,KAAK,YAAY,gCAAqB;YACtC,KAAK,YAAY,qCAA0B;YAC3C,KAAK,YAAY,uCAA4B;YAC7C,CAAC,KAAK,YAAY,wBAAa,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACzD,CAAC,KAAK,YAAY,uCAAkB,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC,CACjE,CAAC;IACN,CAAC;IAEO,WAAW,CAAC,KAAY;QAC5B,2FAA2F;QAC3F,IAAI,KAAK,YAAY,mCAAwB,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,IAAI,KAAK,YAAY,wBAAa,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC,UAAU,KAAK,GAAG,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,CAAC;QAChE,CAAC;QACD,OAAO,CACH,KAAK,YAAY,iCAAsB;YACvC,KAAK,YAAY,oCAAyB;YAC1C,KAAK,YAAY,6BAAkB;YACnC,KAAK,YAAY,8BAAmB;YACpC,KAAK,YAAY,8BAAmB;YACpC,KAAK,YAAY,oCAAyB;YAC1C,KAAK,YAAY,6BAAkB,CACtC,CAAC;IACN,CAAC;CACJ;AAlDD,0EAkDC;AAED,oFAAoF;AACvE,QAAA,kCAAkC,GAAG,IAAI,+BAA+B,EAAE,CAAC","sourcesContent":["import {\n ApiBadRequestError,\n ApiUnauthorizedError,\n ApiForbiddenError,\n ApiNotFoundError,\n ApiEndUserError,\n ApiConflictError,\n ApiUnprocessableError,\n ApiPreconditionFailedError,\n ApiUnsupportedMediaTypeError,\n ApiCodedError,\n ApiRetriesExhaustedError,\n ApiRequestTimeoutError,\n ApiDependencyTimeoutError,\n ApiBadGatewayError,\n ApiUnavailableError,\n ApiRateLimitedError,\n ApiDependencyBackoffError,\n ApiConnectionError,\n} from '../errors/ApiError';\nimport { OAuthProtocolError } from '../oauth/OAuthProtocolError';\nimport { ApiMethodInfo } from './ApiMethodInfo';\nimport { CallOutcome, ErrorClassifier } from './ErrorClassifier';\n\n/**\n * The webpieces built-in {@link ErrorClassifier} — the terminal tier, used when no per-apiClass\n * classifier and no app default claims an error. Two tables, one per question:\n *\n * # 1. EXPECTED or not — \"are things WORKING?\"\n *\n * NOT \"was it an HTTP 4xx vs 5xx\" — the two differ (see 408). Classification is by portable Error\n * TYPE, never by transport: this runs over in-process calls, queue handlers and HTTP through one code\n * path and only ever sees a thrown Error.\n *\n * - ApiEndUserError (266): ALWAYS expected, server OR client — an expected \"user made a mistake\".\n * - SERVER — a healthy server correctly rejecting a CLIENT'S mistake is metrics NOISE, not a failure:\n * ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403), ApiNotFoundError\n * (404), ApiConflictError (409), ApiPreconditionFailedError (412), ApiUnsupportedMediaTypeError\n * (415), ApiUnprocessableError (422), an ApiCodedError whose `isCallerError()` is true (below 500,\n * except 408/429), and an OAuthProtocolError below 500 (a refused grant is the OAuth protocol\n * working, #1176). ApiRequestTimeoutError (408) is deliberately absent: the client may NEVER have\n * seen the response.\n * - CLIENT: receiving ANY error except 266 means the outbound call failed — never expected here.\n * (An external client whose 404 means \"miss\" registers its own classifier for that.)\n *\n * # 2. TRANSIENT or FAILURE — \"may repeating it work?\"\n *\n * The kind table that used to live inside the MCP renderer:\n *\n * - TRANSIENT: request-timeout (408), dependency-timeout (504, incl. a client's own\n * `ApiCallTimeoutError`), bad-gateway (502 proxy), unavailable (503), rate-limited (429),\n * dependency-backoff, connection, and an ApiCodedError of 408/429.\n * - FAILURE: everything else — a received 4xx (our bug), implementation, not-implemented (501), a\n * generic dependency defect, and {@link ApiRetriesExhaustedError}, which is checked FIRST: it is an\n * `ApiDependencyError`, and classifying it transient would let every layer above retry again.\n */\nexport class WebpiecesDefaultErrorClassifier implements ErrorClassifier {\n /** Terminal tier — NEVER returns undefined. */\n classify(error: Error, methodInfo: ApiMethodInfo): CallOutcome {\n if (this.isExpected(error, methodInfo)) {\n return CallOutcome.EXPECTED;\n }\n return this.isTransient(error) ? CallOutcome.TRANSIENT_FAILURE : CallOutcome.FAILURE;\n }\n\n private isExpected(error: Error, methodInfo: ApiMethodInfo): boolean {\n // 266 is the one error that is never a failure, on either side.\n if (error instanceof ApiEndUserError) {\n return true;\n }\n // A client that RECEIVED any other error made a failed call.\n if (methodInfo.side !== 'server') {\n return false;\n }\n return (\n error instanceof ApiBadRequestError ||\n error instanceof ApiUnauthorizedError ||\n error instanceof ApiForbiddenError ||\n error instanceof ApiNotFoundError ||\n error instanceof ApiConflictError ||\n error instanceof ApiUnprocessableError ||\n error instanceof ApiPreconditionFailedError ||\n error instanceof ApiUnsupportedMediaTypeError ||\n (error instanceof ApiCodedError && error.isCallerError()) ||\n (error instanceof OAuthProtocolError && error.isCallerError())\n );\n }\n\n private isTransient(error: Error): boolean {\n // FIRST: a lower layer already retried. Never transient, or every layer above retries too.\n if (error instanceof ApiRetriesExhaustedError) {\n return false;\n }\n if (error instanceof ApiCodedError) {\n return error.statusCode === 408 || error.statusCode === 429;\n }\n return (\n error instanceof ApiRequestTimeoutError ||\n error instanceof ApiDependencyTimeoutError ||\n error instanceof ApiBadGatewayError ||\n error instanceof ApiUnavailableError ||\n error instanceof ApiRateLimitedError ||\n error instanceof ApiDependencyBackoffError ||\n error instanceof ApiConnectionError\n );\n }\n}\n\n/** Process-wide built-in instance — stateless, so one shared instance is enough. */\nexport const WEBPIECES_DEFAULT_ERROR_CLASSIFIER = new WebpiecesDefaultErrorClassifier();\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -59,6 +59,9 @@ export { InstantDto, DateDto, TimeDto, DateTimeDto, InstantUtil, DateUtil, TimeU
|
|
|
59
59
|
export { HeaderRegistry } from './http/HeaderRegistry';
|
|
60
60
|
export { ClientRegistry } from './http/ClientRegistry';
|
|
61
61
|
export { CallRegistry } from './http/CallRegistry';
|
|
62
|
+
export type { CallScope } from './http/CallRegistry';
|
|
63
|
+
export { TransportDefault } from './http/TransportDefault';
|
|
64
|
+
export { RetryStrategy } from './http/RetryStrategy';
|
|
62
65
|
export { CallDeadline } from './http/CallDeadline';
|
|
63
66
|
export { CallContext } from './http/CallStrategy';
|
|
64
67
|
export type { Attempt, CallStrategy } from './http/CallStrategy';
|
|
@@ -73,9 +76,9 @@ export { WebpiecesDefaultErrorTranslator, WEBPIECES_DEFAULT_ERROR_TRANSLATOR, }
|
|
|
73
76
|
export { SurfaceEndUserStatus } from './http/Surface';
|
|
74
77
|
export type { Surface } from './http/Surface';
|
|
75
78
|
export { ReceivedApiErrorRule } from './errors/ReceivedApiErrorRule';
|
|
76
|
-
export type {
|
|
77
|
-
export {
|
|
78
|
-
export {
|
|
79
|
+
export type { ErrorClassifier } from './http/ErrorClassifier';
|
|
80
|
+
export { CallOutcome, KeyedErrorClassifier } from './http/ErrorClassifier';
|
|
81
|
+
export { WebpiecesDefaultErrorClassifier, WEBPIECES_DEFAULT_ERROR_CLASSIFIER, } from './http/WebpiecesDefaultErrorClassifier';
|
|
79
82
|
export { templateDeriver } from './http/templateDeriver';
|
|
80
83
|
export { WebpiecesCoreHeaders } from './http/WebpiecesCoreHeaders';
|
|
81
84
|
export { ContextReader } from './http/ContextReader';
|
|
@@ -98,7 +101,7 @@ export { RecordSerializer, SerializedMap, SerializedError } from './http/recorde
|
|
|
98
101
|
export { Filter } from './filters/Filter';
|
|
99
102
|
export type { Service } from './filters/Filter';
|
|
100
103
|
export { FilterChain } from './filters/FilterChain';
|
|
101
|
-
export { ApiError, ApiNotFoundError, ApiDependencyError, ApiBadGatewayError, ApiUnavailableError, ApiDependencyTimeoutError, ApiImplementationError, ApiRateLimitedError, ApiForbiddenError, ApiRequestTimeoutError, ApiEndUserError, ApiBadRequestError, ApiUnauthorizedError, ApiDependencyBackoffError, ApiConnectionError, ApiEndpointNotFoundError, ApiConflictError, ApiUnprocessableError, ApiPreconditionFailedError, ApiUnsupportedMediaTypeError, ApiNotImplementedError, ApiCodedError, ApiClientTooOldError, ApiEndUserNotFoundError, ApiEndUserForbiddenError, ApiEndUserBadRequestError, EndUserErrorCode, EndUserErrorRegistry, ClientRole, ApiErrorCodec, ApiErrorPayload, ApiErrorBoundary, ApiCallSite, ReportableApiFailure, RpcCallFailed, } from './errors';
|
|
104
|
+
export { ApiError, ApiNotFoundError, ApiDependencyError, ApiBadGatewayError, ApiUnavailableError, ApiDependencyTimeoutError, ApiImplementationError, ApiRateLimitedError, ApiForbiddenError, ApiRequestTimeoutError, ApiEndUserError, ApiBadRequestError, ApiUnauthorizedError, ApiDependencyBackoffError, ApiRetriesExhaustedError, ApiConnectionError, ApiEndpointNotFoundError, ApiConflictError, ApiUnprocessableError, ApiPreconditionFailedError, ApiUnsupportedMediaTypeError, ApiNotImplementedError, ApiCodedError, ApiClientTooOldError, ApiEndUserNotFoundError, ApiEndUserForbiddenError, ApiEndUserBadRequestError, EndUserErrorCode, EndUserErrorRegistry, ClientRole, ApiErrorCodec, ApiErrorPayload, ApiErrorBoundary, ApiCallSite, ReportableApiFailure, RpcCallFailed, } from './errors';
|
|
102
105
|
export type { ApiErrorKind, ApiStatusCode, EdgeHttpStatus, EndUserErrorFactory, CallSiteBoundary, } from './errors';
|
|
103
106
|
export { ApiErrorHttpStatus } from './http/ApiErrorHttpStatus';
|
|
104
107
|
export { OAuthErrorCode, OAuthErrorStatus, OAuthText } from './oauth/OAuthErrorCode';
|
package/src/index.js
CHANGED
|
@@ -11,8 +11,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
11
11
|
exports.MCP = exports.EXTERNAL_CUSTOMER = exports.SVC_TO_SVC = exports.ApiType = exports.NUMERIC_METADATA_KEYS = exports.WpMax = exports.WpMin = exports.WpInt = exports.getHttpParameterDeclarations = exports.QueryParam = exports.PathParam = exports.METADATA_KEYS = exports.validateNoConflictingDecorators = exports.assertEveryWebhookEndpointRetainsRawBody = exports.assertEveryExternalEndpointDeclaresCaller = exports.assertEveryEndpointHasAuthMode = exports.getAuthMeta = exports.isApiPath = exports.isRawBody = exports.isFormPost = exports.getMaskSpec = exports.getEndpointKinds = exports.getEndpointKind = exports.getEndpointOperation = exports.getEndpointOptions = exports.getEndpointHttpMethod = exports.getEndpoints = exports.getApiPath = exports.MaskLog = exports.isLocalOnly = exports.WpLocalOnly = exports.MISSING_AUTH_DECORATOR_FIX = exports.WpAuth = exports.WpAuthPublic = exports.Endpoint = exports.ApiPath = exports.GCP_LOG_BUDGET_BYTES = exports.MAX_GCP_LOG_BYTES = exports.LogChunkInfo = exports.LogChunkerImpl = exports.LogChunker = exports.LogManager = exports.ConsoleLoggerFactory = exports.ConsoleLogger = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = exports.ContextTuple = exports.ContextKey = exports.toError = void 0;
|
|
12
12
|
exports.InvalidEndpointForMcp = exports.WRITE = exports.WRITE_IDEMPOTENT = exports.READ = exports.EXTERNAL = exports.CRON = exports.CLOUDTASKS = exports.RPC = exports.POST = exports.GET = exports.registerStreamingSchemas = exports.getStreamingEndpoint = exports.WpStream = exports.StreamDirection = exports.StreamWriter = exports.StreamTransportError = exports.StreamEventValidator = exports.StreamingEndpointMetadata = exports.StreamEnvelope = exports.StreamCorrelation = exports.HttpParameterDeclaration = exports.HttpParameterBinding = exports.HttpContractMapper = exports.BoundHttpRequest = exports.StreamDisconnectedError = exports.StreamProtocolError = exports.StreamErrorControl = exports.registerStreamingCatalog = exports.StreamingSchemaCatalog = exports.getAuthorization = exports.WpAuthorization = exports.AuthorizationDeclaration = exports.AuthorizationType = exports.RouteMetadataFactory = exports.RouteMetadata = exports.IPC_METADATA_KEYS = exports.assertNotInternalApi = exports.assertInternalApi = exports.getIpcMaskSpec = exports.getIpcEndpointKind = exports.getIpcEndpoints = exports.getIpcApiId = exports.isInternalApi = exports.WpIpcEndpoint = exports.WpInternal = exports.assertApiTypeMatchesMcpTools = exports.getApiTypeEndpointNames = exports.getApiTypes = exports.DEFAULT_API_TYPES = exports.API_TYPE_METADATA_KEY = void 0;
|
|
13
13
|
exports.NetworkRejectClassifier = 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.SECRETS = exports.Secrets = exports.getEndpointCaller = exports.isExternalSystemKind = exports.ExternalCaller = exports.DEFAULT_CALLER_KIND = exports.EXTERNAL_SYSTEM_KINDS = exports.getQueueName = exports.assertPubSubConventions = exports.assertApiKind = exports.getApiKind = exports.ENDPOINT_KINDS_BY_API_KIND = exports.Queue = exports.PubSub = exports.Rpc = exports.apiKey = exports.webhook = exports.sharedSecret = exports.oidc = exports.jwt = exports.AuthDeclaration = exports.AuthMeta = exports.GenerateOutputTarget = exports.GenerateOutputLookup = exports.GenerateLayoutProblem = exports.GeneratedApiDocsLayout = exports.McpToolDefinition = exports.McpToolCatalogError = exports.McpToolCatalogFile = exports.ObjectSchemaBuilder = exports.DtoValidationFailure = exports.ApiJsonSchemaValidator = exports.ApiJsonSchemaDiscriminator = exports.ApiJsonSchema = exports.mcpHintsForOperation = exports.getWpMcpTools = exports.getInvalidEndpointsForMcp = exports.WpMcpToolMetadata = exports.WpMcpToolHints = exports.WpMcpTool = exports.InvalidEndpointForMcpMetadata = void 0;
|
|
14
|
-
exports.
|
|
15
|
-
exports.McpToolProfilesOptions = exports.Mcp = exports.OAuthAuthorizationErrorRedirect = exports.OAuthErrorResponse = exports.OAuthErrorBody = exports.OAuthBearerChallenge = exports.OAuthErrorExtras = exports.OAuthProtocolError = exports.OAuthText = exports.OAuthErrorStatus = exports.OAuthErrorCode = exports.ApiErrorHttpStatus = exports.RpcCallFailed = exports.ReportableApiFailure = exports.ApiCallSite = exports.ApiErrorBoundary = exports.ApiErrorPayload = exports.ApiErrorCodec = exports.ClientRole = exports.EndUserErrorRegistry = exports.EndUserErrorCode = exports.ApiEndUserBadRequestError = exports.ApiEndUserForbiddenError = exports.ApiEndUserNotFoundError = exports.ApiClientTooOldError = exports.ApiCodedError = exports.ApiNotImplementedError = exports.ApiUnsupportedMediaTypeError = exports.ApiPreconditionFailedError = exports.ApiUnprocessableError = exports.ApiConflictError = exports.ApiEndpointNotFoundError = exports.ApiConnectionError = exports.ApiDependencyBackoffError = exports.ApiUnauthorizedError = exports.ApiBadRequestError = exports.ApiEndUserError = exports.ApiRequestTimeoutError = exports.ApiForbiddenError = exports.ApiRateLimitedError = exports.ApiImplementationError = void 0;
|
|
14
|
+
exports.ApiDependencyError = exports.ApiNotFoundError = exports.ApiError = exports.FilterChain = exports.Filter = exports.SerializedError = exports.SerializedMap = exports.RecordSerializer = exports.getDoNotRecordFields = exports.DoNotRecord = exports.RecordedTestCase = exports.RecordedError = exports.RecordedEndpoint = exports.RecorderKeys = exports.ApiMethodInfo = exports.LOG_API_CALL_LOGGER_NAME = exports.ApiCallLogNameImpl = exports.ApiCallLogName = exports.ApiCallInfo = exports.MaskSpec = exports.LogApiCallImpl = exports.ContextMgr = exports.DestinationTrust = exports.WebpiecesCoreHeaders = exports.templateDeriver = exports.WEBPIECES_DEFAULT_ERROR_CLASSIFIER = exports.WebpiecesDefaultErrorClassifier = exports.KeyedErrorClassifier = exports.CallOutcome = exports.ReceivedApiErrorRule = exports.SurfaceEndUserStatus = exports.WEBPIECES_DEFAULT_ERROR_TRANSLATOR = exports.WebpiecesDefaultErrorTranslator = exports.HttpResponseDto = exports.HttpResponseStatus = exports.HttpHeader = exports.RuntimeLocality = exports.ServiceInfo = exports.ApiCallTimeoutError = exports.CallContext = exports.CallDeadline = exports.RetryStrategy = exports.TransportDefault = exports.CallRegistry = exports.ClientRegistry = exports.HeaderRegistry = exports.DateTimeUtil = exports.TimeUtil = exports.DateUtil = exports.InstantUtil = void 0;
|
|
15
|
+
exports.McpToolProfilesOptions = exports.Mcp = exports.OAuthAuthorizationErrorRedirect = exports.OAuthErrorResponse = exports.OAuthErrorBody = exports.OAuthBearerChallenge = exports.OAuthErrorExtras = exports.OAuthProtocolError = exports.OAuthText = exports.OAuthErrorStatus = exports.OAuthErrorCode = exports.ApiErrorHttpStatus = exports.RpcCallFailed = exports.ReportableApiFailure = exports.ApiCallSite = exports.ApiErrorBoundary = exports.ApiErrorPayload = exports.ApiErrorCodec = exports.ClientRole = exports.EndUserErrorRegistry = exports.EndUserErrorCode = exports.ApiEndUserBadRequestError = exports.ApiEndUserForbiddenError = exports.ApiEndUserNotFoundError = exports.ApiClientTooOldError = exports.ApiCodedError = exports.ApiNotImplementedError = exports.ApiUnsupportedMediaTypeError = exports.ApiPreconditionFailedError = exports.ApiUnprocessableError = exports.ApiConflictError = exports.ApiEndpointNotFoundError = exports.ApiConnectionError = exports.ApiRetriesExhaustedError = exports.ApiDependencyBackoffError = exports.ApiUnauthorizedError = exports.ApiBadRequestError = exports.ApiEndUserError = exports.ApiRequestTimeoutError = exports.ApiForbiddenError = exports.ApiRateLimitedError = exports.ApiImplementationError = exports.ApiDependencyTimeoutError = exports.ApiUnavailableError = exports.ApiBadGatewayError = void 0;
|
|
16
16
|
var errorUtils_1 = require("./lib/errorUtils");
|
|
17
17
|
Object.defineProperty(exports, "toError", { enumerable: true, get: function () { return errorUtils_1.toError; } });
|
|
18
18
|
var ContextKey_1 = require("./ContextKey");
|
|
@@ -227,6 +227,10 @@ var ClientRegistry_1 = require("./http/ClientRegistry");
|
|
|
227
227
|
Object.defineProperty(exports, "ClientRegistry", { enumerable: true, get: function () { return ClientRegistry_1.ClientRegistry; } });
|
|
228
228
|
var CallRegistry_1 = require("./http/CallRegistry");
|
|
229
229
|
Object.defineProperty(exports, "CallRegistry", { enumerable: true, get: function () { return CallRegistry_1.CallRegistry; } });
|
|
230
|
+
var TransportDefault_1 = require("./http/TransportDefault");
|
|
231
|
+
Object.defineProperty(exports, "TransportDefault", { enumerable: true, get: function () { return TransportDefault_1.TransportDefault; } });
|
|
232
|
+
var RetryStrategy_1 = require("./http/RetryStrategy");
|
|
233
|
+
Object.defineProperty(exports, "RetryStrategy", { enumerable: true, get: function () { return RetryStrategy_1.RetryStrategy; } });
|
|
230
234
|
var CallDeadline_1 = require("./http/CallDeadline");
|
|
231
235
|
Object.defineProperty(exports, "CallDeadline", { enumerable: true, get: function () { return CallDeadline_1.CallDeadline; } });
|
|
232
236
|
var CallStrategy_1 = require("./http/CallStrategy");
|
|
@@ -259,11 +263,12 @@ Object.defineProperty(exports, "SurfaceEndUserStatus", { enumerable: true, get:
|
|
|
259
263
|
// The ONE rule for an error RECEIVED from another process, shared verbatim by HTTP and IPC.
|
|
260
264
|
var ReceivedApiErrorRule_1 = require("./errors/ReceivedApiErrorRule");
|
|
261
265
|
Object.defineProperty(exports, "ReceivedApiErrorRule", { enumerable: true, get: function () { return ReceivedApiErrorRule_1.ReceivedApiErrorRule; } });
|
|
262
|
-
var
|
|
263
|
-
Object.defineProperty(exports, "
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
Object.defineProperty(exports, "
|
|
266
|
+
var ErrorClassifier_1 = require("./http/ErrorClassifier");
|
|
267
|
+
Object.defineProperty(exports, "CallOutcome", { enumerable: true, get: function () { return ErrorClassifier_1.CallOutcome; } });
|
|
268
|
+
Object.defineProperty(exports, "KeyedErrorClassifier", { enumerable: true, get: function () { return ErrorClassifier_1.KeyedErrorClassifier; } });
|
|
269
|
+
var WebpiecesDefaultErrorClassifier_1 = require("./http/WebpiecesDefaultErrorClassifier");
|
|
270
|
+
Object.defineProperty(exports, "WebpiecesDefaultErrorClassifier", { enumerable: true, get: function () { return WebpiecesDefaultErrorClassifier_1.WebpiecesDefaultErrorClassifier; } });
|
|
271
|
+
Object.defineProperty(exports, "WEBPIECES_DEFAULT_ERROR_CLASSIFIER", { enumerable: true, get: function () { return WebpiecesDefaultErrorClassifier_1.WEBPIECES_DEFAULT_ERROR_CLASSIFIER; } });
|
|
267
272
|
var templateDeriver_1 = require("./http/templateDeriver");
|
|
268
273
|
Object.defineProperty(exports, "templateDeriver", { enumerable: true, get: function () { return templateDeriver_1.templateDeriver; } });
|
|
269
274
|
var WebpiecesCoreHeaders_1 = require("./http/WebpiecesCoreHeaders");
|
|
@@ -336,6 +341,7 @@ Object.defineProperty(exports, "ApiEndUserError", { enumerable: true, get: funct
|
|
|
336
341
|
Object.defineProperty(exports, "ApiBadRequestError", { enumerable: true, get: function () { return errors_2.ApiBadRequestError; } });
|
|
337
342
|
Object.defineProperty(exports, "ApiUnauthorizedError", { enumerable: true, get: function () { return errors_2.ApiUnauthorizedError; } });
|
|
338
343
|
Object.defineProperty(exports, "ApiDependencyBackoffError", { enumerable: true, get: function () { return errors_2.ApiDependencyBackoffError; } });
|
|
344
|
+
Object.defineProperty(exports, "ApiRetriesExhaustedError", { enumerable: true, get: function () { return errors_2.ApiRetriesExhaustedError; } });
|
|
339
345
|
Object.defineProperty(exports, "ApiConnectionError", { enumerable: true, get: function () { return errors_2.ApiConnectionError; } });
|
|
340
346
|
Object.defineProperty(exports, "ApiEndpointNotFoundError", { enumerable: true, get: function () { return errors_2.ApiEndpointNotFoundError; } });
|
|
341
347
|
Object.defineProperty(exports, "ApiConflictError", { enumerable: true, get: function () { return errors_2.ApiConflictError; } });
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;AAEH,+CAA2C;AAAlC,qGAAA,OAAO,OAAA;AAChB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAOnB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,+EAA+E;AAC/E,kFAAkF;AAClF,yCAAyC;AACzC,mDAA0F;AAAjF,gHAAA,cAAc,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,sHAAA,oBAAoB,OAAA;AAO/D,yDAAwD;AAA/C,8GAAA,aAAa,OAAA;AACtB,uEAAsE;AAA7D,4HAAA,oBAAoB,OAAA;AAC7B,mDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,mDAM8B;AAL1B,wGAAA,UAAU,OAAA;AACV,4GAAA,cAAc,OAAA;AACd,0GAAA,YAAY,OAAA;AACZ,+GAAA,iBAAiB,OAAA;AACjB,kHAAA,oBAAoB,OAAA;AAGxB,8DAA8D;AAC9D,sEA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AAE,2GAAA,SAAS,OAAA;AAQpD,iEAAkF;AAAzE,wHAAA,kBAAkB,OAAA;AAAE,sHAAA,gBAAgB,OAAA;AAC7C,qEAAoE;AAA3D,4HAAA,oBAAoB,OAAA;AAC7B,iEAAgF;AAAvE,oHAAA,cAAc,OAAA;AAAE,wHAAA,kBAAkB,OAAA;AAC3C,2FAA0F;AAAjF,kJAAA,+BAA+B,OAAA;AAGxC,iCAAwD;AAA/C,0FAAA,GAAG,OAAA;AAAE,6GAAA,sBAAsB,OAAA","sourcesContent":["/**\n * @webpieces/core-util\n *\n * Utility functions for WebPieces applications.\n * This package works in both browser and Node.js environments.\n *\n * @packageDocumentation\n */\n\nexport { toError } from './lib/errorUtils';\nexport { ContextKey } from './ContextKey';\nexport type {\n AnyContextKey,\n AnyTrustedContextKey,\n AnyUntrustedContextKey,\n Trust,\n} from './ContextKey';\nexport { ContextTuple } from './ContextTuple';\n\n// @DocumentDesign — DI-design-root marker. Applies to ANY project kind (server\n// controllers AND library impl classes), so it lives here (browser + Node) rather\n// than in a server-only routing package.\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './DocumentDesign';\n\n// Logging (merged from former @webpieces/wp-logging).\n// Pluggable logging interface + a browser-safe console default; apps plug in\n// bunyan/winston/pino/etc. via LogManager.setFactory(...). Browser + Node.\nexport type { Logger, LogLevel } from './logging/Logger';\nexport type { LoggerFactory } from './logging/LoggerFactory';\nexport { ConsoleLogger } from './logging/ConsoleLogger';\nexport { ConsoleLoggerFactory } from './logging/ConsoleLoggerFactory';\nexport { LogManager } from './logging/LogManager';\nexport {\n LogChunker,\n LogChunkerImpl,\n LogChunkInfo,\n MAX_GCP_LOG_BYTES,\n GCP_LOG_BUDGET_BYTES,\n} from './logging/LogChunker';\n\n// HTTP API contract (merged from former @webpieces/http-api).\n// Shared HTTP API definition consumed by both client and server: REST\n// decorators, the API error taxonomy, datetime DTOs, platform-header\n// registry/readers, ValidateImplementation, and the test-case recorder\n// contract. Pure definitions — express-free, browser + Node safe.\n\n// API definition decorators\nexport {\n ApiPath,\n Endpoint,\n // Auth mode decorators (clean service-to-service + user JWT model)\n WpAuthPublic,\n WpAuth,\n MISSING_AUTH_DECORATOR_FIX,\n WpLocalOnly,\n isLocalOnly,\n MaskLog,\n getApiPath,\n getEndpoints,\n getEndpointHttpMethod,\n getEndpointOptions,\n getEndpointOperation,\n getEndpointKind,\n getEndpointKinds,\n getMaskSpec,\n isFormPost,\n isRawBody,\n isApiPath,\n getAuthMeta,\n assertEveryEndpointHasAuthMode,\n assertEveryExternalEndpointDeclaresCaller,\n assertEveryWebhookEndpointRetainsRawBody,\n validateNoConflictingDecorators,\n METADATA_KEYS,\n} from './http/decorators';\nexport {\n PathParam,\n QueryParam,\n getHttpParameterDeclarations,\n} from './http/http-parameter-decorators';\nexport { WpInt, WpMin, WpMax, NUMERIC_METADATA_KEYS } from './http/numeric-field-decorators';\nexport type { Integer } from './http/numeric-field-decorators';\nexport {\n ApiType,\n SVC_TO_SVC,\n EXTERNAL_CUSTOMER,\n MCP,\n API_TYPE_METADATA_KEY,\n DEFAULT_API_TYPES,\n getApiTypes,\n getApiTypeEndpointNames,\n assertApiTypeMatchesMcpTools,\n} from './http/api-type';\nexport type { ApiTypeKind } from './http/api-type';\nexport {\n WpInternal,\n WpIpcEndpoint,\n isInternalApi,\n getIpcApiId,\n getIpcEndpoints,\n getIpcEndpointKind,\n getIpcMaskSpec,\n assertInternalApi,\n assertNotInternalApi,\n IPC_METADATA_KEYS,\n} from './ipc/IpcDecorators';\nexport type { IpcApiType, IpcEndpointKind, IpcEndpointOptions } from './ipc/IpcDecorators';\n// The runtime representation of ONE route (split out of decorators.ts for file size only).\nexport { RouteMetadata } from './http/RouteMetadata';\nexport { RouteMetadataFactory } from './http/RouteMetadataFactory';\nexport { AuthorizationType, AuthorizationDeclaration, WpAuthorization, getAuthorization } from './http/authorization';\nexport type { AuthorizationRequirement } from './http/authorization';\nexport { StreamingSchemaCatalog, registerStreamingCatalog } from './http/StreamingSchemaCatalog';\nexport {\n StreamErrorControl,\n StreamProtocolError,\n StreamDisconnectedError,\n} from './http/StreamErrorControl';\nexport {\n BoundHttpRequest,\n HttpContractMapper,\n HttpParameterBinding,\n HttpParameterDeclaration,\n} from './http/HttpContract';\nexport {\n StreamCorrelation,\n StreamEnvelope,\n StreamingEndpointMetadata,\n StreamEventValidator,\n StreamTransportError,\n StreamWriter,\n StreamDirection,\n WpStream,\n getStreamingEndpoint,\n registerStreamingSchemas,\n} from './http/StreamingContract';\nexport type { RequestStream, ResponseStream, StreamEnvelopeKind } from './http/StreamingContract';\nexport type {\n EndpointResponseType,\n HttpMethod,\n HttpParameterSource,\n HttpParameterValueType,\n} from './http/HttpContract';\nexport { GET, POST } from './http/HttpContract';\nexport type {\n EndpointKind,\n EndpointOperation,\n EndpointOptions,\n ExternalEndpointOptions,\n} from './http/decorators';\nexport { RPC, CLOUDTASKS, CRON, EXTERNAL, READ, WRITE_IDEMPOTENT, WRITE } from './http/decorators';\nexport {\n InvalidEndpointForMcp,\n InvalidEndpointForMcpMetadata,\n WpMcpTool,\n WpMcpToolHints,\n WpMcpToolMetadata,\n getInvalidEndpointsForMcp,\n getWpMcpTools,\n mcpHintsForOperation,\n} from './mcp/McpMetadata';\nexport type { WpMcpMethodDecorator } from './mcp/McpMetadata';\nexport {\n ApiJsonSchema,\n ApiJsonSchemaDiscriminator,\n ApiJsonSchemaValidator,\n DtoValidationFailure,\n ObjectSchemaBuilder,\n} from './mcp/DtoSchema';\nexport type { ApiJsonSchemaType, DtoValue } from './mcp/DtoSchema';\nexport {\n McpToolCatalogFile,\n McpToolCatalogError,\n McpToolDefinition,\n} from './mcp/McpToolCatalogFile';\nexport {\n GeneratedApiDocsLayout,\n GenerateLayoutProblem,\n GenerateOutputLookup,\n GenerateOutputTarget,\n} from './mcp/GeneratedApiDocsLayout';\nexport type {\n LayoutDependsOn,\n LayoutDependsOnObject,\n LayoutTarget,\n LayoutTargets,\n} from './mcp/GeneratedApiDocsLayout';\n// The TYPE layer of the auth surface — likewise split out of decorators.ts for file size only.\nexport { AuthMeta, AuthDeclaration, jwt, oidc, sharedSecret, webhook, apiKey } from './http/auth-mode';\nexport type {\n AuthMode,\n ApiKeyCredential,\n ApiKeyCredentials,\n AuthMethod,\n AuthMethods,\n} from './http/auth-mode';\n// API kind (RPC vs PubSub/Cloud Tasks) + queue naming. Split out of decorators.ts for file size only;\n// one-way dependency api-kind -> decorators, and the barrel keeps the surface identical.\nexport {\n Rpc,\n PubSub,\n Queue,\n ENDPOINT_KINDS_BY_API_KIND,\n getApiKind,\n assertApiKind,\n assertPubSubConventions,\n getQueueName,\n} from './http/api-kind';\nexport type { ApiKind } from './http/api-kind';\n// WHO calls an `external` endpoint — the caller declaration\n// @Endpoint(POST, ..., WRITE, EXTERNAL, { calledBy })\n// requires, and the reader for it.\nexport {\n EXTERNAL_SYSTEM_KINDS,\n DEFAULT_CALLER_KIND,\n ExternalCaller,\n isExternalSystemKind,\n getEndpointCaller,\n} from './http/external-caller';\nexport type { ExternalSystemKind } from './http/external-caller';\n// Client-side shared-secret store (the value THIS service sends per sharedSecret(...) key).\nexport { Secrets, SECRETS } from './http/Secrets';\n\n// Type validators\nexport { ValidateImplementation } from './http/validators';\n\n// Authentication subtype constants.\nexport {\n ENTITY_NOT_FOUND,\n WRONG_LOGIN_TYPE,\n WRONG_LOGIN,\n NOT_APPROVED,\n EMAIL_NOT_CONFIRMED,\n WRONG_DOMAIN,\n WRONG_COMPANY,\n NO_REG_CODE,\n} from './errors';\n\nexport { NetworkRejectClassifier } from './http/networkReject';\n\n// Date/Time DTOs and Utilities (inspired by Java Time / JSR-310)\nexport {\n InstantDto,\n DateDto,\n TimeDto,\n DateTimeDto,\n InstantUtil,\n DateUtil,\n TimeUtil,\n DateTimeUtil,\n} from './http/datetime';\n\n// Context keys + registry (the global magic-context header system)\nexport { HeaderRegistry } from './http/HeaderRegistry';\nexport { ClientRegistry } from './http/ClientRegistry';\nexport { CallRegistry } from './http/CallRegistry';\nexport { CallDeadline } from './http/CallDeadline';\nexport { CallContext } from './http/CallStrategy';\nexport type { Attempt, CallStrategy } from './http/CallStrategy';\nexport { ApiCallTimeoutError } from './http/ApiCallTimeoutError';\nexport type { ServiceUrlDeriver } from './http/ClientRegistry';\n\n// \"What service am I\" — set once at startup, read by the logging backends and by\n// RequestContextHeaders (to stamp requestIdSource on ids this service mints).\nexport { ServiceInfo } from './http/ServiceInfo';\n// \"Where am I running\" — declared once at startup (setupRuntime, from RuntimeSetupOptions.locality).\n// The ONE input to @WpLocalOnly enforcement. Undeclared reads as DEPLOYED (fail safe).\nexport { RuntimeLocality } from './http/RuntimeLocality';\nexport type { Locality } from './http/RuntimeLocality';\n// The ENTIRE HTTP response as pure data — the ONE form both transports (express, fetch) are\n// normalised into, so an ErrorTranslator implementation is written once and serves both.\nexport { HttpHeader, HttpResponseStatus, HttpResponseDto } from './http/HttpResponseDto';\n// Pluggable, bidirectional error translation (app exception <-> the WHOLE response). Set on\n// ClientRegistry at startup; consulted before the built-in webpieces mapping on BOTH sides.\nexport type { ErrorTranslator } from './http/ErrorTranslator';\n// THE webpieces default translator — always installed, and what an app's own translator delegates to\n// in order to decline an error. ONE class, both halves, node and browser alike.\nexport {\n WebpiecesDefaultErrorTranslator,\n WEBPIECES_DEFAULT_ERROR_TRANSLATOR,\n} from './http/WebpiecesDefaultErrorTranslator';\n// WHICH KIND OF CALLER drove this request (gui / llm / public-api), and the per-request end-user\n// status derived from it — the replacement for the deleted per-router EndUserStatus.\nexport { SurfaceEndUserStatus } from './http/Surface';\nexport type { Surface } from './http/Surface';\n// The ONE rule for an error RECEIVED from another process, shared verbatim by HTTP and IPC.\nexport { ReceivedApiErrorRule } from './errors/ReceivedApiErrorRule';\n// Pluggable per-client failure classification (is a thrown API-call error a real failure or an\n// expected non-failure?). Registered on ClientRegistry at startup; consulted by LogApiCall.\nexport type { FailureClassifier } from './http/FailureClassifier';\nexport { KeyedFailureClassifier } from './http/FailureClassifier';\nexport {\n WebpiecesDefaultFailureClassifier,\n WEBPIECES_DEFAULT_FAILURE_CLASSIFIER,\n} from './http/WebpiecesDefaultFailureClassifier';\nexport { templateDeriver } from './http/templateDeriver';\nexport { WebpiecesCoreHeaders } from './http/WebpiecesCoreHeaders';\nexport { ContextReader } from './http/ContextReader';\nexport { ContextWriter, ContextStore } from './http/ContextWriter';\n\n// The OUTBOUND half of the trust model: whether a TRUSTED context key may ride to the endpoint being\n// called. Built ONLY from the destination endpoint's AuthMode — see the class doc.\nexport { DestinationTrust } from './http/DestinationTrust';\n\n// BROWSER-ONLY outbound-header propagation (app-held store + registry -> outbound HTTP headers).\n// Only @webpieces/http-client-browser may name it; the server reads RequestContext directly via\n// RequestContextHeaders in the Node-only @webpieces/core-context.\nexport { ContextMgr } from './http/ContextMgr';\n\n// API-call logging helper (uses LogManager above). NOT a singleton: construct one per environment\n// with that environment's ApiCallContext — `new LogApiCallImpl(new RequestContextApiCallContext())`\n// on node, `new LogApiCallImpl(new BrowserApiCallContext())` in a browser.\nexport { LogApiCallImpl } from './http/LogApiCall';\n\n// Opt-in field masking for the LogApiCall log path — declare per-api sensitive fields so secrets\n// (OAuth refresh tokens, id-token JWTs) are masked in the logs while the real value stays on the wire.\nexport { MaskSpec } from './http/LogFieldMask';\nexport type { MaskMode } from './http/LogFieldMask';\n\n// The structured `api` tag + the context-writer seam LogApiCall stamps through. The Node\n// RequestContext-backed impl lives in @webpieces/core-context, the browser one in\n// @webpieces/http-client-browser; each is CONSTRUCTED by its package, never installed globally.\nexport { ApiCallInfo } from './http/ApiCallInfo';\nexport type { ApiCallDirection, ApiResult } from './http/ApiCallInfo';\n// Console-render bridge: turns LogApiCall's [LogApiCall] bracket into [API.{side}.{phase}] locally.\nexport {\n ApiCallLogName,\n ApiCallLogNameImpl,\n LOG_API_CALL_LOGGER_NAME,\n} from './http/ApiCallLogName';\nexport { ApiMethodInfo } from './http/ApiMethodInfo';\nexport type { ApiSide } from './http/ApiMethodInfo';\nexport type { ApiCallContext } from './http/ApiCallContext';\n\n// Test-case recording contract (impl lives in http-server; hooks in http-client)\nexport { TestCaseRecorder, RecorderKeys } from './http/recorder/TestCaseRecorder';\nexport {\n RecordedEndpoint,\n RecordedError,\n RecordedTestCase,\n} from './http/recorder/RecordedEndpoint';\nexport { DoNotRecord, getDoNotRecordFields } from './http/recorder/DoNotRecord';\nexport { RecordSerializer, SerializedMap, SerializedError } from './http/recorder/RecordSerializer';\n\n// ---------------------------------------------------------------------------------------------\n// Filter-chain primitives, shared by BOTH chains: the inbound server chain\n// (`Filter<MethodMeta, WpResponse<unknown>>`, @webpieces/http-routing) and the outbound client\n// chain (`Filter<ClientRequest, Response>`, @webpieces/http-client-core). Declared once, here, in\n// the package both depend on — see the class doc for why a second pair would be a shim.\nexport { Filter } from './filters/Filter';\nexport type { Service } from './filters/Filter';\nexport { FilterChain } from './filters/FilterChain';\n\nexport {\n ApiError,\n ApiNotFoundError,\n ApiDependencyError,\n ApiBadGatewayError,\n ApiUnavailableError,\n ApiDependencyTimeoutError,\n ApiImplementationError,\n ApiRateLimitedError,\n ApiForbiddenError,\n ApiRequestTimeoutError,\n ApiEndUserError,\n ApiBadRequestError,\n ApiUnauthorizedError,\n ApiDependencyBackoffError,\n ApiConnectionError,\n ApiEndpointNotFoundError,\n ApiConflictError,\n ApiUnprocessableError,\n ApiPreconditionFailedError,\n ApiUnsupportedMediaTypeError,\n ApiNotImplementedError,\n ApiCodedError,\n ApiClientTooOldError,\n ApiEndUserNotFoundError,\n ApiEndUserForbiddenError,\n ApiEndUserBadRequestError,\n EndUserErrorCode,\n EndUserErrorRegistry,\n ClientRole,\n ApiErrorCodec,\n ApiErrorPayload,\n ApiErrorBoundary,\n ApiCallSite,\n ReportableApiFailure,\n RpcCallFailed,\n} from './errors';\nexport type {\n ApiErrorKind,\n ApiStatusCode,\n EdgeHttpStatus,\n EndUserErrorFactory,\n CallSiteBoundary,\n} from './errors';\nexport { ApiErrorHttpStatus } from './http/ApiErrorHttpStatus';\n\n// RFC 6749 / 6750 / 7591 OAuth refusals for app-hosted OAuth endpoints (#1176): the typed error,\n// its one renderer, the Bearer challenge builder and the authorization-endpoint error redirect.\nexport { OAuthErrorCode, OAuthErrorStatus, OAuthText } from './oauth/OAuthErrorCode';\nexport type {\n OAuthHttpStatus,\n InvalidClientStatus,\n OAuthFixedStatusErrorCode,\n BearerErrorCode,\n AuthorizationEndpointErrorCode,\n} from './oauth/OAuthErrorCode';\nexport { OAuthProtocolError, OAuthErrorExtras } from './oauth/OAuthProtocolError';\nexport { OAuthBearerChallenge } from './oauth/OAuthBearerChallenge';\nexport { OAuthErrorBody, OAuthErrorResponse } from './oauth/OAuthErrorResponse';\nexport { OAuthAuthorizationErrorRedirect } from './oauth/OAuthAuthorizationErrorRedirect';\nexport type { PublishedKind, PublishedApiError } from './http/ApiErrorHttpStatus';\n\nexport { Mcp, McpToolProfilesOptions } from './mcp/Mcp';\nexport type { McpToolProfiles } from './mcp/Mcp';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/core/core-util/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;AAEH,+CAA2C;AAAlC,qGAAA,OAAO,OAAA;AAChB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AAOnB,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,+EAA+E;AAC/E,kFAAkF;AAClF,yCAAyC;AACzC,mDAA0F;AAAjF,gHAAA,cAAc,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,sHAAA,oBAAoB,OAAA;AAO/D,yDAAwD;AAA/C,8GAAA,aAAa,OAAA;AACtB,uEAAsE;AAA7D,4HAAA,oBAAoB,OAAA;AAC7B,mDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,mDAM8B;AAL1B,wGAAA,UAAU,OAAA;AACV,4GAAA,cAAc,OAAA;AACd,0GAAA,YAAY,OAAA;AACZ,+GAAA,iBAAiB,OAAA;AAC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8GAAA,oBAAoB,OAAA;AACpB,uGAAA,aAAa,OAAA;AASjB,gEAA+D;AAAtD,wHAAA,kBAAkB,OAAA;AAE3B,iGAAiG;AACjG,gGAAgG;AAChG,yDAAqF;AAA5E,gHAAA,cAAc,OAAA;AAAE,kHAAA,gBAAgB,OAAA;AAAE,2GAAA,SAAS,OAAA;AAQpD,iEAAkF;AAAzE,wHAAA,kBAAkB,OAAA;AAAE,sHAAA,gBAAgB,OAAA;AAC7C,qEAAoE;AAA3D,4HAAA,oBAAoB,OAAA;AAC7B,iEAAgF;AAAvE,oHAAA,cAAc,OAAA;AAAE,wHAAA,kBAAkB,OAAA;AAC3C,2FAA0F;AAAjF,kJAAA,+BAA+B,OAAA;AAGxC,iCAAwD;AAA/C,0FAAA,GAAG,OAAA;AAAE,6GAAA,sBAAsB,OAAA","sourcesContent":["/**\n * @webpieces/core-util\n *\n * Utility functions for WebPieces applications.\n * This package works in both browser and Node.js environments.\n *\n * @packageDocumentation\n */\n\nexport { toError } from './lib/errorUtils';\nexport { ContextKey } from './ContextKey';\nexport type {\n AnyContextKey,\n AnyTrustedContextKey,\n AnyUntrustedContextKey,\n Trust,\n} from './ContextKey';\nexport { ContextTuple } from './ContextTuple';\n\n// @DocumentDesign — DI-design-root marker. Applies to ANY project kind (server\n// controllers AND library impl classes), so it lives here (browser + Node) rather\n// than in a server-only routing package.\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './DocumentDesign';\n\n// Logging (merged from former @webpieces/wp-logging).\n// Pluggable logging interface + a browser-safe console default; apps plug in\n// bunyan/winston/pino/etc. via LogManager.setFactory(...). Browser + Node.\nexport type { Logger, LogLevel } from './logging/Logger';\nexport type { LoggerFactory } from './logging/LoggerFactory';\nexport { ConsoleLogger } from './logging/ConsoleLogger';\nexport { ConsoleLoggerFactory } from './logging/ConsoleLoggerFactory';\nexport { LogManager } from './logging/LogManager';\nexport {\n LogChunker,\n LogChunkerImpl,\n LogChunkInfo,\n MAX_GCP_LOG_BYTES,\n GCP_LOG_BUDGET_BYTES,\n} from './logging/LogChunker';\n\n// HTTP API contract (merged from former @webpieces/http-api).\n// Shared HTTP API definition consumed by both client and server: REST\n// decorators, the API error taxonomy, datetime DTOs, platform-header\n// registry/readers, ValidateImplementation, and the test-case recorder\n// contract. Pure definitions — express-free, browser + Node safe.\n\n// API definition decorators\nexport {\n ApiPath,\n Endpoint,\n // Auth mode decorators (clean service-to-service + user JWT model)\n WpAuthPublic,\n WpAuth,\n MISSING_AUTH_DECORATOR_FIX,\n WpLocalOnly,\n isLocalOnly,\n MaskLog,\n getApiPath,\n getEndpoints,\n getEndpointHttpMethod,\n getEndpointOptions,\n getEndpointOperation,\n getEndpointKind,\n getEndpointKinds,\n getMaskSpec,\n isFormPost,\n isRawBody,\n isApiPath,\n getAuthMeta,\n assertEveryEndpointHasAuthMode,\n assertEveryExternalEndpointDeclaresCaller,\n assertEveryWebhookEndpointRetainsRawBody,\n validateNoConflictingDecorators,\n METADATA_KEYS,\n} from './http/decorators';\nexport {\n PathParam,\n QueryParam,\n getHttpParameterDeclarations,\n} from './http/http-parameter-decorators';\nexport { WpInt, WpMin, WpMax, NUMERIC_METADATA_KEYS } from './http/numeric-field-decorators';\nexport type { Integer } from './http/numeric-field-decorators';\nexport {\n ApiType,\n SVC_TO_SVC,\n EXTERNAL_CUSTOMER,\n MCP,\n API_TYPE_METADATA_KEY,\n DEFAULT_API_TYPES,\n getApiTypes,\n getApiTypeEndpointNames,\n assertApiTypeMatchesMcpTools,\n} from './http/api-type';\nexport type { ApiTypeKind } from './http/api-type';\nexport {\n WpInternal,\n WpIpcEndpoint,\n isInternalApi,\n getIpcApiId,\n getIpcEndpoints,\n getIpcEndpointKind,\n getIpcMaskSpec,\n assertInternalApi,\n assertNotInternalApi,\n IPC_METADATA_KEYS,\n} from './ipc/IpcDecorators';\nexport type { IpcApiType, IpcEndpointKind, IpcEndpointOptions } from './ipc/IpcDecorators';\n// The runtime representation of ONE route (split out of decorators.ts for file size only).\nexport { RouteMetadata } from './http/RouteMetadata';\nexport { RouteMetadataFactory } from './http/RouteMetadataFactory';\nexport { AuthorizationType, AuthorizationDeclaration, WpAuthorization, getAuthorization } from './http/authorization';\nexport type { AuthorizationRequirement } from './http/authorization';\nexport { StreamingSchemaCatalog, registerStreamingCatalog } from './http/StreamingSchemaCatalog';\nexport {\n StreamErrorControl,\n StreamProtocolError,\n StreamDisconnectedError,\n} from './http/StreamErrorControl';\nexport {\n BoundHttpRequest,\n HttpContractMapper,\n HttpParameterBinding,\n HttpParameterDeclaration,\n} from './http/HttpContract';\nexport {\n StreamCorrelation,\n StreamEnvelope,\n StreamingEndpointMetadata,\n StreamEventValidator,\n StreamTransportError,\n StreamWriter,\n StreamDirection,\n WpStream,\n getStreamingEndpoint,\n registerStreamingSchemas,\n} from './http/StreamingContract';\nexport type { RequestStream, ResponseStream, StreamEnvelopeKind } from './http/StreamingContract';\nexport type {\n EndpointResponseType,\n HttpMethod,\n HttpParameterSource,\n HttpParameterValueType,\n} from './http/HttpContract';\nexport { GET, POST } from './http/HttpContract';\nexport type {\n EndpointKind,\n EndpointOperation,\n EndpointOptions,\n ExternalEndpointOptions,\n} from './http/decorators';\nexport { RPC, CLOUDTASKS, CRON, EXTERNAL, READ, WRITE_IDEMPOTENT, WRITE } from './http/decorators';\nexport {\n InvalidEndpointForMcp,\n InvalidEndpointForMcpMetadata,\n WpMcpTool,\n WpMcpToolHints,\n WpMcpToolMetadata,\n getInvalidEndpointsForMcp,\n getWpMcpTools,\n mcpHintsForOperation,\n} from './mcp/McpMetadata';\nexport type { WpMcpMethodDecorator } from './mcp/McpMetadata';\nexport {\n ApiJsonSchema,\n ApiJsonSchemaDiscriminator,\n ApiJsonSchemaValidator,\n DtoValidationFailure,\n ObjectSchemaBuilder,\n} from './mcp/DtoSchema';\nexport type { ApiJsonSchemaType, DtoValue } from './mcp/DtoSchema';\nexport {\n McpToolCatalogFile,\n McpToolCatalogError,\n McpToolDefinition,\n} from './mcp/McpToolCatalogFile';\nexport {\n GeneratedApiDocsLayout,\n GenerateLayoutProblem,\n GenerateOutputLookup,\n GenerateOutputTarget,\n} from './mcp/GeneratedApiDocsLayout';\nexport type {\n LayoutDependsOn,\n LayoutDependsOnObject,\n LayoutTarget,\n LayoutTargets,\n} from './mcp/GeneratedApiDocsLayout';\n// The TYPE layer of the auth surface — likewise split out of decorators.ts for file size only.\nexport { AuthMeta, AuthDeclaration, jwt, oidc, sharedSecret, webhook, apiKey } from './http/auth-mode';\nexport type {\n AuthMode,\n ApiKeyCredential,\n ApiKeyCredentials,\n AuthMethod,\n AuthMethods,\n} from './http/auth-mode';\n// API kind (RPC vs PubSub/Cloud Tasks) + queue naming. Split out of decorators.ts for file size only;\n// one-way dependency api-kind -> decorators, and the barrel keeps the surface identical.\nexport {\n Rpc,\n PubSub,\n Queue,\n ENDPOINT_KINDS_BY_API_KIND,\n getApiKind,\n assertApiKind,\n assertPubSubConventions,\n getQueueName,\n} from './http/api-kind';\nexport type { ApiKind } from './http/api-kind';\n// WHO calls an `external` endpoint — the caller declaration\n// @Endpoint(POST, ..., WRITE, EXTERNAL, { calledBy })\n// requires, and the reader for it.\nexport {\n EXTERNAL_SYSTEM_KINDS,\n DEFAULT_CALLER_KIND,\n ExternalCaller,\n isExternalSystemKind,\n getEndpointCaller,\n} from './http/external-caller';\nexport type { ExternalSystemKind } from './http/external-caller';\n// Client-side shared-secret store (the value THIS service sends per sharedSecret(...) key).\nexport { Secrets, SECRETS } from './http/Secrets';\n\n// Type validators\nexport { ValidateImplementation } from './http/validators';\n\n// Authentication subtype constants.\nexport {\n ENTITY_NOT_FOUND,\n WRONG_LOGIN_TYPE,\n WRONG_LOGIN,\n NOT_APPROVED,\n EMAIL_NOT_CONFIRMED,\n WRONG_DOMAIN,\n WRONG_COMPANY,\n NO_REG_CODE,\n} from './errors';\n\nexport { NetworkRejectClassifier } from './http/networkReject';\n\n// Date/Time DTOs and Utilities (inspired by Java Time / JSR-310)\nexport {\n InstantDto,\n DateDto,\n TimeDto,\n DateTimeDto,\n InstantUtil,\n DateUtil,\n TimeUtil,\n DateTimeUtil,\n} from './http/datetime';\n\n// Context keys + registry (the global magic-context header system)\nexport { HeaderRegistry } from './http/HeaderRegistry';\nexport { ClientRegistry } from './http/ClientRegistry';\nexport { CallRegistry } from './http/CallRegistry';\nexport type { CallScope } from './http/CallRegistry';\nexport { TransportDefault } from './http/TransportDefault';\nexport { RetryStrategy } from './http/RetryStrategy';\nexport { CallDeadline } from './http/CallDeadline';\nexport { CallContext } from './http/CallStrategy';\nexport type { Attempt, CallStrategy } from './http/CallStrategy';\nexport { ApiCallTimeoutError } from './http/ApiCallTimeoutError';\nexport type { ServiceUrlDeriver } from './http/ClientRegistry';\n\n// \"What service am I\" — set once at startup, read by the logging backends and by\n// RequestContextHeaders (to stamp requestIdSource on ids this service mints).\nexport { ServiceInfo } from './http/ServiceInfo';\n// \"Where am I running\" — declared once at startup (setupRuntime, from RuntimeSetupOptions.locality).\n// The ONE input to @WpLocalOnly enforcement. Undeclared reads as DEPLOYED (fail safe).\nexport { RuntimeLocality } from './http/RuntimeLocality';\nexport type { Locality } from './http/RuntimeLocality';\n// The ENTIRE HTTP response as pure data — the ONE form both transports (express, fetch) are\n// normalised into, so an ErrorTranslator implementation is written once and serves both.\nexport { HttpHeader, HttpResponseStatus, HttpResponseDto } from './http/HttpResponseDto';\n// Pluggable, bidirectional error translation (app exception <-> the WHOLE response). Set on\n// ClientRegistry at startup; consulted before the built-in webpieces mapping on BOTH sides.\nexport type { ErrorTranslator } from './http/ErrorTranslator';\n// THE webpieces default translator — always installed, and what an app's own translator delegates to\n// in order to decline an error. ONE class, both halves, node and browser alike.\nexport {\n WebpiecesDefaultErrorTranslator,\n WEBPIECES_DEFAULT_ERROR_TRANSLATOR,\n} from './http/WebpiecesDefaultErrorTranslator';\n// WHICH KIND OF CALLER drove this request (gui / llm / public-api), and the per-request end-user\n// status derived from it — the replacement for the deleted per-router EndUserStatus.\nexport { SurfaceEndUserStatus } from './http/Surface';\nexport type { Surface } from './http/Surface';\n// The ONE rule for an error RECEIVED from another process, shared verbatim by HTTP and IPC.\nexport { ReceivedApiErrorRule } from './errors/ReceivedApiErrorRule';\n// Pluggable per-client error classification: one CallOutcome (EXPECTED / TRANSIENT_FAILURE /\n// FAILURE) per thrown API-call error. Registered on ClientRegistry at startup; read by RetryStrategy,\n// CallRegistry's per-attempt log line, LogApiCall and the MCP renderer's retry advice.\nexport type { ErrorClassifier } from './http/ErrorClassifier';\nexport { CallOutcome, KeyedErrorClassifier } from './http/ErrorClassifier';\nexport {\n WebpiecesDefaultErrorClassifier,\n WEBPIECES_DEFAULT_ERROR_CLASSIFIER,\n} from './http/WebpiecesDefaultErrorClassifier';\nexport { templateDeriver } from './http/templateDeriver';\nexport { WebpiecesCoreHeaders } from './http/WebpiecesCoreHeaders';\nexport { ContextReader } from './http/ContextReader';\nexport { ContextWriter, ContextStore } from './http/ContextWriter';\n\n// The OUTBOUND half of the trust model: whether a TRUSTED context key may ride to the endpoint being\n// called. Built ONLY from the destination endpoint's AuthMode — see the class doc.\nexport { DestinationTrust } from './http/DestinationTrust';\n\n// BROWSER-ONLY outbound-header propagation (app-held store + registry -> outbound HTTP headers).\n// Only @webpieces/http-client-browser may name it; the server reads RequestContext directly via\n// RequestContextHeaders in the Node-only @webpieces/core-context.\nexport { ContextMgr } from './http/ContextMgr';\n\n// API-call logging helper (uses LogManager above). NOT a singleton: construct one per environment\n// with that environment's ApiCallContext — `new LogApiCallImpl(new RequestContextApiCallContext())`\n// on node, `new LogApiCallImpl(new BrowserApiCallContext())` in a browser.\nexport { LogApiCallImpl } from './http/LogApiCall';\n\n// Opt-in field masking for the LogApiCall log path — declare per-api sensitive fields so secrets\n// (OAuth refresh tokens, id-token JWTs) are masked in the logs while the real value stays on the wire.\nexport { MaskSpec } from './http/LogFieldMask';\nexport type { MaskMode } from './http/LogFieldMask';\n\n// The structured `api` tag + the context-writer seam LogApiCall stamps through. The Node\n// RequestContext-backed impl lives in @webpieces/core-context, the browser one in\n// @webpieces/http-client-browser; each is CONSTRUCTED by its package, never installed globally.\nexport { ApiCallInfo } from './http/ApiCallInfo';\nexport type { ApiCallDirection, ApiResult } from './http/ApiCallInfo';\n// Console-render bridge: turns LogApiCall's [LogApiCall] bracket into [API.{side}.{phase}] locally.\nexport {\n ApiCallLogName,\n ApiCallLogNameImpl,\n LOG_API_CALL_LOGGER_NAME,\n} from './http/ApiCallLogName';\nexport { ApiMethodInfo } from './http/ApiMethodInfo';\nexport type { ApiSide } from './http/ApiMethodInfo';\nexport type { ApiCallContext } from './http/ApiCallContext';\n\n// Test-case recording contract (impl lives in http-server; hooks in http-client)\nexport { TestCaseRecorder, RecorderKeys } from './http/recorder/TestCaseRecorder';\nexport {\n RecordedEndpoint,\n RecordedError,\n RecordedTestCase,\n} from './http/recorder/RecordedEndpoint';\nexport { DoNotRecord, getDoNotRecordFields } from './http/recorder/DoNotRecord';\nexport { RecordSerializer, SerializedMap, SerializedError } from './http/recorder/RecordSerializer';\n\n// ---------------------------------------------------------------------------------------------\n// Filter-chain primitives, shared by BOTH chains: the inbound server chain\n// (`Filter<MethodMeta, WpResponse<unknown>>`, @webpieces/http-routing) and the outbound client\n// chain (`Filter<ClientRequest, Response>`, @webpieces/http-client-core). Declared once, here, in\n// the package both depend on — see the class doc for why a second pair would be a shim.\nexport { Filter } from './filters/Filter';\nexport type { Service } from './filters/Filter';\nexport { FilterChain } from './filters/FilterChain';\n\nexport {\n ApiError,\n ApiNotFoundError,\n ApiDependencyError,\n ApiBadGatewayError,\n ApiUnavailableError,\n ApiDependencyTimeoutError,\n ApiImplementationError,\n ApiRateLimitedError,\n ApiForbiddenError,\n ApiRequestTimeoutError,\n ApiEndUserError,\n ApiBadRequestError,\n ApiUnauthorizedError,\n ApiDependencyBackoffError,\n ApiRetriesExhaustedError,\n ApiConnectionError,\n ApiEndpointNotFoundError,\n ApiConflictError,\n ApiUnprocessableError,\n ApiPreconditionFailedError,\n ApiUnsupportedMediaTypeError,\n ApiNotImplementedError,\n ApiCodedError,\n ApiClientTooOldError,\n ApiEndUserNotFoundError,\n ApiEndUserForbiddenError,\n ApiEndUserBadRequestError,\n EndUserErrorCode,\n EndUserErrorRegistry,\n ClientRole,\n ApiErrorCodec,\n ApiErrorPayload,\n ApiErrorBoundary,\n ApiCallSite,\n ReportableApiFailure,\n RpcCallFailed,\n} from './errors';\nexport type {\n ApiErrorKind,\n ApiStatusCode,\n EdgeHttpStatus,\n EndUserErrorFactory,\n CallSiteBoundary,\n} from './errors';\nexport { ApiErrorHttpStatus } from './http/ApiErrorHttpStatus';\n\n// RFC 6749 / 6750 / 7591 OAuth refusals for app-hosted OAuth endpoints (#1176): the typed error,\n// its one renderer, the Bearer challenge builder and the authorization-endpoint error redirect.\nexport { OAuthErrorCode, OAuthErrorStatus, OAuthText } from './oauth/OAuthErrorCode';\nexport type {\n OAuthHttpStatus,\n InvalidClientStatus,\n OAuthFixedStatusErrorCode,\n BearerErrorCode,\n AuthorizationEndpointErrorCode,\n} from './oauth/OAuthErrorCode';\nexport { OAuthProtocolError, OAuthErrorExtras } from './oauth/OAuthProtocolError';\nexport { OAuthBearerChallenge } from './oauth/OAuthBearerChallenge';\nexport { OAuthErrorBody, OAuthErrorResponse } from './oauth/OAuthErrorResponse';\nexport { OAuthAuthorizationErrorRedirect } from './oauth/OAuthAuthorizationErrorRedirect';\nexport type { PublishedKind, PublishedApiError } from './http/ApiErrorHttpStatus';\n\nexport { Mcp, McpToolProfilesOptions } from './mcp/Mcp';\nexport type { McpToolProfiles } from './mcp/Mcp';\n"]}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ApiMethodInfo } from './ApiMethodInfo';
|
|
2
|
-
/**
|
|
3
|
-
* Decides whether a thrown API-call error is a real FAILURE — the process not working, SURFACE it
|
|
4
|
-
* (LogApiCall logs `[API-*-resp-FAIL]`, `jsonPayload.api.result='failure'` — what dashboards/alerts
|
|
5
|
-
* count) — or an EXPECTED non-failure — the process working correctly, a handled condition
|
|
6
|
-
* (`[API-*-resp-OTHER]`, `result='success'`).
|
|
7
|
-
*
|
|
8
|
-
* This is BEHAVIOR, so it is an interface (per CLAUDE.md), passed as an object with a NAMED method
|
|
9
|
-
* rather than a bare function — so "find usages" in an IDE lands on every implementation.
|
|
10
|
-
*
|
|
11
|
-
* Registered on {@link ClientRegistry} at startup — the same browser-safe, no-DI, populated-once
|
|
12
|
-
* singleton that owns URL mappings and {@link ErrorTranslator}. TWO tiers, resolved most-specific
|
|
13
|
-
* first (see {@link ClientRegistry.classifyFailure}):
|
|
14
|
-
*
|
|
15
|
-
* 1. `ClientRegistry.setDefaultFailureClassifier(c)` — ONE per app/company. It reads
|
|
16
|
-
* {@link ApiMethodInfo.side}, so a single strategy covers the SERVER router AND all INTERNAL
|
|
17
|
-
* clients (webpieces http client, cloud tasks). Optional: if unset, webpieces uses
|
|
18
|
-
* {@link WebpiecesDefaultFailureClassifier} (server 4xx = non-failure; client non-266 = failure).
|
|
19
|
-
* 2. `ClientRegistry.addFailureClassifier(apiClass, c)` — per EXTERNAL client, keyed by
|
|
20
|
-
* {@link ApiMethodInfo.apiClass} ('FirestoreAdminClient', 'ClaudeApi', 'TwilioApi'). Each external
|
|
21
|
-
* API qualifies errors differently (a Firestore 404 miss, a Twilio 429 retry are EXPECTED, not
|
|
22
|
-
* failures), so it overrides the default for that apiClass only.
|
|
23
|
-
*
|
|
24
|
-
* Internal clients and the server register NOTHING — the ABSENCE of an apiClass entry is the signal;
|
|
25
|
-
* they fall through to tier 1. An external client that forgets to register is FAIL-SAFE: it also
|
|
26
|
-
* falls to tier 1 (client side ⇒ every non-266 = failure) until it opts in.
|
|
27
|
-
*/
|
|
28
|
-
export interface FailureClassifier {
|
|
29
|
-
/**
|
|
30
|
-
* @param error - the already-normalized thrown error (callers pass `toError(err)`)
|
|
31
|
-
* @param methodInfo - the call identity; `side` distinguishes server/client, `apiClass` the client
|
|
32
|
-
* @returns `true` = real failure; `false` = expected/non-failure; `undefined` = DEFER
|
|
33
|
-
* (a per-apiClass classifier defers to the app default; the app default defers to the
|
|
34
|
-
* webpieces built-in). Deferring is what makes classifiers additive AND override-capable.
|
|
35
|
-
*/
|
|
36
|
-
isFailure(error: Error, methodInfo: ApiMethodInfo): boolean | undefined;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* A per-external-client registration pair: the {@link ApiMethodInfo.apiClass} to key on, and the
|
|
40
|
-
* {@link FailureClassifier} to apply for it. A data-only structure, so it is a class (not an inline
|
|
41
|
-
* object literal), per CLAUDE.md — lets startup wiring carry a list of these and hand each to
|
|
42
|
-
* {@link ClientRegistry.addFailureClassifier}.
|
|
43
|
-
*/
|
|
44
|
-
export declare class KeyedFailureClassifier {
|
|
45
|
-
readonly apiClass: string;
|
|
46
|
-
readonly classifier: FailureClassifier;
|
|
47
|
-
constructor(apiClass: string, classifier: FailureClassifier);
|
|
48
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KeyedFailureClassifier = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A per-external-client registration pair: the {@link ApiMethodInfo.apiClass} to key on, and the
|
|
6
|
-
* {@link FailureClassifier} to apply for it. A data-only structure, so it is a class (not an inline
|
|
7
|
-
* object literal), per CLAUDE.md — lets startup wiring carry a list of these and hand each to
|
|
8
|
-
* {@link ClientRegistry.addFailureClassifier}.
|
|
9
|
-
*/
|
|
10
|
-
class KeyedFailureClassifier {
|
|
11
|
-
apiClass;
|
|
12
|
-
classifier;
|
|
13
|
-
constructor(apiClass, classifier) {
|
|
14
|
-
this.apiClass = apiClass;
|
|
15
|
-
this.classifier = classifier;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.KeyedFailureClassifier = KeyedFailureClassifier;
|
|
19
|
-
//# sourceMappingURL=FailureClassifier.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FailureClassifier.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/FailureClassifier.ts"],"names":[],"mappings":";;;AAuCA;;;;;GAKG;AACH,MAAa,sBAAsB;IAEX;IACA;IAFpB,YACoB,QAAgB,EAChB,UAA6B;QAD7B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,eAAU,GAAV,UAAU,CAAmB;IAC9C,CAAC;CACP;AALD,wDAKC","sourcesContent":["import { ApiMethodInfo } from './ApiMethodInfo';\n\n/**\n * Decides whether a thrown API-call error is a real FAILURE — the process not working, SURFACE it\n * (LogApiCall logs `[API-*-resp-FAIL]`, `jsonPayload.api.result='failure'` — what dashboards/alerts\n * count) — or an EXPECTED non-failure — the process working correctly, a handled condition\n * (`[API-*-resp-OTHER]`, `result='success'`).\n *\n * This is BEHAVIOR, so it is an interface (per CLAUDE.md), passed as an object with a NAMED method\n * rather than a bare function — so \"find usages\" in an IDE lands on every implementation.\n *\n * Registered on {@link ClientRegistry} at startup — the same browser-safe, no-DI, populated-once\n * singleton that owns URL mappings and {@link ErrorTranslator}. TWO tiers, resolved most-specific\n * first (see {@link ClientRegistry.classifyFailure}):\n *\n * 1. `ClientRegistry.setDefaultFailureClassifier(c)` — ONE per app/company. It reads\n * {@link ApiMethodInfo.side}, so a single strategy covers the SERVER router AND all INTERNAL\n * clients (webpieces http client, cloud tasks). Optional: if unset, webpieces uses\n * {@link WebpiecesDefaultFailureClassifier} (server 4xx = non-failure; client non-266 = failure).\n * 2. `ClientRegistry.addFailureClassifier(apiClass, c)` — per EXTERNAL client, keyed by\n * {@link ApiMethodInfo.apiClass} ('FirestoreAdminClient', 'ClaudeApi', 'TwilioApi'). Each external\n * API qualifies errors differently (a Firestore 404 miss, a Twilio 429 retry are EXPECTED, not\n * failures), so it overrides the default for that apiClass only.\n *\n * Internal clients and the server register NOTHING — the ABSENCE of an apiClass entry is the signal;\n * they fall through to tier 1. An external client that forgets to register is FAIL-SAFE: it also\n * falls to tier 1 (client side ⇒ every non-266 = failure) until it opts in.\n */\nexport interface FailureClassifier {\n /**\n * @param error - the already-normalized thrown error (callers pass `toError(err)`)\n * @param methodInfo - the call identity; `side` distinguishes server/client, `apiClass` the client\n * @returns `true` = real failure; `false` = expected/non-failure; `undefined` = DEFER\n * (a per-apiClass classifier defers to the app default; the app default defers to the\n * webpieces built-in). Deferring is what makes classifiers additive AND override-capable.\n */\n isFailure(error: Error, methodInfo: ApiMethodInfo): boolean | undefined;\n}\n\n/**\n * A per-external-client registration pair: the {@link ApiMethodInfo.apiClass} to key on, and the\n * {@link FailureClassifier} to apply for it. A data-only structure, so it is a class (not an inline\n * object literal), per CLAUDE.md — lets startup wiring carry a list of these and hand each to\n * {@link ClientRegistry.addFailureClassifier}.\n */\nexport class KeyedFailureClassifier {\n constructor(\n public readonly apiClass: string,\n public readonly classifier: FailureClassifier,\n ) {}\n}\n"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ApiMethodInfo } from './ApiMethodInfo';
|
|
2
|
-
import { FailureClassifier } from './FailureClassifier';
|
|
3
|
-
/**
|
|
4
|
-
* The webpieces built-in {@link FailureClassifier} — the terminal tier, used when no app default and
|
|
5
|
-
* no per-apiClass classifier claims an error. It is the SINGLE SOURCE OF TRUTH for the historical
|
|
6
|
-
* `LogApiCall.isUserError` behavior (which now delegates here), so the classification lives in one
|
|
7
|
-
* place.
|
|
8
|
-
*
|
|
9
|
-
* The question is "are things WORKING?", NOT "was it an HTTP 4xx vs 5xx" — the two differ (see 408).
|
|
10
|
-
* Classification is by portable Error TYPE, never by transport: this runs over in-process calls,
|
|
11
|
-
* pubsub/queue handlers, and HTTP through one code path and only ever sees a thrown Error. The API
|
|
12
|
-
* classes are portable error types that travel with the throw anywhere, so matching the TYPE works
|
|
13
|
-
* with or without any HTTP in the picture.
|
|
14
|
-
*
|
|
15
|
-
* SERVER — a healthy server correctly rejecting a CLIENT'S mistake is metrics NOISE, not a failure:
|
|
16
|
-
* - ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403),
|
|
17
|
-
* ApiNotFoundError (404), ApiConflictError (409), ApiPreconditionFailedError (412),
|
|
18
|
-
* ApiUnsupportedMediaTypeError (415), ApiUnprocessableError (422), and an ApiCodedError whose
|
|
19
|
-
* `isCallerError()` is true (below 500, except 408/429), and an OAuthProtocolError below 500 (a
|
|
20
|
-
* refused grant or token is the OAuth protocol working, #1176) → the server is fine, the caller
|
|
21
|
-
* erred → NON-failure.
|
|
22
|
-
* SERVER — something may actually be WRONG, so SURFACE it (failure):
|
|
23
|
-
* - ApiRequestTimeoutError (408): a 4xx, but the client may NEVER have seen the response — deliberately
|
|
24
|
-
* absent below, so it counts as a failure. Implementation/dependency failures, ApiNotImplementedError
|
|
25
|
-
* (501), an ApiCodedError of 500+ (or 408/429), and non-API errors are failures.
|
|
26
|
-
*
|
|
27
|
-
* ApiEndUserError (266): ALWAYS a non-failure, server OR client — an expected "user made a mistake".
|
|
28
|
-
* CLIENT: receiving ANY error except 266 means the outbound call FAILED → failure.
|
|
29
|
-
*/
|
|
30
|
-
export declare class WebpiecesDefaultFailureClassifier implements FailureClassifier {
|
|
31
|
-
/**
|
|
32
|
-
* Terminal tier — NEVER returns undefined (a definitive verdict is required so classification
|
|
33
|
-
* always resolves to a boolean).
|
|
34
|
-
*
|
|
35
|
-
* @returns true = failure, false = expected/non-failure
|
|
36
|
-
*/
|
|
37
|
-
isFailure(error: Error, methodInfo: ApiMethodInfo): boolean;
|
|
38
|
-
}
|
|
39
|
-
/** Process-wide built-in instance — stateless, so one shared instance is enough. */
|
|
40
|
-
export declare const WEBPIECES_DEFAULT_FAILURE_CLASSIFIER: WebpiecesDefaultFailureClassifier;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBPIECES_DEFAULT_FAILURE_CLASSIFIER = exports.WebpiecesDefaultFailureClassifier = void 0;
|
|
4
|
-
const ApiError_1 = require("../errors/ApiError");
|
|
5
|
-
const OAuthProtocolError_1 = require("../oauth/OAuthProtocolError");
|
|
6
|
-
/**
|
|
7
|
-
* The webpieces built-in {@link FailureClassifier} — the terminal tier, used when no app default and
|
|
8
|
-
* no per-apiClass classifier claims an error. It is the SINGLE SOURCE OF TRUTH for the historical
|
|
9
|
-
* `LogApiCall.isUserError` behavior (which now delegates here), so the classification lives in one
|
|
10
|
-
* place.
|
|
11
|
-
*
|
|
12
|
-
* The question is "are things WORKING?", NOT "was it an HTTP 4xx vs 5xx" — the two differ (see 408).
|
|
13
|
-
* Classification is by portable Error TYPE, never by transport: this runs over in-process calls,
|
|
14
|
-
* pubsub/queue handlers, and HTTP through one code path and only ever sees a thrown Error. The API
|
|
15
|
-
* classes are portable error types that travel with the throw anywhere, so matching the TYPE works
|
|
16
|
-
* with or without any HTTP in the picture.
|
|
17
|
-
*
|
|
18
|
-
* SERVER — a healthy server correctly rejecting a CLIENT'S mistake is metrics NOISE, not a failure:
|
|
19
|
-
* - ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403),
|
|
20
|
-
* ApiNotFoundError (404), ApiConflictError (409), ApiPreconditionFailedError (412),
|
|
21
|
-
* ApiUnsupportedMediaTypeError (415), ApiUnprocessableError (422), and an ApiCodedError whose
|
|
22
|
-
* `isCallerError()` is true (below 500, except 408/429), and an OAuthProtocolError below 500 (a
|
|
23
|
-
* refused grant or token is the OAuth protocol working, #1176) → the server is fine, the caller
|
|
24
|
-
* erred → NON-failure.
|
|
25
|
-
* SERVER — something may actually be WRONG, so SURFACE it (failure):
|
|
26
|
-
* - ApiRequestTimeoutError (408): a 4xx, but the client may NEVER have seen the response — deliberately
|
|
27
|
-
* absent below, so it counts as a failure. Implementation/dependency failures, ApiNotImplementedError
|
|
28
|
-
* (501), an ApiCodedError of 500+ (or 408/429), and non-API errors are failures.
|
|
29
|
-
*
|
|
30
|
-
* ApiEndUserError (266): ALWAYS a non-failure, server OR client — an expected "user made a mistake".
|
|
31
|
-
* CLIENT: receiving ANY error except 266 means the outbound call FAILED → failure.
|
|
32
|
-
*/
|
|
33
|
-
class WebpiecesDefaultFailureClassifier {
|
|
34
|
-
/**
|
|
35
|
-
* Terminal tier — NEVER returns undefined (a definitive verdict is required so classification
|
|
36
|
-
* always resolves to a boolean).
|
|
37
|
-
*
|
|
38
|
-
* @returns true = failure, false = expected/non-failure
|
|
39
|
-
*/
|
|
40
|
-
isFailure(error, methodInfo) {
|
|
41
|
-
// 266 is the one error that is never a failure, on either side.
|
|
42
|
-
if (error instanceof ApiError_1.ApiEndUserError) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
// A client that RECEIVED any error (except the 266 above) made a failed call.
|
|
46
|
-
if (methodInfo.side !== 'server') {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
// SERVER: only a healthy rejection of the caller's mistake is a non-failure. Note 408
|
|
50
|
-
// (ApiRequestTimeoutError) is intentionally NOT here — the client may never have seen the response.
|
|
51
|
-
const healthyRejection = error instanceof ApiError_1.ApiBadRequestError ||
|
|
52
|
-
error instanceof ApiError_1.ApiUnauthorizedError ||
|
|
53
|
-
error instanceof ApiError_1.ApiForbiddenError ||
|
|
54
|
-
error instanceof ApiError_1.ApiNotFoundError ||
|
|
55
|
-
error instanceof ApiError_1.ApiConflictError ||
|
|
56
|
-
error instanceof ApiError_1.ApiUnprocessableError ||
|
|
57
|
-
error instanceof ApiError_1.ApiPreconditionFailedError ||
|
|
58
|
-
error instanceof ApiError_1.ApiUnsupportedMediaTypeError ||
|
|
59
|
-
(error instanceof ApiError_1.ApiCodedError && error.isCallerError()) ||
|
|
60
|
-
(error instanceof OAuthProtocolError_1.OAuthProtocolError && error.isCallerError());
|
|
61
|
-
return !healthyRejection;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.WebpiecesDefaultFailureClassifier = WebpiecesDefaultFailureClassifier;
|
|
65
|
-
/** Process-wide built-in instance — stateless, so one shared instance is enough. */
|
|
66
|
-
exports.WEBPIECES_DEFAULT_FAILURE_CLASSIFIER = new WebpiecesDefaultFailureClassifier();
|
|
67
|
-
//# sourceMappingURL=WebpiecesDefaultFailureClassifier.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebpiecesDefaultFailureClassifier.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/WebpiecesDefaultFailureClassifier.ts"],"names":[],"mappings":";;;AAAA,iDAW4B;AAC5B,oEAAiE;AAIjE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,iCAAiC;IAC1C;;;;;OAKG;IACH,SAAS,CAAC,KAAY,EAAE,UAAyB;QAC7C,gEAAgE;QAChE,IAAI,KAAK,YAAY,0BAAe,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,8EAA8E;QAC9E,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,sFAAsF;QACtF,oGAAoG;QACpG,MAAM,gBAAgB,GAClB,KAAK,YAAY,6BAAkB;YACnC,KAAK,YAAY,+BAAoB;YACrC,KAAK,YAAY,4BAAiB;YAClC,KAAK,YAAY,2BAAgB;YACjC,KAAK,YAAY,2BAAgB;YACjC,KAAK,YAAY,gCAAqB;YACtC,KAAK,YAAY,qCAA0B;YAC3C,KAAK,YAAY,uCAA4B;YAC7C,CAAC,KAAK,YAAY,wBAAa,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACzD,CAAC,KAAK,YAAY,uCAAkB,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;QACnE,OAAO,CAAC,gBAAgB,CAAC;IAC7B,CAAC;CACJ;AA/BD,8EA+BC;AAED,oFAAoF;AACvE,QAAA,oCAAoC,GAAG,IAAI,iCAAiC,EAAE,CAAC","sourcesContent":["import {\n ApiBadRequestError,\n ApiUnauthorizedError,\n ApiForbiddenError,\n ApiNotFoundError,\n ApiEndUserError,\n ApiConflictError,\n ApiUnprocessableError,\n ApiPreconditionFailedError,\n ApiUnsupportedMediaTypeError,\n ApiCodedError,\n} from '../errors/ApiError';\nimport { OAuthProtocolError } from '../oauth/OAuthProtocolError';\nimport { ApiMethodInfo } from './ApiMethodInfo';\nimport { FailureClassifier } from './FailureClassifier';\n\n/**\n * The webpieces built-in {@link FailureClassifier} — the terminal tier, used when no app default and\n * no per-apiClass classifier claims an error. It is the SINGLE SOURCE OF TRUTH for the historical\n * `LogApiCall.isUserError` behavior (which now delegates here), so the classification lives in one\n * place.\n *\n * The question is \"are things WORKING?\", NOT \"was it an HTTP 4xx vs 5xx\" — the two differ (see 408).\n * Classification is by portable Error TYPE, never by transport: this runs over in-process calls,\n * pubsub/queue handlers, and HTTP through one code path and only ever sees a thrown Error. The API\n * classes are portable error types that travel with the throw anywhere, so matching the TYPE works\n * with or without any HTTP in the picture.\n *\n * SERVER — a healthy server correctly rejecting a CLIENT'S mistake is metrics NOISE, not a failure:\n * - ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403),\n * ApiNotFoundError (404), ApiConflictError (409), ApiPreconditionFailedError (412),\n * ApiUnsupportedMediaTypeError (415), ApiUnprocessableError (422), and an ApiCodedError whose\n * `isCallerError()` is true (below 500, except 408/429), and an OAuthProtocolError below 500 (a\n * refused grant or token is the OAuth protocol working, #1176) → the server is fine, the caller\n * erred → NON-failure.\n * SERVER — something may actually be WRONG, so SURFACE it (failure):\n * - ApiRequestTimeoutError (408): a 4xx, but the client may NEVER have seen the response — deliberately\n * absent below, so it counts as a failure. Implementation/dependency failures, ApiNotImplementedError\n * (501), an ApiCodedError of 500+ (or 408/429), and non-API errors are failures.\n *\n * ApiEndUserError (266): ALWAYS a non-failure, server OR client — an expected \"user made a mistake\".\n * CLIENT: receiving ANY error except 266 means the outbound call FAILED → failure.\n */\nexport class WebpiecesDefaultFailureClassifier implements FailureClassifier {\n /**\n * Terminal tier — NEVER returns undefined (a definitive verdict is required so classification\n * always resolves to a boolean).\n *\n * @returns true = failure, false = expected/non-failure\n */\n isFailure(error: Error, methodInfo: ApiMethodInfo): boolean {\n // 266 is the one error that is never a failure, on either side.\n if (error instanceof ApiEndUserError) {\n return false;\n }\n // A client that RECEIVED any error (except the 266 above) made a failed call.\n if (methodInfo.side !== 'server') {\n return true;\n }\n // SERVER: only a healthy rejection of the caller's mistake is a non-failure. Note 408\n // (ApiRequestTimeoutError) is intentionally NOT here — the client may never have seen the response.\n const healthyRejection =\n error instanceof ApiBadRequestError ||\n error instanceof ApiUnauthorizedError ||\n error instanceof ApiForbiddenError ||\n error instanceof ApiNotFoundError ||\n error instanceof ApiConflictError ||\n error instanceof ApiUnprocessableError ||\n error instanceof ApiPreconditionFailedError ||\n error instanceof ApiUnsupportedMediaTypeError ||\n (error instanceof ApiCodedError && error.isCallerError()) ||\n (error instanceof OAuthProtocolError && error.isCallerError());\n return !healthyRejection;\n }\n}\n\n/** Process-wide built-in instance — stateless, so one shared instance is enough. */\nexport const WEBPIECES_DEFAULT_FAILURE_CLASSIFIER = new WebpiecesDefaultFailureClassifier();\n"]}
|