langsmith 0.0.31 → 0.0.32
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/schemas.d.ts +1 -0
- package/dist/utils/env.cjs +45 -1
- package/dist/utils/env.d.ts +10 -0
- package/dist/utils/env.js +43 -0
- package/package.json +1 -1
package/dist/schemas.d.ts
CHANGED
package/dist/utils/env.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setEnvironmentVariable = exports.getEnvironmentVariable = exports.getRuntimeEnvironment = exports.getEnv = exports.isNode = exports.isDeno = exports.isJsDom = exports.isWebWorker = exports.isBrowser = void 0;
|
|
3
|
+
exports.getShas = exports.setEnvironmentVariable = exports.getEnvironmentVariable = exports.getRuntimeEnvironment = exports.getEnv = exports.isNode = exports.isDeno = exports.isJsDom = exports.isWebWorker = exports.isBrowser = void 0;
|
|
4
4
|
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
5
5
|
exports.isBrowser = isBrowser;
|
|
6
6
|
const isWebWorker = () => typeof globalThis === "object" &&
|
|
@@ -49,9 +49,11 @@ let runtimeEnvironment;
|
|
|
49
49
|
async function getRuntimeEnvironment() {
|
|
50
50
|
if (runtimeEnvironment === undefined) {
|
|
51
51
|
const env = (0, exports.getEnv)();
|
|
52
|
+
const releaseEnv = getShas();
|
|
52
53
|
runtimeEnvironment = {
|
|
53
54
|
library: "langsmith",
|
|
54
55
|
runtime: env,
|
|
56
|
+
...releaseEnv,
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
59
|
return runtimeEnvironment;
|
|
@@ -78,3 +80,45 @@ function setEnvironmentVariable(name, value) {
|
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
exports.setEnvironmentVariable = setEnvironmentVariable;
|
|
83
|
+
let cachedCommitSHAs;
|
|
84
|
+
/**
|
|
85
|
+
* Get the Git commit SHA from common environment variables
|
|
86
|
+
* used by different CI/CD platforms.
|
|
87
|
+
* @returns {string | undefined} The Git commit SHA or undefined if not found.
|
|
88
|
+
*/
|
|
89
|
+
function getShas() {
|
|
90
|
+
if (cachedCommitSHAs !== undefined) {
|
|
91
|
+
return cachedCommitSHAs;
|
|
92
|
+
}
|
|
93
|
+
const common_release_envs = [
|
|
94
|
+
"VERCEL_GIT_COMMIT_SHA",
|
|
95
|
+
"NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA",
|
|
96
|
+
"COMMIT_REF",
|
|
97
|
+
"RENDER_GIT_COMMIT",
|
|
98
|
+
"CI_COMMIT_SHA",
|
|
99
|
+
"CIRCLE_SHA1",
|
|
100
|
+
"CF_PAGES_COMMIT_SHA",
|
|
101
|
+
"REACT_APP_GIT_SHA",
|
|
102
|
+
"SOURCE_VERSION",
|
|
103
|
+
"GITHUB_SHA",
|
|
104
|
+
"TRAVIS_COMMIT",
|
|
105
|
+
"GIT_COMMIT",
|
|
106
|
+
"BUILD_VCS_NUMBER",
|
|
107
|
+
"bamboo_planRepository_revision",
|
|
108
|
+
"Build.SourceVersion",
|
|
109
|
+
"BITBUCKET_COMMIT",
|
|
110
|
+
"DRONE_COMMIT_SHA",
|
|
111
|
+
"SEMAPHORE_GIT_SHA",
|
|
112
|
+
"BUILDKITE_COMMIT",
|
|
113
|
+
];
|
|
114
|
+
const shas = {};
|
|
115
|
+
for (const env of common_release_envs) {
|
|
116
|
+
const envVar = getEnvironmentVariable(env);
|
|
117
|
+
if (envVar !== undefined) {
|
|
118
|
+
shas[env] = envVar;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
cachedCommitSHAs = shas;
|
|
122
|
+
return shas;
|
|
123
|
+
}
|
|
124
|
+
exports.getShas = getShas;
|
package/dist/utils/env.d.ts
CHANGED
|
@@ -20,3 +20,13 @@ export type RuntimeEnvironment = {
|
|
|
20
20
|
export declare function getRuntimeEnvironment(): Promise<RuntimeEnvironment>;
|
|
21
21
|
export declare function getEnvironmentVariable(name: string): string | undefined;
|
|
22
22
|
export declare function setEnvironmentVariable(name: string, value: string): void;
|
|
23
|
+
interface ICommitSHAs {
|
|
24
|
+
[key: string]: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the Git commit SHA from common environment variables
|
|
28
|
+
* used by different CI/CD platforms.
|
|
29
|
+
* @returns {string | undefined} The Git commit SHA or undefined if not found.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getShas(): ICommitSHAs;
|
|
32
|
+
export {};
|
package/dist/utils/env.js
CHANGED
|
@@ -40,9 +40,11 @@ let runtimeEnvironment;
|
|
|
40
40
|
export async function getRuntimeEnvironment() {
|
|
41
41
|
if (runtimeEnvironment === undefined) {
|
|
42
42
|
const env = getEnv();
|
|
43
|
+
const releaseEnv = getShas();
|
|
43
44
|
runtimeEnvironment = {
|
|
44
45
|
library: "langsmith",
|
|
45
46
|
runtime: env,
|
|
47
|
+
...releaseEnv,
|
|
46
48
|
};
|
|
47
49
|
}
|
|
48
50
|
return runtimeEnvironment;
|
|
@@ -66,3 +68,44 @@ export function setEnvironmentVariable(name, value) {
|
|
|
66
68
|
process.env[name] = value;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
71
|
+
let cachedCommitSHAs;
|
|
72
|
+
/**
|
|
73
|
+
* Get the Git commit SHA from common environment variables
|
|
74
|
+
* used by different CI/CD platforms.
|
|
75
|
+
* @returns {string | undefined} The Git commit SHA or undefined if not found.
|
|
76
|
+
*/
|
|
77
|
+
export function getShas() {
|
|
78
|
+
if (cachedCommitSHAs !== undefined) {
|
|
79
|
+
return cachedCommitSHAs;
|
|
80
|
+
}
|
|
81
|
+
const common_release_envs = [
|
|
82
|
+
"VERCEL_GIT_COMMIT_SHA",
|
|
83
|
+
"NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA",
|
|
84
|
+
"COMMIT_REF",
|
|
85
|
+
"RENDER_GIT_COMMIT",
|
|
86
|
+
"CI_COMMIT_SHA",
|
|
87
|
+
"CIRCLE_SHA1",
|
|
88
|
+
"CF_PAGES_COMMIT_SHA",
|
|
89
|
+
"REACT_APP_GIT_SHA",
|
|
90
|
+
"SOURCE_VERSION",
|
|
91
|
+
"GITHUB_SHA",
|
|
92
|
+
"TRAVIS_COMMIT",
|
|
93
|
+
"GIT_COMMIT",
|
|
94
|
+
"BUILD_VCS_NUMBER",
|
|
95
|
+
"bamboo_planRepository_revision",
|
|
96
|
+
"Build.SourceVersion",
|
|
97
|
+
"BITBUCKET_COMMIT",
|
|
98
|
+
"DRONE_COMMIT_SHA",
|
|
99
|
+
"SEMAPHORE_GIT_SHA",
|
|
100
|
+
"BUILDKITE_COMMIT",
|
|
101
|
+
];
|
|
102
|
+
const shas = {};
|
|
103
|
+
for (const env of common_release_envs) {
|
|
104
|
+
const envVar = getEnvironmentVariable(env);
|
|
105
|
+
if (envVar !== undefined) {
|
|
106
|
+
shas[env] = envVar;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
cachedCommitSHAs = shas;
|
|
110
|
+
return shas;
|
|
111
|
+
}
|