@fgv/ts-res 5.0.0-5 → 5.0.0-7
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/ts-res.d.ts +136 -42
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +18 -2
- package/lib/index.js.map +1 -1
- package/lib/packlets/common/resources.d.ts +8 -0
- package/lib/packlets/common/resources.d.ts.map +1 -1
- package/lib/packlets/common/resources.js.map +1 -1
- package/lib/packlets/resource-types/jsonResourceType.d.ts +4 -4
- package/lib/packlets/resource-types/jsonResourceType.d.ts.map +1 -1
- package/lib/packlets/resource-types/jsonResourceType.js +1 -1
- package/lib/packlets/resource-types/jsonResourceType.js.map +1 -1
- package/lib/packlets/resource-types/resourceType.d.ts +16 -7
- package/lib/packlets/resource-types/resourceType.d.ts.map +1 -1
- package/lib/packlets/resource-types/resourceType.js.map +1 -1
- package/lib/packlets/resources/common.d.ts +12 -0
- package/lib/packlets/resources/common.d.ts.map +1 -1
- package/lib/packlets/resources/common.js.map +1 -1
- package/lib/packlets/resources/resourceManagerBuilder.d.ts +50 -3
- package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -1
- package/lib/packlets/resources/resourceManagerBuilder.js +203 -8
- package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -1
- package/lib/packlets/runtime/cacheListener.d.ts +9 -0
- package/lib/packlets/runtime/cacheListener.d.ts.map +1 -1
- package/lib/packlets/runtime/cacheListener.js +6 -0
- package/lib/packlets/runtime/cacheListener.js.map +1 -1
- package/lib/packlets/runtime/cacheMetrics.d.ts +6 -0
- package/lib/packlets/runtime/cacheMetrics.d.ts.map +1 -1
- package/lib/packlets/runtime/cacheMetrics.js +11 -0
- package/lib/packlets/runtime/cacheMetrics.js.map +1 -1
- package/lib/packlets/runtime/resourceResolver.js +15 -11
- package/lib/packlets/runtime/resourceResolver.js.map +1 -1
- package/package.json +12 -12
package/dist/ts-res.d.ts
CHANGED
|
@@ -227,6 +227,15 @@ declare class Candidate<TVALUE extends JsonValue = JsonValue> implements ICandid
|
|
|
227
227
|
*/
|
|
228
228
|
declare type CandidateAction = 'unchanged' | 'reduced' | 'suppressed';
|
|
229
229
|
|
|
230
|
+
/**
|
|
231
|
+
* The completeness of a resource candidate value. A full value is one that
|
|
232
|
+
* contains all of the required properties for the resource type. A partial
|
|
233
|
+
* value is one that contains some of the required properties for the resource
|
|
234
|
+
* type.
|
|
235
|
+
* @public
|
|
236
|
+
*/
|
|
237
|
+
export declare type CandidateCompleteness = 'full' | 'partial';
|
|
238
|
+
|
|
230
239
|
/**
|
|
231
240
|
* Manages candidate reduction logic for filtering and qualifier reduction operations.
|
|
232
241
|
* Encapsulates the state and logic needed to consistently process candidates for reduction.
|
|
@@ -402,7 +411,8 @@ declare namespace Common {
|
|
|
402
411
|
ResourceTypeName,
|
|
403
412
|
ResourceTypeIndex,
|
|
404
413
|
ResourceValueMergeMethod,
|
|
405
|
-
allResourceValueMergeMethods
|
|
414
|
+
allResourceValueMergeMethods,
|
|
415
|
+
CandidateCompleteness
|
|
406
416
|
}
|
|
407
417
|
}
|
|
408
418
|
|
|
@@ -685,7 +695,7 @@ declare class ConcreteDecision<TVALUE extends JsonValue = JsonValue> implements
|
|
|
685
695
|
* Represents a single condition applied to some resource instance.
|
|
686
696
|
* @public
|
|
687
697
|
*/
|
|
688
|
-
declare class Condition implements IValidatedConditionDecl {
|
|
698
|
+
export declare class Condition implements IValidatedConditionDecl {
|
|
689
699
|
/**
|
|
690
700
|
* The {@link Qualifiers.Qualifier | qualifier} used in this condition.
|
|
691
701
|
*/
|
|
@@ -932,7 +942,7 @@ declare const conditionPriority: Converter<ConditionPriority, unknown>;
|
|
|
932
942
|
|
|
933
943
|
declare namespace Conditions {
|
|
934
944
|
export {
|
|
935
|
-
|
|
945
|
+
Convert_5 as Convert,
|
|
936
946
|
Condition,
|
|
937
947
|
IConditionCollectorCreateParams,
|
|
938
948
|
ConditionCollector,
|
|
@@ -956,7 +966,7 @@ export { Conditions }
|
|
|
956
966
|
* context for a resource instance to be valid.
|
|
957
967
|
* @public
|
|
958
968
|
*/
|
|
959
|
-
declare class ConditionSet implements IValidatedConditionSetDecl {
|
|
969
|
+
export declare class ConditionSet implements IValidatedConditionSetDecl {
|
|
960
970
|
protected readonly _collectible: Collections.Collectible<ConditionSetKey, ConditionSetIndex>;
|
|
961
971
|
/**
|
|
962
972
|
* The {@link Conditions.Condition | conditions} that make up this condition
|
|
@@ -1120,10 +1130,10 @@ declare class ConditionSetCollector extends ValidatingCollector<ConditionSet> {
|
|
|
1120
1130
|
declare type ConditionSetDecl = ConditionSetDeclAsArray | ConditionSetDeclAsRecord;
|
|
1121
1131
|
|
|
1122
1132
|
/**
|
|
1123
|
-
* Converter
|
|
1133
|
+
* `Converter` for a normalized {@link ResourceJson.Normalized.ConditionSetDecl | condition set declaration}.
|
|
1124
1134
|
* @public
|
|
1125
1135
|
*/
|
|
1126
|
-
declare const conditionSetDecl:
|
|
1136
|
+
declare const conditionSetDecl: Converter<Normalized.ConditionSetDecl>;
|
|
1127
1137
|
|
|
1128
1138
|
/**
|
|
1129
1139
|
* Normalized non-validated declaration of a {@link Conditions.Condition | condition}.
|
|
@@ -1132,10 +1142,10 @@ declare const conditionSetDecl: ObjectConverter<IConditionSetDecl, unknown>;
|
|
|
1132
1142
|
declare type ConditionSetDecl_2 = ReadonlyArray<ILooseConditionDecl>;
|
|
1133
1143
|
|
|
1134
1144
|
/**
|
|
1135
|
-
*
|
|
1145
|
+
* Converter which converts to a {@link Conditions.IConditionSetDecl | condition set declaration}.
|
|
1136
1146
|
* @public
|
|
1137
1147
|
*/
|
|
1138
|
-
declare const conditionSetDecl_2:
|
|
1148
|
+
declare const conditionSetDecl_2: ObjectConverter<IConditionSetDecl, unknown>;
|
|
1139
1149
|
|
|
1140
1150
|
/**
|
|
1141
1151
|
* Non-validated declaration of a {@link Conditions.Condition | condition}.
|
|
@@ -1417,7 +1427,7 @@ declare const containerContextDecl: Converter<Normalized.IContainerContextDecl>;
|
|
|
1417
1427
|
|
|
1418
1428
|
declare namespace Context {
|
|
1419
1429
|
export {
|
|
1420
|
-
|
|
1430
|
+
Convert_2 as Convert,
|
|
1421
1431
|
IContextMatchOptions,
|
|
1422
1432
|
IContextQualifierValueDecl,
|
|
1423
1433
|
IContextDecl,
|
|
@@ -1767,12 +1777,11 @@ declare namespace Convert_10 {
|
|
|
1767
1777
|
|
|
1768
1778
|
declare namespace Convert_2 {
|
|
1769
1779
|
export {
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
validatedConditionSetDecl
|
|
1780
|
+
contextQualifierValueDecl,
|
|
1781
|
+
contextDecl,
|
|
1782
|
+
IContextDeclConvertContext,
|
|
1783
|
+
validatedContextQualifierValueDecl,
|
|
1784
|
+
validatedContextDecl
|
|
1776
1785
|
}
|
|
1777
1786
|
}
|
|
1778
1787
|
|
|
@@ -1797,7 +1806,7 @@ declare namespace Convert_4 {
|
|
|
1797
1806
|
export {
|
|
1798
1807
|
looseConditionDecl,
|
|
1799
1808
|
childConditionDecl,
|
|
1800
|
-
|
|
1809
|
+
conditionSetDecl,
|
|
1801
1810
|
looseResourceCandidateDecl,
|
|
1802
1811
|
importerResourceCandidateDecl,
|
|
1803
1812
|
childResourceCandidateDecl,
|
|
@@ -1813,11 +1822,12 @@ declare namespace Convert_4 {
|
|
|
1813
1822
|
|
|
1814
1823
|
declare namespace Convert_5 {
|
|
1815
1824
|
export {
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1825
|
+
conditionDecl,
|
|
1826
|
+
IConditionDeclConvertContext,
|
|
1827
|
+
validatedConditionDecl,
|
|
1828
|
+
conditionSetDecl_2 as conditionSetDecl,
|
|
1829
|
+
IConditionSetDeclConvertContext,
|
|
1830
|
+
validatedConditionSetDecl
|
|
1821
1831
|
}
|
|
1822
1832
|
}
|
|
1823
1833
|
|
|
@@ -1895,7 +1905,7 @@ declare function createResourceTypeFromConfig(config: IResourceTypeConfig): Resu
|
|
|
1895
1905
|
* Simple collectible implementation of {@link Decisions.IDecision | IDecision}.
|
|
1896
1906
|
* @public
|
|
1897
1907
|
*/
|
|
1898
|
-
declare class Decision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {
|
|
1908
|
+
export declare class Decision<TVALUE extends JsonValue = JsonValue> implements IDecision<TVALUE> {
|
|
1899
1909
|
/**
|
|
1900
1910
|
* The sorted {@link Conditions.ConditionSet | ConditionSets} that make up this decision.
|
|
1901
1911
|
* @public
|
|
@@ -4281,7 +4291,7 @@ declare interface IResourceDeclContainer {
|
|
|
4281
4291
|
* implementations without requiring the full ResourceManagerBuilder build mechanics.
|
|
4282
4292
|
* @public
|
|
4283
4293
|
*/
|
|
4284
|
-
declare interface IResourceManager {
|
|
4294
|
+
export declare interface IResourceManager {
|
|
4285
4295
|
/**
|
|
4286
4296
|
* A {@link Conditions.ReadOnlyConditionCollector | ReadOnlyConditionCollector} which
|
|
4287
4297
|
* contains the {@link Conditions.Condition | conditions} used by resource candidates.
|
|
@@ -4333,6 +4343,19 @@ declare interface IResourceManagerBuilderCreateParams {
|
|
|
4333
4343
|
resourceTypes: ReadOnlyResourceTypeCollector;
|
|
4334
4344
|
}
|
|
4335
4345
|
|
|
4346
|
+
/**
|
|
4347
|
+
* Options for ResourceManagerBuilder clone operations.
|
|
4348
|
+
* Extends IDeclarationOptions to include support for applying edits when cloning.
|
|
4349
|
+
* @public
|
|
4350
|
+
*/
|
|
4351
|
+
declare interface IResourceManagerCloneOptions extends IResourceDeclarationOptions {
|
|
4352
|
+
/**
|
|
4353
|
+
* Optional array of loose condition declarations to be applied as edits during the clone operation.
|
|
4354
|
+
* These conditions can modify or extend the resource candidates in the cloned manager.
|
|
4355
|
+
*/
|
|
4356
|
+
readonly candidates?: ReadonlyArray<ResourceJson.Json.ILooseResourceCandidateDecl>;
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4336
4359
|
/**
|
|
4337
4360
|
* A listener for {@link Runtime.ResourceResolver | ResourceResolver} cache activity.
|
|
4338
4361
|
* @public
|
|
@@ -4356,6 +4379,11 @@ declare interface IResourceResolverCacheListener {
|
|
|
4356
4379
|
* @param index - The index of the cache that had an error.
|
|
4357
4380
|
*/
|
|
4358
4381
|
onCacheError(cache: ResourceResolverCacheType, index: number): void;
|
|
4382
|
+
/**
|
|
4383
|
+
* Called when a context error occurs.
|
|
4384
|
+
* @param error - The error that occurred.
|
|
4385
|
+
*/
|
|
4386
|
+
onContextError(qualifier: string, error: string): void;
|
|
4359
4387
|
/**
|
|
4360
4388
|
* Called when a cache is cleared.
|
|
4361
4389
|
* @param cache - The type of cache that was cleared.
|
|
@@ -5065,15 +5093,15 @@ declare class JsonResourceType extends ResourceType<JsonObject> {
|
|
|
5065
5093
|
/**
|
|
5066
5094
|
* {@inheritdoc ResourceTypes.ResourceType.(validate:1)}
|
|
5067
5095
|
*/
|
|
5068
|
-
validate(json: JsonObject,
|
|
5096
|
+
validate(json: JsonObject, completeness: CandidateCompleteness): Result<JsonObject>;
|
|
5069
5097
|
/**
|
|
5070
5098
|
* {@inheritdoc ResourceTypes.ResourceType.(validate:2)}
|
|
5071
5099
|
*/
|
|
5072
|
-
validate(json: JsonObject,
|
|
5100
|
+
validate(json: JsonObject, completeness: 'full'): Result<JsonObject>;
|
|
5073
5101
|
/**
|
|
5074
5102
|
* {@inheritdoc ResourceTypes.ResourceType.(validate:3)}
|
|
5075
5103
|
*/
|
|
5076
|
-
validate(json: JsonObject,
|
|
5104
|
+
validate(json: JsonObject, completeness: 'partial'): Result<JsonObject>;
|
|
5077
5105
|
}
|
|
5078
5106
|
|
|
5079
5107
|
/**
|
|
@@ -5545,6 +5573,10 @@ declare class NoOpResourceResolverCacheListener implements IResourceResolverCach
|
|
|
5545
5573
|
* {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}
|
|
5546
5574
|
*/
|
|
5547
5575
|
onCacheError(cache: ResourceResolverCacheType, index: number): void;
|
|
5576
|
+
/**
|
|
5577
|
+
* {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}
|
|
5578
|
+
*/
|
|
5579
|
+
onContextError(qualifier: string, error: string): void;
|
|
5548
5580
|
/**
|
|
5549
5581
|
* {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}
|
|
5550
5582
|
*/
|
|
@@ -5692,7 +5724,7 @@ declare const predefinedSystemConfiguration: Converter<PredefinedSystemConfigura
|
|
|
5692
5724
|
* which a resource is used.
|
|
5693
5725
|
* @public
|
|
5694
5726
|
*/
|
|
5695
|
-
declare class Qualifier implements IValidatedQualifierDecl, ICollectible<QualifierName, QualifierIndex> {
|
|
5727
|
+
export declare class Qualifier implements IValidatedQualifierDecl, ICollectible<QualifierName, QualifierIndex> {
|
|
5696
5728
|
/**
|
|
5697
5729
|
* The name of the qualifier.
|
|
5698
5730
|
*/
|
|
@@ -6052,7 +6084,7 @@ export { Qualifiers }
|
|
|
6052
6084
|
* the {@link QualifierTypes.IQualifierType | IQualifierType} interface.
|
|
6053
6085
|
* @public
|
|
6054
6086
|
*/
|
|
6055
|
-
declare abstract class QualifierType implements IQualifierType {
|
|
6087
|
+
export declare abstract class QualifierType implements IQualifierType {
|
|
6056
6088
|
/**
|
|
6057
6089
|
* {@inheritdoc QualifierTypes.IQualifierType.name}
|
|
6058
6090
|
*/
|
|
@@ -6405,7 +6437,7 @@ declare namespace RegularExpressions {
|
|
|
6405
6437
|
* candidate instances.
|
|
6406
6438
|
* @public
|
|
6407
6439
|
*/
|
|
6408
|
-
declare class Resource implements IResource {
|
|
6440
|
+
export declare class Resource implements IResource {
|
|
6409
6441
|
/**
|
|
6410
6442
|
* The unique {@link ResourceId | id} of the resource.
|
|
6411
6443
|
*/
|
|
@@ -6621,7 +6653,7 @@ declare type ResourceBuilderResultDetail = Collections.ResultMapResultDetail | '
|
|
|
6621
6653
|
* and instructions on how to merge it with other instances.
|
|
6622
6654
|
* @public
|
|
6623
6655
|
*/
|
|
6624
|
-
declare class ResourceCandidate implements IResourceCandidate {
|
|
6656
|
+
export declare class ResourceCandidate implements IResourceCandidate {
|
|
6625
6657
|
/**
|
|
6626
6658
|
* The unique identifier of the resource for which this candidate
|
|
6627
6659
|
* is a possible instance.
|
|
@@ -6866,7 +6898,7 @@ export { ResourceJson }
|
|
|
6866
6898
|
* and builds a collection of {@link Resources.Resource | resources} once all candidates are collected.
|
|
6867
6899
|
* @public
|
|
6868
6900
|
*/
|
|
6869
|
-
declare class ResourceManagerBuilder implements IResourceManager {
|
|
6901
|
+
export declare class ResourceManagerBuilder implements IResourceManager {
|
|
6870
6902
|
readonly qualifiers: IReadOnlyQualifierCollector;
|
|
6871
6903
|
readonly resourceTypes: ReadOnlyResourceTypeCollector;
|
|
6872
6904
|
protected readonly _conditions: ConditionCollector;
|
|
@@ -6931,6 +6963,15 @@ declare class ResourceManagerBuilder implements IResourceManager {
|
|
|
6931
6963
|
* @public
|
|
6932
6964
|
*/
|
|
6933
6965
|
static create(params: IResourceManagerBuilderCreateParams): Result<ResourceManagerBuilder>;
|
|
6966
|
+
/**
|
|
6967
|
+
* Creates a new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object from a predefined system configuration.
|
|
6968
|
+
* @param name - The name of the predefined system configuration to use.
|
|
6969
|
+
* @param qualifierDefaultValues - Optional default values for qualifiers.
|
|
6970
|
+
* @returns `Success` with the new {@link Resources.ResourceManagerBuilder | ResourceManagerBuilder} object if successful,
|
|
6971
|
+
* or `Failure` with an error message if not.
|
|
6972
|
+
* @public
|
|
6973
|
+
*/
|
|
6974
|
+
static createPredefined(name: Config.PredefinedSystemConfiguration, qualifierDefaultValues?: Config.ISystemConfigurationInitParams['qualifierDefaultValues']): Result<ResourceManagerBuilder>;
|
|
6934
6975
|
/**
|
|
6935
6976
|
* Given a {@link ResourceJson.Json.ILooseResourceCandidateDecl | resource candidate declaration}, builds and adds
|
|
6936
6977
|
* a {@link Resources.ResourceCandidate | candidate} to the manager.
|
|
@@ -7046,11 +7087,48 @@ declare class ResourceManagerBuilder implements IResourceManager {
|
|
|
7046
7087
|
* Creates a filtered clone of this ResourceManagerBuilder using the specified context.
|
|
7047
7088
|
* This is a convenience method that creates a new ResourceManagerBuilder with the same
|
|
7048
7089
|
* configuration but filtered to include only candidates that match the provided context.
|
|
7049
|
-
*
|
|
7090
|
+
* If candidates are provided for editing, they will be applied with collision detection.
|
|
7091
|
+
* @param options - Options for the cloning operation, including the strongly-typed filterForContext property and optional candidates for edits.
|
|
7050
7092
|
* @returns A Result containing the new filtered ResourceManagerBuilder.
|
|
7051
7093
|
* @public
|
|
7052
7094
|
*/
|
|
7053
|
-
clone(options?:
|
|
7095
|
+
clone(options?: IResourceManagerCloneOptions): Result<ResourceManagerBuilder>;
|
|
7096
|
+
/**
|
|
7097
|
+
* Creates a resource ID keyed map from an array of loose resource candidate declarations.
|
|
7098
|
+
* This enables efficient detection of edit collisions by grouping candidates by their target resource.
|
|
7099
|
+
* @param candidates - Array of loose resource candidate declarations to organize
|
|
7100
|
+
* @returns A Result containing a Map where keys are validated ResourceIds and values are arrays of candidates for that resource
|
|
7101
|
+
* @internal
|
|
7102
|
+
*/
|
|
7103
|
+
private static _createCandidatesByResourceMap;
|
|
7104
|
+
/**
|
|
7105
|
+
* Generates a proper ConditionSet token for collision detection using the existing ConditionSet.getKeyForDecl method.
|
|
7106
|
+
* @param conditionSet - The condition set to generate a token for
|
|
7107
|
+
* @param conditionCollector - The condition collector needed for validation context
|
|
7108
|
+
* @returns A Result containing the ConditionSet token if successful, or failure if validation fails
|
|
7109
|
+
* @internal
|
|
7110
|
+
*/
|
|
7111
|
+
private static _getConditionSetToken;
|
|
7112
|
+
/**
|
|
7113
|
+
* Applies candidate edits to a resource declaration, handling collisions using condition set tokens.
|
|
7114
|
+
* If there's no collision, adds the candidate. If there's a collision, replaces the original candidate with the edit.
|
|
7115
|
+
* @param resourceDecl - The original resource declaration to potentially modify
|
|
7116
|
+
* @param candidatesByResource - Map of resource IDs to arrays of candidate edits
|
|
7117
|
+
* @param conditionCollector - The condition collector needed for generating condition tokens
|
|
7118
|
+
* @returns A Result containing the resource declaration to use (original or modified)
|
|
7119
|
+
* @internal
|
|
7120
|
+
*/
|
|
7121
|
+
private static _applyEditsToResourceDeclaration;
|
|
7122
|
+
/**
|
|
7123
|
+
* Creates a new resource declaration from an array of candidate declarations.
|
|
7124
|
+
* This is used when cloning to create new resources that don't exist in the original manager.
|
|
7125
|
+
* @param resourceId - The validated resource ID for the new resource
|
|
7126
|
+
* @param candidates - Array of loose candidate declarations for the new resource
|
|
7127
|
+
* @param conditionCollector - The condition collector for validation context
|
|
7128
|
+
* @returns A Result containing the new resource declaration if successful, or failure if validation fails
|
|
7129
|
+
* @internal
|
|
7130
|
+
*/
|
|
7131
|
+
private static _createResourceDeclFromCandidates;
|
|
7054
7132
|
}
|
|
7055
7133
|
|
|
7056
7134
|
/**
|
|
@@ -7077,7 +7155,7 @@ declare const resourceName: Converter<ResourceName, unknown>;
|
|
|
7077
7155
|
* and caching results for optimal performance.
|
|
7078
7156
|
* @public
|
|
7079
7157
|
*/
|
|
7080
|
-
declare class ResourceResolver {
|
|
7158
|
+
export declare class ResourceResolver {
|
|
7081
7159
|
/**
|
|
7082
7160
|
* The resource manager that defines available resources and provides condition access.
|
|
7083
7161
|
*/
|
|
@@ -7233,6 +7311,8 @@ declare type ResourceResolverCacheActivity = 'hit' | 'miss' | 'error' | 'clear';
|
|
|
7233
7311
|
*/
|
|
7234
7312
|
declare class ResourceResolverCacheMetricsListener<TM extends ICacheMetrics> implements IResourceResolverCacheListener {
|
|
7235
7313
|
private readonly _metrics;
|
|
7314
|
+
private _contextErrors;
|
|
7315
|
+
get numContextErrors(): number;
|
|
7236
7316
|
constructor(factory: () => TM);
|
|
7237
7317
|
constructor(metrics: OverallCacheMetrics<TM>);
|
|
7238
7318
|
/**
|
|
@@ -7252,6 +7332,10 @@ declare class ResourceResolverCacheMetricsListener<TM extends ICacheMetrics> imp
|
|
|
7252
7332
|
* {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheError}
|
|
7253
7333
|
*/
|
|
7254
7334
|
onCacheError(cache: ResourceResolverCacheType, index: number): void;
|
|
7335
|
+
/**
|
|
7336
|
+
* {@inheritDoc Runtime.IResourceResolverCacheListener.onContextError}
|
|
7337
|
+
*/
|
|
7338
|
+
onContextError(qualifier: string, error: string): void;
|
|
7255
7339
|
/**
|
|
7256
7340
|
* {@inheritDoc Runtime.IResourceResolverCacheListener.onCacheClear}
|
|
7257
7341
|
*/
|
|
@@ -7286,7 +7370,8 @@ declare namespace Resources {
|
|
|
7286
7370
|
ResourceManagerBuilderResultDetail,
|
|
7287
7371
|
ResourceManagerBuilder,
|
|
7288
7372
|
IResourceDeclarationOptions,
|
|
7289
|
-
ICompiledResourceOptionsWithFilter
|
|
7373
|
+
ICompiledResourceOptionsWithFilter,
|
|
7374
|
+
IResourceManagerCloneOptions
|
|
7290
7375
|
}
|
|
7291
7376
|
}
|
|
7292
7377
|
export { Resources }
|
|
@@ -7434,7 +7519,7 @@ declare const resourceTreeRootDecl: Converter<Normalized.IResourceTreeRootDecl>;
|
|
|
7434
7519
|
* resource value.
|
|
7435
7520
|
* @public
|
|
7436
7521
|
*/
|
|
7437
|
-
declare abstract class ResourceType<T = unknown> implements ICollectible<ResourceTypeName, ResourceTypeIndex> {
|
|
7522
|
+
export declare abstract class ResourceType<T = unknown> implements ICollectible<ResourceTypeName, ResourceTypeIndex> {
|
|
7438
7523
|
private _collectible;
|
|
7439
7524
|
/**
|
|
7440
7525
|
* The key for this resource type.
|
|
@@ -7457,30 +7542,39 @@ declare abstract class ResourceType<T = unknown> implements ICollectible<Resourc
|
|
|
7457
7542
|
/**
|
|
7458
7543
|
* Validates a JSON value for use as a partial resource instance value.
|
|
7459
7544
|
* @param json - The JSON value to validate.
|
|
7460
|
-
* @param
|
|
7545
|
+
* @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.
|
|
7461
7546
|
* @returns `Success` with the strongly-typed partial resource value if the JSON is valid,
|
|
7462
7547
|
* `Failure` with an error message otherwise.
|
|
7463
7548
|
* @public
|
|
7464
7549
|
*/
|
|
7465
|
-
abstract validate(json: JsonValue,
|
|
7550
|
+
abstract validate(json: JsonValue, completeness: CandidateCompleteness): Result<Partial<T>>;
|
|
7466
7551
|
/**
|
|
7467
7552
|
* Validates a JSON value for use as a complete resource instance value.
|
|
7468
7553
|
* @param json - The JSON value to validate.
|
|
7469
|
-
* @param
|
|
7554
|
+
* @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.
|
|
7470
7555
|
* @returns `Success` with the strongly-typed resource value if the JSON is valid,
|
|
7471
7556
|
* `Failure` with an error message otherwise.
|
|
7472
7557
|
* @public
|
|
7473
7558
|
*/
|
|
7474
|
-
abstract validate(json: JsonValue,
|
|
7559
|
+
abstract validate(json: JsonValue, completeness: 'full'): Result<T>;
|
|
7560
|
+
/**
|
|
7561
|
+
* Validates a JSON value for use as a partial resource instance value.
|
|
7562
|
+
* @param json - The JSON value to validate.
|
|
7563
|
+
* @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.
|
|
7564
|
+
* @returns `Success` with the strongly-typed partial resource value if the JSON is valid,
|
|
7565
|
+
* `Failure` with an error message otherwise.
|
|
7566
|
+
* @public
|
|
7567
|
+
*/
|
|
7568
|
+
abstract validate(json: JsonValue, completeness: 'partial'): Result<Partial<T>>;
|
|
7475
7569
|
/**
|
|
7476
7570
|
* Validates a JSON value for use as a full or partial resource instance value.
|
|
7477
7571
|
* @param json - The JSON value to validate.
|
|
7478
|
-
* @param
|
|
7572
|
+
* @param completeness - Describes {@link CandidateCompleteness | how complete} the candidate value is.
|
|
7479
7573
|
* @returns `Success` with the strongly-typed full or partial resource value if
|
|
7480
7574
|
* the JSON is valid, `Failure` with an error message otherwise.
|
|
7481
7575
|
* @public
|
|
7482
7576
|
*/
|
|
7483
|
-
abstract validate(json: JsonValue,
|
|
7577
|
+
abstract validate(json: JsonValue, completeness?: CandidateCompleteness): Result<T | Partial<T>>;
|
|
7484
7578
|
/**
|
|
7485
7579
|
* Sets the index for this resource type. Once set, the index cannot be changed.
|
|
7486
7580
|
*/
|
package/lib/index.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ import * as ResourceTypes from './packlets/resource-types';
|
|
|
10
10
|
import * as Import from './packlets/import';
|
|
11
11
|
import * as Runtime from './packlets/runtime';
|
|
12
12
|
export * from './packlets/common';
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
import { Condition, ConditionSet } from './packlets/conditions';
|
|
14
|
+
import { Decision } from './packlets/decisions';
|
|
15
|
+
import { QualifierType } from './packlets/qualifier-types';
|
|
16
|
+
import { Qualifier } from './packlets/qualifiers';
|
|
17
|
+
import { ResourceType } from './packlets/resource-types';
|
|
18
|
+
import { Resource, ResourceCandidate, ResourceManagerBuilder } from './packlets/resources';
|
|
19
|
+
import { IResourceManager, ResourceResolver } from './packlets/runtime';
|
|
20
|
+
export { Condition, Conditions, ConditionSet, Config, Context, Decision, Decisions, Import, IResourceManager, Qualifier, QualifierType, QualifierTypes, Qualifiers, Resource, ResourceCandidate, ResourceJson, ResourceResolver, ResourceManagerBuilder, ResourceType, ResourceTypes, Resources, Runtime };
|
|
15
21
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,cAAc,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,cAAc,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,UAAU,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAE9C,cAAc,mBAAmB,CAAC;AAElC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,cAAc,EACd,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,SAAS,EACT,OAAO,EACR,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -57,7 +57,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
57
57
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
58
58
|
};
|
|
59
59
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.Runtime = exports.ResourceTypes = exports.
|
|
60
|
+
exports.Runtime = exports.Resources = exports.ResourceTypes = exports.ResourceType = exports.ResourceManagerBuilder = exports.ResourceResolver = exports.ResourceJson = exports.ResourceCandidate = exports.Resource = exports.Qualifiers = exports.QualifierTypes = exports.QualifierType = exports.Qualifier = exports.Import = exports.Decisions = exports.Decision = exports.Context = exports.Config = exports.ConditionSet = exports.Conditions = exports.Condition = void 0;
|
|
61
61
|
const QualifierTypes = __importStar(require("./packlets/qualifier-types"));
|
|
62
62
|
exports.QualifierTypes = QualifierTypes;
|
|
63
63
|
const Qualifiers = __importStar(require("./packlets/qualifiers"));
|
|
@@ -81,5 +81,21 @@ exports.Import = Import;
|
|
|
81
81
|
const Runtime = __importStar(require("./packlets/runtime"));
|
|
82
82
|
exports.Runtime = Runtime;
|
|
83
83
|
__exportStar(require("./packlets/common"), exports);
|
|
84
|
-
|
|
84
|
+
const conditions_1 = require("./packlets/conditions");
|
|
85
|
+
Object.defineProperty(exports, "Condition", { enumerable: true, get: function () { return conditions_1.Condition; } });
|
|
86
|
+
Object.defineProperty(exports, "ConditionSet", { enumerable: true, get: function () { return conditions_1.ConditionSet; } });
|
|
87
|
+
const decisions_1 = require("./packlets/decisions");
|
|
88
|
+
Object.defineProperty(exports, "Decision", { enumerable: true, get: function () { return decisions_1.Decision; } });
|
|
89
|
+
const qualifier_types_1 = require("./packlets/qualifier-types");
|
|
90
|
+
Object.defineProperty(exports, "QualifierType", { enumerable: true, get: function () { return qualifier_types_1.QualifierType; } });
|
|
91
|
+
const qualifiers_1 = require("./packlets/qualifiers");
|
|
92
|
+
Object.defineProperty(exports, "Qualifier", { enumerable: true, get: function () { return qualifiers_1.Qualifier; } });
|
|
93
|
+
const resource_types_1 = require("./packlets/resource-types");
|
|
94
|
+
Object.defineProperty(exports, "ResourceType", { enumerable: true, get: function () { return resource_types_1.ResourceType; } });
|
|
95
|
+
const resources_1 = require("./packlets/resources");
|
|
96
|
+
Object.defineProperty(exports, "Resource", { enumerable: true, get: function () { return resources_1.Resource; } });
|
|
97
|
+
Object.defineProperty(exports, "ResourceCandidate", { enumerable: true, get: function () { return resources_1.ResourceCandidate; } });
|
|
98
|
+
Object.defineProperty(exports, "ResourceManagerBuilder", { enumerable: true, get: function () { return resources_1.ResourceManagerBuilder; } });
|
|
99
|
+
const runtime_1 = require("./packlets/runtime");
|
|
100
|
+
Object.defineProperty(exports, "ResourceResolver", { enumerable: true, get: function () { return runtime_1.ResourceResolver; } });
|
|
85
101
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;AAkC3D,wCAAc;AAjChB,kEAAoD;AAkClD,gCAAU;AAjCZ,kEAAoD;AAsBlD,gCAAU;AArBZ,0DAA4C;AAuB1C,wBAAM;AAtBR,4DAA8C;AAuB5C,0BAAO;AAtBT,gEAAkD;AAwBhD,8BAAS;AAvBX,uEAAyD;AAgCvD,oCAAY;AA/Bd,gEAAkD;AAoChD,8BAAS;AAnCX,yEAA2D;AAkCzD,sCAAa;AAjCf,0DAA4C;AAqB1C,wBAAM;AApBR,4DAA8C;AAkC5C,0BAAO;AAhCT,oDAAkC;AAElC,sDAAgE;AAS9D,0FATO,sBAAS,OASP;AAET,6FAXkB,yBAAY,OAWlB;AAVd,oDAAgD;AAa9C,yFAbO,oBAAQ,OAaP;AAZV,gEAA2D;AAiBzD,8FAjBO,+BAAa,OAiBP;AAhBf,sDAAkD;AAehD,0FAfO,sBAAS,OAeP;AAdX,8DAAyD;AAuBvD,6FAvBO,6BAAY,OAuBP;AAtBd,oDAA2F;AAiBzF,yFAjBO,oBAAQ,OAiBP;AACR,kGAlBiB,6BAAiB,OAkBjB;AAGjB,uGArBoC,kCAAsB,OAqBpC;AApBxB,gDAAwE;AAmBtE,iGAnByB,0BAAgB,OAmBzB","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport * as QualifierTypes from './packlets/qualifier-types';\nimport * as Qualifiers from './packlets/qualifiers';\nimport * as Conditions from './packlets/conditions';\nimport * as Config from './packlets/config';\nimport * as Context from './packlets/context';\nimport * as Decisions from './packlets/decisions';\nimport * as ResourceJson from './packlets/resource-json';\nimport * as Resources from './packlets/resources';\nimport * as ResourceTypes from './packlets/resource-types';\nimport * as Import from './packlets/import';\nimport * as Runtime from './packlets/runtime';\n\nexport * from './packlets/common';\n\nimport { Condition, ConditionSet } from './packlets/conditions';\nimport { Decision } from './packlets/decisions';\nimport { QualifierType } from './packlets/qualifier-types';\nimport { Qualifier } from './packlets/qualifiers';\nimport { ResourceType } from './packlets/resource-types';\nimport { Resource, ResourceCandidate, ResourceManagerBuilder } from './packlets/resources';\nimport { IResourceManager, ResourceResolver } from './packlets/runtime';\n\nexport {\n Condition,\n Conditions,\n ConditionSet,\n Config,\n Context,\n Decision,\n Decisions,\n Import,\n IResourceManager,\n Qualifier,\n QualifierType,\n QualifierTypes,\n Qualifiers,\n Resource,\n ResourceCandidate,\n ResourceJson,\n ResourceResolver,\n ResourceManagerBuilder,\n ResourceType,\n ResourceTypes,\n Resources,\n Runtime\n};\n"]}
|
|
@@ -38,4 +38,12 @@ export type ResourceValueMergeMethod = 'augment' | 'delete' | 'replace';
|
|
|
38
38
|
* @public
|
|
39
39
|
*/
|
|
40
40
|
export declare const allResourceValueMergeMethods: ResourceValueMergeMethod[];
|
|
41
|
+
/**
|
|
42
|
+
* The completeness of a resource candidate value. A full value is one that
|
|
43
|
+
* contains all of the required properties for the resource type. A partial
|
|
44
|
+
* value is one that contains some of the required properties for the resource
|
|
45
|
+
* type.
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export type CandidateCompleteness = 'full' | 'partial';
|
|
41
49
|
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/resources.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBAAwB,EAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../src/packlets/common/resources.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBAAwB,EAAqC,CAAC;AAEzG;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/packlets/common/resources.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA4CH;;;GAGG;AACU,QAAA,4BAA4B,GAA+B,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Brand } from '@fgv/ts-utils';\n\n/**\n * Branded string representing a validated resource id. A resource ID\n * is a dot-separated sequence of resource names.\n * @public\n */\nexport type ResourceId = Brand<string, 'ResourceId'>;\n\n/**\n * Branded string representing a validated resource name.\n * @public\n */\nexport type ResourceName = Brand<string, 'ResourceName'>;\n\n/**\n * Branded number representing a validated resource index.\n * @public\n */\nexport type ResourceIndex = Brand<number, 'ResourceIndex'>;\n\n/**\n * Branded string representing a validated resource type name.\n * @public\n */\nexport type ResourceTypeName = Brand<string, 'ResourceTypeName'>;\n\n/**\n * Branded number representing a validated resource type index.\n * @public\n */\nexport type ResourceTypeIndex = Brand<number, 'ResourceTypeIndex'>;\n\n/**\n * Type representing the possible ways that a resource value can be merged into an existing resource.\n * - 'augment' means that the new value should be merged into the existing value, with new properties added and existing properties updated.\n * - 'delete' means that the existing values should be deleted.\n * - 'replace' means that the new value should replace the existing value.\n * @public\n */\nexport type ResourceValueMergeMethod = 'augment' | 'delete' | 'replace';\n\n/**\n * Array of all possible {@link ResourceValueMergeMethod | resource merge type} values.\n * @public\n */\nexport const allResourceValueMergeMethods: ResourceValueMergeMethod[] = ['augment', 'delete', 'replace'];\n"]}
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../../src/packlets/common/resources.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AA4CH;;;GAGG;AACU,QAAA,4BAA4B,GAA+B,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Brand } from '@fgv/ts-utils';\n\n/**\n * Branded string representing a validated resource id. A resource ID\n * is a dot-separated sequence of resource names.\n * @public\n */\nexport type ResourceId = Brand<string, 'ResourceId'>;\n\n/**\n * Branded string representing a validated resource name.\n * @public\n */\nexport type ResourceName = Brand<string, 'ResourceName'>;\n\n/**\n * Branded number representing a validated resource index.\n * @public\n */\nexport type ResourceIndex = Brand<number, 'ResourceIndex'>;\n\n/**\n * Branded string representing a validated resource type name.\n * @public\n */\nexport type ResourceTypeName = Brand<string, 'ResourceTypeName'>;\n\n/**\n * Branded number representing a validated resource type index.\n * @public\n */\nexport type ResourceTypeIndex = Brand<number, 'ResourceTypeIndex'>;\n\n/**\n * Type representing the possible ways that a resource value can be merged into an existing resource.\n * - 'augment' means that the new value should be merged into the existing value, with new properties added and existing properties updated.\n * - 'delete' means that the existing values should be deleted.\n * - 'replace' means that the new value should replace the existing value.\n * @public\n */\nexport type ResourceValueMergeMethod = 'augment' | 'delete' | 'replace';\n\n/**\n * Array of all possible {@link ResourceValueMergeMethod | resource merge type} values.\n * @public\n */\nexport const allResourceValueMergeMethods: ResourceValueMergeMethod[] = ['augment', 'delete', 'replace'];\n\n/**\n * The completeness of a resource candidate value. A full value is one that\n * contains all of the required properties for the resource type. A partial\n * value is one that contains some of the required properties for the resource\n * type.\n * @public\n */\nexport type CandidateCompleteness = 'full' | 'partial';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JsonObject } from '@fgv/ts-json-base';
|
|
2
2
|
import { IResourceCandidateValidationProperties, ResourceType } from './resourceType';
|
|
3
|
-
import { ResourceTypeName } from '../common';
|
|
3
|
+
import { CandidateCompleteness, ResourceTypeName } from '../common';
|
|
4
4
|
import { Result } from '@fgv/ts-utils';
|
|
5
5
|
/**
|
|
6
6
|
* Parameters to create a {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.
|
|
@@ -44,14 +44,14 @@ export declare class JsonResourceType extends ResourceType<JsonObject> {
|
|
|
44
44
|
/**
|
|
45
45
|
* {@inheritdoc ResourceTypes.ResourceType.(validate:1)}
|
|
46
46
|
*/
|
|
47
|
-
validate(json: JsonObject,
|
|
47
|
+
validate(json: JsonObject, completeness: CandidateCompleteness): Result<JsonObject>;
|
|
48
48
|
/**
|
|
49
49
|
* {@inheritdoc ResourceTypes.ResourceType.(validate:2)}
|
|
50
50
|
*/
|
|
51
|
-
validate(json: JsonObject,
|
|
51
|
+
validate(json: JsonObject, completeness: 'full'): Result<JsonObject>;
|
|
52
52
|
/**
|
|
53
53
|
* {@inheritdoc ResourceTypes.ResourceType.(validate:3)}
|
|
54
54
|
*/
|
|
55
|
-
validate(json: JsonObject,
|
|
55
|
+
validate(json: JsonObject, completeness: 'partial'): Result<JsonObject>;
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=jsonResourceType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonResourceType.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/jsonResourceType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAgC,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,sCAAsC,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAW,gBAAgB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonResourceType.d.ts","sourceRoot":"","sources":["../../../src/packlets/resource-types/jsonResourceType.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAgC,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,sCAAsC,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAW,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAiB,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,UAAU,CAAC;IAC5D;;;;;OAKG;IACH,SAAS,aAAa,GAAG,EAAE,gBAAgB,EAAE,KAAK,CAAC,EAAE,MAAM;IAI3D;;;;;OAKG;WACW,MAAM,CAAC,MAAM,CAAC,EAAE,6BAA6B,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAMtF;;OAEG;IAEI,mBAAmB,CAAC,KAAK,EAAE,sCAAsC,GAAG,MAAM,CAAC,UAAU,CAAC;IAI7F;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,qBAAqB,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1F;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC;IAC3E;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;CAI/E"}
|
|
@@ -58,7 +58,7 @@ class JsonResourceType extends resourceType_1.ResourceType {
|
|
|
58
58
|
validateDeclaration(props) {
|
|
59
59
|
return ts_json_base_1.Converters.jsonObject.convert(props.json);
|
|
60
60
|
}
|
|
61
|
-
validate(json,
|
|
61
|
+
validate(json, __completeness) {
|
|
62
62
|
return ts_json_base_1.Converters.jsonObject.convert(json);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonResourceType.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/jsonResourceType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,oDAA6E;AAC7E,iDAAsF;AACtF,
|
|
1
|
+
{"version":3,"file":"jsonResourceType.js","sourceRoot":"","sources":["../../../src/packlets/resource-types/jsonResourceType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAEH,oDAA6E;AAC7E,iDAAsF;AACtF,sCAA6E;AAC7E,4CAAsD;AAoBtD;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,2BAAwB;IAC5D;;;;;OAKG;IACH,YAAsB,GAAqB,EAAE,KAAc;QACzD,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,MAAsC;;QACzD,OAAO,gBAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,mCAAI,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;YAC/E,OAAO,IAAA,wBAAa,EAAC,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,GAAG,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,CAAC;QACvE,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IAEI,mBAAmB,CAAC,KAA6C;QACtE,OAAO,yBAAc,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IAcM,QAAQ,CAAC,IAAgB,EAAE,cAAsC;QACtE,OAAO,yBAAc,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,CAAC;CACF;AA9CD,4CA8CC","sourcesContent":["/*\n * Copyright (c) 2025 Erik Fortune\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { Converters as JsonConverters, JsonObject } from '@fgv/ts-json-base';\nimport { IResourceCandidateValidationProperties, ResourceType } from './resourceType';\nimport { CandidateCompleteness, Convert, ResourceTypeName } from '../common';\nimport { captureResult, Result } from '@fgv/ts-utils';\n\n/**\n * Parameters to create a {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * @public\n */\nexport interface IJsonResourceTypeCreateParams {\n /**\n * Optional key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * Defaults to 'json'.\n */\n key?: string;\n\n /**\n * Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType}\n * instance.\n */\n index?: number;\n}\n\n/**\n * Implementation of a {@link ResourceTypes.ResourceType | ResourceType} for JSON values.\n * @public\n */\nexport class JsonResourceType extends ResourceType<JsonObject> {\n /**\n * Protected {@link ResourceTypes.JsonResourceType | JsonResourceType} constructor for use by subclasses.\n * Use {@link ResourceTypes.JsonResourceType.create | JsonResourceType.create} to create a new instance.\n * @param key - The key for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * @param index - Optional index for the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n */\n protected constructor(key: ResourceTypeName, index?: number) {\n super(key, index);\n }\n\n /**\n * Factory method to create a new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance.\n * @param params - {@link ResourceTypes.IJsonResourceTypeCreateParams | Parameters} to create the new instance.\n * @returns `Success` with the new {@link ResourceTypes.JsonResourceType | JsonResourceType} instance if successful\n * or `Failure` with an error message if not.\n */\n public static create(params?: IJsonResourceTypeCreateParams): Result<JsonResourceType> {\n return Convert.resourceTypeName.convert(params?.key ?? 'json').onSuccess((key) => {\n return captureResult(() => new JsonResourceType(key, params?.index));\n });\n }\n\n /**\n * {@inheritdoc ResourceTypes.ResourceType.validateDeclaration}\n */\n\n public validateDeclaration(props: IResourceCandidateValidationProperties): Result<JsonObject> {\n return JsonConverters.jsonObject.convert(props.json);\n }\n\n /**\n * {@inheritdoc ResourceTypes.ResourceType.(validate:1)}\n */\n public validate(json: JsonObject, completeness: CandidateCompleteness): Result<JsonObject>;\n /**\n * {@inheritdoc ResourceTypes.ResourceType.(validate:2)}\n */\n public validate(json: JsonObject, completeness: 'full'): Result<JsonObject>;\n /**\n * {@inheritdoc ResourceTypes.ResourceType.(validate:3)}\n */\n public validate(json: JsonObject, completeness: 'partial'): Result<JsonObject>;\n public validate(json: JsonObject, __completeness?: CandidateCompleteness): Result<JsonObject> {\n return JsonConverters.jsonObject.convert(json);\n }\n}\n"]}
|