@fgv/ts-res 5.0.0-27 → 5.0.0-28

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 CHANGED
@@ -7,6 +7,7 @@ import { FileTree } from '@fgv/ts-utils';
7
7
  import { Hash } from '@fgv/ts-utils';
8
8
  import { ICollectible } from '@fgv/ts-utils';
9
9
  import { IReadOnlyResultMap } from '@fgv/ts-utils';
10
+ import { JsonCompatible } from '@fgv/ts-json-base';
10
11
  import { JsonObject } from '@fgv/ts-json-base';
11
12
  import { JsonValue } from '@fgv/ts-json-base';
12
13
  import { ObjectConverter } from '@fgv/ts-utils';
@@ -189,12 +190,15 @@ declare function buildQualifierDefaultValuesToken(parts: ReadonlyArray<IQualifie
189
190
  declare function buildQualifierDefaultValueToken({ qualifier, value }: IQualifierDefaultValueTokenParts): Result<QualifierDefaultValueToken>;
190
191
 
191
192
  /**
192
- * A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.ISystemQualifierTypeConfig | system qualifier type configuration}.
193
+ * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from
194
+ * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.
195
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
196
+ * if successful, `Failure` with an error message otherwise.
193
197
  * @public
194
198
  */
195
- declare class BuiltInQualifierTypeFactory implements IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType> {
199
+ declare class BuiltInQualifierTypeFactory implements IConfigInitFactory<QualifierTypes.Config.ISystemQualifierTypeConfig, SystemQualifierType> {
196
200
  /** {@inheritDoc Config.IConfigInitFactory.create} */
197
- create(config: QualifierTypes.Config.IAnyQualifierTypeConfig): Result<QualifierType>;
201
+ create(config: QualifierTypes.Config.IAnyQualifierTypeConfig): Result<SystemQualifierType>;
198
202
  }
199
203
 
200
204
  /**
@@ -2358,16 +2362,16 @@ declare namespace Convert_9 {
2358
2362
  declare function createQualifierTypeFromConfig(typeConfig: Config_2.IAnyQualifierTypeConfig): Result<QualifierType>;
2359
2363
 
2360
2364
  /**
2361
- * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
2365
+ * Creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from a system configuration object.
2362
2366
  * This factory function determines the appropriate qualifier type based on the systemType
2363
2367
  * and delegates to the appropriate type-specific createFromConfig method.
2364
2368
  * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}
2365
2369
  * containing the name, systemType, and optional type-specific configuration.
2366
- * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
2370
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
2367
2371
  * if successful, `Failure` with an error message otherwise.
2368
2372
  * @public
2369
2373
  */
2370
- declare function createQualifierTypeFromSystemConfig(typeConfig: Config_2.ISystemQualifierTypeConfig): Result<QualifierType>;
2374
+ declare function createQualifierTypeFromSystemConfig(typeConfig: Config_2.ISystemQualifierTypeConfig): Result<SystemQualifierType>;
2371
2375
 
2372
2376
  /**
2373
2377
  * Creates a {@link ResourceTypes.ResourceType | ResourceType} from a configuration object.
@@ -4144,7 +4148,7 @@ declare interface ILiteralValue<T extends string> {
4144
4148
  */
4145
4149
  declare interface ILiteralValueHierarchyCreateParams<T extends string = string> {
4146
4150
  values: ReadonlyArray<T>;
4147
- hierarchy?: LiteralValueHierarchyDecl<T>;
4151
+ hierarchy?: Partial<LiteralValueHierarchyDecl<T>>;
4148
4152
  }
4149
4153
 
4150
4154
  /**
@@ -4574,7 +4578,7 @@ declare interface IQualifierDefaultValueTokenParts {
4574
4578
  * territories, etc).
4575
4579
  * @public
4576
4580
  */
4577
- declare interface IQualifierType extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
4581
+ declare interface IQualifierType<TCFGJSON extends JsonObject = JsonObject> extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
4578
4582
  /**
4579
4583
  * The name of the qualifier type.
4580
4584
  */
@@ -4649,13 +4653,13 @@ declare interface IQualifierType extends ICollectible<QualifierTypeName, Qualifi
4649
4653
  * Gets the configuration for this qualifier type.
4650
4654
  * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
4651
4655
  */
4652
- getConfigurationJson(): Result<JsonObject>;
4656
+ getConfigurationJson(): Result<JsonCompatible<Config_2.IQualifierTypeConfig<TCFGJSON>>>;
4653
4657
  /**
4654
4658
  * Validates configuration JSON data for this qualifier type.
4655
4659
  * @param from - The unknown data to validate as configuration JSON.
4656
4660
  * @returns `Success` with validated JSON configuration if valid, `Failure` with an error message otherwise.
4657
4661
  */
4658
- validateConfigurationJson(from: unknown): Result<JsonObject>;
4662
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config_2.IQualifierTypeConfig<TCFGJSON>>>;
4659
4663
  }
4660
4664
 
4661
4665
  /**
@@ -5465,10 +5469,10 @@ declare interface IResourceType<T = unknown> extends ICollectible<ResourceTypeNa
5465
5469
  * Configuration for a {@link ResourceTypes.ResourceType | resource type}.
5466
5470
  * @public
5467
5471
  */
5468
- declare interface IResourceTypeConfig {
5472
+ declare interface IResourceTypeConfig<T extends JsonObject = JsonObject> {
5469
5473
  name: string;
5470
5474
  typeName: string;
5471
- template?: JsonObject;
5475
+ template?: T;
5472
5476
  }
5473
5477
 
5474
5478
  /**
@@ -6272,7 +6276,7 @@ declare const LanguagePrioritySystemConfiguration: ISystemConfiguration;
6272
6276
  * Accepts a list of language tags in the context by default.
6273
6277
  * @public
6274
6278
  */
6275
- declare class LanguageQualifierType extends QualifierType {
6279
+ declare class LanguageQualifierType extends QualifierType<JsonCompatible<Config_2.ILanguageQualifierTypeConfig>> {
6276
6280
  /**
6277
6281
  * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
6278
6282
  */
@@ -6315,11 +6319,11 @@ declare class LanguageQualifierType extends QualifierType {
6315
6319
  /**
6316
6320
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
6317
6321
  */
6318
- getConfigurationJson(): Result<JsonObject>;
6322
+ getConfigurationJson(): Result<JsonCompatible<Config_2.ISystemLanguageQualifierTypeConfig>>;
6319
6323
  /**
6320
6324
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
6321
6325
  */
6322
- validateConfigurationJson(from: unknown): Result<JsonObject>;
6326
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config_2.ISystemLanguageQualifierTypeConfig>>;
6323
6327
  /**
6324
6328
  * Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
6325
6329
  * for this qualifier type.
@@ -6350,7 +6354,7 @@ declare const languageQualifierTypeConfig: ObjectConverter<Model_2.ILanguageQual
6350
6354
  * optionally case-sensitive or matching against an ordered list of values at runtime.
6351
6355
  * @public
6352
6356
  */
6353
- declare class LiteralQualifierType extends QualifierType {
6357
+ declare class LiteralQualifierType extends QualifierType<JsonCompatible<Config_2.ILiteralQualifierTypeConfig>> {
6354
6358
  /**
6355
6359
  * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
6356
6360
  */
@@ -6399,11 +6403,11 @@ declare class LiteralQualifierType extends QualifierType {
6399
6403
  /**
6400
6404
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
6401
6405
  */
6402
- getConfigurationJson(): Result<JsonObject>;
6406
+ getConfigurationJson(): Result<JsonCompatible<Config_2.ISystemLiteralQualifierTypeConfig>>;
6403
6407
  /**
6404
6408
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
6405
6409
  */
6406
- validateConfigurationJson(from: unknown): Result<JsonObject>;
6410
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config_2.ISystemLiteralQualifierTypeConfig>>;
6407
6411
  /**
6408
6412
  * Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
6409
6413
  * for this qualifier type.
@@ -6564,7 +6568,7 @@ declare function literalValueHierarchyCreateParams<T extends string>(valueConver
6564
6568
  * determine the relationship between values when matching conditions and contexts.
6565
6569
  * @public
6566
6570
  */
6567
- declare type LiteralValueHierarchyDecl<T extends string> = Partial<Record<T, T>>;
6571
+ declare type LiteralValueHierarchyDecl<T extends string> = Record<T, T>;
6568
6572
 
6569
6573
  /**
6570
6574
  * `Converter` for a normalized {@link ResourceJson.Json.ILooseConditionDecl | loose condition declaration}.
@@ -7325,7 +7329,7 @@ export { Qualifiers }
7325
7329
  * the {@link QualifierTypes.IQualifierType | IQualifierType} interface.
7326
7330
  * @public
7327
7331
  */
7328
- export declare abstract class QualifierType implements IQualifierType {
7332
+ export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonObject> implements IQualifierType<TCFGJSON> {
7329
7333
  /**
7330
7334
  * {@inheritdoc QualifierTypes.IQualifierType.name}
7331
7335
  */
@@ -7382,11 +7386,11 @@ export declare abstract class QualifierType implements IQualifierType {
7382
7386
  /**
7383
7387
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
7384
7388
  */
7385
- abstract getConfigurationJson(): Result<JsonObject>;
7389
+ abstract getConfigurationJson(): Result<JsonCompatible<Config_2.IQualifierTypeConfig<TCFGJSON>>>;
7386
7390
  /**
7387
7391
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
7388
7392
  */
7389
- abstract validateConfigurationJson(from: unknown): Result<JsonObject>;
7393
+ abstract validateConfigurationJson(from: unknown): Result<JsonCompatible<Config_2.IQualifierTypeConfig<TCFGJSON>>>;
7390
7394
  /**
7391
7395
  * {@inheritdoc QualifierTypes.IQualifierType.setIndex}
7392
7396
  */
@@ -7442,7 +7446,7 @@ export declare abstract class QualifierType implements IQualifierType {
7442
7446
  * index from a supplied {@link QualifierTypes.Convert.IQualifierTypeConvertContext | conversion context}.
7443
7447
  * @public
7444
7448
  */
7445
- declare const qualifierType: Converter<QualifierType, IQualifierTypeConvertContext>;
7449
+ declare const qualifierType: Converter<QualifierType<JsonObject>, IQualifierTypeConvertContext>;
7446
7450
 
7447
7451
  /**
7448
7452
  * Collector for {@link QualifierTypes.QualifierType | QualifierType} objects.
@@ -7475,17 +7479,54 @@ declare class QualifierTypeCollector extends ValidatingConvertingCollector<Quali
7475
7479
  declare function qualifierTypeConfig<T, TD = unknown>(config: Converter<T, TD>): Converter<Model_2.IQualifierTypeConfig<T>, TD>;
7476
7480
 
7477
7481
  /**
7478
- * A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | system qualifier type configuration}
7479
- * by chaining a supplied factory with a {@link Config.BuiltInQualifierTypeFactory | built-in factory} that handles built-in qualifier types.
7482
+ * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,
7483
+ * supporting both built-in system types and custom external types.
7484
+ *
7485
+ * This factory allows external consumers to extend the qualifier type system with their own custom types
7486
+ * while maintaining support for all built-in types (Language, Territory, Literal).
7487
+ *
7488
+ * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.
7489
+ *
7490
+ * @example Creating a factory with custom qualifier types
7491
+ * ```typescript
7492
+ * // Define a custom qualifier type
7493
+ * class CustomQualifierType extends QualifierType {
7494
+ * // ... implementation
7495
+ * }
7496
+ *
7497
+ * // Define a discriminated union of all types
7498
+ * type AppQualifierType = SystemQualifierType | CustomQualifierType;
7499
+ *
7500
+ * // Create a factory that handles custom types
7501
+ * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {
7502
+ * create(config) {
7503
+ * // ... handle custom type creation
7504
+ * }
7505
+ * };
7506
+ *
7507
+ * // Create the combined factory
7508
+ * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);
7509
+ *
7510
+ * // The factory returns T | SystemQualifierType, supporting all types
7511
+ * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>
7512
+ * ```
7513
+ *
7514
+ * @remarks
7515
+ * - The factory chains custom factories with the built-in factory
7516
+ * - Custom factories are tried first, falling back to built-in types
7517
+ * - The return type is a union of custom types (T) and system types
7518
+ *
7480
7519
  * @public
7481
7520
  */
7482
- declare class QualifierTypeFactory extends ChainedConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType> {
7521
+ declare class QualifierTypeFactory<T extends QualifierType = SystemQualifierType> extends ChainedConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T | SystemQualifierType> {
7483
7522
  /**
7484
7523
  * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.
7485
- * @param factories - The {@link Config.IConfigInitFactory | factories} to chain.
7486
- * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always added to the end of the chain.
7524
+ * @param factories - Array of {@link Config.IConfigInitFactory | factories} for custom qualifier types.
7525
+ * These are tried in order before falling back to built-in types.
7526
+ * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle
7527
+ * system qualifier types (Language, Territory, Literal).
7487
7528
  */
7488
- constructor(factories: IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType>[]);
7529
+ constructor(factories: IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T>[]);
7489
7530
  }
7490
7531
 
7491
7532
  /**
@@ -7532,7 +7573,8 @@ declare namespace QualifierTypes {
7532
7573
  QualifierTypeCollector,
7533
7574
  ReadOnlyQualifierTypeCollector,
7534
7575
  createQualifierTypeFromConfig,
7535
- createQualifierTypeFromSystemConfig
7576
+ createQualifierTypeFromSystemConfig,
7577
+ SystemQualifierType
7536
7578
  }
7537
7579
  }
7538
7580
  export { QualifierTypes }
@@ -9205,7 +9247,7 @@ declare class ResourceTypeCollector extends ValidatingCollector<ResourceType> {
9205
9247
  * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
9206
9248
  * @public
9207
9249
  */
9208
- declare const resourceTypeConfig: ObjectConverter<IResourceTypeConfig, unknown>;
9250
+ declare const resourceTypeConfig: ObjectConverter<IResourceTypeConfig<JsonObject>, unknown>;
9209
9251
 
9210
9252
  /**
9211
9253
  * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}
@@ -9518,6 +9560,14 @@ declare const systemLanguageQualifierTypeConfig: ObjectConverter<Model_2.ISystem
9518
9560
  */
9519
9561
  declare const systemLiteralQualifierTypeConfig: ObjectConverter<Model_2.ISystemLiteralQualifierTypeConfig, unknown>;
9520
9562
 
9563
+ /**
9564
+ * A discriminated union of all system qualifier types.
9565
+ * This allows TypeScript to properly discriminate between specific qualifier type implementations
9566
+ * and access their specific methods like getConfiguration().
9567
+ * @public
9568
+ */
9569
+ declare type SystemQualifierType = LanguageQualifierType | TerritoryQualifierType | LiteralQualifierType;
9570
+
9521
9571
  /**
9522
9572
  * A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
9523
9573
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
@@ -9561,7 +9611,7 @@ declare const TerritoryPrioritySystemConfiguration: ISystemConfiguration;
9561
9611
  * implementation handles incorrect casing.
9562
9612
  * @public
9563
9613
  */
9564
- declare class TerritoryQualifierType extends QualifierType {
9614
+ declare class TerritoryQualifierType extends QualifierType<JsonCompatible<Config_2.ITerritoryQualifierTypeConfig>> {
9565
9615
  /**
9566
9616
  * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
9567
9617
  */
@@ -9608,17 +9658,19 @@ declare class TerritoryQualifierType extends QualifierType {
9608
9658
  */
9609
9659
  static createFromConfig(config: Config_2.IQualifierTypeConfig<Config_2.ITerritoryQualifierTypeConfig>): Result<TerritoryQualifierType>;
9610
9660
  /**
9611
- * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
9661
+ * Gets the {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration}
9662
+ * for this qualifier type.
9663
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
9612
9664
  */
9613
9665
  getConfiguration(): Result<Config_2.ISystemTerritoryQualifierTypeConfig>;
9614
9666
  /**
9615
9667
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
9616
9668
  */
9617
- getConfigurationJson(): Result<JsonObject>;
9669
+ getConfigurationJson(): Result<JsonCompatible<Config_2.ISystemTerritoryQualifierTypeConfig>>;
9618
9670
  /**
9619
9671
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
9620
9672
  */
9621
- validateConfigurationJson(from: unknown): Result<JsonObject>;
9673
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config_2.ISystemTerritoryQualifierTypeConfig>>;
9622
9674
  /**
9623
9675
  * Validates a {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration object}
9624
9676
  * for this qualifier type.
@@ -1,5 +1,5 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
- import { QualifierType } from '../qualifier-types';
2
+ import { QualifierType, SystemQualifierType } from '../qualifier-types';
3
3
  import * as QualifierTypes from '../qualifier-types';
4
4
  import * as ResourceTypes from '../resource-types';
5
5
  import { ResourceType } from '../resource-types';
@@ -34,25 +34,65 @@ export declare class ChainedConfigInitFactory<TConfig, T> implements IConfigInit
34
34
  create(config: TConfig): Result<T>;
35
35
  }
36
36
  /**
37
- * A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.ISystemQualifierTypeConfig | system qualifier type configuration}.
37
+ * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from
38
+ * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.
39
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
40
+ * if successful, `Failure` with an error message otherwise.
38
41
  * @public
39
42
  */
40
- export declare class BuiltInQualifierTypeFactory implements IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType> {
43
+ export declare class BuiltInQualifierTypeFactory implements IConfigInitFactory<QualifierTypes.Config.ISystemQualifierTypeConfig, SystemQualifierType> {
41
44
  /** {@inheritDoc Config.IConfigInitFactory.create} */
42
- create(config: QualifierTypes.Config.IAnyQualifierTypeConfig): Result<QualifierType>;
45
+ create(config: QualifierTypes.Config.IAnyQualifierTypeConfig): Result<SystemQualifierType>;
43
46
  }
44
47
  /**
45
- * A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | system qualifier type configuration}
46
- * by chaining a supplied factory with a {@link Config.BuiltInQualifierTypeFactory | built-in factory} that handles built-in qualifier types.
48
+ * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,
49
+ * supporting both built-in system types and custom external types.
50
+ *
51
+ * This factory allows external consumers to extend the qualifier type system with their own custom types
52
+ * while maintaining support for all built-in types (Language, Territory, Literal).
53
+ *
54
+ * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.
55
+ *
56
+ * @example Creating a factory with custom qualifier types
57
+ * ```typescript
58
+ * // Define a custom qualifier type
59
+ * class CustomQualifierType extends QualifierType {
60
+ * // ... implementation
61
+ * }
62
+ *
63
+ * // Define a discriminated union of all types
64
+ * type AppQualifierType = SystemQualifierType | CustomQualifierType;
65
+ *
66
+ * // Create a factory that handles custom types
67
+ * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {
68
+ * create(config) {
69
+ * // ... handle custom type creation
70
+ * }
71
+ * };
72
+ *
73
+ * // Create the combined factory
74
+ * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);
75
+ *
76
+ * // The factory returns T | SystemQualifierType, supporting all types
77
+ * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>
78
+ * ```
79
+ *
80
+ * @remarks
81
+ * - The factory chains custom factories with the built-in factory
82
+ * - Custom factories are tried first, falling back to built-in types
83
+ * - The return type is a union of custom types (T) and system types
84
+ *
47
85
  * @public
48
86
  */
49
- export declare class QualifierTypeFactory extends ChainedConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType> {
87
+ export declare class QualifierTypeFactory<T extends QualifierType = SystemQualifierType> extends ChainedConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T | SystemQualifierType> {
50
88
  /**
51
89
  * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.
52
- * @param factories - The {@link Config.IConfigInitFactory | factories} to chain.
53
- * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always added to the end of the chain.
90
+ * @param factories - Array of {@link Config.IConfigInitFactory | factories} for custom qualifier types.
91
+ * These are tried in order before falling back to built-in types.
92
+ * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle
93
+ * system qualifier types (Language, Territory, Literal).
54
94
  */
55
- constructor(factories: IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, QualifierType>[]);
95
+ constructor(factories: IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T>[]);
56
96
  }
57
97
  /**
58
98
  * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}.
@@ -87,7 +87,10 @@ class ChainedConfigInitFactory {
87
87
  }
88
88
  exports.ChainedConfigInitFactory = ChainedConfigInitFactory;
89
89
  /**
90
- * A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.ISystemQualifierTypeConfig | system qualifier type configuration}.
90
+ * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from
91
+ * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.
92
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
93
+ * if successful, `Failure` with an error message otherwise.
91
94
  * @public
92
95
  */
93
96
  class BuiltInQualifierTypeFactory {
@@ -101,15 +104,52 @@ class BuiltInQualifierTypeFactory {
101
104
  }
102
105
  exports.BuiltInQualifierTypeFactory = BuiltInQualifierTypeFactory;
103
106
  /**
104
- * A factory that creates a {@link QualifierTypes.QualifierType | QualifierType} from a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | system qualifier type configuration}
105
- * by chaining a supplied factory with a {@link Config.BuiltInQualifierTypeFactory | built-in factory} that handles built-in qualifier types.
107
+ * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,
108
+ * supporting both built-in system types and custom external types.
109
+ *
110
+ * This factory allows external consumers to extend the qualifier type system with their own custom types
111
+ * while maintaining support for all built-in types (Language, Territory, Literal).
112
+ *
113
+ * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.
114
+ *
115
+ * @example Creating a factory with custom qualifier types
116
+ * ```typescript
117
+ * // Define a custom qualifier type
118
+ * class CustomQualifierType extends QualifierType {
119
+ * // ... implementation
120
+ * }
121
+ *
122
+ * // Define a discriminated union of all types
123
+ * type AppQualifierType = SystemQualifierType | CustomQualifierType;
124
+ *
125
+ * // Create a factory that handles custom types
126
+ * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {
127
+ * create(config) {
128
+ * // ... handle custom type creation
129
+ * }
130
+ * };
131
+ *
132
+ * // Create the combined factory
133
+ * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);
134
+ *
135
+ * // The factory returns T | SystemQualifierType, supporting all types
136
+ * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>
137
+ * ```
138
+ *
139
+ * @remarks
140
+ * - The factory chains custom factories with the built-in factory
141
+ * - Custom factories are tried first, falling back to built-in types
142
+ * - The return type is a union of custom types (T) and system types
143
+ *
106
144
  * @public
107
145
  */
108
146
  class QualifierTypeFactory extends ChainedConfigInitFactory {
109
147
  /**
110
148
  * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.
111
- * @param factories - The {@link Config.IConfigInitFactory | factories} to chain.
112
- * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always added to the end of the chain.
149
+ * @param factories - Array of {@link Config.IConfigInitFactory | factories} for custom qualifier types.
150
+ * These are tried in order before falling back to built-in types.
151
+ * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle
152
+ * system qualifier types (Language, Territory, Literal).
113
153
  */
114
154
  constructor(factories) {
115
155
  super([...factories, new BuiltInQualifierTypeFactory()]);
@@ -24,7 +24,7 @@ export interface ILanguageQualifierTypeConfig {
24
24
  * determine the relationship between values when matching conditions and contexts.
25
25
  * @public
26
26
  */
27
- export type LiteralValueHierarchyDecl<T extends string> = Partial<Record<T, T>>;
27
+ export type LiteralValueHierarchyDecl<T extends string> = Record<T, T>;
28
28
  /**
29
29
  * Configuration for {@link QualifierTypes.TerritoryQualifierType | territory qualifier type} configuration.
30
30
  * @public
@@ -16,7 +16,7 @@ export interface IQualifierTypeConvertContext {
16
16
  * index from a supplied {@link QualifierTypes.Convert.IQualifierTypeConvertContext | conversion context}.
17
17
  * @public
18
18
  */
19
- export declare const qualifierType: Converter<QualifierType, IQualifierTypeConvertContext>;
19
+ export declare const qualifierType: Converter<QualifierType<import("@fgv/ts-json-base").JsonObject>, IQualifierTypeConvertContext>;
20
20
  /**
21
21
  * Gets a converter for {@link QualifierTypes.ILiteralValueHierarchyCreateParams | ILiteralValueHierarchyCreateParams}
22
22
  * objects with values validated by a supplied value converter.
@@ -1,6 +1,16 @@
1
1
  import { Result } from '@fgv/ts-utils';
2
2
  import * as Config from './config';
3
3
  import { QualifierType } from './qualifierType';
4
+ import { LanguageQualifierType } from './languageQualifierType';
5
+ import { TerritoryQualifierType } from './territoryQualifierType';
6
+ import { LiteralQualifierType } from './literalQualifierType';
7
+ /**
8
+ * A discriminated union of all system qualifier types.
9
+ * This allows TypeScript to properly discriminate between specific qualifier type implementations
10
+ * and access their specific methods like getConfiguration().
11
+ * @public
12
+ */
13
+ export type SystemQualifierType = LanguageQualifierType | TerritoryQualifierType | LiteralQualifierType;
4
14
  /**
5
15
  * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a configuration object.
6
16
  * This factory function determines the appropriate qualifier type based on the systemType
@@ -13,14 +23,14 @@ import { QualifierType } from './qualifierType';
13
23
  */
14
24
  export declare function createQualifierTypeFromConfig(typeConfig: Config.IAnyQualifierTypeConfig): Result<QualifierType>;
15
25
  /**
16
- * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
26
+ * Creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from a system configuration object.
17
27
  * This factory function determines the appropriate qualifier type based on the systemType
18
28
  * and delegates to the appropriate type-specific createFromConfig method.
19
29
  * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}
20
30
  * containing the name, systemType, and optional type-specific configuration.
21
- * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
31
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
22
32
  * if successful, `Failure` with an error message otherwise.
23
33
  * @public
24
34
  */
25
- export declare function createQualifierTypeFromSystemConfig(typeConfig: Config.ISystemQualifierTypeConfig): Result<QualifierType>;
35
+ export declare function createQualifierTypeFromSystemConfig(typeConfig: Config.ISystemQualifierTypeConfig): Result<SystemQualifierType>;
26
36
  //# sourceMappingURL=helpers.d.ts.map
@@ -93,12 +93,12 @@ function createQualifierTypeFromConfig(typeConfig) {
93
93
  }
94
94
  }
95
95
  /**
96
- * Creates a {@link QualifierTypes.QualifierType | QualifierType} from a system configuration object.
96
+ * Creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from a system configuration object.
97
97
  * This factory function determines the appropriate qualifier type based on the systemType
98
98
  * and delegates to the appropriate type-specific createFromConfig method.
99
99
  * @param typeConfig - The {@link QualifierTypes.Config.ISystemQualifierTypeConfig | configuration object}
100
100
  * containing the name, systemType, and optional type-specific configuration.
101
- * @returns `Success` with the new {@link QualifierTypes.QualifierType | QualifierType}
101
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
102
102
  * if successful, `Failure` with an error message otherwise.
103
103
  * @public
104
104
  */
@@ -2,7 +2,7 @@ import { Result } from '@fgv/ts-utils';
2
2
  import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore, QualifierTypeName } from '../common';
3
3
  import { IQualifierTypeCreateParams, QualifierType } from './qualifierType';
4
4
  import * as Config from './config';
5
- import { JsonObject } from '@fgv/ts-json-base';
5
+ import { JsonCompatible } from '@fgv/ts-json-base';
6
6
  /**
7
7
  * Interface defining the parameters that can be used to create a new
8
8
  * {@link QualifierTypes.LanguageQualifierType | LanguageQualifierType}.
@@ -25,7 +25,7 @@ export interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTy
25
25
  * Accepts a list of language tags in the context by default.
26
26
  * @public
27
27
  */
28
- export declare class LanguageQualifierType extends QualifierType {
28
+ export declare class LanguageQualifierType extends QualifierType<JsonCompatible<Config.ILanguageQualifierTypeConfig>> {
29
29
  /**
30
30
  * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
31
31
  */
@@ -68,11 +68,11 @@ export declare class LanguageQualifierType extends QualifierType {
68
68
  /**
69
69
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
70
70
  */
71
- getConfigurationJson(): Result<JsonObject>;
71
+ getConfigurationJson(): Result<JsonCompatible<Config.ISystemLanguageQualifierTypeConfig>>;
72
72
  /**
73
73
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
74
74
  */
75
- validateConfigurationJson(from: unknown): Result<JsonObject>;
75
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.ISystemLanguageQualifierTypeConfig>>;
76
76
  /**
77
77
  * Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
78
78
  * for this qualifier type.
@@ -146,9 +146,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
146
146
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
147
147
  */
148
148
  validateConfigurationJson(from) {
149
- return Config.Convert.systemLanguageQualifierTypeConfig
150
- .convert(from)
151
- .onSuccess((config) => (0, ts_utils_1.succeed)(config));
149
+ return Config.Convert.systemLanguageQualifierTypeConfig.convert(from);
152
150
  }
153
151
  /**
154
152
  * Validates a {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | strongly typed configuration object}
@@ -157,7 +155,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
157
155
  * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
158
156
  */
159
157
  validateConfiguration(from) {
160
- return this.validateConfigurationJson(from).onSuccess((json) => Config.Convert.systemLanguageQualifierTypeConfig.convert(json));
158
+ return Config.Convert.systemLanguageQualifierTypeConfig.convert(from);
161
159
  }
162
160
  /**
163
161
  * Matches a single language condition against a single language context value using
@@ -3,7 +3,7 @@ import { ConditionOperator, QualifierConditionValue, QualifierContextValue, Qual
3
3
  import { QualifierType } from './qualifierType';
4
4
  import { LiteralValueHierarchy } from './literalValueHierarchy';
5
5
  import * as Config from './config';
6
- import { JsonObject } from '@fgv/ts-json-base';
6
+ import { JsonCompatible } from '@fgv/ts-json-base';
7
7
  /**
8
8
  * Interface defining the parameters that can be used to create a new
9
9
  * {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
@@ -44,7 +44,7 @@ export interface ILiteralQualifierTypeCreateParams {
44
44
  * optionally case-sensitive or matching against an ordered list of values at runtime.
45
45
  * @public
46
46
  */
47
- export declare class LiteralQualifierType extends QualifierType {
47
+ export declare class LiteralQualifierType extends QualifierType<JsonCompatible<Config.ILiteralQualifierTypeConfig>> {
48
48
  /**
49
49
  * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
50
50
  */
@@ -93,11 +93,11 @@ export declare class LiteralQualifierType extends QualifierType {
93
93
  /**
94
94
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
95
95
  */
96
- getConfigurationJson(): Result<JsonObject>;
96
+ getConfigurationJson(): Result<JsonCompatible<Config.ISystemLiteralQualifierTypeConfig>>;
97
97
  /**
98
98
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
99
99
  */
100
- validateConfigurationJson(from: unknown): Result<JsonObject>;
100
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.ISystemLiteralQualifierTypeConfig>>;
101
101
  /**
102
102
  * Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
103
103
  * for this qualifier type.
@@ -155,9 +155,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
155
155
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
156
156
  */
157
157
  validateConfigurationJson(from) {
158
- return Config.Convert.systemLiteralQualifierTypeConfig
159
- .convert(from)
160
- .onSuccess((config) => (0, ts_utils_1.succeed)(config));
158
+ return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
161
159
  }
162
160
  /**
163
161
  * Validates a {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | strongly typed configuration object}
@@ -166,7 +164,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
166
164
  * @returns `Success` with the validated configuration if successful, `Failure` with an error message otherwise.
167
165
  */
168
166
  validateConfiguration(from) {
169
- return this.validateConfigurationJson(from).onSuccess((json) => Config.Convert.systemLiteralQualifierTypeConfig.convert(json));
167
+ return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
170
168
  }
171
169
  /**
172
170
  * {@inheritdoc QualifierTypes.QualifierType._matchOne}
@@ -17,7 +17,7 @@ export interface ILiteralValue<T extends string> {
17
17
  */
18
18
  export interface ILiteralValueHierarchyCreateParams<T extends string = string> {
19
19
  values: ReadonlyArray<T>;
20
- hierarchy?: LiteralValueHierarchyDecl<T>;
20
+ hierarchy?: Partial<LiteralValueHierarchyDecl<T>>;
21
21
  }
22
22
  /**
23
23
  * A class that implements a hierarchy of literal values. The hierarchy is defined as a
@@ -1,13 +1,14 @@
1
1
  import { Collections, ICollectible, Result } from '@fgv/ts-utils';
2
2
  import { ConditionOperator, QualifierConditionValue, QualifierContextValue, QualifierMatchScore, QualifierTypeIndex, QualifierTypeName } from '../common';
3
- import { JsonObject } from '@fgv/ts-json-base';
3
+ import { JsonCompatible, JsonObject } from '@fgv/ts-json-base';
4
+ import * as Config from './config';
4
5
  /**
5
6
  * Interface for a qualifier type. A qualifier type implements the build and
6
7
  * runtime semantics for some class of related qualifiers (e.g. language,
7
8
  * territories, etc).
8
9
  * @public
9
10
  */
10
- export interface IQualifierType extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
11
+ export interface IQualifierType<TCFGJSON extends JsonObject = JsonObject> extends ICollectible<QualifierTypeName, QualifierTypeIndex> {
11
12
  /**
12
13
  * The name of the qualifier type.
13
14
  */
@@ -82,13 +83,13 @@ export interface IQualifierType extends ICollectible<QualifierTypeName, Qualifie
82
83
  * Gets the configuration for this qualifier type.
83
84
  * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
84
85
  */
85
- getConfigurationJson(): Result<JsonObject>;
86
+ getConfigurationJson(): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
86
87
  /**
87
88
  * Validates configuration JSON data for this qualifier type.
88
89
  * @param from - The unknown data to validate as configuration JSON.
89
90
  * @returns `Success` with validated JSON configuration if valid, `Failure` with an error message otherwise.
90
91
  */
91
- validateConfigurationJson(from: unknown): Result<JsonObject>;
92
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
92
93
  }
93
94
  /**
94
95
  * Parameters used to create a base {@link QualifierTypes.QualifierType | qualifier type}.
@@ -114,7 +115,7 @@ export interface IQualifierTypeCreateParams {
114
115
  * the {@link QualifierTypes.IQualifierType | IQualifierType} interface.
115
116
  * @public
116
117
  */
117
- export declare abstract class QualifierType implements IQualifierType {
118
+ export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonObject> implements IQualifierType<TCFGJSON> {
118
119
  /**
119
120
  * {@inheritdoc QualifierTypes.IQualifierType.name}
120
121
  */
@@ -171,11 +172,11 @@ export declare abstract class QualifierType implements IQualifierType {
171
172
  /**
172
173
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
173
174
  */
174
- abstract getConfigurationJson(): Result<JsonObject>;
175
+ abstract getConfigurationJson(): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
175
176
  /**
176
177
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
177
178
  */
178
- abstract validateConfigurationJson(from: unknown): Result<JsonObject>;
179
+ abstract validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.IQualifierTypeConfig<TCFGJSON>>>;
179
180
  /**
180
181
  * {@inheritdoc QualifierTypes.IQualifierType.setIndex}
181
182
  */
@@ -3,7 +3,7 @@ import { QualifierConditionValue, QualifierContextValue, QualifierMatchScore, Co
3
3
  import { QualifierType } from './qualifierType';
4
4
  import { LiteralValueHierarchy } from './literalValueHierarchy';
5
5
  import * as Config from './config';
6
- import { JsonObject } from '@fgv/ts-json-base';
6
+ import { JsonCompatible } from '@fgv/ts-json-base';
7
7
  /**
8
8
  * Parameters used to create a new {@link QualifierTypes.TerritoryQualifierType | TerritoryQualifierType} instance.
9
9
  * @public
@@ -42,7 +42,7 @@ export interface ITerritoryQualifierTypeCreateParams {
42
42
  * implementation handles incorrect casing.
43
43
  * @public
44
44
  */
45
- export declare class TerritoryQualifierType extends QualifierType {
45
+ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible<Config.ITerritoryQualifierTypeConfig>> {
46
46
  /**
47
47
  * {@inheritdoc QualifierTypes.IQualifierType.systemTypeName}
48
48
  */
@@ -89,17 +89,19 @@ export declare class TerritoryQualifierType extends QualifierType {
89
89
  */
90
90
  static createFromConfig(config: Config.IQualifierTypeConfig<Config.ITerritoryQualifierTypeConfig>): Result<TerritoryQualifierType>;
91
91
  /**
92
- * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
92
+ * Gets the {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration}
93
+ * for this qualifier type.
94
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
93
95
  */
94
96
  getConfiguration(): Result<Config.ISystemTerritoryQualifierTypeConfig>;
95
97
  /**
96
98
  * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
97
99
  */
98
- getConfigurationJson(): Result<JsonObject>;
100
+ getConfigurationJson(): Result<JsonCompatible<Config.ISystemTerritoryQualifierTypeConfig>>;
99
101
  /**
100
102
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
101
103
  */
102
- validateConfigurationJson(from: unknown): Result<JsonObject>;
104
+ validateConfigurationJson(from: unknown): Result<JsonCompatible<Config.ISystemTerritoryQualifierTypeConfig>>;
103
105
  /**
104
106
  * Validates a {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration object}
105
107
  * for this qualifier type.
@@ -147,7 +147,9 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
147
147
  }).onSuccess(TerritoryQualifierType.create);
148
148
  }
149
149
  /**
150
- * {@inheritdoc QualifierTypes.IQualifierType.getConfigurationJson}
150
+ * Gets the {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration}
151
+ * for this qualifier type.
152
+ * @returns `Success` with the configuration if successful, `Failure` with an error message otherwise.
151
153
  */
152
154
  getConfiguration() {
153
155
  return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
@@ -170,9 +172,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
170
172
  * {@inheritdoc QualifierTypes.IQualifierType.validateConfigurationJson}
171
173
  */
172
174
  validateConfigurationJson(from) {
173
- return Config.Convert.systemTerritoryQualifierTypeConfig
174
- .convert(from)
175
- .onSuccess((config) => (0, ts_utils_1.succeed)(config));
175
+ return Config.Convert.systemTerritoryQualifierTypeConfig.convert(from);
176
176
  }
177
177
  /**
178
178
  * Validates a {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | strongly typed configuration object}
@@ -4,5 +4,5 @@ import { IResourceTypeConfig } from './json';
4
4
  * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
5
5
  * @public
6
6
  */
7
- export declare const resourceTypeConfig: import("@fgv/ts-utils").ObjectConverter<IResourceTypeConfig, unknown>;
7
+ export declare const resourceTypeConfig: import("@fgv/ts-utils").ObjectConverter<IResourceTypeConfig<import("@fgv/ts-json-base").JsonObject>, unknown>;
8
8
  //# sourceMappingURL=convert.d.ts.map
@@ -3,9 +3,9 @@ import { JsonObject } from '@fgv/ts-json-base';
3
3
  * Configuration for a {@link ResourceTypes.ResourceType | resource type}.
4
4
  * @public
5
5
  */
6
- export interface IResourceTypeConfig {
6
+ export interface IResourceTypeConfig<T extends JsonObject = JsonObject> {
7
7
  name: string;
8
8
  typeName: string;
9
- template?: JsonObject;
9
+ template?: T;
10
10
  }
11
11
  //# sourceMappingURL=json.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fgv/ts-res",
3
- "version": "5.0.0-27",
3
+ "version": "5.0.0-28",
4
4
  "description": "Multi-dimensional Resource Runtime",
5
5
  "main": "lib/index.js",
6
6
  "types": "dist/ts-res.d.ts",
@@ -44,16 +44,16 @@
44
44
  "@rushstack/heft-node-rig": "2.9.5",
45
45
  "@types/heft-jest": "1.0.6",
46
46
  "eslint-plugin-tsdoc": "~0.4.0",
47
- "@fgv/ts-utils-jest": "5.0.0-27",
48
- "@fgv/ts-extras": "5.0.0-27"
47
+ "@fgv/ts-extras": "5.0.0-28",
48
+ "@fgv/ts-utils-jest": "5.0.0-28"
49
49
  },
50
50
  "dependencies": {
51
51
  "luxon": "^3.7.2",
52
52
  "fflate": "~0.8.2",
53
- "@fgv/ts-utils": "5.0.0-27",
54
- "@fgv/ts-bcp47": "5.0.0-27",
55
- "@fgv/ts-json-base": "5.0.0-27",
56
- "@fgv/ts-json": "5.0.0-27"
53
+ "@fgv/ts-json-base": "5.0.0-28",
54
+ "@fgv/ts-bcp47": "5.0.0-28",
55
+ "@fgv/ts-utils": "5.0.0-28",
56
+ "@fgv/ts-json": "5.0.0-28"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "heft build --clean",