@azuro-org/toolkit 5.1.0-beta.1 → 5.1.0-beta.3
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.
- package/dist/global.d.ts +27 -0
- package/dist/index.js +83 -23
- package/dist/index.js.map +1 -0
- package/dist/utils/bonus/getBonuses.d.ts +16 -2
- package/package.json +6 -8
package/dist/global.d.ts
CHANGED
|
@@ -61,6 +61,20 @@ export declare enum BonusStatus {
|
|
|
61
61
|
Used = "Used",
|
|
62
62
|
Available = "Available"
|
|
63
63
|
}
|
|
64
|
+
export declare enum FreebetType {
|
|
65
|
+
OnlyWin = "OnlyWin",
|
|
66
|
+
AllWin = "AllWin"
|
|
67
|
+
}
|
|
68
|
+
export declare enum BetRestrictionType {
|
|
69
|
+
All = "All",
|
|
70
|
+
Ordinar = "Ordinar",
|
|
71
|
+
Combo = "Combo"
|
|
72
|
+
}
|
|
73
|
+
export declare enum EventRestrictionState {
|
|
74
|
+
All = "All",
|
|
75
|
+
Live = "Live",
|
|
76
|
+
Prematch = "Prematch"
|
|
77
|
+
}
|
|
64
78
|
type BonusBase = {
|
|
65
79
|
id: string;
|
|
66
80
|
type: BonusType;
|
|
@@ -78,6 +92,19 @@ export type Freebet = {
|
|
|
78
92
|
isFeeSponsored: boolean;
|
|
79
93
|
isSponsoredBetReturnable: boolean;
|
|
80
94
|
};
|
|
95
|
+
settings: {
|
|
96
|
+
type: FreebetType;
|
|
97
|
+
feeSponsored: boolean;
|
|
98
|
+
betRestriction: {
|
|
99
|
+
type: BetRestrictionType | undefined;
|
|
100
|
+
minOdds: string;
|
|
101
|
+
maxOdds: string | undefined;
|
|
102
|
+
};
|
|
103
|
+
eventRestriction: {
|
|
104
|
+
state: EventRestrictionState | undefined;
|
|
105
|
+
};
|
|
106
|
+
periodOfValidityMs: number;
|
|
107
|
+
};
|
|
81
108
|
} & BonusBase;
|
|
82
109
|
export type Bonus = Freebet;
|
|
83
110
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -5832,7 +5832,7 @@ const environments = {
|
|
|
5832
5832
|
// endpointNameByChainId[gnosis.id] = 'gnosis-dev'
|
|
5833
5833
|
// endpointNameByChainId[polygonAmoy.id] = 'polygon-amoy-dev'
|
|
5834
5834
|
// }
|
|
5835
|
-
const
|
|
5835
|
+
const isDevChain = (chainId) => {
|
|
5836
5836
|
return (chainId === polygonAmoy.id ||
|
|
5837
5837
|
chainId === spicy.id ||
|
|
5838
5838
|
chainId === baseSepolia.id);
|
|
@@ -5843,7 +5843,7 @@ const getBetsGraphqlEndpoint = (chainId) => (`https://thegraph.onchainfeed.org/s
|
|
|
5843
5843
|
* @deprecated Only for v2 feed
|
|
5844
5844
|
*/
|
|
5845
5845
|
const getLegacyLiveGraphqlEndpoint = (chainId) => {
|
|
5846
|
-
if (
|
|
5846
|
+
if (isDevChain(chainId)) {
|
|
5847
5847
|
return 'https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed-dev';
|
|
5848
5848
|
}
|
|
5849
5849
|
// if (chainId === polygonAmoy.id) {
|
|
@@ -5852,7 +5852,7 @@ const getLegacyLiveGraphqlEndpoint = (chainId) => {
|
|
|
5852
5852
|
return 'https://thegraph.azuro.org/subgraphs/name/azuro-protocol/azuro-api-live-data-feed';
|
|
5853
5853
|
};
|
|
5854
5854
|
const getSocketEndpoint = (chainId) => {
|
|
5855
|
-
if (
|
|
5855
|
+
if (isDevChain(chainId)) {
|
|
5856
5856
|
return 'wss://dev-streams.onchainfeed.org/v1/streams';
|
|
5857
5857
|
}
|
|
5858
5858
|
// if (chainId === polygonAmoy.id) {
|
|
@@ -5861,7 +5861,7 @@ const getSocketEndpoint = (chainId) => {
|
|
|
5861
5861
|
return 'wss://streams.onchainfeed.org/v1/streams';
|
|
5862
5862
|
};
|
|
5863
5863
|
const getApiEndpoint = (chainId) => {
|
|
5864
|
-
if (
|
|
5864
|
+
if (isDevChain(chainId)) {
|
|
5865
5865
|
return 'https://dev-api.onchainfeed.org/api/v1/public';
|
|
5866
5866
|
}
|
|
5867
5867
|
// if (chainId === polygonAmoy.id) {
|
|
@@ -6187,7 +6187,24 @@ var BonusStatus;
|
|
|
6187
6187
|
(function (BonusStatus) {
|
|
6188
6188
|
BonusStatus["Used"] = "Used";
|
|
6189
6189
|
BonusStatus["Available"] = "Available";
|
|
6190
|
-
})(BonusStatus || (BonusStatus = {}));
|
|
6190
|
+
})(BonusStatus || (BonusStatus = {}));
|
|
6191
|
+
var FreebetType;
|
|
6192
|
+
(function (FreebetType) {
|
|
6193
|
+
FreebetType["OnlyWin"] = "OnlyWin";
|
|
6194
|
+
FreebetType["AllWin"] = "AllWin";
|
|
6195
|
+
})(FreebetType || (FreebetType = {}));
|
|
6196
|
+
var BetRestrictionType;
|
|
6197
|
+
(function (BetRestrictionType) {
|
|
6198
|
+
BetRestrictionType["All"] = "All";
|
|
6199
|
+
BetRestrictionType["Ordinar"] = "Ordinar";
|
|
6200
|
+
BetRestrictionType["Combo"] = "Combo";
|
|
6201
|
+
})(BetRestrictionType || (BetRestrictionType = {}));
|
|
6202
|
+
var EventRestrictionState;
|
|
6203
|
+
(function (EventRestrictionState) {
|
|
6204
|
+
EventRestrictionState["All"] = "All";
|
|
6205
|
+
EventRestrictionState["Live"] = "Live";
|
|
6206
|
+
EventRestrictionState["Prematch"] = "Prematch";
|
|
6207
|
+
})(EventRestrictionState || (EventRestrictionState = {}));const BettorFragmentDoc = gql `
|
|
6191
6208
|
fragment Bettor on Bettor {
|
|
6192
6209
|
id
|
|
6193
6210
|
rawToPayout
|
|
@@ -8306,8 +8323,9 @@ const createCashout = async (props) => {
|
|
|
8306
8323
|
}
|
|
8307
8324
|
const data = await response.json();
|
|
8308
8325
|
return data;
|
|
8309
|
-
};const getBonuses = async (
|
|
8310
|
-
const {
|
|
8326
|
+
};const getBonuses = async (props) => {
|
|
8327
|
+
const { chainId, account, affiliate, bonusStatus = BonusStatus.Available } = props;
|
|
8328
|
+
const { api } = chainsData[chainId];
|
|
8311
8329
|
const response = await fetch(`${api}/bonus/get-by-addresses`, {
|
|
8312
8330
|
method: 'POST',
|
|
8313
8331
|
headers: {
|
|
@@ -8317,6 +8335,7 @@ const createCashout = async (props) => {
|
|
|
8317
8335
|
body: JSON.stringify({
|
|
8318
8336
|
bettorAddress: account,
|
|
8319
8337
|
poolAddress: affiliate,
|
|
8338
|
+
status: bonusStatus,
|
|
8320
8339
|
}),
|
|
8321
8340
|
});
|
|
8322
8341
|
if (response.status === 404) {
|
|
@@ -8326,20 +8345,43 @@ const createCashout = async (props) => {
|
|
|
8326
8345
|
throw new Error(`Status ${response.status}: ${response.statusText}`);
|
|
8327
8346
|
}
|
|
8328
8347
|
const { bonuses } = await response.json();
|
|
8329
|
-
return bonuses.
|
|
8348
|
+
return bonuses.reduce((acc, bonus) => {
|
|
8330
8349
|
const environment = `${bonus.network}${bonus.currency}`;
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8350
|
+
const { chain, betToken } = chainsDataByEnv[environment];
|
|
8351
|
+
// TODO: need to add environement to request params
|
|
8352
|
+
if (chain.id === chainId) {
|
|
8353
|
+
const { id, freebetParam: { isBetSponsored, isFeeSponsored, isSponsoredBetReturnable, settings, }, } = bonus;
|
|
8354
|
+
acc.push({
|
|
8355
|
+
id,
|
|
8356
|
+
amount: formatUnits(BigInt(bonus.amount), betToken.decimals),
|
|
8357
|
+
type: bonus.bonusType,
|
|
8358
|
+
params: {
|
|
8359
|
+
isBetSponsored,
|
|
8360
|
+
isFeeSponsored,
|
|
8361
|
+
isSponsoredBetReturnable,
|
|
8362
|
+
},
|
|
8363
|
+
settings: {
|
|
8364
|
+
type: settings.bonusType,
|
|
8365
|
+
feeSponsored: settings.feeSponsored,
|
|
8366
|
+
betRestriction: {
|
|
8367
|
+
type: settings.betRestriction.betType === 'All' ? undefined : settings.betRestriction.betType,
|
|
8368
|
+
minOdds: settings.betRestriction.minOdds,
|
|
8369
|
+
maxOdds: settings.betRestriction?.maxOdds,
|
|
8370
|
+
},
|
|
8371
|
+
eventRestriction: {
|
|
8372
|
+
state: settings.eventRestriction.eventStatus === 'All' ? undefined : settings.eventRestriction.eventStatus,
|
|
8373
|
+
},
|
|
8374
|
+
periodOfValidityMs: settings.periodOfValidityMs,
|
|
8375
|
+
},
|
|
8376
|
+
status: bonus.status,
|
|
8377
|
+
chainId: chain.id,
|
|
8378
|
+
expiresAt: +new Date(bonus.expiresAt),
|
|
8379
|
+
usedAt: +new Date(bonus.usedAt),
|
|
8380
|
+
createdAt: +new Date(bonus.createdAt),
|
|
8381
|
+
});
|
|
8382
|
+
}
|
|
8383
|
+
return acc;
|
|
8384
|
+
}, []);
|
|
8343
8385
|
};const getAvailableFreebets = async ({ chainId, account, affiliate, selections }) => {
|
|
8344
8386
|
const { api, environment, betToken } = chainsData[chainId];
|
|
8345
8387
|
const response = await fetch(`${api}/bonus/freebet/get-available`, {
|
|
@@ -8367,11 +8409,29 @@ const createCashout = async (props) => {
|
|
|
8367
8409
|
const { bonuses } = await response.json();
|
|
8368
8410
|
return bonuses.map(bonus => {
|
|
8369
8411
|
const environment = `${bonus.network}${bonus.currency}`;
|
|
8412
|
+
const { id, freebetParam: { isBetSponsored, isFeeSponsored, isSponsoredBetReturnable, settings, }, } = bonus;
|
|
8370
8413
|
return {
|
|
8371
|
-
id
|
|
8414
|
+
id,
|
|
8372
8415
|
amount: formatUnits(BigInt(bonus.amount), betToken.decimals),
|
|
8373
8416
|
type: BonusType.FreeBet,
|
|
8374
|
-
params:
|
|
8417
|
+
params: {
|
|
8418
|
+
isBetSponsored,
|
|
8419
|
+
isFeeSponsored,
|
|
8420
|
+
isSponsoredBetReturnable,
|
|
8421
|
+
},
|
|
8422
|
+
settings: {
|
|
8423
|
+
type: settings.bonusType,
|
|
8424
|
+
feeSponsored: settings.feeSponsored,
|
|
8425
|
+
betRestriction: {
|
|
8426
|
+
type: settings.betRestriction.betType === 'All' ? undefined : settings.betRestriction.betType,
|
|
8427
|
+
minOdds: settings.betRestriction.minOdds,
|
|
8428
|
+
maxOdds: settings.betRestriction?.maxOdds,
|
|
8429
|
+
},
|
|
8430
|
+
eventRestriction: {
|
|
8431
|
+
state: settings.eventRestriction.eventStatus === 'All' ? undefined : settings.eventRestriction.eventStatus,
|
|
8432
|
+
},
|
|
8433
|
+
periodOfValidityMs: settings.periodOfValidityMs,
|
|
8434
|
+
},
|
|
8375
8435
|
status: bonus.status,
|
|
8376
8436
|
chainId: chainsDataByEnv[environment].chain.id,
|
|
8377
8437
|
expiresAt: +new Date(bonus.expiresAt),
|
|
@@ -8379,4 +8439,4 @@ const createCashout = async (props) => {
|
|
|
8379
8439
|
createdAt: +new Date(bonus.createdAt),
|
|
8380
8440
|
};
|
|
8381
8441
|
});
|
|
8382
|
-
};export{Aggregation_Interval,BET_DATA_TYPES,ConditionStatus as BetConditionStatus,BetFragmentDoc,BetResult,BetState,BetStatus,V3_Bet_OrderBy as Bet_OrderBy,BetsDocument,BettorFragmentDoc,BettorsDocument,BonusStatus,BonusType,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CLIENT_DATA_TYPES,COMBO_BET_DATA_TYPES,CashoutState,ConditionDocument,ConditionFragmentDoc,ConditionState,Condition_OrderBy,ConditionsBatchDocument,ConditionsDocument,Country_OrderBy,Environment,EventName,Event_OrderBy,GameBetsDocument,GameDocument,GameInfoFragmentDoc,GameState,Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,League_OrderBy,LegacyBetsDocument,GameStatus as LegacyGameStatus,LegacyLiveBetFragmentDoc,LegacyLiveGamesDocument,LegacyPrematchBetFragmentDoc,Bet_OrderBy as Legacy_Bet_OrderBy,NavigationDocument,ODDS_DECIMALS,OrderDirection,OutcomeResult,Outcome_OrderBy,Participant_OrderBy,V3_SelectionConditionKind as SelectionKind,SelectionResult,SportHub_OrderBy,Sport_OrderBy,SportsDocument,SportsNavigationDocument,TYPED_DATA_DOMAIN_NAME,TYPED_DATA_DOMAIN_VERSION,VirtualCondition_OrderBy,VirtualGame_OrderBy,WaveLevelName,_SubgraphErrorPolicy_,activateWave,azuroBetAbi,baseData,baseSepoliaData,calcMindOdds,cashoutAbi,chainsData,chainsDataByEnv,chilizData,coreAbi,createBet,createCashout,createComboBet,environments,getApiEndpoint,getAvailableFreebets,getBet,getBetFee,getBetStatus,getBetTypedData,getBetsGraphqlEndpoint,getBonuses,getCalculatedCashout,getCashout,getCashoutTypedData,getComboBetTypedData,getFeedGraphqlEndpoint,getIsPendingResolution,getMaxBet,getPrecalculatedCashouts,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,gnosisData,gnosisDevData,groupConditionsByMarket,lpAbi,paymasterAbi,polygonAmoyData,polygonData,relayerAbi,setupContracts,spicyData,vaultAbi}
|
|
8442
|
+
};export{Aggregation_Interval,BET_DATA_TYPES,ConditionStatus as BetConditionStatus,BetFragmentDoc,BetRestrictionType,BetResult,BetState,BetStatus,V3_Bet_OrderBy as Bet_OrderBy,BetsDocument,BettorFragmentDoc,BettorsDocument,BonusStatus,BonusType,CASHOUT_DATA_TYPES,CASHOUT_TYPED_DATA_DOMAIN_NAME,CASHOUT_TYPED_DATA_DOMAIN_VERSION,CLIENT_DATA_TYPES,COMBO_BET_DATA_TYPES,CashoutState,ConditionDocument,ConditionFragmentDoc,ConditionState,Condition_OrderBy,ConditionsBatchDocument,ConditionsDocument,Country_OrderBy,Environment,EventName,EventRestrictionState,Event_OrderBy,FreebetType,GameBetsDocument,GameDocument,GameInfoFragmentDoc,GameState,Game_OrderBy,GamesDocument,BetStatus$1 as GraphBetStatus,League_OrderBy,LegacyBetsDocument,GameStatus as LegacyGameStatus,LegacyLiveBetFragmentDoc,LegacyLiveGamesDocument,LegacyPrematchBetFragmentDoc,Bet_OrderBy as Legacy_Bet_OrderBy,NavigationDocument,ODDS_DECIMALS,OrderDirection,OutcomeResult,Outcome_OrderBy,Participant_OrderBy,V3_SelectionConditionKind as SelectionKind,SelectionResult,SportHub_OrderBy,Sport_OrderBy,SportsDocument,SportsNavigationDocument,TYPED_DATA_DOMAIN_NAME,TYPED_DATA_DOMAIN_VERSION,VirtualCondition_OrderBy,VirtualGame_OrderBy,WaveLevelName,_SubgraphErrorPolicy_,activateWave,azuroBetAbi,baseData,baseSepoliaData,calcMindOdds,cashoutAbi,chainsData,chainsDataByEnv,chilizData,coreAbi,createBet,createCashout,createComboBet,environments,getApiEndpoint,getAvailableFreebets,getBet,getBetFee,getBetStatus,getBetTypedData,getBetsGraphqlEndpoint,getBonuses,getCalculatedCashout,getCashout,getCashoutTypedData,getComboBetTypedData,getFeedGraphqlEndpoint,getIsPendingResolution,getMaxBet,getPrecalculatedCashouts,getProviderFromId,getSocketEndpoint,getWaveLeaderBoard,getWaveLevels,getWavePeriods,getWaveStats,gnosisData,gnosisDevData,groupConditionsByMarket,lpAbi,paymasterAbi,polygonAmoyData,polygonData,relayerAbi,setupContracts,spicyData,vaultAbi};//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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'../../config';
|
|
3
|
-
import { type BonusType, type Bonus, type
|
|
3
|
+
import { BonusStatus, type BonusType, type Bonus, type FreebetType, type BetRestrictionType, type EventRestrictionState } from '../../global';
|
|
4
4
|
export type RawBonus = {
|
|
5
5
|
id: string;
|
|
6
6
|
bonusType: BonusType;
|
|
@@ -8,6 +8,19 @@ export type RawBonus = {
|
|
|
8
8
|
isBetSponsored: true;
|
|
9
9
|
isFeeSponsored: true;
|
|
10
10
|
isSponsoredBetReturnable: true;
|
|
11
|
+
settings: {
|
|
12
|
+
bonusType: FreebetType;
|
|
13
|
+
feeSponsored: boolean;
|
|
14
|
+
betRestriction: {
|
|
15
|
+
betType: BetRestrictionType | 'All';
|
|
16
|
+
minOdds: string;
|
|
17
|
+
maxOdds?: string;
|
|
18
|
+
};
|
|
19
|
+
eventRestriction: {
|
|
20
|
+
eventStatus: EventRestrictionState | 'All';
|
|
21
|
+
};
|
|
22
|
+
periodOfValidityMs: 86400000;
|
|
23
|
+
};
|
|
11
24
|
};
|
|
12
25
|
address: string;
|
|
13
26
|
amount: string;
|
|
@@ -23,6 +36,7 @@ type Props = {
|
|
|
23
36
|
chainId: ChainId;
|
|
24
37
|
account: Address;
|
|
25
38
|
affiliate: Address;
|
|
39
|
+
bonusStatus?: BonusStatus;
|
|
26
40
|
};
|
|
27
|
-
export declare const getBonuses: (
|
|
41
|
+
export declare const getBonuses: (props: Props) => Promise<GetBonuses>;
|
|
28
42
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azuro-org/toolkit",
|
|
3
|
-
"version": "5.1.0-beta.
|
|
3
|
+
"version": "5.1.0-beta.3",
|
|
4
4
|
"description": "This framework-agnostic package provides essential utilities for building applications on the Azuro Protocol.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"gql:cleanup": "rimraf src/docs/**/*.ts src/docs/**/**/*.ts",
|
|
16
16
|
"gql": "npm run gql:cleanup & graphql-codegen",
|
|
17
17
|
"dev": "rollup -cw",
|
|
18
|
-
"build": "rimraf ./dist && npm run gql && rollup -c --compact",
|
|
18
|
+
"build": "rimraf ./dist && npm run gql && tsc --emitDeclarationOnly && rollup -c --compact",
|
|
19
19
|
"prepublishOnly": "npm run build",
|
|
20
20
|
"------------------ Lint --------------------------------------------------------------------------------": "",
|
|
21
21
|
"lint": "next lint && tsc --noEmit",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"homepage": "https://github.com/Azuro-protocol/toolkit#readme",
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@azuro-org/dictionaries": "^3.0.27",
|
|
44
|
-
"graphql-tag": "^2.12.6",
|
|
45
44
|
"@wagmi/core": "^2.17.2",
|
|
45
|
+
"graphql-tag": "^2.12.6",
|
|
46
46
|
"viem": "^2.30.4"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"@graphql-codegen/typescript": "^4.1.2",
|
|
53
53
|
"@graphql-codegen/typescript-document-nodes": "^4.0.12",
|
|
54
54
|
"@graphql-codegen/typescript-operations": "^4.4.0",
|
|
55
|
-
"@rollup/plugin-
|
|
56
|
-
"@rollup/plugin-commonjs": "^23.0.3",
|
|
55
|
+
"@rollup/plugin-commonjs": "^23.0.7",
|
|
57
56
|
"@rollup/plugin-json": "^4.1.0",
|
|
58
57
|
"@types/node": "^17.0.21",
|
|
59
58
|
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
|
@@ -63,10 +62,9 @@
|
|
|
63
62
|
"eslint-plugin-import": "^2.29.1",
|
|
64
63
|
"minimist": "^1.2.7",
|
|
65
64
|
"rimraf": "^3.0.2",
|
|
66
|
-
"rollup": "^2.
|
|
67
|
-
"rollup-plugin-babel": "^4.4.0",
|
|
65
|
+
"rollup": "^2.79.2",
|
|
68
66
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
69
67
|
"tslib": "^2.4.1",
|
|
70
|
-
"typescript": "^5.
|
|
68
|
+
"typescript": "^5.8.3"
|
|
71
69
|
}
|
|
72
70
|
}
|