@quiverai/sdk 0.8.0 → 0.8.2
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/commonjs/funcs/createSVGsGenerateSVG.js +1 -1
- package/dist/commonjs/funcs/createSVGsGenerateSVG.js.map +1 -1
- package/dist/commonjs/funcs/modelsGetModel.js +1 -1
- package/dist/commonjs/funcs/modelsGetModel.js.map +1 -1
- package/dist/commonjs/funcs/modelsListModels.js +1 -1
- package/dist/commonjs/funcs/modelsListModels.js.map +1 -1
- package/dist/commonjs/funcs/vectorizeSVGVectorizeSVG.js +1 -4
- package/dist/commonjs/funcs/vectorizeSVGVectorizeSVG.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/event-streams.d.ts +7 -2
- package/dist/commonjs/lib/event-streams.d.ts.map +1 -1
- package/dist/commonjs/lib/event-streams.js +2 -1
- package/dist/commonjs/lib/event-streams.js.map +1 -1
- package/dist/commonjs/lib/retries.js +7 -0
- package/dist/commonjs/lib/retries.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/index.d.ts +1 -0
- package/dist/commonjs/sdk/models/shared/index.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/index.js +1 -0
- package/dist/commonjs/sdk/models/shared/index.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/publicerrorenvelope.d.ts +8 -3
- package/dist/commonjs/sdk/models/shared/publicerrorenvelope.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/publicerrorenvelope.js +8 -3
- package/dist/commonjs/sdk/models/shared/publicerrorenvelope.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/publicerrorsseeventdata.d.ts +40 -0
- package/dist/commonjs/sdk/models/shared/publicerrorsseeventdata.d.ts.map +1 -0
- package/dist/commonjs/sdk/models/shared/publicerrorsseeventdata.js +82 -0
- package/dist/commonjs/sdk/models/shared/publicerrorsseeventdata.js.map +1 -0
- package/dist/commonjs/sdk/models/shared/svgstreamevent.d.ts +25 -6
- package/dist/commonjs/sdk/models/shared/svgstreamevent.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/svgstreamevent.js +30 -6
- package/dist/commonjs/sdk/models/shared/svgstreamevent.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/svgstreameventdata.d.ts +4 -1
- package/dist/commonjs/sdk/models/shared/svgstreameventdata.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/svgstreameventdata.js +2 -0
- package/dist/commonjs/sdk/models/shared/svgstreameventdata.js.map +1 -1
- package/dist/esm/funcs/createSVGsGenerateSVG.js +1 -1
- package/dist/esm/funcs/createSVGsGenerateSVG.js.map +1 -1
- package/dist/esm/funcs/modelsGetModel.js +1 -1
- package/dist/esm/funcs/modelsGetModel.js.map +1 -1
- package/dist/esm/funcs/modelsListModels.js +1 -1
- package/dist/esm/funcs/modelsListModels.js.map +1 -1
- package/dist/esm/funcs/vectorizeSVGVectorizeSVG.js +1 -4
- package/dist/esm/funcs/vectorizeSVGVectorizeSVG.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/event-streams.d.ts +7 -2
- package/dist/esm/lib/event-streams.d.ts.map +1 -1
- package/dist/esm/lib/event-streams.js +2 -1
- package/dist/esm/lib/event-streams.js.map +1 -1
- package/dist/esm/lib/retries.js +7 -0
- package/dist/esm/lib/retries.js.map +1 -1
- package/dist/esm/sdk/models/shared/index.d.ts +1 -0
- package/dist/esm/sdk/models/shared/index.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/index.js +1 -0
- package/dist/esm/sdk/models/shared/index.js.map +1 -1
- package/dist/esm/sdk/models/shared/publicerrorenvelope.d.ts +8 -3
- package/dist/esm/sdk/models/shared/publicerrorenvelope.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/publicerrorenvelope.js +8 -3
- package/dist/esm/sdk/models/shared/publicerrorenvelope.js.map +1 -1
- package/dist/esm/sdk/models/shared/publicerrorsseeventdata.d.ts +40 -0
- package/dist/esm/sdk/models/shared/publicerrorsseeventdata.d.ts.map +1 -0
- package/dist/esm/sdk/models/shared/publicerrorsseeventdata.js +45 -0
- package/dist/esm/sdk/models/shared/publicerrorsseeventdata.js.map +1 -0
- package/dist/esm/sdk/models/shared/svgstreamevent.d.ts +25 -6
- package/dist/esm/sdk/models/shared/svgstreamevent.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/svgstreamevent.js +28 -5
- package/dist/esm/sdk/models/shared/svgstreamevent.js.map +1 -1
- package/dist/esm/sdk/models/shared/svgstreameventdata.d.ts +4 -1
- package/dist/esm/sdk/models/shared/svgstreameventdata.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/svgstreameventdata.js +2 -0
- package/dist/esm/sdk/models/shared/svgstreameventdata.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/createSVGsGenerateSVG.ts +2 -2
- package/src/funcs/modelsGetModel.ts +2 -2
- package/src/funcs/modelsListModels.ts +2 -2
- package/src/funcs/vectorizeSVGVectorizeSVG.ts +6 -5
- package/src/lib/config.ts +3 -3
- package/src/lib/event-streams.ts +15 -7
- package/src/lib/retries.ts +8 -0
- package/src/sdk/models/shared/index.ts +1 -0
- package/src/sdk/models/shared/publicerrorenvelope.ts +8 -3
- package/src/sdk/models/shared/publicerrorsseeventdata.ts +80 -0
- package/src/sdk/models/shared/svgstreamevent.ts +59 -11
- package/src/sdk/models/shared/svgstreameventdata.ts +8 -0
|
@@ -6,12 +6,16 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../../../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
PublicErrorSseEventData,
|
|
11
|
+
PublicErrorSseEventData$inboundSchema,
|
|
12
|
+
} from "./publicerrorsseeventdata.js";
|
|
9
13
|
import {
|
|
10
14
|
SvgStreamEventData,
|
|
11
15
|
SvgStreamEventData$inboundSchema,
|
|
12
16
|
} from "./svgstreameventdata.js";
|
|
13
17
|
|
|
14
|
-
export type
|
|
18
|
+
export type Five = {
|
|
15
19
|
/**
|
|
16
20
|
* The event payload. Shape depends on the `type` phase discriminator.
|
|
17
21
|
*/
|
|
@@ -30,7 +34,7 @@ export type Four = {
|
|
|
30
34
|
retry?: number | undefined;
|
|
31
35
|
};
|
|
32
36
|
|
|
33
|
-
export type
|
|
37
|
+
export type Four = {
|
|
34
38
|
/**
|
|
35
39
|
* The event payload. Shape depends on the `type` phase discriminator.
|
|
36
40
|
*/
|
|
@@ -49,7 +53,7 @@ export type Three = {
|
|
|
49
53
|
retry?: number | undefined;
|
|
50
54
|
};
|
|
51
55
|
|
|
52
|
-
export type
|
|
56
|
+
export type Three = {
|
|
53
57
|
/**
|
|
54
58
|
* The event payload. Shape depends on the `type` phase discriminator.
|
|
55
59
|
*/
|
|
@@ -68,7 +72,7 @@ export type Two = {
|
|
|
68
72
|
retry?: number | undefined;
|
|
69
73
|
};
|
|
70
74
|
|
|
71
|
-
export type
|
|
75
|
+
export type Two = {
|
|
72
76
|
/**
|
|
73
77
|
* The event payload. Shape depends on the `type` phase discriminator.
|
|
74
78
|
*/
|
|
@@ -87,13 +91,29 @@ export type One = {
|
|
|
87
91
|
retry?: number | undefined;
|
|
88
92
|
};
|
|
89
93
|
|
|
94
|
+
export type One = {
|
|
95
|
+
data: PublicErrorSseEventData;
|
|
96
|
+
/**
|
|
97
|
+
* The SSE event name (sent via the `event:` line).
|
|
98
|
+
*/
|
|
99
|
+
event: "error";
|
|
100
|
+
/**
|
|
101
|
+
* Optional SSE event id (sent via the `id:` line).
|
|
102
|
+
*/
|
|
103
|
+
id?: string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Optional SSE retry value in milliseconds (sent via the `retry:` line).
|
|
106
|
+
*/
|
|
107
|
+
retry?: number | undefined;
|
|
108
|
+
};
|
|
109
|
+
|
|
90
110
|
/**
|
|
91
|
-
* Server-sent event (SSE) envelope for SVG streaming operations. Each SSE message uses the `event:` line for the phase discriminator and the `data:` line for a JSON payload. For `n > 1`, events are interleaved: use `data.index` for output position and `data.id` as the stable per-output identifier. The stream terminates with `data: [DONE]`.
|
|
111
|
+
* Server-sent event (SSE) envelope for SVG streaming operations. Each SSE message uses the `event:` line for the phase discriminator and the `data:` line for a JSON payload. For `n > 1`, events are interleaved: use `data.index` for output position and `data.id` as the stable per-output identifier. Terminal failures emit `event: error` with public error data. The stream terminates with `data: [DONE]`.
|
|
92
112
|
*/
|
|
93
|
-
export type SvgStreamEvent = One | Two | Three | Four;
|
|
113
|
+
export type SvgStreamEvent = One | Two | Three | Four | Five;
|
|
94
114
|
|
|
95
115
|
/** @internal */
|
|
96
|
-
export const
|
|
116
|
+
export const Five$inboundSchema: z.ZodType<Five, z.ZodTypeDef, unknown> = z
|
|
97
117
|
.object({
|
|
98
118
|
data: z.unknown().transform((v, ctx) => {
|
|
99
119
|
if (typeof v !== "string") return v;
|
|
@@ -109,6 +129,33 @@ export const Four$inboundSchema: z.ZodType<Four, z.ZodTypeDef, unknown> = z
|
|
|
109
129
|
retry: z.number().int().optional(),
|
|
110
130
|
});
|
|
111
131
|
|
|
132
|
+
export function fiveFromJSON(
|
|
133
|
+
jsonString: string,
|
|
134
|
+
): SafeParseResult<Five, SDKValidationError> {
|
|
135
|
+
return safeParse(
|
|
136
|
+
jsonString,
|
|
137
|
+
(x) => Five$inboundSchema.parse(JSON.parse(x)),
|
|
138
|
+
`Failed to parse 'Five' from JSON`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** @internal */
|
|
143
|
+
export const Four$inboundSchema: z.ZodType<Four, z.ZodTypeDef, unknown> = z
|
|
144
|
+
.object({
|
|
145
|
+
data: z.unknown().transform((v, ctx) => {
|
|
146
|
+
if (typeof v !== "string") return v;
|
|
147
|
+
try {
|
|
148
|
+
return JSON.parse(v);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
151
|
+
return z.NEVER;
|
|
152
|
+
}
|
|
153
|
+
}).pipe(SvgStreamEventData$inboundSchema),
|
|
154
|
+
event: z.literal("draft"),
|
|
155
|
+
id: z.string().optional(),
|
|
156
|
+
retry: z.number().int().optional(),
|
|
157
|
+
});
|
|
158
|
+
|
|
112
159
|
export function fourFromJSON(
|
|
113
160
|
jsonString: string,
|
|
114
161
|
): SafeParseResult<Four, SDKValidationError> {
|
|
@@ -131,7 +178,7 @@ export const Three$inboundSchema: z.ZodType<Three, z.ZodTypeDef, unknown> = z
|
|
|
131
178
|
return z.NEVER;
|
|
132
179
|
}
|
|
133
180
|
}).pipe(SvgStreamEventData$inboundSchema),
|
|
134
|
-
event: z.literal("
|
|
181
|
+
event: z.literal("reasoning"),
|
|
135
182
|
id: z.string().optional(),
|
|
136
183
|
retry: z.number().int().optional(),
|
|
137
184
|
});
|
|
@@ -158,7 +205,7 @@ export const Two$inboundSchema: z.ZodType<Two, z.ZodTypeDef, unknown> = z
|
|
|
158
205
|
return z.NEVER;
|
|
159
206
|
}
|
|
160
207
|
}).pipe(SvgStreamEventData$inboundSchema),
|
|
161
|
-
event: z.literal("
|
|
208
|
+
event: z.literal("generating"),
|
|
162
209
|
id: z.string().optional(),
|
|
163
210
|
retry: z.number().int().optional(),
|
|
164
211
|
});
|
|
@@ -184,8 +231,8 @@ export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z
|
|
|
184
231
|
ctx.addIssue({ code: "custom", message: `malformed json: ${err}` });
|
|
185
232
|
return z.NEVER;
|
|
186
233
|
}
|
|
187
|
-
}).pipe(
|
|
188
|
-
event: z.literal("
|
|
234
|
+
}).pipe(PublicErrorSseEventData$inboundSchema),
|
|
235
|
+
event: z.literal("error"),
|
|
189
236
|
id: z.string().optional(),
|
|
190
237
|
retry: z.number().int().optional(),
|
|
191
238
|
});
|
|
@@ -210,6 +257,7 @@ export const SvgStreamEvent$inboundSchema: z.ZodType<
|
|
|
210
257
|
z.lazy(() => Two$inboundSchema),
|
|
211
258
|
z.lazy(() => Three$inboundSchema),
|
|
212
259
|
z.lazy(() => Four$inboundSchema),
|
|
260
|
+
z.lazy(() => Five$inboundSchema),
|
|
213
261
|
]);
|
|
214
262
|
|
|
215
263
|
export function svgStreamEventFromJSON(
|
|
@@ -6,6 +6,10 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../../../lib/schemas.js";
|
|
7
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
PublicErrorSseEventData,
|
|
11
|
+
PublicErrorSseEventData$inboundSchema,
|
|
12
|
+
} from "./publicerrorsseeventdata.js";
|
|
9
13
|
import {
|
|
10
14
|
SvgContentEventData,
|
|
11
15
|
SvgContentEventData$inboundSchema,
|
|
@@ -29,6 +33,7 @@ import {
|
|
|
29
33
|
export type SvgStreamEventData =
|
|
30
34
|
| SvgContentEventData
|
|
31
35
|
| SvgDraftEventData
|
|
36
|
+
| (PublicErrorSseEventData & { type: "error" })
|
|
32
37
|
| SvgGeneratingEventData
|
|
33
38
|
| SvgReasoningEventData;
|
|
34
39
|
|
|
@@ -40,6 +45,9 @@ export const SvgStreamEventData$inboundSchema: z.ZodType<
|
|
|
40
45
|
> = z.union([
|
|
41
46
|
SvgContentEventData$inboundSchema,
|
|
42
47
|
SvgDraftEventData$inboundSchema,
|
|
48
|
+
PublicErrorSseEventData$inboundSchema.and(
|
|
49
|
+
z.object({ type: z.literal("error") }),
|
|
50
|
+
),
|
|
43
51
|
SvgGeneratingEventData$inboundSchema,
|
|
44
52
|
SvgReasoningEventData$inboundSchema,
|
|
45
53
|
]);
|