@jini-ai/user-management 0.6.15-rc.2 → 0.6.15
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/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 +12 -12
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.15
|
|
3
|
+
"version": "0.6.15",
|
|
4
4
|
"description": "Runtime-separated user management contracts and Node authentication, authorization, and administration services.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -87,16 +87,16 @@
|
|
|
87
87
|
"registry": "https://registry.npmjs.org"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@jini-ai/core": "^0.6.15
|
|
90
|
+
"@jini-ai/core": "^0.6.15"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"argon2": "^0.44.0",
|
|
94
94
|
"react": "^18.3.0 || ^19.0.0",
|
|
95
95
|
"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.
|
|
96
|
+
"@jini-ai/ui": "^0.6.10",
|
|
97
|
+
"@jini-ai/admin": "^0.6.10",
|
|
98
|
+
"@jini-ai/agentic": "^0.6.10",
|
|
99
|
+
"@jini-ai/ui-kit": "^0.6.10"
|
|
100
100
|
},
|
|
101
101
|
"peerDependenciesMeta": {
|
|
102
102
|
"argon2": {
|
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
"@testing-library/user-event": "^14.5.0",
|
|
135
135
|
"@testing-library/jest-dom": "^6.6.3",
|
|
136
136
|
"jsdom": "^25.0.1",
|
|
137
|
-
"@jini-ai/
|
|
138
|
-
"@jini-ai/
|
|
139
|
-
"@jini-ai/
|
|
140
|
-
"@jini-ai/
|
|
141
|
-
"@jini-ai/core": "^0.6.15
|
|
142
|
-
"@jini-ai/
|
|
137
|
+
"@jini-ai/agentic": "0.6.15",
|
|
138
|
+
"@jini-ai/ui": "0.6.15",
|
|
139
|
+
"@jini-ai/cms": "0.6.15",
|
|
140
|
+
"@jini-ai/ui-kit": "^0.6.15",
|
|
141
|
+
"@jini-ai/core": "^0.6.15",
|
|
142
|
+
"@jini-ai/admin": "0.6.15"
|
|
143
143
|
},
|
|
144
144
|
"scripts": {
|
|
145
145
|
"build": "tsc -p tsconfig.json",
|