chore: update the name of metadata

This commit is contained in:
BluJ
2023-05-09 16:54:42 -06:00
parent cc057ea222
commit 5536dfb55f
5 changed files with 15 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ import {
import { Variants } from "./config/builder/variants" import { Variants } from "./config/builder/variants"
import { CreatedAction, createAction } from "./actions/createAction" import { CreatedAction, createAction } from "./actions/createAction"
import { import {
ActionMetaData, ActionMetadata,
Effects, Effects,
ActionResult, ActionResult,
Metadata, Metadata,
@@ -106,7 +106,7 @@ export class StartSdk<Manifest extends SDKManifest, Store, Vault> {
| Config<any, never, never>, | Config<any, never, never>,
Type extends Record<string, any> = ExtractConfigType<ConfigType>, Type extends Record<string, any> = ExtractConfigType<ConfigType>,
>( >(
metaData: Omit<ActionMetaData, "input"> & { metaData: Omit<ActionMetadata, "input"> & {
input: Config<Type, Store, Vault> | Config<Type, never, never> input: Config<Type, Store, Vault> | Config<Type, never, never>
}, },
fn: (options: { fn: (options: {

View File

@@ -1,5 +1,5 @@
import { Config, ExtractConfigType } from "../config/builder/config" import { Config, ExtractConfigType } from "../config/builder/config"
import { ActionMetaData, ActionResult, Effects, ExportedAction } from "../types" import { ActionMetadata, ActionResult, Effects, ExportedAction } from "../types"
import { createUtils } from "../util" import { createUtils } from "../util"
import { Utils, utils } from "../util/utils" import { Utils, utils } from "../util/utils"
@@ -13,7 +13,7 @@ export class CreatedAction<
Type extends Record<string, any> = ExtractConfigType<ConfigType>, Type extends Record<string, any> = ExtractConfigType<ConfigType>,
> { > {
private constructor( private constructor(
public readonly myMetaData: Omit<ActionMetaData, "input">, public readonly myMetaData: Omit<ActionMetadata, "input">,
readonly fn: (options: { readonly fn: (options: {
effects: Effects effects: Effects
utils: Utils<Store, Vault> utils: Utils<Store, Vault>
@@ -32,7 +32,7 @@ export class CreatedAction<
| Config<any, never, never>, | Config<any, never, never>,
Type extends Record<string, any> = ExtractConfigType<ConfigType>, Type extends Record<string, any> = ExtractConfigType<ConfigType>,
>( >(
metaData: Omit<ActionMetaData, "input"> & { metaData: Omit<ActionMetadata, "input"> & {
input: Config<Type, Store, Vault> | Config<Type, never, never> input: Config<Type, Store, Vault> | Config<Type, never, never>
}, },
fn: (options: { fn: (options: {
@@ -65,10 +65,10 @@ export class CreatedAction<
}) })
} }
async actionMetaData(options: { async ActionMetadata(options: {
effects: Effects effects: Effects
utils: Utils<Store, Vault> utils: Utils<Store, Vault>
}): Promise<ActionMetaData> { }): Promise<ActionMetadata> {
return { return {
...this.myMetaData, ...this.myMetaData,
input: await this.input.build(options), input: await this.input.build(options),

View File

@@ -17,14 +17,14 @@ export function setupActions<Store, Vault>(
get actions() { get actions() {
return myActions() return myActions()
}, },
async actionsMetaData({ effects }: { effects: Effects }) { async actionsMetadata({ effects }: { effects: Effects }) {
const utils = createUtils<Store, Vault>(effects) const utils = createUtils<Store, Vault>(effects)
return Promise.all( return Promise.all(
createdActions.map((x) => x.actionMetaData({ effects, utils })), createdActions.map((x) => x.ActionMetadata({ effects, utils })),
) )
}, },
} satisfies { } satisfies {
actions: ExpectedExports.actions actions: ExpectedExports.actions
actionsMetaData: ExpectedExports.actionsMetaData actionsMetadata: ExpectedExports.actionsMetadata
} }
} }

View File

@@ -1,5 +1,5 @@
import { ValidEmVer } from "../emverLite/mod" import { ValidEmVer } from "../emverLite/mod"
import { ActionMetaData } from "../types" import { ActionMetadata } from "../types"
export interface Container { export interface Container {
/** This should be pointing to a docker container name */ /** This should be pointing to a docker container name */

View File

@@ -45,9 +45,9 @@ export namespace ExpectedExports {
} }
} }
export type actionsMetaData = (options: { export type actionsMetadata = (options: {
effects: Effects effects: Effects
}) => Promise<Array<ActionMetaData>> }) => Promise<Array<ActionMetadata>>
/** /**
* This is the entrypoint for the main container. Used to start up something like the service that the * This is the entrypoint for the main container. Used to start up something like the service that the
@@ -154,7 +154,7 @@ export type DaemonReturned = {
term(): Promise<void> term(): Promise<void>
} }
export type ActionMetaData = { export type ActionMetadata = {
name: string name: string
description: string description: string
id: string id: string
@@ -320,7 +320,7 @@ export type Effects = {
* *
* @param options * @param options
*/ */
exportAction(options: ActionMetaData): Promise<void> exportAction(options: ActionMetadata): Promise<void>
/** /**
* Remove an action that was exported. Used problably during main or during setConfig. * Remove an action that was exported. Used problably during main or during setConfig.
*/ */