tachybase_todo/packages/core/actions/src/index.ts
lyf-coder 92fda15efd feat(core/cache): support cache (#876)
* feat(core/cache): support cache

* build(create-nocobase-app): remove --cache-store-package cli option

* perf(core/cache): modify default cache config and remove unnecessary logic code

(cherry picked from commit 6e6086de7a908f38fe516e5340cb2154229c3843)

# Conflicts:
#	packages/core/server/src/application.ts
#	packages/core/server/src/helper.ts
2022-10-13 12:24:10 +08:00

29 lines
655 B
TypeScript

import Koa from 'koa';
import { Database } from '@nocobase/database';
import { Action } from '@nocobase/resourcer';
import { Cache } from '@nocobase/cache';
import lodash from 'lodash';
import * as actions from './actions';
export * as utils from './utils';
export type Next = () => Promise<any>;
export interface Context extends Koa.Context {
db: Database;
cache: Cache;
action: Action;
body: any;
app: any;
[key: string]: any;
}
export function registerActions(api: any) {
api.actions(
lodash.pick(actions, ['add', 'create', 'destroy', 'get', 'list', 'remove', 'set', 'toggle', 'update', 'move']),
);
}
export default actions;