ps99-api 2.3.3 → 2.5.0
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/.github/workflows/release-on-main.yml +1 -2
- package/.idea/node-ps99-api.iml +1 -0
- package/.idea/runConfigurations/test_changing.xml +1 -1
- package/README.md +1 -1
- package/debug_currency.json +57 -0
- package/debug_goals.json +271 -0
- package/dist/ps99-api.d.ts +2 -0
- package/dist/ps99-api.js +4 -1
- package/dist/ps99-api.js.map +1 -1
- package/dist/request-client/axios.js +6 -1
- package/dist/request-client/axios.js.map +1 -1
- package/dist/responses/collection/achievement.d.ts +2 -0
- package/dist/responses/collection/guild-battle.d.ts +2 -4
- package/dist/responses/collection/index.d.ts +1 -0
- package/dist/responses/collection/index.js +15 -0
- package/dist/responses/collection/index.js.map +1 -1
- package/dist/responses/collection/rank.d.ts +1 -0
- package/dist/responses/collection/rarity.d.ts +1 -0
- package/dist/responses/collection/seed.d.ts +1 -0
- package/dist/responses/exists.d.ts +2 -0
- package/example-web/react/package-lock.json +1504 -1470
- package/example-web/react2/package-lock.json +3082 -2759
- package/example-web/react2/package.json +6 -1
- package/example-web/react2/public/assets/gold_variant_icon.png +0 -0
- package/example-web/react2/public/assets/hot_cocoa_egg.png +0 -0
- package/example-web/react2/public/index.html +34 -31
- package/example-web/react2/src/App.tsx +6 -9
- package/example-web/react2/src/assets/guild_placeholder.png +0 -0
- package/example-web/react2/src/components/AchievementsComponent.tsx +78 -30
- package/example-web/react2/src/components/BoostsComponent.tsx +18 -14
- package/example-web/react2/src/components/BoothsComponent.tsx +24 -22
- package/example-web/react2/src/components/BoxesComponent.tsx +46 -21
- package/example-web/react2/src/components/BuffsComponent.tsx +83 -13
- package/example-web/react2/src/components/CharmsComponent.tsx +47 -29
- package/example-web/react2/src/components/CollectionConfigIndex.tsx +398 -35
- package/example-web/react2/src/components/CollectionsIndex.tsx +132 -23
- package/example-web/react2/src/components/CollectionsLayout.tsx +50 -0
- package/example-web/react2/src/components/CurrencyComponent.tsx +59 -50
- package/example-web/react2/src/components/DynamicCollectionConfigData.tsx +178 -11
- package/example-web/react2/src/components/EggsComponent.tsx +77 -44
- package/example-web/react2/src/components/EnchantsComponent.tsx +84 -34
- package/example-web/react2/src/components/FishingRodsComponent.tsx +38 -31
- package/example-web/react2/src/components/Footer.tsx +75 -18
- package/example-web/react2/src/components/FruitsComponent.tsx +41 -25
- package/example-web/react2/src/components/GenericFetchComponent.tsx +40 -22
- package/example-web/react2/src/components/GuildBattlesComponent.tsx +93 -65
- package/example-web/react2/src/components/Header.tsx +5 -37
- package/example-web/react2/src/components/HomePage.tsx +16 -16
- package/example-web/react2/src/components/HoverboardsComponent.tsx +25 -37
- package/example-web/react2/src/components/ImageComponent.tsx +255 -45
- package/example-web/react2/src/components/ItemCard.tsx +240 -0
- package/example-web/react2/src/components/LootboxesComponent.tsx +24 -16
- package/example-web/react2/src/components/MasteryComponent.tsx +93 -37
- package/example-web/react2/src/components/MerchantsComponent.tsx +46 -28
- package/example-web/react2/src/components/MiscItemsComponent.tsx +28 -26
- package/example-web/react2/src/components/PetsComponent.tsx +115 -46
- package/example-web/react2/src/components/PotionsComponent.tsx +53 -36
- package/example-web/react2/src/components/RandomEventsComponent.tsx +39 -35
- package/example-web/react2/src/components/RanksComponent.tsx +187 -71
- package/example-web/react2/src/components/RarityComponent.tsx +124 -13
- package/example-web/react2/src/components/RebirthsComponent.tsx +37 -26
- package/example-web/react2/src/components/SecretRoomsComponent.tsx +7 -13
- package/example-web/react2/src/components/SeedsComponent.tsx +45 -32
- package/example-web/react2/src/components/ShovelsComponent.tsx +23 -18
- package/example-web/react2/src/components/Sidebar.tsx +105 -0
- package/example-web/react2/src/components/SprinklersComponent.tsx +27 -19
- package/example-web/react2/src/components/Tooltip.tsx +36 -0
- package/example-web/react2/src/components/UltimatesComponent.tsx +29 -24
- package/example-web/react2/src/components/UpgradesComponent.tsx +99 -55
- package/example-web/react2/src/components/WateringCansComponent.tsx +23 -21
- package/example-web/react2/src/components/WorldsComponent.tsx +27 -24
- package/example-web/react2/src/components/XPPotionsComponent.tsx +29 -19
- package/example-web/react2/src/components/ZoneFlagsComponent.tsx +27 -23
- package/example-web/react2/src/components/ZonesComponent.tsx +56 -73
- package/example-web/react2/src/constants/collectionIcons.ts +29 -0
- package/example-web/react2/src/context/CollectionDataContext.tsx +62 -0
- package/example-web/react2/src/hooks/useExpandableList.ts +38 -0
- package/example-web/react2/src/hooks/useItemResolution.ts +351 -0
- package/example-web/react2/src/index.css +257 -0
- package/example-web/react2/src/index.tsx +2 -1
- package/example-web/react2/temp_model.rbxm +0 -0
- package/example-web/react2/webpack.config.js +103 -47
- package/package.json +11 -11
- package/ranks.json +1 -0
- package/repro_collection_fetch.ts +33 -0
- package/repro_image_fetch.ts +50 -0
- package/src/__tests__/__snapshots__/ps99-api-changes.ts.snap +34841 -10439
- package/src/__tests__/__snapshots__/ps99-api-live.ts.snap +160667 -67217
- package/src/ps99-api.ts +9 -5
- package/src/request-client/axios.ts +6 -2
- package/src/responses/collection/achievement.ts +2 -0
- package/src/responses/collection/guild-battle.ts +2 -4
- package/src/responses/collection/index.ts +1 -0
- package/src/responses/collection/rank.ts +1 -0
- package/src/responses/collection/rarity.ts +1 -0
- package/src/responses/collection/seed.ts +1 -0
- package/src/responses/exists.ts +2 -0
- package/tsconfig.json +1 -1
- package/example-web/react2/public/service-worker.js +0 -63
package/src/ps99-api.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ActiveClanBattleResponseBody } from "./responses/activeClanBattle";
|
|
|
10
10
|
|
|
11
11
|
export type PetSimulator99APIOptions = {
|
|
12
12
|
requestClient?: RequestClient;
|
|
13
|
+
baseUrl?: string;
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export type ApiResponseBody<T> =
|
|
@@ -18,10 +19,12 @@ export type ApiResponseBody<T> =
|
|
|
18
19
|
|
|
19
20
|
export class PetSimulator99API {
|
|
20
21
|
public requestClient: RequestClient;
|
|
22
|
+
public baseUrl: string;
|
|
21
23
|
|
|
22
24
|
constructor(params?: PetSimulator99APIOptions) {
|
|
23
25
|
this.requestClient =
|
|
24
26
|
params && params.requestClient ? params.requestClient : getAxiosRequest();
|
|
27
|
+
this.baseUrl = params?.baseUrl || "https://biggamesapi.io";
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
private request<T>(
|
|
@@ -35,17 +38,17 @@ export class PetSimulator99API {
|
|
|
35
38
|
responseType?: ApiRequestParams["responseType"];
|
|
36
39
|
responseEncoding?: ApiRequestParams["responseEncoding"];
|
|
37
40
|
} = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
params: {},
|
|
42
|
+
responseType: "json",
|
|
43
|
+
responseEncoding: "utf8",
|
|
44
|
+
},
|
|
42
45
|
) {
|
|
43
46
|
params = params || {};
|
|
44
47
|
responseType = responseType || "json";
|
|
45
48
|
responseEncoding = responseEncoding || "utf8";
|
|
46
49
|
return this.requestClient.send<T>({
|
|
47
50
|
method: "GET",
|
|
48
|
-
url:
|
|
51
|
+
url: `${this.baseUrl}${path}`,
|
|
49
52
|
params,
|
|
50
53
|
responseType,
|
|
51
54
|
responseEncoding,
|
|
@@ -104,6 +107,7 @@ export class PetSimulator99API {
|
|
|
104
107
|
if (rbxassetid.startsWith("rbxassetid://")) {
|
|
105
108
|
rbxassetid = rbxassetid.slice(13);
|
|
106
109
|
}
|
|
110
|
+
console.log(`[ps99-api] getImage calling: /image/${rbxassetid}`);
|
|
107
111
|
return this.request<Blob>(`/image/${rbxassetid}`, {
|
|
108
112
|
responseType: "arraybuffer",
|
|
109
113
|
responseEncoding: "BINARY",
|
|
@@ -6,12 +6,16 @@ export function getAxiosRequest(instance?: AxiosInstance): RequestClient {
|
|
|
6
6
|
async send<T>(options: ApiRequestParams) {
|
|
7
7
|
try {
|
|
8
8
|
const { data } = await (instance ? instance(options) : axios(options));
|
|
9
|
-
|
|
9
|
+
console.log(`[ps99-api] Axios response for ${options.url}:`, data, "Type:", typeof data, "IsArrayBuffer:", data instanceof ArrayBuffer);
|
|
10
10
|
return data as T;
|
|
11
11
|
} catch (e: unknown) {
|
|
12
12
|
if (isAxiosError<{ message?: string }>(e)) {
|
|
13
13
|
const message: string = e?.response?.data?.message || e.message;
|
|
14
|
-
|
|
14
|
+
const newError = new Error(`${options.method} ${options.url}: ${message}`);
|
|
15
|
+
// Attach original response/status for consumers
|
|
16
|
+
(newError as any).response = e.response;
|
|
17
|
+
(newError as any).status = e.response?.status;
|
|
18
|
+
throw newError;
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
throw e;
|
|
@@ -26,14 +26,12 @@ export type GuildBattleItem = {
|
|
|
26
26
|
|
|
27
27
|
export type GuildBattleItemData = {
|
|
28
28
|
id: string;
|
|
29
|
+
/** For pets: pt=1 is golden, p2=2 is rainbow */
|
|
29
30
|
pt?: number;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
export type GuildBattleRewards = {
|
|
33
|
-
|
|
34
|
-
Gold: GuildBattleRewardItem[];
|
|
35
|
-
Good?: GuildBattleRewardItem[];
|
|
36
|
-
Silver: GuildBattleRewardItem[];
|
|
34
|
+
[key: string]: GuildBattleRewardItem[];
|
|
37
35
|
};
|
|
38
36
|
|
|
39
37
|
export type GuildBattleRewardItem = {
|
package/src/responses/exists.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
const CACHE_NAME = "ps99-cache-v2";
|
|
2
|
-
const urlsToCache = [
|
|
3
|
-
"/node-ps99-api/",
|
|
4
|
-
"/node-ps99-api/bundle.js",
|
|
5
|
-
"/node-ps99-api/manifest.json",
|
|
6
|
-
"/node-ps99-api/icons/icon-192x192.png",
|
|
7
|
-
"/node-ps99-api/icons/icon-512x512.png",
|
|
8
|
-
"/node-ps99-api/collections",
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
self.addEventListener("install", (event) => {
|
|
12
|
-
event.waitUntil(
|
|
13
|
-
caches.open(CACHE_NAME).then((cache) => {
|
|
14
|
-
console.log("Opened cache");
|
|
15
|
-
return cache.addAll(urlsToCache);
|
|
16
|
-
}),
|
|
17
|
-
);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
self.addEventListener("fetch", (event) => {
|
|
21
|
-
if (event.request.url.includes("/api/")) {
|
|
22
|
-
event.respondWith(
|
|
23
|
-
caches.match(event.request).then((response) => {
|
|
24
|
-
if (response) {
|
|
25
|
-
return response;
|
|
26
|
-
}
|
|
27
|
-
return fetch(event.request).then((response) => {
|
|
28
|
-
if (
|
|
29
|
-
!response ||
|
|
30
|
-
response.status !== 200 ||
|
|
31
|
-
response.type !== "basic"
|
|
32
|
-
) {
|
|
33
|
-
return response;
|
|
34
|
-
}
|
|
35
|
-
const responseToCache = response.clone();
|
|
36
|
-
caches.open(CACHE_NAME).then((cache) => {
|
|
37
|
-
cache.put(event.request, responseToCache);
|
|
38
|
-
});
|
|
39
|
-
return response;
|
|
40
|
-
});
|
|
41
|
-
}),
|
|
42
|
-
);
|
|
43
|
-
} else {
|
|
44
|
-
event.respondWith(
|
|
45
|
-
fetch(event.request).catch(() => caches.match(event.request)),
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
self.addEventListener("activate", (event) => {
|
|
51
|
-
const cacheWhitelist = [CACHE_NAME];
|
|
52
|
-
event.waitUntil(
|
|
53
|
-
caches.keys().then((cacheNames) => {
|
|
54
|
-
return Promise.all(
|
|
55
|
-
cacheNames.map((cacheName) => {
|
|
56
|
-
if (cacheWhitelist.indexOf(cacheName) === -1) {
|
|
57
|
-
return caches.delete(cacheName);
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
60
|
-
);
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
63
|
-
});
|