@fgv/ts-res 5.0.2 → 5.1.0-1

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 (50) hide show
  1. package/dist/tsdoc-metadata.json +1 -1
  2. package/package.json +36 -36
  3. package/dist/packlets/config/common.js +0 -78
  4. package/dist/packlets/config/configInitFactory.js +0 -258
  5. package/dist/packlets/config/convert.js +0 -56
  6. package/dist/packlets/config/index.browser.js +0 -34
  7. package/dist/packlets/config/index.js +0 -28
  8. package/dist/packlets/config/json.js +0 -23
  9. package/dist/packlets/config/predefined/default.js +0 -138
  10. package/dist/packlets/config/predefined/extended.js +0 -190
  11. package/dist/packlets/config/predefined/index.js +0 -25
  12. package/dist/packlets/config/systemConfiguration.js +0 -147
  13. package/dist/packlets/qualifier-types/config/convert.js +0 -124
  14. package/dist/packlets/qualifier-types/config/index.js +0 -25
  15. package/dist/packlets/qualifier-types/config/json.js +0 -32
  16. package/dist/packlets/resource-types/config/convert.js +0 -35
  17. package/dist/packlets/resource-types/config/index.js +0 -25
  18. package/dist/packlets/resource-types/config/json.js +0 -23
  19. package/lib/packlets/config/common.d.ts +0 -35
  20. package/lib/packlets/config/common.js +0 -97
  21. package/lib/packlets/config/configInitFactory.d.ts +0 -217
  22. package/lib/packlets/config/configInitFactory.js +0 -303
  23. package/lib/packlets/config/convert.d.ts +0 -23
  24. package/lib/packlets/config/convert.js +0 -93
  25. package/lib/packlets/config/index.browser.d.ts +0 -7
  26. package/lib/packlets/config/index.browser.js +0 -74
  27. package/lib/packlets/config/index.d.ts +0 -7
  28. package/lib/packlets/config/index.js +0 -68
  29. package/lib/packlets/config/json.d.ts +0 -20
  30. package/lib/packlets/config/json.js +0 -24
  31. package/lib/packlets/config/predefined/default.d.ts +0 -57
  32. package/lib/packlets/config/predefined/default.js +0 -141
  33. package/lib/packlets/config/predefined/extended.d.ts +0 -25
  34. package/lib/packlets/config/predefined/extended.js +0 -193
  35. package/lib/packlets/config/predefined/index.d.ts +0 -4
  36. package/lib/packlets/config/predefined/index.js +0 -62
  37. package/lib/packlets/config/systemConfiguration.d.ts +0 -94
  38. package/lib/packlets/config/systemConfiguration.js +0 -152
  39. package/lib/packlets/qualifier-types/config/convert.d.ts +0 -65
  40. package/lib/packlets/qualifier-types/config/convert.js +0 -161
  41. package/lib/packlets/qualifier-types/config/index.d.ts +0 -4
  42. package/lib/packlets/qualifier-types/config/index.js +0 -64
  43. package/lib/packlets/qualifier-types/config/json.d.ts +0 -91
  44. package/lib/packlets/qualifier-types/config/json.js +0 -35
  45. package/lib/packlets/resource-types/config/convert.d.ts +0 -8
  46. package/lib/packlets/resource-types/config/convert.js +0 -38
  47. package/lib/packlets/resource-types/config/index.d.ts +0 -4
  48. package/lib/packlets/resource-types/config/index.js +0 -64
  49. package/lib/packlets/resource-types/config/json.d.ts +0 -11
  50. package/lib/packlets/resource-types/config/json.js +0 -24
@@ -1,35 +0,0 @@
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
@@ -1,25 +0,0 @@
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
@@ -1,23 +0,0 @@
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
@@ -1,35 +0,0 @@
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
@@ -1,97 +0,0 @@
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
@@ -1,217 +0,0 @@
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