@fonoster/apiserver 0.4.7 → 0.4.9
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/envs.d.ts +1 -0
- package/dist/envs.js +22 -0
- package/dist/index.js +28 -14
- package/package.json +16 -17
package/dist/envs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const APISERVER_JWT_PRIVATE_KEY: string;
|
package/dist/envs.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APISERVER_JWT_PRIVATE_KEY = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
exports.APISERVER_JWT_PRIVATE_KEY = process.env.APISERVER_JWT_PRIVATE_KEY;
|
package/dist/index.js
CHANGED
|
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
22
22
|
* See the License for the specific language governing permissions and
|
|
23
23
|
* limitations under the License.
|
|
24
24
|
*/
|
|
25
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
26
25
|
const path_1 = require("path");
|
|
26
|
+
const dotenv_1 = __importDefault(require("dotenv"));
|
|
27
27
|
if (process.env.NODE_ENV === "dev") {
|
|
28
28
|
dotenv_1.default.config({ path: (0, path_1.join)(__dirname, "../../../", ".env") });
|
|
29
29
|
}
|
|
@@ -38,8 +38,10 @@ const limiter_1 = require("@fonoster/limiter");
|
|
|
38
38
|
const monitor_1 = require("@fonoster/monitor");
|
|
39
39
|
const users_1 = require("@fonoster/users");
|
|
40
40
|
const projects_1 = require("@fonoster/projects");
|
|
41
|
+
const auth_1 = require("@fonoster/auth");
|
|
41
42
|
const agents_1 = require("@fonoster/agents");
|
|
42
43
|
const common_1 = require("@fonoster/common");
|
|
44
|
+
const envs_1 = require("./envs");
|
|
43
45
|
const services = [
|
|
44
46
|
{
|
|
45
47
|
name: "apps",
|
|
@@ -65,18 +67,12 @@ const services = [
|
|
|
65
67
|
service: projects_1.ProjectsService,
|
|
66
68
|
server: new projects_1.ProjectsServer()
|
|
67
69
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// {
|
|
75
|
-
// name: "funcs",
|
|
76
|
-
// version: "v1beta1",
|
|
77
|
-
// service: FuncsService,
|
|
78
|
-
// server: new FuncsServer()
|
|
79
|
-
// },
|
|
70
|
+
{
|
|
71
|
+
name: "auth",
|
|
72
|
+
version: "v1beta1",
|
|
73
|
+
service: auth_1.AuthService,
|
|
74
|
+
server: new auth_1.AuthServer()
|
|
75
|
+
},
|
|
80
76
|
{
|
|
81
77
|
name: "agents",
|
|
82
78
|
version: "v1beta1",
|
|
@@ -126,4 +122,22 @@ const services = [
|
|
|
126
122
|
server: new limiter_1.LimiterServer()
|
|
127
123
|
}
|
|
128
124
|
];
|
|
129
|
-
|
|
125
|
+
const middlewares = [
|
|
126
|
+
{
|
|
127
|
+
name: "authenticator",
|
|
128
|
+
middlewareObj: new auth_1.AuthMiddleware(envs_1.APISERVER_JWT_PRIVATE_KEY, [
|
|
129
|
+
"/fonoster.auth.v1beta1.Auth/GetRole",
|
|
130
|
+
"/fonoster.users.v1beta1.Users/CreateUser",
|
|
131
|
+
"/fonoster.auth.v1beta1.Users/CreateUserCredentials",
|
|
132
|
+
"/fonoster.auth.v1beta1.Limiter/CheckAuthorized"
|
|
133
|
+
]).middleware
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "limiter",
|
|
137
|
+
middlewareObj: (0, auth_1.createLimiterMiddleware)([
|
|
138
|
+
"/fonoster.auth.v1beta1.Auth/GetRole",
|
|
139
|
+
"/fonoster.auth.v1beta1.Limiter/CheckAuthorized"
|
|
140
|
+
])
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
(0, common_1.runServices)(services, middlewares);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/apiserver",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "Fonoster API Server",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -36,22 +36,21 @@
|
|
|
36
36
|
"url": "https://github.com/fonoster/fonoster/issues"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@fonoster/agents": "^0.4.
|
|
40
|
-
"@fonoster/apps": "^0.4.
|
|
41
|
-
"@fonoster/auth": "^0.4.
|
|
42
|
-
"@fonoster/callmanager": "^0.4.
|
|
43
|
-
"@fonoster/common": "^0.4.
|
|
44
|
-
"@fonoster/domains": "^0.4.
|
|
45
|
-
"@fonoster/
|
|
46
|
-
"@fonoster/
|
|
47
|
-
"@fonoster/
|
|
48
|
-
"@fonoster/
|
|
49
|
-
"@fonoster/
|
|
50
|
-
"@fonoster/
|
|
51
|
-
"@fonoster/
|
|
52
|
-
"@fonoster/
|
|
53
|
-
"@fonoster/users": "^0.4.7",
|
|
39
|
+
"@fonoster/agents": "^0.4.9",
|
|
40
|
+
"@fonoster/apps": "^0.4.9",
|
|
41
|
+
"@fonoster/auth": "^0.4.9",
|
|
42
|
+
"@fonoster/callmanager": "^0.4.9",
|
|
43
|
+
"@fonoster/common": "^0.4.9",
|
|
44
|
+
"@fonoster/domains": "^0.4.9",
|
|
45
|
+
"@fonoster/limiter": "^0.4.9",
|
|
46
|
+
"@fonoster/monitor": "^0.4.9",
|
|
47
|
+
"@fonoster/numbers": "^0.4.9",
|
|
48
|
+
"@fonoster/projects": "^0.4.9",
|
|
49
|
+
"@fonoster/providers": "^0.4.9",
|
|
50
|
+
"@fonoster/secrets": "^0.4.9",
|
|
51
|
+
"@fonoster/storage": "^0.4.9",
|
|
52
|
+
"@fonoster/users": "^0.4.9",
|
|
54
53
|
"dotenv": "^8.2.0"
|
|
55
54
|
},
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "c32b3a14cdffce2e7ef8fd6dc4dfaf237dff23a8"
|
|
57
56
|
}
|