@prompt-helm/sdk 0.2.0 → 1.0.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/dist/index.js CHANGED
@@ -1,570 +1,137 @@
1
- import 'fs';
2
-
3
1
  // src/errors.ts
4
2
  var PromptHelmError = class extends Error {
5
- /** HTTP status code (or the inferred status for SSE error events). */
6
- statusCode;
7
- /** Machine-readable error code from the API envelope, e.g. `VALIDATION_ERROR`. */
8
- errorCode;
9
- /** Request correlation id — quote this when contacting PromptHelm support. */
10
- requestId;
11
- constructor(statusCode, errorCode, requestId, message) {
3
+ constructor(code, message, status) {
12
4
  super(message);
13
- this.name = "PromptHelmError";
14
- this.statusCode = statusCode;
15
- this.errorCode = errorCode;
16
- this.requestId = requestId;
17
- }
18
- };
19
- var AuthenticationError = class extends PromptHelmError {
20
- constructor(statusCode, errorCode, requestId, message) {
21
- super(statusCode, errorCode, requestId, message);
22
- this.name = "AuthenticationError";
23
- }
24
- };
25
- var AuthorizationError = class extends PromptHelmError {
26
- constructor(statusCode, errorCode, requestId, message) {
27
- super(statusCode, errorCode, requestId, message);
28
- this.name = "AuthorizationError";
29
- }
30
- };
31
- var RateLimitError = class extends PromptHelmError {
32
- constructor(statusCode, errorCode, requestId, message) {
33
- super(statusCode, errorCode, requestId, message);
34
- this.name = "RateLimitError";
35
- }
36
- };
37
- var NotFoundError = class extends PromptHelmError {
38
- constructor(statusCode, errorCode, requestId, message) {
39
- super(statusCode, errorCode, requestId, message);
40
- this.name = "NotFoundError";
5
+ this.code = code;
6
+ this.status = status;
41
7
  }
8
+ code;
9
+ status;
10
+ name = "PromptHelmError";
42
11
  };
43
- var ApiError = class extends PromptHelmError {
44
- constructor(statusCode, errorCode, requestId, message) {
45
- super(statusCode, errorCode, requestId, message);
46
- this.name = "ApiError";
47
- }
48
- };
49
- var TimeoutError = class extends Error {
50
- timeoutMs;
51
- constructor(timeoutMs, message) {
52
- super(message ?? `Request timed out after ${String(timeoutMs)}ms`);
53
- this.name = "TimeoutError";
54
- this.timeoutMs = timeoutMs;
55
- }
56
- };
57
- function fallbackMessage(status) {
58
- if (status === 401) {
59
- return "Authentication failed. Check that your API key is valid and not revoked.";
60
- }
61
- if (status === 403) {
62
- return "You do not have permission to perform this action.";
63
- }
64
- if (status === 404) {
65
- return "The requested prompt or resource was not found.";
66
- }
67
- if (status === 429) {
68
- return "Rate limit exceeded. Slow down requests or upgrade your plan.";
69
- }
70
- if (status >= 500) {
71
- return "PromptHelm encountered an internal error. The request can be retried.";
72
- }
73
- return `Request failed with status ${String(status)}.`;
74
- }
75
- function normalizeMessage(message) {
76
- return Array.isArray(message) ? message.join("; ") : message;
77
- }
78
- function parseErrorResponse(status, body) {
79
- const envelope = isErrorEnvelope(body) ? body : null;
80
- const message = envelope ? normalizeMessage(envelope.message) : fallbackMessage(status);
81
- const errorCode = envelope?.errorCode;
82
- const requestId = envelope?.requestId;
83
- const statusCode = envelope?.statusCode ?? status;
84
- if (statusCode === 401) {
85
- return new AuthenticationError(statusCode, errorCode, requestId, message);
86
- }
87
- if (statusCode === 403) {
88
- return new AuthorizationError(statusCode, errorCode, requestId, message);
89
- }
90
- if (statusCode === 404) {
91
- return new NotFoundError(statusCode, errorCode, requestId, message);
92
- }
93
- if (statusCode === 429) {
94
- return new RateLimitError(statusCode, errorCode, requestId, message);
95
- }
96
- return new ApiError(statusCode, errorCode, requestId, message);
97
- }
98
- function isErrorEnvelope(value) {
99
- if (typeof value !== "object" || value === null) {
100
- return false;
101
- }
102
- const record = value;
103
- const message = record["message"];
104
- const messageOk = typeof message === "string" || Array.isArray(message) && message.every((item) => typeof item === "string");
105
- return typeof record["statusCode"] === "number" && typeof record["errorCode"] === "string" && messageOk;
106
- }
107
-
108
- // src/retry.ts
109
- var DEFAULT_BASE_DELAY_MS = 250;
110
- var DEFAULT_MAX_DELAY_MS = 8e3;
111
- function defaultSleep(ms) {
112
- return new Promise((resolve) => setTimeout(resolve, ms));
113
- }
114
- function computeBackoff(attempt, baseDelayMs, maxDelayMs, random) {
115
- const exponential = baseDelayMs * Math.pow(2, attempt);
116
- const jitter = Math.floor(random() * 100);
117
- return Math.min(exponential + jitter, maxDelayMs);
118
- }
119
- async function withRetry(fn, opts) {
120
- const baseDelayMs = opts.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
121
- const maxDelayMs = opts.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;
122
- const sleep = opts.sleep ?? defaultSleep;
123
- const random = opts.random ?? Math.random;
124
- let attempt = 0;
125
- while (true) {
126
- try {
127
- return await fn();
128
- } catch (err) {
129
- if (attempt >= opts.maxRetries || !opts.isRetryable(err)) {
130
- throw err;
131
- }
132
- const delay = computeBackoff(attempt, baseDelayMs, maxDelayMs, random);
133
- await sleep(delay);
134
- attempt += 1;
135
- }
136
- }
137
- }
138
12
 
139
- // src/stream.ts
140
- var SseParser = class {
141
- buffer = "";
142
- dataLines = [];
143
- feed(chunk) {
144
- this.buffer += chunk;
145
- const frames = [];
146
- let newlineIndex = this.indexOfLineEnd(this.buffer);
147
- while (newlineIndex.index !== -1) {
148
- const line = this.buffer.slice(0, newlineIndex.index);
149
- this.buffer = this.buffer.slice(newlineIndex.index + newlineIndex.length);
150
- if (line === "") {
151
- if (this.dataLines.length > 0) {
152
- frames.push({ data: this.dataLines.join("\n") });
153
- this.dataLines = [];
154
- }
155
- } else if (!line.startsWith(":")) {
156
- const colonIndex = line.indexOf(":");
157
- let field;
158
- let value;
159
- if (colonIndex === -1) {
160
- field = line;
161
- value = "";
162
- } else {
163
- field = line.slice(0, colonIndex);
164
- value = line.slice(colonIndex + 1);
165
- if (value.startsWith(" ")) {
166
- value = value.slice(1);
167
- }
168
- }
169
- if (field === "data") {
170
- this.dataLines.push(value);
171
- }
172
- }
173
- newlineIndex = this.indexOfLineEnd(this.buffer);
174
- }
175
- return frames;
176
- }
177
- flush() {
178
- if (this.dataLines.length === 0) {
179
- return [];
180
- }
181
- const frame = { data: this.dataLines.join("\n") };
182
- this.dataLines = [];
183
- return [frame];
184
- }
185
- indexOfLineEnd(input) {
186
- const crlf = input.indexOf("\r\n");
187
- const lf = input.indexOf("\n");
188
- const cr = input.indexOf("\r");
189
- if (crlf !== -1 && (lf === -1 || crlf <= lf) && (cr === -1 || crlf <= cr)) {
190
- return { index: crlf, length: 2 };
191
- }
192
- if (lf !== -1 && (cr === -1 || lf < cr)) {
193
- return { index: lf, length: 1 };
194
- }
195
- if (cr !== -1) {
196
- return { index: cr, length: 1 };
197
- }
198
- return { index: -1, length: 0 };
199
- }
200
- };
201
- function parseStreamEvent(data) {
202
- const trimmed = data.trim();
203
- if (trimmed === "" || trimmed === "[DONE]") {
204
- return null;
205
- }
206
- let parsed;
207
- try {
208
- parsed = JSON.parse(trimmed);
209
- } catch {
210
- return null;
211
- }
212
- if (!isStreamEvent(parsed)) {
213
- return null;
214
- }
215
- return parsed;
13
+ // src/template.ts
14
+ var VARIABLE = /\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}/g;
15
+ function extractVariables(template) {
16
+ const names = /* @__PURE__ */ new Set();
17
+ for (const match of template.matchAll(VARIABLE)) {
18
+ names.add(match[1]);
19
+ }
20
+ return [...names];
216
21
  }
217
- function isStreamEvent(value) {
218
- if (typeof value !== "object" || value === null) {
219
- return false;
220
- }
221
- const record = value;
222
- const type = record["type"];
223
- if (type === "chunk") {
224
- return typeof record["content"] === "string";
22
+ function render(template, vars = {}) {
23
+ const missing = extractVariables(template).filter((name) => !Object.hasOwn(vars, name));
24
+ if (missing.length > 0) {
25
+ throw new PromptHelmError("missing_variables", `Missing variables: ${missing.join(", ")}`);
225
26
  }
226
- if (type === "done") {
227
- return typeof record["inputTokens"] === "number" && typeof record["outputTokens"] === "number" && typeof record["totalTokens"] === "number" && typeof record["cost"] === "number" && typeof record["model"] === "string" && typeof record["latencyMs"] === "number";
228
- }
229
- if (type === "error") {
230
- return typeof record["errorCode"] === "string" && typeof record["message"] === "string";
231
- }
232
- return false;
27
+ return template.replace(VARIABLE, (_, name) => String(vars[name]));
233
28
  }
234
- async function* readSseStream(body, signal) {
235
- const reader = body.getReader();
236
- const decoder = new TextDecoder("utf-8");
237
- const parser = new SseParser();
238
- const abortListener = () => {
239
- void reader.cancel().catch(() => {
240
- });
241
- };
242
- if (signal) {
243
- if (signal.aborted) {
244
- await reader.cancel().catch(() => void 0);
245
- return;
246
- }
247
- signal.addEventListener("abort", abortListener, { once: true });
248
- }
249
- try {
250
- while (true) {
251
- const { value, done } = await reader.read();
252
- if (done) {
253
- const tail = parser.flush();
254
- for (const frame of tail) {
255
- const event = parseStreamEvent(frame.data);
256
- if (event) {
257
- yield event;
258
- }
259
- }
260
- return;
261
- }
262
- const text = decoder.decode(value, { stream: true });
263
- const frames = parser.feed(text);
264
- for (const frame of frames) {
265
- const event = parseStreamEvent(frame.data);
266
- if (event) {
267
- yield event;
268
- }
269
- }
270
- if (signal?.aborted) {
271
- return;
272
- }
273
- }
274
- } finally {
275
- if (signal) {
276
- signal.removeEventListener("abort", abortListener);
277
- }
278
- reader.releaseLock();
279
- }
280
- }
281
- var SDK_VERSION = "0.2.0" ;
282
- var SDK_USER_AGENT = `prompt-helm-sdk-node/${SDK_VERSION}`;
283
29
 
284
30
  // src/client.ts
285
- var DEFAULT_BASE_URL = "https://api.prompthelm.app";
286
- var DEFAULT_TIMEOUT_MS = 6e4;
287
- var DEFAULT_MAX_RETRIES = 2;
288
- var API_KEY_LENGTH = 36;
289
- var API_KEY_PREFIX = "phk_";
290
- var SDK_UA = SDK_USER_AGENT;
31
+ var DEFAULT_BASE_URL = "https://prompthelm.app";
291
32
  var PromptHelm = class {
292
- apiKey;
293
- baseURL;
294
- timeout;
295
- maxRetries;
296
- fetchFn;
297
- extraHeaders;
298
- userAgent;
299
- constructor(config) {
300
- if (typeof config.apiKey !== "string" || config.apiKey.length === 0) {
301
- throw new Error(
302
- "PromptHelm: `apiKey` is required. Provide a PromptHelm API key starting with `phk_`."
303
- );
304
- }
305
- if (!config.apiKey.startsWith(API_KEY_PREFIX) || config.apiKey.length !== API_KEY_LENGTH) {
306
- throw new Error(
307
- "PromptHelm: `apiKey` must start with `phk_` followed by 32 hex characters."
308
- );
309
- }
310
- const baseURL = config.baseURL ?? DEFAULT_BASE_URL;
311
- if (!isValidUrl(baseURL)) {
312
- throw new Error(`PromptHelm: \`baseURL\` is not a valid URL: ${baseURL}`);
313
- }
314
- const timeout = config.timeout ?? DEFAULT_TIMEOUT_MS;
315
- if (!Number.isFinite(timeout) || timeout <= 0) {
316
- throw new Error("PromptHelm: `timeout` must be a positive number of milliseconds.");
317
- }
318
- const maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES;
319
- if (!Number.isInteger(maxRetries) || maxRetries < 0) {
320
- throw new Error("PromptHelm: `maxRetries` must be a non-negative integer.");
321
- }
322
- const fetchImpl = config.fetch ?? globalThis.fetch;
323
- if (typeof fetchImpl !== "function") {
324
- throw new Error(
325
- "PromptHelm: global `fetch` is not available. Use Node.js >= 18 or pass `config.fetch`."
326
- );
33
+ #apiKey;
34
+ #baseUrl;
35
+ #ttl;
36
+ #timeout;
37
+ #fetch;
38
+ #onError;
39
+ #cache = /* @__PURE__ */ new Map();
40
+ #inflight = /* @__PURE__ */ new Map();
41
+ constructor(options = {}) {
42
+ const apiKey = options.apiKey ?? env("PROMPTHELM_API_KEY");
43
+ if (!apiKey) throw new Error("PromptHelm: pass apiKey or set PROMPTHELM_API_KEY");
44
+ this.#apiKey = apiKey;
45
+ const baseUrl = options.baseUrl ?? env("PROMPTHELM_BASE_URL") ?? DEFAULT_BASE_URL;
46
+ this.#baseUrl = baseUrl.replace(/\/+$/, "");
47
+ this.#ttl = options.ttl ?? 6e4;
48
+ this.#timeout = options.timeout ?? 3e3;
49
+ this.#fetch = options.fetch ?? ((input, init) => globalThis.fetch(input, init));
50
+ this.#onError = options.onError ?? ((error, slug) => console.warn(`[PromptHelm] ${slug}: ${error.message}`));
51
+ }
52
+ /** The live version of a prompt with its variables filled in. */
53
+ async get(slug, options = {}) {
54
+ const { vars, fallback } = options;
55
+ try {
56
+ const entry = await this.#entry(slug);
57
+ return render(entry.content, vars);
58
+ } catch (error) {
59
+ const failure = toPromptHelmError(error);
60
+ if (fallback === void 0) throw failure;
61
+ this.#onError(failure, slug);
62
+ return render(fallback, vars);
63
+ }
64
+ }
65
+ #entry(slug) {
66
+ const cached = this.#cache.get(slug);
67
+ if (!cached) return this.#load(slug);
68
+ if (Date.now() - cached.fetchedAt >= this.#ttl) {
69
+ this.#load(slug).catch((error) => {
70
+ cached.fetchedAt = Date.now();
71
+ this.#onError(toPromptHelmError(error), slug);
72
+ });
327
73
  }
328
- this.apiKey = config.apiKey;
329
- this.baseURL = baseURL.replace(/\/+$/, "");
330
- this.timeout = timeout;
331
- this.maxRetries = maxRetries;
332
- this.fetchFn = fetchImpl;
333
- this.extraHeaders = config.headers ?? {};
334
- this.userAgent = config.userAgent ? `${config.userAgent} ${SDK_UA}` : SDK_UA;
74
+ return Promise.resolve(cached);
335
75
  }
336
- async execute(request, options) {
337
- return withRetry(
338
- async () => this.executeOnce(request, options),
339
- {
340
- maxRetries: this.maxRetries,
341
- isRetryable: (err) => this.isRetryable(err)
342
- }
343
- );
76
+ #load(slug) {
77
+ let pending = this.#inflight.get(slug);
78
+ if (!pending) {
79
+ pending = this.#request(slug).finally(() => this.#inflight.delete(slug));
80
+ this.#inflight.set(slug, pending);
81
+ }
82
+ return pending;
344
83
  }
345
- stream(request, options) {
346
- const url = `${this.baseURL}/api/v1/gateway/stream`;
347
- const body = JSON.stringify(request);
348
- const headers = this.buildHeaders({ accept: "text/event-stream" });
349
- const timeout = this.timeout;
350
- const fetchFn = this.fetchFn;
351
- const signal = options?.signal;
352
- return {
353
- [Symbol.asyncIterator]: () => {
354
- const controller = new AbortController();
355
- const composite = composeSignals(controller.signal, signal);
356
- const timeoutHandle = setTimeout(() => {
357
- controller.abort(new TimeoutError(timeout));
358
- }, timeout);
359
- const responsePromise = fetchFn(url, {
360
- method: "POST",
361
- headers,
362
- body,
363
- signal: composite
364
- }).then(async (response) => {
365
- if (!response.ok) {
366
- clearTimeout(timeoutHandle);
367
- const errorBody = await safeReadJson(response);
368
- throw parseErrorResponse(response.status, errorBody);
369
- }
370
- if (!response.body) {
371
- clearTimeout(timeoutHandle);
372
- throw new ApiError(
373
- response.status,
374
- void 0,
375
- void 0,
376
- "Server returned an empty stream body."
377
- );
378
- }
379
- return response.body;
380
- });
381
- let inner = null;
382
- let finalized = false;
383
- const finalize = () => {
384
- if (finalized) {
385
- return;
386
- }
387
- finalized = true;
388
- clearTimeout(timeoutHandle);
389
- };
390
- return {
391
- next: async () => {
392
- try {
393
- if (!inner) {
394
- const body2 = await responsePromise.catch((err) => {
395
- if (isAbortError(err) && controller.signal.aborted) {
396
- const reason = controller.signal.reason;
397
- if (reason instanceof TimeoutError) {
398
- throw reason;
399
- }
400
- }
401
- throw err;
402
- });
403
- inner = readSseStream(body2, signal);
404
- }
405
- const result = await inner.next();
406
- if (result.done === true) {
407
- finalize();
408
- return { value: void 0, done: true };
409
- }
410
- const event = result.value;
411
- if (event.type === "error") {
412
- finalize();
413
- throw new ApiError(
414
- 500,
415
- event.errorCode,
416
- event.requestId,
417
- event.message
418
- );
419
- }
420
- if (event.type === "done") {
421
- finalize();
422
- return { value: event, done: false };
423
- }
424
- return { value: event, done: false };
425
- } catch (err) {
426
- finalize();
427
- if (isAbortError(err) && controller.signal.aborted && controller.signal.reason instanceof TimeoutError) {
428
- throw controller.signal.reason;
429
- }
430
- throw err;
431
- }
432
- },
433
- return: async () => {
434
- finalize();
435
- controller.abort();
436
- if (inner) {
437
- await inner.return().catch(() => void 0);
438
- }
439
- return { value: void 0, done: true };
440
- },
441
- throw: async (err) => {
442
- finalize();
443
- controller.abort();
444
- if (inner) {
445
- await inner.return().catch(() => void 0);
446
- }
447
- throw err;
448
- }
449
- };
450
- }
84
+ async #request(slug) {
85
+ const cached = this.#cache.get(slug);
86
+ const headers = {
87
+ authorization: `Bearer ${this.#apiKey}`,
88
+ accept: "application/json"
451
89
  };
452
- }
453
- async executeOnce(request, options) {
454
- const url = `${this.baseURL}/api/v1/gateway/execute`;
455
- const controller = new AbortController();
456
- const composite = composeSignals(controller.signal, options?.signal);
457
- const timeoutHandle = setTimeout(() => {
458
- controller.abort(new TimeoutError(this.timeout));
459
- }, this.timeout);
90
+ if (cached?.etag) headers["if-none-match"] = cached.etag;
91
+ let response;
460
92
  try {
461
- const response = await this.fetchFn(url, {
462
- method: "POST",
463
- headers: this.buildHeaders({ accept: "application/json" }),
464
- body: JSON.stringify(request),
465
- signal: composite
93
+ response = await this.#fetch(`${this.#baseUrl}/v1/prompts/${encodeURIComponent(slug)}`, {
94
+ headers,
95
+ signal: AbortSignal.timeout(this.#timeout)
466
96
  });
467
- if (!response.ok) {
468
- const errorBody = await safeReadJson(response);
469
- throw parseErrorResponse(response.status, errorBody);
470
- }
471
- const payload = await response.json();
472
- return payload;
473
- } catch (err) {
474
- if (isAbortError(err) && controller.signal.aborted && controller.signal.reason instanceof TimeoutError) {
475
- throw controller.signal.reason;
97
+ } catch (error) {
98
+ if (error?.name === "TimeoutError") {
99
+ throw new PromptHelmError("timeout", `No response within ${this.#timeout} ms`);
476
100
  }
477
- throw err;
478
- } finally {
479
- clearTimeout(timeoutHandle);
480
- }
481
- }
482
- buildHeaders(extra) {
483
- return {
484
- "content-type": "application/json",
485
- accept: extra["accept"] ?? "application/json",
486
- authorization: `Bearer ${this.apiKey}`,
487
- "user-agent": this.userAgent,
488
- ...this.extraHeaders
101
+ throw new PromptHelmError("network", error instanceof Error ? error.message : String(error));
102
+ }
103
+ if (response.status === 304 && cached) {
104
+ const entry2 = { ...cached, fetchedAt: Date.now() };
105
+ this.#cache.set(slug, entry2);
106
+ return entry2;
107
+ }
108
+ if (!response.ok) throw await errorFromResponse(response);
109
+ const payload = await response.json();
110
+ const entry = {
111
+ content: payload.content,
112
+ etag: response.headers.get("etag"),
113
+ fetchedAt: Date.now()
489
114
  };
490
- }
491
- isRetryable(err) {
492
- if (err instanceof TimeoutError) {
493
- return false;
494
- }
495
- if (err instanceof AuthenticationError) {
496
- return false;
497
- }
498
- if (err instanceof AuthorizationError) {
499
- return false;
500
- }
501
- if (err instanceof NotFoundError) {
502
- return false;
503
- }
504
- if (err instanceof RateLimitError) {
505
- return false;
506
- }
507
- if (err instanceof PromptHelmError) {
508
- return err.statusCode >= 500 && err.statusCode <= 599;
509
- }
510
- if (isAbortError(err)) {
511
- return false;
512
- }
513
- return true;
115
+ this.#cache.set(slug, entry);
116
+ return entry;
514
117
  }
515
118
  };
516
- function composeSignals(primary, external) {
517
- if (!external) {
518
- return primary;
519
- }
520
- if (external.aborted) {
521
- return external;
522
- }
523
- const onAbort = () => {
524
- if (!primary.aborted) {
525
- const reason = external.reason;
526
- compositeController.abort(reason);
527
- }
528
- };
529
- const compositeController = new AbortController();
530
- external.addEventListener("abort", onAbort, { once: true });
531
- primary.addEventListener(
532
- "abort",
533
- () => {
534
- const reason = primary.reason;
535
- compositeController.abort(reason);
536
- },
537
- { once: true }
538
- );
539
- return compositeController.signal;
119
+ async function errorFromResponse(response) {
120
+ const body = await response.json().catch(() => null);
121
+ const message = body?.error?.message ?? `HTTP ${response.status}`;
122
+ const code = response.status === 401 || response.status === 403 ? "unauthorized" : response.status === 404 ? "not_found" : "server";
123
+ return new PromptHelmError(code, message, response.status);
540
124
  }
541
- function isAbortError(err) {
542
- if (typeof err !== "object" || err === null) {
543
- return false;
544
- }
545
- const candidate = err;
546
- return candidate.name === "AbortError";
125
+ function env(name) {
126
+ return typeof process === "undefined" ? void 0 : process.env[name] || void 0;
547
127
  }
548
- function isValidUrl(input) {
549
- try {
550
- new URL(input);
551
- return true;
552
- } catch {
553
- return false;
554
- }
128
+ function toPromptHelmError(error) {
129
+ if (error instanceof PromptHelmError) return error;
130
+ return new PromptHelmError("server", error instanceof Error ? error.message : String(error));
555
131
  }
556
- async function safeReadJson(response) {
557
- try {
558
- const text = await response.text();
559
- if (text === "") {
560
- return null;
561
- }
562
- return JSON.parse(text);
563
- } catch {
564
- return null;
565
- }
566
- }
567
-
568
- export { ApiError, AuthenticationError, AuthorizationError, NotFoundError, PromptHelm, PromptHelmError, RateLimitError, TimeoutError };
569
- //# sourceMappingURL=index.js.map
570
- //# sourceMappingURL=index.js.map
132
+ export {
133
+ PromptHelm,
134
+ PromptHelmError,
135
+ extractVariables,
136
+ render
137
+ };