@zenstackhq/runtime 3.0.0-alpha.26 → 3.0.0-alpha.27
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/{contract-BF6mvhVn.d.cts → contract-c8GpEAl3.d.cts} +15 -13
- package/dist/{contract-BF6mvhVn.d.ts → contract-c8GpEAl3.d.ts} +15 -13
- package/dist/index.cjs +109 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +109 -144
- package/dist/index.js.map +1 -1
- package/dist/plugins/policy/index.cjs +59 -24
- package/dist/plugins/policy/index.cjs.map +1 -1
- package/dist/plugins/policy/index.d.cts +1 -1
- package/dist/plugins/policy/index.d.ts +1 -1
- package/dist/plugins/policy/index.js +59 -24
- package/dist/plugins/policy/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -201,12 +201,6 @@ type SelectIncludeOmit<Schema extends SchemaDef, Model extends GetModels<Schema>
|
|
|
201
201
|
include?: IncludeInput<Schema, Model>;
|
|
202
202
|
omit?: OmitInput<Schema, Model>;
|
|
203
203
|
};
|
|
204
|
-
type Distinct<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
205
|
-
distinct?: OrArray<NonRelationFields<Schema, Model>>;
|
|
206
|
-
};
|
|
207
|
-
type Cursor<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
208
|
-
cursor?: WhereUniqueInput<Schema, Model>;
|
|
209
|
-
};
|
|
210
204
|
type SelectInput<Schema extends SchemaDef, Model extends GetModels<Schema>, AllowCount extends boolean = true, AllowRelation extends boolean = true> = {
|
|
211
205
|
[Key in NonRelationFields<Schema, Model>]?: true;
|
|
212
206
|
} & (AllowRelation extends true ? IncludeInput<Schema, Model> : {}) & // relation fields
|
|
@@ -255,13 +249,18 @@ type GetRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Fiel
|
|
|
255
249
|
type OppositeRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, FT = FieldType<Schema, Model, Field>> = FT extends GetModels<Schema> ? GetRelation<Schema, Model, Field> extends RelationInfo ? GetRelation<Schema, Model, Field>['opposite'] extends GetModelFields<Schema, FT> ? Schema['models'][FT]['fields'][GetRelation<Schema, Model, Field>['opposite']]['relation'] : never : never : never;
|
|
256
250
|
type OppositeRelationFields<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, Opposite = OppositeRelation<Schema, Model, Field>> = Opposite extends RelationInfo ? (Opposite['fields'] extends string[] ? Opposite['fields'] : []) : [];
|
|
257
251
|
type OppositeRelationAndFK<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, FT = FieldType<Schema, Model, Field>, Relation = GetModelField<Schema, Model, Field>['relation'], Opposite = Relation extends RelationInfo ? Relation['opposite'] : never> = FT extends GetModels<Schema> ? Opposite extends GetModelFields<Schema, FT> ? Opposite | OppositeRelationFields<Schema, Model, Field>[number] : never : never;
|
|
258
|
-
type
|
|
252
|
+
type FilterArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
253
|
+
where?: WhereInput<Schema, Model>;
|
|
254
|
+
};
|
|
255
|
+
type SortAndTakeArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
259
256
|
skip?: number;
|
|
260
257
|
take?: number;
|
|
261
258
|
orderBy?: OrArray<OrderBy<Schema, Model, true, false>>;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
cursor?: WhereUniqueInput<Schema, Model>;
|
|
260
|
+
};
|
|
261
|
+
type FindArgs<Schema extends SchemaDef, Model extends GetModels<Schema>, Collection extends boolean, AllowFilter extends boolean = true> = ProviderSupportsDistinct<Schema> extends true ? (Collection extends true ? SortAndTakeArgs<Schema, Model> & {
|
|
262
|
+
distinct?: OrArray<NonRelationFields<Schema, Model>>;
|
|
263
|
+
} : {}) & (AllowFilter extends true ? FilterArgs<Schema, Model> : {}) & SelectIncludeOmit<Schema, Model, Collection> : (Collection extends true ? SortAndTakeArgs<Schema, Model> : {}) & (AllowFilter extends true ? FilterArgs<Schema, Model> : {}) & SelectIncludeOmit<Schema, Model, Collection>;
|
|
265
264
|
type FindManyArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = FindArgs<Schema, Model, true>;
|
|
266
265
|
type FindFirstArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = FindArgs<Schema, Model, false>;
|
|
267
266
|
type FindUniqueArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
@@ -513,7 +512,8 @@ type NonOwnedRelationFields<Schema extends SchemaDef, Model extends GetModels<Sc
|
|
|
513
512
|
type HasToManyRelations<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof {
|
|
514
513
|
[Key in RelationFields<Schema, Model> as FieldIsArray<Schema, Model, Key> extends true ? Key : never]: true;
|
|
515
514
|
} extends never ? false : true;
|
|
516
|
-
type ProviderSupportsCaseSensitivity<Schema extends SchemaDef> = Schema['provider'] extends 'postgresql' ? true : false;
|
|
515
|
+
type ProviderSupportsCaseSensitivity<Schema extends SchemaDef> = Schema['provider']['type'] extends 'postgresql' ? true : false;
|
|
516
|
+
type ProviderSupportsDistinct<Schema extends SchemaDef> = Schema['provider']['type'] extends 'postgresql' ? true : false;
|
|
517
517
|
|
|
518
518
|
type AuthType<Schema extends SchemaDef> = string extends GetModels<Schema> ? Record<string, unknown> : Schema['authType'] extends GetModels<Schema> ? Partial<ModelResult<Schema, Schema['authType']>> : never;
|
|
519
519
|
|
|
@@ -532,7 +532,9 @@ declare abstract class BaseCrudDialect<Schema extends SchemaDef> {
|
|
|
532
532
|
constructor(schema: Schema, options: ClientOptions<Schema>);
|
|
533
533
|
transformPrimitive(value: unknown, _type: BuiltinType, _forArrayField: boolean): unknown;
|
|
534
534
|
buildSelectModel(eb: ExpressionBuilder<any, any>, model: string): SelectQueryBuilder<any, any, {}>;
|
|
535
|
+
buildFilterSortTake(model: GetModels<Schema>, args: FindArgs<Schema, GetModels<Schema>, true>, query: SelectQueryBuilder<any, any, {}>): SelectQueryBuilder<any, any, {}>;
|
|
535
536
|
buildFilter(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string, where: boolean | object | undefined): Expression<SqlBool>;
|
|
537
|
+
private buildCursorFilter;
|
|
536
538
|
private isLogicalCombinator;
|
|
537
539
|
protected buildCompositeFilter(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string, key: (typeof LOGICAL_COMBINATORS)[number], payload: any): Expression<SqlBool>;
|
|
538
540
|
private buildRelationFilter;
|
|
@@ -602,8 +604,8 @@ declare abstract class BaseCrudDialect<Schema extends SchemaDef> {
|
|
|
602
604
|
abstract get supportInsertWithDefault(): boolean;
|
|
603
605
|
}
|
|
604
606
|
|
|
605
|
-
type
|
|
606
|
-
type AllCrudOperation =
|
|
607
|
+
type CoreCrudOperation = 'findMany' | 'findUnique' | 'findFirst' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert' | 'delete' | 'deleteMany' | 'count' | 'aggregate' | 'groupBy';
|
|
608
|
+
type AllCrudOperation = CoreCrudOperation | 'findUniqueOrThrow' | 'findFirstOrThrow';
|
|
607
609
|
|
|
608
610
|
/**
|
|
609
611
|
* ZenStack runtime plugin.
|
|
@@ -201,12 +201,6 @@ type SelectIncludeOmit<Schema extends SchemaDef, Model extends GetModels<Schema>
|
|
|
201
201
|
include?: IncludeInput<Schema, Model>;
|
|
202
202
|
omit?: OmitInput<Schema, Model>;
|
|
203
203
|
};
|
|
204
|
-
type Distinct<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
205
|
-
distinct?: OrArray<NonRelationFields<Schema, Model>>;
|
|
206
|
-
};
|
|
207
|
-
type Cursor<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
208
|
-
cursor?: WhereUniqueInput<Schema, Model>;
|
|
209
|
-
};
|
|
210
204
|
type SelectInput<Schema extends SchemaDef, Model extends GetModels<Schema>, AllowCount extends boolean = true, AllowRelation extends boolean = true> = {
|
|
211
205
|
[Key in NonRelationFields<Schema, Model>]?: true;
|
|
212
206
|
} & (AllowRelation extends true ? IncludeInput<Schema, Model> : {}) & // relation fields
|
|
@@ -255,13 +249,18 @@ type GetRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Fiel
|
|
|
255
249
|
type OppositeRelation<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, FT = FieldType<Schema, Model, Field>> = FT extends GetModels<Schema> ? GetRelation<Schema, Model, Field> extends RelationInfo ? GetRelation<Schema, Model, Field>['opposite'] extends GetModelFields<Schema, FT> ? Schema['models'][FT]['fields'][GetRelation<Schema, Model, Field>['opposite']]['relation'] : never : never : never;
|
|
256
250
|
type OppositeRelationFields<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, Opposite = OppositeRelation<Schema, Model, Field>> = Opposite extends RelationInfo ? (Opposite['fields'] extends string[] ? Opposite['fields'] : []) : [];
|
|
257
251
|
type OppositeRelationAndFK<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, FT = FieldType<Schema, Model, Field>, Relation = GetModelField<Schema, Model, Field>['relation'], Opposite = Relation extends RelationInfo ? Relation['opposite'] : never> = FT extends GetModels<Schema> ? Opposite extends GetModelFields<Schema, FT> ? Opposite | OppositeRelationFields<Schema, Model, Field>[number] : never : never;
|
|
258
|
-
type
|
|
252
|
+
type FilterArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
253
|
+
where?: WhereInput<Schema, Model>;
|
|
254
|
+
};
|
|
255
|
+
type SortAndTakeArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
259
256
|
skip?: number;
|
|
260
257
|
take?: number;
|
|
261
258
|
orderBy?: OrArray<OrderBy<Schema, Model, true, false>>;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
259
|
+
cursor?: WhereUniqueInput<Schema, Model>;
|
|
260
|
+
};
|
|
261
|
+
type FindArgs<Schema extends SchemaDef, Model extends GetModels<Schema>, Collection extends boolean, AllowFilter extends boolean = true> = ProviderSupportsDistinct<Schema> extends true ? (Collection extends true ? SortAndTakeArgs<Schema, Model> & {
|
|
262
|
+
distinct?: OrArray<NonRelationFields<Schema, Model>>;
|
|
263
|
+
} : {}) & (AllowFilter extends true ? FilterArgs<Schema, Model> : {}) & SelectIncludeOmit<Schema, Model, Collection> : (Collection extends true ? SortAndTakeArgs<Schema, Model> : {}) & (AllowFilter extends true ? FilterArgs<Schema, Model> : {}) & SelectIncludeOmit<Schema, Model, Collection>;
|
|
265
264
|
type FindManyArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = FindArgs<Schema, Model, true>;
|
|
266
265
|
type FindFirstArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = FindArgs<Schema, Model, false>;
|
|
267
266
|
type FindUniqueArgs<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
@@ -513,7 +512,8 @@ type NonOwnedRelationFields<Schema extends SchemaDef, Model extends GetModels<Sc
|
|
|
513
512
|
type HasToManyRelations<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof {
|
|
514
513
|
[Key in RelationFields<Schema, Model> as FieldIsArray<Schema, Model, Key> extends true ? Key : never]: true;
|
|
515
514
|
} extends never ? false : true;
|
|
516
|
-
type ProviderSupportsCaseSensitivity<Schema extends SchemaDef> = Schema['provider'] extends 'postgresql' ? true : false;
|
|
515
|
+
type ProviderSupportsCaseSensitivity<Schema extends SchemaDef> = Schema['provider']['type'] extends 'postgresql' ? true : false;
|
|
516
|
+
type ProviderSupportsDistinct<Schema extends SchemaDef> = Schema['provider']['type'] extends 'postgresql' ? true : false;
|
|
517
517
|
|
|
518
518
|
type AuthType<Schema extends SchemaDef> = string extends GetModels<Schema> ? Record<string, unknown> : Schema['authType'] extends GetModels<Schema> ? Partial<ModelResult<Schema, Schema['authType']>> : never;
|
|
519
519
|
|
|
@@ -532,7 +532,9 @@ declare abstract class BaseCrudDialect<Schema extends SchemaDef> {
|
|
|
532
532
|
constructor(schema: Schema, options: ClientOptions<Schema>);
|
|
533
533
|
transformPrimitive(value: unknown, _type: BuiltinType, _forArrayField: boolean): unknown;
|
|
534
534
|
buildSelectModel(eb: ExpressionBuilder<any, any>, model: string): SelectQueryBuilder<any, any, {}>;
|
|
535
|
+
buildFilterSortTake(model: GetModels<Schema>, args: FindArgs<Schema, GetModels<Schema>, true>, query: SelectQueryBuilder<any, any, {}>): SelectQueryBuilder<any, any, {}>;
|
|
535
536
|
buildFilter(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string, where: boolean | object | undefined): Expression<SqlBool>;
|
|
537
|
+
private buildCursorFilter;
|
|
536
538
|
private isLogicalCombinator;
|
|
537
539
|
protected buildCompositeFilter(eb: ExpressionBuilder<any, any>, model: string, modelAlias: string, key: (typeof LOGICAL_COMBINATORS)[number], payload: any): Expression<SqlBool>;
|
|
538
540
|
private buildRelationFilter;
|
|
@@ -602,8 +604,8 @@ declare abstract class BaseCrudDialect<Schema extends SchemaDef> {
|
|
|
602
604
|
abstract get supportInsertWithDefault(): boolean;
|
|
603
605
|
}
|
|
604
606
|
|
|
605
|
-
type
|
|
606
|
-
type AllCrudOperation =
|
|
607
|
+
type CoreCrudOperation = 'findMany' | 'findUnique' | 'findFirst' | 'create' | 'createMany' | 'createManyAndReturn' | 'update' | 'updateMany' | 'updateManyAndReturn' | 'upsert' | 'delete' | 'deleteMany' | 'count' | 'aggregate' | 'groupBy';
|
|
608
|
+
type AllCrudOperation = CoreCrudOperation | 'findUniqueOrThrow' | 'findFirstOrThrow';
|
|
607
609
|
|
|
608
610
|
/**
|
|
609
611
|
* ZenStack runtime plugin.
|
package/dist/index.cjs
CHANGED
|
@@ -414,16 +414,6 @@ function ensureArray(value) {
|
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
__name(ensureArray, "ensureArray");
|
|
417
|
-
function safeJSONStringify(value) {
|
|
418
|
-
return JSON.stringify(value, (_, v) => {
|
|
419
|
-
if (typeof v === "bigint") {
|
|
420
|
-
return v.toString();
|
|
421
|
-
} else {
|
|
422
|
-
return v;
|
|
423
|
-
}
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
__name(safeJSONStringify, "safeJSONStringify");
|
|
427
417
|
function extractIdFields(entity, schema, model) {
|
|
428
418
|
const idFields = getIdFields(schema, model);
|
|
429
419
|
return extractFields(entity, idFields);
|
|
@@ -560,6 +550,33 @@ var BaseCrudDialect = class {
|
|
|
560
550
|
}
|
|
561
551
|
return result;
|
|
562
552
|
}
|
|
553
|
+
buildFilterSortTake(model, args, query) {
|
|
554
|
+
let result = query;
|
|
555
|
+
if (args.where) {
|
|
556
|
+
result = result.where((eb) => this.buildFilter(eb, model, model, args?.where));
|
|
557
|
+
}
|
|
558
|
+
let negateOrderBy = false;
|
|
559
|
+
const skip = args.skip;
|
|
560
|
+
let take = args.take;
|
|
561
|
+
if (take !== void 0 && take < 0) {
|
|
562
|
+
negateOrderBy = true;
|
|
563
|
+
take = -take;
|
|
564
|
+
}
|
|
565
|
+
result = this.buildSkipTake(result, skip, take);
|
|
566
|
+
result = this.buildOrderBy(result, model, model, args.orderBy, skip !== void 0 || take !== void 0, negateOrderBy);
|
|
567
|
+
if ("distinct" in args && args.distinct) {
|
|
568
|
+
const distinct = ensureArray(args.distinct);
|
|
569
|
+
if (this.supportsDistinctOn) {
|
|
570
|
+
result = result.distinctOn(distinct.map((f) => import_kysely.sql.ref(`${model}.${f}`)));
|
|
571
|
+
} else {
|
|
572
|
+
throw new QueryError(`"distinct" is not supported by "${this.schema.provider.type}" provider`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
if (args.cursor) {
|
|
576
|
+
result = this.buildCursorFilter(model, result, args.cursor, args.orderBy, negateOrderBy);
|
|
577
|
+
}
|
|
578
|
+
return result;
|
|
579
|
+
}
|
|
563
580
|
buildFilter(eb, model, modelAlias, where) {
|
|
564
581
|
if (where === true || where === void 0) {
|
|
565
582
|
return this.true(eb);
|
|
@@ -597,6 +614,26 @@ var BaseCrudDialect = class {
|
|
|
597
614
|
}
|
|
598
615
|
return result;
|
|
599
616
|
}
|
|
617
|
+
buildCursorFilter(model, query, cursor, orderBy, negateOrderBy) {
|
|
618
|
+
const _orderBy = orderBy ?? makeDefaultOrderBy(this.schema, model);
|
|
619
|
+
const orderByItems = ensureArray(_orderBy).flatMap((obj) => Object.entries(obj));
|
|
620
|
+
const eb = (0, import_kysely.expressionBuilder)();
|
|
621
|
+
const cursorFilter = this.buildFilter(eb, model, model, cursor);
|
|
622
|
+
let result = query;
|
|
623
|
+
const filters = [];
|
|
624
|
+
for (let i = orderByItems.length - 1; i >= 0; i--) {
|
|
625
|
+
const andFilters = [];
|
|
626
|
+
for (let j = 0; j <= i; j++) {
|
|
627
|
+
const [field, order] = orderByItems[j];
|
|
628
|
+
const _order = negateOrderBy ? order === "asc" ? "desc" : "asc" : order;
|
|
629
|
+
const op = j === i ? _order === "asc" ? ">=" : "<=" : "=";
|
|
630
|
+
andFilters.push(eb(eb.ref(`${model}.${field}`), op, eb.selectFrom(model).select(`${model}.${field}`).where(cursorFilter)));
|
|
631
|
+
}
|
|
632
|
+
filters.push(eb.and(andFilters));
|
|
633
|
+
}
|
|
634
|
+
result = result.where((eb2) => eb2.or(filters));
|
|
635
|
+
return result;
|
|
636
|
+
}
|
|
600
637
|
isLogicalCombinator(key) {
|
|
601
638
|
return LOGICAL_COMBINATORS.includes(key);
|
|
602
639
|
}
|
|
@@ -1123,18 +1160,7 @@ var PostgresCrudDialect = class extends BaseCrudDialect {
|
|
|
1123
1160
|
let subQuery = this.buildSelectModel(eb, relationModel);
|
|
1124
1161
|
subQuery = this.buildSelectAllFields(relationModel, subQuery, typeof payload === "object" ? payload?.omit : void 0);
|
|
1125
1162
|
if (payload && typeof payload === "object") {
|
|
1126
|
-
|
|
1127
|
-
subQuery = subQuery.where((eb2) => this.buildFilter(eb2, relationModel, relationModel, payload.where));
|
|
1128
|
-
}
|
|
1129
|
-
const skip = payload.skip;
|
|
1130
|
-
let take = payload.take;
|
|
1131
|
-
let negateOrderBy = false;
|
|
1132
|
-
if (take !== void 0 && take < 0) {
|
|
1133
|
-
negateOrderBy = true;
|
|
1134
|
-
take = -take;
|
|
1135
|
-
}
|
|
1136
|
-
subQuery = this.buildSkipTake(subQuery, skip, take);
|
|
1137
|
-
subQuery = this.buildOrderBy(subQuery, relationModel, relationModel, payload.orderBy, skip !== void 0 || take !== void 0, negateOrderBy);
|
|
1163
|
+
subQuery = this.buildFilterSortTake(relationModel, payload, subQuery);
|
|
1138
1164
|
}
|
|
1139
1165
|
const m2m = getManyToManyRelation(this.schema, model, relationField);
|
|
1140
1166
|
if (m2m) {
|
|
@@ -1297,18 +1323,7 @@ var SqliteCrudDialect = class extends BaseCrudDialect {
|
|
|
1297
1323
|
let subQuery = this.buildSelectModel(eb, relationModel);
|
|
1298
1324
|
subQuery = this.buildSelectAllFields(relationModel, subQuery, typeof payload === "object" ? payload?.omit : void 0);
|
|
1299
1325
|
if (payload && typeof payload === "object") {
|
|
1300
|
-
|
|
1301
|
-
subQuery = subQuery.where((eb2) => this.buildFilter(eb2, relationModel, relationModel, payload.where));
|
|
1302
|
-
}
|
|
1303
|
-
const skip = payload.skip;
|
|
1304
|
-
let take = payload.take;
|
|
1305
|
-
let negateOrderBy = false;
|
|
1306
|
-
if (take !== void 0 && take < 0) {
|
|
1307
|
-
negateOrderBy = true;
|
|
1308
|
-
take = -take;
|
|
1309
|
-
}
|
|
1310
|
-
subQuery = this.buildSkipTake(subQuery, skip, take);
|
|
1311
|
-
subQuery = this.buildOrderBy(subQuery, relationModel, relationModel, payload.orderBy, skip !== void 0 || take !== void 0, negateOrderBy);
|
|
1326
|
+
subQuery = this.buildFilterSortTake(relationModel, payload, subQuery);
|
|
1312
1327
|
}
|
|
1313
1328
|
const m2m = getManyToManyRelation(this.schema, model, relationField);
|
|
1314
1329
|
if (m2m) {
|
|
@@ -2750,27 +2765,8 @@ var BaseOperationHandler = class {
|
|
|
2750
2765
|
}
|
|
2751
2766
|
async read(kysely, model, args) {
|
|
2752
2767
|
let query = this.dialect.buildSelectModel((0, import_kysely8.expressionBuilder)(), model);
|
|
2753
|
-
if (args
|
|
2754
|
-
query =
|
|
2755
|
-
}
|
|
2756
|
-
let negateOrderBy = false;
|
|
2757
|
-
const skip = args?.skip;
|
|
2758
|
-
let take = args?.take;
|
|
2759
|
-
if (take !== void 0 && take < 0) {
|
|
2760
|
-
negateOrderBy = true;
|
|
2761
|
-
take = -take;
|
|
2762
|
-
}
|
|
2763
|
-
query = this.dialect.buildSkipTake(query, skip, take);
|
|
2764
|
-
query = this.dialect.buildOrderBy(query, model, model, args?.orderBy, skip !== void 0 || take !== void 0, negateOrderBy);
|
|
2765
|
-
let inMemoryDistinct = void 0;
|
|
2766
|
-
if (args?.distinct) {
|
|
2767
|
-
const distinct = ensureArray(args.distinct);
|
|
2768
|
-
if (this.dialect.supportsDistinctOn) {
|
|
2769
|
-
query = query.distinctOn(distinct.map((f) => import_kysely8.sql.ref(`${model}.${f}`)));
|
|
2770
|
-
} else {
|
|
2771
|
-
inMemoryDistinct = distinct;
|
|
2772
|
-
query = distinct.reduce((acc, field) => acc.select((eb) => this.dialect.fieldRef(model, field, eb).as(`$distinct$${field}`)), query);
|
|
2773
|
-
}
|
|
2768
|
+
if (args) {
|
|
2769
|
+
query = this.dialect.buildFilterSortTake(model, args, query);
|
|
2774
2770
|
}
|
|
2775
2771
|
if (args && "select" in args && args.select) {
|
|
2776
2772
|
query = this.buildFieldSelection(model, query, args.select, model);
|
|
@@ -2780,9 +2776,6 @@ var BaseOperationHandler = class {
|
|
|
2780
2776
|
if (args && "include" in args && args.include) {
|
|
2781
2777
|
query = this.buildFieldSelection(model, query, args.include, model);
|
|
2782
2778
|
}
|
|
2783
|
-
if (args?.cursor) {
|
|
2784
|
-
query = this.buildCursorFilter(model, query, args.cursor, args.orderBy, negateOrderBy);
|
|
2785
|
-
}
|
|
2786
2779
|
query = query.modifyEnd(this.makeContextComment({
|
|
2787
2780
|
model,
|
|
2788
2781
|
operation: "read"
|
|
@@ -2803,21 +2796,6 @@ ${compiled.parameters.map((p) => (0, import_node_util.inspect)(p)).join("\n")}`;
|
|
|
2803
2796
|
}
|
|
2804
2797
|
throw new QueryError(message, err);
|
|
2805
2798
|
}
|
|
2806
|
-
if (inMemoryDistinct) {
|
|
2807
|
-
const distinctResult = [];
|
|
2808
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2809
|
-
for (const r of result) {
|
|
2810
|
-
const key = safeJSONStringify(inMemoryDistinct.map((f) => r[`$distinct$${f}`]));
|
|
2811
|
-
if (!seen.has(key)) {
|
|
2812
|
-
distinctResult.push(r);
|
|
2813
|
-
seen.add(key);
|
|
2814
|
-
}
|
|
2815
|
-
}
|
|
2816
|
-
result = distinctResult;
|
|
2817
|
-
for (const r of result) {
|
|
2818
|
-
Object.keys(r).filter((k) => k.startsWith("$distinct$")).forEach((k) => delete r[k]);
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
2799
|
return result;
|
|
2822
2800
|
}
|
|
2823
2801
|
async readUnique(kysely, model, args) {
|
|
@@ -2856,28 +2834,6 @@ ${compiled.parameters.map((p) => (0, import_node_util.inspect)(p)).join("\n")}`;
|
|
|
2856
2834
|
buildCountSelection(query, model, parentAlias, payload) {
|
|
2857
2835
|
return query.select((eb) => this.dialect.buildCountJson(model, eb, parentAlias, payload).as("_count"));
|
|
2858
2836
|
}
|
|
2859
|
-
buildCursorFilter(model, query, cursor, orderBy, negateOrderBy) {
|
|
2860
|
-
if (!orderBy) {
|
|
2861
|
-
orderBy = makeDefaultOrderBy(this.schema, model);
|
|
2862
|
-
}
|
|
2863
|
-
const orderByItems = ensureArray(orderBy).flatMap((obj) => Object.entries(obj));
|
|
2864
|
-
const eb = (0, import_kysely8.expressionBuilder)();
|
|
2865
|
-
const cursorFilter = this.dialect.buildFilter(eb, model, model, cursor);
|
|
2866
|
-
let result = query;
|
|
2867
|
-
const filters = [];
|
|
2868
|
-
for (let i = orderByItems.length - 1; i >= 0; i--) {
|
|
2869
|
-
const andFilters = [];
|
|
2870
|
-
for (let j = 0; j <= i; j++) {
|
|
2871
|
-
const [field, order] = orderByItems[j];
|
|
2872
|
-
const _order = negateOrderBy ? order === "asc" ? "desc" : "asc" : order;
|
|
2873
|
-
const op = j === i ? _order === "asc" ? ">=" : "<=" : "=";
|
|
2874
|
-
andFilters.push(eb(eb.ref(`${model}.${field}`), op, eb.selectFrom(model).select(`${model}.${field}`).where(cursorFilter)));
|
|
2875
|
-
}
|
|
2876
|
-
filters.push(eb.and(andFilters));
|
|
2877
|
-
}
|
|
2878
|
-
result = result.where((eb2) => eb2.or(filters));
|
|
2879
|
-
return result;
|
|
2880
|
-
}
|
|
2881
2837
|
async create(kysely, model, data, fromRelation, creatingForDelegate = false) {
|
|
2882
2838
|
const modelDef = this.requireModel(model);
|
|
2883
2839
|
if (modelDef.isDelegate && !creatingForDelegate) {
|
|
@@ -4910,25 +4866,28 @@ var InputValidator = class {
|
|
|
4910
4866
|
return import_zod.z.strictObject(fields);
|
|
4911
4867
|
}
|
|
4912
4868
|
makeRelationSelectIncludeSchema(fieldDef) {
|
|
4869
|
+
let objSchema = import_zod.z.strictObject({
|
|
4870
|
+
...fieldDef.array || fieldDef.optional ? {
|
|
4871
|
+
// to-many relations and optional to-one relations are filterable
|
|
4872
|
+
where: import_zod.z.lazy(() => this.makeWhereSchema(fieldDef.type, false)).optional()
|
|
4873
|
+
} : {},
|
|
4874
|
+
select: import_zod.z.lazy(() => this.makeSelectSchema(fieldDef.type)).optional(),
|
|
4875
|
+
include: import_zod.z.lazy(() => this.makeIncludeSchema(fieldDef.type)).optional(),
|
|
4876
|
+
omit: import_zod.z.lazy(() => this.makeOmitSchema(fieldDef.type)).optional(),
|
|
4877
|
+
...fieldDef.array ? {
|
|
4878
|
+
// to-many relations can be ordered, skipped, taken, and cursor-located
|
|
4879
|
+
orderBy: import_zod.z.lazy(() => this.makeOrderBySchema(fieldDef.type, true, false)).optional(),
|
|
4880
|
+
skip: this.makeSkipSchema().optional(),
|
|
4881
|
+
take: this.makeTakeSchema().optional(),
|
|
4882
|
+
cursor: this.makeCursorSchema(fieldDef.type).optional(),
|
|
4883
|
+
distinct: this.makeDistinctSchema(fieldDef.type).optional()
|
|
4884
|
+
} : {}
|
|
4885
|
+
});
|
|
4886
|
+
objSchema = this.refineForSelectIncludeMutuallyExclusive(objSchema);
|
|
4887
|
+
objSchema = this.refineForSelectOmitMutuallyExclusive(objSchema);
|
|
4913
4888
|
return import_zod.z.union([
|
|
4914
4889
|
import_zod.z.boolean(),
|
|
4915
|
-
|
|
4916
|
-
...fieldDef.array || fieldDef.optional ? {
|
|
4917
|
-
// to-many relations and optional to-one relations are filterable
|
|
4918
|
-
where: import_zod.z.lazy(() => this.makeWhereSchema(fieldDef.type, false)).optional()
|
|
4919
|
-
} : {},
|
|
4920
|
-
select: import_zod.z.lazy(() => this.makeSelectSchema(fieldDef.type)).optional(),
|
|
4921
|
-
include: import_zod.z.lazy(() => this.makeIncludeSchema(fieldDef.type)).optional(),
|
|
4922
|
-
omit: import_zod.z.lazy(() => this.makeOmitSchema(fieldDef.type)).optional(),
|
|
4923
|
-
...fieldDef.array ? {
|
|
4924
|
-
// to-many relations can be ordered, skipped, taken, and cursor-located
|
|
4925
|
-
orderBy: import_zod.z.lazy(() => this.makeOrderBySchema(fieldDef.type, true, false)).optional(),
|
|
4926
|
-
skip: this.makeSkipSchema().optional(),
|
|
4927
|
-
take: this.makeTakeSchema().optional(),
|
|
4928
|
-
cursor: this.makeCursorSchema(fieldDef.type).optional(),
|
|
4929
|
-
distinct: this.makeDistinctSchema(fieldDef.type).optional()
|
|
4930
|
-
} : {}
|
|
4931
|
-
})
|
|
4890
|
+
objSchema
|
|
4932
4891
|
]);
|
|
4933
4892
|
}
|
|
4934
4893
|
makeOmitSchema(model) {
|
|
@@ -5017,7 +4976,7 @@ var InputValidator = class {
|
|
|
5017
4976
|
// #region Create
|
|
5018
4977
|
makeCreateSchema(model) {
|
|
5019
4978
|
const dataSchema = this.makeCreateDataSchema(model, false);
|
|
5020
|
-
const schema = import_zod.z.
|
|
4979
|
+
const schema = import_zod.z.strictObject({
|
|
5021
4980
|
data: dataSchema,
|
|
5022
4981
|
select: this.makeSelectSchema(model).optional(),
|
|
5023
4982
|
include: this.makeIncludeSchema(model).optional(),
|
|
@@ -5030,10 +4989,10 @@ var InputValidator = class {
|
|
|
5030
4989
|
}
|
|
5031
4990
|
makeCreateManyAndReturnSchema(model) {
|
|
5032
4991
|
const base = this.makeCreateManyDataSchema(model, []);
|
|
5033
|
-
const result = base.
|
|
4992
|
+
const result = base.extend({
|
|
5034
4993
|
select: this.makeSelectSchema(model).optional(),
|
|
5035
4994
|
omit: this.makeOmitSchema(model).optional()
|
|
5036
|
-
})
|
|
4995
|
+
});
|
|
5037
4996
|
return this.refineForSelectOmitMutuallyExclusive(result).optional();
|
|
5038
4997
|
}
|
|
5039
4998
|
makeCreateDataSchema(model, canBeArray, withoutFields = [], withoutRelationFields = false) {
|
|
@@ -5198,13 +5157,13 @@ var InputValidator = class {
|
|
|
5198
5157
|
makeConnectOrCreateDataSchema(model, canBeArray, withoutFields) {
|
|
5199
5158
|
const whereSchema = this.makeWhereSchema(model, true);
|
|
5200
5159
|
const createSchema = this.makeCreateDataSchema(model, false, withoutFields);
|
|
5201
|
-
return this.orArray(import_zod.z.
|
|
5160
|
+
return this.orArray(import_zod.z.strictObject({
|
|
5202
5161
|
where: whereSchema,
|
|
5203
5162
|
create: createSchema
|
|
5204
5163
|
}), canBeArray);
|
|
5205
5164
|
}
|
|
5206
5165
|
makeCreateManyDataSchema(model, withoutFields) {
|
|
5207
|
-
return import_zod.z.
|
|
5166
|
+
return import_zod.z.strictObject({
|
|
5208
5167
|
data: this.makeCreateDataSchema(model, true, withoutFields, true),
|
|
5209
5168
|
skipDuplicates: import_zod.z.boolean().optional()
|
|
5210
5169
|
});
|
|
@@ -5212,7 +5171,7 @@ var InputValidator = class {
|
|
|
5212
5171
|
// #endregion
|
|
5213
5172
|
// #region Update
|
|
5214
5173
|
makeUpdateSchema(model) {
|
|
5215
|
-
const schema = import_zod.z.
|
|
5174
|
+
const schema = import_zod.z.strictObject({
|
|
5216
5175
|
where: this.makeWhereSchema(model, true),
|
|
5217
5176
|
data: this.makeUpdateDataSchema(model),
|
|
5218
5177
|
select: this.makeSelectSchema(model).optional(),
|
|
@@ -5222,7 +5181,7 @@ var InputValidator = class {
|
|
|
5222
5181
|
return this.refineForSelectIncludeMutuallyExclusive(schema);
|
|
5223
5182
|
}
|
|
5224
5183
|
makeUpdateManySchema(model) {
|
|
5225
|
-
return import_zod.z.
|
|
5184
|
+
return import_zod.z.strictObject({
|
|
5226
5185
|
where: this.makeWhereSchema(model, false).optional(),
|
|
5227
5186
|
data: this.makeUpdateDataSchema(model, [], true),
|
|
5228
5187
|
limit: import_zod.z.int().nonnegative().optional()
|
|
@@ -5230,14 +5189,14 @@ var InputValidator = class {
|
|
|
5230
5189
|
}
|
|
5231
5190
|
makeUpdateManyAndReturnSchema(model) {
|
|
5232
5191
|
const base = this.makeUpdateManySchema(model);
|
|
5233
|
-
const result = base.
|
|
5192
|
+
const result = base.extend({
|
|
5234
5193
|
select: this.makeSelectSchema(model).optional(),
|
|
5235
5194
|
omit: this.makeOmitSchema(model).optional()
|
|
5236
|
-
})
|
|
5195
|
+
});
|
|
5237
5196
|
return this.refineForSelectOmitMutuallyExclusive(result);
|
|
5238
5197
|
}
|
|
5239
5198
|
makeUpsertSchema(model) {
|
|
5240
|
-
const schema = import_zod.z.
|
|
5199
|
+
const schema = import_zod.z.strictObject({
|
|
5241
5200
|
where: this.makeWhereSchema(model, true),
|
|
5242
5201
|
create: this.makeCreateDataSchema(model, false),
|
|
5243
5202
|
update: this.makeUpdateDataSchema(model),
|
|
@@ -5322,7 +5281,7 @@ var InputValidator = class {
|
|
|
5322
5281
|
// #endregion
|
|
5323
5282
|
// #region Delete
|
|
5324
5283
|
makeDeleteSchema(model) {
|
|
5325
|
-
const schema = import_zod.z.
|
|
5284
|
+
const schema = import_zod.z.strictObject({
|
|
5326
5285
|
where: this.makeWhereSchema(model, true),
|
|
5327
5286
|
select: this.makeSelectSchema(model).optional(),
|
|
5328
5287
|
include: this.makeIncludeSchema(model).optional()
|
|
@@ -5350,7 +5309,7 @@ var InputValidator = class {
|
|
|
5350
5309
|
const modelDef = requireModel(this.schema, model);
|
|
5351
5310
|
return import_zod.z.union([
|
|
5352
5311
|
import_zod.z.literal(true),
|
|
5353
|
-
import_zod.z.
|
|
5312
|
+
import_zod.z.strictObject({
|
|
5354
5313
|
_all: import_zod.z.literal(true).optional(),
|
|
5355
5314
|
...Object.keys(modelDef.fields).reduce((acc, field) => {
|
|
5356
5315
|
acc[field] = import_zod.z.literal(true).optional();
|
|
@@ -5397,7 +5356,7 @@ var InputValidator = class {
|
|
|
5397
5356
|
makeGroupBySchema(model) {
|
|
5398
5357
|
const modelDef = requireModel(this.schema, model);
|
|
5399
5358
|
const nonRelationFields = Object.keys(modelDef.fields).filter((field) => !modelDef.fields[field]?.relation);
|
|
5400
|
-
let schema = import_zod.z.
|
|
5359
|
+
let schema = import_zod.z.strictObject({
|
|
5401
5360
|
where: this.makeWhereSchema(model, false).optional(),
|
|
5402
5361
|
orderBy: this.orArray(this.makeOrderBySchema(model, false, true), true).optional(),
|
|
5403
5362
|
by: this.orArray(import_zod.z.enum(nonRelationFields), true),
|
|
@@ -6443,6 +6402,9 @@ var SchemaDbPusher = class {
|
|
|
6443
6402
|
if (this.isAutoIncrement(fieldDef) && this.schema.provider.type === "postgresql") {
|
|
6444
6403
|
return "serial";
|
|
6445
6404
|
}
|
|
6405
|
+
if (this.isCustomType(fieldDef.type)) {
|
|
6406
|
+
return "jsonb";
|
|
6407
|
+
}
|
|
6446
6408
|
const type = fieldDef.type;
|
|
6447
6409
|
const result = (0, import_ts_pattern18.match)(type).with("String", () => "text").with("Boolean", () => "boolean").with("Int", () => "integer").with("Float", () => "real").with("BigInt", () => "bigint").with("Decimal", () => "decimal").with("DateTime", () => "timestamp").with("Bytes", () => this.schema.provider.type === "postgresql" ? "bytea" : "blob").with("Json", () => "jsonb").otherwise(() => {
|
|
6448
6410
|
throw new Error(`Unsupported field type: ${type}`);
|
|
@@ -6453,6 +6415,9 @@ var SchemaDbPusher = class {
|
|
|
6453
6415
|
return result;
|
|
6454
6416
|
}
|
|
6455
6417
|
}
|
|
6418
|
+
isCustomType(type) {
|
|
6419
|
+
return this.schema.typeDefs && Object.values(this.schema.typeDefs).some((def) => def.name === type);
|
|
6420
|
+
}
|
|
6456
6421
|
isAutoIncrement(fieldDef) {
|
|
6457
6422
|
return fieldDef.default && ExpressionUtils.isCall(fieldDef.default) && fieldDef.default.function === "autoincrement";
|
|
6458
6423
|
}
|
|
@@ -6903,7 +6868,7 @@ function createClientProxy(client) {
|
|
|
6903
6868
|
}
|
|
6904
6869
|
__name(createClientProxy, "createClientProxy");
|
|
6905
6870
|
function createModelCrudHandler(client, model, inputValidator, resultProcessor) {
|
|
6906
|
-
const createPromise = /* @__PURE__ */ __name((operation, args, handler, postProcess = false, throwIfNoResult = false) => {
|
|
6871
|
+
const createPromise = /* @__PURE__ */ __name((operation, nominalOperation, args, handler, postProcess = false, throwIfNoResult = false) => {
|
|
6907
6872
|
return createZenStackPromise(async (txClient) => {
|
|
6908
6873
|
let proceed = /* @__PURE__ */ __name(async (_args) => {
|
|
6909
6874
|
const _handler = txClient ? handler.withClient(txClient) : handler;
|
|
@@ -6929,7 +6894,7 @@ function createModelCrudHandler(client, model, inputValidator, resultProcessor)
|
|
|
6929
6894
|
proceed = /* @__PURE__ */ __name((_args) => onQuery({
|
|
6930
6895
|
client,
|
|
6931
6896
|
model,
|
|
6932
|
-
operation,
|
|
6897
|
+
operation: nominalOperation,
|
|
6933
6898
|
// reflect the latest override if provided
|
|
6934
6899
|
args: _args,
|
|
6935
6900
|
// ensure inner overrides are propagated to the previous proceed
|
|
@@ -6942,55 +6907,55 @@ function createModelCrudHandler(client, model, inputValidator, resultProcessor)
|
|
|
6942
6907
|
}, "createPromise");
|
|
6943
6908
|
return {
|
|
6944
6909
|
findUnique: /* @__PURE__ */ __name((args) => {
|
|
6945
|
-
return createPromise("findUnique", args, new FindOperationHandler(client, model, inputValidator), true);
|
|
6910
|
+
return createPromise("findUnique", "findUnique", args, new FindOperationHandler(client, model, inputValidator), true);
|
|
6946
6911
|
}, "findUnique"),
|
|
6947
6912
|
findUniqueOrThrow: /* @__PURE__ */ __name((args) => {
|
|
6948
|
-
return createPromise("findUnique", args, new FindOperationHandler(client, model, inputValidator), true, true);
|
|
6913
|
+
return createPromise("findUnique", "findUniqueOrThrow", args, new FindOperationHandler(client, model, inputValidator), true, true);
|
|
6949
6914
|
}, "findUniqueOrThrow"),
|
|
6950
6915
|
findFirst: /* @__PURE__ */ __name((args) => {
|
|
6951
|
-
return createPromise("findFirst", args, new FindOperationHandler(client, model, inputValidator), true);
|
|
6916
|
+
return createPromise("findFirst", "findFirst", args, new FindOperationHandler(client, model, inputValidator), true);
|
|
6952
6917
|
}, "findFirst"),
|
|
6953
6918
|
findFirstOrThrow: /* @__PURE__ */ __name((args) => {
|
|
6954
|
-
return createPromise("findFirst", args, new FindOperationHandler(client, model, inputValidator), true, true);
|
|
6919
|
+
return createPromise("findFirst", "findFirstOrThrow", args, new FindOperationHandler(client, model, inputValidator), true, true);
|
|
6955
6920
|
}, "findFirstOrThrow"),
|
|
6956
6921
|
findMany: /* @__PURE__ */ __name((args) => {
|
|
6957
|
-
return createPromise("findMany", args, new FindOperationHandler(client, model, inputValidator), true);
|
|
6922
|
+
return createPromise("findMany", "findMany", args, new FindOperationHandler(client, model, inputValidator), true);
|
|
6958
6923
|
}, "findMany"),
|
|
6959
6924
|
create: /* @__PURE__ */ __name((args) => {
|
|
6960
|
-
return createPromise("create", args, new CreateOperationHandler(client, model, inputValidator), true);
|
|
6925
|
+
return createPromise("create", "create", args, new CreateOperationHandler(client, model, inputValidator), true);
|
|
6961
6926
|
}, "create"),
|
|
6962
6927
|
createMany: /* @__PURE__ */ __name((args) => {
|
|
6963
|
-
return createPromise("createMany", args, new CreateOperationHandler(client, model, inputValidator), false);
|
|
6928
|
+
return createPromise("createMany", "createMany", args, new CreateOperationHandler(client, model, inputValidator), false);
|
|
6964
6929
|
}, "createMany"),
|
|
6965
6930
|
createManyAndReturn: /* @__PURE__ */ __name((args) => {
|
|
6966
|
-
return createPromise("createManyAndReturn", args, new CreateOperationHandler(client, model, inputValidator), true);
|
|
6931
|
+
return createPromise("createManyAndReturn", "createManyAndReturn", args, new CreateOperationHandler(client, model, inputValidator), true);
|
|
6967
6932
|
}, "createManyAndReturn"),
|
|
6968
6933
|
update: /* @__PURE__ */ __name((args) => {
|
|
6969
|
-
return createPromise("update", args, new UpdateOperationHandler(client, model, inputValidator), true);
|
|
6934
|
+
return createPromise("update", "update", args, new UpdateOperationHandler(client, model, inputValidator), true);
|
|
6970
6935
|
}, "update"),
|
|
6971
6936
|
updateMany: /* @__PURE__ */ __name((args) => {
|
|
6972
|
-
return createPromise("updateMany", args, new UpdateOperationHandler(client, model, inputValidator), false);
|
|
6937
|
+
return createPromise("updateMany", "updateMany", args, new UpdateOperationHandler(client, model, inputValidator), false);
|
|
6973
6938
|
}, "updateMany"),
|
|
6974
6939
|
updateManyAndReturn: /* @__PURE__ */ __name((args) => {
|
|
6975
|
-
return createPromise("updateManyAndReturn", args, new UpdateOperationHandler(client, model, inputValidator), true);
|
|
6940
|
+
return createPromise("updateManyAndReturn", "updateManyAndReturn", args, new UpdateOperationHandler(client, model, inputValidator), true);
|
|
6976
6941
|
}, "updateManyAndReturn"),
|
|
6977
6942
|
upsert: /* @__PURE__ */ __name((args) => {
|
|
6978
|
-
return createPromise("upsert", args, new UpdateOperationHandler(client, model, inputValidator), true);
|
|
6943
|
+
return createPromise("upsert", "upsert", args, new UpdateOperationHandler(client, model, inputValidator), true);
|
|
6979
6944
|
}, "upsert"),
|
|
6980
6945
|
delete: /* @__PURE__ */ __name((args) => {
|
|
6981
|
-
return createPromise("delete", args, new DeleteOperationHandler(client, model, inputValidator), true);
|
|
6946
|
+
return createPromise("delete", "delete", args, new DeleteOperationHandler(client, model, inputValidator), true);
|
|
6982
6947
|
}, "delete"),
|
|
6983
6948
|
deleteMany: /* @__PURE__ */ __name((args) => {
|
|
6984
|
-
return createPromise("deleteMany", args, new DeleteOperationHandler(client, model, inputValidator), false);
|
|
6949
|
+
return createPromise("deleteMany", "deleteMany", args, new DeleteOperationHandler(client, model, inputValidator), false);
|
|
6985
6950
|
}, "deleteMany"),
|
|
6986
6951
|
count: /* @__PURE__ */ __name((args) => {
|
|
6987
|
-
return createPromise("count", args, new CountOperationHandler(client, model, inputValidator), false);
|
|
6952
|
+
return createPromise("count", "count", args, new CountOperationHandler(client, model, inputValidator), false);
|
|
6988
6953
|
}, "count"),
|
|
6989
6954
|
aggregate: /* @__PURE__ */ __name((args) => {
|
|
6990
|
-
return createPromise("aggregate", args, new AggregateOperationHandler(client, model, inputValidator), false);
|
|
6955
|
+
return createPromise("aggregate", "aggregate", args, new AggregateOperationHandler(client, model, inputValidator), false);
|
|
6991
6956
|
}, "aggregate"),
|
|
6992
6957
|
groupBy: /* @__PURE__ */ __name((args) => {
|
|
6993
|
-
return createPromise("groupBy", args, new GroupByOperationHandler(client, model, inputValidator), true);
|
|
6958
|
+
return createPromise("groupBy", "groupBy", args, new GroupByOperationHandler(client, model, inputValidator), true);
|
|
6994
6959
|
}, "groupBy")
|
|
6995
6960
|
};
|
|
6996
6961
|
}
|