@natrave/shared-entities 1.6.0 → 1.6.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/dist/app-auth/refresh-tokens/refresh-token.entity.d.ts +4 -0
- package/dist/app-auth/refresh-tokens/refresh-token.entity.d.ts.map +1 -1
- package/dist/app-auth/refresh-tokens/refresh-token.entity.js +40 -1
- package/dist/app-auth/users/user.entity.d.ts +1 -0
- package/dist/app-auth/users/user.entity.d.ts.map +1 -1
- package/dist/app-auth/users/user.entity.js +10 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-token.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/refresh-tokens/refresh-token.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"refresh-token.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/refresh-tokens/refresh-token.entity.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAYhC,qBAOa,YAAY;IAEvB,EAAE,EAAE,MAAM,CAAC;IAOX,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAQvB,KAAK,EAAE,MAAM,CAAC;IASd,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC;IAQpB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAQjC,oBAAoB,EAAE,MAAM,CAAC;IAO7B,MAAM,EAAE,MAAM,CAAC;IASf,IAAI,EAAE,IAAI,CAAC;CACZ"}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Column,
|
|
13
13
|
CreateDateColumn,
|
|
14
14
|
Entity,
|
|
15
|
+
Index,
|
|
15
16
|
JoinColumn,
|
|
16
17
|
ManyToOne,
|
|
17
18
|
PrimaryGeneratedColumn,
|
|
@@ -53,6 +54,39 @@ __decorateClass([
|
|
|
53
54
|
comment: "Token de atualiza\xE7\xE3o propriamente dito, utilizado para renovar a sess\xE3o."
|
|
54
55
|
})
|
|
55
56
|
], RefreshToken.prototype, "token", 2);
|
|
57
|
+
__decorateClass([
|
|
58
|
+
Column({
|
|
59
|
+
name: "token_hash",
|
|
60
|
+
type: "char",
|
|
61
|
+
length: 64,
|
|
62
|
+
nullable: true,
|
|
63
|
+
comment: "Hash do refresh token para lookup e valida\xE7\xE3o sem armazenar o token em claro."
|
|
64
|
+
})
|
|
65
|
+
], RefreshToken.prototype, "tokenHash", 2);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
Column({
|
|
68
|
+
name: "used_at",
|
|
69
|
+
type: "timestamptz",
|
|
70
|
+
nullable: true,
|
|
71
|
+
comment: "Data e hora em que o refresh token foi utilizado."
|
|
72
|
+
})
|
|
73
|
+
], RefreshToken.prototype, "usedAt", 2);
|
|
74
|
+
__decorateClass([
|
|
75
|
+
Column({
|
|
76
|
+
name: "replaced_by_token_id",
|
|
77
|
+
type: "uuid",
|
|
78
|
+
nullable: true,
|
|
79
|
+
comment: "ID do novo refresh token que substituiu este token."
|
|
80
|
+
})
|
|
81
|
+
], RefreshToken.prototype, "replacedByTokenId", 2);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
Column({
|
|
84
|
+
name: "issued_session_version",
|
|
85
|
+
type: "int",
|
|
86
|
+
default: 0,
|
|
87
|
+
comment: "Vers\xE3o da sess\xE3o do usu\xE1rio no momento da emiss\xE3o do refresh token."
|
|
88
|
+
})
|
|
89
|
+
], RefreshToken.prototype, "issuedSessionVersion", 2);
|
|
56
90
|
__decorateClass([
|
|
57
91
|
Column({
|
|
58
92
|
name: "user_id",
|
|
@@ -66,7 +100,12 @@ __decorateClass([
|
|
|
66
100
|
], RefreshToken.prototype, "user", 2);
|
|
67
101
|
RefreshToken = __decorateClass([
|
|
68
102
|
Entity("refresh_tokens"),
|
|
69
|
-
Unique(["token"])
|
|
103
|
+
Unique(["token"]),
|
|
104
|
+
Index("UQ_refresh_tokens_token_hash", ["tokenHash"], {
|
|
105
|
+
unique: true,
|
|
106
|
+
where: '"token_hash" IS NOT NULL'
|
|
107
|
+
}),
|
|
108
|
+
Index("IDX_refresh_tokens_user_id_revoked_at", ["userId", "revokedAt"])
|
|
70
109
|
], RefreshToken);
|
|
71
110
|
export {
|
|
72
111
|
RefreshToken
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/users/user.entity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,
|
|
1
|
+
{"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../../src/app-auth/users/user.entity.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAa7C,qBAkBa,IAAI;IAIf,EAAE,EAAE,MAAM,CAAC;IAUX,SAAS,EAAE,MAAM,CAAC;IAOlB,SAAS,EAAE,IAAI,CAAC;IAOhB,SAAS,EAAE,IAAI,CAAC;IAQhB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IASvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAQpB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAQzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAQ3B,KAAK,EAAE,MAAM,CAAC;IAQd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAQtB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAS5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAUvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IASrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAQxB,cAAc,EAAE,MAAM,CAAC;IAKvB,aAAa,EAAE,YAAY,EAAE,CAAC;IAK9B,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;IAKtC,MAAM,EAAE,MAAM,CAAC;IAGf,aAAa,EAAE,YAAY,EAAE,CAAC;IAG9B,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAMpC,sBAAsB,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAG1D,8BAA8B,EAAE,6BAA6B,EAAE,CAAC;IAMhE,WAAW,IAAI,IAAI;CAGpB"}
|
|
@@ -147,6 +147,14 @@ __decorateClass([
|
|
|
147
147
|
comment: "URL da imagem de perfil do usu\xE1rio."
|
|
148
148
|
})
|
|
149
149
|
], User.prototype, "imageUrl", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
Column({
|
|
152
|
+
name: "session_version",
|
|
153
|
+
type: "int",
|
|
154
|
+
default: 0,
|
|
155
|
+
comment: "Vers\xE3o atual de sess\xE3o do usu\xE1rio para invalida\xE7\xE3o global de refresh tokens."
|
|
156
|
+
})
|
|
157
|
+
], User.prototype, "sessionVersion", 2);
|
|
150
158
|
__decorateClass([
|
|
151
159
|
OneToMany(() => RefreshToken, (refreshToken) => refreshToken.user)
|
|
152
160
|
], User.prototype, "refreshTokens", 2);
|
|
@@ -195,7 +203,8 @@ User = __decorateClass([
|
|
|
195
203
|
Index("IDX_users_created_at", ["createdAt"]),
|
|
196
204
|
Index("IDX_users_updated_at", ["updatedAt"]),
|
|
197
205
|
Index("IDX_users_name", ["name"], { where: '"deleted_at" IS NULL' }),
|
|
198
|
-
Index("IDX_users_gender", ["gender"], { where: '"deleted_at" IS NULL' })
|
|
206
|
+
Index("IDX_users_gender", ["gender"], { where: '"deleted_at" IS NULL' }),
|
|
207
|
+
Index("IDX_users_id_session_version", ["id", "sessionVersion"])
|
|
199
208
|
], User);
|
|
200
209
|
export {
|
|
201
210
|
User
|