@adeficior/data-modifier 1.0.0-rc.12 → 1.0.0-rc.14

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 (233) 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 -8
  40. package/dist/emit/data/loot.js +11 -13
  41. package/dist/emit/data/loot.js.map +1 -1
  42. package/dist/emit/data/recipe.d.ts +20 -18
  43. package/dist/emit/data/recipe.js +40 -29
  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 +7 -5
  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 +0 -4
  59. package/dist/index.js +0 -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 +13 -7
  65. package/dist/loader/pack.js +43 -25
  66. package/dist/loader/pack.js.map +1 -1
  67. package/dist/loader/recipe.d.ts +9 -5
  68. package/dist/loader/recipe.js +39 -48
  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/parser/adAstra.d.ts +5 -11
  80. package/dist/parser/adAstra.js +5 -5
  81. package/dist/parser/adAstra.js.map +1 -1
  82. package/dist/parser/botania.d.ts +10 -20
  83. package/dist/parser/botania.js +10 -10
  84. package/dist/parser/botania.js.map +1 -1
  85. package/dist/parser/create.d.ts +2 -4
  86. package/dist/parser/create.js +2 -2
  87. package/dist/parser/create.js.map +1 -1
  88. package/dist/parser/index.d.ts +7 -13
  89. package/dist/parser/index.js +7 -7
  90. package/dist/parser/index.js.map +1 -1
  91. package/dist/parser/lootTable.d.ts +7 -6
  92. package/dist/parser/lootTable.js +25 -23
  93. package/dist/parser/lootTable.js.map +1 -1
  94. package/dist/parser/recipe/adAstra/conversion.d.ts +15 -14
  95. package/dist/parser/recipe/adAstra/conversion.js +27 -20
  96. package/dist/parser/recipe/adAstra/conversion.js.map +1 -1
  97. package/dist/parser/recipe/adAstra/hammering.d.ts +3 -17
  98. package/dist/parser/recipe/adAstra/hammering.js +2 -25
  99. package/dist/parser/recipe/adAstra/hammering.js.map +1 -1
  100. package/dist/parser/recipe/adAstra/inputOutput.d.ts +16 -19
  101. package/dist/parser/recipe/adAstra/inputOutput.js +37 -29
  102. package/dist/parser/recipe/adAstra/inputOutput.js.map +1 -1
  103. package/dist/parser/recipe/adAstra/nasaWorkbench.d.ts +3 -19
  104. package/dist/parser/recipe/adAstra/nasaWorkbench.js +2 -28
  105. package/dist/parser/recipe/adAstra/nasaWorkbench.js.map +1 -1
  106. package/dist/parser/recipe/adAstra/spaceStation.d.ts +15 -14
  107. package/dist/parser/recipe/adAstra/spaceStation.js +33 -14
  108. package/dist/parser/recipe/adAstra/spaceStation.js.map +1 -1
  109. package/dist/parser/recipe/botania/apothecary.d.ts +17 -14
  110. package/dist/parser/recipe/botania/apothecary.js +26 -17
  111. package/dist/parser/recipe/botania/apothecary.js.map +1 -1
  112. package/dist/parser/recipe/botania/blocks.d.ts +21 -0
  113. package/dist/parser/recipe/botania/blocks.js +77 -0
  114. package/dist/parser/recipe/botania/blocks.js.map +1 -0
  115. package/dist/parser/recipe/botania/brew.d.ts +13 -12
  116. package/dist/parser/recipe/botania/brew.js +16 -11
  117. package/dist/parser/recipe/botania/brew.js.map +1 -1
  118. package/dist/parser/recipe/botania/elvenTrade.d.ts +8 -13
  119. package/dist/parser/recipe/botania/elvenTrade.js +11 -22
  120. package/dist/parser/recipe/botania/elvenTrade.js.map +1 -1
  121. package/dist/parser/recipe/botania/gogWrapper.d.ts +12 -12
  122. package/dist/parser/recipe/botania/gogWrapper.js +14 -15
  123. package/dist/parser/recipe/botania/gogWrapper.js.map +1 -1
  124. package/dist/parser/recipe/botania/manaInfusion.d.ts +18 -15
  125. package/dist/parser/recipe/botania/manaInfusion.js +29 -21
  126. package/dist/parser/recipe/botania/manaInfusion.js.map +1 -1
  127. package/dist/parser/recipe/botania/nbtWrapper.d.ts +12 -12
  128. package/dist/parser/recipe/botania/nbtWrapper.js +12 -13
  129. package/dist/parser/recipe/botania/nbtWrapper.js.map +1 -1
  130. package/dist/parser/recipe/botania/orechid.d.ts +3 -30
  131. package/dist/parser/recipe/botania/orechid.js +2 -72
  132. package/dist/parser/recipe/botania/orechid.js.map +1 -1
  133. package/dist/parser/recipe/botania/pureDaisy.d.ts +3 -18
  134. package/dist/parser/recipe/botania/pureDaisy.js +2 -28
  135. package/dist/parser/recipe/botania/pureDaisy.js.map +1 -1
  136. package/dist/parser/recipe/botania/runicAltar.d.ts +8 -13
  137. package/dist/parser/recipe/botania/runicAltar.js +11 -22
  138. package/dist/parser/recipe/botania/runicAltar.js.map +1 -1
  139. package/dist/parser/recipe/botania/terraPlate.d.ts +4 -16
  140. package/dist/parser/recipe/botania/terraPlate.js +2 -25
  141. package/dist/parser/recipe/botania/terraPlate.js.map +1 -1
  142. package/dist/parser/recipe/create/assembly.d.ts +18 -17
  143. package/dist/parser/recipe/create/assembly.js +28 -28
  144. package/dist/parser/recipe/create/assembly.js.map +1 -1
  145. package/dist/parser/recipe/create/processing.d.ts +4 -16
  146. package/dist/parser/recipe/create/processing.js +2 -25
  147. package/dist/parser/recipe/create/processing.js.map +1 -1
  148. package/dist/parser/recipe/farmersdelight/cooking.d.ts +16 -12
  149. package/dist/parser/recipe/farmersdelight/cooking.js +27 -15
  150. package/dist/parser/recipe/farmersdelight/cooking.js.map +1 -1
  151. package/dist/parser/recipe/farmersdelight/cutting.d.ts +14 -15
  152. package/dist/parser/recipe/farmersdelight/cutting.js +32 -29
  153. package/dist/parser/recipe/farmersdelight/cutting.js.map +1 -1
  154. package/dist/parser/recipe/forge/conditional.d.ts +11 -11
  155. package/dist/parser/recipe/forge/conditional.js +17 -21
  156. package/dist/parser/recipe/forge/conditional.js.map +1 -1
  157. package/dist/parser/recipe/index.d.ts +36 -13
  158. package/dist/parser/recipe/index.js +38 -5
  159. package/dist/parser/recipe/index.js.map +1 -1
  160. package/dist/parser/recipe/ingredientMap.d.ts +12 -0
  161. package/dist/parser/recipe/ingredientMap.js +17 -0
  162. package/dist/parser/recipe/ingredientMap.js.map +1 -0
  163. package/dist/parser/recipe/manyToMany.d.ts +20 -0
  164. package/dist/parser/recipe/manyToMany.js +33 -0
  165. package/dist/parser/recipe/manyToMany.js.map +1 -0
  166. package/dist/parser/recipe/manyToOne.d.ts +20 -0
  167. package/dist/parser/recipe/manyToOne.js +33 -0
  168. package/dist/parser/recipe/manyToOne.js.map +1 -0
  169. package/dist/parser/recipe/oneToOne.d.ts +20 -0
  170. package/dist/parser/recipe/oneToOne.js +33 -0
  171. package/dist/parser/recipe/oneToOne.js.map +1 -0
  172. package/dist/parser/recipe/roots/component.d.ts +13 -12
  173. package/dist/parser/recipe/roots/component.js +16 -11
  174. package/dist/parser/recipe/roots/component.js.map +1 -1
  175. package/dist/parser/recipe/roots/ritual.d.ts +14 -16
  176. package/dist/parser/recipe/roots/ritual.js +18 -25
  177. package/dist/parser/recipe/roots/ritual.js.map +1 -1
  178. package/dist/parser/recipe/sullys/polishing.d.ts +4 -16
  179. package/dist/parser/recipe/sullys/polishing.js +2 -25
  180. package/dist/parser/recipe/sullys/polishing.js.map +1 -1
  181. package/dist/parser/recipe/thermal/catalyst.d.ts +13 -12
  182. package/dist/parser/recipe/thermal/catalyst.js +16 -11
  183. package/dist/parser/recipe/thermal/catalyst.js.map +1 -1
  184. package/dist/parser/recipe/thermal/fuel.d.ts +13 -12
  185. package/dist/parser/recipe/thermal/fuel.js +17 -11
  186. package/dist/parser/recipe/thermal/fuel.js.map +1 -1
  187. package/dist/parser/recipe/thermal/index.d.ts +16 -14
  188. package/dist/parser/recipe/thermal/index.js +35 -24
  189. package/dist/parser/recipe/thermal/index.js.map +1 -1
  190. package/dist/parser/recipe/thermal/ingredient.d.ts +4 -21
  191. package/dist/parser/recipe/thermal/ingredient.js +40 -33
  192. package/dist/parser/recipe/thermal/ingredient.js.map +1 -1
  193. package/dist/parser/recipe/thermal/treeExtraction.d.ts +17 -17
  194. package/dist/parser/recipe/thermal/treeExtraction.js +30 -31
  195. package/dist/parser/recipe/thermal/treeExtraction.js.map +1 -1
  196. package/dist/parser/recipe/vanilla/shaped.d.ts +17 -13
  197. package/dist/parser/recipe/vanilla/shaped.js +21 -16
  198. package/dist/parser/recipe/vanilla/shaped.js.map +1 -1
  199. package/dist/parser/recipe/vanilla/shapeless.d.ts +3 -17
  200. package/dist/parser/recipe/vanilla/shapeless.js +2 -25
  201. package/dist/parser/recipe/vanilla/shapeless.js.map +1 -1
  202. package/dist/parser/recipe/vanilla/smelting.d.ts +16 -13
  203. package/dist/parser/recipe/vanilla/smelting.js +21 -15
  204. package/dist/parser/recipe/vanilla/smelting.js.map +1 -1
  205. package/dist/parser/recipe/vanilla/smithing.d.ts +18 -14
  206. package/dist/parser/recipe/vanilla/smithing.js +25 -16
  207. package/dist/parser/recipe/vanilla/smithing.js.map +1 -1
  208. package/dist/parser/recipe/vanilla/stonecutting.d.ts +15 -13
  209. package/dist/parser/recipe/vanilla/stonecutting.js +22 -24
  210. package/dist/parser/recipe/vanilla/stonecutting.js.map +1 -1
  211. package/dist/parser/roots.d.ts +2 -4
  212. package/dist/parser/roots.js +2 -2
  213. package/dist/parser/roots.js.map +1 -1
  214. package/dist/parser/thermal.d.ts +4 -10
  215. package/dist/parser/thermal.js +4 -5
  216. package/dist/parser/thermal.js.map +1 -1
  217. package/dist/schema/data/recipe.d.ts +2 -1
  218. package/package.json +2 -1
  219. package/dist/common/ingredient.d.ts +0 -49
  220. package/dist/common/ingredient.js +0 -108
  221. package/dist/common/ingredient.js.map +0 -1
  222. package/dist/common/result.d.ts +0 -48
  223. package/dist/common/result.js +0 -37
  224. package/dist/common/result.js.map +0 -1
  225. package/dist/parser/recipe/adAstra/index.d.ts +0 -5
  226. package/dist/parser/recipe/adAstra/index.js +0 -1
  227. package/dist/parser/recipe/adAstra/index.js.map +0 -1
  228. package/dist/parser/recipe/ignored.d.ts +0 -10
  229. package/dist/parser/recipe/ignored.js +0 -16
  230. package/dist/parser/recipe/ignored.js.map +0 -1
  231. package/dist/parser/recipe/quark/exclusion.d.ts +0 -20
  232. package/dist/parser/recipe/quark/exclusion.js +0 -32
  233. package/dist/parser/recipe/quark/exclusion.js.map +0 -1
@@ -0,0 +1,33 @@
1
+ import RecipeParser, { Recipe, } from "./index.js";
2
+ export class OneToOneRecipe extends Recipe {
3
+ ingredient;
4
+ result;
5
+ constructor(ingredient, result) {
6
+ super();
7
+ this.ingredient = ingredient;
8
+ this.result = result;
9
+ }
10
+ getIngredients() {
11
+ return [this.ingredient];
12
+ }
13
+ getResults() {
14
+ return [this.result];
15
+ }
16
+ replace(ingredientReplacer, resultReplacer) {
17
+ return new OneToOneRecipe(ingredientReplacer(this.ingredient), resultReplacer(this.result));
18
+ }
19
+ serialize(context) {
20
+ return {
21
+ result: context.results.serialize(this.result),
22
+ ingredient: context.ingredients.serialize(this.ingredient),
23
+ };
24
+ }
25
+ }
26
+ export class OneToOneRecipeParser extends RecipeParser {
27
+ deserialize(definition, context) {
28
+ const ingredient = context.ingredients.create(definition.ingredient);
29
+ const result = context.results.create(definition.result);
30
+ return new OneToOneRecipe(ingredient, result);
31
+ }
32
+ }
33
+ //# sourceMappingURL=oneToOne.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oneToOne.js","sourceRoot":"","sources":["../../../src/parser/recipe/oneToOne.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,EAAE,EACnB,MAAM,GAGP,MAAM,YAAY,CAAC;AAQpB,MAAM,OAAO,cAAe,SAAQ,MAAM;IAEnB;IACA;IAFrB,YACqB,UAAsB,EACtB,MAAc;QAEjC,KAAK,EAAE,CAAC;QAHW,eAAU,GAAV,UAAU,CAAY;QACtB,WAAM,GAAN,MAAM,CAAQ;IAGnC,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvB,CAAC;IAEQ,OAAO,CACd,kBAAwC,EACxC,cAAgC;QAEhC,OAAO,IAAI,cAAc,CACvB,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,EACnC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAC5B,CAAC;IACJ,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9C,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3D,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,oBAEX,SAAQ,YAAyC;IACjD,WAAW,CACT,UAAuB,EACvB,OAA2B;QAE3B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -1,18 +1,19 @@
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";
3
+ import type { RecipeParseContext, Replacer } from "../index.js";
4
+ import RecipeParser, { Recipe } from "../index.js";
6
5
  export type RootComponentRecipeDefinition = RecipeDefinition & Readonly<{
7
6
  effect: string;
8
- ingredients: Ingredient[];
7
+ ingredients: unknown[];
9
8
  }>;
10
- export declare class RootComponentRecipe extends Recipe<RootComponentRecipeDefinition> {
11
- getIngredients(): IngredientInput[];
12
- getResults(): ResultInput[];
13
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
14
- replaceResult(): RootComponentRecipe;
9
+ export declare class RootComponentRecipe extends Recipe {
10
+ private readonly ingredients;
11
+ constructor(ingredients: Ingredient[]);
12
+ getIngredients(): Ingredient[];
13
+ getResults(): never[];
14
+ replace(ingredientReplacer: Replacer<Ingredient>): RootComponentRecipe;
15
+ serialize(context: RecipeParseContext): Partial<RootComponentRecipeDefinition>;
15
16
  }
16
- export default class RootComponentRecipeParser extends RecipeParser<RootComponentRecipeDefinition, RootComponentRecipe> {
17
- create(definition: RootComponentRecipeDefinition): RootComponentRecipe;
17
+ export declare class RootComponentRecipeParser extends RecipeParser<RootComponentRecipeDefinition, RootComponentRecipe> {
18
+ deserialize(definition: RootComponentRecipeDefinition, context: RecipeParseContext): RootComponentRecipe;
18
19
  }
@@ -1,24 +1,29 @@
1
1
  import RecipeParser, { Recipe } from "../index.js";
2
2
  export class RootComponentRecipe extends Recipe {
3
+ ingredients;
4
+ constructor(ingredients) {
5
+ super();
6
+ this.ingredients = ingredients;
7
+ }
3
8
  getIngredients() {
4
- return this.definition.ingredients;
9
+ return this.ingredients;
5
10
  }
6
11
  getResults() {
7
12
  return [];
8
13
  }
9
- replaceIngredient(replace) {
10
- return new RootComponentRecipe({
11
- ...this.definition,
12
- ingredients: this.definition.ingredients.map(replace),
13
- });
14
+ replace(ingredientReplacer) {
15
+ return new RootComponentRecipe(this.ingredients.map(ingredientReplacer));
14
16
  }
15
- replaceResult() {
16
- return new RootComponentRecipe(this.definition);
17
+ serialize(context) {
18
+ return {
19
+ ingredients: context.ingredients.serializeList(this.ingredients),
20
+ };
17
21
  }
18
22
  }
19
- export default class RootComponentRecipeParser extends RecipeParser {
20
- create(definition) {
21
- return new RootComponentRecipe(definition);
23
+ export class RootComponentRecipeParser extends RecipeParser {
24
+ deserialize(definition, context) {
25
+ const ingredients = context.ingredients.createList(definition.ingredients);
26
+ return new RootComponentRecipe(ingredients);
22
27
  }
23
28
  }
24
29
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/parser/recipe/roots/component.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcnD,MAAM,OAAO,mBAAoB,SAAQ,MAAqC;IAC5E,cAAc;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;IACrC,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,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,OAAO,CAAC;SACtD,CAAC,CAAC;IACL,CAAC;IAED,aAAa;QACX,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClD,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":"component.js","sourceRoot":"","sources":["../../../../src/parser/recipe/roots/component.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQnD,MAAM,OAAO,mBAAoB,SAAQ,MAAM;IAChB;IAA7B,YAA6B,WAAyB;QACpD,KAAK,EAAE,CAAC;QADmB,gBAAW,GAAX,WAAW,CAAc;IAEtD,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;IAEQ,OAAO,CAAC,kBAAwC;QACvD,OAAO,IAAI,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAC3E,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;SACjE,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,YAG9C;IACC,WAAW,CACT,UAAyC,EACzC,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3E,OAAO,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -1,22 +1,20 @@
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 RootRitualRecipeDefinition = RecipeDefinition & Readonly<{
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
3
+ import type { RecipeParseContext, Replacer } from "../index.js";
4
+ import RecipeParser from "../index.js";
5
+ import { ManyToOneRecipe, type ManyToOneRecipeDefinition } from "../manyToOne.js";
6
+ export type RootRitualRecipeDefinition = ManyToOneRecipeDefinition & Readonly<{
7
7
  color: string;
8
8
  effect: string;
9
9
  level: number;
10
- incenses?: Ingredient[];
11
- ingredients?: Ingredient[];
12
- result?: Result;
10
+ incenses?: unknown[];
13
11
  }>;
14
- export declare class RootRitualRecipe extends Recipe<RootRitualRecipeDefinition> {
15
- getIngredients(): IngredientInput[];
16
- getResults(): ResultInput[];
17
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
18
- replaceResult(replace: Replacer<Result>): RootRitualRecipe;
12
+ export declare class RootRitualRecipe extends ManyToOneRecipe {
13
+ private readonly incenses;
14
+ constructor(ingredients: Ingredient[], result: Result, incenses?: Ingredient[]);
15
+ getIngredients(): Ingredient[];
16
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): RootRitualRecipe;
19
17
  }
20
- export default class RootRitualRecipeParser extends RecipeParser<RootRitualRecipeDefinition, RootRitualRecipe> {
21
- create(definition: RootRitualRecipeDefinition): RootRitualRecipe;
18
+ export declare class RootRitualRecipeParser extends RecipeParser<RootRitualRecipeDefinition, RootRitualRecipe> {
19
+ deserialize(definition: RootRitualRecipeDefinition, context: RecipeParseContext): RootRitualRecipe;
22
20
  }
@@ -1,32 +1,25 @@
1
- import { exists } from "@adeficior/pack-resolver";
2
- import RecipeParser, { Recipe } from "../index.js";
3
- export class RootRitualRecipe extends Recipe {
4
- getIngredients() {
5
- return [
6
- ...(this.definition.ingredients ?? []),
7
- ...(this.definition.incenses ?? []),
8
- ];
9
- }
10
- getResults() {
11
- return [this.definition.result].filter(exists);
1
+ import RecipeParser from "../index.js";
2
+ import { ManyToOneRecipe, } from "../manyToOne.js";
3
+ export class RootRitualRecipe extends ManyToOneRecipe {
4
+ incenses;
5
+ constructor(ingredients, result, incenses = []) {
6
+ super(ingredients, result);
7
+ this.incenses = incenses;
12
8
  }
13
- replaceIngredient(replace) {
14
- return new RootRitualRecipe({
15
- ...this.definition,
16
- ingredients: this.definition.ingredients?.map(replace),
17
- incenses: this.definition.incenses?.map(replace),
18
- });
9
+ getIngredients() {
10
+ return [...super.getIngredients(), ...this.incenses];
19
11
  }
20
- replaceResult(replace) {
21
- return new RootRitualRecipe({
22
- ...this.definition,
23
- result: this.definition.result && replace(this.definition.result),
24
- });
12
+ replace(ingredientReplacer, resultReplacer) {
13
+ return new RootRitualRecipe(this.incenses.map(ingredientReplacer), resultReplacer(this.result), this.incenses.map(ingredientReplacer));
25
14
  }
26
15
  }
27
- export default class RootRitualRecipeParser extends RecipeParser {
28
- create(definition) {
29
- return new RootRitualRecipe(definition);
16
+ export class RootRitualRecipeParser extends RecipeParser {
17
+ deserialize(definition, context) {
18
+ const ingredients = context.ingredients.createList(definition.ingredients);
19
+ const result = context.results.create(definition.result);
20
+ const incenses = definition.incenses &&
21
+ context.ingredients.createList(definition.incenses);
22
+ return new RootRitualRecipe(ingredients, result, incenses);
30
23
  }
31
24
  }
32
25
  //# sourceMappingURL=ritual.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ritual.js","sourceRoot":"","sources":["../../../../src/parser/recipe/roots/ritual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAQlD,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAYnD,MAAM,OAAO,gBAAiB,SAAQ,MAAkC;IACtE,cAAc;QACZ,OAAO;YACL,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,EAAE,CAAC;YACtC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC;SACpC,CAAC;IACJ,CAAC;IAED,UAAU;QACR,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC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gBAAgB,CACzB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC,EACrC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAC3B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC,CACtC,CAAC;IACJ,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,YAG3C;IACC,WAAW,CACT,UAAsC,EACtC,OAA2B;QAE3B,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAC3E,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,QAAQ,GACZ,UAAU,CAAC,QAAQ;YACnB,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QACtD,OAAO,IAAI,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -1,19 +1,7 @@
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 GrindstonePolishingDefinition = RecipeDefinition & Readonly<{
7
- ingredients: Ingredient[];
8
- result: Result;
1
+ import type { ManyToOneRecipeDefinition } from "../manyToOne.js";
2
+ import { ManyToOneRecipeParser } from "../manyToOne.js";
3
+ export type GrindstonePolishingDefinition = ManyToOneRecipeDefinition & Readonly<{
9
4
  experience?: number;
10
5
  }>;
11
- export declare class GrindstonePolishing extends Recipe<GrindstonePolishingDefinition> {
12
- getIngredients(): IngredientInput[];
13
- getResults(): ResultInput[];
14
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
15
- replaceResult(replace: Replacer<Result>): Recipe;
16
- }
17
- export default class GrindstonePolishingParser extends RecipeParser<GrindstonePolishingDefinition, GrindstonePolishing> {
18
- create(definition: GrindstonePolishingDefinition): GrindstonePolishing;
6
+ export declare class GrindstonePolishingParser extends ManyToOneRecipeParser<GrindstonePolishingDefinition> {
19
7
  }
@@ -1,27 +1,4 @@
1
- import RecipeParser, { Recipe } from "../index.js";
2
- export class GrindstonePolishing extends Recipe {
3
- getIngredients() {
4
- return this.definition.ingredients;
5
- }
6
- getResults() {
7
- return [this.definition.result];
8
- }
9
- replaceIngredient(replace) {
10
- return new GrindstonePolishing({
11
- ...this.definition,
12
- ingredients: this.definition.ingredients.map(replace),
13
- });
14
- }
15
- replaceResult(replace) {
16
- return new GrindstonePolishing({
17
- ...this.definition,
18
- result: replace(this.definition.result),
19
- });
20
- }
21
- }
22
- export default class GrindstonePolishingParser extends RecipeParser {
23
- create(definition) {
24
- return new GrindstonePolishing(definition);
25
- }
1
+ import { ManyToOneRecipeParser } from "../manyToOne.js";
2
+ export class GrindstonePolishingParser extends ManyToOneRecipeParser {
26
3
  }
27
4
  //# sourceMappingURL=polishing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"polishing.js","sourceRoot":"","sources":["../../../../src/parser/recipe/sullys/polishing.ts"],"names":[],"mappings":"AAOA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASnD,MAAM,OAAO,mBAAoB,SAAQ,MAAqC;IAC5E,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,mBAAmB,CAAC;YAC7B,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,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":"polishing.js","sourceRoot":"","sources":["../../../../src/parser/recipe/sullys/polishing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAOxD,MAAM,OAAO,yBAA0B,SAAQ,qBAAoD;CAAG"}
@@ -1,22 +1,23 @@
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";
3
+ import type { RecipeParseContext, Replacer } from "../index.js";
4
+ import RecipeParser, { Recipe } from "../index.js";
6
5
  export type ThermalCatalystRecipeDefinition = RecipeDefinition & Readonly<{
7
- ingredient: Ingredient;
6
+ ingredient: unknown;
8
7
  primary_mod?: number;
9
8
  secondary_mod?: number;
10
9
  energy_mod?: number;
11
10
  min_chance?: number;
12
11
  use_chance?: number;
13
12
  }>;
14
- export declare class ThermalCatalystRecipe extends Recipe<ThermalCatalystRecipeDefinition> {
15
- getIngredients(): IngredientInput[];
16
- getResults(): ResultInput[];
17
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
18
- replaceResult(): ThermalCatalystRecipe;
13
+ export declare class ThermalCatalystRecipe extends Recipe {
14
+ private readonly ingredient;
15
+ constructor(ingredient: Ingredient);
16
+ getIngredients(): Ingredient[];
17
+ getResults(): never[];
18
+ replace(ingredientReplacer: Replacer<Ingredient>): Recipe;
19
+ serialize(context: RecipeParseContext): Partial<ThermalCatalystRecipeDefinition>;
19
20
  }
20
- export default class ThermalCatalystRecipeParser extends RecipeParser<ThermalCatalystRecipeDefinition, ThermalCatalystRecipe> {
21
- create(definition: ThermalCatalystRecipeDefinition): ThermalCatalystRecipe;
21
+ export declare class ThermalCatalystRecipeParser extends RecipeParser<ThermalCatalystRecipeDefinition, ThermalCatalystRecipe> {
22
+ deserialize(definition: ThermalCatalystRecipeDefinition, context: RecipeParseContext): ThermalCatalystRecipe;
22
23
  }
@@ -1,24 +1,29 @@
1
1
  import RecipeParser, { Recipe } from "../index.js";
2
2
  export class ThermalCatalystRecipe extends Recipe {
3
+ ingredient;
4
+ constructor(ingredient) {
5
+ super();
6
+ this.ingredient = ingredient;
7
+ }
3
8
  getIngredients() {
4
- return [this.definition.ingredient];
9
+ return [this.ingredient];
5
10
  }
6
11
  getResults() {
7
12
  return [];
8
13
  }
9
- replaceIngredient(replace) {
10
- return new ThermalCatalystRecipe({
11
- ...this.definition,
12
- ingredient: replace(this.definition.ingredient),
13
- });
14
+ replace(ingredientReplacer) {
15
+ return new ThermalCatalystRecipe(ingredientReplacer(this.ingredient));
14
16
  }
15
- replaceResult() {
16
- return new ThermalCatalystRecipe(this.definition);
17
+ serialize(context) {
18
+ return {
19
+ ingredient: context.ingredients.serialize(this.ingredient),
20
+ };
17
21
  }
18
22
  }
19
- export default class ThermalCatalystRecipeParser extends RecipeParser {
20
- create(definition) {
21
- return new ThermalCatalystRecipe(definition);
23
+ export class ThermalCatalystRecipeParser extends RecipeParser {
24
+ deserialize(definition, context) {
25
+ const ingredient = context.ingredients.create(definition.ingredient);
26
+ return new ThermalCatalystRecipe(ingredient);
22
27
  }
23
28
  }
24
29
  //# sourceMappingURL=catalyst.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalyst.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/catalyst.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkBnD,MAAM,OAAO,qBAAsB,SAAQ,MAAuC;IAChF,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,qBAAqB,CAAC;YAC/B,GAAG,IAAI,CAAC,UAAU;YAClB,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;IAED,aAAa;QACX,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpD,CAAC;CACF;AAED,MAAM,CAAC,OAAO,OAAO,2BAA4B,SAAQ,YAGxD;IACC,MAAM,CAAC,UAA2C;QAChD,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;CACF"}
1
+ {"version":3,"file":"catalyst.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/catalyst.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAYnD,MAAM,OAAO,qBAAsB,SAAQ,MAAM;IAClB;IAA7B,YAA6B,UAAsB;QACjD,KAAK,EAAE,CAAC;QADmB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC3B,CAAC;IAED,UAAU;QACR,OAAO,EAAE,CAAC;IACZ,CAAC;IAEQ,OAAO,CAAC,kBAAwC;QACvD,OAAO,IAAI,qBAAqB,CAAC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IACxE,CAAC;IAEQ,SAAS,CAChB,OAA2B;QAE3B,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;SAC3D,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,UAAU,CAAC,CAAC;QACrE,OAAO,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -1,18 +1,19 @@
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";
3
+ import type { RecipeParseContext, Replacer } from "../index.js";
4
+ import RecipeParser, { Recipe } from "../index.js";
6
5
  export type ThermalFuelRecipeDefinition = RecipeDefinition & Readonly<{
7
6
  energy: number;
8
- ingredient: Ingredient;
7
+ ingredient: unknown;
9
8
  }>;
10
- export declare class ThermalFuelRecipe extends Recipe<ThermalFuelRecipeDefinition> {
11
- getIngredients(): IngredientInput[];
12
- getResults(): ResultInput[];
13
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
14
- replaceResult(): ThermalFuelRecipe;
9
+ export declare class ThermalFuelRecipe extends Recipe {
10
+ private readonly ingredient;
11
+ constructor(ingredient: Ingredient);
12
+ getIngredients(): Ingredient[];
13
+ getResults(): never[];
14
+ replace(ingredientReplacer: Replacer<Ingredient>): Recipe;
15
+ serialize(context: RecipeParseContext): Partial<ThermalFuelRecipeDefinition>;
15
16
  }
16
- export default class ThermalFuelRecipeParser extends RecipeParser<ThermalFuelRecipeDefinition, ThermalFuelRecipe> {
17
- create(definition: ThermalFuelRecipeDefinition): ThermalFuelRecipe;
17
+ export declare class ThermalFuelRecipeParser extends RecipeParser<ThermalFuelRecipeDefinition, ThermalFuelRecipe> {
18
+ deserialize(definition: ThermalFuelRecipeDefinition, context: RecipeParseContext): ThermalFuelRecipe;
18
19
  }
@@ -1,24 +1,30 @@
1
1
  import RecipeParser, { Recipe } from "../index.js";
2
+ // TODO could be same as catalyst
2
3
  export class ThermalFuelRecipe extends Recipe {
4
+ ingredient;
5
+ constructor(ingredient) {
6
+ super();
7
+ this.ingredient = ingredient;
8
+ }
3
9
  getIngredients() {
4
- return [this.definition.ingredient];
10
+ return [this.ingredient];
5
11
  }
6
12
  getResults() {
7
13
  return [];
8
14
  }
9
- replaceIngredient(replace) {
10
- return new ThermalFuelRecipe({
11
- ...this.definition,
12
- ingredient: replace(this.definition.ingredient),
13
- });
15
+ replace(ingredientReplacer) {
16
+ return new ThermalFuelRecipe(ingredientReplacer(this.ingredient));
14
17
  }
15
- replaceResult() {
16
- return new ThermalFuelRecipe(this.definition);
18
+ serialize(context) {
19
+ return {
20
+ ingredient: context.ingredients.serialize(this.ingredient),
21
+ };
17
22
  }
18
23
  }
19
- export default class ThermalFuelRecipeParser extends RecipeParser {
20
- create(definition) {
21
- return new ThermalFuelRecipe(definition);
24
+ export class ThermalFuelRecipeParser extends RecipeParser {
25
+ deserialize(definition, context) {
26
+ const ingredient = context.ingredients.create(definition.ingredient);
27
+ return new ThermalFuelRecipe(ingredient);
22
28
  }
23
29
  }
24
30
  //# sourceMappingURL=fuel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fuel.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/fuel.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcnD,MAAM,OAAO,iBAAkB,SAAQ,MAAmC;IACxE,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,CAAC;I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AAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QACrE,OAAO,IAAI,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;CACF"}
@@ -1,22 +1,24 @@
1
- import type { Ingredient, IngredientInput } from "../../../common/ingredient.js";
2
- import type { Result, ResultInput } from "../../../common/result.js";
1
+ import type { Ingredient } from "../../../common/ingredient/index.js";
2
+ import type { Result } from "../../../common/result/index.js";
3
3
  import type { RecipeDefinition } from "../../../schema/data/recipe.js";
4
- import type { Replacer } from "../index.js";
4
+ import type { RecipeParseContext, Replacer } from "../index.js";
5
5
  import RecipeParser, { Recipe } from "../index.js";
6
- import type { ThermalIngredientInput } from "./ingredient.js";
7
6
  export type ThermalRecipeDefinition = RecipeDefinition & Readonly<{
8
- ingredient?: ThermalIngredientInput;
9
- ingredients?: ThermalIngredientInput[];
10
- result: Result[] | Result;
7
+ ingredient?: unknown;
8
+ ingredients?: unknown[];
9
+ result: unknown;
11
10
  energy?: number;
12
11
  experience?: number;
13
12
  }>;
14
- export declare class ThermalRecipe extends Recipe<ThermalRecipeDefinition> {
15
- getIngredients(): IngredientInput[];
16
- getResults(): ResultInput[];
17
- replaceIngredient(replace: Replacer<Ingredient>): Recipe;
18
- replaceResult(replace: Replacer<Result>): Recipe;
13
+ export declare class ThermalRecipe extends Recipe {
14
+ private readonly ingredients;
15
+ private readonly results;
16
+ constructor(ingredients: Ingredient[], results: Result[]);
17
+ getIngredients(): Ingredient[];
18
+ getResults(): Result[];
19
+ replace(ingredientReplacer: Replacer<Ingredient>, resultReplacer: Replacer<Result>): Recipe;
20
+ serialize(context: RecipeParseContext): Partial<ThermalRecipeDefinition>;
19
21
  }
20
- export default class ThermalRecipeParser extends RecipeParser<ThermalRecipeDefinition, ThermalRecipe> {
21
- create(definition: ThermalRecipeDefinition): ThermalRecipe;
22
+ export declare class ThermalRecipeParser extends RecipeParser<ThermalRecipeDefinition, ThermalRecipe> {
23
+ deserialize(definition: ThermalRecipeDefinition, context: RecipeParseContext): ThermalRecipe;
22
24
  }
@@ -1,36 +1,47 @@
1
- import { arrayOrSelf, exists } from "@adeficior/pack-resolver";
1
+ import { IllegalShapeError } from "../../../error.js";
2
2
  import RecipeParser, { Recipe } from "../index.js";
3
- import { fromThermalIngredient, toThermalIngredient } from "./ingredient.js";
4
3
  export class ThermalRecipe extends Recipe {
4
+ ingredients;
5
+ results;
6
+ constructor(ingredients, results) {
7
+ super();
8
+ this.ingredients = ingredients;
9
+ this.results = results;
10
+ }
5
11
  getIngredients() {
6
- return [this.definition.ingredient, ...(this.definition.ingredients ?? [])]
7
- .filter(exists)
8
- .map(fromThermalIngredient);
12
+ return this.ingredients;
9
13
  }
10
14
  getResults() {
11
- return arrayOrSelf(this.definition.result);
15
+ return this.results;
12
16
  }
13
- replaceIngredient(replace) {
14
- return new ThermalRecipe({
15
- ...this.definition,
16
- ingredient: this.definition.ingredient &&
17
- toThermalIngredient(replace(fromThermalIngredient(this.definition.ingredient))),
18
- ingredients: this.definition.ingredients
19
- ?.map(fromThermalIngredient)
20
- ?.map(replace)
21
- ?.map(toThermalIngredient),
22
- });
17
+ replace(ingredientReplacer, resultReplacer) {
18
+ return new ThermalRecipe(this.ingredients.map(ingredientReplacer), this.results.map(resultReplacer));
23
19
  }
24
- replaceResult(replace) {
25
- return new ThermalRecipe({
26
- ...this.definition,
27
- result: arrayOrSelf(this.definition.result).map(replace),
28
- });
20
+ serialize(context) {
21
+ const serialized = {
22
+ result: context.results.serializeList(this.results),
23
+ };
24
+ if (this.ingredients.length === 1) {
25
+ serialized.ingredient = context.ingredients.serialize(this.ingredients[0]);
26
+ }
27
+ else {
28
+ serialized.ingredients = context.ingredients.serializeList(this.ingredients);
29
+ }
30
+ return serialized;
29
31
  }
30
32
  }
31
- export default class ThermalRecipeParser extends RecipeParser {
32
- create(definition) {
33
- return new ThermalRecipe(definition);
33
+ export class ThermalRecipeParser extends RecipeParser {
34
+ deserialize(definition, context) {
35
+ // TODO map from and to thermals shape
36
+ const ingredients = definition.ingredient
37
+ ? [context.ingredients.create(definition.ingredient)]
38
+ : context.ingredients.createList(definition.ingredients ?? []);
39
+ if (ingredients.length === 0)
40
+ throw new IllegalShapeError("ingredients missing or empty", definition);
41
+ const results = Array.isArray(definition.result)
42
+ ? context.results.createList(definition.result)
43
+ : [context.results.create(definition.result)];
44
+ return new ThermalRecipe(ingredients, results);
34
45
  }
35
46
  }
36
47
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/parser/recipe/thermal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAQ/D,OAAO,YAAY,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAW7E,MAAM,OAAO,aAAc,SAAQ,MAA+B;IAChE,cAAc;QACZ,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;aACxE,MAAM,CAAC,MAAM,CAAC;aACd,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAChC,CAAC;IAED,UAAU;QACR,OAAO,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,iBAAiB,CAAC,OAA6B;QAC7C,OAAO,IAAI,aAAa,CAAC;YACvB,GAAG,IAAI,CAAC,UAAU;YAClB,UAAU,EACR,IAAI,CAAC,UAAU,CAAC,UAAU;gBAC1B,mBAAmB,CACjB,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAC3D;YACH,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;gBACtC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
1
- import zod from "zod";
2
- import type { FluidTag, Ingredient, IngredientInput } from "../../../common/ingredient.js";
3
- declare const ThermalFluidTagSchema: zod.ZodObject<{
4
- fluid_tag: zod.ZodString;
5
- amount: zod.ZodNumber;
6
- }, "strip", zod.ZodTypeAny, {
7
- amount: number;
8
- fluid_tag: string;
9
- }, {
10
- amount: number;
11
- fluid_tag: string;
12
- }>;
13
- type ThermalFluidTag = zod.infer<typeof ThermalFluidTagSchema>;
14
- type ThermalItemList = Readonly<{
15
- value: ThermalIngredientInput[];
16
- count?: number;
17
- }>;
18
- export type ThermalIngredientInput = Exclude<IngredientInput, FluidTag> | ThermalFluidTag | ThermalItemList;
19
- export declare function fromThermalIngredient(input: ThermalIngredientInput): Ingredient;
20
- export declare function toThermalIngredient(input: IngredientInput): ThermalIngredientInput;
21
- export {};
1
+ import { type Ingredient } from "../../../common/ingredient/index.js";
2
+ import type IngredientSerializer from "../../../common/ingredient/serializer.js";
3
+ export declare function createThermalIngredients(ingredients: IngredientSerializer, input: unknown): Ingredient[];
4
+ export declare function serializeThermalIngredient(ingredients: IngredientSerializer, ingredient: Ingredient): unknown;