@builder.io/ai-utils 0.11.35 → 0.12.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/ai-utils",
3
- "version": "0.11.35",
3
+ "version": "0.12.0",
4
4
  "description": "Builder.io AI utils",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1,4 +1,38 @@
1
- export type StoreComponentDocsInput = StoreComponentDocsInputV1 | StoreComponentDocsInputV2;
1
+ export type StoreComponentDocsInput = StoreComponentDocsInputV1 | StoreComponentDocsInputV2 | IndexDocumentV1;
2
+ export type IndexDocumentV1 = ComponentDocument | TokenDocument | IconDocument | AgentDocument;
3
+ export interface ComponentDocument extends DocumentBase {
4
+ type: "component";
5
+ relatedComponents: string[];
6
+ relevantFiles: string[];
7
+ hash: string;
8
+ }
9
+ export interface TokenDocument extends DocumentBase {
10
+ type: "token";
11
+ hash: string;
12
+ relevantFiles: string[];
13
+ }
14
+ export interface IconDocument extends DocumentBase {
15
+ type: "icon";
16
+ hash: string;
17
+ }
18
+ export interface AgentDocument extends DocumentBase {
19
+ type: "agent";
20
+ }
21
+ export interface DocumentBase {
22
+ id?: string;
23
+ name: string;
24
+ description: string;
25
+ content: string;
26
+ designSystemId: string;
27
+ designSystemPackage?: string;
28
+ designSystemVersion?: string;
29
+ tokens?: number;
30
+ sessionId?: string;
31
+ }
32
+ export declare const isAgentDocument: (doc: IndexDocumentV1) => doc is AgentDocument;
33
+ export declare const isIconDocument: (doc: IndexDocumentV1) => doc is IconDocument;
34
+ export declare const isTokenDocument: (doc: IndexDocumentV1) => doc is TokenDocument;
35
+ export declare const isComponentDocument: (doc: IndexDocumentV1) => doc is ComponentDocument;
2
36
  /**
3
37
  * @deprecated
4
38
  * While some documents may still use this format, new documents should use the
@@ -21,6 +55,9 @@ interface StoreComponentDocsInputV1 {
21
55
  hash?: string;
22
56
  designSystemId?: string;
23
57
  }
58
+ /**
59
+ * @deprecated
60
+ */
24
61
  interface StoreComponentDocsInputV2 {
25
62
  id?: string;
26
63
  ownerId?: string;
@@ -1 +1,12 @@
1
- export {};
1
+ export const isAgentDocument = (doc) => {
2
+ return doc.type === "agent";
3
+ };
4
+ export const isIconDocument = (doc) => {
5
+ return doc.type === "icon";
6
+ };
7
+ export const isTokenDocument = (doc) => {
8
+ return doc.type === "token";
9
+ };
10
+ export const isComponentDocument = (doc) => {
11
+ return doc.type === "component";
12
+ };