@classytic/arc 2.38.0 → 2.41.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/{BaseController-CYaDvmOB.mjs → BaseController-DYJRZ0EJ.mjs} +114 -24
- package/dist/{EventTransport-Cx60_s-6.d.mts → EventTransport-CbUKDzZZ.d.mts} +33 -0
- package/dist/{EventTransport-Gq7JWbWw.mjs → EventTransport-n7qO5Cz3.mjs} +22 -2
- package/dist/{HookSystem-C0ikzqQf.mjs → HookSystem-CxvZBo77.mjs} +2 -2
- package/dist/{ResourceRegistry-DPcX--zk.mjs → ResourceRegistry-Cu7uTJp9.mjs} +2 -2
- package/dist/{actionPermissions-jlFZ1it4.mjs → actionPermissions-DPwPWPOV.mjs} +7 -6
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +10 -3
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +12 -6
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-BP8GHtjc.mjs → authorizationDecision-2YY_Kaj1.mjs} +2 -2
- package/dist/{base-C-NL2fTi.d.mts → base-CxrV1LmG.d.mts} +10 -0
- package/dist/{buildHandler-DjXOqIvX.mjs → buildHandler-CUhjGHGZ.mjs} +4 -4
- package/dist/cache/index.d.mts +4 -2
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-a3ZEcJJs.mjs → caching-DsWDjIxx.mjs} +2 -2
- package/dist/cleanup/index.d.mts +2 -2
- package/dist/cleanup/index.mjs +21 -5
- 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-BONghE1Y.mjs → constants-BxLgNFF7.mjs} +1 -1
- package/dist/context/index.d.mts +34 -6
- package/dist/context/index.mjs +42 -24
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +7 -7
- package/dist/{core-8She7FgF.mjs → core-iNGqYerO.mjs} +3 -3
- package/dist/{createActionRouter-Bqi6Bhhx.mjs → createActionRouter-BBlbPs3k.mjs} +7 -7
- package/dist/{createAggregationRouter-BsYO7ktd.mjs → createAggregationRouter-Dv5SuK2x.mjs} +7 -7
- package/dist/createMcpServer-CbDWkZ1T.d.mts +48 -0
- package/dist/{defineAggregation-0KBvqEEC.mjs → defineAggregation-UyeurGkp.mjs} +1 -1
- package/dist/{defineResource-BMdyRelW.mjs → defineResource-DzGT-2LP.mjs} +20 -22
- 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-C6woysGC.mjs → elevation-BF-vhGxY.mjs} +4 -4
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-DI5AN2b5.d.mts → errorHandler--4rSMMvq.d.mts} +7 -1
- package/dist/{errorHandler-BdmIWPba.mjs → errorHandler-CIMkCOWm.mjs} +3 -3
- package/dist/{errors-2ExmOgIJ.mjs → errors-C_YhELhe.mjs} +1 -1
- package/dist/{eventPlugin-DFvHa4Nf.d.mts → eventPlugin-B52abJ8W.d.mts} +1 -1
- package/dist/{eventPlugin-DJwpGMzx.mjs → eventPlugin-CmXaPWLv.mjs} +5 -5
- package/dist/events/index.d.mts +4 -4
- package/dist/events/index.mjs +5 -5
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +34 -24
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/events/transports/redis.mjs +11 -8
- package/dist/factory/index.d.mts +5 -5
- package/dist/factory/index.mjs +5 -5
- package/dist/{fastify-augmentation-jYA2oHyL.d.mts → fastify-augmentation-Cq2nHVaW.d.mts} +3 -3
- package/dist/{fields-Cha2QCKH.mjs → fields-BTyPLHK0.mjs} +1 -1
- package/dist/{generate-BUP4Oydg.mjs → generate-D_YmiCNf.mjs} +4 -3
- package/dist/{headers-DeXNifVj.mjs → headers-CNECDE6q.mjs} +2 -2
- package/dist/{health-Bh0N_FLk.mjs → health-CxQzbJmr.mjs} +10 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/idempotency/index.d.mts +1 -1
- package/dist/idempotency/index.mjs +4 -4
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-BtYoMip1.d.mts → index-BHdZD8zK.d.mts} +10 -2
- package/dist/{index-D2uIUSQk.d.mts → index-CFfLKMH4.d.mts} +2 -2
- package/dist/{index-eyg5WEcy.d.mts → index-CbJiYrfv.d.mts} +1 -1
- package/dist/{index-BRoDtjek.d.mts → index-D4u76eQW.d.mts} +3 -3
- package/dist/{index-B78WZom8.d.mts → index-DHbyPo5j.d.mts} +52 -12
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +11 -11
- package/dist/{init-Dg_Am2o_.mjs → init-Y2MlSN9n.mjs} +9 -9
- package/dist/integrations/event-gateway.d.mts +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.d.mts +1 -1
- package/dist/integrations/jobs/index.mjs +2 -2
- package/dist/integrations/mcp/index.d.mts +4 -47
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +22 -2
- package/dist/integrations/mcp/testing.mjs +55 -33
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +2 -2
- package/dist/integrations/webhooks.mjs +3 -3
- package/dist/integrations/websocket-pushref-redis.d.mts +1 -1
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +24 -6
- package/dist/{interface-DYPVscCU.mjs → interface-BIpgzbZl.mjs} +1 -1
- package/dist/{jsonBody-DVui0uJl.mjs → jsonBody-Cq9KYl2Z.mjs} +2 -2
- package/dist/{keys-BSuxGS-B.mjs → keys-Cmv4cBRa.mjs} +1 -1
- package/dist/{loadResources-CNd1DWnK.mjs → loadResources-CblF7xt2.mjs} +2 -2
- package/dist/{loadResourcesFromEntry-DNj8cpiY.mjs → loadResourcesFromEntry-99fIMC3p.mjs} +2 -2
- package/dist/logger/index.mjs +1 -1
- package/dist/{mcpPlugin-KWsezMx7.mjs → mcpPlugin-xF3Gw-HW.mjs} +75 -31
- package/dist/{memory-BiPVaCPg.mjs → memory-CpDZ9NPw.mjs} +2 -2
- package/dist/{metrics-CsWaIVTa.mjs → metrics-BaKnq8ag.mjs} +2 -2
- 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-BQXHxMEk.mjs → module-BkQEesNQ.mjs} +1 -1
- package/dist/{multipartBody-u6VrS_iH.mjs → multipartBody-C92aJ8am.mjs} +1 -1
- package/dist/{openapi-Dxc8RLy_.mjs → openapi-C3LFRzPq.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +2 -2
- package/dist/outbox-admin/index.mjs +4 -4
- package/dist/{outbox-module-CQXu_O6o.d.mts → outbox-module-BHdUnuuK.d.mts} +15 -2
- package/dist/{outbox-module-DyIqA5vo.mjs → outbox-module-dsCyLxXH.mjs} +43 -21
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +5 -5
- package/dist/{permissions-H7Zcb82Z.mjs → permissions-DiHXy8Ck.mjs} +12 -6
- package/dist/{pipe-SunhEaZ6.mjs → pipe-CBVmUJ-j.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/plugins/index.d.mts +7 -37
- package/dist/plugins/index.mjs +34 -22
- package/dist/plugins/response-cache.mjs +9 -2
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-Da7IT_qJ.mjs → pluralize-2_U6QZQg.mjs} +1 -1
- package/dist/{preloadResources-DlhH81py.mjs → preloadResources-Bbp4QJ8V.mjs} +82 -26
- package/dist/{preloadResources-BbBkNkqK.d.mts → preloadResources-CjS2OfpU.d.mts} +14 -9
- package/dist/presets/filesUpload.d.mts +2 -2
- 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 +38 -1
- package/dist/presets/multiTenant.mjs +24 -6
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-CNyfaxGL.mjs → presets-BdlugYTc.mjs} +4 -4
- package/dist/{projection-DSfEoooA.mjs → projection-Uvgp-EEj.mjs} +2 -2
- package/dist/{queryCachePlugin-oTsmVyEQ.mjs → queryCachePlugin-B5F09bYr.mjs} +11 -5
- package/dist/rateLimitKey-CK-EU2L8.mjs +41 -0
- package/dist/{realtime-CPmjjgqd.mjs → realtime-FnnD0n3Z.mjs} +9 -9
- package/dist/{redis-CduhKsJi.d.mts → redis-Bzi1y3F9.d.mts} +10 -2
- package/dist/{redis-stream-eh0eOtjh.d.mts → redis-stream-BPKscsTB.d.mts} +12 -7
- package/dist/{registerRoute-XvcI_3sh.mjs → registerRoute-DRsSHPSM.mjs} +6 -6
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-UFEJQN8R.mjs → registry-D3y8VEJ1.mjs} +2 -2
- package/dist/{renewingLease-DuRGVOMe.mjs → renewingLease-B3VYh5aU.mjs} +1 -1
- package/dist/{replyHelpers-BHebarf0.mjs → replyHelpers-DPHsdw-5.mjs} +2 -2
- package/dist/{requestContext-DpmntRZy.mjs → requestContext-cSVKnYPk.mjs} +1 -1
- package/dist/{rolldown-runtime-Add2L50I.mjs → rolldown-runtime-DjDuyglE.mjs} +1 -1
- package/dist/{runtimeCapabilities-D793Pxci.mjs → runtimeCapabilities-DSA_dH1_.mjs} +31 -5
- package/dist/{schedules-DthM8Qag.mjs → schedules-BktJb3Y3.mjs} +8 -4
- package/dist/{schemaConverter-Db-MMsH6.mjs → schemaConverter-BLCSmNbr.mjs} +1 -1
- package/dist/{schemaIR-CIXShch7.mjs → schemaIR-K16Bb5BX.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-D03sk17n.mjs → scope-jSxuBTFM.mjs} +4 -4
- package/dist/{simpleEqualityMatcher-B7qVjQBv.mjs → simpleEqualityMatcher-BiOnyflP.mjs} +1 -1
- package/dist/{sse-D4MYqkic.mjs → sse-CH7Slxc1.mjs} +5 -5
- package/dist/{sseStream-BuMNPR6r.mjs → sseStream-CN-Lh1Tu.mjs} +2 -2
- package/dist/{store-helpers-CIF4RG8s.mjs → store-helpers-9DX9-1j_.mjs} +1 -1
- package/dist/{streaming-DkpW1HwJ.mjs → streaming-dvppnxsr.mjs} +1 -1
- package/dist/{subscribe-helpers-CBZOi6pk.mjs → subscribe-helpers-AVYPgqTl.mjs} +2 -2
- package/dist/sync/changelog.mjs +1 -1
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +5 -5
- package/dist/testing/index.mjs +10 -10
- package/dist/testing/outboxStoreContract.mjs +14 -3
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{transactionContext-DMmvcfdo.mjs → transactionContext-DCWMI6hV.mjs} +1 -1
- package/dist/{typeGuards-DHTnEs5X.mjs → typeGuards-D7tHFdH6.mjs} +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-BqLyyH0o.mjs → types-CDy3-zw1.mjs} +4 -4
- package/dist/{types-LQFwC37d.d.mts → types-CWQn9-IC.d.mts} +46 -1
- package/dist/{types-BRU-Kd3t.d.mts → types-DfVDvkdP.d.mts} +20 -2
- package/dist/usage/index.d.mts +58 -2
- package/dist/usage/index.mjs +0 -0
- package/dist/{userHelpers-CXySQFRg.mjs → userHelpers-DDMOZ_Pm.mjs} +1 -1
- package/dist/utils/index.d.mts +110 -8
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-BbGG8XNT.mjs → utils-B-zj_b__.mjs} +61 -12
- package/dist/{validate-CidSeUrx.mjs → validate-R0G_JrnK.mjs} +2 -2
- package/dist/{versioning-B843jOYX.d.mts → versioning-D6JIK8Tk.d.mts} +58 -2
- package/dist/{versioning-C2r0eOZ4.mjs → versioning-DuVWcu-F.mjs} +3 -3
- package/dist/workScope-BhsWde4k.mjs +41 -0
- package/package.json +574 -565
- package/skills/arc/SKILL.md +8 -4
- package/skills/arc/references/mcp.md +20 -0
- package/skills/arc/references/production.md +94 -9
- package/skills/arc/references/testing.md +0 -12
- package/skills/arc-code-review/references/anti-patterns.md +1 -1
- package/skills/arc-code-review/references/migration-recipes.md +0 -60
- package/skills/arc-code-review/references/mongokit-migration.md +0 -27
- package/skills/arc-module-publishing/references/package-manifest.md +3 -1
- package/dist/rateLimitKey-CewdR-m6.mjs +0 -15
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as evaluatePermissionDecision } from "./authorizationDecision-
|
|
3
|
-
import { p as isArcError, t as ArcError } from "./errors-
|
|
4
|
-
import { n as requireSingleHeaderValue } from "./headers-
|
|
5
|
-
import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-
|
|
6
|
-
import { t as BaseController } from "./BaseController-
|
|
7
|
-
import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-
|
|
8
|
-
import { t as buildRequestScopeProjection } from "./projection-
|
|
9
|
-
import { i as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-
|
|
10
|
-
import { t as executePipeline } from "./pipe-
|
|
11
|
-
import { t as pluralize } from "./pluralize-
|
|
12
|
-
import { t as createIdempotencyResult } from "./interface-
|
|
13
|
-
import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-
|
|
14
|
-
import { n as validateAggregations } from "./validate-
|
|
15
|
-
import { n as executeAggregation } from "./buildHandler-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as evaluatePermissionDecision } from "./authorizationDecision-2YY_Kaj1.mjs";
|
|
3
|
+
import { p as isArcError, t as ArcError } from "./errors-C_YhELhe.mjs";
|
|
4
|
+
import { n as requireSingleHeaderValue } from "./headers-CNECDE6q.mjs";
|
|
5
|
+
import { b as isElevated, c as getOrgId, g as getUserId, x as isMember } from "./types-CDy3-zw1.mjs";
|
|
6
|
+
import { t as BaseController } from "./BaseController-DYJRZ0EJ.mjs";
|
|
7
|
+
import { a as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-BTyPLHK0.mjs";
|
|
8
|
+
import { t as buildRequestScopeProjection } from "./projection-Uvgp-EEj.mjs";
|
|
9
|
+
import { i as resolvePipelineSteps, t as resolveActionPermission } from "./actionPermissions-DPwPWPOV.mjs";
|
|
10
|
+
import { t as executePipeline } from "./pipe-CBVmUJ-j.mjs";
|
|
11
|
+
import { t as pluralize } from "./pluralize-2_U6QZQg.mjs";
|
|
12
|
+
import { t as createIdempotencyResult } from "./interface-BIpgzbZl.mjs";
|
|
13
|
+
import { r as shouldRejectAdditionalProperties, t as normalizeSchemaIR } from "./schemaIR-K16Bb5BX.mjs";
|
|
14
|
+
import { n as validateAggregations } from "./validate-R0G_JrnK.mjs";
|
|
15
|
+
import { n as executeAggregation } from "./buildHandler-CUhjGHGZ.mjs";
|
|
16
16
|
import { isHttpError, toErrorContract } from "@classytic/repo-core/errors";
|
|
17
17
|
import { createHash, randomUUID } from "node:crypto";
|
|
18
18
|
import fp from "fastify-plugin";
|
|
@@ -50,7 +50,7 @@ import { z } from "zod";
|
|
|
50
50
|
* @returns McpServer instance (not yet connected to a transport)
|
|
51
51
|
*/
|
|
52
52
|
async function createMcpServer(config, authRef) {
|
|
53
|
-
const { McpServer } = await import("@modelcontextprotocol/
|
|
53
|
+
const { McpServer } = await import("@modelcontextprotocol/server");
|
|
54
54
|
const server = new McpServer({
|
|
55
55
|
name: config.name,
|
|
56
56
|
version: config.version ?? "1.0.0"
|
|
@@ -130,25 +130,39 @@ function registerTool(server, tool, authRef) {
|
|
|
130
130
|
const config = {};
|
|
131
131
|
if (tool.title) config.title = tool.title;
|
|
132
132
|
if (tool.description) config.description = tool.description;
|
|
133
|
+
/**
|
|
134
|
+
* Flat SHAPES are passed straight through. v2's `registerTool` carries a
|
|
135
|
+
* `ZodRawShape` overload and auto-wraps it in `z.object()` itself, so arc's
|
|
136
|
+
* host-facing ergonomic (`{ name: z.string() }`) needs no adaptation layer.
|
|
137
|
+
*
|
|
138
|
+
* arc's own MIGRATION-V2 notes claimed v2 "requires z.object(), raw shapes no
|
|
139
|
+
* longer accepted" and a wrap was written here on that basis. That was true of
|
|
140
|
+
* the PRE-ALPHA and is not true of 2.0.0 — checked against the shipped
|
|
141
|
+
* overloads. Wrapping anyway would have been arc maintaining an adapter for a
|
|
142
|
+
* conversion the SDK already owns.
|
|
143
|
+
*/
|
|
133
144
|
if (tool.inputSchema) config.inputSchema = tool.inputSchema;
|
|
134
145
|
if (tool.outputSchema) config.outputSchema = tool.outputSchema;
|
|
135
146
|
if (tool.annotations) config.annotations = tool.annotations;
|
|
136
|
-
srv.registerTool(tool.name, config, (input,
|
|
147
|
+
srv.registerTool(tool.name, config, (input, mcpCtx) => {
|
|
137
148
|
const ctx = {
|
|
138
149
|
session: authRef?.current ?? null,
|
|
150
|
+
/**
|
|
151
|
+
* v2 exposes logging as `ctx.mcpReq.log(level, message)` — the SDK builds
|
|
152
|
+
* the `notifications/message` envelope and correlates it to the in-flight
|
|
153
|
+
* request. v1 handed over a raw `sendNotification` that arc had to frame
|
|
154
|
+
* itself; that hand-framed envelope carried no request id, so a log line
|
|
155
|
+
* from a tool arrived uncorrelated.
|
|
156
|
+
*
|
|
157
|
+
* Still best-effort: a transport that has already closed must not turn a
|
|
158
|
+
* successful tool call into a failed one.
|
|
159
|
+
*/
|
|
139
160
|
log: async (level, message) => {
|
|
140
161
|
try {
|
|
141
|
-
|
|
142
|
-
if (notify) await notify({
|
|
143
|
-
method: "notifications/message",
|
|
144
|
-
params: {
|
|
145
|
-
level,
|
|
146
|
-
data: message
|
|
147
|
-
}
|
|
148
|
-
});
|
|
162
|
+
await (mcpCtx?.mcpReq)?.log?.(level, message);
|
|
149
163
|
} catch {}
|
|
150
164
|
},
|
|
151
|
-
extra
|
|
165
|
+
extra: mcpCtx
|
|
152
166
|
};
|
|
153
167
|
return tool.handler(input, ctx);
|
|
154
168
|
});
|
|
@@ -2035,7 +2049,7 @@ function resourceToTools(resource, config = {}) {
|
|
|
2035
2049
|
*/
|
|
2036
2050
|
function registerSchemaResources(server, resources, overrides) {
|
|
2037
2051
|
const srv = server;
|
|
2038
|
-
srv.
|
|
2052
|
+
srv.registerResource("schemas", "arc://schemas", {
|
|
2039
2053
|
title: "Arc Resource Schemas",
|
|
2040
2054
|
description: "All available resources",
|
|
2041
2055
|
mimeType: "application/json"
|
|
@@ -2053,7 +2067,7 @@ function registerSchemaResources(server, resources, overrides) {
|
|
|
2053
2067
|
for (const r of resources) {
|
|
2054
2068
|
const uri = `arc://schemas/${r.name}`;
|
|
2055
2069
|
const schemaOpts = r.schemaOptions;
|
|
2056
|
-
srv.
|
|
2070
|
+
srv.registerResource(`schema-${r.name}`, uri, {
|
|
2057
2071
|
title: `${r.displayName} Schema`,
|
|
2058
2072
|
description: `Schema for ${r.displayName}`,
|
|
2059
2073
|
mimeType: "application/json"
|
|
@@ -2181,7 +2195,7 @@ var McpSessionCache = class {
|
|
|
2181
2195
|
closeTransport(entry) {
|
|
2182
2196
|
try {
|
|
2183
2197
|
const transport = entry.transport;
|
|
2184
|
-
if (transport && typeof transport.close === "function") transport.close();
|
|
2198
|
+
if (transport && typeof transport.close === "function") Promise.resolve(transport.close()).catch(() => {});
|
|
2185
2199
|
} catch {}
|
|
2186
2200
|
}
|
|
2187
2201
|
};
|
|
@@ -2219,9 +2233,9 @@ var McpSessionCache = class {
|
|
|
2219
2233
|
const mcpPluginImpl = async (fastify, options) => {
|
|
2220
2234
|
let StreamableHTTPServerTransport;
|
|
2221
2235
|
try {
|
|
2222
|
-
StreamableHTTPServerTransport = (await import("@modelcontextprotocol/
|
|
2236
|
+
StreamableHTTPServerTransport = (await import("@modelcontextprotocol/node")).NodeStreamableHTTPServerTransport;
|
|
2223
2237
|
} catch {
|
|
2224
|
-
throw new Error("@modelcontextprotocol/
|
|
2238
|
+
throw new Error("@modelcontextprotocol/server and @modelcontextprotocol/node are required for MCP support. Install them: npm install @modelcontextprotocol/server @modelcontextprotocol/node");
|
|
2225
2239
|
}
|
|
2226
2240
|
try {
|
|
2227
2241
|
await import("zod");
|
|
@@ -2286,6 +2300,36 @@ const mcpPluginImpl = async (fastify, options) => {
|
|
|
2286
2300
|
const more = allTools.length > 5 ? ` (+${allTools.length - 5} more)` : "";
|
|
2287
2301
|
fastify.log.warn(`[arc/mcp] MCP server registered at "${prefix}" with auth DISABLED. Anyone who can reach this URL has full access to ${allTools.length} tools across ${enabledResources.length} resources: ${toolList}${more}. Pass \`auth: betterAuthInstance\` or \`auth: async (headers) => ...\` to gate access. Safe only for stdio transports, local development, or explicitly-public read-only APIs.`);
|
|
2288
2302
|
}
|
|
2303
|
+
const rebindOption = options.dnsRebindingProtection;
|
|
2304
|
+
if (rebindOption === void 0 ? options.auth === false : rebindOption !== false) {
|
|
2305
|
+
const { validateHostHeader, validateOriginHeader, localhostAllowedHostnames } = await import("@modelcontextprotocol/server");
|
|
2306
|
+
const cfg = rebindOption === void 0 || rebindOption === false ? {} : rebindOption;
|
|
2307
|
+
const allowedHosts = cfg.allowedHosts ?? localhostAllowedHostnames();
|
|
2308
|
+
const allowedOrigins = cfg.allowedOrigins ?? allowedHosts;
|
|
2309
|
+
const healthPath = `${prefix}/health`;
|
|
2310
|
+
fastify.addHook("onRequest", async (request, reply) => {
|
|
2311
|
+
if (!request.url.startsWith(prefix)) return;
|
|
2312
|
+
if (request.url.split("?")[0] === healthPath) return;
|
|
2313
|
+
const host = validateHostHeader(request.headers.host, allowedHosts);
|
|
2314
|
+
if (!host.ok) return reply.code(403).send({
|
|
2315
|
+
jsonrpc: "2.0",
|
|
2316
|
+
error: {
|
|
2317
|
+
code: -32e3,
|
|
2318
|
+
message: host.message
|
|
2319
|
+
},
|
|
2320
|
+
id: null
|
|
2321
|
+
});
|
|
2322
|
+
const origin = validateOriginHeader(request.headers.origin, allowedOrigins);
|
|
2323
|
+
if (!origin.ok) return reply.code(403).send({
|
|
2324
|
+
jsonrpc: "2.0",
|
|
2325
|
+
error: {
|
|
2326
|
+
code: -32e3,
|
|
2327
|
+
message: origin.message
|
|
2328
|
+
},
|
|
2329
|
+
id: null
|
|
2330
|
+
});
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2289
2333
|
fastify.get(`${prefix}/health`, async (request, reply) => {
|
|
2290
2334
|
const liveness = {
|
|
2291
2335
|
status: "ok",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DjDuyglE.mjs";
|
|
3
3
|
//#region src/cache/memory.ts
|
|
4
4
|
var memory_exports = /* @__PURE__ */ __exportAll({ MemoryCacheStore: () => MemoryCacheStore });
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DjDuyglE.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/plugins/metrics.ts
|
|
5
5
|
var metrics_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-
|
|
2
|
+
import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-DHbyPo5j.mjs";
|
|
3
3
|
import { RouteHandlerMethod } from "fastify";
|
|
4
4
|
//#region src/middleware/middleware.d.ts
|
|
5
5
|
interface NamedMiddleware {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as CRUD_OPERATIONS } from "../constants-
|
|
3
|
-
import { t as multipartBody } from "../multipartBody-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CRUD_OPERATIONS } from "../constants-BxLgNFF7.mjs";
|
|
3
|
+
import { t as multipartBody } from "../multipartBody-C92aJ8am.mjs";
|
|
4
4
|
//#region src/middleware/middleware.ts
|
|
5
5
|
/**
|
|
6
6
|
* Named Middleware — Priority-based, conditional middleware execution.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as startRenewingLease } from "../renewingLease-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as startRenewingLease } from "../renewingLease-B3VYh5aU.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/migrations/index.ts
|
|
5
5
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as getUserRoles } from "./userHelpers-
|
|
3
|
-
import { n as convertRouteSchema } from "./schemaConverter-
|
|
4
|
-
import { t as resolveActionPermission } from "./actionPermissions-
|
|
5
|
-
import { t as pluralize } from "./pluralize-
|
|
6
|
-
import { t as buildActionBodySchema } from "./createActionRouter-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as getUserRoles } from "./userHelpers-DDMOZ_Pm.mjs";
|
|
3
|
+
import { n as convertRouteSchema } from "./schemaConverter-BLCSmNbr.mjs";
|
|
4
|
+
import { t as resolveActionPermission } from "./actionPermissions-DPwPWPOV.mjs";
|
|
5
|
+
import { t as pluralize } from "./pluralize-2_U6QZQg.mjs";
|
|
6
|
+
import { t as buildActionBodySchema } from "./createActionRouter-BBlbPs3k.mjs";
|
|
7
7
|
import fp from "fastify-plugin";
|
|
8
8
|
//#region src/docs/openapi/canonical-schemas.ts
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { l as PermissionCheck } from "../base-
|
|
3
|
-
import { t as ArcModule } from "../types-
|
|
2
|
+
import { l as PermissionCheck } from "../base-CxrV1LmG.mjs";
|
|
3
|
+
import { t as ArcModule } from "../types-DfVDvkdP.mjs";
|
|
4
4
|
import { OutboxStore } from "@classytic/primitives/outbox";
|
|
5
5
|
//#region src/outbox-admin/module.d.ts
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { i as NotFoundError, u as ValidationError } from "../errors-
|
|
3
|
-
import { t as defineResource } from "../defineResource-
|
|
4
|
-
import { n as getModuleExports, t as defineModule } from "../module-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { i as NotFoundError, u as ValidationError } from "../errors-C_YhELhe.mjs";
|
|
3
|
+
import { t as defineResource } from "../defineResource-DzGT-2LP.mjs";
|
|
4
|
+
import { n as getModuleExports, t as defineModule } from "../module-BkQEesNQ.mjs";
|
|
5
5
|
//#region src/outbox-admin/module.ts
|
|
6
6
|
/**
|
|
7
7
|
* Strip the domain payload and the stack unless explicitly opted in.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-
|
|
3
|
-
import { t as ArcModule } from "./types-
|
|
2
|
+
import { a as EventTransport, n as DomainEvent, t as DeadLetteredEvent } from "./EventTransport-CbUKDzZZ.mjs";
|
|
3
|
+
import { t as ArcModule } from "./types-DfVDvkdP.mjs";
|
|
4
4
|
import { FastifyInstance } from "fastify";
|
|
5
5
|
import { MemoryOutboxStore } from "@classytic/primitives/memory-outbox";
|
|
6
6
|
import { OutboxFailurePolicy, OutboxStore, OutboxWriteOptions } from "@classytic/primitives/outbox";
|
|
@@ -372,6 +372,19 @@ interface OutboxModuleExports {
|
|
|
372
372
|
store: OutboxStore;
|
|
373
373
|
/** The relay, for a host that wants to drain on demand (tests, admin actions). */
|
|
374
374
|
relay: EventOutbox;
|
|
375
|
+
/**
|
|
376
|
+
* Ask for a relay pass SOON, without waiting for the interval. Coalesced:
|
|
377
|
+
* any number of calls before the pass runs produce ONE pass. Never throws
|
|
378
|
+
* and returns nothing — a unit of work calls this after commit so a row it
|
|
379
|
+
* just wrote is delivered in milliseconds rather than up to `relayEveryMs`
|
|
380
|
+
* later. Safe under concurrency: the store's lease and fence token make an
|
|
381
|
+
* extra pass a no-op, not a double publish.
|
|
382
|
+
*
|
|
383
|
+
* Calling from inside a request does NOT put the pass in that request's
|
|
384
|
+
* scope: a pass drains whatever is pending, which is other requests' rows.
|
|
385
|
+
* The pass runs scope-free, so each event opens its own (see `runWorkScope`).
|
|
386
|
+
*/
|
|
387
|
+
requestDrain: () => void;
|
|
375
388
|
}
|
|
376
389
|
/**
|
|
377
390
|
* Compose the outbox as a module.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as transactionContext } from "./transactionContext-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as transactionContext } from "./transactionContext-DCWMI6hV.mjs";
|
|
3
|
+
import { n as requestContext } from "./requestContext-cSVKnYPk.mjs";
|
|
4
|
+
import { i as resolveEventTransport } from "./EventTransport-n7qO5Cz3.mjs";
|
|
5
|
+
import { n as createSafeGetOne, t as createIsDuplicateKeyError } from "./store-helpers-9DX9-1j_.mjs";
|
|
5
6
|
import { and, anyOf, eq, lte, ne, or } from "@classytic/repo-core/filter";
|
|
6
7
|
import { randomBytes } from "node:crypto";
|
|
7
8
|
import { InvalidOutboxEventError, OutboxOwnershipError } from "@classytic/primitives/outbox";
|
|
@@ -807,25 +808,46 @@ function createOutboxModule(options) {
|
|
|
807
808
|
* module exists to prevent, arrived at from the other side.
|
|
808
809
|
*/
|
|
809
810
|
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.`);
|
|
811
|
+
const relay = new EventOutbox({
|
|
812
|
+
store,
|
|
813
|
+
transport,
|
|
814
|
+
...options.batchSize !== void 0 ? { batchSize: options.batchSize } : {},
|
|
815
|
+
...options.leaseMs !== void 0 ? { leaseMs: options.leaseMs } : {},
|
|
816
|
+
consumerId: options.consumerId ?? mintConsumerId(name),
|
|
817
|
+
onError: options.onError ?? ((info) => {
|
|
818
|
+
fastify.log.error({
|
|
819
|
+
err: info.error,
|
|
820
|
+
kind: info.kind,
|
|
821
|
+
...info.event?.meta.id !== void 0 ? { eventId: info.event.meta.id } : {},
|
|
822
|
+
...info.event?.type !== void 0 ? { eventType: info.event.type } : {}
|
|
823
|
+
}, `outbox relay "${name}" failed`);
|
|
824
|
+
}),
|
|
825
|
+
...options.failurePolicy !== void 0 ? { failurePolicy: options.failurePolicy } : {},
|
|
826
|
+
...options.sessionProvider === false ? {} : { sessionProvider: options.sessionProvider ?? (() => transactionContext.get()) }
|
|
827
|
+
});
|
|
828
|
+
/**
|
|
829
|
+
* One pass per burst of requests. `drainQueued` stays true from the
|
|
830
|
+
* first request until the pass STARTS, so a request landing mid-pass
|
|
831
|
+
* schedules the next one — a row written during a pass is never left
|
|
832
|
+
* waiting for the interval.
|
|
833
|
+
*/
|
|
834
|
+
let drainQueued = false;
|
|
835
|
+
const requestDrain = () => {
|
|
836
|
+
if (drainQueued) return;
|
|
837
|
+
drainQueued = true;
|
|
838
|
+
setImmediate(() => {
|
|
839
|
+
drainQueued = false;
|
|
840
|
+
requestContext.storage.exit(() => {
|
|
841
|
+
relay.relayBatch().catch((err) => {
|
|
842
|
+
fastify.log.error({ err }, `outbox relay "${name}" requested drain failed`);
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
});
|
|
846
|
+
};
|
|
810
847
|
exports = {
|
|
811
848
|
store,
|
|
812
|
-
relay
|
|
813
|
-
|
|
814
|
-
transport,
|
|
815
|
-
...options.batchSize !== void 0 ? { batchSize: options.batchSize } : {},
|
|
816
|
-
...options.leaseMs !== void 0 ? { leaseMs: options.leaseMs } : {},
|
|
817
|
-
consumerId: options.consumerId ?? mintConsumerId(name),
|
|
818
|
-
onError: options.onError ?? ((info) => {
|
|
819
|
-
fastify.log.error({
|
|
820
|
-
err: info.error,
|
|
821
|
-
kind: info.kind,
|
|
822
|
-
...info.event?.meta.id !== void 0 ? { eventId: info.event.meta.id } : {},
|
|
823
|
-
...info.event?.type !== void 0 ? { eventType: info.event.type } : {}
|
|
824
|
-
}, `outbox relay "${name}" failed`);
|
|
825
|
-
}),
|
|
826
|
-
...options.failurePolicy !== void 0 ? { failurePolicy: options.failurePolicy } : {},
|
|
827
|
-
...options.sessionProvider === false ? {} : { sessionProvider: options.sessionProvider ?? (() => transactionContext.get()) }
|
|
828
|
-
})
|
|
849
|
+
relay,
|
|
850
|
+
requestDrain
|
|
829
851
|
};
|
|
830
852
|
return exports;
|
|
831
853
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { c as DataPolicy, d as UserBase, l as PermissionCheck, m as normalizeRoles, p as getUserRoles, s as AuthorizationDecision, u as PermissionContext } from "../base-
|
|
2
|
+
import { c as DataPolicy, d as UserBase, l as PermissionCheck, m as normalizeRoles, p as getUserRoles, s as AuthorizationDecision, u as PermissionContext } from "../base-CxrV1LmG.mjs";
|
|
3
3
|
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, r as FieldPermissionType, s as resolveEffectiveRoles, t as FieldPermission } from "../fields-I_EeRWND.mjs";
|
|
4
|
-
import { $ as requireAuth, A as RequireGrantOptions, B as ConnectEventsOptions, C as requireServiceScope, D as GRANT_MODES, E as createRoleHierarchy, F as PermissionRequirement, G as createOrgPermissions, H as DynamicPermissionMatrixConfig, I as collectPublicSurface, J as allowPublic, K as allOf, L as describePermission, M as requireGrant, N as conjoinPolicyFilters, O as GrantMode, P as AccessExplanation, Q as not, R as describePermissionMap, S as requireScopeContext, T as RoleHierarchy, U as PermissionEventBus, V as DynamicPermissionMatrix, W as createDynamicPermissionMatrix, X as deny, Y as anyOf, Z as denyAll, _ as publicReadAdminWrite, a as PermissionMatrixRegistry, at as scopeOf, b as requireOrgMembership, c as introspectModule, ct as evaluatePermissionDecision, d as authenticated, dt as RequireMandateOptions, et as requireOwnership, f as fullPublic, ft as requireAgentScope, g as publicRead, h as presets_d_exports, i as PermissionMatrixOptions, it as when, j as modeSatisfies, k as GrantResolution, l as introspectRegistry, lt as normalizeToDecision, m as permissionMatrix, mt as requireMandate, n as PermissionEntryType, nt as requireRoles, o as buildPermissionMatrix, ot as PermissionCheckReturn, p as ownerWithAdminBypass, pt as requireDPoP, q as allow, r as PermissionMatrix, rt as roles, s as introspectCheck, st as applyAuthorizationDecision, t as PermissionEntry, tt as requirePlatformRole, u as adminOnly, ut as RequireAgentScopeOptions, v as readOnly, w as requireTeamMembership, x as requireOrgRole, y as requireOrgInScope, z as explainAccess } from "../index-
|
|
4
|
+
import { $ as requireAuth, A as RequireGrantOptions, B as ConnectEventsOptions, C as requireServiceScope, D as GRANT_MODES, E as createRoleHierarchy, F as PermissionRequirement, G as createOrgPermissions, H as DynamicPermissionMatrixConfig, I as collectPublicSurface, J as allowPublic, K as allOf, L as describePermission, M as requireGrant, N as conjoinPolicyFilters, O as GrantMode, P as AccessExplanation, Q as not, R as describePermissionMap, S as requireScopeContext, T as RoleHierarchy, U as PermissionEventBus, V as DynamicPermissionMatrix, W as createDynamicPermissionMatrix, X as deny, Y as anyOf, Z as denyAll, _ as publicReadAdminWrite, a as PermissionMatrixRegistry, at as scopeOf, b as requireOrgMembership, c as introspectModule, ct as evaluatePermissionDecision, d as authenticated, dt as RequireMandateOptions, et as requireOwnership, f as fullPublic, ft as requireAgentScope, g as publicRead, h as presets_d_exports, i as PermissionMatrixOptions, it as when, j as modeSatisfies, k as GrantResolution, l as introspectRegistry, lt as normalizeToDecision, m as permissionMatrix, mt as requireMandate, n as PermissionEntryType, nt as requireRoles, o as buildPermissionMatrix, ot as PermissionCheckReturn, p as ownerWithAdminBypass, pt as requireDPoP, q as allow, r as PermissionMatrix, rt as roles, s as introspectCheck, st as applyAuthorizationDecision, t as PermissionEntry, tt as requirePlatformRole, u as adminOnly, ut as RequireAgentScopeOptions, v as readOnly, w as requireTeamMembership, x as requireOrgRole, y as requireOrgInScope, z as explainAccess } from "../index-BHdZD8zK.mjs";
|
|
5
5
|
export { type AccessExplanation, type AuthorizationDecision, type ConnectEventsOptions, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type FieldPermission, type FieldPermissionMap, type FieldPermissionType, GRANT_MODES, type GrantMode, type GrantResolution, type PermissionCheck, type PermissionCheckReturn, type PermissionContext, type PermissionEntry, type PermissionEntryType, type PermissionEventBus, type PermissionMatrix, type PermissionMatrixOptions, type PermissionMatrixRegistry, type PermissionRequirement, type RequireAgentScopeOptions, type RequireGrantOptions, type RequireMandateOptions, type RoleHierarchy, type UserBase, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, scopeOf, when };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as conjoinPolicyFilters, i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-
|
|
3
|
-
import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-
|
|
4
|
-
import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-
|
|
5
|
-
import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as conjoinPolicyFilters, i as normalizeToDecision, r as evaluatePermissionDecision, t as applyAuthorizationDecision } from "../authorizationDecision-2YY_Kaj1.mjs";
|
|
3
|
+
import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-DDMOZ_Pm.mjs";
|
|
4
|
+
import { a as resolveEffectiveRoles, i as fields, n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-BTyPLHK0.mjs";
|
|
5
|
+
import { A as requireAgentScope, B as requireAuth, C as createOrgPermissions, D as requireScopeContext, E as requireOrgRole, F as allowPublic, G as when, H as requirePlatformRole, I as anyOf, K as scopeOf, L as deny, M as requireMandate, N as allOf, O as requireServiceScope, P as allow, R as denyAll, S as createDynamicPermissionMatrix, T as requireOrgMembership, U as requireRoles, V as requireOwnership, W as roles, _ as requireGrant, a as adminOnly, b as describePermissionMap, c as ownerWithAdminBypass, d as publicRead, f as publicReadAdminWrite, g as modeSatisfies, h as GRANT_MODES, i as introspectRegistry, j as requireDPoP, k as requireTeamMembership, l as permissionMatrix, m as createRoleHierarchy, n as introspectCheck, o as authenticated, p as readOnly, r as introspectModule, s as fullPublic, t as buildPermissionMatrix, u as presets_exports, v as collectPublicSurface, w as requireOrgInScope, x as explainAccess, y as describePermission, z as not } from "../permissions-DiHXy8Ck.mjs";
|
|
6
6
|
export { GRANT_MODES, adminOnly, allOf, allow, allowPublic, anyOf, applyAuthorizationDecision, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, buildPermissionMatrix, collectPublicSurface, conjoinPolicyFilters, createDynamicPermissionMatrix, createOrgPermissions, createRoleHierarchy, deny, denyAll, describePermission, describePermissionMap, evaluatePermissionDecision, explainAccess, fields, fullPublic, getUserRoles, introspectCheck, introspectModule, introspectRegistry, modeSatisfies, normalizeRoles, normalizeToDecision, not, ownerWithAdminBypass, permissionMatrix, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAgentScope, requireAuth, requireDPoP, requireGrant, requireMandate, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requirePlatformRole, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, resolveEffectiveRoles, roles, scopeOf, when };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DjDuyglE.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
|
-
import { a as conjoinPolicyFilters, i as normalizeToDecision } from "./authorizationDecision-
|
|
5
|
-
import { n as getUserRoles } from "./userHelpers-
|
|
6
|
-
import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-
|
|
7
|
-
import {
|
|
4
|
+
import { a as conjoinPolicyFilters, i as normalizeToDecision } from "./authorizationDecision-2YY_Kaj1.mjs";
|
|
5
|
+
import { n as getUserRoles } from "./userHelpers-DDMOZ_Pm.mjs";
|
|
6
|
+
import { C as isService, S as isOrgInScope, a as getDPoPJkt, b as isElevated, d as getScopeContext, f as getScopeContextMap, g as getUserId, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, u as getRequestScope, v as hasOrgAccess, x as isMember } from "./types-CDy3-zw1.mjs";
|
|
7
|
+
import { n as declareRuntimeCapability } from "./runtimeCapabilities-DSA_dH1_.mjs";
|
|
8
|
+
import { t as MemoryCacheStore } from "./memory-CpDZ9NPw.mjs";
|
|
8
9
|
import { randomUUID } from "node:crypto";
|
|
9
10
|
//#region src/permissions/context.ts
|
|
10
11
|
/**
|
|
@@ -871,6 +872,11 @@ function createDynamicPermissionMatrix(config) {
|
|
|
871
872
|
maxEntries: config.cache?.maxEntries ?? 1e3
|
|
872
873
|
}) : void 0;
|
|
873
874
|
const cacheStore = config.cacheStore ?? internalStore;
|
|
875
|
+
if (config.fastify && cacheStore) declareRuntimeCapability(config.fastify, {
|
|
876
|
+
subsystem: "permissions.dynamic-cache",
|
|
877
|
+
durability: internalStore ? "memory" : "shared",
|
|
878
|
+
detail: "internal MemoryCacheStore: a role change invalidates on this replica only"
|
|
879
|
+
});
|
|
874
880
|
const trackedKeys = /* @__PURE__ */ new Set();
|
|
875
881
|
const orgKeyIndex = /* @__PURE__ */ new Map();
|
|
876
882
|
const maxTrackedKeys = config.cache?.maxEntries ?? 1e4;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { r as ForbiddenError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as ForbiddenError } from "./errors-C_YhELhe.mjs";
|
|
3
3
|
//#region src/pipeline/pipe.ts
|
|
4
4
|
/**
|
|
5
5
|
* Compose pipeline steps into an ordered array.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { Ct as PipelineStep, Fn as IControllerResponse, St as PipelineContext, _t as Guard, bt as OperationFilter, vt as Interceptor, wt as Transform, xt as PipelineConfig, yt as NextFunction } from "../index-
|
|
2
|
+
import { Ct as PipelineStep, Fn as IControllerResponse, St as PipelineContext, _t as Guard, bt as OperationFilter, vt as Interceptor, wt as Transform, xt as PipelineConfig, yt as NextFunction } from "../index-DHbyPo5j.mjs";
|
|
3
3
|
//#region src/pipeline/guard.d.ts
|
|
4
4
|
interface GuardOptions {
|
|
5
5
|
operations?: OperationFilter;
|
package/dist/pipeline/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as pipe, t as executePipeline } from "../pipe-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as pipe, t as executePipeline } from "../pipe-CBVmUJ-j.mjs";
|
|
3
3
|
//#region src/pipeline/guard.ts
|
|
4
4
|
/**
|
|
5
5
|
* Create a named guard.
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import { t as AnyRecord } from "../base-
|
|
3
|
-
import { At as RouteDefinition, J as PresetHook, Q as MiddlewareConfig, et as RouteSchemaOptions } from "../index-
|
|
4
|
-
import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler
|
|
5
|
-
import { _ as HealthCheck, b as healthPlugin, f as ScheduleDefinition, g as schedulesPlugin, h as _default$8, m as SchedulesPluginOptions, p as ScheduleStats, v as HealthOptions, y as _default$3 } from "../types-
|
|
6
|
-
import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-
|
|
7
|
-
import { _ as CachingRule, a as MetricsCollector, c as metricsPlugin, d as _default$6, f as realtimePlugin, g as CachingOptions, h as ssePlugin, i as MetricEntry, l as ChangeOperation, m as _default$9, n as _default$10, o as MetricsOptions, p as SSEOptions, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as RealtimeOptions, v as _default$1, y as cachingPlugin } from "../versioning-
|
|
2
|
+
import { t as AnyRecord } from "../base-CxrV1LmG.mjs";
|
|
3
|
+
import { At as RouteDefinition, J as PresetHook, Q as MiddlewareConfig, et as RouteSchemaOptions } from "../index-DHbyPo5j.mjs";
|
|
4
|
+
import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler--4rSMMvq.mjs";
|
|
5
|
+
import { _ as HealthCheck, b as healthPlugin, f as ScheduleDefinition, g as schedulesPlugin, h as _default$8, m as SchedulesPluginOptions, p as ScheduleStats, v as HealthOptions, y as _default$3 } from "../types-DfVDvkdP.mjs";
|
|
6
|
+
import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-Cq2nHVaW.mjs";
|
|
7
|
+
import { C as gracefulShutdownPlugin, S as _default$2, _ as CachingRule, a as MetricsCollector, b as GracefulShutdownOptions, c as metricsPlugin, d as _default$6, f as realtimePlugin, g as CachingOptions, h as ssePlugin, i as MetricEntry, l as ChangeOperation, m as _default$9, n as _default$10, o as MetricsOptions, p as SSEOptions, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as RealtimeOptions, v as _default$1, x as ShutdownState, y as cachingPlugin } from "../versioning-D6JIK8Tk.mjs";
|
|
8
8
|
import { t as TracingOptions } from "../tracing-Dro5eH6j.mjs";
|
|
9
9
|
import { PaginatedResult } from "@classytic/repo-core/pagination";
|
|
10
10
|
import { FastifyInstance, FastifyPluginAsync } from "fastify";
|
|
@@ -59,36 +59,6 @@ interface ArcPlugin<TRootOpts extends AnyRecord = AnyRecord, TResourceOpts exten
|
|
|
59
59
|
*/
|
|
60
60
|
declare function createPlugin<TRootOpts extends AnyRecord = AnyRecord, TResourceOpts extends AnyRecord = AnyRecord>(name: string, definition: CreatePluginDefinition<TRootOpts, TResourceOpts>): ArcPlugin<TRootOpts, TResourceOpts>;
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region src/plugins/gracefulShutdown.d.ts
|
|
63
|
-
interface GracefulShutdownOptions {
|
|
64
|
-
/** Maximum time to wait for graceful shutdown in ms (default: 30000) */
|
|
65
|
-
timeout?: number;
|
|
66
|
-
/** Custom cleanup function called before exit */
|
|
67
|
-
onShutdown?: () => Promise<void> | void;
|
|
68
|
-
/** Signals to handle (default: ['SIGTERM', 'SIGINT']) */
|
|
69
|
-
signals?: NodeJS.Signals[];
|
|
70
|
-
/** Whether to log shutdown events (default: true) */
|
|
71
|
-
logEvents?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Called when shutdown times out or encounters an error.
|
|
74
|
-
* Defaults to `process.exit(1)` — appropriate for production but dangerous in:
|
|
75
|
-
* - **Tests**: kills the test runner. Pass `() => {}` or `() => { throw … }`.
|
|
76
|
-
* - **Shared runtimes** (e.g., serverless): may kill unrelated handlers.
|
|
77
|
-
*
|
|
78
|
-
* @param reason - `'timeout'` if shutdown exceeded `timeout` ms,
|
|
79
|
-
* `'error'` if `onShutdown` or `fastify.close()` threw.
|
|
80
|
-
*/
|
|
81
|
-
onForceExit?: (reason: "timeout" | "error") => void;
|
|
82
|
-
}
|
|
83
|
-
declare const gracefulShutdownPlugin: FastifyPluginAsync<GracefulShutdownOptions>;
|
|
84
|
-
declare module "fastify" {
|
|
85
|
-
interface FastifyInstance {
|
|
86
|
-
/** Trigger graceful shutdown manually */
|
|
87
|
-
shutdown: () => Promise<void>;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
declare const _default$2: FastifyPluginAsync<GracefulShutdownOptions>;
|
|
91
|
-
//#endregion
|
|
92
62
|
//#region src/plugins/pressure.d.ts
|
|
93
63
|
/**
|
|
94
64
|
* One measurable source of load, normalised by whoever owns it.
|
|
@@ -253,4 +223,4 @@ declare function createRequestIdGenerator(opts?: Pick<RequestIdOptions, "header"
|
|
|
253
223
|
declare const requestIdPlugin: FastifyPluginAsync<RequestIdOptions>;
|
|
254
224
|
declare const _default$7: FastifyPluginAsync<RequestIdOptions>;
|
|
255
225
|
//#endregion
|
|
256
|
-
export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type ChangeOperation, type CreatePluginDefinition, type ErrorHandlerOptions, type ErrorMapper, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type PressureApi, type PressureOptions, type PressureSignal, type PressureSnapshot, type PressureState, type PressureThresholds, type RealtimeOptions, type RequestIdOptions, type SSEOptions, type ScheduleDefinition, type ScheduleStats, type SchedulesPluginOptions, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, arcCorePlugin as arcCorePluginFn, _default$1 as cachingPlugin, cachingPlugin as cachingPluginFn, createPlugin, createRequestIdGenerator, defaultIsDuplicateKeyError, errorHandlerPlugin, errorHandlerPlugin as errorHandlerPluginFn, _default$2 as gracefulShutdownPlugin, gracefulShutdownPlugin as gracefulShutdownPluginFn, _default$3 as healthPlugin, healthPlugin as healthPluginFn, _default$4 as metricsPlugin, metricsPlugin as metricsPluginFn, _default$5 as pressurePlugin, pressurePlugin as pressurePluginFn, _default$6 as realtimePlugin, realtimePlugin as realtimePluginFn, replyHelpersPlugin, _default$7 as requestIdPlugin, requestIdPlugin as requestIdPluginFn, sanitizeRequestId, _default$8 as schedulesPlugin, schedulesPlugin as schedulesPluginFn, _default$9 as ssePlugin, ssePlugin as ssePluginFn, _default$10 as versioningPlugin, versioningPlugin as versioningPluginFn };
|
|
226
|
+
export { type ArcCore, type ArcCorePluginOptions, type ArcPlugin, type CachingOptions, type CachingRule, type ChangeOperation, type CreatePluginDefinition, type ErrorHandlerOptions, type ErrorMapper, type GracefulShutdownOptions, type HealthCheck, type HealthOptions, type MetricEntry, type MetricsCollector, type MetricsOptions, type PluginMeta, type PluginResourceResult, type PressureApi, type PressureOptions, type PressureSignal, type PressureSnapshot, type PressureState, type PressureThresholds, type RealtimeOptions, type RequestIdOptions, type SSEOptions, type ScheduleDefinition, type ScheduleStats, type SchedulesPluginOptions, type ShutdownState, type TracingOptions, type VersioningOptions, _default as arcCorePlugin, arcCorePlugin as arcCorePluginFn, _default$1 as cachingPlugin, cachingPlugin as cachingPluginFn, createPlugin, createRequestIdGenerator, defaultIsDuplicateKeyError, errorHandlerPlugin, errorHandlerPlugin as errorHandlerPluginFn, _default$2 as gracefulShutdownPlugin, gracefulShutdownPlugin as gracefulShutdownPluginFn, _default$3 as healthPlugin, healthPlugin as healthPluginFn, _default$4 as metricsPlugin, metricsPlugin as metricsPluginFn, _default$5 as pressurePlugin, pressurePlugin as pressurePluginFn, _default$6 as realtimePlugin, realtimePlugin as realtimePluginFn, replyHelpersPlugin, _default$7 as requestIdPlugin, requestIdPlugin as requestIdPluginFn, sanitizeRequestId, _default$8 as schedulesPlugin, schedulesPlugin as schedulesPluginFn, _default$9 as ssePlugin, ssePlugin as ssePluginFn, _default$10 as versioningPlugin, versioningPlugin as versioningPluginFn };
|