diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9b45cc6..2a93d5e 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -22,7 +22,7 @@ jobs: node-version: '14' - name: 'Cache dependencies' - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: '**/node_modules' key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} diff --git a/src/api.d.ts b/src/api.d.ts index 44c0252..f50d989 100644 --- a/src/api.d.ts +++ b/src/api.d.ts @@ -21,4 +21,6 @@ export interface API_Recipes_Entry { export interface API_Recipes_Entry_Next extends API_Recipes_Entry { multipleRecipeCount: number + daily_purchase_cap?: number + weekly_purchase_cap?: number } diff --git a/src/index.ts b/src/index.ts index 85d63a8..5f41c3c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,8 @@ interface TransformedRecipe { merchant?: { name: string; locations: Array } prerequisites: Prerequisites multipleRecipeCount: number + daily_purchase_cap?: number + weekly_purchase_cap?: number } interface TransformedRecipeInternal extends TransformedRecipe { @@ -82,6 +84,8 @@ function transformRecipe(recipe: API_Recipes_Entry_Next): TransformedRecipeInter achievement_id: recipe.achievement_id, merchant: recipe.merchant, multipleRecipeCount: recipe.multipleRecipeCount, + daily_purchase_cap: recipe.daily_purchase_cap ? recipe.daily_purchase_cap : 0, + weekly_purchase_cap: recipe.weekly_purchase_cap ? recipe.weekly_purchase_cap : 0, } } diff --git a/tests/__snapshots__/index.spec.ts.snap b/tests/__snapshots__/index.spec.ts.snap index 6644b2a..1813961 100644 --- a/tests/__snapshots__/index.spec.ts.snap +++ b/tests/__snapshots__/index.spec.ts.snap @@ -10,6 +10,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -31,6 +32,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -44,6 +46,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -65,6 +68,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -81,6 +85,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -102,6 +107,7 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -112,6 +118,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Armorsmith", "Artificer", @@ -135,6 +142,7 @@ Object { "quantity": 3, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "id": 1, @@ -147,6 +155,7 @@ Object { "type": "Currency", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -168,6 +177,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -184,6 +194,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -205,6 +216,7 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -220,6 +232,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Armorsmith", "Artificer", @@ -242,8 +255,10 @@ Object { "quantity": 3, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -264,6 +279,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -282,6 +298,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Armorsmith", "Artificer", @@ -304,6 +321,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -326,6 +344,7 @@ Array [ "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Scribe", ], @@ -344,8 +363,10 @@ Array [ "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Scribe", ], @@ -364,6 +385,7 @@ Array [ "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -379,6 +401,7 @@ Array [ "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Scribe", ], @@ -397,6 +420,7 @@ Array [ "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ] `; @@ -427,6 +451,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Armorsmith", "Artificer", @@ -449,8 +474,10 @@ Object { "quantity": 3, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Scribe", ], @@ -469,8 +496,10 @@ Object { "quantity": 7, "type": "Recipe", "upgrade_id": 696, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Leatherworker", "Armorsmith", @@ -491,6 +520,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -523,6 +553,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -544,8 +575,10 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -567,6 +600,7 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -585,6 +619,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -606,6 +641,7 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "id": 88775, @@ -613,6 +649,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Scribe", ], @@ -631,8 +668,10 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": 9001, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -654,8 +693,10 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -677,6 +718,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -695,6 +737,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -716,6 +759,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -745,6 +789,7 @@ Array [ "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Mystic Forge", ], @@ -763,6 +808,7 @@ Array [ "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -788,6 +834,7 @@ Array [ "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Mystic Forge", ], @@ -806,6 +853,7 @@ Array [ "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -831,6 +879,7 @@ Array [ "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Mystic Forge", ], @@ -849,6 +898,7 @@ Array [ "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -874,6 +924,7 @@ Array [ "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Mystic Forge", ], @@ -892,6 +943,7 @@ Array [ "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ] `; @@ -914,6 +966,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Leatherworker", "Armorsmith", @@ -935,6 +988,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "id": 24285, @@ -947,6 +1001,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Leatherworker", "Armorsmith", @@ -967,6 +1022,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; @@ -983,6 +1039,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1004,6 +1061,7 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -1017,6 +1075,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1038,8 +1097,10 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1061,6 +1122,7 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -1074,6 +1136,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1095,8 +1158,10 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1118,6 +1183,7 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, Object { "achievement_id": undefined, @@ -1131,6 +1197,7 @@ Object { "type": "Item", }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1152,8 +1219,10 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1175,8 +1244,10 @@ Object { "quantity": 2, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, }, ], + "daily_purchase_cap": 0, "disciplines": Array [ "Artificer", "Weaponsmith", @@ -1198,5 +1269,6 @@ Object { "quantity": 1, "type": "Recipe", "upgrade_id": undefined, + "weekly_purchase_cap": 0, } `; diff --git a/tests/index.spec.ts b/tests/index.spec.ts index 2499f4d..d814342 100644 --- a/tests/index.spec.ts +++ b/tests/index.spec.ts @@ -16,6 +16,8 @@ describe('recipe-nesting', () => { output_item_count_range: '1-10', achievement_id: 12, multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -28,6 +30,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -40,6 +44,8 @@ describe('recipe-nesting', () => { id: 21, chat_link: '[&CRUAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -57,6 +63,8 @@ describe('recipe-nesting', () => { id: 39, chat_link: '[&CScAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -69,6 +77,8 @@ describe('recipe-nesting', () => { id: 3, chat_link: '[&CQMAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -84,6 +94,8 @@ describe('recipe-nesting', () => { id: 16, chat_link: '[&CRAAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -99,6 +111,8 @@ describe('recipe-nesting', () => { id: 30, chat_link: '[&CR4AAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -111,6 +125,8 @@ describe('recipe-nesting', () => { id: 7, chat_link: '[&CQcAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Insignia', @@ -128,6 +144,8 @@ describe('recipe-nesting', () => { id: 69, chat_link: '[&CUUAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Fake', @@ -144,6 +162,8 @@ describe('recipe-nesting', () => { id: 69, chat_link: '[&CUUAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'GuildDecoration', @@ -157,6 +177,8 @@ describe('recipe-nesting', () => { id: 11756, chat_link: '[&CewtAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Fake too', @@ -171,6 +193,8 @@ describe('recipe-nesting', () => { id: 69, chat_link: '[&CUUAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -186,6 +210,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -201,6 +227,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -216,6 +244,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -228,6 +258,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'GuildDecoration', @@ -244,6 +276,8 @@ describe('recipe-nesting', () => { id: 900011, chat_link: '[&CewtAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -261,6 +295,8 @@ describe('recipe-nesting', () => { id: 1293083123, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -273,6 +309,8 @@ describe('recipe-nesting', () => { id: 987654645, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -285,6 +323,8 @@ describe('recipe-nesting', () => { id: 767567, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -297,6 +337,8 @@ describe('recipe-nesting', () => { id: 2344356, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -309,6 +351,8 @@ describe('recipe-nesting', () => { id: 12421412312, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'CraftingMaterial', @@ -320,6 +364,8 @@ describe('recipe-nesting', () => { id: -1626, chat_link: '[&FAAAKE=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, ] @@ -363,6 +409,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Refinement', @@ -378,6 +426,8 @@ describe('recipe-nesting', () => { id: 1, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 1, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, ] const decorations = { 42: 1337 } @@ -436,6 +486,8 @@ describe('recipe-nesting', () => { id: 1, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 3, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Recipe', @@ -469,6 +521,8 @@ describe('recipe-nesting', () => { id: 2, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 3, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Recipe', @@ -502,6 +556,8 @@ describe('recipe-nesting', () => { id: 3, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 3, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, { type: 'Recipe', @@ -535,6 +591,8 @@ describe('recipe-nesting', () => { id: 4, chat_link: '[&CQIAAAA=]', multipleRecipeCount: 3, + daily_purchase_cap: 0, + weekly_purchase_cap: 0, }, ]