@flink-app/stripe-plugin 0.3.0 → 0.3.7
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/generatedRepos.ts +1 -1
- package/.flink/schemas/schemas.ts +1 -1
- package/.flink/start.ts +1 -1
- package/LICENSE +21 -0
- package/dist/.flink/generatedHandlers.js +1 -1
- package/dist/.flink/generatedRepos.js +1 -1
- package/dist/.flink/schemas/schemas.js +1 -1
- package/dist/.flink/start.js +1 -1
- package/package.json +3 -3
- package/dist/src/handlers/Management/Get.d.ts +0 -7
- package/dist/src/handlers/Management/Get.js +0 -53
- package/dist/src/handlers/Management/GetManagement.d.ts +0 -8
- package/dist/src/handlers/Management/GetManagement.js +0 -53
- package/dist/src/handlers/User/DeleteByUserid.d.ts +0 -9
- package/dist/src/handlers/User/DeleteByUserid.js +0 -70
- package/dist/src/handlers/User/GetByUserid.d.ts +0 -9
- package/dist/src/handlers/User/GetByUserid.js +0 -71
- package/dist/src/handlers/User/GetList.d.ts +0 -9
- package/dist/src/handlers/User/GetList.js +0 -64
- package/dist/src/handlers/User/GetMe.d.ts +0 -8
- package/dist/src/handlers/User/GetMe.js +0 -81
- package/dist/src/handlers/User/Post.d.ts +0 -10
- package/dist/src/handlers/User/Post.js +0 -87
- package/dist/src/handlers/User/PostLogin.d.ts +0 -10
- package/dist/src/handlers/User/PostLogin.js +0 -86
- package/dist/src/handlers/User/PutByUserid.d.ts +0 -9
- package/dist/src/handlers/User/PutByUserid.js +0 -97
- package/dist/src/managementApiContext.d.ts +0 -7
- package/dist/src/managementApiContext.js +0 -2
- package/dist/src/models/ManagementApi.d.ts +0 -28
- package/dist/src/models/ManagementApi.js +0 -8
- package/dist/src/repos/ConnectSessionRepo.d.ts +0 -5
- package/dist/src/repos/ConnectSessionRepo.js +0 -26
- package/dist/src/repos/ManagementUserRepo.d.ts +0 -5
- package/dist/src/repos/ManagementUserRepo.js +0 -26
- package/dist/src/schemas/Management/GetReq.d.ts +0 -2
- package/dist/src/schemas/Management/GetReq.js +0 -2
- package/dist/src/schemas/Management/GetRes.d.ts +0 -3
- package/dist/src/schemas/Management/GetRes.js +0 -2
- package/dist/src/schemas/ManagementUser.d.ts +0 -6
- package/dist/src/schemas/ManagementUser.js +0 -2
- package/dist/src/schemas/ManagementUserViewModel.d.ts +0 -4
- package/dist/src/schemas/ManagementUserViewModel.js +0 -19
- package/dist/src/schemas/ModuleList.d.ts +0 -18
- package/dist/src/schemas/ModuleList.js +0 -2
- package/dist/src/schemas/User/DeleteByUseridReq.d.ts +0 -2
- package/dist/src/schemas/User/DeleteByUseridReq.js +0 -2
- package/dist/src/schemas/User/DeleteByUseridRes.d.ts +0 -2
- package/dist/src/schemas/User/DeleteByUseridRes.js +0 -2
- package/dist/src/schemas/User/GetByUseridReq.d.ts +0 -2
- package/dist/src/schemas/User/GetByUseridReq.js +0 -2
- package/dist/src/schemas/User/GetByUseridRes.d.ts +0 -3
- package/dist/src/schemas/User/GetByUseridRes.js +0 -2
- package/dist/src/schemas/User/GetListReq.d.ts +0 -2
- package/dist/src/schemas/User/GetListReq.js +0 -2
- package/dist/src/schemas/User/GetListRes.d.ts +0 -4
- package/dist/src/schemas/User/GetListRes.js +0 -2
- package/dist/src/schemas/User/GetMeReq.d.ts +0 -2
- package/dist/src/schemas/User/GetMeReq.js +0 -2
- package/dist/src/schemas/User/GetMeRes.d.ts +0 -3
- package/dist/src/schemas/User/GetMeRes.js +0 -2
- package/dist/src/schemas/User/PostLoginReq.d.ts +0 -4
- package/dist/src/schemas/User/PostLoginReq.js +0 -2
- package/dist/src/schemas/User/PostLoginRes.d.ts +0 -5
- package/dist/src/schemas/User/PostLoginRes.js +0 -2
- package/dist/src/schemas/User/PostReq.d.ts +0 -3
- package/dist/src/schemas/User/PostReq.js +0 -2
- package/dist/src/schemas/User/PostRes.d.ts +0 -3
- package/dist/src/schemas/User/PostRes.js +0 -2
- package/dist/src/schemas/User/PutByUseridReq.d.ts +0 -3
- package/dist/src/schemas/User/PutByUseridReq.js +0 -2
- package/dist/src/schemas/User/PutByUseridRes.d.ts +0 -3
- package/dist/src/schemas/User/PutByUseridRes.js +0 -2
- package/dist/src/stripePlguinContext.d.ts +0 -5
- package/dist/src/stripePlguinContext.js +0 -2
- package/dist/src/utils/bcrypt.d.ts +0 -2
- package/dist/src/utils/bcrypt.js +0 -28
|
@@ -1,87 +0,0 @@
|
|
|
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());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
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 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.Route = void 0;
|
|
40
|
-
var flink_1 = require("@flink-app/flink");
|
|
41
|
-
var bcrypt_1 = require("../../utils/bcrypt");
|
|
42
|
-
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
43
|
-
exports.Route = {
|
|
44
|
-
path: "/user",
|
|
45
|
-
method: flink_1.HttpMethod.post,
|
|
46
|
-
};
|
|
47
|
-
var PostUser = function (_a) {
|
|
48
|
-
var ctx = _a.ctx, req = _a.req;
|
|
49
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
-
var existingUser, salt, hash, obj, user;
|
|
51
|
-
return __generator(this, function (_b) {
|
|
52
|
-
switch (_b.label) {
|
|
53
|
-
case 0:
|
|
54
|
-
if (req.body.username.length == 0 || req.body.password.length == 0) {
|
|
55
|
-
return [2 /*return*/, flink_1.badRequest("Username and password must be specified")];
|
|
56
|
-
}
|
|
57
|
-
return [4 /*yield*/, ctx.repos.managementuserRepo.getOne({ username: req.body.username })];
|
|
58
|
-
case 1:
|
|
59
|
-
existingUser = _b.sent();
|
|
60
|
-
if (existingUser != null) {
|
|
61
|
-
return [2 /*return*/, flink_1.conflict("Username already taken")];
|
|
62
|
-
}
|
|
63
|
-
return [4 /*yield*/, bcrypt_1.genSalt(10)];
|
|
64
|
-
case 2:
|
|
65
|
-
salt = _b.sent();
|
|
66
|
-
return [4 /*yield*/, bcrypt_1.encrypt(req.body.password, salt)];
|
|
67
|
-
case 3:
|
|
68
|
-
hash = _b.sent();
|
|
69
|
-
obj = {
|
|
70
|
-
username: req.body.username,
|
|
71
|
-
password: hash,
|
|
72
|
-
salt: salt
|
|
73
|
-
};
|
|
74
|
-
return [4 /*yield*/, ctx.repos.managementuserRepo.create(obj)];
|
|
75
|
-
case 4:
|
|
76
|
-
user = _b.sent();
|
|
77
|
-
return [2 /*return*/, {
|
|
78
|
-
data: ManagementUserViewModel_1.GetManagementUserViewModel(user),
|
|
79
|
-
status: 200
|
|
80
|
-
}];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
exports.default = PostUser;
|
|
86
|
-
exports.__assumedHttpMethod = "post", exports.__file = "Post.ts", exports.__query = [], exports.__params = [];
|
|
87
|
-
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": { "username": { "type": "string" }, "password": { "type": "string" } }, "required": ["password", "username"] }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] } };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Handler, RouteProps } from "@flink-app/flink";
|
|
2
|
-
import { Ctx } from "../../Ctx";
|
|
3
|
-
import { PostUserLoginReq } from "../../schemas/User/PostLoginReq";
|
|
4
|
-
import { PostUserLoginRes } from "../../schemas/User/PostLoginRes";
|
|
5
|
-
export declare const Route: RouteProps;
|
|
6
|
-
declare type Params = {};
|
|
7
|
-
declare const PostUserLogin: Handler<Ctx, PostUserLoginReq, PostUserLoginRes, Params>;
|
|
8
|
-
export default PostUserLogin;
|
|
9
|
-
export declare const __assumedHttpMethod = "post", __file = "PostLogin.ts", __query: never[], __params: never[];
|
|
10
|
-
export declare const __schemas: any;
|
|
@@ -1,86 +0,0 @@
|
|
|
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());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
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 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.Route = void 0;
|
|
43
|
-
var flink_1 = require("@flink-app/flink");
|
|
44
|
-
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
45
|
-
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
46
|
-
var bcrypt_1 = require("../../utils/bcrypt");
|
|
47
|
-
exports.Route = {
|
|
48
|
-
path: "/user/login",
|
|
49
|
-
method: flink_1.HttpMethod.post,
|
|
50
|
-
};
|
|
51
|
-
var PostUserLogin = function (_a) {
|
|
52
|
-
var ctx = _a.ctx, req = _a.req;
|
|
53
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
54
|
-
var user, hashCandidate, viewUser, token;
|
|
55
|
-
return __generator(this, function (_b) {
|
|
56
|
-
switch (_b.label) {
|
|
57
|
-
case 0: return [4 /*yield*/, ctx.repos.managementuserRepo.getOne({
|
|
58
|
-
username: req.body.username,
|
|
59
|
-
})];
|
|
60
|
-
case 1:
|
|
61
|
-
user = _b.sent();
|
|
62
|
-
if (user == null) {
|
|
63
|
-
return [2 /*return*/, flink_1.unauthorized("Username or password invalid")];
|
|
64
|
-
}
|
|
65
|
-
return [4 /*yield*/, bcrypt_1.encrypt(req.body.password, user.salt)];
|
|
66
|
-
case 2:
|
|
67
|
-
hashCandidate = _b.sent();
|
|
68
|
-
if (hashCandidate !== user.password) {
|
|
69
|
-
return [2 /*return*/, flink_1.unauthorized("Username or password invalid")];
|
|
70
|
-
}
|
|
71
|
-
viewUser = ManagementUserViewModel_1.GetManagementUserViewModel(user);
|
|
72
|
-
token = jsonwebtoken_1.default.sign(viewUser, ctx.plugins.managementApi.jwtSecret);
|
|
73
|
-
return [2 /*return*/, {
|
|
74
|
-
data: {
|
|
75
|
-
user: viewUser,
|
|
76
|
-
token: token,
|
|
77
|
-
},
|
|
78
|
-
status: 200,
|
|
79
|
-
}];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
exports.default = PostUserLogin;
|
|
85
|
-
exports.__assumedHttpMethod = "post", exports.__file = "PostLogin.ts", exports.__query = [], exports.__params = [];
|
|
86
|
-
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": { "username": { "type": "string" }, "password": { "type": "string" } }, "required": ["password", "username"] }, resSchema: { "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"] } };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Handler, RouteProps } from "@flink-app/flink";
|
|
2
|
-
import { Ctx } from "../../Ctx";
|
|
3
|
-
import { PutUserByUseridReq } from "../../schemas/User/PutByUseridReq";
|
|
4
|
-
import { PutUserByUseridRes } from "../../schemas/User/PutByUseridRes";
|
|
5
|
-
export declare const Route: RouteProps;
|
|
6
|
-
declare const PutUserByUserid: Handler<Ctx, PutUserByUseridReq, PutUserByUseridRes>;
|
|
7
|
-
export default PutUserByUserid;
|
|
8
|
-
export declare const __assumedHttpMethod = "put", __file = "PutByUserid.ts", __query: never[], __params: never[];
|
|
9
|
-
export declare const __schemas: any;
|
|
@@ -1,97 +0,0 @@
|
|
|
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());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
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 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.Route = void 0;
|
|
40
|
-
var flink_1 = require("@flink-app/flink");
|
|
41
|
-
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
42
|
-
var bcrypt_1 = require("../../utils/bcrypt");
|
|
43
|
-
exports.Route = {
|
|
44
|
-
path: "/user/:userid",
|
|
45
|
-
method: flink_1.HttpMethod.put,
|
|
46
|
-
};
|
|
47
|
-
// type Params = {
|
|
48
|
-
// userid: string;
|
|
49
|
-
// };
|
|
50
|
-
var PutUserByUserid = function (_a) {
|
|
51
|
-
var ctx = _a.ctx, req = _a.req;
|
|
52
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
53
|
-
var model, existingUser, salt, hash, updated;
|
|
54
|
-
return __generator(this, function (_b) {
|
|
55
|
-
switch (_b.label) {
|
|
56
|
-
case 0:
|
|
57
|
-
model = req.body;
|
|
58
|
-
if (!(model.username != null)) return [3 /*break*/, 2];
|
|
59
|
-
return [4 /*yield*/, ctx.repos.managementuserRepo.getOne({
|
|
60
|
-
username: model.username,
|
|
61
|
-
})];
|
|
62
|
-
case 1:
|
|
63
|
-
existingUser = _b.sent();
|
|
64
|
-
if (existingUser != null) {
|
|
65
|
-
if (existingUser._id != req.params.userid) {
|
|
66
|
-
return [2 /*return*/, flink_1.conflict("Username already taken")];
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
_b.label = 2;
|
|
70
|
-
case 2:
|
|
71
|
-
if (!(model.password != null)) return [3 /*break*/, 5];
|
|
72
|
-
return [4 /*yield*/, bcrypt_1.genSalt(10)];
|
|
73
|
-
case 3:
|
|
74
|
-
salt = _b.sent();
|
|
75
|
-
return [4 /*yield*/, bcrypt_1.encrypt(model.password, salt)];
|
|
76
|
-
case 4:
|
|
77
|
-
hash = _b.sent();
|
|
78
|
-
model.password = hash;
|
|
79
|
-
model.salt = salt;
|
|
80
|
-
_b.label = 5;
|
|
81
|
-
case 5: return [4 /*yield*/, ctx.repos.managementuserRepo.updateOne(req.params.userid, model)];
|
|
82
|
-
case 6:
|
|
83
|
-
updated = _b.sent();
|
|
84
|
-
if (updated == null) {
|
|
85
|
-
return [2 /*return*/, flink_1.notFound()];
|
|
86
|
-
}
|
|
87
|
-
return [2 /*return*/, {
|
|
88
|
-
data: ManagementUserViewModel_1.GetManagementUserViewModel(updated),
|
|
89
|
-
status: 200,
|
|
90
|
-
}];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
exports.default = PutUserByUserid;
|
|
96
|
-
exports.__assumedHttpMethod = "put", exports.__file = "PutByUserid.ts", exports.__query = [], exports.__params = [];
|
|
97
|
-
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": { "username": { "type": "string" }, "password": { "type": "string" } } }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] } };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { HandlerFile, RouteProps } from "@flink-app/flink";
|
|
2
|
-
export interface ManagementApiModule {
|
|
3
|
-
id: string;
|
|
4
|
-
type: ManagementApiType;
|
|
5
|
-
endpoints: {
|
|
6
|
-
handler: HandlerFile;
|
|
7
|
-
routeProps: Partial<RouteProps>;
|
|
8
|
-
}[];
|
|
9
|
-
ui: boolean;
|
|
10
|
-
uiSettings?: {
|
|
11
|
-
title: string;
|
|
12
|
-
icon: string;
|
|
13
|
-
features: string[];
|
|
14
|
-
};
|
|
15
|
-
data: {
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export interface ManagementApiOptions {
|
|
20
|
-
token: string;
|
|
21
|
-
baseUrl?: string;
|
|
22
|
-
jwtSecret: string;
|
|
23
|
-
modules: ManagementApiModule[];
|
|
24
|
-
}
|
|
25
|
-
export declare enum ManagementApiType {
|
|
26
|
-
user = "USER",
|
|
27
|
-
managementUser = "MANAGEMENT_USER"
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ManagementApiType = void 0;
|
|
4
|
-
var ManagementApiType;
|
|
5
|
-
(function (ManagementApiType) {
|
|
6
|
-
ManagementApiType["user"] = "USER";
|
|
7
|
-
ManagementApiType["managementUser"] = "MANAGEMENT_USER";
|
|
8
|
-
})(ManagementApiType = exports.ManagementApiType || (exports.ManagementApiType = {}));
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var flink_1 = require("@flink-app/flink");
|
|
19
|
-
var ConnectSessionRepo = /** @class */ (function (_super) {
|
|
20
|
-
__extends(ConnectSessionRepo, _super);
|
|
21
|
-
function ConnectSessionRepo() {
|
|
22
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
}
|
|
24
|
-
return ConnectSessionRepo;
|
|
25
|
-
}(flink_1.FlinkRepo));
|
|
26
|
-
exports.default = ConnectSessionRepo;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var flink_1 = require("@flink-app/flink");
|
|
19
|
-
var ManagementUserRepo = /** @class */ (function (_super) {
|
|
20
|
-
__extends(ManagementUserRepo, _super);
|
|
21
|
-
function ManagementUserRepo() {
|
|
22
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
23
|
-
}
|
|
24
|
-
return ManagementUserRepo;
|
|
25
|
-
}(flink_1.FlinkRepo));
|
|
26
|
-
exports.default = ManagementUserRepo;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.GetManagementUserViewModel = void 0;
|
|
15
|
-
var GetManagementUserViewModel = function (user) {
|
|
16
|
-
var password = user.password, salt = user.salt, resp = __rest(user, ["password", "salt"]);
|
|
17
|
-
return resp;
|
|
18
|
-
};
|
|
19
|
-
exports.GetManagementUserViewModel = GetManagementUserViewModel;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface ModuleList {
|
|
2
|
-
modules: Module[];
|
|
3
|
-
}
|
|
4
|
-
export interface Module {
|
|
5
|
-
id: string;
|
|
6
|
-
type: string;
|
|
7
|
-
features: string[];
|
|
8
|
-
title: string;
|
|
9
|
-
ui: string;
|
|
10
|
-
data: {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
13
|
-
endpoints: ModuleEndpoint[];
|
|
14
|
-
}
|
|
15
|
-
export interface ModuleEndpoint {
|
|
16
|
-
method: string;
|
|
17
|
-
url: string;
|
|
18
|
-
}
|