@rine-network/core 0.3.4 → 0.4.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/README.md +7 -2
- package/dist/index.js +4 -1
- package/dist/src/http.d.ts +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,10 +63,15 @@ Config directory resolution (`resolveConfigDir`) uses a smart fallback: `RINE_CO
|
|
|
63
63
|
|
|
64
64
|
## License
|
|
65
65
|
|
|
66
|
-
[EUPL-1.2](
|
|
66
|
+
[EUPL-1.2](https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12)
|
|
67
|
+
|
|
68
|
+
## For AI Agents
|
|
69
|
+
|
|
70
|
+
- [Platform docs](https://rine.network/llms.txt)
|
|
71
|
+
- [Protocol](https://rine.network/protocol.md)
|
|
72
|
+
- [Encryption](https://rine.network/encryption.md)
|
|
67
73
|
|
|
68
74
|
## Links
|
|
69
75
|
|
|
70
76
|
- Website: [rine.network](https://rine.network)
|
|
71
|
-
- Protocol: [rine.network/protocol.md](https://rine.network/protocol.md)
|
|
72
77
|
- Source: [codeberg.org/rine/rine-core](https://codeberg.org/rine/rine-core)
|
package/dist/index.js
CHANGED
|
@@ -129,11 +129,13 @@ var HttpClient = class {
|
|
|
129
129
|
tokenFn;
|
|
130
130
|
canRefresh;
|
|
131
131
|
defaultHeaders;
|
|
132
|
+
defaultSignal;
|
|
132
133
|
constructor(opts) {
|
|
133
134
|
this.baseUrl = opts.apiUrl;
|
|
134
135
|
this.tokenFn = opts.tokenFn;
|
|
135
136
|
this.canRefresh = opts.canRefresh ?? true;
|
|
136
137
|
this.defaultHeaders = opts.defaultHeaders ?? {};
|
|
138
|
+
this.defaultSignal = opts.signal;
|
|
137
139
|
}
|
|
138
140
|
async request(method, path, body, params, extraHeaders) {
|
|
139
141
|
let url = this.baseUrl + path;
|
|
@@ -150,7 +152,8 @@ var HttpClient = class {
|
|
|
150
152
|
if (body !== void 0) headers["Content-Type"] = "application/json";
|
|
151
153
|
const init = {
|
|
152
154
|
method,
|
|
153
|
-
headers
|
|
155
|
+
headers,
|
|
156
|
+
signal: this.defaultSignal
|
|
154
157
|
};
|
|
155
158
|
if (body !== void 0) init.body = JSON.stringify(body);
|
|
156
159
|
return fetch(url, init);
|
package/dist/src/http.d.ts
CHANGED
|
@@ -7,12 +7,20 @@ export interface HttpClientOptions {
|
|
|
7
7
|
canRefresh?: boolean;
|
|
8
8
|
/** Headers injected on every request (e.g. X-Rine-Agent). */
|
|
9
9
|
defaultHeaders?: Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Default abort signal applied to every request made by this instance.
|
|
12
|
+
* Use one short-lived HttpClient per cancellation scope — e.g. one per
|
|
13
|
+
* SDK crypto operation. A fired signal propagates to fetch() as-is; the
|
|
14
|
+
* resulting AbortError is NOT wrapped in RineApiError.
|
|
15
|
+
*/
|
|
16
|
+
signal?: AbortSignal;
|
|
10
17
|
}
|
|
11
18
|
export declare class HttpClient {
|
|
12
19
|
private readonly baseUrl;
|
|
13
20
|
private readonly tokenFn;
|
|
14
21
|
private readonly canRefresh;
|
|
15
22
|
private readonly defaultHeaders;
|
|
23
|
+
private readonly defaultSignal;
|
|
16
24
|
constructor(opts: HttpClientOptions);
|
|
17
25
|
private request;
|
|
18
26
|
get(path: string, params?: Record<string, string | number | boolean>, extraHeaders?: Record<string, string>): Promise<unknown>;
|