@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.
Files changed (139) hide show
  1. package/README.md +19 -90
  2. package/dist/{BaseController-Vu2yc56T.mjs → BaseController-CbKKIflT.mjs} +8 -44
  3. package/dist/{ResourceRegistry-Dq3_zBQP.mjs → ResourceRegistry-BPd6NQDm.mjs} +1 -1
  4. package/dist/adapters/index.d.mts +3 -3
  5. package/dist/adapters/index.mjs +2 -2
  6. package/dist/{adapters-BBqAVvPK.mjs → adapters-BXY4i-hw.mjs} +210 -41
  7. package/dist/audit/index.d.mts +38 -3
  8. package/dist/audit/index.mjs +41 -7
  9. package/dist/auth/index.d.mts +4 -4
  10. package/dist/auth/index.mjs +5 -5
  11. package/dist/auth/redis-session.d.mts +1 -1
  12. package/dist/cache/index.d.mts +17 -15
  13. package/dist/cache/index.mjs +15 -14
  14. package/dist/{caching-CjybdRwx.mjs → caching-CBpK_SCM.mjs} +8 -3
  15. package/dist/cli/commands/describe.mjs +1 -1
  16. package/dist/cli/commands/docs.mjs +2 -2
  17. package/dist/cli/commands/generate.mjs +1 -1
  18. package/dist/cli/commands/init.mjs +1 -1
  19. package/dist/cli/commands/introspect.mjs +1 -1
  20. package/dist/core/index.d.mts +2 -2
  21. package/dist/core/index.mjs +3 -4
  22. package/dist/{defineResource-C__jkwvs.mjs → core-CcR01lup.mjs} +44 -12
  23. package/dist/{createActionRouter-DH1YFL9m.mjs → createActionRouter-Bp_5c_2b.mjs} +1 -1
  24. package/dist/{createApp-CBJUJKGP.mjs → createApp-BuvPma24.mjs} +14 -14
  25. package/dist/docs/index.d.mts +2 -2
  26. package/dist/docs/index.mjs +2 -2
  27. package/dist/{elevation-DxQ6ACbt.mjs → elevation-C7hgL_aI.mjs} +2 -2
  28. package/dist/{errorHandler-CZDW4EXS.mjs → errorHandler-Bb49BvPD.mjs} +1 -1
  29. package/dist/{errorHandler-DixGcttC.d.mts → errorHandler-DRQ3EqfL.d.mts} +1 -1
  30. package/dist/{eventPlugin-BxvaCIZF.d.mts → eventPlugin-CxWgpd6K.d.mts} +1 -1
  31. package/dist/{eventPlugin-Dl7MoVWH.mjs → eventPlugin-DCUjuiQT.mjs} +1 -1
  32. package/dist/events/index.d.mts +8 -5
  33. package/dist/events/index.mjs +34 -17
  34. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  35. package/dist/events/transports/redis.d.mts +1 -1
  36. package/dist/factory/index.d.mts +1 -1
  37. package/dist/factory/index.mjs +2 -2
  38. package/dist/{types-DZi1aYhm.d.mts → fields-Lo1VUDpt.d.mts} +121 -1
  39. package/dist/{filesUpload-q8oHt--L.mjs → filesUpload-t21LS-py.mjs} +2 -2
  40. package/dist/hooks/index.d.mts +1 -1
  41. package/dist/hooks/index.mjs +1 -1
  42. package/dist/idempotency/index.d.mts +7 -4
  43. package/dist/idempotency/index.mjs +9 -11
  44. package/dist/idempotency/redis.d.mts +1 -1
  45. package/dist/{index-Cibkchnx.d.mts → index-8qw4y6ff.d.mts} +2 -2
  46. package/dist/{index-C-xjcA6F.d.mts → index-ChIw3776.d.mts} +283 -408
  47. package/dist/{interface-YrWsmKqE.d.mts → index-Cl0uoKd5.d.mts} +1885 -2741
  48. package/dist/{index-CtGKT0lf.d.mts → index-DStwgFUK.d.mts} +81 -7
  49. package/dist/index.d.mts +7 -8
  50. package/dist/index.mjs +11 -12
  51. package/dist/integrations/event-gateway.d.mts +1 -1
  52. package/dist/integrations/event-gateway.mjs +1 -1
  53. package/dist/integrations/index.d.mts +1 -1
  54. package/dist/integrations/mcp/index.d.mts +2 -2
  55. package/dist/integrations/mcp/index.mjs +1 -1
  56. package/dist/integrations/mcp/testing.d.mts +1 -1
  57. package/dist/integrations/mcp/testing.mjs +1 -1
  58. package/dist/interface-D218ikEo.d.mts +77 -0
  59. package/dist/{memory-BFAYkf8H.mjs → memory-B5Amv9A1.mjs} +23 -8
  60. package/dist/{openapi-CXuTG1M9.mjs → openapi-B5F8AddX.mjs} +2 -2
  61. package/dist/org/index.d.mts +2 -2
  62. package/dist/permissions/index.d.mts +3 -4
  63. package/dist/permissions/index.mjs +5 -5
  64. package/dist/{permissions-oNZawnkR.mjs → permissions-Dk6mshja.mjs} +315 -397
  65. package/dist/plugins/index.d.mts +4 -4
  66. package/dist/plugins/index.mjs +12 -14
  67. package/dist/plugins/response-cache.mjs +1 -1
  68. package/dist/plugins/tracing-entry.d.mts +1 -1
  69. package/dist/plugins/tracing-entry.mjs +1 -1
  70. package/dist/presets/filesUpload.d.mts +3 -3
  71. package/dist/presets/filesUpload.mjs +1 -1
  72. package/dist/presets/index.d.mts +1 -1
  73. package/dist/presets/index.mjs +2 -2
  74. package/dist/presets/multiTenant.d.mts +1 -1
  75. package/dist/presets/multiTenant.mjs +1 -1
  76. package/dist/presets/search.d.mts +91 -4
  77. package/dist/presets/search.mjs +1 -1
  78. package/dist/{presets-hM4WhNWY.mjs → presets-fLJVXdVn.mjs} +1 -1
  79. package/dist/{queryCachePlugin-CnTZZTC5.d.mts → queryCachePlugin-BKbWjgDG.d.mts} +1 -1
  80. package/dist/{queryCachePlugin-DbUVroUG.mjs → queryCachePlugin-DQCEfJis.mjs} +8 -8
  81. package/dist/{queryParser-Cs-6SHQK.mjs → queryParser-DBqBB6AC.mjs} +1 -1
  82. package/dist/{redis-MXLp1oOf.d.mts → redis-DqyeggCa.d.mts} +1 -1
  83. package/dist/{redis-stream-Bz-4q96t.d.mts → redis-stream-CakIQmwR.d.mts} +1 -1
  84. package/dist/registry/index.d.mts +1 -1
  85. package/dist/registry/index.mjs +2 -2
  86. package/dist/{resourceToTools-C3cWymnW.mjs → resourceToTools-BElv3xPT.mjs} +3 -3
  87. package/dist/scope/index.d.mts +1 -1
  88. package/dist/scope/index.mjs +2 -2
  89. package/dist/{sse-CJpt7LGI.mjs → sse-yBCgOLGu.mjs} +1 -1
  90. package/dist/testing/index.d.mts +6 -5
  91. package/dist/testing/index.mjs +8 -10
  92. package/dist/testing/storageContract.d.mts +1 -1
  93. package/dist/types/index.d.mts +4 -4
  94. package/dist/types/index.mjs +1 -31
  95. package/dist/types/storage.d.mts +1 -1
  96. package/dist/{types-CoSzA-s-.d.mts → types-Btdda02s.d.mts} +1 -1
  97. package/dist/{types-CunEX4UX.d.mts → types-Co8k3NyS.d.mts} +9 -9
  98. package/dist/types-Csi3FLfq.mjs +27 -0
  99. package/dist/utils/index.d.mts +207 -3
  100. package/dist/utils/index.mjs +3 -4
  101. package/dist/{utils-B7FuRr9w.mjs → utils-B2fNOD_i.mjs} +285 -2
  102. package/dist/{versioning-Cm8qoFDg.mjs → versioning-C2U_bLY0.mjs} +3 -5
  103. package/package.json +15 -18
  104. package/skills/arc/SKILL.md +7 -11
  105. package/skills/arc/references/production.md +0 -41
  106. package/dist/circuitBreaker-CvXkjfrW.d.mts +0 -206
  107. package/dist/circuitBreaker-l18oRgL5.mjs +0 -284
  108. package/dist/core-DNncu0xF.mjs +0 -34
  109. package/dist/dynamic/index.d.mts +0 -93
  110. package/dist/dynamic/index.mjs +0 -122
  111. package/dist/fields-BC7zcmI9.d.mts +0 -121
  112. package/dist/interface-DplgQO2e.d.mts +0 -54
  113. package/dist/policies/index.d.mts +0 -425
  114. package/dist/policies/index.mjs +0 -318
  115. package/dist/rpc/index.d.mts +0 -90
  116. package/dist/rpc/index.mjs +0 -248
  117. /package/dist/{EventTransport-CqZ8FyM_.d.mts → EventTransport-CUw5NNWe.d.mts} +0 -0
  118. /package/dist/{HookSystem-BjFu7zf1.mjs → HookSystem-BNYKnrXF.mjs} +0 -0
  119. /package/dist/{applyPermissionResult-bqGpo9ML.mjs → applyPermissionResult-QhV1Pa-g.mjs} +0 -0
  120. /package/dist/{betterAuthOpenApi--rdY15Ld.mjs → betterAuthOpenApi-BBRVhjQN.mjs} +0 -0
  121. /package/dist/{constants-Cxde4rpC.mjs → constants-BhY1OHoH.mjs} +0 -0
  122. /package/dist/{elevation-B6S5csVA.d.mts → elevation-C5SwtkAn.d.mts} +0 -0
  123. /package/dist/{errors-BI8kEKsO.d.mts → errors-CCSsMpXE.d.mts} +0 -0
  124. /package/dist/{errors-CqWnSqM-.mjs → errors-D5c-5BJL.mjs} +0 -0
  125. /package/dist/{externalPaths-Bapitwvd.d.mts → externalPaths-BQ8QijNH.d.mts} +0 -0
  126. /package/dist/{fields-CU6FlaDV.mjs → fields-bxkeltzz.mjs} +0 -0
  127. /package/dist/{interface-B-pe8fhj.d.mts → interface-CSbZdv_3.d.mts} +0 -0
  128. /package/dist/{loadResources-Bksk8ydA.mjs → loadResources-BAzJItAJ.mjs} +0 -0
  129. /package/dist/{logger-CDjpjySd.mjs → logger-DLg8-Ueg.mjs} +0 -0
  130. /package/dist/{metrics-TuOmguhi.mjs → metrics-DuhiSEZI.mjs} +0 -0
  131. /package/dist/{pluralize-CWP6MB39.mjs → pluralize-A0tWEl1K.mjs} +0 -0
  132. /package/dist/{registry-B0Wl7uVV.mjs → registry-B3lRFBWo.mjs} +0 -0
  133. /package/dist/{replyHelpers-BLojtuvR.mjs → replyHelpers-CXtJDAZ0.mjs} +0 -0
  134. /package/dist/{requestContext-DYtmNpm5.mjs → requestContext-xHIKedG6.mjs} +0 -0
  135. /package/dist/{sessionManager-D-oNWHz3.d.mts → sessionManager-BkzVU8h2.d.mts} +0 -0
  136. /package/dist/{storage-BwGQXUpd.d.mts → storage-CVk_SEn2.d.mts} +0 -0
  137. /package/dist/{store-helpers-DFiZl5TL.mjs → store-helpers-ZCSMJJAX.mjs} +0 -0
  138. /package/dist/{tracing-xqXzWeaf.d.mts → tracing-65B51Dw3.d.mts} +0 -0
  139. /package/dist/{types-ZUu_h0jp.mjs → types-DV9WDfeg.mjs} +0 -0
@@ -1,7 +1,7 @@
1
- import { $ as PresetHook, G as MiddlewareConfig, Gt as ResourceRegistry, Tn as HookSystem, _t as RouteSchemaOptions, mt as RouteDefinition, p as AnyRecord } from "../interface-YrWsmKqE.mjs";
2
- import { t as ExternalOpenApiPaths } from "../externalPaths-Bapitwvd.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-DixGcttC.mjs";
4
- import { t as TracingOptions } from "../tracing-xqXzWeaf.mjs";
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
 
@@ -1,15 +1,15 @@
1
- import { p as MUTATION_OPERATIONS } from "../constants-Cxde4rpC.mjs";
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-DYtmNpm5.mjs";
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-BjFu7zf1.mjs";
6
- import { t as ResourceRegistry } from "../ResourceRegistry-Dq3_zBQP.mjs";
7
- import { n as caching_default, t as cachingPlugin } from "../caching-CjybdRwx.mjs";
8
- import { n as errorHandlerPlugin, t as defaultIsDuplicateKeyError } from "../errorHandler-CZDW4EXS.mjs";
9
- import { n as metrics_default, t as metricsPlugin } from "../metrics-TuOmguhi.mjs";
10
- import { t as replyHelpersPlugin } from "../replyHelpers-BLojtuvR.mjs";
11
- import { n as sse_default, t as ssePlugin } from "../sse-CJpt7LGI.mjs";
12
- import { n as versioning_default, t as versioningPlugin } from "../versioning-Cm8qoFDg.mjs";
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("onSend", async (request, reply, payload) => {
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-xqXzWeaf.mjs";
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.9.1";
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 { et as PresetResult } from "../interface-YrWsmKqE.mjs";
3
- import { t as PermissionCheck } from "../types-DZi1aYhm.mjs";
4
- import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-BwGQXUpd.mjs";
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-q8oHt--L.mjs";
1
+ import { t as filesUploadPreset } from "../filesUpload-t21LS-py.mjs";
2
2
  export { filesUploadPreset };
@@ -1,4 +1,4 @@
1
- import { Ht as IRequestContext, Vt as IControllerResponse, et as PresetResult, lt as ResourceConfig, on as PaginationResult, p as AnyRecord } from "../interface-YrWsmKqE.mjs";
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";
@@ -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-hM4WhNWY.mjs";
3
- import { t as filesUploadPreset } from "../filesUpload-q8oHt--L.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-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,4 +1,4 @@
1
- import { T as CrudRouteKey, et as PresetResult } from "../interface-YrWsmKqE.mjs";
1
+ import { Q as CrudRouteKey, ot as PresetResult } from "../index-Cl0uoKd5.mjs";
2
2
 
3
3
  //#region src/presets/multiTenant.d.ts
4
4
  /**
@@ -1,4 +1,4 @@
1
- import "../constants-Cxde4rpC.mjs";
1
+ import "../constants-BhY1OHoH.mjs";
2
2
  import { _ as isElevated, c as getRequestScope, f as getTeamId, h as hasOrgAccess, l as getScopeContext, o as getOrgId } from "../types-AOD8fxIw.mjs";
3
3
  //#region src/presets/multiTenant.ts
4
4
  /**
@@ -1,7 +1,94 @@
1
- import { Lt as ControllerHandler, et as PresetResult, gt as RouteMcpConfig, mt as RouteDefinition, o as RepositoryLike } from "../interface-YrWsmKqE.mjs";
2
- import { t as PermissionCheck } from "../types-DZi1aYhm.mjs";
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?: Pick<RepositoryLike, "search" | "searchSimilar" | "embed">;
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 };
@@ -1,4 +1,4 @@
1
- import { n as allowPublic, s as requireAuth } from "../permissions-oNZawnkR.mjs";
1
+ import { C as requireAuth, y as allowPublic } from "../permissions-Dk6mshja.mjs";
2
2
  //#region src/presets/search.ts
3
3
  const BUILTINS = [
4
4
  {
@@ -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 { f as requireRoles, n as allowPublic, s as requireAuth } from "./permissions-oNZawnkR.mjs";
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,4 +1,4 @@
1
- import { i as CacheStore } from "./interface-DplgQO2e.mjs";
1
+ import { r as CacheStore } from "./interface-D218ikEo.mjs";
2
2
  import { FastifyPluginAsync } from "fastify";
3
3
 
4
4
  //#region src/cache/QueryCache.d.ts
@@ -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-BFAYkf8H.mjs";
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 staleTimeMs = (config.staleTime ?? 0) * 1e3;
37
- const totalTtl = staleTimeMs + (config.gcTime ?? 60) * 1e3;
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 + staleTimeMs,
43
- expiresAt: now + totalTtl,
42
+ staleAfter: now + staleTimeSec * 1e3,
43
+ expiresAt: now + totalTtlSec * 1e3,
44
44
  tags: config.tags ?? []
45
45
  };
46
- await this.store.set(key, envelope, { ttlMs: totalTtl });
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, { ttlMs: 1440 * 60 * 1e3 });
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, { ttlMs: 1440 * 60 * 1e3 });
69
+ await this.store.set(key, newVersion, 1440 * 60);
70
70
  }
71
71
  };
72
72
  //#endregion
@@ -1,4 +1,4 @@
1
- import { m as RESERVED_QUERY_PARAMS } from "./constants-Cxde4rpC.mjs";
1
+ import { m as RESERVED_QUERY_PARAMS } from "./constants-BhY1OHoH.mjs";
2
2
  //#region src/utils/queryParser.ts
3
3
  /**
4
4
  * Arc Query Parser - Default URL-to-Query Parser
@@ -1,4 +1,4 @@
1
- import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-B-pe8fhj.mjs";
1
+ import { n as IdempotencyResult, r as IdempotencyStore } from "./interface-CSbZdv_3.mjs";
2
2
 
3
3
  //#region src/idempotency/stores/redis.d.ts
4
4
  interface RedisClient {
@@ -1,4 +1,4 @@
1
- import { i as EventLogger, n as DomainEvent, o as EventTransport, r as EventHandler } from "./EventTransport-CqZ8FyM_.mjs";
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 { Gt as ResourceRegistry, V as IntrospectionPluginOptions, Wt as RegisterOptions } from "../interface-YrWsmKqE.mjs";
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
@@ -1,3 +1,3 @@
1
- import { n as introspectionPlugin_default, t as introspectionPlugin } from "../registry-B0Wl7uVV.mjs";
2
- import { t as ResourceRegistry } from "../ResourceRegistry-Dq3_zBQP.mjs";
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-Vu2yc56T.mjs";
2
- import { n as normalizePermissionResult } from "./applyPermissionResult-bqGpo9ML.mjs";
3
- import { t as pluralize } from "./pluralize-CWP6MB39.mjs";
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
  /**
@@ -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
@@ -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-ZUu_h0jp.mjs";
3
- import { n as elevation_default, t as elevationPlugin } from "../elevation-DxQ6ACbt.mjs";
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-CDjpjySd.mjs";
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({
@@ -1,9 +1,10 @@
1
- import { Kt as ResourceDefinition, Xt as CrudRepository, p as AnyRecord } from "../interface-YrWsmKqE.mjs";
2
- import { d as ResourceLike, r as CreateAppOptions } from "../types-CunEX4UX.mjs";
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 CrudRepository<T> {
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: CrudRepository<AnyRecord>): {
523
- repository: CrudRepository<AnyRecord>;
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>;
@@ -1,5 +1,5 @@
1
- import { t as CRUD_OPERATIONS } from "../constants-Cxde4rpC.mjs";
2
- import { n as applyFieldWritePermissions, t as applyFieldReadPermissions } from "../fields-CU6FlaDV.mjs";
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 this.eagerBaseUrl = `${optionsOrGetter.apiPrefix ?? "/api"}${resource.prefix}`;
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-CBJUJKGP.mjs").then((n) => n.r);
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",
@@ -1,4 +1,4 @@
1
- import { t as Storage } from "../storage-BwGQXUpd.mjs";
1
+ import { t as Storage } from "../storage-CVk_SEn2.mjs";
2
2
 
3
3
  //#region src/testing/storageContract.d.ts
4
4
  interface StorageContractSetupResult {
@@ -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 { $ as PresetHook, $t as DeleteResult, A as FastifyRequestExtras, At as BaseControllerOptions, B as IntrospectionData, Bt as IController, C as ControllerQueryOptions, Ct as UserLike, D as CrudSchemas, Dt as envelope, E as CrudRouterOptions, Et as ValidationResult, F as HealthCheck, G as MiddlewareConfig, H as JWTPayload, Ht as IRequestContext, I as HealthOptions, J as OpenApiSchemas, Jt as BulkWriteOperation, K as MiddlewareHandler, L as InferAdapterDoc, Lt as ControllerHandler, M as FastifyWithDecorators, N as FieldRule, O as EventDefinition, Ot as getUserId, P as GracefulShutdownOptions, Q as PresetFunction, Qt as DeleteOptions, R as InferDocType, Rt as ControllerLike, S as ConfigError, St as TypedResourceConfig, T as CrudRouteKey, Tt as ValidateOptions, U as JwtContext, Ut as RouteHandler, V as IntrospectionPluginOptions, Vt as IControllerResponse, W as LookupOption, X as ParsedQuery, Xt as CrudRepository, Y as OwnershipCheck, Yt as BulkWriteResult, Z as PopulateOption, Zt as DeleteManyResult, _ as ArcRequest, _t as RouteSchemaOptions, an as PaginationParams, at as RequestContext, b as Authenticator, bt as TypedController, cn as RepositorySession, ct as ResourceCacheConfig, d as ActionHandlerFn, dt as ResourceHooks, en as FindOneAndUpdateOptions, et as PresetResult, f as ActionsMap, ft as ResourceMetadata, g as ArcInternalMetadata, gt as RouteMcpConfig, h as ArcDecorator, ht as RouteHandlerMethod, in as PaginatedResult, it as RegistryStats, j as FastifyWithAuth, k as EventsDecorator, l as ActionDefinition, ln as UpdateManyResult, lt as ResourceConfig, m as ApiResponse, mt as RouteDefinition, nn as KeysetPaginatedResult, nt as RateLimitConfig, on as PaginationResult, ot as RequestIdOptions, p as AnyRecord, pt as ResourcePermissions, q as ObjectId, rn as OffsetPaginatedResult, rt as RegistryEntry, sn as QueryOptions, st as RequestWithExtras, tn as InferDoc, tt as QueryParserInterface, u as ActionEntry, un as WriteOptions, ut as ResourceHookContext, v as AuthHelpers, vt as ServiceContext, w as CrudController, wt as UserOrganization, x as AuthenticatorContext, xt as TypedRepository, y as AuthPluginOptions, yt as TokenPair, z as InferResourceDoc, zt as FastifyHandler } from "../interface-YrWsmKqE.mjs";
3
- import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "../types-DZi1aYhm.mjs";
4
- import { n as ElevationOptions, t as ElevationEvent } from "../elevation-B6S5csVA.mjs";
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 };
@@ -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
- //#region src/types/index.ts
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 };
@@ -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-BwGQXUpd.mjs";
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,4 +1,4 @@
1
- import { Kt as ResourceDefinition } from "./interface-YrWsmKqE.mjs";
1
+ import { G as ResourceDefinition } from "./index-Cl0uoKd5.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/integrations/mcp/types.d.ts
@@ -1,12 +1,12 @@
1
- import { b as Authenticator } from "./interface-YrWsmKqE.mjs";
2
- import { n as ElevationOptions } from "./elevation-B6S5csVA.mjs";
3
- import { t as ExternalOpenApiPaths } from "./externalPaths-Bapitwvd.mjs";
4
- import { i as CacheStore } from "./interface-DplgQO2e.mjs";
5
- import { r as QueryCachePluginOptions } from "./queryCachePlugin-CnTZZTC5.mjs";
6
- import { o as EventTransport } from "./EventTransport-CqZ8FyM_.mjs";
7
- import { t as EventPluginOptions } from "./eventPlugin-BxvaCIZF.mjs";
8
- import { a as VersioningOptions, g as CachingOptions, p as SSEOptions, t as ErrorHandlerOptions, u as MetricsOptions } from "./errorHandler-DixGcttC.mjs";
9
- import { r as IdempotencyStore } from "./interface-B-pe8fhj.mjs";
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 };