mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 04:11:57 +00:00
feat: New actions
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
import { Effects, ExpectedExports, ExportedAction } from "../types"
|
||||
import { ActionMetaData } from "../types"
|
||||
import { once } from "../util/once"
|
||||
import { CreatedAction } from "./createAction"
|
||||
|
||||
export function setupActions(...createdActions: CreatedAction<any, any>[]) {
|
||||
const myActions = once(() => {
|
||||
const actions: Record<string, CreatedAction<any, any>> = {}
|
||||
for (const action of createdActions) {
|
||||
actions[action.myMetaData.id] = action
|
||||
}
|
||||
return actions
|
||||
})
|
||||
return {
|
||||
get actions() {
|
||||
const actions: Record<string, ExportedAction> = {}
|
||||
for (const action of createdActions) {
|
||||
actions[action.myMetaData.id] = action.exportedAction
|
||||
}
|
||||
return actions
|
||||
return myActions()
|
||||
},
|
||||
get actionsMetadata() {
|
||||
return createdActions.map((x) => x.myMetaData)
|
||||
|
||||
Reference in New Issue
Block a user