Skip to content

Commit

Permalink
hotfix/firebase-functions-upgrade/draft/0 (#2247)
Browse files Browse the repository at this point in the history
* chore(scores-lib): update imports and methods

[1] ────
Update 'imports' and 'methods' for newest 'scores-lib' 4.0.0 package update.

* build(scores-lib): update to 4.0.0
  • Loading branch information
migbash authored Jul 24, 2024
1 parent afd2ab8 commit 0052902
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 46 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"dependencies": {
"@betarena/ad-engine": "0.0.51",
"@betarena/scores-lib": "3.3.0",
"@betarena/scores-lib": "4.0.0",
"@lukeed/uuid": "2.0.1",
"@metamask/sdk": "0.1.0",
"@moralisweb3/client-firebase-auth-utils": "2.18.4",
Expand Down
4 changes: 2 additions & 2 deletions src/lib/api/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import LZString from 'lz-string';

import { dlogv2 } from '$lib/utils/debug.js';
import { tryCatch } from '$lib/utils/miscellenous.js';
import { tryCatchAsync, tryCatchAsyncV2 } from '@betarena/scores-lib/dist/util/common';
import { tryCatchAsync } from '@betarena/scores-lib/dist/util/common';

// #endregion ➤ 📦 Package Imports

Expand Down Expand Up @@ -222,7 +222,7 @@ export async function postv2
, data: any
): Promise < T1 | null | undefined | unknown | IResponseError >
{
return await tryCatchAsyncV2
return await tryCatchAsync
<
T1
>
Expand Down
49 changes: 37 additions & 12 deletions src/lib/components/page/competition/main/Main-Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import { Betarena_User_Class } from '@betarena/scores-lib/dist/classes/class.betarena-user.js';
import { Competition } from '@betarena/scores-lib/dist/classes/class.competition.js';
import { cleanUrl, iso2CountryLogo} from '$lib/utils/string.js';
import { Parser } from '@betarena/scores-lib/dist/classes/class.parser.js';
import CompCountdownStatus from '$lib/components/shared/COMP-Countdown-+-Status.svelte';
import CompDetails from '$lib/components/shared/COMP-Details.svelte';
Expand All @@ -54,7 +55,7 @@
import icon_twitter_white from './assets/icon-twitter-white.svg';
import icon_twitter from './assets/icon-twitter.svg';
import type { BetarenaUser } from '@betarena/scores-lib/types/_FIREBASE_.js';
import type { IBetarenaUser } from '@betarena/scores-lib/types/firebase/firestore.js';
import type { B_H_COMP_DATA } from '@betarena/scores-lib/types/_HASURA_.js';
import type { FIRE_LNNS } from '@betarena/scores-lib/types/firebase.js';
import type { LS2_C_Fixture } from '@betarena/scores-lib/types/livescores-v2.js';
Expand Down Expand Up @@ -103,7 +104,7 @@
/** @description TODO: DOC: */
prediction_side: 'home' | 'away',
/** @description TODO: DOC: */
participantsMap: Map < string, BetarenaUser > = new Map(),
participantsMap: Map < string, IBetarenaUser > = new Map(),
/** @description TODO: DOC: */
competitionWasLive: boolean = false
;
Expand Down Expand Up @@ -215,18 +216,42 @@
;
if (if_M_0) return;
const participantPublicData = await new Betarena_User_Class().obtainPublicInformationTargetUsers
(
newUids
) as (BetarenaUser | undefined)[];
const newParticipantsMap: Map < string, BetarenaUser > = new Betarena_User_Class().convertToMap
(
participantPublicData
);
const
/**
* @description
* 📝 `map` for Fixtures
*/
dataRes1: IBetarenaUser[]
= (
await new Betarena_User_Class().obtainPublicInformationTargetUsers
(
{
query: {},
body:
{
user_uids: newUids
}
}
)
).success.data,
/**
* @description
* 📝 Map of author data.
*/
userMap
= new Parser().toMapById
<
IBetarenaUser,
string
>
(
dataRes1 ?? [],
'uid'
)
;
// ### IMPORTANT
participantsMap = new Map([...participantsMap, ...newParticipantsMap]);
participantsMap = new Map([...participantsMap, ...userMap]);
return;
}
Expand Down
47 changes: 36 additions & 11 deletions src/lib/components/page/fixture/competition/Competition-Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import { Betarena_User_Class } from '@betarena/scores-lib/dist/classes/class.betarena-user.js';
import { Competition } from '@betarena/scores-lib/dist/classes/class.competition.js';
import { langPrefix } from '$lib/utils/string.js';
import { Parser } from '@betarena/scores-lib/dist/classes/class.parser.js';
import WidgetTitle from '$lib/components/Widget-Title.svelte';
import CompCountdownStatus from '$lib/components/shared/COMP-Countdown-+-Status.svelte';
Expand All @@ -51,7 +52,7 @@
import icon_loose from './assets/icon-thumbs-down-red.svg';
import icon_win from './assets/icon-thumbs-up-green.svg';
import type { BetarenaUser } from '@betarena/scores-lib/types/_FIREBASE_.js';
import type { IBetarenaUser } from '@betarena/scores-lib/types/firebase/firestore.js';
import type { B_H_COMP_DATA } from '@betarena/scores-lib/types/_HASURA_.js';
import type { FIRE_LNNS } from '@betarena/scores-lib/types/firebase.js';
import type { LS2_C_Fixture } from '@betarena/scores-lib/types/livescores-v2.js';
Expand Down Expand Up @@ -231,18 +232,42 @@
;
if (if_M_0) return;
const participantPublicData = await new Betarena_User_Class().obtainPublicInformationTargetUsers
(
newUids
) as (BetarenaUser | undefined)[];
const newParticipantsMap: Map < string, BetarenaUser > = new Betarena_User_Class().convertToMap
(
participantPublicData
);
const
/**
* @description
* 📝 `map` for Fixtures
*/
dataRes1: IBetarenaUser[]
= (
await new Betarena_User_Class().obtainPublicInformationTargetUsers
(
{
query: {},
body:
{
user_uids: newUids
}
}
)
).success.data,
/**
* @description
* 📝 Map of author data.
*/
userMap
= new Parser().toMapById
<
IBetarenaUser,
string
>
(
dataRes1 ?? [],
'uid'
)
;
// ▓▓ IMPORTANT
participantsMap = new Map([...participantsMap, ...newParticipantsMap]);
participantsMap = new Map([...participantsMap, ...userMap]);
return;
}
Expand Down
49 changes: 37 additions & 12 deletions src/lib/components/page/lobby/highlights/Highlights-Grid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@
import { dlog } from '$lib/utils/debug.js';
import { Betarena_User_Class } from '@betarena/scores-lib/dist/classes/class.betarena-user.js';
import { Competition } from '@betarena/scores-lib/dist/classes/class.competition.js';
import { Parser } from '@betarena/scores-lib/dist/classes/class.parser.js';
import HighlightsNoCompetitions from './Highlights-No-Competitions.svelte';
import icon_question_mark from './assets/icon-question-mark.svg';
import type { BetarenaUser } from '$lib/types/types.scores.js';
import type { IBetarenaUser } from '@betarena/scores-lib/types/firebase/firestore.js';
import type { B_H_COMP_DATA } from '@betarena/scores-lib/types/_HASURA_.js';
import type { FIRE_LNNS } from '@betarena/scores-lib/types/firebase.js';
import type { LS2_C_Fixture } from '@betarena/scores-lib/types/livescores-v2.js';
Expand Down Expand Up @@ -94,7 +95,7 @@
/** @description competitions (lobby) highlights (widget) - no competitions available */
isNoCompetitions: boolean = false,
/** @description competitions (lobby) highlights (widget) - all participants map */
participantsMap: Map < string, BetarenaUser > = new Map(),
participantsMap: Map < string, IBetarenaUser > = new Map(),
/** @description TODO: DOC: */
competitionMapSnap: Map < number, B_H_COMP_DATA > = new Map()
;
Expand Down Expand Up @@ -404,18 +405,42 @@
;
if (if_M_0) return;
const participantPublicData = await new Betarena_User_Class().obtainPublicInformationTargetUsers
(
newUids
) as (BetarenaUser | undefined)[];
const newParticipantsMap: Map < string, BetarenaUser > = new Betarena_User_Class().convertToMap
(
participantPublicData
);
const
/**
* @description
* 📝 `map` for Fixtures
*/
dataRes1: IBetarenaUser[]
= (
await new Betarena_User_Class().obtainPublicInformationTargetUsers
(
{
query: {},
body:
{
user_uids: newUids
}
}
)
).success.data,
/**
* @description
* 📝 Map of author data.
*/
userMap
= new Parser().toMapById
<
IBetarenaUser,
string
>
(
dataRes1 ?? [],
'uid'
)
;
// ### IMPORTANT
participantsMap = new Map([...participantsMap, ...newParticipantsMap]);
participantsMap = new Map([...participantsMap, ...userMap]);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/sveltekit/endpoint/author.article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { json, type RequestEvent } from '@sveltejs/kit';

import { entryAuthorArticleTranslation } from '@betarena/scores-lib/dist/functions/v8/authors.articles.js';
import { entryTargetDataArticle } from '@betarena/scores-lib/dist/functions/v8/main.preload.authors.js';
import { tryCatchAsyncV2 } from '@betarena/scores-lib/dist/util/common.js';
import { tryCatchAsync } from '@betarena/scores-lib/dist/util/common.js';

import { postv2 } from '$lib/api/utils.js';
import { API_DATA_ERROR_RESPONSE } from '$lib/utils/debug.js';
Expand Down Expand Up @@ -51,7 +51,7 @@ export async function main
request: RequestEvent
): Promise < Response >
{
return await tryCatchAsyncV2
return await tryCatchAsync
(
async (
): Promise < Response > =>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/sveltekit/endpoint/fixture.content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { json, type RequestEvent } from '@sveltejs/kit';
// import { dev } from '$app/environment';

import { entryFixtureContentData, entryFixtureContentTranslation } from '@betarena/scores-lib/dist/functions/v8/fixture.content.js';
import { tryCatchAsyncV2 } from '@betarena/scores-lib/dist/util/common.js';
import { tryCatchAsync } from '@betarena/scores-lib/dist/util/common.js';

import { API_DATA_ERROR_RESPONSE } from '$lib/utils/debug.js';

Expand All @@ -50,7 +50,7 @@ export async function main
request: RequestEvent
): Promise < Response >
{
return await tryCatchAsyncV2
return await tryCatchAsync
(
async (
): Promise < Response > =>
Expand Down

0 comments on commit 0052902

Please sign in to comment.