@nocobase/plugin-users 0.18.0-alpha.9 → 0.19.0-alpha.2
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/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/externalVersion.js +5 -5
- package/dist/server/collections/users.d.ts +1 -2
- package/dist/server/collections/users.js +7 -6
- package/dist/server/migrations/20220818072639-add-users-phone-constraint.d.ts +7 -0
- package/dist/server/migrations/20220818072639-add-users-phone-constraint.js +52 -0
- package/dist/server/migrations/20220818072639-add-users-phone.d.ts +1 -0
- package/dist/server/migrations/20220818072639-add-users-phone.js +2 -7
- package/dist/server/migrations/20230802170800-add-username-constraint.d.ts +6 -0
- package/dist/server/migrations/20230802170800-add-username-constraint.js +50 -0
- package/dist/server/migrations/20230802170800-add-username.d.ts +1 -1
- package/dist/server/migrations/20230802170800-add-username.js +2 -9
- package/dist/server/migrations/20230802183100-update-username.d.ts +1 -0
- package/dist/server/migrations/20230802183100-update-username.js +1 -4
- package/dist/server/migrations/20230908164036-update-username-interface.d.ts +1 -0
- package/dist/server/migrations/20230908164036-update-username-interface.js +1 -0
- package/dist/server/server.js +1 -3
- package/package.json +2 -2
- package/server.d.ts +2 -0
- package/server.js +1 -0
package/client.d.ts
ADDED
package/client.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.
|
|
3
|
-
"@nocobase/database": "0.
|
|
4
|
-
"@nocobase/server": "0.
|
|
5
|
-
"@nocobase/utils": "0.
|
|
6
|
-
"@nocobase/actions": "0.
|
|
2
|
+
"@nocobase/client": "0.19.0-alpha.2",
|
|
3
|
+
"@nocobase/database": "0.19.0-alpha.2",
|
|
4
|
+
"@nocobase/server": "0.19.0-alpha.2",
|
|
5
|
+
"@nocobase/utils": "0.19.0-alpha.2",
|
|
6
|
+
"@nocobase/actions": "0.19.0-alpha.2"
|
|
7
7
|
};
|
|
@@ -20,11 +20,11 @@ __export(users_exports, {
|
|
|
20
20
|
default: () => users_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(users_exports);
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
var import_database = require("@nocobase/database");
|
|
24
|
+
var users_default = (0, import_database.defineCollection)({
|
|
25
|
+
origin: "@nocobase/plugin-users",
|
|
26
|
+
dumpRules: {
|
|
27
|
+
group: "user"
|
|
28
28
|
},
|
|
29
29
|
name: "users",
|
|
30
30
|
title: '{{t("Users")}}',
|
|
@@ -33,6 +33,7 @@ var users_default = {
|
|
|
33
33
|
createdBy: true,
|
|
34
34
|
updatedBy: true,
|
|
35
35
|
logging: true,
|
|
36
|
+
shared: true,
|
|
36
37
|
fields: [
|
|
37
38
|
{
|
|
38
39
|
name: "id",
|
|
@@ -119,4 +120,4 @@ var users_default = {
|
|
|
119
120
|
defaultValue: {}
|
|
120
121
|
}
|
|
121
122
|
]
|
|
122
|
-
};
|
|
123
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var add_users_phone_constraint_exports = {};
|
|
19
|
+
__export(add_users_phone_constraint_exports, {
|
|
20
|
+
default: () => AddUsersPhoneMigration
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(add_users_phone_constraint_exports);
|
|
23
|
+
var import_database = require("@nocobase/database");
|
|
24
|
+
var import_server = require("@nocobase/server");
|
|
25
|
+
class AddUsersPhoneMigration extends import_server.Migration {
|
|
26
|
+
on = "beforeLoad";
|
|
27
|
+
appVersion = "<0.7.5-alpha.1";
|
|
28
|
+
async up() {
|
|
29
|
+
const collection = this.db.collection({
|
|
30
|
+
name: "users",
|
|
31
|
+
fields: [
|
|
32
|
+
{
|
|
33
|
+
type: "string",
|
|
34
|
+
name: "phone",
|
|
35
|
+
unique: true
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
const tableNameWithSchema = collection.getTableNameWithSchema();
|
|
40
|
+
const field = collection.getField("username");
|
|
41
|
+
await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
|
|
42
|
+
type: import_database.DataTypes.STRING
|
|
43
|
+
});
|
|
44
|
+
await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
|
|
45
|
+
type: "unique",
|
|
46
|
+
fields: [field.columnName()]
|
|
47
|
+
});
|
|
48
|
+
this.db.removeCollection("users");
|
|
49
|
+
}
|
|
50
|
+
async down() {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -22,11 +22,8 @@ __export(add_users_phone_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(add_users_phone_exports);
|
|
23
23
|
var import_server = require("@nocobase/server");
|
|
24
24
|
class AddUsersPhoneMigration extends import_server.Migration {
|
|
25
|
+
appVersion = "<0.7.5-alpha.1";
|
|
25
26
|
async up() {
|
|
26
|
-
const match = await this.app.version.satisfies("<=0.7.4-alpha.7");
|
|
27
|
-
if (!match) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
27
|
const Field = this.context.db.getRepository("fields");
|
|
31
28
|
const existed = await Field.count({
|
|
32
29
|
filter: {
|
|
@@ -49,9 +46,7 @@ class AddUsersPhoneMigration extends import_server.Migration {
|
|
|
49
46
|
"x-validator": "phone",
|
|
50
47
|
require: true
|
|
51
48
|
}
|
|
52
|
-
}
|
|
53
|
-
// NOTE: to trigger hook
|
|
54
|
-
context: {}
|
|
49
|
+
}
|
|
55
50
|
});
|
|
56
51
|
}
|
|
57
52
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var add_username_constraint_exports = {};
|
|
19
|
+
__export(add_username_constraint_exports, {
|
|
20
|
+
default: () => AddUserNameMigration
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(add_username_constraint_exports);
|
|
23
|
+
var import_database = require("@nocobase/database");
|
|
24
|
+
var import_server = require("@nocobase/server");
|
|
25
|
+
class AddUserNameMigration extends import_server.Migration {
|
|
26
|
+
on = "beforeLoad";
|
|
27
|
+
appVersion = "<0.13.0-alpha.1";
|
|
28
|
+
async up() {
|
|
29
|
+
const collection = this.db.collection({
|
|
30
|
+
name: "users",
|
|
31
|
+
fields: [
|
|
32
|
+
{
|
|
33
|
+
type: "string",
|
|
34
|
+
name: "username",
|
|
35
|
+
unique: true
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
const tableNameWithSchema = collection.getTableNameWithSchema();
|
|
40
|
+
const field = collection.getField("username");
|
|
41
|
+
await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
|
|
42
|
+
type: import_database.DataTypes.STRING
|
|
43
|
+
});
|
|
44
|
+
await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
|
|
45
|
+
type: "unique",
|
|
46
|
+
fields: [field.columnName()]
|
|
47
|
+
});
|
|
48
|
+
this.db.removeCollection("users");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -22,11 +22,8 @@ __export(add_username_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(add_username_exports);
|
|
23
23
|
var import_server = require("@nocobase/server");
|
|
24
24
|
class AddUserNameMigration extends import_server.Migration {
|
|
25
|
+
appVersion = "<0.13.0-alpha.1";
|
|
25
26
|
async up() {
|
|
26
|
-
const match = await this.app.version.satisfies("<=0.12.0-alpha.4");
|
|
27
|
-
if (!match) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
27
|
const Field = this.context.db.getRepository("fields");
|
|
31
28
|
const existed = await Field.count({
|
|
32
29
|
filter: {
|
|
@@ -49,12 +46,8 @@ class AddUserNameMigration extends import_server.Migration {
|
|
|
49
46
|
"x-validator": { username: true },
|
|
50
47
|
required: true
|
|
51
48
|
}
|
|
52
|
-
}
|
|
53
|
-
// NOTE: to trigger hook
|
|
54
|
-
context: {}
|
|
49
|
+
}
|
|
55
50
|
});
|
|
56
51
|
}
|
|
57
52
|
}
|
|
58
|
-
async down() {
|
|
59
|
-
}
|
|
60
53
|
}
|
|
@@ -22,11 +22,8 @@ __export(update_username_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(update_username_exports);
|
|
23
23
|
var import_server = require("@nocobase/server");
|
|
24
24
|
class UpdateUserNameMigration extends import_server.Migration {
|
|
25
|
+
appVersion = "<0.13.0-alpha.1";
|
|
25
26
|
async up() {
|
|
26
|
-
const match = await this.app.version.satisfies("<=0.12.0-alpha.4");
|
|
27
|
-
if (!match) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
27
|
const repo = this.context.db.getRepository("users");
|
|
31
28
|
const user = await repo.findOne({
|
|
32
29
|
filter: {
|
|
@@ -22,6 +22,7 @@ __export(update_username_interface_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(update_username_interface_exports);
|
|
23
23
|
var import_server = require("@nocobase/server");
|
|
24
24
|
class UpdateUserNameInterfaceMigration extends import_server.Migration {
|
|
25
|
+
appVersion = "<0.13.0-alpha.10";
|
|
25
26
|
async up() {
|
|
26
27
|
const match = await this.app.version.satisfies("<=0.13.0-alpha.8");
|
|
27
28
|
if (!match) {
|
package/dist/server/server.js
CHANGED
|
@@ -127,9 +127,7 @@ class UsersPlugin extends import_server.Plugin {
|
|
|
127
127
|
loggedInActions.forEach((action) => this.app.acl.allow("users", action, "loggedIn"));
|
|
128
128
|
}
|
|
129
129
|
async load() {
|
|
130
|
-
await this.
|
|
131
|
-
directory: (0, import_path.resolve)(__dirname, "collections")
|
|
132
|
-
});
|
|
130
|
+
await this.importCollections((0, import_path.resolve)(__dirname, "collections"));
|
|
133
131
|
this.db.addMigrations({
|
|
134
132
|
namespace: "users",
|
|
135
133
|
directory: (0, import_path.resolve)(__dirname, "migrations"),
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"displayName.zh-CN": "用户",
|
|
5
5
|
"description": "Provides a basic user model and a password-based user authentication type, and extended the createdBy and updatedBy field types",
|
|
6
6
|
"description.zh-CN": "提供了基础的用户模型和基于密码的用户认证方式,并拓展了创建人和最后更新人字段类型",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.19.0-alpha.2",
|
|
8
8
|
"license": "AGPL-3.0",
|
|
9
9
|
"main": "./dist/server/index.js",
|
|
10
10
|
"devDependencies": {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@nocobase/test": "0.x",
|
|
23
23
|
"@nocobase/utils": "0.x"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "cff5b77ecf12ccdb450d50d505b3aa44a68478c8"
|
|
26
26
|
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|