From a1c99f38923a614a07e1f3ab8806ba19b312b009 Mon Sep 17 00:00:00 2001 From: Ken Eucker Date: Thu, 4 Jan 2024 23:08:39 -0800 Subject: [PATCH 1/2] fix(sanity): adds the group field to the Achievement class --- package-lock.json | 4 ++-- package.json | 2 +- src/common/data.ts | 1 + src/common/schema.ts | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a8d7b69..298d338 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "biketag", - "version": "3.2.5", + "version": "3.2.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "biketag", - "version": "3.2.5", + "version": "3.2.6", "license": "AGPL-3.0-or-later", "dependencies": { "@sanity/client": "2.25.1-feature-image-file-input-refactor.150", diff --git a/package.json b/package.json index b50f4ea..da929de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "biketag", - "version": "3.2.5", + "version": "3.2.6", "description": "The Javascript client API for BikeTag Games", "main": "./biketag.node.js", "browser": "./biketag.js", diff --git a/src/common/data.ts b/src/common/data.ts index 55ff131..8fea7bf 100644 --- a/src/common/data.ts +++ b/src/common/data.ts @@ -168,6 +168,7 @@ export const createAchievementObject = ( name: achievementData.name ?? '', key: achievementData.key ?? '', value: achievementData.value ?? '', + group: achievementData.value ?? '', } as Achievement } export const achievementDataFields = Object.keys(createAchievementObject()) diff --git a/src/common/schema.ts b/src/common/schema.ts index 6e80b59..dce907f 100644 --- a/src/common/schema.ts +++ b/src/common/schema.ts @@ -27,6 +27,7 @@ export type Achievement = { description: string key: string value: string + group: string } export type Region = { From 5227111dff3c2a71656d6086ae601fdcfd867bf5 Mon Sep 17 00:00:00 2001 From: Ken Eucker Date: Thu, 4 Jan 2024 23:19:04 -0800 Subject: [PATCH 2/2] fix(sanity): fixes bugs around achievements that were missed in previous commits --- examples/node/index.js | 14 +++++++------- src/common/data.ts | 2 +- src/sanity/helpers.ts | 3 ++- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/node/index.js b/examples/node/index.js index 7e4295b..0ef1b98 100644 --- a/examples/node/index.js +++ b/examples/node/index.js @@ -189,8 +189,8 @@ const runTests = async (out = false) => { await get10PlayersAsync("BikeTag", biketagDefaultInstance, out) } - // if (false) { - if (bikeTagImgurInstance) { + if (false) { + // if (bikeTagImgurInstance) { console.log(pretty("Imgur BikeTag Client Instantiated"), imgurInstanceOpts) await getGameAsync("Imgur", bikeTagImgurInstance, out) // await getTag1Async("Imgur", bikeTagImgurInstance, out) @@ -202,16 +202,16 @@ const runTests = async (out = false) => { // await get10PlayersAsync("Imgur", bikeTagImgurInstance, out) } - if (false) { - // if (bikeTagSanityInstance) { + // if (false) { + if (bikeTagSanityInstance) { console.log(pretty("Sanity BikeTag Client Instantiated"), sanityInstanceOpts) // await getTag1Async("Sanity", bikeTagSanityInstance, out) // await get10TagsAsync("Sanity", bikeTagSanityInstance, out) await getGameAsync("Sanity", bikeTagSanityInstance, out) // await getAllGamesAsync("Sanity", bikeTagSanityInstance, out) - await get10PlayersAsync("Sanity", bikeTagSanityInstance, out) - await get1PlayerAsync("Sanity", bikeTagSanityInstance, out) - // await get10AchievementsAsync("Sanity", bikeTagSanityInstance, out) + // await get10PlayersAsync("Sanity", bikeTagSanityInstance, out) + // await get1PlayerAsync("Sanity", bikeTagSanityInstance, out) + await get10AchievementsAsync("Sanity", bikeTagSanityInstance, out) // await get10AmbassadorsAsync("Sanity", bikeTagSanityInstance, out) // await get10SettingsAsync("Sanity", bikeTagSanityInstance, out) // await get10AchievementsAsync("Sanity", bikeTagSanityInstance, out) diff --git a/src/common/data.ts b/src/common/data.ts index 8fea7bf..67eccc4 100644 --- a/src/common/data.ts +++ b/src/common/data.ts @@ -168,7 +168,7 @@ export const createAchievementObject = ( name: achievementData.name ?? '', key: achievementData.key ?? '', value: achievementData.value ?? '', - group: achievementData.value ?? '', + group: achievementData.group ?? '', } as Achievement } export const achievementDataFields = Object.keys(createAchievementObject()) diff --git a/src/sanity/helpers.ts b/src/sanity/helpers.ts index eb9f32c..3fbb057 100644 --- a/src/sanity/helpers.ts +++ b/src/sanity/helpers.ts @@ -19,6 +19,7 @@ import { createAchievementObject, ambassadorDataReferenceFields, createAmbassadorObject, + achievementDataFields, settingDataFields, ambassadorDataFields, gameDataAssetFields, @@ -495,7 +496,7 @@ export function constructSanityFieldsQuery( case DataTypes.achievement: referenceFields = [] arrayFields = [] - fields = fields.length ? fields : settingDataFields + fields = fields.length ? fields : achievementDataFields break }