@jskit-ai/users-core 0.1.256 → 0.1.258

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/users-core",
3
- "version": "0.1.256",
3
+ "version": "0.1.258",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test --test-concurrency=1"
@@ -13,12 +13,12 @@
13
13
  "./shared/resources/userSettingsResource": "./src/shared/resources/userSettingsResource.js"
14
14
  },
15
15
  "dependencies": {
16
- "@jskit-ai/database-runtime": "0.1.243",
17
- "@jskit-ai/json-rest-api-core": "0.1.187",
18
- "@jskit-ai/resource-core": "0.1.185",
19
- "@jskit-ai/resource-crud-core": "0.1.185",
20
- "@jskit-ai/storage-runtime": "0.1.240",
21
- "@jskit-ai/uploads-runtime": "0.1.218",
16
+ "@jskit-ai/database-runtime": "0.1.245",
17
+ "@jskit-ai/json-rest-api-core": "0.1.189",
18
+ "@jskit-ai/resource-core": "0.1.187",
19
+ "@jskit-ai/resource-crud-core": "0.1.187",
20
+ "@jskit-ai/storage-runtime": "0.1.242",
21
+ "@jskit-ai/uploads-runtime": "0.1.220",
22
22
  "json-rest-schema": "^1.0.17"
23
23
  },
24
24
  "description": "Users/account runtime plus HTTP routes for account features.",
@@ -166,8 +166,8 @@
166
166
  }
167
167
  },
168
168
  "peerDependencies": {
169
- "@jskit-ai/auth-core": "0.1.241",
170
- "@jskit-ai/http-runtime": "0.1.241",
171
- "@jskit-ai/kernel": "0.1.243"
169
+ "@jskit-ai/auth-core": "0.1.243",
170
+ "@jskit-ai/http-runtime": "0.1.243",
171
+ "@jskit-ai/kernel": "0.1.245"
172
172
  }
173
173
  }
@@ -9,8 +9,8 @@
9
9
  "./shared": "./src/shared/index.js"
10
10
  },
11
11
  "dependencies": {
12
- "@jskit-ai/crud-core": "0.1.254",
13
- "@jskit-ai/resource-crud-core": "0.1.185"
12
+ "@jskit-ai/crud-core": "0.1.256",
13
+ "@jskit-ai/resource-crud-core": "0.1.187"
14
14
  },
15
15
  "jskit": {
16
16
  "kind": "runtime",
@@ -9,9 +9,9 @@
9
9
  "./shared": "./src/shared/index.js"
10
10
  },
11
11
  "dependencies": {
12
- "@jskit-ai/crud-core": "0.1.254",
13
- "@jskit-ai/resource-crud-core": "0.1.185",
14
- "@jskit-ai/workspaces-core": "0.1.221"
12
+ "@jskit-ai/crud-core": "0.1.256",
13
+ "@jskit-ai/resource-crud-core": "0.1.187",
14
+ "@jskit-ai/workspaces-core": "0.1.223"
15
15
  },
16
16
  "jskit": {
17
17
  "kind": "runtime",
@@ -1,4 +1,5 @@
1
1
  import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
2
+ import { isAuthOperationSupported } from "@jskit-ai/auth-core/shared/authCapabilities";
2
3
  import { normalizeIdentity } from "../support/identity.js";
3
4
 
4
5
  async function resolveUserProfile(userProfilesRepository, user) {
@@ -25,6 +26,14 @@ async function resolveSecurityStatus(authService, request) {
25
26
  if (!authService || typeof authService.getSecurityStatus !== "function") {
26
27
  return {};
27
28
  }
29
+ // A provider that keeps passwords elsewhere, such as an accounts hub, has no
30
+ // security status; its settings pages still load.
31
+ if (
32
+ typeof authService.getCapabilities === "function" &&
33
+ !isAuthOperationSupported(authService.getCapabilities(), "getSecurityStatus")
34
+ ) {
35
+ return {};
36
+ }
28
37
 
29
38
  return authService.getSecurityStatus(request);
30
39
  }
@@ -0,0 +1,23 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { resolveSecurityStatus } from "../src/server/common/services/accountContextService.js";
4
+
5
+ function authServiceWith(securityStatus) {
6
+ return {
7
+ getCapabilities: () => ({ features: { securityStatus } }),
8
+ async getSecurityStatus() {
9
+ if (!securityStatus) {
10
+ throw new Error("unsupported");
11
+ }
12
+ return { mfa: { status: "not_enabled" } };
13
+ }
14
+ };
15
+ }
16
+
17
+ test("security status comes from a provider that supports it", async () => {
18
+ assert.deepEqual(await resolveSecurityStatus(authServiceWith(true), {}), { mfa: { status: "not_enabled" } });
19
+ });
20
+
21
+ test("a provider without security status, such as an accounts hub, leaves it empty", async () => {
22
+ assert.deepEqual(await resolveSecurityStatus(authServiceWith(false), {}), {});
23
+ });