yapi-to-typescript2 1.0.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.
@@ -0,0 +1,317 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import getAvailablePort from 'get-port';
5
+ import http from 'http';
6
+ import onExit from 'signal-exit';
7
+ import url from 'url';
8
+ import { httpGet } from './utils';
9
+ import { isEmpty } from 'vtils';
10
+ import { swaggerJsonToYApiData } from './swaggerJsonToYApiData';
11
+ export var SwaggerToYApiServer = /*#__PURE__*/function () {
12
+ function SwaggerToYApiServer(options) {
13
+ this.options = options;
14
+ this.port = 0;
15
+ this.swaggerJson = {};
16
+ this.httpServer = null;
17
+ this.yapiData = {};
18
+ }
19
+
20
+ var _proto = SwaggerToYApiServer.prototype;
21
+
22
+ _proto.getPort = /*#__PURE__*/function () {
23
+ var _getPort = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
24
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
25
+ while (1) {
26
+ switch (_context.prev = _context.next) {
27
+ case 0:
28
+ if (!(this.port === 0)) {
29
+ _context.next = 4;
30
+ break;
31
+ }
32
+
33
+ _context.next = 3;
34
+ return getAvailablePort({
35
+ port: 50505
36
+ });
37
+
38
+ case 3:
39
+ this.port = _context.sent;
40
+
41
+ case 4:
42
+ return _context.abrupt("return", this.port);
43
+
44
+ case 5:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }
49
+ }, _callee, this);
50
+ }));
51
+
52
+ function getPort() {
53
+ return _getPort.apply(this, arguments);
54
+ }
55
+
56
+ return getPort;
57
+ }();
58
+
59
+ _proto.getUrl = /*#__PURE__*/function () {
60
+ var _getUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
61
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
62
+ while (1) {
63
+ switch (_context2.prev = _context2.next) {
64
+ case 0:
65
+ _context2.next = 2;
66
+ return this.getPort();
67
+
68
+ case 2:
69
+ _context2.t0 = _context2.sent;
70
+ return _context2.abrupt("return", "http://127.0.0.1:" + _context2.t0);
71
+
72
+ case 4:
73
+ case "end":
74
+ return _context2.stop();
75
+ }
76
+ }
77
+ }, _callee2, this);
78
+ }));
79
+
80
+ function getUrl() {
81
+ return _getUrl.apply(this, arguments);
82
+ }
83
+
84
+ return getUrl;
85
+ }();
86
+
87
+ _proto.getSwaggerJson = /*#__PURE__*/function () {
88
+ var _getSwaggerJson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
89
+ var res;
90
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
91
+ while (1) {
92
+ switch (_context3.prev = _context3.next) {
93
+ case 0:
94
+ if (!isEmpty(this.swaggerJson)) {
95
+ _context3.next = 5;
96
+ break;
97
+ }
98
+
99
+ _context3.next = 3;
100
+ return httpGet(this.options.swaggerJsonUrl);
101
+
102
+ case 3:
103
+ res = _context3.sent;
104
+ this.swaggerJson = res;
105
+
106
+ case 5:
107
+ return _context3.abrupt("return", this.swaggerJson);
108
+
109
+ case 6:
110
+ case "end":
111
+ return _context3.stop();
112
+ }
113
+ }
114
+ }, _callee3, this);
115
+ }));
116
+
117
+ function getSwaggerJson() {
118
+ return _getSwaggerJson.apply(this, arguments);
119
+ }
120
+
121
+ return getSwaggerJson;
122
+ }();
123
+
124
+ _proto.getYApiData = /*#__PURE__*/function () {
125
+ var _getYApiData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
126
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
127
+ while (1) {
128
+ switch (_context4.prev = _context4.next) {
129
+ case 0:
130
+ if (!isEmpty(this.yapiData)) {
131
+ _context4.next = 8;
132
+ break;
133
+ }
134
+
135
+ _context4.t0 = swaggerJsonToYApiData;
136
+ _context4.next = 4;
137
+ return this.getSwaggerJson();
138
+
139
+ case 4:
140
+ _context4.t1 = _context4.sent;
141
+ _context4.next = 7;
142
+ return (0, _context4.t0)(_context4.t1);
143
+
144
+ case 7:
145
+ this.yapiData = _context4.sent;
146
+
147
+ case 8:
148
+ return _context4.abrupt("return", this.yapiData);
149
+
150
+ case 9:
151
+ case "end":
152
+ return _context4.stop();
153
+ }
154
+ }
155
+ }, _callee4, this);
156
+ }));
157
+
158
+ function getYApiData() {
159
+ return _getYApiData.apply(this, arguments);
160
+ }
161
+
162
+ return getYApiData;
163
+ }();
164
+
165
+ _proto.start = /*#__PURE__*/function () {
166
+ var _start = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
167
+ var _this = this;
168
+
169
+ var yapiData;
170
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
171
+ while (1) {
172
+ switch (_context7.prev = _context7.next) {
173
+ case 0:
174
+ _context7.next = 2;
175
+ return this.getYApiData();
176
+
177
+ case 2:
178
+ yapiData = _context7.sent;
179
+ _context7.next = 5;
180
+ return new Promise( /*#__PURE__*/function () {
181
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(resolve) {
182
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
183
+ while (1) {
184
+ switch (_context6.prev = _context6.next) {
185
+ case 0:
186
+ _context6.t0 = http.createServer( /*#__PURE__*/function () {
187
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(req, res) {
188
+ var _url$parse, pathname;
189
+
190
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
191
+ while (1) {
192
+ switch (_context5.prev = _context5.next) {
193
+ case 0:
194
+ _url$parse = url.parse(req.url || ''), pathname = _url$parse.pathname;
195
+ res.setHeader('Content-Type', 'application/json');
196
+
197
+ if (pathname.includes('/api/plugin/export')) {
198
+ res.end(JSON.stringify(yapiData.cats.map(function (cat) {
199
+ return _extends({}, cat, {
200
+ list: yapiData.interfaces.filter(function (item) {
201
+ return item.catid === cat._id;
202
+ })
203
+ });
204
+ })));
205
+ } else if (pathname.includes('/api/interface/getCatMenu')) {
206
+ res.end(JSON.stringify({
207
+ errcode: 0,
208
+ errmsg: '成功!',
209
+ data: yapiData.cats
210
+ }));
211
+ } else if (pathname.includes('/api/project/get')) {
212
+ res.end(JSON.stringify({
213
+ errcode: 0,
214
+ errmsg: '成功!',
215
+ data: yapiData.project
216
+ }));
217
+ } else {
218
+ res.end('404');
219
+ }
220
+
221
+ case 3:
222
+ case "end":
223
+ return _context5.stop();
224
+ }
225
+ }
226
+ }, _callee5);
227
+ }));
228
+
229
+ return function (_x2, _x3) {
230
+ return _ref2.apply(this, arguments);
231
+ };
232
+ }());
233
+ _context6.next = 3;
234
+ return _this.getPort();
235
+
236
+ case 3:
237
+ _context6.t1 = _context6.sent;
238
+
239
+ _context6.t2 = function () {
240
+ onExit(function () {
241
+ return _this.stop();
242
+ });
243
+ resolve();
244
+ };
245
+
246
+ _this.httpServer = _context6.t0.listen.call(_context6.t0, _context6.t1, '127.0.0.1', _context6.t2);
247
+
248
+ case 6:
249
+ case "end":
250
+ return _context6.stop();
251
+ }
252
+ }
253
+ }, _callee6);
254
+ }));
255
+
256
+ return function (_x) {
257
+ return _ref.apply(this, arguments);
258
+ };
259
+ }());
260
+
261
+ case 5:
262
+ return _context7.abrupt("return", this.getUrl());
263
+
264
+ case 6:
265
+ case "end":
266
+ return _context7.stop();
267
+ }
268
+ }
269
+ }, _callee7, this);
270
+ }));
271
+
272
+ function start() {
273
+ return _start.apply(this, arguments);
274
+ }
275
+
276
+ return start;
277
+ }();
278
+
279
+ _proto.stop = /*#__PURE__*/function () {
280
+ var _stop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
281
+ var _this2 = this;
282
+
283
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
284
+ while (1) {
285
+ switch (_context8.prev = _context8.next) {
286
+ case 0:
287
+ return _context8.abrupt("return", new Promise(function (resolve, reject) {
288
+ if (!_this2.httpServer) {
289
+ resolve();
290
+ } else {
291
+ _this2.httpServer.close(function (err) {
292
+ if (err) {
293
+ reject(err);
294
+ } else {
295
+ resolve();
296
+ }
297
+ });
298
+ }
299
+ }));
300
+
301
+ case 1:
302
+ case "end":
303
+ return _context8.stop();
304
+ }
305
+ }
306
+ }, _callee8);
307
+ }));
308
+
309
+ function stop() {
310
+ return _stop.apply(this, arguments);
311
+ }
312
+
313
+ return stop;
314
+ }();
315
+
316
+ return SwaggerToYApiServer;
317
+ }();
package/lib/esm/cli.js ADDED
@@ -0,0 +1,257 @@
1
+ #!/usr/bin/env node
2
+ import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+
5
+ var _templateObject, _templateObject2;
6
+
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
8
+ import * as TSNode from 'ts-node';
9
+ import consola from 'consola';
10
+ import fs from 'fs-extra';
11
+ import ora from 'ora';
12
+ import path from 'path';
13
+ import prompt from 'prompts';
14
+ import yargs from 'yargs';
15
+ import { dedent, wait } from 'vtils';
16
+ import { Generator } from './Generator';
17
+ TSNode.register({
18
+ // 不加载本地的 tsconfig.json
19
+ skipProject: true,
20
+ // 仅转译,不做类型检查
21
+ transpileOnly: true,
22
+ // 自定义编译选项
23
+ compilerOptions: {
24
+ strict: false,
25
+ target: 'es2017',
26
+ module: 'commonjs',
27
+ moduleResolution: 'node',
28
+ declaration: false,
29
+ removeComments: false,
30
+ esModuleInterop: true,
31
+ allowSyntheticDefaultImports: true,
32
+ importHelpers: false,
33
+ // 转换 js,支持在 ytt.config.js 里使用最新语法
34
+ allowJs: true,
35
+ lib: ['es2017']
36
+ }
37
+ });
38
+ export function run(_x, _x2) {
39
+ return _run.apply(this, arguments);
40
+ }
41
+ /* istanbul ignore next */
42
+
43
+ function _run() {
44
+ _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cmd, options) {
45
+ var useCustomConfigFile, cwd, configTSFile, configJSFile, configFile, configFileExist, configTSFileExist, configJSFileExist, answers, outputConfigFile, outputConfigFileType, _answers, _config2, _config2$hooks, config, generator, spinner, _hooks, delayNotice, output, _spinner, _generator, _config, _config$hooks;
46
+
47
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
48
+ while (1) {
49
+ switch (_context.prev = _context.next) {
50
+ case 0:
51
+ useCustomConfigFile = false;
52
+
53
+ if (options != null && options.configFile) {
54
+ _context.next = 18;
55
+ break;
56
+ }
57
+
58
+ cwd = process.cwd();
59
+ configTSFile = path.join(cwd, 'ytt.config.ts');
60
+ configJSFile = path.join(cwd, 'ytt.config.js');
61
+ _context.next = 7;
62
+ return fs.pathExists(configTSFile);
63
+
64
+ case 7:
65
+ configTSFileExist = _context.sent;
66
+ _context.t0 = !configTSFileExist;
67
+
68
+ if (!_context.t0) {
69
+ _context.next = 13;
70
+ break;
71
+ }
72
+
73
+ _context.next = 12;
74
+ return fs.pathExists(configJSFile);
75
+
76
+ case 12:
77
+ _context.t0 = _context.sent;
78
+
79
+ case 13:
80
+ configJSFileExist = _context.t0;
81
+ configFileExist = configTSFileExist || configJSFileExist;
82
+ configFile = configTSFileExist ? configTSFile : configJSFile;
83
+ _context.next = 24;
84
+ break;
85
+
86
+ case 18:
87
+ useCustomConfigFile = true;
88
+ configFile = options.configFile;
89
+ cwd = path.dirname(configFile);
90
+ _context.next = 23;
91
+ return fs.pathExists(configFile);
92
+
93
+ case 23:
94
+ configFileExist = _context.sent;
95
+
96
+ case 24:
97
+ if (!(cmd === 'help')) {
98
+ _context.next = 28;
99
+ break;
100
+ }
101
+
102
+ console.log("\n" + dedent(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n # \u7528\u6CD5\n \u521D\u59CB\u5316\u914D\u7F6E\u6587\u4EF6: ytt init\n \u751F\u6210\u4EE3\u7801: ytt\n \u67E5\u770B\u5E2E\u52A9: ytt help\n\n # GitHub\n https://github.com/fjc0k/yapi-to-typescript\n "]))) + "\n");
103
+ _context.next = 87;
104
+ break;
105
+
106
+ case 28:
107
+ if (!(cmd === 'init')) {
108
+ _context.next = 51;
109
+ break;
110
+ }
111
+
112
+ if (!configFileExist) {
113
+ _context.next = 36;
114
+ break;
115
+ }
116
+
117
+ consola.info("\u68C0\u6D4B\u5230\u914D\u7F6E\u6587\u4EF6: " + configFile);
118
+ _context.next = 33;
119
+ return prompt({
120
+ message: '是否覆盖已有配置文件?',
121
+ name: 'override',
122
+ type: 'confirm'
123
+ });
124
+
125
+ case 33:
126
+ answers = _context.sent;
127
+
128
+ if (answers.override) {
129
+ _context.next = 36;
130
+ break;
131
+ }
132
+
133
+ return _context.abrupt("return");
134
+
135
+ case 36:
136
+ if (!useCustomConfigFile) {
137
+ _context.next = 41;
138
+ break;
139
+ }
140
+
141
+ outputConfigFile = configFile;
142
+ outputConfigFileType = configFile.endsWith('.js') ? 'js' : 'ts';
143
+ _context.next = 46;
144
+ break;
145
+
146
+ case 41:
147
+ _context.next = 43;
148
+ return prompt({
149
+ message: '选择配置文件类型?',
150
+ name: 'configFileType',
151
+ type: 'select',
152
+ choices: [{
153
+ title: 'TypeScript(ytt.config.ts)',
154
+ value: 'ts'
155
+ }, {
156
+ title: 'JavaScript(ytt.config.js)',
157
+ value: 'js'
158
+ }]
159
+ });
160
+
161
+ case 43:
162
+ _answers = _context.sent;
163
+ outputConfigFile = _answers.configFileType === 'js' ? configJSFile : configTSFile;
164
+ outputConfigFileType = _answers.configFileType;
165
+
166
+ case 46:
167
+ _context.next = 48;
168
+ return fs.outputFile(outputConfigFile, dedent(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n import { defineConfig } from 'yapi-to-typescript'\n\n export default defineConfig([\n {\n serverUrl: 'http://foo.bar',\n typesOnly: false,\n target: '", "',\n reactHooks: {\n enabled: false,\n },\n prodEnvName: 'production',\n outputFilePath: 'src/api/index.", "',\n requestFunctionFilePath: 'src/api/request.", "',\n dataKey: 'data',\n projects: [\n {\n token: 'hello',\n categories: [\n {\n id: 0,\n getRequestFunctionName(interfaceInfo, changeCase) {\n // \u4EE5\u63A5\u53E3\u5168\u8DEF\u5F84\u751F\u6210\u8BF7\u6C42\u51FD\u6570\u540D\n return changeCase.camelCase(interfaceInfo.path)\n\n // \u82E5\u751F\u6210\u7684\u8BF7\u6C42\u51FD\u6570\u540D\u5B58\u5728\u8BED\u6CD5\u5173\u952E\u8BCD\u62A5\u9519\u3001\u6216\u60F3\u901A\u8FC7\u67D0\u4E2A\u5173\u952E\u8BCD\u89E6\u53D1 IDE \u81EA\u52A8\u5F15\u5165\u63D0\u793A\uFF0C\u53EF\u8003\u8651\u52A0\u524D\u7F00\uFF0C\u5982:\n // return changeCase.camelCase(`api_${interfaceInfo.path}`)\n\n // \u82E5\u751F\u6210\u7684\u8BF7\u6C42\u51FD\u6570\u540D\u6709\u91CD\u590D\u62A5\u9519\uFF0C\u53EF\u8003\u8651\u5C06\u63A5\u53E3\u8BF7\u6C42\u65B9\u5F0F\u7EB3\u5165\u751F\u6210\u6761\u4EF6\uFF0C\u5982:\n // return changeCase.camelCase(`${interfaceInfo.method}_${interfaceInfo.path}`)\n },\n },\n ],\n },\n ],\n },\n ])\n "], ["\n import { defineConfig } from 'yapi-to-typescript'\n\n export default defineConfig([\n {\n serverUrl: 'http://foo.bar',\n typesOnly: false,\n target: '", "',\n reactHooks: {\n enabled: false,\n },\n prodEnvName: 'production',\n outputFilePath: 'src/api/index.", "',\n requestFunctionFilePath: 'src/api/request.", "',\n dataKey: 'data',\n projects: [\n {\n token: 'hello',\n categories: [\n {\n id: 0,\n getRequestFunctionName(interfaceInfo, changeCase) {\n // \u4EE5\u63A5\u53E3\u5168\u8DEF\u5F84\u751F\u6210\u8BF7\u6C42\u51FD\u6570\u540D\n return changeCase.camelCase(interfaceInfo.path)\n\n // \u82E5\u751F\u6210\u7684\u8BF7\u6C42\u51FD\u6570\u540D\u5B58\u5728\u8BED\u6CD5\u5173\u952E\u8BCD\u62A5\u9519\u3001\u6216\u60F3\u901A\u8FC7\u67D0\u4E2A\u5173\u952E\u8BCD\u89E6\u53D1 IDE \u81EA\u52A8\u5F15\u5165\u63D0\u793A\uFF0C\u53EF\u8003\u8651\u52A0\u524D\u7F00\uFF0C\u5982:\n // return changeCase.camelCase(\\`api_\\${interfaceInfo.path}\\`)\n\n // \u82E5\u751F\u6210\u7684\u8BF7\u6C42\u51FD\u6570\u540D\u6709\u91CD\u590D\u62A5\u9519\uFF0C\u53EF\u8003\u8651\u5C06\u63A5\u53E3\u8BF7\u6C42\u65B9\u5F0F\u7EB3\u5165\u751F\u6210\u6761\u4EF6\uFF0C\u5982:\n // return changeCase.camelCase(\\`\\${interfaceInfo.method}_\\${interfaceInfo.path}\\`)\n },\n },\n ],\n },\n ],\n },\n ])\n "])), outputConfigFileType === 'js' ? 'javascript' : 'typescript', outputConfigFileType, outputConfigFileType));
169
+
170
+ case 48:
171
+ consola.success('写入配置文件完毕');
172
+ _context.next = 87;
173
+ break;
174
+
175
+ case 51:
176
+ if (configFileExist) {
177
+ _context.next = 53;
178
+ break;
179
+ }
180
+
181
+ return _context.abrupt("return", consola.error("\u627E\u4E0D\u5230\u914D\u7F6E\u6587\u4EF6: " + (useCustomConfigFile ? configFile : configTSFile + " \u6216 " + configJSFile)));
182
+
183
+ case 53:
184
+ consola.success("\u627E\u5230\u914D\u7F6E\u6587\u4EF6: " + configFile);
185
+ _context.prev = 54;
186
+ config = require(configFile).default;
187
+ generator = new Generator(config, {
188
+ cwd: cwd
189
+ });
190
+ spinner = ora('正在获取数据并生成代码...').start();
191
+ delayNotice = wait(5000);
192
+ delayNotice.then(function () {
193
+ spinner.text = "\u6B63\u5728\u83B7\u53D6\u6570\u636E\u5E76\u751F\u6210\u4EE3\u7801... (\u82E5\u957F\u65F6\u95F4\u5904\u4E8E\u6B64\u72B6\u6001\uFF0C\u8BF7\u68C0\u67E5\u662F\u5426\u6709\u63A5\u53E3\u5B9A\u4E49\u7684\u6570\u636E\u8FC7\u5927\u5BFC\u81F4\u62C9\u53D6\u6216\u89E3\u6790\u7F13\u6162)";
194
+ });
195
+ _context.next = 62;
196
+ return generator.prepare();
197
+
198
+ case 62:
199
+ delayNotice.cancel();
200
+ _context.next = 65;
201
+ return generator.generate();
202
+
203
+ case 65:
204
+ output = _context.sent;
205
+ spinner.stop();
206
+ consola.success('获取数据并生成代码完毕');
207
+ _context.next = 70;
208
+ return generator.write(output);
209
+
210
+ case 70:
211
+ consola.success('写入文件完毕');
212
+ _context.next = 73;
213
+ return generator.destroy();
214
+
215
+ case 73:
216
+ _context.next = 75;
217
+ return (_hooks = config.hooks) == null ? void 0 : _hooks.success == null ? void 0 : _hooks.success();
218
+
219
+ case 75:
220
+ _context.next = 85;
221
+ break;
222
+
223
+ case 77:
224
+ _context.prev = 77;
225
+ _context.t1 = _context["catch"](54);
226
+ (_spinner = spinner) == null ? void 0 : _spinner.stop();
227
+ _context.next = 82;
228
+ return (_generator = generator) == null ? void 0 : _generator.destroy();
229
+
230
+ case 82:
231
+ _context.next = 84;
232
+ return (_config = config) == null ? void 0 : (_config$hooks = _config.hooks) == null ? void 0 : _config$hooks.fail == null ? void 0 : _config$hooks.fail();
233
+
234
+ case 84:
235
+ /* istanbul ignore next */
236
+ consola.error(_context.t1);
237
+
238
+ case 85:
239
+ _context.next = 87;
240
+ return (_config2 = config) == null ? void 0 : (_config2$hooks = _config2.hooks) == null ? void 0 : _config2$hooks.complete == null ? void 0 : _config2$hooks.complete();
241
+
242
+ case 87:
243
+ case "end":
244
+ return _context.stop();
245
+ }
246
+ }
247
+ }, _callee, null, [[54, 77]]);
248
+ }));
249
+ return _run.apply(this, arguments);
250
+ }
251
+
252
+ if (require.main === module) {
253
+ var argv = yargs(process.argv).alias('c', 'config').argv;
254
+ run(argv._[2], {
255
+ configFile: argv.config ? path.resolve(process.cwd(), argv.config) : undefined
256
+ });
257
+ }