@deveye/types 0.20.1 → 0.20.3
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/device.ts +8 -13
- 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/device.ts +13 -27
- package/src/http/status.ts +26 -0
- package/src/index.ts +39 -9
- package/src/protocol/agent.ts +116 -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 +227 -24
- package/src/sdk/testing.test.ts +22 -1
- package/src/sdk/testing.ts +173 -19
package/src/index.ts
CHANGED
|
@@ -9,12 +9,19 @@ export type { ProtocolVersion } from './protocol/version';
|
|
|
9
9
|
export {
|
|
10
10
|
AGENT_ACK,
|
|
11
11
|
AGENT_AUTH_EVENTS,
|
|
12
|
+
AGENT_CLOSE_PENDING_APPROVAL,
|
|
12
13
|
AGENT_COLLECT,
|
|
13
14
|
AGENT_CONFIG,
|
|
14
15
|
AGENT_DESTROY,
|
|
15
16
|
AGENT_DESTROYED,
|
|
16
17
|
AGENT_ERROR,
|
|
17
18
|
AGENT_FILES_ANALYZE,
|
|
19
|
+
AGENT_FILES_ARCHIVE,
|
|
20
|
+
AGENT_FILES_ARCHIVE_CANCEL,
|
|
21
|
+
AGENT_FILES_ARCHIVE_CHUNK,
|
|
22
|
+
AGENT_FILES_ARCHIVE_CREDIT,
|
|
23
|
+
AGENT_FILES_ARCHIVE_END,
|
|
24
|
+
AGENT_FILES_ARCHIVE_PROGRESS,
|
|
18
25
|
AGENT_FILES_CHUNK,
|
|
19
26
|
AGENT_FILES_DOWNLOAD,
|
|
20
27
|
AGENT_FILES_LIST,
|
|
@@ -25,6 +32,7 @@ export {
|
|
|
25
32
|
AGENT_FILES_SEARCH,
|
|
26
33
|
AGENT_FILES_UPLOAD,
|
|
27
34
|
AGENT_FILES_USAGE,
|
|
35
|
+
AGENT_FOLDER_ARCHIVE_PROBE,
|
|
28
36
|
AGENT_HELLO,
|
|
29
37
|
AGENT_INTEGRITY,
|
|
30
38
|
AGENT_LIFECYCLE,
|
|
@@ -77,6 +85,12 @@ export {
|
|
|
77
85
|
agentConfigPayloadSchema,
|
|
78
86
|
agentDestroyedMessagePayloadSchema,
|
|
79
87
|
agentFilesAnalyzePayloadSchema,
|
|
88
|
+
agentFilesArchiveCancelPayloadSchema,
|
|
89
|
+
agentFilesArchiveChunkPayloadSchema,
|
|
90
|
+
agentFilesArchiveCreditPayloadSchema,
|
|
91
|
+
agentFilesArchiveEndPayloadSchema,
|
|
92
|
+
agentFilesArchivePayloadSchema,
|
|
93
|
+
agentFilesArchiveProgressPayloadSchema,
|
|
80
94
|
agentFilesChunkPayloadSchema,
|
|
81
95
|
agentFilesDownloadPayloadSchema,
|
|
82
96
|
agentFilesListPayloadSchema,
|
|
@@ -196,6 +210,12 @@ export type {
|
|
|
196
210
|
AgentTokenRotatePayload,
|
|
197
211
|
OrderSignature,
|
|
198
212
|
AgentFilesAnalyzePayload,
|
|
213
|
+
AgentFilesArchiveCancelPayload,
|
|
214
|
+
AgentFilesArchiveChunkPayload,
|
|
215
|
+
AgentFilesArchiveCreditPayload,
|
|
216
|
+
AgentFilesArchiveEndPayload,
|
|
217
|
+
AgentFilesArchivePayload,
|
|
218
|
+
AgentFilesArchiveProgressPayload,
|
|
199
219
|
AgentFilesDownloadPayload,
|
|
200
220
|
AgentFilesListPayload,
|
|
201
221
|
AgentFilesMutatePayload,
|
|
@@ -356,24 +376,29 @@ export {
|
|
|
356
376
|
SYNC_CHUNK_MAX,
|
|
357
377
|
SYNC_FINGERPRINT_SEP,
|
|
358
378
|
SYNC_INDEX_BATCH_MAX,
|
|
359
|
-
SYNC_PATTERN_MAX,
|
|
360
379
|
SYNC_REL_PATH_MAX,
|
|
361
380
|
SYNC_STORAGE_PATH_MAX,
|
|
362
381
|
syncDirectionSchema,
|
|
363
382
|
syncEntryKindSchema,
|
|
364
|
-
syncExclusionKindSchema,
|
|
365
383
|
syncIndexFingerprintSchema,
|
|
366
384
|
syncScanModeSchema,
|
|
367
385
|
syncSessionStateSchema,
|
|
368
386
|
syncShareStatusSchema
|
|
369
387
|
} from './domain/syncProtocol';
|
|
388
|
+
export {
|
|
389
|
+
PATH_EXCLUSION_PATTERN_MAX,
|
|
390
|
+
PATH_EXCLUSION_SUGGESTIONS,
|
|
391
|
+
pathExclusionKindSchema,
|
|
392
|
+
pathExclusionProblem,
|
|
393
|
+
pathExclusionSchema
|
|
394
|
+
} from './domain/pathExclusions';
|
|
395
|
+
export type { PathExclusion, PathExclusionKind } from './domain/pathExclusions';
|
|
370
396
|
export type {
|
|
371
397
|
CloudSyncProgress,
|
|
372
398
|
CloudSyncShareState,
|
|
373
399
|
CloudSyncShareStats,
|
|
374
400
|
SyncDirection,
|
|
375
401
|
SyncEntryKind,
|
|
376
|
-
SyncExclusionKind,
|
|
377
402
|
SyncScanMode,
|
|
378
403
|
SyncSessionState,
|
|
379
404
|
SyncShareStatus
|
|
@@ -841,6 +866,7 @@ export {
|
|
|
841
866
|
themeStateSchema,
|
|
842
867
|
accountPlanSchema,
|
|
843
868
|
userCommands,
|
|
869
|
+
userDeleteAccount,
|
|
844
870
|
userPlan,
|
|
845
871
|
userSetAvatar,
|
|
846
872
|
userSetColor,
|
|
@@ -990,8 +1016,7 @@ export {
|
|
|
990
1016
|
LINK_CODE_TTL_MAX_SECONDS,
|
|
991
1017
|
linkCodeRequestSchema,
|
|
992
1018
|
linkCodeResponseSchema,
|
|
993
|
-
linkCodesListResponseSchema
|
|
994
|
-
linkCodeUpdateSchema
|
|
1019
|
+
linkCodesListResponseSchema
|
|
995
1020
|
} from './http/device';
|
|
996
1021
|
export type {
|
|
997
1022
|
AgentManifest,
|
|
@@ -1005,10 +1030,15 @@ export type {
|
|
|
1005
1030
|
EnrollDeviceResponse,
|
|
1006
1031
|
LinkCodeRequest,
|
|
1007
1032
|
LinkCodeResponse,
|
|
1008
|
-
LinkCodesListResponse
|
|
1009
|
-
LinkCodeUpdate
|
|
1033
|
+
LinkCodesListResponse
|
|
1010
1034
|
} from './http/device';
|
|
1011
|
-
export {
|
|
1012
|
-
|
|
1035
|
+
export {
|
|
1036
|
+
BUILD_MANIFEST_PATH,
|
|
1037
|
+
bootTaskSchema,
|
|
1038
|
+
bootTaskStateSchema,
|
|
1039
|
+
buildManifestSchema,
|
|
1040
|
+
serverStatusSchema
|
|
1041
|
+
} from './http/status';
|
|
1042
|
+
export type { BootTask, BootTaskState, BuildManifest, ServerStatus } from './http/status';
|
|
1013
1043
|
|
|
1014
1044
|
export { compareVersions, isNewerVersion } from './utils/version';
|
package/src/protocol/agent.ts
CHANGED
|
@@ -5,15 +5,14 @@ import {
|
|
|
5
5
|
sha256HexSchema,
|
|
6
6
|
SYNC_CHUNK_MAX,
|
|
7
7
|
SYNC_INDEX_BATCH_MAX,
|
|
8
|
-
SYNC_PATTERN_MAX,
|
|
9
8
|
SYNC_REL_PATH_MAX,
|
|
10
9
|
SYNC_STORAGE_PATH_MAX,
|
|
11
10
|
syncEntryKindSchema,
|
|
12
|
-
syncExclusionKindSchema,
|
|
13
11
|
syncIndexFingerprintSchema,
|
|
14
12
|
syncScanModeSchema,
|
|
15
13
|
syncShareStatusSchema
|
|
16
14
|
} from '../domain/syncProtocol';
|
|
15
|
+
import { pathExclusionSchema } from '../domain/pathExclusions';
|
|
17
16
|
import {
|
|
18
17
|
fileListingSchema,
|
|
19
18
|
fileMatchSchema,
|
|
@@ -301,6 +300,51 @@ export const agentFilesChunkPayloadSchema = z.object({
|
|
|
301
300
|
error: z.string().max(500).optional()
|
|
302
301
|
});
|
|
303
302
|
|
|
303
|
+
/** Agent → server: one piece of a folder archive (`data` base64). Consumes one credit. */
|
|
304
|
+
export const AGENT_FILES_ARCHIVE_CHUNK = 'files.archiveChunk' as const;
|
|
305
|
+
export const agentFilesArchiveChunkPayloadSchema = z.object({
|
|
306
|
+
deviceId: z.uuid(),
|
|
307
|
+
opId: z.string().max(64),
|
|
308
|
+
/** 0, 1, 2… : a gap or a repeat fails the archive, frames are never reordered. */
|
|
309
|
+
seq: z.number().int().nonnegative(),
|
|
310
|
+
data: z.string().max(1_400_000)
|
|
311
|
+
});
|
|
312
|
+
export type AgentFilesArchiveChunkPayload = z.infer<typeof agentFilesArchiveChunkPayloadSchema>;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Agent → server: a sign of life while the archive has nothing to send yet
|
|
316
|
+
* (compression can take long to fill a piece). Consumes no credit.
|
|
317
|
+
*/
|
|
318
|
+
export const AGENT_FILES_ARCHIVE_PROGRESS = 'files.archiveProgress' as const;
|
|
319
|
+
export const agentFilesArchiveProgressPayloadSchema = z.object({
|
|
320
|
+
deviceId: z.uuid(),
|
|
321
|
+
opId: z.string().max(64),
|
|
322
|
+
entries: z.number().int().nonnegative(),
|
|
323
|
+
bytesRead: z.number().int().nonnegative()
|
|
324
|
+
});
|
|
325
|
+
export type AgentFilesArchiveProgressPayload = z.infer<
|
|
326
|
+
typeof agentFilesArchiveProgressPayloadSchema
|
|
327
|
+
>;
|
|
328
|
+
|
|
329
|
+
/** Agent → server: how a folder archive ended. The last frame of the operation. */
|
|
330
|
+
export const AGENT_FILES_ARCHIVE_END = 'files.archiveEnd' as const;
|
|
331
|
+
export const agentFilesArchiveEndPayloadSchema = z.object({
|
|
332
|
+
deviceId: z.uuid(),
|
|
333
|
+
opId: z.string().max(64),
|
|
334
|
+
ok: z.boolean(),
|
|
335
|
+
error: z.string().max(500).optional(),
|
|
336
|
+
files: z.number().int().nonnegative(),
|
|
337
|
+
dirs: z.number().int().nonnegative(),
|
|
338
|
+
bytesRead: z.number().int().nonnegative(),
|
|
339
|
+
/** Entries left out because they could not be read. */
|
|
340
|
+
skipped: z.number().int().nonnegative(),
|
|
341
|
+
/** Files whose size changed while they were read: archived padded or cut. */
|
|
342
|
+
changed: z.number().int().nonnegative(),
|
|
343
|
+
/** The first skipped or changed entries, and why. */
|
|
344
|
+
samples: z.array(z.object({ path: z.string().max(1024), reason: z.string().max(120) })).max(20)
|
|
345
|
+
});
|
|
346
|
+
export type AgentFilesArchiveEndPayload = z.infer<typeof agentFilesArchiveEndPayloadSchema>;
|
|
347
|
+
|
|
304
348
|
const syncOpId = z.string().min(1).max(64);
|
|
305
349
|
const syncRelPath = z.string().min(1).max(SYNC_REL_PATH_MAX);
|
|
306
350
|
|
|
@@ -543,6 +587,18 @@ export const agentClientMessageSchema = z.discriminatedUnion('command', [
|
|
|
543
587
|
command: z.literal(AGENT_FILES_CHUNK),
|
|
544
588
|
payload: agentFilesChunkPayloadSchema
|
|
545
589
|
}),
|
|
590
|
+
z.object({
|
|
591
|
+
command: z.literal(AGENT_FILES_ARCHIVE_CHUNK),
|
|
592
|
+
payload: agentFilesArchiveChunkPayloadSchema
|
|
593
|
+
}),
|
|
594
|
+
z.object({
|
|
595
|
+
command: z.literal(AGENT_FILES_ARCHIVE_PROGRESS),
|
|
596
|
+
payload: agentFilesArchiveProgressPayloadSchema
|
|
597
|
+
}),
|
|
598
|
+
z.object({
|
|
599
|
+
command: z.literal(AGENT_FILES_ARCHIVE_END),
|
|
600
|
+
payload: agentFilesArchiveEndPayloadSchema
|
|
601
|
+
}),
|
|
546
602
|
z.object({
|
|
547
603
|
command: z.literal(AGENT_SYNC_CHANGED),
|
|
548
604
|
payload: agentSyncChangedPayloadSchema
|
|
@@ -584,6 +640,14 @@ export const AGENT_CONFIG = 'agent.config' as const;
|
|
|
584
640
|
export const AGENT_TOKEN_ROTATE = 'agent.tokenRotate' as const;
|
|
585
641
|
export const agentTokenRotatePayloadSchema = z.object({ token: z.string().min(1).max(4096) });
|
|
586
642
|
export type AgentTokenRotatePayload = z.infer<typeof agentTokenRotatePayloadSchema>;
|
|
643
|
+
/**
|
|
644
|
+
* WebSocket close code for an authenticated agent whose device waits for
|
|
645
|
+
* approval: it retries on a short fixed delay instead of backing off like a
|
|
646
|
+
* refused one. Every refusal (unknown, invalid or archived) stays `1008`, so
|
|
647
|
+
* only a holder of a valid token learns the device is pending. Mirrored by
|
|
648
|
+
* `CLOSE_PENDING_APPROVAL` in the agent's `runner.rs`.
|
|
649
|
+
*/
|
|
650
|
+
export const AGENT_CLOSE_PENDING_APPROVAL = 4001;
|
|
587
651
|
/** Tell the agent to self-destruct (wipe its local config + binary) and exit. */
|
|
588
652
|
export const AGENT_DESTROY = 'agent.destroy' as const;
|
|
589
653
|
/** Tell the agent to download, verify and swap in a newer signed binary. */
|
|
@@ -768,6 +832,39 @@ export const agentFilesUploadPayloadSchema = z.object({
|
|
|
768
832
|
});
|
|
769
833
|
export type AgentFilesUploadPayload = z.infer<typeof agentFilesUploadPayloadSchema>;
|
|
770
834
|
|
|
835
|
+
/**
|
|
836
|
+
* Archive a folder as a `.tar.gz` built on the machine, streamed as
|
|
837
|
+
* `files.archiveChunk` frames, each spending one credit. The agent sends no
|
|
838
|
+
* more than the credits the server grants: memory on both sides stays bounded
|
|
839
|
+
* whatever the folder's size, and a slow destination slows the machine down.
|
|
840
|
+
*/
|
|
841
|
+
export const AGENT_FILES_ARCHIVE = 'files.archive' as const;
|
|
842
|
+
/** What an agent that knows `files.archive` declares in `report.agent.probes`. */
|
|
843
|
+
export const AGENT_FOLDER_ARCHIVE_PROBE = 'folderArchive';
|
|
844
|
+
export const agentFilesArchivePayloadSchema = z.object({
|
|
845
|
+
opId: filesOpId,
|
|
846
|
+
path: filesPath,
|
|
847
|
+
exclusions: z.array(pathExclusionSchema).max(200),
|
|
848
|
+
/** Do not descend into another filesystem (a network mount, a removable disk). */
|
|
849
|
+
oneFileSystem: z.boolean(),
|
|
850
|
+
/** Credits granted up front. */
|
|
851
|
+
window: z.number().int().min(1).max(64)
|
|
852
|
+
});
|
|
853
|
+
export type AgentFilesArchivePayload = z.infer<typeof agentFilesArchivePayloadSchema>;
|
|
854
|
+
|
|
855
|
+
/** More credits for a folder archive, as the server consumes its pieces. */
|
|
856
|
+
export const AGENT_FILES_ARCHIVE_CREDIT = 'files.archiveCredit' as const;
|
|
857
|
+
export const agentFilesArchiveCreditPayloadSchema = z.object({
|
|
858
|
+
opId: filesOpId,
|
|
859
|
+
credits: z.number().int().min(1).max(64)
|
|
860
|
+
});
|
|
861
|
+
export type AgentFilesArchiveCreditPayload = z.infer<typeof agentFilesArchiveCreditPayloadSchema>;
|
|
862
|
+
|
|
863
|
+
/** Stop a folder archive: the agent ends it with `files.archiveEnd` and an error. */
|
|
864
|
+
export const AGENT_FILES_ARCHIVE_CANCEL = 'files.archiveCancel' as const;
|
|
865
|
+
export const agentFilesArchiveCancelPayloadSchema = z.object({ opId: filesOpId });
|
|
866
|
+
export type AgentFilesArchiveCancelPayload = z.infer<typeof agentFilesArchiveCancelPayloadSchema>;
|
|
867
|
+
|
|
771
868
|
/**
|
|
772
869
|
* CloudSync, serveur → agent. Le serveur orchestre tout : l'agent reçoit ses
|
|
773
870
|
* assignations (`sync.config`), scanne sur ordre, transfère sur ordre.
|
|
@@ -779,12 +876,7 @@ export const syncShareAssignmentSchema = z.object({
|
|
|
779
876
|
localPath: z.string().min(1).max(SYNC_STORAGE_PATH_MAX),
|
|
780
877
|
/** `paused` = watcher coupé, scans refusés (pause partage OU appareil). */
|
|
781
878
|
status: syncShareStatusSchema,
|
|
782
|
-
exclusions: z.array(
|
|
783
|
-
z.object({
|
|
784
|
-
kind: syncExclusionKindSchema,
|
|
785
|
-
pattern: z.string().min(1).max(SYNC_PATTERN_MAX)
|
|
786
|
-
})
|
|
787
|
-
),
|
|
879
|
+
exclusions: z.array(pathExclusionSchema),
|
|
788
880
|
/**
|
|
789
881
|
* Plafond de débit des MONTÉES, en octets/s ; `null` = illimité. Le
|
|
790
882
|
* limiteur vit chez l'émetteur : l'agent pour les montées, le serveur pour
|
|
@@ -1092,6 +1184,18 @@ export const agentServerMessageSchema = z.discriminatedUnion('command', [
|
|
|
1092
1184
|
command: z.literal(AGENT_FILES_UPLOAD),
|
|
1093
1185
|
payload: agentFilesUploadPayloadSchema
|
|
1094
1186
|
}),
|
|
1187
|
+
z.object({
|
|
1188
|
+
command: z.literal(AGENT_FILES_ARCHIVE),
|
|
1189
|
+
payload: agentFilesArchivePayloadSchema
|
|
1190
|
+
}),
|
|
1191
|
+
z.object({
|
|
1192
|
+
command: z.literal(AGENT_FILES_ARCHIVE_CREDIT),
|
|
1193
|
+
payload: agentFilesArchiveCreditPayloadSchema
|
|
1194
|
+
}),
|
|
1195
|
+
z.object({
|
|
1196
|
+
command: z.literal(AGENT_FILES_ARCHIVE_CANCEL),
|
|
1197
|
+
payload: agentFilesArchiveCancelPayloadSchema
|
|
1198
|
+
}),
|
|
1095
1199
|
z.object({
|
|
1096
1200
|
command: z.literal(AGENT_SYNC_CONFIG),
|
|
1097
1201
|
payload: agentSyncConfigPayloadSchema
|
|
@@ -1137,7 +1241,8 @@ export type OrderSignature = z.infer<typeof orderSignatureSchema>;
|
|
|
1137
1241
|
/**
|
|
1138
1242
|
* The orders the server signs (`ORDER_SIGNING_KEY`) and the agent refuses
|
|
1139
1243
|
* unsigned: what runs code, writes or deletes files, changes the agent's
|
|
1140
|
-
* privileges or its life. Mirror of
|
|
1244
|
+
* privileges or its life, or drives its containers. Mirror of
|
|
1245
|
+
* `SIGNED_COMMANDS` in `agent/src/protocol.rs`.
|
|
1141
1246
|
*/
|
|
1142
1247
|
export const SIGNED_AGENT_COMMANDS: ReadonlySet<string> = new Set([
|
|
1143
1248
|
AGENT_TERM_OPEN,
|
|
@@ -1147,7 +1252,8 @@ export const SIGNED_AGENT_COMMANDS: ReadonlySet<string> = new Set([
|
|
|
1147
1252
|
AGENT_POWER,
|
|
1148
1253
|
AGENT_DESTROY,
|
|
1149
1254
|
AGENT_PKG_UPGRADE,
|
|
1150
|
-
AGENT_LIFECYCLE
|
|
1255
|
+
AGENT_LIFECYCLE,
|
|
1256
|
+
AGENT_DOCKER_ACTION
|
|
1151
1257
|
]);
|
|
1152
1258
|
|
|
1153
1259
|
/**
|
|
@@ -28,10 +28,17 @@ declare module 'deveye-sdk-client' {
|
|
|
28
28
|
FeatureDomain,
|
|
29
29
|
FeatureId,
|
|
30
30
|
MinimalUser,
|
|
31
|
+
PathExclusionKind,
|
|
31
32
|
User,
|
|
32
33
|
WorkspaceCapability
|
|
33
34
|
} from '@deveye/types';
|
|
34
|
-
import type {
|
|
35
|
+
import type {
|
|
36
|
+
AccountPlan,
|
|
37
|
+
FeatureManifest,
|
|
38
|
+
ManifestCommand,
|
|
39
|
+
PageTheme,
|
|
40
|
+
PageThemeChoice
|
|
41
|
+
} from '@deveye/types/sdk';
|
|
35
42
|
import type { SdkDeviceSummary } from '@deveye/types/sdk/client';
|
|
36
43
|
|
|
37
44
|
// ── UI kit ─────────────────────────────────────────────────────────────
|
|
@@ -85,17 +92,25 @@ declare module 'deveye-sdk-client' {
|
|
|
85
92
|
'aria-label'?: string;
|
|
86
93
|
className?: string;
|
|
87
94
|
}>;
|
|
88
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* One choice of a `SearchSelect`. `prefix` is decorative (a flag, an avatar);
|
|
97
|
+
* `keywords` widen what the search reads. Options sharing a `group` are
|
|
98
|
+
* listed together under that heading, groups in order of first appearance.
|
|
99
|
+
* A `disabled` option is shown but cannot be picked: say why in `detail`.
|
|
100
|
+
*/
|
|
89
101
|
export interface SearchSelectOption<T extends string = string> {
|
|
90
102
|
value: T;
|
|
91
103
|
label: string;
|
|
92
104
|
prefix?: ReactNode;
|
|
93
105
|
detail?: string;
|
|
94
106
|
keywords?: readonly string[];
|
|
107
|
+
group?: string;
|
|
108
|
+
disabled?: boolean;
|
|
95
109
|
}
|
|
96
110
|
/**
|
|
97
|
-
* A dropdown one can search in (accent- and case-insensitive
|
|
98
|
-
*
|
|
111
|
+
* A dropdown one can search in (accent- and case-insensitive, group names
|
|
112
|
+
* included), for a list too long to scan or sorted into groups:
|
|
113
|
+
* currencies, units, countries. Under ten ungrouped choices or so,
|
|
99
114
|
* `SelectInput` stays simpler. Safe inside a Dialog: the panel is portaled.
|
|
100
115
|
*/
|
|
101
116
|
export function SearchSelect<T extends string>(props: {
|
|
@@ -347,17 +362,29 @@ declare module 'deveye-sdk-client' {
|
|
|
347
362
|
hint: string;
|
|
348
363
|
/** A key is on file for this provider. */
|
|
349
364
|
held: boolean;
|
|
350
|
-
/**
|
|
351
|
-
|
|
365
|
+
/**
|
|
366
|
+
* Whether a key is wanted. `false` for a provider that needs none
|
|
367
|
+
* (Open-Meteo): shown, nothing to set. `'optional'` when the row works
|
|
368
|
+
* without one and a key only enriches it. Required by default.
|
|
369
|
+
*/
|
|
370
|
+
needsKey?: boolean | 'optional';
|
|
352
371
|
/** Where to get one. Only offered while no key is held. */
|
|
353
372
|
signupUrl?: string;
|
|
354
373
|
/** Icon class suffix, without the `icon-` prefix. */
|
|
355
374
|
icon?: string;
|
|
375
|
+
/** Who issues the key, when the row bears another name. Defaults to `label`. */
|
|
376
|
+
issuer?: string;
|
|
377
|
+
/** What the key changes, heading the dialog. Defaults to `hint`. */
|
|
378
|
+
keyHint?: string;
|
|
379
|
+
/** Pills after the name: a price tier, a scope. */
|
|
380
|
+
badges?: { label: string; tone?: 'neutral' | 'accent' | 'warning' }[];
|
|
381
|
+
/** Consecutive rows of the same group share a heading. */
|
|
382
|
+
group?: string;
|
|
356
383
|
}
|
|
357
384
|
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
385
|
+
* A fixed list of providers, each wanting one key (or none): the rows, the
|
|
386
|
+
* add/edit button on each, and the dialog. `onSave` / `onRemove` reject to
|
|
387
|
+
* keep the dialog open on the error.
|
|
361
388
|
*/
|
|
362
389
|
export const ProviderKeys: ComponentType<{
|
|
363
390
|
rows: ProviderKeyRow[];
|
|
@@ -563,6 +590,49 @@ declare module 'deveye-sdk-client' {
|
|
|
563
590
|
onPick: (path: string) => void;
|
|
564
591
|
/** What the folder is for, said by the caller. */
|
|
565
592
|
description?: string;
|
|
593
|
+
/** Offer to create a folder; false to pick what exists (what gets backed up). Default true. */
|
|
594
|
+
allowCreate?: boolean;
|
|
595
|
+
}>;
|
|
596
|
+
/**
|
|
597
|
+
* A path on a device: typed (a known path, an offline device) or picked by
|
|
598
|
+
* browsing its folders. The label stays the caller's, outside a `<label>`
|
|
599
|
+
* that would wrap the button: pass `id` for a `<label htmlFor>`, or
|
|
600
|
+
* `aria-label`. `action` is one more button at the end of the row.
|
|
601
|
+
*/
|
|
602
|
+
export const DeviceFolderField: ComponentType<{
|
|
603
|
+
/** The device to browse; without it, "Parcourir" stays disabled. */
|
|
604
|
+
device: { id: string; name: string } | null;
|
|
605
|
+
value: string;
|
|
606
|
+
onChange: (path: string) => void;
|
|
607
|
+
placeholder?: string;
|
|
608
|
+
id?: string;
|
|
609
|
+
'aria-label'?: string;
|
|
610
|
+
pickerDescription?: string;
|
|
611
|
+
allowCreate?: boolean;
|
|
612
|
+
disabled?: boolean;
|
|
613
|
+
action?: ReactNode;
|
|
614
|
+
}>;
|
|
615
|
+
/** One rule of a `PathExclusionsEditor`. */
|
|
616
|
+
export interface PathExclusionItem {
|
|
617
|
+
key: string | number;
|
|
618
|
+
kind: PathExclusionKind;
|
|
619
|
+
pattern: string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* The exclusions of a walked folder (a CloudSync share, a backed-up
|
|
623
|
+
* folder): exact path, component name or regex, relative to its root,
|
|
624
|
+
* validated the way the agent will run them. `onAdd` gets a rule already
|
|
625
|
+
* validated; `false` or a rejection keeps what was typed (say why where
|
|
626
|
+
* you show your errors). `scope` ends the suggestions' tooltip ("le
|
|
627
|
+
* partage", "le dossier").
|
|
628
|
+
*/
|
|
629
|
+
export const PathExclusionsEditor: ComponentType<{
|
|
630
|
+
items: readonly PathExclusionItem[];
|
|
631
|
+
onAdd: (kind: PathExclusionKind, pattern: string) => boolean | Promise<boolean>;
|
|
632
|
+
onRemove: (key: string | number) => void;
|
|
633
|
+
canWrite: boolean;
|
|
634
|
+
scope: string;
|
|
635
|
+
disabled?: boolean;
|
|
566
636
|
}>;
|
|
567
637
|
/**
|
|
568
638
|
* The workspace's enrolled devices, live: what the Devices module offers
|
|
@@ -627,6 +697,38 @@ declare module 'deveye-sdk-client' {
|
|
|
627
697
|
* has no plan provider (everything unlimited): never read it as "free".
|
|
628
698
|
*/
|
|
629
699
|
export function useAccountPlan(): AccountPlan | null;
|
|
700
|
+
/**
|
|
701
|
+
* How many of the account's items its plan holds paused, by
|
|
702
|
+
* `<featureId>.<quotaKey>`, only the keys that have some. Empty while
|
|
703
|
+
* loading and without a plan provider.
|
|
704
|
+
*/
|
|
705
|
+
export function usePlanPauses(): Readonly<Record<string, number>>;
|
|
706
|
+
/** The badge of an item its owner's plan holds paused (a `stock` quota). */
|
|
707
|
+
export const PlanPausedBadge: ComponentType<{ className?: string }>;
|
|
708
|
+
/**
|
|
709
|
+
* The notice above a list that holds items paused by the plan: how many,
|
|
710
|
+
* why, what still runs, and for the workspace owner the way to the plans.
|
|
711
|
+
* Renders nothing at 0. `one` and `many` name the item: "service
|
|
712
|
+
* surveillé", "services surveillés".
|
|
713
|
+
*/
|
|
714
|
+
export const PlanPausedNotice: ComponentType<{ count: number; one: string; many: string }>;
|
|
715
|
+
/**
|
|
716
|
+
* The look of a public page your module serves: its theme (`themes`, in
|
|
717
|
+
* that order; `auto` follows the visitor) and its accent (an account
|
|
718
|
+
* colour's name, a `#rrggbb`, or `''` for `ownAccent`, the page's own).
|
|
719
|
+
* `preview` renders under the fields: a miniature of your page in that
|
|
720
|
+
* look. Pair it with `pageAccentSchema` and `resolvePageAccent` from
|
|
721
|
+
* `@deveye/types/sdk`.
|
|
722
|
+
*/
|
|
723
|
+
export function PageLookFields<T extends PageThemeChoice>(props: {
|
|
724
|
+
theme: T;
|
|
725
|
+
accent: string;
|
|
726
|
+
themes: readonly T[];
|
|
727
|
+
ownAccent: Readonly<Record<PageTheme, string>>;
|
|
728
|
+
disabled?: boolean;
|
|
729
|
+
onChange: (next: { theme: T; accent: string }) => void;
|
|
730
|
+
preview?: ReactNode;
|
|
731
|
+
}): ReactNode;
|
|
630
732
|
/** Opens an account view (`manifest.accountEntry`): the given module's, or the first one. No-op without any. */
|
|
631
733
|
export function openAccountView(featureId?: string): void;
|
|
632
734
|
export interface LiveOutlineProps {
|
|
@@ -694,11 +796,17 @@ declare module 'deveye-sdk-client' {
|
|
|
694
796
|
* The client contract another module offers (`FeatureClient.providers`,
|
|
695
797
|
* keys in `@deveye/types/sdk`): how a module composes another's screens
|
|
696
798
|
* (Projects renders the linked items of Git, Uptime...). `undefined` when
|
|
697
|
-
* that module is not installed: degrade, never assume.
|
|
799
|
+
* that module is not installed: degrade, never assume. A feature in preview
|
|
800
|
+
* the current account does not see offers nothing either.
|
|
698
801
|
*/
|
|
699
802
|
export function moduleClientProvider<T>(key: string): T | undefined;
|
|
700
803
|
/** The signed-in user, `null` before the session answers. */
|
|
701
804
|
export function useCurrentUser(): User | null;
|
|
805
|
+
/**
|
|
806
|
+
* The features in preview the current account does not see (it is not an
|
|
807
|
+
* administrator): no tile, no link, no row that names them.
|
|
808
|
+
*/
|
|
809
|
+
export function useHiddenFeatures(): ReadonlySet<string>;
|
|
702
810
|
/** Image inputs accepted by `fileToSquareDataUrl`. */
|
|
703
811
|
export const ACCEPTED_TYPES: readonly string[];
|
|
704
812
|
export const MAX_INPUT_BYTES: number;
|
package/src/sdk/client.ts
CHANGED
|
@@ -150,6 +150,8 @@ export interface UptimeLinkedService {
|
|
|
150
150
|
name: string;
|
|
151
151
|
url: string;
|
|
152
152
|
enabled: boolean;
|
|
153
|
+
/** Its owner's plan holds it paused: nothing is measured until the limit rises. */
|
|
154
|
+
planPaused: boolean;
|
|
153
155
|
/** Projected here from another workspace. */
|
|
154
156
|
foreign?: boolean;
|
|
155
157
|
status: string;
|
|
@@ -297,7 +299,7 @@ export interface DeployLinkedCandidate {
|
|
|
297
299
|
name: string;
|
|
298
300
|
/** Projected here from another workspace. */
|
|
299
301
|
foreign?: boolean;
|
|
300
|
-
/**
|
|
302
|
+
/** Where the target lives, as the module labels it (« dokploy.example.com », « github.com/owner/repo »). */
|
|
301
303
|
host: string;
|
|
302
304
|
}
|
|
303
305
|
|
|
@@ -416,6 +418,22 @@ export interface AudienceClientProvider {
|
|
|
416
418
|
}>;
|
|
417
419
|
}
|
|
418
420
|
|
|
421
|
+
/**
|
|
422
|
+
* What the Invoicing module offers other screens under
|
|
423
|
+
* `INVOICING_CLIENT_PROVIDER`. It sends Invoicing's own command under the
|
|
424
|
+
* caller's session: the same rights, audit and "invoice settled" notice as a
|
|
425
|
+
* payment typed in Invoicing.
|
|
426
|
+
*/
|
|
427
|
+
export interface InvoicingClientProvider {
|
|
428
|
+
/** Records a bank transfer received on this invoice. Rejects as the command does (rights, overpayment). */
|
|
429
|
+
recordPayment(input: {
|
|
430
|
+
docId: number;
|
|
431
|
+
paidOn: string;
|
|
432
|
+
amountCents: number;
|
|
433
|
+
reference: string;
|
|
434
|
+
}): Promise<void>;
|
|
435
|
+
}
|
|
436
|
+
|
|
419
437
|
/**
|
|
420
438
|
* What the Mail module offers the host's screens under `MAIL_CLIENT_PROVIDER`:
|
|
421
439
|
* the ready senders (open tier, enabled) an email notification channel picks
|