@@ -8,7 +8,13 @@ sidebar_label: API
88
99## ` @zenstackhq/orm `
1010
11- ### ` class ZenStackClient `
11+ ### ` ClientContract<Schema> `
12+
13+ The interface for the ZenStack ORM client, implemented by [ ZenStackClient] ( #zenstackclient ) .
14+
15+ ### ` ZenStackClient<Schema> `
16+
17+ The class that implements the ORM client.
1218
1319``` ts
1420/**
@@ -45,4 +51,99 @@ export type ClientOptions<Schema extends SchemaDef> = {
4551 */
4652 computedFields: ComputedFieldsOptions <Schema >;
4753};
48- ```
54+ ```
55+
56+ #### Query APIs
57+
58+ Please refer to the [ ORM Query API documentation] ( ../orm/api/ ) for more details about query APIs like ` findMany ` , ` create ` , ` update ` , etc.
59+
60+ #### ` $connect() `
61+
62+ ``` ts
63+ /**
64+ * Eagerly connects to the database.
65+ */
66+ $connect (): Promise < void > ;
67+ ```
68+
69+ #### ` $disconnect() `
70+
71+ ``` ts
72+ /**
73+ * Explicitly disconnects from the database.
74+ */
75+ $disconnect (): Promise < void > ;
76+ ```
77+
78+ #### ` $setAuth() `
79+
80+ ``` ts
81+ /**
82+ * Sets the current user identity.
83+ */
84+ $setAuth (auth : AuthType < Schema > | undefined ): ClientContract < Schema > ;
85+ ```
86+
87+ #### ` $auth `
88+
89+ ``` ts
90+ /**
91+ * The current user identity.
92+ */
93+ get $auth (): AuthType < Schema > | undefined ;
94+ ```
95+
96+ #### ` $use() `
97+
98+ Read more in the [ Plugins documentation] ( ../orm/plugins/ ) .
99+
100+ ``` ts
101+ /**
102+ * Returns a new client with the specified plugin installed.
103+ */
104+ $use (plugin : RuntimePlugin < Schema > ): ClientContract < Schema > ;
105+ ```
106+
107+ #### ` $unuse() `
108+
109+ Read more in the [ Plugins documentation] ( ../orm/plugins/ ) .
110+
111+ ``` ts
112+ /**
113+ * Returns a new client with the specified plugin removed.
114+ */
115+ $unuse (pluginId : string ): ClientContract < Schema > ;
116+ ```
117+
118+ #### ` $unuseAll() `
119+
120+ Read more in the [ Plugins documentation] ( ../orm/plugins/ ) .
121+
122+ ``` ts
123+ /**
124+ * Returns a new client with all plugins removed.
125+ */
126+ $unuseAll (): ClientContract < Schema > ;
127+ ```
128+
129+ #### ` $qb `
130+
131+ Read more in the [ Query Builder API documentation] ( ../orm/query-builder ) .
132+
133+ ``` ts
134+ /**
135+ * The underlying Kysely query builder instance.
136+ */
137+ readonly $qb : ToKysely < Schema > ;
138+ ```
139+
140+ #### ` $qbRaw `
141+
142+ Read more in the [ Query Builder API documentation] ( ../orm/query-builder ) .
143+
144+ ``` ts
145+ /**
146+ * The underlying raw Kysely query builder without any ZenStack enhancements.
147+ */
148+ readonly $qbRaw : AnyKysely ;
149+ ```
0 commit comments