@danielhritcu/zenstack-orm 3.5.7 → 3.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -42
- package/dist/index.d.ts +65 -42
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1051,7 +1051,7 @@ type CoreDeleteOperations = (typeof CoreDeleteOperations)[number];
|
|
|
1051
1051
|
/**
|
|
1052
1052
|
* List of all CRUD operations, including 'orThrow' variants.
|
|
1053
1053
|
*/
|
|
1054
|
-
declare const AllCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow"];
|
|
1054
|
+
declare const AllCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow", "paginate"];
|
|
1055
1055
|
/**
|
|
1056
1056
|
* List of all CRUD operations, including 'orThrow' variants.
|
|
1057
1057
|
*/
|
|
@@ -2242,6 +2242,47 @@ interface Diagnostics {
|
|
|
2242
2242
|
slowQueries: QueryInfo[];
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
|
+
/**
|
|
2246
|
+
* Offset pagination result.
|
|
2247
|
+
*/
|
|
2248
|
+
interface PaginatedOffset<T> {
|
|
2249
|
+
items: T[];
|
|
2250
|
+
pagination: {
|
|
2251
|
+
count: number;
|
|
2252
|
+
page: {
|
|
2253
|
+
size: number;
|
|
2254
|
+
current: number;
|
|
2255
|
+
next: number | null;
|
|
2256
|
+
prev: number | null;
|
|
2257
|
+
total: number;
|
|
2258
|
+
};
|
|
2259
|
+
has: {
|
|
2260
|
+
next: boolean;
|
|
2261
|
+
prev: boolean;
|
|
2262
|
+
};
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Cursor pagination result.
|
|
2267
|
+
*/
|
|
2268
|
+
interface PaginatedCursor<T> {
|
|
2269
|
+
items: T[];
|
|
2270
|
+
pagination: {
|
|
2271
|
+
count: number;
|
|
2272
|
+
page: {
|
|
2273
|
+
size: number;
|
|
2274
|
+
};
|
|
2275
|
+
has: {
|
|
2276
|
+
next: boolean;
|
|
2277
|
+
prev: boolean;
|
|
2278
|
+
};
|
|
2279
|
+
cursor: {
|
|
2280
|
+
next: string | null;
|
|
2281
|
+
prev: string | null;
|
|
2282
|
+
};
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2245
2286
|
/**
|
|
2246
2287
|
* A promise that only executes when it's awaited or .then() is called.
|
|
2247
2288
|
*/
|
|
@@ -3002,6 +3043,29 @@ type CommonModelOperations<Schema extends SchemaDef, Model extends GetModels<Sch
|
|
|
3002
3043
|
* }); // result: `boolean`
|
|
3003
3044
|
*/
|
|
3004
3045
|
exists<T extends ExistsArgs<Schema, Model, Options, ExtQueryArgs>>(args?: Subset<T, ExistsArgs<Schema, Model, Options, ExtQueryArgs>>): ZenStackPromise<Schema, boolean>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Returns paginated results with metadata.
|
|
3048
|
+
*
|
|
3049
|
+
* Offset mode (pass `page`):
|
|
3050
|
+
* ```ts
|
|
3051
|
+
* const result = await db.user.paginate({ page: 1, pageSize: 20 });
|
|
3052
|
+
* // result.items, result.pagination.page.current, result.pagination.has.next
|
|
3053
|
+
* ```
|
|
3054
|
+
*
|
|
3055
|
+
* Cursor mode (pass `cursor`):
|
|
3056
|
+
* ```ts
|
|
3057
|
+
* const result = await db.user.paginate({ cursor: lastId, pageSize: 20 });
|
|
3058
|
+
* // result.items, result.pagination.cursor.next, result.pagination.has.next
|
|
3059
|
+
* ```
|
|
3060
|
+
*/
|
|
3061
|
+
paginate<T extends FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>(args: Omit<SelectSubset<T, FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>, 'skip' | 'take' | 'cursor'> & {
|
|
3062
|
+
page: number;
|
|
3063
|
+
pageSize?: number;
|
|
3064
|
+
}): ZenStackPromise<Schema, PaginatedOffset<SimplifiedPlainResult<Schema, Model, T, Options, ExtResult>>>;
|
|
3065
|
+
paginate<T extends FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>(args: Omit<SelectSubset<T, FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>, 'skip' | 'take' | 'cursor'> & {
|
|
3066
|
+
cursor: string;
|
|
3067
|
+
pageSize?: number;
|
|
3068
|
+
}): ZenStackPromise<Schema, PaginatedCursor<SimplifiedPlainResult<Schema, Model, T, Options, ExtResult>>>;
|
|
3005
3069
|
};
|
|
3006
3070
|
type OperationsRequiringCreate = 'create' | 'createMany' | 'createManyAndReturn' | 'upsert';
|
|
3007
3071
|
type ModelOperations<Schema extends SchemaDef, Model extends GetModels<Schema>, Options extends ClientOptions<Schema> = ClientOptions<Schema>, ExtQueryArgs extends ExtQueryArgsBase = {}, ExtResult extends ExtResultBase<Schema> = {}> = SliceOperations<AllModelOperations<Schema, Model, Options, ExtQueryArgs, ExtResult>, Schema, Model, Options>;
|
|
@@ -3375,47 +3439,6 @@ declare namespace queryUtils {
|
|
|
3375
3439
|
export { queryUtils_TEMP_ALIAS_PREFIX as TEMP_ALIAS_PREFIX, queryUtils_aggregate as aggregate, queryUtils_buildJoinPairs as buildJoinPairs, queryUtils_ensureArray as ensureArray, queryUtils_extractFieldName as extractFieldName, queryUtils_extractIdFields as extractIdFields, queryUtils_extractModelName as extractModelName, queryUtils_fieldHasDefaultValue as fieldHasDefaultValue, queryUtils_flattenCompoundUniqueFilters as flattenCompoundUniqueFilters, queryUtils_getDelegateDescendantModels as getDelegateDescendantModels, queryUtils_getDiscriminatorField as getDiscriminatorField, queryUtils_getEnum as getEnum, queryUtils_getField as getField, queryUtils_getIdFields as getIdFields, queryUtils_getIdValues as getIdValues, queryUtils_getManyToManyRelation as getManyToManyRelation, queryUtils_getModel as getModel, queryUtils_getModelFields as getModelFields, queryUtils_getRelationForeignKeyFieldPairs as getRelationForeignKeyFieldPairs, queryUtils_getTypeDef as getTypeDef, queryUtils_getUniqueFields as getUniqueFields, queryUtils_hasModel as hasModel, queryUtils_isEnum as isEnum, queryUtils_isForeignKeyField as isForeignKeyField, queryUtils_isInheritedField as isInheritedField, queryUtils_isRelationField as isRelationField, queryUtils_isScalarField as isScalarField, queryUtils_isTypeDef as isTypeDef, queryUtils_isUnsupportedField as isUnsupportedField, queryUtils_makeDefaultOrderBy as makeDefaultOrderBy, queryUtils_requireField as requireField, queryUtils_requireIdFields as requireIdFields, queryUtils_requireModel as requireModel, queryUtils_requireTypeDef as requireTypeDef, queryUtils_stripAlias as stripAlias, queryUtils_tmpAlias as tmpAlias };
|
|
3376
3440
|
}
|
|
3377
3441
|
|
|
3378
|
-
/**
|
|
3379
|
-
* Offset pagination result.
|
|
3380
|
-
*/
|
|
3381
|
-
interface PaginatedOffset<T> {
|
|
3382
|
-
items: T[];
|
|
3383
|
-
pagination: {
|
|
3384
|
-
count: number;
|
|
3385
|
-
page: {
|
|
3386
|
-
size: number;
|
|
3387
|
-
current: number;
|
|
3388
|
-
next: number | null;
|
|
3389
|
-
prev: number | null;
|
|
3390
|
-
total: number;
|
|
3391
|
-
};
|
|
3392
|
-
has: {
|
|
3393
|
-
next: boolean;
|
|
3394
|
-
prev: boolean;
|
|
3395
|
-
};
|
|
3396
|
-
};
|
|
3397
|
-
}
|
|
3398
|
-
/**
|
|
3399
|
-
* Cursor pagination result.
|
|
3400
|
-
*/
|
|
3401
|
-
interface PaginatedCursor<T> {
|
|
3402
|
-
items: T[];
|
|
3403
|
-
pagination: {
|
|
3404
|
-
count: number;
|
|
3405
|
-
page: {
|
|
3406
|
-
size: number;
|
|
3407
|
-
};
|
|
3408
|
-
has: {
|
|
3409
|
-
next: boolean;
|
|
3410
|
-
prev: boolean;
|
|
3411
|
-
};
|
|
3412
|
-
cursor: {
|
|
3413
|
-
next: string | null;
|
|
3414
|
-
prev: string | null;
|
|
3415
|
-
};
|
|
3416
|
-
};
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
3442
|
type VisitResult = void | {
|
|
3420
3443
|
abort: true;
|
|
3421
3444
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1051,7 +1051,7 @@ type CoreDeleteOperations = (typeof CoreDeleteOperations)[number];
|
|
|
1051
1051
|
/**
|
|
1052
1052
|
* List of all CRUD operations, including 'orThrow' variants.
|
|
1053
1053
|
*/
|
|
1054
|
-
declare const AllCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow"];
|
|
1054
|
+
declare const AllCrudOperations: readonly ["findMany", "findUnique", "findFirst", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "upsert", "delete", "deleteMany", "count", "aggregate", "groupBy", "exists", "findUniqueOrThrow", "findFirstOrThrow", "paginate"];
|
|
1055
1055
|
/**
|
|
1056
1056
|
* List of all CRUD operations, including 'orThrow' variants.
|
|
1057
1057
|
*/
|
|
@@ -2242,6 +2242,47 @@ interface Diagnostics {
|
|
|
2242
2242
|
slowQueries: QueryInfo[];
|
|
2243
2243
|
}
|
|
2244
2244
|
|
|
2245
|
+
/**
|
|
2246
|
+
* Offset pagination result.
|
|
2247
|
+
*/
|
|
2248
|
+
interface PaginatedOffset<T> {
|
|
2249
|
+
items: T[];
|
|
2250
|
+
pagination: {
|
|
2251
|
+
count: number;
|
|
2252
|
+
page: {
|
|
2253
|
+
size: number;
|
|
2254
|
+
current: number;
|
|
2255
|
+
next: number | null;
|
|
2256
|
+
prev: number | null;
|
|
2257
|
+
total: number;
|
|
2258
|
+
};
|
|
2259
|
+
has: {
|
|
2260
|
+
next: boolean;
|
|
2261
|
+
prev: boolean;
|
|
2262
|
+
};
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Cursor pagination result.
|
|
2267
|
+
*/
|
|
2268
|
+
interface PaginatedCursor<T> {
|
|
2269
|
+
items: T[];
|
|
2270
|
+
pagination: {
|
|
2271
|
+
count: number;
|
|
2272
|
+
page: {
|
|
2273
|
+
size: number;
|
|
2274
|
+
};
|
|
2275
|
+
has: {
|
|
2276
|
+
next: boolean;
|
|
2277
|
+
prev: boolean;
|
|
2278
|
+
};
|
|
2279
|
+
cursor: {
|
|
2280
|
+
next: string | null;
|
|
2281
|
+
prev: string | null;
|
|
2282
|
+
};
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2245
2286
|
/**
|
|
2246
2287
|
* A promise that only executes when it's awaited or .then() is called.
|
|
2247
2288
|
*/
|
|
@@ -3002,6 +3043,29 @@ type CommonModelOperations<Schema extends SchemaDef, Model extends GetModels<Sch
|
|
|
3002
3043
|
* }); // result: `boolean`
|
|
3003
3044
|
*/
|
|
3004
3045
|
exists<T extends ExistsArgs<Schema, Model, Options, ExtQueryArgs>>(args?: Subset<T, ExistsArgs<Schema, Model, Options, ExtQueryArgs>>): ZenStackPromise<Schema, boolean>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Returns paginated results with metadata.
|
|
3048
|
+
*
|
|
3049
|
+
* Offset mode (pass `page`):
|
|
3050
|
+
* ```ts
|
|
3051
|
+
* const result = await db.user.paginate({ page: 1, pageSize: 20 });
|
|
3052
|
+
* // result.items, result.pagination.page.current, result.pagination.has.next
|
|
3053
|
+
* ```
|
|
3054
|
+
*
|
|
3055
|
+
* Cursor mode (pass `cursor`):
|
|
3056
|
+
* ```ts
|
|
3057
|
+
* const result = await db.user.paginate({ cursor: lastId, pageSize: 20 });
|
|
3058
|
+
* // result.items, result.pagination.cursor.next, result.pagination.has.next
|
|
3059
|
+
* ```
|
|
3060
|
+
*/
|
|
3061
|
+
paginate<T extends FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>(args: Omit<SelectSubset<T, FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>, 'skip' | 'take' | 'cursor'> & {
|
|
3062
|
+
page: number;
|
|
3063
|
+
pageSize?: number;
|
|
3064
|
+
}): ZenStackPromise<Schema, PaginatedOffset<SimplifiedPlainResult<Schema, Model, T, Options, ExtResult>>>;
|
|
3065
|
+
paginate<T extends FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>(args: Omit<SelectSubset<T, FindManyArgs<Schema, Model, Options, ExtQueryArgs, ExtResult>>, 'skip' | 'take' | 'cursor'> & {
|
|
3066
|
+
cursor: string;
|
|
3067
|
+
pageSize?: number;
|
|
3068
|
+
}): ZenStackPromise<Schema, PaginatedCursor<SimplifiedPlainResult<Schema, Model, T, Options, ExtResult>>>;
|
|
3005
3069
|
};
|
|
3006
3070
|
type OperationsRequiringCreate = 'create' | 'createMany' | 'createManyAndReturn' | 'upsert';
|
|
3007
3071
|
type ModelOperations<Schema extends SchemaDef, Model extends GetModels<Schema>, Options extends ClientOptions<Schema> = ClientOptions<Schema>, ExtQueryArgs extends ExtQueryArgsBase = {}, ExtResult extends ExtResultBase<Schema> = {}> = SliceOperations<AllModelOperations<Schema, Model, Options, ExtQueryArgs, ExtResult>, Schema, Model, Options>;
|
|
@@ -3375,47 +3439,6 @@ declare namespace queryUtils {
|
|
|
3375
3439
|
export { queryUtils_TEMP_ALIAS_PREFIX as TEMP_ALIAS_PREFIX, queryUtils_aggregate as aggregate, queryUtils_buildJoinPairs as buildJoinPairs, queryUtils_ensureArray as ensureArray, queryUtils_extractFieldName as extractFieldName, queryUtils_extractIdFields as extractIdFields, queryUtils_extractModelName as extractModelName, queryUtils_fieldHasDefaultValue as fieldHasDefaultValue, queryUtils_flattenCompoundUniqueFilters as flattenCompoundUniqueFilters, queryUtils_getDelegateDescendantModels as getDelegateDescendantModels, queryUtils_getDiscriminatorField as getDiscriminatorField, queryUtils_getEnum as getEnum, queryUtils_getField as getField, queryUtils_getIdFields as getIdFields, queryUtils_getIdValues as getIdValues, queryUtils_getManyToManyRelation as getManyToManyRelation, queryUtils_getModel as getModel, queryUtils_getModelFields as getModelFields, queryUtils_getRelationForeignKeyFieldPairs as getRelationForeignKeyFieldPairs, queryUtils_getTypeDef as getTypeDef, queryUtils_getUniqueFields as getUniqueFields, queryUtils_hasModel as hasModel, queryUtils_isEnum as isEnum, queryUtils_isForeignKeyField as isForeignKeyField, queryUtils_isInheritedField as isInheritedField, queryUtils_isRelationField as isRelationField, queryUtils_isScalarField as isScalarField, queryUtils_isTypeDef as isTypeDef, queryUtils_isUnsupportedField as isUnsupportedField, queryUtils_makeDefaultOrderBy as makeDefaultOrderBy, queryUtils_requireField as requireField, queryUtils_requireIdFields as requireIdFields, queryUtils_requireModel as requireModel, queryUtils_requireTypeDef as requireTypeDef, queryUtils_stripAlias as stripAlias, queryUtils_tmpAlias as tmpAlias };
|
|
3376
3440
|
}
|
|
3377
3441
|
|
|
3378
|
-
/**
|
|
3379
|
-
* Offset pagination result.
|
|
3380
|
-
*/
|
|
3381
|
-
interface PaginatedOffset<T> {
|
|
3382
|
-
items: T[];
|
|
3383
|
-
pagination: {
|
|
3384
|
-
count: number;
|
|
3385
|
-
page: {
|
|
3386
|
-
size: number;
|
|
3387
|
-
current: number;
|
|
3388
|
-
next: number | null;
|
|
3389
|
-
prev: number | null;
|
|
3390
|
-
total: number;
|
|
3391
|
-
};
|
|
3392
|
-
has: {
|
|
3393
|
-
next: boolean;
|
|
3394
|
-
prev: boolean;
|
|
3395
|
-
};
|
|
3396
|
-
};
|
|
3397
|
-
}
|
|
3398
|
-
/**
|
|
3399
|
-
* Cursor pagination result.
|
|
3400
|
-
*/
|
|
3401
|
-
interface PaginatedCursor<T> {
|
|
3402
|
-
items: T[];
|
|
3403
|
-
pagination: {
|
|
3404
|
-
count: number;
|
|
3405
|
-
page: {
|
|
3406
|
-
size: number;
|
|
3407
|
-
};
|
|
3408
|
-
has: {
|
|
3409
|
-
next: boolean;
|
|
3410
|
-
prev: boolean;
|
|
3411
|
-
};
|
|
3412
|
-
cursor: {
|
|
3413
|
-
next: string | null;
|
|
3414
|
-
prev: string | null;
|
|
3415
|
-
};
|
|
3416
|
-
};
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
3442
|
type VisitResult = void | {
|
|
3420
3443
|
abort: true;
|
|
3421
3444
|
};
|
package/dist/index.js
CHANGED
|
@@ -3060,7 +3060,8 @@ var CoreDeleteOperations = [
|
|
|
3060
3060
|
var AllCrudOperations = [
|
|
3061
3061
|
...CoreCrudOperations2,
|
|
3062
3062
|
"findUniqueOrThrow",
|
|
3063
|
-
"findFirstOrThrow"
|
|
3063
|
+
"findFirstOrThrow",
|
|
3064
|
+
"paginate"
|
|
3064
3065
|
];
|
|
3065
3066
|
var AllReadOperations = [
|
|
3066
3067
|
...CoreReadOperations,
|