@classytic/arc 2.43.0 → 2.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{EventTransport-tzA7CAB4.mjs → EventTransport-DZWDsaPa.mjs} +2 -2
- package/dist/{HookSystem-B6UaKRbF.mjs → HookSystem-yjEgn7Cm.mjs} +2 -2
- package/dist/{ResourceRegistry-CuCARu2B.mjs → ResourceRegistry-DJxHUpE4.mjs} +2 -2
- package/dist/acquire-BozJ-9yt.mjs +35 -0
- package/dist/{actionPermissions-BotX1YOa.mjs → actionPermissions-5N04zBL4.mjs} +13 -17
- package/dist/audit/index.d.mts +6 -6
- package/dist/audit/index.mjs +4 -4
- package/dist/auth/audit.d.mts +8 -8
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +5 -5
- package/dist/auth/index.mjs +11 -8
- package/dist/auth/redis-session.d.mts +4 -5
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-DQYrkl5f.mjs → authorizationDecision-wX3SA9w_.mjs} +4 -4
- package/dist/{boundedMap-BULzfXYU.mjs → boundedMap-DWiKW7lP.mjs} +1 -1
- package/dist/{buildHandler-CRQ8EcX5.mjs → buildHandler-Bswu_vNb.mjs} +4 -4
- package/dist/cache/index.d.mts +9 -9
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-Cc2M1DwO.mjs → caching-Drp68DIS.mjs} +2 -2
- package/dist/{claimed-B10RTfkM.mjs → claimed-DYvQoZLv.mjs} +1 -1
- package/dist/cleanup/index.d.mts +14 -14
- package/dist/cleanup/index.mjs +4 -4
- package/dist/cli/commands/describe.d.mts +5 -5
- package/dist/cli/commands/describe.mjs +3 -3
- package/dist/cli/commands/docs.d.mts +2 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.d.mts +2 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -3
- package/dist/cli/commands/init.mjs +2 -3
- package/dist/cli/commands/introspect.d.mts +2 -3
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-Cu7Mx7_U.mjs → constants-B2QHb6u6.mjs} +1 -1
- package/dist/context/index.d.mts +9 -9
- package/dist/context/index.mjs +5 -5
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +8 -8
- package/dist/{core-Cb0LjccA.mjs → core-COcqo0Cp.mjs} +13 -4
- package/dist/{createActionRouter-xjqonMRO.mjs → createActionRouter-zG13rpPJ.mjs} +18 -8
- package/dist/{createAggregationRouter-zRYWw_5D.mjs → createAggregationRouter-CWRz96Vr.mjs} +7 -7
- package/dist/{createApp-D-953ZAq.mjs → createApp-BGLYtErt.mjs} +34 -32
- package/dist/{createMcpServer-C9cxS8zt.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
- package/dist/{defineAggregation-Bm8RjMbq.mjs → defineAggregation--3xguLkk.mjs} +1 -1
- package/dist/{defineResource-DIC7JZGU.mjs → defineResource-gUp9ug66.mjs} +7 -7
- package/dist/discovery/index.d.mts +6 -7
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +3 -3
- package/dist/docs/index.mjs +3 -3
- package/dist/{elevation-DG8SrLN-.mjs → elevation-BG4gnMsJ.mjs} +5 -5
- package/dist/encryption/index.d.mts +5 -5
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-BnfDviL1.mjs → errorHandler-COHw3N1b.mjs} +3 -3
- package/dist/{errors-CtrywMHP.mjs → errors-CW4anJBy.mjs} +1 -1
- package/dist/{eventPlugin-Q6BhzHzs.mjs → eventPlugin-BweHAVws.mjs} +8 -8
- package/dist/{eventTypes-Cdhm6ZlV.mjs → eventTypes-N4-omQFR.mjs} +2 -2
- package/dist/events/index.d.mts +14 -14
- package/dist/events/index.mjs +7 -7
- package/dist/events/transports/redis-stream-entry.mjs +4 -4
- package/dist/events/transports/redis.d.mts +4 -5
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.d.mts +16 -16
- package/dist/factory/index.mjs +6 -6
- package/dist/{fastify-augmentation-DhUJ-mvo.d.mts → fastify-augmentation-DRlCIWE9.d.mts} +2 -2
- package/dist/{fields-ToPYpMqS.mjs → fields-A5crhsJb.mjs} +1 -1
- package/dist/{filter-merge-IpGywvym.mjs → filter-merge-DGM-GQ1J.mjs} +1 -1
- package/dist/{generate-DRTkLlIl.mjs → generate-BXKo2Gc8.mjs} +2 -2
- package/dist/{headers-BbkIF6vA.mjs → headers-DKZQKL-Z.mjs} +2 -2
- package/dist/{health-D-Ft6JM6.mjs → health-BYAwA6YS.mjs} +1 -1
- package/dist/{health-DqbsG-_w.mjs → health-CrqUp3sz.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -3
- package/dist/idempotency/index.d.mts +8 -6
- package/dist/idempotency/index.mjs +108 -46
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +30 -2
- package/dist/{index-CRoPtISf.d.mts → index-Beg3aNnK.d.mts} +3 -31
- package/dist/{index-C8zVGYsk.d.mts → index-BkV55WlV.d.mts} +3 -3
- package/dist/{index-JdbZAIsm.d.mts → index-CUJvoyw3.d.mts} +1 -1
- package/dist/{index-mqaqZNpe.d.mts → index-WH7xgvxS.d.mts} +52 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +11 -11
- package/dist/{init-B_oUYDXI.mjs → init-BPzK5Lnr.mjs} +1 -1
- package/dist/integrations/event-gateway.d.mts +3 -4
- 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 +36 -36
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +8 -9
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.d.mts +12 -13
- package/dist/integrations/streamline.mjs +18 -4
- package/dist/integrations/webhooks.d.mts +23 -23
- package/dist/integrations/webhooks.mjs +3 -3
- package/dist/integrations/websocket-pushref-redis.d.mts +4 -5
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.d.mts +4 -5
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{interface-C0395yUN.d.mts → interface-JJzwH4Ro.d.mts} +22 -2
- package/dist/{jsonBody-B4YVGcql.mjs → jsonBody-YIq-vGLv.mjs} +2 -2
- package/dist/{keys-B2KtgMLJ.mjs → keys-CpoiZ8hU.mjs} +1 -1
- package/dist/{loadResources-Dn4lalw2.mjs → loadResources-6jO52-RR.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-3sLYbuse.mjs → loadResourcesFromEntry-MP8xEppu.mjs} +2 -2
- package/dist/logger/index.d.mts +9 -10
- package/dist/logger/index.mjs +2 -3
- package/dist/{logger-DXjfIqjV.mjs → logger-D4V1zGLI.mjs} +1 -1
- package/dist/{mcpPlugin-C08HalN5.mjs → mcpPlugin-srPc7ItN.mjs} +42 -29
- package/dist/{memory-9Cp7611C.mjs → memory-CTa5pOCW.mjs} +3 -3
- package/dist/{metrics-CWI11eRu.mjs → metrics-DsZrvnpB.mjs} +3 -3
- package/dist/middleware/index.d.mts +5 -5
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.d.mts +13 -13
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-BSvOQC7E.mjs → module--L0iBIZz.mjs} +1 -1
- package/dist/mongodb-memory-server-CHhYSq5y.mjs +35539 -0
- package/dist/mongoose-CYJCLyi-.mjs +67451 -0
- package/dist/{multiTenant-cY0FkDiA.d.mts → multiTenant-CAtYlW6H.d.mts} +1 -1
- package/dist/{multipartBody-CXM2a-Dy.mjs → multipartBody-Cc7eZ9cq.mjs} +1 -1
- package/dist/node-D8UZv_8c.mjs +41236 -0
- package/dist/{openapi-DT_G4VhY.mjs → openapi-CMegfsm8.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +2 -2
- package/dist/outbox-admin/index.mjs +5 -5
- package/dist/{outbox-module-Bjgzl6tg.mjs → outbox-module-Ryk270jd.mjs} +9 -9
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-Cm0uYHvd.mjs → permissions-C5ijIz5Q.mjs} +9 -9
- package/dist/{pipe-BqeGT6UO.mjs → pipe-D81zMtWs.mjs} +2 -2
- package/dist/pipeline/index.d.mts +7 -7
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-FVR6LP59.mjs → plan-CJGMKoui.mjs} +1 -1
- package/dist/{plugin-BccET1tL.mjs → plugin-DALd9dcF.mjs} +39 -27
- package/dist/plugins/index.d.mts +7 -7
- package/dist/plugins/index.mjs +17 -17
- package/dist/plugins/response-cache.d.mts +5 -6
- package/dist/plugins/response-cache.mjs +4 -4
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-CVIOcgMF.mjs → pluralize-COUNYo3d.mjs} +1 -1
- package/dist/presets/filesUpload.d.mts +7 -7
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +14 -14
- 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 +8 -9
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-Cpvj6fGO.mjs → presets-CONf2Qem.mjs} +4 -4
- package/dist/{projection-Ce4aQhQk.mjs → projection-wFoLqdss.mjs} +2 -2
- package/dist/{queryCachePlugin-CFWNH8aT.mjs → queryCachePlugin-BATECpyh.mjs} +6 -6
- package/dist/{rateLimitKey-C4O-kPm0.mjs → rateLimitKey-DVEZ_UpV.mjs} +1 -1
- package/dist/{realtime-DmPE9S54.mjs → realtime-xyubMKSB.mjs} +11 -11
- package/dist/{redis-vLvtcGy_.d.mts → redis-BDgv9Glw.d.mts} +5 -1
- package/dist/registry/index.d.mts +9 -9
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-Bcz9G1bh.mjs → registry-Bdzg-hdm.mjs} +5 -4
- package/dist/{renewingLease-qODa7KJQ.mjs → renewingLease-BFJxGPuh.mjs} +1 -1
- package/dist/{replyHelpers-CG_VtVgS.mjs → replyHelpers-Bnc6lJyy.mjs} +2 -2
- package/dist/{requestContext-Dsu9P1bV.mjs → requestContext-C10UeFe5.mjs} +1 -1
- package/dist/{requirement-KDdoRcOP.mjs → requirement-Bu50QALH.mjs} +1 -1
- package/dist/{resourceRateLimit-dSjVr1pk.mjs → resourceRateLimit-urWPJxrt.mjs} +2 -2
- package/dist/rolldown-runtime-MYrLNGnq.mjs +45 -0
- package/dist/{routeValidator-D36SW8qt.mjs → routeValidator-DHtpzrzk.mjs} +1 -1
- package/dist/{runtimeCapabilities-0tccjRlj.mjs → runtimeCapabilities-DIMKMV2G.mjs} +1 -1
- package/dist/{schedules-C-OpmHBq.mjs → schedules-CKTs5ys8.mjs} +5 -5
- package/dist/{schemaConverter-BORek3O-.mjs → schemaConverter-BVjkQ5DD.mjs} +2 -2
- package/dist/{schemaIR-C7Vbp71I.mjs → schemaIR-BA0Hb21Y.mjs} +2 -2
- package/dist/schemas/index.d.mts +10 -10
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.d.mts +13 -13
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +3 -3
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-DQthe88b.mjs → scope-DINaj7Ax.mjs} +4 -4
- package/dist/{shutdown-MqA81z_P.mjs → shutdown-LpLMH8T1.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-auW8QjXN.mjs → simpleEqualityMatcher-DbwIM1f1.mjs} +1 -1
- package/dist/{sse-CYzQBVFe.mjs → sse-BzJFPX_1.mjs} +7 -7
- package/dist/{sseStream-B5_Afiqn.mjs → sseStream-DQChzGTs.mjs} +2 -2
- package/dist/{store-helpers-BOzk-CuX.mjs → store-helpers-Coj9RhOZ.mjs} +1 -1
- package/dist/{streaming-DjTQhZrN.mjs → streaming-JzB5CAga.mjs} +1 -1
- package/dist/{subscriberIdentity-CW39uA8G.mjs → subscriberIdentity-DeyppIif.mjs} +1 -1
- package/dist/{tenancy--ed9eH_z.mjs → tenancy-DxV8OuX2.mjs} +2 -2
- package/dist/{tenantPreparation-BKon6Yox.mjs → tenantPreparation-CBvvAcAj.mjs} +4 -4
- package/dist/testing/cleanupStoreContract.d.mts +4 -5
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +35 -35
- package/dist/testing/index.mjs +16 -15
- package/dist/testing/outboxStoreContract.d.mts +4 -5
- package/dist/testing/outboxStoreContract.mjs +2 -2
- package/dist/testing/requiredPorts.d.mts +4 -5
- package/dist/testing/requiredPorts.mjs +2 -2
- package/dist/testing/storageContract.d.mts +4 -5
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{timing-qczZ0YC-.mjs → timing-CntavTlR.mjs} +1 -1
- package/dist/{transactionContext-DjFkrNG6.mjs → transactionContext-orvnGu4F.mjs} +1 -1
- package/dist/{typeGuards-CySF12G-.mjs → typeGuards-kEaP_WmO.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-B4Aq4Sdj.d.mts → types-D3Ixsh00.d.mts} +1 -1
- package/dist/{types-Bk9NOgOC.mjs → types-fvO6Ovzx.mjs} +4 -4
- package/dist/usage/index.d.mts +4 -4
- package/dist/usage/index.mjs +4 -4
- package/dist/{userHelpers-aklawRaK.mjs → userHelpers-C76zD5pa.mjs} +1 -1
- package/dist/utils/index.d.mts +47 -47
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-ec1oTo1n.mjs → utils-BpkVZ8rB.mjs} +4 -4
- package/dist/{validate-9yzHC1e2.mjs → validate-CWp-lsrm.mjs} +3 -3
- package/dist/{versioning-fhhWHV74.mjs → versioning-CHhL9P3o.mjs} +3 -3
- package/dist/{workScope-zpPyge4t.mjs → workScope-n9a7d_lZ.mjs} +2 -2
- package/package.json +45 -51
- package/dist/rolldown-runtime-D1w9Y1VJ.mjs +0 -15
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { d as createDomainError } from "../errors-
|
|
3
|
-
import { n as requireSingleHeaderValue } from "../headers-
|
|
4
|
-
import { i as requestRequiresIdempotencyKey, n as idempotencyConfigProblem, r as requestDedupedByHandler, t as declaresIdempotencyFence } from "../requirement-
|
|
5
|
-
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-
|
|
6
|
-
import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "../timing-
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { d as createDomainError } from "../errors-CW4anJBy.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "../headers-DKZQKL-Z.mjs";
|
|
4
|
+
import { i as requestRequiresIdempotencyKey, n as idempotencyConfigProblem, r as requestDedupedByHandler, t as declaresIdempotencyFence } from "../requirement-Bu50QALH.mjs";
|
|
5
|
+
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "../store-helpers-Coj9RhOZ.mjs";
|
|
6
|
+
import { n as createIdempotencyResult, r as operationIdentity, t as resolveIdempotencyTiming } from "../timing-CntavTlR.mjs";
|
|
7
|
+
import { n as acquireIdempotencyKey, r as releaseIdempotencyLock } from "../acquire-BozJ-9yt.mjs";
|
|
7
8
|
import { ARC_ERROR_CODES } from "@classytic/repo-core/errors";
|
|
8
9
|
import { and, eq, exists, gt, lt, or, startsWith } from "@classytic/repo-core/filter";
|
|
9
10
|
import { createHash } from "node:crypto";
|
|
@@ -64,22 +65,12 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
|
|
|
64
65
|
}
|
|
65
66
|
return {
|
|
66
67
|
name: "repository",
|
|
68
|
+
completionReleasesLock: true,
|
|
67
69
|
async get(key) {
|
|
68
70
|
const doc = await safeGetOne(eq(idField, key));
|
|
69
71
|
if (!doc) return void 0;
|
|
70
72
|
assertKeyIdentity("get", doc, key);
|
|
71
|
-
|
|
72
|
-
if (new Date(doc.expiresAt) < /* @__PURE__ */ new Date()) return void 0;
|
|
73
|
-
return {
|
|
74
|
-
key,
|
|
75
|
-
...doc.result.requestFingerprint ? { requestFingerprint: doc.result.requestFingerprint } : {},
|
|
76
|
-
statusCode: doc.result.statusCode,
|
|
77
|
-
headers: doc.result.headers,
|
|
78
|
-
body: doc.result.body,
|
|
79
|
-
...doc.result.bodyEncoding ? { bodyEncoding: doc.result.bodyEncoding } : {},
|
|
80
|
-
createdAt: new Date(doc.createdAt),
|
|
81
|
-
expiresAt: new Date(doc.expiresAt)
|
|
82
|
-
};
|
|
73
|
+
return completedResult(doc, key);
|
|
83
74
|
},
|
|
84
75
|
async set(key, result) {
|
|
85
76
|
const doc = await r.findOneAndUpdate(eq(idField, key), update({
|
|
@@ -103,21 +94,66 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
|
|
|
103
94
|
if (doc) assertKeyIdentity("set", doc, key);
|
|
104
95
|
},
|
|
105
96
|
async setIfLocked(key, requestId, result) {
|
|
106
|
-
const doc = await r.findOneAndUpdate(and(eq(idField, key), eq("lock.requestId", requestId), gt("lock.expiresAt", /* @__PURE__ */ new Date())), update({
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
const doc = await r.findOneAndUpdate(and(eq(idField, key), eq("lock.requestId", requestId), gt("lock.expiresAt", /* @__PURE__ */ new Date())), update({
|
|
98
|
+
set: {
|
|
99
|
+
result: {
|
|
100
|
+
statusCode: result.statusCode,
|
|
101
|
+
headers: result.headers,
|
|
102
|
+
body: result.body,
|
|
103
|
+
...result.requestFingerprint ? { requestFingerprint: result.requestFingerprint } : {},
|
|
104
|
+
...result.bodyEncoding ? { bodyEncoding: result.bodyEncoding } : {}
|
|
105
|
+
},
|
|
106
|
+
createdAt: result.createdAt,
|
|
107
|
+
expiresAt: result.expiresAt
|
|
113
108
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
} }), { returnDocument: "after" });
|
|
109
|
+
unset: ["lock"]
|
|
110
|
+
}), { returnDocument: "after" });
|
|
117
111
|
if (!doc) return false;
|
|
118
112
|
assertKeyIdentity("setIfLocked", doc, key);
|
|
119
113
|
return true;
|
|
120
114
|
},
|
|
115
|
+
async acquire(key, requestId, lockTtlMs) {
|
|
116
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
117
|
+
const now = /* @__PURE__ */ new Date();
|
|
118
|
+
let doc = null;
|
|
119
|
+
try {
|
|
120
|
+
doc = await r.findOneAndUpdate(and(eq(idField, key), or(exists("result.statusCode", false), lt("expiresAt", now)), or(exists("lock", false), lt("lock.expiresAt", now))), update({
|
|
121
|
+
set: {
|
|
122
|
+
lock: {
|
|
123
|
+
requestId,
|
|
124
|
+
expiresAt: new Date(now.getTime() + lockTtlMs)
|
|
125
|
+
},
|
|
126
|
+
expiresAt: new Date(now.getTime() + defaultTtlMs)
|
|
127
|
+
},
|
|
128
|
+
unset: ["result"],
|
|
129
|
+
setOnInsert: {
|
|
130
|
+
[idField]: key,
|
|
131
|
+
createdAt: now
|
|
132
|
+
}
|
|
133
|
+
}), {
|
|
134
|
+
upsert: true,
|
|
135
|
+
returnDocument: "after"
|
|
136
|
+
});
|
|
137
|
+
} catch (err) {
|
|
138
|
+
if (!isDuplicateKeyError(err)) throw err;
|
|
139
|
+
}
|
|
140
|
+
if (doc) {
|
|
141
|
+
assertKeyIdentity("acquire", doc, key);
|
|
142
|
+
return { status: "acquired" };
|
|
143
|
+
}
|
|
144
|
+
const existing = await safeGetOne(eq(idField, key));
|
|
145
|
+
if (existing) {
|
|
146
|
+
assertKeyIdentity("acquire", existing, key);
|
|
147
|
+
const result = completedResult(existing, key);
|
|
148
|
+
if (result) return {
|
|
149
|
+
status: "completed",
|
|
150
|
+
result
|
|
151
|
+
};
|
|
152
|
+
if (existing.lock && new Date(existing.lock.expiresAt) > /* @__PURE__ */ new Date()) return { status: "locked" };
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return { status: "locked" };
|
|
156
|
+
},
|
|
121
157
|
async tryLock(key, requestId, ttlMs) {
|
|
122
158
|
const now = /* @__PURE__ */ new Date();
|
|
123
159
|
const lockExpiresAt = new Date(now.getTime() + ttlMs);
|
|
@@ -175,6 +211,21 @@ function repositoryAsIdempotencyStore(repository, defaultTtlMs) {
|
|
|
175
211
|
async close() {}
|
|
176
212
|
};
|
|
177
213
|
}
|
|
214
|
+
/** The row's unexpired completed response, or `undefined`. */
|
|
215
|
+
function completedResult(doc, key) {
|
|
216
|
+
if (!isCompleted(doc)) return void 0;
|
|
217
|
+
if (new Date(doc.expiresAt) < /* @__PURE__ */ new Date()) return void 0;
|
|
218
|
+
return {
|
|
219
|
+
key,
|
|
220
|
+
...doc.result.requestFingerprint ? { requestFingerprint: doc.result.requestFingerprint } : {},
|
|
221
|
+
statusCode: doc.result.statusCode,
|
|
222
|
+
headers: doc.result.headers,
|
|
223
|
+
body: doc.result.body,
|
|
224
|
+
...doc.result.bodyEncoding ? { bodyEncoding: doc.result.bodyEncoding } : {},
|
|
225
|
+
createdAt: new Date(doc.createdAt),
|
|
226
|
+
expiresAt: new Date(doc.expiresAt)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
178
229
|
/**
|
|
179
230
|
* A row holds a completed response only when it has a status code. A lock-only row can read back
|
|
180
231
|
* with `result: {}` (a nested path in a mongoose schema); replaying that would answer nothing.
|
|
@@ -186,6 +237,7 @@ function isCompleted(doc) {
|
|
|
186
237
|
//#region src/idempotency/stores/memory.ts
|
|
187
238
|
var MemoryIdempotencyStore = class {
|
|
188
239
|
name = "memory";
|
|
240
|
+
completionReleasesLock = true;
|
|
189
241
|
results = /* @__PURE__ */ new Map();
|
|
190
242
|
locks = /* @__PURE__ */ new Map();
|
|
191
243
|
ttlMs;
|
|
@@ -223,8 +275,28 @@ var MemoryIdempotencyStore = class {
|
|
|
223
275
|
const lock = this.locks.get(key);
|
|
224
276
|
if (!lock || lock.requestId !== requestId || lock.expiresAt.getTime() <= Date.now()) return false;
|
|
225
277
|
this.writeResult(key, result);
|
|
278
|
+
this.locks.delete(key);
|
|
226
279
|
return true;
|
|
227
280
|
}
|
|
281
|
+
async acquire(key, requestId, lockTtlMs) {
|
|
282
|
+
const result = this.results.get(key);
|
|
283
|
+
if (result) {
|
|
284
|
+
if (Date.now() <= new Date(result.expiresAt).getTime()) return {
|
|
285
|
+
status: "completed",
|
|
286
|
+
result
|
|
287
|
+
};
|
|
288
|
+
this.results.delete(key);
|
|
289
|
+
}
|
|
290
|
+
const lock = this.locks.get(key);
|
|
291
|
+
if (lock && Date.now() <= new Date(lock.expiresAt).getTime()) return { status: "locked" };
|
|
292
|
+
this.locks.set(key, {
|
|
293
|
+
key,
|
|
294
|
+
requestId,
|
|
295
|
+
lockedAt: /* @__PURE__ */ new Date(),
|
|
296
|
+
expiresAt: new Date(Date.now() + lockTtlMs)
|
|
297
|
+
});
|
|
298
|
+
return { status: "acquired" };
|
|
299
|
+
}
|
|
228
300
|
async tryLock(key, requestId, ttlMs) {
|
|
229
301
|
const existing = this.locks.get(key);
|
|
230
302
|
if (existing) {
|
|
@@ -443,12 +515,12 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
|
|
|
443
515
|
request.idempotencyKey = idempotencyKey;
|
|
444
516
|
const fullKey = `${idempotencyKey}:${operationIdentity$1(request)}`;
|
|
445
517
|
const requestFingerprint = bodyFingerprint(request);
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
-
replay(request, reply,
|
|
518
|
+
const acquisition = await acquireIdempotencyKey(store, fullKey, request.id, lockTimeoutMs);
|
|
519
|
+
if (acquisition.status === "completed") {
|
|
520
|
+
replay(request, reply, acquisition.result, requestFingerprint);
|
|
449
521
|
return reply;
|
|
450
522
|
}
|
|
451
|
-
if (
|
|
523
|
+
if (acquisition.status === "locked") {
|
|
452
524
|
reply.code(409).header("Retry-After", retryAfterSeconds.toString()).send({
|
|
453
525
|
code: ARC_ERROR_CODES.IDEMPOTENCY_CONFLICT,
|
|
454
526
|
message: "Request with this idempotency key is already in progress",
|
|
@@ -459,19 +531,6 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
|
|
|
459
531
|
}
|
|
460
532
|
request._idempotencyFullKey = fullKey;
|
|
461
533
|
request._idempotencyFingerprint = requestFingerprint;
|
|
462
|
-
try {
|
|
463
|
-
const completed = await store.get(fullKey);
|
|
464
|
-
if (completed) {
|
|
465
|
-
await store.unlock(fullKey, request.id);
|
|
466
|
-
request._idempotencyFullKey = void 0;
|
|
467
|
-
replay(request, reply, completed, requestFingerprint);
|
|
468
|
-
return reply;
|
|
469
|
-
}
|
|
470
|
-
} catch (err) {
|
|
471
|
-
await store.unlock(fullKey, request.id);
|
|
472
|
-
request._idempotencyFullKey = void 0;
|
|
473
|
-
throw err;
|
|
474
|
-
}
|
|
475
534
|
reply.header(HEADER_IDEMPOTENCY_KEY, idempotencyKey);
|
|
476
535
|
};
|
|
477
536
|
fastify.addHook("onRoute", (route) => {
|
|
@@ -495,6 +554,8 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
|
|
|
495
554
|
lockTimeoutMs
|
|
496
555
|
});
|
|
497
556
|
const recordedResponses = /* @__PURE__ */ new WeakSet();
|
|
557
|
+
/** Completed through `setIfLocked` — the lock is already gone when the store says so. */
|
|
558
|
+
const fencedCompletions = /* @__PURE__ */ new WeakSet();
|
|
498
559
|
async function recordResponse(request, reply, payload, binary = false) {
|
|
499
560
|
if (request.idempotencyReplayed || recordedResponses.has(request)) return;
|
|
500
561
|
const fullKey = request._idempotencyFullKey;
|
|
@@ -519,6 +580,7 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
|
|
|
519
580
|
};
|
|
520
581
|
if (store.setIfLocked && store.supportsFencedCompletion !== false) {
|
|
521
582
|
if (!await store.setIfLocked(fullKey, request.id, completion)) throw createDomainError(ARC_ERROR_CODES.IDEMPOTENCY_CONFLICT, "This request lost its idempotency lease before completion; its effect may have been applied. Retry the same key to retrieve the current owner's result.", 409);
|
|
583
|
+
fencedCompletions.add(request);
|
|
522
584
|
} else await store.set(fullKey, completion);
|
|
523
585
|
recordedResponses.add(request);
|
|
524
586
|
}
|
|
@@ -532,7 +594,7 @@ const idempotencyPlugin = async (fastify, opts = {}) => {
|
|
|
532
594
|
if (request.idempotencyReplayed) return;
|
|
533
595
|
const fullKey = request._idempotencyFullKey;
|
|
534
596
|
if (!fullKey) return;
|
|
535
|
-
await store
|
|
597
|
+
await releaseIdempotencyLock(store, fullKey, request.id, fencedCompletions.has(request));
|
|
536
598
|
});
|
|
537
599
|
fastify.addHook("onClose", async () => {
|
|
538
600
|
if (ownsStore) await store.close?.();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-
|
|
2
|
+
import { a as UpstashRedisLike, i as RedisIdempotencyStoreOptions, n as RedisClient, o as ioredisAsIdempotencyClient, r as RedisIdempotencyStore, s as upstashAsIdempotencyClient, t as IoredisLike } from "../redis-BDgv9Glw.mjs";
|
|
3
3
|
export { type IoredisLike, type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions, type UpstashRedisLike, ioredisAsIdempotencyClient, upstashAsIdempotencyClient };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as acquireBySteps } from "../acquire-BozJ-9yt.mjs";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
//#region src/idempotency/stores/redis.ts
|
|
4
5
|
/**
|
|
@@ -21,6 +22,8 @@ import { createHash } from "node:crypto";
|
|
|
21
22
|
var RedisIdempotencyStore = class {
|
|
22
23
|
name = "redis";
|
|
23
24
|
supportsFencedCompletion;
|
|
25
|
+
/** The fenced completion script deletes the lock; it needs `eval`, as fencing does. */
|
|
26
|
+
completionReleasesLock;
|
|
24
27
|
client;
|
|
25
28
|
prefix;
|
|
26
29
|
lockPrefix;
|
|
@@ -28,6 +31,7 @@ var RedisIdempotencyStore = class {
|
|
|
28
31
|
constructor(options) {
|
|
29
32
|
this.client = options.client;
|
|
30
33
|
this.supportsFencedCompletion = typeof options.client.eval === "function";
|
|
34
|
+
this.completionReleasesLock = this.supportsFencedCompletion;
|
|
31
35
|
this.prefix = options.prefix ?? "idem:";
|
|
32
36
|
this.lockPrefix = options.lockPrefix ?? "idem:lock:";
|
|
33
37
|
if (this.prefix.match(/\{([^}]+)\}/)?.[1] !== this.lockPrefix.match(/\{([^}]+)\}/)?.[1]) throw new Error("Redis idempotency prefixes must use the same Redis Cluster hash tag or neither may use one.");
|
|
@@ -40,7 +44,9 @@ var RedisIdempotencyStore = class {
|
|
|
40
44
|
return `${this.lockPrefix}${key}:{${createHash("sha256").update(key).digest("hex")}}`;
|
|
41
45
|
}
|
|
42
46
|
async get(key) {
|
|
43
|
-
|
|
47
|
+
return this.parseResult(await this.client.get(this.resultKey(key)));
|
|
48
|
+
}
|
|
49
|
+
parseResult(data) {
|
|
44
50
|
if (!data) return void 0;
|
|
45
51
|
try {
|
|
46
52
|
const result = JSON.parse(data);
|
|
@@ -69,6 +75,27 @@ var RedisIdempotencyStore = class {
|
|
|
69
75
|
NX: true
|
|
70
76
|
}) === "OK";
|
|
71
77
|
}
|
|
78
|
+
async acquire(key, requestId, lockTtlMs) {
|
|
79
|
+
const client = this.client;
|
|
80
|
+
if (typeof client.eval !== "function") return acquireBySteps(this, key, requestId, lockTtlMs);
|
|
81
|
+
const reply = await client.eval(`
|
|
82
|
+
local done = redis.call("get", KEYS[2])
|
|
83
|
+
if done then return {1, done} end
|
|
84
|
+
if redis.call("set", KEYS[1], ARGV[1], "NX", "PX", ARGV[2]) then return {2} end
|
|
85
|
+
return {0}
|
|
86
|
+
`, 2, this.lockKey(key), this.resultKey(key), requestId, Math.max(1, Math.ceil(lockTtlMs)));
|
|
87
|
+
const tag = Number(reply?.[0]);
|
|
88
|
+
if (tag === 2) return { status: "acquired" };
|
|
89
|
+
if (tag === 1) {
|
|
90
|
+
const result = this.parseResult(reply?.[1] ?? null);
|
|
91
|
+
if (result) return {
|
|
92
|
+
status: "completed",
|
|
93
|
+
result
|
|
94
|
+
};
|
|
95
|
+
return await this.tryLock(key, requestId, lockTtlMs) ? { status: "acquired" } : { status: "locked" };
|
|
96
|
+
}
|
|
97
|
+
return { status: "locked" };
|
|
98
|
+
}
|
|
72
99
|
async setIfLocked(key, requestId, result) {
|
|
73
100
|
if (typeof this.client.eval !== "function") throw new Error("Redis idempotency fenced completion requires eval; proxy eval through your Redis client adapter.");
|
|
74
101
|
const ttlMs = new Date(result.expiresAt).getTime() - Date.now();
|
|
@@ -76,6 +103,7 @@ var RedisIdempotencyStore = class {
|
|
|
76
103
|
const saved = await this.client.eval(`
|
|
77
104
|
if redis.call("get", KEYS[1]) ~= ARGV[1] then return 0 end
|
|
78
105
|
redis.call("set", KEYS[2], ARGV[2], "PX", ARGV[3])
|
|
106
|
+
redis.call("del", KEYS[1])
|
|
79
107
|
return 1
|
|
80
108
|
`, 2, this.lockKey(key), this.resultKey(key), requestId, JSON.stringify({
|
|
81
109
|
key,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "./types-Ddl9OjmE.mjs";
|
|
3
3
|
import { l as PermissionCheck, t as AnyRecord } from "./base-CZyixEQR.mjs";
|
|
4
|
-
import { A as RequestWithExtras, Dt as RouteMcpConfig, F as ResourceDefinition,
|
|
5
|
-
import "./fastify-augmentation-
|
|
4
|
+
import { A as RequestWithExtras, Dt as RouteMcpConfig, F as ResourceDefinition, Hn as IRequestContext, I as CrudController, L as ResourceConfig, O as FastifyWithDecorators, St as ActionDefinition, Vn as IControllerResponse, X as RouteSchemaOptions, Z as ArcFieldRule, g as RequestContext, ot as AggregationConfig, v as CrudRouterOptions } from "./index-WH7xgvxS.mjs";
|
|
5
|
+
import "./fastify-augmentation-DRlCIWE9.mjs";
|
|
6
6
|
import { Filter } from "@classytic/repo-core/filter";
|
|
7
7
|
import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
8
8
|
import { z } from "zod";
|
|
@@ -271,34 +271,6 @@ type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: Resou
|
|
|
271
271
|
*/
|
|
272
272
|
declare function defineResourceVariants<TDoc extends object = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
|
|
273
273
|
//#endregion
|
|
274
|
-
//#region src/core/entityHelpers.d.ts
|
|
275
|
-
/**
|
|
276
|
-
* Read the resource's configured `idField` for the current request.
|
|
277
|
-
* Falls back to the framework default (`_id`) when the route hasn't
|
|
278
|
-
* bound an idField — keeps handlers safe to author without checking
|
|
279
|
-
* the resource config.
|
|
280
|
-
*/
|
|
281
|
-
declare function getEntityIdField(req: RequestWithExtras): string;
|
|
282
|
-
/**
|
|
283
|
-
* Read the URL `:id` path param value as the resource handle.
|
|
284
|
-
* Returns `undefined` when the route has no `:id` segment (collection
|
|
285
|
-
* routes) — handlers that need the entity must be on row routes.
|
|
286
|
-
*/
|
|
287
|
-
declare function getEntityId(req: RequestWithExtras): string | undefined;
|
|
288
|
-
/**
|
|
289
|
-
* Compose a `findOne` filter that resolves the current request's
|
|
290
|
-
* entity, regardless of whether the resource binds `_id` or a custom
|
|
291
|
-
* field. Idiomatic shape for arc action handlers.
|
|
292
|
-
*
|
|
293
|
-
* ```ts
|
|
294
|
-
* const doc = await Model.findOne(getEntityQuery(req));
|
|
295
|
-
* ```
|
|
296
|
-
*
|
|
297
|
-
* Returns `{}` when the route has no entity context (collection routes
|
|
298
|
-
* or tests bypassing the router) — caller decides what that means.
|
|
299
|
-
*/
|
|
300
|
-
declare function getEntityQuery(req: RequestWithExtras): Record<string, string>;
|
|
301
|
-
//#endregion
|
|
302
274
|
//#region src/core/fastifyAdapter.d.ts
|
|
303
275
|
/**
|
|
304
276
|
* Project `FastifyRequest` into the `IRequestContext` controllers receive,
|
|
@@ -396,4 +368,4 @@ declare function formatValidationErrors(resourceName: string, result: Validation
|
|
|
396
368
|
*/
|
|
397
369
|
declare function assertValidConfig(config: ResourceConfig, options?: ValidateOptions): void;
|
|
398
370
|
//#endregion
|
|
399
|
-
export {
|
|
371
|
+
export { CrudOperation as A, HookOperation as B, mergeResourceConfig as C, createPermissionMiddleware as D, createCrudRouter as E, DEFAULT_TENANT_FIELD as F, MUTATION_OPERATIONS as G, MAX_FILTER_DEPTH as H, DEFAULT_UPDATE_METHOD as I, SYSTEM_FIELDS as J, MutationOperation as K, DEFAULT_VERSION_FIELD as L, DEFAULT_LIMIT as M, DEFAULT_MAX_LIMIT as N, defineAggregation as O, DEFAULT_SORT as P, HOOK_OPERATIONS as R, SeamedResourceConfig as S, defineAction as T, MAX_REGEX_LENGTH as U, HookPhase as V, MAX_SEARCH_LENGTH as W, VariantsMap as _, formatValidationErrors as a, AdapterLike as b, nativePolicyFilter as c, createFastifyHandler as d, createRequestContext as f, VariantOverride as g, sendControllerResponse as h, assertValidConfig as i, DEFAULT_ID_FIELD as j, CRUD_OPERATIONS as k, collectReadBlockedFields as l, getControllerScope as m, ValidateOptions as n, validateResourceConfig as o, getControllerContext as p, RESERVED_QUERY_PARAMS as q, ValidationResult as r, NativePolicyFilter as s, ConfigError as t, isFieldReadable as u, VariantsResult as v, DefineActionConfig as w, ResourceSeams as x, defineResourceVariants as y, HOOK_PHASES as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Mt as Authenticator } from "./index-
|
|
2
|
+
import { Mt as Authenticator } from "./index-WH7xgvxS.mjs";
|
|
3
3
|
import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
|
|
4
4
|
import { n as ElevationOptions } from "./elevation-BW2J3tNj.mjs";
|
|
5
5
|
import { a as EventTransport } from "./EventTransport-CiicKz2Z.mjs";
|
|
@@ -7,10 +7,10 @@ import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
|
|
|
7
7
|
import { r as QueryCachePluginOptions } from "./queryCachePlugin-C2lZjTxk.mjs";
|
|
8
8
|
import { t as ErrorHandlerOptions } from "./errorHandler--4rSMMvq.mjs";
|
|
9
9
|
import { S as SchedulesPluginOptions, T as HealthOptions, _ as ResourceLike, o as ArcPorts, r as ArcModuleInput } from "./types-BJ-2XqVF.mjs";
|
|
10
|
-
import { H as ModuleGraphOptions } from "./index-
|
|
10
|
+
import { H as ModuleGraphOptions } from "./index-CUJvoyw3.mjs";
|
|
11
11
|
import { t as EventPluginOptions } from "./eventPlugin-BtmA4-3P.mjs";
|
|
12
12
|
import { a as MetricsOptions, c as RealtimeOptions, f as CachingOptions, h as GracefulShutdownOptions, t as VersioningOptions, u as SSEOptions } from "./versioning-Bsb51gGT.mjs";
|
|
13
|
-
import {
|
|
13
|
+
import { i as IdempotencyStore } from "./interface-JJzwH4Ro.mjs";
|
|
14
14
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
|
|
15
15
|
//#region src/factory/types/assets.d.ts
|
|
16
16
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { F as ResourceDefinition } from "./index-
|
|
2
|
+
import { F as ResourceDefinition } from "./index-WH7xgvxS.mjs";
|
|
3
3
|
import { h as ModuleSetupContext, i as ArcModuleRegistry, l as ModuleContribution, n as ArcModule, o as ArcPorts, p as PortName, r as ArcModuleInput, u as ModuleName } from "./types-BJ-2XqVF.mjs";
|
|
4
4
|
import { FastifyInstance } from "fastify";
|
|
5
5
|
//#region src/factory/module/graph.d.ts
|
|
@@ -1042,6 +1042,50 @@ declare class AccessControl {
|
|
|
1042
1042
|
private _meta;
|
|
1043
1043
|
}
|
|
1044
1044
|
//#endregion
|
|
1045
|
+
//#region src/core/entityHelpers.d.ts
|
|
1046
|
+
/**
|
|
1047
|
+
* Read the resource's configured `idField` for the current request.
|
|
1048
|
+
* Falls back to the framework default (`_id`) when the route hasn't
|
|
1049
|
+
* bound an idField — keeps handlers safe to author without checking
|
|
1050
|
+
* the resource config.
|
|
1051
|
+
*/
|
|
1052
|
+
declare function getEntityIdField(req: RequestWithExtras): string;
|
|
1053
|
+
/**
|
|
1054
|
+
* Read the URL `:id` path param value as the resource handle.
|
|
1055
|
+
* Returns `undefined` when the route has no `:id` segment (collection
|
|
1056
|
+
* routes) — handlers that need the entity must be on row routes.
|
|
1057
|
+
*/
|
|
1058
|
+
declare function getEntityId(req: RequestWithExtras): string | undefined;
|
|
1059
|
+
/**
|
|
1060
|
+
* Compose a `findOne` filter that resolves the current request's
|
|
1061
|
+
* entity, regardless of whether the resource binds `_id` or a custom
|
|
1062
|
+
* field. Idiomatic shape for arc action handlers.
|
|
1063
|
+
*
|
|
1064
|
+
* ```ts
|
|
1065
|
+
* const doc = await Model.findOne(getEntityQuery(req));
|
|
1066
|
+
* ```
|
|
1067
|
+
*
|
|
1068
|
+
* Returns `{}` when the route has no entity context (collection routes
|
|
1069
|
+
* or tests bypassing the router) — caller decides what that means.
|
|
1070
|
+
*/
|
|
1071
|
+
declare function getEntityQuery(req: RequestWithExtras): Record<string, string>;
|
|
1072
|
+
/** The action-target fence's answer and, when it read one, the row (`GET /:id`'s scope). */
|
|
1073
|
+
interface ActionTargetCheck {
|
|
1074
|
+
readonly visible: boolean;
|
|
1075
|
+
readonly doc?: unknown;
|
|
1076
|
+
}
|
|
1077
|
+
/**
|
|
1078
|
+
* The row the action-target fence loaded for this request, so the handler need not read it
|
|
1079
|
+
* again. `undefined` when no fence read happened (untenanted resource, `scope: 'handler'`,
|
|
1080
|
+
* id-less action) — load it yourself then. It is a snapshot taken after the idempotency lock
|
|
1081
|
+
* and before the handler: a guarded write must still carry its precondition in the filter.
|
|
1082
|
+
*/
|
|
1083
|
+
declare function getActionTarget<TDoc = Record<string, unknown>>(req: {
|
|
1084
|
+
readonly arc?: {
|
|
1085
|
+
readonly actionTarget?: unknown;
|
|
1086
|
+
};
|
|
1087
|
+
}): TDoc | undefined;
|
|
1088
|
+
//#endregion
|
|
1045
1089
|
//#region src/core/QueryResolver.d.ts
|
|
1046
1090
|
interface QueryResolverConfig {
|
|
1047
1091
|
/** Query parser instance (default: Arc built-in parser) */
|
|
@@ -1277,6 +1321,11 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
1277
1321
|
/** Whether {@link isActionTargetVisible} can answer — it reads through the repository. */
|
|
1278
1322
|
canFenceActionTargets(): boolean;
|
|
1279
1323
|
isActionTargetVisible(req: IRequestContext, id: string): Promise<boolean>;
|
|
1324
|
+
/**
|
|
1325
|
+
* The fence's answer plus the row it read (absent when the resource has no row scope, so
|
|
1326
|
+
* nothing was read). The router hands the row to the handler as `getActionTarget(req)`.
|
|
1327
|
+
*/
|
|
1328
|
+
loadActionTarget(req: IRequestContext, id: string): Promise<ActionTargetCheck>;
|
|
1280
1329
|
/** `ETag: "<version>"` for a versioned document under optimistic concurrency. */
|
|
1281
1330
|
protected etagHeaders(doc: unknown): Record<string, string> | undefined;
|
|
1282
1331
|
/**
|
|
@@ -3994,6 +4043,8 @@ interface RequestWithExtras extends FastifyRequest {
|
|
|
3994
4043
|
* can still read the entity handle.
|
|
3995
4044
|
*/
|
|
3996
4045
|
entityId?: string;
|
|
4046
|
+
/** The id-bound action's target as the fence read it — read via `getActionTarget(req)`. */
|
|
4047
|
+
actionTarget?: unknown;
|
|
3997
4048
|
};
|
|
3998
4049
|
context?: Record<string, unknown>;
|
|
3999
4050
|
_policyFilters?: Record<string, unknown>;
|
|
@@ -4605,4 +4656,4 @@ type InferDocType<T> = T extends DataAdapter<infer D> ? D : T extends ResourceCo
|
|
|
4605
4656
|
type InferAdapterDoc<A> = A extends DataAdapter<infer D> ? D : unknown;
|
|
4606
4657
|
type InferResourceDoc<T> = T extends ResourceConfig<infer D> ? D : never;
|
|
4607
4658
|
//#endregion
|
|
4608
|
-
export { ResourceHookContext as $,
|
|
4659
|
+
export { ResourceHookContext as $, AccessControl as $t, RequestWithExtras as A, MixinConstructor as An, AuthHelpers as At, OnTenantDeleteConfig as B, IController as Bn, TreeMixin as Bt, RequestIdOptions as C, ArcGetResult as Cn, ActionEntry as Ct, FastifyWithAuth as D, ControllerConfigurableOptions as Dn, RouteMcpConfig as Dt, FastifyRequestExtras as E, BaseControllerOptions as En, RouteDefinition as Et, ResourceDefinition as F, WriteContext as Fn, TokenPair as Ft, CrudRouteKey as G, ServerAccessor as Gn, BaseCrudController as Gt, PresetFunction as H, IRequestContext as Hn, SlugMixin as Ht, CrudController as I, WriteVerbKey as In, BaseController as It, MiddlewareConfig as J, ActionTargetCheck as Jt, CrudSchemas as K, QueryResolver as Kt, ResourceConfig as L, ControllerHandler as Ln, SoftDeleteExt as Lt, ResourceRegistry as M, BodySanitizerConfig as Mn, Authenticator as Mt, RouteRow as N, MutationWriteContext as Nn, AuthenticatorContext as Nt, FastifyWithDecorators as O, ControllerConstructionOptions as On, RouteMethod as Ot, defineResource as P, ResourceWrites as Pn, JwtContext as Pt, FieldRule$1 as Q, getEntityQuery as Qt, ResourceIdempotencyConfig as R, ControllerLike as Rn, SoftDeleteMixin as Rt, IntrospectionPluginOptions as S, ArcDeleteResult as Sn, ActionDefinition as St, EventsDecorator as T, ArcUpdateResult as Tn, ActionsMap as Tt, PresetHook as U, RawRouteHandler as Un, BulkExt as Ut, ResolvedTenantPurge as V, IControllerResponse as Vn, SlugExt as Vt, PresetResult as W, RouteHandler as Wn, BulkMixin as Wt, RouteSchemaOptions as X, getEntityId as Xt, OpenApiSchemas as Y, getActionTarget as Yt, ArcFieldRule as Z, getEntityIdField as Zt, ServiceContext as _, beforeDelete as _n, PipelineConfig as _t, IntrospectionData as a, DefineHookOptions as an, AggregationCacheConfig as at, HealthCheck as b, defineHook as bn, Transform as bt, ResourceMetadata as c, HookOperation as cn, AggregationIndexHint as ct, LookupOption as d, HookSystem as dn, AggregationRateLimit as dt, AccessControlConfig as en, ResourceHooks as et, OwnershipCheck as f, HookSystemOptions as fn, AggregationsMap as ft, RequestContext as g, beforeCreate as gn, OperationFilter as gt, QueryParserInterface as h, afterUpdate as hn, NextFunction as ht, PaginationResult as i, AroundHookHandler as in, AggMeasureShorthand as it, RegisterOptions as j, BodySanitizer as jn, AuthPluginOptions as jt, MiddlewareHandler as k, ListResult as kn, RateLimitConfig as kt, ArcInternalMetadata as l, HookPhase as ln, AggregationMaterializedContext as lt, PopulateOption as m, afterDelete as mn, Interceptor as mt, InferDocType as n, FetchDenialReason as nn, EventDefinition as nt, RegistryEntry as o, HookContext as on, AggregationConfig as ot, ParsedQuery as p, afterCreate as pn, Guard as pt, LookupPolicy as q, QueryResolverConfig as qt, InferResourceDoc as r, FetchResult as rn, AggMeasureInput as rt, RegistryStats as s, HookHandler as sn, AggregationDateRangeRequirement as st, InferAdapterDoc as t, AccessControlRepository as tn, ResourceExtensions as tt, ControllerQueryOptions as u, HookRegistration as un, AggregationMaterializedResult as ut, CrudRouterOptions as v, beforeUpdate as vn, PipelineContext as vt, ArcDecorator as w, ArcListResult as wn, ActionHandlerFn as wt, HealthOptions as x, ArcCreateResult as xn, ResourceCacheConfig as xt, GracefulShutdownOptions as y, createHookSystem as yn, PipelineStep as yt, ResourcePermissions as z, FastifyHandler as zn, TreeExt as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { c as DataPolicy, d as UserBase, l as PermissionCheck, n as ArcRequest, o as UserOrganization, r as JWTPayload, s as AuthorizationDecision, t as AnyRecord, u as PermissionContext } from "./base-CZyixEQR.mjs";
|
|
3
|
-
import { A as RequestWithExtras,
|
|
3
|
+
import { A as RequestWithExtras, Bn as IController, Bt as TreeMixin, C as RequestIdOptions, Cn as ArcGetResult, D as FastifyWithAuth, Dn as ControllerConfigurableOptions, E as FastifyRequestExtras, En as BaseControllerOptions, F as ResourceDefinition, Fn as WriteContext, G as CrudRouteKey, Gt as BaseCrudController, H as PresetFunction, Hn as IRequestContext, Ht as SlugMixin, I as CrudController, In as WriteVerbKey, It as BaseController, J as MiddlewareConfig, K as CrudSchemas, L as ResourceConfig, Lt as SoftDeleteExt, Nn as MutationWriteContext, O as FastifyWithDecorators, On as ControllerConstructionOptions, P as defineResource, Pn as ResourceWrites, Q as FieldRule, Rn as ControllerLike, Rt as SoftDeleteMixin, S as IntrospectionPluginOptions, Sn as ArcDeleteResult, Tn as ArcUpdateResult, Un as RawRouteHandler, Ut as BulkExt, Vn as IControllerResponse, Vt as SlugExt, W as PresetResult, Wn as RouteHandler, Wt as BulkMixin, X as RouteSchemaOptions, _ as ServiceContext, a as IntrospectionData, at as AggregationCacheConfig, b as HealthCheck, c as ResourceMetadata, ct as AggregationIndexHint, dt as AggregationRateLimit, f as OwnershipCheck, ft as AggregationsMap, g as RequestContext, h as QueryParserInterface, i as PaginationResult, it as AggMeasureShorthand, jt as AuthPluginOptions, kn as ListResult, kt as RateLimitConfig, l as ArcInternalMetadata, lt as AggregationMaterializedContext, n as InferDocType, nt as EventDefinition, o as RegistryEntry, ot as AggregationConfig, r as InferResourceDoc, rt as AggMeasureInput, s as RegistryStats, st as AggregationDateRangeRequirement, t as InferAdapterDoc, ut as AggregationMaterializedResult, v as CrudRouterOptions, wn as ArcListResult, x as HealthOptions, xn as ArcCreateResult, y as GracefulShutdownOptions, zt as TreeExt } from "./index-WH7xgvxS.mjs";
|
|
4
4
|
import { a as applyFieldReadPermissions, n as FieldPermissionMap, o as applyFieldWritePermissions, s as fields, t as FieldPermission } from "./fields-BBSpf8pS.mjs";
|
|
5
|
-
import "./fastify-augmentation-
|
|
6
|
-
import {
|
|
5
|
+
import "./fastify-augmentation-DRlCIWE9.mjs";
|
|
6
|
+
import { A as CrudOperation, B as HookOperation, C as mergeResourceConfig, F as DEFAULT_TENANT_FIELD, G as MUTATION_OPERATIONS, H as MAX_FILTER_DEPTH, I as DEFAULT_UPDATE_METHOD, J as SYSTEM_FIELDS, K as MutationOperation, M as DEFAULT_LIMIT, N as DEFAULT_MAX_LIMIT, O as defineAggregation, P as DEFAULT_SORT, R as HOOK_OPERATIONS, S as SeamedResourceConfig, T as defineAction, U as MAX_REGEX_LENGTH, V as HookPhase, W as MAX_SEARCH_LENGTH, b as AdapterLike, c as nativePolicyFilter, j as DEFAULT_ID_FIELD, k as CRUD_OPERATIONS, m as getControllerScope, q as RESERVED_QUERY_PARAMS, s as NativePolicyFilter, x as ResourceSeams, y as defineResourceVariants, z as HOOK_PHASES } from "./index-Beg3aNnK.mjs";
|
|
7
7
|
import { C as requireScopeContext, G as createDynamicPermissionMatrix, H as DynamicPermissionMatrix, J as PublicPolicy, K as createOrgPermissions, Q as anyOf, S as requireOrgRole, T as requireTeamMembership, U as DynamicPermissionMatrixConfig, Y as allOf, Z as allowPublic, _ as publicRead, at as requireRoles, b as requireOrgInScope, d as adminOnly, et as denyAll, f as authenticated, g as presets_d_exports, m as ownerWithAdminBypass, nt as requireAuth, p as fullPublic, q as AllowPublicOptions, rt as requireOwnership, st as when, v as publicReadAdminWrite, w as requireServiceScope, x as requireOrgMembership, y as readOnly } from "./index-Bxriq3so.mjs";
|
|
8
8
|
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-JYc9vwqE.mjs";
|
|
9
9
|
//#region src/index.d.ts
|
|
10
|
-
declare const version: string;
|
|
10
|
+
export declare const version: string;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AllowPublicOptions, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type PublicPolicy, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, UnauthorizedError, type UserBase, type UserOrganization, ValidationError, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership,
|
|
12
|
+
export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AllowPublicOptions, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, type MutationWriteContext, type NativePolicyFilter, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type PublicPolicy, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type ResourceWrites, type RouteHandler, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, UnauthorizedError, type UserBase, type UserOrganization, ValidationError, type WriteContext, type WriteVerbKey, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, when };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-
|
|
3
|
-
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-
|
|
4
|
-
import { S as nativePolicyFilter, c as BaseController, d as SlugMixin, f as BulkMixin, l as TreeMixin, p as BaseCrudController, u as SoftDeleteMixin } from "./plugin-
|
|
5
|
-
import { t as defineAggregation } from "./defineAggregation
|
|
6
|
-
import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-
|
|
7
|
-
import { S as getControllerScope } from "./actionPermissions-
|
|
8
|
-
import { a as
|
|
9
|
-
import { a as ResourceDefinition, t as defineResource } from "./defineResource-
|
|
10
|
-
import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as DEFAULT_SORT, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "./constants-B2QHb6u6.mjs";
|
|
3
|
+
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-CW4anJBy.mjs";
|
|
4
|
+
import { S as nativePolicyFilter, c as BaseController, d as SlugMixin, f as BulkMixin, l as TreeMixin, p as BaseCrudController, u as SoftDeleteMixin } from "./plugin-DALd9dcF.mjs";
|
|
5
|
+
import { t as defineAggregation } from "./defineAggregation--3xguLkk.mjs";
|
|
6
|
+
import { i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "./fields-A5crhsJb.mjs";
|
|
7
|
+
import { S as getControllerScope } from "./actionPermissions-5N04zBL4.mjs";
|
|
8
|
+
import { a as defineResourceVariants, o as mergeResourceConfig, s as defineAction } from "./core-COcqo0Cp.mjs";
|
|
9
|
+
import { a as ResourceDefinition, t as defineResource } from "./defineResource-gUp9ug66.mjs";
|
|
10
|
+
import { B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, I as anyOf, N as allOf, O as requireServiceScope, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, a as adminOnly, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, k as requireTeamMembership, o as authenticated, p as readOnly, s as fullPublic, u as presets_exports, w as requireOrgInScope } from "./permissions-C5ijIz5Q.mjs";
|
|
11
11
|
//#region src/index.ts
|
|
12
|
-
const version = "2.
|
|
12
|
+
const version = "2.44.0";
|
|
13
13
|
//#endregion
|
|
14
14
|
export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, NotFoundError, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, nativePolicyFilter, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
|
@@ -3,7 +3,7 @@ import { n as DomainEvent } from "../EventTransport-CiicKz2Z.mjs";
|
|
|
3
3
|
import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-Cs4awVyD.mjs";
|
|
4
4
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
5
5
|
//#region src/integrations/event-gateway.d.ts
|
|
6
|
-
interface EventGatewayOptions {
|
|
6
|
+
export interface EventGatewayOptions {
|
|
7
7
|
/** Require auth for all real-time connections (default: true) */
|
|
8
8
|
auth?: boolean;
|
|
9
9
|
/** Custom auth function for WebSocket upgrade */
|
|
@@ -46,6 +46,5 @@ interface EventGatewayOptions {
|
|
|
46
46
|
onDisconnect?: (client: WebSocketClient) => void | Promise<void>;
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
|
|
50
|
-
//#endregion
|
|
51
|
-
export { EventGatewayOptions, eventGatewayPlugin };
|
|
49
|
+
export declare const eventGatewayPlugin: FastifyPluginAsync<EventGatewayOptions>;
|
|
50
|
+
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
2
|
import fp from "fastify-plugin";
|
|
3
3
|
//#region src/integrations/event-gateway.ts
|
|
4
4
|
const eventGatewayPluginImpl = async (fastify, opts = {}) => {
|
|
5
5
|
const { auth = true, orgScoped, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
|
|
6
6
|
if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
|
|
7
7
|
if (opts.sse !== false) {
|
|
8
|
-
const { default: ssePlugin } = await import("../sse-
|
|
8
|
+
const { default: ssePlugin } = await import("../sse-BzJFPX_1.mjs").then((n) => n.n);
|
|
9
9
|
await fastify.register(ssePlugin, {
|
|
10
10
|
path: opts.sse?.path ?? "/events/stream",
|
|
11
11
|
requireAuth: auth,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-Cs4awVyD.mjs";
|
|
3
3
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
4
4
|
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-Chgz3d0i.mjs";
|
|
5
|
-
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-
|
|
5
|
+
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-D3Ixsh00.mjs";
|
|
6
6
|
import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
|
|
7
7
|
import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
|
|
8
8
|
export type { BetterAuthHandler, CallToolResult, CreateMcpServerConfig, CrudOperation, EventGatewayOptions, JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, McpAuthResult, McpPluginOptions, McpResourceConfig, PromptDefinition, QueueStats, StreamlinePluginOptions, ToolAnnotations, ToolContext, ToolDefinition, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription, WorkflowLike, WorkflowRunLike };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
2
|
export {};
|