@classytic/arc 2.46.0 → 2.48.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-DNgD9NP4.mjs → EventTransport-BWwg5YAU.mjs} +4 -4
- package/dist/{HookSystem-DRbPzEcP.mjs → HookSystem-B9x-Y_k7.mjs} +2 -2
- package/dist/{ResourceRegistry-Douk51fa.mjs → ResourceRegistry-BcvEJoZd.mjs} +2 -2
- package/dist/{acquire-RbtvDg9s.mjs → acquire-D2yj6Zzl.mjs} +1 -1
- package/dist/{actionPermissions-De0AJ7hm.mjs → actionPermissions-Dha8sAz2.mjs} +13 -13
- 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 +1 -1
- package/dist/auth/index.mjs +7 -7
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-DeZMrHcm.mjs → authorizationDecision-BZSJcPNE.mjs} +4 -4
- package/dist/{boundedMap-2WBh3gM9.mjs → boundedMap-o2KZDCWy.mjs} +1 -1
- package/dist/{buildHandler-DxVOOBpw.mjs → buildHandler-G3k59KY2.mjs} +4 -4
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-BYRwYrUo.mjs → caching-CJIDPZOv.mjs} +2 -2
- package/dist/{claimed-DYlELdnm.mjs → claimed-D0A43wjT.mjs} +1 -1
- package/dist/cleanup/index.d.mts +1 -1
- 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-CHZMUwBW.mjs → constants-D-faL5SX.mjs} +1 -1
- package/dist/context/index.mjs +5 -5
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +7 -7
- package/dist/{core-D9rS2BxO.mjs → core-NSu1peyq.mjs} +3 -3
- package/dist/{createActionRouter-0qkCRzTL.mjs → createActionRouter-DTSVv1VK.mjs} +6 -6
- package/dist/{createAggregationRouter-CUf5Esd9.mjs → createAggregationRouter-zEasm-ax.mjs} +7 -7
- package/dist/{createApp-DZIXfDKD.mjs → createApp-CjqhkX1x.mjs} +29 -29
- package/dist/{createMcpServer-DeVpqQF-.d.mts → createMcpServer-hSFeqRUb.d.mts} +9 -10
- package/dist/{defineAggregation-bmKQ4NmC.mjs → defineAggregation-DH2L6_v9.mjs} +1 -1
- package/dist/{defineResource-CGmdmGwh.mjs → defineResource-zYCrhNaN.mjs} +10 -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-CzhqAyVN.mjs → elevation-z--rFcZ5.mjs} +5 -5
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-dFyGOEoB.mjs → errorHandler-3_3oN-Uc.mjs} +3 -3
- package/dist/{errors-BY8vzlP4.mjs → errors-DyY48oRi.mjs} +1 -1
- package/dist/{eventPlugin-eMhAPtQA.mjs → eventPlugin-Co9sABCg.mjs} +8 -8
- package/dist/{eventTypes-Do2KYeJx.mjs → eventTypes-HmAFyJmJ.mjs} +2 -2
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.mjs +8 -7
- package/dist/events/transports/redis-stream-entry.mjs +4 -4
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.d.mts +3 -3
- package/dist/factory/index.mjs +6 -6
- package/dist/{fastify-augmentation-Dtn0IIRn.d.mts → fastify-augmentation-bzkWPt1f.d.mts} +2 -2
- package/dist/{fields-LnbCcvsw.mjs → fields-rfsl26Ov.mjs} +1 -1
- package/dist/{filter-merge-BAWi019Q.mjs → filter-merge-8glLr7Dk.mjs} +1 -1
- package/dist/{generate-oXoDnpJf.mjs → generate-BOfBueRt.mjs} +2 -2
- package/dist/{headers-DBd3Qheo.mjs → headers-CHSOqpcY.mjs} +2 -2
- package/dist/{health-BlJu9GXS.mjs → health-DHvAIVmM.mjs} +1 -1
- package/dist/{health-Dp-3EC9o.mjs → health-ezwTHQh2.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 +211 -0
- package/dist/http-cache/index.mjs +605 -0
- package/dist/http-cache/purgers/cloudflare.d.mts +13 -0
- package/dist/http-cache/purgers/cloudflare.mjs +46 -0
- package/dist/http-cache/purgers/fastly.d.mts +12 -0
- package/dist/http-cache/purgers/fastly.mjs +47 -0
- package/dist/http-cache/testing/index.d.mts +68 -0
- package/dist/http-cache/testing/index.mjs +168 -0
- package/dist/idempotency/index.mjs +8 -8
- package/dist/idempotency/redis.mjs +2 -2
- package/dist/{index-BTxzJ_MN.d.mts → index-BxZS-8So.d.mts} +2 -2
- package/dist/{index-DyJFTJLA.d.mts → index-Cy2-QffW.d.mts} +9 -0
- package/dist/{index-CUdaoCYt.d.mts → index-D1X_C_qz.d.mts} +2 -2
- package/dist/{index-Bqfo8hLz.d.mts → index-DFCCQ9AE.d.mts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +11 -11
- package/dist/{init-BOaNkLYb.mjs → init-MoE3eZNR.mjs} +1 -1
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.mjs +3 -3
- package/dist/integrations/mcp/index.d.mts +4 -36
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +11 -15
- package/dist/integrations/mcp/testing.mjs +22 -42
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +1 -1
- package/dist/integrations/webhooks.mjs +4 -3
- 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-DpRpKR_K.mjs → jsonBody-DZGiCawf.mjs} +2 -2
- package/dist/{keys-FBz6Ull-.mjs → keys-CrMOZuk6.mjs} +1 -1
- package/dist/{loadResources-Bx1sKPnF.mjs → loadResources-CVQvYUhN.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-b_jcqbxh.mjs → loadResourcesFromEntry-D0naccV2.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-CbFcIEBZ.mjs → logger-VyMcSmVG.mjs} +1 -1
- package/dist/{mcpPlugin-yix548XX.mjs → mcpPlugin-DQACaqVu.mjs} +210 -373
- package/dist/{memory-Bgw5dn8N.mjs → memory-Lpfu8Hga.mjs} +3 -3
- package/dist/{metrics-CZDQWVjS.mjs → metrics-DjVj1sg5.mjs} +3 -3
- 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-Dsc_nKL5.mjs → module-BqPJpZ_L.mjs} +1 -1
- package/dist/{multiTenant-XCxAUlru.d.mts → multiTenant-KZj8j1uJ.d.mts} +1 -1
- package/dist/{multipartBody-B85ek8Kj.mjs → multipartBody-BNgNv7r0.mjs} +1 -1
- package/dist/{observeSend-BK-JN1jK.mjs → observeSend-BKJHibJz.mjs} +1 -1
- package/dist/{openapi-Co7hl073.mjs → openapi-T90KrPR6.mjs} +6 -6
- package/dist/outbox-admin/index.mjs +5 -5
- package/dist/{outbox-module-XvUThpqn.d.mts → outbox-module-5Mnwcycy.d.mts} +1 -1
- package/dist/outbox-module-C874VgBr.mjs +297 -0
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-A1oKtpiC.mjs → permissions-R9T2G1PH.mjs} +9 -9
- package/dist/{pipe-Czpw9U2n.mjs → pipe-DzqbsZy-.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-KVseuBCL.mjs → plan-C0gkeABY.mjs} +1 -1
- package/dist/{plugin-DTWt_8C3.mjs → plugin-BJcVOX5r.mjs} +48 -24
- package/dist/plugins/index.d.mts +2 -2
- package/dist/plugins/index.mjs +17 -17
- package/dist/plugins/response-cache.mjs +4 -4
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-msB9X3yw.mjs → pluralize-CrCpyoZs.mjs} +1 -1
- package/dist/policy.types-DPqToKG1.d.mts +50 -0
- 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-qKCehiJM.mjs → presets-CNDvNYsz.mjs} +4 -4
- package/dist/{projection-ClBqtsIw.mjs → projection-CIUe8b59.mjs} +2 -2
- package/dist/purger.types-DvPp4-yd.d.mts +26 -0
- package/dist/purger.types-f83fTzGy.mjs +24 -0
- package/dist/{queryCachePlugin-3gJj5Rbz.mjs → queryCachePlugin-B2jpwFcv.mjs} +6 -6
- package/dist/{rateLimitKey-Kro---xl.mjs → rateLimitKey-BWx-qep0.mjs} +1 -1
- package/dist/{realtime-Ber8uJN2.mjs → realtime-D2tqi3d2.mjs} +11 -11
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-BA-_vFYk.mjs → registry-Dl0k6UXy.mjs} +2 -2
- package/dist/{outbox-module-mg9kDYkd.mjs → relay-ZYvS4xyW.mjs} +5 -299
- package/dist/{renewingLease-CMY8YOcc.mjs → renewingLease-DT4yLb29.mjs} +1 -1
- package/dist/{replyHelpers-DK9P_XSz.mjs → replyHelpers-BJFN5AW7.mjs} +2 -2
- package/dist/{requestContext-GYO_0gEw.mjs → requestContext-Ct5la-SA.mjs} +1 -1
- package/dist/{requirement-DeNjZIH3.mjs → requirement-CxDxjB6V.mjs} +1 -1
- package/dist/{resourceRateLimit-tHLbrtWc.mjs → resourceRateLimit-D1oH2obv.mjs} +2 -2
- package/dist/{rolldown-runtime-Kv1fZdLg.mjs → rolldown-runtime-BdTN42uL.mjs} +1 -1
- package/dist/{routeValidator-C_H5NanI.mjs → routeValidator-DclDl5WJ.mjs} +1 -1
- package/dist/{runtimeCapabilities-DWqbxkyw.mjs → runtimeCapabilities-ClWr60El.mjs} +1 -1
- package/dist/{schedules-eO_RzhCU.mjs → schedules-gVkRcs-9.mjs} +5 -5
- package/dist/{schemaConverter-DBJrPZN4.mjs → schemaConverter-CIwB5wPO.mjs} +2 -2
- package/dist/{schemaIR-CEScKT2v.mjs → schemaIR-A0IoD05P.mjs} +2 -2
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-B-Sm9m_E.mjs → scope-VMZhdkbT.mjs} +4 -4
- package/dist/{shutdown-DzLFbe27.mjs → shutdown-Bi19vH0z.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-DOJhwQ8g.mjs → simpleEqualityMatcher-CaCS09fh.mjs} +1 -1
- package/dist/{sse-2972pVwV.mjs → sse-BqM359f1.mjs} +7 -7
- package/dist/{sseStream-AWLEeNV-.mjs → sseStream-qSa-F2Qm.mjs} +2 -2
- package/dist/{store-helpers-VzjgVTkM.mjs → store-helpers-rx-F2ZGR.mjs} +1 -1
- package/dist/{streaming-DvraWW6x.mjs → streaming-CPChx3A7.mjs} +1 -1
- package/dist/{subscriberIdentity-Bya56jsg.mjs → subscriberIdentity-CYNYw8p_.mjs} +1 -1
- package/dist/{tenancy-DSa_0hhw.mjs → tenancy-BoWImS3K.mjs} +2 -2
- package/dist/{tenantPreparation-BrpkQre3.mjs → tenantPreparation-oqKCZQZM.mjs} +4 -4
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +3 -3
- package/dist/testing/index.mjs +11 -11
- package/dist/testing/outboxStoreContract.mjs +2 -2
- package/dist/testing/requiredPorts.mjs +2 -2
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{timing-6rQTuCwg.mjs → timing-Dsteq59c.mjs} +1 -1
- package/dist/{transactionContext-DaxYUEgH.mjs → transactionContext-C1OgH-hW.mjs} +1 -1
- package/dist/{typeGuards-UKnX8wPX.mjs → typeGuards-DNlpASzd.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-BYEb_dLW.d.mts → types-DduBiYaI.d.mts} +19 -30
- package/dist/{types-CuGjhn83.mjs → types-HFFSwF_K.mjs} +4 -4
- package/dist/usage/index.mjs +4 -4
- package/dist/{userHelpers-oX5_mOVs.mjs → userHelpers-N-k-8dNF.mjs} +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-CjjGOT4E.mjs → utils-C7w_RVlx.mjs} +5 -5
- package/dist/{validate-4RlTKOJb.mjs → validate-Brr4b_fH.mjs} +3 -3
- package/dist/{versioning-Dk2-19La.mjs → versioning-CE5kdWOY.mjs} +3 -3
- package/dist/{workScope-DoBsoVo4.mjs → workScope-A3XBpYTa.mjs} +2 -2
- package/package.json +47 -27
- package/skills/arc/references/mcp-custom-tools.md +1 -1
- package/skills/arc/references/mcp-setup.md +11 -10
- package/skills/arc/references/mcp-testing.md +3 -3
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import { i as resolveEventTransport } from "./EventTransport-DNgD9NP4.mjs";
|
|
6
|
-
import { t as emitObserved } from "./eventPlugin-eMhAPtQA.mjs";
|
|
7
|
-
import { n as canReportHealth, r as readOutboxHealth } from "./health-BlJu9GXS.mjs";
|
|
8
|
-
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-VzjgVTkM.mjs";
|
|
9
|
-
import { t as claimedAttempts } from "./claimed-DYlELdnm.mjs";
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evictToSize, r as touch } from "./boundedMap-o2KZDCWy.mjs";
|
|
3
|
+
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-rx-F2ZGR.mjs";
|
|
4
|
+
import { t as claimedAttempts } from "./claimed-D0A43wjT.mjs";
|
|
10
5
|
import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
|
|
11
|
-
import { randomBytes } from "node:crypto";
|
|
12
6
|
import { InvalidOutboxEventError, OutboxConflictError, OutboxOwnershipError, outboxPayloadFingerprint } from "@classytic/primitives/outbox";
|
|
13
7
|
import { update } from "@classytic/repo-core/update";
|
|
14
|
-
import { hostname } from "node:os";
|
|
15
8
|
// src/events/outbox/backoff.ts
|
|
16
9
|
/**
|
|
17
10
|
* Compute a `retryAt` `Date` using exponential backoff with jitter.
|
|
@@ -746,291 +739,4 @@ function normalizeError(err) {
|
|
|
746
739
|
};
|
|
747
740
|
return { message: String(err) };
|
|
748
741
|
}
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* The OUTBOX as a module — so the store is a SLOT other modules depend on, not a value the host
|
|
752
|
-
* threads by hand.
|
|
753
|
-
*
|
|
754
|
-
* ## The failure this exists to make impossible
|
|
755
|
-
*
|
|
756
|
-
* A durable store passed as a constructor argument to N consumers will eventually miss one, and
|
|
757
|
-
* the miss is silent. Observed in two independent ERP hosts on the same fleet:
|
|
758
|
-
*
|
|
759
|
-
* - one passed an outbox to its revenue-attach seam and **not** to `createOrder`, so
|
|
760
|
-
* `order:created` published fire-and-forget — a failed publish discarded the revenue trigger
|
|
761
|
-
* entirely: no attach, no dead-letter, no log. Cash collected, nothing recorded.
|
|
762
|
-
* - the other had the identical gap, written independently.
|
|
763
|
-
*
|
|
764
|
-
* Six consumers had to be wired by hand in each host (order kernel, revenue kernel, access
|
|
765
|
-
* kernel, revenue-attach durability, line-activation dead letters, promo-commit dead letters).
|
|
766
|
-
* That is not a discipline problem; it is a design problem.
|
|
767
|
-
*
|
|
768
|
-
* As a module the store is registered ONCE and read from the registry. A consumer declares
|
|
769
|
-
* `dependsOn: ['outbox']` and arc refuses to boot without it — the omission becomes a startup
|
|
770
|
-
* failure instead of a quiet data-loss window.
|
|
771
|
-
*
|
|
772
|
-
* ## What this module does NOT do
|
|
773
|
-
*
|
|
774
|
-
* It does not build a store. Store construction is store-specific (a mongo model, a SQL table),
|
|
775
|
-
* and arc is deliberately storage-agnostic — `repositoryAsOutboxStore` already adapts any
|
|
776
|
-
* repository, and kits own their own schema (e.g. `@classytic/mongokit/outbox`). This module owns
|
|
777
|
-
* the three things that are genuinely arc's: the module SLOT, the relay SCHEDULE, and shutdown.
|
|
778
|
-
*/
|
|
779
|
-
/**
|
|
780
|
-
* The store contract is `@classytic/primitives/outbox`'s, not arc's — arc adapts to it rather
|
|
781
|
-
* than owning it, which is why a kit (mongokit) can supply a store with no arc dependency.
|
|
782
|
-
*/
|
|
783
|
-
/** Default relay cadence. Frequent enough that a retry is not a user-visible delay. */
|
|
784
|
-
const DEFAULT_RELAY_EVERY_MS = 5e3;
|
|
785
|
-
/** How long the readiness check reuses a relay-health reading. See `health.probeCacheMs`. */
|
|
786
|
-
const DEFAULT_PROBE_CACHE_MS = 5e3;
|
|
787
|
-
/** How often an unhealthy outbox is logged. See `health.alertEveryMs`. */
|
|
788
|
-
const DEFAULT_HEALTH_ALERT_EVERY_MS = 3e5;
|
|
789
|
-
/**
|
|
790
|
-
* One relay identity per RELAY INSTANCE — `<name>:<hostname>:<pid>:<random>`.
|
|
791
|
-
*
|
|
792
|
-
* A lease identifies an independently executing CLAIMANT, not a crash domain.
|
|
793
|
-
* Arc lets two outbox modules coexist (`name` is the `dependsOn` key), each
|
|
794
|
-
* with its own schedule arm, and nothing stops two of them pointing at the
|
|
795
|
-
* same store: they tick independently, so they are two claimants and must be
|
|
796
|
-
* two identities. Scoping this per-process instead would have made the module
|
|
797
|
-
* WEAKER than the primitive it wraps — `EventOutbox`'s own fallback is already
|
|
798
|
-
* per-instance — and would leave the store unable to tell the two apart after
|
|
799
|
-
* a lease expiry, which is exactly the stale-owner hole this replaced.
|
|
800
|
-
*
|
|
801
|
-
* Every component earns its place: `name` distinguishes co-resident modules,
|
|
802
|
-
* `hostname:pid` makes a lease row legible in ops tooling, and the random
|
|
803
|
-
* suffix breaks the tie a container restart creates — same hostname, often the
|
|
804
|
-
* same pid, and the restarted process must not inherit a predecessor's
|
|
805
|
-
* identity while that predecessor's lease is still live.
|
|
806
|
-
*
|
|
807
|
-
* Called once per `bootstrap()`, so the id is stable across every tick of the
|
|
808
|
-
* relay it belongs to — which the lease depends on.
|
|
809
|
-
*/
|
|
810
|
-
function mintConsumerId(name) {
|
|
811
|
-
return `${name}:${hostname()}:${process.pid}:${randomBytes(4).toString("hex")}`;
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Compose the outbox as a module.
|
|
815
|
-
*
|
|
816
|
-
* ```ts
|
|
817
|
-
* // host
|
|
818
|
-
* const model = createOutboxModel(connection, { visibleAtField: 'nextVisibleAt' });
|
|
819
|
-
* createApp({ modules: [
|
|
820
|
-
* createOutboxModule({
|
|
821
|
-
* store: repositoryAsOutboxStore(new Repository(model), { visibleAtField: 'nextVisibleAt' }),
|
|
822
|
-
* onError: (err, ctx) => app.log.error({ err, ...ctx }, 'outbox relay'),
|
|
823
|
-
* }),
|
|
824
|
-
* …
|
|
825
|
-
* ]});
|
|
826
|
-
*
|
|
827
|
-
* // consumer module
|
|
828
|
-
* defineModule({
|
|
829
|
-
* name: 'order',
|
|
830
|
-
* dependsOn: ['outbox'],
|
|
831
|
-
* bootstrap: (f) => createOrder({
|
|
832
|
-
* outbox: getModuleExports<OutboxModuleExports>(f, 'outbox').store,
|
|
833
|
-
* }),
|
|
834
|
-
* });
|
|
835
|
-
* ```
|
|
836
|
-
*
|
|
837
|
-
* `dependsOn` is doing real work there: it both orders the bootstraps and makes a missing outbox a
|
|
838
|
-
* boot error naming the module that needed it.
|
|
839
|
-
*/
|
|
840
|
-
function createOutboxModule(options) {
|
|
841
|
-
const name = options.name ?? "outbox";
|
|
842
|
-
const relayEveryMs = options.relayEveryMs ?? DEFAULT_RELAY_EVERY_MS;
|
|
843
|
-
const lagUnhealthyMs = (options.health === false ? void 0 : options.health?.relayLagUnhealthyMs) ?? 3e5;
|
|
844
|
-
const probeCacheMs = (options.health === false ? void 0 : options.health?.probeCacheMs) ?? DEFAULT_PROBE_CACHE_MS;
|
|
845
|
-
if (!Number.isFinite(probeCacheMs) || probeCacheMs < 0) throw new Error(`Outbox module "${name}": health.probeCacheMs must be a non-negative number, got ${String(probeCacheMs)}.`);
|
|
846
|
-
const alertEveryMs = options.health === false ? 0 : options.health?.alertEveryMs ?? DEFAULT_HEALTH_ALERT_EVERY_MS;
|
|
847
|
-
if (!Number.isFinite(alertEveryMs) || alertEveryMs < 0) throw new Error(`Outbox module "${name}": health.alertEveryMs must be a non-negative number, got ${String(alertEveryMs)}.`);
|
|
848
|
-
let log;
|
|
849
|
-
/** The unmeasurable-store warning is said once, not every alert tick. */
|
|
850
|
-
let warnedUnmeasurable = false;
|
|
851
|
-
/**
|
|
852
|
-
* The readiness probe's reading, reused for `probeCacheMs` and shared by
|
|
853
|
-
* concurrent probes (single-flight). A failed or unmeasurable reading is
|
|
854
|
-
* cached as unhealthy for the same window — retrying a failing store on
|
|
855
|
-
* every probe is load on the thing that is already failing.
|
|
856
|
-
*/
|
|
857
|
-
let probeReading;
|
|
858
|
-
let probeInFlight;
|
|
859
|
-
const probeHealthy = (read) => {
|
|
860
|
-
if (probeReading && Date.now() - probeReading.at < probeCacheMs) return Promise.resolve(probeReading.healthy);
|
|
861
|
-
probeInFlight ??= read().then((h) => h.healthy, () => false).then((healthy) => {
|
|
862
|
-
probeReading = {
|
|
863
|
-
at: Date.now(),
|
|
864
|
-
healthy
|
|
865
|
-
};
|
|
866
|
-
return healthy;
|
|
867
|
-
}).finally(() => {
|
|
868
|
-
probeInFlight = void 0;
|
|
869
|
-
});
|
|
870
|
-
return probeInFlight;
|
|
871
|
-
};
|
|
872
|
-
/**
|
|
873
|
-
* Built at bootstrap and reused by the schedule.
|
|
874
|
-
*
|
|
875
|
-
* Not rebuilt per tick: `EventOutbox` carries the consumer id the lease is keyed on, and a fresh
|
|
876
|
-
* instance per tick would be a fresh claimant every few seconds — which defeats the lease it
|
|
877
|
-
* depends on for exactly-once publishing.
|
|
878
|
-
*/
|
|
879
|
-
let exports;
|
|
880
|
-
/** Passes THIS module started (nudge, schedule) that have not settled — `drain()` waits on them. */
|
|
881
|
-
const inFlightPasses = /* @__PURE__ */ new Set();
|
|
882
|
-
const trackPass = (pass) => {
|
|
883
|
-
inFlightPasses.add(pass);
|
|
884
|
-
const untrack = () => {
|
|
885
|
-
inFlightPasses.delete(pass);
|
|
886
|
-
};
|
|
887
|
-
pass.then(untrack, untrack);
|
|
888
|
-
return pass;
|
|
889
|
-
};
|
|
890
|
-
return {
|
|
891
|
-
name,
|
|
892
|
-
bootstrap: (fastify) => {
|
|
893
|
-
log = fastify.log;
|
|
894
|
-
const store = typeof options.store === "function" ? options.store(fastify) : options.store;
|
|
895
|
-
/**
|
|
896
|
-
* The RAW transport, never `fastify.events`.
|
|
897
|
-
*
|
|
898
|
-
* This read used to be `(fastify as { events?: EventTransport }).events` — a cast across
|
|
899
|
-
* two INCOMPATIBLE shapes. The facade's `publish(type, payload, meta?)` took the relayed
|
|
900
|
-
* `DomainEvent` as its `type` argument and failed the non-empty-string guard, so the
|
|
901
|
-
* documented default path published NOTHING: subscribers saw nothing and every tick
|
|
902
|
-
* reported `publishFailed: 1` until the row dead-lettered. The cast is what let two
|
|
903
|
-
* mismatched signatures typecheck.
|
|
904
|
-
*/
|
|
905
|
-
const transport = options.transport === void 0 ? resolveEventTransport(fastify) : typeof options.transport === "function" ? options.transport(fastify) : options.transport;
|
|
906
|
-
/**
|
|
907
|
-
* No transport is BOOT-FATAL, because the alternative is invisible:
|
|
908
|
-
* `EventOutbox.relayBatch()` returns an empty result when it has none, so the
|
|
909
|
-
* module's schedule would tick forever, publish nothing, and let the store grow —
|
|
910
|
-
* a durable backlog nobody is draining, reported as healthy. The failure this
|
|
911
|
-
* module exists to prevent, arrived at from the other side.
|
|
912
|
-
*/
|
|
913
|
-
if (transport === void 0) throw new Error(`Outbox module "${name}" could not resolve an event transport, so its relay would tick forever without publishing while the store grows. Register arc's events plugin (it is on by default — check \`arcPlugins.events !== false\`), or pass an explicit \`transport\` to \`createOutboxModule\`. Note the outbox needs the RAW EventTransport, not the \`fastify.events\` facade: the facade takes \`(type, payload, meta?)\` and fails open, which would acknowledge rows whose publish actually failed.`);
|
|
914
|
-
const relay = new EventOutbox({
|
|
915
|
-
store,
|
|
916
|
-
transport,
|
|
917
|
-
onPublished: (event) => emitObserved(fastify.events, event),
|
|
918
|
-
...options.batchSize !== void 0 ? { batchSize: options.batchSize } : {},
|
|
919
|
-
...options.leaseMs !== void 0 ? { leaseMs: options.leaseMs } : {},
|
|
920
|
-
consumerId: options.consumerId ?? mintConsumerId(name),
|
|
921
|
-
onError: options.onError ?? ((info) => {
|
|
922
|
-
fastify.log.error({
|
|
923
|
-
err: info.error,
|
|
924
|
-
kind: info.kind,
|
|
925
|
-
...info.event?.meta.id !== void 0 ? { eventId: info.event.meta.id } : {},
|
|
926
|
-
...info.event?.type !== void 0 ? { eventType: info.event.type } : {}
|
|
927
|
-
}, `outbox relay "${name}" failed`);
|
|
928
|
-
}),
|
|
929
|
-
...options.failurePolicy !== void 0 ? { failurePolicy: options.failurePolicy } : {},
|
|
930
|
-
...options.sessionProvider === false ? {} : { sessionProvider: options.sessionProvider ?? (() => transactionContext.get()) }
|
|
931
|
-
});
|
|
932
|
-
/**
|
|
933
|
-
* One pass per burst of requests. `drainQueued` stays true from the
|
|
934
|
-
* first request until the pass STARTS, so a request landing mid-pass
|
|
935
|
-
* schedules the next one — a row written during a pass is never left
|
|
936
|
-
* waiting for the interval.
|
|
937
|
-
*/
|
|
938
|
-
let drainQueued = false;
|
|
939
|
-
const requestDrain = () => {
|
|
940
|
-
if (drainQueued) return;
|
|
941
|
-
drainQueued = true;
|
|
942
|
-
let passDone = () => {};
|
|
943
|
-
trackPass(new Promise((resolve) => passDone = resolve));
|
|
944
|
-
setImmediate(() => {
|
|
945
|
-
drainQueued = false;
|
|
946
|
-
requestContext.storage.exit(() => {
|
|
947
|
-
relay.relayBatch().catch((err) => {
|
|
948
|
-
fastify.log.error({ err }, `outbox relay "${name}" requested drain failed`);
|
|
949
|
-
}).finally(passDone);
|
|
950
|
-
});
|
|
951
|
-
});
|
|
952
|
-
};
|
|
953
|
-
const drain = ({ maxPasses = 100 } = {}) => requestContext.storage.exit(async () => {
|
|
954
|
-
const total = {
|
|
955
|
-
passes: 0,
|
|
956
|
-
relayed: 0,
|
|
957
|
-
publishFailed: 0,
|
|
958
|
-
deadLettered: 0,
|
|
959
|
-
drained: false
|
|
960
|
-
};
|
|
961
|
-
while (total.passes < maxPasses) {
|
|
962
|
-
if (inFlightPasses.size > 0) await Promise.allSettled([...inFlightPasses]);
|
|
963
|
-
const r = await relay.relayBatch();
|
|
964
|
-
total.passes++;
|
|
965
|
-
total.relayed += r.relayed;
|
|
966
|
-
total.publishFailed += r.publishFailed;
|
|
967
|
-
total.deadLettered += r.deadLettered;
|
|
968
|
-
if (r.attempted === 0 && inFlightPasses.size === 0) {
|
|
969
|
-
total.drained = true;
|
|
970
|
-
break;
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
return total;
|
|
974
|
-
});
|
|
975
|
-
const health = async () => {
|
|
976
|
-
if (!canReportHealth(store)) throw new Error(`Outbox module "${name}": relay health needs BOTH countByStatus and oldestPendingAgeMs on the store, and it is missing at least one.`);
|
|
977
|
-
return readOutboxHealth(store, lagUnhealthyMs);
|
|
978
|
-
};
|
|
979
|
-
exports = {
|
|
980
|
-
store,
|
|
981
|
-
relay,
|
|
982
|
-
requestDrain,
|
|
983
|
-
drain,
|
|
984
|
-
health
|
|
985
|
-
};
|
|
986
|
-
return exports;
|
|
987
|
-
},
|
|
988
|
-
...options.health === false ? {} : { healthChecks: [{
|
|
989
|
-
name: `${name}.relay`,
|
|
990
|
-
critical: false,
|
|
991
|
-
check: () => exports ? probeHealthy(exports.health) : Promise.resolve(false)
|
|
992
|
-
}] },
|
|
993
|
-
/**
|
|
994
|
-
* The relay runs on the module's OWN schedule arm, so the host stops owning the tick — and
|
|
995
|
-
* a host that forgets to start one cannot exist.
|
|
996
|
-
*/
|
|
997
|
-
scheduledJobs: () => [{
|
|
998
|
-
name: `${name}.relay`,
|
|
999
|
-
kind: "relay",
|
|
1000
|
-
every: relayEveryMs,
|
|
1001
|
-
runOnStart: options.runOnStart ?? true,
|
|
1002
|
-
handler: async () => {
|
|
1003
|
-
if (exports) await trackPass(exports.relay.relay());
|
|
1004
|
-
}
|
|
1005
|
-
}, ...alertEveryMs > 0 ? [{
|
|
1006
|
-
name: `${name}.health`,
|
|
1007
|
-
kind: "relay",
|
|
1008
|
-
every: alertEveryMs,
|
|
1009
|
-
handler: async () => {
|
|
1010
|
-
if (!exports || !log) return;
|
|
1011
|
-
if (!canReportHealth(exports.store)) {
|
|
1012
|
-
if (!warnedUnmeasurable) {
|
|
1013
|
-
warnedUnmeasurable = true;
|
|
1014
|
-
log.warn({
|
|
1015
|
-
marker: "OUTBOX_HEALTH_UNMEASURABLE",
|
|
1016
|
-
outbox: name
|
|
1017
|
-
}, `outbox "${name}" store lacks countByStatus or oldestPendingAgeMs — relay stalls cannot be alerted on`);
|
|
1018
|
-
}
|
|
1019
|
-
return;
|
|
1020
|
-
}
|
|
1021
|
-
const h = await exports.health();
|
|
1022
|
-
if (h.deadLetter > 0) log.warn({
|
|
1023
|
-
marker: "OUTBOX_DEAD_LETTER",
|
|
1024
|
-
outbox: name,
|
|
1025
|
-
...h
|
|
1026
|
-
}, `outbox "${name}" has dead-lettered events — inspect and replay them`);
|
|
1027
|
-
if (h.relayLagMs !== null && h.relayLagMs >= lagUnhealthyMs) log.error({
|
|
1028
|
-
marker: "OUTBOX_RELAY_LAG",
|
|
1029
|
-
outbox: name,
|
|
1030
|
-
...h
|
|
1031
|
-
}, `outbox "${name}" relay is behind — events are committed but not delivered`);
|
|
1032
|
-
}
|
|
1033
|
-
}] : []]
|
|
1034
|
-
};
|
|
1035
|
-
}
|
|
1036
|
-
export { exponentialBackoff as i, EventOutbox as n, repositoryAsOutboxStore as r, createOutboxModule as t };
|
|
742
|
+
export { repositoryAsOutboxStore as n, exponentialBackoff as r, EventOutbox as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
|
|
3
3
|
import { toCanonicalList } from "@classytic/repo-core/pagination";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
// src/plugins/replyHelpers.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
2
|
// src/idempotency/requirement.ts
|
|
3
3
|
/** What is wrong with a route's idempotency declaration, or `undefined` when it is sound. */
|
|
4
4
|
function idempotencyConfigProblem(config) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as createTenantKeyGenerator } from "./rateLimitKey-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as createTenantKeyGenerator } from "./rateLimitKey-BWx-qep0.mjs";
|
|
3
3
|
// src/permissions/resourceRateLimit.ts
|
|
4
4
|
function decision(allowed, max, remaining, ttlSeconds) {
|
|
5
5
|
const reset = Math.max(1, ttlSeconds);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { a as runShutdown, i as runAdmittedWork, r as registerShutdownParticipant } from "./shutdown-
|
|
4
|
-
import { t as runWorkScope } from "./workScope-
|
|
5
|
-
import { t as startRenewingLease } from "./renewingLease-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
|
|
3
|
+
import { a as runShutdown, i as runAdmittedWork, r as registerShutdownParticipant } from "./shutdown-Bi19vH0z.mjs";
|
|
4
|
+
import { t as runWorkScope } from "./workScope-A3XBpYTa.mjs";
|
|
5
|
+
import { t as startRenewingLease } from "./renewingLease-DT4yLb29.mjs";
|
|
6
6
|
import fp from "fastify-plugin";
|
|
7
7
|
import { civilDateOf, civilDateToInstant, isValidTimeZone, localTimeParts } from "@classytic/primitives/timezone";
|
|
8
8
|
// src/plugins/dailyGate.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as arcLog } from "./logger-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as arcLog } from "./logger-VyMcSmVG.mjs";
|
|
3
3
|
// src/utils/schemaConverter.ts
|
|
4
4
|
/**
|
|
5
5
|
* Schema Converter — Detect-First, Convert-Only-When-Needed
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { o as toJsonSchema } from "./schemaConverter-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { o as toJsonSchema } from "./schemaConverter-CIwB5wPO.mjs";
|
|
3
3
|
// src/core/schemaIR.ts
|
|
4
4
|
/**
|
|
5
5
|
* Schema IR — one canonical representation, two adapters.
|
package/dist/schemas/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
2
|
import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
|
|
3
3
|
import { Type, Type as Type$1 } from "typebox";
|
|
4
4
|
// src/schemas/index.ts
|
package/dist/scim/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as parseJsonBody } from "../jsonBody-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as parseJsonBody } from "../jsonBody-DZGiCawf.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
// src/scim/errors.ts
|
|
5
5
|
var ScimError = class extends Error {
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-
|
|
3
|
-
import { t as createTenantKeyGenerator } from "../rateLimitKey-
|
|
4
|
-
import { t as elevation_default } from "../elevation-
|
|
5
|
-
import { t as resolveOrgFromHeader } from "../scope-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-HFFSwF_K.mjs";
|
|
3
|
+
import { t as createTenantKeyGenerator } from "../rateLimitKey-BWx-qep0.mjs";
|
|
4
|
+
import { t as elevation_default } from "../elevation-z--rFcZ5.mjs";
|
|
5
|
+
import { t as resolveOrgFromHeader } from "../scope-VMZhdkbT.mjs";
|
|
6
6
|
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader, scopeFirstCtx };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-
|
|
3
|
-
import { n as requireSingleHeaderValue } from "./headers-
|
|
4
|
-
import { n as getUserRoles } from "./userHelpers-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-DyY48oRi.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "./headers-CHSOqpcY.mjs";
|
|
4
|
+
import { n as getUserRoles } from "./userHelpers-N-k-8dNF.mjs";
|
|
5
5
|
// src/scope/resolveOrgFromHeader.ts
|
|
6
6
|
/**
|
|
7
7
|
* Create a preHandler hook that resolves org scope from a header.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
// src/utils/shutdown.ts
|
|
4
4
|
/** Stop admissions across every runtime before draining work and disposing domain engines. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { t as arcLog } from "./logger-
|
|
4
|
-
import { g as getUserId, n as PUBLIC_SCOPE } from "./types-
|
|
5
|
-
import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-
|
|
6
|
-
import { a as promoteStreamTokenToHeader } from "./streaming-
|
|
7
|
-
import { t as openSseStream } from "./sseStream-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BdTN42uL.mjs";
|
|
3
|
+
import { t as arcLog } from "./logger-VyMcSmVG.mjs";
|
|
4
|
+
import { g as getUserId, n as PUBLIC_SCOPE } from "./types-HFFSwF_K.mjs";
|
|
5
|
+
import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-BoWImS3K.mjs";
|
|
6
|
+
import { a as promoteStreamTokenToHeader } from "./streaming-CPChx3A7.mjs";
|
|
7
|
+
import { t as openSseStream } from "./sseStream-qSa-F2Qm.mjs";
|
|
8
8
|
import fp from "fastify-plugin";
|
|
9
9
|
// src/plugins/sse.ts
|
|
10
10
|
var sse_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as forwardedStreamHeaders } from "./streaming-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as forwardedStreamHeaders } from "./streaming-CPChx3A7.mjs";
|
|
3
3
|
// src/utils/sseStream.ts
|
|
4
4
|
/**
|
|
5
5
|
* Take over the reply socket and open an SSE stream. Call ONLY after every
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
2
|
// src/events/subscriberIdentity.ts
|
|
3
3
|
const SUBSCRIBER_ID = Symbol.for("@classytic/arc/subscriber-id");
|
|
4
4
|
/** Assign a deployment-stable identity for durable per-handler progress; never use an index. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { b as isElevated, c as getOrgId } from "./types-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { b as isElevated, c as getOrgId } from "./types-HFFSwF_K.mjs";
|
|
3
3
|
// src/core/tenancy.ts
|
|
4
4
|
function eventAudienceOf(scope) {
|
|
5
5
|
const tenancy = resolveTenancy({ _scope: scope }, "organizationId");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as conjoinPolicyFilters } from "./filter-merge-
|
|
3
|
-
import { d as createDomainError } from "./errors-
|
|
4
|
-
import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, v as hasOrgAccess } from "./types-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as conjoinPolicyFilters } from "./filter-merge-8glLr7Dk.mjs";
|
|
3
|
+
import { d as createDomainError } from "./errors-DyY48oRi.mjs";
|
|
4
|
+
import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, v as hasOrgAccess } from "./types-HFFSwF_K.mjs";
|
|
5
5
|
// src/permissions/tenantPreparation.ts
|
|
6
6
|
/** Tenant preparation shared by HTTP middleware and direct transport invocation. */
|
|
7
7
|
const PREPARATION = Symbol.for("arc.tenantPreparation");
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "../types-DnkIALZ8.mjs";
|
|
3
3
|
import { l as PermissionCheck, t as AnyRecord } from "../base-HXNgPQww.mjs";
|
|
4
|
-
import { F as ResourceDefinition } from "../index-
|
|
4
|
+
import { F as ResourceDefinition } from "../index-Cy2-QffW.mjs";
|
|
5
5
|
import { h as ModuleSetupContext, m as ModuleDisposer, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "../types-BeEJm-DV.mjs";
|
|
6
|
-
import "../index-
|
|
7
|
-
import { n as CreateAppOptions } from "../index-
|
|
6
|
+
import "../index-DFCCQ9AE.mjs";
|
|
7
|
+
import { n as CreateAppOptions } from "../index-D1X_C_qz.mjs";
|
|
8
8
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
9
9
|
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
10
10
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as CRUD_OPERATIONS } from "../constants-
|
|
3
|
-
import { f as BaseController } from "../plugin-
|
|
4
|
-
import { g as getUserId } from "../types-
|
|
5
|
-
import { t as defineAggregation } from "../defineAggregation-
|
|
6
|
-
import { t as defineResource } from "../defineResource-
|
|
7
|
-
import { E as requireOrgRole } from "../permissions-
|
|
8
|
-
import { h as asModulePorts, r as createApp } from "../createApp-
|
|
9
|
-
import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-
|
|
10
|
-
import { n as getModuleExports } from "../module-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CRUD_OPERATIONS } from "../constants-D-faL5SX.mjs";
|
|
3
|
+
import { f as BaseController } from "../plugin-BJcVOX5r.mjs";
|
|
4
|
+
import { g as getUserId } from "../types-HFFSwF_K.mjs";
|
|
5
|
+
import { t as defineAggregation } from "../defineAggregation-DH2L6_v9.mjs";
|
|
6
|
+
import { t as defineResource } from "../defineResource-zYCrhNaN.mjs";
|
|
7
|
+
import { E as requireOrgRole } from "../permissions-R9T2G1PH.mjs";
|
|
8
|
+
import { h as asModulePorts, r as createApp } from "../createApp-CjqhkX1x.mjs";
|
|
9
|
+
import { d as resolveModule, l as isLazyBridge, o as resolveModuleClosure } from "../plan-C0gkeABY.mjs";
|
|
10
|
+
import { n as getModuleExports } from "../module-BqPJpZ_L.mjs";
|
|
11
11
|
import { runStorageContract } from "./storageContract.mjs";
|
|
12
12
|
import Fastify from "fastify";
|
|
13
13
|
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
@@ -1566,7 +1566,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1566
1566
|
};
|
|
1567
1567
|
}
|
|
1568
1568
|
async function createTestApp(options = {}) {
|
|
1569
|
-
const { createApp } = await import("../createApp-
|
|
1569
|
+
const { createApp } = await import("../createApp-CjqhkX1x.mjs").then((n) => n.i);
|
|
1570
1570
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1571
1571
|
let dbHandle;
|
|
1572
1572
|
let dbUri;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as claimedAttempts } from "../claimed-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as claimedAttempts } from "../claimed-D0A43wjT.mjs";
|
|
3
3
|
import { OutboxConflictError, OutboxOwnershipError } from "@classytic/primitives/outbox";
|
|
4
4
|
import { afterAll, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
|
5
5
|
// src/testing/outboxStoreContract.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
|
+
import { c as declareModules, d as resolveModule, i as planModules, r as compositionProblems } from "../plan-C0gkeABY.mjs";
|
|
3
3
|
// src/testing/requiredPorts.ts
|
|
4
4
|
/**
|
|
5
5
|
* Assert a module declares EXACTLY `ports` as required, and that composing it without any one of
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.48.0 | MIT | https://classytic.com */
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
// src/utils/operationIdentity.ts
|
|
4
4
|
/** Security context included in idempotency identities across transports. */
|