@zernio/node 0.2.543 → 0.2.544

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.mts CHANGED
@@ -53,6 +53,12 @@ declare class Zernio {
53
53
  * credentials.
54
54
  */
55
55
  private _client;
56
+ /**
57
+ * Wrapper around `_client` that `_bind` injects into operations. Identical
58
+ * to `_client` except that its HTTP methods strip the `client` selector from
59
+ * request options before dispatch (see `_stripClientSelector`).
60
+ */
61
+ private _dispatchClient;
56
62
  /**
57
63
  * API key used for authentication.
58
64
  */
@@ -68,6 +74,22 @@ declare class Zernio {
68
74
  * body runs.
69
75
  */
70
76
  private _bind;
77
+ /**
78
+ * TODO: remove once hey-api ships a fix for
79
+ * https://github.com/hey-api/hey-api/issues/4177 and we can upgrade.
80
+ *
81
+ * `_bind` injects the per-instance client into each operation's options
82
+ * under the `client` key, and the generated operations forward that whole
83
+ * options object to @hey-api/client-fetch, which spreads it into the fetch
84
+ * `RequestInit`. Node's undici ignores unknown init fields, but Deno defines
85
+ * its own `client` init option (a `Deno.HttpClient`) and validates it, so
86
+ * `new Request(...)` throws and every SDK call fails on Deno, Deno Deploy,
87
+ * and Supabase Edge Functions. The selector has already done its job by the
88
+ * time an HTTP method runs, so this wrapper strips it before hey-api builds
89
+ * the request. The real client is left untouched — config and interceptors
90
+ * still live on it, and the wrapper delegates everything else to it.
91
+ */
92
+ private static _stripClientSelector;
71
93
  /**
72
94
  * validate API
73
95
  */
package/dist/index.d.ts CHANGED
@@ -53,6 +53,12 @@ declare class Zernio {
53
53
  * credentials.
54
54
  */
55
55
  private _client;
56
+ /**
57
+ * Wrapper around `_client` that `_bind` injects into operations. Identical
58
+ * to `_client` except that its HTTP methods strip the `client` selector from
59
+ * request options before dispatch (see `_stripClientSelector`).
60
+ */
61
+ private _dispatchClient;
56
62
  /**
57
63
  * API key used for authentication.
58
64
  */
@@ -68,6 +74,22 @@ declare class Zernio {
68
74
  * body runs.
69
75
  */
70
76
  private _bind;
77
+ /**
78
+ * TODO: remove once hey-api ships a fix for
79
+ * https://github.com/hey-api/hey-api/issues/4177 and we can upgrade.
80
+ *
81
+ * `_bind` injects the per-instance client into each operation's options
82
+ * under the `client` key, and the generated operations forward that whole
83
+ * options object to @hey-api/client-fetch, which spreads it into the fetch
84
+ * `RequestInit`. Node's undici ignores unknown init fields, but Deno defines
85
+ * its own `client` init option (a `Deno.HttpClient`) and validates it, so
86
+ * `new Request(...)` throws and every SDK call fails on Deno, Deno Deploy,
87
+ * and Supabase Edge Functions. The selector has already done its job by the
88
+ * time an HTTP method runs, so this wrapper strips it before hey-api builds
89
+ * the request. The real client is left untouched — config and interceptors
90
+ * still live on it, and the wrapper delegates everything else to it.
91
+ */
92
+ private static _stripClientSelector;
71
93
  /**
72
94
  * validate API
73
95
  */
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
36
36
  // package.json
37
37
  var package_default = {
38
38
  name: "@zernio/node",
39
- version: "0.2.543",
39
+ version: "0.2.544",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
@@ -69,6 +69,7 @@ var package_default = {
69
69
  typecheck: "tsc --noEmit",
70
70
  test: "vitest run",
71
71
  "test:watch": "vitest",
72
+ "test:deno": "deno test --allow-read --allow-env tests/deno/smoke.ts",
72
73
  prepublishOnly: "npm run build",
73
74
  "fetch-spec": "curl -o openapi.yaml https://zernio.com/openapi.yaml"
74
75
  },
@@ -3792,7 +3793,7 @@ function parseApiError(response, body) {
3792
3793
  }
3793
3794
 
3794
3795
  // src/client.ts
3795
- var Zernio = class {
3796
+ var Zernio = class _Zernio {
3796
3797
  /**
3797
3798
  * Create a new Zernio API client.
3798
3799
  *
@@ -4917,6 +4918,7 @@ var Zernio = class {
4917
4918
  }
4918
4919
  })
4919
4920
  );
4921
+ this._dispatchClient = _Zernio._stripClientSelector(this._client);
4920
4922
  this._client.interceptors.request.use((request) => {
4921
4923
  request.headers.set("Authorization", `Bearer ${this.apiKey}`);
4922
4924
  return request;
@@ -4943,11 +4945,52 @@ var Zernio = class {
4943
4945
  return ((options) => {
4944
4946
  const withClient = { ...options };
4945
4947
  if (withClient["client"] === void 0) {
4946
- withClient["client"] = this._client;
4948
+ withClient["client"] = this._dispatchClient;
4947
4949
  }
4948
4950
  return operation(withClient);
4949
4951
  });
4950
4952
  }
4953
+ /**
4954
+ * TODO: remove once hey-api ships a fix for
4955
+ * https://github.com/hey-api/hey-api/issues/4177 and we can upgrade.
4956
+ *
4957
+ * `_bind` injects the per-instance client into each operation's options
4958
+ * under the `client` key, and the generated operations forward that whole
4959
+ * options object to @hey-api/client-fetch, which spreads it into the fetch
4960
+ * `RequestInit`. Node's undici ignores unknown init fields, but Deno defines
4961
+ * its own `client` init option (a `Deno.HttpClient`) and validates it, so
4962
+ * `new Request(...)` throws and every SDK call fails on Deno, Deno Deploy,
4963
+ * and Supabase Edge Functions. The selector has already done its job by the
4964
+ * time an HTTP method runs, so this wrapper strips it before hey-api builds
4965
+ * the request. The real client is left untouched — config and interceptors
4966
+ * still live on it, and the wrapper delegates everything else to it.
4967
+ */
4968
+ static _stripClientSelector(client2) {
4969
+ const wrapped = Object.create(client2);
4970
+ const methods = [
4971
+ "connect",
4972
+ "delete",
4973
+ "get",
4974
+ "head",
4975
+ "options",
4976
+ "patch",
4977
+ "post",
4978
+ "put",
4979
+ "trace"
4980
+ ];
4981
+ for (const method of methods) {
4982
+ const dispatch = client2[method];
4983
+ wrapped[method] = (requestOptions) => {
4984
+ if (requestOptions && "client" in requestOptions) {
4985
+ const sanitized = { ...requestOptions };
4986
+ delete sanitized["client"];
4987
+ return dispatch(sanitized);
4988
+ }
4989
+ return dispatch(requestOptions);
4990
+ };
4991
+ }
4992
+ return wrapped;
4993
+ }
4951
4994
  };
4952
4995
  var Late = Zernio;
4953
4996
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@zernio/node",
8
- version: "0.2.543",
8
+ version: "0.2.544",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
@@ -38,6 +38,7 @@ var package_default = {
38
38
  typecheck: "tsc --noEmit",
39
39
  test: "vitest run",
40
40
  "test:watch": "vitest",
41
+ "test:deno": "deno test --allow-read --allow-env tests/deno/smoke.ts",
41
42
  prepublishOnly: "npm run build",
42
43
  "fetch-spec": "curl -o openapi.yaml https://zernio.com/openapi.yaml"
43
44
  },
@@ -3761,7 +3762,7 @@ function parseApiError(response, body) {
3761
3762
  }
3762
3763
 
3763
3764
  // src/client.ts
3764
- var Zernio = class {
3765
+ var Zernio = class _Zernio {
3765
3766
  /**
3766
3767
  * Create a new Zernio API client.
3767
3768
  *
@@ -4886,6 +4887,7 @@ var Zernio = class {
4886
4887
  }
4887
4888
  })
4888
4889
  );
4890
+ this._dispatchClient = _Zernio._stripClientSelector(this._client);
4889
4891
  this._client.interceptors.request.use((request) => {
4890
4892
  request.headers.set("Authorization", `Bearer ${this.apiKey}`);
4891
4893
  return request;
@@ -4912,11 +4914,52 @@ var Zernio = class {
4912
4914
  return ((options) => {
4913
4915
  const withClient = { ...options };
4914
4916
  if (withClient["client"] === void 0) {
4915
- withClient["client"] = this._client;
4917
+ withClient["client"] = this._dispatchClient;
4916
4918
  }
4917
4919
  return operation(withClient);
4918
4920
  });
4919
4921
  }
4922
+ /**
4923
+ * TODO: remove once hey-api ships a fix for
4924
+ * https://github.com/hey-api/hey-api/issues/4177 and we can upgrade.
4925
+ *
4926
+ * `_bind` injects the per-instance client into each operation's options
4927
+ * under the `client` key, and the generated operations forward that whole
4928
+ * options object to @hey-api/client-fetch, which spreads it into the fetch
4929
+ * `RequestInit`. Node's undici ignores unknown init fields, but Deno defines
4930
+ * its own `client` init option (a `Deno.HttpClient`) and validates it, so
4931
+ * `new Request(...)` throws and every SDK call fails on Deno, Deno Deploy,
4932
+ * and Supabase Edge Functions. The selector has already done its job by the
4933
+ * time an HTTP method runs, so this wrapper strips it before hey-api builds
4934
+ * the request. The real client is left untouched — config and interceptors
4935
+ * still live on it, and the wrapper delegates everything else to it.
4936
+ */
4937
+ static _stripClientSelector(client2) {
4938
+ const wrapped = Object.create(client2);
4939
+ const methods = [
4940
+ "connect",
4941
+ "delete",
4942
+ "get",
4943
+ "head",
4944
+ "options",
4945
+ "patch",
4946
+ "post",
4947
+ "put",
4948
+ "trace"
4949
+ ];
4950
+ for (const method of methods) {
4951
+ const dispatch = client2[method];
4952
+ wrapped[method] = (requestOptions) => {
4953
+ if (requestOptions && "client" in requestOptions) {
4954
+ const sanitized = { ...requestOptions };
4955
+ delete sanitized["client"];
4956
+ return dispatch(sanitized);
4957
+ }
4958
+ return dispatch(requestOptions);
4959
+ };
4960
+ }
4961
+ return wrapped;
4962
+ }
4920
4963
  };
4921
4964
  var Late = Zernio;
4922
4965
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.543",
3
+ "version": "0.2.544",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -33,6 +33,7 @@
33
33
  "typecheck": "tsc --noEmit",
34
34
  "test": "vitest run",
35
35
  "test:watch": "vitest",
36
+ "test:deno": "deno test --allow-read --allow-env tests/deno/smoke.ts",
36
37
  "prepublishOnly": "npm run build",
37
38
  "fetch-spec": "curl -o openapi.yaml https://zernio.com/openapi.yaml"
38
39
  },
package/src/client.ts CHANGED
@@ -613,6 +613,13 @@ export class Zernio {
613
613
  */
614
614
  private _client!: Client;
615
615
 
616
+ /**
617
+ * Wrapper around `_client` that `_bind` injects into operations. Identical
618
+ * to `_client` except that its HTTP methods strip the `client` selector from
619
+ * request options before dispatch (see `_stripClientSelector`).
620
+ */
621
+ private _dispatchClient!: Client;
622
+
616
623
  /**
617
624
  * API key used for authentication.
618
625
  */
@@ -633,12 +640,56 @@ export class Zernio {
633
640
  return ((options?: Record<string, unknown>) => {
634
641
  const withClient = { ...options };
635
642
  if (withClient['client'] === undefined) {
636
- withClient['client'] = this._client;
643
+ withClient['client'] = this._dispatchClient;
637
644
  }
638
645
  return (operation as (opts: unknown) => unknown)(withClient);
639
646
  }) as F;
640
647
  }
641
648
 
649
+ /**
650
+ * TODO: remove once hey-api ships a fix for
651
+ * https://github.com/hey-api/hey-api/issues/4177 and we can upgrade.
652
+ *
653
+ * `_bind` injects the per-instance client into each operation's options
654
+ * under the `client` key, and the generated operations forward that whole
655
+ * options object to @hey-api/client-fetch, which spreads it into the fetch
656
+ * `RequestInit`. Node's undici ignores unknown init fields, but Deno defines
657
+ * its own `client` init option (a `Deno.HttpClient`) and validates it, so
658
+ * `new Request(...)` throws and every SDK call fails on Deno, Deno Deploy,
659
+ * and Supabase Edge Functions. The selector has already done its job by the
660
+ * time an HTTP method runs, so this wrapper strips it before hey-api builds
661
+ * the request. The real client is left untouched — config and interceptors
662
+ * still live on it, and the wrapper delegates everything else to it.
663
+ */
664
+ private static _stripClientSelector(client: Client): Client {
665
+ const wrapped = Object.create(client) as Client;
666
+ const methods = [
667
+ 'connect',
668
+ 'delete',
669
+ 'get',
670
+ 'head',
671
+ 'options',
672
+ 'patch',
673
+ 'post',
674
+ 'put',
675
+ 'trace',
676
+ ] as const;
677
+ for (const method of methods) {
678
+ const dispatch = client[method] as (requestOptions?: unknown) => unknown;
679
+ (wrapped as unknown as Record<string, unknown>)[method] = (
680
+ requestOptions?: Record<string, unknown>
681
+ ) => {
682
+ if (requestOptions && 'client' in requestOptions) {
683
+ const sanitized = { ...requestOptions };
684
+ delete sanitized['client'];
685
+ return dispatch(sanitized);
686
+ }
687
+ return dispatch(requestOptions);
688
+ };
689
+ }
690
+ return wrapped;
691
+ }
692
+
642
693
  /**
643
694
  * validate API
644
695
  */
@@ -1839,6 +1890,11 @@ export class Zernio {
1839
1890
  })
1840
1891
  );
1841
1892
 
1893
+ // Deno / WinterCG compatibility: operations dispatch through a wrapper
1894
+ // that strips the `client` selector from request options (see
1895
+ // `_stripClientSelector`).
1896
+ this._dispatchClient = Zernio._stripClientSelector(this._client);
1897
+
1842
1898
  // Add auth interceptor
1843
1899
  this._client.interceptors.request.use((request) => {
1844
1900
  request.headers.set('Authorization', `Bearer ${this.apiKey}`);