@webpieces/core-util 0.4.879 → 0.4.881

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 (78) hide show
  1. package/package.json +1 -1
  2. package/src/errors/ApiCallSite.d.ts +58 -0
  3. package/src/errors/ApiCallSite.js +96 -0
  4. package/src/errors/ApiCallSite.js.map +1 -0
  5. package/src/errors/ApiError.d.ts +47 -0
  6. package/src/errors/ApiError.js +46 -1
  7. package/src/errors/ApiError.js.map +1 -1
  8. package/src/errors/ApiErrorCodec.js +9 -2
  9. package/src/errors/ApiErrorCodec.js.map +1 -1
  10. package/src/errors/ClientRole.d.ts +27 -0
  11. package/src/errors/ClientRole.js +32 -0
  12. package/src/errors/ClientRole.js.map +1 -0
  13. package/src/errors/EndUserErrorCode.d.ts +22 -0
  14. package/src/errors/EndUserErrorCode.js +38 -0
  15. package/src/errors/EndUserErrorCode.js.map +1 -0
  16. package/src/errors/EndUserErrorRegistry.d.ts +61 -0
  17. package/src/errors/EndUserErrorRegistry.js +103 -0
  18. package/src/errors/EndUserErrorRegistry.js.map +1 -0
  19. package/src/errors/EndUserErrors.d.ts +28 -0
  20. package/src/errors/EndUserErrors.js +59 -0
  21. package/src/errors/EndUserErrors.js.map +1 -0
  22. package/src/errors/ReceivedApiErrorRule.d.ts +33 -3
  23. package/src/errors/ReceivedApiErrorRule.js +47 -8
  24. package/src/errors/ReceivedApiErrorRule.js.map +1 -1
  25. package/src/errors/ReportableApiFailure.d.ts +43 -0
  26. package/src/errors/ReportableApiFailure.js +75 -0
  27. package/src/errors/ReportableApiFailure.js.map +1 -0
  28. package/src/errors/index.d.ts +9 -1
  29. package/src/errors/index.js +17 -1
  30. package/src/errors/index.js.map +1 -1
  31. package/src/http/ContextMgr.d.ts +1 -1
  32. package/src/http/ContextMgr.js +1 -1
  33. package/src/http/ContextMgr.js.map +1 -1
  34. package/src/http/ErrorTranslator.d.ts +10 -4
  35. package/src/http/ErrorTranslator.js.map +1 -1
  36. package/src/http/HttpEndpointOptions.d.ts +8 -0
  37. package/src/http/HttpEndpointOptions.js.map +1 -1
  38. package/src/http/StreamErrorControl.d.ts +3 -1
  39. package/src/http/StreamErrorControl.js +4 -3
  40. package/src/http/StreamErrorControl.js.map +1 -1
  41. package/src/http/WebpiecesDefaultErrorTranslator.d.ts +13 -2
  42. package/src/http/WebpiecesDefaultErrorTranslator.js +21 -3
  43. package/src/http/WebpiecesDefaultErrorTranslator.js.map +1 -1
  44. package/src/http/WebpiecesDefaultFailureClassifier.d.ts +3 -2
  45. package/src/http/WebpiecesDefaultFailureClassifier.js +6 -3
  46. package/src/http/WebpiecesDefaultFailureClassifier.js.map +1 -1
  47. package/src/index.d.ts +8 -2
  48. package/src/index.js +27 -1
  49. package/src/index.js.map +1 -1
  50. package/src/ipc/IpcErrorTranslator.d.ts +6 -2
  51. package/src/ipc/IpcErrorTranslator.js.map +1 -1
  52. package/src/ipc/IpcRegistry.d.ts +4 -1
  53. package/src/ipc/IpcRegistry.js +5 -3
  54. package/src/ipc/IpcRegistry.js.map +1 -1
  55. package/src/ipc/WebpiecesDefaultIpcErrorTranslator.d.ts +6 -2
  56. package/src/ipc/WebpiecesDefaultIpcErrorTranslator.js +6 -3
  57. package/src/ipc/WebpiecesDefaultIpcErrorTranslator.js.map +1 -1
  58. package/src/ipc/index.d.ts +1 -0
  59. package/src/ipc/index.js +3 -1
  60. package/src/ipc/index.js.map +1 -1
  61. package/src/oauth/OAuthAuthorizationErrorRedirect.d.ts +37 -0
  62. package/src/oauth/OAuthAuthorizationErrorRedirect.js +61 -0
  63. package/src/oauth/OAuthAuthorizationErrorRedirect.js.map +1 -0
  64. package/src/oauth/OAuthBearerChallenge.d.ts +31 -0
  65. package/src/oauth/OAuthBearerChallenge.js +52 -0
  66. package/src/oauth/OAuthBearerChallenge.js.map +1 -0
  67. package/src/oauth/OAuthErrorCode.d.ts +69 -0
  68. package/src/oauth/OAuthErrorCode.js +89 -0
  69. package/src/oauth/OAuthErrorCode.js.map +1 -0
  70. package/src/oauth/OAuthErrorResponse.d.ts +34 -0
  71. package/src/oauth/OAuthErrorResponse.js +74 -0
  72. package/src/oauth/OAuthErrorResponse.js.map +1 -0
  73. package/src/oauth/OAuthProtocolError.d.ts +61 -0
  74. package/src/oauth/OAuthProtocolError.js +83 -0
  75. package/src/oauth/OAuthProtocolError.js.map +1 -0
  76. package/src/oauth/OAuthProtocolErrorCompileAssertions.d.ts +10 -0
  77. package/src/oauth/OAuthProtocolErrorCompileAssertions.js +39 -0
  78. package/src/oauth/OAuthProtocolErrorCompileAssertions.js.map +1 -0
@@ -16,8 +16,9 @@ import { FailureClassifier } from './FailureClassifier';
16
16
  * - ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403),
17
17
  * ApiNotFoundError (404), ApiConflictError (409), ApiPreconditionFailedError (412),
18
18
  * ApiUnsupportedMediaTypeError (415), ApiUnprocessableError (422), and an ApiCodedError whose
19
- * `isCallerError()` is true (below 500, except 408/429) → the server is fine, the caller erred →
20
- * NON-failure.
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.
21
22
  * SERVER — something may actually be WRONG, so SURFACE it (failure):
22
23
  * - ApiRequestTimeoutError (408): a 4xx, but the client may NEVER have seen the response — deliberately
23
24
  * absent below, so it counts as a failure. Implementation/dependency failures, ApiNotImplementedError
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WEBPIECES_DEFAULT_FAILURE_CLASSIFIER = exports.WebpiecesDefaultFailureClassifier = void 0;
4
4
  const ApiError_1 = require("../errors/ApiError");
5
+ const OAuthProtocolError_1 = require("../oauth/OAuthProtocolError");
5
6
  /**
6
7
  * The webpieces built-in {@link FailureClassifier} — the terminal tier, used when no app default and
7
8
  * no per-apiClass classifier claims an error. It is the SINGLE SOURCE OF TRUTH for the historical
@@ -18,8 +19,9 @@ const ApiError_1 = require("../errors/ApiError");
18
19
  * - ApiBadRequestError (400), ApiUnauthorizedError (401), ApiForbiddenError (403),
19
20
  * ApiNotFoundError (404), ApiConflictError (409), ApiPreconditionFailedError (412),
20
21
  * ApiUnsupportedMediaTypeError (415), ApiUnprocessableError (422), and an ApiCodedError whose
21
- * `isCallerError()` is true (below 500, except 408/429) → the server is fine, the caller erred →
22
- * NON-failure.
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.
23
25
  * SERVER — something may actually be WRONG, so SURFACE it (failure):
24
26
  * - ApiRequestTimeoutError (408): a 4xx, but the client may NEVER have seen the response — deliberately
25
27
  * absent below, so it counts as a failure. Implementation/dependency failures, ApiNotImplementedError
@@ -54,7 +56,8 @@ class WebpiecesDefaultFailureClassifier {
54
56
  error instanceof ApiError_1.ApiUnprocessableError ||
55
57
  error instanceof ApiError_1.ApiPreconditionFailedError ||
56
58
  error instanceof ApiError_1.ApiUnsupportedMediaTypeError ||
57
- (error instanceof ApiError_1.ApiCodedError && error.isCallerError());
59
+ (error instanceof ApiError_1.ApiCodedError && error.isCallerError()) ||
60
+ (error instanceof OAuthProtocolError_1.OAuthProtocolError && error.isCallerError());
58
61
  return !healthyRejection;
59
62
  }
60
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WebpiecesDefaultFailureClassifier.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/http/WebpiecesDefaultFailureClassifier.ts"],"names":[],"mappings":";;;AAAA,iDAW4B;AAI5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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,CAAC;QAC9D,OAAO,CAAC,gBAAgB,CAAC;IAC7B,CAAC;CACJ;AA9BD,8EA8BC;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 { 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) → the server is fine, the caller erred →\n * 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 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"]}
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"]}
package/src/index.d.ts CHANGED
@@ -98,7 +98,13 @@ export { RecordSerializer, SerializedMap, SerializedError } from './http/recorde
98
98
  export { Filter } from './filters/Filter';
99
99
  export type { Service } from './filters/Filter';
100
100
  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, ApiErrorCodec, ApiErrorPayload, ApiErrorBoundary, } from './errors';
102
- export type { ApiErrorKind, ApiStatusCode, EdgeHttpStatus } from './errors';
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';
102
+ export type { ApiErrorKind, ApiStatusCode, EdgeHttpStatus, EndUserErrorFactory, CallSiteBoundary, } from './errors';
103
103
  export { ApiErrorHttpStatus } from './http/ApiErrorHttpStatus';
104
+ export { OAuthErrorCode, OAuthErrorStatus, OAuthText } from './oauth/OAuthErrorCode';
105
+ export type { OAuthHttpStatus, InvalidClientStatus, OAuthFixedStatusErrorCode, BearerErrorCode, AuthorizationEndpointErrorCode, } from './oauth/OAuthErrorCode';
106
+ export { OAuthProtocolError, OAuthErrorExtras } from './oauth/OAuthProtocolError';
107
+ export { OAuthBearerChallenge } from './oauth/OAuthBearerChallenge';
108
+ export { OAuthErrorBody, OAuthErrorResponse } from './oauth/OAuthErrorResponse';
109
+ export { OAuthAuthorizationErrorRedirect } from './oauth/OAuthAuthorizationErrorRedirect';
104
110
  export type { PublishedKind, PublishedApiError } from './http/ApiErrorHttpStatus';
package/src/index.js CHANGED
@@ -12,7 +12,7 @@ exports.MCP = exports.EXTERNAL_CUSTOMER = exports.SVC_TO_SVC = exports.ApiType =
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
14
  exports.ApiDependencyTimeoutError = exports.ApiUnavailableError = exports.ApiBadGatewayError = 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_FAILURE_CLASSIFIER = exports.WebpiecesDefaultFailureClassifier = exports.KeyedFailureClassifier = 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.CallRegistry = exports.ClientRegistry = exports.HeaderRegistry = exports.DateTimeUtil = exports.TimeUtil = exports.DateUtil = exports.InstantUtil = void 0;
15
- exports.ApiErrorHttpStatus = exports.ApiErrorBoundary = exports.ApiErrorPayload = exports.ApiErrorCodec = 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;
15
+ 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;
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");
@@ -344,9 +344,35 @@ Object.defineProperty(exports, "ApiPreconditionFailedError", { enumerable: true,
344
344
  Object.defineProperty(exports, "ApiUnsupportedMediaTypeError", { enumerable: true, get: function () { return errors_2.ApiUnsupportedMediaTypeError; } });
345
345
  Object.defineProperty(exports, "ApiNotImplementedError", { enumerable: true, get: function () { return errors_2.ApiNotImplementedError; } });
346
346
  Object.defineProperty(exports, "ApiCodedError", { enumerable: true, get: function () { return errors_2.ApiCodedError; } });
347
+ Object.defineProperty(exports, "ApiClientTooOldError", { enumerable: true, get: function () { return errors_2.ApiClientTooOldError; } });
348
+ Object.defineProperty(exports, "ApiEndUserNotFoundError", { enumerable: true, get: function () { return errors_2.ApiEndUserNotFoundError; } });
349
+ Object.defineProperty(exports, "ApiEndUserForbiddenError", { enumerable: true, get: function () { return errors_2.ApiEndUserForbiddenError; } });
350
+ Object.defineProperty(exports, "ApiEndUserBadRequestError", { enumerable: true, get: function () { return errors_2.ApiEndUserBadRequestError; } });
351
+ Object.defineProperty(exports, "EndUserErrorCode", { enumerable: true, get: function () { return errors_2.EndUserErrorCode; } });
352
+ Object.defineProperty(exports, "EndUserErrorRegistry", { enumerable: true, get: function () { return errors_2.EndUserErrorRegistry; } });
353
+ Object.defineProperty(exports, "ClientRole", { enumerable: true, get: function () { return errors_2.ClientRole; } });
347
354
  Object.defineProperty(exports, "ApiErrorCodec", { enumerable: true, get: function () { return errors_2.ApiErrorCodec; } });
348
355
  Object.defineProperty(exports, "ApiErrorPayload", { enumerable: true, get: function () { return errors_2.ApiErrorPayload; } });
349
356
  Object.defineProperty(exports, "ApiErrorBoundary", { enumerable: true, get: function () { return errors_2.ApiErrorBoundary; } });
357
+ Object.defineProperty(exports, "ApiCallSite", { enumerable: true, get: function () { return errors_2.ApiCallSite; } });
358
+ Object.defineProperty(exports, "ReportableApiFailure", { enumerable: true, get: function () { return errors_2.ReportableApiFailure; } });
359
+ Object.defineProperty(exports, "RpcCallFailed", { enumerable: true, get: function () { return errors_2.RpcCallFailed; } });
350
360
  var ApiErrorHttpStatus_1 = require("./http/ApiErrorHttpStatus");
351
361
  Object.defineProperty(exports, "ApiErrorHttpStatus", { enumerable: true, get: function () { return ApiErrorHttpStatus_1.ApiErrorHttpStatus; } });
362
+ // RFC 6749 / 6750 / 7591 OAuth refusals for app-hosted OAuth endpoints (#1176): the typed error,
363
+ // its one renderer, the Bearer challenge builder and the authorization-endpoint error redirect.
364
+ var OAuthErrorCode_1 = require("./oauth/OAuthErrorCode");
365
+ Object.defineProperty(exports, "OAuthErrorCode", { enumerable: true, get: function () { return OAuthErrorCode_1.OAuthErrorCode; } });
366
+ Object.defineProperty(exports, "OAuthErrorStatus", { enumerable: true, get: function () { return OAuthErrorCode_1.OAuthErrorStatus; } });
367
+ Object.defineProperty(exports, "OAuthText", { enumerable: true, get: function () { return OAuthErrorCode_1.OAuthText; } });
368
+ var OAuthProtocolError_1 = require("./oauth/OAuthProtocolError");
369
+ Object.defineProperty(exports, "OAuthProtocolError", { enumerable: true, get: function () { return OAuthProtocolError_1.OAuthProtocolError; } });
370
+ Object.defineProperty(exports, "OAuthErrorExtras", { enumerable: true, get: function () { return OAuthProtocolError_1.OAuthErrorExtras; } });
371
+ var OAuthBearerChallenge_1 = require("./oauth/OAuthBearerChallenge");
372
+ Object.defineProperty(exports, "OAuthBearerChallenge", { enumerable: true, get: function () { return OAuthBearerChallenge_1.OAuthBearerChallenge; } });
373
+ var OAuthErrorResponse_1 = require("./oauth/OAuthErrorResponse");
374
+ Object.defineProperty(exports, "OAuthErrorBody", { enumerable: true, get: function () { return OAuthErrorResponse_1.OAuthErrorBody; } });
375
+ Object.defineProperty(exports, "OAuthErrorResponse", { enumerable: true, get: function () { return OAuthErrorResponse_1.OAuthErrorResponse; } });
376
+ var OAuthAuthorizationErrorRedirect_1 = require("./oauth/OAuthAuthorizationErrorRedirect");
377
+ Object.defineProperty(exports, "OAuthAuthorizationErrorRedirect", { enumerable: true, get: function () { return OAuthAuthorizationErrorRedirect_1.OAuthAuthorizationErrorRedirect; } });
352
378
  //# sourceMappingURL=index.js.map
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,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AHtC,oHAAA,gBAAgB,OAAA;AAChB,iHAAA,aAAa,OAAA;AACb,oHAAA,gBAAgB,OAAA;AAEpB,2DAAgF;AAAvE,0GAAA,WAAW,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAC1C,qEAAoG;AAA3F,oHAAA,gBAAgB,OAAA;AAAE,iHAAA,aAAa,OAAA;AAAE,mHAAA,eAAe,OAAA;AAEzD,gGAAgG;AAChG,2EAA2E;AAC3E,+FAA+F;AAC/F,kGAAkG;AAClG,wFAAwF;AACxF,2CAA0C;AAAjC,gGAAA,MAAM,OAAA;AAEf,qDAAoD;AAA3C,0GAAA,WAAW,OAAA;AAEpB,mCA0BkB;AAzBd,kGAAA,QAAQ,OAAA;AACR,0GAAA,gBAAgB,OAAA;AAChB,4GAAA,kBAAkB,OAAA;AAClB,4GAAA,kBAAkB,OAAA;AAClB,6GAAA,mBAAmB,OAAA;AACnB,mHAAA,yBAAyB,OAAA;AACzB,gHAAA,sBAAsB,OAAA;AACtB,6GAAA,mBAAmB,OAAA;AACnB,2GAAA,iBAAiB,OAAA;AACjB,gHAAA,sBAAsB,OAAA;AACtB,yGAAA,eAAe,OAAA;AACf,4GAAA,kBAAkB,OAAA;AAClB,8GAAA,oBAAoB,OAAA;AACpB,mHAAA,yBAAyB,OAAA;AACzB,4GAAA,kBAAkB,OAAA;AAClB,kHAAA,wBAAwB,OAAA;AACxB,0GAAA,gBAAgB,OAAA;AAChB,+GAAA,qBAAqB,OAAA;AACrB,oHAAA,0BAA0B,OAAA;AAC1B,sHAAA,4BAA4B,OAAA;AAC5B,gHAAA,sBAAsB,OAAA;AACtB,uGAAA,aAAa,OAAA;AACb,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,0GAAA,gBAAgB,OAAA;AAGpB,gEAA+D;AAAtD,wHAAA,kBAAkB,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 ApiErrorCodec,\n ApiErrorPayload,\n ApiErrorBoundary,\n} from './errors';\nexport type { ApiErrorKind, ApiStatusCode, EdgeHttpStatus } from './errors';\nexport { ApiErrorHttpStatus } from './http/ApiErrorHttpStatus';\nexport type { PublishedKind, PublishedApiError } from './http/ApiErrorHttpStatus';\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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BAAkB,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","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"]}
@@ -1,4 +1,5 @@
1
1
  import { ApiErrorPayload } from '../errors/ApiErrorCodec';
2
+ import { ClientRole } from '../errors/ClientRole';
2
3
  import { IpcReply } from './IpcProtocol';
3
4
  /**
4
5
  * IpcErrorTranslator - ONE symmetric place an app owns IPC error translation, in BOTH directions.
@@ -33,7 +34,10 @@ export interface IpcErrorTranslator {
33
34
  * HTTP side, so an app can turn a "successful" reply into a throw. Returning normally means "let
34
35
  * this reply through"; the webpieces default returns for an `IpcSuccess` and throws for an
35
36
  * `IpcFailure`. Decline by calling
36
- * `new WebpiecesDefaultIpcErrorTranslator().fromWire(reply)`.
37
+ * `new WebpiecesDefaultIpcErrorTranslator().fromWire(reply, role)`.
38
+ *
39
+ * `role` is WHO is receiving ({@link ClientRole}), declared once at `IpcClientFactory` setup with
40
+ * no default. It decides what a received `unauthorized` means; pass it through when declining.
37
41
  */
38
- fromWire(reply: IpcReply): void;
42
+ fromWire(reply: IpcReply, role: ClientRole): void;
39
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IpcErrorTranslator.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/IpcErrorTranslator.ts"],"names":[],"mappings":"","sourcesContent":["import { ApiErrorPayload } from '../errors/ApiErrorCodec';\nimport { IpcReply } from './IpcProtocol';\n\n/**\n * IpcErrorTranslator - ONE symmetric place an app owns IPC error translation, in BOTH directions.\n *\n * The exact twin of `ErrorTranslator` for HTTP, down to the shape of each half: `toWire` is called in\n * a catch and RETURNS the payload the reply carries, `fromWire` is its mirror and THROWS. It exists\n * for the same reason: IPC already HAD both halves, hand-rolled at three call sites\n * (`IpcServerFactory.handle`, `IpcConnection.dispatch`, `IpcClientFactory`), with no seam an app could\n * reach. An app whose two processes share an error taxonomy had nowhere to put it.\n *\n * Register one with {@link IpcRegistry.setErrorTranslator} — one registry per PROTOCOL, mirroring\n * `ClientRegistry` for HTTP and `McpRegistry` for MCP, because the three speak different wire shapes\n * and an app rarely wants the same answer on all three.\n *\n * There is ALWAYS a translator ({@link IpcRegistry.getErrorTranslator} is non-optional), so every call\n * site is one unconditional line and a registered translator declines by DELEGATING to\n * {@link WebpiecesDefaultIpcErrorTranslator}.\n *\n * This is a business-logic contract (methods, not data), so it is an interface per the webpieces\n * guidelines.\n */\nexport interface IpcErrorTranslator {\n /**\n * SERVER: exception -> the wire payload carried by `IpcFailure`. Always a payload; decline by\n * returning `new WebpiecesDefaultIpcErrorTranslator().toWire(error)`, which applies the shared\n * `ApiErrorBoundary` publication rule (notably: a caller-local `ApiConnectionError` publishes as\n * `implementation`, because to the PEER this process is what is broken).\n */\n toWire(error: Error): ApiErrorPayload;\n\n /**\n * CLIENT: the reply -> a THROW. Called for EVERY reply, success or failure, exactly as on the\n * HTTP side, so an app can turn a \"successful\" reply into a throw. Returning normally means \"let\n * this reply through\"; the webpieces default returns for an `IpcSuccess` and throws for an\n * `IpcFailure`. Decline by calling\n * `new WebpiecesDefaultIpcErrorTranslator().fromWire(reply)`.\n */\n fromWire(reply: IpcReply): void;\n}\n"]}
1
+ {"version":3,"file":"IpcErrorTranslator.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/IpcErrorTranslator.ts"],"names":[],"mappings":"","sourcesContent":["import { ApiErrorPayload } from '../errors/ApiErrorCodec';\nimport { ClientRole } from '../errors/ClientRole';\nimport { IpcReply } from './IpcProtocol';\n\n/**\n * IpcErrorTranslator - ONE symmetric place an app owns IPC error translation, in BOTH directions.\n *\n * The exact twin of `ErrorTranslator` for HTTP, down to the shape of each half: `toWire` is called in\n * a catch and RETURNS the payload the reply carries, `fromWire` is its mirror and THROWS. It exists\n * for the same reason: IPC already HAD both halves, hand-rolled at three call sites\n * (`IpcServerFactory.handle`, `IpcConnection.dispatch`, `IpcClientFactory`), with no seam an app could\n * reach. An app whose two processes share an error taxonomy had nowhere to put it.\n *\n * Register one with {@link IpcRegistry.setErrorTranslator} — one registry per PROTOCOL, mirroring\n * `ClientRegistry` for HTTP and `McpRegistry` for MCP, because the three speak different wire shapes\n * and an app rarely wants the same answer on all three.\n *\n * There is ALWAYS a translator ({@link IpcRegistry.getErrorTranslator} is non-optional), so every call\n * site is one unconditional line and a registered translator declines by DELEGATING to\n * {@link WebpiecesDefaultIpcErrorTranslator}.\n *\n * This is a business-logic contract (methods, not data), so it is an interface per the webpieces\n * guidelines.\n */\nexport interface IpcErrorTranslator {\n /**\n * SERVER: exception -> the wire payload carried by `IpcFailure`. Always a payload; decline by\n * returning `new WebpiecesDefaultIpcErrorTranslator().toWire(error)`, which applies the shared\n * `ApiErrorBoundary` publication rule (notably: a caller-local `ApiConnectionError` publishes as\n * `implementation`, because to the PEER this process is what is broken).\n */\n toWire(error: Error): ApiErrorPayload;\n\n /**\n * CLIENT: the reply -> a THROW. Called for EVERY reply, success or failure, exactly as on the\n * HTTP side, so an app can turn a \"successful\" reply into a throw. Returning normally means \"let\n * this reply through\"; the webpieces default returns for an `IpcSuccess` and throws for an\n * `IpcFailure`. Decline by calling\n * `new WebpiecesDefaultIpcErrorTranslator().fromWire(reply, role)`.\n *\n * `role` is WHO is receiving ({@link ClientRole}), declared once at `IpcClientFactory` setup with\n * no default. It decides what a received `unauthorized` means; pass it through when declining.\n */\n fromWire(reply: IpcReply, role: ClientRole): void;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { ClientRole } from '../errors/ClientRole';
1
2
  import { IpcErrorTranslator } from './IpcErrorTranslator';
2
3
  import { IpcReply, IpcSuccess } from './IpcProtocol';
3
4
  /**
@@ -50,6 +51,8 @@ export declare class IpcClientErrorTranslator {
50
51
  * normally for a failure reply has a bug whose symptom would otherwise be `undefined` arriving
51
52
  * where the contract promised a DTO. For a genuine success the default returns immediately, so
52
53
  * the normal path costs one comparison.
54
+ *
55
+ * @param role - who is receiving, from the `IpcClientFactory` that sent the request.
53
56
  */
54
- static throwIfFailure(reply: IpcReply): asserts reply is IpcSuccess;
57
+ static throwIfFailure(reply: IpcReply, role: ClientRole): asserts reply is IpcSuccess;
55
58
  }
@@ -62,11 +62,13 @@ class IpcClientErrorTranslator {
62
62
  * normally for a failure reply has a bug whose symptom would otherwise be `undefined` arriving
63
63
  * where the contract promised a DTO. For a genuine success the default returns immediately, so
64
64
  * the normal path costs one comparison.
65
+ *
66
+ * @param role - who is receiving, from the `IpcClientFactory` that sent the request.
65
67
  */
66
68
  // webpieces-disable no-function-outside-class -- stateless boundary shared by every IPC client proxy
67
- static throwIfFailure(reply) {
68
- IpcRegistry.getErrorTranslator().fromWire(reply);
69
- WebpiecesDefaultIpcErrorTranslator_1.WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR.fromWire(reply);
69
+ static throwIfFailure(reply, role) {
70
+ IpcRegistry.getErrorTranslator().fromWire(reply, role);
71
+ WebpiecesDefaultIpcErrorTranslator_1.WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR.fromWire(reply, role);
70
72
  }
71
73
  }
72
74
  exports.IpcClientErrorTranslator = IpcClientErrorTranslator;
@@ -1 +1 @@
1
- {"version":3,"file":"IpcRegistry.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/IpcRegistry.ts"],"names":[],"mappings":";;;AAEA,6FAA8F;AAE9F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,WAAW;IACpB;;;;OAIG;IACK,MAAM,CAAC,eAAe,GAAuB,2EAAsC,CAAC;IAE5F;;;OAGG;IACH,4JAA4J;IAC5J,MAAM,CAAC,kBAAkB,CAAC,UAA8B;QACpD,WAAW,CAAC,eAAe,GAAG,UAAU,CAAC;IAC7C,CAAC;IAED,kGAAkG;IAClG,4JAA4J;IAC5J,MAAM,CAAC,kBAAkB;QACrB,OAAO,WAAW,CAAC,eAAe,CAAC;IACvC,CAAC;IAED,6FAA6F;IAC7F,4JAA4J;IAC5J,MAAM,CAAC,aAAa;QAChB,WAAW,CAAC,eAAe,GAAG,2EAAsC,CAAC;IACzE,CAAC;;AA3BL,kCA4BC;AAED;;;;;;;GAOG;AACH,MAAa,wBAAwB;IACjC;;;;;;;OAOG;IACH,qGAAqG;IACrG,MAAM,CAAC,cAAc,CAAC,KAAe;QACjC,WAAW,CAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjD,2EAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC3D,CAAC;CACJ;AAdD,4DAcC","sourcesContent":["import { IpcErrorTranslator } from './IpcErrorTranslator';\nimport { IpcReply, IpcSuccess } from './IpcProtocol';\nimport { WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR } from './WebpiecesDefaultIpcErrorTranslator';\n\n/**\n * IpcRegistry - the process-global home of the ONE {@link IpcErrorTranslator}, mirroring\n * `ClientRegistry` for HTTP and `McpRegistry` for MCP.\n *\n * ONE REGISTRY PER PROTOCOL, and that is the design: the three speak different wire shapes\n * (`HttpResponseDto`, `CallToolResult`, `ApiErrorPayload`), so one combined registry would either\n * force an app to answer three unrelated questions in one object or hide two of them behind\n * optionality. Three registries, three unconditional call sites.\n *\n * Configured like `HeaderRegistry` / `ClientRegistry` / LogManager — populated once at startup, then\n * globally accessible with NO DI wiring.\n *\n * ```ts\n * // startup, ONCE per process, in BOTH processes that share the connection\n * IpcRegistry.setErrorTranslator(new MyIpcErrorTranslator());\n * ```\n */\nexport class IpcRegistry {\n /**\n * THE translator. NEVER undefined — it starts life holding\n * {@link WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR}, and {@link IpcRegistry.setErrorTranslator}\n * REPLACES it. So no IPC call site asks \"did anyone register one\".\n */\n private static errorTranslator: IpcErrorTranslator = WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR;\n\n /**\n * Install the app's {@link IpcErrorTranslator}. `set`, not `add`: an app with several layers of\n * error policy composes them INSIDE its own `toWire`, where the precedence is written down.\n */\n // webpieces-disable no-function-outside-class -- static global singleton (like HeaderRegistry/ClientRegistry); populated once at startup, never DI-injected\n static setErrorTranslator(translator: IpcErrorTranslator): void {\n IpcRegistry.errorTranslator = translator;\n }\n\n /** THE {@link IpcErrorTranslator} for this process — never `undefined`, so no caller branches. */\n // webpieces-disable no-function-outside-class -- static global singleton (like HeaderRegistry/ClientRegistry); populated once at startup, never DI-injected\n static getErrorTranslator(): IpcErrorTranslator {\n return IpcRegistry.errorTranslator;\n }\n\n /** Put the process-global back to the webpieces default. For TESTS, so specs cannot leak. */\n // webpieces-disable no-function-outside-class -- static global singleton (like HeaderRegistry/ClientRegistry); populated once at startup, never DI-injected\n static resetForTests(): void {\n IpcRegistry.errorTranslator = WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR;\n }\n}\n\n/**\n * The CLIENT half's one call site, and the guarantee behind it — the IPC twin of\n * `ClientErrorTranslator.throwIfFailure`.\n *\n * The `asserts` return type is what lets `IpcClientFactory` read the success body straight afterwards\n * with no `if (reply.type === 'failure')` branch left over: after this call the compiler knows the\n * reply is an {@link IpcSuccess}, because the only way past it is that it is one.\n */\nexport class IpcClientErrorTranslator {\n /**\n * Run `fromWire` over a reply, and make it impossible for an `IpcFailure` to be read as data.\n *\n * The second call is BUG CONTAINMENT, not a fallback branch: an app translator that returns\n * normally for a failure reply has a bug whose symptom would otherwise be `undefined` arriving\n * where the contract promised a DTO. For a genuine success the default returns immediately, so\n * the normal path costs one comparison.\n */\n // webpieces-disable no-function-outside-class -- stateless boundary shared by every IPC client proxy\n static throwIfFailure(reply: IpcReply): asserts reply is IpcSuccess {\n IpcRegistry.getErrorTranslator().fromWire(reply);\n WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR.fromWire(reply);\n }\n}\n"]}
1
+ {"version":3,"file":"IpcRegistry.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/IpcRegistry.ts"],"names":[],"mappings":";;;AAGA,6FAA8F;AAE9F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,WAAW;IACpB;;;;OAIG;IACK,MAAM,CAAC,eAAe,GAAuB,2EAAsC,CAAC;IAE5F;;;OAGG;IACH,4JAA4J;IAC5J,MAAM,CAAC,kBAAkB,CAAC,UAA8B;QACpD,WAAW,CAAC,eAAe,GAAG,UAAU,CAAC;IAC7C,CAAC;IAED,kGAAkG;IAClG,4JAA4J;IAC5J,MAAM,CAAC,kBAAkB;QACrB,OAAO,WAAW,CAAC,eAAe,CAAC;IACvC,CAAC;IAED,6FAA6F;IAC7F,4JAA4J;IAC5J,MAAM,CAAC,aAAa;QAChB,WAAW,CAAC,eAAe,GAAG,2EAAsC,CAAC;IACzE,CAAC;;AA3BL,kCA4BC;AAED;;;;;;;GAOG;AACH,MAAa,wBAAwB;IACjC;;;;;;;;;OASG;IACH,qGAAqG;IACrG,MAAM,CAAC,cAAc,CAAC,KAAe,EAAE,IAAgB;QACnD,WAAW,CAAC,kBAAkB,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvD,2EAAsC,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;CACJ;AAhBD,4DAgBC","sourcesContent":["import { ClientRole } from '../errors/ClientRole';\nimport { IpcErrorTranslator } from './IpcErrorTranslator';\nimport { IpcReply, IpcSuccess } from './IpcProtocol';\nimport { WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR } from './WebpiecesDefaultIpcErrorTranslator';\n\n/**\n * IpcRegistry - the process-global home of the ONE {@link IpcErrorTranslator}, mirroring\n * `ClientRegistry` for HTTP and `McpRegistry` for MCP.\n *\n * ONE REGISTRY PER PROTOCOL, and that is the design: the three speak different wire shapes\n * (`HttpResponseDto`, `CallToolResult`, `ApiErrorPayload`), so one combined registry would either\n * force an app to answer three unrelated questions in one object or hide two of them behind\n * optionality. Three registries, three unconditional call sites.\n *\n * Configured like `HeaderRegistry` / `ClientRegistry` / LogManager — populated once at startup, then\n * globally accessible with NO DI wiring.\n *\n * ```ts\n * // startup, ONCE per process, in BOTH processes that share the connection\n * IpcRegistry.setErrorTranslator(new MyIpcErrorTranslator());\n * ```\n */\nexport class IpcRegistry {\n /**\n * THE translator. NEVER undefined — it starts life holding\n * {@link WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR}, and {@link IpcRegistry.setErrorTranslator}\n * REPLACES it. So no IPC call site asks \"did anyone register one\".\n */\n private static errorTranslator: IpcErrorTranslator = WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR;\n\n /**\n * Install the app's {@link IpcErrorTranslator}. `set`, not `add`: an app with several layers of\n * error policy composes them INSIDE its own `toWire`, where the precedence is written down.\n */\n // webpieces-disable no-function-outside-class -- static global singleton (like HeaderRegistry/ClientRegistry); populated once at startup, never DI-injected\n static setErrorTranslator(translator: IpcErrorTranslator): void {\n IpcRegistry.errorTranslator = translator;\n }\n\n /** THE {@link IpcErrorTranslator} for this process — never `undefined`, so no caller branches. */\n // webpieces-disable no-function-outside-class -- static global singleton (like HeaderRegistry/ClientRegistry); populated once at startup, never DI-injected\n static getErrorTranslator(): IpcErrorTranslator {\n return IpcRegistry.errorTranslator;\n }\n\n /** Put the process-global back to the webpieces default. For TESTS, so specs cannot leak. */\n // webpieces-disable no-function-outside-class -- static global singleton (like HeaderRegistry/ClientRegistry); populated once at startup, never DI-injected\n static resetForTests(): void {\n IpcRegistry.errorTranslator = WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR;\n }\n}\n\n/**\n * The CLIENT half's one call site, and the guarantee behind it — the IPC twin of\n * `ClientErrorTranslator.throwIfFailure`.\n *\n * The `asserts` return type is what lets `IpcClientFactory` read the success body straight afterwards\n * with no `if (reply.type === 'failure')` branch left over: after this call the compiler knows the\n * reply is an {@link IpcSuccess}, because the only way past it is that it is one.\n */\nexport class IpcClientErrorTranslator {\n /**\n * Run `fromWire` over a reply, and make it impossible for an `IpcFailure` to be read as data.\n *\n * The second call is BUG CONTAINMENT, not a fallback branch: an app translator that returns\n * normally for a failure reply has a bug whose symptom would otherwise be `undefined` arriving\n * where the contract promised a DTO. For a genuine success the default returns immediately, so\n * the normal path costs one comparison.\n *\n * @param role - who is receiving, from the `IpcClientFactory` that sent the request.\n */\n // webpieces-disable no-function-outside-class -- stateless boundary shared by every IPC client proxy\n static throwIfFailure(reply: IpcReply, role: ClientRole): asserts reply is IpcSuccess {\n IpcRegistry.getErrorTranslator().fromWire(reply, role);\n WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR.fromWire(reply, role);\n }\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import { ApiErrorPayload } from '../errors/ApiErrorCodec';
2
+ import { ClientRole } from '../errors/ClientRole';
2
3
  import { IpcErrorTranslator } from './IpcErrorTranslator';
3
4
  import { IpcReply } from './IpcProtocol';
4
5
  /**
@@ -14,7 +15,9 @@ import { IpcReply } from './IpcProtocol';
14
15
  * caller-error kind coming back means I sent a bad IPC request (MY bug ->
15
16
  * `ApiImplementationError`), a server-side kind means the peer broke (NOT my bug ->
16
17
  * `ApiDependencyError`), an incoming `ApiDependencyError` is already attributed and rethrows as-is,
17
- * and an `ApiEndUserError` is the actor's own answer and passes through.
18
+ * an `ApiEndUserError` is the actor's own answer and passes through (as its registered subclass), an
19
+ * `ApiClientTooOldError` passes through on every hop, and an `unauthorized` reply depends on the
20
+ * receiving {@link ClientRole}.
18
21
  *
19
22
  * The two protocols share ONE rule object rather than two copies for the obvious reason: an app that
20
23
  * moves a call from IPC to HTTP or back must not thereby change which team gets paged.
@@ -22,7 +25,8 @@ import { IpcReply } from './IpcProtocol';
22
25
  export declare class WebpiecesDefaultIpcErrorTranslator implements IpcErrorTranslator {
23
26
  private readonly boundary;
24
27
  toWire(error: Error): ApiErrorPayload;
25
- fromWire(reply: IpcReply): void;
28
+ /** @param role - who is receiving, declared at `IpcClientFactory` setup. Decides what a 401 means. */
29
+ fromWire(reply: IpcReply, role: ClientRole): void;
26
30
  }
27
31
  /** Process-wide built-in instance — stateless, so one shared instance is enough. */
28
32
  export declare const WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR: WebpiecesDefaultIpcErrorTranslator;
@@ -19,7 +19,9 @@ const ApiErrorHttpStatus_1 = require("../http/ApiErrorHttpStatus");
19
19
  * caller-error kind coming back means I sent a bad IPC request (MY bug ->
20
20
  * `ApiImplementationError`), a server-side kind means the peer broke (NOT my bug ->
21
21
  * `ApiDependencyError`), an incoming `ApiDependencyError` is already attributed and rethrows as-is,
22
- * and an `ApiEndUserError` is the actor's own answer and passes through.
22
+ * an `ApiEndUserError` is the actor's own answer and passes through (as its registered subclass), an
23
+ * `ApiClientTooOldError` passes through on every hop, and an `unauthorized` reply depends on the
24
+ * receiving {@link ClientRole}.
23
25
  *
24
26
  * The two protocols share ONE rule object rather than two copies for the obvious reason: an app that
25
27
  * moves a call from IPC to HTTP or back must not thereby change which team gets paged.
@@ -29,7 +31,8 @@ class WebpiecesDefaultIpcErrorTranslator {
29
31
  toWire(error) {
30
32
  return this.boundary.encode(error);
31
33
  }
32
- fromWire(reply) {
34
+ /** @param role - who is receiving, declared at `IpcClientFactory` setup. Decides what a 401 means. */
35
+ fromWire(reply, role) {
33
36
  if (reply.type === 'success') {
34
37
  return;
35
38
  }
@@ -40,7 +43,7 @@ class WebpiecesDefaultIpcErrorTranslator {
40
43
  const equivalent = ApiErrorHttpStatus_1.ApiErrorHttpStatus.hasCode(decoded)
41
44
  ? ApiErrorHttpStatus_1.ApiErrorHttpStatus.codeFor(decoded.kind, statusCode)
42
45
  : 500;
43
- throw ReceivedApiErrorRule_1.ReceivedApiErrorRule.adapt(equivalent, decoded.message, decoded);
46
+ throw ReceivedApiErrorRule_1.ReceivedApiErrorRule.adapt(role, equivalent, decoded.message, decoded);
44
47
  }
45
48
  }
46
49
  exports.WebpiecesDefaultIpcErrorTranslator = WebpiecesDefaultIpcErrorTranslator;
@@ -1 +1 @@
1
- {"version":3,"file":"WebpiecesDefaultIpcErrorTranslator.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/WebpiecesDefaultIpcErrorTranslator.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAC9D,2DAAyE;AACzE,iDAAmD;AACnD,yEAAsE;AACtE,mEAAgE;AAIhE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,kCAAkC;IAC1B,QAAQ,GAAG,IAAI,mCAAgB,EAAE,CAAC;IAEnD,MAAM,CAAC,KAAY;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ,CAAC,KAAe;QACpB,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QACD,MAAM,OAAO,GAAG,6BAAa,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClD,2FAA2F;QAC3F,8FAA8F;QAC9F,MAAM,UAAU,GAAG,OAAO,YAAY,wBAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QACrF,MAAM,UAAU,GAAG,uCAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;YAClD,CAAC,CAAC,uCAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC;YACtD,CAAC,CAAC,GAAG,CAAC;QACV,MAAM,2CAAoB,CAAC,KAAK,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;CACJ;AApBD,gFAoBC;AAED,oFAAoF;AACvE,QAAA,sCAAsC,GAAG,IAAI,kCAAkC,EAAE,CAAC","sourcesContent":["import { ApiErrorBoundary } from '../errors/ApiErrorBoundary';\nimport { ApiErrorCodec, ApiErrorPayload } from '../errors/ApiErrorCodec';\nimport { ApiCodedError } from '../errors/ApiError';\nimport { ReceivedApiErrorRule } from '../errors/ReceivedApiErrorRule';\nimport { ApiErrorHttpStatus } from '../http/ApiErrorHttpStatus';\nimport { IpcErrorTranslator } from './IpcErrorTranslator';\nimport { IpcReply } from './IpcProtocol';\n\n/**\n * THE webpieces default {@link IpcErrorTranslator}, and what {@link IpcRegistry} holds until an app\n * installs its own.\n *\n * `toWire` is exactly what the two IPC receivers did inline before this seam existed — the shared\n * {@link ApiErrorBoundary}, so the `ApiConnectionError` -> `implementation` rule survives untouched.\n *\n * `fromWire` is a BEHAVIOUR CHANGE and a deliberate one. `IpcClientFactory` used to rethrow\n * `ApiErrorCodec.decode(reply.error)` verbatim, which handed the caller the PEER's error type as if\n * this process had produced it. IPC now applies the SAME {@link ReceivedApiErrorRule} as HTTP: a\n * caller-error kind coming back means I sent a bad IPC request (MY bug ->\n * `ApiImplementationError`), a server-side kind means the peer broke (NOT my bug ->\n * `ApiDependencyError`), an incoming `ApiDependencyError` is already attributed and rethrows as-is,\n * and an `ApiEndUserError` is the actor's own answer and passes through.\n *\n * The two protocols share ONE rule object rather than two copies for the obvious reason: an app that\n * moves a call from IPC to HTTP or back must not thereby change which team gets paged.\n */\nexport class WebpiecesDefaultIpcErrorTranslator implements IpcErrorTranslator {\n private readonly boundary = new ApiErrorBoundary();\n\n toWire(error: Error): ApiErrorPayload {\n return this.boundary.encode(error);\n }\n\n fromWire(reply: IpcReply): void {\n if (reply.type === 'success') {\n return;\n }\n const decoded = ApiErrorCodec.decode(reply.error);\n // IPC has no wire status, so the equivalent is derived from the payload's own kind through\n // the ONE status table HTTP uses. Same table, same verdict, no second ladder to keep in step.\n const statusCode = decoded instanceof ApiCodedError ? decoded.statusCode : undefined;\n const equivalent = ApiErrorHttpStatus.hasCode(decoded)\n ? ApiErrorHttpStatus.codeFor(decoded.kind, statusCode)\n : 500;\n throw ReceivedApiErrorRule.adapt(equivalent, decoded.message, decoded);\n }\n}\n\n/** Process-wide built-in instance — stateless, so one shared instance is enough. */\nexport const WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR = new WebpiecesDefaultIpcErrorTranslator();\n"]}
1
+ {"version":3,"file":"WebpiecesDefaultIpcErrorTranslator.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/WebpiecesDefaultIpcErrorTranslator.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAC9D,2DAAyE;AACzE,iDAAmD;AAEnD,yEAAsE;AACtE,mEAAgE;AAIhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,kCAAkC;IAC1B,QAAQ,GAAG,IAAI,mCAAgB,EAAE,CAAC;IAEnD,MAAM,CAAC,KAAY;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,sGAAsG;IACtG,QAAQ,CAAC,KAAe,EAAE,IAAgB;QACtC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO;QACX,CAAC;QACD,MAAM,OAAO,GAAG,6BAAa,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClD,2FAA2F;QAC3F,8FAA8F;QAC9F,MAAM,UAAU,GAAG,OAAO,YAAY,wBAAa,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QACrF,MAAM,UAAU,GAAG,uCAAkB,CAAC,OAAO,CAAC,OAAO,CAAC;YAClD,CAAC,CAAC,uCAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC;YACtD,CAAC,CAAC,GAAG,CAAC;QACV,MAAM,2CAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjF,CAAC;CACJ;AArBD,gFAqBC;AAED,oFAAoF;AACvE,QAAA,sCAAsC,GAAG,IAAI,kCAAkC,EAAE,CAAC","sourcesContent":["import { ApiErrorBoundary } from '../errors/ApiErrorBoundary';\nimport { ApiErrorCodec, ApiErrorPayload } from '../errors/ApiErrorCodec';\nimport { ApiCodedError } from '../errors/ApiError';\nimport { ClientRole } from '../errors/ClientRole';\nimport { ReceivedApiErrorRule } from '../errors/ReceivedApiErrorRule';\nimport { ApiErrorHttpStatus } from '../http/ApiErrorHttpStatus';\nimport { IpcErrorTranslator } from './IpcErrorTranslator';\nimport { IpcReply } from './IpcProtocol';\n\n/**\n * THE webpieces default {@link IpcErrorTranslator}, and what {@link IpcRegistry} holds until an app\n * installs its own.\n *\n * `toWire` is exactly what the two IPC receivers did inline before this seam existed — the shared\n * {@link ApiErrorBoundary}, so the `ApiConnectionError` -> `implementation` rule survives untouched.\n *\n * `fromWire` is a BEHAVIOUR CHANGE and a deliberate one. `IpcClientFactory` used to rethrow\n * `ApiErrorCodec.decode(reply.error)` verbatim, which handed the caller the PEER's error type as if\n * this process had produced it. IPC now applies the SAME {@link ReceivedApiErrorRule} as HTTP: a\n * caller-error kind coming back means I sent a bad IPC request (MY bug ->\n * `ApiImplementationError`), a server-side kind means the peer broke (NOT my bug ->\n * `ApiDependencyError`), an incoming `ApiDependencyError` is already attributed and rethrows as-is,\n * an `ApiEndUserError` is the actor's own answer and passes through (as its registered subclass), an\n * `ApiClientTooOldError` passes through on every hop, and an `unauthorized` reply depends on the\n * receiving {@link ClientRole}.\n *\n * The two protocols share ONE rule object rather than two copies for the obvious reason: an app that\n * moves a call from IPC to HTTP or back must not thereby change which team gets paged.\n */\nexport class WebpiecesDefaultIpcErrorTranslator implements IpcErrorTranslator {\n private readonly boundary = new ApiErrorBoundary();\n\n toWire(error: Error): ApiErrorPayload {\n return this.boundary.encode(error);\n }\n\n /** @param role - who is receiving, declared at `IpcClientFactory` setup. Decides what a 401 means. */\n fromWire(reply: IpcReply, role: ClientRole): void {\n if (reply.type === 'success') {\n return;\n }\n const decoded = ApiErrorCodec.decode(reply.error);\n // IPC has no wire status, so the equivalent is derived from the payload's own kind through\n // the ONE status table HTTP uses. Same table, same verdict, no second ladder to keep in step.\n const statusCode = decoded instanceof ApiCodedError ? decoded.statusCode : undefined;\n const equivalent = ApiErrorHttpStatus.hasCode(decoded)\n ? ApiErrorHttpStatus.codeFor(decoded.kind, statusCode)\n : 500;\n throw ReceivedApiErrorRule.adapt(role, equivalent, decoded.message, decoded);\n }\n}\n\n/** Process-wide built-in instance — stateless, so one shared instance is enough. */\nexport const WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR = new WebpiecesDefaultIpcErrorTranslator();\n"]}
@@ -8,6 +8,7 @@ export { IpcRegistry, IpcClientErrorTranslator } from './IpcRegistry';
8
8
  export type { IpcErrorTranslator } from './IpcErrorTranslator';
9
9
  export { WebpiecesDefaultIpcErrorTranslator, WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR, } from './WebpiecesDefaultIpcErrorTranslator';
10
10
  export { ApiErrorPayload } from '../errors/ApiErrorCodec';
11
+ export { ClientRole } from '../errors/ClientRole';
11
12
  export type { IpcTransport, IpcScheduler, IpcErrorOwner } from './IpcConnection';
12
13
  export { IpcCallLogger } from './IpcLogging';
13
14
  export type { IpcLogging } from './IpcLogging';
package/src/ipc/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toError = exports.ApiCallTimeoutError = exports.LogApiCallImpl = exports.ApiMethodInfo = exports.MaskLog = exports.MaskSpec = exports.IpcCallLogger = exports.ApiErrorPayload = exports.WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR = exports.WebpiecesDefaultIpcErrorTranslator = exports.IpcClientErrorTranslator = exports.IpcRegistry = exports.IpcErrors = exports.IpcTransportError = exports.IpcConnectionOptions = exports.IpcConnection = exports.IpcProtocol = exports.IpcFailure = exports.IpcSuccess = exports.IpcRequest = exports.IpcCallContext = exports.IPC_METADATA_KEYS = exports.assertNotInternalApi = exports.assertInternalApi = exports.getIpcMaskSpec = exports.getIpcEndpointKind = exports.getIpcEndpoints = exports.getIpcApiId = exports.isInternalApi = exports.WpIpcEndpoint = exports.WpInternal = exports.IpcIdentity = void 0;
3
+ exports.toError = exports.ApiCallTimeoutError = exports.LogApiCallImpl = exports.ApiMethodInfo = exports.MaskLog = exports.MaskSpec = exports.IpcCallLogger = exports.ClientRole = exports.ApiErrorPayload = exports.WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR = exports.WebpiecesDefaultIpcErrorTranslator = exports.IpcClientErrorTranslator = exports.IpcRegistry = exports.IpcErrors = exports.IpcTransportError = exports.IpcConnectionOptions = exports.IpcConnection = exports.IpcProtocol = exports.IpcFailure = exports.IpcSuccess = exports.IpcRequest = exports.IpcCallContext = exports.IPC_METADATA_KEYS = exports.assertNotInternalApi = exports.assertInternalApi = exports.getIpcMaskSpec = exports.getIpcEndpointKind = exports.getIpcEndpoints = exports.getIpcApiId = exports.isInternalApi = exports.WpIpcEndpoint = exports.WpInternal = exports.IpcIdentity = void 0;
4
4
  var IpcIdentity_1 = require("./IpcIdentity");
5
5
  Object.defineProperty(exports, "IpcIdentity", { enumerable: true, get: function () { return IpcIdentity_1.IpcIdentity; } });
6
6
  var IpcDecorators_1 = require("./IpcDecorators");
@@ -33,6 +33,8 @@ Object.defineProperty(exports, "WebpiecesDefaultIpcErrorTranslator", { enumerabl
33
33
  Object.defineProperty(exports, "WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR", { enumerable: true, get: function () { return WebpiecesDefaultIpcErrorTranslator_1.WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR; } });
34
34
  var ApiErrorCodec_1 = require("../errors/ApiErrorCodec");
35
35
  Object.defineProperty(exports, "ApiErrorPayload", { enumerable: true, get: function () { return ApiErrorCodec_1.ApiErrorPayload; } });
36
+ var ClientRole_1 = require("../errors/ClientRole");
37
+ Object.defineProperty(exports, "ClientRole", { enumerable: true, get: function () { return ClientRole_1.ClientRole; } });
36
38
  var IpcLogging_1 = require("./IpcLogging");
37
39
  Object.defineProperty(exports, "IpcCallLogger", { enumerable: true, get: function () { return IpcLogging_1.IpcCallLogger; } });
38
40
  var LogFieldMask_1 = require("../http/LogFieldMask");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iDAWyB;AAVrB,2GAAA,UAAU,OAAA;AACV,8GAAA,aAAa,OAAA;AACb,8GAAA,aAAa,OAAA;AACb,4GAAA,WAAW,OAAA;AACX,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA;AAClB,+GAAA,cAAc,OAAA;AACd,kHAAA,iBAAiB,OAAA;AACjB,qHAAA,oBAAoB,OAAA;AACpB,kHAAA,iBAAiB,OAAA;AAGrB,6CAAgG;AAAvF,6GAAA,cAAc,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,0GAAA,WAAW,OAAA;AAExE,iDAAoG;AAA3F,8GAAA,aAAa,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAAE,0GAAA,SAAS,OAAA;AAC1E,6CAAsE;AAA7D,0GAAA,WAAW,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAE9C,2FAG8C;AAF1C,wJAAA,kCAAkC,OAAA;AAClC,4JAAA,sCAAsC,OAAA;AAE1C,yDAA0D;AAAjD,gHAAA,eAAe,OAAA;AAExB,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAEtB,qDAAgD;AAAvC,wGAAA,QAAQ,OAAA;AACjB,iDAA6C;AAApC,qGAAA,OAAO,OAAA;AAChB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,iDAAoD;AAA3C,4GAAA,cAAc,OAAA;AAEvB,mEAAkE;AAAzD,0HAAA,mBAAmB,OAAA;AAE5B,gDAA4C;AAAnC,qGAAA,OAAO,OAAA","sourcesContent":["export { IpcIdentity } from './IpcIdentity';\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 './IpcDecorators';\nexport type { IpcApiType, IpcEndpointKind, IpcEndpointOptions } from './IpcDecorators';\nexport { IpcCallContext, IpcRequest, IpcSuccess, IpcFailure, IpcProtocol } from './IpcProtocol';\nexport type { IpcReply, IpcMessage } from './IpcProtocol';\nexport { IpcConnection, IpcConnectionOptions, IpcTransportError, IpcErrors } from './IpcConnection';\nexport { IpcRegistry, IpcClientErrorTranslator } from './IpcRegistry';\nexport type { IpcErrorTranslator } from './IpcErrorTranslator';\nexport {\n WebpiecesDefaultIpcErrorTranslator,\n WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR,\n} from './WebpiecesDefaultIpcErrorTranslator';\nexport { ApiErrorPayload } from '../errors/ApiErrorCodec';\nexport type { IpcTransport, IpcScheduler, IpcErrorOwner } from './IpcConnection';\nexport { IpcCallLogger } from './IpcLogging';\nexport type { IpcLogging } from './IpcLogging';\nexport { MaskSpec } from '../http/LogFieldMask';\nexport { MaskLog } from '../http/decorators';\nexport { ApiMethodInfo } from '../http/ApiMethodInfo';\nexport { LogApiCallImpl } from '../http/LogApiCall';\nexport type { ApiCallContext } from '../http/ApiCallContext';\nexport { ApiCallTimeoutError } from '../http/ApiCallTimeoutError';\n\nexport { toError } from '../lib/errorUtils';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/core/core-util/src/ipc/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,iDAWyB;AAVrB,2GAAA,UAAU,OAAA;AACV,8GAAA,aAAa,OAAA;AACb,8GAAA,aAAa,OAAA;AACb,4GAAA,WAAW,OAAA;AACX,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA;AAClB,+GAAA,cAAc,OAAA;AACd,kHAAA,iBAAiB,OAAA;AACjB,qHAAA,oBAAoB,OAAA;AACpB,kHAAA,iBAAiB,OAAA;AAGrB,6CAAgG;AAAvF,6GAAA,cAAc,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,0GAAA,WAAW,OAAA;AAExE,iDAAoG;AAA3F,8GAAA,aAAa,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAAE,0GAAA,SAAS,OAAA;AAC1E,6CAAsE;AAA7D,0GAAA,WAAW,OAAA;AAAE,uHAAA,wBAAwB,OAAA;AAE9C,2FAG8C;AAF1C,wJAAA,kCAAkC,OAAA;AAClC,4JAAA,sCAAsC,OAAA;AAE1C,yDAA0D;AAAjD,gHAAA,eAAe,OAAA;AACxB,mDAAkD;AAAzC,wGAAA,UAAU,OAAA;AAEnB,2CAA6C;AAApC,2GAAA,aAAa,OAAA;AAEtB,qDAAgD;AAAvC,wGAAA,QAAQ,OAAA;AACjB,iDAA6C;AAApC,qGAAA,OAAO,OAAA;AAChB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,iDAAoD;AAA3C,4GAAA,cAAc,OAAA;AAEvB,mEAAkE;AAAzD,0HAAA,mBAAmB,OAAA;AAE5B,gDAA4C;AAAnC,qGAAA,OAAO,OAAA","sourcesContent":["export { IpcIdentity } from './IpcIdentity';\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 './IpcDecorators';\nexport type { IpcApiType, IpcEndpointKind, IpcEndpointOptions } from './IpcDecorators';\nexport { IpcCallContext, IpcRequest, IpcSuccess, IpcFailure, IpcProtocol } from './IpcProtocol';\nexport type { IpcReply, IpcMessage } from './IpcProtocol';\nexport { IpcConnection, IpcConnectionOptions, IpcTransportError, IpcErrors } from './IpcConnection';\nexport { IpcRegistry, IpcClientErrorTranslator } from './IpcRegistry';\nexport type { IpcErrorTranslator } from './IpcErrorTranslator';\nexport {\n WebpiecesDefaultIpcErrorTranslator,\n WEBPIECES_DEFAULT_IPC_ERROR_TRANSLATOR,\n} from './WebpiecesDefaultIpcErrorTranslator';\nexport { ApiErrorPayload } from '../errors/ApiErrorCodec';\nexport { ClientRole } from '../errors/ClientRole';\nexport type { IpcTransport, IpcScheduler, IpcErrorOwner } from './IpcConnection';\nexport { IpcCallLogger } from './IpcLogging';\nexport type { IpcLogging } from './IpcLogging';\nexport { MaskSpec } from '../http/LogFieldMask';\nexport { MaskLog } from '../http/decorators';\nexport { ApiMethodInfo } from '../http/ApiMethodInfo';\nexport { LogApiCallImpl } from '../http/LogApiCall';\nexport type { ApiCallContext } from '../http/ApiCallContext';\nexport { ApiCallTimeoutError } from '../http/ApiCallTimeoutError';\n\nexport { toError } from '../lib/errorUtils';\n"]}
@@ -0,0 +1,37 @@
1
+ import { AuthorizationEndpointErrorCode } from './OAuthErrorCode';
2
+ /**
3
+ * The AUTHORIZATION endpoint's error answer, RFC 6749 §4.1.2.1: not a status code at all, but a
4
+ * redirect of the user agent back to the client's `redirect_uri` carrying
5
+ * `error`, `error_description?`, `error_uri?`, `state` and (RFC 9207) `iss?` as query parameters.
6
+ *
7
+ * ```ts
8
+ * const url = new OAuthAuthorizationErrorRedirect(
9
+ * client.redirectUri, OAuthErrorCode.ACCESS_DENIED, requestState, 'The user declined',
10
+ * ).toUrl();
11
+ * res.redirect(302, url);
12
+ * ```
13
+ *
14
+ * `requestState` above is the request's `state` narrowed to `string | undefined` (express types a
15
+ * query value more widely). `state` is a REQUIRED argument that may be `undefined`: the RFC requires it back exactly when the
16
+ * client sent it, so every caller must hand over what the request carried rather than forget it.
17
+ * An existing query on `redirectUri` is kept, as the RFC requires.
18
+ *
19
+ * Only redirect to a `redirect_uri` you have VALIDATED against the client's registration. When the
20
+ * `redirect_uri` or `client_id` is missing, invalid or mismatched, RFC 6749 §4.1.2.1 forbids the
21
+ * redirect (it would be an open redirector) — answer the resource owner directly instead, for
22
+ * example with an `OAuthProtocolError` rendered as JSON.
23
+ */
24
+ export declare class OAuthAuthorizationErrorRedirect {
25
+ readonly redirectUri: string;
26
+ readonly error: AuthorizationEndpointErrorCode;
27
+ readonly state: string | undefined;
28
+ readonly description?: string | undefined;
29
+ readonly errorUri?: string | undefined;
30
+ /** RFC 9207 `iss`: the authorization server's issuer identifier, for mix-up defence. */
31
+ readonly issuer?: string | undefined;
32
+ constructor(redirectUri: string, error: AuthorizationEndpointErrorCode, state: string | undefined, description?: string | undefined, errorUri?: string | undefined,
33
+ /** RFC 9207 `iss`: the authorization server's issuer identifier, for mix-up defence. */
34
+ issuer?: string | undefined);
35
+ /** The absolute redirect URL. Throws `TypeError` (from `URL`) if `redirectUri` is not absolute. */
36
+ toUrl(): string;
37
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuthAuthorizationErrorRedirect = void 0;
4
+ const OAuthErrorCode_1 = require("./OAuthErrorCode");
5
+ /**
6
+ * The AUTHORIZATION endpoint's error answer, RFC 6749 §4.1.2.1: not a status code at all, but a
7
+ * redirect of the user agent back to the client's `redirect_uri` carrying
8
+ * `error`, `error_description?`, `error_uri?`, `state` and (RFC 9207) `iss?` as query parameters.
9
+ *
10
+ * ```ts
11
+ * const url = new OAuthAuthorizationErrorRedirect(
12
+ * client.redirectUri, OAuthErrorCode.ACCESS_DENIED, requestState, 'The user declined',
13
+ * ).toUrl();
14
+ * res.redirect(302, url);
15
+ * ```
16
+ *
17
+ * `requestState` above is the request's `state` narrowed to `string | undefined` (express types a
18
+ * query value more widely). `state` is a REQUIRED argument that may be `undefined`: the RFC requires it back exactly when the
19
+ * client sent it, so every caller must hand over what the request carried rather than forget it.
20
+ * An existing query on `redirectUri` is kept, as the RFC requires.
21
+ *
22
+ * Only redirect to a `redirect_uri` you have VALIDATED against the client's registration. When the
23
+ * `redirect_uri` or `client_id` is missing, invalid or mismatched, RFC 6749 §4.1.2.1 forbids the
24
+ * redirect (it would be an open redirector) — answer the resource owner directly instead, for
25
+ * example with an `OAuthProtocolError` rendered as JSON.
26
+ */
27
+ class OAuthAuthorizationErrorRedirect {
28
+ redirectUri;
29
+ error;
30
+ state;
31
+ description;
32
+ errorUri;
33
+ issuer;
34
+ constructor(redirectUri, error, state, description, errorUri,
35
+ /** RFC 9207 `iss`: the authorization server's issuer identifier, for mix-up defence. */
36
+ issuer) {
37
+ this.redirectUri = redirectUri;
38
+ this.error = error;
39
+ this.state = state;
40
+ this.description = description;
41
+ this.errorUri = errorUri;
42
+ this.issuer = issuer;
43
+ }
44
+ /** The absolute redirect URL. Throws `TypeError` (from `URL`) if `redirectUri` is not absolute. */
45
+ toUrl() {
46
+ const url = new URL(this.redirectUri);
47
+ url.searchParams.set('error', this.error);
48
+ if (this.description !== undefined) {
49
+ url.searchParams.set('error_description', OAuthErrorCode_1.OAuthText.sanitize(this.description));
50
+ }
51
+ if (this.errorUri !== undefined)
52
+ url.searchParams.set('error_uri', this.errorUri);
53
+ if (this.state !== undefined)
54
+ url.searchParams.set('state', this.state);
55
+ if (this.issuer !== undefined)
56
+ url.searchParams.set('iss', this.issuer);
57
+ return url.toString();
58
+ }
59
+ }
60
+ exports.OAuthAuthorizationErrorRedirect = OAuthAuthorizationErrorRedirect;
61
+ //# sourceMappingURL=OAuthAuthorizationErrorRedirect.js.map