@fgv/ts-res 5.0.1-8 → 5.0.1

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 (162) hide show
  1. package/dist/index.browser.js +53 -0
  2. package/dist/index.js +45 -0
  3. package/dist/packlets/bundle/bundleBuilder.js +130 -0
  4. package/dist/packlets/bundle/bundleLoader.js +101 -0
  5. package/dist/packlets/bundle/bundleNormalizer.js +138 -0
  6. package/dist/packlets/bundle/bundleUtils.js +113 -0
  7. package/dist/packlets/bundle/convert.js +75 -0
  8. package/dist/packlets/bundle/index.js +42 -0
  9. package/dist/packlets/bundle/model.js +23 -0
  10. package/dist/packlets/common/conditions.js +47 -0
  11. package/dist/packlets/common/convert.js +172 -0
  12. package/dist/packlets/common/helpers/conditions.js +66 -0
  13. package/dist/packlets/common/helpers/context.js +70 -0
  14. package/dist/packlets/common/helpers/index.js +26 -0
  15. package/dist/packlets/common/helpers/qualifierDefaultValues.js +66 -0
  16. package/dist/packlets/common/helpers/resources.js +93 -0
  17. package/dist/packlets/common/index.js +28 -0
  18. package/dist/packlets/common/resources.js +27 -0
  19. package/dist/packlets/common/validate/conditions.js +544 -0
  20. package/dist/packlets/common/validate/index.js +26 -0
  21. package/dist/packlets/common/validate/regularExpressions.js +84 -0
  22. package/dist/packlets/common/validate/resources.js +209 -0
  23. package/dist/packlets/conditions/condition.js +252 -0
  24. package/dist/packlets/conditions/conditionCollector.js +69 -0
  25. package/dist/packlets/conditions/conditionDecls.js +23 -0
  26. package/dist/packlets/conditions/conditionSet.js +247 -0
  27. package/dist/packlets/conditions/conditionSetCollector.js +89 -0
  28. package/dist/packlets/conditions/conditionSetDecls.js +23 -0
  29. package/dist/packlets/conditions/conditionToken.js +147 -0
  30. package/dist/packlets/conditions/convert/conditionSetDecls.js +51 -0
  31. package/dist/packlets/conditions/convert/decls.js +75 -0
  32. package/dist/packlets/conditions/convert/index.js +24 -0
  33. package/dist/packlets/conditions/index.js +31 -0
  34. package/dist/packlets/config/common.js +78 -0
  35. package/dist/packlets/config/configInitFactory.js +258 -0
  36. package/dist/packlets/config/convert.js +56 -0
  37. package/dist/packlets/config/index.browser.js +34 -0
  38. package/dist/packlets/config/index.js +28 -0
  39. package/dist/packlets/config/json.js +23 -0
  40. package/dist/packlets/config/predefined/default.js +138 -0
  41. package/dist/packlets/config/predefined/extended.js +190 -0
  42. package/dist/packlets/config/predefined/index.js +25 -0
  43. package/dist/packlets/config/systemConfiguration.js +147 -0
  44. package/dist/packlets/context/contextDecls.js +23 -0
  45. package/dist/packlets/context/contextToken.js +202 -0
  46. package/dist/packlets/context/convert/decls.js +91 -0
  47. package/dist/packlets/context/convert/index.js +23 -0
  48. package/dist/packlets/context/index.js +26 -0
  49. package/dist/packlets/decisions/abstractDecision.js +68 -0
  50. package/dist/packlets/decisions/abstractDecisionCollector.js +90 -0
  51. package/dist/packlets/decisions/candidate.js +76 -0
  52. package/dist/packlets/decisions/common.js +23 -0
  53. package/dist/packlets/decisions/concreteDecision.js +111 -0
  54. package/dist/packlets/decisions/decision.js +126 -0
  55. package/dist/packlets/decisions/index.js +28 -0
  56. package/dist/packlets/import/fsItem.js +134 -0
  57. package/dist/packlets/import/importContext.js +129 -0
  58. package/dist/packlets/import/importManager.js +129 -0
  59. package/dist/packlets/import/importable.js +32 -0
  60. package/dist/packlets/import/importers/collectionImporter.js +118 -0
  61. package/dist/packlets/import/importers/fsItemImporter.js +116 -0
  62. package/dist/packlets/import/importers/importer.js +23 -0
  63. package/dist/packlets/import/importers/index.browser.js +29 -0
  64. package/dist/packlets/import/importers/index.js +27 -0
  65. package/dist/packlets/import/importers/jsonImporter.js +94 -0
  66. package/dist/packlets/import/importers/pathImporter.js +84 -0
  67. package/dist/packlets/import/index.browser.js +34 -0
  68. package/dist/packlets/import/index.js +28 -0
  69. package/dist/packlets/qualifier-types/config/convert.js +124 -0
  70. package/dist/packlets/qualifier-types/config/index.js +25 -0
  71. package/dist/packlets/qualifier-types/config/json.js +32 -0
  72. package/dist/packlets/qualifier-types/convert.js +56 -0
  73. package/dist/packlets/qualifier-types/helpers.js +82 -0
  74. package/dist/packlets/qualifier-types/index.js +32 -0
  75. package/dist/packlets/qualifier-types/languageQualifierType.js +142 -0
  76. package/dist/packlets/qualifier-types/literalQualifierType.js +200 -0
  77. package/dist/packlets/qualifier-types/literalValueHierarchy.js +236 -0
  78. package/dist/packlets/qualifier-types/qualifierType.js +184 -0
  79. package/dist/packlets/qualifier-types/qualifierTypeCollector.js +66 -0
  80. package/dist/packlets/qualifier-types/territoryQualifierType.js +200 -0
  81. package/dist/packlets/qualifiers/convert/decls.js +70 -0
  82. package/dist/packlets/qualifiers/convert/index.js +24 -0
  83. package/dist/packlets/qualifiers/convert/qualifier.js +40 -0
  84. package/dist/packlets/qualifiers/index.js +29 -0
  85. package/dist/packlets/qualifiers/qualifier.js +108 -0
  86. package/dist/packlets/qualifiers/qualifierCollector.js +123 -0
  87. package/dist/packlets/qualifiers/qualifierDecl.js +23 -0
  88. package/dist/packlets/qualifiers/qualifierDefaultValueDecls.js +23 -0
  89. package/dist/packlets/qualifiers/qualifierDefaultValueToken.js +175 -0
  90. package/dist/packlets/resource-json/compiled/common.js +23 -0
  91. package/dist/packlets/resource-json/compiled/convert.js +132 -0
  92. package/dist/packlets/resource-json/compiled/index.js +26 -0
  93. package/dist/packlets/resource-json/compiled/json.js +2 -0
  94. package/dist/packlets/resource-json/convert.js +171 -0
  95. package/dist/packlets/resource-json/helpers.js +241 -0
  96. package/dist/packlets/resource-json/index.js +31 -0
  97. package/dist/packlets/resource-json/json.js +36 -0
  98. package/dist/packlets/resource-json/normalized.js +23 -0
  99. package/dist/packlets/resource-json/resourceDeclCollection.js +88 -0
  100. package/dist/packlets/resource-json/resourceDeclContainer.js +23 -0
  101. package/dist/packlets/resource-json/resourceDeclTree.js +94 -0
  102. package/dist/packlets/resource-types/config/convert.js +35 -0
  103. package/dist/packlets/resource-types/config/index.js +25 -0
  104. package/dist/packlets/resource-types/config/json.js +23 -0
  105. package/dist/packlets/resource-types/helpers.js +42 -0
  106. package/dist/packlets/resource-types/index.js +28 -0
  107. package/dist/packlets/resource-types/jsonResourceType.js +66 -0
  108. package/dist/packlets/resource-types/resourceType.js +95 -0
  109. package/dist/packlets/resource-types/resourceTypeCollector.js +61 -0
  110. package/dist/packlets/resources/candidateReducer.js +246 -0
  111. package/dist/packlets/resources/candidateValue.js +92 -0
  112. package/dist/packlets/resources/candidateValueCollector.js +94 -0
  113. package/dist/packlets/resources/common.js +23 -0
  114. package/dist/packlets/resources/deltaGenerator.js +338 -0
  115. package/dist/packlets/resources/index.js +31 -0
  116. package/dist/packlets/resources/resource.js +207 -0
  117. package/dist/packlets/resources/resourceBuilder.js +183 -0
  118. package/dist/packlets/resources/resourceCandidate.js +216 -0
  119. package/dist/packlets/resources/resourceManagerBuilder.js +890 -0
  120. package/dist/packlets/runtime/cacheListener.js +58 -0
  121. package/dist/packlets/runtime/cacheMetrics.js +149 -0
  122. package/dist/packlets/runtime/compiledResourceCollection.js +473 -0
  123. package/dist/packlets/runtime/conditionSetResolutionResult.js +134 -0
  124. package/dist/packlets/runtime/context/contextQualifierProvider.js +29 -0
  125. package/dist/packlets/runtime/context/contextQualifierProviderValidator.js +146 -0
  126. package/dist/packlets/runtime/context/index.js +26 -0
  127. package/dist/packlets/runtime/context/simpleContextQualifierProvider.js +196 -0
  128. package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +60 -0
  129. package/dist/packlets/runtime/iResourceManager.js +23 -0
  130. package/dist/packlets/runtime/index.js +34 -0
  131. package/dist/packlets/runtime/resource-tree/common.js +23 -0
  132. package/dist/packlets/runtime/resource-tree/index.js +26 -0
  133. package/dist/packlets/runtime/resource-tree/readOnlyResourceTree.js +216 -0
  134. package/dist/packlets/runtime/resource-tree/resourceTreeChildren.js +97 -0
  135. package/dist/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +161 -0
  136. package/dist/packlets/runtime/resourceResolver.js +481 -0
  137. package/dist/packlets/runtime/resourceTreeResolver.js +220 -0
  138. package/dist/packlets/runtime/validate.js +47 -0
  139. package/dist/packlets/zip-archive/convert.js +100 -0
  140. package/dist/packlets/zip-archive/index.browser.js +54 -0
  141. package/dist/packlets/zip-archive/index.js +47 -0
  142. package/dist/packlets/zip-archive/json.js +23 -0
  143. package/dist/packlets/zip-archive/types.js +36 -0
  144. package/dist/packlets/zip-archive/zipArchiveCreator.js +191 -0
  145. package/dist/packlets/zip-archive/zipArchiveFormat.js +140 -0
  146. package/dist/packlets/zip-archive/zipArchiveLoader.js +282 -0
  147. package/dist/test/data/sample.json +32 -0
  148. package/dist/test/unit/qualifier-types/testQualifierType.js +76 -0
  149. package/dist/test/unit/resource-types/testDerivedResourceType.js +109 -0
  150. package/dist/test/unit/resources/deltaGenerator.helpers.js +282 -0
  151. package/dist/tsdoc-metadata.json +1 -1
  152. package/lib/index.browser.d.ts +24 -0
  153. package/lib/index.browser.js +116 -0
  154. package/lib/packlets/config/index.browser.d.ts +7 -0
  155. package/lib/packlets/config/index.browser.js +74 -0
  156. package/lib/packlets/import/importers/index.browser.d.ts +4 -0
  157. package/lib/packlets/import/importers/index.browser.js +45 -0
  158. package/lib/packlets/import/index.browser.d.ts +7 -0
  159. package/lib/packlets/import/index.browser.js +74 -0
  160. package/lib/packlets/zip-archive/index.browser.d.ts +27 -0
  161. package/lib/packlets/zip-archive/index.browser.js +102 -0
  162. package/package.json +21 -7
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=importer.js.map
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ // Browser-safe importers - excludes Node.js filesystem dependencies
23
+ export * from './importer';
24
+ export * from './collectionImporter';
25
+ export * from './jsonImporter';
26
+ // Excluded from browser:
27
+ // - fsItemImporter (processes filesystem items)
28
+ // - pathImporter (requires Node.js fs via FileTree.forFilesystem())
29
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1,27 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export * from './importer';
23
+ export * from './collectionImporter';
24
+ export * from './fsItemImporter';
25
+ export * from './jsonImporter';
26
+ export * from './pathImporter';
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,94 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { captureResult, failWithDetail, succeed } from '@fgv/ts-utils';
23
+ import { isImportable } from '../importable';
24
+ import * as ResourceJson from '../../resource-json';
25
+ /**
26
+ * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a JSON object.
27
+ * @public
28
+ */
29
+ export class JsonImporter {
30
+ /**
31
+ * Protected {@link Import.Importers.JsonImporter | JsonImporter} constructor for derived classes.
32
+ */
33
+ constructor() {
34
+ /**
35
+ * {@inheritdoc Import.Importers.IImporter.types}
36
+ */
37
+ this.types = ['json'];
38
+ }
39
+ /**
40
+ * Creates a new {@link Import.Importers.JsonImporter | JsonImporter} instance.
41
+ * @returns `Success` with the new {@link Import.Importers.JsonImporter | JsonImporter} if successful,
42
+ * `Failure` otherwise.
43
+ */
44
+ static create() {
45
+ return captureResult(() => new JsonImporter());
46
+ }
47
+ /**
48
+ * {@inheritdoc Import.Importers.IImporter.import}
49
+ */
50
+ import(item, manager) {
51
+ var _a, _b;
52
+ /* c8 ignore next 1 - coverage intermittently misses the next line */
53
+ if (!isImportable(item) || item.type !== 'json') {
54
+ /* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
55
+ const name = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown';
56
+ return failWithDetail(`${name}: invalid JSON importable (${item.type})`, 'skipped');
57
+ }
58
+ return (this._tryImportResourceCollection(item)
59
+ .onFailure(() => this._tryImportResourceTree(item))
60
+ // experimenting with this, accepting any JSON object here makes it
61
+ // very hard to distinguish a collection or tree with a typo from a
62
+ // legitimate single loose resource, which yields extremely confusing
63
+ // error messages. Disabled until/unless we come up with a better plan.
64
+ //.onFailure(() => this._tryImportResource(item, manager));
65
+ .onFailure(() => { var _a, _b;
66
+ /* c8 ignore next 1 - defense in depth */
67
+ return failWithDetail(`${(_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown'}: unrecognized JSON format.`, 'failed'); }));
68
+ }
69
+ _tryImportResourceCollection(item) {
70
+ return ResourceJson.ResourceDeclCollection.create(item.json)
71
+ .onSuccess((collection) => {
72
+ const importable = {
73
+ type: 'resourceCollection',
74
+ collection,
75
+ context: item.context
76
+ };
77
+ return succeed([importable]);
78
+ })
79
+ .withDetail('skipped', 'consumed');
80
+ }
81
+ _tryImportResourceTree(item) {
82
+ return ResourceJson.ResourceDeclTree.create(item.json)
83
+ .onSuccess((tree) => {
84
+ const importable = {
85
+ type: 'resourceTree',
86
+ tree,
87
+ context: item.context
88
+ };
89
+ return succeed([importable]);
90
+ })
91
+ .withDetail('skipped', 'consumed');
92
+ }
93
+ }
94
+ //# sourceMappingURL=jsonImporter.js.map
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { captureResult, failWithDetail, succeedWithDetail } from '@fgv/ts-utils';
23
+ import { FileTree } from '@fgv/ts-json-base';
24
+ import { FsItem } from '../fsItem';
25
+ /**
26
+ * {@link Import.Importers.IImporter | Importer} implementation which imports resources from a `FileTree`
27
+ * given a path.
28
+ * @public
29
+ */
30
+ export class PathImporter {
31
+ /**
32
+ * Protected constructor for the {@link Import.Importers.PathImporter | PathImporter}.
33
+ * @param params - Parameters for creating the {@link Import.Importers.PathImporter | PathImporter}.
34
+ */
35
+ constructor(params) {
36
+ var _a, _b;
37
+ /**
38
+ * The types of {@link Import.IImportable | importables} that this importer can handle.
39
+ */
40
+ this.types = ['path'];
41
+ this.qualifiers = params.qualifiers;
42
+ this.tree = (_a = params.tree) !== null && _a !== void 0 ? _a : FileTree.forFilesystem().orThrow();
43
+ this.ignoreFileTypes = (_b = params.ignoreFileTypes) !== null && _b !== void 0 ? _b : [];
44
+ }
45
+ /**
46
+ * Creates a new {@link Import.Importers.PathImporter | PathImporter}.
47
+ * @param params - Parameters for creating the {@link Import.Importers.PathImporter | dirPathImporter}.
48
+ * @returns `Success` with the new `PathImporter` if successful, `Failure` with an error message if not.
49
+ */
50
+ static create(params) {
51
+ return captureResult(() => new PathImporter(params));
52
+ }
53
+ /**
54
+ * {@inheritdoc Import.Importers.IImporter.import}
55
+ */
56
+ import(item, __manager) {
57
+ const { value: fsItem, message: getTreeMessage, detail: getTreeDetail } = this._getFileTreeItemFromImportable(item);
58
+ if (getTreeMessage !== undefined) {
59
+ return failWithDetail(getTreeMessage, getTreeDetail === 'skipped' ? 'skipped' : 'failed');
60
+ }
61
+ if (fsItem.item.type === 'file' && this.ignoreFileTypes.includes(fsItem.item.extension)) {
62
+ return succeedWithDetail([], 'processed');
63
+ }
64
+ // extracted characteristics are in the fsItem so add them to the context when
65
+ // that is imported instead of now.
66
+ const context = item.context;
67
+ return succeedWithDetail([{ type: 'fsItem', item: fsItem, context }], 'processed');
68
+ }
69
+ /**
70
+ * Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.
71
+ * @param item - The importable to convert.
72
+ * @returns `Success` containing the `FsItem` if successful, `Failure` with an error message if not.
73
+ */
74
+ _getFileTreeItemFromImportable(item) {
75
+ if (item.type === 'path') {
76
+ if ('path' in item && typeof item.path === 'string') {
77
+ return FsItem.createForPath(item.path, this.qualifiers, this.tree);
78
+ }
79
+ return failWithDetail(`malformed path importable does not contain a string path`, 'failed');
80
+ }
81
+ return failWithDetail(`${item.type}: invalid importable type for a PathImporter`, 'skipped');
82
+ }
83
+ }
84
+ //# sourceMappingURL=pathImporter.js.map
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ // Browser-safe import exports - excludes Node.js filesystem dependencies
23
+ export * from './importContext';
24
+ export * from './importable';
25
+ export * from './importManager';
26
+ // Export FsItem class (browser-safe for in-memory FileTree usage)
27
+ export { FsItem } from './fsItem';
28
+ // Use browser-safe importers index
29
+ import * as Importers from './importers/index.browser';
30
+ export { Importers };
31
+ // Excluded from browser:
32
+ // - FsItem.createForPath() static method (requires Node.js fs via FileTree.forFilesystem())
33
+ // - PathImporter and FsItemImporter (via importers/index.browser.ts)
34
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export * from './importContext';
23
+ export * from './importable';
24
+ export * from './fsItem';
25
+ export * from './importManager';
26
+ import * as Importers from './importers';
27
+ export { Importers };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,124 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /* eslint-disable @rushstack/typedef-var */
23
+ import { Converters } from '@fgv/ts-utils';
24
+ import * as Common from '../../common';
25
+ import { Converters as JsonConverters } from '@fgv/ts-json-base';
26
+ /**
27
+ * A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
28
+ * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
29
+ * @public
30
+ */
31
+ export const languageQualifierTypeConfig = Converters.strictObject({
32
+ allowContextList: Converters.boolean.optional()
33
+ });
34
+ /**
35
+ * A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
36
+ * @returns A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
37
+ * @public
38
+ */
39
+ export const territoryQualifierTypeConfig = Converters.strictObject({
40
+ allowContextList: Converters.boolean,
41
+ acceptLowercase: Converters.boolean.optional(),
42
+ allowedTerritories: Converters.arrayOf(Converters.string).optional(),
43
+ hierarchy: Converters.recordOf(Converters.string).optional()
44
+ });
45
+ /**
46
+ * A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
47
+ * @returns A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
48
+ * @public
49
+ */
50
+ export const literalQualifierTypeConfig = Converters.strictObject({
51
+ allowContextList: Converters.boolean.optional(),
52
+ caseSensitive: Converters.boolean.optional(),
53
+ enumeratedValues: Converters.arrayOf(Converters.string).optional(),
54
+ hierarchy: Converters.recordOf(Converters.string).optional()
55
+ });
56
+ /**
57
+ * A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
58
+ * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
59
+ * @public
60
+ */
61
+ export const systemLanguageQualifierTypeConfig = Converters.strictObject({
62
+ name: Converters.string,
63
+ systemType: Converters.literal('language'),
64
+ configuration: languageQualifierTypeConfig.optional()
65
+ });
66
+ /**
67
+ * A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
68
+ * @returns A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
69
+ * @public
70
+ */
71
+ export const systemTerritoryQualifierTypeConfig = Converters.strictObject({
72
+ name: Converters.string,
73
+ systemType: Converters.literal('territory'),
74
+ configuration: territoryQualifierTypeConfig.optional()
75
+ });
76
+ /**
77
+ * A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
78
+ * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
79
+ * @public
80
+ */
81
+ export const systemLiteralQualifierTypeConfig = Converters.strictObject({
82
+ name: Converters.string,
83
+ systemType: Converters.literal('literal'),
84
+ configuration: literalQualifierTypeConfig.optional()
85
+ });
86
+ /**
87
+ * A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
88
+ * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
89
+ * @public
90
+ */
91
+ export const systemQualifierTypeConfig = Converters.discriminatedObject('systemType', {
92
+ language: systemLanguageQualifierTypeConfig,
93
+ territory: systemTerritoryQualifierTypeConfig,
94
+ literal: systemLiteralQualifierTypeConfig
95
+ });
96
+ /**
97
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
98
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
99
+ * @param config - A `Converter` for the configuration object.
100
+ * @public
101
+ */
102
+ export function qualifierTypeConfig(config) {
103
+ return Converters.strictObject({
104
+ name: Common.Convert.qualifierTypeName,
105
+ systemType: Common.Convert.qualifierTypeName,
106
+ configuration: config.optional()
107
+ });
108
+ }
109
+ /**
110
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
111
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
112
+ * @public
113
+ */
114
+ export const jsonQualifierTypeConfig = qualifierTypeConfig(JsonConverters.jsonObject);
115
+ /**
116
+ * A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
117
+ * @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
118
+ * @public
119
+ */
120
+ export const anyQualifierTypeConfig = Converters.oneOf([
121
+ jsonQualifierTypeConfig,
122
+ systemQualifierTypeConfig
123
+ ]);
124
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import * as Convert from './convert';
23
+ export * from './json';
24
+ export { Convert };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /**
23
+ * Checks if a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | qualifier type configuration} is a
24
+ * {@link QualifierTypes.Config.ISystemQualifierTypeConfig | system qualifier type configuration}.
25
+ * @param config - The {@link QualifierTypes.Config.IAnyQualifierTypeConfig | qualifier type configuration} to check.
26
+ * @returns `true` if the configuration is a system qualifier type configuration, `false` otherwise.
27
+ * @public
28
+ */
29
+ export function isSystemQualifierTypeConfig(config) {
30
+ return (config.systemType === 'language' || config.systemType === 'territory' || config.systemType === 'literal');
31
+ }
32
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { Converters, fail } from '@fgv/ts-utils';
23
+ /**
24
+ * Converter for {@link QualifierTypes.QualifierType | QualifierType} objects,
25
+ * retrieves a {@link QualifierTypes.QualifierType | QualifierType} by name or
26
+ * index from a supplied {@link QualifierTypes.Convert.IQualifierTypeConvertContext | conversion context}.
27
+ * @public
28
+ */
29
+ // eslint-disable-next-line @rushstack/typedef-var
30
+ export const qualifierType = Converters.generic((from, __self, context) => {
31
+ if (!context) {
32
+ return fail('qualifierType converter requires a context');
33
+ }
34
+ if (typeof from === 'string') {
35
+ return context.qualifierTypes.validating.get(from);
36
+ }
37
+ else if (typeof from === 'number') {
38
+ return context.qualifierTypes.getAt(from);
39
+ }
40
+ return fail('qualifierType converter requires a string or number');
41
+ });
42
+ /**
43
+ * Gets a converter for {@link QualifierTypes.ILiteralValueHierarchyCreateParams | ILiteralValueHierarchyCreateParams}
44
+ * objects with values validated by a supplied value converter.
45
+ * @param valueConverter - Converter for the literal value type.
46
+ * @public
47
+ */
48
+ export function literalValueHierarchyCreateParams(valueConverter) {
49
+ return Converters.object({
50
+ values: Converters.arrayOf(valueConverter),
51
+ hierarchy: Converters.recordOf(valueConverter, {
52
+ keyConverter: valueConverter
53
+ })
54
+ });
55
+ }
56
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1,82 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { fail } from '@fgv/ts-utils';
23
+ import * as Config from './config';
24
+ import { LanguageQualifierType } from './languageQualifierType';
25
+ import { TerritoryQualifierType } from './territoryQualifierType';
26
+ import { LiteralQualifierType } from './literalQualifierType';
27
+ /**
28
+ * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a configuration object.
29
+ * This factory function determines the appropriate qualifier type based on the systemType
30
+ * and delegates to the appropriate type-specific createFromConfig method.
31
+ * @param typeConfig - The {@link QualifierTypes.Config.IQualifierTypeConfig | configuration object}
32
+ * containing the name, systemType, and optional type-specific configuration.
33
+ * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
34
+ * if successful, `Failure` with an error message otherwise.
35
+ * @public
36
+ */
37
+ export function createQualifierTypeFromConfig(typeConfig) {
38
+ var _a;
39
+ /* c8 ignore next 1 - defense in depth */
40
+ const childConfig = (_a = typeConfig.configuration) !== null && _a !== void 0 ? _a : {};
41
+ switch (typeConfig.systemType) {
42
+ case 'language':
43
+ return Config.Convert.languageQualifierTypeConfig
44
+ .convert(childConfig)
45
+ .onSuccess((configuration) => LanguageQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
46
+ case 'territory':
47
+ return Config.Convert.territoryQualifierTypeConfig
48
+ .convert(childConfig)
49
+ .onSuccess((configuration) => TerritoryQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
50
+ case 'literal':
51
+ return Config.Convert.literalQualifierTypeConfig
52
+ .convert(childConfig)
53
+ .onSuccess((configuration) => LiteralQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
54
+ }
55
+ /* c8 ignore next 1 - defense in depth */
56
+ return fail(`Unknown qualifier type: ${typeConfig.systemType}`);
57
+ }
58
+ /**
59
+ * Creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from a system configuration object.
60
+ * This factory function determines the appropriate qualifier type based on the systemType
61
+ * and delegates to the appropriate type-specific createFromConfig method.
62
+ * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}
63
+ * containing the name, systemType, and optional type-specific configuration.
64
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
65
+ * if successful, `Failure` with an error message otherwise.
66
+ * @public
67
+ */
68
+ export function createQualifierTypeFromSystemConfig(typeConfig) {
69
+ const { systemType } = typeConfig;
70
+ switch (systemType) {
71
+ case 'language':
72
+ return LanguageQualifierType.createFromConfig(typeConfig);
73
+ case 'territory':
74
+ return TerritoryQualifierType.createFromConfig(typeConfig);
75
+ case 'literal':
76
+ return LiteralQualifierType.createFromConfig(typeConfig);
77
+ }
78
+ /* c8 ignore next 3 - should not happen */
79
+ // @ts-expect-error
80
+ return fail(`${systemType}: Unknown system qualifier type.`);
81
+ }
82
+ //# sourceMappingURL=helpers.js.map