@nocobase/resourcer 2.2.0-beta.8 → 2.3.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { Toposort, ToposortOptions } from '@nocobase/utils';
10
+ import type * as Koa from 'koa';
10
11
  import Action, { ActionName } from './action';
11
12
  import Resource, { ResourceOptions } from './resource';
12
13
  import { ParsedParams } from './utils';
@@ -15,6 +16,8 @@ export interface ResourcerContext {
15
16
  action?: Action;
16
17
  [key: string]: any;
17
18
  }
19
+ export interface ResourcerActionContext extends ResourcerContext, Pick<Koa.Context, 'throw'> {
20
+ }
18
21
  export interface KoaMiddlewareOptions {
19
22
  skipIfDataSourceExists?: boolean;
20
23
  /**
@@ -117,7 +120,7 @@ export interface ExecuteOptions {
117
120
  */
118
121
  action: ActionName;
119
122
  }
120
- export type HandlerType = (ctx: ResourcerContext, next: () => Promise<any>) => any;
123
+ export type HandlerType = (ctx: ResourcerActionContext, next: () => Promise<any>) => any;
121
124
  export interface Handlers {
122
125
  [key: string]: HandlerType;
123
126
  }
package/package.json CHANGED
@@ -1,22 +1,26 @@
1
1
  {
2
2
  "name": "@nocobase/resourcer",
3
- "version": "2.2.0-beta.8",
3
+ "version": "2.3.0-alpha.1",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "dependencies": {
9
- "@nocobase/utils": "2.2.0-beta.8",
9
+ "@nocobase/utils": "2.3.0-alpha.1",
10
10
  "deepmerge": "^4.2.2",
11
+ "koa": "^3.2.0",
11
12
  "koa-compose": "^4.1.0",
12
13
  "lodash": "^4.17.21",
13
14
  "path-to-regexp": "^6.3.0",
14
15
  "qs": "^6.9.4"
15
16
  },
17
+ "devDependencies": {
18
+ "@types/koa": "^2.15.0"
19
+ },
16
20
  "repository": {
17
21
  "type": "git",
18
22
  "url": "git+https://github.com/nocobase/nocobase.git",
19
23
  "directory": "packages/resourcer"
20
24
  },
21
- "gitHead": "fa2502c1e9faf6d74b3f51b42dbc6546638d46af"
25
+ "gitHead": "2377df8ceb12549149017f7f14a61207bf6e49a2"
22
26
  }