@lessly/sdk-app 30.0.0 → 30.2.0

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as GeneratedClient } from './client.gen-BOjtovBR.cjs';
1
+ import { G as GeneratedClient } from './client.gen-C6_mJktu.cjs';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
4
  type ParamIn = 'path' | 'query' | 'body';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as GeneratedClient } from './client.gen-BOjtovBR.js';
1
+ import { G as GeneratedClient } from './client.gen-C6_mJktu.js';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
4
4
  type ParamIn = 'path' | 'query' | 'body';
package/dist/index.js CHANGED
@@ -87,7 +87,15 @@ async function executeRequest(opts, binding, input) {
87
87
  if (body !== void 0) headers.set("Content-Type", "application/json");
88
88
  if (MUTATING.has(binding.method)) {
89
89
  const token = (opts.getCsrfToken ?? readCsrfCookie)();
90
- if (token) headers.set("X-CSRF-Token", token);
90
+ if (!token) {
91
+ throw new LesslyApiError(
92
+ 0,
93
+ "csrf_cookie_missing",
94
+ `CSRF cookie "lessly_csrf" is missing; the session must be re-established before mutating requests (${binding.method} ${binding.path}).`,
95
+ null
96
+ );
97
+ }
98
+ headers.set("X-CSRF-Token", token);
91
99
  }
92
100
  const requestInit = { method: binding.method, headers, credentials: "include" };
93
101
  if (body !== void 0) requestInit.body = JSON.stringify(body);