@fgv/ts-res 5.0.1-9 → 5.0.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +53 -0
- package/dist/index.js +45 -0
- package/dist/packlets/bundle/bundleBuilder.js +130 -0
- package/dist/packlets/bundle/bundleLoader.js +101 -0
- package/dist/packlets/bundle/bundleNormalizer.js +138 -0
- package/dist/packlets/bundle/bundleUtils.js +113 -0
- package/dist/packlets/bundle/convert.js +75 -0
- package/dist/packlets/bundle/index.js +42 -0
- package/dist/packlets/bundle/model.js +23 -0
- package/dist/packlets/common/conditions.js +47 -0
- package/dist/packlets/common/convert.js +172 -0
- package/dist/packlets/common/helpers/conditions.js +66 -0
- package/dist/packlets/common/helpers/context.js +70 -0
- package/dist/packlets/common/helpers/index.js +26 -0
- package/dist/packlets/common/helpers/qualifierDefaultValues.js +66 -0
- package/dist/packlets/common/helpers/resources.js +93 -0
- package/dist/packlets/common/index.js +28 -0
- package/dist/packlets/common/resources.js +27 -0
- package/dist/packlets/common/validate/conditions.js +544 -0
- package/dist/packlets/common/validate/index.js +26 -0
- package/dist/packlets/common/validate/regularExpressions.js +84 -0
- package/dist/packlets/common/validate/resources.js +209 -0
- package/dist/packlets/conditions/condition.js +252 -0
- package/dist/packlets/conditions/conditionCollector.js +69 -0
- package/dist/packlets/conditions/conditionDecls.js +23 -0
- package/dist/packlets/conditions/conditionSet.js +247 -0
- package/dist/packlets/conditions/conditionSetCollector.js +89 -0
- package/dist/packlets/conditions/conditionSetDecls.js +23 -0
- package/dist/packlets/conditions/conditionToken.js +147 -0
- package/dist/packlets/conditions/convert/conditionSetDecls.js +51 -0
- package/dist/packlets/conditions/convert/decls.js +75 -0
- package/dist/packlets/conditions/convert/index.js +24 -0
- package/dist/packlets/conditions/index.js +31 -0
- package/dist/packlets/config/common.js +78 -0
- package/dist/packlets/config/configInitFactory.js +258 -0
- package/dist/packlets/config/convert.js +56 -0
- package/dist/packlets/config/index.browser.js +34 -0
- package/dist/packlets/config/index.js +28 -0
- package/dist/packlets/config/json.js +23 -0
- package/dist/packlets/config/predefined/default.js +138 -0
- package/dist/packlets/config/predefined/extended.js +190 -0
- package/dist/packlets/config/predefined/index.js +25 -0
- package/dist/packlets/config/systemConfiguration.js +147 -0
- package/dist/packlets/context/contextDecls.js +23 -0
- package/dist/packlets/context/contextToken.js +202 -0
- package/dist/packlets/context/convert/decls.js +91 -0
- package/dist/packlets/context/convert/index.js +23 -0
- package/dist/packlets/context/index.js +26 -0
- package/dist/packlets/decisions/abstractDecision.js +68 -0
- package/dist/packlets/decisions/abstractDecisionCollector.js +90 -0
- package/dist/packlets/decisions/candidate.js +76 -0
- package/dist/packlets/decisions/common.js +23 -0
- package/dist/packlets/decisions/concreteDecision.js +111 -0
- package/dist/packlets/decisions/decision.js +126 -0
- package/dist/packlets/decisions/index.js +28 -0
- package/dist/packlets/import/fsItem.js +134 -0
- package/dist/packlets/import/importContext.js +129 -0
- package/dist/packlets/import/importManager.js +129 -0
- package/dist/packlets/import/importable.js +32 -0
- package/dist/packlets/import/importers/collectionImporter.js +118 -0
- package/dist/packlets/import/importers/fsItemImporter.js +116 -0
- package/dist/packlets/import/importers/importer.js +23 -0
- package/dist/packlets/import/importers/index.browser.js +29 -0
- package/dist/packlets/import/importers/index.js +27 -0
- package/dist/packlets/import/importers/jsonImporter.js +94 -0
- package/dist/packlets/import/importers/pathImporter.js +84 -0
- package/dist/packlets/import/index.browser.js +34 -0
- package/dist/packlets/import/index.js +28 -0
- package/dist/packlets/qualifier-types/config/convert.js +124 -0
- package/dist/packlets/qualifier-types/config/index.js +25 -0
- package/dist/packlets/qualifier-types/config/json.js +32 -0
- package/dist/packlets/qualifier-types/convert.js +56 -0
- package/dist/packlets/qualifier-types/helpers.js +82 -0
- package/dist/packlets/qualifier-types/index.js +32 -0
- package/dist/packlets/qualifier-types/languageQualifierType.js +142 -0
- package/dist/packlets/qualifier-types/literalQualifierType.js +200 -0
- package/dist/packlets/qualifier-types/literalValueHierarchy.js +236 -0
- package/dist/packlets/qualifier-types/qualifierType.js +184 -0
- package/dist/packlets/qualifier-types/qualifierTypeCollector.js +66 -0
- package/dist/packlets/qualifier-types/territoryQualifierType.js +200 -0
- package/dist/packlets/qualifiers/convert/decls.js +70 -0
- package/dist/packlets/qualifiers/convert/index.js +24 -0
- package/dist/packlets/qualifiers/convert/qualifier.js +40 -0
- package/dist/packlets/qualifiers/index.js +29 -0
- package/dist/packlets/qualifiers/qualifier.js +108 -0
- package/dist/packlets/qualifiers/qualifierCollector.js +123 -0
- package/dist/packlets/qualifiers/qualifierDecl.js +23 -0
- package/dist/packlets/qualifiers/qualifierDefaultValueDecls.js +23 -0
- package/dist/packlets/qualifiers/qualifierDefaultValueToken.js +175 -0
- package/dist/packlets/resource-json/compiled/common.js +23 -0
- package/dist/packlets/resource-json/compiled/convert.js +132 -0
- package/dist/packlets/resource-json/compiled/index.js +26 -0
- package/dist/packlets/resource-json/compiled/json.js +2 -0
- package/dist/packlets/resource-json/convert.js +171 -0
- package/dist/packlets/resource-json/helpers.js +241 -0
- package/dist/packlets/resource-json/index.js +31 -0
- package/dist/packlets/resource-json/json.js +36 -0
- package/dist/packlets/resource-json/normalized.js +23 -0
- package/dist/packlets/resource-json/resourceDeclCollection.js +88 -0
- package/dist/packlets/resource-json/resourceDeclContainer.js +23 -0
- package/dist/packlets/resource-json/resourceDeclTree.js +94 -0
- package/dist/packlets/resource-types/config/convert.js +35 -0
- package/dist/packlets/resource-types/config/index.js +25 -0
- package/dist/packlets/resource-types/config/json.js +23 -0
- package/dist/packlets/resource-types/helpers.js +42 -0
- package/dist/packlets/resource-types/index.js +28 -0
- package/dist/packlets/resource-types/jsonResourceType.js +66 -0
- package/dist/packlets/resource-types/resourceType.js +95 -0
- package/dist/packlets/resource-types/resourceTypeCollector.js +61 -0
- package/dist/packlets/resources/candidateReducer.js +246 -0
- package/dist/packlets/resources/candidateValue.js +92 -0
- package/dist/packlets/resources/candidateValueCollector.js +94 -0
- package/dist/packlets/resources/common.js +23 -0
- package/dist/packlets/resources/deltaGenerator.js +338 -0
- package/dist/packlets/resources/index.js +31 -0
- package/dist/packlets/resources/resource.js +207 -0
- package/dist/packlets/resources/resourceBuilder.js +183 -0
- package/dist/packlets/resources/resourceCandidate.js +216 -0
- package/dist/packlets/resources/resourceManagerBuilder.js +890 -0
- package/dist/packlets/runtime/cacheListener.js +58 -0
- package/dist/packlets/runtime/cacheMetrics.js +149 -0
- package/dist/packlets/runtime/compiledResourceCollection.js +473 -0
- package/dist/packlets/runtime/conditionSetResolutionResult.js +134 -0
- package/dist/packlets/runtime/context/contextQualifierProvider.js +29 -0
- package/dist/packlets/runtime/context/contextQualifierProviderValidator.js +146 -0
- package/dist/packlets/runtime/context/index.js +26 -0
- package/dist/packlets/runtime/context/simpleContextQualifierProvider.js +196 -0
- package/dist/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +60 -0
- package/dist/packlets/runtime/iResourceManager.js +23 -0
- package/dist/packlets/runtime/index.js +34 -0
- package/dist/packlets/runtime/resource-tree/common.js +23 -0
- package/dist/packlets/runtime/resource-tree/index.js +26 -0
- package/dist/packlets/runtime/resource-tree/readOnlyResourceTree.js +216 -0
- package/dist/packlets/runtime/resource-tree/resourceTreeChildren.js +97 -0
- package/dist/packlets/runtime/resource-tree/resourceTreeChildrenValidator.js +161 -0
- package/dist/packlets/runtime/resourceResolver.js +481 -0
- package/dist/packlets/runtime/resourceTreeResolver.js +220 -0
- package/dist/packlets/runtime/validate.js +47 -0
- package/dist/packlets/zip-archive/convert.js +100 -0
- package/dist/packlets/zip-archive/index.browser.js +54 -0
- package/dist/packlets/zip-archive/index.js +47 -0
- package/dist/packlets/zip-archive/json.js +23 -0
- package/dist/packlets/zip-archive/types.js +36 -0
- package/dist/packlets/zip-archive/zipArchiveCreator.js +191 -0
- package/dist/packlets/zip-archive/zipArchiveFormat.js +140 -0
- package/dist/packlets/zip-archive/zipArchiveLoader.js +282 -0
- package/dist/test/data/sample.json +32 -0
- package/dist/test/unit/qualifier-types/testQualifierType.js +76 -0
- package/dist/test/unit/resource-types/testDerivedResourceType.js +109 -0
- package/dist/test/unit/resources/deltaGenerator.helpers.js +282 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/index.browser.d.ts +24 -0
- package/lib/index.browser.js +116 -0
- package/lib/packlets/config/index.browser.d.ts +7 -0
- package/lib/packlets/config/index.browser.js +74 -0
- package/lib/packlets/import/importers/index.browser.d.ts +4 -0
- package/lib/packlets/import/importers/index.browser.js +45 -0
- package/lib/packlets/import/index.browser.d.ts +7 -0
- package/lib/packlets/import/index.browser.js +74 -0
- package/lib/packlets/zip-archive/index.browser.d.ts +27 -0
- package/lib/packlets/zip-archive/index.browser.js +102 -0
- package/package.json +25 -7
|
@@ -0,0 +1,544 @@
|
|
|
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, succeed } from '@fgv/ts-utils';
|
|
23
|
+
import { NoMatch, PerfectMatch, MinConditionPriority, MaxConditionPriority, allConditionOperators } from '../conditions';
|
|
24
|
+
import { conditionKey, conditionSetHash, conditionToken, contextToken, decisionKey, identifier, qualifierDefaultValueToken, qualifierDefaultValuesToken } from './regularExpressions';
|
|
25
|
+
/**
|
|
26
|
+
* Determines whether a string is a valid qualifier name.
|
|
27
|
+
* @param name - the string to validate
|
|
28
|
+
* @returns true if the string is a valid qualifier name, false otherwise.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export function isValidQualifierName(name) {
|
|
32
|
+
return identifier.test(name);
|
|
33
|
+
}
|
|
34
|
+
/***
|
|
35
|
+
* Determines whether a string is a valid qualifier type name.
|
|
36
|
+
* @param name - the string to validate
|
|
37
|
+
* @returns true if the string is a valid qualifier type name, false otherwise.
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export function isValidQualifierTypeName(name) {
|
|
41
|
+
return identifier.test(name);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Determines whether a number is a valid priority.
|
|
45
|
+
* @param priority - the number to validate
|
|
46
|
+
* @returns true if the number is a valid priority, false otherwise.
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export function isValidConditionPriority(priority) {
|
|
50
|
+
return priority >= MinConditionPriority && priority <= MaxConditionPriority;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Determines whether a number is a valid qualifier index.
|
|
54
|
+
* @param index - the number to validate
|
|
55
|
+
* @returns true if the number is a valid qualifier index, false otherwise.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export function isValidQualifierIndex(index) {
|
|
59
|
+
return index >= 0;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Determines whether a number is a valid qualifier type index.
|
|
63
|
+
* @param index - the number to validate
|
|
64
|
+
* @returns true if the number is a valid qualifier type index, false otherwise.
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export function isValidQualifierTypeIndex(index) {
|
|
68
|
+
return index >= 0;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Determines whether a supplied value is a valid {@link QualifierMatchScore | match score}.
|
|
72
|
+
* @param value - The value to validate.
|
|
73
|
+
* @returns - `true` if the value is a valid match score, `false` otherwise.
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
export function isValidQualifierMatchScore(value) {
|
|
77
|
+
return value >= NoMatch && value <= PerfectMatch;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Determines whether a number is a valid condition index.
|
|
81
|
+
* @param index - the number to validate
|
|
82
|
+
* @returns true if the number is a valid condition index, false otherwise.
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export function isValidConditionIndex(index) {
|
|
86
|
+
return index >= 0;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Determines whether a string is a valid condition operator.
|
|
90
|
+
* @param operator - the string to validate
|
|
91
|
+
* @returns true if the string is a valid condition operator, false otherwise.
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export function isValidConditionOperator(operator) {
|
|
95
|
+
return allConditionOperators.includes(operator);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Determines whether a string is a valid condition key. A condition key has
|
|
99
|
+
* the format:
|
|
100
|
+
* `<qualifierName>(-<operator>)?-[<value>]@<priority>`
|
|
101
|
+
* where operator is omitted for the default 'matches' operator.
|
|
102
|
+
* @param key - the string to validate
|
|
103
|
+
* @returns `true` if the string is a valid condition key, `false` otherwise.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export function isValidConditionKey(key) {
|
|
107
|
+
return conditionKey.test(key);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Determines whether a string is a valid {@link ConditionToken | condition token}.
|
|
111
|
+
* A condition token has the format:
|
|
112
|
+
* `<qualifierName>=<value>` or `<value>`
|
|
113
|
+
* @param token -
|
|
114
|
+
* @returns `true` if the string is a valid condition token, `false` otherwise.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export function isValidConditionToken(token) {
|
|
118
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
119
|
+
if (token === '') {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return conditionToken.test(token);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Determines whether a number is a valid condition set index.
|
|
126
|
+
* @param index - the number to validate
|
|
127
|
+
* @returns true if the number is a valid condition set index, false otherwise.
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
export function isValidConditionSetIndex(index) {
|
|
131
|
+
return index >= 0;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Determines whether a string is a valid condition set key.
|
|
135
|
+
* @param key - the string to validate.
|
|
136
|
+
* @returns `true` if the string is a valid condition set key, `false` otherwise.
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export function isValidConditionSetKey(key) {
|
|
140
|
+
if (key === '') {
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
/* c8 ignore next 2 - edge case: condition set key validation rarely fails */
|
|
144
|
+
// a condition set key is a `+` separated list of condition keys
|
|
145
|
+
return key.split('+').every(isValidConditionKey);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Determines whether a string is a valid condition set token.
|
|
149
|
+
* @param token - the string to validate.
|
|
150
|
+
* @returns `true` if the string is a valid condition set token, `false` otherwise.
|
|
151
|
+
* @public
|
|
152
|
+
*/
|
|
153
|
+
export function isValidConditionSetToken(token) {
|
|
154
|
+
return token.split(',').every(isValidConditionToken);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Determines whether a string is a valid condition set hash.
|
|
158
|
+
* @param hash - the string to validate.
|
|
159
|
+
* @returns `true` if the string is a valid condition set hash, `false` otherwise.
|
|
160
|
+
* @public
|
|
161
|
+
*/
|
|
162
|
+
export function isValidConditionSetHash(hash) {
|
|
163
|
+
return conditionSetHash.test(hash);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Determines whether a string is a valid decision key.
|
|
167
|
+
* @param key - the string to validate
|
|
168
|
+
* @returns `true` if the string is a valid decision key, `false` otherwise.
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
export function isValidDecisionKey(key) {
|
|
172
|
+
if (key === '') {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return decisionKey.test(key);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Determines whether a number is a valid decision index.
|
|
179
|
+
* @param index - the number to validate
|
|
180
|
+
* @returns `true` if the number is a valid decision index, `false` otherwise.
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
export function isValidDecisionIndex(index) {
|
|
184
|
+
return index >= 0;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Determines whether a string is a valid qualifier context value.
|
|
188
|
+
* For now, any non-empty string is considered a valid context value.
|
|
189
|
+
* @param value - the string to validate
|
|
190
|
+
* @returns true if the string is a valid qualifier context value, false otherwise.
|
|
191
|
+
* @public
|
|
192
|
+
*/
|
|
193
|
+
export function isValidQualifierContextValue(value) {
|
|
194
|
+
return typeof value === 'string' && value.length > 0;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Converts a string to a {@link QualifierName} if it is a valid qualifier name.
|
|
198
|
+
* @param name - the string to convert
|
|
199
|
+
* @returns `Success` with the converted {@link QualifierName} if successful, or `Failure` with an
|
|
200
|
+
* error message if not.
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
|
+
export function toQualifierName(name) {
|
|
204
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
205
|
+
if (!isValidQualifierName(name)) {
|
|
206
|
+
return fail(`${name}: invalid qualifier name`);
|
|
207
|
+
}
|
|
208
|
+
return succeed(name);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Converts a string to a {@link QualifierContextValue} if it is a valid qualifier context value.
|
|
212
|
+
* @param value - the string to convert
|
|
213
|
+
* @returns `Success` with the converted {@link QualifierContextValue} if successful, or `Failure` with an
|
|
214
|
+
* error message if not.
|
|
215
|
+
* @public
|
|
216
|
+
*/
|
|
217
|
+
export function toQualifierContextValue(value) {
|
|
218
|
+
if (!isValidQualifierContextValue(value)) {
|
|
219
|
+
return fail(`${value}: invalid qualifier context value`);
|
|
220
|
+
}
|
|
221
|
+
return succeed(value);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Converts a number to a {@link QualifierIndex} if it is a valid qualifier index.
|
|
225
|
+
* @param index - the number to convert
|
|
226
|
+
* @returns `Success` with the converted {@link QualifierIndex} if successful, or `Failure` with an
|
|
227
|
+
* error message if not.
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
export function toQualifierIndex(index) {
|
|
231
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
232
|
+
if (!isValidQualifierIndex(index)) {
|
|
233
|
+
return fail(`${index}: invalid qualifier index`);
|
|
234
|
+
}
|
|
235
|
+
return succeed(index);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Converts a string to a {@link QualifierTypeName} if it is a valid qualifier type name.
|
|
239
|
+
* @param name - the string to convert
|
|
240
|
+
* @returns `Success` with the converted {@link QualifierTypeName} if successful, or `Failure` with an
|
|
241
|
+
* error message if not.
|
|
242
|
+
* @public
|
|
243
|
+
*/
|
|
244
|
+
export function toQualifierTypeName(name) {
|
|
245
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
246
|
+
if (!isValidQualifierTypeName(name)) {
|
|
247
|
+
return fail(`${name}: invalid qualifier type name`);
|
|
248
|
+
}
|
|
249
|
+
return succeed(name);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Converts a number to a {@link QualifierTypeIndex} if it is a valid qualifier type index.
|
|
253
|
+
* @param index - the number to convert
|
|
254
|
+
* @returns `Success` with the converted {@link QualifierTypeIndex} if successful, or `Failure` with an
|
|
255
|
+
* error message if not.
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
258
|
+
export function toQualifierTypeIndex(index) {
|
|
259
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
260
|
+
if (!isValidQualifierTypeIndex(index)) {
|
|
261
|
+
return fail(`${index}: invalid qualifier type index`);
|
|
262
|
+
}
|
|
263
|
+
return succeed(index);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Converts a number to a {@link QualifierMatchScore | match score} if it is a valid score.
|
|
267
|
+
* @param value - The number to convert.
|
|
268
|
+
* @returns `Success` with the converted score if successful, or `Failure` with an error message
|
|
269
|
+
* if not.
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
272
|
+
export function toQualifierMatchScore(value) {
|
|
273
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
274
|
+
if (!isValidQualifierMatchScore(value)) {
|
|
275
|
+
return fail(`${value}: invalid match score`);
|
|
276
|
+
}
|
|
277
|
+
return succeed(value);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Converts a number to a {@link ConditionPriority} if it is a valid priority.
|
|
281
|
+
* @param priority - the number to convert
|
|
282
|
+
* @returns `Success` with the converted {@link ConditionPriority} if successful, or `Failure` with an
|
|
283
|
+
* error message if not.
|
|
284
|
+
* @public
|
|
285
|
+
*/
|
|
286
|
+
export function toConditionPriority(priority) {
|
|
287
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
288
|
+
if (!isValidConditionPriority(priority)) {
|
|
289
|
+
return fail(`${priority}: invalid priority`);
|
|
290
|
+
}
|
|
291
|
+
return succeed(priority);
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Converts a number to a {@link ConditionIndex} if it is a valid condition index.
|
|
295
|
+
* @param index - the number to convert
|
|
296
|
+
* @returns `Success` with the converted {@link ConditionIndex} if successful, or `Failure` with an
|
|
297
|
+
* error message if not.
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
export function toConditionIndex(index) {
|
|
301
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
302
|
+
if (!isValidConditionIndex(index)) {
|
|
303
|
+
return fail(`${index}: invalid condition index`);
|
|
304
|
+
}
|
|
305
|
+
return succeed(index);
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Converts a string to a {@link ConditionOperator} if it is a valid condition operator.
|
|
309
|
+
* @param operator - the string to convert
|
|
310
|
+
* @returns `Success` with the converted {@link ConditionOperator} if successful, or `Failure` with an
|
|
311
|
+
* error message if not.
|
|
312
|
+
* @public
|
|
313
|
+
*/
|
|
314
|
+
export function toConditionOperator(operator) {
|
|
315
|
+
if (!isValidConditionOperator(operator)) {
|
|
316
|
+
return fail(`${operator}: invalid condition operator`);
|
|
317
|
+
}
|
|
318
|
+
return succeed(operator);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Converts a string to a {@link ConditionKey} if it is a valid condition key.
|
|
322
|
+
* @param key - the string to convert
|
|
323
|
+
* @returns `Success` with the converted {@link ConditionKey} if successful, or `Failure` with an
|
|
324
|
+
* error message if not.
|
|
325
|
+
* @public
|
|
326
|
+
*/
|
|
327
|
+
export function toConditionKey(key) {
|
|
328
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
329
|
+
if (!isValidConditionKey(key)) {
|
|
330
|
+
return fail(`${key}: invalid condition key`);
|
|
331
|
+
}
|
|
332
|
+
return succeed(key);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Converts a string to a {@link ConditionToken} if it is a valid condition token.
|
|
336
|
+
* @param token - the string to convert
|
|
337
|
+
* @returns `Success` with the converted {@link ConditionToken} if successful, or `Failure` with an
|
|
338
|
+
* error message if not.
|
|
339
|
+
* @public
|
|
340
|
+
*/
|
|
341
|
+
export function toConditionToken(token) {
|
|
342
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
343
|
+
if (!isValidConditionToken(token)) {
|
|
344
|
+
return fail(`${token}: invalid condition token`);
|
|
345
|
+
}
|
|
346
|
+
return succeed(token);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Converts a number to a {@link ConditionSetIndex} if it is a valid condition set index.
|
|
350
|
+
* @param index - the number to convert
|
|
351
|
+
* @returns `Success` with the converted {@link ConditionSetIndex} if successful, or `Failure` with an
|
|
352
|
+
* error message if not.
|
|
353
|
+
* @public
|
|
354
|
+
*/
|
|
355
|
+
export function toConditionSetIndex(index) {
|
|
356
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
357
|
+
if (!isValidConditionSetIndex(index)) {
|
|
358
|
+
return fail(`${index}: invalid condition set index`);
|
|
359
|
+
}
|
|
360
|
+
return succeed(index);
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Converts a string to a {@link ConditionSetKey} if it is a valid condition set key.
|
|
364
|
+
* @param key - the string to convert
|
|
365
|
+
* @returns `Success` with the converted {@link ConditionSetKey} if successful, or `Failure` with an
|
|
366
|
+
* error message if not.
|
|
367
|
+
* @public
|
|
368
|
+
*/
|
|
369
|
+
export function toConditionSetKey(key) {
|
|
370
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
371
|
+
if (!isValidConditionSetKey(key)) {
|
|
372
|
+
return fail(`${key}: invalid condition set key`);
|
|
373
|
+
}
|
|
374
|
+
return succeed(key);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Converts a string to a {@link ConditionSetToken} if it is a valid condition set token.
|
|
378
|
+
* @param token - the string to convert
|
|
379
|
+
* @returns `Success` with the converted {@link ConditionSetToken} if successful, or `Failure` with an
|
|
380
|
+
* error message if not.
|
|
381
|
+
* @public
|
|
382
|
+
*/
|
|
383
|
+
export function toConditionSetToken(token) {
|
|
384
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
385
|
+
if (!isValidConditionSetToken(token)) {
|
|
386
|
+
return fail(`${token}: invalid condition set token`);
|
|
387
|
+
}
|
|
388
|
+
return succeed(token);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Converts a string to a {@link ConditionSetHash} if it is a valid condition set hash.
|
|
392
|
+
* @param key - the string to convert
|
|
393
|
+
* @returns `Success` with the converted {@link ConditionSetHash} if successful, or `Failure` with an
|
|
394
|
+
* error message if not.
|
|
395
|
+
* @public
|
|
396
|
+
*/
|
|
397
|
+
export function toConditionSetHash(hash) {
|
|
398
|
+
if (!isValidConditionSetHash(hash)) {
|
|
399
|
+
return fail(`${hash}: invalid condition set hash`);
|
|
400
|
+
}
|
|
401
|
+
return succeed(hash);
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Converts a number to a {@link DecisionIndex} if it is a valid decision index.
|
|
405
|
+
* @param index - the number to convert
|
|
406
|
+
* @returns `Success` with the converted {@link DecisionIndex} if successful, or `Failure` with an
|
|
407
|
+
* error message if not.
|
|
408
|
+
* @public
|
|
409
|
+
*/
|
|
410
|
+
export function toDecisionKey(key) {
|
|
411
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
412
|
+
if (!isValidDecisionKey(key)) {
|
|
413
|
+
return fail(`${key}: invalid decision key`);
|
|
414
|
+
}
|
|
415
|
+
return succeed(key);
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Converts a number to a {@link DecisionIndex} if it is a valid decision index.
|
|
419
|
+
* @param index - the number to convert
|
|
420
|
+
* @returns `Success` with the converted {@link DecisionIndex} if successful, or `Failure` with an
|
|
421
|
+
* error message if not.
|
|
422
|
+
* @public
|
|
423
|
+
*/
|
|
424
|
+
export function toDecisionIndex(index) {
|
|
425
|
+
/* c8 ignore next 3 - coverage is having a bad day */
|
|
426
|
+
if (!isValidDecisionIndex(index)) {
|
|
427
|
+
return fail(`${index}: invalid decision index`);
|
|
428
|
+
}
|
|
429
|
+
return succeed(index);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Determines whether a string is a valid {@link ContextQualifierToken | context qualifier token}.
|
|
433
|
+
* A context qualifier token has the format:
|
|
434
|
+
* `<qualifierName>=<value>` or `<value>`
|
|
435
|
+
* Context qualifier tokens allow broader character set including commas for comma-separated values.
|
|
436
|
+
* @param token - the string to validate
|
|
437
|
+
* @returns `true` if the string is a valid context qualifier token, `false` otherwise.
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
export function isValidContextQualifierToken(token) {
|
|
441
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
442
|
+
if (token === '') {
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
return contextToken.test(token);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Determines whether a string is a valid context token.
|
|
449
|
+
* Context tokens are pipe-separated lists of context qualifier tokens.
|
|
450
|
+
* @param token - the string to validate.
|
|
451
|
+
* @returns `true` if the string is a valid context token, `false` otherwise.
|
|
452
|
+
* @public
|
|
453
|
+
*/
|
|
454
|
+
export function isValidContextToken(token) {
|
|
455
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
456
|
+
if (token === '') {
|
|
457
|
+
return true;
|
|
458
|
+
}
|
|
459
|
+
const parts = token.split('|').map((part) => part.trim());
|
|
460
|
+
return parts.every((part) => part !== '' && isValidContextQualifierToken(part));
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Converts a string to a {@link ContextQualifierToken} if it is a valid context qualifier token.
|
|
464
|
+
* @param token - the string to convert
|
|
465
|
+
* @returns `Success` with the converted {@link ContextQualifierToken} if successful, or `Failure` with an
|
|
466
|
+
* error message if not.
|
|
467
|
+
* @public
|
|
468
|
+
*/
|
|
469
|
+
export function toContextQualifierToken(token) {
|
|
470
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
471
|
+
if (!isValidContextQualifierToken(token)) {
|
|
472
|
+
return fail(`${token}: invalid context qualifier token`);
|
|
473
|
+
}
|
|
474
|
+
return succeed(token);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Converts a string to a {@link ContextToken} if it is a valid context token.
|
|
478
|
+
* @param token - the string to convert
|
|
479
|
+
* @returns `Success` with the converted {@link ContextToken} if successful, or `Failure` with an
|
|
480
|
+
* error message if not.
|
|
481
|
+
* @public
|
|
482
|
+
*/
|
|
483
|
+
export function toContextToken(token) {
|
|
484
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
485
|
+
if (!isValidContextToken(token)) {
|
|
486
|
+
return fail(`${token}: invalid context token`);
|
|
487
|
+
}
|
|
488
|
+
return succeed(token);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Determines whether a string is a valid {@link QualifierDefaultValueToken | qualifier default value token}.
|
|
492
|
+
* A qualifier default value token has the format:
|
|
493
|
+
* `<qualifierName>=<value>` or `<qualifierName>=` (to remove default)
|
|
494
|
+
* Default values allow broader character set including commas for comma-separated values.
|
|
495
|
+
* @param token - the string to validate
|
|
496
|
+
* @returns `true` if the string is a valid qualifier default value token, `false` otherwise.
|
|
497
|
+
* @public
|
|
498
|
+
*/
|
|
499
|
+
export function isValidQualifierDefaultValueToken(token) {
|
|
500
|
+
return qualifierDefaultValueToken.test(token);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Determines whether a string is a valid qualifier default values token.
|
|
504
|
+
* Qualifier default values tokens are pipe-separated lists of qualifier default value tokens.
|
|
505
|
+
* @param token - the string to validate.
|
|
506
|
+
* @returns `true` if the string is a valid qualifier default values token, `false` otherwise.
|
|
507
|
+
* @public
|
|
508
|
+
*/
|
|
509
|
+
export function isValidQualifierDefaultValuesToken(token) {
|
|
510
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
511
|
+
if (token === '') {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
return qualifierDefaultValuesToken.test(token);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Converts a string to a {@link QualifierDefaultValueToken} if it is a valid qualifier default value token.
|
|
518
|
+
* @param token - the string to convert
|
|
519
|
+
* @returns `Success` with the converted {@link QualifierDefaultValueToken} if successful, or `Failure` with an
|
|
520
|
+
* error message if not.
|
|
521
|
+
* @public
|
|
522
|
+
*/
|
|
523
|
+
export function toQualifierDefaultValueToken(token) {
|
|
524
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
525
|
+
if (!isValidQualifierDefaultValueToken(token)) {
|
|
526
|
+
return fail(`${token}: invalid qualifier default value token`);
|
|
527
|
+
}
|
|
528
|
+
return succeed(token);
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Converts a string to a {@link QualifierDefaultValuesToken} if it is a valid qualifier default values token.
|
|
532
|
+
* @param token - the string to convert
|
|
533
|
+
* @returns `Success` with the converted {@link QualifierDefaultValuesToken} if successful, or `Failure` with an
|
|
534
|
+
* error message if not.
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
export function toQualifierDefaultValuesToken(token) {
|
|
538
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
539
|
+
if (!isValidQualifierDefaultValuesToken(token)) {
|
|
540
|
+
return fail(`${token}: invalid qualifier default values token`);
|
|
541
|
+
}
|
|
542
|
+
return succeed(token);
|
|
543
|
+
}
|
|
544
|
+
//# sourceMappingURL=conditions.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
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 './conditions';
|
|
23
|
+
export * from './resources';
|
|
24
|
+
import * as RegularExpressions from './regularExpressions';
|
|
25
|
+
export { RegularExpressions };
|
|
26
|
+
//# sourceMappingURL=index.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
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export const identifier = /^[a-zA-Z_][a-zA-Z0-9_\-]*$/;
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
*/
|
|
29
|
+
export const segmentedIdentifier = /^[a-zA-Z_][a-zA-Z0-9_\-]*(\.[a-zA-Z_][a-zA-Z0-9_\-]*)*$/;
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export const identifierList = /^[a-zA-Z_][a-zA-Z0-9_\-]*(,[a-zA-Z_][a-zA-Z0-9_\-]*)*$/;
|
|
34
|
+
/**
|
|
35
|
+
* The format of a {@link ConditionKey | condition key} is:
|
|
36
|
+
* <qualifierName>-[<value>][\@<priority>](<scoreAsDefault>) where operator is `matches`, or
|
|
37
|
+
* <qualifierName>-<operator>-[<value>][\@<priority>](<scoreAsDefault>)
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export const conditionKey = /^[a-zA-Z_][a-zA-Z0-9_\-]*(-matches)?-\[.*\](?:@[0-9]{1,4})?(?:\([01](?:\.[0-9]+)?\))?$/;
|
|
41
|
+
/**
|
|
42
|
+
* A {@link ConditionToken | condition token} is a comma-separated list of one or more
|
|
43
|
+
* condition specifiers, where a condition specifier has either the form
|
|
44
|
+
* `<qualifierName>=<value>` or `<value>`.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export const conditionToken = /^[a-zA-Z_][a-zA-Z0-9_\-]*(?:=[a-zA-Z0-9_\-]+)?$/;
|
|
48
|
+
/**
|
|
49
|
+
* A {@link ContextToken | context token} has the form `<qualifierName>=<value>` or `<value>`.
|
|
50
|
+
* Context tokens allow broader character set including commas for comma-separated values.
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export const contextToken = /^[a-zA-Z_][a-zA-Z0-9_\-]*(?:=[a-zA-Z0-9_\-,\s]+)?$/;
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export const conditionSetHash = /^[a-zA-Z0-9]{8}$/;
|
|
58
|
+
/**
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export const decisionKey = /^[a-zA-Z0-9]{8}(?:\+[a-zA-Z0-9]{8})*(?:\|[a-zA-Z0-9]{8})?$/;
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export const candidateValueKey = /^[a-zA-Z0-9]+$/;
|
|
66
|
+
/**
|
|
67
|
+
* A {@link QualifierDefaultValueToken | qualifier default value token} has the form
|
|
68
|
+
* `<qualifierName>=<value>` or `<qualifierName>=` (to remove default).
|
|
69
|
+
* Default values allow broader character set including commas for comma-separated values.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export const qualifierDefaultValueToken = /^[a-zA-Z_][a-zA-Z0-9_\-]*=(?:[a-zA-Z0-9_\-,\s]*)?$/;
|
|
73
|
+
/**
|
|
74
|
+
* A {@link QualifierDefaultValuesToken | qualifier default values token} is a
|
|
75
|
+
* pipe-separated list of one or more qualifier default value tokens.
|
|
76
|
+
* Uses "|" as separator to avoid conflicts with comma-separated values within defaults.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export const qualifierDefaultValuesToken = /^[a-zA-Z_][a-zA-Z0-9_\-]*=(?:[a-zA-Z0-9_\-,\s]*)?(?:\|[a-zA-Z_][a-zA-Z0-9_\-]*=(?:[a-zA-Z0-9_\-,\s]*)?)*$/;
|
|
80
|
+
/**
|
|
81
|
+
* @internal
|
|
82
|
+
*/
|
|
83
|
+
export const territoryCode = /^[a-zA-Z]{2}$/;
|
|
84
|
+
//# sourceMappingURL=regularExpressions.js.map
|