@jwilleke/ngdpbase-types 5.27.0 → 5.29.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/lib/packages/ngdpbase-types/index.d.ts +4 -1
- package/lib/src/context/ActorContext.d.ts +15 -2
- package/lib/src/context/ActorContext.js +20 -0
- package/lib/src/context/ApiContext.d.ts +17 -4
- package/lib/src/context/ApiContext.js +22 -6
- package/lib/src/ice/runImport.d.ts +26 -0
- package/lib/src/ice/types.d.ts +29 -0
- package/lib/src/managers/AddonsManager.d.ts +7 -3
- package/lib/src/managers/AssetManager.d.ts +7 -3
- package/lib/src/managers/ExportManager.js +5 -0
- package/lib/src/managers/ImportManager.d.ts +57 -8
- package/lib/src/managers/OrganizationManager.d.ts +5 -3
- package/lib/src/managers/PageManager.d.ts +32 -0
- package/lib/src/managers/PersonManager.d.ts +48 -14
- package/lib/src/managers/RoleManager.d.ts +79 -19
- package/lib/src/managers/UserManager.d.ts +66 -2
- package/lib/src/security/PolicyDecisionPoint.d.ts +18 -9
- package/lib/src/security/PolicyInformationPoint.d.ts +25 -10
- package/lib/src/types/Consent.js +22 -0
- package/lib/src/types/User.d.ts +1 -1
- package/lib/src/utils/auditEventNames.generated.d.ts +10 -10
- package/lib/src/utils/auditEventNames.generated.js +10 -10
- package/lib/src/utils/contactAccess.d.ts +30 -0
- package/lib/src/utils/keyedSerial.d.ts +31 -0
- package/lib/src/utils/privateStoreAccess.js +1 -3
- package/lib/src/utils/roleChangeError.d.ts +25 -0
- package/lib/src/utils/subjectMayDo.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KeyedSerial — one task at a time per key, within this process (#2015).
|
|
3
|
+
*
|
|
4
|
+
* A read-modify-write of one record (read the file, change it, write it back)
|
|
5
|
+
* is only safe while nothing else writes that record in between. Two role
|
|
6
|
+
* changes to one role used to interleave: each read the member list before the
|
|
7
|
+
* other wrote it, and the second write dropped the first one's member. Running
|
|
8
|
+
* every read-modify-write of a key through `run` makes them happen one after
|
|
9
|
+
* another, each reading what the last one wrote. Different keys still run side
|
|
10
|
+
* by side.
|
|
11
|
+
*
|
|
12
|
+
* What it does not do:
|
|
13
|
+
*
|
|
14
|
+
* - **Not across processes.** Two server processes sharing one data folder can
|
|
15
|
+
* still race; no supported deployment runs that way.
|
|
16
|
+
* - **Not re-entrant.** A task must not `run` the same key again and wait for
|
|
17
|
+
* it: the inner task queues behind the outer one, which never finishes.
|
|
18
|
+
*
|
|
19
|
+
* A failed task fails its own caller only; the next task on the key runs as
|
|
20
|
+
* usual. A key's entry is dropped once its queue is empty, so the map holds
|
|
21
|
+
* only keys with work in flight.
|
|
22
|
+
*/
|
|
23
|
+
export declare class KeyedSerial {
|
|
24
|
+
/** The settled tail of each key's queue: never rejects. */
|
|
25
|
+
private readonly tails;
|
|
26
|
+
/** Run `task` after every earlier task on `key` has settled; resolves or rejects as `task` does. */
|
|
27
|
+
run<T>(key: string, task: () => Promise<T>): Promise<T>;
|
|
28
|
+
/** Resolves once every task queued so far, on every key, has settled (shutdown). */
|
|
29
|
+
settled(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export default KeyedSerial;
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
* slice 4).
|
|
26
26
|
*/
|
|
27
27
|
import { isJobContext } from '../context/ActorContext.js';
|
|
28
|
-
import { toPermissionSubject } from '../context/JobContext.js';
|
|
29
28
|
import { shareNamesVault } from '../types/Share.js';
|
|
30
29
|
import { mixesProxyWithDelegation, proxyCarries } from './proxyClaim.js';
|
|
31
30
|
export function mayActInPrivateContainer(ctx, owner, opts = {}) {
|
|
@@ -60,6 +59,5 @@ export function mayActInPrivateContainer(ctx, owner, opts = {}) {
|
|
|
60
59
|
export async function permitsInVault(pdp, ctx, action, where) {
|
|
61
60
|
if (!pdp || !mayActInPrivateContainer(ctx, where.owner, { vault: where.vault }))
|
|
62
61
|
return false;
|
|
63
|
-
|
|
64
|
-
return (await pdp.decide(subject, { action, resource: { type: 'page', id: where.resource }, attributes: { vault: where.vault } })).permit;
|
|
62
|
+
return (await pdp.decide(ctx, { action, resource: { type: 'page', id: where.resource }, attributes: { vault: where.vault } })).permit;
|
|
65
63
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A role change that did not happen (#2015).
|
|
3
|
+
*
|
|
4
|
+
* Operator, 2026-10-23: adding or removing a role completes or it does not
|
|
5
|
+
* happen, everywhere, and one that cannot be made is always an error. So a
|
|
6
|
+
* request that asks for several role changes either gets all of them or none:
|
|
7
|
+
* RoleManager undoes the ones that landed before the failure, then throws
|
|
8
|
+
* this, and the request that asked fails with it.
|
|
9
|
+
*
|
|
10
|
+
* The message is shown to whoever asked (an administrator's form). It names
|
|
11
|
+
* the account, the change that failed and, when it is something an
|
|
12
|
+
* administrator can fix, the reason (no Person record, no anchor
|
|
13
|
+
* Organization). Storage detail (paths, errno) stays in `cause`, for the log.
|
|
14
|
+
*/
|
|
15
|
+
export declare class RoleChangeError extends Error {
|
|
16
|
+
/** The change that could not be made, as `add <role>` / `remove <role>`. */
|
|
17
|
+
readonly failed: readonly string[];
|
|
18
|
+
/** Changes that landed, could not be undone, and so are still in effect. Empty when nothing was left changed. */
|
|
19
|
+
readonly notUndone: readonly string[];
|
|
20
|
+
constructor(subject: string, failed: readonly string[], options?: {
|
|
21
|
+
reason?: string;
|
|
22
|
+
cause?: unknown;
|
|
23
|
+
notUndone?: readonly string[];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
* had somewhere to go that is not a second evaluator: a role name skips
|
|
13
13
|
* PolicyEvaluator, deny policies and the token ceiling; this does not.
|
|
14
14
|
*/
|
|
15
|
-
import type {
|
|
15
|
+
import type { ActorContext } from '../context/ActorContext.js';
|
|
16
16
|
import type { CorePermission } from '../security/permissions.generated.js';
|
|
17
17
|
type EngineLike = {
|
|
18
18
|
getManager: (name: string) => unknown;
|
|
19
19
|
} | null | undefined;
|
|
20
|
-
export declare function subjectMayDo(engine: EngineLike, subject:
|
|
20
|
+
export declare function subjectMayDo(engine: EngineLike, subject: ActorContext | null | undefined, action: CorePermission): Promise<boolean>;
|
|
21
21
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jwilleke/ngdpbase-types",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.29.0",
|
|
4
4
|
"description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Jim Willeke",
|