@gatwech/core 1.0.0-beta.18 → 1.0.0-beta.19

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.
@@ -1,3 +1,3 @@
1
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-65G5U5DB.mjs";
2
- import "../index-CmdhhvA2.mjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-Df0KhQRf.mjs";
2
+ import "../index-CNtOUpmF.mjs";
3
3
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,5 +1,5 @@
1
- import { d as AuthContext, nt as DBAdapter, st as DBTransactionAdapter } from "../index-65G5U5DB.mjs";
2
- import "../index-CmdhhvA2.mjs";
1
+ import { d as AuthContext, nt as DBAdapter, st as DBTransactionAdapter } from "../index-Df0KhQRf.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-65G5U5DB.mjs";
2
- import "../../index-CmdhhvA2.mjs";
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-Df0KhQRf.mjs";
2
+ import "../../index-CNtOUpmF.mjs";
3
3
  export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -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-65G5U5DB.mjs";
2
- import "../index-CmdhhvA2.mjs";
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-Df0KhQRf.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 };
@@ -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-CmdhhvA2.mjs";
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 };
@@ -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-4_Lym7sj.mjs";
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-ubiqEEZm.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}[Payvo Auth]:${TTY_COLORS.reset} ${message}`;
218
- return `${timestamp} ${level.toUpperCase()} [Payvo Auth]: ${message}`;
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);
@@ -1,4 +1,4 @@
1
- import "../utils-BFQCAfNW.mjs";
2
- import { n as BASE_ERROR_CODES, t as PayvoAuthError } from "../error-41YsFQ8b.mjs";
1
+ import "../utils-CTOwq_Nj.mjs";
2
+ import { n as BASE_ERROR_CODES, t as PayvoAuthError } from "../error-DKIIiFmH.mjs";
3
3
 
4
4
  export { BASE_ERROR_CODES, PayvoAuthError };
@@ -1,4 +1,4 @@
1
- import { t as defineErrorCodes } from "./utils-BFQCAfNW.mjs";
1
+ import { t as defineErrorCodes } from "./utils-CTOwq_Nj.mjs";
2
2
 
3
3
  //#region src/error/codes.ts
4
4
  const BASE_ERROR_CODES = defineErrorCodes({
@@ -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-CmdhhvA2.mjs";
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";
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-65G5U5DB.mjs";
2
- import "./index-CmdhhvA2.mjs";
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-Df0KhQRf.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 };
@@ -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-65G5U5DB.mjs";
2
- import "../index-CmdhhvA2.mjs";
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-Df0KhQRf.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-65G5U5DB.mjs";
2
- import "../index-CmdhhvA2.mjs";
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-Df0KhQRf.mjs";
2
+ import "../index-CNtOUpmF.mjs";
3
3
  export { GithubOptions, GithubProfile, GoogleOptions, GoogleProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, github, google, socialProviderList, socialProviders };
@@ -1,6 +1,6 @@
1
- import { i as logger } from "../env-4_Lym7sj.mjs";
2
- import "../utils-BFQCAfNW.mjs";
3
- import { t as PayvoAuthError } from "../error-41YsFQ8b.mjs";
1
+ import "../utils-CTOwq_Nj.mjs";
2
+ import { t as PayvoAuthError } from "../error-DKIIiFmH.mjs";
3
+ import { i as logger } from "../env-ubiqEEZm.mjs";
4
4
  import { a as refreshAccessToken, n as validateAuthorizationCode, o as createAuthorizationURL } from "../oauth2-DyI7_CNv.mjs";
5
5
  import * as z$1 from "zod";
6
6
  import { betterFetch } from "@better-fetch/fetch";
@@ -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
  } & {
@@ -1,3 +1,3 @@
1
- import { t as defineErrorCodes } from "../utils-BFQCAfNW.mjs";
1
+ import { t as defineErrorCodes } from "../utils-CTOwq_Nj.mjs";
2
2
 
3
3
  export { defineErrorCodes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gatwech/core",
3
- "version": "1.0.0-beta.18",
3
+ "version": "1.0.0-beta.19",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "publishConfig": {
File without changes