Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 197 additions & 0 deletions examples/prisma-next-demo/diamond-contract/c1.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
// ⚠️ GENERATED FILE - DO NOT EDIT
// This file is automatically generated by 'prisma-next contract emit'.
// To regenerate, run: prisma-next contract emit
import type { QueryOperationTypes as PgAdapterQueryOps } from '@prisma-next/adapter-postgres/operation-types';
import type {
Bit,
Char,
CodecTypes as PgTypes,
Interval,
JsonValue,
Numeric,
Time,
Timestamp,
Timestamptz,
Timetz,
VarBit,
Varchar,
} from '@prisma-next/target-postgres/codec-types';

import type {
ContractWithTypeMaps,
TypeMaps as TypeMapsType,
} from '@prisma-next/sql-contract/types';
import type {
Contract as ContractType,
ContractModelsMap,
ExecutionHashBase,
NamespaceId,
ProfileHashBase,
StorageHashBase,
} from '@prisma-next/contract/types';

export type StorageHash =
StorageHashBase<'sha256:789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4'>;
export type ExecutionHash =
ExecutionHashBase<'sha256:5230f959b26fc69f483bc89f66df7c95e0e93400e0f4cb14311e4cbf963cd545'>;
export type ProfileHash =
ProfileHashBase<'sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb'>;

export type CodecTypes = PgTypes;
export type LaneCodecTypes = CodecTypes;
export type QueryOperationTypes = PgAdapterQueryOps<CodecTypes>;
type DefaultLiteralValue<CodecId extends string, _Encoded> = CodecId extends keyof CodecTypes
? CodecTypes[CodecId]['output']
: _Encoded;

export type FieldOutputTypes = {
readonly user: { readonly id: Char<36>; readonly email: CodecTypes['pg/text@1']['output'] };
};
export type FieldInputTypes = {
readonly user: {
readonly id: CodecTypes['sql/char@1']['input'];
readonly email: CodecTypes['pg/text@1']['input'];
};
};
export type TypeMaps = TypeMapsType<
CodecTypes,
QueryOperationTypes,
FieldOutputTypes,
FieldInputTypes
>;

type ContractBase = Omit<
ContractType<
{
readonly namespaces: {
readonly __unbound__: {
readonly id: '__unbound__';
readonly kind: 'sql-namespace';
readonly tables: {
readonly user: {
columns: {
readonly id: {
readonly nativeType: 'character';
readonly codecId: 'sql/char@1';
readonly nullable: false;
readonly typeParams: { readonly length: 36 };
};
readonly email: {
readonly nativeType: 'text';
readonly codecId: 'pg/text@1';
readonly nullable: false;
};
};
primaryKey: { readonly columns: readonly ['id'] };
uniques: readonly [];
indexes: readonly [];
foreignKeys: readonly [];
};
};
};
};
readonly storageHash: StorageHash;
},
{
readonly user: {
readonly fields: {
readonly id: {
readonly nullable: false;
readonly type: {
readonly kind: 'scalar';
readonly codecId: 'sql/char@1';
readonly typeParams: { readonly length: 36 };
};
};
readonly email: {
readonly nullable: false;
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
};
};
readonly relations: Record<string, never>;
readonly storage: {
readonly table: 'user';
readonly fields: {
readonly id: { readonly column: 'id' };
readonly email: { readonly column: 'email' };
};
};
};
}
>,
'roots' | 'domain'
> & {
readonly target: 'postgres';
readonly targetFamily: 'sql';
readonly roots: {
readonly user: { readonly namespace: '__unbound__' & NamespaceId; readonly model: 'user' };
};
readonly domain: {
readonly namespaces: {
readonly __unbound__: {
readonly models: {
readonly user: {
readonly fields: {
readonly id: {
readonly nullable: false;
readonly type: {
readonly kind: 'scalar';
readonly codecId: 'sql/char@1';
readonly typeParams: { readonly length: 36 };
};
};
readonly email: {
readonly nullable: false;
readonly type: { readonly kind: 'scalar'; readonly codecId: 'pg/text@1' };
};
};
readonly relations: Record<string, never>;
readonly storage: {
readonly table: 'user';
readonly fields: {
readonly id: { readonly column: 'id' };
readonly email: { readonly column: 'email' };
};
};
};
};
};
};
};
readonly capabilities: {
readonly postgres: {
readonly distinctOn: true;
readonly jsonAgg: true;
readonly lateral: true;
readonly limit: true;
readonly orderBy: true;
readonly returning: true;
};
readonly sql: {
readonly defaultInInsert: true;
readonly enums: true;
readonly lateral: true;
readonly returning: true;
};
};
readonly extensionPacks: {};
readonly execution: {
readonly executionHash: ExecutionHash;
readonly mutations: {
readonly defaults: readonly [
{
readonly ref: { readonly table: 'user'; readonly column: 'id' };
readonly onCreate: { readonly kind: 'generator'; readonly id: 'uuidv4' };
},
];
};
};
readonly meta: {};

readonly profileHash: ProfileHash;
};

export type Contract = ContractWithTypeMaps<ContractBase, TypeMaps>;

export type Namespaces = Contract['storage']['namespaces'];
export type Models = ContractModelsMap<Contract>;
127 changes: 127 additions & 0 deletions examples/prisma-next-demo/diamond-contract/c1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
{
"schemaVersion": "1",
"targetFamily": "sql",
"target": "postgres",
"profileHash": "sha256:9c8aa3114e84ed3b7ea2bd57526d9c2e1bf7c5292be694e9d3801f566fda7ccb",
"roots": {
"user": {
"model": "user",
"namespace": "__unbound__"
}
},
"domain": {
"namespaces": {
"__unbound__": {
"models": {
"user": {
"fields": {
"email": {
"nullable": false,
"type": {
"codecId": "pg/text@1",
"kind": "scalar"
}
},
"id": {
"nullable": false,
"type": {
"codecId": "sql/char@1",
"kind": "scalar",
"typeParams": {
"length": 36
}
}
}
},
"relations": {},
"storage": {
"fields": {
"email": {
"column": "email"
},
"id": {
"column": "id"
}
},
"table": "user"
}
}
}
}
}
},
"storage": {
"namespaces": {
"__unbound__": {
"id": "__unbound__",
"kind": "postgres-unbound-schema",
"tables": {
"user": {
"columns": {
"email": {
"codecId": "pg/text@1",
"nativeType": "text",
"nullable": false
},
"id": {
"codecId": "sql/char@1",
"nativeType": "character",
"nullable": false,
"typeParams": {
"length": 36
}
}
},
"foreignKeys": [],
"indexes": [],
"primaryKey": {
"columns": ["id"]
},
"uniques": []
}
}
}
},
"storageHash": "sha256:789dd79ab5ab725be1b6ced088109b803a4d62f9874f932eb384a868d94360a4"
},
"execution": {
"executionHash": "sha256:5230f959b26fc69f483bc89f66df7c95e0e93400e0f4cb14311e4cbf963cd545",
"mutations": {
"defaults": [
{
"onCreate": {
"id": "uuidv4",
"kind": "generator"
},
"ref": {
"column": "id",
"table": "user"
}
}
]
}
},
"capabilities": {
"postgres": {
"distinctOn": true,
"jsonAgg": true,
"lateral": true,
"limit": true,
"orderBy": true,
"returning": true
},
"sql": {
"defaultInInsert": true,
"enums": true,
"lateral": true,
"returning": true
}
},
"extensionPacks": {},
"meta": {},
"_generated": {
"warning": "⚠️ GENERATED FILE - DO NOT EDIT",
"message": "This file is automatically generated by \"prisma-next contract emit\".",
"regenerate": "To regenerate, run: prisma-next contract emit"
}
}
6 changes: 6 additions & 0 deletions examples/prisma-next-demo/diamond-contract/c1.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// use prisma-next

model user {
id String @id @default(uuid())
email String
}
Loading
Loading