@classytic/arc 2.10.8 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/{BaseController-DVNKvoX4.mjs → BaseController-JNV08qOT.mjs} +480 -442
  2. package/dist/{queryCachePlugin-Dumka73q.d.mts → QueryCache-DOBNHBE0.d.mts} +2 -32
  3. package/dist/adapters/index.d.mts +2 -2
  4. package/dist/adapters/index.mjs +1 -1
  5. package/dist/{adapters-BXY4i-hw.mjs → adapters-D0tT2Tyo.mjs} +54 -0
  6. package/dist/audit/index.d.mts +1 -1
  7. package/dist/auth/index.d.mts +1 -1
  8. package/dist/auth/index.mjs +5 -5
  9. package/dist/{betterAuthOpenApi--rdY15Ld.mjs → betterAuthOpenApi-DwxtK3uG.mjs} +1 -1
  10. package/dist/cache/index.d.mts +3 -2
  11. package/dist/cache/index.mjs +3 -3
  12. package/dist/cli/commands/docs.mjs +2 -2
  13. package/dist/cli/commands/generate.mjs +37 -27
  14. package/dist/cli/commands/init.mjs +46 -33
  15. package/dist/cli/commands/introspect.mjs +1 -1
  16. package/dist/context/index.mjs +1 -1
  17. package/dist/core/index.d.mts +3 -3
  18. package/dist/core/index.mjs +4 -3
  19. package/dist/core-DXdSSFW-.mjs +1037 -0
  20. package/dist/createActionRouter-BwaSM0No.mjs +166 -0
  21. package/dist/{createApp-BwnEAO2h.mjs → createApp-DvNYEhpb.mjs} +75 -27
  22. package/dist/docs/index.d.mts +1 -1
  23. package/dist/docs/index.mjs +2 -2
  24. package/dist/{elevation-Dci0AYLT.mjs → elevation-DOFoxoDs.mjs} +1 -1
  25. package/dist/{errorHandler-CSxe7KIM.mjs → errorHandler-BQm8ZxTK.mjs} +1 -1
  26. package/dist/{eventPlugin-ByU4Cv0e.mjs → eventPlugin--5HIkdPU.mjs} +1 -1
  27. package/dist/events/index.d.mts +3 -3
  28. package/dist/events/index.mjs +2 -2
  29. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  30. package/dist/factory/index.d.mts +1 -1
  31. package/dist/factory/index.mjs +2 -2
  32. package/dist/hooks/index.d.mts +1 -1
  33. package/dist/hooks/index.mjs +1 -1
  34. package/dist/idempotency/index.d.mts +3 -3
  35. package/dist/idempotency/index.mjs +1 -1
  36. package/dist/idempotency/redis.d.mts +1 -1
  37. package/dist/{index-C_Noptz-.d.mts → index-BYCqHCVu.d.mts} +2 -2
  38. package/dist/{index-BGbpGVyM.d.mts → index-Cm0vUrr_.d.mts} +699 -494
  39. package/dist/{index-BziRPS4H.d.mts → index-DAushRTt.d.mts} +29 -10
  40. package/dist/index-DsJ1MNfC.d.mts +1179 -0
  41. package/dist/{index-EqQN6p0W.d.mts → index-t8pLpPFW.d.mts} +11 -8
  42. package/dist/index.d.mts +6 -38
  43. package/dist/index.mjs +9 -9
  44. package/dist/integrations/event-gateway.d.mts +1 -1
  45. package/dist/integrations/event-gateway.mjs +1 -1
  46. package/dist/integrations/index.d.mts +2 -2
  47. package/dist/integrations/mcp/index.d.mts +2 -2
  48. package/dist/integrations/mcp/index.mjs +1 -1
  49. package/dist/integrations/mcp/testing.d.mts +1 -1
  50. package/dist/integrations/mcp/testing.mjs +1 -1
  51. package/dist/integrations/streamline.d.mts +46 -5
  52. package/dist/integrations/streamline.mjs +50 -21
  53. package/dist/integrations/websocket-redis.d.mts +1 -1
  54. package/dist/integrations/websocket.d.mts +2 -154
  55. package/dist/integrations/websocket.mjs +292 -224
  56. package/dist/{keys-nWQGUTu1.mjs → keys-CARyUjiR.mjs} +2 -0
  57. package/dist/{loadResources-Bksk8ydA.mjs → loadResources-YNwKHvRA.mjs} +3 -1
  58. package/dist/middleware/index.d.mts +1 -1
  59. package/dist/middleware/index.mjs +1 -1
  60. package/dist/{openapi-DpNpqBmo.mjs → openapi-C0L9ar7m.mjs} +4 -4
  61. package/dist/org/index.d.mts +1 -1
  62. package/dist/permissions/index.d.mts +1 -1
  63. package/dist/permissions/index.mjs +2 -4
  64. package/dist/{permissions-wkqRwicB.mjs → permissions-B4vU9L0Q.mjs} +221 -3
  65. package/dist/{pipe-CGJxqDGx.mjs → pipe-DVoIheVC.mjs} +1 -1
  66. package/dist/pipeline/index.d.mts +1 -1
  67. package/dist/pipeline/index.mjs +1 -1
  68. package/dist/plugins/index.d.mts +4 -4
  69. package/dist/plugins/index.mjs +10 -10
  70. package/dist/plugins/response-cache.mjs +1 -1
  71. package/dist/plugins/tracing-entry.d.mts +1 -1
  72. package/dist/plugins/tracing-entry.mjs +42 -24
  73. package/dist/presets/filesUpload.d.mts +1 -1
  74. package/dist/presets/filesUpload.mjs +3 -3
  75. package/dist/presets/index.d.mts +1 -1
  76. package/dist/presets/index.mjs +1 -1
  77. package/dist/presets/multiTenant.d.mts +1 -1
  78. package/dist/presets/multiTenant.mjs +6 -0
  79. package/dist/presets/search.d.mts +1 -1
  80. package/dist/presets/search.mjs +1 -1
  81. package/dist/{presets-CrwOvuXI.mjs → presets-k604Lj99.mjs} +1 -1
  82. package/dist/queryCachePlugin-BUXBSm4F.d.mts +34 -0
  83. package/dist/{queryCachePlugin-ChLNZvFT.mjs → queryCachePlugin-Bq6bO6vc.mjs} +3 -3
  84. package/dist/{redis-MXLp1oOf.d.mts → redis-Cm1gnRDf.d.mts} +1 -1
  85. package/dist/registry/index.d.mts +1 -1
  86. package/dist/registry/index.mjs +2 -2
  87. package/dist/{resourceToTools-BhF3JV5p.mjs → resourceToTools--okX6QBr.mjs} +534 -420
  88. package/dist/routerShared-DeESFp4a.mjs +515 -0
  89. package/dist/schemaIR-BlG9bY7v.mjs +137 -0
  90. package/dist/scope/index.mjs +2 -2
  91. package/dist/testing/index.d.mts +367 -711
  92. package/dist/testing/index.mjs +637 -1434
  93. package/dist/{tracing-xqXzWeaf.d.mts → tracing-DokiEsuz.d.mts} +9 -4
  94. package/dist/types/index.d.mts +3 -3
  95. package/dist/types/index.mjs +1 -3
  96. package/dist/{types-CVdgPXBW.d.mts → types-CgikqKAj.d.mts} +118 -19
  97. package/dist/{types-CVKBssX5.d.mts → types-D9NqiYIw.d.mts} +1 -1
  98. package/dist/utils/index.d.mts +2 -968
  99. package/dist/utils/index.mjs +5 -6
  100. package/dist/utils-D3Yxnrwr.mjs +1639 -0
  101. package/dist/websocket-CyJ1VIFI.d.mts +186 -0
  102. package/package.json +7 -5
  103. package/skills/arc/SKILL.md +123 -38
  104. package/skills/arc/references/testing.md +212 -183
  105. package/dist/applyPermissionResult-QhV1Pa-g.mjs +0 -37
  106. package/dist/core-3MWJosCH.mjs +0 -1459
  107. package/dist/createActionRouter-C8UUB3Px.mjs +0 -249
  108. package/dist/errors-BI8kEKsO.d.mts +0 -140
  109. package/dist/fields-CTMWOUDt.mjs +0 -126
  110. package/dist/queryParser-NR__Qiju.mjs +0 -419
  111. package/dist/types-CDnTEpga.mjs +0 -27
  112. package/dist/utils-LMwVidKy.mjs +0 -947
  113. /package/dist/{HookSystem-BjFu7zf1.mjs → HookSystem-CGsMd6oK.mjs} +0 -0
  114. /package/dist/{ResourceRegistry-CcN2LVrc.mjs → ResourceRegistry-DkAeAuTX.mjs} +0 -0
  115. /package/dist/{actionPermissions-TUVR3uiZ.mjs → actionPermissions-C8YYU92K.mjs} +0 -0
  116. /package/dist/{caching-3h93rkJM.mjs → caching-CheW3m-S.mjs} +0 -0
  117. /package/dist/{errorHandler-2ii4RIYr.d.mts → errorHandler-Co3lnVmJ.d.mts} +0 -0
  118. /package/dist/{errors-BqdUDja_.mjs → errors-D5c-5BJL.mjs} +0 -0
  119. /package/dist/{eventPlugin-D1ThQ1Pp.d.mts → eventPlugin-CUNjYYRY.d.mts} +0 -0
  120. /package/dist/{interface-B-pe8fhj.d.mts → interface-CkkWm5uR.d.mts} +0 -0
  121. /package/dist/{interface-yhyb_pLY.d.mts → interface-Da0r7Lna.d.mts} +0 -0
  122. /package/dist/{memory-DqI-449b.mjs → memory-DikHSvWa.mjs} +0 -0
  123. /package/dist/{metrics-TuOmguhi.mjs → metrics-Csh4nsvv.mjs} +0 -0
  124. /package/dist/{multipartBody-CUQGVlM_.mjs → multipartBody-CvTR1Un6.mjs} +0 -0
  125. /package/dist/{pluralize-CWP6MB39.mjs → pluralize-BneOJkpi.mjs} +0 -0
  126. /package/dist/{redis-stream-bkO88VHx.d.mts → redis-stream-CM8TXTix.d.mts} +0 -0
  127. /package/dist/{registry-B0Wl7uVV.mjs → registry-D63ee7fl.mjs} +0 -0
  128. /package/dist/{replyHelpers-BLojtuvR.mjs → replyHelpers-ByllIXXV.mjs} +0 -0
  129. /package/dist/{requestContext-C38GskNt.mjs → requestContext-CfRkaxwf.mjs} +0 -0
  130. /package/dist/{schemaConverter-BxFDdtXu.mjs → schemaConverter-B0oKLuqI.mjs} +0 -0
  131. /package/dist/{sse-D8UeDwis.mjs → sse-V7aXc3bW.mjs} +0 -0
  132. /package/dist/{store-helpers-DYYUQbQN.mjs → store-helpers-BhrzxvyQ.mjs} +0 -0
  133. /package/dist/{typeGuards-Cj5Rgvlg.mjs → typeGuards-CcFZXgU7.mjs} +0 -0
  134. /package/dist/{types-D57iXYb8.mjs → types-DV9WDfeg.mjs} +0 -0
  135. /package/dist/{versioning-B6mimogM.mjs → versioning-CGPjkqAg.mjs} +0 -0
  136. /package/dist/{versioning-CeUXHfjw.d.mts → versioning-M9lNLhO8.d.mts} +0 -0
@@ -1,4 +1,5 @@
1
1
  import { FastifyInstance, FastifyRequest } from "fastify";
2
+ import { Span, Tracer } from "@opentelemetry/api";
2
3
 
3
4
  //#region src/plugins/tracing.d.ts
4
5
  interface TracingOptions {
@@ -28,8 +29,8 @@ interface TracingOptions {
28
29
  sampleRate?: number;
29
30
  }
30
31
  interface TracerContext {
31
- tracer: any;
32
- currentSpan: any;
32
+ tracer: Tracer;
33
+ currentSpan: Span;
33
34
  }
34
35
  declare module "fastify" {
35
36
  interface FastifyRequest {
@@ -53,7 +54,7 @@ declare function tracingPlugin(fastify: FastifyInstance, options?: TracingOption
53
54
  * });
54
55
  * }
55
56
  */
56
- declare function createSpan<T>(request: FastifyRequest, name: string, fn: (span: any) => Promise<T>, attributes?: Record<string, any>): Promise<T>;
57
+ declare function createSpan<T>(request: FastifyRequest, name: string, fn: (span: Span | null) => Promise<T>, attributes?: Record<string, string | number | boolean>): Promise<T>;
57
58
  /**
58
59
  * Decorator to automatically trace repository methods
59
60
  *
@@ -65,7 +66,11 @@ declare function createSpan<T>(request: FastifyRequest, name: string, fn: (span:
65
66
  * }
66
67
  * }
67
68
  */
68
- declare function traced(spanName?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
69
+ declare function traced(spanName?: string): (target: {
70
+ constructor: {
71
+ name: string;
72
+ };
73
+ }, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
69
74
  /**
70
75
  * Check if OpenTelemetry is available
71
76
  */
@@ -1,5 +1,5 @@
1
- import { $t as ObjectId, A as RequestIdOptions, At as FastifyHandler, C as RequestContext, Ct as ResourcePermissions, D as HealthCheck, Dt as RouteSchemaOptions, E as GracefulShutdownOptions, Et as RouteMethod, F as FastifyWithDecorators, Gt as Authenticator, I as MiddlewareHandler, Jt as TokenPair, Kt as AuthenticatorContext, L as RequestWithExtras, M as EventsDecorator, Mt as IControllerResponse, N as FastifyRequestExtras, Nt as IRequestContext, O as HealthOptions, Ot as ControllerHandler, P as FastifyWithAuth, Pt as RouteHandler, Qt as JWTPayload, S as QueryParserInterface, St as ResourceHooks, T as CrudRouterOptions, Tt as RouteMcpConfig, Ut as AuthHelpers, Wt as AuthPluginOptions, Xt as ApiResponse, Yt as AnyRecord, Zt as ArcRequest, _ as ControllerQueryOptions, _t as PresetResult, a as InferAdapterDoc, an as BaseControllerOptions, at as ActionEntry, b as ParsedQuery, bt as ResourceConfig, c as TypedController, ct as CrudController, d as PaginationResult, dt as EventDefinition, en as UserLike, f as IntrospectionData, ft as FieldRule, g as ArcInternalMetadata, gt as PresetHook, h as ResourceMetadata, ht as PresetFunction, i as ValidationResult, it as ActionDefinition, j as ArcDecorator, jt as IController, k as IntrospectionPluginOptions, kt as ControllerLike, l as TypedRepository, lt as CrudRouteKey, m as RegistryStats, mt as OpenApiSchemas, n as ConfigError, nn as envelope, o as InferDocType, ot as ActionHandlerFn, p as RegistryEntry, pt as MiddlewareConfig, qt as JwtContext, r as ValidateOptions, rn as getUserId, s as InferResourceDoc, st as ActionsMap, t as RouteHandlerMethod, tn as UserOrganization, u as TypedResourceConfig, ut as CrudSchemas, v as LookupOption, vt as RateLimitConfig, w as ServiceContext, wt as RouteDefinition, x as PopulateOption, xt as ResourceHookContext, y as OwnershipCheck, yt as ResourceCacheConfig } from "../index-BGbpGVyM.mjs";
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-tgR4Pt8F.mjs";
1
+ import { $ as OpenApiSchemas, A as RequestIdOptions, At as Authenticator, Bt as UserOrganization, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, Ft as ApiResponse, G as ActionsMap, H as ActionDefinition, I as MiddlewareHandler, It as ArcRequest, J as CrudRouteKey, K as ArcFieldRule, L as RequestWithExtras, Lt as JWTPayload, M as EventsDecorator, Mt as JwtContext, N as FastifyRequestExtras, Nt as TokenPair, O as HealthOptions, Ot as AuthHelpers, P as FastifyWithAuth, Pt as AnyRecord, Q as MiddlewareConfig, Rt as ObjectId, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, W as ActionHandlerFn, X as EventDefinition, Y as CrudSchemas, Z as FieldRule, _ as ControllerQueryOptions, _t as IControllerResponse, a as InferAdapterDoc, at as ResourceConfig, b as ParsedQuery, c as TypedController, ct as ResourcePermissions, d as PaginationResult, dt as RouteMethod, et as PresetFunction, f as IntrospectionData, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, ht as FastifyHandler, i as ValidationResult, it as ResourceCacheConfig, j as ArcDecorator, jt as AuthenticatorContext, k as IntrospectionPluginOptions, kt as AuthPluginOptions, l as TypedRepository, lt as RouteDefinition, m as RegistryStats, mt as ControllerLike, n as ConfigError, nt as PresetResult, o as InferDocType, ot as ResourceHookContext, p as RegistryEntry, pt as ControllerHandler, q as CrudController, r as ValidateOptions, rt as RateLimitConfig, s as InferResourceDoc, st as ResourceHooks, t as RouteHandlerMethod, tn as BaseControllerOptions, tt as PresetHook, u as TypedResourceConfig, ut as RouteMcpConfig, v as LookupOption, vt as IRequestContext, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, yt as RouteHandler, zt as UserLike } from "../index-Cm0vUrr_.mjs";
2
+ import { r as RequestScope } from "../types-tgR4Pt8F.mjs";
3
3
  import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-C8Y0XLAu.mjs";
4
4
  import { n as ElevationOptions, t as ElevationEvent } from "../elevation-s5ykdNHr.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 };
5
+ export { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcFieldRule, 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, 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 };
@@ -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
- import { n as getUserId, t as envelope } from "../types-CDnTEpga.mjs";
3
- export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, envelope, getOrgId, getOrgRoles, getTeamId, getUserId, hasOrgAccess, isAuthenticated, isElevated, isMember };
1
+ export {};
@@ -1,13 +1,13 @@
1
- import { Gt as Authenticator } from "./index-BGbpGVyM.mjs";
1
+ import { At as Authenticator } from "./index-Cm0vUrr_.mjs";
2
+ import { r as CacheStore } from "./interface-Da0r7Lna.mjs";
2
3
  import { n as ElevationOptions } from "./elevation-s5ykdNHr.mjs";
3
4
  import { o as EventTransport } from "./EventTransport-CfVEGaEl.mjs";
4
5
  import { t as ExternalOpenApiPaths } from "./externalPaths-Bapitwvd.mjs";
5
- import { r as CacheStore } from "./interface-yhyb_pLY.mjs";
6
- import { r as QueryCachePluginOptions } from "./queryCachePlugin-Dumka73q.mjs";
7
- import { t as EventPluginOptions } from "./eventPlugin-D1ThQ1Pp.mjs";
8
- import { f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-CeUXHfjw.mjs";
9
- import { t as ErrorHandlerOptions } from "./errorHandler-2ii4RIYr.mjs";
10
- import { r as IdempotencyStore } from "./interface-B-pe8fhj.mjs";
6
+ import { r as QueryCachePluginOptions } from "./queryCachePlugin-BUXBSm4F.mjs";
7
+ import { t as EventPluginOptions } from "./eventPlugin-CUNjYYRY.mjs";
8
+ import { f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-M9lNLhO8.mjs";
9
+ import { t as ErrorHandlerOptions } from "./errorHandler-Co3lnVmJ.mjs";
10
+ import { r as IdempotencyStore } from "./interface-CkkWm5uR.mjs";
11
11
  import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
12
12
 
13
13
  //#region src/factory/loadResources.d.ts
@@ -653,18 +653,70 @@ interface CreateAppOptions {
653
653
  */
654
654
  serializeBigInt?: boolean;
655
655
  /**
656
- * Resources to register automatically.
657
- * Each resource's `.toPlugin()` is called and registered for you.
656
+ * Resources to register automatically. Accepts two shapes:
658
657
  *
659
- * @example
658
+ * 1. **Array** — each resource's `.toPlugin()` is called and registered.
659
+ * Defined at module-import time, so the resource's adapter must be
660
+ * constructible without any async state.
661
+ *
662
+ * 2. **Factory function** (sync or async) — called AFTER `bootstrap[]`
663
+ * but BEFORE routes are wired. Use this when a resource's adapter
664
+ * depends on an engine / singleton that boots asynchronously
665
+ * (e.g. `await ensureCatalogEngine()` / `await createFlowEngine()`).
666
+ * The factory receives the Fastify instance for symmetry with
667
+ * `plugins` and `bootstrap`.
668
+ *
669
+ * Arc's lifecycle contract:
670
+ * ```
671
+ * 1. Arc core (security, auth, events)
672
+ * 2. plugins() ← infra (DB, SSE, docs)
673
+ * 3. bootstrap[] ← domain init (engines, singletons)
674
+ * 4. resources resolution ← (factory form: call it here)
675
+ * 5. resources registered ← plugins mounted on Fastify
676
+ * 6. afterResources() ← post-registration wiring
677
+ * ```
678
+ *
679
+ * The factory form is the canonical answer to "my repository lives in an
680
+ * engine that boots asynchronously." Before this shape existed, hosts had
681
+ * to write per-resource lazy-bridge adapters that awaited the engine on
682
+ * every CRUD call — pure boilerplate. With a factory, `defineResource(...)`
683
+ * runs with the engine already live, so `createMongooseAdapter(engine.models.X, engine.repositories.X)`
684
+ * works directly.
685
+ *
686
+ * @example Static array (most resources)
660
687
  * ```ts
661
688
  * const app = await createApp({
662
689
  * resources: [productResource, orderResource, userResource],
663
690
  * auth: { type: 'jwt', jwt: { secret: 'xxx' } },
664
691
  * });
665
692
  * ```
693
+ *
694
+ * @example Factory with async-booted engine
695
+ * ```ts
696
+ * const app = await createApp({
697
+ * bootstrap: [async () => { await ensureCatalogEngine(); }],
698
+ * resources: async () => {
699
+ * const cat = await ensureCatalogEngine();
700
+ * return [
701
+ * defineResource({
702
+ * name: 'product',
703
+ * adapter: createMongooseAdapter(cat.models.Product, cat.repositories.product),
704
+ * // ...
705
+ * }),
706
+ * ];
707
+ * },
708
+ * });
709
+ * ```
710
+ *
711
+ * @example Factory delegating to auto-discovery
712
+ * ```ts
713
+ * const app = await createApp({
714
+ * bootstrap: [async () => { await ensureCatalogEngine(); }],
715
+ * resources: async () => loadResources(import.meta.url),
716
+ * });
717
+ * ```
666
718
  */
667
- resources?: Array<ResourceLike>;
719
+ resources?: ReadonlyArray<ResourceLike> | ((fastify: FastifyInstance) => ReadonlyArray<ResourceLike> | Promise<ReadonlyArray<ResourceLike>>);
668
720
  /**
669
721
  * URL prefix for all auto-registered resources.
670
722
  * Applied only to resources in the `resources` array — not to `plugins()`.
@@ -681,25 +733,72 @@ interface CreateAppOptions {
681
733
  resourcePrefix?: string;
682
734
  /**
683
735
  * Auto-discover resources from a directory instead of passing an explicit
684
- * `resources` array. Resolves relative to `process.cwd()`.
736
+ * `resources` array.
685
737
  *
686
- * This replaces the common pattern:
687
- * ```ts
688
- * resources: await loadResources(import.meta.url)
689
- * ```
738
+ * Accepts either a filesystem path OR `import.meta.url` (a `file://` URL).
739
+ * **Prefer the URL form in production** — bare strings resolve relative to
740
+ * `process.cwd()`, which diverges from `dist/` at runtime and was the root
741
+ * cause of a reported "deployed app serves 404 on every route" incident.
690
742
  *
691
- * When both `resourceDir` and `resources` are provided, `resources` wins
692
- * (explicit always beats convention).
743
+ * When both `resourceDir` and `resources` are provided, `resources` wins
744
+ * explicit always beats convention, **including an explicit empty array**.
745
+ * `resources: []` disables resource registration entirely even with
746
+ * `resourceDir` set, which is the common case for shared base configs
747
+ * that turn resource loading off in test / CLI / health-check subprocesses.
748
+ * Auto-discovery from `resourceDir` fires only when `resources` is
749
+ * `undefined` (absent).
693
750
  *
694
751
  * @example
695
752
  * ```ts
753
+ * // Recommended (v2.10.9+): URL form works in both src/ and dist/
696
754
  * const app = await createApp({
697
- * resourceDir: 'src/resources',
755
+ * resourceDir: import.meta.url,
698
756
  * resourcePrefix: '/api/v1',
699
757
  * });
758
+ *
759
+ * // String form — resolves against process.cwd(), mind the dist/ gap
760
+ * const app = await createApp({
761
+ * resourceDir: 'src/resources',
762
+ * });
700
763
  * ```
701
764
  */
702
765
  resourceDir?: string;
766
+ /**
767
+ * Throw instead of silently booting with zero resources when `resourceDir`
768
+ * yields an empty result. Off by default to preserve back-compat — turning
769
+ * it on in production catches the "typoed path / stale dist/ layout"
770
+ * failure mode before the app accepts traffic.
771
+ *
772
+ * Only takes effect when `resourceDir` is set.
773
+ *
774
+ * @example
775
+ * ```ts
776
+ * await createApp({
777
+ * resourceDir: import.meta.url,
778
+ * strictResourceDir: process.env.NODE_ENV === 'production',
779
+ * });
780
+ * ```
781
+ *
782
+ * @default false
783
+ */
784
+ strictResourceDir?: boolean;
785
+ /**
786
+ * Throw instead of warn when two resources share the same `name`. Off by
787
+ * default to preserve back-compat; turn on in production to catch stale
788
+ * `dist/` files (a common source of `Mongoose model already exists`
789
+ * collisions downstream of arc's own registry).
790
+ *
791
+ * @example
792
+ * ```ts
793
+ * await createApp({
794
+ * resources: await loadResources(import.meta.url),
795
+ * strictResources: process.env.NODE_ENV === 'production',
796
+ * });
797
+ * ```
798
+ *
799
+ * @default false
800
+ */
801
+ strictResources?: boolean;
703
802
  /**
704
803
  * Custom plugin registration — runs after Arc core (security, auth, events)
705
804
  * but before `bootstrap` and `resources`.
@@ -1,4 +1,4 @@
1
- import { B as ResourceDefinition } from "./index-BGbpGVyM.mjs";
1
+ import { B as ResourceDefinition } from "./index-Cm0vUrr_.mjs";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region src/integrations/mcp/types.d.ts