diff --git a/lib/config/setupConfigExports.ts b/lib/config/setupConfigExports.ts
index a1c25f0..4dbce26 100644
--- a/lib/config/setupConfigExports.ts
+++ b/lib/config/setupConfigExports.ts
@@ -1,15 +1,19 @@
import { Config } from "./builder";
-import {
- DeepPartial,
- Dependencies,
- DependsOn,
- Effects,
- ExpectedExports,
-} from "../types";
+import { DeepPartial, Dependencies, DependsOn, Effects, ExpectedExports } from "../types";
import { InputSpec } from "./configTypes";
import { nullIfEmpty } from "../util";
import { TypeFromProps } from "../util/propertiesMatcher";
+export type Write = (options: { effects: Effects; input: TypeFromProps }) => Promise;
+export type Read = (options: {
+ effects: Effects;
+ config: ConfigType;
+}) => Promise>>;
+export type DependenciesFn = (options: {
+ effects: Effects;
+ input: TypeFromProps;
+ config: ConfigType;
+}) => Promise;
/**
* We want to setup a config export with a get and set, this
* is going to be the default helper to setup config, because it will help
@@ -19,20 +23,9 @@ import { TypeFromProps } from "../util/propertiesMatcher";
*/
export function setupConfigExports(options: {
spec: Config;
- write(options: {
- effects: Effects;
- input: TypeFromProps;
- }): Promise;
- read(options: {
- effects: Effects;
- config: ConfigType;
- }): Promise>>;
-
- dependencies(options: {
- effects: Effects;
- input: TypeFromProps;
- config: ConfigType;
- }): Promise;
+ write: Write;
+ read: Read;
+ dependencies: DependenciesFn;
}) {
const validator = options.spec.validator();
return {
@@ -45,17 +38,14 @@ export function setupConfigExports(options: {
input: JSON.parse(JSON.stringify(input)),
effects,
});
- const dependencies =
- (await options.dependencies({ effects, input, config })) || [];
+ const dependencies = (await options.dependencies({ effects, input, config })) || [];
await effects.setDependencies(dependencies);
await effects.setWrapperData({ path: "config", value: config || null });
}) as ExpectedExports.setConfig,
getConfig: (async ({ effects, config }) => {
return {
spec: options.spec.build(),
- config: nullIfEmpty(
- await options.read({ effects, config: config as ConfigType })
- ),
+ config: nullIfEmpty(await options.read({ effects, config: config as ConfigType })),
};
}) as ExpectedExports.getConfig,
};
diff --git a/package-lock.json b/package-lock.json
index e938c0e..128c242 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "start-sdk",
- "version": "0.4.0-lib0.charlie29",
+ "version": "0.4.0-lib0.charlie30",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "start-sdk",
- "version": "0.4.0-lib0.charlie29",
+ "version": "0.4.0-lib0.charlie30",
"license": "MIT",
"dependencies": {
"@iarna/toml": "^2.2.5",
diff --git a/package.json b/package.json
index d6d382d..525ef64 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "start-sdk",
- "version": "0.4.0-lib0.charlie29",
+ "version": "0.4.0-lib0.charlie30",
"description": "For making the patterns that are wanted in making services for the startOS.",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",