@bobtail.software/b-ssr 1.0.10 → 1.0.11

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.
@@ -603,18 +603,18 @@ node_modules`),!r)return;let i=(0,Isr.default)({allowRelativePaths:!0}).add(r);r
603
603
  });
604
604
  if (routeModule.default) await routeModule.default(mockFastify);
605
605
  }
606
- ${l.map(f=>{let v=[];f.requiresArgs&&v.push("args"),v.push("ssrContext");let D=f.type==="rpc"?`
606
+ ${l.map(f=>{let v=[];f.requiresArgs&&v.push("args"),v.push("ssrContext");let D=f.requiresArgs?"args":"{}",C=f.type==="rpc"?`
607
607
  if (fn.isMultipart) throw new Error('RPC multipart no soportado en SSR.');
608
608
  await getOptionsMaps();
609
609
  const options = rpcOptionsMap.get('${f.url}');
610
- if (!options?.handler) throw new Error('Handler no encontrado para RPC: ${f.name}');
611
- const augmentedReq = Object.assign(Object.create(ssrContext.req), args);
610
+ if (!options?.handler) throw new Error('Handler no encontrado para RPC: ${f.name}');
611
+ const augmentedReq = Object.assign(Object.create(ssrContext.req), ${D});
612
612
  return await options.handler.call(ssrContext.req.server, augmentedReq, ssrContext.reply);
613
613
  `:`
614
614
  await getOptionsMaps();
615
615
  const options = renderOptionsMap.get('${f.url}');
616
616
  if (!options) throw new Error('Opciones loader no encontradas para: ${f.name}');
617
- const augmentedReq = Object.assign(Object.create(ssrContext.req), args || {});
617
+ const augmentedReq = Object.assign(Object.create(ssrContext.req), ${D});
618
618
  let customData = {};
619
619
  if (options.handler) customData = (await options.handler.call(ssrContext.req.server, augmentedReq, ssrContext.reply)) || {};
620
620
  if (ssrContext.reply.sent) return;
@@ -622,7 +622,7 @@ node_modules`),!r)return;let i=(0,Isr.default)({allowRelativePaths:!0}).add(r);r
622
622
  `;return`exports.${f.name} = async (${v.join(", ")}) => {
623
623
  try {
624
624
  if (!ssrContext?.req || !ssrContext?.reply) throw new Error('ssrContext requerido en ${f.name}. Aseg\xFArate de pasarlo en el loader: ${f.name}({ context })');
625
- ${D}
625
+ ${C}
626
626
  } catch (error) {
627
627
  if (ssrContext?.req?.log) {
628
628
  ssrContext.req.log.error({ err: error }, '\u274C [B-SSR Error] ${f.name}');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobtail.software/b-ssr",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Fastify + Vite SSR Plugin wrapper with RPC",
5
5
  "author": "Victor Moreno <info@bobtail.software> (https://bobtail.software)",
6
6
  "license": "GPL-3.0",