@jini-ai/user-management 0.6.15-rc.2 → 0.6.16
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/README.md +2 -0
- package/dist/admin/adapters/http.js +15 -5
- package/dist/admin/adapters/memory.js +103 -38
- package/dist/admin/conformance/index.js +48 -30
- package/dist/admin/controllers/controller-store.js +18 -6
- package/dist/admin/controllers/members.controller.js +48 -21
- package/dist/admin/controllers/roles.controller.js +98 -49
- package/dist/admin/controllers/users.controller.js +22 -11
- package/dist/admin/error-copy.js +3 -1
- package/dist/admin/ports.d.ts +11 -10
- package/dist/admin/react/components/PermissionPanel.js +3 -2
- package/dist/admin/react/components/PolicyRow.js +3 -2
- package/dist/admin/react/components/RoleRow.js +3 -2
- package/dist/admin/react/components/UsersConfirmation.js +1 -2
- package/dist/admin/react/hooks/AuthScope.hooks.js +2 -1
- package/dist/admin/react/hooks/MembersPage.hooks.js +23 -10
- package/dist/admin/react/hooks/MembersScope.hooks.js +2 -1
- package/dist/admin/react/hooks/UsersPage.hooks.js +13 -5
- package/dist/admin/react/hooks/UsersScope.hooks.js +2 -1
- package/dist/admin/react/index.d.ts +6 -6
- package/dist/admin/rules.js +15 -7
- package/dist/core/ports.d.ts +6 -0
- package/dist/react/errors.js +3 -1
- package/dist/react/users/Users.js +2 -1
- package/dist/react/users/rules.js +9 -5
- package/dist/server/admin-crud-service.js +17 -13
- package/dist/server/agent-tool-registrations.js +18 -15
- package/dist/server/agent-tools.js +38 -31
- package/dist/server/auth-challenge.js +4 -3
- package/dist/server/hasher.js +2 -1
- package/dist/server/repo.memory-transactions.js +13 -9
- package/dist/server/repo.memory.d.ts +3 -0
- package/dist/server/repo.memory.js +8 -0
- package/dist/server/seed.d.ts +17 -1
- package/dist/server/seed.js +25 -2
- package/package.json +41 -32
package/dist/server/seed.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Clock, IdGenerator, UUID } from "@jini-ai/core/primitives";
|
|
2
|
-
import type { IdentityRepos, PasswordHasherPort } from "../core/ports.js";
|
|
2
|
+
import type { IdentityRepos, PasswordHasherPort, PrincipalRepoPort } from "../core/ports.js";
|
|
3
|
+
import { type PrincipalRecord } from "../core/types.js";
|
|
3
4
|
export interface SeedIdentityDeps {
|
|
4
5
|
repos: IdentityRepos;
|
|
5
6
|
hasher: PasswordHasherPort;
|
|
@@ -56,4 +57,19 @@ export declare function seedIdentity(required: {
|
|
|
56
57
|
deps: SeedIdentityDeps;
|
|
57
58
|
input: SeedIdentityInput;
|
|
58
59
|
}, optional?: SeedIdentityOptions): Promise<SeedIdentityResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Ensure a credential-free user principal, using externalId as its stable principal ID.
|
|
62
|
+
* @param required Repository and caller identity; strings are trimmed and limited to 255 characters.
|
|
63
|
+
* @param optional Workspace scope (defaults to "local" for single-owner hosts) and clock.
|
|
64
|
+
* @returns The inserted or existing row, preserving existing names and disabled status.
|
|
65
|
+
* @throws IdentityValidationError for invalid input or an adapter without atomic insertion.
|
|
66
|
+
*/
|
|
67
|
+
export declare function ensurePrincipal(required: {
|
|
68
|
+
principalRepo: PrincipalRepoPort;
|
|
69
|
+
externalId: string;
|
|
70
|
+
displayName: string;
|
|
71
|
+
}, optional?: {
|
|
72
|
+
workspaceId?: UUID;
|
|
73
|
+
clock?: Clock;
|
|
74
|
+
}): Promise<PrincipalRecord>;
|
|
59
75
|
//# sourceMappingURL=seed.d.ts.map
|
package/dist/server/seed.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nowIso as kernelNowIso } from "@jini-ai/core/primitives";
|
|
1
|
+
import { createSystemClock, nowIso as kernelNowIso } from "@jini-ai/core/primitives";
|
|
2
2
|
import { normalizeUsername } from "./username.js";
|
|
3
|
-
import { IdentityNotFoundError } from "../core/types.js";
|
|
3
|
+
import { IdentityNotFoundError, IdentityValidationError } from "../core/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* @file First-boot identity seed (state.spec `SEED_FIRST_BOOT`).
|
|
6
6
|
*
|
|
@@ -462,4 +462,27 @@ export async function seedIdentity(required, optional = {}) {
|
|
|
462
462
|
});
|
|
463
463
|
return { ownerPrincipalId, systemPrincipalId };
|
|
464
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Ensure a credential-free user principal, using externalId as its stable principal ID.
|
|
467
|
+
* @param required Repository and caller identity; strings are trimmed and limited to 255 characters.
|
|
468
|
+
* @param optional Workspace scope (defaults to "local" for single-owner hosts) and clock.
|
|
469
|
+
* @returns The inserted or existing row, preserving existing names and disabled status.
|
|
470
|
+
* @throws IdentityValidationError for invalid input or an adapter without atomic insertion.
|
|
471
|
+
*/
|
|
472
|
+
export async function ensurePrincipal(required, optional = {}) {
|
|
473
|
+
const { principalRepo, externalId, displayName } = required;
|
|
474
|
+
const { workspaceId = "local", clock = createSystemClock() } = optional;
|
|
475
|
+
for (const [name, value] of Object.entries({ externalId, displayName, workspaceId })) {
|
|
476
|
+
if (typeof value !== "string" || !value.trim() || value.trim().length > 255) {
|
|
477
|
+
throw new IdentityValidationError({ message: `${name} must contain 1–255 trimmed characters` });
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (!principalRepo.insertIfAbsent) {
|
|
481
|
+
throw new IdentityValidationError({ message: "ensurePrincipal requires atomic principalRepo.insertIfAbsent" });
|
|
482
|
+
}
|
|
483
|
+
return principalRepo.insertIfAbsent({ record: {
|
|
484
|
+
id: externalId.trim(), workspaceId: workspaceId.trim(), kind: "user",
|
|
485
|
+
displayName: displayName.trim(), status: "active", createdAt: kernelNowIso({ clock }),
|
|
486
|
+
} });
|
|
487
|
+
}
|
|
465
488
|
//# sourceMappingURL=seed.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/user-management",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.16",
|
|
4
4
|
"description": "Runtime-separated user management contracts and Node authentication, authorization, and administration services.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -22,6 +22,15 @@
|
|
|
22
22
|
"./admin/adapters/http": "universal",
|
|
23
23
|
"./admin/adapters/memory": "universal",
|
|
24
24
|
"./admin/conformance": "universal"
|
|
25
|
+
},
|
|
26
|
+
"optionalPeers": {
|
|
27
|
+
"argon2": "opt-in: argon2 password hashing; import @jini-ai/user-management/server — Argon2 password hashing could not load argon2. Install argon2 to enable this feature, or check its installed version and native binaries.",
|
|
28
|
+
"@jini-ai/ui": "opt-in: ui integrations; import @jini-ai/user-management/react — UI integrations could not load @jini-ai/ui. Install @jini-ai/ui to enable this feature, or check its installed version and native binaries.",
|
|
29
|
+
"@jini-ai/admin": "opt-in: admin modules; import @jini-ai/user-management/react — Admin modules could not load @jini-ai/admin. Install @jini-ai/admin to enable this feature, or check its installed version and native binaries.",
|
|
30
|
+
"@jini-ai/agentic": "opt-in: agent-aware ui and protocols; import @jini-ai/user-management/react — Agent-aware UI and protocols could not load @jini-ai/agentic. Install @jini-ai/agentic to enable this feature, or check its installed version and native binaries.",
|
|
31
|
+
"@jini-ai/ui-kit": "opt-in: ui kit integrations; import @jini-ai/user-management/react — UI kit integrations could not load @jini-ai/ui-kit. Install @jini-ai/ui-kit to enable this feature, or check its installed version and native binaries.",
|
|
32
|
+
"react": "opt-in: react user-management ui; import @jini-ai/user-management/react — React user-management UI could not load react. Install react to enable this feature, or check its installed version.",
|
|
33
|
+
"react-dom": "opt-in: react user-management ui; import @jini-ai/user-management/react — React user-management UI could not load react-dom. Install react-dom to enable this feature, or check its installed version."
|
|
25
34
|
}
|
|
26
35
|
},
|
|
27
36
|
"type": "module",
|
|
@@ -87,27 +96,41 @@
|
|
|
87
96
|
"registry": "https://registry.npmjs.org"
|
|
88
97
|
},
|
|
89
98
|
"dependencies": {
|
|
90
|
-
"@jini-ai/core": "^0.6.
|
|
99
|
+
"@jini-ai/core": "^0.6.16"
|
|
91
100
|
},
|
|
92
101
|
"peerDependencies": {
|
|
93
102
|
"argon2": "^0.44.0",
|
|
94
103
|
"react": "^18.3.0 || ^19.0.0",
|
|
95
104
|
"react-dom": "^18.3.0 || ^19.0.0",
|
|
96
|
-
"@jini-ai/ui": "^0.6.
|
|
97
|
-
"@jini-ai/admin": "^0.6.
|
|
98
|
-
"@jini-ai/agentic": "^0.6.
|
|
99
|
-
"@jini-ai/ui-kit": "^0.6.
|
|
105
|
+
"@jini-ai/ui": "^0.6.10",
|
|
106
|
+
"@jini-ai/admin": "^0.6.10",
|
|
107
|
+
"@jini-ai/agentic": "^0.6.10",
|
|
108
|
+
"@jini-ai/ui-kit": "^0.6.10"
|
|
109
|
+
},
|
|
110
|
+
"devDependencies": {
|
|
111
|
+
"vitest": "^2.1.0",
|
|
112
|
+
"typescript": "^5.6.0",
|
|
113
|
+
"@types/node": "^24.0.0",
|
|
114
|
+
"argon2": "^0.44.0",
|
|
115
|
+
"react": "^19.2.0",
|
|
116
|
+
"react-dom": "^19.2.0",
|
|
117
|
+
"@types/react": "^19.2.0",
|
|
118
|
+
"@types/react-dom": "^19.2.0",
|
|
119
|
+
"@testing-library/react": "^16.3.0",
|
|
120
|
+
"@testing-library/user-event": "^14.5.0",
|
|
121
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
122
|
+
"jsdom": "^25.0.1",
|
|
123
|
+
"@jini-ai/core": "^0.6.16",
|
|
124
|
+
"@jini-ai/ui-kit": "^0.6.16",
|
|
125
|
+
"@jini-ai/ui": "0.6.16",
|
|
126
|
+
"@jini-ai/agentic": "0.6.16",
|
|
127
|
+
"@jini-ai/admin": "0.6.16",
|
|
128
|
+
"@jini-ai/cms": "0.6.16"
|
|
100
129
|
},
|
|
101
130
|
"peerDependenciesMeta": {
|
|
102
131
|
"argon2": {
|
|
103
132
|
"optional": true
|
|
104
133
|
},
|
|
105
|
-
"react": {
|
|
106
|
-
"optional": true
|
|
107
|
-
},
|
|
108
|
-
"react-dom": {
|
|
109
|
-
"optional": true
|
|
110
|
-
},
|
|
111
134
|
"@jini-ai/ui": {
|
|
112
135
|
"optional": true
|
|
113
136
|
},
|
|
@@ -119,28 +142,14 @@
|
|
|
119
142
|
},
|
|
120
143
|
"@jini-ai/ui-kit": {
|
|
121
144
|
"optional": true
|
|
145
|
+
},
|
|
146
|
+
"react": {
|
|
147
|
+
"optional": true
|
|
148
|
+
},
|
|
149
|
+
"react-dom": {
|
|
150
|
+
"optional": true
|
|
122
151
|
}
|
|
123
152
|
},
|
|
124
|
-
"devDependencies": {
|
|
125
|
-
"vitest": "^2.1.0",
|
|
126
|
-
"typescript": "^5.6.0",
|
|
127
|
-
"@types/node": "^24.0.0",
|
|
128
|
-
"argon2": "^0.44.0",
|
|
129
|
-
"react": "^19.2.0",
|
|
130
|
-
"react-dom": "^19.2.0",
|
|
131
|
-
"@types/react": "^19.2.0",
|
|
132
|
-
"@types/react-dom": "^19.2.0",
|
|
133
|
-
"@testing-library/react": "^16.3.0",
|
|
134
|
-
"@testing-library/user-event": "^14.5.0",
|
|
135
|
-
"@testing-library/jest-dom": "^6.6.3",
|
|
136
|
-
"jsdom": "^25.0.1",
|
|
137
|
-
"@jini-ai/admin": "0.6.15-rc.2",
|
|
138
|
-
"@jini-ai/cms": "0.6.15-rc.2",
|
|
139
|
-
"@jini-ai/ui": "0.6.15-rc.2",
|
|
140
|
-
"@jini-ai/agentic": "0.6.15-rc.2",
|
|
141
|
-
"@jini-ai/core": "^0.6.15-rc.2",
|
|
142
|
-
"@jini-ai/ui-kit": "^0.6.15-rc.2"
|
|
143
|
-
},
|
|
144
153
|
"scripts": {
|
|
145
154
|
"build": "tsc -p tsconfig.json",
|
|
146
155
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|