@classytic/arc 2.50.0 → 2.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/{EventTransport-B18mcj_M.mjs → EventTransport-DeNze_-C.mjs} +2 -2
  2. package/dist/{HookSystem-FUBaLTRm.mjs → HookSystem-DTffXM1X.mjs} +2 -2
  3. package/dist/{ResourceRegistry-C5NM07fZ.mjs → ResourceRegistry-tlqXSZoK.mjs} +2 -2
  4. package/dist/{acquire-MHCnbDtH.mjs → acquire-7JKEkKnN.mjs} +1 -1
  5. package/dist/audit/index.mjs +4 -4
  6. package/dist/auth/audit.mjs +1 -1
  7. package/dist/auth/index.d.mts +30 -0
  8. package/dist/auth/index.mjs +172 -32
  9. package/dist/auth/redis-session.mjs +1 -1
  10. package/dist/auth/social/index.d.mts +42 -0
  11. package/dist/auth/social/index.mjs +311 -0
  12. package/dist/{authorizationDecision-BD8K4jdQ.mjs → authorizationDecision-DKmH4tZ-.mjs} +9 -7
  13. package/dist/{boundedMap-CuCwos_X.mjs → boundedMap-zxGBpXX0.mjs} +1 -1
  14. package/dist/{buildHandler-BttjNkTM.mjs → buildHandler-ZDV6LRZ_.mjs} +5 -5
  15. package/dist/cache/index.mjs +4 -4
  16. package/dist/{caching-CxUQLHfR.mjs → caching-DceUN9Xk.mjs} +2 -2
  17. package/dist/{claimed-CQ4ZpD8K.mjs → claimed-DsP5Hi_f.mjs} +1 -1
  18. package/dist/cleanup/index.mjs +4 -4
  19. package/dist/cli/commands/describe.mjs +3 -3
  20. package/dist/cli/commands/docs.mjs +3 -3
  21. package/dist/cli/commands/doctor.mjs +1 -1
  22. package/dist/cli/commands/generate.mjs +2 -2
  23. package/dist/cli/commands/init.mjs +2 -2
  24. package/dist/cli/commands/introspect.mjs +2 -2
  25. package/dist/cli/index.mjs +3 -3
  26. package/dist/{constants-BZFsZwJh.mjs → constants-Ca2IQFy2.mjs} +1 -1
  27. package/dist/context/index.mjs +5 -5
  28. package/dist/core/index.d.mts +1 -1
  29. package/dist/core/index.mjs +7 -7
  30. package/dist/{core-DWA1-5IE.mjs → core-M18RhMqi.mjs} +3 -3
  31. package/dist/{createActionRouter-fP3l2xVF.mjs → createActionRouter-zXlrwWVs.mjs} +5 -5
  32. package/dist/{createAggregationRouter-BJZeOmBa.mjs → createAggregationRouter-CN0Da9nC.mjs} +7 -7
  33. package/dist/{createApp-Db9JRumw.mjs → createApp-BC67ACu4.mjs} +29 -29
  34. package/dist/{defineAggregation-BskqRz8M.mjs → defineAggregation-DqAGb5oI.mjs} +1 -1
  35. package/dist/{defineResource-B2vTvKzW.mjs → defineResource-DC5UqkQv.mjs} +8 -8
  36. package/dist/discovery/index.mjs +1 -1
  37. package/dist/docs/index.mjs +3 -3
  38. package/dist/{elevation-XoY0C73T.mjs → elevation-DiXVg98q.mjs} +5 -5
  39. package/dist/encryption/index.d.mts +26 -1
  40. package/dist/encryption/index.mjs +56 -6
  41. package/dist/{errorHandler-BYI-JQMm.mjs → errorHandler-BUTm9P_f.mjs} +3 -3
  42. package/dist/{errors-3xaK0i9n.mjs → errors-DxpHZBlW.mjs} +1 -1
  43. package/dist/{eventPlugin-CVQ9ddnL.mjs → eventPlugin-ZsIQPRso.mjs} +8 -8
  44. package/dist/{eventTypes-UPYg7gW1.mjs → eventTypes-D-pFtqT1.mjs} +2 -2
  45. package/dist/events/index.mjs +8 -8
  46. package/dist/events/transports/redis-stream-entry.mjs +4 -4
  47. package/dist/events/transports/redis.mjs +2 -2
  48. package/dist/factory/index.d.mts +4 -4
  49. package/dist/factory/index.mjs +7 -7
  50. package/dist/{fastify-augmentation-baQc3MaO.d.mts → fastify-augmentation-CPReFhZ1.d.mts} +1 -1
  51. package/dist/{fieldTypes-CxRvCaaZ.mjs → fieldTypes-f-3TZgR3.mjs} +2 -2
  52. package/dist/{fields-DLFcJiDe.mjs → fields-kCbIDTjA.mjs} +1 -1
  53. package/dist/{filter-merge-Bvjk_8dV.mjs → filter-merge-UJCgjbZR.mjs} +1 -1
  54. package/dist/{generate-0OpCUjUv.mjs → generate-CLpmzbJ_.mjs} +2 -2
  55. package/dist/{headers-BROW65-r.mjs → headers-Bh47h0XH.mjs} +2 -2
  56. package/dist/{health-Cy6aOg1i.mjs → health-CEpgVAl7.mjs} +1 -1
  57. package/dist/{health-Cfh-kYI_.mjs → health-W4S2yFBL.mjs} +1 -1
  58. package/dist/hooks/index.mjs +2 -2
  59. package/dist/http-cache/index.mjs +4 -4
  60. package/dist/http-cache/purgers/cloudflare.mjs +2 -2
  61. package/dist/http-cache/purgers/fastly.mjs +2 -2
  62. package/dist/http-cache/testing/index.mjs +1 -1
  63. package/dist/idempotency/index.mjs +7 -7
  64. package/dist/idempotency/redis.mjs +2 -2
  65. package/dist/{index-DexdFs1a.d.mts → index-CSbDhif4.d.mts} +19 -1
  66. package/dist/{index-DKM2p5w5.d.mts → index-DCH08eqQ.d.mts} +1 -1
  67. package/dist/{index-Dhrks-hM.d.mts → index-yXXCsKl7.d.mts} +1 -1
  68. package/dist/index.d.mts +2 -2
  69. package/dist/index.mjs +11 -11
  70. package/dist/{init-D7PQcvvL.mjs → init-B43DXBpc.mjs} +22 -22
  71. package/dist/integrations/event-gateway.mjs +2 -2
  72. package/dist/integrations/index.mjs +1 -1
  73. package/dist/integrations/jobs/index.mjs +3 -3
  74. package/dist/integrations/mcp/index.mjs +2 -2
  75. package/dist/integrations/mcp/testing.mjs +2 -2
  76. package/dist/integrations/streamline.mjs +3 -3
  77. package/dist/integrations/webhooks.mjs +4 -4
  78. package/dist/integrations/websocket-pushref-redis.mjs +1 -1
  79. package/dist/integrations/websocket-redis.mjs +1 -1
  80. package/dist/integrations/websocket.mjs +2 -2
  81. package/dist/{jsonBody-C0oREwUc.mjs → jsonBody-CkKs6dA_.mjs} +2 -2
  82. package/dist/{keys-CGlPoVSn.mjs → keys-DHrHnT0f.mjs} +1 -1
  83. package/dist/{loadResources-Oi47dogA.mjs → loadResources-CFdzAWQZ.mjs} +3 -3
  84. package/dist/{loadResourcesFromEntry-BW-LexBz.mjs → loadResourcesFromEntry-DkoSiJsI.mjs} +2 -2
  85. package/dist/logger/index.mjs +2 -2
  86. package/dist/{logger-BagW7_YA.mjs → logger-DJwz_-Pl.mjs} +1 -1
  87. package/dist/{mcpPlugin-C6-wFsOX.mjs → mcpPlugin-CA_MDFlS.mjs} +21 -21
  88. package/dist/{memory-Bl7kv6TS.mjs → memory-B9CFHbA_.mjs} +3 -3
  89. package/dist/{metrics-CqnMJKrJ.mjs → metrics-DSKv-T9K.mjs} +3 -3
  90. package/dist/middleware/index.mjs +3 -3
  91. package/dist/migrations/index.mjs +2 -2
  92. package/dist/{module-lbEbHUfI.mjs → module-C0JCsnO7.mjs} +17 -2
  93. package/dist/{multipartBody-CqNezaB3.mjs → multipartBody-Bxz-q6hI.mjs} +1 -1
  94. package/dist/{observeSend-BjilzlYl.mjs → observeSend-DfNkdGww.mjs} +1 -1
  95. package/dist/{openapi-DXNbadgd.mjs → openapi-Dmp7Ipsi.mjs} +6 -6
  96. package/dist/outbox-admin/index.mjs +5 -5
  97. package/dist/{outbox-module-k5rIszQ4.mjs → outbox-module-vT6PaThj.mjs} +7 -7
  98. package/dist/permissions/index.mjs +7 -7
  99. package/dist/{permissions-BJylQopQ.mjs → permissions-Cga6KBOX.mjs} +9 -9
  100. package/dist/{pipe-D1cq8hET.mjs → pipe-CqPweKdL.mjs} +2 -2
  101. package/dist/pipeline/index.mjs +2 -2
  102. package/dist/{plan-iEgaS5_H.mjs → plan-CbDTFbTj.mjs} +1 -1
  103. package/dist/{plugin-DsLr6L4O.mjs → plugin-8Z1khbAI.mjs} +24 -24
  104. package/dist/plugins/index.d.mts +1 -1
  105. package/dist/plugins/index.mjs +18 -18
  106. package/dist/plugins/response-cache.mjs +4 -4
  107. package/dist/plugins/tracing-entry.mjs +2 -2
  108. package/dist/{pluralize-CX4ZvwCa.mjs → pluralize-D4vcPLVs.mjs} +1 -1
  109. package/dist/presets/filesUpload.mjs +5 -5
  110. package/dist/presets/index.mjs +2 -2
  111. package/dist/presets/multiTenant.mjs +5 -5
  112. package/dist/presets/search.mjs +2 -2
  113. package/dist/{presets-D_suT4OY.mjs → presets-D28IABZe.mjs} +4 -4
  114. package/dist/{projection-CmjGjFih.mjs → projection-aHCtDQQ9.mjs} +2 -2
  115. package/dist/{purger.types-CZwkTZ7B.mjs → purger.types-CNFmEtFu.mjs} +1 -1
  116. package/dist/{queryCachePlugin-BDOPEAmH.mjs → queryCachePlugin-CwpEjCwz.mjs} +6 -6
  117. package/dist/{rateLimitKey-igF1x64n.mjs → rateLimitKey-D9dl3FQn.mjs} +1 -1
  118. package/dist/{realtime-Cq_ugiWw.mjs → realtime-Dvu8ES2z.mjs} +11 -11
  119. package/dist/registry/index.d.mts +1 -1
  120. package/dist/registry/index.mjs +3 -3
  121. package/dist/{registry-DmF9Akvn.mjs → registry-DmxbzW7-.mjs} +2 -2
  122. package/dist/{relay-DA89IhFt.mjs → relay-CEaCmUfG.mjs} +5 -5
  123. package/dist/{renewingLease-DBtGUt8T.mjs → renewingLease-g2FjB3im.mjs} +1 -1
  124. package/dist/{replyHelpers-CUbeUc5q.mjs → replyHelpers-CSByAX_Z.mjs} +2 -2
  125. package/dist/{requestContext-DO9Qv0gw.mjs → requestContext-yc7MSgmq.mjs} +1 -1
  126. package/dist/{requirement-C3GaQmkR.mjs → requirement-Dm8njSoC.mjs} +1 -1
  127. package/dist/{resourceRateLimit-KKn-sFhb.mjs → resourceRateLimit-PQaY3HW1.mjs} +2 -2
  128. package/dist/{rolldown-runtime-Ck1Tj4Ax.mjs → rolldown-runtime-BBBkGgwA.mjs} +1 -1
  129. package/dist/{routeValidator-BF7n34xV.mjs → routeValidator-fuG51bQA.mjs} +1 -1
  130. package/dist/{runtimeCapabilities-D0A4kkrC.mjs → runtimeCapabilities-B8IT7xiQ.mjs} +1 -1
  131. package/dist/{schedules-CLrQRSTt.mjs → schedules-0-aS4jDV.mjs} +5 -5
  132. package/dist/{schemaConverter-JEmU21fu.mjs → schemaConverter-Cs3SwP4R.mjs} +2 -2
  133. package/dist/{schemaIR-wOffQlbq.mjs → schemaIR-By8XiNeE.mjs} +14 -14
  134. package/dist/schemas/index.mjs +1 -1
  135. package/dist/scim/index.mjs +2 -2
  136. package/dist/scope/index.mjs +5 -5
  137. package/dist/{scope-CcTMRd7s.mjs → scope-BWNAlBj0.mjs} +4 -4
  138. package/dist/{shutdown-BIR-QBYM.mjs → shutdown-Cf-27xsS.mjs} +1 -1
  139. package/dist/{simpleEqualityMatcher-DqqJqovq.mjs → simpleEqualityMatcher-e-dgJcUO.mjs} +1 -1
  140. package/dist/{sse-OEuPpgss.mjs → sse-C3bj5qWi.mjs} +7 -7
  141. package/dist/{sseStream-DknHE2K5.mjs → sseStream-BYZbpFDa.mjs} +2 -2
  142. package/dist/{store-helpers-D4vtEXt2.mjs → store-helpers-B9HierHY.mjs} +1 -1
  143. package/dist/{streaming-CcIpcx02.mjs → streaming-EN8NJWxr.mjs} +1 -1
  144. package/dist/{subscriberIdentity-PO6kimAl.mjs → subscriberIdentity-DSqCh38x.mjs} +1 -1
  145. package/dist/{tenancy-CH2Kuksc.mjs → tenancy-CAqjGQcQ.mjs} +2 -2
  146. package/dist/{tenantPreparation-BTGpblQW.mjs → tenantPreparation-CVBWarqs.mjs} +4 -4
  147. package/dist/testing/cleanupStoreContract.mjs +1 -1
  148. package/dist/testing/index.d.mts +2 -2
  149. package/dist/testing/index.mjs +11 -11
  150. package/dist/testing/outboxStoreContract.mjs +2 -2
  151. package/dist/testing/requiredPorts.mjs +2 -2
  152. package/dist/testing/storageContract.mjs +1 -1
  153. package/dist/{timing-Dii5X7AP.mjs → timing-CKI_Oyub.mjs} +1 -1
  154. package/dist/{transactionContext-DMPhYEOt.mjs → transactionContext-D0UZFoSy.mjs} +1 -1
  155. package/dist/{typeGuards-C1o_XEyp.mjs → typeGuards-CLYkmBLT.mjs} +1 -1
  156. package/dist/types/index.mjs +1 -1
  157. package/dist/types/storage.mjs +1 -1
  158. package/dist/{types-BuV_cFqT.mjs → types-Cunc4shv.mjs} +4 -4
  159. package/dist/usage/index.mjs +4 -4
  160. package/dist/{userHelpers-D4m_pLSC.mjs → userHelpers-cT5j1kgp.mjs} +1 -1
  161. package/dist/utils/index.mjs +12 -12
  162. package/dist/{utils-CxLMXGn5.mjs → utils-DlNkm1dI.mjs} +6 -6
  163. package/dist/{validate-CZ975J8N.mjs → validate-63QThRoS.mjs} +3 -3
  164. package/dist/{versioning-B2_8SBZo.mjs → versioning-f2YGmh4i.mjs} +3 -3
  165. package/dist/{workScope-B3W3r35s.mjs → workScope-DwspXz70.mjs} +2 -2
  166. package/package.json +17 -12
  167. package/skills/arc/references/auth-better-auth.md +27 -1
@@ -0,0 +1,311 @@
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
3
+ import { APIError, createAuthEndpoint, createAuthMiddleware, getOAuthState } from "better-auth/api";
4
+ import { makeSignature } from "better-auth/crypto";
5
+ import { parseUserOutput } from "better-auth/db";
6
+ import { isGoogleHostedDomainAllowed, verifyGoogleIdToken } from "better-auth/social-providers";
7
+ // src/auth/social/providers.ts
8
+ /** Comma list from an env value, trimmed, empties dropped. */
9
+ function list(value) {
10
+ return (value ?? "").split(",").map((item) => item.trim()).filter(Boolean);
11
+ }
12
+ /** An env value, trimmed; `undefined` when unset or blank. */
13
+ function read(env, key) {
14
+ const value = env[key]?.trim();
15
+ return value ? value : void 0;
16
+ }
17
+ /** Google profile → Better Auth user fields. `emailVerified` only on a literal `true`. */
18
+ function mapGoogleProfile(profile) {
19
+ const joined = [profile.given_name, profile.family_name].filter(Boolean).join(" ");
20
+ return {
21
+ name: profile.name || joined,
22
+ image: profile.picture || void 0,
23
+ emailVerified: profile.email_verified === true
24
+ };
25
+ }
26
+ /**
27
+ * Google `getUserInfo` that verifies the id token (signature against Google's JWKS, issuer,
28
+ * audience = every configured client id, expiry, max age 1h, nonce when the flow bound one)
29
+ * before mapping. `null` (sign-in refused) on any failure, as Better Auth's own providers do.
30
+ */
31
+ async function verifiedGoogleUserInfo(token, config) {
32
+ if (!token.idToken) return null;
33
+ const payload = await verifyGoogleIdToken({
34
+ token: token.idToken,
35
+ audience: config.clientId,
36
+ nonce: token.expectedIdTokenNonce
37
+ });
38
+ if (!payload || typeof payload.sub !== "string" || typeof payload.email !== "string") return null;
39
+ if (!isGoogleHostedDomainAllowed(config.hd, payload.hd)) return null;
40
+ const profile = payload;
41
+ const mapped = await config.mapProfileToUser?.(profile);
42
+ return {
43
+ user: {
44
+ email: profile.email,
45
+ ...mapGoogleProfile(profile),
46
+ ...mapped
47
+ },
48
+ data: profile
49
+ };
50
+ }
51
+ const PRESETS = {
52
+ google: {
53
+ name: "Google",
54
+ required: ["GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET"],
55
+ build: (env) => {
56
+ const audiences = list(read(env, "GOOGLE_ID_TOKEN_AUDIENCES"));
57
+ const clientId = read(env, "GOOGLE_CLIENT_ID");
58
+ return {
59
+ clientId: audiences.length > 0 ? [clientId, ...audiences] : clientId,
60
+ clientSecret: read(env, "GOOGLE_CLIENT_SECRET"),
61
+ disableDefaultScope: true,
62
+ scope: [
63
+ "openid",
64
+ "email",
65
+ "profile"
66
+ ],
67
+ includeGrantedScopes: false,
68
+ prompt: "select_account",
69
+ accessType: "online",
70
+ mapProfileToUser: mapGoogleProfile
71
+ };
72
+ }
73
+ },
74
+ github: {
75
+ name: "GitHub",
76
+ required: ["GITHUB_CLIENT_ID", "GITHUB_CLIENT_SECRET"],
77
+ build: (env) => ({
78
+ clientId: read(env, "GITHUB_CLIENT_ID"),
79
+ clientSecret: read(env, "GITHUB_CLIENT_SECRET")
80
+ })
81
+ },
82
+ apple: {
83
+ name: "Apple",
84
+ required: ["APPLE_CLIENT_ID", "APPLE_CLIENT_SECRET"],
85
+ trustedOrigins: ["https://appleid.apple.com"],
86
+ build: (env) => {
87
+ const bundle = read(env, "APPLE_APP_BUNDLE_IDENTIFIER");
88
+ return {
89
+ clientId: read(env, "APPLE_CLIENT_ID"),
90
+ clientSecret: read(env, "APPLE_CLIENT_SECRET"),
91
+ ...bundle ? { appBundleIdentifier: bundle } : {}
92
+ };
93
+ }
94
+ },
95
+ facebook: {
96
+ name: "Facebook",
97
+ required: ["FACEBOOK_CLIENT_ID", "FACEBOOK_CLIENT_SECRET"],
98
+ build: (env) => ({
99
+ clientId: read(env, "FACEBOOK_CLIENT_ID"),
100
+ clientSecret: read(env, "FACEBOOK_CLIENT_SECRET")
101
+ })
102
+ }
103
+ };
104
+ /** Display name of a preset provider, or `undefined` for an id arc has no preset for. */
105
+ function socialProviderName(id) {
106
+ return Object.hasOwn(PRESETS, id) ? PRESETS[id].name : void 0;
107
+ }
108
+ /**
109
+ * Better Auth `socialProviders`, the client-facing provider list and the extra trusted origins,
110
+ * for the providers `enabled` names. Throws on an unknown id, and on an enabled provider whose
111
+ * credentials are missing (the message names each missing variable).
112
+ *
113
+ * @example
114
+ * const social = defineSocialProviders({ enabled: process.env.SOCIAL_PROVIDERS ?? "" });
115
+ * betterAuth({ socialProviders: social.socialProviders, plugins: [socialAuth({ providers: social.providers })] });
116
+ */
117
+ function defineSocialProviders(options) {
118
+ const env = options.env ?? process.env;
119
+ const ids = [...new Set(typeof options.enabled === "string" ? list(options.enabled) : options.enabled)];
120
+ const unknown = ids.filter((id) => !Object.hasOwn(PRESETS, id));
121
+ if (unknown.length > 0) throw new Error(`defineSocialProviders: unknown provider ${unknown.map((id) => `"${id}"`).join(", ")}. Presets: ${Object.keys(PRESETS).join(", ")}. Configure others in betterAuth({ socialProviders }) directly.`);
122
+ const missing = ids.flatMap((id) => {
123
+ const absent = PRESETS[id].required.filter((key) => !read(env, key));
124
+ return absent.length > 0 ? [`"${id}" needs ${absent.join(", ")}`] : [];
125
+ });
126
+ if (missing.length > 0) throw new Error(`defineSocialProviders: enabled provider is missing credentials: ${missing.join("; ")}.`);
127
+ const socialProviders = {};
128
+ const trustedOrigins = /* @__PURE__ */ new Set();
129
+ for (const id of ids) {
130
+ const preset = PRESETS[id];
131
+ const override = options.overrides?.[id];
132
+ const config = {
133
+ ...preset.build(env),
134
+ ...override
135
+ };
136
+ if (id === "google" && !override?.getUserInfo) config.getUserInfo = (token) => verifiedGoogleUserInfo(token, config);
137
+ socialProviders[id] = config;
138
+ for (const origin of preset.trustedOrigins ?? []) trustedOrigins.add(origin);
139
+ }
140
+ return {
141
+ socialProviders,
142
+ providers: ids.map((id) => ({
143
+ id,
144
+ name: PRESETS[id].name
145
+ })),
146
+ trustedOrigins: [...trustedOrigins]
147
+ };
148
+ }
149
+ // src/auth/social/plugin.ts
150
+ /**
151
+ * `socialAuth()`: a Better Auth plugin that serves social sign-in under the auth catch-all.
152
+ *
153
+ * - `GET /social/providers`: the enabled providers, `{ providers: [{ id, name }] }`.
154
+ * - OAuth bearer handoff: a client that cannot rely on the API's cookie starts
155
+ * `signIn.social({ additionalData: { handoff: challenge } })` with challenge =
156
+ * base64url(SHA-256(verifier)). When the callback creates a NEW session and redirects to an
157
+ * absolute trusted URL, an after hook stores a single-use record (60 s, keyed by a hash of a
158
+ * random code, through Better Auth's verification store, so any database adapter works) and
159
+ * appends `#handoff=<code>` to the redirect. `POST /social/handoff { code, verifier }` consumes
160
+ * it and returns `{ token, user }` (plus `set-auth-token` when `bearer()` is installed).
161
+ * Every refusal is the same 400 `HANDOFF_INVALID`.
162
+ * - One Tap nonce: Better Auth's `/one-tap/callback` ignores a client `nonce`; when one is sent,
163
+ * a before hook verifies the id token with it and refuses a mismatch (400 `ONE_TAP_NONCE_MISMATCH`).
164
+ *
165
+ * Ordering: list `socialAuth()` BEFORE any plugin that strips the session Set-Cookie or rewrites
166
+ * the callback redirect; Better Auth runs plugin hooks in `plugins` order.
167
+ */
168
+ /** Lifetime of a handoff code. */
169
+ const HANDOFF_TTL_MS = 6e4;
170
+ /** base64url of 32 bytes (code) or of a SHA-256 digest (challenge). */
171
+ const B64URL_256 = /^[A-Za-z0-9_-]{43}$/;
172
+ /** PKCE-style verifier: 43 to 128 base64url characters. */
173
+ const VERIFIER = /^[A-Za-z0-9_-]{43,128}$/;
174
+ const sha256 = (value) => createHash("sha256").update(value).digest("base64url");
175
+ const handoffIdentifier = (code) => `social-handoff:${sha256(code)}`;
176
+ function handoffInvalid() {
177
+ return new APIError("BAD_REQUEST", {
178
+ code: "HANDOFF_INVALID",
179
+ message: "Invalid or expired handoff code"
180
+ });
181
+ }
182
+ /** `url` with `handoff=<code>` in its fragment; the query string is untouched. */
183
+ function withHandoffFragment(url, code) {
184
+ const hash = url.indexOf("#");
185
+ if (hash === -1) return `${url}#handoff=${code}`;
186
+ return url.slice(hash + 1) ? `${url}&handoff=${code}` : `${url}handoff=${code}`;
187
+ }
188
+ function isAbsoluteHttpUrl(value) {
189
+ try {
190
+ const { protocol } = new URL(value);
191
+ return protocol === "http:" || protocol === "https:";
192
+ } catch {
193
+ return false;
194
+ }
195
+ }
196
+ /** Equal-length base64url strings compared in constant time. */
197
+ function sameDigest(a, b) {
198
+ const left = Buffer.from(a);
199
+ const right = Buffer.from(b);
200
+ return left.length === right.length && timingSafeEqual(left, right);
201
+ }
202
+ /** Google client ids One Tap tokens may be minted for: the oneTap plugin's, then the provider's. */
203
+ function googleAudiences(options) {
204
+ const oneTap = options.plugins?.find((plugin) => plugin.id === "one-tap")?.options;
205
+ const google = options.socialProviders?.google;
206
+ return [oneTap?.clientId, ...[google?.clientId ?? []].flat()].filter((id) => typeof id === "string" && id.length > 0);
207
+ }
208
+ function socialAuth(options = {}) {
209
+ const names = new Map((options.providers ?? []).map((p) => [p.id, p.name]));
210
+ return {
211
+ id: "social",
212
+ endpoints: {
213
+ listSocialProviders: createAuthEndpoint("/social/providers", {
214
+ method: "GET",
215
+ metadata: { openapi: {
216
+ summary: "Enabled social sign-in providers",
217
+ responses: { 200: { description: "`{ providers: [{ id, name }] }`" } }
218
+ } }
219
+ }, async (ctx) => {
220
+ const providers = (ctx.context.socialProviders ?? []).map((p) => ({
221
+ id: p.id,
222
+ name: names.get(p.id) ?? socialProviderName(p.id) ?? p.name
223
+ }));
224
+ ctx.setHeader("Cache-Control", "public, max-age=300");
225
+ return ctx.json({ providers });
226
+ }),
227
+ exchangeSocialHandoff: createAuthEndpoint("/social/handoff", {
228
+ method: "POST",
229
+ metadata: { openapi: {
230
+ summary: "Exchange an OAuth handoff code for a session token",
231
+ description: "Body `{ code, verifier }`. Single use; 400 `HANDOFF_INVALID` on any refusal.",
232
+ responses: {
233
+ 200: { description: "`{ token, user }`" },
234
+ 400: { description: "`{ code: 'HANDOFF_INVALID' }`" }
235
+ }
236
+ } }
237
+ }, async (ctx) => {
238
+ const { code, verifier } = ctx.body ?? {};
239
+ if (typeof code !== "string" || !B64URL_256.test(code)) throw handoffInvalid();
240
+ if (typeof verifier !== "string" || !VERIFIER.test(verifier)) throw handoffInvalid();
241
+ const record = await ctx.context.internalAdapter.consumeVerificationValue(handoffIdentifier(code));
242
+ if (!record) throw handoffInvalid();
243
+ let stored;
244
+ try {
245
+ stored = JSON.parse(record.value);
246
+ } catch {
247
+ throw handoffInvalid();
248
+ }
249
+ if (typeof stored.sessionToken !== "string" || typeof stored.challenge !== "string") throw handoffInvalid();
250
+ if (!sameDigest(sha256(verifier), stored.challenge)) throw handoffInvalid();
251
+ const found = await ctx.context.internalAdapter.findSession(stored.sessionToken);
252
+ if (!found || new Date(found.session.expiresAt).getTime() <= Date.now()) throw handoffInvalid();
253
+ const token = found.session.token;
254
+ if (ctx.context.hasPlugin("bearer")) {
255
+ ctx.setHeader("set-auth-token", `${token}.${await makeSignature(token, ctx.context.secret)}`);
256
+ ctx.setHeader("Access-Control-Expose-Headers", "set-auth-token");
257
+ }
258
+ return ctx.json({
259
+ token,
260
+ user: parseUserOutput(ctx.context.options, found.user)
261
+ });
262
+ })
263
+ },
264
+ hooks: {
265
+ before: [{
266
+ matcher: (ctx) => ctx.path === "/one-tap/callback",
267
+ handler: createAuthMiddleware(async (ctx) => {
268
+ const body = ctx.body ?? {};
269
+ if (body.nonce === void 0) return;
270
+ const audience = googleAudiences(ctx.context.options);
271
+ if (!(typeof body.nonce === "string" && body.nonce.length > 0 && typeof body.idToken === "string" && audience.length > 0 && await verifyGoogleIdToken({
272
+ token: body.idToken,
273
+ audience,
274
+ nonce: body.nonce
275
+ }))) throw new APIError("BAD_REQUEST", {
276
+ code: "ONE_TAP_NONCE_MISMATCH",
277
+ message: "The id token does not carry the nonce this sign-in sent"
278
+ });
279
+ })
280
+ }],
281
+ after: [{
282
+ matcher: (ctx) => ctx.path === "/callback/:id",
283
+ handler: createAuthMiddleware(async (ctx) => {
284
+ const created = ctx.context.newSession;
285
+ if (!created) return;
286
+ const location = ctx.context.responseHeaders?.get("location");
287
+ if (!location || !isAbsoluteHttpUrl(location)) return;
288
+ if (!ctx.context.isTrustedOrigin(location)) return;
289
+ const challenge = (await getOAuthState())?.handoff;
290
+ if (typeof challenge !== "string" || !B64URL_256.test(challenge)) return;
291
+ const code = randomBytes(32).toString("base64url");
292
+ await ctx.context.internalAdapter.createVerificationValue({
293
+ identifier: handoffIdentifier(code),
294
+ value: JSON.stringify({
295
+ sessionToken: created.session.token,
296
+ challenge
297
+ }),
298
+ expiresAt: new Date(Date.now() + HANDOFF_TTL_MS)
299
+ });
300
+ ctx.setHeader("location", withHandoffFragment(location, code));
301
+ })
302
+ }]
303
+ },
304
+ rateLimit: [{
305
+ window: 60,
306
+ max: 10,
307
+ pathMatcher: (path) => path === "/social/handoff"
308
+ }]
309
+ };
310
+ }
311
+ export { defineSocialProviders, socialAuth };
@@ -1,7 +1,8 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as arcLog } from "./logger-BagW7_YA.mjs";
3
- import { t as ArcError } from "./errors-3xaK0i9n.mjs";
4
- import { t as conjoinPolicyFilters } from "./filter-merge-Bvjk_8dV.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as arcLog } from "./logger-DJwz_-Pl.mjs";
3
+ import { n as PUBLIC_SCOPE, y as isAuthenticated } from "./types-Cunc4shv.mjs";
4
+ import { t as ArcError } from "./errors-DxpHZBlW.mjs";
5
+ import { t as conjoinPolicyFilters } from "./filter-merge-UJCgjbZR.mjs";
5
6
  // src/permissions/authorizationDecision.ts
6
7
  const log = arcLog("permissions:enforce");
7
8
  /**
@@ -158,11 +159,12 @@ async function evaluateAndApplyPermission(check, context, request, reply, opts)
158
159
  }
159
160
  const { decision } = outcome;
160
161
  if (decision.effect !== "allow") {
161
- const defaultMsg = opts?.defaultDenialMessage?.(context.user) ?? (context.user ? "Permission denied" : "Authentication required");
162
+ const authenticated = context.user != null || isAuthenticated(request.scope ?? PUBLIC_SCOPE);
163
+ const defaultMsg = opts?.defaultDenialMessage?.(context.user) ?? (authenticated ? "Permission denied" : "Authentication required");
162
164
  const reason = decision.reason && decision.reason.length <= MAX_DENIAL_REASON_LENGTH ? decision.reason : defaultMsg;
163
- const status = context.user ? 403 : 401;
165
+ const status = authenticated ? 403 : 401;
164
166
  reply.code(status).send({
165
- code: context.user ? "arc.forbidden" : "arc.unauthorized",
167
+ code: authenticated ? "arc.forbidden" : "arc.unauthorized",
166
168
  message: reason,
167
169
  status
168
170
  });
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
2
  // src/collections/boundedMap.ts
3
3
  /**
4
4
  * Insertion-order LRU on a plain `Map` — the two moves, written once.
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as conjoinPolicyFilters } from "./filter-merge-Bvjk_8dV.mjs";
3
- import { D as toRepositoryFilter } from "./plugin-DsLr6L4O.mjs";
4
- import { i as guessDate, t as coerceByType } from "./fieldTypes-CxRvCaaZ.mjs";
5
- import { i as compileAggRequest, t as adapterSupportsAggregate } from "./validate-CZ975J8N.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as conjoinPolicyFilters } from "./filter-merge-UJCgjbZR.mjs";
3
+ import { D as toRepositoryFilter } from "./plugin-8Z1khbAI.mjs";
4
+ import { i as guessDate, t as coerceByType } from "./fieldTypes-f-3TZgR3.mjs";
5
+ import { i as compileAggRequest, t as adapterSupportsAggregate } from "./validate-63QThRoS.mjs";
6
6
  // src/core/aggregation/buildHandler.ts
7
7
  /**
8
8
  * Framework-agnostic aggregation execution. Runs safety guards,
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { i as versionKey, n as hashParams, r as tagVersionKey, t as buildQueryKey } from "../keys-CGlPoVSn.mjs";
3
- import { t as MemoryCacheStore } from "../memory-Bl7kv6TS.mjs";
4
- import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-BDOPEAmH.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { i as versionKey, n as hashParams, r as tagVersionKey, t as buildQueryKey } from "../keys-DHrHnT0f.mjs";
3
+ import { t as MemoryCacheStore } from "../memory-B9CFHbA_.mjs";
4
+ import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-CwpEjCwz.mjs";
5
5
  // src/cache/redis.ts
6
6
  /**
7
7
  * Redis-backed cache store.
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BBBkGgwA.mjs";
3
3
  import fp from "fastify-plugin";
4
4
  // src/plugins/caching.ts
5
5
  var caching_exports = /* @__PURE__ */ __exportAll({ default: () => caching_default });
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
2
  // src/events/outbox/claimed.ts
3
3
  function claimedAttempts(claimed) {
4
4
  const value = claimed.attempts;
@@ -1,7 +1,7 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as defineResource } from "../defineResource-B2vTvKzW.mjs";
3
- import { t as defineModule } from "../module-lbEbHUfI.mjs";
4
- import { g as getUserId } from "../types-BuV_cFqT.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as defineResource } from "../defineResource-DC5UqkQv.mjs";
3
+ import { t as defineModule } from "../module-C0JCsnO7.mjs";
4
+ import { g as getUserId } from "../types-Cunc4shv.mjs";
5
5
  import { createPurgeEvidence } from "@classytic/primitives/retention";
6
6
  import { canonicalJson, sha256Hex } from "@classytic/primitives/canonical";
7
7
  // src/cleanup/errors.ts
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as CRUD_OPERATIONS } from "../../constants-BZFsZwJh.mjs";
3
- import { n as stringifyMeasureMap } from "../../ResourceRegistry-C5NM07fZ.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as CRUD_OPERATIONS } from "../../constants-Ca2IQFy2.mjs";
3
+ import { n as stringifyMeasureMap } from "../../ResourceRegistry-tlqXSZoK.mjs";
4
4
  import { resolve } from "node:path";
5
5
  import { pathToFileURL } from "node:url";
6
6
  // src/cli/commands/describe.ts
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as buildOpenApiSpec } from "../../openapi-DXNbadgd.mjs";
3
- import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-BW-LexBz.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as buildOpenApiSpec } from "../../openapi-Dmp7Ipsi.mjs";
3
+ import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-DkoSiJsI.mjs";
4
4
  import { dirname, resolve } from "node:path";
5
5
  import { mkdirSync, writeFileSync } from "node:fs";
6
6
  // src/cli/commands/docs.ts
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
2
  import { dirname, join, parse, resolve } from "node:path";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  // src/cli/commands/doctor.ts
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- export { t as generate } from "../../generate-0OpCUjUv.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ export { t as generate } from "../../generate-CLpmzbJ_.mjs";
@@ -1,2 +1,2 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- export { t as init } from "../../init-D7PQcvvL.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ export { t as init } from "../../init-B43DXBpc.mjs";
@@ -1,5 +1,5 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-BW-LexBz.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-DkoSiJsI.mjs";
3
3
  // src/cli/commands/introspect.ts
4
4
  function describePermission(value) {
5
5
  if (!value) return "none";
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
2
  import { describe } from "./commands/describe.mjs";
3
3
  import { exportDocs } from "./commands/docs.mjs";
4
4
  import { doctor } from "./commands/doctor.mjs";
5
- import { t as generate } from "../generate-0OpCUjUv.mjs";
6
- import { t as init } from "../init-D7PQcvvL.mjs";
5
+ import { t as generate } from "../generate-CLpmzbJ_.mjs";
6
+ import { t as init } from "../init-B43DXBpc.mjs";
7
7
  import { introspect } from "./commands/introspect.mjs";
8
8
  export { describe, doctor, exportDocs, generate, init, introspect };
@@ -1,4 +1,4 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
2
  // src/constants.ts
3
3
  /**
4
4
  * Arc Framework Constants — Single Source of Truth
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { n as requestContext, t as getTraceHeaders } from "../requestContext-DO9Qv0gw.mjs";
3
- import { n as evictToSize, r as touch } from "../boundedMap-CuCwos_X.mjs";
4
- import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-B3W3r35s.mjs";
5
- import { t as transactionContext } from "../transactionContext-DMPhYEOt.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { n as requestContext, t as getTraceHeaders } from "../requestContext-yc7MSgmq.mjs";
3
+ import { n as evictToSize, r as touch } from "../boundedMap-zxGBpXX0.mjs";
4
+ import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-DwspXz70.mjs";
5
+ import { t as transactionContext } from "../transactionContext-D0UZFoSy.mjs";
6
6
  // src/context/requestScopedCache.ts
7
7
  /** The memo slot the per-scope store hangs off. */
8
8
  const SLOT = Symbol.for("arc.requestScopedCache");
@@ -1,4 +1,4 @@
1
1
 
2
2
  import { $t as getEntityIdField, An as ControllerConstructionOptions, Bt as SoftDeleteMixin, F as ResourceDefinition, Gt as BulkExt, Ht as TreeMixin, Jt as QueryResolver, Kt as BulkMixin, Mn as MixinConstructor, Nn as BodySanitizer, On as BaseControllerOptions, P as defineResource, Pn as BodySanitizerConfig, Qt as getEntityId, Rt as BaseController, Ut as SlugExt, Vt as TreeExt, Wt as SlugMixin, Xt as ActionTargetCheck, Yt as QueryResolverConfig, Zt as getActionTarget, an as FetchResult, at as AggregationCacheConfig, ct as AggregationIndexHint, dt as AggregationRateLimit, en as getEntityQuery, ft as AggregationsMap, in as FetchDenialReason, it as AggMeasureShorthand, jn as ListResult, kn as ControllerConfigurableOptions, lt as AggregationMaterializedContext, mt as AggregationFieldTypes, nn as AccessControlConfig, ot as AggregationConfig, pt as AggregationFieldType, qt as BaseCrudController, rn as AccessControlRepository, rt as AggMeasureInput, st as AggregationDateRangeRequirement, tn as AccessControl, ut as AggregationMaterializedResult, zt as SoftDeleteExt } from "../index-DLCcLUQT.mjs";
3
- import { $ as MAX_SEARCH_LENGTH, A as ResourceSeams, B as DEFAULT_ID_FIELD, C as getControllerScope, D as VariantsResult, E as VariantsMap, F as createCrudRouter, G as DEFAULT_UPDATE_METHOD, H as DEFAULT_MAX_LIMIT, I as createPermissionMiddleware, J as HOOK_PHASES, K as DEFAULT_VERSION_FIELD, L as defineAggregation, M as mergeResourceConfig, N as DefineActionConfig, O as defineResourceVariants, P as defineAction, Q as MAX_REGEX_LENGTH, R as CRUD_OPERATIONS, S as getControllerContext, T as VariantOverride, U as DEFAULT_SORT, V as DEFAULT_LIMIT, W as DEFAULT_TENANT_FIELD, X as HookPhase, Y as HookOperation, Z as MAX_FILTER_DEPTH, _ as nativePolicyFilter, a as formatValidationErrors, b as createFastifyHandler, c as InputSchema, d as RouteInputSlots, et as MUTATION_OPERATIONS, f as crudInput, g as NativePolicyFilter, h as routeInput, i as assertValidConfig, j as SeamedResourceConfig, k as AdapterLike, l as RouteInputIssue, m as parsed, n as ValidateOptions, nt as RESERVED_QUERY_PARAMS, o as validateResourceConfig, p as noPayloadSchema, q as HOOK_OPERATIONS, r as ValidationResult, rt as SYSTEM_FIELDS, s as CrudInput, t as ConfigError, tt as MutationOperation, u as RouteInputOptions, v as collectReadBlockedFields, w as sendControllerResponse, x as createRequestContext, y as isFieldReadable, z as CrudOperation } from "../index-DKM2p5w5.mjs";
3
+ import { $ as MAX_SEARCH_LENGTH, A as ResourceSeams, B as DEFAULT_ID_FIELD, C as getControllerScope, D as VariantsResult, E as VariantsMap, F as createCrudRouter, G as DEFAULT_UPDATE_METHOD, H as DEFAULT_MAX_LIMIT, I as createPermissionMiddleware, J as HOOK_PHASES, K as DEFAULT_VERSION_FIELD, L as defineAggregation, M as mergeResourceConfig, N as DefineActionConfig, O as defineResourceVariants, P as defineAction, Q as MAX_REGEX_LENGTH, R as CRUD_OPERATIONS, S as getControllerContext, T as VariantOverride, U as DEFAULT_SORT, V as DEFAULT_LIMIT, W as DEFAULT_TENANT_FIELD, X as HookPhase, Y as HookOperation, Z as MAX_FILTER_DEPTH, _ as nativePolicyFilter, a as formatValidationErrors, b as createFastifyHandler, c as InputSchema, d as RouteInputSlots, et as MUTATION_OPERATIONS, f as crudInput, g as NativePolicyFilter, h as routeInput, i as assertValidConfig, j as SeamedResourceConfig, k as AdapterLike, l as RouteInputIssue, m as parsed, n as ValidateOptions, nt as RESERVED_QUERY_PARAMS, o as validateResourceConfig, p as noPayloadSchema, q as HOOK_OPERATIONS, r as ValidationResult, rt as SYSTEM_FIELDS, s as CrudInput, t as ConfigError, tt as MutationOperation, u as RouteInputOptions, v as collectReadBlockedFields, w as sendControllerResponse, x as createRequestContext, y as isFieldReadable, z as CrudOperation } from "../index-DCH08eqQ.mjs";
4
4
  export { AccessControl, type AccessControlConfig, type AccessControlRepository, type ActionTargetCheck, type AdapterLike, type AggMeasureInput, type AggMeasureShorthand, type AggregationCacheConfig, type AggregationConfig, type AggregationDateRangeRequirement, type AggregationFieldType, type AggregationFieldTypes, type AggregationIndexHint, type AggregationMaterializedContext, type AggregationMaterializedResult, type AggregationRateLimit, type AggregationsMap, BaseController, type BaseControllerOptions, BaseCrudController, BodySanitizer, type BodySanitizerConfig, type BulkExt, BulkMixin, CRUD_OPERATIONS, type ConfigError, type ControllerConfigurableOptions, type ControllerConstructionOptions, type CrudInput, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, DEFAULT_VERSION_FIELD, type DefineActionConfig, type FetchDenialReason, type FetchResult, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, type InputSchema, type ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, type MixinConstructor, MutationOperation, type NativePolicyFilter, QueryResolver, type QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, type ResourceSeams, type RouteInputIssue, type RouteInputOptions, type RouteInputSlots, SYSTEM_FIELDS, type SeamedResourceConfig, type SlugExt, SlugMixin, type SoftDeleteExt, SoftDeleteMixin, type TreeExt, TreeMixin, type ValidateOptions, type ValidationResult, type VariantOverride, type VariantsMap, type VariantsResult, assertValidConfig, collectReadBlockedFields, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, crudInput, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getActionTarget, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, nativePolicyFilter, noPayloadSchema, parsed, routeInput, sendControllerResponse, validateResourceConfig };
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { a as DEFAULT_SORT, c as DEFAULT_VERSION_FIELD, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "../constants-BZFsZwJh.mjs";
3
- import { E as nativePolicyFilter, T as AccessControl, _ as BaseCrudController, a as crudInput, b as isFieldReadable, c as routeInput, d as createPermissionMiddleware, f as BaseController, g as BulkMixin, h as SlugMixin, m as SoftDeleteMixin, o as noPayloadSchema, p as TreeMixin, s as parsed, u as createCrudRouter, v as QueryResolver, w as BodySanitizer, y as collectReadBlockedFields } from "../plugin-DsLr6L4O.mjs";
4
- import { t as defineAggregation } from "../defineAggregation-BskqRz8M.mjs";
5
- import { C as createFastifyHandler, D as sendControllerResponse, E as getControllerScope, T as getControllerContext, w as createRequestContext } from "../schemaIR-wOffQlbq.mjs";
6
- import { a as defineResourceVariants, i as getEntityQuery, n as getEntityId, o as mergeResourceConfig, r as getEntityIdField, s as defineAction, t as getActionTarget } from "../core-DWA1-5IE.mjs";
7
- import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, r as formatValidationErrors, t as defineResource } from "../defineResource-B2vTvKzW.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { a as DEFAULT_SORT, c as DEFAULT_VERSION_FIELD, d as MAX_FILTER_DEPTH, f as MAX_REGEX_LENGTH, g as SYSTEM_FIELDS, h as RESERVED_QUERY_PARAMS, i as DEFAULT_MAX_LIMIT, l as HOOK_OPERATIONS, m as MUTATION_OPERATIONS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MAX_SEARCH_LENGTH, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as HOOK_PHASES } from "../constants-Ca2IQFy2.mjs";
3
+ import { E as nativePolicyFilter, T as AccessControl, _ as BaseCrudController, a as crudInput, b as isFieldReadable, c as routeInput, d as createPermissionMiddleware, f as BaseController, g as BulkMixin, h as SlugMixin, m as SoftDeleteMixin, o as noPayloadSchema, p as TreeMixin, s as parsed, u as createCrudRouter, v as QueryResolver, w as BodySanitizer, y as collectReadBlockedFields } from "../plugin-8Z1khbAI.mjs";
4
+ import { t as defineAggregation } from "../defineAggregation-DqAGb5oI.mjs";
5
+ import { C as createFastifyHandler, D as sendControllerResponse, E as getControllerScope, T as getControllerContext, w as createRequestContext } from "../schemaIR-By8XiNeE.mjs";
6
+ import { a as defineResourceVariants, i as getEntityQuery, n as getEntityId, o as mergeResourceConfig, r as getEntityIdField, s as defineAction, t as getActionTarget } from "../core-M18RhMqi.mjs";
7
+ import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, r as formatValidationErrors, t as defineResource } from "../defineResource-DC5UqkQv.mjs";
8
8
  export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, DEFAULT_VERSION_FIELD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, assertValidConfig, collectReadBlockedFields, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, crudInput, defineAction, defineAggregation, defineResource, defineResourceVariants, formatValidationErrors, getActionTarget, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, mergeResourceConfig, nativePolicyFilter, noPayloadSchema, parsed, routeInput, sendControllerResponse, validateResourceConfig };
@@ -1,6 +1,6 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import "./constants-BZFsZwJh.mjs";
3
- import { t as defineResource } from "./defineResource-B2vTvKzW.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import "./constants-Ca2IQFy2.mjs";
3
+ import { t as defineResource } from "./defineResource-DC5UqkQv.mjs";
4
4
  // src/core/defineAction.ts
5
5
  /**
6
6
  * Build an `ActionDefinition` with a typed handler. The literal schema
@@ -1,8 +1,8 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { t as __exportAll } from "./rolldown-runtime-Ck1Tj4Ax.mjs";
3
- import "./constants-BZFsZwJh.mjs";
4
- import { f as createError, i as NotFoundError, u as ValidationError } from "./errors-3xaK0i9n.mjs";
5
- import { D as sendControllerResponse, b as buildAuthMiddlewareForPermissions, c as buildRouteConfig, d as buildActionPipelineHandler, g as buildRouteHooks, l as resolveRouterPluginMw, m as buildActionPermissionMw, o as tryRegisterRoute, p as resolvePipelineSteps, r as schemaIRToJsonSchemaBranch, s as buildRateLimitConfig, t as actionSchemaIR, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator } from "./schemaIR-wOffQlbq.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { t as __exportAll } from "./rolldown-runtime-BBBkGgwA.mjs";
3
+ import "./constants-Ca2IQFy2.mjs";
4
+ import { f as createError, i as NotFoundError, u as ValidationError } from "./errors-DxpHZBlW.mjs";
5
+ import { D as sendControllerResponse, b as buildAuthMiddlewareForPermissions, c as buildRouteConfig, d as buildActionPipelineHandler, g as buildRouteHooks, l as resolveRouterPluginMw, m as buildActionPermissionMw, o as tryRegisterRoute, p as resolvePipelineSteps, r as schemaIRToJsonSchemaBranch, s as buildRateLimitConfig, t as actionSchemaIR, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator } from "./schemaIR-By8XiNeE.mjs";
6
6
  // src/core/createActionRouter.ts
7
7
  var createActionRouter_exports = /* @__PURE__ */ __exportAll({ createActionRouter: () => createActionRouter });
8
8
  /**
@@ -1,10 +1,10 @@
1
- /*! @classytic/arc v2.50.0 | MIT | https://classytic.com */
2
- import { n as evaluateAndApplyPermission } from "./authorizationDecision-BD8K4jdQ.mjs";
3
- import { u as getRequestScope } from "./types-BuV_cFqT.mjs";
4
- import { f as createError } from "./errors-3xaK0i9n.mjs";
5
- import { g as buildRouteHooks, l as resolveRouterPluginMw, o as tryRegisterRoute, s as buildRateLimitConfig, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator, y as buildAuthMiddleware } from "./schemaIR-wOffQlbq.mjs";
6
- import { t as buildAggregationHandler } from "./buildHandler-BttjNkTM.mjs";
7
- import { n as validateAggregations } from "./validate-CZ975J8N.mjs";
1
+ /*! @classytic/arc v2.52.0 | MIT | https://classytic.com */
2
+ import { n as evaluateAndApplyPermission } from "./authorizationDecision-DKmH4tZ-.mjs";
3
+ import { u as getRequestScope } from "./types-Cunc4shv.mjs";
4
+ import { f as createError } from "./errors-DxpHZBlW.mjs";
5
+ import { g as buildRouteHooks, l as resolveRouterPluginMw, o as tryRegisterRoute, s as buildRateLimitConfig, u as selectPluginMw, v as routeHookOptions, x as buildArcDecorator, y as buildAuthMiddleware } from "./schemaIR-By8XiNeE.mjs";
6
+ import { t as buildAggregationHandler } from "./buildHandler-ZDV6LRZ_.mjs";
7
+ import { n as validateAggregations } from "./validate-63QThRoS.mjs";
8
8
  // src/core/aggregation/createAggregationRouter.ts
9
9
  /**
10
10
  * Register one Fastify route per aggregation. No-op when the map is