@classytic/arc 2.48.0 → 2.50.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-BWwg5YAU.mjs → EventTransport-B18mcj_M.mjs} +2 -2
- package/dist/{HookSystem-B9x-Y_k7.mjs → HookSystem-FUBaLTRm.mjs} +2 -2
- package/dist/{QueryCache-DdvrGG8Q.d.mts → QueryCache-BE47tmlO.d.mts} +36 -1
- package/dist/{ResourceRegistry-BcvEJoZd.mjs → ResourceRegistry-C5NM07fZ.mjs} +2 -2
- package/dist/{acquire-D2yj6Zzl.mjs → acquire-MHCnbDtH.mjs} +1 -1
- package/dist/audit/index.d.mts +1 -1
- package/dist/audit/index.mjs +4 -4
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +53 -15
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-BZSJcPNE.mjs → authorizationDecision-BD8K4jdQ.mjs} +4 -4
- package/dist/{boundedMap-o2KZDCWy.mjs → boundedMap-CuCwos_X.mjs} +1 -1
- package/dist/{buildHandler-G3k59KY2.mjs → buildHandler-BttjNkTM.mjs} +23 -16
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-CJIDPZOv.mjs → caching-CxUQLHfR.mjs} +3 -6
- package/dist/{claimed-D0A43wjT.mjs → claimed-CQ4ZpD8K.mjs} +1 -1
- package/dist/cleanup/index.d.mts +2 -2
- package/dist/cleanup/index.mjs +4 -4
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +3 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/commands/init.mjs +2 -2
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-D-faL5SX.mjs → constants-BZFsZwJh.mjs} +1 -1
- package/dist/context/index.mjs +5 -5
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +7 -7
- package/dist/{core-NSu1peyq.mjs → core-DWA1-5IE.mjs} +3 -3
- package/dist/{createActionRouter-DTSVv1VK.mjs → createActionRouter-fP3l2xVF.mjs} +54 -18
- package/dist/{createAggregationRouter-zEasm-ax.mjs → createAggregationRouter-BJZeOmBa.mjs} +13 -11
- package/dist/{createApp-CjqhkX1x.mjs → createApp-Db9JRumw.mjs} +332 -40
- package/dist/{createMcpServer-hSFeqRUb.d.mts → createMcpServer-CS2KOVP6.d.mts} +1 -1
- package/dist/{defineAggregation-DH2L6_v9.mjs → defineAggregation-BskqRz8M.mjs} +1 -1
- package/dist/{defineResource-zYCrhNaN.mjs → defineResource-B2vTvKzW.mjs} +8 -8
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +3 -3
- package/dist/{elevation-z--rFcZ5.mjs → elevation-XoY0C73T.mjs} +6 -9
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-3_3oN-Uc.mjs → errorHandler-BYI-JQMm.mjs} +4 -7
- package/dist/{errors-DyY48oRi.mjs → errors-3xaK0i9n.mjs} +1 -1
- package/dist/{eventPlugin-Co9sABCg.mjs → eventPlugin-CVQ9ddnL.mjs} +9 -13
- package/dist/{eventTypes-HmAFyJmJ.mjs → eventTypes-UPYg7gW1.mjs} +2 -2
- package/dist/events/index.d.mts +18 -5
- package/dist/events/index.mjs +8 -8
- package/dist/events/transports/redis-stream-entry.mjs +4 -4
- package/dist/events/transports/redis.d.mts +35 -0
- package/dist/events/transports/redis.mjs +87 -11
- package/dist/factory/index.d.mts +4 -4
- package/dist/factory/index.mjs +6 -6
- package/dist/{fastify-augmentation-bzkWPt1f.d.mts → fastify-augmentation-baQc3MaO.d.mts} +2 -2
- package/dist/fieldTypes-CxRvCaaZ.mjs +80 -0
- package/dist/{fields-rfsl26Ov.mjs → fields-DLFcJiDe.mjs} +1 -1
- package/dist/{filter-merge-8glLr7Dk.mjs → filter-merge-Bvjk_8dV.mjs} +1 -1
- package/dist/{generate-BOfBueRt.mjs → generate-0OpCUjUv.mjs} +2 -2
- package/dist/{headers-CHSOqpcY.mjs → headers-BROW65-r.mjs} +2 -2
- package/dist/{health-ezwTHQh2.mjs → health-Cfh-kYI_.mjs} +1 -1
- package/dist/{health-DHvAIVmM.mjs → health-Cy6aOg1i.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/http-cache/index.d.mts +2 -2
- package/dist/http-cache/index.mjs +4 -4
- package/dist/http-cache/purgers/cloudflare.mjs +2 -2
- package/dist/http-cache/purgers/fastly.mjs +2 -2
- package/dist/http-cache/testing/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +1 -1
- package/dist/idempotency/index.mjs +10 -8
- package/dist/idempotency/redis.mjs +2 -2
- package/dist/{index-B5i9-vuP.d.mts → index-CMNpMBtW.d.mts} +1 -1
- package/dist/{index-BxZS-8So.d.mts → index-DKM2p5w5.d.mts} +48 -23
- package/dist/{index-Cy2-QffW.d.mts → index-DLCcLUQT.d.mts} +69 -6
- package/dist/{index-DFCCQ9AE.d.mts → index-DexdFs1a.d.mts} +1 -1
- package/dist/{index-D1X_C_qz.d.mts → index-Dhrks-hM.d.mts} +60 -10
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +11 -11
- package/dist/{init-MoE3eZNR.mjs → init-D7PQcvvL.mjs} +1 -1
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +2 -2
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.mjs +3 -3
- package/dist/integrations/mcp/index.d.mts +5 -5
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +2 -2
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +1 -1
- package/dist/integrations/webhooks.mjs +4 -4
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{jsonBody-DZGiCawf.mjs → jsonBody-C0oREwUc.mjs} +2 -2
- package/dist/{keys-CrMOZuk6.mjs → keys-CGlPoVSn.mjs} +1 -1
- package/dist/{loadResources-CVQvYUhN.mjs → loadResources-Oi47dogA.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-D0naccV2.mjs → loadResourcesFromEntry-BW-LexBz.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-VyMcSmVG.mjs → logger-BagW7_YA.mjs} +1 -1
- package/dist/{mcpPlugin-DQACaqVu.mjs → mcpPlugin-C6-wFsOX.mjs} +29 -26
- package/dist/{memory-Lpfu8Hga.mjs → memory-Bl7kv6TS.mjs} +3 -3
- package/dist/{metrics-DjVj1sg5.mjs → metrics-CqnMJKrJ.mjs} +4 -7
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-BqPJpZ_L.mjs → module-lbEbHUfI.mjs} +1 -1
- package/dist/{multiTenant-KZj8j1uJ.d.mts → multiTenant-QtDzxx_K.d.mts} +1 -1
- package/dist/{multipartBody-BNgNv7r0.mjs → multipartBody-CqNezaB3.mjs} +1 -1
- package/dist/{observeSend-BKJHibJz.mjs → observeSend-BjilzlYl.mjs} +1 -1
- package/dist/{openapi-T90KrPR6.mjs → openapi-DXNbadgd.mjs} +7 -7
- package/dist/outbox-admin/index.d.mts +1 -1
- package/dist/outbox-admin/index.mjs +5 -5
- package/dist/{outbox-module-5Mnwcycy.d.mts → outbox-module-DzW6zwWJ.d.mts} +103 -10
- package/dist/{outbox-module-C874VgBr.mjs → outbox-module-k5rIszQ4.mjs} +197 -28
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-R9T2G1PH.mjs → permissions-BJylQopQ.mjs} +9 -9
- package/dist/{pipe-DzqbsZy-.mjs → pipe-D1cq8hET.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-C0gkeABY.mjs → plan-iEgaS5_H.mjs} +1 -1
- package/dist/{plugin-BJcVOX5r.mjs → plugin-DsLr6L4O.mjs} +94 -50
- package/dist/plugins/index.d.mts +6 -5
- package/dist/plugins/index.mjs +19 -18
- package/dist/plugins/response-cache.mjs +4 -4
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-CrCpyoZs.mjs → pluralize-CX4ZvwCa.mjs} +1 -1
- package/dist/presets/filesUpload.d.mts +1 -1
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +2 -2
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +5 -5
- package/dist/presets/search.d.mts +1 -1
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-CNDvNYsz.mjs → presets-D_suT4OY.mjs} +4 -4
- package/dist/{projection-CIUe8b59.mjs → projection-CmjGjFih.mjs} +2 -2
- package/dist/{purger.types-f83fTzGy.mjs → purger.types-CZwkTZ7B.mjs} +1 -1
- package/dist/{queryCachePlugin-B2jpwFcv.mjs → queryCachePlugin-BDOPEAmH.mjs} +114 -14
- package/dist/{queryCachePlugin-DYQUyeJ9.d.mts → queryCachePlugin-DrQNnGws.d.mts} +1 -1
- package/dist/{rateLimitKey-BWx-qep0.mjs → rateLimitKey-igF1x64n.mjs} +1 -1
- package/dist/{realtime-D2tqi3d2.mjs → realtime-Cq_ugiWw.mjs} +75 -22
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-Dl0k6UXy.mjs → registry-DmF9Akvn.mjs} +2 -2
- package/dist/{relay-ZYvS4xyW.mjs → relay-DA89IhFt.mjs} +200 -99
- package/dist/{renewingLease-DT4yLb29.mjs → renewingLease-DBtGUt8T.mjs} +1 -1
- package/dist/{replyHelpers-BJFN5AW7.mjs → replyHelpers-CUbeUc5q.mjs} +2 -2
- package/dist/{requestContext-Ct5la-SA.mjs → requestContext-DO9Qv0gw.mjs} +1 -1
- package/dist/{requirement-CxDxjB6V.mjs → requirement-C3GaQmkR.mjs} +1 -1
- package/dist/{resourceRateLimit-DCWglD7V.d.mts → resourceRateLimit-BPiESPtG.d.mts} +4 -0
- package/dist/{resourceRateLimit-D1oH2obv.mjs → resourceRateLimit-KKn-sFhb.mjs} +19 -4
- package/dist/{rolldown-runtime-BdTN42uL.mjs → rolldown-runtime-Ck1Tj4Ax.mjs} +1 -1
- package/dist/{routeValidator-DclDl5WJ.mjs → routeValidator-BF7n34xV.mjs} +47 -5
- package/dist/{runtimeCapabilities-ClWr60El.mjs → runtimeCapabilities-D0A4kkrC.mjs} +1 -1
- package/dist/{schedules-gVkRcs-9.mjs → schedules-CLrQRSTt.mjs} +6 -9
- package/dist/{schemaConverter-CIwB5wPO.mjs → schemaConverter-JEmU21fu.mjs} +2 -2
- package/dist/{actionPermissions-Dha8sAz2.mjs → schemaIR-wOffQlbq.mjs} +184 -16
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +1 -1
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-VMZhdkbT.mjs → scope-CcTMRd7s.mjs} +4 -4
- package/dist/{shutdown-Bi19vH0z.mjs → shutdown-BIR-QBYM.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-CaCS09fh.mjs → simpleEqualityMatcher-DqqJqovq.mjs} +1 -1
- package/dist/{sse-BqM359f1.mjs → sse-OEuPpgss.mjs} +9 -35
- package/dist/sseStats-DQqNN385.d.mts +112 -0
- package/dist/sseStream-DknHE2K5.mjs +166 -0
- package/dist/{store-helpers-rx-F2ZGR.mjs → store-helpers-D4vtEXt2.mjs} +1 -1
- package/dist/{streaming-CPChx3A7.mjs → streaming-CcIpcx02.mjs} +1 -1
- package/dist/{subscriberIdentity-CYNYw8p_.mjs → subscriberIdentity-PO6kimAl.mjs} +1 -1
- package/dist/{tenancy-BoWImS3K.mjs → tenancy-CH2Kuksc.mjs} +2 -2
- package/dist/{tenantPreparation-oqKCZQZM.mjs → tenantPreparation-BTGpblQW.mjs} +4 -4
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +4 -4
- package/dist/testing/index.mjs +324 -17
- package/dist/testing/outboxStoreContract.mjs +2 -2
- package/dist/testing/requiredPorts.mjs +2 -2
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{timing-Dsteq59c.mjs → timing-Dii5X7AP.mjs} +1 -1
- package/dist/{transactionContext-C1OgH-hW.mjs → transactionContext-DMPhYEOt.mjs} +1 -1
- package/dist/{typeGuards-DNlpASzd.mjs → typeGuards-C1o_XEyp.mjs} +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-DduBiYaI.d.mts → types-B4E0sc6D.d.mts} +2 -2
- package/dist/{types-HFFSwF_K.mjs → types-BuV_cFqT.mjs} +4 -4
- package/dist/usage/index.d.mts +1 -1
- package/dist/usage/index.mjs +7 -7
- package/dist/{userHelpers-N-k-8dNF.mjs → userHelpers-D4m_pLSC.mjs} +1 -1
- package/dist/utils/index.d.mts +193 -34
- package/dist/utils/index.mjs +13 -13
- package/dist/{utils-C7w_RVlx.mjs → utils-CxLMXGn5.mjs} +761 -8
- package/dist/{validate-Brr4b_fH.mjs → validate-CZ975J8N.mjs} +3 -3
- package/dist/{versioning-S18y2-0C.d.mts → versioning-B07RgD27.d.mts} +2 -13
- package/dist/{versioning-CE5kdWOY.mjs → versioning-B2_8SBZo.mjs} +4 -7
- package/dist/{workScope-A3XBpYTa.mjs → workScope-B3W3r35s.mjs} +2 -2
- package/llms.txt +2 -2
- package/package.json +34 -34
- package/skills/arc/references/api-reference.md +2 -2
- package/skills/arc/references/auth-better-auth.md +1 -0
- package/skills/arc/references/events-outbox.md +7 -4
- package/skills/arc/references/events.md +2 -2
- package/skills/arc/references/production-api.md +4 -0
- package/skills/arc/references/production-boot.md +2 -0
- package/skills/arc/references/production-idempotency.md +1 -1
- package/skills/arc/references/production-realtime.md +28 -2
- package/skills/arc/references/validation.md +4 -0
- package/skills/arc/references/writes-hooks-errors.md +1 -0
- package/dist/schemaIR-A0IoD05P.mjs +0 -108
- package/dist/sseStream-qSa-F2Qm.mjs +0 -57
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as runAdmittedWork, n as isAdmittedWork, r as registerShutdownParticipant } from "./shutdown-
|
|
7
|
-
import { n as MemoryEventTransport, r as createEvent, t as ARC_EVENT_TRANSPORT } from "./EventTransport-
|
|
8
|
-
import { n as preserveSubscriberIdentity } from "./subscriberIdentity-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
|
|
3
|
+
import { n as requestContext } from "./requestContext-DO9Qv0gw.mjs";
|
|
4
|
+
import { t as arcLog } from "./logger-BagW7_YA.mjs";
|
|
5
|
+
import { d as createDomainError } from "./errors-3xaK0i9n.mjs";
|
|
6
|
+
import { i as runAdmittedWork, n as isAdmittedWork, r as registerShutdownParticipant } from "./shutdown-BIR-QBYM.mjs";
|
|
7
|
+
import { n as MemoryEventTransport, r as createEvent, t as ARC_EVENT_TRANSPORT } from "./EventTransport-B18mcj_M.mjs";
|
|
8
|
+
import { n as preserveSubscriberIdentity } from "./subscriberIdentity-PO6kimAl.mjs";
|
|
9
9
|
import { isProductionEnv } from "@classytic/primitives/environment";
|
|
10
10
|
import fp from "fastify-plugin";
|
|
11
11
|
import { NonDurablePublishError } from "@classytic/primitives/durable-events";
|
|
@@ -135,11 +135,7 @@ function sleep(ms) {
|
|
|
135
135
|
* transport: new RedisEventTransport({ url: process.env.REDIS_URL }),
|
|
136
136
|
* });
|
|
137
137
|
*/
|
|
138
|
-
var eventPlugin_exports = /* @__PURE__ */ __exportAll({
|
|
139
|
-
default: () => eventPlugin_default,
|
|
140
|
-
emitObserved: () => emitObserved,
|
|
141
|
-
eventPlugin: () => eventPlugin
|
|
142
|
-
});
|
|
138
|
+
var eventPlugin_exports = /* @__PURE__ */ __exportAll({ default: () => eventPlugin_default });
|
|
143
139
|
const OBSERVERS = Symbol.for("arc.events.observers");
|
|
144
140
|
/** Notify `fastify.events.observe` listeners. Internal: the plugin and the outbox relay call it. */
|
|
145
141
|
function emitObserved(events, event) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as createEvent } from "./EventTransport-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as createEvent } from "./EventTransport-B18mcj_M.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { durableEventMeta } from "@classytic/primitives/durable-events";
|
|
5
5
|
// src/events/defineEvent.ts
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { i as EventLogger, n as DomainEvent, o as MemoryEventTransport, r as EventHandler, s as MemoryEventTransportOptions } from "../EventTransport-CYEoCJGe.mjs";
|
|
3
2
|
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-BY38F6yK.mjs";
|
|
4
|
-
import {
|
|
3
|
+
import { i as EventLogger, n as DomainEvent, o as MemoryEventTransport, r as EventHandler, s as MemoryEventTransportOptions } from "../EventTransport-CYEoCJGe.mjs";
|
|
4
|
+
import { a as createOutboxModule, c as EventOutboxOptions, d as RelayBatchOptions, f as RelayResult, g as readOutboxHealth, h as OutboxHealthStore, i as OutboxModuleOptions, l as OutboxRelayErrorHandler, m as OutboxHealth, n as OutboxDrainResult, o as MemoryOutboxStore, p as DEFAULT_RELAY_LAG_UNHEALTHY_MS, r as OutboxModuleExports, s as EventOutbox, t as OutboxDrainRequest, u as OutboxRelayErrorKind } from "../outbox-module-DzW6zwWJ.mjs";
|
|
5
5
|
import { RedisEventTransportOptions, RedisLike } from "./transports/redis.mjs";
|
|
6
6
|
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-CS1N9dwM.mjs";
|
|
7
7
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
@@ -61,7 +61,12 @@ interface InboxOptions {
|
|
|
61
61
|
readonly store: IdempotencyClaimStore;
|
|
62
62
|
/** Must exceed the handler's worst-case run time. Default: the store's lease default. */
|
|
63
63
|
readonly leaseMs?: number;
|
|
64
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Commit or roll back ALL work, including claim completion; external effects need their own key.
|
|
66
|
+
* Covers only writes made with the handler's `context.session`. A write outside it runs while this
|
|
67
|
+
* transaction stays open (a database-wide lock can then deadlock on it): omit `transaction` for
|
|
68
|
+
* such a handler and dedupe by `context.eventId`.
|
|
69
|
+
*/
|
|
65
70
|
readonly transaction?: <T>(work: (session: unknown) => Promise<T>) => Promise<T>;
|
|
66
71
|
}
|
|
67
72
|
interface InboxHandlerContext {
|
|
@@ -156,7 +161,15 @@ interface RepositoryOutboxStoreOptions {
|
|
|
156
161
|
* evaluates to `undefined` if the method ever disappears — an operator's replay that
|
|
157
162
|
* quietly does nothing and reports success.
|
|
158
163
|
*/
|
|
159
|
-
type RepositoryOutboxStore = OutboxStore & Required<Pick<OutboxStore, "fail" | "getDeadLettered" | "purge" | "requeue" | "countByStatus" | "oldestPendingAgeMs"
|
|
164
|
+
type RepositoryOutboxStore = OutboxStore & Required<Pick<OutboxStore, "fail" | "getDeadLettered" | "purge" | "requeue" | "countByStatus" | "oldestPendingAgeMs">> & {
|
|
165
|
+
/**
|
|
166
|
+
* The most rows the repository returned for one claim read, once a read came back
|
|
167
|
+
* clamped (its page `limit` below the one asked, e.g. a page `maxLimit`); `undefined`
|
|
168
|
+
* until then. `EventOutbox` lowers its effective `batchSize` to it, so a clamped page
|
|
169
|
+
* never reads as "backlog empty". Warned once (`OUTBOX_CLAIM_CAPPED`).
|
|
170
|
+
*/
|
|
171
|
+
readonly claimCap?: number | undefined;
|
|
172
|
+
};
|
|
160
173
|
export declare function repositoryAsOutboxStore(repository: RepositoryLike, options?: RepositoryOutboxStoreOptions): RepositoryOutboxStore;
|
|
161
174
|
/**
|
|
162
175
|
* Extract the payload type from an `EventDefinitionOutput<T>`.
|
|
@@ -317,4 +330,4 @@ interface FastifyEventBus {
|
|
|
317
330
|
}
|
|
318
331
|
/** Assign a deployment-stable identity for durable per-handler progress; never use an index. */
|
|
319
332
|
export declare function withSubscriberId<T>(id: string, handler: EventHandler<T>): EventHandler<T>;
|
|
320
|
-
export { type ArcLifecycleEvent, type CacheEvent, type CrudEventSuffix, type CustomValidator, DEFAULT_RELAY_LAG_UNHEALTHY_MS, type EventDefinitionInput, type EventDefinitionOutput, EventOutbox, type EventOutboxOptions, type EventPluginOptions, type EventRegistry, type EventRegistryOptions, type EventSchema, type ExponentialBackoffOptions, type FastifyEventBus, type InboxHandler, type InboxHandlerContext, type InboxOptions, MemoryEventTransport, type MemoryEventTransportOptions, MemoryOutboxStore, type OutboxDrainResult, type OutboxHealth, type OutboxHealthStore, type OutboxModuleExports, type OutboxModuleOptions, type OutboxRelayErrorHandler, type OutboxRelayErrorKind, type PayloadOf, type RedisEventTransportOptions, type RedisLike, type RedisStreamLike, type RedisStreamTransportOptions, type RelayResult, type RepositoryOutboxStore, type RepositoryOutboxStoreOptions, type RetryOptions, type ValidationResult, type WrapWithBoundaryOptions, type WrapWithSchemaOptions, createDeadLetterPublisher, createEventRegistry, createOutboxModule, defineEvent, eventPlugin, readOutboxHealth, withRetry };
|
|
333
|
+
export { type ArcLifecycleEvent, type CacheEvent, type CrudEventSuffix, type CustomValidator, DEFAULT_RELAY_LAG_UNHEALTHY_MS, type EventDefinitionInput, type EventDefinitionOutput, EventOutbox, type EventOutboxOptions, type EventPluginOptions, type EventRegistry, type EventRegistryOptions, type EventSchema, type ExponentialBackoffOptions, type FastifyEventBus, type InboxHandler, type InboxHandlerContext, type InboxOptions, MemoryEventTransport, type MemoryEventTransportOptions, MemoryOutboxStore, type OutboxDrainRequest, type OutboxDrainResult, type OutboxHealth, type OutboxHealthStore, type OutboxModuleExports, type OutboxModuleOptions, type OutboxRelayErrorHandler, type OutboxRelayErrorKind, type PayloadOf, type RedisEventTransportOptions, type RedisLike, type RedisStreamLike, type RedisStreamTransportOptions, type RelayBatchOptions, type RelayResult, type RepositoryOutboxStore, type RepositoryOutboxStoreOptions, type RetryOptions, type ValidationResult, type WrapWithBoundaryOptions, type WrapWithSchemaOptions, createDeadLetterPublisher, createEventRegistry, createOutboxModule, defineEvent, eventPlugin, readOutboxHealth, withRetry };
|
package/dist/events/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as crudEventType, d as createEventRegistry, f as defineEvent, i as CRUD_EVENT_SUFFIXES, l as wrapWithBoundary, n as CACHE_EVENTS, o as subscribeWithBoundary, s as subscribeWithSchema, t as ARC_LIFECYCLE_EVENTS, u as wrapWithSchema } from "../eventTypes-UPYg7gW1.mjs";
|
|
3
|
+
import { n as MemoryEventTransport } from "../EventTransport-B18mcj_M.mjs";
|
|
4
|
+
import { a as withRetry, i as createDeadLetterPublisher, n as eventPlugin } from "../eventPlugin-CVQ9ddnL.mjs";
|
|
5
|
+
import { r as withSubscriberId } from "../subscriberIdentity-PO6kimAl.mjs";
|
|
6
|
+
import { r as readOutboxHealth, t as DEFAULT_RELAY_LAG_UNHEALTHY_MS } from "../health-Cy6aOg1i.mjs";
|
|
7
|
+
import { t as createOutboxModule } from "../outbox-module-k5rIszQ4.mjs";
|
|
8
|
+
import { n as repositoryAsOutboxStore, r as exponentialBackoff, t as EventOutbox } from "../relay-DA89IhFt.mjs";
|
|
9
9
|
import { fingerprintRequest, runIdempotent } from "@classytic/repo-core/idempotency";
|
|
10
10
|
import { MemoryOutboxStore } from "@classytic/primitives/memory-outbox";
|
|
11
11
|
// src/events/inbox.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as evictToSize } from "../../boundedMap-
|
|
3
|
-
import { r as workSeedFromEvent, t as runWorkScope } from "../../workScope-
|
|
4
|
-
import { t as getSubscriberId } from "../../subscriberIdentity-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evictToSize } from "../../boundedMap-CuCwos_X.mjs";
|
|
3
|
+
import { r as workSeedFromEvent, t as runWorkScope } from "../../workScope-B3W3r35s.mjs";
|
|
4
|
+
import { t as getSubscriberId } from "../../subscriberIdentity-PO6kimAl.mjs";
|
|
5
5
|
import sjson from "secure-json-parse";
|
|
6
6
|
import { createEventRouter } from "@classytic/primitives/events";
|
|
7
7
|
// src/events/transports/redis-stream.ts
|
|
@@ -26,7 +26,29 @@ export interface RedisEventTransportOptions {
|
|
|
26
26
|
* Pass `fastify.log` to integrate with your application logger.
|
|
27
27
|
*/
|
|
28
28
|
logger?: EventLogger;
|
|
29
|
+
/**
|
|
30
|
+
* Longest `subscribe()` waits for Redis to confirm a subscription (ms). Past it the
|
|
31
|
+
* handler is registered anyway and the SUBSCRIBE stays queued on the client (ioredis
|
|
32
|
+
* sends it once connected and re-subscribes after every reconnect), so an app BOOTS
|
|
33
|
+
* while Redis is down instead of hanging until it returns. One warning per outage;
|
|
34
|
+
* while the subscriber is not connected, later subscriptions do not wait at all.
|
|
35
|
+
* @default 2000
|
|
36
|
+
*/
|
|
37
|
+
subscribeTimeoutMs?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Longest `publish()` waits for Redis (ms) before it rejects, so a caller with a retry
|
|
40
|
+
* (the outbox relay) retries later instead of hanging on a client that queues while
|
|
41
|
+
* disconnected. A publish that timed out may still be sent when the client reconnects:
|
|
42
|
+
* handlers must be idempotent by event id (they already must be for at-least-once).
|
|
43
|
+
* @default 5000
|
|
44
|
+
*/
|
|
45
|
+
publishTimeoutMs?: number;
|
|
29
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* `error.code` of a publish refused because Redis did not answer (never a bad event): an outbox
|
|
49
|
+
* `failurePolicy` can keep retrying it instead of counting it toward dead-lettering.
|
|
50
|
+
*/
|
|
51
|
+
export declare const TRANSPORT_UNAVAILABLE = "arc.transport_unavailable";
|
|
30
52
|
export declare class RedisEventTransport implements EventTransport {
|
|
31
53
|
readonly name = "redis";
|
|
32
54
|
/** Publish-side client (the original client or a duplicate). */
|
|
@@ -43,10 +65,23 @@ export declare class RedisEventTransport implements EventTransport {
|
|
|
43
65
|
private handlers;
|
|
44
66
|
/** Tracks whether the pmessage listener has been attached. */
|
|
45
67
|
private listenerAttached;
|
|
68
|
+
private subscribeTimeoutMs;
|
|
69
|
+
private publishTimeoutMs;
|
|
70
|
+
/** A subscription timed out and the subscriber has not been ready since: do not wait again. */
|
|
71
|
+
private subscriberDown;
|
|
72
|
+
/** A publish timed out and the publisher has not been ready since: refuse at once. */
|
|
73
|
+
private publisherDown;
|
|
46
74
|
constructor(redis: RedisLike, options?: RedisEventTransportOptions);
|
|
47
75
|
publish(event: DomainEvent): Promise<void>;
|
|
48
76
|
subscribe(pattern: string, handler: EventHandler): Promise<() => void>;
|
|
49
77
|
close(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* QUIT waits for Redis like any command (queued while disconnected): bounded, then the socket is
|
|
80
|
+
* dropped (`disconnect()` when the client has one), so an app can shut down during an outage.
|
|
81
|
+
*/
|
|
82
|
+
private quitOrDrop;
|
|
83
|
+
/** A queued subscription that Redis refused once it answered (logged; the handler stays registered). */
|
|
84
|
+
private subscribeFailed;
|
|
50
85
|
/**
|
|
51
86
|
* Attach the Redis message listeners exactly once.
|
|
52
87
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as workSeedFromEvent, t as runWorkScope } from "../../workScope-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as workSeedFromEvent, t as runWorkScope } from "../../workScope-B3W3r35s.mjs";
|
|
3
3
|
import sjson from "secure-json-parse";
|
|
4
4
|
// src/events/transports/redis.ts
|
|
5
5
|
/**
|
|
@@ -17,6 +17,33 @@ import sjson from "secure-json-parse";
|
|
|
17
17
|
*
|
|
18
18
|
* await app.register(eventPlugin, { transport });
|
|
19
19
|
*/
|
|
20
|
+
/** Settle `promise` within `ms`: `'timeout'` when it did not. The promise keeps running. */
|
|
21
|
+
function within(promise, ms) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
const timer = setTimeout(() => resolve("timeout"), ms);
|
|
24
|
+
timer.unref?.();
|
|
25
|
+
promise.then((value) => {
|
|
26
|
+
clearTimeout(timer);
|
|
27
|
+
resolve({ value });
|
|
28
|
+
}, (err) => {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
reject(err);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `error.code` of a publish refused because Redis did not answer (never a bad event): an outbox
|
|
36
|
+
* `failurePolicy` can keep retrying it instead of counting it toward dead-lettering.
|
|
37
|
+
*/
|
|
38
|
+
const TRANSPORT_UNAVAILABLE = "arc.transport_unavailable";
|
|
39
|
+
function unavailable(message) {
|
|
40
|
+
return Object.assign(new Error(message), { code: TRANSPORT_UNAVAILABLE });
|
|
41
|
+
}
|
|
42
|
+
function positiveMs(name, value, fallback) {
|
|
43
|
+
if (value === void 0) return fallback;
|
|
44
|
+
if (!Number.isFinite(value) || value <= 0) throw new Error(`[RedisEventTransport] ${name} must be a positive number of milliseconds.`);
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
20
47
|
/**
|
|
21
48
|
* DomainEvent contains a `Date` in `meta.timestamp`. We serialize it as an
|
|
22
49
|
* ISO string and revive it on the other end so subscribers always receive a
|
|
@@ -50,27 +77,59 @@ var RedisEventTransport = class {
|
|
|
50
77
|
handlers = /* @__PURE__ */ new Map();
|
|
51
78
|
/** Tracks whether the pmessage listener has been attached. */
|
|
52
79
|
listenerAttached = false;
|
|
80
|
+
subscribeTimeoutMs;
|
|
81
|
+
publishTimeoutMs;
|
|
82
|
+
/** A subscription timed out and the subscriber has not been ready since: do not wait again. */
|
|
83
|
+
subscriberDown = false;
|
|
84
|
+
/** A publish timed out and the publisher has not been ready since: refuse at once. */
|
|
85
|
+
publisherDown = false;
|
|
53
86
|
constructor(redis, options = {}) {
|
|
54
87
|
const { channel = "arc-events", externalLifecycle = false, logger = console } = options;
|
|
55
88
|
this.channel = channel;
|
|
56
89
|
this.externalLifecycle = externalLifecycle;
|
|
57
90
|
this.logger = logger;
|
|
91
|
+
this.subscribeTimeoutMs = positiveMs("subscribeTimeoutMs", options.subscribeTimeoutMs, 2e3);
|
|
92
|
+
this.publishTimeoutMs = positiveMs("publishTimeoutMs", options.publishTimeoutMs, 5e3);
|
|
58
93
|
this.pub = redis;
|
|
59
94
|
this.sub = redis.duplicate();
|
|
95
|
+
if (typeof this.pub.on === "function") this.pub.on("ready", () => {
|
|
96
|
+
this.publisherDown = false;
|
|
97
|
+
});
|
|
98
|
+
let reported = false;
|
|
99
|
+
this.sub.on("error", (err) => {
|
|
100
|
+
if (reported) return;
|
|
101
|
+
reported = true;
|
|
102
|
+
this.logger.warn(`[RedisEventTransport] subscriber connection error: ${err instanceof Error ? err.message : String(err)}`);
|
|
103
|
+
});
|
|
104
|
+
this.sub.on("ready", () => {
|
|
105
|
+
reported = false;
|
|
106
|
+
});
|
|
60
107
|
}
|
|
61
108
|
async publish(event) {
|
|
62
109
|
const redisChannel = `${this.channel}:${event.type}`;
|
|
63
|
-
|
|
110
|
+
if (this.publisherDown) throw unavailable(`[RedisEventTransport] publish of ${event.type} refused: Redis unavailable`);
|
|
111
|
+
if (await within(this.pub.publish(redisChannel, serialize(event)), this.publishTimeoutMs) === "timeout") {
|
|
112
|
+
this.publisherDown = true;
|
|
113
|
+
throw unavailable(`[RedisEventTransport] publish of ${event.type} not confirmed within ${this.publishTimeoutMs} ms (Redis unavailable?)`);
|
|
114
|
+
}
|
|
64
115
|
}
|
|
65
116
|
async subscribe(pattern, handler) {
|
|
66
117
|
this.ensureListener();
|
|
67
118
|
const redisPattern = this.toRedisPattern(pattern);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
119
|
+
const known = this.handlers.get(redisPattern);
|
|
120
|
+
this.handlers.set(redisPattern, (known ?? /* @__PURE__ */ new Set()).add(handler));
|
|
121
|
+
if (!known) {
|
|
122
|
+
const confirmed = this.isGlob(redisPattern) ? this.sub.psubscribe(redisPattern) : this.sub.subscribe(redisPattern);
|
|
123
|
+
if (this.subscriberDown) confirmed.catch((err) => this.subscribeFailed(redisPattern, err));
|
|
124
|
+
else if (await within(confirmed, this.subscribeTimeoutMs).catch((err) => {
|
|
125
|
+
this.handlers.delete(redisPattern);
|
|
126
|
+
throw err;
|
|
127
|
+
}) === "timeout") {
|
|
128
|
+
this.subscriberDown = true;
|
|
129
|
+
confirmed.catch((err) => this.subscribeFailed(redisPattern, err));
|
|
130
|
+
this.logger.warn(`[RedisEventTransport] Redis did not confirm a subscription within ${this.subscribeTimeoutMs} ms: continuing; subscriptions are sent when it connects (no cross-instance events until then)`);
|
|
131
|
+
}
|
|
72
132
|
}
|
|
73
|
-
this.handlers.get(redisPattern)?.add(handler);
|
|
74
133
|
return () => {
|
|
75
134
|
const set = this.handlers.get(redisPattern);
|
|
76
135
|
if (set) set.delete(handler);
|
|
@@ -78,8 +137,22 @@ var RedisEventTransport = class {
|
|
|
78
137
|
}
|
|
79
138
|
async close() {
|
|
80
139
|
this.handlers.clear();
|
|
81
|
-
if (!this.externalLifecycle) await Promise.all([this.sub
|
|
82
|
-
else await this.sub
|
|
140
|
+
if (!this.externalLifecycle) await Promise.all([this.quitOrDrop(this.sub), this.quitOrDrop(this.pub)]);
|
|
141
|
+
else await this.quitOrDrop(this.sub);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* QUIT waits for Redis like any command (queued while disconnected): bounded, then the socket is
|
|
145
|
+
* dropped (`disconnect()` when the client has one), so an app can shut down during an outage.
|
|
146
|
+
*/
|
|
147
|
+
async quitOrDrop(client) {
|
|
148
|
+
const quit = client.quit();
|
|
149
|
+
quit.catch(() => {});
|
|
150
|
+
const outcome = await within(quit, this.publishTimeoutMs).catch(() => "failed");
|
|
151
|
+
if (outcome === "timeout" || outcome === "failed") client.disconnect?.();
|
|
152
|
+
}
|
|
153
|
+
/** A queued subscription that Redis refused once it answered (logged; the handler stays registered). */
|
|
154
|
+
subscribeFailed(redisPattern, err) {
|
|
155
|
+
this.logger.error(`[RedisEventTransport] Subscription to ${redisPattern} failed:`, err);
|
|
83
156
|
}
|
|
84
157
|
/**
|
|
85
158
|
* Attach the Redis message listeners exactly once.
|
|
@@ -87,6 +160,9 @@ var RedisEventTransport = class {
|
|
|
87
160
|
ensureListener() {
|
|
88
161
|
if (this.listenerAttached) return;
|
|
89
162
|
this.listenerAttached = true;
|
|
163
|
+
this.sub.on("ready", () => {
|
|
164
|
+
this.subscriberDown = false;
|
|
165
|
+
});
|
|
90
166
|
this.sub.on("pmessage", (...args) => {
|
|
91
167
|
const [redisPattern, , message] = args;
|
|
92
168
|
this.dispatch(redisPattern, message);
|
|
@@ -139,4 +215,4 @@ var RedisEventTransport = class {
|
|
|
139
215
|
return pattern.includes("*") || pattern.includes("?") || pattern.includes("[");
|
|
140
216
|
}
|
|
141
217
|
};
|
|
142
|
-
export { RedisEventTransport };
|
|
218
|
+
export { RedisEventTransport, TRANSPORT_UNAVAILABLE };
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
+
import { a as ResolvedModuleDescriptor, o as ResolvedModuleLifecycle, s as ResolvedResourceDescriptor } from "../fastify-augmentation-baQc3MaO.mjs";
|
|
3
|
+
import { a as RawBodyOptions, c as BetterAuthOption, d as JwtAuthOption, i as MultipartOptions, l as CustomAuthenticatorOption, n as CreateAppHttpOptions, o as UnderPressureOptions, r as CreateAppOptions, s as AuthOption, t as BootDisposer, u as CustomPluginAuthOption } from "../index-Dhrks-hM.mjs";
|
|
2
4
|
import { F as HealthCheck, _ 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, y as loadResources } from "../types-BeEJm-DV.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-
|
|
4
|
-
import { a as ResolvedModuleDescriptor, o as ResolvedModuleLifecycle, s as ResolvedResourceDescriptor } from "../fastify-augmentation-bzkWPt1f.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-D1X_C_qz.mjs";
|
|
5
|
+
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-DexdFs1a.mjs";
|
|
6
6
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
7
7
|
/**
|
|
8
8
|
* Default pino redact paths (auth/cookie/API-key headers, nested
|
|
@@ -157,4 +157,4 @@ export declare const testingPreset: Partial<CreateAppOptions>;
|
|
|
157
157
|
*/
|
|
158
158
|
export declare const edgePreset: Partial<CreateAppOptions>;
|
|
159
159
|
export declare function getPreset(name: "production" | "development" | "testing" | "edge" | "worker"): Partial<CreateAppOptions>;
|
|
160
|
-
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 };
|
|
160
|
+
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 CreateAppHttpOptions, 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,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
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-Db9JRumw.mjs";
|
|
3
|
+
import { r as mergeHealthChecks, t as healthPlugin } from "../health-Cfh-kYI_.mjs";
|
|
4
|
+
import { a as lazyModuleExports, i as hasModuleExports, n as getModuleExports, o as lazyRequiredModuleExports, r as getOptionalModuleExports, t as defineModule } from "../module-lbEbHUfI.mjs";
|
|
5
|
+
import { t as loadResources } from "../loadResources-Oi47dogA.mjs";
|
|
6
|
+
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-iEgaS5_H.mjs";
|
|
7
7
|
// src/factory/module/asyncapi.ts
|
|
8
8
|
/**
|
|
9
9
|
* The module graph as an AsyncAPI 3.0 document — one channel per event (addressed by the event
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { M as ResourceRegistry,
|
|
2
|
+
import { M as ResourceRegistry, pn as HookSystem } from "./index-DLCcLUQT.mjs";
|
|
3
3
|
import { t as ExternalOpenApiPaths } from "./externalPaths-BOqdq5wr.mjs";
|
|
4
4
|
import { F as HealthCheck, i as ArcModuleRegistry, n as ArcModule, x as ScheduleDefinition } from "./types-BeEJm-DV.mjs";
|
|
5
|
-
import { L as ModuleGraph, s as ModuleState } from "./index-
|
|
5
|
+
import { L as ModuleGraph, s as ModuleState } from "./index-DexdFs1a.mjs";
|
|
6
6
|
import { FastifyPluginAsync } from "fastify";
|
|
7
7
|
/**
|
|
8
8
|
* Resolved module introspection — what a module ACTUALLY composed to.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
|
|
3
|
+
// src/core/aggregation/fieldTypes.ts
|
|
4
|
+
var fieldTypes_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
coerceByType: () => coerceByType,
|
|
6
|
+
fieldTypesFromOpenApiSchemas: () => fieldTypesFromOpenApiSchemas,
|
|
7
|
+
guessDate: () => guessDate
|
|
8
|
+
});
|
|
9
|
+
const isRecord = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
10
|
+
/** One JSON Schema property → a field type, or `undefined` when ambiguous / not scalar. */
|
|
11
|
+
function typeOfProperty(prop) {
|
|
12
|
+
if (!isRecord(prop)) return void 0;
|
|
13
|
+
for (const key of ["anyOf", "oneOf"]) {
|
|
14
|
+
const branches = prop[key];
|
|
15
|
+
if (Array.isArray(branches)) {
|
|
16
|
+
const nonNull = branches.filter((b) => !(isRecord(b) && b.type === "null"));
|
|
17
|
+
return nonNull.length === 1 ? typeOfProperty(nonNull[0]) : void 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const declared = Array.isArray(prop.type) ? prop.type.filter((t) => t !== "null") : [prop.type];
|
|
21
|
+
if (declared.length !== 1) return void 0;
|
|
22
|
+
switch (declared[0]) {
|
|
23
|
+
case "string":
|
|
24
|
+
if (prop.format === "date-time") return "date";
|
|
25
|
+
if (prop.format === "date") return void 0;
|
|
26
|
+
return "string";
|
|
27
|
+
case "number":
|
|
28
|
+
case "integer": return "number";
|
|
29
|
+
case "boolean": return "boolean";
|
|
30
|
+
default: return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function collect(schema, prefix, out) {
|
|
34
|
+
if (!isRecord(schema) || !isRecord(schema.properties)) return;
|
|
35
|
+
for (const [name, prop] of Object.entries(schema.properties)) {
|
|
36
|
+
const path = prefix ? `${prefix}.${name}` : name;
|
|
37
|
+
if (path in out) continue;
|
|
38
|
+
const type = typeOfProperty(prop);
|
|
39
|
+
if (type) out[path] = type;
|
|
40
|
+
else if (isRecord(prop) && isRecord(prop.properties)) collect(prop, path, out);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Field types from a resource's generated OpenAPI schemas. Reads `entity`, then `response`, then
|
|
45
|
+
* `createBody` (the first that declares a field wins). Returns `{}` when none is available.
|
|
46
|
+
*/
|
|
47
|
+
function fieldTypesFromOpenApiSchemas(schemas) {
|
|
48
|
+
const out = {};
|
|
49
|
+
if (!isRecord(schemas)) return out;
|
|
50
|
+
for (const key of [
|
|
51
|
+
"entity",
|
|
52
|
+
"response",
|
|
53
|
+
"createBody"
|
|
54
|
+
]) collect(schemas[key], "", out);
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
const ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
58
|
+
/** The legacy shape guess, kept for fields with no declared type. */
|
|
59
|
+
function guessDate(v) {
|
|
60
|
+
if (typeof v !== "string" || !ISO_DATE_RE.test(v)) return v;
|
|
61
|
+
const d = new Date(v);
|
|
62
|
+
return Number.isNaN(d.getTime()) ? v : d;
|
|
63
|
+
}
|
|
64
|
+
/** Coerce one URL operand by the field's declared type. Unparseable input is returned unchanged. */
|
|
65
|
+
function coerceByType(v, type) {
|
|
66
|
+
if (typeof v !== "string") return v;
|
|
67
|
+
switch (type) {
|
|
68
|
+
case "string": return v;
|
|
69
|
+
case "date": {
|
|
70
|
+
const d = new Date(v);
|
|
71
|
+
return v.trim() === "" || Number.isNaN(d.getTime()) ? v : d;
|
|
72
|
+
}
|
|
73
|
+
case "number": {
|
|
74
|
+
const n = Number(v);
|
|
75
|
+
return v.trim() === "" || !Number.isFinite(n) ? v : n;
|
|
76
|
+
}
|
|
77
|
+
case "boolean": return v === "true" ? true : v === "false" ? false : v;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export { guessDate as i, fieldTypesFromOpenApiSchemas as n, fieldTypes_exports as r, coerceByType as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as pluralize } from "./pluralize-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as pluralize } from "./pluralize-CX4ZvwCa.mjs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
// 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.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { u as ValidationError } from "./errors-3xaK0i9n.mjs";
|
|
3
3
|
// src/utils/headers.ts
|
|
4
4
|
/**
|
|
5
5
|
* Canonical header typing + accessor.
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Sn as defineHook, _n as afterUpdate, bn as beforeUpdate, cn as HookContext, dn as HookPhase, fn as HookRegistration, gn as afterDelete, hn as afterCreate, ln as HookHandler, mn as HookSystemOptions, on as AroundHookHandler, pn as HookSystem, sn as DefineHookOptions, un as HookOperation, vn as beforeCreate, xn as createHookSystem, yn as beforeDelete } from "../index-DLCcLUQT.mjs";
|
|
3
3
|
export { type AroundHookHandler, type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
export { t as HookSystem, n as afterCreate, r as afterDelete, i as afterUpdate, a as beforeCreate, o as beforeDelete, s as beforeUpdate, c as createHookSystem, l as defineHook } from "../HookSystem-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
export { t as HookSystem, n as afterCreate, r as afterDelete, i as afterUpdate, a as beforeCreate, o as beforeDelete, s as beforeUpdate, c as createHookSystem, l as defineHook } from "../HookSystem-FUBaLTRm.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as PrivacyDecision, c as RouteHttpCacheConfig, i as NonCacheableReason, l as TagSpec, n as HttpCachePolicy, o as PrivacyReason, r as HttpCacheRule, s as ResourceHttpCacheConfig, t as DocumentTags } from "../policy.types-DPqToKG1.mjs";
|
|
3
|
-
import { n as DomainEvent } from "../EventTransport-CYEoCJGe.mjs";
|
|
4
2
|
import { i as PurgerCapabilities, n as CachePurger, r as PurgeMode, t as CachePurgeError } from "../purger.types-DvPp4-yd.mjs";
|
|
3
|
+
import { n as DomainEvent } from "../EventTransport-CYEoCJGe.mjs";
|
|
4
|
+
import { a as PrivacyDecision, c as RouteHttpCacheConfig, i as NonCacheableReason, l as TagSpec, n as HttpCachePolicy, o as PrivacyReason, r as HttpCacheRule, s as ResourceHttpCacheConfig, t as DocumentTags } from "../policy.types-DPqToKG1.mjs";
|
|
5
5
|
import { FastifyInstance, FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
6
6
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
7
7
|
interface InvalidationBatch {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { r as exponentialBackoff, t as EventOutbox } from "../relay-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as chunkTags, t as CachePurgeError } from "../purger.types-CZwkTZ7B.mjs";
|
|
3
|
+
import { t as hasEvents } from "../typeGuards-C1o_XEyp.mjs";
|
|
4
|
+
import { r as exponentialBackoff, t as EventOutbox } from "../relay-DA89IhFt.mjs";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
6
|
import { createEvent } from "@classytic/primitives/events";
|
|
7
7
|
// src/http-cache/invalidation/delivery.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as CachePurgeError } from "../../purger.types-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CachePurgeError } from "../../purger.types-CZwkTZ7B.mjs";
|
|
3
3
|
// src/http-cache/purgers/cloudflare.ts
|
|
4
4
|
/**
|
|
5
5
|
* Cloudflare purge-by-tag (`Cache-Tag`). Needs an API token scoped to Zone > Cache Purge only.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as CachePurgeError } from "../../purger.types-
|
|
1
|
+
/*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CachePurgeError } from "../../purger.types-CZwkTZ7B.mjs";
|
|
3
3
|
// src/http-cache/purgers/fastly.ts
|
|
4
4
|
/**
|
|
5
5
|
* Fastly surrogate-key purge, with soft purge (`Fastly-Soft-Purge: 1`). Responses must carry the tags in
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as RouteIdempotencyConfig } from "../requirement-CTRQjjQx.mjs";
|
|
3
2
|
import { a as createIdempotencyResult, i as IdempotencyStore, n as IdempotencyLock, r as IdempotencyResult, t as IdempotencyAcquisition } from "../interface-BmExzQRD.mjs";
|
|
3
|
+
import { t as RouteIdempotencyConfig } from "../requirement-CTRQjjQx.mjs";
|
|
4
4
|
import { i as RedisIdempotencyStoreOptions, n as RedisClient } from "../redis-RpDMemdm.mjs";
|
|
5
5
|
import { FastifyPluginAsync } from "fastify";
|
|
6
6
|
import { RepositoryLike } from "@classytic/repo-core/adapter";
|