@wspc/cli 0.0.15 → 0.0.17

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.ts CHANGED
@@ -197,12 +197,24 @@ type UpdateTodoBody = {
197
197
  };
198
198
  type ProjectCreateData = {
199
199
  body?: CreateProjectBody;
200
+ headers?: {
201
+ /**
202
+ * Optional opaque consistency bookmark returned by a previous todo response. Send it back unchanged to continue read-after-write consistency for todo D1 data.
203
+ */
204
+ 'x-cb-todo'?: string;
205
+ };
200
206
  path?: never;
201
207
  query?: never;
202
208
  url: '/todo/projects';
203
209
  };
204
210
  type RecurrenceRuleListData = {
205
211
  body?: never;
212
+ headers?: {
213
+ /**
214
+ * Optional opaque consistency bookmark returned by a previous todo response. Send it back unchanged to continue read-after-write consistency for todo D1 data.
215
+ */
216
+ 'x-cb-todo'?: string;
217
+ };
206
218
  path?: never;
207
219
  query: {
208
220
  /**
@@ -215,6 +227,12 @@ type RecurrenceRuleListData = {
215
227
  };
216
228
  type TodoListData = {
217
229
  body?: never;
230
+ headers?: {
231
+ /**
232
+ * Optional opaque consistency bookmark returned by a previous todo response. Send it back unchanged to continue read-after-write consistency for todo D1 data.
233
+ */
234
+ 'x-cb-todo'?: string;
235
+ };
218
236
  path?: never;
219
237
  query: {
220
238
  /**
@@ -245,12 +263,24 @@ type TodoListData = {
245
263
  };
246
264
  type TodoCreateData = {
247
265
  body?: CreateTodoBody;
266
+ headers?: {
267
+ /**
268
+ * Optional opaque consistency bookmark returned by a previous todo response. Send it back unchanged to continue read-after-write consistency for todo D1 data.
269
+ */
270
+ 'x-cb-todo'?: string;
271
+ };
248
272
  path?: never;
249
273
  query?: never;
250
274
  url: '/todo/items';
251
275
  };
252
276
  type TodoTypeListData = {
253
277
  body?: never;
278
+ headers?: {
279
+ /**
280
+ * Optional opaque consistency bookmark returned by a previous todo response. Send it back unchanged to continue read-after-write consistency for todo D1 data.
281
+ */
282
+ 'x-cb-todo'?: string;
283
+ };
254
284
  path?: never;
255
285
  query: {
256
286
  /**
@@ -264,6 +294,12 @@ type TodoTypeListData = {
264
294
  };
265
295
  type TodoUpdateData = {
266
296
  body?: UpdateTodoBody;
297
+ headers?: {
298
+ /**
299
+ * Optional opaque consistency bookmark returned by a previous todo response. Send it back unchanged to continue read-after-write consistency for todo D1 data.
300
+ */
301
+ 'x-cb-todo'?: string;
302
+ };
267
303
  path: {
268
304
  id: string;
269
305
  };
@@ -585,9 +621,9 @@ interface TDataShape {
585
621
  type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
586
622
  type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
587
623
 
588
- declare const VERSION = "0.0.15";
589
- declare const SPEC_SHA = "dac502bc";
590
- declare const SPEC_FETCHED_AT = "2026-06-15T16:41:41.264Z";
624
+ declare const VERSION = "0.0.17";
625
+ declare const SPEC_SHA = "d0ccc741";
626
+ declare const SPEC_FETCHED_AT = "2026-06-16T14:51:59.656Z";
591
627
  declare const API_BASE = "https://api.wspc.ai";
592
628
 
593
629
  type WspcClientOptions = {
package/dist/index.js CHANGED
@@ -783,7 +783,24 @@ var createClient = (config = {}) => {
783
783
  };
784
784
  };
785
785
 
786
+ // src/version.ts
787
+ var VERSION = "0.0.17";
788
+ var SPEC_SHA = "d0ccc741";
789
+ var SPEC_FETCHED_AT = "2026-06-16T14:51:59.656Z";
790
+ var API_BASE = "https://api.wspc.ai";
791
+
786
792
  // src/handwritten/auth/sdk-auth.ts
793
+ var USER_AGENT = `@wspc/cli/${VERSION}`;
794
+ async function expiredMessage(res) {
795
+ try {
796
+ const body = await res.clone().json();
797
+ if (!body.error) return void 0;
798
+ const detail = body.error_description ? `: ${body.error_description}` : "";
799
+ return `wspc token refresh failed (${body.error}${detail}); re-authenticate via \`wspc login\``;
800
+ } catch {
801
+ return void 0;
802
+ }
803
+ }
787
804
  function createAuthInterceptor(mode) {
788
805
  if ("apiKey" in mode) {
789
806
  const apiKey = mode.apiKey;
@@ -791,6 +808,7 @@ function createAuthInterceptor(mode) {
791
808
  return {
792
809
  async onRequest(req) {
793
810
  req.headers.set("authorization", `Bearer ${apiKey}`);
811
+ req.headers.set("user-agent", USER_AGENT);
794
812
  return req;
795
813
  },
796
814
  async execute(req) {
@@ -806,6 +824,7 @@ function createAuthInterceptor(mode) {
806
824
  return {
807
825
  async onRequest(req) {
808
826
  req.headers.set("authorization", `Bearer ${accessToken}`);
827
+ req.headers.set("user-agent", USER_AGENT);
809
828
  return req;
810
829
  },
811
830
  async execute(req) {
@@ -813,7 +832,10 @@ function createAuthInterceptor(mode) {
813
832
  if (first.status !== 401) return first;
814
833
  const refreshRes = await fetchImpl(`${mode.baseUrl}/auth/oauth/token`, {
815
834
  method: "POST",
816
- headers: { "content-type": "application/x-www-form-urlencoded" },
835
+ headers: {
836
+ "content-type": "application/x-www-form-urlencoded",
837
+ "user-agent": USER_AGENT
838
+ },
817
839
  body: new URLSearchParams({
818
840
  grant_type: "refresh_token",
819
841
  refresh_token: refreshToken,
@@ -821,7 +843,7 @@ function createAuthInterceptor(mode) {
821
843
  })
822
844
  });
823
845
  if (!refreshRes.ok) {
824
- throw new WspcAuthExpiredError();
846
+ throw new WspcAuthExpiredError(await expiredMessage(refreshRes));
825
847
  }
826
848
  const tokens = await refreshRes.json();
827
849
  accessToken = tokens.access_token;
@@ -902,12 +924,6 @@ var todoUpdate = (options) => (options.client ?? client).patch({
902
924
  }
903
925
  });
904
926
 
905
- // src/version.ts
906
- var VERSION = "0.0.15";
907
- var SPEC_SHA = "dac502bc";
908
- var SPEC_FETCHED_AT = "2026-06-15T16:41:41.264Z";
909
- var API_BASE = "https://api.wspc.ai";
910
-
911
927
  // src/index.ts
912
928
  var WspcAuthExpiredError = class extends Error {
913
929
  code = "WSPC_AUTH_EXPIRED";