feat: Remove the vault

This commit is contained in:
Blu-J
2023-05-30 17:36:30 -06:00
parent 613bf74180
commit 3f5dbc6a4b
24 changed files with 308 additions and 515 deletions

View File

@@ -5,47 +5,45 @@ import { Utils, utils } from "../util/utils"
export class CreatedAction<
Store,
Vault,
ConfigType extends
| Record<string, any>
| Config<any, Store, Vault>
| Config<any, never, never>,
| Config<any, Store>
| Config<any, never>,
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
> {
private constructor(
public readonly myMetaData: Omit<ActionMetadata, "input">,
readonly fn: (options: {
effects: Effects
utils: Utils<Store, Vault>
utils: Utils<Store>
input: Type
}) => Promise<ActionResult>,
readonly input: Config<Type, Store, Vault>,
readonly input: Config<Type, Store>,
) {}
public validator = this.input.validator
static of<
Store,
Vault,
ConfigType extends
| Record<string, any>
| Config<any, any, any>
| Config<any, never, never>,
| Config<any, any>
| Config<any, never>,
Type extends Record<string, any> = ExtractConfigType<ConfigType>,
>(
metaData: Omit<ActionMetadata, "input"> & {
input: Config<Type, Store, Vault> | Config<Type, never, never>
input: Config<Type, Store> | Config<Type, never>
},
fn: (options: {
effects: Effects
utils: Utils<Store, Vault>
utils: Utils<Store>
input: Type
}) => Promise<ActionResult>,
) {
const { input, ...rest } = metaData
return new CreatedAction<Store, Vault, ConfigType, Type>(
return new CreatedAction<Store, ConfigType, Type>(
rest,
fn,
input as Config<Type, Store, Vault>,
input as Config<Type, Store>,
)
}
@@ -67,7 +65,7 @@ export class CreatedAction<
async ActionMetadata(options: {
effects: Effects
utils: Utils<Store, Vault>
utils: Utils<Store>
}): Promise<ActionMetadata> {
return {
...this.myMetaData,