@nocobase/plugin-users 0.7.0-alpha.9 → 0.7.1-alpha.6

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.
Files changed (61) hide show
  1. package/lib/actions/users.js +279 -163
  2. package/lib/collections/roles-users.js +12 -5
  3. package/lib/collections/users.js +88 -86
  4. package/lib/index.d.ts +1 -0
  5. package/lib/index.js +19 -8
  6. package/lib/jwt-service.js +50 -29
  7. package/lib/locale/en-US.d.ts +5 -0
  8. package/lib/locale/en-US.js +11 -0
  9. package/lib/locale/index.d.ts +2 -0
  10. package/lib/locale/index.js +23 -0
  11. package/lib/locale/zh-CN.d.ts +6 -0
  12. package/lib/locale/zh-CN.js +12 -0
  13. package/lib/middlewares/check.js +28 -23
  14. package/lib/middlewares/index.js +20 -7
  15. package/lib/middlewares/parseToken.js +86 -62
  16. package/lib/models/UserModel.d.ts +2 -2
  17. package/lib/models/UserModel.js +68 -53
  18. package/lib/server.d.ts +5 -10
  19. package/lib/server.js +261 -149
  20. package/package.json +3 -8
  21. package/esm/actions/users.d.ts +0 -11
  22. package/esm/actions/users.js +0 -165
  23. package/esm/actions/users.js.map +0 -1
  24. package/esm/collections/roles-users.d.ts +0 -3
  25. package/esm/collections/roles-users.js +0 -5
  26. package/esm/collections/roles-users.js.map +0 -1
  27. package/esm/collections/users.d.ts +0 -3
  28. package/esm/collections/users.js +0 -86
  29. package/esm/collections/users.js.map +0 -1
  30. package/esm/index.d.ts +0 -1
  31. package/esm/index.js +0 -2
  32. package/esm/index.js.map +0 -1
  33. package/esm/jwt-service.d.ts +0 -12
  34. package/esm/jwt-service.js +0 -26
  35. package/esm/jwt-service.js.map +0 -1
  36. package/esm/middlewares/check.d.ts +0 -1
  37. package/esm/middlewares/check.js +0 -22
  38. package/esm/middlewares/check.js.map +0 -1
  39. package/esm/middlewares/index.d.ts +0 -2
  40. package/esm/middlewares/index.js +0 -3
  41. package/esm/middlewares/index.js.map +0 -1
  42. package/esm/middlewares/parseToken.d.ts +0 -6
  43. package/esm/middlewares/parseToken.js +0 -64
  44. package/esm/middlewares/parseToken.js.map +0 -1
  45. package/esm/models/UserModel.d.ts +0 -4
  46. package/esm/models/UserModel.js +0 -53
  47. package/esm/models/UserModel.js.map +0 -1
  48. package/esm/server.d.ts +0 -23
  49. package/esm/server.js +0 -133
  50. package/esm/server.js.map +0 -1
  51. package/lib/actions/users.js.map +0 -1
  52. package/lib/collections/roles-users.js.map +0 -1
  53. package/lib/collections/users.js.map +0 -1
  54. package/lib/index.js.map +0 -1
  55. package/lib/jwt-service.js.map +0 -1
  56. package/lib/middlewares/check.js.map +0 -1
  57. package/lib/middlewares/index.js.map +0 -1
  58. package/lib/middlewares/parseToken.js.map +0 -1
  59. package/lib/models/UserModel.js.map +0 -1
  60. package/lib/server.js.map +0 -1
  61. package/tsconfig.build.json +0 -9
@@ -1,181 +1,297 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.changePassword = changePassword;
7
+ exports.check = check;
8
+ exports.getUserByResetToken = getUserByResetToken;
9
+ exports.lostpassword = lostpassword;
10
+ exports.resetpassword = resetpassword;
11
+ exports.setDefaultRole = setDefaultRole;
12
+ exports.signin = signin;
13
+ exports.signout = signout;
14
+ exports.signup = signup;
15
+ exports.updateProfile = updateProfile;
16
+
17
+ function _crypto() {
18
+ const data = _interopRequireDefault(require("crypto"));
19
+
20
+ _crypto = function _crypto() {
21
+ return data;
22
+ };
23
+
24
+ return data;
25
+ }
26
+
27
+ var _ = require("../");
28
+
29
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
+
31
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
32
+
33
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
34
+
35
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
36
+
37
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
38
+
39
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
40
+
41
+ function check(_x, _x2) {
42
+ return _check.apply(this, arguments);
43
+ }
44
+
45
+ function _check() {
46
+ _check = _asyncToGenerator(function* (ctx, next) {
47
+ if (ctx.state.currentUser) {
48
+ const user = ctx.state.currentUser.toJSON();
49
+ ctx.body = user;
50
+ } else {
51
+ ctx.body = {};
52
+ }
53
+
54
+ yield next();
55
+ });
56
+ return _check.apply(this, arguments);
57
+ }
58
+
59
+ function signin(_x3, _x4) {
60
+ return _signin.apply(this, arguments);
61
+ }
62
+
63
+ function _signin() {
64
+ _signin = _asyncToGenerator(function* (ctx, next) {
65
+ const _ctx$action$params = ctx.action.params,
66
+ _ctx$action$params$un = _ctx$action$params.uniqueField,
67
+ uniqueField = _ctx$action$params$un === void 0 ? 'email' : _ctx$action$params$un,
68
+ values = _ctx$action$params.values;
69
+
70
+ if (!values[uniqueField]) {
71
+ ctx.throw(401, ctx.t('Please fill in your email address', {
72
+ ns: _.namespace
73
+ }));
74
+ }
75
+
76
+ const User = ctx.db.getCollection('users');
77
+ const user = yield User.model.findOne({
78
+ where: {
79
+ [uniqueField]: values[uniqueField]
80
+ }
9
81
  });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.setDefaultRole = exports.changePassword = exports.updateProfile = exports.getUserByResetToken = exports.resetpassword = exports.lostpassword = exports.signup = exports.signout = exports.signin = exports.check = void 0;
16
- const crypto_1 = __importDefault(require("crypto"));
17
- function check(ctx, next) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- if (ctx.state.currentUser) {
20
- const user = ctx.state.currentUser.toJSON();
21
- ctx.body = user;
22
- }
23
- else {
24
- ctx.body = {};
25
- }
26
- yield next();
82
+
83
+ if (!user) {
84
+ ctx.throw(401, ctx.t('The email is incorrect, please re-enter', {
85
+ ns: _.namespace
86
+ }));
87
+ }
88
+
89
+ const pwd = User.getField('password');
90
+ const isValid = yield pwd.verify(values.password, user.password);
91
+
92
+ if (!isValid) {
93
+ ctx.throw(401, ctx.t('The password is incorrect, please re-enter', {
94
+ ns: _.namespace
95
+ }));
96
+ }
97
+
98
+ const pluginUser = ctx.app.getPlugin('@nocobase/plugin-users');
99
+ ctx.body = _objectSpread(_objectSpread({}, user.toJSON()), {}, {
100
+ token: pluginUser.jwtService.sign({
101
+ userId: user.get('id')
102
+ })
27
103
  });
104
+ yield next();
105
+ });
106
+ return _signin.apply(this, arguments);
28
107
  }
29
- exports.check = check;
30
- function signin(ctx, next) {
31
- return __awaiter(this, void 0, void 0, function* () {
32
- const { uniqueField = 'email', values } = ctx.action.params;
33
- if (!values[uniqueField]) {
34
- ctx.throw(401, '请填写邮箱账号');
35
- }
36
- const User = ctx.db.getCollection('users');
37
- const user = yield User.model.findOne({
38
- where: {
39
- [uniqueField]: values[uniqueField],
40
- },
41
- });
42
- if (!user) {
43
- ctx.throw(401, '邮箱账号未注册');
44
- }
45
- const pwd = User.getField('password');
46
- const isValid = yield pwd.verify(values.password, user.password);
47
- if (!isValid) {
48
- ctx.throw(401, '密码错误,请您重新输入');
49
- }
50
- const pluginUser = ctx.app.getPlugin('@nocobase/plugin-users');
51
- ctx.body = Object.assign(Object.assign({}, user.toJSON()), { token: pluginUser.jwtService.sign({
52
- userId: user.get('id'),
53
- }) });
54
- yield next();
55
- });
108
+
109
+ function signout(_x5, _x6) {
110
+ return _signout.apply(this, arguments);
56
111
  }
57
- exports.signin = signin;
58
- function signout(ctx, next) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- ctx.body = ctx.state.currentUser;
61
- yield next();
62
- });
112
+
113
+ function _signout() {
114
+ _signout = _asyncToGenerator(function* (ctx, next) {
115
+ ctx.body = ctx.state.currentUser;
116
+ yield next();
117
+ });
118
+ return _signout.apply(this, arguments);
63
119
  }
64
- exports.signout = signout;
65
- function signup(ctx, next) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const User = ctx.db.getRepository('users');
68
- const { values } = ctx.action.params;
69
- const user = yield User.create({ values });
70
- ctx.body = user;
71
- yield next();
72
- });
120
+
121
+ function signup(_x7, _x8) {
122
+ return _signup.apply(this, arguments);
73
123
  }
74
- exports.signup = signup;
75
- function lostpassword(ctx, next) {
76
- return __awaiter(this, void 0, void 0, function* () {
77
- const { values: { email }, } = ctx.action.params;
78
- if (!email) {
79
- ctx.throw(401, '请填写邮箱账号');
80
- }
81
- const User = ctx.db.getCollection('users');
82
- const user = yield User.model.findOne({
83
- where: {
84
- email,
85
- },
86
- });
87
- if (!user) {
88
- ctx.throw(401, '邮箱账号未注册');
89
- }
90
- user.resetToken = crypto_1.default.randomBytes(20).toString('hex');
91
- yield user.save();
92
- ctx.body = user;
93
- yield next();
124
+
125
+ function _signup() {
126
+ _signup = _asyncToGenerator(function* (ctx, next) {
127
+ const User = ctx.db.getRepository('users');
128
+ const values = ctx.action.params.values;
129
+ const user = yield User.create({
130
+ values
94
131
  });
132
+ ctx.body = user;
133
+ yield next();
134
+ });
135
+ return _signup.apply(this, arguments);
95
136
  }
96
- exports.lostpassword = lostpassword;
97
- function resetpassword(ctx, next) {
98
- return __awaiter(this, void 0, void 0, function* () {
99
- const { values: { email, password, resetToken }, } = ctx.action.params;
100
- const User = ctx.db.getCollection('users');
101
- const user = yield User.model.findOne({
102
- where: {
103
- email,
104
- resetToken,
105
- },
106
- });
107
- if (!user) {
108
- ctx.throw(401, 'Unauthorized');
109
- }
110
- user.token = null;
111
- user.resetToken = null;
112
- user.password = password;
113
- yield user.save();
114
- ctx.body = user;
115
- yield next();
116
- });
137
+
138
+ function lostpassword(_x9, _x10) {
139
+ return _lostpassword.apply(this, arguments);
117
140
  }
118
- exports.resetpassword = resetpassword;
119
- function getUserByResetToken(ctx, next) {
120
- return __awaiter(this, void 0, void 0, function* () {
121
- const { token } = ctx.action.params;
122
- const User = ctx.db.getCollection('users');
123
- const user = yield User.model.findOne({
124
- where: {
125
- resetToken: token,
126
- },
127
- });
128
- if (!user) {
129
- ctx.throw(401, 'Unauthorized');
130
- }
131
- ctx.body = user;
132
- yield next();
141
+
142
+ function _lostpassword() {
143
+ _lostpassword = _asyncToGenerator(function* (ctx, next) {
144
+ const email = ctx.action.params.values.email;
145
+
146
+ if (!email) {
147
+ ctx.throw(401, ctx.t('Please fill in your email address', {
148
+ ns: _.namespace
149
+ }));
150
+ }
151
+
152
+ const User = ctx.db.getCollection('users');
153
+ const user = yield User.model.findOne({
154
+ where: {
155
+ email
156
+ }
133
157
  });
158
+
159
+ if (!user) {
160
+ ctx.throw(401, ctx.t('The email is incorrect, please re-enter', {
161
+ ns: _.namespace
162
+ }));
163
+ }
164
+
165
+ user.resetToken = _crypto().default.randomBytes(20).toString('hex');
166
+ yield user.save();
167
+ ctx.body = user;
168
+ yield next();
169
+ });
170
+ return _lostpassword.apply(this, arguments);
134
171
  }
135
- exports.getUserByResetToken = getUserByResetToken;
136
- function updateProfile(ctx, next) {
137
- return __awaiter(this, void 0, void 0, function* () {
138
- const { values } = ctx.action.params;
139
- if (!ctx.state.currentUser) {
140
- ctx.throw(401, 'Unauthorized');
141
- }
142
- yield ctx.state.currentUser.update(values);
143
- ctx.body = ctx.state.currentUser;
144
- yield next();
172
+
173
+ function resetpassword(_x11, _x12) {
174
+ return _resetpassword.apply(this, arguments);
175
+ }
176
+
177
+ function _resetpassword() {
178
+ _resetpassword = _asyncToGenerator(function* (ctx, next) {
179
+ const _ctx$action$params$va = ctx.action.params.values,
180
+ email = _ctx$action$params$va.email,
181
+ password = _ctx$action$params$va.password,
182
+ resetToken = _ctx$action$params$va.resetToken;
183
+ const User = ctx.db.getCollection('users');
184
+ const user = yield User.model.findOne({
185
+ where: {
186
+ email,
187
+ resetToken
188
+ }
145
189
  });
190
+
191
+ if (!user) {
192
+ ctx.throw(401, 'Unauthorized');
193
+ }
194
+
195
+ user.token = null;
196
+ user.resetToken = null;
197
+ user.password = password;
198
+ yield user.save();
199
+ ctx.body = user;
200
+ yield next();
201
+ });
202
+ return _resetpassword.apply(this, arguments);
146
203
  }
147
- exports.updateProfile = updateProfile;
148
- function changePassword(ctx, next) {
149
- return __awaiter(this, void 0, void 0, function* () {
150
- const { values: { oldPassword, newPassword }, } = ctx.action.params;
151
- if (!ctx.state.currentUser) {
152
- ctx.throw(401, 'Unauthorized');
153
- }
154
- const User = ctx.db.getCollection('users');
155
- const user = yield User.model.findOne({
156
- where: {
157
- email: ctx.state.currentUser.email,
158
- },
159
- });
160
- const pwd = User.getField('password');
161
- const isValid = yield pwd.verify(oldPassword, user.password);
162
- if (!isValid) {
163
- ctx.throw(401, '密码错误,请您重新输入');
164
- }
165
- user.password = newPassword;
166
- user.save();
167
- ctx.body = ctx.state.currentUser.toJSON();
168
- yield next();
204
+
205
+ function getUserByResetToken(_x13, _x14) {
206
+ return _getUserByResetToken.apply(this, arguments);
207
+ }
208
+
209
+ function _getUserByResetToken() {
210
+ _getUserByResetToken = _asyncToGenerator(function* (ctx, next) {
211
+ const token = ctx.action.params.token;
212
+ const User = ctx.db.getCollection('users');
213
+ const user = yield User.model.findOne({
214
+ where: {
215
+ resetToken: token
216
+ }
169
217
  });
218
+
219
+ if (!user) {
220
+ ctx.throw(401, 'Unauthorized');
221
+ }
222
+
223
+ ctx.body = user;
224
+ yield next();
225
+ });
226
+ return _getUserByResetToken.apply(this, arguments);
170
227
  }
171
- exports.changePassword = changePassword;
172
- function setDefaultRole(ctx, next) {
173
- return __awaiter(this, void 0, void 0, function* () {
174
- const { values: { roleName }, } = ctx.action.params;
175
- yield ctx.state.currentUser.setDefaultRole(roleName);
176
- ctx.body = 'ok';
177
- yield next();
228
+
229
+ function updateProfile(_x15, _x16) {
230
+ return _updateProfile.apply(this, arguments);
231
+ }
232
+
233
+ function _updateProfile() {
234
+ _updateProfile = _asyncToGenerator(function* (ctx, next) {
235
+ const values = ctx.action.params.values;
236
+
237
+ if (!ctx.state.currentUser) {
238
+ ctx.throw(401, 'Unauthorized');
239
+ }
240
+
241
+ yield ctx.state.currentUser.update(values);
242
+ ctx.body = ctx.state.currentUser;
243
+ yield next();
244
+ });
245
+ return _updateProfile.apply(this, arguments);
246
+ }
247
+
248
+ function changePassword(_x17, _x18) {
249
+ return _changePassword.apply(this, arguments);
250
+ }
251
+
252
+ function _changePassword() {
253
+ _changePassword = _asyncToGenerator(function* (ctx, next) {
254
+ const _ctx$action$params$va2 = ctx.action.params.values,
255
+ oldPassword = _ctx$action$params$va2.oldPassword,
256
+ newPassword = _ctx$action$params$va2.newPassword;
257
+
258
+ if (!ctx.state.currentUser) {
259
+ ctx.throw(401, 'Unauthorized');
260
+ }
261
+
262
+ const User = ctx.db.getCollection('users');
263
+ const user = yield User.model.findOne({
264
+ where: {
265
+ email: ctx.state.currentUser.email
266
+ }
178
267
  });
268
+ const pwd = User.getField('password');
269
+ const isValid = yield pwd.verify(oldPassword, user.password);
270
+
271
+ if (!isValid) {
272
+ ctx.throw(401, ctx.t('The password is incorrect, please re-enter', {
273
+ ns: _.namespace
274
+ }));
275
+ }
276
+
277
+ user.password = newPassword;
278
+ user.save();
279
+ ctx.body = ctx.state.currentUser.toJSON();
280
+ yield next();
281
+ });
282
+ return _changePassword.apply(this, arguments);
179
283
  }
180
- exports.setDefaultRole = setDefaultRole;
181
- //# sourceMappingURL=users.js.map
284
+
285
+ function setDefaultRole(_x19, _x20) {
286
+ return _setDefaultRole.apply(this, arguments);
287
+ }
288
+
289
+ function _setDefaultRole() {
290
+ _setDefaultRole = _asyncToGenerator(function* (ctx, next) {
291
+ const roleName = ctx.action.params.values.roleName;
292
+ yield ctx.state.currentUser.setDefaultRole(roleName);
293
+ ctx.body = 'ok';
294
+ yield next();
295
+ });
296
+ return _setDefaultRole.apply(this, arguments);
297
+ }
@@ -1,7 +1,14 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- name: 'rolesUsers',
5
- fields: [{ type: 'boolean', name: 'default' }],
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ name: 'rolesUsers',
9
+ fields: [{
10
+ type: 'boolean',
11
+ name: 'default'
12
+ }]
6
13
  };
7
- //# sourceMappingURL=roles-users.js.map
14
+ exports.default = _default;
@@ -1,88 +1,90 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- name: 'users',
5
- title: '{{t("Users")}}',
6
- sortable: 'sort',
7
- model: 'UserModel',
8
- createdBy: true,
9
- updatedBy: true,
10
- fields: [
11
- {
12
- name: 'id',
13
- type: 'integer',
14
- autoIncrement: true,
15
- primaryKey: true,
16
- allowNull: false,
17
- uiSchema: { type: 'number', title: '{{t("ID")}}', 'x-component': 'InputNumber', 'x-read-pretty': true },
18
- interface: 'id',
19
- },
20
- {
21
- interface: 'input',
22
- type: 'string',
23
- name: 'nickname',
24
- uiSchema: {
25
- type: 'string',
26
- title: '{{t("Nickname")}}',
27
- 'x-component': 'Input',
28
- },
29
- },
30
- {
31
- interface: 'email',
32
- type: 'string',
33
- name: 'email',
34
- unique: true,
35
- uiSchema: {
36
- type: 'string',
37
- title: '{{t("Email")}}',
38
- 'x-component': 'Input',
39
- require: true,
40
- },
41
- },
42
- {
43
- interface: 'password',
44
- type: 'password',
45
- name: 'password',
46
- hidden: true,
47
- uiSchema: {
48
- type: 'string',
49
- title: '{{t("Password")}}',
50
- 'x-component': 'Password',
51
- },
52
- },
53
- {
54
- interface: 'linkTo',
55
- type: 'belongsToMany',
56
- name: 'roles',
57
- target: 'roles',
58
- foreignKey: 'userId',
59
- otherKey: 'roleName',
60
- sourceKey: 'id',
61
- targetKey: 'name',
62
- through: 'rolesUsers',
63
- uiSchema: {
64
- type: 'array',
65
- title: '{{t("Roles")}}',
66
- 'x-component': 'RecordPicker',
67
- 'x-component-props': {
68
- multiple: true,
69
- fieldNames: {
70
- label: 'title',
71
- value: 'name',
72
- },
73
- },
74
- },
75
- },
76
- {
77
- type: 'string',
78
- name: 'appLang',
79
- },
80
- {
81
- type: 'string',
82
- name: 'resetToken',
83
- unique: true,
84
- hidden: true,
85
- },
86
- ],
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = {
8
+ name: 'users',
9
+ title: '{{t("Users")}}',
10
+ sortable: 'sort',
11
+ model: 'UserModel',
12
+ createdBy: true,
13
+ updatedBy: true,
14
+ logging: true,
15
+ fields: [{
16
+ name: 'id',
17
+ type: 'integer',
18
+ autoIncrement: true,
19
+ primaryKey: true,
20
+ allowNull: false,
21
+ uiSchema: {
22
+ type: 'number',
23
+ title: '{{t("ID")}}',
24
+ 'x-component': 'InputNumber',
25
+ 'x-read-pretty': true
26
+ },
27
+ interface: 'id'
28
+ }, {
29
+ interface: 'input',
30
+ type: 'string',
31
+ name: 'nickname',
32
+ uiSchema: {
33
+ type: 'string',
34
+ title: '{{t("Nickname")}}',
35
+ 'x-component': 'Input'
36
+ }
37
+ }, {
38
+ interface: 'email',
39
+ type: 'string',
40
+ name: 'email',
41
+ unique: true,
42
+ uiSchema: {
43
+ type: 'string',
44
+ title: '{{t("Email")}}',
45
+ 'x-component': 'Input',
46
+ require: true
47
+ }
48
+ }, {
49
+ interface: 'password',
50
+ type: 'password',
51
+ name: 'password',
52
+ hidden: true,
53
+ uiSchema: {
54
+ type: 'string',
55
+ title: '{{t("Password")}}',
56
+ 'x-component': 'Password'
57
+ }
58
+ }, {
59
+ interface: 'm2m',
60
+ type: 'belongsToMany',
61
+ name: 'roles',
62
+ target: 'roles',
63
+ foreignKey: 'userId',
64
+ otherKey: 'roleName',
65
+ sourceKey: 'id',
66
+ targetKey: 'name',
67
+ through: 'rolesUsers',
68
+ uiSchema: {
69
+ type: 'array',
70
+ title: '{{t("Roles")}}',
71
+ 'x-component': 'RecordPicker',
72
+ 'x-component-props': {
73
+ multiple: true,
74
+ fieldNames: {
75
+ label: 'title',
76
+ value: 'name'
77
+ }
78
+ }
79
+ }
80
+ }, {
81
+ type: 'string',
82
+ name: 'appLang'
83
+ }, {
84
+ type: 'string',
85
+ name: 'resetToken',
86
+ unique: true,
87
+ hidden: true
88
+ }]
87
89
  };
88
- //# sourceMappingURL=users.js.map
90
+ exports.default = _default;
package/lib/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { default } from './server';
2
+ export declare const namespace: any;