@effect-vfs/core 0.9.0 → 0.10.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/dist/BytePath.d.ts +4 -1
- package/dist/BytePath.d.ts.map +1 -1
- package/dist/BytePath.js +6 -4
- package/dist/Caller.d.ts +105 -66
- package/dist/Caller.d.ts.map +1 -1
- package/dist/Caller.js +15 -87
- package/dist/LiveVolume.d.ts +6 -1
- package/dist/LiveVolume.d.ts.map +1 -1
- package/dist/LiveVolume.js +8 -1
- package/dist/Search.d.ts +32 -8
- package/dist/Search.d.ts.map +1 -1
- package/dist/Search.js +14 -13
- package/dist/SynchronousAdapter.d.ts +58 -0
- package/dist/SynchronousAdapter.d.ts.map +1 -0
- package/dist/SynchronousAdapter.js +116 -0
- package/dist/Target.d.ts +7 -91
- package/dist/Target.d.ts.map +1 -1
- package/dist/Target.js +7 -47
- package/dist/Testing.d.ts +5 -2
- package/dist/Testing.d.ts.map +1 -1
- package/dist/Testing.js +2 -1
- package/dist/VfsError.d.ts +1 -1
- package/dist/VfsError.d.ts.map +1 -1
- package/dist/VirtualFileSystem.d.ts +126 -43
- package/dist/VirtualFileSystem.d.ts.map +1 -1
- package/dist/VirtualFileSystem.js +25 -21
- package/dist/Volume.d.ts +6 -1
- package/dist/Volume.d.ts.map +1 -1
- package/dist/Volume.js +6 -2
- package/dist/internal/adapterBinding.d.ts +13 -0
- package/dist/internal/adapterBinding.d.ts.map +1 -0
- package/dist/internal/adapterBinding.js +13 -0
- package/dist/internal/bytePath.d.ts +6 -1
- package/dist/internal/bytePath.d.ts.map +1 -1
- package/dist/internal/callerWatch.d.ts +5 -1
- package/dist/internal/callerWatch.d.ts.map +1 -1
- package/dist/internal/callerWatch.js +4 -3
- package/dist/internal/engine.d.ts +1305 -0
- package/dist/internal/engine.d.ts.map +1 -0
- package/dist/internal/engine.js +3458 -0
- package/dist/internal/errors.d.ts +1 -33
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -45
- package/dist/internal/fixture.d.ts +2 -1
- package/dist/internal/fixture.d.ts.map +1 -1
- package/dist/internal/fixture.js +7 -3
- package/dist/internal/image.d.ts +4 -1
- package/dist/internal/image.d.ts.map +1 -1
- package/dist/internal/image.js +6 -3
- package/dist/internal/lines.d.ts.map +1 -1
- package/dist/internal/lines.js +3 -2
- package/dist/internal/liveImage.d.ts +4 -2
- package/dist/internal/liveImage.d.ts.map +1 -1
- package/dist/internal/liveImage.js +3 -1
- package/dist/internal/merkle.d.ts +7 -4
- package/dist/internal/merkle.d.ts.map +1 -1
- package/dist/internal/merkle.js +6 -4
- package/dist/internal/search.d.ts +3 -1
- package/dist/internal/search.d.ts.map +1 -1
- package/dist/internal/search.js +4 -3
- package/dist/internal/snapshotDelta.d.ts +11 -7
- package/dist/internal/snapshotDelta.d.ts.map +1 -1
- package/dist/internal/snapshotDelta.js +15 -9
- package/dist/internal/snapshotMerge.d.ts +1 -1
- package/dist/internal/snapshotMerge.d.ts.map +1 -1
- package/dist/internal/snapshotMerge.js +5 -2
- package/dist/internal/tree.d.ts +4 -2
- package/dist/internal/tree.d.ts.map +1 -1
- package/dist/internal/tree.js +4 -2
- package/dist/internal/virtualFileSystem.d.ts +20 -49
- package/dist/internal/virtualFileSystem.d.ts.map +1 -1
- package/dist/internal/virtualFileSystem.js +75 -2082
- package/dist/internal/volumeLimits.d.ts +1 -0
- package/dist/internal/volumeLimits.d.ts.map +1 -1
- package/dist/internal/volumeLimits.js +3 -2
- package/dist/internal/volumeState.d.ts +10 -79
- package/dist/internal/volumeState.d.ts.map +1 -1
- package/dist/internal/volumeState.js +9 -79
- package/dist/internal/watchHub.d.ts +3 -3
- package/dist/internal/watchHub.d.ts.map +1 -1
- package/dist/internal/watchHub.js +4 -2
- package/package.json +14 -9
- package/dist/internal/confinement.d.ts +0 -16
- package/dist/internal/confinement.d.ts.map +0 -1
- package/dist/internal/confinement.js +0 -79
- package/dist/internal/directoryEntries.d.ts +0 -6
- package/dist/internal/directoryEntries.d.ts.map +0 -1
- package/dist/internal/directoryEntries.js +0 -79
- package/dist/internal/inodeTable.d.ts +0 -20
- package/dist/internal/inodeTable.d.ts.map +0 -1
- package/dist/internal/inodeTable.js +0 -48
- package/dist/internal/path.d.ts +0 -56
- package/dist/internal/path.d.ts.map +0 -1
- package/dist/internal/path.js +0 -141
- package/dist/internal/resolution.d.ts +0 -139
- package/dist/internal/resolution.d.ts.map +0 -1
- package/dist/internal/resolution.js +0 -332
- package/dist/internal/testSeams.d.ts +0 -17
- package/dist/internal/testSeams.d.ts.map +0 -1
- package/dist/internal/testSeams.js +0 -20
- package/dist/internal/tokenRegistry.d.ts +0 -83
- package/dist/internal/tokenRegistry.d.ts.map +0 -1
- package/dist/internal/tokenRegistry.js +0 -146
- package/dist/internal/turnstile.d.ts +0 -8
- package/dist/internal/turnstile.d.ts.map +0 -1
- package/dist/internal/turnstile.js +0 -43
package/dist/Search.d.ts
CHANGED
|
@@ -602,7 +602,10 @@ export type ScanContentFailure = ContentFailure | BudgetExceeded;
|
|
|
602
602
|
* @category operations
|
|
603
603
|
* @since 0.8.0
|
|
604
604
|
*/
|
|
605
|
-
export declare const scanGlob:
|
|
605
|
+
export declare const scanGlob: {
|
|
606
|
+
(query: GlobQuery): (snapshot: Snapshot) => Stream.Stream<string, ScanGlobFailure>;
|
|
607
|
+
(snapshot: Snapshot, query: GlobQuery): Stream.Stream<string, ScanGlobFailure>;
|
|
608
|
+
};
|
|
606
609
|
/**
|
|
607
610
|
* Collect bounded matches and preserve preceding rows when a work or output
|
|
608
611
|
* budget stops the query. Invalid queries, malformed patterns and snapshot
|
|
@@ -636,7 +639,10 @@ export declare const scanGlob: (snapshot: Snapshot, query: GlobQuery) => Stream.
|
|
|
636
639
|
* @category operations
|
|
637
640
|
* @since 0.8.0
|
|
638
641
|
*/
|
|
639
|
-
export declare const glob:
|
|
642
|
+
export declare const glob: {
|
|
643
|
+
(query: GlobQuery): (snapshot: Snapshot) => Effect.Effect<GlobReport, GlobFailure>;
|
|
644
|
+
(snapshot: Snapshot, query: GlobQuery): Effect.Effect<GlobReport, GlobFailure>;
|
|
645
|
+
};
|
|
640
646
|
/**
|
|
641
647
|
* Stream one result per matching line after classifying the complete file for
|
|
642
648
|
* strict UTF-8 and NUL. Each row contains the first whole-match byte range and
|
|
@@ -670,7 +676,10 @@ export declare const glob: (snapshot: Snapshot, query: GlobQuery) => Effect.Effe
|
|
|
670
676
|
* @category operations
|
|
671
677
|
* @since 0.8.0
|
|
672
678
|
*/
|
|
673
|
-
export declare const scanLines:
|
|
679
|
+
export declare const scanLines: {
|
|
680
|
+
(query: ContentQuery): (snapshot: Snapshot) => Stream.Stream<LineResult, ScanContentFailure>;
|
|
681
|
+
(snapshot: Snapshot, query: ContentQuery): Stream.Stream<LineResult, ScanContentFailure>;
|
|
682
|
+
};
|
|
674
683
|
/**
|
|
675
684
|
* Collect matching lines, preceding rows, skips, work and completion. Catch only
|
|
676
685
|
* budget exhaustion; query, pattern and snapshot failures remain typed failures,
|
|
@@ -685,7 +694,10 @@ export declare const scanLines: (snapshot: Snapshot, query: ContentQuery) => Str
|
|
|
685
694
|
* @category operations
|
|
686
695
|
* @since 0.8.0
|
|
687
696
|
*/
|
|
688
|
-
export declare const lines:
|
|
697
|
+
export declare const lines: {
|
|
698
|
+
(query: ContentQuery): (snapshot: Snapshot) => Effect.Effect<LinesReport, ContentFailure>;
|
|
699
|
+
(snapshot: Snapshot, query: ContentQuery): Effect.Effect<LinesReport, ContentFailure>;
|
|
700
|
+
};
|
|
689
701
|
/**
|
|
690
702
|
* Stream one root-relative filename per matching regular-file path. Classify
|
|
691
703
|
* the complete file before testing lines and stop matching after the first hit.
|
|
@@ -695,7 +707,10 @@ export declare const lines: (snapshot: Snapshot, query: ContentQuery) => Effect.
|
|
|
695
707
|
* @category operations
|
|
696
708
|
* @since 0.8.0
|
|
697
709
|
*/
|
|
698
|
-
export declare const scanFiles:
|
|
710
|
+
export declare const scanFiles: {
|
|
711
|
+
(query: ContentQuery): (snapshot: Snapshot) => Stream.Stream<string, ScanContentFailure>;
|
|
712
|
+
(snapshot: Snapshot, query: ContentQuery): Stream.Stream<string, ScanContentFailure>;
|
|
713
|
+
};
|
|
699
714
|
/**
|
|
700
715
|
* Collect matching filenames with preceding rows, work, skips and completion.
|
|
701
716
|
* Shares text classification and matching with `lines`, but evaluates only as
|
|
@@ -705,7 +720,10 @@ export declare const scanFiles: (snapshot: Snapshot, query: ContentQuery) => Str
|
|
|
705
720
|
* @category operations
|
|
706
721
|
* @since 0.8.0
|
|
707
722
|
*/
|
|
708
|
-
export declare const files:
|
|
723
|
+
export declare const files: {
|
|
724
|
+
(query: ContentQuery): (snapshot: Snapshot) => Effect.Effect<FilesReport, ContentFailure>;
|
|
725
|
+
(snapshot: Snapshot, query: ContentQuery): Effect.Effect<FilesReport, ContentFailure>;
|
|
726
|
+
};
|
|
709
727
|
/**
|
|
710
728
|
* Stream exact matching-line counts for completely scanned matching files.
|
|
711
729
|
* Multiple occurrences on one line count once. A stopped file emits no partial
|
|
@@ -715,7 +733,10 @@ export declare const files: (snapshot: Snapshot, query: ContentQuery) => Effect.
|
|
|
715
733
|
* @category operations
|
|
716
734
|
* @since 0.8.0
|
|
717
735
|
*/
|
|
718
|
-
export declare const scanCountLines:
|
|
736
|
+
export declare const scanCountLines: {
|
|
737
|
+
(query: ContentQuery): (snapshot: Snapshot) => Stream.Stream<CountResult, ScanContentFailure>;
|
|
738
|
+
(snapshot: Snapshot, query: ContentQuery): Stream.Stream<CountResult, ScanContentFailure>;
|
|
739
|
+
};
|
|
719
740
|
/**
|
|
720
741
|
* Collect exact per-file matching-line counts with work, skips and completion.
|
|
721
742
|
* A stopped or skipped query's summed counts are lower bounds for its original
|
|
@@ -725,6 +746,9 @@ export declare const scanCountLines: (snapshot: Snapshot, query: ContentQuery) =
|
|
|
725
746
|
* @category operations
|
|
726
747
|
* @since 0.8.0
|
|
727
748
|
*/
|
|
728
|
-
export declare const countLines:
|
|
749
|
+
export declare const countLines: {
|
|
750
|
+
(query: ContentQuery): (snapshot: Snapshot) => Effect.Effect<CountLinesReport, ContentFailure>;
|
|
751
|
+
(snapshot: Snapshot, query: ContentQuery): Effect.Effect<CountLinesReport, ContentFailure>;
|
|
752
|
+
};
|
|
729
753
|
export {};
|
|
730
754
|
//# sourceMappingURL=Search.d.ts.map
|
package/dist/Search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../src/Search.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../src/Search.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAKxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,IAAI,4DAAoD,CAAA;AAErE;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAoBnC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;EAA6B,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;EAgBzB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD;;;;;GAKG;AACH,eAAO,MA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O,MAAM,UAAU,EAAE;IACvB,CAAC,KAAK,EAAE,YAAY,GAAG,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;IAC9F,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAA;CAQ3F,CAAA"}
|
package/dist/Search.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as ByteSize from "effect/ByteSize";
|
|
12
12
|
import * as Effect from "effect/Effect";
|
|
13
|
+
import { dual } from "effect/Function";
|
|
13
14
|
import * as Schema from "effect/Schema";
|
|
14
15
|
import * as Stream from "effect/Stream";
|
|
15
16
|
import { BytePath } from "./BytePath.js";
|
|
@@ -400,10 +401,10 @@ const evaluate = Effect.fnUntraced(function* (snapshot, input) {
|
|
|
400
401
|
* @category operations
|
|
401
402
|
* @since 0.8.0
|
|
402
403
|
*/
|
|
403
|
-
export const scanGlob = (snapshot, query) => Stream.unwrap(Effect.map(evaluate(snapshot, query), ({ next }) => Stream.unfold(undefined, Effect.fnUntraced(function* () {
|
|
404
|
+
export const scanGlob = dual(2, (snapshot, query) => Stream.unwrap(Effect.map(evaluate(snapshot, query), ({ next }) => Stream.unfold(undefined, Effect.fnUntraced(function* () {
|
|
404
405
|
const row = yield* next();
|
|
405
406
|
return row === undefined ? undefined : [row, undefined];
|
|
406
|
-
}))));
|
|
407
|
+
})))));
|
|
407
408
|
/**
|
|
408
409
|
* Collect bounded matches and preserve preceding rows when a work or output
|
|
409
410
|
* budget stops the query. Invalid queries, malformed patterns and snapshot
|
|
@@ -437,7 +438,7 @@ export const scanGlob = (snapshot, query) => Stream.unwrap(Effect.map(evaluate(s
|
|
|
437
438
|
* @category operations
|
|
438
439
|
* @since 0.8.0
|
|
439
440
|
*/
|
|
440
|
-
export const glob = Effect.fnUntraced(function* (snapshot, query) {
|
|
441
|
+
export const glob = dual(2, Effect.fnUntraced(function* (snapshot, query) {
|
|
441
442
|
const evaluation = yield* evaluate(snapshot, query);
|
|
442
443
|
const results = [];
|
|
443
444
|
const completion = yield* Effect.gen(function* () {
|
|
@@ -454,7 +455,7 @@ export const glob = Effect.fnUntraced(function* (snapshot, query) {
|
|
|
454
455
|
skips: { ...evaluation.meter.skips },
|
|
455
456
|
completion
|
|
456
457
|
};
|
|
457
|
-
});
|
|
458
|
+
}));
|
|
458
459
|
const scanContent = (snapshot, query, mode) => Stream.unwrap(Effect.map(Content.evaluate(snapshot, query, mode), ({ next }) => Stream.unfold(undefined, Effect.fnUntraced(function* () {
|
|
459
460
|
const row = yield* next();
|
|
460
461
|
return row === undefined ? undefined : [row, undefined];
|
|
@@ -510,7 +511,7 @@ const collectContent = Effect.fnUntraced(function* (snapshot, query, mode) {
|
|
|
510
511
|
* @category operations
|
|
511
512
|
* @since 0.8.0
|
|
512
513
|
*/
|
|
513
|
-
export const scanLines = (snapshot, query) => scanContent(snapshot, query, "lines");
|
|
514
|
+
export const scanLines = dual(2, (snapshot, query) => scanContent(snapshot, query, "lines"));
|
|
514
515
|
/**
|
|
515
516
|
* Collect matching lines, preceding rows, skips, work and completion. Catch only
|
|
516
517
|
* budget exhaustion; query, pattern and snapshot failures remain typed failures,
|
|
@@ -525,10 +526,10 @@ export const scanLines = (snapshot, query) => scanContent(snapshot, query, "line
|
|
|
525
526
|
* @category operations
|
|
526
527
|
* @since 0.8.0
|
|
527
528
|
*/
|
|
528
|
-
export const lines = Effect
|
|
529
|
+
export const lines = dual(2, Effect
|
|
529
530
|
.fnUntraced(function* (snapshot, query) {
|
|
530
531
|
return yield* collectContent(snapshot, query, "lines");
|
|
531
|
-
});
|
|
532
|
+
}));
|
|
532
533
|
/**
|
|
533
534
|
* Stream one root-relative filename per matching regular-file path. Classify
|
|
534
535
|
* the complete file before testing lines and stop matching after the first hit.
|
|
@@ -538,7 +539,7 @@ export const lines = Effect
|
|
|
538
539
|
* @category operations
|
|
539
540
|
* @since 0.8.0
|
|
540
541
|
*/
|
|
541
|
-
export const scanFiles = (snapshot, query) => scanContent(snapshot, query, "files");
|
|
542
|
+
export const scanFiles = dual(2, (snapshot, query) => scanContent(snapshot, query, "files"));
|
|
542
543
|
/**
|
|
543
544
|
* Collect matching filenames with preceding rows, work, skips and completion.
|
|
544
545
|
* Shares text classification and matching with `lines`, but evaluates only as
|
|
@@ -548,10 +549,10 @@ export const scanFiles = (snapshot, query) => scanContent(snapshot, query, "file
|
|
|
548
549
|
* @category operations
|
|
549
550
|
* @since 0.8.0
|
|
550
551
|
*/
|
|
551
|
-
export const files = Effect
|
|
552
|
+
export const files = dual(2, Effect
|
|
552
553
|
.fnUntraced(function* (snapshot, query) {
|
|
553
554
|
return yield* collectContent(snapshot, query, "files");
|
|
554
|
-
});
|
|
555
|
+
}));
|
|
555
556
|
/**
|
|
556
557
|
* Stream exact matching-line counts for completely scanned matching files.
|
|
557
558
|
* Multiple occurrences on one line count once. A stopped file emits no partial
|
|
@@ -561,7 +562,7 @@ export const files = Effect
|
|
|
561
562
|
* @category operations
|
|
562
563
|
* @since 0.8.0
|
|
563
564
|
*/
|
|
564
|
-
export const scanCountLines = (snapshot, query) => scanContent(snapshot, query, "countLines");
|
|
565
|
+
export const scanCountLines = dual(2, (snapshot, query) => scanContent(snapshot, query, "countLines"));
|
|
565
566
|
/**
|
|
566
567
|
* Collect exact per-file matching-line counts with work, skips and completion.
|
|
567
568
|
* A stopped or skipped query's summed counts are lower bounds for its original
|
|
@@ -571,6 +572,6 @@ export const scanCountLines = (snapshot, query) => scanContent(snapshot, query,
|
|
|
571
572
|
* @category operations
|
|
572
573
|
* @since 0.8.0
|
|
573
574
|
*/
|
|
574
|
-
export const countLines = Effect.fnUntraced(function* (snapshot, query) {
|
|
575
|
+
export const countLines = dual(2, Effect.fnUntraced(function* (snapshot, query) {
|
|
575
576
|
return yield* collectContent(snapshot, query, "countLines");
|
|
576
|
-
});
|
|
577
|
+
}));
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Scope from "effect/Scope";
|
|
3
|
+
import type { MkdirOptions, OpenOptions } from "./Caller.js";
|
|
4
|
+
import type { Metadata, OwnerUpdate, Times } from "./Metadata.js";
|
|
5
|
+
import type { Caller, FsFailure, TargetInput, Volume } from "./VirtualFileSystem.js";
|
|
6
|
+
/**
|
|
7
|
+
* A private-scope handle. Explicit close checks reentry before touching its scope.
|
|
8
|
+
* @since 0.10.0
|
|
9
|
+
*/
|
|
10
|
+
export interface Handle {
|
|
11
|
+
readonly closed: boolean;
|
|
12
|
+
readonly directory: boolean;
|
|
13
|
+
readonly stat: () => Metadata;
|
|
14
|
+
readonly read: (length: number, position: bigint) => Uint8Array;
|
|
15
|
+
readonly write: (bytes: Uint8Array, position: bigint, append: boolean) => number;
|
|
16
|
+
readonly truncate: (length: bigint) => void;
|
|
17
|
+
readonly chmod: (mode: number) => void;
|
|
18
|
+
readonly chown: (owner: OwnerUpdate) => void;
|
|
19
|
+
readonly utimes: (times: Times) => void;
|
|
20
|
+
readonly sync: () => void;
|
|
21
|
+
readonly close: () => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Synchronous filesystem operations. Failures throw the core FsFailure value.
|
|
25
|
+
* @since 0.10.0
|
|
26
|
+
*/
|
|
27
|
+
export interface Binding {
|
|
28
|
+
readonly stat: (target: TargetInput) => Metadata;
|
|
29
|
+
readonly readDirectory: (path: string) => Effect.Success<ReturnType<Caller["readDirectory"]>>;
|
|
30
|
+
readonly readLink: (path: string) => Uint8Array;
|
|
31
|
+
readonly realPath: (path: string) => Uint8Array;
|
|
32
|
+
readonly access: (path: string, bits: number) => number;
|
|
33
|
+
readonly mkdir: (path: string, options?: MkdirOptions) => void;
|
|
34
|
+
readonly rmdir: (path: string) => void;
|
|
35
|
+
readonly unlink: (path: string) => void;
|
|
36
|
+
readonly rename: (from: string, to: string) => void;
|
|
37
|
+
readonly link: (from: TargetInput, to: string) => void;
|
|
38
|
+
readonly symlink: (target: string, path: string) => void;
|
|
39
|
+
readonly chmod: (target: TargetInput, mode: number) => void;
|
|
40
|
+
readonly chown: (target: TargetInput, owner: OwnerUpdate) => void;
|
|
41
|
+
readonly utimes: (target: TargetInput, times: Times) => void;
|
|
42
|
+
readonly open: (path: string, options: OpenOptions, noFollow: boolean, directory: boolean) => Handle;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Binds only constructor-qualified synchronous memory volumes. The scope owns all opened handles.
|
|
46
|
+
* No arbitrary Effect can be submitted to this binding.
|
|
47
|
+
* @since 0.10.0
|
|
48
|
+
*/
|
|
49
|
+
export declare const bind: (volume: Volume, options?: {
|
|
50
|
+
readonly identity?: {
|
|
51
|
+
readonly uid: number;
|
|
52
|
+
readonly gid: number;
|
|
53
|
+
readonly groups: readonly number[];
|
|
54
|
+
readonly privileged: boolean;
|
|
55
|
+
};
|
|
56
|
+
readonly umask?: number;
|
|
57
|
+
} | undefined) => Effect.Effect<Binding, FsFailure, Scope.Scope>;
|
|
58
|
+
//# sourceMappingURL=SynchronousAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SynchronousAdapter.d.ts","sourceRoot":"","sources":["../src/SynchronousAdapter.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAA;AAG/E,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,KAAK,EAAE,MAAM,EAA+B,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAEjH;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ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AM,KAAK,MAAM,CAAA;IACvD,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;IAC9D,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACtD,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACxD,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3D,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACjE,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC5D,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,KAAK,MAAM,CAAA;CACrG;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI;;;;;;;;gEAsHhB,CAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// These callbacks implement a checked native boundary with fresh synchronous fibers.
|
|
2
|
+
/* eslint-disable effecttsgo/run-effect-inside-effect */
|
|
3
|
+
/**
|
|
4
|
+
* Checked synchronous operations for native adapters over an existing memory volume.
|
|
5
|
+
* This adapter contract is versioned with core. Volumes from another package copy are rejected.
|
|
6
|
+
* @since 0.10.0
|
|
7
|
+
*/
|
|
8
|
+
import * as Cause from "effect/Cause";
|
|
9
|
+
import * as Effect from "effect/Effect";
|
|
10
|
+
import * as Exit from "effect/Exit";
|
|
11
|
+
import * as Result from "effect/Result";
|
|
12
|
+
import * as Scheduler from "effect/Scheduler";
|
|
13
|
+
import * as Scope from "effect/Scope";
|
|
14
|
+
import { engineOf } from "./internal/adapterBinding.js";
|
|
15
|
+
import { Errors, Paths } from "./internal/engine.js";
|
|
16
|
+
/**
|
|
17
|
+
* Binds only constructor-qualified synchronous memory volumes. The scope owns all opened handles.
|
|
18
|
+
* No arbitrary Effect can be submitted to this binding.
|
|
19
|
+
* @since 0.10.0
|
|
20
|
+
*/
|
|
21
|
+
export const bind = Effect.fnUntraced(function* (volume, options) {
|
|
22
|
+
const engine = engineOf(volume);
|
|
23
|
+
const checked = engine?.syncBinding;
|
|
24
|
+
if (engine === undefined || checked === undefined)
|
|
25
|
+
return yield* Errors.argumentFailure("bind", "volume");
|
|
26
|
+
yield* Effect.fromResult(checked.check("bind"));
|
|
27
|
+
const context = yield* engine.context(options);
|
|
28
|
+
const operations = context.operations;
|
|
29
|
+
const parent = yield* Effect.scope;
|
|
30
|
+
let closed = false;
|
|
31
|
+
yield* Scope.addFinalizer(parent, Effect.sync(() => {
|
|
32
|
+
closed = true;
|
|
33
|
+
}));
|
|
34
|
+
const run = (operation, effect) => {
|
|
35
|
+
if (closed)
|
|
36
|
+
throw Errors.fsFailure("ClosedCaller", operation);
|
|
37
|
+
const available = checked.check(operation);
|
|
38
|
+
if (Result.isFailure(available))
|
|
39
|
+
throw available.failure;
|
|
40
|
+
const exit = Effect.runSyncExit(Effect.provideService(effect, Scheduler.PreventSchedulerYield, true));
|
|
41
|
+
if (Exit.isFailure(exit))
|
|
42
|
+
throw Cause.squash(exit.cause);
|
|
43
|
+
return exit.value;
|
|
44
|
+
};
|
|
45
|
+
const open = (path, options, noFollow, directory) => {
|
|
46
|
+
// Preflight must precede even scope allocation. A rejected reentrant close/open owns no resources.
|
|
47
|
+
run("open", Effect.void);
|
|
48
|
+
const scope = Scope.forkUnsafe(parent);
|
|
49
|
+
const target = { _tag: "Path", path, followFinalSymlink: !noFollow };
|
|
50
|
+
const acquire = directory
|
|
51
|
+
? operations.openDirectory(target)
|
|
52
|
+
: operations.open(target, options);
|
|
53
|
+
const acquired = Effect.runSyncExit(Effect.provideService(Effect.provideService(acquire, Scope.Scope, scope), Scheduler.PreventSchedulerYield, true));
|
|
54
|
+
if (Exit.isFailure(acquired)) {
|
|
55
|
+
Effect.runSync(Scope.close(scope, Exit.void));
|
|
56
|
+
throw Cause.squash(acquired.cause);
|
|
57
|
+
}
|
|
58
|
+
const handle = acquired.value;
|
|
59
|
+
let released = false;
|
|
60
|
+
Effect.runSync(Scope.addFinalizer(scope, Effect.sync(() => {
|
|
61
|
+
released = true;
|
|
62
|
+
})));
|
|
63
|
+
const file = () => {
|
|
64
|
+
if (!("pread" in handle))
|
|
65
|
+
throw Errors.fsFailure("IsDirectory", "read");
|
|
66
|
+
return handle;
|
|
67
|
+
};
|
|
68
|
+
return Object.freeze({
|
|
69
|
+
get closed() {
|
|
70
|
+
return released;
|
|
71
|
+
},
|
|
72
|
+
directory,
|
|
73
|
+
stat: () => run("fstat", handle.stat),
|
|
74
|
+
read: (length, position) => run("read", Effect.map(file().pread(length, position), (value) => value.bytes)),
|
|
75
|
+
write: (bytes, position, append) => run("write", append ? file().write(bytes) : file().pwrite(bytes, position)),
|
|
76
|
+
truncate: (length) => run("ftruncate", file().truncate(length)),
|
|
77
|
+
chmod: (mode) => run("fchmod", operations.chmod(handle, mode)),
|
|
78
|
+
chown: (owner) => run("fchown", operations.chown(handle, owner)),
|
|
79
|
+
utimes: (times) => run("futimes", operations.utimes(handle, times)),
|
|
80
|
+
sync: () => run("fsync", directory ? Effect.asVoid(handle.stat) : file().sync),
|
|
81
|
+
close: () => {
|
|
82
|
+
run("close", handle.close);
|
|
83
|
+
Effect.runSync(Scope.close(scope, Exit.void));
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
return Object.freeze({
|
|
88
|
+
stat: (target) => run("stat", operations.stat(target)),
|
|
89
|
+
readDirectory: (path) => run("readdir", operations.readDirectory(path)),
|
|
90
|
+
readLink: (path) => run("readlink", operations.readLink(path)),
|
|
91
|
+
realPath: (path) => run("realpath", Effect.flatMap(operations.realPath(path), Paths.pathToBytes)),
|
|
92
|
+
access: (path, bits) => run("access", operations.access(path, bits)),
|
|
93
|
+
mkdir: (path, options) => {
|
|
94
|
+
run("mkdir", operations.mkdir(path, options));
|
|
95
|
+
},
|
|
96
|
+
rmdir: (path) => {
|
|
97
|
+
run("rmdir", operations.rmdir(path));
|
|
98
|
+
},
|
|
99
|
+
unlink: (path) => {
|
|
100
|
+
run("unlink", operations.unlink(path));
|
|
101
|
+
},
|
|
102
|
+
rename: (from, to) => {
|
|
103
|
+
run("rename", operations.rename(from, to));
|
|
104
|
+
},
|
|
105
|
+
link: (from, to) => {
|
|
106
|
+
run("link", operations.link(from, to));
|
|
107
|
+
},
|
|
108
|
+
symlink: (target, path) => {
|
|
109
|
+
run("symlink", operations.symlink(target, path));
|
|
110
|
+
},
|
|
111
|
+
chmod: (target, mode) => run("chmod", operations.chmod(target, mode)),
|
|
112
|
+
chown: (target, owner) => run("chown", operations.chown(target, owner)),
|
|
113
|
+
utimes: (target, times) => run("utimes", operations.utimes(target, times)),
|
|
114
|
+
open
|
|
115
|
+
});
|
|
116
|
+
});
|
package/dist/Target.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @since 0.6.0
|
|
8
8
|
*/
|
|
9
|
-
import * as Data from "effect/Data";
|
|
10
|
-
import * as Schema from "effect/Schema";
|
|
9
|
+
import type * as Data from "effect/Data";
|
|
10
|
+
import type * as Schema from "effect/Schema";
|
|
11
11
|
import type { DirectoryHandle, FileHandle, ObjectReference, PathInput } from "./VirtualFileSystem.js";
|
|
12
12
|
/**
|
|
13
13
|
* A target: a path resolved from the caller's working directory or a base
|
|
@@ -31,92 +31,6 @@ export type Target = Data.TaggedEnum<{
|
|
|
31
31
|
readonly handle: FileHandle | DirectoryHandle;
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
|
-
declare const enumeration: {
|
|
35
|
-
readonly $is: <Tag extends "Handle" | "Path" | "Reference">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
36
|
-
readonly _tag: "Handle";
|
|
37
|
-
readonly handle: FileHandle | DirectoryHandle;
|
|
38
|
-
}, {
|
|
39
|
-
readonly _tag: Tag;
|
|
40
|
-
}> | Extract<{
|
|
41
|
-
readonly _tag: "Path";
|
|
42
|
-
readonly path: PathInput;
|
|
43
|
-
readonly relativeTo?: DirectoryHandle;
|
|
44
|
-
readonly followFinalSymlink?: boolean;
|
|
45
|
-
}, {
|
|
46
|
-
readonly _tag: Tag;
|
|
47
|
-
}> | Extract<{
|
|
48
|
-
readonly _tag: "Reference";
|
|
49
|
-
readonly reference: ObjectReference;
|
|
50
|
-
}, {
|
|
51
|
-
readonly _tag: Tag;
|
|
52
|
-
}>;
|
|
53
|
-
readonly $match: {
|
|
54
|
-
<Cases extends { readonly [Tag in "Handle" | "Path" | "Reference"]: (args: Extract<{
|
|
55
|
-
readonly _tag: "Handle";
|
|
56
|
-
readonly handle: FileHandle | DirectoryHandle;
|
|
57
|
-
} | {
|
|
58
|
-
readonly _tag: "Path";
|
|
59
|
-
readonly path: PathInput;
|
|
60
|
-
readonly relativeTo?: DirectoryHandle;
|
|
61
|
-
readonly followFinalSymlink?: boolean;
|
|
62
|
-
} | {
|
|
63
|
-
readonly _tag: "Reference";
|
|
64
|
-
readonly reference: ObjectReference;
|
|
65
|
-
}, {
|
|
66
|
-
readonly _tag: Tag;
|
|
67
|
-
}>) => any; }>(cases: Cases): (value: {
|
|
68
|
-
readonly _tag: "Handle";
|
|
69
|
-
readonly handle: FileHandle | DirectoryHandle;
|
|
70
|
-
} | {
|
|
71
|
-
readonly _tag: "Path";
|
|
72
|
-
readonly path: PathInput;
|
|
73
|
-
readonly relativeTo?: DirectoryHandle;
|
|
74
|
-
readonly followFinalSymlink?: boolean;
|
|
75
|
-
} | {
|
|
76
|
-
readonly _tag: "Reference";
|
|
77
|
-
readonly reference: ObjectReference;
|
|
78
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["Handle" | "Path" | "Reference"]>>;
|
|
79
|
-
<Cases extends { readonly [Tag in "Handle" | "Path" | "Reference"]: (args: Extract<{
|
|
80
|
-
readonly _tag: "Handle";
|
|
81
|
-
readonly handle: FileHandle | DirectoryHandle;
|
|
82
|
-
} | {
|
|
83
|
-
readonly _tag: "Path";
|
|
84
|
-
readonly path: PathInput;
|
|
85
|
-
readonly relativeTo?: DirectoryHandle;
|
|
86
|
-
readonly followFinalSymlink?: boolean;
|
|
87
|
-
} | {
|
|
88
|
-
readonly _tag: "Reference";
|
|
89
|
-
readonly reference: ObjectReference;
|
|
90
|
-
}, {
|
|
91
|
-
readonly _tag: Tag;
|
|
92
|
-
}>) => any; }>(value: {
|
|
93
|
-
readonly _tag: "Handle";
|
|
94
|
-
readonly handle: FileHandle | DirectoryHandle;
|
|
95
|
-
} | {
|
|
96
|
-
readonly _tag: "Path";
|
|
97
|
-
readonly path: PathInput;
|
|
98
|
-
readonly relativeTo?: DirectoryHandle;
|
|
99
|
-
readonly followFinalSymlink?: boolean;
|
|
100
|
-
} | {
|
|
101
|
-
readonly _tag: "Reference";
|
|
102
|
-
readonly reference: ObjectReference;
|
|
103
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["Handle" | "Path" | "Reference"]>>;
|
|
104
|
-
};
|
|
105
|
-
readonly Handle: Data.TaggedEnum.ConstructorFrom<{
|
|
106
|
-
readonly _tag: "Handle";
|
|
107
|
-
readonly handle: FileHandle | DirectoryHandle;
|
|
108
|
-
}, "_tag">;
|
|
109
|
-
readonly Path: Data.TaggedEnum.ConstructorFrom<{
|
|
110
|
-
readonly _tag: "Path";
|
|
111
|
-
readonly path: PathInput;
|
|
112
|
-
readonly relativeTo?: DirectoryHandle;
|
|
113
|
-
readonly followFinalSymlink?: boolean;
|
|
114
|
-
}, "_tag">;
|
|
115
|
-
readonly Reference: Data.TaggedEnum.ConstructorFrom<{
|
|
116
|
-
readonly _tag: "Reference";
|
|
117
|
-
readonly reference: ObjectReference;
|
|
118
|
-
}, "_tag">;
|
|
119
|
-
};
|
|
120
34
|
/**
|
|
121
35
|
* Whether a value is a `Target`.
|
|
122
36
|
*
|
|
@@ -139,7 +53,7 @@ export type TargetInput = Target | PathInput | ObjectReference | FileHandle | Di
|
|
|
139
53
|
* @category constructors
|
|
140
54
|
* @since 0.6.0
|
|
141
55
|
*/
|
|
142
|
-
export declare const Target:
|
|
56
|
+
export declare const Target: Data.TaggedEnum.Constructor<Target> & {
|
|
143
57
|
readonly of: (input: TargetInput) => Target;
|
|
144
58
|
};
|
|
145
59
|
/**
|
|
@@ -213,7 +127,10 @@ export declare const isEntry: (value: unknown) => value is Entry;
|
|
|
213
127
|
* @category constructors
|
|
214
128
|
* @since 0.6.0
|
|
215
129
|
*/
|
|
216
|
-
export declare const Entry:
|
|
130
|
+
export declare const Entry: {
|
|
131
|
+
(name: NameInput): (directory: TargetInput) => Entry;
|
|
132
|
+
(directory: TargetInput, name: NameInput): Entry;
|
|
133
|
+
};
|
|
217
134
|
/**
|
|
218
135
|
* Whether a path input is a byte path rather than a string.
|
|
219
136
|
*
|
|
@@ -221,5 +138,4 @@ export declare const Entry: (directory: TargetInput, name: NameInput) => Entry;
|
|
|
221
138
|
* @since 0.6.0
|
|
222
139
|
*/
|
|
223
140
|
export declare const isBytePathInput: (input: PathInput) => boolean;
|
|
224
|
-
export {};
|
|
225
141
|
//# sourceMappingURL=Target.d.ts.map
|
package/dist/Target.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Target.d.ts","sourceRoot":"","sources":["../src/Target.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Target.d.ts","sourceRoot":"","sources":["../src/Target.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAE5C,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAErG;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;QACxB,qFAAqF;QACrF,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAA;QACrC,qEAAqE;QACrE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;KACtC,CAAA;IACD,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAA;KAAE,CAAA;IAC3D,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,eAAe,CAAA;KAAE,CAAA;CACnE,CAAC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,MAAyB,CAAA;AAE7E;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,eAAe,GAAG,UAAU,GAAG,eAAe,CAAA;AAE7F;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,MAAM,CAAA;CACxF,CAAA;AAEhB;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,UAAU,CAAA;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,UAAyB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAA;AAEnC;;;;;GAKG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,UAAU,CAAA;AAEvD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,KAAuB,CAAA;AAE1E;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK,EAAE;IAClB,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,SAAS,EAAE,WAAW,KAAK,KAAK,CAAA;IACpD,CAAC,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,GAAG,KAAK,CAAA;CACjC,CAAA;AAEjB;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,OAAiC,CAAA"}
|
package/dist/Target.js
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
* How a caller names what it operates on. A `Target` is a path, an object
|
|
3
|
-
* reference, or an open handle; an `Entry` is a child of a directory target
|
|
4
|
-
* called `name`. Every verb takes one or the other, so the three addressing
|
|
5
|
-
* modes share one body and one option vocabulary.
|
|
6
|
-
*
|
|
7
|
-
* @since 0.6.0
|
|
8
|
-
*/
|
|
9
|
-
import * as Data from "effect/Data";
|
|
10
|
-
import * as Predicate from "effect/Predicate";
|
|
11
|
-
import * as Schema from "effect/Schema";
|
|
12
|
-
import { DirectoryHandleId, FileHandleId } from "./FileHandle.js";
|
|
13
|
-
import * as Internal from "./internal/bytePath.js";
|
|
14
|
-
const isFileHandle = (value) => Predicate.hasProperty(FileHandleId)(value) && value[FileHandleId] === true;
|
|
15
|
-
const isDirectoryHandle = (value) => Predicate.hasProperty(DirectoryHandleId)(value) && value[DirectoryHandleId] === true;
|
|
16
|
-
const enumeration = Data.taggedEnum();
|
|
1
|
+
import { Address } from "./internal/engine.js";
|
|
17
2
|
/**
|
|
18
3
|
* Whether a value is a `Target`.
|
|
19
4
|
*
|
|
20
5
|
* @category predicates
|
|
21
6
|
* @since 0.6.0
|
|
22
7
|
*/
|
|
23
|
-
export const isTarget =
|
|
8
|
+
export const isTarget = Address.isTarget;
|
|
24
9
|
/**
|
|
25
10
|
* Constructors and matchers for `Target`, plus `of`, which wraps a bare path,
|
|
26
11
|
* reference, or handle.
|
|
@@ -28,46 +13,21 @@ export const isTarget = (value) => Predicate.isTagged("Path")(value) || Predicat
|
|
|
28
13
|
* @category constructors
|
|
29
14
|
* @since 0.6.0
|
|
30
15
|
*/
|
|
31
|
-
export const Target =
|
|
32
|
-
Path: enumeration.Path,
|
|
33
|
-
Reference: enumeration.Reference,
|
|
34
|
-
Handle: enumeration.Handle,
|
|
35
|
-
$is: enumeration.$is,
|
|
36
|
-
$match: enumeration.$match,
|
|
37
|
-
// A string or byte path is a path and a handle is a handle; anything else is taken for a reference, so a forged
|
|
38
|
-
// token reaches the registry and is reported as one.
|
|
39
|
-
of: (input) => {
|
|
40
|
-
if (isTarget(input))
|
|
41
|
-
return input;
|
|
42
|
-
if (isFileHandle(input) || isDirectoryHandle(input))
|
|
43
|
-
return enumeration.Handle({ handle: input });
|
|
44
|
-
if (Predicate.isString(input) || Internal.isBytePath(input))
|
|
45
|
-
return enumeration.Path({ path: input });
|
|
46
|
-
return enumeration.Reference({ reference: input });
|
|
47
|
-
}
|
|
48
|
-
};
|
|
16
|
+
export const Target = Address.Target;
|
|
49
17
|
/**
|
|
50
18
|
* Schema for a well-formed entry name, as bytes.
|
|
51
19
|
*
|
|
52
20
|
* @category schemas
|
|
53
21
|
* @since 0.6.0
|
|
54
22
|
*/
|
|
55
|
-
export const Name =
|
|
56
|
-
? "must not be empty"
|
|
57
|
-
: bytes.length > 255
|
|
58
|
-
? "must be at most 255 bytes"
|
|
59
|
-
: bytes.includes(0)
|
|
60
|
-
? "must not contain NUL"
|
|
61
|
-
: bytes.includes(0x2f)
|
|
62
|
-
? "must not contain a slash"
|
|
63
|
-
: undefined));
|
|
23
|
+
export const Name = Address.Name;
|
|
64
24
|
/**
|
|
65
25
|
* Whether a value is an `Entry`.
|
|
66
26
|
*
|
|
67
27
|
* @category predicates
|
|
68
28
|
* @since 0.6.0
|
|
69
29
|
*/
|
|
70
|
-
export const isEntry =
|
|
30
|
+
export const isEntry = Address.isEntry;
|
|
71
31
|
/**
|
|
72
32
|
* Names a child of a directory. The directory may be given bare.
|
|
73
33
|
*
|
|
@@ -82,11 +42,11 @@ export const isEntry = (value) => Predicate.hasProperty(value, "directory") && P
|
|
|
82
42
|
* @category constructors
|
|
83
43
|
* @since 0.6.0
|
|
84
44
|
*/
|
|
85
|
-
export const Entry =
|
|
45
|
+
export const Entry = Address.Entry;
|
|
86
46
|
/**
|
|
87
47
|
* Whether a path input is a byte path rather than a string.
|
|
88
48
|
*
|
|
89
49
|
* @category predicates
|
|
90
50
|
* @since 0.6.0
|
|
91
51
|
*/
|
|
92
|
-
export const isBytePathInput =
|
|
52
|
+
export const isBytePathInput = Address.isBytePathInput;
|
package/dist/Testing.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ import type { VolumeOptions } from "./Volume.js";
|
|
|
31
31
|
export interface LayerOptions {
|
|
32
32
|
/** Entries the volume starts with; without one the volume starts empty. */
|
|
33
33
|
readonly fixture?: Fixture;
|
|
34
|
-
/**
|
|
34
|
+
/** Execution mode, limits and identity of the volume. */
|
|
35
35
|
readonly volume?: VolumeOptions;
|
|
36
36
|
/** Credentials and umask of the root caller the layer provides. */
|
|
37
37
|
readonly caller?: RootCallerOptions;
|
|
@@ -128,5 +128,8 @@ export declare const callerAs: (identity: Identity, options?: Omit<RootCallerOpt
|
|
|
128
128
|
* @category combinators
|
|
129
129
|
* @since 0.6.0
|
|
130
130
|
*/
|
|
131
|
-
export declare const collectChanges:
|
|
131
|
+
export declare const collectChanges: {
|
|
132
|
+
(n: number): <A, E, R>(stream: Stream.Stream<A, E, R>) => Effect.Effect<Effect.Effect<Array<A>, E>, never, R | Scope.Scope>;
|
|
133
|
+
<A, E, R>(stream: Stream.Stream<A, E, R>, n: number): Effect.Effect<Effect.Effect<Array<A>, E>, never, R | Scope.Scope>;
|
|
134
|
+
};
|
|
132
135
|
//# sourceMappingURL=Testing.d.ts.map
|