@zenstackhq/tanstack-query 2.20.1 → 3.0.0-beta.16
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/.turbo/turbo-build.log +32 -0
- package/.turbo/turbo-lint.log +5 -0
- package/LICENSE +1 -1
- package/dist/react.cjs +1238 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +696 -0
- package/dist/react.d.ts +696 -0
- package/dist/react.js +1195 -0
- package/dist/react.js.map +1 -0
- package/eslint.config.js +4 -0
- package/package.json +56 -109
- package/scripts/generate.ts +27 -0
- package/src/react.ts +531 -0
- package/src/utils/common.ts +457 -0
- package/src/utils/mutator.ts +441 -0
- package/src/utils/nested-read-visitor.ts +61 -0
- package/src/utils/nested-write-visitor.ts +359 -0
- package/src/utils/query-analysis.ts +116 -0
- package/src/utils/serialization.ts +39 -0
- package/src/utils/types.ts +19 -0
- package/test/react-query.test.tsx +1787 -0
- package/test/schemas/basic/input.ts +70 -0
- package/test/schemas/basic/models.ts +12 -0
- package/test/schemas/basic/schema-lite.ts +124 -0
- package/test/schemas/basic/schema.zmodel +25 -0
- package/tsconfig.json +7 -0
- package/tsconfig.test.json +8 -0
- package/tsup.config.ts +13 -0
- package/vitest.config.ts +11 -0
- package/README.md +0 -5
- package/generator.d.ts +0 -6
- package/generator.js +0 -578
- package/generator.js.map +0 -1
- package/index.d.ts +0 -4
- package/index.js +0 -22
- package/index.js.map +0 -1
- package/runtime/common-CXlL7vTW.d.mts +0 -121
- package/runtime/common-CXlL7vTW.d.ts +0 -121
- package/runtime/index.d.mts +0 -20
- package/runtime/index.d.ts +0 -20
- package/runtime/index.js +0 -44
- package/runtime/index.js.map +0 -1
- package/runtime/index.mjs +0 -21
- package/runtime/index.mjs.map +0 -1
- package/runtime/react.d.mts +0 -322
- package/runtime/react.d.ts +0 -322
- package/runtime/react.js +0 -408
- package/runtime/react.js.map +0 -1
- package/runtime/react.mjs +0 -380
- package/runtime/react.mjs.map +0 -1
- package/runtime/svelte.d.mts +0 -322
- package/runtime/svelte.d.ts +0 -322
- package/runtime/svelte.js +0 -407
- package/runtime/svelte.js.map +0 -1
- package/runtime/svelte.mjs +0 -379
- package/runtime/svelte.mjs.map +0 -1
- package/runtime/vue.d.mts +0 -330
- package/runtime/vue.d.ts +0 -330
- package/runtime/vue.js +0 -418
- package/runtime/vue.js.map +0 -1
- package/runtime/vue.mjs +0 -390
- package/runtime/vue.mjs.map +0 -1
- package/runtime-v5/angular.d.mts +0 -59
- package/runtime-v5/angular.d.ts +0 -59
- package/runtime-v5/angular.js +0 -425
- package/runtime-v5/angular.js.map +0 -1
- package/runtime-v5/angular.mjs +0 -397
- package/runtime-v5/angular.mjs.map +0 -1
- package/runtime-v5/common-CXlL7vTW.d.mts +0 -121
- package/runtime-v5/common-CXlL7vTW.d.ts +0 -121
- package/runtime-v5/index.d.mts +0 -20
- package/runtime-v5/index.d.ts +0 -20
- package/runtime-v5/index.js +0 -44
- package/runtime-v5/index.js.map +0 -1
- package/runtime-v5/index.mjs +0 -21
- package/runtime-v5/index.mjs.map +0 -1
- package/runtime-v5/react.d.mts +0 -474
- package/runtime-v5/react.d.ts +0 -474
- package/runtime-v5/react.js +0 -440
- package/runtime-v5/react.js.map +0 -1
- package/runtime-v5/react.mjs +0 -412
- package/runtime-v5/react.mjs.map +0 -1
- package/runtime-v5/svelte.d.mts +0 -386
- package/runtime-v5/svelte.d.ts +0 -386
- package/runtime-v5/svelte.js +0 -436
- package/runtime-v5/svelte.js.map +0 -1
- package/runtime-v5/svelte.mjs +0 -408
- package/runtime-v5/svelte.mjs.map +0 -1
- package/runtime-v5/vue.d.mts +0 -330
- package/runtime-v5/vue.d.ts +0 -330
- package/runtime-v5/vue.js +0 -420
- package/runtime-v5/vue.js.map +0 -1
- package/runtime-v5/vue.mjs +0 -392
- package/runtime-v5/vue.mjs.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// DO NOT MODIFY THIS FILE //
|
|
3
|
+
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
|
|
4
|
+
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
|
|
8
|
+
import { type SchemaType as $Schema } from "./schema-lite";
|
|
9
|
+
import type { FindManyArgs as $FindManyArgs, FindUniqueArgs as $FindUniqueArgs, FindFirstArgs as $FindFirstArgs, CreateArgs as $CreateArgs, CreateManyArgs as $CreateManyArgs, CreateManyAndReturnArgs as $CreateManyAndReturnArgs, UpdateArgs as $UpdateArgs, UpdateManyArgs as $UpdateManyArgs, UpdateManyAndReturnArgs as $UpdateManyAndReturnArgs, UpsertArgs as $UpsertArgs, DeleteArgs as $DeleteArgs, DeleteManyArgs as $DeleteManyArgs, CountArgs as $CountArgs, AggregateArgs as $AggregateArgs, GroupByArgs as $GroupByArgs, WhereInput as $WhereInput, SelectInput as $SelectInput, IncludeInput as $IncludeInput, OmitInput as $OmitInput } from "@zenstackhq/orm";
|
|
10
|
+
import type { SimplifiedModelResult as $SimplifiedModelResult, SelectIncludeOmit as $SelectIncludeOmit } from "@zenstackhq/orm";
|
|
11
|
+
export type UserFindManyArgs = $FindManyArgs<$Schema, "User">;
|
|
12
|
+
export type UserFindUniqueArgs = $FindUniqueArgs<$Schema, "User">;
|
|
13
|
+
export type UserFindFirstArgs = $FindFirstArgs<$Schema, "User">;
|
|
14
|
+
export type UserCreateArgs = $CreateArgs<$Schema, "User">;
|
|
15
|
+
export type UserCreateManyArgs = $CreateManyArgs<$Schema, "User">;
|
|
16
|
+
export type UserCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "User">;
|
|
17
|
+
export type UserUpdateArgs = $UpdateArgs<$Schema, "User">;
|
|
18
|
+
export type UserUpdateManyArgs = $UpdateManyArgs<$Schema, "User">;
|
|
19
|
+
export type UserUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "User">;
|
|
20
|
+
export type UserUpsertArgs = $UpsertArgs<$Schema, "User">;
|
|
21
|
+
export type UserDeleteArgs = $DeleteArgs<$Schema, "User">;
|
|
22
|
+
export type UserDeleteManyArgs = $DeleteManyArgs<$Schema, "User">;
|
|
23
|
+
export type UserCountArgs = $CountArgs<$Schema, "User">;
|
|
24
|
+
export type UserAggregateArgs = $AggregateArgs<$Schema, "User">;
|
|
25
|
+
export type UserGroupByArgs = $GroupByArgs<$Schema, "User">;
|
|
26
|
+
export type UserWhereInput = $WhereInput<$Schema, "User">;
|
|
27
|
+
export type UserSelect = $SelectInput<$Schema, "User">;
|
|
28
|
+
export type UserInclude = $IncludeInput<$Schema, "User">;
|
|
29
|
+
export type UserOmit = $OmitInput<$Schema, "User">;
|
|
30
|
+
export type UserGetPayload<Args extends $SelectIncludeOmit<$Schema, "User", true>> = $SimplifiedModelResult<$Schema, "User", Args>;
|
|
31
|
+
export type PostFindManyArgs = $FindManyArgs<$Schema, "Post">;
|
|
32
|
+
export type PostFindUniqueArgs = $FindUniqueArgs<$Schema, "Post">;
|
|
33
|
+
export type PostFindFirstArgs = $FindFirstArgs<$Schema, "Post">;
|
|
34
|
+
export type PostCreateArgs = $CreateArgs<$Schema, "Post">;
|
|
35
|
+
export type PostCreateManyArgs = $CreateManyArgs<$Schema, "Post">;
|
|
36
|
+
export type PostCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "Post">;
|
|
37
|
+
export type PostUpdateArgs = $UpdateArgs<$Schema, "Post">;
|
|
38
|
+
export type PostUpdateManyArgs = $UpdateManyArgs<$Schema, "Post">;
|
|
39
|
+
export type PostUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "Post">;
|
|
40
|
+
export type PostUpsertArgs = $UpsertArgs<$Schema, "Post">;
|
|
41
|
+
export type PostDeleteArgs = $DeleteArgs<$Schema, "Post">;
|
|
42
|
+
export type PostDeleteManyArgs = $DeleteManyArgs<$Schema, "Post">;
|
|
43
|
+
export type PostCountArgs = $CountArgs<$Schema, "Post">;
|
|
44
|
+
export type PostAggregateArgs = $AggregateArgs<$Schema, "Post">;
|
|
45
|
+
export type PostGroupByArgs = $GroupByArgs<$Schema, "Post">;
|
|
46
|
+
export type PostWhereInput = $WhereInput<$Schema, "Post">;
|
|
47
|
+
export type PostSelect = $SelectInput<$Schema, "Post">;
|
|
48
|
+
export type PostInclude = $IncludeInput<$Schema, "Post">;
|
|
49
|
+
export type PostOmit = $OmitInput<$Schema, "Post">;
|
|
50
|
+
export type PostGetPayload<Args extends $SelectIncludeOmit<$Schema, "Post", true>> = $SimplifiedModelResult<$Schema, "Post", Args>;
|
|
51
|
+
export type CategoryFindManyArgs = $FindManyArgs<$Schema, "Category">;
|
|
52
|
+
export type CategoryFindUniqueArgs = $FindUniqueArgs<$Schema, "Category">;
|
|
53
|
+
export type CategoryFindFirstArgs = $FindFirstArgs<$Schema, "Category">;
|
|
54
|
+
export type CategoryCreateArgs = $CreateArgs<$Schema, "Category">;
|
|
55
|
+
export type CategoryCreateManyArgs = $CreateManyArgs<$Schema, "Category">;
|
|
56
|
+
export type CategoryCreateManyAndReturnArgs = $CreateManyAndReturnArgs<$Schema, "Category">;
|
|
57
|
+
export type CategoryUpdateArgs = $UpdateArgs<$Schema, "Category">;
|
|
58
|
+
export type CategoryUpdateManyArgs = $UpdateManyArgs<$Schema, "Category">;
|
|
59
|
+
export type CategoryUpdateManyAndReturnArgs = $UpdateManyAndReturnArgs<$Schema, "Category">;
|
|
60
|
+
export type CategoryUpsertArgs = $UpsertArgs<$Schema, "Category">;
|
|
61
|
+
export type CategoryDeleteArgs = $DeleteArgs<$Schema, "Category">;
|
|
62
|
+
export type CategoryDeleteManyArgs = $DeleteManyArgs<$Schema, "Category">;
|
|
63
|
+
export type CategoryCountArgs = $CountArgs<$Schema, "Category">;
|
|
64
|
+
export type CategoryAggregateArgs = $AggregateArgs<$Schema, "Category">;
|
|
65
|
+
export type CategoryGroupByArgs = $GroupByArgs<$Schema, "Category">;
|
|
66
|
+
export type CategoryWhereInput = $WhereInput<$Schema, "Category">;
|
|
67
|
+
export type CategorySelect = $SelectInput<$Schema, "Category">;
|
|
68
|
+
export type CategoryInclude = $IncludeInput<$Schema, "Category">;
|
|
69
|
+
export type CategoryOmit = $OmitInput<$Schema, "Category">;
|
|
70
|
+
export type CategoryGetPayload<Args extends $SelectIncludeOmit<$Schema, "Category", true>> = $SimplifiedModelResult<$Schema, "Category", Args>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// DO NOT MODIFY THIS FILE //
|
|
3
|
+
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
|
|
4
|
+
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
|
|
8
|
+
import { type SchemaType as $Schema } from "./schema-lite";
|
|
9
|
+
import { type ModelResult as $ModelResult } from "@zenstackhq/orm";
|
|
10
|
+
export type User = $ModelResult<$Schema, "User">;
|
|
11
|
+
export type Post = $ModelResult<$Schema, "Post">;
|
|
12
|
+
export type Category = $ModelResult<$Schema, "Category">;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// DO NOT MODIFY THIS FILE //
|
|
3
|
+
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
|
|
4
|
+
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
5
|
+
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
|
|
8
|
+
import { type SchemaDef, ExpressionUtils } from "@zenstackhq/orm/schema";
|
|
9
|
+
export const schema = {
|
|
10
|
+
provider: {
|
|
11
|
+
type: "sqlite"
|
|
12
|
+
},
|
|
13
|
+
models: {
|
|
14
|
+
User: {
|
|
15
|
+
name: "User",
|
|
16
|
+
fields: {
|
|
17
|
+
id: {
|
|
18
|
+
name: "id",
|
|
19
|
+
type: "String",
|
|
20
|
+
id: true,
|
|
21
|
+
default: ExpressionUtils.call("cuid")
|
|
22
|
+
},
|
|
23
|
+
email: {
|
|
24
|
+
name: "email",
|
|
25
|
+
type: "String",
|
|
26
|
+
unique: true
|
|
27
|
+
},
|
|
28
|
+
name: {
|
|
29
|
+
name: "name",
|
|
30
|
+
type: "String",
|
|
31
|
+
optional: true
|
|
32
|
+
},
|
|
33
|
+
posts: {
|
|
34
|
+
name: "posts",
|
|
35
|
+
type: "Post",
|
|
36
|
+
array: true,
|
|
37
|
+
relation: { opposite: "owner" }
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
idFields: ["id"],
|
|
41
|
+
uniqueFields: {
|
|
42
|
+
id: { type: "String" },
|
|
43
|
+
email: { type: "String" }
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
Post: {
|
|
47
|
+
name: "Post",
|
|
48
|
+
fields: {
|
|
49
|
+
id: {
|
|
50
|
+
name: "id",
|
|
51
|
+
type: "String",
|
|
52
|
+
id: true,
|
|
53
|
+
default: ExpressionUtils.call("cuid")
|
|
54
|
+
},
|
|
55
|
+
title: {
|
|
56
|
+
name: "title",
|
|
57
|
+
type: "String"
|
|
58
|
+
},
|
|
59
|
+
owner: {
|
|
60
|
+
name: "owner",
|
|
61
|
+
type: "User",
|
|
62
|
+
optional: true,
|
|
63
|
+
relation: { opposite: "posts", fields: ["ownerId"], references: ["id"] }
|
|
64
|
+
},
|
|
65
|
+
ownerId: {
|
|
66
|
+
name: "ownerId",
|
|
67
|
+
type: "String",
|
|
68
|
+
optional: true,
|
|
69
|
+
foreignKeyFor: [
|
|
70
|
+
"owner"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
category: {
|
|
74
|
+
name: "category",
|
|
75
|
+
type: "Category",
|
|
76
|
+
optional: true,
|
|
77
|
+
relation: { opposite: "posts", fields: ["categoryId"], references: ["id"] }
|
|
78
|
+
},
|
|
79
|
+
categoryId: {
|
|
80
|
+
name: "categoryId",
|
|
81
|
+
type: "String",
|
|
82
|
+
optional: true,
|
|
83
|
+
foreignKeyFor: [
|
|
84
|
+
"category"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
idFields: ["id"],
|
|
89
|
+
uniqueFields: {
|
|
90
|
+
id: { type: "String" }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
Category: {
|
|
94
|
+
name: "Category",
|
|
95
|
+
fields: {
|
|
96
|
+
id: {
|
|
97
|
+
name: "id",
|
|
98
|
+
type: "String",
|
|
99
|
+
id: true,
|
|
100
|
+
default: ExpressionUtils.call("cuid")
|
|
101
|
+
},
|
|
102
|
+
name: {
|
|
103
|
+
name: "name",
|
|
104
|
+
type: "String",
|
|
105
|
+
unique: true
|
|
106
|
+
},
|
|
107
|
+
posts: {
|
|
108
|
+
name: "posts",
|
|
109
|
+
type: "Post",
|
|
110
|
+
array: true,
|
|
111
|
+
relation: { opposite: "category" }
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
idFields: ["id"],
|
|
115
|
+
uniqueFields: {
|
|
116
|
+
id: { type: "String" },
|
|
117
|
+
name: { type: "String" }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
authType: "User",
|
|
122
|
+
plugins: {}
|
|
123
|
+
} as const satisfies SchemaDef;
|
|
124
|
+
export type SchemaType = typeof schema;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
datasource db {
|
|
2
|
+
provider = 'sqlite'
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
model User {
|
|
6
|
+
id String @id @default(cuid())
|
|
7
|
+
email String @unique
|
|
8
|
+
name String?
|
|
9
|
+
posts Post[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
model Post {
|
|
13
|
+
id String @id @default(cuid())
|
|
14
|
+
title String
|
|
15
|
+
owner User? @relation(fields: [ownerId], references: [id])
|
|
16
|
+
ownerId String?
|
|
17
|
+
category Category? @relation(fields: [categoryId], references: [id])
|
|
18
|
+
categoryId String?
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
model Category {
|
|
22
|
+
id String @id @default(cuid())
|
|
23
|
+
name String @unique
|
|
24
|
+
posts Post[]
|
|
25
|
+
}
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
package/vitest.config.ts
ADDED
package/README.md
DELETED
package/generator.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PluginOptions } from '@zenstackhq/sdk';
|
|
2
|
-
import { Model } from '@zenstackhq/sdk/ast';
|
|
3
|
-
import { type DMMF } from '@zenstackhq/sdk/prisma';
|
|
4
|
-
export declare function generate(model: Model, options: PluginOptions, dmmf: DMMF.Document): Promise<{
|
|
5
|
-
warnings: string[];
|
|
6
|
-
}>;
|