chore: Change the expected export

This commit is contained in:
BluJ
2023-05-10 16:52:44 -06:00
parent 9521865c59
commit a76344d95f
3 changed files with 13 additions and 8 deletions

View File

@@ -1,4 +1,8 @@
import { AutoConfigure, DeepPartial, Effects, ExpectedExports } from "../types" import {
DependencyConfig as DependencyConfigType,
DeepPartial,
Effects,
} from "../types"
import { Utils, utils } from "../util/utils" import { Utils, utils } from "../util/utils"
import { deepEqual } from "../util/deepEqual" import { deepEqual } from "../util/deepEqual"
import { deepMerge } from "../util/deepMerge" import { deepMerge } from "../util/deepMerge"
@@ -19,8 +23,8 @@ export class DependencyConfig<
) {} ) {}
async check( async check(
options: Parameters<AutoConfigure["check"]>[0], options: Parameters<DependencyConfigType["check"]>[0],
): ReturnType<AutoConfigure["check"]> { ): ReturnType<DependencyConfigType["check"]> {
const origConfig = JSON.parse(JSON.stringify(options.localConfig)) const origConfig = JSON.parse(JSON.stringify(options.localConfig))
const newOptions = { const newOptions = {
...options, ...options,
@@ -41,8 +45,8 @@ export class DependencyConfig<
throw new Error(`Check failed`) throw new Error(`Check failed`)
} }
async autoConfigure( async autoConfigure(
options: Parameters<AutoConfigure["autoConfigure"]>[0], options: Parameters<DependencyConfigType["autoConfigure"]>[0],
): ReturnType<AutoConfigure["autoConfigure"]> { ): ReturnType<DependencyConfigType["autoConfigure"]> {
const newOptions = { const newOptions = {
...options, ...options,
utils: utils<Store, Vault>(options.effects), utils: utils<Store, Vault>(options.effects),

View File

@@ -1,5 +1,6 @@
import { Config } from "../config/builder/config" import { Config } from "../config/builder/config"
import { SDKManifest } from "../manifest/ManifestTypes" import { SDKManifest } from "../manifest/ManifestTypes"
import { ExpectedExports } from "../types"
import { DependencyConfig } from "./DependencyConfig" import { DependencyConfig } from "./DependencyConfig"
export function setupDependencyConfig< export function setupDependencyConfig<
@@ -17,6 +18,6 @@ export function setupDependencyConfig<
any any
> >
}, },
) { ): ExpectedExports.dependencyConfig {
return autoConfigs return autoConfigs
} }

View File

@@ -85,7 +85,7 @@ export namespace ExpectedExports {
/** Auto configure is used to make sure that other dependencies have the values t /** Auto configure is used to make sure that other dependencies have the values t
* that this service could use. * that this service could use.
*/ */
export type autoConfig = Record<PackageId, AutoConfigure> export type dependencyConfig = Record<PackageId, DependencyConfig>
} }
export type TimeMs = number export type TimeMs = number
export type VersionString = string export type VersionString = string
@@ -94,7 +94,7 @@ export type VersionString = string
* AutoConfigure is used as the value to the key of package id, * AutoConfigure is used as the value to the key of package id,
* this is used to make sure that other dependencies have the values that this service could use. * this is used to make sure that other dependencies have the values that this service could use.
*/ */
export type AutoConfigure = { export type DependencyConfig = {
/** Checks are called to make sure that our dependency is in the correct shape. If a known error is returned we know that the dependency needs modification */ /** Checks are called to make sure that our dependency is in the correct shape. If a known error is returned we know that the dependency needs modification */
check(options: { check(options: {
effects: Effects effects: Effects