From 199642a177c160d12587310e1a3f678460b4353b Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 07:54:35 +0800 Subject: [PATCH 1/8] feat: implement field omission --- package.json | 6 +- packages/language/res/stdlib.zmodel | 7 + packages/orm/src/client/client-impl.ts | 134 +++++------ packages/orm/src/client/contract.ts | 65 ++--- packages/orm/src/client/crud-types.ts | 84 ++++++- .../src/client/crud/dialects/base-dialect.ts | 22 +- .../src/client/crud/dialects/postgresql.ts | 7 +- .../orm/src/client/crud/dialects/sqlite.ts | 5 +- .../orm/src/client/crud/operations/base.ts | 11 +- .../orm/src/client/crud/validator/index.ts | 1 + packages/orm/src/client/options.ts | 30 ++- packages/orm/src/client/promise.ts | 12 +- packages/schema/src/schema.ts | 1 + packages/sdk/src/ts-schema-generator.ts | 28 ++- packages/testtools/src/client.ts | 38 +-- pnpm-lock.yaml | 223 +++++++++--------- pnpm-workspace.yaml | 2 +- tests/e2e/apps/rally/zenstack/input.ts | 56 ++--- tests/e2e/orm/client-api/omit.test.ts | 139 +++++++++++ tests/e2e/orm/schemas/basic/input.ts | 10 +- tests/e2e/orm/schemas/default-auth/input.ts | 8 +- tests/e2e/orm/schemas/delegate/input.ts | 16 +- tests/e2e/orm/schemas/name-mapping/input.ts | 6 +- tests/e2e/orm/schemas/omit/input.ts | 90 +++++++ tests/e2e/orm/schemas/omit/models.ts | 13 + tests/e2e/orm/schemas/omit/schema.ts | 142 +++++++++++ tests/e2e/orm/schemas/omit/schema.zmodel | 29 +++ tests/e2e/orm/schemas/petstore/input.ts | 8 +- tests/e2e/orm/schemas/todo/input.ts | 12 +- tests/e2e/orm/schemas/typing/input.ts | 14 +- 30 files changed, 889 insertions(+), 330 deletions(-) create mode 100644 tests/e2e/orm/client-api/omit.test.ts create mode 100644 tests/e2e/orm/schemas/omit/input.ts create mode 100644 tests/e2e/orm/schemas/omit/models.ts create mode 100644 tests/e2e/orm/schemas/omit/schema.ts create mode 100644 tests/e2e/orm/schemas/omit/schema.zmodel diff --git a/package.json b/package.json index 26be83f1..b5845769 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "zenstack-v3", "version": "3.0.0-beta.25", "description": "ZenStack", - "packageManager": "pnpm@10.20.0", + "packageManager": "pnpm@10.23.0", "scripts": { "build": "turbo run build", "watch": "turbo run watch build", @@ -25,14 +25,14 @@ "eslint": "~9.29.0", "glob": "^11.0.2", "prettier": "^3.5.3", + "prisma": "catalog:", "tsup": "^8.5.0", "tsx": "^4.20.3", "turbo": "^2.5.4", "typescript": "catalog:", "typescript-eslint": "^8.34.1", "vitest": "^3.2.4", - "yaml": "^2.8.0", - "prisma": "catalog:" + "yaml": "^2.8.0" }, "pnpm": { "onlyBuiltDependencies": [ diff --git a/packages/language/res/stdlib.zmodel b/packages/language/res/stdlib.zmodel index d3bef43b..bbeafb07 100644 --- a/packages/language/res/stdlib.zmodel +++ b/packages/language/res/stdlib.zmodel @@ -393,6 +393,13 @@ attribute @ignore() @@@prisma */ attribute @@ignore() @@@prisma +/** + * Indicates that the field should be omitted by default when read with an ORM client. The omission can be + * overridden in options passed to create `ZenStackClient`, or at query time by explicitly passing in an + * `omit` clause. The attribute is only effective for ORM query APIs, not for query-builder APIs. + */ +attribute @omit() + /** * Automatically stores the time when a record was last updated. */ diff --git a/packages/orm/src/client/client-impl.ts b/packages/orm/src/client/client-impl.ts index 834aef79..1b472b55 100644 --- a/packages/orm/src/client/client-impl.ts +++ b/packages/orm/src/client/client-impl.ts @@ -10,7 +10,7 @@ import { Transaction, type KyselyProps, } from 'kysely'; -import type { GetModels, ProcedureDef, SchemaDef } from '../schema'; +import type { ProcedureDef, SchemaDef } from '../schema'; import type { AnyKysely } from '../utils/kysely-utils'; import type { UnwrapTuplePromises } from '../utils/type-utils'; import type { @@ -38,7 +38,6 @@ import { SchemaDbPusher } from './helpers/schema-db-pusher'; import type { ClientOptions, ProceduresOptions } from './options'; import type { RuntimePlugin } from './plugin'; import { createZenStackPromise, type ZenStackPromise } from './promise'; -import type { ToKysely } from './query-builder'; import { ResultProcessor } from './result-processor'; /** @@ -49,21 +48,21 @@ export const ZenStackClient = function ( schema: Schema, options: ClientOptions, ) { - return new ClientImpl(schema, options); + return new ClientImpl(schema, options as ClientOptions); } as unknown as ClientConstructor; -export class ClientImpl { - private kysely: ToKysely; +export class ClientImpl { + private kysely: AnyKysely; private kyselyRaw: AnyKysely; - public readonly $options: ClientOptions; - public readonly $schema: Schema; + public readonly $options: ClientOptions; + public readonly $schema: SchemaDef; readonly kyselyProps: KyselyProps; - private auth: AuthType | undefined; + private auth: AuthType | undefined; constructor( - private readonly schema: Schema, - private options: ClientOptions, - baseClient?: ClientImpl, + private readonly schema: SchemaDef, + private options: ClientOptions, + baseClient?: ClientImpl, executor?: QueryExecutor, ) { this.$schema = schema; @@ -139,12 +138,12 @@ export class ClientImpl { // overload for interactive transaction $transaction( - callback: (tx: ClientContract) => Promise, + callback: (tx: ClientContract) => Promise, options?: { isolationLevel?: TransactionIsolationLevel }, ): Promise; // overload for sequential transaction - $transaction

[]>( + $transaction

[]>( arg: [...P], options?: { isolationLevel?: TransactionIsolationLevel }, ): Promise>; @@ -169,12 +168,12 @@ export class ClientImpl { } private async interactiveTransaction( - callback: (tx: ClientContract) => Promise, + callback: (tx: ClientContract) => Promise, options?: { isolationLevel?: TransactionIsolationLevel }, ): Promise { if (this.kysely.isTransaction) { // proceed directly if already in a transaction - return callback(this as unknown as ClientContract); + return callback(this as unknown as ClientContract); } else { // otherwise, create a new transaction, clone the client, and execute the callback let txBuilder = this.kysely.transaction(); @@ -182,23 +181,23 @@ export class ClientImpl { txBuilder = txBuilder.setIsolationLevel(options.isolationLevel); } return txBuilder.execute((tx) => { - const txClient = new ClientImpl(this.schema, this.$options, this); + const txClient = new ClientImpl(this.schema, this.$options, this); txClient.kysely = tx; - return callback(txClient as unknown as ClientContract); + return callback(txClient as unknown as ClientContract); }); } } private async sequentialTransaction( - arg: ZenStackPromise[], + arg: ZenStackPromise[], options?: { isolationLevel?: TransactionIsolationLevel }, ) { const execute = async (tx: AnyKysely) => { - const txClient = new ClientImpl(this.schema, this.$options, this); + const txClient = new ClientImpl(this.schema, this.$options, this); txClient.kysely = tx; const result: any[] = []; for (const promise of arg) { - result.push(await promise.cb(txClient as unknown as ClientContract)); + result.push(await promise.cb(txClient as unknown as ClientContract)); } return result; }; @@ -228,7 +227,7 @@ export class ClientImpl { } const procOptions = this.$options.procedures as ProceduresOptions< - Schema & { + SchemaDef & { procedures: Record; } >; @@ -253,45 +252,45 @@ export class ClientImpl { await new SchemaDbPusher(this.schema, this.kysely).push(); } - $use(plugin: RuntimePlugin) { + $use(plugin: RuntimePlugin) { // tsc perf - const newPlugins: RuntimePlugin[] = [...(this.$options.plugins ?? []), plugin]; - const newOptions: ClientOptions = { + const newPlugins: RuntimePlugin[] = [...(this.$options.plugins ?? []), plugin]; + const newOptions: ClientOptions = { ...this.options, plugins: newPlugins, }; - return new ClientImpl(this.schema, newOptions, this); + return new ClientImpl(this.schema, newOptions, this); } $unuse(pluginId: string) { // tsc perf - const newPlugins: RuntimePlugin[] = []; + const newPlugins: RuntimePlugin[] = []; for (const plugin of this.options.plugins ?? []) { if (plugin.id !== pluginId) { newPlugins.push(plugin); } } - const newOptions: ClientOptions = { + const newOptions: ClientOptions = { ...this.options, plugins: newPlugins, }; - return new ClientImpl(this.schema, newOptions, this); + return new ClientImpl(this.schema, newOptions, this); } $unuseAll() { // tsc perf - const newOptions: ClientOptions = { + const newOptions: ClientOptions = { ...this.options, - plugins: [] as RuntimePlugin[], + plugins: [] as RuntimePlugin[], }; - return new ClientImpl(this.schema, newOptions, this); + return new ClientImpl(this.schema, newOptions, this); } - $setAuth(auth: AuthType | undefined) { + $setAuth(auth: AuthType | undefined) { if (auth !== undefined && typeof auth !== 'object') { throw new Error('Invalid auth object'); } - const newClient = new ClientImpl(this.schema, this.$options, this); + const newClient = new ClientImpl(this.schema, this.$options, this); newClient.auth = auth; return newClient; } @@ -301,11 +300,11 @@ export class ClientImpl { } $setInputValidation(enable: boolean) { - const newOptions: ClientOptions = { + const newOptions: ClientOptions = { ...this.options, validateInput: enable, }; - return new ClientImpl(this.schema, newOptions, this); + return new ClientImpl(this.schema, newOptions, this); } $executeRaw(query: TemplateStringsArray, ...values: any[]) { @@ -344,8 +343,8 @@ export class ClientImpl { } } -function createClientProxy(client: ClientImpl): ClientImpl { - const inputValidator = new InputValidator(client as unknown as ClientContract); +function createClientProxy(client: ClientImpl): ClientImpl { + const inputValidator = new InputValidator(client as any); const resultProcessor = new ResultProcessor(client.$schema, client.$options); return new Proxy(client, { @@ -357,35 +356,30 @@ function createClientProxy(client: ClientImpl) if (typeof prop === 'string') { const model = Object.keys(client.$schema.models).find((m) => m.toLowerCase() === prop.toLowerCase()); if (model) { - return createModelCrudHandler( - client as unknown as ClientContract, - model as GetModels, - inputValidator, - resultProcessor, - ); + return createModelCrudHandler(client as any, model, inputValidator, resultProcessor); } } return Reflect.get(target, prop, receiver); }, - }) as unknown as ClientImpl; + }) as unknown as ClientImpl; } -function createModelCrudHandler>( - client: ClientContract, - model: Model, - inputValidator: InputValidator, - resultProcessor: ResultProcessor, -): ModelOperations { +function createModelCrudHandler( + client: ClientContract, + model: string, + inputValidator: InputValidator, + resultProcessor: ResultProcessor, +): ModelOperations { const createPromise = ( operation: CoreCrudOperation, nominalOperation: AllCrudOperation, args: unknown, - handler: BaseOperationHandler, + handler: BaseOperationHandler, postProcess = false, throwIfNoResult = false, ) => { - return createZenStackPromise(async (txClient?: ClientContract) => { + return createZenStackPromise(async (txClient?: ClientContract) => { let proceed = async (_args: unknown) => { const _handler = txClient ? handler.withClient(txClient) : handler; const r = await _handler.handle(operation, _args); @@ -431,7 +425,7 @@ function createModelCrudHandler(client, model, inputValidator), + new FindOperationHandler(client, model, inputValidator), true, ); }, @@ -441,7 +435,7 @@ function createModelCrudHandler(client, model, inputValidator), + new FindOperationHandler(client, model, inputValidator), true, true, ); @@ -452,7 +446,7 @@ function createModelCrudHandler(client, model, inputValidator), + new FindOperationHandler(client, model, inputValidator), true, ); }, @@ -462,7 +456,7 @@ function createModelCrudHandler(client, model, inputValidator), + new FindOperationHandler(client, model, inputValidator), true, true, ); @@ -473,7 +467,7 @@ function createModelCrudHandler(client, model, inputValidator), + new FindOperationHandler(client, model, inputValidator), true, ); }, @@ -483,7 +477,7 @@ function createModelCrudHandler(client, model, inputValidator), + new CreateOperationHandler(client, model, inputValidator), true, ); }, @@ -493,7 +487,7 @@ function createModelCrudHandler(client, model, inputValidator), + new CreateOperationHandler(client, model, inputValidator), false, ); }, @@ -503,7 +497,7 @@ function createModelCrudHandler(client, model, inputValidator), + new CreateOperationHandler(client, model, inputValidator), true, ); }, @@ -513,7 +507,7 @@ function createModelCrudHandler(client, model, inputValidator), + new UpdateOperationHandler(client, model, inputValidator), true, ); }, @@ -523,7 +517,7 @@ function createModelCrudHandler(client, model, inputValidator), + new UpdateOperationHandler(client, model, inputValidator), false, ); }, @@ -533,7 +527,7 @@ function createModelCrudHandler(client, model, inputValidator), + new UpdateOperationHandler(client, model, inputValidator), true, ); }, @@ -543,7 +537,7 @@ function createModelCrudHandler(client, model, inputValidator), + new UpdateOperationHandler(client, model, inputValidator), true, ); }, @@ -553,7 +547,7 @@ function createModelCrudHandler(client, model, inputValidator), + new DeleteOperationHandler(client, model, inputValidator), true, ); }, @@ -563,7 +557,7 @@ function createModelCrudHandler(client, model, inputValidator), + new DeleteOperationHandler(client, model, inputValidator), false, ); }, @@ -573,7 +567,7 @@ function createModelCrudHandler(client, model, inputValidator), + new CountOperationHandler(client, model, inputValidator), false, ); }, @@ -583,7 +577,7 @@ function createModelCrudHandler(client, model, inputValidator), + new AggregateOperationHandler(client, model, inputValidator), false, ); }, @@ -593,9 +587,9 @@ function createModelCrudHandler(client, model, inputValidator), + new GroupByOperationHandler(client, model, inputValidator), true, ); }, - } as ModelOperations; + } as ModelOperations; } diff --git a/packages/orm/src/client/contract.ts b/packages/orm/src/client/contract.ts index 4ef52dd5..a4a8b46e 100644 --- a/packages/orm/src/client/contract.ts +++ b/packages/orm/src/client/contract.ts @@ -58,13 +58,13 @@ export enum TransactionIsolationLevel { /** * ZenStack client interface. */ -export type ClientContract = { +export type ClientContract = ClientOptions> = { readonly $schema: Schema; /** * The client options. */ - readonly $options: ClientOptions; + readonly $options: Options; /** * Executes a prepared raw query and returns the number of affected rows. @@ -112,13 +112,13 @@ export type ClientContract = { /** * Sets the current user identity. */ - $setAuth(auth: AuthType | undefined): ClientContract; + $setAuth(auth: AuthType | undefined): ClientContract; /** * Returns a new client enabling/disabling input validations expressed with attributes like * `@email`, `@regex`, `@@validate`, etc. */ - $setInputValidation(enable: boolean): ClientContract; + $setInputValidation(enable: boolean): ClientContract; /** * The Kysely query builder instance. @@ -134,7 +134,7 @@ export type ClientContract = { * Starts an interactive transaction. */ $transaction( - callback: (tx: Omit, TransactionUnsupportedMethods>) => Promise, + callback: (tx: Omit, TransactionUnsupportedMethods>) => Promise, options?: { isolationLevel?: TransactionIsolationLevel }, ): Promise; @@ -149,17 +149,17 @@ export type ClientContract = { /** * Returns a new client with the specified plugin installed. */ - $use(plugin: RuntimePlugin): ClientContract; + $use(plugin: RuntimePlugin): ClientContract; /** * Returns a new client with the specified plugin removed. */ - $unuse(pluginId: string): ClientContract; + $unuse(pluginId: string): ClientContract; /** * Returns a new client with all plugins removed. */ - $unuseAll(): ClientContract; + $unuseAll(): ClientContract; /** * Eagerly connects to the database. @@ -177,14 +177,14 @@ export type ClientContract = { */ $pushSchema(): Promise; } & { - [Key in GetModels as Uncapitalize]: ModelOperations; + [Key in GetModels as Uncapitalize]: ModelOperations; } & Procedures; /** * The contract for a client in a transaction. */ -export type TransactionClientContract = Omit< - ClientContract, +export type TransactionClientContract> = Omit< + ClientContract, TransactionUnsupportedMethods >; @@ -227,7 +227,10 @@ type MapProcedureParams = { * Creates a new ZenStack client instance. */ export interface ClientConstructor { - new (schema: Schema, options: ClientOptions): ClientContract; + new >( + schema: Schema, + options: Options, + ): ClientContract; } /** @@ -252,7 +255,11 @@ export const CRUD_EXT = [...CRUD, 'post-update'] as const; //#region Model operations -export type AllModelOperations> = { +export type AllModelOperations< + Schema extends SchemaDef, + Model extends GetModels, + Options extends ClientOptions, +> = { /** * Returns a list of entities. * @param args - query args @@ -336,7 +343,7 @@ export type AllModelOperations>( args?: SelectSubset>, - ): ZenStackPromise[]>; + ): ZenStackPromise[]>; /** * Returns a uniquely identified entity. @@ -346,7 +353,7 @@ export type AllModelOperations>( args: SelectSubset>, - ): ZenStackPromise | null>; + ): ZenStackPromise | null>; /** * Returns a uniquely identified entity or throws `NotFoundError` if not found. @@ -356,7 +363,7 @@ export type AllModelOperations>( args: SelectSubset>, - ): ZenStackPromise>; + ): ZenStackPromise>; /** * Returns the first entity. @@ -366,7 +373,7 @@ export type AllModelOperations>( args?: SelectSubset>, - ): ZenStackPromise | null>; + ): ZenStackPromise | null>; /** * Returns the first entity or throws `NotFoundError` if not found. @@ -376,7 +383,7 @@ export type AllModelOperations>( args?: SelectSubset>, - ): ZenStackPromise>; + ): ZenStackPromise>; /** * Creates a new entity. @@ -432,7 +439,7 @@ export type AllModelOperations>( args: SelectSubset>, - ): ZenStackPromise>; + ): ZenStackPromise>; /** * Creates multiple entities. Only scalar fields are allowed. @@ -483,7 +490,7 @@ export type AllModelOperations>( args?: SelectSubset>, - ): ZenStackPromise[]>; + ): ZenStackPromise[]>; /** * Updates a uniquely identified entity. @@ -604,7 +611,7 @@ export type AllModelOperations>( args: SelectSubset>, - ): ZenStackPromise>; + ): ZenStackPromise>; /** * Updates multiple entities. @@ -654,7 +661,7 @@ export type AllModelOperations>( args: Subset>, - ): ZenStackPromise[]>; + ): ZenStackPromise[]>; /** * Creates or updates an entity. @@ -678,7 +685,7 @@ export type AllModelOperations>( args: SelectSubset>, - ): ZenStackPromise>; + ): ZenStackPromise>; /** * Deletes a uniquely identifiable entity. @@ -701,7 +708,7 @@ export type AllModelOperations>( args: SelectSubset>, - ): ZenStackPromise>; + ): ZenStackPromise>; /** * Deletes multiple entities. @@ -809,8 +816,12 @@ export type AllModelOperations> = Omit< - AllModelOperations, +export type ModelOperations< + Schema extends SchemaDef, + Model extends GetModels, + Options extends ClientOptions = ClientOptions, +> = Omit< + AllModelOperations, // exclude operations not applicable to delegate models IsDelegateModel extends true ? OperationsIneligibleForDelegateModels : never >; @@ -824,7 +835,7 @@ export type ModelOperations> = Partial< - DefaultModelResult + DefaultModelResult> > & { [Key in RelationFields]?: FieldIsArray extends true ? AuthModelType>[] diff --git a/packages/orm/src/client/crud-types.ts b/packages/orm/src/client/crud-types.ts index 6fe3f076..21e75967 100644 --- a/packages/orm/src/client/crud-types.ts +++ b/packages/orm/src/client/crud-types.ts @@ -43,6 +43,7 @@ import type { WrapType, XOR, } from '../utils/type-utils'; +import type { ClientOptions } from './options'; import type { ToKyselySchema } from './query-builder'; //#region Query results @@ -50,34 +51,86 @@ import type { ToKyselySchema } from './query-builder'; export type DefaultModelResult< Schema extends SchemaDef, Model extends GetModels, + Options extends ClientOptions = ClientOptions, Omit = undefined, Optional = false, Array = false, > = WrapType< IsDelegateModel extends true ? // delegate model's selection result is a union of all sub-models - DelegateUnionResult, Omit> + DelegateUnionResult, Omit> : { - [Key in NonRelationFields as Key extends keyof Omit - ? Omit[Key] extends true - ? never - : Key + [Key in NonRelationFields as ShouldOmitField< + Schema, + Model, + Options, + Key, + Omit + > extends true + ? never : Key]: MapModelFieldType; }, Optional, Array >; +// precedence: query-level omit > options-level omit > schema-level omit +type ShouldOmitField< + Schema extends SchemaDef, + Model extends GetModels, + Options extends ClientOptions, + Field extends GetModelFields, + Omit, +> = + QueryLevelOmit extends boolean + ? QueryLevelOmit + : OptionsLevelOmit extends boolean + ? OptionsLevelOmit + : SchemaLevelOmit; + +type QueryLevelOmit< + Schema extends SchemaDef, + Model extends GetModels, + Field extends GetModelFields, + Omit, +> = Field extends keyof Omit ? (Omit[Field] extends boolean ? Omit[Field] : undefined) : undefined; + +type OptionsLevelOmit< + Schema extends SchemaDef, + Model extends GetModels, + Field extends GetModelFields, + Options extends ClientOptions, +> = Model extends keyof Options['omit'] + ? Field extends keyof Options['omit'][Model] + ? Options['omit'][Model][Field] extends boolean + ? Options['omit'][Model][Field] + : undefined + : undefined + : undefined; + +type SchemaLevelOmit< + Schema extends SchemaDef, + Model extends GetModels, + Field extends GetModelFields, +> = GetModelField['omit'] extends true ? true : false; + type DelegateUnionResult< Schema extends SchemaDef, Model extends GetModels, + Options extends ClientOptions, SubModel extends GetModels, Omit = undefined, > = SubModel extends string // typescript union distribution - ? DefaultModelResult & { [K in GetModelDiscriminator]: SubModel } // fixate discriminated field + ? DefaultModelResult & { [K in GetModelDiscriminator]: SubModel } // fixate discriminated field : never; -type ModelSelectResult, Select, Omit> = { +type ModelSelectResult< + Schema extends SchemaDef, + Model extends GetModels, + Options extends ClientOptions, + Select, + Omit, +> = { [Key in keyof Select as Select[Key] extends false | undefined ? never : Key extends keyof Omit @@ -102,6 +155,7 @@ type ModelSelectResult ? ModelResult< Schema, RelationFieldType, + Options, Pick, ModelFieldIsOptional, FieldIsArray @@ -109,6 +163,7 @@ type ModelSelectResult : ModelResult< Schema, RelationFieldType, + Options, Pick, ModelFieldIsOptional, FieldIsArray @@ -116,6 +171,7 @@ type ModelSelectResult : DefaultModelResult< Schema, RelationFieldType, + Options, Omit, ModelFieldIsOptional, FieldIsArray @@ -135,6 +191,7 @@ type SelectCountResult export type ModelResult< Schema extends SchemaDef, Model extends GetModels, + Options extends ClientOptions = ClientOptions, Args = {}, Optional = false, Array = false, @@ -143,12 +200,12 @@ export type ModelResult< select: infer S; omit?: infer O; } - ? ModelSelectResult + ? ModelSelectResult : Args extends { include: infer I; omit?: infer O; } - ? DefaultModelResult & { + ? DefaultModelResult & { [Key in keyof I & RelationFields as I[Key] extends false | undefined ? never : Key]: I[Key] extends FindArgs< @@ -159,6 +216,7 @@ export type ModelResult< ? ModelResult< Schema, RelationFieldType, + Options, I[Key], ModelFieldIsOptional, FieldIsArray @@ -166,14 +224,15 @@ export type ModelResult< : DefaultModelResult< Schema, RelationFieldType, + Options, undefined, ModelFieldIsOptional, FieldIsArray >; } : Args extends { omit: infer O } - ? DefaultModelResult - : DefaultModelResult, + ? DefaultModelResult + : DefaultModelResult, Optional, Array >; @@ -181,10 +240,11 @@ export type ModelResult< export type SimplifiedModelResult< Schema extends SchemaDef, Model extends GetModels, + Options extends ClientOptions, Args = {}, Optional = false, Array = false, -> = Simplify>; +> = Simplify>; export type TypeDefResult> = Optional< { diff --git a/packages/orm/src/client/crud/dialects/base-dialect.ts b/packages/orm/src/client/crud/dialects/base-dialect.ts index 2b96941e..42af09d2 100644 --- a/packages/orm/src/client/crud/dialects/base-dialect.ts +++ b/packages/orm/src/client/crud/dialects/base-dialect.ts @@ -873,7 +873,7 @@ export abstract class BaseCrudDialect { if (isRelationField(this.schema, model, field)) { continue; } - if (omit?.[field] === true) { + if (this.shouldOmitField(omit, model, field)) { continue; } result = this.buildSelectField(result, model, modelAlias, field); @@ -901,6 +901,26 @@ export abstract class BaseCrudDialect { return result; } + shouldOmitField(omit: unknown, model: string, field: string) { + // query-level + if (omit && typeof omit === 'object' && typeof (omit as any)[field] === 'boolean') { + return (omit as any)[field]; + } + + // options-level + if ( + this.options.omit?.[model] && + typeof this.options.omit[model] === 'object' && + typeof (this.options.omit[model] as any)[field] === 'boolean' + ) { + return (this.options.omit[model] as any)[field]; + } + + // schema-level + const fieldDef = requireField(this.schema, model, field); + return !!fieldDef.omit; + } + protected buildModelSelect( model: GetModels, subQueryAlias: string, diff --git a/packages/orm/src/client/crud/dialects/postgresql.ts b/packages/orm/src/client/crud/dialects/postgresql.ts index a37e603b..660356dd 100644 --- a/packages/orm/src/client/crud/dialects/postgresql.ts +++ b/packages/orm/src/client/crud/dialects/postgresql.ts @@ -12,6 +12,7 @@ import { match } from 'ts-pattern'; import type { BuiltinType, FieldDef, GetModels, SchemaDef } from '../../../schema'; import { DELEGATE_JOINED_FIELD_PREFIX } from '../../constants'; import type { FindArgs } from '../../crud-types'; +import { createInternalError } from '../../errors'; import type { ClientOptions } from '../../options'; import { buildJoinPairs, @@ -23,7 +24,6 @@ import { requireModel, } from '../../query-utils'; import { BaseCrudDialect } from './base-dialect'; -import { createInternalError } from '../../errors'; export class PostgresCrudDialect extends BaseCrudDialect { constructor(schema: Schema, options: ClientOptions) { @@ -305,11 +305,12 @@ export class PostgresCrudDialect extends BaseCrudDiale } if (payload === true || !payload.select) { - // select all scalar fields + // select all scalar fields except for omitted + const omit = typeof payload === 'object' ? payload.omit : undefined; objArgs.push( ...Object.entries(relationModelDef.fields) .filter(([, value]) => !value.relation) - .filter(([name]) => !(typeof payload === 'object' && (payload.omit as any)?.[name] === true)) + .filter(([name]) => !this.shouldOmitField(omit, relationModel, name)) .map(([field]) => [sql.lit(field), this.fieldRef(relationModel, field, relationModelAlias, false)]) .flatMap((v) => v), ); diff --git a/packages/orm/src/client/crud/dialects/sqlite.ts b/packages/orm/src/client/crud/dialects/sqlite.ts index 464e30dc..04b22d03 100644 --- a/packages/orm/src/client/crud/dialects/sqlite.ts +++ b/packages/orm/src/client/crud/dialects/sqlite.ts @@ -198,11 +198,12 @@ export class SqliteCrudDialect extends BaseCrudDialect } if (payload === true || !payload.select) { - // select all scalar fields + // select all scalar fields except for omitted + const omit = typeof payload === 'object' ? payload.omit : undefined; objArgs.push( ...Object.entries(relationModelDef.fields) .filter(([, value]) => !value.relation) - .filter(([name]) => !(typeof payload === 'object' && (payload.omit as any)?.[name] === true)) + .filter(([name]) => !this.shouldOmitField(omit, relationModel, name)) .map(([field]) => [sql.lit(field), this.fieldRef(relationModel, field, subQueryName, false)]) .flatMap((v) => v), ); diff --git a/packages/orm/src/client/crud/operations/base.ts b/packages/orm/src/client/crud/operations/base.ts index ce788831..f5fbca54 100644 --- a/packages/orm/src/client/crud/operations/base.ts +++ b/packages/orm/src/client/crud/operations/base.ts @@ -2141,20 +2141,21 @@ export abstract class BaseOperationHandler { const computedFields = Object.values(modelDef.fields) .filter((f) => f.computed) .map((f) => f.name); - const omit = Object.entries(args.omit ?? {}) - .filter(([, v]) => v) - .map(([k]) => k); const allFieldsSelected: string[] = []; if (!args.select || typeof args.select !== 'object') { // all non-relation fields selected - allFieldsSelected.push(...allFields.filter((f) => !relationFields.includes(f) && !omit.includes(f))); + allFieldsSelected.push( + ...allFields.filter( + (f) => !relationFields.includes(f) && !this.dialect.shouldOmitField(args.omit, model, f), + ), + ); } else { // explicit select allFieldsSelected.push( ...Object.entries(args.select) - .filter(([k, v]) => v && !omit.includes(k)) + .filter(([k, v]) => v && !this.dialect.shouldOmitField(args.omit, model, k)) .map(([k]) => k), ); } diff --git a/packages/orm/src/client/crud/validator/index.ts b/packages/orm/src/client/crud/validator/index.ts index 4be44346..ee8bd17a 100644 --- a/packages/orm/src/client/crud/validator/index.ts +++ b/packages/orm/src/client/crud/validator/index.ts @@ -1302,6 +1302,7 @@ export class InputValidator { where: this.makeWhereSchema(model, true), select: this.makeSelectSchema(model).optional().nullable(), include: this.makeIncludeSchema(model).optional().nullable(), + omit: this.makeOmitSchema(model).optional().nullable(), }); schema = this.refineForSelectIncludeMutuallyExclusive(schema); schema = this.refineForSelectOmitMutuallyExclusive(schema); diff --git a/packages/orm/src/client/options.ts b/packages/orm/src/client/options.ts index 2f6f7af7..a3feea03 100644 --- a/packages/orm/src/client/options.ts +++ b/packages/orm/src/client/options.ts @@ -1,5 +1,5 @@ import type { Dialect, Expression, ExpressionBuilder, KyselyConfig } from 'kysely'; -import type { GetModel, GetModels, ProcedureDef, SchemaDef } from '../schema'; +import type { GetModel, GetModelFields, GetModels, ProcedureDef, ScalarFields, SchemaDef } from '../schema'; import type { PrependParameter } from '../utils/type-utils'; import type { ClientContract, CRUD_EXT, ProcedureFunc } from './contract'; import type { BaseCrudDialect } from './crud/dialects/base-dialect'; @@ -78,14 +78,19 @@ export type ClientOptions = { * `@@validate`, etc. Defaults to `true`. */ validateInput?: boolean; +} & { + /** + * Options for omitting fields in ORM query results. + */ + omit?: OmitOptions; } & (HasComputedFields extends true - ? { - /** - * Computed field definitions. - */ - computedFields: ComputedFieldsOptions; - } - : {}) & + ? { + /** + * Computed field definitions. + */ + computedFields: ComputedFieldsOptions; + } + : {}) & (HasProcedures extends true ? { /** @@ -95,6 +100,15 @@ export type ClientOptions = { } : {}); +/** + * Options for omitting fields in ORM query results. + */ +export type OmitOptions = { + [Model in GetModels]?: { + [Field in GetModelFields as Field extends ScalarFields ? Field : never]?: boolean; + }; +}; + export type ComputedFieldsOptions = { [Model in GetModels as 'computedFields' extends keyof GetModel ? Model : never]: { [Field in keyof Schema['models'][Model]['computedFields']]: PrependParameter< diff --git a/packages/orm/src/client/promise.ts b/packages/orm/src/client/promise.ts index f3c261a1..0f389932 100644 --- a/packages/orm/src/client/promise.ts +++ b/packages/orm/src/client/promise.ts @@ -16,16 +16,16 @@ export type ZenStackPromise = Promise & { * Creates a promise that only executes when it's awaited or .then() is called. * @see https://github.com/prisma/prisma/blob/main/packages/client/src/runtime/core/request/createPrismaPromise.ts */ -export function createZenStackPromise( - callback: (txClient?: ClientContract) => Promise, -): ZenStackPromise { - let promise: Promise | undefined; - const cb = (txClient?: ClientContract) => { +export function createZenStackPromise( + callback: (txClient?: ClientContract) => Promise, +): ZenStackPromise { + let promise: Promise | undefined; + const cb = (txClient?: ClientContract) => { try { return (promise ??= valueToPromise(callback(txClient))); } catch (err) { // deal with synchronous errors - return Promise.reject(err); + return Promise.reject(err); } }; diff --git a/packages/schema/src/schema.ts b/packages/schema/src/schema.ts index 13fc90b9..95abd005 100644 --- a/packages/schema/src/schema.ts +++ b/packages/schema/src/schema.ts @@ -69,6 +69,7 @@ export type FieldDef = { updatedAt?: boolean; attributes?: AttributeApplication[]; default?: MappedBuiltinType | Expression | unknown[]; + omit?: boolean; relation?: RelationInfo; foreignKeyFor?: string[]; computed?: boolean; diff --git a/packages/sdk/src/ts-schema-generator.ts b/packages/sdk/src/ts-schema-generator.ts index 62c5efe5..780817aa 100644 --- a/packages/sdk/src/ts-schema-generator.ts +++ b/packages/sdk/src/ts-schema-generator.ts @@ -551,6 +551,10 @@ export class TsSchemaGenerator { objectFields.push(ts.factory.createPropertyAssignment('updatedAt', ts.factory.createTrue())); } + if (hasAttribute(field, '@omit')) { + objectFields.push(ts.factory.createPropertyAssignment('omit', ts.factory.createTrue())); + } + // originModel if ( contextModel && @@ -1550,15 +1554,20 @@ export class TsSchemaGenerator { ts.factory.createImportClause( true, undefined, - ts.factory.createNamedImports( - inputTypes.map((inputType) => + ts.factory.createNamedImports([ + ...inputTypes.map((inputType) => ts.factory.createImportSpecifier( false, undefined, ts.factory.createIdentifier(`${inputType} as $${inputType}`), ), ), - ), + ts.factory.createImportSpecifier( + false, + undefined, + ts.factory.createIdentifier('ClientOptions as $ClientOptions'), + ), + ]), ), ts.factory.createStringLiteral('@zenstackhq/orm'), ), @@ -1607,7 +1616,7 @@ export class TsSchemaGenerator { ); } - // generate: export type ModelGetPayload> = $SimplifiedModelResult; + // generate: export type ModelGetPayload, Options extends ClientOptions> = $SimplifiedModelResult; statements.push( ts.factory.createTypeAliasDeclaration( [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)], @@ -1622,10 +1631,21 @@ export class TsSchemaGenerator { ts.factory.createLiteralTypeNode(ts.factory.createTrue()), ]), ), + ts.factory.createTypeParameterDeclaration( + undefined, + 'Options', + ts.factory.createTypeReferenceNode('$ClientOptions', [ + ts.factory.createTypeReferenceNode('$Schema'), + ]), + ts.factory.createTypeReferenceNode('$ClientOptions', [ + ts.factory.createTypeReferenceNode('$Schema'), + ]), + ), ], ts.factory.createTypeReferenceNode('$SimplifiedModelResult', [ ts.factory.createTypeReferenceNode('$Schema'), ts.factory.createLiteralTypeNode(ts.factory.createStringLiteral(dm.name)), + ts.factory.createTypeReferenceNode('Options'), ts.factory.createTypeReferenceNode('Args'), ]), ), diff --git a/packages/testtools/src/client.ts b/packages/testtools/src/client.ts index b00c38ae..c756f126 100644 --- a/packages/testtools/src/client.ts +++ b/packages/testtools/src/client.ts @@ -32,7 +32,7 @@ const TEST_PG_CONFIG = { password: process.env['TEST_PG_PASSWORD'] ?? 'postgres', }; -export type CreateTestClientOptions = Omit, 'dialect'> & { +type ExtraTestClientOptions = { /** * Database provider */ @@ -81,23 +81,27 @@ export type CreateTestClientOptions = Omit( - schema: Schema, - options?: CreateTestClientOptions, -): Promise>; -export async function createTestClient( - schema: string, - options?: CreateTestClientOptions, -): Promise; -export async function createTestClient( - schema: Schema | string, - options?: CreateTestClientOptions, +export type CreateTestClientOptions = Omit, 'dialect'> & + ExtraTestClientOptions; + +export async function createTestClient< + Schema extends SchemaDef, + Options extends ClientOptions, + CreateOptions = Omit, +>(schema: Schema, options?: CreateOptions): Promise>; +export async function createTestClient(schema: string, options?: CreateTestClientOptions): Promise; +export async function createTestClient( + schema: SchemaDef | string, + options?: CreateTestClientOptions, ): Promise { let workDir = options?.workDir; - let _schema: Schema; + let _schema: SchemaDef; const provider = options?.provider ?? getTestDbProvider() ?? 'sqlite'; const dbName = options?.dbName ?? getTestDbName(provider); const dbUrl = @@ -118,7 +122,7 @@ export async function createTestClient( ...generated.schema.provider, type: provider, }, - } as Schema; + } as SchemaDef; } else { // replace schema's provider _schema = { @@ -148,9 +152,9 @@ export async function createTestClient( invariant(workDir); const { plugins, ...rest } = options ?? {}; - const _options: ClientOptions = { + const _options = { ...rest, - } as ClientOptions; + } as ClientOptions; if (options?.debug) { console.log(`Work directory: ${workDir}`); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f313b66c..69a4d33e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -67,8 +67,8 @@ catalogs: specifier: ^5.7.1 version: 5.7.1 typescript: - specifier: ^5.8.0 - version: 5.8.3 + specifier: ^5.9.3 + version: 5.9.3 vue: specifier: 3.5.22 version: 3.5.22 @@ -97,10 +97,10 @@ importers: version: 3.5.3 prisma: specifier: 'catalog:' - version: 6.19.0(magicast@0.3.5)(typescript@5.8.3) + version: 6.19.0(magicast@0.3.5)(typescript@5.9.3) tsup: specifier: ^8.5.0 - version: 8.5.0(@swc/core@1.12.5)(jiti@2.6.1)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.8.3)(yaml@2.8.0) + version: 8.5.0(@swc/core@1.12.5)(jiti@2.6.1)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.9.3)(yaml@2.8.0) tsx: specifier: ^4.20.3 version: 4.20.3 @@ -109,10 +109,10 @@ importers: version: 2.5.4 typescript: specifier: 'catalog:' - version: 5.8.3 + version: 5.9.3 typescript-eslint: specifier: ^8.34.1 - version: 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + version: 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) vitest: specifier: ^3.2.4 version: 3.2.4(@types/node@20.19.24)(happy-dom@20.0.10)(jiti@2.6.1)(jsdom@27.1.0)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.0) @@ -185,7 +185,7 @@ importers: version: 1.3.0 prisma: specifier: 'catalog:' - version: 6.19.0(magicast@0.3.5)(typescript@5.8.3) + version: 6.19.0(magicast@0.3.5)(typescript@5.9.3) semver: specifier: ^7.7.2 version: 7.7.2 @@ -250,7 +250,7 @@ importers: version: 5.90.2(svelte@5.43.3) '@tanstack/vue-query': specifier: 5.90.6 - version: 5.90.6(vue@3.5.22(typescript@5.8.3)) + version: 5.90.6(vue@3.5.22(typescript@5.9.3)) '@testing-library/dom': specifier: ^10.4.1 version: 10.4.1 @@ -289,7 +289,7 @@ importers: version: 5.43.3 vue: specifier: 'catalog:' - version: 3.5.22(typescript@5.8.3) + version: 3.5.22(typescript@5.9.3) packages/common-helpers: devDependencies: @@ -529,7 +529,7 @@ importers: version: 5.7.1 typescript: specifier: 'catalog:' - version: 5.8.3 + version: 5.9.3 devDependencies: '@zenstackhq/eslint-config': specifier: workspace:* @@ -600,7 +600,7 @@ importers: version: 2.2.0 elysia: specifier: ^1.3.1 - version: 1.4.13(@sinclair/typebox@0.34.41)(exact-mirror@0.2.2(@sinclair/typebox@0.34.41))(file-type@21.0.0)(openapi-types@12.1.3)(typescript@5.8.3) + version: 1.4.13(@sinclair/typebox@0.34.41)(exact-mirror@0.2.2(@sinclair/typebox@0.34.41))(file-type@21.0.0)(openapi-types@12.1.3)(typescript@5.9.3) express: specifier: ^5.0.0 version: 5.1.0 @@ -621,7 +621,7 @@ importers: version: 16.0.1(@babel/core@7.28.5)(react-dom@19.2.0(react@19.2.0))(react@19.2.0) nuxt: specifier: ^4.2.0 - version: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) + version: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) supertest: specifier: ^7.1.4 version: 7.1.4 @@ -663,7 +663,7 @@ importers: version: 8.16.3 prisma: specifier: 'catalog:' - version: 6.19.0(magicast@0.3.5)(typescript@5.8.3) + version: 6.19.0(magicast@0.3.5)(typescript@5.9.3) tmp: specifier: 'catalog:' version: 0.2.3 @@ -691,7 +691,7 @@ importers: version: link:../config/typescript-config typescript: specifier: 'catalog:' - version: 5.8.3 + version: 5.9.3 packages/zod: dependencies: @@ -802,7 +802,7 @@ importers: version: link:../../packages/config/typescript-config prisma: specifier: 'catalog:' - version: 6.19.0(magicast@0.3.5)(typescript@5.8.3) + version: 6.19.0(magicast@0.3.5)(typescript@5.9.3) tests/e2e: dependencies: @@ -7085,6 +7085,11 @@ packages: engines: {node: '>=14.17'} hasBin: true + typescript@5.9.3: + resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} + engines: {node: '>=14.17'} + hasBin: true + ufo@1.6.1: resolution: {integrity: sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==} @@ -8512,12 +8517,12 @@ snapshots: prompts: 2.4.2 semver: 7.7.3 - '@nuxt/devtools@2.7.0(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3))': + '@nuxt/devtools@2.7.0(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))': dependencies: '@nuxt/devtools-kit': 2.7.0(magicast@0.3.5)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)) '@nuxt/devtools-wizard': 2.7.0 '@nuxt/kit': 3.20.0(magicast@0.3.5) - '@vue/devtools-core': 7.7.7(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3)) + '@vue/devtools-core': 7.7.7(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3)) '@vue/devtools-kit': 7.7.7 birpc: 2.6.1 consola: 3.4.2 @@ -8544,7 +8549,7 @@ snapshots: tinyglobby: 0.2.15 vite: 7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1) vite-plugin-inspect: 11.3.3(@nuxt/kit@3.20.0(magicast@0.3.5))(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)) - vite-plugin-vue-tracer: 1.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3)) + vite-plugin-vue-tracer: 1.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3)) which: 5.0.0 ws: 8.18.3 transitivePeerDependencies: @@ -8630,11 +8635,11 @@ snapshots: transitivePeerDependencies: - magicast - '@nuxt/nitro-server@4.2.0(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(ioredis@5.8.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(typescript@5.8.3)': + '@nuxt/nitro-server@4.2.0(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(ioredis@5.8.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(typescript@5.9.3)': dependencies: '@nuxt/devalue': 2.0.2 '@nuxt/kit': 4.2.0(magicast@0.5.0) - '@unhead/vue': 2.0.19(vue@3.5.22(typescript@5.8.3)) + '@unhead/vue': 2.0.19(vue@3.5.22(typescript@5.9.3)) '@vue/shared': 3.5.22 consola: 3.4.2 defu: 6.1.4 @@ -8648,7 +8653,7 @@ snapshots: klona: 2.0.6 mocked-exports: 0.1.1 nitropack: 2.12.9(better-sqlite3@12.2.0) - nuxt: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) + nuxt: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) pathe: 2.0.3 pkg-types: 2.3.0 radix3: 1.1.2 @@ -8656,7 +8661,7 @@ snapshots: ufo: 1.6.1 unctx: 2.4.1 unstorage: 1.17.1(db0@0.3.4(better-sqlite3@12.2.0))(ioredis@5.8.2) - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) vue-bundle-renderer: 2.2.0 vue-devtools-stub: 0.1.0 transitivePeerDependencies: @@ -8719,12 +8724,12 @@ snapshots: transitivePeerDependencies: - magicast - '@nuxt/vite-builder@4.2.0(@types/node@20.19.24)(eslint@9.29.0(jiti@2.6.1))(lightningcss@1.30.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vue@3.5.22(typescript@5.8.3))(yaml@2.8.1)': + '@nuxt/vite-builder@4.2.0(@types/node@20.19.24)(eslint@9.29.0(jiti@2.6.1))(lightningcss@1.30.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vue@3.5.22(typescript@5.9.3))(yaml@2.8.1)': dependencies: '@nuxt/kit': 4.2.0(magicast@0.5.0) '@rollup/plugin-replace': 6.0.3(rollup@4.52.5) - '@vitejs/plugin-vue': 6.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3)) - '@vitejs/plugin-vue-jsx': 5.1.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3)) + '@vitejs/plugin-vue': 6.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3)) + '@vitejs/plugin-vue-jsx': 5.1.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3)) autoprefixer: 10.4.21(postcss@8.5.6) consola: 3.4.2 cssnano: 7.1.2(postcss@8.5.6) @@ -8739,7 +8744,7 @@ snapshots: magic-string: 0.30.21 mlly: 1.8.0 mocked-exports: 0.1.1 - nuxt: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) + nuxt: 4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1) pathe: 2.0.3 pkg-types: 2.3.0 postcss: 8.5.6 @@ -8750,8 +8755,8 @@ snapshots: unenv: 2.0.0-rc.24 vite: 7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1) vite-node: 3.2.4(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1) - vite-plugin-checker: 0.11.0(eslint@9.29.0(jiti@2.6.1))(optionator@0.9.4)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)) - vue: 3.5.22(typescript@5.8.3) + vite-plugin-checker: 0.11.0(eslint@9.29.0(jiti@2.6.1))(optionator@0.9.4)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)) + vue: 3.5.22(typescript@5.9.3) vue-bundle-renderer: 2.2.0 transitivePeerDependencies: - '@biomejs/biome' @@ -9554,13 +9559,13 @@ snapshots: '@tanstack/query-core': 5.90.2 svelte: 5.43.3 - '@tanstack/vue-query@5.90.6(vue@3.5.22(typescript@5.8.3))': + '@tanstack/vue-query@5.90.6(vue@3.5.22(typescript@5.9.3))': dependencies: '@tanstack/match-sorter-utils': 8.19.4 '@tanstack/query-core': 5.90.6 '@vue/devtools-api': 6.6.4 - vue: 3.5.22(typescript@5.8.3) - vue-demi: 0.14.10(vue@3.5.22(typescript@5.8.3)) + vue: 3.5.22(typescript@5.9.3) + vue-demi: 0.14.10(vue@3.5.22(typescript@5.9.3)) '@testing-library/dom@10.4.1': dependencies: @@ -9730,20 +9735,20 @@ snapshots: '@types/whatwg-mimetype@3.0.2': {} - '@typescript-eslint/eslint-plugin@8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/eslint-plugin@8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/parser': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) '@typescript-eslint/scope-manager': 8.34.1 - '@typescript-eslint/type-utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) - '@typescript-eslint/utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/type-utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) '@typescript-eslint/visitor-keys': 8.34.1 eslint: 9.29.0(jiti@2.6.1) graphemer: 1.4.0 ignore: 7.0.5 natural-compare: 1.4.0 - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9764,15 +9769,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/parser@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@typescript-eslint/scope-manager': 8.34.1 '@typescript-eslint/types': 8.34.1 - '@typescript-eslint/typescript-estree': 8.34.1(typescript@5.8.3) + '@typescript-eslint/typescript-estree': 8.34.1(typescript@5.9.3) '@typescript-eslint/visitor-keys': 8.34.1 debug: 4.4.1 eslint: 9.29.0(jiti@2.6.1) - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9788,12 +9793,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.34.1(typescript@5.8.3)': + '@typescript-eslint/project-service@8.34.1(typescript@5.9.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.34.1(typescript@5.8.3) + '@typescript-eslint/tsconfig-utils': 8.34.1(typescript@5.9.3) '@typescript-eslint/types': 8.34.1 debug: 4.4.1 - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9816,22 +9821,22 @@ snapshots: '@typescript-eslint/types': 8.46.2 '@typescript-eslint/visitor-keys': 8.46.2 - '@typescript-eslint/tsconfig-utils@8.34.1(typescript@5.8.3)': + '@typescript-eslint/tsconfig-utils@8.34.1(typescript@5.9.3)': dependencies: - typescript: 5.8.3 + typescript: 5.9.3 '@typescript-eslint/tsconfig-utils@8.46.2(typescript@5.8.3)': dependencies: typescript: 5.8.3 - '@typescript-eslint/type-utils@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/type-utils@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: - '@typescript-eslint/typescript-estree': 8.34.1(typescript@5.8.3) - '@typescript-eslint/utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/typescript-estree': 8.34.1(typescript@5.9.3) + '@typescript-eslint/utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) debug: 4.4.1 eslint: 9.29.0(jiti@2.6.1) - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9851,10 +9856,10 @@ snapshots: '@typescript-eslint/types@8.46.2': {} - '@typescript-eslint/typescript-estree@8.34.1(typescript@5.8.3)': + '@typescript-eslint/typescript-estree@8.34.1(typescript@5.9.3)': dependencies: - '@typescript-eslint/project-service': 8.34.1(typescript@5.8.3) - '@typescript-eslint/tsconfig-utils': 8.34.1(typescript@5.8.3) + '@typescript-eslint/project-service': 8.34.1(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.34.1(typescript@5.9.3) '@typescript-eslint/types': 8.34.1 '@typescript-eslint/visitor-keys': 8.34.1 debug: 4.4.1 @@ -9862,8 +9867,8 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.7.2 - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9883,14 +9888,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/utils@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/eslint-utils': 4.7.0(eslint@9.29.0(jiti@2.6.1)) '@typescript-eslint/scope-manager': 8.34.1 '@typescript-eslint/types': 8.34.1 - '@typescript-eslint/typescript-estree': 8.34.1(typescript@5.8.3) + '@typescript-eslint/typescript-estree': 8.34.1(typescript@5.9.3) eslint: 9.29.0(jiti@2.6.1) - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9915,11 +9920,11 @@ snapshots: '@typescript-eslint/types': 8.46.2 eslint-visitor-keys: 4.2.1 - '@unhead/vue@2.0.19(vue@3.5.22(typescript@5.8.3))': + '@unhead/vue@2.0.19(vue@3.5.22(typescript@5.9.3))': dependencies: hookable: 5.5.3 unhead: 2.0.19 - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) '@unrs/resolver-binding-android-arm-eabi@1.11.1': optional: true @@ -9999,7 +10004,7 @@ snapshots: - rollup - supports-color - '@vitejs/plugin-vue-jsx@5.1.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3))': + '@vitejs/plugin-vue-jsx@5.1.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))': dependencies: '@babel/core': 7.28.5 '@babel/plugin-syntax-typescript': 7.27.1(@babel/core@7.28.5) @@ -10007,15 +10012,15 @@ snapshots: '@rolldown/pluginutils': 1.0.0-beta.45 '@vue/babel-plugin-jsx': 1.5.0(@babel/core@7.28.5) vite: 7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1) - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) transitivePeerDependencies: - supports-color - '@vitejs/plugin-vue@6.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3))': + '@vitejs/plugin-vue@6.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))': dependencies: '@rolldown/pluginutils': 1.0.0-beta.29 vite: 7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1) - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) '@vitest/expect@3.2.4': dependencies: @@ -10065,7 +10070,7 @@ snapshots: '@volar/source-map@2.4.23': {} - '@vue-macros/common@3.1.1(vue@3.5.22(typescript@5.8.3))': + '@vue-macros/common@3.1.1(vue@3.5.22(typescript@5.9.3))': dependencies: '@vue/compiler-sfc': 3.5.22 ast-kit: 2.1.3 @@ -10073,7 +10078,7 @@ snapshots: magic-string-ast: 1.0.3 unplugin-utils: 0.3.1 optionalDependencies: - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) '@vue/babel-helper-vue-transform-on@1.5.0': {} @@ -10136,7 +10141,7 @@ snapshots: '@vue/devtools-api@6.6.4': {} - '@vue/devtools-core@7.7.7(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3))': + '@vue/devtools-core@7.7.7(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3))': dependencies: '@vue/devtools-kit': 7.7.7 '@vue/devtools-shared': 7.7.7 @@ -10144,7 +10149,7 @@ snapshots: nanoid: 5.1.6 pathe: 2.0.3 vite-hot-client: 2.1.0(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)) - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) transitivePeerDependencies: - vite @@ -10162,7 +10167,7 @@ snapshots: dependencies: rfdc: 1.4.1 - '@vue/language-core@3.1.2(typescript@5.8.3)': + '@vue/language-core@3.1.2(typescript@5.9.3)': dependencies: '@volar/language-core': 2.4.23 '@vue/compiler-dom': 3.5.22 @@ -10172,7 +10177,7 @@ snapshots: path-browserify: 1.0.1 picomatch: 4.0.3 optionalDependencies: - typescript: 5.8.3 + typescript: 5.9.3 '@vue/reactivity@3.5.22': dependencies: @@ -10190,11 +10195,11 @@ snapshots: '@vue/shared': 3.5.22 csstype: 3.1.3 - '@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.8.3))': + '@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.9.3))': dependencies: '@vue/compiler-ssr': 3.5.22 '@vue/shared': 3.5.22 - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) '@vue/shared@3.5.22': {} @@ -11042,7 +11047,7 @@ snapshots: electron-to-chromium@1.5.243: {} - elysia@1.4.13(@sinclair/typebox@0.34.41)(exact-mirror@0.2.2(@sinclair/typebox@0.34.41))(file-type@21.0.0)(openapi-types@12.1.3)(typescript@5.8.3): + elysia@1.4.13(@sinclair/typebox@0.34.41)(exact-mirror@0.2.2(@sinclair/typebox@0.34.41))(file-type@21.0.0)(openapi-types@12.1.3)(typescript@5.9.3): dependencies: '@sinclair/typebox': 0.34.41 cookie: 1.0.2 @@ -11052,7 +11057,7 @@ snapshots: memoirist: 0.4.0 openapi-types: 12.1.3 optionalDependencies: - typescript: 5.8.3 + typescript: 5.9.3 emoji-regex@8.0.0: {} @@ -12844,17 +12849,17 @@ snapshots: dependencies: boolbase: 1.0.0 - nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1): + nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1): dependencies: '@dxup/nuxt': 0.2.0(magicast@0.5.0) '@nuxt/cli': 3.29.3(magicast@0.5.0) - '@nuxt/devtools': 2.7.0(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3)) + '@nuxt/devtools': 2.7.0(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3)) '@nuxt/kit': 4.2.0(magicast@0.5.0) - '@nuxt/nitro-server': 4.2.0(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(ioredis@5.8.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(typescript@5.8.3) + '@nuxt/nitro-server': 4.2.0(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(ioredis@5.8.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(typescript@5.9.3) '@nuxt/schema': 4.2.0 '@nuxt/telemetry': 2.6.6(magicast@0.5.0) - '@nuxt/vite-builder': 4.2.0(@types/node@20.19.24)(eslint@9.29.0(jiti@2.6.1))(lightningcss@1.30.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.8.3)(vue@3.5.22(typescript@5.8.3))(yaml@2.8.1) - '@unhead/vue': 2.0.19(vue@3.5.22(typescript@5.8.3)) + '@nuxt/vite-builder': 4.2.0(@types/node@20.19.24)(eslint@9.29.0(jiti@2.6.1))(lightningcss@1.30.2)(magicast@0.5.0)(nuxt@4.2.0(@parcel/watcher@2.5.1)(@types/node@20.19.24)(@vue/compiler-sfc@3.5.22)(better-sqlite3@12.2.0)(db0@0.3.4(better-sqlite3@12.2.0))(eslint@9.29.0(jiti@2.6.1))(ioredis@5.8.2)(lightningcss@1.30.2)(magicast@0.5.0)(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(yaml@2.8.1))(optionator@0.9.4)(rollup@4.52.5)(terser@5.44.0)(tsx@4.20.3)(typescript@5.9.3)(vue@3.5.22(typescript@5.9.3))(yaml@2.8.1) + '@unhead/vue': 2.0.19(vue@3.5.22(typescript@5.9.3)) '@vue/shared': 3.5.22 c12: 3.3.1(magicast@0.5.0) chokidar: 4.0.3 @@ -12899,10 +12904,10 @@ snapshots: unctx: 2.4.1 unimport: 5.5.0 unplugin: 2.3.10 - unplugin-vue-router: 0.16.0(@vue/compiler-sfc@3.5.22)(typescript@5.8.3)(vue-router@4.6.3(vue@3.5.22(typescript@5.8.3)))(vue@3.5.22(typescript@5.8.3)) + unplugin-vue-router: 0.16.0(@vue/compiler-sfc@3.5.22)(typescript@5.9.3)(vue-router@4.6.3(vue@3.5.22(typescript@5.9.3)))(vue@3.5.22(typescript@5.9.3)) untyped: 2.0.0 - vue: 3.5.22(typescript@5.8.3) - vue-router: 4.6.3(vue@3.5.22(typescript@5.8.3)) + vue: 3.5.22(typescript@5.9.3) + vue-router: 4.6.3(vue@3.5.22(typescript@5.9.3)) optionalDependencies: '@parcel/watcher': 2.5.1 '@types/node': 20.19.24 @@ -13540,12 +13545,12 @@ snapshots: dependencies: parse-ms: 4.0.0 - prisma@6.19.0(magicast@0.3.5)(typescript@5.8.3): + prisma@6.19.0(magicast@0.3.5)(typescript@5.9.3): dependencies: '@prisma/config': 6.19.0(magicast@0.3.5) '@prisma/engines': 6.19.0 optionalDependencies: - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - magicast @@ -14421,6 +14426,10 @@ snapshots: dependencies: typescript: 5.8.3 + ts-api-utils@2.1.0(typescript@5.9.3): + dependencies: + typescript: 5.9.3 + ts-interface-checker@0.1.13: {} ts-japi@1.12.1: {} @@ -14438,7 +14447,7 @@ snapshots: tslib@2.8.1: {} - tsup@8.5.0(@swc/core@1.12.5)(jiti@2.6.1)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.8.3)(yaml@2.8.0): + tsup@8.5.0(@swc/core@1.12.5)(jiti@2.6.1)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.9.3)(yaml@2.8.0): dependencies: bundle-require: 5.1.0(esbuild@0.25.5) cac: 6.7.14 @@ -14460,7 +14469,7 @@ snapshots: optionalDependencies: '@swc/core': 1.12.5 postcss: 8.5.6 - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - jiti - supports-color @@ -14558,13 +14567,13 @@ snapshots: possible-typed-array-names: 1.1.0 reflect.getprototypeof: 1.0.10 - typescript-eslint@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3): + typescript-eslint@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) - '@typescript-eslint/parser': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) - '@typescript-eslint/utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/eslint-plugin': 8.34.1(@typescript-eslint/parser@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/parser': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/utils': 8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) eslint: 9.29.0(jiti@2.6.1) - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -14581,6 +14590,8 @@ snapshots: typescript@5.8.3: {} + typescript@5.9.3: {} + ufo@1.6.1: {} uint8array-extras@1.5.0: {} @@ -14652,12 +14663,12 @@ snapshots: pathe: 2.0.3 picomatch: 4.0.3 - unplugin-vue-router@0.16.0(@vue/compiler-sfc@3.5.22)(typescript@5.8.3)(vue-router@4.6.3(vue@3.5.22(typescript@5.8.3)))(vue@3.5.22(typescript@5.8.3)): + unplugin-vue-router@0.16.0(@vue/compiler-sfc@3.5.22)(typescript@5.9.3)(vue-router@4.6.3(vue@3.5.22(typescript@5.9.3)))(vue@3.5.22(typescript@5.9.3)): dependencies: '@babel/generator': 7.28.5 - '@vue-macros/common': 3.1.1(vue@3.5.22(typescript@5.8.3)) + '@vue-macros/common': 3.1.1(vue@3.5.22(typescript@5.9.3)) '@vue/compiler-sfc': 3.5.22 - '@vue/language-core': 3.1.2(typescript@5.8.3) + '@vue/language-core': 3.1.2(typescript@5.9.3) ast-walker-scope: 0.8.3 chokidar: 4.0.3 json5: 2.2.3 @@ -14673,7 +14684,7 @@ snapshots: unplugin-utils: 0.3.1 yaml: 2.8.1 optionalDependencies: - vue-router: 4.6.3(vue@3.5.22(typescript@5.8.3)) + vue-router: 4.6.3(vue@3.5.22(typescript@5.9.3)) transitivePeerDependencies: - typescript - vue @@ -14818,7 +14829,7 @@ snapshots: - tsx - yaml - vite-plugin-checker@0.11.0(eslint@9.29.0(jiti@2.6.1))(optionator@0.9.4)(typescript@5.8.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)): + vite-plugin-checker@0.11.0(eslint@9.29.0(jiti@2.6.1))(optionator@0.9.4)(typescript@5.9.3)(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)): dependencies: '@babel/code-frame': 7.27.1 chokidar: 4.0.3 @@ -14832,7 +14843,7 @@ snapshots: optionalDependencies: eslint: 9.29.0(jiti@2.6.1) optionator: 0.9.4 - typescript: 5.8.3 + typescript: 5.9.3 vite-plugin-inspect@11.3.3(@nuxt/kit@3.20.0(magicast@0.3.5))(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1)): dependencies: @@ -14851,7 +14862,7 @@ snapshots: transitivePeerDependencies: - supports-color - vite-plugin-vue-tracer@1.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.8.3)): + vite-plugin-vue-tracer@1.0.1(vite@7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1))(vue@3.5.22(typescript@5.9.3)): dependencies: estree-walker: 3.0.3 exsolve: 1.0.7 @@ -14859,7 +14870,7 @@ snapshots: pathe: 2.0.3 source-map-js: 1.2.1 vite: 7.1.12(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.1) - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) vite@6.3.5(@types/node@20.19.24)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.0)(tsx@4.20.3)(yaml@2.8.0): dependencies: @@ -14988,26 +14999,26 @@ snapshots: dependencies: ufo: 1.6.1 - vue-demi@0.14.10(vue@3.5.22(typescript@5.8.3)): + vue-demi@0.14.10(vue@3.5.22(typescript@5.9.3)): dependencies: - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) vue-devtools-stub@0.1.0: {} - vue-router@4.6.3(vue@3.5.22(typescript@5.8.3)): + vue-router@4.6.3(vue@3.5.22(typescript@5.9.3)): dependencies: '@vue/devtools-api': 6.6.4 - vue: 3.5.22(typescript@5.8.3) + vue: 3.5.22(typescript@5.9.3) - vue@3.5.22(typescript@5.8.3): + vue@3.5.22(typescript@5.9.3): dependencies: '@vue/compiler-dom': 3.5.22 '@vue/compiler-sfc': 3.5.22 '@vue/runtime-dom': 3.5.22 - '@vue/server-renderer': 3.5.22(vue@3.5.22(typescript@5.8.3)) + '@vue/server-renderer': 3.5.22(vue@3.5.22(typescript@5.9.3)) '@vue/shared': 3.5.22 optionalDependencies: - typescript: 5.8.3 + typescript: 5.9.3 w3c-xmlserializer@5.0.0: dependencies: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 045fb619..e5cc8997 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -9,7 +9,7 @@ catalog: langium: 3.5.0 langium-cli: 3.5.0 ts-pattern: ^5.7.1 - typescript: ^5.8.0 + typescript: ^5.9.3 '@types/node': ^20.19.0 tmp: ^0.2.3 '@types/tmp': ^0.2.6 diff --git a/tests/e2e/apps/rally/zenstack/input.ts b/tests/e2e/apps/rally/zenstack/input.ts index 65715c19..fcb5ede6 100644 --- a/tests/e2e/apps/rally/zenstack/input.ts +++ b/tests/e2e/apps/rally/zenstack/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type AccountFindManyArgs = $FindManyArgs<$Schema, "Account">; export type AccountFindUniqueArgs = $FindUniqueArgs<$Schema, "Account">; @@ -27,7 +27,7 @@ export type AccountWhereInput = $WhereInput<$Schema, "Account">; export type AccountSelect = $SelectInput<$Schema, "Account">; export type AccountInclude = $IncludeInput<$Schema, "Account">; export type AccountOmit = $OmitInput<$Schema, "Account">; -export type AccountGetPayload> = $SimplifiedModelResult<$Schema, "Account", Args>; +export type AccountGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Account", Options, Args>; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; export type UserFindFirstArgs = $FindFirstArgs<$Schema, "User">; @@ -47,7 +47,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type VerificationTokenFindManyArgs = $FindManyArgs<$Schema, "VerificationToken">; export type VerificationTokenFindUniqueArgs = $FindUniqueArgs<$Schema, "VerificationToken">; export type VerificationTokenFindFirstArgs = $FindFirstArgs<$Schema, "VerificationToken">; @@ -67,7 +67,7 @@ export type VerificationTokenWhereInput = $WhereInput<$Schema, "VerificationToke export type VerificationTokenSelect = $SelectInput<$Schema, "VerificationToken">; export type VerificationTokenInclude = $IncludeInput<$Schema, "VerificationToken">; export type VerificationTokenOmit = $OmitInput<$Schema, "VerificationToken">; -export type VerificationTokenGetPayload> = $SimplifiedModelResult<$Schema, "VerificationToken", Args>; +export type VerificationTokenGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "VerificationToken", Options, Args>; export type SessionFindManyArgs = $FindManyArgs<$Schema, "Session">; export type SessionFindUniqueArgs = $FindUniqueArgs<$Schema, "Session">; export type SessionFindFirstArgs = $FindFirstArgs<$Schema, "Session">; @@ -87,7 +87,7 @@ export type SessionWhereInput = $WhereInput<$Schema, "Session">; export type SessionSelect = $SelectInput<$Schema, "Session">; export type SessionInclude = $IncludeInput<$Schema, "Session">; export type SessionOmit = $OmitInput<$Schema, "Session">; -export type SessionGetPayload> = $SimplifiedModelResult<$Schema, "Session", Args>; +export type SessionGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Session", Options, Args>; export type VerificationFindManyArgs = $FindManyArgs<$Schema, "Verification">; export type VerificationFindUniqueArgs = $FindUniqueArgs<$Schema, "Verification">; export type VerificationFindFirstArgs = $FindFirstArgs<$Schema, "Verification">; @@ -107,7 +107,7 @@ export type VerificationWhereInput = $WhereInput<$Schema, "Verification">; export type VerificationSelect = $SelectInput<$Schema, "Verification">; export type VerificationInclude = $IncludeInput<$Schema, "Verification">; export type VerificationOmit = $OmitInput<$Schema, "Verification">; -export type VerificationGetPayload> = $SimplifiedModelResult<$Schema, "Verification", Args>; +export type VerificationGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Verification", Options, Args>; export type PollFindManyArgs = $FindManyArgs<$Schema, "Poll">; export type PollFindUniqueArgs = $FindUniqueArgs<$Schema, "Poll">; export type PollFindFirstArgs = $FindFirstArgs<$Schema, "Poll">; @@ -127,7 +127,7 @@ export type PollWhereInput = $WhereInput<$Schema, "Poll">; export type PollSelect = $SelectInput<$Schema, "Poll">; export type PollInclude = $IncludeInput<$Schema, "Poll">; export type PollOmit = $OmitInput<$Schema, "Poll">; -export type PollGetPayload> = $SimplifiedModelResult<$Schema, "Poll", Args>; +export type PollGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Poll", Options, Args>; export type WatcherFindManyArgs = $FindManyArgs<$Schema, "Watcher">; export type WatcherFindUniqueArgs = $FindUniqueArgs<$Schema, "Watcher">; export type WatcherFindFirstArgs = $FindFirstArgs<$Schema, "Watcher">; @@ -147,7 +147,7 @@ export type WatcherWhereInput = $WhereInput<$Schema, "Watcher">; export type WatcherSelect = $SelectInput<$Schema, "Watcher">; export type WatcherInclude = $IncludeInput<$Schema, "Watcher">; export type WatcherOmit = $OmitInput<$Schema, "Watcher">; -export type WatcherGetPayload> = $SimplifiedModelResult<$Schema, "Watcher", Args>; +export type WatcherGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Watcher", Options, Args>; export type ParticipantFindManyArgs = $FindManyArgs<$Schema, "Participant">; export type ParticipantFindUniqueArgs = $FindUniqueArgs<$Schema, "Participant">; export type ParticipantFindFirstArgs = $FindFirstArgs<$Schema, "Participant">; @@ -167,7 +167,7 @@ export type ParticipantWhereInput = $WhereInput<$Schema, "Participant">; export type ParticipantSelect = $SelectInput<$Schema, "Participant">; export type ParticipantInclude = $IncludeInput<$Schema, "Participant">; export type ParticipantOmit = $OmitInput<$Schema, "Participant">; -export type ParticipantGetPayload> = $SimplifiedModelResult<$Schema, "Participant", Args>; +export type ParticipantGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Participant", Options, Args>; export type OptionFindManyArgs = $FindManyArgs<$Schema, "Option">; export type OptionFindUniqueArgs = $FindUniqueArgs<$Schema, "Option">; export type OptionFindFirstArgs = $FindFirstArgs<$Schema, "Option">; @@ -187,7 +187,7 @@ export type OptionWhereInput = $WhereInput<$Schema, "Option">; export type OptionSelect = $SelectInput<$Schema, "Option">; export type OptionInclude = $IncludeInput<$Schema, "Option">; export type OptionOmit = $OmitInput<$Schema, "Option">; -export type OptionGetPayload> = $SimplifiedModelResult<$Schema, "Option", Args>; +export type OptionGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Option", Options, Args>; export type VoteFindManyArgs = $FindManyArgs<$Schema, "Vote">; export type VoteFindUniqueArgs = $FindUniqueArgs<$Schema, "Vote">; export type VoteFindFirstArgs = $FindFirstArgs<$Schema, "Vote">; @@ -207,7 +207,7 @@ export type VoteWhereInput = $WhereInput<$Schema, "Vote">; export type VoteSelect = $SelectInput<$Schema, "Vote">; export type VoteInclude = $IncludeInput<$Schema, "Vote">; export type VoteOmit = $OmitInput<$Schema, "Vote">; -export type VoteGetPayload> = $SimplifiedModelResult<$Schema, "Vote", Args>; +export type VoteGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Vote", Options, Args>; export type CommentFindManyArgs = $FindManyArgs<$Schema, "Comment">; export type CommentFindUniqueArgs = $FindUniqueArgs<$Schema, "Comment">; export type CommentFindFirstArgs = $FindFirstArgs<$Schema, "Comment">; @@ -227,7 +227,7 @@ export type CommentWhereInput = $WhereInput<$Schema, "Comment">; export type CommentSelect = $SelectInput<$Schema, "Comment">; export type CommentInclude = $IncludeInput<$Schema, "Comment">; export type CommentOmit = $OmitInput<$Schema, "Comment">; -export type CommentGetPayload> = $SimplifiedModelResult<$Schema, "Comment", Args>; +export type CommentGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Comment", Options, Args>; export type PollViewFindManyArgs = $FindManyArgs<$Schema, "PollView">; export type PollViewFindUniqueArgs = $FindUniqueArgs<$Schema, "PollView">; export type PollViewFindFirstArgs = $FindFirstArgs<$Schema, "PollView">; @@ -247,7 +247,7 @@ export type PollViewWhereInput = $WhereInput<$Schema, "PollView">; export type PollViewSelect = $SelectInput<$Schema, "PollView">; export type PollViewInclude = $IncludeInput<$Schema, "PollView">; export type PollViewOmit = $OmitInput<$Schema, "PollView">; -export type PollViewGetPayload> = $SimplifiedModelResult<$Schema, "PollView", Args>; +export type PollViewGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "PollView", Options, Args>; export type SpaceFindManyArgs = $FindManyArgs<$Schema, "Space">; export type SpaceFindUniqueArgs = $FindUniqueArgs<$Schema, "Space">; export type SpaceFindFirstArgs = $FindFirstArgs<$Schema, "Space">; @@ -267,7 +267,7 @@ export type SpaceWhereInput = $WhereInput<$Schema, "Space">; export type SpaceSelect = $SelectInput<$Schema, "Space">; export type SpaceInclude = $IncludeInput<$Schema, "Space">; export type SpaceOmit = $OmitInput<$Schema, "Space">; -export type SpaceGetPayload> = $SimplifiedModelResult<$Schema, "Space", Args>; +export type SpaceGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Space", Options, Args>; export type SpaceMemberFindManyArgs = $FindManyArgs<$Schema, "SpaceMember">; export type SpaceMemberFindUniqueArgs = $FindUniqueArgs<$Schema, "SpaceMember">; export type SpaceMemberFindFirstArgs = $FindFirstArgs<$Schema, "SpaceMember">; @@ -287,7 +287,7 @@ export type SpaceMemberWhereInput = $WhereInput<$Schema, "SpaceMember">; export type SpaceMemberSelect = $SelectInput<$Schema, "SpaceMember">; export type SpaceMemberInclude = $IncludeInput<$Schema, "SpaceMember">; export type SpaceMemberOmit = $OmitInput<$Schema, "SpaceMember">; -export type SpaceMemberGetPayload> = $SimplifiedModelResult<$Schema, "SpaceMember", Args>; +export type SpaceMemberGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "SpaceMember", Options, Args>; export type SpaceMemberInviteFindManyArgs = $FindManyArgs<$Schema, "SpaceMemberInvite">; export type SpaceMemberInviteFindUniqueArgs = $FindUniqueArgs<$Schema, "SpaceMemberInvite">; export type SpaceMemberInviteFindFirstArgs = $FindFirstArgs<$Schema, "SpaceMemberInvite">; @@ -307,7 +307,7 @@ export type SpaceMemberInviteWhereInput = $WhereInput<$Schema, "SpaceMemberInvit export type SpaceMemberInviteSelect = $SelectInput<$Schema, "SpaceMemberInvite">; export type SpaceMemberInviteInclude = $IncludeInput<$Schema, "SpaceMemberInvite">; export type SpaceMemberInviteOmit = $OmitInput<$Schema, "SpaceMemberInvite">; -export type SpaceMemberInviteGetPayload> = $SimplifiedModelResult<$Schema, "SpaceMemberInvite", Args>; +export type SpaceMemberInviteGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "SpaceMemberInvite", Options, Args>; export type SubscriptionFindManyArgs = $FindManyArgs<$Schema, "Subscription">; export type SubscriptionFindUniqueArgs = $FindUniqueArgs<$Schema, "Subscription">; export type SubscriptionFindFirstArgs = $FindFirstArgs<$Schema, "Subscription">; @@ -327,7 +327,7 @@ export type SubscriptionWhereInput = $WhereInput<$Schema, "Subscription">; export type SubscriptionSelect = $SelectInput<$Schema, "Subscription">; export type SubscriptionInclude = $IncludeInput<$Schema, "Subscription">; export type SubscriptionOmit = $OmitInput<$Schema, "Subscription">; -export type SubscriptionGetPayload> = $SimplifiedModelResult<$Schema, "Subscription", Args>; +export type SubscriptionGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Subscription", Options, Args>; export type PaymentMethodFindManyArgs = $FindManyArgs<$Schema, "PaymentMethod">; export type PaymentMethodFindUniqueArgs = $FindUniqueArgs<$Schema, "PaymentMethod">; export type PaymentMethodFindFirstArgs = $FindFirstArgs<$Schema, "PaymentMethod">; @@ -347,7 +347,7 @@ export type PaymentMethodWhereInput = $WhereInput<$Schema, "PaymentMethod">; export type PaymentMethodSelect = $SelectInput<$Schema, "PaymentMethod">; export type PaymentMethodInclude = $IncludeInput<$Schema, "PaymentMethod">; export type PaymentMethodOmit = $OmitInput<$Schema, "PaymentMethod">; -export type PaymentMethodGetPayload> = $SimplifiedModelResult<$Schema, "PaymentMethod", Args>; +export type PaymentMethodGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "PaymentMethod", Options, Args>; export type ScheduledEventFindManyArgs = $FindManyArgs<$Schema, "ScheduledEvent">; export type ScheduledEventFindUniqueArgs = $FindUniqueArgs<$Schema, "ScheduledEvent">; export type ScheduledEventFindFirstArgs = $FindFirstArgs<$Schema, "ScheduledEvent">; @@ -367,7 +367,7 @@ export type ScheduledEventWhereInput = $WhereInput<$Schema, "ScheduledEvent">; export type ScheduledEventSelect = $SelectInput<$Schema, "ScheduledEvent">; export type ScheduledEventInclude = $IncludeInput<$Schema, "ScheduledEvent">; export type ScheduledEventOmit = $OmitInput<$Schema, "ScheduledEvent">; -export type ScheduledEventGetPayload> = $SimplifiedModelResult<$Schema, "ScheduledEvent", Args>; +export type ScheduledEventGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "ScheduledEvent", Options, Args>; export type RescheduledEventDateFindManyArgs = $FindManyArgs<$Schema, "RescheduledEventDate">; export type RescheduledEventDateFindUniqueArgs = $FindUniqueArgs<$Schema, "RescheduledEventDate">; export type RescheduledEventDateFindFirstArgs = $FindFirstArgs<$Schema, "RescheduledEventDate">; @@ -387,7 +387,7 @@ export type RescheduledEventDateWhereInput = $WhereInput<$Schema, "RescheduledEv export type RescheduledEventDateSelect = $SelectInput<$Schema, "RescheduledEventDate">; export type RescheduledEventDateInclude = $IncludeInput<$Schema, "RescheduledEventDate">; export type RescheduledEventDateOmit = $OmitInput<$Schema, "RescheduledEventDate">; -export type RescheduledEventDateGetPayload> = $SimplifiedModelResult<$Schema, "RescheduledEventDate", Args>; +export type RescheduledEventDateGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "RescheduledEventDate", Options, Args>; export type ScheduledEventInviteFindManyArgs = $FindManyArgs<$Schema, "ScheduledEventInvite">; export type ScheduledEventInviteFindUniqueArgs = $FindUniqueArgs<$Schema, "ScheduledEventInvite">; export type ScheduledEventInviteFindFirstArgs = $FindFirstArgs<$Schema, "ScheduledEventInvite">; @@ -407,7 +407,7 @@ export type ScheduledEventInviteWhereInput = $WhereInput<$Schema, "ScheduledEven export type ScheduledEventInviteSelect = $SelectInput<$Schema, "ScheduledEventInvite">; export type ScheduledEventInviteInclude = $IncludeInput<$Schema, "ScheduledEventInvite">; export type ScheduledEventInviteOmit = $OmitInput<$Schema, "ScheduledEventInvite">; -export type ScheduledEventInviteGetPayload> = $SimplifiedModelResult<$Schema, "ScheduledEventInvite", Args>; +export type ScheduledEventInviteGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "ScheduledEventInvite", Options, Args>; export type CredentialFindManyArgs = $FindManyArgs<$Schema, "Credential">; export type CredentialFindUniqueArgs = $FindUniqueArgs<$Schema, "Credential">; export type CredentialFindFirstArgs = $FindFirstArgs<$Schema, "Credential">; @@ -427,7 +427,7 @@ export type CredentialWhereInput = $WhereInput<$Schema, "Credential">; export type CredentialSelect = $SelectInput<$Schema, "Credential">; export type CredentialInclude = $IncludeInput<$Schema, "Credential">; export type CredentialOmit = $OmitInput<$Schema, "Credential">; -export type CredentialGetPayload> = $SimplifiedModelResult<$Schema, "Credential", Args>; +export type CredentialGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Credential", Options, Args>; export type CalendarConnectionFindManyArgs = $FindManyArgs<$Schema, "CalendarConnection">; export type CalendarConnectionFindUniqueArgs = $FindUniqueArgs<$Schema, "CalendarConnection">; export type CalendarConnectionFindFirstArgs = $FindFirstArgs<$Schema, "CalendarConnection">; @@ -447,7 +447,7 @@ export type CalendarConnectionWhereInput = $WhereInput<$Schema, "CalendarConnect export type CalendarConnectionSelect = $SelectInput<$Schema, "CalendarConnection">; export type CalendarConnectionInclude = $IncludeInput<$Schema, "CalendarConnection">; export type CalendarConnectionOmit = $OmitInput<$Schema, "CalendarConnection">; -export type CalendarConnectionGetPayload> = $SimplifiedModelResult<$Schema, "CalendarConnection", Args>; +export type CalendarConnectionGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "CalendarConnection", Options, Args>; export type ProviderCalendarFindManyArgs = $FindManyArgs<$Schema, "ProviderCalendar">; export type ProviderCalendarFindUniqueArgs = $FindUniqueArgs<$Schema, "ProviderCalendar">; export type ProviderCalendarFindFirstArgs = $FindFirstArgs<$Schema, "ProviderCalendar">; @@ -467,7 +467,7 @@ export type ProviderCalendarWhereInput = $WhereInput<$Schema, "ProviderCalendar" export type ProviderCalendarSelect = $SelectInput<$Schema, "ProviderCalendar">; export type ProviderCalendarInclude = $IncludeInput<$Schema, "ProviderCalendar">; export type ProviderCalendarOmit = $OmitInput<$Schema, "ProviderCalendar">; -export type ProviderCalendarGetPayload> = $SimplifiedModelResult<$Schema, "ProviderCalendar", Args>; +export type ProviderCalendarGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "ProviderCalendar", Options, Args>; export type InstanceSettingsFindManyArgs = $FindManyArgs<$Schema, "InstanceSettings">; export type InstanceSettingsFindUniqueArgs = $FindUniqueArgs<$Schema, "InstanceSettings">; export type InstanceSettingsFindFirstArgs = $FindFirstArgs<$Schema, "InstanceSettings">; @@ -487,7 +487,7 @@ export type InstanceSettingsWhereInput = $WhereInput<$Schema, "InstanceSettings" export type InstanceSettingsSelect = $SelectInput<$Schema, "InstanceSettings">; export type InstanceSettingsInclude = $IncludeInput<$Schema, "InstanceSettings">; export type InstanceSettingsOmit = $OmitInput<$Schema, "InstanceSettings">; -export type InstanceSettingsGetPayload> = $SimplifiedModelResult<$Schema, "InstanceSettings", Args>; +export type InstanceSettingsGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "InstanceSettings", Options, Args>; export type LicenseFindManyArgs = $FindManyArgs<$Schema, "License">; export type LicenseFindUniqueArgs = $FindUniqueArgs<$Schema, "License">; export type LicenseFindFirstArgs = $FindFirstArgs<$Schema, "License">; @@ -507,7 +507,7 @@ export type LicenseWhereInput = $WhereInput<$Schema, "License">; export type LicenseSelect = $SelectInput<$Schema, "License">; export type LicenseInclude = $IncludeInput<$Schema, "License">; export type LicenseOmit = $OmitInput<$Schema, "License">; -export type LicenseGetPayload> = $SimplifiedModelResult<$Schema, "License", Args>; +export type LicenseGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "License", Options, Args>; export type LicenseValidationFindManyArgs = $FindManyArgs<$Schema, "LicenseValidation">; export type LicenseValidationFindUniqueArgs = $FindUniqueArgs<$Schema, "LicenseValidation">; export type LicenseValidationFindFirstArgs = $FindFirstArgs<$Schema, "LicenseValidation">; @@ -527,7 +527,7 @@ export type LicenseValidationWhereInput = $WhereInput<$Schema, "LicenseValidatio export type LicenseValidationSelect = $SelectInput<$Schema, "LicenseValidation">; export type LicenseValidationInclude = $IncludeInput<$Schema, "LicenseValidation">; export type LicenseValidationOmit = $OmitInput<$Schema, "LicenseValidation">; -export type LicenseValidationGetPayload> = $SimplifiedModelResult<$Schema, "LicenseValidation", Args>; +export type LicenseValidationGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "LicenseValidation", Options, Args>; export type InstanceLicenseFindManyArgs = $FindManyArgs<$Schema, "InstanceLicense">; export type InstanceLicenseFindUniqueArgs = $FindUniqueArgs<$Schema, "InstanceLicense">; export type InstanceLicenseFindFirstArgs = $FindFirstArgs<$Schema, "InstanceLicense">; @@ -547,4 +547,4 @@ export type InstanceLicenseWhereInput = $WhereInput<$Schema, "InstanceLicense">; export type InstanceLicenseSelect = $SelectInput<$Schema, "InstanceLicense">; export type InstanceLicenseInclude = $IncludeInput<$Schema, "InstanceLicense">; export type InstanceLicenseOmit = $OmitInput<$Schema, "InstanceLicense">; -export type InstanceLicenseGetPayload> = $SimplifiedModelResult<$Schema, "InstanceLicense", Args>; +export type InstanceLicenseGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "InstanceLicense", Options, Args>; diff --git a/tests/e2e/orm/client-api/omit.test.ts b/tests/e2e/orm/client-api/omit.test.ts new file mode 100644 index 00000000..0953de9d --- /dev/null +++ b/tests/e2e/orm/client-api/omit.test.ts @@ -0,0 +1,139 @@ +import { createTestClient } from '@zenstackhq/testtools'; +import { describe, expect, it } from 'vitest'; +import { schema } from '../schemas/omit/schema'; + +describe('Field omission tests', () => { + it('respects schema-level omit', async () => { + const db = await createTestClient(schema); + const user = await db.user.create({ + data: { id: 1, name: 'User1', password: 'abc', posts: { create: { id: 1, title: 'Post1' } } }, + }); + // @ts-expect-error + expect(user.password).toBeUndefined(); + + const user1 = await db.user.findFirstOrThrow(); + // @ts-expect-error + expect(user1.password).toBeUndefined(); + + const userWithPosts = await db.user.findFirstOrThrow({ include: { posts: true } }); + // @ts-expect-error + expect(userWithPosts.password).toBeUndefined(); + + const user2 = await db.user.update({ + where: { id: 1 }, + data: { name: 'User2' }, + }); + + // @ts-expect-error + expect(user2.password).toBeUndefined(); + + const data = await db.post.findFirstOrThrow({ include: { author: true } }); + // @ts-expect-error + expect(data.author.password).toBeUndefined(); + + const user3 = await db.user.delete({ where: { id: 1 } }); + // @ts-expect-error + expect(user3.password).toBeUndefined(); + }); + + it('respects client omit options', async () => { + const options = { omit: { User: { name: true } }, dialect: {} as any } as const; + const db = await createTestClient(schema, options); + + const user = await db.user.create({ + data: { + id: 1, + name: 'User1', + password: 'abc', + posts: { create: { id: 1, title: 'Post1' } }, + }, + }); + + // inherited omit from schema + // @ts-expect-error + expect(user.password).toBeUndefined; + + // options-level omit + // @ts-expect-error + expect(user.name).toBeUndefined(); + + const post = await db.post.findFirstOrThrow({ include: { author: true } }); + // @ts-expect-error + expect(post.author.password).toBeUndefined(); + // @ts-expect-error + expect(post.author.name).toBeUndefined(); + + // override schema-level omit + const options1 = { omit: { User: { password: false } }, dialect: {} as any } as const; + const db1 = await createTestClient(schema, options1); + const user1 = await db1.user.create({ + data: { + id: 1, + name: 'User1', + password: 'abc', + }, + }); + expect(user1.password).toBeTruthy(); + }); + + it('respects query-level omit', async () => { + const db = await createTestClient(schema); + const user = await db.user.create({ + data: { id: 1, name: 'User1', password: 'abc', posts: { create: { id: 1, title: 'Post1' } } }, + omit: { password: false }, + }); + expect(user.password).toBeTruthy(); + + const user1 = await db.user.findFirstOrThrow({ omit: { password: false } }); + expect(user1.password).toBeTruthy(); + + const user11 = await db.user.findFirstOrThrow({ omit: { name: true } }); + // @ts-expect-error + expect(user11.name).toBeUndefined(); + + const user2 = await db.user.findFirstOrThrow({ omit: { password: true } }); + // @ts-expect-error + expect(user2.password).toBeUndefined(); + + // override schema-level omit + const user3 = await db.user.update({ + where: { id: 1 }, + data: { name: 'User2' }, + omit: { password: false }, + }); + expect(user3.password).toBeTruthy(); + + const data = await db.post.findFirstOrThrow({ include: { author: { omit: { password: false } } } }); + expect(data.author.password).toBeTruthy(); + + const user4 = await db.user.delete({ where: { id: 1 }, omit: { password: false } }); + expect(user4.password).toBeTruthy(); + + // override options-level omit + const options = { omit: { User: { name: true } }, dialect: {} as any } as const; + const db1 = await createTestClient(schema, options); + const user5 = await db1.user.create({ + data: { id: 2, name: 'User2', password: 'abc' }, + }); + // @ts-expect-error + expect(user5.name).toBeUndefined(); + const user6 = await db1.user.findFirstOrThrow({ omit: { name: false } }); + expect(user6.name).toBeTruthy(); + }); + + it('works with delegate models', async () => { + const db = await createTestClient(schema); + const sub = await db.sub.create({ + data: { id: 1, title: 'Sub1', content: 'Foo' }, + }); + // @ts-expect-error + expect(sub.content).toBeUndefined(); + + const read = await db.sub.findFirstOrThrow(); + // @ts-expect-error + expect(read.content).toBeUndefined(); + + const read1 = await db.sub.findFirstOrThrow({ omit: { content: false } }); + expect(read1.content).toBe('Foo'); + }); +}); diff --git a/tests/e2e/orm/schemas/basic/input.ts b/tests/e2e/orm/schemas/basic/input.ts index 70de8c2e..96a679c1 100644 --- a/tests/e2e/orm/schemas/basic/input.ts +++ b/tests/e2e/orm/schemas/basic/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; @@ -47,7 +47,7 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">; export type PostSelect = $SelectInput<$Schema, "Post">; export type PostInclude = $IncludeInput<$Schema, "Post">; export type PostOmit = $OmitInput<$Schema, "Post">; -export type PostGetPayload> = $SimplifiedModelResult<$Schema, "Post", Args>; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; export type CommentFindManyArgs = $FindManyArgs<$Schema, "Comment">; export type CommentFindUniqueArgs = $FindUniqueArgs<$Schema, "Comment">; export type CommentFindFirstArgs = $FindFirstArgs<$Schema, "Comment">; @@ -67,7 +67,7 @@ export type CommentWhereInput = $WhereInput<$Schema, "Comment">; export type CommentSelect = $SelectInput<$Schema, "Comment">; export type CommentInclude = $IncludeInput<$Schema, "Comment">; export type CommentOmit = $OmitInput<$Schema, "Comment">; -export type CommentGetPayload> = $SimplifiedModelResult<$Schema, "Comment", Args>; +export type CommentGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Comment", Options, Args>; export type ProfileFindManyArgs = $FindManyArgs<$Schema, "Profile">; export type ProfileFindUniqueArgs = $FindUniqueArgs<$Schema, "Profile">; export type ProfileFindFirstArgs = $FindFirstArgs<$Schema, "Profile">; @@ -87,4 +87,4 @@ export type ProfileWhereInput = $WhereInput<$Schema, "Profile">; export type ProfileSelect = $SelectInput<$Schema, "Profile">; export type ProfileInclude = $IncludeInput<$Schema, "Profile">; export type ProfileOmit = $OmitInput<$Schema, "Profile">; -export type ProfileGetPayload> = $SimplifiedModelResult<$Schema, "Profile", Args>; +export type ProfileGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Profile", Options, Args>; diff --git a/tests/e2e/orm/schemas/default-auth/input.ts b/tests/e2e/orm/schemas/default-auth/input.ts index 5ebdd080..f7fa5424 100644 --- a/tests/e2e/orm/schemas/default-auth/input.ts +++ b/tests/e2e/orm/schemas/default-auth/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type ProfileFindManyArgs = $FindManyArgs<$Schema, "Profile">; export type ProfileFindUniqueArgs = $FindUniqueArgs<$Schema, "Profile">; export type ProfileFindFirstArgs = $FindFirstArgs<$Schema, "Profile">; @@ -47,7 +47,7 @@ export type ProfileWhereInput = $WhereInput<$Schema, "Profile">; export type ProfileSelect = $SelectInput<$Schema, "Profile">; export type ProfileInclude = $IncludeInput<$Schema, "Profile">; export type ProfileOmit = $OmitInput<$Schema, "Profile">; -export type ProfileGetPayload> = $SimplifiedModelResult<$Schema, "Profile", Args>; +export type ProfileGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Profile", Options, Args>; export type AddressFindManyArgs = $FindManyArgs<$Schema, "Address">; export type AddressFindUniqueArgs = $FindUniqueArgs<$Schema, "Address">; export type AddressFindFirstArgs = $FindFirstArgs<$Schema, "Address">; @@ -67,4 +67,4 @@ export type AddressWhereInput = $WhereInput<$Schema, "Address">; export type AddressSelect = $SelectInput<$Schema, "Address">; export type AddressInclude = $IncludeInput<$Schema, "Address">; export type AddressOmit = $OmitInput<$Schema, "Address">; -export type AddressGetPayload> = $SimplifiedModelResult<$Schema, "Address", Args>; +export type AddressGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Address", Options, Args>; diff --git a/tests/e2e/orm/schemas/delegate/input.ts b/tests/e2e/orm/schemas/delegate/input.ts index 1d43c413..f4d2a694 100644 --- a/tests/e2e/orm/schemas/delegate/input.ts +++ b/tests/e2e/orm/schemas/delegate/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type CommentFindManyArgs = $FindManyArgs<$Schema, "Comment">; export type CommentFindUniqueArgs = $FindUniqueArgs<$Schema, "Comment">; export type CommentFindFirstArgs = $FindFirstArgs<$Schema, "Comment">; @@ -47,7 +47,7 @@ export type CommentWhereInput = $WhereInput<$Schema, "Comment">; export type CommentSelect = $SelectInput<$Schema, "Comment">; export type CommentInclude = $IncludeInput<$Schema, "Comment">; export type CommentOmit = $OmitInput<$Schema, "Comment">; -export type CommentGetPayload> = $SimplifiedModelResult<$Schema, "Comment", Args>; +export type CommentGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Comment", Options, Args>; export type AssetFindManyArgs = $FindManyArgs<$Schema, "Asset">; export type AssetFindUniqueArgs = $FindUniqueArgs<$Schema, "Asset">; export type AssetFindFirstArgs = $FindFirstArgs<$Schema, "Asset">; @@ -67,7 +67,7 @@ export type AssetWhereInput = $WhereInput<$Schema, "Asset">; export type AssetSelect = $SelectInput<$Schema, "Asset">; export type AssetInclude = $IncludeInput<$Schema, "Asset">; export type AssetOmit = $OmitInput<$Schema, "Asset">; -export type AssetGetPayload> = $SimplifiedModelResult<$Schema, "Asset", Args>; +export type AssetGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Asset", Options, Args>; export type VideoFindManyArgs = $FindManyArgs<$Schema, "Video">; export type VideoFindUniqueArgs = $FindUniqueArgs<$Schema, "Video">; export type VideoFindFirstArgs = $FindFirstArgs<$Schema, "Video">; @@ -87,7 +87,7 @@ export type VideoWhereInput = $WhereInput<$Schema, "Video">; export type VideoSelect = $SelectInput<$Schema, "Video">; export type VideoInclude = $IncludeInput<$Schema, "Video">; export type VideoOmit = $OmitInput<$Schema, "Video">; -export type VideoGetPayload> = $SimplifiedModelResult<$Schema, "Video", Args>; +export type VideoGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Video", Options, Args>; export type RatedVideoFindManyArgs = $FindManyArgs<$Schema, "RatedVideo">; export type RatedVideoFindUniqueArgs = $FindUniqueArgs<$Schema, "RatedVideo">; export type RatedVideoFindFirstArgs = $FindFirstArgs<$Schema, "RatedVideo">; @@ -107,7 +107,7 @@ export type RatedVideoWhereInput = $WhereInput<$Schema, "RatedVideo">; export type RatedVideoSelect = $SelectInput<$Schema, "RatedVideo">; export type RatedVideoInclude = $IncludeInput<$Schema, "RatedVideo">; export type RatedVideoOmit = $OmitInput<$Schema, "RatedVideo">; -export type RatedVideoGetPayload> = $SimplifiedModelResult<$Schema, "RatedVideo", Args>; +export type RatedVideoGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "RatedVideo", Options, Args>; export type ImageFindManyArgs = $FindManyArgs<$Schema, "Image">; export type ImageFindUniqueArgs = $FindUniqueArgs<$Schema, "Image">; export type ImageFindFirstArgs = $FindFirstArgs<$Schema, "Image">; @@ -127,7 +127,7 @@ export type ImageWhereInput = $WhereInput<$Schema, "Image">; export type ImageSelect = $SelectInput<$Schema, "Image">; export type ImageInclude = $IncludeInput<$Schema, "Image">; export type ImageOmit = $OmitInput<$Schema, "Image">; -export type ImageGetPayload> = $SimplifiedModelResult<$Schema, "Image", Args>; +export type ImageGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Image", Options, Args>; export type GalleryFindManyArgs = $FindManyArgs<$Schema, "Gallery">; export type GalleryFindUniqueArgs = $FindUniqueArgs<$Schema, "Gallery">; export type GalleryFindFirstArgs = $FindFirstArgs<$Schema, "Gallery">; @@ -147,4 +147,4 @@ export type GalleryWhereInput = $WhereInput<$Schema, "Gallery">; export type GallerySelect = $SelectInput<$Schema, "Gallery">; export type GalleryInclude = $IncludeInput<$Schema, "Gallery">; export type GalleryOmit = $OmitInput<$Schema, "Gallery">; -export type GalleryGetPayload> = $SimplifiedModelResult<$Schema, "Gallery", Args>; +export type GalleryGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Gallery", Options, Args>; diff --git a/tests/e2e/orm/schemas/name-mapping/input.ts b/tests/e2e/orm/schemas/name-mapping/input.ts index 6c876632..fb776314 100644 --- a/tests/e2e/orm/schemas/name-mapping/input.ts +++ b/tests/e2e/orm/schemas/name-mapping/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; @@ -47,4 +47,4 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">; export type PostSelect = $SelectInput<$Schema, "Post">; export type PostInclude = $IncludeInput<$Schema, "Post">; export type PostOmit = $OmitInput<$Schema, "Post">; -export type PostGetPayload> = $SimplifiedModelResult<$Schema, "Post", Args>; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; diff --git a/tests/e2e/orm/schemas/omit/input.ts b/tests/e2e/orm/schemas/omit/input.ts new file mode 100644 index 00000000..35f840d1 --- /dev/null +++ b/tests/e2e/orm/schemas/omit/input.ts @@ -0,0 +1,90 @@ +////////////////////////////////////////////////////////////////////////////////////////////// +// DO NOT MODIFY THIS FILE // +// This file is automatically generated by ZenStack CLI and should not be manually updated. // +////////////////////////////////////////////////////////////////////////////////////////////// + +/* eslint-disable */ + +import { type SchemaType as $Schema } from "./schema"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; +import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; +export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; +export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; +export type UserFindFirstArgs = $FindFirstArgs<$Schema, "User">; +export type UserCreateArgs = $CreateArgs<$Schema, "User">; +export type UserCreateManyArgs = $CreateManyArgs<$Schema, "User">; +export type UserCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "User">; +export type UserUpdateArgs = $UpdateArgs<$Schema, "User">; +export type UserUpdateManyArgs = $UpdateManyArgs<$Schema, "User">; +export type UserUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "User">; +export type UserUpsertArgs = $UpsertArgs<$Schema, "User">; +export type UserDeleteArgs = $DeleteArgs<$Schema, "User">; +export type UserDeleteManyArgs = $DeleteManyArgs<$Schema, "User">; +export type UserCountArgs = $CountArgs<$Schema, "User">; +export type UserAggregateArgs = $AggregateArgs<$Schema, "User">; +export type UserGroupByArgs = $GroupByArgs<$Schema, "User">; +export type UserWhereInput = $WhereInput<$Schema, "User">; +export type UserSelect = $SelectInput<$Schema, "User">; +export type UserInclude = $IncludeInput<$Schema, "User">; +export type UserOmit = $OmitInput<$Schema, "User">; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; +export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; +export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; +export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; +export type PostCreateArgs = $CreateArgs<$Schema, "Post">; +export type PostCreateManyArgs = $CreateManyArgs<$Schema, "Post">; +export type PostCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "Post">; +export type PostUpdateArgs = $UpdateArgs<$Schema, "Post">; +export type PostUpdateManyArgs = $UpdateManyArgs<$Schema, "Post">; +export type PostUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "Post">; +export type PostUpsertArgs = $UpsertArgs<$Schema, "Post">; +export type PostDeleteArgs = $DeleteArgs<$Schema, "Post">; +export type PostDeleteManyArgs = $DeleteManyArgs<$Schema, "Post">; +export type PostCountArgs = $CountArgs<$Schema, "Post">; +export type PostAggregateArgs = $AggregateArgs<$Schema, "Post">; +export type PostGroupByArgs = $GroupByArgs<$Schema, "Post">; +export type PostWhereInput = $WhereInput<$Schema, "Post">; +export type PostSelect = $SelectInput<$Schema, "Post">; +export type PostInclude = $IncludeInput<$Schema, "Post">; +export type PostOmit = $OmitInput<$Schema, "Post">; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; +export type BaseFindManyArgs = $FindManyArgs<$Schema, "Base">; +export type BaseFindUniqueArgs = $FindUniqueArgs<$Schema, "Base">; +export type BaseFindFirstArgs = $FindFirstArgs<$Schema, "Base">; +export type BaseCreateArgs = $CreateArgs<$Schema, "Base">; +export type BaseCreateManyArgs = $CreateManyArgs<$Schema, "Base">; +export type BaseCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "Base">; +export type BaseUpdateArgs = $UpdateArgs<$Schema, "Base">; +export type BaseUpdateManyArgs = $UpdateManyArgs<$Schema, "Base">; +export type BaseUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "Base">; +export type BaseUpsertArgs = $UpsertArgs<$Schema, "Base">; +export type BaseDeleteArgs = $DeleteArgs<$Schema, "Base">; +export type BaseDeleteManyArgs = $DeleteManyArgs<$Schema, "Base">; +export type BaseCountArgs = $CountArgs<$Schema, "Base">; +export type BaseAggregateArgs = $AggregateArgs<$Schema, "Base">; +export type BaseGroupByArgs = $GroupByArgs<$Schema, "Base">; +export type BaseWhereInput = $WhereInput<$Schema, "Base">; +export type BaseSelect = $SelectInput<$Schema, "Base">; +export type BaseInclude = $IncludeInput<$Schema, "Base">; +export type BaseOmit = $OmitInput<$Schema, "Base">; +export type BaseGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Base", Options, Args>; +export type SubFindManyArgs = $FindManyArgs<$Schema, "Sub">; +export type SubFindUniqueArgs = $FindUniqueArgs<$Schema, "Sub">; +export type SubFindFirstArgs = $FindFirstArgs<$Schema, "Sub">; +export type SubCreateArgs = $CreateArgs<$Schema, "Sub">; +export type SubCreateManyArgs = $CreateManyArgs<$Schema, "Sub">; +export type SubCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "Sub">; +export type SubUpdateArgs = $UpdateArgs<$Schema, "Sub">; +export type SubUpdateManyArgs = $UpdateManyArgs<$Schema, "Sub">; +export type SubUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "Sub">; +export type SubUpsertArgs = $UpsertArgs<$Schema, "Sub">; +export type SubDeleteArgs = $DeleteArgs<$Schema, "Sub">; +export type SubDeleteManyArgs = $DeleteManyArgs<$Schema, "Sub">; +export type SubCountArgs = $CountArgs<$Schema, "Sub">; +export type SubAggregateArgs = $AggregateArgs<$Schema, "Sub">; +export type SubGroupByArgs = $GroupByArgs<$Schema, "Sub">; +export type SubWhereInput = $WhereInput<$Schema, "Sub">; +export type SubSelect = $SelectInput<$Schema, "Sub">; +export type SubInclude = $IncludeInput<$Schema, "Sub">; +export type SubOmit = $OmitInput<$Schema, "Sub">; +export type SubGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Sub", Options, Args>; diff --git a/tests/e2e/orm/schemas/omit/models.ts b/tests/e2e/orm/schemas/omit/models.ts new file mode 100644 index 00000000..6636b4d5 --- /dev/null +++ b/tests/e2e/orm/schemas/omit/models.ts @@ -0,0 +1,13 @@ +////////////////////////////////////////////////////////////////////////////////////////////// +// DO NOT MODIFY THIS FILE // +// This file is automatically generated by ZenStack CLI and should not be manually updated. // +////////////////////////////////////////////////////////////////////////////////////////////// + +/* eslint-disable */ + +import { type SchemaType as $Schema } from "./schema"; +import { type ModelResult as $ModelResult } from "@zenstackhq/orm"; +export type User = $ModelResult<$Schema, "User">; +export type Post = $ModelResult<$Schema, "Post">; +export type Base = $ModelResult<$Schema, "Base">; +export type Sub = $ModelResult<$Schema, "Sub">; diff --git a/tests/e2e/orm/schemas/omit/schema.ts b/tests/e2e/orm/schemas/omit/schema.ts new file mode 100644 index 00000000..4543ccb7 --- /dev/null +++ b/tests/e2e/orm/schemas/omit/schema.ts @@ -0,0 +1,142 @@ +////////////////////////////////////////////////////////////////////////////////////////////// +// DO NOT MODIFY THIS FILE // +// This file is automatically generated by ZenStack CLI and should not be manually updated. // +////////////////////////////////////////////////////////////////////////////////////////////// + +/* eslint-disable */ + +import { type SchemaDef, ExpressionUtils } from "@zenstackhq/orm/schema"; +const _schema = { + provider: { + type: "sqlite" + }, + models: { + User: { + name: "User", + fields: { + id: { + name: "id", + type: "Int", + id: true, + attributes: [{ name: "@id" }] + }, + name: { + name: "name", + type: "String" + }, + password: { + name: "password", + type: "String", + omit: true, + attributes: [{ name: "@omit" }] + }, + posts: { + name: "posts", + type: "Post", + array: true, + relation: { opposite: "author" } + } + }, + idFields: ["id"], + uniqueFields: { + id: { type: "Int" } + } + }, + Post: { + name: "Post", + fields: { + id: { + name: "id", + type: "Int", + id: true, + attributes: [{ name: "@id" }] + }, + title: { + name: "title", + type: "String" + }, + author: { + name: "author", + type: "User", + attributes: [{ name: "@relation", args: [{ name: "fields", value: ExpressionUtils.array([ExpressionUtils.field("authorId")]) }, { name: "references", value: ExpressionUtils.array([ExpressionUtils.field("id")]) }, { name: "onDelete", value: ExpressionUtils.literal("Cascade") }] }], + relation: { opposite: "posts", fields: ["authorId"], references: ["id"], onDelete: "Cascade" } + }, + authorId: { + name: "authorId", + type: "Int", + foreignKeyFor: [ + "author" + ] + } + }, + idFields: ["id"], + uniqueFields: { + id: { type: "Int" } + } + }, + Base: { + name: "Base", + fields: { + id: { + name: "id", + type: "Int", + id: true, + attributes: [{ name: "@id" }] + }, + type: { + name: "type", + type: "String", + isDiscriminator: true + } + }, + attributes: [ + { name: "@@delegate", args: [{ name: "discriminator", value: ExpressionUtils.field("type") }] } + ], + idFields: ["id"], + uniqueFields: { + id: { type: "Int" } + }, + isDelegate: true, + subModels: ["Sub"] + }, + Sub: { + name: "Sub", + baseModel: "Base", + fields: { + id: { + name: "id", + type: "Int", + id: true, + attributes: [{ name: "@id" }] + }, + type: { + name: "type", + type: "String", + originModel: "Base", + isDiscriminator: true + }, + title: { + name: "title", + type: "String" + }, + content: { + name: "content", + type: "String", + omit: true, + attributes: [{ name: "@omit" }] + } + }, + idFields: ["id"], + uniqueFields: { + id: { type: "Int" } + } + } + }, + authType: "User", + plugins: {} +} as const satisfies SchemaDef; +type Schema = typeof _schema & { + __brand?: "schema"; +}; +export const schema: Schema = _schema; +export type SchemaType = Schema; diff --git a/tests/e2e/orm/schemas/omit/schema.zmodel b/tests/e2e/orm/schemas/omit/schema.zmodel new file mode 100644 index 00000000..0fdba033 --- /dev/null +++ b/tests/e2e/orm/schemas/omit/schema.zmodel @@ -0,0 +1,29 @@ +datasource db { + provider = "sqlite" + url = "file:./dev.db" +} + +model User { + id Int @id + name String + password String @omit + posts Post[] +} + +model Post { + id Int @id + title String + author User @relation(fields: [authorId], references: [id], onDelete: Cascade) + authorId Int +} + +model Base { + id Int @id + type String + @@delegate(type) +} + +model Sub extends Base { + title String + content String @omit +} diff --git a/tests/e2e/orm/schemas/petstore/input.ts b/tests/e2e/orm/schemas/petstore/input.ts index 690d1d90..5ea5d622 100644 --- a/tests/e2e/orm/schemas/petstore/input.ts +++ b/tests/e2e/orm/schemas/petstore/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type PetFindManyArgs = $FindManyArgs<$Schema, "Pet">; export type PetFindUniqueArgs = $FindUniqueArgs<$Schema, "Pet">; export type PetFindFirstArgs = $FindFirstArgs<$Schema, "Pet">; @@ -47,7 +47,7 @@ export type PetWhereInput = $WhereInput<$Schema, "Pet">; export type PetSelect = $SelectInput<$Schema, "Pet">; export type PetInclude = $IncludeInput<$Schema, "Pet">; export type PetOmit = $OmitInput<$Schema, "Pet">; -export type PetGetPayload> = $SimplifiedModelResult<$Schema, "Pet", Args>; +export type PetGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Pet", Options, Args>; export type OrderFindManyArgs = $FindManyArgs<$Schema, "Order">; export type OrderFindUniqueArgs = $FindUniqueArgs<$Schema, "Order">; export type OrderFindFirstArgs = $FindFirstArgs<$Schema, "Order">; @@ -67,4 +67,4 @@ export type OrderWhereInput = $WhereInput<$Schema, "Order">; export type OrderSelect = $SelectInput<$Schema, "Order">; export type OrderInclude = $IncludeInput<$Schema, "Order">; export type OrderOmit = $OmitInput<$Schema, "Order">; -export type OrderGetPayload> = $SimplifiedModelResult<$Schema, "Order", Args>; +export type OrderGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Order", Options, Args>; diff --git a/tests/e2e/orm/schemas/todo/input.ts b/tests/e2e/orm/schemas/todo/input.ts index 22fd5a19..c198bf58 100644 --- a/tests/e2e/orm/schemas/todo/input.ts +++ b/tests/e2e/orm/schemas/todo/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type SpaceFindManyArgs = $FindManyArgs<$Schema, "Space">; export type SpaceFindUniqueArgs = $FindUniqueArgs<$Schema, "Space">; @@ -27,7 +27,7 @@ export type SpaceWhereInput = $WhereInput<$Schema, "Space">; export type SpaceSelect = $SelectInput<$Schema, "Space">; export type SpaceInclude = $IncludeInput<$Schema, "Space">; export type SpaceOmit = $OmitInput<$Schema, "Space">; -export type SpaceGetPayload> = $SimplifiedModelResult<$Schema, "Space", Args>; +export type SpaceGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Space", Options, Args>; export type SpaceUserFindManyArgs = $FindManyArgs<$Schema, "SpaceUser">; export type SpaceUserFindUniqueArgs = $FindUniqueArgs<$Schema, "SpaceUser">; export type SpaceUserFindFirstArgs = $FindFirstArgs<$Schema, "SpaceUser">; @@ -47,7 +47,7 @@ export type SpaceUserWhereInput = $WhereInput<$Schema, "SpaceUser">; export type SpaceUserSelect = $SelectInput<$Schema, "SpaceUser">; export type SpaceUserInclude = $IncludeInput<$Schema, "SpaceUser">; export type SpaceUserOmit = $OmitInput<$Schema, "SpaceUser">; -export type SpaceUserGetPayload> = $SimplifiedModelResult<$Schema, "SpaceUser", Args>; +export type SpaceUserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "SpaceUser", Options, Args>; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; export type UserFindFirstArgs = $FindFirstArgs<$Schema, "User">; @@ -67,7 +67,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type ListFindManyArgs = $FindManyArgs<$Schema, "List">; export type ListFindUniqueArgs = $FindUniqueArgs<$Schema, "List">; export type ListFindFirstArgs = $FindFirstArgs<$Schema, "List">; @@ -87,7 +87,7 @@ export type ListWhereInput = $WhereInput<$Schema, "List">; export type ListSelect = $SelectInput<$Schema, "List">; export type ListInclude = $IncludeInput<$Schema, "List">; export type ListOmit = $OmitInput<$Schema, "List">; -export type ListGetPayload> = $SimplifiedModelResult<$Schema, "List", Args>; +export type ListGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "List", Options, Args>; export type TodoFindManyArgs = $FindManyArgs<$Schema, "Todo">; export type TodoFindUniqueArgs = $FindUniqueArgs<$Schema, "Todo">; export type TodoFindFirstArgs = $FindFirstArgs<$Schema, "Todo">; @@ -107,4 +107,4 @@ export type TodoWhereInput = $WhereInput<$Schema, "Todo">; export type TodoSelect = $SelectInput<$Schema, "Todo">; export type TodoInclude = $IncludeInput<$Schema, "Todo">; export type TodoOmit = $OmitInput<$Schema, "Todo">; -export type TodoGetPayload> = $SimplifiedModelResult<$Schema, "Todo", Args>; +export type TodoGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Todo", Options, Args>; diff --git a/tests/e2e/orm/schemas/typing/input.ts b/tests/e2e/orm/schemas/typing/input.ts index 13d7d458..58e1ad6d 100644 --- a/tests/e2e/orm/schemas/typing/input.ts +++ b/tests/e2e/orm/schemas/typing/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; @@ -47,7 +47,7 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">; export type PostSelect = $SelectInput<$Schema, "Post">; export type PostInclude = $IncludeInput<$Schema, "Post">; export type PostOmit = $OmitInput<$Schema, "Post">; -export type PostGetPayload> = $SimplifiedModelResult<$Schema, "Post", Args>; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; export type ProfileFindManyArgs = $FindManyArgs<$Schema, "Profile">; export type ProfileFindUniqueArgs = $FindUniqueArgs<$Schema, "Profile">; export type ProfileFindFirstArgs = $FindFirstArgs<$Schema, "Profile">; @@ -67,7 +67,7 @@ export type ProfileWhereInput = $WhereInput<$Schema, "Profile">; export type ProfileSelect = $SelectInput<$Schema, "Profile">; export type ProfileInclude = $IncludeInput<$Schema, "Profile">; export type ProfileOmit = $OmitInput<$Schema, "Profile">; -export type ProfileGetPayload> = $SimplifiedModelResult<$Schema, "Profile", Args>; +export type ProfileGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Profile", Options, Args>; export type TagFindManyArgs = $FindManyArgs<$Schema, "Tag">; export type TagFindUniqueArgs = $FindUniqueArgs<$Schema, "Tag">; export type TagFindFirstArgs = $FindFirstArgs<$Schema, "Tag">; @@ -87,7 +87,7 @@ export type TagWhereInput = $WhereInput<$Schema, "Tag">; export type TagSelect = $SelectInput<$Schema, "Tag">; export type TagInclude = $IncludeInput<$Schema, "Tag">; export type TagOmit = $OmitInput<$Schema, "Tag">; -export type TagGetPayload> = $SimplifiedModelResult<$Schema, "Tag", Args>; +export type TagGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Tag", Options, Args>; export type RegionFindManyArgs = $FindManyArgs<$Schema, "Region">; export type RegionFindUniqueArgs = $FindUniqueArgs<$Schema, "Region">; export type RegionFindFirstArgs = $FindFirstArgs<$Schema, "Region">; @@ -107,7 +107,7 @@ export type RegionWhereInput = $WhereInput<$Schema, "Region">; export type RegionSelect = $SelectInput<$Schema, "Region">; export type RegionInclude = $IncludeInput<$Schema, "Region">; export type RegionOmit = $OmitInput<$Schema, "Region">; -export type RegionGetPayload> = $SimplifiedModelResult<$Schema, "Region", Args>; +export type RegionGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Region", Options, Args>; export type MetaFindManyArgs = $FindManyArgs<$Schema, "Meta">; export type MetaFindUniqueArgs = $FindUniqueArgs<$Schema, "Meta">; export type MetaFindFirstArgs = $FindFirstArgs<$Schema, "Meta">; @@ -127,4 +127,4 @@ export type MetaWhereInput = $WhereInput<$Schema, "Meta">; export type MetaSelect = $SelectInput<$Schema, "Meta">; export type MetaInclude = $IncludeInput<$Schema, "Meta">; export type MetaOmit = $OmitInput<$Schema, "Meta">; -export type MetaGetPayload> = $SimplifiedModelResult<$Schema, "Meta", Args>; +export type MetaGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Meta", Options, Args>; From c19e7e4279308ed59fe9d75d95120be250987d06 Mon Sep 17 00:00:00 2001 From: Yiming Cao Date: Thu, 27 Nov 2025 07:59:11 +0800 Subject: [PATCH 2/8] Update tests/e2e/orm/client-api/omit.test.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/e2e/orm/client-api/omit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/orm/client-api/omit.test.ts b/tests/e2e/orm/client-api/omit.test.ts index 0953de9d..42cfa662 100644 --- a/tests/e2e/orm/client-api/omit.test.ts +++ b/tests/e2e/orm/client-api/omit.test.ts @@ -51,7 +51,7 @@ describe('Field omission tests', () => { // inherited omit from schema // @ts-expect-error - expect(user.password).toBeUndefined; + expect(user.password).toBeUndefined(); // options-level omit // @ts-expect-error From b42f42dc2da9ba8d0aed803cb339fb8b183c341b Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 08:05:25 +0800 Subject: [PATCH 3/8] fix build --- .../executor/zenstack-query-executor.ts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/orm/src/client/executor/zenstack-query-executor.ts b/packages/orm/src/client/executor/zenstack-query-executor.ts index 06f8d133..201c3229 100644 --- a/packages/orm/src/client/executor/zenstack-query-executor.ts +++ b/packages/orm/src/client/executor/zenstack-query-executor.ts @@ -24,7 +24,7 @@ import { type RootOperationNode, } from 'kysely'; import { match } from 'ts-pattern'; -import type { GetModels, ModelDef, SchemaDef, TypeDefDef } from '../../schema'; +import type { ModelDef, SchemaDef, TypeDefDef } from '../../schema'; import { type ClientImpl } from '../client-impl'; import { TransactionIsolationLevel, type ClientContract } from '../contract'; import { createDBQueryError, createInternalError, ORMError } from '../errors'; @@ -35,17 +35,17 @@ import type { ZenStackDriver } from './zenstack-driver'; type MutationQueryNode = InsertQueryNode | UpdateQueryNode | DeleteQueryNode; -type MutationInfo = { - model: GetModels; +type MutationInfo = { + model: string; action: 'create' | 'update' | 'delete'; where: WhereNode | undefined; }; -export class ZenStackQueryExecutor extends DefaultQueryExecutor { +export class ZenStackQueryExecutor extends DefaultQueryExecutor { private readonly nameMapper: QueryNameMapper | undefined; constructor( - private client: ClientImpl, + private client: ClientImpl, private readonly driver: ZenStackDriver, private readonly compiler: QueryCompiler, adapter: DialectAdapter, @@ -63,7 +63,7 @@ export class ZenStackQueryExecutor extends DefaultQuer } } - private schemaHasMappedNames(schema: Schema) { + private schemaHasMappedNames(schema: SchemaDef) { const hasMapAttr = (decl: ModelDef | TypeDefDef) => { if (decl.attributes?.some((attr) => attr.name === '@@map')) { return true; @@ -134,7 +134,7 @@ export class ZenStackQueryExecutor extends DefaultQuer ) { let proceed = (q: RootOperationNode) => this.proceedQuery(connection, q, parameters, queryId); - const hooks: OnKyselyQueryCallback[] = []; + const hooks: OnKyselyQueryCallback[] = []; // tsc perf for (const plugin of this.client.$options.plugins ?? []) { if (plugin.onKyselyQuery) { @@ -147,7 +147,7 @@ export class ZenStackQueryExecutor extends DefaultQuer proceed = async (query: RootOperationNode) => { const _p = (q: RootOperationNode) => _proceed(q); const hookResult = await hook!({ - client: this.client as ClientContract, + client: this.client as unknown as ClientContract, schema: this.client.$schema, query, proceed: _p, @@ -161,7 +161,7 @@ export class ZenStackQueryExecutor extends DefaultQuer return result; } - private getMutationInfo(queryNode: MutationQueryNode): MutationInfo { + private getMutationInfo(queryNode: MutationQueryNode): MutationInfo { const model = this.getMutationModel(queryNode); const { action, where } = match(queryNode) .when(InsertQueryNode.is, () => ({ @@ -275,7 +275,7 @@ export class ZenStackQueryExecutor extends DefaultQuer if (inTx) { innerClient.forceTransaction(); } - return innerClient as ClientContract; + return innerClient as unknown as ClientContract; } private get hasEntityMutationPlugins() { @@ -353,7 +353,7 @@ export class ZenStackQueryExecutor extends DefaultQuer return newExecutor; } - private getMutationModel(queryNode: OperationNode): GetModels { + private getMutationModel(queryNode: OperationNode): string { return match(queryNode) .when(InsertQueryNode.is, (node) => { invariant(node.into, 'InsertQueryNode must have an into clause'); @@ -373,14 +373,14 @@ export class ZenStackQueryExecutor extends DefaultQuer }) .otherwise((node) => { throw createInternalError(`Invalid query node: ${node}`); - }) as GetModels; + }) as string; } private async callBeforeMutationHooks( queryNode: OperationNode, - mutationInfo: MutationInfo, + mutationInfo: MutationInfo, loadBeforeMutationEntities: () => Promise[] | undefined>, - client: ClientContract, + client: ClientContract, queryId: QueryId, ) { if (this.options.plugins) { @@ -405,12 +405,12 @@ export class ZenStackQueryExecutor extends DefaultQuer private async callAfterMutationHooks( queryResult: QueryResult, queryNode: OperationNode, - mutationInfo: MutationInfo, - client: ClientContract, + mutationInfo: MutationInfo, + client: ClientContract, filterFor: 'inTx' | 'outTx' | 'all', queryId: QueryId, ) { - const hooks: AfterEntityMutationCallback[] = []; + const hooks: AfterEntityMutationCallback[] = []; // tsc perf for (const plugin of this.options.plugins ?? []) { @@ -457,7 +457,7 @@ export class ZenStackQueryExecutor extends DefaultQuer } private async loadEntities( - model: GetModels, + model: string, where: WhereNode | undefined, connection: DatabaseConnection, ): Promise[]> { From 9f610c682ede4734c7b12e625060ec96c7a8e04a Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 08:15:22 +0800 Subject: [PATCH 4/8] fix build --- packages/clients/tanstack-query/src/react.ts | 58 +++++++++++-------- packages/clients/tanstack-query/src/svelte.ts | 40 +++++++------ packages/clients/tanstack-query/src/vue.ts | 38 ++++++------ .../test/schemas/basic/input.ts | 12 ++-- 4 files changed, 83 insertions(+), 65 deletions(-) diff --git a/packages/clients/tanstack-query/src/react.ts b/packages/clients/tanstack-query/src/react.ts index 92af99b5..57b9cea2 100644 --- a/packages/clients/tanstack-query/src/react.ts +++ b/packages/clients/tanstack-query/src/react.ts @@ -24,6 +24,7 @@ import type { AggregateArgs, AggregateResult, BatchResult, + ClientOptions, CountArgs, CountResult, CreateArgs, @@ -128,11 +129,14 @@ export type ModelMutationModelResult< Model extends GetModels, TArgs, Array extends boolean = false, -> = Omit, TArgs>, 'mutateAsync'> & { +> = Omit< + ModelMutationResult, TArgs, false, Array>, TArgs>, + 'mutateAsync' +> & { mutateAsync( args: T, - options?: ModelMutationOptions, T>, - ): Promise>; + options?: ModelMutationOptions, T, false, Array>, T>, + ): Promise, T, false, Array>>; }; export type ClientHooks = { @@ -147,46 +151,50 @@ export type ModelQueryHooks>( args: SelectSubset>, - options?: ModelQueryOptions | null>, - ): ModelQueryResult | null>; + options?: ModelQueryOptions, T> | null>, + ): ModelQueryResult, T> | null>; useSuspenseFindUnique>( args: SelectSubset>, - options?: ModelSuspenseQueryOptions | null>, - ): ModelSuspenseQueryResult | null>; + options?: ModelSuspenseQueryOptions, T> | null>, + ): ModelSuspenseQueryResult, T> | null>; useFindFirst>( args?: SelectSubset>, - options?: ModelQueryOptions | null>, - ): ModelQueryResult | null>; + options?: ModelQueryOptions, T> | null>, + ): ModelQueryResult, T> | null>; useSuspenseFindFirst>( args?: SelectSubset>, - options?: ModelSuspenseQueryOptions | null>, - ): ModelSuspenseQueryResult | null>; + options?: ModelSuspenseQueryOptions, T> | null>, + ): ModelSuspenseQueryResult, T> | null>; useFindMany>( args?: SelectSubset>, - options?: ModelQueryOptions[]>, - ): ModelQueryResult[]>; + options?: ModelQueryOptions, T>[]>, + ): ModelQueryResult, T>[]>; useSuspenseFindMany>( args?: SelectSubset>, - options?: ModelSuspenseQueryOptions[]>, - ): ModelSuspenseQueryResult[]>; + options?: ModelSuspenseQueryOptions, T>[]>, + ): ModelSuspenseQueryResult, T>[]>; useInfiniteFindMany>( args?: SelectSubset>, - options?: ModelInfiniteQueryOptions[]>, - ): ModelInfiniteQueryResult[]>>; + options?: ModelInfiniteQueryOptions, T>[]>, + ): ModelInfiniteQueryResult, T>[]>>; useSuspenseInfiniteFindMany>( args?: SelectSubset>, - options?: ModelSuspenseInfiniteQueryOptions[]>, - ): ModelSuspenseInfiniteQueryResult[]>>; + options?: ModelSuspenseInfiniteQueryOptions< + SimplifiedModelResult, T>[] + >, + ): ModelSuspenseInfiniteQueryResult< + InfiniteData, T>[]> + >; useCreate>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useCreateMany>( @@ -194,11 +202,11 @@ export type ModelQueryHooks; useCreateManyAndReturn>( - options?: ModelMutationOptions[], T>, + options?: ModelMutationOptions, T>[], T>, ): ModelMutationModelResult; useUpdate>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useUpdateMany>( @@ -206,15 +214,15 @@ export type ModelQueryHooks; useUpdateManyAndReturn>( - options?: ModelMutationOptions[], T>, + options?: ModelMutationOptions, T>[], T>, ): ModelMutationModelResult; useUpsert>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useDelete>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useDeleteMany>( diff --git a/packages/clients/tanstack-query/src/svelte.ts b/packages/clients/tanstack-query/src/svelte.ts index 8b40750c..447b11dc 100644 --- a/packages/clients/tanstack-query/src/svelte.ts +++ b/packages/clients/tanstack-query/src/svelte.ts @@ -20,6 +20,7 @@ import type { AggregateArgs, AggregateResult, BatchResult, + ClientOptions, CountArgs, CountResult, CreateArgs, @@ -118,13 +119,18 @@ export type ModelMutationModelResult< Array extends boolean = false, > = Readable< Omit< - UnwrapStore, TArgs>>, + UnwrapStore< + ModelMutationResult, TArgs, false, Array>, TArgs> + >, 'mutateAsync' > & { mutateAsync( args: T, - options?: ModelMutationOptions, T>, - ): Promise>; + options?: ModelMutationOptions< + SimplifiedModelResult, T, false, Array>, + T + >, + ): Promise, T, false, Array>>; } >; @@ -140,26 +146,26 @@ export type ModelQueryHooks>( args: SelectSubset>, - options?: ModelQueryOptions | null>, - ): ModelQueryResult | null>; + options?: ModelQueryOptions, T> | null>, + ): ModelQueryResult, T> | null>; useFindFirst>( args?: SelectSubset>, - options?: ModelQueryOptions | null>, - ): ModelQueryResult | null>; + options?: ModelQueryOptions, T> | null>, + ): ModelQueryResult, T> | null>; useFindMany>( args?: SelectSubset>, - options?: ModelQueryOptions[]>, - ): ModelQueryResult[]>; + options?: ModelQueryOptions, T>[]>, + ): ModelQueryResult, T>[]>; useInfiniteFindMany>( args?: SelectSubset>, - options?: ModelInfiniteQueryOptions[]>, - ): ModelInfiniteQueryResult[]>>; + options?: ModelInfiniteQueryOptions, T>[]>, + ): ModelInfiniteQueryResult, T>[]>>; useCreate>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useCreateMany>( @@ -167,11 +173,11 @@ export type ModelQueryHooks; useCreateManyAndReturn>( - options?: ModelMutationOptions[], T>, + options?: ModelMutationOptions, T>[], T>, ): ModelMutationModelResult; useUpdate>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useUpdateMany>( @@ -179,15 +185,15 @@ export type ModelQueryHooks; useUpdateManyAndReturn>( - options?: ModelMutationOptions[], T>, + options?: ModelMutationOptions, T>[], T>, ): ModelMutationModelResult; useUpsert>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useDelete>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useDeleteMany>( diff --git a/packages/clients/tanstack-query/src/vue.ts b/packages/clients/tanstack-query/src/vue.ts index e5051426..6d0cec9b 100644 --- a/packages/clients/tanstack-query/src/vue.ts +++ b/packages/clients/tanstack-query/src/vue.ts @@ -18,6 +18,7 @@ import type { AggregateArgs, AggregateResult, BatchResult, + ClientOptions, CountArgs, CountResult, CreateArgs, @@ -105,11 +106,14 @@ export type ModelMutationModelResult< Model extends GetModels, TArgs, Array extends boolean = false, -> = Omit, TArgs>, 'mutateAsync'> & { +> = Omit< + ModelMutationResult, TArgs, false, Array>, TArgs>, + 'mutateAsync' +> & { mutateAsync( args: T, - options?: ModelMutationOptions, T>, - ): Promise>; + options?: ModelMutationOptions, T, false, Array>, T>, + ): Promise, T, false, Array>>; }; export type ClientHooks = { @@ -124,26 +128,26 @@ export type ModelQueryHooks>( args: SelectSubset>, - options?: ModelQueryOptions | null>, - ): ModelQueryResult | null>; + options?: ModelQueryOptions, T> | null>, + ): ModelQueryResult, T> | null>; useFindFirst>( args?: SelectSubset>, - options?: ModelQueryOptions | null>, - ): ModelQueryResult | null>; + options?: ModelQueryOptions, T> | null>, + ): ModelQueryResult, T> | null>; useFindMany>( args?: SelectSubset>, - options?: ModelQueryOptions[]>, - ): ModelQueryResult[]>; + options?: ModelQueryOptions, T>[]>, + ): ModelQueryResult, T>[]>; useInfiniteFindMany>( args?: SelectSubset>, - options?: ModelInfiniteQueryOptions[]>, - ): ModelInfiniteQueryResult[]>>; + options?: ModelInfiniteQueryOptions, T>[]>, + ): ModelInfiniteQueryResult, T>[]>>; useCreate>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useCreateMany>( @@ -151,11 +155,11 @@ export type ModelQueryHooks; useCreateManyAndReturn>( - options?: ModelMutationOptions[], T>, + options?: ModelMutationOptions, T>[], T>, ): ModelMutationModelResult; useUpdate>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useUpdateMany>( @@ -163,15 +167,15 @@ export type ModelQueryHooks; useUpdateManyAndReturn>( - options?: ModelMutationOptions[], T>, + options?: ModelMutationOptions, T>[], T>, ): ModelMutationModelResult; useUpsert>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useDelete>( - options?: ModelMutationOptions, T>, + options?: ModelMutationOptions, T>, T>, ): ModelMutationModelResult; useDeleteMany>( diff --git a/packages/clients/tanstack-query/test/schemas/basic/input.ts b/packages/clients/tanstack-query/test/schemas/basic/input.ts index 755f3b2b..29cf7929 100644 --- a/packages/clients/tanstack-query/test/schemas/basic/input.ts +++ b/packages/clients/tanstack-query/test/schemas/basic/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema-lite"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; @@ -47,7 +47,7 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">; export type PostSelect = $SelectInput<$Schema, "Post">; export type PostInclude = $IncludeInput<$Schema, "Post">; export type PostOmit = $OmitInput<$Schema, "Post">; -export type PostGetPayload> = $SimplifiedModelResult<$Schema, "Post", Args>; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; export type CategoryFindManyArgs = $FindManyArgs<$Schema, "Category">; export type CategoryFindUniqueArgs = $FindUniqueArgs<$Schema, "Category">; export type CategoryFindFirstArgs = $FindFirstArgs<$Schema, "Category">; @@ -67,7 +67,7 @@ export type CategoryWhereInput = $WhereInput<$Schema, "Category">; export type CategorySelect = $SelectInput<$Schema, "Category">; export type CategoryInclude = $IncludeInput<$Schema, "Category">; export type CategoryOmit = $OmitInput<$Schema, "Category">; -export type CategoryGetPayload> = $SimplifiedModelResult<$Schema, "Category", Args>; +export type CategoryGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Category", Options, Args>; export type FooFindManyArgs = $FindManyArgs<$Schema, "Foo">; export type FooFindUniqueArgs = $FindUniqueArgs<$Schema, "Foo">; export type FooFindFirstArgs = $FindFirstArgs<$Schema, "Foo">; @@ -87,7 +87,7 @@ export type FooWhereInput = $WhereInput<$Schema, "Foo">; export type FooSelect = $SelectInput<$Schema, "Foo">; export type FooInclude = $IncludeInput<$Schema, "Foo">; export type FooOmit = $OmitInput<$Schema, "Foo">; -export type FooGetPayload> = $SimplifiedModelResult<$Schema, "Foo", Args>; +export type FooGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Foo", Options, Args>; export type BarFindManyArgs = $FindManyArgs<$Schema, "Bar">; export type BarFindUniqueArgs = $FindUniqueArgs<$Schema, "Bar">; export type BarFindFirstArgs = $FindFirstArgs<$Schema, "Bar">; @@ -107,4 +107,4 @@ export type BarWhereInput = $WhereInput<$Schema, "Bar">; export type BarSelect = $SelectInput<$Schema, "Bar">; export type BarInclude = $IncludeInput<$Schema, "Bar">; export type BarOmit = $OmitInput<$Schema, "Bar">; -export type BarGetPayload> = $SimplifiedModelResult<$Schema, "Bar", Args>; +export type BarGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Bar", Options, Args>; From 6a809850bc893cf6dc6d46d5aec1c9131bd3c317 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 08:31:38 +0800 Subject: [PATCH 5/8] fix build --- samples/next.js/zenstack/input.ts | 6 +++--- samples/orm/zenstack/input.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/next.js/zenstack/input.ts b/samples/next.js/zenstack/input.ts index 31122290..7d1c6dbe 100644 --- a/samples/next.js/zenstack/input.ts +++ b/samples/next.js/zenstack/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema-lite"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; @@ -47,4 +47,4 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">; export type PostSelect = $SelectInput<$Schema, "Post">; export type PostInclude = $IncludeInput<$Schema, "Post">; export type PostOmit = $OmitInput<$Schema, "Post">; -export type PostGetPayload> = $SimplifiedModelResult<$Schema, "Post", Args>; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; diff --git a/samples/orm/zenstack/input.ts b/samples/orm/zenstack/input.ts index c10942b2..c5ead56d 100644 --- a/samples/orm/zenstack/input.ts +++ b/samples/orm/zenstack/input.ts @@ -6,7 +6,7 @@ /* eslint-disable */ import { type SchemaType as $Schema } from "./schema"; -import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm"; +import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput, ClientOptions as $ClientOptions } from "@zenstackhq/orm"; import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm"; export type UserFindManyArgs = $FindManyArgs<$Schema, "User">; export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">; @@ -27,7 +27,7 @@ export type UserWhereInput = $WhereInput<$Schema, "User">; export type UserSelect = $SelectInput<$Schema, "User">; export type UserInclude = $IncludeInput<$Schema, "User">; export type UserOmit = $OmitInput<$Schema, "User">; -export type UserGetPayload> = $SimplifiedModelResult<$Schema, "User", Args>; +export type UserGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "User", Options, Args>; export type ProfileFindManyArgs = $FindManyArgs<$Schema, "Profile">; export type ProfileFindUniqueArgs = $FindUniqueArgs<$Schema, "Profile">; export type ProfileFindFirstArgs = $FindFirstArgs<$Schema, "Profile">; @@ -47,7 +47,7 @@ export type ProfileWhereInput = $WhereInput<$Schema, "Profile">; export type ProfileSelect = $SelectInput<$Schema, "Profile">; export type ProfileInclude = $IncludeInput<$Schema, "Profile">; export type ProfileOmit = $OmitInput<$Schema, "Profile">; -export type ProfileGetPayload> = $SimplifiedModelResult<$Schema, "Profile", Args>; +export type ProfileGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Profile", Options, Args>; export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">; export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">; export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">; @@ -67,4 +67,4 @@ export type PostWhereInput = $WhereInput<$Schema, "Post">; export type PostSelect = $SelectInput<$Schema, "Post">; export type PostInclude = $IncludeInput<$Schema, "Post">; export type PostOmit = $OmitInput<$Schema, "Post">; -export type PostGetPayload> = $SimplifiedModelResult<$Schema, "Post", Args>; +export type PostGetPayload, Options extends $ClientOptions<$Schema> = $ClientOptions<$Schema>> = $SimplifiedModelResult<$Schema, "Post", Options, Args>; From 44b696831d12c5baf57bcab84d3b921211f4c56c Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 08:52:19 +0800 Subject: [PATCH 6/8] update sample --- pnpm-lock.yaml | 109 ++++++++++++++++------------------- samples/next.js/package.json | 2 +- 2 files changed, 50 insertions(+), 61 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69a4d33e..5e1199a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -768,13 +768,13 @@ importers: version: 9.29.0(jiti@2.6.1) eslint-config-next: specifier: 16.0.1 - version: 16.0.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + version: 16.0.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) tailwindcss: specifier: ^4 version: 4.1.16 typescript: - specifier: ^5 - version: 5.8.3 + specifier: 'catalog:' + version: 5.9.3 samples/orm: dependencies: @@ -7080,11 +7080,6 @@ packages: eslint: ^8.57.0 || ^9.0.0 typescript: '>=4.8.4 <6.0.0' - typescript@5.8.3: - resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==} - engines: {node: '>=14.17'} - hasBin: true - typescript@5.9.3: resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} @@ -9752,20 +9747,20 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/eslint-plugin@8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/eslint-plugin@8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/regexpp': 4.12.1 - '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) '@typescript-eslint/scope-manager': 8.46.2 - '@typescript-eslint/type-utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) - '@typescript-eslint/utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/type-utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) '@typescript-eslint/visitor-keys': 8.46.2 eslint: 9.29.0(jiti@2.6.1) graphemer: 1.4.0 ignore: 7.0.5 natural-compare: 1.4.0 - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9781,15 +9776,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@typescript-eslint/scope-manager': 8.46.2 '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.8.3) + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) '@typescript-eslint/visitor-keys': 8.46.2 debug: 4.4.1 eslint: 9.29.0(jiti@2.6.1) - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9802,12 +9797,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.46.2(typescript@5.8.3)': + '@typescript-eslint/project-service@8.46.2(typescript@5.9.3)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.8.3) + '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3) '@typescript-eslint/types': 8.46.2 debug: 4.4.1 - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9825,9 +9820,9 @@ snapshots: dependencies: typescript: 5.9.3 - '@typescript-eslint/tsconfig-utils@8.46.2(typescript@5.8.3)': + '@typescript-eslint/tsconfig-utils@8.46.2(typescript@5.9.3)': dependencies: - typescript: 5.8.3 + typescript: 5.9.3 '@typescript-eslint/type-utils@8.34.1(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: @@ -9840,15 +9835,15 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/type-utils@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/type-utils@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.8.3) - '@typescript-eslint/utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) + '@typescript-eslint/utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) debug: 4.4.1 eslint: 9.29.0(jiti@2.6.1) - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9872,10 +9867,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/typescript-estree@8.46.2(typescript@5.8.3)': + '@typescript-eslint/typescript-estree@8.46.2(typescript@5.9.3)': dependencies: - '@typescript-eslint/project-service': 8.46.2(typescript@5.8.3) - '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.8.3) + '@typescript-eslint/project-service': 8.46.2(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.46.2(typescript@5.9.3) '@typescript-eslint/types': 8.46.2 '@typescript-eslint/visitor-keys': 8.46.2 debug: 4.4.1 @@ -9883,8 +9878,8 @@ snapshots: is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.7.3 - ts-api-utils: 2.1.0(typescript@5.8.3) - typescript: 5.8.3 + ts-api-utils: 2.1.0(typescript@5.9.3) + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -9899,14 +9894,14 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3)': + '@typescript-eslint/utils@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3)': dependencies: '@eslint-community/eslint-utils': 4.7.0(eslint@9.29.0(jiti@2.6.1)) '@typescript-eslint/scope-manager': 8.46.2 '@typescript-eslint/types': 8.46.2 - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.8.3) + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) eslint: 9.29.0(jiti@2.6.1) - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color @@ -11253,20 +11248,20 @@ snapshots: escape-string-regexp@5.0.0: {} - eslint-config-next@16.0.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3): + eslint-config-next@16.0.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3): dependencies: '@next/eslint-plugin-next': 16.0.1 eslint: 9.29.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) eslint-plugin-jsx-a11y: 6.10.2(eslint@9.29.0(jiti@2.6.1)) eslint-plugin-react: 7.37.5(eslint@9.29.0(jiti@2.6.1)) eslint-plugin-react-hooks: 7.0.1(eslint@9.29.0(jiti@2.6.1)) globals: 16.4.0 - typescript-eslint: 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + typescript-eslint: 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) optionalDependencies: - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-webpack @@ -11281,7 +11276,7 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)): + eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.4.1 @@ -11292,22 +11287,22 @@ snapshots: tinyglobby: 0.2.15 unrs-resolver: 1.11.1 optionalDependencies: - eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) + eslint-plugin-import: 2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) eslint: 9.29.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) + eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) transitivePeerDependencies: - supports-color - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)): + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -11318,7 +11313,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.29.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)))(eslint@9.29.0(jiti@2.6.1)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -11330,7 +11325,7 @@ snapshots: string.prototype.trimend: 1.0.9 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -14422,10 +14417,6 @@ snapshots: tree-kill@1.2.2: {} - ts-api-utils@2.1.0(typescript@5.8.3): - dependencies: - typescript: 5.8.3 - ts-api-utils@2.1.0(typescript@5.9.3): dependencies: typescript: 5.9.3 @@ -14577,19 +14568,17 @@ snapshots: transitivePeerDependencies: - supports-color - typescript-eslint@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3): + typescript-eslint@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3): dependencies: - '@typescript-eslint/eslint-plugin': 8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) - '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) - '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.8.3) - '@typescript-eslint/utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.8.3) + '@typescript-eslint/eslint-plugin': 8.46.2(@typescript-eslint/parser@8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3))(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/parser': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) + '@typescript-eslint/typescript-estree': 8.46.2(typescript@5.9.3) + '@typescript-eslint/utils': 8.46.2(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.3) eslint: 9.29.0(jiti@2.6.1) - typescript: 5.8.3 + typescript: 5.9.3 transitivePeerDependencies: - supports-color - typescript@5.8.3: {} - typescript@5.9.3: {} ufo@1.6.1: {} diff --git a/samples/next.js/package.json b/samples/next.js/package.json index 515ccd8d..76b5f826 100644 --- a/samples/next.js/package.json +++ b/samples/next.js/package.json @@ -32,6 +32,6 @@ "eslint": "^9", "eslint-config-next": "16.0.1", "tailwindcss": "^4", - "typescript": "^5" + "typescript": "catalog:" } } From 5bdbbd3833e1d7c1ea5752cf1ba37c64e3aebeb5 Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:16:46 +0800 Subject: [PATCH 7/8] fix tests --- tests/e2e/orm/client-api/omit.test.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/e2e/orm/client-api/omit.test.ts b/tests/e2e/orm/client-api/omit.test.ts index 42cfa662..f200a0c5 100644 --- a/tests/e2e/orm/client-api/omit.test.ts +++ b/tests/e2e/orm/client-api/omit.test.ts @@ -62,11 +62,13 @@ describe('Field omission tests', () => { expect(post.author.password).toBeUndefined(); // @ts-expect-error expect(post.author.name).toBeUndefined(); + }); + it('allows override at query options level', async () => { // override schema-level omit - const options1 = { omit: { User: { password: false } }, dialect: {} as any } as const; - const db1 = await createTestClient(schema, options1); - const user1 = await db1.user.create({ + const options = { omit: { User: { password: false } }, dialect: {} as any } as const; + const db = await createTestClient(schema, options); + const user1 = await db.user.create({ data: { id: 1, name: 'User1', @@ -108,16 +110,18 @@ describe('Field omission tests', () => { const user4 = await db.user.delete({ where: { id: 1 }, omit: { password: false } }); expect(user4.password).toBeTruthy(); + }); + it('allows override at query level', async () => { // override options-level omit const options = { omit: { User: { name: true } }, dialect: {} as any } as const; - const db1 = await createTestClient(schema, options); - const user5 = await db1.user.create({ + const db = await createTestClient(schema, options); + const user5 = await db.user.create({ data: { id: 2, name: 'User2', password: 'abc' }, }); // @ts-expect-error expect(user5.name).toBeUndefined(); - const user6 = await db1.user.findFirstOrThrow({ omit: { name: false } }); + const user6 = await db.user.findFirstOrThrow({ omit: { name: false } }); expect(user6.name).toBeTruthy(); }); From f229f41d6b249e8b5e6dba88a322a40ee6082cfc Mon Sep 17 00:00:00 2001 From: ymc9 <104139426+ymc9@users.noreply.github.com> Date: Thu, 27 Nov 2025 09:18:56 +0800 Subject: [PATCH 8/8] update --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index d913fdbb..9628cc16 100644 --- a/TODO.md +++ b/TODO.md @@ -85,7 +85,7 @@ - [x] Error system - [x] Custom table name - [x] Custom field name - - [ ] Global omit + - [x] Global omit - [ ] DbNull vs JsonNull - [ ] Migrate to tsdown - [x] @default validation