@vite-hub/workspace 0.4.1 → 0.5.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.
- package/README.md +62 -19
- package/dist/blob-database/postgres.d.ts +424 -0
- package/dist/blob-database/postgres.js +2 -0
- package/dist/blob-database-sources-DDZ1wV9w.js +9 -0
- package/dist/blob-database.d.ts +33 -447
- package/dist/blob-database.js +637 -208
- package/dist/checkout.js +1 -1
- package/dist/cloudflare.d.ts +1 -1
- package/dist/cloudflare.js +1 -1
- package/dist/{config-D1QENneP.js → config-DiyPi3Ff.js} +7 -7
- package/dist/{config-CDeGd0RB.d.ts → config-hxABr_Gg.d.ts} +1 -1
- package/dist/durability.d.ts +11 -2
- package/dist/durability.js +46 -4
- package/dist/{error-diagnostics-CQ4BUqRe.js → error-diagnostics-C0KyI408.js} +5 -1
- package/dist/{error-diagnostics-B5s9kNEA.js → error-diagnostics-Cth97txN.js} +10 -2
- package/dist/{path-uxLkzrZm.d.ts → errors-DXCZjdUU.d.ts} +0 -1
- package/dist/{file-CqG9zqiF.js → file-C1DYoGz3.js} +1 -1
- package/dist/{target-Dm9dHAVJ.js → file-metadata-Dv2JZwal.js} +1 -29
- package/dist/{files-B6wpAhEx.js → files-iHyik8jj.js} +2 -2
- package/dist/files.d.ts +13 -5
- package/dist/files.js +6 -5
- package/dist/{github-DKAlO0Vh.js → github-CFHl6RI0.js} +4 -4
- package/dist/{glob-BOqSKzSg.js → glob-BitxqDhb.js} +7 -7
- package/dist/{glob-Cjxms1t7.js → glob-Buxfvmyy.js} +1 -1
- package/dist/history-schema-BBWbpDk4.d.ts +436 -0
- package/dist/history-schema-postgres-U_ueRvmO.js +41 -0
- package/dist/{host-Bf1a2uo_.js → host-Dmr2Ctem.js} +150 -16
- package/dist/{hosted-zG7HJaE4.js → hosted-BktlvkF2.js} +20 -11
- package/dist/{hosted-vercel-blob-AbXG8fvR.js → hosted-vercel-blob-D0IPAjb1.js} +5 -5
- package/dist/hosted-vercel-blob.d.ts +1 -1
- package/dist/hosted-vercel-blob.js +1 -1
- package/dist/hosted.d.ts +1 -1
- package/dist/hosted.js +1 -1
- package/dist/index.d.ts +11 -23
- package/dist/index.js +28 -106
- package/dist/internal/workspace.d.ts +14 -0
- package/dist/internal/workspace.js +86 -0
- package/dist/{lifecycle-D8FdpBod.js → lifecycle-D6WN2dd_.js} +11 -8
- package/dist/loader.d.ts +1 -1
- package/dist/loader.js +2 -2
- package/dist/{mcp-resources-DntxtmDU.js → mcp-resources-TtxLNSL6.js} +1 -1
- package/dist/{memory-D5jq9HZW.js → memory-DjzwSng2.js} +16 -8
- package/dist/{metadata-target-DDoOQNp1.js → metadata-target-CR0aDtvS.js} +205 -60
- package/dist/{operation-definition-nmRu_O3V.d.ts → operation-definition-CI2PJGqu.d.ts} +8 -2
- package/dist/{operations-D8uCpzhM.js → operations-Cib30_dt.js} +5 -5
- package/dist/{operations-DsY2MQnG.js → operations-dtcU5LkD.js} +22 -7
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +1 -1
- package/dist/{path--wrT_Azm.js → path-BlIBpI7U.js} +1 -16
- package/dist/{plugins-CsrXCA1Q.d.ts → plugins-DKCBrH31.d.ts} +1 -1
- package/dist/{provider-sm9uzkLg.js → provider-Fc3M6bEx.js} +23 -10
- package/dist/providers/github/store.d.ts +1 -1
- package/dist/providers/github/store.js +1 -1
- package/dist/{registry-CwryP59t.d.ts → registry-CLL0TY0L.d.ts} +5 -3
- package/dist/{registry-DmVfUe4K.js → registry-CedQvQxW.js} +8 -3
- package/dist/{registry-CFl1Htyc.d.ts → registry-DpB5PBA4.d.ts} +5 -4
- package/dist/{request-scope-Dw5n8bMC.js → request-scope-Bcv2kD8h.js} +2 -1
- package/dist/rule-keys-Bsz6jTTF.js +19 -0
- package/dist/rules-OHaPFopX.js +269 -0
- package/dist/runtime/assets.d.ts +1 -1
- package/dist/runtime/assets.js +3 -3
- package/dist/runtime/empty-assets-registry.d.ts +1 -1
- package/dist/runtime/empty-registry.d.ts +2 -2
- package/dist/runtime/registry.d.ts +2 -2
- package/dist/runtime/request.js +1 -1
- package/dist/runtime/state.d.ts +5 -4
- package/dist/runtime/state.js +18 -6
- package/dist/runtime/workspace.d.ts +1 -1
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.d.ts +9 -8
- package/dist/runtime.js +23 -16
- package/dist/{search-C_RfoM2j.js → search-BqNV9LnO.js} +1 -1
- package/dist/{server-Cd4-iCh5.js → server-CFtrOPk6.js} +5 -5
- package/dist/server.d.ts +2 -2
- package/dist/server.js +1 -1
- package/dist/{shared-ovXVSV3-.js → shared-BgDjxY3J.js} +14 -3
- package/dist/source-metadata.d.ts +2 -2
- package/dist/source-metadata.js +3 -3
- package/dist/{state-C-YtsaiJ.d.ts → state-DBV6VHS6.d.ts} +13 -21
- package/dist/{store-NZoRto-Y.js → store-BRMdD8Ft.js} +37 -36
- package/dist/{sync-CrT8zjwc.js → sync-BezGVzrW.js} +4 -4
- package/dist/test.d.ts +1 -1
- package/dist/test.js +1 -1
- package/dist/{types-1Z-tKK3g.d.ts → types-9DMtFjaa.d.ts} +52 -4
- package/dist/{use-B0o5HoBl.js → use-Dm2tbI5F.js} +15 -15
- package/dist/{use-CjbF8EO9.d.ts → use-Dv973swc.d.ts} +20 -28
- package/dist/{state-Cb_hIyAw.js → use-tools-C1qvhzme.js} +4 -17
- package/dist/use-tools-CMUthOdy.d.ts +12 -0
- package/dist/{utils-Dw-WULEZ.js → utils-C0Au2R16.js} +77 -268
- package/dist/vite.d.ts +32 -3
- package/dist/vite.js +990 -1286
- package/dist/vitehub-grants-C8IAl5-M.js +38 -0
- package/dist/{workspace-DvKu5PRa.js → workspace-CFrwWhEm.js} +18 -17
- package/dist/{workspace-CIXgHeyX.d.ts → workspace-Cw4ycIW-.d.ts} +1 -1
- package/package.json +22 -12
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
//#region src/storage/history-schema.d.ts
|
|
2
|
+
interface HistoryManifestFile {
|
|
3
|
+
digest: string;
|
|
4
|
+
size: number;
|
|
5
|
+
mediaType: string;
|
|
6
|
+
metadata?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
/** Include these tables in a Database Definition and apply its migrations. */
|
|
9
|
+
declare const workspaceHistorySchema: {
|
|
10
|
+
workspaceHistoryWorkspaces: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
11
|
+
name: "workspace_history_workspaces";
|
|
12
|
+
schema: undefined;
|
|
13
|
+
columns: {
|
|
14
|
+
workspace: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
15
|
+
name: string;
|
|
16
|
+
tableName: "workspace_history_workspaces";
|
|
17
|
+
dataType: "string";
|
|
18
|
+
data: string;
|
|
19
|
+
driverParam: string;
|
|
20
|
+
notNull: true;
|
|
21
|
+
hasDefault: false;
|
|
22
|
+
isPrimaryKey: true;
|
|
23
|
+
isAutoincrement: false;
|
|
24
|
+
hasRuntimeDefault: false;
|
|
25
|
+
enumValues: [string, ...string[]];
|
|
26
|
+
baseColumn: never;
|
|
27
|
+
identity: undefined;
|
|
28
|
+
generated: undefined;
|
|
29
|
+
}, {}>;
|
|
30
|
+
deleted: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
31
|
+
name: string;
|
|
32
|
+
tableName: "workspace_history_workspaces";
|
|
33
|
+
dataType: "boolean";
|
|
34
|
+
data: boolean;
|
|
35
|
+
driverParam: number;
|
|
36
|
+
notNull: true;
|
|
37
|
+
hasDefault: true;
|
|
38
|
+
isPrimaryKey: false;
|
|
39
|
+
isAutoincrement: false;
|
|
40
|
+
hasRuntimeDefault: false;
|
|
41
|
+
enumValues: undefined;
|
|
42
|
+
baseColumn: never;
|
|
43
|
+
identity: undefined;
|
|
44
|
+
generated: undefined;
|
|
45
|
+
}, {}>;
|
|
46
|
+
};
|
|
47
|
+
dialect: "sqlite";
|
|
48
|
+
isAlias: false;
|
|
49
|
+
}>;
|
|
50
|
+
workspaceHistoryRefs: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
51
|
+
name: "workspace_history_refs";
|
|
52
|
+
schema: undefined;
|
|
53
|
+
columns: {
|
|
54
|
+
workspace: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
55
|
+
name: string;
|
|
56
|
+
tableName: "workspace_history_refs";
|
|
57
|
+
dataType: "string";
|
|
58
|
+
data: string;
|
|
59
|
+
driverParam: string;
|
|
60
|
+
notNull: true;
|
|
61
|
+
hasDefault: false;
|
|
62
|
+
isPrimaryKey: false;
|
|
63
|
+
isAutoincrement: false;
|
|
64
|
+
hasRuntimeDefault: false;
|
|
65
|
+
enumValues: [string, ...string[]];
|
|
66
|
+
baseColumn: never;
|
|
67
|
+
identity: undefined;
|
|
68
|
+
generated: undefined;
|
|
69
|
+
}, {}>;
|
|
70
|
+
ref: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
71
|
+
name: string;
|
|
72
|
+
tableName: "workspace_history_refs";
|
|
73
|
+
dataType: "string";
|
|
74
|
+
data: string;
|
|
75
|
+
driverParam: string;
|
|
76
|
+
notNull: true;
|
|
77
|
+
hasDefault: false;
|
|
78
|
+
isPrimaryKey: false;
|
|
79
|
+
isAutoincrement: false;
|
|
80
|
+
hasRuntimeDefault: false;
|
|
81
|
+
enumValues: [string, ...string[]];
|
|
82
|
+
baseColumn: never;
|
|
83
|
+
identity: undefined;
|
|
84
|
+
generated: undefined;
|
|
85
|
+
}, {}>;
|
|
86
|
+
head: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
87
|
+
name: string;
|
|
88
|
+
tableName: "workspace_history_refs";
|
|
89
|
+
dataType: "string";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: false;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}>;
|
|
102
|
+
sequence: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
103
|
+
name: string;
|
|
104
|
+
tableName: "workspace_history_refs";
|
|
105
|
+
dataType: "number int53";
|
|
106
|
+
data: number;
|
|
107
|
+
driverParam: number;
|
|
108
|
+
notNull: true;
|
|
109
|
+
hasDefault: true;
|
|
110
|
+
isPrimaryKey: false;
|
|
111
|
+
isAutoincrement: false;
|
|
112
|
+
hasRuntimeDefault: false;
|
|
113
|
+
enumValues: undefined;
|
|
114
|
+
baseColumn: never;
|
|
115
|
+
identity: undefined;
|
|
116
|
+
generated: undefined;
|
|
117
|
+
}, {}>;
|
|
118
|
+
};
|
|
119
|
+
dialect: "sqlite";
|
|
120
|
+
isAlias: false;
|
|
121
|
+
}>;
|
|
122
|
+
workspaceHistoryRevisions: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
123
|
+
name: "workspace_history_revisions";
|
|
124
|
+
schema: undefined;
|
|
125
|
+
columns: {
|
|
126
|
+
workspace: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
127
|
+
name: string;
|
|
128
|
+
tableName: "workspace_history_revisions";
|
|
129
|
+
dataType: "string";
|
|
130
|
+
data: string;
|
|
131
|
+
driverParam: string;
|
|
132
|
+
notNull: true;
|
|
133
|
+
hasDefault: false;
|
|
134
|
+
isPrimaryKey: false;
|
|
135
|
+
isAutoincrement: false;
|
|
136
|
+
hasRuntimeDefault: false;
|
|
137
|
+
enumValues: [string, ...string[]];
|
|
138
|
+
baseColumn: never;
|
|
139
|
+
identity: undefined;
|
|
140
|
+
generated: undefined;
|
|
141
|
+
}, {}>;
|
|
142
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
143
|
+
name: string;
|
|
144
|
+
tableName: "workspace_history_revisions";
|
|
145
|
+
dataType: "string";
|
|
146
|
+
data: string;
|
|
147
|
+
driverParam: string;
|
|
148
|
+
notNull: true;
|
|
149
|
+
hasDefault: false;
|
|
150
|
+
isPrimaryKey: false;
|
|
151
|
+
isAutoincrement: false;
|
|
152
|
+
hasRuntimeDefault: false;
|
|
153
|
+
enumValues: [string, ...string[]];
|
|
154
|
+
baseColumn: never;
|
|
155
|
+
identity: undefined;
|
|
156
|
+
generated: undefined;
|
|
157
|
+
}, {}>;
|
|
158
|
+
ref: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
159
|
+
name: string;
|
|
160
|
+
tableName: "workspace_history_revisions";
|
|
161
|
+
dataType: "string";
|
|
162
|
+
data: string;
|
|
163
|
+
driverParam: string;
|
|
164
|
+
notNull: true;
|
|
165
|
+
hasDefault: false;
|
|
166
|
+
isPrimaryKey: false;
|
|
167
|
+
isAutoincrement: false;
|
|
168
|
+
hasRuntimeDefault: false;
|
|
169
|
+
enumValues: [string, ...string[]];
|
|
170
|
+
baseColumn: never;
|
|
171
|
+
identity: undefined;
|
|
172
|
+
generated: undefined;
|
|
173
|
+
}, {}>;
|
|
174
|
+
parentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
175
|
+
name: string;
|
|
176
|
+
tableName: "workspace_history_revisions";
|
|
177
|
+
dataType: "string";
|
|
178
|
+
data: string;
|
|
179
|
+
driverParam: string;
|
|
180
|
+
notNull: false;
|
|
181
|
+
hasDefault: false;
|
|
182
|
+
isPrimaryKey: false;
|
|
183
|
+
isAutoincrement: false;
|
|
184
|
+
hasRuntimeDefault: false;
|
|
185
|
+
enumValues: [string, ...string[]];
|
|
186
|
+
baseColumn: never;
|
|
187
|
+
identity: undefined;
|
|
188
|
+
generated: undefined;
|
|
189
|
+
}, {}>;
|
|
190
|
+
sequence: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
191
|
+
name: string;
|
|
192
|
+
tableName: "workspace_history_revisions";
|
|
193
|
+
dataType: "number int53";
|
|
194
|
+
data: number;
|
|
195
|
+
driverParam: number;
|
|
196
|
+
notNull: true;
|
|
197
|
+
hasDefault: false;
|
|
198
|
+
isPrimaryKey: false;
|
|
199
|
+
isAutoincrement: false;
|
|
200
|
+
hasRuntimeDefault: false;
|
|
201
|
+
enumValues: undefined;
|
|
202
|
+
baseColumn: never;
|
|
203
|
+
identity: undefined;
|
|
204
|
+
generated: undefined;
|
|
205
|
+
}, {}>;
|
|
206
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
207
|
+
name: string;
|
|
208
|
+
tableName: "workspace_history_revisions";
|
|
209
|
+
dataType: "string";
|
|
210
|
+
data: string;
|
|
211
|
+
driverParam: string;
|
|
212
|
+
notNull: true;
|
|
213
|
+
hasDefault: false;
|
|
214
|
+
isPrimaryKey: false;
|
|
215
|
+
isAutoincrement: false;
|
|
216
|
+
hasRuntimeDefault: false;
|
|
217
|
+
enumValues: [string, ...string[]];
|
|
218
|
+
baseColumn: never;
|
|
219
|
+
identity: undefined;
|
|
220
|
+
generated: undefined;
|
|
221
|
+
}, {}>;
|
|
222
|
+
message: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
223
|
+
name: string;
|
|
224
|
+
tableName: "workspace_history_revisions";
|
|
225
|
+
dataType: "string";
|
|
226
|
+
data: string;
|
|
227
|
+
driverParam: string;
|
|
228
|
+
notNull: false;
|
|
229
|
+
hasDefault: false;
|
|
230
|
+
isPrimaryKey: false;
|
|
231
|
+
isAutoincrement: false;
|
|
232
|
+
hasRuntimeDefault: false;
|
|
233
|
+
enumValues: [string, ...string[]];
|
|
234
|
+
baseColumn: never;
|
|
235
|
+
identity: undefined;
|
|
236
|
+
generated: undefined;
|
|
237
|
+
}, {}>;
|
|
238
|
+
metadata: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
239
|
+
name: string;
|
|
240
|
+
tableName: "workspace_history_revisions";
|
|
241
|
+
dataType: "object json";
|
|
242
|
+
data: Record<string, unknown>;
|
|
243
|
+
driverParam: string;
|
|
244
|
+
notNull: false;
|
|
245
|
+
hasDefault: false;
|
|
246
|
+
isPrimaryKey: false;
|
|
247
|
+
isAutoincrement: false;
|
|
248
|
+
hasRuntimeDefault: false;
|
|
249
|
+
enumValues: undefined;
|
|
250
|
+
baseColumn: never;
|
|
251
|
+
identity: undefined;
|
|
252
|
+
generated: undefined;
|
|
253
|
+
}, {}>;
|
|
254
|
+
files: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
255
|
+
name: string;
|
|
256
|
+
tableName: "workspace_history_revisions";
|
|
257
|
+
dataType: "number int53";
|
|
258
|
+
data: number;
|
|
259
|
+
driverParam: number;
|
|
260
|
+
notNull: true;
|
|
261
|
+
hasDefault: false;
|
|
262
|
+
isPrimaryKey: false;
|
|
263
|
+
isAutoincrement: false;
|
|
264
|
+
hasRuntimeDefault: false;
|
|
265
|
+
enumValues: undefined;
|
|
266
|
+
baseColumn: never;
|
|
267
|
+
identity: undefined;
|
|
268
|
+
generated: undefined;
|
|
269
|
+
}, {}>;
|
|
270
|
+
bytes: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
271
|
+
name: string;
|
|
272
|
+
tableName: "workspace_history_revisions";
|
|
273
|
+
dataType: "number int53";
|
|
274
|
+
data: number;
|
|
275
|
+
driverParam: number;
|
|
276
|
+
notNull: true;
|
|
277
|
+
hasDefault: false;
|
|
278
|
+
isPrimaryKey: false;
|
|
279
|
+
isAutoincrement: false;
|
|
280
|
+
hasRuntimeDefault: false;
|
|
281
|
+
enumValues: undefined;
|
|
282
|
+
baseColumn: never;
|
|
283
|
+
identity: undefined;
|
|
284
|
+
generated: undefined;
|
|
285
|
+
}, {}>;
|
|
286
|
+
entries: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
287
|
+
name: string;
|
|
288
|
+
tableName: "workspace_history_revisions";
|
|
289
|
+
dataType: "object json";
|
|
290
|
+
data: Record<string, HistoryManifestFile>;
|
|
291
|
+
driverParam: string;
|
|
292
|
+
notNull: true;
|
|
293
|
+
hasDefault: false;
|
|
294
|
+
isPrimaryKey: false;
|
|
295
|
+
isAutoincrement: false;
|
|
296
|
+
hasRuntimeDefault: false;
|
|
297
|
+
enumValues: undefined;
|
|
298
|
+
baseColumn: never;
|
|
299
|
+
identity: undefined;
|
|
300
|
+
generated: undefined;
|
|
301
|
+
}, {}>;
|
|
302
|
+
committed: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
303
|
+
name: string;
|
|
304
|
+
tableName: "workspace_history_revisions";
|
|
305
|
+
dataType: "boolean";
|
|
306
|
+
data: boolean;
|
|
307
|
+
driverParam: number;
|
|
308
|
+
notNull: true;
|
|
309
|
+
hasDefault: true;
|
|
310
|
+
isPrimaryKey: false;
|
|
311
|
+
isAutoincrement: false;
|
|
312
|
+
hasRuntimeDefault: false;
|
|
313
|
+
enumValues: undefined;
|
|
314
|
+
baseColumn: never;
|
|
315
|
+
identity: undefined;
|
|
316
|
+
generated: undefined;
|
|
317
|
+
}, {}>;
|
|
318
|
+
};
|
|
319
|
+
dialect: "sqlite";
|
|
320
|
+
isAlias: false;
|
|
321
|
+
}>;
|
|
322
|
+
workspaceHistoryObjects: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
323
|
+
name: "workspace_history_objects";
|
|
324
|
+
schema: undefined;
|
|
325
|
+
columns: {
|
|
326
|
+
workspace: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
327
|
+
name: string;
|
|
328
|
+
tableName: "workspace_history_objects";
|
|
329
|
+
dataType: "string";
|
|
330
|
+
data: string;
|
|
331
|
+
driverParam: string;
|
|
332
|
+
notNull: true;
|
|
333
|
+
hasDefault: false;
|
|
334
|
+
isPrimaryKey: false;
|
|
335
|
+
isAutoincrement: false;
|
|
336
|
+
hasRuntimeDefault: false;
|
|
337
|
+
enumValues: [string, ...string[]];
|
|
338
|
+
baseColumn: never;
|
|
339
|
+
identity: undefined;
|
|
340
|
+
generated: undefined;
|
|
341
|
+
}, {}>;
|
|
342
|
+
digest: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
343
|
+
name: string;
|
|
344
|
+
tableName: "workspace_history_objects";
|
|
345
|
+
dataType: "string";
|
|
346
|
+
data: string;
|
|
347
|
+
driverParam: string;
|
|
348
|
+
notNull: true;
|
|
349
|
+
hasDefault: false;
|
|
350
|
+
isPrimaryKey: false;
|
|
351
|
+
isAutoincrement: false;
|
|
352
|
+
hasRuntimeDefault: false;
|
|
353
|
+
enumValues: [string, ...string[]];
|
|
354
|
+
baseColumn: never;
|
|
355
|
+
identity: undefined;
|
|
356
|
+
generated: undefined;
|
|
357
|
+
}, {}>;
|
|
358
|
+
size: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
359
|
+
name: string;
|
|
360
|
+
tableName: "workspace_history_objects";
|
|
361
|
+
dataType: "number int53";
|
|
362
|
+
data: number;
|
|
363
|
+
driverParam: number;
|
|
364
|
+
notNull: true;
|
|
365
|
+
hasDefault: false;
|
|
366
|
+
isPrimaryKey: false;
|
|
367
|
+
isAutoincrement: false;
|
|
368
|
+
hasRuntimeDefault: false;
|
|
369
|
+
enumValues: undefined;
|
|
370
|
+
baseColumn: never;
|
|
371
|
+
identity: undefined;
|
|
372
|
+
generated: undefined;
|
|
373
|
+
}, {}>;
|
|
374
|
+
};
|
|
375
|
+
dialect: "sqlite";
|
|
376
|
+
isAlias: false;
|
|
377
|
+
}>;
|
|
378
|
+
workspaceHistoryMetadata: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
379
|
+
name: "workspace_history_metadata";
|
|
380
|
+
schema: undefined;
|
|
381
|
+
columns: {
|
|
382
|
+
workspace: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
383
|
+
name: string;
|
|
384
|
+
tableName: "workspace_history_metadata";
|
|
385
|
+
dataType: "string";
|
|
386
|
+
data: string;
|
|
387
|
+
driverParam: string;
|
|
388
|
+
notNull: true;
|
|
389
|
+
hasDefault: false;
|
|
390
|
+
isPrimaryKey: false;
|
|
391
|
+
isAutoincrement: false;
|
|
392
|
+
hasRuntimeDefault: false;
|
|
393
|
+
enumValues: [string, ...string[]];
|
|
394
|
+
baseColumn: never;
|
|
395
|
+
identity: undefined;
|
|
396
|
+
generated: undefined;
|
|
397
|
+
}, {}>;
|
|
398
|
+
key: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
399
|
+
name: string;
|
|
400
|
+
tableName: "workspace_history_metadata";
|
|
401
|
+
dataType: "string";
|
|
402
|
+
data: string;
|
|
403
|
+
driverParam: string;
|
|
404
|
+
notNull: true;
|
|
405
|
+
hasDefault: false;
|
|
406
|
+
isPrimaryKey: false;
|
|
407
|
+
isAutoincrement: false;
|
|
408
|
+
hasRuntimeDefault: false;
|
|
409
|
+
enumValues: [string, ...string[]];
|
|
410
|
+
baseColumn: never;
|
|
411
|
+
identity: undefined;
|
|
412
|
+
generated: undefined;
|
|
413
|
+
}, {}>;
|
|
414
|
+
value: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
415
|
+
name: string;
|
|
416
|
+
tableName: "workspace_history_metadata";
|
|
417
|
+
dataType: "object json";
|
|
418
|
+
data: unknown;
|
|
419
|
+
driverParam: string;
|
|
420
|
+
notNull: true;
|
|
421
|
+
hasDefault: false;
|
|
422
|
+
isPrimaryKey: false;
|
|
423
|
+
isAutoincrement: false;
|
|
424
|
+
hasRuntimeDefault: false;
|
|
425
|
+
enumValues: undefined;
|
|
426
|
+
baseColumn: never;
|
|
427
|
+
identity: undefined;
|
|
428
|
+
generated: undefined;
|
|
429
|
+
}, {}>;
|
|
430
|
+
};
|
|
431
|
+
dialect: "sqlite";
|
|
432
|
+
isAlias: false;
|
|
433
|
+
}>;
|
|
434
|
+
};
|
|
435
|
+
//#endregion
|
|
436
|
+
export { workspaceHistorySchema as n, HistoryManifestFile as t };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { bigint, boolean, index, integer, json, jsonb, pgTable, primaryKey, text } from "drizzle-orm/pg-core";
|
|
2
|
+
/** Include these tables in a Postgres Database Definition and apply its migrations. */
|
|
3
|
+
const workspaceHistorySchema = {
|
|
4
|
+
workspaceHistoryWorkspaces: pgTable("workspace_history_workspaces", {
|
|
5
|
+
workspace: text("workspace").primaryKey(),
|
|
6
|
+
deleted: boolean("deleted").notNull().default(false)
|
|
7
|
+
}),
|
|
8
|
+
workspaceHistoryRefs: pgTable("workspace_history_refs", {
|
|
9
|
+
workspace: text("workspace").notNull(),
|
|
10
|
+
ref: text("ref").notNull(),
|
|
11
|
+
head: text("head"),
|
|
12
|
+
sequence: integer("sequence").notNull().default(0)
|
|
13
|
+
}, (table) => [primaryKey({ columns: [table.workspace, table.ref] })]),
|
|
14
|
+
workspaceHistoryRevisions: pgTable("workspace_history_revisions", {
|
|
15
|
+
workspace: text("workspace").notNull(),
|
|
16
|
+
id: text("id").notNull(),
|
|
17
|
+
ref: text("ref").notNull(),
|
|
18
|
+
parentId: text("parent_id"),
|
|
19
|
+
sequence: integer("sequence").notNull(),
|
|
20
|
+
createdAt: text("created_at").notNull(),
|
|
21
|
+
message: text("message"),
|
|
22
|
+
metadata: json("metadata").$type(),
|
|
23
|
+
files: integer("files").notNull(),
|
|
24
|
+
bytes: bigint("bytes", { mode: "number" }).notNull(),
|
|
25
|
+
entries: json("entries").$type().notNull(),
|
|
26
|
+
fileIndex: jsonb("file_index").$type().notNull(),
|
|
27
|
+
committed: boolean("committed").notNull().default(false)
|
|
28
|
+
}, (table) => [primaryKey({ columns: [table.workspace, table.id] }), index("workspace_history_timeline").on(table.workspace, table.ref, table.committed, table.sequence)]),
|
|
29
|
+
workspaceHistoryObjects: pgTable("workspace_history_objects", {
|
|
30
|
+
workspace: text("workspace").notNull(),
|
|
31
|
+
digest: text("digest").notNull(),
|
|
32
|
+
size: bigint("size", { mode: "number" }).notNull()
|
|
33
|
+
}, (table) => [primaryKey({ columns: [table.workspace, table.digest] })]),
|
|
34
|
+
workspaceHistoryMetadata: pgTable("workspace_history_metadata", {
|
|
35
|
+
workspace: text("workspace").notNull(),
|
|
36
|
+
key: text("key").notNull(),
|
|
37
|
+
value: json("value").$type().notNull()
|
|
38
|
+
}, (table) => [primaryKey({ columns: [table.workspace, table.key] })])
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { workspaceHistorySchema as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-rQ84J-ij.js";
|
|
2
2
|
import { a as workspaceConflict, s as workspaceError, t as normalizeSafeWorkspacePath } from "./path-DrSIenjj.js";
|
|
3
|
-
import { a as isExcludedWorkspacePath,
|
|
4
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
5
|
-
import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-
|
|
6
|
-
import { r as resolveWorkspaceRevisionMaterializer } from "./
|
|
7
|
-
import { C as isMissingWorkspacePathError, S as filterSessionEntries, b as assertPathInSessionScope, w as scopedSearchQuery, x as filterSessionDiff, y as assertDiffInsideSessionPaths } from "./workspace-
|
|
3
|
+
import { a as isExcludedWorkspacePath, d as sha256, i as decodeFile, l as normalizeWorkspacePath, r as contentToBytes, s as matchesAny } from "./path-BlIBpI7U.js";
|
|
4
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Cth97txN.js";
|
|
5
|
+
import { n as createSnapshotFromEntries, r as diffSnapshots } from "./utils-C0Au2R16.js";
|
|
6
|
+
import { r as resolveWorkspaceRevisionMaterializer } from "./vitehub-grants-C8IAl5-M.js";
|
|
7
|
+
import { C as isMissingWorkspacePathError, S as filterSessionEntries, b as assertPathInSessionScope, w as scopedSearchQuery, x as filterSessionDiff, y as assertDiffInsideSessionPaths } from "./workspace-CFrwWhEm.js";
|
|
8
8
|
import { normalizeExecutionAuthority } from "@vite-hub/runtime";
|
|
9
9
|
import { posix } from "node:path";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
@@ -44,6 +44,72 @@ async function withWorkspaceProgress(onProgress, event, fn) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
+
//#region src/session/tar.ts
|
|
48
|
+
const encoder = new TextEncoder();
|
|
49
|
+
function writeField(header, offset, length, value) {
|
|
50
|
+
header.set(encoder.encode(value).subarray(0, length), offset);
|
|
51
|
+
}
|
|
52
|
+
function writeOctal(header, offset, length, value) {
|
|
53
|
+
writeField(header, offset, length, `${value.toString(8).padStart(length - 1, "0")}\0`);
|
|
54
|
+
}
|
|
55
|
+
function tarHeader(name, type, size, mode, mtime, linkname = "") {
|
|
56
|
+
const header = /* @__PURE__ */ new Uint8Array(512);
|
|
57
|
+
writeField(header, 0, 100, name);
|
|
58
|
+
writeOctal(header, 100, 8, mode);
|
|
59
|
+
writeOctal(header, 108, 8, 0);
|
|
60
|
+
writeOctal(header, 116, 8, 0);
|
|
61
|
+
writeOctal(header, 124, 12, size);
|
|
62
|
+
writeOctal(header, 136, 12, mtime);
|
|
63
|
+
header.fill(32, 148, 156);
|
|
64
|
+
writeField(header, 156, 1, type);
|
|
65
|
+
writeField(header, 157, 100, linkname);
|
|
66
|
+
writeField(header, 257, 8, "ustar\x0000");
|
|
67
|
+
let checksum = 0;
|
|
68
|
+
for (const byte of header) checksum += byte;
|
|
69
|
+
writeField(header, 148, 8, `${checksum.toString(8).padStart(6, "0")}\0 `);
|
|
70
|
+
return header;
|
|
71
|
+
}
|
|
72
|
+
function paxRecord(key, value) {
|
|
73
|
+
const body = ` ${key}=${value}\n`;
|
|
74
|
+
const size = encoder.encode(body).byteLength;
|
|
75
|
+
let length = size + String(size).length;
|
|
76
|
+
if (String(length).length !== String(size).length) length = size + String(length).length;
|
|
77
|
+
return `${length}${body}`;
|
|
78
|
+
}
|
|
79
|
+
function padding(size) {
|
|
80
|
+
return new Uint8Array((512 - size % 512) % 512);
|
|
81
|
+
}
|
|
82
|
+
/** Packs the entries into one gzip tar archive. Names longer than the 100-byte ustar field use a PAX header. */
|
|
83
|
+
async function createTarGz(entries, maxBytes) {
|
|
84
|
+
const mtime = Math.floor(Date.now() / 1e3);
|
|
85
|
+
const chunks = [];
|
|
86
|
+
let size = 1024;
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
const start = chunks.length;
|
|
89
|
+
const name = entry.type === "directory" ? `${entry.path}/` : entry.path;
|
|
90
|
+
const linkname = entry.type === "symlink" ? entry.target : "";
|
|
91
|
+
const pax = [encoder.encode(name).byteLength > 100 ? paxRecord("path", name) : "", encoder.encode(linkname).byteLength > 100 ? paxRecord("linkpath", linkname) : ""].join("");
|
|
92
|
+
if (pax) {
|
|
93
|
+
const records = encoder.encode(pax);
|
|
94
|
+
chunks.push(tarHeader("PaxHeader", "x", records.byteLength, 420, mtime), records, padding(records.byteLength));
|
|
95
|
+
}
|
|
96
|
+
if (entry.type === "directory") chunks.push(tarHeader(name, "5", 0, 493, mtime));
|
|
97
|
+
else if (entry.type === "symlink") chunks.push(tarHeader(name, "2", 0, 511, mtime, linkname));
|
|
98
|
+
else chunks.push(tarHeader(name, "0", entry.content.byteLength, entry.executable ? 493 : 420, mtime), entry.content, padding(entry.content.byteLength));
|
|
99
|
+
for (let index = start; index < chunks.length; index++) size += chunks[index].byteLength;
|
|
100
|
+
if (size > maxBytes) return;
|
|
101
|
+
}
|
|
102
|
+
chunks.push(/* @__PURE__ */ new Uint8Array(1024));
|
|
103
|
+
const tar = new Uint8Array(size);
|
|
104
|
+
let offset = 0;
|
|
105
|
+
for (const chunk of chunks) {
|
|
106
|
+
tar.set(chunk, offset);
|
|
107
|
+
offset += chunk.byteLength;
|
|
108
|
+
}
|
|
109
|
+
const compressed = new Blob([tar]).stream().pipeThrough(new CompressionStream("gzip"));
|
|
110
|
+
return new Uint8Array(await new Response(compressed).arrayBuffer());
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
47
113
|
//#region src/session/host.ts
|
|
48
114
|
var host_exports = /* @__PURE__ */ __exportAll({ createHostedWorkspaceSession: () => createHostedWorkspaceSession });
|
|
49
115
|
const publicationQueues = /* @__PURE__ */ new WeakMap();
|
|
@@ -661,6 +727,33 @@ async function extractRevisionArchive(host, root, materialization, signal) {
|
|
|
661
727
|
await removeHostPath(host, root, stagingRoot, true, signal);
|
|
662
728
|
}
|
|
663
729
|
}
|
|
730
|
+
const sessionArchiveMinFiles = 32;
|
|
731
|
+
const sessionArchiveMaxBytes = 67108864;
|
|
732
|
+
async function extractSessionArchive(host, root, archive, signal) {
|
|
733
|
+
const path = posix.join(root, `.vitehub-workspace-${randomUUID()}.tar.gz`);
|
|
734
|
+
signal?.throwIfAborted();
|
|
735
|
+
try {
|
|
736
|
+
await host.files.write(path, archive, { signal });
|
|
737
|
+
signal?.throwIfAborted();
|
|
738
|
+
const extracted = await host.exec("tar", [
|
|
739
|
+
"-xzf",
|
|
740
|
+
path,
|
|
741
|
+
"-C",
|
|
742
|
+
root
|
|
743
|
+
], { signal });
|
|
744
|
+
signal?.throwIfAborted();
|
|
745
|
+
return extracted.code === 0;
|
|
746
|
+
} catch {
|
|
747
|
+
signal?.throwIfAborted();
|
|
748
|
+
return false;
|
|
749
|
+
} finally {
|
|
750
|
+
try {
|
|
751
|
+
if (await host.files.exists(path)) await host.files.remove(path, { recursive: false });
|
|
752
|
+
} finally {
|
|
753
|
+
signal?.throwIfAborted();
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
664
757
|
async function sanitizeHostSymlinks(host, root, abortSignal) {
|
|
665
758
|
const symlinks = (await listHostEntries(host, root, "", true, void 0, false, [], abortSignal)).filter(isGitSymlinkEntry);
|
|
666
759
|
for (const entry of symlinks) {
|
|
@@ -733,22 +826,64 @@ async function materializeWorkspace(workspace, host, root, options, useRevisionM
|
|
|
733
826
|
const symlinks = new Set(entries.filter(isGitSymlinkEntry).map((entry) => entry.path));
|
|
734
827
|
const nested = entries.find((entry) => hasSymlinkParent(entry.path, symlinks));
|
|
735
828
|
if (nested) throw workspaceError(`[vitehub] Workspace path crosses a symlink parent: ${nested.path}.`);
|
|
736
|
-
|
|
737
|
-
abortSignal?.throwIfAborted();
|
|
738
|
-
await host.files.mkdir(toHostPath(root, entry.path), {
|
|
739
|
-
recursive: true,
|
|
740
|
-
signal: abortSignal
|
|
741
|
-
});
|
|
742
|
-
abortSignal?.throwIfAborted();
|
|
743
|
-
}
|
|
829
|
+
const bytes = entries.reduce((total, entry) => total + (entry.size || 0), 0);
|
|
744
830
|
await withWorkspaceProgress(options?.onProgress, {
|
|
745
831
|
data: {
|
|
746
|
-
bytes
|
|
832
|
+
bytes,
|
|
747
833
|
files: files.length
|
|
748
834
|
},
|
|
749
835
|
id: "workspace.prepare.read-files",
|
|
750
836
|
label: "Reading workspace files"
|
|
751
837
|
}, async () => {
|
|
838
|
+
abortSignal?.throwIfAborted();
|
|
839
|
+
const archiveBudget = Math.min(host.archiveMaxBytes ?? 0, sessionArchiveMaxBytes);
|
|
840
|
+
const tryArchive = async () => {
|
|
841
|
+
let remaining = archiveBudget;
|
|
842
|
+
const archive = entries.filter((entry) => entry.type === "directory").map((entry) => ({
|
|
843
|
+
path: entry.path,
|
|
844
|
+
type: "directory"
|
|
845
|
+
}));
|
|
846
|
+
for (const entry of files) {
|
|
847
|
+
abortSignal?.throwIfAborted();
|
|
848
|
+
const symlink = isGitSymlinkEntry(entry);
|
|
849
|
+
const content = symlink && typeof entry.metadata?.symlinkTarget === "string" ? contentToBytes(entry.metadata.symlinkTarget) : contentToBytes(await workspace.readFile(entry.path, { encoding: "binary" }));
|
|
850
|
+
remaining -= content.byteLength;
|
|
851
|
+
if (remaining < 0) return false;
|
|
852
|
+
if (symlink) {
|
|
853
|
+
const target = new TextDecoder().decode(content);
|
|
854
|
+
if (isSafeHostSymlink(root, entry.path, target)) archive.push({
|
|
855
|
+
path: entry.path,
|
|
856
|
+
type: "symlink",
|
|
857
|
+
target
|
|
858
|
+
});
|
|
859
|
+
else {
|
|
860
|
+
matchesRetained = false;
|
|
861
|
+
archive.push({
|
|
862
|
+
path: entry.path,
|
|
863
|
+
type: "file",
|
|
864
|
+
content: contentToBytes(target)
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
} else archive.push({
|
|
868
|
+
path: entry.path,
|
|
869
|
+
type: "file",
|
|
870
|
+
content,
|
|
871
|
+
executable: entry.metadata?.gitMode === "100755"
|
|
872
|
+
});
|
|
873
|
+
if (matchesRetained && !await matchesRetainedWorkspaceFile(workspace, entry, content, retained?.files.get(entry.path))) matchesRetained = false;
|
|
874
|
+
}
|
|
875
|
+
abortSignal?.throwIfAborted();
|
|
876
|
+
const compressed = await createTarGz(archive, archiveBudget);
|
|
877
|
+
return !!compressed && compressed.byteLength <= archiveBudget && await extractSessionArchive(host, root, compressed, abortSignal);
|
|
878
|
+
};
|
|
879
|
+
if (archiveBudget > 0 && files.length >= sessionArchiveMinFiles && bytes <= archiveBudget && await tryArchive()) return;
|
|
880
|
+
for (const entry of entries.filter((entry) => entry.type === "directory")) {
|
|
881
|
+
abortSignal?.throwIfAborted();
|
|
882
|
+
await host.files.mkdir(toHostPath(root, entry.path), {
|
|
883
|
+
recursive: true,
|
|
884
|
+
signal: abortSignal
|
|
885
|
+
});
|
|
886
|
+
}
|
|
752
887
|
abortSignal?.throwIfAborted();
|
|
753
888
|
await mapHostMaterialization(host, files, async (entry) => {
|
|
754
889
|
abortSignal?.throwIfAborted();
|
|
@@ -906,7 +1041,6 @@ async function createHostedWorkspaceSession(workspace, options) {
|
|
|
906
1041
|
assertOpen();
|
|
907
1042
|
const patterns = Array.isArray(pattern) ? pattern : [pattern];
|
|
908
1043
|
const cwd = normalizeSearchRoot(globOptions?.cwd || "");
|
|
909
|
-
const { matchesAny } = await import("./path--wrT_Azm.js").then((n) => n.u);
|
|
910
1044
|
return filterSessionEntries(await listHostEntries(host, root, "", true), sessionPaths).filter((entry) => {
|
|
911
1045
|
if (entry.type !== "file") return false;
|
|
912
1046
|
if (!cwd) return patterns.some((item) => matchesAny(entry.path, item));
|
|
@@ -917,7 +1051,7 @@ async function createHostedWorkspaceSession(workspace, options) {
|
|
|
917
1051
|
},
|
|
918
1052
|
async search(query) {
|
|
919
1053
|
assertOpen();
|
|
920
|
-
const { searchText } = await import("./search-
|
|
1054
|
+
const { searchText } = await import("./search-BqNV9LnO.js").then((n) => n.n);
|
|
921
1055
|
const scoped = scopedSearchQuery(query, sessionPaths, normalizeSearchRoot);
|
|
922
1056
|
if (!scoped) return [];
|
|
923
1057
|
const scopedSearchRoots = [...new Set((scoped.paths?.length ? scoped.paths : [scoped.cwd || ""]).map(normalizeSearchRoot))].filter(Boolean);
|