@seedprotocol/react 0.4.15
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/OPFSFilesManager.d.ts +45 -0
- package/dist/OPFSFilesManager.d.ts.map +1 -0
- package/dist/OPFSImage.d.ts +7 -0
- package/dist/OPFSImage.d.ts.map +1 -0
- package/dist/SeedClientGate.d.ts +28 -0
- package/dist/SeedClientGate.d.ts.map +1 -0
- package/dist/SeedImage.d.ts +13 -0
- package/dist/SeedImage.d.ts.map +1 -0
- package/dist/SeedProvider.d.ts +30 -0
- package/dist/SeedProvider.d.ts.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/db.d.ts +4 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1988 -0
- package/dist/index.js.map +1 -0
- package/dist/item.d.ts +42 -0
- package/dist/item.d.ts.map +1 -0
- package/dist/itemProperty.d.ts +116 -0
- package/dist/itemProperty.d.ts.map +1 -0
- package/dist/liveQuery.d.ts +29 -0
- package/dist/liveQuery.d.ts.map +1 -0
- package/dist/model.d.ts +48 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/modelProperty.d.ts +82 -0
- package/dist/modelProperty.d.ts.map +1 -0
- package/dist/queryClient.d.ts +28 -0
- package/dist/queryClient.d.ts.map +1 -0
- package/dist/schema.d.ts +45 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/services.d.ts +24 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/trash.d.ts +9 -0
- package/dist/trash.d.ts.map +1 -0
- package/dist/useFiles.d.ts +22 -0
- package/dist/useFiles.d.ts.map +1 -0
- package/dist/useImageFiles.d.ts +19 -0
- package/dist/useImageFiles.d.ts.map +1 -0
- package/dist/useOPFSFiles.d.ts +27 -0
- package/dist/useOPFSFiles.d.ts.map +1 -0
- package/package.json +63 -0
package/dist/item.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Item, ModelValues, IItem } from '@seedprotocol/sdk';
|
|
2
|
+
type UseItemReturn<T extends ModelValues<T>> = {
|
|
3
|
+
item: IItem<T> | undefined;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
};
|
|
7
|
+
type UseItemProps = {
|
|
8
|
+
modelName: string;
|
|
9
|
+
seedLocalId?: string;
|
|
10
|
+
seedUid?: string;
|
|
11
|
+
};
|
|
12
|
+
type UseItem = <T extends ModelValues<T>>(props: UseItemProps) => UseItemReturn<T>;
|
|
13
|
+
export declare const useItem: UseItem;
|
|
14
|
+
type UseItemsReturn = {
|
|
15
|
+
items: IItem<any>[];
|
|
16
|
+
isLoading: boolean;
|
|
17
|
+
error: Error | null;
|
|
18
|
+
};
|
|
19
|
+
type UseItemsProps = {
|
|
20
|
+
modelName?: string;
|
|
21
|
+
deleted?: boolean;
|
|
22
|
+
includeEas?: boolean;
|
|
23
|
+
addressFilter?: 'owned' | 'watched' | 'all';
|
|
24
|
+
};
|
|
25
|
+
type UseItems = (props: UseItemsProps) => UseItemsReturn;
|
|
26
|
+
export declare const useItems: UseItems;
|
|
27
|
+
export type UseCreateItemReturn = {
|
|
28
|
+
createItem: (modelName: string, itemData?: Record<string, any>) => Promise<Item<any> | undefined>;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
resetError: () => void;
|
|
32
|
+
};
|
|
33
|
+
export declare const useCreateItem: () => UseCreateItemReturn;
|
|
34
|
+
type UsePublishItemReturn = {
|
|
35
|
+
publishItem: (item: Item<any> | undefined) => void;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
error: Error | null;
|
|
38
|
+
resetError: () => void;
|
|
39
|
+
};
|
|
40
|
+
export declare const usePublishItem: () => UsePublishItemReturn;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|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A;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAA;IACjG,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,QAAO,mBAyChC,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,KAAK,IAAI,CAAA;IAClD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,oBAsDjC,CAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { IItemProperty } from '@seedprotocol/sdk';
|
|
2
|
+
type UseItemPropertyReturn = {
|
|
3
|
+
property: IItemProperty | undefined;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Hook to get a specific ItemProperty instance
|
|
9
|
+
* Can be called in multiple ways:
|
|
10
|
+
* 1. With seedLocalId/seedUid and propertyName: useItemProperty({ seedLocalId, propertyName }) or useItemProperty({ seedUid, propertyName })
|
|
11
|
+
* 2. With itemId and propertyName: useItemProperty(itemId, propertyName) or useItemProperty({ itemId, propertyName })
|
|
12
|
+
*
|
|
13
|
+
* @overload
|
|
14
|
+
* @param props - Object with seedLocalId or seedUid, and propertyName
|
|
15
|
+
* @returns Object with property, isLoading, and error
|
|
16
|
+
*
|
|
17
|
+
* @overload
|
|
18
|
+
* @param props - Object with itemId and propertyName
|
|
19
|
+
* @returns Object with property, isLoading, and error
|
|
20
|
+
*
|
|
21
|
+
* @overload
|
|
22
|
+
* @param itemId - The item ID (seedLocalId or seedUid)
|
|
23
|
+
* @param propertyName - The name of the property
|
|
24
|
+
* @returns Object with property, isLoading, and error
|
|
25
|
+
*/
|
|
26
|
+
export declare function useItemProperty(props: {
|
|
27
|
+
seedLocalId?: string;
|
|
28
|
+
seedUid?: string;
|
|
29
|
+
propertyName: string;
|
|
30
|
+
}): UseItemPropertyReturn;
|
|
31
|
+
export declare function useItemProperty(props: {
|
|
32
|
+
itemId?: string;
|
|
33
|
+
propertyName: string;
|
|
34
|
+
}): UseItemPropertyReturn;
|
|
35
|
+
export declare function useItemProperty(itemId: string, propertyName: string): UseItemPropertyReturn;
|
|
36
|
+
type UseDebouncedItemPropertyParams = {
|
|
37
|
+
seedLocalId?: string;
|
|
38
|
+
seedUid?: string;
|
|
39
|
+
propertyName: string;
|
|
40
|
+
} | {
|
|
41
|
+
itemId: string;
|
|
42
|
+
propertyName: string;
|
|
43
|
+
};
|
|
44
|
+
type UseDebouncedItemPropertyReturn = {
|
|
45
|
+
property: IItemProperty | undefined;
|
|
46
|
+
setValue: (value: string) => void;
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
error: Error | null;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Hook for real-time ItemProperty updates with debounced persistence.
|
|
52
|
+
* Updates the display immediately on each change while debouncing writes to the database.
|
|
53
|
+
* Use this for text inputs and other high-frequency updates.
|
|
54
|
+
*
|
|
55
|
+
* @param params - Same as useItemProperty: { seedLocalId, propertyName }, { seedUid, propertyName }, or { itemId, propertyName }
|
|
56
|
+
* @param debounceMs - Debounce delay for persistence (default: 300)
|
|
57
|
+
*/
|
|
58
|
+
export declare function useDebouncedItemProperty(params: UseDebouncedItemPropertyParams, debounceMs?: number): UseDebouncedItemPropertyReturn;
|
|
59
|
+
type UseItemPropertiesReturn = {
|
|
60
|
+
properties: IItemProperty[];
|
|
61
|
+
isLoading: boolean;
|
|
62
|
+
error: Error | null;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Hook to get all ItemProperty instances for a specific item
|
|
66
|
+
* Can be called in multiple ways:
|
|
67
|
+
* 1. With seedLocalId: useItemProperties({ seedLocalId })
|
|
68
|
+
* 2. With seedUid: useItemProperties({ seedUid })
|
|
69
|
+
* 3. With itemId: useItemProperties(itemId)
|
|
70
|
+
*
|
|
71
|
+
* Uses useLiveQuery to watch for changes in the metadata table and automatically
|
|
72
|
+
* updates the returned ItemProperty instances when changes occur.
|
|
73
|
+
*
|
|
74
|
+
* @overload
|
|
75
|
+
* @param props - Object with seedLocalId or seedUid
|
|
76
|
+
* @returns Object with properties array, isLoading, and error
|
|
77
|
+
*
|
|
78
|
+
* @overload
|
|
79
|
+
* @param itemId - The item ID (seedLocalId or seedUid)
|
|
80
|
+
* @returns Object with properties array, isLoading, and error
|
|
81
|
+
*/
|
|
82
|
+
export declare function useItemProperties(props: {
|
|
83
|
+
seedLocalId?: string;
|
|
84
|
+
seedUid?: string;
|
|
85
|
+
}): UseItemPropertiesReturn;
|
|
86
|
+
export declare function useItemProperties(itemId: string): UseItemPropertiesReturn;
|
|
87
|
+
export type UseCreateItemPropertyProps = {
|
|
88
|
+
seedLocalId?: string;
|
|
89
|
+
seedUid?: string;
|
|
90
|
+
propertyName: string;
|
|
91
|
+
modelName: string;
|
|
92
|
+
propertyValue?: any;
|
|
93
|
+
versionLocalId?: string;
|
|
94
|
+
versionUid?: string;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
};
|
|
97
|
+
export type UseCreateItemPropertyReturn = {
|
|
98
|
+
create: (props: UseCreateItemPropertyProps) => IItemProperty | undefined;
|
|
99
|
+
isLoading: boolean;
|
|
100
|
+
error: Error | null;
|
|
101
|
+
resetError: () => void;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Hook to create an ItemProperty with loading and error state.
|
|
105
|
+
* create(props) creates a new property instance for an item; provide seedLocalId or seedUid, propertyName, and modelName.
|
|
106
|
+
*/
|
|
107
|
+
export declare const useCreateItemProperty: () => UseCreateItemPropertyReturn;
|
|
108
|
+
export type UseDestroyItemPropertyReturn = {
|
|
109
|
+
destroy: (itemProperty: IItemProperty) => Promise<void>;
|
|
110
|
+
isLoading: boolean;
|
|
111
|
+
error: Error | null;
|
|
112
|
+
resetError: () => void;
|
|
113
|
+
};
|
|
114
|
+
export declare const useDestroyItemProperty: () => UseDestroyItemPropertyReturn;
|
|
115
|
+
export {};
|
|
116
|
+
//# sourceMappingURL=itemProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"itemProperty.d.ts","sourceRoot":"","sources":["../src/itemProperty.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAgBtD,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,aAAa,GAAG,SAAS,CAAA;IACnC,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,qBAAqB,CAAA;AACzB,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,qBAAqB,CAAA;AACzB,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,qBAAqB,CAAA;AAiMxB,KAAK,8BAA8B,GAC/B;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAA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,KAAK,aAAa,GAAG,SAAS,CAAA;IACxE,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,2BAsDxC,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,sBAAsB,QAAO,4BA8CzC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to execute a reactive query that emits new results whenever the underlying data changes.
|
|
3
|
+
*
|
|
4
|
+
* Supports two usage patterns:
|
|
5
|
+
* 1. SQL tag function: useLiveQuery((sql) => sql`SELECT * FROM models`)
|
|
6
|
+
* 2. Drizzle query builder: useLiveQuery(db.select().from(models))
|
|
7
|
+
*
|
|
8
|
+
* @param query - SQL query function or Drizzle query builder, or null/undefined to disable the query
|
|
9
|
+
* @returns Array of query results, or undefined if not yet loaded
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Using SQL tag function
|
|
14
|
+
* const models = useLiveQuery<ModelRow>(
|
|
15
|
+
* (sql) => sql`SELECT * FROM models WHERE schema_file_id = ${schemaId}`
|
|
16
|
+
* )
|
|
17
|
+
*
|
|
18
|
+
* // Using Drizzle query builder
|
|
19
|
+
* import { models } from '@seedprotocol/sdk'
|
|
20
|
+
* import { eq } from 'drizzle-orm'
|
|
21
|
+
*
|
|
22
|
+
* const appDb = BaseDb.getAppDb()
|
|
23
|
+
* const models = useLiveQuery<ModelRow>(
|
|
24
|
+
* appDb.select().from(models).where(eq(models.schemaFileId, schemaId))
|
|
25
|
+
* )
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function useLiveQuery<T>(query: ((sql: any) => any) | any | null | undefined): T[] | undefined;
|
|
29
|
+
//# sourceMappingURL=liveQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveQuery.d.ts","sourceRoot":"","sources":["../src/liveQuery.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAC5B,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,GAAG,SAAS,GAClD,CAAC,EAAE,GAAG,SAAS,CAoEjB"}
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Model } from '@seedprotocol/sdk';
|
|
2
|
+
type UseModelsResult = {
|
|
3
|
+
models: Model[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
};
|
|
7
|
+
type UseModelsParams = string | null | undefined;
|
|
8
|
+
type UseModels = (schemaId: UseModelsParams) => UseModelsResult;
|
|
9
|
+
export declare const useModels: UseModels;
|
|
10
|
+
type UseModelResult = {
|
|
11
|
+
model: Model | undefined;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
error: Error | null;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Hook to get a specific Model instance
|
|
17
|
+
* Can be called in two ways:
|
|
18
|
+
* 1. With schemaId and modelName: useModel(schemaId, modelName)
|
|
19
|
+
* 2. With modelId: useModel(modelId)
|
|
20
|
+
*
|
|
21
|
+
* @param schemaIdOrModelId - The schema ID (schema file ID) OR the model ID (modelFileId)
|
|
22
|
+
* @param modelName - The name of the model to retrieve (required if first param is schemaId)
|
|
23
|
+
* @returns Object with model, isLoading, and error
|
|
24
|
+
*/
|
|
25
|
+
export declare const useModel: (schemaIdOrModelId: string | null | undefined, modelName?: string | null | undefined) => UseModelResult;
|
|
26
|
+
export type UseCreateModelOptions = {
|
|
27
|
+
modelFileId?: string;
|
|
28
|
+
properties?: {
|
|
29
|
+
[propertyName: string]: any;
|
|
30
|
+
};
|
|
31
|
+
registerWithSchema?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type UseCreateModelReturn = {
|
|
34
|
+
create: (schemaName: string, modelName: string, options?: UseCreateModelOptions) => Model;
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
error: Error | null;
|
|
37
|
+
resetError: () => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const useCreateModel: () => UseCreateModelReturn;
|
|
40
|
+
export type UseDestroyModelReturn = {
|
|
41
|
+
destroy: (model: Model) => Promise<void>;
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
error: Error | null;
|
|
44
|
+
resetError: () => void;
|
|
45
|
+
};
|
|
46
|
+
export declare const useDestroyModel: () => UseDestroyModelReturn;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AASzC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED,KAAK,eAAe,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAEhD,KAAK,SAAS,GAAG,CAAC,QAAQ,EAAE,eAAe,KAAK,eAAe,CAAA;AAc/D,eAAO,MAAM,SAAS,EAAE,SAqJvB,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CACpB,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GACnB,mBAAmB,MAAM,GAAG,IAAI,GAAG,SAAS,EAC5C,YAAY,MAAM,GAAG,IAAI,GAAG,SAAS,KACpC,cAmIF,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE;QAAE,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAA;IAC5C,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,CACN,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,qBAAqB,KAC5B,KAAK,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,cAAc,QAAO,oBAiDjC,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,eAAe,QAAO,qBA4ClC,CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { ModelProperty } from '@seedprotocol/sdk';
|
|
2
|
+
type UseModelPropertiesResult = {
|
|
3
|
+
modelProperties: ModelProperty[];
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Hook to get all ModelProperty instances for a specific model
|
|
9
|
+
* Can be called in two ways:
|
|
10
|
+
* 1. With schemaId and modelName: useModelProperties(schemaId, modelName)
|
|
11
|
+
* 2. With modelId: useModelProperties(modelId)
|
|
12
|
+
*
|
|
13
|
+
* Uses useLiveQuery to watch for changes in the properties table and automatically
|
|
14
|
+
* updates the returned ModelProperty instances when changes occur.
|
|
15
|
+
*
|
|
16
|
+
* @param schemaIdOrModelId - The schema ID (schema file ID) OR the model ID (modelFileId)
|
|
17
|
+
* @param modelName - The name of the model to get properties from (required if first param is schemaId)
|
|
18
|
+
* @returns Object with modelProperties array, isLoading, and error
|
|
19
|
+
*/
|
|
20
|
+
export declare const useModelProperties: (schemaIdOrModelId: string | null | undefined, modelName?: string | null | undefined) => UseModelPropertiesResult;
|
|
21
|
+
/**
|
|
22
|
+
* Hook to get a specific ModelProperty instance
|
|
23
|
+
* Can be called in three ways:
|
|
24
|
+
* 1. With propertyFileId: useModelProperty(propertyFileId)
|
|
25
|
+
* 2. With modelFileId and propertyName: useModelProperty(modelFileId, propertyName)
|
|
26
|
+
* 3. With schemaId, modelName, and propertyName: useModelProperty(schemaId, modelName, propertyName)
|
|
27
|
+
*
|
|
28
|
+
* @overload
|
|
29
|
+
* @param propertyFileId - The property file ID (schemaFileId)
|
|
30
|
+
* @returns Object with modelProperty, isLoading, and error
|
|
31
|
+
*
|
|
32
|
+
* @overload
|
|
33
|
+
* @param modelFileId - The model file ID (modelFileId)
|
|
34
|
+
* @param propertyName - The name of the property
|
|
35
|
+
* @returns Object with modelProperty, isLoading, and error
|
|
36
|
+
*
|
|
37
|
+
* @overload
|
|
38
|
+
* @param schemaId - The schema ID (schema file ID)
|
|
39
|
+
* @param modelName - The name of the model
|
|
40
|
+
* @param propertyName - The name of the property
|
|
41
|
+
* @returns Object with modelProperty, isLoading, and error
|
|
42
|
+
*/
|
|
43
|
+
export declare function useModelProperty(propertyFileId: string): {
|
|
44
|
+
modelProperty: ModelProperty | undefined;
|
|
45
|
+
isLoading: boolean;
|
|
46
|
+
error: Error | null;
|
|
47
|
+
};
|
|
48
|
+
export declare function useModelProperty(modelFileId: string, propertyName: string): {
|
|
49
|
+
modelProperty: ModelProperty | undefined;
|
|
50
|
+
isLoading: boolean;
|
|
51
|
+
error: Error | null;
|
|
52
|
+
};
|
|
53
|
+
export declare function useModelProperty(schemaId: string, modelName: string, propertyName: string): {
|
|
54
|
+
modelProperty: ModelProperty | undefined;
|
|
55
|
+
isLoading: boolean;
|
|
56
|
+
error: Error | null;
|
|
57
|
+
};
|
|
58
|
+
export type UseCreateModelPropertyOptions = {
|
|
59
|
+
name: string;
|
|
60
|
+
dataType: string;
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
export type UseCreateModelPropertyReturn = {
|
|
64
|
+
create: (schemaId: string, modelName: string, property: UseCreateModelPropertyOptions) => ModelProperty;
|
|
65
|
+
isLoading: boolean;
|
|
66
|
+
error: Error | null;
|
|
67
|
+
resetError: () => void;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Hook to create a ModelProperty with loading and error state.
|
|
71
|
+
* create(schemaId, modelName, property) creates a new property on the model.
|
|
72
|
+
*/
|
|
73
|
+
export declare const useCreateModelProperty: () => UseCreateModelPropertyReturn;
|
|
74
|
+
export type UseDestroyModelPropertyReturn = {
|
|
75
|
+
destroy: (modelProperty: ModelProperty) => Promise<void>;
|
|
76
|
+
isLoading: boolean;
|
|
77
|
+
error: Error | null;
|
|
78
|
+
resetError: () => void;
|
|
79
|
+
};
|
|
80
|
+
export declare const useDestroyModelProperty: () => UseDestroyModelPropertyReturn;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=modelProperty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelProperty.d.ts","sourceRoot":"","sources":["../src/modelProperty.ts"],"names":[],"mappings":"AAIA,OAAO,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAcpE,KAAK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Aa,CAAA;IAClB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAO,4BA8DzC,CAAA;AAED,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxD,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,uBAAuB,QAAO,6BA4C1C,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { QueryClient, DefaultOptions, QueryClientConfig } from '@tanstack/react-query';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the default options used by Seed for list-query caching.
|
|
4
|
+
* Use this when building your own QueryClient so Seed hooks get consistent behavior.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getSeedQueryDefaultOptions(): DefaultOptions;
|
|
7
|
+
/**
|
|
8
|
+
* Merges Seed's default query options with your existing default options.
|
|
9
|
+
* Your options take precedence over Seed's. Use when constructing your own QueryClient:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const client = new QueryClient({
|
|
14
|
+
* defaultOptions: mergeSeedQueryDefaults({
|
|
15
|
+
* queries: { gcTime: 1000 * 60 * 60 },
|
|
16
|
+
* }),
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function mergeSeedQueryDefaults(userOptions?: Partial<DefaultOptions> | null): DefaultOptions;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a QueryClient configured with Seed's default options.
|
|
23
|
+
* Use this when you want to provide your own QueryClientProvider but still use Seed's defaults.
|
|
24
|
+
*
|
|
25
|
+
* @param overrides - Optional config to merge with Seed defaults (e.g. defaultOptions, logger).
|
|
26
|
+
*/
|
|
27
|
+
export declare function createSeedQueryClient(overrides?: Partial<QueryClientConfig>): QueryClient;
|
|
28
|
+
//# sourceMappingURL=queryClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryClient.d.ts","sourceRoot":"","sources":["../src/queryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EAEvB,MAAM,uBAAuB,CAAA;AAU9B;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,CAE3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,GAC3C,cAAc,CAahB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,WAAW,CASzF"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Schema } from '@seedprotocol/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to get a Schema class instance (with setters) that is reactive
|
|
4
|
+
* This allows you to edit schema properties directly like: schema.name = 'New name'
|
|
5
|
+
* The schema instance uses a Proxy to ensure React re-renders when properties change
|
|
6
|
+
* @param schemaIdentifier - The name of the schema or the schema file ID
|
|
7
|
+
* - If a name is provided, retrieves the latest version with that name
|
|
8
|
+
* - If an ID is provided, retrieves the specific schema by ID
|
|
9
|
+
* @returns Object with schema instance
|
|
10
|
+
*/
|
|
11
|
+
export declare const useSchema: (schemaIdentifier: string | null | undefined) => {
|
|
12
|
+
schema: Schema | null;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
error: Error | null;
|
|
15
|
+
};
|
|
16
|
+
export declare const useSchemas: () => {
|
|
17
|
+
schemas: Schema[];
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
error: Error | null;
|
|
20
|
+
};
|
|
21
|
+
export declare const useCreateSchema: () => {
|
|
22
|
+
createSchema: (schemaName: string) => Schema;
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
resetError: () => void;
|
|
26
|
+
};
|
|
27
|
+
export type UseDestroySchemaReturn = {
|
|
28
|
+
destroy: (schema: Schema) => Promise<void>;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
resetError: () => void;
|
|
32
|
+
};
|
|
33
|
+
export declare const useDestroySchema: () => UseDestroySchemaReturn;
|
|
34
|
+
export declare const useAllSchemaVersions: () => Schema[] | null | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Hook to get the internal Seed Protocol schema (SDK-only schema)
|
|
37
|
+
* This schema is managed by the SDK and should not be edited by app developers
|
|
38
|
+
* @returns Object with schema instance and schemaData (version, metadata, etc.)
|
|
39
|
+
*/
|
|
40
|
+
export declare const useSeedProtocolSchema: () => {
|
|
41
|
+
schema: Schema | null;
|
|
42
|
+
isLoading: boolean;
|
|
43
|
+
error: Error | null;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAW1C;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,kBAAkB,MAAM,GAAG,IAAI,GAAG,SAAS;;;;CAsFpE,CAAA;AAID,eAAO,MAAM,UAAU;;;WAmGE,KAAK,GAAG,IAAI;CAEpC,CAAA;AAED,eAAO,MAAM,eAAe;+BAOoB,MAAM;;;;CAoCrD,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAO,sBA4CnC,CAAA;AAED,eAAO,MAAM,oBAAoB,mCA2EhC,CAAA;AAKD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;CAEjC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ActorRef } from 'xstate';
|
|
2
|
+
import { ClientManagerState } from '@seedprotocol/sdk';
|
|
3
|
+
export declare const getServiceName: (service: ActorRef<any, any>) => string;
|
|
4
|
+
export declare const getServiceValue: (service: ActorRef<any, any>) => string | undefined;
|
|
5
|
+
export declare const getServiceUniqueKey: (service: ActorRef<any, any>) => any;
|
|
6
|
+
export declare const useService: (service: ActorRef<any, any>) => {
|
|
7
|
+
name: string;
|
|
8
|
+
timeElapsed: number;
|
|
9
|
+
value: string | undefined;
|
|
10
|
+
percentComplete: number;
|
|
11
|
+
uniqueKey: any;
|
|
12
|
+
};
|
|
13
|
+
export declare const useIsDbReady: () => boolean;
|
|
14
|
+
export declare const usePersistedSnapshots: () => void;
|
|
15
|
+
export declare const useHasSavedSnapshots: () => boolean;
|
|
16
|
+
export declare const useServices: () => {
|
|
17
|
+
services: ActorRef<any, any, import('xstate').EventObject>[];
|
|
18
|
+
percentComplete: number;
|
|
19
|
+
};
|
|
20
|
+
export declare const useGlobalServiceStatus: () => {
|
|
21
|
+
status: ClientManagerState;
|
|
22
|
+
internalStatus: string;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=services.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAuB,MAAM,QAAQ,CAAA;AAStD,OAAO,EAAsB,kBAAkB,EAAa,MAAM,mBAAmB,CAAA;AAMrF,eAAO,MAAM,cAAc,GAAI,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,WAUzD,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,KAC1B,MAAM,GAAG,SAmBX,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,QAiC9D,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,SAAS,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC;;;;;;CAoErD,CAAA;AAED,eAAO,MAAM,YAAY,eAmBxB,CAAA;AAED,eAAO,MAAM,qBAAqB,YAqDjC,CAAA;AAED,eAAO,MAAM,oBAAoB,eAyBhC,CAAA;AAED,eAAO,MAAM,WAAW;;;CAiDvB,CAAA;AAED,eAAO,MAAM,sBAAsB;;;CA2BlC,CAAA"}
|
package/dist/trash.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Item } from '@seedprotocol/sdk';
|
|
2
|
+
export type UseDeleteItemReturn = {
|
|
3
|
+
deleteItem: (item: Item<any>) => Promise<void>;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
error: Error | null;
|
|
6
|
+
resetError: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useDeleteItem: () => UseDeleteItemReturn;
|
|
9
|
+
//# sourceMappingURL=trash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trash.d.ts","sourceRoot":"","sources":["../src/trash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9C,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,QAAO,mBA4ChC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const FILES_QUERY_KEY_PREFIX: readonly ["seed", "files"];
|
|
2
|
+
/**
|
|
3
|
+
* Returns an up-to-date list of filenames stored in the given directory.
|
|
4
|
+
* Automatically refetches when files are saved (file-saved) or after bulk downloads (fs.downloadAll.success).
|
|
5
|
+
*
|
|
6
|
+
* Must be used within SeedProvider and after client.init().
|
|
7
|
+
*
|
|
8
|
+
* @param dir - Directory name under the files root (e.g. 'files', 'images'). Default: 'files'.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* const { files, isLoading, error, refetch } = useFiles('files')
|
|
13
|
+
* // files: ['document.pdf', 'contract.docx']
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function useFiles(dir?: string): {
|
|
17
|
+
files: string[];
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
error: Error | null;
|
|
20
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<string[], Error>>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFiles.d.ts","sourceRoot":"","sources":["../src/useFiles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,4BAA6B,CAAA;AAEhE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,GAAG,GAAE,MAAgB;;;;;EAwC7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns an up-to-date list of image filenames stored in the file system (OPFS in browser).
|
|
3
|
+
* Automatically refetches when images are saved (file-saved) or after bulk downloads (fs.downloadAll.success).
|
|
4
|
+
*
|
|
5
|
+
* Must be used within SeedProvider and after client.init().
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* const { imageFiles, isLoading, error, refetch } = useImageFiles()
|
|
10
|
+
* // imageFiles: ['photo.jpg', 'cover.png']
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function useImageFiles(): {
|
|
14
|
+
imageFiles: string[];
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<string[], Error>>;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useImageFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImageFiles.d.ts","sourceRoot":"","sources":["../src/useImageFiles.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa;;;;;EAsC5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface OPFSFile {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
size: number;
|
|
5
|
+
type: string;
|
|
6
|
+
lastModified: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UseOPFSFilesOptions {
|
|
9
|
+
/** Optional subdirectory to scan (e.g. 'app-files'). Default: root. */
|
|
10
|
+
rootPath?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook to scan and list all files in OPFS (Origin Private File System).
|
|
14
|
+
* Uses navigator.storage.getDirectory() - works in browsers that support OPFS.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { files, isLoading, error, refetch } = useOPFSFiles()
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useOPFSFiles(options?: UseOPFSFilesOptions): {
|
|
22
|
+
files: OPFSFile[];
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
error: string | null;
|
|
25
|
+
refetch: () => Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useOPFSFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOPFSFiles.d.ts","sourceRoot":"","sources":["../src/useOPFSFiles.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,CAAA;CACrB;AAqCD,MAAM,WAAW,mBAAmB;IAClC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB;;;;;EAsC7D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seedprotocol/react",
|
|
3
|
+
"version": "0.4.15",
|
|
4
|
+
"description": "React hooks and components for Seed Protocol",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"require": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "rimraf dist && vite build",
|
|
27
|
+
"test": "cd ../.. && vitest run --reporter=default --config vite.config.js --project=browser-react",
|
|
28
|
+
"test:watch": "cd ../.. && vitest --config vite.config.js --project=browser-react",
|
|
29
|
+
"test:browser": "cd ../.. && vitest --config vite.config.js --project=browser"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@seedprotocol/sdk": "^0.4.0",
|
|
33
|
+
"react": "^18 || ^19",
|
|
34
|
+
"@tanstack/react-query": "^5"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@xstate/react": "^6.1.0",
|
|
38
|
+
"debug": "^4.4.1",
|
|
39
|
+
"drizzle-orm": "^0.44.3",
|
|
40
|
+
"immer": "^11.0.1",
|
|
41
|
+
"lodash-es": "^4.17.22",
|
|
42
|
+
"pluralize": "^8.0.0",
|
|
43
|
+
"rxjs": "^7.8.1",
|
|
44
|
+
"xstate": "^5.28.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@seedprotocol/sdk": "workspace:*",
|
|
48
|
+
"vite-plugin-dts": "^4.5.4",
|
|
49
|
+
"@tanstack/react-query": "^5.90.15",
|
|
50
|
+
"@testing-library/react": "^16.3.1",
|
|
51
|
+
"@types/react": "^19.0.2",
|
|
52
|
+
"react": "^19.0.0",
|
|
53
|
+
"react-dom": "^19.0.0",
|
|
54
|
+
"rimraf": "^6.0.1",
|
|
55
|
+
"typescript": "~5.9.3",
|
|
56
|
+
"vite": "^7.3.0"
|
|
57
|
+
},
|
|
58
|
+
"author": "Keith Axline <keith@journodao.xyz>",
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
}
|
|
63
|
+
}
|