@proteinjs/user 1.8.0 → 1.10.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.
- package/CHANGELOG.md +30 -0
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +7 -1
- package/dist/generated/index.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/src/MachineAccount.d.ts +47 -0
- package/dist/src/MachineAccount.d.ts.map +1 -0
- package/dist/src/MachineAccount.js +100 -0
- package/dist/src/MachineAccount.js.map +1 -0
- package/dist/src/ScopedRecord.d.ts +8 -0
- package/dist/src/ScopedRecord.d.ts.map +1 -1
- package/dist/src/ScopedRecord.js +5 -1
- package/dist/src/ScopedRecord.js.map +1 -1
- package/dist/src/SharedRecord.d.ts +1 -6
- package/dist/src/SharedRecord.d.ts.map +1 -1
- package/dist/src/SharedRecord.js +18 -5
- package/dist/src/SharedRecord.js.map +1 -1
- package/dist/src/routes.d.ts.map +1 -1
- package/dist/src/routes.js +1 -0
- package/dist/src/routes.js.map +1 -1
- package/dist/src/services/AccountDeletionService.d.ts +27 -0
- package/dist/src/services/AccountDeletionService.d.ts.map +1 -0
- package/dist/src/services/AccountDeletionService.js +6 -0
- package/dist/src/services/AccountDeletionService.js.map +1 -0
- package/dist/src/services/MachineCredentialsService.d.ts +38 -0
- package/dist/src/services/MachineCredentialsService.d.ts.map +1 -0
- package/dist/src/services/MachineCredentialsService.js +6 -0
- package/dist/src/services/MachineCredentialsService.js.map +1 -0
- package/dist/src/services/SetUserStatusService.d.ts +15 -0
- package/dist/src/services/SetUserStatusService.d.ts.map +1 -0
- package/dist/src/services/SetUserStatusService.js +6 -0
- package/dist/src/services/SetUserStatusService.js.map +1 -0
- package/dist/src/services/SignupService.d.ts +8 -7
- package/dist/src/services/SignupService.d.ts.map +1 -1
- package/dist/src/tables/AccountDeletionTable.d.ts +85 -0
- package/dist/src/tables/AccountDeletionTable.d.ts.map +1 -0
- package/dist/src/tables/AccountDeletionTable.js +62 -0
- package/dist/src/tables/AccountDeletionTable.js.map +1 -0
- package/dist/src/tables/SessionTable.d.ts +1 -1
- package/dist/src/tables/UserStatusEventTable.d.ts +30 -0
- package/dist/src/tables/UserStatusEventTable.d.ts.map +1 -0
- package/dist/src/tables/UserStatusEventTable.js +43 -0
- package/dist/src/tables/UserStatusEventTable.js.map +1 -0
- package/dist/src/tables/UserTable.d.ts +36 -2
- package/dist/src/tables/UserTable.d.ts.map +1 -1
- package/dist/src/tables/UserTable.js +73 -4
- package/dist/src/tables/UserTable.js.map +1 -1
- package/dist/src/tables/tables.d.ts +4 -0
- package/dist/src/tables/tables.d.ts.map +1 -1
- package/dist/src/tables/tables.js +4 -0
- package/dist/src/tables/tables.js.map +1 -1
- package/dist/test/SharedRecordDuplicateModuleState.test.d.ts +18 -0
- package/dist/test/SharedRecordDuplicateModuleState.test.d.ts.map +1 -0
- package/dist/test/SharedRecordDuplicateModuleState.test.js +50 -0
- package/dist/test/SharedRecordDuplicateModuleState.test.js.map +1 -0
- package/dist/test/tablesAuth.test.js +20 -4
- package/dist/test/tablesAuth.test.js.map +1 -1
- package/generated/index.ts +7 -1
- package/index.ts +6 -0
- package/package.json +4 -4
- package/src/MachineAccount.ts +103 -0
- package/src/ScopedRecord.ts +11 -0
- package/src/SharedRecord.ts +18 -4
- package/src/routes.ts +1 -0
- package/src/services/AccountDeletionService.ts +28 -0
- package/src/services/MachineCredentialsService.ts +43 -0
- package/src/services/SetUserStatusService.ts +16 -0
- package/src/services/SignupService.ts +8 -7
- package/src/tables/AccountDeletionTable.ts +98 -0
- package/src/tables/UserStatusEventTable.ts +34 -0
- package/src/tables/UserTable.ts +57 -6
- package/src/tables/tables.ts +4 -0
- package/test/SharedRecordDuplicateModuleState.test.ts +59 -0
- package/test/tablesAuth.test.ts +22 -4
|
@@ -6,6 +6,14 @@ export declare const getScopedDb: () => Db<ScopedRecord>;
|
|
|
6
6
|
export declare const getScopedDbAsSystem: <R extends ScopedRecord = ScopedRecord>() => Db<R>;
|
|
7
7
|
export declare function getScopedTables(): Table<ScopedRecord>[];
|
|
8
8
|
export declare function isScopedTable(table: Table<any>): boolean;
|
|
9
|
+
/** Declares a scoped table whose rows deliberately SURVIVE account purge (billing ledger,
|
|
10
|
+
* ops records — casing §7.2/§7.4). Rows become pseudonymous when the user row purges
|
|
11
|
+
* (scope keeps the bare 36-char id). Default is PURGE: a new scoped table is erased unless
|
|
12
|
+
* it declares otherwise — the safe default for a privacy obligation. */
|
|
13
|
+
export interface AccountPurgePolicy {
|
|
14
|
+
readonly retainOnAccountPurge: true;
|
|
15
|
+
}
|
|
16
|
+
export declare function retainedOnAccountPurge(table: Table<any>): boolean;
|
|
9
17
|
/**
|
|
10
18
|
* Wrapper function to add default ScopedRecord columns to your table's columns.
|
|
11
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedRecord.d.ts","sourceRoot":"","sources":["../../src/ScopedRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,MAAM,EAGN,KAAK,EAGL,EAAE,EACH,MAAM,eAAe,CAAC;AAGvB,MAAM,WAAW,YAAa,SAAQ,MAAM;IAC1C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,WAAW,wBAAsB,CAAC;AAE/C,eAAO,MAAM,mBAAmB,oDACkB,CAAC;AA+CnD,wBAAgB,eAAe,0BAE9B;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,WAG9C;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,YAAY,EAC5D,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,EAC7C,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAC1B,OAAO,CAAC,YAAY,CAAC,GAAG,OA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,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,YAAY,EAAE,IAAI,EAAE;IAC9D,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG;IAAE,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAM5D"}
|
package/dist/src/ScopedRecord.js
CHANGED
|
@@ -56,7 +56,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
56
56
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
57
|
};
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.createScopedIndex = exports.withScopedRecordColumns = exports.isScopedTable = exports.getScopedTables = exports.getScopedDbAsSystem = exports.getScopedDb = void 0;
|
|
59
|
+
exports.createScopedIndex = exports.withScopedRecordColumns = exports.retainedOnAccountPurge = exports.isScopedTable = exports.getScopedTables = exports.getScopedDbAsSystem = exports.getScopedDb = void 0;
|
|
60
60
|
var db_1 = require("@proteinjs/db");
|
|
61
61
|
var UserRepo_1 = require("./UserRepo");
|
|
62
62
|
exports.getScopedDb = (db_1.getDb);
|
|
@@ -120,6 +120,10 @@ function isScopedTable(table) {
|
|
|
120
120
|
return !!scopeColumn;
|
|
121
121
|
}
|
|
122
122
|
exports.isScopedTable = isScopedTable;
|
|
123
|
+
function retainedOnAccountPurge(table) {
|
|
124
|
+
return table.retainOnAccountPurge === true;
|
|
125
|
+
}
|
|
126
|
+
exports.retainedOnAccountPurge = retainedOnAccountPurge;
|
|
123
127
|
/**
|
|
124
128
|
* Wrapper function to add default ScopedRecord columns to your table's columns.
|
|
125
129
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScopedRecord.js","sourceRoot":"","sources":["../../src/ScopedRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAUuB;AACvB,uCAAsC;AAMzB,QAAA,WAAW,GAAG,CAAA,UAAmB,CAAA,CAAC;AAExC,IAAM,mBAAmB,GAAG;IACjC,OAAA,IAAI,OAAE,CAAI,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC;AAAhD,CAAgD,CAAC;AADtC,QAAA,mBAAmB,uBACmB;AAEnD;;;;;;;;GAQG;AACH,IAAM,kBAAkB,GAAG,UAAC,SAAiB;IAC3C,IAAM,MAAM,GAAG,IAAI,mBAAQ,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;IAC3C,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CACb,gDAAyC,SAAS,+CAA4C;YAC5F,yFAAyF;YACzF,8DAA8D,CACjE,CAAC;KACH;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,IAAM,sBAAsB,GAAG,UAAC,gBAA+B;IAA/B,iCAAA,EAAA,qBAA+B;IAC7D,OAAO;QACL,KAAK,EAAE,IAAI,iBAAY,CAAC,OAAO,EAAE;YAC/B,YAAY,EAAE;gBAAY,sBAAA,kBAAkB,CAAC,OAAO,CAAC,EAAA;qBAAA;YACrD,iBAAiB,EAAE,UAAC,WAAW,IAAK,OAAA,CAAC,WAAW,EAAZ,CAAY;YAChD,0FAA0F;YAC1F,4FAA4F;YAC5F,4FAA4F;YAC5F,uFAAuF;YACvF,SAAS,EAAE,UAAC,WAAW,IAAK,OAAA,CAAC,WAAW,EAAZ,CAAY;YACxC,UAAU,EAAE,UAAO,EAAE,EAAE,WAAW;;oBAChC,IAAI,CAAC,WAAW,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IAAI,IAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAG;AAC5G,CAAC;AAVD,8CAUC"}
|
|
@@ -6,13 +6,8 @@ export interface SharedRecord<T extends SharedRecord = any> extends Record {
|
|
|
6
6
|
export declare const getSharedDb: () => Db<SharedRecord<any>>;
|
|
7
7
|
export declare const getSharedDbWithOverride: () => Db<Omit<SharedRecord<any>, "permissionSource">>;
|
|
8
8
|
export declare const getSharedDbAsSystem: <R extends SharedRecord<any> = SharedRecord<any>>() => Db<R>;
|
|
9
|
-
/**
|
|
10
|
-
* When true, skips AccessGrant creation during inserts and skips the
|
|
11
|
-
* permission subquery filter on reads. Use in test environments where
|
|
12
|
-
* AccessGrant accumulation degrades Spanner emulator performance.
|
|
13
|
-
*/
|
|
14
|
-
export declare let skipAccessGrants: boolean;
|
|
15
9
|
export declare function setSkipAccessGrants(value: boolean): void;
|
|
10
|
+
export declare function skipAccessGrantsEnabled(): boolean;
|
|
16
11
|
type SharedRecordOptions = {
|
|
17
12
|
permissionSourceTableName?: string;
|
|
18
13
|
permissionSourceDefaultValue?: (table: Table<any>, insertObj: any & Record) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedRecord.d.ts","sourceRoot":"","sources":["../../src/SharedRecord.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,EAAE,EAEF,MAAM,EACN,KAAK,EAKL,SAAS,EAGV,MAAM,eAAe,CAAC;AAOvB,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,YAAY,GAAG,GAAG,CAAE,SAAQ,MAAM;IACxE,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,WAAW,6BAAsB,CAAC;AAC/C,eAAO,MAAM,uBAAuB,uDAAgD,CAAC;AAErF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,CAE9D"}
|
package/dist/src/SharedRecord.js
CHANGED
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.withSharedRecordColumns = exports.isSharedTable = exports.getSharedTables = exports.
|
|
39
|
+
exports.withSharedRecordColumns = exports.isSharedTable = exports.getSharedTables = exports.skipAccessGrantsEnabled = exports.setSkipAccessGrants = exports.getSharedDbAsSystem = exports.getSharedDbWithOverride = exports.getSharedDb = void 0;
|
|
40
40
|
var db_1 = require("@proteinjs/db");
|
|
41
41
|
var UserRepo_1 = require("./UserRepo");
|
|
42
42
|
var UserTable_1 = require("./tables/UserTable");
|
|
@@ -51,12 +51,25 @@ exports.getSharedDbAsSystem = getSharedDbAsSystem;
|
|
|
51
51
|
* When true, skips AccessGrant creation during inserts and skips the
|
|
52
52
|
* permission subquery filter on reads. Use in test environments where
|
|
53
53
|
* AccessGrant accumulation degrades Spanner emulator performance.
|
|
54
|
+
*
|
|
55
|
+
* The flag lives on the global object (window in browser, globalThis elsewhere) rather than in
|
|
56
|
+
* module scope: per-package installs can put multiple live copies of @proteinjs/user in one
|
|
57
|
+
* process (each sibling package's nested node_modules hosts its own copy), and module-scoped
|
|
58
|
+
* state splits per copy — a caller toggling one copy while the AccessGrant closures enforce
|
|
59
|
+
* from another (silent authz-toggle no-op, 2026-08-14 incident). Anchoring on the global gives
|
|
60
|
+
* every copy the same state — same pattern as reflection's SourceRepository and db's
|
|
61
|
+
* ReferenceCache.
|
|
54
62
|
*/
|
|
55
|
-
|
|
63
|
+
var SKIP_ACCESS_GRANTS_GLOBAL_KEY = '__proteinjs_user_skipAccessGrants';
|
|
64
|
+
var getGlobal = function () { return (typeof window !== 'undefined' ? window : globalThis); };
|
|
56
65
|
function setSkipAccessGrants(value) {
|
|
57
|
-
|
|
66
|
+
getGlobal()[SKIP_ACCESS_GRANTS_GLOBAL_KEY] = value;
|
|
58
67
|
}
|
|
59
68
|
exports.setSkipAccessGrants = setSkipAccessGrants;
|
|
69
|
+
function skipAccessGrantsEnabled() {
|
|
70
|
+
return getGlobal()[SKIP_ACCESS_GRANTS_GLOBAL_KEY] === true;
|
|
71
|
+
}
|
|
72
|
+
exports.skipAccessGrantsEnabled = skipAccessGrantsEnabled;
|
|
60
73
|
var getSharedRecordColumns = function (_a) {
|
|
61
74
|
var _b = _a === void 0 ? {} : _a, permissionSourceTableName = _b.permissionSourceTableName, permissionSourceDefaultValue = _b.permissionSourceDefaultValue;
|
|
62
75
|
return {
|
|
@@ -66,7 +79,7 @@ var getSharedRecordColumns = function (_a) {
|
|
|
66
79
|
return __generator(this, function (_a) {
|
|
67
80
|
switch (_a.label) {
|
|
68
81
|
case 0:
|
|
69
|
-
if (!!
|
|
82
|
+
if (!!skipAccessGrantsEnabled()) return [3 /*break*/, 2];
|
|
70
83
|
user = new UserRepo_1.UserRepo().getUser();
|
|
71
84
|
db = (0, db_1.getDb)();
|
|
72
85
|
return [4 /*yield*/, db.insert(tables_1.tables.AccessGrant, {
|
|
@@ -85,7 +98,7 @@ var getSharedRecordColumns = function (_a) {
|
|
|
85
98
|
addToQuery: function (qb, runAsSystem, operation) { return __awaiter(void 0, void 0, void 0, function () {
|
|
86
99
|
var operationToLevel, subQuery;
|
|
87
100
|
return __generator(this, function (_a) {
|
|
88
|
-
if (runAsSystem ||
|
|
101
|
+
if (runAsSystem || skipAccessGrantsEnabled()) {
|
|
89
102
|
return [2 /*return*/];
|
|
90
103
|
}
|
|
91
104
|
operationToLevel = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedRecord.js","sourceRoot":"","sources":["../../src/SharedRecord.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oCAauB;AAGvB,uCAAsC;AACtC,gDAA+C;AAC/C,0CAAyC;AAO5B,QAAA,WAAW,GAAG,CAAA,UA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E,sBAAsB,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;AAClF,CAAC;AAFD,sCAEC;AAED;;;;;GAKG;AACH,SAAgB,uBAAuB,CACrC,OAA6C,EAC7C,OAA6B;IAE7B,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,IAAA,sBAAiB,EAAS,OAAO,CAAQ,CAAC,CAAC;AACtH,CAAC;AALD,0DAKC"}
|
package/dist/src/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;KAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;KAAE,CAAA;CAO3G,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;mBACP,MAAM,gBAAgB,MAAM;;CAG5C,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;CAOpB,CAAC"}
|
package/dist/src/routes.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.uiRoutes = exports.avatarRoute = exports.routes = void 0;
|
|
4
4
|
exports.routes = {
|
|
5
5
|
login: { path: '/user/login', method: 'post' },
|
|
6
|
+
signup: { path: '/user/signup', method: 'post' },
|
|
6
7
|
initiatePasswordReset: { path: '/user/initiate-password-reset', method: 'post' },
|
|
7
8
|
executePasswordReset: { path: '/user/execute-password-reset', method: 'post' },
|
|
8
9
|
validateResetToken: { path: '/user/validate-reset-token', method: 'get' },
|
package/dist/src/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAA8F;IAC/G,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9C,qBAAqB,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,MAAM,EAAE;IAChF,oBAAoB,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9E,kBAAkB,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,MAAM,EAAE,KAAK,EAAE;IACzE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE;CAChD,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,UAAC,MAAc,EAAE,YAAoB;QACzC,OAAA,kBAAW,kBAAkB,CAAC,MAAM,CAAC,gBAAM,kBAAkB,CAAC,YAAY,CAAC,CAAE;IAA7E,CAA6E;IAC/E,MAAM,EAAE,KAAc;CACvB,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO;QACd,cAAc,EAAE,uBAAuB;QACvC,aAAa,EAAE,sBAAsB;QACrC,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAA8F;IAC/G,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9C,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE;IAChD,qBAAqB,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,MAAM,EAAE;IAChF,oBAAoB,EAAE,EAAE,IAAI,EAAE,8BAA8B,EAAE,MAAM,EAAE,MAAM,EAAE;IAC9E,kBAAkB,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,MAAM,EAAE,KAAK,EAAE;IACzE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE;CAChD,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,WAAW,GAAG;IACzB,IAAI,EAAE,UAAC,MAAc,EAAE,YAAoB;QACzC,OAAA,kBAAW,kBAAkB,CAAC,MAAM,CAAC,gBAAM,kBAAkB,CAAC,YAAY,CAAC,CAAE;IAA7E,CAA6E;IAC/E,MAAM,EAAE,KAAc;CACvB,CAAC;AAEW,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO;QACd,cAAc,EAAE,uBAAuB;QACvC,aAAa,EAAE,sBAAsB;QACrC,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Service } from '@proteinjs/service';
|
|
2
|
+
import { Moment } from 'moment';
|
|
3
|
+
export declare const getAccountDeletionService: () => AccountDeletionService;
|
|
4
|
+
/**
|
|
5
|
+
* In-app account deletion, archive-then-purge: the synchronous call deactivates the account
|
|
6
|
+
* ("gone right away" — shares revoked both directions, sessions killed), and the background
|
|
7
|
+
* purge walker erases everything after the grace window. Logging back in during grace cancels
|
|
8
|
+
* (full restore, including shares — the login route runs the cancel hook, not this service).
|
|
9
|
+
*
|
|
10
|
+
* Acts ONLY on the session user — no target parameter, so the only authz surface beyond the
|
|
11
|
+
* door is the password re-auth inside the call. Door: any authenticated user (`allUsers`,
|
|
12
|
+
* declared on the implementation's serviceMetadata).
|
|
13
|
+
*/
|
|
14
|
+
export interface AccountDeletionService extends Service {
|
|
15
|
+
/**
|
|
16
|
+
* Deactivate the session user's account and schedule the purge. Idempotent: a re-call after a
|
|
17
|
+
* partial failure resumes from the stored deletion manifest (never re-enumerates). The
|
|
18
|
+
* caller's sessions are killed last — the response is the last authenticated exchange.
|
|
19
|
+
*
|
|
20
|
+
* @param password re-auth — must match the session user's password
|
|
21
|
+
* @returns the purge date, for the UI's confirmation copy
|
|
22
|
+
*/
|
|
23
|
+
requestDeletion(password: string): Promise<{
|
|
24
|
+
purgeAfter: Moment;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=AccountDeletionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountDeletionService.d.ts","sourceRoot":"","sources":["../../../src/services/AccountDeletionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,yBAAyB,8BAErC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,WAAW,sBAAuB,SAAQ,OAAO;IACrD;;;;;;;OAOG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccountDeletionService = void 0;
|
|
4
|
+
var service_1 = require("@proteinjs/service");
|
|
5
|
+
exports.getAccountDeletionService = (0, service_1.serviceFactory)('@proteinjs/user/AccountDeletionService');
|
|
6
|
+
//# sourceMappingURL=AccountDeletionService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountDeletionService.js","sourceRoot":"","sources":["../../../src/services/AccountDeletionService.ts"],"names":[],"mappings":";;;AAAA,8CAA6D;AAGhD,QAAA,yBAAyB,GAAG,IAAA,wBAAc,EACrD,wCAAwC,CACzC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Service } from '@proteinjs/service';
|
|
2
|
+
export declare const getMachineCredentialsService: () => MachineCredentialsService;
|
|
3
|
+
/** The one-time view of a minted machine credential — the plaintext is never stored. */
|
|
4
|
+
export type MintedMachineCredential = {
|
|
5
|
+
/** The machine account the credential was minted for. */
|
|
6
|
+
email: string;
|
|
7
|
+
/** The generated password — shown exactly ONCE; only its hash is stored. */
|
|
8
|
+
password: string;
|
|
9
|
+
/** The Secret Manager secret the declaration names as the credential's home. */
|
|
10
|
+
secretName: string;
|
|
11
|
+
/** Operator instruction: where to paste the plaintext and what activates it. */
|
|
12
|
+
note: string;
|
|
13
|
+
};
|
|
14
|
+
/** A declared machine account joined with its row state — the admin surface renders these. */
|
|
15
|
+
export type MachineAccountView = {
|
|
16
|
+
email: string;
|
|
17
|
+
accountName: string;
|
|
18
|
+
roles: string[];
|
|
19
|
+
secretName: string;
|
|
20
|
+
/** 'pending first boot' until the boot sync has created/adopted the row. */
|
|
21
|
+
status: 'active' | 'deactivated' | 'pending first boot';
|
|
22
|
+
/** Whether a credential has ever been minted/provisioned (hash present on the row). */
|
|
23
|
+
hasCredential: boolean;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Credential minting for code-declared machine accounts (`MachineAccount`): identity and grants
|
|
27
|
+
* live in source; the credential is the ONLY runtime-provisioned piece. Minting generates a
|
|
28
|
+
* strong random password, stores its hash on the account row (no human-chosen passwords), kills
|
|
29
|
+
* the account's sessions, and returns the plaintext once for pasting into the declaration's
|
|
30
|
+
* Secret Manager secret. The same call rotates. Machine rows only — human credentials go
|
|
31
|
+
* through the password-reset flow.
|
|
32
|
+
*/
|
|
33
|
+
export interface MachineCredentialsService extends Service {
|
|
34
|
+
/** Every declared machine account with its row state, for the admin surface. */
|
|
35
|
+
listMachineAccounts(): Promise<MachineAccountView[]>;
|
|
36
|
+
mintCredential(email: string): Promise<MintedMachineCredential>;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=MachineCredentialsService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MachineCredentialsService.d.ts","sourceRoot":"","sources":["../../../src/services/MachineCredentialsService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAE7D,eAAO,MAAM,4BAA4B,iCAExC,CAAC;AAEF,wFAAwF;AACxF,MAAM,MAAM,uBAAuB,GAAG;IACpC,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,oBAAoB,CAAC;IACxD,uFAAuF;IACvF,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,yBAA0B,SAAQ,OAAO;IACxD,gFAAgF;IAChF,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACrD,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACjE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMachineCredentialsService = void 0;
|
|
4
|
+
var service_1 = require("@proteinjs/service");
|
|
5
|
+
exports.getMachineCredentialsService = (0, service_1.serviceFactory)('@proteinjs/user/MachineCredentialsService');
|
|
6
|
+
//# sourceMappingURL=MachineCredentialsService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MachineCredentialsService.js","sourceRoot":"","sources":["../../../src/services/MachineCredentialsService.ts"],"names":[],"mappings":";;;AAAA,8CAA6D;AAEhD,QAAA,4BAA4B,GAAG,IAAA,wBAAc,EACxD,2CAA2C,CAC5C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Service } from '@proteinjs/service';
|
|
2
|
+
import { UserStatus } from '../tables/UserTable';
|
|
3
|
+
export declare const getSetUserStatusService: () => SetUserStatusService;
|
|
4
|
+
/**
|
|
5
|
+
* The ONE write path for a user's account standing. The `user.status` column is
|
|
6
|
+
* service-protected (generic record writes cannot touch it); every change lands here and writes
|
|
7
|
+
* a `user_status_event` audit row (actor, target, status; `created` is the timestamp).
|
|
8
|
+
* Admin-only: deactivation locks the target out of the product (login refused, live sessions
|
|
9
|
+
* stop resolving), so the door is the break-glass role, not a mapped permission.
|
|
10
|
+
*/
|
|
11
|
+
export interface SetUserStatusService extends Service {
|
|
12
|
+
/** Set a user's standing. Already in that standing: no change, no audit row. */
|
|
13
|
+
setUserStatus(userId: string, status: UserStatus): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=SetUserStatusService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetUserStatusService.d.ts","sourceRoot":"","sources":["../../../src/services/SetUserStatusService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,uBAAuB,4BAA+E,CAAC;AAEpH;;;;;;GAMG;AACH,MAAM,WAAW,oBAAqB,SAAQ,OAAO;IACnD,gFAAgF;IAChF,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSetUserStatusService = void 0;
|
|
4
|
+
var service_1 = require("@proteinjs/service");
|
|
5
|
+
exports.getSetUserStatusService = (0, service_1.serviceFactory)('@proteinjs/user/SetUserStatusService');
|
|
6
|
+
//# sourceMappingURL=SetUserStatusService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SetUserStatusService.js","sourceRoot":"","sources":["../../../src/services/SetUserStatusService.ts"],"names":[],"mappings":";;;AAAA,8CAA6D;AAGhD,QAAA,uBAAuB,GAAG,IAAA,wBAAc,EAAuB,sCAAsC,CAAC,CAAC"}
|
|
@@ -12,17 +12,18 @@ export type InitializeSignupResponse = {
|
|
|
12
12
|
isInviteOnly?: boolean;
|
|
13
13
|
invite?: Omit<Invite, 'token'>;
|
|
14
14
|
};
|
|
15
|
+
/** The signup route's request body (`routes.signup`). `email` is required if no token is provided. */
|
|
15
16
|
export type UserSignup = Pick<User, 'name' | 'password'> & {
|
|
16
17
|
email?: User['email'];
|
|
17
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* Account CREATION is not on this interface: signing up establishes a session in the same
|
|
21
|
+
* request (auto-login), and session establishment is a request-level concern services never
|
|
22
|
+
* see — it lives on the `routes.signup` route (user-server `src/routes/signup.ts`), beside
|
|
23
|
+
* login. This service owns the rest of the signup flow: pre-submit initialization and invite
|
|
24
|
+
* management.
|
|
25
|
+
*/
|
|
18
26
|
export interface SignupService extends Service {
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new user account.
|
|
21
|
-
* @param {UserSignup} user - User signup information. `user.email` is required if no token is provided.
|
|
22
|
-
* @param {string} [token] - Optional invite token. If provided, the corresponding invite record will be used to get the user's email.
|
|
23
|
-
* @returns {Promise<void>}
|
|
24
|
-
*/
|
|
25
|
-
createUser(user: UserSignup, token?: string): Promise<void>;
|
|
26
27
|
/** Creates invite record and sends email to the invited user.
|
|
27
28
|
* If invite already exists for the email, it will update the existing record with a new token and send a new email.
|
|
28
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignupService.d.ts","sourceRoot":"","sources":["../../../src/services/SignupService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,qBAAiE,CAAC;AAE/F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IACzD,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CACvB,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C
|
|
1
|
+
{"version":3,"file":"SignupService.d.ts","sourceRoot":"","sources":["../../../src/services/SignupService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,qBAAiE,CAAC;AAE/F,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,sGAAsG;AACtG,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC,GAAG;IACzD,KAAK,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACvD,uDAAuD;IACvD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C;;;;OAIG;IACH,gBAAgB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC3E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Table, Record } from '@proteinjs/db';
|
|
2
|
+
import { Moment } from 'moment';
|
|
3
|
+
import { AccessGrant } from './AccessGrantTable';
|
|
4
|
+
/** Purge-machine phases. `grace` = cancelable window; `restoring` = a cancel-by-login claimed the
|
|
5
|
+
* row; `purging` = the walker claimed it; `purged` = rows erased, completion email pending. */
|
|
6
|
+
export declare const ACCOUNT_DELETION_PHASES: readonly ["grace", "restoring", "purging", "purged"];
|
|
7
|
+
export type AccountDeletionPhase = (typeof ACCOUNT_DELETION_PHASES)[number];
|
|
8
|
+
/**
|
|
9
|
+
* A revoked `access_grant` row serialized verbatim into the deletion manifest. The stored `id`
|
|
10
|
+
* lets revocation delete precisely and resume idempotently; cancel re-inserts WITHOUT ids
|
|
11
|
+
* (fresh rows), matched by `(principal, resource, accessLevel)`.
|
|
12
|
+
*/
|
|
13
|
+
export type ManifestGrant = {
|
|
14
|
+
/** id of the revoked access_grant row */
|
|
15
|
+
id: string;
|
|
16
|
+
/** user id (the grant's principal) */
|
|
17
|
+
principal: string;
|
|
18
|
+
/** resource id (the grant's resource) */
|
|
19
|
+
resource: string;
|
|
20
|
+
resourceTable?: string;
|
|
21
|
+
accessLevel: AccessGrant['accessLevel'];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* One row per in-flight account deletion: the deletion manifest plus the purge machine's own
|
|
25
|
+
* state. Deliberately a plain `Record`, NOT scoped — it must survive the purge walker's scope
|
|
26
|
+
* sweep and outlive the `user` row (the completion email sends after the user is gone).
|
|
27
|
+
*/
|
|
28
|
+
export interface AccountDeletion extends Record {
|
|
29
|
+
/** unique — one in-flight deletion per account */
|
|
30
|
+
userId: string;
|
|
31
|
+
/** Completion-email addressee after the user row is gone; login-cancel lookup key. */
|
|
32
|
+
userEmail: string;
|
|
33
|
+
phase: AccountDeletionPhase;
|
|
34
|
+
/** Write-once copy of `user.purgeAfter` (same logical step; this row is the machine's own stamp). */
|
|
35
|
+
purgeAfter: Moment;
|
|
36
|
+
/**
|
|
37
|
+
* Revoked grants, BOTH directions (inbound: my non-owner grants on others' content; outbound:
|
|
38
|
+
* others' grants on my content), verbatim. Persisted BEFORE any mutation — after a partial
|
|
39
|
+
* revocation the live grants under-count, so resume must never re-enumerate.
|
|
40
|
+
*/
|
|
41
|
+
manifestGrants: ManifestGrant[];
|
|
42
|
+
/**
|
|
43
|
+
* Owner-grant resource ids snapshotted at deactivation — the purge walker's thought-domain id
|
|
44
|
+
* source. LOAD-BEARING: ThoughtAccessGrantCleanupTableWatcher deletes a thought's grants the
|
|
45
|
+
* moment its row dies, so live re-enumeration after a mid-tree crash would strand orphan
|
|
46
|
+
* children forever.
|
|
47
|
+
*/
|
|
48
|
+
ownedResourceIds: string[];
|
|
49
|
+
/** CAS token (RoutineTicker.tickSeq pattern), bumped on every claim. */
|
|
50
|
+
leaseSeq: number;
|
|
51
|
+
ownerNodeId?: string | null;
|
|
52
|
+
/** JS-compared (Spanner timestamp-condition house rule). */
|
|
53
|
+
heartbeatAt?: Moment | null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Locked like `SessionTable`: readable behind the 'users' permission, and NO write doors — rows
|
|
57
|
+
* are system-written only (the deletion service and the purge walker ride system paths, which
|
|
58
|
+
* bypass TableAuth). The manifest holds cross-user grant data, so even break-glass admin gets
|
|
59
|
+
* no generic write surface.
|
|
60
|
+
*/
|
|
61
|
+
export declare class AccountDeletionTable extends Table<AccountDeletion> {
|
|
62
|
+
name: string;
|
|
63
|
+
auth: Table<AccountDeletion>['auth'];
|
|
64
|
+
indexes: {
|
|
65
|
+
name: string;
|
|
66
|
+
columns: (keyof AccountDeletion)[];
|
|
67
|
+
unique: boolean;
|
|
68
|
+
}[];
|
|
69
|
+
columns: {
|
|
70
|
+
id: import("@proteinjs/db").Column<string, any>;
|
|
71
|
+
created: import("@proteinjs/db").Column<Moment, any>;
|
|
72
|
+
updated: import("@proteinjs/db").Column<Moment, any>;
|
|
73
|
+
} & {} & {
|
|
74
|
+
purgeAfter: import("@proteinjs/db").Column<Moment, any>;
|
|
75
|
+
userId: import("@proteinjs/db").Column<string, any>;
|
|
76
|
+
userEmail: import("@proteinjs/db").Column<string, any>;
|
|
77
|
+
phase: import("@proteinjs/db").Column<"grace" | "restoring" | "purging" | "purged", any>;
|
|
78
|
+
manifestGrants: import("@proteinjs/db").Column<ManifestGrant[], any>;
|
|
79
|
+
ownedResourceIds: import("@proteinjs/db").Column<string[], any>;
|
|
80
|
+
leaseSeq: import("@proteinjs/db").Column<number, any>;
|
|
81
|
+
ownerNodeId: import("@proteinjs/db").Column<string | null | undefined, any>;
|
|
82
|
+
heartbeatAt: import("@proteinjs/db").Column<Moment | null | undefined, any>;
|
|
83
|
+
} & {};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=AccountDeletionTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountDeletionTable.d.ts","sourceRoot":"","sources":["../../../src/tables/AccountDeletionTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,EACL,MAAM,EAEP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;gGACgG;AAChG,eAAO,MAAM,uBAAuB,sDAAuD,CAAC;AAC5F,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,eAAgB,SAAQ,MAAM;IAC7C,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,qGAAqG;IACrG,UAAU,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,KAAK,CAAC,eAAe,CAAC;IAC9D,IAAI,SAAsB;IAC1B,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAOlC;IACF,OAAO;;;;QAEL;IACF,OAAO;;;;;;;;;;;;;;WAUJ;CACJ"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AccountDeletionTable = exports.ACCOUNT_DELETION_PHASES = void 0;
|
|
19
|
+
var db_1 = require("@proteinjs/db");
|
|
20
|
+
var permissions_1 = require("../permissions");
|
|
21
|
+
/** Purge-machine phases. `grace` = cancelable window; `restoring` = a cancel-by-login claimed the
|
|
22
|
+
* row; `purging` = the walker claimed it; `purged` = rows erased, completion email pending. */
|
|
23
|
+
exports.ACCOUNT_DELETION_PHASES = ['grace', 'restoring', 'purging', 'purged'];
|
|
24
|
+
/**
|
|
25
|
+
* Locked like `SessionTable`: readable behind the 'users' permission, and NO write doors — rows
|
|
26
|
+
* are system-written only (the deletion service and the purge walker ride system paths, which
|
|
27
|
+
* bypass TableAuth). The manifest holds cross-user grant data, so even break-glass admin gets
|
|
28
|
+
* no generic write surface.
|
|
29
|
+
*/
|
|
30
|
+
var AccountDeletionTable = /** @class */ (function (_super) {
|
|
31
|
+
__extends(AccountDeletionTable, _super);
|
|
32
|
+
function AccountDeletionTable() {
|
|
33
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
+
_this.name = 'account_deletion';
|
|
35
|
+
_this.auth = {
|
|
36
|
+
db: {
|
|
37
|
+
query: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
38
|
+
},
|
|
39
|
+
service: {
|
|
40
|
+
query: { permission: permissions_1.USER_PERMISSIONS.users },
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
_this.indexes = [
|
|
44
|
+
{ name: 'idx_account_deletion_user_id_unique', columns: ['userId'], unique: true },
|
|
45
|
+
];
|
|
46
|
+
_this.columns = (0, db_1.withRecordColumns)({
|
|
47
|
+
userId: new db_1.StringColumn('user_id', {}, 36),
|
|
48
|
+
userEmail: new db_1.StringColumn('user_email', {}, 250),
|
|
49
|
+
phase: new db_1.StringColumn('phase', {}, 16),
|
|
50
|
+
purgeAfter: new db_1.DateTimeColumn('purge_after'),
|
|
51
|
+
manifestGrants: new db_1.ObjectColumn('manifest_grants'),
|
|
52
|
+
ownedResourceIds: new db_1.ObjectColumn('owned_resource_ids'),
|
|
53
|
+
leaseSeq: new db_1.IntegerColumn('lease_seq'),
|
|
54
|
+
ownerNodeId: new db_1.StringColumn('owner_node_id'),
|
|
55
|
+
heartbeatAt: new db_1.DateTimeColumn('heartbeat_at'),
|
|
56
|
+
});
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
return AccountDeletionTable;
|
|
60
|
+
}(db_1.Table));
|
|
61
|
+
exports.AccountDeletionTable = AccountDeletionTable;
|
|
62
|
+
//# sourceMappingURL=AccountDeletionTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountDeletionTable.js","sourceRoot":"","sources":["../../../src/tables/AccountDeletionTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAQuB;AAEvB,8CAAkD;AAGlD;gGACgG;AACnF,QAAA,uBAAuB,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAU,CAAC;AAoD5F;;;;;GAKG;AACH;IAA0C,wCAAsB;IAAhE;QAAA,qEAwBC;QAvBC,UAAI,GAAG,kBAAkB,CAAC;QAC1B,UAAI,GAAmC;YACrC,EAAE,EAAE;gBACF,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;aAC9C;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,EAAE,UAAU,EAAE,8BAAgB,CAAC,KAAK,EAAE;aAC9C;SACF,CAAC;QACF,aAAO,GAAG;YACR,EAAE,IAAI,EAAE,qCAAqC,EAAE,OAAO,EAAE,CAAC,QAAQ,CAA8B,EAAE,MAAM,EAAE,IAAI,EAAE;SAChH,CAAC;QACF,aAAO,GAAG,IAAA,sBAAiB,EAAkB;YAC3C,MAAM,EAAE,IAAI,iBAAY,CAAC,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;YAC3C,SAAS,EAAE,IAAI,iBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC;YAClD,KAAK,EAAE,IAAI,iBAAY,CAAuB,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC;YAC9D,UAAU,EAAE,IAAI,mBAAc,CAAC,aAAa,CAAC;YAC7C,cAAc,EAAE,IAAI,iBAAY,CAAkB,iBAAiB,CAAC;YACpE,gBAAgB,EAAE,IAAI,iBAAY,CAAW,oBAAoB,CAAC;YAClE,QAAQ,EAAE,IAAI,kBAAa,CAAC,WAAW,CAAC;YACxC,WAAW,EAAE,IAAI,iBAAY,CAAC,eAAe,CAAC;YAC9C,WAAW,EAAE,IAAI,mBAAc,CAAC,cAAc,CAAC;SAChD,CAAC,CAAC;;IACL,CAAC;IAAD,2BAAC;AAAD,CAAC,AAxBD,CAA0C,UAAK,GAwB9C;AAxBY,oDAAoB"}
|
|
@@ -19,10 +19,10 @@ export declare class SessionTable extends Table<Session> {
|
|
|
19
19
|
created: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
20
20
|
updated: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
21
21
|
} & {} & {
|
|
22
|
+
userEmail: import("@proteinjs/db").Column<string, any>;
|
|
22
23
|
session: import("@proteinjs/db").Column<string, any>;
|
|
23
24
|
sessionId: import("@proteinjs/db").Column<string, any>;
|
|
24
25
|
expires: import("@proteinjs/db").Column<Date, any>;
|
|
25
|
-
userEmail: import("@proteinjs/db").Column<string, any>;
|
|
26
26
|
} & {};
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=SessionTable.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Table, Record } from '@proteinjs/db';
|
|
2
|
+
import { UserStatus } from './UserTable';
|
|
3
|
+
/**
|
|
4
|
+
* Audit row written by the SetUserStatus service for EVERY status change. The base `created`
|
|
5
|
+
* column is the change timestamp. Rows are append-only: readable by admins (the same scope as
|
|
6
|
+
* the service that writes them), written only by the service's system path — no generic door
|
|
7
|
+
* grants writes, so the trail cannot be edited from the record surfaces.
|
|
8
|
+
*/
|
|
9
|
+
export type UserStatusEvent = Record & {
|
|
10
|
+
/** id of the user who made the change */
|
|
11
|
+
actor: string;
|
|
12
|
+
/** id of the user whose status changed */
|
|
13
|
+
target: string;
|
|
14
|
+
/** the standing the target was set to */
|
|
15
|
+
status: UserStatus;
|
|
16
|
+
};
|
|
17
|
+
export declare class UserStatusEventTable extends Table<UserStatusEvent> {
|
|
18
|
+
name: string;
|
|
19
|
+
auth: Table<UserStatusEvent>['auth'];
|
|
20
|
+
columns: {
|
|
21
|
+
id: import("@proteinjs/db").Column<string, any>;
|
|
22
|
+
created: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
23
|
+
updated: import("@proteinjs/db").Column<import("moment").Moment, any>;
|
|
24
|
+
} & {} & {
|
|
25
|
+
status: import("@proteinjs/db").Column<"active" | "deactivated", any>;
|
|
26
|
+
actor: import("@proteinjs/db").Column<string, any>;
|
|
27
|
+
target: import("@proteinjs/db").Column<string, any>;
|
|
28
|
+
} & {};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=UserStatusEventTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStatusEventTable.d.ts","sourceRoot":"","sources":["../../../src/tables/UserStatusEventTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,EAAqB,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IACrC,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,KAAK,CAAC,eAAe,CAAC;IAC9D,IAAI,SAAuB;IAC3B,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAOlC;IACF,OAAO;;;;;;;;WAIJ;CACJ"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.UserStatusEventTable = void 0;
|
|
19
|
+
var db_1 = require("@proteinjs/db");
|
|
20
|
+
var UserStatusEventTable = /** @class */ (function (_super) {
|
|
21
|
+
__extends(UserStatusEventTable, _super);
|
|
22
|
+
function UserStatusEventTable() {
|
|
23
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
24
|
+
_this.name = 'user_status_event';
|
|
25
|
+
_this.auth = {
|
|
26
|
+
db: {
|
|
27
|
+
query: ['admin'],
|
|
28
|
+
},
|
|
29
|
+
service: {
|
|
30
|
+
query: ['admin'],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
_this.columns = (0, db_1.withRecordColumns)({
|
|
34
|
+
actor: new db_1.StringColumn('actor', {}, 36),
|
|
35
|
+
target: new db_1.StringColumn('target', {}, 36),
|
|
36
|
+
status: new db_1.StringColumn('status', {}, 16),
|
|
37
|
+
});
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
return UserStatusEventTable;
|
|
41
|
+
}(db_1.Table));
|
|
42
|
+
exports.UserStatusEventTable = UserStatusEventTable;
|
|
43
|
+
//# sourceMappingURL=UserStatusEventTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserStatusEventTable.js","sourceRoot":"","sources":["../../../src/tables/UserStatusEventTable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,oCAA+E;AAkB/E;IAA0C,wCAAsB;IAAhE;QAAA,qEAeC;QAdC,UAAI,GAAG,mBAAmB,CAAC;QAC3B,UAAI,GAAmC;YACrC,EAAE,EAAE;gBACF,KAAK,EAAE,CAAC,OAAO,CAAC;aACjB;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,CAAC,OAAO,CAAC;aACjB;SACF,CAAC;QACF,aAAO,GAAG,IAAA,sBAAiB,EAAkB;YAC3C,KAAK,EAAE,IAAI,iBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC;YACxC,MAAM,EAAE,IAAI,iBAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;YAC1C,MAAM,EAAE,IAAI,iBAAY,CAAa,QAAQ,EAAE,EAAE,EAAE,EAAE,CAAC;SACvD,CAAC,CAAC;;IACL,CAAC;IAAD,2BAAC;AAAD,CAAC,AAfD,CAA0C,UAAK,GAe9C;AAfY,oDAAoB"}
|