@corti/sdk 0.10.0-rc.3 → 0.10.0-rc.5
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/cjs/Client.js +2 -2
- package/dist/cjs/custom/utils/encodeHeadersAsWsProtocols.d.ts +2 -1
- package/dist/cjs/custom/utils/encodeHeadersAsWsProtocols.js +18 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/custom/utils/encodeHeadersAsWsProtocols.d.mts +2 -1
- package/dist/esm/custom/utils/encodeHeadersAsWsProtocols.mjs +18 -4
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/Client.js
CHANGED
|
@@ -65,8 +65,8 @@ class CortiClient {
|
|
|
65
65
|
"Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
|
|
66
66
|
"X-Fern-Language": "JavaScript",
|
|
67
67
|
"X-Fern-SDK-Name": "@corti/sdk",
|
|
68
|
-
"X-Fern-SDK-Version": "0.10.0-rc.
|
|
69
|
-
"User-Agent": "@corti/sdk/0.10.0-rc.
|
|
68
|
+
"X-Fern-SDK-Version": "0.10.0-rc.5",
|
|
69
|
+
"User-Agent": "@corti/sdk/0.10.0-rc.5",
|
|
70
70
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
71
71
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
72
72
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -6,8 +6,9 @@ import type { CortiClient } from "../CortiClient.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* Patch: resolves header values (including suppliers/functions) and returns a flat array
|
|
8
8
|
* of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values.
|
|
9
|
+
* When filterSdkHeaders is true, SDK-added headers are excluded (use for merged client headers).
|
|
9
10
|
*/
|
|
10
|
-
export declare function buildProtocolsFromHeaders(headers: CortiClient.HeadersRecord | undefined): Promise<string[]>;
|
|
11
|
+
export declare function buildProtocolsFromHeaders(headers: CortiClient.HeadersRecord | undefined, filterSdkHeaders?: boolean): Promise<string[]>;
|
|
11
12
|
/** Patch: options shape for getWsProtocols (encodeHeadersAsWsProtocols + headers). */
|
|
12
13
|
export type WsProtocolsOptions = {
|
|
13
14
|
encodeHeadersAsWsProtocols?: boolean;
|
|
@@ -49,17 +49,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
49
49
|
exports.buildProtocolsFromHeaders = buildProtocolsFromHeaders;
|
|
50
50
|
exports.getWsProtocols = getWsProtocols;
|
|
51
51
|
const core = __importStar(require("../../core/index.js"));
|
|
52
|
+
/** Patch: headers added by the SDK; exclude these when filterSdkHeaders is true (e.g. merged client headers). */
|
|
53
|
+
const SDK_HEADER_NAMES = new Set([
|
|
54
|
+
"Tenant-Name",
|
|
55
|
+
"X-Fern-Language",
|
|
56
|
+
"X-Fern-SDK-Name",
|
|
57
|
+
"X-Fern-SDK-Version",
|
|
58
|
+
"User-Agent",
|
|
59
|
+
"X-Fern-Runtime",
|
|
60
|
+
"X-Fern-Runtime-Version",
|
|
61
|
+
]);
|
|
52
62
|
/**
|
|
53
63
|
* Patch: resolves header values (including suppliers/functions) and returns a flat array
|
|
54
64
|
* of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values.
|
|
65
|
+
* When filterSdkHeaders is true, SDK-added headers are excluded (use for merged client headers).
|
|
55
66
|
*/
|
|
56
|
-
function buildProtocolsFromHeaders(
|
|
57
|
-
return __awaiter(this,
|
|
67
|
+
function buildProtocolsFromHeaders(headers_1) {
|
|
68
|
+
return __awaiter(this, arguments, void 0, function* (headers, filterSdkHeaders = false) {
|
|
58
69
|
if (!headers || Object.keys(headers).length === 0) {
|
|
59
70
|
return [];
|
|
60
71
|
}
|
|
61
72
|
const protocols = [];
|
|
62
73
|
for (const [name, valueOrSupplier] of Object.entries(headers)) {
|
|
74
|
+
if (filterSdkHeaders && SDK_HEADER_NAMES.has(name)) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
63
77
|
const value = yield core.Supplier.get(valueOrSupplier);
|
|
64
78
|
if (value != null && value !== "") {
|
|
65
79
|
protocols.push(name, encodeURIComponent(value));
|
|
@@ -75,13 +89,13 @@ function buildProtocolsFromHeaders(headers) {
|
|
|
75
89
|
function getWsProtocols(options, proxyProtocols) {
|
|
76
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
91
|
const headerProtocols = options.encodeHeadersAsWsProtocols && options.headers
|
|
78
|
-
? yield buildProtocolsFromHeaders(options.headers)
|
|
92
|
+
? yield buildProtocolsFromHeaders(options.headers, true)
|
|
79
93
|
: [];
|
|
80
94
|
const resolvedProxy = proxyProtocols == null
|
|
81
95
|
? []
|
|
82
96
|
: Array.isArray(proxyProtocols)
|
|
83
97
|
? proxyProtocols
|
|
84
|
-
: yield buildProtocolsFromHeaders(proxyProtocols);
|
|
98
|
+
: yield buildProtocolsFromHeaders(proxyProtocols, false);
|
|
85
99
|
const combined = [...headerProtocols, ...resolvedProxy];
|
|
86
100
|
return combined.length > 0 ? combined : [];
|
|
87
101
|
});
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.10.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "0.10.0-rc.5";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -29,8 +29,8 @@ export class CortiClient {
|
|
|
29
29
|
"Tenant-Name": _options === null || _options === void 0 ? void 0 : _options.tenantName,
|
|
30
30
|
"X-Fern-Language": "JavaScript",
|
|
31
31
|
"X-Fern-SDK-Name": "@corti/sdk",
|
|
32
|
-
"X-Fern-SDK-Version": "0.10.0-rc.
|
|
33
|
-
"User-Agent": "@corti/sdk/0.10.0-rc.
|
|
32
|
+
"X-Fern-SDK-Version": "0.10.0-rc.5",
|
|
33
|
+
"User-Agent": "@corti/sdk/0.10.0-rc.5",
|
|
34
34
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
35
35
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
36
36
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -6,8 +6,9 @@ import type { CortiClient } from "../CortiClient.mjs";
|
|
|
6
6
|
/**
|
|
7
7
|
* Patch: resolves header values (including suppliers/functions) and returns a flat array
|
|
8
8
|
* of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values.
|
|
9
|
+
* When filterSdkHeaders is true, SDK-added headers are excluded (use for merged client headers).
|
|
9
10
|
*/
|
|
10
|
-
export declare function buildProtocolsFromHeaders(headers: CortiClient.HeadersRecord | undefined): Promise<string[]>;
|
|
11
|
+
export declare function buildProtocolsFromHeaders(headers: CortiClient.HeadersRecord | undefined, filterSdkHeaders?: boolean): Promise<string[]>;
|
|
11
12
|
/** Patch: options shape for getWsProtocols (encodeHeadersAsWsProtocols + headers). */
|
|
12
13
|
export type WsProtocolsOptions = {
|
|
13
14
|
encodeHeadersAsWsProtocols?: boolean;
|
|
@@ -12,17 +12,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
import * as core from "../../core/index.mjs";
|
|
15
|
+
/** Patch: headers added by the SDK; exclude these when filterSdkHeaders is true (e.g. merged client headers). */
|
|
16
|
+
const SDK_HEADER_NAMES = new Set([
|
|
17
|
+
"Tenant-Name",
|
|
18
|
+
"X-Fern-Language",
|
|
19
|
+
"X-Fern-SDK-Name",
|
|
20
|
+
"X-Fern-SDK-Version",
|
|
21
|
+
"User-Agent",
|
|
22
|
+
"X-Fern-Runtime",
|
|
23
|
+
"X-Fern-Runtime-Version",
|
|
24
|
+
]);
|
|
15
25
|
/**
|
|
16
26
|
* Patch: resolves header values (including suppliers/functions) and returns a flat array
|
|
17
27
|
* of [name, encodeURIComponent(value)] for each header, skipping undefined/empty values.
|
|
28
|
+
* When filterSdkHeaders is true, SDK-added headers are excluded (use for merged client headers).
|
|
18
29
|
*/
|
|
19
|
-
export function buildProtocolsFromHeaders(
|
|
20
|
-
return __awaiter(this,
|
|
30
|
+
export function buildProtocolsFromHeaders(headers_1) {
|
|
31
|
+
return __awaiter(this, arguments, void 0, function* (headers, filterSdkHeaders = false) {
|
|
21
32
|
if (!headers || Object.keys(headers).length === 0) {
|
|
22
33
|
return [];
|
|
23
34
|
}
|
|
24
35
|
const protocols = [];
|
|
25
36
|
for (const [name, valueOrSupplier] of Object.entries(headers)) {
|
|
37
|
+
if (filterSdkHeaders && SDK_HEADER_NAMES.has(name)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
26
40
|
const value = yield core.Supplier.get(valueOrSupplier);
|
|
27
41
|
if (value != null && value !== "") {
|
|
28
42
|
protocols.push(name, encodeURIComponent(value));
|
|
@@ -38,13 +52,13 @@ export function buildProtocolsFromHeaders(headers) {
|
|
|
38
52
|
export function getWsProtocols(options, proxyProtocols) {
|
|
39
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
54
|
const headerProtocols = options.encodeHeadersAsWsProtocols && options.headers
|
|
41
|
-
? yield buildProtocolsFromHeaders(options.headers)
|
|
55
|
+
? yield buildProtocolsFromHeaders(options.headers, true)
|
|
42
56
|
: [];
|
|
43
57
|
const resolvedProxy = proxyProtocols == null
|
|
44
58
|
? []
|
|
45
59
|
: Array.isArray(proxyProtocols)
|
|
46
60
|
? proxyProtocols
|
|
47
|
-
: yield buildProtocolsFromHeaders(proxyProtocols);
|
|
61
|
+
: yield buildProtocolsFromHeaders(proxyProtocols, false);
|
|
48
62
|
const combined = [...headerProtocols, ...resolvedProxy];
|
|
49
63
|
return combined.length > 0 ? combined : [];
|
|
50
64
|
});
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.10.0-rc.
|
|
1
|
+
export declare const SDK_VERSION = "0.10.0-rc.5";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.10.0-rc.
|
|
1
|
+
export const SDK_VERSION = "0.10.0-rc.5";
|