@flink-app/management-api-plugin 0.12.1-alpha.7 → 0.13.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/.flink/generatedHandlers.ts +1 -1
- package/.flink/generatedJobs.ts +1 -1
- package/.flink/generatedRepos.ts +1 -1
- package/.flink/schemas/schemas.json +0 -151
- package/.flink/schemas/schemas.ts +1 -19
- package/.flink/start.ts +2 -1
- package/CHANGELOG.md +12 -0
- package/dist/.flink/generatedHandlers.js +1 -1
- package/dist/.flink/generatedJobs.js +1 -1
- package/dist/.flink/generatedRepos.js +1 -1
- package/dist/.flink/schemas/schemas.d.ts +0 -18
- package/dist/.flink/schemas/schemas.json +0 -151
- package/dist/.flink/start.d.ts +2 -0
- package/dist/.flink/start.js +2 -1
- package/dist/src/handlers/Management/GetManagement.d.ts +0 -1
- package/dist/src/handlers/Management/GetManagement.js +3 -4
- package/dist/src/handlers/User/DeleteByUserid.js +2 -2
- package/dist/src/handlers/User/GetByUserid.js +2 -2
- package/dist/src/handlers/User/GetList.d.ts +0 -1
- package/dist/src/handlers/User/GetList.js +3 -4
- package/dist/src/handlers/User/GetMe.d.ts +0 -1
- package/dist/src/handlers/User/GetMe.js +3 -4
- package/dist/src/handlers/User/Post.js +2 -2
- package/dist/src/handlers/User/PostLogin.js +2 -2
- package/dist/src/handlers/User/PutByUserid.js +2 -2
- package/dist/src/utils/bcrypt.js +2 -3
- package/package.json +30 -33
- package/readme.md +177 -26
- package/tsconfig.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
|
|
3
3
|
import * as GetManagement_0 from "../src/handlers/Management/GetManagement";
|
|
4
4
|
import * as DeleteByUserid_0 from "../src/handlers/User/DeleteByUserid";
|
package/.flink/generatedJobs.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredJobs } from "@flink-app/flink";
|
|
3
3
|
export const jobs = [];
|
|
4
4
|
autoRegisteredJobs.push(...jobs);
|
package/.flink/generatedRepos.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import { autoRegisteredRepos } from "@flink-app/flink";
|
|
3
3
|
import ManagementUserRepo from "../src/repos/ManagementUserRepo";
|
|
4
4
|
|
|
@@ -2,82 +2,6 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$ref": "#/definitions/Schemas",
|
|
4
4
|
"definitions": {
|
|
5
|
-
"GetManagement_6_ReqSchema": {
|
|
6
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"additionalProperties": false,
|
|
9
|
-
"properties": {},
|
|
10
|
-
"definitions": {}
|
|
11
|
-
},
|
|
12
|
-
"GetManagement_6_ResSchema": {
|
|
13
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
14
|
-
"type": "object",
|
|
15
|
-
"additionalProperties": false,
|
|
16
|
-
"properties": {
|
|
17
|
-
"modules": {
|
|
18
|
-
"type": "array",
|
|
19
|
-
"items": {
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": {
|
|
22
|
-
"id": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
},
|
|
25
|
-
"type": {
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"features": {
|
|
29
|
-
"type": "array",
|
|
30
|
-
"items": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"title": {
|
|
35
|
-
"type": "string"
|
|
36
|
-
},
|
|
37
|
-
"ui": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
},
|
|
40
|
-
"data": {
|
|
41
|
-
"type": "object"
|
|
42
|
-
},
|
|
43
|
-
"endpoints": {
|
|
44
|
-
"type": "array",
|
|
45
|
-
"items": {
|
|
46
|
-
"type": "object",
|
|
47
|
-
"properties": {
|
|
48
|
-
"method": {
|
|
49
|
-
"type": "string"
|
|
50
|
-
},
|
|
51
|
-
"url": {
|
|
52
|
-
"type": "string"
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"required": [
|
|
56
|
-
"method",
|
|
57
|
-
"url"
|
|
58
|
-
],
|
|
59
|
-
"additionalProperties": false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"required": [
|
|
64
|
-
"id",
|
|
65
|
-
"type",
|
|
66
|
-
"features",
|
|
67
|
-
"title",
|
|
68
|
-
"ui",
|
|
69
|
-
"data",
|
|
70
|
-
"endpoints"
|
|
71
|
-
],
|
|
72
|
-
"additionalProperties": false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"required": [
|
|
77
|
-
"modules"
|
|
78
|
-
],
|
|
79
|
-
"definitions": {}
|
|
80
|
-
},
|
|
81
5
|
"DeleteByUserid_15_ReqSchema": {
|
|
82
6
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
83
7
|
"type": "object",
|
|
@@ -117,81 +41,6 @@
|
|
|
117
41
|
],
|
|
118
42
|
"definitions": {}
|
|
119
43
|
},
|
|
120
|
-
"GetList_9_ReqSchema": {
|
|
121
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
122
|
-
"type": "object",
|
|
123
|
-
"additionalProperties": false,
|
|
124
|
-
"properties": {},
|
|
125
|
-
"definitions": {}
|
|
126
|
-
},
|
|
127
|
-
"GetList_9_ResSchema": {
|
|
128
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
129
|
-
"type": "object",
|
|
130
|
-
"additionalProperties": false,
|
|
131
|
-
"properties": {
|
|
132
|
-
"users": {
|
|
133
|
-
"type": "array",
|
|
134
|
-
"items": {
|
|
135
|
-
"type": "object",
|
|
136
|
-
"additionalProperties": false,
|
|
137
|
-
"properties": {
|
|
138
|
-
"_id": {
|
|
139
|
-
"type": "string"
|
|
140
|
-
},
|
|
141
|
-
"username": {
|
|
142
|
-
"type": "string"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
"required": [
|
|
146
|
-
"_id",
|
|
147
|
-
"username"
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"required": [
|
|
153
|
-
"users"
|
|
154
|
-
],
|
|
155
|
-
"definitions": {}
|
|
156
|
-
},
|
|
157
|
-
"GetMe_8_ReqSchema": {
|
|
158
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
159
|
-
"type": "object",
|
|
160
|
-
"additionalProperties": false,
|
|
161
|
-
"properties": {},
|
|
162
|
-
"definitions": {}
|
|
163
|
-
},
|
|
164
|
-
"GetMe_8_ResSchema": {
|
|
165
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
166
|
-
"type": "object",
|
|
167
|
-
"additionalProperties": false,
|
|
168
|
-
"properties": {
|
|
169
|
-
"user": {
|
|
170
|
-
"type": "object",
|
|
171
|
-
"additionalProperties": false,
|
|
172
|
-
"properties": {
|
|
173
|
-
"_id": {
|
|
174
|
-
"type": "string"
|
|
175
|
-
},
|
|
176
|
-
"username": {
|
|
177
|
-
"type": "string"
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"required": [
|
|
181
|
-
"_id",
|
|
182
|
-
"username"
|
|
183
|
-
]
|
|
184
|
-
},
|
|
185
|
-
"token": {
|
|
186
|
-
"type": "string"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"required": [
|
|
190
|
-
"token",
|
|
191
|
-
"user"
|
|
192
|
-
],
|
|
193
|
-
"definitions": {}
|
|
194
|
-
},
|
|
195
44
|
"Post_14_ReqSchema": {
|
|
196
45
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
197
46
|
"type": "object",
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import { GetManagementReq } from "../../src/schemas/Management/GetReq";
|
|
2
|
-
import { GetManagementRes } from "../../src/schemas/Management/GetRes";
|
|
3
1
|
import { DeleteUserByUseridReq } from "../../src/schemas/User/DeleteByUseridReq";
|
|
4
2
|
import { DeleteUserByUseridRes } from "../../src/schemas/User/DeleteByUseridRes";
|
|
5
3
|
import { GetUserByUseridReq } from "../../src/schemas/User/GetByUseridReq";
|
|
6
4
|
import { GetUserByUseridRes } from "../../src/schemas/User/GetByUseridRes";
|
|
7
|
-
import { GetUserListReq } from "../../src/schemas/User/GetListReq";
|
|
8
|
-
import { GetUserListRes } from "../../src/schemas/User/GetListRes";
|
|
9
|
-
import { GetUserMeReq } from "../../src/schemas/User/GetMeReq";
|
|
10
|
-
import { GetUserMeRes } from "../../src/schemas/User/GetMeRes";
|
|
11
5
|
import { PostUserReq } from "../../src/schemas/User/PostReq";
|
|
12
6
|
import { PostUserRes } from "../../src/schemas/User/PostRes";
|
|
13
7
|
import { PostUserLoginReq } from "../../src/schemas/User/PostLoginReq";
|
|
@@ -15,11 +9,7 @@ import { PostUserLoginRes } from "../../src/schemas/User/PostLoginRes";
|
|
|
15
9
|
import { PutUserByUseridReq } from "../../src/schemas/User/PutByUseridReq";
|
|
16
10
|
import { PutUserByUseridRes } from "../../src/schemas/User/PutByUseridRes";
|
|
17
11
|
|
|
18
|
-
// Generated
|
|
19
|
-
export interface GetManagement_6_ReqSchema extends GetManagementReq {}
|
|
20
|
-
|
|
21
|
-
export interface GetManagement_6_ResSchema extends GetManagementRes {}
|
|
22
|
-
|
|
12
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
23
13
|
export interface DeleteByUserid_15_ReqSchema extends DeleteUserByUseridReq {}
|
|
24
14
|
|
|
25
15
|
export interface DeleteByUserid_15_ResSchema extends DeleteUserByUseridRes {}
|
|
@@ -28,14 +18,6 @@ export interface GetByUserid_15_ReqSchema extends GetUserByUseridReq {}
|
|
|
28
18
|
|
|
29
19
|
export interface GetByUserid_15_ResSchema extends GetUserByUseridRes {}
|
|
30
20
|
|
|
31
|
-
export interface GetList_9_ReqSchema extends GetUserListReq {}
|
|
32
|
-
|
|
33
|
-
export interface GetList_9_ResSchema extends GetUserListRes {}
|
|
34
|
-
|
|
35
|
-
export interface GetMe_8_ReqSchema extends GetUserMeReq {}
|
|
36
|
-
|
|
37
|
-
export interface GetMe_8_ResSchema extends GetUserMeRes {}
|
|
38
|
-
|
|
39
21
|
export interface Post_14_ReqSchema extends PostUserReq {}
|
|
40
22
|
|
|
41
23
|
export interface Post_14_ResSchema extends PostUserRes {}
|
package/.flink/start.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
2
2
|
import "./generatedHandlers";
|
|
3
3
|
import "./generatedRepos";
|
|
4
4
|
import "./generatedJobs";
|
|
5
5
|
import "../src/index";
|
|
6
|
+
export default {}; // Export an empty object to make it a module
|
package/CHANGELOG.md
ADDED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.handlers = void 0;
|
|
27
|
-
// Generated
|
|
27
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
28
28
|
var flink_1 = require("@flink-app/flink");
|
|
29
29
|
var DeleteByUserid_0 = __importStar(require("../src/handlers/User/DeleteByUserid"));
|
|
30
30
|
var GetByUserid_1 = __importStar(require("../src/handlers/User/GetByUserid"));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.jobs = void 0;
|
|
4
|
-
// Generated
|
|
4
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.jobs = [];
|
|
7
7
|
flink_1.autoRegisteredJobs.push.apply(flink_1.autoRegisteredJobs, exports.jobs);
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.repos = void 0;
|
|
7
|
-
// Generated
|
|
7
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
8
8
|
var flink_1 = require("@flink-app/flink");
|
|
9
9
|
var ManagementUserRepo_1 = __importDefault(require("../src/repos/ManagementUserRepo"));
|
|
10
10
|
exports.repos = [{ collectionName: "managementuser", repoInstanceName: "managementUserRepo", Repo: ManagementUserRepo_1.default }];
|
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
import { GetManagementReq } from "../../src/schemas/Management/GetReq";
|
|
2
|
-
import { GetManagementRes } from "../../src/schemas/Management/GetRes";
|
|
3
1
|
import { DeleteUserByUseridReq } from "../../src/schemas/User/DeleteByUseridReq";
|
|
4
2
|
import { DeleteUserByUseridRes } from "../../src/schemas/User/DeleteByUseridRes";
|
|
5
3
|
import { GetUserByUseridReq } from "../../src/schemas/User/GetByUseridReq";
|
|
6
4
|
import { GetUserByUseridRes } from "../../src/schemas/User/GetByUseridRes";
|
|
7
|
-
import { GetUserListReq } from "../../src/schemas/User/GetListReq";
|
|
8
|
-
import { GetUserListRes } from "../../src/schemas/User/GetListRes";
|
|
9
|
-
import { GetUserMeReq } from "../../src/schemas/User/GetMeReq";
|
|
10
|
-
import { GetUserMeRes } from "../../src/schemas/User/GetMeRes";
|
|
11
5
|
import { PostUserReq } from "../../src/schemas/User/PostReq";
|
|
12
6
|
import { PostUserRes } from "../../src/schemas/User/PostRes";
|
|
13
7
|
import { PostUserLoginReq } from "../../src/schemas/User/PostLoginReq";
|
|
14
8
|
import { PostUserLoginRes } from "../../src/schemas/User/PostLoginRes";
|
|
15
9
|
import { PutUserByUseridReq } from "../../src/schemas/User/PutByUseridReq";
|
|
16
10
|
import { PutUserByUseridRes } from "../../src/schemas/User/PutByUseridRes";
|
|
17
|
-
export interface GetManagement_6_ReqSchema extends GetManagementReq {
|
|
18
|
-
}
|
|
19
|
-
export interface GetManagement_6_ResSchema extends GetManagementRes {
|
|
20
|
-
}
|
|
21
11
|
export interface DeleteByUserid_15_ReqSchema extends DeleteUserByUseridReq {
|
|
22
12
|
}
|
|
23
13
|
export interface DeleteByUserid_15_ResSchema extends DeleteUserByUseridRes {
|
|
@@ -26,14 +16,6 @@ export interface GetByUserid_15_ReqSchema extends GetUserByUseridReq {
|
|
|
26
16
|
}
|
|
27
17
|
export interface GetByUserid_15_ResSchema extends GetUserByUseridRes {
|
|
28
18
|
}
|
|
29
|
-
export interface GetList_9_ReqSchema extends GetUserListReq {
|
|
30
|
-
}
|
|
31
|
-
export interface GetList_9_ResSchema extends GetUserListRes {
|
|
32
|
-
}
|
|
33
|
-
export interface GetMe_8_ReqSchema extends GetUserMeReq {
|
|
34
|
-
}
|
|
35
|
-
export interface GetMe_8_ResSchema extends GetUserMeRes {
|
|
36
|
-
}
|
|
37
19
|
export interface Post_14_ReqSchema extends PostUserReq {
|
|
38
20
|
}
|
|
39
21
|
export interface Post_14_ResSchema extends PostUserRes {
|
|
@@ -2,82 +2,6 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"$ref": "#/definitions/Schemas",
|
|
4
4
|
"definitions": {
|
|
5
|
-
"GetManagement_6_ReqSchema": {
|
|
6
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"additionalProperties": false,
|
|
9
|
-
"properties": {},
|
|
10
|
-
"definitions": {}
|
|
11
|
-
},
|
|
12
|
-
"GetManagement_6_ResSchema": {
|
|
13
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
14
|
-
"type": "object",
|
|
15
|
-
"additionalProperties": false,
|
|
16
|
-
"properties": {
|
|
17
|
-
"modules": {
|
|
18
|
-
"type": "array",
|
|
19
|
-
"items": {
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": {
|
|
22
|
-
"id": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
},
|
|
25
|
-
"type": {
|
|
26
|
-
"type": "string"
|
|
27
|
-
},
|
|
28
|
-
"features": {
|
|
29
|
-
"type": "array",
|
|
30
|
-
"items": {
|
|
31
|
-
"type": "string"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"title": {
|
|
35
|
-
"type": "string"
|
|
36
|
-
},
|
|
37
|
-
"ui": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
},
|
|
40
|
-
"data": {
|
|
41
|
-
"type": "object"
|
|
42
|
-
},
|
|
43
|
-
"endpoints": {
|
|
44
|
-
"type": "array",
|
|
45
|
-
"items": {
|
|
46
|
-
"type": "object",
|
|
47
|
-
"properties": {
|
|
48
|
-
"method": {
|
|
49
|
-
"type": "string"
|
|
50
|
-
},
|
|
51
|
-
"url": {
|
|
52
|
-
"type": "string"
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"required": [
|
|
56
|
-
"method",
|
|
57
|
-
"url"
|
|
58
|
-
],
|
|
59
|
-
"additionalProperties": false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"required": [
|
|
64
|
-
"id",
|
|
65
|
-
"type",
|
|
66
|
-
"features",
|
|
67
|
-
"title",
|
|
68
|
-
"ui",
|
|
69
|
-
"data",
|
|
70
|
-
"endpoints"
|
|
71
|
-
],
|
|
72
|
-
"additionalProperties": false
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"required": [
|
|
77
|
-
"modules"
|
|
78
|
-
],
|
|
79
|
-
"definitions": {}
|
|
80
|
-
},
|
|
81
5
|
"DeleteByUserid_15_ReqSchema": {
|
|
82
6
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
83
7
|
"type": "object",
|
|
@@ -117,81 +41,6 @@
|
|
|
117
41
|
],
|
|
118
42
|
"definitions": {}
|
|
119
43
|
},
|
|
120
|
-
"GetList_9_ReqSchema": {
|
|
121
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
122
|
-
"type": "object",
|
|
123
|
-
"additionalProperties": false,
|
|
124
|
-
"properties": {},
|
|
125
|
-
"definitions": {}
|
|
126
|
-
},
|
|
127
|
-
"GetList_9_ResSchema": {
|
|
128
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
129
|
-
"type": "object",
|
|
130
|
-
"additionalProperties": false,
|
|
131
|
-
"properties": {
|
|
132
|
-
"users": {
|
|
133
|
-
"type": "array",
|
|
134
|
-
"items": {
|
|
135
|
-
"type": "object",
|
|
136
|
-
"additionalProperties": false,
|
|
137
|
-
"properties": {
|
|
138
|
-
"_id": {
|
|
139
|
-
"type": "string"
|
|
140
|
-
},
|
|
141
|
-
"username": {
|
|
142
|
-
"type": "string"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
"required": [
|
|
146
|
-
"_id",
|
|
147
|
-
"username"
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"required": [
|
|
153
|
-
"users"
|
|
154
|
-
],
|
|
155
|
-
"definitions": {}
|
|
156
|
-
},
|
|
157
|
-
"GetMe_8_ReqSchema": {
|
|
158
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
159
|
-
"type": "object",
|
|
160
|
-
"additionalProperties": false,
|
|
161
|
-
"properties": {},
|
|
162
|
-
"definitions": {}
|
|
163
|
-
},
|
|
164
|
-
"GetMe_8_ResSchema": {
|
|
165
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
166
|
-
"type": "object",
|
|
167
|
-
"additionalProperties": false,
|
|
168
|
-
"properties": {
|
|
169
|
-
"user": {
|
|
170
|
-
"type": "object",
|
|
171
|
-
"additionalProperties": false,
|
|
172
|
-
"properties": {
|
|
173
|
-
"_id": {
|
|
174
|
-
"type": "string"
|
|
175
|
-
},
|
|
176
|
-
"username": {
|
|
177
|
-
"type": "string"
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"required": [
|
|
181
|
-
"_id",
|
|
182
|
-
"username"
|
|
183
|
-
]
|
|
184
|
-
},
|
|
185
|
-
"token": {
|
|
186
|
-
"type": "string"
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
"required": [
|
|
190
|
-
"token",
|
|
191
|
-
"user"
|
|
192
|
-
],
|
|
193
|
-
"definitions": {}
|
|
194
|
-
},
|
|
195
44
|
"Post_14_ReqSchema": {
|
|
196
45
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
197
46
|
"type": "object",
|
package/dist/.flink/start.d.ts
CHANGED
package/dist/.flink/start.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Generated
|
|
3
|
+
// Generated Fri Jan 09 2026 11:18:28 GMT+0100 (Central European Standard Time)
|
|
4
4
|
require("./generatedHandlers");
|
|
5
5
|
require("./generatedRepos");
|
|
6
6
|
require("./generatedJobs");
|
|
7
7
|
require("../src/index");
|
|
8
|
+
exports.default = {}; // Export an empty object to make it a module
|
|
@@ -5,4 +5,3 @@ import { GetManagementRes } from "../../schemas/Management/GetRes";
|
|
|
5
5
|
declare const GetManagement: Handler<Ctx, GetManagementReq, GetManagementRes>;
|
|
6
6
|
export default GetManagement;
|
|
7
7
|
export declare const __assumedHttpMethod = "get", __file = "GetManagement.ts", __query: never[], __params: never[];
|
|
8
|
-
export declare const __schemas: any;
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
40
|
var GetManagement = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
41
41
|
var ctx = _b.ctx, req = _b.req;
|
|
42
42
|
return __generator(this, function (_c) {
|
|
@@ -48,4 +48,3 @@ var GetManagement = function (_a) { return __awaiter(void 0, [_a], void 0, funct
|
|
|
48
48
|
}); };
|
|
49
49
|
exports.default = GetManagement;
|
|
50
50
|
exports.__assumedHttpMethod = "get", exports.__file = "GetManagement.ts", exports.__query = [], exports.__params = [];
|
|
51
|
-
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "modules": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "features": { "type": "array", "items": { "type": "string" } }, "title": { "type": "string" }, "ui": { "type": "string" }, "data": { "type": "object" }, "endpoints": { "type": "array", "items": { "type": "object", "properties": { "method": { "type": "string" }, "url": { "type": "string" } }, "required": ["method", "url"], "additionalProperties": false } } }, "required": ["id", "type", "features", "title", "ui", "data", "endpoints"], "additionalProperties": false } } }, "required": ["modules"], "definitions": {} } };
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -6,4 +6,3 @@ type Params = {};
|
|
|
6
6
|
declare const GetUserList: Handler<Ctx, GetUserListReq, GetUserListRes, Params>;
|
|
7
7
|
export default GetUserList;
|
|
8
8
|
export declare const __assumedHttpMethod = "get", __file = "GetList.ts", __query: never[], __params: never[];
|
|
9
|
-
export declare const __schemas: any;
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
40
|
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
41
41
|
var GetUserList = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
42
42
|
var repo, users;
|
|
@@ -59,4 +59,3 @@ var GetUserList = function (_a) { return __awaiter(void 0, [_a], void 0, functio
|
|
|
59
59
|
}); };
|
|
60
60
|
exports.default = GetUserList;
|
|
61
61
|
exports.__assumedHttpMethod = "get", exports.__file = "GetList.ts", exports.__query = [], exports.__params = [];
|
|
62
|
-
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "users": { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] } } }, "required": ["users"], "definitions": {} } };
|
|
@@ -5,4 +5,3 @@ import { GetUserMeRes } from "../../schemas/User/GetMeRes";
|
|
|
5
5
|
declare const GetUserMe: Handler<Ctx, GetUserMeReq, GetUserMeRes>;
|
|
6
6
|
export default GetUserMe;
|
|
7
7
|
export declare const __assumedHttpMethod = "get", __file = "GetMe.ts", __query: never[], __params: never[];
|
|
8
|
-
export declare const __schemas: any;
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -50,7 +50,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
53
|
+
exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
54
54
|
var flink_1 = require("@flink-app/flink");
|
|
55
55
|
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
56
56
|
var GetUserMe = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
@@ -76,4 +76,3 @@ var GetUserMe = function (_a) { return __awaiter(void 0, [_a], void 0, function
|
|
|
76
76
|
}); };
|
|
77
77
|
exports.default = GetUserMe;
|
|
78
78
|
exports.__assumedHttpMethod = "get", exports.__file = "GetMe.ts", exports.__query = [], exports.__params = [];
|
|
79
|
-
exports.__schemas = { reqSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": {}, "definitions": {} }, resSchema: { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": false, "properties": { "user": { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] }, "token": { "type": "string" } }, "required": ["token", "user"], "definitions": {} } };
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g =
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
package/dist/src/utils/bcrypt.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.encrypt = encrypt;
|
|
7
|
+
exports.genSalt = genSalt;
|
|
7
8
|
var bcrypt_1 = __importDefault(require("bcrypt"));
|
|
8
9
|
function encrypt(password, salt) {
|
|
9
10
|
return new Promise(function (resolve, reject) {
|
|
@@ -14,7 +15,6 @@ function encrypt(password, salt) {
|
|
|
14
15
|
});
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
|
-
exports.encrypt = encrypt;
|
|
18
18
|
function genSalt(rounds) {
|
|
19
19
|
if (rounds === void 0) { rounds = 10; }
|
|
20
20
|
return new Promise(function (resolve, reject) {
|
|
@@ -25,4 +25,3 @@ function genSalt(rounds) {
|
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
exports.genSalt = genSalt;
|
package/package.json
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
"gitHead": "cd86dec5f9b3bf23c01374a729bb02d8a48c2869"
|
|
34
|
-
}
|
|
2
|
+
"name": "@flink-app/management-api-plugin",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "Flink plugin that makes it possible to expose management api:s for other plugins",
|
|
5
|
+
"author": "johan@frost.se",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"types": "dist/src/index.d.ts",
|
|
11
|
+
"main": "dist/src/index.js",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"bcrypt": "^5.0.1",
|
|
14
|
+
"jsonwebtoken": "^8.5.1",
|
|
15
|
+
"@flink-app/flink": "0.13.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/bcrypt": "^5.0.0",
|
|
19
|
+
"@types/express-fileupload": "^1.1.7",
|
|
20
|
+
"@types/jsonwebtoken": "^8.5.4",
|
|
21
|
+
"@types/node": "22.13.10",
|
|
22
|
+
"ts-node": "^10.9.2"
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "4243e3b3cd6d4e1ca001a61baa8436bf2bbe4113",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "echo \"Error: no test specified\"",
|
|
27
|
+
"build": "flink build",
|
|
28
|
+
"watch": "nodemon --exec \"flink build\"",
|
|
29
|
+
"clean": "rimraf dist .flink"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,51 +1,202 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @flink-app/management-api-plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Flink plugin that provides a secure management API system with built-in user authentication and module registration. This plugin enables other plugins to expose their own management endpoints through a centralized API.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Built-in user management system with authentication
|
|
8
|
+
- JWT-based token authentication
|
|
9
|
+
- Module-based architecture for extensibility
|
|
10
|
+
- Token or JWT authentication for all endpoints
|
|
11
|
+
- Automatic endpoint registration for modules
|
|
12
|
+
- MongoDB-backed user storage
|
|
13
|
+
- Password hashing with bcrypt
|
|
8
14
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
Install plugin to your flink app project:
|
|
15
|
+
## Installation
|
|
12
16
|
|
|
13
|
-
```
|
|
14
|
-
npm
|
|
17
|
+
```bash
|
|
18
|
+
npm install @flink-app/management-api-plugin
|
|
15
19
|
```
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
## Usage
|
|
18
22
|
|
|
19
|
-
|
|
20
|
-
import { managementApiPlugin } from "@flink-app/management-api-plugin";
|
|
23
|
+
### Basic Setup
|
|
21
24
|
|
|
25
|
+
```typescript
|
|
26
|
+
import { FlinkApp } from "@flink-app/flink";
|
|
27
|
+
import { managementApiPlugin } from "@flink-app/management-api-plugin";
|
|
22
28
|
|
|
23
29
|
function start() {
|
|
24
30
|
new FlinkApp<AppContext>({
|
|
25
31
|
name: "My app",
|
|
26
32
|
plugins: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
managementApiPlugin({
|
|
34
|
+
token: "SECRET_TOKEN_USED_TO_COMMUNICATE_WITH_THE_API",
|
|
35
|
+
jwtSecret: "JWT_SECRET_USED_TO_GENERATE_LOGGED_IN_TOKENS",
|
|
36
|
+
modules: [],
|
|
37
|
+
baseUrl: "/managementapi", // optional, defaults to /managementapi
|
|
38
|
+
}),
|
|
33
39
|
],
|
|
34
40
|
}).start();
|
|
35
41
|
}
|
|
36
42
|
```
|
|
37
43
|
|
|
38
|
-
##
|
|
44
|
+
## Configuration Options
|
|
45
|
+
|
|
46
|
+
- `token` (required): Master token for initial authentication and user creation
|
|
47
|
+
- `jwtSecret` (required): Secret key for JWT token generation and verification
|
|
48
|
+
- `modules` (required): Array of management API modules to register
|
|
49
|
+
- `baseUrl` (optional): Base URL for all management API endpoints (defaults to `/managementapi`)
|
|
50
|
+
|
|
51
|
+
## Authentication
|
|
52
|
+
|
|
53
|
+
The management API supports two authentication methods:
|
|
54
|
+
|
|
55
|
+
1. **Master Token**: Use the `token` specified during plugin initialization
|
|
56
|
+
2. **JWT Token**: Login with a management user to receive a JWT token
|
|
57
|
+
|
|
58
|
+
All requests (except login) must include one of these tokens in the `management-token` header.
|
|
59
|
+
|
|
60
|
+
## Built-in User Management
|
|
39
61
|
|
|
40
|
-
|
|
62
|
+
The plugin includes a complete user management system:
|
|
41
63
|
|
|
42
|
-
|
|
64
|
+
### Endpoints
|
|
43
65
|
|
|
44
|
-
|
|
66
|
+
- `POST /managementapi/managementapiuser` - Create new user
|
|
67
|
+
- `POST /managementapi/managementapiuser/login` - Login and receive JWT token
|
|
68
|
+
- `GET /managementapi/managementapiuser` - List all users
|
|
69
|
+
- `GET /managementapi/managementapiuser/me` - Get current user info
|
|
70
|
+
- `GET /managementapi/managementapiuser/:userid` - Get user by ID
|
|
71
|
+
- `PUT /managementapi/managementapiuser/:userid` - Update user
|
|
72
|
+
- `DELETE /managementapi/managementapiuser/:userid` - Delete user
|
|
45
73
|
|
|
74
|
+
### Creating Your First User
|
|
75
|
+
|
|
76
|
+
To create the initial management user, make a POST request with the master token:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
curl 'https://YOUR-API-URL/managementapi/managementapiuser' \
|
|
80
|
+
-H 'management-token: SECRET_TOKEN_USED_TO_COMMUNICATE_WITH_THE_API' \
|
|
81
|
+
-H 'Content-Type: application/json' \
|
|
82
|
+
--data-raw '{"username":"admin","password":"secure_password"}'
|
|
46
83
|
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
84
|
+
|
|
85
|
+
### Logging In
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
curl 'https://YOUR-API-URL/managementapi/managementapiuser/login' \
|
|
89
|
+
-H 'Content-Type: application/json' \
|
|
90
|
+
--data-raw '{"username":"admin","password":"secure_password"}'
|
|
51
91
|
```
|
|
92
|
+
|
|
93
|
+
This returns a JWT token that can be used in the `management-token` header for subsequent requests.
|
|
94
|
+
|
|
95
|
+
## Creating Management Modules
|
|
96
|
+
|
|
97
|
+
Other plugins can create management modules that get registered with this plugin:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { ManagementApiModule, ManagementApiType } from "@flink-app/management-api-plugin";
|
|
101
|
+
import { HttpMethod } from "@flink-app/flink";
|
|
102
|
+
|
|
103
|
+
const myModule: ManagementApiModule = {
|
|
104
|
+
id: "my-module",
|
|
105
|
+
type: ManagementApiType.custom, // or other types
|
|
106
|
+
ui: true,
|
|
107
|
+
uiSettings: {
|
|
108
|
+
title: "My Module",
|
|
109
|
+
icon: "",
|
|
110
|
+
features: [],
|
|
111
|
+
},
|
|
112
|
+
endpoints: [
|
|
113
|
+
{
|
|
114
|
+
handler: myHandler,
|
|
115
|
+
routeProps: {
|
|
116
|
+
method: HttpMethod.get,
|
|
117
|
+
path: "/list",
|
|
118
|
+
docs: "List all items",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
data: {},
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Register with management API plugin
|
|
126
|
+
managementApiPlugin({
|
|
127
|
+
token: "...",
|
|
128
|
+
jwtSecret: "...",
|
|
129
|
+
modules: [myModule],
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Module Types
|
|
134
|
+
|
|
135
|
+
The plugin supports different module types via `ManagementApiType`:
|
|
136
|
+
|
|
137
|
+
- `managementUser` - User management (built-in)
|
|
138
|
+
- `action` - Action modules (used by management-actions-plugin)
|
|
139
|
+
- Custom types can be defined
|
|
140
|
+
|
|
141
|
+
## API Endpoints
|
|
142
|
+
|
|
143
|
+
### Get Management API Info
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
GET /managementapi
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Returns information about all registered modules and their configuration.
|
|
150
|
+
|
|
151
|
+
## TypeScript Support
|
|
152
|
+
|
|
153
|
+
The plugin includes full TypeScript definitions. To use the plugin context in your application:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { managementApiPluginContext } from "@flink-app/management-api-plugin";
|
|
157
|
+
|
|
158
|
+
interface MyContext extends FlinkContext<managementApiPluginContext> {
|
|
159
|
+
// your context
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Database Requirements
|
|
164
|
+
|
|
165
|
+
This plugin requires MongoDB to be configured in your Flink app for user management. The plugin automatically creates a `ManagementUserRepo` repository.
|
|
166
|
+
|
|
167
|
+
## Security Notes
|
|
168
|
+
|
|
169
|
+
- Always use strong, unique values for `token` and `jwtSecret`
|
|
170
|
+
- Store secrets in environment variables, never commit them to source control
|
|
171
|
+
- The master token provides full access - protect it carefully
|
|
172
|
+
- User passwords are automatically hashed using bcrypt
|
|
173
|
+
- The login endpoint is the only endpoint that doesn't require authentication
|
|
174
|
+
|
|
175
|
+
## Example Integration with Management Actions Plugin
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import { managementApiPlugin } from "@flink-app/management-api-plugin";
|
|
179
|
+
import { GetManagementModule } from "@flink-app/management-actions-plugin";
|
|
180
|
+
|
|
181
|
+
const actionsModule = GetManagementModule({
|
|
182
|
+
ui: true,
|
|
183
|
+
uiSettings: { title: "Actions" },
|
|
184
|
+
actions: [
|
|
185
|
+
// your actions
|
|
186
|
+
],
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
new FlinkApp<AppContext>({
|
|
190
|
+
plugins: [
|
|
191
|
+
managementApiPlugin({
|
|
192
|
+
token: process.env.MANAGEMENT_TOKEN!,
|
|
193
|
+
jwtSecret: process.env.JWT_SECRET!,
|
|
194
|
+
modules: [actionsModule],
|
|
195
|
+
}),
|
|
196
|
+
],
|
|
197
|
+
}).start();
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|