@rdfx/git 0.0.34 → 0.0.36
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/dist/AbstractVersionedRdfFileGraphStore.d.ts +4 -3
- package/dist/AbstractVersionedRdfFileGraphStore.js +6 -3
- package/package.json +3 -3
- package/dist/AbstractGitGraphStore.d.ts +0 -28
- package/dist/AbstractGitGraphStore.js +0 -28
- package/dist/GitDirectoryGraphStore.d.ts +0 -7
- package/dist/GitDirectoryGraphStore.js +0 -6
- package/dist/GitFileSystem.d.ts +0 -15
- package/dist/GitFileSystem.js +0 -30
- package/dist/GitGraphStore copy.d.ts +0 -7
- package/dist/GitGraphStore copy.js +0 -6
- package/dist/GitGraphStore.d.ts +0 -7
- package/dist/GitGraphStore.js +0 -6
- package/dist/GitVersionedGraphStore.d.ts +0 -2
- package/dist/GitVersionedGraphStore.js +0 -2
- package/dist/VersionedFileSystem.d.ts +0 -35
- package/dist/VersionedFileSystem.js +0 -79
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Stream } from "@rdfjs/types";
|
|
1
|
+
import type { DatasetCore, Stream } from "@rdfjs/types";
|
|
2
2
|
import { type FileSystem, type RdfDirectoryGraphStore, type RdfFileGraphStore } from "@rdfx/fs";
|
|
3
3
|
import type { GraphIdentifier, VersionedGraphStore } from "@rdfx/graph-store";
|
|
4
4
|
import * as git from "isomorphic-git";
|
|
@@ -21,7 +21,6 @@ export declare abstract class AbstractVersionedRdfFileGraphStore implements Vers
|
|
|
21
21
|
get(identifier: GraphIdentifier, options?: {
|
|
22
22
|
readonly version?: string;
|
|
23
23
|
}): Promise<Either<Error, Maybe<Stream>>>;
|
|
24
|
-
protected abstract getVersion(identifier: GraphIdentifier, version: string): Promise<Either<Error, Maybe<Stream>>>;
|
|
25
24
|
head(identifier: GraphIdentifier, options?: {
|
|
26
25
|
readonly version?: string;
|
|
27
26
|
}): Promise<Either<Error, boolean>>;
|
|
@@ -33,11 +32,13 @@ export declare abstract class AbstractVersionedRdfFileGraphStore implements Vers
|
|
|
33
32
|
put(quads: Stream): Promise<Either<Error, {
|
|
34
33
|
readonly version: string;
|
|
35
34
|
}>>;
|
|
35
|
+
unionDataset(): Promise<Either<Error, DatasetCore>>;
|
|
36
36
|
protected abstract delegate(options?: {
|
|
37
37
|
fileSystem?: FileSystem;
|
|
38
38
|
}): RdfDirectoryGraphStore | RdfFileGraphStore;
|
|
39
|
-
|
|
39
|
+
protected abstract getVersion(identifier: GraphIdentifier, version: string): Promise<Either<Error, Maybe<Stream>>>;
|
|
40
40
|
protected gitRelativeFilePath(path: string): string;
|
|
41
|
+
private mutate;
|
|
41
42
|
}
|
|
42
43
|
type GitParameters = {
|
|
43
44
|
readonly author?: Parameters<typeof git.commit>[0]["author"];
|
|
@@ -54,6 +54,12 @@ export class AbstractVersionedRdfFileGraphStore {
|
|
|
54
54
|
async put(quads) {
|
|
55
55
|
return this.mutate((delegate) => delegate.put(quads));
|
|
56
56
|
}
|
|
57
|
+
async unionDataset() {
|
|
58
|
+
return this.delegate().unionDataset();
|
|
59
|
+
}
|
|
60
|
+
gitRelativeFilePath(path) {
|
|
61
|
+
return relative(this.gitParameters.dir, path);
|
|
62
|
+
}
|
|
57
63
|
async mutate(mutator) {
|
|
58
64
|
return EitherAsync(async ({ liftEither }) => {
|
|
59
65
|
const addedFilePaths = [];
|
|
@@ -146,8 +152,5 @@ export class AbstractVersionedRdfFileGraphStore {
|
|
|
146
152
|
return { version: objectId };
|
|
147
153
|
});
|
|
148
154
|
}
|
|
149
|
-
gitRelativeFilePath(path) {
|
|
150
|
-
return relative(this.gitParameters.dir, path);
|
|
151
|
-
}
|
|
152
155
|
}
|
|
153
156
|
//# sourceMappingURL=AbstractVersionedRdfFileGraphStore.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@rdfx/fs": "0.0.
|
|
4
|
-
"@rdfx/graph-store": "0.0.
|
|
3
|
+
"@rdfx/fs": "0.0.36",
|
|
4
|
+
"@rdfx/graph-store": "0.0.36",
|
|
5
5
|
"isomorphic-git": "~1.38.3",
|
|
6
6
|
"ts-log": "~3.0.2",
|
|
7
7
|
"typescript-memoize": "~1.1.1"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
},
|
|
31
31
|
"type": "module",
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
|
-
"version": "0.0.
|
|
33
|
+
"version": "0.0.36"
|
|
34
34
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Stream } from "@rdfjs/types";
|
|
2
|
-
import type { GraphIdentifier, GraphStore, VersionedGraphStore } from "@rdfx/graph-store";
|
|
3
|
-
import type { Either, Maybe } from "purify-ts";
|
|
4
|
-
export declare abstract class AbstractGitGraphStore implements VersionedGraphStore<string> {
|
|
5
|
-
constructor(path: string, {}: {});
|
|
6
|
-
clear(options?: object | undefined): Promise<Either<Error, {
|
|
7
|
-
readonly version: string;
|
|
8
|
-
}>>;
|
|
9
|
-
delete(identifier: GraphIdentifier, options?: object | undefined): Promise<Either<Error, {
|
|
10
|
-
readonly version: string;
|
|
11
|
-
}>>;
|
|
12
|
-
get(identifier: GraphIdentifier, options?: {
|
|
13
|
-
readonly version?: string | undefined;
|
|
14
|
-
} | undefined): Promise<Either<Error, Maybe<Stream>>>;
|
|
15
|
-
head(identifier: GraphIdentifier, options?: {
|
|
16
|
-
readonly version?: string | undefined;
|
|
17
|
-
} | undefined): Promise<Either<Error, boolean>>;
|
|
18
|
-
identifiers(): Promise<Either<Error, readonly GraphIdentifier[]>>;
|
|
19
|
-
isEmpty(): Promise<Either<Error, boolean>>;
|
|
20
|
-
post(quads: Stream, options?: object | undefined): Promise<Either<Error, {
|
|
21
|
-
readonly version: string;
|
|
22
|
-
}>>;
|
|
23
|
-
put(quads: Stream, options?: object | undefined): Promise<Either<Error, {
|
|
24
|
-
readonly version: string;
|
|
25
|
-
}>>;
|
|
26
|
-
protected abstract readonly delegate: GraphStore;
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=AbstractGitGraphStore.d.ts.map
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export class AbstractGitGraphStore {
|
|
2
|
-
constructor(path, {}) { }
|
|
3
|
-
clear(options) {
|
|
4
|
-
throw new Error("Method not implemented.");
|
|
5
|
-
}
|
|
6
|
-
delete(identifier, options) {
|
|
7
|
-
throw new Error("Method not implemented.");
|
|
8
|
-
}
|
|
9
|
-
get(identifier, options) {
|
|
10
|
-
throw new Error("Method not implemented.");
|
|
11
|
-
}
|
|
12
|
-
head(identifier, options) {
|
|
13
|
-
throw new Error("Method not implemented.");
|
|
14
|
-
}
|
|
15
|
-
identifiers() {
|
|
16
|
-
throw new Error("Method not implemented.");
|
|
17
|
-
}
|
|
18
|
-
isEmpty() {
|
|
19
|
-
throw new Error("Method not implemented.");
|
|
20
|
-
}
|
|
21
|
-
post(quads, options) {
|
|
22
|
-
throw new Error("Method not implemented.");
|
|
23
|
-
}
|
|
24
|
-
put(quads, options) {
|
|
25
|
-
throw new Error("Method not implemented.");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=AbstractGitGraphStore.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { RdfDirectoryGraphStore, RdfFileGraphStore } from "@rdfx/fs";
|
|
2
|
-
import type { VersionedGraphStore } from "@rdfx/graph-store";
|
|
3
|
-
export type GitGraphStore = VersionedGraphStore<string>;
|
|
4
|
-
export declare namespace GitGraphStore {
|
|
5
|
-
function wrap(delegate: RdfDirectoryGraphStore | RdfFileGraphStore): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=GitDirectoryGraphStore.d.ts.map
|
package/dist/GitFileSystem.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Writable } from "node:stream";
|
|
2
|
-
import { NodeFileSystem } from "@rdfx/fs";
|
|
3
|
-
import { type Either } from "purify-ts";
|
|
4
|
-
/**
|
|
5
|
-
* FileSystem implementation that git adds/removes files that are written or deleted successfully from the underlying node:fs.
|
|
6
|
-
*/
|
|
7
|
-
export declare class GitFileSystem extends NodeFileSystem {
|
|
8
|
-
private readonly gitParameters;
|
|
9
|
-
constructor({ dir, gitdir, }: {
|
|
10
|
-
dir: string;
|
|
11
|
-
gitdir?: string;
|
|
12
|
-
});
|
|
13
|
-
writeFileStream<ReturnT>(path: string, write: (stream: Writable) => Promise<Either<Error, ReturnT>>): Promise<Either<Error, ReturnT>>;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=GitFileSystem.d.ts.map
|
package/dist/GitFileSystem.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { relative } from "node:path";
|
|
3
|
-
import { NodeFileSystem } from "@rdfx/fs";
|
|
4
|
-
import * as git from "isomorphic-git";
|
|
5
|
-
import { EitherAsync } from "purify-ts";
|
|
6
|
-
/**
|
|
7
|
-
* FileSystem implementation that git adds/removes files that are written or deleted successfully from the underlying node:fs.
|
|
8
|
-
*/
|
|
9
|
-
export class GitFileSystem extends NodeFileSystem {
|
|
10
|
-
gitParameters;
|
|
11
|
-
constructor({ dir, gitdir, }) {
|
|
12
|
-
super();
|
|
13
|
-
this.gitParameters = {
|
|
14
|
-
dir,
|
|
15
|
-
fs: fs.promises,
|
|
16
|
-
gitdir,
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
async writeFileStream(path, write) {
|
|
20
|
-
return EitherAsync(async ({ liftEither }) => {
|
|
21
|
-
const result = await liftEither(await super.writeFileStream(path, write));
|
|
22
|
-
await git.add({
|
|
23
|
-
...this.gitParameters,
|
|
24
|
-
filepath: relative(this.gitParameters.dir, path),
|
|
25
|
-
});
|
|
26
|
-
return result;
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=GitFileSystem.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { RdfDirectoryGraphStore, RdfFileGraphStore } from "@rdfx/fs";
|
|
2
|
-
import type { VersionedGraphStore } from "@rdfx/graph-store";
|
|
3
|
-
export type GitGraphStore = VersionedGraphStore<string>;
|
|
4
|
-
export declare namespace GitGraphStore {
|
|
5
|
-
function wrap(delegate: RdfDirectoryGraphStore | RdfFileGraphStore): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=GitGraphStore%20copy.d.ts.map
|
package/dist/GitGraphStore.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { RdfDirectoryGraphStore, RdfFileGraphStore } from "@rdfx/fs";
|
|
2
|
-
import type { VersionedGraphStore } from "@rdfx/graph-store";
|
|
3
|
-
export type GitGraphStore = VersionedGraphStore<string>;
|
|
4
|
-
export declare namespace GitGraphStore {
|
|
5
|
-
function wrap(delegate: RdfDirectoryGraphStore | RdfFileGraphStore): void;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=GitGraphStore.d.ts.map
|
package/dist/GitGraphStore.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Readable, Writable } from "node:stream";
|
|
2
|
-
import type { Dirent, ErrnoException, FileSystem, Stat } from "@rdfx/fs";
|
|
3
|
-
import * as git from "isomorphic-git";
|
|
4
|
-
import { type Either } from "purify-ts";
|
|
5
|
-
/**
|
|
6
|
-
* FileSystem implementation that git adds/removes files that are written or deleted successfully from the underlying node:fs.
|
|
7
|
-
*/
|
|
8
|
-
export declare class VersionedFileSystem implements FileSystem {
|
|
9
|
-
private readonly delegate;
|
|
10
|
-
readonly gitParameters: VersionedFileSystem.GitParameters & {
|
|
11
|
-
readonly fs: git.PromiseFsClient;
|
|
12
|
-
};
|
|
13
|
-
constructor({ delegate, gitParameters, }: {
|
|
14
|
-
delegate: FileSystem;
|
|
15
|
-
gitParameters: VersionedFileSystem.GitParameters;
|
|
16
|
-
});
|
|
17
|
-
createDirectory(path: string, options?: FileSystem.CreateDirectoryOptions): Promise<Either<ErrnoException, void>>;
|
|
18
|
-
createReadStream(path: string): Readable;
|
|
19
|
-
deleteDirectory(path: string, options?: FileSystem.DeleteDirectoryOptions): Promise<Either<ErrnoException, void>>;
|
|
20
|
-
deleteFile(path: string, options?: FileSystem.DeleteFileOptions): Promise<Either<ErrnoException, void>>;
|
|
21
|
-
gitRelativeFilePath(path: string): string;
|
|
22
|
-
readDirectory(path: string, options?: FileSystem.ReadDirectoryOptions): Promise<Either<ErrnoException, readonly Dirent[]>>;
|
|
23
|
-
readFile(path: string): Promise<Either<ErrnoException, Uint8Array>>;
|
|
24
|
-
realpath(path: string): Promise<Either<ErrnoException, string>>;
|
|
25
|
-
stat(path: string): Promise<Either<ErrnoException, Stat>>;
|
|
26
|
-
writeFile(path: string, data: Uint8Array): Promise<Either<ErrnoException, void>>;
|
|
27
|
-
writeFileStream<ReturnT>(path: string, write: (stream: Writable) => Promise<Either<Error, ReturnT>>): Promise<Either<Error, ReturnT>>;
|
|
28
|
-
}
|
|
29
|
-
export declare namespace VersionedFileSystem {
|
|
30
|
-
interface GitParameters {
|
|
31
|
-
readonly dir: string;
|
|
32
|
-
readonly gitdir?: string;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=VersionedFileSystem.d.ts.map
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { join, relative } from "node:path";
|
|
3
|
-
import * as git from "isomorphic-git";
|
|
4
|
-
import { EitherAsync } from "purify-ts";
|
|
5
|
-
/**
|
|
6
|
-
* FileSystem implementation that git adds/removes files that are written or deleted successfully from the underlying node:fs.
|
|
7
|
-
*/
|
|
8
|
-
export class VersionedFileSystem {
|
|
9
|
-
delegate;
|
|
10
|
-
gitParameters;
|
|
11
|
-
constructor({ delegate, gitParameters, }) {
|
|
12
|
-
this.delegate = delegate;
|
|
13
|
-
this.gitParameters = { ...gitParameters, fs: fs.promises };
|
|
14
|
-
}
|
|
15
|
-
createDirectory(path, options) {
|
|
16
|
-
return this.delegate.createDirectory(path, options);
|
|
17
|
-
}
|
|
18
|
-
createReadStream(path) {
|
|
19
|
-
return this.delegate.createReadStream(path);
|
|
20
|
-
}
|
|
21
|
-
async deleteDirectory(path, options) {
|
|
22
|
-
return EitherAsync(async ({ liftEither }) => {
|
|
23
|
-
const filePaths = (await liftEither(await this.delegate.readDirectory(path, options)))
|
|
24
|
-
.filter((dirent) => dirent.isFile())
|
|
25
|
-
.map((dirent) => join(dirent.parentPath, dirent.name));
|
|
26
|
-
await liftEither(await this.delegate.deleteDirectory(path, options));
|
|
27
|
-
for (const filePath of filePaths) {
|
|
28
|
-
await git.remove({
|
|
29
|
-
...this.gitParameters,
|
|
30
|
-
filepath: this.gitRelativeFilePath(filePath),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
async deleteFile(path, options) {
|
|
36
|
-
return EitherAsync(async ({ liftEither }) => {
|
|
37
|
-
await liftEither(await this.delegate.deleteFile(path, options));
|
|
38
|
-
await git.remove({
|
|
39
|
-
...this.gitParameters,
|
|
40
|
-
filepath: this.gitRelativeFilePath(path),
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
gitRelativeFilePath(path) {
|
|
45
|
-
return relative(this.gitParameters.dir, path);
|
|
46
|
-
}
|
|
47
|
-
readDirectory(path, options) {
|
|
48
|
-
return this.delegate.readDirectory(path, options);
|
|
49
|
-
}
|
|
50
|
-
readFile(path) {
|
|
51
|
-
return this.delegate.readFile(path);
|
|
52
|
-
}
|
|
53
|
-
realpath(path) {
|
|
54
|
-
return this.delegate.realpath(path);
|
|
55
|
-
}
|
|
56
|
-
stat(path) {
|
|
57
|
-
return this.delegate.stat(path);
|
|
58
|
-
}
|
|
59
|
-
async writeFile(path, data) {
|
|
60
|
-
return EitherAsync(async ({ liftEither }) => {
|
|
61
|
-
await liftEither(await this.delegate.writeFile(path, data));
|
|
62
|
-
await git.add({
|
|
63
|
-
...this.gitParameters,
|
|
64
|
-
filepath: this.gitRelativeFilePath(path),
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
async writeFileStream(path, write) {
|
|
69
|
-
return EitherAsync(async ({ liftEither }) => {
|
|
70
|
-
const result = await liftEither(await this.delegate.writeFileStream(path, write));
|
|
71
|
-
await git.add({
|
|
72
|
-
...this.gitParameters,
|
|
73
|
-
filepath: this.gitRelativeFilePath(path),
|
|
74
|
-
});
|
|
75
|
-
return result;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=VersionedFileSystem.js.map
|