@fgv/ts-res 5.0.0-7 → 5.0.0-9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/ts-res.d.ts +542 -98
  2. package/lib/index.d.ts +3 -1
  3. package/lib/index.d.ts.map +1 -1
  4. package/lib/index.js +6 -1
  5. package/lib/index.js.map +1 -1
  6. package/lib/packlets/bundle/bundleBuilder.d.ts +41 -0
  7. package/lib/packlets/bundle/bundleBuilder.d.ts.map +1 -0
  8. package/lib/packlets/bundle/bundleBuilder.js +131 -0
  9. package/lib/packlets/bundle/bundleBuilder.js.map +1 -0
  10. package/lib/packlets/bundle/bundleLoader.d.ts +72 -0
  11. package/lib/packlets/bundle/bundleLoader.d.ts.map +1 -0
  12. package/lib/packlets/bundle/bundleLoader.js +104 -0
  13. package/lib/packlets/bundle/bundleLoader.js.map +1 -0
  14. package/lib/packlets/bundle/bundleNormalizer.d.ts +73 -0
  15. package/lib/packlets/bundle/bundleNormalizer.d.ts.map +1 -0
  16. package/lib/packlets/bundle/bundleNormalizer.js +142 -0
  17. package/lib/packlets/bundle/bundleNormalizer.js.map +1 -0
  18. package/lib/packlets/bundle/bundleUtils.d.ts +70 -0
  19. package/lib/packlets/bundle/bundleUtils.d.ts.map +1 -0
  20. package/lib/packlets/bundle/bundleUtils.js +119 -0
  21. package/lib/packlets/bundle/bundleUtils.js.map +1 -0
  22. package/lib/packlets/bundle/convert.d.ts +33 -0
  23. package/lib/packlets/bundle/convert.d.ts.map +1 -0
  24. package/lib/packlets/bundle/convert.js +78 -0
  25. package/lib/packlets/bundle/convert.js.map +1 -0
  26. package/lib/packlets/bundle/index.d.ts +19 -0
  27. package/lib/packlets/bundle/index.d.ts.map +1 -0
  28. package/lib/packlets/bundle/index.js +72 -0
  29. package/lib/packlets/bundle/index.js.map +1 -0
  30. package/lib/packlets/bundle/model.d.ts +100 -0
  31. package/lib/packlets/bundle/model.d.ts.map +1 -0
  32. package/lib/packlets/bundle/model.js +24 -0
  33. package/lib/packlets/bundle/model.js.map +1 -0
  34. package/lib/packlets/resources/resourceManagerBuilder.d.ts +15 -1
  35. package/lib/packlets/resources/resourceManagerBuilder.d.ts.map +1 -1
  36. package/lib/packlets/resources/resourceManagerBuilder.js +31 -0
  37. package/lib/packlets/resources/resourceManagerBuilder.js.map +1 -1
  38. package/lib/packlets/runtime/resourceResolver.d.ts +21 -0
  39. package/lib/packlets/runtime/resourceResolver.d.ts.map +1 -1
  40. package/lib/packlets/runtime/resourceResolver.js +24 -6
  41. package/lib/packlets/runtime/resourceResolver.js.map +1 -1
  42. package/package.json +12 -12
package/dist/ts-res.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Collections } from '@fgv/ts-utils';
3
3
  import { Converter } from '@fgv/ts-utils';
4
4
  import { DetailedResult } from '@fgv/ts-utils';
5
5
  import { FileTree } from '@fgv/ts-utils';
6
+ import { Hash } from '@fgv/ts-utils';
6
7
  import { ICollectible } from '@fgv/ts-utils';
7
8
  import { IReadOnlyResultMap } from '@fgv/ts-utils';
8
9
  import { JsonObject } from '@fgv/ts-json-base';
@@ -178,6 +179,261 @@ declare function buildQualifierDefaultValuesToken(parts: ReadonlyArray<IQualifie
178
179
  */
179
180
  declare function buildQualifierDefaultValueToken({ qualifier, value }: IQualifierDefaultValueTokenParts): Result<QualifierDefaultValueToken>;
180
181
 
182
+ declare namespace Bundle {
183
+ export {
184
+ IBundleMetadata,
185
+ IBundleExportMetadata,
186
+ IBundle,
187
+ IBundleCreateParams,
188
+ BundleBuilder,
189
+ BundleLoader,
190
+ IBundleLoaderCreateParams,
191
+ BundleUtils,
192
+ IBundleComponents,
193
+ Convert_10 as Convert,
194
+ BundleNormalizer
195
+ }
196
+ }
197
+ export { Bundle }
198
+
199
+ /**
200
+ * `Converter` for a {@link Bundle.IBundle | bundle} object.
201
+ * @public
202
+ */
203
+ declare const bundle: Converter<IBundle>;
204
+
205
+ /**
206
+ * Builder for creating resource bundles from a ResourceManagerBuilder.
207
+ * Handles the compilation, configuration extraction, and integrity verification
208
+ * needed to create a complete, portable bundle.
209
+ * @public
210
+ */
211
+ export declare class BundleBuilder {
212
+ /**
213
+ * Creates a resource bundle from a ResourceManagerBuilder.
214
+ * @param builder - The ResourceManagerBuilder containing the resources to bundle
215
+ * @param systemConfig - The SystemConfiguration used to create the builder
216
+ * @param params - Optional parameters for bundle creation
217
+ * @returns Success with the created bundle if successful, Failure with error message otherwise
218
+ * @public
219
+ */
220
+ static create(builder: ResourceManagerBuilder, systemConfig: SystemConfiguration, params?: IBundleCreateParams): Result<IBundle>;
221
+ /**
222
+ * Creates a resource bundle from a ResourceManagerBuilder using a predefined system configuration.
223
+ * This is a convenience method for the common case of using predefined configurations.
224
+ * @param builder - The ResourceManagerBuilder containing the resources to bundle
225
+ * @param configName - The name of the predefined system configuration used
226
+ * @param params - Optional parameters for bundle creation
227
+ * @returns Success with the created bundle if successful, Failure with error message otherwise
228
+ * @public
229
+ */
230
+ static createFromPredefined(builder: ResourceManagerBuilder, configName: PredefinedSystemConfiguration, params?: IBundleCreateParams): Result<IBundle>;
231
+ /**
232
+ * Generates a hash checksum for the compiled resource collection.
233
+ * The checksum is calculated using the provided hash normalizer.
234
+ * @param compiledCollection - The compiled resource collection to generate checksum for
235
+ * @param hashNormalizer - The hash normalizer to use for checksum generation
236
+ * @returns Success with the checksum string if successful, Failure otherwise
237
+ * @internal
238
+ */
239
+ private static _generateChecksum;
240
+ }
241
+
242
+ /**
243
+ * `Converter` for {@link Bundle.IBundleCreateParams | bundle creation parameters}.
244
+ * @public
245
+ */
246
+ declare const bundleCreateParams: Converter<IBundleCreateParams>;
247
+
248
+ /**
249
+ * `Converter` for {@link Bundle.IBundleExportMetadata | bundle export metadata}.
250
+ * @public
251
+ */
252
+ declare const bundleExportMetadata: Converter<IBundleExportMetadata>;
253
+
254
+ /**
255
+ * Loader for creating an IResourceManager from a resource bundle.
256
+ * Handles integrity verification and reconstruction of the runtime resource manager.
257
+ * @public
258
+ */
259
+ export declare class BundleLoader {
260
+ /**
261
+ * Creates an IResourceManager from a resource bundle.
262
+ * @param params - Parameters for bundle loading including the bundle and options
263
+ * @returns Success with the IResourceManager if successful, Failure with error message otherwise
264
+ * @public
265
+ */
266
+ static createManagerFromBundle(params: IBundleLoaderCreateParams): Result<IResourceManager>;
267
+ /**
268
+ * Verifies the integrity of a bundle by checking its checksum.
269
+ * @param bundle - The bundle to verify
270
+ * @param skipVerification - Whether to skip verification
271
+ * @param hashNormalizer - The hash normalizer to use for verification
272
+ * @returns Success if verification passes or is skipped, Failure otherwise
273
+ * @internal
274
+ */
275
+ private static _verifyBundleIntegrity;
276
+ /**
277
+ * Generates a hash checksum for the compiled resource collection.
278
+ * @param compiledCollection - The compiled resource collection to generate checksum for
279
+ * @param hashNormalizer - The hash normalizer to use for checksum generation
280
+ * @returns Success with the checksum string if successful, Failure otherwise
281
+ * @internal
282
+ */
283
+ private static _generateChecksum;
284
+ /**
285
+ * Creates a SystemConfiguration from the bundle's configuration.
286
+ * @param bundle - The bundle containing the configuration
287
+ * @returns Success with the SystemConfiguration if successful, Failure otherwise
288
+ * @internal
289
+ */
290
+ private static _createSystemConfiguration;
291
+ /**
292
+ * Creates a CompiledResourceCollection from the bundle.
293
+ * @param bundle - The bundle to load
294
+ * @param qualifierTypes - The qualifier type collector from the system configuration
295
+ * @param resourceTypes - The resource type collector from the system configuration
296
+ * @returns Success with the CompiledResourceCollection if successful, Failure otherwise
297
+ * @internal
298
+ */
299
+ private static _createCompiledResourceCollection;
300
+ }
301
+
302
+ /**
303
+ * `Converter` for a {@link Bundle.IBundleMetadata | bundle metadata} object.
304
+ * @public
305
+ */
306
+ declare const bundleMetadata: Converter<IBundleMetadata>;
307
+
308
+ /**
309
+ * Normalizes ResourceManagerBuilder instances to ensure consistent ordering
310
+ * of internal entities, enabling order-independent bundle checksums.
311
+ *
312
+ * The normalization process rebuilds the ResourceManagerBuilder from the ground up
313
+ * in a canonical order to ensure identical index assignments regardless of
314
+ * original construction order.
315
+ * @public
316
+ */
317
+ declare class BundleNormalizer {
318
+ /**
319
+ * Creates a normalized ResourceManagerBuilder from an existing builder.
320
+ * The normalized builder will have identical entities but arranged in
321
+ * canonical order to ensure consistent index assignments.
322
+ *
323
+ * @param originalBuilder - The ResourceManagerBuilder to normalize
324
+ * @param systemConfig - The SystemConfiguration used to create the original builder
325
+ * @returns Success with the normalized ResourceManagerBuilder if successful, Failure otherwise
326
+ */
327
+ static normalize(originalBuilder: ResourceManagerBuilder, systemConfig: SystemConfiguration): Result<ResourceManagerBuilder>;
328
+ /**
329
+ * Creates a normalized ResourceManagerBuilder using a predefined system configuration.
330
+ * This is a convenience method for the common case of using predefined configurations.
331
+ *
332
+ * @param originalBuilder - The ResourceManagerBuilder to normalize
333
+ * @param configName - The name of the predefined system configuration used
334
+ * @returns Success with the normalized ResourceManagerBuilder if successful, Failure otherwise
335
+ */
336
+ static normalizeFromPredefined(originalBuilder: ResourceManagerBuilder, configName: PredefinedSystemConfiguration): Result<ResourceManagerBuilder>;
337
+ /**
338
+ * Normalizes all conditions from the original builder by adding them to the
339
+ * normalized builder in sorted order using loose condition declarations.
340
+ *
341
+ * @param originalBuilder - The source ResourceManagerBuilder
342
+ * @param normalizedBuilder - The target normalized ResourceManagerBuilder
343
+ * @returns Success if all conditions were normalized successfully, Failure otherwise
344
+ * @internal
345
+ */
346
+ private static _normalizeConditions;
347
+ /**
348
+ * Normalizes all condition sets from the original builder by adding them to the
349
+ * normalized builder in sorted order using loose condition set declarations.
350
+ *
351
+ * @param originalBuilder - The source ResourceManagerBuilder
352
+ * @param normalizedBuilder - The target normalized ResourceManagerBuilder
353
+ * @returns Success if all condition sets were normalized successfully, Failure otherwise
354
+ * @internal
355
+ */
356
+ private static _normalizeConditionSets;
357
+ /**
358
+ * Normalizes all candidates by sorting them first by resource ID, then by condition set.
359
+ *
360
+ * @param originalBuilder - The source ResourceManagerBuilder
361
+ * @param normalizedBuilder - The target normalized ResourceManagerBuilder
362
+ * @returns Success if all candidates were normalized successfully, Failure otherwise
363
+ * @internal
364
+ */
365
+ private static _normalizeCandidates;
366
+ /**
367
+ * Adds normalized resources to the target builder by first normalizing conditions,
368
+ * then condition sets, then candidates.
369
+ *
370
+ * @param originalBuilder - The source ResourceManagerBuilder
371
+ * @param normalizedBuilder - The target normalized ResourceManagerBuilder
372
+ * @returns Success if all resources were added successfully, Failure otherwise
373
+ * @internal
374
+ */
375
+ private static _addNormalizedResources;
376
+ }
377
+
378
+ /**
379
+ * Lightweight converter for bundle structure validation without full processing.
380
+ * Useful for detecting bundle files without the overhead of full validation.
381
+ * @public
382
+ */
383
+ declare const bundleStructure: Converter<{
384
+ metadata: IBundleMetadata;
385
+ config: unknown;
386
+ compiledCollection: unknown;
387
+ }>;
388
+
389
+ /**
390
+ * Utility functions for working with resource bundles.
391
+ * Provides reusable logic for bundle detection, parsing, and component extraction.
392
+ * @public
393
+ */
394
+ declare class BundleUtils {
395
+ /**
396
+ * Checks if the given object appears to be a bundle file by examining its structure.
397
+ * This is a lightweight check that doesn't perform full validation.
398
+ * @param data - The data to check
399
+ * @returns True if the data appears to be a bundle structure
400
+ * @public
401
+ */
402
+ static isBundleFile(data: unknown): boolean;
403
+ /**
404
+ * Extracts and validates components from a bundle for reuse.
405
+ * Performs full validation of the bundle structure and creates typed components.
406
+ * @param bundleData - The raw bundle data to extract components from
407
+ * @returns Success with bundle components if valid, Failure with error message otherwise
408
+ * @public
409
+ */
410
+ static extractBundleComponents(bundleData: unknown): Result<IBundleComponents>;
411
+ /**
412
+ * Extracts just the metadata from potential bundle data without full validation.
413
+ * Useful for displaying bundle information without processing the entire bundle.
414
+ * @param data - The data to extract metadata from
415
+ * @returns Success with metadata if found and valid, Failure otherwise
416
+ * @public
417
+ */
418
+ static extractBundleMetadata(data: unknown): Result<IBundleMetadata>;
419
+ /**
420
+ * Parses bundle data from a JSON string.
421
+ * Convenience method that combines JSON parsing with bundle component extraction.
422
+ * @param jsonString - The JSON string containing bundle data
423
+ * @returns Success with bundle components if valid, Failure with error message otherwise
424
+ * @public
425
+ */
426
+ static parseBundleFromJson(jsonString: string): Result<IBundleComponents>;
427
+ /**
428
+ * Checks if a file name suggests it might be a bundle file.
429
+ * This is a heuristic check based on file naming conventions.
430
+ * @param fileName - The file name to check
431
+ * @returns True if the file name suggests a bundle file
432
+ * @public
433
+ */
434
+ static isBundleFileName(fileName: string): boolean;
435
+ }
436
+
181
437
  /**
182
438
  * Simple implementation of {@link Decisions.ICandidate | ICandidate} with
183
439
  * helper methods for sorting and presentation.
@@ -418,7 +674,7 @@ declare namespace Common {
418
674
 
419
675
  declare namespace Compiled {
420
676
  export {
421
- Convert_3 as Convert,
677
+ Convert_6 as Convert,
422
678
  ICompiledResourceOptions,
423
679
  ICompiledConditionMetadata,
424
680
  ICompiledConditionSetMetadata,
@@ -439,61 +695,61 @@ declare namespace Compiled {
439
695
  * Converter for a {@link ResourceJson.Compiled.ICompiledAbstractDecision | compiled abstract decision}.
440
696
  * @public
441
697
  */
442
- declare const compiledAbstractDecision: ObjectConverter<Model.ICompiledAbstractDecision, unknown>;
698
+ declare const compiledAbstractDecision: ObjectConverter<Model_3.ICompiledAbstractDecision, unknown>;
443
699
 
444
700
  /**
445
701
  * Converter for a {@link ResourceJson.Compiled.ICompiledCandidate | compiled candidate}.
446
702
  * @public
447
703
  */
448
- declare const compiledCandidate: ObjectConverter<Model.ICompiledCandidate, unknown>;
704
+ declare const compiledCandidate: ObjectConverter<Model_3.ICompiledCandidate, unknown>;
449
705
 
450
706
  /**
451
707
  * Converter for a {@link ResourceJson.Compiled.ICompiledCondition | compiled condition}.
452
708
  * @public
453
709
  */
454
- declare const compiledCondition: ObjectConverter<Model.ICompiledCondition, unknown>;
710
+ declare const compiledCondition: ObjectConverter<Model_3.ICompiledCondition, unknown>;
455
711
 
456
712
  /**
457
713
  * Converter for a {@link ResourceJson.Compiled.ICompiledConditionMetadata | compiled condition metadata}.
458
714
  * @public
459
715
  */
460
- declare const compiledConditionMetadata: ObjectConverter<Model.ICompiledConditionMetadata, unknown>;
716
+ declare const compiledConditionMetadata: ObjectConverter<Model_3.ICompiledConditionMetadata, unknown>;
461
717
 
462
718
  /**
463
719
  * Converter for a {@link ResourceJson.Compiled.ICompiledConditionSet | compiled condition set}.
464
720
  * @public
465
721
  */
466
- declare const compiledConditionSet: ObjectConverter<Model.ICompiledConditionSet, unknown>;
722
+ declare const compiledConditionSet: ObjectConverter<Model_3.ICompiledConditionSet, unknown>;
467
723
 
468
724
  /**
469
725
  * Converter for a {@link ResourceJson.Compiled.ICompiledConditionSetMetadata | compiled condition set metadata}.
470
726
  * @public
471
727
  */
472
- declare const compiledConditionSetMetadata: ObjectConverter<Model.ICompiledConditionSetMetadata, unknown>;
728
+ declare const compiledConditionSetMetadata: ObjectConverter<Model_3.ICompiledConditionSetMetadata, unknown>;
473
729
 
474
730
  /**
475
731
  * Converter for a {@link ResourceJson.Compiled.ICompiledDecisionMetadata | compiled decision metadata}.
476
732
  * @public
477
733
  */
478
- declare const compiledDecisionMetadata: ObjectConverter<Model.ICompiledDecisionMetadata, unknown>;
734
+ declare const compiledDecisionMetadata: ObjectConverter<Model_3.ICompiledDecisionMetadata, unknown>;
479
735
 
480
736
  /**
481
737
  * Converter for a {@link ResourceJson.Compiled.ICompiledQualifier | compiled qualifier}.
482
738
  * @public
483
739
  */
484
- declare const compiledQualifier: ObjectConverter<Model.ICompiledQualifier, unknown>;
740
+ declare const compiledQualifier: ObjectConverter<Model_3.ICompiledQualifier, unknown>;
485
741
 
486
742
  /**
487
743
  * Converter for a {@link ResourceJson.Compiled.ICompiledQualifierType | compiled qualifier type}.
488
744
  * @public
489
745
  */
490
- declare const compiledQualifierType: ObjectConverter<Model.ICompiledQualifierType, unknown>;
746
+ declare const compiledQualifierType: ObjectConverter<Model_3.ICompiledQualifierType, unknown>;
491
747
 
492
748
  /**
493
749
  * Converter for a {@link ResourceJson.Compiled.ICompiledResource | compiled resource}.
494
750
  * @public
495
751
  */
496
- declare const compiledResource: ObjectConverter<Model.ICompiledResource, unknown>;
752
+ declare const compiledResource: ObjectConverter<Model_3.ICompiledResource, unknown>;
497
753
 
498
754
  /**
499
755
  * A compiled resource collection implements {@link Runtime.IResourceManager | IResourceManager}
@@ -638,13 +894,13 @@ declare class CompiledResourceCollection implements IResourceManager {
638
894
  * This combines all the individual converters into a single converter for the entire resource collection.
639
895
  * @public
640
896
  */
641
- declare const compiledResourceCollection: ObjectConverter<Model.ICompiledResourceCollection, unknown>;
897
+ declare const compiledResourceCollection: ObjectConverter<Model_3.ICompiledResourceCollection, unknown>;
642
898
 
643
899
  /**
644
900
  * Converter for a {@link ResourceJson.Compiled.ICompiledResourceType | compiled resource type}.
645
901
  * @public
646
902
  */
647
- declare const compiledResourceType: ObjectConverter<Model.ICompiledResourceType, unknown>;
903
+ declare const compiledResourceType: ObjectConverter<Model_3.ICompiledResourceType, unknown>;
648
904
 
649
905
  /**
650
906
  * A {@link Decisions.ConcreteDecision | concrete decision} is a {@link Decisions.IDecision | decision}
@@ -942,7 +1198,7 @@ declare const conditionPriority: Converter<ConditionPriority, unknown>;
942
1198
 
943
1199
  declare namespace Conditions {
944
1200
  export {
945
- Convert_5 as Convert,
1201
+ Convert_11 as Convert,
946
1202
  Condition,
947
1203
  IConditionCollectorCreateParams,
948
1204
  ConditionCollector,
@@ -1383,8 +1639,8 @@ declare class ConditionTokens {
1383
1639
 
1384
1640
  declare namespace Config {
1385
1641
  export {
1386
- Model_2 as Model,
1387
- Convert_10 as Convert,
1642
+ Model,
1643
+ Convert_9 as Convert,
1388
1644
  updateSystemConfigurationQualifierDefaultValues,
1389
1645
  ISystemConfigurationInitParams,
1390
1646
  SystemConfiguration,
@@ -1400,7 +1656,7 @@ export { Config }
1400
1656
 
1401
1657
  declare namespace Config_2 {
1402
1658
  export {
1403
- Convert_6 as Convert,
1659
+ Convert_2 as Convert,
1404
1660
  IQualifierTypeConfig,
1405
1661
  ILanguageQualifierTypeConfig,
1406
1662
  ITerritoryQualifierTypeConfig,
@@ -1414,7 +1670,7 @@ declare namespace Config_2 {
1414
1670
 
1415
1671
  declare namespace Config_3 {
1416
1672
  export {
1417
- Convert_9 as Convert,
1673
+ Convert_5 as Convert,
1418
1674
  IResourceTypeConfig
1419
1675
  }
1420
1676
  }
@@ -1427,7 +1683,7 @@ declare const containerContextDecl: Converter<Normalized.IContainerContextDecl>;
1427
1683
 
1428
1684
  declare namespace Context {
1429
1685
  export {
1430
- Convert_2 as Convert,
1686
+ Convert_7 as Convert,
1431
1687
  IContextMatchOptions,
1432
1688
  IContextQualifierValueDecl,
1433
1689
  IContextDecl,
@@ -1768,24 +2024,64 @@ declare namespace Convert {
1768
2024
  }
1769
2025
  export { Convert }
1770
2026
 
1771
- declare namespace Convert_10 {
2027
+ export declare namespace Convert_10 {
1772
2028
  export {
1773
- systemConfiguration,
1774
- predefinedSystemConfiguration
2029
+ bundleMetadata,
2030
+ bundleExportMetadata,
2031
+ bundle,
2032
+ bundleCreateParams,
2033
+ bundleStructure
2034
+ }
2035
+ }
2036
+
2037
+ declare namespace Convert_11 {
2038
+ export {
2039
+ conditionDecl,
2040
+ IConditionDeclConvertContext,
2041
+ validatedConditionDecl,
2042
+ conditionSetDecl_2 as conditionSetDecl,
2043
+ IConditionSetDeclConvertContext,
2044
+ validatedConditionSetDecl
1775
2045
  }
1776
2046
  }
1777
2047
 
1778
2048
  declare namespace Convert_2 {
1779
2049
  export {
1780
- contextQualifierValueDecl,
1781
- contextDecl,
1782
- IContextDeclConvertContext,
1783
- validatedContextQualifierValueDecl,
1784
- validatedContextDecl
2050
+ languageQualifierTypeConfig,
2051
+ territoryQualifierTypeConfig,
2052
+ literalQualifierTypeConfig,
2053
+ systemLanguageQualifierTypeConfig,
2054
+ systemTerritoryQualifierTypeConfig,
2055
+ systemLiteralQualifierTypeConfig,
2056
+ systemQualifierTypeConfig
1785
2057
  }
1786
2058
  }
1787
2059
 
1788
2060
  declare namespace Convert_3 {
2061
+ export {
2062
+ literalValueHierarchyCreateParams,
2063
+ IQualifierTypeConvertContext,
2064
+ qualifierType
2065
+ }
2066
+ }
2067
+
2068
+ declare namespace Convert_4 {
2069
+ export {
2070
+ qualifierDecl,
2071
+ IQualifierDeclConvertContext,
2072
+ validatedQualifierDecl,
2073
+ IQualifierConvertContext,
2074
+ qualifier
2075
+ }
2076
+ }
2077
+
2078
+ declare namespace Convert_5 {
2079
+ export {
2080
+ resourceTypeConfig
2081
+ }
2082
+ }
2083
+
2084
+ declare namespace Convert_6 {
1789
2085
  export {
1790
2086
  compiledConditionMetadata,
1791
2087
  compiledConditionSetMetadata,
@@ -1802,7 +2098,17 @@ declare namespace Convert_3 {
1802
2098
  }
1803
2099
  }
1804
2100
 
1805
- declare namespace Convert_4 {
2101
+ declare namespace Convert_7 {
2102
+ export {
2103
+ contextQualifierValueDecl,
2104
+ contextDecl,
2105
+ IContextDeclConvertContext,
2106
+ validatedContextQualifierValueDecl,
2107
+ validatedContextDecl
2108
+ }
2109
+ }
2110
+
2111
+ declare namespace Convert_8 {
1806
2112
  export {
1807
2113
  looseConditionDecl,
1808
2114
  childConditionDecl,
@@ -1820,50 +2126,10 @@ declare namespace Convert_4 {
1820
2126
  }
1821
2127
  }
1822
2128
 
1823
- declare namespace Convert_5 {
1824
- export {
1825
- conditionDecl,
1826
- IConditionDeclConvertContext,
1827
- validatedConditionDecl,
1828
- conditionSetDecl_2 as conditionSetDecl,
1829
- IConditionSetDeclConvertContext,
1830
- validatedConditionSetDecl
1831
- }
1832
- }
1833
-
1834
- declare namespace Convert_6 {
1835
- export {
1836
- languageQualifierTypeConfig,
1837
- territoryQualifierTypeConfig,
1838
- literalQualifierTypeConfig,
1839
- systemLanguageQualifierTypeConfig,
1840
- systemTerritoryQualifierTypeConfig,
1841
- systemLiteralQualifierTypeConfig,
1842
- systemQualifierTypeConfig
1843
- }
1844
- }
1845
-
1846
- declare namespace Convert_7 {
1847
- export {
1848
- literalValueHierarchyCreateParams,
1849
- IQualifierTypeConvertContext,
1850
- qualifierType
1851
- }
1852
- }
1853
-
1854
- declare namespace Convert_8 {
1855
- export {
1856
- qualifierDecl,
1857
- IQualifierDeclConvertContext,
1858
- validatedQualifierDecl,
1859
- IQualifierConvertContext,
1860
- qualifier
1861
- }
1862
- }
1863
-
1864
2129
  declare namespace Convert_9 {
1865
2130
  export {
1866
- resourceTypeConfig
2131
+ systemConfiguration,
2132
+ predefinedSystemConfiguration
1867
2133
  }
1868
2134
  }
1869
2135
 
@@ -2293,6 +2559,147 @@ declare interface IAbstractDecisionCreateParams {
2293
2559
  index?: number;
2294
2560
  }
2295
2561
 
2562
+ /**
2563
+ * A complete resource bundle that encapsulates built resources, configuration, and metadata.
2564
+ * Bundles provide a portable, integrity-verified way to distribute pre-compiled resource collections.
2565
+ * @public
2566
+ */
2567
+ declare interface IBundle {
2568
+ /**
2569
+ * Metadata about the bundle including build date and integrity checksum.
2570
+ */
2571
+ metadata: IBundleMetadata;
2572
+ /**
2573
+ * The system configuration that was used to build the resources in this bundle.
2574
+ */
2575
+ config: Model.ISystemConfiguration;
2576
+ /**
2577
+ * The compiled resource collection containing all resources, conditions, and decisions.
2578
+ */
2579
+ compiledCollection: Compiled.ICompiledResourceCollection;
2580
+ /**
2581
+ * Optional export metadata for tracking when and how the bundle was exported.
2582
+ */
2583
+ exportMetadata?: IBundleExportMetadata;
2584
+ }
2585
+
2586
+ /**
2587
+ * Components extracted from a bundle for reuse in different contexts.
2588
+ * @public
2589
+ */
2590
+ declare interface IBundleComponents {
2591
+ /**
2592
+ * The system configuration from the bundle.
2593
+ */
2594
+ systemConfiguration: SystemConfiguration;
2595
+ /**
2596
+ * The compiled resource collection from the bundle.
2597
+ */
2598
+ compiledCollection: Compiled.ICompiledResourceCollection;
2599
+ /**
2600
+ * The bundle metadata including build information.
2601
+ */
2602
+ metadata: IBundleMetadata;
2603
+ }
2604
+
2605
+ /**
2606
+ * Optional parameters for bundle creation.
2607
+ * @public
2608
+ */
2609
+ declare interface IBundleCreateParams {
2610
+ /**
2611
+ * Optional version identifier to include in the bundle metadata.
2612
+ */
2613
+ version?: string;
2614
+ /**
2615
+ * Optional description to include in the bundle metadata.
2616
+ */
2617
+ description?: string;
2618
+ /**
2619
+ * Optional custom build date. If not provided, the current date will be used.
2620
+ */
2621
+ dateBuilt?: string;
2622
+ /**
2623
+ * Optional hash normalizer for generating checksums. If not provided,
2624
+ * a CRC32 normalizer will be used for browser compatibility.
2625
+ */
2626
+ hashNormalizer?: Hash.HashingNormalizer;
2627
+ /**
2628
+ * Whether to normalize the ResourceManagerBuilder before bundle creation.
2629
+ * When true, the builder is reconstructed in canonical order to ensure
2630
+ * order-independent checksums. Defaults to false for Phase 1 compatibility.
2631
+ */
2632
+ normalize?: boolean;
2633
+ }
2634
+
2635
+ /**
2636
+ * Optional export metadata for tracking bundle export information.
2637
+ * @public
2638
+ */
2639
+ declare interface IBundleExportMetadata {
2640
+ /**
2641
+ * ISO timestamp indicating when the bundle was exported.
2642
+ */
2643
+ exportedAt: string;
2644
+ /**
2645
+ * Tool or application that exported the bundle.
2646
+ */
2647
+ exportedFrom: string;
2648
+ /**
2649
+ * Type of bundle export (e.g., 'ts-res-bundle', 'ts-res-bundle-filtered').
2650
+ */
2651
+ type: string;
2652
+ /**
2653
+ * Optional filter context if the bundle represents filtered data.
2654
+ */
2655
+ filterContext?: Record<string, unknown>;
2656
+ }
2657
+
2658
+ /**
2659
+ * Parameters for creating a BundleLoader.
2660
+ * @public
2661
+ */
2662
+ declare interface IBundleLoaderCreateParams {
2663
+ /**
2664
+ * The bundle to load.
2665
+ */
2666
+ bundle: IBundle;
2667
+ /**
2668
+ * Whether to skip checksum verification during loading.
2669
+ * Default is false - checksum verification is performed.
2670
+ */
2671
+ skipChecksumVerification?: boolean;
2672
+ /**
2673
+ * Optional hash normalizer for verifying checksums. If not provided,
2674
+ * a CRC32 normalizer will be used for browser compatibility.
2675
+ * Must match the normalizer used during bundle creation.
2676
+ */
2677
+ hashNormalizer?: Hash.HashingNormalizer;
2678
+ }
2679
+
2680
+ /**
2681
+ * Metadata for a resource bundle, including build information and integrity verification.
2682
+ * @public
2683
+ */
2684
+ declare interface IBundleMetadata {
2685
+ /**
2686
+ * ISO timestamp indicating when the bundle was built.
2687
+ */
2688
+ dateBuilt: string;
2689
+ /**
2690
+ * SHA-256 checksum of the serialized compiled resource collection for integrity verification.
2691
+ */
2692
+ checksum: string;
2693
+ /**
2694
+ * Optional version identifier for the bundle.
2695
+ */
2696
+ version?: string;
2697
+ /**
2698
+ * Optional human-readable description of the bundle.
2699
+ */
2700
+ description?: string;
2701
+ }
2702
+
2296
2703
  /**
2297
2704
  * Cache metrics interface for tracking cache performance.
2298
2705
  * @public
@@ -4415,6 +4822,24 @@ declare interface IResourceResolverCreateParams {
4415
4822
  * An optional listener for {@link Runtime.ResourceResolver | ResourceResolver} cache activity.
4416
4823
  */
4417
4824
  listener?: IResourceResolverCacheListener;
4825
+ /**
4826
+ * Optional configuration options for the {@link Runtime.ResourceResolver | ResourceResolver}.
4827
+ */
4828
+ options?: IResourceResolverOptions;
4829
+ }
4830
+
4831
+ /**
4832
+ * Options for configuring a {@link Runtime.ResourceResolver | ResourceResolver}.
4833
+ * @public
4834
+ */
4835
+ declare interface IResourceResolverOptions {
4836
+ /**
4837
+ * Controls whether null values in resource composition should suppress properties
4838
+ * instead of setting them to null. When true, properties with null values from
4839
+ * higher-priority partial candidates will be omitted from the final composed resource.
4840
+ * @defaultValue false
4841
+ */
4842
+ suppressNullAsDelete?: boolean;
4418
4843
  }
4419
4844
 
4420
4845
  /**
@@ -5174,7 +5599,7 @@ declare class LanguageQualifierType extends QualifierType {
5174
5599
  * @returns A `Converter` for {@link QualifierTypes.Config.ILanguageQualifierTypeConfig | LanguageQualifierTypeConfig} objects.
5175
5600
  * @public
5176
5601
  */
5177
- declare const languageQualifierTypeConfig: ObjectConverter<Model_3.ILanguageQualifierTypeConfig, unknown>;
5602
+ declare const languageQualifierTypeConfig: ObjectConverter<Model_2.ILanguageQualifierTypeConfig, unknown>;
5178
5603
 
5179
5604
  /**
5180
5605
  * A {@link QualifierTypes.QualifierType | qualifier} that matches a literal value,
@@ -5262,7 +5687,7 @@ declare class LiteralQualifierType extends QualifierType {
5262
5687
  * @returns A `Converter` for {@link QualifierTypes.Config.ILiteralQualifierTypeConfig | LiteralQualifierTypeConfig} objects.
5263
5688
  * @public
5264
5689
  */
5265
- declare const literalQualifierTypeConfig: ObjectConverter<Model_3.ILiteralQualifierTypeConfig, unknown>;
5690
+ declare const literalQualifierTypeConfig: ObjectConverter<Model_2.ILiteralQualifierTypeConfig, unknown>;
5266
5691
 
5267
5692
  /**
5268
5693
  * A class that implements a hierarchy of literal values. The hierarchy is defined as a
@@ -5515,29 +5940,12 @@ declare function mergeLooseResource(resource: Normalized.IImporterResourceDecl,
5515
5940
  export declare const MinConditionPriority: ConditionPriority;
5516
5941
 
5517
5942
  declare namespace Model {
5518
- export {
5519
- ICompiledConditionMetadata,
5520
- ICompiledConditionSetMetadata,
5521
- ICompiledDecisionMetadata,
5522
- ICompiledQualifierType,
5523
- ICompiledQualifier,
5524
- ICompiledResourceType,
5525
- ICompiledCondition,
5526
- ICompiledConditionSet,
5527
- ICompiledAbstractDecision,
5528
- ICompiledCandidate,
5529
- ICompiledResource,
5530
- ICompiledResourceCollection
5531
- }
5532
- }
5533
-
5534
- declare namespace Model_2 {
5535
5943
  export {
5536
5944
  ISystemConfiguration
5537
5945
  }
5538
5946
  }
5539
5947
 
5540
- declare namespace Model_3 {
5948
+ declare namespace Model_2 {
5541
5949
  export {
5542
5950
  IQualifierTypeConfig,
5543
5951
  ILanguageQualifierTypeConfig,
@@ -5550,6 +5958,23 @@ declare namespace Model_3 {
5550
5958
  }
5551
5959
  }
5552
5960
 
5961
+ declare namespace Model_3 {
5962
+ export {
5963
+ ICompiledConditionMetadata,
5964
+ ICompiledConditionSetMetadata,
5965
+ ICompiledDecisionMetadata,
5966
+ ICompiledQualifierType,
5967
+ ICompiledQualifier,
5968
+ ICompiledResourceType,
5969
+ ICompiledCondition,
5970
+ ICompiledConditionSet,
5971
+ ICompiledAbstractDecision,
5972
+ ICompiledCandidate,
5973
+ ICompiledResource,
5974
+ ICompiledResourceCollection
5975
+ }
5976
+ }
5977
+
5553
5978
  /**
5554
5979
  * {@link QualifierMatchScore | Match score} indicating no match.
5555
5980
  * @public
@@ -6063,7 +6488,7 @@ declare const qualifierName: Converter<QualifierName, unknown>;
6063
6488
 
6064
6489
  declare namespace Qualifiers {
6065
6490
  export {
6066
- Convert_8 as Convert,
6491
+ Convert_4 as Convert,
6067
6492
  Qualifier,
6068
6493
  IQualifierDecl,
6069
6494
  IValidatedQualifierDecl,
@@ -6240,7 +6665,7 @@ declare const qualifierTypeName: Converter<QualifierTypeName, unknown>;
6240
6665
  declare namespace QualifierTypes {
6241
6666
  export {
6242
6667
  Config_2 as Config,
6243
- Convert_7 as Convert,
6668
+ Convert_3 as Convert,
6244
6669
  IQualifierType,
6245
6670
  IQualifierTypeCreateParams,
6246
6671
  QualifierType,
@@ -6880,7 +7305,7 @@ declare const resourceIndex: Converter<ResourceIndex, unknown>;
6880
7305
  declare namespace ResourceJson {
6881
7306
  export {
6882
7307
  Compiled,
6883
- Convert_4 as Convert,
7308
+ Convert_8 as Convert,
6884
7309
  Helpers_2 as Helpers,
6885
7310
  Json,
6886
7311
  Normalized,
@@ -6981,6 +7406,20 @@ export declare class ResourceManagerBuilder implements IResourceManager {
6981
7406
  */
6982
7407
  addLooseCandidate(decl: ResourceJson.Json.ILooseResourceCandidateDecl): DetailedResult<ResourceCandidate, ResourceBuilderResultDetail>;
6983
7408
  addResource(decl: ResourceJson.Json.ILooseResourceDecl): DetailedResult<ResourceBuilder, ResourceBuilderResultDetail>;
7409
+ /**
7410
+ * Adds a condition to the manager.
7411
+ * @param decl - The condition declaration to add.
7412
+ * @returns `Success` with the condition if successful, or `Failure` with an error message if not.
7413
+ * @public
7414
+ */
7415
+ addCondition(decl: ResourceJson.Json.ILooseConditionDecl): Result<Condition>;
7416
+ /**
7417
+ * Adds a condition set to the manager.
7418
+ * @param decl - The condition set declaration to add.
7419
+ * @returns `Success` with the condition set if successful, or `Failure` with an error message if not.
7420
+ * @public
7421
+ */
7422
+ addConditionSet(conditions: ResourceJson.Normalized.ConditionSetDecl): Result<ConditionSet>;
6984
7423
  /**
6985
7424
  * Gets a read-only array of all {@link Resources.ResourceBuilder | resource builders} present in the manager.
6986
7425
  * @returns `Success` with the {@link Resources.ResourceBuilder | resource builder} if successful,
@@ -7168,6 +7607,10 @@ export declare class ResourceResolver {
7168
7607
  * The context qualifier provider that resolves qualifier values.
7169
7608
  */
7170
7609
  readonly contextQualifierProvider: IContextQualifierProvider;
7610
+ /**
7611
+ * The configuration options for this resource resolver.
7612
+ */
7613
+ readonly options: IResourceResolverOptions;
7171
7614
  /**
7172
7615
  * The cache array for resolved conditions, indexed by condition index for O(1) lookup.
7173
7616
  * Each entry stores the resolved {@link Runtime.IConditionMatchResult | condition match result} for
@@ -7672,6 +8115,7 @@ declare namespace Runtime {
7672
8115
  IValidatingSimpleContextQualifierProviderCreateParams,
7673
8116
  ValidatingSimpleContextQualifierProvider,
7674
8117
  DecisionResolutionResult,
8118
+ IResourceResolverOptions,
7675
8119
  IResourceResolverCreateParams,
7676
8120
  ResourceResolver,
7677
8121
  ConditionMatchType,
@@ -7863,28 +8307,28 @@ declare const systemConfiguration: ObjectConverter<ISystemConfiguration, unknown
7863
8307
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLanguageQualifierTypeConfig | SystemLanguageQualifierTypeConfig} objects.
7864
8308
  * @public
7865
8309
  */
7866
- declare const systemLanguageQualifierTypeConfig: ObjectConverter<Model_3.ISystemLanguageQualifierTypeConfig, unknown>;
8310
+ declare const systemLanguageQualifierTypeConfig: ObjectConverter<Model_2.ISystemLanguageQualifierTypeConfig, unknown>;
7867
8311
 
7868
8312
  /**
7869
8313
  * A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
7870
8314
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemLiteralQualifierTypeConfig | SystemLiteralQualifierTypeConfig} objects.
7871
8315
  * @public
7872
8316
  */
7873
- declare const systemLiteralQualifierTypeConfig: ObjectConverter<Model_3.ISystemLiteralQualifierTypeConfig, unknown>;
8317
+ declare const systemLiteralQualifierTypeConfig: ObjectConverter<Model_2.ISystemLiteralQualifierTypeConfig, unknown>;
7874
8318
 
7875
8319
  /**
7876
8320
  * A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
7877
8321
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemQualifierTypeConfig | SystemQualifierTypeConfig} objects.
7878
8322
  * @public
7879
8323
  */
7880
- declare const systemQualifierTypeConfig: Converter<Model_3.ISystemQualifierTypeConfig, unknown>;
8324
+ declare const systemQualifierTypeConfig: Converter<Model_2.ISystemQualifierTypeConfig, unknown>;
7881
8325
 
7882
8326
  /**
7883
8327
  * A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
7884
8328
  * @returns A `Converter` for {@link QualifierTypes.Config.ISystemTerritoryQualifierTypeConfig | SystemTerritoryQualifierTypeConfig} objects.
7885
8329
  * @public
7886
8330
  */
7887
- declare const systemTerritoryQualifierTypeConfig: ObjectConverter<Model_3.ISystemTerritoryQualifierTypeConfig, unknown>;
8331
+ declare const systemTerritoryQualifierTypeConfig: ObjectConverter<Model_2.ISystemTerritoryQualifierTypeConfig, unknown>;
7888
8332
 
7889
8333
  /**
7890
8334
  * @internal
@@ -7987,7 +8431,7 @@ declare class TerritoryQualifierType extends QualifierType {
7987
8431
  * @returns A `Converter` for {@link QualifierTypes.Config.ITerritoryQualifierTypeConfig | TerritoryQualifierTypeConfig} objects.
7988
8432
  * @public
7989
8433
  */
7990
- declare const territoryQualifierTypeConfig: ObjectConverter<Model_3.ITerritoryQualifierTypeConfig, unknown>;
8434
+ declare const territoryQualifierTypeConfig: ObjectConverter<Model_2.ITerritoryQualifierTypeConfig, unknown>;
7991
8435
 
7992
8436
  /**
7993
8437
  * Converts a number to a {@link ConditionIndex} if it is a valid condition index.