@gatwech/core 1.0.0-beta.18 → 1.0.0-beta.20
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/api/index.d.mts +2 -2
- package/dist/context/index.d.mts +2 -2
- package/dist/db/adapter/index.d.mts +2 -2
- package/dist/db/index.d.mts +2 -2
- package/dist/env/index.d.mts +1 -1
- package/dist/env/index.mjs +1 -1
- package/dist/{env-4_Lym7sj.mjs → env-BL9S5k9_.mjs} +5 -4
- package/dist/{index-CmdhhvA2.d.mts → index-CNtOUpmF.d.mts} +1 -0
- package/dist/{index-65G5U5DB.d.mts → index-D8uD3Sbr.d.mts} +45 -11
- package/dist/index.d.mts +2 -2
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/social-providers/index.d.mts +2 -2
- package/dist/social-providers/index.mjs +1 -1
- package/dist/src/env/logger.d.ts +2 -0
- package/dist/src/types/context.d.ts +14 -1
- package/dist/src/types/init-options.d.ts +21 -0
- package/package.json +1 -1
package/dist/api/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-D8uD3Sbr.mjs";
|
|
2
|
+
import "../index-CNtOUpmF.mjs";
|
|
3
3
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as AuthContext, nt as DBAdapter, st as DBTransactionAdapter } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { d as AuthContext, nt as DBAdapter, st as DBTransactionAdapter } from "../index-D8uD3Sbr.mjs";
|
|
2
|
+
import "../index-CNtOUpmF.mjs";
|
|
3
3
|
import { t as AsyncLocalStorage } from "../index-CRg-E-VF.mjs";
|
|
4
4
|
import { EndpointContext, InputContext } from "better-call";
|
|
5
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { at as DBAdapterInstance, ct as Where, et as CleanedWhere, it as DBAdapterFactoryConfig, nt as DBAdapter, ot as DBAdapterSchemaCreation, rt as DBAdapterDebugLogOption, st as DBTransactionAdapter, tt as CustomAdapter } from "../../index-
|
|
2
|
-
import "../../index-
|
|
1
|
+
import { at as DBAdapterInstance, ct as Where, et as CleanedWhere, it as DBAdapterFactoryConfig, nt as DBAdapter, ot as DBAdapterSchemaCreation, rt as DBAdapterDebugLogOption, st as DBTransactionAdapter, tt as CustomAdapter } from "../../index-D8uD3Sbr.mjs";
|
|
2
|
+
import "../../index-CNtOUpmF.mjs";
|
|
3
3
|
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { At as DBPreservedModels, Ct as rateLimitSchema, Dt as DBFieldAttribute, Et as PayvoAuthPluginDBSchema, Mt as PayvoAuthDBSchema, Nt as SecondaryStorage, Ot as DBFieldAttributeConfig, St as RateLimit, Tt as accountSchema, _t as User, bt as Session, dt as FieldAttributeConfig, ft as FieldType, gt as verificationSchema, ht as Verification, jt as DBPrimitive, kt as DBFieldType, lt as AuthPluginSchema, mt as Primitive, pt as PayvoAuthDbSchema, ut as FieldAttribute, vt as userSchema, wt as Account, xt as sessionSchema, yt as coreSchema } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { At as DBPreservedModels, Ct as rateLimitSchema, Dt as DBFieldAttribute, Et as PayvoAuthPluginDBSchema, Mt as PayvoAuthDBSchema, Nt as SecondaryStorage, Ot as DBFieldAttributeConfig, St as RateLimit, Tt as accountSchema, _t as User, bt as Session, dt as FieldAttributeConfig, ft as FieldType, gt as verificationSchema, ht as Verification, jt as DBPrimitive, kt as DBFieldType, lt as AuthPluginSchema, mt as Primitive, pt as PayvoAuthDbSchema, ut as FieldAttribute, vt as userSchema, wt as Account, xt as sessionSchema, yt as coreSchema } from "../index-D8uD3Sbr.mjs";
|
|
2
|
+
import "../index-CNtOUpmF.mjs";
|
|
3
3
|
export { Account, AuthPluginSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, PayvoAuthDBSchema, PayvoAuthDbSchema, PayvoAuthPluginDBSchema, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
package/dist/env/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-
|
|
1
|
+
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-CNtOUpmF.mjs";
|
|
2
2
|
export { ENV, EnvObject, InternalLogger, LogHandlerParams, LogLevel, Logger, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|
package/dist/env/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "../env-
|
|
1
|
+
import { a as shouldPublishLog, c as env, d as isDevelopment, f as isProduction, i as logger, l as getBooleanEnvVar, m as nodeENV, n as createLogger, o as getColorDepth, p as isTest, r as levels, s as ENV, t as TTY_COLORS, u as getEnvVar } from "../env-BL9S5k9_.mjs";
|
|
2
2
|
|
|
3
3
|
export { ENV, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|
|
@@ -212,18 +212,19 @@ const levelColors = {
|
|
|
212
212
|
error: TTY_COLORS.fg.red,
|
|
213
213
|
debug: TTY_COLORS.fg.magenta
|
|
214
214
|
};
|
|
215
|
-
const formatMessage = (level, message, colorsEnabled) => {
|
|
215
|
+
const formatMessage = (level, message, colorsEnabled, tag = "Payvo Auth") => {
|
|
216
216
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
217
|
-
if (colorsEnabled) return `${TTY_COLORS.dim}${timestamp}${TTY_COLORS.reset} ${levelColors[level]}${level.toUpperCase()}${TTY_COLORS.reset} ${TTY_COLORS.bright}[
|
|
218
|
-
return `${timestamp} ${level.toUpperCase()} [
|
|
217
|
+
if (colorsEnabled) return `${TTY_COLORS.dim}${timestamp}${TTY_COLORS.reset} ${levelColors[level]}${level.toUpperCase()}${TTY_COLORS.reset} ${TTY_COLORS.bright}[${tag}]:${TTY_COLORS.reset} ${message}`;
|
|
218
|
+
return `${timestamp} ${level.toUpperCase()} [${tag}]: ${message}`;
|
|
219
219
|
};
|
|
220
220
|
const createLogger = (options) => {
|
|
221
221
|
const enabled = options?.disabled !== true;
|
|
222
222
|
const logLevel = options?.level ?? "error";
|
|
223
|
+
const tag = options?.tag || "Payvo Auth";
|
|
223
224
|
const colorsEnabled = options?.disableColors !== void 0 ? !options.disableColors : getColorDepth() !== 1;
|
|
224
225
|
const LogFunc = (level, message, args = []) => {
|
|
225
226
|
if (!enabled || !shouldPublishLog(logLevel, level)) return;
|
|
226
|
-
const formattedMessage = formatMessage(level, message, colorsEnabled);
|
|
227
|
+
const formattedMessage = formatMessage(level, message, colorsEnabled, tag);
|
|
227
228
|
if (!options || typeof options.log !== "function") {
|
|
228
229
|
if (level === "error") console.error(formattedMessage, ...args);
|
|
229
230
|
else if (level === "warn") console.warn(formattedMessage, ...args);
|
|
@@ -70,6 +70,7 @@ interface Logger {
|
|
|
70
70
|
disabled?: boolean | undefined;
|
|
71
71
|
disableColors?: boolean | undefined;
|
|
72
72
|
level?: Exclude<LogLevel, "success"> | undefined;
|
|
73
|
+
tag?: string | undefined;
|
|
73
74
|
log?: ((level: Exclude<LogLevel, "success">, message: string, ...args: any[]) => void) | undefined;
|
|
74
75
|
}
|
|
75
76
|
type LogHandlerParams = Parameters<NonNullable<Logger["log"]>> extends [LogLevel, ...infer Rest] ? Rest : never;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Logger, o as createLogger } from "./index-
|
|
1
|
+
import { i as Logger, o as createLogger } from "./index-CNtOUpmF.mjs";
|
|
2
2
|
import * as better_call0 from "better-call";
|
|
3
3
|
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware } from "better-call";
|
|
4
4
|
import * as z$1 from "zod";
|
|
@@ -121,7 +121,7 @@ interface SecondaryStorage {
|
|
|
121
121
|
* @param key - Key to get
|
|
122
122
|
* @returns - Value of the key
|
|
123
123
|
*/
|
|
124
|
-
get: (key: string) => Awaitable
|
|
124
|
+
get: (key: string) => Awaitable<unknown>;
|
|
125
125
|
/**
|
|
126
126
|
* Atomically get a value and delete it from storage.
|
|
127
127
|
*
|
|
@@ -133,7 +133,7 @@ interface SecondaryStorage {
|
|
|
133
133
|
* breaking release, or require database-backed verification storage for
|
|
134
134
|
* security-sensitive consume paths.
|
|
135
135
|
*/
|
|
136
|
-
getAndDelete?: (key: string) => Awaitable
|
|
136
|
+
getAndDelete?: (key: string) => Awaitable<unknown>;
|
|
137
137
|
/**
|
|
138
138
|
* Atomically increment the counter at `key` by one, returning the
|
|
139
139
|
* post-increment value.
|
|
@@ -148,7 +148,7 @@ interface SecondaryStorage {
|
|
|
148
148
|
* this required for secondary-storage-backed rate limiting in the next minor
|
|
149
149
|
* on `next`.
|
|
150
150
|
*/
|
|
151
|
-
increment?: (key: string, ttl: number) => Awaitable
|
|
151
|
+
increment?: (key: string, ttl: number) => Awaitable<number>;
|
|
152
152
|
set: (
|
|
153
153
|
/**
|
|
154
154
|
* Key to store
|
|
@@ -161,12 +161,12 @@ interface SecondaryStorage {
|
|
|
161
161
|
/**
|
|
162
162
|
* Time to live in seconds
|
|
163
163
|
*/
|
|
164
|
-
ttl?: number | undefined) => Awaitable
|
|
164
|
+
ttl?: number | undefined) => Awaitable<void | null | unknown>;
|
|
165
165
|
/**
|
|
166
166
|
*
|
|
167
167
|
* @param key - Key to delete
|
|
168
168
|
*/
|
|
169
|
-
delete: (key: string) => Awaitable
|
|
169
|
+
delete: (key: string) => Awaitable<void | null | string>;
|
|
170
170
|
}
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/db/plugin.d.ts
|
|
@@ -1078,8 +1078,8 @@ type PayvoAuthCookies = {
|
|
|
1078
1078
|
//#endregion
|
|
1079
1079
|
//#region src/types/helper.d.ts
|
|
1080
1080
|
type Primitive = string | number | symbol | bigint | boolean | null | undefined;
|
|
1081
|
-
type Awaitable
|
|
1082
|
-
type AwaitableFunction<T> = T | (() => Awaitable
|
|
1081
|
+
type Awaitable<T> = T | Promise<T>;
|
|
1082
|
+
type AwaitableFunction<T> = T | (() => Awaitable<T>);
|
|
1083
1083
|
type LiteralString = "" | (string & Record<never, never>);
|
|
1084
1084
|
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1085
1085
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
@@ -1387,7 +1387,7 @@ type SocialProviders = { [K in SocialProviderList[number]]?: Parameters<(typeof
|
|
|
1387
1387
|
type SocialProviderList = typeof socialProviderList;
|
|
1388
1388
|
//#endregion
|
|
1389
1389
|
//#region src/types/plugin.d.ts
|
|
1390
|
-
type Awaitable<T> = T | Promise<T>;
|
|
1390
|
+
type Awaitable$1<T> = T | Promise<T>;
|
|
1391
1391
|
type DeepPartial<T> = T extends Function ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
1392
1392
|
type HookEndpointContext = Partial<EndpointContext<string, any> & Omit<InputContext<string, any>, "method">> & {
|
|
1393
1393
|
path: string;
|
|
@@ -1403,7 +1403,7 @@ type PayvoAuthPlugin = {
|
|
|
1403
1403
|
* The init function is called when the plugin is initialized.
|
|
1404
1404
|
* You can return a new context or modify the existing context.
|
|
1405
1405
|
*/
|
|
1406
|
-
init?: ((ctx: AuthContext) => Awaitable<{
|
|
1406
|
+
init?: ((ctx: AuthContext) => Awaitable$1<{
|
|
1407
1407
|
context?: DeepPartial<Omit<AuthContext, "options">>;
|
|
1408
1408
|
options?: Partial<PayvoAuthOptions>;
|
|
1409
1409
|
}> | void | Promise<void>) | undefined;
|
|
@@ -1624,6 +1624,27 @@ type PayvoAuthAdvancedOptions = {
|
|
|
1624
1624
|
* Payvo Auth. And could lead to security vulnerabilities.
|
|
1625
1625
|
*/
|
|
1626
1626
|
disableOriginCheck?: boolean | undefined;
|
|
1627
|
+
/**
|
|
1628
|
+
* Run deferred work, such as sending events to a remote service, after the
|
|
1629
|
+
* response is sent. On serverless platforms, pass the platform's hook so
|
|
1630
|
+
* the function stays alive until the work finishes.
|
|
1631
|
+
*
|
|
1632
|
+
* @example
|
|
1633
|
+
* // Vercel
|
|
1634
|
+
* import { waitUntil } from "@vercel/functions";
|
|
1635
|
+
* advanced: { backgroundTasks: { handler: waitUntil } }
|
|
1636
|
+
*
|
|
1637
|
+
* @example
|
|
1638
|
+
* // Cloudflare Workers, with the execution context kept in AsyncLocalStorage
|
|
1639
|
+
* advanced: {
|
|
1640
|
+
* backgroundTasks: {
|
|
1641
|
+
* handler: (promise) => executionContext.getStore()?.waitUntil(promise),
|
|
1642
|
+
* },
|
|
1643
|
+
* }
|
|
1644
|
+
*/
|
|
1645
|
+
backgroundTasks?: {
|
|
1646
|
+
handler: (promise: Promise<unknown>) => void;
|
|
1647
|
+
} | undefined;
|
|
1627
1648
|
/**
|
|
1628
1649
|
* Configure cookies to be cross subdomains
|
|
1629
1650
|
*/
|
|
@@ -2793,6 +2814,19 @@ type AuthContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = {
|
|
|
2793
2814
|
* @default false
|
|
2794
2815
|
*/
|
|
2795
2816
|
skipCSRFCheck: boolean;
|
|
2817
|
+
/**
|
|
2818
|
+
* Runs work after the response without blocking it, e.g. sending an
|
|
2819
|
+
* event to a remote service.
|
|
2820
|
+
*
|
|
2821
|
+
* This is inferred from the `options.advanced?.backgroundTasks?.handler`
|
|
2822
|
+
* option. Without one, the promise runs on its own.
|
|
2823
|
+
*/
|
|
2824
|
+
runInBackground: (promise: Promise<unknown>) => void;
|
|
2825
|
+
/**
|
|
2826
|
+
* Runs work in the background when `advanced.backgroundTasks` is
|
|
2827
|
+
* configured, and awaits it otherwise, for work that must finish
|
|
2828
|
+
*/
|
|
2829
|
+
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => Awaitable<unknown>;
|
|
2796
2830
|
};
|
|
2797
2831
|
//#endregion
|
|
2798
2832
|
//#region src/types/plugin-client.d.ts
|
|
@@ -2999,4 +3033,4 @@ declare const createAuthEndpoint: <Path extends string, Opts extends EndpointOpt
|
|
|
2999
3033
|
type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
|
|
3000
3034
|
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
3001
3035
|
//#endregion
|
|
3002
|
-
export { ProviderOptions as $, GithubProfile as A, DBPreservedModels as At, createAuthorizationCodeRequest as B, SocialProviders as C, rateLimitSchema as Ct, GoogleProfile as D, DBFieldAttribute as Dt, GoogleOptions as E, PayvoAuthPluginDBSchema as Et, LiteralUnion as F, createRefreshAccessTokenRequest as G, validateToken as H, Prettify as I, clientCredentialsToken as J, refreshAccessToken as K, Primitive as L, Awaitable
|
|
3036
|
+
export { ProviderOptions as $, GithubProfile as A, DBPreservedModels as At, createAuthorizationCodeRequest as B, SocialProviders as C, rateLimitSchema as Ct, GoogleProfile as D, DBFieldAttribute as Dt, GoogleOptions as E, PayvoAuthPluginDBSchema as Et, LiteralUnion as F, createRefreshAccessTokenRequest as G, validateToken as H, Prettify as I, clientCredentialsToken as J, refreshAccessToken as K, Primitive as L, Awaitable as M, PayvoAuthDBSchema as Mt, AwaitableFunction as N, SecondaryStorage as Nt, google as O, DBFieldAttributeConfig as Ot, LiteralString as P, OAuthProvider as Q, UnionToIntersection as R, SocialProviderListEnum as S, RateLimit as St, socialProviders as T, accountSchema as Tt, generateCodeChallenge as U, validateAuthorizationCode as V, getOAuth2Tokens as W, OAuth2Tokens as X, createClientCredentialsTokenRequest as Y, OAuth2UserInfo as Z, PayvoAuthRateLimitOptions as _, User as _t, optionsMiddleware as a, DBAdapterInstance as at, SocialProvider as b, Session as bt, ClientStore as c, Where as ct, AuthContext as d, FieldAttributeConfig as dt, CleanedWhere as et, GenericEndpointContext as f, FieldType as ft, PayvoAuthOptions as g, verificationSchema as gt, PayvoAuthAdvancedOptions as h, Verification as ht, createAuthMiddleware as i, DBAdapterFactoryConfig as it, github as j, DBPrimitive as jt, GithubOptions as k, DBFieldType as kt, PayvoAuthClientOptions as l, AuthPluginSchema as lt, GenerateIdFn as m, Primitive$1 as mt, AuthMiddleware as n, DBAdapter as nt, StandardSchemaV1$1 as o, DBAdapterSchemaCreation as ot, InternalAdapter as p, PayvoAuthDbSchema as pt, createAuthorizationURL as q, createAuthEndpoint as r, DBAdapterDebugLogOption as rt, ClientAtomListener as s, DBTransactionAdapter as st, AuthEndpoint as t, CustomAdapter as tt, PayvoAuthClientPlugin as u, FieldAttribute as ut, HookEndpointContext as v, userSchema as vt, socialProviderList as w, Account as wt, SocialProviderList as x, sessionSchema as xt, PayvoAuthPlugin as y, coreSchema as yt, PayvoAuthCookies as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { F as LiteralUnion, I as Prettify, L as Primitive, M as Awaitable, N as AwaitableFunction, P as LiteralString, R as UnionToIntersection, _ as PayvoAuthRateLimitOptions, c as ClientStore, d as AuthContext, f as GenericEndpointContext, g as PayvoAuthOptions, h as PayvoAuthAdvancedOptions, l as PayvoAuthClientOptions, m as GenerateIdFn, o as StandardSchemaV1, p as InternalAdapter, s as ClientAtomListener, u as PayvoAuthClientPlugin, v as HookEndpointContext, y as PayvoAuthPlugin, z as PayvoAuthCookies } from "./index-
|
|
2
|
-
import "./index-
|
|
1
|
+
import { F as LiteralUnion, I as Prettify, L as Primitive, M as Awaitable, N as AwaitableFunction, P as LiteralString, R as UnionToIntersection, _ as PayvoAuthRateLimitOptions, c as ClientStore, d as AuthContext, f as GenericEndpointContext, g as PayvoAuthOptions, h as PayvoAuthAdvancedOptions, l as PayvoAuthClientOptions, m as GenerateIdFn, o as StandardSchemaV1, p as InternalAdapter, s as ClientAtomListener, u as PayvoAuthClientPlugin, v as HookEndpointContext, y as PayvoAuthPlugin, z as PayvoAuthCookies } from "./index-D8uD3Sbr.mjs";
|
|
2
|
+
import "./index-CNtOUpmF.mjs";
|
|
3
3
|
export { AuthContext, Awaitable, AwaitableFunction, ClientAtomListener, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, PayvoAuthAdvancedOptions, PayvoAuthClientOptions, PayvoAuthClientPlugin, PayvoAuthCookies, PayvoAuthOptions, PayvoAuthPlugin, PayvoAuthRateLimitOptions, Prettify, Primitive, StandardSchemaV1, UnionToIntersection };
|
package/dist/oauth2/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as ProviderOptions, B as createAuthorizationCodeRequest, G as createRefreshAccessTokenRequest, H as validateToken, J as clientCredentialsToken, K as refreshAccessToken, Q as OAuthProvider, U as generateCodeChallenge, V as validateAuthorizationCode, W as getOAuth2Tokens, X as OAuth2Tokens, Y as createClientCredentialsTokenRequest, Z as OAuth2UserInfo, q as createAuthorizationURL } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { $ as ProviderOptions, B as createAuthorizationCodeRequest, G as createRefreshAccessTokenRequest, H as validateToken, J as clientCredentialsToken, K as refreshAccessToken, Q as OAuthProvider, U as generateCodeChallenge, V as validateAuthorizationCode, W as getOAuth2Tokens, X as OAuth2Tokens, Y as createClientCredentialsTokenRequest, Z as OAuth2UserInfo, q as createAuthorizationURL } from "../index-D8uD3Sbr.mjs";
|
|
2
|
+
import "../index-CNtOUpmF.mjs";
|
|
3
3
|
export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as GithubProfile, C as SocialProviders, D as GoogleProfile, E as GoogleOptions, O as google, S as SocialProviderListEnum, T as socialProviders, b as SocialProvider, j as github, k as GithubOptions, w as socialProviderList, x as SocialProviderList } from "../index-
|
|
2
|
-
import "../index-
|
|
1
|
+
import { A as GithubProfile, C as SocialProviders, D as GoogleProfile, E as GoogleOptions, O as google, S as SocialProviderListEnum, T as socialProviders, b as SocialProvider, j as github, k as GithubOptions, w as socialProviderList, x as SocialProviderList } from "../index-D8uD3Sbr.mjs";
|
|
2
|
+
import "../index-CNtOUpmF.mjs";
|
|
3
3
|
export { GithubOptions, GithubProfile, GoogleOptions, GoogleProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, github, google, socialProviderList, socialProviders };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as logger } from "../env-
|
|
1
|
+
import { i as logger } from "../env-BL9S5k9_.mjs";
|
|
2
2
|
import "../utils-BFQCAfNW.mjs";
|
|
3
3
|
import { t as PayvoAuthError } from "../error-41YsFQ8b.mjs";
|
|
4
4
|
import { a as refreshAccessToken, n as validateAuthorizationCode, o as createAuthorizationURL } from "../oauth2-DyI7_CNv.mjs";
|
package/dist/src/env/logger.d.ts
CHANGED
|
@@ -35,12 +35,14 @@ export interface Logger {
|
|
|
35
35
|
disabled?: boolean | undefined;
|
|
36
36
|
disableColors?: boolean | undefined;
|
|
37
37
|
level?: Exclude<LogLevel, "success"> | undefined;
|
|
38
|
+
tag?: string | undefined;
|
|
38
39
|
log?: ((level: Exclude<LogLevel, "success">, message: string, ...args: any[]) => void) | undefined;
|
|
39
40
|
}
|
|
40
41
|
export type LogHandlerParams = Parameters<NonNullable<Logger["log"]>> extends [
|
|
41
42
|
LogLevel,
|
|
42
43
|
...infer Rest
|
|
43
44
|
] ? Rest : never;
|
|
45
|
+
export declare const formatMessage: (level: LogLevel, message: string, colorsEnabled: boolean, tag?: string) => string;
|
|
44
46
|
export type InternalLogger = {
|
|
45
47
|
[K in LogLevel]: (...params: LogHandlerParams) => void;
|
|
46
48
|
} & {
|
|
@@ -4,7 +4,7 @@ import type { DBAdapter, Where } from "../db/adapter";
|
|
|
4
4
|
import { createLogger } from "../env";
|
|
5
5
|
import type { OAuthProvider } from "../oauth2";
|
|
6
6
|
import type { PayvoAuthCookies } from "./cookie";
|
|
7
|
-
import type { LiteralUnion } from "./helper";
|
|
7
|
+
import type { Awaitable, LiteralUnion } from "./helper";
|
|
8
8
|
import type { PayvoAuthOptions, PayvoAuthRateLimitOptions } from "./init-options";
|
|
9
9
|
export type GenericEndpointContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = EndpointContext<string, any> & {
|
|
10
10
|
context: AuthContext<Options>;
|
|
@@ -173,5 +173,18 @@ export type AuthContext<Options extends PayvoAuthOptions = PayvoAuthOptions> = {
|
|
|
173
173
|
* @default false
|
|
174
174
|
*/
|
|
175
175
|
skipCSRFCheck: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Runs work after the response without blocking it, e.g. sending an
|
|
178
|
+
* event to a remote service.
|
|
179
|
+
*
|
|
180
|
+
* This is inferred from the `options.advanced?.backgroundTasks?.handler`
|
|
181
|
+
* option. Without one, the promise runs on its own.
|
|
182
|
+
*/
|
|
183
|
+
runInBackground: (promise: Promise<unknown>) => void;
|
|
184
|
+
/**
|
|
185
|
+
* Runs work in the background when `advanced.backgroundTasks` is
|
|
186
|
+
* configured, and awaits it otherwise, for work that must finish
|
|
187
|
+
*/
|
|
188
|
+
runInBackgroundOrAwait: (promise: Promise<unknown> | void) => Awaitable<unknown>;
|
|
176
189
|
};
|
|
177
190
|
export {};
|
|
@@ -137,6 +137,27 @@ export type PayvoAuthAdvancedOptions = {
|
|
|
137
137
|
* Payvo Auth. And could lead to security vulnerabilities.
|
|
138
138
|
*/
|
|
139
139
|
disableOriginCheck?: boolean | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Run deferred work, such as sending events to a remote service, after the
|
|
142
|
+
* response is sent. On serverless platforms, pass the platform's hook so
|
|
143
|
+
* the function stays alive until the work finishes.
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* // Vercel
|
|
147
|
+
* import { waitUntil } from "@vercel/functions";
|
|
148
|
+
* advanced: { backgroundTasks: { handler: waitUntil } }
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* // Cloudflare Workers, with the execution context kept in AsyncLocalStorage
|
|
152
|
+
* advanced: {
|
|
153
|
+
* backgroundTasks: {
|
|
154
|
+
* handler: (promise) => executionContext.getStore()?.waitUntil(promise),
|
|
155
|
+
* },
|
|
156
|
+
* }
|
|
157
|
+
*/
|
|
158
|
+
backgroundTasks?: {
|
|
159
|
+
handler: (promise: Promise<unknown>) => void;
|
|
160
|
+
} | undefined;
|
|
140
161
|
/**
|
|
141
162
|
* Configure cookies to be cross subdomains
|
|
142
163
|
*/
|