@prisma/studio-core
Advanced tools
| import baseConfig from "../../eslint.config.base.mjs"; | ||
| export default baseConfig({ metaUrl: import.meta.url }); |
+60
-54
@@ -19,8 +19,8 @@ export type Either<E, R> = [E] | [null, R]; | ||
| filters: Record<QueryFilterOperator, boolean>; | ||
| } | ||
| }; | ||
| export type InstrospectSchemaMeta = { | ||
| tables: Record<TableName, InstrospectTableMeta>; | ||
| enums: Record<EnumName, EnumMeta> | ||
| } | ||
| enums: Record<EnumName, EnumMeta>; | ||
| }; | ||
@@ -31,3 +31,3 @@ export type InstrospectTableMeta = { | ||
| columns: Record<ColumnName, InstrospectColumnMeta>; | ||
| } | ||
| }; | ||
@@ -44,3 +44,3 @@ export type InstrospectColumnMeta = { | ||
| reference: InstrospectTableMeta | null; | ||
| } | ||
| }; | ||
@@ -50,46 +50,46 @@ export type IntrospectDataType = { | ||
| args: (string | number)[]; | ||
| } | ||
| }; | ||
| export type IntrospectUiType = | ||
| | { | ||
| kind: 'string' | ||
| isList: boolean; | ||
| max: number; | ||
| min: number; | ||
| } | ||
| kind: "string"; | ||
| isList: boolean; | ||
| max: number; | ||
| min: number; | ||
| } | ||
| | { | ||
| kind: 'number' | ||
| isList: boolean; | ||
| max: number; | ||
| min: number; | ||
| } | ||
| kind: "number"; | ||
| isList: boolean; | ||
| max: number; | ||
| min: number; | ||
| } | ||
| | { | ||
| kind: 'decimal' | ||
| isList: boolean; | ||
| max: number; | ||
| min: number; | ||
| decimalPlaces: number; | ||
| } | ||
| kind: "decimal"; | ||
| isList: boolean; | ||
| max: number; | ||
| min: number; | ||
| decimalPlaces: number; | ||
| } | ||
| | { | ||
| kind: 'boolean' | ||
| isList: boolean; | ||
| } | ||
| kind: "boolean"; | ||
| isList: boolean; | ||
| } | ||
| | { | ||
| kind: 'datetime' | ||
| isList: boolean; | ||
| } | ||
| kind: "datetime"; | ||
| isList: boolean; | ||
| } | ||
| | { | ||
| kind: 'json' | ||
| isList: boolean; | ||
| } | ||
| kind: "json"; | ||
| isList: boolean; | ||
| } | ||
| | { | ||
| kind: 'blob' | ||
| isList: boolean; | ||
| } | ||
| kind: "blob"; | ||
| isList: boolean; | ||
| } | ||
| | { | ||
| kind: 'enum' | ||
| isList: boolean; | ||
| name: EnumName; | ||
| values: string[]; | ||
| } | ||
| kind: "enum"; | ||
| isList: boolean; | ||
| name: EnumName; | ||
| values: string[]; | ||
| }; | ||
@@ -99,3 +99,3 @@ export type EnumMeta = { | ||
| values: string[]; | ||
| } | ||
| }; | ||
@@ -109,3 +109,3 @@ export type QueryInput = { | ||
| offset?: number; | ||
| } | ||
| }; | ||
@@ -117,10 +117,10 @@ export type QueryFilter = { | ||
| not?: boolean; | ||
| } | ||
| }; | ||
| export type QuerySorting = { | ||
| column: ColumnName; | ||
| order: 'asc' | 'desc'; | ||
| } | ||
| order: "asc" | "desc"; | ||
| }; | ||
| export type QueryFilterOperator = '=' | '>=' | '>' | '<=' | '<' | 'like' | 'ilike' | 'is null' | (string & {}) | ||
| export type QueryFilterOperator = "=" | ">=" | ">" | "<=" | "<" | "like" | "ilike" | "is null" | (string & {}); | ||
@@ -132,5 +132,5 @@ export type QueryResult = { | ||
| duration: number; | ||
| rows: Record<ColumnName, QueryResultColumn>[] | ||
| rows: Record<ColumnName, QueryResultColumn>[]; | ||
| count: number; | ||
| } | ||
| }; | ||
@@ -142,13 +142,19 @@ export type QueryResultColumn = { | ||
| uiType?: IntrospectUiType; | ||
| } | ||
| }; | ||
| // TODO: Implement the following types | ||
| export type MutateInput = {} | ||
| export type MutateResult = {} | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export type MutateInput = {}; | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export type MutateResult = {}; | ||
| export type AlterInput = {} | ||
| export type AlterResult = {} | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export type AlterInput = {}; | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export type AlterResult = {}; | ||
| export type RawQueryInput = {} | ||
| export type RawQueryResult = {} | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export type RawQueryInput = {}; | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export type RawQueryResult = {}; |
+133
-113
@@ -1,128 +0,145 @@ | ||
| import { Adapter, AlterInput, AlterResult, Either, InstrospectResult, MutateInput, MutateResult, QueryInput, QueryResult, RawQueryInput, RawQueryResult } from "./Adapter"; | ||
| import { | ||
| Adapter, | ||
| AlterInput, | ||
| AlterResult, | ||
| Either, | ||
| InstrospectResult, | ||
| MutateInput, | ||
| MutateResult, | ||
| QueryInput, | ||
| QueryResult, | ||
| RawQueryInput, | ||
| RawQueryResult, | ||
| } from "./Adapter"; | ||
| export class AdapterMock implements Adapter { | ||
| // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars | ||
| async introspect(): Promise<Either<Error, InstrospectResult>> { | ||
| return [null, { | ||
| schemas: { | ||
| public: { | ||
| tables: { | ||
| users: { | ||
| schema: "public", | ||
| name: "users", | ||
| columns: { | ||
| id: { | ||
| schema: "public", | ||
| table: "users", | ||
| name: "id", | ||
| dataType: { name: "integer", args: [] }, | ||
| uiType: { kind: "number", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: true, | ||
| reference: null, | ||
| }, | ||
| name: { | ||
| schema: "public", | ||
| table: "users", | ||
| name: "name", | ||
| dataType: { name: "varchar", args: [255] }, | ||
| uiType: { kind: "string", isList: false, max: 255, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| role: { | ||
| schema: "public", | ||
| table: "users", | ||
| name: "role", | ||
| dataType: { name: "enum", args: [] }, | ||
| uiType: { | ||
| kind: "enum", | ||
| isList: false, | ||
| name: "UserRole", | ||
| values: ["admin", "user", "guest"], | ||
| return [ | ||
| null, | ||
| { | ||
| schemas: { | ||
| public: { | ||
| tables: { | ||
| users: { | ||
| schema: "public", | ||
| name: "users", | ||
| columns: { | ||
| id: { | ||
| schema: "public", | ||
| table: "users", | ||
| name: "id", | ||
| dataType: { name: "integer", args: [] }, | ||
| uiType: { kind: "number", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: true, | ||
| reference: null, | ||
| }, | ||
| defaults: "user", | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: null, | ||
| name: { | ||
| schema: "public", | ||
| table: "users", | ||
| name: "name", | ||
| dataType: { name: "varchar", args: [255] }, | ||
| uiType: { kind: "string", isList: false, max: 255, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| role: { | ||
| schema: "public", | ||
| table: "users", | ||
| name: "role", | ||
| dataType: { name: "enum", args: [] }, | ||
| uiType: { | ||
| kind: "enum", | ||
| isList: false, | ||
| name: "UserRole", | ||
| values: ["admin", "user", "guest"], | ||
| }, | ||
| defaults: "user", | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| posts: { | ||
| schema: "public", | ||
| name: "posts", | ||
| columns: { | ||
| id: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "id", | ||
| dataType: { name: "integer", args: [] }, | ||
| uiType: { kind: "number", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: true, | ||
| reference: null, | ||
| }, | ||
| title: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "title", | ||
| dataType: { name: "varchar", args: [255] }, | ||
| uiType: { kind: "string", isList: false, max: 255, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| content: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "content", | ||
| dataType: { name: "text", args: [] }, | ||
| uiType: { kind: "string", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: true, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| userId: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "userId", | ||
| dataType: { name: "integer", args: [] }, | ||
| uiType: { kind: "number", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: { | ||
| posts: { | ||
| schema: "public", | ||
| name: "posts", | ||
| columns: { | ||
| id: { | ||
| schema: "public", | ||
| name: "users", | ||
| columns: {}, // This can be expanded if needed. | ||
| table: "posts", | ||
| name: "id", | ||
| dataType: { name: "integer", args: [] }, | ||
| uiType: { kind: "number", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: true, | ||
| reference: null, | ||
| }, | ||
| title: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "title", | ||
| dataType: { name: "varchar", args: [255] }, | ||
| uiType: { kind: "string", isList: false, max: 255, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| content: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "content", | ||
| dataType: { name: "text", args: [] }, | ||
| uiType: { kind: "string", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: true, | ||
| partOfPk: false, | ||
| reference: null, | ||
| }, | ||
| userId: { | ||
| schema: "public", | ||
| table: "posts", | ||
| name: "userId", | ||
| dataType: { name: "integer", args: [] }, | ||
| uiType: { kind: "number", isList: false, max: 10000, min: 0 }, | ||
| defaults: null, | ||
| nullable: false, | ||
| partOfPk: false, | ||
| reference: { | ||
| schema: "public", | ||
| name: "users", | ||
| columns: {}, // This can be expanded if needed. | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| enums: { | ||
| UserRole: { | ||
| name: "UserRole", | ||
| values: ["admin", "user", "guest"], | ||
| enums: { | ||
| UserRole: { | ||
| name: "UserRole", | ||
| values: ["admin", "user", "guest"], | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| filters: { | ||
| "=": true, | ||
| ">=": true, | ||
| ">": true, | ||
| "<=": true, | ||
| "<": true, | ||
| like: true, | ||
| ilike: false, | ||
| "is null": true, | ||
| }, | ||
| }, | ||
| filters: { | ||
| "=": true, | ||
| ">=": true, | ||
| ">": true, | ||
| "<=": true, | ||
| "<": true, | ||
| "like": true, | ||
| "ilike": false, | ||
| "is null": true, | ||
| }, | ||
| }] | ||
| ]; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars | ||
| async query(input: QueryInput): Promise<Either<Error, QueryResult>> { | ||
@@ -190,13 +207,16 @@ return [ | ||
| }, | ||
| ] | ||
| ]; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars | ||
| async mutate(inputs: MutateInput[]): Promise<Either<Error, MutateResult>> { | ||
| throw new Error("Method not implemented."); | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars | ||
| async alter(inputs: AlterInput[]): Promise<Either<Error, AlterResult>> { | ||
| throw new Error("Method not implemented."); | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/require-await, @typescript-eslint/no-unused-vars | ||
| async rawQuery(input: RawQueryInput): Promise<Either<Error, RawQueryResult>> { | ||
| throw new Error("Method not implemented."); | ||
| } | ||
| } | ||
| } |
+2
-2
@@ -1,2 +0,2 @@ | ||
| export { type Adapter } from './adapter/Adapter'; | ||
| export { AdapterMock } from './adapter/AdapterMock'; | ||
| export { type Adapter } from "./adapter/Adapter"; | ||
| export { AdapterMock } from "./adapter/AdapterMock"; |
+10
-10
@@ -42,3 +42,3 @@ type Either<E, R> = [E] | [null, R]; | ||
| type IntrospectUiType = { | ||
| kind: 'string'; | ||
| kind: "string"; | ||
| isList: boolean; | ||
@@ -48,3 +48,3 @@ max: number; | ||
| } | { | ||
| kind: 'number'; | ||
| kind: "number"; | ||
| isList: boolean; | ||
@@ -54,3 +54,3 @@ max: number; | ||
| } | { | ||
| kind: 'decimal'; | ||
| kind: "decimal"; | ||
| isList: boolean; | ||
@@ -61,15 +61,15 @@ max: number; | ||
| } | { | ||
| kind: 'boolean'; | ||
| kind: "boolean"; | ||
| isList: boolean; | ||
| } | { | ||
| kind: 'datetime'; | ||
| kind: "datetime"; | ||
| isList: boolean; | ||
| } | { | ||
| kind: 'json'; | ||
| kind: "json"; | ||
| isList: boolean; | ||
| } | { | ||
| kind: 'blob'; | ||
| kind: "blob"; | ||
| isList: boolean; | ||
| } | { | ||
| kind: 'enum'; | ||
| kind: "enum"; | ||
| isList: boolean; | ||
@@ -99,5 +99,5 @@ name: EnumName; | ||
| column: ColumnName; | ||
| order: 'asc' | 'desc'; | ||
| order: "asc" | "desc"; | ||
| }; | ||
| type QueryFilterOperator = '=' | '>=' | '>' | '<=' | '<' | 'like' | 'ilike' | 'is null' | (string & {}); | ||
| type QueryFilterOperator = "=" | ">=" | ">" | "<=" | "<" | "like" | "ilike" | "is null" | (string & {}); | ||
| type QueryResult = { | ||
@@ -104,0 +104,0 @@ schema: SchemaName; |
+1
-1
| { | ||
| "name": "@prisma/studio-core", | ||
| "version": "0.0.0-dev.202503182320", | ||
| "version": "0.0.0-dev.202503190015", | ||
| "description": "Modular Prisma Studio components", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
18533
8.11%12
9.09%514
6.2%0
-100%