diff --git a/packages/runtime/src/utils/type-utils.ts b/packages/runtime/src/utils/type-utils.ts index 6769f177..8670ae00 100644 --- a/packages/runtime/src/utils/type-utils.ts +++ b/packages/runtime/src/utils/type-utils.ts @@ -45,6 +45,12 @@ export type JsonValue = string | number | boolean | null | JsonObject | JsonArra export type JsonObject = { [key: string]: JsonValue }; export type JsonArray = Array; +/** + * Returns an object containing the provided code string as the `code` property. + * + * @param code - The string to assign to the `code` property + * @returns An object with a single `code` property set to the input string + */ export function call(code: string) { return { code }; } diff --git a/packages/runtime/test/typing/verify-typing.ts b/packages/runtime/test/typing/verify-typing.ts index 86389616..dd7d1590 100644 --- a/packages/runtime/test/typing/verify-typing.ts +++ b/packages/runtime/test/typing/verify-typing.ts @@ -30,6 +30,11 @@ async function main() { enums(); } +/** + * Demonstrates various user query operations using the ZenStackClient, including filtering, selecting, omitting, and including nested relations. + * + * Executes and logs results for single and multiple user queries, nested relation selections, computed fields, pagination, ordering, distinct, and cursor-based queries. Also verifies TypeScript type safety for invalid query combinations and field access. + */ async function find() { const user1 = await client.user.findFirst({ where: { @@ -188,6 +193,11 @@ async function find() { console.log(u.posts[0]?.author?.email); } +/** + * Demonstrates various create operations for users, profiles, regions, posts, and tags using the ZenStackClient. + * + * This includes single and batch creation, nested relation creation, compound key connections, and many-to-many associations. Also tests error scenarios for required fields and invalid relation usage. + */ async function create() { await client.user.create({ // @ts-expect-error email is required