@wspc/cli 0.0.14 → 0.0.16

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.
203
+ */
204
+ 'x-consistency-bookmark'?: 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.
215
+ */
216
+ 'x-consistency-bookmark'?: 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.
233
+ */
234
+ 'x-consistency-bookmark'?: 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.
269
+ */
270
+ 'x-consistency-bookmark'?: 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.
281
+ */
282
+ 'x-consistency-bookmark'?: 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.
300
+ */
301
+ 'x-consistency-bookmark'?: 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.14";
589
- declare const SPEC_SHA = "7842b7a9";
590
- declare const SPEC_FETCHED_AT = "2026-06-10T05:27:40.161Z";
624
+ declare const VERSION = "0.0.16";
625
+ declare const SPEC_SHA = "b505a817";
626
+ declare const SPEC_FETCHED_AT = "2026-06-16T07:42:43.911Z";
591
627
  declare const API_BASE = "https://api.wspc.ai";
592
628
 
593
629
  type WspcClientOptions = {
package/dist/index.js CHANGED
@@ -783,18 +783,37 @@ var createClient = (config = {}) => {
783
783
  };
784
784
  };
785
785
 
786
+ // src/version.ts
787
+ var VERSION = "0.0.16";
788
+ var SPEC_SHA = "b505a817";
789
+ var SPEC_FETCHED_AT = "2026-06-16T07:42:43.911Z";
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;
807
+ const fetchImpl2 = mode.fetchImpl ?? fetch;
790
808
  return {
791
809
  async onRequest(req) {
792
810
  req.headers.set("authorization", `Bearer ${apiKey}`);
811
+ req.headers.set("user-agent", USER_AGENT);
793
812
  return req;
794
813
  },
795
814
  async execute(req) {
796
815
  const out = await this.onRequest(req.clone());
797
- return fetch(out);
816
+ return fetchImpl2(out);
798
817
  }
799
818
  };
800
819
  }
@@ -805,6 +824,7 @@ function createAuthInterceptor(mode) {
805
824
  return {
806
825
  async onRequest(req) {
807
826
  req.headers.set("authorization", `Bearer ${accessToken}`);
827
+ req.headers.set("user-agent", USER_AGENT);
808
828
  return req;
809
829
  },
810
830
  async execute(req) {
@@ -812,7 +832,10 @@ function createAuthInterceptor(mode) {
812
832
  if (first.status !== 401) return first;
813
833
  const refreshRes = await fetchImpl(`${mode.baseUrl}/auth/oauth/token`, {
814
834
  method: "POST",
815
- headers: { "content-type": "application/x-www-form-urlencoded" },
835
+ headers: {
836
+ "content-type": "application/x-www-form-urlencoded",
837
+ "user-agent": USER_AGENT
838
+ },
816
839
  body: new URLSearchParams({
817
840
  grant_type: "refresh_token",
818
841
  refresh_token: refreshToken,
@@ -820,7 +843,7 @@ function createAuthInterceptor(mode) {
820
843
  })
821
844
  });
822
845
  if (!refreshRes.ok) {
823
- throw new WspcAuthExpiredError();
846
+ throw new WspcAuthExpiredError(await expiredMessage(refreshRes));
824
847
  }
825
848
  const tokens = await refreshRes.json();
826
849
  accessToken = tokens.access_token;
@@ -901,12 +924,6 @@ var todoUpdate = (options) => (options.client ?? client).patch({
901
924
  }
902
925
  });
903
926
 
904
- // src/version.ts
905
- var VERSION = "0.0.14";
906
- var SPEC_SHA = "7842b7a9";
907
- var SPEC_FETCHED_AT = "2026-06-10T05:27:40.161Z";
908
- var API_BASE = "https://api.wspc.ai";
909
-
910
927
  // src/index.ts
911
928
  var WspcAuthExpiredError = class extends Error {
912
929
  code = "WSPC_AUTH_EXPIRED";