ident
All repositories: gitoria
4.0 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')ta = env('OLD_TESTAPP') != null && env('OLD_TESTAPP') != '' ? env('OLD_TESTAPP') : 'http://127.0.0.1:8396' // the fixture app's origin (migration.mjs passes its TA)bob = env('OLD_BOBAPP') != null && env('OLD_BOBAPP') != '' ? env('OLD_BOBAPP') : 'http://127.0.0.1:8397' // Bob's app origin (migration.mjs passes its BOB)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 = ta 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 = bob 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 = ta + '/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
- d69665f6|||PR ident#34 part 3: shared look classes (wide, avatar, chip/used, conn, choose, who, inboxlink) moved to statics or droppedmre
- 3a64dc48ident#34: chipLook: radius as the same var() string (a bare token name in a static does not compile); selector gate selectormre
- eb039073ident#34: tests: signin and migration find the choice without the classmre
- 4b94a594ident#34: tests: fix selector of the identity choicemre
- bebc88e4ident#34: main.hl drops the unstyled classes inboxlink and whomre
- b4e7ad04ident#34: the identity choice link/button has no class (rule on #chooselist a)mre
- 3c33d6eaident#34: the connection link in inbox has no class (rule on #conns a)mre
- dc97ec0dident#34: the Notif. chip and the Used in link share chipLook (Style.pChip) instead of the classes chip/used/notifmre
- 378bd432ident#34: the identity picture look is a static in styles.hl (Style.pAvatar); sizes stay with each listmre
- 1cf79e7eident#34: the wide page column is a static in styles.hl (Style.pWide), not the class "wide"mre
- ddc7d135Merge branch 'f7-hooks' into mainIdent
- eee0b513|||PR ident#34 part: test-hook classes replaced by name/element/attribute selectors (tests adjusted), the shared lead/message/notice looks are statics in styles.hlmre
- ccd6d0c4ident#34: browser gate: rowButton finds the row's button by namemre
- 24dd414eident#34: the shared lead, message and notice looks are statics in components/styles.hl, imported by the components (lib/looks.hl gone)mre
- 03ed26c7ident#34: access.hl: the remaining lead classes droppedmre
- 1d066c42ident#34: access.hl drops its unstyled lead class (the shared lead rule would otherwise mute it)mre
- 1e1dd7b4ident#34: the access page keeps its lead class string (the page has no ident-card, so its lead line was never muted; a shared rule would change the look)mre
- 89ac6553ident#34: the lead, message and notice lines are named with Style.pLead / pMessage / pNotice (shared bodies in lib/looks.hl) instead of class stringsmre
- e84be3deident#34: browser gate lists the Edit/Delete buttons by namemre
- fb7111faident#34: access page: unstyled test-hook classes (idrow, never, who, whoname, appname, neverrevoke) dropped; the tests use element/name selectorsmre