import { ExposedStorePaths } from "../../../base/lib/types" import { PathBuilder, extractJsonPath, pathBuilder, } from "../../../base/lib/util/PathBuilder" /** * @description Use this function to determine which Store values to expose and make available to other services running on StartOS. Store values not exposed here will be kept private. Use the type safe pathBuilder to traverse your Store's structure. * @example * In this example, we expose the hypothetical Store values "adminPassword" and "nameLastUpdatedAt". * * ``` export const exposedStore = setupExposeStore((pathBuilder) => [ pathBuilder.adminPassword pathBuilder.nameLastUpdatedAt, ]) * ``` */ export const setupExposeStore = >( fn: (pathBuilder: PathBuilder) => PathBuilder[], ) => { return fn(pathBuilder()).map( (x) => extractJsonPath(x) as string, ) as ExposedStorePaths } export { ExposedStorePaths }