routesync 1.0.8 → 1.0.10

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/cli.js CHANGED
@@ -8785,10 +8785,10 @@ var NextActionGenerator = class {
8785
8785
  lines.push(`import { cookies } from 'next/headers'`);
8786
8786
  lines.push(``);
8787
8787
  lines.push(`// Helper to auto-inject token from cookies if available`);
8788
- lines.push(`async function getAuthHeaders() {`);
8788
+ lines.push(`async function getAuthHeaders(): Promise<Record<string, string> | undefined> {`);
8789
8789
  lines.push(` const cookieStore = await cookies()`);
8790
8790
  lines.push(` const token = cookieStore.get('token')?.value`);
8791
- lines.push(` return token ? { Authorization: \`Bearer \${token}\` } : {}`);
8791
+ lines.push(` return token ? { Authorization: \`Bearer \${token}\` } : undefined`);
8792
8792
  lines.push(`}`);
8793
8793
  lines.push(``);
8794
8794
  const grouped = buildGeneratedRoutes(manifest.routes);
package/dist/react.d.mts CHANGED
@@ -42,6 +42,7 @@ type CallOptions = {
42
42
  params?: Record<string, any>;
43
43
  query?: Record<string, any>;
44
44
  body?: Record<string, any>;
45
+ headers?: Record<string, string>;
45
46
  };
46
47
  interface EndpointCallable {
47
48
  (options?: CallOptions): Promise<any>;
package/dist/react.d.ts CHANGED
@@ -42,6 +42,7 @@ type CallOptions = {
42
42
  params?: Record<string, any>;
43
43
  query?: Record<string, any>;
44
44
  body?: Record<string, any>;
45
+ headers?: Record<string, string>;
45
46
  };
46
47
  interface EndpointCallable {
47
48
  (options?: CallOptions): Promise<any>;
package/dist/sdk.d.mts CHANGED
@@ -103,6 +103,7 @@ type CallOptions = {
103
103
  params?: Record<string, any>;
104
104
  query?: Record<string, any>;
105
105
  body?: Record<string, any>;
106
+ headers?: Record<string, string>;
106
107
  };
107
108
  interface EndpointCallable {
108
109
  (options?: CallOptions): Promise<any>;
package/dist/sdk.d.ts CHANGED
@@ -103,6 +103,7 @@ type CallOptions = {
103
103
  params?: Record<string, any>;
104
104
  query?: Record<string, any>;
105
105
  body?: Record<string, any>;
106
+ headers?: Record<string, string>;
106
107
  };
107
108
  interface EndpointCallable {
108
109
  (options?: CallOptions): Promise<any>;
package/dist/sdk.js CHANGED
@@ -280,7 +280,7 @@ function defineApi(definition, config) {
280
280
  );
281
281
  const resolvedPath = PathResolver.resolve(route.path, params);
282
282
  const method = route.method.toLowerCase();
283
- const requestConfig = { params: query, headers: route.headers };
283
+ const requestConfig = { params: query, headers: { ...route.headers, ...options?.headers } };
284
284
  let response;
285
285
  if (method === "get" || method === "delete") {
286
286
  response = await client[method](resolvedPath, requestConfig);
package/dist/sdk.mjs CHANGED
@@ -238,7 +238,7 @@ function defineApi(definition, config) {
238
238
  );
239
239
  const resolvedPath = PathResolver.resolve(route.path, params);
240
240
  const method = route.method.toLowerCase();
241
- const requestConfig = { params: query, headers: route.headers };
241
+ const requestConfig = { params: query, headers: { ...route.headers, ...options?.headers } };
242
242
  let response;
243
243
  if (method === "get" || method === "delete") {
244
244
  response = await client[method](resolvedPath, requestConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "routesync",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Laravel routes to typed frontend SDKs.",
5
5
  "main": "./dist/sdk.js",
6
6
  "module": "./dist/sdk.mjs",