@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
|
@@ -13,8 +13,7 @@ export declare function splitResourceId(id: string | undefined): Result<Resource
|
|
|
13
13
|
* Joins a list of {@link ResourceId | resource ID} or {@link ResourceName | resource name} with
|
|
14
14
|
* to create a new {@link ResourceId | resource ID}. Fails if resulting ID is invalid or empty.
|
|
15
15
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @param names - Additional names to join.
|
|
16
|
+
* @param ids - The names or IDs to join.
|
|
18
17
|
* @returns `Success` with the new ID if the base and names are valid, or `Failure` with an error message
|
|
19
18
|
* if not.
|
|
20
19
|
* @public
|
|
@@ -24,8 +23,7 @@ export declare function joinResourceIds(...ids: (string | undefined)[]): Result<
|
|
|
24
23
|
* Joins a list of {@link ResourceId | resource ID} or {@link ResourceName | resource name} with
|
|
25
24
|
* to create a new {@link ResourceId | resource ID}. Returns `undefined` if no names are defined.
|
|
26
25
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param names - Additional names to join.
|
|
26
|
+
* @param ids - The names or IDs to join.
|
|
29
27
|
* @returns `Success` with the new ID if the base and names are valid, `Success` with `undefined`
|
|
30
28
|
* if names were present, or `Failure` with an error message if the resulting id is invalid.
|
|
31
29
|
* @public
|
|
@@ -46,8 +46,7 @@ function splitResourceId(id) {
|
|
|
46
46
|
* Joins a list of {@link ResourceId | resource ID} or {@link ResourceName | resource name} with
|
|
47
47
|
* to create a new {@link ResourceId | resource ID}. Fails if resulting ID is invalid or empty.
|
|
48
48
|
*
|
|
49
|
-
* @param
|
|
50
|
-
* @param names - Additional names to join.
|
|
49
|
+
* @param ids - The names or IDs to join.
|
|
51
50
|
* @returns `Success` with the new ID if the base and names are valid, or `Failure` with an error message
|
|
52
51
|
* if not.
|
|
53
52
|
* @public
|
|
@@ -67,8 +66,7 @@ function joinResourceIds(...ids) {
|
|
|
67
66
|
* Joins a list of {@link ResourceId | resource ID} or {@link ResourceName | resource name} with
|
|
68
67
|
* to create a new {@link ResourceId | resource ID}. Returns `undefined` if no names are defined.
|
|
69
68
|
*
|
|
70
|
-
* @param
|
|
71
|
-
* @param names - Additional names to join.
|
|
69
|
+
* @param ids - The names or IDs to join.
|
|
72
70
|
* @returns `Success` with the new ID if the base and names are valid, `Success` with `undefined`
|
|
73
71
|
* if names were present, or `Failure` with an error message if the resulting id is invalid.
|
|
74
72
|
* @public
|
|
@@ -239,16 +239,16 @@ export declare function toConditionSetKey(key: string): Result<ConditionSetKey>;
|
|
|
239
239
|
export declare function toConditionSetToken(token: string): Result<ConditionSetToken>;
|
|
240
240
|
/**
|
|
241
241
|
* Converts a string to a {@link ConditionSetHash} if it is a valid condition set hash.
|
|
242
|
-
* @param
|
|
242
|
+
* @param hash - the string to convert
|
|
243
243
|
* @returns `Success` with the converted {@link ConditionSetHash} if successful, or `Failure` with an
|
|
244
244
|
* error message if not.
|
|
245
245
|
* @public
|
|
246
246
|
*/
|
|
247
247
|
export declare function toConditionSetHash(hash: string): Result<ConditionSetHash>;
|
|
248
248
|
/**
|
|
249
|
-
* Converts a
|
|
250
|
-
* @param
|
|
251
|
-
* @returns `Success` with the converted {@link
|
|
249
|
+
* Converts a string to a {@link DecisionKey} if it is a valid decision key.
|
|
250
|
+
* @param key - the string to convert
|
|
251
|
+
* @returns `Success` with the converted {@link DecisionKey} if successful, or `Failure` with an
|
|
252
252
|
* error message if not.
|
|
253
253
|
* @public
|
|
254
254
|
*/
|
|
@@ -433,7 +433,7 @@ function toConditionSetToken(token) {
|
|
|
433
433
|
}
|
|
434
434
|
/**
|
|
435
435
|
* Converts a string to a {@link ConditionSetHash} if it is a valid condition set hash.
|
|
436
|
-
* @param
|
|
436
|
+
* @param hash - the string to convert
|
|
437
437
|
* @returns `Success` with the converted {@link ConditionSetHash} if successful, or `Failure` with an
|
|
438
438
|
* error message if not.
|
|
439
439
|
* @public
|
|
@@ -445,9 +445,9 @@ function toConditionSetHash(hash) {
|
|
|
445
445
|
return (0, ts_utils_1.succeed)(hash);
|
|
446
446
|
}
|
|
447
447
|
/**
|
|
448
|
-
* Converts a
|
|
449
|
-
* @param
|
|
450
|
-
* @returns `Success` with the converted {@link
|
|
448
|
+
* Converts a string to a {@link DecisionKey} if it is a valid decision key.
|
|
449
|
+
* @param key - the string to convert
|
|
450
|
+
* @returns `Success` with the converted {@link DecisionKey} if successful, or `Failure` with an
|
|
451
451
|
* error message if not.
|
|
452
452
|
* @public
|
|
453
453
|
*/
|
|
@@ -12,8 +12,8 @@ export declare const segmentedIdentifier: RegExp;
|
|
|
12
12
|
export declare const identifierList: RegExp;
|
|
13
13
|
/**
|
|
14
14
|
* The format of a {@link ConditionKey | condition key} is:
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* \<qualifierName\>-\[<value>\]\[\@<priority>\]\(\<scoreAsDefault\>\) where operator is `matches`, or
|
|
16
|
+
* \<qualifierName\>-\<operator\>-\[<value>\]\[\@<priority>\]\(\<scoreAsDefault\>\)
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export declare const conditionKey: RegExp;
|
|
@@ -36,8 +36,8 @@ exports.segmentedIdentifier = /^[a-zA-Z_][a-zA-Z0-9_\-]*(\.[a-zA-Z_][a-zA-Z0-9_\
|
|
|
36
36
|
exports.identifierList = /^[a-zA-Z_][a-zA-Z0-9_\-]*(,[a-zA-Z_][a-zA-Z0-9_\-]*)*$/;
|
|
37
37
|
/**
|
|
38
38
|
* The format of a {@link ConditionKey | condition key} is:
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* \<qualifierName\>-\[<value>\]\[\@<priority>\]\(\<scoreAsDefault\>\) where operator is `matches`, or
|
|
40
|
+
* \<qualifierName\>-\<operator\>-\[<value>\]\[\@<priority>\]\(\<scoreAsDefault\>\)
|
|
41
41
|
* @internal
|
|
42
42
|
*/
|
|
43
43
|
exports.conditionKey = /^[a-zA-Z_][a-zA-Z0-9_\-]*(-matches)?-\[.*\](?:@[0-9]{1,4})?(?:\([01](?:\.[0-9]+)?\))?$/;
|
|
@@ -59,7 +59,7 @@ export declare function isValidCandidateValueKey(key: string): key is CandidateV
|
|
|
59
59
|
/**
|
|
60
60
|
* Converts a string to a {@link ResourceName | resource name}.
|
|
61
61
|
*
|
|
62
|
-
* @param
|
|
62
|
+
* @param name - The string to convert.
|
|
63
63
|
* @returns `Success` with the converted name if valid, or `Failure` with an error message
|
|
64
64
|
* if not.
|
|
65
65
|
* @public
|
|
@@ -111,7 +111,7 @@ function isValidCandidateValueKey(key) {
|
|
|
111
111
|
/**
|
|
112
112
|
* Converts a string to a {@link ResourceName | resource name}.
|
|
113
113
|
*
|
|
114
|
-
* @param
|
|
114
|
+
* @param name - The string to convert.
|
|
115
115
|
* @returns `Success` with the converted name if valid, or `Failure` with an error message
|
|
116
116
|
* if not.
|
|
117
117
|
* @public
|
|
@@ -32,12 +32,8 @@ export declare class Condition implements IValidatedConditionDecl {
|
|
|
32
32
|
protected _collectible: Collections.Collectible<ConditionKey, ConditionIndex>;
|
|
33
33
|
/**
|
|
34
34
|
* Constructs a new {@link Conditions.Condition | Condition} object.
|
|
35
|
-
* @param
|
|
36
|
-
*
|
|
37
|
-
* @param operator - The {@link ConditionOperator | operator} used when matching context value to condition value.
|
|
38
|
-
* @param priority - The {@link ConditionPriority | relative priority} of this condition.
|
|
39
|
-
* @param scoreAsDefault - The {@link QualifierMatchScore | score} to be used when this condition is the default.
|
|
40
|
-
* @param index - The index of this condition.
|
|
35
|
+
* @param params - The {@link Conditions.IValidatedConditionDecl | validated condition declaration}
|
|
36
|
+
* used to construct this condition.
|
|
41
37
|
* @public
|
|
42
38
|
*/
|
|
43
39
|
protected constructor({ qualifier, value, operator, priority, scoreAsDefault, index }: IValidatedConditionDecl);
|
|
@@ -61,7 +57,7 @@ export declare class Condition implements IValidatedConditionDecl {
|
|
|
61
57
|
* @returns A {@link QualifierMatchScore | match score} indicating match quality if the condition is present
|
|
62
58
|
* in the context to be matched, `undefined` otherwise.
|
|
63
59
|
* @remarks
|
|
64
|
-
* If {@link Context.IContextMatchOptions.partialContextMatch | `options.partialContextMatch
|
|
60
|
+
* If {@link Context.IContextMatchOptions.partialContextMatch | `options.partialContextMatch`} is `true`, then
|
|
65
61
|
* the method will return `undefined` if the corresponding qualifier is not present in the context.
|
|
66
62
|
*/
|
|
67
63
|
getContextMatch(context: Context.IValidatedContextDecl, options?: Context.IContextMatchOptions): QualifierMatchScore | undefined;
|
|
@@ -33,12 +33,8 @@ const scoreFormatter = new Intl.NumberFormat('en-US', { minimumFractionDigits: 0
|
|
|
33
33
|
class Condition {
|
|
34
34
|
/**
|
|
35
35
|
* Constructs a new {@link Conditions.Condition | Condition} object.
|
|
36
|
-
* @param
|
|
37
|
-
*
|
|
38
|
-
* @param operator - The {@link ConditionOperator | operator} used when matching context value to condition value.
|
|
39
|
-
* @param priority - The {@link ConditionPriority | relative priority} of this condition.
|
|
40
|
-
* @param scoreAsDefault - The {@link QualifierMatchScore | score} to be used when this condition is the default.
|
|
41
|
-
* @param index - The index of this condition.
|
|
36
|
+
* @param params - The {@link Conditions.IValidatedConditionDecl | validated condition declaration}
|
|
37
|
+
* used to construct this condition.
|
|
42
38
|
* @public
|
|
43
39
|
*/
|
|
44
40
|
constructor({ qualifier, value, operator, priority, scoreAsDefault, index }) {
|
|
@@ -88,7 +84,7 @@ class Condition {
|
|
|
88
84
|
* @returns A {@link QualifierMatchScore | match score} indicating match quality if the condition is present
|
|
89
85
|
* in the context to be matched, `undefined` otherwise.
|
|
90
86
|
* @remarks
|
|
91
|
-
* If {@link Context.IContextMatchOptions.partialContextMatch | `options.partialContextMatch
|
|
87
|
+
* If {@link Context.IContextMatchOptions.partialContextMatch | `options.partialContextMatch`} is `true`, then
|
|
92
88
|
* the method will return `undefined` if the corresponding qualifier is not present in the context.
|
|
93
89
|
*/
|
|
94
90
|
getContextMatch(context, options) {
|
|
@@ -82,7 +82,7 @@ export declare class Decision<TVALUE extends JsonValue = JsonValue> implements I
|
|
|
82
82
|
static getAbstractKey(conditionSets: ReadonlyArray<ConditionSet>): DecisionKey;
|
|
83
83
|
/**
|
|
84
84
|
* Helper function to return a stable key for a set of condition sets.
|
|
85
|
-
* @param
|
|
85
|
+
* @param candidates - The candidates whose condition sets are used to create the key.
|
|
86
86
|
* @returns A key derived from the condition set hashes.
|
|
87
87
|
* @public
|
|
88
88
|
*/
|
|
@@ -102,7 +102,7 @@ class Decision {
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Helper function to return a stable key for a set of condition sets.
|
|
105
|
-
* @param
|
|
105
|
+
* @param candidates - The candidates whose condition sets are used to create the key.
|
|
106
106
|
* @returns A key derived from the condition set hashes.
|
|
107
107
|
* @public
|
|
108
108
|
*/
|
|
@@ -54,9 +54,6 @@ export declare class FsItem implements IFsItemProps {
|
|
|
54
54
|
* @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.
|
|
55
55
|
* @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
|
|
56
56
|
* embedded condition set tokens.
|
|
57
|
-
* @param tree - file tree implementation to use for this item.
|
|
58
|
-
* @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
|
|
59
|
-
* containing an error message if not.
|
|
60
57
|
*/
|
|
61
58
|
protected constructor(props: IFsItemProps, qualifiers: IReadOnlyQualifierCollector);
|
|
62
59
|
/**
|
|
@@ -74,7 +71,7 @@ export declare class FsItem implements IFsItemProps {
|
|
|
74
71
|
* @param importPath - The path to the file system item to import.
|
|
75
72
|
* @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
|
|
76
73
|
* embedded condition set tokens.
|
|
77
|
-
* @param
|
|
74
|
+
* @param tree - An optional {@link FileTree.FileTree | file tree} to use for this item.
|
|
78
75
|
* @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created
|
|
79
76
|
* successfully, or a `Failure` containing an error message if it is not. Note that the result detail
|
|
80
77
|
* `skipped` indicates that the item was not created because it is not relevant - this is a soft error
|
|
@@ -70,9 +70,6 @@ class FsItem {
|
|
|
70
70
|
* @param props - The {@link Import.IFsItemProps | file system item properties} to use for this item.
|
|
71
71
|
* @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
|
|
72
72
|
* embedded condition set tokens.
|
|
73
|
-
* @param tree - file tree implementation to use for this item.
|
|
74
|
-
* @returns `Success` containing the new {@link Import.FsItem | FsItem} if successful, or a `Failure`
|
|
75
|
-
* containing an error message if not.
|
|
76
73
|
*/
|
|
77
74
|
constructor(props, qualifiers) {
|
|
78
75
|
const { baseName, conditions, item } = props;
|
|
@@ -104,7 +101,7 @@ class FsItem {
|
|
|
104
101
|
* @param importPath - The path to the file system item to import.
|
|
105
102
|
* @param qualifiers - The {@link Qualifiers.IReadOnlyQualifierCollector | qualifiers} used to parse
|
|
106
103
|
* embedded condition set tokens.
|
|
107
|
-
* @param
|
|
104
|
+
* @param tree - An optional {@link FileTree.FileTree | file tree} to use for this item.
|
|
108
105
|
* @returns `Success` containing the new {@link Import.FsItem | FsItem} if an item is created
|
|
109
106
|
* successfully, or a `Failure` containing an error message if it is not. Note that the result detail
|
|
110
107
|
* `skipped` indicates that the item was not created because it is not relevant - this is a soft error
|
|
@@ -38,18 +38,18 @@ export interface IValidatedImportContext {
|
|
|
38
38
|
*/
|
|
39
39
|
export declare class ImportContext implements IValidatedImportContext {
|
|
40
40
|
/**
|
|
41
|
-
* {@
|
|
41
|
+
* {@inheritDoc Import.IImportContext.baseId}
|
|
42
42
|
*/
|
|
43
43
|
readonly baseId: ResourceId | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* {@
|
|
45
|
+
* {@inheritDoc Import.IImportContext.conditions}
|
|
46
46
|
*/
|
|
47
47
|
readonly conditions: ReadonlyArray<IConditionDecl>;
|
|
48
48
|
/**
|
|
49
49
|
* Protected {@link Import.ImportContext | import context} for derived classes.
|
|
50
50
|
* Public consumers use {@link Import.ImportContext.create | create} to create new instances.
|
|
51
|
-
* @param
|
|
52
|
-
*
|
|
51
|
+
* @param params - The {@link Import.IImportContext | import context} parameters including
|
|
52
|
+
* the base ID and conditions to be applied to resources imported in this context.
|
|
53
53
|
*/
|
|
54
54
|
protected constructor({ baseId, conditions }: IImportContext);
|
|
55
55
|
/**
|
|
@@ -69,7 +69,7 @@ export declare class ImportContext implements IValidatedImportContext {
|
|
|
69
69
|
withConditions(conditions: IConditionDecl[]): Result<ImportContext>;
|
|
70
70
|
/**
|
|
71
71
|
* Appends names to the base ID of the import context.
|
|
72
|
-
* @param
|
|
72
|
+
* @param names - The name segments to append to the base ID.
|
|
73
73
|
* @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID
|
|
74
74
|
* if successful, or `Failure` with an error message if the operation fails.
|
|
75
75
|
*/
|
|
@@ -32,8 +32,8 @@ class ImportContext {
|
|
|
32
32
|
/**
|
|
33
33
|
* Protected {@link Import.ImportContext | import context} for derived classes.
|
|
34
34
|
* Public consumers use {@link Import.ImportContext.create | create} to create new instances.
|
|
35
|
-
* @param
|
|
36
|
-
*
|
|
35
|
+
* @param params - The {@link Import.IImportContext | import context} parameters including
|
|
36
|
+
* the base ID and conditions to be applied to resources imported in this context.
|
|
37
37
|
*/
|
|
38
38
|
constructor({ baseId, conditions }) {
|
|
39
39
|
this.baseId = common_1.Helpers.joinOptionalResourceIds(baseId).orThrow();
|
|
@@ -65,7 +65,7 @@ class ImportContext {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Appends names to the base ID of the import context.
|
|
68
|
-
* @param
|
|
68
|
+
* @param names - The name segments to append to the base ID.
|
|
69
69
|
* @returns `Success` with a new {@link Import.ImportContext | import context} containing the new base ID
|
|
70
70
|
* if successful, or `Failure` with an error message if the operation fails.
|
|
71
71
|
*/
|
|
@@ -10,7 +10,7 @@ import { IImporter, ImporterResultDetail } from './importer';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class CollectionImporter implements IImporter {
|
|
12
12
|
/**
|
|
13
|
-
* {@
|
|
13
|
+
* {@inheritDoc Import.Importers.IImporter.types}
|
|
14
14
|
*/
|
|
15
15
|
readonly types: string[];
|
|
16
16
|
/**
|
|
@@ -24,7 +24,7 @@ export declare class CollectionImporter implements IImporter {
|
|
|
24
24
|
*/
|
|
25
25
|
static create(): Result<CollectionImporter>;
|
|
26
26
|
/**
|
|
27
|
-
* {@
|
|
27
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
28
28
|
*/
|
|
29
29
|
import(item: IImportable, manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
30
30
|
/**
|
|
@@ -71,7 +71,7 @@ class CollectionImporter {
|
|
|
71
71
|
*/
|
|
72
72
|
constructor() {
|
|
73
73
|
/**
|
|
74
|
-
* {@
|
|
74
|
+
* {@inheritDoc Import.Importers.IImporter.types}
|
|
75
75
|
*/
|
|
76
76
|
this.types = ['resourceCollection', 'resourceTree'];
|
|
77
77
|
}
|
|
@@ -84,7 +84,7 @@ class CollectionImporter {
|
|
|
84
84
|
return (0, ts_utils_1.captureResult)(() => new CollectionImporter());
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
|
-
* {@
|
|
87
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
88
88
|
*/
|
|
89
89
|
import(item, manager) {
|
|
90
90
|
var _a, _b;
|
|
@@ -47,7 +47,7 @@ export declare class FsItemImporter implements IImporter {
|
|
|
47
47
|
*/
|
|
48
48
|
static create(params: IFsItemImporterCreateParams): Result<FsItemImporter>;
|
|
49
49
|
/**
|
|
50
|
-
* {@
|
|
50
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
51
51
|
*/
|
|
52
52
|
import(item: IImportable, __manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
53
53
|
private _isSupportedFileExtension;
|
|
@@ -52,7 +52,7 @@ class FsItemImporter {
|
|
|
52
52
|
return (0, ts_utils_1.captureResult)(() => new FsItemImporter(params));
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* {@
|
|
55
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
56
56
|
*/
|
|
57
57
|
import(item, __manager) {
|
|
58
58
|
const { value: fsItem, message: getTreeMessage, detail: getTreeDetail } = this._getFileTreeItemFromImportable(item);
|
|
@@ -8,7 +8,7 @@ import { IImportable } from '../importable';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class JsonImporter implements IImporter {
|
|
10
10
|
/**
|
|
11
|
-
* {@
|
|
11
|
+
* {@inheritDoc Import.Importers.IImporter.types}
|
|
12
12
|
*/
|
|
13
13
|
readonly types: ReadonlyArray<string>;
|
|
14
14
|
/**
|
|
@@ -22,7 +22,7 @@ export declare class JsonImporter implements IImporter {
|
|
|
22
22
|
*/
|
|
23
23
|
static create(): Result<JsonImporter>;
|
|
24
24
|
/**
|
|
25
|
-
* {@
|
|
25
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
26
26
|
*/
|
|
27
27
|
import(item: IImportable, manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
28
28
|
private _tryImportResourceCollection;
|
|
@@ -68,7 +68,7 @@ class JsonImporter {
|
|
|
68
68
|
*/
|
|
69
69
|
constructor() {
|
|
70
70
|
/**
|
|
71
|
-
* {@
|
|
71
|
+
* {@inheritDoc Import.Importers.IImporter.types}
|
|
72
72
|
*/
|
|
73
73
|
this.types = ['json'];
|
|
74
74
|
}
|
|
@@ -81,7 +81,7 @@ class JsonImporter {
|
|
|
81
81
|
return (0, ts_utils_1.captureResult)(() => new JsonImporter());
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* {@
|
|
84
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
85
85
|
*/
|
|
86
86
|
import(item, manager) {
|
|
87
87
|
var _a, _b;
|
|
@@ -49,7 +49,7 @@ export declare class PathImporter implements IImporter {
|
|
|
49
49
|
*/
|
|
50
50
|
static create(params: IPathImporterCreateParams): Result<PathImporter>;
|
|
51
51
|
/**
|
|
52
|
-
* {@
|
|
52
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
53
53
|
*/
|
|
54
54
|
import(item: IImportable, __manager: ResourceManagerBuilder): DetailedResult<IImportable[], ImporterResultDetail>;
|
|
55
55
|
/**
|
|
@@ -54,7 +54,7 @@ class PathImporter {
|
|
|
54
54
|
return (0, ts_utils_1.captureResult)(() => new PathImporter(params));
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* {@
|
|
57
|
+
* {@inheritDoc Import.Importers.IImporter.import}
|
|
58
58
|
*/
|
|
59
59
|
import(item, __manager) {
|
|
60
60
|
const { value: fsItem, message: getTreeMessage, detail: getTreeDetail } = this._getFileTreeItemFromImportable(item);
|
|
@@ -27,14 +27,13 @@ export interface ILanguageQualifierTypeCreateParams extends Partial<IQualifierTy
|
|
|
27
27
|
*/
|
|
28
28
|
export declare class LanguageQualifierType extends QualifierType<JsonCompatibleType<Config.ILanguageQualifierTypeConfig>> {
|
|
29
29
|
/**
|
|
30
|
-
* {@
|
|
30
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
31
31
|
*/
|
|
32
32
|
readonly systemTypeName: QualifierTypeName;
|
|
33
33
|
/**
|
|
34
34
|
* Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
|
|
35
|
-
* @param
|
|
36
|
-
*
|
|
37
|
-
* list of values. Defaults to `true`.
|
|
35
|
+
* @param params - The {@link QualifierTypes.ILanguageQualifierTypeCreateParams | create parameters}
|
|
36
|
+
* for this qualifier type.
|
|
38
37
|
* @public
|
|
39
38
|
*/
|
|
40
39
|
protected constructor({ name, allowContextList, index }: ILanguageQualifierTypeCreateParams);
|
|
@@ -56,7 +55,7 @@ export declare class LanguageQualifierType extends QualifierType<JsonCompatibleT
|
|
|
56
55
|
*/
|
|
57
56
|
static createFromConfig(config: Config.IQualifierTypeConfig<Config.ILanguageQualifierTypeConfig>): Result<LanguageQualifierType>;
|
|
58
57
|
/**
|
|
59
|
-
* {@
|
|
58
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidConditionValue}
|
|
60
59
|
*/
|
|
61
60
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
62
61
|
/**
|
|
@@ -66,11 +65,11 @@ export declare class LanguageQualifierType extends QualifierType<JsonCompatibleT
|
|
|
66
65
|
*/
|
|
67
66
|
getConfiguration(): Result<Config.ISystemLanguageQualifierTypeConfig>;
|
|
68
67
|
/**
|
|
69
|
-
* {@
|
|
68
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
70
69
|
*/
|
|
71
70
|
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemLanguageQualifierTypeConfig>>;
|
|
72
71
|
/**
|
|
73
|
-
* {@
|
|
72
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
74
73
|
*/
|
|
75
74
|
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemLanguageQualifierTypeConfig>>;
|
|
76
75
|
/**
|
|
@@ -70,9 +70,8 @@ const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
|
70
70
|
class LanguageQualifierType extends qualifierType_1.QualifierType {
|
|
71
71
|
/**
|
|
72
72
|
* Creates a new instance of a {@link QualifierTypes.LanguageQualifierType | language qualifier type}.
|
|
73
|
-
* @param
|
|
74
|
-
*
|
|
75
|
-
* list of values. Defaults to `true`.
|
|
73
|
+
* @param params - The {@link QualifierTypes.ILanguageQualifierTypeCreateParams | create parameters}
|
|
74
|
+
* for this qualifier type.
|
|
76
75
|
* @public
|
|
77
76
|
*/
|
|
78
77
|
constructor({ name, allowContextList, index }) {
|
|
@@ -83,7 +82,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
|
|
|
83
82
|
super(Object.assign({ name,
|
|
84
83
|
allowContextList }, validated));
|
|
85
84
|
/**
|
|
86
|
-
* {@
|
|
85
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
87
86
|
*/
|
|
88
87
|
this.systemTypeName = common_1.Convert.qualifierTypeName.convert('language').orThrow();
|
|
89
88
|
}
|
|
@@ -115,7 +114,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
|
|
|
115
114
|
}).onSuccess(LanguageQualifierType.create);
|
|
116
115
|
}
|
|
117
116
|
/**
|
|
118
|
-
* {@
|
|
117
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isValidConditionValue}
|
|
119
118
|
*/
|
|
120
119
|
isValidConditionValue(value) {
|
|
121
120
|
return ts_bcp47_1.Bcp47.tag(value)
|
|
@@ -131,7 +130,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
|
|
|
131
130
|
return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemLanguageQualifierTypeConfig.convert(json));
|
|
132
131
|
}
|
|
133
132
|
/**
|
|
134
|
-
* {@
|
|
133
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
135
134
|
*/
|
|
136
135
|
getConfigurationJson() {
|
|
137
136
|
return (0, ts_utils_1.succeed)({
|
|
@@ -143,7 +142,7 @@ class LanguageQualifierType extends qualifierType_1.QualifierType {
|
|
|
143
142
|
});
|
|
144
143
|
}
|
|
145
144
|
/**
|
|
146
|
-
* {@
|
|
145
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
147
146
|
*/
|
|
148
147
|
validateConfigurationJson(from) {
|
|
149
148
|
return Config.Convert.systemLanguageQualifierTypeConfig.convert(from);
|
|
@@ -46,7 +46,7 @@ export interface ILiteralQualifierTypeCreateParams {
|
|
|
46
46
|
*/
|
|
47
47
|
export declare class LiteralQualifierType extends QualifierType<JsonCompatibleType<Config.ILiteralQualifierTypeConfig>> {
|
|
48
48
|
/**
|
|
49
|
-
* {@
|
|
49
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
50
50
|
*/
|
|
51
51
|
readonly systemTypeName: QualifierTypeName;
|
|
52
52
|
/**
|
|
@@ -64,11 +64,8 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
64
64
|
readonly hierarchy?: LiteralValueHierarchy<string>;
|
|
65
65
|
/**
|
|
66
66
|
* Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
|
|
67
|
-
* @param
|
|
68
|
-
*
|
|
69
|
-
* case-sensitive. Defaults to `false`.
|
|
70
|
-
* @param allowContextList - Optional flag indicating whether the context can be a
|
|
71
|
-
* list of values. Defaults to `false`.
|
|
67
|
+
* @param params - The {@link QualifierTypes.ILiteralQualifierTypeCreateParams | create parameters}
|
|
68
|
+
* for this qualifier type.
|
|
72
69
|
* @public
|
|
73
70
|
*/
|
|
74
71
|
protected constructor({ name, caseSensitive, allowContextList, enumeratedValues, hierarchy, index }: ILiteralQualifierTypeCreateParams);
|
|
@@ -81,7 +78,7 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
81
78
|
*/
|
|
82
79
|
isValidConditionValue(value: string): value is QualifierConditionValue;
|
|
83
80
|
/**
|
|
84
|
-
* {@
|
|
81
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
85
82
|
*/
|
|
86
83
|
isPotentialMatch(conditionValue: string, contextValue: string): boolean;
|
|
87
84
|
/**
|
|
@@ -91,11 +88,11 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
91
88
|
*/
|
|
92
89
|
getConfiguration(): Result<Config.ISystemLiteralQualifierTypeConfig>;
|
|
93
90
|
/**
|
|
94
|
-
* {@
|
|
91
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
95
92
|
*/
|
|
96
93
|
getConfigurationJson(): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>>;
|
|
97
94
|
/**
|
|
98
|
-
* {@
|
|
95
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
99
96
|
*/
|
|
100
97
|
validateConfigurationJson(from: unknown): Result<JsonCompatibleType<Config.ISystemLiteralQualifierTypeConfig>>;
|
|
101
98
|
/**
|
|
@@ -106,7 +103,7 @@ export declare class LiteralQualifierType extends QualifierType<JsonCompatibleTy
|
|
|
106
103
|
*/
|
|
107
104
|
validateConfiguration(from: unknown): Result<Config.ISystemLiteralQualifierTypeConfig>;
|
|
108
105
|
/**
|
|
109
|
-
* {@
|
|
106
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
110
107
|
*/
|
|
111
108
|
protected _matchOne(condition: QualifierConditionValue, context: QualifierContextValue, __operator: ConditionOperator): QualifierMatchScore;
|
|
112
109
|
/**
|
|
@@ -69,11 +69,8 @@ const ts_json_base_1 = require("@fgv/ts-json-base");
|
|
|
69
69
|
class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
70
70
|
/**
|
|
71
71
|
* Constructs a new {@link QualifierTypes.LiteralQualifierType | LiteralQualifierType}.
|
|
72
|
-
* @param
|
|
73
|
-
*
|
|
74
|
-
* case-sensitive. Defaults to `false`.
|
|
75
|
-
* @param allowContextList - Optional flag indicating whether the context can be a
|
|
76
|
-
* list of values. Defaults to `false`.
|
|
72
|
+
* @param params - The {@link QualifierTypes.ILiteralQualifierTypeCreateParams | create parameters}
|
|
73
|
+
* for this qualifier type.
|
|
77
74
|
* @public
|
|
78
75
|
*/
|
|
79
76
|
constructor({ name, caseSensitive, allowContextList, enumeratedValues, hierarchy, index }) {
|
|
@@ -84,7 +81,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
84
81
|
index: index !== undefined ? common_1.Convert.qualifierTypeIndex.convert(index).orThrow() : undefined
|
|
85
82
|
});
|
|
86
83
|
/**
|
|
87
|
-
* {@
|
|
84
|
+
* {@inheritDoc QualifierTypes.IQualifierType.systemTypeName}
|
|
88
85
|
*/
|
|
89
86
|
this.systemTypeName = common_1.Convert.qualifierTypeName.convert('literal').orThrow();
|
|
90
87
|
this.caseSensitive = caseSensitive === true;
|
|
@@ -116,7 +113,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
116
113
|
return LiteralQualifierType.isValidLiteralConditionValue(value);
|
|
117
114
|
}
|
|
118
115
|
/**
|
|
119
|
-
* {@
|
|
116
|
+
* {@inheritDoc QualifierTypes.IQualifierType.isPotentialMatch}
|
|
120
117
|
*/
|
|
121
118
|
isPotentialMatch(conditionValue, contextValue) {
|
|
122
119
|
if (this.isValidConditionValue(conditionValue) && this.isValidContextValue(contextValue)) {
|
|
@@ -138,7 +135,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
138
135
|
return this.getConfigurationJson().onSuccess((json) => Config.Convert.systemLiteralQualifierTypeConfig.convert(json));
|
|
139
136
|
}
|
|
140
137
|
/**
|
|
141
|
-
* {@
|
|
138
|
+
* {@inheritDoc QualifierTypes.IQualifierType.getConfigurationJson}
|
|
142
139
|
*/
|
|
143
140
|
getConfigurationJson() {
|
|
144
141
|
const hierarchy = this.hierarchy ? { hierarchy: this.hierarchy.asRecord() } : {};
|
|
@@ -152,7 +149,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
152
149
|
});
|
|
153
150
|
}
|
|
154
151
|
/**
|
|
155
|
-
* {@
|
|
152
|
+
* {@inheritDoc QualifierTypes.IQualifierType.validateConfigurationJson}
|
|
156
153
|
*/
|
|
157
154
|
validateConfigurationJson(from) {
|
|
158
155
|
return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
|
|
@@ -167,7 +164,7 @@ class LiteralQualifierType extends qualifierType_1.QualifierType {
|
|
|
167
164
|
return Config.Convert.systemLiteralQualifierTypeConfig.convert(from);
|
|
168
165
|
}
|
|
169
166
|
/**
|
|
170
|
-
* {@
|
|
167
|
+
* {@inheritDoc QualifierTypes.QualifierType._matchOne}
|
|
171
168
|
*/
|
|
172
169
|
_matchOne(condition, context, __operator) {
|
|
173
170
|
if (this.hierarchy) {
|