@adeficior/data-modifier 1.0.0-rc.11 → 1.0.0-rc.13

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 (236) hide show
  1. package/dist/common/id.d.ts +1 -0
  2. package/dist/common/id.js +4 -0
  3. package/dist/common/id.js.map +1 -1
  4. package/dist/common/ingredient/filter.d.ts +6 -0
  5. package/dist/common/ingredient/filter.js +97 -0
  6. package/dist/common/ingredient/filter.js.map +1 -0
  7. package/dist/common/ingredient/index.d.ts +74 -0
  8. package/dist/common/ingredient/index.js +112 -0
  9. package/dist/common/ingredient/index.js.map +1 -0
  10. package/dist/common/ingredient/input.d.ts +3 -0
  11. package/dist/common/ingredient/input.js +1 -0
  12. package/dist/common/ingredient/input.js.map +1 -0
  13. package/dist/common/ingredient/serializer.d.ts +17 -0
  14. package/dist/common/ingredient/serializer.js +112 -0
  15. package/dist/common/ingredient/serializer.js.map +1 -0
  16. package/dist/common/predicates.d.ts +2 -1
  17. package/dist/common/predicates.js.map +1 -1
  18. package/dist/common/result/filter.d.ts +6 -0
  19. package/dist/common/result/filter.js +68 -0
  20. package/dist/common/result/filter.js.map +1 -0
  21. package/dist/common/result/index.d.ts +41 -0
  22. package/dist/common/result/index.js +59 -0
  23. package/dist/common/result/index.js.map +1 -0
  24. package/dist/common/result/input.d.ts +3 -0
  25. package/dist/common/result/input.js +1 -0
  26. package/dist/common/result/input.js.map +1 -0
  27. package/dist/common/result/serializer.d.ts +15 -0
  28. package/dist/common/result/serializer.js +81 -0
  29. package/dist/common/result/serializer.js.map +1 -0
  30. package/dist/common/serializable.d.ts +6 -0
  31. package/dist/common/serializable.js +1 -0
  32. package/dist/common/serializable.js.map +1 -0
  33. package/dist/common/units.d.ts +1 -0
  34. package/dist/common/units.js +2 -0
  35. package/dist/common/units.js.map +1 -0
  36. package/dist/emit/blacklist.d.ts +4 -6
  37. package/dist/emit/blacklist.js +19 -21
  38. package/dist/emit/blacklist.js.map +1 -1
  39. package/dist/emit/data/loot.d.ts +6 -7
  40. package/dist/emit/data/loot.js +14 -13
  41. package/dist/emit/data/loot.js.map +1 -1
  42. package/dist/emit/data/recipe.d.ts +18 -16
  43. package/dist/emit/data/recipe.js +28 -22
  44. package/dist/emit/data/recipe.js.map +1 -1
  45. package/dist/emit/data/tags.d.ts +1 -1
  46. package/dist/emit/data/tags.js.map +1 -1
  47. package/dist/emit/polytoneTabs.d.ts +1 -1
  48. package/dist/emit/polytoneTabs.js +1 -2
  49. package/dist/emit/polytoneTabs.js.map +1 -1
  50. package/dist/emit/rule/lootTable.d.ts +2 -1
  51. package/dist/emit/rule/lootTable.js +4 -2
  52. package/dist/emit/rule/lootTable.js.map +1 -1
  53. package/dist/emit/rule/recipe.d.ts +4 -2
  54. package/dist/emit/rule/recipe.js.map +1 -1
  55. package/dist/emit/ruled.d.ts +2 -1
  56. package/dist/emit/ruled.js +5 -2
  57. package/dist/emit/ruled.js.map +1 -1
  58. package/dist/index.d.ts +1 -4
  59. package/dist/index.js +1 -2
  60. package/dist/index.js.map +1 -1
  61. package/dist/loader/context.d.ts +12 -0
  62. package/dist/loader/context.js +1 -0
  63. package/dist/loader/context.js.map +1 -0
  64. package/dist/loader/pack.d.ts +15 -8
  65. package/dist/loader/pack.js +43 -25
  66. package/dist/loader/pack.js.map +1 -1
  67. package/dist/loader/recipe.d.ts +8 -4
  68. package/dist/loader/recipe.js +41 -47
  69. package/dist/loader/recipe.js.map +1 -1
  70. package/dist/loader/registry/dump.d.ts +0 -2
  71. package/dist/loader/registry/dump.js +0 -11
  72. package/dist/loader/registry/dump.js.map +1 -1
  73. package/dist/loader/registry/index.d.ts +0 -2
  74. package/dist/loader/registry/wrapped.d.ts +13 -0
  75. package/dist/loader/registry/wrapped.js +26 -0
  76. package/dist/loader/registry/wrapped.js.map +1 -0
  77. package/dist/loader/tags.d.ts +1 -1
  78. package/dist/loader/tags.js.map +1 -1
  79. package/dist/packFormat.d.ts +11 -0
  80. package/dist/packFormat.js +59 -0
  81. package/dist/packFormat.js.map +1 -0
  82. package/dist/parser/adAstra.d.ts +5 -11
  83. package/dist/parser/adAstra.js +5 -5
  84. package/dist/parser/adAstra.js.map +1 -1
  85. package/dist/parser/botania.d.ts +10 -20
  86. package/dist/parser/botania.js +10 -10
  87. package/dist/parser/botania.js.map +1 -1
  88. package/dist/parser/create.d.ts +2 -4
  89. package/dist/parser/create.js +2 -2
  90. package/dist/parser/create.js.map +1 -1
  91. package/dist/parser/index.d.ts +6 -12
  92. package/dist/parser/index.js +6 -6
  93. package/dist/parser/index.js.map +1 -1
  94. package/dist/parser/lootTable.d.ts +7 -6
  95. package/dist/parser/lootTable.js +25 -23
  96. package/dist/parser/lootTable.js.map +1 -1
  97. package/dist/parser/recipe/adAstra/conversion.d.ts +15 -14
  98. package/dist/parser/recipe/adAstra/conversion.js +26 -19
  99. package/dist/parser/recipe/adAstra/conversion.js.map +1 -1
  100. package/dist/parser/recipe/adAstra/hammering.d.ts +3 -17
  101. package/dist/parser/recipe/adAstra/hammering.js +2 -25
  102. package/dist/parser/recipe/adAstra/hammering.js.map +1 -1
  103. package/dist/parser/recipe/adAstra/inputOutput.d.ts +16 -19
  104. package/dist/parser/recipe/adAstra/inputOutput.js +37 -29
  105. package/dist/parser/recipe/adAstra/inputOutput.js.map +1 -1
  106. package/dist/parser/recipe/adAstra/nasaWorkbench.d.ts +3 -19
  107. package/dist/parser/recipe/adAstra/nasaWorkbench.js +2 -28
  108. package/dist/parser/recipe/adAstra/nasaWorkbench.js.map +1 -1
  109. package/dist/parser/recipe/adAstra/spaceStation.d.ts +15 -14
  110. package/dist/parser/recipe/adAstra/spaceStation.js +33 -14
  111. package/dist/parser/recipe/adAstra/spaceStation.js.map +1 -1
  112. package/dist/parser/recipe/botania/apothecary.d.ts +17 -14
  113. package/dist/parser/recipe/botania/apothecary.js +26 -17
  114. package/dist/parser/recipe/botania/apothecary.js.map +1 -1
  115. package/dist/parser/recipe/botania/blocks.d.ts +21 -0
  116. package/dist/parser/recipe/botania/blocks.js +77 -0
  117. package/dist/parser/recipe/botania/blocks.js.map +1 -0
  118. package/dist/parser/recipe/botania/brew.d.ts +13 -12
  119. package/dist/parser/recipe/botania/brew.js +16 -11
  120. package/dist/parser/recipe/botania/brew.js.map +1 -1
  121. package/dist/parser/recipe/botania/elvenTrade.d.ts +8 -13
  122. package/dist/parser/recipe/botania/elvenTrade.js +11 -22
  123. package/dist/parser/recipe/botania/elvenTrade.js.map +1 -1
  124. package/dist/parser/recipe/botania/gogWrapper.d.ts +12 -12
  125. package/dist/parser/recipe/botania/gogWrapper.js +12 -13
  126. package/dist/parser/recipe/botania/gogWrapper.js.map +1 -1
  127. package/dist/parser/recipe/botania/manaInfusion.d.ts +18 -15
  128. package/dist/parser/recipe/botania/manaInfusion.js +29 -21
  129. package/dist/parser/recipe/botania/manaInfusion.js.map +1 -1
  130. package/dist/parser/recipe/botania/nbtWrapper.d.ts +12 -12
  131. package/dist/parser/recipe/botania/nbtWrapper.js +10 -11
  132. package/dist/parser/recipe/botania/nbtWrapper.js.map +1 -1
  133. package/dist/parser/recipe/botania/orechid.d.ts +3 -30
  134. package/dist/parser/recipe/botania/orechid.js +2 -72
  135. package/dist/parser/recipe/botania/orechid.js.map +1 -1
  136. package/dist/parser/recipe/botania/pureDaisy.d.ts +3 -18
  137. package/dist/parser/recipe/botania/pureDaisy.js +2 -28
  138. package/dist/parser/recipe/botania/pureDaisy.js.map +1 -1
  139. package/dist/parser/recipe/botania/runicAltar.d.ts +8 -13
  140. package/dist/parser/recipe/botania/runicAltar.js +11 -22
  141. package/dist/parser/recipe/botania/runicAltar.js.map +1 -1
  142. package/dist/parser/recipe/botania/terraPlate.d.ts +4 -16
  143. package/dist/parser/recipe/botania/terraPlate.js +2 -25
  144. package/dist/parser/recipe/botania/terraPlate.js.map +1 -1
  145. package/dist/parser/recipe/create/assembly.d.ts +18 -17
  146. package/dist/parser/recipe/create/assembly.js +27 -27
  147. package/dist/parser/recipe/create/assembly.js.map +1 -1
  148. package/dist/parser/recipe/create/processing.d.ts +4 -16
  149. package/dist/parser/recipe/create/processing.js +2 -25
  150. package/dist/parser/recipe/create/processing.js.map +1 -1
  151. package/dist/parser/recipe/farmersdelight/cooking.d.ts +16 -12
  152. package/dist/parser/recipe/farmersdelight/cooking.js +27 -15
  153. package/dist/parser/recipe/farmersdelight/cooking.js.map +1 -1
  154. package/dist/parser/recipe/farmersdelight/cutting.d.ts +14 -14
  155. package/dist/parser/recipe/farmersdelight/cutting.js +32 -29
  156. package/dist/parser/recipe/farmersdelight/cutting.js.map +1 -1
  157. package/dist/parser/recipe/forge/conditional.d.ts +10 -10
  158. package/dist/parser/recipe/forge/conditional.js +13 -17
  159. package/dist/parser/recipe/forge/conditional.js.map +1 -1
  160. package/dist/parser/recipe/index.d.ts +21 -12
  161. package/dist/parser/recipe/index.js +10 -3
  162. package/dist/parser/recipe/index.js.map +1 -1
  163. package/dist/parser/recipe/ingredientMap.d.ts +12 -0
  164. package/dist/parser/recipe/ingredientMap.js +17 -0
  165. package/dist/parser/recipe/ingredientMap.js.map +1 -0
  166. package/dist/parser/recipe/manyToMany.d.ts +20 -0
  167. package/dist/parser/recipe/manyToMany.js +33 -0
  168. package/dist/parser/recipe/manyToMany.js.map +1 -0
  169. package/dist/parser/recipe/manyToOne.d.ts +20 -0
  170. package/dist/parser/recipe/manyToOne.js +33 -0
  171. package/dist/parser/recipe/manyToOne.js.map +1 -0
  172. package/dist/parser/recipe/oneToOne.d.ts +20 -0
  173. package/dist/parser/recipe/oneToOne.js +33 -0
  174. package/dist/parser/recipe/oneToOne.js.map +1 -0
  175. package/dist/parser/recipe/roots/component.d.ts +13 -12
  176. package/dist/parser/recipe/roots/component.js +16 -11
  177. package/dist/parser/recipe/roots/component.js.map +1 -1
  178. package/dist/parser/recipe/roots/ritual.d.ts +14 -15
  179. package/dist/parser/recipe/roots/ritual.js +18 -25
  180. package/dist/parser/recipe/roots/ritual.js.map +1 -1
  181. package/dist/parser/recipe/sullys/polishing.d.ts +4 -16
  182. package/dist/parser/recipe/sullys/polishing.js +2 -25
  183. package/dist/parser/recipe/sullys/polishing.js.map +1 -1
  184. package/dist/parser/recipe/thermal/catalyst.d.ts +13 -12
  185. package/dist/parser/recipe/thermal/catalyst.js +16 -11
  186. package/dist/parser/recipe/thermal/catalyst.js.map +1 -1
  187. package/dist/parser/recipe/thermal/fuel.d.ts +13 -12
  188. package/dist/parser/recipe/thermal/fuel.js +17 -11
  189. package/dist/parser/recipe/thermal/fuel.js.map +1 -1
  190. package/dist/parser/recipe/thermal/index.d.ts +16 -14
  191. package/dist/parser/recipe/thermal/index.js +35 -24
  192. package/dist/parser/recipe/thermal/index.js.map +1 -1
  193. package/dist/parser/recipe/thermal/ingredient.d.ts +4 -21
  194. package/dist/parser/recipe/thermal/ingredient.js +40 -33
  195. package/dist/parser/recipe/thermal/ingredient.js.map +1 -1
  196. package/dist/parser/recipe/thermal/treeExtraction.d.ts +17 -17
  197. package/dist/parser/recipe/thermal/treeExtraction.js +29 -30
  198. package/dist/parser/recipe/thermal/treeExtraction.js.map +1 -1
  199. package/dist/parser/recipe/vanilla/shaped.d.ts +17 -13
  200. package/dist/parser/recipe/vanilla/shaped.js +21 -16
  201. package/dist/parser/recipe/vanilla/shaped.js.map +1 -1
  202. package/dist/parser/recipe/vanilla/shapeless.d.ts +3 -17
  203. package/dist/parser/recipe/vanilla/shapeless.js +2 -25
  204. package/dist/parser/recipe/vanilla/shapeless.js.map +1 -1
  205. package/dist/parser/recipe/vanilla/smelting.d.ts +16 -13
  206. package/dist/parser/recipe/vanilla/smelting.js +21 -15
  207. package/dist/parser/recipe/vanilla/smelting.js.map +1 -1
  208. package/dist/parser/recipe/vanilla/smithing.d.ts +18 -14
  209. package/dist/parser/recipe/vanilla/smithing.js +25 -16
  210. package/dist/parser/recipe/vanilla/smithing.js.map +1 -1
  211. package/dist/parser/recipe/vanilla/stonecutting.d.ts +15 -13
  212. package/dist/parser/recipe/vanilla/stonecutting.js +22 -24
  213. package/dist/parser/recipe/vanilla/stonecutting.js.map +1 -1
  214. package/dist/parser/roots.d.ts +2 -4
  215. package/dist/parser/roots.js +2 -2
  216. package/dist/parser/roots.js.map +1 -1
  217. package/dist/parser/thermal.d.ts +4 -10
  218. package/dist/parser/thermal.js +4 -5
  219. package/dist/parser/thermal.js.map +1 -1
  220. package/dist/schema/data/recipe.d.ts +2 -1
  221. package/package.json +3 -2
  222. package/dist/common/ingredient.d.ts +0 -49
  223. package/dist/common/ingredient.js +0 -108
  224. package/dist/common/ingredient.js.map +0 -1
  225. package/dist/common/result.d.ts +0 -48
  226. package/dist/common/result.js +0 -37
  227. package/dist/common/result.js.map +0 -1
  228. package/dist/parser/recipe/adAstra/index.d.ts +0 -5
  229. package/dist/parser/recipe/adAstra/index.js +0 -1
  230. package/dist/parser/recipe/adAstra/index.js.map +0 -1
  231. package/dist/parser/recipe/ignored.d.ts +0 -10
  232. package/dist/parser/recipe/ignored.js +0 -16
  233. package/dist/parser/recipe/ignored.js.map +0 -1
  234. package/dist/parser/recipe/quark/exclusion.d.ts +0 -20
  235. package/dist/parser/recipe/quark/exclusion.js +0 -32
  236. package/dist/parser/recipe/quark/exclusion.js.map +0 -1
@@ -1,38 +1,36 @@
1
+ import { encodeId } from "../common/id.js";
2
+ import { ItemIngredient, ItemTagIngredient, } from "../common/ingredient/index.js";
3
+ import { ItemResult } from "../common/result/index.js";
1
4
  import { extendLootEntry } from "../schema/data/loot.js";
2
- import { IllegalShapeError } from "../error.js";
3
5
  function createUnvalidatedLootEntry(input) {
4
- if (input && typeof input === "object") {
5
- if ("type" in input)
6
- return extendLootEntry(input);
7
- if ("tag" in input)
8
- return {
9
- type: "minecraft:tag",
10
- name: input.tag,
11
- };
12
- if ("item" in input)
13
- return {
14
- type: "minecraft:item",
15
- name: input.item,
16
- };
6
+ if (input instanceof ItemIngredient || input instanceof ItemResult) {
7
+ return {
8
+ type: "minecraft:item",
9
+ name: encodeId(input.id),
10
+ };
11
+ }
12
+ if (input instanceof ItemTagIngredient) {
13
+ return {
14
+ type: "minecraft:tag",
15
+ name: encodeId(input.tag),
16
+ };
17
17
  }
18
- throw new IllegalShapeError("unknown loot entry input", input);
18
+ return extendLootEntry(input);
19
19
  }
20
20
  function validateLootEntry(entry, lookup) {
21
21
  if (entry.type === "minecraft:item")
22
- lookup?.validate({ item: entry.name });
23
- if (entry.type === "minecraft:tag")
24
- lookup?.validate({ tag: entry.name });
22
+ lookup.validateEntry("minecraft:item", entry.name);
25
23
  if (entry.type === "minecraft:alternatives") {
26
24
  entry.children.forEach((it) => validateLootEntry(extendLootEntry(it), lookup));
27
25
  }
28
26
  }
29
27
  export function createLootEntry(input, lookup) {
30
28
  const unvalidated = createUnvalidatedLootEntry(input);
31
- if (lookup)
32
- validateLootEntry(unvalidated, lookup);
29
+ validateLootEntry(unvalidated, lookup);
33
30
  return unvalidated;
34
31
  }
35
- export function replaceItemInEntry(predicate, to) {
32
+ // TODO add function Predicate<Ingredient> -> Predicate<LootEntry>
33
+ function replaceItemInEntry(predicate, to) {
36
34
  const replace = (base) => {
37
35
  const entry = extendLootEntry(base);
38
36
  const shared = {
@@ -46,9 +44,13 @@ export function replaceItemInEntry(predicate, to) {
46
44
  children: entry.children.map(replace),
47
45
  };
48
46
  case "minecraft:item":
49
- return predicate({ item: entry.name }) ? { ...shared, ...to } : entry;
47
+ return predicate(new ItemIngredient(entry.name))
48
+ ? { ...shared, ...to }
49
+ : entry;
50
50
  case "minecraft:tag":
51
- return predicate({ tag: entry.name }) ? { ...shared, ...to } : entry;
51
+ return predicate(new ItemTagIngredient(entry.name))
52
+ ? { ...shared, ...to }
53
+ : entry;
52
54
  default:
53
55
  return entry;
54
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"lootTable.js","sourceRoot":"","sources":["../../src/parser/lootTable.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,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OAAO,CAAC,KAAgB,EAAa,EAAE;QACrC,OAAO;YACL,GAAG,KAAK;YACR,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBAChC,GAAG,IAAI;gBACP,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;aACxC,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
@@ -1,20 +1,21 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import { type Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
4
+ import type { RecipeParseContext, Replacer } from "../index.js";
5
+ import RecipeParser, { Recipe } from "../index.js";
6
6
  export type FluidConversionRecipeDefinition = RecipeDefinition & Readonly<{
7
- input: Ingredient;
7
+ input: unknown;
8
8
  output: string;
9
9
  }>;
10
- export declare class FluidConversionRecipe extends Recipe<FluidConversionRecipeDefinition> {
11
- private readonly output;
12
- constructor(definition: FluidConversionRecipeDefinition);
13
- getIngredients(): IngredientInput[];
14
- getResults(): ResultInput[];
15
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
16
- replaceResult(replace: Replacer<Result>): Recipe;
10
+ export declare class FluidConversionRecipe extends Recipe {
11
+ private readonly ingredient;
12
+ private readonly result;
13
+ constructor(definition: RecipeDefinition, ingredient: Ingredient, result: Result);
14
+ getIngredients(): Ingredient[];
15
+ getResults(): Result[];
16
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): FluidConversionRecipe;
17
+ serialize(context: RecipeParseContext): Partial<FluidConversionRecipeDefinition>;
17
18
  }
18
- export default class FluidConversionRecipeParser extends RecipeParser<FluidConversionRecipeDefinition, FluidConversionRecipe> {
19
- create(definition: FluidConversionRecipeDefinition): FluidConversionRecipe;
19
+ export declare class FluidConversionRecipeParser extends RecipeParser<FluidConversionRecipeDefinition, FluidConversionRecipe> {
20
+ deserialize(definition: FluidConversionRecipeDefinition, context: RecipeParseContext): FluidConversionRecipe;
20
21
  }
@@ -1,33 +1,40 @@
1
+ import { encodeId } from "../../../common/id.js";
2
+ import { FluidIngredient, } from "../../../common/ingredient/index.js";
3
+ import { FluidResult } from "../../../common/result/index.js";
4
+ import { IllegalShapeError } from "../../../error.js";
1
5
  import RecipeParser, { Recipe } from "../index.js";
2
6
  export class FluidConversionRecipe extends Recipe {
3
- output;
4
- constructor(definition) {
7
+ ingredient;
8
+ result;
9
+ constructor(definition, ingredient, result) {
5
10
  super(definition);
6
- this.output = { fluid: this.definition.output };
11
+ this.ingredient = ingredient;
12
+ this.result = result;
7
13
  }
8
14
  getIngredients() {
9
- return [this.definition.input];
15
+ return [this.ingredient];
10
16
  }
11
17
  getResults() {
12
- return [this.output];
18
+ return [this.result];
13
19
  }
14
- replaceIngredient(replace) {
15
- return new FluidConversionRecipe({
16
- ...this.definition,
17
- input: replace(this.definition.input),
18
- });
20
+ replace(ingredientReplacer, resultReplacer) {
21
+ return new FluidConversionRecipe(this.definition, ingredientReplacer(this.ingredient), resultReplacer(this.result));
19
22
  }
20
- replaceResult(replace) {
21
- const replaced = replace(this.output);
22
- return new FluidConversionRecipe({
23
- ...this.definition,
24
- output: "fluid" in replaced ? replaced.fluid : this.definition.output,
25
- });
23
+ serialize(context) {
24
+ if (!(this.result instanceof FluidIngredient)) {
25
+ throw new IllegalShapeError("fluid conversion output must be a fluid result", this.result);
26
+ }
27
+ return {
28
+ input: context.ingredients.serialize(this.ingredient),
29
+ output: encodeId(this.result.id),
30
+ };
26
31
  }
27
32
  }
28
- export default class FluidConversionRecipeParser extends RecipeParser {
29
- create(definition) {
30
- return new FluidConversionRecipe(definition);
33
+ export class FluidConversionRecipeParser extends RecipeParser {
34
+ deserialize(definition, context) {
35
+ const ingredient = context.ingredients.create(definition.input);
36
+ const result = context.results.validated(new FluidResult(definition.output, -1));
37
+ return new FluidConversionRecipe(definition, ingredient, result);
31
38
  }
32
39
  }
33
40
  //# sourceMappingURL=conversion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conversion.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/conversion.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcnD,MAAM,OAAO,qBAAsB,SAAQ,MAAuC;IAC/D,MAAM,CAAS;IAEhC,YAAY,UAA2C;QACrD,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IAClD,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,qBAAqB,CAAC;YAC/B,GAAG,IAAI,CAAC,UAAU;YAClB,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;SACtC,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,IAAI,qBAAqB,CAAC;YAC/B,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM;SACtE,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,S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,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;YACrD,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;SACjC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,2BAA4B,SAAQ,YAGhD;IACC,WAAW,CACT,UAA2C,EAC3C,OAA2B;QAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CACtC,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CACvC,CAAC;QACF,OAAO,IAAI,qBAAqB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;CACF"}
@@ -1,18 +1,4 @@
1
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
2
- import type { Result, ResultInput } from "../../../common/result.js";
3
- import type { RecipeDefinition } from "../../../schema/data/recipe.js";
4
- import type { Replacer } from "../index.js";
5
- import RecipeParser, { Recipe } from "../index.js";
6
- export type HammeringRecipeDefinition = RecipeDefinition & Readonly<{
7
- ingredients: Ingredient[];
8
- result: Result;
9
- }>;
10
- export declare class HammeringRecipe extends Recipe<HammeringRecipeDefinition> {
11
- getIngredients(): IngredientInput[];
12
- getResults(): ResultInput[];
13
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
14
- replaceResult(replace: Replacer<Result>): Recipe;
15
- }
16
- export default class HammeringRecipeParser extends RecipeParser<HammeringRecipeDefinition, HammeringRecipe> {
17
- create(definition: HammeringRecipeDefinition): HammeringRecipe;
1
+ import { ManyToOneRecipeParser, type ManyToOneRecipeDefinition } from "../manyToOne.js";
2
+ export type HammeringRecipeDefinition = ManyToOneRecipeDefinition;
3
+ export declare class HammeringRecipeParser extends ManyToOneRecipeParser<HammeringRecipeDefinition> {
18
4
  }
@@ -1,27 +1,4 @@
1
- import RecipeParser, { Recipe } from "../index.js";
2
- export class HammeringRecipe extends Recipe {
3
- getIngredients() {
4
- return this.definition.ingredients;
5
- }
6
- getResults() {
7
- return [this.definition.result];
8
- }
9
- replaceIngredient(replace) {
10
- return new HammeringRecipe({
11
- ...this.definition,
12
- ingredients: this.definition.ingredients.map(replace),
13
- });
14
- }
15
- replaceResult(replace) {
16
- return new HammeringRecipe({
17
- ...this.definition,
18
- result: replace(this.definition.result),
19
- });
20
- }
21
- }
22
- export default class HammeringRecipeParser extends RecipeParser {
23
- create(definition) {
24
- return new HammeringRecipe(definition);
25
- }
1
+ import { ManyToOneRecipeParser, } from "../manyToOne.js";
2
+ export class HammeringRecipeParser extends ManyToOneRecipeParser {
26
3
  }
27
4
  //# sourceMappingURL=hammering.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hammering.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/hammering.ts"],"names":[],"mappings":"AAOA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQnD,MAAM,OAAO,eAAgB,SAAQ,MAAiC;IACpE,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IACrC,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,eAAe,CAAC;YACzB,GAAG,IAAI,CAAC,UAAU;YAClB,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,OAAO,IAAI,eAAe,CAAC;YACzB,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,YAGlD;IACC,MAAM,CAAC,UAAqC;QAC1C,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC;CACF"}
1
+ {"version":3,"file":"hammering.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/hammering.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,OAAO,qBAAsB,SAAQ,qBAAgD;CAAG"}
@@ -1,24 +1,21 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import { ItemResult, type Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
6
- export type IdResult = {
7
- id: string;
8
- count?: number;
9
- };
10
- export declare function fromIdResult({ id, ...result }: IdResult): Result;
11
- export declare function toIdResult(result: Result): IdResult | null;
4
+ import RecipeParser, { Recipe, type RecipeParseContext, type Replacer } from "../index.js";
5
+ import { OneToOneRecipe } from "../oneToOne.js";
12
6
  export type InputOutputRecipeDefinition = RecipeDefinition & Readonly<{
13
- input: Ingredient;
14
- output: IdResult;
7
+ input: unknown;
8
+ output: unknown;
15
9
  }>;
16
- export declare class InputOutputRecipe extends Recipe<InputOutputRecipeDefinition> {
17
- getIngredients(): IngredientInput[];
18
- getResults(): ResultInput[];
19
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
20
- replaceResult(replace: Replacer<Result>): Recipe;
10
+ export declare class InputOutputRecipe extends Recipe {
11
+ protected readonly ingredient: Ingredient;
12
+ protected readonly result: ItemResult;
13
+ constructor(definition: RecipeDefinition, ingredient: Ingredient, result: ItemResult);
14
+ getIngredients(): Ingredient[];
15
+ getResults(): ItemResult[];
16
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): OneToOneRecipe;
17
+ serialize(context: RecipeParseContext): Partial<InputOutputRecipeDefinition>;
21
18
  }
22
- export default class InputOutputRecipeParser extends RecipeParser<InputOutputRecipeDefinition, InputOutputRecipe> {
23
- create(definition: InputOutputRecipeDefinition): InputOutputRecipe;
19
+ export declare class InputOutputRecipeParser extends RecipeParser<InputOutputRecipeDefinition, InputOutputRecipe> {
20
+ deserialize(definition: InputOutputRecipeDefinition, context: RecipeParseContext): InputOutputRecipe;
24
21
  }
@@ -1,42 +1,50 @@
1
- import RecipeParser, { Recipe } from "../index.js";
2
- export function fromIdResult({ id, ...result }) {
3
- return {
4
- item: id,
5
- ...result,
6
- };
1
+ import z from "zod";
2
+ import { encodeId, IdSchema } from "../../../common/id.js";
3
+ import { ItemResult } from "../../../common/result/index.js";
4
+ import RecipeParser, { Recipe, } from "../index.js";
5
+ import { OneToOneRecipe } from "../oneToOne.js";
6
+ // TODO this will also be the new item format, can re-use that
7
+ const IdResultSchema = z.object({
8
+ id: IdSchema,
9
+ count: z.number().optional(),
10
+ });
11
+ function deserializeIdResult(ingredients, input) {
12
+ const { id, count } = IdResultSchema.parse(input);
13
+ return ingredients.validated(new ItemResult(id, count));
7
14
  }
8
- export function toIdResult(result) {
9
- if ("item" in result)
10
- return {
11
- id: result.item,
12
- count: result.count,
13
- };
14
- return null;
15
+ function serializeIdResult(result) {
16
+ const { id, count } = result;
17
+ return { id: encodeId(id), count };
15
18
  }
16
19
  export class InputOutputRecipe extends Recipe {
20
+ ingredient;
21
+ result;
22
+ constructor(definition, ingredient, result) {
23
+ super(definition);
24
+ this.ingredient = ingredient;
25
+ this.result = result;
26
+ }
17
27
  getIngredients() {
18
- return [this.definition.input];
28
+ return [this.ingredient];
19
29
  }
20
30
  getResults() {
21
- return [this.definition.output].map(fromIdResult);
31
+ return [this.result];
22
32
  }
23
- replaceIngredient(replace) {
24
- return new InputOutputRecipe({
25
- ...this.definition,
26
- input: replace(this.definition.input),
27
- });
33
+ replace(ingredientReplacer, resultReplacer) {
34
+ return new OneToOneRecipe(this.definition, ingredientReplacer(this.ingredient), resultReplacer(this.result));
28
35
  }
29
- replaceResult(replace) {
30
- return new InputOutputRecipe({
31
- ...this.definition,
32
- output: toIdResult(replace(fromIdResult(this.definition.output))) ??
33
- this.definition.output,
34
- });
36
+ serialize(context) {
37
+ return {
38
+ input: context.ingredients.serialize(this.ingredient),
39
+ output: serializeIdResult(this.result),
40
+ };
35
41
  }
36
42
  }
37
- export default class InputOutputRecipeParser extends RecipeParser {
38
- create(definition) {
39
- return new InputOutputRecipe(definition);
43
+ export class InputOutputRecipeParser extends RecipeParser {
44
+ deserialize(definition, context) {
45
+ const ingredient = context.ingredients.create(definition.input);
46
+ const result = deserializeIdResult(context.ingredients, definition.output);
47
+ return new InputOutputRecipe(definition, ingredient, result);
40
48
  }
41
49
  }
42
50
  //# sourceMappingURL=inputOutput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"inputOutput.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/inputOutput.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAanD,MAAM,UAAU,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAY;IACtD,OAAO;QACL,IAAI,EAAE,EAAE;QACR,GAAG,MAAM;KACV,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,IAAI,MAAM,IAAI,MAAM;QAClB,OAAO;YACL,EAAE,EAAE,MAAM,CAAC,IAAI;YACf,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IAEJ,OAAO,IAAI,CAAC;AACd,CAAC;AAQD,MAAM,OAAO,iBAAkB,SAAQ,MAAmC;IACxE,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAED,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uC,EACvC,OAA2B;QAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC3E,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;CACF"}
@@ -1,20 +1,4 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
4
- import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
6
- import type { WrappedIngredient } from "./index.js";
7
- export type NasaWorkbenchRecipeDefinition = RecipeDefinition & Readonly<{
8
- ingredients: WrappedIngredient[];
9
- output: Result;
10
- mana?: number;
11
- }>;
12
- export declare class NasaWorkbenchRecipe extends Recipe<NasaWorkbenchRecipeDefinition> {
13
- getIngredients(): IngredientInput[];
14
- getResults(): ResultInput[];
15
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
16
- replaceResult(replace: Replacer<Result>): Recipe;
17
- }
18
- export default class NasaWorkbenchRecipeParser extends RecipeParser<NasaWorkbenchRecipeDefinition, NasaWorkbenchRecipe> {
19
- create(definition: NasaWorkbenchRecipeDefinition): NasaWorkbenchRecipe;
1
+ import { ManyToOneRecipeParser, type ManyToOneRecipeDefinition } from "../manyToOne.js";
2
+ export type NasaWorkbenchRecipeDefinition = ManyToOneRecipeDefinition;
3
+ export declare class NasaWorkbenchRecipeParser extends ManyToOneRecipeParser<NasaWorkbenchRecipeDefinition> {
20
4
  }
@@ -1,30 +1,4 @@
1
- import RecipeParser, { Recipe } from "../index.js";
2
- export class NasaWorkbenchRecipe extends Recipe {
3
- getIngredients() {
4
- return this.definition.ingredients.map((it) => it.ingredient);
5
- }
6
- getResults() {
7
- return [this.definition.output];
8
- }
9
- replaceIngredient(replace) {
10
- return new NasaWorkbenchRecipe({
11
- ...this.definition,
12
- ingredients: this.definition.ingredients.map((it) => ({
13
- ...it,
14
- ingredient: replace(it.ingredient),
15
- })),
16
- });
17
- }
18
- replaceResult(replace) {
19
- return new NasaWorkbenchRecipe({
20
- ...this.definition,
21
- output: replace(this.definition.output),
22
- });
23
- }
24
- }
25
- export default class NasaWorkbenchRecipeParser extends RecipeParser {
26
- create(definition) {
27
- return new NasaWorkbenchRecipe(definition);
28
- }
1
+ import { ManyToOneRecipeParser, } from "../manyToOne.js";
2
+ export class NasaWorkbenchRecipeParser extends ManyToOneRecipeParser {
29
3
  }
30
4
  //# sourceMappingURL=nasaWorkbench.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nasaWorkbench.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/nasaWorkbench.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAgBnD,MAAM,OAAO,mBAAoB,SAAQ,MAAqC;IAC5E,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,mBAAmB,CAAC;YAC7B,GAAG,IAAI,CAAC,UAAU;YAClB,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpD,GAAG,EAAE;gBACL,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;aACnC,CAAC,CAAC;SACJ,CAAC,CAAC;IACL,CAAC;IAED,aAAa,CAAC,OAAyB;QACrC,OAAO,IAAI,mBAAmB,CAAC;YAC7B,GAAG,IAAI,CAAC,UAAU;YAClB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;SACxC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,YAGtD;IACC,MAAM,CAAC,UAAyC;QAC9C,OAAO,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF"}
1
+ {"version":3,"file":"nasaWorkbench.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/nasaWorkbench.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,GAEtB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,OAAO,yBAA0B,SAAQ,qBAAoD;CAAG"}
@@ -1,19 +1,20 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import { type Ingredient } from "../../../common/ingredient/index.js";
4
2
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { ResultInput } from "../../../common/result.js";
6
- import type { WrappedIngredient } from "./index.js";
3
+ import type { RecipeParseContext, Replacer } from "../index.js";
4
+ import RecipeParser, { Recipe } from "../index.js";
7
5
  export type SpaceStationRecipeDefinition = RecipeDefinition & Readonly<{
8
- ingredients: WrappedIngredient[];
9
- mana?: number;
6
+ ingredients: unknown[];
7
+ dimension: string;
8
+ structure: string;
10
9
  }>;
11
- export declare class SpaceStationRecipe extends Recipe<SpaceStationRecipeDefinition> {
12
- getIngredients(): IngredientInput[];
13
- getResults(): ResultInput[];
14
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
15
- replaceResult(): Recipe;
10
+ export declare class SpaceStationRecipe extends Recipe {
11
+ private readonly ingredients;
12
+ constructor(definition: RecipeDefinition, ingredients: Ingredient[]);
13
+ getIngredients(): Ingredient[];
14
+ getResults(): never[];
15
+ replace(ingredientReplacer: Replacer<Ingredient>): SpaceStationRecipe;
16
+ serialize(context: RecipeParseContext): Partial<SpaceStationRecipeDefinition>;
16
17
  }
17
- export default class SpaceStationRecipeParser extends RecipeParser<SpaceStationRecipeDefinition, SpaceStationRecipe> {
18
- create(definition: SpaceStationRecipeDefinition): SpaceStationRecipe;
18
+ export declare class SpaceStationRecipeParser extends RecipeParser<SpaceStationRecipeDefinition, SpaceStationRecipe> {
19
+ deserialize(definition: SpaceStationRecipeDefinition, context: RecipeParseContext): SpaceStationRecipe;
19
20
  }
@@ -1,27 +1,46 @@
1
+ import { omit } from "lodash-es";
2
+ import z from "zod";
3
+ import { ItemIngredient, ItemTagIngredient, } from "../../../common/ingredient/index.js";
4
+ import { IllegalShapeError } from "../../../error.js";
1
5
  import RecipeParser, { Recipe } from "../index.js";
6
+ const WrappedIngredientSchema = z.object({
7
+ ingredient: z.record(z.string(), z.unknown()),
8
+ count: z.number().optional(),
9
+ });
2
10
  export class SpaceStationRecipe extends Recipe {
11
+ ingredients;
12
+ constructor(definition, ingredients) {
13
+ super(definition);
14
+ this.ingredients = ingredients;
15
+ }
3
16
  getIngredients() {
4
- return this.definition.ingredients.map((it) => it.ingredient);
17
+ return this.ingredients;
5
18
  }
6
19
  getResults() {
7
20
  return [];
8
21
  }
9
- replaceIngredient(replace) {
10
- return new SpaceStationRecipe({
11
- ...this.definition,
12
- ingredients: this.definition.ingredients.map((it) => ({
13
- ...it,
14
- ingredient: replace(it.ingredient),
15
- })),
16
- });
22
+ replace(ingredientReplacer) {
23
+ return new SpaceStationRecipe(this.definition, this.ingredients.map(ingredientReplacer));
17
24
  }
18
- replaceResult() {
19
- return new SpaceStationRecipe(this.definition);
25
+ serialize(context) {
26
+ return {
27
+ ingredients: context.ingredients
28
+ .serializeList(this.ingredients)
29
+ .map((it) => {
30
+ if (it instanceof ItemIngredient || it instanceof ItemTagIngredient) {
31
+ return { ingredient: omit(it, "count"), count: it.count };
32
+ }
33
+ throw new IllegalShapeError("space station ingredient needs to be a form of item", it);
34
+ }),
35
+ };
20
36
  }
21
37
  }
22
- export default class SpaceStationRecipeParser extends RecipeParser {
23
- create(definition) {
24
- return new SpaceStationRecipe(definition);
38
+ export class SpaceStationRecipeParser extends RecipeParser {
39
+ deserialize(definition, context) {
40
+ const ingredients = context.ingredients.createList(definition.ingredients
41
+ .map((it) => WrappedIngredientSchema.parse(it))
42
+ .map((it) => ({ ...it.ingredient, count: it.count })));
43
+ return new SpaceStationRecipe(definition, ingredients);
25
44
  }
26
45
  }
27
46
  //# sourceMappingURL=spaceStation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spaceStation.js","sourceRoot":"","sources":["../../../../src/parser/recipe/adAstra/spaceStation.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAenD,MAAM,OAAO,kBAAmB,SAAQ,MAAoC;IAC1E,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAChE,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,kBAAkB,CAAC;YAC5B,GAAG,IAAI,CAAC,UAAU;YAClB,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;gBACpD,GAAG,EAAE;gBACL,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC;aACnC,CAAC,CAAC;SACJ,CAAC,CAAC;IACL,CAAC;IAED,aAAa;QACX,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,YAGrD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AAG,CAAC,CAAC,EAAE,EAAE,EAAE;gBACV,IAAI,EAAE,YAAY,cAAc,IAAI,EAAE,YAAY,iBAAiB,EAAE,CAAC;oBACpE,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC;gBAC5D,CAAC;gBAED,MAAM,IAAI,iBAAiB,CACzB,qDAAqD,EACrD,EAAE,CACH,CAAC;YACJ,CAAC,CAAC;SACL,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,wBAAyB,SAAQ,YAG7C;IACC,WAAW,CACT,UAAwC,EACxC,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAChD,UAAU,CAAC,WAAW;aACnB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aAC9C,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CACxD,CAAC;QAEF,OAAO,IAAI,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -1,19 +1,22 @@
1
- import type { Replacer } from "../index.js";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
4
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
5
- import type { Result, ResultInput } from "../../../common/result.js";
4
+ import RecipeParser, { Recipe, type RecipeParseContext, type Replacer } from "../index.js";
6
5
  export type ApothecaryRecipeDefinition = RecipeDefinition & Readonly<{
7
- ingredients: Ingredient[];
8
- output: Result;
9
- reagent: Ingredient;
6
+ ingredients: unknown[];
7
+ output: unknown;
8
+ reagent: unknown;
10
9
  }>;
11
- export declare class ApothecaryRecipe extends Recipe<ApothecaryRecipeDefinition> {
12
- getIngredients(): IngredientInput[];
13
- getResults(): ResultInput[];
14
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
15
- replaceResult(replace: Replacer<Result>): Recipe;
10
+ export declare class ApothecaryRecipe extends Recipe {
11
+ protected readonly ingredients: Ingredient[];
12
+ protected readonly result: Result;
13
+ protected readonly reagent: Ingredient;
14
+ constructor(definition: RecipeDefinition, ingredients: Ingredient[], result: Result, reagent: Ingredient);
15
+ getIngredients(): Ingredient[];
16
+ getResults(): Result[];
17
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): ApothecaryRecipe;
18
+ serialize(context: RecipeParseContext): Partial<ApothecaryRecipeDefinition>;
16
19
  }
17
- export default class ApothecaryRecipeParser extends RecipeParser<ApothecaryRecipeDefinition, ApothecaryRecipe> {
18
- create(definition: ApothecaryRecipeDefinition): ApothecaryRecipe;
20
+ export declare class ApothecaryRecipeParser extends RecipeParser<ApothecaryRecipeDefinition, ApothecaryRecipe> {
21
+ deserialize(definition: ApothecaryRecipeDefinition, context: RecipeParseContext): ApothecaryRecipe;
19
22
  }