sdnext 0.0.20 → 0.0.21
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/dist/utils/hook.js +6 -27
- package/package.json +3 -3
- package/src/utils/hook.ts +6 -51
package/dist/utils/hook.js
CHANGED
|
@@ -37,15 +37,8 @@ import { useMutation, UseMutationOptions } from "@tanstack/react-query"
|
|
|
37
37
|
import { createRequestFn } from "deepsea-tools"
|
|
38
38
|
|
|
39
39
|
import { ${name}Action } from "@/actions/${join(dir, name)}"
|
|
40
|
-
|
|
41
|
-
${
|
|
42
|
-
` : ""}
|
|
43
|
-
export const ${name}Client = createRequestFn(${hasSchema ? `{
|
|
44
|
-
fn: ${name}Action,
|
|
45
|
-
schema: ${match[1]},
|
|
46
|
-
}` : `{
|
|
47
|
-
fn: ${name}Action,
|
|
48
|
-
}`})
|
|
40
|
+
|
|
41
|
+
export const ${name}Client = createRequestFn(${name}Action)
|
|
49
42
|
|
|
50
43
|
export interface Use${upName}Params<TOnMutateResult = unknown> extends Omit<
|
|
51
44
|
UseMutationOptions<Awaited<ReturnType<typeof ${name}Client>>, Error, Parameters<typeof ${name}Client>[0], TOnMutateResult>,
|
|
@@ -95,15 +88,8 @@ export function use${upName}<TOnMutateResult = unknown>({ onMutate, onSuccess, o
|
|
|
95
88
|
import { createUseQuery } from "soda-tanstack-query"
|
|
96
89
|
|
|
97
90
|
import { ${name}Action } from "@/actions/${join(dir, name)}"
|
|
98
|
-
|
|
99
|
-
${
|
|
100
|
-
` : ""}
|
|
101
|
-
export const ${name}Client = createRequestFn(${hasSchema ? `{
|
|
102
|
-
fn: ${name}Action,
|
|
103
|
-
schema: ${match[1]},
|
|
104
|
-
}` : `{
|
|
105
|
-
fn: ${name}Action,
|
|
106
|
-
}`})
|
|
91
|
+
|
|
92
|
+
export const ${name}Client = createRequestFn(${name}Action)
|
|
107
93
|
|
|
108
94
|
export function ${name}ClientOptional(id?: ${hasSchema ? `${match[1].replace(/Schema$/, "Params").replace(/^./, (char)=>char.toUpperCase())} | ` : ""}undefined | null) {
|
|
109
95
|
return isNonNullable(id) ? ${name}Client(id) : null
|
|
@@ -118,15 +104,8 @@ export const use${upName} = createUseQuery({
|
|
|
118
104
|
import { createUseQuery } from "soda-tanstack-query"
|
|
119
105
|
|
|
120
106
|
import { ${name}Action } from "@/actions/${join(dir, name)}"
|
|
121
|
-
|
|
122
|
-
${
|
|
123
|
-
` : ""}
|
|
124
|
-
export const ${name}Client = createRequestFn(${hasSchema ? `{
|
|
125
|
-
fn: ${name}Action,
|
|
126
|
-
schema: ${match[1]},
|
|
127
|
-
}` : `{
|
|
128
|
-
fn: ${name}Action,
|
|
129
|
-
}`})
|
|
107
|
+
|
|
108
|
+
export const ${name}Client = createRequestFn(${name}Action)
|
|
130
109
|
|
|
131
110
|
export const use${upName} = createUseQuery({
|
|
132
111
|
queryKey: "${key}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdnext",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@inquirer/prompts": "^8.1.0",
|
|
42
42
|
"chokidar": "^5.0.0",
|
|
43
43
|
"commander": "^14.0.2",
|
|
44
|
-
"deepsea-tools": "5.47.
|
|
44
|
+
"deepsea-tools": "5.47.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@types/node": "^24.10.
|
|
47
|
+
"@types/node": "^24.10.14",
|
|
48
48
|
"typescript": ">=5.8.3"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
package/src/utils/hook.ts
CHANGED
|
@@ -58,23 +58,8 @@ import { useMutation, UseMutationOptions } from "@tanstack/react-query"
|
|
|
58
58
|
import { createRequestFn } from "deepsea-tools"
|
|
59
59
|
|
|
60
60
|
import { ${name}Action } from "@/actions/${join(dir, name)}"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
? `
|
|
64
|
-
${match[0]}
|
|
65
|
-
`
|
|
66
|
-
: ""
|
|
67
|
-
}
|
|
68
|
-
export const ${name}Client = createRequestFn(${
|
|
69
|
-
hasSchema
|
|
70
|
-
? `{
|
|
71
|
-
fn: ${name}Action,
|
|
72
|
-
schema: ${match[1]},
|
|
73
|
-
}`
|
|
74
|
-
: `{
|
|
75
|
-
fn: ${name}Action,
|
|
76
|
-
}`
|
|
77
|
-
})
|
|
61
|
+
|
|
62
|
+
export const ${name}Client = createRequestFn(${name}Action)
|
|
78
63
|
|
|
79
64
|
export interface Use${upName}Params<TOnMutateResult = unknown> extends Omit<
|
|
80
65
|
UseMutationOptions<Awaited<ReturnType<typeof ${name}Client>>, Error, Parameters<typeof ${name}Client>[0], TOnMutateResult>,
|
|
@@ -125,23 +110,8 @@ export function use${upName}<TOnMutateResult = unknown>({ onMutate, onSuccess, o
|
|
|
125
110
|
import { createUseQuery } from "soda-tanstack-query"
|
|
126
111
|
|
|
127
112
|
import { ${name}Action } from "@/actions/${join(dir, name)}"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
? `
|
|
131
|
-
${match[0].replace(match[1], `${match[1].replace(/Schema$/, "Params").replace(/^./, char => char.toUpperCase())}, ${match[1]}`)}
|
|
132
|
-
`
|
|
133
|
-
: ""
|
|
134
|
-
}
|
|
135
|
-
export const ${name}Client = createRequestFn(${
|
|
136
|
-
hasSchema
|
|
137
|
-
? `{
|
|
138
|
-
fn: ${name}Action,
|
|
139
|
-
schema: ${match[1]},
|
|
140
|
-
}`
|
|
141
|
-
: `{
|
|
142
|
-
fn: ${name}Action,
|
|
143
|
-
}`
|
|
144
|
-
})
|
|
113
|
+
|
|
114
|
+
export const ${name}Client = createRequestFn(${name}Action)
|
|
145
115
|
|
|
146
116
|
export function ${name}ClientOptional(id?: ${hasSchema ? `${match[1].replace(/Schema$/, "Params").replace(/^./, char => char.toUpperCase())} | ` : ""}undefined | null) {
|
|
147
117
|
return isNonNullable(id) ? ${name}Client(id) : null
|
|
@@ -157,23 +127,8 @@ export const use${upName} = createUseQuery({
|
|
|
157
127
|
import { createUseQuery } from "soda-tanstack-query"
|
|
158
128
|
|
|
159
129
|
import { ${name}Action } from "@/actions/${join(dir, name)}"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
? `
|
|
163
|
-
${match[0]}
|
|
164
|
-
`
|
|
165
|
-
: ""
|
|
166
|
-
}
|
|
167
|
-
export const ${name}Client = createRequestFn(${
|
|
168
|
-
hasSchema
|
|
169
|
-
? `{
|
|
170
|
-
fn: ${name}Action,
|
|
171
|
-
schema: ${match[1]},
|
|
172
|
-
}`
|
|
173
|
-
: `{
|
|
174
|
-
fn: ${name}Action,
|
|
175
|
-
}`
|
|
176
|
-
})
|
|
130
|
+
|
|
131
|
+
export const ${name}Client = createRequestFn(${name}Action)
|
|
177
132
|
|
|
178
133
|
export const use${upName} = createUseQuery({
|
|
179
134
|
queryKey: "${key}",
|