@classytic/arc 2.30.0 → 2.31.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-De7GqHck.mjs} +16 -17
- package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
- package/dist/{EventTransport-C6YA8xY9.mjs → EventTransport-9mlTgqzE.mjs} +1 -0
- package/dist/{HookSystem-WkIougo6.mjs → HookSystem-BcmPyq5I.mjs} +2 -1
- package/dist/{QueryCache-DOMT_iq7.d.mts → QueryCache-DFA-QrU9.d.mts} +2 -1
- package/dist/{ResourceRegistry-y9Hnypus.mjs → ResourceRegistry-qq0mn2s9.mjs} +3 -2
- package/dist/{actionPermissions-CAphcmUG.mjs → actionPermissions-BE5NwaQk.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 +6 -5
- package/dist/auth/redis-session.d.mts +2 -1
- package/dist/auth/redis-session.mjs +1 -0
- package/dist/{applyPermissionResult-Cf6zUCvb.mjs → authorizationDecision-ChvUQGG1.mjs} +19 -10
- package/dist/{buildHandler-BYS3Vkfz.mjs → buildHandler-CDrCJzmB.mjs} +4 -3
- package/dist/cache/index.d.mts +4 -3
- package/dist/cache/index.mjs +4 -3
- package/dist/{caching-_NJeDd1_.mjs → caching-BFHA6Scf.mjs} +2 -1
- package/dist/cleanup/index.d.mts +4 -3
- package/dist/cleanup/index.mjs +9 -13
- package/dist/cli/commands/describe.d.mts +2 -1
- package/dist/cli/commands/describe.mjs +3 -2
- 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-D3Dv4LAV.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-BGpIxINN.mjs} +3 -2
- package/dist/{createActionRouter-BxuywVRB.mjs → createActionRouter-CDXEdasl.mjs} +8 -7
- package/dist/{createAggregationRouter-BiY-lGdY.mjs → createAggregationRouter-KrQDzx-k.mjs} +7 -6
- package/dist/{createApp-CXrKFciH.mjs → createApp-Df89BEni.mjs} +484 -209
- package/dist/{defineAggregation-ufWjUwml.mjs → defineAggregation-DbPPS8RI.mjs} +1 -0
- package/dist/{defineResource-CxWqDCAy.mjs → defineResource-Bv6EtN1x.mjs} +63 -38
- 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-D2l1mh4g.mjs} +4 -3
- package/dist/encryption/index.d.mts +2 -1
- package/dist/encryption/index.mjs +3 -2
- package/dist/{errorHandler-Bq2OeEQL.mjs → errorHandler-C5NeD6bT.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-Cj42AntO.mjs} +1 -0
- package/dist/{eventPlugin-D2NNR4py.mjs → eventPlugin-CkffEihm.mjs} +5 -4
- package/dist/{eventPlugin-Bg3cP2_u.d.mts → eventPlugin-GF5nnBIq.d.mts} +2 -1
- package/dist/events/index.d.mts +4 -3
- package/dist/events/index.mjs +16 -4
- package/dist/events/transports/redis-stream-entry.d.mts +2 -1
- package/dist/events/transports/redis-stream-entry.mjs +1 -0
- 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 +7 -6
- package/dist/{fastify-augmentation-0WhPnUH7.d.mts → fastify-augmentation-zh0_AYHa.d.mts} +13 -4
- package/dist/{fields-CQ_7KQWw.mjs → fields-CB5Cuzk9.mjs} +1 -0
- package/dist/{fields-D3lhgzhD.d.mts → fields-I_EeRWND.d.mts} +1 -0
- package/dist/{generate-BnsL9GBm.d.mts → generate-DCGuEbqI.d.mts} +1 -0
- package/dist/{generate-D0wZupBg.mjs → generate-EcA6ui4i.mjs} +2 -1
- package/dist/{headers-BvlQSDMB.mjs → headers-3zvE0rM3.mjs} +2 -1
- package/dist/{health-CB_m4S32.mjs → health-DjZYjM7H.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 +4 -3
- package/dist/idempotency/redis.d.mts +2 -1
- package/dist/idempotency/redis.mjs +1 -0
- package/dist/{index-Cx7bro4R.d.mts → index-Bc2ox8_U.d.mts} +5 -4
- package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
- package/dist/{index-Ch16aAah.d.mts → index-CEJNZFtX.d.mts} +53 -15
- package/dist/index-CFThn1K9.d.mts +224 -0
- package/dist/{index-Q5gzEIWY.d.mts → index-CpzxqePp.d.mts} +107 -32
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +11 -10
- package/dist/{init-tlRSt667.mjs → init-BEiNZBsJ.mjs} +19 -23
- 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 +108 -32
- 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 +1 -0
- package/dist/{interface-BGZCzOGL.d.mts → interface-BOk3YnTz.d.mts} +1 -0
- package/dist/{interface-Uk8ONJv7.d.mts → interface-DEWNOMza.d.mts} +1 -0
- package/dist/{interface-n5hpKg1d.mjs → interface-DYzM0q-u.mjs} +1 -0
- package/dist/{jsonBody-BlzAoGCe.mjs → jsonBody-BYbLDi5D.mjs} +2 -1
- package/dist/{keys-Cd316u_y.mjs → keys-C0_pa1tY.mjs} +1 -0
- package/dist/{loadResources-DpU8pfjV.mjs → loadResources-yawi9tAE.mjs} +2 -1
- package/dist/{loadResourcesFromEntry-kvGT6EcO.mjs → loadResourcesFromEntry-BAjYZonx.mjs} +2 -1
- package/dist/logger/index.d.mts +1 -0
- package/dist/logger/index.mjs +1 -0
- package/dist/{mcpPlugin-nRzm5g2s.mjs → mcpPlugin-B_es0hiF.mjs} +22 -23
- package/dist/{memory-CmnzXE5Z.mjs → memory-DR6wpa9F.mjs} +2 -1
- package/dist/{metrics-fdxI5mn_.mjs → metrics-CUdw_wLB.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 +2 -1
- package/dist/module-0pFJA6YW.mjs +78 -0
- package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-wOgj_fnj.mjs} +1 -0
- package/dist/{openapi-B8Vkbxbn.mjs → openapi-B2L4js1v.mjs} +6 -5
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +6 -5
- package/dist/{permissions-Bfu_8y1U.mjs → permissions-L--QDAir.mjs} +214 -41
- package/dist/{pipe-BOLmGIxa.mjs → pipe-DRDNsI2T.mjs} +2 -1
- package/dist/pipeline/index.d.mts +2 -1
- package/dist/pipeline/index.mjs +2 -1
- package/dist/{pipeline-BJnpkY9i.mjs → pipeline-UPQFatit.mjs} +6 -5
- 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-O0FZgESl.mjs} +1 -0
- package/dist/{preloadResources-DCfa2egz.d.mts → preloadResources-CyoJMSiO.d.mts} +117 -12
- package/dist/{preloadResources-DSY5HGpS.mjs → preloadResources-Dz6BjzM6.mjs} +1 -0
- package/dist/presets/filesUpload.d.mts +6 -5
- package/dist/presets/filesUpload.mjs +9 -11
- 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-C4-g4_4P.mjs} +4 -3
- package/dist/{projection-UBDgfMwu.mjs → projection-BHw6xlOQ.mjs} +2 -1
- package/dist/{pushref-registry-BbcnpNTm.d.mts → pushref-registry-Dov9l4qE.d.mts} +1 -0
- package/dist/{queryCachePlugin-DSGuSVLW.mjs → queryCachePlugin-BZr8v46E.mjs} +5 -4
- package/dist/{queryCachePlugin-br4otiqF.d.mts → queryCachePlugin-BzqxconG.d.mts} +3 -2
- package/dist/{rateLimit-DrED-C4v.mjs → rateLimit-CMPY5Qms.mjs} +7 -3
- package/dist/{rateLimitKey-BoWRH3e7.mjs → rateLimitKey-Dn5JNmkj.mjs} +1 -0
- package/dist/{realtime-B9nmIY5V.mjs → realtime-C5NoxWFY.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-CBN84fc7.mjs} +4 -3
- package/dist/registry/index.d.mts +3 -2
- package/dist/registry/index.mjs +3 -2
- package/dist/{registry-BYXUUg21.mjs → registry-4213U4zb.mjs} +2 -1
- package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-Dll8mGgc.mjs} +1 -0
- package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DIiZKGUt.mjs} +2 -1
- package/dist/{repositoryFilter-Dz8k3S4P.mjs → repositoryFilter-f9eAfq_l.mjs} +1 -0
- package/dist/{requestContext-MrlJwECf.mjs → requestContext-2TxXOJ7T.mjs} +1 -0
- package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-CUsjNX9R.mjs} +1 -0
- package/dist/{schedules-CjOd2MG9.mjs → schedules-DdtlICTf.mjs} +3 -2
- package/dist/{schemaConverter-DJvodiHj.mjs → schemaConverter-D--wdJM-.mjs} +70 -17
- package/dist/{schemaIR-Ca7ySNPx.mjs → schemaIR-Bm2enbnh.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-DHx5Fous.mjs} +4 -3
- package/dist/{sessionManager-BHOM3N_0.d.mts → sessionManager-qimlKV0P.d.mts} +1 -0
- package/dist/{simpleEqualityMatcher-Cg05HPsn.mjs → simpleEqualityMatcher-DjQJ7FKA.mjs} +1 -0
- package/dist/{sse-BQ1w0dfl.mjs → sse-CUTo9y0X.mjs} +5 -4
- package/dist/{sseStream-BQ7Qaynp.mjs → sseStream-B_5XcVVd.mjs} +2 -1
- package/dist/{storage-DLUZ04kK.d.mts → storage-Cx9Sz3Ou.d.mts} +1 -0
- package/dist/{store-helpers-DY6xq4sM.mjs → store-helpers-D1MP_gRG.mjs} +1 -0
- package/dist/{streaming-BQcW6_Kq.mjs → streaming-PSZwi8JV.mjs} +1 -0
- package/dist/{subscribe-helpers-DfzsivM6.mjs → subscribe-helpers-C0Tb2aUp.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 +1 -0
- package/dist/testing/index.d.mts +139 -12
- package/dist/testing/index.mjs +230 -16
- package/dist/testing/outboxStoreContract.d.mts +1 -0
- package/dist/testing/outboxStoreContract.mjs +1 -0
- package/dist/testing/storageContract.d.mts +2 -1
- package/dist/testing/storageContract.mjs +1 -0
- package/dist/{tracing-CsGKQJGg.d.mts → tracing-Dro5eH6j.d.mts} +1 -0
- package/dist/{transactionContext-PNdoyLLm.mjs → transactionContext-dAfBVUrk.mjs} +1 -0
- package/dist/{typeGuards-C9KXUly6.mjs → typeGuards-B0ryPo3I.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-CBgvkp8O.d.mts} +51 -12
- 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-Cys0ko9Z.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-ChYJ6CdK.mjs} +1 -0
- package/dist/utils/index.d.mts +16 -7
- package/dist/utils/index.mjs +10 -9
- package/dist/{utils-taUVD4p3.mjs → utils-vL8BrDE2.mjs} +3 -2
- package/dist/{validate-Bk44F2yT.mjs → validate-_KbifpHF.mjs} +2 -1
- package/dist/{versioning-gKWyryT3.mjs → versioning-CHDTor3P.mjs} +3 -2
- 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 +547 -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/index-CCzVR-N3.d.mts +0 -107
- package/dist/module-_-M7C5ES.mjs +0 -29
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import { n as
|
|
7
|
-
import { n as
|
|
1
|
+
|
|
2
|
+
import { a as QueryCacheConfig } from "./QueryCache-DFA-QrU9.mjs";
|
|
3
|
+
import { P as ArcHeaders, i as RequestScope } from "./types-ChuShpCP.mjs";
|
|
4
|
+
import { a as UserBase, l as AnyRecord, r as PermissionCheck } from "./types-B7XeLEgK.mjs";
|
|
5
|
+
import "./elevation-BXCfVcNG.mjs";
|
|
6
|
+
import { n as FieldPermissionMap } from "./fields-I_EeRWND.mjs";
|
|
7
|
+
import { n as EncryptionDirective } from "./types-ByHn9rEO.mjs";
|
|
8
|
+
import { n as DomainEvent } from "./EventTransport-2uVV34WU.mjs";
|
|
8
9
|
import { Filter } from "@classytic/repo-core/filter";
|
|
9
10
|
import { KeysetPaginationResult, OffsetPaginationResult } from "@classytic/repo-core/pagination";
|
|
10
11
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, RouteHandlerMethod, RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
|
|
@@ -1238,11 +1239,27 @@ interface AuthPluginOptions {
|
|
|
1238
1239
|
strictTokenType?: boolean;
|
|
1239
1240
|
}
|
|
1240
1241
|
//#endregion
|
|
1242
|
+
//#region src/core/middlewares/rateLimit.d.ts
|
|
1243
|
+
/**
|
|
1244
|
+
* Per-route CORS override, read by `@fastify/cors` off `routeOptions.config.cors`.
|
|
1245
|
+
*
|
|
1246
|
+
* The app-wide policy cannot serve both an API and public assets: an API wants
|
|
1247
|
+
* `credentials: true` with a pinned origin list, while a public asset wants
|
|
1248
|
+
* `origin: "*"` — and `*` with credentials is forbidden by the CORS spec (arc
|
|
1249
|
+
* throws at boot on that combination). Per-route is the granularity that
|
|
1250
|
+
* resolves it. `false` disables CORS for the route entirely.
|
|
1251
|
+
*
|
|
1252
|
+
* Arc does not interpret the value; `@fastify/cors` owns the semantics. Typed
|
|
1253
|
+
* loosely on purpose so a host is never blocked by arc lagging the plugin's
|
|
1254
|
+
* option surface.
|
|
1255
|
+
*/
|
|
1256
|
+
type RouteCorsConfig = Record<string, unknown> | false;
|
|
1257
|
+
//#endregion
|
|
1241
1258
|
//#region src/types/handlers.d.ts
|
|
1242
1259
|
/**
|
|
1243
1260
|
* Minimal server accessor — exposes safe, read-only server decorators.
|
|
1244
1261
|
* Allows controller handlers to publish events, log, and audit
|
|
1245
|
-
* without switching to `
|
|
1262
|
+
* without switching to `rawHandler`.
|
|
1246
1263
|
*/
|
|
1247
1264
|
interface ServerAccessor {
|
|
1248
1265
|
/** Event bus — publish domain events from any handler */
|
|
@@ -1396,7 +1413,7 @@ interface IRequestContext<TBody = unknown, TParams extends Record<string, string
|
|
|
1396
1413
|
metadata?: TMetadata;
|
|
1397
1414
|
/**
|
|
1398
1415
|
* Fastify server accessor — publish events, log, and audit
|
|
1399
|
-
* from any handler without switching to `
|
|
1416
|
+
* from any handler without switching to `rawHandler`.
|
|
1400
1417
|
*
|
|
1401
1418
|
* @example
|
|
1402
1419
|
* ```typescript
|
|
@@ -1431,7 +1448,7 @@ interface IControllerResponse<T = unknown> {
|
|
|
1431
1448
|
* Controller handler — Arc's standard pattern.
|
|
1432
1449
|
*
|
|
1433
1450
|
* Receives a request context object, returns IControllerResponse.
|
|
1434
|
-
* Use with `
|
|
1451
|
+
* Use with `handler` in routes.
|
|
1435
1452
|
*
|
|
1436
1453
|
* **Generic parameters:**
|
|
1437
1454
|
* - `TResponse` — shape of `IControllerResponse.data` (default: `unknown`)
|
|
@@ -1468,7 +1485,6 @@ interface IControllerResponse<T = unknown> {
|
|
|
1468
1485
|
* path: '/products',
|
|
1469
1486
|
* handler: createProduct,
|
|
1470
1487
|
* permissions: requireAuth(),
|
|
1471
|
-
* raw: false, // Arc wraps this into Fastify handler
|
|
1472
1488
|
* }]
|
|
1473
1489
|
* ```
|
|
1474
1490
|
*/
|
|
@@ -1477,7 +1493,7 @@ type ControllerHandler<TResponse = unknown, TBody = unknown, TParams extends Rec
|
|
|
1477
1493
|
* Fastify native handler
|
|
1478
1494
|
*
|
|
1479
1495
|
* Standard Fastify request/reply pattern.
|
|
1480
|
-
* Use with `
|
|
1496
|
+
* Use with `rawHandler` in routes.
|
|
1481
1497
|
*
|
|
1482
1498
|
* @example
|
|
1483
1499
|
* ```typescript
|
|
@@ -1490,12 +1506,31 @@ type ControllerHandler<TResponse = unknown, TBody = unknown, TParams extends Rec
|
|
|
1490
1506
|
* routes: [{
|
|
1491
1507
|
* method: 'GET',
|
|
1492
1508
|
* path: '/files/:id/download',
|
|
1493
|
-
*
|
|
1509
|
+
* rawHandler: downloadFile,
|
|
1494
1510
|
* permissions: requireAuth(),
|
|
1495
|
-
* raw: true, // Use as-is, no wrapping
|
|
1496
1511
|
* }]
|
|
1497
1512
|
* ```
|
|
1498
1513
|
*/
|
|
1514
|
+
type RawRouteHandler = {
|
|
1515
|
+
/**
|
|
1516
|
+
* Fastify-native route handler — the type behind `RouteDefinition.rawHandler`.
|
|
1517
|
+
*
|
|
1518
|
+
* Declared with METHOD syntax and read back through an indexed access, which
|
|
1519
|
+
* buys two properties a plain arrow alias can't have at once:
|
|
1520
|
+
*
|
|
1521
|
+
* - **Bivariant parameters.** `strictFunctionTypes` exempts method
|
|
1522
|
+
* declarations, so a handler annotated `FastifyRequest<{ Body: CreateBody }>`
|
|
1523
|
+
* assigns without a cast. Fastify's own `RouteHandlerMethod` is an arrow
|
|
1524
|
+
* alias, so it rejects those — hosts used to write `as any`.
|
|
1525
|
+
* - **One call signature.** TypeScript contextually types parameters only
|
|
1526
|
+
* when a single constituent is callable, so inline
|
|
1527
|
+
* `rawHandler: async (request, reply) => …` infers instead of reporting
|
|
1528
|
+
* TS7006.
|
|
1529
|
+
*
|
|
1530
|
+
* The runtime always passes the real `(request, reply)` pair.
|
|
1531
|
+
*/
|
|
1532
|
+
handler(this: FastifyInstance, request: FastifyRequest, reply: FastifyReply): unknown;
|
|
1533
|
+
}["handler"];
|
|
1499
1534
|
type FastifyHandler<RouteGeneric extends Record<string, unknown> = Record<string, unknown>> = (request: FastifyRequest<RouteGeneric>, reply: FastifyReply) => Promise<unknown> | unknown;
|
|
1500
1535
|
/**
|
|
1501
1536
|
* Union type for route handlers
|
|
@@ -1574,7 +1609,7 @@ interface RouteMcpConfig {
|
|
|
1574
1609
|
*
|
|
1575
1610
|
* - `handler: 'string'` → controller method → full Arc pipeline + MCP tool
|
|
1576
1611
|
* - `handler: function` → inline handler → full Arc pipeline + MCP tool
|
|
1577
|
-
* - `
|
|
1612
|
+
* - `rawHandler` → raw Fastify handler → no pipeline, no MCP by default
|
|
1578
1613
|
*/
|
|
1579
1614
|
interface RouteDefinition {
|
|
1580
1615
|
readonly method: RouteMethod;
|
|
@@ -1583,14 +1618,14 @@ interface RouteDefinition {
|
|
|
1583
1618
|
/**
|
|
1584
1619
|
* Route handler.
|
|
1585
1620
|
* - String: controller method name (Arc pipeline) — runtime lookup, no TS coverage on typos.
|
|
1586
|
-
* - Function
|
|
1587
|
-
* -
|
|
1621
|
+
* - Function: receives IRequestContext, returns IControllerResponse (Arc pipeline)
|
|
1622
|
+
* - For a raw Fastify handler `(request, reply)`, use {@link rawHandler}
|
|
1588
1623
|
*
|
|
1589
1624
|
* Prefer `controllerMethod` (2.16) over the string form when you want the
|
|
1590
1625
|
* compiler to catch typos. `handler` stays optional when `controllerMethod`
|
|
1591
1626
|
* is set — exactly one of the two must be declared.
|
|
1592
1627
|
*/
|
|
1593
|
-
readonly handler?: string | ControllerHandler
|
|
1628
|
+
readonly handler?: string | ControllerHandler;
|
|
1594
1629
|
/**
|
|
1595
1630
|
* Typed function-reference handler (2.16). Receives the live controller
|
|
1596
1631
|
* instance and returns the method to invoke — TypeScript catches typos
|
|
@@ -1602,11 +1637,15 @@ interface RouteDefinition {
|
|
|
1602
1637
|
* handlers go through), so there's no per-request lookup overhead.
|
|
1603
1638
|
* The returned method is bound to the controller before dispatch.
|
|
1604
1639
|
*
|
|
1640
|
+
* PIPELINE-ONLY: the referenced method is invoked as a `ControllerHandler`
|
|
1641
|
+
* (one `IRequestContext`), because the router derives "is this raw?" from
|
|
1642
|
+
* {@link rawHandler} alone and this field is mutually exclusive with it.
|
|
1643
|
+
* There is no flag that could make a `controllerMethod` route raw. For a
|
|
1644
|
+
* Fastify-native controller method, put its NAME in `rawHandler` — the
|
|
1645
|
+
* lookup is the same, and the field states the calling convention.
|
|
1646
|
+
*
|
|
1605
1647
|
* Mutually exclusive with `handler` — passing both throws at boot
|
|
1606
|
-
* with a clear "pick one" message.
|
|
1607
|
-
* returned function accepts mirrors the `handler` rules: a plain
|
|
1608
|
-
* `ControllerHandler` for pipeline routes, a raw Fastify handler when
|
|
1609
|
-
* the route is `raw: true`.
|
|
1648
|
+
* with a clear "pick one" message.
|
|
1610
1649
|
*
|
|
1611
1650
|
* Typed loosely (`(controller: unknown) => …`) at the type-system
|
|
1612
1651
|
* boundary because `RouteDefinition` is not generic over the
|
|
@@ -1630,14 +1669,33 @@ interface RouteDefinition {
|
|
|
1630
1669
|
* });
|
|
1631
1670
|
* ```
|
|
1632
1671
|
*/
|
|
1633
|
-
readonly controllerMethod?: (controller: unknown) => ControllerHandler
|
|
1672
|
+
readonly controllerMethod?: (controller: unknown) => ControllerHandler;
|
|
1634
1673
|
/** Permission check — REQUIRED */
|
|
1635
1674
|
readonly permissions: PermissionCheck;
|
|
1636
1675
|
/**
|
|
1637
|
-
*
|
|
1638
|
-
*
|
|
1639
|
-
|
|
1640
|
-
|
|
1676
|
+
* Fastify-native handler — receives `(request, reply)` and owns the response.
|
|
1677
|
+
* Bypasses arc's pipeline entirely: no `IControllerResponse` shaping, no
|
|
1678
|
+
* field-write sanitization.
|
|
1679
|
+
*
|
|
1680
|
+
* Mutually exclusive with {@link handler}. The FIELD carries the intent, so
|
|
1681
|
+
* there is no flag to forget: the previous `raw: boolean` let a Fastify-shaped
|
|
1682
|
+
* function sit in `handler` without it (silently run through the pipeline) or
|
|
1683
|
+
* a pipeline handler sit there with it (silently unwrapped), and neither
|
|
1684
|
+
* mismatch was a type error.
|
|
1685
|
+
*
|
|
1686
|
+
* Splitting the two also restores inference. One field carrying both shapes
|
|
1687
|
+
* meant a union of several function types, which has no single contextual
|
|
1688
|
+
* signature — so an inline `handler: async (req) => …` reported TS7006 and
|
|
1689
|
+
* every author annotated `req` by hand. Fastify types its own
|
|
1690
|
+
* `RouteOptions.handler` as ONE function type for exactly this reason; see
|
|
1691
|
+
* {@link RawRouteHandler} for why arc declares its own rather than reusing
|
|
1692
|
+
* `RouteHandlerMethod` directly.
|
|
1693
|
+
*
|
|
1694
|
+
* Accepts a controller-method NAME as well, same as {@link handler} — the
|
|
1695
|
+
* lookup is identical and only the calling convention differs, so a
|
|
1696
|
+
* Fastify-native controller method stays reachable by name.
|
|
1697
|
+
*/
|
|
1698
|
+
readonly rawHandler?: string | RawRouteHandler;
|
|
1641
1699
|
/** Logical operation name (pipeline keys, MCP tool naming). */
|
|
1642
1700
|
readonly operation?: string;
|
|
1643
1701
|
/** OpenAPI summary */
|
|
@@ -1669,7 +1727,8 @@ interface RouteDefinition {
|
|
|
1669
1727
|
*/
|
|
1670
1728
|
readonly tenantScope?: boolean;
|
|
1671
1729
|
/**
|
|
1672
|
-
* SSE streaming mode.
|
|
1730
|
+
* SSE streaming mode. Requires {@link rawHandler} — the handler is invoked
|
|
1731
|
+
* with `(request, reply)` and owns the response. Two shapes work:
|
|
1673
1732
|
*
|
|
1674
1733
|
* - Write to `reply.raw` directly (NDJSON, custom SSE — historical contract).
|
|
1675
1734
|
* - Return a Web `ReadableStream` (Vercel AI SDK's `result.toUIMessageStream()`,
|
|
@@ -1700,7 +1759,7 @@ interface RouteDefinition {
|
|
|
1700
1759
|
* `onFieldWriteDenied: 'reject' | 'strip'` setting governs how denials
|
|
1701
1760
|
* are surfaced.
|
|
1702
1761
|
*
|
|
1703
|
-
* `
|
|
1762
|
+
* `rawHandler` routes ALWAYS bypass this — they've opted out of the
|
|
1704
1763
|
* pipeline entirely.
|
|
1705
1764
|
*/
|
|
1706
1765
|
readonly fieldWrite?: boolean;
|
|
@@ -1723,6 +1782,22 @@ interface RouteDefinition {
|
|
|
1723
1782
|
* it to a dedicated `routes:` entry, or rely on the resource-level limit.
|
|
1724
1783
|
*/
|
|
1725
1784
|
readonly rateLimit?: RateLimitConfig | false;
|
|
1785
|
+
/**
|
|
1786
|
+
* Per-route CORS override, forwarded to `@fastify/cors` as
|
|
1787
|
+
* `routeOptions.config.cors`. `undefined` inherits the app policy; `false`
|
|
1788
|
+
* disables CORS for this route; an object replaces the app policy for it.
|
|
1789
|
+
*
|
|
1790
|
+
* Needed because one app-wide policy cannot serve both an API and a public
|
|
1791
|
+
* asset: an API wants `credentials: true` with a pinned origin list, a public
|
|
1792
|
+
* asset wants `origin: "*"`, and `*` + credentials is forbidden by the spec
|
|
1793
|
+
* (arc throws at boot on that pair).
|
|
1794
|
+
*
|
|
1795
|
+
* ```ts
|
|
1796
|
+
* { method: "GET", path: "/manifest.json", permissions: allowPublic(),
|
|
1797
|
+
* cors: { origin: "*", credentials: false }, handler }
|
|
1798
|
+
* ```
|
|
1799
|
+
*/
|
|
1800
|
+
readonly cors?: RouteCorsConfig;
|
|
1726
1801
|
/**
|
|
1727
1802
|
* Fastify route schema. Each slot (`body`, `querystring`, `params`,
|
|
1728
1803
|
* `headers`, `response[status]`) accepts a plain JSON Schema object
|
|
@@ -2829,7 +2904,7 @@ interface ResourceConfig<TDoc = AnyRecord> {
|
|
|
2829
2904
|
* object, primitive) is supported via auto-envelope (2.17+) but the
|
|
2830
2905
|
* explicit envelope is the canonical contract — declared `fields:`
|
|
2831
2906
|
* permissions, custom `status`, `meta`, and `headers` only work when
|
|
2832
|
-
* you return the envelope.
|
|
2907
|
+
* you return the envelope. Declare a route's function via `rawHandler` to opt out of
|
|
2833
2908
|
* arc's pipeline entirely (custom streaming, SSE, manual `reply.send()`).
|
|
2834
2909
|
*
|
|
2835
2910
|
* **Path collisions with auto-CRUD are detected at `defineResource()` time.**
|
|
@@ -2844,7 +2919,7 @@ interface ResourceConfig<TDoc = AnyRecord> {
|
|
|
2844
2919
|
* ```typescript
|
|
2845
2920
|
* routes: [
|
|
2846
2921
|
* { method: 'GET', path: '/stats', handler: 'getStats', permissions: auth() },
|
|
2847
|
-
* { method: 'POST', path: '/webhook',
|
|
2922
|
+
* { method: 'POST', path: '/webhook', rawHandler: webhookFn, permissions: auth() },
|
|
2848
2923
|
* ]
|
|
2849
2924
|
* ```
|
|
2850
2925
|
*
|
|
@@ -4220,4 +4295,4 @@ interface ValidateOptions {
|
|
|
4220
4295
|
strict?: boolean;
|
|
4221
4296
|
}
|
|
4222
4297
|
//#endregion
|
|
4223
|
-
export { OpenApiSchemas as $,
|
|
4298
|
+
export { OpenApiSchemas as $, TreeMixin as $t, RequestIdOptions as A, BaseControllerOptions as An, RouteDefinition as At, defineResource as B, RawRouteHandler as Bt, RequestContext as C, createHookSystem as Cn, PipelineStep as Ct, HealthCheck as D, ArcGetResult as Dn, ActionEntry as Dt, GracefulShutdownOptions as E, ArcDeleteResult as En, ActionDefinition as Et, FastifyWithDecorators as F, BodySanitizerConfig as Fn, ControllerLike as Ft, OnTenantDeleteConfig as G, Authenticator as Gt, CrudController as H, ServerAccessor as Ht, MiddlewareHandler as I, FastifyHandler as It, PresetHook as J, TokenPair as Jt, ResolvedTenantPurge as K, AuthenticatorContext as Kt, RequestWithExtras as L, IController as Lt, EventsDecorator as M, ControllerConstructionOptions as Mn, RouteMethod as Mt, FastifyRequestExtras as N, ListResult as Nn, RateLimitConfig as Nt, HealthOptions as O, ArcListResult as On, ActionHandlerFn as Ot, FastifyWithAuth as P, BodySanitizer as Pn, ControllerHandler as Pt, MiddlewareConfig as Q, TreeExt as Qt, RegisterOptions as R, IControllerResponse as Rt, QueryParserInterface as S, beforeUpdate as Sn, PipelineContext as St, CrudRouterOptions as T, ArcCreateResult as Tn, ResourceCacheConfig as Tt, ResourceConfig as U, AuthHelpers as Ut, ResourceDefinition as V, RouteHandler as Vt, ResourcePermissions as W, AuthPluginOptions as Wt, CrudRouteKey as X, SoftDeleteExt as Xt, PresetResult as Y, BaseController as Yt, CrudSchemas as Z, SoftDeleteMixin as Zt, ControllerQueryOptions as _, afterCreate as _n, Guard as _t, InferAdapterDoc as a, QueryResolver as an, ResourceExtensions as at, ParsedQuery as b, beforeCreate as bn, OperationFilter as bt, TypedController as c, AccessControlConfig as cn, AggMeasureShorthand as ct, PaginationResult as d, HookHandler as dn, AggregationDateRangeRequirement as dt, SlugExt as en, RouteSchemaOptions as et, IntrospectionData as f, HookOperation as fn, AggregationIndexHint as ft, ArcInternalMetadata as g, HookSystemOptions as gn, AggregationsMap as gt, ResourceMetadata as h, HookSystem as hn, AggregationRateLimit as ht, ValidationResult as i, BaseCrudController as in, ResourceHooks as it, ArcDecorator as j, ControllerConfigurableOptions as jn, RouteMcpConfig as jt, IntrospectionPluginOptions as k, ArcUpdateResult as kn, ActionsMap as kt, TypedRepository as l, DefineHookOptions as ln, AggregationCacheConfig as lt, RegistryStats as m, HookRegistration as mn, AggregationMaterializedResult as mt, ConfigError as n, BulkExt as nn, FieldRule$1 as nt, InferDocType as o, QueryResolverConfig as on, EventDefinition as ot, RegistryEntry as p, HookPhase as pn, AggregationMaterializedContext as pt, PresetFunction as q, JwtContext as qt, ValidateOptions as r, BulkMixin as rn, ResourceHookContext as rt, InferResourceDoc as s, AccessControl as sn, AggMeasureInput as st, RouteHandlerMethod$1 as t, SlugMixin as tn, ArcFieldRule as tt, TypedResourceConfig as u, HookContext as un, AggregationConfig as ut, LookupOption as v, afterDelete as vn, Interceptor as vt, ServiceContext as w, defineHook as wn, Transform as wt, PopulateOption as x, beforeDelete as xn, PipelineConfig as xt, OwnershipCheck as y, afterUpdate as yn, NextFunction as yt, ResourceRegistry as z, IRequestContext as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import { B as
|
|
7
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { $t as TreeMixin, A as RequestIdOptions, An as BaseControllerOptions, B as defineResource, Bt as RawRouteHandler, C as RequestContext, D as HealthCheck, Dn as ArcGetResult, E as GracefulShutdownOptions, En as ArcDeleteResult, F as FastifyWithDecorators, Ft as ControllerLike, H as CrudController, L as RequestWithExtras, Lt as IController, Mn as ControllerConstructionOptions, N as FastifyRequestExtras, Nn as ListResult, Nt as RateLimitConfig, O as HealthOptions, On as ArcListResult, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as TreeExt, Rt as IControllerResponse, S as QueryParserInterface, T as CrudRouterOptions, Tn as ArcCreateResult, U as ResourceConfig, V as ResourceDefinition, Vt as RouteHandler, Wt as AuthPluginOptions, X as CrudRouteKey, Xt as SoftDeleteExt, Y as PresetResult, Yt as BaseController, Z as CrudSchemas, Zt as SoftDeleteMixin, a as InferAdapterDoc, c as TypedController, ct as AggMeasureShorthand, d as PaginationResult, dt as AggregationDateRangeRequirement, en as SlugExt, et as RouteSchemaOptions, f as IntrospectionData, ft as AggregationIndexHint, g as ArcInternalMetadata, gt as AggregationsMap, h as ResourceMetadata, ht as AggregationRateLimit, i as ValidationResult, in as BaseCrudController, jn as ControllerConfigurableOptions, k as IntrospectionPluginOptions, kn as ArcUpdateResult, l as TypedRepository, lt as AggregationCacheConfig, m as RegistryStats, mt as AggregationMaterializedResult, n as ConfigError, nn as BulkExt, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, pt as AggregationMaterializedContext, q as PresetFunction, r as ValidateOptions, rn as BulkMixin, s as InferResourceDoc, st as AggMeasureInput, t as RouteHandlerMethod, tn as SlugMixin, u as TypedResourceConfig, ut as AggregationConfig, w as ServiceContext, y as OwnershipCheck, zt as IRequestContext } from "./index-CpzxqePp.mjs";
|
|
3
|
+
import { a as UserBase, d as JWTPayload, i as PermissionContext, l as AnyRecord, m as UserOrganization, n as DataPolicy, r as PermissionCheck, t as AuthorizationDecision, u as ArcRequest } from "./types-B7XeLEgK.mjs";
|
|
4
|
+
import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-I_EeRWND.mjs";
|
|
5
|
+
import "./fastify-augmentation-zh0_AYHa.mjs";
|
|
6
|
+
import { A as DEFAULT_ID_FIELD, B as MAX_FILTER_DEPTH, D as defineAggregation, F as DEFAULT_UPDATE_METHOD, G as RESERVED_QUERY_PARAMS, H as MAX_SEARCH_LENGTH, I as HOOK_OPERATIONS, K as SYSTEM_FIELDS, L as HOOK_PHASES, M as DEFAULT_MAX_LIMIT, N as DEFAULT_SORT, O as CRUD_OPERATIONS, P as DEFAULT_TENANT_FIELD, R as HookOperation, S as mergeResourceConfig, U as MUTATION_OPERATIONS, V as MAX_REGEX_LENGTH, W as MutationOperation, b as ResourceSeams, j as DEFAULT_LIMIT, k as CrudOperation, p as getControllerScope, v as defineResourceVariants, w as defineAction, x as SeamedResourceConfig, y as AdapterLike, z as HookPhase } from "./index-Bc2ox8_U.mjs";
|
|
7
|
+
import { B as anyOf, F as createDynamicPermissionMatrix, G as requireOwnership, H as denyAll, I as createOrgPermissions, L as allOf, M as DynamicPermissionMatrix, N as DynamicPermissionMatrixConfig, W as requireAuth, Y as when, c as publicReadAdminWrite, d as requireOrgMembership, f as requireOrgRole, h as requireTeamMembership, i as ownerWithAdminBypass, l as readOnly, m as requireServiceScope, n as authenticated, o as presets_d_exports, p as requireScopeContext, q as requireRoles, r as fullPublic, s as publicRead, t as adminOnly, u as requireOrgInScope, z as allowPublic } from "./index-CEJNZFtX.mjs";
|
|
8
|
+
import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-BGdVwP25.mjs";
|
|
8
9
|
//#region src/index.d.ts
|
|
9
10
|
declare const version: string;
|
|
10
11
|
//#endregion
|
|
11
|
-
export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
|
12
|
+
export { type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, type AnyRecord, type ArcCreateResult, type ArcDeleteResult, ArcError, type ArcGetResult, type ArcInternalMetadata, type ArcListResult, type ArcRequest, type ArcUpdateResult, type AuthPluginOptions, type AuthorizationDecision, BaseController, type BaseControllerOptions, BaseCrudController, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type ControllerLike, type CrudController, type CrudOperation, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataPolicy, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, type HookOperation, type HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, type MutationOperation, NotFoundError, type OwnershipCheck, type PaginationResult, type PermissionCheck, type PermissionContext, type PresetFunction, type PresetResult, type QueryParserInterface, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RawRouteHandler, type RegistryEntry, type RegistryStats, type RequestContext, type RequestIdOptions, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type ResourceSeams, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SeamedResourceConfig, type ServiceContext, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, ownerWithAdminBypass, presets_d_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import { d as
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "./constants-D3Dv4LAV.mjs";
|
|
3
|
+
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-Cj42AntO.mjs";
|
|
4
|
+
import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-De7GqHck.mjs";
|
|
5
|
+
import { n as applyFieldWritePermissions, r as fields, t as applyFieldReadPermissions } from "./fields-CB5Cuzk9.mjs";
|
|
6
|
+
import { a as ResourceDefinition, t as defineResource } from "./defineResource-Bv6EtN1x.mjs";
|
|
7
|
+
import { c as getControllerScope } from "./pipeline-UPQFatit.mjs";
|
|
8
|
+
import { t as defineAggregation } from "./defineAggregation-DbPPS8RI.mjs";
|
|
9
|
+
import { a as mergeResourceConfig, i as defineResourceVariants, o as defineAction } from "./core-BGpIxINN.mjs";
|
|
10
|
+
import { C as requireScopeContext, I as requireAuth, L as requireOwnership, M as anyOf, P as denyAll, S as requireOrgRole, T as requireTeamMembership, V as when, b as requireOrgInScope, c as publicReadAdminWrite, i as ownerWithAdminBypass, j as allowPublic, k as allOf, l as readOnly, n as authenticated, o as presets_exports, r as fullPublic, s as publicRead, t as adminOnly, v as createDynamicPermissionMatrix, w as requireServiceScope, x as requireOrgMembership, y as createOrgPermissions, z as requireRoles } from "./permissions-L--QDAir.mjs";
|
|
10
11
|
//#region src/index.ts
|
|
11
|
-
const version = "2.
|
|
12
|
+
const version = "2.31.0";
|
|
12
13
|
//#endregion
|
|
13
14
|
export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, NotFoundError, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAction, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, mergeResourceConfig, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
1
2
|
import * as fs from "node:fs/promises";
|
|
2
3
|
import * as path from "node:path";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
@@ -459,6 +460,11 @@ export async function createAppInstance()${ts ? ": Promise<FastifyInstance>" : "
|
|
|
459
460
|
preset: config.env === 'production' ? (${config.edge ? "'edge'" : "'production'"}) : 'development',
|
|
460
461
|
resources,
|
|
461
462
|
resourcePrefix: '/api',
|
|
463
|
+
// Arc registers the error handler itself (CastError → 400, validation →
|
|
464
|
+
// 422, duplicate key → 409). Configure it HERE — registering
|
|
465
|
+
// errorHandlerPlugin again in your own plugins file overrides arc's in the
|
|
466
|
+
// same scope and boots with an FSTWRN004 warning.
|
|
467
|
+
errorHandler: { includeStack: config.isDev },
|
|
462
468
|
${authConfig}
|
|
463
469
|
cors: {
|
|
464
470
|
origin: config.cors.origins,
|
|
@@ -608,8 +614,7 @@ export const authResource = defineResource({
|
|
|
608
614
|
path: '/register',
|
|
609
615
|
summary: 'Register new user',
|
|
610
616
|
permissions: allowPublic(),
|
|
611
|
-
|
|
612
|
-
raw: true,
|
|
617
|
+
rawHandler: handlers.register,
|
|
613
618
|
schema: { body: schemas.registerBody, response: { 201: schemas.successResponse } },
|
|
614
619
|
},
|
|
615
620
|
{
|
|
@@ -617,8 +622,7 @@ export const authResource = defineResource({
|
|
|
617
622
|
path: '/login',
|
|
618
623
|
summary: 'User login',
|
|
619
624
|
permissions: allowPublic(),
|
|
620
|
-
|
|
621
|
-
raw: true,
|
|
625
|
+
rawHandler: handlers.login,
|
|
622
626
|
schema: { body: schemas.loginBody, response: { 200: schemas.loginResponse } },
|
|
623
627
|
},
|
|
624
628
|
{
|
|
@@ -626,8 +630,7 @@ export const authResource = defineResource({
|
|
|
626
630
|
path: '/refresh',
|
|
627
631
|
summary: 'Refresh access token',
|
|
628
632
|
permissions: allowPublic(),
|
|
629
|
-
|
|
630
|
-
raw: true,
|
|
633
|
+
rawHandler: handlers.refreshToken,
|
|
631
634
|
schema: { body: schemas.refreshBody, response: { 200: schemas.tokenResponse } },
|
|
632
635
|
},
|
|
633
636
|
{
|
|
@@ -635,8 +638,7 @@ export const authResource = defineResource({
|
|
|
635
638
|
path: '/forgot-password',
|
|
636
639
|
summary: 'Request password reset',
|
|
637
640
|
permissions: allowPublic(),
|
|
638
|
-
|
|
639
|
-
raw: true,
|
|
641
|
+
rawHandler: handlers.forgotPassword,
|
|
640
642
|
schema: { body: schemas.forgotBody, response: { 200: schemas.successResponse } },
|
|
641
643
|
},
|
|
642
644
|
{
|
|
@@ -644,8 +646,7 @@ export const authResource = defineResource({
|
|
|
644
646
|
path: '/reset-password',
|
|
645
647
|
summary: 'Reset password with token',
|
|
646
648
|
permissions: allowPublic(),
|
|
647
|
-
|
|
648
|
-
raw: true,
|
|
649
|
+
rawHandler: handlers.resetPassword,
|
|
649
650
|
schema: { body: schemas.resetBody, response: { 200: schemas.successResponse } },
|
|
650
651
|
},
|
|
651
652
|
],
|
|
@@ -669,8 +670,7 @@ export const userProfileResource = defineResource({
|
|
|
669
670
|
path: '/me',
|
|
670
671
|
summary: 'Get current user profile',
|
|
671
672
|
permissions: requireAuth(),
|
|
672
|
-
|
|
673
|
-
raw: true,
|
|
673
|
+
rawHandler: handlers.getUserProfile,
|
|
674
674
|
schema: { response: { 200: schemas.userProfileResponse } },
|
|
675
675
|
},
|
|
676
676
|
{
|
|
@@ -678,8 +678,7 @@ export const userProfileResource = defineResource({
|
|
|
678
678
|
path: '/me',
|
|
679
679
|
summary: 'Update current user profile',
|
|
680
680
|
permissions: requireAuth(),
|
|
681
|
-
|
|
682
|
-
raw: true,
|
|
681
|
+
rawHandler: handlers.updateUserProfile,
|
|
683
682
|
schema: { body: schemas.updateUserBody, response: { 200: schemas.userProfileResponse } },
|
|
684
683
|
},
|
|
685
684
|
],
|
|
@@ -2533,7 +2532,6 @@ function pluginsIndexTemplate(config) {
|
|
|
2533
2532
|
*/
|
|
2534
2533
|
|
|
2535
2534
|
${typeImport}${ts ? "import type { AppConfig } from '../config/index.js';\n" : ""}import { openApiPlugin, scalarPlugin } from '@classytic/arc/docs';
|
|
2536
|
-
import { errorHandlerPlugin } from '@classytic/arc/plugins';
|
|
2537
2535
|
`;
|
|
2538
2536
|
content += `
|
|
2539
2537
|
/**
|
|
@@ -2546,12 +2544,9 @@ export async function registerPlugins(
|
|
|
2546
2544
|
app${appType},
|
|
2547
2545
|
deps${configType}
|
|
2548
2546
|
)${ts ? ": Promise<void>" : ""} {
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
//
|
|
2552
|
-
await app.register(errorHandlerPlugin, {
|
|
2553
|
-
includeStack: config.isDev,
|
|
2554
|
-
});
|
|
2547
|
+
// NOTE: no error handler here — arc registers it inside createApp().
|
|
2548
|
+
// Configure it via createApp({ errorHandler: { includeStack } }) in app.ts.
|
|
2549
|
+
// Registering it again would override arc's in the same scope (FSTWRN004).
|
|
2555
2550
|
|
|
2556
2551
|
// API Documentation (Scalar UI)
|
|
2557
2552
|
// OpenAPI spec: /_docs/openapi.json
|
|
@@ -2567,8 +2562,9 @@ export async function registerPlugins(
|
|
|
2567
2562
|
theme: 'default',
|
|
2568
2563
|
});
|
|
2569
2564
|
|
|
2570
|
-
// Add your custom plugins here:
|
|
2571
|
-
//
|
|
2565
|
+
// Add your custom plugins here — deps carries your config and services:
|
|
2566
|
+
// const { config } = deps;
|
|
2567
|
+
// await app.register(myCustomPlugin, { apiKey: config.someKey });
|
|
2572
2568
|
}
|
|
2573
2569
|
`;
|
|
2574
2570
|
return content;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { n as DomainEvent } from "../EventTransport-2uVV34WU.mjs";
|
|
3
|
+
import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-BOXVggMf.mjs";
|
|
3
4
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
4
5
|
//#region src/integrations/event-gateway.d.ts
|
|
5
6
|
interface EventGatewayOptions {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
1
2
|
import fp from "fastify-plugin";
|
|
2
3
|
//#region src/integrations/event-gateway.ts
|
|
3
4
|
const eventGatewayPluginImpl = async (fastify, opts = {}) => {
|
|
4
5
|
const { auth = true, orgScoped = false, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
|
|
5
6
|
if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
|
|
6
7
|
if (opts.sse !== false) {
|
|
7
|
-
const { default: ssePlugin } = await import("../sse-
|
|
8
|
+
const { default: ssePlugin } = await import("../sse-CUTo9y0X.mjs").then((n) => n.r);
|
|
8
9
|
await fastify.register(ssePlugin, {
|
|
9
10
|
path: opts.sse?.path ?? "/events/stream",
|
|
10
11
|
requireAuth: auth,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-BOXVggMf.mjs";
|
|
2
3
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
3
|
-
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-
|
|
4
|
-
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-
|
|
4
|
+
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-C-481Zf2.mjs";
|
|
5
|
+
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-CwcUQ610.mjs";
|
|
5
6
|
import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
|
|
6
7
|
import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
|
|
7
8
|
export type { BetterAuthHandler, CallToolResult, CreateMcpServerConfig, CrudOperation, EventGatewayOptions, JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, McpAuthResult, McpPluginOptions, McpResourceConfig, PromptDefinition, QueueStats, StreamlinePluginOptions, ToolAnnotations, ToolContext, ToolDefinition, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription, WorkflowLike, WorkflowRunLike };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { a as JobMeta, c as JobsPluginOptions, d as ExecuteTimedHandlerOptions, f as TimedHandlerLogger, i as JobDispatcher, l as QueueStats, n as JobDefinition, o as JobRepeatOptions, p as executeTimedHandler, r as JobDispatchOptions, s as JobStatus, t as jobsPlugin, u as defineJob } from "../../index-C-481Zf2.mjs";
|
|
2
3
|
export { type ExecuteTimedHandlerOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobRepeatOptions, type JobStatus, type JobsPluginOptions, type QueueStats, type TimedHandlerLogger, defineJob, executeTimedHandler, jobsPlugin };
|