| import { Schema } from 'effect';
|
|
|
| |
| |
| |
|
|
| declare interface AdapterInfo {
|
| readonly provider: Provider;
|
| readonly adapterName: (typeof officialPrismaAdapters)[number] | (string & {});
|
| }
|
|
|
| declare type ArgScalarType = 'string' | 'int' | 'bigint' | 'float' | 'decimal' | 'boolean' | 'enum' | 'uuid' | 'json' | 'datetime' | 'bytes' | 'unknown';
|
|
|
| declare type ArgType = {
|
| scalarType: ArgScalarType;
|
| dbType?: string;
|
| arity: Arity;
|
| };
|
|
|
| declare type Arity = 'scalar' | 'list';
|
|
|
| declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
|
|
|
| declare const ColumnTypeEnum: {
|
| readonly Int32: 0;
|
| readonly Int64: 1;
|
| readonly Float: 2;
|
| readonly Double: 3;
|
| readonly Numeric: 4;
|
| readonly Boolean: 5;
|
| readonly Character: 6;
|
| readonly Text: 7;
|
| readonly Date: 8;
|
| readonly Time: 9;
|
| readonly DateTime: 10;
|
| readonly Json: 11;
|
| readonly Enum: 12;
|
| readonly Bytes: 13;
|
| readonly Set: 14;
|
| readonly Uuid: 15;
|
| readonly Int32Array: 64;
|
| readonly Int64Array: 65;
|
| readonly FloatArray: 66;
|
| readonly DoubleArray: 67;
|
| readonly NumericArray: 68;
|
| readonly BooleanArray: 69;
|
| readonly CharacterArray: 70;
|
| readonly TextArray: 71;
|
| readonly DateArray: 72;
|
| readonly TimeArray: 73;
|
| readonly DateTimeArray: 74;
|
| readonly JsonArray: 75;
|
| readonly EnumArray: 76;
|
| readonly BytesArray: 77;
|
| readonly UuidArray: 78;
|
| readonly UnknownNumber: 128;
|
| };
|
|
|
| export declare type ConfigDiagnostic = {
|
| _tag: 'log';
|
| value: (formatters: InjectFormatters) => () => void;
|
| } | {
|
| _tag: 'warn';
|
| value: (formatters: InjectFormatters) => () => void;
|
| };
|
|
|
| export declare type ConfigFromFile = {
|
| resolvedPath: string;
|
| config: PrismaConfigInternal;
|
| error?: never;
|
| diagnostics: ConfigDiagnostic[];
|
| } | {
|
| resolvedPath: string;
|
| config?: never;
|
| error: LoadConfigFromFileError;
|
| diagnostics: ConfigDiagnostic[];
|
| } | {
|
| resolvedPath: null;
|
| config: PrismaConfigInternal;
|
| error?: never;
|
| diagnostics: ConfigDiagnostic[];
|
| };
|
|
|
| declare type ConnectionInfo = {
|
| schemaName?: string;
|
| maxBindValues?: number;
|
| supportsRelationJoins: boolean;
|
| };
|
|
|
| |
| |
|
|
| export declare function defaultTestConfig(): PrismaConfigInternal;
|
|
|
| |
| |
|
|
| export declare function defineConfig(configInput: PrismaConfig): PrismaConfigInternal;
|
|
|
| |
| |
| |
|
|
| declare interface DriverAdapterFactory<Query, Result> extends AdapterInfo {
|
| |
| |
|
|
| connect(): Promise<Queryable<Query, Result>>;
|
| }
|
|
|
| declare type EnumsConfigShape = {
|
| |
| |
| |
| |
|
|
| external?: string[];
|
| };
|
|
|
| export declare function env<Env extends Record<string, string | undefined>>(name: keyof Env & string): string;
|
|
|
| declare type Error_2 = MappedError & {
|
| originalCode?: string;
|
| originalMessage?: string;
|
| };
|
|
|
| declare type ErrorCapturingFunction<T> = T extends (...args: infer A) => Promise<infer R> ? (...args: A) => Promise<Result<ErrorCapturingInterface<R>>> : T extends (...args: infer A) => infer R ? (...args: A) => Result<ErrorCapturingInterface<R>> : T;
|
|
|
| declare type ErrorCapturingInterface<T> = {
|
| [K in keyof T]: ErrorCapturingFunction<T[K]>;
|
| };
|
|
|
| declare interface ErrorCapturingSqlMigrationAwareDriverAdapterFactory extends ErrorCapturingInterface<SqlMigrationAwareDriverAdapterFactory> {
|
| readonly errorRegistry: ErrorRegistry;
|
| }
|
|
|
| declare type ErrorRecord = {
|
| error: unknown;
|
| };
|
|
|
| declare interface ErrorRegistry {
|
| consumeError(id: number): ErrorRecord | undefined;
|
| }
|
|
|
| declare type ExperimentalConfig = {
|
| |
| |
|
|
| adapter?: boolean;
|
| |
| |
|
|
| studio?: boolean;
|
| |
| |
|
|
| externalTables?: boolean;
|
| |
| |
|
|
| extensions?: boolean;
|
| };
|
|
|
| export declare type InjectFormatters = {
|
| dim: (data: string) => string;
|
| log: (data: string) => void;
|
| warn: (data: string) => void;
|
| link: (data: string) => string;
|
| };
|
|
|
| declare type IsolationLevel = 'READ UNCOMMITTED' | 'READ COMMITTED' | 'REPEATABLE READ' | 'SNAPSHOT' | 'SERIALIZABLE';
|
|
|
| |
| |
| |
| |
|
|
| export declare function loadConfigFromFile({ configFile, configRoot, }: LoadConfigFromFileInput): Promise<ConfigFromFile>;
|
|
|
| export declare type LoadConfigFromFileError = {
|
| |
| |
|
|
| _tag: 'ConfigFileNotFound';
|
| } | {
|
| _tag: 'ConfigLoadError';
|
| error: Error;
|
| } | {
|
| _tag: 'ConfigFileSyntaxError';
|
| error: Error;
|
| } | {
|
| _tag: 'UnknownError';
|
| error: Error;
|
| };
|
|
|
| declare type LoadConfigFromFileInput = {
|
| |
| |
|
|
| configFile?: string;
|
| |
| |
|
|
| configRoot?: string;
|
| };
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| export declare function loadConfigFromPackageJson(cwd?: string): Promise<{
|
| config: PrismaConfigPackageJson;
|
| loadedFromFile: string;
|
| } | null>;
|
|
|
| declare type MappedError = {
|
| kind: 'GenericJs';
|
| id: number;
|
| } | {
|
| kind: 'UnsupportedNativeDataType';
|
| type: string;
|
| } | {
|
| kind: 'InvalidIsolationLevel';
|
| level: string;
|
| } | {
|
| kind: 'LengthMismatch';
|
| column?: string;
|
| } | {
|
| kind: 'UniqueConstraintViolation';
|
| constraint?: {
|
| fields: string[];
|
| } | {
|
| index: string;
|
| } | {
|
| foreignKey: {};
|
| };
|
| } | {
|
| kind: 'NullConstraintViolation';
|
| constraint?: {
|
| fields: string[];
|
| } | {
|
| index: string;
|
| } | {
|
| foreignKey: {};
|
| };
|
| } | {
|
| kind: 'ForeignKeyConstraintViolation';
|
| constraint?: {
|
| fields: string[];
|
| } | {
|
| index: string;
|
| } | {
|
| foreignKey: {};
|
| };
|
| } | {
|
| kind: 'DatabaseNotReachable';
|
| host?: string;
|
| port?: number;
|
| } | {
|
| kind: 'DatabaseDoesNotExist';
|
| db?: string;
|
| } | {
|
| kind: 'DatabaseAlreadyExists';
|
| db?: string;
|
| } | {
|
| kind: 'DatabaseAccessDenied';
|
| db?: string;
|
| } | {
|
| kind: 'ConnectionClosed';
|
| } | {
|
| kind: 'TlsConnectionError';
|
| reason: string;
|
| } | {
|
| kind: 'AuthenticationFailed';
|
| user?: string;
|
| } | {
|
| kind: 'TransactionWriteConflict';
|
| } | {
|
| kind: 'TableDoesNotExist';
|
| table?: string;
|
| } | {
|
| kind: 'ColumnNotFound';
|
| column?: string;
|
| } | {
|
| kind: 'TooManyConnections';
|
| cause: string;
|
| } | {
|
| kind: 'ValueOutOfRange';
|
| cause: string;
|
| } | {
|
| kind: 'MissingFullTextSearchIndex';
|
| } | {
|
| kind: 'SocketTimeout';
|
| } | {
|
| kind: 'InconsistentColumnData';
|
| cause: string;
|
| } | {
|
| kind: 'TransactionAlreadyClosed';
|
| cause: string;
|
| } | {
|
| kind: 'postgres';
|
| code: string;
|
| severity: string;
|
| message: string;
|
| detail: string | undefined;
|
| column: string | undefined;
|
| hint: string | undefined;
|
| } | {
|
| kind: 'mysql';
|
| code: number;
|
| message: string;
|
| state: string;
|
| } | {
|
| kind: 'sqlite';
|
| |
| |
|
|
| extendedCode: number;
|
| message: string;
|
| } | {
|
| kind: 'mssql';
|
| code: number;
|
| message: string;
|
| };
|
|
|
| declare type MigrationsConfigShape = {
|
| |
| |
|
|
| path?: string;
|
| |
| |
| |
|
|
| initShadowDb?: string;
|
| |
| |
|
|
| seed?: string;
|
| };
|
|
|
| declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-better-sqlite3", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-mssql", "@prisma/adapter-mariadb"];
|
|
|
| declare const PRISMA_CONFIG_INTERNAL_BRAND: unique symbol;
|
|
|
| |
| |
| |
|
|
| export declare type PrismaConfig = PrismaConfigUnconditional & SchemaEngineConfig;
|
|
|
| export declare class PrismaConfigEnvError extends Error {
|
| constructor(name: string);
|
| }
|
|
|
| |
| |
| |
| |
|
|
| export declare type PrismaConfigInternal = _PrismaConfigInternal & {
|
| __brand: typeof PRISMA_CONFIG_INTERNAL_BRAND;
|
| };
|
|
|
| declare type _PrismaConfigInternal = Omit<PrismaConfig, 'engine' | 'datasource' | 'adapter'> & {
|
| loadedFromFile: string | null;
|
| |
| |
| |
| |
| |
| |
|
|
| deprecatedPackageJson: {
|
| |
| |
| |
|
|
| config: PrismaConfigPackageJson;
|
| |
| |
| |
|
|
| loadedFromFile: string;
|
| } | null;
|
| } & ({
|
| engine: 'classic';
|
| datasource: {
|
| url: string;
|
| shadowDatabaseUrl?: string;
|
| };
|
| } | {
|
| engine: 'js';
|
| adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
| } | {
|
| engine?: never;
|
| });
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| declare type PrismaConfigPackageJson = {
|
| schema?: string;
|
| seed?: string;
|
| };
|
|
|
| declare type PrismaConfigUnconditional = {
|
| |
| |
|
|
| experimental?: Simplify<ExperimentalConfig>;
|
| |
| |
|
|
| schema?: string;
|
| |
| |
|
|
| studio?: Simplify<PrismaStudioConfigShape>;
|
| |
| |
|
|
| migrations?: Simplify<MigrationsConfigShape>;
|
| |
| |
|
|
| tables?: Simplify<TablesConfigShape>;
|
| |
| |
|
|
| enums?: Simplify<EnumsConfigShape>;
|
| |
| |
|
|
| views?: Simplify<ViewsConfigShape>;
|
| |
| |
|
|
| typedSql?: Simplify<TypedSqlConfigShape>;
|
| };
|
|
|
| declare type PrismaStudioConfigShape = {
|
| adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
| };
|
|
|
| declare type Provider = 'mysql' | 'postgres' | 'sqlite' | 'sqlserver';
|
|
|
| declare interface Queryable<Query, Result> extends AdapterInfo {
|
| |
| |
|
|
| queryRaw(params: Query): Promise<Result>;
|
| |
| |
|
|
| executeRaw(params: Query): Promise<number>;
|
| }
|
|
|
| declare type Result<T> = {
|
| map<U>(fn: (value: T) => U): Result<U>;
|
| flatMap<U>(fn: (value: T) => Result<U>): Result<U>;
|
| } & ({
|
| readonly ok: true;
|
| readonly value: T;
|
| } | {
|
| readonly ok: false;
|
| readonly error: Error_2;
|
| });
|
|
|
| declare type SchemaEngineConfig = SchemaEngineConfigJs | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
|
| declare type SchemaEngineConfigAbsent = {
|
| engine?: never;
|
| };
|
|
|
| declare type SchemaEngineConfigClassic = {
|
| |
| |
|
|
| engine: 'classic';
|
| |
| |
|
|
| datasource: SchemaEngineConfigClassicDatasource;
|
| };
|
|
|
| export declare type SchemaEngineConfigClassicDatasource = {
|
| url: string;
|
| directUrl?: string;
|
| shadowDatabaseUrl?: string;
|
| };
|
|
|
| export declare type SchemaEngineConfigInternal = SchemaEngineConfigJsInternal | SchemaEngineConfigClassic | SchemaEngineConfigAbsent;
|
|
|
| declare type SchemaEngineConfigJs = {
|
| |
| |
|
|
| engine: 'js';
|
| |
| |
|
|
| adapter: () => Promise<SqlMigrationAwareDriverAdapterFactory>;
|
| };
|
|
|
| declare type SchemaEngineConfigJsInternal = {
|
| |
| |
|
|
| engine: 'js';
|
| |
| |
|
|
| adapter: () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>;
|
| };
|
|
|
| declare const SchemaEngineConfigJsInternal: Schema.Struct<{
|
| engine: Schema.Literal<["js"]>;
|
| adapter: Schema.declare<() => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, () => Promise<ErrorCapturingSqlMigrationAwareDriverAdapterFactory>, readonly [], never>;
|
| }>;
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| declare type Simplify<A> = {
|
| [K in keyof A]: A[K];
|
| } extends infer B ? B : never;
|
|
|
| declare interface SqlDriverAdapter extends SqlQueryable {
|
| |
| |
|
|
| executeScript(script: string): Promise<void>;
|
| |
| |
|
|
| startTransaction(isolationLevel?: IsolationLevel): Promise<Transaction>;
|
| |
| |
|
|
| getConnectionInfo?(): ConnectionInfo;
|
| |
| |
|
|
| dispose(): Promise<void>;
|
| }
|
|
|
| declare interface SqlDriverAdapterFactory extends DriverAdapterFactory<SqlQuery, SqlResultSet> {
|
| connect(): Promise<SqlDriverAdapter>;
|
| }
|
|
|
| |
| |
| |
|
|
| declare interface SqlMigrationAwareDriverAdapterFactory extends SqlDriverAdapterFactory {
|
| connectToShadowDb(): Promise<SqlDriverAdapter>;
|
| }
|
|
|
| declare type SqlQuery = {
|
| sql: string;
|
| args: Array<unknown>;
|
| argTypes: Array<ArgType>;
|
| };
|
|
|
| declare interface SqlQueryable extends Queryable<SqlQuery, SqlResultSet> {
|
| }
|
|
|
| declare interface SqlResultSet {
|
| |
| |
| |
|
|
| columnTypes: Array<ColumnType>;
|
| |
| |
|
|
| columnNames: Array<string>;
|
| |
| |
| |
|
|
| rows: Array<Array<unknown>>;
|
| |
| |
| |
|
|
| lastInsertId?: string;
|
| }
|
|
|
| declare type TablesConfigShape = {
|
| |
| |
| |
| |
|
|
| external?: string[];
|
| };
|
|
|
| declare interface Transaction extends AdapterInfo, SqlQueryable {
|
| |
| |
|
|
| readonly options: TransactionOptions;
|
| |
| |
|
|
| commit(): Promise<void>;
|
| |
| |
|
|
| rollback(): Promise<void>;
|
| }
|
|
|
| declare type TransactionOptions = {
|
| usePhantomQuery: boolean;
|
| };
|
|
|
| declare type TypedSqlConfigShape = {
|
| |
| |
|
|
| path?: string;
|
| };
|
|
|
| declare type ViewsConfigShape = {
|
| |
| |
|
|
| path?: string;
|
| };
|
|
|
| export { }
|
|
|