@cybermp/rpc-router-tanstack-query 0.1.0-rc.4 → 0.1.0-rc.6
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/index.cjs +10 -7
- package/dist/index.mjs +10 -7
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,9 @@ const parseClientCallRest = (...args) => {
|
|
|
27
27
|
let data;
|
|
28
28
|
let meta;
|
|
29
29
|
let options;
|
|
30
|
+
if (!args?.length) {
|
|
31
|
+
return { player, data, meta, options };
|
|
32
|
+
}
|
|
30
33
|
if (utils.CURRENT_ENVIRONMENT === definitions.MpEnv.SERVER) {
|
|
31
34
|
[player, data, meta, options] = args;
|
|
32
35
|
} else {
|
|
@@ -55,7 +58,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
55
58
|
);
|
|
56
59
|
}
|
|
57
60
|
const { data, meta, options: options2, player } = parseClientCallRest(
|
|
58
|
-
...optionsIn.input
|
|
61
|
+
...optionsIn.input ?? []
|
|
59
62
|
);
|
|
60
63
|
if (utils.CURRENT_ENVIRONMENT === definitions.MpEnv.SERVER) {
|
|
61
64
|
return client.call(player, data, meta, {
|
|
@@ -63,7 +66,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
63
66
|
signal
|
|
64
67
|
});
|
|
65
68
|
} else {
|
|
66
|
-
client.call(data, meta, {
|
|
69
|
+
return client.call(data, meta, {
|
|
67
70
|
...options2 ?? {},
|
|
68
71
|
signal
|
|
69
72
|
});
|
|
@@ -93,7 +96,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
93
96
|
);
|
|
94
97
|
}
|
|
95
98
|
const { data, meta, options: options2, player } = parseClientCallRest(
|
|
96
|
-
...optionsIn.input(pageParam)
|
|
99
|
+
...optionsIn.input(pageParam) ?? []
|
|
97
100
|
);
|
|
98
101
|
if (utils.CURRENT_ENVIRONMENT === definitions.MpEnv.SERVER) {
|
|
99
102
|
return client.call(player, data, meta, {
|
|
@@ -101,7 +104,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
101
104
|
signal
|
|
102
105
|
});
|
|
103
106
|
} else {
|
|
104
|
-
client.call(data, meta, {
|
|
107
|
+
return client.call(data, meta, {
|
|
105
108
|
...options2 ?? {},
|
|
106
109
|
signal
|
|
107
110
|
});
|
|
@@ -121,14 +124,14 @@ const createProcedureUtils = (client, options) => {
|
|
|
121
124
|
return {
|
|
122
125
|
mutationFn: (input) => {
|
|
123
126
|
const { data, meta, options: options2, player } = parseClientCallRest(
|
|
124
|
-
...input
|
|
127
|
+
...input ?? []
|
|
125
128
|
);
|
|
126
129
|
if (utils.CURRENT_ENVIRONMENT === definitions.MpEnv.SERVER) {
|
|
127
130
|
return client.call(player, data, meta, {
|
|
128
131
|
...options2 ?? {}
|
|
129
132
|
});
|
|
130
133
|
} else {
|
|
131
|
-
client.call(data, meta, {
|
|
134
|
+
return client.call(data, meta, {
|
|
132
135
|
...options2 ?? {}
|
|
133
136
|
});
|
|
134
137
|
}
|
|
@@ -141,7 +144,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
141
144
|
const mutationKey = this.mutationKey(optionsIn);
|
|
142
145
|
return {
|
|
143
146
|
mutationFn: (input) => {
|
|
144
|
-
client.trigger(...input);
|
|
147
|
+
client.trigger(...input ?? []);
|
|
145
148
|
},
|
|
146
149
|
...optionsIn,
|
|
147
150
|
mutationKey
|
package/dist/index.mjs
CHANGED
|
@@ -25,6 +25,9 @@ const parseClientCallRest = (...args) => {
|
|
|
25
25
|
let data;
|
|
26
26
|
let meta;
|
|
27
27
|
let options;
|
|
28
|
+
if (!args?.length) {
|
|
29
|
+
return { player, data, meta, options };
|
|
30
|
+
}
|
|
28
31
|
if (CURRENT_ENVIRONMENT === MpEnv.SERVER) {
|
|
29
32
|
[player, data, meta, options] = args;
|
|
30
33
|
} else {
|
|
@@ -53,7 +56,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
53
56
|
);
|
|
54
57
|
}
|
|
55
58
|
const { data, meta, options: options2, player } = parseClientCallRest(
|
|
56
|
-
...optionsIn.input
|
|
59
|
+
...optionsIn.input ?? []
|
|
57
60
|
);
|
|
58
61
|
if (CURRENT_ENVIRONMENT === MpEnv.SERVER) {
|
|
59
62
|
return client.call(player, data, meta, {
|
|
@@ -61,7 +64,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
61
64
|
signal
|
|
62
65
|
});
|
|
63
66
|
} else {
|
|
64
|
-
client.call(data, meta, {
|
|
67
|
+
return client.call(data, meta, {
|
|
65
68
|
...options2 ?? {},
|
|
66
69
|
signal
|
|
67
70
|
});
|
|
@@ -91,7 +94,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
91
94
|
);
|
|
92
95
|
}
|
|
93
96
|
const { data, meta, options: options2, player } = parseClientCallRest(
|
|
94
|
-
...optionsIn.input(pageParam)
|
|
97
|
+
...optionsIn.input(pageParam) ?? []
|
|
95
98
|
);
|
|
96
99
|
if (CURRENT_ENVIRONMENT === MpEnv.SERVER) {
|
|
97
100
|
return client.call(player, data, meta, {
|
|
@@ -99,7 +102,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
99
102
|
signal
|
|
100
103
|
});
|
|
101
104
|
} else {
|
|
102
|
-
client.call(data, meta, {
|
|
105
|
+
return client.call(data, meta, {
|
|
103
106
|
...options2 ?? {},
|
|
104
107
|
signal
|
|
105
108
|
});
|
|
@@ -119,14 +122,14 @@ const createProcedureUtils = (client, options) => {
|
|
|
119
122
|
return {
|
|
120
123
|
mutationFn: (input) => {
|
|
121
124
|
const { data, meta, options: options2, player } = parseClientCallRest(
|
|
122
|
-
...input
|
|
125
|
+
...input ?? []
|
|
123
126
|
);
|
|
124
127
|
if (CURRENT_ENVIRONMENT === MpEnv.SERVER) {
|
|
125
128
|
return client.call(player, data, meta, {
|
|
126
129
|
...options2 ?? {}
|
|
127
130
|
});
|
|
128
131
|
} else {
|
|
129
|
-
client.call(data, meta, {
|
|
132
|
+
return client.call(data, meta, {
|
|
130
133
|
...options2 ?? {}
|
|
131
134
|
});
|
|
132
135
|
}
|
|
@@ -139,7 +142,7 @@ const createProcedureUtils = (client, options) => {
|
|
|
139
142
|
const mutationKey = this.mutationKey(optionsIn);
|
|
140
143
|
return {
|
|
141
144
|
mutationFn: (input) => {
|
|
142
|
-
client.trigger(...input);
|
|
145
|
+
client.trigger(...input ?? []);
|
|
143
146
|
},
|
|
144
147
|
...optionsIn,
|
|
145
148
|
mutationKey
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cybermp/rpc-router-tanstack-query",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.6",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@tanstack/query-core": ">=5.80.2",
|
|
18
|
-
"@cybermp/rpc-core": "0.1.0-rc.
|
|
19
|
-
"@cybermp/rpc-router": "0.1.0-rc.
|
|
18
|
+
"@cybermp/rpc-core": "0.1.0-rc.6",
|
|
19
|
+
"@cybermp/rpc-router": "0.1.0-rc.6"
|
|
20
20
|
},
|
|
21
21
|
"unbuild": {
|
|
22
22
|
"failOnWarn": false
|