@cybermp/rpc-router-tanstack-query 0.1.0-rc.3 → 0.1.0-rc.5

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 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, {
@@ -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, {
@@ -121,7 +124,7 @@ 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, {
@@ -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.d.cts CHANGED
@@ -1140,7 +1140,7 @@ type OperationKey<TType extends OperationType, TInput> = [
1140
1140
  path: readonly string[],
1141
1141
  options: OperationKeyOptions<TType, TInput>
1142
1142
  ];
1143
- type QueryKeyOptions<TInput> = (undefined extends TInput ? {
1143
+ type QueryKeyOptions<TInput> = (undefined extends TInput | (TInput extends any[] ? TInput[0] : never) ? {
1144
1144
  input?: TInput | SkipToken;
1145
1145
  } : {
1146
1146
  input: TInput | SkipToken;
package/dist/index.d.mts CHANGED
@@ -1140,7 +1140,7 @@ type OperationKey<TType extends OperationType, TInput> = [
1140
1140
  path: readonly string[],
1141
1141
  options: OperationKeyOptions<TType, TInput>
1142
1142
  ];
1143
- type QueryKeyOptions<TInput> = (undefined extends TInput ? {
1143
+ type QueryKeyOptions<TInput> = (undefined extends TInput | (TInput extends any[] ? TInput[0] : never) ? {
1144
1144
  input?: TInput | SkipToken;
1145
1145
  } : {
1146
1146
  input: TInput | SkipToken;
package/dist/index.d.ts CHANGED
@@ -1140,7 +1140,7 @@ type OperationKey<TType extends OperationType, TInput> = [
1140
1140
  path: readonly string[],
1141
1141
  options: OperationKeyOptions<TType, TInput>
1142
1142
  ];
1143
- type QueryKeyOptions<TInput> = (undefined extends TInput ? {
1143
+ type QueryKeyOptions<TInput> = (undefined extends TInput | (TInput extends any[] ? TInput[0] : never) ? {
1144
1144
  input?: TInput | SkipToken;
1145
1145
  } : {
1146
1146
  input: TInput | SkipToken;
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, {
@@ -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, {
@@ -119,7 +122,7 @@ 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, {
@@ -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",
3
+ "version": "0.1.0-rc.5",
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.3",
19
- "@cybermp/rpc-router": "0.1.0-rc.3"
18
+ "@cybermp/rpc-core": "0.1.0-rc.5",
19
+ "@cybermp/rpc-router": "0.1.0-rc.5"
20
20
  },
21
21
  "unbuild": {
22
22
  "failOnWarn": false