@fgv/ts-res 5.0.1-0 → 5.0.1-10
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/ts-res.d.ts +226 -15
- 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/common/helpers/resources.d.ts +1 -1
- package/lib/packlets/common/helpers/resources.js +3 -2
- package/lib/packlets/common/resources.d.ts +4 -0
- package/lib/packlets/common/validate/conditions.js +14 -14
- package/lib/packlets/common/validate/resources.js +7 -7
- package/lib/packlets/conditions/conditionSet.js +1 -1
- package/lib/packlets/config/common.js +1 -0
- package/lib/packlets/config/configInitFactory.js +1 -0
- package/lib/packlets/config/index.browser.d.ts +7 -0
- package/lib/packlets/config/index.browser.js +74 -0
- package/lib/packlets/config/systemConfiguration.js +1 -0
- package/lib/packlets/context/convert/decls.js +1 -1
- package/lib/packlets/import/importers/collectionImporter.js +1 -1
- 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/importers/jsonImporter.js +1 -1
- package/lib/packlets/import/index.browser.d.ts +7 -0
- package/lib/packlets/import/index.browser.js +74 -0
- package/lib/packlets/qualifier-types/helpers.js +5 -4
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +4 -4
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +4 -4
- package/lib/packlets/qualifier-types/literalQualifierType.js +1 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +7 -6
- package/lib/packlets/qualifier-types/qualifierType.d.ts +5 -5
- package/lib/packlets/qualifier-types/qualifierType.js +1 -0
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +4 -4
- package/lib/packlets/qualifier-types/territoryQualifierType.js +1 -1
- package/lib/packlets/resource-json/helpers.js +4 -0
- package/lib/packlets/resource-types/helpers.js +1 -0
- package/lib/packlets/resource-types/resourceType.js +1 -0
- package/lib/packlets/resources/candidateValue.js +1 -0
- package/lib/packlets/resources/candidateValueCollector.js +4 -2
- package/lib/packlets/resources/deltaGenerator.d.ts +189 -0
- package/lib/packlets/resources/deltaGenerator.js +342 -0
- package/lib/packlets/resources/index.d.ts +1 -0
- package/lib/packlets/resources/index.js +1 -0
- package/lib/packlets/resources/resourceBuilder.js +4 -0
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +4 -0
- package/lib/packlets/resources/resourceManagerBuilder.js +12 -0
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +4 -0
- package/lib/packlets/runtime/compiledResourceCollection.js +7 -0
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +4 -3
- package/lib/packlets/runtime/iResourceManager.d.ts +4 -0
- package/lib/packlets/runtime/resource-tree/resourceTreeChildren.js +3 -0
- package/lib/packlets/runtime/resourceResolver.d.ts +5 -1
- package/lib/packlets/runtime/resourceResolver.js +8 -4
- package/lib/packlets/runtime/resourceTreeResolver.js +2 -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 +34 -20
|
@@ -316,7 +316,7 @@ function toQualifierTypeIndex(index) {
|
|
|
316
316
|
function toQualifierMatchScore(value) {
|
|
317
317
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
318
318
|
if (!isValidQualifierMatchScore(value)) {
|
|
319
|
-
return (0, ts_utils_1.fail)(`${value}:
|
|
319
|
+
return (0, ts_utils_1.fail)(`${value}: invalid match score`);
|
|
320
320
|
}
|
|
321
321
|
return (0, ts_utils_1.succeed)(value);
|
|
322
322
|
}
|
|
@@ -330,7 +330,7 @@ function toQualifierMatchScore(value) {
|
|
|
330
330
|
function toConditionPriority(priority) {
|
|
331
331
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
332
332
|
if (!isValidConditionPriority(priority)) {
|
|
333
|
-
return (0, ts_utils_1.fail)(`${priority}:
|
|
333
|
+
return (0, ts_utils_1.fail)(`${priority}: invalid priority`);
|
|
334
334
|
}
|
|
335
335
|
return (0, ts_utils_1.succeed)(priority);
|
|
336
336
|
}
|
|
@@ -344,7 +344,7 @@ function toConditionPriority(priority) {
|
|
|
344
344
|
function toConditionIndex(index) {
|
|
345
345
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
346
346
|
if (!isValidConditionIndex(index)) {
|
|
347
|
-
return (0, ts_utils_1.fail)(`${index}:
|
|
347
|
+
return (0, ts_utils_1.fail)(`${index}: invalid condition index`);
|
|
348
348
|
}
|
|
349
349
|
return (0, ts_utils_1.succeed)(index);
|
|
350
350
|
}
|
|
@@ -357,7 +357,7 @@ function toConditionIndex(index) {
|
|
|
357
357
|
*/
|
|
358
358
|
function toConditionOperator(operator) {
|
|
359
359
|
if (!isValidConditionOperator(operator)) {
|
|
360
|
-
return (0, ts_utils_1.fail)(`${operator}:
|
|
360
|
+
return (0, ts_utils_1.fail)(`${operator}: invalid condition operator`);
|
|
361
361
|
}
|
|
362
362
|
return (0, ts_utils_1.succeed)(operator);
|
|
363
363
|
}
|
|
@@ -371,7 +371,7 @@ function toConditionOperator(operator) {
|
|
|
371
371
|
function toConditionKey(key) {
|
|
372
372
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
373
373
|
if (!isValidConditionKey(key)) {
|
|
374
|
-
return (0, ts_utils_1.fail)(`${key}:
|
|
374
|
+
return (0, ts_utils_1.fail)(`${key}: invalid condition key`);
|
|
375
375
|
}
|
|
376
376
|
return (0, ts_utils_1.succeed)(key);
|
|
377
377
|
}
|
|
@@ -385,7 +385,7 @@ function toConditionKey(key) {
|
|
|
385
385
|
function toConditionToken(token) {
|
|
386
386
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
387
387
|
if (!isValidConditionToken(token)) {
|
|
388
|
-
return (0, ts_utils_1.fail)(`${token}:
|
|
388
|
+
return (0, ts_utils_1.fail)(`${token}: invalid condition token`);
|
|
389
389
|
}
|
|
390
390
|
return (0, ts_utils_1.succeed)(token);
|
|
391
391
|
}
|
|
@@ -399,7 +399,7 @@ function toConditionToken(token) {
|
|
|
399
399
|
function toConditionSetIndex(index) {
|
|
400
400
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
401
401
|
if (!isValidConditionSetIndex(index)) {
|
|
402
|
-
return (0, ts_utils_1.fail)(`${index}:
|
|
402
|
+
return (0, ts_utils_1.fail)(`${index}: invalid condition set index`);
|
|
403
403
|
}
|
|
404
404
|
return (0, ts_utils_1.succeed)(index);
|
|
405
405
|
}
|
|
@@ -413,7 +413,7 @@ function toConditionSetIndex(index) {
|
|
|
413
413
|
function toConditionSetKey(key) {
|
|
414
414
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
415
415
|
if (!isValidConditionSetKey(key)) {
|
|
416
|
-
return (0, ts_utils_1.fail)(`${key}:
|
|
416
|
+
return (0, ts_utils_1.fail)(`${key}: invalid condition set key`);
|
|
417
417
|
}
|
|
418
418
|
return (0, ts_utils_1.succeed)(key);
|
|
419
419
|
}
|
|
@@ -427,7 +427,7 @@ function toConditionSetKey(key) {
|
|
|
427
427
|
function toConditionSetToken(token) {
|
|
428
428
|
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
429
429
|
if (!isValidConditionSetToken(token)) {
|
|
430
|
-
return (0, ts_utils_1.fail)(`${token}:
|
|
430
|
+
return (0, ts_utils_1.fail)(`${token}: invalid condition set token`);
|
|
431
431
|
}
|
|
432
432
|
return (0, ts_utils_1.succeed)(token);
|
|
433
433
|
}
|
|
@@ -440,7 +440,7 @@ function toConditionSetToken(token) {
|
|
|
440
440
|
*/
|
|
441
441
|
function toConditionSetHash(hash) {
|
|
442
442
|
if (!isValidConditionSetHash(hash)) {
|
|
443
|
-
return (0, ts_utils_1.fail)(`${hash}:
|
|
443
|
+
return (0, ts_utils_1.fail)(`${hash}: invalid condition set hash`);
|
|
444
444
|
}
|
|
445
445
|
return (0, ts_utils_1.succeed)(hash);
|
|
446
446
|
}
|
|
@@ -454,7 +454,7 @@ function toConditionSetHash(hash) {
|
|
|
454
454
|
function toDecisionKey(key) {
|
|
455
455
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
456
456
|
if (!isValidDecisionKey(key)) {
|
|
457
|
-
return (0, ts_utils_1.fail)(`${key}:
|
|
457
|
+
return (0, ts_utils_1.fail)(`${key}: invalid decision key`);
|
|
458
458
|
}
|
|
459
459
|
return (0, ts_utils_1.succeed)(key);
|
|
460
460
|
}
|
|
@@ -468,7 +468,7 @@ function toDecisionKey(key) {
|
|
|
468
468
|
function toDecisionIndex(index) {
|
|
469
469
|
/* c8 ignore next 3 - coverage is having a bad day */
|
|
470
470
|
if (!isValidDecisionIndex(index)) {
|
|
471
|
-
return (0, ts_utils_1.fail)(`${index}:
|
|
471
|
+
return (0, ts_utils_1.fail)(`${index}: invalid decision index`);
|
|
472
472
|
}
|
|
473
473
|
return (0, ts_utils_1.succeed)(index);
|
|
474
474
|
}
|
|
@@ -513,7 +513,7 @@ function isValidContextToken(token) {
|
|
|
513
513
|
function toContextQualifierToken(token) {
|
|
514
514
|
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
515
515
|
if (!isValidContextQualifierToken(token)) {
|
|
516
|
-
return (0, ts_utils_1.fail)(`${token}:
|
|
516
|
+
return (0, ts_utils_1.fail)(`${token}: invalid context qualifier token`);
|
|
517
517
|
}
|
|
518
518
|
return (0, ts_utils_1.succeed)(token);
|
|
519
519
|
}
|
|
@@ -527,7 +527,7 @@ function toContextQualifierToken(token) {
|
|
|
527
527
|
function toContextToken(token) {
|
|
528
528
|
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
529
529
|
if (!isValidContextToken(token)) {
|
|
530
|
-
return (0, ts_utils_1.fail)(`${token}:
|
|
530
|
+
return (0, ts_utils_1.fail)(`${token}: invalid context token`);
|
|
531
531
|
}
|
|
532
532
|
return (0, ts_utils_1.succeed)(token);
|
|
533
533
|
}
|
|
@@ -119,7 +119,7 @@ function isValidCandidateValueKey(key) {
|
|
|
119
119
|
function toResourceName(name) {
|
|
120
120
|
/* c8 ignore next 3 - coverage having issues */
|
|
121
121
|
if (!isValidResourceName(name)) {
|
|
122
|
-
return (0, ts_utils_1.fail)(`${name}:
|
|
122
|
+
return (0, ts_utils_1.fail)(`${name}: invalid resource name.`);
|
|
123
123
|
}
|
|
124
124
|
return (0, ts_utils_1.succeed)(name);
|
|
125
125
|
}
|
|
@@ -134,7 +134,7 @@ function toResourceName(name) {
|
|
|
134
134
|
function toResourceId(id) {
|
|
135
135
|
/* c8 ignore next 3 - defensive coding: resource ID validation should prevent invalid IDs */
|
|
136
136
|
if (!isValidResourceId(id)) {
|
|
137
|
-
return (0, ts_utils_1.fail)(`${id}:
|
|
137
|
+
return (0, ts_utils_1.fail)(`${id}: invalid resource ID.`);
|
|
138
138
|
}
|
|
139
139
|
return (0, ts_utils_1.succeed)(id);
|
|
140
140
|
}
|
|
@@ -159,7 +159,7 @@ function toOptionalResourceId(id) {
|
|
|
159
159
|
*/
|
|
160
160
|
function toResourceIndex(index) {
|
|
161
161
|
if (!isValidResourceIndex(index)) {
|
|
162
|
-
return (0, ts_utils_1.fail)(`${index}:
|
|
162
|
+
return (0, ts_utils_1.fail)(`${index}: invalid resource index.`);
|
|
163
163
|
}
|
|
164
164
|
return (0, ts_utils_1.succeed)(index);
|
|
165
165
|
}
|
|
@@ -174,7 +174,7 @@ function toResourceIndex(index) {
|
|
|
174
174
|
function toResourceTypeName(name) {
|
|
175
175
|
/* c8 ignore next 3 - coverage having issues */
|
|
176
176
|
if (!isValidResourceTypeName(name)) {
|
|
177
|
-
return (0, ts_utils_1.fail)(`${name}:
|
|
177
|
+
return (0, ts_utils_1.fail)(`${name}: invalid resource type name.`);
|
|
178
178
|
}
|
|
179
179
|
return (0, ts_utils_1.succeed)(name);
|
|
180
180
|
}
|
|
@@ -189,7 +189,7 @@ function toResourceTypeName(name) {
|
|
|
189
189
|
function toResourceTypeIndex(index) {
|
|
190
190
|
/* c8 ignore next 3 - coverage having issues */
|
|
191
191
|
if (!isValidResourceTypeIndex(index)) {
|
|
192
|
-
return (0, ts_utils_1.fail)(`${index}:
|
|
192
|
+
return (0, ts_utils_1.fail)(`${index}: invalid resource type index.`);
|
|
193
193
|
}
|
|
194
194
|
return (0, ts_utils_1.succeed)(index);
|
|
195
195
|
}
|
|
@@ -204,7 +204,7 @@ function toResourceTypeIndex(index) {
|
|
|
204
204
|
function toCandidateValueKey(key) {
|
|
205
205
|
/* c8 ignore next 3 - coverage having issues */
|
|
206
206
|
if (!isValidCandidateValueKey(key)) {
|
|
207
|
-
return (0, ts_utils_1.fail)(`${key}:
|
|
207
|
+
return (0, ts_utils_1.fail)(`${key}: invalid candidate value key.`);
|
|
208
208
|
}
|
|
209
209
|
return (0, ts_utils_1.succeed)(key);
|
|
210
210
|
}
|
|
@@ -219,7 +219,7 @@ function toCandidateValueKey(key) {
|
|
|
219
219
|
function toCandidateValueIndex(index) {
|
|
220
220
|
/* c8 ignore next 3 - coverage having issues */
|
|
221
221
|
if (!isValidCandidateValueIndex(index)) {
|
|
222
|
-
return (0, ts_utils_1.fail)(`${index}:
|
|
222
|
+
return (0, ts_utils_1.fail)(`${index}: invalid candidate value index.`);
|
|
223
223
|
}
|
|
224
224
|
return (0, ts_utils_1.succeed)(index);
|
|
225
225
|
}
|
|
@@ -185,9 +185,9 @@ class ConditionSet {
|
|
|
185
185
|
const conditions = Object.entries(conditionSet).map(([qualifierName, value]) => {
|
|
186
186
|
if (typeof value === 'string') {
|
|
187
187
|
return { qualifierName, value };
|
|
188
|
+
/* c8 ignore next 3 - edge case */
|
|
188
189
|
}
|
|
189
190
|
else {
|
|
190
|
-
/* c8 ignore next 1 - edge case: object spread pattern rarely used */
|
|
191
191
|
return Object.assign({ qualifierName }, value);
|
|
192
192
|
}
|
|
193
193
|
});
|
|
@@ -123,6 +123,7 @@ class BuiltInQualifierTypeFactory {
|
|
|
123
123
|
if (QualifierTypes.Config.isSystemQualifierTypeConfig(config)) {
|
|
124
124
|
return QualifierTypes.createQualifierTypeFromSystemConfig(config);
|
|
125
125
|
}
|
|
126
|
+
/* c8 ignore next 2 - functional code tested but coverage intermittently missed */
|
|
126
127
|
return (0, ts_utils_1.fail)(`${config.name}: unknown built-in qualifier type (${config.systemType})`);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as Model from './json';
|
|
2
|
+
import * as Convert from './convert';
|
|
3
|
+
export * from './configInitFactory';
|
|
4
|
+
export * from './common';
|
|
5
|
+
export { SystemConfiguration } from './systemConfiguration';
|
|
6
|
+
export { Model, Convert };
|
|
7
|
+
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
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
|
+
})();
|
|
56
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
57
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
58
|
+
};
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.Convert = exports.Model = exports.SystemConfiguration = void 0;
|
|
61
|
+
// Browser-safe config exports - excludes Node.js filesystem dependencies
|
|
62
|
+
const Model = __importStar(require("./json"));
|
|
63
|
+
exports.Model = Model;
|
|
64
|
+
const Convert = __importStar(require("./convert"));
|
|
65
|
+
exports.Convert = Convert;
|
|
66
|
+
// Export all modules
|
|
67
|
+
__exportStar(require("./configInitFactory"), exports);
|
|
68
|
+
__exportStar(require("./common"), exports);
|
|
69
|
+
// Export SystemConfiguration class but not as wildcard to avoid pulling in loadFromFile
|
|
70
|
+
var systemConfiguration_1 = require("./systemConfiguration");
|
|
71
|
+
Object.defineProperty(exports, "SystemConfiguration", { enumerable: true, get: function () { return systemConfiguration_1.SystemConfiguration; } });
|
|
72
|
+
// Excluded from browser:
|
|
73
|
+
// - SystemConfiguration.loadFromFile() method (requires Node.js fs via JsonFile)
|
|
74
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -122,6 +122,7 @@ class SystemConfiguration {
|
|
|
122
122
|
*/
|
|
123
123
|
static create(config, initParams) {
|
|
124
124
|
if (initParams === null || initParams === void 0 ? void 0 : initParams.qualifierDefaultValues) {
|
|
125
|
+
/* c8 ignore next 9 - functional code tested but coverage intermittently missed */
|
|
125
126
|
return updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues).onSuccess((updatedConfig) => (0, ts_utils_1.captureResult)(() => new SystemConfiguration(updatedConfig, (0, ts_utils_1.omit)(initParams, ['qualifierDefaultValues']))));
|
|
126
127
|
}
|
|
127
128
|
return (0, ts_utils_1.captureResult)(() => new SystemConfiguration(config, initParams));
|
|
@@ -67,8 +67,8 @@ exports.validatedContextQualifierValueDecl = ts_utils_1.Converters.generic((from
|
|
|
67
67
|
* @public
|
|
68
68
|
*/
|
|
69
69
|
exports.validatedContextDecl = ts_utils_1.Converters.generic((from, __self, context) => {
|
|
70
|
+
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
70
71
|
if (!context) {
|
|
71
|
-
/* c8 ignore next 2 - functional code path tested but coverage intermittently missed */
|
|
72
72
|
return ts_utils_1.Failure.with('validatedContextDecl converter requires a context');
|
|
73
73
|
}
|
|
74
74
|
return exports.contextDecl.convert(from).onSuccess((decl) => {
|
|
@@ -91,7 +91,7 @@ class CollectionImporter {
|
|
|
91
91
|
if (!(0, importable_1.isImportable)(item) || (item.type !== 'resourceCollection' && item.type !== 'resourceTree')) {
|
|
92
92
|
/* c8 ignore next 1 - defense in depth */
|
|
93
93
|
const name = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown';
|
|
94
|
-
return (0, ts_utils_1.failWithDetail)(`${name}:
|
|
94
|
+
return (0, ts_utils_1.failWithDetail)(`${name}: invalid resource collection importable (${item.type})`, 'skipped');
|
|
95
95
|
}
|
|
96
96
|
const container = item.type === 'resourceCollection' ? item.collection : item.tree;
|
|
97
97
|
return importContext_1.ImportContext.forContainerImport(container.context, item.context)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
35
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
// Browser-safe importers - excludes Node.js filesystem dependencies
|
|
39
|
+
__exportStar(require("./importer"), exports);
|
|
40
|
+
__exportStar(require("./collectionImporter"), exports);
|
|
41
|
+
__exportStar(require("./jsonImporter"), exports);
|
|
42
|
+
// Excluded from browser:
|
|
43
|
+
// - fsItemImporter (processes filesystem items)
|
|
44
|
+
// - pathImporter (requires Node.js fs via FileTree.forFilesystem())
|
|
45
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -89,7 +89,7 @@ class JsonImporter {
|
|
|
89
89
|
if (!(0, importable_1.isImportable)(item) || item.type !== 'json') {
|
|
90
90
|
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
91
91
|
const name = (_b = (_a = item.context) === null || _a === void 0 ? void 0 : _a.baseId) !== null && _b !== void 0 ? _b : 'unknown';
|
|
92
|
-
return (0, ts_utils_1.failWithDetail)(`${name}:
|
|
92
|
+
return (0, ts_utils_1.failWithDetail)(`${name}: invalid JSON importable (${item.type})`, 'skipped');
|
|
93
93
|
}
|
|
94
94
|
return (this._tryImportResourceCollection(item)
|
|
95
95
|
.onFailure(() => this._tryImportResourceTree(item))
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2025 Erik Fortune
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
* copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
* SOFTWARE.
|
|
22
|
+
*/
|
|
23
|
+
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
40
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
41
|
+
};
|
|
42
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
43
|
+
var ownKeys = function(o) {
|
|
44
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
45
|
+
var ar = [];
|
|
46
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
47
|
+
return ar;
|
|
48
|
+
};
|
|
49
|
+
return ownKeys(o);
|
|
50
|
+
};
|
|
51
|
+
return function (mod) {
|
|
52
|
+
if (mod && mod.__esModule) return mod;
|
|
53
|
+
var result = {};
|
|
54
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
55
|
+
__setModuleDefault(result, mod);
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.Importers = exports.FsItem = void 0;
|
|
61
|
+
// Browser-safe import exports - excludes Node.js filesystem dependencies
|
|
62
|
+
__exportStar(require("./importContext"), exports);
|
|
63
|
+
__exportStar(require("./importable"), exports);
|
|
64
|
+
__exportStar(require("./importManager"), exports);
|
|
65
|
+
// Export FsItem class (browser-safe for in-memory FileTree usage)
|
|
66
|
+
var fsItem_1 = require("./fsItem");
|
|
67
|
+
Object.defineProperty(exports, "FsItem", { enumerable: true, get: function () { return fsItem_1.FsItem; } });
|
|
68
|
+
// Use browser-safe importers index
|
|
69
|
+
const Importers = __importStar(require("./importers/index.browser"));
|
|
70
|
+
exports.Importers = Importers;
|
|
71
|
+
// Excluded from browser:
|
|
72
|
+
// - FsItem.createForPath() static method (requires Node.js fs via FileTree.forFilesystem())
|
|
73
|
+
// - PathImporter and FsItemImporter (via importers/index.browser.ts)
|
|
74
|
+
//# sourceMappingURL=index.browser.js.map
|
|
@@ -88,9 +88,9 @@ function createQualifierTypeFromConfig(typeConfig) {
|
|
|
88
88
|
return Config.Convert.literalQualifierTypeConfig
|
|
89
89
|
.convert(childConfig)
|
|
90
90
|
.onSuccess((configuration) => literalQualifierType_1.LiteralQualifierType.createFromConfig(Object.assign(Object.assign({}, typeConfig), { configuration })));
|
|
91
|
-
default:
|
|
92
|
-
return (0, ts_utils_1.fail)(`Unknown qualifier type: ${typeConfig.systemType}`);
|
|
93
91
|
}
|
|
92
|
+
/* c8 ignore next 1 - defense in depth */
|
|
93
|
+
return (0, ts_utils_1.fail)(`Unknown qualifier type: ${typeConfig.systemType}`);
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* Creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from a system configuration object.
|
|
@@ -111,8 +111,9 @@ function createQualifierTypeFromSystemConfig(typeConfig) {
|
|
|
111
111
|
return territoryQualifierType_1.TerritoryQualifierType.createFromConfig(typeConfig);
|
|
112
112
|
case 'literal':
|
|
113
113
|
return literalQualifierType_1.LiteralQualifierType.createFromConfig(typeConfig);
|
|
114
|
-
default:
|
|
115
|
-
return (0, ts_utils_1.fail)(`${systemType}: Unknown system qualifier type.`);
|
|
116
114
|
}
|
|
115
|
+
/* c8 ignore next 3 - should not happen */
|
|
116
|
+
// @ts-expect-error
|
|
117
|
+
return (0, ts_utils_1.fail)(`${systemType}: Unknown system qualifier type.`);
|
|
117
118
|
}
|
|
118
119
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -2,7 +2,7 @@ import { Result } from '@fgv/ts-utils';
|
|
|
2
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 {
|
|
5
|
+
import { JsonCompatibleType } from '@fgv/ts-json-base';
|
|
6
6
|
/**
|
|
7
7
|
* Interface defining the parameters that can be used to create a new
|
|
8
8
|
* {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.
|
|
@@ -25,7 +25,7 @@ export interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTy
|
|
|
25
25
|
* Accepts a list of language tags in the context by default.
|
|
26
26
|
* @public
|
|
27
27
|
*/
|
|
28
|
-
export declare class LanguageQualifierType extends QualifierType<
|
|
28
|
+
export declare class LanguageQualifierType extends QualifierType<JsonCompatibleType<Config.ILanguageQualifierTypeConfig>> {
|
|
29
29
|
/**
|
|
30
30
|
* {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
|
|
31
31
|
*/
|
|
@@ -68,11 +68,11 @@ export declare class LanguageQualifierType extends QualifierType<JsonCompatible<
|
|
|
68
68
|
/**
|
|
69
69
|
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
70
70
|
*/
|
|
71
|
-
getConfigurationJson(): Result<
|
|
71
|
+
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemLanguageQualifierTypeConfig>>;
|
|
72
72
|
/**
|
|
73
73
|
* {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
74
74
|
*/
|
|
75
|
-
validateConfigurationJson(from: unknown): Result<
|
|
75
|
+
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemLanguageQualifierTypeConfig>>;
|
|
76
76
|
/**
|
|
77
77
|
* Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
|
|
78
78
|
* for this qualifier type.
|
|
@@ -3,7 +3,7 @@ import { ConditionOperator, QualifierConditionValue, QualifierContextValue, Qual
|
|
|
3
3
|
import { QualifierType } from './qualifierType';
|
|
4
4
|
import { LiteralValueHierarchy } from './literalValueHierarchy';
|
|
5
5
|
import * as Config from './config';
|
|
6
|
-
import {
|
|
6
|
+
import { JsonCompatibleType } from '@fgv/ts-json-base';
|
|
7
7
|
/**
|
|
8
8
|
* Interface defining the parameters that can be used to create a new
|
|
9
9
|
* {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
|
|
@@ -44,7 +44,7 @@ export interface ILiteralQualifierTypeCreateParams {
|
|
|
44
44
|
* optionally case-sensitive or matching against an ordered list of values at runtime.
|
|
45
45
|
* @public
|
|
46
46
|
*/
|
|
47
|
-
export declare class LiteralQualifierType extends QualifierType<
|
|
47
|
+
export declare class LiteralQualifierType extends QualifierType<JsonCompatibleType<Config.ILiteralQualifierTypeConfig>> {
|
|
48
48
|
/**
|
|
49
49
|
* {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
|
|
50
50
|
*/
|
|
@@ -93,11 +93,11 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatible<C
|
|
|
93
93
|
/**
|
|
94
94
|
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
95
95
|
*/
|
|
96
|
-
getConfigurationJson(): Result<
|
|
96
|
+
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>>;
|
|
97
97
|
/**
|
|
98
98
|
* {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
99
99
|
*/
|
|
100
|
-
validateConfigurationJson(from: unknown): Result<
|
|
100
|
+
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>>;
|
|
101
101
|
/**
|
|
102
102
|
* Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
|
|
103
103
|
* for this qualifier type.
|
|
@@ -230,7 +230,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
230
230
|
static toLiteralConditionValue(from) {
|
|
231
231
|
return LiteralQualifierType.isValidLiteralConditionValue(from)
|
|
232
232
|
? (0, ts_utils_1.succeed)(from)
|
|
233
|
-
: (0, ts_utils_1.fail)(`${from}:
|
|
233
|
+
: (0, ts_utils_1.fail)(`${from}: invalid literal condition value.`);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
exports.LiteralQualifierType = LiteralQualifierType;
|
|
@@ -102,7 +102,7 @@ class LiteralValueHierarchy {
|
|
|
102
102
|
if (ancestors.isSuccess()) {
|
|
103
103
|
return ancestors.value.includes(possibleAncestor);
|
|
104
104
|
}
|
|
105
|
-
/* c8 ignore next
|
|
105
|
+
/* c8 ignore next 2 - edge case: ancestor validation fallback */
|
|
106
106
|
return false;
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
@@ -133,11 +133,11 @@ class LiteralValueHierarchy {
|
|
|
133
133
|
// For open hierarchies, skip validation and allow any values
|
|
134
134
|
if (!this.isOpenValues) {
|
|
135
135
|
// Validate that both condition and context exist in the hierarchy
|
|
136
|
-
/* c8 ignore next
|
|
136
|
+
/* c8 ignore next 3 - functional error case tested but coverage intermittently missed */
|
|
137
137
|
if (!this.values.has(condition)) {
|
|
138
138
|
return common_1.NoMatch;
|
|
139
139
|
}
|
|
140
|
-
/* c8 ignore next
|
|
140
|
+
/* c8 ignore next 3 - functional error case tested but coverage intermittently missed */
|
|
141
141
|
if (!this.values.has(context)) {
|
|
142
142
|
return common_1.NoMatch;
|
|
143
143
|
}
|
|
@@ -168,6 +168,7 @@ class LiteralValueHierarchy {
|
|
|
168
168
|
var _a;
|
|
169
169
|
const errors = new ts_utils_1.MessageAggregator();
|
|
170
170
|
const values = params.values;
|
|
171
|
+
/* c8 ignore next 1 - defense in depth */
|
|
171
172
|
const hierarchy = (_a = params.hierarchy) !== null && _a !== void 0 ? _a : {};
|
|
172
173
|
// If no values are provided, collect all values from the hierarchy
|
|
173
174
|
let allValues;
|
|
@@ -191,7 +192,7 @@ class LiteralValueHierarchy {
|
|
|
191
192
|
}
|
|
192
193
|
const parent = valueMap.get(parentName);
|
|
193
194
|
if (!parent) {
|
|
194
|
-
errors.addMessage(`${valueName}: parent ${parentName} is
|
|
195
|
+
errors.addMessage(`${valueName}: parent ${parentName} is invalid literal value.`);
|
|
195
196
|
continue;
|
|
196
197
|
}
|
|
197
198
|
let ancestor = parent.parent;
|
|
@@ -202,14 +203,14 @@ class LiteralValueHierarchy {
|
|
|
202
203
|
ancestors.push(ancestor.name);
|
|
203
204
|
/* c8 ignore next 1 - defensive coding: ancestor.parent === value is very difficult to reach */
|
|
204
205
|
if (ancestor.parent === parent || ancestor.parent === value) {
|
|
205
|
-
/* c8 ignore next
|
|
206
|
+
/* c8 ignore next 4 - defensive coding: circular reference error reporting intermittently missed */
|
|
206
207
|
errors.addMessage(`${valueName}: Circular reference detected: ${ancestors.join('->')}`);
|
|
207
208
|
circular = true;
|
|
208
209
|
break;
|
|
209
210
|
}
|
|
210
211
|
ancestor = ancestor.parent;
|
|
211
212
|
}
|
|
212
|
-
/* c8 ignore next
|
|
213
|
+
/* c8 ignore next 3 - defensive coding: circular reference handling intermittently missed */
|
|
213
214
|
if (circular) {
|
|
214
215
|
continue;
|
|
215
216
|
}
|