@m1212e/rumble 0.15.3 → 0.15.4
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/out/index.cjs +10 -9
- package/out/index.cjs.map +1 -1
- package/out/index.mjs +10 -9
- package/out/index.mjs.map +1 -1
- package/package.json +1 -1
package/out/index.mjs
CHANGED
|
@@ -252,9 +252,8 @@ function makeGraphQLQueryRequest({ queryName, input, client, enableSubscription
|
|
|
252
252
|
return promise;
|
|
253
253
|
}
|
|
254
254
|
function makeGraphQLMutationRequest({ mutationName, input, client, forceReactivity }) {
|
|
255
|
-
const
|
|
256
|
-
const
|
|
257
|
-
const response = pipe(client.mutation(`mutation ${otwMutationName} { ${mutationName}${argsString} { ${stringifySelection(input)} }}`, {}), map((v) => {
|
|
255
|
+
const operationString = `mutation ${`${capitalize(mutationName)}Mutation`} { ${mutationName}${stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {})} { ${stringifySelection(input)} }}`;
|
|
256
|
+
const response = pipe(client.mutation(operationString, {}), map((v) => {
|
|
258
257
|
const data = v.data?.[mutationName];
|
|
259
258
|
if (!data && v.error) throw v.error;
|
|
260
259
|
return data;
|
|
@@ -265,9 +264,8 @@ function makeGraphQLMutationRequest({ mutationName, input, client, forceReactivi
|
|
|
265
264
|
return promise;
|
|
266
265
|
}
|
|
267
266
|
function makeGraphQLSubscriptionRequest({ subscriptionName, input, client, forceReactivity }) {
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
return pipe(client.subscription(`subscription ${otwSubscriptionName} { ${subscriptionName}${argsString} { ${stringifySelection(input)} }}`, {}), map((v) => {
|
|
267
|
+
const operationString = `subscription ${`${capitalize(subscriptionName)}Subscription`} { ${subscriptionName}${stringifyArgumentObjectToGraphqlList(input[argsKey] ?? {})} { ${stringifySelection(input)} }}`;
|
|
268
|
+
return pipe(client.subscription(operationString, {}), map((v) => {
|
|
271
269
|
const data = v.data?.[subscriptionName];
|
|
272
270
|
if (!data && v.error) throw v.error;
|
|
273
271
|
return data;
|
|
@@ -282,7 +280,8 @@ function stringifySelection(selection) {
|
|
|
282
280
|
`;
|
|
283
281
|
return acc;
|
|
284
282
|
}
|
|
285
|
-
acc += `${key} {
|
|
283
|
+
acc += `${key} {
|
|
284
|
+
${stringifySelection(value)} }
|
|
286
285
|
`;
|
|
287
286
|
} else acc += `${key}
|
|
288
287
|
`;
|
|
@@ -291,11 +290,13 @@ function stringifySelection(selection) {
|
|
|
291
290
|
}
|
|
292
291
|
function stringifyArgumentObjectToGraphqlList(args) {
|
|
293
292
|
const entries = Object.entries(args);
|
|
294
|
-
if (
|
|
295
|
-
return `(${entries.map(([key, value]) => `${key}: ${stringifyArgumentValue(value)}`).join(", ")})`;
|
|
293
|
+
if (Array.isArray(args)) return `(${stringifyArgumentValue(args)})`;
|
|
294
|
+
if (entries.length > 0) return `(${entries.map(([key, value]) => `${key}: ${stringifyArgumentValue(value)}`).join(", ")})`;
|
|
295
|
+
return "";
|
|
296
296
|
}
|
|
297
297
|
function stringifyArgumentValue(arg) {
|
|
298
298
|
if (arg === null) return "null";
|
|
299
|
+
if (Array.isArray(arg)) return `[${arg.map(stringifyArgumentValue).join(", ")}]`;
|
|
299
300
|
switch (typeof arg) {
|
|
300
301
|
case "string": return `"${arg}"`;
|
|
301
302
|
case "number": return `${arg}`;
|