@jskit-ai/users-core 0.1.258 → 0.1.259
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 +10 -10
- package/patterns/user-administration-server/example/packages/users/package.json +2 -2
- package/patterns/user-administration-server/example/packages/users-workspace/package.json +3 -3
- package/src/server/accountNotifications/accountNotificationsActions.js +1 -5
- package/src/server/accountPreferences/accountPreferencesActions.js +1 -5
- package/src/server/accountProfile/accountProfileActions.js +1 -17
- package/src/server/accountSecurity/accountSecurityActions.js +1 -21
- package/src/server/common/formatters/accountAvatarFormatter.js +1 -1
- package/src/server/common/formatters/accountSecurityStatusFormatter.js +1 -1
- package/src/server/common/formatters/accountSettingsResponseFormatter.js +1 -1
- package/src/server/common/services/authProfileSyncService.js +1 -1
- package/src/server/usersBootstrapContributor.js +2 -2
- package/test/resourcesCanonical.test.js +2 -2
- package/test/usersRouteResources.test.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/users-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.259",
|
|
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.
|
|
17
|
-
"@jskit-ai/json-rest-api-core": "0.1.
|
|
18
|
-
"@jskit-ai/resource-core": "0.1.
|
|
19
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
20
|
-
"@jskit-ai/storage-runtime": "0.1.
|
|
21
|
-
"@jskit-ai/uploads-runtime": "0.1.
|
|
16
|
+
"@jskit-ai/database-runtime": "0.1.246",
|
|
17
|
+
"@jskit-ai/json-rest-api-core": "0.1.190",
|
|
18
|
+
"@jskit-ai/resource-core": "0.1.188",
|
|
19
|
+
"@jskit-ai/resource-crud-core": "0.1.188",
|
|
20
|
+
"@jskit-ai/storage-runtime": "0.1.243",
|
|
21
|
+
"@jskit-ai/uploads-runtime": "0.1.221",
|
|
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.
|
|
170
|
-
"@jskit-ai/http-runtime": "0.1.
|
|
171
|
-
"@jskit-ai/kernel": "0.1.
|
|
169
|
+
"@jskit-ai/auth-core": "0.1.244",
|
|
170
|
+
"@jskit-ai/http-runtime": "0.1.244",
|
|
171
|
+
"@jskit-ai/kernel": "0.1.246"
|
|
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.
|
|
13
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
12
|
+
"@jskit-ai/crud-core": "0.1.257",
|
|
13
|
+
"@jskit-ai/resource-crud-core": "0.1.188"
|
|
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.
|
|
13
|
-
"@jskit-ai/resource-crud-core": "0.1.
|
|
14
|
-
"@jskit-ai/workspaces-core": "0.1.
|
|
12
|
+
"@jskit-ai/crud-core": "0.1.257",
|
|
13
|
+
"@jskit-ai/resource-crud-core": "0.1.188",
|
|
14
|
+
"@jskit-ai/workspaces-core": "0.1.224"
|
|
15
15
|
},
|
|
16
16
|
"jskit": {
|
|
17
17
|
"kind": "runtime",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRequest
|
|
3
|
-
} from "@jskit-ai/kernel/
|
|
3
|
+
} from "@jskit-ai/kernel/server/actions/actionContributorHelpers";
|
|
4
4
|
import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
|
|
5
5
|
import { resolveActionUser } from "../common/support/resolveActionUser.js";
|
|
6
6
|
import { ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS } from "../common/support/realtimeServiceEvents.js";
|
|
@@ -25,10 +25,6 @@ const accountNotificationsActionSpecifications = Object.freeze([
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
idempotency: "optional",
|
|
28
|
-
audit: {
|
|
29
|
-
actionName: "settings.notifications.update"
|
|
30
|
-
},
|
|
31
|
-
observability: {},
|
|
32
28
|
events: ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS,
|
|
33
29
|
async run(accountNotificationsService, input, context) {
|
|
34
30
|
return accountNotificationsService.updateNotifications(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRequest
|
|
3
|
-
} from "@jskit-ai/kernel/
|
|
3
|
+
} from "@jskit-ai/kernel/server/actions/actionContributorHelpers";
|
|
4
4
|
import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
|
|
5
5
|
import { resolveActionUser } from "../common/support/resolveActionUser.js";
|
|
6
6
|
import { ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS } from "../common/support/realtimeServiceEvents.js";
|
|
@@ -25,10 +25,6 @@ const accountPreferencesActionSpecifications = Object.freeze([
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
idempotency: "optional",
|
|
28
|
-
audit: {
|
|
29
|
-
actionName: "settings.preferences.update"
|
|
30
|
-
},
|
|
31
|
-
observability: {},
|
|
32
28
|
events: ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS,
|
|
33
29
|
async run(accountPreferencesService, input, context) {
|
|
34
30
|
return accountPreferencesService.updatePreferences(
|
|
@@ -2,7 +2,7 @@ import { userSettingsResource } from "../../shared/resources/userSettingsResourc
|
|
|
2
2
|
import {
|
|
3
3
|
emptyInputValidator,
|
|
4
4
|
resolveRequest
|
|
5
|
-
} from "@jskit-ai/kernel/
|
|
5
|
+
} from "@jskit-ai/kernel/server/actions/actionContributorHelpers";
|
|
6
6
|
import { deepFreeze } from "@jskit-ai/kernel/shared/support/deepFreeze";
|
|
7
7
|
import { userProfileResource } from "../../shared/resources/userProfileResource.js";
|
|
8
8
|
import { resolveActionUser } from "../common/support/resolveActionUser.js";
|
|
@@ -33,10 +33,6 @@ const accountProfileActionSpecifications = deepFreeze([
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
idempotency: "none",
|
|
36
|
-
audit: {
|
|
37
|
-
actionName: "settings.read"
|
|
38
|
-
},
|
|
39
|
-
observability: {},
|
|
40
36
|
async run(accountProfileService, input, context) {
|
|
41
37
|
return accountProfileService.getForUser(resolveRequest(context), resolveActionUser(context, input), {
|
|
42
38
|
context
|
|
@@ -62,10 +58,6 @@ const accountProfileActionSpecifications = deepFreeze([
|
|
|
62
58
|
}
|
|
63
59
|
},
|
|
64
60
|
idempotency: "optional",
|
|
65
|
-
audit: {
|
|
66
|
-
actionName: "settings.profile.update"
|
|
67
|
-
},
|
|
68
|
-
observability: {},
|
|
69
61
|
events: ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS,
|
|
70
62
|
async run(accountProfileService, input, context) {
|
|
71
63
|
return accountProfileService.updateProfile(
|
|
@@ -95,10 +87,6 @@ const accountProfileActionSpecifications = deepFreeze([
|
|
|
95
87
|
}
|
|
96
88
|
},
|
|
97
89
|
idempotency: "none",
|
|
98
|
-
audit: {
|
|
99
|
-
actionName: "settings.profile.avatar.upload"
|
|
100
|
-
},
|
|
101
|
-
observability: {},
|
|
102
90
|
events: ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS,
|
|
103
91
|
async run(accountProfileService, input, context) {
|
|
104
92
|
const avatarUpload = {
|
|
@@ -137,10 +125,6 @@ const accountProfileActionSpecifications = deepFreeze([
|
|
|
137
125
|
}
|
|
138
126
|
},
|
|
139
127
|
idempotency: "none",
|
|
140
|
-
audit: {
|
|
141
|
-
actionName: "settings.profile.avatar.delete"
|
|
142
|
-
},
|
|
143
|
-
observability: {},
|
|
144
128
|
events: ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS,
|
|
145
129
|
async run(accountProfileService, input, context) {
|
|
146
130
|
return accountProfileService.deleteAvatar(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveRequest
|
|
3
|
-
} from "@jskit-ai/kernel/
|
|
3
|
+
} from "@jskit-ai/kernel/server/actions/actionContributorHelpers";
|
|
4
4
|
import { composeSchemaDefinitions } from "@jskit-ai/kernel/shared/validators";
|
|
5
5
|
import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
|
|
6
6
|
import { resolveActionUser } from "../common/support/resolveActionUser.js";
|
|
@@ -31,10 +31,6 @@ const accountSecurityActionSpecifications = Object.freeze([
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
idempotency: "none",
|
|
34
|
-
audit: {
|
|
35
|
-
actionName: "settings.security.password.change"
|
|
36
|
-
},
|
|
37
|
-
observability: {},
|
|
38
34
|
async run(accountSecurityService, input, context) {
|
|
39
35
|
return accountSecurityService.changePassword(
|
|
40
36
|
resolveRequest(context),
|
|
@@ -65,10 +61,6 @@ const accountSecurityActionSpecifications = Object.freeze([
|
|
|
65
61
|
}
|
|
66
62
|
},
|
|
67
63
|
idempotency: "none",
|
|
68
|
-
audit: {
|
|
69
|
-
actionName: "settings.security.password_method.toggle"
|
|
70
|
-
},
|
|
71
|
-
observability: {},
|
|
72
64
|
async run(accountSecurityService, input, context) {
|
|
73
65
|
return accountSecurityService.setPasswordMethodEnabled(
|
|
74
66
|
resolveRequest(context),
|
|
@@ -97,10 +89,6 @@ const accountSecurityActionSpecifications = Object.freeze([
|
|
|
97
89
|
}
|
|
98
90
|
},
|
|
99
91
|
idempotency: "none",
|
|
100
|
-
audit: {
|
|
101
|
-
actionName: "settings.security.oauth.link.start"
|
|
102
|
-
},
|
|
103
|
-
observability: {},
|
|
104
92
|
async run(accountSecurityService, input, context) {
|
|
105
93
|
return accountSecurityService.startOAuthProviderLink(
|
|
106
94
|
resolveRequest(context),
|
|
@@ -131,10 +119,6 @@ const accountSecurityActionSpecifications = Object.freeze([
|
|
|
131
119
|
}
|
|
132
120
|
},
|
|
133
121
|
idempotency: "none",
|
|
134
|
-
audit: {
|
|
135
|
-
actionName: "settings.security.oauth.unlink"
|
|
136
|
-
},
|
|
137
|
-
observability: {},
|
|
138
122
|
async run(accountSecurityService, input, context) {
|
|
139
123
|
return accountSecurityService.unlinkOAuthProvider(
|
|
140
124
|
resolveRequest(context),
|
|
@@ -165,10 +149,6 @@ const accountSecurityActionSpecifications = Object.freeze([
|
|
|
165
149
|
}
|
|
166
150
|
},
|
|
167
151
|
idempotency: "none",
|
|
168
|
-
audit: {
|
|
169
|
-
actionName: "settings.security.sessions.logout_others"
|
|
170
|
-
},
|
|
171
|
-
observability: {},
|
|
172
152
|
async run(accountSecurityService, input, context) {
|
|
173
153
|
return accountSecurityService.logoutOtherSessions(resolveRequest(context), resolveActionUser(context, input), {
|
|
174
154
|
context
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
import { normalizeLowerText } from "@jskit-ai/kernel/shared/
|
|
2
|
+
import { normalizeLowerText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
3
3
|
import { DEFAULT_USER_SETTINGS } from "../../../shared/settings.js";
|
|
4
4
|
|
|
5
5
|
const ACCOUNT_AVATAR_FILE_PATH = "/api/settings/profile/avatar";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/
|
|
1
|
+
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
2
2
|
import {
|
|
3
3
|
USER_SETTINGS_NOTIFICATION_KEYS,
|
|
4
4
|
USER_SETTINGS_PREFERENCE_KEYS
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { normalizeRecordId } from "@jskit-ai/kernel/shared/support/normalize";
|
|
2
|
-
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/
|
|
2
|
+
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
3
3
|
import { normalizeIdentity } from "../support/identity.js";
|
|
4
4
|
|
|
5
5
|
function buildNormalizedIdentityKey(identityLike) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppError } from "@jskit-ai/kernel/server/runtime";
|
|
2
|
-
import { requireServiceMethod } from "@jskit-ai/kernel/
|
|
3
|
-
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/
|
|
2
|
+
import { requireServiceMethod } from "@jskit-ai/kernel/server/actions/actionContributorHelpers";
|
|
3
|
+
import { normalizeLowerText, normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
4
4
|
import { normalizeObject } from "@jskit-ai/kernel/shared/support/normalize";
|
|
5
5
|
import { accountAvatarFormatter } from "./common/formatters/accountAvatarFormatter.js";
|
|
6
6
|
import { USER_SETTINGS_BOOTSTRAP_KEYS } from "../shared/resources/userSettingsResource.js";
|
|
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import {
|
|
6
|
+
import { resolveSchemaTransportSchemaDefinition } from "@jskit-ai/kernel/shared/validators";
|
|
7
7
|
import { userProfileResource } from "../src/shared/resources/userProfileResource.js";
|
|
8
8
|
import { userSettingsResource } from "../src/shared/resources/userSettingsResource.js";
|
|
9
9
|
|
|
@@ -61,7 +61,7 @@ test("users-core specialized resource operations expose messages and validators"
|
|
|
61
61
|
for (const { label, operation } of operationSpecs) {
|
|
62
62
|
assert.equal(typeof operation?.messages, "object", `${label}.messages must be an object.`);
|
|
63
63
|
assert.equal(
|
|
64
|
-
typeof
|
|
64
|
+
typeof resolveSchemaTransportSchemaDefinition(operation?.output, {
|
|
65
65
|
context: `${label}.output`,
|
|
66
66
|
defaultMode: "replace"
|
|
67
67
|
}),
|
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { deriveResourceRequiredMetadata } from "@jskit-ai/kernel/_testable";
|
|
7
|
-
import {
|
|
7
|
+
import { resolveSchemaTransportSchemaDefinition } from "@jskit-ai/kernel/shared/validators";
|
|
8
8
|
import { userProfileResource } from "../src/shared/resources/userProfileResource.js";
|
|
9
9
|
import { userSettingsResource } from "../src/shared/resources/userSettingsResource.js";
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ function assertResourceShape(resource, label) {
|
|
|
27
27
|
`${label}.operations.${operationName} must resolve messages from operation.messages or resource.messages.`
|
|
28
28
|
);
|
|
29
29
|
assert.equal(
|
|
30
|
-
typeof
|
|
30
|
+
typeof resolveSchemaTransportSchemaDefinition(operation.output, {
|
|
31
31
|
context: `${label}.operations.${operationName}.output`,
|
|
32
32
|
defaultMode: "replace"
|
|
33
33
|
}),
|
|
@@ -71,7 +71,7 @@ test("specialized settings and invite operations expose canonical validators", (
|
|
|
71
71
|
for (const { label, operation } of operationSpecs) {
|
|
72
72
|
assert.equal(typeof operation?.method, "string", `${label}.method must exist.`);
|
|
73
73
|
assert.equal(
|
|
74
|
-
typeof
|
|
74
|
+
typeof resolveSchemaTransportSchemaDefinition(operation?.output, {
|
|
75
75
|
context: `${label}.output`,
|
|
76
76
|
defaultMode: "replace"
|
|
77
77
|
}),
|