@fgv/ts-res 5.1.0-1 → 5.1.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packlets/config/common.js +78 -0
- package/dist/packlets/config/configInitFactory.js +258 -0
- package/dist/packlets/config/convert.js +56 -0
- package/dist/packlets/config/index.browser.js +34 -0
- package/dist/packlets/config/index.js +28 -0
- package/dist/packlets/config/json.js +23 -0
- package/dist/packlets/config/predefined/default.js +138 -0
- package/dist/packlets/config/predefined/extended.js +190 -0
- package/dist/packlets/config/predefined/index.js +25 -0
- package/dist/packlets/config/systemConfiguration.js +147 -0
- package/dist/packlets/qualifier-types/config/convert.js +124 -0
- package/dist/packlets/qualifier-types/config/index.js +25 -0
- package/dist/packlets/qualifier-types/config/json.js +32 -0
- package/dist/packlets/resource-types/config/convert.js +35 -0
- package/dist/packlets/resource-types/config/index.js +25 -0
- package/dist/packlets/resource-types/config/json.js +23 -0
- package/lib/packlets/config/common.d.ts +35 -0
- package/lib/packlets/config/common.js +97 -0
- package/lib/packlets/config/configInitFactory.d.ts +217 -0
- package/lib/packlets/config/configInitFactory.js +303 -0
- package/lib/packlets/config/convert.d.ts +23 -0
- package/lib/packlets/config/convert.js +93 -0
- package/lib/packlets/config/index.browser.d.ts +7 -0
- package/lib/packlets/config/index.browser.js +74 -0
- package/lib/packlets/config/index.d.ts +7 -0
- package/lib/packlets/config/index.js +68 -0
- package/lib/packlets/config/json.d.ts +20 -0
- package/lib/packlets/config/json.js +24 -0
- package/lib/packlets/config/predefined/default.d.ts +57 -0
- package/lib/packlets/config/predefined/default.js +141 -0
- package/lib/packlets/config/predefined/extended.d.ts +25 -0
- package/lib/packlets/config/predefined/extended.js +193 -0
- package/lib/packlets/config/predefined/index.d.ts +4 -0
- package/lib/packlets/config/predefined/index.js +62 -0
- package/lib/packlets/config/systemConfiguration.d.ts +94 -0
- package/lib/packlets/config/systemConfiguration.js +152 -0
- package/lib/packlets/qualifier-types/config/convert.d.ts +65 -0
- package/lib/packlets/qualifier-types/config/convert.js +161 -0
- package/lib/packlets/qualifier-types/config/index.d.ts +4 -0
- package/lib/packlets/qualifier-types/config/index.js +64 -0
- package/lib/packlets/qualifier-types/config/json.d.ts +91 -0
- package/lib/packlets/qualifier-types/config/json.js +35 -0
- package/lib/packlets/resource-types/config/convert.d.ts +8 -0
- package/lib/packlets/resource-types/config/convert.js +38 -0
- package/lib/packlets/resource-types/config/index.d.ts +4 -0
- package/lib/packlets/resource-types/config/index.js +64 -0
- package/lib/packlets/resource-types/config/json.d.ts +11 -0
- package/lib/packlets/resource-types/config/json.js +24 -0
- package/package.json +24 -24
|
@@ -0,0 +1,161 @@
|
|
|
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
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JsonObject } from '@fgv/ts-json-base';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for a {@link ResourceTypes.ResourceType | resource type}.
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export interface IResourceTypeConfig<T extends JsonObject = JsonObject> {
|
|
7
|
+
name: string;
|
|
8
|
+
typeName: string;
|
|
9
|
+
template?: T;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
//# sourceMappingURL=json.js.map
|
package/package.json
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fgv/ts-res",
|
|
3
|
-
"version": "5.1.0-
|
|
3
|
+
"version": "5.1.0-3",
|
|
4
4
|
"description": "Multi-dimensional Resource Runtime",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "dist/ts-res.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "heft build --clean",
|
|
9
|
-
"clean": "heft clean",
|
|
10
|
-
"test": "heft test --clean",
|
|
11
|
-
"test-ts-res": "heft test --clean",
|
|
12
|
-
"build-docs": "typedoc --options ./config/typedoc.json",
|
|
13
|
-
"build-all": "rushx build; rushx build-docs",
|
|
14
|
-
"test-handles": "heft test --detect-open-handles",
|
|
15
|
-
"clean-jest": "heft test --clean",
|
|
16
|
-
"coverage": "heft test --clean --max-workers 1 --detect-open-handles",
|
|
17
|
-
"lint": "eslint src --ext .ts",
|
|
18
|
-
"fixlint": "eslint src --ext .ts --fix"
|
|
19
|
-
},
|
|
20
7
|
"keywords": [
|
|
21
8
|
"resource",
|
|
22
9
|
"internationalization",
|
|
@@ -31,8 +18,6 @@
|
|
|
31
18
|
"homepage": "https://github.com/ErikFortune/fgv/tree/main/libraries/ts-res#readme",
|
|
32
19
|
"sideEffects": false,
|
|
33
20
|
"devDependencies": {
|
|
34
|
-
"@fgv/heft-dual-rig": "workspace:*",
|
|
35
|
-
"@fgv/ts-utils-jest": "workspace:*",
|
|
36
21
|
"@microsoft/api-documenter": "^7.28.2",
|
|
37
22
|
"@microsoft/api-extractor": "^7.55.2",
|
|
38
23
|
"@types/jest": "^29.5.14",
|
|
@@ -58,16 +43,18 @@
|
|
|
58
43
|
"@rushstack/heft-jest-plugin": "1.2.6",
|
|
59
44
|
"@rushstack/heft-node-rig": "2.11.26",
|
|
60
45
|
"@types/heft-jest": "1.0.6",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
46
|
+
"eslint-plugin-tsdoc": "~0.5.2",
|
|
47
|
+
"@fgv/ts-utils-jest": "5.1.0-3",
|
|
48
|
+
"@fgv/heft-dual-rig": "5.1.0-3",
|
|
49
|
+
"@fgv/ts-extras": "5.1.0-3"
|
|
63
50
|
},
|
|
64
51
|
"dependencies": {
|
|
65
|
-
"@fgv/ts-utils": "workspace:*",
|
|
66
|
-
"@fgv/ts-json-base": "workspace:*",
|
|
67
|
-
"@fgv/ts-bcp47": "workspace:*",
|
|
68
|
-
"@fgv/ts-json": "workspace:*",
|
|
69
52
|
"luxon": "^3.7.2",
|
|
70
|
-
"fflate": "~0.8.2"
|
|
53
|
+
"fflate": "~0.8.2",
|
|
54
|
+
"@fgv/ts-utils": "5.1.0-3",
|
|
55
|
+
"@fgv/ts-json-base": "5.1.0-3",
|
|
56
|
+
"@fgv/ts-bcp47": "5.1.0-3",
|
|
57
|
+
"@fgv/ts-json": "5.1.0-3"
|
|
71
58
|
},
|
|
72
59
|
"exports": {
|
|
73
60
|
".": {
|
|
@@ -85,5 +72,18 @@
|
|
|
85
72
|
"repository": {
|
|
86
73
|
"type": "git",
|
|
87
74
|
"url": "https://github.com/ErikFortune/fgv.git"
|
|
75
|
+
},
|
|
76
|
+
"scripts": {
|
|
77
|
+
"build": "heft build --clean",
|
|
78
|
+
"clean": "heft clean",
|
|
79
|
+
"test": "heft test --clean",
|
|
80
|
+
"test-ts-res": "heft test --clean",
|
|
81
|
+
"build-docs": "typedoc --options ./config/typedoc.json",
|
|
82
|
+
"build-all": "rushx build; rushx build-docs",
|
|
83
|
+
"test-handles": "heft test --detect-open-handles",
|
|
84
|
+
"clean-jest": "heft test --clean",
|
|
85
|
+
"coverage": "heft test --clean --max-workers 1 --detect-open-handles",
|
|
86
|
+
"lint": "eslint src --ext .ts",
|
|
87
|
+
"fixlint": "eslint src --ext .ts --fix"
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|