@fgv/ts-utils 4.3.0 → 4.5.0-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.
Files changed (112) hide show
  1. package/CHANGELOG.json +6 -0
  2. package/CHANGELOG.md +6 -1
  3. package/dist/ts-utils.d.ts +4248 -3531
  4. package/dist/tsdoc-metadata.json +1 -1
  5. package/lib/index.d.ts +3 -2
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.js +7 -3
  8. package/lib/index.js.map +1 -1
  9. package/lib/packlets/base/utils.d.ts.map +1 -1
  10. package/lib/packlets/base/utils.js +0 -1
  11. package/lib/packlets/base/utils.js.map +1 -1
  12. package/lib/packlets/collections/collectible.d.ts +82 -8
  13. package/lib/packlets/collections/collectible.d.ts.map +1 -1
  14. package/lib/packlets/collections/collectible.js +36 -11
  15. package/lib/packlets/collections/collectible.js.map +1 -1
  16. package/lib/packlets/collections/collector.d.ts +78 -79
  17. package/lib/packlets/collections/collector.d.ts.map +1 -1
  18. package/lib/packlets/collections/collector.js +83 -52
  19. package/lib/packlets/collections/collector.js.map +1 -1
  20. package/lib/packlets/collections/collectorValidator.d.ts +89 -0
  21. package/lib/packlets/collections/collectorValidator.d.ts.map +1 -0
  22. package/lib/packlets/collections/collectorValidator.js +98 -0
  23. package/lib/packlets/collections/collectorValidator.js.map +1 -0
  24. package/lib/packlets/collections/convertingCollector.d.ts +77 -36
  25. package/lib/packlets/collections/convertingCollector.d.ts.map +1 -1
  26. package/lib/packlets/collections/convertingCollector.js +71 -26
  27. package/lib/packlets/collections/convertingCollector.js.map +1 -1
  28. package/lib/packlets/collections/convertingCollectorValidator.d.ts +69 -0
  29. package/lib/packlets/collections/convertingCollectorValidator.d.ts.map +1 -0
  30. package/lib/packlets/collections/{collectorConverter.js → convertingCollectorValidator.js} +28 -15
  31. package/lib/packlets/collections/convertingCollectorValidator.js.map +1 -0
  32. package/lib/packlets/collections/index.d.ts +7 -5
  33. package/lib/packlets/collections/index.d.ts.map +1 -1
  34. package/lib/packlets/collections/index.js +7 -5
  35. package/lib/packlets/collections/index.js.map +1 -1
  36. package/lib/packlets/collections/keyValueConverters.d.ts +1 -17
  37. package/lib/packlets/collections/keyValueConverters.d.ts.map +1 -1
  38. package/lib/packlets/collections/keyValueConverters.js +1 -8
  39. package/lib/packlets/collections/keyValueConverters.js.map +1 -1
  40. package/lib/packlets/collections/readonlyResultMap.d.ts +0 -4
  41. package/lib/packlets/collections/readonlyResultMap.d.ts.map +1 -1
  42. package/lib/packlets/collections/readonlyResultMap.js.map +1 -1
  43. package/lib/packlets/collections/resultMap.d.ts +0 -4
  44. package/lib/packlets/collections/resultMap.d.ts.map +1 -1
  45. package/lib/packlets/collections/resultMap.js +0 -6
  46. package/lib/packlets/collections/resultMap.js.map +1 -1
  47. package/lib/packlets/collections/{resultMapConverter.d.ts → resultMapValidator.d.ts} +11 -11
  48. package/lib/packlets/collections/{resultMapConverter.d.ts.map → resultMapValidator.d.ts.map} +1 -1
  49. package/lib/packlets/collections/{resultMapConverter.js → resultMapValidator.js} +6 -6
  50. package/lib/packlets/collections/{resultMapConverter.js.map → resultMapValidator.js.map} +1 -1
  51. package/lib/packlets/collections/validatingCollector.d.ts +69 -0
  52. package/lib/packlets/collections/validatingCollector.d.ts.map +1 -0
  53. package/lib/packlets/collections/validatingCollector.js +67 -0
  54. package/lib/packlets/collections/validatingCollector.js.map +1 -0
  55. package/lib/packlets/collections/validatingConvertingCollector.d.ts +59 -0
  56. package/lib/packlets/collections/validatingConvertingCollector.d.ts.map +1 -0
  57. package/lib/packlets/collections/validatingConvertingCollector.js +68 -0
  58. package/lib/packlets/collections/validatingConvertingCollector.js.map +1 -0
  59. package/lib/packlets/collections/validatingResultMap.d.ts +53 -0
  60. package/lib/packlets/collections/validatingResultMap.d.ts.map +1 -0
  61. package/lib/packlets/collections/validatingResultMap.js +61 -0
  62. package/lib/packlets/collections/validatingResultMap.js.map +1 -0
  63. package/lib/packlets/file-tree/directoryItem.d.ts +47 -0
  64. package/lib/packlets/file-tree/directoryItem.d.ts.map +1 -0
  65. package/lib/packlets/file-tree/directoryItem.js +71 -0
  66. package/lib/packlets/file-tree/directoryItem.js.map +1 -0
  67. package/lib/packlets/file-tree/fileItem.d.ts +64 -0
  68. package/lib/packlets/file-tree/fileItem.d.ts.map +1 -0
  69. package/lib/packlets/file-tree/fileItem.js +93 -0
  70. package/lib/packlets/file-tree/fileItem.js.map +1 -0
  71. package/lib/packlets/file-tree/fileTree.d.ts +84 -0
  72. package/lib/packlets/file-tree/fileTree.d.ts.map +1 -0
  73. package/lib/packlets/file-tree/fileTree.js +135 -0
  74. package/lib/packlets/file-tree/fileTree.js.map +1 -0
  75. package/lib/packlets/file-tree/fileTreeAccessors.d.ts +134 -0
  76. package/lib/packlets/file-tree/fileTreeAccessors.d.ts.map +1 -0
  77. package/lib/packlets/file-tree/fileTreeAccessors.js +24 -0
  78. package/lib/packlets/file-tree/fileTreeAccessors.js.map +1 -0
  79. package/lib/packlets/file-tree/fsTree.d.ts +45 -0
  80. package/lib/packlets/file-tree/fsTree.d.ts.map +1 -0
  81. package/lib/packlets/file-tree/fsTree.js +116 -0
  82. package/lib/packlets/file-tree/fsTree.js.map +1 -0
  83. package/lib/packlets/file-tree/in-memory/inMemoryTree.d.ts +67 -0
  84. package/lib/packlets/file-tree/in-memory/inMemoryTree.d.ts.map +1 -0
  85. package/lib/packlets/file-tree/in-memory/inMemoryTree.js +150 -0
  86. package/lib/packlets/file-tree/in-memory/inMemoryTree.js.map +1 -0
  87. package/lib/packlets/file-tree/in-memory/index.d.ts +2 -0
  88. package/lib/packlets/file-tree/in-memory/index.d.ts.map +1 -0
  89. package/lib/packlets/file-tree/in-memory/index.js +39 -0
  90. package/lib/packlets/file-tree/in-memory/index.js.map +1 -0
  91. package/lib/packlets/file-tree/in-memory/treeBuilder.d.ts +106 -0
  92. package/lib/packlets/file-tree/in-memory/treeBuilder.d.ts.map +1 -0
  93. package/lib/packlets/file-tree/in-memory/treeBuilder.js +170 -0
  94. package/lib/packlets/file-tree/in-memory/treeBuilder.js.map +1 -0
  95. package/lib/packlets/file-tree/index.d.ts +8 -0
  96. package/lib/packlets/file-tree/index.d.ts.map +1 -0
  97. package/lib/packlets/file-tree/index.js +46 -0
  98. package/lib/packlets/file-tree/index.js.map +1 -0
  99. package/lib/packlets/hash/crcNormalizer.js +1 -1
  100. package/lib/packlets/hash/crcNormalizer.js.map +1 -1
  101. package/package.json +15 -15
  102. package/lib/packlets/collections/collectorConverter.d.ts +0 -59
  103. package/lib/packlets/collections/collectorConverter.d.ts.map +0 -1
  104. package/lib/packlets/collections/collectorConverter.js.map +0 -1
  105. package/lib/packlets/collections/collectors.d.ts +0 -32
  106. package/lib/packlets/collections/collectors.d.ts.map +0 -1
  107. package/lib/packlets/collections/collectors.js +0 -57
  108. package/lib/packlets/collections/collectors.js.map +0 -1
  109. package/lib/packlets/collections/convertingResultMap.d.ts +0 -73
  110. package/lib/packlets/collections/convertingResultMap.d.ts.map +0 -1
  111. package/lib/packlets/collections/convertingResultMap.js +0 -102
  112. package/lib/packlets/collections/convertingResultMap.js.map +0 -1
@@ -1,102 +0,0 @@
1
- "use strict";
2
- /*
3
- * Copyright (c) 2025 Erik Fortune
4
- *
5
- * Permission is hereby granted, free of charge, to any person obtaining a copy
6
- * of this software and associated documentation files (the "Software"), to deal
7
- * in the Software without restriction, including without limitation the rights
8
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- * copies of the Software, and to permit persons to whom the Software is
10
- * furnished to do so, subject to the following conditions:
11
- *
12
- * The above copyright notice and this permission notice shall be included in all
13
- * copies or substantial portions of the Software.
14
- *
15
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- * SOFTWARE.
22
- */
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.ConvertingResultMap = void 0;
25
- const base_1 = require("../base");
26
- const resultMap_1 = require("./resultMap");
27
- const resultMapConverter_1 = require("./resultMapConverter");
28
- /**
29
- * A {@link Collections.ResultMap | ResultMap} with a {@link Collections.ResultMapConverter | validator}
30
- * property that enables validated use of the underlying map with weakly-typed keys and values.
31
- * @public
32
- */
33
- class ConvertingResultMap extends resultMap_1.ResultMap {
34
- /**
35
- * Constructs a new {@link Collections.ConvertingResultMap | ConvertingResultMap}.
36
- * @param params - Required parameters for constructing the map.
37
- */
38
- constructor(params) {
39
- var _a;
40
- const entries = params.converters.convertEntries([...((_a = params.entries) !== null && _a !== void 0 ? _a : [])]).orThrow();
41
- super({ entries });
42
- this.converting = new resultMapConverter_1.ResultMapConverter({ map: this, converters: params.converters });
43
- }
44
- /**
45
- * Creates a new {@link Collections.ConvertingResultMap | ConvertingResultMap} instance.
46
- * @param params - Required parameters for constructing the map.
47
- * @returns `Success` with the new map if successful, `Failure` otherwise.
48
- * @public
49
- */
50
- static createConvertingResultMap(params) {
51
- return (0, base_1.captureResult)(() => new ConvertingResultMap(params));
52
- }
53
- /**
54
- * {@inheritdoc Collections.ResultMap.add}
55
- */
56
- add(key, value) {
57
- return this.converting.converters.convertEntry([key, value]).onSuccess((entry) => {
58
- return super.add(entry[0], entry[1]);
59
- });
60
- }
61
- getOrAdd(key, valueOrFactory) {
62
- if (!this._isResultMapValueFactory(valueOrFactory)) {
63
- return this.converting.converters.convertEntry([key, valueOrFactory]).onSuccess((entry) => {
64
- return super.getOrAdd(entry[0], entry[1]);
65
- });
66
- }
67
- else {
68
- return super.get(key).onFailure(() => {
69
- const value = valueOrFactory(key)
70
- .onSuccess((value) => this.converting.converters.convertEntry([key, value]))
71
- .onSuccess(([__key, value]) => (0, base_1.succeed)(value));
72
- return value.success
73
- ? super.add(key, value.value)
74
- : (0, base_1.failWithDetail)(value.message, 'invalid-value');
75
- });
76
- }
77
- }
78
- /**
79
- * {@inheritdoc Collections.ResultMap.set}
80
- */
81
- set(key, value) {
82
- return this.converting.converters.convertEntry([key, value]).onSuccess((entry) => {
83
- return super.set(entry[0], entry[1]);
84
- });
85
- }
86
- /**
87
- * {@inheritdoc Collections.ResultMap.update}
88
- */
89
- update(key, value) {
90
- return this.converting.converters.convertEntry([key, value]).onSuccess((entry) => {
91
- return super.update(entry[0], entry[1]);
92
- });
93
- }
94
- /**
95
- * Gets a read-only version of this map.
96
- */
97
- toReadOnly() {
98
- return this;
99
- }
100
- }
101
- exports.ConvertingResultMap = ConvertingResultMap;
102
- //# sourceMappingURL=convertingResultMap.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convertingResultMap.js","sourceRoot":"","sources":["../../../src/packlets/collections/convertingResultMap.ts"],"names":[],"mappings":"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","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, failWithDetail, Result, succeed } from '../base';\nimport { KeyValueEntry } from './common';\nimport { IReadOnlyResultMap, ResultMapResultDetail } from './readonlyResultMap';\nimport { ResultMap, ResultMapValueFactory } from './resultMap';\nimport { IReadOnlyResultMapConverter, ResultMapConverter } from './resultMapConverter';\nimport { KeyValueConverters } from './keyValueConverters';\n\n/**\n * A read-only interface exposing non-mutating methods of a {@link Collections.ConvertingResultMap | ConvertingResultMap}.\n * @public\n */\nexport interface IReadOnlyConvertingResultMap<TK extends string = string, TV = unknown>\n extends IReadOnlyResultMap<TK, TV> {\n /**\n * {@inheritdoc Collections.ConvertingResultMap.converting}\n */\n readonly converting: IReadOnlyResultMapConverter<TK, TV>;\n}\n\n/**\n * Parameters for constructing a {@link Collections.ResultMap | ResultMap}.\n * @public\n */\nexport interface IConvertingResultMapConstructorParams<TK extends string = string, TV = unknown> {\n entries?: Iterable<KeyValueEntry<string, unknown>>;\n converters: KeyValueConverters<TK, TV>;\n}\n\n/**\n * A {@link Collections.ResultMap | ResultMap} with a {@link Collections.ResultMapConverter | validator}\n * property that enables validated use of the underlying map with weakly-typed keys and values.\n * @public\n */\nexport class ConvertingResultMap<TK extends string = string, TV = unknown>\n extends ResultMap<TK, TV>\n implements IReadOnlyConvertingResultMap<TK, TV>\n{\n /**\n * A {@link Collections.ResultMapConverter | ResultMapConverter} which validates keys and values\n * before inserting them into this collection.\n */\n public readonly converting: ResultMapConverter<TK, TV>;\n\n /**\n * Constructs a new {@link Collections.ConvertingResultMap | ConvertingResultMap}.\n * @param params - Required parameters for constructing the map.\n */\n public constructor(params: IConvertingResultMapConstructorParams<TK, TV>) {\n const entries = params.converters.convertEntries([...(params.entries ?? [])]).orThrow();\n super({ entries });\n this.converting = new ResultMapConverter<TK, TV>({ map: this, converters: params.converters });\n }\n\n /**\n * Creates a new {@link Collections.ConvertingResultMap | ConvertingResultMap} instance.\n * @param params - Required parameters for constructing the map.\n * @returns `Success` with the new map if successful, `Failure` otherwise.\n * @public\n */\n public static createConvertingResultMap<TK extends string = string, TV = unknown>(\n params: IConvertingResultMapConstructorParams<TK, TV>\n ): Result<ConvertingResultMap<TK, TV>> {\n return captureResult(() => new ConvertingResultMap(params));\n }\n\n /**\n * {@inheritdoc Collections.ResultMap.add}\n */\n public add(key: TK, value: TV): DetailedResult<TV, ResultMapResultDetail> {\n return this.converting.converters.convertEntry([key, value]).onSuccess((entry) => {\n return super.add(entry[0], entry[1]);\n });\n }\n\n /**\n * {@inheritdoc Collections.ResultMap.(getOrAdd:1)}\n */\n public getOrAdd(key: TK, value: TV): DetailedResult<TV, ResultMapResultDetail>;\n /**\n * {@inheritdoc Collections.ResultMap.(getOrAdd:2)}\n */\n public getOrAdd(key: TK, factory: ResultMapValueFactory<TK, TV>): DetailedResult<TV, ResultMapResultDetail>;\n public getOrAdd(\n key: TK,\n valueOrFactory: TV | ResultMapValueFactory<TK, TV>\n ): DetailedResult<TV, ResultMapResultDetail> {\n if (!this._isResultMapValueFactory(valueOrFactory)) {\n return this.converting.converters.convertEntry([key, valueOrFactory]).onSuccess((entry) => {\n return super.getOrAdd(entry[0], entry[1]);\n });\n } else {\n return super.get(key).onFailure(() => {\n const value = valueOrFactory(key)\n .onSuccess((value) => this.converting.converters.convertEntry([key, value]))\n .onSuccess(([__key, value]) => succeed(value));\n return value.success\n ? super.add(key, value.value)\n : failWithDetail<TV, ResultMapResultDetail>(value.message, 'invalid-value');\n });\n }\n }\n\n /**\n * {@inheritdoc Collections.ResultMap.set}\n */\n public set(key: TK, value: TV): DetailedResult<TV, ResultMapResultDetail> {\n return this.converting.converters.convertEntry([key, value]).onSuccess((entry) => {\n return super.set(entry[0], entry[1]);\n });\n }\n\n /**\n * {@inheritdoc Collections.ResultMap.update}\n */\n public update(key: TK, value: TV): DetailedResult<TV, ResultMapResultDetail> {\n return this.converting.converters.convertEntry([key, value]).onSuccess((entry) => {\n return super.update(entry[0], entry[1]);\n });\n }\n\n /**\n * Gets a read-only version of this map.\n */\n public toReadOnly(): IReadOnlyConvertingResultMap<TK, TV> {\n return this;\n }\n}\n"]}