@promigence/sdk 0.1.0-beta.12 → 0.1.0-beta.14
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/caller.js +10 -0
- package/dist/cjs/caller.js +10 -0
- package/dist/cjs/client.d.ts +16 -6
- package/dist/cjs/client.js +1180 -1129
- package/dist/cjs/core.d.ts +1 -1
- package/dist/cjs/core.js +1 -1
- package/dist/cjs/dispatcher.d.ts +2 -0
- package/dist/cjs/dispatcher.js +5 -0
- package/dist/cjs/http2.d.ts +11 -0
- package/dist/cjs/http2.js +335 -71
- package/dist/cjs/keyed.d.ts +6 -0
- package/dist/cjs/keyed.js +59 -0
- package/dist/cjs/proxy.js +11 -0
- package/dist/cjs/sandbox.d.ts +3 -1
- package/dist/cjs/sandbox.js +33 -20
- package/dist/cjs/trace.d.ts +2 -0
- package/dist/cjs/trace.js +17 -0
- package/dist/cjs/transport-worker.js +83 -14
- package/dist/client.d.ts +16 -6
- package/dist/client.js +1179 -1127
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/dispatcher.d.ts +2 -0
- package/dist/dispatcher.js +5 -0
- package/dist/http2.d.ts +11 -0
- package/dist/http2.js +335 -72
- package/dist/keyed.d.ts +6 -0
- package/dist/keyed.js +55 -0
- package/dist/proxy.js +11 -0
- package/dist/sandbox.d.ts +3 -1
- package/dist/sandbox.js +33 -20
- package/dist/trace.d.ts +2 -0
- package/dist/trace.js +16 -0
- package/dist/transport-worker.js +83 -14
- package/package.json +1 -1
package/dist/cjs/core.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Promigence SDK — constants, error hierarchy and shared types. */
|
|
2
|
-
export declare const VERSION = "0.1.0-beta.
|
|
2
|
+
export declare const VERSION = "0.1.0-beta.14";
|
|
3
3
|
export declare const DOCS_URL = "https://promigence.ai";
|
|
4
4
|
/** The error reference; each code is an anchor on it (the API's `docs` link has the same form). */
|
|
5
5
|
export declare const ERRORS_DOCS_URL = "https://www.promigence.ai/docs/errors";
|
package/dist/cjs/core.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.fixBeyondMessage = fixBeyondMessage;
|
|
|
7
7
|
exports.previewsOff = previewsOff;
|
|
8
8
|
exports.exitForCode = exitForCode;
|
|
9
9
|
const hint_js_1 = require("./hint.js");
|
|
10
|
-
exports.VERSION = "0.1.0-beta.
|
|
10
|
+
exports.VERSION = "0.1.0-beta.14";
|
|
11
11
|
exports.DOCS_URL = "https://promigence.ai";
|
|
12
12
|
exports.ERRORS_DOCS_URL = "https://www.promigence.ai/docs/errors";
|
|
13
13
|
exports.DEFAULT_API_URL = "https://api.promigence.ai/v1";
|
package/dist/cjs/dispatcher.d.ts
CHANGED
|
@@ -48,6 +48,8 @@ interface Timeouts {
|
|
|
48
48
|
export declare function longRequestDispatcher(timeoutMs: number, base?: object | undefined): object | undefined;
|
|
49
49
|
/** Test and diagnostics view. Not part of the public API. */
|
|
50
50
|
export declare const __dispatcherInternals: {
|
|
51
|
+
/** How many times `longRequestDispatcher` has been asked (each request on the `fetch` path asks once). */
|
|
52
|
+
lookups(): number;
|
|
51
53
|
/** The timeouts a dispatcher of ours sets, or `undefined` for any other value. */
|
|
52
54
|
timeoutsOf(d: unknown): Timeouts | undefined;
|
|
53
55
|
/** The process's global dispatcher composed with exactly these timeouts (never cached). */
|
package/dist/cjs/dispatcher.js
CHANGED
|
@@ -52,7 +52,9 @@ function composeWith(base, ms) {
|
|
|
52
52
|
timeouts.set(d, { headersTimeout: ms, bodyTimeout: ms });
|
|
53
53
|
return d;
|
|
54
54
|
}
|
|
55
|
+
let lookups = 0;
|
|
55
56
|
function longRequestDispatcher(timeoutMs, base = firstGlobalDispatcher()) {
|
|
57
|
+
lookups++;
|
|
56
58
|
try {
|
|
57
59
|
const needed = timeoutMs + exports.LONG_REQUEST_SLACK_MS;
|
|
58
60
|
if (!(needed > exports.FETCH_DEFAULT_TIMEOUT_MS))
|
|
@@ -78,6 +80,9 @@ function longRequestDispatcher(timeoutMs, base = firstGlobalDispatcher()) {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
exports.__dispatcherInternals = {
|
|
83
|
+
lookups() {
|
|
84
|
+
return lookups;
|
|
85
|
+
},
|
|
81
86
|
timeoutsOf(d) {
|
|
82
87
|
return d !== null && typeof d === "object" ? timeouts.get(d) : undefined;
|
|
83
88
|
},
|
package/dist/cjs/http2.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export interface Http2Init {
|
|
|
69
69
|
signal?: AbortSignal;
|
|
70
70
|
/** Read by `fetch` on fallback only. */
|
|
71
71
|
dispatcher?: object;
|
|
72
|
+
/** Worked out on fallback only, when no `dispatcher` was given: the one `fetch` should carry for `timeoutMs`. */
|
|
73
|
+
dispatcherFor?: (timeoutMs: number) => object | undefined;
|
|
72
74
|
/** Phase stamps when `PROMIGENCE_SDK_TRACE=1`. */
|
|
73
75
|
trace?: TraceStamp;
|
|
74
76
|
}
|
|
@@ -142,9 +144,13 @@ export declare class Http2Transport {
|
|
|
142
144
|
*/
|
|
143
145
|
fetch(url: string, init: Http2Init, replayable: boolean): Promise<Response | H2Response>;
|
|
144
146
|
}
|
|
147
|
+
/** The one `Http2Transport` for every client whose fallback is `fallback` (it keeps nothing of a client's). */
|
|
148
|
+
export declare function sharedTransport(fallback: FetchLike): Http2Transport;
|
|
145
149
|
export declare function warmTransport(): void;
|
|
146
150
|
/** Test and diagnostics view of the process-wide pools. Not part of the public API. */
|
|
147
151
|
export declare const __http2Internals: {
|
|
152
|
+
/** How many request URLs have been read (each new URL once; the same URL again is not read again). */
|
|
153
|
+
targetReads(): number;
|
|
148
154
|
pools(): Array<{
|
|
149
155
|
origin: string;
|
|
150
156
|
sessions: number;
|
|
@@ -181,6 +187,9 @@ export declare const __http2Internals: {
|
|
|
181
187
|
answered: number;
|
|
182
188
|
everReady: boolean;
|
|
183
189
|
closedReason: string;
|
|
190
|
+
messages: number;
|
|
191
|
+
posts: number;
|
|
192
|
+
startedAt: number;
|
|
184
193
|
} | undefined;
|
|
185
194
|
/** The transport thread's number of connections and spacing between new requests on one, for an environment (`threadKnobs`). */
|
|
186
195
|
threadKnobs(env: NodeJS.ProcessEnv): {
|
|
@@ -188,6 +197,8 @@ export declare const __http2Internals: {
|
|
|
188
197
|
gapUs: number;
|
|
189
198
|
pace: string;
|
|
190
199
|
};
|
|
200
|
+
/** Tests: make the transport thread stop answering (it reads nothing more), as a stuck one would. */
|
|
201
|
+
wedgeThreadForTest(): void;
|
|
191
202
|
/** Tests: make the transport thread fail as a crash would. */
|
|
192
203
|
crashThreadForTest(): void;
|
|
193
204
|
/** The early lookup, for tests: start one with a platform, DNS servers and hosts file of the test's own. */
|