mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
refactor: use conditional()
from essentials
This commit is contained in:
parent
bb5a9fd392
commit
3e200e2879
2 changed files with 1 additions and 7 deletions
|
@ -1,10 +1,10 @@
|
|||
import dayjs from 'dayjs';
|
||||
import { AdapterFactory } from 'oidc-provider';
|
||||
import { IdentifierSqlTokenType, sql, ValueExpressionType } from 'slonik';
|
||||
import { conditional } from '@logto/essentials';
|
||||
import { OidcModelInstances, OidcModelInstanceDBEntry } from '@logto/schemas';
|
||||
import pool from '@/database/pool';
|
||||
import { convertToIdentifiers } from '@/database/utils';
|
||||
import { conditional } from '@/utils';
|
||||
|
||||
export default function postgresAdapter(modelName: string) {
|
||||
const { table, fields } = convertToIdentifiers(OidcModelInstances);
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
import assert from 'assert';
|
||||
|
||||
export type Optional<T> = T | undefined;
|
||||
export type Falsy = 0 | undefined | null | false | '';
|
||||
|
||||
export const conditional = <T>(value: T | Falsy): Optional<T> => (value ? value : undefined);
|
||||
export const conditionalString = (value: string | Falsy): string => (value ? value : '');
|
||||
|
||||
export const getEnv = (key: string, fallback = ''): string => process.env[key] ?? fallback;
|
||||
export const assertEnv = (key: string): string => {
|
||||
const value = process.env[key];
|
||||
|
|
Loading…
Reference in a new issue