@fgv/ts-res 5.1.0-0 → 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 (49) hide show
  1. package/package.json +24 -24
  2. package/dist/packlets/config/common.js +0 -78
  3. package/dist/packlets/config/configInitFactory.js +0 -258
  4. package/dist/packlets/config/convert.js +0 -56
  5. package/dist/packlets/config/index.browser.js +0 -34
  6. package/dist/packlets/config/index.js +0 -28
  7. package/dist/packlets/config/json.js +0 -23
  8. package/dist/packlets/config/predefined/default.js +0 -138
  9. package/dist/packlets/config/predefined/extended.js +0 -190
  10. package/dist/packlets/config/predefined/index.js +0 -25
  11. package/dist/packlets/config/systemConfiguration.js +0 -147
  12. package/dist/packlets/qualifier-types/config/convert.js +0 -124
  13. package/dist/packlets/qualifier-types/config/index.js +0 -25
  14. package/dist/packlets/qualifier-types/config/json.js +0 -32
  15. package/dist/packlets/resource-types/config/convert.js +0 -35
  16. package/dist/packlets/resource-types/config/index.js +0 -25
  17. package/dist/packlets/resource-types/config/json.js +0 -23
  18. package/lib/packlets/config/common.d.ts +0 -35
  19. package/lib/packlets/config/common.js +0 -97
  20. package/lib/packlets/config/configInitFactory.d.ts +0 -217
  21. package/lib/packlets/config/configInitFactory.js +0 -303
  22. package/lib/packlets/config/convert.d.ts +0 -23
  23. package/lib/packlets/config/convert.js +0 -93
  24. package/lib/packlets/config/index.browser.d.ts +0 -7
  25. package/lib/packlets/config/index.browser.js +0 -74
  26. package/lib/packlets/config/index.d.ts +0 -7
  27. package/lib/packlets/config/index.js +0 -68
  28. package/lib/packlets/config/json.d.ts +0 -20
  29. package/lib/packlets/config/json.js +0 -24
  30. package/lib/packlets/config/predefined/default.d.ts +0 -57
  31. package/lib/packlets/config/predefined/default.js +0 -141
  32. package/lib/packlets/config/predefined/extended.d.ts +0 -25
  33. package/lib/packlets/config/predefined/extended.js +0 -193
  34. package/lib/packlets/config/predefined/index.d.ts +0 -4
  35. package/lib/packlets/config/predefined/index.js +0 -62
  36. package/lib/packlets/config/systemConfiguration.d.ts +0 -94
  37. package/lib/packlets/config/systemConfiguration.js +0 -152
  38. package/lib/packlets/qualifier-types/config/convert.d.ts +0 -65
  39. package/lib/packlets/qualifier-types/config/convert.js +0 -161
  40. package/lib/packlets/qualifier-types/config/index.d.ts +0 -4
  41. package/lib/packlets/qualifier-types/config/index.js +0 -64
  42. package/lib/packlets/qualifier-types/config/json.d.ts +0 -91
  43. package/lib/packlets/qualifier-types/config/json.js +0 -35
  44. package/lib/packlets/resource-types/config/convert.d.ts +0 -8
  45. package/lib/packlets/resource-types/config/convert.js +0 -38
  46. package/lib/packlets/resource-types/config/index.d.ts +0 -4
  47. package/lib/packlets/resource-types/config/index.js +0 -64
  48. package/lib/packlets/resource-types/config/json.d.ts +0 -11
  49. package/lib/packlets/resource-types/config/json.js +0 -24
@@ -1,152 +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
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.SystemConfiguration = void 0;
25
- exports.updateSystemConfigurationQualifierDefaultValues = updateSystemConfigurationQualifierDefaultValues;
26
- const ts_utils_1 = require("@fgv/ts-utils");
27
- const qualifier_types_1 = require("../qualifier-types");
28
- const qualifiers_1 = require("../qualifiers");
29
- const resource_types_1 = require("../resource-types");
30
- const convert_1 = require("./convert");
31
- const ts_json_base_1 = require("@fgv/ts-json-base");
32
- const configInitFactory_1 = require("./configInitFactory");
33
- /**
34
- * Creates a copy of the provided {@link Config.Model.ISystemConfiguration | system configuration}
35
- * with updated qualifier default values.
36
- * @param config - The base {@link Config.Model.ISystemConfiguration | system configuration} to copy.
37
- * @param qualifierDefaultValues - Map of qualifier names to default values. Use `null` to remove existing values.
38
- * @returns `Success` with the updated {@link Config.Model.ISystemConfiguration | system configuration}
39
- * if successful, `Failure` with an error message otherwise.
40
- * @public
41
- */
42
- function updateSystemConfigurationQualifierDefaultValues(config, qualifierDefaultValues // eslint-disable-line @rushstack/no-new-null
43
- ) {
44
- // Create a copy of the config
45
- return (0, ts_json_base_1.sanitizeJsonObject)(config).onSuccess((updatedConfig) => {
46
- // Create a map of existing qualifier names for validation
47
- const existingQualifierNames = new Set(updatedConfig.qualifiers.map((q) => q.name));
48
- // Validate that all specified qualifiers exist in the configuration
49
- for (const qualifierName of Object.keys(qualifierDefaultValues)) {
50
- if (!existingQualifierNames.has(qualifierName)) {
51
- return (0, ts_utils_1.fail)(`Qualifier '${qualifierName}' not found in system configuration`);
52
- }
53
- }
54
- // Update qualifier default values
55
- updatedConfig.qualifiers = updatedConfig.qualifiers.map((qualifier) => {
56
- if (qualifier.name in qualifierDefaultValues) {
57
- const newDefaultValue = qualifierDefaultValues[qualifier.name];
58
- // Create a copy of the qualifier
59
- const updatedQualifier = Object.assign({}, qualifier);
60
- if (newDefaultValue === null) {
61
- // Remove the default value
62
- delete updatedQualifier.defaultValue;
63
- }
64
- else {
65
- // Set the new default value
66
- updatedQualifier.defaultValue = newDefaultValue;
67
- }
68
- return updatedQualifier;
69
- }
70
- return qualifier;
71
- });
72
- return (0, ts_utils_1.succeed)(updatedConfig);
73
- });
74
- }
75
- /**
76
- * A system configuration for both runtime or build.
77
- * @public
78
- */
79
- class SystemConfiguration {
80
- /**
81
- * The name of this system configuration.
82
- */
83
- get name() {
84
- return this._config.name;
85
- }
86
- /**
87
- * The description of this system configuration.
88
- */
89
- get description() {
90
- return this._config.description;
91
- }
92
- /**
93
- * Constructs a new instance of a {@link Config.SystemConfiguration | SystemConfiguration} from the
94
- * supplied {@link Config.Model.ISystemConfiguration | system configuration}.
95
- * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.
96
- * @public
97
- */
98
- constructor(config, initParams) {
99
- var _a, _b;
100
- this._config = config;
101
- const qualifierTypeFactory = (_a = initParams === null || initParams === void 0 ? void 0 : initParams.qualifierTypeFactory) !== null && _a !== void 0 ? _a : new configInitFactory_1.BuiltInQualifierTypeFactory();
102
- const resourceTypeFactory = (_b = initParams === null || initParams === void 0 ? void 0 : initParams.resourceTypeFactory) !== null && _b !== void 0 ? _b : new configInitFactory_1.BuiltInResourceTypeFactory();
103
- this.qualifierTypes = qualifier_types_1.QualifierTypeCollector.create({
104
- qualifierTypes: (0, ts_utils_1.mapResults)(config.qualifierTypes.map((tc) => qualifierTypeFactory.create(tc))).orThrow()
105
- }).orThrow();
106
- this.qualifiers = qualifiers_1.QualifierCollector.create({
107
- qualifierTypes: this.qualifierTypes,
108
- qualifiers: config.qualifiers
109
- }).orThrow();
110
- this.resourceTypes = resource_types_1.ResourceTypeCollector.create({
111
- resourceTypes: (0, ts_utils_1.mapResults)(config.resourceTypes.map((rt) => resourceTypeFactory.create(rt))).orThrow()
112
- }).orThrow();
113
- }
114
- /**
115
- * Creates a new {@link Config.SystemConfiguration | SystemConfiguration} from the supplied
116
- * {@link Config.Model.ISystemConfiguration | system configuration}.
117
- * @param config - The {@link Config.Model.ISystemConfiguration | system configuration} to use.
118
- * @param initParams - Optional {@link Config.ISystemConfigurationInitParams | initialization parameters}.
119
- * @returns `Success` with the new {@link Config.SystemConfiguration | SystemConfiguration}
120
- * if successful, `Failure` with an error message otherwise.
121
- * @public
122
- */
123
- static create(config, initParams) {
124
- if (initParams === null || initParams === void 0 ? void 0 : initParams.qualifierDefaultValues) {
125
- /* c8 ignore next 9 - functional code tested but coverage intermittently missed */
126
- return updateSystemConfigurationQualifierDefaultValues(config, initParams.qualifierDefaultValues).onSuccess((updatedConfig) => (0, ts_utils_1.captureResult)(() => new SystemConfiguration(updatedConfig, (0, ts_utils_1.omit)(initParams, ['qualifierDefaultValues']))));
127
- }
128
- return (0, ts_utils_1.captureResult)(() => new SystemConfiguration(config, initParams));
129
- }
130
- /**
131
- * Loads a {@link Config.SystemConfiguration | SystemConfiguration} from a file.
132
- * @param path - The path to the file to load.
133
- * @returns `Success` with the {@link Config.SystemConfiguration | SystemConfiguration}
134
- * if successful, `Failure` with an error message otherwise.
135
- * @public
136
- */
137
- static loadFromFile(path, initParams) {
138
- return ts_json_base_1.JsonFile.convertJsonFileSync(path, convert_1.systemConfiguration).onSuccess((config) => SystemConfiguration.create(config, initParams));
139
- }
140
- /**
141
- * Returns the {@link Config.Model.ISystemConfiguration | system configuration} that this
142
- * {@link Config.SystemConfiguration | SystemConfiguration} was created from.
143
- * @returns `Success` with the {@link Config.Model.ISystemConfiguration | system configuration}
144
- * if successful, `Failure` with an error message otherwise.
145
- * @public
146
- */
147
- getConfig() {
148
- return convert_1.systemConfiguration.convert(this._config);
149
- }
150
- }
151
- exports.SystemConfiguration = SystemConfiguration;
152
- //# sourceMappingURL=systemConfiguration.js.map
@@ -1,65 +0,0 @@
1
- import { Converter } from '@fgv/ts-utils';
2
- import * as Model from './json';
3
- import { Converters as JsonConverters } from '@fgv/ts-json-base';
4
- /**
5
- * A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
6
- * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
7
- * @public
8
- */
9
- export declare const languageQualifierTypeConfig: import("@fgv/ts-utils").ObjectConverter<Model.ILanguageQualifierTypeConfig, unknown>;
10
- /**
11
- * A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
12
- * @returns A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
13
- * @public
14
- */
15
- export declare const territoryQualifierTypeConfig: import("@fgv/ts-utils").ObjectConverter<Model.ITerritoryQualifierTypeConfig, unknown>;
16
- /**
17
- * A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
18
- * @returns A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
19
- * @public
20
- */
21
- export declare const literalQualifierTypeConfig: import("@fgv/ts-utils").ObjectConverter<Model.ILiteralQualifierTypeConfig, unknown>;
22
- /**
23
- * A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
24
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
25
- * @public
26
- */
27
- export declare const systemLanguageQualifierTypeConfig: import("@fgv/ts-utils").ObjectConverter<Model.ISystemLanguageQualifierTypeConfig, unknown>;
28
- /**
29
- * A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
30
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
31
- * @public
32
- */
33
- export declare const systemTerritoryQualifierTypeConfig: import("@fgv/ts-utils").ObjectConverter<Model.ISystemTerritoryQualifierTypeConfig, unknown>;
34
- /**
35
- * A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
36
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
37
- * @public
38
- */
39
- export declare const systemLiteralQualifierTypeConfig: import("@fgv/ts-utils").ObjectConverter<Model.ISystemLiteralQualifierTypeConfig, unknown>;
40
- /**
41
- * A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
42
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
43
- * @public
44
- */
45
- export declare const systemQualifierTypeConfig: Converter<Model.ISystemQualifierTypeConfig, unknown>;
46
- /**
47
- * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
48
- * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
49
- * @param config - A `Converter` for the configuration object.
50
- * @public
51
- */
52
- export declare function qualifierTypeConfig<T, TD = unknown>(config: Converter<T, TD>): Converter<Model.IQualifierTypeConfig<T>, TD>;
53
- /**
54
- * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
55
- * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
56
- * @public
57
- */
58
- export declare const jsonQualifierTypeConfig: Converter<Model.IQualifierTypeConfig<import("@fgv/ts-json-base").JsonObject>, JsonConverters.IJsonConverterContext>;
59
- /**
60
- * A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
61
- * @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
62
- * @public
63
- */
64
- export declare const anyQualifierTypeConfig: Converter<Model.IAnyQualifierTypeConfig, unknown>;
65
- //# sourceMappingURL=convert.d.ts.map
@@ -1,161 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
- Object.defineProperty(o, "default", { enumerable: true, value: v });
36
- }) : function(o, v) {
37
- o["default"] = v;
38
- });
39
- var __importStar = (this && this.__importStar) || (function () {
40
- var ownKeys = function(o) {
41
- ownKeys = Object.getOwnPropertyNames || function (o) {
42
- var ar = [];
43
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
- return ar;
45
- };
46
- return ownKeys(o);
47
- };
48
- return function (mod) {
49
- if (mod && mod.__esModule) return mod;
50
- var result = {};
51
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
- __setModuleDefault(result, mod);
53
- return result;
54
- };
55
- })();
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.anyQualifierTypeConfig = exports.jsonQualifierTypeConfig = exports.systemQualifierTypeConfig = exports.systemLiteralQualifierTypeConfig = exports.systemTerritoryQualifierTypeConfig = exports.systemLanguageQualifierTypeConfig = exports.literalQualifierTypeConfig = exports.territoryQualifierTypeConfig = exports.languageQualifierTypeConfig = void 0;
58
- exports.qualifierTypeConfig = qualifierTypeConfig;
59
- /* eslint-disable @rushstack/typedef-var */
60
- const ts_utils_1 = require("@fgv/ts-utils");
61
- const Common = __importStar(require("../../common"));
62
- const ts_json_base_1 = require("@fgv/ts-json-base");
63
- /**
64
- * A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
65
- * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
66
- * @public
67
- */
68
- exports.languageQualifierTypeConfig = ts_utils_1.Converters.strictObject({
69
- allowContextList: ts_utils_1.Converters.boolean.optional()
70
- });
71
- /**
72
- * A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
73
- * @returns A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
74
- * @public
75
- */
76
- exports.territoryQualifierTypeConfig = ts_utils_1.Converters.strictObject({
77
- allowContextList: ts_utils_1.Converters.boolean,
78
- acceptLowercase: ts_utils_1.Converters.boolean.optional(),
79
- allowedTerritories: ts_utils_1.Converters.arrayOf(ts_utils_1.Converters.string).optional(),
80
- hierarchy: ts_utils_1.Converters.recordOf(ts_utils_1.Converters.string).optional()
81
- });
82
- /**
83
- * A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
84
- * @returns A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
85
- * @public
86
- */
87
- exports.literalQualifierTypeConfig = ts_utils_1.Converters.strictObject({
88
- allowContextList: ts_utils_1.Converters.boolean.optional(),
89
- caseSensitive: ts_utils_1.Converters.boolean.optional(),
90
- enumeratedValues: ts_utils_1.Converters.arrayOf(ts_utils_1.Converters.string).optional(),
91
- hierarchy: ts_utils_1.Converters.recordOf(ts_utils_1.Converters.string).optional()
92
- });
93
- /**
94
- * A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
95
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
96
- * @public
97
- */
98
- exports.systemLanguageQualifierTypeConfig = ts_utils_1.Converters.strictObject({
99
- name: ts_utils_1.Converters.string,
100
- systemType: ts_utils_1.Converters.literal('language'),
101
- configuration: exports.languageQualifierTypeConfig.optional()
102
- });
103
- /**
104
- * A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
105
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
106
- * @public
107
- */
108
- exports.systemTerritoryQualifierTypeConfig = ts_utils_1.Converters.strictObject({
109
- name: ts_utils_1.Converters.string,
110
- systemType: ts_utils_1.Converters.literal('territory'),
111
- configuration: exports.territoryQualifierTypeConfig.optional()
112
- });
113
- /**
114
- * A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
115
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
116
- * @public
117
- */
118
- exports.systemLiteralQualifierTypeConfig = ts_utils_1.Converters.strictObject({
119
- name: ts_utils_1.Converters.string,
120
- systemType: ts_utils_1.Converters.literal('literal'),
121
- configuration: exports.literalQualifierTypeConfig.optional()
122
- });
123
- /**
124
- * A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
125
- * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
126
- * @public
127
- */
128
- exports.systemQualifierTypeConfig = ts_utils_1.Converters.discriminatedObject('systemType', {
129
- language: exports.systemLanguageQualifierTypeConfig,
130
- territory: exports.systemTerritoryQualifierTypeConfig,
131
- literal: exports.systemLiteralQualifierTypeConfig
132
- });
133
- /**
134
- * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
135
- * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
136
- * @param config - A `Converter` for the configuration object.
137
- * @public
138
- */
139
- function qualifierTypeConfig(config) {
140
- return ts_utils_1.Converters.strictObject({
141
- name: Common.Convert.qualifierTypeName,
142
- systemType: Common.Convert.qualifierTypeName,
143
- configuration: config.optional()
144
- });
145
- }
146
- /**
147
- * A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
148
- * @returns A `Converter` for {@link QualifierTypes.Config.IQualifierTypeConfig | QualifierTypeConfig} objects.
149
- * @public
150
- */
151
- exports.jsonQualifierTypeConfig = qualifierTypeConfig(ts_json_base_1.Converters.jsonObject);
152
- /**
153
- * A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
154
- * @returns A `Converter` for {@link QualifierTypes.Config.IAnyQualifierTypeConfig | AnyQualifierTypeConfig} objects.
155
- * @public
156
- */
157
- exports.anyQualifierTypeConfig = ts_utils_1.Converters.oneOf([
158
- exports.jsonQualifierTypeConfig,
159
- exports.systemQualifierTypeConfig
160
- ]);
161
- //# sourceMappingURL=convert.js.map
@@ -1,4 +0,0 @@
1
- import * as Convert from './convert';
2
- export * from './json';
3
- export { Convert };
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,64 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
35
- Object.defineProperty(o, "default", { enumerable: true, value: v });
36
- }) : function(o, v) {
37
- o["default"] = v;
38
- });
39
- var __importStar = (this && this.__importStar) || (function () {
40
- var ownKeys = function(o) {
41
- ownKeys = Object.getOwnPropertyNames || function (o) {
42
- var ar = [];
43
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
44
- return ar;
45
- };
46
- return ownKeys(o);
47
- };
48
- return function (mod) {
49
- if (mod && mod.__esModule) return mod;
50
- var result = {};
51
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
52
- __setModuleDefault(result, mod);
53
- return result;
54
- };
55
- })();
56
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
57
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
58
- };
59
- Object.defineProperty(exports, "__esModule", { value: true });
60
- exports.Convert = void 0;
61
- const Convert = __importStar(require("./convert"));
62
- exports.Convert = Convert;
63
- __exportStar(require("./json"), exports);
64
- //# sourceMappingURL=index.js.map
@@ -1,91 +0,0 @@
1
- import { JsonObject } from '@fgv/ts-json-base';
2
- /**
3
- * Templated configuration for {@link QualifierTypes.QualifierType | qualifier type} configuration.
4
- * @public
5
- */
6
- export interface IQualifierTypeConfig<T = JsonObject> {
7
- name: string;
8
- systemType: string;
9
- configuration?: T;
10
- }
11
- /**
12
- * Configuration for {@link QualifierTypes.LanguageQualifierType | language qualifier type} configuration.
13
- * @public
14
- */
15
- export interface ILanguageQualifierTypeConfig {
16
- allowContextList?: boolean;
17
- }
18
- /**
19
- * Declares a hierarchy of literal values. The keys are the names of the values, and the
20
- * values are the names of their parents.
21
- * @remarks
22
- * The hierarchy is defined as a tree, where each value can have multiple children but
23
- * only one parent. The root of the tree has no parent. The hierarchy is used to
24
- * determine the relationship between values when matching conditions and contexts.
25
- * @public
26
- */
27
- export type LiteralValueHierarchyDecl<T extends string> = Record<T, T>;
28
- /**
29
- * Configuration for {@link QualifierTypes.TerritoryQualifierType | territory qualifier type} configuration.
30
- * @public
31
- */
32
- export interface ITerritoryQualifierTypeConfig {
33
- allowContextList?: boolean;
34
- acceptLowercase?: boolean;
35
- allowedTerritories?: string[];
36
- /**
37
- * Optional {@link QualifierTypes.Config.LiteralValueHierarchyDecl | hierarchy declaration}
38
- * of territory values to use for matching. If not provided, no hierarchy will be used.
39
- */
40
- hierarchy?: LiteralValueHierarchyDecl<string>;
41
- }
42
- /**
43
- * Configuration for {@link QualifierTypes.LiteralQualifierType | literal qualifier type} configuration.
44
- * @public
45
- */
46
- export interface ILiteralQualifierTypeConfig {
47
- allowContextList?: boolean;
48
- caseSensitive?: boolean;
49
- enumeratedValues?: string[];
50
- hierarchy?: LiteralValueHierarchyDecl<string>;
51
- }
52
- /**
53
- * Discriminated configuration for {@link QualifierTypes.LanguageQualifierType | language qualifier type} configuration.
54
- * @public
55
- */
56
- export interface ISystemLanguageQualifierTypeConfig extends IQualifierTypeConfig<ILanguageQualifierTypeConfig> {
57
- systemType: 'language';
58
- }
59
- /**
60
- * Discriminated configuration for {@link QualifierTypes.TerritoryQualifierType | territory qualifier type} configuration.
61
- * @public
62
- */
63
- export interface ISystemTerritoryQualifierTypeConfig extends IQualifierTypeConfig<ITerritoryQualifierTypeConfig> {
64
- systemType: 'territory';
65
- }
66
- /**
67
- * Discriminated configuration for {@link QualifierTypes.LiteralQualifierType | literal qualifier type} configuration.
68
- * @public
69
- */
70
- export interface ISystemLiteralQualifierTypeConfig extends IQualifierTypeConfig<ILiteralQualifierTypeConfig> {
71
- systemType: 'literal';
72
- }
73
- /**
74
- * Discriminated configuration for {@link QualifierTypes.QualifierType | qualifier type} configuration.
75
- * @public
76
- */
77
- export type ISystemQualifierTypeConfig = ISystemLanguageQualifierTypeConfig | ISystemTerritoryQualifierTypeConfig | ISystemLiteralQualifierTypeConfig;
78
- /**
79
- * A union of all qualifier type configurations.
80
- * @public
81
- */
82
- export type IAnyQualifierTypeConfig = IQualifierTypeConfig | ISystemQualifierTypeConfig;
83
- /**
84
- * Checks if a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | qualifier type configuration} is a
85
- * {@link QualifierTypes.Config.ISystemQualifierTypeConfig | system qualifier type configuration}.
86
- * @param config - The {@link QualifierTypes.Config.IAnyQualifierTypeConfig | qualifier type configuration} to check.
87
- * @returns `true` if the configuration is a system qualifier type configuration, `false` otherwise.
88
- * @public
89
- */
90
- export declare function isSystemQualifierTypeConfig(config: IAnyQualifierTypeConfig): config is ISystemQualifierTypeConfig;
91
- //# sourceMappingURL=json.d.ts.map
@@ -1,35 +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
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.isSystemQualifierTypeConfig = isSystemQualifierTypeConfig;
25
- /**
26
- * Checks if a {@link QualifierTypes.Config.IAnyQualifierTypeConfig | qualifier type configuration} is a
27
- * {@link QualifierTypes.Config.ISystemQualifierTypeConfig | system qualifier type configuration}.
28
- * @param config - The {@link QualifierTypes.Config.IAnyQualifierTypeConfig | qualifier type configuration} to check.
29
- * @returns `true` if the configuration is a system qualifier type configuration, `false` otherwise.
30
- * @public
31
- */
32
- function isSystemQualifierTypeConfig(config) {
33
- return (config.systemType === 'language' || config.systemType === 'territory' || config.systemType === 'literal');
34
- }
35
- //# sourceMappingURL=json.js.map
@@ -1,8 +0,0 @@
1
- import { IResourceTypeConfig } from './json';
2
- /**
3
- * A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
4
- * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
5
- * @public
6
- */
7
- export declare const resourceTypeConfig: import("@fgv/ts-utils").ObjectConverter<IResourceTypeConfig<import("@fgv/ts-json-base").JsonObject>, unknown>;
8
- //# sourceMappingURL=convert.d.ts.map
@@ -1,38 +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
- Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.resourceTypeConfig = void 0;
25
- /* eslint-disable @rushstack/typedef-var */
26
- const ts_utils_1 = require("@fgv/ts-utils");
27
- const ts_json_base_1 = require("@fgv/ts-json-base");
28
- /**
29
- * A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
30
- * @returns A `Converter` for {@link ResourceTypes.Config.IResourceTypeConfig | ResourceTypeConfig} objects.
31
- * @public
32
- */
33
- exports.resourceTypeConfig = ts_utils_1.Converters.strictObject({
34
- name: ts_utils_1.Converters.string,
35
- typeName: ts_utils_1.Converters.string,
36
- template: ts_json_base_1.Converters.jsonObject.optional()
37
- });
38
- //# sourceMappingURL=convert.js.map
@@ -1,4 +0,0 @@
1
- import * as Convert from './convert';
2
- export * from './json';
3
- export { Convert };
4
- //# sourceMappingURL=index.d.ts.map