@fgv/ts-res 5.1.0-1 → 5.1.0-11

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.
Files changed (57) hide show
  1. package/dist/packlets/config/common.js +78 -0
  2. package/dist/packlets/config/configInitFactory.js +258 -0
  3. package/dist/packlets/config/convert.js +56 -0
  4. package/dist/packlets/config/index.browser.js +34 -0
  5. package/dist/packlets/config/index.js +28 -0
  6. package/dist/packlets/config/json.js +23 -0
  7. package/dist/packlets/config/predefined/default.js +138 -0
  8. package/dist/packlets/config/predefined/extended.js +190 -0
  9. package/dist/packlets/config/predefined/index.js +25 -0
  10. package/dist/packlets/config/systemConfiguration.js +147 -0
  11. package/dist/packlets/import/importManager.js +7 -3
  12. package/dist/packlets/import/importers/fsItemImporter.js +29 -13
  13. package/dist/packlets/qualifier-types/config/convert.js +124 -0
  14. package/dist/packlets/qualifier-types/config/index.js +25 -0
  15. package/dist/packlets/qualifier-types/config/json.js +32 -0
  16. package/dist/packlets/resource-types/config/convert.js +35 -0
  17. package/dist/packlets/resource-types/config/index.js +25 -0
  18. package/dist/packlets/resource-types/config/json.js +23 -0
  19. package/dist/ts-res.d.ts +26 -1
  20. package/dist/tsdoc-metadata.json +1 -1
  21. package/lib/packlets/config/common.d.ts +35 -0
  22. package/lib/packlets/config/common.js +97 -0
  23. package/lib/packlets/config/configInitFactory.d.ts +217 -0
  24. package/lib/packlets/config/configInitFactory.js +303 -0
  25. package/lib/packlets/config/convert.d.ts +23 -0
  26. package/lib/packlets/config/convert.js +93 -0
  27. package/lib/packlets/config/index.browser.d.ts +7 -0
  28. package/lib/packlets/config/index.browser.js +74 -0
  29. package/lib/packlets/config/index.d.ts +7 -0
  30. package/lib/packlets/config/index.js +68 -0
  31. package/lib/packlets/config/json.d.ts +20 -0
  32. package/lib/packlets/config/json.js +24 -0
  33. package/lib/packlets/config/predefined/default.d.ts +57 -0
  34. package/lib/packlets/config/predefined/default.js +141 -0
  35. package/lib/packlets/config/predefined/extended.d.ts +25 -0
  36. package/lib/packlets/config/predefined/extended.js +193 -0
  37. package/lib/packlets/config/predefined/index.d.ts +4 -0
  38. package/lib/packlets/config/predefined/index.js +62 -0
  39. package/lib/packlets/config/systemConfiguration.d.ts +94 -0
  40. package/lib/packlets/config/systemConfiguration.js +152 -0
  41. package/lib/packlets/import/importManager.d.ts +15 -1
  42. package/lib/packlets/import/importManager.js +7 -3
  43. package/lib/packlets/import/importers/fsItemImporter.d.ts +15 -1
  44. package/lib/packlets/import/importers/fsItemImporter.js +28 -12
  45. package/lib/packlets/qualifier-types/config/convert.d.ts +65 -0
  46. package/lib/packlets/qualifier-types/config/convert.js +161 -0
  47. package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
  48. package/lib/packlets/qualifier-types/config/index.js +64 -0
  49. package/lib/packlets/qualifier-types/config/json.d.ts +91 -0
  50. package/lib/packlets/qualifier-types/config/json.js +35 -0
  51. package/lib/packlets/resource-types/config/convert.d.ts +8 -0
  52. package/lib/packlets/resource-types/config/convert.js +38 -0
  53. package/lib/packlets/resource-types/config/index.d.ts +4 -0
  54. package/lib/packlets/resource-types/config/index.js +64 -0
  55. package/lib/packlets/resource-types/config/json.d.ts +11 -0
  56. package/lib/packlets/resource-types/config/json.js +24 -0
  57. package/package.json +28 -26
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /* eslint-disable @rushstack/typedef-var */
23
+ import { Converters } from '@fgv/ts-utils';
24
+ import { Converters as JsonConverters } from '@fgv/ts-json-base';
25
+ /**
26
+ * A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
27
+ * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
28
+ * @public
29
+ */
30
+ export const resourceTypeConfig = Converters.strictObject({
31
+ name: Converters.string,
32
+ typeName: Converters.string,
33
+ template: JsonConverters.jsonObject.optional()
34
+ });
35
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import * as Convert from './convert';
23
+ export * from './json';
24
+ export { Convert };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) 2025 Erik Fortune
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export {};
23
+ //# sourceMappingURL=json.js.map
package/dist/ts-res.d.ts CHANGED
@@ -2824,6 +2824,14 @@ declare class FsItemImporter implements IImporter {
2824
2824
  * The {@link Qualifiers.IReadOnlyQualifierCollector | qualifier collector} to use for this importer.
2825
2825
  */
2826
2826
  readonly qualifiers: IReadOnlyQualifierCollector;
2827
+ /**
2828
+ * Optional converter used to parse raw file contents before they are exposed as JSON importables.
2829
+ */
2830
+ readonly fileContentConverter?: Converter<JsonValue>;
2831
+ /**
2832
+ * Optional list of file extensions which should be parsed using the file content converter.
2833
+ */
2834
+ readonly fileContentExtensions?: ReadonlyArray<string>;
2827
2835
  /**
2828
2836
  * The types of {@link Import.IImportable | importables} that this importer can handle.
2829
2837
  */
@@ -2843,6 +2851,9 @@ declare class FsItemImporter implements IImporter {
2843
2851
  * {@inheritdoc Import.Importers.IImporter.import}
2844
2852
  */
2845
2853
  import(item: IImportable, __manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
2854
+ private _isSupportedFileExtension;
2855
+ private _getJsonContents;
2856
+ private _canConvertFileExtension;
2846
2857
  /**
2847
2858
  * Gets an {@link Import.FsItem | FsItem} from an {@link Import.IImportable | importable}.
2848
2859
  * @param item - The importable to convert.
@@ -4021,6 +4032,8 @@ declare const identifierList: RegExp;
4021
4032
  */
4022
4033
  declare interface IFsItemImporterCreateParams {
4023
4034
  qualifiers: IReadOnlyQualifierCollector;
4035
+ fileContentConverter?: Converter<JsonValue>;
4036
+ fileContentExtensions?: ReadonlyArray<string>;
4024
4037
  }
4025
4038
 
4026
4039
  /**
@@ -4204,6 +4217,14 @@ declare interface IImporterCreateParams {
4204
4217
  * An optional list of {@link Import.Importers.IImporter | importers} to use for the import.
4205
4218
  */
4206
4219
  importers?: IImporter[];
4220
+ /**
4221
+ * An optional converter used to pre-process file contents before JSON import validation.
4222
+ */
4223
+ fileContentConverter?: Converter<JsonValue>;
4224
+ /**
4225
+ * Optional file extensions which should be parsed using the supplied file content converter.
4226
+ */
4227
+ fileContentExtensions?: ReadonlyArray<string>;
4207
4228
  }
4208
4229
 
4209
4230
  /**
@@ -4717,9 +4738,13 @@ declare class ImportManager {
4717
4738
  * and optional `FileTree`.
4718
4739
  * @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} to use for the import.
4719
4740
  * @param tree - An optional `FileTree` for importing path items.
4741
+ * @param fileContentConverter - An optional converter used to pre-process raw file contents before JSON import
4742
+ * validation.
4743
+ * @param fileContentExtensions - Optional file extensions which should be parsed using the supplied file
4744
+ * content converter.
4720
4745
  * @returns A read-only array of {@link Import.Importers.IImporter | importers}.
4721
4746
  */
4722
- static getDefaultImporters(qualifiers: IReadOnlyQualifierCollector, tree?: FileTree.FileTree): ReadonlyArray<IImporter>;
4747
+ static getDefaultImporters(qualifiers: IReadOnlyQualifierCollector, tree?: FileTree.FileTree, fileContentConverter?: Converter<JsonValue>, fileContentExtensions?: ReadonlyArray<string>): ReadonlyArray<IImporter>;
4723
4748
  /**
4724
4749
  * Imports any items on the import stack.
4725
4750
  * @returns `Success` with the {@link Import.ImportManager | ImportManager} if successful,
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.57.6"
8
+ "packageVersion": "7.57.7"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,35 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { ISystemConfiguration } from './json';
3
+ import { SystemConfiguration, ISystemConfigurationInitParams } from './systemConfiguration';
4
+ /**
5
+ * A `string` literal type representing a well-known predefined system configuration.
6
+ * @public
7
+ */
8
+ export type PredefinedSystemConfiguration = 'default' | 'language-priority' | 'territory-priority' | 'extended-example';
9
+ /**
10
+ * An array of all well-known predefined system configurations.
11
+ * @public
12
+ */
13
+ export declare const allPredefinedSystemConfigurations: ReadonlyArray<PredefinedSystemConfiguration>;
14
+ export * from './predefined';
15
+ /**
16
+ * Returns the {@link Config.Model.ISystemConfiguration | system configuration} declaration for the
17
+ * specified predefined system configuration.
18
+ * @param name - The name of the predefined system configuration.
19
+ * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
20
+ * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}
21
+ * declaration if successful, `Failure` with an error message otherwise.
22
+ * @public
23
+ */
24
+ export declare function getPredefinedDeclaration(name: PredefinedSystemConfiguration, initParams?: ISystemConfigurationInitParams): Result<ISystemConfiguration>;
25
+ /**
26
+ * Returns the {@link Config.SystemConfiguration | SystemConfiguration} for the specified
27
+ * predefined system configuration.
28
+ * @param name - The name of the predefined system configuration.
29
+ * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
30
+ * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}
31
+ * if successful, `Failure` with an error message otherwise.
32
+ * @public
33
+ */
34
+ export declare function getPredefinedSystemConfiguration(name: PredefinedSystemConfiguration, initParams?: ISystemConfigurationInitParams): Result<SystemConfiguration>;
35
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (c) 2025 Erik Fortune
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in all
13
+ * copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ var desc = Object.getOwnPropertyDescriptor(m, k);
26
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
27
+ desc = { enumerable: true, get: function() { return m[k]; } };
28
+ }
29
+ Object.defineProperty(o, k2, desc);
30
+ }) : (function(o, m, k, k2) {
31
+ if (k2 === undefined) k2 = k;
32
+ o[k2] = m[k];
33
+ }));
34
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
35
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.allPredefinedSystemConfigurations = void 0;
39
+ exports.getPredefinedDeclaration = getPredefinedDeclaration;
40
+ exports.getPredefinedSystemConfiguration = getPredefinedSystemConfiguration;
41
+ const ts_utils_1 = require("@fgv/ts-utils");
42
+ const systemConfiguration_1 = require("./systemConfiguration");
43
+ const ts_json_base_1 = require("@fgv/ts-json-base");
44
+ const predefined_1 = require("./predefined");
45
+ /**
46
+ * An array of all well-known predefined system configurations.
47
+ * @public
48
+ */
49
+ exports.allPredefinedSystemConfigurations = [
50
+ 'default',
51
+ 'language-priority',
52
+ 'territory-priority',
53
+ 'extended-example'
54
+ ];
55
+ __exportStar(require("./predefined"), exports);
56
+ const predefinedDecls = {
57
+ default: predefined_1.Default.DefaultSystemConfiguration,
58
+ 'language-priority': predefined_1.Default.LanguagePrioritySystemConfiguration,
59
+ 'territory-priority': predefined_1.Default.TerritoryPrioritySystemConfiguration,
60
+ 'extended-example': predefined_1.Example.ExtendedSystemConfiguration
61
+ };
62
+ /**
63
+ * Returns the {@link Config.Model.ISystemConfiguration | system configuration} declaration for the
64
+ * specified predefined system configuration.
65
+ * @param name - The name of the predefined system configuration.
66
+ * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
67
+ * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}
68
+ * declaration if successful, `Failure` with an error message otherwise.
69
+ * @public
70
+ */
71
+ function getPredefinedDeclaration(name, initParams) {
72
+ if (name in predefinedDecls) {
73
+ const baseConfig = (0, ts_json_base_1.sanitizeJsonObject)(predefinedDecls[name]);
74
+ if (initParams === null || initParams === void 0 ? void 0 : initParams.qualifierDefaultValues) {
75
+ return baseConfig.onSuccess((config) => (0, systemConfiguration_1.updateSystemConfigurationQualifierDefaultValues)(config, initParams.qualifierDefaultValues));
76
+ }
77
+ return baseConfig;
78
+ }
79
+ /* c8 ignore next 3 - defense in depth */
80
+ return (0, ts_utils_1.fail)(`Unknown predefined system configuration: ${name}`);
81
+ }
82
+ /**
83
+ * Returns the {@link Config.SystemConfiguration | SystemConfiguration} for the specified
84
+ * predefined system configuration.
85
+ * @param name - The name of the predefined system configuration.
86
+ * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
87
+ * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}
88
+ * if successful, `Failure` with an error message otherwise.
89
+ * @public
90
+ */
91
+ function getPredefinedSystemConfiguration(name, initParams) {
92
+ if (name in predefinedDecls) {
93
+ return systemConfiguration_1.SystemConfiguration.create(predefinedDecls[name], initParams);
94
+ }
95
+ return (0, ts_utils_1.fail)(`Unknown predefined system configuration: ${name}`);
96
+ }
97
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1,217 @@
1
+ import { Result } from '@fgv/ts-utils';
2
+ import { QualifierType, SystemQualifierType } from '../qualifier-types';
3
+ import * as QualifierTypes from '../qualifier-types';
4
+ import * as ResourceTypes from '../resource-types';
5
+ import { ResourceType } from '../resource-types';
6
+ /**
7
+ * Function signature for creating a qualifier type from configuration.
8
+ * @public
9
+ */
10
+ export type QualifierTypeFactoryFunction<T extends QualifierType = QualifierType> = (config: QualifierTypes.Config.IAnyQualifierTypeConfig) => Result<T>;
11
+ /**
12
+ * Function signature for creating a resource type from configuration.
13
+ * @public
14
+ */
15
+ export type ResourceTypeFactoryFunction = (config: ResourceTypes.Config.IResourceTypeConfig) => Result<ResourceType>;
16
+ /**
17
+ * Interface for a factory that creates a new instance of a configuration object.
18
+ * @public
19
+ */
20
+ export interface IConfigInitFactory<TConfig, T> {
21
+ /**
22
+ * Creates a new instance of a configuration object.
23
+ * @param config - The configuration object to create.
24
+ * @returns A result containing the new instance of the configuration object.
25
+ */
26
+ create(config: TConfig): Result<T>;
27
+ }
28
+ /**
29
+ * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a factory function.
30
+ * @param fn - The factory function to wrap.
31
+ * @returns An `IConfigInitFactory` instance that delegates to the function.
32
+ * @public
33
+ */
34
+ export declare function createQualifierTypeFactory<T extends QualifierType = QualifierType>(fn: QualifierTypeFactoryFunction<T>): IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T>;
35
+ /**
36
+ * Creates a {@link Config.IConfigInitFactory | IConfigInitFactory} from a resource type factory function.
37
+ * @param fn - The factory function to wrap.
38
+ * @returns An `IConfigInitFactory` instance that delegates to the function.
39
+ * @public
40
+ */
41
+ export declare function createResourceTypeFactory(fn: ResourceTypeFactoryFunction): IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType>;
42
+ /**
43
+ * A factory that chains multiple factories together.
44
+ * @public
45
+ */
46
+ export declare class ChainedConfigInitFactory<TConfig, T> implements IConfigInitFactory<TConfig, T> {
47
+ readonly factories: IConfigInitFactory<TConfig, T>[];
48
+ /**
49
+ * Constructor for a chained config init factory.
50
+ * @param factories - The factories to chain.
51
+ */
52
+ constructor(factories: IConfigInitFactory<TConfig, T>[]);
53
+ /**
54
+ * Creates a new instance of a configuration object.
55
+ * @param config - The configuration object to create.
56
+ * @returns A result containing the new instance of the configuration object.
57
+ */
58
+ create(config: TConfig): Result<T>;
59
+ }
60
+ /**
61
+ * A factory that creates a {@link QualifierTypes.SystemQualifierType | SystemQualifierType} from
62
+ * {@link QualifierTypes.Config.IAnyQualifierTypeConfig | any qualifier type configuration}.
63
+ * @returns `Success` with the new {@link QualifierTypes.SystemQualifierType | SystemQualifierType}
64
+ * if successful, `Failure` with an error message otherwise.
65
+ * @public
66
+ */
67
+ export declare class BuiltInQualifierTypeFactory implements IConfigInitFactory<QualifierTypes.Config.ISystemQualifierTypeConfig, SystemQualifierType> {
68
+ /** {@inheritDoc Config.IConfigInitFactory.create} */
69
+ create(config: QualifierTypes.Config.IAnyQualifierTypeConfig): Result<SystemQualifierType>;
70
+ }
71
+ /**
72
+ * A factory that creates {@link QualifierTypes.QualifierType | QualifierType} instances from configuration,
73
+ * supporting both built-in system types and custom external types.
74
+ *
75
+ * This factory allows external consumers to extend the qualifier type system with their own custom types
76
+ * while maintaining support for all built-in types (Language, Territory, Literal).
77
+ *
78
+ * @typeParam T - The custom qualifier type(s) to support. Defaults to {@link QualifierTypes.SystemQualifierType | SystemQualifierType}.
79
+ *
80
+ * @example Creating a factory with custom qualifier types
81
+ * ```typescript
82
+ * // Define a custom qualifier type
83
+ * class CustomQualifierType extends QualifierType {
84
+ * // ... implementation
85
+ * }
86
+ *
87
+ * // Define a discriminated union of all types
88
+ * type AppQualifierType = SystemQualifierType | CustomQualifierType;
89
+ *
90
+ * // Create a factory that handles custom types
91
+ * const customFactory: IConfigInitFactory<IAnyQualifierTypeConfig, CustomQualifierType> = {
92
+ * create(config) {
93
+ * // ... handle custom type creation
94
+ * }
95
+ * };
96
+ *
97
+ * // Create the combined factory
98
+ * const qualifierTypeFactory = new QualifierTypeFactory<AppQualifierType>([customFactory]);
99
+ *
100
+ * // The factory returns T | SystemQualifierType, supporting all types
101
+ * const result = qualifierTypeFactory.create(config); // Result<AppQualifierType | SystemQualifierType>
102
+ * ```
103
+ *
104
+ * @remarks
105
+ * - The factory chains custom factories with the built-in factory
106
+ * - Custom factories are tried first, falling back to built-in types
107
+ * - The return type is a union of custom types (T) and system types
108
+ *
109
+ * @public
110
+ */
111
+ export declare class QualifierTypeFactory<T extends QualifierType = SystemQualifierType> extends ChainedConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T | SystemQualifierType> {
112
+ /**
113
+ * Constructor for a {@link Config.QualifierTypeFactory | qualifier type factory}.
114
+ * @param factories - Array of factories for custom qualifier types. Can be:
115
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
116
+ * - {@link Config.QualifierTypeFactoryFunction | Factory functions}
117
+ * - A mix of both
118
+ * These are tried in order before falling back to built-in types.
119
+ * @remarks The {@link Config.BuiltInQualifierTypeFactory | built-in factory} is always appended to handle
120
+ * system qualifier types (Language, Territory, Literal).
121
+ */
122
+ constructor(factories: Array<IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T> | QualifierTypeFactoryFunction<T>>);
123
+ }
124
+ /**
125
+ * A factory that validates and creates {@link QualifierTypes.QualifierType | QualifierType} instances
126
+ * from weakly-typed configuration objects. This factory accepts configurations with unvalidated
127
+ * string properties and validates them before delegating to the underlying factory chain.
128
+ *
129
+ * This pattern is useful at package boundaries where type identity issues may occur with
130
+ * branded types across different package instances.
131
+ *
132
+ * @example
133
+ * ```typescript
134
+ * // Accept weakly-typed config from external source
135
+ * const validatingFactory = new ValidatingQualifierTypeFactory([customFactory]);
136
+ *
137
+ * // Config can have plain string types instead of branded types
138
+ * const config = {
139
+ * name: 'my-qualifier', // plain string, not QualifierTypeName
140
+ * systemType: 'custom', // plain string
141
+ * configuration: { ... }
142
+ * };
143
+ *
144
+ * const result = validatingFactory.create(config); // Validates and converts internally
145
+ * ```
146
+ *
147
+ * @public
148
+ */
149
+ export declare class ValidatingQualifierTypeFactory<T extends QualifierType = SystemQualifierType> implements IConfigInitFactory<unknown, T | SystemQualifierType> {
150
+ private readonly _innerFactory;
151
+ /**
152
+ * Constructor for a validating qualifier type factory.
153
+ * @param factories - Array of factories for custom qualifier types. Can be:
154
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
155
+ * - {@link Config.QualifierTypeFactoryFunction | Factory functions}
156
+ * - A mix of both
157
+ */
158
+ constructor(factories: Array<IConfigInitFactory<QualifierTypes.Config.IAnyQualifierTypeConfig, T> | QualifierTypeFactoryFunction<T>>);
159
+ /**
160
+ * Creates a qualifier type from a weakly-typed configuration object.
161
+ * @param config - The configuration object to validate and use for creation.
162
+ * @returns A result containing the new qualifier type if successful.
163
+ */
164
+ create(config: unknown): Result<T | SystemQualifierType>;
165
+ }
166
+ /**
167
+ * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}.
168
+ * @public
169
+ */
170
+ export declare class BuiltInResourceTypeFactory implements IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> {
171
+ /** {@inheritDoc Config.IConfigInitFactory.create} */
172
+ create(config: ResourceTypes.Config.IResourceTypeConfig): Result<ResourceType>;
173
+ }
174
+ /**
175
+ * A factory that creates a {@link ResourceTypes.ResourceType | ResourceType} from a {@link ResourceTypes.Config.IResourceTypeConfig | resource type configuration}
176
+ * by chaining a supplied factory with a {@link Config.BuiltInResourceTypeFactory | built-in factory} that handles built-in resource types.
177
+ * @public
178
+ */
179
+ export declare class ResourceTypeFactory extends ChainedConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> {
180
+ /**
181
+ * Constructor for a resource type factory.
182
+ * @param factories - Array of factories for resource types. Can be:
183
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
184
+ * - {@link Config.ResourceTypeFactoryFunction | Factory functions}
185
+ * - A mix of both
186
+ * @remarks The {@link Config.BuiltInResourceTypeFactory | built-in factory} is always added to the end of the chain.
187
+ */
188
+ constructor(factories: Array<IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> | ResourceTypeFactoryFunction>);
189
+ }
190
+ /**
191
+ * A factory that validates and creates {@link ResourceTypes.ResourceType | ResourceType} instances
192
+ * from weakly-typed configuration objects. This factory accepts configurations with unvalidated
193
+ * string properties and validates them before delegating to the underlying factory chain.
194
+ *
195
+ * This pattern is useful at package boundaries where type identity issues may occur with
196
+ * branded types across different package instances.
197
+ *
198
+ * @public
199
+ */
200
+ export declare class ValidatingResourceTypeFactory implements IConfigInitFactory<unknown, ResourceType> {
201
+ private readonly _innerFactory;
202
+ /**
203
+ * Constructor for a validating resource type factory.
204
+ * @param factories - Array of factories for resource types. Can be:
205
+ * - {@link Config.IConfigInitFactory | IConfigInitFactory} instances
206
+ * - {@link Config.ResourceTypeFactoryFunction | Factory functions}
207
+ * - A mix of both
208
+ */
209
+ constructor(factories: Array<IConfigInitFactory<ResourceTypes.Config.IResourceTypeConfig, ResourceType> | ResourceTypeFactoryFunction>);
210
+ /**
211
+ * Creates a resource type from a weakly-typed configuration object.
212
+ * @param config - The configuration object to validate and use for creation.
213
+ * @returns A result containing the new resource type if successful.
214
+ */
215
+ create(config: unknown): Result<ResourceType>;
216
+ }
217
+ //# sourceMappingURL=configInitFactory.d.ts.map