pepkio-sequence-property-calculator 0.1.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/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # Sequence Property Calculator
2
+
3
+ Node.js ESM client and CLI for running Pepkio's sequence, dilution, and ligation calculations through one typed REST API package.
4
+
5
+ # What It Does
6
+
7
+ This package calls the hosted Pepkio Sequence Property Calculator from Node.js scripts, browser bundles, or CI workflows. You can submit mixed FASTA input for sequence-property analysis, run concentration dilution calculations, or compute ligation insert mass from vector and insert settings.
8
+
9
+ The API runs in synchronous mode and returns structured JSON output for each run. Programmatic runs require a network connection and a Pepkio API key.
10
+
11
+ # Features
12
+
13
+ - Three tool modes via `mode`: `sequence`, `dilution`, `ligation`
14
+ - Sequence mode supports multi-FASTA input with options like `mass_type`, `topology`, `strand_mode`, and `type_overrides`
15
+ - Sequence outputs include fields such as molecular weight, GC%, pI, extinction coefficients, GRAVY, and instability index
16
+ - Dilution mode supports `simple` and `serial` sub-modes and returns protocol steps
17
+ - Ligation mode returns calculated `insert_mass_ng`
18
+ - Built-in manifest helpers: `getManifest`, `listExamples`, `getExampleInput`
19
+ - Run helpers: `run`, `getRun`, `waitForRun`
20
+ - CLI commands: `manifest` and `run`
21
+
22
+ # Installation
23
+
24
+ ```bash
25
+ npm install pepkio-sequence-property-calculator
26
+ ```
27
+
28
+ Requires Node.js 18 or newer.
29
+
30
+ # Configuration
31
+
32
+ Set an API key with `tools:run` scope before calling `run()`:
33
+
34
+ ```bash
35
+ export PEPKIO_API_KEY="your-key"
36
+ ```
37
+
38
+ Create a key at [Pepkio API keys](https://www.pepkio.com/account/api-keys).
39
+
40
+ Optional environment variables:
41
+
42
+ - `PEPKIO_API_BASE_URL` (default: `https://tools.pepkio.com`)
43
+ - `LOCAL_PEPKIO_API_KEY` (used when base URL points to `localtest.me`)
44
+ - `PEPKIO_SSL_VERIFY` (`0` or `false` disables TLS verification)
45
+
46
+ # Quick Example
47
+
48
+ ```typescript
49
+ import { PepkioClient } from "pepkio-sequence-property-calculator";
50
+
51
+ const client = new PepkioClient({ apiKey: process.env.PEPKIO_API_KEY });
52
+
53
+ const input = await client.getExampleInput("mixed_fasta");
54
+ const result = await client.run(input);
55
+
56
+ console.log(result.status);
57
+ console.log(result.result?.mode);
58
+ console.log(result.result?.valid_count);
59
+ ```
60
+
61
+ # CLI
62
+
63
+ ```bash
64
+ npx pepkio-sequence-property-calculator manifest --examples
65
+ npx pepkio-sequence-property-calculator run --example mixed_fasta
66
+ ```
67
+
68
+ # Typical Use Cases
69
+
70
+ - Batch-check molecular properties for mixed DNA, RNA, and protein FASTA entries
71
+ - Review protein constructs with molecular weight and pI in one API workflow
72
+ - Run oligo property checks including GC-related outputs and extinction values
73
+ - Plan dilution steps from stock and target concentrations
74
+ - Calculate insert mass for cloning ligation setups
75
+
76
+ # Scientific Background
77
+
78
+ Sequence mode detects nucleic acid or protein input and computes properties per row. Protein pI is estimated with Bjellqvist pKa tables, and ligation mass follows the ratio-based formula used by the tool (`molarRatio * (insertLength / vectorLength) * vectorMass`). Dilution mode applies concentration-volume conversion workflows for simple and serial planning.
79
+
80
+ # Web Application
81
+
82
+ For researchers who prefer a graphical interface, an interactive web version is available.
83
+
84
+ Web Application: https://www.pepkio.com/tools/sequence-property-calculator
85
+
86
+ The web interface provides live table updates, CSV export, shareable permalinks, row-level concentration utilities, and integrated dilution and ligation tabs.
87
+
88
+ # Documentation and Resources
89
+
90
+ GitHub Repository: https://github.com/pepkio/pepkio-sequence-property-calculator-js
91
+
92
+ Web Application: https://www.pepkio.com/tools/sequence-property-calculator
93
+
94
+ # About Pepkio
95
+
96
+ Pepkio (https://www.pepkio.com/) develops software tools and bioinformatics solutions for life science researchers, including laboratory calculators and analysis services (https://www.pepkio.com/cro).
@@ -0,0 +1,253 @@
1
+ // src/errors.ts
2
+ var PepkioAPIError = class extends Error {
3
+ statusCode;
4
+ code;
5
+ details;
6
+ responseBody;
7
+ constructor(message, options) {
8
+ super(message);
9
+ this.name = "PepkioAPIError";
10
+ this.statusCode = options?.statusCode;
11
+ this.code = options?.code;
12
+ this.details = options?.details ?? {};
13
+ this.responseBody = options?.responseBody;
14
+ }
15
+ toString() {
16
+ const parts = [this.message];
17
+ if (this.code) {
18
+ parts.push(`code=${this.code}`);
19
+ }
20
+ if (this.statusCode !== void 0) {
21
+ parts.push(`status=${this.statusCode}`);
22
+ }
23
+ return parts.join(" ");
24
+ }
25
+ };
26
+
27
+ // src/config.ts
28
+ var DEFAULT_API_BASE_URL = "https://tools.pepkio.com";
29
+ var TOOL_ID = "sequence-property-calculator";
30
+ function resolveBaseUrl(override) {
31
+ return (override ?? process.env.PEPKIO_API_BASE_URL ?? DEFAULT_API_BASE_URL).replace(/\/$/, "");
32
+ }
33
+ function resolveSslVerify(override, baseUrl) {
34
+ if (override !== void 0) {
35
+ return override;
36
+ }
37
+ const env = process.env.PEPKIO_SSL_VERIFY;
38
+ if (env !== void 0) {
39
+ return !["0", "false", "no", "off"].includes(env.trim().toLowerCase());
40
+ }
41
+ const base = baseUrl ?? resolveBaseUrl();
42
+ if (base.includes("localtest.me")) {
43
+ return false;
44
+ }
45
+ return true;
46
+ }
47
+ function resolveApiKey(override, baseUrl) {
48
+ if (override) {
49
+ return override;
50
+ }
51
+ const base = baseUrl ?? resolveBaseUrl();
52
+ if (base.includes("localtest.me")) {
53
+ return process.env.LOCAL_PEPKIO_API_KEY ?? process.env.PEPKIO_API_KEY;
54
+ }
55
+ return process.env.PEPKIO_API_KEY;
56
+ }
57
+
58
+ // src/types.ts
59
+ import { z } from "zod";
60
+ var RunResultSchema = z.object({
61
+ run_id: z.string(),
62
+ status: z.string(),
63
+ result: z.record(z.unknown()).nullable().optional(),
64
+ error: z.object({
65
+ code: z.string().optional(),
66
+ message: z.string().optional(),
67
+ details: z.record(z.unknown()).optional()
68
+ }).nullable().optional(),
69
+ result_url: z.string().nullable().optional(),
70
+ permalink: z.string().nullable().optional(),
71
+ duration_ms: z.number().nullable().optional()
72
+ }).passthrough();
73
+ function parseRunResponse(data) {
74
+ return RunResultSchema.parse(data);
75
+ }
76
+ function raiseForError(result) {
77
+ if (!result.error) {
78
+ return;
79
+ }
80
+ const err = result.error;
81
+ throw new PepkioAPIError(err.message ?? "Tool run failed", {
82
+ code: err.code,
83
+ responseBody: {
84
+ run_id: result.run_id,
85
+ status: result.status,
86
+ error: result.error
87
+ }
88
+ });
89
+ }
90
+
91
+ // src/client.ts
92
+ import { Agent } from "undici";
93
+ var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
94
+ var PepkioClient = class {
95
+ baseUrl;
96
+ apiKey;
97
+ timeoutMs;
98
+ verifySsl;
99
+ fetchFn;
100
+ manifest = null;
101
+ constructor(options = {}) {
102
+ this.baseUrl = resolveBaseUrl(options.baseUrl);
103
+ this.apiKey = resolveApiKey(options.apiKey, this.baseUrl);
104
+ this.timeoutMs = options.timeoutMs ?? 6e4;
105
+ this.verifySsl = resolveSslVerify(options.verifySsl, this.baseUrl);
106
+ this.fetchFn = options.fetch ?? fetch;
107
+ }
108
+ getBaseUrl() {
109
+ return this.baseUrl;
110
+ }
111
+ requireApiKey() {
112
+ if (!this.apiKey) {
113
+ throw new Error(
114
+ "API key required. Set PEPKIO_API_KEY (or LOCAL_PEPKIO_API_KEY for local), or pass apiKey to PepkioClient."
115
+ );
116
+ }
117
+ }
118
+ toolPath(suffix) {
119
+ return `${this.baseUrl}/api/tools/v1/tools/${TOOL_ID}${suffix}`;
120
+ }
121
+ async handleResponse(response) {
122
+ let body = {};
123
+ try {
124
+ const json = await response.json();
125
+ if (json && typeof json === "object" && !Array.isArray(json)) {
126
+ body = json;
127
+ }
128
+ } catch {
129
+ body = {};
130
+ }
131
+ if (response.ok) {
132
+ return body;
133
+ }
134
+ const error = body.error ?? {};
135
+ throw new PepkioAPIError(
136
+ typeof error.message === "string" ? error.message : response.statusText || "Request failed",
137
+ {
138
+ statusCode: response.status,
139
+ code: typeof error.code === "string" ? error.code : void 0,
140
+ details: error.details && typeof error.details === "object" && !Array.isArray(error.details) ? error.details : {},
141
+ responseBody: body
142
+ }
143
+ );
144
+ }
145
+ async request(path, init) {
146
+ const headers = new Headers(init?.headers);
147
+ if (this.apiKey) {
148
+ headers.set("Authorization", `Bearer ${this.apiKey}`);
149
+ }
150
+ const controller = new AbortController();
151
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
152
+ const fetchInit = {
153
+ ...init,
154
+ headers,
155
+ signal: controller.signal
156
+ };
157
+ if (!this.verifySsl) {
158
+ fetchInit.dispatcher = new Agent({ connect: { rejectUnauthorized: false } });
159
+ }
160
+ try {
161
+ const response = await this.fetchFn(path, fetchInit);
162
+ return await this.handleResponse(response);
163
+ } finally {
164
+ clearTimeout(timer);
165
+ }
166
+ }
167
+ async getManifest(options) {
168
+ if (this.manifest !== null && !options?.refresh) {
169
+ return this.manifest;
170
+ }
171
+ const data = await this.request(this.toolPath("/manifest"));
172
+ this.manifest = data;
173
+ return data;
174
+ }
175
+ async listExamples() {
176
+ const manifest = await this.getManifest();
177
+ const examples = manifest.examples ?? [];
178
+ return examples.filter((ex) => typeof ex === "object" && ex !== null).map((ex) => ex.name).filter((name) => typeof name === "string");
179
+ }
180
+ async getExampleInput(name) {
181
+ const manifest = await this.getManifest();
182
+ for (const ex of manifest.examples ?? []) {
183
+ if (typeof ex === "object" && ex !== null && ex.name === name) {
184
+ const input = ex.input;
185
+ if (input && typeof input === "object" && !Array.isArray(input)) {
186
+ return input;
187
+ }
188
+ throw new PepkioAPIError(`Example ${JSON.stringify(name)} has no input object`);
189
+ }
190
+ }
191
+ throw new PepkioAPIError(`Example not found: ${JSON.stringify(name)}`);
192
+ }
193
+ async run(input, options = {}) {
194
+ this.requireApiKey();
195
+ const payload = { input };
196
+ const runOptions = {};
197
+ if (options.idempotencyKey !== void 0) {
198
+ runOptions.idempotency_key = options.idempotencyKey;
199
+ }
200
+ if (options.label !== void 0) {
201
+ runOptions.label = options.label;
202
+ }
203
+ if (Object.keys(runOptions).length > 0) {
204
+ payload.options = runOptions;
205
+ }
206
+ const data = await this.request(this.toolPath("/run"), {
207
+ method: "POST",
208
+ headers: { "Content-Type": "application/json" },
209
+ body: JSON.stringify(payload)
210
+ });
211
+ const result = parseRunResponse(data);
212
+ raiseForError(result);
213
+ return result;
214
+ }
215
+ async getRun(runId) {
216
+ this.requireApiKey();
217
+ const data = await this.request(`${this.baseUrl}/api/tools/v1/runs/${runId}`);
218
+ const result = parseRunResponse(data);
219
+ raiseForError(result);
220
+ return result;
221
+ }
222
+ async waitForRun(runId, options) {
223
+ this.requireApiKey();
224
+ const pollIntervalMs = options?.pollIntervalMs ?? 1e3;
225
+ const timeoutMs = options?.timeoutMs ?? 3e5;
226
+ const deadline = Date.now() + timeoutMs;
227
+ while (true) {
228
+ const result = await this.getRun(runId);
229
+ if (TERMINAL_STATUSES.has(result.status)) {
230
+ return result;
231
+ }
232
+ if (Date.now() >= deadline) {
233
+ throw new PepkioAPIError(
234
+ `Run ${runId} did not complete within ${timeoutMs}ms (status=${result.status})`,
235
+ { code: "TIMEOUT" }
236
+ );
237
+ }
238
+ await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
239
+ }
240
+ }
241
+ };
242
+
243
+ export {
244
+ PepkioAPIError,
245
+ DEFAULT_API_BASE_URL,
246
+ TOOL_ID,
247
+ resolveBaseUrl,
248
+ resolveApiKey,
249
+ parseRunResponse,
250
+ raiseForError,
251
+ PepkioClient
252
+ };
253
+ //# sourceMappingURL=chunk-DMQJTGTY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/config.ts","../src/types.ts","../src/client.ts"],"sourcesContent":["/** API error types. */\n\nexport class PepkioAPIError extends Error {\n readonly statusCode?: number;\n readonly code?: string;\n readonly details: Record<string, unknown>;\n readonly responseBody?: Record<string, unknown>;\n\n constructor(\n message: string,\n options?: {\n statusCode?: number;\n code?: string;\n details?: Record<string, unknown>;\n responseBody?: Record<string, unknown>;\n },\n ) {\n super(message);\n this.name = \"PepkioAPIError\";\n this.statusCode = options?.statusCode;\n this.code = options?.code;\n this.details = options?.details ?? {};\n this.responseBody = options?.responseBody;\n }\n\n override toString(): string {\n const parts = [this.message];\n if (this.code) {\n parts.push(`code=${this.code}`);\n }\n if (this.statusCode !== undefined) {\n parts.push(`status=${this.statusCode}`);\n }\n return parts.join(\" \");\n }\n}\n","/** Configuration and environment resolution. */\n\nexport const DEFAULT_API_BASE_URL = \"https://tools.pepkio.com\";\nexport const TOOL_ID = \"sequence-property-calculator\";\n\nexport function resolveBaseUrl(override?: string): string {\n return (override ?? process.env.PEPKIO_API_BASE_URL ?? DEFAULT_API_BASE_URL).replace(/\\/$/, \"\");\n}\n\nexport function resolveSslVerify(override?: boolean, baseUrl?: string): boolean {\n if (override !== undefined) {\n return override;\n }\n const env = process.env.PEPKIO_SSL_VERIFY;\n if (env !== undefined) {\n return ![\"0\", \"false\", \"no\", \"off\"].includes(env.trim().toLowerCase());\n }\n const base = baseUrl ?? resolveBaseUrl();\n if (base.includes(\"localtest.me\")) {\n return false;\n }\n return true;\n}\n\nexport function resolveApiKey(override?: string, baseUrl?: string): string | undefined {\n if (override) {\n return override;\n }\n const base = baseUrl ?? resolveBaseUrl();\n if (base.includes(\"localtest.me\")) {\n return process.env.LOCAL_PEPKIO_API_KEY ?? process.env.PEPKIO_API_KEY;\n }\n return process.env.PEPKIO_API_KEY;\n}\n","/** Typed API request/response models. */\n\nimport { z } from \"zod\";\n\nimport { PepkioAPIError } from \"./errors.js\";\n\nexport const RunResultSchema = z\n .object({\n run_id: z.string(),\n status: z.string(),\n result: z.record(z.unknown()).nullable().optional(),\n error: z\n .object({\n code: z.string().optional(),\n message: z.string().optional(),\n details: z.record(z.unknown()).optional(),\n })\n .nullable()\n .optional(),\n result_url: z.string().nullable().optional(),\n permalink: z.string().nullable().optional(),\n duration_ms: z.number().nullable().optional(),\n })\n .passthrough();\n\nexport type RunResult = z.infer<typeof RunResultSchema>;\n\nexport function parseRunResponse(data: Record<string, unknown>): RunResult {\n return RunResultSchema.parse(data);\n}\n\nexport function raiseForError(result: RunResult): void {\n if (!result.error) {\n return;\n }\n const err = result.error;\n throw new PepkioAPIError(err.message ?? \"Tool run failed\", {\n code: err.code,\n responseBody: {\n run_id: result.run_id,\n status: result.status,\n error: result.error,\n },\n });\n}\n","/** HTTP client for the Pepkio sequence-property-calculator tool. */\n\nimport { PepkioAPIError } from \"./errors.js\";\nimport { Agent, type Dispatcher } from \"undici\";\n\nimport { TOOL_ID, resolveApiKey, resolveBaseUrl, resolveSslVerify } from \"./config.js\";\nimport { type RunResult, parseRunResponse, raiseForError } from \"./types.js\";\n\nconst TERMINAL_STATUSES = new Set([\"completed\", \"failed\", \"cancelled\"]);\n\nexport interface PepkioClientOptions {\n apiKey?: string;\n baseUrl?: string;\n timeoutMs?: number;\n verifySsl?: boolean;\n fetch?: typeof fetch;\n}\n\nexport interface RunOptions {\n idempotencyKey?: string;\n label?: string;\n}\n\nexport class PepkioClient {\n private readonly baseUrl: string;\n private readonly apiKey: string | undefined;\n private readonly timeoutMs: number;\n private readonly verifySsl: boolean;\n private readonly fetchFn: typeof fetch;\n private manifest: Record<string, unknown> | null = null;\n\n constructor(options: PepkioClientOptions = {}) {\n this.baseUrl = resolveBaseUrl(options.baseUrl);\n this.apiKey = resolveApiKey(options.apiKey, this.baseUrl);\n this.timeoutMs = options.timeoutMs ?? 60_000;\n this.verifySsl = resolveSslVerify(options.verifySsl, this.baseUrl);\n this.fetchFn = options.fetch ?? fetch;\n }\n\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n private requireApiKey(): void {\n if (!this.apiKey) {\n throw new Error(\n \"API key required. Set PEPKIO_API_KEY (or LOCAL_PEPKIO_API_KEY for local), \" +\n \"or pass apiKey to PepkioClient.\",\n );\n }\n }\n\n private toolPath(suffix: string): string {\n return `${this.baseUrl}/api/tools/v1/tools/${TOOL_ID}${suffix}`;\n }\n\n private async handleResponse(response: Response): Promise<Record<string, unknown>> {\n let body: Record<string, unknown> = {};\n try {\n const json = await response.json();\n if (json && typeof json === \"object\" && !Array.isArray(json)) {\n body = json as Record<string, unknown>;\n }\n } catch {\n body = {};\n }\n\n if (response.ok) {\n return body;\n }\n\n const error = (body.error ?? {}) as Record<string, unknown>;\n throw new PepkioAPIError(\n typeof error.message === \"string\" ? error.message : response.statusText || \"Request failed\",\n {\n statusCode: response.status,\n code: typeof error.code === \"string\" ? error.code : undefined,\n details:\n error.details && typeof error.details === \"object\" && !Array.isArray(error.details)\n ? (error.details as Record<string, unknown>)\n : {},\n responseBody: body,\n },\n );\n }\n\n private async request(path: string, init?: RequestInit): Promise<Record<string, unknown>> {\n const headers = new Headers(init?.headers);\n if (this.apiKey) {\n headers.set(\"Authorization\", `Bearer ${this.apiKey}`);\n }\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeoutMs);\n const fetchInit: RequestInit & { dispatcher?: Dispatcher } = {\n ...init,\n headers,\n signal: controller.signal,\n };\n if (!this.verifySsl) {\n fetchInit.dispatcher = new Agent({ connect: { rejectUnauthorized: false } });\n }\n try {\n const response = await this.fetchFn(path, fetchInit);\n return await this.handleResponse(response);\n } finally {\n clearTimeout(timer);\n }\n }\n\n async getManifest(options?: { refresh?: boolean }): Promise<Record<string, unknown>> {\n if (this.manifest !== null && !options?.refresh) {\n return this.manifest;\n }\n const data = await this.request(this.toolPath(\"/manifest\"));\n this.manifest = data;\n return data;\n }\n\n async listExamples(): Promise<string[]> {\n const manifest = await this.getManifest();\n const examples = (manifest.examples ?? []) as unknown[];\n return examples\n .filter((ex): ex is Record<string, unknown> => typeof ex === \"object\" && ex !== null)\n .map((ex) => ex.name)\n .filter((name): name is string => typeof name === \"string\");\n }\n\n async getExampleInput(name: string): Promise<Record<string, unknown>> {\n const manifest = await this.getManifest();\n for (const ex of (manifest.examples ?? []) as unknown[]) {\n if (typeof ex === \"object\" && ex !== null && (ex as Record<string, unknown>).name === name) {\n const input = (ex as Record<string, unknown>).input;\n if (input && typeof input === \"object\" && !Array.isArray(input)) {\n return input as Record<string, unknown>;\n }\n throw new PepkioAPIError(`Example ${JSON.stringify(name)} has no input object`);\n }\n }\n throw new PepkioAPIError(`Example not found: ${JSON.stringify(name)}`);\n }\n\n async run(input: Record<string, unknown>, options: RunOptions = {}): Promise<RunResult> {\n this.requireApiKey();\n const payload: Record<string, unknown> = { input };\n const runOptions: Record<string, string> = {};\n if (options.idempotencyKey !== undefined) {\n runOptions.idempotency_key = options.idempotencyKey;\n }\n if (options.label !== undefined) {\n runOptions.label = options.label;\n }\n if (Object.keys(runOptions).length > 0) {\n payload.options = runOptions;\n }\n const data = await this.request(this.toolPath(\"/run\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(payload),\n });\n const result = parseRunResponse(data);\n raiseForError(result);\n return result;\n }\n\n async getRun(runId: string): Promise<RunResult> {\n this.requireApiKey();\n const data = await this.request(`${this.baseUrl}/api/tools/v1/runs/${runId}`);\n const result = parseRunResponse(data);\n raiseForError(result);\n return result;\n }\n\n async waitForRun(\n runId: string,\n options?: { pollIntervalMs?: number; timeoutMs?: number },\n ): Promise<RunResult> {\n this.requireApiKey();\n const pollIntervalMs = options?.pollIntervalMs ?? 1000;\n const timeoutMs = options?.timeoutMs ?? 300_000;\n const deadline = Date.now() + timeoutMs;\n while (true) {\n const result = await this.getRun(runId);\n if (TERMINAL_STATUSES.has(result.status)) {\n return result;\n }\n if (Date.now() >= deadline) {\n throw new PepkioAPIError(\n `Run ${runId} did not complete within ${timeoutMs}ms (status=${result.status})`,\n { code: \"TIMEOUT\" },\n );\n }\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\n }\n }\n}\n"],"mappings":";AAEO,IAAM,iBAAN,cAA6B,MAAM;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,SACA,SAMA;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,S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,MAAM,UAAU;AAAA,QACpB;AAAA,MACF;AACA,YAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,cAAc,CAAC;AAAA,IACpE;AAAA,EACF;AACF;","names":[]}
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.js ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ PepkioAPIError,
4
+ PepkioClient,
5
+ resolveApiKey,
6
+ resolveBaseUrl
7
+ } from "./chunk-DMQJTGTY.js";
8
+
9
+ // src/cli.ts
10
+ import { Command } from "commander";
11
+ function createClient(apiKey, baseUrl) {
12
+ const resolvedBase = resolveBaseUrl(baseUrl);
13
+ return new PepkioClient({
14
+ apiKey: apiKey ?? resolveApiKey(void 0, resolvedBase),
15
+ baseUrl: resolvedBase
16
+ });
17
+ }
18
+ var program = new Command();
19
+ program.name("pepkio-sequence-property-calculator").description("TypeScript client for Pepkio sequence-property-calculator").option(
20
+ "--api-key <key>",
21
+ "Pepkio API key (tools:run scope); else LOCAL_PEPKIO_API_KEY or PEPKIO_API_KEY from env"
22
+ ).option(
23
+ "--base-url <url>",
24
+ "Tools API base URL (default: https://tools.pepkio.com or PEPKIO_API_BASE_URL)"
25
+ );
26
+ program.command("manifest").description("Fetch and print the tool manifest").option("--examples", "List example names only").action(async (opts, cmd) => {
27
+ const globals = cmd.parent?.opts();
28
+ try {
29
+ const client = createClient(globals.apiKey, globals.baseUrl);
30
+ const data = await client.getManifest();
31
+ if (opts.examples) {
32
+ const names = await client.listExamples();
33
+ for (const name of names) {
34
+ console.log(name);
35
+ }
36
+ return;
37
+ }
38
+ console.log(JSON.stringify(data, null, 2));
39
+ } catch (err) {
40
+ console.error(err instanceof Error ? err.message : String(err));
41
+ process.exit(1);
42
+ }
43
+ });
44
+ program.command("run").description("Run the tool and print the result JSON").option("--example <name>", "Run a named manifest example").option("--input-json <json>", "Tool input as JSON object").option("--label <label>", "Optional run label").option("--idempotency-key <key>", "Optional idempotency key").action(
45
+ async (opts, cmd) => {
46
+ const globals = cmd.parent?.opts();
47
+ if (Boolean(opts.example) === Boolean(opts.inputJson)) {
48
+ console.error("Provide exactly one of --example or --input-json");
49
+ process.exit(1);
50
+ }
51
+ try {
52
+ const client = createClient(globals.apiKey, globals.baseUrl);
53
+ let input;
54
+ if (opts.example) {
55
+ input = await client.getExampleInput(opts.example);
56
+ } else {
57
+ const parsed = JSON.parse(opts.inputJson ?? "{}");
58
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
59
+ throw new Error("--input-json must be a JSON object");
60
+ }
61
+ input = parsed;
62
+ }
63
+ const result = await client.run(input, {
64
+ label: opts.label,
65
+ idempotencyKey: opts.idempotencyKey
66
+ });
67
+ console.log(JSON.stringify(result, null, 2));
68
+ } catch (err) {
69
+ if (err instanceof PepkioAPIError || err instanceof Error) {
70
+ console.error(err.message);
71
+ } else {
72
+ console.error(String(err));
73
+ }
74
+ process.exit(1);
75
+ }
76
+ }
77
+ );
78
+ program.parseAsync(process.argv).catch((err) => {
79
+ console.error(err instanceof Error ? err.message : String(err));
80
+ process.exit(1);
81
+ });
82
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n/** Command-line interface for pepkio-sequence-property-calculator. */\n\nimport { Command } from \"commander\";\n\nimport { PepkioClient } from \"./client.js\";\nimport { PepkioAPIError } from \"./errors.js\";\nimport { resolveApiKey, resolveBaseUrl } from \"./config.js\";\n\nfunction createClient(apiKey?: string, baseUrl?: string): PepkioClient {\n const resolvedBase = resolveBaseUrl(baseUrl);\n return new PepkioClient({\n apiKey: apiKey ?? resolveApiKey(undefined, resolvedBase),\n baseUrl: resolvedBase,\n });\n}\n\nconst program = new Command();\n\nprogram\n .name(\"pepkio-sequence-property-calculator\")\n .description(\"TypeScript client for Pepkio sequence-property-calculator\")\n .option(\n \"--api-key <key>\",\n \"Pepkio API key (tools:run scope); else LOCAL_PEPKIO_API_KEY or PEPKIO_API_KEY from env\",\n )\n .option(\n \"--base-url <url>\",\n \"Tools API base URL (default: https://tools.pepkio.com or PEPKIO_API_BASE_URL)\",\n );\n\nprogram\n .command(\"manifest\")\n .description(\"Fetch and print the tool manifest\")\n .option(\"--examples\", \"List example names only\")\n .action(async (opts: { examples?: boolean }, cmd) => {\n const globals = cmd.parent?.opts() as { apiKey?: string; baseUrl?: string };\n try {\n const client = createClient(globals.apiKey, globals.baseUrl);\n const data = await client.getManifest();\n if (opts.examples) {\n const names = await client.listExamples();\n for (const name of names) {\n console.log(name);\n }\n return;\n }\n console.log(JSON.stringify(data, null, 2));\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n });\n\nprogram\n .command(\"run\")\n .description(\"Run the tool and print the result JSON\")\n .option(\"--example <name>\", \"Run a named manifest example\")\n .option(\"--input-json <json>\", \"Tool input as JSON object\")\n .option(\"--label <label>\", \"Optional run label\")\n .option(\"--idempotency-key <key>\", \"Optional idempotency key\")\n .action(\n async (\n opts: {\n example?: string;\n inputJson?: string;\n label?: string;\n idempotencyKey?: string;\n },\n cmd,\n ) => {\n const globals = cmd.parent?.opts() as { apiKey?: string; baseUrl?: string };\n if (Boolean(opts.example) === Boolean(opts.inputJson)) {\n console.error(\"Provide exactly one of --example or --input-json\");\n process.exit(1);\n }\n try {\n const client = createClient(globals.apiKey, globals.baseUrl);\n let input: Record<string, unknown>;\n if (opts.example) {\n input = await client.getExampleInput(opts.example);\n } else {\n const parsed = JSON.parse(opts.inputJson ?? \"{}\") as unknown;\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n throw new Error(\"--input-json must be a JSON object\");\n }\n input = parsed as Record<string, unknown>;\n }\n const result = await client.run(input, {\n label: opts.label,\n idempotencyKey: opts.idempotencyKey,\n });\n console.log(JSON.stringify(result, null, 2));\n } catch (err) {\n if (err instanceof PepkioAPIError || err instanceof Error) {\n console.error(err.message);\n } else {\n console.error(String(err));\n }\n process.exit(1);\n }\n },\n );\n\nprogram.parseAsync(process.argv).catch((err) => {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n});\n"],"mappings":";;;;;;;;;AAGA,SAAS,eAAe;AAMxB,SAAS,aAAa,QAAiB,SAAgC;AACrE,QAAM,eAAe,eAAe,OAAO;AAC3C,SAAO,IAAI,aAAa;AAAA,IACtB,QAAQ,UAAU,cAAc,QAAW,YAAY;AAAA,IACvD,SAAS;AAAA,EACX,CAAC;AACH;AAEA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,qCAAqC,EAC1C,YAAY,2DAA2D,EACvE;AAAA,EACC;AAAA,EACA;AACF,EACC;AAAA,EACC;AAAA,EACA;AACF;AAEF,QACG,QAAQ,UAAU,EAClB,YAAY,mCAAmC,EAC/C,OAAO,cAAc,yBAAyB,EAC9C,OAAO,OAAO,MAA8B,QAAQ;AACnD,QAAM,UAAU,IAAI,QAAQ,KAAK;AACjC,MAAI;AACF,UAAM,SAAS,aAAa,QAAQ,QAAQ,QAAQ,OAAO;AAC3D,UAAM,OAAO,MAAM,OAAO,YAAY;AACtC,QAAI,KAAK,UAAU;AACjB,YAAM,QAAQ,MAAM,OAAO,aAAa;AACxC,iBAAW,QAAQ,OAAO;AACxB,gBAAQ,IAAI,IAAI;AAAA,MAClB;AACA;AAAA,IACF;AACA,YAAQ,IAAI,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AAAA,EAC3C,SAAS,KAAK;AACZ,YAAQ,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAC9D,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAEH,QACG,QAAQ,KAAK,EACb,YAAY,wCAAwC,EACpD,OAAO,oBAAoB,8BAA8B,EACzD,OAAO,uBAAuB,2BAA2B,EACzD,OAAO,mBAAmB,oBAAoB,EAC9C,OAAO,2BAA2B,0BAA0B,EAC5D;AAAA,EACC,OACE,MAMA,QACG;AACH,UAAM,UAAU,IAAI,QAAQ,KAAK;AACjC,QAAI,QAAQ,KAAK,OAAO,MAAM,QAAQ,KAAK,SAAS,GAAG;AACrD,cAAQ,MAAM,kDAAkD;AAChE,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,QAAI;AACF,YAAM,SAAS,aAAa,QAAQ,QAAQ,QAAQ,OAAO;AAC3D,UAAI;AACJ,UAAI,KAAK,SAAS;AAChB,gBAAQ,MAAM,OAAO,gBAAgB,KAAK,OAAO;AAAA,MACnD,OAAO;AACL,cAAM,SAAS,KAAK,MAAM,KAAK,aAAa,IAAI;AAChD,YAAI,CAAC,UAAU,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GAAG;AAClE,gBAAM,IAAI,MAAM,oCAAoC;AAAA,QACtD;AACA,gBAAQ;AAAA,MACV;AACA,YAAM,SAAS,MAAM,OAAO,IAAI,OAAO;AAAA,QACrC,OAAO,KAAK;AAAA,QACZ,gBAAgB,KAAK;AAAA,MACvB,CAAC;AACD,cAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,IAC7C,SAAS,KAAK;AACZ,UAAI,eAAe,kBAAkB,eAAe,OAAO;AACzD,gBAAQ,MAAM,IAAI,OAAO;AAAA,MAC3B,OAAO;AACL,gBAAQ,MAAM,OAAO,GAAG,CAAC;AAAA,MAC3B;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACF;AAEF,QAAQ,WAAW,QAAQ,IAAI,EAAE,MAAM,CAAC,QAAQ;AAC9C,UAAQ,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAC9D,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
@@ -0,0 +1,130 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Typed API request/response models. */
4
+
5
+ declare const RunResultSchema: z.ZodObject<{
6
+ run_id: z.ZodString;
7
+ status: z.ZodString;
8
+ result: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
9
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
10
+ code: z.ZodOptional<z.ZodString>;
11
+ message: z.ZodOptional<z.ZodString>;
12
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ code?: string | undefined;
15
+ message?: string | undefined;
16
+ details?: Record<string, unknown> | undefined;
17
+ }, {
18
+ code?: string | undefined;
19
+ message?: string | undefined;
20
+ details?: Record<string, unknown> | undefined;
21
+ }>>>;
22
+ result_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ permalink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
24
+ duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
25
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
26
+ run_id: z.ZodString;
27
+ status: z.ZodString;
28
+ result: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
29
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
30
+ code: z.ZodOptional<z.ZodString>;
31
+ message: z.ZodOptional<z.ZodString>;
32
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ code?: string | undefined;
35
+ message?: string | undefined;
36
+ details?: Record<string, unknown> | undefined;
37
+ }, {
38
+ code?: string | undefined;
39
+ message?: string | undefined;
40
+ details?: Record<string, unknown> | undefined;
41
+ }>>>;
42
+ result_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ permalink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
45
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
46
+ run_id: z.ZodString;
47
+ status: z.ZodString;
48
+ result: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
49
+ error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
50
+ code: z.ZodOptional<z.ZodString>;
51
+ message: z.ZodOptional<z.ZodString>;
52
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ code?: string | undefined;
55
+ message?: string | undefined;
56
+ details?: Record<string, unknown> | undefined;
57
+ }, {
58
+ code?: string | undefined;
59
+ message?: string | undefined;
60
+ details?: Record<string, unknown> | undefined;
61
+ }>>>;
62
+ result_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ permalink: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ duration_ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
65
+ }, z.ZodTypeAny, "passthrough">>;
66
+ type RunResult = z.infer<typeof RunResultSchema>;
67
+ declare function parseRunResponse(data: Record<string, unknown>): RunResult;
68
+ declare function raiseForError(result: RunResult): void;
69
+
70
+ /** HTTP client for the Pepkio sequence-property-calculator tool. */
71
+
72
+ interface PepkioClientOptions {
73
+ apiKey?: string;
74
+ baseUrl?: string;
75
+ timeoutMs?: number;
76
+ verifySsl?: boolean;
77
+ fetch?: typeof fetch;
78
+ }
79
+ interface RunOptions {
80
+ idempotencyKey?: string;
81
+ label?: string;
82
+ }
83
+ declare class PepkioClient {
84
+ private readonly baseUrl;
85
+ private readonly apiKey;
86
+ private readonly timeoutMs;
87
+ private readonly verifySsl;
88
+ private readonly fetchFn;
89
+ private manifest;
90
+ constructor(options?: PepkioClientOptions);
91
+ getBaseUrl(): string;
92
+ private requireApiKey;
93
+ private toolPath;
94
+ private handleResponse;
95
+ private request;
96
+ getManifest(options?: {
97
+ refresh?: boolean;
98
+ }): Promise<Record<string, unknown>>;
99
+ listExamples(): Promise<string[]>;
100
+ getExampleInput(name: string): Promise<Record<string, unknown>>;
101
+ run(input: Record<string, unknown>, options?: RunOptions): Promise<RunResult>;
102
+ getRun(runId: string): Promise<RunResult>;
103
+ waitForRun(runId: string, options?: {
104
+ pollIntervalMs?: number;
105
+ timeoutMs?: number;
106
+ }): Promise<RunResult>;
107
+ }
108
+
109
+ /** Configuration and environment resolution. */
110
+ declare const DEFAULT_API_BASE_URL = "https://tools.pepkio.com";
111
+ declare const TOOL_ID = "sequence-property-calculator";
112
+ declare function resolveBaseUrl(override?: string): string;
113
+ declare function resolveApiKey(override?: string, baseUrl?: string): string | undefined;
114
+
115
+ /** API error types. */
116
+ declare class PepkioAPIError extends Error {
117
+ readonly statusCode?: number;
118
+ readonly code?: string;
119
+ readonly details: Record<string, unknown>;
120
+ readonly responseBody?: Record<string, unknown>;
121
+ constructor(message: string, options?: {
122
+ statusCode?: number;
123
+ code?: string;
124
+ details?: Record<string, unknown>;
125
+ responseBody?: Record<string, unknown>;
126
+ });
127
+ toString(): string;
128
+ }
129
+
130
+ export { DEFAULT_API_BASE_URL, PepkioAPIError, PepkioClient, type PepkioClientOptions, type RunOptions, type RunResult, TOOL_ID, parseRunResponse, raiseForError, resolveApiKey, resolveBaseUrl };
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ import {
2
+ DEFAULT_API_BASE_URL,
3
+ PepkioAPIError,
4
+ PepkioClient,
5
+ TOOL_ID,
6
+ parseRunResponse,
7
+ raiseForError,
8
+ resolveApiKey,
9
+ resolveBaseUrl
10
+ } from "./chunk-DMQJTGTY.js";
11
+ export {
12
+ DEFAULT_API_BASE_URL,
13
+ PepkioAPIError,
14
+ PepkioClient,
15
+ TOOL_ID,
16
+ parseRunResponse,
17
+ raiseForError,
18
+ resolveApiKey,
19
+ resolveBaseUrl
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "pepkio-sequence-property-calculator",
3
+ "version": "0.1.0",
4
+ "description": "Call the Pepkio Sequence Property Calculator REST API from Node.js with typed ESM imports and a CLI.",
5
+ "readme": "README_NPM.md",
6
+ "license": "MIT",
7
+ "author": "Pepkio Team",
8
+ "homepage": "https://www.pepkio.com/tools/sequence-property-calculator",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/pepkio/pepkio-sequence-property-calculator-js.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/pepkio/pepkio-sequence-property-calculator-js/issues"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "registry": "https://registry.npmjs.org/"
19
+ },
20
+ "type": "module",
21
+ "keywords": [
22
+ "sequence",
23
+ "fasta",
24
+ "protein",
25
+ "dna",
26
+ "rna",
27
+ "molecular-weight",
28
+ "isoelectric-point",
29
+ "gc-content",
30
+ "extinction-coefficient",
31
+ "gravy",
32
+ "instability-index",
33
+ "ligation",
34
+ "dilution",
35
+ "concentration",
36
+ "sequence-property-calculator",
37
+ "pepkio",
38
+ "molecular-biology",
39
+ "bioinformatics",
40
+ "life-sciences",
41
+ "typescript",
42
+ "node",
43
+ "rest-api",
44
+ "scientific-computing"
45
+ ],
46
+ "main": "./dist/index.js",
47
+ "types": "./dist/index.d.ts",
48
+ "exports": {
49
+ ".": {
50
+ "import": "./dist/index.js",
51
+ "types": "./dist/index.d.ts"
52
+ }
53
+ },
54
+ "bin": {
55
+ "pepkio-sequence-property-calculator": "dist/cli.js"
56
+ },
57
+ "files": [
58
+ "dist"
59
+ ],
60
+ "scripts": {
61
+ "build": "tsup",
62
+ "test": "vitest run test/client.test.ts",
63
+ "test:integration": "vitest run test/integration.test.ts",
64
+ "test:all": "vitest run"
65
+ },
66
+ "engines": {
67
+ "node": ">=18"
68
+ },
69
+ "dependencies": {
70
+ "commander": "^13.1.0",
71
+ "undici": "^7.27.1",
72
+ "zod": "^3.24.2"
73
+ },
74
+ "devDependencies": {
75
+ "@types/node": "^22.15.3",
76
+ "dotenv": "^16.5.0",
77
+ "tsup": "^8.4.0",
78
+ "typescript": "^5.8.3",
79
+ "vitest": "^3.1.2"
80
+ }
81
+ }