@fgv/ts-res 5.0.0-22 → 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.
- package/README.md +665 -44
- package/dist/ts-res.d.ts +421 -19
- package/lib/packlets/common/convert.d.ts +10 -0
- package/lib/packlets/common/convert.js +11 -1
- package/lib/packlets/common/resources.d.ts +14 -0
- package/lib/packlets/common/validate/regularExpressions.d.ts +4 -0
- package/lib/packlets/common/validate/regularExpressions.js +5 -1
- package/lib/packlets/common/validate/resources.d.ts +35 -1
- package/lib/packlets/common/validate/resources.js +54 -0
- package/lib/packlets/config/convert.js +1 -1
- package/lib/packlets/config/json.d.ts +1 -1
- package/lib/packlets/qualifier-types/config/convert.d.ts +22 -1
- package/lib/packlets/qualifier-types/config/convert.js +67 -2
- package/lib/packlets/qualifier-types/config/json.d.ts +11 -2
- package/lib/packlets/qualifier-types/helpers.d.ts +1 -2
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +27 -1
- package/lib/packlets/qualifier-types/languageQualifierType.js +75 -0
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +30 -4
- package/lib/packlets/qualifier-types/literalQualifierType.js +77 -0
- package/lib/packlets/qualifier-types/literalValueHierarchy.d.ts +6 -10
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +10 -0
- package/lib/packlets/qualifier-types/qualifierType.d.ts +28 -0
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +28 -4
- package/lib/packlets/qualifier-types/territoryQualifierType.js +77 -0
- package/lib/packlets/resource-json/compiled/convert.js +2 -1
- package/lib/packlets/resource-json/compiled/json.d.ts +6 -2
- package/lib/packlets/resource-types/jsonResourceType.d.ts +4 -0
- package/lib/packlets/resource-types/jsonResourceType.js +4 -0
- package/lib/packlets/resource-types/resourceType.d.ts +4 -0
- package/lib/packlets/resources/candidateValue.d.ts +92 -0
- package/lib/packlets/resources/candidateValue.js +128 -0
- package/lib/packlets/resources/candidateValueCollector.d.ts +55 -0
- package/lib/packlets/resources/candidateValueCollector.js +96 -0
- package/lib/packlets/resources/index.d.ts +2 -0
- package/lib/packlets/resources/index.js +2 -0
- package/lib/packlets/resources/resource.js +2 -2
- package/lib/packlets/resources/resourceBuilder.d.ts +6 -0
- package/lib/packlets/resources/resourceBuilder.js +3 -1
- package/lib/packlets/resources/resourceCandidate.d.ts +10 -1
- package/lib/packlets/resources/resourceCandidate.js +11 -5
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +7 -0
- package/lib/packlets/resources/resourceManagerBuilder.js +13 -6
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +20 -8
- package/lib/packlets/runtime/compiledResourceCollection.js +25 -4
- package/lib/packlets/runtime/resource-tree/common.d.ts +1 -1
- package/lib/test/unit/qualifier-types/testQualifierType.d.ts +4 -0
- package/lib/test/unit/qualifier-types/testQualifierType.js +24 -0
- package/lib/test/unit/resource-types/testDerivedResourceType.d.ts +1 -0
- package/lib/test/unit/resource-types/testDerivedResourceType.js +3 -0
- package/lib/test/unit/resources/candidateValue.test.d.ts +2 -0
- package/lib/test/unit/resources/candidateValueCollector.test.d.ts +2 -0
- package/package.json +7 -7
- package/src/index.ts +0 -75
- package/src/packlets/bundle/bundleBuilder.ts +0 -159
- package/src/packlets/bundle/bundleLoader.ts +0 -157
- package/src/packlets/bundle/bundleNormalizer.ts +0 -173
- package/src/packlets/bundle/bundleUtils.ts +0 -142
- package/src/packlets/bundle/convert.ts +0 -87
- package/src/packlets/bundle/index.ts +0 -52
- package/src/packlets/bundle/model.ts +0 -138
- package/src/packlets/common/conditions.ts +0 -226
- package/src/packlets/common/convert.ts +0 -184
- package/src/packlets/common/helpers/conditions.ts +0 -84
- package/src/packlets/common/helpers/context.ts +0 -88
- package/src/packlets/common/helpers/index.ts +0 -26
- package/src/packlets/common/helpers/qualifierDefaultValues.ts +0 -91
- package/src/packlets/common/helpers/resources.ts +0 -96
- package/src/packlets/common/index.ts +0 -30
- package/src/packlets/common/resources.ts +0 -105
- package/src/packlets/common/validate/conditions.ts +0 -595
- package/src/packlets/common/validate/index.ts +0 -27
- package/src/packlets/common/validate/regularExpressions.ts +0 -92
- package/src/packlets/common/validate/resources.ts +0 -170
- package/src/packlets/conditions/condition.ts +0 -351
- package/src/packlets/conditions/conditionCollector.ts +0 -103
- package/src/packlets/conditions/conditionDecls.ts +0 -50
- package/src/packlets/conditions/conditionSet.ts +0 -318
- package/src/packlets/conditions/conditionSetCollector.ts +0 -127
- package/src/packlets/conditions/conditionSetDecls.ts +0 -41
- package/src/packlets/conditions/conditionToken.ts +0 -180
- package/src/packlets/conditions/convert/conditionSetDecls.ts +0 -72
- package/src/packlets/conditions/convert/decls.ts +0 -95
- package/src/packlets/conditions/convert/index.ts +0 -24
- package/src/packlets/conditions/index.ts +0 -33
- package/src/packlets/config/common.ts +0 -107
- package/src/packlets/config/configInitFactory.ts +0 -142
- package/src/packlets/config/convert.ts +0 -61
- package/src/packlets/config/index.ts +0 -30
- package/src/packlets/config/json.ts +0 -43
- package/src/packlets/config/predefined/default.ts +0 -150
- package/src/packlets/config/predefined/extended.ts +0 -198
- package/src/packlets/config/predefined/index.ts +0 -26
- package/src/packlets/config/systemConfiguration.ts +0 -217
- package/src/packlets/context/contextDecls.ts +0 -76
- package/src/packlets/context/contextToken.ts +0 -252
- package/src/packlets/context/convert/decls.ts +0 -126
- package/src/packlets/context/convert/index.ts +0 -23
- package/src/packlets/context/index.ts +0 -27
- package/src/packlets/decisions/abstractDecision.ts +0 -87
- package/src/packlets/decisions/abstractDecisionCollector.ts +0 -122
- package/src/packlets/decisions/candidate.ts +0 -101
- package/src/packlets/decisions/common.ts +0 -37
- package/src/packlets/decisions/concreteDecision.ts +0 -157
- package/src/packlets/decisions/decision.ts +0 -172
- package/src/packlets/decisions/index.ts +0 -28
- package/src/packlets/import/fsItem.ts +0 -212
- package/src/packlets/import/importContext.ts +0 -183
- package/src/packlets/import/importManager.ts +0 -187
- package/src/packlets/import/importable.ts +0 -107
- package/src/packlets/import/importers/collectionImporter.ts +0 -153
- package/src/packlets/import/importers/fsItemImporter.ts +0 -154
- package/src/packlets/import/importers/importer.ts +0 -58
- package/src/packlets/import/importers/index.ts +0 -27
- package/src/packlets/import/importers/jsonImporter.ts +0 -133
- package/src/packlets/import/importers/pathImporter.ts +0 -134
- package/src/packlets/import/index.ts +0 -29
- package/src/packlets/qualifier-types/config/convert.ts +0 -108
- package/src/packlets/qualifier-types/config/index.ts +0 -27
- package/src/packlets/qualifier-types/config/json.ts +0 -126
- package/src/packlets/qualifier-types/convert.ts +0 -77
- package/src/packlets/qualifier-types/helpers.ts +0 -94
- package/src/packlets/qualifier-types/index.ts +0 -34
- package/src/packlets/qualifier-types/languageQualifierType.ts +0 -143
- package/src/packlets/qualifier-types/literalQualifierType.ts +0 -244
- package/src/packlets/qualifier-types/literalValueHierarchy.ts +0 -332
- package/src/packlets/qualifier-types/qualifierType.ts +0 -360
- package/src/packlets/qualifier-types/qualifierTypeCollector.ts +0 -102
- package/src/packlets/qualifier-types/territoryQualifierType.ts +0 -255
- package/src/packlets/qualifiers/convert/decls.ts +0 -90
- package/src/packlets/qualifiers/convert/index.ts +0 -24
- package/src/packlets/qualifiers/convert/qualifier.ts +0 -55
- package/src/packlets/qualifiers/index.ts +0 -31
- package/src/packlets/qualifiers/qualifier.ts +0 -169
- package/src/packlets/qualifiers/qualifierCollector.ts +0 -194
- package/src/packlets/qualifiers/qualifierDecl.ts +0 -80
- package/src/packlets/qualifiers/qualifierDefaultValueDecls.ts +0 -57
- package/src/packlets/qualifiers/qualifierDefaultValueToken.ts +0 -230
- package/src/packlets/resource-json/compiled/common.ts +0 -35
- package/src/packlets/resource-json/compiled/convert.ts +0 -143
- package/src/packlets/resource-json/compiled/index.ts +0 -27
- package/src/packlets/resource-json/compiled/json.ts +0 -239
- package/src/packlets/resource-json/convert.ts +0 -236
- package/src/packlets/resource-json/helpers.ts +0 -284
- package/src/packlets/resource-json/index.ts +0 -33
- package/src/packlets/resource-json/json.ts +0 -295
- package/src/packlets/resource-json/normalized.ts +0 -211
- package/src/packlets/resource-json/resourceDeclCollection.ts +0 -117
- package/src/packlets/resource-json/resourceDeclContainer.ts +0 -48
- package/src/packlets/resource-json/resourceDeclTree.ts +0 -116
- package/src/packlets/resource-types/config/convert.ts +0 -38
- package/src/packlets/resource-types/config/index.ts +0 -27
- package/src/packlets/resource-types/config/json.ts +0 -33
- package/src/packlets/resource-types/helpers.ts +0 -44
- package/src/packlets/resource-types/index.ts +0 -30
- package/src/packlets/resource-types/jsonResourceType.ts +0 -102
- package/src/packlets/resource-types/resourceType.ts +0 -292
- package/src/packlets/resource-types/resourceTypeCollector.ts +0 -79
- package/src/packlets/resources/candidateReducer.ts +0 -331
- package/src/packlets/resources/common.ts +0 -114
- package/src/packlets/resources/index.ts +0 -28
- package/src/packlets/resources/resource.ts +0 -307
- package/src/packlets/resources/resourceBuilder.ts +0 -269
- package/src/packlets/resources/resourceCandidate.ts +0 -333
- package/src/packlets/resources/resourceManagerBuilder.ts +0 -1169
- package/src/packlets/runtime/cacheListener.ts +0 -113
- package/src/packlets/runtime/cacheMetrics.ts +0 -206
- package/src/packlets/runtime/compiledResourceCollection.ts +0 -607
- package/src/packlets/runtime/conditionSetResolutionResult.ts +0 -160
- package/src/packlets/runtime/context/contextQualifierProvider.ts +0 -117
- package/src/packlets/runtime/context/contextQualifierProviderValidator.ts +0 -281
- package/src/packlets/runtime/context/index.ts +0 -26
- package/src/packlets/runtime/context/simpleContextQualifierProvider.ts +0 -225
- package/src/packlets/runtime/context/validatingSimpleContextQualifierProvider.ts +0 -96
- package/src/packlets/runtime/iResourceManager.ts +0 -130
- package/src/packlets/runtime/index.ts +0 -35
- package/src/packlets/runtime/resource-tree/common.ts +0 -126
- package/src/packlets/runtime/resource-tree/index.ts +0 -26
- package/src/packlets/runtime/resource-tree/readOnlyResourceTree.ts +0 -342
- package/src/packlets/runtime/resource-tree/resourceTreeChildren.ts +0 -125
- package/src/packlets/runtime/resource-tree/resourceTreeChildrenValidator.ts +0 -187
- package/src/packlets/runtime/resourceResolver.ts +0 -712
- package/src/packlets/runtime/validate.ts +0 -63
- package/src/packlets/zip-archive/convert.ts +0 -121
- package/src/packlets/zip-archive/index.ts +0 -76
- package/src/packlets/zip-archive/json.ts +0 -91
- package/src/packlets/zip-archive/types.ts +0 -140
- package/src/packlets/zip-archive/zipArchiveCreator.ts +0 -229
- package/src/packlets/zip-archive/zipArchiveFormat.ts +0 -158
- package/src/packlets/zip-archive/zipArchiveLoader.ts +0 -370
package/dist/ts-res.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Brand } from '@fgv/ts-utils';
|
|
2
2
|
import { Collections } from '@fgv/ts-utils';
|
|
3
3
|
import { Converter } from '@fgv/ts-utils';
|
|
4
|
+
import { Converters } from '@fgv/ts-json-base';
|
|
4
5
|
import { DetailedResult } from '@fgv/ts-utils';
|
|
5
6
|
import { FileTree } from '@fgv/ts-utils';
|
|
6
7
|
import { Hash } from '@fgv/ts-utils';
|
|
@@ -132,6 +133,13 @@ declare const allPredefinedSystemConfigurations: ReadonlyArray<PredefinedSystemC
|
|
|
132
133
|
*/
|
|
133
134
|
export declare const allResourceValueMergeMethods: ResourceValueMergeMethod[];
|
|
134
135
|
|
|
136
|
+
/**
|
|
137
|
+
* A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
|
|
138
|
+
* @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
|
|
139
|
+
* @public
|
|
140
|
+
*/
|
|
141
|
+
declare const anyQualifierTypeConfig: Converter<Model_2.IAnyQualifierTypeConfig, unknown>;
|
|
142
|
+
|
|
135
143
|
/**
|
|
136
144
|
* Converts an array of {@link Helpers.IConditionTokenParts | condition token parts} into an array of
|
|
137
145
|
* syntactically validated {@link ConditionToken | condition tokens}.
|
|
@@ -577,6 +585,120 @@ declare class CandidateReducer {
|
|
|
577
585
|
reduceCandidate(candidate: ResourceCandidate): Result<IReducedCandidate | undefined>;
|
|
578
586
|
}
|
|
579
587
|
|
|
588
|
+
/**
|
|
589
|
+
* Implementation of a candidate value that stores normalized JSON data.
|
|
590
|
+
* The value is normalized on creation and a hash-based key is generated
|
|
591
|
+
* for efficient deduplication.
|
|
592
|
+
* @public
|
|
593
|
+
*/
|
|
594
|
+
declare class CandidateValue implements ICandidateValue {
|
|
595
|
+
private readonly _collectible;
|
|
596
|
+
private readonly _json;
|
|
597
|
+
/**
|
|
598
|
+
* The unique key for this candidate value.
|
|
599
|
+
*/
|
|
600
|
+
get key(): CandidateValueKey;
|
|
601
|
+
/**
|
|
602
|
+
* The index of this candidate value in the collection.
|
|
603
|
+
*/
|
|
604
|
+
get index(): CandidateValueIndex | undefined;
|
|
605
|
+
/**
|
|
606
|
+
* The normalized JSON value.
|
|
607
|
+
*/
|
|
608
|
+
get json(): JsonValue;
|
|
609
|
+
/**
|
|
610
|
+
* Constructor for a {@link Resources.CandidateValue} object.
|
|
611
|
+
* @param params - Parameters to create the candidate value.
|
|
612
|
+
* @internal
|
|
613
|
+
*/
|
|
614
|
+
protected constructor(params: ICandidateValueCreateParams);
|
|
615
|
+
/**
|
|
616
|
+
* Creates a new {@link Resources.CandidateValue} object.
|
|
617
|
+
* @param params - Parameters to create the candidate value.
|
|
618
|
+
* @returns `Success` with the new candidate value if successful,
|
|
619
|
+
* or `Failure` with an error message if not.
|
|
620
|
+
* @public
|
|
621
|
+
*/
|
|
622
|
+
static create(params: ICandidateValueCreateParams): Result<CandidateValue>;
|
|
623
|
+
/**
|
|
624
|
+
* Sets the index of this candidate value.
|
|
625
|
+
* @param index - The index to set.
|
|
626
|
+
* @returns `Success` with the index if successful, or `Failure` with an error message if not.
|
|
627
|
+
* @public
|
|
628
|
+
*/
|
|
629
|
+
setIndex(index: number): Result<CandidateValueIndex>;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* A `ValidatingCollector` for {@link Resources.CandidateValue | CandidateValues},
|
|
634
|
+
* which collects candidate values supplied as either {@link Resources.CandidateValue | CandidateValue} or
|
|
635
|
+
* `JsonValue`.
|
|
636
|
+
* @public
|
|
637
|
+
*/
|
|
638
|
+
declare class CandidateValueCollector extends ValidatingCollector<CandidateValue> {
|
|
639
|
+
readonly normalizer: Hash.HashingNormalizer;
|
|
640
|
+
/**
|
|
641
|
+
* Constructor for a {@link Resources.CandidateValueCollector} object.
|
|
642
|
+
* @param params - Parameters to create the collector.
|
|
643
|
+
* @internal
|
|
644
|
+
*/
|
|
645
|
+
protected constructor(params?: ICandidateValueCollectorCreateParams);
|
|
646
|
+
/**
|
|
647
|
+
* Creates a new {@link Resources.CandidateValueCollector} object.
|
|
648
|
+
* @param params - Parameters to create the collector.
|
|
649
|
+
* @returns `Success` with the new collector if successful,
|
|
650
|
+
* or `Failure` with an error message if not.
|
|
651
|
+
* @public
|
|
652
|
+
*/
|
|
653
|
+
static create(params?: ICandidateValueCollectorCreateParams): Result<CandidateValueCollector>;
|
|
654
|
+
/**
|
|
655
|
+
* Returns an array of JSON values ordered by their indices.
|
|
656
|
+
* @returns Array of JsonValue objects in index order.
|
|
657
|
+
* @public
|
|
658
|
+
*/
|
|
659
|
+
getValuesByIndex(): JsonValue[];
|
|
660
|
+
/**
|
|
661
|
+
* Converter method to handle CandidateValue | JsonValue.
|
|
662
|
+
* @param from - The value to convert.
|
|
663
|
+
* @returns `Success` with the CandidateValue if successful, or `Failure` with an error message if not.
|
|
664
|
+
* @internal
|
|
665
|
+
*/
|
|
666
|
+
private _toCandidateValue;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Branded number representing a validated candidate value index.
|
|
671
|
+
* Candidate value indices are used to identify candidate values
|
|
672
|
+
* within a resource set and to enable sharing of like values.
|
|
673
|
+
* @public
|
|
674
|
+
*/
|
|
675
|
+
export declare type CandidateValueIndex = Brand<number, 'CandidateValueIndex'>;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* `Converter` which validates an `unknown` value as a {@link CandidateValueIndex | CandidateValueIndex}.
|
|
679
|
+
* @public
|
|
680
|
+
*/
|
|
681
|
+
declare const candidateValueIndex: Converter<CandidateValueIndex, unknown>;
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Branded string representing a validated candidate value key.
|
|
685
|
+
* Candidate value keys are used to identify candidate values
|
|
686
|
+
* within a resource set and to enable sharing of like values.
|
|
687
|
+
* @public
|
|
688
|
+
*/
|
|
689
|
+
export declare type CandidateValueKey = Brand<string, 'CandidateValueKey'>;
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* `Converter` which validates an `unknown` value as a {@link CandidateValueKey | CandidateValueKey}.
|
|
693
|
+
* @public
|
|
694
|
+
*/
|
|
695
|
+
declare const candidateValueKey: Converter<CandidateValueKey, unknown>;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* @internal
|
|
699
|
+
*/
|
|
700
|
+
declare const candidateValueKey_2: RegExp;
|
|
701
|
+
|
|
580
702
|
/**
|
|
581
703
|
* A factory that chains multiple factories together.
|
|
582
704
|
* @public
|
|
@@ -708,6 +830,8 @@ declare namespace Common {
|
|
|
708
830
|
ResourceValueMergeMethod,
|
|
709
831
|
allResourceValueMergeMethods,
|
|
710
832
|
CandidateCompleteness,
|
|
833
|
+
CandidateValueIndex,
|
|
834
|
+
CandidateValueKey,
|
|
711
835
|
IResourceResolver
|
|
712
836
|
}
|
|
713
837
|
}
|
|
@@ -804,23 +928,28 @@ declare class CompiledResourceCollection implements IResourceManager<IResource>
|
|
|
804
928
|
private readonly _qualifierTypes;
|
|
805
929
|
private readonly _qualifiers;
|
|
806
930
|
private readonly _resourceTypes;
|
|
931
|
+
private readonly _candidateValues;
|
|
807
932
|
private readonly _builtResources;
|
|
808
933
|
private _cachedResourceTree?;
|
|
809
934
|
/**
|
|
810
|
-
* A {@link QualifierTypes.
|
|
935
|
+
* A {@link QualifierTypes.ReadOnlyQualifierTypeCollector | ReadOnlyQualifierTypeCollector} which
|
|
811
936
|
* contains the {@link QualifierTypes.QualifierType | qualifier types} used in this collection.
|
|
812
937
|
*/
|
|
813
|
-
get qualifierTypes():
|
|
938
|
+
get qualifierTypes(): ReadOnlyQualifierTypeCollector;
|
|
814
939
|
/**
|
|
815
|
-
* A {@link Qualifiers.
|
|
940
|
+
* A {@link Qualifiers.IReadOnlyQualifierCollector | ReadOnlyQualifierCollector} which
|
|
816
941
|
* contains the {@link Qualifiers.Qualifier | qualifiers} used in this collection.
|
|
817
942
|
*/
|
|
818
|
-
get qualifiers():
|
|
943
|
+
get qualifiers(): IReadOnlyQualifierCollector;
|
|
819
944
|
/**
|
|
820
945
|
* A {@link ResourceTypes.ResourceTypeCollector | ResourceTypeCollector} which
|
|
821
946
|
* contains the {@link ResourceTypes.ResourceType | resource types} used in this collection.
|
|
822
947
|
*/
|
|
823
|
-
get resourceTypes():
|
|
948
|
+
get resourceTypes(): ReadOnlyResourceTypeCollector;
|
|
949
|
+
/**
|
|
950
|
+
* The candidate values in the collection.
|
|
951
|
+
*/
|
|
952
|
+
get candidateValues(): ReadonlyArray<JsonValue>;
|
|
824
953
|
/**
|
|
825
954
|
* {@inheritdoc Runtime.IResourceManager.builtResources}
|
|
826
955
|
*/
|
|
@@ -918,6 +1047,12 @@ declare class CompiledResourceCollection implements IResourceManager<IResource>
|
|
|
918
1047
|
* @internal
|
|
919
1048
|
*/
|
|
920
1049
|
private _buildDecisions;
|
|
1050
|
+
/**
|
|
1051
|
+
* Gets a candidate value from the collection.
|
|
1052
|
+
* @param valueIndex - The index of the candidate value to get.
|
|
1053
|
+
* @returns
|
|
1054
|
+
*/
|
|
1055
|
+
private _getCandidateValue;
|
|
921
1056
|
/**
|
|
922
1057
|
* Reconstructs a ValidatingResultMap of resources from compiled data.
|
|
923
1058
|
* @param compiled - The compiled resource collection
|
|
@@ -1714,6 +1849,7 @@ declare namespace Config_2 {
|
|
|
1714
1849
|
isSystemQualifierTypeConfig,
|
|
1715
1850
|
IQualifierTypeConfig,
|
|
1716
1851
|
ILanguageQualifierTypeConfig,
|
|
1852
|
+
LiteralValueHierarchyDecl,
|
|
1717
1853
|
ITerritoryQualifierTypeConfig,
|
|
1718
1854
|
ILiteralQualifierTypeConfig,
|
|
1719
1855
|
ISystemLanguageQualifierTypeConfig,
|
|
@@ -2071,6 +2207,8 @@ declare namespace Convert {
|
|
|
2071
2207
|
resourceIndex,
|
|
2072
2208
|
resourceTypeName,
|
|
2073
2209
|
resourceTypeIndex,
|
|
2210
|
+
candidateValueKey,
|
|
2211
|
+
candidateValueIndex,
|
|
2074
2212
|
resourceValueMergeMethod,
|
|
2075
2213
|
contextQualifierToken,
|
|
2076
2214
|
contextToken,
|
|
@@ -2117,13 +2255,16 @@ declare namespace Convert_12 {
|
|
|
2117
2255
|
|
|
2118
2256
|
declare namespace Convert_2 {
|
|
2119
2257
|
export {
|
|
2258
|
+
qualifierTypeConfig,
|
|
2120
2259
|
languageQualifierTypeConfig,
|
|
2121
2260
|
territoryQualifierTypeConfig,
|
|
2122
2261
|
literalQualifierTypeConfig,
|
|
2123
2262
|
systemLanguageQualifierTypeConfig,
|
|
2124
2263
|
systemTerritoryQualifierTypeConfig,
|
|
2125
2264
|
systemLiteralQualifierTypeConfig,
|
|
2126
|
-
systemQualifierTypeConfig
|
|
2265
|
+
systemQualifierTypeConfig,
|
|
2266
|
+
jsonQualifierTypeConfig,
|
|
2267
|
+
anyQualifierTypeConfig
|
|
2127
2268
|
}
|
|
2128
2269
|
}
|
|
2129
2270
|
|
|
@@ -2214,7 +2355,7 @@ declare namespace Convert_9 {
|
|
|
2214
2355
|
* if successful, `Failure` with an error message otherwise.
|
|
2215
2356
|
* @public
|
|
2216
2357
|
*/
|
|
2217
|
-
declare function createQualifierTypeFromConfig(typeConfig: Config_2.
|
|
2358
|
+
declare function createQualifierTypeFromConfig(typeConfig: Config_2.IAnyQualifierTypeConfig): Result<QualifierType>;
|
|
2218
2359
|
|
|
2219
2360
|
/**
|
|
2220
2361
|
* Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
|
|
@@ -2870,6 +3011,69 @@ declare interface ICandidateInfo {
|
|
|
2870
3011
|
readonly json?: JsonObject;
|
|
2871
3012
|
}
|
|
2872
3013
|
|
|
3014
|
+
/**
|
|
3015
|
+
* Interface for a candidate value that can be collected and indexed.
|
|
3016
|
+
* Candidate values are normalized JSON values that can be shared across
|
|
3017
|
+
* multiple resource candidates to reduce duplication.
|
|
3018
|
+
* @public
|
|
3019
|
+
*/
|
|
3020
|
+
declare interface ICandidateValue extends Collections.ICollectible<CandidateValueKey, CandidateValueIndex> {
|
|
3021
|
+
/**
|
|
3022
|
+
* The unique key for this candidate value, derived from the hash of the normalized JSON.
|
|
3023
|
+
*/
|
|
3024
|
+
readonly key: CandidateValueKey;
|
|
3025
|
+
/**
|
|
3026
|
+
* The index of this candidate value in the collection.
|
|
3027
|
+
*/
|
|
3028
|
+
readonly index: CandidateValueIndex | undefined;
|
|
3029
|
+
/**
|
|
3030
|
+
* The normalized JSON value.
|
|
3031
|
+
*/
|
|
3032
|
+
readonly json: JsonValue;
|
|
3033
|
+
/**
|
|
3034
|
+
* Sets the index of this candidate value.
|
|
3035
|
+
* @param index - The index to set.
|
|
3036
|
+
* @returns `Success` with the index if successful, or `Failure` with an error message if not.
|
|
3037
|
+
*/
|
|
3038
|
+
setIndex(index: number): Result<CandidateValueIndex>;
|
|
3039
|
+
}
|
|
3040
|
+
|
|
3041
|
+
/**
|
|
3042
|
+
* Parameters for creating a {@link Resources.CandidateValueCollector}.
|
|
3043
|
+
* @public
|
|
3044
|
+
*/
|
|
3045
|
+
declare interface ICandidateValueCollectorCreateParams {
|
|
3046
|
+
/**
|
|
3047
|
+
* Optional normalizer to use for normalizing JSON values.
|
|
3048
|
+
* If not provided, a default Crc32Normalizer will be used.
|
|
3049
|
+
*/
|
|
3050
|
+
normalizer?: Hash.HashingNormalizer;
|
|
3051
|
+
/**
|
|
3052
|
+
* Optional initial candidate values to add to the collection.
|
|
3053
|
+
*/
|
|
3054
|
+
candidateValues?: (CandidateValue | JsonValue)[];
|
|
3055
|
+
}
|
|
3056
|
+
|
|
3057
|
+
/**
|
|
3058
|
+
* Parameters for creating a {@link Resources.CandidateValue | CandidateValue}.
|
|
3059
|
+
* @public
|
|
3060
|
+
*/
|
|
3061
|
+
declare interface ICandidateValueCreateParams {
|
|
3062
|
+
/**
|
|
3063
|
+
* The JSON value to store. Will be normalized during creation.
|
|
3064
|
+
*/
|
|
3065
|
+
json: JsonValue;
|
|
3066
|
+
/**
|
|
3067
|
+
* Optional normalizer to use for normalizing the JSON value.
|
|
3068
|
+
* If not provided, a default Crc32Normalizer will be used.
|
|
3069
|
+
*/
|
|
3070
|
+
normalizer?: Hash.Crc32Normalizer;
|
|
3071
|
+
/**
|
|
3072
|
+
* Optional index if the value is already indexed.
|
|
3073
|
+
*/
|
|
3074
|
+
index?: number;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
2873
3077
|
/**
|
|
2874
3078
|
* Non-validated child declaration of a {@link Conditions.Condition | condition}.
|
|
2875
3079
|
* @public
|
|
@@ -2993,9 +3197,9 @@ declare interface ICompiledAbstractDecision {
|
|
|
2993
3197
|
*/
|
|
2994
3198
|
declare interface ICompiledCandidate {
|
|
2995
3199
|
/**
|
|
2996
|
-
* The JSON value of the candidate.
|
|
3200
|
+
* The global index of the JSON value of the candidate.
|
|
2997
3201
|
*/
|
|
2998
|
-
|
|
3202
|
+
valueIndex: Common.CandidateValueIndex;
|
|
2999
3203
|
/**
|
|
3000
3204
|
* Indicates if this is a partial resource that needs to be merged.
|
|
3001
3205
|
*/
|
|
@@ -3168,6 +3372,10 @@ declare interface ICompiledResourceCollection {
|
|
|
3168
3372
|
* Array of all decisions in the collection.
|
|
3169
3373
|
*/
|
|
3170
3374
|
decisions: ReadonlyArray<ICompiledAbstractDecision>;
|
|
3375
|
+
/**
|
|
3376
|
+
* Array of all candidate values in the collection.
|
|
3377
|
+
*/
|
|
3378
|
+
candidateValues: ReadonlyArray<JsonValue>;
|
|
3171
3379
|
/**
|
|
3172
3380
|
* Array of all resources in the collection.
|
|
3173
3381
|
*/
|
|
@@ -3898,10 +4106,10 @@ declare interface ILiteralQualifierTypeCreateParams {
|
|
|
3898
4106
|
*/
|
|
3899
4107
|
enumeratedValues?: ReadonlyArray<string>;
|
|
3900
4108
|
/**
|
|
3901
|
-
* Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
|
|
4109
|
+
* Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
|
|
3902
4110
|
* of literal values to use for matching. If not provided, no hierarchy will be used.
|
|
3903
4111
|
*/
|
|
3904
|
-
hierarchy?: LiteralValueHierarchyDecl<string>;
|
|
4112
|
+
hierarchy?: Config_2.LiteralValueHierarchyDecl<string>;
|
|
3905
4113
|
/**
|
|
3906
4114
|
* Global index for this qualifier type.
|
|
3907
4115
|
*/
|
|
@@ -4360,6 +4568,10 @@ declare interface IQualifierType extends ICollectible<QualifierTypeName, Qualifi
|
|
|
4360
4568
|
* The name of the qualifier type.
|
|
4361
4569
|
*/
|
|
4362
4570
|
readonly name: QualifierTypeName;
|
|
4571
|
+
/**
|
|
4572
|
+
* Name of the underlying system type.
|
|
4573
|
+
*/
|
|
4574
|
+
readonly systemTypeName: QualifierTypeName;
|
|
4363
4575
|
/**
|
|
4364
4576
|
* Unique key for this qualifier.
|
|
4365
4577
|
*/
|
|
@@ -4422,6 +4634,17 @@ declare interface IQualifierType extends ICollectible<QualifierTypeName, Qualifi
|
|
|
4422
4634
|
* Sets the index for this qualifier type. Once set, index is immutable.
|
|
4423
4635
|
*/
|
|
4424
4636
|
setIndex(index: number): Result<QualifierTypeIndex>;
|
|
4637
|
+
/**
|
|
4638
|
+
* Gets the configuration for this qualifier type.
|
|
4639
|
+
* @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
|
|
4640
|
+
*/
|
|
4641
|
+
getConfigurationJson(): Result<JsonObject>;
|
|
4642
|
+
/**
|
|
4643
|
+
* Validates configuration JSON data for this qualifier type.
|
|
4644
|
+
* @param from - The unknown data to validate as configuration JSON.
|
|
4645
|
+
* @returns `Success` with validated JSON configuration if valid, `Failure` with an error message otherwise.
|
|
4646
|
+
*/
|
|
4647
|
+
validateConfigurationJson(from: unknown): Result<JsonObject>;
|
|
4425
4648
|
}
|
|
4426
4649
|
|
|
4427
4650
|
/**
|
|
@@ -4582,7 +4805,7 @@ declare interface IReadOnlyResourceTreeBranch<T> {
|
|
|
4582
4805
|
* Interface for a read-only result-based resource tree with navigation methods.
|
|
4583
4806
|
* @public
|
|
4584
4807
|
*/
|
|
4585
|
-
declare interface IReadOnlyResourceTreeChildren<T, TID extends string = ResourceId, TNAME extends string = ResourceName> extends IReadOnlyResultMap<
|
|
4808
|
+
declare interface IReadOnlyResourceTreeChildren<T, TID extends string = ResourceId, TNAME extends string = ResourceName> extends IReadOnlyResultMap<TNAME, IReadOnlyResourceTreeNode<T>> {
|
|
4586
4809
|
/**
|
|
4587
4810
|
* Gets a tree node by its full ResourceId path.
|
|
4588
4811
|
* @param id - The ResourceId path to look up
|
|
@@ -4698,6 +4921,7 @@ declare interface IResourceBuilderCreateParams {
|
|
|
4698
4921
|
conditionSets: ConditionSetCollector;
|
|
4699
4922
|
resourceTypes: ReadOnlyResourceTypeCollector;
|
|
4700
4923
|
decisions: AbstractDecisionCollector;
|
|
4924
|
+
candidateValues: CandidateValueCollector;
|
|
4701
4925
|
}
|
|
4702
4926
|
|
|
4703
4927
|
/**
|
|
@@ -4727,6 +4951,7 @@ declare interface IResourceCandidateCreateParams {
|
|
|
4727
4951
|
resourceType?: ResourceType;
|
|
4728
4952
|
parentConditions?: ReadonlyArray<Condition>;
|
|
4729
4953
|
conditionSets: ConditionSetCollector;
|
|
4954
|
+
candidateValues: CandidateValueCollector;
|
|
4730
4955
|
}
|
|
4731
4956
|
|
|
4732
4957
|
/**
|
|
@@ -5273,6 +5498,24 @@ declare function isResourceTreeRootOrNodeInit<T>(init: ResourceTreeNodeInit<T> |
|
|
|
5273
5498
|
*/
|
|
5274
5499
|
declare function isSystemQualifierTypeConfig(config: IAnyQualifierTypeConfig): config is ISystemQualifierTypeConfig;
|
|
5275
5500
|
|
|
5501
|
+
/**
|
|
5502
|
+
* Checks if the given index is a valid candidate value index.
|
|
5503
|
+
*
|
|
5504
|
+
* @param index - The index to validate.
|
|
5505
|
+
* @returns `true` if the index is a valid candidate value index, otherwise `false`.
|
|
5506
|
+
* @public
|
|
5507
|
+
*/
|
|
5508
|
+
declare function isValidCandidateValueIndex(index: number): index is CandidateValueIndex;
|
|
5509
|
+
|
|
5510
|
+
/**
|
|
5511
|
+
* Checks if the given key is a valid candidate value key.
|
|
5512
|
+
*
|
|
5513
|
+
* @param key - The key to validate.
|
|
5514
|
+
* @returns `true` if the key is a valid candidate value key, otherwise `false`.
|
|
5515
|
+
* @public
|
|
5516
|
+
*/
|
|
5517
|
+
declare function isValidCandidateValueKey(key: string): key is CandidateValueKey;
|
|
5518
|
+
|
|
5276
5519
|
/**
|
|
5277
5520
|
* Determines whether a number is a valid condition index.
|
|
5278
5521
|
* @param index - the number to validate
|
|
@@ -5501,7 +5744,7 @@ declare interface ISystemConfiguration {
|
|
|
5501
5744
|
/** Optional description explaining the purpose and use case of the configuration. */
|
|
5502
5745
|
description?: string;
|
|
5503
5746
|
/** Qualifier type configurations that define the available qualifier types in the system. */
|
|
5504
|
-
qualifierTypes: QualifierTypes.Config.
|
|
5747
|
+
qualifierTypes: QualifierTypes.Config.IAnyQualifierTypeConfig[];
|
|
5505
5748
|
/** Qualifier declarations that define the available qualifiers in the system. */
|
|
5506
5749
|
qualifiers: Qualifiers.IQualifierDecl[];
|
|
5507
5750
|
/** Resource type configurations that define the available resource types in the system. */
|
|
@@ -5570,7 +5813,7 @@ declare interface ITerritoryQualifierTypeConfig {
|
|
|
5570
5813
|
acceptLowercase?: boolean;
|
|
5571
5814
|
allowedTerritories?: string[];
|
|
5572
5815
|
/**
|
|
5573
|
-
* Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
|
|
5816
|
+
* Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
|
|
5574
5817
|
* of territory values to use for matching. If not provided, no hierarchy will be used.
|
|
5575
5818
|
*/
|
|
5576
5819
|
hierarchy?: LiteralValueHierarchyDecl<string>;
|
|
@@ -5603,10 +5846,10 @@ declare interface ITerritoryQualifierTypeCreateParams {
|
|
|
5603
5846
|
*/
|
|
5604
5847
|
acceptLowercase?: boolean;
|
|
5605
5848
|
/**
|
|
5606
|
-
* Optional {@link QualifierTypes.LiteralValueHierarchyDecl | hierarchy declaration}
|
|
5849
|
+
* Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
|
|
5607
5850
|
* of territory values to use for matching. If not provided, no hierarchy will be used.
|
|
5608
5851
|
*/
|
|
5609
|
-
hierarchy?: LiteralValueHierarchyDecl<string>;
|
|
5852
|
+
hierarchy?: Config_2.LiteralValueHierarchyDecl<string>;
|
|
5610
5853
|
}
|
|
5611
5854
|
|
|
5612
5855
|
/**
|
|
@@ -5923,11 +6166,22 @@ declare class JsonImporter implements IImporter {
|
|
|
5923
6166
|
private _tryImportResourceTree;
|
|
5924
6167
|
}
|
|
5925
6168
|
|
|
6169
|
+
/**
|
|
6170
|
+
* A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
|
|
6171
|
+
* @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
|
|
6172
|
+
* @public
|
|
6173
|
+
*/
|
|
6174
|
+
declare const jsonQualifierTypeConfig: Converter<Model_2.IQualifierTypeConfig<JsonObject>, Converters.IJsonConverterContext>;
|
|
6175
|
+
|
|
5926
6176
|
/**
|
|
5927
6177
|
* Implementation of a {@link ResourceTypes.ResourceType | ResourceType} for JSON values.
|
|
5928
6178
|
* @public
|
|
5929
6179
|
*/
|
|
5930
6180
|
declare class JsonResourceType extends ResourceType<JsonObject> {
|
|
6181
|
+
/**
|
|
6182
|
+
* {@inheritdoc ResourceTypes.ResourceType.systemTypeName}
|
|
6183
|
+
*/
|
|
6184
|
+
readonly systemTypeName: ResourceTypeName;
|
|
5931
6185
|
/**
|
|
5932
6186
|
* Protected {@link ResourceTypes.JsonResourceType | JsonResourceType} constructor for use by subclasses.
|
|
5933
6187
|
* Use {@link ResourceTypes.JsonResourceType.create | JsonResourceType.create} to create a new instance.
|
|
@@ -5985,6 +6239,10 @@ declare const LanguagePrioritySystemConfiguration: ISystemConfiguration;
|
|
|
5985
6239
|
* @public
|
|
5986
6240
|
*/
|
|
5987
6241
|
declare class LanguageQualifierType extends QualifierType {
|
|
6242
|
+
/**
|
|
6243
|
+
* {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
|
|
6244
|
+
*/
|
|
6245
|
+
readonly systemTypeName: QualifierTypeName;
|
|
5988
6246
|
/**
|
|
5989
6247
|
* Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
|
|
5990
6248
|
* @param name - Optional name for the qualifier type. Defaults to 'language'.
|
|
@@ -6014,6 +6272,27 @@ declare class LanguageQualifierType extends QualifierType {
|
|
|
6014
6272
|
* {@inheritdoc QualifierTypes.IQualifierType.isValidConditionValue}
|
|
6015
6273
|
*/
|
|
6016
6274
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
6275
|
+
/**
|
|
6276
|
+
* Gets a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
|
|
6277
|
+
* for this qualifier type.
|
|
6278
|
+
* @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
|
|
6279
|
+
*/
|
|
6280
|
+
getConfiguration(): Result<Config_2.ISystemLanguageQualifierTypeConfig>;
|
|
6281
|
+
/**
|
|
6282
|
+
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
6283
|
+
*/
|
|
6284
|
+
getConfigurationJson(): Result<JsonObject>;
|
|
6285
|
+
/**
|
|
6286
|
+
* {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
6287
|
+
*/
|
|
6288
|
+
validateConfigurationJson(from: unknown): Result<JsonObject>;
|
|
6289
|
+
/**
|
|
6290
|
+
* Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
|
|
6291
|
+
* for this qualifier type.
|
|
6292
|
+
* @param from - The unknown data to validate as a configuration object.
|
|
6293
|
+
* @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
|
|
6294
|
+
*/
|
|
6295
|
+
validateConfiguration(from: unknown): Result<Config_2.ISystemLanguageQualifierTypeConfig>;
|
|
6017
6296
|
/**
|
|
6018
6297
|
* Matches a single language condition against a single language context value using
|
|
6019
6298
|
* {@link https://github.com/ErikFortune/fgv/tree/main/libraries/ts-bcp47#tag-matching | similarity matching}.
|
|
@@ -6038,6 +6317,10 @@ declare const languageQualifierTypeConfig: ObjectConverter<Model_2.ILanguageQual
|
|
|
6038
6317
|
* @public
|
|
6039
6318
|
*/
|
|
6040
6319
|
declare class LiteralQualifierType extends QualifierType {
|
|
6320
|
+
/**
|
|
6321
|
+
* {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
|
|
6322
|
+
*/
|
|
6323
|
+
readonly systemTypeName: QualifierTypeName;
|
|
6041
6324
|
/**
|
|
6042
6325
|
* Indicates whether the qualifier match is case-sensitive.
|
|
6043
6326
|
*/
|
|
@@ -6073,6 +6356,27 @@ declare class LiteralQualifierType extends QualifierType {
|
|
|
6073
6356
|
* {@inheritdoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
6074
6357
|
*/
|
|
6075
6358
|
isPotentialMatch(conditionValue: string, contextValue: string): boolean;
|
|
6359
|
+
/**
|
|
6360
|
+
* Gets a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
|
|
6361
|
+
* for this qualifier type.
|
|
6362
|
+
* @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
|
|
6363
|
+
*/
|
|
6364
|
+
getConfiguration(): Result<Config_2.ISystemLiteralQualifierTypeConfig>;
|
|
6365
|
+
/**
|
|
6366
|
+
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
6367
|
+
*/
|
|
6368
|
+
getConfigurationJson(): Result<JsonObject>;
|
|
6369
|
+
/**
|
|
6370
|
+
* {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
6371
|
+
*/
|
|
6372
|
+
validateConfigurationJson(from: unknown): Result<JsonObject>;
|
|
6373
|
+
/**
|
|
6374
|
+
* Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
|
|
6375
|
+
* for this qualifier type.
|
|
6376
|
+
* @param from - The unknown data to validate as a configuration object.
|
|
6377
|
+
* @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
|
|
6378
|
+
*/
|
|
6379
|
+
validateConfiguration(from: unknown): Result<Config_2.ISystemLiteralQualifierTypeConfig>;
|
|
6076
6380
|
/**
|
|
6077
6381
|
* {@inheritdoc QualifierTypes.QualifierType._matchOne}
|
|
6078
6382
|
*/
|
|
@@ -6202,6 +6506,11 @@ declare class LiteralValueHierarchy<T extends string = string> {
|
|
|
6202
6506
|
*/
|
|
6203
6507
|
match(condition: QualifierConditionValue, context: QualifierContextValue, __operator?: ConditionOperator): QualifierMatchScore;
|
|
6204
6508
|
protected static _buildValuesFromHierarchy<T extends string>(params: ILiteralValueHierarchyCreateParams<T>): Result<ReadonlyMap<T, ILiteralValue<T>>>;
|
|
6509
|
+
/**
|
|
6510
|
+
* Converts the hierarchy to a record of parent-child relationships.
|
|
6511
|
+
* @returns A record of parent-child relationships.
|
|
6512
|
+
*/
|
|
6513
|
+
asRecord(): Record<string, string>;
|
|
6205
6514
|
}
|
|
6206
6515
|
|
|
6207
6516
|
/**
|
|
@@ -6387,6 +6696,7 @@ declare namespace Model_2 {
|
|
|
6387
6696
|
isSystemQualifierTypeConfig,
|
|
6388
6697
|
IQualifierTypeConfig,
|
|
6389
6698
|
ILanguageQualifierTypeConfig,
|
|
6699
|
+
LiteralValueHierarchyDecl,
|
|
6390
6700
|
ITerritoryQualifierTypeConfig,
|
|
6391
6701
|
ILiteralQualifierTypeConfig,
|
|
6392
6702
|
ISystemLanguageQualifierTypeConfig,
|
|
@@ -6986,6 +7296,10 @@ export declare abstract class QualifierType implements IQualifierType {
|
|
|
6986
7296
|
* {@inheritdoc QualifierTypes.IQualifierType.name}
|
|
6987
7297
|
*/
|
|
6988
7298
|
readonly name: QualifierTypeName;
|
|
7299
|
+
/**
|
|
7300
|
+
* {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
|
|
7301
|
+
*/
|
|
7302
|
+
abstract readonly systemTypeName: QualifierTypeName;
|
|
6989
7303
|
/**
|
|
6990
7304
|
* {@inheritdoc QualifierTypes.IQualifierType.key}
|
|
6991
7305
|
*/
|
|
@@ -7031,6 +7345,14 @@ export declare abstract class QualifierType implements IQualifierType {
|
|
|
7031
7345
|
* {@inheritdoc QualifierTypes.IQualifierType.matches}
|
|
7032
7346
|
*/
|
|
7033
7347
|
matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
|
|
7348
|
+
/**
|
|
7349
|
+
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
7350
|
+
*/
|
|
7351
|
+
abstract getConfigurationJson(): Result<JsonObject>;
|
|
7352
|
+
/**
|
|
7353
|
+
* {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
7354
|
+
*/
|
|
7355
|
+
abstract validateConfigurationJson(from: unknown): Result<JsonObject>;
|
|
7034
7356
|
/**
|
|
7035
7357
|
* {@inheritdoc QualifierTypes.IQualifierType.setIndex}
|
|
7036
7358
|
*/
|
|
@@ -7110,6 +7432,14 @@ declare class QualifierTypeCollector extends ValidatingConvertingCollector<Quali
|
|
|
7110
7432
|
protected static _toQualifierType(from: unknown): Result<QualifierType>;
|
|
7111
7433
|
}
|
|
7112
7434
|
|
|
7435
|
+
/**
|
|
7436
|
+
* A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
|
|
7437
|
+
* @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
|
|
7438
|
+
* @param config - A `Converter` for the configuration object.
|
|
7439
|
+
* @public
|
|
7440
|
+
*/
|
|
7441
|
+
declare function qualifierTypeConfig<T, TD = unknown>(config: Converter<T, TD>): Converter<Model_2.IQualifierTypeConfig<T>, TD>;
|
|
7442
|
+
|
|
7113
7443
|
/**
|
|
7114
7444
|
* A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | system qualifier type configuration}
|
|
7115
7445
|
* by chaining a supplied factory with a {@link Config.BuiltInQualifierTypeFactory | built-in factory} that handles built-in qualifier types.
|
|
@@ -7159,7 +7489,6 @@ declare namespace QualifierTypes {
|
|
|
7159
7489
|
LanguageQualifierType,
|
|
7160
7490
|
ILiteralQualifierTypeCreateParams,
|
|
7161
7491
|
LiteralQualifierType,
|
|
7162
|
-
LiteralValueHierarchyDecl,
|
|
7163
7492
|
ILiteralValue,
|
|
7164
7493
|
ILiteralValueHierarchyCreateParams,
|
|
7165
7494
|
LiteralValueHierarchy,
|
|
@@ -7337,6 +7666,7 @@ declare namespace RegularExpressions {
|
|
|
7337
7666
|
contextToken_2 as contextToken,
|
|
7338
7667
|
conditionSetHash_2 as conditionSetHash,
|
|
7339
7668
|
decisionKey_2 as decisionKey,
|
|
7669
|
+
candidateValueKey_2 as candidateValueKey,
|
|
7340
7670
|
qualifierDefaultValueToken_2 as qualifierDefaultValueToken,
|
|
7341
7671
|
qualifierDefaultValuesToken_2 as qualifierDefaultValuesToken,
|
|
7342
7672
|
territoryCode
|
|
@@ -7493,6 +7823,10 @@ declare class ResourceBuilder {
|
|
|
7493
7823
|
* Collector for {@link Decisions.AbstractDecision | abstract decisions}.
|
|
7494
7824
|
*/
|
|
7495
7825
|
protected _decisions: AbstractDecisionCollector;
|
|
7826
|
+
/**
|
|
7827
|
+
* Collector for candidate values.
|
|
7828
|
+
*/
|
|
7829
|
+
protected _candidateValues: CandidateValueCollector;
|
|
7496
7830
|
/**
|
|
7497
7831
|
* Constructor for a {@link Resources.ResourceBuilder | ResourceBuilder} object.
|
|
7498
7832
|
* @param params - Parameters to construct the new {@link Resources.ResourceBuilder | ResourceBuilder}.
|
|
@@ -7570,10 +7904,16 @@ export declare class ResourceCandidate implements IResourceCandidate {
|
|
|
7570
7904
|
* is a possible instance.
|
|
7571
7905
|
*/
|
|
7572
7906
|
readonly id: ResourceId;
|
|
7907
|
+
/**
|
|
7908
|
+
* The candidate value that contains the JSON representation of the instance data.
|
|
7909
|
+
*/
|
|
7910
|
+
readonly candidateValue: CandidateValue;
|
|
7573
7911
|
/**
|
|
7574
7912
|
* The JSON representation of the instance data to be applied.
|
|
7913
|
+
* @remarks
|
|
7914
|
+
* This property provides access to the JSON data from the underlying candidate value.
|
|
7575
7915
|
*/
|
|
7576
|
-
|
|
7916
|
+
get json(): JsonObject;
|
|
7577
7917
|
/**
|
|
7578
7918
|
* The conditions under which this candidate applies.
|
|
7579
7919
|
*/
|
|
@@ -7837,6 +8177,11 @@ export declare class ResourceManagerBuilder implements IResourceManager<Resource
|
|
|
7837
8177
|
* @internal
|
|
7838
8178
|
*/
|
|
7839
8179
|
protected readonly _decisions: AbstractDecisionCollector;
|
|
8180
|
+
/**
|
|
8181
|
+
* The candidate value collector used by this resource manager.
|
|
8182
|
+
* @internal
|
|
8183
|
+
*/
|
|
8184
|
+
protected readonly _candidateValues: CandidateValueCollector;
|
|
7840
8185
|
/**
|
|
7841
8186
|
* The {@link Resources.ResourceBuilder | resource builders} used by this resource manager.
|
|
7842
8187
|
* @internal
|
|
@@ -8163,6 +8508,7 @@ export declare class ResourceManagerBuilder implements IResourceManager<Resource
|
|
|
8163
8508
|
* @param decision - The decision containing condition sets.
|
|
8164
8509
|
* @param resourceType - The resource type for the candidates.
|
|
8165
8510
|
* @param builder - The builder to add candidates to.
|
|
8511
|
+
* @param candidateValues - Array of candidate values indexed by valueIndex.
|
|
8166
8512
|
* @returns `Success` if all candidates were added successfully, `Failure` otherwise.
|
|
8167
8513
|
* @internal
|
|
8168
8514
|
*/
|
|
@@ -8436,6 +8782,11 @@ declare namespace Resources {
|
|
|
8436
8782
|
ICandidateInfo,
|
|
8437
8783
|
IReducedCandidate,
|
|
8438
8784
|
CandidateReducer,
|
|
8785
|
+
ICandidateValue,
|
|
8786
|
+
ICandidateValueCreateParams,
|
|
8787
|
+
CandidateValue,
|
|
8788
|
+
ICandidateValueCollectorCreateParams,
|
|
8789
|
+
CandidateValueCollector,
|
|
8439
8790
|
IResourceCandidateCreateParams,
|
|
8440
8791
|
ICandidateDeclOptions,
|
|
8441
8792
|
ResourceCandidate,
|
|
@@ -8604,6 +8955,10 @@ export declare abstract class ResourceType<T = unknown> implements IResourceType
|
|
|
8604
8955
|
* {@inheritdoc ResourceTypes.IResourceType.key}
|
|
8605
8956
|
*/
|
|
8606
8957
|
get key(): ResourceTypeName;
|
|
8958
|
+
/**
|
|
8959
|
+
* Name of the underlying system type.
|
|
8960
|
+
*/
|
|
8961
|
+
abstract readonly systemTypeName: ResourceTypeName;
|
|
8607
8962
|
/**
|
|
8608
8963
|
* {@inheritdoc ResourceTypes.IResourceType.index}
|
|
8609
8964
|
*/
|
|
@@ -9053,6 +9408,10 @@ declare const TerritoryPrioritySystemConfiguration: ISystemConfiguration;
|
|
|
9053
9408
|
* @public
|
|
9054
9409
|
*/
|
|
9055
9410
|
declare class TerritoryQualifierType extends QualifierType {
|
|
9411
|
+
/**
|
|
9412
|
+
* {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
|
|
9413
|
+
*/
|
|
9414
|
+
readonly systemTypeName: QualifierTypeName;
|
|
9056
9415
|
/**
|
|
9057
9416
|
* Optional array enumerating allowed territories to further constrain the type.
|
|
9058
9417
|
*/
|
|
@@ -9094,6 +9453,25 @@ declare class TerritoryQualifierType extends QualifierType {
|
|
|
9094
9453
|
* @public
|
|
9095
9454
|
*/
|
|
9096
9455
|
static createFromConfig(config: Config_2.IQualifierTypeConfig<Config_2.ITerritoryQualifierTypeConfig>): Result<TerritoryQualifierType>;
|
|
9456
|
+
/**
|
|
9457
|
+
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
9458
|
+
*/
|
|
9459
|
+
getConfiguration(): Result<Config_2.ISystemTerritoryQualifierTypeConfig>;
|
|
9460
|
+
/**
|
|
9461
|
+
* {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
9462
|
+
*/
|
|
9463
|
+
getConfigurationJson(): Result<JsonObject>;
|
|
9464
|
+
/**
|
|
9465
|
+
* {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
9466
|
+
*/
|
|
9467
|
+
validateConfigurationJson(from: unknown): Result<JsonObject>;
|
|
9468
|
+
/**
|
|
9469
|
+
* Validates a {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration object}
|
|
9470
|
+
* for this qualifier type.
|
|
9471
|
+
* @param from - The unknown data to validate as a configuration object.
|
|
9472
|
+
* @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
|
|
9473
|
+
*/
|
|
9474
|
+
validateConfiguration(from: unknown): Result<Config_2.ISystemTerritoryQualifierTypeConfig>;
|
|
9097
9475
|
/**
|
|
9098
9476
|
* {@inheritdoc QualifierTypes.QualifierType._matchOne}
|
|
9099
9477
|
*/
|
|
@@ -9126,6 +9504,26 @@ declare class TerritoryQualifierType extends QualifierType {
|
|
|
9126
9504
|
*/
|
|
9127
9505
|
declare const territoryQualifierTypeConfig: ObjectConverter<Model_2.ITerritoryQualifierTypeConfig, unknown>;
|
|
9128
9506
|
|
|
9507
|
+
/**
|
|
9508
|
+
* Converts a number to a {@link CandidateValueIndex | candidate value index}.
|
|
9509
|
+
*
|
|
9510
|
+
* @param index - The number to convert.
|
|
9511
|
+
* @returns `Success` with the converted index if valid, or `Failure` with an error message
|
|
9512
|
+
* if not.
|
|
9513
|
+
* @public
|
|
9514
|
+
*/
|
|
9515
|
+
declare function toCandidateValueIndex(index: number): Result<CandidateValueIndex>;
|
|
9516
|
+
|
|
9517
|
+
/**
|
|
9518
|
+
* Converts a string to a {@link CandidateValueKey | candidate value key}.
|
|
9519
|
+
*
|
|
9520
|
+
* @param key - The key to convert.
|
|
9521
|
+
* @returns `Success` with the converted key if valid, or `Failure` with an error message
|
|
9522
|
+
* if not.
|
|
9523
|
+
* @public
|
|
9524
|
+
*/
|
|
9525
|
+
declare function toCandidateValueKey(key: string): Result<CandidateValueKey>;
|
|
9526
|
+
|
|
9129
9527
|
/**
|
|
9130
9528
|
* Converts a number to a {@link ConditionIndex} if it is a valid condition index.
|
|
9131
9529
|
* @param index - the number to convert
|
|
@@ -9425,12 +9823,16 @@ declare namespace Validate {
|
|
|
9425
9823
|
isValidResourceIndex,
|
|
9426
9824
|
isValidResourceTypeName,
|
|
9427
9825
|
isValidResourceTypeIndex,
|
|
9826
|
+
isValidCandidateValueIndex,
|
|
9827
|
+
isValidCandidateValueKey,
|
|
9428
9828
|
toResourceName,
|
|
9429
9829
|
toResourceId,
|
|
9430
9830
|
toOptionalResourceId,
|
|
9431
9831
|
toResourceIndex,
|
|
9432
9832
|
toResourceTypeName,
|
|
9433
|
-
toResourceTypeIndex
|
|
9833
|
+
toResourceTypeIndex,
|
|
9834
|
+
toCandidateValueKey,
|
|
9835
|
+
toCandidateValueIndex
|
|
9434
9836
|
}
|
|
9435
9837
|
}
|
|
9436
9838
|
export { Validate }
|