@jskit-ai/users-core 0.1.26 → 0.1.27

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.
Files changed (39) hide show
  1. package/package.descriptor.mjs +15 -22
  2. package/package.json +5 -6
  3. package/src/server/UsersCoreServiceProvider.js +2 -6
  4. package/src/server/accountNotifications/bootAccountNotificationsRoutes.js +1 -2
  5. package/src/server/accountNotifications/registerAccountNotifications.js +2 -4
  6. package/src/server/accountPreferences/bootAccountPreferencesRoutes.js +1 -2
  7. package/src/server/accountPreferences/registerAccountPreferences.js +2 -4
  8. package/src/server/accountProfile/bootAccountProfileRoutes.js +2 -4
  9. package/src/server/accountProfile/registerAccountProfile.js +8 -14
  10. package/src/server/accountProfile/registerAvatarMultipartSupport.js +5 -8
  11. package/src/server/accountSecurity/bootAccountSecurityRoutes.js +1 -2
  12. package/src/server/accountSecurity/registerAccountSecurity.js +2 -4
  13. package/src/server/common/README.md +0 -1
  14. package/src/server/common/registerCommonRepositories.js +6 -7
  15. package/src/server/common/support/realtimeServiceEvents.js +3 -7
  16. package/src/server/consoleSettings/bootConsoleSettingsRoutes.js +1 -2
  17. package/src/server/consoleSettings/registerConsoleSettings.js +1 -2
  18. package/src/server/registerWorkspaceBootstrap.js +4 -10
  19. package/src/server/registerWorkspaceCore.js +14 -25
  20. package/src/server/workspaceDirectory/bootWorkspaceDirectoryRoutes.js +3 -7
  21. package/src/server/workspaceMembers/bootWorkspaceMembers.js +3 -5
  22. package/src/server/workspaceMembers/registerWorkspaceMembers.js +7 -13
  23. package/src/server/workspacePendingInvitations/bootWorkspacePendingInvitations.js +1 -2
  24. package/src/server/workspacePendingInvitations/registerWorkspacePendingInvitations.js +7 -17
  25. package/src/server/workspaceSettings/bootWorkspaceSettings.js +1 -2
  26. package/src/server/workspaceSettings/registerWorkspaceSettings.js +3 -8
  27. package/src/shared/index.js +1 -24
  28. package/src/shared/resources/consoleSettingsFields.js +1 -2
  29. package/src/shared/resources/userSettingsFields.js +1 -2
  30. package/src/shared/resources/workspaceSettingsFields.js +1 -2
  31. package/src/shared/support/usersApiPaths.js +1 -1
  32. package/test/registerAvatarMultipartSupport.test.js +2 -3
  33. package/test/registerServiceRealtimeEvents.test.js +29 -38
  34. package/test/registerWorkspaceSettings.test.js +2 -6
  35. package/test/usersApiPaths.test.js +2 -2
  36. package/test/usersRouteRequestInputValidator.test.js +38 -39
  37. package/test/workspaceSettingsRepository.test.js +6 -4
  38. package/src/server/common/diTokens.js +0 -21
  39. package/src/shared/events/usersEvents.js +0 -19
@@ -1,7 +1,8 @@
1
1
  export default Object.freeze({
2
2
  packageVersion: 1,
3
3
  packageId: "@jskit-ai/users-core",
4
- version: "0.1.26",
4
+ version: "0.1.27",
5
+ kind: "runtime",
5
6
  description: "Users/workspace domain runtime plus HTTP routes for workspace, account, and console features.",
6
7
  dependsOn: [
7
8
  "@jskit-ai/auth-core",
@@ -53,15 +54,7 @@ export default Object.freeze({
53
54
  }
54
55
  ],
55
56
  containerTokens: {
56
- server: [
57
- "users.core",
58
- "users.profile.sync.service",
59
- "users.workspace.service",
60
- "users.workspace.members.service",
61
- "users.workspace.settings.service",
62
- "users.settings.service",
63
- "users.console.settings.service"
64
- ],
57
+ server: [],
65
58
  client: []
66
59
  }
67
60
  },
@@ -89,42 +82,42 @@ export default Object.freeze({
89
82
  },
90
83
  {
91
84
  method: "GET",
92
- path: "/api/w/:workspaceSlug/workspace/settings",
85
+ path: "/api/w/:workspaceSlug/settings",
93
86
  summary: "Get workspace settings and role catalog by workspace slug."
94
87
  },
95
88
  {
96
89
  method: "PATCH",
97
- path: "/api/w/:workspaceSlug/workspace/settings",
90
+ path: "/api/w/:workspaceSlug/settings",
98
91
  summary: "Update workspace settings by workspace slug."
99
92
  },
100
93
  {
101
94
  method: "GET",
102
- path: "/api/w/:workspaceSlug/workspace/roles",
95
+ path: "/api/w/:workspaceSlug/roles",
103
96
  summary: "Get workspace role catalog by workspace slug."
104
97
  },
105
98
  {
106
99
  method: "GET",
107
- path: "/api/w/:workspaceSlug/workspace/members",
100
+ path: "/api/w/:workspaceSlug/members",
108
101
  summary: "List members by workspace slug."
109
102
  },
110
103
  {
111
104
  method: "PATCH",
112
- path: "/api/w/:workspaceSlug/workspace/members/:memberUserId/role",
105
+ path: "/api/w/:workspaceSlug/members/:memberUserId/role",
113
106
  summary: "Update workspace member role by workspace slug."
114
107
  },
115
108
  {
116
109
  method: "GET",
117
- path: "/api/w/:workspaceSlug/workspace/invites",
110
+ path: "/api/w/:workspaceSlug/invites",
118
111
  summary: "List workspace invites by workspace slug."
119
112
  },
120
113
  {
121
114
  method: "POST",
122
- path: "/api/w/:workspaceSlug/workspace/invites",
115
+ path: "/api/w/:workspaceSlug/invites",
123
116
  summary: "Create workspace invite by workspace slug."
124
117
  },
125
118
  {
126
119
  method: "DELETE",
127
- path: "/api/w/:workspaceSlug/workspace/invites/:inviteId",
120
+ path: "/api/w/:workspaceSlug/invites/:inviteId",
128
121
  summary: "Revoke workspace invite by workspace slug."
129
122
  },
130
123
  {
@@ -203,10 +196,10 @@ export default Object.freeze({
203
196
  mutations: {
204
197
  dependencies: {
205
198
  runtime: {
206
- "@jskit-ai/auth-core": "0.1.16",
207
- "@jskit-ai/database-runtime": "0.1.17",
208
- "@jskit-ai/http-runtime": "0.1.16",
209
- "@jskit-ai/kernel": "0.1.17",
199
+ "@jskit-ai/auth-core": "0.1.17",
200
+ "@jskit-ai/database-runtime": "0.1.18",
201
+ "@jskit-ai/http-runtime": "0.1.17",
202
+ "@jskit-ai/kernel": "0.1.18",
210
203
  "@fastify/multipart": "^9.4.0",
211
204
  "@fastify/type-provider-typebox": "^6.1.0",
212
205
  "typebox": "^1.0.81"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jskit-ai/users-core",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "test": "node --test"
@@ -11,7 +11,6 @@
11
11
  "./server/support/resolveWorkspace": "./src/server/support/resolveWorkspace.js",
12
12
  "./server/validators/routeParamsValidator": "./src/server/common/validators/routeParamsValidator.js",
13
13
  "./shared/settings": "./src/shared/settings.js",
14
- "./shared/events/usersEvents": "./src/shared/events/usersEvents.js",
15
14
  "./shared/tenancyProfile": "./src/shared/tenancyProfile.js",
16
15
  "./shared/support/usersVisibility": "./src/shared/support/usersVisibility.js",
17
16
  "./shared/support/workspacePathModel": "./src/shared/support/workspacePathModel.js",
@@ -25,10 +24,10 @@
25
24
  "./shared/resources/consoleSettingsFields": "./src/shared/resources/consoleSettingsFields.js"
26
25
  },
27
26
  "dependencies": {
28
- "@jskit-ai/auth-core": "0.1.16",
29
- "@jskit-ai/database-runtime": "0.1.17",
30
- "@jskit-ai/http-runtime": "0.1.16",
31
- "@jskit-ai/kernel": "0.1.17",
27
+ "@jskit-ai/auth-core": "0.1.17",
28
+ "@jskit-ai/database-runtime": "0.1.18",
29
+ "@jskit-ai/http-runtime": "0.1.17",
30
+ "@jskit-ai/kernel": "0.1.18",
32
31
  "@fastify/multipart": "^9.4.0",
33
32
  "@fastify/type-provider-typebox": "^6.1.0",
34
33
  "typebox": "^1.0.81"
@@ -14,10 +14,6 @@ import { bootAccountPreferencesRoutes } from "./accountPreferences/bootAccountPr
14
14
  import { bootAccountNotificationsRoutes } from "./accountNotifications/bootAccountNotificationsRoutes.js";
15
15
  import { bootAccountSecurityRoutes } from "./accountSecurity/bootAccountSecurityRoutes.js";
16
16
  import { bootConsoleSettingsRoutes } from "./consoleSettings/bootConsoleSettingsRoutes.js";
17
- import {
18
- USERS_WORKSPACE_INVITATIONS_ENABLED_TOKEN,
19
- USERS_WORKSPACE_ENABLED_TOKEN
20
- } from "./common/diTokens.js";
21
17
  import { registerSharedApi } from "./common/registerSharedApi.js";
22
18
  import { registerCommonRepositories } from "./common/registerCommonRepositories.js";
23
19
  import { registerWorkspaceCore } from "./registerWorkspaceCore.js";
@@ -54,9 +50,9 @@ class UsersCoreServiceProvider {
54
50
  }
55
51
 
56
52
  async boot(app) {
57
- if (app.make(USERS_WORKSPACE_ENABLED_TOKEN) === true) {
53
+ if (app.make("users.workspace.enabled") === true) {
58
54
  bootWorkspaceDirectoryRoutes(app);
59
- if (app.make(USERS_WORKSPACE_INVITATIONS_ENABLED_TOKEN) === true) {
55
+ if (app.make("users.workspace.invitations.enabled") === true) {
60
56
  bootWorkspacePendingInvitations(app);
61
57
  }
62
58
  bootWorkspaceSettings(app);
@@ -1,5 +1,4 @@
1
1
  import { withStandardErrorResponses } from "@jskit-ai/http-runtime/shared/validators/errorResponses";
2
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
3
2
  import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
4
3
 
5
4
  function bootAccountNotificationsRoutes(app) {
@@ -7,7 +6,7 @@ function bootAccountNotificationsRoutes(app) {
7
6
  throw new Error("bootAccountNotificationsRoutes requires application make().");
8
7
  }
9
8
 
10
- const router = app.make(KERNEL_TOKENS.HttpRouter);
9
+ const router = app.make("jskit.http.router");
11
10
 
12
11
  router.register(
13
12
  "PATCH",
@@ -4,15 +4,13 @@ import { accountNotificationsActions } from "./accountNotificationsActions.js";
4
4
  import { deepFreeze } from "../common/support/deepFreeze.js";
5
5
  import { ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS } from "../common/support/realtimeServiceEvents.js";
6
6
 
7
- const USERS_ACCOUNT_NOTIFICATIONS_SERVICE_TOKEN = "users.accountNotifications.service";
8
-
9
7
  function registerAccountNotifications(app) {
10
8
  if (!app || typeof app.singleton !== "function" || typeof app.service !== "function" || typeof app.actions !== "function") {
11
9
  throw new Error("registerAccountNotifications requires application singleton()/service()/actions().");
12
10
  }
13
11
 
14
12
  app.service(
15
- USERS_ACCOUNT_NOTIFICATIONS_SERVICE_TOKEN,
13
+ "users.accountNotifications.service",
16
14
  (scope) =>
17
15
  createAccountNotificationsService({
18
16
  userSettingsRepository: scope.make("userSettingsRepository"),
@@ -30,7 +28,7 @@ function registerAccountNotifications(app) {
30
28
  withActionDefaults(accountNotificationsActions, {
31
29
  domain: "settings",
32
30
  dependencies: {
33
- accountNotificationsService: USERS_ACCOUNT_NOTIFICATIONS_SERVICE_TOKEN
31
+ accountNotificationsService: "users.accountNotifications.service"
34
32
  }
35
33
  })
36
34
  );
@@ -1,5 +1,4 @@
1
1
  import { withStandardErrorResponses } from "@jskit-ai/http-runtime/shared/validators/errorResponses";
2
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
3
2
  import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
4
3
 
5
4
  function bootAccountPreferencesRoutes(app) {
@@ -7,7 +6,7 @@ function bootAccountPreferencesRoutes(app) {
7
6
  throw new Error("bootAccountPreferencesRoutes requires application make().");
8
7
  }
9
8
 
10
- const router = app.make(KERNEL_TOKENS.HttpRouter);
9
+ const router = app.make("jskit.http.router");
11
10
 
12
11
  router.register(
13
12
  "PATCH",
@@ -4,15 +4,13 @@ import { accountPreferencesActions } from "./accountPreferencesActions.js";
4
4
  import { deepFreeze } from "../common/support/deepFreeze.js";
5
5
  import { ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS } from "../common/support/realtimeServiceEvents.js";
6
6
 
7
- const USERS_ACCOUNT_PREFERENCES_SERVICE_TOKEN = "users.accountPreferences.service";
8
-
9
7
  function registerAccountPreferences(app) {
10
8
  if (!app || typeof app.singleton !== "function" || typeof app.service !== "function" || typeof app.actions !== "function") {
11
9
  throw new Error("registerAccountPreferences requires application singleton()/service()/actions().");
12
10
  }
13
11
 
14
12
  app.service(
15
- USERS_ACCOUNT_PREFERENCES_SERVICE_TOKEN,
13
+ "users.accountPreferences.service",
16
14
  (scope) =>
17
15
  createAccountPreferencesService({
18
16
  userSettingsRepository: scope.make("userSettingsRepository"),
@@ -30,7 +28,7 @@ function registerAccountPreferences(app) {
30
28
  withActionDefaults(accountPreferencesActions, {
31
29
  domain: "settings",
32
30
  dependencies: {
33
- accountPreferencesService: USERS_ACCOUNT_PREFERENCES_SERVICE_TOKEN
31
+ accountPreferencesService: "users.accountPreferences.service"
34
32
  }
35
33
  })
36
34
  );
@@ -1,18 +1,16 @@
1
1
  import { AppError } from "@jskit-ai/kernel/server/runtime/errors";
2
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
3
2
  import { withStandardErrorResponses } from "@jskit-ai/http-runtime/shared/validators/errorResponses";
4
3
  import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
5
4
  import { userProfileResource } from "../../shared/resources/userProfileResource.js";
6
- import { USERS_ACCOUNT_PROFILE_SERVICE_TOKEN } from "./registerAccountProfile.js";
7
5
 
8
6
  function bootAccountProfileRoutes(app) {
9
7
  if (!app || typeof app.make !== "function") {
10
8
  throw new Error("bootAccountProfileRoutes requires application make().");
11
9
  }
12
10
 
13
- const router = app.make(KERNEL_TOKENS.HttpRouter);
11
+ const router = app.make("jskit.http.router");
14
12
  const authService = app.make("authService");
15
- const accountProfileService = app.make(USERS_ACCOUNT_PROFILE_SERVICE_TOKEN);
13
+ const accountProfileService = app.make("users.accountProfile.service");
16
14
 
17
15
  router.register(
18
16
  "GET",
@@ -1,44 +1,38 @@
1
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
2
1
  import { withActionDefaults } from "@jskit-ai/kernel/shared/actions";
3
2
  import { createService as createAccountProfileService } from "./accountProfileService.js";
4
3
  import { createService as createAvatarStorageService } from "./avatarStorageService.js";
5
4
  import { createService as createAvatarService } from "./avatarService.js";
6
5
  import { accountProfileActions } from "./accountProfileActions.js";
7
6
  import { deepFreeze } from "../common/support/deepFreeze.js";
8
- import {
9
- USERS_AVATAR_STORAGE_SERVICE_TOKEN,
10
- USERS_AVATAR_SERVICE_TOKEN
11
- } from "../common/diTokens.js";
12
7
  import { ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS } from "../common/support/realtimeServiceEvents.js";
13
8
 
14
- const USERS_ACCOUNT_PROFILE_SERVICE_TOKEN = "users.accountProfile.service";
15
9
 
16
10
  function registerAccountProfile(app) {
17
11
  if (!app || typeof app.singleton !== "function" || typeof app.service !== "function" || typeof app.actions !== "function") {
18
12
  throw new Error("registerAccountProfile requires application singleton()/service()/actions().");
19
13
  }
20
14
 
21
- app.singleton(USERS_AVATAR_STORAGE_SERVICE_TOKEN, (scope) =>
15
+ app.singleton("users.avatar.storage.service", (scope) =>
22
16
  createAvatarStorageService({
23
- storage: scope.make(KERNEL_TOKENS.Storage)
17
+ storage: scope.make("jskit.storage")
24
18
  })
25
19
  );
26
20
 
27
- app.singleton(USERS_AVATAR_SERVICE_TOKEN, (scope) =>
21
+ app.singleton("users.avatar.service", (scope) =>
28
22
  createAvatarService({
29
23
  userProfilesRepository: scope.make("userProfilesRepository"),
30
- avatarStorageService: scope.make(USERS_AVATAR_STORAGE_SERVICE_TOKEN)
24
+ avatarStorageService: scope.make("users.avatar.storage.service")
31
25
  })
32
26
  );
33
27
 
34
28
  app.service(
35
- USERS_ACCOUNT_PROFILE_SERVICE_TOKEN,
29
+ "users.accountProfile.service",
36
30
  (scope) =>
37
31
  createAccountProfileService({
38
32
  userSettingsRepository: scope.make("userSettingsRepository"),
39
33
  userProfilesRepository: scope.make("userProfilesRepository"),
40
34
  authService: scope.make("authService"),
41
- avatarService: scope.make(USERS_AVATAR_SERVICE_TOKEN)
35
+ avatarService: scope.make("users.avatar.service")
42
36
  }),
43
37
  {
44
38
  events: deepFreeze({
@@ -53,10 +47,10 @@ function registerAccountProfile(app) {
53
47
  withActionDefaults(accountProfileActions, {
54
48
  domain: "settings",
55
49
  dependencies: {
56
- accountProfileService: USERS_ACCOUNT_PROFILE_SERVICE_TOKEN
50
+ accountProfileService: "users.accountProfile.service"
57
51
  }
58
52
  })
59
53
  );
60
54
  }
61
55
 
62
- export { USERS_ACCOUNT_PROFILE_SERVICE_TOKEN, registerAccountProfile };
56
+ export { registerAccountProfile };
@@ -1,28 +1,25 @@
1
1
  import fastifyMultipart from "@fastify/multipart";
2
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
3
-
4
- const AVATAR_MULTIPART_SUPPORT_FLAG = Symbol.for("jskit.users-core.avatar.multipart.support");
5
2
 
6
3
  async function registerAvatarMultipartSupport(app) {
7
4
  if (!app || typeof app.has !== "function" || typeof app.make !== "function") {
8
5
  throw new Error("registerAvatarMultipartSupport requires application has()/make().");
9
6
  }
10
7
 
11
- if (!app.has(KERNEL_TOKENS.Fastify)) {
8
+ if (!app.has("jskit.fastify")) {
12
9
  return;
13
10
  }
14
11
 
15
- const fastify = app.make(KERNEL_TOKENS.Fastify);
12
+ const fastify = app.make("jskit.fastify");
16
13
  if (!fastify || typeof fastify.register !== "function") {
17
14
  throw new Error("registerAvatarMultipartSupport requires Fastify register().");
18
15
  }
19
16
 
20
- if (fastify[AVATAR_MULTIPART_SUPPORT_FLAG] === true) {
17
+ if (fastify["jskit.users-core.avatar.multipart.support"] === true) {
21
18
  return;
22
19
  }
23
20
 
24
21
  if (typeof fastify.hasContentTypeParser === "function" && fastify.hasContentTypeParser("multipart")) {
25
- Object.defineProperty(fastify, AVATAR_MULTIPART_SUPPORT_FLAG, {
22
+ Object.defineProperty(fastify, "jskit.users-core.avatar.multipart.support", {
26
23
  value: true,
27
24
  configurable: false,
28
25
  enumerable: false,
@@ -32,7 +29,7 @@ async function registerAvatarMultipartSupport(app) {
32
29
  }
33
30
 
34
31
  await fastify.register(fastifyMultipart);
35
- Object.defineProperty(fastify, AVATAR_MULTIPART_SUPPORT_FLAG, {
32
+ Object.defineProperty(fastify, "jskit.users-core.avatar.multipart.support", {
36
33
  value: true,
37
34
  configurable: false,
38
35
  enumerable: false,
@@ -1,6 +1,5 @@
1
1
  import { Type } from "@fastify/type-provider-typebox";
2
2
  import { withStandardErrorResponses } from "@jskit-ai/http-runtime/shared/validators/errorResponses";
3
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
4
3
  import { userSettingsResource } from "../../shared/resources/userSettingsResource.js";
5
4
 
6
5
  function bootAccountSecurityRoutes(app) {
@@ -8,7 +7,7 @@ function bootAccountSecurityRoutes(app) {
8
7
  throw new Error("bootAccountSecurityRoutes requires application make().");
9
8
  }
10
9
 
11
- const router = app.make(KERNEL_TOKENS.HttpRouter);
10
+ const router = app.make("jskit.http.router");
12
11
  const authService = app.make("authService");
13
12
 
14
13
  router.register(
@@ -2,14 +2,12 @@ import { withActionDefaults } from "@jskit-ai/kernel/shared/actions";
2
2
  import { createService as createAccountSecurityService } from "./accountSecurityService.js";
3
3
  import { accountSecurityActions } from "./accountSecurityActions.js";
4
4
 
5
- const USERS_ACCOUNT_SECURITY_SERVICE_TOKEN = "users.accountSecurity.service";
6
-
7
5
  function registerAccountSecurity(app) {
8
6
  if (!app || typeof app.singleton !== "function" || typeof app.actions !== "function") {
9
7
  throw new Error("registerAccountSecurity requires application singleton()/actions().");
10
8
  }
11
9
 
12
- app.singleton(USERS_ACCOUNT_SECURITY_SERVICE_TOKEN, (scope) => {
10
+ app.singleton("users.accountSecurity.service", (scope) => {
13
11
  const authService = scope.has("authService") ? scope.make("authService") : null;
14
12
  return createAccountSecurityService({
15
13
  userSettingsRepository: scope.make("userSettingsRepository"),
@@ -22,7 +20,7 @@ function registerAccountSecurity(app) {
22
20
  withActionDefaults(accountSecurityActions, {
23
21
  domain: "settings",
24
22
  dependencies: {
25
- accountSecurityService: USERS_ACCOUNT_SECURITY_SERVICE_TOKEN
23
+ accountSecurityService: "users.accountSecurity.service"
26
24
  }
27
25
  })
28
26
  );
@@ -11,7 +11,6 @@ Use these folders:
11
11
  - `routes/`: shared route schema maps used by more than one route adapter.
12
12
 
13
13
  Keep these files here:
14
- - `diTokens.js`: shared DI tokens used across slices.
15
14
  - `registerCommonRepositories.js`: shared repository bindings.
16
15
  - `registerSharedApi.js`: shared API metadata registration.
17
16
 
@@ -1,4 +1,3 @@
1
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
2
1
  import { createRepository as createUserProfilesRepository } from "./repositories/userProfilesRepository.js";
3
2
  import { createRepository as createUserSettingsRepository } from "./repositories/userSettingsRepository.js";
4
3
  import { createRepository as createWorkspacesRepository } from "./repositories/workspacesRepository.js";
@@ -12,32 +11,32 @@ function registerCommonRepositories(app) {
12
11
  }
13
12
 
14
13
  app.singleton("userProfilesRepository", (scope) => {
15
- const knex = scope.make(KERNEL_TOKENS.Knex);
14
+ const knex = scope.make("jskit.database.knex");
16
15
  return createUserProfilesRepository(knex);
17
16
  });
18
17
 
19
18
  app.singleton("userSettingsRepository", (scope) => {
20
- const knex = scope.make(KERNEL_TOKENS.Knex);
19
+ const knex = scope.make("jskit.database.knex");
21
20
  return createUserSettingsRepository(knex);
22
21
  });
23
22
 
24
23
  app.singleton("workspacesRepository", (scope) => {
25
- const knex = scope.make(KERNEL_TOKENS.Knex);
24
+ const knex = scope.make("jskit.database.knex");
26
25
  return createWorkspacesRepository(knex);
27
26
  });
28
27
 
29
28
  app.singleton("workspaceMembershipsRepository", (scope) => {
30
- const knex = scope.make(KERNEL_TOKENS.Knex);
29
+ const knex = scope.make("jskit.database.knex");
31
30
  return createWorkspaceMembershipsRepository(knex);
32
31
  });
33
32
 
34
33
  app.singleton("workspaceInvitesRepository", (scope) => {
35
- const knex = scope.make(KERNEL_TOKENS.Knex);
34
+ const knex = scope.make("jskit.database.knex");
36
35
  return createWorkspaceInvitesRepository(knex);
37
36
  });
38
37
 
39
38
  app.singleton("consoleSettingsRepository", (scope) => {
40
- const knex = scope.make(KERNEL_TOKENS.Knex);
39
+ const knex = scope.make("jskit.database.knex");
41
40
  return createConsoleSettingsRepository(knex);
42
41
  });
43
42
  }
@@ -1,7 +1,3 @@
1
- import {
2
- ACCOUNT_SETTINGS_CHANGED_EVENT,
3
- USERS_BOOTSTRAP_CHANGED_EVENT
4
- } from "../../../shared/events/usersEvents.js";
5
1
  import { deepFreeze } from "./deepFreeze.js";
6
2
 
7
3
  function resolveActorScopedEntityId({ options } = {}) {
@@ -22,7 +18,7 @@ const ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS = deepFreeze([
22
18
  operation: "updated",
23
19
  entityId: resolveActorScopedEntityId,
24
20
  realtime: {
25
- event: ACCOUNT_SETTINGS_CHANGED_EVENT,
21
+ event: "account.settings.changed",
26
22
  audience: "actor_user"
27
23
  }
28
24
  },
@@ -33,7 +29,7 @@ const ACCOUNT_SETTINGS_AND_BOOTSTRAP_EVENTS = deepFreeze([
33
29
  operation: "updated",
34
30
  entityId: resolveActorScopedEntityId,
35
31
  realtime: {
36
- event: USERS_BOOTSTRAP_CHANGED_EVENT,
32
+ event: "users.bootstrap.changed",
37
33
  audience: "actor_user"
38
34
  }
39
35
  }
@@ -84,7 +80,7 @@ function createWorkspaceEntityAndBootstrapEvents({
84
80
  operation: "updated",
85
81
  entityId: bootstrapEntityId,
86
82
  realtime: {
87
- event: USERS_BOOTSTRAP_CHANGED_EVENT,
83
+ event: "users.bootstrap.changed",
88
84
  audience: bootstrapAudience
89
85
  }
90
86
  }
@@ -1,5 +1,4 @@
1
1
  import { withStandardErrorResponses } from "@jskit-ai/http-runtime/shared/validators/errorResponses";
2
- import { KERNEL_TOKENS } from "@jskit-ai/kernel/shared/support/tokens";
3
2
  import { consoleSettingsResource } from "../../shared/resources/consoleSettingsResource.js";
4
3
 
5
4
  function bootConsoleSettingsRoutes(app) {
@@ -7,7 +6,7 @@ function bootConsoleSettingsRoutes(app) {
7
6
  throw new Error("bootConsoleSettingsRoutes requires application make().");
8
7
  }
9
8
 
10
- const router = app.make(KERNEL_TOKENS.HttpRouter);
9
+ const router = app.make("jskit.http.router");
11
10
 
12
11
  router.register(
13
12
  "GET",
@@ -1,5 +1,4 @@
1
1
  import { withActionDefaults } from "@jskit-ai/kernel/shared/actions";
2
- import { CONSOLE_SETTINGS_CHANGED_EVENT } from "../../shared/events/usersEvents.js";
3
2
  import { createService as createConsoleSettingsService } from "./consoleSettingsService.js";
4
3
  import { createService as createConsoleService } from "./consoleService.js";
5
4
  import { consoleSettingsActions } from "./consoleSettingsActions.js";
@@ -35,7 +34,7 @@ function registerConsoleSettings(app) {
35
34
  operation: "updated",
36
35
  entityId: 1,
37
36
  realtime: Object.freeze({
38
- event: CONSOLE_SETTINGS_CHANGED_EVENT,
37
+ event: "console.settings.changed",
39
38
  audience: "all_users"
40
39
  })
41
40
  })
@@ -1,32 +1,26 @@
1
1
  import { registerBootstrapPayloadContributor } from "@jskit-ai/kernel/server/runtime";
2
2
  import { resolveAppConfig } from "@jskit-ai/kernel/server/support";
3
- import {
4
- USERS_WORKSPACE_INVITATIONS_ENABLED_TOKEN,
5
- USERS_TENANCY_PROFILE_TOKEN,
6
- USERS_WORKSPACE_PENDING_INVITATIONS_SERVICE_TOKEN
7
- } from "./common/diTokens.js";
8
3
  import { createWorkspaceBootstrapContributor } from "./workspaceBootstrapContributor.js";
9
4
 
10
- const USERS_WORKSPACE_BOOTSTRAP_PAYLOAD_CONTRIBUTOR_TOKEN = "users.core.workspace.bootstrap.payloadContributor";
11
5
 
12
6
  function registerWorkspaceBootstrap(app) {
13
7
  if (!app || typeof app.singleton !== "function") {
14
8
  throw new Error("registerWorkspaceBootstrap requires application singleton().");
15
9
  }
16
10
 
17
- registerBootstrapPayloadContributor(app, USERS_WORKSPACE_BOOTSTRAP_PAYLOAD_CONTRIBUTOR_TOKEN, (scope) => {
18
- const workspaceInvitationsEnabled = scope.make(USERS_WORKSPACE_INVITATIONS_ENABLED_TOKEN);
11
+ registerBootstrapPayloadContributor(app, "users.core.workspace.bootstrap.payloadContributor", (scope) => {
12
+ const workspaceInvitationsEnabled = scope.make("users.workspace.invitations.enabled");
19
13
 
20
14
  return createWorkspaceBootstrapContributor({
21
15
  workspaceService: scope.make("users.workspace.service"),
22
16
  workspacePendingInvitationsService: workspaceInvitationsEnabled
23
- ? scope.make(USERS_WORKSPACE_PENDING_INVITATIONS_SERVICE_TOKEN)
17
+ ? scope.make("users.workspace.pending-invitations.service")
24
18
  : null,
25
19
  workspaceInvitationsEnabled,
26
20
  userProfilesRepository: scope.make("userProfilesRepository"),
27
21
  userSettingsRepository: scope.make("userSettingsRepository"),
28
22
  appConfig: resolveAppConfig(scope),
29
- tenancyProfile: scope.make(USERS_TENANCY_PROFILE_TOKEN),
23
+ tenancyProfile: scope.make("users.tenancy.profile"),
30
24
  authService: scope.make("authService"),
31
25
  consoleService: scope.has("consoleService") ? scope.make("consoleService") : null
32
26
  });