@classytic/arc 2.9.1 → 2.10.3
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 +19 -90
- package/dist/{BaseController-Vu2yc56T.mjs → BaseController-CbKKIflT.mjs} +8 -44
- package/dist/{ResourceRegistry-Dq3_zBQP.mjs → ResourceRegistry-BPd6NQDm.mjs} +1 -1
- package/dist/adapters/index.d.mts +3 -3
- package/dist/adapters/index.mjs +2 -2
- package/dist/{adapters-BBqAVvPK.mjs → adapters-BXY4i-hw.mjs} +210 -41
- package/dist/audit/index.d.mts +38 -3
- package/dist/audit/index.mjs +41 -7
- package/dist/auth/index.d.mts +4 -4
- package/dist/auth/index.mjs +5 -5
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/cache/index.d.mts +17 -15
- package/dist/cache/index.mjs +15 -14
- package/dist/{caching-CjybdRwx.mjs → caching-CBpK_SCM.mjs} +8 -3
- package/dist/cli/commands/describe.mjs +1 -1
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/init.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 -4
- package/dist/{defineResource-C__jkwvs.mjs → core-CcR01lup.mjs} +44 -12
- package/dist/{createActionRouter-DH1YFL9m.mjs → createActionRouter-Bp_5c_2b.mjs} +1 -1
- package/dist/{createApp-CBJUJKGP.mjs → createApp-BuvPma24.mjs} +14 -14
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +2 -2
- package/dist/{elevation-DxQ6ACbt.mjs → elevation-C7hgL_aI.mjs} +2 -2
- package/dist/{errorHandler-CZDW4EXS.mjs → errorHandler-Bb49BvPD.mjs} +1 -1
- package/dist/{errorHandler-DixGcttC.d.mts → errorHandler-DRQ3EqfL.d.mts} +1 -1
- package/dist/{eventPlugin-BxvaCIZF.d.mts → eventPlugin-CxWgpd6K.d.mts} +1 -1
- package/dist/{eventPlugin-Dl7MoVWH.mjs → eventPlugin-DCUjuiQT.mjs} +1 -1
- package/dist/events/index.d.mts +8 -5
- package/dist/events/index.mjs +34 -17
- 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/{types-DZi1aYhm.d.mts → fields-Lo1VUDpt.d.mts} +121 -1
- package/dist/{filesUpload-q8oHt--L.mjs → filesUpload-t21LS-py.mjs} +2 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +7 -4
- package/dist/idempotency/index.mjs +9 -11
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-Cibkchnx.d.mts → index-8qw4y6ff.d.mts} +2 -2
- package/dist/{index-C-xjcA6F.d.mts → index-ChIw3776.d.mts} +283 -408
- package/dist/{interface-YrWsmKqE.d.mts → index-Cl0uoKd5.d.mts} +1885 -2741
- package/dist/{index-CtGKT0lf.d.mts → index-DStwgFUK.d.mts} +81 -7
- package/dist/index.d.mts +7 -8
- package/dist/index.mjs +11 -12
- 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/mcp/index.d.mts +2 -2
- package/dist/integrations/mcp/index.mjs +1 -1
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/interface-D218ikEo.d.mts +77 -0
- package/dist/{memory-BFAYkf8H.mjs → memory-B5Amv9A1.mjs} +23 -8
- package/dist/{openapi-CXuTG1M9.mjs → openapi-B5F8AddX.mjs} +2 -2
- package/dist/org/index.d.mts +2 -2
- package/dist/permissions/index.d.mts +3 -4
- package/dist/permissions/index.mjs +5 -5
- package/dist/{permissions-oNZawnkR.mjs → permissions-Dk6mshja.mjs} +315 -397
- package/dist/plugins/index.d.mts +4 -4
- package/dist/plugins/index.mjs +12 -14
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/presets/filesUpload.d.mts +3 -3
- package/dist/presets/filesUpload.mjs +1 -1
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +1 -1
- package/dist/presets/search.d.mts +91 -4
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-hM4WhNWY.mjs → presets-fLJVXdVn.mjs} +1 -1
- package/dist/{queryCachePlugin-CnTZZTC5.d.mts → queryCachePlugin-BKbWjgDG.d.mts} +1 -1
- package/dist/{queryCachePlugin-DbUVroUG.mjs → queryCachePlugin-DQCEfJis.mjs} +8 -8
- package/dist/{queryParser-Cs-6SHQK.mjs → queryParser-DBqBB6AC.mjs} +1 -1
- package/dist/{redis-MXLp1oOf.d.mts → redis-DqyeggCa.d.mts} +1 -1
- package/dist/{redis-stream-Bz-4q96t.d.mts → redis-stream-CakIQmwR.d.mts} +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{resourceToTools-C3cWymnW.mjs → resourceToTools-BElv3xPT.mjs} +3 -3
- package/dist/scope/index.d.mts +1 -1
- package/dist/scope/index.mjs +2 -2
- package/dist/{sse-CJpt7LGI.mjs → sse-yBCgOLGu.mjs} +1 -1
- package/dist/testing/index.d.mts +6 -5
- package/dist/testing/index.mjs +8 -10
- package/dist/testing/storageContract.d.mts +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -31
- package/dist/types/storage.d.mts +1 -1
- package/dist/{types-CoSzA-s-.d.mts → types-Btdda02s.d.mts} +1 -1
- package/dist/{types-CunEX4UX.d.mts → types-Co8k3NyS.d.mts} +9 -9
- package/dist/types-Csi3FLfq.mjs +27 -0
- package/dist/utils/index.d.mts +207 -3
- package/dist/utils/index.mjs +3 -4
- package/dist/{utils-B7FuRr9w.mjs → utils-B2fNOD_i.mjs} +285 -2
- package/dist/{versioning-Cm8qoFDg.mjs → versioning-C2U_bLY0.mjs} +3 -5
- package/package.json +15 -18
- package/skills/arc/SKILL.md +7 -11
- package/skills/arc/references/production.md +0 -41
- package/dist/circuitBreaker-CvXkjfrW.d.mts +0 -206
- package/dist/circuitBreaker-l18oRgL5.mjs +0 -284
- package/dist/core-DNncu0xF.mjs +0 -34
- package/dist/dynamic/index.d.mts +0 -93
- package/dist/dynamic/index.mjs +0 -122
- package/dist/fields-BC7zcmI9.d.mts +0 -121
- package/dist/interface-DplgQO2e.d.mts +0 -54
- package/dist/policies/index.d.mts +0 -425
- package/dist/policies/index.mjs +0 -318
- package/dist/rpc/index.d.mts +0 -90
- package/dist/rpc/index.mjs +0 -248
- /package/dist/{EventTransport-CqZ8FyM_.d.mts → EventTransport-CUw5NNWe.d.mts} +0 -0
- /package/dist/{HookSystem-BjFu7zf1.mjs → HookSystem-BNYKnrXF.mjs} +0 -0
- /package/dist/{applyPermissionResult-bqGpo9ML.mjs → applyPermissionResult-QhV1Pa-g.mjs} +0 -0
- /package/dist/{betterAuthOpenApi--rdY15Ld.mjs → betterAuthOpenApi-BBRVhjQN.mjs} +0 -0
- /package/dist/{constants-Cxde4rpC.mjs → constants-BhY1OHoH.mjs} +0 -0
- /package/dist/{elevation-B6S5csVA.d.mts → elevation-C5SwtkAn.d.mts} +0 -0
- /package/dist/{errors-BI8kEKsO.d.mts → errors-CCSsMpXE.d.mts} +0 -0
- /package/dist/{errors-CqWnSqM-.mjs → errors-D5c-5BJL.mjs} +0 -0
- /package/dist/{externalPaths-Bapitwvd.d.mts → externalPaths-BQ8QijNH.d.mts} +0 -0
- /package/dist/{fields-CU6FlaDV.mjs → fields-bxkeltzz.mjs} +0 -0
- /package/dist/{interface-B-pe8fhj.d.mts → interface-CSbZdv_3.d.mts} +0 -0
- /package/dist/{loadResources-Bksk8ydA.mjs → loadResources-BAzJItAJ.mjs} +0 -0
- /package/dist/{logger-CDjpjySd.mjs → logger-DLg8-Ueg.mjs} +0 -0
- /package/dist/{metrics-TuOmguhi.mjs → metrics-DuhiSEZI.mjs} +0 -0
- /package/dist/{pluralize-CWP6MB39.mjs → pluralize-A0tWEl1K.mjs} +0 -0
- /package/dist/{registry-B0Wl7uVV.mjs → registry-B3lRFBWo.mjs} +0 -0
- /package/dist/{replyHelpers-BLojtuvR.mjs → replyHelpers-CXtJDAZ0.mjs} +0 -0
- /package/dist/{requestContext-DYtmNpm5.mjs → requestContext-xHIKedG6.mjs} +0 -0
- /package/dist/{sessionManager-D-oNWHz3.d.mts → sessionManager-BkzVU8h2.d.mts} +0 -0
- /package/dist/{storage-BwGQXUpd.d.mts → storage-CVk_SEn2.d.mts} +0 -0
- /package/dist/{store-helpers-DFiZl5TL.mjs → store-helpers-ZCSMJJAX.mjs} +0 -0
- /package/dist/{tracing-xqXzWeaf.d.mts → tracing-65B51Dw3.d.mts} +0 -0
- /package/dist/{types-ZUu_h0jp.mjs → types-DV9WDfeg.mjs} +0 -0
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as ExternalOpenApiPaths } from "../externalPaths-
|
|
3
|
-
import { _ as CachingRule, a as VersioningOptions, c as MetricEntry, d as _default$4, f as metricsPlugin, g as CachingOptions, h as ssePlugin, i as errorHandlerPlugin, l as MetricsCollector, m as _default$6, n as ErrorMapper, o as _default$7, p as SSEOptions, r as defaultIsDuplicateKeyError, s as versioningPlugin, t as ErrorHandlerOptions, u as MetricsOptions, v as _default$1, y as cachingPlugin } from "../errorHandler-
|
|
4
|
-
import { t as TracingOptions } from "../tracing-
|
|
1
|
+
import { W as ResourceRegistry, at as PresetHook, dn as AnyRecord, gt as RouteSchemaOptions, nt as MiddlewareConfig, pt as RouteDefinition, tn as HookSystem } from "../index-Cl0uoKd5.mjs";
|
|
2
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-BQ8QijNH.mjs";
|
|
3
|
+
import { _ as CachingRule, a as VersioningOptions, c as MetricEntry, d as _default$4, f as metricsPlugin, g as CachingOptions, h as ssePlugin, i as errorHandlerPlugin, l as MetricsCollector, m as _default$6, n as ErrorMapper, o as _default$7, p as SSEOptions, r as defaultIsDuplicateKeyError, s as versioningPlugin, t as ErrorHandlerOptions, u as MetricsOptions, v as _default$1, y as cachingPlugin } from "../errorHandler-DRQ3EqfL.mjs";
|
|
4
|
+
import { t as TracingOptions } from "../tracing-65B51Dw3.mjs";
|
|
5
5
|
import { FastifyInstance, FastifyPluginAsync } from "fastify";
|
|
6
6
|
import * as _$node_stream0 from "node:stream";
|
|
7
7
|
|
package/dist/plugins/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { p as MUTATION_OPERATIONS } from "../constants-
|
|
1
|
+
import { p as MUTATION_OPERATIONS } from "../constants-BhY1OHoH.mjs";
|
|
2
2
|
import { o as getOrgId } from "../types-AOD8fxIw.mjs";
|
|
3
|
-
import { t as requestContext } from "../requestContext-
|
|
3
|
+
import { t as requestContext } from "../requestContext-xHIKedG6.mjs";
|
|
4
4
|
import { t as hasEvents } from "../typeGuards-Cj5Rgvlg.mjs";
|
|
5
|
-
import { t as HookSystem } from "../HookSystem-
|
|
6
|
-
import { t as ResourceRegistry } from "../ResourceRegistry-
|
|
7
|
-
import { n as caching_default, t as cachingPlugin } from "../caching-
|
|
8
|
-
import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-
|
|
9
|
-
import { n as metrics_default, t as metricsPlugin } from "../metrics-
|
|
10
|
-
import { t as replyHelpersPlugin } from "../replyHelpers-
|
|
11
|
-
import { n as sse_default, t as ssePlugin } from "../sse-
|
|
12
|
-
import { n as versioning_default, t as versioningPlugin } from "../versioning-
|
|
5
|
+
import { t as HookSystem } from "../HookSystem-BNYKnrXF.mjs";
|
|
6
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-BPd6NQDm.mjs";
|
|
7
|
+
import { n as caching_default, t as cachingPlugin } from "../caching-CBpK_SCM.mjs";
|
|
8
|
+
import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-Bb49BvPD.mjs";
|
|
9
|
+
import { n as metrics_default, t as metricsPlugin } from "../metrics-DuhiSEZI.mjs";
|
|
10
|
+
import { t as replyHelpersPlugin } from "../replyHelpers-CXtJDAZ0.mjs";
|
|
11
|
+
import { n as sse_default, t as ssePlugin } from "../sse-yBCgOLGu.mjs";
|
|
12
|
+
import { n as versioning_default, t as versioningPlugin } from "../versioning-C2U_bLY0.mjs";
|
|
13
13
|
import { randomUUID } from "node:crypto";
|
|
14
14
|
import fp from "fastify-plugin";
|
|
15
15
|
//#region src/core/arcCorePlugin.ts
|
|
@@ -393,15 +393,13 @@ var health_default = fp(healthPlugin, {
|
|
|
393
393
|
const requestIdPlugin = async (fastify, opts = {}) => {
|
|
394
394
|
const { header = "x-request-id", generator = randomUUID, setResponseHeader = true } = opts;
|
|
395
395
|
if (!fastify.hasRequestDecorator("requestId")) fastify.decorateRequest("requestId", "");
|
|
396
|
-
fastify.addHook("onRequest", async (request) => {
|
|
396
|
+
fastify.addHook("onRequest", async (request, reply) => {
|
|
397
397
|
const incomingId = request.headers[header];
|
|
398
398
|
const sanitized = typeof incomingId === "string" ? incomingId.trim() : "";
|
|
399
399
|
const requestId = sanitized.length > 0 && sanitized.length <= 128 && /^[\w.:-]+$/.test(sanitized) ? sanitized : generator();
|
|
400
400
|
request.id = requestId;
|
|
401
401
|
request.requestId = requestId;
|
|
402
|
-
|
|
403
|
-
if (setResponseHeader) fastify.addHook("onSend", async (request, reply) => {
|
|
404
|
-
reply.header(header, request.requestId);
|
|
402
|
+
if (setResponseHeader) reply.header(header, requestId);
|
|
405
403
|
});
|
|
406
404
|
fastify.log?.debug?.("Request ID plugin registered");
|
|
407
405
|
};
|
|
@@ -145,7 +145,7 @@ const responseCachePluginImpl = async (fastify, opts = {}) => {
|
|
|
145
145
|
request.__arcCacheTTL = 0;
|
|
146
146
|
reply.code(entry.statusCode).send(entry.body);
|
|
147
147
|
};
|
|
148
|
-
fastify.addHook("
|
|
148
|
+
fastify.addHook("preSerialization", async (request, reply, payload) => {
|
|
149
149
|
const ttl = request.__arcCacheTTL;
|
|
150
150
|
if (!ttl || ttl <= 0) return payload;
|
|
151
151
|
if (request.method !== "GET" && request.method !== "HEAD") return payload;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-
|
|
1
|
+
import { a as traced, i as isTracingAvailable, n as _default, r as createSpan, t as TracingOptions } from "../tracing-65B51Dw3.mjs";
|
|
2
2
|
export { type TracingOptions, createSpan, isTracingAvailable, traced, _default as tracingPlugin };
|
|
@@ -44,7 +44,7 @@ try {
|
|
|
44
44
|
function createTracerProvider(options) {
|
|
45
45
|
if (!isAvailable) return null;
|
|
46
46
|
const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
|
|
47
|
-
const resolvedVersion = serviceVersion ?? "2.
|
|
47
|
+
const resolvedVersion = serviceVersion ?? "2.10.3";
|
|
48
48
|
const exporter = new OTLPTraceExporter({ url: exporterUrl });
|
|
49
49
|
const provider = new NodeTracerProvider({ resource: { attributes: {
|
|
50
50
|
"service.name": serviceName,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as RequestScope } from "../types-BD85MlEK.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-
|
|
2
|
+
import { c as PermissionCheck } from "../fields-Lo1VUDpt.mjs";
|
|
3
|
+
import { ot as PresetResult } from "../index-Cl0uoKd5.mjs";
|
|
4
|
+
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-CVk_SEn2.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/presets/filesUpload.d.ts
|
|
7
7
|
interface FilesUploadPresetRoutes {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as filesUploadPreset } from "../filesUpload-
|
|
1
|
+
import { t as filesUploadPreset } from "../filesUpload-t21LS-py.mjs";
|
|
2
2
|
export { filesUploadPreset };
|
package/dist/presets/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { St as IRequestContext, dn as AnyRecord, lt as ResourceConfig, ot as PresetResult, u as PaginationResult, xt as IControllerResponse } from "../index-Cl0uoKd5.mjs";
|
|
2
2
|
import { FilesUploadPresetOptions, FilesUploadPresetPermissions, FilesUploadPresetRoutes, filesUploadPreset } from "./filesUpload.mjs";
|
|
3
3
|
import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
|
|
4
4
|
import { SearchHandler, SearchPresetOptions, SearchRouteConfig, searchPreset } from "./search.mjs";
|
package/dist/presets/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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 { t as filesUploadPreset } from "../filesUpload-
|
|
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-fLJVXdVn.mjs";
|
|
3
|
+
import { t as filesUploadPreset } from "../filesUpload-t21LS-py.mjs";
|
|
4
4
|
import { searchPreset } from "./search.mjs";
|
|
5
5
|
export { applyPresets, auditedPreset, bulkPreset, filesUploadPreset, flexibleMultiTenantPreset, getAvailablePresets, getPreset, multiTenantPreset, ownedByUserPreset, registerPreset, searchPreset, slugLookupPreset, softDeletePreset, treePreset };
|
|
@@ -1,7 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as PermissionCheck } from "../fields-Lo1VUDpt.mjs";
|
|
2
|
+
import { _t as ControllerHandler, mt as RouteMcpConfig, ot as PresetResult, pt as RouteDefinition } from "../index-Cl0uoKd5.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/presets/search.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Search Preset — backend-agnostic search / vector / embed routes
|
|
7
|
+
*
|
|
8
|
+
* Arc doesn't ship a search engine. It ships the **routes** that front one.
|
|
9
|
+
* The preset mounts up to three standard routes on a resource:
|
|
10
|
+
*
|
|
11
|
+
* POST /search → full-text / engine-backed search (ES, OpenSearch, Algolia, Typesense, …)
|
|
12
|
+
* POST /search-similar → vector / semantic similarity (Atlas, Pinecone, Qdrant, Milvus, …)
|
|
13
|
+
* POST /embed → text / media → vector embedding
|
|
14
|
+
*
|
|
15
|
+
* Each route is OFF by default. You opt in by providing a `handler` that calls
|
|
16
|
+
* whatever backend you use. The preset contributes:
|
|
17
|
+
* - Default path + method + permissions (customisable)
|
|
18
|
+
* - OpenAPI description + MCP tool naming
|
|
19
|
+
* - Arc envelope + pipeline (permissions, audit, hooks)
|
|
20
|
+
* - Sensible Fastify route schema defaults
|
|
21
|
+
*
|
|
22
|
+
* Paths are fully customisable — if your product wants `/abc/search` or a
|
|
23
|
+
* GET-based autocomplete, pass `path`/`method` overrides or use `routes` for
|
|
24
|
+
* fully bespoke endpoints.
|
|
25
|
+
*
|
|
26
|
+
* @example MongoKit wiring (elasticSearchPlugin + vectorPlugin)
|
|
27
|
+
* ```typescript
|
|
28
|
+
* import { Repository, methodRegistryPlugin, elasticSearchPlugin } from '@classytic/mongokit';
|
|
29
|
+
* import { vectorPlugin } from '@classytic/mongokit/ai';
|
|
30
|
+
* import { searchPreset } from '@classytic/arc/presets/search';
|
|
31
|
+
*
|
|
32
|
+
* const productRepo = new Repository(Product, [
|
|
33
|
+
* methodRegistryPlugin(),
|
|
34
|
+
* elasticSearchPlugin({ client: esClient, indexName: 'products' }),
|
|
35
|
+
* vectorPlugin({ fields: [{ path: 'embedding', dimensions: 1536 }], embedFn }),
|
|
36
|
+
* ]);
|
|
37
|
+
*
|
|
38
|
+
* defineResource({
|
|
39
|
+
* name: 'product',
|
|
40
|
+
* adapter: createMongooseAdapter({ model: Product, repository: productRepo }),
|
|
41
|
+
* presets: [
|
|
42
|
+
* searchPreset({
|
|
43
|
+
* search: { handler: (req) => productRepo.search(req.body.query, req.body) },
|
|
44
|
+
* similar: { handler: (req) => productRepo.searchSimilar(req.body.query, req.body) },
|
|
45
|
+
* }),
|
|
46
|
+
* ],
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @example Custom vector backend (Pinecone)
|
|
51
|
+
* ```typescript
|
|
52
|
+
* searchPreset({
|
|
53
|
+
* similar: {
|
|
54
|
+
* path: '/vector-search', // custom path
|
|
55
|
+
* handler: async (req) => {
|
|
56
|
+
* const hits = await pinecone.query({
|
|
57
|
+
* vector: req.body.vector,
|
|
58
|
+
* topK: req.body.topK ?? 10,
|
|
59
|
+
* });
|
|
60
|
+
* return hits.matches;
|
|
61
|
+
* },
|
|
62
|
+
* schema: { body: { type: 'object', properties: { vector: { type: 'array' }, topK: { type: 'integer' } } } },
|
|
63
|
+
* mcp: false, // no MCP tool for this one
|
|
64
|
+
* },
|
|
65
|
+
* // Extra app-specific route
|
|
66
|
+
* routes: [
|
|
67
|
+
* {
|
|
68
|
+
* method: 'GET',
|
|
69
|
+
* path: '/autocomplete',
|
|
70
|
+
* handler: async (req) => algolia.suggest(req.query.q as string),
|
|
71
|
+
* permissions: allowPublic(),
|
|
72
|
+
* },
|
|
73
|
+
* ],
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* Feature-detected search surface. Arc's `RepositoryLike` is the cross-kit
|
|
79
|
+
* minimum (repo-core's `MinimalRepo & Partial<StandardRepo>`) and does not
|
|
80
|
+
* declare search/vector/embed methods — those are kit-specific (mongokit's
|
|
81
|
+
* `elasticSearchPlugin` + `vectorPlugin`, pgkit's `pgvector` extension,
|
|
82
|
+
* sqlitekit FTS5, or a standalone Pinecone/Algolia adapter). We type the
|
|
83
|
+
* `repository` option locally so the preset can auto-wire handlers when a
|
|
84
|
+
* kit happens to ship these methods, without forcing every repo to declare
|
|
85
|
+
* them.
|
|
86
|
+
*/
|
|
87
|
+
interface SearchableRepository {
|
|
88
|
+
search?(query: unknown, options?: unknown): Promise<unknown>;
|
|
89
|
+
searchSimilar?(query: unknown, options?: unknown): Promise<unknown>;
|
|
90
|
+
embed?(input: unknown): Promise<number[]>;
|
|
91
|
+
}
|
|
5
92
|
/**
|
|
6
93
|
* Handler contract — receives arc's `IRequestContext` (same as any `actions` or
|
|
7
94
|
* non-raw route handler) and returns either the raw result (wrapped into
|
|
@@ -57,7 +144,7 @@ interface SearchPresetOptions {
|
|
|
57
144
|
* Sections set to `true` REQUIRE `repository` (otherwise the route is
|
|
58
145
|
* skipped silently). Sections with an explicit `handler` ignore this field.
|
|
59
146
|
*/
|
|
60
|
-
repository?:
|
|
147
|
+
repository?: SearchableRepository;
|
|
61
148
|
/** Full-text / engine-backed search route. Opt-in. */
|
|
62
149
|
search?: SearchSection;
|
|
63
150
|
/** Vector / semantic similarity route. Opt-in. */
|
|
@@ -88,4 +175,4 @@ interface SearchPresetOptions {
|
|
|
88
175
|
*/
|
|
89
176
|
declare function searchPreset(options?: SearchPresetOptions): PresetResult;
|
|
90
177
|
//#endregion
|
|
91
|
-
export { SearchHandler, SearchPresetOptions, SearchRouteConfig, SearchSection, searchPreset };
|
|
178
|
+
export { SearchHandler, SearchPresetOptions, SearchRouteConfig, SearchSection, SearchableRepository, searchPreset };
|
package/dist/presets/search.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as isElevated, n as PUBLIC_SCOPE } from "./types-AOD8fxIw.mjs";
|
|
2
2
|
import { multiTenantPreset } from "./presets/multiTenant.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { C as requireAuth, T as requireRoles, y as allowPublic } from "./permissions-Dk6mshja.mjs";
|
|
4
4
|
//#region src/presets/ownedByUser.ts
|
|
5
5
|
/**
|
|
6
6
|
* Create ownership check middleware.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
import { i as versionKey, r as tagVersionKey } from "./keys-qcD-TVJl.mjs";
|
|
3
3
|
import { t as hasEvents } from "./typeGuards-Cj5Rgvlg.mjs";
|
|
4
|
-
import { t as MemoryCacheStore } from "./memory-
|
|
4
|
+
import { t as MemoryCacheStore } from "./memory-B5Amv9A1.mjs";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
6
|
//#region src/cache/QueryCache.ts
|
|
7
7
|
var QueryCache = class {
|
|
@@ -33,17 +33,17 @@ var QueryCache = class {
|
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
async set(key, data, config) {
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const staleTimeSec = config.staleTime ?? 0;
|
|
37
|
+
const totalTtlSec = staleTimeSec + (config.gcTime ?? 60);
|
|
38
38
|
const now = Date.now();
|
|
39
39
|
const envelope = {
|
|
40
40
|
data,
|
|
41
41
|
createdAt: now,
|
|
42
|
-
staleAfter: now +
|
|
43
|
-
expiresAt: now +
|
|
42
|
+
staleAfter: now + staleTimeSec * 1e3,
|
|
43
|
+
expiresAt: now + totalTtlSec * 1e3,
|
|
44
44
|
tags: config.tags ?? []
|
|
45
45
|
};
|
|
46
|
-
await this.store.set(key, envelope,
|
|
46
|
+
await this.store.set(key, envelope, totalTtlSec);
|
|
47
47
|
}
|
|
48
48
|
async invalidate(key) {
|
|
49
49
|
await this.store.delete(key);
|
|
@@ -56,7 +56,7 @@ var QueryCache = class {
|
|
|
56
56
|
async bumpResourceVersion(resource) {
|
|
57
57
|
const key = versionKey(resource);
|
|
58
58
|
const newVersion = Date.now();
|
|
59
|
-
await this.store.set(key, newVersion,
|
|
59
|
+
await this.store.set(key, newVersion, 1440 * 60);
|
|
60
60
|
}
|
|
61
61
|
/** Get current version for a tag */
|
|
62
62
|
async getTagVersion(tag) {
|
|
@@ -66,7 +66,7 @@ var QueryCache = class {
|
|
|
66
66
|
async bumpTagVersion(tag) {
|
|
67
67
|
const key = tagVersionKey(tag);
|
|
68
68
|
const newVersion = Date.now();
|
|
69
|
-
await this.store.set(key, newVersion,
|
|
69
|
+
await this.store.set(key, newVersion, 1440 * 60);
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as EventLogger, n as DomainEvent, o as EventTransport, r as EventHandler } from "./EventTransport-
|
|
1
|
+
import { i as EventLogger, n as DomainEvent, o as EventTransport, r as EventHandler } from "./EventTransport-CUw5NNWe.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/events/transports/redis-stream.d.ts
|
|
4
4
|
interface RedisStreamLike {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as IntrospectionPluginOptions, U as RegisterOptions, W as ResourceRegistry } from "../index-Cl0uoKd5.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/registry/introspectionPlugin.d.ts
|
package/dist/registry/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as introspectionPlugin_default, t as introspectionPlugin } from "../registry-
|
|
2
|
-
import { t as ResourceRegistry } from "../ResourceRegistry-
|
|
1
|
+
import { n as introspectionPlugin_default, t as introspectionPlugin } from "../registry-B3lRFBWo.mjs";
|
|
2
|
+
import { t as ResourceRegistry } from "../ResourceRegistry-BPd6NQDm.mjs";
|
|
3
3
|
export { ResourceRegistry, introspectionPlugin_default as introspectionPlugin, introspectionPlugin as introspectionPluginFn };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as BaseController } from "./BaseController-
|
|
2
|
-
import { n as normalizePermissionResult } from "./applyPermissionResult-
|
|
3
|
-
import { t as pluralize } from "./pluralize-
|
|
1
|
+
import { t as BaseController } from "./BaseController-CbKKIflT.mjs";
|
|
2
|
+
import { n as normalizePermissionResult } from "./applyPermissionResult-QhV1Pa-g.mjs";
|
|
3
|
+
import { t as pluralize } from "./pluralize-A0tWEl1K.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/integrations/mcp/createMcpServer.ts
|
|
6
6
|
/**
|
package/dist/scope/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-C5SwtkAn.mjs";
|
|
1
2
|
import { _ as isAuthenticated, a as getClientId, b as isOrgInScope, c as getOrgRoles, d as getScopeContextMap, f as getServiceScopes, g as hasOrgAccess, h as getUserRoles, i as getAncestorOrgIds, l as getRequestScope, m as getUserId, n as PUBLIC_SCOPE, o as getOrgContext, p as getTeamId, r as RequestScope, s as getOrgId, t as AUTHENTICATED_SCOPE, u as getScopeContext, v as isElevated, x as isService, y as isMember } from "../types-BD85MlEK.mjs";
|
|
2
|
-
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-B6S5csVA.mjs";
|
|
3
3
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/scope/rateLimitKey.d.ts
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as isElevated, a as getOrgContext, b as isService, c as getRequestScope, d as getServiceScopes, f as getTeamId, g as isAuthenticated, h as hasOrgAccess, i as getClientId, l as getScopeContext, m as getUserRoles, n as PUBLIC_SCOPE, o as getOrgId, p as getUserId, r as getAncestorOrgIds, s as getOrgRoles, t as AUTHENTICATED_SCOPE, u as getScopeContextMap, v as isMember, y as isOrgInScope } from "../types-AOD8fxIw.mjs";
|
|
2
|
-
import { n as normalizeRoles } from "../types-
|
|
3
|
-
import { n as elevation_default, t as elevationPlugin } from "../elevation-
|
|
2
|
+
import { n as normalizeRoles } from "../types-DV9WDfeg.mjs";
|
|
3
|
+
import { n as elevation_default, t as elevationPlugin } from "../elevation-C7hgL_aI.mjs";
|
|
4
4
|
//#region src/scope/rateLimitKey.ts
|
|
5
5
|
function createTenantKeyGenerator(opts) {
|
|
6
6
|
if (opts?.strategy) return opts.strategy;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
2
|
import { n as PUBLIC_SCOPE, o as getOrgId } from "./types-AOD8fxIw.mjs";
|
|
3
|
-
import { t as arcLog } from "./logger-
|
|
3
|
+
import { t as arcLog } from "./logger-DLg8-Ueg.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/plugins/sse.ts
|
|
6
6
|
var sse_exports = /* @__PURE__ */ __exportAll({
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as ResourceLike, r as CreateAppOptions } from "../types-
|
|
1
|
+
import { G as ResourceDefinition, dn as AnyRecord } from "../index-Cl0uoKd5.mjs";
|
|
2
|
+
import { d as ResourceLike, r as CreateAppOptions } from "../types-Co8k3NyS.mjs";
|
|
3
3
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import Fastify, { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
5
5
|
import { Connection } from "mongoose";
|
|
6
6
|
import { Mock } from "vitest";
|
|
7
|
+
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
7
8
|
|
|
8
9
|
//#region src/testing/authHelpers.d.ts
|
|
9
10
|
interface BetterAuthTestHelpersOptions {
|
|
@@ -478,7 +479,7 @@ declare function createHttpTestHarness<T = unknown>(resource: ResourceDefinition
|
|
|
478
479
|
/**
|
|
479
480
|
* Extended repository interface for testing (includes optional preset methods)
|
|
480
481
|
*/
|
|
481
|
-
interface MockRepository<T> extends
|
|
482
|
+
interface MockRepository<T> extends StandardRepo<T> {
|
|
482
483
|
getBySlug?: Mock;
|
|
483
484
|
getDeleted?: Mock;
|
|
484
485
|
restore?: Mock;
|
|
@@ -519,8 +520,8 @@ declare function createMockReply(): unknown;
|
|
|
519
520
|
/**
|
|
520
521
|
* Create a mock controller for testing
|
|
521
522
|
*/
|
|
522
|
-
declare function createMockController(repository:
|
|
523
|
-
repository:
|
|
523
|
+
declare function createMockController(repository: StandardRepo<AnyRecord>): {
|
|
524
|
+
repository: StandardRepo<AnyRecord>;
|
|
524
525
|
list: Mock<(...args: any[]) => any>;
|
|
525
526
|
get: Mock<(...args: any[]) => any>;
|
|
526
527
|
create: Mock<(...args: any[]) => any>;
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as CRUD_OPERATIONS } from "../constants-
|
|
2
|
-
import { n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-
|
|
1
|
+
import { t as CRUD_OPERATIONS } from "../constants-BhY1OHoH.mjs";
|
|
2
|
+
import { n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-bxkeltzz.mjs";
|
|
3
3
|
import { runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import Fastify from "fastify";
|
|
5
5
|
import mongoose from "mongoose";
|
|
@@ -566,7 +566,10 @@ var HttpTestHarness = class {
|
|
|
566
566
|
this.resource = resource;
|
|
567
567
|
this.optionsOrGetter = optionsOrGetter;
|
|
568
568
|
if (typeof optionsOrGetter === "function") this.eagerBaseUrl = null;
|
|
569
|
-
else
|
|
569
|
+
else {
|
|
570
|
+
const apiPrefix = optionsOrGetter.apiPrefix ?? "/api";
|
|
571
|
+
this.eagerBaseUrl = `${apiPrefix}${resource.prefix}`;
|
|
572
|
+
}
|
|
570
573
|
const disabled = new Set(resource.disabledRoutes ?? []);
|
|
571
574
|
this.enabledRoutes = new Set(resource.disableDefaultRoutes ? [] : CRUD_OPERATIONS.filter((op) => !disabled.has(op)));
|
|
572
575
|
this.updateMethod = resource.updateMethod === "PUT" ? "PUT" : "PATCH";
|
|
@@ -877,12 +880,6 @@ function createHttpTestHarness(resource, optionsOrGetter) {
|
|
|
877
880
|
//#endregion
|
|
878
881
|
//#region src/testing/mocks.ts
|
|
879
882
|
/**
|
|
880
|
-
* Testing Utilities - Mock Factories
|
|
881
|
-
*
|
|
882
|
-
* Create mock repositories, controllers, and services for testing.
|
|
883
|
-
* Uses Vitest for mocking (compatible with Jest API).
|
|
884
|
-
*/
|
|
885
|
-
/**
|
|
886
883
|
* Create a mock repository for testing
|
|
887
884
|
*
|
|
888
885
|
* @example
|
|
@@ -896,6 +893,7 @@ function createHttpTestHarness(resource, optionsOrGetter) {
|
|
|
896
893
|
function createMockRepository(overrides = {}) {
|
|
897
894
|
return {
|
|
898
895
|
getAll: vi.fn().mockResolvedValue({
|
|
896
|
+
method: "offset",
|
|
899
897
|
docs: [],
|
|
900
898
|
total: 0,
|
|
901
899
|
page: 1,
|
|
@@ -1743,7 +1741,7 @@ function runEventTests(resourceName, displayName, events) {
|
|
|
1743
1741
|
* ```
|
|
1744
1742
|
*/
|
|
1745
1743
|
async function createTestApp(options = {}) {
|
|
1746
|
-
const { createApp } = await import("../createApp-
|
|
1744
|
+
const { createApp } = await import("../createApp-BuvPma24.mjs").then((n) => n.r);
|
|
1747
1745
|
const { useInMemoryDb = true, mongoUri: providedMongoUri, ...appOptions } = options;
|
|
1748
1746
|
const defaultAuth = {
|
|
1749
1747
|
type: "jwt",
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-C5SwtkAn.mjs";
|
|
1
2
|
import { _ as isAuthenticated, c as getOrgRoles, g as hasOrgAccess, n as PUBLIC_SCOPE, p as getTeamId, r as RequestScope, s as getOrgId, t as AUTHENTICATED_SCOPE, v as isElevated, y as isMember } from "../types-BD85MlEK.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export { AUTHENTICATED_SCOPE, ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, BulkWriteOperation, BulkWriteResult, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRepository, CrudRouteKey, CrudRouterOptions, CrudSchemas, DeleteManyResult, DeleteOptions, DeleteResult, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, FindOneAndUpdateOptions, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, KeysetPaginatedResult, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OffsetPaginatedResult, OpenApiSchemas, OwnershipCheck, PUBLIC_SCOPE, PaginatedResult, PaginationParams, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryOptions, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RepositorySession, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResourceCacheConfig, ResourceConfig, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UpdateManyResult, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult, WriteOptions, envelope, getOrgId, getOrgRoles, getTeamId, getUserId, hasOrgAccess, isAuthenticated, isElevated, isMember };
|
|
3
|
+
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-Lo1VUDpt.mjs";
|
|
4
|
+
import { $ as CrudSchemas, A as AuthHelpers, B as FastifyWithDecorators, Bt as ArcInternalMetadata, C as ResourceMetadata, Ct as RouteHandler, D as HealthOptions, E as HealthCheck, F as TokenPair, Gt as PopulateOption, H as RequestWithExtras, Ht as LookupOption, I as ArcDecorator, J as ActionEntry, Jt as ServiceContext, Kt as QueryParserInterface, L as EventsDecorator, M as Authenticator, N as AuthenticatorContext, O as IntrospectionPluginOptions, P as JwtContext, Q as CrudRouteKey, R as FastifyRequestExtras, S as RegistryStats, St as IRequestContext, T as GracefulShutdownOptions, Ut as OwnershipCheck, V as MiddlewareHandler, Vt as ControllerQueryOptions, Wt as ParsedQuery, X as ActionsMap, Y as ActionHandlerFn, Z as CrudController, _ as ConfigError, _n as UserOrganization, _t as ControllerHandler, at as PresetHook, b as IntrospectionData, bt as IController, ct as ResourceCacheConfig, d as InferAdapterDoc, dn as AnyRecord, dt as ResourceHooks, et as EventDefinition, f as InferDocType, fn as ApiResponse, ft as ResourcePermissions, g as TypedResourceConfig, gn as UserLike, gt as RouteSchemaOptions, h as TypedRepository, hn as ObjectId, ht as RouteMethod, it as PresetFunction, j as AuthPluginOptions, k as RequestIdOptions, lt as ResourceConfig, m as TypedController, mn as JWTPayload, mt as RouteMcpConfig, nt as MiddlewareConfig, ot as PresetResult, p as InferResourceDoc, pn as ArcRequest, pt as RouteDefinition, q as ActionDefinition, qt as RequestContext, r as BaseControllerOptions, rt as OpenApiSchemas, st as RateLimitConfig, t as RouteHandlerMethod, tt as FieldRule, u as PaginationResult, ut as ResourceHookContext, v as ValidateOptions, vn as envelope, vt as ControllerLike, w as CrudRouterOptions, x as RegistryEntry, xt as IControllerResponse, y as ValidationResult, yn as getUserId, yt as FastifyHandler, z as FastifyWithAuth } from "../index-Cl0uoKd5.mjs";
|
|
5
|
+
export { AUTHENTICATED_SCOPE, ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OpenApiSchemas, OwnershipCheck, PUBLIC_SCOPE, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResourceCacheConfig, ResourceConfig, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult, envelope, getOrgId, getOrgRoles, getTeamId, getUserId, hasOrgAccess, isAuthenticated, isElevated, isMember };
|
package/dist/types/index.mjs
CHANGED
|
@@ -1,33 +1,3 @@
|
|
|
1
1
|
import { _ as isElevated, f as getTeamId, g as isAuthenticated, h as hasOrgAccess, n as PUBLIC_SCOPE, o as getOrgId, s as getOrgRoles, t as AUTHENTICATED_SCOPE, v as isMember } from "../types-AOD8fxIw.mjs";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Response envelope helper — wraps data in Arc's standard `{ success, data }` format.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```typescript
|
|
8
|
-
* import { envelope } from '@classytic/arc';
|
|
9
|
-
*
|
|
10
|
-
* handler: async (req, reply) => {
|
|
11
|
-
* const data = await getResults();
|
|
12
|
-
* return envelope(data);
|
|
13
|
-
* // → { success: true, data }
|
|
14
|
-
* }
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
function envelope(data, meta) {
|
|
18
|
-
return {
|
|
19
|
-
success: true,
|
|
20
|
-
data,
|
|
21
|
-
...meta
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Extract user ID from a user object (supports both id and _id)
|
|
26
|
-
*/
|
|
27
|
-
function getUserId(user) {
|
|
28
|
-
if (!user) return void 0;
|
|
29
|
-
const id = user.id ?? user._id;
|
|
30
|
-
return id ? String(id) : void 0;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
2
|
+
import { n as getUserId, t as envelope } from "../types-Csi3FLfq.mjs";
|
|
33
3
|
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, envelope, getOrgId, getOrgRoles, getTeamId, getUserId, hasOrgAccess, isAuthenticated, isElevated, isMember };
|
package/dist/types/storage.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-
|
|
1
|
+
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-CVk_SEn2.mjs";
|
|
2
2
|
export { Storage, StorageContext, StorageFile, StorageReadRange, StorageReadResult, StorageUploadInput };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as
|
|
6
|
-
import {
|
|
7
|
-
import { t as EventPluginOptions } from "./eventPlugin-
|
|
8
|
-
import { a as VersioningOptions, g as CachingOptions, p as SSEOptions, t as ErrorHandlerOptions, u as MetricsOptions } from "./errorHandler-
|
|
9
|
-
import { r as IdempotencyStore } from "./interface-
|
|
1
|
+
import { n as ElevationOptions } from "./elevation-C5SwtkAn.mjs";
|
|
2
|
+
import { M as Authenticator } from "./index-Cl0uoKd5.mjs";
|
|
3
|
+
import { o as EventTransport } from "./EventTransport-CUw5NNWe.mjs";
|
|
4
|
+
import { t as ExternalOpenApiPaths } from "./externalPaths-BQ8QijNH.mjs";
|
|
5
|
+
import { r as CacheStore } from "./interface-D218ikEo.mjs";
|
|
6
|
+
import { r as QueryCachePluginOptions } from "./queryCachePlugin-BKbWjgDG.mjs";
|
|
7
|
+
import { t as EventPluginOptions } from "./eventPlugin-CxWgpd6K.mjs";
|
|
8
|
+
import { a as VersioningOptions, g as CachingOptions, p as SSEOptions, t as ErrorHandlerOptions, u as MetricsOptions } from "./errorHandler-DRQ3EqfL.mjs";
|
|
9
|
+
import { r as IdempotencyStore } from "./interface-CSbZdv_3.mjs";
|
|
10
10
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
|
|
11
11
|
|
|
12
12
|
//#region src/factory/loadResources.d.ts
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/types/base.ts
|
|
2
|
+
/** Extract user ID from a user object (supports both id and _id). */
|
|
3
|
+
function getUserId(user) {
|
|
4
|
+
if (!user) return void 0;
|
|
5
|
+
const id = user.id ?? user._id;
|
|
6
|
+
return id ? String(id) : void 0;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Wrap data in Arc's standard `{ success: true, data }` envelope.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* handler: async (req, reply) => {
|
|
14
|
+
* const data = await getResults();
|
|
15
|
+
* return envelope(data); // → { success: true, data }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function envelope(data, meta) {
|
|
20
|
+
return {
|
|
21
|
+
success: true,
|
|
22
|
+
data,
|
|
23
|
+
...meta
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { getUserId as n, envelope as t };
|