@undefineds.co/xpod 0.3.18 → 0.3.23
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/config/bun.json +57 -11
- package/config/cloud.json +14 -12
- package/config/local.json +16 -14
- package/config/xpod.json +47 -9
- package/dist/api/matrix/PodMatrixStore.d.ts +4 -7
- package/dist/api/matrix/PodMatrixStore.js +116 -148
- package/dist/api/matrix/PodMatrixStore.js.map +1 -1
- package/dist/api/matrix/types.d.ts +2 -0
- package/dist/api/matrix/types.js.map +1 -1
- package/dist/api/runs/PiAgentRuntimeDriver.d.ts +1 -0
- package/dist/api/runs/PiAgentRuntimeDriver.js +4 -1
- package/dist/api/runs/PiAgentRuntimeDriver.js.map +1 -1
- package/dist/components/components.jsonld +3 -0
- package/dist/components/context.jsonld +71 -32
- package/dist/http/SubgraphSparqlHttpHandler.d.ts +1 -0
- package/dist/http/SubgraphSparqlHttpHandler.js +27 -4
- package/dist/http/SubgraphSparqlHttpHandler.js.map +1 -1
- package/dist/http/SubgraphSparqlHttpHandler.jsonld +4 -0
- package/dist/http/vector/VectorHttpHandler.d.ts +5 -1
- package/dist/http/vector/VectorHttpHandler.js +5 -5
- package/dist/http/vector/VectorHttpHandler.js.map +1 -1
- package/dist/http/vector/VectorHttpHandler.jsonld +40 -28
- package/dist/index.d.ts +5 -2
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/dist/runtime/Proxy.d.ts +3 -0
- package/dist/runtime/Proxy.js +31 -7
- package/dist/runtime/Proxy.js.map +1 -1
- package/dist/solidfs/LocalSolidFS.js +31 -124
- package/dist/solidfs/LocalSolidFS.js.map +1 -1
- package/dist/solidfs/SolidFsPathUtils.d.ts +13 -0
- package/dist/solidfs/SolidFsPathUtils.js +114 -0
- package/dist/solidfs/SolidFsPathUtils.js.map +1 -0
- package/dist/solidfs/SolidFsSyncJournal.d.ts +117 -0
- package/dist/solidfs/SolidFsSyncJournal.js +553 -0
- package/dist/solidfs/SolidFsSyncJournal.js.map +1 -0
- package/dist/solidfs/index.d.ts +1 -0
- package/dist/solidfs/index.js +1 -0
- package/dist/solidfs/index.js.map +1 -1
- package/dist/solidfs/types.d.ts +1 -0
- package/dist/solidfs/types.js.map +1 -1
- package/dist/storage/SparqlUpdateResourceStore.js +94 -33
- package/dist/storage/SparqlUpdateResourceStore.js.map +1 -1
- package/dist/storage/accessors/MixDataAccessor.d.ts +22 -5
- package/dist/storage/accessors/MixDataAccessor.js +376 -61
- package/dist/storage/accessors/MixDataAccessor.js.map +1 -1
- package/dist/storage/accessors/MixDataAccessor.jsonld +73 -5
- package/dist/storage/accessors/QuadstoreSparqlDataAccessor.js +32 -10
- package/dist/storage/accessors/QuadstoreSparqlDataAccessor.js.map +1 -1
- package/dist/storage/accessors/QuintStoreSparqlDataAccessor.js +28 -6
- package/dist/storage/accessors/QuintStoreSparqlDataAccessor.js.map +1 -1
- package/dist/storage/accessors/SolidRdfDataAccessor.d.ts +45 -0
- package/dist/storage/accessors/SolidRdfDataAccessor.js +277 -0
- package/dist/storage/accessors/SolidRdfDataAccessor.js.map +1 -0
- package/dist/storage/accessors/SolidRdfDataAccessor.jsonld +161 -0
- package/dist/storage/rdf/Rdf3xIndex.d.ts +122 -0
- package/dist/storage/rdf/Rdf3xIndex.js +2695 -0
- package/dist/storage/rdf/Rdf3xIndex.js.map +1 -0
- package/dist/storage/rdf/Rdf3xIndex.jsonld +528 -0
- package/dist/storage/rdf/Rdf3xSchema.d.ts +20 -0
- package/dist/storage/rdf/Rdf3xSchema.js +65 -0
- package/dist/storage/rdf/Rdf3xSchema.js.map +1 -0
- package/dist/storage/rdf/RdfLocalQueryEngine.d.ts +10 -4
- package/dist/storage/rdf/RdfLocalQueryEngine.js +607 -127
- package/dist/storage/rdf/RdfLocalQueryEngine.js.map +1 -1
- package/dist/storage/rdf/RdfQuadIndex.d.ts +12 -1
- package/dist/storage/rdf/RdfQuadIndex.js +152 -22
- package/dist/storage/rdf/RdfQuadIndex.js.map +1 -1
- package/dist/storage/rdf/RdfQuadIndex.jsonld +36 -4
- package/dist/storage/rdf/RdfSparqlAdapter.d.ts +20 -2
- package/dist/storage/rdf/RdfSparqlAdapter.js +364 -40
- package/dist/storage/rdf/RdfSparqlAdapter.js.map +1 -1
- package/dist/storage/rdf/RdfSparqlAdapter.jsonld +60 -0
- package/dist/storage/rdf/RdfTermDictionary.d.ts +8 -0
- package/dist/storage/rdf/RdfTermDictionary.js +141 -70
- package/dist/storage/rdf/RdfTermDictionary.js.map +1 -1
- package/dist/storage/rdf/RdfTermDictionary.jsonld +24 -0
- package/dist/storage/rdf/RdfTextIndex.js +10 -3
- package/dist/storage/rdf/RdfTextIndex.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.d.ts +15 -6
- package/dist/storage/rdf/SolidRdfEngine.js +218 -25
- package/dist/storage/rdf/SolidRdfEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfEngine.jsonld +70 -7
- package/dist/storage/rdf/SolidRdfSparqlEngine.d.ts +11 -7
- package/dist/storage/rdf/SolidRdfSparqlEngine.js +60 -47
- package/dist/storage/rdf/SolidRdfSparqlEngine.js.map +1 -1
- package/dist/storage/rdf/SolidRdfSparqlEngine.jsonld +9 -5
- package/dist/storage/rdf/index.d.ts +2 -2
- package/dist/storage/rdf/index.js +3 -3
- package/dist/storage/rdf/index.js.map +1 -1
- package/dist/storage/rdf/models-benchmark.d.ts +12 -1
- package/dist/storage/rdf/models-benchmark.js +549 -32
- package/dist/storage/rdf/models-benchmark.js.map +1 -1
- package/dist/storage/rdf/types.d.ts +81 -7
- package/dist/storage/rdf/types.js.map +1 -1
- package/dist/storage/sparql/CompatibilitySparqlEngine.d.ts +36 -0
- package/dist/storage/sparql/CompatibilitySparqlEngine.js +96 -0
- package/dist/storage/sparql/CompatibilitySparqlEngine.js.map +1 -0
- package/dist/storage/sparql/CompatibilitySparqlEngine.jsonld +123 -0
- package/dist/storage/sparql/CompatibilitySparqlEngineImpl.d.ts +35 -0
- package/dist/storage/sparql/CompatibilitySparqlEngineImpl.js +112 -0
- package/dist/storage/sparql/CompatibilitySparqlEngineImpl.js.map +1 -0
- package/dist/storage/sparql/SubgraphQueryEngine.d.ts +1 -36
- package/dist/storage/sparql/SubgraphQueryEngine.js +2 -115
- package/dist/storage/sparql/SubgraphQueryEngine.js.map +1 -1
- package/dist/storage/sparql/SubgraphQueryEngine.jsonld +1 -124
- package/dist/terminal/AclPermissionService.d.ts +2 -1
- package/dist/terminal/AclPermissionService.js +26 -3
- package/dist/terminal/AclPermissionService.js.map +1 -1
- package/dist/terminal/TerminalSessionManager.js +25 -3
- package/dist/terminal/TerminalSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/dist/storage/rdf/Rdf3xTripleIndex.d.ts +0 -55
- package/dist/storage/rdf/Rdf3xTripleIndex.js +0 -1235
- package/dist/storage/rdf/Rdf3xTripleIndex.js.map +0 -1
|
@@ -4,14 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.LocalSolidFS = void 0;
|
|
7
|
-
const node_crypto_1 = require("node:crypto");
|
|
8
|
-
const node_fs_1 = require("node:fs");
|
|
9
7
|
const promises_1 = require("node:fs/promises");
|
|
10
8
|
const node_os_1 = __importDefault(require("node:os"));
|
|
11
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
-
const node_url_1 = require("node:url");
|
|
13
10
|
const types_1 = require("./types");
|
|
14
11
|
const RdfContentTypes_1 = require("../storage/rdf/RdfContentTypes");
|
|
12
|
+
const SolidFsPathUtils_1 = require("./SolidFsPathUtils");
|
|
15
13
|
class LocalSolidFS {
|
|
16
14
|
constructor(options = {}) {
|
|
17
15
|
this.workRoot = options.workRoot ?? node_path_1.default.join(node_os_1.default.tmpdir(), 'xpod-solidfs');
|
|
@@ -32,13 +30,17 @@ class LocalSolidFS {
|
|
|
32
30
|
? (relativePath) => syncer.shouldTrackPath(relativePath)
|
|
33
31
|
: isLineAddressableRdfPath
|
|
34
32
|
: undefined;
|
|
35
|
-
const entries = changeFilter ? await snapshotDirectory(sourceRoot, changeFilter) : [];
|
|
33
|
+
const entries = changeFilter ? await (0, SolidFsPathUtils_1.snapshotDirectory)(sourceRoot, changeFilter) : [];
|
|
34
|
+
const manifest = this.createManifest(input.workspace, sourceRoot, projection, entries);
|
|
35
|
+
if (trackChanges && syncer?.initializeWorkspace) {
|
|
36
|
+
await syncer.initializeWorkspace(manifest, input.context);
|
|
37
|
+
}
|
|
36
38
|
return new LocalMaterializedWorkspace({
|
|
37
39
|
sourceRoot,
|
|
38
40
|
cwd: sourceRoot,
|
|
39
41
|
projection,
|
|
40
42
|
cleanupOnRollback: false,
|
|
41
|
-
manifest
|
|
43
|
+
manifest,
|
|
42
44
|
changeFilter,
|
|
43
45
|
context: input.context,
|
|
44
46
|
syncer: this.syncer,
|
|
@@ -61,7 +63,7 @@ class LocalSolidFS {
|
|
|
61
63
|
throw new Error(`LocalSolidFS does not support projection '${projection}' yet.`);
|
|
62
64
|
}
|
|
63
65
|
const cwd = await this.createCopyWorkdir(sourceRoot, input.run?.id);
|
|
64
|
-
const entries = await snapshotDirectory(sourceRoot);
|
|
66
|
+
const entries = await (0, SolidFsPathUtils_1.snapshotDirectory)(sourceRoot);
|
|
65
67
|
await (0, promises_1.cp)(sourceRoot, cwd, {
|
|
66
68
|
recursive: true,
|
|
67
69
|
force: true,
|
|
@@ -110,14 +112,14 @@ class LocalSolidFS {
|
|
|
110
112
|
return workspaceDir;
|
|
111
113
|
}
|
|
112
114
|
createManifest(workspace, cwd, projection, snapshots) {
|
|
113
|
-
const source = sourceForProjection(projection, workspace);
|
|
115
|
+
const source = (0, SolidFsPathUtils_1.sourceForProjection)(projection, workspace);
|
|
114
116
|
return {
|
|
115
117
|
workspace,
|
|
116
118
|
cwd,
|
|
117
119
|
projection,
|
|
118
120
|
entries: snapshots.map((snapshot) => ({
|
|
119
121
|
path: snapshot.relativePath,
|
|
120
|
-
resource: resolveWorkspaceResource(workspace, snapshot.relativePath),
|
|
122
|
+
resource: (0, SolidFsPathUtils_1.resolveWorkspaceResource)(workspace, snapshot.relativePath),
|
|
121
123
|
source,
|
|
122
124
|
sourcePath: snapshot.absolutePath,
|
|
123
125
|
projection,
|
|
@@ -155,7 +157,7 @@ class LocalMaterializedWorkspace {
|
|
|
155
157
|
this.context = options.context;
|
|
156
158
|
this.syncer = options.syncer;
|
|
157
159
|
this.hydrator = options.hydrator;
|
|
158
|
-
this.entrySource = sourceForProjection(this.projection, this.manifest.workspace);
|
|
160
|
+
this.entrySource = (0, SolidFsPathUtils_1.sourceForProjection)(this.projection, this.manifest.workspace);
|
|
159
161
|
}
|
|
160
162
|
async commit() {
|
|
161
163
|
if (this.projection === 'hydrated-object') {
|
|
@@ -203,7 +205,7 @@ class LocalMaterializedWorkspace {
|
|
|
203
205
|
if (!this.hydrator) {
|
|
204
206
|
throw new Error('SolidFS hydrated-object projection requires a hydrator');
|
|
205
207
|
}
|
|
206
|
-
const normalized = safeRelativePath(relativePath);
|
|
208
|
+
const normalized = (0, SolidFsPathUtils_1.safeRelativePath)(relativePath);
|
|
207
209
|
const targetPath = node_path_1.default.join(this.cwd, normalized);
|
|
208
210
|
await (0, promises_1.mkdir)(node_path_1.default.dirname(targetPath), { recursive: true });
|
|
209
211
|
const result = await this.hydrator.hydrate({
|
|
@@ -212,15 +214,15 @@ class LocalMaterializedWorkspace {
|
|
|
212
214
|
workspace: this.manifest,
|
|
213
215
|
context: this.context,
|
|
214
216
|
});
|
|
215
|
-
const workingVersion = await fileVersion(targetPath);
|
|
217
|
+
const workingVersion = await (0, SolidFsPathUtils_1.fileVersion)(targetPath);
|
|
216
218
|
let entry = this.manifest.entries.find((candidate) => candidate.path === normalized);
|
|
217
219
|
if (!entry) {
|
|
218
220
|
entry = {
|
|
219
221
|
path: normalized,
|
|
220
|
-
resource: resolveWorkspaceResource(this.manifest.workspace, normalized),
|
|
222
|
+
resource: (0, SolidFsPathUtils_1.resolveWorkspaceResource)(this.manifest.workspace, normalized),
|
|
221
223
|
source: this.entrySource,
|
|
222
224
|
sourcePath: targetPath,
|
|
223
|
-
contentType: result?.contentType ?? contentTypeForPath(normalized),
|
|
225
|
+
contentType: result?.contentType ?? (0, SolidFsPathUtils_1.contentTypeForPath)(normalized),
|
|
224
226
|
projection: this.projection,
|
|
225
227
|
sourceVersion: result?.sourceVersion,
|
|
226
228
|
workingVersion,
|
|
@@ -232,7 +234,7 @@ class LocalMaterializedWorkspace {
|
|
|
232
234
|
return entry;
|
|
233
235
|
}
|
|
234
236
|
entry.sourcePath = targetPath;
|
|
235
|
-
entry.contentType = result?.contentType ?? entry.contentType ?? contentTypeForPath(normalized);
|
|
237
|
+
entry.contentType = result?.contentType ?? entry.contentType ?? (0, SolidFsPathUtils_1.contentTypeForPath)(normalized);
|
|
236
238
|
entry.sourceVersion = result?.sourceVersion ?? entry.sourceVersion;
|
|
237
239
|
entry.workingVersion = workingVersion;
|
|
238
240
|
entry.lastAccessedAt = Date.now();
|
|
@@ -247,7 +249,7 @@ class LocalMaterializedWorkspace {
|
|
|
247
249
|
const olderThanMs = options.olderThanMs ?? 0;
|
|
248
250
|
const retained = [];
|
|
249
251
|
for (const entry of this.manifest.entries) {
|
|
250
|
-
const currentVersion = await maybeFileVersion(entry.sourcePath);
|
|
252
|
+
const currentVersion = await (0, SolidFsPathUtils_1.maybeFileVersion)(entry.sourcePath);
|
|
251
253
|
const dirty = currentVersion !== undefined && currentVersion !== entry.workingVersion;
|
|
252
254
|
if (dirty) {
|
|
253
255
|
entry.state = 'dirty';
|
|
@@ -289,7 +291,7 @@ class LocalMaterializedWorkspace {
|
|
|
289
291
|
const entry = this.manifest.entries.find((candidate) => candidate.path === change.path);
|
|
290
292
|
if (entry) {
|
|
291
293
|
entry.sourceVersion = result?.sourceVersion ?? entry.sourceVersion;
|
|
292
|
-
entry.workingVersion = await fileVersion(entry.sourcePath);
|
|
294
|
+
entry.workingVersion = await (0, SolidFsPathUtils_1.fileVersion)(entry.sourcePath);
|
|
293
295
|
entry.lastAccessedAt = Date.now();
|
|
294
296
|
}
|
|
295
297
|
}
|
|
@@ -301,11 +303,11 @@ class LocalMaterializedWorkspace {
|
|
|
301
303
|
const changes = [];
|
|
302
304
|
const tracked = new Set(this.manifest.entries.map((entry) => entry.path));
|
|
303
305
|
for (const entry of this.manifest.entries) {
|
|
304
|
-
const currentVersion = await maybeFileVersion(entry.sourcePath);
|
|
306
|
+
const currentVersion = await (0, SolidFsPathUtils_1.maybeFileVersion)(entry.sourcePath);
|
|
305
307
|
if (currentVersion === undefined) {
|
|
306
308
|
changes.push({
|
|
307
309
|
path: entry.path,
|
|
308
|
-
resource: entry.resource ?? resolveWorkspaceResource(this.manifest.workspace, entry.path),
|
|
310
|
+
resource: entry.resource ?? (0, SolidFsPathUtils_1.resolveWorkspaceResource)(this.manifest.workspace, entry.path),
|
|
309
311
|
source: entry.source,
|
|
310
312
|
sourcePath: entry.sourcePath,
|
|
311
313
|
contentType: entry.contentType,
|
|
@@ -319,7 +321,7 @@ class LocalMaterializedWorkspace {
|
|
|
319
321
|
if (currentVersion !== entry.workingVersion) {
|
|
320
322
|
changes.push({
|
|
321
323
|
path: entry.path,
|
|
322
|
-
resource: entry.resource ?? resolveWorkspaceResource(this.manifest.workspace, entry.path),
|
|
324
|
+
resource: entry.resource ?? (0, SolidFsPathUtils_1.resolveWorkspaceResource)(this.manifest.workspace, entry.path),
|
|
323
325
|
source: entry.source,
|
|
324
326
|
sourcePath: entry.sourcePath,
|
|
325
327
|
contentType: entry.contentType,
|
|
@@ -330,16 +332,16 @@ class LocalMaterializedWorkspace {
|
|
|
330
332
|
entry.state = 'dirty';
|
|
331
333
|
}
|
|
332
334
|
}
|
|
333
|
-
for (const snapshot of await snapshotDirectory(this.cwd)) {
|
|
335
|
+
for (const snapshot of await (0, SolidFsPathUtils_1.snapshotDirectory)(this.cwd)) {
|
|
334
336
|
if (tracked.has(snapshot.relativePath)) {
|
|
335
337
|
continue;
|
|
336
338
|
}
|
|
337
339
|
this.manifest.entries.push({
|
|
338
340
|
path: snapshot.relativePath,
|
|
339
|
-
resource: resolveWorkspaceResource(this.manifest.workspace, snapshot.relativePath),
|
|
341
|
+
resource: (0, SolidFsPathUtils_1.resolveWorkspaceResource)(this.manifest.workspace, snapshot.relativePath),
|
|
340
342
|
source: this.entrySource,
|
|
341
343
|
sourcePath: snapshot.absolutePath,
|
|
342
|
-
contentType: contentTypeForPath(snapshot.relativePath),
|
|
344
|
+
contentType: (0, SolidFsPathUtils_1.contentTypeForPath)(snapshot.relativePath),
|
|
343
345
|
projection: this.projection,
|
|
344
346
|
workingVersion: snapshot.version,
|
|
345
347
|
lastAccessedAt: Date.now(),
|
|
@@ -347,10 +349,10 @@ class LocalMaterializedWorkspace {
|
|
|
347
349
|
});
|
|
348
350
|
changes.push({
|
|
349
351
|
path: snapshot.relativePath,
|
|
350
|
-
resource: resolveWorkspaceResource(this.manifest.workspace, snapshot.relativePath),
|
|
352
|
+
resource: (0, SolidFsPathUtils_1.resolveWorkspaceResource)(this.manifest.workspace, snapshot.relativePath),
|
|
351
353
|
source: this.entrySource,
|
|
352
354
|
sourcePath: snapshot.absolutePath,
|
|
353
|
-
contentType: contentTypeForPath(snapshot.relativePath),
|
|
355
|
+
contentType: (0, SolidFsPathUtils_1.contentTypeForPath)(snapshot.relativePath),
|
|
354
356
|
projection: this.projection,
|
|
355
357
|
type: 'created',
|
|
356
358
|
});
|
|
@@ -365,7 +367,7 @@ class LocalMaterializedWorkspace {
|
|
|
365
367
|
if (!entry.sourceVersion) {
|
|
366
368
|
continue;
|
|
367
369
|
}
|
|
368
|
-
const currentVersion = await maybeFileVersion(entry.sourcePath);
|
|
370
|
+
const currentVersion = await (0, SolidFsPathUtils_1.maybeFileVersion)(entry.sourcePath);
|
|
369
371
|
if (currentVersion !== entry.sourceVersion) {
|
|
370
372
|
conflicts.push({
|
|
371
373
|
path: entry.path,
|
|
@@ -376,7 +378,7 @@ class LocalMaterializedWorkspace {
|
|
|
376
378
|
});
|
|
377
379
|
}
|
|
378
380
|
}
|
|
379
|
-
const currentSourceFiles = await snapshotDirectory(this.sourceRoot);
|
|
381
|
+
const currentSourceFiles = await (0, SolidFsPathUtils_1.snapshotDirectory)(this.sourceRoot);
|
|
380
382
|
for (const current of currentSourceFiles) {
|
|
381
383
|
if (!initialPaths.has(current.relativePath)) {
|
|
382
384
|
conflicts.push({
|
|
@@ -394,7 +396,7 @@ class LocalMaterializedWorkspace {
|
|
|
394
396
|
if (before.size === 0 && this.projection === 'direct' && !this.changeFilter) {
|
|
395
397
|
return [];
|
|
396
398
|
}
|
|
397
|
-
const after = new Map((await snapshotDirectory(this.cwd, this.changeFilter)).map((snapshot) => [snapshot.relativePath, snapshot]));
|
|
399
|
+
const after = new Map((await (0, SolidFsPathUtils_1.snapshotDirectory)(this.cwd, this.changeFilter)).map((snapshot) => [snapshot.relativePath, snapshot]));
|
|
398
400
|
const changes = [];
|
|
399
401
|
for (const [relativePath, snapshot] of after) {
|
|
400
402
|
const entry = before.get(relativePath);
|
|
@@ -416,10 +418,10 @@ class LocalMaterializedWorkspace {
|
|
|
416
418
|
createChange(relativePath, sourcePath, type) {
|
|
417
419
|
return {
|
|
418
420
|
path: relativePath,
|
|
419
|
-
resource: resolveWorkspaceResource(this.manifest.workspace, relativePath),
|
|
421
|
+
resource: (0, SolidFsPathUtils_1.resolveWorkspaceResource)(this.manifest.workspace, relativePath),
|
|
420
422
|
source: this.entrySource,
|
|
421
423
|
sourcePath,
|
|
422
|
-
contentType: contentTypeForPath(relativePath),
|
|
424
|
+
contentType: (0, SolidFsPathUtils_1.contentTypeForPath)(relativePath),
|
|
423
425
|
projection: this.projection,
|
|
424
426
|
type,
|
|
425
427
|
};
|
|
@@ -438,102 +440,7 @@ class LocalMaterializedWorkspace {
|
|
|
438
440
|
}
|
|
439
441
|
}
|
|
440
442
|
}
|
|
441
|
-
function contentTypeForPath(filePath) {
|
|
442
|
-
const lower = filePath.toLowerCase();
|
|
443
|
-
const rdfContentType = (0, RdfContentTypes_1.rdfContentTypeForPath)(lower);
|
|
444
|
-
if (rdfContentType) {
|
|
445
|
-
return rdfContentType;
|
|
446
|
-
}
|
|
447
|
-
if (lower.endsWith('.md') || lower.endsWith('.markdown') || lower.endsWith('.mdown')) {
|
|
448
|
-
return 'text/markdown';
|
|
449
|
-
}
|
|
450
|
-
if (lower.endsWith('.txt') || lower.endsWith('.log')) {
|
|
451
|
-
return 'text/plain';
|
|
452
|
-
}
|
|
453
|
-
return undefined;
|
|
454
|
-
}
|
|
455
|
-
function sourceForProjection(projection, workspace) {
|
|
456
|
-
if (projection === 'hydrated-object') {
|
|
457
|
-
return 'object';
|
|
458
|
-
}
|
|
459
|
-
if (/^https?:/u.test(workspace)) {
|
|
460
|
-
return 'pod-http';
|
|
461
|
-
}
|
|
462
|
-
return 'filesystem';
|
|
463
|
-
}
|
|
464
|
-
function resolveWorkspaceResource(workspace, relativePath) {
|
|
465
|
-
if (node_path_1.default.isAbsolute(workspace)) {
|
|
466
|
-
return (0, node_url_1.pathToFileURL)(node_path_1.default.join(workspace, relativePath)).href;
|
|
467
|
-
}
|
|
468
|
-
try {
|
|
469
|
-
const base = new URL(workspace.endsWith('/') ? workspace : `${workspace}/`);
|
|
470
|
-
const normalized = relativePath.split(node_path_1.default.sep).join('/');
|
|
471
|
-
return new URL(normalized, base).href;
|
|
472
|
-
}
|
|
473
|
-
catch {
|
|
474
|
-
return undefined;
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
443
|
function isLineAddressableRdfPath(filePath) {
|
|
478
444
|
return (0, RdfContentTypes_1.isLineAddressableRdfPath)(filePath);
|
|
479
445
|
}
|
|
480
|
-
function safeRelativePath(input) {
|
|
481
|
-
const normalized = input.split(/[\\/]+/u).filter((part) => part.length > 0).join(node_path_1.default.sep);
|
|
482
|
-
if (!normalized || node_path_1.default.isAbsolute(input) || normalized.split(node_path_1.default.sep).includes('..')) {
|
|
483
|
-
throw new Error(`Invalid SolidFS relative path: ${input}`);
|
|
484
|
-
}
|
|
485
|
-
return normalized;
|
|
486
|
-
}
|
|
487
|
-
async function maybeFileVersion(filePath) {
|
|
488
|
-
try {
|
|
489
|
-
return await fileVersion(filePath);
|
|
490
|
-
}
|
|
491
|
-
catch {
|
|
492
|
-
return undefined;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
async function fileVersion(filePath) {
|
|
496
|
-
const fileStat = await (0, promises_1.stat)(filePath);
|
|
497
|
-
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
498
|
-
await new Promise((resolve, reject) => {
|
|
499
|
-
const stream = (0, node_fs_1.createReadStream)(filePath);
|
|
500
|
-
stream.on('data', (chunk) => hash.update(chunk));
|
|
501
|
-
stream.on('error', reject);
|
|
502
|
-
stream.on('end', resolve);
|
|
503
|
-
});
|
|
504
|
-
return `${fileStat.size}:${fileStat.mtimeMs}:${hash.digest('hex')}`;
|
|
505
|
-
}
|
|
506
|
-
async function snapshotDirectory(root, filter) {
|
|
507
|
-
const snapshots = [];
|
|
508
|
-
async function walk(current) {
|
|
509
|
-
let entries;
|
|
510
|
-
try {
|
|
511
|
-
entries = await (0, promises_1.readdir)(current, { withFileTypes: true });
|
|
512
|
-
}
|
|
513
|
-
catch {
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
for (const entry of entries) {
|
|
517
|
-
const absolute = node_path_1.default.join(current, entry.name);
|
|
518
|
-
const relative = node_path_1.default.relative(root, absolute);
|
|
519
|
-
if (entry.isDirectory()) {
|
|
520
|
-
await walk(absolute);
|
|
521
|
-
continue;
|
|
522
|
-
}
|
|
523
|
-
if (!entry.isFile()) {
|
|
524
|
-
continue;
|
|
525
|
-
}
|
|
526
|
-
if (filter && !filter(relative)) {
|
|
527
|
-
continue;
|
|
528
|
-
}
|
|
529
|
-
snapshots.push({
|
|
530
|
-
relativePath: relative,
|
|
531
|
-
absolutePath: absolute,
|
|
532
|
-
version: await fileVersion(absolute),
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
await walk(root);
|
|
537
|
-
return snapshots.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
538
|
-
}
|
|
539
446
|
//# sourceMappingURL=LocalSolidFS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalSolidFS.js","sourceRoot":"","sources":["../../src/solidfs/LocalSolidFS.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAyC;AACzC,qCAA2C;AAC3C,+CAO0B;AAC1B,sDAAyB;AACzB,0DAA6B;AAC7B,uCAAyC;AAEzC,mCAciB;AACjB,oEAGwC;AAcxC,MAAa,YAAY;IAKvB,YAAmB,UAA+B,EAAE;QAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,mBAAI,CAAC,IAAI,CAAC,iBAAE,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,KAA0B;QAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU;YACjC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;YAChC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,QAAQ,CAAC;QAEhD,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAE7C,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC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,EAAE,CAAC;gBACxB,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACrB,SAAS;YACX,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBACpB,SAAS;YACX,CAAC;YACD,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAChC,SAAS;YACX,CAAC;YACD,SAAS,CAAC,IAAI,CAAC;gBACb,YAAY,EAAE,QAAQ;gBACtB,YAAY,EAAE,QAAQ;gBACtB,OAAO,EAAE,MAAM,WAAW,CAAC,QAAQ,CAAC;aACrC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;AAC9F,CAAC","sourcesContent":["import { createHash } from 'node:crypto';\nimport { createReadStream } from 'node:fs';\nimport {\n cp,\n mkdir,\n mkdtemp,\n readdir,\n rm,\n stat,\n} from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport {\n MaterializedWorkspace,\n SolidFS,\n SolidFsChange,\n SolidFsConflict,\n SolidFsConflictError,\n SolidFsEntrySource,\n SolidFsHydrator,\n SolidFsManifest,\n SolidFsManifestEntry,\n SolidFsPrepareInput,\n SolidFsPruneOptions,\n SolidFsProjection,\n SolidFsSyncer,\n} from './types';\nimport {\n isLineAddressableRdfPath as isRdfPath,\n rdfContentTypeForPath,\n} from '../storage/rdf/RdfContentTypes';\n\ninterface FileSnapshot {\n relativePath: string;\n absolutePath: string;\n version: string;\n}\n\nexport interface LocalSolidFSOptions {\n workRoot?: string;\n syncer?: SolidFsSyncer;\n hydrator?: SolidFsHydrator;\n}\n\nexport class LocalSolidFS implements SolidFS {\n private readonly workRoot: string;\n private readonly syncer?: SolidFsSyncer;\n private readonly hydrator?: SolidFsHydrator;\n\n public constructor(options: LocalSolidFSOptions = {}) {\n this.workRoot = options.workRoot ?? path.join(os.tmpdir(), 'xpod-solidfs');\n this.syncer = options.syncer;\n this.hydrator = options.hydrator;\n }\n\n public async prepare(input: SolidFsPrepareInput): Promise<MaterializedWorkspace> {\n const sourceRoot = input.sourcePath\n ? path.resolve(input.sourcePath)\n : this.resolveWorkspacePath(input.workspace);\n const projection = input.projection ?? 'direct';\n\n await this.assertSourceDirectory(sourceRoot);\n\n if (projection === 'direct') {\n const trackChanges = this.syncer?.shouldTrack?.(input) ?? Boolean(this.syncer);\n const syncer = this.syncer;\n const changeFilter = trackChanges\n ? syncer?.shouldTrackPath\n ? (relativePath: string): boolean => syncer.shouldTrackPath!(relativePath)\n : isLineAddressableRdfPath\n : undefined;\n const entries = changeFilter ? await snapshotDirectory(sourceRoot, changeFilter) : [];\n return new LocalMaterializedWorkspace({\n sourceRoot,\n cwd: sourceRoot,\n projection,\n cleanupOnRollback: false,\n manifest: this.createManifest(input.workspace, sourceRoot, projection, entries),\n changeFilter,\n context: input.context,\n syncer: this.syncer,\n hydrator: this.hydrator,\n });\n }\n\n if (projection === 'hydrated-object') {\n const cwd = await this.createHydratedWorkdir(sourceRoot, input.run?.id);\n return new LocalMaterializedWorkspace({\n sourceRoot,\n cwd,\n projection,\n cleanupOnRollback: true,\n manifest: this.createManifest(input.workspace, cwd, projection, []),\n context: input.context,\n hydrator: this.hydrator,\n });\n }\n\n if (projection !== 'copy') {\n throw new Error(`LocalSolidFS does not support projection '${projection}' yet.`);\n }\n\n const cwd = await this.createCopyWorkdir(sourceRoot, input.run?.id);\n const entries = await snapshotDirectory(sourceRoot);\n await cp(sourceRoot, cwd, {\n recursive: true,\n force: true,\n errorOnExist: false,\n dereference: false,\n });\n\n return new LocalMaterializedWorkspace({\n sourceRoot,\n cwd,\n projection,\n cleanupOnRollback: true,\n manifest: this.createManifest(input.workspace, cwd, projection, entries),\n context: input.context,\n syncer: this.syncer,\n hydrator: this.hydrator,\n });\n }\n\n private resolveWorkspacePath(workspace: string): string {\n if (workspace.startsWith('file://')) {\n const url = new URL(workspace);\n const pathname = decodeURIComponent(url.pathname);\n if (process.platform === 'win32' && /^\\/[A-Za-z]:/.test(pathname)) {\n return pathname.slice(1);\n }\n return pathname;\n }\n\n if (path.isAbsolute(workspace)) {\n return workspace;\n }\n\n throw new Error(`Unsupported workspace '${workspace}'. LocalSolidFS expects file:// or absolute paths.`);\n }\n\n private async createCopyWorkdir(sourceRoot: string, runId?: string): Promise<string> {\n const safeRun = (runId ?? 'run').replace(/[^a-zA-Z0-9._-]+/gu, '_');\n const prefix = path.join(this.workRoot, `${safeRun}-`);\n await mkdir(this.workRoot, { recursive: true });\n const cwd = await mkdtemp(prefix);\n\n const sourceName = path.basename(sourceRoot.replace(/[\\\\/]+$/u, '')) || 'workspace';\n return path.join(cwd, sourceName);\n }\n\n private async createHydratedWorkdir(sourceRoot: string, runId?: string): Promise<string> {\n const safeRun = (runId ?? 'run').replace(/[^a-zA-Z0-9._-]+/gu, '_');\n await mkdir(this.workRoot, { recursive: true });\n const cwd = await mkdtemp(path.join(this.workRoot, `${safeRun}-hydrated-`));\n const workspaceDir = path.join(cwd, path.basename(sourceRoot.replace(/[\\\\/]+$/u, '')) || 'workspace');\n await mkdir(workspaceDir, { recursive: true });\n return workspaceDir;\n }\n\n private createManifest(\n workspace: string,\n cwd: string,\n projection: SolidFsProjection,\n snapshots: FileSnapshot[],\n ): SolidFsManifest {\n const source = sourceForProjection(projection, workspace);\n return {\n workspace,\n cwd,\n projection,\n entries: snapshots.map((snapshot): SolidFsManifestEntry => ({\n path: snapshot.relativePath,\n resource: resolveWorkspaceResource(workspace, snapshot.relativePath),\n source,\n sourcePath: snapshot.absolutePath,\n projection,\n sourceVersion: snapshot.version,\n workingVersion: snapshot.version,\n state: 'clean',\n })),\n };\n }\n\n private async assertSourceDirectory(sourceRoot: string): Promise<void> {\n let sourceStat;\n try {\n sourceStat = await stat(sourceRoot);\n } catch (error: any) {\n if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') {\n throw new Error(`SolidFS workspace does not exist: ${sourceRoot}`);\n }\n throw error;\n }\n\n if (!sourceStat.isDirectory()) {\n throw new Error(`SolidFS workspace is not a directory: ${sourceRoot}`);\n }\n }\n\n}\n\ninterface LocalMaterializedWorkspaceOptions {\n sourceRoot: string;\n cwd: string;\n projection: SolidFsProjection;\n cleanupOnRollback: boolean;\n manifest: SolidFsManifest;\n changeFilter?: (relativePath: string) => boolean;\n context?: unknown;\n syncer?: SolidFsSyncer;\n hydrator?: SolidFsHydrator;\n}\n\nclass LocalMaterializedWorkspace implements MaterializedWorkspace {\n public readonly cwd: string;\n public readonly manifest: SolidFsManifest;\n\n private readonly sourceRoot: string;\n private readonly projection: SolidFsProjection;\n private readonly cleanupOnRollback: boolean;\n private readonly changeFilter?: (relativePath: string) => boolean;\n private readonly context?: unknown;\n private readonly syncer?: SolidFsSyncer;\n private readonly hydrator?: SolidFsHydrator;\n private readonly entrySource: SolidFsEntrySource;\n\n public constructor(options: LocalMaterializedWorkspaceOptions) {\n this.sourceRoot = options.sourceRoot;\n this.cwd = options.cwd;\n this.projection = options.projection;\n this.cleanupOnRollback = options.cleanupOnRollback;\n this.manifest = options.manifest;\n this.changeFilter = options.changeFilter;\n this.context = options.context;\n this.syncer = options.syncer;\n this.hydrator = options.hydrator;\n this.entrySource = sourceForProjection(this.projection, this.manifest.workspace);\n }\n\n public async commit(): Promise<SolidFsManifest> {\n if (this.projection === 'hydrated-object') {\n return this.commitHydratedObjects();\n }\n\n const changes = await this.detectChanges();\n this.manifest.changes = changes;\n\n if (this.projection === 'direct') {\n await this.syncChanges(changes);\n this.markCommitted();\n return this.manifest;\n }\n\n if (this.projection !== 'copy') {\n throw new Error(`Commit is not implemented for projection '${this.projection}'.`);\n }\n\n const conflicts = await this.findConflicts();\n if (conflicts.length > 0) {\n for (const entry of this.manifest.entries) {\n if (conflicts.some((conflict) => conflict.path === entry.path)) {\n entry.state = 'conflict';\n }\n }\n throw new SolidFsConflictError(conflicts);\n }\n\n await rm(this.sourceRoot, { recursive: true, force: true });\n await cp(this.cwd, this.sourceRoot, {\n recursive: true,\n force: true,\n errorOnExist: false,\n dereference: false,\n });\n await this.syncChanges(changes);\n this.markCommitted();\n return this.manifest;\n }\n\n public async rollback(): Promise<void> {\n if (this.cleanupOnRollback) {\n await rm(path.dirname(this.cwd), { recursive: true, force: true });\n }\n }\n\n public async hydrate(relativePath: string): Promise<SolidFsManifestEntry> {\n if (this.projection !== 'hydrated-object') {\n throw new Error(`hydrate() is only supported for hydrated-object projection, not '${this.projection}'`);\n }\n if (!this.hydrator) {\n throw new Error('SolidFS hydrated-object projection requires a hydrator');\n }\n\n const normalized = safeRelativePath(relativePath);\n const targetPath = path.join(this.cwd, normalized);\n await mkdir(path.dirname(targetPath), { recursive: true });\n\n const result = await this.hydrator.hydrate({\n path: normalized,\n targetPath,\n workspace: this.manifest,\n context: this.context,\n });\n\n const workingVersion = await fileVersion(targetPath);\n let entry = this.manifest.entries.find((candidate) => candidate.path === normalized);\n if (!entry) {\n entry = {\n path: normalized,\n resource: resolveWorkspaceResource(this.manifest.workspace, normalized),\n source: this.entrySource,\n sourcePath: targetPath,\n contentType: result?.contentType ?? contentTypeForPath(normalized),\n projection: this.projection,\n sourceVersion: result?.sourceVersion,\n workingVersion,\n lastAccessedAt: Date.now(),\n state: 'clean',\n };\n this.manifest.entries.push(entry);\n this.manifest.entries.sort((left, right) => left.path.localeCompare(right.path));\n return entry;\n }\n\n entry.sourcePath = targetPath;\n entry.contentType = result?.contentType ?? entry.contentType ?? contentTypeForPath(normalized);\n entry.sourceVersion = result?.sourceVersion ?? entry.sourceVersion;\n entry.workingVersion = workingVersion;\n entry.lastAccessedAt = Date.now();\n entry.state = 'clean';\n return entry;\n }\n\n public async prune(options: SolidFsPruneOptions = {}): Promise<SolidFsManifest> {\n if (this.projection !== 'hydrated-object') {\n return this.manifest;\n }\n\n const now = options.now ?? Date.now();\n const olderThanMs = options.olderThanMs ?? 0;\n const retained: SolidFsManifestEntry[] = [];\n\n for (const entry of this.manifest.entries) {\n const currentVersion = await maybeFileVersion(entry.sourcePath);\n const dirty = currentVersion !== undefined && currentVersion !== entry.workingVersion;\n if (dirty) {\n entry.state = 'dirty';\n retained.push(entry);\n continue;\n }\n\n const age = now - (entry.lastAccessedAt ?? now);\n if (age >= olderThanMs) {\n await rm(entry.sourcePath, { force: true });\n continue;\n }\n retained.push(entry);\n }\n\n this.manifest.entries = retained;\n return this.manifest;\n }\n\n private async commitHydratedObjects(): Promise<SolidFsManifest> {\n if (!this.hydrator) {\n throw new Error('SolidFS hydrated-object projection requires a hydrator');\n }\n\n const changes = await this.detectHydratedChanges();\n this.manifest.changes = changes;\n\n for (const change of changes) {\n if (change.type === 'deleted' && this.hydrator.delete) {\n await this.hydrator.delete({\n change,\n workspace: this.manifest,\n context: this.context,\n });\n this.manifest.entries = this.manifest.entries.filter((entry) => entry.path !== change.path);\n continue;\n }\n if (change.type !== 'deleted') {\n const result = await this.hydrator.commit({\n change,\n workspace: this.manifest,\n context: this.context,\n });\n const entry = this.manifest.entries.find((candidate) => candidate.path === change.path);\n if (entry) {\n entry.sourceVersion = result?.sourceVersion ?? entry.sourceVersion;\n entry.workingVersion = await fileVersion(entry.sourcePath);\n entry.lastAccessedAt = Date.now();\n }\n }\n }\n\n this.markCommitted();\n return this.manifest;\n }\n\n private async detectHydratedChanges(): Promise<SolidFsChange[]> {\n const changes: SolidFsChange[] = [];\n const tracked = new Set(this.manifest.entries.map((entry) => entry.path));\n for (const entry of this.manifest.entries) {\n const currentVersion = await maybeFileVersion(entry.sourcePath);\n if (currentVersion === undefined) {\n changes.push({\n path: entry.path,\n resource: entry.resource ?? resolveWorkspaceResource(this.manifest.workspace, entry.path),\n source: entry.source,\n sourcePath: entry.sourcePath,\n contentType: entry.contentType,\n projection: this.projection,\n type: 'deleted',\n sourceVersion: entry.sourceVersion,\n });\n entry.state = 'dirty';\n continue;\n }\n if (currentVersion !== entry.workingVersion) {\n changes.push({\n path: entry.path,\n resource: entry.resource ?? resolveWorkspaceResource(this.manifest.workspace, entry.path),\n source: entry.source,\n sourcePath: entry.sourcePath,\n contentType: entry.contentType,\n projection: this.projection,\n type: 'updated',\n sourceVersion: entry.sourceVersion,\n });\n entry.state = 'dirty';\n }\n }\n\n for (const snapshot of await snapshotDirectory(this.cwd)) {\n if (tracked.has(snapshot.relativePath)) {\n continue;\n }\n this.manifest.entries.push({\n path: snapshot.relativePath,\n resource: resolveWorkspaceResource(this.manifest.workspace, snapshot.relativePath),\n source: this.entrySource,\n sourcePath: snapshot.absolutePath,\n contentType: contentTypeForPath(snapshot.relativePath),\n projection: this.projection,\n workingVersion: snapshot.version,\n lastAccessedAt: Date.now(),\n state: 'dirty',\n });\n changes.push({\n path: snapshot.relativePath,\n resource: resolveWorkspaceResource(this.manifest.workspace, snapshot.relativePath),\n source: this.entrySource,\n sourcePath: snapshot.absolutePath,\n contentType: contentTypeForPath(snapshot.relativePath),\n projection: this.projection,\n type: 'created',\n });\n }\n this.manifest.entries.sort((left, right) => left.path.localeCompare(right.path));\n return changes.sort((left, right) => left.path.localeCompare(right.path));\n }\n\n private async findConflicts(): Promise<SolidFsConflict[]> {\n const conflicts: SolidFsConflict[] = [];\n const initialPaths = new Set(this.manifest.entries.map((entry) => entry.path));\n\n for (const entry of this.manifest.entries) {\n if (!entry.sourceVersion) {\n continue;\n }\n const currentVersion = await maybeFileVersion(entry.sourcePath);\n if (currentVersion !== entry.sourceVersion) {\n conflicts.push({\n path: entry.path,\n sourcePath: entry.sourcePath,\n expectedVersion: entry.sourceVersion,\n actualVersion: currentVersion,\n message: 'Source file changed after workspace prepare.',\n });\n }\n }\n\n const currentSourceFiles = await snapshotDirectory(this.sourceRoot);\n for (const current of currentSourceFiles) {\n if (!initialPaths.has(current.relativePath)) {\n conflicts.push({\n path: current.relativePath,\n sourcePath: current.absolutePath,\n actualVersion: current.version,\n message: 'Source file was created after workspace prepare.',\n });\n }\n }\n return conflicts;\n }\n\n private async detectChanges(): Promise<SolidFsChange[]> {\n const before = new Map(this.manifest.entries.map((entry) => [entry.path, entry]));\n if (before.size === 0 && this.projection === 'direct' && !this.changeFilter) {\n return [];\n }\n const after = new Map((await snapshotDirectory(this.cwd, this.changeFilter)).map((snapshot) => [snapshot.relativePath, snapshot]));\n const changes: SolidFsChange[] = [];\n\n for (const [relativePath, snapshot] of after) {\n const entry = before.get(relativePath);\n if (!entry) {\n changes.push(this.createChange(relativePath, snapshot.absolutePath, 'created'));\n continue;\n }\n if (entry.sourceVersion !== snapshot.version) {\n changes.push(this.createChange(relativePath, snapshot.absolutePath, 'updated'));\n }\n }\n\n for (const [relativePath, entry] of before) {\n if (!after.has(relativePath)) {\n changes.push(this.createChange(relativePath, entry.sourcePath, 'deleted'));\n }\n }\n\n return changes.sort((left, right) => left.path.localeCompare(right.path));\n }\n\n private createChange(\n relativePath: string,\n sourcePath: string,\n type: SolidFsChange['type'],\n ): SolidFsChange {\n return {\n path: relativePath,\n resource: resolveWorkspaceResource(this.manifest.workspace, relativePath),\n source: this.entrySource,\n sourcePath,\n contentType: contentTypeForPath(relativePath),\n projection: this.projection,\n type,\n };\n }\n\n private async syncChanges(changes: SolidFsChange[]): Promise<void> {\n if (!this.syncer) {\n return;\n }\n for (const change of changes) {\n await this.syncer.sync(change, this.manifest, this.context);\n }\n }\n\n private markCommitted(): void {\n for (const entry of this.manifest.entries) {\n entry.state = 'committed';\n }\n }\n}\n\nfunction contentTypeForPath(filePath: string): string | undefined {\n const lower = filePath.toLowerCase();\n const rdfContentType = rdfContentTypeForPath(lower);\n if (rdfContentType) {\n return rdfContentType;\n }\n if (lower.endsWith('.md') || lower.endsWith('.markdown') || lower.endsWith('.mdown')) {\n return 'text/markdown';\n }\n if (lower.endsWith('.txt') || lower.endsWith('.log')) {\n return 'text/plain';\n }\n return undefined;\n}\n\nfunction sourceForProjection(projection: SolidFsProjection, workspace: string): SolidFsEntrySource {\n if (projection === 'hydrated-object') {\n return 'object';\n }\n if (/^https?:/u.test(workspace)) {\n return 'pod-http';\n }\n return 'filesystem';\n}\n\nfunction resolveWorkspaceResource(workspace: string, relativePath: string): string | undefined {\n if (path.isAbsolute(workspace)) {\n return pathToFileURL(path.join(workspace, relativePath)).href;\n }\n\n try {\n const base = new URL(workspace.endsWith('/') ? workspace : `${workspace}/`);\n const normalized = relativePath.split(path.sep).join('/');\n return new URL(normalized, base).href;\n } catch {\n return undefined;\n }\n}\n\nfunction isLineAddressableRdfPath(filePath: string): boolean {\n return isRdfPath(filePath);\n}\n\nfunction safeRelativePath(input: string): string {\n const normalized = input.split(/[\\\\/]+/u).filter((part) => part.length > 0).join(path.sep);\n if (!normalized || path.isAbsolute(input) || normalized.split(path.sep).includes('..')) {\n throw new Error(`Invalid SolidFS relative path: ${input}`);\n }\n return normalized;\n}\n\nasync function maybeFileVersion(filePath: string): Promise<string | undefined> {\n try {\n return await fileVersion(filePath);\n } catch {\n return undefined;\n }\n}\n\nasync function fileVersion(filePath: string): Promise<string> {\n const fileStat = await stat(filePath);\n const hash = createHash('sha256');\n await new Promise<void>((resolve, reject) => {\n const stream = createReadStream(filePath);\n stream.on('data', (chunk) => hash.update(chunk));\n stream.on('error', reject);\n stream.on('end', resolve);\n });\n return `${fileStat.size}:${fileStat.mtimeMs}:${hash.digest('hex')}`;\n}\n\nasync function snapshotDirectory(\n root: string,\n filter?: (relativePath: string) => boolean,\n): Promise<FileSnapshot[]> {\n const snapshots: FileSnapshot[] = [];\n\n async function walk(current: string): Promise<void> {\n let entries;\n try {\n entries = await readdir(current, { withFileTypes: true });\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const absolute = path.join(current, entry.name);\n const relative = path.relative(root, absolute);\n if (entry.isDirectory()) {\n await walk(absolute);\n continue;\n }\n if (!entry.isFile()) {\n continue;\n }\n if (filter && !filter(relative)) {\n continue;\n }\n snapshots.push({\n relativePath: relative,\n absolutePath: absolute,\n version: await fileVersion(absolute),\n });\n }\n }\n\n await walk(root);\n return snapshots.sort((left, right) => left.relativePath.localeCompare(right.relativePath));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"LocalSolidFS.js","sourceRoot":"","sources":["../../src/solidfs/LocalSolidFS.ts"],"names":[],"mappings":";;;;;;AAAA,+CAM0B;AAC1B,sDAAyB;AACzB,0DAA6B;AAE7B,mCAciB;AACjB,oEAEwC;AACxC,yDAS4B;AAQ5B,MAAa,YAAY;IAKvB,YAAmB,UAA+B,EAAE;QAClD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,mBAAI,CAAC,IAAI,CAAC,iBAAE,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC;QAC3E,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACnC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,KAA0B;QAC7C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU;YACjC,CAAC,CAAC,mBAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;YAChC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,IAAI,QAAQ,CAAC;QAEhD,MAAM,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAE7C,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,MAAM,YAAY,GAAG,YAAY;gBAC/B,CAAC,CA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jB,OAAO;QACT,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,aAAa;QACnB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAC1C,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAED,SAAS,wBAAwB,CAAC,QAAgB;IAChD,OAAO,IAAA,0CAAS,EAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import {\n cp,\n mkdir,\n mkdtemp,\n rm,\n stat,\n} from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport {\n MaterializedWorkspace,\n SolidFS,\n SolidFsChange,\n SolidFsConflict,\n SolidFsConflictError,\n SolidFsEntrySource,\n SolidFsHydrator,\n SolidFsManifest,\n SolidFsManifestEntry,\n SolidFsPrepareInput,\n SolidFsPruneOptions,\n SolidFsProjection,\n SolidFsSyncer,\n} from './types';\nimport {\n isLineAddressableRdfPath as isRdfPath,\n} from '../storage/rdf/RdfContentTypes';\nimport {\n contentTypeForPath,\n fileVersion,\n maybeFileVersion,\n resolveWorkspaceResource,\n safeRelativePath,\n snapshotDirectory,\n SolidFsFileSnapshot,\n sourceForProjection,\n} from './SolidFsPathUtils';\n\nexport interface LocalSolidFSOptions {\n workRoot?: string;\n syncer?: SolidFsSyncer;\n hydrator?: SolidFsHydrator;\n}\n\nexport class LocalSolidFS implements SolidFS {\n private readonly workRoot: string;\n private readonly syncer?: SolidFsSyncer;\n private readonly hydrator?: SolidFsHydrator;\n\n public constructor(options: LocalSolidFSOptions = {}) {\n this.workRoot = options.workRoot ?? path.join(os.tmpdir(), 'xpod-solidfs');\n this.syncer = options.syncer;\n this.hydrator = options.hydrator;\n }\n\n public async prepare(input: SolidFsPrepareInput): Promise<MaterializedWorkspace> {\n const sourceRoot = input.sourcePath\n ? path.resolve(input.sourcePath)\n : this.resolveWorkspacePath(input.workspace);\n const projection = input.projection ?? 'direct';\n\n await this.assertSourceDirectory(sourceRoot);\n\n if (projection === 'direct') {\n const trackChanges = this.syncer?.shouldTrack?.(input) ?? Boolean(this.syncer);\n const syncer = this.syncer;\n const changeFilter = trackChanges\n ? syncer?.shouldTrackPath\n ? (relativePath: string): boolean => syncer.shouldTrackPath!(relativePath)\n : isLineAddressableRdfPath\n : undefined;\n const entries = changeFilter ? await snapshotDirectory(sourceRoot, changeFilter) : [];\n const manifest = this.createManifest(input.workspace, sourceRoot, projection, entries);\n if (trackChanges && syncer?.initializeWorkspace) {\n await syncer.initializeWorkspace(manifest, input.context);\n }\n return new LocalMaterializedWorkspace({\n sourceRoot,\n cwd: sourceRoot,\n projection,\n cleanupOnRollback: false,\n manifest,\n changeFilter,\n context: input.context,\n syncer: this.syncer,\n hydrator: this.hydrator,\n });\n }\n\n if (projection === 'hydrated-object') {\n const cwd = await this.createHydratedWorkdir(sourceRoot, input.run?.id);\n return new LocalMaterializedWorkspace({\n sourceRoot,\n cwd,\n projection,\n cleanupOnRollback: true,\n manifest: this.createManifest(input.workspace, cwd, projection, []),\n context: input.context,\n hydrator: this.hydrator,\n });\n }\n\n if (projection !== 'copy') {\n throw new Error(`LocalSolidFS does not support projection '${projection}' yet.`);\n }\n\n const cwd = await this.createCopyWorkdir(sourceRoot, input.run?.id);\n const entries = await snapshotDirectory(sourceRoot);\n await cp(sourceRoot, cwd, {\n recursive: true,\n force: true,\n errorOnExist: false,\n dereference: false,\n });\n\n return new LocalMaterializedWorkspace({\n sourceRoot,\n cwd,\n projection,\n cleanupOnRollback: true,\n manifest: this.createManifest(input.workspace, cwd, projection, entries),\n context: input.context,\n syncer: this.syncer,\n hydrator: this.hydrator,\n });\n }\n\n private resolveWorkspacePath(workspace: string): string {\n if (workspace.startsWith('file://')) {\n const url = new URL(workspace);\n const pathname = decodeURIComponent(url.pathname);\n if (process.platform === 'win32' && /^\\/[A-Za-z]:/.test(pathname)) {\n return pathname.slice(1);\n }\n return pathname;\n }\n\n if (path.isAbsolute(workspace)) {\n return workspace;\n }\n\n throw new Error(`Unsupported workspace '${workspace}'. LocalSolidFS expects file:// or absolute paths.`);\n }\n\n private async createCopyWorkdir(sourceRoot: string, runId?: string): Promise<string> {\n const safeRun = (runId ?? 'run').replace(/[^a-zA-Z0-9._-]+/gu, '_');\n const prefix = path.join(this.workRoot, `${safeRun}-`);\n await mkdir(this.workRoot, { recursive: true });\n const cwd = await mkdtemp(prefix);\n\n const sourceName = path.basename(sourceRoot.replace(/[\\\\/]+$/u, '')) || 'workspace';\n return path.join(cwd, sourceName);\n }\n\n private async createHydratedWorkdir(sourceRoot: string, runId?: string): Promise<string> {\n const safeRun = (runId ?? 'run').replace(/[^a-zA-Z0-9._-]+/gu, '_');\n await mkdir(this.workRoot, { recursive: true });\n const cwd = await mkdtemp(path.join(this.workRoot, `${safeRun}-hydrated-`));\n const workspaceDir = path.join(cwd, path.basename(sourceRoot.replace(/[\\\\/]+$/u, '')) || 'workspace');\n await mkdir(workspaceDir, { recursive: true });\n return workspaceDir;\n }\n\n private createManifest(\n workspace: string,\n cwd: string,\n projection: SolidFsProjection,\n snapshots: SolidFsFileSnapshot[],\n ): SolidFsManifest {\n const source = sourceForProjection(projection, workspace);\n return {\n workspace,\n cwd,\n projection,\n entries: snapshots.map((snapshot): SolidFsManifestEntry => ({\n path: snapshot.relativePath,\n resource: resolveWorkspaceResource(workspace, snapshot.relativePath),\n source,\n sourcePath: snapshot.absolutePath,\n projection,\n sourceVersion: snapshot.version,\n workingVersion: snapshot.version,\n state: 'clean',\n })),\n };\n }\n\n private async assertSourceDirectory(sourceRoot: string): Promise<void> {\n let sourceStat;\n try {\n sourceStat = await stat(sourceRoot);\n } catch (error: any) {\n if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') {\n throw new Error(`SolidFS workspace does not exist: ${sourceRoot}`);\n }\n throw error;\n }\n\n if (!sourceStat.isDirectory()) {\n throw new Error(`SolidFS workspace is not a directory: ${sourceRoot}`);\n }\n }\n\n}\n\ninterface LocalMaterializedWorkspaceOptions {\n sourceRoot: string;\n cwd: string;\n projection: SolidFsProjection;\n cleanupOnRollback: boolean;\n manifest: SolidFsManifest;\n changeFilter?: (relativePath: string) => boolean;\n context?: unknown;\n syncer?: SolidFsSyncer;\n hydrator?: SolidFsHydrator;\n}\n\nclass LocalMaterializedWorkspace implements MaterializedWorkspace {\n public readonly cwd: string;\n public readonly manifest: SolidFsManifest;\n\n private readonly sourceRoot: string;\n private readonly projection: SolidFsProjection;\n private readonly cleanupOnRollback: boolean;\n private readonly changeFilter?: (relativePath: string) => boolean;\n private readonly context?: unknown;\n private readonly syncer?: SolidFsSyncer;\n private readonly hydrator?: SolidFsHydrator;\n private readonly entrySource: SolidFsEntrySource;\n\n public constructor(options: LocalMaterializedWorkspaceOptions) {\n this.sourceRoot = options.sourceRoot;\n this.cwd = options.cwd;\n this.projection = options.projection;\n this.cleanupOnRollback = options.cleanupOnRollback;\n this.manifest = options.manifest;\n this.changeFilter = options.changeFilter;\n this.context = options.context;\n this.syncer = options.syncer;\n this.hydrator = options.hydrator;\n this.entrySource = sourceForProjection(this.projection, this.manifest.workspace);\n }\n\n public async commit(): Promise<SolidFsManifest> {\n if (this.projection === 'hydrated-object') {\n return this.commitHydratedObjects();\n }\n\n const changes = await this.detectChanges();\n this.manifest.changes = changes;\n\n if (this.projection === 'direct') {\n await this.syncChanges(changes);\n this.markCommitted();\n return this.manifest;\n }\n\n if (this.projection !== 'copy') {\n throw new Error(`Commit is not implemented for projection '${this.projection}'.`);\n }\n\n const conflicts = await this.findConflicts();\n if (conflicts.length > 0) {\n for (const entry of this.manifest.entries) {\n if (conflicts.some((conflict) => conflict.path === entry.path)) {\n entry.state = 'conflict';\n }\n }\n throw new SolidFsConflictError(conflicts);\n }\n\n await rm(this.sourceRoot, { recursive: true, force: true });\n await cp(this.cwd, this.sourceRoot, {\n recursive: true,\n force: true,\n errorOnExist: false,\n dereference: false,\n });\n await this.syncChanges(changes);\n this.markCommitted();\n return this.manifest;\n }\n\n public async rollback(): Promise<void> {\n if (this.cleanupOnRollback) {\n await rm(path.dirname(this.cwd), { recursive: true, force: true });\n }\n }\n\n public async hydrate(relativePath: string): Promise<SolidFsManifestEntry> {\n if (this.projection !== 'hydrated-object') {\n throw new Error(`hydrate() is only supported for hydrated-object projection, not '${this.projection}'`);\n }\n if (!this.hydrator) {\n throw new Error('SolidFS hydrated-object projection requires a hydrator');\n }\n\n const normalized = safeRelativePath(relativePath);\n const targetPath = path.join(this.cwd, normalized);\n await mkdir(path.dirname(targetPath), { recursive: true });\n\n const result = await this.hydrator.hydrate({\n path: normalized,\n targetPath,\n workspace: this.manifest,\n context: this.context,\n });\n\n const workingVersion = await fileVersion(targetPath);\n let entry = this.manifest.entries.find((candidate) => candidate.path === normalized);\n if (!entry) {\n entry = {\n path: normalized,\n resource: resolveWorkspaceResource(this.manifest.workspace, normalized),\n source: this.entrySource,\n sourcePath: targetPath,\n contentType: result?.contentType ?? contentTypeForPath(normalized),\n projection: this.projection,\n sourceVersion: result?.sourceVersion,\n workingVersion,\n lastAccessedAt: Date.now(),\n state: 'clean',\n };\n this.manifest.entries.push(entry);\n this.manifest.entries.sort((left, right) => left.path.localeCompare(right.path));\n return entry;\n }\n\n entry.sourcePath = targetPath;\n entry.contentType = result?.contentType ?? entry.contentType ?? contentTypeForPath(normalized);\n entry.sourceVersion = result?.sourceVersion ?? entry.sourceVersion;\n entry.workingVersion = workingVersion;\n entry.lastAccessedAt = Date.now();\n entry.state = 'clean';\n return entry;\n }\n\n public async prune(options: SolidFsPruneOptions = {}): Promise<SolidFsManifest> {\n if (this.projection !== 'hydrated-object') {\n return this.manifest;\n }\n\n const now = options.now ?? Date.now();\n const olderThanMs = options.olderThanMs ?? 0;\n const retained: SolidFsManifestEntry[] = [];\n\n for (const entry of this.manifest.entries) {\n const currentVersion = await maybeFileVersion(entry.sourcePath);\n const dirty = currentVersion !== undefined && currentVersion !== entry.workingVersion;\n if (dirty) {\n entry.state = 'dirty';\n retained.push(entry);\n continue;\n }\n\n const age = now - (entry.lastAccessedAt ?? now);\n if (age >= olderThanMs) {\n await rm(entry.sourcePath, { force: true });\n continue;\n }\n retained.push(entry);\n }\n\n this.manifest.entries = retained;\n return this.manifest;\n }\n\n private async commitHydratedObjects(): Promise<SolidFsManifest> {\n if (!this.hydrator) {\n throw new Error('SolidFS hydrated-object projection requires a hydrator');\n }\n\n const changes = await this.detectHydratedChanges();\n this.manifest.changes = changes;\n\n for (const change of changes) {\n if (change.type === 'deleted' && this.hydrator.delete) {\n await this.hydrator.delete({\n change,\n workspace: this.manifest,\n context: this.context,\n });\n this.manifest.entries = this.manifest.entries.filter((entry) => entry.path !== change.path);\n continue;\n }\n if (change.type !== 'deleted') {\n const result = await this.hydrator.commit({\n change,\n workspace: this.manifest,\n context: this.context,\n });\n const entry = this.manifest.entries.find((candidate) => candidate.path === change.path);\n if (entry) {\n entry.sourceVersion = result?.sourceVersion ?? entry.sourceVersion;\n entry.workingVersion = await fileVersion(entry.sourcePath);\n entry.lastAccessedAt = Date.now();\n }\n }\n }\n\n this.markCommitted();\n return this.manifest;\n }\n\n private async detectHydratedChanges(): Promise<SolidFsChange[]> {\n const changes: SolidFsChange[] = [];\n const tracked = new Set(this.manifest.entries.map((entry) => entry.path));\n for (const entry of this.manifest.entries) {\n const currentVersion = await maybeFileVersion(entry.sourcePath);\n if (currentVersion === undefined) {\n changes.push({\n path: entry.path,\n resource: entry.resource ?? resolveWorkspaceResource(this.manifest.workspace, entry.path),\n source: entry.source,\n sourcePath: entry.sourcePath,\n contentType: entry.contentType,\n projection: this.projection,\n type: 'deleted',\n sourceVersion: entry.sourceVersion,\n });\n entry.state = 'dirty';\n continue;\n }\n if (currentVersion !== entry.workingVersion) {\n changes.push({\n path: entry.path,\n resource: entry.resource ?? resolveWorkspaceResource(this.manifest.workspace, entry.path),\n source: entry.source,\n sourcePath: entry.sourcePath,\n contentType: entry.contentType,\n projection: this.projection,\n type: 'updated',\n sourceVersion: entry.sourceVersion,\n });\n entry.state = 'dirty';\n }\n }\n\n for (const snapshot of await snapshotDirectory(this.cwd)) {\n if (tracked.has(snapshot.relativePath)) {\n continue;\n }\n this.manifest.entries.push({\n path: snapshot.relativePath,\n resource: resolveWorkspaceResource(this.manifest.workspace, snapshot.relativePath),\n source: this.entrySource,\n sourcePath: snapshot.absolutePath,\n contentType: contentTypeForPath(snapshot.relativePath),\n projection: this.projection,\n workingVersion: snapshot.version,\n lastAccessedAt: Date.now(),\n state: 'dirty',\n });\n changes.push({\n path: snapshot.relativePath,\n resource: resolveWorkspaceResource(this.manifest.workspace, snapshot.relativePath),\n source: this.entrySource,\n sourcePath: snapshot.absolutePath,\n contentType: contentTypeForPath(snapshot.relativePath),\n projection: this.projection,\n type: 'created',\n });\n }\n this.manifest.entries.sort((left, right) => left.path.localeCompare(right.path));\n return changes.sort((left, right) => left.path.localeCompare(right.path));\n }\n\n private async findConflicts(): Promise<SolidFsConflict[]> {\n const conflicts: SolidFsConflict[] = [];\n const initialPaths = new Set(this.manifest.entries.map((entry) => entry.path));\n\n for (const entry of this.manifest.entries) {\n if (!entry.sourceVersion) {\n continue;\n }\n const currentVersion = await maybeFileVersion(entry.sourcePath);\n if (currentVersion !== entry.sourceVersion) {\n conflicts.push({\n path: entry.path,\n sourcePath: entry.sourcePath,\n expectedVersion: entry.sourceVersion,\n actualVersion: currentVersion,\n message: 'Source file changed after workspace prepare.',\n });\n }\n }\n\n const currentSourceFiles = await snapshotDirectory(this.sourceRoot);\n for (const current of currentSourceFiles) {\n if (!initialPaths.has(current.relativePath)) {\n conflicts.push({\n path: current.relativePath,\n sourcePath: current.absolutePath,\n actualVersion: current.version,\n message: 'Source file was created after workspace prepare.',\n });\n }\n }\n return conflicts;\n }\n\n private async detectChanges(): Promise<SolidFsChange[]> {\n const before = new Map(this.manifest.entries.map((entry) => [entry.path, entry]));\n if (before.size === 0 && this.projection === 'direct' && !this.changeFilter) {\n return [];\n }\n const after = new Map((await snapshotDirectory(this.cwd, this.changeFilter)).map((snapshot) => [snapshot.relativePath, snapshot]));\n const changes: SolidFsChange[] = [];\n\n for (const [relativePath, snapshot] of after) {\n const entry = before.get(relativePath);\n if (!entry) {\n changes.push(this.createChange(relativePath, snapshot.absolutePath, 'created'));\n continue;\n }\n if (entry.sourceVersion !== snapshot.version) {\n changes.push(this.createChange(relativePath, snapshot.absolutePath, 'updated'));\n }\n }\n\n for (const [relativePath, entry] of before) {\n if (!after.has(relativePath)) {\n changes.push(this.createChange(relativePath, entry.sourcePath, 'deleted'));\n }\n }\n\n return changes.sort((left, right) => left.path.localeCompare(right.path));\n }\n\n private createChange(\n relativePath: string,\n sourcePath: string,\n type: SolidFsChange['type'],\n ): SolidFsChange {\n return {\n path: relativePath,\n resource: resolveWorkspaceResource(this.manifest.workspace, relativePath),\n source: this.entrySource,\n sourcePath,\n contentType: contentTypeForPath(relativePath),\n projection: this.projection,\n type,\n };\n }\n\n private async syncChanges(changes: SolidFsChange[]): Promise<void> {\n if (!this.syncer) {\n return;\n }\n for (const change of changes) {\n await this.syncer.sync(change, this.manifest, this.context);\n }\n }\n\n private markCommitted(): void {\n for (const entry of this.manifest.entries) {\n entry.state = 'committed';\n }\n }\n}\n\nfunction isLineAddressableRdfPath(filePath: string): boolean {\n return isRdfPath(filePath);\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SolidFsEntrySource, SolidFsProjection } from './types';
|
|
2
|
+
export interface SolidFsFileSnapshot {
|
|
3
|
+
relativePath: string;
|
|
4
|
+
absolutePath: string;
|
|
5
|
+
version: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function contentTypeForPath(filePath: string): string | undefined;
|
|
8
|
+
export declare function sourceForProjection(projection: SolidFsProjection, workspace: string): SolidFsEntrySource;
|
|
9
|
+
export declare function resolveWorkspaceResource(workspace: string, relativePath: string): string | undefined;
|
|
10
|
+
export declare function safeRelativePath(input: string): string;
|
|
11
|
+
export declare function maybeFileVersion(filePath: string): Promise<string | undefined>;
|
|
12
|
+
export declare function fileVersion(filePath: string): Promise<string>;
|
|
13
|
+
export declare function snapshotDirectory(root: string, filter?: (relativePath: string) => boolean): Promise<SolidFsFileSnapshot[]>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.contentTypeForPath = contentTypeForPath;
|
|
7
|
+
exports.sourceForProjection = sourceForProjection;
|
|
8
|
+
exports.resolveWorkspaceResource = resolveWorkspaceResource;
|
|
9
|
+
exports.safeRelativePath = safeRelativePath;
|
|
10
|
+
exports.maybeFileVersion = maybeFileVersion;
|
|
11
|
+
exports.fileVersion = fileVersion;
|
|
12
|
+
exports.snapshotDirectory = snapshotDirectory;
|
|
13
|
+
const node_crypto_1 = require("node:crypto");
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
15
|
+
const promises_1 = require("node:fs/promises");
|
|
16
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
+
const node_url_1 = require("node:url");
|
|
18
|
+
const RdfContentTypes_1 = require("../storage/rdf/RdfContentTypes");
|
|
19
|
+
function contentTypeForPath(filePath) {
|
|
20
|
+
const lower = filePath.toLowerCase();
|
|
21
|
+
const rdfContentType = (0, RdfContentTypes_1.rdfContentTypeForPath)(lower);
|
|
22
|
+
if (rdfContentType) {
|
|
23
|
+
return rdfContentType;
|
|
24
|
+
}
|
|
25
|
+
if (lower.endsWith('.md') || lower.endsWith('.markdown') || lower.endsWith('.mdown')) {
|
|
26
|
+
return 'text/markdown';
|
|
27
|
+
}
|
|
28
|
+
if (lower.endsWith('.txt') || lower.endsWith('.log')) {
|
|
29
|
+
return 'text/plain';
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
function sourceForProjection(projection, workspace) {
|
|
34
|
+
if (projection === 'hydrated-object') {
|
|
35
|
+
return 'object';
|
|
36
|
+
}
|
|
37
|
+
if (/^https?:/u.test(workspace)) {
|
|
38
|
+
return 'pod-http';
|
|
39
|
+
}
|
|
40
|
+
return 'filesystem';
|
|
41
|
+
}
|
|
42
|
+
function resolveWorkspaceResource(workspace, relativePath) {
|
|
43
|
+
if (node_path_1.default.isAbsolute(workspace)) {
|
|
44
|
+
return (0, node_url_1.pathToFileURL)(node_path_1.default.join(workspace, relativePath)).href;
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
const base = new URL(workspace.endsWith('/') ? workspace : `${workspace}/`);
|
|
48
|
+
const normalized = relativePath.split(node_path_1.default.sep).join('/');
|
|
49
|
+
return new URL(normalized, base).href;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function safeRelativePath(input) {
|
|
56
|
+
const normalized = input.split(/[\\/]+/u).filter((part) => part.length > 0).join(node_path_1.default.sep);
|
|
57
|
+
if (!normalized || node_path_1.default.isAbsolute(input) || normalized.split(node_path_1.default.sep).includes('..')) {
|
|
58
|
+
throw new Error(`Invalid SolidFS relative path: ${input}`);
|
|
59
|
+
}
|
|
60
|
+
return normalized;
|
|
61
|
+
}
|
|
62
|
+
async function maybeFileVersion(filePath) {
|
|
63
|
+
try {
|
|
64
|
+
return await fileVersion(filePath);
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function fileVersion(filePath) {
|
|
71
|
+
const fileStat = await (0, promises_1.stat)(filePath);
|
|
72
|
+
const hash = (0, node_crypto_1.createHash)('sha256');
|
|
73
|
+
await new Promise((resolve, reject) => {
|
|
74
|
+
const stream = (0, node_fs_1.createReadStream)(filePath);
|
|
75
|
+
stream.on('data', (chunk) => hash.update(chunk));
|
|
76
|
+
stream.on('error', reject);
|
|
77
|
+
stream.on('end', resolve);
|
|
78
|
+
});
|
|
79
|
+
return `${fileStat.size}:${fileStat.mtimeMs}:${hash.digest('hex')}`;
|
|
80
|
+
}
|
|
81
|
+
async function snapshotDirectory(root, filter) {
|
|
82
|
+
const snapshots = [];
|
|
83
|
+
async function walk(current) {
|
|
84
|
+
let entries;
|
|
85
|
+
try {
|
|
86
|
+
entries = await (0, promises_1.readdir)(current, { withFileTypes: true });
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
for (const entry of entries) {
|
|
92
|
+
const absolute = node_path_1.default.join(current, entry.name);
|
|
93
|
+
const relative = node_path_1.default.relative(root, absolute);
|
|
94
|
+
if (entry.isDirectory()) {
|
|
95
|
+
await walk(absolute);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (!entry.isFile()) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (filter && !filter(relative)) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
snapshots.push({
|
|
105
|
+
relativePath: relative,
|
|
106
|
+
absolutePath: absolute,
|
|
107
|
+
version: await fileVersion(absolute),
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
await walk(root);
|
|
112
|
+
return snapshots.sort((left, right) => left.relativePath.localeCompare(right.relativePath));
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=SolidFsPathUtils.js.map
|