@byline/admin 3.10.1 → 3.11.1
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/dist/abilities.js +2 -0
- package/dist/exports-parity.test.node.d.ts +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/modules/admin-activity/abilities.d.ts +31 -0
- package/dist/modules/admin-activity/abilities.js +13 -0
- package/dist/modules/admin-activity/index.d.ts +19 -0
- package/dist/modules/admin-activity/index.js +1 -0
- package/package.json +10 -5
- package/src/abilities.ts +2 -0
- package/src/exports-parity.test.node.ts +50 -0
- package/src/index.ts +1 -0
- package/src/modules/admin-activity/abilities.ts +46 -0
- package/src/modules/admin-activity/index.ts +25 -0
package/dist/abilities.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerAdminActivityAbilities } from "./modules/admin-activity/abilities.js";
|
|
1
2
|
import { registerAdminPermissionsAbilities } from "./modules/admin-permissions/abilities.js";
|
|
2
3
|
import { registerAdminRolesAbilities } from "./modules/admin-roles/abilities.js";
|
|
3
4
|
import { registerAdminUsersAbilities } from "./modules/admin-users/abilities.js";
|
|
@@ -5,5 +6,6 @@ function registerAdminAbilities(registry) {
|
|
|
5
6
|
registerAdminUsersAbilities(registry);
|
|
6
7
|
registerAdminRolesAbilities(registry);
|
|
7
8
|
registerAdminPermissionsAbilities(registry);
|
|
9
|
+
registerAdminActivityAbilities(registry);
|
|
8
10
|
}
|
|
9
11
|
export { registerAdminAbilities };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { registerAdminAbilities } from './abilities.js';
|
|
|
24
24
|
export { assertAdminActor, requireAdminActor } from './lib/assert-admin-actor.js';
|
|
25
25
|
export { type Command, type CreateCommandAuthSpec, type CreateCommandHandlerArgs, type CreateCommandSpec, createCommand, } from './lib/create-command.js';
|
|
26
26
|
export * from './modules/admin-account/index.js';
|
|
27
|
+
export * from './modules/admin-activity/index.js';
|
|
27
28
|
export * from './modules/admin-permissions/index.js';
|
|
28
29
|
export * from './modules/admin-roles/index.js';
|
|
29
30
|
export * from './modules/admin-users/index.js';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
import type { AbilityRegistry } from '@byline/auth';
|
|
9
|
+
/**
|
|
10
|
+
* Ability keys for the admin-activity module (docs/AUDIT.md — Workstream 4).
|
|
11
|
+
*
|
|
12
|
+
* `read` gates the system-wide activity area — the `/admin/activity` report
|
|
13
|
+
* over the version-stream + audit-log union. It is deliberately a **separate**
|
|
14
|
+
* ability from any collection's `collections.<path>.read`: the activity feed is
|
|
15
|
+
* not reachable transitively from a content ability, so an auditor role can be
|
|
16
|
+
* granted visibility into who-changed-what without being granted read (let
|
|
17
|
+
* alone write) access to the documents themselves.
|
|
18
|
+
*
|
|
19
|
+
* Read-only by design — there is no write counterpart. The audit log is
|
|
20
|
+
* append-only and is written by the lifecycle write-points, never edited.
|
|
21
|
+
*/
|
|
22
|
+
export declare const ADMIN_ACTIVITY_ABILITIES: {
|
|
23
|
+
readonly read: "admin.activity.read";
|
|
24
|
+
};
|
|
25
|
+
export type AdminActivityAbilityKey = (typeof ADMIN_ACTIVITY_ABILITIES)[keyof typeof ADMIN_ACTIVITY_ABILITIES];
|
|
26
|
+
/**
|
|
27
|
+
* Called from `registerAdminAbilities(registry)` at package level, which
|
|
28
|
+
* fans out to every admin module's registrar so the webapp wiring stays a
|
|
29
|
+
* single line.
|
|
30
|
+
*/
|
|
31
|
+
export declare function registerAdminActivityAbilities(registry: AbilityRegistry): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const ADMIN_ACTIVITY_ABILITIES = {
|
|
2
|
+
read: 'admin.activity.read'
|
|
3
|
+
};
|
|
4
|
+
function registerAdminActivityAbilities(registry) {
|
|
5
|
+
registry.register({
|
|
6
|
+
key: ADMIN_ACTIVITY_ABILITIES.read,
|
|
7
|
+
label: 'Read system activity',
|
|
8
|
+
description: "View the system-wide activity report — content saves and audit-log events (status / path / locale changes, deletions) across all collections.",
|
|
9
|
+
group: 'admin.activity',
|
|
10
|
+
source: 'admin'
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export { ADMIN_ACTIVITY_ABILITIES, registerAdminActivityAbilities };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* `@byline/admin/admin-activity` — the system-wide activity area
|
|
10
|
+
* (docs/AUDIT.md — Workstream 4).
|
|
11
|
+
*
|
|
12
|
+
* Unlike the other admin modules this one owns no table and no AdminStore
|
|
13
|
+
* repository: the activity feed is a read over the document db adapter's
|
|
14
|
+
* version stream + audit log (`IAuditQueries.findAuditLog`), assembled at the
|
|
15
|
+
* host transport layer. This module contributes only the `admin.activity.read`
|
|
16
|
+
* ability — registered at `initBylineCore()` time through the `AbilityRegistry`
|
|
17
|
+
* — so the feed is grantable independently of any content ability.
|
|
18
|
+
*/
|
|
19
|
+
export { ADMIN_ACTIVITY_ABILITIES, type AdminActivityAbilityKey, registerAdminActivityAbilities, } from './abilities.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ADMIN_ACTIVITY_ABILITIES, registerAdminActivityAbilities } from "./abilities.js";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@byline/admin",
|
|
3
3
|
"private": false,
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
|
-
"version": "3.
|
|
5
|
+
"version": "3.11.1",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.9.0"
|
|
8
8
|
},
|
|
@@ -47,6 +47,11 @@
|
|
|
47
47
|
"import": "./dist/modules/auth/index.js",
|
|
48
48
|
"require": "./dist/modules/auth/index.js"
|
|
49
49
|
},
|
|
50
|
+
"./admin-activity": {
|
|
51
|
+
"types": "./dist/modules/admin-activity/index.d.ts",
|
|
52
|
+
"import": "./dist/modules/admin-activity/index.js",
|
|
53
|
+
"require": "./dist/modules/admin-activity/index.js"
|
|
54
|
+
},
|
|
50
55
|
"./admin-users": {
|
|
51
56
|
"types": "./dist/modules/admin-users/index.d.ts",
|
|
52
57
|
"import": "./dist/modules/admin-users/index.js",
|
|
@@ -146,10 +151,10 @@
|
|
|
146
151
|
"uuid": "^14.0.0",
|
|
147
152
|
"zod": "^4.4.3",
|
|
148
153
|
"zod-form-data": "^3.0.1",
|
|
149
|
-
"@byline/auth": "3.
|
|
150
|
-
"@byline/
|
|
151
|
-
"@byline/
|
|
152
|
-
"@byline/
|
|
154
|
+
"@byline/auth": "3.11.1",
|
|
155
|
+
"@byline/ui": "3.11.1",
|
|
156
|
+
"@byline/core": "3.11.1",
|
|
157
|
+
"@byline/i18n": "3.11.1"
|
|
153
158
|
},
|
|
154
159
|
"peerDependencies": {
|
|
155
160
|
"react": "^19.0.0",
|
package/src/abilities.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type { AbilityRegistry } from '@byline/auth'
|
|
10
10
|
|
|
11
|
+
import { registerAdminActivityAbilities } from './modules/admin-activity/abilities.js'
|
|
11
12
|
import { registerAdminPermissionsAbilities } from './modules/admin-permissions/abilities.js'
|
|
12
13
|
import { registerAdminRolesAbilities } from './modules/admin-roles/abilities.js'
|
|
13
14
|
import { registerAdminUsersAbilities } from './modules/admin-users/abilities.js'
|
|
@@ -28,5 +29,6 @@ export function registerAdminAbilities(registry: AbilityRegistry): void {
|
|
|
28
29
|
registerAdminUsersAbilities(registry)
|
|
29
30
|
registerAdminRolesAbilities(registry)
|
|
30
31
|
registerAdminPermissionsAbilities(registry)
|
|
32
|
+
registerAdminActivityAbilities(registry)
|
|
31
33
|
// registerAccountAbilities(registry) — added when that module lands
|
|
32
34
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Guard against `publishConfig.exports` drift.
|
|
11
|
+
*
|
|
12
|
+
* `@byline/admin` carries a `publishConfig.exports` block that npm uses to
|
|
13
|
+
* **override** the top-level `exports` at publish time. The workspace and dev
|
|
14
|
+
* builds resolve through the top-level `exports` (or source), so a subpath
|
|
15
|
+
* added there but forgotten in `publishConfig.exports` typechecks and builds
|
|
16
|
+
* locally yet is **missing from the published package** — surfacing only as a
|
|
17
|
+
* downstream consumer's build error ("X is not exported …"). That is exactly
|
|
18
|
+
* how `./admin-activity` slipped through in v3.11.0.
|
|
19
|
+
*
|
|
20
|
+
* This test fails the moment the two blocks drift, so the gap is caught in
|
|
21
|
+
* `pnpm test` / CI rather than in a production Docker build.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import { readFileSync } from 'node:fs'
|
|
25
|
+
import { dirname, resolve } from 'node:path'
|
|
26
|
+
import { fileURLToPath } from 'node:url'
|
|
27
|
+
|
|
28
|
+
import { describe, expect, it } from 'vitest'
|
|
29
|
+
|
|
30
|
+
const pkgPath = resolve(dirname(fileURLToPath(import.meta.url)), '../package.json')
|
|
31
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8')) as {
|
|
32
|
+
exports: Record<string, unknown>
|
|
33
|
+
publishConfig?: { exports?: Record<string, unknown> }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
describe('package.json export parity', () => {
|
|
37
|
+
it('every top-level export subpath is also declared in publishConfig.exports', () => {
|
|
38
|
+
const publishExports = pkg.publishConfig?.exports
|
|
39
|
+
// If there is no override, the top-level exports ship as-is — nothing to check.
|
|
40
|
+
if (publishExports == null) return
|
|
41
|
+
|
|
42
|
+
const missing = Object.keys(pkg.exports).filter((key) => !(key in publishExports))
|
|
43
|
+
expect(
|
|
44
|
+
missing,
|
|
45
|
+
`publishConfig.exports is missing subpath(s) present in the top-level exports: ${missing.join(
|
|
46
|
+
', '
|
|
47
|
+
)}. The published package would not expose them — add them to BOTH blocks.`
|
|
48
|
+
).toEqual([])
|
|
49
|
+
})
|
|
50
|
+
})
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export {
|
|
|
32
32
|
createCommand,
|
|
33
33
|
} from './lib/create-command.js'
|
|
34
34
|
export * from './modules/admin-account/index.js'
|
|
35
|
+
export * from './modules/admin-activity/index.js'
|
|
35
36
|
export * from './modules/admin-permissions/index.js'
|
|
36
37
|
export * from './modules/admin-roles/index.js'
|
|
37
38
|
export * from './modules/admin-users/index.js'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { AbilityRegistry } from '@byline/auth'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Ability keys for the admin-activity module (docs/AUDIT.md — Workstream 4).
|
|
13
|
+
*
|
|
14
|
+
* `read` gates the system-wide activity area — the `/admin/activity` report
|
|
15
|
+
* over the version-stream + audit-log union. It is deliberately a **separate**
|
|
16
|
+
* ability from any collection's `collections.<path>.read`: the activity feed is
|
|
17
|
+
* not reachable transitively from a content ability, so an auditor role can be
|
|
18
|
+
* granted visibility into who-changed-what without being granted read (let
|
|
19
|
+
* alone write) access to the documents themselves.
|
|
20
|
+
*
|
|
21
|
+
* Read-only by design — there is no write counterpart. The audit log is
|
|
22
|
+
* append-only and is written by the lifecycle write-points, never edited.
|
|
23
|
+
*/
|
|
24
|
+
export const ADMIN_ACTIVITY_ABILITIES = {
|
|
25
|
+
read: 'admin.activity.read',
|
|
26
|
+
} as const
|
|
27
|
+
|
|
28
|
+
export type AdminActivityAbilityKey =
|
|
29
|
+
(typeof ADMIN_ACTIVITY_ABILITIES)[keyof typeof ADMIN_ACTIVITY_ABILITIES]
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Called from `registerAdminAbilities(registry)` at package level, which
|
|
33
|
+
* fans out to every admin module's registrar so the webapp wiring stays a
|
|
34
|
+
* single line.
|
|
35
|
+
*/
|
|
36
|
+
export function registerAdminActivityAbilities(registry: AbilityRegistry): void {
|
|
37
|
+
registry.register({
|
|
38
|
+
key: ADMIN_ACTIVITY_ABILITIES.read,
|
|
39
|
+
label: 'Read system activity',
|
|
40
|
+
description:
|
|
41
|
+
'View the system-wide activity report — content saves and audit-log ' +
|
|
42
|
+
'events (status / path / locale changes, deletions) across all collections.',
|
|
43
|
+
group: 'admin.activity',
|
|
44
|
+
source: 'admin',
|
|
45
|
+
})
|
|
46
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This Source Code is subject to the terms of the Mozilla Public
|
|
3
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Infonomic Company Limited
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `@byline/admin/admin-activity` — the system-wide activity area
|
|
11
|
+
* (docs/AUDIT.md — Workstream 4).
|
|
12
|
+
*
|
|
13
|
+
* Unlike the other admin modules this one owns no table and no AdminStore
|
|
14
|
+
* repository: the activity feed is a read over the document db adapter's
|
|
15
|
+
* version stream + audit log (`IAuditQueries.findAuditLog`), assembled at the
|
|
16
|
+
* host transport layer. This module contributes only the `admin.activity.read`
|
|
17
|
+
* ability — registered at `initBylineCore()` time through the `AbilityRegistry`
|
|
18
|
+
* — so the feed is grantable independently of any content ability.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
ADMIN_ACTIVITY_ABILITIES,
|
|
23
|
+
type AdminActivityAbilityKey,
|
|
24
|
+
registerAdminActivityAbilities,
|
|
25
|
+
} from './abilities.js'
|