@kjerneverk/riotplan-cloud 1.0.0-dev.0

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.
@@ -0,0 +1,179 @@
1
+ export declare function buildSyncDiff(remoteObjects: Record<string, RemoteObjectState>, manifestObjects: Record<string, SyncManifestObject> | undefined, localFiles: Set<string>): {
2
+ added: string[];
3
+ changed: string[];
4
+ unchanged: string[];
5
+ deletedLocal: string[];
6
+ };
7
+
8
+ export declare interface CloudRuntime extends CloudRuntimeDirectories {
9
+ enabled: boolean;
10
+ syncDown: (options?: {
11
+ forceRefresh?: boolean;
12
+ }) => Promise<{
13
+ plan: GcsSyncDownStats | null;
14
+ context: GcsSyncDownStats | null;
15
+ syncFreshHit: boolean;
16
+ coalescedWaiterCount: number;
17
+ }>;
18
+ syncUpPlans: () => Promise<GcsSyncUpStats | null>;
19
+ syncUpContext: () => Promise<GcsSyncUpStats | null>;
20
+ }
21
+
22
+ export declare interface CloudRuntimeConfig {
23
+ cloud?: CloudStorageConfig;
24
+ }
25
+
26
+ export declare interface CloudRuntimeDiagnostics {
27
+ debug?: (event: string, details?: Record<string, unknown>) => void;
28
+ }
29
+
30
+ export declare interface CloudRuntimeDirectories {
31
+ workingDirectory: string;
32
+ contextDirectory: string;
33
+ }
34
+
35
+ export declare interface CloudStorageConfig {
36
+ enabled?: boolean;
37
+ incrementalSyncEnabled?: boolean;
38
+ syncFreshnessTtlMs?: number;
39
+ syncTimeoutMs?: number;
40
+ planBucket?: string;
41
+ planPrefix?: string;
42
+ contextBucket?: string;
43
+ contextPrefix?: string;
44
+ projectId?: string;
45
+ keyFilename?: string;
46
+ credentialsJson?: string;
47
+ cacheDirectory?: string;
48
+ }
49
+
50
+ export declare function createCloudRuntime(config: CloudRuntimeConfig | null | undefined, localPlanDirectory: string, diagnostics?: CloudRuntimeDiagnostics): Promise<CloudRuntime>;
51
+
52
+ export declare interface GcsAuthConfig {
53
+ projectId?: string;
54
+ keyFilename?: string;
55
+ credentialsJson?: string;
56
+ }
57
+
58
+ export declare interface GcsBucketLocation {
59
+ bucket: string;
60
+ prefix?: string;
61
+ }
62
+
63
+ export declare class GcsMirror {
64
+ private readonly auth;
65
+ private readonly bucketName;
66
+ private readonly prefix;
67
+ private readonly localDirectory;
68
+ private readonly includeFile;
69
+ private readonly incrementalSyncEnabled;
70
+ private readonly onDebugEvent?;
71
+ constructor(options: {
72
+ auth: GcsAuthConfig;
73
+ location: GcsBucketLocation;
74
+ localDirectory: string;
75
+ includeFile?: (relativePath: string) => boolean;
76
+ incrementalSyncEnabled?: boolean;
77
+ onDebugEvent?: MirrorDebugEvent;
78
+ });
79
+ syncDown(): Promise<GcsSyncDownStats>;
80
+ syncUp(): Promise<GcsSyncUpStats>;
81
+ }
82
+
83
+ export declare interface GcsSyncDownStats {
84
+ bucket: string;
85
+ prefix: string;
86
+ localDirectory: string;
87
+ remoteListedCount: number;
88
+ remoteIncludedCount: number;
89
+ changedCount: number;
90
+ skippedUnchangedCount: number;
91
+ downloadedCount: number;
92
+ downloadedBytes: number;
93
+ localScannedCount: number;
94
+ removedCount: number;
95
+ elapsedMs: number;
96
+ phases: {
97
+ mkdirMs: number;
98
+ createClientMs: number;
99
+ listRemoteMs: number;
100
+ downloadMs: number;
101
+ listLocalMs: number;
102
+ cleanupMs: number;
103
+ };
104
+ }
105
+
106
+ export declare interface GcsSyncUpStats {
107
+ bucket: string;
108
+ prefix: string;
109
+ localDirectory: string;
110
+ localScannedCount: number;
111
+ localIncludedCount: number;
112
+ uploadedCount: number;
113
+ remoteListedCount: number;
114
+ removedRemoteCount: number;
115
+ elapsedMs: number;
116
+ phases: {
117
+ mkdirMs: number;
118
+ createClientMs: number;
119
+ listLocalMs: number;
120
+ uploadMs: number;
121
+ listRemoteMs: number;
122
+ cleanupMs: number;
123
+ };
124
+ }
125
+
126
+ export declare function loadSyncManifest(localDirectory: string): Promise<{
127
+ manifest: SyncManifest | null;
128
+ invalidated: boolean;
129
+ }>;
130
+
131
+ declare type MirrorDebugEvent = (event: string, details: Record<string, unknown>) => void;
132
+
133
+ export declare interface RemoteObjectState {
134
+ path: string;
135
+ generation?: string;
136
+ etag?: string;
137
+ md5Hash?: string;
138
+ size?: number;
139
+ updatedAt?: string;
140
+ }
141
+
142
+ export declare function runCoalescedOperation<T>(key: string, operation: () => Promise<T>, options?: {
143
+ timeoutMs?: number;
144
+ }): Promise<{
145
+ result: T;
146
+ coalesced: boolean;
147
+ waiterCount: number;
148
+ }>;
149
+
150
+ export declare function runDebouncedCoalescedOperation<T>(key: string, operation: () => Promise<T>, options?: {
151
+ debounceMs?: number;
152
+ timeoutMs?: number;
153
+ }): Promise<{
154
+ result: T;
155
+ coalesced: boolean;
156
+ waiterCount: number;
157
+ }>;
158
+
159
+ export declare interface SyncManifest {
160
+ version: number;
161
+ createdAt: string;
162
+ updatedAt: string;
163
+ objects: Record<string, SyncManifestObject>;
164
+ }
165
+
166
+ export declare interface SyncManifestObject {
167
+ path: string;
168
+ generation?: string;
169
+ etag?: string;
170
+ md5Hash?: string;
171
+ size?: number;
172
+ updatedAt?: string;
173
+ localPath: string;
174
+ lastSyncedAt: string;
175
+ }
176
+
177
+ export declare function writeSyncManifest(localDirectory: string, objects: Record<string, SyncManifestObject>): Promise<void>;
178
+
179
+ export { }