@ai-sdk/svelte 3.0.0-beta.3 → 3.0.0-beta.31

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/CHANGELOG.md CHANGED
@@ -1,5 +1,246 @@
1
1
  # @ai-sdk/svelte
2
2
 
3
+ ## 3.0.0-beta.31
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [6622441]
8
+ - Updated dependencies [ced8eee]
9
+ - Updated dependencies [cee64b2]
10
+ - Updated dependencies [ee38081]
11
+ - Updated dependencies [dd5fd43]
12
+ - ai@5.0.0-beta.31
13
+ - @ai-sdk/provider-utils@3.0.0-beta.8
14
+
15
+ ## 3.0.0-beta.30
16
+
17
+ ### Patch Changes
18
+
19
+ - ai@5.0.0-beta.30
20
+
21
+ ## 3.0.0-beta.29
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [e7fcc86]
26
+ - Updated dependencies [d92b9a8]
27
+ - @ai-sdk/provider-utils@3.0.0-beta.7
28
+ - ai@5.0.0-beta.29
29
+
30
+ ## 3.0.0-beta.28
31
+
32
+ ### Patch Changes
33
+
34
+ - ac34802: Add clear object function to StructuredObject
35
+ - Updated dependencies [ac34802]
36
+ - Updated dependencies [84343eb]
37
+ - Updated dependencies [a753b3a]
38
+ - @ai-sdk/provider-utils@3.0.0-beta.6
39
+ - ai@5.0.0-beta.28
40
+
41
+ ## 3.0.0-beta.27
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [d5ae088]
46
+ - ai@5.0.0-beta.27
47
+
48
+ ## 3.0.0-beta.26
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [ae77a99]
53
+ - Updated dependencies [1f6ce57]
54
+ - Updated dependencies [5a975a4]
55
+ - Updated dependencies [2a62513]
56
+ - Updated dependencies [904fa5e]
57
+ - Updated dependencies [f81c720]
58
+ - ai@5.0.0-beta.26
59
+
60
+ ## 3.0.0-beta.25
61
+
62
+ ### Patch Changes
63
+
64
+ - ai@5.0.0-beta.25
65
+
66
+ ## 3.0.0-beta.24
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [add5ac1]
71
+ - Updated dependencies [57edfcb]
72
+ - Updated dependencies [ff1c81a]
73
+ - Updated dependencies [e4c8647]
74
+ - Updated dependencies [383cbfa]
75
+ - ai@5.0.0-beta.24
76
+ - @ai-sdk/provider-utils@3.0.0-beta.5
77
+
78
+ ## 3.0.0-beta.23
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [89ba235]
83
+ - ai@5.0.0-beta.23
84
+
85
+ ## 3.0.0-beta.22
86
+
87
+ ### Patch Changes
88
+
89
+ - 205077b: fix: improve Zod compatibility
90
+ - Updated dependencies [de2d2ab]
91
+ - Updated dependencies [6c42e56]
92
+ - Updated dependencies [c93a8bc]
93
+ - Updated dependencies [20398f2]
94
+ - Updated dependencies [86293e5]
95
+ - Updated dependencies [205077b]
96
+ - ai@5.0.0-beta.22
97
+ - @ai-sdk/provider-utils@3.0.0-beta.4
98
+
99
+ ## 3.0.0-beta.21
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [38ae5cc]
104
+ - Updated dependencies [faea29f]
105
+ - Updated dependencies [90ac328]
106
+ - Updated dependencies [4a1e0c8]
107
+ - Updated dependencies [30ac566]
108
+ - ai@5.0.0-beta.21
109
+
110
+ ## 3.0.0-beta.20
111
+
112
+ ### Patch Changes
113
+
114
+ - Updated dependencies [4c8f834]
115
+ - ai@5.0.0-beta.20
116
+
117
+ ## 3.0.0-beta.19
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [10b21eb]
122
+ - Updated dependencies [75c3396]
123
+ - Updated dependencies [05d2819]
124
+ - Updated dependencies [db64cbe]
125
+ - ai@5.0.0-beta.19
126
+ - @ai-sdk/provider-utils@3.0.0-beta.3
127
+
128
+ ## 3.0.0-beta.18
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [d3960e3]
133
+ - Updated dependencies [9338f3e]
134
+ - ai@5.0.0-beta.18
135
+
136
+ ## 3.0.0-beta.17
137
+
138
+ ### Patch Changes
139
+
140
+ - ai@5.0.0-beta.17
141
+
142
+ ## 3.0.0-beta.16
143
+
144
+ ### Patch Changes
145
+
146
+ - ai@5.0.0-beta.16
147
+
148
+ ## 3.0.0-beta.15
149
+
150
+ ### Patch Changes
151
+
152
+ - Updated dependencies [8e31d46]
153
+ - ai@5.0.0-beta.15
154
+
155
+ ## 3.0.0-beta.14
156
+
157
+ ### Patch Changes
158
+
159
+ - ai@5.0.0-beta.14
160
+
161
+ ## 3.0.0-beta.13
162
+
163
+ ### Patch Changes
164
+
165
+ - Updated dependencies [377bbcf]
166
+ - Updated dependencies [ce1d1f3]
167
+ - Updated dependencies [c040e2f]
168
+ - Updated dependencies [c808e4d]
169
+ - ai@5.0.0-beta.13
170
+
171
+ ## 3.0.0-beta.12
172
+
173
+ ### Patch Changes
174
+
175
+ - Updated dependencies [fc0380b]
176
+ - Updated dependencies [51f497d]
177
+ - Updated dependencies [4f3776c]
178
+ - ai@5.0.0-beta.12
179
+
180
+ ## 3.0.0-beta.11
181
+
182
+ ### Patch Changes
183
+
184
+ - Updated dependencies [9e40cbe]
185
+ - ai@5.0.0-beta.11
186
+
187
+ ## 3.0.0-beta.10
188
+
189
+ ### Patch Changes
190
+
191
+ - Updated dependencies [16ccfb2]
192
+ - Updated dependencies [90ca2b9]
193
+ - Updated dependencies [af1d5a5]
194
+ - Updated dependencies [2b637d6]
195
+ - ai@5.0.0-beta.10
196
+
197
+ ## 3.0.0-beta.9
198
+
199
+ ### Patch Changes
200
+
201
+ - Updated dependencies [86cfc72]
202
+ - ai@5.0.0-beta.9
203
+
204
+ ## 3.0.0-beta.8
205
+
206
+ ### Patch Changes
207
+
208
+ - Updated dependencies [6909543]
209
+ - Updated dependencies [c8fce91]
210
+ - Updated dependencies [9121250]
211
+ - ai@5.0.0-beta.8
212
+
213
+ ## 3.0.0-beta.7
214
+
215
+ ### Patch Changes
216
+
217
+ - Updated dependencies [60132dd]
218
+ - ai@5.0.0-beta.7
219
+
220
+ ## 3.0.0-beta.6
221
+
222
+ ### Patch Changes
223
+
224
+ - Updated dependencies [143c55b]
225
+ - Updated dependencies [f04ffe4]
226
+ - Updated dependencies [97c35c0]
227
+ - Updated dependencies [fccf75c]
228
+ - ai@5.0.0-beta.6
229
+
230
+ ## 3.0.0-beta.5
231
+
232
+ ### Patch Changes
233
+
234
+ - Updated dependencies [4f3e637]
235
+ - ai@5.0.0-beta.5
236
+
237
+ ## 3.0.0-beta.4
238
+
239
+ ### Patch Changes
240
+
241
+ - Updated dependencies [09f41ac]
242
+ - ai@5.0.0-beta.4
243
+
3
244
  ## 3.0.0-beta.3
4
245
 
5
246
  ### Patch Changes
@@ -2,7 +2,7 @@ import { type FetchFunction, type InferSchema } from '@ai-sdk/provider-utils';
2
2
  import { type DeepPartial, type Schema } from 'ai';
3
3
  import type * as z3 from 'zod/v3';
4
4
  import type * as z4 from 'zod/v4';
5
- export type Experimental_StructuredObjectOptions<SCHEMA extends z3.Schema | z4.ZodType | Schema, RESULT = InferSchema<SCHEMA>> = {
5
+ export type Experimental_StructuredObjectOptions<SCHEMA extends z3.Schema | z4.core.$ZodType | Schema, RESULT = InferSchema<SCHEMA>> = {
6
6
  /**
7
7
  * The API endpoint. It should stream JSON that matches the schema as chunked text.
8
8
  */
@@ -55,7 +55,7 @@ export type Experimental_StructuredObjectOptions<SCHEMA extends z3.Schema | z4.Z
55
55
  */
56
56
  credentials?: RequestCredentials;
57
57
  };
58
- export declare class StructuredObject<SCHEMA extends z3.Schema | z4.ZodType | Schema, RESULT = InferSchema<SCHEMA>, INPUT = unknown> {
58
+ export declare class StructuredObject<SCHEMA extends z3.Schema | z4.core.$ZodType | Schema, RESULT = InferSchema<SCHEMA>, INPUT = unknown> {
59
59
  #private;
60
60
  /**
61
61
  * The current value for the generated object. Updated as the API streams JSON chunks.
@@ -76,5 +76,9 @@ export declare class StructuredObject<SCHEMA extends z3.Schema | z4.ZodType | Sc
76
76
  * Calls the API with the provided input as JSON body.
77
77
  */
78
78
  submit: (input: INPUT) => Promise<void>;
79
+ /**
80
+ * Clears the object state.
81
+ */
82
+ clear: () => void;
79
83
  }
80
84
  //# sourceMappingURL=structured-object.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"structured-object.svelte.d.ts","sourceRoot":"","sources":["../src/structured-object.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,MAAM,EACZ,MAAM,IAAI,CAAC;AACZ,OAAO,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAQlC,MAAM,MAAM,oCAAoC,CAC9C,MAAM,SAAS,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,OAAO,GAAG,MAAM,EAC9C,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,IAC1B;IACF;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAEnC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB;;;WAGG;QACH,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAE3B;;WAEG;QACH,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;KAC1B,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;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EZ;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAEnC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB;;;WAGG;QACH,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAE3B;;WAEG;QACH,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;KAC1B,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAE3B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC;IAE3C;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEF,qBAAa,gBAAgB,CAC3B,MAAM,SAAS,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,MAAM,EACpD,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,EAC5B,KAAK,GAAG,OAAO;;IAWf;;OAEG;IACH,IAAI,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAE5C;IAKD,0CAA0C;IAC1C,IAAI,KAAK,sBAER;IAED;;OAEG;IACH,IAAI,OAAO,YAEV;gBAEW,OAAO,EAAE,oCAAoC,CAAC,MAAM,EAAE,MAAM,CAAC;IAUzE;;OAEG;IACH,IAAI,aASF;IAEF;;OAEG;IACH,MAAM,UAAiB,KAAK,mBAqF1B;IAEF;;OAEG;IACH,KAAK,aAGH;CAOH"}
@@ -56,9 +56,8 @@ export class StructuredObject {
56
56
  */
57
57
  submit = async (input) => {
58
58
  try {
59
- this.#store.object = undefined; // reset the data
59
+ this.#clearObject();
60
60
  this.#store.loading = true;
61
- this.#store.error = undefined;
62
61
  const abortController = new AbortController();
63
62
  this.#abortController = abortController;
64
63
  const actualFetch = this.#options.fetch ?? fetch;
@@ -120,4 +119,16 @@ export class StructuredObject {
120
119
  this.#store.error = coalescedError;
121
120
  }
122
121
  };
122
+ /**
123
+ * Clears the object state.
124
+ */
125
+ clear = () => {
126
+ this.stop();
127
+ this.#clearObject();
128
+ };
129
+ #clearObject = () => {
130
+ this.#store.object = undefined;
131
+ this.#store.error = undefined;
132
+ this.#store.loading = false;
133
+ };
123
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/svelte",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.31",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "svelte": "^5.31.0",
31
- "zod": "^3.25.49"
31
+ "zod": "^3.25.76 || ^4"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "zod": {
@@ -36,8 +36,8 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "ai": "5.0.0-beta.3",
40
- "@ai-sdk/provider-utils": "3.0.0-beta.2"
39
+ "ai": "5.0.0-beta.31",
40
+ "@ai-sdk/provider-utils": "3.0.0-beta.8"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -58,7 +58,7 @@
58
58
  "typescript-eslint": "^8.20.0",
59
59
  "vite": "^6.0.0",
60
60
  "vitest": "^3.0.0",
61
- "zod": "3.25.49",
61
+ "zod": "3.25.76",
62
62
  "@vercel/ai-tsconfig": "0.0.0"
63
63
  },
64
64
  "homepage": "https://ai-sdk.dev/docs",
@@ -22,7 +22,7 @@ import {
22
22
  } from './structured-object-context.svelte.js';
23
23
 
24
24
  export type Experimental_StructuredObjectOptions<
25
- SCHEMA extends z3.Schema | z4.ZodType | Schema,
25
+ SCHEMA extends z3.Schema | z4.core.$ZodType | Schema,
26
26
  RESULT = InferSchema<SCHEMA>,
27
27
  > = {
28
28
  /**
@@ -88,7 +88,7 @@ export type Experimental_StructuredObjectOptions<
88
88
  };
89
89
 
90
90
  export class StructuredObject<
91
- SCHEMA extends z3.Schema | z4.ZodType | Schema,
91
+ SCHEMA extends z3.Schema | z4.core.$ZodType | Schema,
92
92
  RESULT = InferSchema<SCHEMA>,
93
93
  INPUT = unknown,
94
94
  > {
@@ -152,9 +152,9 @@ export class StructuredObject<
152
152
  */
153
153
  submit = async (input: INPUT) => {
154
154
  try {
155
- this.#store.object = undefined; // reset the data
155
+ this.#clearObject();
156
+
156
157
  this.#store.loading = true;
157
- this.#store.error = undefined;
158
158
 
159
159
  const abortController = new AbortController();
160
160
  this.#abortController = abortController;
@@ -236,4 +236,18 @@ export class StructuredObject<
236
236
  this.#store.error = coalescedError;
237
237
  }
238
238
  };
239
+
240
+ /**
241
+ * Clears the object state.
242
+ */
243
+ clear = () => {
244
+ this.stop();
245
+ this.#clearObject();
246
+ };
247
+
248
+ #clearObject = () => {
249
+ this.#store.object = undefined;
250
+ this.#store.error = undefined;
251
+ this.#store.loading = false;
252
+ };
239
253
  }