Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugins/tanstack-query/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ function generateQueryHook(
isExported: true,
});

if (version === 'v5' && infinite && ['react', 'svelte'].includes(target)) {
if (version === 'v5' && infinite && ['react', 'svelte', 'angular'].includes(target)) {
// getNextPageParam option is required in v5
func.addStatements([`options = options ?? { getNextPageParam: () => null };`]);
}
Expand Down
10 changes: 4 additions & 6 deletions packages/plugins/tanstack-query/tests/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,15 @@ ${sharedModel}
})
export class TestComponent {
query() {
const { data, queryKey } = useFindFirstpost_Item({include: { author: true }}, { enabled: true, optimisticUpdate: false });
console.log(queryKey);
const { data } = useFindFirstpost_Item({include: { author: true }}, { enabled: true, optimisticUpdate: false });
console.log(data()?.viewCount);
console.log(data()?.author?.email);
}

infiniteQuery() {
const { data, queryKey, fetchNextPage, hasNextPage } = useInfiniteFindManypost_Item();
const { data, fetchNextPage, hasNextPage } = useInfiniteFindManypost_Item();
useInfiniteFindManypost_Item({ where: { published: true } });
useInfiniteFindManypost_Item(undefined, { enabled: true, getNextPageParam: () => null });
console.log(queryKey);
console.log(data()?.pages[0][0].published);
console.log(data()?.pageParams[0]);
}
Expand Down Expand Up @@ -346,9 +344,9 @@ ${sharedModel}
'@angular/core@^20.0.0',
'@angular/common@^20.0.0',
'@angular/platform-browser@^20.0.0',
'@tanstack/angular-query-v5@npm:@tanstack/angular-query-[email protected]',
'@tanstack/[email protected]',
'rxjs@^7.8.0',
'zone.js@^0.15.0'
'zone.js@^0.15.0',
],
copyDependencies: [path.resolve(__dirname, '../dist')],
compile: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { AnyRouter } from '@trpc/server';
import { createTRPCNuxtClient as _createTRPCNuxtClient } from 'trpc-nuxt/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

type Primitive = string | Function | number | boolean | Symbol | undefined | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { TRPCError } from '@trpc/server';
import { isPrismaClientKnownRequestError } from '@zenstackhq/runtime';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { type RouterFactory, type ProcBuilder, type BaseConfig, db } from ".";
import * as _Schema from '@zenstackhq/runtime/zod/input';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { type RouterFactory, type ProcBuilder, type BaseConfig, db } from ".";
import * as _Schema from '@zenstackhq/runtime/zod/input';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { unsetMarker, AnyRouter, AnyRootConfig, CreateRouterInner, Procedure, ProcedureBuilder, ProcedureParams, ProcedureRouterRecord, ProcedureType } from "@trpc/server";
import type { PrismaClient } from "@prisma/client";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { AnyTRPCRouter as AnyRouter } from '@trpc/server';
import { createTRPCNuxtClient as _createTRPCNuxtClient } from 'trpc-nuxt/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

type Primitive = string | Function | number | boolean | Symbol | undefined | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { TRPCError } from '@trpc/server';
import { isPrismaClientKnownRequestError } from '@zenstackhq/runtime';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { db } from ".";
import { createTRPCRouter } from "../../generated-router-helper";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { db } from ".";
import { createTRPCRouter } from "../../generated-router-helper";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { AnyTRPCRouter as AnyRouter } from "@trpc/server";
import type { PrismaClient } from "@prisma/client";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { AnyRouter } from '@trpc/server';
import type { NextPageContext } from 'next';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

type Primitive = string | Function | number | boolean | Symbol | undefined | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { TRPCError } from '@trpc/server';
import { isPrismaClientKnownRequestError } from '@zenstackhq/runtime';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { type RouterFactory, type ProcBuilder, type BaseConfig, db } from ".";
import * as _Schema from '@zenstackhq/runtime/zod/input';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { type RouterFactory, type ProcBuilder, type BaseConfig, db } from ".";
import * as _Schema from '@zenstackhq/runtime/zod/input';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { unsetMarker, AnyRouter, AnyRootConfig, CreateRouterInner, Procedure, ProcedureBuilder, ProcedureParams, ProcedureRouterRecord, ProcedureType } from "@trpc/server";
import type { PrismaClient } from "@prisma/client";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { Prisma } from '@prisma/client';
import type { TRPCClientErrorLike, TRPCRequestOptions } from '@trpc/client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { AnyTRPCRouter as AnyRouter } from '@trpc/server';
import type { CreateTRPCReactOptions } from '@trpc/react-query/shared';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

type Primitive = string | Function | number | boolean | Symbol | undefined | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { TRPCError } from '@trpc/server';
import { isPrismaClientKnownRequestError } from '@zenstackhq/runtime';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { db } from ".";
import { createTRPCRouter } from "../../generated-router-helper";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import { db } from ".";
import { createTRPCRouter } from "../../generated-router-helper";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
******************************************************************************/

/* eslint-disable */
// @ts-nocheck

import type { AnyTRPCRouter as AnyRouter } from "@trpc/server";
import type { PrismaClient } from "@prisma/client";
Expand Down
29 changes: 17 additions & 12 deletions packages/plugins/trpc/tests/trpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ model Foo {
{
provider: 'postgresql',
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
fullZod: true,
}
Expand Down Expand Up @@ -99,7 +99,7 @@ model Foo {
`,
{
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
fullZod: true,
}
Expand Down Expand Up @@ -129,7 +129,7 @@ model Post {
`,
{
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
fullZod: true,
customSchemaFilePath: 'zenstack/schema.zmodel',
Expand All @@ -154,7 +154,7 @@ model Post {
`,
{
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
fullZod: true,
customSchemaFilePath: 'zenstack/schema.zmodel',
Expand Down Expand Up @@ -184,7 +184,7 @@ model Post {
`,
{
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
fullZod: true,
customSchemaFilePath: 'zenstack/schema.zmodel',
Expand Down Expand Up @@ -232,9 +232,9 @@ model Post {
pushDb: false,
extraDependencies: [
path.resolve(__dirname, '../dist'),
'@trpc/client',
'@trpc/server',
'@trpc/react-query',
'@trpc/client@10',
'@trpc/server@10',
'@trpc/react-query@10',
],
compile: true,
fullZod: true,
Expand All @@ -255,7 +255,12 @@ model Post {
`,
{
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server', '@trpc/next'],
extraDependencies: [
path.resolve(__dirname, '../dist'),
'@trpc/client@10',
'@trpc/server@10',
'@trpc/next@10',
],
compile: true,
fullZod: true,
}
Expand Down Expand Up @@ -285,7 +290,7 @@ model post_item {
`,
{
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
fullZod: true,
}
Expand Down Expand Up @@ -332,7 +337,7 @@ model Foo {
{
addPrelude: false,
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
}
);
Expand Down Expand Up @@ -403,7 +408,7 @@ model Foo {
{
addPrelude: false,
pushDb: false,
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client', '@trpc/server'],
extraDependencies: [path.resolve(__dirname, '../dist'), '@trpc/client@10', '@trpc/server@10'],
compile: true,
}
);
Expand Down
Loading
Loading