@mate-academy/prompt-client 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,6 +104,13 @@ Error model (only when NO `fallback` is provided):
104
104
  wrong-shape prompt (a chat prompt fetched via `getPrompt`, or vice versa).
105
105
  Both extend `LLMPromptError` and carry `promptName` + `cause`.
106
106
 
107
+ `LLMPromptListError` (thrown only by `listPrompts`, see [Catalog](#catalog-for-codegen))
108
+ sits outside this hierarchy on purpose: it is **label-scoped**, not
109
+ prompt-scoped, so it extends `Error` directly and carries `label` + `cause`
110
+ instead of `promptName`. A broad `catch (error) { if (error instanceof
111
+ LLMPromptError) ... }` will **not** catch it — handle it explicitly, or match on
112
+ `error.name === 'LLMPromptListError'`.
113
+
107
114
  With `fallback` set, `getPrompt` never rejects: on any failure it resolves to
108
115
  the fallback text with `version: 0` and `isFallback: true`, and the logger
109
116
  receives a warning.
@@ -10,6 +10,7 @@ const LangfusePrompt_1 = require("../../providers/Langfuse/LangfusePrompt");
10
10
  const LANGFUSE_TEXT_PROMPT_TYPE = 'text';
11
11
  const LANGFUSE_CHAT_PROMPT_TYPE = 'chat';
12
12
  const MILLISECONDS_PER_SECOND = 1000;
13
+ const FALLBACK_PROMPT_VERSION = 0;
13
14
  class LangfusePromptClient {
14
15
  constructor(client, providerOptions, logger) {
15
16
  this.client = client;
@@ -128,7 +129,7 @@ class LangfusePromptClient {
128
129
  buildTextFallbackPrompt(name, fallback, options) {
129
130
  return new client_1.TextPromptClient({
130
131
  name,
131
- version: options?.version ?? 0,
132
+ version: FALLBACK_PROMPT_VERSION,
132
133
  labels: this.resolveFallbackLabels(options),
133
134
  tags: [],
134
135
  config: {},
@@ -143,7 +144,7 @@ class LangfusePromptClient {
143
144
  buildChatFallbackPrompt(name, fallback, options) {
144
145
  return new client_1.ChatPromptClient({
145
146
  name,
146
- version: options?.version ?? 0,
147
+ version: FALLBACK_PROMPT_VERSION,
147
148
  labels: this.resolveFallbackLabels(options),
148
149
  tags: [],
149
150
  config: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mate-academy/prompt-client",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Provider-agnostic LLM prompt management client (Langfuse, InMemory)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",