@zavudev/sdk-mcp 0.24.0 → 0.26.0
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/{headers.d.ts → auth.d.mts} +1 -1
- package/auth.d.mts.map +1 -0
- package/{headers.d.mts → auth.d.ts} +1 -1
- package/auth.d.ts.map +1 -0
- package/{headers.js → auth.js} +1 -1
- package/auth.js.map +1 -0
- package/{headers.mjs → auth.mjs} +1 -1
- package/auth.mjs.map +1 -0
- package/code-tool.d.mts +4 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +4 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +19 -6
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +15 -2
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts.map +1 -1
- package/docs-search-tool.d.ts.map +1 -1
- package/docs-search-tool.js +7 -1
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +7 -1
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts +8 -3
- package/http.d.mts.map +1 -1
- package/http.d.ts +8 -3
- package/http.d.ts.map +1 -1
- package/http.js +27 -12
- package/http.js.map +1 -1
- package/http.mjs +26 -11
- package/http.mjs.map +1 -1
- package/index.js +6 -2
- package/index.js.map +1 -1
- package/index.mjs +6 -2
- package/index.mjs.map +1 -1
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +527 -0
- package/methods.js.map +1 -0
- package/methods.mjs +523 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +4 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +4 -0
- package/options.d.ts.map +1 -1
- package/options.js +31 -12
- package/options.js.map +1 -1
- package/options.mjs +31 -12
- package/options.mjs.map +1 -1
- package/package.json +33 -12
- package/server.d.mts +2 -8
- package/server.d.mts.map +1 -1
- package/server.d.ts +2 -8
- package/server.d.ts.map +1 -1
- package/server.js +41 -33
- package/server.js.map +1 -1
- package/server.mjs +40 -29
- package/server.mjs.map +1 -1
- package/src/code-tool.ts +21 -2
- package/src/docs-search-tool.ts +7 -1
- package/src/http.ts +36 -12
- package/src/index.ts +6 -2
- package/src/methods.ts +548 -0
- package/src/options.ts +39 -12
- package/src/server.ts +49 -34
- package/src/stdio.ts +4 -3
- package/src/util.ts +25 -0
- package/stdio.d.mts +2 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +2 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +3 -3
- package/stdio.js.map +1 -1
- package/stdio.mjs +3 -3
- package/stdio.mjs.map +1 -1
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
- package/headers.d.mts.map +0 -1
- package/headers.d.ts.map +0 -1
- package/headers.js.map +0 -1
- package/headers.mjs.map +0 -1
- /package/src/{headers.ts → auth.ts} +0 -0
package/src/options.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
1
3
|
import qs from 'qs';
|
|
2
4
|
import yargs from 'yargs';
|
|
3
5
|
import { hideBin } from 'yargs/helpers';
|
|
4
6
|
import z from 'zod';
|
|
5
7
|
|
|
6
8
|
export type CLIOptions = McpOptions & {
|
|
9
|
+
debug: boolean;
|
|
7
10
|
transport: 'stdio' | 'http';
|
|
8
11
|
port: number | undefined;
|
|
9
12
|
socket: string | undefined;
|
|
@@ -11,37 +14,57 @@ export type CLIOptions = McpOptions & {
|
|
|
11
14
|
|
|
12
15
|
export type McpOptions = {
|
|
13
16
|
includeDocsTools?: boolean | undefined;
|
|
17
|
+
codeAllowHttpGets?: boolean | undefined;
|
|
18
|
+
codeAllowedMethods?: string[] | undefined;
|
|
19
|
+
codeBlockedMethods?: string[] | undefined;
|
|
14
20
|
};
|
|
15
21
|
|
|
16
22
|
export function parseCLIOptions(): CLIOptions {
|
|
17
23
|
const opts = yargs(hideBin(process.argv))
|
|
18
|
-
.option('
|
|
24
|
+
.option('code-allow-http-gets', {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
description:
|
|
27
|
+
'Allow all code tool methods that map to HTTP GET operations. If all code-allow-* flags are unset, then everything is allowed.',
|
|
28
|
+
})
|
|
29
|
+
.option('code-allowed-methods', {
|
|
19
30
|
type: 'string',
|
|
20
31
|
array: true,
|
|
21
|
-
|
|
22
|
-
|
|
32
|
+
description:
|
|
33
|
+
'Methods to explicitly allow for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
|
|
23
34
|
})
|
|
24
|
-
.option('
|
|
35
|
+
.option('code-blocked-methods', {
|
|
25
36
|
type: 'string',
|
|
26
37
|
array: true,
|
|
27
|
-
|
|
28
|
-
|
|
38
|
+
description:
|
|
39
|
+
'Methods to explicitly block for code tool. Evaluated as regular expressions against method fully qualified names. If all code-allow-* flags are unset, then everything is allowed.',
|
|
29
40
|
})
|
|
30
|
-
.option('
|
|
41
|
+
.option('debug', { type: 'boolean', description: 'Enable debug logging' })
|
|
42
|
+
.option('no-tools', {
|
|
31
43
|
type: 'string',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
description: '
|
|
44
|
+
array: true,
|
|
45
|
+
choices: ['code', 'docs'],
|
|
46
|
+
description: 'Tools to explicitly disable',
|
|
35
47
|
})
|
|
36
48
|
.option('port', {
|
|
37
49
|
type: 'number',
|
|
38
50
|
default: 3000,
|
|
39
51
|
description: 'Port to serve on if using http transport',
|
|
40
52
|
})
|
|
41
|
-
.option('socket', {
|
|
53
|
+
.option('socket', { type: 'string', description: 'Unix socket to serve on if using http transport' })
|
|
54
|
+
.option('tools', {
|
|
42
55
|
type: 'string',
|
|
43
|
-
|
|
56
|
+
array: true,
|
|
57
|
+
choices: ['code', 'docs'],
|
|
58
|
+
description: 'Tools to explicitly enable',
|
|
59
|
+
})
|
|
60
|
+
.option('transport', {
|
|
61
|
+
type: 'string',
|
|
62
|
+
choices: ['stdio', 'http'],
|
|
63
|
+
default: 'stdio',
|
|
64
|
+
description: 'What transport to use; stdio for local servers or http for remote servers',
|
|
44
65
|
})
|
|
66
|
+
.env('MCP_SERVER')
|
|
67
|
+
.version(true)
|
|
45
68
|
.help();
|
|
46
69
|
|
|
47
70
|
const argv = opts.parseSync();
|
|
@@ -57,6 +80,10 @@ export function parseCLIOptions(): CLIOptions {
|
|
|
57
80
|
|
|
58
81
|
return {
|
|
59
82
|
...(includeDocsTools !== undefined && { includeDocsTools }),
|
|
83
|
+
debug: !!argv.debug,
|
|
84
|
+
codeAllowHttpGets: argv.codeAllowHttpGets,
|
|
85
|
+
codeAllowedMethods: argv.codeAllowedMethods,
|
|
86
|
+
codeBlockedMethods: argv.codeBlockedMethods,
|
|
60
87
|
transport,
|
|
61
88
|
port: argv.port,
|
|
62
89
|
socket: argv.socket,
|
package/src/server.ts
CHANGED
|
@@ -12,28 +12,63 @@ import Zavudev from '@zavudev/sdk';
|
|
|
12
12
|
import { codeTool } from './code-tool';
|
|
13
13
|
import docsSearchTool from './docs-search-tool';
|
|
14
14
|
import { McpOptions } from './options';
|
|
15
|
+
import { blockedMethodsForCodeTool } from './methods';
|
|
15
16
|
import { HandlerFunction, McpTool } from './types';
|
|
17
|
+
import { readEnv } from './util';
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
async function getInstructions() {
|
|
20
|
+
// This API key is optional; providing it allows the server to fetch instructions for unreleased versions.
|
|
21
|
+
const stainlessAPIKey = readEnv('STAINLESS_API_KEY');
|
|
22
|
+
const response = await fetch(
|
|
23
|
+
readEnv('CODE_MODE_INSTRUCTIONS_URL') ?? 'https://api.stainless.com/api/ai/instructions/zavudev',
|
|
24
|
+
{
|
|
25
|
+
method: 'GET',
|
|
26
|
+
headers: { ...(stainlessAPIKey && { Authorization: stainlessAPIKey }) },
|
|
27
|
+
},
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
let instructions: string | undefined;
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
console.warn(
|
|
33
|
+
'Warning: failed to retrieve MCP server instructions. Proceeding with default instructions...',
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
instructions = `
|
|
37
|
+
This is the zavudev MCP server. You will use Code Mode to help the user perform
|
|
38
|
+
actions. You can use search_docs tool to learn about how to take action with this server. Then,
|
|
39
|
+
you will write TypeScript code using the execute tool take action. It is CRITICAL that you be
|
|
40
|
+
thoughtful and deliberate when executing code. Always try to entirely solve the problem in code
|
|
41
|
+
block: it can be as long as you need to get the job done!
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
instructions ??= ((await response.json()) as { instructions: string }).instructions;
|
|
46
|
+
instructions = `
|
|
47
|
+
The current time in Unix timestamps is ${Date.now()}.
|
|
48
|
+
|
|
49
|
+
${instructions}
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
return instructions;
|
|
53
|
+
}
|
|
19
54
|
|
|
20
|
-
export const newMcpServer = () =>
|
|
55
|
+
export const newMcpServer = async () =>
|
|
21
56
|
new McpServer(
|
|
22
57
|
{
|
|
23
58
|
name: 'zavudev_sdk_api',
|
|
24
|
-
version: '0.
|
|
59
|
+
version: '0.26.0',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
instructions: await getInstructions(),
|
|
63
|
+
capabilities: { tools: {}, logging: {} },
|
|
25
64
|
},
|
|
26
|
-
{ capabilities: { tools: {}, logging: {} } },
|
|
27
65
|
);
|
|
28
66
|
|
|
29
|
-
// Create server instance
|
|
30
|
-
export const server = newMcpServer();
|
|
31
|
-
|
|
32
67
|
/**
|
|
33
68
|
* Initializes the provided MCP Server with the given tools and handlers.
|
|
34
69
|
* If not provided, the default client, tools and handlers will be used.
|
|
35
70
|
*/
|
|
36
|
-
export function initMcpServer(params: {
|
|
71
|
+
export async function initMcpServer(params: {
|
|
37
72
|
server: Server | McpServer;
|
|
38
73
|
clientOptions?: ClientOptions;
|
|
39
74
|
mcpOptions?: McpOptions;
|
|
@@ -111,7 +146,11 @@ export function initMcpServer(params: {
|
|
|
111
146
|
* Selects the tools to include in the MCP Server based on the provided options.
|
|
112
147
|
*/
|
|
113
148
|
export function selectTools(options?: McpOptions): McpTool[] {
|
|
114
|
-
const includedTools = [
|
|
149
|
+
const includedTools = [
|
|
150
|
+
codeTool({
|
|
151
|
+
blockedMethods: blockedMethodsForCodeTool(options),
|
|
152
|
+
}),
|
|
153
|
+
];
|
|
115
154
|
if (options?.includeDocsTools ?? true) {
|
|
116
155
|
includedTools.push(docsSearchTool);
|
|
117
156
|
}
|
|
@@ -128,27 +167,3 @@ export async function executeHandler(
|
|
|
128
167
|
) {
|
|
129
168
|
return await handler(client, args || {});
|
|
130
169
|
}
|
|
131
|
-
|
|
132
|
-
export const readEnv = (env: string): string | undefined => {
|
|
133
|
-
if (typeof (globalThis as any).process !== 'undefined') {
|
|
134
|
-
return (globalThis as any).process.env?.[env]?.trim();
|
|
135
|
-
} else if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
136
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
137
|
-
}
|
|
138
|
-
return;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export const readEnvOrError = (env: string): string => {
|
|
142
|
-
let envValue = readEnv(env);
|
|
143
|
-
if (envValue === undefined) {
|
|
144
|
-
throw new Error(`Environment variable ${env} is not set`);
|
|
145
|
-
}
|
|
146
|
-
return envValue;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export const requireValue = <T>(value: T | undefined, description: string): T => {
|
|
150
|
-
if (value === undefined) {
|
|
151
|
-
throw new Error(`Missing required value: ${description}`);
|
|
152
|
-
}
|
|
153
|
-
return value;
|
|
154
|
-
};
|
package/src/stdio.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
+
import { McpOptions } from './options';
|
|
2
3
|
import { initMcpServer, newMcpServer } from './server';
|
|
3
4
|
|
|
4
|
-
export const launchStdioServer = async () => {
|
|
5
|
-
const server = newMcpServer();
|
|
5
|
+
export const launchStdioServer = async (mcpOptions: McpOptions) => {
|
|
6
|
+
const server = await newMcpServer();
|
|
6
7
|
|
|
7
|
-
initMcpServer({ server });
|
|
8
|
+
await initMcpServer({ server, mcpOptions });
|
|
8
9
|
|
|
9
10
|
const transport = new StdioServerTransport();
|
|
10
11
|
await server.connect(transport);
|
package/src/util.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export const readEnv = (env: string): string | undefined => {
|
|
4
|
+
if (typeof (globalThis as any).process !== 'undefined') {
|
|
5
|
+
return (globalThis as any).process.env?.[env]?.trim();
|
|
6
|
+
} else if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
7
|
+
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
8
|
+
}
|
|
9
|
+
return;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const readEnvOrError = (env: string): string => {
|
|
13
|
+
let envValue = readEnv(env);
|
|
14
|
+
if (envValue === undefined) {
|
|
15
|
+
throw new Error(`Environment variable ${env} is not set`);
|
|
16
|
+
}
|
|
17
|
+
return envValue;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const requireValue = <T>(value: T | undefined, description: string): T => {
|
|
21
|
+
if (value === undefined) {
|
|
22
|
+
throw new Error(`Missing required value: ${description}`);
|
|
23
|
+
}
|
|
24
|
+
return value;
|
|
25
|
+
};
|
package/stdio.d.mts
CHANGED
package/stdio.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stdio.d.mts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAGrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
|
package/stdio.d.ts
CHANGED
package/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OACO,EAAE,UAAU,EAAE;AAGrB,eAAO,MAAM,iBAAiB,GAAU,YAAY,UAAU,kBAQ7D,CAAC"}
|
package/stdio.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.launchStdioServer = void 0;
|
|
4
4
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
5
|
const server_1 = require("./server.js");
|
|
6
|
-
const launchStdioServer = async () => {
|
|
7
|
-
const server = (0, server_1.newMcpServer)();
|
|
8
|
-
(0, server_1.initMcpServer)({ server });
|
|
6
|
+
const launchStdioServer = async (mcpOptions) => {
|
|
7
|
+
const server = await (0, server_1.newMcpServer)();
|
|
8
|
+
await (0, server_1.initMcpServer)({ server, mcpOptions });
|
|
9
9
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
10
10
|
await server.connect(transport);
|
|
11
11
|
console.error('MCP Server running on stdio');
|
package/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":";;;AAAA,wEAAiF;AAEjF,wCAAuD;AAEhD,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAY,GAAE,CAAC;IAEpC,MAAM,IAAA,sBAAa,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B"}
|
package/stdio.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
2
|
import { initMcpServer, newMcpServer } from "./server.mjs";
|
|
3
|
-
export const launchStdioServer = async () => {
|
|
4
|
-
const server = newMcpServer();
|
|
5
|
-
initMcpServer({ server });
|
|
3
|
+
export const launchStdioServer = async (mcpOptions) => {
|
|
4
|
+
const server = await newMcpServer();
|
|
5
|
+
await initMcpServer({ server, mcpOptions });
|
|
6
6
|
const transport = new StdioServerTransport();
|
|
7
7
|
await server.connect(transport);
|
|
8
8
|
console.error('MCP Server running on stdio');
|
package/stdio.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;
|
|
1
|
+
{"version":3,"file":"stdio.mjs","sourceRoot":"","sources":["src/stdio.ts"],"names":[],"mappings":"OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C;OAEzE,EAAE,aAAa,EAAE,YAAY,EAAE;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAsB,EAAE,EAAE;IAChE,MAAM,MAAM,GAAG,MAAM,YAAY,EAAE,CAAC;IAEpC,MAAM,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;AAC/C,CAAC,CAAC"}
|
package/util.d.mts
ADDED
package/util.d.mts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.mts","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAO9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAM5C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,aAAa,MAAM,KAAG,CAK3E,CAAC"}
|
package/util.d.ts
ADDED
package/util.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAO9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,MAM5C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,EAAE,aAAa,MAAM,KAAG,CAK3E,CAAC"}
|
package/util.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.requireValue = exports.readEnvOrError = exports.readEnv = void 0;
|
|
5
|
+
const readEnv = (env) => {
|
|
6
|
+
if (typeof globalThis.process !== 'undefined') {
|
|
7
|
+
return globalThis.process.env?.[env]?.trim();
|
|
8
|
+
}
|
|
9
|
+
else if (typeof globalThis.Deno !== 'undefined') {
|
|
10
|
+
return globalThis.Deno.env?.get?.(env)?.trim();
|
|
11
|
+
}
|
|
12
|
+
return;
|
|
13
|
+
};
|
|
14
|
+
exports.readEnv = readEnv;
|
|
15
|
+
const readEnvOrError = (env) => {
|
|
16
|
+
let envValue = (0, exports.readEnv)(env);
|
|
17
|
+
if (envValue === undefined) {
|
|
18
|
+
throw new Error(`Environment variable ${env} is not set`);
|
|
19
|
+
}
|
|
20
|
+
return envValue;
|
|
21
|
+
};
|
|
22
|
+
exports.readEnvOrError = readEnvOrError;
|
|
23
|
+
const requireValue = (value, description) => {
|
|
24
|
+
if (value === undefined) {
|
|
25
|
+
throw new Error(`Missing required value: ${description}`);
|
|
26
|
+
}
|
|
27
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
exports.requireValue = requireValue;
|
|
30
|
+
//# sourceMappingURL=util.js.map
|
package/util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAE/E,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3D,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO;AACT,CAAC,CAAC;AAPW,QAAA,OAAO,WAOlB;AAEK,MAAM,cAAc,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,IAAI,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB;AAEK,MAAM,YAAY,GAAG,CAAI,KAAoB,EAAE,WAAmB,EAAK,EAAE;IAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB"}
|
package/util.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
export const readEnv = (env) => {
|
|
3
|
+
if (typeof globalThis.process !== 'undefined') {
|
|
4
|
+
return globalThis.process.env?.[env]?.trim();
|
|
5
|
+
}
|
|
6
|
+
else if (typeof globalThis.Deno !== 'undefined') {
|
|
7
|
+
return globalThis.Deno.env?.get?.(env)?.trim();
|
|
8
|
+
}
|
|
9
|
+
return;
|
|
10
|
+
};
|
|
11
|
+
export const readEnvOrError = (env) => {
|
|
12
|
+
let envValue = readEnv(env);
|
|
13
|
+
if (envValue === undefined) {
|
|
14
|
+
throw new Error(`Environment variable ${env} is not set`);
|
|
15
|
+
}
|
|
16
|
+
return envValue;
|
|
17
|
+
};
|
|
18
|
+
export const requireValue = (value, description) => {
|
|
19
|
+
if (value === undefined) {
|
|
20
|
+
throw new Error(`Missing required value: ${description}`);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=util.mjs.map
|
package/util.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.mjs","sourceRoot":"","sources":["src/util.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACxD,CAAC;SAAM,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QAC3D,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO;AACT,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAW,EAAU,EAAE;IACpD,IAAI,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,aAAa,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,KAAoB,EAAE,WAAmB,EAAK,EAAE;IAC9E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,WAAW,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
package/headers.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.d.mts","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE,MAAM,WAAW;OACpC,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAqBhG,CAAC"}
|
package/headers.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,EAAE,MAAM,WAAW;OACpC,EAAE,aAAa,EAAE,MAAM,cAAc;AAE5C,eAAO,MAAM,gBAAgB,GAAI,KAAK,eAAe,EAAE,WAAW,OAAO,KAAG,OAAO,CAAC,aAAa,CAqBhG,CAAC"}
|
package/headers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.js","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAK/E,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAAE,QAAkB,EAA0B,EAAE;IACnG,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;QACxD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjE,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,QAAQ;gBACX,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACvE;gBACE,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAC;QACN,CAAC;IACH,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACrG,CAAC;IAED,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC/C,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC;AArBW,QAAA,gBAAgB,oBAqB3B"}
|
package/headers.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"headers.mjs","sourceRoot":"","sources":["src/headers.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAKtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAoB,EAAE,QAAkB,EAA0B,EAAE;IACnG,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;QACxD,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjE,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,QAAQ;gBACX,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACvE;gBACE,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAC;QACN,CAAC;IACH,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACrG,CAAC;IAED,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QAC/C,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACrC,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC,CAAC"}
|
|
File without changes
|