@deveye/types 0.20.1 → 0.20.2
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/deviceDocker.ts +5 -1
- package/src/domain/featureDomain.ts +3 -1
- package/src/domain/featureRegistry.ts +19 -12
- package/src/domain/maintenance.ts +7 -5
- package/src/domain/notifications.ts +2 -1
- package/src/domain/pathExclusions.test.ts +29 -0
- package/src/domain/pathExclusions.ts +85 -0
- package/src/domain/report.ts +5 -2
- package/src/domain/syncProtocol.ts +0 -9
- package/src/domain/user.ts +2 -0
- package/src/domain/workspace.ts +8 -1
- package/src/features/user.ts +24 -3
- package/src/http/auth.ts +11 -2
- package/src/http/status.ts +26 -0
- package/src/index.ts +36 -5
- package/src/protocol/agent.ts +108 -10
- package/src/sdk/client-ambient.d.ts +118 -10
- package/src/sdk/client.ts +19 -1
- package/src/sdk/env.test.ts +150 -0
- package/src/sdk/env.ts +191 -0
- package/src/sdk/index.ts +1 -0
- package/src/sdk/manifest.test.ts +7 -0
- package/src/sdk/manifest.ts +15 -1
- package/src/sdk/pageLook.test.ts +26 -0
- package/src/sdk/pageLook.ts +81 -0
- package/src/sdk/providers.ts +83 -1
- package/src/sdk/server.ts +223 -17
- package/src/sdk/testing.test.ts +22 -1
- package/src/sdk/testing.ts +173 -18
package/package.json
CHANGED
|
@@ -158,7 +158,10 @@ export const dockerActionSchema = z.enum([
|
|
|
158
158
|
'pruneBuildCache',
|
|
159
159
|
// Mise à jour d'un service.
|
|
160
160
|
'pull',
|
|
161
|
-
'recreate'
|
|
161
|
+
'recreate',
|
|
162
|
+
// Déploiement d'un service compose (`projet/service`) : son image, puis sa
|
|
163
|
+
// recréation seule. Refusable par la machine (`allow_docker_deploy`).
|
|
164
|
+
'composeDeploy'
|
|
162
165
|
]);
|
|
163
166
|
export type DockerAction = z.infer<typeof dockerActionSchema>;
|
|
164
167
|
|
|
@@ -170,6 +173,7 @@ export type DockerAction = z.infer<typeof dockerActionSchema>;
|
|
|
170
173
|
export const DOCKER_LONG_ACTIONS = [
|
|
171
174
|
'pull',
|
|
172
175
|
'recreate',
|
|
176
|
+
'composeDeploy',
|
|
173
177
|
'pruneContainers',
|
|
174
178
|
'pruneImages',
|
|
175
179
|
'pruneVolumes',
|
|
@@ -41,6 +41,8 @@ export const featureDomainSchema = z.object({
|
|
|
41
41
|
verifiedAt: z.number().int().nullable(),
|
|
42
42
|
checkedAt: z.number().int().nullable(),
|
|
43
43
|
/** How many of the feature's items designate this domain. */
|
|
44
|
-
useCount: z.number().int().nonnegative()
|
|
44
|
+
useCount: z.number().int().nonnegative(),
|
|
45
|
+
/** The owner's plan holds this name paused: it is not served until the limit rises. */
|
|
46
|
+
planPaused: z.boolean()
|
|
45
47
|
});
|
|
46
48
|
export type FeatureDomain = z.infer<typeof featureDomainSchema>;
|
|
@@ -58,9 +58,11 @@ export interface FeatureDescriptor {
|
|
|
58
58
|
/**
|
|
59
59
|
* La phrase de tête de l'onglet Notifications : QUAND la fonctionnalité
|
|
60
60
|
* prévient. Sans elle, l'onglet liste des canaux sans dire à quoi ils
|
|
61
|
-
* servent. Exigée dès que `notifies` est vrai.
|
|
61
|
+
* servent. Exigée dès que `notifies` est vrai. `perItem: false` quand rien
|
|
62
|
+
* ne part jamais au nom d'un élément : ses réglages n'ont alors pas
|
|
63
|
+
* d'onglet Notifications qui ne recevrait rien.
|
|
62
64
|
*/
|
|
63
|
-
notifications?: { hint: string };
|
|
65
|
+
notifications?: { hint: string; perItem?: boolean };
|
|
64
66
|
/**
|
|
65
67
|
* Un de ses éléments peut-il être rendu visible depuis un autre espace ?
|
|
66
68
|
* Décidé par le chiffrement : un élément partagé reste chiffré sous la clé
|
|
@@ -198,17 +200,17 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
|
|
|
198
200
|
id: 'deploy',
|
|
199
201
|
label: 'Déploiements',
|
|
200
202
|
description:
|
|
201
|
-
'Lecture : cibles et historique. Écriture : poser
|
|
203
|
+
'Lecture : cibles et historique. Écriture : poser un accès et déclencher une mise en production.',
|
|
202
204
|
icon: 'rocket',
|
|
203
205
|
notifies: true,
|
|
204
206
|
notifications: {
|
|
205
|
-
hint: 'Envoyées à l’atterrissage d’un déploiement, échec comme succès, y compris ceux lancés depuis Dokploy, une CI ou un push git.'
|
|
207
|
+
hint: 'Envoyées à l’atterrissage d’un déploiement, échec comme succès, y compris ceux lancés ailleurs : depuis Dokploy, une CI ou un push git.'
|
|
206
208
|
},
|
|
207
209
|
hasItems: true,
|
|
208
210
|
itemNoun: 'cible',
|
|
209
211
|
itemNounGender: 'f',
|
|
210
212
|
sources: {
|
|
211
|
-
hint: 'Les accès
|
|
213
|
+
hint: 'Les accès de l’espace : une instance Dokploy (adresse et clé d’API) ou un jeton GitHub. Chaque cible en désigne un ; corriger un accès corrige d’un coup toutes les cibles qui s’en servent.'
|
|
212
214
|
},
|
|
213
215
|
shareTier: 'open'
|
|
214
216
|
},
|
|
@@ -240,7 +242,7 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
|
|
|
240
242
|
hasItems: true,
|
|
241
243
|
itemNoun: 'travail',
|
|
242
244
|
sources: {
|
|
243
|
-
hint: 'Les destinations d’archives de l’espace : un dossier du serveur, une machine
|
|
245
|
+
hint: 'Les destinations d’archives de l’espace : un dossier du serveur, une machine, un bucket S3, un serveur SFTP ou WebDAV. Chaque travail écrit vers l’une d’elles ; la corriger corrige d’un coup tous les travaux qui s’en servent.'
|
|
244
246
|
},
|
|
245
247
|
shareTier: 'open'
|
|
246
248
|
},
|
|
@@ -248,11 +250,19 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
|
|
|
248
250
|
id: 'finance',
|
|
249
251
|
label: 'Finances',
|
|
250
252
|
description:
|
|
251
|
-
'
|
|
253
|
+
'La trésorerie de l’activité : comptes, opérations, échéances. La lecture seule est déjà lourde.',
|
|
252
254
|
icon: 'finance',
|
|
253
|
-
notifies:
|
|
255
|
+
notifies: true,
|
|
256
|
+
notifications: {
|
|
257
|
+
hint: 'Envoyées une semaine avant l’échéance d’une déclaration URSSAF de micro-entreprise, puis la veille, avec le chiffre d’affaires à déclarer ; et quand le consentement donné à une banque reliée approche de sa fin.',
|
|
258
|
+
// Un rappel concerne l'activité, jamais un compte.
|
|
259
|
+
perItem: false
|
|
260
|
+
},
|
|
254
261
|
hasItems: true,
|
|
255
262
|
itemNoun: 'compte',
|
|
263
|
+
sources: {
|
|
264
|
+
hint: 'Les banques reliées à l’espace. Chaque compte du livre en choisit une dans son onglet Banque ; ses lignes arrivent alors seules, toutes les six heures.'
|
|
265
|
+
},
|
|
256
266
|
shareTier: 'never'
|
|
257
267
|
},
|
|
258
268
|
{
|
|
@@ -274,10 +284,7 @@ export const FEATURE_REGISTRY: readonly (FeatureDescriptor & { id: WorkspaceFeat
|
|
|
274
284
|
icon: 'search',
|
|
275
285
|
notifies: false,
|
|
276
286
|
hasItems: false,
|
|
277
|
-
shareTier: 'never'
|
|
278
|
-
sources: {
|
|
279
|
-
hint: 'Les clés d’API des fournisseurs, toutes facultatives : chaque sonde libre fonctionne déjà, une clé ne fait qu’enrichir la sienne.'
|
|
280
|
-
}
|
|
287
|
+
shareTier: 'never'
|
|
281
288
|
},
|
|
282
289
|
{
|
|
283
290
|
id: 'cve',
|
|
@@ -4,13 +4,15 @@ import { z } from 'zod';
|
|
|
4
4
|
* Maintenance, site-wide or per feature, set by the global admin (or by the
|
|
5
5
|
* database and the `MAINTENANCE` variable when the interface is out of reach).
|
|
6
6
|
*
|
|
7
|
-
* A feature has
|
|
8
|
-
* public route while its background service keeps running; `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* A feature has three levels: `requests` refuses every non-admin command and
|
|
8
|
+
* public route while its background service keeps running; `preview` refuses
|
|
9
|
+
* the same, but hides the feature from non-admins instead of greying it out
|
|
10
|
+
* (a feature admins try out in production before opening it); `full` also
|
|
11
|
+
* stops the service, and refuses admins too, the feature no longer being able
|
|
12
|
+
* to answer.
|
|
11
13
|
*/
|
|
12
14
|
|
|
13
|
-
export const featureMaintenanceLevelSchema = z.enum(['requests', 'full']);
|
|
15
|
+
export const featureMaintenanceLevelSchema = z.enum(['requests', 'preview', 'full']);
|
|
14
16
|
export type FeatureMaintenanceLevel = z.infer<typeof featureMaintenanceLevelSchema>;
|
|
15
17
|
|
|
16
18
|
/** What every client of a server knows: enough to eject, grey out and redirect. */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { describe, it } from 'node:test';
|
|
3
|
+
|
|
4
|
+
import { pathExclusionProblem } from './pathExclusions';
|
|
5
|
+
|
|
6
|
+
describe('pathExclusionProblem', () => {
|
|
7
|
+
it('accepts a relative path, refuses one that escapes or starts at the root', () => {
|
|
8
|
+
assert.equal(pathExclusionProblem('path', 'build/cache'), null);
|
|
9
|
+
assert.notEqual(pathExclusionProblem('path', '/etc'), null);
|
|
10
|
+
assert.notEqual(pathExclusionProblem('path', 'a/../b'), null);
|
|
11
|
+
assert.notEqual(pathExclusionProblem('path', 'a//b'), null);
|
|
12
|
+
assert.notEqual(pathExclusionProblem('path', 'a\\b'), null);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('refuses a name with a separator', () => {
|
|
16
|
+
assert.equal(pathExclusionProblem('name', 'node_modules'), null);
|
|
17
|
+
assert.notEqual(pathExclusionProblem('name', 'a/b'), null);
|
|
18
|
+
assert.notEqual(pathExclusionProblem('name', '..'), null);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('refuses what the agent’s regex engine cannot run', () => {
|
|
22
|
+
assert.equal(pathExclusionProblem('regex', '\\.log$'), null);
|
|
23
|
+
assert.equal(pathExclusionProblem('regex', '^(?<dir>tmp)/'), null);
|
|
24
|
+
assert.notEqual(pathExclusionProblem('regex', '('), null);
|
|
25
|
+
assert.notEqual(pathExclusionProblem('regex', 'foo(?=bar)'), null);
|
|
26
|
+
assert.notEqual(pathExclusionProblem('regex', '(?<!x)y'), null);
|
|
27
|
+
assert.notEqual(pathExclusionProblem('regex', '(a)\\1'), null);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Longest exclusion pattern, shared by the server, the agent and the screens. */
|
|
4
|
+
export const PATH_EXCLUSION_PATTERN_MAX = 512;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How a path is excluded from a walked folder (a CloudSync share, a backed-up
|
|
8
|
+
* folder), always against the path relative to that folder's root:
|
|
9
|
+
* - `path`: exact relative path, a file or a folder prefix;
|
|
10
|
+
* - `name`: exact name of any path component (`node_modules`, `.git`);
|
|
11
|
+
* - `regex`: regular expression on the whole relative path, run by the
|
|
12
|
+
* agent's linear-time engine (no lookaround, no backreference).
|
|
13
|
+
*/
|
|
14
|
+
export const pathExclusionKindSchema = z.enum(['path', 'name', 'regex']);
|
|
15
|
+
export type PathExclusionKind = z.infer<typeof pathExclusionKindSchema>;
|
|
16
|
+
|
|
17
|
+
export const pathExclusionSchema = z.object({
|
|
18
|
+
kind: pathExclusionKindSchema,
|
|
19
|
+
pattern: z.string().min(1).max(PATH_EXCLUSION_PATTERN_MAX)
|
|
20
|
+
});
|
|
21
|
+
export type PathExclusion = z.infer<typeof pathExclusionSchema>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* One-click exclusions, all `name`: that kind catches the folder anywhere in
|
|
25
|
+
* the tree, not only at the root. Dependencies and caches a project rebuilds.
|
|
26
|
+
*/
|
|
27
|
+
export const PATH_EXCLUSION_SUGGESTIONS: readonly string[] = [
|
|
28
|
+
'node_modules',
|
|
29
|
+
'.git',
|
|
30
|
+
'.venv',
|
|
31
|
+
'__pycache__',
|
|
32
|
+
'target',
|
|
33
|
+
'dist',
|
|
34
|
+
'build',
|
|
35
|
+
'.cache',
|
|
36
|
+
'.next',
|
|
37
|
+
'.idea'
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const hasControlChar = (text: string): boolean => [...text].some((c) => c.charCodeAt(0) < 0x20);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* JavaScript accepts these, the agent's engine refuses them: a pattern the
|
|
44
|
+
* agent cannot compile would fail every walk of the folder.
|
|
45
|
+
*/
|
|
46
|
+
const UNSUPPORTED_REGEX = /\(\?<?[=!]|\\[1-9]|\\k</;
|
|
47
|
+
|
|
48
|
+
/** Why a pattern cannot be saved (French, shown as is), or `null` when it can. */
|
|
49
|
+
export function pathExclusionProblem(kind: PathExclusionKind, pattern: string): string | null {
|
|
50
|
+
if (pattern.length === 0) return 'Motif vide.';
|
|
51
|
+
if (pattern.length > PATH_EXCLUSION_PATTERN_MAX) {
|
|
52
|
+
return `Motif de plus de ${PATH_EXCLUSION_PATTERN_MAX} caractères.`;
|
|
53
|
+
}
|
|
54
|
+
switch (kind) {
|
|
55
|
+
case 'path': {
|
|
56
|
+
if (pattern.includes('\\')) return 'Un chemin s’écrit avec des « / ».';
|
|
57
|
+
if (hasControlChar(pattern)) return 'Caractère de contrôle interdit.';
|
|
58
|
+
if (pattern.startsWith('/')) {
|
|
59
|
+
return 'Le chemin est relatif au dossier : sans « / » au début.';
|
|
60
|
+
}
|
|
61
|
+
const segments = pattern.split('/');
|
|
62
|
+
if (segments.some((s) => s === '' || s === '.' || s === '..')) {
|
|
63
|
+
return 'Chemin relatif invalide : ni segment vide, ni « . », ni « .. ».';
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
case 'name':
|
|
68
|
+
if (pattern.includes('/') || pattern.includes('\\')) {
|
|
69
|
+
return 'Un nom ne peut pas contenir de séparateur.';
|
|
70
|
+
}
|
|
71
|
+
if (hasControlChar(pattern)) return 'Caractère de contrôle interdit.';
|
|
72
|
+
if (pattern === '.' || pattern === '..') return 'Nom invalide.';
|
|
73
|
+
return null;
|
|
74
|
+
case 'regex':
|
|
75
|
+
try {
|
|
76
|
+
new RegExp(pattern);
|
|
77
|
+
} catch {
|
|
78
|
+
return 'Expression régulière invalide.';
|
|
79
|
+
}
|
|
80
|
+
if (UNSUPPORTED_REGEX.test(pattern)) {
|
|
81
|
+
return 'Ni lookaround, ni référence arrière : l’agent ne les exécute pas.';
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/domain/report.ts
CHANGED
|
@@ -216,7 +216,9 @@ export const agentPolicySchema = z.object({
|
|
|
216
216
|
power: z.boolean(),
|
|
217
217
|
pkgUpgrade: z.boolean(),
|
|
218
218
|
serviceElevate: z.boolean(),
|
|
219
|
-
destroy: z.boolean()
|
|
219
|
+
destroy: z.boolean(),
|
|
220
|
+
/** Deployments (`composeDeploy`). Defaulted: an agent older than the switch reports without it. */
|
|
221
|
+
dockerDeploy: z.boolean().default(true)
|
|
220
222
|
});
|
|
221
223
|
export type AgentPolicy = z.infer<typeof agentPolicySchema>;
|
|
222
224
|
|
|
@@ -246,7 +248,8 @@ export const agentInfoSchema = z.object({
|
|
|
246
248
|
power: true,
|
|
247
249
|
pkgUpgrade: true,
|
|
248
250
|
serviceElevate: true,
|
|
249
|
-
destroy: true
|
|
251
|
+
destroy: true,
|
|
252
|
+
dockerDeploy: true
|
|
250
253
|
}),
|
|
251
254
|
/** The agent reaches this server over plain http/ws (opted in locally): everything, shell included, travels in clear. */
|
|
252
255
|
insecureTransport: z.boolean().default(false)
|
|
@@ -10,7 +10,6 @@ import { z } from 'zod';
|
|
|
10
10
|
*/
|
|
11
11
|
/** Bornes partagées serveur/agent/client. */
|
|
12
12
|
export const SYNC_REL_PATH_MAX = 1024;
|
|
13
|
-
export const SYNC_PATTERN_MAX = 512;
|
|
14
13
|
export const SYNC_STORAGE_PATH_MAX = 1024;
|
|
15
14
|
/** Taille max d'un chunk base64 sur le fil (≈ 1 Mo de binaire). */
|
|
16
15
|
export const SYNC_CHUNK_MAX = 1_400_000;
|
|
@@ -42,14 +41,6 @@ export const syncIndexFingerprintSchema = z.string().regex(/^\d+\.\d+\.[0-9a-f]{
|
|
|
42
41
|
export const sha256HexSchema = z.string().regex(/^[a-f0-9]{64}$/);
|
|
43
42
|
export const syncShareStatusSchema = z.enum(['active', 'paused']);
|
|
44
43
|
export type SyncShareStatus = z.infer<typeof syncShareStatusSchema>;
|
|
45
|
-
/**
|
|
46
|
-
* Type d'exclusion :
|
|
47
|
-
* - `path` → chemin relatif exact (fichier ou préfixe de dossier),
|
|
48
|
-
* - `name` → nom exact d'un composant de chemin (ex. `node_modules`),
|
|
49
|
-
* - `regex` → expression régulière sur le chemin relatif (moteur linéaire).
|
|
50
|
-
*/
|
|
51
|
-
export const syncExclusionKindSchema = z.enum(['path', 'name', 'regex']);
|
|
52
|
-
export type SyncExclusionKind = z.infer<typeof syncExclusionKindSchema>;
|
|
53
44
|
export const syncSessionStateSchema = z.enum([
|
|
54
45
|
'scanning',
|
|
55
46
|
'planning',
|
package/src/domain/user.ts
CHANGED
|
@@ -146,4 +146,6 @@ export interface UserRow {
|
|
|
146
146
|
re_auth_interval: number | null;
|
|
147
147
|
last_login: number;
|
|
148
148
|
created: number;
|
|
149
|
+
/** Seconds. When the terms of use were accepted at sign-up; `null` for an account created without a site. */
|
|
150
|
+
terms_accepted_at: number | null;
|
|
149
151
|
}
|
package/src/domain/workspace.ts
CHANGED
|
@@ -21,7 +21,14 @@ export const workspaceSchema = z.object({
|
|
|
21
21
|
ownerUserId: z.number().int().positive(),
|
|
22
22
|
users: z.array(minimalUserSchema),
|
|
23
23
|
features: z.array(z.string().min(1)),
|
|
24
|
-
created: z.number().int().nonnegative()
|
|
24
|
+
created: z.number().int().nonnegative(),
|
|
25
|
+
/**
|
|
26
|
+
* L'offre du propriétaire tient cet espace partagé en pause : ses membres
|
|
27
|
+
* autres que lui n'y entrent plus, jusqu'à ce que la limite remonte.
|
|
28
|
+
*/
|
|
29
|
+
planPaused: z.boolean(),
|
|
30
|
+
/** Les membres que l'offre du propriétaire tient dehors, les derniers arrivés d'abord. */
|
|
31
|
+
pausedMemberIds: z.array(z.number().int().positive())
|
|
25
32
|
});
|
|
26
33
|
|
|
27
34
|
export type Workspace = z.infer<typeof workspaceSchema>;
|
package/src/features/user.ts
CHANGED
|
@@ -110,17 +110,38 @@ export const accountPlanSchema = z.object({
|
|
|
110
110
|
id: z.string(),
|
|
111
111
|
label: z.string(),
|
|
112
112
|
limits: z.record(z.string(), z.number().int().nonnegative()),
|
|
113
|
-
trialEndsAt: z.number().int().nonnegative().optional()
|
|
113
|
+
trialEndsAt: z.number().int().nonnegative().optional(),
|
|
114
|
+
changesAt: z.number().int().nonnegative().optional()
|
|
114
115
|
});
|
|
115
116
|
|
|
116
|
-
/**
|
|
117
|
+
/**
|
|
118
|
+
* The caller's plan. `null`: this DevEye has no plan provider, everything is
|
|
119
|
+
* unlimited. `paused`: how many of the caller's items the plan holds paused,
|
|
120
|
+
* by `<featureId>.<quotaKey>`, only the keys that have some.
|
|
121
|
+
*/
|
|
117
122
|
export const userPlan = {
|
|
118
123
|
command: 'user.plan' as const,
|
|
119
124
|
input: z.object({}),
|
|
120
|
-
output: z.object({
|
|
125
|
+
output: z.object({
|
|
126
|
+
plan: accountPlanSchema.nullable(),
|
|
127
|
+
paused: z.record(z.string(), z.number().int().positive())
|
|
128
|
+
})
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Deletes the caller's account with everything it owns: the personal workspace,
|
|
133
|
+
* the shared workspaces it owns and their content. Modules are told first
|
|
134
|
+
* (`FeatureService.onAccountDeleted`), so a subscription ends with the account.
|
|
135
|
+
* The password is asked again: the session alone is not enough for this.
|
|
136
|
+
*/
|
|
137
|
+
export const userDeleteAccount = {
|
|
138
|
+
command: 'user.deleteAccount' as const,
|
|
139
|
+
input: z.object({ password: z.string().min(1).max(512) }),
|
|
140
|
+
output: z.object({ ok: z.literal(true) })
|
|
121
141
|
};
|
|
122
142
|
|
|
123
143
|
export const userCommands = [
|
|
144
|
+
userDeleteAccount,
|
|
124
145
|
userPlan,
|
|
125
146
|
userSetAvatar,
|
|
126
147
|
userSetTheme,
|
package/src/http/auth.ts
CHANGED
|
@@ -30,6 +30,8 @@ export const sessionBundleSchema = z.object({
|
|
|
30
30
|
* avant son premier rendu, pour ne pas faire clignoter le bouton.
|
|
31
31
|
*/
|
|
32
32
|
feedbackEnabled: z.boolean(),
|
|
33
|
+
/** The marketing site (`SITE_URL`), for the legal links. `null`: none. */
|
|
34
|
+
siteUrl: z.string().url().nullable(),
|
|
33
35
|
/**
|
|
34
36
|
* Admin only: the process booted with `MAINTENANCE=1` and no admin has
|
|
35
37
|
* closed the reminder. Shown once the site maintenance is lifted. Read at
|
|
@@ -139,7 +141,12 @@ export type MeResponse = z.infer<typeof meResponseSchema>;
|
|
|
139
141
|
*/
|
|
140
142
|
export const signupAvailabilitySchema = z.object({
|
|
141
143
|
/** Can an account be self-created here: the server allows it, or no account exists yet. */
|
|
142
|
-
open: z.boolean()
|
|
144
|
+
open: z.boolean(),
|
|
145
|
+
/**
|
|
146
|
+
* The marketing site of this DevEye (`SITE_URL`), where its legal pages
|
|
147
|
+
* live. `null` on a self-hosted instance without one: no terms to accept.
|
|
148
|
+
*/
|
|
149
|
+
siteUrl: z.string().url().nullable()
|
|
143
150
|
});
|
|
144
151
|
|
|
145
152
|
export type SignupAvailability = z.infer<typeof signupAvailabilitySchema>;
|
|
@@ -151,7 +158,9 @@ export const signupStartRequestSchema = z.object({
|
|
|
151
158
|
plan: z
|
|
152
159
|
.string()
|
|
153
160
|
.regex(/^[a-z0-9_-]{1,64}$/)
|
|
154
|
-
.optional()
|
|
161
|
+
.optional(),
|
|
162
|
+
/** The terms of use and privacy policy were accepted. Required when the server has a `siteUrl`. */
|
|
163
|
+
termsAccepted: z.boolean()
|
|
155
164
|
});
|
|
156
165
|
|
|
157
166
|
export type SignupStartRequest = z.infer<typeof signupStartRequestSchema>;
|
package/src/http/status.ts
CHANGED
|
@@ -41,3 +41,29 @@ export const serverStatusSchema = z.object({
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
export type ServerStatus = z.infer<typeof serverStatusSchema>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* `GET /.well-known/deveye-build.json`: every file of the web client this
|
|
47
|
+
* server serves, with its SHA-256, written at build time. It is NOT a trusted
|
|
48
|
+
* reference (a compromised server would rewrite it along with the files): it
|
|
49
|
+
* is the LIST of what an integrity monitor on another instance must fetch,
|
|
50
|
+
* lazily loaded chunks included, which nothing else names.
|
|
51
|
+
*/
|
|
52
|
+
export const buildManifestSchema = z.object({
|
|
53
|
+
format: z.literal(1),
|
|
54
|
+
version: z.string(),
|
|
55
|
+
/** Path relative to the site root (no leading slash) to the file's SHA-256, hex. */
|
|
56
|
+
files: z.record(
|
|
57
|
+
z
|
|
58
|
+
.string()
|
|
59
|
+
.min(1)
|
|
60
|
+
.max(512)
|
|
61
|
+
.regex(/^(?!\/)(?!.*(^|\/)\.\.(\/|$))[^\s]+$/),
|
|
62
|
+
z.string().regex(/^[0-9a-f]{64}$/)
|
|
63
|
+
)
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export type BuildManifest = z.infer<typeof buildManifestSchema>;
|
|
67
|
+
|
|
68
|
+
/** Where a DevEye instance publishes its build manifest. */
|
|
69
|
+
export const BUILD_MANIFEST_PATH = '/.well-known/deveye-build.json';
|
package/src/index.ts
CHANGED
|
@@ -15,6 +15,12 @@ export {
|
|
|
15
15
|
AGENT_DESTROYED,
|
|
16
16
|
AGENT_ERROR,
|
|
17
17
|
AGENT_FILES_ANALYZE,
|
|
18
|
+
AGENT_FILES_ARCHIVE,
|
|
19
|
+
AGENT_FILES_ARCHIVE_CANCEL,
|
|
20
|
+
AGENT_FILES_ARCHIVE_CHUNK,
|
|
21
|
+
AGENT_FILES_ARCHIVE_CREDIT,
|
|
22
|
+
AGENT_FILES_ARCHIVE_END,
|
|
23
|
+
AGENT_FILES_ARCHIVE_PROGRESS,
|
|
18
24
|
AGENT_FILES_CHUNK,
|
|
19
25
|
AGENT_FILES_DOWNLOAD,
|
|
20
26
|
AGENT_FILES_LIST,
|
|
@@ -25,6 +31,7 @@ export {
|
|
|
25
31
|
AGENT_FILES_SEARCH,
|
|
26
32
|
AGENT_FILES_UPLOAD,
|
|
27
33
|
AGENT_FILES_USAGE,
|
|
34
|
+
AGENT_FOLDER_ARCHIVE_PROBE,
|
|
28
35
|
AGENT_HELLO,
|
|
29
36
|
AGENT_INTEGRITY,
|
|
30
37
|
AGENT_LIFECYCLE,
|
|
@@ -77,6 +84,12 @@ export {
|
|
|
77
84
|
agentConfigPayloadSchema,
|
|
78
85
|
agentDestroyedMessagePayloadSchema,
|
|
79
86
|
agentFilesAnalyzePayloadSchema,
|
|
87
|
+
agentFilesArchiveCancelPayloadSchema,
|
|
88
|
+
agentFilesArchiveChunkPayloadSchema,
|
|
89
|
+
agentFilesArchiveCreditPayloadSchema,
|
|
90
|
+
agentFilesArchiveEndPayloadSchema,
|
|
91
|
+
agentFilesArchivePayloadSchema,
|
|
92
|
+
agentFilesArchiveProgressPayloadSchema,
|
|
80
93
|
agentFilesChunkPayloadSchema,
|
|
81
94
|
agentFilesDownloadPayloadSchema,
|
|
82
95
|
agentFilesListPayloadSchema,
|
|
@@ -196,6 +209,12 @@ export type {
|
|
|
196
209
|
AgentTokenRotatePayload,
|
|
197
210
|
OrderSignature,
|
|
198
211
|
AgentFilesAnalyzePayload,
|
|
212
|
+
AgentFilesArchiveCancelPayload,
|
|
213
|
+
AgentFilesArchiveChunkPayload,
|
|
214
|
+
AgentFilesArchiveCreditPayload,
|
|
215
|
+
AgentFilesArchiveEndPayload,
|
|
216
|
+
AgentFilesArchivePayload,
|
|
217
|
+
AgentFilesArchiveProgressPayload,
|
|
199
218
|
AgentFilesDownloadPayload,
|
|
200
219
|
AgentFilesListPayload,
|
|
201
220
|
AgentFilesMutatePayload,
|
|
@@ -356,24 +375,29 @@ export {
|
|
|
356
375
|
SYNC_CHUNK_MAX,
|
|
357
376
|
SYNC_FINGERPRINT_SEP,
|
|
358
377
|
SYNC_INDEX_BATCH_MAX,
|
|
359
|
-
SYNC_PATTERN_MAX,
|
|
360
378
|
SYNC_REL_PATH_MAX,
|
|
361
379
|
SYNC_STORAGE_PATH_MAX,
|
|
362
380
|
syncDirectionSchema,
|
|
363
381
|
syncEntryKindSchema,
|
|
364
|
-
syncExclusionKindSchema,
|
|
365
382
|
syncIndexFingerprintSchema,
|
|
366
383
|
syncScanModeSchema,
|
|
367
384
|
syncSessionStateSchema,
|
|
368
385
|
syncShareStatusSchema
|
|
369
386
|
} from './domain/syncProtocol';
|
|
387
|
+
export {
|
|
388
|
+
PATH_EXCLUSION_PATTERN_MAX,
|
|
389
|
+
PATH_EXCLUSION_SUGGESTIONS,
|
|
390
|
+
pathExclusionKindSchema,
|
|
391
|
+
pathExclusionProblem,
|
|
392
|
+
pathExclusionSchema
|
|
393
|
+
} from './domain/pathExclusions';
|
|
394
|
+
export type { PathExclusion, PathExclusionKind } from './domain/pathExclusions';
|
|
370
395
|
export type {
|
|
371
396
|
CloudSyncProgress,
|
|
372
397
|
CloudSyncShareState,
|
|
373
398
|
CloudSyncShareStats,
|
|
374
399
|
SyncDirection,
|
|
375
400
|
SyncEntryKind,
|
|
376
|
-
SyncExclusionKind,
|
|
377
401
|
SyncScanMode,
|
|
378
402
|
SyncSessionState,
|
|
379
403
|
SyncShareStatus
|
|
@@ -841,6 +865,7 @@ export {
|
|
|
841
865
|
themeStateSchema,
|
|
842
866
|
accountPlanSchema,
|
|
843
867
|
userCommands,
|
|
868
|
+
userDeleteAccount,
|
|
844
869
|
userPlan,
|
|
845
870
|
userSetAvatar,
|
|
846
871
|
userSetColor,
|
|
@@ -1008,7 +1033,13 @@ export type {
|
|
|
1008
1033
|
LinkCodesListResponse,
|
|
1009
1034
|
LinkCodeUpdate
|
|
1010
1035
|
} from './http/device';
|
|
1011
|
-
export {
|
|
1012
|
-
|
|
1036
|
+
export {
|
|
1037
|
+
BUILD_MANIFEST_PATH,
|
|
1038
|
+
bootTaskSchema,
|
|
1039
|
+
bootTaskStateSchema,
|
|
1040
|
+
buildManifestSchema,
|
|
1041
|
+
serverStatusSchema
|
|
1042
|
+
} from './http/status';
|
|
1043
|
+
export type { BootTask, BootTaskState, BuildManifest, ServerStatus } from './http/status';
|
|
1013
1044
|
|
|
1014
1045
|
export { compareVersions, isNewerVersion } from './utils/version';
|