deepspace 0.2.6 → 0.2.8
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/cli.js +206 -44
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +16 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5656,25 +5656,32 @@ declare function useQuery<T = unknown>(collection: string, options?: {
|
|
|
5656
5656
|
/**
|
|
5657
5657
|
* Get mutation functions for a collection.
|
|
5658
5658
|
*
|
|
5659
|
+
* Type contract:
|
|
5660
|
+
* - `create(data)` requires the **full** record shape `T`. New records
|
|
5661
|
+
* have no existing data to merge with, so all fields the schema
|
|
5662
|
+
* considers required must be present.
|
|
5663
|
+
* - `put(recordId, patch)` accepts a **`Partial<T>`**. The server
|
|
5664
|
+
* merges the patch into the existing row (`{...existing, ...patch}`),
|
|
5665
|
+
* so callers should send only the fields they want to change.
|
|
5666
|
+
*
|
|
5659
5667
|
* @example
|
|
5660
5668
|
* ```tsx
|
|
5661
|
-
* const { create, put, remove
|
|
5669
|
+
* const { create, put, remove } = useMutations<Task>('tasks')
|
|
5662
5670
|
*
|
|
5663
|
-
* //
|
|
5664
|
-
* const id = await create({ title: 'New task' })
|
|
5665
|
-
* await put(id, { title: 'Updated task' })
|
|
5666
|
-
* await remove(id)
|
|
5671
|
+
* // create needs the full Task shape
|
|
5672
|
+
* const id = await create({ title: 'New task', completed: false, priority: 1 })
|
|
5667
5673
|
*
|
|
5668
|
-
* //
|
|
5669
|
-
*
|
|
5674
|
+
* // put is a partial update — only the fields you want to change
|
|
5675
|
+
* await put(id, { completed: true })
|
|
5676
|
+
* await remove(id)
|
|
5670
5677
|
* ```
|
|
5671
5678
|
*/
|
|
5672
5679
|
declare function useMutations<T = unknown>(collection: string): {
|
|
5673
5680
|
create: (data: T) => Promise<string>;
|
|
5674
|
-
put: (recordId: string, data: T) => Promise<void>;
|
|
5681
|
+
put: (recordId: string, data: Partial<T>) => Promise<void>;
|
|
5675
5682
|
remove: (recordId: string) => Promise<void>;
|
|
5676
5683
|
createConfirmed: (data: T) => Promise<string>;
|
|
5677
|
-
putConfirmed: (recordId: string, data: T) => Promise<void>;
|
|
5684
|
+
putConfirmed: (recordId: string, data: Partial<T>) => Promise<void>;
|
|
5678
5685
|
removeConfirmed: (recordId: string) => Promise<void>;
|
|
5679
5686
|
};
|
|
5680
5687
|
|