@mfxhub/sdk 0.2.0 → 0.2.1
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/CHANGELOG.md +8 -0
- package/dist/client.js +2 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/stream.js +5 -1
- package/dist/version.d.ts +4 -0
- package/dist/version.js +5 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ Every release of `@mfxhub/sdk`, newest first. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## 0.2.1
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Every request the SDK sends, and the stream's upgrade, carries
|
|
12
|
+
`User-Agent: mfx-sdk-typescript/<version>`, built from the package's own version, so MFX Hub can
|
|
13
|
+
tell which SDK and which version made each call.
|
|
14
|
+
|
|
7
15
|
## 0.2.0
|
|
8
16
|
|
|
9
17
|
### Added
|
package/dist/client.js
CHANGED
|
@@ -12,6 +12,7 @@ import { Catalog } from "./catalog.js";
|
|
|
12
12
|
import { Execution } from "./execution.js";
|
|
13
13
|
import { MfxStream } from "./stream.js";
|
|
14
14
|
import { Terminals } from "./terminals.js";
|
|
15
|
+
import { USER_AGENT } from "./version.js";
|
|
15
16
|
/** Default time a single request may take. */
|
|
16
17
|
export const DEFAULT_TIMEOUT_MS = 30_000;
|
|
17
18
|
/** How many times a rate-limited read is tried again. */
|
|
@@ -138,6 +139,7 @@ export class MfxClient {
|
|
|
138
139
|
const body = spec.body === undefined ? new Uint8Array() : Buffer.from(JSON.stringify(spec.body));
|
|
139
140
|
const headers = {
|
|
140
141
|
Accept: "application/json",
|
|
142
|
+
"User-Agent": USER_AGENT,
|
|
141
143
|
...this.#signer.headersFor(spec.method, url.pathname + url.search, body),
|
|
142
144
|
};
|
|
143
145
|
if (spec.body !== undefined)
|
package/dist/index.d.ts
CHANGED
|
@@ -25,5 +25,4 @@ export type { CreateTerminal, JournalLine, JournalOptions, PageOptions, Redundan
|
|
|
25
25
|
export { RequestSigner, SigningKey, signingMessage } from "./signing.js";
|
|
26
26
|
export { KEY_HEADER, NONCE_HEADER, SIGNATURE_HEADER, TIMESTAMP_HEADER } from "./signing.js";
|
|
27
27
|
export type { components, operations, paths } from "./generated/api.js";
|
|
28
|
-
|
|
29
|
-
export declare const VERSION = "0.2.0";
|
|
28
|
+
export { VERSION } from "./version.js";
|
package/dist/index.js
CHANGED
|
@@ -16,5 +16,4 @@ export { CLOSE_LIFETIME, CLOSE_REAUTHENTICATE, CLOSE_SLOW_CONSUMER, Channel, Cha
|
|
|
16
16
|
export { Terminals, isUsable } from "./terminals.js";
|
|
17
17
|
export { RequestSigner, SigningKey, signingMessage } from "./signing.js";
|
|
18
18
|
export { KEY_HEADER, NONCE_HEADER, SIGNATURE_HEADER, TIMESTAMP_HEADER } from "./signing.js";
|
|
19
|
-
|
|
20
|
-
export const VERSION = "0.2.0";
|
|
19
|
+
export { VERSION } from "./version.js";
|
package/dist/stream.js
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
// The upgrade is signed exactly as a REST request is, over `GET /v1/stream`.
|
|
24
24
|
import WebSocket from "ws";
|
|
25
25
|
import { AuthError, MfxError, MfxTransportError, errorFor } from "./errors.js";
|
|
26
|
+
import { USER_AGENT } from "./version.js";
|
|
26
27
|
/** The server says why it hung up. 4001 is the one reconnecting cannot fix. */
|
|
27
28
|
export const CLOSE_REAUTHENTICATE = 4001;
|
|
28
29
|
export const CLOSE_SLOW_CONSUMER = 4008;
|
|
@@ -225,7 +226,10 @@ export class MfxStream {
|
|
|
225
226
|
/** Opens the connection. {@link MfxClient.stream} does this for you. */
|
|
226
227
|
async open() {
|
|
227
228
|
const path = new URL(this.#url).pathname;
|
|
228
|
-
this.#connection = await this.#connect(this.#url,
|
|
229
|
+
this.#connection = await this.#connect(this.#url, {
|
|
230
|
+
...this.#client.signer.headersFor("GET", path),
|
|
231
|
+
"User-Agent": USER_AGENT,
|
|
232
|
+
});
|
|
229
233
|
return this;
|
|
230
234
|
}
|
|
231
235
|
/** Subscribe to one channel. Subscribing twice is not an error. */
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// This package's version, in one place: exported by the package, and named by every request.
|
|
2
|
+
/** This package's version. */
|
|
3
|
+
export const VERSION = "0.2.1";
|
|
4
|
+
/** What every request says it is, as a product token: the SDK's language and its version. */
|
|
5
|
+
export const USER_AGENT = `mfx-sdk-typescript/${VERSION}`;
|
package/package.json
CHANGED