@deveye/types 0.18.3 → 0.19.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/device.ts +6 -2
- package/src/domain/featureRegistry.ts +16 -0
- package/src/domain/home.ts +5 -3
- package/src/domain/live.ts +3 -3
- package/src/domain/project.ts +56 -0
- package/src/domain/remoteInstance.test.ts +35 -0
- package/src/domain/remoteInstance.ts +70 -0
- package/src/domain/report.ts +34 -2
- package/src/domain/secrecy.ts +3 -0
- package/src/domain/sharing.ts +46 -1
- package/src/domain/twoFactor.ts +7 -3
- package/src/domain/workspace.ts +1 -1
- package/src/domain/workspaceRole.ts +1 -1
- package/src/features/admin.ts +1 -51
- package/src/features/home.ts +1 -1
- package/src/features/links.ts +37 -0
- package/src/features/registry.ts +4 -0
- package/src/features/remote.ts +52 -0
- package/src/features/secrecy.ts +22 -8
- package/src/features/sharing.ts +78 -2
- package/src/features/twoFactor.ts +1 -1
- package/src/features/user.ts +32 -4
- package/src/features/workspace.ts +2 -2
- package/src/http/auth.ts +113 -15
- package/src/http/device.ts +14 -10
- package/src/http/status.ts +2 -0
- package/src/index.ts +89 -12
- package/src/protocol/agent.ts +38 -0
- package/src/protocol/error.ts +3 -0
- package/src/sdk/client-ambient.d.ts +60 -5
- package/src/sdk/client.ts +81 -3
- package/src/sdk/copy.test.ts +374 -0
- package/src/sdk/copy.ts +435 -0
- package/src/sdk/manifest.test.ts +27 -0
- package/src/sdk/manifest.ts +60 -1
- package/src/sdk/providers.ts +102 -0
- package/src/sdk/server.ts +188 -10
- package/src/sdk/testing.test.ts +22 -0
- package/src/sdk/testing.ts +91 -2
package/src/index.ts
CHANGED
|
@@ -183,12 +183,18 @@ export {
|
|
|
183
183
|
packageListPushSchema,
|
|
184
184
|
packageProgressPushSchema,
|
|
185
185
|
packageStartedPushSchema,
|
|
186
|
+
AGENT_TOKEN_ROTATE,
|
|
187
|
+
agentTokenRotatePayloadSchema,
|
|
188
|
+
orderSignatureSchema,
|
|
189
|
+
SIGNED_AGENT_COMMANDS,
|
|
186
190
|
syncIndexEntrySchema,
|
|
187
191
|
syncShareAssignmentSchema
|
|
188
192
|
} from './protocol/agent';
|
|
189
193
|
export type {
|
|
190
194
|
AgentClientMessage,
|
|
191
195
|
AgentConfigPayload,
|
|
196
|
+
AgentTokenRotatePayload,
|
|
197
|
+
OrderSignature,
|
|
192
198
|
AgentFilesAnalyzePayload,
|
|
193
199
|
AgentFilesDownloadPayload,
|
|
194
200
|
AgentFilesListPayload,
|
|
@@ -386,8 +392,21 @@ export type {
|
|
|
386
392
|
FileSearchFilter,
|
|
387
393
|
FileUsageEntry
|
|
388
394
|
} from './domain/deviceFiles';
|
|
389
|
-
export {
|
|
390
|
-
|
|
395
|
+
export {
|
|
396
|
+
itemProjectGroupSchema,
|
|
397
|
+
itemProjectSchema,
|
|
398
|
+
itemProjectsBlockerSchema,
|
|
399
|
+
itemProjectsStateSchema,
|
|
400
|
+
projectStatusSchema,
|
|
401
|
+
PROJECT_STATUS_LABELS
|
|
402
|
+
} from './domain/project';
|
|
403
|
+
export type {
|
|
404
|
+
ItemProject,
|
|
405
|
+
ItemProjectGroup,
|
|
406
|
+
ItemProjectsBlocker,
|
|
407
|
+
ItemProjectsState,
|
|
408
|
+
ProjectStatus
|
|
409
|
+
} from './domain/project';
|
|
391
410
|
export { presenceEventSchema } from './domain/presence';
|
|
392
411
|
export type { PresenceEvent, PresenceRow } from './domain/presence';
|
|
393
412
|
export { userRoleSchema } from './domain/role';
|
|
@@ -506,6 +525,14 @@ export type {
|
|
|
506
525
|
export { secrecyStatusSchema, secrecyWrapModeSchema } from './domain/secrecy';
|
|
507
526
|
export type { SecrecyStatus, SecrecyWrapMode, UserSecretKeyRow } from './domain/secrecy';
|
|
508
527
|
export { workspaceKindSchema, workspaceSchema } from './domain/workspace';
|
|
528
|
+
export {
|
|
529
|
+
REMOTE_INSTANCES_MAX,
|
|
530
|
+
REMOTE_LABEL_MAX,
|
|
531
|
+
normalizeRemoteOrigin,
|
|
532
|
+
remoteInstanceSchema,
|
|
533
|
+
remoteOriginSchema
|
|
534
|
+
} from './domain/remoteInstance';
|
|
535
|
+
export type { RemoteInstance, RemoteInstanceRow } from './domain/remoteInstance';
|
|
509
536
|
export {
|
|
510
537
|
EXTERNAL_FEATURE_ID_PATTERN,
|
|
511
538
|
externalFeatureIdSchema,
|
|
@@ -553,6 +580,7 @@ export { packageManagerIdSchema, packageManagerSchema } from './domain/packages'
|
|
|
553
580
|
export type { PackageManager, PackageManagerId } from './domain/packages';
|
|
554
581
|
export {
|
|
555
582
|
agentInfoSchema,
|
|
583
|
+
agentPolicySchema,
|
|
556
584
|
agentServiceScopeSchema,
|
|
557
585
|
AUTH_LOGIN_LIMIT,
|
|
558
586
|
AUTH_SOURCE_LIMIT,
|
|
@@ -579,6 +607,7 @@ export {
|
|
|
579
607
|
} from './domain/report';
|
|
580
608
|
export type {
|
|
581
609
|
AgentInfo,
|
|
610
|
+
AgentPolicy,
|
|
582
611
|
AgentServiceScope,
|
|
583
612
|
AuthLogin,
|
|
584
613
|
AuthSource,
|
|
@@ -648,7 +677,12 @@ export {
|
|
|
648
677
|
itemExtraOverridesSchema,
|
|
649
678
|
itemGrantStateSchema,
|
|
650
679
|
itemMoveDependencySchema,
|
|
680
|
+
ITEM_COPY_CHUNK_CHARS,
|
|
681
|
+
itemCopyManifestSchema,
|
|
682
|
+
itemCopyPlanSchema,
|
|
683
|
+
itemCopyTargetSchema,
|
|
651
684
|
itemMovePreviewSchema,
|
|
685
|
+
itemTierSchema,
|
|
652
686
|
itemRefSchema,
|
|
653
687
|
itemRoleGrantSchema,
|
|
654
688
|
itemRoleGrantViewSchema,
|
|
@@ -662,6 +696,9 @@ export type {
|
|
|
662
696
|
ItemExtraOverrides,
|
|
663
697
|
ItemGrantState,
|
|
664
698
|
ItemMoveDependency,
|
|
699
|
+
ItemCopyManifest,
|
|
700
|
+
ItemCopyPlan,
|
|
701
|
+
ItemCopyTarget,
|
|
665
702
|
ItemMovePreview,
|
|
666
703
|
ItemRef,
|
|
667
704
|
ItemRoleGrant,
|
|
@@ -676,12 +713,24 @@ export {
|
|
|
676
713
|
itemGrantList,
|
|
677
714
|
itemGrantSet,
|
|
678
715
|
itemMove,
|
|
716
|
+
itemCopyBegin,
|
|
717
|
+
itemCopyChunk,
|
|
718
|
+
itemCopyCommit,
|
|
719
|
+
itemCopyExport,
|
|
720
|
+
itemCopyPlan,
|
|
721
|
+
itemCopyPut,
|
|
722
|
+
itemCopyTarget,
|
|
679
723
|
itemMovePreview,
|
|
680
724
|
shareGet,
|
|
681
725
|
shareSet,
|
|
682
726
|
sharingCommands
|
|
683
727
|
} from './features/sharing';
|
|
684
|
-
export {
|
|
728
|
+
export { linksCommands, projectLinksGet, projectLinksSet } from './features/links';
|
|
729
|
+
export {
|
|
730
|
+
PROJECT_LINKED_FEATURES,
|
|
731
|
+
SHAREABLE_FEATURES,
|
|
732
|
+
SHARE_WIRED_FEATURES
|
|
733
|
+
} from './domain/featureRegistry';
|
|
685
734
|
export {
|
|
686
735
|
DNS_RECORD_TYPES,
|
|
687
736
|
FEATURE_DOMAIN_HOST_MAX,
|
|
@@ -733,16 +782,12 @@ export type {
|
|
|
733
782
|
export {
|
|
734
783
|
adminCommands,
|
|
735
784
|
adminDeleteUser,
|
|
736
|
-
adminInviteCreate,
|
|
737
|
-
adminInviteList,
|
|
738
|
-
adminInviteRevoke,
|
|
739
|
-
adminInviteSchema,
|
|
740
785
|
adminSetUserRole,
|
|
741
786
|
adminSetUserStatus,
|
|
742
787
|
adminUserList,
|
|
743
788
|
adminUserSchema
|
|
744
789
|
} from './features/admin';
|
|
745
|
-
export type {
|
|
790
|
+
export type { AdminUser } from './features/admin';
|
|
746
791
|
export {
|
|
747
792
|
workspaceActivate,
|
|
748
793
|
workspaceAdd,
|
|
@@ -760,13 +805,23 @@ export {
|
|
|
760
805
|
workspaceRoleUpdate,
|
|
761
806
|
workspaceSetFavorite
|
|
762
807
|
} from './features/workspace';
|
|
808
|
+
export {
|
|
809
|
+
remoteAdd,
|
|
810
|
+
remoteCommands,
|
|
811
|
+
remoteList,
|
|
812
|
+
remoteRemove,
|
|
813
|
+
remoteRename,
|
|
814
|
+
remoteReorder
|
|
815
|
+
} from './features/remote';
|
|
763
816
|
export {
|
|
764
817
|
AVATAR_MAX_LENGTH,
|
|
765
818
|
THEME_IMAGE_MAX_LENGTH,
|
|
766
819
|
THEME_SLOT_COUNT,
|
|
767
820
|
THEME_SLOT_IMAGE_MAX_LENGTH,
|
|
768
821
|
themeStateSchema,
|
|
822
|
+
accountPlanSchema,
|
|
769
823
|
userCommands,
|
|
824
|
+
userPlan,
|
|
770
825
|
userSetAvatar,
|
|
771
826
|
userSetColor,
|
|
772
827
|
userSetSetting,
|
|
@@ -831,6 +886,7 @@ export {
|
|
|
831
886
|
secrecyHold,
|
|
832
887
|
secrecyLock,
|
|
833
888
|
secrecyRecover,
|
|
889
|
+
secrecyRegenerateRecovery,
|
|
834
890
|
secrecySetReauth,
|
|
835
891
|
secrecyStatus,
|
|
836
892
|
secrecyTouch,
|
|
@@ -865,10 +921,21 @@ export {
|
|
|
865
921
|
loginRequestSchema,
|
|
866
922
|
loginResponseSchema,
|
|
867
923
|
meResponseSchema,
|
|
924
|
+
passwordSchema,
|
|
925
|
+
refreshRequestSchema,
|
|
868
926
|
refreshResponseSchema,
|
|
869
|
-
registerRequestSchema,
|
|
870
927
|
sessionBundleSchema,
|
|
871
|
-
|
|
928
|
+
sessionTokensSchema,
|
|
929
|
+
signupAvailabilitySchema,
|
|
930
|
+
signupCompleteRequestSchema,
|
|
931
|
+
signupCompleteResponseSchema,
|
|
932
|
+
signupStartRequestSchema,
|
|
933
|
+
signupStartResponseSchema,
|
|
934
|
+
signupStatusSchema,
|
|
935
|
+
signupVerifyRequestSchema,
|
|
936
|
+
signupVerifyResponseSchema,
|
|
937
|
+
twoFactorChallengeRequestSchema,
|
|
938
|
+
wsTicketResponseSchema
|
|
872
939
|
} from './http/auth';
|
|
873
940
|
export type {
|
|
874
941
|
ChangePasswordRequest,
|
|
@@ -876,10 +943,20 @@ export type {
|
|
|
876
943
|
LoginRequest,
|
|
877
944
|
LoginResponse,
|
|
878
945
|
MeResponse,
|
|
946
|
+
RefreshRequest,
|
|
879
947
|
RefreshResponse,
|
|
880
|
-
RegisterRequest,
|
|
881
948
|
SessionBundle,
|
|
882
|
-
|
|
949
|
+
SessionTokens,
|
|
950
|
+
SignupAvailability,
|
|
951
|
+
SignupCompleteRequest,
|
|
952
|
+
SignupCompleteResponse,
|
|
953
|
+
SignupStartRequest,
|
|
954
|
+
SignupStartResponse,
|
|
955
|
+
SignupStatus,
|
|
956
|
+
SignupVerifyRequest,
|
|
957
|
+
SignupVerifyResponse,
|
|
958
|
+
TwoFactorChallengeRequest,
|
|
959
|
+
WsTicketResponse
|
|
883
960
|
} from './http/auth';
|
|
884
961
|
export {
|
|
885
962
|
AGENT_TARGETS,
|
package/src/protocol/agent.ts
CHANGED
|
@@ -580,6 +580,10 @@ export const AGENT_COLLECT = 'agent.collect' as const;
|
|
|
580
580
|
export const AGENT_SCAN = 'agent.scan' as const;
|
|
581
581
|
/** Push the per-device collection config (cadences + capture mode) to the agent. */
|
|
582
582
|
export const AGENT_CONFIG = 'agent.config' as const;
|
|
583
|
+
/** Server → agent: a fresh device token replacing the one about to expire; the agent persists it. */
|
|
584
|
+
export const AGENT_TOKEN_ROTATE = 'agent.tokenRotate' as const;
|
|
585
|
+
export const agentTokenRotatePayloadSchema = z.object({ token: z.string().min(1).max(4096) });
|
|
586
|
+
export type AgentTokenRotatePayload = z.infer<typeof agentTokenRotatePayloadSchema>;
|
|
583
587
|
/** Tell the agent to self-destruct (wipe its local config + binary) and exit. */
|
|
584
588
|
export const AGENT_DESTROY = 'agent.destroy' as const;
|
|
585
589
|
/** Tell the agent to download, verify and swap in a newer signed binary. */
|
|
@@ -1107,11 +1111,45 @@ export const agentServerMessageSchema = z.discriminatedUnion('command', [
|
|
|
1107
1111
|
z.object({
|
|
1108
1112
|
command: z.literal(AGENT_SYNC_DELETE),
|
|
1109
1113
|
payload: agentSyncDeletePayloadSchema
|
|
1114
|
+
}),
|
|
1115
|
+
z.object({
|
|
1116
|
+
command: z.literal(AGENT_TOKEN_ROTATE),
|
|
1117
|
+
payload: agentTokenRotatePayloadSchema
|
|
1110
1118
|
})
|
|
1111
1119
|
]);
|
|
1112
1120
|
|
|
1113
1121
|
export type AgentServerMessage = z.infer<typeof agentServerMessageSchema>;
|
|
1114
1122
|
|
|
1123
|
+
/**
|
|
1124
|
+
* Signature of a high-impact order, carried next to `command` and `payload` as
|
|
1125
|
+
* `sig`. Ed25519 over `command \n nonce \n issuedAt \n` followed by the exact
|
|
1126
|
+
* bytes of the payload as sent. The agent verifies it against the key pinned at
|
|
1127
|
+
* enrolment, refuses an `issuedAt` more than five minutes off, and refuses a
|
|
1128
|
+
* nonce it has already seen.
|
|
1129
|
+
*/
|
|
1130
|
+
export const orderSignatureSchema = z.object({
|
|
1131
|
+
nonce: z.string().length(32),
|
|
1132
|
+
issuedAt: z.number().int().positive(),
|
|
1133
|
+
signature: z.string().length(88)
|
|
1134
|
+
});
|
|
1135
|
+
export type OrderSignature = z.infer<typeof orderSignatureSchema>;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* The orders the server signs (`ORDER_SIGNING_KEY`) and the agent refuses
|
|
1139
|
+
* unsigned: what runs code, writes or deletes files, changes the agent's
|
|
1140
|
+
* privileges or its life. Mirror of `SIGNED_COMMANDS` in `agent/src/protocol.rs`.
|
|
1141
|
+
*/
|
|
1142
|
+
export const SIGNED_AGENT_COMMANDS: ReadonlySet<string> = new Set([
|
|
1143
|
+
AGENT_TERM_OPEN,
|
|
1144
|
+
AGENT_FILES_MUTATE,
|
|
1145
|
+
AGENT_FILES_UPLOAD,
|
|
1146
|
+
AGENT_SERVICE,
|
|
1147
|
+
AGENT_POWER,
|
|
1148
|
+
AGENT_DESTROY,
|
|
1149
|
+
AGENT_PKG_UPGRADE,
|
|
1150
|
+
AGENT_LIFECYCLE
|
|
1151
|
+
]);
|
|
1152
|
+
|
|
1115
1153
|
/**
|
|
1116
1154
|
* Server -> web client push events (no requestId), carried in the standard
|
|
1117
1155
|
* ServerMessage envelope. These constants name those unsolicited events.
|
package/src/protocol/error.ts
CHANGED
|
@@ -9,6 +9,9 @@ export const ErrorCodeSchema = z.enum([
|
|
|
9
9
|
'conflict',
|
|
10
10
|
'validation',
|
|
11
11
|
'rate_limited',
|
|
12
|
+
// The account's plan does not allow one more of what the command creates.
|
|
13
|
+
// `details` carries `{ feature, key, limit, plan }`.
|
|
14
|
+
'quota_exceeded',
|
|
12
15
|
'internal',
|
|
13
16
|
'unsupported_version',
|
|
14
17
|
// Password-based encryption is enabled but the session has not yet been
|
|
@@ -31,7 +31,7 @@ declare module 'deveye-sdk-client' {
|
|
|
31
31
|
User,
|
|
32
32
|
WorkspaceCapability
|
|
33
33
|
} from '@deveye/types';
|
|
34
|
-
import type { FeatureManifest, ManifestCommand } from '@deveye/types/sdk';
|
|
34
|
+
import type { AccountPlan, FeatureManifest, ManifestCommand } from '@deveye/types/sdk';
|
|
35
35
|
import type { SdkDeviceSummary } from '@deveye/types/sdk/client';
|
|
36
36
|
|
|
37
37
|
// ── UI kit ─────────────────────────────────────────────────────────────
|
|
@@ -73,6 +73,31 @@ declare module 'deveye-sdk-client' {
|
|
|
73
73
|
'aria-label'?: string;
|
|
74
74
|
disabled?: boolean;
|
|
75
75
|
}): ReactNode;
|
|
76
|
+
/**
|
|
77
|
+
* A single choice where each option explains itself: one card per option,
|
|
78
|
+
* label and consequences together. For two or three choices that commit
|
|
79
|
+
* the user; a harmless setting stays a `SegmentedControl`. A description
|
|
80
|
+
* may hold its own clickable elements without checking the card.
|
|
81
|
+
*/
|
|
82
|
+
export function ChoiceCards<T extends string>(props: {
|
|
83
|
+
value: T;
|
|
84
|
+
options: readonly {
|
|
85
|
+
value: T;
|
|
86
|
+
label: string;
|
|
87
|
+
description: ReactNode;
|
|
88
|
+
/** Icon class (`icon-lock`...), shown next to the label. */
|
|
89
|
+
icon?: string;
|
|
90
|
+
/** Why the option is not offered: makes it inert, shown under the description. */
|
|
91
|
+
unavailable?: ReactNode;
|
|
92
|
+
}[];
|
|
93
|
+
onChange: (value: T) => void;
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
/** The choice being applied: its card says so, the others wait. */
|
|
96
|
+
pending?: T | null;
|
|
97
|
+
/** A pointer click on a card, the current choice included: for a choice that advances a step. */
|
|
98
|
+
onPick?: (value: T) => void;
|
|
99
|
+
'aria-label'?: string;
|
|
100
|
+
}): ReactNode;
|
|
76
101
|
/**
|
|
77
102
|
* Le bouton d'enregistrement d'un panneau de réglages : « Enregistrement… »
|
|
78
103
|
* pendant l'aller-retour, « Enregistré » quelques secondes, puis l'intitulé
|
|
@@ -135,6 +160,15 @@ declare module 'deveye-sdk-client' {
|
|
|
135
160
|
body: ReactNode;
|
|
136
161
|
width?: number;
|
|
137
162
|
}): Promise<unknown>;
|
|
163
|
+
/** The technical terms the app's glossary defines. */
|
|
164
|
+
export type GlossaryTermId =
|
|
165
|
+
'zeroKnowledge' | 'encryption' | 'twoFactor' | 'webhook' | 'imap' | 'smtp' | 'proxy';
|
|
166
|
+
/**
|
|
167
|
+
* A technical term inside a sentence: reads like the surrounding text and
|
|
168
|
+
* opens its plain-language definition on click. `children` is the term as
|
|
169
|
+
* the sentence spells it; it defaults to the definition's title.
|
|
170
|
+
*/
|
|
171
|
+
export function Term(props: { id: GlossaryTermId; children?: ReactNode }): ReactNode;
|
|
138
172
|
/** Request the enclosing Dialog's guarded close (the unsaved-changes prompt included). */
|
|
139
173
|
export function useDialogClose(): () => void;
|
|
140
174
|
/** Register `fn` as the enclosing Dialog's primary action (Enter triggers it); `null` clears it. */
|
|
@@ -423,19 +457,40 @@ declare module 'deveye-sdk-client' {
|
|
|
423
457
|
/** Device paths as the agent reports them: Windows or POSIX, joined accordingly. */
|
|
424
458
|
export function isWinPath(p: string): boolean;
|
|
425
459
|
export function joinPath(base: string, name: string): string;
|
|
460
|
+
/**
|
|
461
|
+
* The `href` for a link whose address comes from data (a remote feed, another
|
|
462
|
+
* member's input, a probe): only http(s) and mailto come out, anything else is
|
|
463
|
+
* `undefined`. Use it on every `<a href>` you do not write yourself.
|
|
464
|
+
*/
|
|
465
|
+
export function safeHref(url: string | null | undefined): string | undefined;
|
|
426
466
|
/**
|
|
427
467
|
* The DevEye version this interface was built from: what an agent's
|
|
428
468
|
* reported version is compared against to offer a self-update.
|
|
429
469
|
*/
|
|
430
470
|
export const APP_VERSION: string;
|
|
431
471
|
/**
|
|
432
|
-
* A validated GET on one of the app's HTTP routes
|
|
433
|
-
*
|
|
472
|
+
* A validated GET on one of the app's HTTP routes, authenticated as the
|
|
473
|
+
* session is (an expired access token is renewed and the call replayed
|
|
434
474
|
* once). For the routes that stay HTTP because they serve binaries.
|
|
475
|
+
*
|
|
476
|
+
* Always pass a PATH, never an absolute URL: the active workspace may live
|
|
477
|
+
* on a remote DevEye instance, and the host routes the call there.
|
|
435
478
|
*/
|
|
436
479
|
export function httpGet<T>(path: string, outputSchema?: ZodType<T>): Promise<T>;
|
|
437
|
-
/**
|
|
438
|
-
|
|
480
|
+
/**
|
|
481
|
+
* A raw `fetch` on one of the app's HTTP routes, for a response that is not
|
|
482
|
+
* the usual JSON envelope (a binary to download). Same routing and
|
|
483
|
+
* authentication as {@link httpGet}; a bare `fetch('/api/...')` would reach
|
|
484
|
+
* the wrong server from a remote workspace.
|
|
485
|
+
*/
|
|
486
|
+
export function httpFetch(path: string, init?: RequestInit): Promise<Response>;
|
|
487
|
+
/**
|
|
488
|
+
* The account's plan, kept live. `null` while loading AND when this DevEye
|
|
489
|
+
* has no plan provider (everything unlimited): never read it as "free".
|
|
490
|
+
*/
|
|
491
|
+
export function useAccountPlan(): AccountPlan | null;
|
|
492
|
+
/** Opens an account view (`manifest.accountEntry`): the given module's, or the first one. No-op without any. */
|
|
493
|
+
export function openAccountView(featureId?: string): void;
|
|
439
494
|
export interface LiveOutlineProps {
|
|
440
495
|
'data-live-peer'?: true;
|
|
441
496
|
style?: CSSProperties;
|
package/src/sdk/client.ts
CHANGED
|
@@ -42,6 +42,15 @@ export interface FeatureViewProps {
|
|
|
42
42
|
closeFeature(): void;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/** Props of {@link FeatureClient.AccountView}. */
|
|
46
|
+
export interface AccountViewProps {
|
|
47
|
+
close(): void;
|
|
48
|
+
/** The viewer is a global administrator of this DevEye. */
|
|
49
|
+
isAdmin: boolean;
|
|
50
|
+
/** The hint a sign-up carried (`manifest.accountEntry.signupHint`), delivered once. */
|
|
51
|
+
hint?: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
/**
|
|
46
55
|
* Your package's `./client` export.
|
|
47
56
|
*/
|
|
@@ -51,9 +60,11 @@ export interface FeatureClient {
|
|
|
51
60
|
* data comes from `useResource`, so the card and the full view share one
|
|
52
61
|
* cache and refresh together.
|
|
53
62
|
*/
|
|
54
|
-
Widget
|
|
55
|
-
/** The full view, opened when the card expands. */
|
|
56
|
-
Full
|
|
63
|
+
Widget?: ComponentType;
|
|
64
|
+
/** The full view, opened when the card expands. Required with `Widget` unless `manifest.accountOnly`. */
|
|
65
|
+
Full?: ComponentType<FeatureViewProps>;
|
|
66
|
+
/** The view `manifest.accountEntry` opens from the user menu. */
|
|
67
|
+
AccountView?: ComponentType<AccountViewProps>;
|
|
57
68
|
/**
|
|
58
69
|
* The vignette shown on your card in the home grid's add market and on
|
|
59
70
|
* your "About" sheet. Without one, the host draws a neutral module mark:
|
|
@@ -102,6 +113,38 @@ export interface FeatureClient {
|
|
|
102
113
|
* Deliberately a subset of the module's own contract: what a linked-service
|
|
103
114
|
* block needs, and nothing the module may want to change later.
|
|
104
115
|
*/
|
|
116
|
+
/**
|
|
117
|
+
* One figure of a project's dashboard tile. The module formats it, the host only
|
|
118
|
+
* places it: neither has to know the other's vocabulary.
|
|
119
|
+
*/
|
|
120
|
+
export interface SdkTileMetric {
|
|
121
|
+
/** Stable key of the figure inside its tile, so the host never orders by accident. */
|
|
122
|
+
key: string;
|
|
123
|
+
label: string;
|
|
124
|
+
/** Already formatted by the module (« 1 240 », « 99,95 % », « il y a 3 h »). */
|
|
125
|
+
value: string;
|
|
126
|
+
/** What the theme must say of this value. Never a colour. */
|
|
127
|
+
tone?: 'neutral' | 'accent' | 'good' | 'warn' | 'bad';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* What a module answers about ONE of its items, for a dashboard tile. Always one
|
|
132
|
+
* entry per id asked for, so the host never has to guess which one is missing.
|
|
133
|
+
*/
|
|
134
|
+
export interface SdkTileSummary {
|
|
135
|
+
itemId: number;
|
|
136
|
+
/** The item's name; the host makes it the tile's heading. */
|
|
137
|
+
title: string;
|
|
138
|
+
/** Two or three figures, never more: a tile is not a screen. */
|
|
139
|
+
metrics: readonly SdkTileMetric[];
|
|
140
|
+
/**
|
|
141
|
+
* Why it cannot be measured, in one sentence (item gone, token revoked,
|
|
142
|
+
* monitoring off). The host shows it inside the tile and does NOT turn it
|
|
143
|
+
* into a screen error: a dashboard shows what it can.
|
|
144
|
+
*/
|
|
145
|
+
unavailable?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
105
148
|
export interface UptimeLinkedService {
|
|
106
149
|
id: number;
|
|
107
150
|
name: string;
|
|
@@ -160,6 +203,13 @@ export interface SdkDeviceSummary {
|
|
|
160
203
|
export interface UptimeClientProvider {
|
|
161
204
|
/** The workspace's services, as `uptime.list` returns them. */
|
|
162
205
|
listServices(): Promise<readonly UptimeLinkedService[]>;
|
|
206
|
+
/**
|
|
207
|
+
* The given services, summarised for a project's dashboard tile. ONE round
|
|
208
|
+
* trip whatever their number: a dashboard that opened one per tile would
|
|
209
|
+
* cost far more than the figures are worth. An id the caller cannot read,
|
|
210
|
+
* or that is gone, comes back `unavailable`, never as a throw.
|
|
211
|
+
*/
|
|
212
|
+
summarize(serviceIds: readonly number[]): Promise<readonly SdkTileSummary[]>;
|
|
163
213
|
/**
|
|
164
214
|
* A service's history for the strip. `stamp` is what re-reads it (pass
|
|
165
215
|
* `service.lastCheckedAt`); no timer.
|
|
@@ -215,6 +265,13 @@ export interface DatabaseLinkedCandidate {
|
|
|
215
265
|
export interface DatabaseClientProvider {
|
|
216
266
|
/** The workspace's databases, as `database.list` returns them. */
|
|
217
267
|
listDatabases(): Promise<readonly DatabaseLinkedCandidate[]>;
|
|
268
|
+
/**
|
|
269
|
+
* The given databases, summarised for a project's dashboard tile. ONE round
|
|
270
|
+
* trip whatever their number: a dashboard that opened one per tile would
|
|
271
|
+
* cost far more than the figures are worth. An id the caller cannot read,
|
|
272
|
+
* or that is gone, comes back `unavailable`, never as a throw.
|
|
273
|
+
*/
|
|
274
|
+
summarize(databaseIds: readonly number[]): Promise<readonly SdkTileSummary[]>;
|
|
218
275
|
/**
|
|
219
276
|
* A database linked to a project, shown in full: header (name, address,
|
|
220
277
|
* actions, its own settings button), state, alerts, table explorer. Loads
|
|
@@ -252,6 +309,13 @@ export interface DeployLinkedCandidate {
|
|
|
252
309
|
export interface DeployClientProvider {
|
|
253
310
|
/** The workspace's targets, as `deploy.list` returns them. */
|
|
254
311
|
listTargets(): Promise<readonly DeployLinkedCandidate[]>;
|
|
312
|
+
/**
|
|
313
|
+
* The given targets, summarised for a project's dashboard tile. ONE round
|
|
314
|
+
* trip whatever their number: a dashboard that opened one per tile would
|
|
315
|
+
* cost far more than the figures are worth. An id the caller cannot read,
|
|
316
|
+
* or that is gone, comes back `unavailable`, never as a throw.
|
|
317
|
+
*/
|
|
318
|
+
summarize(targetIds: readonly number[]): Promise<readonly SdkTileSummary[]>;
|
|
255
319
|
/**
|
|
256
320
|
* A target linked to a project, shown in full: identity, last deployment,
|
|
257
321
|
* trigger, its own settings button. Loads itself by `deploy.get`, follows
|
|
@@ -292,6 +356,13 @@ export interface GitLinkedCandidate {
|
|
|
292
356
|
export interface GitClientProvider {
|
|
293
357
|
/** The workspace's repositories, as `git.repoList` returns them. */
|
|
294
358
|
listRepos(): Promise<readonly GitLinkedCandidate[]>;
|
|
359
|
+
/**
|
|
360
|
+
* The given repositories, summarised for a project's dashboard tile. ONE round
|
|
361
|
+
* trip whatever their number: a dashboard that opened one per tile would
|
|
362
|
+
* cost far more than the figures are worth. An id the caller cannot read,
|
|
363
|
+
* or that is gone, comes back `unavailable`, never as a throw.
|
|
364
|
+
*/
|
|
365
|
+
summarize(repoIds: readonly number[]): Promise<readonly SdkTileSummary[]>;
|
|
295
366
|
/**
|
|
296
367
|
* A repository linked to a project, shown in full: header (name, sync
|
|
297
368
|
* state, actions, its own settings button), graph and panels. Loads
|
|
@@ -323,6 +394,13 @@ export interface AudienceLinkedCandidate {
|
|
|
323
394
|
export interface AudienceClientProvider {
|
|
324
395
|
/** The workspace's sites, as `audience.list` returns them. */
|
|
325
396
|
listSites(): Promise<readonly AudienceLinkedCandidate[]>;
|
|
397
|
+
/**
|
|
398
|
+
* The given sites, summarised for a project's dashboard tile. ONE round
|
|
399
|
+
* trip whatever their number: a dashboard that opened one per tile would
|
|
400
|
+
* cost far more than the figures are worth. An id the caller cannot read,
|
|
401
|
+
* or that is gone, comes back `unavailable`, never as a throw.
|
|
402
|
+
*/
|
|
403
|
+
summarize(siteIds: readonly number[]): Promise<readonly SdkTileSummary[]>;
|
|
326
404
|
/**
|
|
327
405
|
* A site linked to a project, shown in full: its sticky heading, actions
|
|
328
406
|
* (install, its own settings button), stats, funnels. Loads itself by
|