mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-04-02 05:23:21 +00:00
chore: Make some things lazy
This commit is contained in:
@@ -3,14 +3,16 @@ import { ActionMetaData } from "../types"
|
||||
import { CreatedAction } from "./createAction"
|
||||
|
||||
export function setupActions(...createdActions: CreatedAction<any, any>[]) {
|
||||
const actions: Record<string, ExportedAction> = {}
|
||||
for (const action of createdActions) {
|
||||
actions[action.metaData.id] = action.exportedAction
|
||||
}
|
||||
|
||||
const actionsMetadata = createdActions.map((x) => x.metaData)
|
||||
return {
|
||||
actions,
|
||||
actionsMetadata,
|
||||
get actions() {
|
||||
const actions: Record<string, ExportedAction> = {}
|
||||
for (const action of createdActions) {
|
||||
actions[action.metaData.id] = action.exportedAction
|
||||
}
|
||||
return actions
|
||||
},
|
||||
get actionsMetadata() {
|
||||
return createdActions.map((x) => x.metaData)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user