@classytic/arc 2.41.1 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EventTransport-CbUKDzZZ.d.mts → EventTransport-CiicKz2Z.d.mts} +1 -1
- package/dist/{EventTransport-DSqD_Xsg.mjs → EventTransport-DZWDsaPa.mjs} +22 -17
- package/dist/{HookSystem-CMF94SEA.mjs → HookSystem-yjEgn7Cm.mjs} +2 -2
- package/dist/{QueryCache-DFA-QrU9.d.mts → QueryCache--5uAuYPW.d.mts} +7 -3
- package/dist/{ResourceRegistry-MGpXoxHZ.mjs → ResourceRegistry-DJxHUpE4.mjs} +44 -13
- package/dist/acquire-BozJ-9yt.mjs +35 -0
- package/dist/actionPermissions-5N04zBL4.mjs +772 -0
- package/dist/audit/index.d.mts +46 -8
- package/dist/audit/index.mjs +48 -26
- package/dist/auth/audit.d.mts +8 -8
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +46 -16
- package/dist/auth/index.mjs +134 -156
- package/dist/auth/redis-session.d.mts +4 -5
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-DawKGoXb.mjs → authorizationDecision-wX3SA9w_.mjs} +7 -102
- package/dist/{base-CxrV1LmG.d.mts → base-CZyixEQR.d.mts} +27 -5
- package/dist/boundedMap-DWiKW7lP.mjs +57 -0
- package/dist/{buildHandler-CvxKOc0m.mjs → buildHandler-Bswu_vNb.mjs} +4 -4
- package/dist/cache/index.d.mts +31 -43
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-DbCBxlgw.mjs → caching-Drp68DIS.mjs} +3 -3
- package/dist/claimed-DYvQoZLv.mjs +8 -0
- package/dist/cleanup/index.d.mts +18 -22
- package/dist/cleanup/index.mjs +27 -73
- package/dist/cli/commands/describe.d.mts +7 -5
- package/dist/cli/commands/describe.mjs +7 -4
- package/dist/cli/commands/docs.d.mts +2 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.d.mts +2 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -3
- package/dist/cli/commands/init.mjs +2 -3
- package/dist/cli/commands/introspect.d.mts +2 -3
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-D5Ubn1fe.mjs → constants-B2QHb6u6.mjs} +4 -2
- package/dist/context/index.d.mts +11 -14
- package/dist/context/index.mjs +18 -38
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +8 -8
- package/dist/{core-5lazhva9.mjs → core-COcqo0Cp.mjs} +15 -5
- package/dist/{createActionRouter-DNqoaK81.mjs → createActionRouter-zG13rpPJ.mjs} +97 -39
- package/dist/{createAggregationRouter-BcbQJf10.mjs → createAggregationRouter-CWRz96Vr.mjs} +11 -8
- package/dist/{preloadResources-f3boenVZ.mjs → createApp-BGLYtErt.mjs} +305 -394
- package/dist/{createMcpServer-CbDWkZ1T.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
- package/dist/{defineAggregation-D_eJjm5A.mjs → defineAggregation--3xguLkk.mjs} +1 -1
- package/dist/{defineResource-DxkMTjRn.mjs → defineResource-gUp9ug66.mjs} +118 -1024
- package/dist/discovery/index.d.mts +6 -7
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +11 -5
- package/dist/docs/index.mjs +4 -4
- package/dist/{elevation-CkvG0LG2.mjs → elevation-BG4gnMsJ.mjs} +41 -12
- package/dist/{elevation-BXCfVcNG.d.mts → elevation-BW2J3tNj.d.mts} +1 -2
- package/dist/encryption/index.d.mts +5 -5
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-D1GHKGlV.mjs → errorHandler-COHw3N1b.mjs} +26 -5
- package/dist/{errors-BH7YU_9O.mjs → errors-CW4anJBy.mjs} +58 -23
- package/dist/{errors-BGdVwP25.d.mts → errors-JYc9vwqE.d.mts} +9 -0
- package/dist/{eventPlugin-B52abJ8W.d.mts → eventPlugin-BtmA4-3P.d.mts} +65 -9
- package/dist/{eventPlugin-zZY-unhr.mjs → eventPlugin-BweHAVws.mjs} +82 -21
- package/dist/{subscribe-helpers-DatDkcuG.mjs → eventTypes-N4-omQFR.mjs} +151 -17
- package/dist/events/index.d.mts +43 -18
- package/dist/events/index.mjs +49 -53
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +139 -157
- package/dist/events/transports/redis.d.mts +5 -6
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.d.mts +42 -27
- package/dist/factory/index.mjs +213 -32
- package/dist/{fastify-augmentation-Cq2nHVaW.d.mts → fastify-augmentation-DRlCIWE9.d.mts} +11 -25
- package/dist/{fields-BHrkoF5y.mjs → fields-A5crhsJb.mjs} +1 -1
- package/dist/{fields-I_EeRWND.d.mts → fields-BBSpf8pS.d.mts} +1 -1
- package/dist/filter-merge-DGM-GQ1J.mjs +99 -0
- package/dist/{generate-BLRf2m3y.mjs → generate-BXKo2Gc8.mjs} +2 -2
- package/dist/{headers-BIXWKrzQ.mjs → headers-DKZQKL-Z.mjs} +2 -2
- package/dist/health-BYAwA6YS.mjs +22 -0
- package/dist/{health-ZRHeDHXH.mjs → health-CrqUp3sz.mjs} +115 -55
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.mjs +2 -3
- package/dist/idempotency/index.d.mts +36 -10
- package/dist/idempotency/index.mjs +230 -111
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +77 -12
- package/dist/{index-D4u76eQW.d.mts → index-Beg3aNnK.d.mts} +23 -101
- package/dist/{preloadResources-CjS2OfpU.d.mts → index-BkV55WlV.d.mts} +37 -38
- package/dist/{index-BHdZD8zK.d.mts → index-Bxriq3so.d.mts} +84 -21
- package/dist/index-CUJvoyw3.d.mts +510 -0
- package/dist/{index-CbJiYrfv.d.mts → index-Chgz3d0i.d.mts} +1 -1
- package/dist/{index-DHbyPo5j.d.mts → index-WH7xgvxS.d.mts} +304 -254
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +11 -11
- package/dist/{init-CpLkjU18.mjs → init-BPzK5Lnr.mjs} +1 -1
- package/dist/integrations/event-gateway.d.mts +11 -7
- package/dist/integrations/event-gateway.mjs +4 -4
- package/dist/integrations/index.d.mts +3 -3
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.d.mts +1 -1
- package/dist/integrations/jobs/index.mjs +18 -5
- package/dist/integrations/mcp/index.d.mts +102 -89
- package/dist/integrations/mcp/index.mjs +19 -4
- package/dist/integrations/mcp/testing.d.mts +8 -9
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.d.mts +85 -144
- package/dist/integrations/streamline.mjs +131 -55
- package/dist/integrations/webhooks.d.mts +83 -143
- package/dist/integrations/webhooks.mjs +36 -80
- package/dist/integrations/websocket-pushref-redis.d.mts +5 -6
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.d.mts +5 -6
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.d.mts +3 -3
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{interface-DEWNOMza.d.mts → interface-JJzwH4Ro.d.mts} +34 -2
- package/dist/{jsonBody-ELR9lfeU.mjs → jsonBody-YIq-vGLv.mjs} +2 -2
- package/dist/{keys-cpZCtcIE.mjs → keys-CpoiZ8hU.mjs} +7 -18
- package/dist/{loadResources-BPfWiI5s.mjs → loadResources-6jO52-RR.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-ixtfL3J2.mjs → loadResourcesFromEntry-MP8xEppu.mjs} +2 -2
- package/dist/logger/index.d.mts +9 -17
- package/dist/logger/index.mjs +2 -153
- package/dist/logger-D4V1zGLI.mjs +160 -0
- package/dist/{mcpPlugin-BX5PujI0.mjs → mcpPlugin-srPc7ItN.mjs} +446 -170
- package/dist/{memory-Iotz0cCx.mjs → memory-CTa5pOCW.mjs} +36 -34
- package/dist/{metrics-NMsmpRmY.mjs → metrics-DsZrvnpB.mjs} +39 -72
- package/dist/middleware/index.d.mts +5 -5
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.d.mts +13 -13
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-DpLJG2_N.mjs → module--L0iBIZz.mjs} +8 -8
- package/dist/mongodb-memory-server-CHhYSq5y.mjs +35539 -0
- package/dist/mongoose-CYJCLyi-.mjs +67451 -0
- package/dist/multiTenant-CAtYlW6H.d.mts +104 -0
- package/dist/{multipartBody-DtRWM6_U.mjs → multipartBody-Cc7eZ9cq.mjs} +46 -7
- package/dist/node-D8UZv_8c.mjs +41236 -0
- package/dist/{openapi-CmFf3yq_.mjs → openapi-CMegfsm8.mjs} +48 -10
- package/dist/outbox-admin/index.d.mts +5 -5
- package/dist/outbox-admin/index.mjs +6 -18
- package/dist/{outbox-module-D2z5WkDY.mjs → outbox-module-Ryk270jd.mjs} +203 -33
- package/dist/{outbox-module-BHdUnuuK.d.mts → outbox-module-gZCHoE4H.d.mts} +79 -6
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +8 -6
- package/dist/{permissions-D8TBH44E.mjs → permissions-C5ijIz5Q.mjs} +149 -33
- package/dist/{pipe-FMWNheSO.mjs → pipe-D81zMtWs.mjs} +2 -2
- package/dist/pipeline/index.d.mts +7 -7
- package/dist/pipeline/index.mjs +2 -2
- package/dist/plan-CJGMKoui.mjs +565 -0
- package/dist/{BaseController-CYEwjyjN.mjs → plugin-DALd9dcF.mjs} +1269 -346
- package/dist/plugins/index.d.mts +17 -14
- package/dist/plugins/index.mjs +44 -22
- package/dist/plugins/response-cache.d.mts +5 -6
- package/dist/plugins/response-cache.mjs +8 -14
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-CXWZIzTv.mjs → pluralize-COUNYo3d.mjs} +1 -1
- package/dist/presets/filesUpload.d.mts +8 -8
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +35 -40
- package/dist/presets/index.mjs +4 -4
- package/dist/presets/multiTenant.d.mts +2 -107
- package/dist/presets/multiTenant.mjs +22 -162
- package/dist/presets/search.d.mts +9 -10
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-ZJSPgmT2.mjs → presets-CONf2Qem.mjs} +99 -107
- package/dist/{projection-BzIgzoKZ.mjs → projection-wFoLqdss.mjs} +2 -2
- package/dist/{pushref-registry-Dov9l4qE.d.mts → pushref-registry-UxCkoA4C.d.mts} +1 -1
- package/dist/{queryCachePlugin-DZHPOm9p.mjs → queryCachePlugin-BATECpyh.mjs} +12 -14
- package/dist/{queryCachePlugin-BzqxconG.d.mts → queryCachePlugin-C2lZjTxk.d.mts} +1 -1
- package/dist/{rateLimitKey-BvOvcBDi.mjs → rateLimitKey-DVEZ_UpV.mjs} +1 -1
- package/dist/{realtime-8tIQWZz4.mjs → realtime-xyubMKSB.mjs} +25 -21
- package/dist/{redis-Bzi1y3F9.d.mts → redis-BDgv9Glw.d.mts} +17 -24
- package/dist/redis-stream-BMk-bpQS.d.mts +219 -0
- package/dist/redisShapes-CQksY67q.d.mts +55 -0
- package/dist/registry/index.d.mts +15 -10
- package/dist/registry/index.mjs +4 -4
- package/dist/{registry-DNkgGQcK.mjs → registry-Bdzg-hdm.mjs} +13 -10
- package/dist/{renewingLease-yF8BdW4b.mjs → renewingLease-BFJxGPuh.mjs} +1 -1
- package/dist/{replyHelpers-CNdvMfM4.mjs → replyHelpers-Bnc6lJyy.mjs} +2 -2
- package/dist/{requestContext-cDkAUr-P.mjs → requestContext-C10UeFe5.mjs} +1 -1
- package/dist/requirement-Bu50QALH.mjs +35 -0
- package/dist/requirement-CbiLdQ1n.d.mts +22 -0
- package/dist/resourceRateLimit-Wf6d6FL9.d.mts +30 -0
- package/dist/resourceRateLimit-urWPJxrt.mjs +180 -0
- package/dist/rolldown-runtime-MYrLNGnq.mjs +45 -0
- package/dist/routeValidator-DHtpzrzk.mjs +70 -0
- package/dist/{runtimeCapabilities-CkhS6jn6.mjs → runtimeCapabilities-DIMKMV2G.mjs} +1 -1
- package/dist/{schedules-j6uXXAeJ.mjs → schedules-CKTs5ys8.mjs} +46 -37
- package/dist/{schemaConverter-BVA7cFRG.mjs → schemaConverter-BVjkQ5DD.mjs} +2 -2
- package/dist/{schemaIR-CTvPDoPB.mjs → schemaIR-BA0Hb21Y.mjs} +2 -2
- package/dist/schemas/index.d.mts +20 -10
- package/dist/schemas/index.mjs +8 -3
- package/dist/scim/index.d.mts +13 -13
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +4 -4
- package/dist/scope/index.mjs +6 -6
- package/dist/{scope-BUi1xV1I.mjs → scope-DINaj7Ax.mjs} +4 -4
- package/dist/shutdown-LpLMH8T1.mjs +59 -0
- package/dist/{simpleEqualityMatcher-C9bzq2gO.mjs → simpleEqualityMatcher-DbwIM1f1.mjs} +1 -1
- package/dist/{sse-BeqVKQKu.mjs → sse-BzJFPX_1.mjs} +11 -15
- package/dist/{sseStream-Ppzo-WUH.mjs → sseStream-DQChzGTs.mjs} +2 -2
- package/dist/{store-helpers-dW71XVWL.mjs → store-helpers-Coj9RhOZ.mjs} +1 -1
- package/dist/{streaming-IcRFjWQU.mjs → streaming-JzB5CAga.mjs} +1 -1
- package/dist/subscriberIdentity-DeyppIif.mjs +28 -0
- package/dist/tenancy-DxV8OuX2.mjs +43 -0
- package/dist/tenantPreparation-CBvvAcAj.mjs +67 -0
- package/dist/testing/cleanupStoreContract.d.mts +4 -5
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +215 -197
- package/dist/testing/index.mjs +289 -214
- package/dist/testing/outboxStoreContract.d.mts +4 -5
- package/dist/testing/outboxStoreContract.mjs +137 -2
- package/dist/testing/requiredPorts.d.mts +16 -0
- package/dist/testing/requiredPorts.mjs +65 -0
- package/dist/testing/storageContract.d.mts +4 -5
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/timing-CntavTlR.mjs +46 -0
- package/dist/{transactionContext-CPbdlnVw.mjs → transactionContext-orvnGu4F.mjs} +1 -1
- package/dist/{typeGuards-BLjPgVBm.mjs → typeGuards-kEaP_WmO.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-DfVDvkdP.d.mts → types-BJ-2XqVF.d.mts} +189 -204
- package/dist/{types-CWQn9-IC.d.mts → types-D3Ixsh00.d.mts} +22 -9
- package/dist/{types-CgenB1gv.mjs → types-fvO6Ovzx.mjs} +4 -4
- package/dist/usage/index.d.mts +5 -6
- package/dist/usage/index.mjs +5 -5
- package/dist/{userHelpers-ChRvkuSZ.mjs → userHelpers-C76zD5pa.mjs} +1 -1
- package/dist/utils/index.d.mts +125 -264
- package/dist/utils/index.mjs +13 -12
- package/dist/{utils-CxcctrAh.mjs → utils-BpkVZ8rB.mjs} +315 -404
- package/dist/{validate-DrYWnOzI.mjs → validate-CWp-lsrm.mjs} +6 -14
- package/dist/{versioning-D6JIK8Tk.d.mts → versioning-Bsb51gGT.d.mts} +28 -13
- package/dist/{versioning-DKkT4hNJ.mjs → versioning-CHhL9P3o.mjs} +4 -4
- package/dist/{websocket-BOXVggMf.d.mts → websocket-Cs4awVyD.d.mts} +1 -1
- package/dist/{workScope-CxKqoIFn.mjs → workScope-n9a7d_lZ.mjs} +2 -2
- package/package.json +57 -59
- package/skills/arc/SKILL.md +13 -4
- package/skills/arc/references/auth.md +8 -5
- package/skills/arc/references/integrations.md +1 -1
- package/skills/arc/references/mcp.md +8 -6
- package/skills/arc/references/multi-tenancy.md +19 -14
- package/skills/arc/references/production.md +27 -10
- package/dist/actionPermissions-BoPGQ5-4.mjs +0 -350
- package/dist/index-CFfLKMH4.d.mts +0 -290
- package/dist/interface-YzIbF7Ii.mjs +0 -17
- package/dist/redis-stream-BPKscsTB.d.mts +0 -260
- package/dist/registerRoute-Bsnk6NiZ.mjs +0 -364
- package/dist/rolldown-runtime-eysyzFAF.mjs +0 -15
- package/dist/sync/changelog.d.mts +0 -3
- package/dist/sync/changelog.mjs +0 -3
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
import { _ as
|
|
3
|
-
import { _ as
|
|
4
|
-
import {
|
|
5
|
-
import { a as
|
|
2
|
+
import { _ as ResourceLike, a as ArcPortRegistry, c as LazyBridge, d as ModulePorts, f as ModuleRequirements, g as LoadResourcesOptions, h as ModuleSetupContext, i as ArcModuleRegistry, l as ModuleContribution, m as ModuleDisposer, n as ArcModule, o as ArcPorts, p as PortName, r as ArcModuleInput, s as EventHandlerDefinition, t as ArcCompositionConfig, u as ModuleName, v as ResourceModule, w as HealthCheck, y as loadResources } from "../types-BJ-2XqVF.mjs";
|
|
3
|
+
import { $ as verifyModuleGraph, A as AsyncApiCatalogEntry, B as ModuleGraphMode, C as planModules, D as ModuleExtension, E as subscribeModuleEventHandlers, F as DurabilityFacts, G as activateBridges, H as ModuleGraphOptions, I as HandlerDurabilityFact, J as crudEventsOf, K as analyzeModuleGraph, L as ModuleGraph, M as toAsyncApi, N as CrudSurface, O as extendModule, P as DerivedPublishes, Q as verifyEventDurability, R as ModuleGraphAnalysis, S as compositionProblems, T as orderModules, U as ModuleKind, V as ModuleGraphNode, W as SkippedBridge, X as eventTopology, Y as dependentsOf, Z as renderModuleGraph, _ as ClosureNode, a as lazyModuleExports, b as PlanModulesOptions, c as getModuleResources, d as resolveContribution, f as resolveModule, g as withRelayNudge, h as createRelayNudge, i as hasModuleExports, j as AsyncApiInfo, k as collectModuleWorkflows, l as getModuleState, m as RelayOption, n as getModuleExports, o as lazyRequiredModuleExports, p as RelayNudge, q as buildModuleGraph, r as getOptionalModuleExports, s as ModuleState, t as defineModule, u as hasModule, v as CompositionProblem, w as resolveModuleClosure, x as assertComposable, y as ModulePlan, z as ModuleGraphIssue } from "../index-CUJvoyw3.mjs";
|
|
4
|
+
import { a as ResolvedModuleDescriptor, o as ResolvedModuleLifecycle, s as ResolvedResourceDescriptor } from "../fastify-augmentation-DRlCIWE9.mjs";
|
|
5
|
+
import { a as UnderPressureOptions, c as CustomAuthenticatorOption, i as RawBodyOptions, l as CustomPluginAuthOption, n as CreateAppOptions, o as AuthOption, r as MultipartOptions, s as BetterAuthOption, t as BootDisposer, u as JwtAuthOption } from "../index-BkV55WlV.mjs";
|
|
6
6
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
7
7
|
//#region src/factory/createApp.d.ts
|
|
8
8
|
/**
|
|
9
|
-
* Default redact paths
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* outgoing logs may carry either), API-key headers, and any nested
|
|
14
|
-
* `password` / `token` / `secret` / `apiKey` fields anywhere in the log
|
|
15
|
-
* tree.
|
|
16
|
-
*
|
|
17
|
-
* Hosts that need NO redaction (test fixtures, security audits) opt out
|
|
18
|
-
* with `logger: { redact: [] }`. Hosts that need MORE redaction supply
|
|
19
|
-
* their own `redact` and arc steps aside — this default never overrides
|
|
20
|
-
* an explicit setting.
|
|
9
|
+
* Default pino redact paths (auth/cookie/API-key headers, nested
|
|
10
|
+
* password/token/secret fields), applied only when the host supplies no
|
|
11
|
+
* `logger.redact`. Opt out with `logger: { redact: [] }`; an explicit
|
|
12
|
+
* `redact` always wins.
|
|
21
13
|
*/
|
|
22
|
-
declare const DEFAULT_LOGGER_REDACT_PATHS: readonly ["req.headers.authorization", 'req.headers["x-api-key"]', 'req.headers["x-internal-api-key"]', 'req.headers["x-device-token"]', "req.headers.cookie", 'req.headers["set-cookie"]', 'res.headers["set-cookie"]', "*.password", "*.passwordHash", "*.token", "*.accessToken", "*.refreshToken", "*.secret", "*.apiKey"];
|
|
14
|
+
export declare const DEFAULT_LOGGER_REDACT_PATHS: readonly ["req.headers.authorization", 'req.headers["x-api-key"]', 'req.headers["x-internal-api-key"]', 'req.headers["x-device-token"]', "req.headers.cookie", 'req.headers["set-cookie"]', 'res.headers["set-cookie"]', "*.password", "*.passwordHash", "*.token", "*.accessToken", "*.refreshToken", "*.secret", "*.apiKey"];
|
|
23
15
|
/**
|
|
24
16
|
* Create a production-ready Fastify application with Arc framework.
|
|
25
17
|
*
|
|
@@ -42,11 +34,11 @@ declare const DEFAULT_LOGGER_REDACT_PATHS: readonly ["req.headers.authorization"
|
|
|
42
34
|
* **Boot is all-or-nothing.** If any phase throws, the partially-built
|
|
43
35
|
* instance is closed before the error propagates — see the wrapper below.
|
|
44
36
|
*/
|
|
45
|
-
declare function createApp(options: CreateAppOptions): Promise<FastifyInstance>;
|
|
37
|
+
export declare function createApp(options: CreateAppOptions): Promise<FastifyInstance>;
|
|
46
38
|
/**
|
|
47
39
|
* Quick factory for common scenarios
|
|
48
40
|
*/
|
|
49
|
-
declare const ArcFactory: {
|
|
41
|
+
export declare const ArcFactory: {
|
|
50
42
|
production(options: Omit<CreateAppOptions, "preset">): Promise<FastifyInstance>;
|
|
51
43
|
development(options: Omit<CreateAppOptions, "preset">): Promise<FastifyInstance>;
|
|
52
44
|
testing(options: Omit<CreateAppOptions, "preset">): Promise<FastifyInstance>;
|
|
@@ -73,7 +65,7 @@ interface ArcWorker {
|
|
|
73
65
|
/** Close app → module onClose (reverse) → app onClose. Idempotent. */
|
|
74
66
|
close(): Promise<void>;
|
|
75
67
|
}
|
|
76
|
-
declare function createWorker(options: CreateAppOptions, workerOptions?: CreateWorkerOptions): Promise<ArcWorker>;
|
|
68
|
+
export declare function createWorker(options: CreateAppOptions, workerOptions?: CreateWorkerOptions): Promise<ArcWorker>;
|
|
77
69
|
//#endregion
|
|
78
70
|
//#region src/factory/edge.d.ts
|
|
79
71
|
interface FetchHandlerOptions {
|
|
@@ -109,21 +101,44 @@ interface FetchHandlerOptions {
|
|
|
109
101
|
* (protobuf, images, non-UTF-8 charsets) survive intact — the
|
|
110
102
|
* content-type parser decides how to decode, same as a real socket.
|
|
111
103
|
*/
|
|
112
|
-
declare function toFetchHandler(app: FastifyInstance, options?: FetchHandlerOptions): (request: Request) => Promise<Response>;
|
|
104
|
+
export declare function toFetchHandler(app: FastifyInstance, options?: FetchHandlerOptions): (request: Request) => Promise<Response>;
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region src/factory/preloadResources.d.ts
|
|
107
|
+
/** Eager glob result: `{ '/path/to/file.ts': resourceModule }` */
|
|
108
|
+
type EagerGlobResult = Record<string, unknown>;
|
|
109
|
+
/** Lazy glob result: `{ '/path/to/file.ts': () => Promise<unknown> }` */
|
|
110
|
+
type LazyGlobResult = Record<string, () => Promise<unknown>>;
|
|
111
|
+
/**
|
|
112
|
+
* Normalize an eager `import.meta.glob` result into a `ResourceLike[]`.
|
|
113
|
+
*
|
|
114
|
+
* Accepts either:
|
|
115
|
+
* - `{ import: 'default' }` form: values are the resource directly
|
|
116
|
+
* - default form: values are the full module — picks first export with `toPlugin()`
|
|
117
|
+
*
|
|
118
|
+
* Throws if any module doesn't yield a valid `ResourceLike`.
|
|
119
|
+
*/
|
|
120
|
+
export declare function preloadResources(globResult: EagerGlobResult): ResourceLike[];
|
|
121
|
+
/**
|
|
122
|
+
* Normalize a lazy `import.meta.glob` result into a `Promise<ResourceLike[]>`.
|
|
123
|
+
*
|
|
124
|
+
* Use this when resources depend on prior bootstrap (e.g., engine init) and
|
|
125
|
+
* cannot be evaluated at import time of the preload file.
|
|
126
|
+
*/
|
|
127
|
+
export declare function preloadResourcesAsync(globResult: LazyGlobResult): Promise<ResourceLike[]>;
|
|
113
128
|
//#endregion
|
|
114
129
|
//#region src/factory/presets.d.ts
|
|
115
130
|
/**
|
|
116
131
|
* Production preset - strict security, performance optimized
|
|
117
132
|
*/
|
|
118
|
-
declare const productionPreset: Partial<CreateAppOptions>;
|
|
133
|
+
export declare const productionPreset: Partial<CreateAppOptions>;
|
|
119
134
|
/**
|
|
120
135
|
* Development preset - relaxed security, verbose logging
|
|
121
136
|
*/
|
|
122
|
-
declare const developmentPreset: Partial<CreateAppOptions>;
|
|
137
|
+
export declare const developmentPreset: Partial<CreateAppOptions>;
|
|
123
138
|
/**
|
|
124
139
|
* Testing preset - minimal setup, fast startup
|
|
125
140
|
*/
|
|
126
|
-
declare const testingPreset: Partial<CreateAppOptions>;
|
|
141
|
+
export declare const testingPreset: Partial<CreateAppOptions>;
|
|
127
142
|
/**
|
|
128
143
|
* Edge/Serverless preset — minimal cold-start overhead
|
|
129
144
|
*
|
|
@@ -149,7 +164,7 @@ declare const testingPreset: Partial<CreateAppOptions>;
|
|
|
149
164
|
* modern edge runtimes with Node.js compat flags. No TCP server is needed
|
|
150
165
|
* when using `toFetchHandler()` (routes through Fastify's `.inject()`).
|
|
151
166
|
*/
|
|
152
|
-
declare const edgePreset: Partial<CreateAppOptions>;
|
|
153
|
-
declare function getPreset(name: "production" | "development" | "testing" | "edge" | "worker"): Partial<CreateAppOptions>;
|
|
167
|
+
export declare const edgePreset: Partial<CreateAppOptions>;
|
|
168
|
+
export declare function getPreset(name: "production" | "development" | "testing" | "edge" | "worker"): Partial<CreateAppOptions>;
|
|
154
169
|
//#endregion
|
|
155
|
-
export {
|
|
170
|
+
export { type ArcCompositionConfig, type ArcModule, type ArcModuleInput, type ArcModuleRegistry, type ArcPortRegistry, type ArcPorts, type ArcWorker, type AsyncApiCatalogEntry, type AsyncApiInfo, type AuthOption, type BetterAuthOption, type BootDisposer, type ClosureNode, type CompositionProblem, type CreateAppOptions, type CreateWorkerOptions, type CrudSurface, type CustomAuthenticatorOption, type CustomPluginAuthOption, type DerivedPublishes, type DurabilityFacts, type EagerGlobResult, type EventHandlerDefinition, type FetchHandlerOptions, type HandlerDurabilityFact, type JwtAuthOption, type LazyBridge, type LazyGlobResult, type LoadResourcesOptions, type ModuleContribution, type ModuleDisposer, type ModuleExtension, type ModuleGraph, type ModuleGraphAnalysis, type ModuleGraphIssue, type ModuleGraphMode, type ModuleGraphNode, type ModuleGraphOptions, type ModuleKind, type ModuleName, type ModulePlan, type ModulePorts, type ModuleRequirements, type ModuleSetupContext, type ModuleState, type MultipartOptions, type PlanModulesOptions, type PortName, type RawBodyOptions, type RelayNudge, type RelayOption, type ResolvedModuleDescriptor, type ResolvedModuleLifecycle, type ResolvedResourceDescriptor, type ResourceLike, type ResourceModule, type SkippedBridge, type UnderPressureOptions, type WorkerHealthOptions, activateBridges, analyzeModuleGraph, assertComposable, buildModuleGraph, collectModuleWorkflows, compositionProblems, createRelayNudge, crudEventsOf, defineModule, dependentsOf, eventTopology, extendModule, getModuleExports, getModuleResources, getModuleState, getOptionalModuleExports, hasModule, hasModuleExports, lazyModuleExports, lazyRequiredModuleExports, loadResources, orderModules, planModules, renderModuleGraph, resolveContribution, resolveModule, resolveModuleClosure, subscribeModuleEventHandlers, toAsyncApi, verifyEventDurability, verifyModuleGraph, withRelayNudge };
|
package/dist/factory/index.mjs
CHANGED
|
@@ -1,8 +1,64 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as mergeHealthChecks, t as healthPlugin } from "../health-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as mergeHealthChecks, t as healthPlugin } from "../health-CrqUp3sz.mjs";
|
|
3
|
+
import { a as developmentPreset, c as productionPreset, d as getModuleResources, f as getModuleState, g as collectModuleWorkflows, l as testingPreset, m as subscribeModuleEventHandlers, n as DEFAULT_LOGGER_REDACT_PATHS, o as edgePreset, p as hasModule, r as createApp, s as getPreset, t as ArcFactory, u as workerPreset } from "../createApp-BGLYtErt.mjs";
|
|
4
|
+
import { _ as dependentsOf, b as verifyEventDurability, d as resolveModule, g as crudEventsOf, h as buildModuleGraph, i as planModules, m as analyzeModuleGraph, o as resolveModuleClosure, p as activateBridges, r as compositionProblems, s as orderModules, t as assertComposable, u as resolveContribution, v as eventTopology, x as verifyModuleGraph, y as renderModuleGraph } from "../plan-CJGMKoui.mjs";
|
|
5
|
+
import { a as lazyModuleExports, i as hasModuleExports, n as getModuleExports, o as lazyRequiredModuleExports, r as getOptionalModuleExports, t as defineModule } from "../module--L0iBIZz.mjs";
|
|
6
|
+
import { t as loadResources } from "../loadResources-6jO52-RR.mjs";
|
|
7
|
+
//#region src/factory/module/asyncapi.ts
|
|
8
|
+
/**
|
|
9
|
+
* The module graph as an AsyncAPI 3.0 document — one channel per event (addressed by the event
|
|
10
|
+
* name, payload from the event registry), a `send` operation for its owner and a `receive` for
|
|
11
|
+
* every consumer (wildcards resolved). The standard format tooling, docs and contract tests read.
|
|
12
|
+
*/
|
|
13
|
+
/** A JSON-Pointer-safe id for an event name. */
|
|
14
|
+
const idOf = (event) => event.replace(/[^A-Za-z0-9_.-]/g, "_");
|
|
15
|
+
function toAsyncApi(graph, catalog, info, analysis = analyzeModuleGraph(graph)) {
|
|
16
|
+
const byName = new Map(catalog.map((entry) => [entry.name, entry]));
|
|
17
|
+
const channels = {};
|
|
18
|
+
const messages = {};
|
|
19
|
+
const operations = {};
|
|
20
|
+
const kindOf = new Map(graph.modules.map((m) => [m.name, m.kind]));
|
|
21
|
+
const ensureChannel = (event) => {
|
|
22
|
+
const id = idOf(event);
|
|
23
|
+
if (channels[id]) return id;
|
|
24
|
+
const entry = byName.get(event);
|
|
25
|
+
messages[id] = {
|
|
26
|
+
name: event,
|
|
27
|
+
...entry?.description ? { summary: entry.description } : {},
|
|
28
|
+
payload: entry?.schema ?? {},
|
|
29
|
+
...entry ? { "x-version": entry.version } : { "x-uncatalogued": true }
|
|
30
|
+
};
|
|
31
|
+
channels[id] = {
|
|
32
|
+
address: event,
|
|
33
|
+
messages: { [id]: { $ref: `#/components/messages/${id}` } }
|
|
34
|
+
};
|
|
35
|
+
return id;
|
|
36
|
+
};
|
|
37
|
+
const operation = (module, action, event) => {
|
|
38
|
+
const id = ensureChannel(event);
|
|
39
|
+
operations[`${module}.${action}.${id}`] = {
|
|
40
|
+
action,
|
|
41
|
+
channel: { $ref: `#/channels/${id}` },
|
|
42
|
+
messages: [{ $ref: `#/channels/${id}/messages/${id}` }],
|
|
43
|
+
tags: [{ name: module }],
|
|
44
|
+
"x-arc-kind": kindOf.get(module)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
for (const [event, owners] of analysis.owners) for (const owner of owners) operation(owner, "send", event);
|
|
48
|
+
for (const [consumer, byPattern] of analysis.reaches) for (const events of byPattern.values()) for (const event of events) operation(consumer, "receive", event);
|
|
49
|
+
return {
|
|
50
|
+
asyncapi: "3.0.0",
|
|
51
|
+
info: {
|
|
52
|
+
title: info.title,
|
|
53
|
+
version: info.version,
|
|
54
|
+
...info.description ? { description: info.description } : {}
|
|
55
|
+
},
|
|
56
|
+
channels,
|
|
57
|
+
operations,
|
|
58
|
+
components: { messages }
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
6
62
|
//#region src/factory/module/extend.ts
|
|
7
63
|
/** Concatenate two contributions, resolving factories only when arc asks. */
|
|
8
64
|
function mergeContribution(own, extra) {
|
|
@@ -33,6 +89,19 @@ function mergeNames(own, extra) {
|
|
|
33
89
|
if (extra === void 0) return own;
|
|
34
90
|
return [.../* @__PURE__ */ new Set([...own, ...extra])];
|
|
35
91
|
}
|
|
92
|
+
function mergeRequires(own, extra) {
|
|
93
|
+
if (own === void 0) return extra;
|
|
94
|
+
if (extra === void 0) return own;
|
|
95
|
+
const ports = mergeNames(own.ports, extra.ports);
|
|
96
|
+
const required = new Set(ports ?? []);
|
|
97
|
+
const optional = mergeNames(own.optionalPorts, extra.optionalPorts)?.filter((p) => !required.has(p));
|
|
98
|
+
const modules = mergeNames(own.modules, extra.modules);
|
|
99
|
+
return {
|
|
100
|
+
...ports ? { ports } : {},
|
|
101
|
+
...optional && optional.length > 0 ? { optionalPorts: optional } : {},
|
|
102
|
+
...modules ? { modules } : {}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
36
105
|
function mergeOwns(own, extra) {
|
|
37
106
|
if (own === "provided" || extra === "provided") return "provided";
|
|
38
107
|
return mergeNames(own, extra);
|
|
@@ -110,7 +179,12 @@ function extendModule(mod, extension) {
|
|
|
110
179
|
const set = (key, value) => {
|
|
111
180
|
if (value !== void 0) out[key] = value;
|
|
112
181
|
};
|
|
182
|
+
if (extension.kind !== void 0) {
|
|
183
|
+
if (mod.kind !== void 0 && mod.kind !== extension.kind) throw new Error(`[arc] extendModule("${mod.name}"): the module declares kind "${mod.kind}"; refusing to relabel it "${extension.kind}". A kind changes activation and ordering — change it in the module.`);
|
|
184
|
+
out.kind = extension.kind;
|
|
185
|
+
}
|
|
113
186
|
set("dependsOn", mergeNames(mod.dependsOn, extension.dependsOn));
|
|
187
|
+
set("requires", mergeRequires(mod.requires, extension.requires));
|
|
114
188
|
set("owns", mergeOwns(mod.owns, extension.owns));
|
|
115
189
|
set("resources", mergeContribution(mod.resources, extension.resources));
|
|
116
190
|
set("eventHandlers", mergeContribution(mod.eventHandlers, extension.eventHandlers));
|
|
@@ -121,10 +195,64 @@ function extendModule(mod, extension) {
|
|
|
121
195
|
set("plugins", mergeHook(mod.plugins, extension.plugins));
|
|
122
196
|
set("afterResources", mergeHook(mod.afterResources, extension.afterResources));
|
|
123
197
|
set("onClose", mergeOnClose(mod.onClose, extension.onClose));
|
|
198
|
+
set("publishes", mergeArray(mod.publishes, extension.publishes));
|
|
199
|
+
if (extension.eventNamespace !== void 0) set("eventNamespace", mergeNames(mod.eventNamespace === void 0 ? [mod.name] : [mod.eventNamespace].flat(), [extension.eventNamespace].flat()));
|
|
124
200
|
if (extension.bootstrap) out.bootstrap = extension.bootstrap(mod.bootstrap);
|
|
125
201
|
return out;
|
|
126
202
|
}
|
|
127
203
|
//#endregion
|
|
204
|
+
//#region src/factory/module/relay-nudge.ts
|
|
205
|
+
function isRelayFromModule(relay) {
|
|
206
|
+
return typeof relay === "object" && relay !== null && "fromModule" in relay;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Merge an `afterCommit` nudge into a runtime whose `dispatch` is `'relay'`.
|
|
210
|
+
*
|
|
211
|
+
* - `'inline'` / no dispatch: returned untouched.
|
|
212
|
+
* - `'relay'` + a resolvable `relay`: `afterCommit` nudges; a host's own hook runs first.
|
|
213
|
+
* - `'relay'` + no `relay`: THROWS — a worker-drained deployment and a forgotten wire
|
|
214
|
+
* look identical, so the host has to say which.
|
|
215
|
+
*/
|
|
216
|
+
function withRelayNudge(label, runtime, relay) {
|
|
217
|
+
if (!runtime || typeof runtime !== "object") return runtime;
|
|
218
|
+
const rt = runtime;
|
|
219
|
+
if (rt.dispatch !== "relay") return runtime;
|
|
220
|
+
if (relay === void 0) throw new Error(`[${label}] runtime.dispatch is 'relay' but no \`relay\` was given. Pass the outbox module's exports (\`{ requestDrain }\`, a thunk, or \`{ fromModule: 'outbox' }\`) so a committed write is delivered now — or \`relay: 'external'\` when a separate relay process drains the outbox.`);
|
|
221
|
+
const resolved = relay;
|
|
222
|
+
if (resolved === "external") return runtime;
|
|
223
|
+
if (typeof resolved !== "function" && !("requestDrain" in resolved)) throw new Error(`[${label}] withRelayNudge received the unresolved \`{ fromModule }\` form — createRelayNudge resolves it after resources; a direct caller passes \`{ requestDrain }\` or a thunk.`);
|
|
224
|
+
const hostAfterCommit = typeof rt.afterCommit === "function" ? rt.afterCommit : void 0;
|
|
225
|
+
const drain = typeof resolved === "function" ? () => resolved().requestDrain() : () => resolved.requestDrain();
|
|
226
|
+
return {
|
|
227
|
+
...rt,
|
|
228
|
+
afterCommit: (info) => {
|
|
229
|
+
try {
|
|
230
|
+
hostAfterCommit?.(info);
|
|
231
|
+
} finally {
|
|
232
|
+
drain();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/** The one way a module wires `relay` — `{ fromModule }` included. */
|
|
238
|
+
function createRelayNudge(label, relay) {
|
|
239
|
+
if (!isRelayFromModule(relay)) return { apply: (runtime) => withRelayNudge(label, runtime, relay) };
|
|
240
|
+
const moduleName = relay.fromModule;
|
|
241
|
+
let moduleDrain;
|
|
242
|
+
const thunk = () => {
|
|
243
|
+
if (!moduleDrain) throw new Error(`[${label}] the relay drain from module "${moduleName}" is not resolved yet — a write committed before afterResources ran. Mount the outbox module alongside this one, or pass \`relay\` directly.`);
|
|
244
|
+
return { requestDrain: moduleDrain };
|
|
245
|
+
};
|
|
246
|
+
return {
|
|
247
|
+
apply: (runtime) => withRelayNudge(label, runtime, thunk),
|
|
248
|
+
afterResources: async (fastify) => {
|
|
249
|
+
const exports = getModuleExports(fastify, moduleName);
|
|
250
|
+
if (typeof exports?.requestDrain !== "function") throw new Error(`[${label}] module "${moduleName}" exports no requestDrain(), so a committed write cannot nudge the relay. Arc >=2.40 adds it to createOutboxModule; pass \`relay: 'external'\` if a separate process drains the outbox.`);
|
|
251
|
+
moduleDrain = exports.requestDrain;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
//#endregion
|
|
128
256
|
//#region src/factory/createWorker.ts
|
|
129
257
|
async function createWorker(options, workerOptions = {}) {
|
|
130
258
|
const { auth: _auth, helmet: _helmet, cors: _cors, rateLimit: _rateLimit, multipart: _multipart, rawBody: _rawBody, sensible: _sensible, underPressure: _underPressure, replyHelpers: _replyHelpers, ...runtimeOptions } = options;
|
|
@@ -139,32 +267,41 @@ async function createWorker(options, workerOptions = {}) {
|
|
|
139
267
|
preset: "worker",
|
|
140
268
|
arcPlugins: workerArcPlugins
|
|
141
269
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
270
|
+
try {
|
|
271
|
+
if (workerOptions.health) {
|
|
272
|
+
const { port, host = "0.0.0.0", checks = [] } = workerOptions.health;
|
|
273
|
+
const moduleChecks = app.arc?.healthChecks ?? [];
|
|
274
|
+
const mergedChecks = mergeHealthChecks([
|
|
275
|
+
{
|
|
276
|
+
owner: "the module graph",
|
|
277
|
+
checks: moduleChecks
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
owner: "shared arcPlugins.health",
|
|
281
|
+
checks: sharedHealth.checks
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
owner: "the worker probe",
|
|
285
|
+
checks
|
|
286
|
+
}
|
|
287
|
+
]);
|
|
288
|
+
await app.register(healthPlugin, {
|
|
289
|
+
...sharedHealth,
|
|
290
|
+
checks: mergedChecks
|
|
291
|
+
});
|
|
292
|
+
await app.listen({
|
|
293
|
+
port,
|
|
294
|
+
host
|
|
295
|
+
});
|
|
296
|
+
} else await app.ready();
|
|
297
|
+
} catch (err) {
|
|
298
|
+
try {
|
|
299
|
+
await app.close();
|
|
300
|
+
} catch (closeErr) {
|
|
301
|
+
app.log.error({ err: closeErr }, "[arc] failed worker startup cleanup failed");
|
|
302
|
+
}
|
|
303
|
+
throw err;
|
|
304
|
+
}
|
|
168
305
|
let closed = false;
|
|
169
306
|
return {
|
|
170
307
|
app,
|
|
@@ -243,4 +380,48 @@ function payloadTooLarge(limit) {
|
|
|
243
380
|
});
|
|
244
381
|
}
|
|
245
382
|
//#endregion
|
|
246
|
-
|
|
383
|
+
//#region src/factory/preloadResources.ts
|
|
384
|
+
/**
|
|
385
|
+
* Normalize an eager `import.meta.glob` result into a `ResourceLike[]`.
|
|
386
|
+
*
|
|
387
|
+
* Accepts either:
|
|
388
|
+
* - `{ import: 'default' }` form: values are the resource directly
|
|
389
|
+
* - default form: values are the full module — picks first export with `toPlugin()`
|
|
390
|
+
*
|
|
391
|
+
* Throws if any module doesn't yield a valid `ResourceLike`.
|
|
392
|
+
*/
|
|
393
|
+
function preloadResources(globResult) {
|
|
394
|
+
const resources = [];
|
|
395
|
+
for (const [path, value] of Object.entries(globResult)) {
|
|
396
|
+
const resource = pickResource(value);
|
|
397
|
+
if (!resource) throw new Error(`preloadResources: ${path} does not export a valid resource.\n Expected: a default export OR a named export with toPlugin().`);
|
|
398
|
+
resources.push(resource);
|
|
399
|
+
}
|
|
400
|
+
return resources.sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Normalize a lazy `import.meta.glob` result into a `Promise<ResourceLike[]>`.
|
|
404
|
+
*
|
|
405
|
+
* Use this when resources depend on prior bootstrap (e.g., engine init) and
|
|
406
|
+
* cannot be evaluated at import time of the preload file.
|
|
407
|
+
*/
|
|
408
|
+
async function preloadResourcesAsync(globResult) {
|
|
409
|
+
return (await Promise.all(Object.entries(globResult).map(async ([path, loader]) => {
|
|
410
|
+
const resource = pickResource(await loader());
|
|
411
|
+
if (!resource) throw new Error(`preloadResourcesAsync: ${path} does not export a valid resource.\n Expected: a default export OR a named export with toPlugin().`);
|
|
412
|
+
return resource;
|
|
413
|
+
}))).sort((a, b) => (a.name ?? "").localeCompare(b.name ?? ""));
|
|
414
|
+
}
|
|
415
|
+
function pickResource(value) {
|
|
416
|
+
if (!value || typeof value !== "object") return void 0;
|
|
417
|
+
if (typeof value.toPlugin === "function") return value;
|
|
418
|
+
const mod = value;
|
|
419
|
+
const candidates = [
|
|
420
|
+
mod.default,
|
|
421
|
+
mod.resource,
|
|
422
|
+
...Object.values(mod)
|
|
423
|
+
];
|
|
424
|
+
for (const c of candidates) if (c && typeof c === "object" && typeof c.toPlugin === "function") return c;
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
export { ArcFactory, DEFAULT_LOGGER_REDACT_PATHS, activateBridges, analyzeModuleGraph, assertComposable, buildModuleGraph, collectModuleWorkflows, compositionProblems, createApp, createRelayNudge, createWorker, crudEventsOf, defineModule, dependentsOf, developmentPreset, edgePreset, eventTopology, extendModule, getModuleExports, getModuleResources, getModuleState, getOptionalModuleExports, getPreset, hasModule, hasModuleExports, lazyModuleExports, lazyRequiredModuleExports, loadResources, orderModules, planModules, preloadResources, preloadResourcesAsync, productionPreset, renderModuleGraph, resolveContribution, resolveModule, resolveModuleClosure, subscribeModuleEventHandlers, testingPreset, toAsyncApi, toFetchHandler, verifyEventDurability, verifyModuleGraph, withRelayNudge };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { M as ResourceRegistry, dn as HookSystem } from "./index-WH7xgvxS.mjs";
|
|
3
3
|
import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { s as ModuleState } from "./index-
|
|
4
|
+
import { b as ScheduleDefinition, i as ArcModuleRegistry, n as ArcModule, w as HealthCheck } from "./types-BJ-2XqVF.mjs";
|
|
5
|
+
import { L as ModuleGraph, s as ModuleState } from "./index-CUJvoyw3.mjs";
|
|
6
6
|
import { FastifyPluginAsync } from "fastify";
|
|
7
7
|
//#region src/factory/module/descriptor.d.ts
|
|
8
8
|
/**
|
|
@@ -65,26 +65,6 @@ interface ResolvedModuleDescriptor {
|
|
|
65
65
|
readonly owns: readonly string[];
|
|
66
66
|
readonly lifecycle: ResolvedModuleLifecycle;
|
|
67
67
|
}
|
|
68
|
-
/** Minimal resource shape the descriptor reads. Structural — matches `ResourceLike`. */
|
|
69
|
-
interface DescribableResource {
|
|
70
|
-
readonly name?: string | undefined;
|
|
71
|
-
readonly prefix?: string | undefined;
|
|
72
|
-
readonly skipGlobalPrefix?: boolean | undefined;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Build a descriptor. Called by `registerResources` once per module, after
|
|
76
|
-
* resources are resolved and `owns` is effective.
|
|
77
|
-
*
|
|
78
|
-
* Frozen at every level: a descriptor is a snapshot of a completed decision,
|
|
79
|
-
* and a consumer mutating it would silently disagree with the running app.
|
|
80
|
-
*/
|
|
81
|
-
declare function describeResolvedModule(input: {
|
|
82
|
-
readonly name: string;
|
|
83
|
-
readonly dependsOn?: readonly string[] | undefined;
|
|
84
|
-
readonly resources: readonly DescribableResource[];
|
|
85
|
-
readonly owns: readonly string[];
|
|
86
|
-
readonly lifecycle: ResolvedModuleLifecycle;
|
|
87
|
-
}): ResolvedModuleDescriptor;
|
|
88
68
|
//#endregion
|
|
89
69
|
//#region src/core/arcCorePlugin.d.ts
|
|
90
70
|
interface ArcCorePluginOptions {
|
|
@@ -159,6 +139,13 @@ interface ArcCore {
|
|
|
159
139
|
* or hand to tooling.
|
|
160
140
|
*/
|
|
161
141
|
moduleDescriptors?: readonly ResolvedModuleDescriptor[];
|
|
142
|
+
/** Active modules, the events each owns and consumes, and the bridges left inactive. */
|
|
143
|
+
moduleGraph?: ModuleGraph;
|
|
144
|
+
/**
|
|
145
|
+
* Event types actually published with no declared owner (and no external source) — observed
|
|
146
|
+
* at the transport while `moduleGraph.events` is on. A test asserts it empty after a flow.
|
|
147
|
+
*/
|
|
148
|
+
undeclaredEvents?: ReadonlySet<string>;
|
|
162
149
|
/**
|
|
163
150
|
* Module-contributed recurring schedules, resolved once in dependency order
|
|
164
151
|
* and frozen after bootstraps. The same definitions are executed by Arc's
|
|
@@ -166,7 +153,6 @@ interface ArcCore {
|
|
|
166
153
|
*/
|
|
167
154
|
scheduledJobs?: readonly Readonly<ScheduleDefinition>[];
|
|
168
155
|
}
|
|
169
|
-
declare const arcCorePlugin: FastifyPluginAsync<ArcCorePluginOptions>;
|
|
170
156
|
declare const _default: FastifyPluginAsync<ArcCorePluginOptions>;
|
|
171
157
|
//#endregion
|
|
172
158
|
//#region src/types/fastify-augmentation.d.ts
|
|
@@ -176,4 +162,4 @@ declare module "fastify" {
|
|
|
176
162
|
}
|
|
177
163
|
}
|
|
178
164
|
//#endregion
|
|
179
|
-
export {
|
|
165
|
+
export { ResolvedModuleDescriptor as a, _default as i, ArcCorePluginOptions as n, ResolvedModuleLifecycle as o, PluginMeta as r, ResolvedResourceDescriptor as s, ArcCore as t };
|
|
@@ -119,4 +119,4 @@ declare function applyFieldWritePermissions<T extends Record<string, unknown>>(b
|
|
|
119
119
|
*/
|
|
120
120
|
declare function resolveEffectiveRoles(userRoles: readonly string[], orgRoles: readonly string[]): string[];
|
|
121
121
|
//#endregion
|
|
122
|
-
export {
|
|
122
|
+
export { applyFieldReadPermissions as a, resolveEffectiveRoles as c, FieldWritePermissionResult as i, FieldPermissionMap as n, applyFieldWritePermissions as o, FieldPermissionType as r, fields as s, FieldPermission as t };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
//#region src/permissions/filter-merge.ts
|
|
3
|
+
/**
|
|
4
|
+
* Policy-filter composition — logical AND, never last-writer-wins.
|
|
5
|
+
*
|
|
6
|
+
* Row-level policy filters can arrive from several INDEPENDENT sources for one
|
|
7
|
+
* request: a tenant preset, an `ownedByUser` grant, an `allOf(...)` branch, a
|
|
8
|
+
* host permission check. Every one of them is a RESTRICTION the row must
|
|
9
|
+
* satisfy, so composing them is logical AND.
|
|
10
|
+
*
|
|
11
|
+
* The historical `{ ...base, ...incoming }` shallow spread did NOT implement AND:
|
|
12
|
+
* when two sources constrained the SAME key with different values, the later one
|
|
13
|
+
* silently REPLACED the earlier one — widening (or erasing) a restriction another
|
|
14
|
+
* layer deliberately imposed. That is a defense-in-depth defect, not a
|
|
15
|
+
* refinement. "Later can refine" is only sound when the refinement is provably
|
|
16
|
+
* narrower, and a bare overwrite proves nothing.
|
|
17
|
+
*
|
|
18
|
+
* {@link conjoinPolicyFilters} composes with AND semantics while preserving the
|
|
19
|
+
* common case byte-for-byte:
|
|
20
|
+
*
|
|
21
|
+
* - key present on only one side → carried through flat. Non-overlapping
|
|
22
|
+
* filters (the ~99% case) produce exactly the same object the old spread did,
|
|
23
|
+
* so there is ZERO behavior change for them.
|
|
24
|
+
* - same key, deep-equal value → kept once (idempotent — e.g. two checks
|
|
25
|
+
* both pinning the same `organizationId`).
|
|
26
|
+
* - same key, DIFFERENT value → BOTH constraints are preserved under an
|
|
27
|
+
* `$and`, so a row must satisfy both. For flat equality that conjunction is
|
|
28
|
+
* unsatisfiable, so the query returns nothing — the safe, correct outcome for
|
|
29
|
+
* contradictory policies (deny), and the earlier restriction is never dropped.
|
|
30
|
+
*
|
|
31
|
+
* Adapter safety: mongokit / sqlitekit compile `$and` natively at the DB layer,
|
|
32
|
+
* and arc's in-memory `simpleEqualityMatcher` (AccessControl.checkPolicyFilters)
|
|
33
|
+
* already fail-closes on operator-shaped filters. So a produced `$and` is either
|
|
34
|
+
* evaluated correctly by the DB or rejected fail-closed in memory — both safe.
|
|
35
|
+
*
|
|
36
|
+
* This is the pragmatic, adapter-neutral form of the AND semantics. A canonical
|
|
37
|
+
* filter IR in `repo-core` (nested and/or/not nodes each adapter compiles) is the
|
|
38
|
+
* fuller design, but this closes the security defect without one.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Validate + return a `$and` operand's fragment array. A security-policy
|
|
42
|
+
* normalizer must NEVER silently drop a malformed constraint — a non-array
|
|
43
|
+
* `$and` (e.g. `{ $and: { organizationId: "a" } }`) is a policy bug, so fail
|
|
44
|
+
* loud (fail-closed) rather than discard the restriction it was meant to carry.
|
|
45
|
+
*/
|
|
46
|
+
function coercePolicyAnd(value) {
|
|
47
|
+
if (!Array.isArray(value)) throw new Error(`conjoinPolicyFilters: malformed '$and' — expected an array of filter fragments, got ${value === null ? "null" : typeof value}. A policy filter constraint must not be silently dropped.`);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
/** Are two flat policy-filter values equivalent for conjunction purposes? */
|
|
51
|
+
function filterValueEqual(a, b) {
|
|
52
|
+
if (Object.is(a, b)) return true;
|
|
53
|
+
if (a !== null && b !== null && typeof a === "object" && typeof b === "object") try {
|
|
54
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Conjoin two policy-filter maps with AND semantics. Never silently overwrites a
|
|
62
|
+
* same-key constraint with a different value — conflicting keys are preserved
|
|
63
|
+
* under `$and`. See the module doc for the full contract.
|
|
64
|
+
*/
|
|
65
|
+
function conjoinPolicyFilters(base, incoming) {
|
|
66
|
+
const baseEmpty = !base || Object.keys(base).length === 0;
|
|
67
|
+
const incomingEmpty = !incoming || Object.keys(incoming).length === 0;
|
|
68
|
+
if (baseEmpty) return incomingEmpty ? {} : { ...incoming };
|
|
69
|
+
if (incomingEmpty) return { ...base };
|
|
70
|
+
const result = {};
|
|
71
|
+
const andParts = [];
|
|
72
|
+
const baseAnd = base.$and;
|
|
73
|
+
if (baseAnd !== void 0) andParts.push(...coercePolicyAnd(baseAnd));
|
|
74
|
+
for (const [key, value] of Object.entries(base)) {
|
|
75
|
+
if (key === "$and") continue;
|
|
76
|
+
result[key] = value;
|
|
77
|
+
}
|
|
78
|
+
for (const [key, value] of Object.entries(incoming)) {
|
|
79
|
+
if (key === "$and") {
|
|
80
|
+
andParts.push(...coercePolicyAnd(value));
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (!(key in result)) {
|
|
84
|
+
result[key] = value;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (filterValueEqual(result[key], value)) continue;
|
|
88
|
+
andParts.push({ [key]: result[key] }, { [key]: value });
|
|
89
|
+
delete result[key];
|
|
90
|
+
}
|
|
91
|
+
if (andParts.length > 0) result.$and = andParts;
|
|
92
|
+
for (const source of [base, incoming]) for (const symbol of Object.getOwnPropertySymbols(source)) {
|
|
93
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, symbol);
|
|
94
|
+
if (descriptor) Object.defineProperty(result, symbol, descriptor);
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { conjoinPolicyFilters as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as pluralize } from "./pluralize-
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as pluralize } from "./pluralize-COUNYo3d.mjs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
//#region src/cli/commands/generate/name-helpers.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { u as ValidationError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { u as ValidationError } from "./errors-CW4anJBy.mjs";
|
|
3
3
|
//#region src/utils/headers.ts
|
|
4
4
|
/**
|
|
5
5
|
* Canonical header typing + accessor.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
//#region src/events/outbox/health.ts
|
|
3
|
+
/** Pending age past which the relay counts as stalled. */
|
|
4
|
+
const DEFAULT_RELAY_LAG_UNHEALTHY_MS = 3e5;
|
|
5
|
+
function canReportHealth(store) {
|
|
6
|
+
return typeof store.countByStatus === "function" && typeof store.oldestPendingAgeMs === "function";
|
|
7
|
+
}
|
|
8
|
+
async function readOutboxHealth(store, relayLagUnhealthyMs = DEFAULT_RELAY_LAG_UNHEALTHY_MS) {
|
|
9
|
+
const [pending, deadLetter, relayLagMs] = await Promise.all([
|
|
10
|
+
store.countByStatus("pending"),
|
|
11
|
+
store.countByStatus("dead_letter"),
|
|
12
|
+
store.oldestPendingAgeMs()
|
|
13
|
+
]);
|
|
14
|
+
return {
|
|
15
|
+
pending,
|
|
16
|
+
deadLetter,
|
|
17
|
+
relayLagMs,
|
|
18
|
+
healthy: deadLetter === 0 && (relayLagMs === null || relayLagMs < relayLagUnhealthyMs)
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { canReportHealth as n, readOutboxHealth as r, DEFAULT_RELAY_LAG_UNHEALTHY_MS as t };
|