ident
All repositories: gitoria
3.8 KB
// tests/oldstore-009.hl — THE MIGRATION FIXTURE (tests/migration.mjs): an ident store in the// OLD format (before mission 009: `*id` tables `<prefix>-<table>.*`, public ids = id + 1),// with known keys, secret hashes and per-app ids. OLD_PREFIX=/abs/dir/ident// The ids are EXPLICIT (id = 0, 1, …) since hybriel 5bb08628 (#4): a fresh `*id` table counts from 1// now, the old tables counted from 0 (mission 048).import { MPackDB } from 'hl:mpackdb'import { env } from 'hl:proc'import { now } from 'hl:time'import { sha256 } from 'hl:crypto'p = env('OLD_PREFIX')accounts = new MPackDB(file = p + '-accounts.db', primaryKey = '*id', indexes = ['!email'])identities = new MPackDB(file = p + '-identities.db', primaryKey = '*id', indexes = ['account'])otp = new MPackDB(file = p + '-otp.db', primaryKey = '*id', indexes = ['email'])sends = new MPackDB(file = p + '-sends.db', primaryKey = '*id', indexes = ['email'])apps = new MPackDB(file = p + '-apps.db', primaryKey = '*id', indexes = ['owner' '!apiKey'])conns = new MPackDB(file = p + '-connections.db', primaryKey = '*id', indexes = ['!pair' 'app' '!appIdentity'])requests = new MPackDB(file = p + '-requests.db', primaryKey = '*id', indexes = ['!rid'])grants = new MPackDB(file = p + '-grants.db', primaryKey = '*id', indexes = ['!hash'])t = now()x = (c, n) => {let s = ''while (s.length < n) { s = s + c }return s}accounts.put({ id = 0 email = '[email protected]' timeZone = 'Europe/Vienna' created = t - 90000 }) // public 1accounts.put({ id = 1 email = '[email protected]' timeZone = 'Asia/Tokyo' created = t - 80000 }) // public 2identities.put({ id = 0 account = 1 identityName = 'Default' nickname = 'Al' firstname = 'Alice' lastname = 'Example' created = t - 89000 updated = t - 1000 }) // 1identities.put({ id = 1 account = 1 identityName = 'Work' nickname = '' firstname = '' lastname = '' created = t - 70000 updated = t - 70000 }) // 2identities.put({ id = 2 account = 2 identityName = 'Default' nickname = '' firstname = '' lastname = '' created = t - 79000 updated = t - 79000 }) // 3gone = identities.put({ id = 3 account = 1 identityName = 'Old' nickname = '' firstname = '' lastname = '' created = t - 60000 updated = t - 60000 }) // 4, deleted belowapps.put({ id = 0 owner = 1 name = 'Fixture app' origins = 'http://127.0.0.1:8396' apiKey = 'pk_' + x('1', 32) secretHash = sha256('sk_' + x('2', 48)) created = t - 50000 updated = t - 50000 }) // 1apps.put({ id = 1 owner = 2 name = 'Bob app' origins = 'http://127.0.0.1:8397' apiKey = 'pk_' + x('3', 32) secretHash = sha256('sk_' + x('4', 48)) created = t - 40000 updated = t - 40000 }) // 2conns.put({ id = 0 pair = '1:1' app = 1 identity = 1 appIdentity = x('a', 32) created = t - 49000 })conns.put({ id = 1 pair = '1:2' app = 1 identity = 2 appIdentity = x('b', 32) created = t - 48000 })conns.put({ id = 2 pair = '1:4' app = 1 identity = 4 appIdentity = x('c', 32) created = t - 47000 })conns.put({ id = 3 pair = '2:3' app = 2 identity = 3 appIdentity = x('d', 32) created = t - 39000 })identities.delete(gone)sends.put({ id = 0 email = '[email protected]' at = t - 1000 })otp.put({ id = 0 email = '[email protected]' hash = sha256('[email protected]:123456') expires = t + 600000 tries = 0 })requests.put({ id = 0 rid = x('f', 32) app = 1 returnUrl = 'http://127.0.0.1:8396/callback' expires = t + 1800000 })grants.put({ id = 0 hash = sha256(x('e', 48)) app = 1 identity = 2 appIdentity = x('b', 32) expires = t + 3600000 })console.log('oldstore: accounts ' + accounts.count() + ' identities ' + identities.count() + ' apps ' + apps.count() + ' connections ' + conns.count() + ' otp ' + otp.count() + ' sends ' + sends.count() + ' requests ' + requests.count() + ' grants ' + grants.count())
Branches
Latest commits
- 021dd0fcident mission 012: browser gate waits cold start (IDENT_COLD_MS), header selectors, e2e checks; shell events from a page do not reach it (probe), current not marked, account-bar link 44 pxmre
- 97f77b07ident mission 012 (WIP): onto the layouts theme dbe3de7, shell on AppHeader/MainMenu/UserMenu/Sidebar + ContentFirst, styles cut, check-theme gatemre
- 8e4f435bpaths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- fa288f63ident mission 011: report wording (Intl zone names)mre
- 961fae01ident mission 011: report, LOG, STATUSmre
- 65348039ident#7: delivery gate — console check split at the gate's own server restart (49 checks)mre
- dfa7b783ident#7: README (Delivery, env, gate, files, data), deploy.sh runs tests/delivery.mjsmre
- ab6331f4ident#7: tests/delivery.mjs — fake clock gate: Vienna/New York/Tokyo/UTC 17:00, urgent, mail off, restart, DST days, zone changemre
- 7869f57bident#7: delivery — the daily mail at 17:00 in the user's zone (digests table, once per local day, test clock IDENT_TEST_CLOCK), urgent mailed at once, push hookmre
- 371ef1b5ident#7: lib/mail.hl sendNotificationMail (sink: <sink>.mail, one JSON line per mail)mre
- 39749e0bident#7: time zones through hl:time — server checks isZone, an account without a known zone reads as UTC, allAccountsmre
- 7a54fe72mission brief 011mre
- a6a874cdident mission 010: vendor hybriel 0f396652 (plugins + compose cache volume/tmpfs + deploy URL wait + report)mre
- 4e7cf78emission brief 010mre
- e8b2b0f7docker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
- 5fdbb6b2ident mission 009: report — scratch folder notemre
- 74235815ident mission 009 (4/4): docs (README files map + same-output test, STATUS, LOG), report, tests/letcount.py + realdata-baseline/comparemre
- fe183516ident mission 009 (3/4): let only where reassigned — 293 never-reassigned lets are plain declarations; kept: reassigned, loop bodies, names of a file member, a name declared twice in one function; same outputmre
- d2e7f91bident mission 009 (2/4): one lib file per topic (login, accounts, identities, apps, invites, selector, notify + helpers, util), function routes as thin wrappers in lib/api.hl, project.hl = the map; same outputmre
- 91017164ident mission 009 (1/4): file moves — the root .hl files into lib/ (api.hl → lib/api-helpers.hl), styles.hl → components/styles.hl; imports adjusted, no other changemre