@proteinjs/user 1.19.0 → 1.19.2
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/CHANGELOG.md +19 -0
- package/dist/src/tables/InviteTable.d.ts +9 -2
- package/dist/src/tables/InviteTable.d.ts.map +1 -1
- package/dist/src/tables/InviteTable.js +10 -2
- package/dist/src/tables/InviteTable.js.map +1 -1
- package/dist/src/tables/UserActivityTable.d.ts +7 -7
- package/dist/test/recordTableDeclarations.test.js +6 -0
- package/dist/test/recordTableDeclarations.test.js.map +1 -1
- package/dist/test/tablesAuth.test.js +15 -0
- package/dist/test/tablesAuth.test.js.map +1 -1
- package/package.json +3 -3
- package/src/tables/InviteTable.ts +10 -2
- package/src/tables/UserActivityTable.ts +7 -7
- package/test/recordTableDeclarations.test.ts +6 -0
- package/test/tablesAuth.test.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.19.2](https://github.com/proteinjs/user/compare/@proteinjs/user@1.19.1...@proteinjs/user@1.19.2) (2026-09-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **user:** the invite table declares its create act as a list action — 'users' holders reach the Send invite form from the record table again (Table.ui.recordTable.actions: kind create, door users, label 'Send invite'); the insert doors stay closed, invites are minted by SignupService only ([5480404](https://github.com/proteinjs/user/commit/54804041f4889bd38371f37430c3ad2499f15b04))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [1.19.1](https://github.com/proteinjs/user/compare/@proteinjs/user@1.19.0...@proteinjs/user@1.19.1) (2026-09-12)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @proteinjs/user
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [1.19.0](https://github.com/proteinjs/user/compare/@proteinjs/user@1.18.0...@proteinjs/user@1.19.0) (2026-09-12)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -16,13 +16,20 @@ export declare class InviteTable extends Table<Invite> {
|
|
|
16
16
|
* writes stay closed. The db doors mirror the service doors — `DbService`'s inner `Db`
|
|
17
17
|
* re-checks the db api as the calling user (see the user table); server code proper uses
|
|
18
18
|
* system paths, which bypass TableAuth.
|
|
19
|
+
*
|
|
20
|
+
* The record table's create act is a DECLARED list action (`ui.recordTable.actions`), not an
|
|
21
|
+
* insert door: the generic surfaces derive the `+` from the insert doors, and with those closed
|
|
22
|
+
* by design the table drew no way to reach the new-record form's own Send act (no `+` on
|
|
23
|
+
* Invites, on any form factor). The action's door names exactly who the send act serves; the
|
|
24
|
+
* act stays gated in the form (`InviteRecordFormCustomization`) and in `SignupService`.
|
|
19
25
|
*/
|
|
20
26
|
auth: Table<Invite>['auth'];
|
|
21
27
|
/**
|
|
22
28
|
* The row scan: who's invited, by whom, until when. The redeemable `token` is auth material
|
|
23
29
|
* with no business in a row scan (founder admin review, v1.22 — also a hygiene win); it stays
|
|
24
|
-
* on the record form for the odd support case. The
|
|
25
|
-
*
|
|
30
|
+
* on the record form for the odd support case. The list actions: the create act, for 'users'
|
|
31
|
+
* holders, named for what it is — an invite is sent, never "created" (the form's button says
|
|
32
|
+
* the same); the delete act stays derived from the delete doors.
|
|
26
33
|
*/
|
|
27
34
|
ui: Table<Invite>['ui'];
|
|
28
35
|
columns: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InviteTable.d.ts","sourceRoot":"","sources":["../../../src/tables/InviteTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,MAAM,EAGN,SAAS,EAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAa,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF,qBAAa,WAAY,SAAQ,KAAK,CAAC,MAAM,CAAC;IAC5C,IAAI,SAAY;IAChB
|
|
1
|
+
{"version":3,"file":"InviteTable.d.ts","sourceRoot":"","sources":["../../../src/tables/InviteTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,EACL,MAAM,EAGN,SAAS,EAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,IAAI,EAAa,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF,qBAAa,WAAY,SAAQ,KAAK,CAAC,MAAM,CAAC;IAC5C,IAAI,SAAY;IAChB;;;;;;;;;;;;;OAaG;IACH,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CASzB;IACF;;;;;;OAMG;IACH,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAKrB;IACF,OAAO;;;;;;;;;WAWJ;CACJ"}
|
|
@@ -31,6 +31,12 @@ var InviteTable = /** @class */ (function (_super) {
|
|
|
31
31
|
* writes stay closed. The db doors mirror the service doors — `DbService`'s inner `Db`
|
|
32
32
|
* re-checks the db api as the calling user (see the user table); server code proper uses
|
|
33
33
|
* system paths, which bypass TableAuth.
|
|
34
|
+
*
|
|
35
|
+
* The record table's create act is a DECLARED list action (`ui.recordTable.actions`), not an
|
|
36
|
+
* insert door: the generic surfaces derive the `+` from the insert doors, and with those closed
|
|
37
|
+
* by design the table drew no way to reach the new-record form's own Send act (no `+` on
|
|
38
|
+
* Invites, on any form factor). The action's door names exactly who the send act serves; the
|
|
39
|
+
* act stays gated in the form (`InviteRecordFormCustomization`) and in `SignupService`.
|
|
34
40
|
*/
|
|
35
41
|
_this.auth = {
|
|
36
42
|
db: {
|
|
@@ -45,12 +51,14 @@ var InviteTable = /** @class */ (function (_super) {
|
|
|
45
51
|
/**
|
|
46
52
|
* The row scan: who's invited, by whom, until when. The redeemable `token` is auth material
|
|
47
53
|
* with no business in a row scan (founder admin review, v1.22 — also a hygiene win); it stays
|
|
48
|
-
* on the record form for the odd support case. The
|
|
49
|
-
*
|
|
54
|
+
* on the record form for the odd support case. The list actions: the create act, for 'users'
|
|
55
|
+
* holders, named for what it is — an invite is sent, never "created" (the form's button says
|
|
56
|
+
* the same); the delete act stays derived from the delete doors.
|
|
50
57
|
*/
|
|
51
58
|
_this.ui = {
|
|
52
59
|
recordTable: {
|
|
53
60
|
columns: ['email', 'invitedBy', 'tokenExpiresAt'],
|
|
61
|
+
actions: [{ kind: 'create', label: 'Send invite', door: { permission: permissions_1.USER_PERMISSIONS.users } }],
|
|
54
62
|
},
|
|
55
63
|
};
|
|
56
64
|
_this.columns = (0, db_1.withRecordColumns)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InviteTable.js","sourceRoot":"","sources":["../../../src/tables/InviteTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAQuB;AAEvB,8CAAkD;AAClD,yCAA8C;AAS9C;IAAiC,+BAAa;IAA9C;QAAA,
|
|
1
|
+
{"version":3,"file":"InviteTable.js","sourceRoot":"","sources":["../../../src/tables/InviteTable.ts"],"names":[],"mapp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;AAnDY,kCAAW"}
|
|
@@ -10,13 +10,13 @@ import { ScopedRecord } from '../ScopedRecord';
|
|
|
10
10
|
* touch / wheel event through `UserPresenceService.recordPresence` (user-ui's
|
|
11
11
|
* UserPresenceReporter, throttled per page), and user-server's UserActivityStamp writes the row
|
|
12
12
|
* from that door only. Transport was the previous key (the per-request session-cache build) and
|
|
13
|
-
* it over-counted (
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
13
|
+
* it over-counted (every user read as "last active today"): an open tab polls, a socket re-joins
|
|
14
|
+
* its rooms on every reconnect, a deploy reloads every idle tab — all of it arrives over a live
|
|
15
|
+
* session with nobody there. Machinery acting on a user's behalf (scheduled jobs, watchers,
|
|
16
|
+
* background runs under seeded contexts) has no page to report from, so it structurally cannot
|
|
17
|
+
* stamp; machine accounts are refused by the stamp. Deliberately NOT derived from any usage or
|
|
18
|
+
* spend ledger: spend measures machine work (which background jobs rack up all day), not the
|
|
19
|
+
* human being present.
|
|
20
20
|
*
|
|
21
21
|
* Reads are people-management trust ('users', the Users-page permission); writes are
|
|
22
22
|
* system-written only (no service/db write door onto the row — the stamp rides the system
|
|
@@ -24,6 +24,12 @@ describe('admin row-scan declarations', function () {
|
|
|
24
24
|
expect(table.columns[column]).toBeDefined();
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
it('invite list actions: one declared act — the create act, named for what it is (Send invite)', function () {
|
|
28
|
+
var _a, _b, _c;
|
|
29
|
+
var table = new InviteTable_1.InviteTable();
|
|
30
|
+
var actions = (_c = (_b = (_a = table.ui) === null || _a === void 0 ? void 0 : _a.recordTable) === null || _b === void 0 ? void 0 : _b.actions) !== null && _c !== void 0 ? _c : [];
|
|
31
|
+
expect(actions.map(function (action) { return [action.kind, action.label]; })).toEqual([['create', 'Send invite']]);
|
|
32
|
+
});
|
|
27
33
|
it('session rows: whose, when it dies, which one — never the serialized session', function () {
|
|
28
34
|
var _a, _b;
|
|
29
35
|
var table = new SessionTable_1.SessionTable();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordTableDeclarations.test.js","sourceRoot":"","sources":["../../test/recordTableDeclarations.test.ts"],"names":[],"mappings":";;AAAA,yDAAwD;AACxD,2DAA0D;AAE1D;;;;;;;;;GASG;AACH,QAAQ,CAAC,6BAA6B,EAAE;IACtC,EAAE,CAAC,yDAAyD,EAAE;;QAC5D,IAAM,KAAK,GAAG,IAAI,yBAAW,EAAE,CAAC;QAChC,IAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,EAAE,0CAAE,WAAW,0CAAE,OAAO,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACnE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACxC,KAAqB,UAAS,EAAT,KAAA,QAAS,EAAT,cAAS,EAAT,IAAS,EAAE;YAA3B,IAAM,MAAM,SAAA;YACf,MAAM,CAAE,KAAK,CAAC,OAAe,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACtD;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE;;QAChF,IAAM,KAAK,GAAG,IAAI,2BAAY,EAAE,CAAC;QACjC,IAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,EAAE,0CAAE,WAAW,0CAAE,OAAO,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAChE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC1C,KAAqB,UAAS,EAAT,KAAA,QAAS,EAAT,cAAS,EAAT,IAAS,EAAE;YA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AAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACpG,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6EAA6E,EAAE;;QAChF,IAAM,KAAK,GAAG,IAAI,2BAAY,EAAE,CAAC;QACjC,IAAM,QAAQ,GAAG,MAAA,MAAA,KAAK,CAAC,EAAE,0CAAE,WAAW,0CAAE,OAAO,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAChE,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC1C,KAAqB,UAAS,EAAT,KAAA,QAAS,EAAT,cAAS,EAAT,IAAS,EAAE;YAA3B,IAAM,MAAM,SAAA;YACf,MAAM,CAAE,KAAK,CAAC,OAAe,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACtD;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -80,5 +80,20 @@ describe('invite table auth shape', function () {
|
|
|
80
80
|
delete: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
|
+
/**
|
|
84
|
+
* The create act is a DECLARED list action, not an insert door (the Invites table lost its `+`
|
|
85
|
+
* when the record surfaces started deriving affordances from the doors — creation rides
|
|
86
|
+
* SignupService, so no insert door exists, and the form's own Send act became unreachable from
|
|
87
|
+
* the table). The action's door names the identity the send act serves; the generic insert stays
|
|
88
|
+
* closed on both apis, and no create-specific door exists anywhere else.
|
|
89
|
+
*/
|
|
90
|
+
it('declares the create act for users holders while the generic insert stays closed', function () {
|
|
91
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
92
|
+
var create = (_c = (_b = (_a = tables_1.tables.Invite.ui) === null || _a === void 0 ? void 0 : _a.recordTable) === null || _b === void 0 ? void 0 : _b.actions) === null || _c === void 0 ? void 0 : _c.find(function (action) { return action.kind === 'create'; });
|
|
93
|
+
expect(create === null || create === void 0 ? void 0 : create.door).toEqual({ permission: permissions_1.USER_PERMISSIONS.users });
|
|
94
|
+
expect((_e = (_d = tables_1.tables.Invite.auth) === null || _d === void 0 ? void 0 : _d.service) === null || _e === void 0 ? void 0 : _e.insert).toBeUndefined();
|
|
95
|
+
expect((_g = (_f = tables_1.tables.Invite.auth) === null || _f === void 0 ? void 0 : _f.db) === null || _g === void 0 ? void 0 : _g.insert).toBeUndefined();
|
|
96
|
+
expect((_h = tables_1.tables.Invite.auth) === null || _h === void 0 ? void 0 : _h.ui).toBeUndefined();
|
|
97
|
+
});
|
|
83
98
|
});
|
|
84
99
|
//# sourceMappingURL=tablesAuth.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tablesAuth.test.js","sourceRoot":"","sources":["../../test/tablesAuth.test.ts"],"names":[],"mappings":";;AAAA,+CAA8C;AAC9C,kDAAsD;AAEtD;;;;;;;;;;;;;GAaG;AAEH,QAAQ,CAAC,uBAAuB,EAAE;IAChC,EAAE,CAAC,kDAAkD,EAAE;;QACrD,MAAM,CAAC,MAAA,eAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,CAAC;YACxC,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC7C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC9C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;YAC9C,MAAM,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0PAEsD,EAAE;;QACzD,MAAM,CAAC,MAAA,eAAM,CAAC,IAAI,CAAC,IAAI,0CAAE,EAAE,CA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AO,0CAAE,MAAM,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5D,MAAM,CAAC,MAAA,MAAA,eAAM,CAAC,MAAM,CAAC,IAAI,0CAAE,EAAE,0CAAE,MAAM,CAAC,CAAC,aAAa,EAAE,CAAC;QACvD,MAAM,CAAC,MAAA,eAAM,CAAC,MAAM,CAAC,IAAI,0CAAE,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/user",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"description": "User management",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "jest --runInBand --passWithNoTests"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@proteinjs/db": "^1.
|
|
25
|
+
"@proteinjs/db": "^1.47.0",
|
|
26
26
|
"@proteinjs/logger": "^1.0.21",
|
|
27
27
|
"@proteinjs/reflection": "^1.2.0",
|
|
28
28
|
"@proteinjs/server-api": "^3.0.11",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
},
|
|
47
47
|
"main": "./dist/generated/index.js",
|
|
48
48
|
"types": "./dist/generated/index.d.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "e26070edf925a69aa0c991c013adfc082c93ee74"
|
|
50
50
|
}
|
|
@@ -27,6 +27,12 @@ export class InviteTable extends Table<Invite> {
|
|
|
27
27
|
* writes stay closed. The db doors mirror the service doors — `DbService`'s inner `Db`
|
|
28
28
|
* re-checks the db api as the calling user (see the user table); server code proper uses
|
|
29
29
|
* system paths, which bypass TableAuth.
|
|
30
|
+
*
|
|
31
|
+
* The record table's create act is a DECLARED list action (`ui.recordTable.actions`), not an
|
|
32
|
+
* insert door: the generic surfaces derive the `+` from the insert doors, and with those closed
|
|
33
|
+
* by design the table drew no way to reach the new-record form's own Send act (no `+` on
|
|
34
|
+
* Invites, on any form factor). The action's door names exactly who the send act serves; the
|
|
35
|
+
* act stays gated in the form (`InviteRecordFormCustomization`) and in `SignupService`.
|
|
30
36
|
*/
|
|
31
37
|
auth: Table<Invite>['auth'] = {
|
|
32
38
|
db: {
|
|
@@ -41,12 +47,14 @@ export class InviteTable extends Table<Invite> {
|
|
|
41
47
|
/**
|
|
42
48
|
* The row scan: who's invited, by whom, until when. The redeemable `token` is auth material
|
|
43
49
|
* with no business in a row scan (founder admin review, v1.22 — also a hygiene win); it stays
|
|
44
|
-
* on the record form for the odd support case. The
|
|
45
|
-
*
|
|
50
|
+
* on the record form for the odd support case. The list actions: the create act, for 'users'
|
|
51
|
+
* holders, named for what it is — an invite is sent, never "created" (the form's button says
|
|
52
|
+
* the same); the delete act stays derived from the delete doors.
|
|
46
53
|
*/
|
|
47
54
|
ui: Table<Invite>['ui'] = {
|
|
48
55
|
recordTable: {
|
|
49
56
|
columns: ['email', 'invitedBy', 'tokenExpiresAt'],
|
|
57
|
+
actions: [{ kind: 'create', label: 'Send invite', door: { permission: USER_PERMISSIONS.users } }],
|
|
50
58
|
},
|
|
51
59
|
};
|
|
52
60
|
columns = withRecordColumns<Invite>({
|
|
@@ -12,13 +12,13 @@ import { USER_PERMISSIONS } from '../permissions';
|
|
|
12
12
|
* touch / wheel event through `UserPresenceService.recordPresence` (user-ui's
|
|
13
13
|
* UserPresenceReporter, throttled per page), and user-server's UserActivityStamp writes the row
|
|
14
14
|
* from that door only. Transport was the previous key (the per-request session-cache build) and
|
|
15
|
-
* it over-counted (
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* it over-counted (every user read as "last active today"): an open tab polls, a socket re-joins
|
|
16
|
+
* its rooms on every reconnect, a deploy reloads every idle tab — all of it arrives over a live
|
|
17
|
+
* session with nobody there. Machinery acting on a user's behalf (scheduled jobs, watchers,
|
|
18
|
+
* background runs under seeded contexts) has no page to report from, so it structurally cannot
|
|
19
|
+
* stamp; machine accounts are refused by the stamp. Deliberately NOT derived from any usage or
|
|
20
|
+
* spend ledger: spend measures machine work (which background jobs rack up all day), not the
|
|
21
|
+
* human being present.
|
|
22
22
|
*
|
|
23
23
|
* Reads are people-management trust ('users', the Users-page permission); writes are
|
|
24
24
|
* system-written only (no service/db write door onto the row — the stamp rides the system
|
|
@@ -22,6 +22,12 @@ describe('admin row-scan declarations', () => {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
it('invite list actions: one declared act — the create act, named for what it is (Send invite)', () => {
|
|
26
|
+
const table = new InviteTable();
|
|
27
|
+
const actions = table.ui?.recordTable?.actions ?? [];
|
|
28
|
+
expect(actions.map((action) => [action.kind, action.label])).toEqual([['create', 'Send invite']]);
|
|
29
|
+
});
|
|
30
|
+
|
|
25
31
|
it('session rows: whose, when it dies, which one — never the serialized session', () => {
|
|
26
32
|
const table = new SessionTable();
|
|
27
33
|
const declared = table.ui?.recordTable?.columns;
|
package/test/tablesAuth.test.ts
CHANGED
|
@@ -83,4 +83,19 @@ describe('invite table auth shape', () => {
|
|
|
83
83
|
delete: { permission: USER_PERMISSIONS.users },
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The create act is a DECLARED list action, not an insert door (the Invites table lost its `+`
|
|
89
|
+
* when the record surfaces started deriving affordances from the doors — creation rides
|
|
90
|
+
* SignupService, so no insert door exists, and the form's own Send act became unreachable from
|
|
91
|
+
* the table). The action's door names the identity the send act serves; the generic insert stays
|
|
92
|
+
* closed on both apis, and no create-specific door exists anywhere else.
|
|
93
|
+
*/
|
|
94
|
+
it('declares the create act for users holders while the generic insert stays closed', () => {
|
|
95
|
+
const create = tables.Invite.ui?.recordTable?.actions?.find((action) => action.kind === 'create');
|
|
96
|
+
expect(create?.door).toEqual({ permission: USER_PERMISSIONS.users });
|
|
97
|
+
expect(tables.Invite.auth?.service?.insert).toBeUndefined();
|
|
98
|
+
expect(tables.Invite.auth?.db?.insert).toBeUndefined();
|
|
99
|
+
expect(tables.Invite.auth?.ui).toBeUndefined();
|
|
100
|
+
});
|
|
86
101
|
});
|