@danielhritcu/zenstack-orm 3.5.17 → 3.5.18
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.map +1 -1
- package/dist/index.d.cts +27 -23
- package/dist/index.d.ts +27 -23
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -120,6 +120,10 @@ type JsonObject = {
|
|
|
120
120
|
};
|
|
121
121
|
type JsonArray = ReadonlyArray<JsonValue | null>;
|
|
122
122
|
type JsonNullValues = DbNull | JsonNull | AnyNull;
|
|
123
|
+
declare const __zenstackBrand: unique symbol;
|
|
124
|
+
type Brand<T extends string> = string & {
|
|
125
|
+
[__zenstackBrand]: T;
|
|
126
|
+
};
|
|
123
127
|
declare class DbNullClass {
|
|
124
128
|
private __brand;
|
|
125
129
|
}
|
|
@@ -1201,7 +1205,7 @@ type WhereInput<Schema extends SchemaDef, Model extends GetModels<Schema>, Optio
|
|
|
1201
1205
|
OR?: WhereInput<Schema, Model, Options, ScalarOnly>[];
|
|
1202
1206
|
NOT?: OrArray<WhereInput<Schema, Model, Options, ScalarOnly>>;
|
|
1203
1207
|
};
|
|
1204
|
-
type FieldFilter<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, Options extends QueryOptions<Schema>, WithAggregations extends boolean, AllowedKinds extends FilterKind = GetSlicedFilterKindsForField<Schema, Model, Field, Options>> = Field extends RelationFields<Schema, Model> ? RelationFilter<Schema, Model, Field, Options, AllowedKinds> : FieldIsArray<Schema, Model, Field> extends true ? ArrayFilter<Schema, GetModelFieldType<Schema, Model, Field>, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetEnums<Schema> ? EnumFilter<Schema, GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetModelFieldType<Schema, Model, Field>, FieldIsArray<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, AllowedKinds> : PrimitiveFilter<GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds>;
|
|
1208
|
+
type FieldFilter<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, Options extends QueryOptions<Schema>, WithAggregations extends boolean, AllowedKinds extends FilterKind = GetSlicedFilterKindsForField<Schema, Model, Field, Options>> = Field extends RelationFields<Schema, Model> ? RelationFilter<Schema, Model, Field, Options, AllowedKinds> : FieldIsArray<Schema, Model, Field> extends true ? ArrayFilter<Schema, GetModelFieldType<Schema, Model, Field>, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetEnums<Schema> ? EnumFilter<Schema, GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetModelFieldType<Schema, Model, Field>, FieldIsArray<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, AllowedKinds> : PrimitiveFilter<MapModelFieldType<Schema, Model, Field>, GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds>;
|
|
1205
1209
|
type EnumFilter<Schema extends SchemaDef, T extends GetEnums<Schema>, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<keyof GetEnum<Schema, T>, Nullable> : never) | (('Equality' extends AllowedKinds ? {
|
|
1206
1210
|
/**
|
|
1207
1211
|
* Checks for equality with the specified enum value.
|
|
@@ -1258,7 +1262,7 @@ type ArrayFilter<Schema extends SchemaDef, Type extends string, AllowedKinds ext
|
|
|
1258
1262
|
isEmpty?: boolean;
|
|
1259
1263
|
} : {});
|
|
1260
1264
|
type MapScalarType<Schema extends SchemaDef, Type extends string> = Type extends GetEnums<Schema> ? keyof GetEnum<Schema, Type> : MapBaseType$1<Type>;
|
|
1261
|
-
type PrimitiveFilter<T extends string, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = T extends 'String' ? StringFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'Int' | 'Float' | 'Decimal' | 'BigInt' ? NumberFilter<T, Nullable, WithAggregations, AllowedKinds> : T extends 'Boolean' ? BooleanFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'DateTime' ? DateTimeFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'Bytes' ? BytesFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'Json' ? JsonFilter<AllowedKinds> : never;
|
|
1265
|
+
type PrimitiveFilter<DataType, T extends string, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = T extends 'String' ? StringFilter<Nullable, WithAggregations, AllowedKinds, DataType & string> : T extends 'Int' | 'Float' | 'Decimal' | 'BigInt' ? NumberFilter<T, Nullable, WithAggregations, AllowedKinds, DataType & (number | bigint)> : T extends 'Boolean' ? BooleanFilter<Nullable, WithAggregations, AllowedKinds, DataType & boolean> : T extends 'DateTime' ? DateTimeFilter<Nullable, WithAggregations, AllowedKinds, DataType & (Date | string)> : T extends 'Bytes' ? BytesFilter<Nullable, WithAggregations, AllowedKinds, DataType & (Uint8Array | Buffer)> : T extends 'Json' ? JsonFilter<AllowedKinds> : never;
|
|
1262
1266
|
type CommonPrimitiveFilter<DataType, T extends BuiltinType, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = ('Equality' extends AllowedKinds ? {
|
|
1263
1267
|
/**
|
|
1264
1268
|
* Checks for equality with the specified value.
|
|
@@ -1297,9 +1301,9 @@ type CommonPrimitiveFilter<DataType, T extends BuiltinType, Nullable extends boo
|
|
|
1297
1301
|
/**
|
|
1298
1302
|
* Builds a negated filter.
|
|
1299
1303
|
*/
|
|
1300
|
-
not?: PrimitiveFilter<T, Nullable, WithAggregations, AllowedKinds>;
|
|
1304
|
+
not?: PrimitiveFilter<DataType, T, Nullable, WithAggregations, AllowedKinds>;
|
|
1301
1305
|
};
|
|
1302
|
-
type StringFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1306
|
+
type StringFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends string = string> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (CommonPrimitiveFilter<DataType, 'String', Nullable, WithAggregations, AllowedKinds> & ('Like' extends AllowedKinds ? {
|
|
1303
1307
|
/**
|
|
1304
1308
|
* Checks if the string contains the specified substring.
|
|
1305
1309
|
*/
|
|
@@ -1330,7 +1334,7 @@ type StringFilter<Nullable extends boolean, WithAggregations extends boolean, Al
|
|
|
1330
1334
|
*/
|
|
1331
1335
|
_max?: StringFilter<false, false, AllowedKinds>;
|
|
1332
1336
|
} : {}));
|
|
1333
|
-
type NumberFilter<T extends 'Int' | 'Float' | 'Decimal' | 'BigInt', Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1337
|
+
type NumberFilter<T extends 'Int' | 'Float' | 'Decimal' | 'BigInt', Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends number | bigint = number | bigint> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (CommonPrimitiveFilter<DataType, T, Nullable, WithAggregations, AllowedKinds> & (WithAggregations extends true ? {
|
|
1334
1338
|
/**
|
|
1335
1339
|
* Filters against the count of records.
|
|
1336
1340
|
*/
|
|
@@ -1338,21 +1342,21 @@ type NumberFilter<T extends 'Int' | 'Float' | 'Decimal' | 'BigInt', Nullable ext
|
|
|
1338
1342
|
/**
|
|
1339
1343
|
* Filters against the average value.
|
|
1340
1344
|
*/
|
|
1341
|
-
_avg?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1345
|
+
_avg?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1342
1346
|
/**
|
|
1343
1347
|
* Filters against the sum value.
|
|
1344
1348
|
*/
|
|
1345
|
-
_sum?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1349
|
+
_sum?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1346
1350
|
/**
|
|
1347
1351
|
* Filters against the minimum value.
|
|
1348
1352
|
*/
|
|
1349
|
-
_min?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1353
|
+
_min?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1350
1354
|
/**
|
|
1351
1355
|
* Filters against the maximum value.
|
|
1352
1356
|
*/
|
|
1353
|
-
_max?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1357
|
+
_max?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1354
1358
|
} : {}));
|
|
1355
|
-
type DateTimeFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1359
|
+
type DateTimeFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends Date | string = Date | string> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (CommonPrimitiveFilter<DataType, 'DateTime', Nullable, WithAggregations, AllowedKinds> & (WithAggregations extends true ? {
|
|
1356
1360
|
/**
|
|
1357
1361
|
* Filters against the count of records.
|
|
1358
1362
|
*/
|
|
@@ -1366,24 +1370,24 @@ type DateTimeFilter<Nullable extends boolean, WithAggregations extends boolean,
|
|
|
1366
1370
|
*/
|
|
1367
1371
|
_max?: DateTimeFilter<false, false, AllowedKinds>;
|
|
1368
1372
|
} : {}));
|
|
1369
|
-
type BytesFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1373
|
+
type BytesFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends Uint8Array | Buffer = Uint8Array | Buffer> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (('Equality' extends AllowedKinds ? {
|
|
1370
1374
|
/**
|
|
1371
1375
|
* Checks for equality with the specified value.
|
|
1372
1376
|
*/
|
|
1373
|
-
equals?: NullableIf<
|
|
1377
|
+
equals?: NullableIf<DataType, Nullable>;
|
|
1374
1378
|
/**
|
|
1375
1379
|
* Checks if the value is in the specified list of values.
|
|
1376
1380
|
*/
|
|
1377
|
-
in?:
|
|
1381
|
+
in?: DataType[];
|
|
1378
1382
|
/**
|
|
1379
1383
|
* Checks if the value is not in the specified list of values.
|
|
1380
1384
|
*/
|
|
1381
|
-
notIn?:
|
|
1385
|
+
notIn?: DataType[];
|
|
1382
1386
|
} : {}) & {
|
|
1383
1387
|
/**
|
|
1384
1388
|
* Builds a negated filter.
|
|
1385
1389
|
*/
|
|
1386
|
-
not?: BytesFilter<Nullable, WithAggregations, AllowedKinds>;
|
|
1390
|
+
not?: BytesFilter<Nullable, WithAggregations, AllowedKinds, DataType>;
|
|
1387
1391
|
} & (WithAggregations extends true ? {
|
|
1388
1392
|
/**
|
|
1389
1393
|
* Filters against the count of records.
|
|
@@ -1398,16 +1402,16 @@ type BytesFilter<Nullable extends boolean, WithAggregations extends boolean, All
|
|
|
1398
1402
|
*/
|
|
1399
1403
|
_max?: BytesFilter<false, false, AllowedKinds>;
|
|
1400
1404
|
} : {}));
|
|
1401
|
-
type BooleanFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1405
|
+
type BooleanFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends boolean = boolean> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (('Equality' extends AllowedKinds ? {
|
|
1402
1406
|
/**
|
|
1403
1407
|
* Checks for equality with the specified value.
|
|
1404
1408
|
*/
|
|
1405
|
-
equals?: NullableIf<
|
|
1409
|
+
equals?: NullableIf<DataType, Nullable>;
|
|
1406
1410
|
} : {}) & {
|
|
1407
1411
|
/**
|
|
1408
1412
|
* Builds a negated filter.
|
|
1409
1413
|
*/
|
|
1410
|
-
not?: BooleanFilter<Nullable, WithAggregations, AllowedKinds>;
|
|
1414
|
+
not?: BooleanFilter<Nullable, WithAggregations, AllowedKinds, DataType>;
|
|
1411
1415
|
} & (WithAggregations extends true ? {
|
|
1412
1416
|
/**
|
|
1413
1417
|
* Filters against the count of records.
|
|
@@ -1477,7 +1481,7 @@ type NonArrayTypedJsonFilter<Schema extends SchemaDef, TypeDefName extends GetTy
|
|
|
1477
1481
|
isNot?: TypedJsonFieldsFilter<Schema, TypeDefName, AllowedKinds>;
|
|
1478
1482
|
} | TypedJsonFieldsFilter<Schema, TypeDefName, AllowedKinds>;
|
|
1479
1483
|
type TypedJsonFieldsFilter<Schema extends SchemaDef, TypeDefName extends GetTypeDefs<Schema>, AllowedKinds extends FilterKind> = {
|
|
1480
|
-
[Key in GetTypeDefFields<Schema, TypeDefName>]?: GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsArray<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, AllowedKinds> : TypeDefFieldIsArray<Schema, TypeDefName, Key> extends true ? ArrayFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, AllowedKinds> : GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetEnums<Schema> ? EnumFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds> : PrimitiveFilter<GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds>;
|
|
1484
|
+
[Key in GetTypeDefFields<Schema, TypeDefName>]?: GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsArray<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, AllowedKinds> : TypeDefFieldIsArray<Schema, TypeDefName, Key> extends true ? ArrayFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, AllowedKinds> : GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetEnums<Schema> ? EnumFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds> : PrimitiveFilter<MapFieldDefType<Schema, GetTypeDefField<Schema, TypeDefName, Key>>, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds>;
|
|
1481
1485
|
};
|
|
1482
1486
|
type SortOrder = 'asc' | 'desc';
|
|
1483
1487
|
type NullsOrder = 'first' | 'last';
|
|
@@ -1523,8 +1527,8 @@ type OrderBy<Schema extends SchemaDef, Model extends GetModels<Schema>, WithRela
|
|
|
1523
1527
|
_sum?: SumAvgInput<Schema, Model, SortOrder>;
|
|
1524
1528
|
}) : {});
|
|
1525
1529
|
type WhereUniqueInput<Schema extends SchemaDef, Model extends GetModels<Schema>, Options extends QueryOptions<Schema>> = AtLeast<{
|
|
1526
|
-
[Key in keyof GetModel<Schema, Model>['uniqueFields']]?: GetModel<Schema, Model>['uniqueFields'][Key] extends Pick<FieldDef, 'type'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key]> : {
|
|
1527
|
-
[Key1 in keyof GetModel<Schema, Model>['uniqueFields'][Key]]: GetModel<Schema, Model>['uniqueFields'][Key][Key1] extends Pick<FieldDef, 'type'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key][Key1]> : never;
|
|
1530
|
+
[Key in keyof GetModel<Schema, Model>['uniqueFields']]?: GetModel<Schema, Model>['uniqueFields'][Key] extends Pick<FieldDef, 'type' | 'brand'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key]> : {
|
|
1531
|
+
[Key1 in keyof GetModel<Schema, Model>['uniqueFields'][Key]]: GetModel<Schema, Model>['uniqueFields'][Key][Key1] extends Pick<FieldDef, 'type' | 'brand'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key][Key1]> : never;
|
|
1528
1532
|
};
|
|
1529
1533
|
} & WhereInput<Schema, Model, Options>, Extract<keyof GetModel<Schema, Model>['uniqueFields'], string>>;
|
|
1530
1534
|
type OmitInput<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
@@ -1589,7 +1593,7 @@ type ToOneRelationFilter<Schema extends SchemaDef, Model extends GetModels<Schem
|
|
|
1589
1593
|
}, ModelFieldIsOptional<Schema, Model, Field>>;
|
|
1590
1594
|
type RelationFilter<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends RelationFields<Schema, Model>, Options extends QueryOptions<Schema>, AllowedKinds extends FilterKind> = 'Relation' extends AllowedKinds ? FieldIsArray<Schema, Model, Field> extends true ? ToManyRelationFilter<Schema, Model, Field, Options> : ToOneRelationFilter<Schema, Model, Field, Options> : never;
|
|
1591
1595
|
type MapModelFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = MapFieldDefType<Schema, GetModelField<Schema, Model, Field>>;
|
|
1592
|
-
type MapFieldDefType<Schema extends SchemaDef, T extends Pick<FieldDef, 'type' | 'optional' | 'array'
|
|
1596
|
+
type MapFieldDefType<Schema extends SchemaDef, T extends Pick<FieldDef, 'type' | 'optional' | 'array'> & globalThis.Partial<Pick<FieldDef, 'brand'>>, IsPartial extends boolean = false> = WrapType<T['brand'] extends string ? Brand<T['brand']> : T['type'] extends GetEnums<Schema> ? keyof GetEnum<Schema, T['type']> : T['type'] extends GetTypeDefs<Schema> ? TypeDefResult<Schema, T['type'], IsPartial> & Record<string, unknown> : MapBaseType$1<T['type']>, T['optional'], T['array']>;
|
|
1593
1597
|
type OptionalFieldsForCreate<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof {
|
|
1594
1598
|
[Key in GetModelFields<Schema, Model> as ModelFieldIsOptional<Schema, Model, Key> extends true ? Key : FieldHasDefault<Schema, Model, Key> extends true ? Key : FieldIsArray<Schema, Model, Key> extends true ? Key : GetModelField<Schema, Model, Key>['updatedAt'] extends true | UpdatedAtInfo ? Key : never]: GetModelField<Schema, Model, Key>;
|
|
1595
1599
|
};
|
|
@@ -3482,4 +3486,4 @@ declare namespace schemaUtils {
|
|
|
3482
3486
|
export { schemaUtils_ExpressionVisitor as ExpressionVisitor, schemaUtils_MatchingExpressionVisitor as MatchingExpressionVisitor, type schemaUtils_VisitResult as VisitResult };
|
|
3483
3487
|
}
|
|
3484
3488
|
|
|
3485
|
-
export { type AfterEntityMutationCallback, type AggregateArgs, type AggregateResult, AllCrudOperations, type AllModelOperations, AllReadOperations, AnyNull, AnyNullClass, type AnyPlugin, type AuthType, BaseCrudDialect, type BatchResult, type BeforeEntityMutationCallback, type BooleanFilter, type BytesFilter, CRUD, CRUD_EXT, type ClientConstructor, type ClientContract, type ClientOptions, type ComputedFieldsOptions, CoreCreateOperations, CoreCrudOperations, CoreDeleteOperations, CoreReadOperations, CoreUpdateOperations, CoreWriteOperations, type CountArgs, type CountResult, type CreateArgs, type CreateInput, type CreateManyAndReturnArgs, type CreateManyArgs, type CreateManyInput, type DateTimeFilter, DbNull, DbNullClass, type DefaultModelResult, type DefaultWhereConfig, type DeleteArgs, type DeleteManyArgs, type EntityMutationHooksDef, type ExistsArgs, type ExtClientMembersBase, type ExtQueryArgsBase, type ExtResultBase, type ExtResultInferenceArgs, type ExtResultSelectOmitFields, type ExtractExtResult, type FilterKind, type FindArgs, type FindFirstArgs, type FindManyArgs, type FindUniqueArgs, type GetAllIncludedOperations, type GetIncludedOperations, type GetProcedure, type GetProcedureNames, type GetProcedureParams, type GetQueryOptions, type GetSlicedFilterKindsForField, type GetSlicedModels, type GetSlicedOperations, type GetSlicedProcedures, type GroupByArgs, type GroupByResult, type HasComputedFields, type HasProcedures, type IncludeInput, InputValidator, type JsonArray, type JsonFilter, JsonNull, JsonNullClass, type JsonNullValues, type JsonObject, type JsonValue, kyselyUtils as KyselyUtils, LOGICAL_COMBINATORS, type MapModelFieldType, type ModelAllowsCreate, type ModelHasRequiredUnsupportedField, type ModelOperations, type ModelResult, type ModelSlicingOptions, type NullsOrder, type NumberFilter, ORMError, ORMErrorReason, type OmitConfig, type OmitInput, type OnKyselyQueryArgs, type OnKyselyQueryCallback, type OnProcedureHookContext, type OperationsRequiringCreate, type OrderBy, type PaginatedCursor, type PaginatedOffset, type PluginAfterEntityMutationArgs, type PluginBeforeEntityMutationArgs, type ProcedureEnvelope, type ProcedureFunc, type ProcedureHandlerFunc, type ProcedureOperations, type ProceduresOptions, type ProceedKyselyQueryFunction, type QueryOptions, queryUtils as QueryUtils, RejectedByPolicyReason, type RuntimePlugin, type SchemaExtResult, schemaUtils as SchemaUtils, type SearchFieldMap, type SearchMode, type SearchPayload, type SearchStrategy, type SelectAwareExtResult, type SelectIncludeOmit, type SelectInput, type SelectSubset, type SimplifiedPlainResult, type SimplifiedResult, type SlicingOptions, type SortOrder, type StringFilter, type Subset, type ToKysely, type TransactionClientContract, TransactionIsolationLevel, type TypeDefResult, type TypedJsonFilter, type UpdateArgs, type UpdateInput, type UpdateManyAndReturnArgs, type UpdateManyArgs, type UpsertArgs, type WhereInput, type WhereUniqueInput, ZENSTACK_QUERY_KIND_SYMBOL, ZENSTACK_QUERY_SYMBOL, type ZModelFunction, type ZModelFunctionContext, ZenStackClient, type ZenStackPromise, type ZenStackQueryKind, createQuerySchemaFactory, definePlugin, getCrudDialect };
|
|
3489
|
+
export { type AfterEntityMutationCallback, type AggregateArgs, type AggregateResult, AllCrudOperations, type AllModelOperations, AllReadOperations, AnyNull, AnyNullClass, type AnyPlugin, type AuthType, BaseCrudDialect, type BatchResult, type BeforeEntityMutationCallback, type BooleanFilter, type Brand, type BytesFilter, CRUD, CRUD_EXT, type ClientConstructor, type ClientContract, type ClientOptions, type ComputedFieldsOptions, CoreCreateOperations, CoreCrudOperations, CoreDeleteOperations, CoreReadOperations, CoreUpdateOperations, CoreWriteOperations, type CountArgs, type CountResult, type CreateArgs, type CreateInput, type CreateManyAndReturnArgs, type CreateManyArgs, type CreateManyInput, type DateTimeFilter, DbNull, DbNullClass, type DefaultModelResult, type DefaultWhereConfig, type DeleteArgs, type DeleteManyArgs, type EntityMutationHooksDef, type ExistsArgs, type ExtClientMembersBase, type ExtQueryArgsBase, type ExtResultBase, type ExtResultInferenceArgs, type ExtResultSelectOmitFields, type ExtractExtResult, type FilterKind, type FindArgs, type FindFirstArgs, type FindManyArgs, type FindUniqueArgs, type GetAllIncludedOperations, type GetIncludedOperations, type GetProcedure, type GetProcedureNames, type GetProcedureParams, type GetQueryOptions, type GetSlicedFilterKindsForField, type GetSlicedModels, type GetSlicedOperations, type GetSlicedProcedures, type GroupByArgs, type GroupByResult, type HasComputedFields, type HasProcedures, type IncludeInput, InputValidator, type JsonArray, type JsonFilter, JsonNull, JsonNullClass, type JsonNullValues, type JsonObject, type JsonValue, kyselyUtils as KyselyUtils, LOGICAL_COMBINATORS, type MapModelFieldType, type ModelAllowsCreate, type ModelHasRequiredUnsupportedField, type ModelOperations, type ModelResult, type ModelSlicingOptions, type NullsOrder, type NumberFilter, ORMError, ORMErrorReason, type OmitConfig, type OmitInput, type OnKyselyQueryArgs, type OnKyselyQueryCallback, type OnProcedureHookContext, type OperationsRequiringCreate, type OrderBy, type PaginatedCursor, type PaginatedOffset, type PluginAfterEntityMutationArgs, type PluginBeforeEntityMutationArgs, type ProcedureEnvelope, type ProcedureFunc, type ProcedureHandlerFunc, type ProcedureOperations, type ProceduresOptions, type ProceedKyselyQueryFunction, type QueryOptions, queryUtils as QueryUtils, RejectedByPolicyReason, type RuntimePlugin, type SchemaExtResult, schemaUtils as SchemaUtils, type SearchFieldMap, type SearchMode, type SearchPayload, type SearchStrategy, type SelectAwareExtResult, type SelectIncludeOmit, type SelectInput, type SelectSubset, type SimplifiedPlainResult, type SimplifiedResult, type SlicingOptions, type SortOrder, type StringFilter, type Subset, type ToKysely, type TransactionClientContract, TransactionIsolationLevel, type TypeDefResult, type TypedJsonFilter, type UpdateArgs, type UpdateInput, type UpdateManyAndReturnArgs, type UpdateManyArgs, type UpsertArgs, type WhereInput, type WhereUniqueInput, ZENSTACK_QUERY_KIND_SYMBOL, ZENSTACK_QUERY_SYMBOL, type ZModelFunction, type ZModelFunctionContext, ZenStackClient, type ZenStackPromise, type ZenStackQueryKind, createQuerySchemaFactory, definePlugin, getCrudDialect };
|
package/dist/index.d.ts
CHANGED
|
@@ -120,6 +120,10 @@ type JsonObject = {
|
|
|
120
120
|
};
|
|
121
121
|
type JsonArray = ReadonlyArray<JsonValue | null>;
|
|
122
122
|
type JsonNullValues = DbNull | JsonNull | AnyNull;
|
|
123
|
+
declare const __zenstackBrand: unique symbol;
|
|
124
|
+
type Brand<T extends string> = string & {
|
|
125
|
+
[__zenstackBrand]: T;
|
|
126
|
+
};
|
|
123
127
|
declare class DbNullClass {
|
|
124
128
|
private __brand;
|
|
125
129
|
}
|
|
@@ -1201,7 +1205,7 @@ type WhereInput<Schema extends SchemaDef, Model extends GetModels<Schema>, Optio
|
|
|
1201
1205
|
OR?: WhereInput<Schema, Model, Options, ScalarOnly>[];
|
|
1202
1206
|
NOT?: OrArray<WhereInput<Schema, Model, Options, ScalarOnly>>;
|
|
1203
1207
|
};
|
|
1204
|
-
type FieldFilter<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, Options extends QueryOptions<Schema>, WithAggregations extends boolean, AllowedKinds extends FilterKind = GetSlicedFilterKindsForField<Schema, Model, Field, Options>> = Field extends RelationFields<Schema, Model> ? RelationFilter<Schema, Model, Field, Options, AllowedKinds> : FieldIsArray<Schema, Model, Field> extends true ? ArrayFilter<Schema, GetModelFieldType<Schema, Model, Field>, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetEnums<Schema> ? EnumFilter<Schema, GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetModelFieldType<Schema, Model, Field>, FieldIsArray<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, AllowedKinds> : PrimitiveFilter<GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds>;
|
|
1208
|
+
type FieldFilter<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>, Options extends QueryOptions<Schema>, WithAggregations extends boolean, AllowedKinds extends FilterKind = GetSlicedFilterKindsForField<Schema, Model, Field, Options>> = Field extends RelationFields<Schema, Model> ? RelationFilter<Schema, Model, Field, Options, AllowedKinds> : FieldIsArray<Schema, Model, Field> extends true ? ArrayFilter<Schema, GetModelFieldType<Schema, Model, Field>, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetEnums<Schema> ? EnumFilter<Schema, GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds> : GetModelFieldType<Schema, Model, Field> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetModelFieldType<Schema, Model, Field>, FieldIsArray<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, AllowedKinds> : PrimitiveFilter<MapModelFieldType<Schema, Model, Field>, GetModelFieldType<Schema, Model, Field>, ModelFieldIsOptional<Schema, Model, Field>, WithAggregations, AllowedKinds>;
|
|
1205
1209
|
type EnumFilter<Schema extends SchemaDef, T extends GetEnums<Schema>, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<keyof GetEnum<Schema, T>, Nullable> : never) | (('Equality' extends AllowedKinds ? {
|
|
1206
1210
|
/**
|
|
1207
1211
|
* Checks for equality with the specified enum value.
|
|
@@ -1258,7 +1262,7 @@ type ArrayFilter<Schema extends SchemaDef, Type extends string, AllowedKinds ext
|
|
|
1258
1262
|
isEmpty?: boolean;
|
|
1259
1263
|
} : {});
|
|
1260
1264
|
type MapScalarType<Schema extends SchemaDef, Type extends string> = Type extends GetEnums<Schema> ? keyof GetEnum<Schema, Type> : MapBaseType$1<Type>;
|
|
1261
|
-
type PrimitiveFilter<T extends string, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = T extends 'String' ? StringFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'Int' | 'Float' | 'Decimal' | 'BigInt' ? NumberFilter<T, Nullable, WithAggregations, AllowedKinds> : T extends 'Boolean' ? BooleanFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'DateTime' ? DateTimeFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'Bytes' ? BytesFilter<Nullable, WithAggregations, AllowedKinds> : T extends 'Json' ? JsonFilter<AllowedKinds> : never;
|
|
1265
|
+
type PrimitiveFilter<DataType, T extends string, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = T extends 'String' ? StringFilter<Nullable, WithAggregations, AllowedKinds, DataType & string> : T extends 'Int' | 'Float' | 'Decimal' | 'BigInt' ? NumberFilter<T, Nullable, WithAggregations, AllowedKinds, DataType & (number | bigint)> : T extends 'Boolean' ? BooleanFilter<Nullable, WithAggregations, AllowedKinds, DataType & boolean> : T extends 'DateTime' ? DateTimeFilter<Nullable, WithAggregations, AllowedKinds, DataType & (Date | string)> : T extends 'Bytes' ? BytesFilter<Nullable, WithAggregations, AllowedKinds, DataType & (Uint8Array | Buffer)> : T extends 'Json' ? JsonFilter<AllowedKinds> : never;
|
|
1262
1266
|
type CommonPrimitiveFilter<DataType, T extends BuiltinType, Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind> = ('Equality' extends AllowedKinds ? {
|
|
1263
1267
|
/**
|
|
1264
1268
|
* Checks for equality with the specified value.
|
|
@@ -1297,9 +1301,9 @@ type CommonPrimitiveFilter<DataType, T extends BuiltinType, Nullable extends boo
|
|
|
1297
1301
|
/**
|
|
1298
1302
|
* Builds a negated filter.
|
|
1299
1303
|
*/
|
|
1300
|
-
not?: PrimitiveFilter<T, Nullable, WithAggregations, AllowedKinds>;
|
|
1304
|
+
not?: PrimitiveFilter<DataType, T, Nullable, WithAggregations, AllowedKinds>;
|
|
1301
1305
|
};
|
|
1302
|
-
type StringFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1306
|
+
type StringFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends string = string> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (CommonPrimitiveFilter<DataType, 'String', Nullable, WithAggregations, AllowedKinds> & ('Like' extends AllowedKinds ? {
|
|
1303
1307
|
/**
|
|
1304
1308
|
* Checks if the string contains the specified substring.
|
|
1305
1309
|
*/
|
|
@@ -1330,7 +1334,7 @@ type StringFilter<Nullable extends boolean, WithAggregations extends boolean, Al
|
|
|
1330
1334
|
*/
|
|
1331
1335
|
_max?: StringFilter<false, false, AllowedKinds>;
|
|
1332
1336
|
} : {}));
|
|
1333
|
-
type NumberFilter<T extends 'Int' | 'Float' | 'Decimal' | 'BigInt', Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1337
|
+
type NumberFilter<T extends 'Int' | 'Float' | 'Decimal' | 'BigInt', Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends number | bigint = number | bigint> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (CommonPrimitiveFilter<DataType, T, Nullable, WithAggregations, AllowedKinds> & (WithAggregations extends true ? {
|
|
1334
1338
|
/**
|
|
1335
1339
|
* Filters against the count of records.
|
|
1336
1340
|
*/
|
|
@@ -1338,21 +1342,21 @@ type NumberFilter<T extends 'Int' | 'Float' | 'Decimal' | 'BigInt', Nullable ext
|
|
|
1338
1342
|
/**
|
|
1339
1343
|
* Filters against the average value.
|
|
1340
1344
|
*/
|
|
1341
|
-
_avg?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1345
|
+
_avg?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1342
1346
|
/**
|
|
1343
1347
|
* Filters against the sum value.
|
|
1344
1348
|
*/
|
|
1345
|
-
_sum?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1349
|
+
_sum?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1346
1350
|
/**
|
|
1347
1351
|
* Filters against the minimum value.
|
|
1348
1352
|
*/
|
|
1349
|
-
_min?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1353
|
+
_min?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1350
1354
|
/**
|
|
1351
1355
|
* Filters against the maximum value.
|
|
1352
1356
|
*/
|
|
1353
|
-
_max?: NumberFilter<T, false, false, AllowedKinds>;
|
|
1357
|
+
_max?: NumberFilter<T, false, false, AllowedKinds, DataType>;
|
|
1354
1358
|
} : {}));
|
|
1355
|
-
type DateTimeFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1359
|
+
type DateTimeFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends Date | string = Date | string> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (CommonPrimitiveFilter<DataType, 'DateTime', Nullable, WithAggregations, AllowedKinds> & (WithAggregations extends true ? {
|
|
1356
1360
|
/**
|
|
1357
1361
|
* Filters against the count of records.
|
|
1358
1362
|
*/
|
|
@@ -1366,24 +1370,24 @@ type DateTimeFilter<Nullable extends boolean, WithAggregations extends boolean,
|
|
|
1366
1370
|
*/
|
|
1367
1371
|
_max?: DateTimeFilter<false, false, AllowedKinds>;
|
|
1368
1372
|
} : {}));
|
|
1369
|
-
type BytesFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1373
|
+
type BytesFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends Uint8Array | Buffer = Uint8Array | Buffer> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (('Equality' extends AllowedKinds ? {
|
|
1370
1374
|
/**
|
|
1371
1375
|
* Checks for equality with the specified value.
|
|
1372
1376
|
*/
|
|
1373
|
-
equals?: NullableIf<
|
|
1377
|
+
equals?: NullableIf<DataType, Nullable>;
|
|
1374
1378
|
/**
|
|
1375
1379
|
* Checks if the value is in the specified list of values.
|
|
1376
1380
|
*/
|
|
1377
|
-
in?:
|
|
1381
|
+
in?: DataType[];
|
|
1378
1382
|
/**
|
|
1379
1383
|
* Checks if the value is not in the specified list of values.
|
|
1380
1384
|
*/
|
|
1381
|
-
notIn?:
|
|
1385
|
+
notIn?: DataType[];
|
|
1382
1386
|
} : {}) & {
|
|
1383
1387
|
/**
|
|
1384
1388
|
* Builds a negated filter.
|
|
1385
1389
|
*/
|
|
1386
|
-
not?: BytesFilter<Nullable, WithAggregations, AllowedKinds>;
|
|
1390
|
+
not?: BytesFilter<Nullable, WithAggregations, AllowedKinds, DataType>;
|
|
1387
1391
|
} & (WithAggregations extends true ? {
|
|
1388
1392
|
/**
|
|
1389
1393
|
* Filters against the count of records.
|
|
@@ -1398,16 +1402,16 @@ type BytesFilter<Nullable extends boolean, WithAggregations extends boolean, All
|
|
|
1398
1402
|
*/
|
|
1399
1403
|
_max?: BytesFilter<false, false, AllowedKinds>;
|
|
1400
1404
|
} : {}));
|
|
1401
|
-
type BooleanFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind> = ('Equality' extends AllowedKinds ? NullableIf<
|
|
1405
|
+
type BooleanFilter<Nullable extends boolean, WithAggregations extends boolean, AllowedKinds extends FilterKind = FilterKind, DataType extends boolean = boolean> = ('Equality' extends AllowedKinds ? NullableIf<DataType, Nullable> : never) | (('Equality' extends AllowedKinds ? {
|
|
1402
1406
|
/**
|
|
1403
1407
|
* Checks for equality with the specified value.
|
|
1404
1408
|
*/
|
|
1405
|
-
equals?: NullableIf<
|
|
1409
|
+
equals?: NullableIf<DataType, Nullable>;
|
|
1406
1410
|
} : {}) & {
|
|
1407
1411
|
/**
|
|
1408
1412
|
* Builds a negated filter.
|
|
1409
1413
|
*/
|
|
1410
|
-
not?: BooleanFilter<Nullable, WithAggregations, AllowedKinds>;
|
|
1414
|
+
not?: BooleanFilter<Nullable, WithAggregations, AllowedKinds, DataType>;
|
|
1411
1415
|
} & (WithAggregations extends true ? {
|
|
1412
1416
|
/**
|
|
1413
1417
|
* Filters against the count of records.
|
|
@@ -1477,7 +1481,7 @@ type NonArrayTypedJsonFilter<Schema extends SchemaDef, TypeDefName extends GetTy
|
|
|
1477
1481
|
isNot?: TypedJsonFieldsFilter<Schema, TypeDefName, AllowedKinds>;
|
|
1478
1482
|
} | TypedJsonFieldsFilter<Schema, TypeDefName, AllowedKinds>;
|
|
1479
1483
|
type TypedJsonFieldsFilter<Schema extends SchemaDef, TypeDefName extends GetTypeDefs<Schema>, AllowedKinds extends FilterKind> = {
|
|
1480
|
-
[Key in GetTypeDefFields<Schema, TypeDefName>]?: GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsArray<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, AllowedKinds> : TypeDefFieldIsArray<Schema, TypeDefName, Key> extends true ? ArrayFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, AllowedKinds> : GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetEnums<Schema> ? EnumFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds> : PrimitiveFilter<GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds>;
|
|
1484
|
+
[Key in GetTypeDefFields<Schema, TypeDefName>]?: GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetTypeDefs<Schema> ? TypedJsonFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsArray<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, AllowedKinds> : TypeDefFieldIsArray<Schema, TypeDefName, Key> extends true ? ArrayFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, AllowedKinds> : GetTypeDefFieldType<Schema, TypeDefName, Key> extends GetEnums<Schema> ? EnumFilter<Schema, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds> : PrimitiveFilter<MapFieldDefType<Schema, GetTypeDefField<Schema, TypeDefName, Key>>, GetTypeDefFieldType<Schema, TypeDefName, Key>, TypeDefFieldIsOptional<Schema, TypeDefName, Key>, false, AllowedKinds>;
|
|
1481
1485
|
};
|
|
1482
1486
|
type SortOrder = 'asc' | 'desc';
|
|
1483
1487
|
type NullsOrder = 'first' | 'last';
|
|
@@ -1523,8 +1527,8 @@ type OrderBy<Schema extends SchemaDef, Model extends GetModels<Schema>, WithRela
|
|
|
1523
1527
|
_sum?: SumAvgInput<Schema, Model, SortOrder>;
|
|
1524
1528
|
}) : {});
|
|
1525
1529
|
type WhereUniqueInput<Schema extends SchemaDef, Model extends GetModels<Schema>, Options extends QueryOptions<Schema>> = AtLeast<{
|
|
1526
|
-
[Key in keyof GetModel<Schema, Model>['uniqueFields']]?: GetModel<Schema, Model>['uniqueFields'][Key] extends Pick<FieldDef, 'type'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key]> : {
|
|
1527
|
-
[Key1 in keyof GetModel<Schema, Model>['uniqueFields'][Key]]: GetModel<Schema, Model>['uniqueFields'][Key][Key1] extends Pick<FieldDef, 'type'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key][Key1]> : never;
|
|
1530
|
+
[Key in keyof GetModel<Schema, Model>['uniqueFields']]?: GetModel<Schema, Model>['uniqueFields'][Key] extends Pick<FieldDef, 'type' | 'brand'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key]> : {
|
|
1531
|
+
[Key1 in keyof GetModel<Schema, Model>['uniqueFields'][Key]]: GetModel<Schema, Model>['uniqueFields'][Key][Key1] extends Pick<FieldDef, 'type' | 'brand'> ? MapFieldDefType<Schema, GetModel<Schema, Model>['uniqueFields'][Key][Key1]> : never;
|
|
1528
1532
|
};
|
|
1529
1533
|
} & WhereInput<Schema, Model, Options>, Extract<keyof GetModel<Schema, Model>['uniqueFields'], string>>;
|
|
1530
1534
|
type OmitInput<Schema extends SchemaDef, Model extends GetModels<Schema>> = {
|
|
@@ -1589,7 +1593,7 @@ type ToOneRelationFilter<Schema extends SchemaDef, Model extends GetModels<Schem
|
|
|
1589
1593
|
}, ModelFieldIsOptional<Schema, Model, Field>>;
|
|
1590
1594
|
type RelationFilter<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends RelationFields<Schema, Model>, Options extends QueryOptions<Schema>, AllowedKinds extends FilterKind> = 'Relation' extends AllowedKinds ? FieldIsArray<Schema, Model, Field> extends true ? ToManyRelationFilter<Schema, Model, Field, Options> : ToOneRelationFilter<Schema, Model, Field, Options> : never;
|
|
1591
1595
|
type MapModelFieldType<Schema extends SchemaDef, Model extends GetModels<Schema>, Field extends GetModelFields<Schema, Model>> = MapFieldDefType<Schema, GetModelField<Schema, Model, Field>>;
|
|
1592
|
-
type MapFieldDefType<Schema extends SchemaDef, T extends Pick<FieldDef, 'type' | 'optional' | 'array'
|
|
1596
|
+
type MapFieldDefType<Schema extends SchemaDef, T extends Pick<FieldDef, 'type' | 'optional' | 'array'> & globalThis.Partial<Pick<FieldDef, 'brand'>>, IsPartial extends boolean = false> = WrapType<T['brand'] extends string ? Brand<T['brand']> : T['type'] extends GetEnums<Schema> ? keyof GetEnum<Schema, T['type']> : T['type'] extends GetTypeDefs<Schema> ? TypeDefResult<Schema, T['type'], IsPartial> & Record<string, unknown> : MapBaseType$1<T['type']>, T['optional'], T['array']>;
|
|
1593
1597
|
type OptionalFieldsForCreate<Schema extends SchemaDef, Model extends GetModels<Schema>> = keyof {
|
|
1594
1598
|
[Key in GetModelFields<Schema, Model> as ModelFieldIsOptional<Schema, Model, Key> extends true ? Key : FieldHasDefault<Schema, Model, Key> extends true ? Key : FieldIsArray<Schema, Model, Key> extends true ? Key : GetModelField<Schema, Model, Key>['updatedAt'] extends true | UpdatedAtInfo ? Key : never]: GetModelField<Schema, Model, Key>;
|
|
1595
1599
|
};
|
|
@@ -3482,4 +3486,4 @@ declare namespace schemaUtils {
|
|
|
3482
3486
|
export { schemaUtils_ExpressionVisitor as ExpressionVisitor, schemaUtils_MatchingExpressionVisitor as MatchingExpressionVisitor, type schemaUtils_VisitResult as VisitResult };
|
|
3483
3487
|
}
|
|
3484
3488
|
|
|
3485
|
-
export { type AfterEntityMutationCallback, type AggregateArgs, type AggregateResult, AllCrudOperations, type AllModelOperations, AllReadOperations, AnyNull, AnyNullClass, type AnyPlugin, type AuthType, BaseCrudDialect, type BatchResult, type BeforeEntityMutationCallback, type BooleanFilter, type BytesFilter, CRUD, CRUD_EXT, type ClientConstructor, type ClientContract, type ClientOptions, type ComputedFieldsOptions, CoreCreateOperations, CoreCrudOperations, CoreDeleteOperations, CoreReadOperations, CoreUpdateOperations, CoreWriteOperations, type CountArgs, type CountResult, type CreateArgs, type CreateInput, type CreateManyAndReturnArgs, type CreateManyArgs, type CreateManyInput, type DateTimeFilter, DbNull, DbNullClass, type DefaultModelResult, type DefaultWhereConfig, type DeleteArgs, type DeleteManyArgs, type EntityMutationHooksDef, type ExistsArgs, type ExtClientMembersBase, type ExtQueryArgsBase, type ExtResultBase, type ExtResultInferenceArgs, type ExtResultSelectOmitFields, type ExtractExtResult, type FilterKind, type FindArgs, type FindFirstArgs, type FindManyArgs, type FindUniqueArgs, type GetAllIncludedOperations, type GetIncludedOperations, type GetProcedure, type GetProcedureNames, type GetProcedureParams, type GetQueryOptions, type GetSlicedFilterKindsForField, type GetSlicedModels, type GetSlicedOperations, type GetSlicedProcedures, type GroupByArgs, type GroupByResult, type HasComputedFields, type HasProcedures, type IncludeInput, InputValidator, type JsonArray, type JsonFilter, JsonNull, JsonNullClass, type JsonNullValues, type JsonObject, type JsonValue, kyselyUtils as KyselyUtils, LOGICAL_COMBINATORS, type MapModelFieldType, type ModelAllowsCreate, type ModelHasRequiredUnsupportedField, type ModelOperations, type ModelResult, type ModelSlicingOptions, type NullsOrder, type NumberFilter, ORMError, ORMErrorReason, type OmitConfig, type OmitInput, type OnKyselyQueryArgs, type OnKyselyQueryCallback, type OnProcedureHookContext, type OperationsRequiringCreate, type OrderBy, type PaginatedCursor, type PaginatedOffset, type PluginAfterEntityMutationArgs, type PluginBeforeEntityMutationArgs, type ProcedureEnvelope, type ProcedureFunc, type ProcedureHandlerFunc, type ProcedureOperations, type ProceduresOptions, type ProceedKyselyQueryFunction, type QueryOptions, queryUtils as QueryUtils, RejectedByPolicyReason, type RuntimePlugin, type SchemaExtResult, schemaUtils as SchemaUtils, type SearchFieldMap, type SearchMode, type SearchPayload, type SearchStrategy, type SelectAwareExtResult, type SelectIncludeOmit, type SelectInput, type SelectSubset, type SimplifiedPlainResult, type SimplifiedResult, type SlicingOptions, type SortOrder, type StringFilter, type Subset, type ToKysely, type TransactionClientContract, TransactionIsolationLevel, type TypeDefResult, type TypedJsonFilter, type UpdateArgs, type UpdateInput, type UpdateManyAndReturnArgs, type UpdateManyArgs, type UpsertArgs, type WhereInput, type WhereUniqueInput, ZENSTACK_QUERY_KIND_SYMBOL, ZENSTACK_QUERY_SYMBOL, type ZModelFunction, type ZModelFunctionContext, ZenStackClient, type ZenStackPromise, type ZenStackQueryKind, createQuerySchemaFactory, definePlugin, getCrudDialect };
|
|
3489
|
+
export { type AfterEntityMutationCallback, type AggregateArgs, type AggregateResult, AllCrudOperations, type AllModelOperations, AllReadOperations, AnyNull, AnyNullClass, type AnyPlugin, type AuthType, BaseCrudDialect, type BatchResult, type BeforeEntityMutationCallback, type BooleanFilter, type Brand, type BytesFilter, CRUD, CRUD_EXT, type ClientConstructor, type ClientContract, type ClientOptions, type ComputedFieldsOptions, CoreCreateOperations, CoreCrudOperations, CoreDeleteOperations, CoreReadOperations, CoreUpdateOperations, CoreWriteOperations, type CountArgs, type CountResult, type CreateArgs, type CreateInput, type CreateManyAndReturnArgs, type CreateManyArgs, type CreateManyInput, type DateTimeFilter, DbNull, DbNullClass, type DefaultModelResult, type DefaultWhereConfig, type DeleteArgs, type DeleteManyArgs, type EntityMutationHooksDef, type ExistsArgs, type ExtClientMembersBase, type ExtQueryArgsBase, type ExtResultBase, type ExtResultInferenceArgs, type ExtResultSelectOmitFields, type ExtractExtResult, type FilterKind, type FindArgs, type FindFirstArgs, type FindManyArgs, type FindUniqueArgs, type GetAllIncludedOperations, type GetIncludedOperations, type GetProcedure, type GetProcedureNames, type GetProcedureParams, type GetQueryOptions, type GetSlicedFilterKindsForField, type GetSlicedModels, type GetSlicedOperations, type GetSlicedProcedures, type GroupByArgs, type GroupByResult, type HasComputedFields, type HasProcedures, type IncludeInput, InputValidator, type JsonArray, type JsonFilter, JsonNull, JsonNullClass, type JsonNullValues, type JsonObject, type JsonValue, kyselyUtils as KyselyUtils, LOGICAL_COMBINATORS, type MapModelFieldType, type ModelAllowsCreate, type ModelHasRequiredUnsupportedField, type ModelOperations, type ModelResult, type ModelSlicingOptions, type NullsOrder, type NumberFilter, ORMError, ORMErrorReason, type OmitConfig, type OmitInput, type OnKyselyQueryArgs, type OnKyselyQueryCallback, type OnProcedureHookContext, type OperationsRequiringCreate, type OrderBy, type PaginatedCursor, type PaginatedOffset, type PluginAfterEntityMutationArgs, type PluginBeforeEntityMutationArgs, type ProcedureEnvelope, type ProcedureFunc, type ProcedureHandlerFunc, type ProcedureOperations, type ProceduresOptions, type ProceedKyselyQueryFunction, type QueryOptions, queryUtils as QueryUtils, RejectedByPolicyReason, type RuntimePlugin, type SchemaExtResult, schemaUtils as SchemaUtils, type SearchFieldMap, type SearchMode, type SearchPayload, type SearchStrategy, type SelectAwareExtResult, type SelectIncludeOmit, type SelectInput, type SelectSubset, type SimplifiedPlainResult, type SimplifiedResult, type SlicingOptions, type SortOrder, type StringFilter, type Subset, type ToKysely, type TransactionClientContract, TransactionIsolationLevel, type TypeDefResult, type TypedJsonFilter, type UpdateArgs, type UpdateInput, type UpdateManyAndReturnArgs, type UpdateManyArgs, type UpsertArgs, type WhereInput, type WhereUniqueInput, ZENSTACK_QUERY_KIND_SYMBOL, ZENSTACK_QUERY_SYMBOL, type ZModelFunction, type ZModelFunctionContext, ZenStackClient, type ZenStackPromise, type ZenStackQueryKind, createQuerySchemaFactory, definePlugin, getCrudDialect };
|