@pipeline-builder/api-core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +98 -0
  3. package/lib/constants/ai-providers.d.ts +52 -0
  4. package/lib/constants/ai-providers.js +129 -0
  5. package/lib/constants/http-status.d.ts +20 -0
  6. package/lib/constants/http-status.js +26 -0
  7. package/lib/constants/index.d.ts +3 -0
  8. package/lib/constants/index.js +6 -0
  9. package/lib/constants/time.d.ts +10 -0
  10. package/lib/constants/time.js +13 -0
  11. package/lib/errors/app-errors.d.ts +30 -0
  12. package/lib/errors/app-errors.js +53 -0
  13. package/lib/errors/index.d.ts +1 -0
  14. package/lib/errors/index.js +4 -0
  15. package/lib/helpers/access-helpers.d.ts +63 -0
  16. package/lib/helpers/access-helpers.js +82 -0
  17. package/lib/helpers/crud-helpers.d.ts +9 -0
  18. package/lib/helpers/crud-helpers.js +23 -0
  19. package/lib/helpers/index.d.ts +6 -0
  20. package/lib/helpers/index.js +9 -0
  21. package/lib/helpers/org-hierarchy-http.d.ts +74 -0
  22. package/lib/helpers/org-hierarchy-http.js +144 -0
  23. package/lib/helpers/org-hierarchy.d.ts +57 -0
  24. package/lib/helpers/org-hierarchy.js +110 -0
  25. package/lib/helpers/restore-helpers.d.ts +49 -0
  26. package/lib/helpers/restore-helpers.js +78 -0
  27. package/lib/helpers/sse-helpers.d.ts +20 -0
  28. package/lib/helpers/sse-helpers.js +45 -0
  29. package/lib/index.d.ts +58 -0
  30. package/lib/index.js +71 -0
  31. package/lib/middleware/auth.d.ts +208 -0
  32. package/lib/middleware/auth.js +588 -0
  33. package/lib/middleware/index.d.ts +3 -0
  34. package/lib/middleware/index.js +6 -0
  35. package/lib/middleware/mongo-sanitize.d.ts +32 -0
  36. package/lib/middleware/mongo-sanitize.js +100 -0
  37. package/lib/middleware/step-up.d.ts +45 -0
  38. package/lib/middleware/step-up.js +138 -0
  39. package/lib/openapi/extend-zod.d.ts +1 -0
  40. package/lib/openapi/extend-zod.js +6 -0
  41. package/lib/openapi/index.d.ts +2 -0
  42. package/lib/openapi/index.js +5 -0
  43. package/lib/openapi/registry.d.ts +17 -0
  44. package/lib/openapi/registry.js +38 -0
  45. package/lib/openapi/routes/ask-routes.d.ts +7 -0
  46. package/lib/openapi/routes/ask-routes.js +62 -0
  47. package/lib/openapi/routes/billing-routes.d.ts +1 -0
  48. package/lib/openapi/routes/billing-routes.js +66 -0
  49. package/lib/openapi/routes/image-registry-routes.d.ts +7 -0
  50. package/lib/openapi/routes/image-registry-routes.js +98 -0
  51. package/lib/openapi/routes/index.d.ts +5 -0
  52. package/lib/openapi/routes/index.js +28 -0
  53. package/lib/openapi/routes/message-routes.d.ts +1 -0
  54. package/lib/openapi/routes/message-routes.js +105 -0
  55. package/lib/openapi/routes/pipeline-routes.d.ts +1 -0
  56. package/lib/openapi/routes/pipeline-routes.js +105 -0
  57. package/lib/openapi/routes/pipeline-template-routes.d.ts +1 -0
  58. package/lib/openapi/routes/pipeline-template-routes.js +61 -0
  59. package/lib/openapi/routes/plugin-routes.d.ts +1 -0
  60. package/lib/openapi/routes/plugin-routes.js +96 -0
  61. package/lib/openapi/routes/quota-routes.d.ts +1 -0
  62. package/lib/openapi/routes/quota-routes.js +62 -0
  63. package/lib/openapi/schema-registry.d.ts +25 -0
  64. package/lib/openapi/schema-registry.js +91 -0
  65. package/lib/routes/health.d.ts +41 -0
  66. package/lib/routes/health.js +82 -0
  67. package/lib/routes/index.d.ts +1 -0
  68. package/lib/routes/index.js +4 -0
  69. package/lib/services/audit-spool.d.ts +80 -0
  70. package/lib/services/audit-spool.js +172 -0
  71. package/lib/services/cache-service.d.ts +124 -0
  72. package/lib/services/cache-service.js +276 -0
  73. package/lib/services/circuit-breaker.d.ts +45 -0
  74. package/lib/services/circuit-breaker.js +138 -0
  75. package/lib/services/compliance-client.d.ts +46 -0
  76. package/lib/services/compliance-client.js +128 -0
  77. package/lib/services/compliance-event-subscriber.d.ts +16 -0
  78. package/lib/services/compliance-event-subscriber.js +72 -0
  79. package/lib/services/durable-event-bus.d.ts +96 -0
  80. package/lib/services/durable-event-bus.js +204 -0
  81. package/lib/services/entity-events.d.ts +48 -0
  82. package/lib/services/entity-events.js +79 -0
  83. package/lib/services/env-redis.d.ts +44 -0
  84. package/lib/services/env-redis.js +94 -0
  85. package/lib/services/http-client.d.ts +143 -0
  86. package/lib/services/http-client.js +335 -0
  87. package/lib/services/index.d.ts +18 -0
  88. package/lib/services/index.js +20 -0
  89. package/lib/services/leader-lock.d.ts +45 -0
  90. package/lib/services/leader-lock.js +85 -0
  91. package/lib/services/quota.d.ts +130 -0
  92. package/lib/services/quota.js +264 -0
  93. package/lib/services/remote-audit-client.d.ts +160 -0
  94. package/lib/services/remote-audit-client.js +390 -0
  95. package/lib/services/retry-strategy.d.ts +74 -0
  96. package/lib/services/retry-strategy.js +118 -0
  97. package/lib/services/scheduler.d.ts +41 -0
  98. package/lib/services/scheduler.js +86 -0
  99. package/lib/services/service-boot.d.ts +20 -0
  100. package/lib/services/service-boot.js +28 -0
  101. package/lib/services/sse-ticket-store.d.ts +51 -0
  102. package/lib/services/sse-ticket-store.js +130 -0
  103. package/lib/services/token-revocation.d.ts +52 -0
  104. package/lib/services/token-revocation.js +120 -0
  105. package/lib/testing/tier-mock.d.ts +44 -0
  106. package/lib/testing/tier-mock.js +65 -0
  107. package/lib/types/audit-events.d.ts +69 -0
  108. package/lib/types/audit-events.js +4 -0
  109. package/lib/types/catalog-metadata.d.ts +36 -0
  110. package/lib/types/catalog-metadata.js +21 -0
  111. package/lib/types/common.d.ts +255 -0
  112. package/lib/types/common.js +41 -0
  113. package/lib/types/error-codes.d.ts +54 -0
  114. package/lib/types/error-codes.js +107 -0
  115. package/lib/types/feature-flags.d.ts +36 -0
  116. package/lib/types/feature-flags.js +128 -0
  117. package/lib/types/http.d.ts +27 -0
  118. package/lib/types/http.js +4 -0
  119. package/lib/types/index.d.ts +11 -0
  120. package/lib/types/index.js +14 -0
  121. package/lib/types/permissions.d.ts +65 -0
  122. package/lib/types/permissions.js +131 -0
  123. package/lib/types/pipeline-template.d.ts +30 -0
  124. package/lib/types/pipeline-template.js +13 -0
  125. package/lib/types/pipeline.d.ts +59 -0
  126. package/lib/types/pipeline.js +31 -0
  127. package/lib/types/quota-tiers.d.ts +79 -0
  128. package/lib/types/quota-tiers.js +221 -0
  129. package/lib/types/visibility.d.ts +20 -0
  130. package/lib/types/visibility.js +22 -0
  131. package/lib/utils/alias-resolver.d.ts +37 -0
  132. package/lib/utils/alias-resolver.js +68 -0
  133. package/lib/utils/audit.d.ts +15 -0
  134. package/lib/utils/audit.js +39 -0
  135. package/lib/utils/aws-scrub.d.ts +11 -0
  136. package/lib/utils/aws-scrub.js +67 -0
  137. package/lib/utils/compliance-attributes.d.ts +6 -0
  138. package/lib/utils/compliance-attributes.js +69 -0
  139. package/lib/utils/concurrency.d.ts +9 -0
  140. package/lib/utils/concurrency.js +29 -0
  141. package/lib/utils/crash-handlers.d.ts +18 -0
  142. package/lib/utils/crash-handlers.js +36 -0
  143. package/lib/utils/env.d.ts +28 -0
  144. package/lib/utils/env.js +54 -0
  145. package/lib/utils/headers.d.ts +18 -0
  146. package/lib/utils/headers.js +21 -0
  147. package/lib/utils/identity.d.ts +40 -0
  148. package/lib/utils/identity.js +51 -0
  149. package/lib/utils/index.d.ts +17 -0
  150. package/lib/utils/index.js +20 -0
  151. package/lib/utils/logger.d.ts +38 -0
  152. package/lib/utils/logger.js +174 -0
  153. package/lib/utils/metric-emitter.d.ts +36 -0
  154. package/lib/utils/metric-emitter.js +32 -0
  155. package/lib/utils/object.d.ts +13 -0
  156. package/lib/utils/object.js +18 -0
  157. package/lib/utils/params.d.ts +150 -0
  158. package/lib/utils/params.js +206 -0
  159. package/lib/utils/response.d.ts +117 -0
  160. package/lib/utils/response.js +223 -0
  161. package/lib/utils/safe-require.d.ts +13 -0
  162. package/lib/utils/safe-require.js +19 -0
  163. package/lib/utils/secret-encryption.d.ts +176 -0
  164. package/lib/utils/secret-encryption.js +374 -0
  165. package/lib/utils/ssrf.d.ts +30 -0
  166. package/lib/utils/ssrf.js +106 -0
  167. package/lib/validation/ai-schemas.d.ts +56 -0
  168. package/lib/validation/ai-schemas.js +78 -0
  169. package/lib/validation/common-schemas.d.ts +133 -0
  170. package/lib/validation/common-schemas.js +94 -0
  171. package/lib/validation/index.d.ts +7 -0
  172. package/lib/validation/index.js +10 -0
  173. package/lib/validation/message-schemas.d.ts +160 -0
  174. package/lib/validation/message-schemas.js +156 -0
  175. package/lib/validation/middleware.d.ts +72 -0
  176. package/lib/validation/middleware.js +65 -0
  177. package/lib/validation/pipeline-schemas.d.ts +181 -0
  178. package/lib/validation/pipeline-schemas.js +101 -0
  179. package/lib/validation/pipeline-template-schemas.d.ts +155 -0
  180. package/lib/validation/pipeline-template-schemas.js +66 -0
  181. package/lib/validation/plugin-schemas.d.ts +171 -0
  182. package/lib/validation/plugin-schemas.js +81 -0
  183. package/openapi.yaml +292 -0
  184. package/package.json +167 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # @pipeline-builder/api-core
2
+
3
+ 📖 **[View documentation](https://mwashburn160.github.io/pipeline-builder/)**
4
+
5
+ Core server-side utilities (auth middleware, response helpers, error codes, quota service, HTTP client, logging, AI provider catalog) shared by every [Pipeline Builder](https://mwashburn160.github.io/pipeline-builder/) backend service.
6
+
7
+ > Internal workspace package — consumed by other packages via `workspace:*`. Not published or used standalone.
8
+
9
+ ## Responsibilities
10
+
11
+ Provides the cross-cutting primitives every backend service depends on: JWT authentication and authorization middleware, inter-service token minting, standardized HTTP response and error helpers, request parameter/identity parsing, Zod validation schemas with an OpenAPI registry, a safe service-to-service HTTP client, quota enforcement types and client, structured Winston logging, an in-memory/Redis cache, domain event pub/sub, and the static AI provider catalog.
12
+
13
+ ## Key exports
14
+
15
+ ### Authentication & authorization (`./middleware`)
16
+ | Export | Purpose |
17
+ | --- | --- |
18
+ | `requireAuth` | JWT authentication middleware (accepts `RequireAuthOptions`, e.g. `allowOrgHeaderOverride` for internal routes) |
19
+ | `requireAdmin`, `requireSystemAdmin` | Role gates (admin/owner; system-org admin/owner) |
20
+ | `requireFeature` | Feature-flag gate |
21
+ | `isSystemOrgId`, `isSystemAdmin`, `isServicePrincipal` | Authorization helpers (`isServicePrincipal` is true when `req.user.sub` starts with `service:`) |
22
+ | `resolveVisibility` | Resolves the sharing rung: `'public'` needs the resource's `:publish` permission (clamped to `'org'` otherwise); an unspecified rung falls back per-entity |
23
+ | `signServiceToken`, `getServiceAuthHeader` | Mint short-lived inter-service JWTs (default TTL 5 min) accepted unmodified by `requireAuth` |
24
+
25
+ ### Responses & errors (`./utils`, `./errors`)
26
+ | Export | Purpose |
27
+ | --- | --- |
28
+ | `sendSuccess`, `sendError`, `sendBadRequest`, `sendInternalError`, `sendQuotaExceeded` | Standardized JSON responses |
29
+ | `sendPaginated`, `sendPaginatedNested`, `parsePaginationParams` | Paginated response helpers |
30
+ | `extractDbError`, `errorMessage` | Safe DB-error and error-to-string extraction |
31
+ | `ErrorCode`, `getStatusForErrorCode` | Standard error code enum and HTTP status mapping |
32
+ | `AppError`, `NotFoundError`, `ForbiddenError`, `ValidationError`, `ConflictError`, `UnauthorizedError` | Typed HTTP error classes |
33
+
34
+ ### Request parsing (`./utils`)
35
+ | Export | Purpose |
36
+ | --- | --- |
37
+ | `getParam`, `getRequiredParam`, `getParams`, `getOrgId`, `getAuthHeader` | Request parameter/header extraction |
38
+ | `parseQueryBoolean`, `parseQueryInt`, `parseQueryString` | Query-string coercion |
39
+ | `getIdentity`, `validateIdentity` | Parsed JWT identity (`RequestIdentity`) helpers |
40
+
41
+ ### HTTP client & services (`./services`)
42
+ | Export | Purpose |
43
+ | --- | --- |
44
+ | `InternalHttpClient`, `createSafeClient` | Service-to-service HTTP client (`ServiceConfig`, `RequestOptions`) |
45
+ | `createComplianceClient` / `ComplianceClient` | Typed compliance-service client built on the safe client |
46
+ | `QuotaService`, `createQuotaService`, `QuotaType`, `QuotaCheckResult`, `QuotaTier`, `QUOTA_TIERS`, `getTierLimits` | Quota enforcement client and tier presets |
47
+ | `CacheService`, `createCacheService` | In-memory TTL cache with optional Redis backend |
48
+ | `entityEvents` | Process-local domain event pub/sub for entity changes |
49
+
50
+ ### Logging, validation & OpenAPI
51
+ | Export | Purpose |
52
+ | --- | --- |
53
+ | `createLogger`, `logger` | Winston structured logger factory and default instance |
54
+ | `AIGenerateBodySchema`, `AIGenerateFromUrlBodySchema`, `PluginCreateSchema`, `PipelineFilterSchema`, `MessageCreateSchema`, plus `PaginationSchema`, `UUIDSchema`, `VisibilitySchema` | Zod request-validation schemas and shared building blocks |
55
+ | `registry`, `generateOpenApiSpec` | Shared schema registry and OpenAPI spec generation |
56
+
57
+ ### AI provider catalog (`./constants`)
58
+ | Export | Purpose |
59
+ | --- | --- |
60
+ | `AI_PROVIDER_CATALOG` | Static provider/model catalog |
61
+ | `AI_PROVIDER_ENV_VARS` | Provider-to-env-var mapping |
62
+ | `getAIProviderModels`, `getAIProviderName` | Lookup helpers for a provider's models/name |
63
+
64
+ ### Health (`./routes`)
65
+ | Export | Purpose |
66
+ | --- | --- |
67
+ | `createHealthRouter` | Registers `GET /health` (liveness) and `GET /ready` (readiness; 503 when a dependency is `'disconnected'`) |
68
+
69
+ ## Usage
70
+
71
+ ```ts
72
+ import {
73
+ requireAuth,
74
+ sendSuccess,
75
+ sendError,
76
+ NotFoundError,
77
+ createLogger,
78
+ } from '@pipeline-builder/api-core';
79
+
80
+ const log = createLogger('plugin-service');
81
+
82
+ router.get('/plugins/:id', requireAuth(), async (req, res) => {
83
+ const plugin = await plugins.findById(req.params.id);
84
+ if (!plugin) throw new NotFoundError('plugin not found');
85
+ return sendSuccess(res, plugin);
86
+ });
87
+ ```
88
+
89
+ ## Development
90
+
91
+ ```bash
92
+ pnpm build # projen build (compile + lint + test)
93
+ pnpm test # run the Jest test suite
94
+ ```
95
+
96
+ ## License
97
+
98
+ Apache-2.0. See [LICENSE](./LICENSE).
@@ -0,0 +1,52 @@
1
+ /** Metadata for a single AI model. */
2
+ export interface AIModelInfo {
3
+ /** Model identifier used in API calls (e.g. "claude-sonnet-5"). */
4
+ id: string;
5
+ /** Human-readable display name (e.g. "Claude Sonnet 5"). */
6
+ name: string;
7
+ }
8
+ /** Metadata for an AI provider with its available models. */
9
+ export interface AIProviderInfo {
10
+ /** Provider identifier (e.g. "anthropic", "openai", "google"). */
11
+ id: string;
12
+ /** Human-readable display name (e.g. "Anthropic"). */
13
+ name: string;
14
+ /** Models available for this provider. */
15
+ models: AIModelInfo[];
16
+ }
17
+ /**
18
+ * Standard AI provider catalog — single source of truth for all supported
19
+ * providers and their models. Used by both backend services and frontend
20
+ * components.
21
+ */
22
+ export declare const AI_PROVIDER_CATALOG: Record<string, AIProviderInfo>;
23
+ /**
24
+ * Environment variable names for each AI provider's API key.
25
+ * Used by backend services to initialize the provider registry.
26
+ */
27
+ export declare const AI_PROVIDER_ENV_VARS: Record<string, string>;
28
+ /**
29
+ * Provider id for a self-hosted, OpenAI-compatible endpoint — a Docker model image
30
+ * (Ollama, Docker Model Runner, vLLM) or any other server that speaks the OpenAI
31
+ * chat API. Unlike the fixed providers above, this one is NOT in the static catalog:
32
+ * its endpoint and model list are deployment-defined and resolved from env at
33
+ * runtime by {@link getOpenAICompatibleProvider}.
34
+ */
35
+ export declare const OPENAI_COMPATIBLE_PROVIDER_ID = "openai-compatible";
36
+ /**
37
+ * Resolve the OpenAI-compatible (local / self-hosted) provider from env, or `null`
38
+ * when no endpoint is configured. Enabled by `OPENAI_COMPATIBLE_BASE_URL`; the model
39
+ * list comes from `OPENAI_COMPATIBLE_MODELS` (comma list of `id[|Display Name]`),
40
+ * falling back to `OPENAI_COMPATIBLE_MODEL`, then a generic `local` id. The display
41
+ * name is overridable via `OPENAI_COMPATIBLE_NAME`.
42
+ *
43
+ * @returns Provider info for the configured local endpoint, or null if unset
44
+ */
45
+ export declare function getOpenAICompatibleProvider(): AIProviderInfo | null;
46
+ /**
47
+ * Get the model list for a given provider ID.
48
+ *
49
+ * @param providerId - Provider identifier (e.g. "anthropic")
50
+ * @returns Array of models, or empty array if the provider is unknown
51
+ */
52
+ export declare function getAIProviderModels(providerId: string): AIModelInfo[];
@@ -0,0 +1,129 @@
1
+ // Copyright 2026 Pipeline Builder Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // Catalog
4
+ /**
5
+ * Standard AI provider catalog — single source of truth for all supported
6
+ * providers and their models. Used by both backend services and frontend
7
+ * components.
8
+ */
9
+ export const AI_PROVIDER_CATALOG = {
10
+ 'anthropic': {
11
+ id: 'anthropic',
12
+ name: 'Anthropic',
13
+ models: [
14
+ { id: 'claude-sonnet-5', name: 'Claude Sonnet 5' },
15
+ { id: 'claude-opus-5', name: 'Claude Opus 5' },
16
+ { id: 'claude-haiku-4-5-20251001', name: 'Claude Haiku 4.5' },
17
+ ],
18
+ },
19
+ 'openai': {
20
+ id: 'openai',
21
+ name: 'OpenAI',
22
+ models: [
23
+ { id: 'gpt-5.6-sol', name: 'GPT-5.6 Sol' },
24
+ { id: 'gpt-5.6-terra', name: 'GPT-5.6 Terra' },
25
+ { id: 'gpt-5.6-luna', name: 'GPT-5.6 Luna' },
26
+ ],
27
+ },
28
+ 'google': {
29
+ id: 'google',
30
+ name: 'Google',
31
+ models: [
32
+ { id: 'gemini-3.7-flash', name: 'Gemini 3.7 Flash' },
33
+ { id: 'gemini-3.1-pro-preview', name: 'Gemini 3.1 Pro' },
34
+ ],
35
+ },
36
+ 'xai': {
37
+ id: 'xai',
38
+ name: 'xAI (Grok)',
39
+ models: [
40
+ { id: 'grok-4.6', name: 'Grok 4.6' },
41
+ { id: 'grok-4.5', name: 'Grok 4.5' },
42
+ { id: 'grok-4.3', name: 'Grok 4.3' },
43
+ ],
44
+ },
45
+ 'amazon-bedrock': {
46
+ id: 'amazon-bedrock',
47
+ name: 'Amazon Bedrock',
48
+ // Bedrock ids are region-scoped cross-region inference profiles; the `us.`
49
+ // prefix targets US regions — swap the prefix (eu./apac./…) to match your
50
+ // deploy region, and confirm availability in the Bedrock console.
51
+ models: [
52
+ { id: 'us.anthropic.claude-sonnet-4-5-20250929-v1:0', name: 'Claude Sonnet 4.5' },
53
+ { id: 'us.amazon.nova-pro-v1:0', name: 'Amazon Nova Pro' },
54
+ { id: 'us.amazon.nova-lite-v1:0', name: 'Amazon Nova Lite' },
55
+ ],
56
+ },
57
+ };
58
+ /**
59
+ * Environment variable names for each AI provider's API key.
60
+ * Used by backend services to initialize the provider registry.
61
+ */
62
+ export const AI_PROVIDER_ENV_VARS = {
63
+ 'anthropic': 'ANTHROPIC_API_KEY',
64
+ 'openai': 'OPENAI_API_KEY',
65
+ 'google': 'GOOGLE_GENERATIVE_AI_API_KEY',
66
+ 'xai': 'XAI_API_KEY',
67
+ 'amazon-bedrock': 'AWS_ACCESS_KEY_ID',
68
+ };
69
+ /**
70
+ * Provider id for a self-hosted, OpenAI-compatible endpoint — a Docker model image
71
+ * (Ollama, Docker Model Runner, vLLM) or any other server that speaks the OpenAI
72
+ * chat API. Unlike the fixed providers above, this one is NOT in the static catalog:
73
+ * its endpoint and model list are deployment-defined and resolved from env at
74
+ * runtime by {@link getOpenAICompatibleProvider}.
75
+ */
76
+ export const OPENAI_COMPATIBLE_PROVIDER_ID = 'openai-compatible';
77
+ /**
78
+ * Parse a `id[|Display Name][,id2[|Name2]]` env string into model metadata. The
79
+ * id/name separator is `|` (NOT `:`) because model ids commonly contain colons —
80
+ * e.g. Ollama tags (`qwen2.5-coder:7b`) and Bedrock inference profiles.
81
+ */
82
+ function parseModelList(raw) {
83
+ return raw
84
+ .split(',')
85
+ .map((s) => s.trim())
86
+ .filter(Boolean)
87
+ .map((entry) => {
88
+ const idx = entry.indexOf('|');
89
+ const id = (idx === -1 ? entry : entry.slice(0, idx)).trim();
90
+ const name = (idx === -1 ? '' : entry.slice(idx + 1)).trim() || id;
91
+ return { id, name };
92
+ })
93
+ .filter((m) => m.id.length > 0);
94
+ }
95
+ /**
96
+ * Resolve the OpenAI-compatible (local / self-hosted) provider from env, or `null`
97
+ * when no endpoint is configured. Enabled by `OPENAI_COMPATIBLE_BASE_URL`; the model
98
+ * list comes from `OPENAI_COMPATIBLE_MODELS` (comma list of `id[|Display Name]`),
99
+ * falling back to `OPENAI_COMPATIBLE_MODEL`, then a generic `local` id. The display
100
+ * name is overridable via `OPENAI_COMPATIBLE_NAME`.
101
+ *
102
+ * @returns Provider info for the configured local endpoint, or null if unset
103
+ */
104
+ export function getOpenAICompatibleProvider() {
105
+ const baseURL = process.env.OPENAI_COMPATIBLE_BASE_URL;
106
+ if (!baseURL)
107
+ return null;
108
+ const raw = process.env.OPENAI_COMPATIBLE_MODELS ?? process.env.OPENAI_COMPATIBLE_MODEL ?? 'local|Local model';
109
+ const models = parseModelList(raw);
110
+ return {
111
+ id: OPENAI_COMPATIBLE_PROVIDER_ID,
112
+ name: process.env.OPENAI_COMPATIBLE_NAME || 'Local model (OpenAI-compatible)',
113
+ models: models.length > 0 ? models : [{ id: 'local', name: 'Local model' }],
114
+ };
115
+ }
116
+ // Helpers
117
+ /**
118
+ * Get the model list for a given provider ID.
119
+ *
120
+ * @param providerId - Provider identifier (e.g. "anthropic")
121
+ * @returns Array of models, or empty array if the provider is unknown
122
+ */
123
+ export function getAIProviderModels(providerId) {
124
+ if (providerId === OPENAI_COMPATIBLE_PROVIDER_ID) {
125
+ return getOpenAICompatibleProvider()?.models ?? [];
126
+ }
127
+ return AI_PROVIDER_CATALOG[providerId]?.models ?? [];
128
+ }
129
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWktcHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2Nvbn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GUpJyxcbiAgICBtb2RlbHM6IG1vZGVscy5sZW5ndGggPiAwID8gbW9kZWxzIDogW3sgaWQ6ICdsb2NhbCcsIG5hbWU6ICdMb2NhbCBtb2RlbCcgfV0sXG4gIH07XG59XG5cbi8vIEhlbHBlcnNcblxuLyoqXG4gKiBHZXQgdGhlIG1vZGVsIGxpc3QgZm9yIGEgZ2l2ZW4gcHJvdmlkZXIgSUQuXG4gKlxuICogQHBhcmFtIHByb3ZpZGVySWQgLSBQcm92aWRlciBpZGVudGlmaWVyIChlLmcuIFwiYW50aHJvcGljXCIpXG4gKiBAcmV0dXJucyBBcnJheSBvZiBtb2RlbHMsIG9yIGVtcHR5IGFycmF5IGlmIHRoZSBwcm92aWRlciBpcyB1bmtub3duXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBnZXRBSVByb3ZpZGVyTW9kZWxzKHByb3ZpZGVySWQ6IHN0cmluZyk6IEFJTW9kZWxJbmZvW10ge1xuICBpZiAocHJvdmlkZXJJZCA9PT0gT1BFTkFJX0NPTVBBVElCTEVfUFJPVklERVJfSUQpIHtcbiAgICByZXR1cm4gZ2V0T3BlbkFJQ29tcGF0aWJsZVByb3ZpZGVyKCk/Lm1vZGVscyA/PyBbXTtcbiAgfVxuICByZXR1cm4gQUlfUFJPVklERVJfQ0FUQUxPR1twcm92aWRlcklkXT8ubW9kZWxzID8/IFtdO1xufVxuIl19
@@ -0,0 +1,20 @@
1
+ /**
2
+ * HTTP status codes organized by category.
3
+ */
4
+ export declare const HttpStatus: {
5
+ readonly OK: 200;
6
+ readonly CREATED: 201;
7
+ readonly ACCEPTED: 202;
8
+ readonly NO_CONTENT: 204;
9
+ readonly BAD_REQUEST: 400;
10
+ readonly UNAUTHORIZED: 401;
11
+ readonly FORBIDDEN: 403;
12
+ readonly NOT_FOUND: 404;
13
+ readonly CONFLICT: 409;
14
+ readonly UNPROCESSABLE_ENTITY: 422;
15
+ readonly TOO_MANY_REQUESTS: 429;
16
+ readonly INTERNAL_SERVER_ERROR: 500;
17
+ readonly BAD_GATEWAY: 502;
18
+ readonly SERVICE_UNAVAILABLE: 503;
19
+ readonly GATEWAY_TIMEOUT: 504;
20
+ };
@@ -0,0 +1,26 @@
1
+ // Copyright 2026 Pipeline Builder Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * HTTP status codes organized by category.
5
+ */
6
+ export const HttpStatus = {
7
+ // Success 2xx
8
+ OK: 200,
9
+ CREATED: 201,
10
+ ACCEPTED: 202,
11
+ NO_CONTENT: 204,
12
+ // Client Errors 4xx
13
+ BAD_REQUEST: 400,
14
+ UNAUTHORIZED: 401,
15
+ FORBIDDEN: 403,
16
+ NOT_FOUND: 404,
17
+ CONFLICT: 409,
18
+ UNPROCESSABLE_ENTITY: 422,
19
+ TOO_MANY_REQUESTS: 429,
20
+ // Server Errors 5xx
21
+ INTERNAL_SERVER_ERROR: 500,
22
+ BAD_GATEWAY: 502,
23
+ SERVICE_UNAVAILABLE: 503,
24
+ GATEWAY_TIMEOUT: 504,
25
+ };
26
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC1zdGF0dXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3RhbnRzL2h0dHAtc3RhdHVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLCtDQUErQztBQUMvQyxzQ0FBc0M7QUFFdEM7O0dBRUc7QUFDSCxNQUFNLENBQUMsTUFBTSxVQUFVLEdBQUc7SUFDeEIsY0FBYztJQUNkLEVBQUUsRUFBRSxHQUFHO0lBQ1AsT0FBTyxFQUFFLEdBQUc7SUFDWixRQUFRLEVBQUUsR0FBRztJQUNiLFVBQVUsRUFBRSxHQUFHO0lBRWYsb0JBQW9CO0lBQ3BCLFdBQVcsRUFBRSxHQUFHO0lBQ2hCLFlBQVksRUFBRSxHQUFHO0lBQ2pCLFNBQVMsRUFBRSxHQUF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G59IGFzIGNvbnN0O1xuIl19
@@ -0,0 +1,3 @@
1
+ export * from './http-status.js';
2
+ export * from './ai-providers.js';
3
+ export * from './time.js';
@@ -0,0 +1,6 @@
1
+ // Copyright 2026 Pipeline Builder Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export * from './http-status.js';
4
+ export * from './ai-providers.js';
5
+ export * from './time.js';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY29uc3RhbnRzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLCtDQUErQztBQUMvQyxzQ0FBc0M7QUFFdEMsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsV0FBVyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IDIwMjYgUGlwZWxpbmUgQnVpbGRlciBDb250cmlidXRvcnNcbi8vIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG5cbmV4cG9ydCAqIGZyb20gJy4vaHR0cC1zdGF0dXMuanMnO1xuZXhwb3J0ICogZnJvbSAnLi9haS1wcm92aWRlcnMuanMnO1xuZXhwb3J0ICogZnJvbSAnLi90aW1lLmpzJztcbiJdfQ==
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Named time constants to prevent magic-number confusion.
3
+ * All values include their unit in the name to avoid ms/s ambiguity.
4
+ */
5
+ /** 30 seconds in milliseconds — default SSE ticket TTL. */
6
+ export declare const SSE_TICKET_TTL_MS = 30000;
7
+ /** 4 hours in seconds — billing plan cache TTL. */
8
+ export declare const CACHE_TTL_BILLING_PLANS_SECS = 14400;
9
+ /** 4 hours in milliseconds — temp directory cleanup threshold. */
10
+ export declare const TEMP_DIR_MAX_AGE_MS = 14400000;
@@ -0,0 +1,13 @@
1
+ // Copyright 2026 Pipeline Builder Contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * Named time constants to prevent magic-number confusion.
5
+ * All values include their unit in the name to avoid ms/s ambiguity.
6
+ */
7
+ /** 30 seconds in milliseconds — default SSE ticket TTL. */
8
+ export const SSE_TICKET_TTL_MS = 30_000;
9
+ /** 4 hours in seconds — billing plan cache TTL. */
10
+ export const CACHE_TTL_BILLING_PLANS_SECS = 14_400;
11
+ /** 4 hours in milliseconds — temp directory cleanup threshold. */
12
+ export const TEMP_DIR_MAX_AGE_MS = 14_400_000;
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb25zdGFudHMvdGltZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwrQ0FBK0M7QUFDL0Msc0NBQXNDO0FBRXRDOzs7R0FHRztBQUVILDJEQUEyRDtBQUMzRCxNQUFNLENBQUMsTUFBTSxpQkFBaUIsR0FBRyxNQUFNLENBQUM7QUFFeEMsbURBQW1EO0FBQ25ELE1BQU0sQ0FBQyxNQUFNLDRCQUE0QixHQUFHLE1BQU0sQ0FBQztBQUVuRCxrRUFBa0U7QUFDbEUsTUFBTSxDQUFDLE1BQU0sbUJBQW1CLEdBQUcsVUFBVSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gQ29weXJpZ2h0IDIwMjYgUGlwZWxpbmUgQnVpbGRlciBDb250cmlidXRvcnNcbi8vIFNQRFgtTGljZW5zZS1JZGVudGlmaWVyOiBBcGFjaGUtMi4wXG5cbi8qKlxuICogTmFtZWQgdGltZSBjb25zdGFudHMgdG8gcHJldmVudCBtYWdpYy1udW1iZXIgY29uZnVzaW9uLlxuICogQWxsIHZhbHVlcyBpbmNsdWRlIHRoZWlyIHVuaXQgaW4gdGhlIG5hbWUgdG8gYXZvaWQgbXMvcyBhbWJpZ3VpdHkuXG4gKi9cblxuLyoqIDMwIHNlY29uZHMgaW4gbWlsbGlzZWNvbmRzIOKAlCBkZWZhdWx0IFNTRSB0aWNrZXQgVFRMLiAqL1xuZXhwb3J0IGNvbnN0IFNTRV9USUNLRVRfVFRMX01TID0gMzBfMDAwO1xuXG4vKiogNCBob3VycyBpbiBzZWNvbmRzIOKAlCBiaWxsaW5nIHBsYW4gY2FjaGUgVFRMLiAqL1xuZXhwb3J0IGNvbnN0IENBQ0hFX1RUTF9CSUxMSU5HX1BMQU5TX1NFQ1MgPSAxNF80MDA7XG5cbi8qKiA0IGhvdXJzIGluIG1pbGxpc2Vjb25kcyDigJQgdGVtcCBkaXJlY3RvcnkgY2xlYW51cCB0aHJlc2hvbGQuICovXG5leHBvcnQgY29uc3QgVEVNUF9ESVJfTUFYX0FHRV9NUyA9IDE0XzQwMF8wMDA7XG4iXX0=
@@ -0,0 +1,30 @@
1
+ import { ErrorCode } from '../types/error-codes.js';
2
+ /**
3
+ * Base application error with HTTP status code and error code.
4
+ * Extend this for domain-specific error types.
5
+ */
6
+ export declare class AppError extends Error {
7
+ readonly statusCode: number;
8
+ readonly code: ErrorCode;
9
+ constructor(statusCode: number, code: ErrorCode, message: string);
10
+ }
11
+ /** 404 — Resource not found. */
12
+ export declare class NotFoundError extends AppError {
13
+ constructor(message: string);
14
+ }
15
+ /** 403 — Insufficient permissions. */
16
+ export declare class ForbiddenError extends AppError {
17
+ constructor(message: string);
18
+ }
19
+ /** 400 — Validation / bad request. */
20
+ export declare class ValidationError extends AppError {
21
+ constructor(message: string);
22
+ }
23
+ /** 409 — Conflict / duplicate. */
24
+ export declare class ConflictError extends AppError {
25
+ constructor(message: string);
26
+ }
27
+ /** 401 — Unauthorized / authentication required. */
28
+ export declare class UnauthorizedError extends AppError {
29
+ constructor(message: string);
30
+ }