@classytic/arc 2.30.0 → 2.32.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/LICENSE +1 -1
- package/README.md +7 -0
- package/TRADEMARK.md +22 -0
- package/dist/{BaseController-B5DwufbB.mjs → BaseController-Dk34dxhI.mjs} +21 -19
- package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
- package/dist/{EventTransport-C6YA8xY9.mjs → EventTransport-BV10D0oG.mjs} +1 -0
- package/dist/{HookSystem-WkIougo6.mjs → HookSystem-vimw5D7Z.mjs} +2 -1
- package/dist/{QueryCache-DOMT_iq7.d.mts → QueryCache-DFA-QrU9.d.mts} +2 -1
- package/dist/{ResourceRegistry-y9Hnypus.mjs → ResourceRegistry-BVr7PgA0.mjs} +18 -15
- package/dist/{actionPermissions-CAphcmUG.mjs → actionPermissions-Dti7ebyv.mjs} +1 -0
- package/dist/audit/index.d.mts +3 -2
- package/dist/audit/index.mjs +2 -1
- package/dist/auth/audit.d.mts +1 -0
- package/dist/auth/audit.mjs +1 -0
- package/dist/auth/index.d.mts +5 -4
- package/dist/auth/index.mjs +11 -9
- package/dist/auth/redis-session.d.mts +2 -1
- package/dist/auth/redis-session.mjs +1 -0
- package/dist/{applyPermissionResult-Cf6zUCvb.mjs → authorizationDecision-__T3EJDA.mjs} +19 -10
- package/dist/{buildHandler-BYS3Vkfz.mjs → buildHandler-Dn7rzUJo.mjs} +6 -4
- package/dist/cache/index.d.mts +4 -3
- package/dist/cache/index.mjs +4 -3
- package/dist/{caching-_NJeDd1_.mjs → caching-DFJqHyFs.mjs} +2 -1
- package/dist/cleanup/index.d.mts +39 -16
- package/dist/cleanup/index.mjs +50 -38
- package/dist/cli/commands/describe.d.mts +2 -1
- package/dist/cli/commands/describe.mjs +4 -5
- package/dist/cli/commands/docs.d.mts +1 -0
- package/dist/cli/commands/docs.mjs +3 -2
- package/dist/cli/commands/doctor.d.mts +1 -0
- package/dist/cli/commands/doctor.mjs +1 -0
- package/dist/cli/commands/generate.d.mts +2 -1
- package/dist/cli/commands/generate.mjs +2 -1
- package/dist/cli/commands/init.d.mts +2 -1
- package/dist/cli/commands/init.mjs +2 -1
- package/dist/cli/commands/introspect.d.mts +1 -0
- package/dist/cli/commands/introspect.mjs +2 -1
- package/dist/cli/index.d.mts +3 -2
- package/dist/cli/index.mjs +3 -2
- package/dist/{constants-DNre0wRg.mjs → constants-J99LGTJI.mjs} +1 -0
- package/dist/context/index.d.mts +1 -0
- package/dist/context/index.mjs +3 -2
- package/dist/core/index.d.mts +3 -2
- package/dist/core/index.mjs +7 -6
- package/dist/{core-poalJLvp.mjs → core-BwwmNSp7.mjs} +3 -2
- package/dist/{createActionRouter-BxuywVRB.mjs → createActionRouter-DkJZWo0m.mjs} +14 -10
- package/dist/{createAggregationRouter-BiY-lGdY.mjs → createAggregationRouter-B1exOVD8.mjs} +10 -7
- package/dist/{createApp-CXrKFciH.mjs → createApp-Bv0m-Q6_.mjs} +625 -229
- package/dist/{defineAggregation-ufWjUwml.mjs → defineAggregation-gX4No1gt.mjs} +1 -0
- package/dist/{defineResource-CxWqDCAy.mjs → defineResource-XFPPUu2c.mjs} +84 -50
- package/dist/discovery/index.d.mts +1 -0
- package/dist/discovery/index.mjs +1 -0
- package/dist/docs/index.d.mts +3 -2
- package/dist/docs/index.mjs +3 -2
- package/dist/{elevation-C9s5hFP_.d.mts → elevation-BXCfVcNG.d.mts} +1 -0
- package/dist/{elevation-CIz1GjGm.mjs → elevation-DNXXxgjl.mjs} +4 -3
- package/dist/encryption/index.d.mts +2 -1
- package/dist/encryption/index.mjs +5 -3
- package/dist/{errorHandler-Bq2OeEQL.mjs → errorHandler-B2AZUJUj.mjs} +3 -2
- package/dist/{errorHandler-C6yv4ZTW.d.mts → errorHandler-CpYUJmPA.d.mts} +1 -0
- package/dist/{errors-DHcHVAgk.d.mts → errors-BGdVwP25.d.mts} +1 -0
- package/dist/{errors-DkO8Nk6-.mjs → errors-Bh1KK5ps.mjs} +1 -0
- package/dist/{eventPlugin-D2NNR4py.mjs → eventPlugin-Dk_TyXeE.mjs} +8 -6
- package/dist/{eventPlugin-Bg3cP2_u.d.mts → eventPlugin-GF5nnBIq.d.mts} +2 -1
- package/dist/events/index.d.mts +112 -44
- package/dist/events/index.mjs +177 -141
- package/dist/events/transports/redis-stream-entry.d.mts +2 -1
- package/dist/events/transports/redis-stream-entry.mjs +14 -9
- package/dist/events/transports/redis.d.mts +2 -1
- package/dist/events/transports/redis.mjs +1 -0
- package/dist/{externalPaths-BE6wFpYv.d.mts → externalPaths-CmGOxOtD.d.mts} +1 -0
- package/dist/factory/index.d.mts +9 -5
- package/dist/factory/index.mjs +131 -7
- package/dist/fastify-augmentation-BppG5bMT.d.mts +179 -0
- package/dist/{fields-CQ_7KQWw.mjs → fields-DEi65pGj.mjs} +6 -10
- package/dist/{fields-D3lhgzhD.d.mts → fields-I_EeRWND.d.mts} +1 -0
- package/dist/{generate-D0wZupBg.mjs → generate-CRSG0jTv.mjs} +2 -1
- package/dist/{generate-BnsL9GBm.d.mts → generate-DCGuEbqI.d.mts} +1 -0
- package/dist/{headers-BvlQSDMB.mjs → headers-BXjQYbeC.mjs} +2 -1
- package/dist/{health-CB_m4S32.mjs → health-5XnTa2uo.mjs} +1 -0
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/index.mjs +2 -1
- package/dist/idempotency/index.d.mts +3 -2
- package/dist/idempotency/index.mjs +8 -5
- package/dist/idempotency/redis.d.mts +2 -1
- package/dist/idempotency/redis.mjs +1 -0
- package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
- package/dist/{index-Q5gzEIWY.d.mts → index-CpzxqePp.d.mts} +107 -32
- package/dist/{index-Cx7bro4R.d.mts → index-DXlHwvuE.d.mts} +5 -4
- package/dist/index-ZWhLTp_s.d.mts +290 -0
- package/dist/{index-Ch16aAah.d.mts → index-zq6VrjaB.d.mts} +122 -15
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +11 -10
- package/dist/{init-tlRSt667.mjs → init-BbfP8aky.mjs} +25 -27
- package/dist/{init-BPEu8cs-.d.mts → init-Cscs4lab.d.mts} +1 -0
- package/dist/integrations/event-gateway.d.mts +3 -2
- package/dist/integrations/event-gateway.mjs +2 -1
- package/dist/integrations/index.d.mts +4 -3
- package/dist/integrations/index.mjs +1 -0
- package/dist/integrations/jobs/index.d.mts +2 -1
- package/dist/integrations/jobs/index.mjs +109 -33
- package/dist/integrations/mcp/index.d.mts +6 -6
- package/dist/integrations/mcp/index.mjs +2 -1
- package/dist/integrations/mcp/testing.d.mts +3 -2
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.d.mts +1 -0
- package/dist/integrations/streamline.mjs +3 -2
- package/dist/integrations/webhooks.d.mts +1 -0
- package/dist/integrations/webhooks.mjs +1 -0
- package/dist/integrations/websocket-pushref-redis.d.mts +2 -1
- package/dist/integrations/websocket-pushref-redis.mjs +1 -0
- package/dist/integrations/websocket-redis.d.mts +2 -1
- package/dist/integrations/websocket-redis.mjs +1 -0
- package/dist/integrations/websocket.d.mts +3 -2
- package/dist/integrations/websocket.mjs +38 -34
- package/dist/{interface-BGZCzOGL.d.mts → interface-BOk3YnTz.d.mts} +1 -0
- package/dist/{interface-n5hpKg1d.mjs → interface-BP4IJCBO.mjs} +1 -0
- package/dist/{interface-Uk8ONJv7.d.mts → interface-DEWNOMza.d.mts} +1 -0
- package/dist/{jsonBody-BlzAoGCe.mjs → jsonBody-DDSR2HFl.mjs} +2 -1
- package/dist/{keys-Cd316u_y.mjs → keys-B-HBTGXl.mjs} +1 -0
- package/dist/{loadResources-DpU8pfjV.mjs → loadResources-DisEAmkm.mjs} +4 -2
- package/dist/{loadResourcesFromEntry-kvGT6EcO.mjs → loadResourcesFromEntry-D1MJp13f.mjs} +2 -1
- package/dist/logger/index.d.mts +1 -0
- package/dist/logger/index.mjs +1 -0
- package/dist/{mcpPlugin-nRzm5g2s.mjs → mcpPlugin-CpfVpKHE.mjs} +38 -38
- package/dist/{memory-CmnzXE5Z.mjs → memory-DsuWnj4T.mjs} +5 -4
- package/dist/{metrics-fdxI5mn_.mjs → metrics-DdQL8syd.mjs} +2 -1
- package/dist/middleware/index.d.mts +2 -1
- package/dist/middleware/index.mjs +3 -2
- package/dist/migrations/index.d.mts +1 -0
- package/dist/migrations/index.mjs +3 -2
- package/dist/module-Br81am6m.mjs +78 -0
- package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-BnkBLN7v.mjs} +3 -2
- package/dist/{openapi-B8Vkbxbn.mjs → openapi-DIRzvxC0.mjs} +6 -5
- package/dist/outbox-admin/index.d.mts +85 -0
- package/dist/outbox-admin/index.mjs +115 -0
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +6 -5
- package/dist/{permissions-Bfu_8y1U.mjs → permissions-Dl_m0NCe.mjs} +308 -42
- package/dist/{pipe-BOLmGIxa.mjs → pipe-ELHCP3zj.mjs} +3 -4
- package/dist/pipeline/index.d.mts +2 -1
- package/dist/pipeline/index.mjs +2 -1
- package/dist/{pipeline-BJnpkY9i.mjs → pipeline-CPA-jx0M.mjs} +17 -14
- package/dist/plugins/index.d.mts +8 -7
- package/dist/plugins/index.mjs +16 -15
- package/dist/plugins/response-cache.d.mts +1 -0
- package/dist/plugins/response-cache.mjs +2 -1
- package/dist/plugins/tracing-entry.d.mts +2 -1
- package/dist/plugins/tracing-entry.mjs +2 -1
- package/dist/{pluralize-BhrgwZb9.mjs → pluralize-C2ZkKbsn.mjs} +1 -0
- package/dist/{preloadResources-DSY5HGpS.mjs → preloadResources-CDs87fTw.mjs} +1 -0
- package/dist/{preloadResources-DCfa2egz.d.mts → preloadResources-T1hmlTEZ.d.mts} +117 -12
- package/dist/presets/filesUpload.d.mts +6 -5
- package/dist/presets/filesUpload.mjs +10 -12
- package/dist/presets/index.d.mts +3 -2
- package/dist/presets/index.mjs +2 -1
- package/dist/presets/multiTenant.d.mts +2 -1
- package/dist/presets/multiTenant.mjs +3 -2
- package/dist/presets/search.d.mts +3 -2
- package/dist/presets/search.mjs +2 -1
- package/dist/{presets-CJOEXLuk.mjs → presets-Dntd_pUO.mjs} +6 -4
- package/dist/{projection-UBDgfMwu.mjs → projection-CjHhM5W1.mjs} +2 -1
- package/dist/{pushref-registry-BbcnpNTm.d.mts → pushref-registry-Dov9l4qE.d.mts} +1 -0
- package/dist/{queryCachePlugin-br4otiqF.d.mts → queryCachePlugin-BzqxconG.d.mts} +3 -2
- package/dist/{queryCachePlugin-DSGuSVLW.mjs → queryCachePlugin-Dhps-Ldt.mjs} +6 -5
- package/dist/{rateLimit-DrED-C4v.mjs → rateLimit-C7mmAGs3.mjs} +7 -3
- package/dist/{rateLimitKey-BoWRH3e7.mjs → rateLimitKey-CccEFBfk.mjs} +1 -0
- package/dist/{realtime-B9nmIY5V.mjs → realtime-DVvVZZFz.mjs} +20 -9
- package/dist/{redis-UDtLaNj6.d.mts → redis-CduhKsJi.d.mts} +2 -1
- package/dist/{redis-stream-uIaauNpZ.d.mts → redis-stream-qN6A-RFv.d.mts} +2 -1
- package/dist/{registerRoute-JkxIEBJq.mjs → registerRoute-B_QrjYZS.mjs} +10 -7
- package/dist/registry/index.d.mts +3 -2
- package/dist/registry/index.mjs +3 -2
- package/dist/{registry-BYXUUg21.mjs → registry-DqUmzA9W.mjs} +2 -1
- package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-BpP9wwj7.mjs} +1 -0
- package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DS-P0b32.mjs} +2 -1
- package/dist/{repositoryFilter-Dz8k3S4P.mjs → repositoryFilter-DotlxG3L.mjs} +1 -0
- package/dist/{requestContext-MrlJwECf.mjs → requestContext-B6vQF-sy.mjs} +1 -0
- package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-BhflRrBs.mjs} +1 -0
- package/dist/{schedules-CjOd2MG9.mjs → schedules-C2Q3uv2d.mjs} +3 -2
- package/dist/{schemaConverter-DJvodiHj.mjs → schemaConverter-Crjvczi_.mjs} +70 -17
- package/dist/{schemaIR-Ca7ySNPx.mjs → schemaIR-CnyKK_1j.mjs} +2 -1
- package/dist/schemas/index.d.mts +1 -0
- package/dist/schemas/index.mjs +1 -0
- package/dist/scim/index.d.mts +1 -0
- package/dist/scim/index.mjs +2 -1
- package/dist/scope/index.d.mts +3 -2
- package/dist/scope/index.mjs +5 -4
- package/dist/{scope-DfaPntpo.mjs → scope-afz_Ieek.mjs} +4 -3
- package/dist/{sessionManager-BHOM3N_0.d.mts → sessionManager-qimlKV0P.d.mts} +1 -0
- package/dist/{simpleEqualityMatcher-Cg05HPsn.mjs → simpleEqualityMatcher-C4KiMWUa.mjs} +1 -0
- package/dist/{sse-BQ1w0dfl.mjs → sse-B9P4Y-UI.mjs} +7 -5
- package/dist/{sseStream-BQ7Qaynp.mjs → sseStream-B3zb_d1h.mjs} +2 -1
- package/dist/{storage-DLUZ04kK.d.mts → storage-Cx9Sz3Ou.d.mts} +1 -0
- package/dist/{store-helpers-DY6xq4sM.mjs → store-helpers-DmEMHlPQ.mjs} +1 -0
- package/dist/{streaming-BQcW6_Kq.mjs → streaming-DPZdQmDz.mjs} +1 -0
- package/dist/{subscribe-helpers-DfzsivM6.mjs → subscribe-helpers-sp5xTDVA.mjs} +2 -1
- package/dist/sync/changelog.d.mts +1 -0
- package/dist/sync/changelog.mjs +1 -0
- package/dist/testing/cleanupStoreContract.d.mts +2 -1
- package/dist/testing/cleanupStoreContract.mjs +10 -5
- package/dist/testing/index.d.mts +166 -12
- package/dist/testing/index.mjs +315 -43
- package/dist/testing/outboxStoreContract.d.mts +12 -2
- package/dist/testing/outboxStoreContract.mjs +110 -20
- package/dist/testing/storageContract.d.mts +2 -1
- package/dist/testing/storageContract.mjs +11 -5
- package/dist/{tracing-CsGKQJGg.d.mts → tracing-Dro5eH6j.d.mts} +1 -0
- package/dist/{transactionContext-PNdoyLLm.mjs → transactionContext-BvLKvOIL.mjs} +1 -0
- package/dist/{typeGuards-C9KXUly6.mjs → typeGuards-B_5-hKjJ.mjs} +1 -0
- package/dist/types/index.d.mts +6 -5
- package/dist/types/index.mjs +1 -0
- package/dist/types/storage.d.mts +2 -1
- package/dist/types/storage.mjs +1 -0
- package/dist/{types-ChvvVNP8.d.mts → types-B7XeLEgK.d.mts} +34 -2
- package/dist/{types-Cc91nXuA.d.mts → types-ByHn9rEO.d.mts} +1 -0
- package/dist/{types-C_ZZRcD6.d.mts → types-C4QE8qnm.d.mts} +1 -0
- package/dist/{types-D_n8L6VY.d.mts → types-CT5vu6M0.d.mts} +132 -17
- package/dist/{types-DjC-KUCz.d.mts → types-ChuShpCP.d.mts} +1 -0
- package/dist/{types-Bmmn-fO0.d.mts → types-CwcUQ610.d.mts} +2 -6
- package/dist/{types-CSyCxl2V.mjs → types-DXYX7dIR.mjs} +4 -3
- package/dist/usage/index.d.mts +3 -2
- package/dist/usage/index.mjs +0 -0
- package/dist/{userHelpers-Cg_y3fBz.mjs → userHelpers-BNsOXzOd.mjs} +1 -0
- package/dist/utils/index.d.mts +16 -7
- package/dist/utils/index.mjs +10 -9
- package/dist/{utils-taUVD4p3.mjs → utils-BtOha_Sp.mjs} +3 -2
- package/dist/{validate-Bk44F2yT.mjs → validate-PMCPR9El.mjs} +2 -1
- package/dist/{versioning-gKWyryT3.mjs → versioning-CKv2jz_U.mjs} +4 -3
- package/dist/{versioning-DXgY5BUm.d.mts → versioning-D_rhHfZm.d.mts} +5 -2
- package/dist/{websocket-_Pd0CgR0.d.mts → websocket-BOXVggMf.d.mts} +2 -1
- package/package.json +557 -539
- package/skills/arc/SKILL.md +22 -8
- package/skills/arc/references/api-reference.md +4 -0
- package/skills/arc/references/auth.md +3 -0
- package/skills/arc/references/integrations.md +33 -0
- package/skills/arc/references/mcp.md +6 -7
- package/skills/arc/references/production.md +24 -25
- package/skills/arc-code-review/references/anti-patterns.md +3 -3
- package/dist/fastify-augmentation-0WhPnUH7.d.mts +0 -76
- package/dist/index-CCzVR-N3.d.mts +0 -107
- package/dist/module-_-M7C5ES.mjs +0 -29
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-Dro5eH6j.mjs";
|
|
2
3
|
export { type TracingOptions, createSpan, isTracingAvailable, traced, _default as tracingPlugin };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import fp from "fastify-plugin";
|
|
3
4
|
//#region src/plugins/tracing.ts
|
|
@@ -58,7 +59,7 @@ try {
|
|
|
58
59
|
function createTracerProvider(options) {
|
|
59
60
|
if (!isAvailable || !NodeTracerProvider || !BatchSpanProcessor || !OTLPTraceExporter) return null;
|
|
60
61
|
const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
|
|
61
|
-
const resolvedVersion = serviceVersion ?? "2.
|
|
62
|
+
const resolvedVersion = serviceVersion ?? "2.32.0";
|
|
62
63
|
const exporter = new OTLPTraceExporter({ url: exporterUrl });
|
|
63
64
|
const provider = new NodeTracerProvider({ resource: { attributes: {
|
|
64
65
|
"service.name": serviceName,
|
|
@@ -1,16 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "./
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { Gt as Authenticator } from "./index-CpzxqePp.mjs";
|
|
3
|
+
import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
|
|
4
|
+
import { n as ElevationOptions } from "./elevation-BXCfVcNG.mjs";
|
|
5
|
+
import { a as EventTransport } from "./EventTransport-2uVV34WU.mjs";
|
|
6
|
+
import { t as ExternalOpenApiPaths } from "./externalPaths-CmGOxOtD.mjs";
|
|
7
|
+
import { r as QueryCachePluginOptions } from "./queryCachePlugin-BzqxconG.mjs";
|
|
8
|
+
import { t as ErrorHandlerOptions } from "./errorHandler-CpYUJmPA.mjs";
|
|
9
|
+
import { l as ResourceLike, m as SchedulesPluginOptions, n as ArcModuleInput, v as HealthOptions } from "./types-CT5vu6M0.mjs";
|
|
10
|
+
import "./index-ZWhLTp_s.mjs";
|
|
11
|
+
import { t as EventPluginOptions } from "./eventPlugin-GF5nnBIq.mjs";
|
|
12
|
+
import { g as CachingOptions, o as MetricsOptions, p as SSEOptions, t as VersioningOptions, u as RealtimeOptions } from "./versioning-D_rhHfZm.mjs";
|
|
13
|
+
import { r as IdempotencyStore } from "./interface-DEWNOMza.mjs";
|
|
13
14
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
|
|
15
|
+
//#region src/factory/types/assets.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* How other origins may EMBED these bytes — the value of
|
|
18
|
+
* `Cross-Origin-Resource-Policy` for this prefix.
|
|
19
|
+
*
|
|
20
|
+
* - `same-site` (default) — `app.example.com` may embed assets served by
|
|
21
|
+
* `api.example.com`; an unrelated site may not. The common deployment split.
|
|
22
|
+
* - `cross-origin` — ANY site may embed (and hotlink). Correct for genuinely
|
|
23
|
+
* public, CDN-style assets; wrong for anything caller-specific.
|
|
24
|
+
* - `same-origin` — only the exact same origin. Arc's app-wide default; set it
|
|
25
|
+
* per-root to keep a private prefix locked down.
|
|
26
|
+
*/
|
|
27
|
+
type AssetCrossOrigin = "same-origin" | "same-site" | "cross-origin";
|
|
28
|
+
/** Cache posture for a prefix. See `CACHE_CONTROL` in `../assets.ts`. */
|
|
29
|
+
type AssetCache = "immutable" | "revalidate" | "none";
|
|
30
|
+
/** One static root mounted at one URL prefix. */
|
|
31
|
+
interface AssetRoot {
|
|
32
|
+
/**
|
|
33
|
+
* URL prefix to serve from, e.g. `"/uploads"`. Must be unique across roots —
|
|
34
|
+
* a duplicate fails at boot rather than silently shadowing.
|
|
35
|
+
*/
|
|
36
|
+
readonly prefix: string;
|
|
37
|
+
/** Filesystem directory (or directories) to serve. Passed to `@fastify/static`. */
|
|
38
|
+
readonly root: string | readonly string[] | URL | readonly URL[];
|
|
39
|
+
/**
|
|
40
|
+
* Who may embed these bytes cross-origin. Defaults to `"same-site"`.
|
|
41
|
+
* **This is the setting that unbreaks a separate-origin frontend** — arc's
|
|
42
|
+
* app-wide default (from helmet) is `same-origin`, which blocks the embed even
|
|
43
|
+
* when CORS is correct.
|
|
44
|
+
*/
|
|
45
|
+
readonly crossOrigin?: AssetCrossOrigin;
|
|
46
|
+
/**
|
|
47
|
+
* Cache posture. Defaults to `"revalidate"` — safe for mutable paths, and
|
|
48
|
+
* cheap in practice because `ETag` turns the steady state into a 304.
|
|
49
|
+
*
|
|
50
|
+
* Use `"immutable"` ONLY for content-addressed filenames (a hash that changes
|
|
51
|
+
* with the bytes). On a mutable path it serves stale content for a year.
|
|
52
|
+
*/
|
|
53
|
+
readonly cache?: AssetCache;
|
|
54
|
+
/**
|
|
55
|
+
* `Content-Disposition` type. Defaults to `"attachment"`.
|
|
56
|
+
*
|
|
57
|
+
* Keep the default for anything user-uploaded: serving untrusted content
|
|
58
|
+
* `inline` lets an uploaded `.svg`/`.html` execute on your origin with your
|
|
59
|
+
* cookies. `"inline"` is for trusted, transformed derivatives you produced.
|
|
60
|
+
*/
|
|
61
|
+
readonly disposition?: "inline" | "attachment";
|
|
62
|
+
/**
|
|
63
|
+
* Serve `.br`/`.gz` siblings when the client accepts them. `@fastify/static`
|
|
64
|
+
* adds `Vary: Accept-Encoding` automatically.
|
|
65
|
+
*
|
|
66
|
+
* ⚠ `allowedPath` is evaluated against the REQUESTED path, before the variant
|
|
67
|
+
* is chosen — so denying `*.gz` does NOT prevent `/main.js` from serving
|
|
68
|
+
* `main.js.gz`. Treat pre-compressed files as public alternate encodings of the
|
|
69
|
+
* same asset; keep anything restricted out of the served root entirely.
|
|
70
|
+
*/
|
|
71
|
+
readonly preCompressed?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Per-request filter. Return `false` to fall through to the 404 handler.
|
|
74
|
+
*
|
|
75
|
+
* **Synchronous by contract** (it is `@fastify/static`'s signature), so an
|
|
76
|
+
* async permission check CANNOT run here. That makes it the right home for a
|
|
77
|
+
* SIGNED-URL check — HMAC verification is synchronous, needs no database, and
|
|
78
|
+
* stays CDN-cacheable. For an async gate, put a `preHandler` on the prefix
|
|
79
|
+
* instead.
|
|
80
|
+
*/
|
|
81
|
+
readonly allowedPath?: (pathName: string, root: string, request: FastifyRequest) => boolean;
|
|
82
|
+
/** Extra headers, applied AFTER arc's policy so a host can override it. */
|
|
83
|
+
readonly setHeaders?: (reply: FastifyReply, filePath: string) => void;
|
|
84
|
+
/** Serve `index.html` for a directory request. Default `false`. */
|
|
85
|
+
readonly index?: string | readonly string[] | false;
|
|
86
|
+
/** Emit `ETag`. Default `true` — it is what makes `revalidate` cheap. */
|
|
87
|
+
readonly etag?: boolean;
|
|
88
|
+
/** Emit `Last-Modified`. Default `true`. */
|
|
89
|
+
readonly lastModified?: boolean;
|
|
90
|
+
/** Support byte ranges — audio/video seeking, resumable downloads. Default `true`. */
|
|
91
|
+
readonly acceptRanges?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Let this root install the `reply.sendFile()` decorator. Default `false`
|
|
94
|
+
* because only ONE registration may decorate; set it on exactly one root if
|
|
95
|
+
* handlers need `reply.sendFile()`.
|
|
96
|
+
*/
|
|
97
|
+
readonly decorateReply?: boolean;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
14
100
|
//#region src/factory/types/auth.d.ts
|
|
15
101
|
/**
|
|
16
102
|
* Arc's built-in JWT auth
|
|
@@ -576,6 +662,25 @@ interface CreateAppOptions {
|
|
|
576
662
|
cors?: CorsOptions | false;
|
|
577
663
|
/** Rate limiting. Set to false to disable. */
|
|
578
664
|
rateLimit?: RateLimitOpts | false;
|
|
665
|
+
/**
|
|
666
|
+
* Static asset roots, each served by its own `@fastify/static` registration.
|
|
667
|
+
*
|
|
668
|
+
* Arc supplies POLICY (per-prefix `Cross-Origin-Resource-Policy`, cache preset,
|
|
669
|
+
* `Content-Disposition`) and delegates every transport mechanic — byte ranges,
|
|
670
|
+
* ETag/304, immutable directives, pre-compressed variants — to the plugin.
|
|
671
|
+
*
|
|
672
|
+
* ```ts
|
|
673
|
+
* assets: [{ prefix: "/uploads", root: "./var/uploads", crossOrigin: "same-site" }]
|
|
674
|
+
* ```
|
|
675
|
+
*
|
|
676
|
+
* **Why this exists:** arc's default security headers include
|
|
677
|
+
* `Cross-Origin-Resource-Policy: same-origin`, which makes a browser discard the
|
|
678
|
+
* response when a cross-origin document tries to embed it — even though the
|
|
679
|
+
* request returned 200 and CORS negotiated fine. A frontend on a different
|
|
680
|
+
* origin cannot render an uploaded image until CORP is relaxed for that prefix.
|
|
681
|
+
* Requires `@fastify/static`.
|
|
682
|
+
*/
|
|
683
|
+
assets?: readonly AssetRoot[];
|
|
579
684
|
/** Under pressure health monitoring. Set to false to disable. */
|
|
580
685
|
underPressure?: UnderPressureOptions | false;
|
|
581
686
|
/** @fastify/sensible (HTTP helpers). Set to false to disable. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { Y as PresetResult } from "../index-CpzxqePp.mjs";
|
|
3
|
+
import { i as RequestScope } from "../types-ChuShpCP.mjs";
|
|
4
|
+
import { r as PermissionCheck } from "../types-B7XeLEgK.mjs";
|
|
5
|
+
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-Cx9Sz3Ou.mjs";
|
|
5
6
|
//#region src/presets/filesUpload.d.ts
|
|
6
7
|
interface FilesUploadPresetRoutes {
|
|
7
8
|
upload?: boolean;
|
|
@@ -61,7 +62,7 @@ interface FilesUploadPresetOptions {
|
|
|
61
62
|
/**
|
|
62
63
|
* Create a files-upload preset bound to a `Storage` adapter.
|
|
63
64
|
*
|
|
64
|
-
* The preset
|
|
65
|
+
* The preset declares every route via `rawHandler` so binary responses bypass arc's JSON
|
|
65
66
|
* envelope. Upload still returns the standard `{ success: true, data }`
|
|
66
67
|
* envelope manually because the response is structured metadata, not bytes.
|
|
67
68
|
*/
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { i as NotFoundError, u as ValidationError } from "../errors-Bh1KK5ps.mjs";
|
|
3
|
+
import { c as getOrgId, g as getUserId } from "../types-DXYX7dIR.mjs";
|
|
4
|
+
import { B as requireAuth, F as allowPublic } from "../permissions-Dl_m0NCe.mjs";
|
|
5
|
+
import { t as multipartBody } from "../multipartBody-BnkBLN7v.mjs";
|
|
5
6
|
//#region src/presets/filesUpload.ts
|
|
6
7
|
const DEFAULT_FIELD_NAME = "file";
|
|
7
|
-
const DEFAULT_MAX_FILE_SIZE =
|
|
8
|
+
const DEFAULT_MAX_FILE_SIZE = 10485760;
|
|
8
9
|
function defaultContextFrom(scope) {
|
|
9
10
|
if (!scope) return {};
|
|
10
11
|
const userId = getUserId(scope);
|
|
@@ -187,7 +188,7 @@ function toNotFound(err, resource, id) {
|
|
|
187
188
|
/**
|
|
188
189
|
* Create a files-upload preset bound to a `Storage` adapter.
|
|
189
190
|
*
|
|
190
|
-
* The preset
|
|
191
|
+
* The preset declares every route via `rawHandler` so binary responses bypass arc's JSON
|
|
191
192
|
* envelope. Upload still returns the standard `{ success: true, data }`
|
|
192
193
|
* envelope manually because the response is structured metadata, not bytes.
|
|
193
194
|
*/
|
|
@@ -222,8 +223,7 @@ function filesUploadPreset(options) {
|
|
|
222
223
|
allowedMimeTypes,
|
|
223
224
|
requiredFields: [deps.fieldName]
|
|
224
225
|
})],
|
|
225
|
-
|
|
226
|
-
handler: makeUploadHandler(deps)
|
|
226
|
+
rawHandler: makeUploadHandler(deps)
|
|
227
227
|
});
|
|
228
228
|
if (includeRoutes.read) routes.push({
|
|
229
229
|
method: "GET",
|
|
@@ -232,8 +232,7 @@ function filesUploadPreset(options) {
|
|
|
232
232
|
summary: "Download a file",
|
|
233
233
|
description: "Streams the stored bytes. Supports single-range `Range: bytes=start-end`.",
|
|
234
234
|
permissions: options.permissions?.read ?? permissions.get ?? allowPublic(),
|
|
235
|
-
|
|
236
|
-
handler: makeReadHandler(deps),
|
|
235
|
+
rawHandler: makeReadHandler(deps),
|
|
237
236
|
mcp: false
|
|
238
237
|
});
|
|
239
238
|
if (includeRoutes.delete) routes.push({
|
|
@@ -242,8 +241,7 @@ function filesUploadPreset(options) {
|
|
|
242
241
|
operation: "filesUpload.delete",
|
|
243
242
|
summary: "Delete a file",
|
|
244
243
|
permissions: options.permissions?.delete ?? permissions.delete ?? requireAuth(),
|
|
245
|
-
|
|
246
|
-
handler: makeDeleteHandler(deps)
|
|
244
|
+
rawHandler: makeDeleteHandler(deps)
|
|
247
245
|
});
|
|
248
246
|
return routes;
|
|
249
247
|
}
|
package/dist/presets/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { Rt as IControllerResponse, U as ResourceConfig, Y as PresetResult, d as PaginationResult, zt as IRequestContext } from "../index-CpzxqePp.mjs";
|
|
3
|
+
import { l as AnyRecord } from "../types-B7XeLEgK.mjs";
|
|
3
4
|
import { FilesUploadPresetOptions, FilesUploadPresetPermissions, FilesUploadPresetRoutes, filesUploadPreset } from "./filesUpload.mjs";
|
|
4
5
|
import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
|
|
5
6
|
import { SearchHandler, SearchPresetOptions, SearchRouteConfig, searchPreset } from "./search.mjs";
|
package/dist/presets/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
1
2
|
import { multiTenantPreset } from "./multiTenant.mjs";
|
|
2
|
-
import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-
|
|
3
|
+
import { a as registerPreset, c as auditedPreset, d as ownedByUserPreset, i as getPreset, l as softDeletePreset, n as flexibleMultiTenantPreset, o as treePreset, r as getAvailablePresets, s as bulkPreset, t as applyPresets, u as slugLookupPreset } from "../presets-Dntd_pUO.mjs";
|
|
3
4
|
import { filesUploadPreset } from "./filesUpload.mjs";
|
|
4
5
|
import { searchPreset } from "./search.mjs";
|
|
5
6
|
export { applyPresets, auditedPreset, bulkPreset, filesUploadPreset, flexibleMultiTenantPreset, getAvailablePresets, getPreset, multiTenantPreset, ownedByUserPreset, registerPreset, searchPreset, slugLookupPreset, softDeletePreset, treePreset };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { X as CrudRouteKey, Y as PresetResult } from "../index-CpzxqePp.mjs";
|
|
2
3
|
//#region src/presets/multiTenant.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* One tenant dimension for multi-field filtering. Discriminated by source:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import "../constants-J99LGTJI.mjs";
|
|
3
|
+
import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, u as getRequestScope, v as hasOrgAccess } from "../types-DXYX7dIR.mjs";
|
|
3
4
|
//#region src/presets/multiTenant.ts
|
|
4
5
|
/**
|
|
5
6
|
* Resolve a single TenantFieldSpec against the current scope.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { At as RouteDefinition, Pt as ControllerHandler, Y as PresetResult, jt as RouteMcpConfig } from "../index-CpzxqePp.mjs";
|
|
3
|
+
import { r as PermissionCheck } from "../types-B7XeLEgK.mjs";
|
|
3
4
|
//#region src/presets/search.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Search Preset — backend-agnostic search / vector / embed routes
|
package/dist/presets/search.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { B as requireAuth, F as allowPublic } from "../permissions-Dl_m0NCe.mjs";
|
|
2
3
|
//#region src/presets/search.ts
|
|
3
4
|
const BUILTINS = [
|
|
4
5
|
{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { l as UnauthorizedError } from "./errors-Bh1KK5ps.mjs";
|
|
3
|
+
import { b as isElevated, n as PUBLIC_SCOPE } from "./types-DXYX7dIR.mjs";
|
|
4
|
+
import { B as requireAuth, F as allowPublic, U as requireRoles } from "./permissions-Dl_m0NCe.mjs";
|
|
4
5
|
import { multiTenantPreset } from "./presets/multiTenant.mjs";
|
|
5
6
|
//#region src/presets/ownedByUser.ts
|
|
6
7
|
/**
|
|
@@ -13,7 +14,8 @@ import { multiTenantPreset } from "./presets/multiTenant.mjs";
|
|
|
13
14
|
*/
|
|
14
15
|
function createOwnershipCheck(ownerField, missingOwner) {
|
|
15
16
|
return async (request, _reply) => {
|
|
16
|
-
|
|
17
|
+
const scope = request.scope ?? PUBLIC_SCOPE;
|
|
18
|
+
if (isElevated(scope)) return;
|
|
17
19
|
const user = request.user;
|
|
18
20
|
if (!user) throw new UnauthorizedError("Authentication required for this operation");
|
|
19
21
|
const userWithId = user;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { c as getOrgId, g as getUserId, x as isMember } from "./types-DXYX7dIR.mjs";
|
|
2
3
|
//#region src/scope/projection.ts
|
|
3
4
|
/**
|
|
4
5
|
* Compute the request-scope projection. Returns `undefined` when no
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { r as CacheStore } from "./interface-BOk3YnTz.mjs";
|
|
3
|
+
import { i as QueryCache } from "./QueryCache-DFA-QrU9.mjs";
|
|
3
4
|
import { FastifyPluginAsync } from "fastify";
|
|
4
5
|
//#region src/cache/queryCachePlugin.d.ts
|
|
5
6
|
interface QueryCachePluginOptions {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
|
|
3
|
+
import { t as hasEvents } from "./typeGuards-B_5-hKjJ.mjs";
|
|
4
|
+
import { i as versionKey, r as tagVersionKey } from "./keys-B-HBTGXl.mjs";
|
|
5
|
+
import { t as MemoryCacheStore } from "./memory-DsuWnj4T.mjs";
|
|
5
6
|
import fp from "fastify-plugin";
|
|
6
7
|
//#region src/cache/QueryCache.ts
|
|
7
8
|
var QueryCache = class {
|
|
@@ -99,7 +100,7 @@ var QueryCache = class {
|
|
|
99
100
|
}
|
|
100
101
|
};
|
|
101
102
|
/** See `bumpVersion` — effectively non-expiring, refreshed on every bump. */
|
|
102
|
-
const VERSION_TTL_SECONDS =
|
|
103
|
+
const VERSION_TTL_SECONDS = 31536e3;
|
|
103
104
|
//#endregion
|
|
104
105
|
//#region src/cache/queryCachePlugin.ts
|
|
105
106
|
var queryCachePlugin_exports = /* @__PURE__ */ __exportAll({ queryCachePlugin: () => queryCachePlugin });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as requestContext } from "./requestContext-B6vQF-sy.mjs";
|
|
2
3
|
//#region src/core/middlewares/arcDecorator.ts
|
|
3
4
|
/**
|
|
4
5
|
* Build the `arcDecorator` preHandler for a resource.
|
|
@@ -211,6 +212,7 @@ function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
|
|
|
211
212
|
* Build the per-route Fastify `config` object shared by the CRUD, custom, and
|
|
212
213
|
* action routers. Two independent concerns ride on `routeOptions.config`:
|
|
213
214
|
* - `config.rateLimit` — read by `@fastify/rate-limit`.
|
|
215
|
+
* - `config.cors` — read by `@fastify/cors` as a per-route override.
|
|
214
216
|
* - `config.arcExtensions` — read by arc plugins (encryption, …) at request
|
|
215
217
|
* time, sourced from `defineResource({ extensions })`.
|
|
216
218
|
*
|
|
@@ -218,10 +220,12 @@ function resolveRouterPluginMw(fastify, resourceHasQueryCache) {
|
|
|
218
220
|
* either stay config-free and the spread is a genuine no-op. Both fields are
|
|
219
221
|
* optional in the return type, so no cast is needed when only one is set.
|
|
220
222
|
*/
|
|
221
|
-
function buildRouteConfig(rateLimitConfig, extensions) {
|
|
222
|
-
|
|
223
|
+
function buildRouteConfig(rateLimitConfig, extensions, cors) {
|
|
224
|
+
const hasCors = cors !== void 0;
|
|
225
|
+
if (!rateLimitConfig && !extensions && !hasCors) return {};
|
|
223
226
|
return { config: {
|
|
224
227
|
...rateLimitConfig ?? {},
|
|
228
|
+
...hasCors ? { cors } : {},
|
|
225
229
|
...extensions ? { arcExtensions: extensions } : {}
|
|
226
230
|
} };
|
|
227
231
|
}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
|
|
2
3
|
import { arcLog } from "./logger/index.mjs";
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as applyFieldReadPermissions } from "./fields-
|
|
8
|
-
import { a as promoteStreamTokenToHeader } from "./streaming-
|
|
9
|
-
import { t as openSseStream } from "./sseStream-
|
|
4
|
+
import { n as evaluateAndApplyPermission } from "./authorizationDecision-__T3EJDA.mjs";
|
|
5
|
+
import { n as getUserRoles } from "./userHelpers-BNsOXzOd.mjs";
|
|
6
|
+
import { c as getOrgId } from "./types-DXYX7dIR.mjs";
|
|
7
|
+
import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-C4KiMWUa.mjs";
|
|
8
|
+
import { t as applyFieldReadPermissions } from "./fields-DEi65pGj.mjs";
|
|
9
|
+
import { a as promoteStreamTokenToHeader } from "./streaming-DPZdQmDz.mjs";
|
|
10
|
+
import { t as openSseStream } from "./sseStream-B3zb_d1h.mjs";
|
|
10
11
|
import fp from "fastify-plugin";
|
|
11
12
|
//#region src/plugins/realtime.ts
|
|
12
13
|
var realtime_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
+
DEFAULT_MAX_CONNECTION_MS: () => DEFAULT_MAX_CONNECTION_MS,
|
|
13
15
|
buildChangeFrame: () => buildChangeFrame,
|
|
14
16
|
connectionDeadlineMs: () => connectionDeadlineMs,
|
|
15
17
|
default: () => realtime_default,
|
|
@@ -38,6 +40,15 @@ const MAX_MULTIPLEX_RESOURCES = 20;
|
|
|
38
40
|
/** Node's `setTimeout` ceiling (~24.8 days); larger delays fire immediately. */
|
|
39
41
|
const MAX_TIMER_MS = 2147483647;
|
|
40
42
|
/**
|
|
43
|
+
* Secure default lease when no other bound applies (session/cookie auth with no
|
|
44
|
+
* token `exp`, and no explicit `maxConnectionMs`). A change feed snapshots its
|
|
45
|
+
* permission filters at connect, so without ANY ceiling a revoked caller would
|
|
46
|
+
* keep their old view forever. 30 minutes bounds that staleness while not
|
|
47
|
+
* churning connections. A host that truly wants a longer-lived feed sets
|
|
48
|
+
* `maxConnectionMs` explicitly (up to `MAX_TIMER_MS`).
|
|
49
|
+
*/
|
|
50
|
+
const DEFAULT_MAX_CONNECTION_MS = 18e5;
|
|
51
|
+
/**
|
|
41
52
|
* Milliseconds from `now` until the feed should force-close to bound
|
|
42
53
|
* permission staleness — `min(auth-token exp, maxConnectionMs)`. Returns
|
|
43
54
|
* `undefined` when neither bound applies (no `exp` claim, no cap → the feed
|
|
@@ -147,7 +158,7 @@ function buildChangeFrame(event, resourceName, data) {
|
|
|
147
158
|
});
|
|
148
159
|
}
|
|
149
160
|
const realtimePlugin = async (fastify, opts = {}) => {
|
|
150
|
-
const { path = "/realtime/:resource", heartbeat = 3e4, resources: allowlist, operations = CHANGE_OPERATIONS, tokenQueryParam = "token", maxConnectionMs } = opts;
|
|
161
|
+
const { path = "/realtime/:resource", heartbeat = 3e4, resources: allowlist, operations = CHANGE_OPERATIONS, tokenQueryParam = "token", maxConnectionMs = DEFAULT_MAX_CONNECTION_MS } = opts;
|
|
151
162
|
if (!fastify.hasDecorator("events")) {
|
|
152
163
|
log.warn("Events plugin (arc-events) not registered. Realtime plugin will not function. Register eventPlugin before realtimePlugin.");
|
|
153
164
|
return;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-DEWNOMza.mjs";
|
|
2
3
|
//#region src/idempotency/stores/redis.d.ts
|
|
3
4
|
interface RedisClient {
|
|
4
5
|
get(key: string): Promise<string | null>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { a as EventTransport, i as EventLogger, n as DomainEvent, r as EventHandler } from "./EventTransport-2uVV34WU.mjs";
|
|
2
3
|
//#region src/events/transports/redis-stream.d.ts
|
|
3
4
|
interface RedisStreamLike {
|
|
4
5
|
xadd(key: string, id: string, ...fieldValues: string[]): Promise<string | null>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "./authorizationDecision-__T3EJDA.mjs";
|
|
3
|
+
import { f as createError } from "./errors-Bh1KK5ps.mjs";
|
|
4
|
+
import { u as getRequestScope } from "./types-DXYX7dIR.mjs";
|
|
4
5
|
//#region src/core/middlewares/permissions.ts
|
|
5
6
|
/**
|
|
6
7
|
* Build a PermissionContext from a Fastify request. Extracted so the CRUD
|
|
@@ -31,10 +32,11 @@ function buildPermissionContext(req, opts) {
|
|
|
31
32
|
function buildCrudPermissionMw(permissionCheck, resourceName, action) {
|
|
32
33
|
if (!permissionCheck) return null;
|
|
33
34
|
return async (req, reply) => {
|
|
34
|
-
|
|
35
|
+
const context = buildPermissionContext(req, {
|
|
35
36
|
resource: resourceName,
|
|
36
37
|
action
|
|
37
|
-
})
|
|
38
|
+
});
|
|
39
|
+
await evaluateAndApplyPermission(permissionCheck, context, req, reply);
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
/**
|
|
@@ -63,12 +65,13 @@ function buildActionPermissionMw(actionEnum, actionPermissions, globalAuth, reso
|
|
|
63
65
|
if (!permissionCheck) return;
|
|
64
66
|
const { action: _discard, ...data } = body;
|
|
65
67
|
const params = req.params;
|
|
66
|
-
|
|
68
|
+
const context = buildPermissionContext(req, {
|
|
67
69
|
resource: resourceName,
|
|
68
70
|
action,
|
|
69
71
|
resourceId: params?.id,
|
|
70
72
|
data
|
|
71
|
-
})
|
|
73
|
+
});
|
|
74
|
+
await evaluateAndApplyPermission(permissionCheck, context, req, reply, { defaultDenialMessage: (user) => user ? `Permission denied for '${action}'` : "Authentication required" });
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
77
|
//#endregion
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import "../
|
|
1
|
+
|
|
2
|
+
import { K as ResolvedTenantPurge, R as RegisterOptions, V as ResourceDefinition, X as CrudRouteKey, k as IntrospectionPluginOptions, p as RegistryEntry, z as ResourceRegistry } from "../index-CpzxqePp.mjs";
|
|
3
|
+
import "../fastify-augmentation-BppG5bMT.mjs";
|
|
3
4
|
import { FastifyPluginAsync } from "fastify";
|
|
4
5
|
import { TenantPurgeProgress, TenantPurgeStrategy } from "@classytic/repo-core/repository";
|
|
5
6
|
//#region src/registry/assertNoTenantData.d.ts
|
package/dist/registry/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as cascadeDeleteForOrganization, c as assertNoTenantData, i as introspectionPlugin_default, n as buildResourceManifestFromRegistry, o as getCascadingResources, r as introspectionPlugin, s as getCascadingResourcesWithMetadata, t as buildResourceManifest } from "../registry-DqUmzA9W.mjs";
|
|
3
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-BVr7PgA0.mjs";
|
|
3
4
|
export { ResourceRegistry, assertNoTenantData, buildResourceManifest, buildResourceManifestFromRegistry, cascadeDeleteForOrganization, getCascadingResources, getCascadingResourcesWithMetadata, introspectionPlugin_default as introspectionPlugin, introspectionPlugin as introspectionPluginFn };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CRUD_OPERATIONS } from "./constants-J99LGTJI.mjs";
|
|
2
3
|
import fp from "fastify-plugin";
|
|
3
4
|
//#region src/registry/assertNoTenantData.ts
|
|
4
5
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
|
|
2
3
|
import { toCanonicalList } from "@classytic/repo-core/pagination";
|
|
3
4
|
import fp from "fastify-plugin";
|
|
4
5
|
//#region src/plugins/replyHelpers.ts
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as
|
|
1
|
+
/*! @classytic/arc v2.32.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-BhflRrBs.mjs";
|
|
3
|
+
import { t as startRenewingLease } from "./renewingLease-BpP9wwj7.mjs";
|
|
3
4
|
import fp from "fastify-plugin";
|
|
4
5
|
//#region src/plugins/schedules.ts
|
|
5
6
|
var schedules_exports = /* @__PURE__ */ __exportAll({
|