@fgv/ts-res 5.1.0-15 → 5.1.0-17
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/common/helpers/resources.js +2 -4
- package/dist/packlets/common/validate/conditions.js +4 -4
- package/dist/packlets/common/validate/regularExpressions.js +2 -2
- package/dist/packlets/common/validate/resources.js +1 -1
- package/dist/packlets/conditions/condition.js +3 -7
- package/dist/packlets/decisions/decision.js +1 -1
- package/dist/packlets/import/fsItem.js +1 -4
- package/dist/packlets/import/importContext.js +3 -3
- package/dist/packlets/import/importers/collectionImporter.js +2 -2
- package/dist/packlets/import/importers/fsItemImporter.js +1 -1
- package/dist/packlets/import/importers/jsonImporter.js +2 -2
- package/dist/packlets/import/importers/pathImporter.js +1 -1
- package/dist/packlets/qualifier-types/languageQualifierType.js +6 -7
- package/dist/packlets/qualifier-types/literalQualifierType.js +7 -10
- package/dist/packlets/qualifier-types/qualifierType.js +12 -13
- package/dist/packlets/qualifier-types/territoryQualifierType.js +5 -5
- package/dist/packlets/qualifiers/qualifier.js +6 -7
- package/dist/packlets/qualifiers/qualifierCollector.js +2 -2
- package/dist/packlets/resource-json/resourceDeclCollection.js +1 -1
- package/dist/packlets/resource-json/resourceDeclTree.js +1 -1
- package/dist/packlets/resource-types/jsonResourceType.js +2 -2
- package/dist/packlets/resource-types/resourceType.js +2 -2
- package/dist/packlets/resources/resourceBuilder.js +2 -2
- package/dist/packlets/resources/resourceManagerBuilder.js +5 -5
- package/dist/packlets/runtime/compiledResourceCollection.js +5 -5
- package/dist/ts-res.d.ts +108 -111
- package/lib/packlets/common/helpers/resources.d.ts +2 -4
- package/lib/packlets/common/helpers/resources.js +2 -4
- package/lib/packlets/common/validate/conditions.d.ts +4 -4
- package/lib/packlets/common/validate/conditions.js +4 -4
- package/lib/packlets/common/validate/regularExpressions.d.ts +2 -2
- package/lib/packlets/common/validate/regularExpressions.js +2 -2
- package/lib/packlets/common/validate/resources.d.ts +1 -1
- package/lib/packlets/common/validate/resources.js +1 -1
- package/lib/packlets/conditions/condition.d.ts +3 -7
- package/lib/packlets/conditions/condition.js +3 -7
- package/lib/packlets/decisions/decision.d.ts +1 -1
- package/lib/packlets/decisions/decision.js +1 -1
- package/lib/packlets/import/fsItem.d.ts +1 -4
- package/lib/packlets/import/fsItem.js +1 -4
- package/lib/packlets/import/importContext.d.ts +5 -5
- package/lib/packlets/import/importContext.js +3 -3
- package/lib/packlets/import/importers/collectionImporter.d.ts +2 -2
- package/lib/packlets/import/importers/collectionImporter.js +2 -2
- package/lib/packlets/import/importers/fsItemImporter.d.ts +1 -1
- package/lib/packlets/import/importers/fsItemImporter.js +1 -1
- package/lib/packlets/import/importers/jsonImporter.d.ts +2 -2
- package/lib/packlets/import/importers/jsonImporter.js +2 -2
- package/lib/packlets/import/importers/pathImporter.d.ts +1 -1
- package/lib/packlets/import/importers/pathImporter.js +1 -1
- package/lib/packlets/qualifier-types/languageQualifierType.d.ts +6 -7
- package/lib/packlets/qualifier-types/languageQualifierType.js +6 -7
- package/lib/packlets/qualifier-types/literalQualifierType.d.ts +7 -10
- package/lib/packlets/qualifier-types/literalQualifierType.js +7 -10
- package/lib/packlets/qualifier-types/qualifierType.d.ts +17 -18
- package/lib/packlets/qualifier-types/qualifierType.js +12 -13
- package/lib/packlets/qualifier-types/territoryQualifierType.d.ts +8 -8
- package/lib/packlets/qualifier-types/territoryQualifierType.js +5 -5
- package/lib/packlets/qualifiers/qualifier.d.ts +6 -7
- package/lib/packlets/qualifiers/qualifier.js +6 -7
- package/lib/packlets/qualifiers/qualifierCollector.d.ts +3 -3
- package/lib/packlets/qualifiers/qualifierCollector.js +2 -2
- package/lib/packlets/resource-json/resourceDeclCollection.d.ts +1 -1
- package/lib/packlets/resource-json/resourceDeclCollection.js +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.d.ts +1 -1
- package/lib/packlets/resource-json/resourceDeclTree.js +1 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts +17 -5
- package/lib/packlets/resource-types/jsonResourceType.js +2 -2
- package/lib/packlets/resource-types/resourceType.d.ts +5 -5
- package/lib/packlets/resource-types/resourceType.js +2 -2
- package/lib/packlets/resources/resourceBuilder.d.ts +2 -2
- package/lib/packlets/resources/resourceBuilder.js +2 -2
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +5 -5
- package/lib/packlets/resources/resourceManagerBuilder.js +5 -5
- package/lib/packlets/runtime/compiledResourceCollection.d.ts +5 -5
- package/lib/packlets/runtime/compiledResourceCollection.js +5 -5
- package/package.json +9 -9
|
@@ -117,19 +117,19 @@ export interface IQualifierTypeCreateParams {
|
|
|
117
117
|
*/
|
|
118
118
|
export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonObject> implements IQualifierType<TCFGJSON> {
|
|
119
119
|
/**
|
|
120
|
-
* {@
|
|
120
|
+
* {@inheritDoc QualifierTypes.IQualifierType.name}
|
|
121
121
|
*/
|
|
122
122
|
readonly name: QualifierTypeName;
|
|
123
123
|
/**
|
|
124
|
-
* {@
|
|
124
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
125
125
|
*/
|
|
126
126
|
abstract readonly systemTypeName: QualifierTypeName;
|
|
127
127
|
/**
|
|
128
|
-
* {@
|
|
128
|
+
* {@inheritDoc QualifierTypes.IQualifierType.key}
|
|
129
129
|
*/
|
|
130
130
|
get key(): QualifierTypeName;
|
|
131
131
|
/**
|
|
132
|
-
* {@
|
|
132
|
+
* {@inheritDoc QualifierTypes.IQualifierType.index}
|
|
133
133
|
*/
|
|
134
134
|
get index(): QualifierTypeIndex | undefined;
|
|
135
135
|
protected readonly _collectible: Collections.Collectible<QualifierTypeName, QualifierTypeIndex>;
|
|
@@ -140,53 +140,52 @@ export declare abstract class QualifierType<TCFGJSON extends JsonObject = JsonOb
|
|
|
140
140
|
readonly allowContextList: boolean;
|
|
141
141
|
/**
|
|
142
142
|
* Constructor for use by derived classes.
|
|
143
|
-
* @param
|
|
144
|
-
*
|
|
145
|
-
* comma-separated list of runtime values in the context. Defaults to `false`.
|
|
143
|
+
* @param params - The {@link QualifierTypes.IQualifierTypeCreateParams | create parameters}
|
|
144
|
+
* for this qualifier type.
|
|
146
145
|
*/
|
|
147
146
|
protected constructor({ name, index, allowContextList }: IQualifierTypeCreateParams);
|
|
148
147
|
/**
|
|
149
|
-
* {@
|
|
148
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidConditionValue}
|
|
150
149
|
*/
|
|
151
150
|
abstract isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
152
151
|
/**
|
|
153
|
-
* {@
|
|
152
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidContextValue}
|
|
154
153
|
*/
|
|
155
154
|
isValidContextValue(value: string): value is QualifierContextValue;
|
|
156
155
|
/**
|
|
157
|
-
* {@
|
|
156
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
158
157
|
*/
|
|
159
158
|
isPotentialMatch(conditionValue: string, contextValue: string): boolean;
|
|
160
159
|
/**
|
|
161
|
-
* {@
|
|
160
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateCondition}
|
|
162
161
|
*/
|
|
163
162
|
validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;
|
|
164
163
|
/**
|
|
165
|
-
* {@
|
|
164
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateContextValue}
|
|
166
165
|
*/
|
|
167
166
|
validateContextValue(value: string): Result<QualifierContextValue>;
|
|
168
167
|
/**
|
|
169
|
-
* {@
|
|
168
|
+
* {@inheritDoc QualifierTypes.IQualifierType.matches}
|
|
170
169
|
*/
|
|
171
170
|
matches(condition: QualifierConditionValue, context: QualifierContextValue, operator: ConditionOperator): QualifierMatchScore;
|
|
172
171
|
/**
|
|
173
|
-
* {@
|
|
172
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
174
173
|
*/
|
|
175
174
|
abstract getConfigurationJson(): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;
|
|
176
175
|
/**
|
|
177
|
-
* {@
|
|
176
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
178
177
|
*/
|
|
179
178
|
abstract validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.IQualifierTypeConfig<TCFGJSON>>>;
|
|
180
179
|
/**
|
|
181
|
-
* {@
|
|
180
|
+
* {@inheritDoc QualifierTypes.IQualifierType.setIndex}
|
|
182
181
|
*/
|
|
183
182
|
setIndex(index: number): Result<QualifierTypeIndex>;
|
|
184
183
|
/**
|
|
185
|
-
* {@
|
|
184
|
+
* {@inheritDoc Validate.isValidQualifierTypeName}
|
|
186
185
|
*/
|
|
187
186
|
static isValidName(name: string): name is QualifierTypeName;
|
|
188
187
|
/**
|
|
189
|
-
* {@
|
|
188
|
+
* {@inheritDoc Validate.isValidQualifierTypeIndex}
|
|
190
189
|
*/
|
|
191
190
|
static isValidIndex(index: number): index is QualifierTypeIndex;
|
|
192
191
|
/**
|
|
@@ -31,22 +31,21 @@ const common_1 = require("../common");
|
|
|
31
31
|
*/
|
|
32
32
|
class QualifierType {
|
|
33
33
|
/**
|
|
34
|
-
* {@
|
|
34
|
+
* {@inheritDoc QualifierTypes.IQualifierType.key}
|
|
35
35
|
*/
|
|
36
36
|
get key() {
|
|
37
37
|
return this._collectible.key;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* {@
|
|
40
|
+
* {@inheritDoc QualifierTypes.IQualifierType.index}
|
|
41
41
|
*/
|
|
42
42
|
get index() {
|
|
43
43
|
return this._collectible.index;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Constructor for use by derived classes.
|
|
47
|
-
* @param
|
|
48
|
-
*
|
|
49
|
-
* comma-separated list of runtime values in the context. Defaults to `false`.
|
|
47
|
+
* @param params - The {@link QualifierTypes.IQualifierTypeCreateParams | create parameters}
|
|
48
|
+
* for this qualifier type.
|
|
50
49
|
*/
|
|
51
50
|
constructor({ name, index, allowContextList }) {
|
|
52
51
|
this.name = common_1.Convert.qualifierTypeName.convert(name).orThrow();
|
|
@@ -58,7 +57,7 @@ class QualifierType {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
/**
|
|
61
|
-
* {@
|
|
60
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidContextValue}
|
|
62
61
|
*/
|
|
63
62
|
isValidContextValue(value) {
|
|
64
63
|
if (this.isValidConditionValue(value)) {
|
|
@@ -72,7 +71,7 @@ class QualifierType {
|
|
|
72
71
|
return false;
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
|
-
* {@
|
|
74
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
76
75
|
*/
|
|
77
76
|
isPotentialMatch(conditionValue, contextValue) {
|
|
78
77
|
if (this.isValidConditionValue(conditionValue) && this.isValidContextValue(contextValue)) {
|
|
@@ -82,7 +81,7 @@ class QualifierType {
|
|
|
82
81
|
return false;
|
|
83
82
|
}
|
|
84
83
|
/**
|
|
85
|
-
* {@
|
|
84
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateCondition}
|
|
86
85
|
*/
|
|
87
86
|
validateCondition(value, operator) {
|
|
88
87
|
operator = operator !== null && operator !== void 0 ? operator : 'matches';
|
|
@@ -97,7 +96,7 @@ class QualifierType {
|
|
|
97
96
|
return (0, ts_utils_1.succeed)(value);
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
100
|
-
* {@
|
|
99
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateContextValue}
|
|
101
100
|
*/
|
|
102
101
|
validateContextValue(value) {
|
|
103
102
|
/* c8 ignore next 2 - functional error case tested but coverage intermittently missed */
|
|
@@ -107,7 +106,7 @@ class QualifierType {
|
|
|
107
106
|
return (0, ts_utils_1.succeed)(value);
|
|
108
107
|
}
|
|
109
108
|
/**
|
|
110
|
-
* {@
|
|
109
|
+
* {@inheritDoc QualifierTypes.IQualifierType.matches}
|
|
111
110
|
*/
|
|
112
111
|
matches(condition, context, operator) {
|
|
113
112
|
if (this.allowContextList) {
|
|
@@ -116,19 +115,19 @@ class QualifierType {
|
|
|
116
115
|
return this._matchOne(condition, context, operator);
|
|
117
116
|
}
|
|
118
117
|
/**
|
|
119
|
-
* {@
|
|
118
|
+
* {@inheritDoc QualifierTypes.IQualifierType.setIndex}
|
|
120
119
|
*/
|
|
121
120
|
setIndex(index) {
|
|
122
121
|
return this._collectible.setIndex(index);
|
|
123
122
|
}
|
|
124
123
|
/**
|
|
125
|
-
* {@
|
|
124
|
+
* {@inheritDoc Validate.isValidQualifierTypeName}
|
|
126
125
|
*/
|
|
127
126
|
static isValidName(name) {
|
|
128
127
|
return common_1.Validate.isValidQualifierTypeName(name);
|
|
129
128
|
}
|
|
130
129
|
/**
|
|
131
|
-
* {@
|
|
130
|
+
* {@inheritDoc Validate.isValidQualifierTypeIndex}
|
|
132
131
|
*/
|
|
133
132
|
static isValidIndex(index) {
|
|
134
133
|
return common_1.Validate.isValidQualifierTypeIndex(index);
|
|
@@ -10,15 +10,15 @@ import { JsonCompatibleType } from '@fgv/ts-json-base';
|
|
|
10
10
|
*/
|
|
11
11
|
export interface ITerritoryQualifierTypeCreateParams {
|
|
12
12
|
/**
|
|
13
|
-
* {@
|
|
13
|
+
* {@inheritDoc QualifierTypes.IQualifierTypeCreateParams.name}
|
|
14
14
|
*/
|
|
15
15
|
name?: string;
|
|
16
16
|
/**
|
|
17
|
-
* {@
|
|
17
|
+
* {@inheritDoc QualifierTypes.IQualifierTypeCreateParams.allowContextList}
|
|
18
18
|
*/
|
|
19
19
|
allowContextList?: boolean;
|
|
20
20
|
/**
|
|
21
|
-
* {@
|
|
21
|
+
* {@inheritDoc QualifierTypes.IQualifierTypeCreateParams.index}
|
|
22
22
|
*/
|
|
23
23
|
index?: number;
|
|
24
24
|
/**
|
|
@@ -44,7 +44,7 @@ export interface ITerritoryQualifierTypeCreateParams {
|
|
|
44
44
|
*/
|
|
45
45
|
export declare class TerritoryQualifierType extends QualifierType<JsonCompatibleType<Config.ITerritoryQualifierTypeConfig>> {
|
|
46
46
|
/**
|
|
47
|
-
* {@
|
|
47
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
48
48
|
*/
|
|
49
49
|
readonly systemTypeName: QualifierTypeName;
|
|
50
50
|
/**
|
|
@@ -67,7 +67,7 @@ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible
|
|
|
67
67
|
*/
|
|
68
68
|
protected constructor({ acceptLowercase, allowedTerritories, allowContextList, name, index, hierarchy }: ITerritoryQualifierTypeCreateParams);
|
|
69
69
|
/**
|
|
70
|
-
* {@
|
|
70
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidConditionValue}
|
|
71
71
|
*/
|
|
72
72
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
73
73
|
/**
|
|
@@ -95,11 +95,11 @@ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible
|
|
|
95
95
|
*/
|
|
96
96
|
getConfiguration(): Result<Config.ISystemTerritoryQualifierTypeConfig>;
|
|
97
97
|
/**
|
|
98
|
-
* {@
|
|
98
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
99
99
|
*/
|
|
100
100
|
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemTerritoryQualifierTypeConfig>>;
|
|
101
101
|
/**
|
|
102
|
-
* {@
|
|
102
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
103
103
|
*/
|
|
104
104
|
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemTerritoryQualifierTypeConfig>>;
|
|
105
105
|
/**
|
|
@@ -110,7 +110,7 @@ export declare class TerritoryQualifierType extends QualifierType<JsonCompatible
|
|
|
110
110
|
*/
|
|
111
111
|
validateConfiguration(from: unknown): Result<Config.ISystemTerritoryQualifierTypeConfig>;
|
|
112
112
|
/**
|
|
113
|
-
* {@
|
|
113
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
114
114
|
*/
|
|
115
115
|
protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, __operator?: ConditionOperator): QualifierMatchScore;
|
|
116
116
|
/**
|
|
@@ -86,7 +86,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
86
86
|
index: validIndex
|
|
87
87
|
});
|
|
88
88
|
/**
|
|
89
|
-
* {@
|
|
89
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
90
90
|
*/
|
|
91
91
|
this.systemTypeName = common_1.Convert.qualifierTypeName
|
|
92
92
|
.convert('territory')
|
|
@@ -102,7 +102,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* {@
|
|
105
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidConditionValue}
|
|
106
106
|
*/
|
|
107
107
|
isValidConditionValue(value) {
|
|
108
108
|
const normalized = this.acceptLowercase ? value.toUpperCase() : value;
|
|
@@ -156,7 +156,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
156
156
|
return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
-
* {@
|
|
159
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
160
160
|
*/
|
|
161
161
|
getConfigurationJson() {
|
|
162
162
|
const hierarchy = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};
|
|
@@ -170,7 +170,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* {@
|
|
173
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
174
174
|
*/
|
|
175
175
|
validateConfigurationJson(from) {
|
|
176
176
|
return Config.Convert.systemTerritoryQualifierTypeConfig.convert(from);
|
|
@@ -185,7 +185,7 @@ class TerritoryQualifierType extends qualifierType_1.QualifierType {
|
|
|
185
185
|
return this.validateConfigurationJson(from).onSuccess((json) => Config.Convert.systemTerritoryQualifierTypeConfig.convert(json));
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
|
-
* {@
|
|
188
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
189
189
|
*/
|
|
190
190
|
_matchOne(condition, context, __operator) {
|
|
191
191
|
if (this.isValidConditionValue(condition) && this.isValidContextValue(context)) {
|
|
@@ -46,9 +46,8 @@ export declare class Qualifier implements IValidatedQualifierDecl, ICollectible<
|
|
|
46
46
|
/**
|
|
47
47
|
* Constructs a new instance of a {@link Qualifiers.Qualifier | Qualifier} from the
|
|
48
48
|
* supplied {@link Qualifiers.IValidatedQualifierDecl | validated declaration}.
|
|
49
|
-
* @param
|
|
50
|
-
*
|
|
51
|
-
* @param defaultPriority - The default {@link ConditionPriority | priority} of conditions
|
|
49
|
+
* @param decl - The {@link Qualifiers.IValidatedQualifierDecl | validated declaration}
|
|
50
|
+
* describing the qualifier to construct.
|
|
52
51
|
* @public
|
|
53
52
|
*/
|
|
54
53
|
protected constructor({ name, token, type, defaultPriority, tokenIsOptional, defaultValue, index }: IValidatedQualifierDecl);
|
|
@@ -69,19 +68,19 @@ export declare class Qualifier implements IValidatedQualifierDecl, ICollectible<
|
|
|
69
68
|
*/
|
|
70
69
|
setIndex(index: QualifierIndex): Result<QualifierIndex>;
|
|
71
70
|
/**
|
|
72
|
-
* {@
|
|
71
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidContextValue}
|
|
73
72
|
*/
|
|
74
73
|
isValidContextValue(value: string): value is QualifierContextValue;
|
|
75
74
|
/**
|
|
76
|
-
* {@
|
|
75
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidConditionValue}
|
|
77
76
|
*/
|
|
78
77
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
79
78
|
/**
|
|
80
|
-
* {@
|
|
79
|
+
* {@inheritDoc QualifierTypes.QualifierType.validateCondition}
|
|
81
80
|
*/
|
|
82
81
|
validateCondition(value: string, operator?: ConditionOperator): Result<QualifierConditionValue>;
|
|
83
82
|
/**
|
|
84
|
-
* {@
|
|
83
|
+
* {@inheritDoc QualifierTypes.QualifierType.validateContextValue}
|
|
85
84
|
*/
|
|
86
85
|
validateContextValue(value: string): Result<QualifierContextValue>;
|
|
87
86
|
}
|
|
@@ -45,9 +45,8 @@ class Qualifier {
|
|
|
45
45
|
/**
|
|
46
46
|
* Constructs a new instance of a {@link Qualifiers.Qualifier | Qualifier} from the
|
|
47
47
|
* supplied {@link Qualifiers.IValidatedQualifierDecl | validated declaration}.
|
|
48
|
-
* @param
|
|
49
|
-
*
|
|
50
|
-
* @param defaultPriority - The default {@link ConditionPriority | priority} of conditions
|
|
48
|
+
* @param decl - The {@link Qualifiers.IValidatedQualifierDecl | validated declaration}
|
|
49
|
+
* describing the qualifier to construct.
|
|
51
50
|
* @public
|
|
52
51
|
*/
|
|
53
52
|
constructor({ name, token, type, defaultPriority, tokenIsOptional, defaultValue, index }) {
|
|
@@ -84,25 +83,25 @@ class Qualifier {
|
|
|
84
83
|
return this._collectible.setIndex(index);
|
|
85
84
|
}
|
|
86
85
|
/**
|
|
87
|
-
* {@
|
|
86
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidContextValue}
|
|
88
87
|
*/
|
|
89
88
|
isValidContextValue(value) {
|
|
90
89
|
return this.type.isValidContextValue(value);
|
|
91
90
|
}
|
|
92
91
|
/**
|
|
93
|
-
* {@
|
|
92
|
+
* {@inheritDoc QualifierTypes.QualifierType.isValidConditionValue}
|
|
94
93
|
*/
|
|
95
94
|
isValidConditionValue(value) {
|
|
96
95
|
return this.type.isValidConditionValue(value);
|
|
97
96
|
}
|
|
98
97
|
/**
|
|
99
|
-
* {@
|
|
98
|
+
* {@inheritDoc QualifierTypes.QualifierType.validateCondition}
|
|
100
99
|
*/
|
|
101
100
|
validateCondition(value, operator) {
|
|
102
101
|
return this.type.validateCondition(value, operator);
|
|
103
102
|
}
|
|
104
103
|
/**
|
|
105
|
-
* {@
|
|
104
|
+
* {@inheritDoc QualifierTypes.QualifierType.validateContextValue}
|
|
106
105
|
*/
|
|
107
106
|
validateContextValue(value) {
|
|
108
107
|
return this.type.validateContextValue(value);
|
|
@@ -9,7 +9,7 @@ import { ReadOnlyQualifierTypeCollector } from '../qualifier-types';
|
|
|
9
9
|
*/
|
|
10
10
|
export interface IReadOnlyQualifierCollector extends Collections.IReadOnlyValidatingCollector<Qualifier> {
|
|
11
11
|
/**
|
|
12
|
-
* {@
|
|
12
|
+
* {@inheritDoc Qualifiers.QualifierCollector.qualifierTypes}
|
|
13
13
|
*/
|
|
14
14
|
readonly qualifierTypes: ReadOnlyQualifierTypeCollector;
|
|
15
15
|
/**
|
|
@@ -65,11 +65,11 @@ export declare class QualifierCollector extends ValidatingConvertingCollector<Qu
|
|
|
65
65
|
*/
|
|
66
66
|
static create(params: IQualifierCollectorCreateParams): Result<QualifierCollector>;
|
|
67
67
|
/**
|
|
68
|
-
* {@
|
|
68
|
+
* {@inheritDoc Qualifiers.IReadOnlyQualifierCollector.getByNameOrToken}
|
|
69
69
|
*/
|
|
70
70
|
getByNameOrToken(nameOrToken: string): Result<Qualifier>;
|
|
71
71
|
/**
|
|
72
|
-
* {@
|
|
72
|
+
* {@inheritDoc Qualifiers.IReadOnlyQualifierCollector.hasNameOrToken}
|
|
73
73
|
*/
|
|
74
74
|
hasNameOrToken(nameOrToken: string): boolean;
|
|
75
75
|
/**
|
|
@@ -93,7 +93,7 @@ class QualifierCollector extends ts_utils_1.ValidatingConvertingCollector {
|
|
|
93
93
|
return (0, ts_utils_1.captureResult)(() => new QualifierCollector(params));
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* {@
|
|
96
|
+
* {@inheritDoc Qualifiers.IReadOnlyQualifierCollector.getByNameOrToken}
|
|
97
97
|
*/
|
|
98
98
|
getByNameOrToken(nameOrToken) {
|
|
99
99
|
return this.validating.get(nameOrToken).onFailure((message) => {
|
|
@@ -106,7 +106,7 @@ class QualifierCollector extends ts_utils_1.ValidatingConvertingCollector {
|
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* {@
|
|
109
|
+
* {@inheritDoc Qualifiers.IReadOnlyQualifierCollector.hasNameOrToken}
|
|
110
110
|
*/
|
|
111
111
|
hasNameOrToken(nameOrToken) {
|
|
112
112
|
/* c8 ignore next 3 - functional code path tested but coverage intermittently missed */
|
|
@@ -13,7 +13,7 @@ export declare class ResourceDeclCollection implements IResourceDeclContainer {
|
|
|
13
13
|
*/
|
|
14
14
|
readonly collection: Normalized.IImporterResourceCollectionDecl;
|
|
15
15
|
/**
|
|
16
|
-
* {@
|
|
16
|
+
* {@inheritDoc ResourceJson.IResourceDeclContainer.context}
|
|
17
17
|
*/
|
|
18
18
|
get context(): Normalized.IContainerContextDecl | undefined;
|
|
19
19
|
protected _resources: Normalized.IImporterResourceDecl[];
|
|
@@ -65,7 +65,7 @@ const helpers_1 = require("./helpers");
|
|
|
65
65
|
*/
|
|
66
66
|
class ResourceDeclCollection {
|
|
67
67
|
/**
|
|
68
|
-
* {@
|
|
68
|
+
* {@inheritDoc ResourceJson.IResourceDeclContainer.context}
|
|
69
69
|
*/
|
|
70
70
|
get context() {
|
|
71
71
|
return this.collection.context;
|
|
@@ -13,7 +13,7 @@ export declare class ResourceDeclTree implements IResourceDeclContainer {
|
|
|
13
13
|
*/
|
|
14
14
|
readonly tree: Normalized.IResourceTreeRootDecl;
|
|
15
15
|
/**
|
|
16
|
-
* {@
|
|
16
|
+
* {@inheritDoc ResourceJson.IResourceDeclContainer.context}
|
|
17
17
|
*/
|
|
18
18
|
get context(): Normalized.IContainerContextDecl | undefined;
|
|
19
19
|
protected _resources: Normalized.ILooseResourceDecl[];
|
|
@@ -66,7 +66,7 @@ const helpers_1 = require("./helpers");
|
|
|
66
66
|
*/
|
|
67
67
|
class ResourceDeclTree {
|
|
68
68
|
/**
|
|
69
|
-
* {@
|
|
69
|
+
* {@inheritDoc ResourceJson.IResourceDeclContainer.context}
|
|
70
70
|
*/
|
|
71
71
|
get context() {
|
|
72
72
|
return this.tree.context;
|
|
@@ -29,7 +29,7 @@ export interface IJsonResourceTypeCreateParams {
|
|
|
29
29
|
*/
|
|
30
30
|
export declare class JsonResourceType extends ResourceType<JsonObject> {
|
|
31
31
|
/**
|
|
32
|
-
* {@
|
|
32
|
+
* {@inheritDoc ResourceTypes.ResourceType.systemTypeName}
|
|
33
33
|
*/
|
|
34
34
|
readonly systemTypeName: ResourceTypeName;
|
|
35
35
|
/**
|
|
@@ -47,19 +47,31 @@ export declare class JsonResourceType extends ResourceType<JsonObject> {
|
|
|
47
47
|
*/
|
|
48
48
|
static create(params?: IJsonResourceTypeCreateParams): Result<JsonResourceType>;
|
|
49
49
|
/**
|
|
50
|
-
* {@
|
|
50
|
+
* {@inheritDoc ResourceTypes.ResourceType.validateDeclaration}
|
|
51
51
|
*/
|
|
52
52
|
validateDeclaration(props: IResourceCandidateValidationProperties): Result<JsonObject>;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* Validates a JSON value for use as a resource instance value.
|
|
55
|
+
* @param json - The JSON value to validate.
|
|
56
|
+
* @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.
|
|
57
|
+
* @returns `Success` with the strongly-typed resource value if the JSON is valid,
|
|
58
|
+
* `Failure` with an error message otherwise.
|
|
55
59
|
*/
|
|
56
60
|
validate(json: JsonObject, completeness: CandidateCompleteness): Result<JsonObject>;
|
|
57
61
|
/**
|
|
58
|
-
*
|
|
62
|
+
* Validates a JSON value for use as a complete resource instance value.
|
|
63
|
+
* @param json - The JSON value to validate.
|
|
64
|
+
* @param completeness - Must be `'full'` to indicate a complete value.
|
|
65
|
+
* @returns `Success` with the strongly-typed resource value if the JSON is valid,
|
|
66
|
+
* `Failure` with an error message otherwise.
|
|
59
67
|
*/
|
|
60
68
|
validate(json: JsonObject, completeness: 'full'): Result<JsonObject>;
|
|
61
69
|
/**
|
|
62
|
-
*
|
|
70
|
+
* Validates a JSON value for use as a partial resource instance value.
|
|
71
|
+
* @param json - The JSON value to validate.
|
|
72
|
+
* @param completeness - Must be `'partial'` to indicate a partial value.
|
|
73
|
+
* @returns `Success` with the strongly-typed partial resource value if the JSON is valid,
|
|
74
|
+
* `Failure` with an error message otherwise.
|
|
63
75
|
*/
|
|
64
76
|
validate(json: JsonObject, completeness: 'partial'): Result<JsonObject>;
|
|
65
77
|
}
|
|
@@ -40,7 +40,7 @@ class JsonResourceType extends resourceType_1.ResourceType {
|
|
|
40
40
|
constructor(key, index, template) {
|
|
41
41
|
super(key, index, template);
|
|
42
42
|
/**
|
|
43
|
-
* {@
|
|
43
|
+
* {@inheritDoc ResourceTypes.ResourceType.systemTypeName}
|
|
44
44
|
*/
|
|
45
45
|
this.systemTypeName = common_1.Convert.resourceTypeName.convert('json').orThrow();
|
|
46
46
|
}
|
|
@@ -57,7 +57,7 @@ class JsonResourceType extends resourceType_1.ResourceType {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* {@
|
|
60
|
+
* {@inheritDoc ResourceTypes.ResourceType.validateDeclaration}
|
|
61
61
|
*/
|
|
62
62
|
validateDeclaration(props) {
|
|
63
63
|
return ts_json_base_1.Converters.jsonObject.convert(props.json);
|
|
@@ -8,7 +8,7 @@ import * as ResourceJson from '../resource-json';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface IResourceCandidateValidationProperties {
|
|
10
10
|
/**
|
|
11
|
-
* {@
|
|
11
|
+
* {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.id}
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
id: ResourceId;
|
|
@@ -18,12 +18,12 @@ export interface IResourceCandidateValidationProperties {
|
|
|
18
18
|
*/
|
|
19
19
|
completeness: CandidateCompleteness;
|
|
20
20
|
/**
|
|
21
|
-
* {@
|
|
21
|
+
* {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.json}
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
24
|
json: JsonValue;
|
|
25
25
|
/**
|
|
26
|
-
* {@
|
|
26
|
+
* {@inheritDoc ResourceJson.Json.ILooseResourceCandidateDecl.mergeMethod}
|
|
27
27
|
* @public
|
|
28
28
|
*/
|
|
29
29
|
mergeMethod: ResourceValueMergeMethod;
|
|
@@ -105,7 +105,7 @@ export declare abstract class ResourceType<T = unknown> implements IResourceType
|
|
|
105
105
|
private _collectible;
|
|
106
106
|
private _template;
|
|
107
107
|
/**
|
|
108
|
-
* {@
|
|
108
|
+
* {@inheritDoc ResourceTypes.IResourceType.key}
|
|
109
109
|
*/
|
|
110
110
|
get key(): ResourceTypeName;
|
|
111
111
|
/**
|
|
@@ -113,7 +113,7 @@ export declare abstract class ResourceType<T = unknown> implements IResourceType
|
|
|
113
113
|
*/
|
|
114
114
|
abstract readonly systemTypeName: ResourceTypeName;
|
|
115
115
|
/**
|
|
116
|
-
* {@
|
|
116
|
+
* {@inheritDoc ResourceTypes.IResourceType.index}
|
|
117
117
|
*/
|
|
118
118
|
get index(): ResourceTypeIndex | undefined;
|
|
119
119
|
protected constructor(key: ResourceTypeName, index?: number, template?: JsonObject);
|
|
@@ -33,13 +33,13 @@ const common_1 = require("../common");
|
|
|
33
33
|
*/
|
|
34
34
|
class ResourceType {
|
|
35
35
|
/**
|
|
36
|
-
* {@
|
|
36
|
+
* {@inheritDoc ResourceTypes.IResourceType.key}
|
|
37
37
|
*/
|
|
38
38
|
get key() {
|
|
39
39
|
return this._collectible.key;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* {@
|
|
42
|
+
* {@inheritDoc ResourceTypes.IResourceType.index}
|
|
43
43
|
*/
|
|
44
44
|
get index() {
|
|
45
45
|
return this._collectible.index;
|
|
@@ -95,7 +95,7 @@ export declare class ResourceBuilder {
|
|
|
95
95
|
/**
|
|
96
96
|
* Given a {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}, creates and adds a
|
|
97
97
|
* {@link Resources.ResourceCandidate | candidate} to the resource being built.
|
|
98
|
-
* @param
|
|
98
|
+
* @param childDecl - The {@link ResourceJson.Json.IChildResourceCandidateDecl | IChildResourceCandidateDecl} to add to the
|
|
99
99
|
* resource being built.
|
|
100
100
|
* @returns `Success` with the added {@link Resources.ResourceCandidate | candidate} if successful,
|
|
101
101
|
* or `Failure` with an error message if not.
|
|
@@ -104,7 +104,7 @@ export declare class ResourceBuilder {
|
|
|
104
104
|
/**
|
|
105
105
|
* Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, creates and adds a
|
|
106
106
|
* {@link Resources.ResourceCandidate | candidate} to the resource being built.
|
|
107
|
-
* @param
|
|
107
|
+
* @param decl - The {@link ResourceJson.Json.ILooseResourceCandidateDecl | IResourceCandidateDecl} to add to the
|
|
108
108
|
* resource being built.
|
|
109
109
|
* @returns `Success` with the added {@link Resources.ResourceCandidate | candidate} if successful,
|
|
110
110
|
* or `Failure` with an error message if not. Fails with error detail 'type-mismatch' if the candidate
|
|
@@ -84,7 +84,7 @@ class ResourceBuilder {
|
|
|
84
84
|
/**
|
|
85
85
|
* Given a {@link ResourceJson.Json.IChildResourceCandidateDecl | child resource candidate declaration}, creates and adds a
|
|
86
86
|
* {@link Resources.ResourceCandidate | candidate} to the resource being built.
|
|
87
|
-
* @param
|
|
87
|
+
* @param childDecl - The {@link ResourceJson.Json.IChildResourceCandidateDecl | IChildResourceCandidateDecl} to add to the
|
|
88
88
|
* resource being built.
|
|
89
89
|
* @returns `Success` with the added {@link Resources.ResourceCandidate | candidate} if successful,
|
|
90
90
|
* or `Failure` with an error message if not.
|
|
@@ -116,7 +116,7 @@ class ResourceBuilder {
|
|
|
116
116
|
/**
|
|
117
117
|
* Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, creates and adds a
|
|
118
118
|
* {@link Resources.ResourceCandidate | candidate} to the resource being built.
|
|
119
|
-
* @param
|
|
119
|
+
* @param decl - The {@link ResourceJson.Json.ILooseResourceCandidateDecl | IResourceCandidateDecl} to add to the
|
|
120
120
|
* resource being built.
|
|
121
121
|
* @returns `Success` with the added {@link Resources.ResourceCandidate | candidate} if successful,
|
|
122
122
|
* or `Failure` with an error message if not. Fails with error detail 'type-mismatch' if the candidate
|