@promptlycms/prompts 0.4.1-canary.8df0df3 → 0.4.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 +0 -18
- package/dist/cli.js +0 -4
- package/dist/index.cjs +0 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +0 -7
- package/dist/schema.d.cts +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/{types-uh2qV9-f.d.cts → types-DIVyjOlH.d.cts} +2 -6
- package/dist/{types-uh2qV9-f.d.ts → types-DIVyjOlH.d.ts} +2 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -180,24 +180,6 @@ const [first, second] = await promptly.getComposers([
|
|
|
180
180
|
]);
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
### HTML blocks
|
|
184
|
-
|
|
185
|
-
Composers can contain raw HTML blocks (for vendor-specific markup like MSO conditional comments in transactional emails). These surface as a distinct `html_block` segment type:
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
const composer = await promptly.getComposer('my-email-composer', {
|
|
189
|
-
input: { country: 'United Kingdom' },
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
for (const segment of composer.segments) {
|
|
193
|
-
if (segment.type === 'html_block') {
|
|
194
|
-
console.log(segment.html); // raw HTML, byte-exact
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
Variable references inside an `html_block` (e.g. `<span data-variable-ref data-field-path="country">`) are interpolated normally during `formatComposer()` / `compose()`. Embedded prompt references inside an `html_block` are passed through opaquely — they aren't resolved as named prompts.
|
|
200
|
-
|
|
201
183
|
## Model auto-detection
|
|
202
184
|
|
|
203
185
|
The SDK automatically resolves models configured in the CMS to the correct AI SDK provider based on the model name prefix:
|
package/dist/cli.js
CHANGED
|
@@ -148,10 +148,6 @@ var extractComposerVariables = (composer) => {
|
|
|
148
148
|
for (const v of extractStaticSegmentVariables(segment.content)) {
|
|
149
149
|
vars.add(v);
|
|
150
150
|
}
|
|
151
|
-
} else if (segment.type === "html_block") {
|
|
152
|
-
for (const v of extractStaticSegmentVariables(segment.html)) {
|
|
153
|
-
vars.add(v);
|
|
154
|
-
}
|
|
155
151
|
}
|
|
156
152
|
}
|
|
157
153
|
return [...vars];
|
package/dist/index.cjs
CHANGED
|
@@ -275,13 +275,6 @@ var createPromptlyClient = (config) => {
|
|
|
275
275
|
});
|
|
276
276
|
continue;
|
|
277
277
|
}
|
|
278
|
-
if (segment.type === "html_block") {
|
|
279
|
-
processedSegments.push({
|
|
280
|
-
type: "static",
|
|
281
|
-
content: interpolateStaticSegment(segment.html, input)
|
|
282
|
-
});
|
|
283
|
-
continue;
|
|
284
|
-
}
|
|
285
278
|
const camelName = toCamelCase(segment.promptName);
|
|
286
279
|
if (!promptsByName.has(camelName)) {
|
|
287
280
|
const segmentConfig = segment.config;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-
|
|
2
|
-
export { C as ComposerConfig, b as ComposerFormatFn, c as ComposerGenerateFn, d as
|
|
1
|
+
import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-DIVyjOlH.cjs';
|
|
2
|
+
export { C as ComposerConfig, b as ComposerFormatFn, c as ComposerGenerateFn, d as ComposerId, e as ComposerInputFor, f as ComposerPrompt, g as ComposerPromptMap, h as ComposerPromptNamesFor, i as ComposerPromptSegment, j as ComposerRequest, k as ComposerResponse, l as ComposerResult, m as ComposerSegment, n as ComposerStaticSegment, o as ComposerVariableMap, p as ComposerVersion, q as ErrorResponse, F as FormatInput, G as GetComposerOptions, r as GetOptions, s as PromptConfig, t as PromptId, u as PromptMessage, v as PromptRequest, w as PromptResponse, x as PromptResult, y as PromptVariableMap, z as PromptVersion, A as PublishedVersion, S as SchemaField, B as SchemaFieldParams, V as ValidationRule } from './types-DIVyjOlH.cjs';
|
|
3
3
|
import 'ai';
|
|
4
4
|
|
|
5
5
|
declare const getSdkModelId: (modelId: string) => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-
|
|
2
|
-
export { C as ComposerConfig, b as ComposerFormatFn, c as ComposerGenerateFn, d as
|
|
1
|
+
import { P as PromptlyClientConfig, a as PromptlyClient, E as ErrorCode } from './types-DIVyjOlH.js';
|
|
2
|
+
export { C as ComposerConfig, b as ComposerFormatFn, c as ComposerGenerateFn, d as ComposerId, e as ComposerInputFor, f as ComposerPrompt, g as ComposerPromptMap, h as ComposerPromptNamesFor, i as ComposerPromptSegment, j as ComposerRequest, k as ComposerResponse, l as ComposerResult, m as ComposerSegment, n as ComposerStaticSegment, o as ComposerVariableMap, p as ComposerVersion, q as ErrorResponse, F as FormatInput, G as GetComposerOptions, r as GetOptions, s as PromptConfig, t as PromptId, u as PromptMessage, v as PromptRequest, w as PromptResponse, x as PromptResult, y as PromptVariableMap, z as PromptVersion, A as PublishedVersion, S as SchemaField, B as SchemaFieldParams, V as ValidationRule } from './types-DIVyjOlH.js';
|
|
3
3
|
import 'ai';
|
|
4
4
|
|
|
5
5
|
declare const getSdkModelId: (modelId: string) => string;
|
package/dist/index.js
CHANGED
|
@@ -234,13 +234,6 @@ var createPromptlyClient = (config) => {
|
|
|
234
234
|
});
|
|
235
235
|
continue;
|
|
236
236
|
}
|
|
237
|
-
if (segment.type === "html_block") {
|
|
238
|
-
processedSegments.push({
|
|
239
|
-
type: "static",
|
|
240
|
-
content: interpolateStaticSegment(segment.html, input)
|
|
241
|
-
});
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
237
|
const camelName = toCamelCase(segment.promptName);
|
|
245
238
|
if (!promptsByName.has(camelName)) {
|
|
246
239
|
const segmentConfig = segment.config;
|
package/dist/schema.d.cts
CHANGED
package/dist/schema.d.ts
CHANGED
|
@@ -108,11 +108,7 @@ type ComposerPromptSegment = {
|
|
|
108
108
|
userMessage: string | null;
|
|
109
109
|
config: Record<string, unknown>;
|
|
110
110
|
};
|
|
111
|
-
type
|
|
112
|
-
type: 'html_block';
|
|
113
|
-
html: string;
|
|
114
|
-
};
|
|
115
|
-
type ComposerSegment = ComposerStaticSegment | ComposerPromptSegment | ComposerHtmlBlockSegment;
|
|
111
|
+
type ComposerSegment = ComposerStaticSegment | ComposerPromptSegment;
|
|
116
112
|
type ComposerConfig = {
|
|
117
113
|
schema: SchemaField[];
|
|
118
114
|
inputData: unknown;
|
|
@@ -199,4 +195,4 @@ type PromptlyClient = {
|
|
|
199
195
|
getComposers: <const T extends readonly ComposerRequest[]>(entries: T) => Promise<GetComposersResults<T>>;
|
|
200
196
|
};
|
|
201
197
|
|
|
202
|
-
export type {
|
|
198
|
+
export type { PublishedVersion as A, SchemaFieldParams as B, ComposerConfig as C, ErrorCode as E, FormatInput as F, GetComposerOptions as G, PromptlyClientConfig as P, SchemaField as S, ValidationRule as V, PromptlyClient as a, ComposerFormatFn as b, ComposerGenerateFn as c, ComposerId as d, ComposerInputFor as e, ComposerPrompt as f, ComposerPromptMap as g, ComposerPromptNamesFor as h, ComposerPromptSegment as i, ComposerRequest as j, ComposerResponse as k, ComposerResult as l, ComposerSegment as m, ComposerStaticSegment as n, ComposerVariableMap as o, ComposerVersion as p, ErrorResponse as q, GetOptions as r, PromptConfig as s, PromptId as t, PromptMessage as u, PromptRequest as v, PromptResponse as w, PromptResult as x, PromptVariableMap as y, PromptVersion as z };
|
|
@@ -108,11 +108,7 @@ type ComposerPromptSegment = {
|
|
|
108
108
|
userMessage: string | null;
|
|
109
109
|
config: Record<string, unknown>;
|
|
110
110
|
};
|
|
111
|
-
type
|
|
112
|
-
type: 'html_block';
|
|
113
|
-
html: string;
|
|
114
|
-
};
|
|
115
|
-
type ComposerSegment = ComposerStaticSegment | ComposerPromptSegment | ComposerHtmlBlockSegment;
|
|
111
|
+
type ComposerSegment = ComposerStaticSegment | ComposerPromptSegment;
|
|
116
112
|
type ComposerConfig = {
|
|
117
113
|
schema: SchemaField[];
|
|
118
114
|
inputData: unknown;
|
|
@@ -199,4 +195,4 @@ type PromptlyClient = {
|
|
|
199
195
|
getComposers: <const T extends readonly ComposerRequest[]>(entries: T) => Promise<GetComposersResults<T>>;
|
|
200
196
|
};
|
|
201
197
|
|
|
202
|
-
export type {
|
|
198
|
+
export type { PublishedVersion as A, SchemaFieldParams as B, ComposerConfig as C, ErrorCode as E, FormatInput as F, GetComposerOptions as G, PromptlyClientConfig as P, SchemaField as S, ValidationRule as V, PromptlyClient as a, ComposerFormatFn as b, ComposerGenerateFn as c, ComposerId as d, ComposerInputFor as e, ComposerPrompt as f, ComposerPromptMap as g, ComposerPromptNamesFor as h, ComposerPromptSegment as i, ComposerRequest as j, ComposerResponse as k, ComposerResult as l, ComposerSegment as m, ComposerStaticSegment as n, ComposerVariableMap as o, ComposerVersion as p, ErrorResponse as q, GetOptions as r, PromptConfig as s, PromptId as t, PromptMessage as u, PromptRequest as v, PromptResponse as w, PromptResult as x, PromptVariableMap as y, PromptVersion as z };
|