ps99-api 2.4.0 → 2.6.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/runConfigurations/test_changing.xml +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/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/rarity.d.ts +1 -0
- package/example-web/react/package-lock.json +1504 -1470
- package/example-web/react2/package-lock.json +3089 -2766
- 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 +15 -15
- package/example-web/react2/src/assets/guild_placeholder.png +0 -0
- package/example-web/react2/src/components/AchievementsComponent.tsx +74 -19
- package/example-web/react2/src/components/AutoSizer.tsx +49 -0
- package/example-web/react2/src/components/BoostsComponent.tsx +16 -5
- package/example-web/react2/src/components/BoothsComponent.tsx +22 -52
- package/example-web/react2/src/components/BoxesComponent.tsx +48 -16
- package/example-web/react2/src/components/BuffsComponent.tsx +82 -34
- package/example-web/react2/src/components/CharmsComponent.tsx +84 -24
- package/example-web/react2/src/components/CollectionConfigIndex.tsx +867 -33
- package/example-web/react2/src/components/CollectionsIndex.tsx +380 -27
- package/example-web/react2/src/components/CollectionsLayout.tsx +60 -0
- package/example-web/react2/src/components/CurrencyComponent.tsx +57 -39
- package/example-web/react2/src/components/DynamicCollectionConfigData.tsx +172 -15
- package/example-web/react2/src/components/EggsComponent.tsx +50 -12
- package/example-web/react2/src/components/EnchantsComponent.tsx +88 -42
- package/example-web/react2/src/components/FishingRodsComponent.tsx +36 -22
- package/example-web/react2/src/components/Footer.tsx +18 -8
- package/example-web/react2/src/components/FruitsComponent.tsx +40 -17
- package/example-web/react2/src/components/GenericFetchComponent.tsx +9 -1
- package/example-web/react2/src/components/GuildBattlesComponent.tsx +41 -34
- package/example-web/react2/src/components/Header.tsx +39 -52
- package/example-web/react2/src/components/HomePage.tsx +15 -17
- package/example-web/react2/src/components/HoverboardsComponent.tsx +23 -99
- 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 +22 -7
- package/example-web/react2/src/components/MasteryComponent.tsx +165 -30
- package/example-web/react2/src/components/MerchantsComponent.tsx +41 -16
- package/example-web/react2/src/components/MiscItemsComponent.tsx +26 -31
- package/example-web/react2/src/components/PetsComponent.tsx +100 -61
- package/example-web/react2/src/components/PotionsComponent.tsx +121 -27
- package/example-web/react2/src/components/RandomEventsComponent.tsx +32 -23
- package/example-web/react2/src/components/RanksComponent.tsx +187 -62
- package/example-web/react2/src/components/RarityComponent.tsx +123 -5
- package/example-web/react2/src/components/ReactWindowMock.tsx +73 -0
- package/example-web/react2/src/components/RebirthsComponent.tsx +36 -19
- package/example-web/react2/src/components/SecretRoomsComponent.tsx +5 -4
- package/example-web/react2/src/components/SeedsComponent.tsx +41 -21
- package/example-web/react2/src/components/ShovelsComponent.tsx +21 -9
- package/example-web/react2/src/components/Sidebar.tsx +105 -0
- package/example-web/react2/src/components/SprinklersComponent.tsx +25 -10
- package/example-web/react2/src/components/Tooltip.tsx +36 -0
- package/example-web/react2/src/components/UltimatesComponent.tsx +28 -16
- package/example-web/react2/src/components/UpgradesComponent.tsx +97 -47
- package/example-web/react2/src/components/WateringCansComponent.tsx +20 -14
- package/example-web/react2/src/components/WorldsComponent.tsx +21 -11
- package/example-web/react2/src/components/XPPotionsComponent.tsx +28 -11
- package/example-web/react2/src/components/ZoneFlagsComponent.tsx +25 -14
- package/example-web/react2/src/components/ZonesComponent.tsx +43 -60
- 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/context/ScrollContext.tsx +35 -0
- package/example-web/react2/src/hooks/useCollapsibleHeader.ts +69 -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/src/utils/gigantix.ts +40 -0
- 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/index.ts +1 -0
- package/src/responses/collection/rarity.ts +1 -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;
|
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
|
-
});
|