@bearei/server-common 0.0.116 → 0.0.118
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/app.entity.d.ts
CHANGED
package/dist/app.entity.js
CHANGED
|
@@ -8,8 +8,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.AppEntity = void 0;
|
|
16
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
13
17
|
const nanoid_1 = require("nanoid");
|
|
14
18
|
const typeorm_1 = require("typeorm");
|
|
15
19
|
const app_interface_1 = require("./app.interface");
|
|
@@ -23,6 +27,10 @@ let AppEntity = class AppEntity extends typeorm_1.BaseEntity {
|
|
|
23
27
|
deletedAt;
|
|
24
28
|
beforeInsert() {
|
|
25
29
|
this.id = (0, nanoid_1.nanoid)();
|
|
30
|
+
this.createdAt = (0, dayjs_1.default)().toISOString();
|
|
31
|
+
}
|
|
32
|
+
beforeUpdate() {
|
|
33
|
+
this.updatedAt = (0, dayjs_1.default)().toISOString();
|
|
26
34
|
}
|
|
27
35
|
beforeSoftRemove() {
|
|
28
36
|
this.entityStatus = app_interface_1.EntityStatus.SOFT_REMOVED;
|
|
@@ -66,6 +74,12 @@ __decorate([
|
|
|
66
74
|
__metadata("design:paramtypes", []),
|
|
67
75
|
__metadata("design:returntype", void 0)
|
|
68
76
|
], AppEntity.prototype, "beforeInsert", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, typeorm_1.BeforeUpdate)(),
|
|
79
|
+
__metadata("design:type", Function),
|
|
80
|
+
__metadata("design:paramtypes", []),
|
|
81
|
+
__metadata("design:returntype", void 0)
|
|
82
|
+
], AppEntity.prototype, "beforeUpdate", null);
|
|
69
83
|
__decorate([
|
|
70
84
|
(0, typeorm_1.BeforeSoftRemove)(),
|
|
71
85
|
__metadata("design:type", Function),
|
package/dist/app.entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../src/app.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app.entity.js","sourceRoot":"","sources":["../src/app.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAyB;AACzB,mCAA6B;AAC7B,qCAagB;AAChB,mDAA4C;AAIrC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,oBAAU;IAErC,SAAS,CAAQ;IAGjB,EAAE,CAAQ;IAGV,YAAY,CAAc;IAG1B,SAAS,CAAQ;IAGjB,SAAS,CAAQ;IAGjB,OAAO,CAAQ;IAGf,SAAS,CAAQ;IAGjB,YAAY;QACR,IAAI,CAAC,EAAE,GAAG,IAAA,eAAM,GAAE,CAAA;QAClB,IAAI,CAAC,SAAS,GAAG,IAAA,eAAK,GAAE,CAAC,WAAW,EAAE,CAAA;IAC1C,CAAC;IAGD,YAAY;QACR,IAAI,CAAC,SAAS,GAAG,IAAA,eAAK,GAAE,CAAC,WAAW,EAAE,CAAA;IAC1C,CAAC;IAGD,gBAAgB;QACZ,IAAI,CAAC,YAAY,GAAG,4BAAY,CAAC,YAAY,CAAA;IACjD,CAAC;IAGD,aAAa;QACT,IAAI,CAAC,YAAY,GAAG,4BAAY,CAAC,SAAS,CAAA;IAC9C,CAAC;CACJ,CAAA;AA1CY,8BAAS;AAElB;IADC,IAAA,gCAAsB,EAAC,UAAU,CAAC;;4CAClB;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC;;qCAC7C;AAGV;IADC,IAAA,gBAAM,EAAC,EAAC,OAAO,EAAE,4BAAY,CAAC,SAAS,EAAE,IAAI,EAAE,4BAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC;;+CACnE;AAG1B;IADC,IAAA,0BAAgB,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;4CACnB;AAGjB;IADC,IAAA,0BAAgB,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;4CACnB;AAGjB;IADC,IAAA,uBAAa,EAAC,EAAC,QAAQ,EAAE,KAAK,EAAC,CAAC;;0CAClB;AAGf;IADC,IAAA,0BAAgB,GAAE;;4CACF;AAGjB;IADC,IAAA,sBAAY,GAAE;;;;6CAId;AAGD;IADC,IAAA,sBAAY,GAAE;;;;6CAGd;AAGD;IADC,IAAA,0BAAgB,GAAE;;;;iDAGlB;AAGD;IADC,IAAA,uBAAa,GAAE;;;;8CAGf;oBAzCQ,SAAS;IAFrB,IAAA,eAAK,EAAC,CAAC,WAAW,CAAC,CAAC;IACpB,IAAA,eAAK,EAAC,CAAC,IAAI,CAAC,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;GACjB,SAAS,CA0CrB"}
|
package/dist/jwt/jwt.service.js
CHANGED
|
@@ -16,7 +16,6 @@ exports.JWTService = void 0;
|
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const jwt_1 = require("@nestjs/jwt");
|
|
18
18
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
19
|
-
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
20
19
|
const nanoid_1 = require("nanoid");
|
|
21
20
|
const app_interface_1 = require("../app.interface");
|
|
22
21
|
const utils_1 = require("../utils");
|
|
@@ -24,7 +23,6 @@ let JWTService = class JWTService {
|
|
|
24
23
|
jwtService;
|
|
25
24
|
constructor(jwtService) {
|
|
26
25
|
this.jwtService = jwtService;
|
|
27
|
-
dayjs_1.default.extend(utc_1.default);
|
|
28
26
|
}
|
|
29
27
|
signAsync({ audience, issuer, jwtId, notBefore }) {
|
|
30
28
|
return (jwtSignOptions) => async (subject) => {
|
|
@@ -32,7 +30,7 @@ let JWTService = class JWTService {
|
|
|
32
30
|
aud: audience,
|
|
33
31
|
iss: issuer,
|
|
34
32
|
jti: jwtId ?? (0, nanoid_1.nanoid)(),
|
|
35
|
-
nbf: notBefore ?? parseInt(`${dayjs_1.default
|
|
33
|
+
nbf: notBefore ?? parseInt(`${(0, dayjs_1.default)().valueOf() / 1000}`),
|
|
36
34
|
sub: subject
|
|
37
35
|
};
|
|
38
36
|
const token = await this.jwtService.signAsync(payload, jwtSignOptions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.service.js","sourceRoot":"","sources":["../../src/jwt/jwt.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyC;AACzC,qCAAsD;AACtD,kDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"jwt.service.js","sourceRoot":"","sources":["../../src/jwt/jwt.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAyC;AACzC,qCAAsD;AACtD,kDAAyB;AACzB,mCAA6B;AAC7B,oDAA0C;AAC1C,oCAAuC;AAIhC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACU;IAA7B,YAA6B,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAEvD,SAAS,CAAC,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAoB;QAC7D,OAAO,CAAC,cAA+B,EAAE,EAAE,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;YAClE,MAAM,OAAO,GAAG;gBACZ,GAAG,EAAE,QAAQ;gBACb,GAAG,EAAE,MAAM;gBACX,GAAG,EAAE,KAAK,IAAI,IAAA,eAAM,GAAE;gBACtB,GAAG,EAAE,SAAS,I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