@classytic/arc 2.28.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-B65zbz9m.mjs → BaseController-De7GqHck.mjs} +25 -24
- package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
- package/dist/EventTransport-9mlTgqzE.mjs +104 -0
- package/dist/{HookSystem-C1vB_Gc9.mjs → HookSystem-BcmPyq5I.mjs} +16 -35
- 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 +3 -2
- 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/authorizationDecision-ChvUQGG1.mjs +266 -0
- package/dist/{buildHandler-Dtwd8fdz.mjs → buildHandler-CDrCJzmB.mjs} +34 -7
- 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 -5
- package/dist/{core-BGa8TXJR.mjs → core-BGpIxINN.mjs} +4 -49
- package/dist/{createActionRouter-C-N7z2EL.mjs → createActionRouter-CDXEdasl.mjs} +8 -7
- package/dist/{createAggregationRouter-wzwFa_dW.mjs → createAggregationRouter-KrQDzx-k.mjs} +10 -22
- package/dist/{createApp-Du5G54TM.mjs → createApp-Df89BEni.mjs} +505 -209
- package/dist/defineAggregation-DbPPS8RI.mjs +48 -0
- package/dist/{defineResource-2zvVVpxg.mjs → defineResource-Bv6EtN1x.mjs} +90 -72
- 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-DrQ_FesK.mjs → eventPlugin-CkffEihm.mjs} +6 -106
- 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 +17 -340
- 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-OzYGIiU1.d.mts → fastify-augmentation-zh0_AYHa.d.mts} +13 -4
- package/dist/{applyPermissionResult-BnyVE9eD.mjs → fields-CB5Cuzk9.mjs} +2 -107
- 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 +5 -4
- package/dist/idempotency/redis.d.mts +2 -1
- package/dist/idempotency/redis.mjs +1 -0
- package/dist/{index-CjVg-Epg.d.mts → index-Bc2ox8_U.d.mts} +6 -5
- package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
- package/dist/{index-BMnbzvtO.d.mts → index-CEJNZFtX.d.mts} +242 -24
- package/dist/index-CFThn1K9.d.mts +224 -0
- package/dist/{index-DPRH0Cme.d.mts → index-CpzxqePp.d.mts} +203 -97
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +11 -9
- 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 +9 -9
- 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-Cs6nRGCt.mjs → mcpPlugin-B_es0hiF.mjs} +52 -60
- 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 -3
- package/dist/migrations/index.mjs +2 -4
- package/dist/module-0pFJA6YW.mjs +78 -0
- package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-wOgj_fnj.mjs} +1 -0
- package/dist/{openapi-BLV4OMXb.mjs → openapi-B2L4js1v.mjs} +6 -5
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +6 -4
- package/dist/{permissions-BrtiBKGs.mjs → permissions-L--QDAir.mjs} +518 -316
- 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-BGRnV-To.mjs → pipeline-UPQFatit.mjs} +7 -20
- 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-CM4uUaFv.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 +15 -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-DwFDVKP0.mjs → presets-C4-g4_4P.mjs} +27 -10
- package/dist/projection-BHw6xlOQ.mjs +18 -0
- 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-DEuDu9io.mjs → realtime-C5NoxWFY.mjs} +20 -8
- 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-DTp18Ah_.mjs → registerRoute-CBN84fc7.mjs} +5 -2
- package/dist/registry/index.d.mts +3 -2
- package/dist/registry/index.mjs +3 -2
- package/dist/{registry-9km_w1aP.mjs → registry-4213U4zb.mjs} +3 -2
- package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-Dll8mGgc.mjs} +1 -0
- package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DIiZKGUt.mjs} +2 -1
- package/dist/repositoryFilter-f9eAfq_l.mjs +45 -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-C0Tb2aUp.mjs +340 -0
- 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 +167 -12
- package/dist/testing/index.mjs +522 -205
- 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-Dmw-6Qeo.d.mts → types-B7XeLEgK.d.mts} +127 -90
- 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-Cu6vVJmh.d.mts → types-CBgvkp8O.d.mts} +82 -12
- package/dist/{types-DjC-KUCz.d.mts → types-ChuShpCP.d.mts} +1 -0
- package/dist/{types-QFGc3Cjv.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 -10
- 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 +15 -7
- 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-CZY4EGga.d.mts +0 -107
- package/dist/module-_-M7C5ES.mjs +0 -29
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as ForbiddenError } from "./errors-Cj42AntO.mjs";
|
|
2
3
|
//#region src/pipeline/pipe.ts
|
|
3
4
|
/**
|
|
4
5
|
* Compose pipeline steps into an ordered array.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { Ct as PipelineStep, Rt as IControllerResponse, St as PipelineContext, _t as Guard, bt as OperationFilter, vt as Interceptor, wt as Transform, xt as PipelineConfig, yt as NextFunction } from "../index-CpzxqePp.mjs";
|
|
2
3
|
//#region src/pipeline/guard.d.ts
|
|
3
4
|
interface GuardOptions {
|
|
4
5
|
operations?: OperationFilter;
|
package/dist/pipeline/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as pipe, t as executePipeline } from "../pipe-DRDNsI2T.mjs";
|
|
2
3
|
//#region src/pipeline/guard.ts
|
|
3
4
|
/**
|
|
4
5
|
* Create a named guard.
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as getUserRoles } from "./userHelpers-ChYJ6CdK.mjs";
|
|
3
|
+
import { b as isElevated, n as PUBLIC_SCOPE, x as isMember } from "./types-Cys0ko9Z.mjs";
|
|
4
|
+
import { i as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-CB5Cuzk9.mjs";
|
|
5
|
+
import { t as executePipeline } from "./pipe-DRDNsI2T.mjs";
|
|
6
|
+
import { t as buildRequestScopeProjection } from "./projection-BHw6xlOQ.mjs";
|
|
5
7
|
import { isPaginatedResult, toCanonicalList } from "@classytic/repo-core/pagination";
|
|
6
|
-
//#region src/scope/projection.ts
|
|
7
|
-
/**
|
|
8
|
-
* Compute the request-scope projection. Returns `undefined` when no
|
|
9
|
-
* scope is attached (public / unscoped routes) so hosts can idiomatically
|
|
10
|
-
* write `ctx.scope?.organizationId` without a double-null check.
|
|
11
|
-
*/
|
|
12
|
-
function buildRequestScopeProjection(scope) {
|
|
13
|
-
if (!scope) return void 0;
|
|
14
|
-
return {
|
|
15
|
-
organizationId: getOrgId(scope),
|
|
16
|
-
userId: getUserId(scope),
|
|
17
|
-
orgRoles: isMember(scope) ? scope.orgRoles : void 0
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
8
|
//#region src/core/fastifyAdapter.ts
|
|
22
9
|
/** Type guard for Mongoose-like documents with toObject() */
|
|
23
10
|
function isMongooseDoc(obj) {
|
|
@@ -334,4 +321,4 @@ function buildActionPipelineHandler(handler, steps, operation, resourceName) {
|
|
|
334
321
|
};
|
|
335
322
|
}
|
|
336
323
|
//#endregion
|
|
337
|
-
export { createFastifyHandler as a, getControllerScope as c, createCrudHandlers as i, sendControllerResponse as l, buildPipelineHandler as n, createRequestContext as o, resolvePipelineSteps as r, getControllerContext as s, buildActionPipelineHandler as t
|
|
324
|
+
export { createFastifyHandler as a, getControllerScope as c, createCrudHandlers as i, sendControllerResponse as l, buildPipelineHandler as n, createRequestContext as o, resolvePipelineSteps as r, getControllerContext as s, buildActionPipelineHandler as t };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
1
|
+
|
|
2
|
+
import { At as RouteDefinition, J as PresetHook, Q as MiddlewareConfig, et as RouteSchemaOptions } from "../index-CpzxqePp.mjs";
|
|
3
|
+
import { l as AnyRecord } from "../types-B7XeLEgK.mjs";
|
|
4
|
+
import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-CpYUJmPA.mjs";
|
|
5
|
+
import { _ as _default$3, d as ScheduleStats, f as SchedulesPluginOptions, g as HealthOptions, h as HealthCheck, m as schedulesPlugin, p as _default$7, u as ScheduleDefinition, v as healthPlugin } from "../types-CBgvkp8O.mjs";
|
|
6
|
+
import { a as arcCorePlugin, i as _default, n as ArcCorePluginOptions, r as PluginMeta, t as ArcCore } from "../fastify-augmentation-zh0_AYHa.mjs";
|
|
7
|
+
import { _ as CachingRule, a as MetricsCollector, c as metricsPlugin, d as _default$5, f as realtimePlugin, g as CachingOptions, h as ssePlugin, i as MetricEntry, l as ChangeOperation, m as _default$8, n as _default$9, o as MetricsOptions, p as SSEOptions, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as RealtimeOptions, v as _default$1, y as cachingPlugin } from "../versioning-D_rhHfZm.mjs";
|
|
8
|
+
import { t as TracingOptions } from "../tracing-Dro5eH6j.mjs";
|
|
8
9
|
import { PaginatedResult } from "@classytic/repo-core/pagination";
|
|
9
10
|
import { FastifyInstance, FastifyPluginAsync } from "fastify";
|
|
10
11
|
//#region src/plugins/createPlugin.d.ts
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import { n as
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import {
|
|
14
|
-
import { n as
|
|
15
|
-
import { n as
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { p as MUTATION_OPERATIONS } from "../constants-D3Dv4LAV.mjs";
|
|
3
|
+
import { c as getOrgId } from "../types-Cys0ko9Z.mjs";
|
|
4
|
+
import { n as requestContext } from "../requestContext-2TxXOJ7T.mjs";
|
|
5
|
+
import { t as hasEvents } from "../typeGuards-B0ryPo3I.mjs";
|
|
6
|
+
import { t as HookSystem } from "../HookSystem-BcmPyq5I.mjs";
|
|
7
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-qq0mn2s9.mjs";
|
|
8
|
+
import { a as requestIdPlugin, i as createRequestIdGenerator, n as health_default, o as requestId_default, s as sanitizeRequestId, t as healthPlugin } from "../health-DjZYjM7H.mjs";
|
|
9
|
+
import { n as caching_default, t as cachingPlugin } from "../caching-BFHA6Scf.mjs";
|
|
10
|
+
import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-C5NeD6bT.mjs";
|
|
11
|
+
import { n as metrics_default, t as metricsPlugin } from "../metrics-CUdw_wLB.mjs";
|
|
12
|
+
import { n as realtime_default, t as realtimePlugin } from "../realtime-C5NoxWFY.mjs";
|
|
13
|
+
import { t as replyHelpersPlugin } from "../replyHelpers-DIiZKGUt.mjs";
|
|
14
|
+
import { n as schedules_default, t as schedulesPlugin } from "../schedules-DdtlICTf.mjs";
|
|
15
|
+
import { n as sse_default, t as ssePlugin } from "../sse-CUTo9y0X.mjs";
|
|
16
|
+
import { n as versioning_default, t as versioningPlugin } from "../versioning-CHDTor3P.mjs";
|
|
16
17
|
import fp from "fastify-plugin";
|
|
17
18
|
//#region src/core/arcCorePlugin.ts
|
|
18
19
|
const arcCorePlugin = async (fastify, opts = {}) => {
|
|
@@ -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.31.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.31.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 { f as SchedulesPluginOptions, g as HealthOptions, n as ArcModuleInput, s as ResourceLike } from "./types-CBgvkp8O.mjs";
|
|
10
|
+
import "./index-CFThn1K9.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,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { i as NotFoundError, u as ValidationError } from "../errors-Cj42AntO.mjs";
|
|
3
|
+
import { c as getOrgId, g as getUserId } from "../types-Cys0ko9Z.mjs";
|
|
4
|
+
import { I as requireAuth, j as allowPublic } from "../permissions-L--QDAir.mjs";
|
|
5
|
+
import { t as multipartBody } from "../multipartBody-wOgj_fnj.mjs";
|
|
5
6
|
//#region src/presets/filesUpload.ts
|
|
6
7
|
const DEFAULT_FIELD_NAME = "file";
|
|
7
8
|
const DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
@@ -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,11 +1,24 @@
|
|
|
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";
|
|
6
7
|
//#region src/presets/ownedByUser.d.ts
|
|
7
8
|
interface OwnedByUserOptions {
|
|
8
9
|
ownerField?: string;
|
|
10
|
+
/**
|
|
11
|
+
* What to do when a target record has NO value in `ownerField` (legacy /
|
|
12
|
+
* unowned records).
|
|
13
|
+
*
|
|
14
|
+
* - `"deny"` (default): fail closed — an unowned record is NOT modifiable
|
|
15
|
+
* through an ownership-gated route. This is the secure default; ownership
|
|
16
|
+
* that silently passes for records missing the owner is not an ownership
|
|
17
|
+
* primitive.
|
|
18
|
+
* - `"allow"`: legacy compatibility — permit modifying records that predate
|
|
19
|
+
* the owner field. Visibly unsafe; opt in only for a bounded migration.
|
|
20
|
+
*/
|
|
21
|
+
missingOwner?: "deny" | "allow";
|
|
9
22
|
}
|
|
10
23
|
declare function ownedByUserPreset(options?: OwnedByUserOptions): PresetResult;
|
|
11
24
|
//#endregion
|
package/dist/presets/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/*! @classytic/arc v2.31.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-C4-g4_4P.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.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import "../constants-D3Dv4LAV.mjs";
|
|
3
|
+
import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, u as getRequestScope, v as hasOrgAccess } from "../types-Cys0ko9Z.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.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { I as requireAuth, j as allowPublic } from "../permissions-L--QDAir.mjs";
|
|
2
3
|
//#region src/presets/search.ts
|
|
3
4
|
const BUILTINS = [
|
|
4
5
|
{
|
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { l as UnauthorizedError } from "./errors-Cj42AntO.mjs";
|
|
3
|
+
import { b as isElevated, n as PUBLIC_SCOPE } from "./types-Cys0ko9Z.mjs";
|
|
4
|
+
import { I as requireAuth, j as allowPublic, z as requireRoles } from "./permissions-L--QDAir.mjs";
|
|
3
5
|
import { multiTenantPreset } from "./presets/multiTenant.mjs";
|
|
4
6
|
//#region src/presets/ownedByUser.ts
|
|
5
7
|
/**
|
|
6
8
|
* Create ownership check middleware.
|
|
7
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* FAIL-CLOSED: ownership is meaningless without an authenticated identity, so a
|
|
11
|
+
* request with no user (or a user with no id) is DENIED here rather than sliding
|
|
12
|
+
* through with no ownership check installed. Elevated scope (platform admin)
|
|
13
|
+
* bypasses the check by design.
|
|
8
14
|
*/
|
|
9
|
-
function createOwnershipCheck(ownerField) {
|
|
15
|
+
function createOwnershipCheck(ownerField, missingOwner) {
|
|
10
16
|
return async (request, _reply) => {
|
|
11
|
-
const user = request.user;
|
|
12
|
-
if (!user) return;
|
|
13
17
|
if (isElevated(request.scope ?? PUBLIC_SCOPE)) return;
|
|
18
|
+
const user = request.user;
|
|
19
|
+
if (!user) throw new UnauthorizedError("Authentication required for this operation");
|
|
14
20
|
const userWithId = user;
|
|
15
21
|
const userId = userWithId._id ?? userWithId.id;
|
|
16
|
-
if (userId)
|
|
22
|
+
if (!userId) throw new UnauthorizedError("Authenticated identity has no usable id");
|
|
23
|
+
request._ownershipCheck = {
|
|
17
24
|
field: ownerField,
|
|
18
|
-
userId
|
|
25
|
+
userId,
|
|
26
|
+
missingOwner
|
|
19
27
|
};
|
|
20
28
|
};
|
|
21
29
|
}
|
|
22
30
|
function ownedByUserPreset(options = {}) {
|
|
23
|
-
const { ownerField = "userId" } = options;
|
|
24
|
-
const ownershipMiddleware = createOwnershipCheck(ownerField);
|
|
31
|
+
const { ownerField = "userId", missingOwner = "deny" } = options;
|
|
32
|
+
const ownershipMiddleware = createOwnershipCheck(ownerField, missingOwner);
|
|
25
33
|
return {
|
|
26
34
|
name: "ownedByUser",
|
|
35
|
+
permissions: {
|
|
36
|
+
update: requireAuth(),
|
|
37
|
+
delete: requireAuth()
|
|
38
|
+
},
|
|
27
39
|
middlewares: {
|
|
28
40
|
update: [ownershipMiddleware],
|
|
29
41
|
delete: [ownershipMiddleware]
|
|
@@ -366,6 +378,11 @@ function mergePreset(config, preset) {
|
|
|
366
378
|
result.middlewares[key] = [...result.middlewares[key] ?? [], ...mws ?? []];
|
|
367
379
|
}
|
|
368
380
|
}
|
|
381
|
+
if (preset.permissions) {
|
|
382
|
+
const merged = { ...result.permissions };
|
|
383
|
+
for (const [op, check] of Object.entries(preset.permissions)) if (merged[op] === void 0 && check !== void 0) merged[op] = check;
|
|
384
|
+
result.permissions = merged;
|
|
385
|
+
}
|
|
369
386
|
if (preset.schemaOptions) result.schemaOptions = {
|
|
370
387
|
...result.schemaOptions,
|
|
371
388
|
...preset.schemaOptions,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { c as getOrgId, g as getUserId, x as isMember } from "./types-Cys0ko9Z.mjs";
|
|
3
|
+
//#region src/scope/projection.ts
|
|
4
|
+
/**
|
|
5
|
+
* Compute the request-scope projection. Returns `undefined` when no
|
|
6
|
+
* scope is attached (public / unscoped routes) so hosts can idiomatically
|
|
7
|
+
* write `ctx.scope?.organizationId` without a double-null check.
|
|
8
|
+
*/
|
|
9
|
+
function buildRequestScopeProjection(scope) {
|
|
10
|
+
if (!scope) return void 0;
|
|
11
|
+
return {
|
|
12
|
+
organizationId: getOrgId(scope),
|
|
13
|
+
userId: getUserId(scope),
|
|
14
|
+
orgRoles: isMember(scope) ? scope.orgRoles : void 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { buildRequestScopeProjection as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-CUsjNX9R.mjs";
|
|
3
|
+
import { t as hasEvents } from "./typeGuards-B0ryPo3I.mjs";
|
|
4
|
+
import { i as versionKey, r as tagVersionKey } from "./keys-C0_pa1tY.mjs";
|
|
5
|
+
import { t as MemoryCacheStore } from "./memory-DR6wpa9F.mjs";
|
|
5
6
|
import fp from "fastify-plugin";
|
|
6
7
|
//#region src/cache/QueryCache.ts
|
|
7
8
|
var QueryCache = class {
|
|
@@ -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,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as requestContext } from "./requestContext-2TxXOJ7T.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
|
}
|