@jini-ai/cms 0.3.10 → 0.4.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 +59 -0
- package/README.md +47 -19
- package/dist/content-types/agent-tools.d.ts +3 -56
- package/dist/content-types/agent-tools.js +22 -6
- package/dist/content-types/cleanup.d.ts +18 -13
- package/dist/content-types/cleanup.js +16 -11
- package/dist/content-types/errors.d.ts +57 -24
- package/dist/content-types/errors.js +56 -39
- package/dist/content-types/field-defs.d.ts +8 -4
- package/dist/content-types/field-defs.js +19 -14
- package/dist/content-types/index-provisioning.d.ts +61 -47
- package/dist/content-types/index-provisioning.js +90 -66
- package/dist/content-types/index.d.ts +4 -3
- package/dist/content-types/lifecycle-dispatch.d.ts +11 -5
- package/dist/content-types/lifecycle-dispatch.js +5 -4
- package/dist/content-types/lifecycle.d.ts +23 -18
- package/dist/content-types/lifecycle.js +71 -64
- package/dist/content-types/repo.memory.d.ts +5 -4
- package/dist/content-types/repo.memory.js +3 -2
- package/dist/content-types/tool-registrations.d.ts +6 -8
- package/dist/content-types/tool-registrations.js +24 -28
- package/dist/content-types/types.d.ts +17 -13
- package/dist/content-types/types.js +11 -5
- package/dist/content-types/write-service.d.ts +20 -22
- package/dist/content-types/write-service.js +78 -75
- package/dist/core/authorization.d.ts +15 -0
- package/dist/core/authorization.js +2 -0
- package/dist/core/commands/change-set.d.ts +15 -7
- package/dist/core/commands/command.d.ts +45 -26
- package/dist/core/commands/command.js +73 -63
- package/dist/core/entity-liveness.d.ts +11 -7
- package/dist/core/entity-liveness.js +5 -4
- package/dist/core/index.d.ts +12 -5
- package/dist/core/index.js +10 -4
- package/dist/core/ports.d.ts +25 -24
- package/dist/core/ports.js +1 -0
- package/dist/core/tools/args.d.ts +49 -0
- package/dist/core/tools/args.js +46 -0
- package/dist/core/tools/index.d.ts +3 -0
- package/dist/core/tools/index.js +3 -0
- package/dist/entries/agent-tools.d.ts +1 -73
- package/dist/entries/agent-tools.js +19 -13
- package/dist/entries/errors.d.ts +28 -14
- package/dist/entries/errors.js +17 -11
- package/dist/entries/field-validation.d.ts +5 -3
- package/dist/entries/field-validation.js +7 -5
- package/dist/entries/index.d.ts +2 -2
- package/dist/entries/lifecycle-dispatch.d.ts +5 -2
- package/dist/entries/lifecycle-dispatch.js +2 -1
- package/dist/entries/list.d.ts +4 -2
- package/dist/entries/list.js +4 -3
- package/dist/entries/repo.memory.d.ts +12 -10
- package/dist/entries/repo.memory.js +11 -10
- package/dist/entries/tool-registrations.d.ts +6 -8
- package/dist/entries/tool-registrations.js +42 -41
- package/dist/entries/types.d.ts +0 -7
- package/dist/entries/write-service.d.ts +28 -29
- package/dist/entries/write-service.js +114 -105
- package/dist/http/settings/cms-adapter.d.ts +20 -0
- package/dist/http/settings/cms-adapter.js +124 -0
- package/dist/http/settings/contracts.d.ts +135 -0
- package/dist/http/settings/contracts.js +2 -0
- package/dist/http/settings/http.d.ts +10 -0
- package/dist/http/settings/http.js +211 -0
- package/dist/http/settings/index.d.ts +5 -0
- package/dist/http/settings/index.js +4 -0
- package/dist/http/settings/shared.d.ts +68 -0
- package/dist/http/settings/shared.js +54 -0
- package/dist/http/settings/stream.d.ts +24 -0
- package/dist/http/settings/stream.js +147 -0
- package/dist/media/agent-tools.d.ts +1 -66
- package/dist/media/agent-tools.js +5 -1
- package/dist/media/blob-gc-lock.d.ts +6 -2
- package/dist/media/blob-gc-lock.js +4 -2
- package/dist/media/blob-gc.d.ts +64 -51
- package/dist/media/blob-gc.js +62 -52
- package/dist/media/blob-key.d.ts +1 -1
- package/dist/media/content-type-sniffer.d.ts +3 -1
- package/dist/media/content-type-sniffer.js +1 -1
- package/dist/media/html-attributes.d.ts +9 -5
- package/dist/media/html-attributes.js +8 -6
- package/dist/media/image-transformer.js +1 -1
- package/dist/media/image-transformer.sharp.d.ts +6 -0
- package/dist/media/image-transformer.sharp.js +12 -6
- package/dist/media/import/fetch-image.d.ts +24 -0
- package/dist/media/import/fetch-image.js +137 -0
- package/dist/media/import/index.d.ts +3 -0
- package/dist/media/import/index.js +3 -0
- package/dist/media/import/ports.d.ts +38 -0
- package/dist/media/index.d.ts +7 -1
- package/dist/media/index.js +1 -0
- package/dist/media/media-service.d.ts +14 -10
- package/dist/media/media-service.js +57 -52
- package/dist/media/ports.d.ts +3 -2
- package/dist/media/rendition-service.d.ts +3 -3
- package/dist/media/rendition-service.js +38 -37
- package/dist/media/repo.memory.d.ts +18 -7
- package/dist/media/repo.memory.js +12 -6
- package/dist/media/tool-registrations.d.ts +16 -15
- package/dist/media/tool-registrations.js +84 -72
- package/dist/media/transform-lock.d.ts +22 -12
- package/dist/media/transform-lock.js +14 -13
- package/dist/media/transform-registry.d.ts +3 -3
- package/dist/media/transform-registry.js +19 -18
- package/dist/media/transform-types.d.ts +8 -3
- package/dist/media/transform-types.js +10 -5
- package/dist/media/types.d.ts +21 -4
- package/dist/media/types.js +15 -2
- package/dist/navigation/agent-tools.d.ts +1 -80
- package/dist/navigation/agent-tools.js +15 -3
- package/dist/navigation/contracts.d.ts +1 -1
- package/dist/navigation/index.d.ts +2 -2
- package/dist/navigation/menu-service.d.ts +57 -40
- package/dist/navigation/menu-service.js +80 -69
- package/dist/navigation/ports.d.ts +1 -1
- package/dist/navigation/read-model.d.ts +3 -1
- package/dist/navigation/read-model.js +2 -2
- package/dist/navigation/reconcile.d.ts +2 -2
- package/dist/navigation/reconcile.js +2 -1
- package/dist/navigation/repo.memory.d.ts +7 -3
- package/dist/navigation/repo.memory.js +4 -2
- package/dist/navigation/resolver.d.ts +4 -1
- package/dist/navigation/resolver.js +1 -1
- package/dist/navigation/tool-registrations.d.ts +6 -8
- package/dist/navigation/tool-registrations.js +44 -42
- package/dist/navigation/types.d.ts +1 -1
- package/dist/presentation/presentation.d.ts +11 -3
- package/dist/presentation/presentation.js +13 -6
- package/dist/presentation/repo.memory.d.ts +6 -2
- package/dist/presentation/repo.memory.js +3 -2
- package/dist/settings/agent-tools.d.ts +2 -75
- package/dist/settings/agent-tools.js +49 -45
- package/dist/settings/agent-value-write-tools.d.ts +22 -0
- package/dist/settings/agent-value-write-tools.js +154 -0
- package/dist/settings/agent-writable-preferences.js +8 -20
- package/dist/settings/agent-write-denylist.d.ts +19 -0
- package/dist/settings/agent-write-denylist.js +15 -0
- package/dist/settings/change-feed.d.ts +11 -2
- package/dist/settings/change-feed.js +4 -4
- package/dist/settings/definitions-dispatch.d.ts +8 -3
- package/dist/settings/definitions-dispatch.js +5 -5
- package/dist/settings/dictionaries/index.d.ts +5 -2
- package/dist/settings/dictionaries/index.js +2 -2
- package/dist/settings/dictionaries/settings-dialog.ar.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.bn.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.de.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.es.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.fa.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.fr.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.hi.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.hu.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.id.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.it.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ja.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ko.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.pl.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.pt-BR.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ru.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.th.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.tr.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.uk.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.ur.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.zh-CN.js +0 -1
- package/dist/settings/dictionaries/settings-dialog.zh-TW.js +0 -1
- package/dist/settings/ensure-definitions.d.ts +5 -5
- package/dist/settings/errors.d.ts +7 -1
- package/dist/settings/errors.js +7 -1
- package/dist/settings/index.d.ts +4 -1
- package/dist/settings/index.js +1 -0
- package/dist/settings/ports.d.ts +6 -5
- package/dist/settings/principal-lookup.d.ts +9 -0
- package/dist/settings/principal-lookup.js +2 -0
- package/dist/settings/purge-service.d.ts +5 -4
- package/dist/settings/purge-service.js +3 -2
- package/dist/settings/settings.d.ts +22 -7
- package/dist/settings/settings.js +47 -26
- package/dist/settings/tool-registrations.d.ts +25 -32
- package/dist/settings/tool-registrations.js +66 -56
- package/dist/settings/types.d.ts +1 -1
- package/dist/settings/ui-tab-definitions.d.ts +1 -1
- package/dist/settings/write-service.d.ts +32 -26
- package/dist/settings/write-service.js +26 -20
- package/dist/taxonomy/agent-tools.d.ts +1 -66
- package/dist/taxonomy/agent-tools.js +25 -15
- package/dist/taxonomy/content-lookup.js +1 -1
- package/dist/taxonomy/index.d.ts +2 -2
- package/dist/taxonomy/merge-term.d.ts +7 -4
- package/dist/taxonomy/merge-term.js +7 -5
- package/dist/taxonomy/repo.memory.d.ts +42 -19
- package/dist/taxonomy/repo.memory.js +14 -12
- package/dist/taxonomy/validation-chain.d.ts +39 -18
- package/dist/taxonomy/validation-chain.js +35 -25
- package/dist/taxonomy/write-service.d.ts +106 -45
- package/dist/taxonomy/write-service.js +221 -179
- package/dist/trash/adapters/record-store.d.ts +52 -0
- package/dist/trash/adapters/record-store.js +36 -0
- package/dist/trash/cursor.d.ts +20 -0
- package/dist/trash/cursor.js +36 -0
- package/dist/trash/follow-ups.d.ts +76 -0
- package/dist/trash/follow-ups.js +46 -0
- package/dist/trash/index.d.ts +8 -0
- package/dist/trash/index.js +8 -0
- package/dist/trash/ports.d.ts +308 -0
- package/dist/trash/ports.js +2 -0
- package/dist/trash/repo.memory.d.ts +50 -0
- package/dist/trash/repo.memory.js +114 -0
- package/dist/trash/sweeper.d.ts +77 -0
- package/dist/trash/sweeper.js +127 -0
- package/dist/trash/write-service.d.ts +100 -0
- package/dist/trash/write-service.js +242 -0
- package/dist/workspace/agent-tools.d.ts +1 -59
- package/dist/workspace/agent-tools.js +27 -12
- package/dist/workspace/create.d.ts +31 -6
- package/dist/workspace/create.js +18 -5
- package/dist/workspace/delete.d.ts +18 -13
- package/dist/workspace/delete.js +20 -12
- package/dist/workspace/index.d.ts +1 -1
- package/dist/workspace/repo.memory.d.ts +19 -4
- package/dist/workspace/repo.memory.js +26 -4
- package/dist/workspace/tool-registrations.d.ts +2 -2
- package/dist/workspace/tool-registrations.js +13 -13
- package/dist/workspace/update.d.ts +6 -5
- package/dist/workspace/update.js +9 -8
- package/package.json +44 -38
- package/dist/identity/admin-crud-service.d.ts +0 -280
- package/dist/identity/admin-crud-service.js +0 -468
- package/dist/identity/agent-tool-input.d.ts +0 -58
- package/dist/identity/agent-tool-input.js +0 -126
- package/dist/identity/agent-tools.d.ts +0 -101
- package/dist/identity/agent-tools.js +0 -290
- package/dist/identity/auth-service.d.ts +0 -118
- package/dist/identity/auth-service.js +0 -170
- package/dist/identity/authorize.d.ts +0 -90
- package/dist/identity/authorize.js +0 -94
- package/dist/identity/grant-service.d.ts +0 -198
- package/dist/identity/grant-service.js +0 -361
- package/dist/identity/hasher.d.ts +0 -39
- package/dist/identity/hasher.js +0 -39
- package/dist/identity/index.d.ts +0 -62
- package/dist/identity/index.js +0 -54
- package/dist/identity/password-policy.d.ts +0 -57
- package/dist/identity/password-policy.js +0 -66
- package/dist/identity/permission-migrations.d.ts +0 -86
- package/dist/identity/permission-migrations.js +0 -67
- package/dist/identity/permissions.d.ts +0 -35
- package/dist/identity/permissions.js +0 -603
- package/dist/identity/ports.d.ts +0 -201
- package/dist/identity/repo.memory.d.ts +0 -164
- package/dist/identity/repo.memory.js +0 -224
- package/dist/identity/seed.d.ts +0 -54
- package/dist/identity/seed.js +0 -429
- package/dist/identity/tool-registrations.d.ts +0 -50
- package/dist/identity/tool-registrations.js +0 -419
- package/dist/identity/types.d.ts +0 -185
- package/dist/identity/types.js +0 -64
- package/dist/identity/username.d.ts +0 -12
- package/dist/identity/username.js +0 -14
- /package/dist/{identity → media/import}/ports.js +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Password policy: no minimum length, no composition rules — presence and an upper bound only.
|
|
3
|
-
*
|
|
4
|
-
* Owner decision: the previous NIST SP 800-63B-aligned 12-character minimum has been removed.
|
|
5
|
-
* This module no longer enforces composition rules (mandatory uppercase, digit, or symbol) either
|
|
6
|
-
* — that predates this change and remains deliberate, since composition rules measurably push
|
|
7
|
-
* people toward predictable, guessable patterns ("Password1!") rather than genuinely stronger
|
|
8
|
-
* secrets. What remains is the minimum a credential system can enforce at all: a password must be
|
|
9
|
-
* non-empty, and is capped at `MAX_PASSWORD_LENGTH` as a defense-in-depth bound (see that
|
|
10
|
-
* constant's own doc).
|
|
11
|
-
*
|
|
12
|
-
* `createUser` (`grant-service.ts`) and `resetUserPassword` (`admin-crud-service.ts`) are the
|
|
13
|
-
* identity system's only two write paths that ever set a password, confirmed by tracing the
|
|
14
|
-
* whole call graph — both call this module.
|
|
15
|
-
*
|
|
16
|
-
* Two things this deliberately does NOT do, both load-bearing:
|
|
17
|
-
* - Never reaches `seed.ts`'s first-boot owner password. `seedIdentity` hashes it directly
|
|
18
|
-
* (`deps.hasher.hash(ownerPassword)`, `seed.ts:317`) and calls neither `createUser` nor
|
|
19
|
-
* `resetUserPassword` — confirmed before writing this module. That separation is intentional
|
|
20
|
-
* to preserve here: the host chooses the first-boot owner password (`SeedIdentityInput` requires
|
|
21
|
-
* it and supplies no default), and an existing installation is already authenticating with
|
|
22
|
-
* whatever it chose. Enforcing this policy on that path would lock out every such installation
|
|
23
|
-
* whose chosen value predates the policy.
|
|
24
|
-
* - Never re-validates at login. This is a write-time policy — `login`/`verify` never call it.
|
|
25
|
-
* An account whose password predates this policy (or was seeded) must keep authenticating.
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* Generous upper bound — not itself a security requirement (argon2id's cost is tuned by its
|
|
29
|
-
* `memoryCost`/`timeCost`/`parallelism` parameters, not by input size — see `hasher.ts`'s own
|
|
30
|
-
* `@complexity` note), but a defense-in-depth cap on how large a string this service will accept
|
|
31
|
-
* and pass to the hasher at all, independent of whatever limit (if any) sits in front of it at
|
|
32
|
-
* the HTTP layer. Comfortably above any realistic human-typed passphrase.
|
|
33
|
-
*/
|
|
34
|
-
export const MAX_PASSWORD_LENGTH = 512;
|
|
35
|
-
/**
|
|
36
|
-
* Validates `password` against the presence-and-upper-bound-only policy.
|
|
37
|
-
*
|
|
38
|
-
* Measures length in Unicode CODE POINTS (`[...password].length`), not UTF-16 code units
|
|
39
|
-
* (`password.length`): a passphrase built from astral-plane characters (many emoji, some
|
|
40
|
-
* CJK/historic scripts) is represented as a surrogate pair per character in a JS string, so plain
|
|
41
|
-
* `.length` overcounts those characters relative to what a human typing them perceives — the same
|
|
42
|
-
* reasoning that applies to `MAX_PASSWORD_LENGTH` below applies to the emptiness check here, since
|
|
43
|
-
* both compare this same code-point count. No trimming, no character allowlist: every printable
|
|
44
|
-
* character, including leading/trailing spaces and full Unicode, is accepted as typed. Silently
|
|
45
|
-
* altering the input (trimming, stripping) would make the stored credential differ from the
|
|
46
|
-
* secret the operator actually chose.
|
|
47
|
-
*
|
|
48
|
-
* @returns `null` if `password` satisfies the policy, otherwise an operator-facing message
|
|
49
|
-
* stating the requirement plainly — used verbatim as the thrown `IdentityValidationError`'s
|
|
50
|
-
* message by both call sites, and rendered as-is through the admin's `describeApiError` layer.
|
|
51
|
-
*
|
|
52
|
-
* @complexity O(n) in the password's length — spreading a string into code points is a single
|
|
53
|
-
* linear pass, which is the minimum work a correct (non-UTF-16-code-unit) count requires.
|
|
54
|
-
* @overallScore 100
|
|
55
|
-
*/
|
|
56
|
-
export function validatePasswordPolicy(password) {
|
|
57
|
-
const length = [...password].length;
|
|
58
|
-
if (length === 0) {
|
|
59
|
-
return "Password is required.";
|
|
60
|
-
}
|
|
61
|
-
if (length > MAX_PASSWORD_LENGTH) {
|
|
62
|
-
return `Password must be no more than ${MAX_PASSWORD_LENGTH} characters.`;
|
|
63
|
-
}
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=password-policy.js.map
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { IdGeneratorPort, UUID } from "../core/ports.js";
|
|
2
|
-
import type { PolicyPermissionRepoPort, PolicyRepoPort } from "./ports.js";
|
|
3
|
-
/**
|
|
4
|
-
* @file Shared deprecate-old/grant-new permission migration mechanism
|
|
5
|
-
* (generalized from the `settings.write` ->
|
|
6
|
-
* `settings.definitions.manage` precedent already shipped ad hoc in
|
|
7
|
-
* `identity/seed.ts`/`identity/permissions.ts`; see
|
|
8
|
-
* `docs/decisions/permission-catalog-migration.md`).
|
|
9
|
-
*
|
|
10
|
-
* Purpose:
|
|
11
|
-
* A permission-string rename/split after real grants exist is a breaking
|
|
12
|
-
* migration. This module is
|
|
13
|
-
* the one place that fan-out runs, so Menus/Members/Analytics/Integrations
|
|
14
|
-
* remediation efforts each register their own `{from, to}` pair here instead of
|
|
15
|
-
* hand-rolling a fourth divergent copy of the same fix.
|
|
16
|
-
*
|
|
17
|
-
* How it relates to the project:
|
|
18
|
-
* - `registerPermissionMigration`/`listPermissionMigrations` are a small,
|
|
19
|
-
* in-process registry — pure metadata, no I/O, mirrors
|
|
20
|
-
* `permissions.ts`'s `PermissionCatalog.register` overwrite semantics.
|
|
21
|
-
* - `migrateDeprecatedPermissionGrants` is the actual grant fan-out: for
|
|
22
|
-
* every registered pair, every policy holding `from` gets every string in
|
|
23
|
-
* `to` it doesn't already hold. It is deliberately, structurally
|
|
24
|
-
* additive-only (INV-NEW-01) — there is no delete/update call against
|
|
25
|
-
* `policy_permissions` anywhere in this file.
|
|
26
|
-
* - Feature-agnostic by design: this module has zero knowledge of
|
|
27
|
-
* `navigation`/`settings`/any specific feature. Callers (e.g.
|
|
28
|
-
* `identity/permissions.ts`) register their own pairs.
|
|
29
|
-
*
|
|
30
|
-
* Architectural role:
|
|
31
|
-
* Security-adjacent domain logic (a bug here could fail-open (grant more than
|
|
32
|
-
* intended) or fail-closed (a policy silently missing a needed grant) across every
|
|
33
|
-
* feature that reuses it). The additive-only design bounds the fail-closed
|
|
34
|
-
* direction to "a required new permission is missing," never "an existing
|
|
35
|
-
* permission is removed." See `__tests__/permission-migrations.test.ts` for
|
|
36
|
-
* the dedicated fixture-driven certification required before any
|
|
37
|
-
* caller wires this into a live boot path.
|
|
38
|
-
*/
|
|
39
|
-
/** One registered deprecate-old/grant-new rename or split pair. */
|
|
40
|
-
export interface PermissionMigration {
|
|
41
|
-
/** The deprecated permission string. Never deleted from the catalog by this mechanism. */
|
|
42
|
-
readonly from: string;
|
|
43
|
-
/** The replacement permission string(s) every `from`-holding policy should also gain. */
|
|
44
|
-
readonly to: readonly string[];
|
|
45
|
-
/** Human-readable rationale, surfaced in docs/reviews — not interpreted by this module. */
|
|
46
|
-
readonly reason: string;
|
|
47
|
-
}
|
|
48
|
-
export interface MigrateDeprecatedPermissionGrantsDeps {
|
|
49
|
-
policyPermissions: PolicyPermissionRepoPort;
|
|
50
|
-
policies: PolicyRepoPort;
|
|
51
|
-
idGen: IdGeneratorPort;
|
|
52
|
-
workspaceId: UUID;
|
|
53
|
-
}
|
|
54
|
-
export interface MigrateDeprecatedPermissionGrantsResult {
|
|
55
|
-
/** Total new `policy_permissions` rows written across every policy and every registered pair. */
|
|
56
|
-
migratedGrantCount: number;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Register a `{from, to, reason}` rename/split pair for later fan-out.
|
|
60
|
-
* Idempotent: re-registering the same `from` overwrites the prior entry
|
|
61
|
-
* rather than duplicating it (matches `PermissionCatalog.register`'s
|
|
62
|
-
* existing overwrite semantics, `identity/permissions.ts`).
|
|
63
|
-
*
|
|
64
|
-
* @complexity O(1).
|
|
65
|
-
* @overallScore 100
|
|
66
|
-
*/
|
|
67
|
-
export declare function registerPermissionMigration(migration: PermissionMigration): void;
|
|
68
|
-
/** Enumerate every registered migration pair. */
|
|
69
|
-
export declare function listPermissionMigrations(): PermissionMigration[];
|
|
70
|
-
/**
|
|
71
|
-
* For every registered `{from, to}` pair, for every policy in the workspace
|
|
72
|
-
* holding `from`, ensure every string in `to` is also granted — adding only
|
|
73
|
-
* the rows that are missing. Never removes or mutates `from` (or any other
|
|
74
|
-
* existing row) — additive-only by construction (INV-NEW-01), so a failed or
|
|
75
|
-
* partial run leaves the system in its previous, still-functioning state.
|
|
76
|
-
*
|
|
77
|
-
* Safe to call on every boot (idempotent): a rerun with nothing new to add
|
|
78
|
-
* returns `migratedGrantCount: 0` (mirrors `migrateLegacyPresentationSettings`'s
|
|
79
|
-
* boot-safety precedent).
|
|
80
|
-
*
|
|
81
|
-
* @complexity O(p * m) where p = policies in the workspace, m = registered
|
|
82
|
-
* migration pairs; both are small, bounded collections in this app's shape.
|
|
83
|
-
* @overallScore 100
|
|
84
|
-
*/
|
|
85
|
-
export declare function migrateDeprecatedPermissionGrants(deps: MigrateDeprecatedPermissionGrantsDeps): Promise<MigrateDeprecatedPermissionGrantsResult>;
|
|
86
|
-
//# sourceMappingURL=permission-migrations.d.ts.map
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/** Module-singleton registry — keyed by `from` so re-registration overwrites (idempotent, matches `PermissionCatalog.register`). */
|
|
2
|
-
const registry = new Map();
|
|
3
|
-
/**
|
|
4
|
-
* Register a `{from, to, reason}` rename/split pair for later fan-out.
|
|
5
|
-
* Idempotent: re-registering the same `from` overwrites the prior entry
|
|
6
|
-
* rather than duplicating it (matches `PermissionCatalog.register`'s
|
|
7
|
-
* existing overwrite semantics, `identity/permissions.ts`).
|
|
8
|
-
*
|
|
9
|
-
* @complexity O(1).
|
|
10
|
-
* @overallScore 100
|
|
11
|
-
*/
|
|
12
|
-
export function registerPermissionMigration(migration) {
|
|
13
|
-
registry.set(migration.from, migration);
|
|
14
|
-
}
|
|
15
|
-
/** Enumerate every registered migration pair. */
|
|
16
|
-
export function listPermissionMigrations() {
|
|
17
|
-
return [...registry.values()];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* For every registered `{from, to}` pair, for every policy in the workspace
|
|
21
|
-
* holding `from`, ensure every string in `to` is also granted — adding only
|
|
22
|
-
* the rows that are missing. Never removes or mutates `from` (or any other
|
|
23
|
-
* existing row) — additive-only by construction (INV-NEW-01), so a failed or
|
|
24
|
-
* partial run leaves the system in its previous, still-functioning state.
|
|
25
|
-
*
|
|
26
|
-
* Safe to call on every boot (idempotent): a rerun with nothing new to add
|
|
27
|
-
* returns `migratedGrantCount: 0` (mirrors `migrateLegacyPresentationSettings`'s
|
|
28
|
-
* boot-safety precedent).
|
|
29
|
-
*
|
|
30
|
-
* @complexity O(p * m) where p = policies in the workspace, m = registered
|
|
31
|
-
* migration pairs; both are small, bounded collections in this app's shape.
|
|
32
|
-
* @overallScore 100
|
|
33
|
-
*/
|
|
34
|
-
export async function migrateDeprecatedPermissionGrants(deps) {
|
|
35
|
-
const migrations = listPermissionMigrations();
|
|
36
|
-
if (migrations.length === 0)
|
|
37
|
-
return { migratedGrantCount: 0 };
|
|
38
|
-
const policies = await deps.policies.list({ workspaceId: deps.workspaceId });
|
|
39
|
-
let migratedGrantCount = 0;
|
|
40
|
-
for (const policy of policies) {
|
|
41
|
-
const existing = await deps.policyPermissions.listByPolicyId({
|
|
42
|
-
workspaceId: deps.workspaceId,
|
|
43
|
-
policyId: policy.id,
|
|
44
|
-
});
|
|
45
|
-
const held = new Set(existing.map((row) => row.permission));
|
|
46
|
-
for (const migration of migrations) {
|
|
47
|
-
if (!held.has(migration.from))
|
|
48
|
-
continue;
|
|
49
|
-
for (const toPermission of migration.to) {
|
|
50
|
-
if (held.has(toPermission))
|
|
51
|
-
continue;
|
|
52
|
-
await deps.policyPermissions.save({
|
|
53
|
-
id: deps.idGen.newId(),
|
|
54
|
-
workspaceId: deps.workspaceId,
|
|
55
|
-
policyId: policy.id,
|
|
56
|
-
permission: toPermission,
|
|
57
|
-
resourceType: null,
|
|
58
|
-
constraintJson: null,
|
|
59
|
-
});
|
|
60
|
-
held.add(toPermission);
|
|
61
|
-
migratedGrantCount += 1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return { migratedGrantCount };
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=permission-migrations.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** One entry in the registered permission catalog. */
|
|
2
|
-
export interface PermissionDescriptor {
|
|
3
|
-
/** Dotted permission string, e.g. `"content.write"`. */
|
|
4
|
-
id: string;
|
|
5
|
-
/** Registering module, e.g. `"core"` or a feature name. */
|
|
6
|
-
owner: string;
|
|
7
|
-
description: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Code-side registry backing REQ-03's catalog validation and REQ-12's
|
|
11
|
-
* enumeration. `"*"` (the owner wildcard, REQ-04) is deliberately not a
|
|
12
|
-
* catalog entry — it is a distinct, built-in-only grant shape checked by
|
|
13
|
-
* `authorize()`/seed, never a registrable permission string.
|
|
14
|
-
*
|
|
15
|
-
* @complexity O(1) amortized per lookup (Map-backed); O(n) to list all.
|
|
16
|
-
* @overallScore 100
|
|
17
|
-
*/
|
|
18
|
-
declare class PermissionCatalog {
|
|
19
|
-
private readonly byId;
|
|
20
|
-
constructor(initial: readonly PermissionDescriptor[]);
|
|
21
|
-
/** Idempotent: re-registering the same `id` (e.g. on a warm reload) is a no-op overwrite. */
|
|
22
|
-
register(descriptor: PermissionDescriptor): void;
|
|
23
|
-
has(id: string): boolean;
|
|
24
|
-
list(): PermissionDescriptor[];
|
|
25
|
-
}
|
|
26
|
-
/** Module-singleton catalog — core's base vocabulary, extended by feature registration. */
|
|
27
|
-
export declare const permissionCatalog: PermissionCatalog;
|
|
28
|
-
/** Register an additional permission at feature startup (REQ-03). */
|
|
29
|
-
export declare function registerPermission(descriptor: PermissionDescriptor): void;
|
|
30
|
-
/** Enumerate the full registered catalog (REQ-12 core capability; CLI wiring is N/A, see file header). */
|
|
31
|
-
export declare function listPermissions(): PermissionDescriptor[];
|
|
32
|
-
/** Whether `id` is a recognized catalog permission. `"*"` is intentionally excluded (see class doc). */
|
|
33
|
-
export declare function isKnownPermission(id: string): boolean;
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=permissions.d.ts.map
|