@classytic/arc 2.8.1 → 2.8.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 (106) hide show
  1. package/README.md +1 -1
  2. package/dist/{ResourceRegistry-Dtcojmu8.mjs → ResourceRegistry-Dq3_zBQP.mjs} +5 -5
  3. package/dist/adapters/index.d.mts +2 -2
  4. package/dist/audit/index.d.mts +1 -1
  5. package/dist/audit/index.mjs +1 -1
  6. package/dist/audit/mongodb.d.mts +1 -1
  7. package/dist/audit/mongodb.mjs +1 -1
  8. package/dist/auth/index.d.mts +4 -4
  9. package/dist/auth/redis-session.d.mts +1 -1
  10. package/dist/cache/index.d.mts +2 -2
  11. package/dist/cli/commands/describe.mjs +1 -1
  12. package/dist/cli/commands/docs.mjs +2 -2
  13. package/dist/cli/commands/generate.mjs +1 -1
  14. package/dist/cli/commands/init.mjs +10 -10
  15. package/dist/cli/commands/introspect.mjs +3 -3
  16. package/dist/core/index.d.mts +3 -3
  17. package/dist/core/index.mjs +4 -4
  18. package/dist/{core-CrLDuqoT.mjs → core-DKSwNSXf.mjs} +1 -1
  19. package/dist/{createApp-p2OThysU.mjs → createApp-BOYjBgdI.mjs} +16 -7
  20. package/dist/{defineResource-CqeUltrW.mjs → defineResource-Bb_Bdhtw.mjs} +42 -27
  21. package/dist/docs/index.d.mts +2 -2
  22. package/dist/docs/index.mjs +1 -1
  23. package/dist/dynamic/index.d.mts +2 -2
  24. package/dist/dynamic/index.mjs +1 -1
  25. package/dist/{errorHandler-DJ7OAB2V.d.mts → errorHandler-CdZDavNH.d.mts} +2 -2
  26. package/dist/{eventPlugin-Cdjwo0Gv.d.mts → eventPlugin-CVxlE6De.d.mts} +1 -1
  27. package/dist/events/index.d.mts +3 -3
  28. package/dist/events/index.mjs +1 -1
  29. package/dist/events/transports/redis-stream-entry.d.mts +1 -1
  30. package/dist/events/transports/redis-stream-entry.mjs +3 -1
  31. package/dist/events/transports/redis.d.mts +1 -1
  32. package/dist/factory/index.d.mts +1 -1
  33. package/dist/factory/index.mjs +2 -152
  34. package/dist/hooks/index.d.mts +1 -1
  35. package/dist/idempotency/index.d.mts +3 -3
  36. package/dist/idempotency/mongodb.d.mts +1 -1
  37. package/dist/idempotency/mongodb.mjs +18 -6
  38. package/dist/idempotency/redis.d.mts +1 -1
  39. package/dist/idempotency/redis.mjs +10 -1
  40. package/dist/{index-0zj73o2U.d.mts → index-BgmMdpm8.d.mts} +1 -1
  41. package/dist/{index-CBru2y5Y.d.mts → index-CSkeivBx.d.mts} +3 -3
  42. package/dist/{index-DadoLP51.d.mts → index-CpTSDqmD.d.mts} +26 -4
  43. package/dist/index.d.mts +7 -7
  44. package/dist/index.mjs +3 -3
  45. package/dist/integrations/event-gateway.d.mts +1 -1
  46. package/dist/integrations/event-gateway.mjs +1 -1
  47. package/dist/integrations/index.d.mts +1 -1
  48. package/dist/integrations/mcp/index.d.mts +2 -2
  49. package/dist/integrations/mcp/index.mjs +1 -1
  50. package/dist/integrations/mcp/testing.d.mts +1 -1
  51. package/dist/integrations/mcp/testing.mjs +1 -1
  52. package/dist/{interface-CS6d7HiB.d.mts → interface-BVuMfeVv.d.mts} +47 -18
  53. package/dist/loadResources-Bksk8ydA.mjs +154 -0
  54. package/dist/{mongodb-B1eVtFhw.d.mts → mongodb-B8U2xaLj.d.mts} +1 -1
  55. package/dist/{mongodb-NShVZDMr.d.mts → mongodb-X7LbEjTN.d.mts} +10 -1
  56. package/dist/{openapi-q6rNKfZy.mjs → openapi-CYCuekCn.mjs} +2 -2
  57. package/dist/org/index.d.mts +2 -2
  58. package/dist/permissions/index.d.mts +3 -3
  59. package/dist/plugins/index.d.mts +5 -5
  60. package/dist/plugins/index.mjs +7 -7
  61. package/dist/plugins/tracing-entry.d.mts +1 -1
  62. package/dist/plugins/tracing-entry.mjs +1 -1
  63. package/dist/policies/index.d.mts +1 -1
  64. package/dist/presets/index.d.mts +1 -1
  65. package/dist/presets/index.mjs +1 -1
  66. package/dist/presets/multiTenant.d.mts +1 -1
  67. package/dist/{presets-BFrGvvjL.mjs → presets-C2xgzW6x.mjs} +10 -18
  68. package/dist/{queryCachePlugin-BCFVXnxK.d.mts → queryCachePlugin-CnTZZTC5.d.mts} +1 -1
  69. package/dist/{redis-stream-BgrYzpeq.d.mts → redis-stream-D54N5oXs.d.mts} +1 -1
  70. package/dist/{redis-Bunu3qWg.d.mts → redis-z3sFr1UP.d.mts} +1 -1
  71. package/dist/registry/index.d.mts +1 -1
  72. package/dist/registry/index.mjs +1 -1
  73. package/dist/{resourceToTools-DNNWnZtx.mjs → resourceToTools-O_HwWXFa.mjs} +1 -1
  74. package/dist/rpc/index.d.mts +1 -1
  75. package/dist/scope/index.d.mts +2 -2
  76. package/dist/testing/index.d.mts +2 -2
  77. package/dist/testing/index.mjs +1 -1
  78. package/dist/types/index.d.mts +4 -4
  79. package/dist/{types-BlOuKTPw.d.mts → types-Bg2X42_m.d.mts} +30 -9
  80. package/dist/{types-BoaZHr-2.d.mts → types-CVC4HOKi.d.mts} +1 -1
  81. package/dist/{types-D3b7hA00.d.mts → types-CcG4avic.d.mts} +1 -1
  82. package/dist/utils/index.d.mts +43 -5
  83. package/dist/utils/index.mjs +3 -3
  84. package/dist/{utils-7sJ8X83I.mjs → utils-yYT3HDXt.mjs} +65 -1
  85. package/package.json +8 -8
  86. package/skills/arc/SKILL.md +79 -6
  87. /package/dist/{EventTransport-CLXJUzyT.d.mts → EventTransport-CinyO7zQ.d.mts} +0 -0
  88. /package/dist/{caching-CHH-iHs3.mjs → caching-CjybdRwx.mjs} +0 -0
  89. /package/dist/{circuitBreaker-BGVoB1hD.d.mts → circuitBreaker-CvXkjfrW.d.mts} +0 -0
  90. /package/dist/{elevation-UJO3-NvX.d.mts → elevation-s5ykdNHr.d.mts} +0 -0
  91. /package/dist/{errorHandler-Cw34h_om.mjs → errorHandler-mzqk4cGl.mjs} +0 -0
  92. /package/dist/{errors-BI8kEKsO.d.mts → errors-Bmn3eZT6.d.mts} +0 -0
  93. /package/dist/{eventPlugin-XijlQmlL.mjs → eventPlugin-D91S2YF4.mjs} +0 -0
  94. /package/dist/{externalPaths-BQ8QijNH.d.mts → externalPaths-Bapitwvd.d.mts} +0 -0
  95. /package/dist/{fields-DoeDgh2b.d.mts → fields-DC4So2M2.d.mts} +0 -0
  96. /package/dist/{interface-CkkWm5uR.d.mts → interface-B-pe8fhj.d.mts} +0 -0
  97. /package/dist/{interface-bpoLKKqx.d.mts → interface-DplgQO2e.d.mts} +0 -0
  98. /package/dist/{metrics-DuhiSEZI.mjs → metrics-TuOmguhi.mjs} +0 -0
  99. /package/dist/{mongodb-5Ff3w8jy.mjs → mongodb-B5O6xaW1.mjs} +0 -0
  100. /package/dist/{pluralize-BneOJkpi.mjs → pluralize-A0tWEl1K.mjs} +0 -0
  101. /package/dist/{replyHelpers-CXtJDAZ0.mjs → replyHelpers-BLojtuvR.mjs} +0 -0
  102. /package/dist/{sessionManager-BkzVU8h2.d.mts → sessionManager-D-oNWHz3.d.mts} +0 -0
  103. /package/dist/{sse-CD5Hghpu.mjs → sse-CJpt7LGI.mjs} +0 -0
  104. /package/dist/{tracing-xqXzWeaf.d.mts → tracing-DxjKk7eW.d.mts} +0 -0
  105. /package/dist/{types-CN6JvmYz.d.mts → types-C72d3NDn.d.mts} +0 -0
  106. /package/dist/{versioning-CPU_5Xfs.mjs → versioning-Cm8qoFDg.mjs} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { t as ArcQueryParser } from "../queryParser-CgCtsjti.mjs";
2
- import { n as defineResource } from "../defineResource-CqeUltrW.mjs";
2
+ import { n as defineResource } from "../defineResource-Bb_Bdhtw.mjs";
3
3
  import { C as publicRead, T as readOnly, b as fullPublic, v as adminOnly, w as publicReadAdminWrite, x as ownerWithAdminBypass, y as authenticated } from "../permissions-CH4cNwJi.mjs";
4
4
  //#region src/dynamic/ArcDynamicLoader.ts
5
5
  const VALID_FIELD_TYPES = new Set([
@@ -1,4 +1,4 @@
1
- import { t as DomainEvent } from "./EventTransport-CLXJUzyT.mjs";
1
+ import { t as DomainEvent } from "./EventTransport-CinyO7zQ.mjs";
2
2
  import { FastifyInstance, FastifyPluginAsync, FastifyRequest } from "fastify";
3
3
 
4
4
  //#region src/plugins/caching.d.ts
@@ -180,4 +180,4 @@ interface ErrorHandlerOptions {
180
180
  declare function errorHandlerPluginFn(fastify: FastifyInstance, options?: ErrorHandlerOptions): Promise<void>;
181
181
  declare const errorHandlerPlugin: typeof errorHandlerPluginFn;
182
182
  //#endregion
183
- export { cachingPlugin as _, versioningPlugin as a, MetricsOptions as c, SSEOptions as d, _default$2 as f, _default$3 as g, CachingRule as h, _default as i, _default$1 as l, CachingOptions as m, errorHandlerPlugin as n, MetricEntry as o, ssePlugin as p, VersioningOptions as r, MetricsCollector as s, ErrorHandlerOptions as t, metricsPlugin as u };
183
+ export { _default$3 as _, _default as a, MetricsCollector as c, metricsPlugin as d, SSEOptions as f, CachingRule as g, CachingOptions as h, VersioningOptions as i, MetricsOptions as l, ssePlugin as m, ErrorMapper as n, versioningPlugin as o, _default$2 as p, errorHandlerPlugin as r, MetricEntry as s, ErrorHandlerOptions as t, _default$1 as u, cachingPlugin as v };
@@ -1,4 +1,4 @@
1
- import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "./EventTransport-CLXJUzyT.mjs";
1
+ import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "./EventTransport-CinyO7zQ.mjs";
2
2
  import { FastifyPluginAsync } from "fastify";
3
3
 
4
4
  //#region src/events/defineEvent.d.ts
@@ -1,7 +1,7 @@
1
- import { a as MemoryEventTransport, c as createEvent, i as EventTransport, n as EventHandler, o as MemoryEventTransportOptions, r as EventLogger, s as PublishManyResult, t as DomainEvent } from "../EventTransport-CLXJUzyT.mjs";
2
- import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-Cdjwo0Gv.mjs";
1
+ import { a as MemoryEventTransport, c as createEvent, i as EventTransport, n as EventHandler, o as MemoryEventTransportOptions, r as EventLogger, s as PublishManyResult, t as DomainEvent } from "../EventTransport-CinyO7zQ.mjs";
2
+ import { a as withRetry, c as EventDefinitionOutput, d as EventSchema, f as ValidationResult, i as createDeadLetterPublisher, l as EventRegistry, m as defineEvent, n as eventPlugin, o as CustomValidator, p as createEventRegistry, r as RetryOptions, s as EventDefinitionInput, t as EventPluginOptions, u as EventRegistryOptions } from "../eventPlugin-CVxlE6De.mjs";
3
3
  import { RedisEventTransportOptions, RedisLike } from "./transports/redis.mjs";
4
- import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-BgrYzpeq.mjs";
4
+ import { r as RedisStreamTransportOptions, t as RedisStreamLike } from "../redis-stream-D54N5oXs.mjs";
5
5
 
6
6
  //#region src/events/eventTypes.d.ts
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { a as MemoryEventTransport, i as withRetry, o as createEvent, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-XijlQmlL.mjs";
1
+ import { a as MemoryEventTransport, i as withRetry, o as createEvent, r as createDeadLetterPublisher, t as eventPlugin } from "../eventPlugin-D91S2YF4.mjs";
2
2
  //#region src/events/defineEvent.ts
3
3
  /**
4
4
  * defineEvent — Typed Event Definitions with Optional Schema Validation
@@ -1,2 +1,2 @@
1
- import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-BgrYzpeq.mjs";
1
+ import { n as RedisStreamTransport, r as RedisStreamTransportOptions, t as RedisStreamLike } from "../../redis-stream-D54N5oXs.mjs";
2
2
  export { type RedisStreamLike, RedisStreamTransport, type RedisStreamTransportOptions };
@@ -118,7 +118,9 @@ var RedisStreamTransport = class {
118
118
  const claimed = await this.redis.xclaim(this.stream, this.group, this.consumer, this.claimTimeoutMs, ...staleIds);
119
119
  for (const [messageId, fields] of claimed) await this.processEntry(messageId, fields);
120
120
  }
121
- } catch {}
121
+ } catch (err) {
122
+ this.logger.error("[RedisStreamTransport] claimPending error:", err);
123
+ }
122
124
  }
123
125
  async processEntry(messageId, fields) {
124
126
  const fieldMap = /* @__PURE__ */ new Map();
@@ -1,4 +1,4 @@
1
- import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "../../EventTransport-CLXJUzyT.mjs";
1
+ import { i as EventTransport, n as EventHandler, r as EventLogger, t as DomainEvent } from "../../EventTransport-CinyO7zQ.mjs";
2
2
 
3
3
  //#region src/events/transports/redis.d.ts
4
4
  interface RedisLike {
@@ -1,4 +1,4 @@
1
- import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-BlOuKTPw.mjs";
1
+ import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as loadResources, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-Bg2X42_m.mjs";
2
2
  import { FastifyInstance } from "fastify";
3
3
 
4
4
  //#region src/factory/createApp.d.ts
@@ -1,7 +1,5 @@
1
- import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-p2OThysU.mjs";
2
- import { readdir } from "node:fs/promises";
3
- import { dirname, join, resolve } from "node:path";
4
- import { fileURLToPath, pathToFileURL } from "node:url";
1
+ import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-BOYjBgdI.mjs";
2
+ import { t as loadResources } from "../loadResources-Bksk8ydA.mjs";
5
3
  //#region src/factory/edge.ts
6
4
  /**
7
5
  * Convert a Fastify app into a Web Standards fetch handler.
@@ -48,152 +46,4 @@ function toFetchHandler(app, options = {}) {
48
46
  };
49
47
  }
50
48
  //#endregion
51
- //#region src/factory/loadResources.ts
52
- /**
53
- * loadResources — Auto-discover resource files from a directory.
54
- *
55
- * Scans for `*.resource.{ts,js,mts,mjs}` files, imports each,
56
- * and collects their default exports. No barrel file needed.
57
- *
58
- * @example
59
- * ```ts
60
- * import { createApp, loadResources } from '@classytic/arc/factory';
61
- *
62
- * // Recommended: import.meta.url — works in both src/ (dev) and dist/ (prod)
63
- * const app = await createApp({
64
- * resources: await loadResources(import.meta.url),
65
- * auth: { type: 'jwt', jwt: { secret: process.env.JWT_SECRET } },
66
- * });
67
- *
68
- * // Or explicit path (must match runtime layout)
69
- * const app2 = await createApp({
70
- * resources: await loadResources('./src/resources'),
71
- * });
72
- * ```
73
- *
74
- * File convention:
75
- * ```
76
- * src/resources/
77
- * product/product.resource.ts → export default defineResource({ name: 'product', ... })
78
- * order/order.resource.ts → export default defineResource({ name: 'order', ... })
79
- * ```
80
- */
81
- /**
82
- * Scan a directory for resource files and import their default exports.
83
- *
84
- * Accepts a directory path OR `import.meta.url` (file:// URL).
85
- * When given a URL, resolves to the directory containing that file —
86
- * so `loadResources(import.meta.url)` works in both dev (`src/`) and
87
- * production (`dist/`) without path gymnastics.
88
- *
89
- * @param dir - Directory path, or `import.meta.url` (file:// URL resolved to its dirname)
90
- * @param options - Pattern and recursion options
91
- * @returns Array of resource definitions (anything with `.toPlugin()`)
92
- *
93
- * @example
94
- * ```ts
95
- * // Works from both src/ and dist/ — resolves relative to the calling file
96
- * await loadResources(import.meta.url);
97
- *
98
- * // Subdirectory relative to the calling file
99
- * await loadResources(import.meta.url, { suffix: '.resource' });
100
- *
101
- * // Explicit path (must match runtime layout)
102
- * await loadResources('./src/resources');
103
- * ```
104
- */
105
- async function loadResources(dir, options = {}) {
106
- const { suffix = ".resource", recursive = true, exclude, include, silent = false } = options;
107
- const files = await collectFiles(resolve(dir.startsWith("file://") ? dirname(fileURLToPath(dir)) : dir), new RegExp(`${escapeRegex(suffix)}\\.(ts|js|mts|mjs)$`), recursive);
108
- files.sort();
109
- const includeSet = include ? new Set(include) : null;
110
- const excludeSet = exclude ? new Set(exclude) : null;
111
- const skipped = [];
112
- const failed = [];
113
- const isWindowsPath = (p) => /^[a-z]:[\\/]/i.test(p);
114
- const results = await Promise.all(files.map(async (file) => {
115
- let mod;
116
- let primaryError;
117
- try {
118
- mod = await import(pathToFileURL(file).href);
119
- return {
120
- file,
121
- mod
122
- };
123
- } catch (err) {
124
- primaryError = err;
125
- }
126
- if (!isWindowsPath(file)) try {
127
- mod = await import(file);
128
- return {
129
- file,
130
- mod
131
- };
132
- } catch {}
133
- const err = primaryError;
134
- const code = err.code;
135
- const msg = err instanceof Error ? err.message : String(err);
136
- if (code === "ERR_MODULE_NOT_FOUND" && msg.includes(".js")) failed.push(`${file}: ${msg}\n Hint: This file uses .js extension imports (TypeScript ESM convention).
137
- • Production: ensure your build compiles .ts→.js before loadResources() runs.
138
- • Node.js: use tsx, ts-node/esm, or a build step.
139
- • Vitest: nested .js→.ts resolution may fail through dynamic imports.
140
- Workaround: use import.meta.glob to preload resources statically.
141
- See: https://github.com/classytic/arc/blob/main/docs/production-ops/factory.mdx#vitest-limitation`);
142
- else failed.push(`${file}: ${msg}`);
143
- return null;
144
- }));
145
- const resources = [];
146
- for (const result of results) {
147
- if (!result) continue;
148
- let resource = result.mod.default ?? result.mod.resource;
149
- if (!resource || typeof resource.toPlugin !== "function") {
150
- for (const value of Object.values(result.mod)) if (value && typeof value === "object" && typeof value.toPlugin === "function") {
151
- resource = value;
152
- break;
153
- }
154
- }
155
- if (!resource || typeof resource.toPlugin !== "function") {
156
- skipped.push(result.file);
157
- continue;
158
- }
159
- const name = resource.name;
160
- if (name) {
161
- if (includeSet && !includeSet.has(name)) continue;
162
- if (!includeSet && excludeSet?.has(name)) continue;
163
- }
164
- resources.push(resource);
165
- }
166
- const log = silent ? void 0 : options?.logger;
167
- if (log) {
168
- if (failed.length) {
169
- log.warn(`[arc] loadResources: ${failed.length} file(s) failed to import:`);
170
- for (const f of failed) log.warn(` - ${f}`);
171
- }
172
- if (skipped.length) {
173
- log.warn(`[arc] loadResources: ${skipped.length} file(s) skipped (no default export with toPlugin):`);
174
- for (const f of skipped) log.warn(` - ${f}`);
175
- }
176
- }
177
- return resources;
178
- }
179
- async function collectFiles(dir, pattern, recursive) {
180
- const results = [];
181
- let entries;
182
- try {
183
- entries = await readdir(dir, { withFileTypes: true });
184
- } catch {
185
- return results;
186
- }
187
- for (const entry of entries) {
188
- const name = String(entry.name);
189
- const fullPath = join(dir, name);
190
- if (entry.isDirectory() && recursive) results.push(...await collectFiles(fullPath, pattern, recursive));
191
- else if (entry.isFile() && pattern.test(name)) results.push(fullPath);
192
- }
193
- return results;
194
- }
195
- function escapeRegex(str) {
196
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
197
- }
198
- //#endregion
199
49
  export { ArcFactory, createApp, developmentPreset, edgePreset, getPreset, loadResources, productionPreset, testingPreset, toFetchHandler };
@@ -1,2 +1,2 @@
1
- import { An as beforeCreate, Cn as HookPhase, Dn as afterCreate, En as HookSystemOptions, Mn as beforeUpdate, Nn as createHookSystem, On as afterDelete, Pn as defineHook, Sn as HookOperation, Tn as HookSystem, bn as HookContext, jn as beforeDelete, kn as afterUpdate, wn as HookRegistration, xn as HookHandler, yn as DefineHookOptions } from "../interface-CS6d7HiB.mjs";
1
+ import { An as beforeCreate, Cn as HookPhase, Dn as afterCreate, En as HookSystemOptions, Mn as beforeUpdate, Nn as createHookSystem, On as afterDelete, Pn as defineHook, Sn as HookOperation, Tn as HookSystem, bn as HookContext, jn as beforeDelete, kn as afterUpdate, wn as HookRegistration, xn as HookHandler, yn as DefineHookOptions } from "../interface-BVuMfeVv.mjs";
2
2
  export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
@@ -1,6 +1,6 @@
1
- import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-CkkWm5uR.mjs";
2
- import { n as MongoIdempotencyStoreOptions } from "../mongodb-NShVZDMr.mjs";
3
- import { r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-Bunu3qWg.mjs";
1
+ import { i as createIdempotencyResult, n as IdempotencyResult, r as IdempotencyStore, t as IdempotencyLock } from "../interface-B-pe8fhj.mjs";
2
+ import { n as MongoIdempotencyStoreOptions } from "../mongodb-X7LbEjTN.mjs";
3
+ import { r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-z3sFr1UP.mjs";
4
4
  import { FastifyPluginAsync } from "fastify";
5
5
 
6
6
  //#region src/idempotency/idempotencyPlugin.d.ts
@@ -1,2 +1,2 @@
1
- import { n as MongoIdempotencyStoreOptions, t as MongoIdempotencyStore } from "../mongodb-NShVZDMr.mjs";
1
+ import { n as MongoIdempotencyStoreOptions, t as MongoIdempotencyStore } from "../mongodb-X7LbEjTN.mjs";
2
2
  export { MongoIdempotencyStore, type MongoIdempotencyStoreOptions };
@@ -5,11 +5,15 @@ var MongoIdempotencyStore = class {
5
5
  collectionName;
6
6
  ttlMs;
7
7
  indexCreated = false;
8
+ shouldEnsureIndex;
9
+ logger;
8
10
  constructor(options) {
9
11
  this.connection = options.connection;
10
12
  this.collectionName = options.collection ?? "arc_idempotency";
11
13
  this.ttlMs = options.ttlMs ?? 864e5;
12
- if (options.createIndex !== false) this.ensureIndex().catch(() => {});
14
+ this.shouldEnsureIndex = options.createIndex !== false;
15
+ this.logger = options.logger ?? console;
16
+ if (this.shouldEnsureIndex) this.ensureIndex().catch(() => {});
13
17
  }
14
18
  get collection() {
15
19
  return this.connection.db.collection(this.collectionName);
@@ -19,8 +23,13 @@ var MongoIdempotencyStore = class {
19
23
  try {
20
24
  await this.collection.createIndex({ expiresAt: 1 }, { expireAfterSeconds: 0 });
21
25
  this.indexCreated = true;
22
- } catch {
23
- this.indexCreated = true;
26
+ } catch (err) {
27
+ const code = err?.code;
28
+ if (code === 85 || code === 86) {
29
+ this.indexCreated = true;
30
+ return;
31
+ }
32
+ this.logger.warn(`[MongoIdempotencyStore] TTL index creation failed (will retry on next write): ${err.message ?? err}`);
24
33
  }
25
34
  }
26
35
  async get(key) {
@@ -37,6 +46,7 @@ var MongoIdempotencyStore = class {
37
46
  };
38
47
  }
39
48
  async set(key, result) {
49
+ if (this.shouldEnsureIndex && !this.indexCreated) await this.ensureIndex().catch(() => {});
40
50
  await this.collection.updateOne({ _id: key }, {
41
51
  $set: {
42
52
  result: {
@@ -51,6 +61,7 @@ var MongoIdempotencyStore = class {
51
61
  }, { upsert: true });
52
62
  }
53
63
  async tryLock(key, requestId, ttlMs) {
64
+ if (this.shouldEnsureIndex && !this.indexCreated) await this.ensureIndex().catch(() => {});
54
65
  const now = /* @__PURE__ */ new Date();
55
66
  const expiresAt = new Date(now.getTime() + ttlMs);
56
67
  try {
@@ -67,9 +78,10 @@ var MongoIdempotencyStore = class {
67
78
  expiresAt: new Date(now.getTime() + this.ttlMs)
68
79
  }
69
80
  }, { upsert: true });
70
- return result.matchedCount === 1 || result.modifiedCount === 1;
71
- } catch {
72
- return false;
81
+ return result.matchedCount === 1 || (result.upsertedCount ?? 0) === 1;
82
+ } catch (err) {
83
+ if (err?.code === 11e3) return false;
84
+ throw err;
73
85
  }
74
86
  }
75
87
  async unlock(key, requestId) {
@@ -1,2 +1,2 @@
1
- import { n as RedisIdempotencyStore, r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-Bunu3qWg.mjs";
1
+ import { n as RedisIdempotencyStore, r as RedisIdempotencyStoreOptions, t as RedisClient } from "../redis-z3sFr1UP.mjs";
2
2
  export { type RedisClient, RedisIdempotencyStore, type RedisIdempotencyStoreOptions };
@@ -51,7 +51,16 @@ var RedisIdempotencyStore = class {
51
51
  }) === "OK";
52
52
  }
53
53
  async unlock(key, requestId) {
54
- if (await this.client.get(this.lockKey(key)) === requestId) await this.client.del(this.lockKey(key));
54
+ const luaScript = `
55
+ if redis.call("get", KEYS[1]) == ARGV[1] then
56
+ return redis.call("del", KEYS[1])
57
+ else
58
+ return 0
59
+ end
60
+ `;
61
+ const lockKey = this.lockKey(key);
62
+ if (typeof this.client.eval === "function") await this.client.eval(luaScript, 1, lockKey, requestId);
63
+ else if (await this.client.get(lockKey) === requestId) await this.client.del(lockKey);
55
64
  }
56
65
  async isLocked(key) {
57
66
  return await this.client.exists(this.lockKey(key)) > 0;
@@ -1,4 +1,4 @@
1
- import { Y as OpenApiSchemas, Z as ParsedQuery, Zt as CrudRepository, c as ValidationResult, n as AdapterSchemaContext, nt as QueryParserInterface, o as RepositoryLike, r as DataAdapter, s as SchemaMetadata, vt as RouteSchemaOptions } from "./interface-CS6d7HiB.mjs";
1
+ import { Y as OpenApiSchemas, Z as ParsedQuery, Zt as CrudRepository, c as ValidationResult, n as AdapterSchemaContext, nt as QueryParserInterface, o as RepositoryLike, r as DataAdapter, s as SchemaMetadata, vt as RouteSchemaOptions } from "./interface-BVuMfeVv.mjs";
2
2
  import { Model } from "mongoose";
3
3
 
4
4
  //#region src/adapters/mongoose.d.ts
@@ -1,6 +1,6 @@
1
- import { r as RequestScope } from "./types-CN6JvmYz.mjs";
2
- import { n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-BoaZHr-2.mjs";
3
- import { i as CacheStore, t as CacheLogger } from "./interface-bpoLKKqx.mjs";
1
+ import { r as RequestScope } from "./types-C72d3NDn.mjs";
2
+ import { n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-CVC4HOKi.mjs";
3
+ import { i as CacheStore, t as CacheLogger } from "./interface-DplgQO2e.mjs";
4
4
  import { FastifyRequest } from "fastify";
5
5
 
6
6
  //#region src/permissions/applyPermissionResult.d.ts
@@ -1,6 +1,6 @@
1
- import { r as RequestScope } from "./types-CN6JvmYz.mjs";
2
- import { D as CrudRouterOptions, Ht as IControllerResponse, N as FastifyWithDecorators, T as CrudController, Ut as IRequestContext, Vt as IController, ct as RequestWithExtras, m as AnyRecord, ot as RequestContext, qt as ResourceDefinition, ut as ResourceConfig } from "./interface-CS6d7HiB.mjs";
3
- import { t as PermissionCheck } from "./types-BoaZHr-2.mjs";
1
+ import { r as RequestScope } from "./types-C72d3NDn.mjs";
2
+ import { D as CrudRouterOptions, Ht as IControllerResponse, N as FastifyWithDecorators, T as CrudController, Ut as IRequestContext, Vt as IController, ct as RequestWithExtras, m as AnyRecord, ot as RequestContext, qt as ResourceDefinition, ut as ResourceConfig } from "./interface-BVuMfeVv.mjs";
3
+ import { t as PermissionCheck } from "./types-CVC4HOKi.mjs";
4
4
  import { FastifyInstance, FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
5
5
 
6
6
  //#region src/constants.d.ts
@@ -160,6 +160,28 @@ interface IdempotencyService {
160
160
  * @param config - Action router configuration
161
161
  */
162
162
  declare function createActionRouter(fastify: FastifyInstance, config: ActionRouterConfig): void;
163
+ /**
164
+ * Build a discriminated body schema for the unified action endpoint.
165
+ *
166
+ * Produces a schema of the form:
167
+ * ```json
168
+ * {
169
+ * "type": "object",
170
+ * "required": ["action"],
171
+ * "oneOf": [
172
+ * { "properties": { "action": { "const": "dispatch" }, "carrier": {...} }, "required": ["action", "carrier"] },
173
+ * { "properties": { "action": { "const": "approve" } }, "required": ["action"] }
174
+ * ]
175
+ * }
176
+ * ```
177
+ *
178
+ * AJV validates this natively, so an action call missing required fields is
179
+ * rejected with HTTP 400 before the handler ever runs.
180
+ *
181
+ * Exported so OpenAPI generation and MCP tool generation can reuse the same
182
+ * schema shape (single source of truth).
183
+ */
184
+ declare function buildActionBodySchema(actionEnum: readonly string[], actionSchemas?: Record<string, Record<string, unknown>>): Record<string, unknown>;
163
185
  //#endregion
164
186
  //#region src/core/createCrudRouter.d.ts
165
187
  /**
@@ -287,4 +309,4 @@ declare function createCrudHandlers<TDoc>(controller: IController<TDoc>): {
287
309
  delete: (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
288
310
  };
289
311
  //#endregion
290
- export { MutationOperation as A, HOOK_PHASES as C, MAX_REGEX_LENGTH as D, MAX_FILTER_DEPTH as E, SYSTEM_FIELDS as M, MAX_SEARCH_LENGTH as O, HOOK_OPERATIONS as S, HookPhase as T, DEFAULT_LIMIT as _, getControllerScope as a, DEFAULT_TENANT_FIELD as b, createCrudRouter as c, ActionRouterConfig as d, IdempotencyService as f, DEFAULT_ID_FIELD as g, CrudOperation as h, getControllerContext as i, RESERVED_QUERY_PARAMS as j, MUTATION_OPERATIONS as k, createPermissionMiddleware as l, CRUD_OPERATIONS as m, createFastifyHandler as n, sendControllerResponse as o, createActionRouter as p, createRequestContext as r, defineResourceVariants as s, createCrudHandlers as t, ActionHandler as u, DEFAULT_MAX_LIMIT as v, HookOperation as w, DEFAULT_UPDATE_METHOD as x, DEFAULT_SORT as y };
312
+ export { MUTATION_OPERATIONS as A, HOOK_OPERATIONS as C, MAX_FILTER_DEPTH as D, HookPhase as E, RESERVED_QUERY_PARAMS as M, SYSTEM_FIELDS as N, MAX_REGEX_LENGTH as O, DEFAULT_UPDATE_METHOD as S, HookOperation as T, DEFAULT_ID_FIELD as _, getControllerScope as a, DEFAULT_SORT as b, createCrudRouter as c, ActionRouterConfig as d, IdempotencyService as f, CrudOperation as g, CRUD_OPERATIONS as h, getControllerContext as i, MutationOperation as j, MAX_SEARCH_LENGTH as k, createPermissionMiddleware as l, createActionRouter as m, createFastifyHandler as n, sendControllerResponse as o, buildActionBodySchema as p, createRequestContext as r, defineResourceVariants as s, createCrudHandlers as t, ActionHandler as u, DEFAULT_LIMIT as v, HOOK_PHASES as w, DEFAULT_TENANT_FIELD as x, DEFAULT_MAX_LIMIT as y };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- import { $ as PresetFunction, $t as DeleteOptions, At as BaseController, B as InferResourceDoc, C as ConfigError, Ct as TypedResourceConfig, D as CrudRouterOptions, Dt as ValidationResult$1, E as CrudRouteKey, Et as ValidateOptions, F as GracefulShutdownOptions, H as IntrospectionPluginOptions, Ht as IControllerResponse, I as HealthCheck, Jt as defineResource, K as MiddlewareConfig, L as HealthOptions, M as FastifyWithAuth, N as FastifyWithDecorators, O as CrudSchemas, Ot as envelope, P as FieldRule, Qt as DeleteManyResult, R as InferAdapterDoc, St as TypedRepository, T as CrudController, Tt as UserOrganization, U as JWTPayload, Ut as IRequestContext, V as IntrospectionData, Vt as IController, Wt as RouteHandler, X as OwnershipCheck, Xt as BulkWriteResult, Yt as BulkWriteOperation, Zt as CrudRepository, _ as ArcInternalMetadata, _n as PipelineStep, a as RelationMetadata, an as PaginationParams, at as RegistryStats, b as AuthPluginOptions, c as ValidationResult, cn as RepositorySession, ct as RequestWithExtras, dn as Guard, en as DeleteResult, fn as Interceptor, gn as PipelineContext, gt as RouteHandlerMethod, h as ApiResponse, hn as PipelineConfig, i as FieldMetadata, in as PaginatedResult, it as RegistryEntry, j as FastifyRequestExtras, jt as BaseControllerOptions, k as EventDefinition, ln as UpdateManyResult, m as AnyRecord, mn as OperationFilter, nn as KeysetPaginatedResult, o as RepositoryLike, on as PaginationResult, ot as RequestContext, p as AdditionalRoute, pn as NextFunction, pt as ResourceMetadata, q as MiddlewareHandler, qt as ResourceDefinition, r as DataAdapter, rn as OffsetPaginatedResult, rt as RateLimitConfig, s as SchemaMetadata, sn as QueryOptions, st as RequestIdOptions, tt as PresetResult, un as WriteOptions, ut as ResourceConfig, v as ArcRequest, vn as Transform, vt as RouteSchemaOptions, xt as TypedController, yt as ServiceContext, z as InferDocType, zt as ControllerLike } from "./interface-CS6d7HiB.mjs";
2
- import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-DoeDgh2b.mjs";
3
- import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-BoaZHr-2.mjs";
4
- import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-0zj73o2U.mjs";
5
- import { A as MutationOperation, C as HOOK_PHASES, D as MAX_REGEX_LENGTH, E as MAX_FILTER_DEPTH, M as SYSTEM_FIELDS, O as MAX_SEARCH_LENGTH, S as HOOK_OPERATIONS, T as HookPhase, _ as DEFAULT_LIMIT, a as getControllerScope, b as DEFAULT_TENANT_FIELD, g as DEFAULT_ID_FIELD, h as CrudOperation, j as RESERVED_QUERY_PARAMS, k as MUTATION_OPERATIONS, m as CRUD_OPERATIONS, s as defineResourceVariants, v as DEFAULT_MAX_LIMIT, w as HookOperation, x as DEFAULT_UPDATE_METHOD, y as DEFAULT_SORT } from "./index-DadoLP51.mjs";
6
- import { C as authenticated, D as publicRead, E as presets_d_exports, O as publicReadAdminWrite, S as adminOnly, T as ownerWithAdminBypass, _ as requireScopeContext, a as allOf, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgInScope, g as requireRoles, h as requireOwnership, k as readOnly, l as createOrgPermissions, m as requireOrgRole, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgMembership, r as DynamicPermissionMatrixConfig, s as anyOf, u as denyAll, v as requireServiceScope, w as fullPublic, x as when, y as requireTeamMembership } from "./index-CBru2y5Y.mjs";
7
- import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-BI8kEKsO.mjs";
1
+ import { $ as PresetFunction, $t as DeleteOptions, At as BaseController, B as InferResourceDoc, C as ConfigError, Ct as TypedResourceConfig, D as CrudRouterOptions, Dt as ValidationResult$1, E as CrudRouteKey, Et as ValidateOptions, F as GracefulShutdownOptions, H as IntrospectionPluginOptions, Ht as IControllerResponse, I as HealthCheck, Jt as defineResource, K as MiddlewareConfig, L as HealthOptions, M as FastifyWithAuth, N as FastifyWithDecorators, O as CrudSchemas, Ot as envelope, P as FieldRule, Qt as DeleteManyResult, R as InferAdapterDoc, St as TypedRepository, T as CrudController, Tt as UserOrganization, U as JWTPayload, Ut as IRequestContext, V as IntrospectionData, Vt as IController, Wt as RouteHandler, X as OwnershipCheck, Xt as BulkWriteResult, Yt as BulkWriteOperation, Zt as CrudRepository, _ as ArcInternalMetadata, _n as PipelineStep, a as RelationMetadata, an as PaginationParams, at as RegistryStats, b as AuthPluginOptions, c as ValidationResult, cn as RepositorySession, ct as RequestWithExtras, dn as Guard, en as DeleteResult, fn as Interceptor, gn as PipelineContext, gt as RouteHandlerMethod, h as ApiResponse, hn as PipelineConfig, i as FieldMetadata, in as PaginatedResult, it as RegistryEntry, j as FastifyRequestExtras, jt as BaseControllerOptions, k as EventDefinition, ln as UpdateManyResult, m as AnyRecord, mn as OperationFilter, nn as KeysetPaginatedResult, o as RepositoryLike, on as PaginationResult, ot as RequestContext, p as AdditionalRoute, pn as NextFunction, pt as ResourceMetadata, q as MiddlewareHandler, qt as ResourceDefinition, r as DataAdapter, rn as OffsetPaginatedResult, rt as RateLimitConfig, s as SchemaMetadata, sn as QueryOptions, st as RequestIdOptions, tt as PresetResult, un as WriteOptions, ut as ResourceConfig, v as ArcRequest, vn as Transform, vt as RouteSchemaOptions, xt as TypedController, yt as ServiceContext, z as InferDocType, zt as ControllerLike } from "./interface-BVuMfeVv.mjs";
2
+ import { a as applyFieldWritePermissions, i as applyFieldReadPermissions, n as FieldPermissionMap, o as fields, t as FieldPermission } from "./fields-DC4So2M2.mjs";
3
+ import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "./types-CVC4HOKi.mjs";
4
+ import { l as createMongooseAdapter, o as createPrismaAdapter, s as MongooseAdapter, t as PrismaAdapter } from "./index-BgmMdpm8.mjs";
5
+ import { A as MUTATION_OPERATIONS, C as HOOK_OPERATIONS, D as MAX_FILTER_DEPTH, E as HookPhase, M as RESERVED_QUERY_PARAMS, N as SYSTEM_FIELDS, O as MAX_REGEX_LENGTH, S as DEFAULT_UPDATE_METHOD, T as HookOperation, _ as DEFAULT_ID_FIELD, a as getControllerScope, b as DEFAULT_SORT, g as CrudOperation, h as CRUD_OPERATIONS, j as MutationOperation, k as MAX_SEARCH_LENGTH, s as defineResourceVariants, v as DEFAULT_LIMIT, w as HOOK_PHASES, x as DEFAULT_TENANT_FIELD, y as DEFAULT_MAX_LIMIT } from "./index-CpTSDqmD.mjs";
6
+ import { C as authenticated, D as publicRead, E as presets_d_exports, O as publicReadAdminWrite, S as adminOnly, T as ownerWithAdminBypass, _ as requireScopeContext, a as allOf, c as createDynamicPermissionMatrix, d as requireAuth, f as requireOrgInScope, g as requireRoles, h as requireOwnership, k as readOnly, l as createOrgPermissions, m as requireOrgRole, n as DynamicPermissionMatrix, o as allowPublic, p as requireOrgMembership, r as DynamicPermissionMatrixConfig, s as anyOf, u as denyAll, v as requireServiceScope, w as fullPublic, x as when, y as requireTeamMembership } from "./index-CSkeivBx.mjs";
7
+ import { a as NotFoundError, d as ValidationError, f as createDomainError, i as ForbiddenError, t as ArcError, u as UnauthorizedError } from "./errors-Bmn3eZT6.mjs";
8
8
  import { AsyncLocalStorage } from "node:async_hooks";
9
9
  import { RouteHandlerMethod as RouteHandlerMethod$1 } from "fastify";
10
10
 
package/dist/index.mjs CHANGED
@@ -5,9 +5,9 @@ import { envelope } from "./types/index.mjs";
5
5
  import { n as applyFieldWritePermissions, r as fields, t as applyFieldReadPermissions } from "./fields-ipsbIRPK.mjs";
6
6
  import { t as requestContext } from "./requestContext-DYvHl113.mjs";
7
7
  import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-BF2bIOIS.mjs";
8
- import { a as validateResourceConfig, f as getControllerScope, i as formatValidationErrors, m as pipe, n as defineResource, r as assertValidConfig, t as ResourceDefinition } from "./defineResource-CqeUltrW.mjs";
8
+ import { a as validateResourceConfig, f as getControllerScope, i as formatValidationErrors, m as pipe, n as defineResource, r as assertValidConfig, t as ResourceDefinition } from "./defineResource-Bb_Bdhtw.mjs";
9
9
  import { C as publicRead, S as presets_exports, T as readOnly, _ as when, a as createOrgPermissions, b as fullPublic, c as requireOrgInScope, d as requireOwnership, f as requireRoles, h as requireTeamMembership, i as createDynamicPermissionMatrix, l as requireOrgMembership, m as requireServiceScope, n as allowPublic, o as denyAll, p as requireScopeContext, r as anyOf, s as requireAuth, t as allOf, u as requireOrgRole, v as adminOnly, w as publicReadAdminWrite, x as ownerWithAdminBypass, y as authenticated } from "./permissions-CH4cNwJi.mjs";
10
- import { t as defineResourceVariants } from "./core-CrLDuqoT.mjs";
10
+ import { t as defineResourceVariants } from "./core-DKSwNSXf.mjs";
11
11
  import { n as configureArcLogger, t as arcLog } from "./logger-CDjpjySd.mjs";
12
12
  //#region src/middleware/middleware.ts
13
13
  /**
@@ -128,6 +128,6 @@ function transform(name, handlerOrOptions) {
128
128
  }
129
129
  //#endregion
130
130
  //#region src/index.ts
131
- const version = "2.8.1";
131
+ const version = "2.8.3";
132
132
  //#endregion
133
133
  export { ArcError, BaseController, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MongooseAdapter, NotFoundError, PrismaAdapter, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, arcLog, assertValidConfig, authenticated, configureArcLogger, createDomainError, createDynamicPermissionMatrix, createMongooseAdapter, createOrgPermissions, createPrismaAdapter, defineResource, defineResourceVariants, denyAll, envelope, fields, formatValidationErrors, fullPublic, getControllerScope, guard, intercept, middleware, ownerWithAdminBypass, presets_exports as permissions, pipe, publicRead, publicReadAdminWrite, readOnly, requestContext, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, sortMiddlewares, transform, validateResourceConfig, version, when };
@@ -1,4 +1,4 @@
1
- import { t as DomainEvent } from "../EventTransport-CLXJUzyT.mjs";
1
+ import { t as DomainEvent } from "../EventTransport-CinyO7zQ.mjs";
2
2
  import { WebSocketClient, WebSocketMessage } from "./websocket.mjs";
3
3
  import { FastifyPluginAsync, FastifyRequest } from "fastify";
4
4
 
@@ -4,7 +4,7 @@ const eventGatewayPluginImpl = async (fastify, opts = {}) => {
4
4
  const { auth = true, orgScoped = false, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
5
5
  if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
6
6
  if (opts.sse !== false) {
7
- const { default: ssePlugin } = await import("../sse-CD5Hghpu.mjs").then((n) => n.r);
7
+ const { default: ssePlugin } = await import("../sse-CJpt7LGI.mjs").then((n) => n.r);
8
8
  await fastify.register(ssePlugin, {
9
9
  path: opts.sse?.path ?? "/events/stream",
10
10
  requireAuth: auth,
@@ -1,7 +1,7 @@
1
1
  import { WebSocketClient, WebSocketMessage, WebSocketPluginOptions } from "./websocket.mjs";
2
2
  import { EventGatewayOptions } from "./event-gateway.mjs";
3
3
  import { JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, QueueStats } from "./jobs.mjs";
4
- import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-D3b7hA00.mjs";
4
+ import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-CcG4avic.mjs";
5
5
  import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
6
6
  import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
7
7
  export { type BetterAuthHandler, type CallToolResult, type CreateMcpServerConfig, type CrudOperation, type EventGatewayOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobsPluginOptions, type McpAuthResult, type McpPluginOptions, type McpResourceConfig, type PromptDefinition, type QueueStats, type StreamlinePluginOptions, type ToolAnnotations, type ToolContext, type ToolDefinition, type WebSocketClient, type WebSocketMessage, type WebSocketPluginOptions, type WebhookDeliveryRecord, type WebhookManager, type WebhookPluginOptions, type WebhookStore, type WebhookSubscription, type WorkflowLike, type WorkflowRunLike };
@@ -1,5 +1,5 @@
1
- import { qt as ResourceDefinition } from "../../interface-CS6d7HiB.mjs";
2
- import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-D3b7hA00.mjs";
1
+ import { qt as ResourceDefinition } from "../../interface-BVuMfeVv.mjs";
2
+ import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-CcG4avic.mjs";
3
3
  import { FastifyPluginAsync } from "fastify";
4
4
  import { z } from "zod";
5
5
 
@@ -1,4 +1,4 @@
1
- import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools-DNNWnZtx.mjs";
1
+ import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools-O_HwWXFa.mjs";
2
2
  import { createHash } from "node:crypto";
3
3
  import fp from "fastify-plugin";
4
4
  //#region src/integrations/mcp/definePrompt.ts
@@ -1,4 +1,4 @@
1
- import { o as McpAuthResult, s as McpPluginOptions } from "../../types-D3b7hA00.mjs";
1
+ import { o as McpAuthResult, s as McpPluginOptions } from "../../types-CcG4avic.mjs";
2
2
 
3
3
  //#region src/integrations/mcp/testing.d.ts
4
4
  interface TestMcpClientOptions {
@@ -1,4 +1,4 @@
1
- import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-DNNWnZtx.mjs";
1
+ import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-O_HwWXFa.mjs";
2
2
  //#region src/integrations/mcp/testing.ts
3
3
  /**
4
4
  * @classytic/arc/mcp/testing — MCP Test Utilities