@scefira/dfw 0.0.58 → 0.1.1
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/lib/DFWInstance.d.ts +21 -0
- package/lib/DFWInstance.d.ts.map +1 -0
- package/lib/DFWInstance.js +52 -0
- package/lib/DFWInstance.js.map +1 -0
- package/lib/{script/DFWUtils.d.ts → DFWUtils.d.ts} +3 -4
- package/lib/DFWUtils.d.ts.map +1 -0
- package/lib/{script/DFWUtils.js → DFWUtils.js} +9 -15
- package/lib/DFWUtils.js.map +1 -0
- package/lib/index.d.ts +7 -58
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +14 -11
- package/lib/index.js.map +1 -1
- package/lib/manager/APIManager.d.ts +48 -0
- package/lib/manager/APIManager.d.ts.map +1 -0
- package/lib/manager/APIManager.js +210 -0
- package/lib/manager/APIManager.js.map +1 -0
- package/lib/manager/DFWModule.d.ts +10 -0
- package/lib/manager/DFWModule.d.ts.map +1 -0
- package/lib/manager/DFWModule.js +10 -0
- package/lib/manager/DFWModule.js.map +1 -0
- package/lib/manager/DatabaseManager.d.ts +9 -0
- package/lib/manager/DatabaseManager.d.ts.map +1 -0
- package/lib/manager/DatabaseManager.js +25 -0
- package/lib/manager/DatabaseManager.js.map +1 -0
- package/lib/manager/FileManager.d.ts +64 -0
- package/lib/manager/FileManager.d.ts.map +1 -0
- package/lib/manager/FileManager.js +206 -0
- package/lib/manager/FileManager.js.map +1 -0
- package/lib/{module → manager}/SecurityManager.d.ts +13 -13
- package/lib/manager/SecurityManager.d.ts.map +1 -0
- package/lib/{module → manager}/SecurityManager.js +36 -63
- package/lib/manager/SecurityManager.js.map +1 -0
- package/lib/manager/SessionManager.d.ts +41 -0
- package/lib/manager/SessionManager.d.ts.map +1 -0
- package/lib/manager/SessionManager.js +173 -0
- package/lib/manager/SessionManager.js.map +1 -0
- package/lib/manager/UserManager.d.ts +15 -0
- package/lib/manager/UserManager.d.ts.map +1 -0
- package/lib/manager/UserManager.js +101 -0
- package/lib/manager/UserManager.js.map +1 -0
- package/lib/test.js +25 -75
- package/lib/test.js.map +1 -1
- package/lib/types/APIListenerConfig.d.ts +46 -0
- package/lib/types/APIListenerConfig.d.ts.map +1 -0
- package/lib/types/{DFWAPIListenerConfig.js → APIListenerConfig.js} +1 -1
- package/lib/types/APIListenerConfig.js.map +1 -0
- package/lib/types/DFWBoot.d.ts +19 -0
- package/lib/types/DFWBoot.d.ts.map +1 -0
- package/lib/types/DFWBoot.js +3 -0
- package/lib/types/DFWBoot.js.map +1 -0
- package/lib/types/DFWConfig.d.ts +7 -21
- package/lib/types/DFWConfig.d.ts.map +1 -1
- package/lib/types/DFWRequestScheme.d.ts +36 -0
- package/lib/types/DFWRequestScheme.d.ts.map +1 -0
- package/lib/types/DFWRequestScheme.js +3 -0
- package/lib/types/DFWRequestScheme.js.map +1 -0
- package/package.json +31 -43
- package/prisma/schema.prisma +117 -0
- package/lib/model/dfw_access.d.ts +0 -11
- package/lib/model/dfw_access.d.ts.map +0 -1
- package/lib/model/dfw_access.js +0 -58
- package/lib/model/dfw_access.js.map +0 -1
- package/lib/model/dfw_access_credential.d.ts +0 -6
- package/lib/model/dfw_access_credential.d.ts.map +0 -1
- package/lib/model/dfw_access_credential.js +0 -41
- package/lib/model/dfw_access_credential.js.map +0 -1
- package/lib/model/dfw_credential.d.ts +0 -12
- package/lib/model/dfw_credential.d.ts.map +0 -1
- package/lib/model/dfw_credential.js +0 -100
- package/lib/model/dfw_credential.js.map +0 -1
- package/lib/model/dfw_file.d.ts +0 -23
- package/lib/model/dfw_file.d.ts.map +0 -1
- package/lib/model/dfw_file.js +0 -121
- package/lib/model/dfw_file.js.map +0 -1
- package/lib/model/dfw_session.d.ts +0 -15
- package/lib/model/dfw_session.d.ts.map +0 -1
- package/lib/model/dfw_session.js +0 -69
- package/lib/model/dfw_session.js.map +0 -1
- package/lib/model/dfw_user.d.ts +0 -31
- package/lib/model/dfw_user.d.ts.map +0 -1
- package/lib/model/dfw_user.js +0 -211
- package/lib/model/dfw_user.js.map +0 -1
- package/lib/model/dfw_users_credential.d.ts +0 -6
- package/lib/model/dfw_users_credential.d.ts.map +0 -1
- package/lib/model/dfw_users_credential.js +0 -41
- package/lib/model/dfw_users_credential.js.map +0 -1
- package/lib/module/APIManager.d.ts +0 -86
- package/lib/module/APIManager.d.ts.map +0 -1
- package/lib/module/APIManager.js +0 -267
- package/lib/module/APIManager.js.map +0 -1
- package/lib/module/DatabaseManager.d.ts +0 -22
- package/lib/module/DatabaseManager.d.ts.map +0 -1
- package/lib/module/DatabaseManager.js +0 -58
- package/lib/module/DatabaseManager.js.map +0 -1
- package/lib/module/FileManager.d.ts +0 -196
- package/lib/module/FileManager.d.ts.map +0 -1
- package/lib/module/FileManager.js +0 -433
- package/lib/module/FileManager.js.map +0 -1
- package/lib/module/SecurityManager.d.ts.map +0 -1
- package/lib/module/SecurityManager.js.map +0 -1
- package/lib/module/SessionManager.d.ts +0 -49
- package/lib/module/SessionManager.d.ts.map +0 -1
- package/lib/module/SessionManager.js +0 -220
- package/lib/module/SessionManager.js.map +0 -1
- package/lib/module/UserManager.d.ts +0 -16
- package/lib/module/UserManager.d.ts.map +0 -1
- package/lib/module/UserManager.js +0 -74
- package/lib/module/UserManager.js.map +0 -1
- package/lib/script/DFWInstance.d.ts +0 -38
- package/lib/script/DFWInstance.d.ts.map +0 -1
- package/lib/script/DFWInstance.js +0 -65
- package/lib/script/DFWInstance.js.map +0 -1
- package/lib/script/DFWModule.d.ts +0 -10
- package/lib/script/DFWModule.d.ts.map +0 -1
- package/lib/script/DFWModule.js +0 -12
- package/lib/script/DFWModule.js.map +0 -1
- package/lib/script/DFWUtils.d.ts.map +0 -1
- package/lib/script/DFWUtils.js.map +0 -1
- package/lib/types/DFWAPIListenerConfig.d.ts +0 -39
- package/lib/types/DFWAPIListenerConfig.d.ts.map +0 -1
- package/lib/types/DFWAPIListenerConfig.js.map +0 -1
- package/lib/types/DFWRequestError.d.ts +0 -9
- package/lib/types/DFWRequestError.d.ts.map +0 -1
- package/lib/types/DFWRequestError.js +0 -15
- package/lib/types/DFWRequestError.js.map +0 -1
package/lib/model/dfw_session.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
16
|
-
const dfw_user_1 = __importDefault(require("./dfw_user"));
|
|
17
|
-
let dfw_session = class dfw_session extends sequelize_typescript_1.Model {
|
|
18
|
-
};
|
|
19
|
-
__decorate([
|
|
20
|
-
sequelize_typescript_1.PrimaryKey,
|
|
21
|
-
sequelize_typescript_1.AutoIncrement,
|
|
22
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.BIGINT.UNSIGNED),
|
|
23
|
-
__metadata("design:type", Number)
|
|
24
|
-
], dfw_session.prototype, "id", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
sequelize_typescript_1.AllowNull(false),
|
|
27
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.STRING),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], dfw_session.prototype, "token", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
sequelize_typescript_1.Column,
|
|
32
|
-
__metadata("design:type", String)
|
|
33
|
-
], dfw_session.prototype, "agent", void 0);
|
|
34
|
-
__decorate([
|
|
35
|
-
sequelize_typescript_1.Column,
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], dfw_session.prototype, "ip", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
sequelize_typescript_1.Default(false),
|
|
40
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.BOOLEAN),
|
|
41
|
-
__metadata("design:type", Boolean)
|
|
42
|
-
], dfw_session.prototype, "persist", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.DATEONLY),
|
|
45
|
-
__metadata("design:type", Date)
|
|
46
|
-
], dfw_session.prototype, "expire", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
sequelize_typescript_1.AllowNull,
|
|
49
|
-
sequelize_typescript_1.ForeignKey(() => dfw_user_1.default),
|
|
50
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.INTEGER.UNSIGNED),
|
|
51
|
-
__metadata("design:type", Object)
|
|
52
|
-
], dfw_session.prototype, "idUser", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
sequelize_typescript_1.CreatedAt,
|
|
55
|
-
__metadata("design:type", Date)
|
|
56
|
-
], dfw_session.prototype, "created_at", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
sequelize_typescript_1.UpdatedAt,
|
|
59
|
-
__metadata("design:type", Date)
|
|
60
|
-
], dfw_session.prototype, "updated_at", void 0);
|
|
61
|
-
__decorate([
|
|
62
|
-
sequelize_typescript_1.BelongsTo(() => dfw_user_1.default, { constraints: false }),
|
|
63
|
-
__metadata("design:type", Object)
|
|
64
|
-
], dfw_session.prototype, "user", void 0);
|
|
65
|
-
dfw_session = __decorate([
|
|
66
|
-
sequelize_typescript_1.Table({ tableName: "dfw_sessions", indexes: [{ fields: ["idUser"] }] })
|
|
67
|
-
], dfw_session);
|
|
68
|
-
exports.default = dfw_session;
|
|
69
|
-
//# sourceMappingURL=dfw_session.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dfw_session.js","sourceRoot":"","sources":["../../src/model/dfw_session.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAmL;AACnL,0DAAkC;AAGlC,IAAqB,WAAW,GAAhC,MAAqB,WAAY,SAAQ,4BAAK;CAyC7C,CAAA;AApCG;IAHC,iCAAU;IACV,oCAAa;IACb,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;;uCACrB;AAIZ;IAFC,gCAAS,CAAC,KAAK,CAAC;IAChB,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;0CACT;AAGf;IADC,6BAAM;;0CACQ;AAGf;IADC,6BAAM;;uCACK;AAIZ;IAFC,8BAAO,CAAC,KAAK,CAAC;IACd,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC;;4CACP;AAGlB;IADC,6BAAM,CAAC,+BAAQ,CAAC,QAAQ,CAAC;8BACjB,IAAI;2CAAC;AAKd;IAHC,gCAAS;IACT,iCAAU,CAAC,GAAG,EAAE,CAAC,kBAAQ,CAAC;IAC1B,6BAAM,CAAC,+BAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC;;2CACb;AAGrB;IADC,gCAAS;8BACG,IAAI;+CAAC;AAGlB;IADC,gCAAS;8BACG,IAAI;+CAAC;AAMlB;IADC,gCAAS,CAAC,GAAG,EAAE,CAAC,kBAAQ,EAAE,EAAE,WAAW,EAAC,KAAK,EAAE,CAAC;;yCAC5B;AAvCJ,WAAW;IAD/B,4BAAK,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAC,CAAC,EAAE,MAAM,EAAC,CAAC,QAAQ,CAAC,EAAC,CAAC,EAAE,CAAC;GAChD,WAAW,CAyC/B;kBAzCoB,WAAW"}
|
package/lib/model/dfw_user.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Model } from 'sequelize-typescript';
|
|
2
|
-
import dfw_session from './dfw_session';
|
|
3
|
-
import dfw_credential from './dfw_credential';
|
|
4
|
-
import dfw_access from './dfw_access';
|
|
5
|
-
import { Transaction } from 'sequelize/types';
|
|
6
|
-
export default class dfw_user extends Model {
|
|
7
|
-
id: number;
|
|
8
|
-
nick: string;
|
|
9
|
-
email: string;
|
|
10
|
-
status: string;
|
|
11
|
-
encodedKey: string;
|
|
12
|
-
created_at: Date;
|
|
13
|
-
updated_at: Date;
|
|
14
|
-
sessionsOwned: dfw_session[];
|
|
15
|
-
credentials: dfw_credential[];
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param password plain password to check
|
|
19
|
-
* @returns Boolean true or false if the password match with the encripted password
|
|
20
|
-
*/
|
|
21
|
-
checkPassword(password: string): boolean;
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @param access
|
|
25
|
-
*/
|
|
26
|
-
checkAccessAsync(access: string | string[] | number | number[] | dfw_access | dfw_access[]): Promise<boolean>;
|
|
27
|
-
checkCredentialAsync(credential: string | string[] | number | number[] | dfw_credential | dfw_credential[]): Promise<boolean>;
|
|
28
|
-
assignCredentialAsync(credential: string | string[] | number | number[] | dfw_credential | dfw_credential[], transaction?: Transaction): Promise<any>;
|
|
29
|
-
removeCredentialAsync(credential: string | string[] | number | number[] | dfw_credential | dfw_credential[], transaction?: Transaction): Promise<any>;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=dfw_user.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dfw_user.d.ts","sourceRoot":"","sources":["../../src/model/dfw_user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAi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C,WAAW,GAAE,OAAO,CAAC,GAAG,CAAC;CA4BhJ"}
|
package/lib/model/dfw_user.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
25
|
-
const dfw_session_1 = __importDefault(require("./dfw_session"));
|
|
26
|
-
const dfw_credential_1 = __importDefault(require("./dfw_credential"));
|
|
27
|
-
const dfw_users_credential_1 = __importDefault(require("./dfw_users_credential"));
|
|
28
|
-
const dfw_access_1 = __importDefault(require("./dfw_access"));
|
|
29
|
-
const SecurityManager_1 = __importDefault(require("../module/SecurityManager"));
|
|
30
|
-
let dfw_user = class dfw_user extends sequelize_typescript_1.Model {
|
|
31
|
-
//// methods ////
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param password plain password to check
|
|
35
|
-
* @returns Boolean true or false if the password match with the encripted password
|
|
36
|
-
*/
|
|
37
|
-
checkPassword(password) {
|
|
38
|
-
return SecurityManager_1.default.verifyPassword(this.encodedKey, password);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @param access
|
|
43
|
-
*/
|
|
44
|
-
checkAccessAsync(access) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
var ownCreds = this.credentials ? this.credentials : yield this.$get("credentials", { include: [dfw_access_1.default] });
|
|
47
|
-
if (!ownCreds)
|
|
48
|
-
return false;
|
|
49
|
-
for (var i = 0; i < ownCreds.length; i++) {
|
|
50
|
-
if ((yield ownCreds[i].checkAccess(access)) === true)
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
return false;
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
checkCredentialAsync(credential) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
if (Array.isArray(credential)) {
|
|
59
|
-
for (var i = 0; i < credential.length; i++) {
|
|
60
|
-
if ((yield this.checkCredentialAsync(credential[i])) === true) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
var ownCreds = this.credentials ? this.credentials : yield this.$get("credentials", { include: [dfw_access_1.default] });
|
|
67
|
-
if (!ownCreds)
|
|
68
|
-
return false;
|
|
69
|
-
for (var i = 0; i < ownCreds.length; i++) {
|
|
70
|
-
var sample = ownCreds[i];
|
|
71
|
-
if (typeof credential == "number") {
|
|
72
|
-
if (sample.id === credential)
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
else if (typeof credential == "string") {
|
|
76
|
-
if (sample.name === credential)
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
else if (typeof credential == "object" && credential.id) {
|
|
80
|
-
if (sample.id === credential.id)
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return false;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
assignCredentialAsync(credential, transaction) {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
if (Array.isArray(credential)) {
|
|
91
|
-
if (transaction === undefined)
|
|
92
|
-
transaction = yield this.sequelize.transaction();
|
|
93
|
-
return Promise.all(credential.map((cred) => {
|
|
94
|
-
return this.assignCredentialAsync(cred, transaction);
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
if (typeof credential == "number") {
|
|
99
|
-
return this.$add("credentials", credential, { transaction });
|
|
100
|
-
}
|
|
101
|
-
else if (typeof credential == "string") {
|
|
102
|
-
var credObj = yield dfw_credential_1.default.findOne({ where: { name: credential } });
|
|
103
|
-
if (credObj) {
|
|
104
|
-
return this.$add("credentials", credObj, { transaction });
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
return new Promise((resolve, reject) => {
|
|
108
|
-
reject("unknown credential " + credential);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
else if (credential instanceof dfw_credential_1.default) {
|
|
113
|
-
return this.$add("credentials", credential, { transaction });
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return new Promise((resolve, reject) => {
|
|
117
|
-
reject("unknown argument type");
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
removeCredentialAsync(credential, transaction) {
|
|
122
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
if (Array.isArray(credential)) {
|
|
124
|
-
if (transaction === undefined)
|
|
125
|
-
transaction = yield this.sequelize.transaction();
|
|
126
|
-
return Promise.all(credential.map((cred) => {
|
|
127
|
-
return this.removeCredentialAsync(cred, transaction);
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
if (typeof credential == "number") {
|
|
132
|
-
return this.$remove("credentials", credential, { transaction });
|
|
133
|
-
}
|
|
134
|
-
else if (typeof credential == "string") {
|
|
135
|
-
var credObj = yield dfw_credential_1.default.findOne({ where: { name: credential } });
|
|
136
|
-
if (credObj) {
|
|
137
|
-
return this.$remove("credentials", credObj, { transaction });
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
return new Promise((resolve, reject) => {
|
|
141
|
-
reject("unknown credential " + credential);
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else if (typeof credential == "object" && credential.id) {
|
|
146
|
-
return this.$remove("credentials", credential, { transaction });
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return new Promise((resolve, reject) => {
|
|
150
|
-
reject("unknown argument type");
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
__decorate([
|
|
156
|
-
sequelize_typescript_1.PrimaryKey,
|
|
157
|
-
sequelize_typescript_1.AutoIncrement,
|
|
158
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.INTEGER.UNSIGNED),
|
|
159
|
-
__metadata("design:type", Number)
|
|
160
|
-
], dfw_user.prototype, "id", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
sequelize_typescript_1.Unique,
|
|
163
|
-
sequelize_typescript_1.AllowNull(false),
|
|
164
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.STRING(60)),
|
|
165
|
-
__metadata("design:type", String)
|
|
166
|
-
], dfw_user.prototype, "nick", void 0);
|
|
167
|
-
__decorate([
|
|
168
|
-
sequelize_typescript_1.Unique,
|
|
169
|
-
sequelize_typescript_1.AllowNull(false),
|
|
170
|
-
sequelize_typescript_1.Length({ max: 60 }),
|
|
171
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.STRING(60)),
|
|
172
|
-
__metadata("design:type", String)
|
|
173
|
-
], dfw_user.prototype, "email", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
sequelize_typescript_1.Default(null),
|
|
176
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.TINYINT.UNSIGNED),
|
|
177
|
-
__metadata("design:type", String)
|
|
178
|
-
], dfw_user.prototype, "status", void 0);
|
|
179
|
-
__decorate([
|
|
180
|
-
sequelize_typescript_1.Column,
|
|
181
|
-
sequelize_typescript_1.AllowNull(true),
|
|
182
|
-
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.STRING),
|
|
183
|
-
__metadata("design:type", String)
|
|
184
|
-
], dfw_user.prototype, "encodedKey", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
sequelize_typescript_1.CreatedAt,
|
|
187
|
-
__metadata("design:type", Date)
|
|
188
|
-
], dfw_user.prototype, "created_at", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
sequelize_typescript_1.UpdatedAt,
|
|
191
|
-
__metadata("design:type", Date)
|
|
192
|
-
], dfw_user.prototype, "updated_at", void 0);
|
|
193
|
-
__decorate([
|
|
194
|
-
sequelize_typescript_1.HasMany(() => dfw_session_1.default, { constraints: false }),
|
|
195
|
-
__metadata("design:type", Array)
|
|
196
|
-
], dfw_user.prototype, "sessionsOwned", void 0);
|
|
197
|
-
__decorate([
|
|
198
|
-
sequelize_typescript_1.BelongsToMany(() => dfw_credential_1.default, {
|
|
199
|
-
through: {
|
|
200
|
-
model: () => dfw_users_credential_1.default,
|
|
201
|
-
unique: false,
|
|
202
|
-
},
|
|
203
|
-
constraints: false
|
|
204
|
-
}),
|
|
205
|
-
__metadata("design:type", Array)
|
|
206
|
-
], dfw_user.prototype, "credentials", void 0);
|
|
207
|
-
dfw_user = __decorate([
|
|
208
|
-
sequelize_typescript_1.Table({ tableName: 'dfw_users' })
|
|
209
|
-
], dfw_user);
|
|
210
|
-
exports.default = dfw_user;
|
|
211
|
-
//# sourceMappingURL=dfw_user.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dfw_user.js","sourceRoot":"","sources":["../../src/model/dfw_user.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAAqL;AACrL,gEAAwC;AACxC,sEAA8C;AAC9C,kFAA0D;AAC1D,8DAAsC;AAEtC,gFAAwD;AAGxD,IAAqB,QAAQ,GAA7B,MAAqB,QAAS,SAAQ,4BAAK;IAgDvC,iBAAiB;IAEjB;;;;OAIG;IACH,aAAa,CAAC,QAAe;QACzB,OAAO,yBAAe,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAC,QAAQ,CAAC,CAAC;IACpE,CAAC;IAED;;;OAGG;IACG,gBAAgB,CAAC,MAA8D;;YAEjF,IAAI,QAAQ,GAAyB,IAAI,CAAC,WAAW,CAAA,CAAC,CAAA,IAAI,CAAC,WAAW,CAAA,CAAC,CAAA,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,EAAC,EAAC,OAAO,EAAC,CAAE,oBAAU,CAAE,EAAC,CAAC,CAAC;YAE/H,IAAG,CAAC,QAAQ;gBAAE,OAAO,KAAK,CAAC;YAE3B,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;gBACpC,IAAI,CAAA,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,MAAK,IAAI;oBAAE,OAAO,IAAI,CAAA;aAClE;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;KAAA;IAEK,o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"version":3,"file":"dfw_users_credential.d.ts","sourceRoot":"","sources":["../../src/model/dfw_users_credential.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAA0B,MAAM,sBAAsB,CAAC;AAYnF,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,KAAK;IAInD,MAAM,EAAG,MAAM,CAAC;IAIhB,YAAY,EAAG,MAAM,CAAC;CACzB"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const sequelize_typescript_1 = require("sequelize-typescript");
|
|
16
|
-
const dfw_user_1 = __importDefault(require("./dfw_user"));
|
|
17
|
-
const dfw_credential_1 = __importDefault(require("./dfw_credential"));
|
|
18
|
-
let dfw_users_credential = class dfw_users_credential extends sequelize_typescript_1.Model {
|
|
19
|
-
};
|
|
20
|
-
__decorate([
|
|
21
|
-
sequelize_typescript_1.ForeignKey(() => dfw_user_1.default),
|
|
22
|
-
sequelize_typescript_1.Column({ unique: false, type: sequelize_typescript_1.DataType.INTEGER.UNSIGNED }),
|
|
23
|
-
__metadata("design:type", Number)
|
|
24
|
-
], dfw_users_credential.prototype, "idUser", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
sequelize_typescript_1.ForeignKey(() => dfw_credential_1.default),
|
|
27
|
-
sequelize_typescript_1.Column({ unique: false, type: sequelize_typescript_1.DataType.INTEGER.UNSIGNED }),
|
|
28
|
-
__metadata("design:type", Number)
|
|
29
|
-
], dfw_users_credential.prototype, "idCredential", void 0);
|
|
30
|
-
dfw_users_credential = __decorate([
|
|
31
|
-
sequelize_typescript_1.Table({
|
|
32
|
-
tableName: "dfw_users_credentials",
|
|
33
|
-
indexes: [{
|
|
34
|
-
unique: true,
|
|
35
|
-
fields: ['idUser', 'idCredential'],
|
|
36
|
-
}],
|
|
37
|
-
timestamps: false
|
|
38
|
-
})
|
|
39
|
-
], dfw_users_credential);
|
|
40
|
-
exports.default = dfw_users_credential;
|
|
41
|
-
//# sourceMappingURL=dfw_users_credential.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dfw_users_credential.js","sourceRoot":"","sources":["../../src/model/dfw_users_credential.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAmF;AACnF,0DAAkC;AAClC,sEAA8C;AAU9C,IAAqB,oBAAoB,GAAzC,MAAqB,oBAAqB,SAAQ,4BAAK;CAStD,CAAA;AALG;IAFC,iCAAU,CAAC,GAAG,EAAE,CAAC,kBAAQ,CAAC;IAC1B,6BAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,+BAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;;oDAC3C;AAIhB;IAFC,iCAAU,CAAC,GAAG,EAAE,CAAC,wBAAc,CAAC;IAChC,6BAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,+BAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;;0DACrC;AARL,oBAAoB;IARxC,4BAAK,CAAC;QACH,SAAS,EAAE,uBAAuB;QAClC,OAAO,EAAE,CAAC;gBACN,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC;aACrC,CAAC;QACF,UAAU,EAAE,KAAK;KACpB,CAAC;GACmB,oBAAoB,CASxC;kBAToB,oBAAoB"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { NextFunction, Request, Response, RequestHandler } from "express";
|
|
2
|
-
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
3
|
-
import DFWModule from "../script/DFWModule";
|
|
4
|
-
import { DFWAPIListenerConfig } from "../types/DFWAPIListenerConfig";
|
|
5
|
-
import dfw_credential from "../model/dfw_credential";
|
|
6
|
-
import dfw_user from "../model/dfw_user";
|
|
7
|
-
export declare type APIFunction = ((req: Request, res: Response, api: DFW.DFWRequestScheme) => Promise<any>) | ((req: Request, res: Response, api: any) => any);
|
|
8
|
-
export declare type APIMethods = "get" | "put" | "post" | "delete" | "options" | "link" | "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "LINK";
|
|
9
|
-
export declare class APIListenerObject {
|
|
10
|
-
readonly config: DFWAPIListenerConfig;
|
|
11
|
-
readonly listener: APIFunction;
|
|
12
|
-
constructor(config: DFWAPIListenerConfig | APIFunction, listener?: APIFunction);
|
|
13
|
-
}
|
|
14
|
-
export declare type BootCallback = (req: Request, boot: DFW.Boot) => Promise<any>;
|
|
15
|
-
export default class APIManager extends DFWModule {
|
|
16
|
-
private bootCallbacks;
|
|
17
|
-
middleware: (req: Request, res: Response, next: NextFunction) => void;
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param req
|
|
21
|
-
* @param res
|
|
22
|
-
* @param data
|
|
23
|
-
*/
|
|
24
|
-
response(req: Request, res: Response, data?: {}): void;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param path
|
|
28
|
-
* @param apiFunc
|
|
29
|
-
* @param config
|
|
30
|
-
*/
|
|
31
|
-
addListener(path: string, apiFunc: APIFunction, config?: DFWAPIListenerConfig): void;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @param apiFunc
|
|
35
|
-
* @param config
|
|
36
|
-
*/
|
|
37
|
-
generateAPILevelMiddleware(config?: DFWAPIListenerConfig): RequestHandler[];
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
* @param dfw
|
|
41
|
-
*/
|
|
42
|
-
getBootAsync(req: Request): Promise<DFW.Boot>;
|
|
43
|
-
/**
|
|
44
|
-
*
|
|
45
|
-
* @param bootc
|
|
46
|
-
*/
|
|
47
|
-
addBootCallback(bootc: BootCallback): void;
|
|
48
|
-
/**
|
|
49
|
-
* fetch data to the server
|
|
50
|
-
* @param path
|
|
51
|
-
* @param config
|
|
52
|
-
*/
|
|
53
|
-
static fetch(path: string, config?: AxiosRequestConfig): Promise<AxiosResponse>;
|
|
54
|
-
/**
|
|
55
|
-
* Función recursiva que registra en DFW los listeners basados en una estructura de objeto
|
|
56
|
-
* @param node
|
|
57
|
-
* @param path
|
|
58
|
-
*/
|
|
59
|
-
registerAPIListenerObject(node: (APIListenerObject | Object) | (APIListenerObject | Object)[], path: string): void;
|
|
60
|
-
createUserAsync(email: string, nick: string, password: string): Promise<dfw_user>;
|
|
61
|
-
findUserAsync(nameOrMail: string): Promise<dfw_user>;
|
|
62
|
-
assingCredentialTo(credential: number | dfw_credential, user: number | dfw_user): Promise<boolean>;
|
|
63
|
-
}
|
|
64
|
-
export declare type APIResponseScheme = {
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
getBootAsync: () => Promise<DFW.Boot>;
|
|
69
|
-
/**
|
|
70
|
-
*
|
|
71
|
-
*/
|
|
72
|
-
error: (description?: string, code?: number, ref?: any) => any;
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
*/
|
|
76
|
-
success: (data?: any) => any;
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
response: (data: any) => void;
|
|
81
|
-
/**
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
notFound: (description?: string) => void;
|
|
85
|
-
};
|
|
86
|
-
//# sourceMappingURL=APIManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"APIManager.d.ts","sourceRoot":"","sources":["../../src/module/APIManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAG,OAAO,EAAG,QAAQ,EAAE,cAAc,EAAuB,MAAM,SAAS,CAAC;AACjG,OAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,SAAqC,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAEzC,oBAAY,WAAW,GAAG,CAAC,CAAC,GAAG,EAAC,OAAO,EAAC,GAAG,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,CAAC,gBAAgB,KAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAC,CAAC,CAAC,GAAG,EAAC,OAAO,EAAC,GAAG,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,KAAG,GAAG,CAAC,CAAC;AACxI,oBAAY,UAAU,GAAG,KAAK,GAAC,KAAK,GAAC,MAAM,GAAC,QAAQ,GAAC,SAAS,GAAC,MAAM,GAAC,KAAK,GAAC,KAAK,GAAC,MAAM,GAAC,QAAQ,GAAC,SAAS,GAAC,MAAM,CAAC;AAEnH,qBAAa,iBAAiB;IAC1B,SAAgB,MAAM,EAAC,oBAAoB,CAAC;IAC5C,SAAgB,QAAQ,EAAC,WAAW,CAAC;gBAEzB,MAAM,EAAC,oBAAoB,GAAC,WAAW,EAAC,QAAQ,CAAC,EAAC,WA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