@zenstackhq/orm 3.5.0-beta.4 → 3.5.0
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/README.md +34 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -7
- package/dist/index.d.ts +5 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1487,12 +1487,9 @@ type SelectIncludeOmit<Schema extends SchemaDef, Model extends GetModels<Schema>
|
|
|
1487
1487
|
* Explicitly omit fields from the query result.
|
|
1488
1488
|
*/
|
|
1489
1489
|
omit?: (OmitInput<Schema, Model> & ExtResultSelectOmitFields<ExtResult, Model & string>) | null;
|
|
1490
|
-
} &
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
*/
|
|
1494
|
-
include?: IncludeInput<Schema, Model, Options, AllowCount, ExtResult> | null;
|
|
1495
|
-
} : {});
|
|
1490
|
+
} & {
|
|
1491
|
+
[K in AllowRelation extends true ? RelationFields<Schema, Model> extends never ? never : 'include' : never]?: IncludeInput<Schema, Model, Options, AllowCount, ExtResult> | null;
|
|
1492
|
+
};
|
|
1496
1493
|
type SelectInput<Schema extends SchemaDef, Model extends GetModels<Schema>, Options extends QueryOptions<Schema> = QueryOptions<Schema>, AllowCount extends boolean = true, AllowRelation extends boolean = true, ExtResult extends ExtResultBase<Schema> = {}> = {
|
|
1497
1494
|
[Key in NonRelationFields<Schema, Model>]?: boolean;
|
|
1498
1495
|
} & (AllowRelation extends true ? IncludeInput<Schema, Model, Options, AllowCount, ExtResult> : {});
|
|
@@ -2268,11 +2265,12 @@ type ClientContract<Schema extends SchemaDef, Options extends ClientOptions<Sche
|
|
|
2268
2265
|
*/
|
|
2269
2266
|
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): ZenStackPromise<Schema, T>;
|
|
2270
2267
|
/**
|
|
2271
|
-
* The current user identity.
|
|
2268
|
+
* The current user identity. If the client is not bound to any user context, returns `undefined`.
|
|
2272
2269
|
*/
|
|
2273
2270
|
get $auth(): AuthType<Schema> | undefined;
|
|
2274
2271
|
/**
|
|
2275
2272
|
* Returns a new client bound to the specified user identity. The original client remains unchanged.
|
|
2273
|
+
* Pass `undefined` to return a client without any user context.
|
|
2276
2274
|
*
|
|
2277
2275
|
* @example
|
|
2278
2276
|
* ```
|
package/dist/index.d.ts
CHANGED
|
@@ -1487,12 +1487,9 @@ type SelectIncludeOmit<Schema extends SchemaDef, Model extends GetModels<Schema>
|
|
|
1487
1487
|
* Explicitly omit fields from the query result.
|
|
1488
1488
|
*/
|
|
1489
1489
|
omit?: (OmitInput<Schema, Model> & ExtResultSelectOmitFields<ExtResult, Model & string>) | null;
|
|
1490
|
-
} &
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
*/
|
|
1494
|
-
include?: IncludeInput<Schema, Model, Options, AllowCount, ExtResult> | null;
|
|
1495
|
-
} : {});
|
|
1490
|
+
} & {
|
|
1491
|
+
[K in AllowRelation extends true ? RelationFields<Schema, Model> extends never ? never : 'include' : never]?: IncludeInput<Schema, Model, Options, AllowCount, ExtResult> | null;
|
|
1492
|
+
};
|
|
1496
1493
|
type SelectInput<Schema extends SchemaDef, Model extends GetModels<Schema>, Options extends QueryOptions<Schema> = QueryOptions<Schema>, AllowCount extends boolean = true, AllowRelation extends boolean = true, ExtResult extends ExtResultBase<Schema> = {}> = {
|
|
1497
1494
|
[Key in NonRelationFields<Schema, Model>]?: boolean;
|
|
1498
1495
|
} & (AllowRelation extends true ? IncludeInput<Schema, Model, Options, AllowCount, ExtResult> : {});
|
|
@@ -2268,11 +2265,12 @@ type ClientContract<Schema extends SchemaDef, Options extends ClientOptions<Sche
|
|
|
2268
2265
|
*/
|
|
2269
2266
|
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): ZenStackPromise<Schema, T>;
|
|
2270
2267
|
/**
|
|
2271
|
-
* The current user identity.
|
|
2268
|
+
* The current user identity. If the client is not bound to any user context, returns `undefined`.
|
|
2272
2269
|
*/
|
|
2273
2270
|
get $auth(): AuthType<Schema> | undefined;
|
|
2274
2271
|
/**
|
|
2275
2272
|
* Returns a new client bound to the specified user identity. The original client remains unchanged.
|
|
2273
|
+
* Pass `undefined` to return a client without any user context.
|
|
2276
2274
|
*
|
|
2277
2275
|
* @example
|
|
2278
2276
|
* ```
|
package/dist/index.js
CHANGED
|
@@ -9145,7 +9145,7 @@ var ClientImpl = class _ClientImpl {
|
|
|
9145
9145
|
return newClient;
|
|
9146
9146
|
}
|
|
9147
9147
|
$setAuth(auth) {
|
|
9148
|
-
if (auth !== void 0 && typeof auth !== "object") {
|
|
9148
|
+
if (auth !== void 0 && (typeof auth !== "object" || auth === null || Array.isArray(auth))) {
|
|
9149
9149
|
throw new Error("Invalid auth object");
|
|
9150
9150
|
}
|
|
9151
9151
|
const newClient = new _ClientImpl(this.schema, this.$options, this);
|