mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 04:11:57 +00:00
feat: Remove the vault
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user