0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-31 22:51:25 -05:00

refactor(schemas): remove src/db-entries from source control (#764)

This commit is contained in:
Gao Sun 2022-05-09 15:04:36 +08:00 committed by GitHub
parent aae0b55e26
commit d78c115db1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1 additions and 567 deletions

1
packages/schemas/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/src/db-entries

View file

@ -1,67 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import {
OidcClientMetadata,
oidcClientMetadataGuard,
CustomClientMetadata,
customClientMetadataGuard,
GeneratedSchema,
Guard,
} from '../foundations';
import { ApplicationType } from './custom-types';
export type CreateApplication = {
id: string;
name: string;
description?: string | null;
type: ApplicationType;
oidcClientMetadata: OidcClientMetadata;
customClientMetadata?: CustomClientMetadata;
createdAt?: number;
};
export type Application = {
id: string;
name: string;
description: string | null;
type: ApplicationType;
oidcClientMetadata: OidcClientMetadata;
customClientMetadata: CustomClientMetadata;
createdAt: number;
};
const createGuard: Guard<CreateApplication> = z.object({
id: z.string(),
name: z.string(),
description: z.string().nullable().optional(),
type: z.nativeEnum(ApplicationType),
oidcClientMetadata: oidcClientMetadataGuard,
customClientMetadata: customClientMetadataGuard.optional(),
createdAt: z.number().optional(),
});
export const Applications: GeneratedSchema<CreateApplication> = Object.freeze({
table: 'applications',
tableSingular: 'application',
fields: {
id: 'id',
name: 'name',
description: 'description',
type: 'type',
oidcClientMetadata: 'oidc_client_metadata',
customClientMetadata: 'custom_client_metadata',
createdAt: 'created_at',
},
fieldKeys: [
'id',
'name',
'description',
'type',
'oidcClientMetadata',
'customClientMetadata',
'createdAt',
],
createGuard,
});

View file

@ -1,43 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import { ArbitraryObject, arbitraryObjectGuard, GeneratedSchema, Guard } from '../foundations';
export type CreateConnector = {
id: string;
type: string;
enabled?: boolean;
config?: ArbitraryObject;
createdAt?: number;
};
export type Connector = {
id: string;
type: string;
enabled: boolean;
config: ArbitraryObject;
createdAt: number;
};
const createGuard: Guard<CreateConnector> = z.object({
id: z.string(),
type: z.string(),
enabled: z.boolean().optional(),
config: arbitraryObjectGuard.optional(),
createdAt: z.number().optional(),
});
export const Connectors: GeneratedSchema<CreateConnector> = Object.freeze({
table: 'connectors',
tableSingular: 'connector',
fields: {
id: 'id',
type: 'type',
enabled: 'enabled',
config: 'config',
createdAt: 'created_at',
},
fieldKeys: ['id', 'type', 'enabled', 'config', 'createdAt'],
createGuard,
});

View file

@ -1,15 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
export enum ApplicationType {
Native = 'Native',
SPA = 'SPA',
Traditional = 'Traditional',
}
export enum PasscodeType {
SignIn = 'SignIn',
Register = 'Register',
ForgotPassword = 'ForgotPassword',
}
export enum UsersPasswordEncryptionMethod {
Argon2i = 'Argon2i',
}

View file

@ -1,13 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
export * from './custom-types';
export * from './application';
export * from './connector';
export * from './log';
export * from './oidc-model-instance';
export * from './passcode';
export * from './resource';
export * from './role';
export * from './setting';
export * from './sign-in-experience';
export * from './user';

View file

@ -1,39 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import { ArbitraryObject, arbitraryObjectGuard, GeneratedSchema, Guard } from '../foundations';
export type CreateLog = {
id: string;
type: string;
payload?: ArbitraryObject;
createdAt?: number;
};
export type Log = {
id: string;
type: string;
payload: ArbitraryObject;
createdAt: number;
};
const createGuard: Guard<CreateLog> = z.object({
id: z.string(),
type: z.string(),
payload: arbitraryObjectGuard.optional(),
createdAt: z.number().optional(),
});
export const Logs: GeneratedSchema<CreateLog> = Object.freeze({
table: 'logs',
tableSingular: 'log',
fields: {
id: 'id',
type: 'type',
payload: 'payload',
createdAt: 'created_at',
},
fieldKeys: ['id', 'type', 'payload', 'createdAt'],
createGuard,
});

View file

@ -1,48 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import {
OidcModelInstancePayload,
oidcModelInstancePayloadGuard,
GeneratedSchema,
Guard,
} from '../foundations';
export type CreateOidcModelInstance = {
modelName: string;
id: string;
payload: OidcModelInstancePayload;
expiresAt: number;
consumedAt?: number | null;
};
export type OidcModelInstance = {
modelName: string;
id: string;
payload: OidcModelInstancePayload;
expiresAt: number;
consumedAt: number | null;
};
const createGuard: Guard<CreateOidcModelInstance> = z.object({
modelName: z.string(),
id: z.string(),
payload: oidcModelInstancePayloadGuard,
expiresAt: z.number(),
consumedAt: z.number().nullable().optional(),
});
export const OidcModelInstances: GeneratedSchema<CreateOidcModelInstance> = Object.freeze({
table: 'oidc_model_instances',
tableSingular: 'oidc_model_instance',
fields: {
modelName: 'model_name',
id: 'id',
payload: 'payload',
expiresAt: 'expires_at',
consumedAt: 'consumed_at',
},
fieldKeys: ['modelName', 'id', 'payload', 'expiresAt', 'consumedAt'],
createGuard,
});

View file

@ -1,70 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import { GeneratedSchema, Guard } from '../foundations';
import { PasscodeType } from './custom-types';
export type CreatePasscode = {
id: string;
interactionJti: string;
phone?: string | null;
email?: string | null;
type: PasscodeType;
code: string;
consumed?: boolean;
tryCount?: number;
createdAt?: number;
};
export type Passcode = {
id: string;
interactionJti: string;
phone: string | null;
email: string | null;
type: PasscodeType;
code: string;
consumed: boolean;
tryCount: number;
createdAt: number;
};
const createGuard: Guard<CreatePasscode> = z.object({
id: z.string(),
interactionJti: z.string(),
phone: z.string().nullable().optional(),
email: z.string().nullable().optional(),
type: z.nativeEnum(PasscodeType),
code: z.string(),
consumed: z.boolean().optional(),
tryCount: z.number().optional(),
createdAt: z.number().optional(),
});
export const Passcodes: GeneratedSchema<CreatePasscode> = Object.freeze({
table: 'passcodes',
tableSingular: 'passcode',
fields: {
id: 'id',
interactionJti: 'interaction_jti',
phone: 'phone',
email: 'email',
type: 'type',
code: 'code',
consumed: 'consumed',
tryCount: 'try_count',
createdAt: 'created_at',
},
fieldKeys: [
'id',
'interactionJti',
'phone',
'email',
'type',
'code',
'consumed',
'tryCount',
'createdAt',
],
createGuard,
});

View file

@ -1,39 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import { GeneratedSchema, Guard } from '../foundations';
export type CreateResource = {
id: string;
name: string;
indicator: string;
accessTokenTtl?: number;
};
export type Resource = {
id: string;
name: string;
indicator: string;
accessTokenTtl: number;
};
const createGuard: Guard<CreateResource> = z.object({
id: z.string(),
name: z.string(),
indicator: z.string(),
accessTokenTtl: z.number().optional(),
});
export const Resources: GeneratedSchema<CreateResource> = Object.freeze({
table: 'resources',
tableSingular: 'resource',
fields: {
id: 'id',
name: 'name',
indicator: 'indicator',
accessTokenTtl: 'access_token_ttl',
},
fieldKeys: ['id', 'name', 'indicator', 'accessTokenTtl'],
createGuard,
});

View file

@ -1,31 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import { GeneratedSchema, Guard } from '../foundations';
export type CreateRole = {
name: string;
description: string;
};
export type Role = {
name: string;
description: string;
};
const createGuard: Guard<CreateRole> = z.object({
name: z.string(),
description: z.string(),
});
export const Roles: GeneratedSchema<CreateRole> = Object.freeze({
table: 'roles',
tableSingular: 'role',
fields: {
name: 'name',
description: 'description',
},
fieldKeys: ['name', 'description'],
createGuard,
});

View file

@ -1,36 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import {
AdminConsoleConfig,
adminConsoleConfigGuard,
GeneratedSchema,
Guard,
} from '../foundations';
export type CreateSetting = {
id: string;
adminConsole: AdminConsoleConfig;
};
export type Setting = {
id: string;
adminConsole: AdminConsoleConfig;
};
const createGuard: Guard<CreateSetting> = z.object({
id: z.string(),
adminConsole: adminConsoleConfigGuard,
});
export const Settings: GeneratedSchema<CreateSetting> = Object.freeze({
table: 'settings',
tableSingular: 'setting',
fields: {
id: 'id',
adminConsole: 'admin_console',
},
fieldKeys: ['id', 'adminConsole'],
createGuard,
});

View file

@ -1,67 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import {
Branding,
brandingGuard,
LanguageInfo,
languageInfoGuard,
TermsOfUse,
termsOfUseGuard,
SignInMethods,
signInMethodsGuard,
ConnectorIds,
connectorIdsGuard,
GeneratedSchema,
Guard,
} from '../foundations';
export type CreateSignInExperience = {
id: string;
branding: Branding;
languageInfo: LanguageInfo;
termsOfUse: TermsOfUse;
signInMethods: SignInMethods;
socialSignInConnectorIds?: ConnectorIds;
};
export type SignInExperience = {
id: string;
branding: Branding;
languageInfo: LanguageInfo;
termsOfUse: TermsOfUse;
signInMethods: SignInMethods;
socialSignInConnectorIds: ConnectorIds;
};
const createGuard: Guard<CreateSignInExperience> = z.object({
id: z.string(),
branding: brandingGuard,
languageInfo: languageInfoGuard,
termsOfUse: termsOfUseGuard,
signInMethods: signInMethodsGuard,
socialSignInConnectorIds: connectorIdsGuard.optional(),
});
export const SignInExperiences: GeneratedSchema<CreateSignInExperience> = Object.freeze({
table: 'sign_in_experiences',
tableSingular: 'sign_in_experience',
fields: {
id: 'id',
branding: 'branding',
languageInfo: 'language_info',
termsOfUse: 'terms_of_use',
signInMethods: 'sign_in_methods',
socialSignInConnectorIds: 'social_sign_in_connector_ids',
},
fieldKeys: [
'id',
'branding',
'languageInfo',
'termsOfUse',
'signInMethods',
'socialSignInConnectorIds',
],
createGuard,
});

View file

@ -1,99 +0,0 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import { z } from 'zod';
import {
RoleNames,
roleNamesGuard,
Identities,
identitiesGuard,
ArbitraryObject,
arbitraryObjectGuard,
GeneratedSchema,
Guard,
} from '../foundations';
import { UsersPasswordEncryptionMethod } from './custom-types';
export type CreateUser = {
id: string;
username?: string | null;
primaryEmail?: string | null;
primaryPhone?: string | null;
passwordEncrypted?: string | null;
passwordEncryptionMethod?: UsersPasswordEncryptionMethod | null;
name?: string | null;
avatar?: string | null;
applicationId?: string | null;
roleNames?: RoleNames;
identities?: Identities;
customData?: ArbitraryObject;
lastSignInAt?: number | null;
};
export type User = {
id: string;
username: string | null;
primaryEmail: string | null;
primaryPhone: string | null;
passwordEncrypted: string | null;
passwordEncryptionMethod: UsersPasswordEncryptionMethod | null;
name: string | null;
avatar: string | null;
applicationId: string | null;
roleNames: RoleNames;
identities: Identities;
customData: ArbitraryObject;
lastSignInAt: number | null;
};
const createGuard: Guard<CreateUser> = z.object({
id: z.string(),
username: z.string().nullable().optional(),
primaryEmail: z.string().nullable().optional(),
primaryPhone: z.string().nullable().optional(),
passwordEncrypted: z.string().nullable().optional(),
passwordEncryptionMethod: z.nativeEnum(UsersPasswordEncryptionMethod).nullable().optional(),
name: z.string().nullable().optional(),
avatar: z.string().nullable().optional(),
applicationId: z.string().nullable().optional(),
roleNames: roleNamesGuard.optional(),
identities: identitiesGuard.optional(),
customData: arbitraryObjectGuard.optional(),
lastSignInAt: z.number().nullable().optional(),
});
export const Users: GeneratedSchema<CreateUser> = Object.freeze({
table: 'users',
tableSingular: 'user',
fields: {
id: 'id',
username: 'username',
primaryEmail: 'primary_email',
primaryPhone: 'primary_phone',
passwordEncrypted: 'password_encrypted',
passwordEncryptionMethod: 'password_encryption_method',
name: 'name',
avatar: 'avatar',
applicationId: 'application_id',
roleNames: 'role_names',
identities: 'identities',
customData: 'custom_data',
lastSignInAt: 'last_sign_in_at',
},
fieldKeys: [
'id',
'username',
'primaryEmail',
'primaryPhone',
'passwordEncrypted',
'passwordEncryptionMethod',
'name',
'avatar',
'applicationId',
'roleNames',
'identities',
'customData',
'lastSignInAt',
],
createGuard,
});