This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import type { DB, PrimaryFieldType } from "bknd";
|
||||
import type { DB, PrimaryFieldType } from "userbase";
|
||||
import * as AuthPermissions from "auth/auth-permissions";
|
||||
import type { AuthStrategy } from "auth/authenticate/strategies/Strategy";
|
||||
import type { PasswordStrategy } from "auth/authenticate/strategies/PasswordStrategy";
|
||||
import { $console, secureRandomString, transformObject, pickKeys } from "bknd/utils";
|
||||
import { $console, secureRandomString, transformObject, pickKeys } from "userbase/utils";
|
||||
import type { Entity, EntityManager } from "data/entities";
|
||||
import { em, entity, enumm, type FieldSchema } from "data/prototype";
|
||||
import { Module } from "modules/Module";
|
||||
@@ -16,7 +16,7 @@ import { Role } from "./authorize/Role";
|
||||
|
||||
export type UsersFields = typeof AppAuth.usersFields;
|
||||
export type UserFieldSchema = FieldSchema<typeof AppAuth.usersFields>;
|
||||
declare module "bknd" {
|
||||
declare module "userbase" {
|
||||
interface Users extends AppEntity, UserFieldSchema {}
|
||||
interface DB {
|
||||
users: Users;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AppAuth } from "auth/AppAuth";
|
||||
import type { CreateUser, SafeUser, User, UserPool } from "auth/authenticate/Authenticator";
|
||||
import { $console } from "bknd/utils";
|
||||
import { $console } from "userbase/utils";
|
||||
import { pick } from "lodash-es";
|
||||
import {
|
||||
InvalidConditionsException,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthActionResponse } from "auth/api/AuthController";
|
||||
import type { AppAuthSchema } from "auth/auth-schema";
|
||||
import type { AuthResponse, SafeUser, AuthStrategy } from "bknd";
|
||||
import type { AuthResponse, SafeUser, AuthStrategy } from "userbase";
|
||||
import { type BaseModuleApiOptions, ModuleApi } from "modules/ModuleApi";
|
||||
|
||||
export type AuthApiOptions = BaseModuleApiOptions & {
|
||||
@@ -69,7 +69,7 @@ export class AuthApi extends ModuleApi<AuthApiOptions> {
|
||||
async logout() {
|
||||
return this.get(["logout"], undefined, {
|
||||
headers: {
|
||||
// this way bknd detects a json request and doesn't redirect back
|
||||
// this way userbase detects a json request and doesn't redirect back
|
||||
Accept: "application/json",
|
||||
},
|
||||
}).then(() => this.options.onTokenUpdate?.(undefined, true));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DB, SafeUser } from "bknd";
|
||||
import type { DB, SafeUser } from "userbase";
|
||||
import type { AuthStrategy } from "auth/authenticate/strategies/Strategy";
|
||||
import type { AppAuth } from "auth/AppAuth";
|
||||
import * as AuthPermissions from "auth/auth-permissions";
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
transformObject,
|
||||
mcpTool,
|
||||
$console,
|
||||
} from "bknd/utils";
|
||||
} from "userbase/utils";
|
||||
import type { PasswordStrategy } from "auth/authenticate/strategies";
|
||||
|
||||
export type AuthActionResponse = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cookieConfig, jwtConfig } from "auth/authenticate/Authenticator";
|
||||
import { CustomOAuthStrategy, OAuthStrategy, PasswordStrategy } from "auth/authenticate/strategies";
|
||||
import { roleSchema } from "auth/authorize/Role";
|
||||
import { objectTransform, omitKeys, pick, s } from "bknd/utils";
|
||||
import { objectTransform, omitKeys, pick, s } from "userbase/utils";
|
||||
import { $object, $record } from "modules/mcp";
|
||||
|
||||
export const Strategies = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { DB } from "bknd";
|
||||
import type { DB } from "userbase";
|
||||
import { Exception } from "core/errors";
|
||||
import { addFlashMessage } from "core/server/flash";
|
||||
import type { Context } from "hono";
|
||||
@@ -7,7 +7,7 @@ import { sign, verify } from "hono/jwt";
|
||||
import { type CookieOptions, serializeSigned } from "hono/utils/cookie";
|
||||
import type { ServerEnv } from "modules/Controller";
|
||||
import { InvalidConditionsException } from "auth/errors";
|
||||
import { s, parse, secret, runtimeSupports, truncate, $console, pickKeys } from "bknd/utils";
|
||||
import { s, parse, secret, runtimeSupports, truncate, $console, pickKeys } from "userbase/utils";
|
||||
import type { AuthStrategy } from "./strategies/Strategy";
|
||||
|
||||
type Input = any; // workaround
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { User } from "bknd";
|
||||
import type { User } from "userbase";
|
||||
import type { Authenticator } from "auth/authenticate/Authenticator";
|
||||
import { InvalidCredentialsException } from "auth/errors";
|
||||
import { hash, $console, s, parse, jsc, describeRoute } from "bknd/utils";
|
||||
import { hash, $console, s, parse, jsc, describeRoute } from "userbase/utils";
|
||||
import { Hono } from "hono";
|
||||
import { compare as bcryptCompare, genSalt as bcryptGenSalt, hash as bcryptHash } from "bcryptjs";
|
||||
import { AuthStrategy } from "./Strategy";
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
StrategyActions,
|
||||
} from "../Authenticator";
|
||||
import type { Hono } from "hono";
|
||||
import { type s, parse } from "bknd/utils";
|
||||
import { type s, parse } from "userbase/utils";
|
||||
|
||||
export type StrategyMode = "form" | "external";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type * as oauth from "oauth4webapi";
|
||||
import { OAuthStrategy } from "./OAuthStrategy";
|
||||
import { s } from "bknd/utils";
|
||||
import { s } from "userbase/utils";
|
||||
|
||||
type SupportedTypes = "oauth2" | "oidc";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { type Context, Hono } from "hono";
|
||||
import { getSignedCookie, setSignedCookie } from "hono/cookie";
|
||||
import * as oauth from "oauth4webapi";
|
||||
import * as issuers from "./issuers";
|
||||
import { s, filterKeys } from "bknd/utils";
|
||||
import { s, filterKeys } from "userbase/utils";
|
||||
import { Exception } from "core/errors";
|
||||
import { isDebug } from "core/env";
|
||||
import { AuthStrategy } from "../Strategy";
|
||||
|
||||
@@ -37,7 +37,7 @@ export const github: IssuerConfig<GithubUserInfo> = {
|
||||
try {
|
||||
const res = await fetch("https://api.github.com/user/emails", {
|
||||
headers: {
|
||||
"User-Agent": "bknd", // this is mandatory... *smh*
|
||||
"User-Agent": "userbase", // this is mandatory... *smh*
|
||||
Accept: "application/json",
|
||||
Authorization: `Bearer ${tokenResponse.access_token}`,
|
||||
},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Exception } from "core/errors";
|
||||
import { $console, mergeObject, type s } from "bknd/utils";
|
||||
import { $console, mergeObject, type s } from "userbase/utils";
|
||||
import type { Permission, PermissionContext } from "auth/authorize/Permission";
|
||||
import type { Context } from "hono";
|
||||
import type { ServerEnv } from "modules/Controller";
|
||||
import type { Role } from "./Role";
|
||||
import { HttpStatus } from "bknd/utils";
|
||||
import { HttpStatus } from "userbase/utils";
|
||||
import type { Policy, PolicySchema } from "./Policy";
|
||||
import { convert, type ObjectQuery } from "core/object/query/object-query";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { s, type ParseOptions, parse, InvalidSchemaError, HttpStatus } from "bknd/utils";
|
||||
import { s, type ParseOptions, parse, InvalidSchemaError, HttpStatus } from "userbase/utils";
|
||||
|
||||
export const permissionOptionsSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { s, parse, recursivelyReplacePlaceholders } from "bknd/utils";
|
||||
import { s, parse, recursivelyReplacePlaceholders } from "userbase/utils";
|
||||
import * as query from "core/object/query/object-query";
|
||||
|
||||
export const policySchema = s
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { s } from "bknd/utils";
|
||||
import { s } from "userbase/utils";
|
||||
import { Permission } from "./Permission";
|
||||
import { Policy, policySchema } from "./Policy";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Exception } from "core/errors";
|
||||
import { isDebug } from "core/env";
|
||||
import { HttpStatus } from "bknd/utils";
|
||||
import { HttpStatus } from "userbase/utils";
|
||||
|
||||
export class AuthException extends Exception {
|
||||
getSafeErrorAndCode() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { $console, patternMatch } from "bknd/utils";
|
||||
import { $console, patternMatch } from "userbase/utils";
|
||||
import type { Context } from "hono";
|
||||
import { createMiddleware } from "hono/factory";
|
||||
import type { ServerEnv } from "modules/Controller";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Permission, PermissionContext } from "auth/authorize/Permission";
|
||||
import { $console, threw } from "bknd/utils";
|
||||
import { $console, threw } from "userbase/utils";
|
||||
import type { Context, Hono } from "hono";
|
||||
import type { RouterRoute } from "hono/types";
|
||||
import { createMiddleware } from "hono/factory";
|
||||
|
||||
Reference in New Issue
Block a user