@justair/justair-library 7.15.0-alpha.9cbd0e1 → 7.15.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"emailChangeToken.d.ts","sourceRoot":"","sources":["../../src/models/emailChangeToken.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUE;AAOF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAoF;qBA3C/D,UAAU"}
1
+ {"version":3,"file":"emailChangeToken.d.ts","sourceRoot":"","sources":["../../src/models/emailChangeToken.js"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUE;AAYF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAoF;qBAjD/D,UAAU"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justair/justair-library",
3
- "version": "7.15.0-alpha.9cbd0e1",
3
+ "version": "7.15.0",
4
4
  "description": "JustAir Internal Library",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -19,8 +19,9 @@ import mongoose from 'mongoose';
19
19
  // The TTL index below does NOT delete at expiry: it sweeps a day later, so an
20
20
  // expired, unclicked request stays readable and GET /admin/me can report
21
21
  // "expired" to the profile page for that day (Figma "Email update not
22
- // verified."). The lingering row is a SHA-256 hash the consume query refuses,
23
- // so keeping it costs nothing but the row.
22
+ // verified."). The lingering row holds adminId, the requested newEmail and a
23
+ // SHA-256 hash the consume query refuses; no raw token, nothing a client
24
+ // could use, but the unverified address does sit here a day longer.
24
25
  //
25
26
  // Requesting a second change for the same admin marks every earlier unused token
26
27
  // used (updateMany) before minting the new one, so only the newest link works.
@@ -38,6 +39,11 @@ const emailChangeTokenSchema = new mongoose.Schema(
38
39
 
39
40
  // TTL index — MongoDB removes the doc 24h after expiresAt, not at expiresAt
40
41
  // (see the header comment: the row must outlive the link to report "expired").
42
+ // MongoDB will not change expireAfterSeconds on an index that already exists:
43
+ // a database that built this index from a pre-release alpha (expireAfterSeconds
44
+ // 0) keeps deleting at expiry until it is told otherwise, once, in mongosh:
45
+ // db.runCommand({ collMod: 'emailchangetokens',
46
+ // index: { keyPattern: { expiresAt: 1 }, expireAfterSeconds: 86400 } })
41
47
  const EXPIRED_ROW_RETENTION_SECONDS = 24 * 60 * 60;
42
48
  emailChangeTokenSchema.index({ expiresAt: 1 }, { expireAfterSeconds: EXPIRED_ROW_RETENTION_SECONDS });
43
49