@tachybase/plugin-api-keys 1.3.21 → 1.3.22
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/dist/collections/apiKeys.d.ts +1 -1
- package/dist/externalVersion.js +4 -6
- package/dist/server/actions/api-keys.d.ts +1 -1
- package/dist/server/actions/api-keys.js +5 -15
- package/dist/server/migrations/20250403220209-token-text-type.d.ts +1 -1
- package/dist/server/migrations/20250403220209-token-text-type.js +2 -3
- package/dist/server/migrations/20250626175519-change-token.d.ts +1 -1
- package/dist/server/migrations/20250626175519-change-token.js +2 -3
- package/dist/server/plugin.d.ts +1 -1
- package/dist/server/plugin.js +1 -1
- package/package.json +10 -17
package/dist/externalVersion.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@tachybase/client": "1.3.
|
|
3
|
-
"@
|
|
4
|
-
"@tachybase/server": "1.3.21",
|
|
2
|
+
"@tachybase/client": "1.3.22",
|
|
3
|
+
"@tego/server": "1.3.39",
|
|
5
4
|
"react": "18.3.1",
|
|
6
|
-
"@tachybase/schema": "1.3.
|
|
5
|
+
"@tachybase/schema": "1.3.39",
|
|
7
6
|
"ahooks": "3.9.0",
|
|
8
7
|
"antd": "5.22.5",
|
|
9
8
|
"dayjs": "1.11.13",
|
|
10
|
-
"react-i18next": "15.2.0"
|
|
11
|
-
"@tachybase/actions": "1.3.21"
|
|
9
|
+
"react-i18next": "15.2.0"
|
|
12
10
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
var api_keys_exports = {};
|
|
29
19
|
__export(api_keys_exports, {
|
|
@@ -31,8 +21,8 @@ __export(api_keys_exports, {
|
|
|
31
21
|
destroy: () => destroy
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(api_keys_exports);
|
|
34
|
-
var
|
|
35
|
-
var
|
|
24
|
+
var import_node_crypto = require("node:crypto");
|
|
25
|
+
var import_server = require("@tego/server");
|
|
36
26
|
async function create(ctx, next) {
|
|
37
27
|
const { values } = ctx.action.params;
|
|
38
28
|
if (!values.role) {
|
|
@@ -47,7 +37,7 @@ async function create(ctx, next) {
|
|
|
47
37
|
if (!role) {
|
|
48
38
|
throw ctx.throw(400, ctx.t("Role not found"));
|
|
49
39
|
}
|
|
50
|
-
const hash = (0,
|
|
40
|
+
const hash = (0, import_node_crypto.createHash)("sha256");
|
|
51
41
|
const jwtToken = ctx.app.authManager.jwt.sign(
|
|
52
42
|
{ userId: ctx.auth.user.id, roleName: role.name },
|
|
53
43
|
{ expiresIn: values.expiresIn }
|
|
@@ -60,7 +50,7 @@ async function create(ctx, next) {
|
|
|
60
50
|
accessToken: token
|
|
61
51
|
}
|
|
62
52
|
});
|
|
63
|
-
return
|
|
53
|
+
return import_server.actions.create(ctx, async () => {
|
|
64
54
|
ctx.body = {
|
|
65
55
|
token
|
|
66
56
|
};
|
|
@@ -75,7 +65,7 @@ async function destroy(ctx, next) {
|
|
|
75
65
|
if (token) {
|
|
76
66
|
await ctx.app.authManager.jwt.block(token);
|
|
77
67
|
}
|
|
78
|
-
return
|
|
68
|
+
return import_server.actions.destroy(ctx, next);
|
|
79
69
|
}
|
|
80
70
|
// Annotate the CommonJS export names for ESM import in node:
|
|
81
71
|
0 && (module.exports = {
|
|
@@ -20,8 +20,7 @@ __export(token_text_type_exports, {
|
|
|
20
20
|
default: () => token_text_type_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(token_text_type_exports);
|
|
23
|
-
var
|
|
24
|
-
var import_server = require("@tachybase/server");
|
|
23
|
+
var import_server = require("@tego/server");
|
|
25
24
|
class token_text_type_default extends import_server.Migration {
|
|
26
25
|
constructor() {
|
|
27
26
|
super(...arguments);
|
|
@@ -32,7 +31,7 @@ class token_text_type_default extends import_server.Migration {
|
|
|
32
31
|
async up() {
|
|
33
32
|
const queryInterface = this.db.sequelize.getQueryInterface();
|
|
34
33
|
await queryInterface.changeColumn("apiKeys", "token", {
|
|
35
|
-
type:
|
|
34
|
+
type: import_server.DataTypes.TEXT
|
|
36
35
|
});
|
|
37
36
|
this.app.logger.info("change apiKeys token form string to text success!");
|
|
38
37
|
}
|
|
@@ -20,8 +20,7 @@ __export(change_token_exports, {
|
|
|
20
20
|
default: () => change_token_default
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(change_token_exports);
|
|
23
|
-
var
|
|
24
|
-
var import_server = require("@tachybase/server");
|
|
23
|
+
var import_server = require("@tego/server");
|
|
25
24
|
class change_token_default extends import_server.Migration {
|
|
26
25
|
constructor() {
|
|
27
26
|
super(...arguments);
|
|
@@ -37,7 +36,7 @@ class change_token_default extends import_server.Migration {
|
|
|
37
36
|
}
|
|
38
37
|
const queryInterface = this.db.sequelize.getQueryInterface();
|
|
39
38
|
await queryInterface.changeColumn("apiKeys", "token", {
|
|
40
|
-
type:
|
|
39
|
+
type: import_server.DataTypes.STRING(512)
|
|
41
40
|
});
|
|
42
41
|
this.app.logger.info("apiKeys token change string(512) success!");
|
|
43
42
|
}
|
package/dist/server/plugin.d.ts
CHANGED
package/dist/server/plugin.js
CHANGED
|
@@ -21,7 +21,7 @@ __export(plugin_exports, {
|
|
|
21
21
|
default: () => plugin_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
-
var import_server = require("@
|
|
24
|
+
var import_server = require("@tego/server");
|
|
25
25
|
var import_api_keys = require("./actions/api-keys");
|
|
26
26
|
class PluginAPIKeysServer extends import_server.Plugin {
|
|
27
27
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-api-keys",
|
|
3
3
|
"displayName": "Auth: API keys",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.22",
|
|
5
5
|
"description": "Allows users to use API key to access application's HTTP API",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Authentication"
|
|
@@ -10,26 +10,19 @@
|
|
|
10
10
|
"main": "./dist/server/index.js",
|
|
11
11
|
"dependencies": {},
|
|
12
12
|
"devDependencies": {
|
|
13
|
+
"@tachybase/schema": "^1.3.39",
|
|
14
|
+
"@tachybase/test": "^1.3.39",
|
|
15
|
+
"@tego/client": "^1.3.39",
|
|
16
|
+
"@tego/server": "^1.3.39",
|
|
13
17
|
"ahooks": "^3.9.0",
|
|
14
18
|
"antd": "5.22.5",
|
|
15
19
|
"dayjs": "1.11.13",
|
|
16
|
-
"react": "
|
|
17
|
-
"react-dom": "
|
|
18
|
-
"react-i18next": "
|
|
19
|
-
"@tachybase/
|
|
20
|
-
},
|
|
21
|
-
"peerDependencies": {
|
|
22
|
-
"@tachybase/actions": "1.3.21",
|
|
23
|
-
"@tachybase/database": "1.3.21",
|
|
24
|
-
"@tachybase/client": "1.3.21",
|
|
25
|
-
"@tachybase/resourcer": "1.3.21",
|
|
26
|
-
"@tachybase/server": "1.3.21",
|
|
27
|
-
"@tachybase/test": "1.3.21",
|
|
28
|
-
"@tachybase/utils": "1.3.21"
|
|
20
|
+
"react": "18.3.1",
|
|
21
|
+
"react-dom": "18.3.1",
|
|
22
|
+
"react-i18next": "15.2.0",
|
|
23
|
+
"@tachybase/client": "1.3.22"
|
|
29
24
|
},
|
|
30
25
|
"description.zh-CN": "允许用户使用 API 密钥访问应用的 HTTP API",
|
|
31
26
|
"displayName.zh-CN": "认证:API 密钥",
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tachybase-build --no-dts @tachybase/plugin-api-keys"
|
|
34
|
-
}
|
|
27
|
+
"scripts": {}
|
|
35
28
|
}
|