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

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,234 @@
1
1
  # @ai-sdk/svelte
2
2
 
3
+ ## 3.0.0-beta.30
4
+
5
+ ### Patch Changes
6
+
7
+ - ai@5.0.0-beta.30
8
+
9
+ ## 3.0.0-beta.29
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [e7fcc86]
14
+ - Updated dependencies [d92b9a8]
15
+ - @ai-sdk/provider-utils@3.0.0-beta.7
16
+ - ai@5.0.0-beta.29
17
+
18
+ ## 3.0.0-beta.28
19
+
20
+ ### Patch Changes
21
+
22
+ - ac34802: Add clear object function to StructuredObject
23
+ - Updated dependencies [ac34802]
24
+ - Updated dependencies [84343eb]
25
+ - Updated dependencies [a753b3a]
26
+ - @ai-sdk/provider-utils@3.0.0-beta.6
27
+ - ai@5.0.0-beta.28
28
+
29
+ ## 3.0.0-beta.27
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [d5ae088]
34
+ - ai@5.0.0-beta.27
35
+
36
+ ## 3.0.0-beta.26
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [ae77a99]
41
+ - Updated dependencies [1f6ce57]
42
+ - Updated dependencies [5a975a4]
43
+ - Updated dependencies [2a62513]
44
+ - Updated dependencies [904fa5e]
45
+ - Updated dependencies [f81c720]
46
+ - ai@5.0.0-beta.26
47
+
48
+ ## 3.0.0-beta.25
49
+
50
+ ### Patch Changes
51
+
52
+ - ai@5.0.0-beta.25
53
+
54
+ ## 3.0.0-beta.24
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [add5ac1]
59
+ - Updated dependencies [57edfcb]
60
+ - Updated dependencies [ff1c81a]
61
+ - Updated dependencies [e4c8647]
62
+ - Updated dependencies [383cbfa]
63
+ - ai@5.0.0-beta.24
64
+ - @ai-sdk/provider-utils@3.0.0-beta.5
65
+
66
+ ## 3.0.0-beta.23
67
+
68
+ ### Patch Changes
69
+
70
+ - Updated dependencies [89ba235]
71
+ - ai@5.0.0-beta.23
72
+
73
+ ## 3.0.0-beta.22
74
+
75
+ ### Patch Changes
76
+
77
+ - 205077b: fix: improve Zod compatibility
78
+ - Updated dependencies [de2d2ab]
79
+ - Updated dependencies [6c42e56]
80
+ - Updated dependencies [c93a8bc]
81
+ - Updated dependencies [20398f2]
82
+ - Updated dependencies [86293e5]
83
+ - Updated dependencies [205077b]
84
+ - ai@5.0.0-beta.22
85
+ - @ai-sdk/provider-utils@3.0.0-beta.4
86
+
87
+ ## 3.0.0-beta.21
88
+
89
+ ### Patch Changes
90
+
91
+ - Updated dependencies [38ae5cc]
92
+ - Updated dependencies [faea29f]
93
+ - Updated dependencies [90ac328]
94
+ - Updated dependencies [4a1e0c8]
95
+ - Updated dependencies [30ac566]
96
+ - ai@5.0.0-beta.21
97
+
98
+ ## 3.0.0-beta.20
99
+
100
+ ### Patch Changes
101
+
102
+ - Updated dependencies [4c8f834]
103
+ - ai@5.0.0-beta.20
104
+
105
+ ## 3.0.0-beta.19
106
+
107
+ ### Patch Changes
108
+
109
+ - Updated dependencies [10b21eb]
110
+ - Updated dependencies [75c3396]
111
+ - Updated dependencies [05d2819]
112
+ - Updated dependencies [db64cbe]
113
+ - ai@5.0.0-beta.19
114
+ - @ai-sdk/provider-utils@3.0.0-beta.3
115
+
116
+ ## 3.0.0-beta.18
117
+
118
+ ### Patch Changes
119
+
120
+ - Updated dependencies [d3960e3]
121
+ - Updated dependencies [9338f3e]
122
+ - ai@5.0.0-beta.18
123
+
124
+ ## 3.0.0-beta.17
125
+
126
+ ### Patch Changes
127
+
128
+ - ai@5.0.0-beta.17
129
+
130
+ ## 3.0.0-beta.16
131
+
132
+ ### Patch Changes
133
+
134
+ - ai@5.0.0-beta.16
135
+
136
+ ## 3.0.0-beta.15
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [8e31d46]
141
+ - ai@5.0.0-beta.15
142
+
143
+ ## 3.0.0-beta.14
144
+
145
+ ### Patch Changes
146
+
147
+ - ai@5.0.0-beta.14
148
+
149
+ ## 3.0.0-beta.13
150
+
151
+ ### Patch Changes
152
+
153
+ - Updated dependencies [377bbcf]
154
+ - Updated dependencies [ce1d1f3]
155
+ - Updated dependencies [c040e2f]
156
+ - Updated dependencies [c808e4d]
157
+ - ai@5.0.0-beta.13
158
+
159
+ ## 3.0.0-beta.12
160
+
161
+ ### Patch Changes
162
+
163
+ - Updated dependencies [fc0380b]
164
+ - Updated dependencies [51f497d]
165
+ - Updated dependencies [4f3776c]
166
+ - ai@5.0.0-beta.12
167
+
168
+ ## 3.0.0-beta.11
169
+
170
+ ### Patch Changes
171
+
172
+ - Updated dependencies [9e40cbe]
173
+ - ai@5.0.0-beta.11
174
+
175
+ ## 3.0.0-beta.10
176
+
177
+ ### Patch Changes
178
+
179
+ - Updated dependencies [16ccfb2]
180
+ - Updated dependencies [90ca2b9]
181
+ - Updated dependencies [af1d5a5]
182
+ - Updated dependencies [2b637d6]
183
+ - ai@5.0.0-beta.10
184
+
185
+ ## 3.0.0-beta.9
186
+
187
+ ### Patch Changes
188
+
189
+ - Updated dependencies [86cfc72]
190
+ - ai@5.0.0-beta.9
191
+
192
+ ## 3.0.0-beta.8
193
+
194
+ ### Patch Changes
195
+
196
+ - Updated dependencies [6909543]
197
+ - Updated dependencies [c8fce91]
198
+ - Updated dependencies [9121250]
199
+ - ai@5.0.0-beta.8
200
+
201
+ ## 3.0.0-beta.7
202
+
203
+ ### Patch Changes
204
+
205
+ - Updated dependencies [60132dd]
206
+ - ai@5.0.0-beta.7
207
+
208
+ ## 3.0.0-beta.6
209
+
210
+ ### Patch Changes
211
+
212
+ - Updated dependencies [143c55b]
213
+ - Updated dependencies [f04ffe4]
214
+ - Updated dependencies [97c35c0]
215
+ - Updated dependencies [fccf75c]
216
+ - ai@5.0.0-beta.6
217
+
218
+ ## 3.0.0-beta.5
219
+
220
+ ### Patch Changes
221
+
222
+ - Updated dependencies [4f3e637]
223
+ - ai@5.0.0-beta.5
224
+
225
+ ## 3.0.0-beta.4
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [09f41ac]
230
+ - ai@5.0.0-beta.4
231
+
3
232
  ## 3.0.0-beta.3
4
233
 
5
234
  ### 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":"","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AE3B;;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.30",
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-sdk/provider-utils": "3.0.0-beta.7",
40
+ "ai": "5.0.0-beta.30"
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
  }