@fgv/ts-res 5.0.0-21 → 5.0.0-23

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 (197) hide show
  1. package/README.md +794 -137
  2. package/dist/ts-res.d.ts +506 -33
  3. package/lib/packlets/common/convert.d.ts +10 -0
  4. package/lib/packlets/common/convert.js +11 -1
  5. package/lib/packlets/common/resources.d.ts +40 -1
  6. package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
  7. package/lib/packlets/common/validate/regularExpressions.js +5 -1
  8. package/lib/packlets/common/validate/resources.d.ts +35 -1
  9. package/lib/packlets/common/validate/resources.js +54 -0
  10. package/lib/packlets/config/convert.js +1 -1
  11. package/lib/packlets/config/json.d.ts +1 -1
  12. package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
  13. package/lib/packlets/qualifier-types/config/convert.js +67 -2
  14. package/lib/packlets/qualifier-types/config/json.d.ts +11 -2
  15. package/lib/packlets/qualifier-types/helpers.d.ts +1 -2
  16. package/lib/packlets/qualifier-types/languageQualifierType.d.ts +27 -1
  17. package/lib/packlets/qualifier-types/languageQualifierType.js +75 -0
  18. package/lib/packlets/qualifier-types/literalQualifierType.d.ts +30 -4
  19. package/lib/packlets/qualifier-types/literalQualifierType.js +77 -0
  20. package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +6 -10
  21. package/lib/packlets/qualifier-types/literalValueHierarchy.js +10 -0
  22. package/lib/packlets/qualifier-types/qualifierType.d.ts +28 -0
  23. package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +28 -4
  24. package/lib/packlets/qualifier-types/territoryQualifierType.js +77 -0
  25. package/lib/packlets/resource-json/compiled/convert.js +2 -1
  26. package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
  27. package/lib/packlets/resource-types/config/convert.js +3 -1
  28. package/lib/packlets/resource-types/config/json.d.ts +2 -0
  29. package/lib/packlets/resource-types/jsonResourceType.d.ts +10 -6
  30. package/lib/packlets/resource-types/jsonResourceType.js +7 -10
  31. package/lib/packlets/resource-types/resourceType.d.ts +20 -8
  32. package/lib/packlets/resource-types/resourceType.js +20 -16
  33. package/lib/packlets/resources/candidateValue.d.ts +92 -0
  34. package/lib/packlets/resources/candidateValue.js +128 -0
  35. package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
  36. package/lib/packlets/resources/candidateValueCollector.js +96 -0
  37. package/lib/packlets/resources/index.d.ts +2 -0
  38. package/lib/packlets/resources/index.js +2 -0
  39. package/lib/packlets/resources/resource.js +2 -2
  40. package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
  41. package/lib/packlets/resources/resourceBuilder.js +3 -1
  42. package/lib/packlets/resources/resourceCandidate.d.ts +10 -1
  43. package/lib/packlets/resources/resourceCandidate.js +11 -5
  44. package/lib/packlets/resources/resourceManagerBuilder.d.ts +7 -0
  45. package/lib/packlets/resources/resourceManagerBuilder.js +13 -6
  46. package/lib/packlets/runtime/compiledResourceCollection.d.ts +20 -8
  47. package/lib/packlets/runtime/compiledResourceCollection.js +25 -4
  48. package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
  49. package/lib/packlets/runtime/resourceResolver.d.ts +39 -1
  50. package/lib/packlets/runtime/resourceResolver.js +45 -28
  51. package/lib/test/unit/qualifier-types/testQualifierType.d.ts +4 -0
  52. package/lib/test/unit/qualifier-types/testQualifierType.js +24 -0
  53. package/lib/test/unit/resource-types/derivedResourceType.test.d.ts +2 -0
  54. package/lib/test/unit/resource-types/testDerivedResourceType.d.ts +79 -0
  55. package/lib/test/unit/resource-types/testDerivedResourceType.js +113 -0
  56. package/lib/test/unit/resources/candidateValue.test.d.ts +2 -0
  57. package/lib/test/unit/resources/candidateValueCollector.test.d.ts +2 -0
  58. package/lib/test/unit/runtime/resourceResolver.coverage.test.d.ts +2 -0
  59. package/lib/test/unit/runtime/resourceResolver.newFeatures.test.d.ts +2 -0
  60. package/package.json +7 -7
  61. package/src/index.ts +0 -75
  62. package/src/packlets/bundle/bundleBuilder.ts +0 -159
  63. package/src/packlets/bundle/bundleLoader.ts +0 -157
  64. package/src/packlets/bundle/bundleNormalizer.ts +0 -173
  65. package/src/packlets/bundle/bundleUtils.ts +0 -142
  66. package/src/packlets/bundle/convert.ts +0 -87
  67. package/src/packlets/bundle/index.ts +0 -52
  68. package/src/packlets/bundle/model.ts +0 -138
  69. package/src/packlets/common/conditions.ts +0 -226
  70. package/src/packlets/common/convert.ts +0 -184
  71. package/src/packlets/common/helpers/conditions.ts +0 -84
  72. package/src/packlets/common/helpers/context.ts +0 -88
  73. package/src/packlets/common/helpers/index.ts +0 -26
  74. package/src/packlets/common/helpers/qualifierDefaultValues.ts +0 -91
  75. package/src/packlets/common/helpers/resources.ts +0 -96
  76. package/src/packlets/common/index.ts +0 -30
  77. package/src/packlets/common/resources.ts +0 -78
  78. package/src/packlets/common/validate/conditions.ts +0 -595
  79. package/src/packlets/common/validate/index.ts +0 -27
  80. package/src/packlets/common/validate/regularExpressions.ts +0 -92
  81. package/src/packlets/common/validate/resources.ts +0 -170
  82. package/src/packlets/conditions/condition.ts +0 -351
  83. package/src/packlets/conditions/conditionCollector.ts +0 -103
  84. package/src/packlets/conditions/conditionDecls.ts +0 -50
  85. package/src/packlets/conditions/conditionSet.ts +0 -318
  86. package/src/packlets/conditions/conditionSetCollector.ts +0 -127
  87. package/src/packlets/conditions/conditionSetDecls.ts +0 -41
  88. package/src/packlets/conditions/conditionToken.ts +0 -180
  89. package/src/packlets/conditions/convert/conditionSetDecls.ts +0 -72
  90. package/src/packlets/conditions/convert/decls.ts +0 -95
  91. package/src/packlets/conditions/convert/index.ts +0 -24
  92. package/src/packlets/conditions/index.ts +0 -33
  93. package/src/packlets/config/common.ts +0 -107
  94. package/src/packlets/config/configInitFactory.ts +0 -142
  95. package/src/packlets/config/convert.ts +0 -61
  96. package/src/packlets/config/index.ts +0 -30
  97. package/src/packlets/config/json.ts +0 -43
  98. package/src/packlets/config/predefined/default.ts +0 -150
  99. package/src/packlets/config/predefined/extended.ts +0 -198
  100. package/src/packlets/config/predefined/index.ts +0 -26
  101. package/src/packlets/config/systemConfiguration.ts +0 -217
  102. package/src/packlets/context/contextDecls.ts +0 -76
  103. package/src/packlets/context/contextToken.ts +0 -252
  104. package/src/packlets/context/convert/decls.ts +0 -126
  105. package/src/packlets/context/convert/index.ts +0 -23
  106. package/src/packlets/context/index.ts +0 -27
  107. package/src/packlets/decisions/abstractDecision.ts +0 -87
  108. package/src/packlets/decisions/abstractDecisionCollector.ts +0 -122
  109. package/src/packlets/decisions/candidate.ts +0 -101
  110. package/src/packlets/decisions/common.ts +0 -37
  111. package/src/packlets/decisions/concreteDecision.ts +0 -157
  112. package/src/packlets/decisions/decision.ts +0 -172
  113. package/src/packlets/decisions/index.ts +0 -28
  114. package/src/packlets/import/fsItem.ts +0 -212
  115. package/src/packlets/import/importContext.ts +0 -183
  116. package/src/packlets/import/importManager.ts +0 -187
  117. package/src/packlets/import/importable.ts +0 -107
  118. package/src/packlets/import/importers/collectionImporter.ts +0 -153
  119. package/src/packlets/import/importers/fsItemImporter.ts +0 -154
  120. package/src/packlets/import/importers/importer.ts +0 -58
  121. package/src/packlets/import/importers/index.ts +0 -27
  122. package/src/packlets/import/importers/jsonImporter.ts +0 -133
  123. package/src/packlets/import/importers/pathImporter.ts +0 -134
  124. package/src/packlets/import/index.ts +0 -29
  125. package/src/packlets/qualifier-types/config/convert.ts +0 -108
  126. package/src/packlets/qualifier-types/config/index.ts +0 -27
  127. package/src/packlets/qualifier-types/config/json.ts +0 -126
  128. package/src/packlets/qualifier-types/convert.ts +0 -77
  129. package/src/packlets/qualifier-types/helpers.ts +0 -94
  130. package/src/packlets/qualifier-types/index.ts +0 -34
  131. package/src/packlets/qualifier-types/languageQualifierType.ts +0 -143
  132. package/src/packlets/qualifier-types/literalQualifierType.ts +0 -244
  133. package/src/packlets/qualifier-types/literalValueHierarchy.ts +0 -332
  134. package/src/packlets/qualifier-types/qualifierType.ts +0 -360
  135. package/src/packlets/qualifier-types/qualifierTypeCollector.ts +0 -102
  136. package/src/packlets/qualifier-types/territoryQualifierType.ts +0 -255
  137. package/src/packlets/qualifiers/convert/decls.ts +0 -90
  138. package/src/packlets/qualifiers/convert/index.ts +0 -24
  139. package/src/packlets/qualifiers/convert/qualifier.ts +0 -55
  140. package/src/packlets/qualifiers/index.ts +0 -31
  141. package/src/packlets/qualifiers/qualifier.ts +0 -169
  142. package/src/packlets/qualifiers/qualifierCollector.ts +0 -194
  143. package/src/packlets/qualifiers/qualifierDecl.ts +0 -80
  144. package/src/packlets/qualifiers/qualifierDefaultValueDecls.ts +0 -57
  145. package/src/packlets/qualifiers/qualifierDefaultValueToken.ts +0 -230
  146. package/src/packlets/resource-json/compiled/common.ts +0 -35
  147. package/src/packlets/resource-json/compiled/convert.ts +0 -143
  148. package/src/packlets/resource-json/compiled/index.ts +0 -27
  149. package/src/packlets/resource-json/compiled/json.ts +0 -239
  150. package/src/packlets/resource-json/convert.ts +0 -236
  151. package/src/packlets/resource-json/helpers.ts +0 -284
  152. package/src/packlets/resource-json/index.ts +0 -33
  153. package/src/packlets/resource-json/json.ts +0 -295
  154. package/src/packlets/resource-json/normalized.ts +0 -211
  155. package/src/packlets/resource-json/resourceDeclCollection.ts +0 -117
  156. package/src/packlets/resource-json/resourceDeclContainer.ts +0 -48
  157. package/src/packlets/resource-json/resourceDeclTree.ts +0 -116
  158. package/src/packlets/resource-types/config/convert.ts +0 -36
  159. package/src/packlets/resource-types/config/index.ts +0 -27
  160. package/src/packlets/resource-types/config/json.ts +0 -30
  161. package/src/packlets/resource-types/helpers.ts +0 -44
  162. package/src/packlets/resource-types/index.ts +0 -30
  163. package/src/packlets/resource-types/jsonResourceType.ts +0 -104
  164. package/src/packlets/resource-types/resourceType.ts +0 -259
  165. package/src/packlets/resource-types/resourceTypeCollector.ts +0 -79
  166. package/src/packlets/resources/candidateReducer.ts +0 -331
  167. package/src/packlets/resources/common.ts +0 -114
  168. package/src/packlets/resources/index.ts +0 -28
  169. package/src/packlets/resources/resource.ts +0 -307
  170. package/src/packlets/resources/resourceBuilder.ts +0 -269
  171. package/src/packlets/resources/resourceCandidate.ts +0 -333
  172. package/src/packlets/resources/resourceManagerBuilder.ts +0 -1169
  173. package/src/packlets/runtime/cacheListener.ts +0 -113
  174. package/src/packlets/runtime/cacheMetrics.ts +0 -206
  175. package/src/packlets/runtime/compiledResourceCollection.ts +0 -607
  176. package/src/packlets/runtime/conditionSetResolutionResult.ts +0 -160
  177. package/src/packlets/runtime/context/contextQualifierProvider.ts +0 -117
  178. package/src/packlets/runtime/context/contextQualifierProviderValidator.ts +0 -281
  179. package/src/packlets/runtime/context/index.ts +0 -26
  180. package/src/packlets/runtime/context/simpleContextQualifierProvider.ts +0 -225
  181. package/src/packlets/runtime/context/validatingSimpleContextQualifierProvider.ts +0 -96
  182. package/src/packlets/runtime/iResourceManager.ts +0 -130
  183. package/src/packlets/runtime/index.ts +0 -35
  184. package/src/packlets/runtime/resource-tree/common.ts +0 -126
  185. package/src/packlets/runtime/resource-tree/index.ts +0 -26
  186. package/src/packlets/runtime/resource-tree/readOnlyResourceTree.ts +0 -342
  187. package/src/packlets/runtime/resource-tree/resourceTreeChildren.ts +0 -125
  188. package/src/packlets/runtime/resource-tree/resourceTreeChildrenValidator.ts +0 -187
  189. package/src/packlets/runtime/resourceResolver.ts +0 -626
  190. package/src/packlets/runtime/validate.ts +0 -63
  191. package/src/packlets/zip-archive/convert.ts +0 -121
  192. package/src/packlets/zip-archive/index.ts +0 -76
  193. package/src/packlets/zip-archive/json.ts +0 -91
  194. package/src/packlets/zip-archive/types.ts +0 -140
  195. package/src/packlets/zip-archive/zipArchiveCreator.ts +0 -229
  196. package/src/packlets/zip-archive/zipArchiveFormat.ts +0 -158
  197. package/src/packlets/zip-archive/zipArchiveLoader.ts +0 -370
@@ -103,6 +103,16 @@ export declare const resourceTypeName: import("@fgv/ts-utils").Converter<import(
103
103
  * @public
104
104
  */
105
105
  export declare const resourceTypeIndex: import("@fgv/ts-utils").Converter<import("./resources").ResourceTypeIndex, unknown>;
106
+ /**
107
+ * `Converter` which validates an `unknown` value as a {@link CandidateValueKey | CandidateValueKey}.
108
+ * @public
109
+ */
110
+ export declare const candidateValueKey: import("@fgv/ts-utils").Converter<import("./resources").CandidateValueKey, unknown>;
111
+ /**
112
+ * `Converter` which validates an `unknown` value as a {@link CandidateValueIndex | CandidateValueIndex}.
113
+ * @public
114
+ */
115
+ export declare const candidateValueIndex: import("@fgv/ts-utils").Converter<import("./resources").CandidateValueIndex, unknown>;
106
116
  /**
107
117
  * `Converter` for a resource value merge method.
108
118
  * @public
@@ -54,7 +54,7 @@ var __importStar = (this && this.__importStar) || (function () {
54
54
  };
55
55
  })();
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.contextToken = exports.contextQualifierToken = exports.resourceValueMergeMethod = exports.resourceTypeIndex = exports.resourceTypeName = exports.resourceIndex = exports.resourceName = exports.resourceId = exports.decisionKey = exports.decisionIndex = exports.conditionSetHash = exports.conditionSetToken = exports.conditionSetKey = exports.conditionSetIndex = exports.conditionToken = exports.conditionKey = exports.conditionIndex = exports.conditionOperator = exports.conditionPriority = exports.qualifierMatchScore = exports.qualifierTypeIndex = exports.qualifierTypeName = exports.qualifierIndex = exports.qualifierName = void 0;
57
+ exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.contextToken = exports.contextQualifierToken = exports.resourceValueMergeMethod = exports.candidateValueIndex = exports.candidateValueKey = exports.resourceTypeIndex = exports.resourceTypeName = exports.resourceIndex = exports.resourceName = exports.resourceId = exports.decisionKey = exports.decisionIndex = exports.conditionSetHash = exports.conditionSetToken = exports.conditionSetKey = exports.conditionSetIndex = exports.conditionToken = exports.conditionKey = exports.conditionIndex = exports.conditionOperator = exports.conditionPriority = exports.qualifierMatchScore = exports.qualifierTypeIndex = exports.qualifierTypeName = exports.qualifierIndex = exports.qualifierName = void 0;
58
58
  const ts_utils_1 = require("@fgv/ts-utils");
59
59
  const Validate = __importStar(require("./validate"));
60
60
  const conditions_1 = require("./conditions");
@@ -165,6 +165,16 @@ exports.resourceTypeName = ts_utils_1.Converters.string.map(Validate.toResourceT
165
165
  * @public
166
166
  */
167
167
  exports.resourceTypeIndex = ts_utils_1.Converters.number.map(Validate.toResourceTypeIndex);
168
+ /**
169
+ * `Converter` which validates an `unknown` value as a {@link CandidateValueKey | CandidateValueKey}.
170
+ * @public
171
+ */
172
+ exports.candidateValueKey = ts_utils_1.Converters.string.map(Validate.toCandidateValueKey);
173
+ /**
174
+ * `Converter` which validates an `unknown` value as a {@link CandidateValueIndex | CandidateValueIndex}.
175
+ * @public
176
+ */
177
+ exports.candidateValueIndex = ts_utils_1.Converters.number.map(Validate.toCandidateValueIndex);
168
178
  /**
169
179
  * `Converter` for a resource value merge method.
170
180
  * @public
@@ -1,4 +1,5 @@
1
- import { Brand } from '@fgv/ts-utils';
1
+ import { JsonValue } from '@fgv/ts-json-base';
2
+ import { Brand, Result } from '@fgv/ts-utils';
2
3
  /**
3
4
  * Branded string representing a validated resource id. A resource ID
4
5
  * is a dot-separated sequence of resource names.
@@ -46,4 +47,42 @@ export declare const allResourceValueMergeMethods: ResourceValueMergeMethod[];
46
47
  * @public
47
48
  */
48
49
  export type CandidateCompleteness = 'full' | 'partial';
50
+ /**
51
+ * Branded number representing a validated candidate value index.
52
+ * Candidate value indices are used to identify candidate values
53
+ * within a resource set and to enable sharing of like values.
54
+ * @public
55
+ */
56
+ export type CandidateValueIndex = Brand<number, 'CandidateValueIndex'>;
57
+ /**
58
+ * Branded string representing a validated candidate value key.
59
+ * Candidate value keys are used to identify candidate values
60
+ * within a resource set and to enable sharing of like values.
61
+ * @public
62
+ */
63
+ export type CandidateValueKey = Brand<string, 'CandidateValueKey'>;
64
+ /**
65
+ * Minimal resource resolver
66
+ * @public
67
+ */
68
+ export interface IResourceResolver {
69
+ /**
70
+ * Resolves a resource to a composed value by merging matching candidates according to their merge methods.
71
+ * Starting from the highest priority candidates, finds the first "full" candidate and merges all higher
72
+ * priority "partial" candidates into it in ascending order of priority.
73
+ * @param resource - The string id of the resource to resolve.
74
+ * @returns `Success` with the composed JsonValue if successful,
75
+ * or `Failure` with an error message if no candidates match or resolution fails.
76
+ * @public
77
+ */
78
+ resolveComposedResourceValue(resource: string): Result<JsonValue>;
79
+ /**
80
+ * Creates a new {@link IResourceResolver | resource resolver} with the given context.
81
+ * @param context - The context to use for the new resource resolver.
82
+ * @returns `Success` with the new resource resolver if successful,
83
+ * or `Failure` with an error message if the context is invalid.
84
+ * @public
85
+ */
86
+ withContext(context: Record<string, string>): Result<IResourceResolver>;
87
+ }
49
88
  //# sourceMappingURL=resources.d.ts.map
@@ -38,6 +38,10 @@ export declare const conditionSetHash: RegExp;
38
38
  * @internal
39
39
  */
40
40
  export declare const decisionKey: RegExp;
41
+ /**
42
+ * @internal
43
+ */
44
+ export declare const candidateValueKey: RegExp;
41
45
  /**
42
46
  * A {@link QualifierDefaultValueToken | qualifier default value token} has the form
43
47
  * `<qualifierName>=<value>` or `<qualifierName>=` (to remove default).
@@ -21,7 +21,7 @@
21
21
  * SOFTWARE.
22
22
  */
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.territoryCode = exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.decisionKey = exports.conditionSetHash = exports.contextToken = exports.conditionToken = exports.conditionKey = exports.identifierList = exports.segmentedIdentifier = exports.identifier = void 0;
24
+ exports.territoryCode = exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.candidateValueKey = exports.decisionKey = exports.conditionSetHash = exports.contextToken = exports.conditionToken = exports.conditionKey = exports.identifierList = exports.segmentedIdentifier = exports.identifier = void 0;
25
25
  /**
26
26
  * @internal
27
27
  */
@@ -62,6 +62,10 @@ exports.conditionSetHash = /^[a-zA-Z0-9]{8}$/;
62
62
  * @internal
63
63
  */
64
64
  exports.decisionKey = /^[a-zA-Z0-9]{8}(?:\+[a-zA-Z0-9]{8})*(?:\|[a-zA-Z0-9]{8})?$/;
65
+ /**
66
+ * @internal
67
+ */
68
+ exports.candidateValueKey = /^[a-zA-Z0-9]+$/;
65
69
  /**
66
70
  * A {@link QualifierDefaultValueToken | qualifier default value token} has the form
67
71
  * `<qualifierName>=<value>` or `<qualifierName>=` (to remove default).
@@ -1,5 +1,5 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ResourceId, ResourceIndex, ResourceName, ResourceTypeIndex, ResourceTypeName } from '../resources';
2
+ import { CandidateValueIndex, CandidateValueKey, ResourceId, ResourceIndex, ResourceName, ResourceTypeIndex, ResourceTypeName } from '../resources';
3
3
  /**
4
4
  * Checks if the given name is a valid resource name.
5
5
  *
@@ -40,6 +40,22 @@ export declare function isValidResourceTypeName(name: string): name is ResourceT
40
40
  * @public
41
41
  */
42
42
  export declare function isValidResourceTypeIndex(index: number): index is ResourceTypeIndex;
43
+ /**
44
+ * Checks if the given index is a valid candidate value index.
45
+ *
46
+ * @param index - The index to validate.
47
+ * @returns `true` if the index is a valid candidate value index, otherwise `false`.
48
+ * @public
49
+ */
50
+ export declare function isValidCandidateValueIndex(index: number): index is CandidateValueIndex;
51
+ /**
52
+ * Checks if the given key is a valid candidate value key.
53
+ *
54
+ * @param key - The key to validate.
55
+ * @returns `true` if the key is a valid candidate value key, otherwise `false`.
56
+ * @public
57
+ */
58
+ export declare function isValidCandidateValueKey(key: string): key is CandidateValueKey;
43
59
  /**
44
60
  * Converts a string to a {@link ResourceName | resource name}.
45
61
  *
@@ -94,4 +110,22 @@ export declare function toResourceTypeName(name: string): Result<ResourceTypeNam
94
110
  * @public
95
111
  */
96
112
  export declare function toResourceTypeIndex(index: number): Result<ResourceTypeIndex>;
113
+ /**
114
+ * Converts a string to a {@link CandidateValueKey | candidate value key}.
115
+ *
116
+ * @param key - The key to convert.
117
+ * @returns `Success` with the converted key if valid, or `Failure` with an error message
118
+ * if not.
119
+ * @public
120
+ */
121
+ export declare function toCandidateValueKey(key: string): Result<CandidateValueKey>;
122
+ /**
123
+ * Converts a number to a {@link CandidateValueIndex | candidate value index}.
124
+ *
125
+ * @param index - The number to convert.
126
+ * @returns `Success` with the converted index if valid, or `Failure` with an error message
127
+ * if not.
128
+ * @public
129
+ */
130
+ export declare function toCandidateValueIndex(index: number): Result<CandidateValueIndex>;
97
131
  //# sourceMappingURL=resources.d.ts.map
@@ -26,12 +26,16 @@ exports.isValidResourceId = isValidResourceId;
26
26
  exports.isValidResourceIndex = isValidResourceIndex;
27
27
  exports.isValidResourceTypeName = isValidResourceTypeName;
28
28
  exports.isValidResourceTypeIndex = isValidResourceTypeIndex;
29
+ exports.isValidCandidateValueIndex = isValidCandidateValueIndex;
30
+ exports.isValidCandidateValueKey = isValidCandidateValueKey;
29
31
  exports.toResourceName = toResourceName;
30
32
  exports.toResourceId = toResourceId;
31
33
  exports.toOptionalResourceId = toOptionalResourceId;
32
34
  exports.toResourceIndex = toResourceIndex;
33
35
  exports.toResourceTypeName = toResourceTypeName;
34
36
  exports.toResourceTypeIndex = toResourceTypeIndex;
37
+ exports.toCandidateValueKey = toCandidateValueKey;
38
+ exports.toCandidateValueIndex = toCandidateValueIndex;
35
39
  const ts_utils_1 = require("@fgv/ts-utils");
36
40
  const regularExpressions_1 = require("./regularExpressions");
37
41
  /**
@@ -84,6 +88,26 @@ function isValidResourceTypeName(name) {
84
88
  function isValidResourceTypeIndex(index) {
85
89
  return index >= 0;
86
90
  }
91
+ /**
92
+ * Checks if the given index is a valid candidate value index.
93
+ *
94
+ * @param index - The index to validate.
95
+ * @returns `true` if the index is a valid candidate value index, otherwise `false`.
96
+ * @public
97
+ */
98
+ function isValidCandidateValueIndex(index) {
99
+ return index >= 0;
100
+ }
101
+ /**
102
+ * Checks if the given key is a valid candidate value key.
103
+ *
104
+ * @param key - The key to validate.
105
+ * @returns `true` if the key is a valid candidate value key, otherwise `false`.
106
+ * @public
107
+ */
108
+ function isValidCandidateValueKey(key) {
109
+ return regularExpressions_1.candidateValueKey.test(key);
110
+ }
87
111
  /**
88
112
  * Converts a string to a {@link ResourceName | resource name}.
89
113
  *
@@ -168,4 +192,34 @@ function toResourceTypeIndex(index) {
168
192
  }
169
193
  return (0, ts_utils_1.succeed)(index);
170
194
  }
195
+ /**
196
+ * Converts a string to a {@link CandidateValueKey | candidate value key}.
197
+ *
198
+ * @param key - The key to convert.
199
+ * @returns `Success` with the converted key if valid, or `Failure` with an error message
200
+ * if not.
201
+ * @public
202
+ */
203
+ function toCandidateValueKey(key) {
204
+ /* c8 ignore next 3 - coverage having issues */
205
+ if (!isValidCandidateValueKey(key)) {
206
+ return (0, ts_utils_1.fail)(`${key}: not a valid candidate value key.`);
207
+ }
208
+ return (0, ts_utils_1.succeed)(key);
209
+ }
210
+ /**
211
+ * Converts a number to a {@link CandidateValueIndex | candidate value index}.
212
+ *
213
+ * @param index - The number to convert.
214
+ * @returns `Success` with the converted index if valid, or `Failure` with an error message
215
+ * if not.
216
+ * @public
217
+ */
218
+ function toCandidateValueIndex(index) {
219
+ /* c8 ignore next 3 - coverage having issues */
220
+ if (!isValidCandidateValueIndex(index)) {
221
+ return (0, ts_utils_1.fail)(`${index}: not a valid candidate value index.`);
222
+ }
223
+ return (0, ts_utils_1.succeed)(index);
224
+ }
171
225
  //# sourceMappingURL=resources.js.map
@@ -70,7 +70,7 @@ const common_1 = require("./common");
70
70
  exports.systemConfiguration = ts_utils_1.Converters.strictObject({
71
71
  name: ts_utils_1.Converters.optionalString,
72
72
  description: ts_utils_1.Converters.optionalString,
73
- qualifierTypes: ts_utils_1.Converters.arrayOf(QualifierTypes.Config.Convert.systemQualifierTypeConfig),
73
+ qualifierTypes: ts_utils_1.Converters.arrayOf(QualifierTypes.Config.Convert.anyQualifierTypeConfig),
74
74
  qualifiers: ts_utils_1.Converters.arrayOf(Qualifiers.Convert.qualifierDecl),
75
75
  resourceTypes: ts_utils_1.Converters.arrayOf(ResourceTypes.Config.Convert.resourceTypeConfig)
76
76
  });
@@ -11,7 +11,7 @@ export interface ISystemConfiguration {
11
11
  /** Optional description explaining the purpose and use case of the configuration. */
12
12
  description?: string;
13
13
  /** Qualifier type configurations that define the available qualifier types in the system. */
14
- qualifierTypes: QualifierTypes.Config.ISystemQualifierTypeConfig[];
14
+ qualifierTypes: QualifierTypes.Config.IAnyQualifierTypeConfig[];
15
15
  /** Qualifier declarations that define the available qualifiers in the system. */
16
16
  qualifiers: Qualifiers.IQualifierDecl[];
17
17
  /** Resource type configurations that define the available resource types in the system. */
@@ -1,4 +1,6 @@
1
+ import { Converter } from '@fgv/ts-utils';
1
2
  import * as Model from './json';
3
+ import { Converters as JsonConverters } from '@fgv/ts-json-base';
2
4
  /**
3
5
  * A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
4
6
  * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
@@ -40,5 +42,24 @@ export declare const systemLiteralQualifierTypeConfig: import("@fgv/ts-utils").O
40
42
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
41
43
  * @public
42
44
  */
43
- export declare const systemQualifierTypeConfig: import("@fgv/ts-utils").Converter<Model.ISystemQualifierTypeConfig, unknown>;
45
+ export declare const systemQualifierTypeConfig: Converter<Model.ISystemQualifierTypeConfig, unknown>;
46
+ /**
47
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
48
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
49
+ * @param config - A `Converter` for the configuration object.
50
+ * @public
51
+ */
52
+ export declare function qualifierTypeConfig<T, TD = unknown>(config: Converter<T, TD>): Converter<Model.IQualifierTypeConfig<T>, TD>;
53
+ /**
54
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
55
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
56
+ * @public
57
+ */
58
+ export declare const jsonQualifierTypeConfig: Converter<Model.IQualifierTypeConfig<import("@fgv/ts-json-base").JsonObject>, JsonConverters.IJsonConverterContext>;
59
+ /**
60
+ * A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
61
+ * @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
62
+ * @public
63
+ */
64
+ export declare const anyQualifierTypeConfig: Converter<Model.IAnyQualifierTypeConfig, unknown>;
44
65
  //# sourceMappingURL=convert.d.ts.map
@@ -20,10 +20,46 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
22
  */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
23
56
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.systemQualifierTypeConfig = exports.systemLiteralQualifierTypeConfig = exports.systemTerritoryQualifierTypeConfig = exports.systemLanguageQualifierTypeConfig = exports.literalQualifierTypeConfig = exports.territoryQualifierTypeConfig = exports.languageQualifierTypeConfig = void 0;
57
+ exports.anyQualifierTypeConfig = exports.jsonQualifierTypeConfig = exports.systemQualifierTypeConfig = exports.systemLiteralQualifierTypeConfig = exports.systemTerritoryQualifierTypeConfig = exports.systemLanguageQualifierTypeConfig = exports.literalQualifierTypeConfig = exports.territoryQualifierTypeConfig = exports.languageQualifierTypeConfig = void 0;
58
+ exports.qualifierTypeConfig = qualifierTypeConfig;
25
59
  /* eslint-disable @rushstack/typedef-var */
26
60
  const ts_utils_1 = require("@fgv/ts-utils");
61
+ const Common = __importStar(require("../../common"));
62
+ const ts_json_base_1 = require("@fgv/ts-json-base");
27
63
  /**
28
64
  * A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
29
65
  * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
@@ -40,7 +76,8 @@ exports.languageQualifierTypeConfig = ts_utils_1.Converters.strictObject({
40
76
  exports.territoryQualifierTypeConfig = ts_utils_1.Converters.strictObject({
41
77
  allowContextList: ts_utils_1.Converters.boolean,
42
78
  acceptLowercase: ts_utils_1.Converters.boolean.optional(),
43
- allowedTerritories: ts_utils_1.Converters.arrayOf(ts_utils_1.Converters.string).optional()
79
+ allowedTerritories: ts_utils_1.Converters.arrayOf(ts_utils_1.Converters.string).optional(),
80
+ hierarchy: ts_utils_1.Converters.recordOf(ts_utils_1.Converters.string).optional()
44
81
  });
45
82
  /**
46
83
  * A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
@@ -93,4 +130,32 @@ exports.systemQualifierTypeConfig = ts_utils_1.Converters.discriminatedObject('s
93
130
  territory: exports.systemTerritoryQualifierTypeConfig,
94
131
  literal: exports.systemLiteralQualifierTypeConfig
95
132
  });
133
+ /**
134
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
135
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
136
+ * @param config - A `Converter` for the configuration object.
137
+ * @public
138
+ */
139
+ function qualifierTypeConfig(config) {
140
+ return ts_utils_1.Converters.strictObject({
141
+ name: Common.Convert.qualifierTypeName,
142
+ systemType: Common.Convert.qualifierTypeName,
143
+ configuration: config.optional()
144
+ });
145
+ }
146
+ /**
147
+ * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
148
+ * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
149
+ * @public
150
+ */
151
+ exports.jsonQualifierTypeConfig = qualifierTypeConfig(ts_json_base_1.Converters.jsonObject);
152
+ /**
153
+ * A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
154
+ * @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
155
+ * @public
156
+ */
157
+ exports.anyQualifierTypeConfig = ts_utils_1.Converters.oneOf([
158
+ exports.jsonQualifierTypeConfig,
159
+ exports.systemQualifierTypeConfig
160
+ ]);
96
161
  //# sourceMappingURL=convert.js.map
@@ -1,5 +1,4 @@
1
1
  import { JsonObject } from '@fgv/ts-json-base';
2
- import { LiteralValueHierarchyDecl } from '../literalValueHierarchy';
3
2
  /**
4
3
  * Templated configuration for {@link QualifierTypes.QualifierType | qualifier type} configuration.
5
4
  * @public
@@ -16,6 +15,16 @@ export interface IQualifierTypeConfig<T = JsonObject> {
16
15
  export interface ILanguageQualifierTypeConfig {
17
16
  allowContextList?: boolean;
18
17
  }
18
+ /**
19
+ * Declares a hierarchy of literal values. The keys are the names of the values, and the
20
+ * values are the names of their parents.
21
+ * @remarks
22
+ * The hierarchy is defined as a tree, where each value can have multiple children but
23
+ * only one parent. The root of the tree has no parent. The hierarchy is used to
24
+ * determine the relationship between values when matching conditions and contexts.
25
+ * @public
26
+ */
27
+ export type LiteralValueHierarchyDecl<T extends string> = Partial<Record<T, T>>;
19
28
  /**
20
29
  * Configuration for {@link QualifierTypes.TerritoryQualifierType | territory qualifier type} configuration.
21
30
  * @public
@@ -25,7 +34,7 @@ export interface ITerritoryQualifierTypeConfig {
25
34
  acceptLowercase?: boolean;
26
35
  allowedTerritories?: string[];
27
36
  /**
28
- * Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
37
+ * Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
29
38
  * of territory values to use for matching. If not provided, no hierarchy will be used.
30
39
  */
31
40
  hierarchy?: LiteralValueHierarchyDecl<string>;
@@ -1,7 +1,6 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
2
  import * as Config from './config';
3
3
  import { QualifierType } from './qualifierType';
4
- import { JsonObject } from '@fgv/ts-json-base';
5
4
  /**
6
5
  * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a configuration object.
7
6
  * This factory function determines the appropriate qualifier type based on the systemType
@@ -12,7 +11,7 @@ import { JsonObject } from '@fgv/ts-json-base';
12
11
  * if successful, `Failure` with an error message otherwise.
13
12
  * @public
14
13
  */
15
- export declare function createQualifierTypeFromConfig(typeConfig: Config.IQualifierTypeConfig<JsonObject>): Result<QualifierType>;
14
+ export declare function createQualifierTypeFromConfig(typeConfig: Config.IAnyQualifierTypeConfig): Result<QualifierType>;
16
15
  /**
17
16
  * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
18
17
  * This factory function determines the appropriate qualifier type based on the systemType
@@ -1,7 +1,8 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore } from '../common';
2
+ import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore, QualifierTypeName } from '../common';
3
3
  import { IQualifierTypeCreateParams, QualifierType } from './qualifierType';
4
4
  import * as Config from './config';
5
+ import { JsonObject } from '@fgv/ts-json-base';
5
6
  /**
6
7
  * Interface defining the parameters that can be used to create a new
7
8
  * {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.
@@ -25,6 +26,10 @@ export interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTy
25
26
  * @public
26
27
  */
27
28
  export declare class LanguageQualifierType extends QualifierType {
29
+ /**
30
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
31
+ */
32
+ readonly systemTypeName: QualifierTypeName;
28
33
  /**
29
34
  * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
30
35
  * @param name - Optional name for the qualifier type. Defaults to 'language'.
@@ -54,6 +59,27 @@ export declare class LanguageQualifierType extends QualifierType {
54
59
  * {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}
55
60
  */
56
61
  isValidConditionValue(value: string): value is QualifierConditionValue;
62
+ /**
63
+ * Gets a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
64
+ * for this qualifier type.
65
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
66
+ */
67
+ getConfiguration(): Result<Config.ISystemLanguageQualifierTypeConfig>;
68
+ /**
69
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
70
+ */
71
+ getConfigurationJson(): Result<JsonObject>;
72
+ /**
73
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
74
+ */
75
+ validateConfigurationJson(from: unknown): Result<JsonObject>;
76
+ /**
77
+ * Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
78
+ * for this qualifier type.
79
+ * @param from - The unknown data to validate as a configuration object.
80
+ * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
81
+ */
82
+ validateConfiguration(from: unknown): Result<Config.ISystemLanguageQualifierTypeConfig>;
57
83
  /**
58
84
  * Matches a single language condition against a single language context value using
59
85
  * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
@@ -20,12 +20,46 @@
20
20
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
22
  */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
36
+ }) : function(o, v) {
37
+ o["default"] = v;
38
+ });
39
+ var __importStar = (this && this.__importStar) || (function () {
40
+ var ownKeys = function(o) {
41
+ ownKeys = Object.getOwnPropertyNames || function (o) {
42
+ var ar = [];
43
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
+ return ar;
45
+ };
46
+ return ownKeys(o);
47
+ };
48
+ return function (mod) {
49
+ if (mod && mod.__esModule) return mod;
50
+ var result = {};
51
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
+ __setModuleDefault(result, mod);
53
+ return result;
54
+ };
55
+ })();
23
56
  Object.defineProperty(exports, "__esModule", { value: true });
24
57
  exports.LanguageQualifierType = void 0;
25
58
  const ts_utils_1 = require("@fgv/ts-utils");
26
59
  const ts_bcp47_1 = require("@fgv/ts-bcp47");
27
60
  const common_1 = require("../common");
28
61
  const qualifierType_1 = require("./qualifierType");
62
+ const Config = __importStar(require("./config"));
29
63
  const ts_json_base_1 = require("@fgv/ts-json-base");
30
64
  /**
31
65
  * {@link QualifierTypes.QualifierType | Qualifier type} which matches BCP-47 language tags
@@ -48,6 +82,10 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
48
82
  const validated = index ? { index: common_1.Convert.qualifierTypeIndex.convert(index).orThrow() } : {};
49
83
  super(Object.assign({ name,
50
84
  allowContextList }, validated));
85
+ /**
86
+ * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
87
+ */
88
+ this.systemTypeName = common_1.Convert.qualifierTypeName.convert('language').orThrow();
51
89
  }
52
90
  /**
53
91
  * Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
@@ -84,6 +122,43 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
84
122
  .onSuccess((tag) => (0, ts_utils_1.succeed)(tag.isValid))
85
123
  .orDefault(false);
86
124
  }
125
+ /**
126
+ * Gets a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
127
+ * for this qualifier type.
128
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
129
+ */
130
+ getConfiguration() {
131
+ return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemLanguageQualifierTypeConfig.convert(json));
132
+ }
133
+ /**
134
+ * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
135
+ */
136
+ getConfigurationJson() {
137
+ return (0, ts_utils_1.succeed)({
138
+ name: this.name,
139
+ systemType: 'language',
140
+ configuration: {
141
+ allowContextList: this.allowContextList
142
+ }
143
+ });
144
+ }
145
+ /**
146
+ * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
147
+ */
148
+ validateConfigurationJson(from) {
149
+ return Config.Convert.systemLanguageQualifierTypeConfig
150
+ .convert(from)
151
+ .onSuccess((config) => (0, ts_utils_1.succeed)(config));
152
+ }
153
+ /**
154
+ * Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
155
+ * for this qualifier type.
156
+ * @param from - The unknown data to validate as a configuration object.
157
+ * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
158
+ */
159
+ validateConfiguration(from) {
160
+ return this.validateConfigurationJson(from).onSuccess((json) => Config.Convert.systemLanguageQualifierTypeConfig.convert(json));
161
+ }
87
162
  /**
88
163
  * Matches a single language condition against a single language context value using
89
164
  * {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.