@deveye/types 0.27.0 → 0.27.1
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 +1 -1
- package/src/domain/workspaceRole.ts +7 -0
- package/src/features/workspace.ts +27 -1
- package/src/http/auth.ts +46 -1
- package/src/index.ts +11 -0
- package/src/sdk/client-ambient.d.ts +5 -0
package/package.json
CHANGED
|
@@ -224,6 +224,12 @@ export const workspaceRoleSchema = z.object({
|
|
|
224
224
|
position: z.number().int().nonnegative(),
|
|
225
225
|
capabilities: z.array(workspaceCapabilitySchema),
|
|
226
226
|
features: z.array(workspaceFeatureGrantSchema),
|
|
227
|
+
/**
|
|
228
|
+
* Écriture et tous les réglages sur chaque fonctionnalité, celles installées
|
|
229
|
+
* plus tard comprises : `features` est alors ignoré. Les capacités restent
|
|
230
|
+
* celles du rôle.
|
|
231
|
+
*/
|
|
232
|
+
allFeatures: z.boolean(),
|
|
227
233
|
/** Attribué d'office à qui rejoint l'espace. */
|
|
228
234
|
isDefault: z.boolean(),
|
|
229
235
|
memberCount: z.number().int().nonnegative()
|
|
@@ -242,6 +248,7 @@ export interface WorkspaceRoleRow {
|
|
|
242
248
|
capabilities: string;
|
|
243
249
|
/** Tableau JSON de `WorkspaceFeatureGrant`. */
|
|
244
250
|
features: string;
|
|
251
|
+
all_features: number;
|
|
245
252
|
is_default: number;
|
|
246
253
|
created: number;
|
|
247
254
|
}
|
|
@@ -3,6 +3,8 @@ import { homeLayoutSchema } from '../domain/home';
|
|
|
3
3
|
import { workspaceSchema } from '../domain/workspace';
|
|
4
4
|
import {
|
|
5
5
|
WORKSPACE_ROLE_NAME_MAX,
|
|
6
|
+
featureAccessSchema,
|
|
7
|
+
featureIdSchema,
|
|
6
8
|
workspaceCapabilitySchema,
|
|
7
9
|
workspaceFeatureGrantSchema,
|
|
8
10
|
workspacePermissionsSchema,
|
|
@@ -140,7 +142,8 @@ const roleDraftSchema = z.object({
|
|
|
140
142
|
name: z.string().min(1).max(WORKSPACE_ROLE_NAME_MAX),
|
|
141
143
|
color: z.string().regex(/^#[0-9a-fA-F]{6}$/),
|
|
142
144
|
capabilities: z.array(workspaceCapabilitySchema),
|
|
143
|
-
features: z.array(workspaceFeatureGrantSchema)
|
|
145
|
+
features: z.array(workspaceFeatureGrantSchema),
|
|
146
|
+
allFeatures: z.boolean()
|
|
144
147
|
});
|
|
145
148
|
|
|
146
149
|
export const workspaceRoleList = {
|
|
@@ -186,6 +189,28 @@ export const workspaceRoleSetDefault = {
|
|
|
186
189
|
output: z.object({ roleId: z.number().int().positive() })
|
|
187
190
|
};
|
|
188
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Ouvre une fonctionnalité à des rôles, en un geste : l'étape d'accès qui suit
|
|
194
|
+
* l'ajout de sa tuile. Un grant neuf ne porte que le niveau ; un grant existant
|
|
195
|
+
* garde ses réglages et ne fait que monter. Un rôle `allFeatures` est ignoré.
|
|
196
|
+
*/
|
|
197
|
+
export const workspaceFeatureAccessSet = {
|
|
198
|
+
command: 'workspace.featureAccessSet' as const,
|
|
199
|
+
input: z.object({
|
|
200
|
+
feature: featureIdSchema,
|
|
201
|
+
grants: z
|
|
202
|
+
.array(
|
|
203
|
+
z.object({
|
|
204
|
+
roleId: z.number().int().positive(),
|
|
205
|
+
access: featureAccessSchema
|
|
206
|
+
})
|
|
207
|
+
)
|
|
208
|
+
.min(1)
|
|
209
|
+
.max(100)
|
|
210
|
+
}),
|
|
211
|
+
output: z.object({ roleIds: z.array(z.number().int().positive()) })
|
|
212
|
+
};
|
|
213
|
+
|
|
189
214
|
/** Attribue un rôle à un membre. `null` le laisse sans aucun droit. */
|
|
190
215
|
export const workspaceAssignRole = {
|
|
191
216
|
command: 'workspace.assignRole' as const,
|
|
@@ -205,6 +230,7 @@ export const workspaceCommands = [
|
|
|
205
230
|
workspaceRoleUpdate,
|
|
206
231
|
workspaceRoleDelete,
|
|
207
232
|
workspaceRoleSetDefault,
|
|
233
|
+
workspaceFeatureAccessSet,
|
|
208
234
|
workspaceAssignRole,
|
|
209
235
|
workspaceRename,
|
|
210
236
|
workspaceLeave,
|
package/src/http/auth.ts
CHANGED
|
@@ -45,7 +45,8 @@ export const sessionBundleSchema = z.object({
|
|
|
45
45
|
export type SessionBundle = z.infer<typeof sessionBundleSchema>;
|
|
46
46
|
|
|
47
47
|
export const loginRequestSchema = z.object({
|
|
48
|
-
|
|
48
|
+
/** The account name, or its email address (a name never holds an "@"). */
|
|
49
|
+
username: z.string().min(1).max(320),
|
|
49
50
|
password: z.string().min(1).max(512),
|
|
50
51
|
/** A federated page's trusted-browser token for this account; a same-origin page holds a cookie instead. */
|
|
51
52
|
trustToken: z.string().max(256).optional()
|
|
@@ -234,3 +235,47 @@ export const signupCompleteResponseSchema = sessionBundleSchema.extend({
|
|
|
234
235
|
});
|
|
235
236
|
|
|
236
237
|
export type SignupCompleteResponse = z.infer<typeof signupCompleteResponseSchema>;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Forgotten password, in three steps: ask with the account's email
|
|
241
|
+
* (`/password-reset`), open the mailed link (`/password-reset/verify`), choose
|
|
242
|
+
* a new password (`/password-reset/complete`). The first step answers the same
|
|
243
|
+
* whether the address has an account or not. No session is opened at the end:
|
|
244
|
+
* the person signs in again, second factors included.
|
|
245
|
+
*/
|
|
246
|
+
export const passwordResetStartRequestSchema = z.object({ email: z.string().email().max(320) });
|
|
247
|
+
|
|
248
|
+
export type PasswordResetStartRequest = z.infer<typeof passwordResetStartRequestSchema>;
|
|
249
|
+
|
|
250
|
+
export const passwordResetVerifyRequestSchema = z.object({ token: z.string().min(1).max(128) });
|
|
251
|
+
|
|
252
|
+
export type PasswordResetVerifyRequest = z.infer<typeof passwordResetVerifyRequestSchema>;
|
|
253
|
+
|
|
254
|
+
export const passwordResetVerifyResponseSchema = z.object({
|
|
255
|
+
username: z.string(),
|
|
256
|
+
/**
|
|
257
|
+
* The account's data is encrypted under its password: the recovery code
|
|
258
|
+
* chosen at activation must come with the new password, or that data
|
|
259
|
+
* would be lost.
|
|
260
|
+
*/
|
|
261
|
+
recoveryRequired: z.boolean()
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export type PasswordResetVerifyResponse = z.infer<typeof passwordResetVerifyResponseSchema>;
|
|
265
|
+
|
|
266
|
+
export const passwordResetCompleteRequestSchema = z.object({
|
|
267
|
+
token: z.string().min(1).max(128),
|
|
268
|
+
password: passwordSchema,
|
|
269
|
+
/** Required when `recoveryRequired`, ignored otherwise. */
|
|
270
|
+
recoveryCode: z.string().max(64).optional()
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
export type PasswordResetCompleteRequest = z.infer<typeof passwordResetCompleteRequestSchema>;
|
|
274
|
+
|
|
275
|
+
export const passwordResetCompleteResponseSchema = z.object({
|
|
276
|
+
username: z.string(),
|
|
277
|
+
/** The recovery code that replaces the one just used, shown once. `null` when none was needed. */
|
|
278
|
+
recoveryCode: z.string().nullable()
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
export type PasswordResetCompleteResponse = z.infer<typeof passwordResetCompleteResponseSchema>;
|
package/src/index.ts
CHANGED
|
@@ -1085,6 +1085,7 @@ export {
|
|
|
1085
1085
|
workspaceAcceptInvite,
|
|
1086
1086
|
workspaceDeclineInvite,
|
|
1087
1087
|
workspaceAssignRole,
|
|
1088
|
+
workspaceFeatureAccessSet,
|
|
1088
1089
|
workspaceRename,
|
|
1089
1090
|
workspaceRoleCreate,
|
|
1090
1091
|
workspaceRoleDelete,
|
|
@@ -1237,6 +1238,11 @@ export {
|
|
|
1237
1238
|
loginStepSchema,
|
|
1238
1239
|
loginVerifyRequestSchema,
|
|
1239
1240
|
meResponseSchema,
|
|
1241
|
+
passwordResetCompleteRequestSchema,
|
|
1242
|
+
passwordResetCompleteResponseSchema,
|
|
1243
|
+
passwordResetStartRequestSchema,
|
|
1244
|
+
passwordResetVerifyRequestSchema,
|
|
1245
|
+
passwordResetVerifyResponseSchema,
|
|
1240
1246
|
passwordSchema,
|
|
1241
1247
|
refreshRequestSchema,
|
|
1242
1248
|
refreshResponseSchema,
|
|
@@ -1262,6 +1268,11 @@ export type {
|
|
|
1262
1268
|
LoginStep,
|
|
1263
1269
|
LoginVerifyRequest,
|
|
1264
1270
|
MeResponse,
|
|
1271
|
+
PasswordResetCompleteRequest,
|
|
1272
|
+
PasswordResetCompleteResponse,
|
|
1273
|
+
PasswordResetStartRequest,
|
|
1274
|
+
PasswordResetVerifyRequest,
|
|
1275
|
+
PasswordResetVerifyResponse,
|
|
1265
1276
|
RefreshRequest,
|
|
1266
1277
|
RefreshResponse,
|
|
1267
1278
|
SessionBundle,
|
|
@@ -368,6 +368,11 @@ declare module 'deveye-sdk-client' {
|
|
|
368
368
|
searchable?: boolean | 'auto';
|
|
369
369
|
/** Chips under the search, AND-combined, reset when the panel closes. */
|
|
370
370
|
filters?: readonly SearchSelectFilter<T>[];
|
|
371
|
+
/**
|
|
372
|
+
* For a long list with long labels: the panel opens larger, grows by
|
|
373
|
+
* its corner, and the browser keeps the dragged size under this key.
|
|
374
|
+
*/
|
|
375
|
+
resizeKey?: string;
|
|
371
376
|
/** The trigger's id, for a label's `htmlFor`. */
|
|
372
377
|
id?: string;
|
|
373
378
|
/** The field the opening Dialog focuses first (`data-autofocus`). */
|