@tomei/sso 0.39.6 → 0.40.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,14 +13,15 @@ export declare class APIKey extends ObjectBase {
13
13
  Description: string;
14
14
  Status: APIKeyStatusEnum;
15
15
  ExpirationDate: Date;
16
- _InvokedById: number;
17
- _InvokedAt: Date;
16
+ RevokedReason: string;
17
+ _RevokedById: number;
18
+ _RevokedAt: Date;
18
19
  _CreatedAt: Date;
19
20
  _CreatedById: number;
20
21
  get APIKeyId(): number;
21
22
  set APIKeyId(value: number);
22
- get InvokedById(): number;
23
- get InvokedAt(): Date;
23
+ get RevokedById(): number;
24
+ get RevokedAt(): Date;
24
25
  get CreatedAt(): Date;
25
26
  get CreatedById(): number;
26
27
  protected static _Repo: APIKeyRepository;
@@ -33,7 +34,38 @@ export declare class APIKey extends ObjectBase {
33
34
  ExpirationDate: Date;
34
35
  CreatedAt: Date;
35
36
  CreatedById: number;
36
- InvokedAt: Date;
37
- InvokedById: number;
37
+ RevokedAt: Date;
38
+ RevokedById: number;
39
+ RevokedReason: string;
40
+ }>;
41
+ findAll(pagination: {
42
+ page: number;
43
+ limit: number;
44
+ }, loginUser: LoginUser, dbTransaction: any, whereOptions: {
45
+ Status?: APIKeyStatusEnum;
46
+ ExpirationDate?: {
47
+ FromDate: Date;
48
+ ToDate: Date;
49
+ };
50
+ CreatedById?: number;
51
+ }, sortOptions?: {
52
+ SortBy: string;
53
+ SortOrder: 'ASC' | 'DESC';
54
+ }): Promise<{
55
+ total: number;
56
+ ApiKeys: {
57
+ ApiKeyId: number;
58
+ ApiKey: string;
59
+ Name: string;
60
+ Status: APIKeyStatusEnum;
61
+ ExpirationDate: Date;
62
+ CreatedAt: Date;
63
+ CreatedById: number;
64
+ RevokedAt: Date;
65
+ RevokedById: number;
66
+ RevokedReason: string;
67
+ }[];
68
+ page: number;
69
+ limit: number;
38
70
  }>;
39
71
  }
@@ -15,6 +15,7 @@ const api_key_repository_1 = require("./api-key.repository");
15
15
  const config_1 = require("@tomei/config");
16
16
  const crypto_1 = require("crypto");
17
17
  const activity_history_1 = require("@tomei/activity-history");
18
+ const sequelize_1 = require("sequelize");
18
19
  class APIKey extends general_1.ObjectBase {
19
20
  get APIKeyId() {
20
21
  return parseInt(this.ObjectId);
@@ -22,11 +23,11 @@ class APIKey extends general_1.ObjectBase {
22
23
  set APIKeyId(value) {
23
24
  this.ObjectId = value.toString();
24
25
  }
25
- get InvokedById() {
26
- return this._InvokedById;
26
+ get RevokedById() {
27
+ return this._RevokedById;
27
28
  }
28
- get InvokedAt() {
29
- return this._InvokedAt;
29
+ get RevokedAt() {
30
+ return this._RevokedAt;
30
31
  }
31
32
  get CreatedAt() {
32
33
  return this._CreatedAt;
@@ -43,8 +44,8 @@ class APIKey extends general_1.ObjectBase {
43
44
  this.Description = apiKeyAttr.Description;
44
45
  this.Status = apiKeyAttr.Status;
45
46
  this.ExpirationDate = apiKeyAttr.ExpirationDate;
46
- this._InvokedById = apiKeyAttr.InvokedById;
47
- this._InvokedAt = apiKeyAttr.InvokedAt;
47
+ this._RevokedById = apiKeyAttr.RevokedById;
48
+ this._RevokedAt = apiKeyAttr.RevokedAt;
48
49
  this._CreatedAt = apiKeyAttr.CreatedAt;
49
50
  this._CreatedById = apiKeyAttr.CreatedById;
50
51
  }
@@ -86,8 +87,9 @@ class APIKey extends general_1.ObjectBase {
86
87
  ExpirationDate: this.ExpirationDate,
87
88
  CreatedAt: this.CreatedAt,
88
89
  CreatedById: this.CreatedById,
89
- InvokedAt: this.InvokedAt,
90
- InvokedById: this.InvokedById,
90
+ RevokedAt: this.RevokedAt,
91
+ RevokedById: this.RevokedById,
92
+ RevokedReason: this.RevokedReason,
91
93
  };
92
94
  const data = yield APIKey._Repo.create(EntityValueAfter, {
93
95
  transaction: dbTransaction,
@@ -111,8 +113,79 @@ class APIKey extends general_1.ObjectBase {
111
113
  ExpirationDate: this.ExpirationDate,
112
114
  CreatedAt: this.CreatedAt,
113
115
  CreatedById: this.CreatedById,
114
- InvokedAt: this.InvokedAt,
115
- InvokedById: this.InvokedById,
116
+ RevokedAt: this.RevokedAt,
117
+ RevokedById: this.RevokedById,
118
+ RevokedReason: this.RevokedReason,
119
+ };
120
+ }
121
+ catch (error) {
122
+ throw error;
123
+ }
124
+ });
125
+ }
126
+ findAll(pagination, loginUser, dbTransaction, whereOptions, sortOptions) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ try {
129
+ const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
130
+ const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'API_KEY_VIEW');
131
+ if (!isPrivileged) {
132
+ throw new general_1.ClassError('APIKey', 'APIKeyErrMsgO2', 'User does not have privilege to generate API key.', 'generate');
133
+ }
134
+ const where = {};
135
+ if (whereOptions) {
136
+ if (whereOptions.Status) {
137
+ where['Status'] = whereOptions.Status;
138
+ }
139
+ if (whereOptions.ExpirationDate) {
140
+ where['ExpirationDate'] = {
141
+ [sequelize_1.Op.between]: [
142
+ whereOptions.ExpirationDate.FromDate,
143
+ whereOptions.ExpirationDate.ToDate,
144
+ ],
145
+ };
146
+ }
147
+ if (whereOptions.CreatedById) {
148
+ where['CreatedById'] = whereOptions.CreatedById;
149
+ }
150
+ }
151
+ const order = [];
152
+ if (sortOptions) {
153
+ if (sortOptions.SortBy) {
154
+ order.push([sortOptions.SortBy, sortOptions.SortOrder]);
155
+ }
156
+ }
157
+ else {
158
+ order.push(['CreatedAt', 'DESC']);
159
+ }
160
+ let offset = 0;
161
+ if (pagination) {
162
+ offset = (pagination.page - 1) * pagination.limit;
163
+ }
164
+ const data = yield APIKey._Repo.findAllWithPagination({
165
+ where,
166
+ order,
167
+ offset,
168
+ limit: pagination.limit,
169
+ transaction: dbTransaction,
170
+ });
171
+ return {
172
+ total: data.count,
173
+ ApiKeys: data.rows.map((row) => {
174
+ return {
175
+ ApiKeyId: row.APIKeyId,
176
+ ApiKey: row.ApiKey,
177
+ Name: row.Name,
178
+ Status: row.Status,
179
+ ExpirationDate: row.ExpirationDate,
180
+ CreatedAt: row.CreatedAt,
181
+ CreatedById: row.CreatedById,
182
+ RevokedAt: row.RevokedAt,
183
+ RevokedById: row.RevokedById,
184
+ RevokedReason: row.RevokedReason,
185
+ };
186
+ }),
187
+ page: pagination.page,
188
+ limit: pagination.limit,
116
189
  };
117
190
  }
118
191
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.js","sourceRoot":"","sources":["../../../../src/components/api-key/api-key.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAwD;AAExD,6DAAwD;AAGxD,0CAAkD;AAClD,mCAAiD;AACjD,8DAA+D;AAE/D,MAAa,MAAO,SAAQ,oBAAU;IAgBpC,IAAI,QAAQ;QACV,OAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;IAED,IAAI,QAAQ,CAAC,KAAa;QACxB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAID,YAAsB,UAAwB;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;YACpC,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YAChC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;YAC5B,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC;YAC1C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;YAChC,IAAI,CAAC,cA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E,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;wBAC7B,OAAO;4BACL,QAAQ,EAAE,GAAG,CAAC,QAAQ;4BACtB,MAAM,EAAE,GAAG,CAAC,MAAM;4BAClB,IAAI,EAAE,GAAG,CAAC,IAAI;4BACd,MAAM,EAAE,GAAG,CAAC,MAAM;4BAClB,cAAc,EAAE,GAAG,CAAC,cAAc;4BAClC,SAAS,EAAE,GAAG,CAAC,SAAS;4BACxB,WAAW,EAAE,GAAG,CAAC,WAAW;4BAC5B,SAAS,EAAE,GAAG,CAAC,SAAS;4BACxB,WAAW,EAAE,GAAG,CAAC,WAAW;4BAC5B,aAAa,EAAE,GAAG,CAAC,aAAa;yBACjC,CAAC;oBACJ,CAAC,CAAC;oBACF,IAAI,EAAE,UAAU,CAAC,IAAI;oBACrB,KAAK,EAAE,UAAU,CAAC,KAAK;iBACxB,CAAC;aACH;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,KAAK,CAAC;aACb;QACH,CAAC;KAAA;;AA5TH,wBA6TC;AApRkB,YAAK,GAAG,IAAI,qCAAgB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export declare enum APIKeyStatusEnum {
2
2
  ACTIVE = "Active",
3
- INACTIVE = "Inactive",
3
+ REVOKED = "Revoked",
4
4
  EXPIRED = "Expired"
5
5
  }
@@ -4,7 +4,7 @@ exports.APIKeyStatusEnum = void 0;
4
4
  var APIKeyStatusEnum;
5
5
  (function (APIKeyStatusEnum) {
6
6
  APIKeyStatusEnum["ACTIVE"] = "Active";
7
- APIKeyStatusEnum["INACTIVE"] = "Inactive";
7
+ APIKeyStatusEnum["REVOKED"] = "Revoked";
8
8
  APIKeyStatusEnum["EXPIRED"] = "Expired";
9
9
  })(APIKeyStatusEnum = exports.APIKeyStatusEnum || (exports.APIKeyStatusEnum = {}));
10
10
  //# sourceMappingURL=api-key.enum.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-key.enum.js","sourceRoot":"","sources":["../../../src/enum/api-key.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
1
+ {"version":3,"file":"api-key.enum.js","sourceRoot":"","sources":["../../../src/enum/api-key.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;AACrB,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
@@ -7,7 +7,8 @@ export interface IAPIKeyAttr {
7
7
  Status: APIKeyStatusEnum;
8
8
  ExpirationDate: Date;
9
9
  CreatedById: number;
10
- InvokedById: number;
10
+ RevokedById: number;
11
11
  CreatedAt: Date;
12
- InvokedAt: Date;
12
+ RevokedAt: Date;
13
+ RevokedReason: string;
13
14
  }
@@ -9,9 +9,10 @@ export default class APIKeyModel extends Model {
9
9
  Status: APIKeyStatusEnum;
10
10
  ExpirationDate: Date;
11
11
  CreatedById: number;
12
- InvokedById: number;
12
+ RevokedById: number;
13
13
  CreatedAt: Date;
14
- InvokedAt: Date;
14
+ RevokedAt: Date;
15
+ RevokedReason: string;
15
16
  CreatedByUser: User;
16
17
  UpdatedByUser: User;
17
18
  }
@@ -27,7 +27,6 @@ __decorate([
27
27
  (0, sequelize_typescript_1.Column)({
28
28
  type: sequelize_typescript_1.DataType.STRING(128),
29
29
  }),
30
- (0, sequelize_typescript_1.Index)('IDX_ApiKey'),
31
30
  __metadata("design:type", String)
32
31
  ], APIKeyModel.prototype, "ApiKey", void 0);
33
32
  __decorate([
@@ -63,7 +62,6 @@ __decorate([
63
62
  (0, sequelize_typescript_1.Column)({
64
63
  type: sequelize_typescript_1.DataType.INTEGER,
65
64
  }),
66
- (0, sequelize_typescript_1.Index)('IDX_CreatedById'),
67
65
  __metadata("design:type", Number)
68
66
  ], APIKeyModel.prototype, "CreatedById", void 0);
69
67
  __decorate([
@@ -71,9 +69,8 @@ __decorate([
71
69
  (0, sequelize_typescript_1.Column)({
72
70
  type: sequelize_typescript_1.DataType.INTEGER,
73
71
  }),
74
- (0, sequelize_typescript_1.Index)('IDX_InvokedById'),
75
72
  __metadata("design:type", Number)
76
- ], APIKeyModel.prototype, "InvokedById", void 0);
73
+ ], APIKeyModel.prototype, "RevokedById", void 0);
77
74
  __decorate([
78
75
  sequelize_typescript_1.CreatedAt,
79
76
  __metadata("design:type", Date)
@@ -84,7 +81,14 @@ __decorate([
84
81
  allowNull: true,
85
82
  }),
86
83
  __metadata("design:type", Date)
87
- ], APIKeyModel.prototype, "InvokedAt", void 0);
84
+ ], APIKeyModel.prototype, "RevokedAt", void 0);
85
+ __decorate([
86
+ (0, sequelize_typescript_1.Column)({
87
+ type: sequelize_typescript_1.DataType.TEXT,
88
+ allowNull: true,
89
+ }),
90
+ __metadata("design:type", String)
91
+ ], APIKeyModel.prototype, "RevokedReason", void 0);
88
92
  __decorate([
89
93
  (0, sequelize_typescript_1.BelongsTo)(() => user_entity_1.default, 'CreatedById'),
90
94
  __metadata("design:type", user_entity_1.default)
@@ -1 +1 @@
1
- {"version":3,"file":"api-key-entity.js","sourceRoot":"","sources":["../../../src/models/api-key-entity.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAS8B;AAC9B,+CAAiC;AACjC,uDAAwD;AAQzC,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,4BAAK;CAmE7C,CAAA;AAlEC;IAAC,IAAA,6BAAM,EAAC;QACN,UAAU,EAAE,IAAI;QAChB,IAAI,EAAE,+BAAQ,CAAC,OAAO;QACtB,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;KACpB,CAAC;;6CACe;AAEjB;IAAC,IAAA,6BAAM,EAAC;QACN,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