mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
wip: Adding in properties and nested path
This commit is contained in:
12
sdk/lib/store/setupExposeStore.ts
Normal file
12
sdk/lib/store/setupExposeStore.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Affine, _ } from "../util"
|
||||
import { PathBuilder, extractJsonPath, pathBuilder } from "./PathBuilder"
|
||||
|
||||
export type ExposedStorePaths = string[] & Affine<"ExposedStorePaths">
|
||||
|
||||
export const setupExposeStore = <Store extends Record<string, any>>(
|
||||
fn: (pathBuilder: PathBuilder<Store>) => PathBuilder<Store, any>[],
|
||||
) => {
|
||||
return fn(pathBuilder<Store>()).map(
|
||||
(x) => extractJsonPath(x) as string,
|
||||
) as ExposedStorePaths
|
||||
}
|
||||
Reference in New Issue
Block a user