@ai-sdk/svelte 5.0.17 → 5.0.18

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,14 @@
1
1
  # @ai-sdk/svelte
2
2
 
3
+ ## 5.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 0363440: Promote `useObject` (React, Vue) and `StructuredObject` (Svelte) to stable exports, with deprecated experimental aliases for backwards compatibility.
8
+ - Updated dependencies [ac306ed]
9
+ - @ai-sdk/provider-utils@5.0.6
10
+ - ai@7.0.18
11
+
3
12
  ## 5.0.17
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,19 @@
1
+ import type { FlexibleSchema, InferSchema } from '@ai-sdk/provider-utils';
2
+ import { StructuredObject, type StructuredObjectOptions } from './structured-object.svelte.js';
1
3
  export { Chat, type CreateUIMessage, type UIMessage } from './chat.svelte.js';
2
4
  export { Completion, type CompletionOptions } from './completion.svelte.js';
3
5
  export { createAIContext } from './context-provider.js';
4
- export { StructuredObject as Experimental_StructuredObject, type Experimental_StructuredObjectOptions, } from './structured-object.svelte.js';
6
+ export { StructuredObject, type StructuredObjectOptions, } from './structured-object.svelte.js';
7
+ /**
8
+ * @deprecated Use `StructuredObject` instead.
9
+ */
10
+ export declare const Experimental_StructuredObject: typeof StructuredObject;
11
+ /**
12
+ * @deprecated Use `StructuredObject` instead.
13
+ */
14
+ export type Experimental_StructuredObject<SCHEMA extends FlexibleSchema, RESULT = InferSchema<SCHEMA>, INPUT = unknown> = StructuredObject<SCHEMA, RESULT, INPUT>;
15
+ /**
16
+ * @deprecated Use `StructuredObjectOptions` instead.
17
+ */
18
+ export type Experimental_StructuredObjectOptions<SCHEMA extends FlexibleSchema, RESULT = InferSchema<SCHEMA>> = StructuredObjectOptions<SCHEMA, RESULT>;
5
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.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AM,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,12 @@
1
+ import { StructuredObject, } from './structured-object.svelte.js';
1
2
  export { Chat } from './chat.svelte.js';
2
3
  export { Completion } from './completion.svelte.js';
3
4
  export { createAIContext } from './context-provider.js';
4
- export { StructuredObject as Experimental_StructuredObject, } from './structured-object.svelte.js';
5
+ export { StructuredObject, } from './structured-object.svelte.js';
6
+ // deprecated aliases
7
+ // note: declared here (instead of export aliases) so that the `@deprecated`
8
+ // tags are preserved in the bundled type declarations
9
+ /**
10
+ * @deprecated Use `StructuredObject` instead.
11
+ */
12
+ export const Experimental_StructuredObject = StructuredObject;
@@ -1,6 +1,6 @@
1
1
  import { type FetchFunction } from '@ai-sdk/provider-utils';
2
2
  import { type DeepPartial, type FlexibleSchema, type InferSchema } from 'ai';
3
- export type Experimental_StructuredObjectOptions<SCHEMA extends FlexibleSchema, RESULT = InferSchema<SCHEMA>> = {
3
+ export type StructuredObjectOptions<SCHEMA extends FlexibleSchema, RESULT = InferSchema<SCHEMA>> = {
4
4
  /**
5
5
  * The API endpoint. It should stream JSON that matches the schema as chunked text.
6
6
  */
@@ -65,7 +65,7 @@ export declare class StructuredObject<SCHEMA extends FlexibleSchema, RESULT = In
65
65
  * Flag that indicates whether an API request is in progress.
66
66
  */
67
67
  get loading(): boolean;
68
- constructor(options: Experimental_StructuredObjectOptions<SCHEMA, RESULT>);
68
+ constructor(options: StructuredObjectOptions<SCHEMA, RESULT>);
69
69
  /**
70
70
  * Abort the current request immediately, keep the current partial object if any.
71
71
  */
@@ -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,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,IAAI,CAAC;AAOZ,MAAM,MAAM,oCAAoC,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AAS,CAE5C;IAKD,0CAA0C;IAC1C,IAAI,KAAK,sBAER;IAED;;OAEG;IACH,IAAI,OAAO,YAEV;gBAEW,OAAO,EAAE,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC;IAU5D;;OAEG;IACH,IAAI,aASF;IAEF;;OAEG;IACH,MAAM,GAAU,OAAO,KAAK,mBAqF1B;IAEF;;OAEG;IACH,KAAK,aAGH;CAOH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/svelte",
3
- "version": "5.0.17",
3
+ "version": "5.0.18",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist",
@@ -34,8 +34,8 @@
34
34
  "svelte": "^5.31.0"
35
35
  },
36
36
  "dependencies": {
37
- "@ai-sdk/provider-utils": "5.0.5",
38
- "ai": "7.0.17"
37
+ "@ai-sdk/provider-utils": "5.0.6",
38
+ "ai": "7.0.18"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@sveltejs/package": "^2.5.7",
package/src/index.ts CHANGED
@@ -1,7 +1,38 @@
1
+ import type { FlexibleSchema, InferSchema } from '@ai-sdk/provider-utils';
2
+ import {
3
+ StructuredObject,
4
+ type StructuredObjectOptions,
5
+ } from './structured-object.svelte.js';
6
+
1
7
  export { Chat, type CreateUIMessage, type UIMessage } from './chat.svelte.js';
2
8
  export { Completion, type CompletionOptions } from './completion.svelte.js';
3
9
  export { createAIContext } from './context-provider.js';
4
10
  export {
5
- StructuredObject as Experimental_StructuredObject,
6
- type Experimental_StructuredObjectOptions,
11
+ StructuredObject,
12
+ type StructuredObjectOptions,
7
13
  } from './structured-object.svelte.js';
14
+
15
+ // deprecated aliases
16
+ // note: declared here (instead of export aliases) so that the `@deprecated`
17
+ // tags are preserved in the bundled type declarations
18
+
19
+ /**
20
+ * @deprecated Use `StructuredObject` instead.
21
+ */
22
+ export const Experimental_StructuredObject = StructuredObject;
23
+ /**
24
+ * @deprecated Use `StructuredObject` instead.
25
+ */
26
+ export type Experimental_StructuredObject<
27
+ SCHEMA extends FlexibleSchema,
28
+ RESULT = InferSchema<SCHEMA>,
29
+ INPUT = unknown,
30
+ > = StructuredObject<SCHEMA, RESULT, INPUT>;
31
+
32
+ /**
33
+ * @deprecated Use `StructuredObjectOptions` instead.
34
+ */
35
+ export type Experimental_StructuredObjectOptions<
36
+ SCHEMA extends FlexibleSchema,
37
+ RESULT = InferSchema<SCHEMA>,
38
+ > = StructuredObjectOptions<SCHEMA, RESULT>;
@@ -18,7 +18,7 @@ import {
18
18
  KeyedStructuredObjectStore,
19
19
  type StructuredObjectStore,
20
20
  } from './structured-object-context.svelte.js';
21
- export type Experimental_StructuredObjectOptions<
21
+ export type StructuredObjectOptions<
22
22
  SCHEMA extends FlexibleSchema,
23
23
  RESULT = InferSchema<SCHEMA>,
24
24
  > = {
@@ -89,8 +89,8 @@ export class StructuredObject<
89
89
  RESULT = InferSchema<SCHEMA>,
90
90
  INPUT = unknown,
91
91
  > {
92
- #options: Experimental_StructuredObjectOptions<SCHEMA, RESULT> =
93
- {} as Experimental_StructuredObjectOptions<SCHEMA, RESULT>;
92
+ #options: StructuredObjectOptions<SCHEMA, RESULT> =
93
+ {} as StructuredObjectOptions<SCHEMA, RESULT>;
94
94
  readonly #id = $derived(this.#options.id ?? generateId());
95
95
  readonly #keyedStore = $state<KeyedStructuredObjectStore>()!;
96
96
  readonly #store = $derived(
@@ -120,7 +120,7 @@ export class StructuredObject<
120
120
  return this.#store.loading;
121
121
  }
122
122
 
123
- constructor(options: Experimental_StructuredObjectOptions<SCHEMA, RESULT>) {
123
+ constructor(options: StructuredObjectOptions<SCHEMA, RESULT>) {
124
124
  if (hasStructuredObjectContext()) {
125
125
  this.#keyedStore = getStructuredObjectContext();
126
126
  } else {