@fgv/ts-res 5.0.0-30 → 5.0.0-31
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/ts-res.d.ts +317 -158
- package/lib/packlets/common/convert.d.ts +5 -0
- package/lib/packlets/common/convert.js +6 -1
- package/lib/packlets/common/helpers/context.js +1 -0
- package/lib/packlets/common/helpers/resources.js +1 -0
- package/lib/packlets/common/validate/conditions.d.ts +17 -1
- package/lib/packlets/common/validate/conditions.js +32 -6
- package/lib/packlets/common/validate/resources.js +1 -0
- package/lib/packlets/conditions/condition.js +1 -0
- package/lib/packlets/conditions/conditionSet.js +1 -0
- package/lib/packlets/import/fsItem.d.ts +2 -1
- package/lib/packlets/import/fsItem.js +2 -1
- package/lib/packlets/import/importManager.d.ts +2 -1
- package/lib/packlets/import/importers/pathImporter.d.ts +2 -1
- package/lib/packlets/import/importers/pathImporter.js +2 -1
- package/lib/packlets/qualifier-types/literalValueHierarchy.js +1 -0
- package/lib/packlets/qualifier-types/territoryQualifierType.js +3 -0
- package/lib/packlets/resources/candidateReducer.js +3 -0
- package/lib/packlets/resources/resourceBuilder.js +1 -0
- package/lib/packlets/resources/resourceManagerBuilder.js +3 -0
- package/lib/packlets/runtime/compiledResourceCollection.js +38 -29
- package/lib/packlets/runtime/conditionSetResolutionResult.js +3 -0
- package/lib/packlets/runtime/context/contextQualifierProvider.d.ts +53 -3
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.d.ts +82 -37
- package/lib/packlets/runtime/context/contextQualifierProviderValidator.js +49 -77
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.d.ts +23 -2
- package/lib/packlets/runtime/context/simpleContextQualifierProvider.js +53 -31
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.d.ts +4 -4
- package/lib/packlets/runtime/context/validatingSimpleContextQualifierProvider.js +2 -2
- package/lib/packlets/runtime/resourceResolver.js +5 -0
- package/lib/packlets/zip-archive/types.d.ts +1 -1
- package/lib/packlets/zip-archive/zipArchiveCreator.js +3 -2
- package/package.json +7 -7
package/dist/ts-res.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Collections } from '@fgv/ts-utils';
|
|
|
3
3
|
import { Converter } from '@fgv/ts-utils';
|
|
4
4
|
import { Converters } from '@fgv/ts-json-base';
|
|
5
5
|
import { DetailedResult } from '@fgv/ts-utils';
|
|
6
|
-
import { FileTree } from '@fgv/ts-
|
|
6
|
+
import { FileTree } from '@fgv/ts-json-base';
|
|
7
7
|
import { Hash } from '@fgv/ts-utils';
|
|
8
8
|
import { ICollectible } from '@fgv/ts-utils';
|
|
9
9
|
import { IReadOnlyResultMap } from '@fgv/ts-utils';
|
|
@@ -141,6 +141,56 @@ export declare const allResourceValueMergeMethods: ResourceValueMergeMethod[];
|
|
|
141
141
|
*/
|
|
142
142
|
declare const anyQualifierTypeConfig: Converter<Model_2.IAnyQualifierTypeConfig, unknown>;
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Base implementation class containing shared validation logic for both read-only and mutable validators.
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
declare abstract class BaseContextQualifierProviderValidator<T extends IContextQualifierProvider = IContextQualifierProvider> implements IContextQualifierProviderValidatorBase<T> {
|
|
149
|
+
/**
|
|
150
|
+
* The wrapped context qualifier provider.
|
|
151
|
+
*/
|
|
152
|
+
abstract readonly provider: T;
|
|
153
|
+
/**
|
|
154
|
+
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
155
|
+
*/
|
|
156
|
+
get qualifiers(): IReadOnlyQualifierCollector;
|
|
157
|
+
/**
|
|
158
|
+
* Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
|
|
159
|
+
* @param name - The string name to convert and look up.
|
|
160
|
+
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
161
|
+
* or `Failure` with an error message if not found or an error occurs.
|
|
162
|
+
*/
|
|
163
|
+
get(name: string): Result<QualifierContextValue>;
|
|
164
|
+
/**
|
|
165
|
+
* Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
|
|
166
|
+
* @param index - The number index to convert and look up.
|
|
167
|
+
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
168
|
+
* or `Failure` with an error message if not found or an error occurs.
|
|
169
|
+
*/
|
|
170
|
+
getByIndex(index: number): Result<QualifierContextValue>;
|
|
171
|
+
/**
|
|
172
|
+
* Gets a validated qualifier context value by its string name.
|
|
173
|
+
* @param name - The string name to convert and look up.
|
|
174
|
+
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
175
|
+
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
176
|
+
*/
|
|
177
|
+
getValidated(name: string): Result<QualifierContextValue>;
|
|
178
|
+
/**
|
|
179
|
+
* Gets a validated qualifier context value by its number index.
|
|
180
|
+
* @param index - The number index to convert and look up.
|
|
181
|
+
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
182
|
+
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
183
|
+
*/
|
|
184
|
+
getValidatedByIndex(index: number): Result<QualifierContextValue>;
|
|
185
|
+
/**
|
|
186
|
+
* Checks if a qualifier value exists with the given string name.
|
|
187
|
+
* @param name - The string name to convert and check.
|
|
188
|
+
* @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
|
|
189
|
+
* or `Failure` with an error message if an error occurs during the check.
|
|
190
|
+
*/
|
|
191
|
+
has(name: string): Result<boolean>;
|
|
192
|
+
}
|
|
193
|
+
|
|
144
194
|
/**
|
|
145
195
|
* Converts an array of {@link Helpers.IConditionTokenParts | condition token parts} into an array of
|
|
146
196
|
* syntactically validated {@link ConditionToken | condition tokens}.
|
|
@@ -1898,11 +1948,19 @@ export { Context }
|
|
|
1898
1948
|
|
|
1899
1949
|
declare namespace Context_2 {
|
|
1900
1950
|
export {
|
|
1951
|
+
IContextQualifierProviderBase,
|
|
1952
|
+
IReadOnlyContextQualifierProvider,
|
|
1953
|
+
IMutableContextQualifierProvider,
|
|
1901
1954
|
IContextQualifierProvider,
|
|
1902
1955
|
ContextQualifierProvider,
|
|
1956
|
+
IContextQualifierProviderValidatorBase,
|
|
1903
1957
|
IReadOnlyContextQualifierProviderValidator,
|
|
1958
|
+
IMutableContextQualifierProviderValidator,
|
|
1959
|
+
IReadOnlyContextQualifierProviderValidatorCreateParams,
|
|
1960
|
+
IMutableContextQualifierProviderValidatorCreateParams,
|
|
1904
1961
|
IContextQualifierProviderValidatorCreateParams,
|
|
1905
|
-
|
|
1962
|
+
ReadOnlyContextQualifierProviderValidator,
|
|
1963
|
+
MutableContextQualifierProviderValidator,
|
|
1906
1964
|
ISimpleContextQualifierProviderCreateParams,
|
|
1907
1965
|
SimpleContextQualifierProvider,
|
|
1908
1966
|
IValidatingSimpleContextQualifierProviderCreateParams,
|
|
@@ -1921,7 +1979,7 @@ declare const contextDecl: Converter<Record<string, string>, unknown>;
|
|
|
1921
1979
|
* Provides common functionality and enforces the contract for derived classes.
|
|
1922
1980
|
* @public
|
|
1923
1981
|
*/
|
|
1924
|
-
declare abstract class ContextQualifierProvider implements
|
|
1982
|
+
declare abstract class ContextQualifierProvider implements IContextQualifierProviderBase {
|
|
1925
1983
|
/**
|
|
1926
1984
|
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
1927
1985
|
*/
|
|
@@ -1955,96 +2013,6 @@ declare abstract class ContextQualifierProvider implements IContextQualifierProv
|
|
|
1955
2013
|
abstract getNames(): Result<ReadonlyArray<QualifierName>>;
|
|
1956
2014
|
}
|
|
1957
2015
|
|
|
1958
|
-
/**
|
|
1959
|
-
* A wrapper for {@link Runtime.Context.IContextQualifierProvider | IContextQualifierProvider} that accepts
|
|
1960
|
-
* string inputs and converts them to strongly-typed values before calling the wrapped provider.
|
|
1961
|
-
* This eliminates the need for type casting in consumer code while maintaining type safety.
|
|
1962
|
-
* @public
|
|
1963
|
-
*/
|
|
1964
|
-
declare class ContextQualifierProviderValidator implements IReadOnlyContextQualifierProviderValidator {
|
|
1965
|
-
/**
|
|
1966
|
-
* The wrapped context qualifier provider.
|
|
1967
|
-
*/
|
|
1968
|
-
readonly provider: IContextQualifierProvider;
|
|
1969
|
-
/**
|
|
1970
|
-
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
1971
|
-
*/
|
|
1972
|
-
get qualifiers(): IReadOnlyQualifierCollector;
|
|
1973
|
-
/**
|
|
1974
|
-
* Constructs a new {@link Runtime.Context.ContextQualifierProviderValidator | ContextQualifierProviderValidator}.
|
|
1975
|
-
* @param params - Required parameters for constructing the validator.
|
|
1976
|
-
*/
|
|
1977
|
-
constructor(params: IContextQualifierProviderValidatorCreateParams);
|
|
1978
|
-
/**
|
|
1979
|
-
* Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
|
|
1980
|
-
* @param name - The string name to convert and look up.
|
|
1981
|
-
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
1982
|
-
* or `Failure` with an error message if not found or an error occurs.
|
|
1983
|
-
*/
|
|
1984
|
-
get(name: string): Result<QualifierContextValue>;
|
|
1985
|
-
/**
|
|
1986
|
-
* Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
|
|
1987
|
-
* @param index - The number index to convert and look up.
|
|
1988
|
-
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
1989
|
-
* or `Failure` with an error message if not found or an error occurs.
|
|
1990
|
-
*/
|
|
1991
|
-
getByIndex(index: number): Result<QualifierContextValue>;
|
|
1992
|
-
/**
|
|
1993
|
-
* Gets a validated qualifier context value by its string name.
|
|
1994
|
-
* @param name - The string name to convert and look up.
|
|
1995
|
-
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
1996
|
-
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
1997
|
-
*/
|
|
1998
|
-
getValidated(name: string): Result<QualifierContextValue>;
|
|
1999
|
-
/**
|
|
2000
|
-
* Gets a validated qualifier context value by its number index.
|
|
2001
|
-
* @param index - The number index to convert and look up.
|
|
2002
|
-
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
2003
|
-
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
2004
|
-
*/
|
|
2005
|
-
getValidatedByIndex(index: number): Result<QualifierContextValue>;
|
|
2006
|
-
/**
|
|
2007
|
-
* Checks if a qualifier value exists with the given string name.
|
|
2008
|
-
* @param name - The string name to convert and check.
|
|
2009
|
-
* @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
|
|
2010
|
-
* or `Failure` with an error message if an error occurs during the check.
|
|
2011
|
-
*/
|
|
2012
|
-
has(name: string): Result<boolean>;
|
|
2013
|
-
/**
|
|
2014
|
-
* Sets a qualifier value using string inputs, converting to strongly-typed values.
|
|
2015
|
-
* @param name - The string name to convert.
|
|
2016
|
-
* @param value - The string value to convert.
|
|
2017
|
-
* @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
|
|
2018
|
-
* or `Failure` with an error message if an error occurs.
|
|
2019
|
-
*/
|
|
2020
|
-
set(name: string, value: string): Result<QualifierContextValue>;
|
|
2021
|
-
/**
|
|
2022
|
-
* Removes a qualifier value using string input, converting to strongly-typed QualifierName.
|
|
2023
|
-
* @param name - The string name to convert.
|
|
2024
|
-
* @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
|
|
2025
|
-
* or `Failure` with an error message if an error occurs.
|
|
2026
|
-
*/
|
|
2027
|
-
remove(name: string): Result<QualifierContextValue>;
|
|
2028
|
-
/**
|
|
2029
|
-
* Validates a string as a QualifierName.
|
|
2030
|
-
* @param name - The string to validate.
|
|
2031
|
-
* @returns `Success` with the strongly-typed QualifierName, or `Failure` if invalid.
|
|
2032
|
-
*/
|
|
2033
|
-
private _validateQualifierName;
|
|
2034
|
-
/**
|
|
2035
|
-
* Validates a number as a QualifierIndex.
|
|
2036
|
-
* @param index - The number to validate.
|
|
2037
|
-
* @returns `Success` with the strongly-typed QualifierIndex, or `Failure` if invalid.
|
|
2038
|
-
*/
|
|
2039
|
-
private _validateQualifierIndex;
|
|
2040
|
-
/**
|
|
2041
|
-
* Validates a string as a QualifierContextValue.
|
|
2042
|
-
* @param value - The string to validate.
|
|
2043
|
-
* @returns `Success` with the strongly-typed QualifierContextValue, or `Failure` if invalid.
|
|
2044
|
-
*/
|
|
2045
|
-
private _validateQualifierContextValue;
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
2016
|
/**
|
|
2049
2017
|
* A string representing a validated context qualifier token. Context qualifier tokens are used
|
|
2050
2018
|
* for filtering resources by context criteria. A context qualifier token has the form
|
|
@@ -2200,6 +2168,7 @@ declare namespace Convert {
|
|
|
2200
2168
|
qualifierIndex,
|
|
2201
2169
|
qualifierTypeName,
|
|
2202
2170
|
qualifierTypeIndex,
|
|
2171
|
+
qualifierContextValue,
|
|
2203
2172
|
qualifierMatchScore,
|
|
2204
2173
|
conditionPriority,
|
|
2205
2174
|
conditionOperator,
|
|
@@ -3674,11 +3643,19 @@ declare interface IContextMatchOptions {
|
|
|
3674
3643
|
}
|
|
3675
3644
|
|
|
3676
3645
|
/**
|
|
3677
|
-
*
|
|
3646
|
+
* Union type for context qualifier providers that can be either read-only or mutable.
|
|
3647
|
+
* Provides compile-time type discrimination via the `mutable` property.
|
|
3648
|
+
* @public
|
|
3649
|
+
*/
|
|
3650
|
+
declare type IContextQualifierProvider = IReadOnlyContextQualifierProvider | IMutableContextQualifierProvider;
|
|
3651
|
+
|
|
3652
|
+
/**
|
|
3653
|
+
* Base interface for providing qualifier values in an optimized runtime context.
|
|
3654
|
+
* Contains common read-only operations shared by both mutable and immutable providers.
|
|
3678
3655
|
* Acts as a property bag using the Result pattern for qualifier value lookups.
|
|
3679
3656
|
* @public
|
|
3680
3657
|
*/
|
|
3681
|
-
declare interface
|
|
3658
|
+
declare interface IContextQualifierProviderBase {
|
|
3682
3659
|
/**
|
|
3683
3660
|
* Gets a qualifier value by its name, index, or qualifier object.
|
|
3684
3661
|
* @param nameOrIndexOrQualifier - The {@link QualifierName | qualifier name}, {@link QualifierIndex | index}, or {@link Qualifiers.Qualifier | qualifier object} to look up.
|
|
@@ -3713,13 +3690,62 @@ declare interface IContextQualifierProvider {
|
|
|
3713
3690
|
}
|
|
3714
3691
|
|
|
3715
3692
|
/**
|
|
3716
|
-
*
|
|
3693
|
+
* Base interface for shared operations between read-only and mutable context qualifier provider validators.
|
|
3694
|
+
* Contains common methods that don't depend on provider mutability.
|
|
3717
3695
|
* @public
|
|
3718
3696
|
*/
|
|
3719
|
-
declare interface
|
|
3720
|
-
|
|
3697
|
+
declare interface IContextQualifierProviderValidatorBase<T extends IContextQualifierProvider = IContextQualifierProvider> {
|
|
3698
|
+
/**
|
|
3699
|
+
* The wrapped context qualifier provider.
|
|
3700
|
+
*/
|
|
3701
|
+
readonly provider: T;
|
|
3702
|
+
/**
|
|
3703
|
+
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
3704
|
+
*/
|
|
3705
|
+
readonly qualifiers: IReadOnlyQualifierCollector;
|
|
3706
|
+
/**
|
|
3707
|
+
* Gets a qualifier value by its string name, converting to strongly-typed QualifierName.
|
|
3708
|
+
* @param name - The string name to convert and look up.
|
|
3709
|
+
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
3710
|
+
* or `Failure` with an error message if not found or an error occurs.
|
|
3711
|
+
*/
|
|
3712
|
+
get(name: string): Result<QualifierContextValue>;
|
|
3713
|
+
/**
|
|
3714
|
+
* Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
|
|
3715
|
+
* @param index - The number index to convert and look up.
|
|
3716
|
+
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
3717
|
+
* or `Failure` with an error message if not found or an error occurs.
|
|
3718
|
+
*/
|
|
3719
|
+
getByIndex(index: number): Result<QualifierContextValue>;
|
|
3720
|
+
/**
|
|
3721
|
+
* Gets a validated qualifier context value by its string name.
|
|
3722
|
+
* @param name - The string name to convert and look up.
|
|
3723
|
+
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
3724
|
+
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
3725
|
+
*/
|
|
3726
|
+
getValidated(name: string): Result<QualifierContextValue>;
|
|
3727
|
+
/**
|
|
3728
|
+
* Gets a validated qualifier context value by its number index.
|
|
3729
|
+
* @param index - The number index to convert and look up.
|
|
3730
|
+
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
3731
|
+
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
3732
|
+
*/
|
|
3733
|
+
getValidatedByIndex(index: number): Result<QualifierContextValue>;
|
|
3734
|
+
/**
|
|
3735
|
+
* Checks if a qualifier value exists with the given string name.
|
|
3736
|
+
* @param name - The string name to convert and check.
|
|
3737
|
+
* @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
|
|
3738
|
+
* or `Failure` with an error message if an error occurs during the check.
|
|
3739
|
+
*/
|
|
3740
|
+
has(name: string): Result<boolean>;
|
|
3721
3741
|
}
|
|
3722
3742
|
|
|
3743
|
+
/**
|
|
3744
|
+
* Union type for validator constructor parameters.
|
|
3745
|
+
* @public
|
|
3746
|
+
*/
|
|
3747
|
+
declare type IContextQualifierProviderValidatorCreateParams = IReadOnlyContextQualifierProviderValidatorCreateParams | IMutableContextQualifierProviderValidatorCreateParams;
|
|
3748
|
+
|
|
3723
3749
|
/**
|
|
3724
3750
|
* Non-validated declaration of a single context qualifier value.
|
|
3725
3751
|
* @public
|
|
@@ -4511,6 +4537,73 @@ declare class ImportManager {
|
|
|
4511
4537
|
protected _import(): Result<ImportManager>;
|
|
4512
4538
|
}
|
|
4513
4539
|
|
|
4540
|
+
/**
|
|
4541
|
+
* Mutable interface for providing qualifier values in an optimized runtime context.
|
|
4542
|
+
* Extends the base interface with mutation operations and explicit mutability marker.
|
|
4543
|
+
* @public
|
|
4544
|
+
*/
|
|
4545
|
+
declare interface IMutableContextQualifierProvider extends IContextQualifierProviderBase {
|
|
4546
|
+
/**
|
|
4547
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
4548
|
+
* Always `true` for mutable providers.
|
|
4549
|
+
*/
|
|
4550
|
+
readonly mutable: true;
|
|
4551
|
+
/**
|
|
4552
|
+
* Sets a qualifier value in this provider.
|
|
4553
|
+
* @param name - The {@link QualifierName | qualifier name} to set.
|
|
4554
|
+
* @param value - The {@link QualifierContextValue | qualifier context value} to set.
|
|
4555
|
+
* @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
|
|
4556
|
+
* or `Failure` with an error message if not.
|
|
4557
|
+
*/
|
|
4558
|
+
set(name: QualifierName, value: QualifierContextValue): Result<QualifierContextValue>;
|
|
4559
|
+
/**
|
|
4560
|
+
* Removes a qualifier value from this provider.
|
|
4561
|
+
* @param name - The {@link QualifierName | qualifier name} to remove.
|
|
4562
|
+
* @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
|
|
4563
|
+
* or `Failure` with an error message if not found or an error occurs.
|
|
4564
|
+
*/
|
|
4565
|
+
remove(name: QualifierName): Result<QualifierContextValue>;
|
|
4566
|
+
/**
|
|
4567
|
+
* Clears all qualifier values from this provider.
|
|
4568
|
+
*/
|
|
4569
|
+
clear(): void;
|
|
4570
|
+
}
|
|
4571
|
+
|
|
4572
|
+
/**
|
|
4573
|
+
* A mutable interface for validators wrapping mutable context qualifier providers.
|
|
4574
|
+
* Extends the base interface with mutation operations and provides compile-time type safety.
|
|
4575
|
+
* @public
|
|
4576
|
+
*/
|
|
4577
|
+
declare interface IMutableContextQualifierProviderValidator<T extends IMutableContextQualifierProvider = IMutableContextQualifierProvider> extends IContextQualifierProviderValidatorBase<T> {
|
|
4578
|
+
/**
|
|
4579
|
+
* The wrapped mutable context qualifier provider.
|
|
4580
|
+
*/
|
|
4581
|
+
readonly provider: T;
|
|
4582
|
+
/**
|
|
4583
|
+
* Sets a qualifier value using string inputs, converting to strongly-typed values.
|
|
4584
|
+
* @param name - The string name to convert.
|
|
4585
|
+
* @param value - The string value to convert.
|
|
4586
|
+
* @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
|
|
4587
|
+
* or `Failure` with an error message if an error occurs.
|
|
4588
|
+
*/
|
|
4589
|
+
set(name: string, value: string): Result<QualifierContextValue>;
|
|
4590
|
+
/**
|
|
4591
|
+
* Removes a qualifier value using string input, converting to strongly-typed QualifierName.
|
|
4592
|
+
* @param name - The string name to convert.
|
|
4593
|
+
* @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
|
|
4594
|
+
* or `Failure` with an error message if an error occurs.
|
|
4595
|
+
*/
|
|
4596
|
+
remove(name: string): Result<QualifierContextValue>;
|
|
4597
|
+
}
|
|
4598
|
+
|
|
4599
|
+
/**
|
|
4600
|
+
* Parameters for constructing a mutable context qualifier provider validator.
|
|
4601
|
+
* @public
|
|
4602
|
+
*/
|
|
4603
|
+
declare interface IMutableContextQualifierProviderValidatorCreateParams<T extends IMutableContextQualifierProvider = IMutableContextQualifierProvider> {
|
|
4604
|
+
provider: T;
|
|
4605
|
+
}
|
|
4606
|
+
|
|
4514
4607
|
/**
|
|
4515
4608
|
* Parameters for creating a {@link Import.Importers.PathImporter | PathImporter}.
|
|
4516
4609
|
* @public
|
|
@@ -4736,68 +4829,36 @@ declare interface IQualifierTypeCreateParams {
|
|
|
4736
4829
|
}
|
|
4737
4830
|
|
|
4738
4831
|
/**
|
|
4739
|
-
*
|
|
4832
|
+
* Read-only interface for providing qualifier values in an optimized runtime context.
|
|
4833
|
+
* Explicitly marked as immutable with compile-time type discrimination.
|
|
4740
4834
|
* @public
|
|
4741
4835
|
*/
|
|
4742
|
-
declare interface
|
|
4743
|
-
/**
|
|
4744
|
-
* {@inheritdoc Runtime.Context.ContextQualifierProviderValidator.provider}
|
|
4745
|
-
*/
|
|
4746
|
-
readonly provider: IContextQualifierProvider;
|
|
4747
|
-
/**
|
|
4748
|
-
* {@inheritdoc Runtime.Context.ContextQualifierProviderValidator.qualifiers}
|
|
4749
|
-
*/
|
|
4750
|
-
readonly qualifiers: IReadOnlyQualifierCollector;
|
|
4836
|
+
declare interface IReadOnlyContextQualifierProvider extends IContextQualifierProviderBase {
|
|
4751
4837
|
/**
|
|
4752
|
-
*
|
|
4753
|
-
*
|
|
4754
|
-
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
4755
|
-
* or `Failure` with an error message if not found or an error occurs.
|
|
4756
|
-
*/
|
|
4757
|
-
get(name: string): Result<QualifierContextValue>;
|
|
4758
|
-
/**
|
|
4759
|
-
* Gets a qualifier value by its number index, converting to strongly-typed QualifierIndex.
|
|
4760
|
-
* @param index - The number index to convert and look up.
|
|
4761
|
-
* @returns `Success` with the {@link QualifierContextValue | qualifier context value} if found,
|
|
4762
|
-
* or `Failure` with an error message if not found or an error occurs.
|
|
4763
|
-
*/
|
|
4764
|
-
getByIndex(index: number): Result<QualifierContextValue>;
|
|
4765
|
-
/**
|
|
4766
|
-
* Gets a validated qualifier context value by its string name.
|
|
4767
|
-
* @param name - The string name to convert and look up.
|
|
4768
|
-
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
4769
|
-
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
4770
|
-
*/
|
|
4771
|
-
getValidated(name: string): Result<QualifierContextValue>;
|
|
4772
|
-
/**
|
|
4773
|
-
* Gets a validated qualifier context value by its number index.
|
|
4774
|
-
* @param index - The number index to convert and look up.
|
|
4775
|
-
* @returns `Success` with the validated {@link QualifierContextValue | qualifier context value} if found,
|
|
4776
|
-
* or `Failure` with an error message if not found, invalid, or an error occurs.
|
|
4777
|
-
*/
|
|
4778
|
-
getValidatedByIndex(index: number): Result<QualifierContextValue>;
|
|
4779
|
-
/**
|
|
4780
|
-
* Checks if a qualifier value exists with the given string name.
|
|
4781
|
-
* @param name - The string name to convert and check.
|
|
4782
|
-
* @returns `Success` with `true` if the qualifier value exists, `false` if it doesn't,
|
|
4783
|
-
* or `Failure` with an error message if an error occurs during the check.
|
|
4838
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
4839
|
+
* Always `false` for read-only providers.
|
|
4784
4840
|
*/
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4841
|
+
readonly mutable: false;
|
|
4842
|
+
}
|
|
4843
|
+
|
|
4844
|
+
/**
|
|
4845
|
+
* A read-only interface for validators wrapping read-only context qualifier providers.
|
|
4846
|
+
* Only exposes read operations, providing compile-time type safety by excluding mutation methods.
|
|
4847
|
+
* @public
|
|
4848
|
+
*/
|
|
4849
|
+
declare interface IReadOnlyContextQualifierProviderValidator<T extends IReadOnlyContextQualifierProvider = IReadOnlyContextQualifierProvider> {
|
|
4794
4850
|
/**
|
|
4795
|
-
*
|
|
4796
|
-
* @param name - The string name to convert.
|
|
4797
|
-
* @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
|
|
4798
|
-
* or `Failure` with an error message if an error occurs.
|
|
4851
|
+
* The wrapped read-only context qualifier provider.
|
|
4799
4852
|
*/
|
|
4800
|
-
|
|
4853
|
+
readonly provider: T;
|
|
4854
|
+
}
|
|
4855
|
+
|
|
4856
|
+
/**
|
|
4857
|
+
* Parameters for constructing a read-only context qualifier provider validator.
|
|
4858
|
+
* @public
|
|
4859
|
+
*/
|
|
4860
|
+
declare interface IReadOnlyContextQualifierProviderValidatorCreateParams<T extends IReadOnlyContextQualifierProvider = IReadOnlyContextQualifierProvider> {
|
|
4861
|
+
provider: T;
|
|
4801
4862
|
}
|
|
4802
4863
|
|
|
4803
4864
|
/**
|
|
@@ -5689,6 +5750,15 @@ declare function isValidDecisionIndex(index: number): index is DecisionIndex;
|
|
|
5689
5750
|
*/
|
|
5690
5751
|
declare function isValidDecisionKey(key: string): key is DecisionKey;
|
|
5691
5752
|
|
|
5753
|
+
/**
|
|
5754
|
+
* Determines whether a string is a valid qualifier context value.
|
|
5755
|
+
* For now, any non-empty string is considered a valid context value.
|
|
5756
|
+
* @param value - the string to validate
|
|
5757
|
+
* @returns true if the string is a valid qualifier context value, false otherwise.
|
|
5758
|
+
* @public
|
|
5759
|
+
*/
|
|
5760
|
+
declare function isValidQualifierContextValue(value: string): value is QualifierContextValue;
|
|
5761
|
+
|
|
5692
5762
|
/**
|
|
5693
5763
|
* Determines whether a string is a valid qualifier default values token.
|
|
5694
5764
|
* Qualifier default values tokens are pipe-separated lists of qualifier default value tokens.
|
|
@@ -6793,6 +6863,39 @@ declare namespace Model_4 {
|
|
|
6793
6863
|
}
|
|
6794
6864
|
}
|
|
6795
6865
|
|
|
6866
|
+
/**
|
|
6867
|
+
* A validator for mutable context qualifier providers that accepts string inputs
|
|
6868
|
+
* and converts them to strongly-typed values before calling the wrapped provider.
|
|
6869
|
+
* Provides both read and mutation operations.
|
|
6870
|
+
* @public
|
|
6871
|
+
*/
|
|
6872
|
+
declare class MutableContextQualifierProviderValidator<T extends IMutableContextQualifierProvider = IMutableContextQualifierProvider> extends BaseContextQualifierProviderValidator<T> implements IMutableContextQualifierProviderValidator<T> {
|
|
6873
|
+
/**
|
|
6874
|
+
* The wrapped mutable context qualifier provider.
|
|
6875
|
+
*/
|
|
6876
|
+
readonly provider: T;
|
|
6877
|
+
/**
|
|
6878
|
+
* Constructs a new {@link Runtime.Context.MutableContextQualifierProviderValidator | MutableContextQualifierProviderValidator}.
|
|
6879
|
+
* @param params - Required parameters for constructing the validator.
|
|
6880
|
+
*/
|
|
6881
|
+
constructor(params: IMutableContextQualifierProviderValidatorCreateParams<T>);
|
|
6882
|
+
/**
|
|
6883
|
+
* Sets a qualifier value using string inputs, converting to strongly-typed values.
|
|
6884
|
+
* @param name - The string name to convert.
|
|
6885
|
+
* @param value - The string value to convert.
|
|
6886
|
+
* @returns `Success` with the set {@link QualifierContextValue | qualifier context value} if successful,
|
|
6887
|
+
* or `Failure` with an error message if an error occurs.
|
|
6888
|
+
*/
|
|
6889
|
+
set(name: string, value: string): Result<QualifierContextValue>;
|
|
6890
|
+
/**
|
|
6891
|
+
* Removes a qualifier value using string input, converting to strongly-typed QualifierName.
|
|
6892
|
+
* @param name - The string name to convert.
|
|
6893
|
+
* @returns `Success` with the removed {@link QualifierContextValue | qualifier context value} if successful,
|
|
6894
|
+
* or `Failure` with an error message if an error occurs.
|
|
6895
|
+
*/
|
|
6896
|
+
remove(name: string): Result<QualifierContextValue>;
|
|
6897
|
+
}
|
|
6898
|
+
|
|
6796
6899
|
/**
|
|
6797
6900
|
* {@link QualifierMatchScore | Match score} indicating no match.
|
|
6798
6901
|
* @public
|
|
@@ -7148,6 +7251,12 @@ export declare type QualifierConditionValue = Brand<string, 'QualifierConditionV
|
|
|
7148
7251
|
*/
|
|
7149
7252
|
export declare type QualifierContextValue = Brand<string, 'QualifierContextValue'>;
|
|
7150
7253
|
|
|
7254
|
+
/**
|
|
7255
|
+
* `Converter` which validates an `unknown` value as a {@link QualifierContextValue | QualifierContextValue}.
|
|
7256
|
+
* @public
|
|
7257
|
+
*/
|
|
7258
|
+
declare const qualifierContextValue: Converter<QualifierContextValue, unknown>;
|
|
7259
|
+
|
|
7151
7260
|
/**
|
|
7152
7261
|
* Converter for a {@link Qualifiers.IQualifierDecl | qualifier declaration}.
|
|
7153
7262
|
* @public
|
|
@@ -7628,6 +7737,24 @@ declare type ReadOnlyConditionCollector = Collections.IReadOnlyValidatingCollect
|
|
|
7628
7737
|
*/
|
|
7629
7738
|
declare type ReadOnlyConditionSetCollector = Collections.IReadOnlyValidatingCollector<ConditionSet>;
|
|
7630
7739
|
|
|
7740
|
+
/**
|
|
7741
|
+
* A validator for read-only context qualifier providers that accepts string inputs
|
|
7742
|
+
* and converts them to strongly-typed values before calling the wrapped provider.
|
|
7743
|
+
* Only provides read operations for compile-time type safety.
|
|
7744
|
+
* @public
|
|
7745
|
+
*/
|
|
7746
|
+
declare class ReadOnlyContextQualifierProviderValidator<T extends IReadOnlyContextQualifierProvider = IReadOnlyContextQualifierProvider> extends BaseContextQualifierProviderValidator<T> implements IReadOnlyContextQualifierProviderValidator<T> {
|
|
7747
|
+
/**
|
|
7748
|
+
* The wrapped read-only context qualifier provider.
|
|
7749
|
+
*/
|
|
7750
|
+
readonly provider: T;
|
|
7751
|
+
/**
|
|
7752
|
+
* Constructs a new {@link Runtime.Context.ReadOnlyContextQualifierProviderValidator | ReadOnlyContextQualifierProviderValidator}.
|
|
7753
|
+
* @param params - Required parameters for constructing the validator.
|
|
7754
|
+
*/
|
|
7755
|
+
constructor(params: IReadOnlyContextQualifierProviderValidatorCreateParams<T>);
|
|
7756
|
+
}
|
|
7757
|
+
|
|
7631
7758
|
/**
|
|
7632
7759
|
* Interface exposing non-mutating members of a
|
|
7633
7760
|
* {@link QualifierTypes.QualifierTypeCollector | QualifierTypeCollector}.
|
|
@@ -9412,7 +9539,12 @@ declare const segmentedIdentifier: RegExp;
|
|
|
9412
9539
|
* using a `ResultMap` for qualifier value storage.
|
|
9413
9540
|
* @public
|
|
9414
9541
|
*/
|
|
9415
|
-
declare class SimpleContextQualifierProvider extends ContextQualifierProvider {
|
|
9542
|
+
declare class SimpleContextQualifierProvider extends ContextQualifierProvider implements IMutableContextQualifierProvider {
|
|
9543
|
+
/**
|
|
9544
|
+
* Explicit mutability marker for compile-time type discrimination.
|
|
9545
|
+
* Always `true` for mutable providers.
|
|
9546
|
+
*/
|
|
9547
|
+
readonly mutable: true;
|
|
9416
9548
|
/**
|
|
9417
9549
|
* The readonly qualifier collector that defines and validates the qualifiers for this context.
|
|
9418
9550
|
*/
|
|
@@ -9490,6 +9622,14 @@ declare class SimpleContextQualifierProvider extends ContextQualifierProvider {
|
|
|
9490
9622
|
* @public
|
|
9491
9623
|
*/
|
|
9492
9624
|
clear(): void;
|
|
9625
|
+
/**
|
|
9626
|
+
* Resolves a qualifier from a name, index, or qualifier object.
|
|
9627
|
+
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
9628
|
+
* @returns `Success` with the {@link Qualifier | qualifier} if successful,
|
|
9629
|
+
* or `Failure` with an error message if not found or invalid.
|
|
9630
|
+
* @internal
|
|
9631
|
+
*/
|
|
9632
|
+
private _resolveQualifier;
|
|
9493
9633
|
/**
|
|
9494
9634
|
* Resolves a qualifier name from a name, index, or qualifier object.
|
|
9495
9635
|
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
@@ -9498,6 +9638,14 @@ declare class SimpleContextQualifierProvider extends ContextQualifierProvider {
|
|
|
9498
9638
|
* @internal
|
|
9499
9639
|
*/
|
|
9500
9640
|
private _resolveQualifierName;
|
|
9641
|
+
/**
|
|
9642
|
+
* Resolves a qualifier name from a qualifier-like object.
|
|
9643
|
+
* @param nameOrIndexOrQualifier - The input to resolve.
|
|
9644
|
+
* @returns `Success` with the {@link QualifierName | qualifier name} if successful,
|
|
9645
|
+
* or `Failure` with an error message if not found or invalid.
|
|
9646
|
+
* @internal
|
|
9647
|
+
*/
|
|
9648
|
+
private static _qualifierNameFromQualifierLike;
|
|
9501
9649
|
}
|
|
9502
9650
|
|
|
9503
9651
|
/**
|
|
@@ -9897,6 +10045,15 @@ declare function toDecisionKey(key: string): Result<DecisionKey>;
|
|
|
9897
10045
|
*/
|
|
9898
10046
|
declare function toOptionalResourceId(id?: string): Result<ResourceId | undefined>;
|
|
9899
10047
|
|
|
10048
|
+
/**
|
|
10049
|
+
* Converts a string to a {@link QualifierContextValue} if it is a valid qualifier context value.
|
|
10050
|
+
* @param value - the string to convert
|
|
10051
|
+
* @returns `Success` with the converted {@link QualifierContextValue} if successful, or `Failure` with an
|
|
10052
|
+
* error message if not.
|
|
10053
|
+
* @public
|
|
10054
|
+
*/
|
|
10055
|
+
declare function toQualifierContextValue(value: string): Result<QualifierContextValue>;
|
|
10056
|
+
|
|
9900
10057
|
/**
|
|
9901
10058
|
* Converts a string to a {@link QualifierDefaultValuesToken} if it is a valid qualifier default values token.
|
|
9902
10059
|
* @param token - the string to convert
|
|
@@ -10040,7 +10197,9 @@ declare namespace Validate {
|
|
|
10040
10197
|
isValidConditionSetHash,
|
|
10041
10198
|
isValidDecisionKey,
|
|
10042
10199
|
isValidDecisionIndex,
|
|
10200
|
+
isValidQualifierContextValue,
|
|
10043
10201
|
toQualifierName,
|
|
10202
|
+
toQualifierContextValue,
|
|
10044
10203
|
toQualifierIndex,
|
|
10045
10204
|
toQualifierTypeName,
|
|
10046
10205
|
toQualifierTypeIndex,
|
|
@@ -10213,17 +10372,17 @@ declare class ValidatingResourceTypeFactory implements IConfigInitFactory<unknow
|
|
|
10213
10372
|
|
|
10214
10373
|
/**
|
|
10215
10374
|
* A {@link Runtime.SimpleContextQualifierProvider | SimpleContextQualifierProvider} with a
|
|
10216
|
-
* {@link Runtime.Context.
|
|
10375
|
+
* {@link Runtime.Context.MutableContextQualifierProviderValidator | validator} property that enables
|
|
10217
10376
|
* validated use of the underlying provider with string keys and values.
|
|
10218
10377
|
* This eliminates the need for type casting in consumer code.
|
|
10219
10378
|
* @public
|
|
10220
10379
|
*/
|
|
10221
10380
|
declare class ValidatingSimpleContextQualifierProvider extends SimpleContextQualifierProvider {
|
|
10222
10381
|
/**
|
|
10223
|
-
* A {@link Runtime.Context.
|
|
10382
|
+
* A {@link Runtime.Context.MutableContextQualifierProviderValidator | MutableContextQualifierProviderValidator} which validates
|
|
10224
10383
|
* string inputs before passing them to this provider.
|
|
10225
10384
|
*/
|
|
10226
|
-
readonly validating:
|
|
10385
|
+
readonly validating: IMutableContextQualifierProviderValidator;
|
|
10227
10386
|
/**
|
|
10228
10387
|
* Constructor for a {@link Runtime.ValidatingSimpleContextQualifierProvider | ValidatingSimpleContextQualifierProvider} object.
|
|
10229
10388
|
* @param params - {@link Runtime.IValidatingSimpleContextQualifierProviderCreateParams | Parameters} used to create the provider.
|
|
@@ -18,6 +18,11 @@ export declare const qualifierTypeName: import("@fgv/ts-utils").Converter<import
|
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
20
|
export declare const qualifierTypeIndex: import("@fgv/ts-utils").Converter<import("./conditions").QualifierTypeIndex, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* `Converter` which validates an `unknown` value as a {@link QualifierContextValue | QualifierContextValue}.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare const qualifierContextValue: import("@fgv/ts-utils").Converter<import("./conditions").QualifierContextValue, unknown>;
|
|
21
26
|
/**
|
|
22
27
|
* `Converter` which validates an `unknown` value as a {@link QualifierConditionValue | QualifierConditionValue}.
|
|
23
28
|
* @public
|
|
@@ -54,7 +54,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
54
54
|
};
|
|
55
55
|
})();
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.contextToken = exports.contextQualifierToken = exports.resourceValueMergeMethod = exports.candidateValueIndex = exports.candidateValueKey = exports.resourceTypeIndex = exports.resourceTypeName = exports.resourceIndex = exports.resourceName = exports.resourceId = exports.decisionKey = exports.decisionIndex = exports.conditionSetHash = exports.conditionSetToken = exports.conditionSetKey = exports.conditionSetIndex = exports.conditionToken = exports.conditionKey = exports.conditionIndex = exports.conditionOperator = exports.conditionPriority = exports.qualifierMatchScore = exports.qualifierTypeIndex = exports.qualifierTypeName = exports.qualifierIndex = exports.qualifierName = void 0;
|
|
57
|
+
exports.qualifierDefaultValuesToken = exports.qualifierDefaultValueToken = exports.contextToken = exports.contextQualifierToken = exports.resourceValueMergeMethod = exports.candidateValueIndex = exports.candidateValueKey = exports.resourceTypeIndex = exports.resourceTypeName = exports.resourceIndex = exports.resourceName = exports.resourceId = exports.decisionKey = exports.decisionIndex = exports.conditionSetHash = exports.conditionSetToken = exports.conditionSetKey = exports.conditionSetIndex = exports.conditionToken = exports.conditionKey = exports.conditionIndex = exports.conditionOperator = exports.conditionPriority = exports.qualifierMatchScore = exports.qualifierContextValue = exports.qualifierTypeIndex = exports.qualifierTypeName = exports.qualifierIndex = exports.qualifierName = void 0;
|
|
58
58
|
const ts_utils_1 = require("@fgv/ts-utils");
|
|
59
59
|
const Validate = __importStar(require("./validate"));
|
|
60
60
|
const conditions_1 = require("./conditions");
|
|
@@ -80,6 +80,11 @@ exports.qualifierTypeName = ts_utils_1.Converters.string.map(Validate.toQualifie
|
|
|
80
80
|
* @public
|
|
81
81
|
*/
|
|
82
82
|
exports.qualifierTypeIndex = ts_utils_1.Converters.number.map(Validate.toQualifierTypeIndex);
|
|
83
|
+
/**
|
|
84
|
+
* `Converter` which validates an `unknown` value as a {@link QualifierContextValue | QualifierContextValue}.
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
exports.qualifierContextValue = ts_utils_1.Converters.string.map(Validate.toQualifierContextValue);
|
|
83
88
|
/**
|
|
84
89
|
* `Converter` which validates an `unknown` value as a {@link QualifierConditionValue | QualifierConditionValue}.
|
|
85
90
|
* @public
|