@classytic/arc 2.50.0 → 2.51.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.
- package/dist/{EventTransport-B18mcj_M.mjs → EventTransport-K7Q9WPjm.mjs} +2 -2
- package/dist/{HookSystem-FUBaLTRm.mjs → HookSystem-DBAu9uNT.mjs} +2 -2
- package/dist/{ResourceRegistry-C5NM07fZ.mjs → ResourceRegistry-BelzCRMy.mjs} +2 -2
- package/dist/{acquire-MHCnbDtH.mjs → acquire-B0zhfGSm.mjs} +1 -1
- package/dist/audit/index.mjs +4 -4
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +30 -0
- package/dist/auth/index.mjs +172 -32
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/auth/social/index.d.mts +42 -0
- package/dist/auth/social/index.mjs +311 -0
- package/dist/{authorizationDecision-BD8K4jdQ.mjs → authorizationDecision-Dxj_cy6N.mjs} +4 -4
- package/dist/{boundedMap-CuCwos_X.mjs → boundedMap-DOBai-H3.mjs} +1 -1
- package/dist/{buildHandler-BttjNkTM.mjs → buildHandler-Dyl8P9j0.mjs} +5 -5
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-CxUQLHfR.mjs → caching-CUmaNL8Y.mjs} +2 -2
- package/dist/{claimed-CQ4ZpD8K.mjs → claimed-DJPk4VZr.mjs} +1 -1
- package/dist/cleanup/index.mjs +4 -4
- package/dist/cli/commands/describe.mjs +3 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/commands/init.mjs +2 -2
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-BZFsZwJh.mjs → constants-DH41jnNT.mjs} +1 -1
- package/dist/context/index.mjs +5 -5
- package/dist/core/index.mjs +7 -7
- package/dist/{core-DWA1-5IE.mjs → core-DPmRWlpx.mjs} +3 -3
- package/dist/{createActionRouter-fP3l2xVF.mjs → createActionRouter-B1xhER6i.mjs} +5 -5
- package/dist/{createAggregationRouter-BJZeOmBa.mjs → createAggregationRouter-CNntJL-z.mjs} +7 -7
- package/dist/{createApp-Db9JRumw.mjs → createApp-DpG26bCu.mjs} +29 -29
- package/dist/{defineAggregation-BskqRz8M.mjs → defineAggregation-rI3EbZUg.mjs} +1 -1
- package/dist/{defineResource-B2vTvKzW.mjs → defineResource-5DcG_wlI.mjs} +8 -8
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.mjs +3 -3
- package/dist/{elevation-XoY0C73T.mjs → elevation-XFu7J3aj.mjs} +5 -5
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-BYI-JQMm.mjs → errorHandler-xDVUWOMu.mjs} +3 -3
- package/dist/{errors-3xaK0i9n.mjs → errors-KBZ3tQk5.mjs} +1 -1
- package/dist/{eventPlugin-CVQ9ddnL.mjs → eventPlugin-C4lNj2Dw.mjs} +8 -8
- package/dist/{eventTypes-UPYg7gW1.mjs → eventTypes-DZRoUAdk.mjs} +2 -2
- package/dist/events/index.mjs +8 -8
- package/dist/events/transports/redis-stream-entry.mjs +4 -4
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.mjs +6 -6
- package/dist/{fieldTypes-CxRvCaaZ.mjs → fieldTypes-DrXUW1jc.mjs} +2 -2
- package/dist/{fields-DLFcJiDe.mjs → fields-C5J8WTd2.mjs} +1 -1
- package/dist/{filter-merge-Bvjk_8dV.mjs → filter-merge-DTjYoDrj.mjs} +1 -1
- package/dist/{generate-0OpCUjUv.mjs → generate-SA8oMlLB.mjs} +2 -2
- package/dist/{headers-BROW65-r.mjs → headers-D5wrBLOk.mjs} +2 -2
- package/dist/{health-Cy6aOg1i.mjs → health-BLal039H.mjs} +1 -1
- package/dist/{health-Cfh-kYI_.mjs → health-vEo3fni4.mjs} +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/http-cache/index.mjs +4 -4
- package/dist/http-cache/purgers/cloudflare.mjs +2 -2
- package/dist/http-cache/purgers/fastly.mjs +2 -2
- package/dist/http-cache/testing/index.mjs +1 -1
- package/dist/idempotency/index.mjs +7 -7
- package/dist/idempotency/redis.mjs +2 -2
- package/dist/index.mjs +11 -11
- package/dist/{init-D7PQcvvL.mjs → init-DeKHaNZn.mjs} +22 -22
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.mjs +3 -3
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.mjs +4 -4
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{jsonBody-C0oREwUc.mjs → jsonBody-rDPGT5A9.mjs} +2 -2
- package/dist/{keys-CGlPoVSn.mjs → keys-t7i-lJ2r.mjs} +1 -1
- package/dist/{loadResources-Oi47dogA.mjs → loadResources-CcupAVJH.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-BW-LexBz.mjs → loadResourcesFromEntry-BpjYlaoj.mjs} +2 -2
- package/dist/logger/index.mjs +2 -2
- package/dist/{logger-BagW7_YA.mjs → logger-IL7Btm-N.mjs} +1 -1
- package/dist/{mcpPlugin-C6-wFsOX.mjs → mcpPlugin-BsdH7Vot.mjs} +21 -21
- package/dist/{memory-Bl7kv6TS.mjs → memory-Dkp6ZD3F.mjs} +3 -3
- package/dist/{metrics-CqnMJKrJ.mjs → metrics-CDPqgdKr.mjs} +3 -3
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-lbEbHUfI.mjs → module-KFxT1Iuk.mjs} +1 -1
- package/dist/{multipartBody-CqNezaB3.mjs → multipartBody-BHktuarE.mjs} +1 -1
- package/dist/{observeSend-BjilzlYl.mjs → observeSend-CY-sLanc.mjs} +1 -1
- package/dist/{openapi-DXNbadgd.mjs → openapi-DbeXiy2v.mjs} +6 -6
- package/dist/outbox-admin/index.mjs +5 -5
- package/dist/{outbox-module-k5rIszQ4.mjs → outbox-module-BWqkTE8-.mjs} +7 -7
- package/dist/permissions/index.mjs +7 -7
- package/dist/{permissions-BJylQopQ.mjs → permissions-e5YMrFbm.mjs} +9 -9
- package/dist/{pipe-D1cq8hET.mjs → pipe-CMnKfdF4.mjs} +2 -2
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{plan-iEgaS5_H.mjs → plan-BvLJGm3U.mjs} +1 -1
- package/dist/{plugin-DsLr6L4O.mjs → plugin-DYmu8uT4.mjs} +24 -24
- package/dist/plugins/index.mjs +18 -18
- package/dist/plugins/response-cache.mjs +4 -4
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-CX4ZvwCa.mjs → pluralize-ClwfBdIx.mjs} +1 -1
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.mjs +5 -5
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-D_suT4OY.mjs → presets-DX_lPabi.mjs} +4 -4
- package/dist/{projection-CmjGjFih.mjs → projection-DnZiFPPE.mjs} +2 -2
- package/dist/{purger.types-CZwkTZ7B.mjs → purger.types-BEzTVDOU.mjs} +1 -1
- package/dist/{queryCachePlugin-BDOPEAmH.mjs → queryCachePlugin-C57-Nj-g.mjs} +6 -6
- package/dist/{rateLimitKey-igF1x64n.mjs → rateLimitKey-B1RxyGt3.mjs} +1 -1
- package/dist/{realtime-Cq_ugiWw.mjs → realtime-C-VIoXMg.mjs} +11 -11
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-DmF9Akvn.mjs → registry-DbQvODPH.mjs} +2 -2
- package/dist/{relay-DA89IhFt.mjs → relay-B61seKq1.mjs} +5 -5
- package/dist/{renewingLease-DBtGUt8T.mjs → renewingLease-Dp7wmzNN.mjs} +1 -1
- package/dist/{replyHelpers-CUbeUc5q.mjs → replyHelpers-CHii_jIO.mjs} +2 -2
- package/dist/{requestContext-DO9Qv0gw.mjs → requestContext-C_mbAm8o.mjs} +1 -1
- package/dist/{requirement-C3GaQmkR.mjs → requirement-C8OsWLYp.mjs} +1 -1
- package/dist/{resourceRateLimit-KKn-sFhb.mjs → resourceRateLimit-DhbQZjE2.mjs} +2 -2
- package/dist/{rolldown-runtime-Ck1Tj4Ax.mjs → rolldown-runtime-HTi8KV7V.mjs} +1 -1
- package/dist/{routeValidator-BF7n34xV.mjs → routeValidator-DnQ2BGnH.mjs} +1 -1
- package/dist/{runtimeCapabilities-D0A4kkrC.mjs → runtimeCapabilities-G9QXHov1.mjs} +1 -1
- package/dist/{schedules-CLrQRSTt.mjs → schedules-DAthT5O3.mjs} +5 -5
- package/dist/{schemaConverter-JEmU21fu.mjs → schemaConverter-BOt_ed78.mjs} +2 -2
- package/dist/{schemaIR-wOffQlbq.mjs → schemaIR-MZVVj6Cw.mjs} +14 -14
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-CcTMRd7s.mjs → scope-btg-225w.mjs} +4 -4
- package/dist/{shutdown-BIR-QBYM.mjs → shutdown-Dfy8La90.mjs} +1 -1
- package/dist/{simpleEqualityMatcher-DqqJqovq.mjs → simpleEqualityMatcher-D5dOqbbj.mjs} +1 -1
- package/dist/{sse-OEuPpgss.mjs → sse-DivxX1m6.mjs} +7 -7
- package/dist/{sseStream-DknHE2K5.mjs → sseStream-hQxQjvre.mjs} +2 -2
- package/dist/{store-helpers-D4vtEXt2.mjs → store-helpers-DfqfssAw.mjs} +1 -1
- package/dist/{streaming-CcIpcx02.mjs → streaming-CQiOktsh.mjs} +1 -1
- package/dist/{subscriberIdentity-PO6kimAl.mjs → subscriberIdentity-Bf8VLqA7.mjs} +1 -1
- package/dist/{tenancy-CH2Kuksc.mjs → tenancy-Btmaf1MB.mjs} +2 -2
- package/dist/{tenantPreparation-BTGpblQW.mjs → tenantPreparation-4e3qyb6q.mjs} +4 -4
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.mjs +11 -11
- package/dist/testing/outboxStoreContract.mjs +2 -2
- package/dist/testing/requiredPorts.mjs +2 -2
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{timing-Dii5X7AP.mjs → timing-DXx0IWyi.mjs} +1 -1
- package/dist/{transactionContext-DMPhYEOt.mjs → transactionContext-DperjON1.mjs} +1 -1
- package/dist/{typeGuards-C1o_XEyp.mjs → typeGuards-eoQLIOh6.mjs} +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-BuV_cFqT.mjs → types-CcpISJe8.mjs} +4 -4
- package/dist/usage/index.mjs +4 -4
- package/dist/{userHelpers-D4m_pLSC.mjs → userHelpers-Cp5zqlEN.mjs} +1 -1
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-CxLMXGn5.mjs → utils-dKN-_315.mjs} +6 -6
- package/dist/{validate-CZ975J8N.mjs → validate-BZHaAdgy.mjs} +3 -3
- package/dist/{versioning-B2_8SBZo.mjs → versioning-CPLP0VbB.mjs} +3 -3
- package/dist/{workScope-B3W3r35s.mjs → workScope-BI72KXsI.mjs} +2 -2
- package/package.json +17 -12
- package/skills/arc/references/auth-better-auth.md +27 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/*! @classytic/arc v2.51.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,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as arcLog } from "./logger-
|
|
3
|
-
import { t as ArcError } from "./errors-
|
|
4
|
-
import { t as conjoinPolicyFilters } from "./filter-merge-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as arcLog } from "./logger-IL7Btm-N.mjs";
|
|
3
|
+
import { t as ArcError } from "./errors-KBZ3tQk5.mjs";
|
|
4
|
+
import { t as conjoinPolicyFilters } from "./filter-merge-DTjYoDrj.mjs";
|
|
5
5
|
// src/permissions/authorizationDecision.ts
|
|
6
6
|
const log = arcLog("permissions:enforce");
|
|
7
7
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as conjoinPolicyFilters } from "./filter-merge-
|
|
3
|
-
import { D as toRepositoryFilter } from "./plugin-
|
|
4
|
-
import { i as guessDate, t as coerceByType } from "./fieldTypes-
|
|
5
|
-
import { i as compileAggRequest, t as adapterSupportsAggregate } from "./validate-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as conjoinPolicyFilters } from "./filter-merge-DTjYoDrj.mjs";
|
|
3
|
+
import { D as toRepositoryFilter } from "./plugin-DYmu8uT4.mjs";
|
|
4
|
+
import { i as guessDate, t as coerceByType } from "./fieldTypes-DrXUW1jc.mjs";
|
|
5
|
+
import { i as compileAggRequest, t as adapterSupportsAggregate } from "./validate-BZHaAdgy.mjs";
|
|
6
6
|
// src/core/aggregation/buildHandler.ts
|
|
7
7
|
/**
|
|
8
8
|
* Framework-agnostic aggregation execution. Runs safety guards,
|
package/dist/cache/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { i as versionKey, n as hashParams, r as tagVersionKey, t as buildQueryKey } from "../keys-
|
|
3
|
-
import { t as MemoryCacheStore } from "../memory-
|
|
4
|
-
import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { i as versionKey, n as hashParams, r as tagVersionKey, t as buildQueryKey } from "../keys-t7i-lJ2r.mjs";
|
|
3
|
+
import { t as MemoryCacheStore } from "../memory-Dkp6ZD3F.mjs";
|
|
4
|
+
import { r as QueryCache, t as queryCachePlugin } from "../queryCachePlugin-C57-Nj-g.mjs";
|
|
5
5
|
// src/cache/redis.ts
|
|
6
6
|
/**
|
|
7
7
|
* Redis-backed cache store.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-HTi8KV7V.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
// src/plugins/caching.ts
|
|
5
5
|
var caching_exports = /* @__PURE__ */ __exportAll({ default: () => caching_default });
|
package/dist/cleanup/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as defineResource } from "../defineResource-
|
|
3
|
-
import { t as defineModule } from "../module-
|
|
4
|
-
import { g as getUserId } from "../types-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as defineResource } from "../defineResource-5DcG_wlI.mjs";
|
|
3
|
+
import { t as defineModule } from "../module-KFxT1Iuk.mjs";
|
|
4
|
+
import { g as getUserId } from "../types-CcpISJe8.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.
|
|
2
|
-
import { t as CRUD_OPERATIONS } from "../../constants-
|
|
3
|
-
import { n as stringifyMeasureMap } from "../../ResourceRegistry-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as CRUD_OPERATIONS } from "../../constants-DH41jnNT.mjs";
|
|
3
|
+
import { n as stringifyMeasureMap } from "../../ResourceRegistry-BelzCRMy.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.
|
|
2
|
-
import { t as buildOpenApiSpec } from "../../openapi-
|
|
3
|
-
import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as buildOpenApiSpec } from "../../openapi-DbeXiy2v.mjs";
|
|
3
|
+
import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-BpjYlaoj.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,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
export { t as generate } from "../../generate-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
export { t as generate } from "../../generate-SA8oMlLB.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
export { t as init } from "../../init-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
export { t as init } from "../../init-DeKHaNZn.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as loadResourcesFromEntry } from "../../loadResourcesFromEntry-BpjYlaoj.mjs";
|
|
3
3
|
// src/cli/commands/introspect.ts
|
|
4
4
|
function describePermission(value) {
|
|
5
5
|
if (!value) return "none";
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.51.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-
|
|
6
|
-
import { t as init } from "../init-
|
|
5
|
+
import { t as generate } from "../generate-SA8oMlLB.mjs";
|
|
6
|
+
import { t as init } from "../init-DeKHaNZn.mjs";
|
|
7
7
|
import { introspect } from "./commands/introspect.mjs";
|
|
8
8
|
export { describe, doctor, exportDocs, generate, init, introspect };
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as requestContext, t as getTraceHeaders } from "../requestContext-
|
|
3
|
-
import { n as evictToSize, r as touch } from "../boundedMap-
|
|
4
|
-
import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-
|
|
5
|
-
import { t as transactionContext } from "../transactionContext-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as requestContext, t as getTraceHeaders } from "../requestContext-C_mbAm8o.mjs";
|
|
3
|
+
import { n as evictToSize, r as touch } from "../boundedMap-DOBai-H3.mjs";
|
|
4
|
+
import { n as scopedValue, r as workSeedFromEvent, t as runWorkScope } from "../workScope-BI72KXsI.mjs";
|
|
5
|
+
import { t as transactionContext } from "../transactionContext-DperjON1.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");
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
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-
|
|
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-
|
|
4
|
-
import { t as defineAggregation } from "../defineAggregation-
|
|
5
|
-
import { C as createFastifyHandler, D as sendControllerResponse, E as getControllerScope, T as getControllerContext, w as createRequestContext } from "../schemaIR-
|
|
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-
|
|
7
|
-
import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, r as formatValidationErrors, t as defineResource } from "../defineResource-
|
|
1
|
+
/*! @classytic/arc v2.51.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-DH41jnNT.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-DYmu8uT4.mjs";
|
|
4
|
+
import { t as defineAggregation } from "../defineAggregation-rI3EbZUg.mjs";
|
|
5
|
+
import { C as createFastifyHandler, D as sendControllerResponse, E as getControllerScope, T as getControllerContext, w as createRequestContext } from "../schemaIR-MZVVj6Cw.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-DPmRWlpx.mjs";
|
|
7
|
+
import { a as ResourceDefinition, i as validateResourceConfig, n as assertValidConfig, r as formatValidationErrors, t as defineResource } from "../defineResource-5DcG_wlI.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.
|
|
2
|
-
import "./constants-
|
|
3
|
-
import { t as defineResource } from "./defineResource-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import "./constants-DH41jnNT.mjs";
|
|
3
|
+
import { t as defineResource } from "./defineResource-5DcG_wlI.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.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import "./constants-
|
|
4
|
-
import { f as createError, i as NotFoundError, u as ValidationError } from "./errors-
|
|
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-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-HTi8KV7V.mjs";
|
|
3
|
+
import "./constants-DH41jnNT.mjs";
|
|
4
|
+
import { f as createError, i as NotFoundError, u as ValidationError } from "./errors-KBZ3tQk5.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-MZVVj6Cw.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.
|
|
2
|
-
import { n as evaluateAndApplyPermission } from "./authorizationDecision-
|
|
3
|
-
import { u as getRequestScope } from "./types-
|
|
4
|
-
import { f as createError } from "./errors-
|
|
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-
|
|
6
|
-
import { t as buildAggregationHandler } from "./buildHandler-
|
|
7
|
-
import { n as validateAggregations } from "./validate-
|
|
1
|
+
/*! @classytic/arc v2.51.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "./authorizationDecision-Dxj_cy6N.mjs";
|
|
3
|
+
import { u as getRequestScope } from "./types-CcpISJe8.mjs";
|
|
4
|
+
import { f as createError } from "./errors-KBZ3tQk5.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-MZVVj6Cw.mjs";
|
|
6
|
+
import { t as buildAggregationHandler } from "./buildHandler-Dyl8P9j0.mjs";
|
|
7
|
+
import { n as validateAggregations } from "./validate-BZHaAdgy.mjs";
|
|
8
8
|
// src/core/aggregation/createAggregationRouter.ts
|
|
9
9
|
/**
|
|
10
10
|
* Register one Fastify route per aggregation. No-op when the map is
|