@classytic/arc 2.47.0 → 2.49.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-BHKy4_Bi.mjs → EventTransport-DbHZK230.mjs} +2 -2
- package/dist/{HookSystem-CAIDVoKC.mjs → HookSystem-DMoeJ6Do.mjs} +2 -2
- package/dist/{QueryCache-DdvrGG8Q.d.mts → QueryCache-BE47tmlO.d.mts} +36 -1
- package/dist/{ResourceRegistry-23Ml6FNe.mjs → ResourceRegistry-CP-iTcKy.mjs} +2 -2
- package/dist/{acquire-DoFX06fm.mjs → acquire-CB0va87C.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-DYiubkYw.mjs → authorizationDecision-DHO94aV2.mjs} +4 -4
- package/dist/{boundedMap-CtdzpJ3X.mjs → boundedMap-C51EUUOm.mjs} +1 -1
- package/dist/{buildHandler-CARdmPNo.mjs → buildHandler-9DuwEKvr.mjs} +23 -16
- package/dist/cache/index.d.mts +2 -2
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-QRiryDLs.mjs → caching-COTX3sDa.mjs} +3 -6
- package/dist/{claimed-BLecr1j3.mjs → claimed-C7T1nHlo.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-Cx7BcnHT.mjs → constants-DOnfMd7i.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-0WyMuo0f.mjs → core-BoEdFDDw.mjs} +3 -3
- package/dist/{createActionRouter-mLAGbpDV.mjs → createActionRouter-CpTn15dm.mjs} +54 -18
- package/dist/{createAggregationRouter-BEAjn3dA.mjs → createAggregationRouter-CD_Hydp0.mjs} +13 -11
- package/dist/{createApp-QDP4vYWH.mjs → createApp-Be6XTGD9.mjs} +332 -40
- package/dist/{createMcpServer-DzXHX0SO.d.mts → createMcpServer-CS2KOVP6.d.mts} +9 -10
- package/dist/{defineAggregation-CFNfvz-C.mjs → defineAggregation-BI5pRb8c.mjs} +1 -1
- package/dist/{defineResource-BROJmhzJ.mjs → defineResource-BAzNu5Um.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-DrXeEWWk.mjs → elevation-DupGuM41.mjs} +6 -9
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-BiBXtxj4.mjs → errorHandler-DA03vRqp.mjs} +4 -7
- package/dist/{errors-DnrUChAy.mjs → errors-BpYV859Y.mjs} +1 -1
- package/dist/{eventPlugin-BhKLUe7H.mjs → eventPlugin-D7LYtYzL.mjs} +9 -13
- package/dist/{eventTypes-CCIRGakw.mjs → eventTypes-BqA-N-Uz.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-EFWxCkZ5.mjs +80 -0
- package/dist/{fields-CYdpcV73.mjs → fields-CT1Erg7o.mjs} +1 -1
- package/dist/{filter-merge-6kasezRH.mjs → filter-merge-B1eJ1pMx.mjs} +1 -1
- package/dist/{generate-DUkcbc4r.mjs → generate-Cr0ULavs.mjs} +2 -2
- package/dist/{headers-KxhrKevA.mjs → headers-D4bncIOf.mjs} +2 -2
- package/dist/{health-jkYNdobJ.mjs → health-BoFxrkJE.mjs} +1 -1
- package/dist/{health-CRJg3IIq.mjs → health-DN_pUVMX.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-CACwpktI.mjs → init-C4a24wD2.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 +6 -38
- 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 -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-CzDBkCme.mjs → jsonBody-DoTt5BS6.mjs} +2 -2
- package/dist/{keys-Cbwf6r1B.mjs → keys--l9n7aOC.mjs} +1 -1
- package/dist/{loadResources-Kr6vuljv.mjs → loadResources-rygByIQA.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-D2e0qoDR.mjs → loadResourcesFromEntry-ItNBIQ5w.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-C110X5Yz.mjs → logger-UbknHqHy.mjs} +1 -1
- package/dist/{mcpPlugin-4lIPr9OJ.mjs → mcpPlugin-CTkk4RP8.mjs} +218 -378
- package/dist/{memory-D9qkhXiB.mjs → memory-C47xVsjX.mjs} +3 -3
- package/dist/{metrics-B-qrrWfI.mjs → metrics-TJyAb1Xk.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-BD8xHgrz.mjs → module-CWiqsXnh.mjs} +1 -1
- package/dist/{multiTenant-KZj8j1uJ.d.mts → multiTenant-QtDzxx_K.d.mts} +1 -1
- package/dist/{multipartBody-qU7KCn1l.mjs → multipartBody-BdG1qbn1.mjs} +1 -1
- package/dist/{observeSend-BnPtTotW.mjs → observeSend-DrA3ADFN.mjs} +1 -1
- package/dist/{openapi-DoVa5SVP.mjs → openapi-D6MAbYpv.mjs} +7 -7
- package/dist/outbox-admin/index.d.mts +1 -1
- package/dist/outbox-admin/index.mjs +5 -5
- package/dist/{outbox-module-DyITEIop.mjs → outbox-module-D5QABFQW.mjs} +197 -28
- package/dist/{outbox-module-5Mnwcycy.d.mts → outbox-module-DzW6zwWJ.d.mts} +103 -10
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-BBy4bOGi.mjs → permissions-CFsmdYUt.mjs} +9 -9
- package/dist/{pipe-BOm2o4UA.mjs → pipe-B_05AgGt.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-DDIGwuxr.mjs → plan-BnlNJhrj.mjs} +1 -1
- package/dist/{plugin-Bn4D_0XK.mjs → plugin-CrMPYbdj.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-ClEjcKlG.mjs → pluralize-oVIxJ4CY.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-DK2jh5YR.mjs → presets-CUd3L7v6.mjs} +4 -4
- package/dist/{projection-BHH-sXyS.mjs → projection-DowJlIto.mjs} +2 -2
- package/dist/{purger.types-2wNJK_89.mjs → purger.types-BjKy8869.mjs} +1 -1
- package/dist/{queryCachePlugin-Ckqe98AM.mjs → queryCachePlugin-BvB3k_Fh.mjs} +114 -14
- package/dist/{queryCachePlugin-DYQUyeJ9.d.mts → queryCachePlugin-DrQNnGws.d.mts} +1 -1
- package/dist/{rateLimitKey-CWAjlqcN.mjs → rateLimitKey-56nH1cWN.mjs} +1 -1
- package/dist/{realtime-BIJi9USY.mjs → realtime-DXGBPtYK.mjs} +19 -22
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-y9ZA-R_J.mjs → registry-Biz-6sEZ.mjs} +2 -2
- package/dist/{relay-BNrC1CEP.mjs → relay-DEIoMntZ.mjs} +200 -99
- package/dist/{renewingLease-CS43br5E.mjs → renewingLease-BCJpW9-u.mjs} +1 -1
- package/dist/{replyHelpers-oZDzakGb.mjs → replyHelpers-DliJNb0-.mjs} +2 -2
- package/dist/{requestContext-fWb_YaV2.mjs → requestContext-tUgLt9Ky.mjs} +1 -1
- package/dist/{requirement--2hWyyHi.mjs → requirement-0l2DApiQ.mjs} +1 -1
- package/dist/{resourceRateLimit-DCWglD7V.d.mts → resourceRateLimit-BPiESPtG.d.mts} +4 -0
- package/dist/{resourceRateLimit-1WbcyMZY.mjs → resourceRateLimit-iSXF8rLH.mjs} +19 -4
- package/dist/{rolldown-runtime-yH2lHMo_.mjs → rolldown-runtime-gKJR3o-6.mjs} +1 -1
- package/dist/{routeValidator-BSlRIA5c.mjs → routeValidator-xNYA4rr1.mjs} +47 -5
- package/dist/{runtimeCapabilities-CYCEtU1W.mjs → runtimeCapabilities-BQK-GrYe.mjs} +1 -1
- package/dist/{schedules-B5WGlYIT.mjs → schedules-D9iMVFhF.mjs} +6 -9
- package/dist/{schemaConverter-DtNvts-6.mjs → schemaConverter-cIh4oX9a.mjs} +2 -2
- package/dist/{actionPermissions-DXrlWHHK.mjs → schemaIR-BsY4y9VP.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-BwVLSyNG.mjs → scope-QyhM9w8z.mjs} +4 -4
- package/dist/{shutdown-BJiJN7FT.mjs → shutdown-BM7Q0h4B.mjs} +1 -1
- package/dist/{sse-B_50llZu.mjs → sse-ofvlcTQQ.mjs} +9 -35
- package/dist/sseStats-DQqNN385.d.mts +112 -0
- package/dist/sseStream-BxQW7hPq.mjs +166 -0
- package/dist/{store-helpers-D-n5cwy5.mjs → store-helpers-_FRhHDyv.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-DGRLq-1k.mjs → streamFrames-B3ZJfI02.mjs} +19 -2
- package/dist/{streaming-Dcgqa-hH.mjs → streaming-HZr63UiM.mjs} +1 -1
- package/dist/{subscriberIdentity-C9KhIXTF.mjs → subscriberIdentity-DSgnoT_D.mjs} +1 -1
- package/dist/{tenancy-COrhjPRZ.mjs → tenancy-_ukT0oBt.mjs} +2 -2
- package/dist/{tenantPreparation-BElWHytd.mjs → tenantPreparation-DSlQI53c.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-CaxKbRk_.mjs → timing-Z8p-Zlw1.mjs} +1 -1
- package/dist/{transactionContext-8qKON0Nk.mjs → transactionContext-DBbSTfY3.mjs} +1 -1
- package/dist/{typeGuards-DVjVSsXO.mjs → typeGuards-_6nNQqgq.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-DeLiuaNv.d.mts → types-B4E0sc6D.d.mts} +20 -31
- package/dist/{types-DZHqOuJE.mjs → types-CrOlZ4rY.mjs} +4 -4
- package/dist/usage/index.d.mts +1 -1
- package/dist/usage/index.mjs +7 -7
- package/dist/{userHelpers-_eGj6kf0.mjs → userHelpers-CBKx3XJN.mjs} +1 -1
- package/dist/utils/index.d.mts +239 -34
- package/dist/utils/index.mjs +13 -13
- package/dist/{utils-Dd6MWpye.mjs → utils--HE8R8sH.mjs} +761 -8
- package/dist/{validate-BaF5wd0x.mjs → validate-BUeE2MLR.mjs} +3 -3
- package/dist/{versioning-S18y2-0C.d.mts → versioning-B07RgD27.d.mts} +2 -13
- package/dist/{versioning-DyV7mwtK.mjs → versioning-qYgqwOhL.mjs} +4 -7
- package/dist/{workScope-CmCBUmPR.mjs → workScope-C-1QHNmV.mjs} +2 -2
- package/llms.txt +2 -2
- package/package.json +42 -50
- 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/mcp-custom-tools.md +1 -1
- package/skills/arc/references/mcp-setup.md +11 -10
- package/skills/arc/references/mcp-testing.md +3 -3
- 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-uS_RHqa3.mjs +0 -108
- package/dist/sseStream-BjSo9Ult.mjs +0 -57
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-gKJR3o-6.mjs";
|
|
3
|
+
import { n as declareRuntimeCapability } from "./runtimeCapabilities-BQK-GrYe.mjs";
|
|
4
|
+
import { t as hasEvents } from "./typeGuards-_6nNQqgq.mjs";
|
|
5
|
+
import { t as MemoryCacheStore } from "./memory-C47xVsjX.mjs";
|
|
6
|
+
import { i as versionKey, r as tagVersionKey } from "./keys--l9n7aOC.mjs";
|
|
7
7
|
import fp from "fastify-plugin";
|
|
8
8
|
// src/cache/QueryCache.ts
|
|
9
9
|
const MISS = Object.freeze({
|
|
@@ -12,15 +12,31 @@ const MISS = Object.freeze({
|
|
|
12
12
|
});
|
|
13
13
|
var QueryCache = class {
|
|
14
14
|
store;
|
|
15
|
-
|
|
15
|
+
onStoreError;
|
|
16
|
+
/** Entry deletes the store refused: read as a miss here until replayed. */
|
|
17
|
+
pendingDeletes = /* @__PURE__ */ new Set();
|
|
18
|
+
/** Version keys whose bump the store refused: bumped once each when it answers again. */
|
|
19
|
+
pendingBumps = /* @__PURE__ */ new Set();
|
|
20
|
+
failing = false;
|
|
21
|
+
flushing;
|
|
22
|
+
constructor(store, options = {}) {
|
|
16
23
|
this.store = store;
|
|
24
|
+
this.onStoreError = options.onStoreError;
|
|
17
25
|
}
|
|
18
26
|
async get(key) {
|
|
19
|
-
|
|
27
|
+
if (!await this.recovered() || this.pendingDeletes.has(key)) return MISS;
|
|
28
|
+
let envelope;
|
|
29
|
+
try {
|
|
30
|
+
envelope = await this.store.get(key);
|
|
31
|
+
this.ok();
|
|
32
|
+
} catch (err) {
|
|
33
|
+
this.failed(err, "get");
|
|
34
|
+
return MISS;
|
|
35
|
+
}
|
|
20
36
|
if (!envelope?.createdAt) return MISS;
|
|
21
37
|
const now = Date.now();
|
|
22
38
|
if (now >= envelope.expiresAt) {
|
|
23
|
-
await this.
|
|
39
|
+
await this.invalidate(key);
|
|
24
40
|
return MISS;
|
|
25
41
|
}
|
|
26
42
|
if (now < envelope.staleAfter) return {
|
|
@@ -45,14 +61,27 @@ var QueryCache = class {
|
|
|
45
61
|
expiresAt: now + totalTtlSec * 1e3,
|
|
46
62
|
tags: config.tags ?? []
|
|
47
63
|
};
|
|
48
|
-
|
|
64
|
+
try {
|
|
65
|
+
await this.store.set(key, envelope, totalTtlSec);
|
|
66
|
+
this.pendingDeletes.delete(key);
|
|
67
|
+
this.ok();
|
|
68
|
+
} catch (err) {
|
|
69
|
+
this.failed(err, "set");
|
|
70
|
+
}
|
|
49
71
|
}
|
|
50
72
|
async invalidate(key) {
|
|
51
|
-
|
|
73
|
+
try {
|
|
74
|
+
await this.store.delete(key);
|
|
75
|
+
this.pendingDeletes.delete(key);
|
|
76
|
+
this.ok();
|
|
77
|
+
} catch (err) {
|
|
78
|
+
this.pendingDeletes.add(key);
|
|
79
|
+
this.failed(err, "invalidate");
|
|
80
|
+
}
|
|
52
81
|
}
|
|
53
82
|
/** Get current version for a resource (defaults to 0 if not set) */
|
|
54
83
|
async getResourceVersion(resource) {
|
|
55
|
-
return
|
|
84
|
+
return this.readVersion(versionKey(resource));
|
|
56
85
|
}
|
|
57
86
|
/** Bump resource version — orphans all cached queries for this resource */
|
|
58
87
|
async bumpResourceVersion(resource) {
|
|
@@ -60,12 +89,32 @@ var QueryCache = class {
|
|
|
60
89
|
}
|
|
61
90
|
/** Get current version for a tag */
|
|
62
91
|
async getTagVersion(tag) {
|
|
63
|
-
return
|
|
92
|
+
return this.readVersion(tagVersionKey(tag));
|
|
64
93
|
}
|
|
65
94
|
/** Bump tag version — orphans all cached queries tagged with this tag */
|
|
66
95
|
async bumpTagVersion(tag) {
|
|
67
96
|
await this.bumpVersion(tagVersionKey(tag));
|
|
68
97
|
}
|
|
98
|
+
/** The store is failing, or holds invalidations it refused: reads go to the source. */
|
|
99
|
+
get degraded() {
|
|
100
|
+
return this.failing || this.pendingDeletes.size > 0 || this.pendingBumps.size > 0;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A version the store cannot give is 0: entries are not read while it fails either, and
|
|
104
|
+
* a version bump it refused is replayed before any version is read again (`recovered`),
|
|
105
|
+
* so an entry cached before the outage is never served past an invalidation.
|
|
106
|
+
*/
|
|
107
|
+
async readVersion(key) {
|
|
108
|
+
if (!await this.recovered()) return 0;
|
|
109
|
+
try {
|
|
110
|
+
const ver = await this.store.get(key);
|
|
111
|
+
this.ok();
|
|
112
|
+
return ver ?? 0;
|
|
113
|
+
} catch (err) {
|
|
114
|
+
this.failed(err, "version");
|
|
115
|
+
return 0;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
69
118
|
/**
|
|
70
119
|
* Version-bump semantics:
|
|
71
120
|
*
|
|
@@ -87,8 +136,20 @@ var QueryCache = class {
|
|
|
87
136
|
* outlive that reset and entry TTLs are minutes-scale (staleTime +
|
|
88
137
|
* gcTime). The read-modify-write fallback uses plain `set`, which
|
|
89
138
|
* refreshes the TTL per bump — strictly longer-lived, equally safe.
|
|
139
|
+
*
|
|
140
|
+
* A bump the store refuses is remembered and replayed once it answers.
|
|
90
141
|
*/
|
|
91
142
|
async bumpVersion(key) {
|
|
143
|
+
try {
|
|
144
|
+
await this.rawBump(key);
|
|
145
|
+
this.pendingBumps.delete(key);
|
|
146
|
+
this.ok();
|
|
147
|
+
} catch (err) {
|
|
148
|
+
this.pendingBumps.add(key);
|
|
149
|
+
this.failed(err, "bump");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async rawBump(key) {
|
|
92
153
|
if (typeof this.store.increment === "function") {
|
|
93
154
|
await this.store.increment(key, 1, VERSION_TTL_SECONDS);
|
|
94
155
|
return;
|
|
@@ -97,6 +158,42 @@ var QueryCache = class {
|
|
|
97
158
|
const next = Math.max(Date.now(), (current ?? 0) + 1);
|
|
98
159
|
await this.store.set(key, next, VERSION_TTL_SECONDS);
|
|
99
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Replay refused invalidations before a read; `false` while the store still refuses a
|
|
163
|
+
* version bump (the caller then answers from the source). One replay at a time.
|
|
164
|
+
*/
|
|
165
|
+
async recovered() {
|
|
166
|
+
if (this.pendingBumps.size === 0 && this.pendingDeletes.size === 0) return true;
|
|
167
|
+
this.flushing ??= this.flush().finally(() => {
|
|
168
|
+
this.flushing = void 0;
|
|
169
|
+
});
|
|
170
|
+
await this.flushing;
|
|
171
|
+
return this.pendingBumps.size === 0;
|
|
172
|
+
}
|
|
173
|
+
async flush() {
|
|
174
|
+
try {
|
|
175
|
+
for (const key of [...this.pendingBumps]) {
|
|
176
|
+
await this.rawBump(key);
|
|
177
|
+
this.pendingBumps.delete(key);
|
|
178
|
+
}
|
|
179
|
+
for (const key of [...this.pendingDeletes]) {
|
|
180
|
+
await this.store.delete(key);
|
|
181
|
+
this.pendingDeletes.delete(key);
|
|
182
|
+
}
|
|
183
|
+
this.ok();
|
|
184
|
+
} catch (err) {
|
|
185
|
+
this.failed(err, "replay");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
ok() {
|
|
189
|
+
this.failing = false;
|
|
190
|
+
}
|
|
191
|
+
failed(err, operation) {
|
|
192
|
+
if (!this.failing) try {
|
|
193
|
+
this.onStoreError?.(err, operation);
|
|
194
|
+
} catch {}
|
|
195
|
+
this.failing = true;
|
|
196
|
+
}
|
|
100
197
|
};
|
|
101
198
|
/** See `bumpVersion` — effectively non-expiring, refreshed on every bump. */
|
|
102
199
|
const VERSION_TTL_SECONDS = 31536e3;
|
|
@@ -110,7 +207,10 @@ const CRUD_SUFFIXES = /* @__PURE__ */ new Set([
|
|
|
110
207
|
const queryCachePluginImpl = async (fastify, opts = {}) => {
|
|
111
208
|
const ownsStore = opts.store === void 0;
|
|
112
209
|
const store = opts.store ?? new MemoryCacheStore();
|
|
113
|
-
const queryCache = new QueryCache(store)
|
|
210
|
+
const queryCache = new QueryCache(store, { onStoreError: (err, operation) => fastify.log.warn({
|
|
211
|
+
err: err instanceof Error ? err.message : String(err),
|
|
212
|
+
operation
|
|
213
|
+
}, "[arc] query cache store unavailable: reading from the source until it answers again") });
|
|
114
214
|
declareRuntimeCapability(fastify, {
|
|
115
215
|
subsystem: "cache.query",
|
|
116
216
|
durability: store instanceof MemoryCacheStore ? "memory" : "shared",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { r as CacheStore } from "./interface-WR1U0K7t.mjs";
|
|
3
|
-
import { i as QueryCache } from "./QueryCache-
|
|
3
|
+
import { i as QueryCache } from "./QueryCache-BE47tmlO.mjs";
|
|
4
4
|
import { FastifyPluginAsync } from "fastify";
|
|
5
5
|
interface QueryCachePluginOptions {
|
|
6
6
|
/** CacheStore instance. Default: MemoryCacheStore with default options. */
|
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import { t as applyFieldReadPermissions } from "./fields-
|
|
8
|
-
import {
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-gKJR3o-6.mjs";
|
|
3
|
+
import { n as arcRouteValidatorCompiler } from "./routeValidator-xNYA4rr1.mjs";
|
|
4
|
+
import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-_ukT0oBt.mjs";
|
|
5
|
+
import { t as arcLog } from "./logger-UbknHqHy.mjs";
|
|
6
|
+
import { n as evaluateAndApplyPermission } from "./authorizationDecision-DHO94aV2.mjs";
|
|
7
|
+
import { t as applyFieldReadPermissions } from "./fields-CT1Erg7o.mjs";
|
|
8
|
+
import { n as getUserRoles } from "./userHelpers-CBKx3XJN.mjs";
|
|
9
|
+
import { n as simpleEqualityMatcher, t as STREAM_FRAMES } from "./streamFrames-B3ZJfI02.mjs";
|
|
10
|
+
import { a as registerSseStats, r as openSseStream } from "./sseStream-BxQW7hPq.mjs";
|
|
11
|
+
import { a as promoteStreamTokenToHeader } from "./streaming-HZr63UiM.mjs";
|
|
12
12
|
import fp from "fastify-plugin";
|
|
13
13
|
// src/plugins/realtime.ts
|
|
14
|
-
var realtime_exports = /* @__PURE__ */ __exportAll({
|
|
15
|
-
DEFAULT_MAX_CONNECTION_MS: () => DEFAULT_MAX_CONNECTION_MS,
|
|
16
|
-
buildChangeFrame: () => buildChangeFrame,
|
|
17
|
-
connectionDeadlineMs: () => connectionDeadlineMs,
|
|
18
|
-
default: () => realtime_default,
|
|
19
|
-
realtimePlugin: () => realtimePlugin,
|
|
20
|
-
resolveDelivery: () => resolveDelivery,
|
|
21
|
-
resolveRowMatcher: () => resolveRowMatcher
|
|
22
|
-
});
|
|
14
|
+
var realtime_exports = /* @__PURE__ */ __exportAll({ default: () => realtime_default });
|
|
23
15
|
const log = arcLog("realtime");
|
|
24
16
|
const CHANGE_OPERATIONS = [
|
|
25
17
|
"created",
|
|
@@ -166,6 +158,10 @@ const realtimePlugin = async (fastify, opts = {}) => {
|
|
|
166
158
|
}
|
|
167
159
|
if (!path.includes(":resource")) throw new Error(`[arc-realtime] path must contain ':resource' (got '${path}')`);
|
|
168
160
|
const activeConnections = /* @__PURE__ */ new Set();
|
|
161
|
+
registerSseStats(fastify, () => ({
|
|
162
|
+
connections: activeConnections.size,
|
|
163
|
+
keys: 0
|
|
164
|
+
}));
|
|
169
165
|
const isProtected = (entry) => {
|
|
170
166
|
const listCheck = entry.permissions?.list;
|
|
171
167
|
return typeof listCheck === "function" && listCheck._isPublic !== true;
|
|
@@ -291,9 +287,10 @@ const realtimePlugin = async (fastify, opts = {}) => {
|
|
|
291
287
|
stream.onCleanup(unsub);
|
|
292
288
|
}
|
|
293
289
|
}
|
|
294
|
-
stream.write(
|
|
290
|
+
stream.write(STREAM_FRAMES.READY, JSON.stringify({
|
|
295
291
|
resources: subscriptions.map((s) => s.name),
|
|
296
|
-
operations: [...operations]
|
|
292
|
+
operations: [...operations],
|
|
293
|
+
resumed: false
|
|
297
294
|
}));
|
|
298
295
|
};
|
|
299
296
|
const lookupEntry = (name) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
3
|
-
import "../
|
|
2
|
+
import "../fastify-augmentation-baQc3MaO.mjs";
|
|
3
|
+
import { F as ResourceDefinition, G as CrudRouteKey, M as ResourceRegistry, N as RouteRow, S as IntrospectionPluginOptions, V as ResolvedTenantPurge, j as RegisterOptions, o as RegistryEntry } from "../index-DLCcLUQT.mjs";
|
|
4
4
|
import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
|
|
5
5
|
import { FastifyPluginAsync } from "fastify";
|
|
6
6
|
interface AssertNoTenantDataOptions {
|
package/dist/registry/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as getCascadingResources, i as cascadeDeleteForOrganization, n as buildResourceManifestFromRegistry, o as getCascadingResourcesWithMetadata, r as introspectionPlugin_default, s as assertNoTenantData, t as buildResourceManifest } from "../registry-
|
|
3
|
-
import { t as ResourceRegistry } from "../ResourceRegistry-
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as getCascadingResources, i as cascadeDeleteForOrganization, n as buildResourceManifestFromRegistry, o as getCascadingResourcesWithMetadata, r as introspectionPlugin_default, s as assertNoTenantData, t as buildResourceManifest } from "../registry-Biz-6sEZ.mjs";
|
|
3
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-CP-iTcKy.mjs";
|
|
4
4
|
export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as CRUD_OPERATIONS } from "./constants-
|
|
1
|
+
/*! @classytic/arc v2.49.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CRUD_OPERATIONS } from "./constants-DOnfMd7i.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
// src/registry/assertNoTenantData.ts
|
|
5
5
|
/**
|