@classytic/arc 2.2.5 → 2.4.1

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 (174) hide show
  1. package/README.md +187 -18
  2. package/bin/arc.js +11 -3
  3. package/dist/BaseController-CkM5dUh_.mjs +1031 -0
  4. package/dist/{EventTransport-BkUDYZEb.d.mts → EventTransport-wc5hSLik.d.mts} +1 -1
  5. package/dist/{HookSystem-BsGV-j2l.mjs → HookSystem-COkyWztM.mjs} +2 -3
  6. package/dist/{ResourceRegistry-7Ic20ZMw.mjs → ResourceRegistry-DeCIFlix.mjs} +8 -5
  7. package/dist/adapters/index.d.mts +3 -5
  8. package/dist/adapters/index.mjs +2 -3
  9. package/dist/{prisma-DJbMt3yf.mjs → adapters-DTC4Ug66.mjs} +45 -12
  10. package/dist/audit/index.d.mts +4 -7
  11. package/dist/audit/index.mjs +2 -29
  12. package/dist/audit/mongodb.d.mts +1 -4
  13. package/dist/audit/mongodb.mjs +2 -3
  14. package/dist/auth/index.d.mts +7 -9
  15. package/dist/auth/index.mjs +65 -63
  16. package/dist/auth/redis-session.d.mts +1 -1
  17. package/dist/auth/redis-session.mjs +1 -2
  18. package/dist/{betterAuthOpenApi-DjWDddNc.mjs → betterAuthOpenApi-lz0IRbXJ.mjs} +4 -6
  19. package/dist/cache/index.d.mts +23 -23
  20. package/dist/cache/index.mjs +4 -6
  21. package/dist/{caching-GSDJcA6-.mjs → caching-BSXB-Xr7.mjs} +2 -24
  22. package/dist/chunk-BpYLSNr0.mjs +14 -0
  23. package/dist/circuitBreaker-BOBOpN2w.mjs +284 -0
  24. package/dist/circuitBreaker-JP2GdJ4b.d.mts +206 -0
  25. package/dist/cli/commands/describe.mjs +24 -7
  26. package/dist/cli/commands/docs.mjs +6 -7
  27. package/dist/cli/commands/doctor.d.mts +10 -0
  28. package/dist/cli/commands/doctor.mjs +156 -0
  29. package/dist/cli/commands/generate.mjs +66 -17
  30. package/dist/cli/commands/init.mjs +315 -45
  31. package/dist/cli/commands/introspect.mjs +2 -4
  32. package/dist/cli/index.d.mts +1 -10
  33. package/dist/cli/index.mjs +4 -153
  34. package/dist/{constants-DdXFXQtN.mjs → constants-Cxde4rpC.mjs} +1 -2
  35. package/dist/core/index.d.mts +3 -5
  36. package/dist/core/index.mjs +5 -4
  37. package/dist/core-C1XCMtqM.mjs +185 -0
  38. package/dist/{createApp-BKHSl2nT.mjs → createApp-ByWNRsZj.mjs} +65 -36
  39. package/dist/{defineResource-DO9ONe_D.mjs → defineResource-D9aY5Cy6.mjs} +154 -1165
  40. package/dist/discovery/index.mjs +37 -5
  41. package/dist/docs/index.d.mts +6 -9
  42. package/dist/docs/index.mjs +3 -21
  43. package/dist/dynamic/index.d.mts +93 -0
  44. package/dist/dynamic/index.mjs +122 -0
  45. package/dist/{elevation-DSTbVvYj.mjs → elevation-BEdACOLB.mjs} +5 -36
  46. package/dist/{elevation-DGo5shaX.d.mts → elevation-Ca_yveIO.d.mts} +41 -7
  47. package/dist/{errorHandler-C3GY3_ow.mjs → errorHandler--zp54tGc.mjs} +3 -5
  48. package/dist/errorHandler-Do4vVQ1f.d.mts +139 -0
  49. package/dist/{errors-DBANPbGr.mjs → errors-rxhfP7Hf.mjs} +1 -2
  50. package/dist/{eventPlugin-BEOvaDqo.mjs → eventPlugin-Ba00swHF.mjs} +25 -27
  51. package/dist/{eventPlugin-H6wDDjGO.d.mts → eventPlugin-iGrSEmwJ.d.mts} +105 -5
  52. package/dist/events/index.d.mts +72 -7
  53. package/dist/events/index.mjs +216 -4
  54. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  55. package/dist/events/transports/redis-stream-entry.mjs +19 -7
  56. package/dist/events/transports/redis.d.mts +1 -1
  57. package/dist/events/transports/redis.mjs +3 -4
  58. package/dist/factory/index.d.mts +23 -9
  59. package/dist/factory/index.mjs +48 -3
  60. package/dist/{fields-Bi_AVKSo.d.mts → fields-DFwdaWCq.d.mts} +1 -1
  61. package/dist/{fields-CTd_CrKr.mjs → fields-ipsbIRPK.mjs} +1 -2
  62. package/dist/hooks/index.d.mts +1 -3
  63. package/dist/hooks/index.mjs +2 -3
  64. package/dist/idempotency/index.d.mts +5 -5
  65. package/dist/idempotency/index.mjs +3 -7
  66. package/dist/idempotency/mongodb.d.mts +1 -1
  67. package/dist/idempotency/mongodb.mjs +4 -5
  68. package/dist/idempotency/redis.d.mts +1 -1
  69. package/dist/idempotency/redis.mjs +2 -5
  70. package/dist/{fastifyAdapter-CyAA2zlB.d.mts → index-BL8CaQih.d.mts} +56 -57
  71. package/dist/index-Diqcm14c.d.mts +369 -0
  72. package/dist/{prisma-xjhMEq_S.d.mts → index-yhxyjqNb.d.mts} +4 -5
  73. package/dist/index.d.mts +100 -105
  74. package/dist/index.mjs +85 -58
  75. package/dist/integrations/event-gateway.d.mts +1 -1
  76. package/dist/integrations/event-gateway.mjs +8 -4
  77. package/dist/integrations/index.d.mts +4 -2
  78. package/dist/integrations/index.mjs +1 -1
  79. package/dist/integrations/jobs.d.mts +2 -2
  80. package/dist/integrations/jobs.mjs +63 -14
  81. package/dist/integrations/mcp/index.d.mts +219 -0
  82. package/dist/integrations/mcp/index.mjs +572 -0
  83. package/dist/integrations/mcp/testing.d.mts +53 -0
  84. package/dist/integrations/mcp/testing.mjs +104 -0
  85. package/dist/integrations/streamline.mjs +39 -19
  86. package/dist/integrations/webhooks.d.mts +56 -0
  87. package/dist/integrations/webhooks.mjs +139 -0
  88. package/dist/integrations/websocket-redis.d.mts +46 -0
  89. package/dist/integrations/websocket-redis.mjs +50 -0
  90. package/dist/integrations/websocket.d.mts +68 -2
  91. package/dist/integrations/websocket.mjs +96 -13
  92. package/dist/{interface-CSNjltAc.d.mts → interface-B4awm1RJ.d.mts} +2 -2
  93. package/dist/interface-DGmPxakH.d.mts +2213 -0
  94. package/dist/{keys-DhqDRxv3.mjs → keys-qcD-TVJl.mjs} +3 -4
  95. package/dist/{logger-ByrvQWZO.mjs → logger-Dz3j1ItV.mjs} +2 -4
  96. package/dist/{memory-B2v7KrCB.mjs → memory-Cb_7iy9e.mjs} +2 -4
  97. package/dist/metrics-Csh4nsvv.mjs +224 -0
  98. package/dist/migrations/index.mjs +3 -7
  99. package/dist/{mongodb-DNKEExbf.mjs → mongodb-BuQ7fNTg.mjs} +1 -4
  100. package/dist/{mongodb-ClykrfGo.d.mts → mongodb-CUpYfxfD.d.mts} +2 -3
  101. package/dist/{mongodb-Dg8O_gvd.d.mts → mongodb-bga9AbkD.d.mts} +2 -2
  102. package/dist/{openapi-9nB_kiuR.mjs → openapi-CBmZ6EQN.mjs} +4 -21
  103. package/dist/org/index.d.mts +12 -14
  104. package/dist/org/index.mjs +92 -119
  105. package/dist/org/types.d.mts +2 -2
  106. package/dist/org/types.mjs +1 -1
  107. package/dist/permissions/index.d.mts +4 -278
  108. package/dist/permissions/index.mjs +4 -579
  109. package/dist/permissions-CA5zg0yK.mjs +751 -0
  110. package/dist/plugins/index.d.mts +104 -107
  111. package/dist/plugins/index.mjs +203 -313
  112. package/dist/plugins/response-cache.mjs +4 -69
  113. package/dist/plugins/tracing-entry.d.mts +1 -1
  114. package/dist/plugins/tracing-entry.mjs +24 -11
  115. package/dist/{pluralize-CM-jZg7p.mjs → pluralize-CcT6qF0a.mjs} +12 -13
  116. package/dist/policies/index.d.mts +2 -2
  117. package/dist/policies/index.mjs +80 -83
  118. package/dist/presets/index.d.mts +26 -19
  119. package/dist/presets/index.mjs +2 -142
  120. package/dist/presets/multiTenant.d.mts +1 -4
  121. package/dist/presets/multiTenant.mjs +4 -6
  122. package/dist/presets-C9QXJV1u.mjs +422 -0
  123. package/dist/{queryCachePlugin-B6R0d4av.mjs → queryCachePlugin-ClosZdNS.mjs} +6 -27
  124. package/dist/{queryCachePlugin-Q6SYuHZ6.d.mts → queryCachePlugin-DcmETvcB.d.mts} +3 -3
  125. package/dist/queryParser-CgCtsjti.mjs +352 -0
  126. package/dist/{redis-UwjEp8Ea.d.mts → redis-CQ5YxMC5.d.mts} +2 -2
  127. package/dist/{redis-stream-CBg0upHI.d.mts → redis-stream-BW9UKLZM.d.mts} +9 -2
  128. package/dist/registry/index.d.mts +1 -4
  129. package/dist/registry/index.mjs +3 -4
  130. package/dist/{introspectionPlugin-B3JkrjwU.mjs → registry-I-ogLgL9.mjs} +1 -8
  131. package/dist/{requestContext-xi6OKBL-.mjs → requestContext-DYtmNpm5.mjs} +1 -3
  132. package/dist/resourceToTools-B6ZN9Ing.mjs +489 -0
  133. package/dist/rpc/index.d.mts +90 -0
  134. package/dist/rpc/index.mjs +248 -0
  135. package/dist/{schemaConverter-Dtg0Kt9T.mjs → schemaConverter-DjzHpFam.mjs} +1 -2
  136. package/dist/schemas/index.d.mts +30 -30
  137. package/dist/schemas/index.mjs +4 -6
  138. package/dist/scope/index.d.mts +13 -2
  139. package/dist/scope/index.mjs +18 -5
  140. package/dist/{sessionManager-D_iEHjQl.d.mts → sessionManager-wbkYj2HL.d.mts} +2 -2
  141. package/dist/{sse-DkqQ1uxb.mjs → sse-BkViJPlT.mjs} +4 -25
  142. package/dist/testing/index.d.mts +551 -567
  143. package/dist/testing/index.mjs +1744 -1799
  144. package/dist/{tracing-8CEbhF0w.d.mts → tracing-bz_U4EM1.d.mts} +6 -1
  145. package/dist/{typeGuards-DwxA1t_L.mjs → typeGuards-Cj5Rgvlg.mjs} +1 -2
  146. package/dist/types/index.d.mts +4 -946
  147. package/dist/types/index.mjs +2 -4
  148. package/dist/types-BJmgxNbF.d.mts +275 -0
  149. package/dist/{types-RLkFVgaw.d.mts → types-BNUccdcf.d.mts} +2 -2
  150. package/dist/{types-Beqn1Un7.mjs → types-C6TQjtdi.mjs} +30 -2
  151. package/dist/{types-DMSBMkaZ.d.mts → types-Dt0-AI6E.d.mts} +85 -27
  152. package/dist/{types-DelU6kln.mjs → types-ZUu_h0jp.mjs} +1 -2
  153. package/dist/utils/index.d.mts +255 -352
  154. package/dist/utils/index.mjs +7 -6
  155. package/dist/utils-Dc0WhlIl.mjs +594 -0
  156. package/dist/versioning-BzfeHmhj.mjs +37 -0
  157. package/package.json +46 -12
  158. package/skills/arc/SKILL.md +506 -0
  159. package/skills/arc/references/auth.md +250 -0
  160. package/skills/arc/references/events.md +272 -0
  161. package/skills/arc/references/integrations.md +385 -0
  162. package/skills/arc/references/mcp.md +386 -0
  163. package/skills/arc/references/production.md +610 -0
  164. package/skills/arc/references/testing.md +183 -0
  165. package/dist/audited-CGdLiSlE.mjs +0 -140
  166. package/dist/chunk-C7Uep-_p.mjs +0 -20
  167. package/dist/circuitBreaker-DYhWBW_D.mjs +0 -1096
  168. package/dist/errorHandler-CW3OOeYq.d.mts +0 -72
  169. package/dist/interface-DZYNK9bb.d.mts +0 -1112
  170. package/dist/presets-BTeYbw7h.d.mts +0 -57
  171. package/dist/presets-CeFtfDR8.mjs +0 -119
  172. /package/dist/{errors-DAWRdiYP.d.mts → errors-CPpvPHT0.d.mts} +0 -0
  173. /package/dist/{externalPaths-SyPF2tgK.d.mts → externalPaths-DpO-s7r8.d.mts} +0 -0
  174. /package/dist/{interface-DTbsvIWe.d.mts → interface-D_BWALyZ.d.mts} +0 -0
@@ -0,0 +1,369 @@
1
+ import { n as PermissionContext, t as PermissionCheck } from "./types-BNUccdcf.mjs";
2
+ import { i as CacheStore, t as CacheLogger } from "./interface-D_BWALyZ.mjs";
3
+
4
+ //#region src/permissions/roleHierarchy.d.ts
5
+ /**
6
+ * Role Hierarchy — Composable RBAC Inheritance
7
+ *
8
+ * Expands roles based on an inheritance map. Apply at scope-building time
9
+ * so that requireRoles() works with the already-expanded list.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { createRoleHierarchy } from '@classytic/arc/permissions';
14
+ *
15
+ * const hierarchy = createRoleHierarchy({
16
+ * superadmin: ['admin'],
17
+ * admin: ['branch_manager'],
18
+ * branch_manager: ['member'],
19
+ * });
20
+ *
21
+ * // When building scope:
22
+ * const expandedRoles = hierarchy.expand(user.roles);
23
+ * // ['superadmin'] → ['superadmin', 'admin', 'branch_manager', 'member']
24
+ *
25
+ * // Check inclusion:
26
+ * hierarchy.includes(['admin'], 'branch_manager'); // true (admin inherits branch_manager)
27
+ * hierarchy.includes(['member'], 'admin'); // false (child doesn't inherit parent)
28
+ * ```
29
+ */
30
+ interface RoleHierarchy {
31
+ /** Expand roles to include all inherited (child) roles. Deduplicated. */
32
+ expand(roles: readonly string[]): string[];
33
+ /** Check if any of the user's roles (expanded) include the required role. */
34
+ includes(userRoles: readonly string[], requiredRole: string): boolean;
35
+ }
36
+ /**
37
+ * Create a role hierarchy from a parent → children map.
38
+ *
39
+ * Each key is a parent role, each value is the array of roles it inherits.
40
+ * Inheritance is transitive: if A → B and B → C, then A expands to [A, B, C].
41
+ * Circular references are handled safely (visited set).
42
+ */
43
+ declare function createRoleHierarchy(map: Record<string, readonly string[]>): RoleHierarchy;
44
+ declare namespace presets_d_exports {
45
+ export { adminOnly, authenticated, fullPublic, ownerWithAdminBypass, publicRead, publicReadAdminWrite, readOnly };
46
+ }
47
+ /**
48
+ * ResourcePermissions shape — matches the type in types/index.ts
49
+ */
50
+ interface ResourcePermissions<TDoc = any> {
51
+ list?: PermissionCheck<TDoc>;
52
+ get?: PermissionCheck<TDoc>;
53
+ create?: PermissionCheck<TDoc>;
54
+ update?: PermissionCheck<TDoc>;
55
+ delete?: PermissionCheck<TDoc>;
56
+ }
57
+ type PermissionOverrides<TDoc = any> = Partial<ResourcePermissions<TDoc>>;
58
+ /**
59
+ * Public read, authenticated write.
60
+ * list + get = allowPublic(), create + update + delete = requireAuth()
61
+ */
62
+ declare function publicRead<TDoc = any>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
63
+ /**
64
+ * Public read, admin write.
65
+ * list + get = allowPublic(), create + update + delete = requireRoles(['admin'])
66
+ */
67
+ declare function publicReadAdminWrite<TDoc = any>(roles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
68
+ /**
69
+ * All operations require authentication.
70
+ */
71
+ declare function authenticated<TDoc = any>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
72
+ /**
73
+ * All operations require specific roles.
74
+ * @param roles - Required roles (user needs at least one). Default: ['admin']
75
+ */
76
+ declare function adminOnly<TDoc = any>(roles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
77
+ /**
78
+ * Owner-scoped with admin bypass.
79
+ * list = auth (scoped to owner), get = auth, create = auth,
80
+ * update + delete = ownership check with admin bypass.
81
+ *
82
+ * @param ownerField - Field containing owner ID (default: 'userId')
83
+ * @param bypassRoles - Roles that bypass ownership check (default: ['admin'])
84
+ */
85
+ declare function ownerWithAdminBypass<TDoc = any>(ownerField?: Extract<keyof TDoc, string> | string, bypassRoles?: readonly string[], overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
86
+ /**
87
+ * Full public access — no auth required for any operation.
88
+ * Use sparingly (dev/testing, truly public APIs).
89
+ */
90
+ declare function fullPublic<TDoc = any>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
91
+ /**
92
+ * Read-only: list + get authenticated, write operations denied.
93
+ * Useful for computed/derived resources.
94
+ */
95
+ declare function readOnly<TDoc = any>(overrides?: PermissionOverrides<TDoc>): ResourcePermissions<TDoc>;
96
+ //#endregion
97
+ //#region src/permissions/index.d.ts
98
+ interface DynamicPermissionMatrixConfig {
99
+ /**
100
+ * Resolve role → resource → actions map dynamically (DB/API/config service).
101
+ * Called at permission-check time (or cache miss if cache enabled).
102
+ */
103
+ resolveRolePermissions: (ctx: PermissionContext) => Record<string, Record<string, readonly string[]>> | Promise<Record<string, Record<string, readonly string[]>>>;
104
+ /**
105
+ * Optional cache store adapter.
106
+ * Use MemoryCacheStore for single-instance apps or RedisCacheStore for distributed setups.
107
+ */
108
+ cacheStore?: CacheStore<Record<string, Record<string, readonly string[]>>>;
109
+ /** Optional logger for cache/runtime failures (default: console) */
110
+ logger?: CacheLogger;
111
+ /**
112
+ * Legacy convenience in-memory cache config.
113
+ * If `cacheStore` is not provided and ttlMs > 0, Arc creates an internal MemoryCacheStore.
114
+ */
115
+ cache?: {
116
+ /** Cache TTL in milliseconds */ttlMs: number; /** Optional custom cache key builder */
117
+ key?: (ctx: PermissionContext) => string | null | undefined; /** Hard entry cap for internal memory store (default: 1000) */
118
+ maxEntries?: number;
119
+ };
120
+ }
121
+ /** Minimal publish/subscribe interface for cross-node cache invalidation. */
122
+ interface PermissionEventBus {
123
+ publish: <T>(type: string, payload: T) => Promise<void>;
124
+ subscribe: (pattern: string, handler: (event: {
125
+ payload: unknown;
126
+ }) => void | Promise<void>) => Promise<(() => void) | undefined>;
127
+ }
128
+ interface ConnectEventsOptions {
129
+ /** Called on remote invalidation for app-specific cleanup (e.g., resolver cache) */
130
+ onRemoteInvalidation?: (orgId: string) => void | Promise<void>;
131
+ /** Custom event type (default: 'arc.permissions.invalidated') */
132
+ eventType?: string;
133
+ }
134
+ interface DynamicPermissionMatrix {
135
+ can: (permissions: Record<string, readonly string[]>) => PermissionCheck;
136
+ canAction: (resource: string, action: string) => PermissionCheck;
137
+ requireRole: (...roles: string[]) => PermissionCheck;
138
+ requireMembership: () => PermissionCheck;
139
+ requireTeamMembership: () => PermissionCheck;
140
+ /** Invalidate cached permissions for a specific organization */
141
+ invalidateByOrg: (orgId: string) => Promise<void>;
142
+ clearCache: () => Promise<void>;
143
+ /**
144
+ * Connect to an event system for cross-node cache invalidation.
145
+ *
146
+ * Late-binding: call after the event plugin is registered (e.g., in onReady hook).
147
+ * Once connected, `invalidateByOrg()` auto-publishes an event, and incoming
148
+ * events from other nodes trigger local cache invalidation.
149
+ * Echo is suppressed via per-process nodeId matching.
150
+ */
151
+ connectEvents(events: PermissionEventBus, options?: ConnectEventsOptions): Promise<void>;
152
+ /** Disconnect from the event system. Safe to call even if never connected. */
153
+ disconnectEvents(): Promise<void>;
154
+ /** Whether events are currently connected. */
155
+ readonly eventsConnected: boolean;
156
+ }
157
+ /**
158
+ * Allow public access (no authentication required)
159
+ *
160
+ * @example
161
+ * ```typescript
162
+ * permissions: {
163
+ * list: allowPublic(),
164
+ * get: allowPublic(),
165
+ * }
166
+ * ```
167
+ */
168
+ declare function allowPublic(): PermissionCheck;
169
+ /**
170
+ * Require authentication (any authenticated user)
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * permissions: {
175
+ * create: requireAuth(),
176
+ * update: requireAuth(),
177
+ * }
178
+ * ```
179
+ */
180
+ declare function requireAuth(): PermissionCheck;
181
+ /**
182
+ * Require specific roles
183
+ *
184
+ * @param roles - Required roles (user needs at least one)
185
+ * @param options - Optional bypass roles
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * permissions: {
190
+ * create: requireRoles(['admin', 'editor']),
191
+ * delete: requireRoles(['admin']),
192
+ * }
193
+ *
194
+ * // With bypass roles
195
+ * permissions: {
196
+ * update: requireRoles(['owner'], { bypassRoles: ['admin', 'superadmin'] }),
197
+ * }
198
+ * ```
199
+ */
200
+ declare function requireRoles(roles: readonly string[], options?: {
201
+ bypassRoles?: readonly string[];
202
+ }): PermissionCheck;
203
+ /**
204
+ * Require resource ownership
205
+ *
206
+ * Returns filters to scope queries to user's owned resources.
207
+ *
208
+ * @param ownerField - Field containing owner ID (default: 'userId')
209
+ * @param options - Optional bypass roles
210
+ *
211
+ * @example
212
+ * ```typescript
213
+ * permissions: {
214
+ * update: requireOwnership('userId'),
215
+ * delete: requireOwnership('createdBy', { bypassRoles: ['admin'] }),
216
+ * }
217
+ * ```
218
+ */
219
+ declare function requireOwnership<TDoc = Record<string, unknown>>(ownerField?: Extract<keyof TDoc, string> | string, options?: {
220
+ bypassRoles?: readonly string[];
221
+ }): PermissionCheck<TDoc>;
222
+ /**
223
+ * Combine multiple checks - ALL must pass (AND logic)
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * permissions: {
228
+ * update: allOf(
229
+ * requireAuth(),
230
+ * requireRoles(['editor']),
231
+ * requireOwnership('createdBy')
232
+ * ),
233
+ * }
234
+ * ```
235
+ */
236
+ declare function allOf(...checks: PermissionCheck[]): PermissionCheck;
237
+ /**
238
+ * Combine multiple checks - ANY must pass (OR logic)
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * permissions: {
243
+ * update: anyOf(
244
+ * requireRoles(['admin']),
245
+ * requireOwnership('createdBy')
246
+ * ),
247
+ * }
248
+ * ```
249
+ */
250
+ declare function anyOf(...checks: PermissionCheck[]): PermissionCheck;
251
+ /**
252
+ * Deny all access
253
+ *
254
+ * @example
255
+ * ```typescript
256
+ * permissions: {
257
+ * delete: denyAll('Deletion not allowed'),
258
+ * }
259
+ * ```
260
+ */
261
+ declare function denyAll(reason?: string): PermissionCheck;
262
+ /**
263
+ * Dynamic permission based on context
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * permissions: {
268
+ * update: when((ctx) => ctx.data?.status === 'draft'),
269
+ * }
270
+ * ```
271
+ */
272
+ declare function when<TDoc = Record<string, unknown>>(condition: (ctx: PermissionContext<TDoc>) => boolean | Promise<boolean>): PermissionCheck<TDoc>;
273
+ /**
274
+ * Require membership in the active organization.
275
+ * User must be authenticated AND have an active org (member or elevated scope).
276
+ *
277
+ * Reads `request.scope` set by auth adapters.
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * permissions: {
282
+ * list: requireOrgMembership(),
283
+ * get: requireOrgMembership(),
284
+ * }
285
+ * ```
286
+ */
287
+ declare function requireOrgMembership<TDoc = Record<string, unknown>>(): PermissionCheck<TDoc>;
288
+ /**
289
+ * Require specific org-level roles.
290
+ * Reads `request.scope.orgRoles` (set by auth adapters).
291
+ * Elevated scope always passes (platform admin bypass).
292
+ *
293
+ * @param roles - Required org roles (user needs at least one)
294
+ *
295
+ * @example
296
+ * ```typescript
297
+ * permissions: {
298
+ * create: requireOrgRole('admin', 'owner'),
299
+ * delete: requireOrgRole('owner'),
300
+ * }
301
+ * ```
302
+ */
303
+ declare function requireOrgRole<TDoc = Record<string, unknown>>(...args: string[] | [readonly string[]]): PermissionCheck<TDoc>;
304
+ /**
305
+ * Create a scoped permission system for resource-action patterns.
306
+ * Maps org roles to fine-grained permissions without external API calls.
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * const perms = createOrgPermissions({
311
+ * statements: {
312
+ * product: ['create', 'update', 'delete'],
313
+ * order: ['create', 'approve'],
314
+ * },
315
+ * roles: {
316
+ * owner: { product: ['create', 'update', 'delete'], order: ['create', 'approve'] },
317
+ * admin: { product: ['create', 'update'], order: ['create'] },
318
+ * member: { product: [], order: [] },
319
+ * },
320
+ * });
321
+ *
322
+ * defineResource({
323
+ * permissions: {
324
+ * create: perms.can({ product: ['create'] }),
325
+ * delete: perms.can({ product: ['delete'] }),
326
+ * }
327
+ * });
328
+ * ```
329
+ */
330
+ declare function createOrgPermissions(config: {
331
+ statements: Record<string, readonly string[]>;
332
+ roles: Record<string, Record<string, readonly string[]>>;
333
+ }): {
334
+ can: (permissions: Record<string, string[]>) => PermissionCheck;
335
+ requireRole: (...roles: string[]) => PermissionCheck;
336
+ requireMembership: () => PermissionCheck;
337
+ requireTeamMembership: () => PermissionCheck;
338
+ };
339
+ /**
340
+ * Create a dynamic role-based permission matrix.
341
+ *
342
+ * Use this when role/action mappings are managed outside code
343
+ * (e.g., admin UI matrix, DB-stored ACLs, remote policy service).
344
+ *
345
+ * Supports:
346
+ * - org role union (any assigned org role can grant)
347
+ * - global bypass roles
348
+ * - wildcard resource/action (`*`)
349
+ * - optional in-memory cache
350
+ */
351
+ declare function createDynamicPermissionMatrix(config: DynamicPermissionMatrixConfig): DynamicPermissionMatrix;
352
+ /**
353
+ * Require membership in the active team.
354
+ * User must be authenticated, a member of the active org, AND have an active team.
355
+ *
356
+ * Better Auth teams are flat member groups (no team-level roles).
357
+ * Reads `request.scope.teamId` set by the Better Auth adapter.
358
+ *
359
+ * @example
360
+ * ```typescript
361
+ * permissions: {
362
+ * list: requireTeamMembership(),
363
+ * create: requireTeamMembership(),
364
+ * }
365
+ * ```
366
+ */
367
+ declare function requireTeamMembership<TDoc = Record<string, unknown>>(): PermissionCheck<TDoc>;
368
+ //#endregion
369
+ export { publicRead as C, createRoleHierarchy as D, RoleHierarchy as E, presets_d_exports as S, readOnly as T, when as _, allOf as a, fullPublic as b, createDynamicPermissionMatrix as c, requireAuth as d, requireOrgMembership as f, requireTeamMembership as g, requireRoles as h, PermissionEventBus as i, createOrgPermissions as l, requireOwnership as m, DynamicPermissionMatrix as n, allowPublic as o, requireOrgRole as p, DynamicPermissionMatrixConfig as r, anyOf as s, ConnectEventsOptions as t, denyAll as u, adminOnly as v, publicReadAdminWrite as w, ownerWithAdminBypass as x, authenticated as y };
@@ -1,5 +1,4 @@
1
- import { D as CrudRepository, a as RepositoryLike, n as DataAdapter, o as SchemaMetadata, s as ValidationResult } from "./interface-DZYNK9bb.mjs";
2
- import { OpenApiSchemas, ParsedQuery, QueryParserInterface, RouteSchemaOptions } from "./types/index.mjs";
1
+ import { G as ParsedQuery, U as OpenApiSchemas, X as QueryParserInterface, a as RepositoryLike, lt as RouteSchemaOptions, n as DataAdapter, o as SchemaMetadata, s as ValidationResult, zt as CrudRepository } from "./interface-DGmPxakH.mjs";
3
2
  import { Model } from "mongoose";
4
3
 
5
4
  //#region src/adapters/mongoose.d.ts
@@ -34,7 +33,7 @@ interface MongooseAdapterOptions<TDoc = unknown> {
34
33
  * });
35
34
  * ```
36
35
  */
37
- schemaGenerator?: (model: Model<TDoc>, options?: RouteSchemaOptions) => OpenApiSchemas;
36
+ schemaGenerator?: (model: Model<TDoc>, options?: RouteSchemaOptions) => OpenApiSchemas | Record<string, unknown>;
38
37
  }
39
38
  /**
40
39
  * Mongoose data adapter with proper type safety
@@ -58,7 +57,7 @@ declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
58
57
  * If a `schemaGenerator` plugin was provided (e.g. MongoKit's buildCrudSchemasFromModel),
59
58
  * it is used instead of the built-in basic conversion.
60
59
  */
61
- generateSchemas(schemaOptions?: RouteSchemaOptions): OpenApiSchemas | null;
60
+ generateSchemas(schemaOptions?: RouteSchemaOptions): OpenApiSchemas | Record<string, unknown> | null;
62
61
  /**
63
62
  * Extract relation metadata
64
63
  */
@@ -198,7 +197,7 @@ declare class PrismaQueryParser implements QueryParserInterface {
198
197
  */
199
198
  interface PrismaQueryOptions {
200
199
  where?: Record<string, unknown>;
201
- orderBy?: Array<Record<string, 'asc' | 'desc'>>;
200
+ orderBy?: Array<Record<string, "asc" | "desc">>;
202
201
  take?: number;
203
202
  skip?: number;
204
203
  select?: Record<string, boolean>;
package/dist/index.d.mts CHANGED
@@ -1,17 +1,67 @@
1
- import "./elevation-DGo5shaX.mjs";
2
- import { D as CrudRepository, E as defineResource, F as OperationFilter, I as PipelineConfig, L as PipelineContext, M as Guard, N as Interceptor, P as NextFunction, R as PipelineStep, S as RouteHandler, T as ResourceDefinition, _ as ControllerLike, a as RepositoryLike, b as IControllerResponse, c as BaseController, i as RelationMetadata, j as QueryOptions, k as PaginatedResult, l as BaseControllerOptions, n as DataAdapter, o as SchemaMetadata, r as FieldMetadata, s as ValidationResult, x as IRequestContext, y as IController, z as Transform } from "./interface-DZYNK9bb.mjs";
3
- import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-Bi_AVKSo.mjs";
4
- import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-RLkFVgaw.mjs";
5
- import { AdditionalRoute, AnyRecord, ApiResponse, ArcInternalMetadata, AuthPluginOptions, ConfigError, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, EventDefinition, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, MiddlewareConfig, MiddlewareHandler, OwnershipCheck, PresetFunction, PresetResult, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestWithExtras, ResourceConfig, ResourceMetadata, RouteHandlerMethod, RouteSchemaOptions, ServiceContext, TypedController, TypedRepository, TypedResourceConfig, UserOrganization, ValidateOptions, ValidationResult as ValidationResult$1 } from "./types/index.mjs";
6
- import { c as MongooseAdapterOptions, l as createMongooseAdapter, n as PrismaAdapterOptions, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./prisma-xjhMEq_S.mjs";
7
- import "./adapters/index.mjs";
8
- import { C as MutationOperation, S as MUTATION_OPERATIONS, T as SYSTEM_FIELDS, _ as HookOperation, a as getControllerScope, b as MAX_REGEX_LENGTH, c as CrudOperation, d as DEFAULT_MAX_LIMIT, f as DEFAULT_SORT, g as HOOK_PHASES, h as HOOK_OPERATIONS, l as DEFAULT_ID_FIELD, m as DEFAULT_UPDATE_METHOD, p as DEFAULT_TENANT_FIELD, s as CRUD_OPERATIONS, u as DEFAULT_LIMIT, v as HookPhase, w as RESERVED_QUERY_PARAMS, x as MAX_SEARCH_LENGTH, y as MAX_FILTER_DEPTH } from "./fastifyAdapter-CyAA2zlB.mjs";
9
- import "./core/index.mjs";
10
- import { a as NotFoundError, d as ValidationError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-DAWRdiYP.mjs";
11
- import { a as presets_d_exports, c as readOnly, i as ownerWithAdminBypass, n as authenticated, o as publicRead, r as fullPublic, s as publicReadAdminWrite, t as adminOnly } from "./presets-BTeYbw7h.mjs";
12
- import { DynamicPermissionMatrix, DynamicPermissionMatrixConfig, allOf, allowPublic, anyOf, createDynamicPermissionMatrix, createOrgPermissions, denyAll, requireAuth, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireTeamMembership, when } from "./permissions/index.mjs";
1
+ import { $ as RegistryStats, A as HealthCheck, B as MiddlewareConfig, C as EventDefinition, D as FastifyWithDecorators, E as FastifyWithAuth, F as IntrospectionData, Gt as Interceptor, I as IntrospectionPluginOptions, Jt as PipelineConfig, Kt as NextFunction, L as JWTPayload, Lt as ResourceDefinition, M as InferAdapterDoc, Mt as IControllerResponse, N as InferDocType, Nt as IRequestContext, O as FieldRule, P as InferResourceDoc, Pt as RouteHandler, Q as RegistryEntry, Rt as defineResource, S as CrudSchemas, T as FastifyRequestExtras, Ut as QueryOptions, V as MiddlewareHandler, Vt as PaginatedResult, W as OwnershipCheck, Wt as Guard, Xt as PipelineStep, Y as PresetResult, Yt as PipelineContext, Z as RateLimitConfig, Zt as Transform, _ as ConfigError, _t as ValidateOptions, a as RepositoryLike, b as CrudRouteKey, bt as BaseController, c as AdditionalRoute, ct as RouteHandlerMethod, et as RequestContext, f as ArcInternalMetadata, ft as TypedController, gt as UserOrganization, i as RelationMetadata, it as ResourceConfig, j as HealthOptions, jt as IController, k as GracefulShutdownOptions, kt as ControllerLike, l as AnyRecord, lt as RouteSchemaOptions, m as AuthPluginOptions, mt as TypedResourceConfig, n as DataAdapter, nt as RequestWithExtras, o as SchemaMetadata, ot as ResourceMetadata, pt as TypedRepository, q as PresetFunction, qt as OperationFilter, r as FieldMetadata, s as ValidationResult, tt as RequestIdOptions, u as ApiResponse, ut as ServiceContext, vt as ValidationResult$1, x as CrudRouterOptions, xt as BaseControllerOptions, y as CrudController, zt as CrudRepository } from "./interface-DGmPxakH.mjs";
2
+ import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-DFwdaWCq.mjs";
3
+ import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-BNUccdcf.mjs";
4
+ import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-yhxyjqNb.mjs";
5
+ import { A as RESERVED_QUERY_PARAMS, C as HookOperation, D as MAX_SEARCH_LENGTH, E as MAX_REGEX_LENGTH, O as MUTATION_OPERATIONS, S as HOOK_PHASES, T as MAX_FILTER_DEPTH, _ as DEFAULT_MAX_LIMIT, a as getControllerScope, b as DEFAULT_UPDATE_METHOD, g as DEFAULT_LIMIT, h as DEFAULT_ID_FIELD, j as SYSTEM_FIELDS, k as MutationOperation, m as CrudOperation, p as CRUD_OPERATIONS, v as DEFAULT_SORT, w as HookPhase, x as HOOK_OPERATIONS, y as DEFAULT_TENANT_FIELD } from "./index-BL8CaQih.mjs";
6
+ import { C as publicRead, S as presets_d_exports, T as readOnly, _ as when, a as allOf, b as fullPublic, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgMembership, g as requireTeamMembership, h as requireRoles, l as createOrgPermissions, m as requireOwnership, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgRole, r as DynamicPermissionMatrixConfig, s as anyOf, u as denyAll, v as adminOnly, w as publicReadAdminWrite, x as ownerWithAdminBypass, y as authenticated } from "./index-Diqcm14c.mjs";
7
+ import { a as NotFoundError, d as ValidationError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-CPpvPHT0.mjs";
13
8
  import { AsyncLocalStorage } from "node:async_hooks";
14
9
 
10
+ //#region src/context/requestContext.d.ts
11
+ /**
12
+ * Shape of the request-scoped context store.
13
+ * Populated by Arc's onRequest hook in arcCorePlugin.
14
+ */
15
+ interface RequestStore {
16
+ /** Unique request identifier */
17
+ requestId?: string;
18
+ /** Authenticated user (if any) */
19
+ user?: {
20
+ id?: string;
21
+ _id?: string;
22
+ roles?: string[];
23
+ [key: string]: unknown;
24
+ } | null;
25
+ /** Active organization ID (multi-tenant) */
26
+ organizationId?: string;
27
+ /** Active team ID (team-scoped resources) */
28
+ teamId?: string;
29
+ /** Current resource name (set by arcDecorator in CRUD routes) */
30
+ resourceName?: string;
31
+ /** Request start time (for timing) */
32
+ startTime: number;
33
+ /** Additional context — extensible by app */
34
+ [key: string]: unknown;
35
+ }
36
+ /**
37
+ * Request context API.
38
+ *
39
+ * - `get()` — returns current store or undefined if outside request scope
40
+ * - `run(store, fn)` — run a function with a specific store (used by Arc internals)
41
+ * - `getStore()` — alias for get() (matches Node.js API naming)
42
+ */
43
+ declare const requestContext: {
44
+ /**
45
+ * Get the current request context.
46
+ * Returns undefined if called outside a request lifecycle.
47
+ */
48
+ get(): RequestStore | undefined;
49
+ /**
50
+ * Alias for get() — matches Node.js AsyncLocalStorage API naming.
51
+ */
52
+ getStore(): RequestStore | undefined;
53
+ /**
54
+ * Run a function within a specific request context.
55
+ * Used internally by Arc's onRequest hook.
56
+ */
57
+ run<T>(store: RequestStore, fn: () => T): T;
58
+ /**
59
+ * The underlying AsyncLocalStorage instance.
60
+ * Exposed for advanced use cases (testing, custom integrations).
61
+ */
62
+ storage: AsyncLocalStorage<RequestStore>;
63
+ };
64
+ //#endregion
15
65
  //#region src/core/validateResourceConfig.d.ts
16
66
  interface ConfigError$1 {
17
67
  field: string;
@@ -44,6 +94,35 @@ declare function formatValidationErrors(resourceName: string, result: Validation
44
94
  */
45
95
  declare function assertValidConfig(config: ResourceConfig, options?: ValidateOptions$1): void;
46
96
  //#endregion
97
+ //#region src/middleware/middleware.d.ts
98
+ interface NamedMiddleware {
99
+ /** Unique name for debugging/introspection */
100
+ readonly name: string;
101
+ /** Operations this middleware applies to (default: all) */
102
+ readonly operations?: Array<"list" | "get" | "create" | "update" | "delete" | string>;
103
+ /** Priority — lower numbers run first (default: 10) */
104
+ readonly priority: number;
105
+ /** Conditional execution — return true to run, false to skip */
106
+ readonly when?: (request: RequestWithExtras) => boolean | Promise<boolean>;
107
+ /** The middleware handler */
108
+ readonly handler: MiddlewareHandler;
109
+ }
110
+ interface MiddlewareOptions {
111
+ operations?: NamedMiddleware["operations"];
112
+ priority?: number;
113
+ when?: NamedMiddleware["when"];
114
+ handler: MiddlewareHandler;
115
+ }
116
+ /**
117
+ * Create a named middleware with priority and conditions.
118
+ */
119
+ declare function middleware(name: string, options: MiddlewareOptions): NamedMiddleware;
120
+ /**
121
+ * Sort named middlewares by priority (ascending — lower runs first).
122
+ * Returns a MiddlewareConfig map keyed by operation, ready to pass to `defineResource()`.
123
+ */
124
+ declare function sortMiddlewares(middlewares: NamedMiddleware[]): MiddlewareConfig;
125
+ //#endregion
47
126
  //#region src/pipeline/guard.d.ts
48
127
  interface GuardOptions {
49
128
  operations?: OperationFilter;
@@ -57,19 +136,6 @@ interface GuardOptions {
57
136
  */
58
137
  declare function guard(name: string, handlerOrOptions: ((ctx: PipelineContext) => boolean | Promise<boolean>) | GuardOptions): Guard;
59
138
  //#endregion
60
- //#region src/pipeline/transform.d.ts
61
- interface TransformOptions {
62
- operations?: OperationFilter;
63
- handler: (ctx: PipelineContext) => PipelineContext | void | Promise<PipelineContext | void>;
64
- }
65
- /**
66
- * Create a named transform.
67
- *
68
- * @param name - Transform name (for debugging/introspection)
69
- * @param handlerOrOptions - Handler function or options object
70
- */
71
- declare function transform(name: string, handlerOrOptions: ((ctx: PipelineContext) => PipelineContext | void | Promise<PipelineContext | void>) | TransformOptions): Transform;
72
- //#endregion
73
139
  //#region src/pipeline/intercept.d.ts
74
140
  interface InterceptOptions {
75
141
  operations?: OperationFilter;
@@ -90,89 +156,18 @@ declare function intercept(name: string, handlerOrOptions: ((ctx: PipelineContex
90
156
  */
91
157
  declare function pipe(...steps: PipelineStep[]): PipelineStep[];
92
158
  //#endregion
93
- //#region src/middleware/middleware.d.ts
94
- interface NamedMiddleware {
95
- /** Unique name for debugging/introspection */
96
- readonly name: string;
97
- /** Operations this middleware applies to (default: all) */
98
- readonly operations?: Array<'list' | 'get' | 'create' | 'update' | 'delete' | string>;
99
- /** Priority — lower numbers run first (default: 10) */
100
- readonly priority: number;
101
- /** Conditional execution — return true to run, false to skip */
102
- readonly when?: (request: RequestWithExtras) => boolean | Promise<boolean>;
103
- /** The middleware handler */
104
- readonly handler: MiddlewareHandler;
105
- }
106
- interface MiddlewareOptions {
107
- operations?: NamedMiddleware['operations'];
108
- priority?: number;
109
- when?: NamedMiddleware['when'];
110
- handler: MiddlewareHandler;
111
- }
112
- /**
113
- * Create a named middleware with priority and conditions.
114
- */
115
- declare function middleware(name: string, options: MiddlewareOptions): NamedMiddleware;
116
- /**
117
- * Sort named middlewares by priority (ascending — lower runs first).
118
- * Returns a MiddlewareConfig map keyed by operation, ready to pass to `defineResource()`.
119
- */
120
- declare function sortMiddlewares(middlewares: NamedMiddleware[]): MiddlewareConfig;
121
- //#endregion
122
- //#region src/context/requestContext.d.ts
123
- /**
124
- * Shape of the request-scoped context store.
125
- * Populated by Arc's onRequest hook in arcCorePlugin.
126
- */
127
- interface RequestStore {
128
- /** Unique request identifier */
129
- requestId?: string;
130
- /** Authenticated user (if any) */
131
- user?: {
132
- id?: string;
133
- _id?: string;
134
- roles?: string[];
135
- [key: string]: unknown;
136
- } | null;
137
- /** Active organization ID (multi-tenant) */
138
- organizationId?: string;
139
- /** Active team ID (team-scoped resources) */
140
- teamId?: string;
141
- /** Current resource name (set by arcDecorator in CRUD routes) */
142
- resourceName?: string;
143
- /** Request start time (for timing) */
144
- startTime: number;
145
- /** Additional context — extensible by app */
146
- [key: string]: unknown;
159
+ //#region src/pipeline/transform.d.ts
160
+ interface TransformOptions {
161
+ operations?: OperationFilter;
162
+ handler: (ctx: PipelineContext) => PipelineContext | undefined | Promise<PipelineContext | undefined>;
147
163
  }
148
164
  /**
149
- * Request context API.
165
+ * Create a named transform.
150
166
  *
151
- * - `get()` returns current store or undefined if outside request scope
152
- * - `run(store, fn)` run a function with a specific store (used by Arc internals)
153
- * - `getStore()` — alias for get() (matches Node.js API naming)
167
+ * @param name - Transform name (for debugging/introspection)
168
+ * @param handlerOrOptions - Handler function or options object
154
169
  */
155
- declare const requestContext: {
156
- /**
157
- * Get the current request context.
158
- * Returns undefined if called outside a request lifecycle.
159
- */
160
- get(): RequestStore | undefined;
161
- /**
162
- * Alias for get() — matches Node.js AsyncLocalStorage API naming.
163
- */
164
- getStore(): RequestStore | undefined;
165
- /**
166
- * Run a function within a specific request context.
167
- * Used internally by Arc's onRequest hook.
168
- */
169
- run<T>(store: RequestStore, fn: () => T): T;
170
- /**
171
- * The underlying AsyncLocalStorage instance.
172
- * Exposed for advanced use cases (testing, custom integrations).
173
- */
174
- storage: AsyncLocalStorage<RequestStore>;
175
- };
170
+ declare function transform(name: string, handlerOrOptions: ((ctx: PipelineContext) => PipelineContext | undefined | Promise<PipelineContext | undefined>) | TransformOptions): Transform;
176
171
  //#endregion
177
172
  //#region src/logger/index.d.ts
178
173
  /**
@@ -257,4 +252,4 @@ declare function arcLog(module: string): ArcLogger;
257
252
  //#region src/index.d.ts
258
253
  declare const version: string;
259
254
  //#endregion
260
- export { type ValidationResult as AdapterValidationResult, type AdditionalRoute, type AnyRecord, type ApiResponse, ArcError, type ArcInternalMetadata, type ArcLogWriter, type ArcLogger, type ArcLoggerOptions, type AuthPluginOptions, BaseController, type BaseControllerOptions, CRUD_OPERATIONS, type ConfigError, type ControllerLike, type CrudController, CrudOperation, type CrudRepository, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataAdapter, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldMetadata, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, type Guard, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, HookOperation, HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type Interceptor, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, MongooseAdapter, type MongooseAdapterOptions, MutationOperation, type NamedMiddleware, NotFoundError, type OwnershipCheck, type PaginatedResult, type PermissionCheck, type PermissionContext, type PermissionResult, type PipelineConfig, type PipelineContext, type PipelineStep, type PresetFunction, type PresetResult, PrismaAdapter, type PrismaAdapterOptions, type QueryOptions, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RegistryEntry, type RegistryStats, type RelationMetadata, type RepositoryLike, type RequestContext, type RequestIdOptions, type RequestStore, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SchemaMetadata, type ServiceContext, type Transform, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult$1 as ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, arcLog, assertValidConfig, authenticated, configureArcLogger, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, denyAll, fields, formatValidationErrors, fullPublic, getControllerScope, guard, intercept, middleware, ownerWithAdminBypass, presets_d_exports as permissions, pipe, publicRead, publicReadAdminWrite, readOnly, requestContext, requireAuth, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireTeamMembership, sortMiddlewares, transform, validateResourceConfig, version, when };
255
+ export { type ValidationResult as AdapterValidationResult, type AdditionalRoute, type AnyRecord, type ApiResponse, ArcError, type ArcInternalMetadata, type ArcLogWriter, type ArcLogger, type ArcLoggerOptions, type AuthPluginOptions, BaseController, type BaseControllerOptions, CRUD_OPERATIONS, type ConfigError, type ControllerLike, type CrudController, CrudOperation, type CrudRepository, type CrudRouteKey, type CrudRouterOptions, type CrudSchemas, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, type DataAdapter, type DynamicPermissionMatrix, type DynamicPermissionMatrixConfig, type EventDefinition, type FastifyRequestExtras, type FastifyWithAuth, type FastifyWithDecorators, type FieldMetadata, type FieldPermission, type FieldPermissionMap, type FieldRule, ForbiddenError, type GracefulShutdownOptions, type Guard, HOOK_OPERATIONS, HOOK_PHASES, type HealthCheck, type HealthOptions, HookOperation, HookPhase, type IController, type IControllerResponse, type IRequestContext, type InferAdapterDoc, type InferDocType, type InferResourceDoc, type Interceptor, type IntrospectionData, type IntrospectionPluginOptions, type JWTPayload, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MiddlewareConfig, MongooseAdapter, MutationOperation, type NamedMiddleware, NotFoundError, type OwnershipCheck, type PaginatedResult, type PermissionCheck, type PermissionContext, type PermissionResult, type PipelineConfig, type PipelineContext, type PipelineStep, type PresetFunction, type PresetResult, PrismaAdapter, type QueryOptions, RESERVED_QUERY_PARAMS, type RateLimitConfig, type RegistryEntry, type RegistryStats, type RelationMetadata, type RepositoryLike, type RequestContext, type RequestIdOptions, type RequestStore, type RequestWithExtras, type ResourceConfig, ResourceDefinition, type ResourceMetadata, type RouteHandler, type RouteHandlerMethod, type RouteSchemaOptions, SYSTEM_FIELDS, type SchemaMetadata, type ServiceContext, type Transform, type TypedController, type TypedRepository, type TypedResourceConfig, UnauthorizedError, type UserBase, type UserOrganization, type ValidateOptions, ValidationError, type ValidationResult$1 as ValidationResult, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, arcLog, assertValidConfig, authenticated, configureArcLogger, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, denyAll, fields, formatValidationErrors, fullPublic, getControllerScope, guard, intercept, middleware, ownerWithAdminBypass, presets_d_exports as permissions, pipe, publicRead, publicReadAdminWrite, readOnly, requestContext, requireAuth, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireTeamMembership, sortMiddlewares, transform, validateResourceConfig, version, when };