contree-client 0.2.1 → 0.3.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/lib/client.d.ts CHANGED
@@ -34,13 +34,13 @@ export interface ContreeClientOptions {
34
34
  }
35
35
 
36
36
  export declare class ContreeClient {
37
- token: string;
37
+ token: string | null;
38
38
  baseUrl: string;
39
39
  project: string | null;
40
40
  timeout: number | null;
41
41
  retry: RetryPolicy | null;
42
42
  identity: string | null;
43
- constructor(token: string, options?: ContreeClientOptions);
43
+ constructor(token: string | null, options?: ContreeClientOptions);
44
44
  static fromProfile(
45
45
  profile?: string | Profile | null,
46
46
  options?: ContreeClientOptions & { configPath?: string | null },
package/lib/client.js CHANGED
@@ -39,6 +39,10 @@ import * as operations from "./operations.js";
39
39
  * unlike the Python adapters there is exactly one transport. Pass a
40
40
  * custom `fetch` implementation (undici dispatcher wrappers, MSW,
41
41
  * ...) via the constructor options to customize it.
42
+ *
43
+ * `token` may be null, like `project`: the client then sends no
44
+ * `Authorization` header, which is all the endpoints that need no
45
+ * authentication want.
42
46
  */
43
47
  export class ContreeClient {
44
48
  constructor(
@@ -59,7 +63,7 @@ export class ContreeClient {
59
63
  `unsupported baseUrl scheme ${parsed.protocol} in ${baseUrl}: use http:// or https://`,
60
64
  );
61
65
  }
62
- this.token = token;
66
+ this.token = token ?? null;
63
67
  this.baseUrl = baseUrl.replace(/\/+$/, "");
64
68
  this.project = project;
65
69
  this.timeout = timeout;
@@ -112,8 +116,11 @@ export class ContreeClient {
112
116
  }
113
117
 
114
118
  buildHeaders(spec) {
115
- const headers = { Authorization: `Bearer ${this.token}` };
116
- if (this.project !== null) {
119
+ const headers = {};
120
+ if (this.token) {
121
+ headers["Authorization"] = `Bearer ${this.token}`;
122
+ }
123
+ if (this.project) {
117
124
  headers["Project"] = this.project;
118
125
  }
119
126
  if (spec.contentType) {
package/lib/models.js CHANGED
@@ -585,7 +585,7 @@ export class StreamRepr {
585
585
  }
586
586
  }
587
587
 
588
- /** Stdin payload. Unlike output streams it is never truncated; */
588
+ /** Stdin payload. Delivery to the child is always complete */
589
589
  export class ClosableStreamRepr {
590
590
  constructor(fields = {}) {
591
591
  this.value = fields.value;
package/lib/runtime.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
 
15
15
  export const CHUNK_SIZE = 65536;
16
16
 
17
- export const PACKAGE_VERSION = "0.2.1";
17
+ export const PACKAGE_VERSION = "0.3.0";
18
18
  export const UA_PRODUCT = `contree-client-js/${PACKAGE_VERSION}`;
19
19
 
20
20
  const NODE_VERSION =
package/lib/specInfo.js CHANGED
@@ -5,4 +5,4 @@ export const DEFAULT_BASE_URL = "https://api.tokenfactory.nebius.com/sandboxes";
5
5
  // sha256 of the exact OpenAPI document this package was built
6
6
  // from - the build input provenance
7
7
  export const SPEC_SHA256 =
8
- "2bfd239341e6f61ccba1aafb39cef7b476d56f424156860a204f089d7d79b7bf";
8
+ "23d748a2918b1124b3072d54d17d8eb43aa00d0b969bc1fa718f34ac884ee887";
package/lib/testing.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare class ContreeClient extends GeneratedClient {
17
17
  mocks: Map<string, Outcome[]>;
18
18
  calls: Call[];
19
19
  constructedWith: {
20
- token: string;
20
+ token: string | null;
21
21
  baseUrl: string;
22
22
  project: string | null;
23
23
  timeout: number | null;
@@ -25,7 +25,7 @@ export declare class ContreeClient extends GeneratedClient {
25
25
  identity: string | null;
26
26
  };
27
27
  constructor(
28
- token?: string,
28
+ token?: string | null,
29
29
  options?: ConstructorParameters<typeof GeneratedClient>[1],
30
30
  );
31
31
  mock(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contree-client",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "JavaScript client for the Contree API, generated from the OpenAPI spec",
5
5
  "homepage": "https://contree.dev/",
6
6
  "repository": {