@adeficior/data-modifier 2.0.0-rc.1 → 2.0.0-rc.20260814115618
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/builtinModules.d.ts +2 -0
- package/dist/builtinModules.js +9 -0
- package/dist/builtinModules.js.map +1 -0
- package/dist/cli/codegen/registry.d.ts +3 -3
- package/dist/cli/codegen/registry.js +34 -44
- package/dist/cli/codegen/registry.js.map +1 -1
- package/dist/cli/config.d.ts +3 -3
- package/dist/cli/config.js +4 -3
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/index.d.ts +2 -1
- package/dist/cli/index.js +15 -27
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/run.d.ts +1 -0
- package/dist/cli/run.js +17 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -0
- package/dist/common/class.d.ts +4 -0
- package/dist/common/class.js +1 -0
- package/dist/common/class.js.map +1 -0
- package/dist/common/context.d.ts +2 -0
- package/dist/common/context.js +1 -0
- package/dist/common/context.js.map +1 -0
- package/dist/{error.d.ts → common/error.d.ts} +5 -3
- package/dist/common/error.js +62 -0
- package/dist/common/error.js.map +1 -0
- package/dist/common/id.d.ts +3 -1
- package/dist/common/id.js +8 -6
- package/dist/common/id.js.map +1 -1
- package/dist/common/index.d.ts +8 -0
- package/dist/common/index.js +6 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/packFormat.d.ts +13 -0
- package/dist/common/packFormat.js +65 -0
- package/dist/common/packFormat.js.map +1 -0
- package/dist/common/registry.d.ts +8 -2
- package/dist/common/registry.js +14 -2
- package/dist/common/registry.js.map +1 -1
- package/dist/common/registryProvider.d.ts +5 -0
- package/dist/common/registryProvider.js +1 -0
- package/dist/common/registryProvider.js.map +1 -0
- package/dist/common/textHelper.d.ts +5 -0
- package/dist/common/textHelper.js +25 -0
- package/dist/common/textHelper.js.map +1 -0
- package/dist/emit/abstract.d.ts +7 -0
- package/dist/emit/abstract.js +1 -0
- package/dist/emit/abstract.js.map +1 -0
- package/dist/emit/assets/blockstates.d.ts +6 -6
- package/dist/emit/assets/blockstates.js +5 -5
- package/dist/emit/assets/blockstates.js.map +1 -1
- package/dist/emit/assets/lang.d.ts +6 -7
- package/dist/emit/assets/lang.js +37 -35
- package/dist/emit/assets/lang.js.map +1 -1
- package/dist/emit/assets/models.d.ts +7 -7
- package/dist/emit/assets/models.js +9 -9
- package/dist/emit/assets/models.js.map +1 -1
- package/dist/emit/blacklist.d.ts +12 -15
- package/dist/emit/blacklist.js +39 -48
- package/dist/emit/blacklist.js.map +1 -1
- package/dist/emit/content/blockDefinition.d.ts +9 -9
- package/dist/emit/content/blockDefinition.js +4 -4
- package/dist/emit/content/blockDefinition.js.map +1 -1
- package/dist/emit/content/innerBlockDefinition.d.ts +6 -6
- package/dist/emit/content/innerBlockDefinition.js +2 -2
- package/dist/emit/content/innerBlockDefinition.js.map +1 -1
- package/dist/emit/content/itemDefinition.d.ts +14 -14
- package/dist/emit/content/itemDefinition.js +6 -6
- package/dist/emit/content/itemDefinition.js.map +1 -1
- package/dist/emit/custom.d.ts +4 -5
- package/dist/emit/custom.js +10 -9
- package/dist/emit/custom.js.map +1 -1
- package/dist/emit/data/loot.d.ts +19 -22
- package/dist/emit/data/loot.js +28 -31
- package/dist/emit/data/loot.js.map +1 -1
- package/dist/emit/data/recipe.d.ts +28 -27
- package/dist/emit/data/recipe.js +66 -48
- package/dist/emit/data/recipe.js.map +1 -1
- package/dist/emit/data/tags.d.ts +18 -13
- package/dist/emit/data/tags.js +32 -20
- package/dist/emit/data/tags.js.map +1 -1
- package/dist/emit/index.d.ts +12 -11
- package/dist/emit/index.js +6 -0
- package/dist/emit/index.js.map +1 -1
- package/dist/emit/packMetadata.d.ts +16 -0
- package/dist/emit/packMetadata.js +20 -0
- package/dist/emit/packMetadata.js.map +1 -0
- package/dist/emit/polytoneTabs.d.ts +5 -8
- package/dist/emit/polytoneTabs.js +10 -8
- package/dist/emit/polytoneTabs.js.map +1 -1
- package/dist/emit/recipeGraph.d.ts +26 -0
- package/dist/emit/recipeGraph.js +201 -0
- package/dist/emit/recipeGraph.js.map +1 -0
- package/dist/emit/rule/index.d.ts +2 -2
- package/dist/emit/rule/index.js +1 -1
- package/dist/emit/rule/index.js.map +1 -1
- package/dist/emit/rule/lootTable.d.ts +10 -9
- package/dist/emit/rule/lootTable.js +18 -18
- package/dist/emit/rule/lootTable.js.map +1 -1
- package/dist/emit/rule/recipe.d.ts +10 -10
- package/dist/emit/rule/recipe.js +11 -12
- package/dist/emit/rule/recipe.js.map +1 -1
- package/dist/emit/ruled.d.ts +8 -8
- package/dist/emit/ruled.js +27 -21
- package/dist/emit/ruled.js.map +1 -1
- package/dist/index.d.ts +1 -31
- package/dist/index.js +4 -11
- package/dist/index.js.map +1 -1
- package/dist/installTarget.d.ts +15 -0
- package/dist/installTarget.js +99 -0
- package/dist/installTarget.js.map +1 -0
- package/dist/instance.d.ts +16 -0
- package/dist/instance.js +52 -0
- package/dist/instance.js.map +1 -0
- package/dist/io/fields.d.ts +4 -0
- package/dist/io/fields.js +5 -0
- package/dist/io/fields.js.map +1 -0
- package/dist/io/filters.d.ts +7 -0
- package/dist/io/filters.js +32 -0
- package/dist/io/filters.js.map +1 -0
- package/dist/io/index.d.ts +7 -0
- package/dist/io/index.js +7 -0
- package/dist/io/index.js.map +1 -0
- package/dist/io/ingredient/filter.d.ts +6 -0
- package/dist/io/ingredient/filter.js +40 -0
- package/dist/io/ingredient/filter.js.map +1 -0
- package/dist/io/ingredient/impl.d.ts +75 -0
- package/dist/io/ingredient/impl.js +150 -0
- package/dist/io/ingredient/impl.js.map +1 -0
- package/dist/io/ingredient/index.d.ts +3 -0
- package/dist/io/ingredient/index.js +3 -0
- package/dist/io/ingredient/index.js.map +1 -0
- package/dist/io/ingredient/input.d.ts +3 -0
- package/dist/io/ingredient/input.js +1 -0
- package/dist/io/ingredient/input.js.map +1 -0
- package/dist/io/replacer.d.ts +3 -0
- package/dist/io/replacer.js +8 -0
- package/dist/io/replacer.js.map +1 -0
- package/dist/io/result/filter.d.ts +5 -0
- package/dist/io/result/filter.js +10 -0
- package/dist/io/result/filter.js.map +1 -0
- package/dist/io/result/impl.d.ts +41 -0
- package/dist/io/result/impl.js +73 -0
- package/dist/io/result/impl.js.map +1 -0
- package/dist/io/result/index.d.ts +3 -0
- package/dist/io/result/index.js +3 -0
- package/dist/io/result/index.js.map +1 -0
- package/dist/io/result/input.d.ts +3 -0
- package/dist/io/result/input.js +1 -0
- package/dist/io/result/input.js.map +1 -0
- package/dist/io/subject.d.ts +8 -0
- package/dist/io/subject.js +1 -0
- package/dist/io/subject.js.map +1 -0
- package/dist/io/units.d.ts +1 -0
- package/dist/io/units.js +2 -0
- package/dist/io/units.js.map +1 -0
- package/dist/loader/abstract.d.ts +3 -0
- package/dist/loader/abstract.js +1 -0
- package/dist/loader/abstract.js.map +1 -0
- package/dist/loader/context.d.ts +12 -0
- package/dist/loader/context.js +1 -0
- package/dist/loader/context.js.map +1 -0
- package/dist/loader/index.d.ts +6 -16
- package/dist/loader/index.js +4 -39
- package/dist/loader/index.js.map +1 -1
- package/dist/loader/json.d.ts +11 -0
- package/dist/loader/json.js +29 -0
- package/dist/loader/json.js.map +1 -0
- package/dist/loader/lang.d.ts +5 -6
- package/dist/loader/lang.js +5 -5
- package/dist/loader/lang.js.map +1 -1
- package/dist/loader/loot.d.ts +4 -6
- package/dist/loader/loot.js +5 -9
- package/dist/loader/loot.js.map +1 -1
- package/dist/loader/pack.d.ts +40 -34
- package/dist/loader/pack.js +84 -73
- package/dist/loader/pack.js.map +1 -1
- package/dist/loader/recipe.d.ts +17 -13
- package/dist/loader/recipe.js +47 -100
- package/dist/loader/recipe.js.map +1 -1
- package/dist/loader/registry/dump.d.ts +6 -10
- package/dist/loader/registry/dump.js +9 -33
- package/dist/loader/registry/dump.js.map +1 -1
- package/dist/loader/registry/empty.d.ts +3 -3
- package/dist/loader/registry/empty.js +2 -2
- package/dist/loader/registry/empty.js.map +1 -1
- package/dist/loader/registry/index.d.ts +4 -11
- package/dist/loader/registry/index.js +3 -0
- package/dist/loader/registry/index.js.map +1 -1
- package/dist/loader/registry/lookup.d.ts +9 -0
- package/dist/loader/registry/lookup.js +1 -0
- package/dist/loader/registry/lookup.js.map +1 -0
- package/dist/loader/registry/wrapped.d.ts +13 -0
- package/dist/loader/registry/wrapped.js +26 -0
- package/dist/loader/registry/wrapped.js.map +1 -0
- package/dist/loader/tags.d.ts +7 -9
- package/dist/loader/tags.js +25 -28
- package/dist/loader/tags.js.map +1 -1
- package/dist/module.d.ts +2 -0
- package/dist/module.js +13 -0
- package/dist/module.js.map +1 -0
- package/dist/parser/lootTable.d.ts +7 -7
- package/dist/parser/lootTable.js +25 -24
- package/dist/parser/lootTable.js.map +1 -1
- package/dist/schema/content/itemDefinition.d.ts +1 -1
- package/dist/schema/data/loot.d.ts +126 -1065
- package/dist/schema/data/loot.js +8 -2
- package/dist/schema/data/loot.js.map +1 -1
- package/dist/schema/data/recipe.d.ts +2 -1
- package/dist/schema/data/tag.d.ts +1 -1
- package/dist/schema/data/tag.js +1 -1
- package/dist/schema/data/tag.js.map +1 -1
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/serializer/abstract.d.ts +23 -0
- package/dist/serializer/abstract.js +19 -0
- package/dist/serializer/abstract.js.map +1 -0
- package/dist/serializer/checks.d.ts +2 -0
- package/dist/serializer/checks.js +13 -0
- package/dist/serializer/checks.js.map +1 -0
- package/dist/serializer/index.d.ts +4 -0
- package/dist/serializer/index.js +5 -0
- package/dist/serializer/index.js.map +1 -0
- package/dist/serializer/ingredientMap.d.ts +8 -0
- package/dist/serializer/ingredientMap.js +14 -0
- package/dist/serializer/ingredientMap.js.map +1 -0
- package/dist/serializer/ingredients/15.d.ts +2 -0
- package/dist/serializer/ingredients/15.js +39 -0
- package/dist/serializer/ingredients/15.js.map +1 -0
- package/dist/serializer/ingredients/44.d.ts +2 -0
- package/dist/serializer/ingredients/44.js +46 -0
- package/dist/serializer/ingredients/44.js.map +1 -0
- package/dist/serializer/ingredients/common.d.ts +3 -0
- package/dist/serializer/ingredients/common.js +14 -0
- package/dist/serializer/ingredients/common.js.map +1 -0
- package/dist/serializer/ingredients/index.d.ts +20 -0
- package/dist/serializer/ingredients/index.js +36 -0
- package/dist/serializer/ingredients/index.js.map +1 -0
- package/dist/serializer/module.d.ts +21 -0
- package/dist/serializer/module.js +42 -0
- package/dist/serializer/module.js.map +1 -0
- package/dist/serializer/recipe/abstract.d.ts +18 -0
- package/dist/serializer/recipe/abstract.js +15 -0
- package/dist/serializer/recipe/abstract.js.map +1 -0
- package/dist/serializer/recipe/adAstra/conversion.d.ts +18 -0
- package/dist/serializer/recipe/adAstra/conversion.js +38 -0
- package/dist/serializer/recipe/adAstra/conversion.js.map +1 -0
- package/dist/serializer/recipe/adAstra/hammering.d.ts +4 -0
- package/dist/serializer/recipe/adAstra/hammering.js +4 -0
- package/dist/serializer/recipe/adAstra/hammering.js.map +1 -0
- package/dist/serializer/recipe/adAstra/inputOutput.d.ts +18 -0
- package/dist/serializer/recipe/adAstra/inputOutput.js +50 -0
- package/dist/serializer/recipe/adAstra/inputOutput.js.map +1 -0
- package/dist/serializer/recipe/adAstra/nasaWorkbench.d.ts +4 -0
- package/dist/serializer/recipe/adAstra/nasaWorkbench.js +4 -0
- package/dist/serializer/recipe/adAstra/nasaWorkbench.js.map +1 -0
- package/dist/serializer/recipe/adAstra/spaceStation.d.ts +18 -0
- package/dist/serializer/recipe/adAstra/spaceStation.js +46 -0
- package/dist/serializer/recipe/adAstra/spaceStation.js.map +1 -0
- package/dist/serializer/recipe/botania/apothecary.d.ts +21 -0
- package/dist/serializer/recipe/botania/apothecary.js +39 -0
- package/dist/serializer/recipe/botania/apothecary.js.map +1 -0
- package/dist/serializer/recipe/botania/blocks.d.ts +24 -0
- package/dist/serializer/recipe/botania/blocks.js +50 -0
- package/dist/serializer/recipe/botania/blocks.js.map +1 -0
- package/dist/serializer/recipe/botania/brew.d.ts +18 -0
- package/dist/serializer/recipe/botania/brew.js +31 -0
- package/dist/serializer/recipe/botania/brew.js.map +1 -0
- package/dist/serializer/recipe/botania/elvenTrade.d.ts +12 -0
- package/dist/serializer/recipe/botania/elvenTrade.js +15 -0
- package/dist/serializer/recipe/botania/elvenTrade.js.map +1 -0
- package/dist/serializer/recipe/botania/gogWrapper.d.ts +19 -0
- package/dist/serializer/recipe/botania/gogWrapper.js +34 -0
- package/dist/serializer/recipe/botania/gogWrapper.js.map +1 -0
- package/dist/serializer/recipe/botania/manaInfusion.d.ts +25 -0
- package/dist/serializer/recipe/botania/manaInfusion.js +44 -0
- package/dist/serializer/recipe/botania/manaInfusion.js.map +1 -0
- package/dist/serializer/recipe/botania/nbtWrapper.d.ts +17 -0
- package/dist/serializer/recipe/botania/nbtWrapper.js +30 -0
- package/dist/serializer/recipe/botania/nbtWrapper.js.map +1 -0
- package/dist/serializer/recipe/botania/orechid.d.ts +8 -0
- package/dist/serializer/recipe/botania/orechid.js +4 -0
- package/dist/serializer/recipe/botania/orechid.js.map +1 -0
- package/dist/serializer/recipe/botania/pureDaisy.d.ts +8 -0
- package/dist/serializer/recipe/botania/pureDaisy.js +16 -0
- package/dist/serializer/recipe/botania/pureDaisy.js.map +1 -0
- package/dist/serializer/recipe/botania/runicAltar.d.ts +12 -0
- package/dist/serializer/recipe/botania/runicAltar.js +15 -0
- package/dist/serializer/recipe/botania/runicAltar.js.map +1 -0
- package/dist/serializer/recipe/botania/terraPlate.d.ts +6 -0
- package/dist/serializer/recipe/botania/terraPlate.js +4 -0
- package/dist/serializer/recipe/botania/terraPlate.js.map +1 -0
- package/dist/serializer/recipe/context.d.ts +10 -0
- package/dist/serializer/recipe/context.js +1 -0
- package/dist/serializer/recipe/context.js.map +1 -0
- package/dist/serializer/recipe/create/assembly.d.ts +25 -0
- package/dist/serializer/recipe/create/assembly.js +50 -0
- package/dist/serializer/recipe/create/assembly.js.map +1 -0
- package/dist/serializer/recipe/create/processing.d.ts +8 -0
- package/dist/serializer/recipe/create/processing.js +4 -0
- package/dist/serializer/recipe/create/processing.js.map +1 -0
- package/dist/serializer/recipe/farmersdelight/cooking.d.ts +24 -0
- package/dist/serializer/recipe/farmersdelight/cooking.js +40 -0
- package/dist/serializer/recipe/farmersdelight/cooking.js.map +1 -0
- package/dist/serializer/recipe/farmersdelight/cutting.d.ts +21 -0
- package/dist/serializer/recipe/farmersdelight/cutting.js +42 -0
- package/dist/serializer/recipe/farmersdelight/cutting.js.map +1 -0
- package/dist/serializer/recipe/forge/conditional.d.ts +22 -0
- package/dist/serializer/recipe/forge/conditional.js +42 -0
- package/dist/serializer/recipe/forge/conditional.js.map +1 -0
- package/dist/serializer/recipe/holder.d.ts +23 -0
- package/dist/serializer/recipe/holder.js +46 -0
- package/dist/serializer/recipe/holder.js.map +1 -0
- package/dist/serializer/recipe/index.d.ts +34 -0
- package/dist/serializer/recipe/index.js +34 -0
- package/dist/serializer/recipe/index.js.map +1 -0
- package/dist/serializer/recipe/manyToMany.d.ts +21 -0
- package/dist/serializer/recipe/manyToMany.js +33 -0
- package/dist/serializer/recipe/manyToMany.js.map +1 -0
- package/dist/serializer/recipe/manyToOne.d.ts +21 -0
- package/dist/serializer/recipe/manyToOne.js +33 -0
- package/dist/serializer/recipe/manyToOne.js.map +1 -0
- package/dist/serializer/recipe/modifier.d.ts +5 -0
- package/dist/serializer/recipe/modifier.js +1 -0
- package/dist/serializer/recipe/modifier.js.map +1 -0
- package/dist/serializer/recipe/oneToOne.d.ts +21 -0
- package/dist/serializer/recipe/oneToOne.js +33 -0
- package/dist/serializer/recipe/oneToOne.js.map +1 -0
- package/dist/serializer/recipe/roots/component.d.ts +17 -0
- package/dist/serializer/recipe/roots/component.js +30 -0
- package/dist/serializer/recipe/roots/component.js.map +1 -0
- package/dist/serializer/recipe/roots/ritual.d.ts +17 -0
- package/dist/serializer/recipe/roots/ritual.js +25 -0
- package/dist/serializer/recipe/roots/ritual.js.map +1 -0
- package/dist/serializer/recipe/sullys/polishing.d.ts +6 -0
- package/dist/serializer/recipe/sullys/polishing.js +4 -0
- package/dist/serializer/recipe/sullys/polishing.js.map +1 -0
- package/dist/serializer/recipe/thermal/catalyst.d.ts +22 -0
- package/dist/serializer/recipe/thermal/catalyst.js +31 -0
- package/dist/serializer/recipe/thermal/catalyst.js.map +1 -0
- package/dist/serializer/recipe/thermal/fuel.d.ts +18 -0
- package/dist/serializer/recipe/thermal/fuel.js +32 -0
- package/dist/serializer/recipe/thermal/fuel.js.map +1 -0
- package/dist/serializer/recipe/thermal/index.d.ts +25 -0
- package/dist/serializer/recipe/thermal/index.js +52 -0
- package/dist/serializer/recipe/thermal/index.js.map +1 -0
- package/dist/serializer/recipe/thermal/module.d.ts +4 -0
- package/dist/serializer/recipe/thermal/module.js +32 -0
- package/dist/serializer/recipe/thermal/module.js.map +1 -0
- package/dist/serializer/recipe/thermal/treeExtraction.d.ts +23 -0
- package/dist/serializer/recipe/thermal/treeExtraction.js +46 -0
- package/dist/serializer/recipe/thermal/treeExtraction.js.map +1 -0
- package/dist/serializer/recipe/vanilla/index.d.ts +5 -0
- package/dist/serializer/recipe/vanilla/index.js +6 -0
- package/dist/serializer/recipe/vanilla/index.js.map +1 -0
- package/dist/serializer/recipe/vanilla/shaped.d.ts +23 -0
- package/dist/serializer/recipe/vanilla/shaped.js +33 -0
- package/dist/serializer/recipe/vanilla/shaped.js.map +1 -0
- package/dist/serializer/recipe/vanilla/shapeless.d.ts +4 -0
- package/dist/serializer/recipe/vanilla/shapeless.js +4 -0
- package/dist/serializer/recipe/vanilla/shapeless.js.map +1 -0
- package/dist/serializer/recipe/vanilla/smelting.d.ts +22 -0
- package/dist/serializer/recipe/vanilla/smelting.js +33 -0
- package/dist/serializer/recipe/vanilla/smelting.js.map +1 -0
- package/dist/serializer/recipe/vanilla/smithing.d.ts +25 -0
- package/dist/serializer/recipe/vanilla/smithing.js +42 -0
- package/dist/serializer/recipe/vanilla/smithing.js.map +1 -0
- package/dist/serializer/recipe/vanilla/stonecutting.d.ts +22 -0
- package/dist/serializer/recipe/vanilla/stonecutting.js +34 -0
- package/dist/serializer/recipe/vanilla/stonecutting.js.map +1 -0
- package/dist/serializer/results/15.d.ts +2 -0
- package/dist/serializer/results/15.js +24 -0
- package/dist/serializer/results/15.js.map +1 -0
- package/dist/serializer/results/44.d.ts +2 -0
- package/dist/serializer/results/44.js +21 -0
- package/dist/serializer/results/44.js.map +1 -0
- package/dist/serializer/results/common.d.ts +3 -0
- package/dist/serializer/results/common.js +7 -0
- package/dist/serializer/results/common.js.map +1 -0
- package/dist/serializer/results/index.d.ts +6 -0
- package/dist/serializer/results/index.js +22 -0
- package/dist/serializer/results/index.js.map +1 -0
- package/dist/serializer/versioned.d.ts +18 -0
- package/dist/serializer/versioned.js +54 -0
- package/dist/serializer/versioned.js.map +1 -0
- package/dist/serializer/wrapped.d.ts +12 -0
- package/dist/serializer/wrapped.js +32 -0
- package/dist/serializer/wrapped.js.map +1 -0
- package/package.json +85 -95
- package/dist/common/ingredient.d.ts +0 -49
- package/dist/common/ingredient.js +0 -108
- package/dist/common/ingredient.js.map +0 -1
- package/dist/common/predicates.d.ts +0 -7
- package/dist/common/predicates.js +0 -32
- package/dist/common/predicates.js.map +0 -1
- package/dist/common/result.d.ts +0 -48
- package/dist/common/result.js +0 -37
- package/dist/common/result.js.map +0 -1
- package/dist/error.js +0 -45
- package/dist/error.js.map +0 -1
- package/dist/parser/adAstra.d.ts +0 -11
- package/dist/parser/adAstra.js +0 -6
- package/dist/parser/adAstra.js.map +0 -1
- package/dist/parser/botania.d.ts +0 -20
- package/dist/parser/botania.js +0 -11
- package/dist/parser/botania.js.map +0 -1
- package/dist/parser/create.d.ts +0 -4
- package/dist/parser/create.js +0 -3
- package/dist/parser/create.js.map +0 -1
- package/dist/parser/farmersdelight.d.ts +0 -4
- package/dist/parser/farmersdelight.js +0 -3
- package/dist/parser/farmersdelight.js.map +0 -1
- package/dist/parser/index.d.ts +0 -13
- package/dist/parser/index.js +0 -8
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/recipe/adAstra/conversion.d.ts +0 -20
- package/dist/parser/recipe/adAstra/conversion.js +0 -33
- package/dist/parser/recipe/adAstra/conversion.js.map +0 -1
- package/dist/parser/recipe/adAstra/hammering.d.ts +0 -18
- package/dist/parser/recipe/adAstra/hammering.js +0 -27
- package/dist/parser/recipe/adAstra/hammering.js.map +0 -1
- package/dist/parser/recipe/adAstra/index.d.ts +0 -5
- package/dist/parser/recipe/adAstra/index.js +0 -1
- package/dist/parser/recipe/adAstra/index.js.map +0 -1
- package/dist/parser/recipe/adAstra/inputOutput.d.ts +0 -24
- package/dist/parser/recipe/adAstra/inputOutput.js +0 -42
- package/dist/parser/recipe/adAstra/inputOutput.js.map +0 -1
- package/dist/parser/recipe/adAstra/nasaWorkbench.d.ts +0 -20
- package/dist/parser/recipe/adAstra/nasaWorkbench.js +0 -30
- package/dist/parser/recipe/adAstra/nasaWorkbench.js.map +0 -1
- package/dist/parser/recipe/adAstra/spaceStation.d.ts +0 -19
- package/dist/parser/recipe/adAstra/spaceStation.js +0 -27
- package/dist/parser/recipe/adAstra/spaceStation.js.map +0 -1
- package/dist/parser/recipe/botania/apothecary.d.ts +0 -19
- package/dist/parser/recipe/botania/apothecary.js +0 -28
- package/dist/parser/recipe/botania/apothecary.js.map +0 -1
- package/dist/parser/recipe/botania/brew.d.ts +0 -18
- package/dist/parser/recipe/botania/brew.js +0 -24
- package/dist/parser/recipe/botania/brew.js.map +0 -1
- package/dist/parser/recipe/botania/elvenTrade.d.ts +0 -19
- package/dist/parser/recipe/botania/elvenTrade.js +0 -27
- package/dist/parser/recipe/botania/elvenTrade.js.map +0 -1
- package/dist/parser/recipe/botania/gogWrapper.d.ts +0 -22
- package/dist/parser/recipe/botania/gogWrapper.js +0 -34
- package/dist/parser/recipe/botania/gogWrapper.js.map +0 -1
- package/dist/parser/recipe/botania/manaInfusion.d.ts +0 -21
- package/dist/parser/recipe/botania/manaInfusion.js +0 -33
- package/dist/parser/recipe/botania/manaInfusion.js.map +0 -1
- package/dist/parser/recipe/botania/nbtWrapper.d.ts +0 -20
- package/dist/parser/recipe/botania/nbtWrapper.js +0 -30
- package/dist/parser/recipe/botania/nbtWrapper.js.map +0 -1
- package/dist/parser/recipe/botania/orechid.d.ts +0 -35
- package/dist/parser/recipe/botania/orechid.js +0 -74
- package/dist/parser/recipe/botania/orechid.js.map +0 -1
- package/dist/parser/recipe/botania/pureDaisy.d.ts +0 -19
- package/dist/parser/recipe/botania/pureDaisy.js +0 -30
- package/dist/parser/recipe/botania/pureDaisy.js.map +0 -1
- package/dist/parser/recipe/botania/runicAltar.d.ts +0 -19
- package/dist/parser/recipe/botania/runicAltar.js +0 -27
- package/dist/parser/recipe/botania/runicAltar.js.map +0 -1
- package/dist/parser/recipe/botania/terraPlate.d.ts +0 -19
- package/dist/parser/recipe/botania/terraPlate.js +0 -27
- package/dist/parser/recipe/botania/terraPlate.js.map +0 -1
- package/dist/parser/recipe/create/assembly.d.ts +0 -25
- package/dist/parser/recipe/create/assembly.js +0 -45
- package/dist/parser/recipe/create/assembly.js.map +0 -1
- package/dist/parser/recipe/create/processing.d.ts +0 -21
- package/dist/parser/recipe/create/processing.js +0 -27
- package/dist/parser/recipe/create/processing.js.map +0 -1
- package/dist/parser/recipe/farmersdelight/cooking.d.ts +0 -22
- package/dist/parser/recipe/farmersdelight/cooking.js +0 -29
- package/dist/parser/recipe/farmersdelight/cooking.js.map +0 -1
- package/dist/parser/recipe/farmersdelight/cutting.d.ts +0 -23
- package/dist/parser/recipe/farmersdelight/cutting.js +0 -38
- package/dist/parser/recipe/farmersdelight/cutting.js.map +0 -1
- package/dist/parser/recipe/forge/conditional.d.ts +0 -25
- package/dist/parser/recipe/forge/conditional.js +0 -45
- package/dist/parser/recipe/forge/conditional.js.map +0 -1
- package/dist/parser/recipe/ignored.d.ts +0 -10
- package/dist/parser/recipe/ignored.js +0 -16
- package/dist/parser/recipe/ignored.js.map +0 -1
- package/dist/parser/recipe/index.d.ts +0 -19
- package/dist/parser/recipe/index.js +0 -22
- package/dist/parser/recipe/index.js.map +0 -1
- package/dist/parser/recipe/quark/exclusion.d.ts +0 -20
- package/dist/parser/recipe/quark/exclusion.js +0 -32
- package/dist/parser/recipe/quark/exclusion.js.map +0 -1
- package/dist/parser/recipe/roots/component.d.ts +0 -18
- package/dist/parser/recipe/roots/component.js +0 -24
- package/dist/parser/recipe/roots/component.js.map +0 -1
- package/dist/parser/recipe/roots/ritual.d.ts +0 -22
- package/dist/parser/recipe/roots/ritual.js +0 -32
- package/dist/parser/recipe/roots/ritual.js.map +0 -1
- package/dist/parser/recipe/sullys/polishing.d.ts +0 -19
- package/dist/parser/recipe/sullys/polishing.js +0 -27
- package/dist/parser/recipe/sullys/polishing.js.map +0 -1
- package/dist/parser/recipe/thermal/catalyst.d.ts +0 -22
- package/dist/parser/recipe/thermal/catalyst.js +0 -24
- package/dist/parser/recipe/thermal/catalyst.js.map +0 -1
- package/dist/parser/recipe/thermal/fuel.d.ts +0 -18
- package/dist/parser/recipe/thermal/fuel.js +0 -24
- package/dist/parser/recipe/thermal/fuel.js.map +0 -1
- package/dist/parser/recipe/thermal/index.d.ts +0 -22
- package/dist/parser/recipe/thermal/index.js +0 -36
- package/dist/parser/recipe/thermal/index.js.map +0 -1
- package/dist/parser/recipe/thermal/ingredient.d.ts +0 -21
- package/dist/parser/recipe/thermal/ingredient.js +0 -43
- package/dist/parser/recipe/thermal/ingredient.js.map +0 -1
- package/dist/parser/recipe/thermal/treeExtraction.d.ts +0 -24
- package/dist/parser/recipe/thermal/treeExtraction.js +0 -47
- package/dist/parser/recipe/thermal/treeExtraction.js.map +0 -1
- package/dist/parser/recipe/vanilla/shaped.d.ts +0 -19
- package/dist/parser/recipe/vanilla/shaped.js +0 -28
- package/dist/parser/recipe/vanilla/shaped.js.map +0 -1
- package/dist/parser/recipe/vanilla/shapeless.d.ts +0 -18
- package/dist/parser/recipe/vanilla/shapeless.js +0 -27
- package/dist/parser/recipe/vanilla/shapeless.js.map +0 -1
- package/dist/parser/recipe/vanilla/smelting.d.ts +0 -19
- package/dist/parser/recipe/vanilla/smelting.js +0 -27
- package/dist/parser/recipe/vanilla/smelting.js.map +0 -1
- package/dist/parser/recipe/vanilla/smithing.d.ts +0 -19
- package/dist/parser/recipe/vanilla/smithing.js +0 -28
- package/dist/parser/recipe/vanilla/smithing.js.map +0 -1
- package/dist/parser/recipe/vanilla/stonecutting.d.ts +0 -20
- package/dist/parser/recipe/vanilla/stonecutting.js +0 -36
- package/dist/parser/recipe/vanilla/stonecutting.js.map +0 -1
- package/dist/parser/roots.d.ts +0 -4
- package/dist/parser/roots.js +0 -3
- package/dist/parser/roots.js.map +0 -1
- package/dist/parser/thermal.d.ts +0 -10
- package/dist/parser/thermal.js +0 -6
- package/dist/parser/thermal.js.map +0 -1
- package/dist/stubTypes.d.ts +0 -7
- package/dist/stubTypes.js +0 -1
- package/dist/stubTypes.js.map +0 -1
- package/dist/textHelper.d.ts +0 -3
- package/dist/textHelper.js +0 -20
- package/dist/textHelper.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { module as core, } from "@adeficior/data-modifier-core";
|
|
2
|
+
import ingredients from "@adeficior/data-modifier-ingredients";
|
|
3
|
+
import loot from "@adeficior/data-modifier-loot";
|
|
4
|
+
import recipes from "@adeficior/data-modifier-recipes";
|
|
5
|
+
import tags from "@adeficior/data-modifier-tags";
|
|
6
|
+
export function builtInModules() {
|
|
7
|
+
return [tags, ingredients, recipes, loot, core];
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=builtinModules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtinModules.js","sourceRoot":"","sources":["../src/builtinModules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,IAAI,IAAI,GAEf,MAAM,+BAA+B,CAAC;AACvC,OAAO,WAAW,MAAM,sCAAsC,CAAC;AAC/D,OAAO,IAAI,MAAM,+BAA+B,CAAC;AACjD,OAAO,OAAO,MAAM,kCAAkC,CAAC;AACvD,OAAO,IAAI,MAAM,+BAA+B,CAAC;AAEjD,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAmB,CAAC;AACpE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type RegistryLookup from "../../loader/registry
|
|
2
|
-
export declare function generateRegistryTypes(lookup: RegistryLookup,
|
|
3
|
-
export declare function generateStubTypes(
|
|
1
|
+
import type { RegistryLookup } from "../../loader/registry";
|
|
2
|
+
export declare function generateRegistryTypes(lookup: RegistryLookup, file: string): Promise<void>;
|
|
3
|
+
export declare function generateStubTypes(file: string): Promise<void>;
|
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { writeFileSync } from "fs";
|
|
2
2
|
import { camelCase } from "lodash-es";
|
|
3
|
-
import { join, resolve } from "path";
|
|
4
3
|
import { format } from "prettier";
|
|
5
|
-
import { createId, encodeId } from "../../common/id
|
|
4
|
+
import { createId, encodeId } from "../../common/id";
|
|
6
5
|
const module = "@adeficior/data-modifier/generated";
|
|
7
6
|
function idType(id) {
|
|
8
7
|
const cased = camelCase(id.path.replaceAll("/", " "));
|
|
9
8
|
return cased.charAt(0).toUpperCase() + cased.substring(1);
|
|
10
9
|
}
|
|
11
10
|
function idTemplate(type, values) {
|
|
12
|
-
return `
|
|
13
|
-
export type ${type}Id = ${values.map((it) => `'${it}'`).join(" | ")}
|
|
11
|
+
return `
|
|
12
|
+
export type ${type}Id = ${values.map((it) => `'${it}'`).join(" | ")}
|
|
14
13
|
`;
|
|
15
14
|
}
|
|
16
15
|
function inferRegistryTemplate(keys) {
|
|
17
16
|
if (keys.length === 0)
|
|
18
17
|
throw new Error("no registry found");
|
|
19
|
-
return `
|
|
20
|
-
export type InferIds<T extends RegistryId> = {
|
|
18
|
+
return `
|
|
19
|
+
export type InferIds<T extends RegistryId> = {
|
|
21
20
|
${keys
|
|
22
21
|
.map((it) => `'${encodeId(it)}': ${idType(createId(it))}Id`)
|
|
23
|
-
.join("\n")}
|
|
24
|
-
}[T]
|
|
22
|
+
.join("\n")}
|
|
23
|
+
}[T]
|
|
25
24
|
`;
|
|
26
25
|
}
|
|
27
26
|
function moduleTemplate(...content) {
|
|
28
|
-
const replaced = `
|
|
29
|
-
declare module '${module}' {
|
|
30
|
-
${content.join("\n\n")}
|
|
27
|
+
const replaced = `
|
|
28
|
+
declare module '${module}' {
|
|
29
|
+
${content.join("\n\n")}
|
|
31
30
|
}`;
|
|
32
31
|
return format(replaced, { parser: "typescript" });
|
|
33
32
|
}
|
|
34
|
-
function
|
|
35
|
-
const dir = resolve(base, "@types", "generated");
|
|
36
|
-
if (!existsSync(dir))
|
|
37
|
-
mkdirSync(dir, { recursive: true });
|
|
38
|
-
return dir;
|
|
39
|
-
}
|
|
40
|
-
export async function generateRegistryTypes(lookup, outputDirectory) {
|
|
41
|
-
const typesDirectory = createTypesDirectory(outputDirectory);
|
|
33
|
+
export async function generateRegistryTypes(lookup, file) {
|
|
42
34
|
const registryBlock = idTemplate("Registry", lookup.registries());
|
|
43
35
|
const inferIdBlock = inferRegistryTemplate(lookup.registries());
|
|
44
36
|
const idBlocks = lookup
|
|
@@ -50,32 +42,30 @@ export async function generateRegistryTypes(lookup, outputDirectory) {
|
|
|
50
42
|
const type = idType(id);
|
|
51
43
|
return idTemplate(type, keys);
|
|
52
44
|
});
|
|
53
|
-
writeFileSync(
|
|
45
|
+
writeFileSync(file, await moduleTemplate(registryBlock, ...idBlocks, inferIdBlock));
|
|
54
46
|
}
|
|
55
|
-
export async function generateStubTypes(
|
|
56
|
-
const typesDirectory = createTypesDirectory(outputDirectory);
|
|
57
|
-
const registryStub = resolve(typesDirectory, "index.d.ts");
|
|
47
|
+
export async function generateStubTypes(file) {
|
|
58
48
|
const stubIdType = "`${string}:${string}`";
|
|
59
|
-
writeFileSync(
|
|
60
|
-
declare module '@adeficior/data-modifier/generated' {
|
|
61
|
-
type StubId = ${stubIdType}
|
|
62
|
-
|
|
63
|
-
export type RegistryId = StubId
|
|
64
|
-
|
|
65
|
-
export type CreativeModeTabId = StubId
|
|
66
|
-
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
|
-
export type InferIds<T extends RegistryId> = StubId
|
|
69
|
-
|
|
70
|
-
export type ItemId = StubId
|
|
71
|
-
|
|
72
|
-
export type BlockId = StubId
|
|
73
|
-
|
|
74
|
-
export type FluidId = StubId
|
|
75
|
-
|
|
76
|
-
export type RecipeSerializerId = StubId
|
|
77
|
-
|
|
78
|
-
export type EntityTypeId = StubId
|
|
49
|
+
writeFileSync(file, await format(`
|
|
50
|
+
declare module '@adeficior/data-modifier/generated' {
|
|
51
|
+
type StubId = ${stubIdType}
|
|
52
|
+
|
|
53
|
+
export type RegistryId = StubId
|
|
54
|
+
|
|
55
|
+
export type CreativeModeTabId = StubId
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
+
export type InferIds<T extends RegistryId> = StubId
|
|
59
|
+
|
|
60
|
+
export type ItemId = StubId
|
|
61
|
+
|
|
62
|
+
export type BlockId = StubId
|
|
63
|
+
|
|
64
|
+
export type FluidId = StubId
|
|
65
|
+
|
|
66
|
+
export type RecipeSerializerId = StubId
|
|
67
|
+
|
|
68
|
+
export type EntityTypeId = StubId
|
|
79
69
|
}`, { parser: "typescript" }));
|
|
80
70
|
}
|
|
81
71
|
//# sourceMappingURL=registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/cli/codegen/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources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help" | "codegen";
|
|
3
|
-
export
|
|
3
|
+
export interface CliConfig {
|
|
4
4
|
resources: string[];
|
|
5
|
-
output
|
|
5
|
+
output: string;
|
|
6
6
|
registryDump?: string;
|
|
7
7
|
action: CliAction;
|
|
8
8
|
}
|
|
9
|
-
export declare function fromArgs(
|
|
9
|
+
export declare function fromArgs(argv?: string[]): CliConfig;
|
|
10
10
|
export declare function printHelp(logger: Logger): void;
|
package/dist/cli/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import parseArgs from "arg";
|
|
2
2
|
import commandLineUsage from "command-line-usage";
|
|
3
|
-
export function fromArgs(
|
|
3
|
+
export function fromArgs(argv = process.argv) {
|
|
4
4
|
const args = parseArgs({
|
|
5
5
|
"--help": Boolean,
|
|
6
6
|
"--resources": [String],
|
|
@@ -8,8 +8,9 @@ export function fromArgs(logger, argv = process.argv) {
|
|
|
8
8
|
"--registry-dump": String,
|
|
9
9
|
"-h": "--help",
|
|
10
10
|
}, { argv, permissive: true });
|
|
11
|
+
const defaultOutput = "@types";
|
|
11
12
|
if (args["--help"]) {
|
|
12
|
-
return { action: "help", resources: [] };
|
|
13
|
+
return { action: "help", resources: [], output: defaultOutput };
|
|
13
14
|
}
|
|
14
15
|
const action = args["--help"] ? "help" : args._[2];
|
|
15
16
|
if (!action)
|
|
@@ -17,7 +18,7 @@ export function fromArgs(logger, argv = process.argv) {
|
|
|
17
18
|
return {
|
|
18
19
|
resources: args["--resources"] ?? [],
|
|
19
20
|
registryDump: args["--registry-dump"],
|
|
20
|
-
output: args["--output"],
|
|
21
|
+
output: args["--output"] ?? defaultOutput,
|
|
21
22
|
action,
|
|
22
23
|
};
|
|
23
24
|
}
|
package/dist/cli/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,KAAK,CAAC;AAC5B,OAAO,gBAAgB,MAAM,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SAC7D;QACD;YACE,MAAM,EAAE,SAAS;YACjB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,WAAW;oBACjB,SAAS,EAAE,aAAa;oBACxB,QAAQ,EAAE,IAAI;oBACd,WAAW,EAAE,+BAA+B;iBAC7C;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,MAAM;oBACjB,WAAW,EAAE,gDAAgD;iBAC9D;gBACD;oBACE,IAAI,EAAE,eAAe;oBACrB,SAAS,EAAE,WAAW;oBACtB,WAAW,EAAE,yCAAyC;iBACvD;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,GAAG;oBACV,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,yBAAyB;iBACvC;aACF;SACF;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type Logger } from "@adeficior/pack-resolver";
|
|
2
|
+
export declare function generateDumpTypes(dumpDir: string | undefined, output: string, logger?: Logger): Promise<void>;
|
package/dist/cli/index.js
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
import { createLogger, createResolver } from "@adeficior/pack-resolver";
|
|
2
|
-
import { existsSync } from "fs";
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
default:
|
|
16
|
-
throw new Error(`unknown action '${config.action}'`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
async function runCodegen(config) {
|
|
20
|
-
if (!config.output)
|
|
21
|
-
throw new Error("output not specified");
|
|
22
|
-
if (config.registryDump && existsSync(config.registryDump)) {
|
|
23
|
-
const resolver = createResolver({ from: config.registryDump });
|
|
24
|
-
const registry = new RegistryDumpLoader(logger);
|
|
25
|
-
await registry.extract(resolver);
|
|
26
|
-
await generateRegistryTypes(registry, config.output);
|
|
1
|
+
import { createLogger, createResolver, } from "@adeficior/pack-resolver";
|
|
2
|
+
import { existsSync, mkdirSync } from "fs";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
import { RegistryDumpLoader } from "../loader/registry/dump";
|
|
5
|
+
import { generateRegistryTypes, generateStubTypes } from "./codegen/registry";
|
|
6
|
+
export async function generateDumpTypes(dumpDir, output, logger = createLogger()) {
|
|
7
|
+
if (!existsSync(output))
|
|
8
|
+
mkdirSync(output, { recursive: true });
|
|
9
|
+
const file = resolve(output, "registry.d.ts");
|
|
10
|
+
if (dumpDir && existsSync(dumpDir)) {
|
|
11
|
+
const resolver = await createResolver({ from: dumpDir, logger });
|
|
12
|
+
const registry = new RegistryDumpLoader();
|
|
13
|
+
await resolver.extract(registry);
|
|
14
|
+
await generateRegistryTypes(registry, file);
|
|
27
15
|
logger.info("successfully generated registry entry types");
|
|
28
16
|
}
|
|
29
17
|
else {
|
|
30
18
|
logger.warn("registry dump missing, generating stub types");
|
|
31
|
-
await generateStubTypes(
|
|
19
|
+
await generateStubTypes(file);
|
|
32
20
|
}
|
|
33
21
|
}
|
|
34
22
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAA2B,EAC3B,MAAc,EACd,MAAM,GAAW,YAAY,EAAE;IAE/B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAE9C,IAAI,OAAO,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAEjE,MAAM,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAC1C,MAAM,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEjC,MAAM,qBAAqB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,6CAA6C,CAAC,CAAC;IAC7D,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAC5D,MAAM,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli/run.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createLogger } from "@adeficior/pack-resolver";
|
|
2
|
+
import { generateDumpTypes } from ".";
|
|
3
|
+
import { fromArgs, printHelp } from "./config";
|
|
4
|
+
const logger = createLogger();
|
|
5
|
+
runCli().catch((e) => logger.error("an error occurred", e));
|
|
6
|
+
async function runCli() {
|
|
7
|
+
const config = fromArgs();
|
|
8
|
+
switch (config.action) {
|
|
9
|
+
case "help":
|
|
10
|
+
return printHelp(logger);
|
|
11
|
+
case "codegen":
|
|
12
|
+
return generateDumpTypes(config.registryDump, config.output, logger);
|
|
13
|
+
default:
|
|
14
|
+
throw new Error(`unknown action '${config.action}'`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAE9B,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5D,KAAK,UAAU,MAAM;IACnB,MAAM,MAAM,GAAG,QAAQ,EAAE,CAAC;IAE1B,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,KAAK,MAAM;YACT,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;QAC3B,KAAK,SAAS;YACZ,OAAO,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEvE;YACE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IACzD,CAAC;AACH,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli.js
ADDED
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,iBAAiB;AAEjB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;AAE9B,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/common/class.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/common/context.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { InferIds, RegistryId } from "@adeficior/data-modifier/generated";
|
|
2
2
|
import type { Logger } from "@adeficior/pack-resolver";
|
|
3
3
|
export declare class IllegalShapeError extends Error {
|
|
4
|
-
readonly input?: unknown
|
|
5
|
-
constructor(message: string, input?: unknown
|
|
4
|
+
readonly input?: unknown;
|
|
5
|
+
constructor(message: string, input?: unknown);
|
|
6
6
|
}
|
|
7
7
|
export declare class UnknownRegistryEntry<T extends RegistryId> extends Error {
|
|
8
8
|
readonly registry: T;
|
|
9
9
|
readonly id: InferIds<T>;
|
|
10
10
|
constructor(message: string, registry: T, id: InferIds<T>);
|
|
11
11
|
}
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function transformError(error: unknown): Error;
|
|
13
|
+
export declare function transformErrors<T>(run: () => T): T;
|
|
14
|
+
export declare function tryCatching<T>(logger: Logger, run: () => T): T | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ZodError } from "zod";
|
|
2
|
+
export class IllegalShapeError extends Error {
|
|
3
|
+
input;
|
|
4
|
+
constructor(message, input) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.input = input;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class UnknownRegistryEntry extends Error {
|
|
10
|
+
registry;
|
|
11
|
+
id;
|
|
12
|
+
constructor(message, registry, id) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.registry = registry;
|
|
15
|
+
this.id = id;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function transformError(error) {
|
|
19
|
+
if (error instanceof ZodError) {
|
|
20
|
+
const message = error.issues
|
|
21
|
+
.map((it) => {
|
|
22
|
+
if (it.path)
|
|
23
|
+
return `${it.path.join(".")}: ${it.message}`;
|
|
24
|
+
else
|
|
25
|
+
return it.message;
|
|
26
|
+
})
|
|
27
|
+
.join(", ");
|
|
28
|
+
return new IllegalShapeError(message);
|
|
29
|
+
}
|
|
30
|
+
if (error instanceof Error)
|
|
31
|
+
return error;
|
|
32
|
+
return new Error("an unknown error occured");
|
|
33
|
+
}
|
|
34
|
+
export function transformErrors(run) {
|
|
35
|
+
try {
|
|
36
|
+
return run();
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
throw transformError(error);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export function tryCatching(logger, run) {
|
|
43
|
+
try {
|
|
44
|
+
return run();
|
|
45
|
+
}
|
|
46
|
+
catch (throwable) {
|
|
47
|
+
const error = transformError(throwable);
|
|
48
|
+
if (error instanceof IllegalShapeError) {
|
|
49
|
+
if (error.input)
|
|
50
|
+
logger.trace(error.message, { input: error.input });
|
|
51
|
+
else
|
|
52
|
+
logger.trace(error.message);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (error instanceof UnknownRegistryEntry) {
|
|
56
|
+
logger.trace(error.message, { id: error.id, registry: error.registry });
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
throw throwable;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../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OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,SAAS,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;YACvC,IAAI,KAAK,CAAC,KAAK;gBAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;;gBAChE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;YAC1C,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,SAAS,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/common/id.d.ts
CHANGED
|
@@ -6,10 +6,12 @@ export type Id = Readonly<{
|
|
|
6
6
|
}>;
|
|
7
7
|
export type IdInput<T extends string = string> = T | Id;
|
|
8
8
|
export type NormalizedId<T extends string = string> = T extends `${string}:${string}` ? T : T extends `#${infer R}` ? `#${string}:${R}` : `${string}:${T}`;
|
|
9
|
+
export type TagId = NormalizedId<`#${string}`>;
|
|
9
10
|
export type TagInput = IdInput<`#${string}`>;
|
|
10
11
|
export declare const IdSchema: zod.ZodString;
|
|
11
|
-
export declare const IdOrTagSchema: zod.ZodString;
|
|
12
12
|
export declare function createId(from: IdInput): Id;
|
|
13
13
|
export declare function encodeId<T extends string>(from: IdInput<T>): NormalizedId<T>;
|
|
14
|
+
export declare function toTag(from: IdInput): TagId;
|
|
15
|
+
export declare function stripTag(from: IdInput): NormalizedId;
|
|
14
16
|
export declare function prefix(id: IdInput, prefix: string): `${string}:${string}`;
|
|
15
17
|
export declare function suffix(id: IdInput, suffix: string): `${string}:${string}`;
|
package/dist/common/id.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
2
|
export const IdSchema = zod
|
|
3
3
|
.string()
|
|
4
|
-
.regex(
|
|
4
|
+
.regex(/^#?([a-z0-9_.-]+:)?[a-z0-9_.-/]+$/i, "ID may only include letters, numbers, dashes and underscores")
|
|
5
|
+
.refine((val) => !val.startsWith("#"), "IDs may not start with a hashtag")
|
|
5
6
|
.describe("Valid ID");
|
|
6
|
-
export const IdOrTagSchema = zod
|
|
7
|
-
.string()
|
|
8
|
-
.regex(/^#?([a-z0-9_.-]+:)?[a-z0-9/._-]+$/i)
|
|
9
|
-
.describe("Valid ID or Tag-ID");
|
|
10
7
|
export function createId(from) {
|
|
11
8
|
if (typeof from !== "string")
|
|
12
9
|
return from;
|
|
@@ -20,7 +17,6 @@ export function createId(from) {
|
|
|
20
17
|
}
|
|
21
18
|
export function encodeId(from) {
|
|
22
19
|
if (typeof from === "string") {
|
|
23
|
-
IdOrTagSchema.parse(from);
|
|
24
20
|
if (from.includes(":"))
|
|
25
21
|
return from;
|
|
26
22
|
if (from.startsWith("#"))
|
|
@@ -31,6 +27,12 @@ export function encodeId(from) {
|
|
|
31
27
|
return `#${from.namespace}:${from.path}`;
|
|
32
28
|
return `${from.namespace}:${from.path}`;
|
|
33
29
|
}
|
|
30
|
+
export function toTag(from) {
|
|
31
|
+
return encodeId({ ...createId(from), isTag: true });
|
|
32
|
+
}
|
|
33
|
+
export function stripTag(from) {
|
|
34
|
+
return encodeId({ ...createId(from), isTag: false });
|
|
35
|
+
}
|
|
34
36
|
export function prefix(id, prefix) {
|
|
35
37
|
const { path, ...rest } = createId(id);
|
|
36
38
|
return encodeId({ ...rest, path: prefix + path });
|
package/dist/common/id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id.js","sourceRoot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|
5
|
+
export * from "./packFormat";
|
|
6
|
+
export * from "./registry";
|
|
7
|
+
export type { RegistryProvider } from "./registryProvider";
|
|
8
|
+
export * from "./textHelper";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAEA,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAE3B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SemVerInput = SemVer | string;
|
|
2
|
+
type SemVer = {
|
|
3
|
+
major: number;
|
|
4
|
+
minor: number;
|
|
5
|
+
patch: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function parseSemVer(input: SemVerInput): SemVer;
|
|
8
|
+
export declare function comparseVersions(a: SemVerInput, b: SemVerInput): -1 | 0 | 1;
|
|
9
|
+
export declare function isAtLeastVersion(input: SemVerInput, reference: SemVerInput): boolean;
|
|
10
|
+
export declare const packFormatOf: (input: SemVerInput) => SemVer;
|
|
11
|
+
export declare function lootTableFolder(packFormat: SemVerInput): "loot_table" | "loot_tables";
|
|
12
|
+
export declare function recipeFolder(packFormat: SemVerInput): "recipe" | "recipes";
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export function parseSemVer(input) {
|
|
2
|
+
if (typeof input !== "string")
|
|
3
|
+
return input;
|
|
4
|
+
const parts = input.split(".").map((it) => Number.parseInt(it));
|
|
5
|
+
if (parts.some((it) => Number.isNaN(it)))
|
|
6
|
+
throw new Error(`invalid semver format: ${input}`);
|
|
7
|
+
const [major, minor = 0, patch = 0] = parts;
|
|
8
|
+
if (!major)
|
|
9
|
+
throw new Error(`major version missing: ${input}`);
|
|
10
|
+
return { major, minor, patch };
|
|
11
|
+
}
|
|
12
|
+
export function comparseVersions(a, b) {
|
|
13
|
+
const [va, vb] = [a, b].map(parseSemVer);
|
|
14
|
+
if (va.major > vb.major)
|
|
15
|
+
return 1;
|
|
16
|
+
if (va.major < vb.major)
|
|
17
|
+
return -1;
|
|
18
|
+
if (va.minor > vb.minor)
|
|
19
|
+
return 1;
|
|
20
|
+
if (va.minor < vb.minor)
|
|
21
|
+
return -1;
|
|
22
|
+
if (va.patch > vb.patch)
|
|
23
|
+
return 1;
|
|
24
|
+
if (va.patch < vb.patch)
|
|
25
|
+
return -1;
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
export function isAtLeastVersion(input, reference) {
|
|
29
|
+
return comparseVersions(input, reference) >= 0;
|
|
30
|
+
}
|
|
31
|
+
function defineFormats(input) {
|
|
32
|
+
const formats = Object.entries(input)
|
|
33
|
+
.map((versions) => {
|
|
34
|
+
const [minecraftVersion, packFormat] = versions.map(parseSemVer);
|
|
35
|
+
return { minecraftVersion, packFormat };
|
|
36
|
+
})
|
|
37
|
+
.toSorted((...versions) => comparseVersions(...versions.map((it) => it.packFormat)))
|
|
38
|
+
.toReversed();
|
|
39
|
+
return (input) => {
|
|
40
|
+
const match = formats.find((it) => isAtLeastVersion(input, it.minecraftVersion));
|
|
41
|
+
if (match)
|
|
42
|
+
return match.packFormat;
|
|
43
|
+
throw new Error(`unknown minecraft version '${input}', please pass packFormat manually`);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export const packFormatOf = defineFormats({
|
|
47
|
+
"1.20": "15",
|
|
48
|
+
"1.20.2": "18",
|
|
49
|
+
"1.20.3": "26",
|
|
50
|
+
"1.20.5": "41",
|
|
51
|
+
"1.21": "48",
|
|
52
|
+
"1.21.2": "57",
|
|
53
|
+
"1.21.4": "61",
|
|
54
|
+
"1.21.5": "71",
|
|
55
|
+
"1.21.6": "80",
|
|
56
|
+
"1.21.7": "81",
|
|
57
|
+
"1.21.9": "88.0",
|
|
58
|
+
});
|
|
59
|
+
export function lootTableFolder(packFormat) {
|
|
60
|
+
return isAtLeastVersion(packFormat, "44") ? "loot_table" : "loot_tables";
|
|
61
|
+
}
|
|
62
|
+
export function recipeFolder(packFormat) {
|
|
63
|
+
return isAtLeastVersion(packFormat, "44") ? "recipe" : "recipes";
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=packFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packFormat.js","sourceRoot":"","sources":["../../src/common/packFormat.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,WAAW,CAAC,KAAkB;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;IAC5C,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,KAAK,EAAE,CAAC,CAAC;IAC/D,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,CAAc,EAAE,CAAc;IAC7D,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAqB,CAAC;IAC7D,IAAI,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,KAAK,GAAG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AE,OAAO,KAAK,CAAC,UAAU,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,8BAA8B,KAAK,oCAAoC,CACxE,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;IACxC,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,MAAM;CACjB,CAAC,CAAC;AAEH,MAAM,UAAU,eAAe,CAAC,UAAuB;IACrD,OAAO,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,UAAuB;IAClD,OAAO,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import type { Id, IdInput, NormalizedId } from "./id
|
|
2
|
-
export
|
|
1
|
+
import type { Id, IdInput, NormalizedId } from "./id";
|
|
2
|
+
export declare class Registry<TEntry, TId extends string = string> {
|
|
3
3
|
private readonly entries;
|
|
4
4
|
set(key: IdInput<TId>, value: TEntry): void;
|
|
5
5
|
get(key: IdInput<TId>): TEntry | undefined;
|
|
6
6
|
getOrPut(key: IdInput<TId>, defaultValue: () => TEntry): TEntry;
|
|
7
7
|
forEach(consumer: (value: TEntry, key: Id) => void): void;
|
|
8
8
|
forEachAsync(consumer: (value: TEntry, key: Id) => Promise<void>): Promise<void>;
|
|
9
|
+
filter(predicate: (value: TEntry, key: Id) => boolean): [NormalizedId<TId>, TEntry][];
|
|
10
|
+
delete(id: IdInput<TId>): void;
|
|
9
11
|
clear(): void;
|
|
10
12
|
keys(): NormalizedId<TId>[];
|
|
13
|
+
values(): TEntry[];
|
|
14
|
+
valuesWithId(): (TEntry & {
|
|
15
|
+
id: NormalizedId<TId>;
|
|
16
|
+
})[];
|
|
11
17
|
has(key: IdInput<TId>): boolean;
|
|
12
18
|
}
|