@gravity-ui/gateway 3.2.0 → 4.1.0
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.
- package/README.md +4 -4
- package/build/index.d.ts +1 -1
- package/build/index.js +2 -1
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install --save-dev @gravity-ui/gateway
|
|
|
13
13
|
First of all, you need to create a controller where you will import Gateway and Schema, and then return the initialized gateway controller:
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
|
-
import getGatewayControllers from '@gravity-ui/gateway';
|
|
16
|
+
import {getGatewayControllers} from '@gravity-ui/gateway';
|
|
17
17
|
import Schema from '<schemas package>';
|
|
18
18
|
|
|
19
19
|
const config = {
|
|
@@ -134,7 +134,7 @@ If the parameter value does not pass validation, the `GATEWAY_INVALID_PARAM_VALU
|
|
|
134
134
|
Upon gateway initialization, in addition to exporting the controller, it also exports an `api` object, which represents the core for executing requests to the backend.
|
|
135
135
|
|
|
136
136
|
```javascript
|
|
137
|
-
import getGatewayControllers from '@gravity-ui/gateway';
|
|
137
|
+
import {getGatewayControllers} from '@gravity-ui/gateway';
|
|
138
138
|
import Schema from '<schemas package>';
|
|
139
139
|
|
|
140
140
|
const config = {
|
|
@@ -180,7 +180,7 @@ const schemasByScopes = {scope1: schema1, scope2: schema2};
|
|
|
180
180
|
Example with two scope namespaces: `root` and `anotherScope`.
|
|
181
181
|
|
|
182
182
|
```javascript
|
|
183
|
-
import getGatewayControllers from '@gravity-ui/gateway';
|
|
183
|
+
import {getGatewayControllers} from '@gravity-ui/gateway';
|
|
184
184
|
|
|
185
185
|
const {
|
|
186
186
|
controller, // Controller
|
|
@@ -215,7 +215,7 @@ If the scope parameter is not specified, the default scope is assumed to be `roo
|
|
|
215
215
|
When initializing the `gateway`, there is an option to explicitly specify the actions that need to be connected from the schemas. To do this, provide a list of available client-side actions in the `actions` field in the config. If `actions` are not provided, all actions from the schemas are connected by default.
|
|
216
216
|
|
|
217
217
|
```typescript
|
|
218
|
-
import getGatewayControllers from '@gravity-ui/gateway';
|
|
218
|
+
import {getGatewayControllers} from '@gravity-ui/gateway';
|
|
219
219
|
import rootSchema from '<schemas package>';
|
|
220
220
|
import localSchema from '../shared/schemas';
|
|
221
221
|
|
package/build/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './utils/grpc-reflection';
|
|
|
5
5
|
export * from './models/common';
|
|
6
6
|
export * from './models/context';
|
|
7
7
|
export * from './models/error';
|
|
8
|
-
export
|
|
8
|
+
export declare function getGatewayControllers<TSchema extends SchemasByScope, Context extends GatewayContext, Req extends GatewayRequest<Context>, Res extends GatewayResponse>(schemasByScope: TSchema, config: GatewayConfig<Context, Req, Res>): {
|
|
9
9
|
controller: (req: Req, res: Res) => Promise<any>;
|
|
10
10
|
api: ApiWithRoot<TSchema, Context, Req, Res>;
|
|
11
11
|
};
|
package/build/index.js
CHANGED
|
@@ -29,6 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.getGatewayControllers = void 0;
|
|
32
33
|
const lodash_1 = __importDefault(require("lodash"));
|
|
33
34
|
const grpc_1 = __importStar(require("./components/grpc"));
|
|
34
35
|
const mixed_1 = require("./components/mixed");
|
|
@@ -292,4 +293,4 @@ function getGatewayControllers(schemasByScope, config) {
|
|
|
292
293
|
api,
|
|
293
294
|
};
|
|
294
295
|
}
|
|
295
|
-
exports.
|
|
296
|
+
exports.getGatewayControllers = getGatewayControllers;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/gateway",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -29,7 +29,9 @@
|
|
|
29
29
|
"start-integration-server": "node build-integration/integration-test/server",
|
|
30
30
|
"build-and-run-integration": "npm run build-integration && npm run start-integration-server",
|
|
31
31
|
"clean": "rm -rf build && rm -rf build-integration",
|
|
32
|
-
"lint": "
|
|
32
|
+
"lint": "npm run lint:code && npm run lint:exports",
|
|
33
|
+
"lint:code": "eslint \"lib/**/*.{js,ts}\" --quiet",
|
|
34
|
+
"lint:exports": "npm run build && attw --pack .",
|
|
33
35
|
"typecheck": "tsc --noEmit",
|
|
34
36
|
"prepublishOnly": "npm run build",
|
|
35
37
|
"test": "jest --colors",
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
"uuid": "^9.0.0"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
53
|
+
"@arethetypeswrong/cli": "^0.17.3",
|
|
51
54
|
"@commitlint/cli": "^17.7.1",
|
|
52
55
|
"@commitlint/config-conventional": "^17.7.0",
|
|
53
56
|
"@gravity-ui/eslint-config": "^2.0.0",
|