@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.
@@ -1,5 +1,5 @@
1
1
  /** Promigence SDK — constants, error hierarchy and shared types. */
2
- export declare const VERSION = "0.1.0-beta.12";
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.12";
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";
@@ -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). */
@@ -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
  },
@@ -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. */