@classytic/arc 2.8.3 → 2.8.5
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/README.md +50 -1
- package/dist/adapters/index.d.mts +2 -2
- package/dist/audit/index.d.mts +1 -1
- package/dist/audit/index.mjs +1 -1
- package/dist/audit/mongodb.d.mts +1 -1
- package/dist/audit/mongodb.mjs +1 -1
- package/dist/auth/index.d.mts +4 -4
- package/dist/auth/index.mjs +2 -2
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/{betterAuthOpenApi-C5lDyRH2.mjs → betterAuthOpenApi-BuUcUEJq.mjs} +1 -1
- package/dist/cache/index.d.mts +73 -3
- package/dist/cache/index.mjs +95 -2
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +3 -3
- package/dist/{core-DKSwNSXf.mjs → core-F0QoWBt2.mjs} +1 -1
- package/dist/{createActionRouter-Df1BuawX.mjs → createActionRouter-BORM8f17.mjs} +1 -1
- package/dist/{createApp-BOYjBgdI.mjs → createApp-B1EY8zxa.mjs} +11 -11
- package/dist/{defineResource-Bb_Bdhtw.mjs → defineResource-tcgySDo1.mjs} +2 -2
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +1 -1
- package/dist/dynamic/index.d.mts +2 -2
- package/dist/dynamic/index.mjs +1 -1
- package/dist/{elevation-BBGFjzIP.mjs → elevation-DtFxrG0s.mjs} +1 -1
- package/dist/{errorHandler-CdZDavNH.d.mts → errorHandler-Bah5JhBd.d.mts} +1 -1
- package/dist/{eventPlugin-CVxlE6De.d.mts → eventPlugin-D9DKB2zM.d.mts} +1 -1
- package/dist/events/index.d.mts +3 -3
- package/dist/events/index.mjs +1 -1
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/factory/index.d.mts +1 -1
- package/dist/factory/index.mjs +2 -2
- package/dist/filesUpload-C7r7HIeA.mjs +319 -0
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +3 -3
- package/dist/idempotency/mongodb.d.mts +1 -1
- package/dist/idempotency/redis.d.mts +2 -2
- package/dist/idempotency/redis.mjs +134 -13
- package/dist/{index-CSkeivBx.d.mts → index-BLXBmWud.d.mts} +3 -3
- package/dist/{index-BgmMdpm8.d.mts → index-C1meYuDn.d.mts} +1 -1
- package/dist/{index-CpTSDqmD.d.mts → index-DtDzOBn8.d.mts} +3 -3
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +4 -4
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/jobs.d.mts +25 -3
- package/dist/integrations/jobs.mjs +63 -4
- package/dist/integrations/mcp/index.d.mts +51 -3
- package/dist/integrations/mcp/index.mjs +78 -19
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/{interface-BVuMfeVv.d.mts → interface-CMRutPfe.d.mts} +38 -16
- package/dist/{mongodb-B8U2xaLj.d.mts → mongodb-BsP-WbhN.d.mts} +1 -1
- package/dist/{mongodb-X7LbEjTN.d.mts → mongodb-CTcp0hQZ.d.mts} +1 -1
- package/dist/{openapi-CYCuekCn.mjs → openapi-CbKUJY_m.mjs} +3 -3
- package/dist/org/index.d.mts +2 -2
- package/dist/permissions/index.d.mts +3 -3
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.mjs +8 -8
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/policies/index.d.mts +1 -1
- package/dist/presets/filesUpload.d.mts +49 -0
- package/dist/presets/filesUpload.mjs +2 -0
- package/dist/presets/index.d.mts +3 -2
- package/dist/presets/index.mjs +2 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/{queryCachePlugin-CnTZZTC5.d.mts → queryCachePlugin-BJJGBTlu.d.mts} +1 -1
- package/dist/redis-BM00zaPB.d.mts +115 -0
- package/dist/{redis-stream-D54N5oXs.d.mts → redis-stream-CrsfUmPt.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{resourceToTools-O_HwWXFa.mjs → resourceToTools-8s-EsCCe.mjs} +1 -1
- package/dist/rpc/index.d.mts +1 -1
- package/dist/{schemaConverter-OxfCshus.mjs → schemaConverter-Y7nCYaLJ.mjs} +24 -8
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +1 -1
- package/dist/{sse-CJpt7LGI.mjs → sse-Ad7ypl9e.mjs} +1 -1
- package/dist/storage-Dfzt4VTl.d.mts +146 -0
- package/dist/testing/index.d.mts +4 -3
- package/dist/testing/index.mjs +3 -2
- package/dist/testing/storageContract.d.mts +26 -0
- package/dist/testing/storageContract.mjs +216 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/types/storage.d.mts +2 -0
- package/dist/types/storage.mjs +1 -0
- package/dist/{types-CcG4avic.d.mts → types-BsbNMEDR.d.mts} +1 -1
- package/dist/{types-Bg2X42_m.d.mts → types-Ch9pTQbf.d.mts} +9 -9
- package/dist/{types-CVC4HOKi.d.mts → types-DZi1aYhm.d.mts} +1 -1
- package/dist/utils/index.d.mts +26 -8
- package/dist/utils/index.mjs +1 -1
- package/package.json +16 -1
- package/skills/arc/SKILL.md +22 -0
- package/skills/arc/references/events.md +29 -0
- package/skills/arc/references/mcp.md +37 -0
- package/dist/redis-z3sFr1UP.d.mts +0 -49
- /package/dist/{EventTransport-CinyO7zQ.d.mts → EventTransport-BXja8NOc.d.mts} +0 -0
- /package/dist/{HookSystem-BjFu7zf1.mjs → HookSystem-HprTmvVY.mjs} +0 -0
- /package/dist/{ResourceRegistry-Dq3_zBQP.mjs → ResourceRegistry-C6uXlWe3.mjs} +0 -0
- /package/dist/{caching-CjybdRwx.mjs → caching-IMuYVjTL.mjs} +0 -0
- /package/dist/{circuitBreaker-CvXkjfrW.d.mts → circuitBreaker-dTtG-UyS.d.mts} +0 -0
- /package/dist/{elevation-s5ykdNHr.d.mts → elevation-B6S5csVA.d.mts} +0 -0
- /package/dist/{errorHandler-mzqk4cGl.mjs → errorHandler-f869_8PQ.mjs} +0 -0
- /package/dist/{errors-Bmn3eZT6.d.mts → errors-Ck2h67pm.d.mts} +0 -0
- /package/dist/{eventPlugin-D91S2YF4.mjs → eventPlugin-CDjVTM82.mjs} +0 -0
- /package/dist/{externalPaths-Bapitwvd.d.mts → externalPaths-BnkYrNzp.d.mts} +0 -0
- /package/dist/{fields-DC4So2M2.d.mts → fields-DpZQa_Q3.d.mts} +0 -0
- /package/dist/{interface-DplgQO2e.d.mts → interface-4y979v99.d.mts} +0 -0
- /package/dist/{interface-B-pe8fhj.d.mts → interface-DfLGcus7.d.mts} +0 -0
- /package/dist/{loadResources-Bksk8ydA.mjs → loadResources-PWd0OCpV.mjs} +0 -0
- /package/dist/{logger-CDjpjySd.mjs → logger-D1YrIImS.mjs} +0 -0
- /package/dist/{metrics-TuOmguhi.mjs → metrics-B-PU4-Yu.mjs} +0 -0
- /package/dist/{mongodb-B5O6xaW1.mjs → mongodb-Utc5k_-0.mjs} +0 -0
- /package/dist/{pluralize-A0tWEl1K.mjs → pluralize-CWP6MB39.mjs} +0 -0
- /package/dist/{queryCachePlugin-D0iIVhW_.mjs → queryCachePlugin-BH-fidlv.mjs} +0 -0
- /package/dist/{registry-B0Wl7uVV.mjs → registry-BiTKT1Dg.mjs} +0 -0
- /package/dist/{replyHelpers-BLojtuvR.mjs → replyHelpers-CxkYGT81.mjs} +0 -0
- /package/dist/{sessionManager-D-oNWHz3.d.mts → sessionManager-DDCmiNIo.d.mts} +0 -0
- /package/dist/{tracing-DxjKk7eW.d.mts → tracing-DdN2-wHJ.d.mts} +0 -0
- /package/dist/{types-C72d3NDn.d.mts → types-BD85MlEK.d.mts} +0 -0
- /package/dist/{versioning-Cm8qoFDg.mjs → versioning-CDugduqI.mjs} +0 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Database-agnostic resource framework for Fastify. Define resources, get CRUD routes, permissions, presets, caching, events, OpenAPI, and MCP tools — without boilerplate.
|
|
4
4
|
|
|
5
|
-
**v2.8.
|
|
5
|
+
**v2.8.4** | Fastify 5+ | Node.js 22+ | ESM only | 279+ test files, 3867+ tests
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -661,6 +661,34 @@ npx @classytic/arc doctor # Health check
|
|
|
661
661
|
}
|
|
662
662
|
```
|
|
663
663
|
|
|
664
|
+
## Bundle Size
|
|
665
|
+
|
|
666
|
+
Arc is tree-shakable and split into 47 subpath exports. You pay only for what you import.
|
|
667
|
+
|
|
668
|
+
| What you import | JS shipped to your bundle |
|
|
669
|
+
|---|---|
|
|
670
|
+
| `createApp` + `defineResource` + `BaseController` (minimal CRUD API) | **~130 KB** |
|
|
671
|
+
| `+ @classytic/arc/events/redis` (distributed pub/sub) | +24 KB |
|
|
672
|
+
| `+ @classytic/arc/integrations/jobs` (BullMQ) | +8 KB |
|
|
673
|
+
| `+ @classytic/arc/mcp` (AI agent tools) | +24 KB |
|
|
674
|
+
|
|
675
|
+
For reference — Fastify core alone is ~300 KB, NestJS core + reflect-metadata is 400+ KB. Arc's minimal footprint is smaller than either, with more features included. `dist/` on disk is 1.7 MB but most of it is `.d.mts` type declarations (free at runtime), the CLI (88 KB, only loaded when running `npx @classytic/arc init`), and the testing helpers (52 KB, never shipped to production).
|
|
676
|
+
|
|
677
|
+
**Use subpath imports** — they're the whole reason arc stays lean:
|
|
678
|
+
|
|
679
|
+
```typescript
|
|
680
|
+
// Good — each import resolves to exactly one subpath chunk
|
|
681
|
+
import { createApp } from '@classytic/arc/factory';
|
|
682
|
+
import { defineResource } from '@classytic/arc/core';
|
|
683
|
+
import { jobsPlugin } from '@classytic/arc/integrations/jobs'; // only if you use queues
|
|
684
|
+
import { mcpPlugin } from '@classytic/arc/mcp'; // only if you expose MCP
|
|
685
|
+
|
|
686
|
+
// Bad — pulls the whole barrel; tree-shaking helps but subpath is better
|
|
687
|
+
import { createApp, defineResource, jobsPlugin, mcpPlugin } from '@classytic/arc';
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
Arc sets `"sideEffects": false` in [package.json](package.json), so modern bundlers (esbuild, Rollup, Webpack 5+, tsdown) correctly eliminate unused exports even from the barrel.
|
|
691
|
+
|
|
664
692
|
## Subpath Imports
|
|
665
693
|
|
|
666
694
|
| Import | Purpose |
|
|
@@ -694,6 +722,27 @@ npx @classytic/arc doctor # Health check
|
|
|
694
722
|
| `@classytic/arc/docs` | OpenAPI generation |
|
|
695
723
|
| `@classytic/arc/cli` | CLI commands (programmatic) |
|
|
696
724
|
|
|
725
|
+
## v2.8.4 Highlights
|
|
726
|
+
|
|
727
|
+
- **MCP ↔ AI SDK bridge** — expose AI SDK `tool()` definitions over MCP without duplicating code. `bridgeToMcp(bridge)` adapts any AI SDK tool into an MCP tool with automatic auth, guard delegation, and `{ error } → isError` envelope translation. `buildMcpToolsFromBridges(bridges, { include, exclude })` registers a whole catalog at once with per-environment filtering.
|
|
728
|
+
|
|
729
|
+
```typescript
|
|
730
|
+
import { bridgeToMcp, buildMcpToolsFromBridges, type McpBridge } from '@classytic/arc/mcp';
|
|
731
|
+
|
|
732
|
+
export const triggerJobBridge: McpBridge = {
|
|
733
|
+
name: 'trigger_job',
|
|
734
|
+
description: 'Start a job.',
|
|
735
|
+
inputSchema: { phase: z.enum(['investigate', 'fix']) },
|
|
736
|
+
annotations: { destructiveHint: true },
|
|
737
|
+
buildTool: (ctx) => buildTriggerJobTool(getUserId(ctx) ?? ''),
|
|
738
|
+
};
|
|
739
|
+
|
|
740
|
+
await app.register(mcpPlugin, {
|
|
741
|
+
resources,
|
|
742
|
+
extraTools: buildMcpToolsFromBridges([triggerJobBridge]),
|
|
743
|
+
});
|
|
744
|
+
```
|
|
745
|
+
|
|
697
746
|
## v2.8.1 Highlights
|
|
698
747
|
|
|
699
748
|
- **Per-action discriminated validation** — `actions` schemas now enforce required fields via a `oneOf` body schema; missing inputs are rejected at the HTTP layer by AJV (no more silent bypass)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as RelationMetadata, c as ValidationResult, i as FieldMetadata, o as RepositoryLike, r as DataAdapter, s as SchemaMetadata, t as AdapterFactory } from "../interface-
|
|
2
|
-
import { a as PrismaQueryParserOptions, c as MongooseAdapterOptions, i as PrismaQueryParser, l as createMongooseAdapter, n as PrismaAdapterOptions, o as createPrismaAdapter, r as PrismaQueryOptions, s as MongooseAdapter, t as PrismaAdapter } from "../index-
|
|
1
|
+
import { a as RelationMetadata, c as ValidationResult, i as FieldMetadata, o as RepositoryLike, r as DataAdapter, s as SchemaMetadata, t as AdapterFactory } from "../interface-CMRutPfe.mjs";
|
|
2
|
+
import { a as PrismaQueryParserOptions, c as MongooseAdapterOptions, i as PrismaQueryParser, l as createMongooseAdapter, n as PrismaAdapterOptions, o as createPrismaAdapter, r as PrismaQueryOptions, s as MongooseAdapter, t as PrismaAdapter } from "../index-C1meYuDn.mjs";
|
|
3
3
|
export { AdapterFactory, DataAdapter, FieldMetadata, MongooseAdapter, MongooseAdapterOptions, PrismaAdapter, PrismaAdapterOptions, PrismaQueryOptions, PrismaQueryParser, PrismaQueryParserOptions, RelationMetadata, RepositoryLike, SchemaMetadata, ValidationResult, createMongooseAdapter, createPrismaAdapter };
|
package/dist/audit/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as AuditContext, c as AuditStore, i as AuditAction, l as AuditStoreOptions, n as MongoAuditStoreOptions, o as AuditEntry, r as MongoConnection, s as AuditQueryOptions, u as createAuditEntry } from "../mongodb-
|
|
1
|
+
import { a as AuditContext, c as AuditStore, i as AuditAction, l as AuditStoreOptions, n as MongoAuditStoreOptions, o as AuditEntry, r as MongoConnection, s as AuditQueryOptions, u as createAuditEntry } from "../mongodb-BsP-WbhN.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/audit/auditPlugin.d.ts
|
package/dist/audit/index.mjs
CHANGED
package/dist/audit/mongodb.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as MongoAuditStoreOptions, t as MongoAuditStore } from "../mongodb-
|
|
1
|
+
import { n as MongoAuditStoreOptions, t as MongoAuditStore } from "../mongodb-BsP-WbhN.mjs";
|
|
2
2
|
export { MongoAuditStore, type MongoAuditStoreOptions };
|
package/dist/audit/mongodb.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as MongoAuditStore } from "../mongodb-
|
|
1
|
+
import { t as MongoAuditStore } from "../mongodb-Utc5k_-0.mjs";
|
|
2
2
|
export { MongoAuditStore };
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { b as AuthPluginOptions, y as AuthHelpers } from "../interface-
|
|
2
|
-
import { t as PermissionCheck } from "../types-
|
|
3
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
4
|
-
import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-
|
|
1
|
+
import { b as AuthPluginOptions, y as AuthHelpers } from "../interface-CMRutPfe.mjs";
|
|
2
|
+
import { t as PermissionCheck } from "../types-DZi1aYhm.mjs";
|
|
3
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-BnkYrNzp.mjs";
|
|
4
|
+
import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-DDCmiNIo.mjs";
|
|
5
5
|
import { FastifyPluginAsync, FastifyReply as FastifyReply$1, FastifyRequest as FastifyRequest$1 } from "fastify";
|
|
6
6
|
|
|
7
7
|
//#region src/auth/authPlugin.d.ts
|
package/dist/auth/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as normalizeRoles, t as getUserRoles } from "../types-ZUu_h0jp.mjs";
|
|
2
2
|
import { t as ArcError } from "../errors-BF2bIOIS.mjs";
|
|
3
3
|
import { h as requireTeamMembership, l as requireOrgMembership, u as requireOrgRole } from "../permissions-CH4cNwJi.mjs";
|
|
4
|
-
import { n as extractBetterAuthOpenApi } from "../betterAuthOpenApi-
|
|
4
|
+
import { n as extractBetterAuthOpenApi } from "../betterAuthOpenApi-BuUcUEJq.mjs";
|
|
5
5
|
import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
6
6
|
import fp from "fastify-plugin";
|
|
7
7
|
//#region src/auth/authPlugin.ts
|
|
@@ -677,7 +677,7 @@ function createBetterAuthAdapter(options) {
|
|
|
677
677
|
if (!fastify.hasDecorator("authenticate")) fastify.decorate("authenticate", authenticate);
|
|
678
678
|
if (!fastify.hasDecorator("optionalAuthenticate")) fastify.decorate("optionalAuthenticate", optionalAuthenticate);
|
|
679
679
|
if (!extractedOpenApi && openapiOpt !== false && auth.api && typeof auth.api === "object") {
|
|
680
|
-
const { extractBetterAuthOpenApi } = await import("../betterAuthOpenApi-
|
|
680
|
+
const { extractBetterAuthOpenApi } = await import("../betterAuthOpenApi-BuUcUEJq.mjs").then((n) => n.t);
|
|
681
681
|
extractedOpenApi = extractBetterAuthOpenApi(auth.api, {
|
|
682
682
|
basePath,
|
|
683
683
|
userFields
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as SessionData, s as SessionStore } from "../sessionManager-
|
|
1
|
+
import { i as SessionData, s as SessionStore } from "../sessionManager-DDCmiNIo.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/auth/redis-session.d.ts
|
|
4
4
|
/** Minimal Redis client interface — compatible with ioredis */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
|
-
import { a as toJsonSchema } from "./schemaConverter-
|
|
2
|
+
import { a as toJsonSchema } from "./schemaConverter-Y7nCYaLJ.mjs";
|
|
3
3
|
//#region src/auth/betterAuthOpenApi.ts
|
|
4
4
|
var betterAuthOpenApi_exports = /* @__PURE__ */ __exportAll({ extractBetterAuthOpenApi: () => extractBetterAuthOpenApi });
|
|
5
5
|
/**
|
package/dist/cache/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as CacheStore, n as CacheSetOptions, r as CacheStats, t as CacheLogger } from "../interface-
|
|
2
|
-
import { a as CacheEnvelope, c as QueryCache, i as queryCachePlugin, l as QueryCacheConfig, n as QueryCacheDefaults, o as CacheResult, r as QueryCachePluginOptions, s as CacheStatus, t as CrossResourceRule } from "../queryCachePlugin-
|
|
1
|
+
import { i as CacheStore, n as CacheSetOptions, r as CacheStats, t as CacheLogger } from "../interface-4y979v99.mjs";
|
|
2
|
+
import { a as CacheEnvelope, c as QueryCache, i as queryCachePlugin, l as QueryCacheConfig, n as QueryCacheDefaults, o as CacheResult, r as QueryCachePluginOptions, s as CacheStatus, t as CrossResourceRule } from "../queryCachePlugin-BJJGBTlu.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/cache/keys.d.ts
|
|
5
5
|
/**
|
|
@@ -141,5 +141,75 @@ declare class RedisCacheStore<TValue = unknown> implements CacheStore<TValue> {
|
|
|
141
141
|
private scanAndDelete;
|
|
142
142
|
private withPrefix;
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Minimal ioredis shape we depend on. We don't import ioredis itself so the
|
|
146
|
+
* cache subpath stays peer-dep-free.
|
|
147
|
+
*/
|
|
148
|
+
interface IoredisLike {
|
|
149
|
+
get(key: string): Promise<string | null>;
|
|
150
|
+
set(...args: unknown[]): Promise<string | null>;
|
|
151
|
+
del(...keys: string[]): Promise<number>;
|
|
152
|
+
scan(cursor: string | number, ...args: (string | number)[]): Promise<[string, string[]]>;
|
|
153
|
+
pipeline?(): {
|
|
154
|
+
del(key: string): unknown;
|
|
155
|
+
exec(): Promise<unknown>;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Wrap an ioredis instance as a `RedisCacheClient`.
|
|
160
|
+
*
|
|
161
|
+
* Why: arc's `RedisCacheClient` uses node-redis-v4 object-options style
|
|
162
|
+
* (`set(key, val, { PX })`), but ioredis expects positional flags
|
|
163
|
+
* (`set(key, val, 'PX', ms)`). Without this adapter every ioredis user
|
|
164
|
+
* reinvents the bridge.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* import Redis from 'ioredis';
|
|
169
|
+
* import { RedisCacheStore, ioredisAsCacheClient } from '@classytic/arc/cache';
|
|
170
|
+
*
|
|
171
|
+
* const redis = new Redis(process.env.REDIS_URL);
|
|
172
|
+
* const store = new RedisCacheStore({
|
|
173
|
+
* client: ioredisAsCacheClient(redis),
|
|
174
|
+
* prefix: 'arc:cache:',
|
|
175
|
+
* });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
declare function ioredisAsCacheClient(client: IoredisLike): RedisCacheClient;
|
|
179
|
+
/**
|
|
180
|
+
* Minimal `@upstash/redis` REST SDK shape we depend on.
|
|
181
|
+
*
|
|
182
|
+
* `@upstash/redis` is HTTP-based and works on edge runtimes (Cloudflare
|
|
183
|
+
* Workers, Vercel Edge, Deno Deploy) where TCP connections — and thus
|
|
184
|
+
* ioredis — are unavailable.
|
|
185
|
+
*/
|
|
186
|
+
interface UpstashRedisLike {
|
|
187
|
+
get(key: string): Promise<string | null | unknown>;
|
|
188
|
+
set(key: string, value: unknown, opts?: Record<string, unknown>): Promise<unknown>;
|
|
189
|
+
del(...keys: string[]): Promise<number>;
|
|
190
|
+
scan(cursor: number | string, opts?: {
|
|
191
|
+
match?: string;
|
|
192
|
+
count?: number;
|
|
193
|
+
}): Promise<[number, string[]] | [string, string[]]>;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Wrap an `@upstash/redis` REST client as a `RedisCacheClient`.
|
|
197
|
+
*
|
|
198
|
+
* Enables running arc's cache layer on edge runtimes without ioredis.
|
|
199
|
+
* Requires `@upstash/redis` as an optional peer dependency.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* import { Redis } from '@upstash/redis';
|
|
204
|
+
* import { RedisCacheStore, upstashAsCacheClient } from '@classytic/arc/cache';
|
|
205
|
+
*
|
|
206
|
+
* const redis = Redis.fromEnv();
|
|
207
|
+
* const store = new RedisCacheStore({
|
|
208
|
+
* client: upstashAsCacheClient(redis),
|
|
209
|
+
* prefix: 'arc:cache:',
|
|
210
|
+
* });
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
declare function upstashAsCacheClient(client: UpstashRedisLike): RedisCacheClient;
|
|
144
214
|
//#endregion
|
|
145
|
-
export { type CacheEnvelope, type CacheLogger, type CacheResult, type CacheSetOptions, type CacheStats, type CacheStatus, type CacheStore, type CrossResourceRule, MemoryCacheStore, type MemoryCacheStoreOptions, QueryCache, type QueryCacheConfig, type QueryCacheDefaults, type QueryCachePluginOptions, type RedisCacheClient, RedisCacheStore, type RedisCacheStoreOptions, type RedisPipeline, buildQueryKey, hashParams, queryCachePlugin, tagVersionKey, versionKey };
|
|
215
|
+
export { type CacheEnvelope, type CacheLogger, type CacheResult, type CacheSetOptions, type CacheStats, type CacheStatus, type CacheStore, type CrossResourceRule, type IoredisLike, MemoryCacheStore, type MemoryCacheStoreOptions, QueryCache, type QueryCacheConfig, type QueryCacheDefaults, type QueryCachePluginOptions, type RedisCacheClient, RedisCacheStore, type RedisCacheStoreOptions, type RedisPipeline, type UpstashRedisLike, buildQueryKey, hashParams, ioredisAsCacheClient, queryCachePlugin, tagVersionKey, upstashAsCacheClient, versionKey };
|
package/dist/cache/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as versionKey, n as hashParams, r as tagVersionKey, t as buildQueryKey } from "../keys-qcD-TVJl.mjs";
|
|
2
2
|
import { t as MemoryCacheStore } from "../memory-Cp7_cAko.mjs";
|
|
3
|
-
import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-
|
|
3
|
+
import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-BH-fidlv.mjs";
|
|
4
4
|
//#region src/cache/redis.ts
|
|
5
5
|
/**
|
|
6
6
|
* Redis-backed cache store.
|
|
@@ -85,5 +85,98 @@ var RedisCacheStore = class {
|
|
|
85
85
|
return `${this.prefix}${key}`;
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
+
/**
|
|
89
|
+
* Wrap an ioredis instance as a `RedisCacheClient`.
|
|
90
|
+
*
|
|
91
|
+
* Why: arc's `RedisCacheClient` uses node-redis-v4 object-options style
|
|
92
|
+
* (`set(key, val, { PX })`), but ioredis expects positional flags
|
|
93
|
+
* (`set(key, val, 'PX', ms)`). Without this adapter every ioredis user
|
|
94
|
+
* reinvents the bridge.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
98
|
+
* import Redis from 'ioredis';
|
|
99
|
+
* import { RedisCacheStore, ioredisAsCacheClient } from '@classytic/arc/cache';
|
|
100
|
+
*
|
|
101
|
+
* const redis = new Redis(process.env.REDIS_URL);
|
|
102
|
+
* const store = new RedisCacheStore({
|
|
103
|
+
* client: ioredisAsCacheClient(redis),
|
|
104
|
+
* prefix: 'arc:cache:',
|
|
105
|
+
* });
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
function ioredisAsCacheClient(client) {
|
|
109
|
+
return {
|
|
110
|
+
async get(key) {
|
|
111
|
+
return client.get(key);
|
|
112
|
+
},
|
|
113
|
+
async set(key, value, options) {
|
|
114
|
+
if (options?.PX) return client.set(key, value, "PX", options.PX, ...options.NX ? ["NX"] : []);
|
|
115
|
+
if (options?.EX) return client.set(key, value, "EX", options.EX, ...options.NX ? ["NX"] : []);
|
|
116
|
+
if (options?.NX) return client.set(key, value, "NX");
|
|
117
|
+
return client.set(key, value);
|
|
118
|
+
},
|
|
119
|
+
async del(key) {
|
|
120
|
+
if (Array.isArray(key)) return client.del(...key);
|
|
121
|
+
return client.del(key);
|
|
122
|
+
},
|
|
123
|
+
async scan(cursor, ...args) {
|
|
124
|
+
const [next, keys] = await client.scan(cursor, ...args);
|
|
125
|
+
return [next, keys];
|
|
126
|
+
},
|
|
127
|
+
pipeline: client.pipeline ? () => client.pipeline() : void 0
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Wrap an `@upstash/redis` REST client as a `RedisCacheClient`.
|
|
132
|
+
*
|
|
133
|
+
* Enables running arc's cache layer on edge runtimes without ioredis.
|
|
134
|
+
* Requires `@upstash/redis` as an optional peer dependency.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* import { Redis } from '@upstash/redis';
|
|
139
|
+
* import { RedisCacheStore, upstashAsCacheClient } from '@classytic/arc/cache';
|
|
140
|
+
*
|
|
141
|
+
* const redis = Redis.fromEnv();
|
|
142
|
+
* const store = new RedisCacheStore({
|
|
143
|
+
* client: upstashAsCacheClient(redis),
|
|
144
|
+
* prefix: 'arc:cache:',
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
function upstashAsCacheClient(client) {
|
|
149
|
+
return {
|
|
150
|
+
async get(key) {
|
|
151
|
+
const raw = await client.get(key);
|
|
152
|
+
if (raw == null) return null;
|
|
153
|
+
return typeof raw === "string" ? raw : JSON.stringify(raw);
|
|
154
|
+
},
|
|
155
|
+
async set(key, value, options) {
|
|
156
|
+
const opts = {};
|
|
157
|
+
if (options?.PX) opts.px = options.PX;
|
|
158
|
+
if (options?.EX) opts.ex = options.EX;
|
|
159
|
+
if (options?.NX) opts.nx = true;
|
|
160
|
+
if (options?.XX) opts.xx = true;
|
|
161
|
+
const res = await client.set(key, value, opts);
|
|
162
|
+
return res == null ? null : String(res);
|
|
163
|
+
},
|
|
164
|
+
async del(key) {
|
|
165
|
+
if (Array.isArray(key)) return client.del(...key);
|
|
166
|
+
return client.del(key);
|
|
167
|
+
},
|
|
168
|
+
async scan(cursor, ...args) {
|
|
169
|
+
const opts = {};
|
|
170
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
171
|
+
const flag = String(args[i]).toLowerCase();
|
|
172
|
+
const val = args[i + 1];
|
|
173
|
+
if (flag === "match" && typeof val === "string") opts.match = val;
|
|
174
|
+
if (flag === "count") opts.count = Number(val);
|
|
175
|
+
}
|
|
176
|
+
const [next, keys] = await client.scan(cursor, opts);
|
|
177
|
+
return [next, keys];
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
}
|
|
88
181
|
//#endregion
|
|
89
|
-
export { MemoryCacheStore, QueryCache, RedisCacheStore, buildQueryKey, hashParams, queryCachePlugin, tagVersionKey, versionKey };
|
|
182
|
+
export { MemoryCacheStore, QueryCache, RedisCacheStore, buildQueryKey, hashParams, ioredisAsCacheClient, queryCachePlugin, tagVersionKey, upstashAsCacheClient, versionKey };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ResourceRegistry } from "../../ResourceRegistry-
|
|
2
|
-
import { t as buildOpenApiSpec } from "../../openapi-
|
|
1
|
+
import { t as ResourceRegistry } from "../../ResourceRegistry-C6uXlWe3.mjs";
|
|
2
|
+
import { t as buildOpenApiSpec } from "../../openapi-CbKUJY_m.mjs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as pluralize } from "../../pluralize-
|
|
1
|
+
import { t as pluralize } from "../../pluralize-CWP6MB39.mjs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
//#region src/cli/commands/generate.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ResourceRegistry } from "../../ResourceRegistry-
|
|
1
|
+
import { t as ResourceRegistry } from "../../ResourceRegistry-C6uXlWe3.mjs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
//#region src/cli/commands/introspect.ts
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { At as BaseController, Ft as BodySanitizerConfig, It as AccessControl, Jt as defineResource, Lt as AccessControlConfig, Mt as QueryResolver, Nt as QueryResolverConfig, Pt as BodySanitizer, jt as BaseControllerOptions, qt as ResourceDefinition } from "../interface-
|
|
2
|
-
import { A as MUTATION_OPERATIONS, C as HOOK_OPERATIONS, D as MAX_FILTER_DEPTH, E as HookPhase, M as RESERVED_QUERY_PARAMS, N as SYSTEM_FIELDS, O as MAX_REGEX_LENGTH, S as DEFAULT_UPDATE_METHOD, T as HookOperation, _ as DEFAULT_ID_FIELD, a as getControllerScope, b as DEFAULT_SORT, c as createCrudRouter, d as ActionRouterConfig, f as IdempotencyService, g as CrudOperation, h as CRUD_OPERATIONS, i as getControllerContext, j as MutationOperation, k as MAX_SEARCH_LENGTH, l as createPermissionMiddleware, m as createActionRouter, n as createFastifyHandler, o as sendControllerResponse, p as buildActionBodySchema, r as createRequestContext, s as defineResourceVariants, t as createCrudHandlers, u as ActionHandler, v as DEFAULT_LIMIT, w as HOOK_PHASES, x as DEFAULT_TENANT_FIELD, y as DEFAULT_MAX_LIMIT } from "../index-
|
|
1
|
+
import { At as BaseController, Ft as BodySanitizerConfig, It as AccessControl, Jt as defineResource, Lt as AccessControlConfig, Mt as QueryResolver, Nt as QueryResolverConfig, Pt as BodySanitizer, jt as BaseControllerOptions, qt as ResourceDefinition } from "../interface-CMRutPfe.mjs";
|
|
2
|
+
import { A as MUTATION_OPERATIONS, C as HOOK_OPERATIONS, D as MAX_FILTER_DEPTH, E as HookPhase, M as RESERVED_QUERY_PARAMS, N as SYSTEM_FIELDS, O as MAX_REGEX_LENGTH, S as DEFAULT_UPDATE_METHOD, T as HookOperation, _ as DEFAULT_ID_FIELD, a as getControllerScope, b as DEFAULT_SORT, c as createCrudRouter, d as ActionRouterConfig, f as IdempotencyService, g as CrudOperation, h as CRUD_OPERATIONS, i as getControllerContext, j as MutationOperation, k as MAX_SEARCH_LENGTH, l as createPermissionMiddleware, m as createActionRouter, n as createFastifyHandler, o as sendControllerResponse, p as buildActionBodySchema, r as createRequestContext, s as defineResourceVariants, t as createCrudHandlers, u as ActionHandler, v as DEFAULT_LIMIT, w as HOOK_PHASES, x as DEFAULT_TENANT_FIELD, y as DEFAULT_MAX_LIMIT } from "../index-DtDzOBn8.mjs";
|
|
3
3
|
export { AccessControl, AccessControlConfig, ActionHandler, ActionRouterConfig, BaseController, BaseControllerOptions, BodySanitizer, BodySanitizerConfig, CRUD_OPERATIONS, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, IdempotencyService, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, buildActionBodySchema, createActionRouter, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineResource, defineResourceVariants, getControllerContext, getControllerScope, sendControllerResponse };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
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-Cxde4rpC.mjs";
|
|
2
2
|
import { i as AccessControl, n as QueryResolver, r as BodySanitizer, t as BaseController } from "../BaseController-DAGGc5Xn.mjs";
|
|
3
|
-
import { n as createActionRouter, t as buildActionBodySchema } from "../createActionRouter-
|
|
4
|
-
import { c as createCrudHandlers, d as getControllerContext, f as getControllerScope, l as createFastifyHandler, n as defineResource, o as createCrudRouter, p as sendControllerResponse, s as createPermissionMiddleware, t as ResourceDefinition, u as createRequestContext } from "../defineResource-
|
|
5
|
-
import { t as defineResourceVariants } from "../core-
|
|
3
|
+
import { n as createActionRouter, t as buildActionBodySchema } from "../createActionRouter-BORM8f17.mjs";
|
|
4
|
+
import { c as createCrudHandlers, d as getControllerContext, f as getControllerScope, l as createFastifyHandler, n as defineResource, o as createCrudRouter, p as sendControllerResponse, s as createPermissionMiddleware, t as ResourceDefinition, u as createRequestContext } from "../defineResource-tcgySDo1.mjs";
|
|
5
|
+
import { t as defineResourceVariants } from "../core-F0QoWBt2.mjs";
|
|
6
6
|
export { AccessControl, BaseController, BodySanitizer, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, buildActionBodySchema, createActionRouter, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineResource, defineResourceVariants, getControllerContext, getControllerScope, sendControllerResponse };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as defineResource } from "./defineResource-
|
|
1
|
+
import { n as defineResource } from "./defineResource-tcgySDo1.mjs";
|
|
2
2
|
//#region src/core/defineResourceVariants.ts
|
|
3
3
|
/**
|
|
4
4
|
* Define multiple resources from a shared base config and per-variant overrides.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
import { n as normalizePermissionResult, t as applyPermissionResult } from "./applyPermissionResult-D6GPMsvh.mjs";
|
|
3
|
-
import { a as toJsonSchema } from "./schemaConverter-
|
|
3
|
+
import { a as toJsonSchema } from "./schemaConverter-Y7nCYaLJ.mjs";
|
|
4
4
|
//#region src/core/createActionRouter.ts
|
|
5
5
|
var createActionRouter_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
buildActionBodySchema: () => buildActionBodySchema,
|
|
@@ -207,7 +207,7 @@ async function registerArcCore(fastify, config, trackPlugin) {
|
|
|
207
207
|
await fastify.register(arcCorePlugin, { emitEvents: config.arcPlugins?.emitEvents !== false });
|
|
208
208
|
trackPlugin("arc-core");
|
|
209
209
|
if (config.arcPlugins?.events !== false) {
|
|
210
|
-
const { default: eventPlugin } = await import("./eventPlugin-
|
|
210
|
+
const { default: eventPlugin } = await import("./eventPlugin-CDjVTM82.mjs").then((n) => n.n);
|
|
211
211
|
const eventOpts = typeof config.arcPlugins?.events === "object" ? config.arcPlugins.events : {};
|
|
212
212
|
await fastify.register(eventPlugin, {
|
|
213
213
|
...eventOpts,
|
|
@@ -243,13 +243,13 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules) {
|
|
|
243
243
|
trackPlugin("arc-graceful-shutdown");
|
|
244
244
|
}
|
|
245
245
|
if (config.arcPlugins?.caching) {
|
|
246
|
-
const { default: cachingPlugin } = await import("./caching-
|
|
246
|
+
const { default: cachingPlugin } = await import("./caching-IMuYVjTL.mjs").then((n) => n.r);
|
|
247
247
|
const opts = config.arcPlugins.caching === true ? {} : config.arcPlugins.caching;
|
|
248
248
|
await fastify.register(cachingPlugin, opts);
|
|
249
249
|
trackPlugin("arc-caching", opts);
|
|
250
250
|
}
|
|
251
251
|
if (config.arcPlugins?.queryCache) {
|
|
252
|
-
const { queryCachePlugin } = await import("./queryCachePlugin-
|
|
252
|
+
const { queryCachePlugin } = await import("./queryCachePlugin-BH-fidlv.mjs").then((n) => n.n);
|
|
253
253
|
const opts = config.arcPlugins.queryCache === true ? {} : config.arcPlugins.queryCache;
|
|
254
254
|
const store = config.stores?.queryCache ?? new (await (import("./memory-Cp7_cAko.mjs").then((n) => n.n))).MemoryCacheStore();
|
|
255
255
|
await fastify.register(queryCachePlugin, {
|
|
@@ -260,19 +260,19 @@ async function registerArcPlugins(fastify, config, trackPlugin, modules) {
|
|
|
260
260
|
}
|
|
261
261
|
if (config.arcPlugins?.sse) if (config.arcPlugins?.events === false) fastify.log.warn("SSE plugin requires events plugin (arcPlugins.events). SSE disabled.");
|
|
262
262
|
else {
|
|
263
|
-
const { default: ssePlugin } = await import("./sse-
|
|
263
|
+
const { default: ssePlugin } = await import("./sse-Ad7ypl9e.mjs").then((n) => n.r);
|
|
264
264
|
const opts = config.arcPlugins.sse === true ? {} : config.arcPlugins.sse;
|
|
265
265
|
await fastify.register(ssePlugin, opts);
|
|
266
266
|
trackPlugin("arc-sse", opts);
|
|
267
267
|
}
|
|
268
268
|
if (config.arcPlugins?.metrics) {
|
|
269
|
-
const { default: metricsPlugin } = await import("./metrics-
|
|
269
|
+
const { default: metricsPlugin } = await import("./metrics-B-PU4-Yu.mjs").then((n) => n.r);
|
|
270
270
|
const opts = config.arcPlugins.metrics === true ? {} : config.arcPlugins.metrics;
|
|
271
271
|
await fastify.register(metricsPlugin, opts);
|
|
272
272
|
trackPlugin("arc-metrics", opts);
|
|
273
273
|
}
|
|
274
274
|
if (config.arcPlugins?.versioning) {
|
|
275
|
-
const { default: versioningPlugin } = await import("./versioning-
|
|
275
|
+
const { default: versioningPlugin } = await import("./versioning-CDugduqI.mjs").then((n) => n.r);
|
|
276
276
|
await fastify.register(versioningPlugin, config.arcPlugins.versioning);
|
|
277
277
|
trackPlugin("arc-versioning", config.arcPlugins.versioning);
|
|
278
278
|
}
|
|
@@ -340,7 +340,7 @@ async function registerAuth(fastify, config, trackPlugin) {
|
|
|
340
340
|
*/
|
|
341
341
|
async function registerElevation(fastify, config, trackPlugin) {
|
|
342
342
|
if (!config.elevation) return;
|
|
343
|
-
const { elevationPlugin } = await import("./elevation-
|
|
343
|
+
const { elevationPlugin } = await import("./elevation-DtFxrG0s.mjs").then((n) => n.r);
|
|
344
344
|
await fastify.register(elevationPlugin, config.elevation);
|
|
345
345
|
trackPlugin("arc-elevation", config.elevation);
|
|
346
346
|
fastify.log.debug("Elevation plugin enabled");
|
|
@@ -350,7 +350,7 @@ async function registerElevation(fastify, config, trackPlugin) {
|
|
|
350
350
|
*/
|
|
351
351
|
async function registerErrorHandler(fastify, config, trackPlugin) {
|
|
352
352
|
if (config.errorHandler === false) return;
|
|
353
|
-
const { errorHandlerPlugin } = await import("./errorHandler-
|
|
353
|
+
const { errorHandlerPlugin } = await import("./errorHandler-f869_8PQ.mjs").then((n) => n.n);
|
|
354
354
|
const errorOpts = typeof config.errorHandler === "object" ? config.errorHandler : { includeStack: config.preset !== "production" };
|
|
355
355
|
await fastify.register(errorHandlerPlugin, errorOpts);
|
|
356
356
|
trackPlugin("arc-error-handler", errorOpts);
|
|
@@ -417,7 +417,7 @@ async function registerResources(fastify, config) {
|
|
|
417
417
|
fastify.log.debug(`${config.bootstrap.length} bootstrap function(s) executed`);
|
|
418
418
|
}
|
|
419
419
|
if (!config.resources?.length && config.resourceDir) {
|
|
420
|
-
const { loadResources } = await import("./loadResources-
|
|
420
|
+
const { loadResources } = await import("./loadResources-PWd0OCpV.mjs").then((n) => n.n);
|
|
421
421
|
const { resolve } = await import("node:path");
|
|
422
422
|
const dir = resolve(config.resourceDir);
|
|
423
423
|
config = {
|
|
@@ -676,7 +676,7 @@ function validateDistributedRuntime(options) {
|
|
|
676
676
|
*/
|
|
677
677
|
async function createApp(options) {
|
|
678
678
|
if (options.debug !== void 0 && options.debug !== false) {
|
|
679
|
-
const { configureArcLogger } = await import("./logger-
|
|
679
|
+
const { configureArcLogger } = await import("./logger-D1YrIImS.mjs").then((n) => n.r);
|
|
680
680
|
configureArcLogger({ debug: options.debug });
|
|
681
681
|
}
|
|
682
682
|
validateAuthOptions(options);
|
|
@@ -729,7 +729,7 @@ async function createApp(options) {
|
|
|
729
729
|
await registerErrorHandler(fastify, config, trackPlugin);
|
|
730
730
|
await registerResources(fastify, config);
|
|
731
731
|
if (config.replyHelpers) {
|
|
732
|
-
const { replyHelpersPlugin } = await import("./replyHelpers-
|
|
732
|
+
const { replyHelpersPlugin } = await import("./replyHelpers-CxkYGT81.mjs").then((n) => n.n);
|
|
733
733
|
await fastify.register(replyHelpersPlugin);
|
|
734
734
|
}
|
|
735
735
|
if (config.serializeBigInt) fastify.addHook("preSerialization", async (_request, _reply, payload) => {
|
|
@@ -4,7 +4,7 @@ import { t as BaseController } from "./BaseController-DAGGc5Xn.mjs";
|
|
|
4
4
|
import { i as resolveEffectiveRoles, t as applyFieldReadPermissions } from "./fields-ipsbIRPK.mjs";
|
|
5
5
|
import { t as getUserRoles } from "./types-ZUu_h0jp.mjs";
|
|
6
6
|
import { n as normalizePermissionResult, t as applyPermissionResult } from "./applyPermissionResult-D6GPMsvh.mjs";
|
|
7
|
-
import { n as convertRouteSchema, t as convertOpenApiSchemas } from "./schemaConverter-
|
|
7
|
+
import { n as convertRouteSchema, t as convertOpenApiSchemas } from "./schemaConverter-Y7nCYaLJ.mjs";
|
|
8
8
|
import { t as requestContext } from "./requestContext-DYvHl113.mjs";
|
|
9
9
|
import { i as getDefaultCrudSchemas } from "./utils-yYT3HDXt.mjs";
|
|
10
10
|
import { r as ForbiddenError } from "./errors-BF2bIOIS.mjs";
|
|
@@ -1299,7 +1299,7 @@ var ResourceDefinition = class {
|
|
|
1299
1299
|
fields: self.fields
|
|
1300
1300
|
});
|
|
1301
1301
|
if (self.actions && Object.keys(self.actions).length > 0) {
|
|
1302
|
-
const { createActionRouter } = await import("./createActionRouter-
|
|
1302
|
+
const { createActionRouter } = await import("./createActionRouter-BORM8f17.mjs").then((n) => n.r);
|
|
1303
1303
|
createActionRouter(instance, normalizeActionsToRouterConfig(self.actions, self.actionPermissions, self.tag));
|
|
1304
1304
|
}
|
|
1305
1305
|
if (self.events && Object.keys(self.events).length > 0) typedInstance.log?.debug?.(`Resource '${self.name}' defined ${Object.keys(self.events).length} events`);
|
package/dist/docs/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { it as RegistryEntry } from "../interface-
|
|
2
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
1
|
+
import { it as RegistryEntry } from "../interface-CMRutPfe.mjs";
|
|
2
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-BnkYrNzp.mjs";
|
|
3
3
|
import { FastifyPluginAsync } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/docs/openapi.d.ts
|
package/dist/docs/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getUserRoles } from "../types-ZUu_h0jp.mjs";
|
|
2
|
-
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-
|
|
2
|
+
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-CbKUJY_m.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/docs/scalar.ts
|
|
5
5
|
const scalarPlugin = async (fastify, opts = {}) => {
|
package/dist/dynamic/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { qt as ResourceDefinition, r as DataAdapter } from "../interface-
|
|
2
|
-
import { t as PermissionCheck } from "../types-
|
|
1
|
+
import { qt as ResourceDefinition, r as DataAdapter } from "../interface-CMRutPfe.mjs";
|
|
2
|
+
import { t as PermissionCheck } from "../types-DZi1aYhm.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/dynamic/ArcDynamicLoader.d.ts
|
|
5
5
|
interface ArcArchitectureSchema {
|
package/dist/dynamic/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ArcQueryParser } from "../queryParser-CgCtsjti.mjs";
|
|
2
|
-
import { n as defineResource } from "../defineResource-
|
|
2
|
+
import { n as defineResource } from "../defineResource-tcgySDo1.mjs";
|
|
3
3
|
import { C as publicRead, T as readOnly, b as fullPublic, v as adminOnly, w as publicReadAdminWrite, x as ownerWithAdminBypass, y as authenticated } from "../permissions-CH4cNwJi.mjs";
|
|
4
4
|
//#region src/dynamic/ArcDynamicLoader.ts
|
|
5
5
|
const VALID_FIELD_TYPES = new Set([
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
import { t as getUserRoles } from "./types-ZUu_h0jp.mjs";
|
|
3
|
-
import { t as arcLog } from "./logger-
|
|
3
|
+
import { t as arcLog } from "./logger-D1YrIImS.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/scope/elevation.ts
|
|
6
6
|
var elevation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "./EventTransport-
|
|
1
|
+
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "./EventTransport-BXja8NOc.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/events/defineEvent.d.ts
|
package/dist/events/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as MemoryEventTransport, c as createEvent, i as EventTransport, n as EventHandler, o as MemoryEventTransportOptions, r as EventLogger, s as PublishManyResult, t as DomainEvent } from "../EventTransport-
|
|
2
|
-
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-
|
|
1
|
+
import { a as MemoryEventTransport, c as createEvent, i as EventTransport, n as EventHandler, o as MemoryEventTransportOptions, r as EventLogger, s as PublishManyResult, t as DomainEvent } from "../EventTransport-BXja8NOc.mjs";
|
|
2
|
+
import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-D9DKB2zM.mjs";
|
|
3
3
|
import { RedisEventTransportOptions, RedisLike } from "./transports/redis.mjs";
|
|
4
|
-
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-
|
|
4
|
+
import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-CrsfUmPt.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/events/eventTypes.d.ts
|
|
7
7
|
/**
|
package/dist/events/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as MemoryEventTransport, i as withRetry, o as createEvent, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-
|
|
1
|
+
import { a as MemoryEventTransport, i as withRetry, o as createEvent, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-CDjVTM82.mjs";
|
|
2
2
|
//#region src/events/defineEvent.ts
|
|
3
3
|
/**
|
|
4
4
|
* defineEvent — Typed Event Definitions with Optional Schema Validation
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-
|
|
1
|
+
import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-CrsfUmPt.mjs";
|
|
2
2
|
export { type RedisStreamLike, RedisStreamTransport, type RedisStreamTransportOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "../../EventTransport-
|
|
1
|
+
import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "../../EventTransport-BXja8NOc.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/events/transports/redis.d.ts
|
|
4
4
|
interface RedisLike {
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-
|
|
1
|
+
import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-Ch9pTQbf.mjs";
|
|
2
2
|
import { FastifyInstance } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/factory/createApp.d.ts
|