@robelest/convex-auth 0.0.4-preview.13 → 0.0.4-preview.16
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/README.md +140 -9
- package/dist/bin.cjs +5957 -5478
- package/dist/client/index.d.ts +3 -7
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +27 -26
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +14 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +1672 -24
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts +2 -2
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/index.d.ts +1 -1
- package/dist/component/index.js +2 -2
- package/dist/component/model.d.ts +153 -0
- package/dist/component/model.d.ts.map +1 -0
- package/dist/component/model.js +343 -0
- package/dist/component/model.js.map +1 -0
- package/dist/component/providers/sso.d.ts +1 -1
- package/dist/component/public/enterprise.d.ts +54 -0
- package/dist/component/public/enterprise.d.ts.map +1 -0
- package/dist/component/public/enterprise.js +515 -0
- package/dist/component/public/enterprise.js.map +1 -0
- package/dist/component/public/factors.d.ts +52 -0
- package/dist/component/public/factors.d.ts.map +1 -0
- package/dist/component/public/factors.js +285 -0
- package/dist/component/public/factors.js.map +1 -0
- package/dist/component/public/groups.d.ts +116 -0
- package/dist/component/public/groups.d.ts.map +1 -0
- package/dist/component/public/groups.js +596 -0
- package/dist/component/public/groups.js.map +1 -0
- package/dist/component/public/identity.d.ts +93 -0
- package/dist/component/public/identity.d.ts.map +1 -0
- package/dist/component/public/identity.js +426 -0
- package/dist/component/public/identity.js.map +1 -0
- package/dist/component/public/keys.d.ts +41 -0
- package/dist/component/public/keys.d.ts.map +1 -0
- package/dist/component/public/keys.js +157 -0
- package/dist/component/public/keys.js.map +1 -0
- package/dist/component/public/shared.d.ts +26 -0
- package/dist/component/public/shared.d.ts.map +1 -0
- package/dist/component/public/shared.js +32 -0
- package/dist/component/public/shared.js.map +1 -0
- package/dist/component/public.d.ts +9 -321
- package/dist/component/public.d.ts.map +1 -1
- package/dist/component/public.js +6 -2145
- package/dist/component/schema.d.ts +406 -260
- package/dist/component/schema.js +37 -32
- package/dist/component/schema.js.map +1 -1
- package/dist/component/server/auth.d.ts +161 -15
- package/dist/component/server/auth.d.ts.map +1 -1
- package/dist/component/server/auth.js +100 -7
- package/dist/component/server/auth.js.map +1 -1
- package/dist/component/server/cookies.js +3 -0
- package/dist/component/server/cookies.js.map +1 -1
- package/dist/component/server/db.js +1 -0
- package/dist/component/server/db.js.map +1 -1
- package/dist/component/server/device.js +3 -1
- package/dist/component/server/device.js.map +1 -1
- package/dist/component/server/domains/core.js +629 -0
- package/dist/component/server/domains/core.js.map +1 -0
- package/dist/component/server/domains/sso.js +884 -0
- package/dist/component/server/domains/sso.js.map +1 -0
- package/dist/component/server/factory.d.ts +136 -0
- package/dist/component/server/factory.d.ts.map +1 -0
- package/dist/component/server/factory.js +1134 -0
- package/dist/component/server/factory.js.map +1 -0
- package/dist/component/server/fx.js +2 -1
- package/dist/component/server/fx.js.map +1 -1
- package/dist/component/server/http.js +287 -0
- package/dist/component/server/http.js.map +1 -0
- package/dist/component/server/identity.js +13 -0
- package/dist/component/server/identity.js.map +1 -0
- package/dist/component/server/keys.js +4 -0
- package/dist/component/server/keys.js.map +1 -1
- package/dist/component/server/mutations/account.js +1 -1
- package/dist/component/server/mutations/index.js +2 -2
- package/dist/component/server/mutations/index.js.map +1 -1
- package/dist/component/server/mutations/invalidate.js +1 -1
- package/dist/component/server/mutations/oauth.js +10 -7
- package/dist/component/server/mutations/oauth.js.map +1 -1
- package/dist/component/server/mutations/refresh.js +1 -1
- package/dist/component/server/mutations/register.js +1 -1
- package/dist/component/server/mutations/retrieve.js +1 -1
- package/dist/component/server/mutations/signature.js +1 -1
- package/dist/component/server/mutations/store.js +6 -3
- package/dist/component/server/mutations/store.js.map +1 -1
- package/dist/component/server/mutations/verify.js +1 -1
- package/dist/component/server/oauth.js +3 -0
- package/dist/component/server/oauth.js.map +1 -1
- package/dist/component/server/passkey.js +3 -2
- package/dist/component/server/passkey.js.map +1 -1
- package/dist/component/server/provider.js +2 -0
- package/dist/component/server/provider.js.map +1 -1
- package/dist/component/server/providers.js +10 -0
- package/dist/component/server/providers.js.map +1 -1
- package/dist/component/server/ratelimit.js +3 -0
- package/dist/component/server/ratelimit.js.map +1 -1
- package/dist/component/server/redirects.js +2 -0
- package/dist/component/server/redirects.js.map +1 -1
- package/dist/component/server/refresh.js +5 -0
- package/dist/component/server/refresh.js.map +1 -1
- package/dist/component/server/sessions.js +5 -0
- package/dist/component/server/sessions.js.map +1 -1
- package/dist/component/server/signin.js +2 -1
- package/dist/component/server/signin.js.map +1 -1
- package/dist/component/server/sso.js +166 -19
- package/dist/component/server/sso.js.map +1 -1
- package/dist/component/server/tokens.js +1 -0
- package/dist/component/server/tokens.js.map +1 -1
- package/dist/component/server/totp.js +4 -2
- package/dist/component/server/totp.js.map +1 -1
- package/dist/component/server/types.d.ts +106 -38
- package/dist/component/server/types.d.ts.map +1 -1
- package/dist/component/server/types.js.map +1 -1
- package/dist/component/server/users.js +1 -0
- package/dist/component/server/users.js.map +1 -1
- package/dist/component/server/utils.js +44 -2
- package/dist/component/server/utils.js.map +1 -1
- package/dist/providers/anonymous.d.ts +1 -1
- package/dist/providers/credentials.d.ts +1 -1
- package/dist/providers/password.d.ts +1 -1
- package/dist/providers/sso.d.ts +1 -1
- package/dist/providers/sso.js.map +1 -1
- package/dist/server/auth.d.ts +163 -17
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +100 -7
- package/dist/server/auth.js.map +1 -1
- package/dist/server/cookies.d.ts +1 -38
- package/dist/server/cookies.js +3 -0
- package/dist/server/cookies.js.map +1 -1
- package/dist/server/db.d.ts +1 -125
- package/dist/server/db.js +1 -0
- package/dist/server/db.js.map +1 -1
- package/dist/server/device.d.ts +1 -24
- package/dist/server/device.js +3 -1
- package/dist/server/device.js.map +1 -1
- package/dist/server/domains/core.d.ts +434 -0
- package/dist/server/domains/core.d.ts.map +1 -0
- package/dist/server/domains/core.js +629 -0
- package/dist/server/domains/core.js.map +1 -0
- package/dist/server/domains/sso.d.ts +409 -0
- package/dist/server/domains/sso.d.ts.map +1 -0
- package/dist/server/domains/sso.js +884 -0
- package/dist/server/domains/sso.js.map +1 -0
- package/dist/server/enterpriseValidators.d.ts +1 -0
- package/dist/server/enterpriseValidators.js +60 -0
- package/dist/server/enterpriseValidators.js.map +1 -0
- package/dist/server/factory.d.ts +136 -0
- package/dist/server/factory.d.ts.map +1 -0
- package/dist/server/factory.js +1134 -0
- package/dist/server/factory.js.map +1 -0
- package/dist/server/fx.d.ts +1 -16
- package/dist/server/fx.d.ts.map +1 -1
- package/dist/server/fx.js +1 -0
- package/dist/server/fx.js.map +1 -1
- package/dist/server/http.d.ts +59 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +287 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/identity.d.ts +1 -0
- package/dist/server/identity.js +13 -0
- package/dist/server/identity.js.map +1 -0
- package/dist/server/index.d.ts +468 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +530 -36
- package/dist/server/index.js.map +1 -1
- package/dist/server/keys.d.ts +1 -57
- package/dist/server/keys.js +4 -0
- package/dist/server/keys.js.map +1 -1
- package/dist/server/mutations/account.d.ts +7 -7
- package/dist/server/mutations/account.d.ts.map +1 -1
- package/dist/server/mutations/code.d.ts +13 -13
- package/dist/server/mutations/code.d.ts.map +1 -1
- package/dist/server/mutations/index.d.ts +107 -107
- package/dist/server/mutations/index.d.ts.map +1 -1
- package/dist/server/mutations/index.js +1 -1
- package/dist/server/mutations/index.js.map +1 -1
- package/dist/server/mutations/invalidate.d.ts +5 -5
- package/dist/server/mutations/invalidate.d.ts.map +1 -1
- package/dist/server/mutations/oauth.d.ts +10 -10
- package/dist/server/mutations/oauth.d.ts.map +1 -1
- package/dist/server/mutations/oauth.js +9 -6
- package/dist/server/mutations/oauth.js.map +1 -1
- package/dist/server/mutations/refresh.d.ts +4 -4
- package/dist/server/mutations/register.d.ts +12 -12
- package/dist/server/mutations/register.d.ts.map +1 -1
- package/dist/server/mutations/retrieve.d.ts +7 -7
- package/dist/server/mutations/signature.d.ts +5 -5
- package/dist/server/mutations/signin.d.ts +6 -6
- package/dist/server/mutations/signin.d.ts.map +1 -1
- package/dist/server/mutations/signout.d.ts +1 -1
- package/dist/server/mutations/store.d.ts +3 -2
- package/dist/server/mutations/store.d.ts.map +1 -1
- package/dist/server/mutations/store.js +6 -3
- package/dist/server/mutations/store.js.map +1 -1
- package/dist/server/mutations/verifier.d.ts +1 -1
- package/dist/server/mutations/verify.d.ts +11 -11
- package/dist/server/mutations/verify.d.ts.map +1 -1
- package/dist/server/oauth.d.ts +1 -59
- package/dist/server/oauth.js +3 -0
- package/dist/server/oauth.js.map +1 -1
- package/dist/server/passkey.d.ts.map +1 -1
- package/dist/server/passkey.js +3 -2
- package/dist/server/passkey.js.map +1 -1
- package/dist/server/provider.d.ts +1 -14
- package/dist/server/provider.d.ts.map +1 -1
- package/dist/server/provider.js +2 -0
- package/dist/server/provider.js.map +1 -1
- package/dist/server/providers.js +10 -0
- package/dist/server/providers.js.map +1 -1
- package/dist/server/ratelimit.d.ts +1 -22
- package/dist/server/ratelimit.js +3 -0
- package/dist/server/ratelimit.js.map +1 -1
- package/dist/server/redirects.d.ts +1 -10
- package/dist/server/redirects.js +2 -0
- package/dist/server/redirects.js.map +1 -1
- package/dist/server/refresh.d.ts +1 -37
- package/dist/server/refresh.js +5 -0
- package/dist/server/refresh.js.map +1 -1
- package/dist/server/sessions.d.ts +1 -28
- package/dist/server/sessions.js +5 -0
- package/dist/server/sessions.js.map +1 -1
- package/dist/server/signin.d.ts +1 -55
- package/dist/server/signin.js +2 -1
- package/dist/server/signin.js.map +1 -1
- package/dist/server/sso.d.ts +1 -348
- package/dist/server/sso.js +165 -18
- package/dist/server/sso.js.map +1 -1
- package/dist/server/templates.d.ts +1 -21
- package/dist/server/templates.js +1 -0
- package/dist/server/templates.js.map +1 -1
- package/dist/server/tokens.d.ts +1 -11
- package/dist/server/tokens.js +1 -0
- package/dist/server/tokens.js.map +1 -1
- package/dist/server/totp.d.ts +1 -23
- package/dist/server/totp.js +4 -2
- package/dist/server/totp.js.map +1 -1
- package/dist/server/types.d.ts +114 -77
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js.map +1 -1
- package/dist/server/users.d.ts +1 -31
- package/dist/server/users.js +1 -0
- package/dist/server/users.js.map +1 -1
- package/dist/server/utils.d.ts +1 -27
- package/dist/server/utils.js +44 -2
- package/dist/server/utils.js.map +1 -1
- package/dist/server/version.d.ts +1 -1
- package/dist/server/version.js +1 -1
- package/dist/server/version.js.map +1 -1
- package/package.json +4 -5
- package/src/cli/bin.ts +5 -0
- package/src/cli/index.ts +22 -9
- package/src/cli/keys.ts +3 -0
- package/src/client/index.ts +36 -37
- package/src/component/_generated/api.ts +14 -0
- package/src/component/_generated/component.ts +2106 -9
- package/src/component/index.ts +3 -1
- package/src/component/model.ts +441 -0
- package/src/component/public/enterprise.ts +753 -0
- package/src/component/public/factors.ts +332 -0
- package/src/component/public/groups.ts +932 -0
- package/src/component/public/identity.ts +566 -0
- package/src/component/public/keys.ts +209 -0
- package/src/component/public/shared.ts +119 -0
- package/src/component/public.ts +5 -2965
- package/src/component/schema.ts +68 -63
- package/src/providers/sso.ts +1 -1
- package/src/server/auth.ts +413 -18
- package/src/server/cookies.ts +3 -0
- package/src/server/db.ts +3 -0
- package/src/server/device.ts +3 -1
- package/src/server/domains/core.ts +1071 -0
- package/src/server/domains/sso.ts +1749 -0
- package/src/server/enterpriseValidators.ts +93 -0
- package/src/server/factory.ts +2181 -0
- package/src/server/fx.ts +1 -0
- package/src/server/http.ts +529 -0
- package/src/server/identity.ts +18 -0
- package/src/server/index.ts +806 -40
- package/src/server/keys.ts +4 -0
- package/src/server/mutations/index.ts +1 -1
- package/src/server/mutations/oauth.ts +36 -8
- package/src/server/mutations/store.ts +6 -3
- package/src/server/oauth.ts +6 -0
- package/src/server/passkey.ts +3 -2
- package/src/server/provider.ts +2 -0
- package/src/server/providers.ts +20 -0
- package/src/server/ratelimit.ts +3 -0
- package/src/server/redirects.ts +2 -0
- package/src/server/refresh.ts +5 -0
- package/src/server/sessions.ts +5 -0
- package/src/server/signin.ts +1 -0
- package/src/server/sso.ts +259 -17
- package/src/server/templates.ts +1 -0
- package/src/server/tokens.ts +1 -0
- package/src/server/totp.ts +4 -2
- package/src/server/types.ts +178 -83
- package/src/server/users.ts +1 -0
- package/src/server/utils.ts +71 -1
- package/src/server/version.ts +1 -1
- package/dist/component/public.js.map +0 -1
- package/dist/component/server/implementation.d.ts +0 -1264
- package/dist/component/server/implementation.d.ts.map +0 -1
- package/dist/component/server/implementation.js +0 -2365
- package/dist/component/server/implementation.js.map +0 -1
- package/dist/server/cookies.d.ts.map +0 -1
- package/dist/server/db.d.ts.map +0 -1
- package/dist/server/device.d.ts.map +0 -1
- package/dist/server/implementation.d.ts +0 -1264
- package/dist/server/implementation.d.ts.map +0 -1
- package/dist/server/implementation.js +0 -2365
- package/dist/server/implementation.js.map +0 -1
- package/dist/server/keys.d.ts.map +0 -1
- package/dist/server/oauth.d.ts.map +0 -1
- package/dist/server/ratelimit.d.ts.map +0 -1
- package/dist/server/redirects.d.ts.map +0 -1
- package/dist/server/refresh.d.ts.map +0 -1
- package/dist/server/sessions.d.ts.map +0 -1
- package/dist/server/signin.d.ts.map +0 -1
- package/dist/server/sso.d.ts.map +0 -1
- package/dist/server/templates.d.ts.map +0 -1
- package/dist/server/tokens.d.ts.map +0 -1
- package/dist/server/totp.d.ts.map +0 -1
- package/dist/server/users.d.ts.map +0 -1
- package/dist/server/utils.d.ts.map +0 -1
- package/src/server/implementation.ts +0 -5336
package/dist/server/keys.js
CHANGED
|
@@ -18,6 +18,7 @@ const VISIBLE_PREFIX_EXTRA_CHARS = 4;
|
|
|
18
18
|
* @param prefix - Key prefix, defaults to "sk_"
|
|
19
19
|
* @returns `{ raw, hashedKey, displayPrefix }`
|
|
20
20
|
*/
|
|
21
|
+
/** @internal */
|
|
21
22
|
async function generateApiKey(prefix = DEFAULT_KEY_PREFIX) {
|
|
22
23
|
const raw = `${prefix}${generateRandomString(KEY_RANDOM_LENGTH, KEY_RANDOM_ALPHABET)}`;
|
|
23
24
|
return {
|
|
@@ -31,6 +32,7 @@ async function generateApiKey(prefix = DEFAULT_KEY_PREFIX) {
|
|
|
31
32
|
*
|
|
32
33
|
* Used during Bearer token verification to find the stored key record.
|
|
33
34
|
*/
|
|
35
|
+
/** @internal */
|
|
34
36
|
async function hashApiKey(rawKey) {
|
|
35
37
|
return sha256(rawKey);
|
|
36
38
|
}
|
|
@@ -43,6 +45,7 @@ async function hashApiKey(rawKey) {
|
|
|
43
45
|
* A wildcard action `"*"` grants all actions on that resource.
|
|
44
46
|
* A wildcard resource `"*"` grants the action on all resources.
|
|
45
47
|
*/
|
|
48
|
+
/** @internal */
|
|
46
49
|
function buildScopeChecker(scopes) {
|
|
47
50
|
return {
|
|
48
51
|
scopes,
|
|
@@ -59,6 +62,7 @@ function buildScopeChecker(scopes) {
|
|
|
59
62
|
*
|
|
60
63
|
* @returns `{ limited: boolean; newState: { attemptsLeft, lastAttemptTime } }`
|
|
61
64
|
*/
|
|
65
|
+
/** @internal */
|
|
62
66
|
function checkKeyRateLimit(rateLimit, state) {
|
|
63
67
|
const now = Date.now();
|
|
64
68
|
if (!state) return {
|
package/dist/server/keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","names":[],"sources":["../../src/server/keys.ts"],"sourcesContent":["/**\n * API Key crypto utilities.\n *\n * Uses `@oslojs/crypto` primitives for key generation and hashing:\n * - SHA-256 for hashing keys (API keys have high entropy, no need for bcrypt)\n * - Cryptographically secure random generation for key material\n *\n * @module\n */\n\nimport type { KeyScope, ScopeChecker } from \"./types\";\nimport { sha256, generateRandomString } from \"./utils\";\n\n// ============================================================================\n// Constants\n// ============================================================================\n\nconst DEFAULT_KEY_PREFIX = \"sk_\";\nconst KEY_RANDOM_LENGTH = 32;\nconst KEY_RANDOM_ALPHABET =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n/**\n * How many characters of the full key to store as the visible prefix.\n * Includes the prefix string (e.g. \"sk_\") plus a few random chars.\n */\nconst VISIBLE_PREFIX_EXTRA_CHARS = 4;\n\n// ============================================================================\n// Key generation\n// ============================================================================\n\n/**\n * Generate a new API key.\n *\n * Returns the raw key (to be shown once to the user) and metadata for storage.\n * The raw key is `{prefix}{32 random alphanumeric chars}`.\n *\n * @param prefix - Key prefix, defaults to \"sk_\"\n * @returns `{ raw, hashedKey, displayPrefix }`\n */\nexport async function generateApiKey(\n prefix: string = DEFAULT_KEY_PREFIX,\n): Promise<{\n /** The full raw key — show to user once, never store. */\n raw: string;\n /** SHA-256 hex hash of the raw key — store this. */\n hashedKey: string;\n /** Truncated prefix for display (e.g. \"sk_aBc1...\"). */\n displayPrefix: string;\n}> {\n const randomPart = generateRandomString(\n KEY_RANDOM_LENGTH,\n KEY_RANDOM_ALPHABET,\n );\n const raw = `${prefix}${randomPart}`;\n const hashedKey = await sha256(raw);\n const displayPrefix = `${raw.substring(0, prefix.length + VISIBLE_PREFIX_EXTRA_CHARS)}...`;\n\n return { raw, hashedKey, displayPrefix };\n}\n\n/**\n * Hash a raw API key for lookup.\n *\n * Used during Bearer token verification to find the stored key record.\n */\nexport async function hashApiKey(rawKey: string): Promise<string> {\n return sha256(rawKey);\n}\n\n// ============================================================================\n// Scope checker\n// ============================================================================\n\n/**\n * Build a `ScopeChecker` from an array of `KeyScope` entries.\n *\n * The checker provides a `.can(resource, action)` method that returns `true`\n * if any scope entry grants the requested permission.\n *\n * A wildcard action `\"*\"` grants all actions on that resource.\n * A wildcard resource `\"*\"` grants the action on all resources.\n */\nexport function buildScopeChecker(scopes: KeyScope[]): ScopeChecker {\n return {\n scopes,\n can(resource: string, action: string): boolean {\n return scopes.some(\n (scope) =>\n (scope.resource === resource || scope.resource === \"*\") &&\n (scope.actions.includes(action) || scope.actions.includes(\"*\")),\n );\n },\n };\n}\n\n// ============================================================================\n// Per-key rate limiting (token-bucket)\n// ============================================================================\n\n/**\n * Check whether a key is rate-limited based on its stored state.\n *\n * Uses the same token-bucket algorithm as sign-in rate limiting:\n * tokens refill linearly over the configured window.\n *\n * @returns `{ limited: boolean; newState: { attemptsLeft, lastAttemptTime } }`\n */\nexport function checkKeyRateLimit(\n rateLimit: { maxRequests: number; windowMs: number },\n state: { attemptsLeft: number; lastAttemptTime: number } | undefined,\n): {\n limited: boolean;\n newState: { attemptsLeft: number; lastAttemptTime: number };\n} {\n const now = Date.now();\n\n if (!state) {\n // First request — create initial state with one token consumed.\n return {\n limited: false,\n newState: {\n attemptsLeft: rateLimit.maxRequests - 1,\n lastAttemptTime: now,\n },\n };\n }\n\n const elapsed = now - state.lastAttemptTime;\n const refillRate = rateLimit.maxRequests / rateLimit.windowMs;\n const refilled = Math.min(\n rateLimit.maxRequests,\n state.attemptsLeft + elapsed * refillRate,\n );\n\n if (refilled < 1) {\n return {\n limited: true,\n newState: {\n attemptsLeft: refilled,\n lastAttemptTime: now,\n },\n };\n }\n\n return {\n limited: false,\n newState: {\n attemptsLeft: refilled - 1,\n lastAttemptTime: now,\n },\n };\n}\n"],"mappings":";;;AAiBA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,MAAM,sBACJ;;;;;AAMF,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"keys.js","names":[],"sources":["../../src/server/keys.ts"],"sourcesContent":["/**\n * API Key crypto utilities.\n *\n * Uses `@oslojs/crypto` primitives for key generation and hashing:\n * - SHA-256 for hashing keys (API keys have high entropy, no need for bcrypt)\n * - Cryptographically secure random generation for key material\n *\n * @module\n */\n\nimport type { KeyScope, ScopeChecker } from \"./types\";\nimport { sha256, generateRandomString } from \"./utils\";\n\n// ============================================================================\n// Constants\n// ============================================================================\n\nconst DEFAULT_KEY_PREFIX = \"sk_\";\nconst KEY_RANDOM_LENGTH = 32;\nconst KEY_RANDOM_ALPHABET =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n\n/**\n * How many characters of the full key to store as the visible prefix.\n * Includes the prefix string (e.g. \"sk_\") plus a few random chars.\n */\nconst VISIBLE_PREFIX_EXTRA_CHARS = 4;\n\n// ============================================================================\n// Key generation\n// ============================================================================\n\n/**\n * Generate a new API key.\n *\n * Returns the raw key (to be shown once to the user) and metadata for storage.\n * The raw key is `{prefix}{32 random alphanumeric chars}`.\n *\n * @param prefix - Key prefix, defaults to \"sk_\"\n * @returns `{ raw, hashedKey, displayPrefix }`\n */\n/** @internal */\nexport async function generateApiKey(\n prefix: string = DEFAULT_KEY_PREFIX,\n): Promise<{\n /** The full raw key — show to user once, never store. */\n raw: string;\n /** SHA-256 hex hash of the raw key — store this. */\n hashedKey: string;\n /** Truncated prefix for display (e.g. \"sk_aBc1...\"). */\n displayPrefix: string;\n}> {\n const randomPart = generateRandomString(\n KEY_RANDOM_LENGTH,\n KEY_RANDOM_ALPHABET,\n );\n const raw = `${prefix}${randomPart}`;\n const hashedKey = await sha256(raw);\n const displayPrefix = `${raw.substring(0, prefix.length + VISIBLE_PREFIX_EXTRA_CHARS)}...`;\n\n return { raw, hashedKey, displayPrefix };\n}\n\n/**\n * Hash a raw API key for lookup.\n *\n * Used during Bearer token verification to find the stored key record.\n */\n/** @internal */\nexport async function hashApiKey(rawKey: string): Promise<string> {\n return sha256(rawKey);\n}\n\n// ============================================================================\n// Scope checker\n// ============================================================================\n\n/**\n * Build a `ScopeChecker` from an array of `KeyScope` entries.\n *\n * The checker provides a `.can(resource, action)` method that returns `true`\n * if any scope entry grants the requested permission.\n *\n * A wildcard action `\"*\"` grants all actions on that resource.\n * A wildcard resource `\"*\"` grants the action on all resources.\n */\n/** @internal */\nexport function buildScopeChecker(scopes: KeyScope[]): ScopeChecker {\n return {\n scopes,\n can(resource: string, action: string): boolean {\n return scopes.some(\n (scope) =>\n (scope.resource === resource || scope.resource === \"*\") &&\n (scope.actions.includes(action) || scope.actions.includes(\"*\")),\n );\n },\n };\n}\n\n// ============================================================================\n// Per-key rate limiting (token-bucket)\n// ============================================================================\n\n/**\n * Check whether a key is rate-limited based on its stored state.\n *\n * Uses the same token-bucket algorithm as sign-in rate limiting:\n * tokens refill linearly over the configured window.\n *\n * @returns `{ limited: boolean; newState: { attemptsLeft, lastAttemptTime } }`\n */\n/** @internal */\nexport function checkKeyRateLimit(\n rateLimit: { maxRequests: number; windowMs: number },\n state: { attemptsLeft: number; lastAttemptTime: number } | undefined,\n): {\n limited: boolean;\n newState: { attemptsLeft: number; lastAttemptTime: number };\n} {\n const now = Date.now();\n\n if (!state) {\n // First request — create initial state with one token consumed.\n return {\n limited: false,\n newState: {\n attemptsLeft: rateLimit.maxRequests - 1,\n lastAttemptTime: now,\n },\n };\n }\n\n const elapsed = now - state.lastAttemptTime;\n const refillRate = rateLimit.maxRequests / rateLimit.windowMs;\n const refilled = Math.min(\n rateLimit.maxRequests,\n state.attemptsLeft + elapsed * refillRate,\n );\n\n if (refilled < 1) {\n return {\n limited: true,\n newState: {\n attemptsLeft: refilled,\n lastAttemptTime: now,\n },\n };\n }\n\n return {\n limited: false,\n newState: {\n attemptsLeft: refilled - 1,\n lastAttemptTime: now,\n },\n };\n}\n"],"mappings":";;;AAiBA,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,MAAM,sBACJ;;;;;AAMF,MAAM,6BAA6B;;;;;;;;;;;AAgBnC,eAAsB,eACpB,SAAiB,oBAQhB;CAKD,MAAM,MAAM,GAAG,SAJI,qBACjB,mBACA,oBACD;AAKD,QAAO;EAAE;EAAK,WAHI,MAAM,OAAO,IAAI;EAGV,eAFH,GAAG,IAAI,UAAU,GAAG,OAAO,SAAS,2BAA2B,CAAC;EAE9C;;;;;;;;AAS1C,eAAsB,WAAW,QAAiC;AAChE,QAAO,OAAO,OAAO;;;;;;;;;;;;AAiBvB,SAAgB,kBAAkB,QAAkC;AAClE,QAAO;EACL;EACA,IAAI,UAAkB,QAAyB;AAC7C,UAAO,OAAO,MACX,WACE,MAAM,aAAa,YAAY,MAAM,aAAa,SAClD,MAAM,QAAQ,SAAS,OAAO,IAAI,MAAM,QAAQ,SAAS,IAAI,EACjE;;EAEJ;;;;;;;;;;;AAgBH,SAAgB,kBACd,WACA,OAIA;CACA,MAAM,MAAM,KAAK,KAAK;AAEtB,KAAI,CAAC,MAEH,QAAO;EACL,SAAS;EACT,UAAU;GACR,cAAc,UAAU,cAAc;GACtC,iBAAiB;GAClB;EACF;CAGH,MAAM,UAAU,MAAM,MAAM;CAC5B,MAAM,aAAa,UAAU,cAAc,UAAU;CACrD,MAAM,WAAW,KAAK,IACpB,UAAU,aACV,MAAM,eAAe,UAAU,WAChC;AAED,KAAI,WAAW,EACb,QAAO;EACL,SAAS;EACT,UAAU;GACR,cAAc;GACd,iBAAiB;GAClB;EACF;AAGH,QAAO;EACL,SAAS;EACT,UAAU;GACR,cAAc,WAAW;GACzB,iBAAiB;GAClB;EACF"}
|
|
@@ -2,25 +2,25 @@ import { MutationCtx } from "../types.js";
|
|
|
2
2
|
import { AuthError } from "../fx.js";
|
|
3
3
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
4
4
|
import { Fx } from "@robelest/fx";
|
|
5
|
-
import * as convex_values88 from "convex/values";
|
|
6
|
-
import { Infer } from "convex/values";
|
|
7
5
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
6
|
+
import * as convex_values1 from "convex/values";
|
|
7
|
+
import { Infer } from "convex/values";
|
|
8
8
|
|
|
9
9
|
//#region src/server/mutations/account.d.ts
|
|
10
|
-
declare const modifyAccountArgs:
|
|
10
|
+
declare const modifyAccountArgs: convex_values1.VObject<{
|
|
11
11
|
provider: string;
|
|
12
12
|
account: {
|
|
13
13
|
id: string;
|
|
14
14
|
secret: string;
|
|
15
15
|
};
|
|
16
16
|
}, {
|
|
17
|
-
provider:
|
|
18
|
-
account:
|
|
17
|
+
provider: convex_values1.VString<string, "required">;
|
|
18
|
+
account: convex_values1.VObject<{
|
|
19
19
|
id: string;
|
|
20
20
|
secret: string;
|
|
21
21
|
}, {
|
|
22
|
-
id:
|
|
23
|
-
secret:
|
|
22
|
+
id: convex_values1.VString<string, "required">;
|
|
23
|
+
secret: convex_values1.VString<string, "required">;
|
|
24
24
|
}, "required", "id" | "secret">;
|
|
25
25
|
}, "required", "provider" | "account" | "account.id" | "account.secret">;
|
|
26
26
|
declare function modifyAccountImpl(ctx: MutationCtx, args: Infer<typeof modifyAccountArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config): Fx<void, AuthError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","names":[],"sources":["../../../src/server/mutations/account.ts"],"mappings":";;;;;;;;;cAYa,iBAAA,
|
|
1
|
+
{"version":3,"file":"account.d.ts","names":[],"sources":["../../../src/server/mutations/account.ts"],"mappings":";;;;;;;;;cAYa,iBAAA,iBAAiB,OAAA;;;;;;;YAG5B,cAAA,CAAA,OAAA;;;;;;;;;iBAEc,iBAAA,CACd,GAAA,EAAK,WAAA,EACL,IAAA,EAAM,KAAA,QAAa,iBAAA,GACnB,kBAAA,EAAoB,sBAAA,EACpB,MAAA,EAAQ,MAAA,GACP,EAAA,OAAS,SAAA;AAAA,cA2CC,iBAAA,qBAA6C,gBAAA,EACxD,GAAA,EAAK,gBAAA,CAAiB,SAAA,GACtB,IAAA,EAAM,KAAA,QAAa,iBAAA,MAClB,OAAA"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { MutationCtx } from "../types.js";
|
|
2
2
|
import { Config, GetProviderOrThrowFunc } from "../provider.js";
|
|
3
|
-
import * as convex_values7 from "convex/values";
|
|
4
|
-
import { Infer } from "convex/values";
|
|
5
3
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
4
|
+
import * as convex_values16 from "convex/values";
|
|
5
|
+
import { Infer } from "convex/values";
|
|
6
6
|
|
|
7
7
|
//#region src/server/mutations/code.d.ts
|
|
8
|
-
declare const createVerificationCodeArgs:
|
|
8
|
+
declare const createVerificationCodeArgs: convex_values16.VObject<{
|
|
9
9
|
email?: string | undefined;
|
|
10
10
|
phone?: string | undefined;
|
|
11
11
|
accountId?: string | undefined;
|
|
12
|
-
expirationTime: number;
|
|
13
12
|
provider: string;
|
|
14
|
-
code: string;
|
|
15
13
|
allowExtraProviders: boolean;
|
|
14
|
+
code: string;
|
|
15
|
+
expirationTime: number;
|
|
16
16
|
}, {
|
|
17
|
-
accountId:
|
|
18
|
-
provider:
|
|
19
|
-
email:
|
|
20
|
-
phone:
|
|
21
|
-
code:
|
|
22
|
-
expirationTime:
|
|
23
|
-
allowExtraProviders:
|
|
24
|
-
}, "required", "email" | "phone" | "
|
|
17
|
+
accountId: convex_values16.VString<string | undefined, "optional">;
|
|
18
|
+
provider: convex_values16.VString<string, "required">;
|
|
19
|
+
email: convex_values16.VString<string | undefined, "optional">;
|
|
20
|
+
phone: convex_values16.VString<string | undefined, "optional">;
|
|
21
|
+
code: convex_values16.VString<string, "required">;
|
|
22
|
+
expirationTime: convex_values16.VFloat64<number, "required">;
|
|
23
|
+
allowExtraProviders: convex_values16.VBoolean<boolean, "required">;
|
|
24
|
+
}, "required", "email" | "phone" | "provider" | "allowExtraProviders" | "accountId" | "code" | "expirationTime">;
|
|
25
25
|
type ReturnType = string;
|
|
26
26
|
declare function createVerificationCodeImpl(ctx: MutationCtx, args: Infer<typeof createVerificationCodeArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config): Promise<ReturnType>;
|
|
27
27
|
declare const callCreateVerificationCode: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: Infer<typeof createVerificationCodeArgs>) => Promise<ReturnType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.d.ts","names":[],"sources":["../../../src/server/mutations/code.ts"],"mappings":";;;;;;;cAaa,0BAAA,
|
|
1
|
+
{"version":3,"file":"code.d.ts","names":[],"sources":["../../../src/server/mutations/code.ts"],"mappings":";;;;;;;cAaa,0BAAA,kBAA0B,OAAA;;;;;;;;;aAQrC,eAAA,CAAA,OAAA;;;;;;;;KAEG,UAAA;AAAA,iBAEiB,0BAAA,CACpB,GAAA,EAAK,WAAA,EACL,IAAA,EAAM,KAAA,QAAa,0BAAA,GACnB,kBAAA,EAAoB,sBAAA,EACpB,MAAA,EAAQ,MAAA,GACP,OAAA,CAAQ,UAAA;AAAA,cAoDE,0BAAA,qBACO,gBAAA,EAElB,GAAA,EAAK,gBAAA,CAAiB,SAAA,GACtB,IAAA,EAAM,KAAA,QAAa,0BAAA,MAClB,OAAA,CAAQ,UAAA"}
|
|
@@ -12,11 +12,11 @@ import { callVerifier } from "./verifier.js";
|
|
|
12
12
|
import { callRefreshSession } from "./refresh.js";
|
|
13
13
|
import { callSignOut } from "./signout.js";
|
|
14
14
|
import { callSignIn } from "./signin.js";
|
|
15
|
-
import * as
|
|
15
|
+
import * as convex_values32 from "convex/values";
|
|
16
16
|
import { Infer } from "convex/values";
|
|
17
17
|
|
|
18
18
|
//#region src/server/mutations/index.d.ts
|
|
19
|
-
declare const storeArgs:
|
|
19
|
+
declare const storeArgs: convex_values32.VObject<{
|
|
20
20
|
args: {
|
|
21
21
|
sessionId?: string | undefined;
|
|
22
22
|
type: "signIn";
|
|
@@ -31,9 +31,9 @@ declare const storeArgs: convex_values15.VObject<{
|
|
|
31
31
|
provider?: string | undefined;
|
|
32
32
|
verifier?: string | undefined;
|
|
33
33
|
type: "verifyCodeAndSignIn";
|
|
34
|
-
allowExtraProviders: boolean;
|
|
35
|
-
generateTokens: boolean;
|
|
36
34
|
params: any;
|
|
35
|
+
generateTokens: boolean;
|
|
36
|
+
allowExtraProviders: boolean;
|
|
37
37
|
} | {
|
|
38
38
|
type: "verifier";
|
|
39
39
|
} | {
|
|
@@ -42,40 +42,40 @@ declare const storeArgs: convex_values15.VObject<{
|
|
|
42
42
|
signature: string;
|
|
43
43
|
} | {
|
|
44
44
|
accountExtend?: any;
|
|
45
|
-
type: "userOAuth";
|
|
46
45
|
provider: string;
|
|
47
|
-
|
|
46
|
+
type: "userOAuth";
|
|
48
47
|
signature: string;
|
|
48
|
+
providerAccountId: string;
|
|
49
49
|
profile: any;
|
|
50
50
|
} | {
|
|
51
51
|
email?: string | undefined;
|
|
52
52
|
phone?: string | undefined;
|
|
53
53
|
accountId?: string | undefined;
|
|
54
|
-
type: "createVerificationCode";
|
|
55
|
-
expirationTime: number;
|
|
56
54
|
provider: string;
|
|
57
|
-
|
|
55
|
+
type: "createVerificationCode";
|
|
58
56
|
allowExtraProviders: boolean;
|
|
57
|
+
code: string;
|
|
58
|
+
expirationTime: number;
|
|
59
59
|
} | {
|
|
60
60
|
shouldLinkViaEmail?: boolean | undefined;
|
|
61
61
|
shouldLinkViaPhone?: boolean | undefined;
|
|
62
|
-
type: "createAccountFromCredentials";
|
|
63
62
|
provider: string;
|
|
63
|
+
type: "createAccountFromCredentials";
|
|
64
|
+
profile: any;
|
|
64
65
|
account: {
|
|
65
66
|
secret?: string | undefined;
|
|
66
67
|
id: string;
|
|
67
68
|
};
|
|
68
|
-
profile: any;
|
|
69
69
|
} | {
|
|
70
|
-
type: "retrieveAccountWithCredentials";
|
|
71
70
|
provider: string;
|
|
71
|
+
type: "retrieveAccountWithCredentials";
|
|
72
72
|
account: {
|
|
73
73
|
secret?: string | undefined;
|
|
74
74
|
id: string;
|
|
75
75
|
};
|
|
76
76
|
} | {
|
|
77
|
-
type: "modifyAccount";
|
|
78
77
|
provider: string;
|
|
78
|
+
type: "modifyAccount";
|
|
79
79
|
account: {
|
|
80
80
|
id: string;
|
|
81
81
|
secret: string;
|
|
@@ -86,7 +86,7 @@ declare const storeArgs: convex_values15.VObject<{
|
|
|
86
86
|
userId: string;
|
|
87
87
|
};
|
|
88
88
|
}, {
|
|
89
|
-
args:
|
|
89
|
+
args: convex_values32.VUnion<{
|
|
90
90
|
sessionId?: string | undefined;
|
|
91
91
|
type: "signIn";
|
|
92
92
|
userId: string;
|
|
@@ -100,9 +100,9 @@ declare const storeArgs: convex_values15.VObject<{
|
|
|
100
100
|
provider?: string | undefined;
|
|
101
101
|
verifier?: string | undefined;
|
|
102
102
|
type: "verifyCodeAndSignIn";
|
|
103
|
-
allowExtraProviders: boolean;
|
|
104
|
-
generateTokens: boolean;
|
|
105
103
|
params: any;
|
|
104
|
+
generateTokens: boolean;
|
|
105
|
+
allowExtraProviders: boolean;
|
|
106
106
|
} | {
|
|
107
107
|
type: "verifier";
|
|
108
108
|
} | {
|
|
@@ -111,40 +111,40 @@ declare const storeArgs: convex_values15.VObject<{
|
|
|
111
111
|
signature: string;
|
|
112
112
|
} | {
|
|
113
113
|
accountExtend?: any;
|
|
114
|
-
type: "userOAuth";
|
|
115
114
|
provider: string;
|
|
116
|
-
|
|
115
|
+
type: "userOAuth";
|
|
117
116
|
signature: string;
|
|
117
|
+
providerAccountId: string;
|
|
118
118
|
profile: any;
|
|
119
119
|
} | {
|
|
120
120
|
email?: string | undefined;
|
|
121
121
|
phone?: string | undefined;
|
|
122
122
|
accountId?: string | undefined;
|
|
123
|
-
type: "createVerificationCode";
|
|
124
|
-
expirationTime: number;
|
|
125
123
|
provider: string;
|
|
126
|
-
|
|
124
|
+
type: "createVerificationCode";
|
|
127
125
|
allowExtraProviders: boolean;
|
|
126
|
+
code: string;
|
|
127
|
+
expirationTime: number;
|
|
128
128
|
} | {
|
|
129
129
|
shouldLinkViaEmail?: boolean | undefined;
|
|
130
130
|
shouldLinkViaPhone?: boolean | undefined;
|
|
131
|
-
type: "createAccountFromCredentials";
|
|
132
131
|
provider: string;
|
|
132
|
+
type: "createAccountFromCredentials";
|
|
133
|
+
profile: any;
|
|
133
134
|
account: {
|
|
134
135
|
secret?: string | undefined;
|
|
135
136
|
id: string;
|
|
136
137
|
};
|
|
137
|
-
profile: any;
|
|
138
138
|
} | {
|
|
139
|
-
type: "retrieveAccountWithCredentials";
|
|
140
139
|
provider: string;
|
|
140
|
+
type: "retrieveAccountWithCredentials";
|
|
141
141
|
account: {
|
|
142
142
|
secret?: string | undefined;
|
|
143
143
|
id: string;
|
|
144
144
|
};
|
|
145
145
|
} | {
|
|
146
|
-
type: "modifyAccount";
|
|
147
146
|
provider: string;
|
|
147
|
+
type: "modifyAccount";
|
|
148
148
|
account: {
|
|
149
149
|
id: string;
|
|
150
150
|
secret: string;
|
|
@@ -153,157 +153,154 @@ declare const storeArgs: convex_values15.VObject<{
|
|
|
153
153
|
except?: string[] | undefined;
|
|
154
154
|
type: "invalidateSessions";
|
|
155
155
|
userId: string;
|
|
156
|
-
}, [
|
|
156
|
+
}, [convex_values32.VObject<{
|
|
157
157
|
sessionId?: string | undefined;
|
|
158
158
|
type: "signIn";
|
|
159
159
|
userId: string;
|
|
160
160
|
generateTokens: boolean;
|
|
161
161
|
}, {
|
|
162
|
-
userId:
|
|
163
|
-
sessionId:
|
|
164
|
-
generateTokens:
|
|
165
|
-
type:
|
|
166
|
-
}, "required", "type" | "userId" | "sessionId" | "generateTokens">,
|
|
162
|
+
userId: convex_values32.VString<string, "required">;
|
|
163
|
+
sessionId: convex_values32.VString<string | undefined, "optional">;
|
|
164
|
+
generateTokens: convex_values32.VBoolean<boolean, "required">;
|
|
165
|
+
type: convex_values32.VLiteral<"signIn", "required">;
|
|
166
|
+
}, "required", "type" | "userId" | "sessionId" | "generateTokens">, convex_values32.VObject<{
|
|
167
167
|
type: "signOut";
|
|
168
168
|
}, {
|
|
169
|
-
type:
|
|
170
|
-
}, "required", "type">,
|
|
169
|
+
type: convex_values32.VLiteral<"signOut", "required">;
|
|
170
|
+
}, "required", "type">, convex_values32.VObject<{
|
|
171
171
|
type: "refreshSession";
|
|
172
172
|
refreshToken: string;
|
|
173
173
|
}, {
|
|
174
|
-
refreshToken:
|
|
175
|
-
type:
|
|
176
|
-
}, "required", "type" | "refreshToken">,
|
|
174
|
+
refreshToken: convex_values32.VString<string, "required">;
|
|
175
|
+
type: convex_values32.VLiteral<"refreshSession", "required">;
|
|
176
|
+
}, "required", "type" | "refreshToken">, convex_values32.VObject<{
|
|
177
177
|
provider?: string | undefined;
|
|
178
178
|
verifier?: string | undefined;
|
|
179
179
|
type: "verifyCodeAndSignIn";
|
|
180
|
-
allowExtraProviders: boolean;
|
|
181
|
-
generateTokens: boolean;
|
|
182
180
|
params: any;
|
|
181
|
+
generateTokens: boolean;
|
|
182
|
+
allowExtraProviders: boolean;
|
|
183
183
|
}, {
|
|
184
|
-
params:
|
|
185
|
-
provider:
|
|
186
|
-
verifier:
|
|
187
|
-
generateTokens:
|
|
188
|
-
allowExtraProviders:
|
|
189
|
-
type:
|
|
190
|
-
}, "required", "
|
|
184
|
+
params: convex_values32.VAny<any, "required", string>;
|
|
185
|
+
provider: convex_values32.VString<string | undefined, "optional">;
|
|
186
|
+
verifier: convex_values32.VString<string | undefined, "optional">;
|
|
187
|
+
generateTokens: convex_values32.VBoolean<boolean, "required">;
|
|
188
|
+
allowExtraProviders: convex_values32.VBoolean<boolean, "required">;
|
|
189
|
+
type: convex_values32.VLiteral<"verifyCodeAndSignIn", "required">;
|
|
190
|
+
}, "required", "provider" | "type" | "params" | "verifier" | "generateTokens" | "allowExtraProviders" | `params.${string}`>, convex_values32.VObject<{
|
|
191
191
|
type: "verifier";
|
|
192
192
|
}, {
|
|
193
|
-
type:
|
|
194
|
-
}, "required", "type">,
|
|
193
|
+
type: convex_values32.VLiteral<"verifier", "required">;
|
|
194
|
+
}, "required", "type">, convex_values32.VObject<{
|
|
195
195
|
type: "verifierSignature";
|
|
196
196
|
verifier: string;
|
|
197
197
|
signature: string;
|
|
198
198
|
}, {
|
|
199
|
-
verifier:
|
|
200
|
-
signature:
|
|
201
|
-
type:
|
|
202
|
-
}, "required", "type" | "verifier" | "signature">,
|
|
199
|
+
verifier: convex_values32.VString<string, "required">;
|
|
200
|
+
signature: convex_values32.VString<string, "required">;
|
|
201
|
+
type: convex_values32.VLiteral<"verifierSignature", "required">;
|
|
202
|
+
}, "required", "type" | "verifier" | "signature">, convex_values32.VObject<{
|
|
203
203
|
accountExtend?: any;
|
|
204
|
-
type: "userOAuth";
|
|
205
204
|
provider: string;
|
|
206
|
-
|
|
205
|
+
type: "userOAuth";
|
|
207
206
|
signature: string;
|
|
207
|
+
providerAccountId: string;
|
|
208
208
|
profile: any;
|
|
209
209
|
}, {
|
|
210
|
-
provider:
|
|
211
|
-
providerAccountId:
|
|
212
|
-
profile:
|
|
213
|
-
signature:
|
|
214
|
-
accountExtend:
|
|
215
|
-
type:
|
|
216
|
-
}, "required", "type" | "
|
|
210
|
+
provider: convex_values32.VString<string, "required">;
|
|
211
|
+
providerAccountId: convex_values32.VString<string, "required">;
|
|
212
|
+
profile: convex_values32.VAny<any, "required", string>;
|
|
213
|
+
signature: convex_values32.VString<string, "required">;
|
|
214
|
+
accountExtend: convex_values32.VAny<any, "optional", string>;
|
|
215
|
+
type: convex_values32.VLiteral<"userOAuth", "required">;
|
|
216
|
+
}, "required", "provider" | "type" | "signature" | "providerAccountId" | "profile" | "accountExtend" | `profile.${string}` | `accountExtend.${string}`>, convex_values32.VObject<{
|
|
217
217
|
email?: string | undefined;
|
|
218
218
|
phone?: string | undefined;
|
|
219
219
|
accountId?: string | undefined;
|
|
220
|
-
type: "createVerificationCode";
|
|
221
|
-
expirationTime: number;
|
|
222
220
|
provider: string;
|
|
223
|
-
|
|
221
|
+
type: "createVerificationCode";
|
|
224
222
|
allowExtraProviders: boolean;
|
|
223
|
+
code: string;
|
|
224
|
+
expirationTime: number;
|
|
225
225
|
}, {
|
|
226
|
-
accountId:
|
|
227
|
-
provider:
|
|
228
|
-
email:
|
|
229
|
-
phone:
|
|
230
|
-
code:
|
|
231
|
-
expirationTime:
|
|
232
|
-
allowExtraProviders:
|
|
233
|
-
type:
|
|
234
|
-
}, "required", "email" | "phone" | "
|
|
226
|
+
accountId: convex_values32.VString<string | undefined, "optional">;
|
|
227
|
+
provider: convex_values32.VString<string, "required">;
|
|
228
|
+
email: convex_values32.VString<string | undefined, "optional">;
|
|
229
|
+
phone: convex_values32.VString<string | undefined, "optional">;
|
|
230
|
+
code: convex_values32.VString<string, "required">;
|
|
231
|
+
expirationTime: convex_values32.VFloat64<number, "required">;
|
|
232
|
+
allowExtraProviders: convex_values32.VBoolean<boolean, "required">;
|
|
233
|
+
type: convex_values32.VLiteral<"createVerificationCode", "required">;
|
|
234
|
+
}, "required", "email" | "phone" | "provider" | "type" | "allowExtraProviders" | "accountId" | "code" | "expirationTime">, convex_values32.VObject<{
|
|
235
235
|
shouldLinkViaEmail?: boolean | undefined;
|
|
236
236
|
shouldLinkViaPhone?: boolean | undefined;
|
|
237
|
-
type: "createAccountFromCredentials";
|
|
238
237
|
provider: string;
|
|
238
|
+
type: "createAccountFromCredentials";
|
|
239
|
+
profile: any;
|
|
239
240
|
account: {
|
|
240
241
|
secret?: string | undefined;
|
|
241
242
|
id: string;
|
|
242
243
|
};
|
|
243
|
-
profile: any;
|
|
244
244
|
}, {
|
|
245
|
-
provider:
|
|
246
|
-
account:
|
|
245
|
+
provider: convex_values32.VString<string, "required">;
|
|
246
|
+
account: convex_values32.VObject<{
|
|
247
247
|
secret?: string | undefined;
|
|
248
248
|
id: string;
|
|
249
249
|
}, {
|
|
250
|
-
id:
|
|
251
|
-
secret:
|
|
250
|
+
id: convex_values32.VString<string, "required">;
|
|
251
|
+
secret: convex_values32.VString<string | undefined, "optional">;
|
|
252
252
|
}, "required", "id" | "secret">;
|
|
253
|
-
profile:
|
|
254
|
-
shouldLinkViaEmail:
|
|
255
|
-
shouldLinkViaPhone:
|
|
256
|
-
type:
|
|
257
|
-
}, "required", "
|
|
258
|
-
type: "retrieveAccountWithCredentials";
|
|
253
|
+
profile: convex_values32.VAny<any, "required", string>;
|
|
254
|
+
shouldLinkViaEmail: convex_values32.VBoolean<boolean | undefined, "optional">;
|
|
255
|
+
shouldLinkViaPhone: convex_values32.VBoolean<boolean | undefined, "optional">;
|
|
256
|
+
type: convex_values32.VLiteral<"createAccountFromCredentials", "required">;
|
|
257
|
+
}, "required", "provider" | "type" | "profile" | `profile.${string}` | "account" | "shouldLinkViaEmail" | "shouldLinkViaPhone" | "account.id" | "account.secret">, convex_values32.VObject<{
|
|
259
258
|
provider: string;
|
|
259
|
+
type: "retrieveAccountWithCredentials";
|
|
260
260
|
account: {
|
|
261
261
|
secret?: string | undefined;
|
|
262
262
|
id: string;
|
|
263
263
|
};
|
|
264
264
|
}, {
|
|
265
|
-
provider:
|
|
266
|
-
account:
|
|
265
|
+
provider: convex_values32.VString<string, "required">;
|
|
266
|
+
account: convex_values32.VObject<{
|
|
267
267
|
secret?: string | undefined;
|
|
268
268
|
id: string;
|
|
269
269
|
}, {
|
|
270
|
-
id:
|
|
271
|
-
secret:
|
|
270
|
+
id: convex_values32.VString<string, "required">;
|
|
271
|
+
secret: convex_values32.VString<string | undefined, "optional">;
|
|
272
272
|
}, "required", "id" | "secret">;
|
|
273
|
-
type:
|
|
274
|
-
}, "required", "
|
|
275
|
-
type: "modifyAccount";
|
|
273
|
+
type: convex_values32.VLiteral<"retrieveAccountWithCredentials", "required">;
|
|
274
|
+
}, "required", "provider" | "type" | "account" | "account.id" | "account.secret">, convex_values32.VObject<{
|
|
276
275
|
provider: string;
|
|
276
|
+
type: "modifyAccount";
|
|
277
277
|
account: {
|
|
278
278
|
id: string;
|
|
279
279
|
secret: string;
|
|
280
280
|
};
|
|
281
281
|
}, {
|
|
282
|
-
provider:
|
|
283
|
-
account:
|
|
282
|
+
provider: convex_values32.VString<string, "required">;
|
|
283
|
+
account: convex_values32.VObject<{
|
|
284
284
|
id: string;
|
|
285
285
|
secret: string;
|
|
286
286
|
}, {
|
|
287
|
-
id:
|
|
288
|
-
secret:
|
|
287
|
+
id: convex_values32.VString<string, "required">;
|
|
288
|
+
secret: convex_values32.VString<string, "required">;
|
|
289
289
|
}, "required", "id" | "secret">;
|
|
290
|
-
type:
|
|
291
|
-
}, "required", "
|
|
290
|
+
type: convex_values32.VLiteral<"modifyAccount", "required">;
|
|
291
|
+
}, "required", "provider" | "type" | "account" | "account.id" | "account.secret">, convex_values32.VObject<{
|
|
292
292
|
except?: string[] | undefined;
|
|
293
293
|
type: "invalidateSessions";
|
|
294
294
|
userId: string;
|
|
295
295
|
}, {
|
|
296
|
-
userId:
|
|
297
|
-
except:
|
|
298
|
-
type:
|
|
299
|
-
}, "required", "type" | "userId" | "except">], "required", "email" | "phone" | "
|
|
300
|
-
}, "required", "args" | "args.email" | "args.phone" | "args.
|
|
296
|
+
userId: convex_values32.VString<string, "required">;
|
|
297
|
+
except: convex_values32.VArray<string[] | undefined, convex_values32.VString<string, "required">, "optional">;
|
|
298
|
+
type: convex_values32.VLiteral<"invalidateSessions", "required">;
|
|
299
|
+
}, "required", "type" | "userId" | "except">], "required", "email" | "phone" | "provider" | "type" | "params" | "verifier" | "refreshToken" | "userId" | "sessionId" | "generateTokens" | "allowExtraProviders" | `params.${string}` | "signature" | "providerAccountId" | "profile" | "accountExtend" | `profile.${string}` | `accountExtend.${string}` | "accountId" | "code" | "expirationTime" | "account" | "shouldLinkViaEmail" | "shouldLinkViaPhone" | "account.id" | "account.secret" | "except">;
|
|
300
|
+
}, "required", "args" | "args.email" | "args.phone" | "args.provider" | "args.type" | "args.params" | "args.verifier" | "args.refreshToken" | "args.userId" | "args.sessionId" | "args.generateTokens" | "args.allowExtraProviders" | `args.params.${string}` | "args.signature" | "args.providerAccountId" | "args.profile" | "args.accountExtend" | `args.profile.${string}` | `args.accountExtend.${string}` | "args.accountId" | "args.code" | "args.expirationTime" | "args.account" | "args.shouldLinkViaEmail" | "args.shouldLinkViaPhone" | "args.account.id" | "args.account.secret" | "args.except">;
|
|
301
301
|
declare const storeImpl: (ctx: MutationCtx, fnArgs: Infer<typeof storeArgs>, getProviderOrThrow: GetProviderOrThrowFunc, config: Config) => Promise<string | void | {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
} | {
|
|
305
|
-
userId: convex_values15.GenericId<"User">;
|
|
306
|
-
sessionId: convex_values15.GenericId<"Session">;
|
|
302
|
+
userId: convex_values32.GenericId<"User">;
|
|
303
|
+
sessionId: convex_values32.GenericId<"Session">;
|
|
307
304
|
} | (string & {
|
|
308
305
|
__tableName: "AuthVerifier";
|
|
309
306
|
}) | SessionInfo | {
|
|
@@ -312,6 +309,9 @@ declare const storeImpl: (ctx: MutationCtx, fnArgs: Infer<typeof storeArgs>, get
|
|
|
312
309
|
} | {
|
|
313
310
|
account: Doc<"Account">;
|
|
314
311
|
user: Doc<"User">;
|
|
312
|
+
} | {
|
|
313
|
+
account: Doc<"Account">;
|
|
314
|
+
user: Doc<"User">;
|
|
315
315
|
} | null>;
|
|
316
316
|
//#endregion
|
|
317
317
|
export { callCreateAccountFromCredentials, callCreateVerificationCode, callInvalidateSessions, callModifyAccount, callRefreshSession, callRetreiveAccountWithCredentials, callRetrieveAccountWithCredentials, callSignIn, callSignOut, callUserOAuth, callVerifier, callVerifierSignature, callVerifyCodeAndSignIn, storeArgs, storeImpl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/server/mutations/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAwCa,SAAA,kBAAS,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiDpB,eAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,SAAA,GACX,GAAA,EAAK,WAAA,EACL,MAAA,EAAQ,KAAA,QAAa,SAAA,GACrB,kBAAA,EAAoB,sBAAA,EACpB,MAAA,EAAQ,MAAA,KAAe,OAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/server/mutations/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;cAwCa,SAAA,kBAAS,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiDpB,eAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAEW,SAAA,GACX,GAAA,EAAK,WAAA,EACL,MAAA,EAAQ,KAAA,QAAa,SAAA,GACrB,kBAAA,EAAoB,sBAAA,EACpB,MAAA,EAAQ,MAAA,KAAe,OAAA;UAAA,eAAA,CAAA,SAAA"}
|
|
@@ -48,7 +48,7 @@ const storeArgs = v.object({ args: v.union(v.object({
|
|
|
48
48
|
})) });
|
|
49
49
|
const storeImpl = async (ctx, fnArgs, getProviderOrThrow, config) => {
|
|
50
50
|
const args = fnArgs.args;
|
|
51
|
-
logWithLevel(LOG_LEVELS.INFO, `\`auth
|
|
51
|
+
logWithLevel(LOG_LEVELS.INFO, `\`auth:store\` type: ${args.type}`);
|
|
52
52
|
return Fx.run(Fx.match(args, args.type, {
|
|
53
53
|
signIn: (a) => Fx.from({
|
|
54
54
|
ok: () => signInImpl(ctx, a, config),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/server/mutations/index.ts"],"sourcesContent":["import { Fx } from \"@robelest/fx\";\nimport { Infer, v } from \"convex/values\";\n\nimport * as Provider from \"../provider\";\nimport { MutationCtx } from \"../types\";\nimport { LOG_LEVELS, logWithLevel } from \"../utils\";\nimport { modifyAccountArgs, modifyAccountImpl } from \"./account\";\nimport { createVerificationCodeArgs, createVerificationCodeImpl } from \"./code\";\nimport { invalidateSessionsArgs, invalidateSessionsImpl } from \"./invalidate\";\nimport { userOAuthArgs, userOAuthImpl } from \"./oauth\";\nimport { refreshSessionArgs, refreshSessionImpl } from \"./refresh\";\nimport {\n createAccountFromCredentialsArgs,\n createAccountFromCredentialsImpl,\n} from \"./register\";\nimport {\n retrieveAccountWithCredentialsArgs,\n retrieveAccountWithCredentialsImpl,\n} from \"./retrieve\";\nimport { verifierSignatureArgs, verifierSignatureImpl } from \"./signature\";\nimport { signInArgs, signInImpl } from \"./signin\";\nimport { signOutImpl } from \"./signout\";\nimport { verifierImpl } from \"./verifier\";\nimport { verifyCodeAndSignInArgs, verifyCodeAndSignInImpl } from \"./verify\";\nexport { callInvalidateSessions } from \"./invalidate\";\nexport { callModifyAccount } from \"./account\";\nexport {\n callRetrieveAccountWithCredentials,\n callRetreiveAccountWithCredentials,\n} from \"./retrieve\";\nexport { callCreateAccountFromCredentials } from \"./register\";\nexport { callCreateVerificationCode } from \"./code\";\nexport { callUserOAuth } from \"./oauth\";\nexport { callVerifierSignature } from \"./signature\";\nexport { callVerifyCodeAndSignIn } from \"./verify\";\nexport { callVerifier } from \"./verifier\";\nexport { callRefreshSession } from \"./refresh\";\nexport { callSignOut } from \"./signout\";\nexport { callSignIn } from \"./signin\";\n\nexport const storeArgs = v.object({\n args: v.union(\n v.object({\n type: v.literal(\"signIn\"),\n ...signInArgs.fields,\n }),\n v.object({\n type: v.literal(\"signOut\"),\n }),\n v.object({\n type: v.literal(\"refreshSession\"),\n ...refreshSessionArgs.fields,\n }),\n v.object({\n type: v.literal(\"verifyCodeAndSignIn\"),\n ...verifyCodeAndSignInArgs.fields,\n }),\n v.object({\n type: v.literal(\"verifier\"),\n }),\n v.object({\n type: v.literal(\"verifierSignature\"),\n ...verifierSignatureArgs.fields,\n }),\n v.object({\n type: v.literal(\"userOAuth\"),\n ...userOAuthArgs.fields,\n }),\n v.object({\n type: v.literal(\"createVerificationCode\"),\n ...createVerificationCodeArgs.fields,\n }),\n v.object({\n type: v.literal(\"createAccountFromCredentials\"),\n ...createAccountFromCredentialsArgs.fields,\n }),\n v.object({\n type: v.literal(\"retrieveAccountWithCredentials\"),\n ...retrieveAccountWithCredentialsArgs.fields,\n }),\n v.object({\n type: v.literal(\"modifyAccount\"),\n ...modifyAccountArgs.fields,\n }),\n v.object({\n type: v.literal(\"invalidateSessions\"),\n ...invalidateSessionsArgs.fields,\n }),\n ),\n});\n\nexport const storeImpl = async (\n ctx: MutationCtx,\n fnArgs: Infer<typeof storeArgs>,\n getProviderOrThrow: Provider.GetProviderOrThrowFunc,\n config: Provider.Config,\n) => {\n const args = fnArgs.args;\n logWithLevel(LOG_LEVELS.INFO, `\\`auth
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/server/mutations/index.ts"],"sourcesContent":["import { Fx } from \"@robelest/fx\";\nimport { Infer, v } from \"convex/values\";\n\nimport * as Provider from \"../provider\";\nimport { MutationCtx } from \"../types\";\nimport { LOG_LEVELS, logWithLevel } from \"../utils\";\nimport { modifyAccountArgs, modifyAccountImpl } from \"./account\";\nimport { createVerificationCodeArgs, createVerificationCodeImpl } from \"./code\";\nimport { invalidateSessionsArgs, invalidateSessionsImpl } from \"./invalidate\";\nimport { userOAuthArgs, userOAuthImpl } from \"./oauth\";\nimport { refreshSessionArgs, refreshSessionImpl } from \"./refresh\";\nimport {\n createAccountFromCredentialsArgs,\n createAccountFromCredentialsImpl,\n} from \"./register\";\nimport {\n retrieveAccountWithCredentialsArgs,\n retrieveAccountWithCredentialsImpl,\n} from \"./retrieve\";\nimport { verifierSignatureArgs, verifierSignatureImpl } from \"./signature\";\nimport { signInArgs, signInImpl } from \"./signin\";\nimport { signOutImpl } from \"./signout\";\nimport { verifierImpl } from \"./verifier\";\nimport { verifyCodeAndSignInArgs, verifyCodeAndSignInImpl } from \"./verify\";\nexport { callInvalidateSessions } from \"./invalidate\";\nexport { callModifyAccount } from \"./account\";\nexport {\n callRetrieveAccountWithCredentials,\n callRetreiveAccountWithCredentials,\n} from \"./retrieve\";\nexport { callCreateAccountFromCredentials } from \"./register\";\nexport { callCreateVerificationCode } from \"./code\";\nexport { callUserOAuth } from \"./oauth\";\nexport { callVerifierSignature } from \"./signature\";\nexport { callVerifyCodeAndSignIn } from \"./verify\";\nexport { callVerifier } from \"./verifier\";\nexport { callRefreshSession } from \"./refresh\";\nexport { callSignOut } from \"./signout\";\nexport { callSignIn } from \"./signin\";\n\nexport const storeArgs = v.object({\n args: v.union(\n v.object({\n type: v.literal(\"signIn\"),\n ...signInArgs.fields,\n }),\n v.object({\n type: v.literal(\"signOut\"),\n }),\n v.object({\n type: v.literal(\"refreshSession\"),\n ...refreshSessionArgs.fields,\n }),\n v.object({\n type: v.literal(\"verifyCodeAndSignIn\"),\n ...verifyCodeAndSignInArgs.fields,\n }),\n v.object({\n type: v.literal(\"verifier\"),\n }),\n v.object({\n type: v.literal(\"verifierSignature\"),\n ...verifierSignatureArgs.fields,\n }),\n v.object({\n type: v.literal(\"userOAuth\"),\n ...userOAuthArgs.fields,\n }),\n v.object({\n type: v.literal(\"createVerificationCode\"),\n ...createVerificationCodeArgs.fields,\n }),\n v.object({\n type: v.literal(\"createAccountFromCredentials\"),\n ...createAccountFromCredentialsArgs.fields,\n }),\n v.object({\n type: v.literal(\"retrieveAccountWithCredentials\"),\n ...retrieveAccountWithCredentialsArgs.fields,\n }),\n v.object({\n type: v.literal(\"modifyAccount\"),\n ...modifyAccountArgs.fields,\n }),\n v.object({\n type: v.literal(\"invalidateSessions\"),\n ...invalidateSessionsArgs.fields,\n }),\n ),\n});\n\nexport const storeImpl = async (\n ctx: MutationCtx,\n fnArgs: Infer<typeof storeArgs>,\n getProviderOrThrow: Provider.GetProviderOrThrowFunc,\n config: Provider.Config,\n) => {\n const args = fnArgs.args;\n logWithLevel(LOG_LEVELS.INFO, `\\`auth:store\\` type: ${args.type}`);\n return Fx.run(\n Fx.match(args, args.type, {\n signIn: (a) =>\n Fx.from({\n ok: () => signInImpl(ctx, a, config),\n err: (e) => e as never,\n }),\n signOut: () => signOutImpl(ctx, config),\n refreshSession: (a) =>\n Fx.from({\n ok: () => refreshSessionImpl(ctx, a, getProviderOrThrow, config),\n err: (e) => e as never,\n }),\n verifyCodeAndSignIn: (a) =>\n Fx.from({\n ok: () => verifyCodeAndSignInImpl(ctx, a, getProviderOrThrow, config),\n err: (e) => e as never,\n }),\n verifier: () => verifierImpl(ctx, config),\n verifierSignature: (a) =>\n verifierSignatureImpl(ctx, a, config).pipe(\n Fx.recover((e) => Fx.fatal(e.toConvexError())),\n ),\n userOAuth: (a) =>\n userOAuthImpl(ctx, a, getProviderOrThrow, config).pipe(\n Fx.recover((e) => Fx.fatal(e.toConvexError())),\n ),\n createVerificationCode: (a) =>\n Fx.from({\n ok: () =>\n createVerificationCodeImpl(ctx, a, getProviderOrThrow, config),\n err: (e) => e as never,\n }),\n createAccountFromCredentials: (a) =>\n Fx.from({\n ok: () =>\n createAccountFromCredentialsImpl(\n ctx,\n a,\n getProviderOrThrow,\n config,\n ),\n err: (e) => e as never,\n }),\n retrieveAccountWithCredentials: (a) =>\n retrieveAccountWithCredentialsImpl(ctx, a, getProviderOrThrow, config),\n modifyAccount: (a) =>\n modifyAccountImpl(ctx, a, getProviderOrThrow, config).pipe(\n Fx.recover((e) => Fx.fatal(e.toConvexError())),\n ),\n invalidateSessions: (a) => invalidateSessionsImpl(ctx, a, config),\n }),\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,MAAa,YAAY,EAAE,OAAO,EAChC,MAAM,EAAE,MACN,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,SAAS;CACzB,GAAG,WAAW;CACf,CAAC,EACF,EAAE,OAAO,EACP,MAAM,EAAE,QAAQ,UAAU,EAC3B,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,iBAAiB;CACjC,GAAG,mBAAmB;CACvB,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,sBAAsB;CACtC,GAAG,wBAAwB;CAC5B,CAAC,EACF,EAAE,OAAO,EACP,MAAM,EAAE,QAAQ,WAAW,EAC5B,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,oBAAoB;CACpC,GAAG,sBAAsB;CAC1B,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,YAAY;CAC5B,GAAG,cAAc;CAClB,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,yBAAyB;CACzC,GAAG,2BAA2B;CAC/B,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,+BAA+B;CAC/C,GAAG,iCAAiC;CACrC,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,iCAAiC;CACjD,GAAG,mCAAmC;CACvC,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,gBAAgB;CAChC,GAAG,kBAAkB;CACtB,CAAC,EACF,EAAE,OAAO;CACP,MAAM,EAAE,QAAQ,qBAAqB;CACrC,GAAG,uBAAuB;CAC3B,CAAC,CACH,EACF,CAAC;AAEF,MAAa,YAAY,OACvB,KACA,QACA,oBACA,WACG;CACH,MAAM,OAAO,OAAO;AACpB,cAAa,WAAW,MAAM,wBAAwB,KAAK,OAAO;AAClE,QAAO,GAAG,IACR,GAAG,MAAM,MAAM,KAAK,MAAM;EACxB,SAAS,MACP,GAAG,KAAK;GACN,UAAU,WAAW,KAAK,GAAG,OAAO;GACpC,MAAM,MAAM;GACb,CAAC;EACJ,eAAe,YAAY,KAAK,OAAO;EACvC,iBAAiB,MACf,GAAG,KAAK;GACN,UAAU,mBAAmB,KAAK,GAAG,oBAAoB,OAAO;GAChE,MAAM,MAAM;GACb,CAAC;EACJ,sBAAsB,MACpB,GAAG,KAAK;GACN,UAAU,wBAAwB,KAAK,GAAG,oBAAoB,OAAO;GACrE,MAAM,MAAM;GACb,CAAC;EACJ,gBAAgB,aAAa,KAAK,OAAO;EACzC,oBAAoB,MAClB,sBAAsB,KAAK,GAAG,OAAO,CAAC,KACpC,GAAG,SAAS,MAAM,GAAG,MAAM,EAAE,eAAe,CAAC,CAAC,CAC/C;EACH,YAAY,MACV,cAAc,KAAK,GAAG,oBAAoB,OAAO,CAAC,KAChD,GAAG,SAAS,MAAM,GAAG,MAAM,EAAE,eAAe,CAAC,CAAC,CAC/C;EACH,yBAAyB,MACvB,GAAG,KAAK;GACN,UACE,2BAA2B,KAAK,GAAG,oBAAoB,OAAO;GAChE,MAAM,MAAM;GACb,CAAC;EACJ,+BAA+B,MAC7B,GAAG,KAAK;GACN,UACE,iCACE,KACA,GACA,oBACA,OACD;GACH,MAAM,MAAM;GACb,CAAC;EACJ,iCAAiC,MAC/B,mCAAmC,KAAK,GAAG,oBAAoB,OAAO;EACxE,gBAAgB,MACd,kBAAkB,KAAK,GAAG,oBAAoB,OAAO,CAAC,KACpD,GAAG,SAAS,MAAM,GAAG,MAAM,EAAE,eAAe,CAAC,CAAC,CAC/C;EACH,qBAAqB,MAAM,uBAAuB,KAAK,GAAG,OAAO;EAClE,CAAC,CACH"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { MutationCtx } from "../types.js";
|
|
2
2
|
import { Config } from "../provider.js";
|
|
3
3
|
import { Fx } from "@robelest/fx";
|
|
4
|
-
import * as convex_values84 from "convex/values";
|
|
5
|
-
import { Infer } from "convex/values";
|
|
6
4
|
import { GenericActionCtx, GenericDataModel } from "convex/server";
|
|
5
|
+
import * as convex_values104 from "convex/values";
|
|
6
|
+
import { Infer } from "convex/values";
|
|
7
7
|
|
|
8
8
|
//#region src/server/mutations/invalidate.d.ts
|
|
9
|
-
declare const invalidateSessionsArgs:
|
|
9
|
+
declare const invalidateSessionsArgs: convex_values104.VObject<{
|
|
10
10
|
except?: string[] | undefined;
|
|
11
11
|
userId: string;
|
|
12
12
|
}, {
|
|
13
|
-
userId:
|
|
14
|
-
except:
|
|
13
|
+
userId: convex_values104.VString<string, "required">;
|
|
14
|
+
except: convex_values104.VArray<string[] | undefined, convex_values104.VString<string, "required">, "optional">;
|
|
15
15
|
}, "required", "userId" | "except">;
|
|
16
16
|
declare const callInvalidateSessions: <DataModel extends GenericDataModel>(ctx: GenericActionCtx<DataModel>, args: Infer<typeof invalidateSessionsArgs>) => Promise<void>;
|
|
17
17
|
declare function invalidateSessionsImpl(ctx: MutationCtx, args: Infer<typeof invalidateSessionsArgs>, config: Config): Fx<void, never>;
|