@jskit-ai/workspaces-core 0.1.30 → 0.1.32
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.descriptor.mjs +11 -22
- package/package.json +11 -9
- package/src/server/WorkspacesCoreServiceProvider.js +22 -2
- package/src/server/common/repositories/workspaceInvitesRepository.js +233 -78
- package/src/server/common/repositories/workspaceMembershipsRepository.js +177 -86
- package/src/server/common/repositories/workspacesRepository.js +179 -86
- package/src/server/common/services/workspaceContextService.js +26 -24
- package/src/server/common/validators/routeParamsValidator.js +36 -53
- package/src/server/registerWorkspaceCore.js +6 -7
- package/src/server/registerWorkspaceRepositories.js +7 -3
- package/src/server/support/workspaceServerScopeSupport.js +1 -1
- package/src/server/workspaceBootstrapContributor.js +5 -14
- package/src/server/workspaceDirectory/bootWorkspaceDirectoryRoutes.js +54 -27
- package/src/server/workspaceDirectory/workspaceDirectoryActions.js +30 -24
- package/src/server/workspaceMembers/bootWorkspaceMembers.js +70 -32
- package/src/server/workspaceMembers/workspaceMembersActions.js +61 -27
- package/src/server/workspaceMembers/workspaceMembersService.js +43 -7
- package/src/server/workspacePendingInvitations/bootWorkspacePendingInvitations.js +28 -13
- package/src/server/workspacePendingInvitations/workspacePendingInvitationsActions.js +13 -15
- package/src/server/workspacePendingInvitations/workspacePendingInvitationsService.js +33 -10
- package/src/server/workspaceSettings/bootWorkspaceSettings.js +32 -13
- package/src/server/workspaceSettings/registerWorkspaceSettings.js +5 -1
- package/src/server/workspaceSettings/workspaceSettingsActions.js +18 -12
- package/src/server/workspaceSettings/workspaceSettingsRepository.js +104 -91
- package/src/server/workspaceSettings/workspaceSettingsService.js +5 -6
- package/src/shared/jsonApiTransports.js +79 -0
- package/src/shared/resources/workspaceInvitesResource.js +158 -0
- package/src/shared/resources/workspaceMembersResource.js +176 -311
- package/src/shared/resources/workspaceMembershipsResource.js +96 -0
- package/src/shared/resources/workspacePendingInvitationsResource.js +25 -72
- package/src/shared/resources/workspaceResource.js +113 -144
- package/src/shared/resources/workspaceRoleCatalogSchema.js +31 -0
- package/src/shared/resources/workspaceSettingsResource.js +276 -148
- package/test/repositoryContracts.test.js +16 -4
- package/test/resourcesCanonical.test.js +39 -16
- package/test/routeParamsValidator.test.js +37 -19
- package/test/usersRouteResources.test.js +27 -17
- package/test/workspaceActionContextContributor.test.js +1 -1
- package/test/workspaceInternalCrudResources.test.js +98 -0
- package/test/workspaceInvitesRepository.test.js +196 -148
- package/test/workspaceMembersResource.test.js +35 -0
- package/test/workspaceMembershipsRepository.test.js +155 -115
- package/test/workspacePendingInvitationsResource.test.js +18 -23
- package/test/workspacePendingInvitationsService.test.js +2 -1
- package/test/workspaceServerScopeSupport.test.js +21 -3
- package/test/workspaceSettingsActions.test.js +5 -7
- package/test/workspaceSettingsInternalResource.test.js +8 -0
- package/test/workspaceSettingsRepository.test.js +158 -123
- package/test/workspaceSettingsResource.test.js +51 -62
- package/test/workspaceSettingsService.test.js +0 -1
- package/test/workspacesRepository.test.js +318 -174
- package/test/workspacesRouteRequestInputValidator.test.js +25 -11
- package/src/server/common/resources/workspaceInvitesResource.js +0 -207
- package/src/server/common/resources/workspaceMembershipsResource.js +0 -154
- package/src/server/common/resources/workspacesResource.js +0 -170
- package/src/server/common/validators/authenticatedUserValidator.js +0 -43
- package/src/shared/resources/resolveGlobalArrayRegistry.js +0 -6
- package/src/shared/resources/workspaceSettingsFields.js +0 -65
- package/templates/packages/main/src/shared/resources/workspaceSettingsFields.js +0 -197
- package/test/settingsFieldRegistriesSingleton.test.js +0 -14
- package/test-support/registerDefaultSettingsFields.js +0 -1
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
// @jskit-contract users.settings-fields.workspace.v1
|
|
2
|
-
// Append-only settings field registrations for workspace settings.
|
|
3
|
-
|
|
4
|
-
import { Type } from "typebox";
|
|
5
|
-
import { normalizeText } from "@jskit-ai/kernel/shared/actions/textNormalization";
|
|
6
|
-
import {
|
|
7
|
-
DEFAULT_WORKSPACE_DARK_PALETTE,
|
|
8
|
-
DEFAULT_WORKSPACE_LIGHT_PALETTE,
|
|
9
|
-
coerceWorkspaceThemeColor
|
|
10
|
-
} from "@jskit-ai/workspaces-core/shared/settings";
|
|
11
|
-
import {
|
|
12
|
-
defineField,
|
|
13
|
-
resetWorkspaceSettingsFields
|
|
14
|
-
} from "@jskit-ai/workspaces-core/shared/resources/workspaceSettingsFields";
|
|
15
|
-
|
|
16
|
-
function normalizeHexColor(value) {
|
|
17
|
-
const color = normalizeText(value);
|
|
18
|
-
return /^#[0-9A-Fa-f]{6}$/.test(color) ? color.toUpperCase() : null;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
resetWorkspaceSettingsFields();
|
|
22
|
-
|
|
23
|
-
defineField({
|
|
24
|
-
key: "lightPrimaryColor",
|
|
25
|
-
repository: { column: "light_primary_color" },
|
|
26
|
-
required: true,
|
|
27
|
-
inputSchema: Type.String({
|
|
28
|
-
minLength: 7,
|
|
29
|
-
maxLength: 7,
|
|
30
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
31
|
-
messages: {
|
|
32
|
-
required: "Light primary color is required.",
|
|
33
|
-
pattern: "Light primary color must be a hex color like #1867C0.",
|
|
34
|
-
default: "Light primary color must be a hex color like #1867C0."
|
|
35
|
-
}
|
|
36
|
-
}),
|
|
37
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
38
|
-
normalizeInput: normalizeHexColor,
|
|
39
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_LIGHT_PALETTE.color),
|
|
40
|
-
resolveDefault: () => DEFAULT_WORKSPACE_LIGHT_PALETTE.color
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
defineField({
|
|
44
|
-
key: "lightSecondaryColor",
|
|
45
|
-
repository: { column: "light_secondary_color" },
|
|
46
|
-
required: true,
|
|
47
|
-
inputSchema: Type.String({
|
|
48
|
-
minLength: 7,
|
|
49
|
-
maxLength: 7,
|
|
50
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
51
|
-
messages: {
|
|
52
|
-
required: "Light secondary color is required.",
|
|
53
|
-
pattern: "Light secondary color must be a hex color like #48A9A6.",
|
|
54
|
-
default: "Light secondary color must be a hex color like #48A9A6."
|
|
55
|
-
}
|
|
56
|
-
}),
|
|
57
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
58
|
-
normalizeInput: normalizeHexColor,
|
|
59
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_LIGHT_PALETTE.secondaryColor),
|
|
60
|
-
resolveDefault: () => DEFAULT_WORKSPACE_LIGHT_PALETTE.secondaryColor
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
defineField({
|
|
64
|
-
key: "lightSurfaceColor",
|
|
65
|
-
repository: { column: "light_surface_color" },
|
|
66
|
-
required: true,
|
|
67
|
-
inputSchema: Type.String({
|
|
68
|
-
minLength: 7,
|
|
69
|
-
maxLength: 7,
|
|
70
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
71
|
-
messages: {
|
|
72
|
-
required: "Light surface color is required.",
|
|
73
|
-
pattern: "Light surface color must be a hex color like #FFFFFF.",
|
|
74
|
-
default: "Light surface color must be a hex color like #FFFFFF."
|
|
75
|
-
}
|
|
76
|
-
}),
|
|
77
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
78
|
-
normalizeInput: normalizeHexColor,
|
|
79
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_LIGHT_PALETTE.surfaceColor),
|
|
80
|
-
resolveDefault: () => DEFAULT_WORKSPACE_LIGHT_PALETTE.surfaceColor
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
defineField({
|
|
84
|
-
key: "lightSurfaceVariantColor",
|
|
85
|
-
repository: { column: "light_surface_variant_color" },
|
|
86
|
-
required: true,
|
|
87
|
-
inputSchema: Type.String({
|
|
88
|
-
minLength: 7,
|
|
89
|
-
maxLength: 7,
|
|
90
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
91
|
-
messages: {
|
|
92
|
-
required: "Light surface variant color is required.",
|
|
93
|
-
pattern: "Light surface variant color must be a hex color like #424242.",
|
|
94
|
-
default: "Light surface variant color must be a hex color like #424242."
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
98
|
-
normalizeInput: normalizeHexColor,
|
|
99
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_LIGHT_PALETTE.surfaceVariantColor),
|
|
100
|
-
resolveDefault: () => DEFAULT_WORKSPACE_LIGHT_PALETTE.surfaceVariantColor
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
defineField({
|
|
104
|
-
key: "darkPrimaryColor",
|
|
105
|
-
repository: { column: "dark_primary_color" },
|
|
106
|
-
required: true,
|
|
107
|
-
inputSchema: Type.String({
|
|
108
|
-
minLength: 7,
|
|
109
|
-
maxLength: 7,
|
|
110
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
111
|
-
messages: {
|
|
112
|
-
required: "Dark primary color is required.",
|
|
113
|
-
pattern: "Dark primary color must be a hex color like #2196F3.",
|
|
114
|
-
default: "Dark primary color must be a hex color like #2196F3."
|
|
115
|
-
}
|
|
116
|
-
}),
|
|
117
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
118
|
-
normalizeInput: normalizeHexColor,
|
|
119
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_DARK_PALETTE.color),
|
|
120
|
-
resolveDefault: () => DEFAULT_WORKSPACE_DARK_PALETTE.color
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
defineField({
|
|
124
|
-
key: "darkSecondaryColor",
|
|
125
|
-
repository: { column: "dark_secondary_color" },
|
|
126
|
-
required: true,
|
|
127
|
-
inputSchema: Type.String({
|
|
128
|
-
minLength: 7,
|
|
129
|
-
maxLength: 7,
|
|
130
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
131
|
-
messages: {
|
|
132
|
-
required: "Dark secondary color is required.",
|
|
133
|
-
pattern: "Dark secondary color must be a hex color like #54B6B2.",
|
|
134
|
-
default: "Dark secondary color must be a hex color like #54B6B2."
|
|
135
|
-
}
|
|
136
|
-
}),
|
|
137
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
138
|
-
normalizeInput: normalizeHexColor,
|
|
139
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_DARK_PALETTE.secondaryColor),
|
|
140
|
-
resolveDefault: () => DEFAULT_WORKSPACE_DARK_PALETTE.secondaryColor
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
defineField({
|
|
144
|
-
key: "darkSurfaceColor",
|
|
145
|
-
repository: { column: "dark_surface_color" },
|
|
146
|
-
required: true,
|
|
147
|
-
inputSchema: Type.String({
|
|
148
|
-
minLength: 7,
|
|
149
|
-
maxLength: 7,
|
|
150
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
151
|
-
messages: {
|
|
152
|
-
required: "Dark surface color is required.",
|
|
153
|
-
pattern: "Dark surface color must be a hex color like #212121.",
|
|
154
|
-
default: "Dark surface color must be a hex color like #212121."
|
|
155
|
-
}
|
|
156
|
-
}),
|
|
157
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
158
|
-
normalizeInput: normalizeHexColor,
|
|
159
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_DARK_PALETTE.surfaceColor),
|
|
160
|
-
resolveDefault: () => DEFAULT_WORKSPACE_DARK_PALETTE.surfaceColor
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
defineField({
|
|
164
|
-
key: "darkSurfaceVariantColor",
|
|
165
|
-
repository: { column: "dark_surface_variant_color" },
|
|
166
|
-
required: true,
|
|
167
|
-
inputSchema: Type.String({
|
|
168
|
-
minLength: 7,
|
|
169
|
-
maxLength: 7,
|
|
170
|
-
pattern: "^#[0-9A-Fa-f]{6}$",
|
|
171
|
-
messages: {
|
|
172
|
-
required: "Dark surface variant color is required.",
|
|
173
|
-
pattern: "Dark surface variant color must be a hex color like #C8C8C8.",
|
|
174
|
-
default: "Dark surface variant color must be a hex color like #C8C8C8."
|
|
175
|
-
}
|
|
176
|
-
}),
|
|
177
|
-
outputSchema: Type.String({ minLength: 7, maxLength: 7, pattern: "^#[0-9A-Fa-f]{6}$" }),
|
|
178
|
-
normalizeInput: normalizeHexColor,
|
|
179
|
-
normalizeOutput: (value) => coerceWorkspaceThemeColor(value, DEFAULT_WORKSPACE_DARK_PALETTE.surfaceVariantColor),
|
|
180
|
-
resolveDefault: () => DEFAULT_WORKSPACE_DARK_PALETTE.surfaceVariantColor
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
defineField({
|
|
184
|
-
key: "invitesEnabled",
|
|
185
|
-
repository: { column: "invites_enabled" },
|
|
186
|
-
required: true,
|
|
187
|
-
inputSchema: Type.Boolean({
|
|
188
|
-
messages: {
|
|
189
|
-
required: "invitesEnabled is required.",
|
|
190
|
-
default: "invitesEnabled must be a boolean."
|
|
191
|
-
}
|
|
192
|
-
}),
|
|
193
|
-
outputSchema: Type.Boolean(),
|
|
194
|
-
normalizeInput: (value) => value === true,
|
|
195
|
-
normalizeOutput: (value) => value !== false,
|
|
196
|
-
resolveDefault: ({ defaultInvitesEnabled } = {}) => defaultInvitesEnabled !== false
|
|
197
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import test from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
|
|
4
|
-
async function importWithIdentity(url, identity) {
|
|
5
|
-
return import(`${url.href}?identity=${identity}`);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
test("workspace settings field registries stay shared across module identities", async () => {
|
|
9
|
-
const workspaceModuleUrl = new URL("../src/shared/resources/workspaceSettingsFields.js", import.meta.url);
|
|
10
|
-
|
|
11
|
-
const workspaceA = await importWithIdentity(workspaceModuleUrl, "workspace-a");
|
|
12
|
-
const workspaceB = await importWithIdentity(workspaceModuleUrl, "workspace-b");
|
|
13
|
-
assert.equal(workspaceA.workspaceSettingsFields, workspaceB.workspaceSettingsFields);
|
|
14
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../templates/packages/main/src/shared/resources/workspaceSettingsFields.js";
|