phenoml 17.9.0 → 17.10.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/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/core/runtime/index.d.ts +1 -1
- package/dist/cjs/core/runtime/index.js +2 -1
- package/dist/cjs/core/runtime/runtime.d.ts +19 -0
- package/dist/cjs/core/runtime/runtime.js +74 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/core/runtime/index.d.mts +1 -1
- package/dist/esm/core/runtime/index.mjs +1 -1
- package/dist/esm/core/runtime/runtime.d.mts +19 -0
- package/dist/esm/core/runtime/runtime.mjs +73 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/openapi/openapi.json +1 -1
- package/package.json +1 -1
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "phenoml",
|
|
46
|
-
"X-Fern-SDK-Version": "17.
|
|
47
|
-
"User-Agent": "phenoml/17.
|
|
46
|
+
"X-Fern-SDK-Version": "17.10.1",
|
|
47
|
+
"User-Agent": "phenoml/17.10.1",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RUNTIME } from "./runtime.js";
|
|
1
|
+
export { getUserAgent, RUNTIME } from "./runtime.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RUNTIME = void 0;
|
|
3
|
+
exports.RUNTIME = exports.getUserAgent = void 0;
|
|
4
4
|
var runtime_js_1 = require("./runtime.js");
|
|
5
|
+
Object.defineProperty(exports, "getUserAgent", { enumerable: true, get: function () { return runtime_js_1.getUserAgent; } });
|
|
5
6
|
Object.defineProperty(exports, "RUNTIME", { enumerable: true, get: function () { return runtime_js_1.RUNTIME; } });
|
|
@@ -6,4 +6,23 @@ export interface Runtime {
|
|
|
6
6
|
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
|
|
7
7
|
version?: string;
|
|
8
8
|
parsedVersion?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The operating system the SDK is running on, when it can be determined
|
|
11
|
+
* (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in
|
|
12
|
+
* environments where the OS is not observable (e.g. browsers).
|
|
13
|
+
*/
|
|
14
|
+
os?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The CPU architecture the SDK is running on, when it can be determined
|
|
17
|
+
* (e.g. "x64", "arm64" on server runtimes). Undefined in environments where
|
|
18
|
+
* the architecture is not observable (e.g. browsers).
|
|
19
|
+
*/
|
|
20
|
+
arch?: string;
|
|
9
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds a structured User-Agent string of the form
|
|
24
|
+
* `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
|
|
25
|
+
* where the platform group and runtime segment are omitted gracefully when the
|
|
26
|
+
* underlying values cannot be determined (e.g. in a browser).
|
|
27
|
+
*/
|
|
28
|
+
export declare function getUserAgent(sdkName: string, sdkVersion: string): string;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RUNTIME = void 0;
|
|
4
|
+
exports.getUserAgent = getUserAgent;
|
|
4
5
|
/**
|
|
5
6
|
* A constant that indicates which environment and version the SDK is running in.
|
|
6
7
|
*/
|
|
7
8
|
exports.RUNTIME = evaluateRuntime();
|
|
8
9
|
function evaluateRuntime() {
|
|
9
|
-
var _a, _b, _c, _d, _e;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
11
|
/**
|
|
11
12
|
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
12
13
|
*/
|
|
@@ -59,6 +60,8 @@ function evaluateRuntime() {
|
|
|
59
60
|
return {
|
|
60
61
|
type: "deno",
|
|
61
62
|
version: Deno.version.deno,
|
|
63
|
+
os: (_e = Deno.build) === null || _e === void 0 ? void 0 : _e.os,
|
|
64
|
+
arch: (_f = Deno.build) === null || _f === void 0 ? void 0 : _f.arch,
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
67
|
/**
|
|
@@ -69,6 +72,8 @@ function evaluateRuntime() {
|
|
|
69
72
|
return {
|
|
70
73
|
type: "bun",
|
|
71
74
|
version: Bun.version,
|
|
75
|
+
os: typeof process !== "undefined" ? process.platform : undefined,
|
|
76
|
+
arch: typeof process !== "undefined" ? process.arch : undefined,
|
|
72
77
|
};
|
|
73
78
|
}
|
|
74
79
|
/**
|
|
@@ -90,15 +95,82 @@ function evaluateRuntime() {
|
|
|
90
95
|
* Edge Runtime warns about Node.js APIs even when they are guarded).
|
|
91
96
|
*/
|
|
92
97
|
const _process = typeof process !== "undefined" ? process : undefined;
|
|
93
|
-
const isNode = typeof _process !== "undefined" && typeof ((
|
|
98
|
+
const isNode = typeof _process !== "undefined" && typeof ((_g = _process.versions) === null || _g === void 0 ? void 0 : _g.node) === "string";
|
|
94
99
|
if (isNode) {
|
|
95
100
|
return {
|
|
96
101
|
type: "node",
|
|
97
102
|
version: _process.versions.node,
|
|
98
103
|
parsedVersion: Number(_process.versions.node.split(".")[0]),
|
|
104
|
+
os: _process.platform,
|
|
105
|
+
arch: _process.arch,
|
|
99
106
|
};
|
|
100
107
|
}
|
|
101
108
|
return {
|
|
102
109
|
type: "unknown",
|
|
103
110
|
};
|
|
104
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Display names for the language runtimes whose version is meaningful to encode
|
|
114
|
+
* in a User-Agent. Environments where a version string is not useful (e.g.
|
|
115
|
+
* browsers, where `version` is the full navigator UA) are intentionally mapped
|
|
116
|
+
* to `undefined` so they are omitted from the User-Agent.
|
|
117
|
+
*/
|
|
118
|
+
const RUNTIME_DISPLAY_NAMES = {
|
|
119
|
+
node: "Node",
|
|
120
|
+
deno: "Deno",
|
|
121
|
+
bun: "Bun",
|
|
122
|
+
browser: undefined,
|
|
123
|
+
"web-worker": undefined,
|
|
124
|
+
"react-native": undefined,
|
|
125
|
+
workerd: undefined,
|
|
126
|
+
"edge-runtime": undefined,
|
|
127
|
+
unknown: undefined,
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* CPU architecture aliases that all refer to 64-bit x86. They are normalized to
|
|
131
|
+
* the single canonical token `x86_64` so the User-Agent architecture label is
|
|
132
|
+
* consistent regardless of which runtime reports it (Node reports `x64`, others
|
|
133
|
+
* report `amd64` or `x86_64`).
|
|
134
|
+
*/
|
|
135
|
+
const X86_64_ARCH_ALIASES = new Set(["x64", "amd64", "x86_64"]);
|
|
136
|
+
/**
|
|
137
|
+
* Normalizes a CPU architecture token, collapsing the 64-bit x86 aliases
|
|
138
|
+
* (`x64`, `amd64`, `x86_64`) to `x86_64`. Other architectures are returned
|
|
139
|
+
* unchanged.
|
|
140
|
+
*/
|
|
141
|
+
function normalizeArch(arch) {
|
|
142
|
+
if (arch == null) {
|
|
143
|
+
return arch;
|
|
144
|
+
}
|
|
145
|
+
return X86_64_ARCH_ALIASES.has(arch.toLowerCase()) ? "x86_64" : arch;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Percent-encodes the `@` and `/` characters in an npm package name so the
|
|
149
|
+
* User-Agent product token stays within the RFC 7230 token grammar. The
|
|
150
|
+
* original scoped package name can be recovered by URL-decoding (e.g.
|
|
151
|
+
* `@dummy/sdk` becomes `%40dummy%2Fsdk`).
|
|
152
|
+
*/
|
|
153
|
+
function encodeProductName(sdkName) {
|
|
154
|
+
return sdkName.replace(/@/g, "%40").replace(/\//g, "%2F");
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Builds a structured User-Agent string of the form
|
|
158
|
+
* `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
|
|
159
|
+
* where the platform group and runtime segment are omitted gracefully when the
|
|
160
|
+
* underlying values cannot be determined (e.g. in a browser).
|
|
161
|
+
*/
|
|
162
|
+
function getUserAgent(sdkName, sdkVersion) {
|
|
163
|
+
let userAgent = `${encodeProductName(sdkName)}/${sdkVersion}`;
|
|
164
|
+
const platform = [exports.RUNTIME.os, normalizeArch(exports.RUNTIME.arch)].filter((part) => part != null && part.length > 0);
|
|
165
|
+
if (platform.length > 0) {
|
|
166
|
+
userAgent += ` (${platform.join("; ")})`;
|
|
167
|
+
}
|
|
168
|
+
const runtimeName = RUNTIME_DISPLAY_NAMES[exports.RUNTIME.type];
|
|
169
|
+
if (runtimeName != null) {
|
|
170
|
+
userAgent += ` ${runtimeName}`;
|
|
171
|
+
if (exports.RUNTIME.version != null && exports.RUNTIME.version.length > 0) {
|
|
172
|
+
userAgent += `/${exports.RUNTIME.version}`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return userAgent;
|
|
176
|
+
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "17.
|
|
1
|
+
export declare const SDK_VERSION = "17.10.1";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "phenoml",
|
|
9
|
-
"X-Fern-SDK-Version": "17.
|
|
10
|
-
"User-Agent": "phenoml/17.
|
|
9
|
+
"X-Fern-SDK-Version": "17.10.1",
|
|
10
|
+
"User-Agent": "phenoml/17.10.1",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RUNTIME } from "./runtime.mjs";
|
|
1
|
+
export { getUserAgent, RUNTIME } from "./runtime.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RUNTIME } from "./runtime.mjs";
|
|
1
|
+
export { getUserAgent, RUNTIME } from "./runtime.mjs";
|
|
@@ -6,4 +6,23 @@ export interface Runtime {
|
|
|
6
6
|
type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime";
|
|
7
7
|
version?: string;
|
|
8
8
|
parsedVersion?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The operating system the SDK is running on, when it can be determined
|
|
11
|
+
* (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in
|
|
12
|
+
* environments where the OS is not observable (e.g. browsers).
|
|
13
|
+
*/
|
|
14
|
+
os?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The CPU architecture the SDK is running on, when it can be determined
|
|
17
|
+
* (e.g. "x64", "arm64" on server runtimes). Undefined in environments where
|
|
18
|
+
* the architecture is not observable (e.g. browsers).
|
|
19
|
+
*/
|
|
20
|
+
arch?: string;
|
|
9
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Builds a structured User-Agent string of the form
|
|
24
|
+
* `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
|
|
25
|
+
* where the platform group and runtime segment are omitted gracefully when the
|
|
26
|
+
* underlying values cannot be determined (e.g. in a browser).
|
|
27
|
+
*/
|
|
28
|
+
export declare function getUserAgent(sdkName: string, sdkVersion: string): string;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const RUNTIME = evaluateRuntime();
|
|
5
5
|
function evaluateRuntime() {
|
|
6
|
-
var _a, _b, _c, _d, _e;
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
7
7
|
/**
|
|
8
8
|
* A constant that indicates whether the environment the code is running is a Web Browser.
|
|
9
9
|
*/
|
|
@@ -56,6 +56,8 @@ function evaluateRuntime() {
|
|
|
56
56
|
return {
|
|
57
57
|
type: "deno",
|
|
58
58
|
version: Deno.version.deno,
|
|
59
|
+
os: (_e = Deno.build) === null || _e === void 0 ? void 0 : _e.os,
|
|
60
|
+
arch: (_f = Deno.build) === null || _f === void 0 ? void 0 : _f.arch,
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
@@ -66,6 +68,8 @@ function evaluateRuntime() {
|
|
|
66
68
|
return {
|
|
67
69
|
type: "bun",
|
|
68
70
|
version: Bun.version,
|
|
71
|
+
os: typeof process !== "undefined" ? process.platform : undefined,
|
|
72
|
+
arch: typeof process !== "undefined" ? process.arch : undefined,
|
|
69
73
|
};
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
@@ -87,15 +91,82 @@ function evaluateRuntime() {
|
|
|
87
91
|
* Edge Runtime warns about Node.js APIs even when they are guarded).
|
|
88
92
|
*/
|
|
89
93
|
const _process = typeof process !== "undefined" ? process : undefined;
|
|
90
|
-
const isNode = typeof _process !== "undefined" && typeof ((
|
|
94
|
+
const isNode = typeof _process !== "undefined" && typeof ((_g = _process.versions) === null || _g === void 0 ? void 0 : _g.node) === "string";
|
|
91
95
|
if (isNode) {
|
|
92
96
|
return {
|
|
93
97
|
type: "node",
|
|
94
98
|
version: _process.versions.node,
|
|
95
99
|
parsedVersion: Number(_process.versions.node.split(".")[0]),
|
|
100
|
+
os: _process.platform,
|
|
101
|
+
arch: _process.arch,
|
|
96
102
|
};
|
|
97
103
|
}
|
|
98
104
|
return {
|
|
99
105
|
type: "unknown",
|
|
100
106
|
};
|
|
101
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Display names for the language runtimes whose version is meaningful to encode
|
|
110
|
+
* in a User-Agent. Environments where a version string is not useful (e.g.
|
|
111
|
+
* browsers, where `version` is the full navigator UA) are intentionally mapped
|
|
112
|
+
* to `undefined` so they are omitted from the User-Agent.
|
|
113
|
+
*/
|
|
114
|
+
const RUNTIME_DISPLAY_NAMES = {
|
|
115
|
+
node: "Node",
|
|
116
|
+
deno: "Deno",
|
|
117
|
+
bun: "Bun",
|
|
118
|
+
browser: undefined,
|
|
119
|
+
"web-worker": undefined,
|
|
120
|
+
"react-native": undefined,
|
|
121
|
+
workerd: undefined,
|
|
122
|
+
"edge-runtime": undefined,
|
|
123
|
+
unknown: undefined,
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* CPU architecture aliases that all refer to 64-bit x86. They are normalized to
|
|
127
|
+
* the single canonical token `x86_64` so the User-Agent architecture label is
|
|
128
|
+
* consistent regardless of which runtime reports it (Node reports `x64`, others
|
|
129
|
+
* report `amd64` or `x86_64`).
|
|
130
|
+
*/
|
|
131
|
+
const X86_64_ARCH_ALIASES = new Set(["x64", "amd64", "x86_64"]);
|
|
132
|
+
/**
|
|
133
|
+
* Normalizes a CPU architecture token, collapsing the 64-bit x86 aliases
|
|
134
|
+
* (`x64`, `amd64`, `x86_64`) to `x86_64`. Other architectures are returned
|
|
135
|
+
* unchanged.
|
|
136
|
+
*/
|
|
137
|
+
function normalizeArch(arch) {
|
|
138
|
+
if (arch == null) {
|
|
139
|
+
return arch;
|
|
140
|
+
}
|
|
141
|
+
return X86_64_ARCH_ALIASES.has(arch.toLowerCase()) ? "x86_64" : arch;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Percent-encodes the `@` and `/` characters in an npm package name so the
|
|
145
|
+
* User-Agent product token stays within the RFC 7230 token grammar. The
|
|
146
|
+
* original scoped package name can be recovered by URL-decoding (e.g.
|
|
147
|
+
* `@dummy/sdk` becomes `%40dummy%2Fsdk`).
|
|
148
|
+
*/
|
|
149
|
+
function encodeProductName(sdkName) {
|
|
150
|
+
return sdkName.replace(/@/g, "%40").replace(/\//g, "%2F");
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Builds a structured User-Agent string of the form
|
|
154
|
+
* `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}`
|
|
155
|
+
* where the platform group and runtime segment are omitted gracefully when the
|
|
156
|
+
* underlying values cannot be determined (e.g. in a browser).
|
|
157
|
+
*/
|
|
158
|
+
export function getUserAgent(sdkName, sdkVersion) {
|
|
159
|
+
let userAgent = `${encodeProductName(sdkName)}/${sdkVersion}`;
|
|
160
|
+
const platform = [RUNTIME.os, normalizeArch(RUNTIME.arch)].filter((part) => part != null && part.length > 0);
|
|
161
|
+
if (platform.length > 0) {
|
|
162
|
+
userAgent += ` (${platform.join("; ")})`;
|
|
163
|
+
}
|
|
164
|
+
const runtimeName = RUNTIME_DISPLAY_NAMES[RUNTIME.type];
|
|
165
|
+
if (runtimeName != null) {
|
|
166
|
+
userAgent += ` ${runtimeName}`;
|
|
167
|
+
if (RUNTIME.version != null && RUNTIME.version.length > 0) {
|
|
168
|
+
userAgent += `/${RUNTIME.version}`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return userAgent;
|
|
172
|
+
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "17.
|
|
1
|
+
export declare const SDK_VERSION = "17.10.1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "17.
|
|
1
|
+
export const SDK_VERSION = "17.10.1";
|
package/openapi/openapi.json
CHANGED