@fgv/ts-json-base 5.1.0-3 → 5.1.0-31
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/index.browser.js.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/packlets/converters/converters.js +11 -0
- package/dist/packlets/converters/converters.js.map +1 -0
- package/dist/packlets/converters/index.js.map +1 -0
- package/dist/packlets/file-tree/directoryItem.js.map +1 -0
- package/dist/packlets/file-tree/fileItem.js +11 -4
- package/dist/packlets/file-tree/fileItem.js.map +1 -0
- package/dist/packlets/file-tree/fileTree.js.map +1 -0
- package/dist/packlets/file-tree/fileTreeAccessors.js.map +1 -0
- package/dist/packlets/file-tree/fileTreeHelpers.inMemory.js.map +1 -0
- package/dist/packlets/file-tree/fileTreeHelpers.js.map +1 -0
- package/dist/packlets/file-tree/filterSpec.js.map +1 -0
- package/dist/packlets/file-tree/fsTree.js +44 -13
- package/dist/packlets/file-tree/fsTree.js.map +1 -0
- package/dist/packlets/file-tree/in-memory/inMemoryTree.js +44 -13
- package/dist/packlets/file-tree/in-memory/inMemoryTree.js.map +1 -0
- package/dist/packlets/file-tree/in-memory/index.js.map +1 -0
- package/dist/packlets/file-tree/in-memory/treeBuilder.js.map +1 -0
- package/dist/packlets/file-tree/index.browser.js.map +1 -0
- package/dist/packlets/file-tree/index.js.map +1 -0
- package/dist/packlets/json/common.js.map +1 -0
- package/dist/packlets/json/index.js.map +1 -0
- package/dist/packlets/json-compatible/common.js.map +1 -0
- package/dist/packlets/json-compatible/converters.js.map +1 -0
- package/dist/packlets/json-compatible/index.js.map +1 -0
- package/dist/packlets/json-compatible/validators.js.map +1 -0
- package/dist/packlets/json-file/file.js.map +1 -0
- package/dist/packlets/json-file/index.browser.js.map +1 -0
- package/dist/packlets/json-file/index.js.map +1 -0
- package/dist/packlets/json-file/jsonFsHelper.js.map +1 -0
- package/dist/packlets/json-file/jsonLike.js.map +1 -0
- package/dist/packlets/json-file/jsonTreeHelper.js.map +1 -0
- package/dist/packlets/validators/index.js.map +1 -0
- package/dist/packlets/validators/validators.js.map +1 -0
- package/dist/ts-json-base.d.ts +128 -30
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.browser.d.ts.map +1 -0
- package/lib/index.browser.js.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/packlets/converters/converters.d.ts +27 -1
- package/lib/packlets/converters/converters.d.ts.map +1 -0
- package/lib/packlets/converters/converters.js +12 -0
- package/lib/packlets/converters/converters.js.map +1 -0
- package/lib/packlets/converters/index.d.ts.map +1 -0
- package/lib/packlets/converters/index.js.map +1 -0
- package/lib/packlets/file-tree/directoryItem.d.ts.map +1 -0
- package/lib/packlets/file-tree/directoryItem.js.map +1 -0
- package/lib/packlets/file-tree/fileItem.d.ts +11 -4
- package/lib/packlets/file-tree/fileItem.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileItem.js +11 -4
- package/lib/packlets/file-tree/fileItem.js.map +1 -0
- package/lib/packlets/file-tree/fileTree.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTree.js.map +1 -0
- package/lib/packlets/file-tree/fileTreeAccessors.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTreeAccessors.js.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.inMemory.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.inMemory.js.map +1 -0
- package/lib/packlets/file-tree/fileTreeHelpers.js.map +1 -0
- package/lib/packlets/file-tree/filterSpec.d.ts.map +1 -0
- package/lib/packlets/file-tree/filterSpec.js.map +1 -0
- package/lib/packlets/file-tree/fsTree.d.ts +44 -13
- package/lib/packlets/file-tree/fsTree.d.ts.map +1 -0
- package/lib/packlets/file-tree/fsTree.js +44 -13
- package/lib/packlets/file-tree/fsTree.js.map +1 -0
- package/lib/packlets/file-tree/in-memory/inMemoryTree.d.ts +44 -13
- package/lib/packlets/file-tree/in-memory/inMemoryTree.d.ts.map +1 -0
- package/lib/packlets/file-tree/in-memory/inMemoryTree.js +44 -13
- package/lib/packlets/file-tree/in-memory/inMemoryTree.js.map +1 -0
- package/lib/packlets/file-tree/in-memory/index.d.ts.map +1 -0
- package/lib/packlets/file-tree/in-memory/index.js.map +1 -0
- package/lib/packlets/file-tree/in-memory/treeBuilder.d.ts.map +1 -0
- package/lib/packlets/file-tree/in-memory/treeBuilder.js.map +1 -0
- package/lib/packlets/file-tree/index.browser.d.ts.map +1 -0
- package/lib/packlets/file-tree/index.browser.js.map +1 -0
- package/lib/packlets/file-tree/index.d.ts.map +1 -0
- package/lib/packlets/file-tree/index.js.map +1 -0
- package/lib/packlets/json/common.d.ts.map +1 -0
- package/lib/packlets/json/common.js.map +1 -0
- package/lib/packlets/json/index.d.ts.map +1 -0
- package/lib/packlets/json/index.js.map +1 -0
- package/lib/packlets/json-compatible/common.d.ts.map +1 -0
- package/lib/packlets/json-compatible/common.js.map +1 -0
- package/lib/packlets/json-compatible/converters.d.ts.map +1 -0
- package/lib/packlets/json-compatible/converters.js.map +1 -0
- package/lib/packlets/json-compatible/index.d.ts.map +1 -0
- package/lib/packlets/json-compatible/index.js.map +1 -0
- package/lib/packlets/json-compatible/validators.d.ts.map +1 -0
- package/lib/packlets/json-compatible/validators.js.map +1 -0
- package/lib/packlets/json-file/file.d.ts.map +1 -0
- package/lib/packlets/json-file/file.js.map +1 -0
- package/lib/packlets/json-file/index.browser.d.ts.map +1 -0
- package/lib/packlets/json-file/index.browser.js.map +1 -0
- package/lib/packlets/json-file/index.d.ts.map +1 -0
- package/lib/packlets/json-file/index.js.map +1 -0
- package/lib/packlets/json-file/jsonFsHelper.d.ts.map +1 -0
- package/lib/packlets/json-file/jsonFsHelper.js.map +1 -0
- package/lib/packlets/json-file/jsonLike.d.ts.map +1 -0
- package/lib/packlets/json-file/jsonLike.js.map +1 -0
- package/lib/packlets/json-file/jsonTreeHelper.d.ts.map +1 -0
- package/lib/packlets/json-file/jsonTreeHelper.js.map +1 -0
- package/lib/packlets/validators/index.d.ts.map +1 -0
- package/lib/packlets/validators/index.js.map +1 -0
- package/lib/packlets/validators/validators.d.ts.map +1 -0
- package/lib/packlets/validators/validators.js.map +1 -0
- package/package.json +9 -7
- package/dist/test/fixtures/file-tree/config.json +0 -1
- package/dist/test/fixtures/file-tree/data/items.json +0 -1
- package/dist/test/fixtures/file-tree/docs/api/reference.json +0 -1
- package/dist/test/unit/data/file/bad/bad3.json +0 -3
- package/dist/test/unit/data/file/bad/thing1.json +0 -4
- package/dist/test/unit/data/file/bad/thing2.json +0 -3
- package/dist/test/unit/data/file/good/thing1.json +0 -4
- package/dist/test/unit/data/file/good/thing2.json +0 -3
- package/dist/test/unit/json-compatible/helpers.js +0 -32
package/dist/ts-json-base.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ declare namespace Converters {
|
|
|
105
105
|
export {
|
|
106
106
|
literal,
|
|
107
107
|
enumeratedValue,
|
|
108
|
+
stringifiedJson,
|
|
108
109
|
jsonConverter,
|
|
109
110
|
IJsonConverterContext,
|
|
110
111
|
jsonPrimitive,
|
|
@@ -345,7 +346,9 @@ declare class FileItem<TCT extends string = string> implements IMutableFileTreeF
|
|
|
345
346
|
*/
|
|
346
347
|
static create<TCT extends string = string>(path: string, hal: IFileTreeAccessors<TCT>): Result<FileItem<TCT>>;
|
|
347
348
|
/**
|
|
348
|
-
*
|
|
349
|
+
* Indicates whether this file can be saved.
|
|
350
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
351
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
349
352
|
*/
|
|
350
353
|
getIsMutable(): DetailedResult<boolean, SaveDetail>;
|
|
351
354
|
/**
|
|
@@ -366,15 +369,20 @@ declare class FileItem<TCT extends string = string> implements IMutableFileTreeF
|
|
|
366
369
|
*/
|
|
367
370
|
setContentType(contentType: TCT | undefined): void;
|
|
368
371
|
/**
|
|
369
|
-
*
|
|
372
|
+
* Sets the contents of the file from a JSON value.
|
|
373
|
+
* @param json - The JSON value to serialize and save.
|
|
374
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
370
375
|
*/
|
|
371
376
|
setContents(json: JsonValue): Result<JsonValue>;
|
|
372
377
|
/**
|
|
373
|
-
*
|
|
378
|
+
* Sets the raw contents of the file.
|
|
379
|
+
* @param contents - The string contents to save.
|
|
380
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
374
381
|
*/
|
|
375
382
|
setRawContents(contents: string): Result<string>;
|
|
376
383
|
/**
|
|
377
|
-
*
|
|
384
|
+
* Deletes this file from its backing store.
|
|
385
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
378
386
|
*/
|
|
379
387
|
delete(): Result<boolean>;
|
|
380
388
|
/**
|
|
@@ -542,55 +550,86 @@ declare class FsFileTreeAccessors<TCT extends string = string> implements IMutab
|
|
|
542
550
|
*/
|
|
543
551
|
constructor(params?: IFileTreeInitParams<TCT>);
|
|
544
552
|
/**
|
|
545
|
-
*
|
|
553
|
+
* Resolves paths to an absolute path.
|
|
554
|
+
* @param paths - Paths to resolve.
|
|
555
|
+
* @returns The resolved absolute path.
|
|
546
556
|
*/
|
|
547
557
|
resolveAbsolutePath(...paths: string[]): string;
|
|
548
558
|
/**
|
|
549
|
-
*
|
|
559
|
+
* Gets the extension of a path.
|
|
560
|
+
* @param itemPath - Path to get the extension of.
|
|
561
|
+
* @returns The extension of the path.
|
|
550
562
|
*/
|
|
551
563
|
getExtension(itemPath: string): string;
|
|
552
564
|
/**
|
|
553
|
-
*
|
|
565
|
+
* Gets the base name of a path.
|
|
566
|
+
* @param itemPath - Path to get the base name of.
|
|
567
|
+
* @param suffix - Optional suffix to remove from the base name.
|
|
568
|
+
* @returns The base name of the path.
|
|
554
569
|
*/
|
|
555
570
|
getBaseName(itemPath: string, suffix?: string): string;
|
|
556
571
|
/**
|
|
557
|
-
*
|
|
572
|
+
* Joins paths together.
|
|
573
|
+
* @param paths - Paths to join.
|
|
574
|
+
* @returns The joined paths.
|
|
558
575
|
*/
|
|
559
576
|
joinPaths(...paths: string[]): string;
|
|
560
577
|
/**
|
|
561
|
-
*
|
|
578
|
+
* Gets an item from the file tree.
|
|
579
|
+
* @param itemPath - Path of the item to get.
|
|
580
|
+
* @returns The item if it exists.
|
|
562
581
|
*/
|
|
563
582
|
getItem(itemPath: string): Result<FileTreeItem<TCT>>;
|
|
564
583
|
/**
|
|
565
|
-
*
|
|
584
|
+
* Gets the contents of a file in the file tree.
|
|
585
|
+
* @param filePath - Absolute path of the file.
|
|
586
|
+
* @returns The contents of the file.
|
|
566
587
|
*/
|
|
567
588
|
getFileContents(filePath: string): Result<string>;
|
|
568
589
|
/**
|
|
569
|
-
*
|
|
590
|
+
* Gets the content type of a file in the file tree.
|
|
591
|
+
* @param filePath - Absolute path of the file.
|
|
592
|
+
* @param provided - Optional supplied content type.
|
|
593
|
+
* @returns The content type of the file.
|
|
570
594
|
*/
|
|
571
595
|
getFileContentType(filePath: string, provided?: string): Result<TCT | undefined>;
|
|
572
596
|
/**
|
|
573
|
-
*
|
|
597
|
+
* Gets the children of a directory in the file tree.
|
|
598
|
+
* @param dirPath - Path of the directory.
|
|
599
|
+
* @returns The children of the directory.
|
|
574
600
|
*/
|
|
575
601
|
getChildren(dirPath: string): Result<ReadonlyArray<FileTreeItem<TCT>>>;
|
|
576
602
|
/**
|
|
577
|
-
*
|
|
603
|
+
* Checks if a file at the given path can be saved.
|
|
604
|
+
* @param path - The path to check.
|
|
605
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
606
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
578
607
|
*/
|
|
579
608
|
fileIsMutable(path: string): DetailedResult<boolean, SaveDetail>;
|
|
580
609
|
/**
|
|
581
|
-
*
|
|
610
|
+
* Saves the contents to a file at the given path.
|
|
611
|
+
* @param path - The path of the file to save.
|
|
612
|
+
* @param contents - The string contents to save.
|
|
613
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
582
614
|
*/
|
|
583
615
|
saveFileContents(path: string, contents: string): Result<string>;
|
|
584
616
|
/**
|
|
585
|
-
*
|
|
617
|
+
* Deletes a file at the given path.
|
|
618
|
+
* @param path - The path of the file to delete.
|
|
619
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
586
620
|
*/
|
|
587
621
|
deleteFile(path: string): Result<boolean>;
|
|
588
622
|
/**
|
|
589
|
-
*
|
|
623
|
+
* Creates a directory at the given path, including any missing parent directories.
|
|
624
|
+
* @param dirPath - The path of the directory to create.
|
|
625
|
+
* @returns `Success` with the absolute path if created, or `Failure` with an error message.
|
|
590
626
|
*/
|
|
591
627
|
createDirectory(dirPath: string): Result<string>;
|
|
592
628
|
/**
|
|
593
|
-
*
|
|
629
|
+
* Deletes a directory at the given path.
|
|
630
|
+
* The directory must be empty or the operation will fail.
|
|
631
|
+
* @param dirPath - The path of the directory to delete.
|
|
632
|
+
* @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.
|
|
594
633
|
*/
|
|
595
634
|
deleteDirectory(dirPath: string): Result<boolean>;
|
|
596
635
|
}
|
|
@@ -1011,56 +1050,87 @@ declare class InMemoryTreeAccessors<TCT extends string = string> implements IMut
|
|
|
1011
1050
|
*/
|
|
1012
1051
|
static create<TCT extends string = string>(files: IInMemoryFile<TCT>[], params?: IFileTreeInitParams<TCT>): Result<InMemoryTreeAccessors<TCT>>;
|
|
1013
1052
|
/**
|
|
1014
|
-
*
|
|
1053
|
+
* Resolves paths to an absolute path.
|
|
1054
|
+
* @param paths - Paths to resolve.
|
|
1055
|
+
* @returns The resolved absolute path.
|
|
1015
1056
|
*/
|
|
1016
1057
|
resolveAbsolutePath(...paths: string[]): string;
|
|
1017
1058
|
/**
|
|
1018
|
-
*
|
|
1059
|
+
* Gets the extension of a path.
|
|
1060
|
+
* @param path - Path to get the extension of.
|
|
1061
|
+
* @returns The extension of the path.
|
|
1019
1062
|
*/
|
|
1020
1063
|
getExtension(path: string): string;
|
|
1021
1064
|
/**
|
|
1022
|
-
*
|
|
1065
|
+
* Gets the base name of a path.
|
|
1066
|
+
* @param path - Path to get the base name of.
|
|
1067
|
+
* @param suffix - Optional suffix to remove from the base name.
|
|
1068
|
+
* @returns The base name of the path.
|
|
1023
1069
|
*/
|
|
1024
1070
|
getBaseName(path: string, suffix?: string): string;
|
|
1025
1071
|
/**
|
|
1026
|
-
*
|
|
1072
|
+
* Joins paths together.
|
|
1073
|
+
* @param paths - Paths to join.
|
|
1074
|
+
* @returns The joined paths.
|
|
1027
1075
|
*/
|
|
1028
1076
|
joinPaths(...paths: string[]): string;
|
|
1029
1077
|
/**
|
|
1030
|
-
*
|
|
1078
|
+
* Gets an item from the file tree.
|
|
1079
|
+
* @param itemPath - Path of the item to get.
|
|
1080
|
+
* @returns The item if it exists.
|
|
1031
1081
|
*/
|
|
1032
1082
|
getItem(itemPath: string): Result<FileTreeItem<TCT>>;
|
|
1033
1083
|
/**
|
|
1034
|
-
*
|
|
1084
|
+
* Gets the contents of a file in the file tree.
|
|
1085
|
+
* @param path - Absolute path of the file.
|
|
1086
|
+
* @returns The contents of the file.
|
|
1035
1087
|
*/
|
|
1036
1088
|
getFileContents(path: string): Result<string>;
|
|
1037
1089
|
/**
|
|
1038
|
-
*
|
|
1090
|
+
* Gets the content type of a file in the file tree.
|
|
1091
|
+
* @param path - Absolute path of the file.
|
|
1092
|
+
* @param provided - Optional supplied content type.
|
|
1093
|
+
* @returns The content type of the file.
|
|
1039
1094
|
*/
|
|
1040
1095
|
getFileContentType(path: string, provided?: string): Result<TCT | undefined>;
|
|
1041
1096
|
/**
|
|
1042
|
-
*
|
|
1097
|
+
* Gets the children of a directory in the file tree.
|
|
1098
|
+
* @param path - Path of the directory.
|
|
1099
|
+
* @returns The children of the directory.
|
|
1043
1100
|
*/
|
|
1044
1101
|
getChildren(path: string): Result<ReadonlyArray<FileTreeItem<TCT>>>;
|
|
1045
1102
|
private _addMutableFile;
|
|
1046
1103
|
/**
|
|
1047
|
-
*
|
|
1104
|
+
* Creates a directory at the given path, including any missing parent directories.
|
|
1105
|
+
* @param dirPath - The path of the directory to create.
|
|
1106
|
+
* @returns `Success` with the absolute path if created, or `Failure` with an error message.
|
|
1048
1107
|
*/
|
|
1049
1108
|
createDirectory(dirPath: string): Result<string>;
|
|
1050
1109
|
/**
|
|
1051
|
-
*
|
|
1110
|
+
* Checks if a file at the given path can be saved.
|
|
1111
|
+
* @param path - The path to check.
|
|
1112
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
1113
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
1052
1114
|
*/
|
|
1053
1115
|
fileIsMutable(path: string): DetailedResult<boolean, SaveDetail>;
|
|
1054
1116
|
/**
|
|
1055
|
-
*
|
|
1117
|
+
* Deletes a file at the given path.
|
|
1118
|
+
* @param path - The path of the file to delete.
|
|
1119
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
1056
1120
|
*/
|
|
1057
1121
|
deleteFile(path: string): Result<boolean>;
|
|
1058
1122
|
/**
|
|
1059
|
-
*
|
|
1123
|
+
* Deletes a directory at the given path.
|
|
1124
|
+
* The directory must be empty or the operation will fail.
|
|
1125
|
+
* @param path - The path of the directory to delete.
|
|
1126
|
+
* @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.
|
|
1060
1127
|
*/
|
|
1061
1128
|
deleteDirectory(path: string): Result<boolean>;
|
|
1062
1129
|
/**
|
|
1063
|
-
*
|
|
1130
|
+
* Saves the contents to a file at the given path.
|
|
1131
|
+
* @param path - The path of the file to save.
|
|
1132
|
+
* @param contents - The string contents to save.
|
|
1133
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
1064
1134
|
*/
|
|
1065
1135
|
saveFileContents(path: string, contents: string): Result<string>;
|
|
1066
1136
|
}
|
|
@@ -1750,6 +1820,34 @@ declare const string: StringConverter<string, IJsonConverterContext>;
|
|
|
1750
1820
|
*/
|
|
1751
1821
|
declare const string_2: Validation.Classes.StringValidator<string, IJsonValidatorContext>;
|
|
1752
1822
|
|
|
1823
|
+
/**
|
|
1824
|
+
* Creates a converter that accepts a string, parses it as JSON, and optionally
|
|
1825
|
+
* applies the supplied inner converter or validator to the parsed value.
|
|
1826
|
+
*
|
|
1827
|
+
* @remarks
|
|
1828
|
+
* Unlike {@link Converters.jsonConverter}, the inner step is optional. When omitted, the
|
|
1829
|
+
* converter resolves to the parsed `JsonValue` (object, array, or primitive).
|
|
1830
|
+
* Both `Converter<T>` and `Validator<T>` are accepted because both expose
|
|
1831
|
+
* `convert(unknown): Result<T>`.
|
|
1832
|
+
*
|
|
1833
|
+
* @param inner - Optional `Converter<T>` or `Validator<T>` applied to the
|
|
1834
|
+
* parsed JSON value.
|
|
1835
|
+
* @returns Converter that parses a JSON string into `T` (or `JsonValue` when
|
|
1836
|
+
* no inner step is supplied).
|
|
1837
|
+
* @public
|
|
1838
|
+
*/
|
|
1839
|
+
declare function stringifiedJson(): Converter<JsonValue>;
|
|
1840
|
+
|
|
1841
|
+
/**
|
|
1842
|
+
* Creates a converter that accepts a string, parses it as JSON, and applies
|
|
1843
|
+
* the supplied inner converter or validator to the parsed value.
|
|
1844
|
+
*
|
|
1845
|
+
* @param inner - `Converter<T>` or `Validator<T>` applied to the parsed JSON.
|
|
1846
|
+
* @returns Converter that parses a JSON string into `T`.
|
|
1847
|
+
* @public
|
|
1848
|
+
*/
|
|
1849
|
+
declare function stringifiedJson<T>(inner: Converter<T> | Validator<T>): Converter<T>;
|
|
1850
|
+
|
|
1753
1851
|
/**
|
|
1754
1852
|
* A validator which validates a supplied `unknown` value to a valid {@link JsonCompatibleType | JsonCompatible} value.
|
|
1755
1853
|
* @public
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AAEpD,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAE7D,OAAO,KAAK,QAAQ,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AAEpD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../src/index.browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAAoD;AAS3C,gCAAU;AARnB,yDAAyD;AACzD,6EAA+D;AAO1C,4BAAQ;AAN7B,2EAA6D;AAM9B,wCAAc;AAL7C,yDAAyD;AACzD,6EAA+D;AAIhB,4BAAQ;AAHvD,kEAAoD;AAGK,gCAAU;AADnE,kDAAgC","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Converters from './packlets/converters';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as FileTree from './packlets/file-tree/index.browser';\nimport * as JsonCompatible from './packlets/json-compatible';\n// eslint-disable-next-line @rushstack/packlets/mechanics\nimport * as JsonFile from './packlets/json-file/index.browser';\nimport * as Validators from './packlets/validators';\n\nexport * from './packlets/json';\nexport { Converters, FileTree, JsonCompatible, JsonFile, Validators };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC;AACjD,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AAEpD,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC"}
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kEAAoD;AAO3C,gCAAU;AANnB,+DAAiD;AAM5B,4BAAQ;AAL7B,2EAA6D;AAK9B,wCAAc;AAJ7C,+DAAiD;AAIF,4BAAQ;AAHvD,kEAAoD;AAGK,gCAAU;AADnE,kDAAgC","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as Converters from './packlets/converters';\nimport * as FileTree from './packlets/file-tree';\nimport * as JsonCompatible from './packlets/json-compatible';\nimport * as JsonFile from './packlets/json-file';\nimport * as Validators from './packlets/validators';\n\nexport * from './packlets/json';\nexport { Converters, FileTree, JsonCompatible, JsonFile, Validators };\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Converter, StringConverter } from '@fgv/ts-utils';
|
|
1
|
+
import { Converter, StringConverter, Validator } from '@fgv/ts-utils';
|
|
2
2
|
import { JsonArray, JsonObject, JsonPrimitive, JsonValue } from '../json';
|
|
3
3
|
/**
|
|
4
4
|
* Conversion context for JSON converters.
|
|
@@ -82,6 +82,32 @@ export declare function literal<T>(value: T): Converter<T, IJsonConverterContext
|
|
|
82
82
|
* @public
|
|
83
83
|
*/
|
|
84
84
|
export declare function enumeratedValue<T>(values: ReadonlyArray<T>, message?: string): Converter<T, IJsonConverterContext | ReadonlyArray<T>>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a converter that accepts a string, parses it as JSON, and optionally
|
|
87
|
+
* applies the supplied inner converter or validator to the parsed value.
|
|
88
|
+
*
|
|
89
|
+
* @remarks
|
|
90
|
+
* Unlike {@link Converters.jsonConverter}, the inner step is optional. When omitted, the
|
|
91
|
+
* converter resolves to the parsed `JsonValue` (object, array, or primitive).
|
|
92
|
+
* Both `Converter<T>` and `Validator<T>` are accepted because both expose
|
|
93
|
+
* `convert(unknown): Result<T>`.
|
|
94
|
+
*
|
|
95
|
+
* @param inner - Optional `Converter<T>` or `Validator<T>` applied to the
|
|
96
|
+
* parsed JSON value.
|
|
97
|
+
* @returns Converter that parses a JSON string into `T` (or `JsonValue` when
|
|
98
|
+
* no inner step is supplied).
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export declare function stringifiedJson(): Converter<JsonValue>;
|
|
102
|
+
/**
|
|
103
|
+
* Creates a converter that accepts a string, parses it as JSON, and applies
|
|
104
|
+
* the supplied inner converter or validator to the parsed value.
|
|
105
|
+
*
|
|
106
|
+
* @param inner - `Converter<T>` or `Validator<T>` applied to the parsed JSON.
|
|
107
|
+
* @returns Converter that parses a JSON string into `T`.
|
|
108
|
+
* @public
|
|
109
|
+
*/
|
|
110
|
+
export declare function stringifiedJson<T>(inner: Converter<T> | Validator<T>): Converter<T>;
|
|
85
111
|
/**
|
|
86
112
|
* Creates a converter that parses JSON string content and then applies the supplied converter.
|
|
87
113
|
* @param converter - Converter to apply to the parsed JSON
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../src/packlets/converters/converters.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,SAAS,EAGT,eAAe,EACf,SAAS,EAIV,MAAM,eAAe,CAAC;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AC;AACxD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAarF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAkBtE"}
|
|
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
exports.boolean = exports.number = exports.string = exports.jsonValue = exports.jsonArray = exports.jsonObject = exports.jsonPrimitive = void 0;
|
|
25
25
|
exports.literal = literal;
|
|
26
26
|
exports.enumeratedValue = enumeratedValue;
|
|
27
|
+
exports.stringifiedJson = stringifiedJson;
|
|
27
28
|
exports.jsonConverter = jsonConverter;
|
|
28
29
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
29
30
|
const json_1 = require("../json");
|
|
@@ -190,6 +191,17 @@ function enumeratedValue(values, message) {
|
|
|
190
191
|
return (0, ts_utils_1.fail)(message !== null && message !== void 0 ? message : `Invalid enumerated value ${JSON.stringify(from)}`);
|
|
191
192
|
});
|
|
192
193
|
}
|
|
194
|
+
function stringifiedJson(inner) {
|
|
195
|
+
const step = inner !== null && inner !== void 0 ? inner : exports.jsonValue;
|
|
196
|
+
return new ts_utils_1.Conversion.BaseConverter((from) => {
|
|
197
|
+
if (typeof from !== 'string') {
|
|
198
|
+
return (0, ts_utils_1.fail)('stringifiedJson: input must be a string.');
|
|
199
|
+
}
|
|
200
|
+
return (0, ts_utils_1.captureResult)(() => JSON.parse(from))
|
|
201
|
+
.withErrorFormat((msg) => `stringifiedJson: failed to parse JSON: ${msg}`)
|
|
202
|
+
.onSuccess((parsed) => step.convert(parsed));
|
|
203
|
+
});
|
|
204
|
+
}
|
|
193
205
|
/**
|
|
194
206
|
* Creates a converter that parses JSON string content and then applies the supplied converter.
|
|
195
207
|
* @param converter - Converter to apply to the parsed JSON
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.js","sourceRoot":"","sources":["../../../src/packlets/converters/converters.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA2MH,0BAEC;AAgBD,0CAkBC;AA4BD,0CAUC;AAQD,sCAkBC;AA7SD,4CAUuB;AACvB,kCAAqG;AAYrG;;;GAGG;AACU,QAAA,aAAa,GAAoD,IAAI,qBAAU,CAAC,aAAa,CACxG,CACE,IAAa,EACb,MAAuD,EACvD,GAA2B,EACJ,EAAE;IACzB,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IACD,QAAQ,OAAO,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;QACvB,KAAK,QAAQ;YACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,OAAO,IAAA,kBAAO,EAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YACD,MAAM;IACV,CAAC;IACD,OAAO,IAAA,eAAI,EAAC,IAAI,MAAM,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;AAC5D,CAAC,CACF,CAAC;AAEF;;;;;;;;GAQG;AACU,QAAA,UAAU,GAAiD,IAAI,qBAAU,CAAC,aAAa,CAClG,CACE,IAAa,EACb,MAAoD,EACpD,GAA2B,EACP,EAAE;IACtB,IAAI,CAAC,IAAA,mBAAY,EAAC,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,IAAA,eAAI,EAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;IACD,MAAM,GAAG,GAAe,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,M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,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClD,OAAO,IAAA,eAAI,EAAC,sDAAsD,CAAC,CAAC;QACtE,CAAC;QAED,OAAO,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*\n * Copyright (c) 2023 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport {\n Conversion,\n Converter,\n Converters as BaseConverters,\n Result,\n StringConverter,\n Validator,\n captureResult,\n fail,\n succeed\n} from '@fgv/ts-utils';\nimport { JsonArray, JsonObject, JsonPrimitive, JsonValue, isJsonArray, isJsonObject } from '../json';\n\n/* eslint-disable @typescript-eslint/no-use-before-define */\n\n/**\n * Conversion context for JSON converters.\n * @public\n */\nexport interface IJsonConverterContext {\n ignoreUndefinedProperties?: boolean;\n}\n\n/**\n * An converter which converts a supplied `unknown` value to a valid {@link JsonPrimitive | JsonPrimitive}.\n * @public\n */\nexport const jsonPrimitive: Converter<JsonPrimitive, IJsonConverterContext> = new Conversion.BaseConverter(\n (\n from: unknown,\n __self: Converter<JsonPrimitive, IJsonConverterContext>,\n ctx?: IJsonConverterContext\n ): Result<JsonPrimitive> => {\n if (from === null) {\n return succeed(null);\n }\n switch (typeof from) {\n case 'boolean':\n case 'string':\n return succeed(from);\n case 'number':\n if (!Number.isNaN(from)) {\n return succeed(from);\n }\n break;\n }\n return fail(`\"${String(from)}\": invalid JSON primitive.`);\n }\n);\n\n/**\n * An copying converter which converts a supplied `unknown` value into\n * a valid {@link JsonObject | JsonObject}. Fails by default if any properties or array elements\n * are `undefined` - this default behavior can be overridden by supplying an appropriate\n * `IJsonConverterContext` at runtime.\n *\n * Guaranteed to return a new object.\n * @public\n */\nexport const jsonObject: Converter<JsonObject, IJsonConverterContext> = new Conversion.BaseConverter(\n (\n from: unknown,\n __self: Converter<JsonObject, IJsonConverterContext>,\n ctx?: IJsonConverterContext\n ): Result<JsonObject> => {\n if (!isJsonObject(from)) {\n return fail('invalid JSON object.');\n }\n const obj: JsonObject = {};\n const errors: string[] = [];\n for (const [name, value] of Object.entries(from)) {\n if (value === undefined && ctx?.ignoreUndefinedProperties === true) {\n // optionally ignore undefined values\n continue;\n }\n jsonValue\n .convert(value, ctx)\n .onSuccess((v: JsonValue) => {\n obj[name] = v;\n return succeed(v);\n })\n .onFailure((m) => {\n errors.push(`${name}: ${m}`);\n return fail(m);\n });\n }\n if (errors.length > 0) {\n return fail(`invalid JSON object:\\n${errors.join('\\n')}`);\n }\n return succeed(obj);\n }\n);\n\n/**\n * An copying converter which converts a supplied `unknown` value to\n * a valid {@link JsonArray | JsonArray}. Fails by default if any properties or array elements\n * are `undefined` - this default behavior can be overridden by supplying an appropriate\n * `IJsonConverterContext` at runtime.\n *\n * Guaranteed to return a new array.\n * @public\n */\nexport const jsonArray: Converter<JsonArray, IJsonConverterContext> = new Conversion.BaseConverter(\n (\n from: unknown,\n __self: Converter<JsonArray, IJsonConverterContext>,\n ctx?: IJsonConverterContext\n ): Result<JsonArray> => {\n if (!isJsonArray(from)) {\n return fail('not an array');\n }\n const arr: JsonValue[] = [];\n const errors: string[] = [];\n for (let i = 0; i < from.length; i++) {\n const value = from[i];\n if (value === undefined && ctx?.ignoreUndefinedProperties === true) {\n // convert undefined to 'null' for parity with JSON.stringify\n arr.push(null);\n continue;\n }\n jsonValue\n .convert(value, ctx)\n .onSuccess((v) => {\n arr.push(v);\n return succeed(v);\n })\n .onFailure((m) => {\n errors.push(`${i}: ${m}`);\n return fail(m);\n });\n }\n if (errors.length > 0) {\n return fail(`array contains non-json elements:\\n${errors.join('\\n')}`);\n }\n return succeed(arr);\n }\n);\n\n/**\n * An copying converter which converts a supplied `unknown` value to a\n * valid {@link JsonValue | JsonValue}. Fails by default if any properties or array elements\n * are `undefined` - this default behavior can be overridden by supplying an appropriate\n * `IJsonConverterContext` at runtime.\n * @public\n */\nexport const jsonValue: Converter<JsonValue, IJsonConverterContext> = new Conversion.BaseConverter<\n JsonValue,\n IJsonConverterContext\n>(\n (\n from: unknown,\n __self: Converter<JsonValue, IJsonConverterContext>,\n ctx?: IJsonConverterContext\n ): Result<JsonValue> => {\n if (isJsonArray(from)) {\n return jsonArray.convert(from, ctx);\n } else if (isJsonObject(from)) {\n return jsonObject.convert(from, ctx);\n }\n return jsonPrimitive.convert(from, ctx);\n }\n);\n\n/**\n * A `StringConverter` which converts `unknown` to a `string`.\n * Accepts `IJsonConverterContext` but ignores it.\n * @public\n */\nexport const string: StringConverter<string, IJsonConverterContext> = new StringConverter<\n string,\n IJsonConverterContext\n>();\n\n/**\n * A `Converter` which converts `unknown` to a `number`.\n * Accepts `IJsonConverterContext` but ignores it.\n * Mirrors the behavior of `@fgv/ts-utils`.\n * @public\n */\nexport const number: Converter<number, IJsonConverterContext> = new Conversion.BaseConverter<\n number,\n IJsonConverterContext\n>((from: unknown): Result<number> => BaseConverters.number.convert(from));\n\n/**\n * A `Converter` which converts `unknown` to a `boolean`.\n * Accepts `IJsonConverterContext` but ignores it.\n * Mirrors the behavior of `@fgv/ts-utils`.\n * @public\n */\nexport const boolean: Converter<boolean, IJsonConverterContext> = new Conversion.BaseConverter<\n boolean,\n IJsonConverterContext\n>((from: unknown): Result<boolean> => BaseConverters.boolean.convert(from));\n\n/**\n * Helper to create a converter for a literal value.\n * Accepts `IJsonConverterContext` but ignores it.\n * Mirrors the behavior of `@fgv/ts-utils`.\n * @public\n */\nexport function literal<T>(value: T): Converter<T, IJsonConverterContext> {\n return BaseConverters.literal<T, IJsonConverterContext>(value);\n}\n\n/**\n * Helper function to create a `Converter` which converts `unknown` to one of a set of\n * supplied enumerated values. Anything else fails.\n *\n * @remarks\n * This JSON variant accepts an `IJsonConverterContext` OR\n * a `ReadonlyArray<T>` as its conversion context. If the context is an array, it is used to override the\n * allowed values for that conversion; otherwise, the original `values` supplied at creation time are used.\n *\n * @param values - Array of allowed values.\n * @param message - Optional custom failure message.\n * @returns A new `Converter` returning `<T>`.\n * @public\n */\nexport function enumeratedValue<T>(\n values: ReadonlyArray<T>,\n message?: string\n): Converter<T, IJsonConverterContext | ReadonlyArray<T>> {\n return new Conversion.BaseConverter<T, IJsonConverterContext | ReadonlyArray<T>>(\n (\n from: unknown,\n __self: Converter<T, IJsonConverterContext | ReadonlyArray<T>>,\n context?: IJsonConverterContext | ReadonlyArray<T>\n ): Result<T> => {\n const effectiveValues = Array.isArray(context) ? (context as ReadonlyArray<T>) : values;\n const index = effectiveValues.indexOf(from as T);\n if (index >= 0) {\n return succeed(effectiveValues[index]);\n }\n return fail(message ?? `Invalid enumerated value ${JSON.stringify(from)}`);\n }\n );\n}\n\n/**\n * Creates a converter that accepts a string, parses it as JSON, and optionally\n * applies the supplied inner converter or validator to the parsed value.\n *\n * @remarks\n * Unlike {@link Converters.jsonConverter}, the inner step is optional. When omitted, the\n * converter resolves to the parsed `JsonValue` (object, array, or primitive).\n * Both `Converter<T>` and `Validator<T>` are accepted because both expose\n * `convert(unknown): Result<T>`.\n *\n * @param inner - Optional `Converter<T>` or `Validator<T>` applied to the\n * parsed JSON value.\n * @returns Converter that parses a JSON string into `T` (or `JsonValue` when\n * no inner step is supplied).\n * @public\n */\nexport function stringifiedJson(): Converter<JsonValue>;\n/**\n * Creates a converter that accepts a string, parses it as JSON, and applies\n * the supplied inner converter or validator to the parsed value.\n *\n * @param inner - `Converter<T>` or `Validator<T>` applied to the parsed JSON.\n * @returns Converter that parses a JSON string into `T`.\n * @public\n */\nexport function stringifiedJson<T>(inner: Converter<T> | Validator<T>): Converter<T>;\nexport function stringifiedJson<T>(inner?: Converter<T> | Validator<T>): Converter<T | JsonValue> {\n const step: { convert(from: unknown): Result<T | JsonValue> } = inner ?? jsonValue;\n return new Conversion.BaseConverter<T | JsonValue>((from: unknown): Result<T | JsonValue> => {\n if (typeof from !== 'string') {\n return fail('stringifiedJson: input must be a string.');\n }\n return captureResult<unknown>(() => JSON.parse(from))\n .withErrorFormat((msg) => `stringifiedJson: failed to parse JSON: ${msg}`)\n .onSuccess((parsed) => step.convert(parsed));\n });\n}\n\n/**\n * Creates a converter that parses JSON string content and then applies the supplied converter.\n * @param converter - Converter to apply to the parsed JSON\n * @returns Converter that parses JSON then validates\n * @public\n */\nexport function jsonConverter<T>(converter: Converter<T>): Converter<T> {\n return new Conversion.BaseConverter<T>((from: unknown): Result<T> => {\n if (typeof from !== 'string') {\n return fail('Input must be a string');\n }\n\n const parseResult = captureResult(() => JSON.parse(from));\n if (parseResult.isFailure()) {\n return fail(`Failed to parse JSON: ${parseResult.message}`);\n }\n\n const parsed = parseResult.value;\n if (typeof parsed !== 'object' || parsed === null) {\n return fail('Failed to parse JSON: JSON content must be an object');\n }\n\n return converter.convert(parsed);\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/packlets/converters/index.ts"],"names":[],"mappings":"AAsBA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/packlets/converters/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;AAEH,+CAA6B","sourcesContent":["/*\n * Copyright (c) 2020 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nexport * from './converters';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directoryItem.d.ts","sourceRoot":"","sources":["../../../src/packlets/file-tree/directoryItem.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAgC,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,6BAA6B,EAC7B,wBAAwB,EAGzB,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,qBAAa,aAAa,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,CAAE,YAAW,6BAA6B,CAAC,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AE,CAAC;wBACvB,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;oBACzD,6EAA6E;oBAC7E,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;wBACvB,OAAO,MAAM,CAAC;oBAChB,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAhKD,sCAgKC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Result, captureResult, fail, succeed } from '@fgv/ts-utils';\nimport {\n FileTreeItem,\n IDeleteChildOptions,\n IFileTreeAccessors,\n IMutableFileTreeDirectoryItem,\n IMutableFileTreeFileItem,\n isMutableAccessors,\n isMutableFileItem\n} from './fileTreeAccessors';\n\n/**\n * Class representing a directory in a file tree.\n * @public\n */\nexport class DirectoryItem<TCT extends string = string> implements IMutableFileTreeDirectoryItem<TCT> {\n /**\n * {@inheritDoc FileTree.IFileTreeDirectoryItem.\"type\"}\n */\n public readonly type: 'directory' = 'directory';\n\n /**\n * {@inheritDoc FileTree.IFileTreeDirectoryItem.absolutePath}\n */\n public readonly absolutePath: string;\n\n /**\n * {@inheritDoc FileTree.IFileTreeDirectoryItem.name}\n */\n public get name(): string {\n return this._hal.getBaseName(this.absolutePath);\n }\n\n /**\n * The {@link FileTree.IFileTreeAccessors | accessors} to use for file system operations.\n * @public\n */\n protected readonly _hal: IFileTreeAccessors<TCT>;\n\n /**\n * Protected constructor for derived classes.\n * @param path - Relative path of the directory.\n * @param hal - The {@link FileTree.IFileTreeAccessors | accessors} to use for\n * file system operations.\n * @public\n */\n protected constructor(path: string, hal: IFileTreeAccessors<TCT>) {\n this._hal = hal;\n this.absolutePath = hal.resolveAbsolutePath(path);\n }\n\n /**\n * Creates a new DirectoryItem instance.\n * @param path - Relative path of the directory.\n * @param hal - The {@link FileTree.IFileTreeAccessors | accessors} to use for\n * file system operations.\n * @returns `Success` with the new {@link FileTree.DirectoryItem | DirectoryItem} instance if successful,\n * or `Failure` with an error message otherwise.\n */\n public static create<TCT extends string = string>(\n path: string,\n hal: IFileTreeAccessors<TCT>\n ): Result<DirectoryItem<TCT>> {\n return captureResult(() => new DirectoryItem<TCT>(path, hal));\n }\n\n /**\n * {@inheritDoc FileTree.IFileTreeDirectoryItem.getChildren}\n */\n public getChildren(): Result<ReadonlyArray<FileTreeItem<TCT>>> {\n return this._hal.getChildren(this.absolutePath);\n }\n\n /**\n * {@inheritDoc FileTree.IMutableFileTreeDirectoryItem.createChildFile}\n */\n public createChildFile(name: string, contents: string): Result<IMutableFileTreeFileItem<TCT>> {\n const hal = this._hal;\n if (!isMutableAccessors(hal)) {\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return fail(`${this.absolutePath}: mutation not supported`);\n }\n\n const filePath = hal.joinPaths(this.absolutePath, name);\n return hal.saveFileContents(filePath, contents).onSuccess(() =>\n hal.getItem(filePath).onSuccess((item) => {\n /* c8 ignore next 3 - defensive: verifies accessor returned correct item type after save */\n if (!isMutableFileItem(item)) {\n return fail(`${filePath}: expected mutable file but got ${item.type}`);\n }\n return succeed(item);\n })\n );\n }\n\n /**\n * {@inheritDoc FileTree.IMutableFileTreeDirectoryItem.createChildDirectory}\n */\n public createChildDirectory(name: string): Result<IMutableFileTreeDirectoryItem<TCT>> {\n const hal = this._hal;\n if (!isMutableAccessors(hal)) {\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return fail(`${this.absolutePath}: mutation not supported`);\n }\n\n const dirPath = hal.joinPaths(this.absolutePath, name);\n return hal.createDirectory(dirPath).onSuccess(() => DirectoryItem.create(dirPath, hal));\n }\n\n /**\n * {@inheritDoc FileTree.IMutableFileTreeDirectoryItem.deleteChild}\n */\n public deleteChild(name: string, options?: IDeleteChildOptions): Result<boolean> {\n const hal = this._hal;\n if (!isMutableAccessors(hal)) {\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return fail(`${this.absolutePath}: mutation not supported`);\n }\n\n const childPath = hal.joinPaths(this.absolutePath, name);\n return hal.getItem(childPath).onSuccess((item) => {\n if (item.type === 'file') {\n return hal.deleteFile(childPath);\n }\n // Directory child\n if (options?.recursive) {\n return this._deleteRecursive(childPath);\n }\n return hal.deleteDirectory(childPath);\n });\n }\n\n /**\n * {@inheritDoc FileTree.IMutableFileTreeDirectoryItem.delete}\n */\n public delete(): Result<boolean> {\n const hal = this._hal;\n if (!isMutableAccessors(hal)) {\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return fail(`${this.absolutePath}: mutation not supported`);\n }\n return hal.deleteDirectory(this.absolutePath);\n }\n\n /**\n * Recursively deletes all children of a directory and then the directory itself.\n * @param dirPath - The absolute path of the directory to delete.\n * @returns `Success` with `true` if the directory was deleted, or `Failure` with an error message.\n * @internal\n */\n private _deleteRecursive(dirPath: string): Result<boolean> {\n const hal = this._hal;\n /* c8 ignore next 3 - defensive: caller already verified mutable */\n if (!isMutableAccessors(hal)) {\n return fail(`${dirPath}: mutation not supported`);\n }\n return hal.getChildren(dirPath).onSuccess((children) => {\n for (const child of children) {\n if (child.type === 'file') {\n const result = hal.deleteFile(child.absolutePath);\n /* c8 ignore next 3 - defensive: error propagation during recursive delete */\n if (result.isFailure()) {\n return result;\n }\n } else {\n const result = this._deleteRecursive(child.absolutePath);\n /* c8 ignore next 3 - defensive: error propagation during recursive delete */\n if (result.isFailure()) {\n return result;\n }\n }\n }\n return hal.deleteDirectory(dirPath);\n });\n }\n}\n"]}
|
|
@@ -58,7 +58,9 @@ export declare class FileItem<TCT extends string = string> implements IMutableFi
|
|
|
58
58
|
*/
|
|
59
59
|
static create<TCT extends string = string>(path: string, hal: IFileTreeAccessors<TCT>): Result<FileItem<TCT>>;
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
61
|
+
* Indicates whether this file can be saved.
|
|
62
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
63
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
62
64
|
*/
|
|
63
65
|
getIsMutable(): DetailedResult<boolean, SaveDetail>;
|
|
64
66
|
/**
|
|
@@ -79,15 +81,20 @@ export declare class FileItem<TCT extends string = string> implements IMutableFi
|
|
|
79
81
|
*/
|
|
80
82
|
setContentType(contentType: TCT | undefined): void;
|
|
81
83
|
/**
|
|
82
|
-
*
|
|
84
|
+
* Sets the contents of the file from a JSON value.
|
|
85
|
+
* @param json - The JSON value to serialize and save.
|
|
86
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
83
87
|
*/
|
|
84
88
|
setContents(json: JsonValue): Result<JsonValue>;
|
|
85
89
|
/**
|
|
86
|
-
*
|
|
90
|
+
* Sets the raw contents of the file.
|
|
91
|
+
* @param contents - The string contents to save.
|
|
92
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
87
93
|
*/
|
|
88
94
|
setRawContents(contents: string): Result<string>;
|
|
89
95
|
/**
|
|
90
|
-
*
|
|
96
|
+
* Deletes this file from its backing store.
|
|
97
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
91
98
|
*/
|
|
92
99
|
delete(): Result<boolean>;
|
|
93
100
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileItem.d.ts","sourceRoot":"","sources":["../../../src/packlets/file-tree/fileItem.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,cAAc,EAAwB,MAAM,EAAoB,MAAM,eAAe,CAAC;AAC9G,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EAExB,UAAU,EACX,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,qBAAa,QAAQ,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,CAAE,YAAW,wBAAwB,CAAC,GAAG,CAAC;IACzF;;OAEG;IACH,SAAgB,IAAI,EAAE,MAAM,CAAU;IAEtC;;OAEG;IACH,SAAgB,YAAY,EAAE,MAAM,CAAC;IAErC;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,GAAG,GAAG,SAAS,CAExC;IAED;;;OAGG;IACH,OAAO,CAAC,YAAY,CAAkB;IAEtC;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,SAAS,aAA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80,9 @@ class FileItem {
|
|
|
80
80
|
return (0, ts_utils_1.captureResult)(() => new FileItem(path, hal));
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* Indicates whether this file can be saved.
|
|
84
|
+
* @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,
|
|
85
|
+
* or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.
|
|
84
86
|
*/
|
|
85
87
|
getIsMutable() {
|
|
86
88
|
if ((0, fileTreeAccessors_1.isMutableAccessors)(this._hal)) {
|
|
@@ -114,13 +116,17 @@ class FileItem {
|
|
|
114
116
|
this._contentType = contentType;
|
|
115
117
|
}
|
|
116
118
|
/**
|
|
117
|
-
*
|
|
119
|
+
* Sets the contents of the file from a JSON value.
|
|
120
|
+
* @param json - The JSON value to serialize and save.
|
|
121
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
118
122
|
*/
|
|
119
123
|
setContents(json) {
|
|
120
124
|
return (0, ts_utils_1.captureResult)(() => JSON.stringify(json, null, 2)).onSuccess((contents) => this.setRawContents(contents).onSuccess(() => ts_utils_1.Success.with(json)));
|
|
121
125
|
}
|
|
122
126
|
/**
|
|
123
|
-
*
|
|
127
|
+
* Sets the raw contents of the file.
|
|
128
|
+
* @param contents - The string contents to save.
|
|
129
|
+
* @returns `Success` if the file was saved, or `Failure` with an error message.
|
|
124
130
|
*/
|
|
125
131
|
setRawContents(contents) {
|
|
126
132
|
if ((0, fileTreeAccessors_1.isMutableAccessors)(this._hal)) {
|
|
@@ -130,7 +136,8 @@ class FileItem {
|
|
|
130
136
|
return (0, ts_utils_1.fail)(`${this.absolutePath}: mutation not supported`);
|
|
131
137
|
}
|
|
132
138
|
/**
|
|
133
|
-
*
|
|
139
|
+
* Deletes this file from its backing store.
|
|
140
|
+
* @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.
|
|
134
141
|
*/
|
|
135
142
|
delete() {
|
|
136
143
|
if (!(0, fileTreeAccessors_1.isMutableAccessors)(this._hal)) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileItem.js","sourceRoot":"","sources":["../../../src/packlets/file-tree/fileItem.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,4CAA8G;AAG9G,2DAK6B;AAE7B;;;GAGG;AACH,MAAa,QAAQ;IAWnB;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAcD;;;;;;OAMG;IACH,YAAsB,IAAY,EAAE,GAA4B;QAzDhE;;WAEG;QACa,SAAI,GAAW,MAAM,CAAC;QAuDpC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,EAAE,CAAC;IAC5E,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,CAClB,IAAY,EACZ,GAA4B;QAE5B,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED;;;;OAI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/E,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,kBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAClE,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,QAAgB;QACpC,IAAI,IAAA,sCAAkB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACjE,CAAC;QACD,mGAAmG;QACnG,OAAO,IAAA,eAAI,EAAC,GAAG,IAAI,CAAC,YAAY,0BAA0B,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACI,MAAM;QACX,IAAI,CAAC,IAAA,sCAAkB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,mGAAmG;YACnG,OAAO,IAAA,eAAI,EAAC,GAAG,IAAI,CAAC,YAAY,0BAA0B,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,uBAAuB,CACnC,QAAgB,EAChB,QAAiB;QAEjB,OAAO,IAAA,kBAAO,EAAC,SAAS,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,wBAAwB,CACpC,QAAgB,EAChB,QAAc;QAEd,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;CACF;AAjMD,4BAiMC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, DetailedResult, fail, failWithDetail, Result, succeed, Success } from '@fgv/ts-utils';\nimport { Converter, Validator } from '@fgv/ts-utils';\nimport { JsonValue } from '../json';\nimport {\n IFileTreeAccessors,\n IMutableFileTreeFileItem,\n isMutableAccessors,\n SaveDetail\n} from './fileTreeAccessors';\n\n/**\n * Class representing a file in a file tree.\n * @public\n */\nexport class FileItem<TCT extends string = string> implements IMutableFileTreeFileItem<TCT> {\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.\"type\"}\n */\n public readonly type: 'file' = 'file';\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.absolutePath}\n */\n public readonly absolutePath: string;\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.name}\n */\n public get name(): string {\n return this._hal.getBaseName(this.absolutePath);\n }\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.baseName}\n */\n public get baseName(): string {\n return this._hal.getBaseName(this.absolutePath, this.extension);\n }\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.extension}\n */\n public get extension(): string {\n return this._hal.getExtension(this.absolutePath);\n }\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.contentType}\n */\n public get contentType(): TCT | undefined {\n return this._contentType;\n }\n\n /**\n * Mutable content type of the file.\n * @public\n */\n private _contentType: TCT | undefined;\n\n /**\n * The {@link FileTree.IFileTreeAccessors | accessors} to use for file system operations.\n * @public\n */\n protected readonly _hal: IFileTreeAccessors<TCT>;\n\n /**\n * Protected constructor for derived classes.\n * @param path - Relative path of the file.\n * @param hal - The {@link FileTree.IFileTreeAccessors | accessors} to use for\n * file system operations.\n * @public\n */\n protected constructor(path: string, hal: IFileTreeAccessors<TCT>) {\n this._hal = hal;\n this.absolutePath = hal.resolveAbsolutePath(path);\n this._contentType = hal.getFileContentType(this.absolutePath).orDefault();\n }\n\n /**\n * Creates a new {@link FileTree.FileItem} instance.\n * @param path - Relative path of the file.\n * @param hal - The {@link FileTree.IFileTreeAccessors | accessors} to use for\n * file system operations.\n * @public\n */\n public static create<TCT extends string = string>(\n path: string,\n hal: IFileTreeAccessors<TCT>\n ): Result<FileItem<TCT>> {\n return captureResult(() => new FileItem(path, hal));\n }\n\n /**\n * Indicates whether this file can be saved.\n * @returns `DetailedSuccess` with {@link FileTree.SaveCapability} if the file can be saved,\n * or `DetailedFailure` with {@link FileTree.SaveFailureReason} if it cannot.\n */\n public getIsMutable(): DetailedResult<boolean, SaveDetail> {\n if (isMutableAccessors(this._hal)) {\n return this._hal.fileIsMutable(this.absolutePath);\n }\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return failWithDetail(`${this.absolutePath}: mutation not supported`, 'not-supported');\n }\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.getContents}\n */\n public getContents(): Result<JsonValue>;\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.getContents}\n */\n public getContents<T>(converter: Validator<T> | Converter<T>): Result<T>;\n public getContents<T>(converter?: Validator<T> | Converter<T>): Result<T | JsonValue> {\n return this._hal\n .getFileContents(this.absolutePath)\n .onSuccess((body) => captureResult(() => JSON.parse(body)).onFailure(() => succeed(body)))\n .onSuccess<T | JsonValue>((parsed) => {\n if (converter !== undefined) {\n return converter.convert(parsed);\n }\n return succeed(parsed as JsonValue);\n });\n }\n\n /**\n * {@inheritDoc FileTree.IFileTreeFileItem.getRawContents}\n */\n public getRawContents(): Result<string> {\n return this._hal.getFileContents(this.absolutePath);\n }\n\n /**\n * Sets the content type of the file.\n * @param contentType - The content type of the file.\n */\n public setContentType(contentType: TCT | undefined): void {\n this._contentType = contentType;\n }\n\n /**\n * Sets the contents of the file from a JSON value.\n * @param json - The JSON value to serialize and save.\n * @returns `Success` if the file was saved, or `Failure` with an error message.\n */\n public setContents(json: JsonValue): Result<JsonValue> {\n return captureResult(() => JSON.stringify(json, null, 2)).onSuccess((contents) =>\n this.setRawContents(contents).onSuccess(() => Success.with(json))\n );\n }\n\n /**\n * Sets the raw contents of the file.\n * @param contents - The string contents to save.\n * @returns `Success` if the file was saved, or `Failure` with an error message.\n */\n public setRawContents(contents: string): Result<string> {\n if (isMutableAccessors(this._hal)) {\n return this._hal.saveFileContents(this.absolutePath, contents);\n }\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return fail(`${this.absolutePath}: mutation not supported`);\n }\n\n /**\n * Deletes this file from its backing store.\n * @returns `Success` with `true` if the file was deleted, or `Failure` with an error message.\n */\n public delete(): Result<boolean> {\n if (!isMutableAccessors(this._hal)) {\n /* c8 ignore next 2 - defensive: all current accessor implementations support mutation interface */\n return fail(`${this.absolutePath}: mutation not supported`);\n }\n return this._hal.deleteFile(this.absolutePath);\n }\n\n /**\n * Default function to infer the content type of a file.\n * @param filePath - The path of the file.\n * @param provided - Optional supplied content type.\n * @returns `Success` with the content type of the file if successful, or\n * `Failure` with an error message otherwise.\n * @remarks This default implementation always returns `Success` with `undefined`.\n * @public\n */\n public static defaultInferContentType<TCT extends string = string>(\n filePath: string,\n provided?: string\n ): Result<TCT | undefined> {\n return succeed(undefined);\n }\n\n /**\n * Default function to accept the content type of a file.\n * @param filePath - The path of the file.\n * @param provided - Optional supplied content type.\n * @returns `Success` with the content type of the file if successful, or\n * `Failure` with an error message otherwise.\n * @remarks This default implementation always returns `Success` with `undefined`.\n * @public\n */\n public static defaultAcceptContentType<TCT extends string = string>(\n filePath: string,\n provided?: TCT\n ): Result<TCT | undefined> {\n return succeed(provided);\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTree.d.ts","sourceRoot":"","sources":["../../../src/packlets/file-tree/fileTree.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAiB,MAAM,EAAiB,MAAM,eAAe,CAAC;AACrE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,qBAAa,QAAQ,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM;IAC/C;;;OAGG;IACI,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,SAAS,aAAa,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC;IAIlD;;;;;OAKG;WACW,MAAM,CAAC,GAAG,SAAS,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAItG;;;;;OAKG;IACI,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAK3D;;;;;OAKG;IACI,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAShE;;;;;OAKG;IACI,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;CAQhF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTree.js","sourceRoot":"","sources":["../../../src/packlets/file-tree/fileTree.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;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Content":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { captureResult, Result, fail, succeed } from '@fgv/ts-utils';\nimport {\n FileTreeItem,\n IFileTreeAccessors,\n IFileTreeDirectoryItem,\n IFileTreeFileItem\n} from './fileTreeAccessors';\n\n/**\n * Represents a file tree.\n * @public\n */\nexport class FileTree<TCT extends string = string> {\n /**\n * The {@link FileTree.IFileTreeAccessors | accessors} to use for file system operations.\n * @public\n */\n public hal: IFileTreeAccessors<TCT>;\n\n /**\n * Protected constructor for derived classes.\n * @param hal - The {@link FileTree.IFileTreeAccessors | accessors} to use for\n * file system operations.\n * @public\n */\n protected constructor(hal: IFileTreeAccessors<TCT>) {\n this.hal = hal;\n }\n\n /**\n * Creates a new {@link FileTree} instance with the supplied\n * accessors.\n * @param hal - The {@link FileTree.IFileTreeAccessors | accessors} to use for\n * file system operations.\n */\n public static create<TCT extends string = string>(hal: IFileTreeAccessors<TCT>): Result<FileTree<TCT>> {\n return captureResult(() => new FileTree(hal));\n }\n\n /**\n * Gets an item from the tree.\n * @param itemPath - The path to the item.\n * @returns `Success` with the item if successful,\n * or `Failure` with an error message otherwise.\n */\n public getItem(itemPath: string): Result<FileTreeItem<TCT>> {\n const absolutePath = this.hal.resolveAbsolutePath(itemPath);\n return this.hal.getItem(absolutePath);\n }\n\n /**\n * Gets a file item from the tree.\n * @param filePath - The path to the file.\n * @returns `Success` with the {@link FileTree.IFileTreeFileItem | file item}\n * if successful, or `Failure` with an error message otherwise.\n */\n public getFile(filePath: string): Result<IFileTreeFileItem<TCT>> {\n return this.getItem(filePath).onSuccess((item) => {\n if (item.type === 'file') {\n return succeed(item);\n }\n return fail(`${filePath}: not a file`);\n });\n }\n\n /**\n * Gets a directory item from the tree.\n * @param directoryPath - The path to the directory.\n * @returns `Success` with the {@link FileTree.IFileTreeDirectoryItem | directory item}\n * if successful, or `Failure` with an error message otherwise.\n */\n public getDirectory(directoryPath: string): Result<IFileTreeDirectoryItem<TCT>> {\n return this.getItem(directoryPath).onSuccess((item) => {\n if (item.type === 'directory') {\n return succeed(item);\n }\n return fail(`${directoryPath}: not a directory`);\n });\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileTreeAccessors.d.ts","sourceRoot":"","sources":["../../../src/packlets/file-tree/fileTreeAccessors.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,WAAW,CAAC;AAExD;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf,WAAW,GACX,aAAa,GACb,eAAe,GACf,mBAAmB,CAAC;AAExB;;;GAGG;AACH,MAAM,MAA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