mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
feat(core): fix packages' dependencies
This commit is contained in:
parent
0ae081ad56
commit
f669f6b657
8 changed files with 25 additions and 48 deletions
|
@ -20,9 +20,7 @@
|
|||
"node": "^16.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@logto/phrases": "^0.1.0",
|
||||
"@logto/schemas": "^0.1.0",
|
||||
"got": "^11.8.2"
|
||||
"@logto/phrases": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/types": "^27.5.1",
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { Languages } from '@logto/phrases';
|
||||
import { ArbitraryObject, ConnectorType } from '@logto/schemas';
|
||||
import { Response } from 'got';
|
||||
|
||||
export enum ConnectorType {
|
||||
Email = 'Email',
|
||||
SMS = 'SMS',
|
||||
Social = 'Social',
|
||||
}
|
||||
|
||||
export interface ConnectorMetadata {
|
||||
id: string;
|
||||
|
@ -50,23 +54,17 @@ export type SendEmailResponse = { EnvId: string; RequestId: string };
|
|||
|
||||
export type SendSmsResponse = { BizId: string; Code: string; Message: string; RequestId: string };
|
||||
|
||||
export type EmailSendMessageFunction<
|
||||
ResponseBody extends ArbitraryObject = ArbitraryObject,
|
||||
ResponseType = Response<ResponseBody>
|
||||
> = (
|
||||
export type EmailSendMessageFunction<T = Record<string, unknown>> = (
|
||||
address: string,
|
||||
type: keyof EmailMessageTypes,
|
||||
payload: EmailMessageTypes[typeof type]
|
||||
) => Promise<ResponseType>;
|
||||
) => Promise<T>;
|
||||
|
||||
export type SmsSendMessageFunction<
|
||||
ResponseBody extends ArbitraryObject = ArbitraryObject,
|
||||
ResponseType = Response<ResponseBody>
|
||||
> = (
|
||||
export type SmsSendMessageFunction<T = Record<string, unknown>> = (
|
||||
phone: string,
|
||||
type: keyof SmsMessageTypes,
|
||||
payload: SmsMessageTypes[typeof type]
|
||||
) => Promise<ResponseType>;
|
||||
) => Promise<T>;
|
||||
|
||||
export interface BaseConnector {
|
||||
metadata: ConnectorMetadata;
|
||||
|
@ -90,9 +88,7 @@ export interface SocialConnector extends BaseConnector {
|
|||
getTimestamp?: GetTimestamp;
|
||||
}
|
||||
|
||||
export type ValidateConfig<T extends ArbitraryObject = ArbitraryObject> = (
|
||||
config: T
|
||||
) => Promise<void>;
|
||||
export type ValidateConfig<T = Record<string, unknown>> = (config: T) => Promise<void>;
|
||||
|
||||
export type GetAuthorizationUri = (redirectUri: string, state: string) => Promise<string>;
|
||||
|
||||
|
@ -104,9 +100,7 @@ export type GetUserInfo = (
|
|||
accessTokenObject: AccessTokenObject
|
||||
) => Promise<{ id: string } & Record<string, string | undefined>>;
|
||||
|
||||
export type GetConnectorConfig<T extends ArbitraryObject = ArbitraryObject> = (
|
||||
id: string
|
||||
) => Promise<T>;
|
||||
export type GetConnectorConfig<T = Record<string, unknown>> = (id: string) => Promise<T>;
|
||||
|
||||
export type GetTimeout = () => Promise<number>;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
},
|
||||
"prettier": "@silverhand/eslint-config/.prettierrc",
|
||||
"dependencies": {
|
||||
"@logto/connector-types": "^0.1.0",
|
||||
"@logto/phrases": "^0.1.0",
|
||||
"zod": "^3.14.3"
|
||||
}
|
||||
|
|
|
@ -3,11 +3,10 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
import { ArbitraryObject, arbitraryObjectGuard, GeneratedSchema, Guard } from '../foundations';
|
||||
import { ConnectorType } from './custom-types';
|
||||
|
||||
export type CreateConnector = {
|
||||
id: string;
|
||||
type: ConnectorType;
|
||||
type: string;
|
||||
enabled?: boolean;
|
||||
config?: ArbitraryObject;
|
||||
createdAt?: number;
|
||||
|
@ -15,7 +14,7 @@ export type CreateConnector = {
|
|||
|
||||
export type Connector = {
|
||||
id: string;
|
||||
type: ConnectorType;
|
||||
type: string;
|
||||
enabled: boolean;
|
||||
config: ArbitraryObject;
|
||||
createdAt: number;
|
||||
|
@ -23,7 +22,7 @@ export type Connector = {
|
|||
|
||||
const createGuard: Guard<CreateConnector> = z.object({
|
||||
id: z.string(),
|
||||
type: z.nativeEnum(ConnectorType),
|
||||
type: z.string(),
|
||||
enabled: z.boolean().optional(),
|
||||
config: arbitraryObjectGuard.optional(),
|
||||
createdAt: z.number().optional(),
|
||||
|
|
|
@ -5,11 +5,6 @@ export enum ApplicationType {
|
|||
SPA = 'SPA',
|
||||
Traditional = 'Traditional',
|
||||
}
|
||||
export enum ConnectorType {
|
||||
Email = 'Email',
|
||||
SMS = 'SMS',
|
||||
Social = 'Social',
|
||||
}
|
||||
export enum PasscodeType {
|
||||
SignIn = 'SignIn',
|
||||
Register = 'Register',
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
import { Languages } from '@logto/phrases';
|
||||
import { ConnectorMetadata } from '@logto/connector-types';
|
||||
|
||||
import { Connector, ConnectorType } from '../db-entries';
|
||||
import { Connector } from '../db-entries';
|
||||
|
||||
export type { ConnectorMetadata } from '@logto/connector-types';
|
||||
export { ConnectorType } from '@logto/connector-types';
|
||||
|
||||
export interface ConnectorMetadata {
|
||||
id: string;
|
||||
type: ConnectorType;
|
||||
name: Record<Languages, string>;
|
||||
logo: string;
|
||||
description: Record<Languages, string>;
|
||||
readme: string;
|
||||
configTemplate: string;
|
||||
}
|
||||
export interface ConnectorDTO extends Connector {
|
||||
metadata: ConnectorMetadata;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
create type connector_type as enum ('Email', 'SMS', 'Social');
|
||||
|
||||
create table connectors (
|
||||
id varchar(128) not null,
|
||||
type connector_type not null,
|
||||
type varchar(64) not null,
|
||||
enabled boolean not null default FALSE,
|
||||
config jsonb /* @use ArbitraryObject */ not null default '{}'::jsonb,
|
||||
created_at timestamptz not null default(now()),
|
||||
|
|
|
@ -61,14 +61,12 @@ importers:
|
|||
specifiers:
|
||||
'@jest/types': ^27.5.1
|
||||
'@logto/phrases': ^0.1.0
|
||||
'@logto/schemas': ^0.1.0
|
||||
'@shopify/jest-koa-mocks': ^3.0.8
|
||||
'@silverhand/eslint-config': ^0.10.2
|
||||
'@silverhand/essentials': ^1.1.6
|
||||
'@silverhand/ts-config': ^0.10.2
|
||||
'@types/jest': ^27.4.1
|
||||
eslint: ^8.10.0
|
||||
got: ^11.8.2
|
||||
jest: ^27.5.1
|
||||
jest-matcher-specific-error: ^1.0.0
|
||||
lint-staged: ^11.1.1
|
||||
|
@ -77,8 +75,6 @@ importers:
|
|||
typescript: ^4.6.2
|
||||
dependencies:
|
||||
'@logto/phrases': link:../phrases
|
||||
'@logto/schemas': link:../schemas
|
||||
got: 11.8.3
|
||||
devDependencies:
|
||||
'@jest/types': 27.5.1
|
||||
'@shopify/jest-koa-mocks': 3.0.8
|
||||
|
@ -397,6 +393,7 @@ importers:
|
|||
|
||||
packages/schemas:
|
||||
specifiers:
|
||||
'@logto/connector-types': ^0.1.0
|
||||
'@logto/phrases': ^0.1.0
|
||||
'@silverhand/eslint-config': ^0.10.2
|
||||
'@silverhand/essentials': ^1.1.6
|
||||
|
@ -414,6 +411,7 @@ importers:
|
|||
typescript: ^4.6.2
|
||||
zod: ^3.14.3
|
||||
dependencies:
|
||||
'@logto/connector-types': link:../connector-types
|
||||
'@logto/phrases': link:../phrases
|
||||
zod: 3.14.3
|
||||
devDependencies:
|
||||
|
|
Loading…
Reference in a new issue