vigor-roblox 1.0.2 → 1.0.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/index.d.ts +15 -1
- package/dist/index.js +48 -1
- package/dist/index.mjs +48 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -183,6 +183,15 @@ interface RobloxServerLocation {
|
|
|
183
183
|
isp: string;
|
|
184
184
|
timezone: string;
|
|
185
185
|
}
|
|
186
|
+
interface RobloxFriendEntry {
|
|
187
|
+
id: RobloxUserId;
|
|
188
|
+
name: RobloxUserName;
|
|
189
|
+
displayName: RobloxDisplayName;
|
|
190
|
+
hasVerifiedBadge?: boolean;
|
|
191
|
+
isOnline?: boolean;
|
|
192
|
+
isDeleted?: boolean;
|
|
193
|
+
friendFrom?: string | null;
|
|
194
|
+
}
|
|
186
195
|
interface CreateRobloxApiOptions {
|
|
187
196
|
cache: RobloxApiCache;
|
|
188
197
|
cookies: RobloxCookie[];
|
|
@@ -232,13 +241,18 @@ interface RobloxApi {
|
|
|
232
241
|
placeId: RobloxPlaceId;
|
|
233
242
|
jobIds: RobloxJobId[];
|
|
234
243
|
}) => Promise<RobloxServerLocation[]>;
|
|
244
|
+
friends: (userId: RobloxUserId) => Promise<RobloxFriendEntry[]>;
|
|
245
|
+
sendFriendRequest: (targetUserId: RobloxUserId) => Promise<void>;
|
|
246
|
+
unfriend: (targetUserId: RobloxUserId) => Promise<void>;
|
|
235
247
|
_internal: {
|
|
236
248
|
gamejoinApi: VigorFetchInstance;
|
|
237
249
|
gamesApi: VigorFetchInstance;
|
|
238
250
|
apisRoblox: VigorFetchInstance;
|
|
251
|
+
friendsApi: VigorFetchInstance;
|
|
252
|
+
presenceApi: VigorFetchInstance;
|
|
239
253
|
};
|
|
240
254
|
}
|
|
241
255
|
declare function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }: CreateRobloxApiOptions): RobloxApi;
|
|
242
256
|
|
|
243
257
|
export { RobloxAuthError, RobloxRateLimitError, RobloxRequestError, createRobloxApi };
|
|
244
|
-
export type { CreateRobloxApiOptions, RobloxApi, RobloxApiCache, RobloxAssetId, RobloxAuthenticatedUser, RobloxCookie, RobloxDisplayName, RobloxJobId, RobloxPlaceId, RobloxPlaceInfo, RobloxPresenceEntry, RobloxServerEntry, RobloxServerEntryWithLocation, RobloxServerLocation, RobloxServersResult, RobloxThumbnail, RobloxThumbnailRaw, RobloxThumbnailTarget, RobloxUniverseId, RobloxUser, RobloxUserAgeBracket, RobloxUserBirthdate, RobloxUserCountryCode, RobloxUserDescription, RobloxUserGender, RobloxUserId, RobloxUserName, RobloxUserRoles, RobloxUserSimple, VigorFetchInstance };
|
|
258
|
+
export type { CreateRobloxApiOptions, RobloxApi, RobloxApiCache, RobloxAssetId, RobloxAuthenticatedUser, RobloxCookie, RobloxDisplayName, RobloxFriendEntry, RobloxJobId, RobloxPlaceId, RobloxPlaceInfo, RobloxPresenceEntry, RobloxServerEntry, RobloxServerEntryWithLocation, RobloxServerLocation, RobloxServersResult, RobloxThumbnail, RobloxThumbnailRaw, RobloxThumbnailTarget, RobloxUniverseId, RobloxUser, RobloxUserAgeBracket, RobloxUserBirthdate, RobloxUserCountryCode, RobloxUserDescription, RobloxUserGender, RobloxUserId, RobloxUserName, RobloxUserRoles, RobloxUserSimple, VigorFetchInstance };
|
package/dist/index.js
CHANGED
|
@@ -1904,6 +1904,14 @@ function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }) {
|
|
|
1904
1904
|
.retryConfig(c => c
|
|
1905
1905
|
.settings(s => s.attempt(4))
|
|
1906
1906
|
.algorithms(a => a.backoff().initial(500).multiplier(2)));
|
|
1907
|
+
// friends.roblox.com — used for friend list lookups, sending friend
|
|
1908
|
+
// requests, and unfriending. Same cookie + WinInet headers as usersApi.
|
|
1909
|
+
const friendsApi = vigor.fetch('https://friends.roblox.com/v1')
|
|
1910
|
+
.interceptors(cookieInterceptor)
|
|
1911
|
+
.interceptors(winInetInterceptor)
|
|
1912
|
+
.retryConfig(c => c
|
|
1913
|
+
.settings(s => s.attempt(5))
|
|
1914
|
+
.algorithms(a => a.backoff().initial(500).multiplier(2)));
|
|
1907
1915
|
async function withCache(opts) {
|
|
1908
1916
|
const { type, keys, ttlMs, getKey, fetchMissing, fallback } = opts;
|
|
1909
1917
|
const cached = await cache.select(type, keys);
|
|
@@ -2398,6 +2406,42 @@ function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }) {
|
|
|
2398
2406
|
]);
|
|
2399
2407
|
return jobIds.flatMap(id => { const loc = resultMap.get(id); return loc ? [loc] : []; });
|
|
2400
2408
|
}
|
|
2409
|
+
// ----------------------------------------------------------------
|
|
2410
|
+
// Friends
|
|
2411
|
+
// ----------------------------------------------------------------
|
|
2412
|
+
async function friends(userId) {
|
|
2413
|
+
try {
|
|
2414
|
+
return await friendsApi
|
|
2415
|
+
.path('users', userId, 'friends')
|
|
2416
|
+
.interceptors(dataInterceptor)
|
|
2417
|
+
.request();
|
|
2418
|
+
}
|
|
2419
|
+
catch (cause) {
|
|
2420
|
+
throw wrapVigorError(cause);
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
async function sendFriendRequest(targetUserId) {
|
|
2424
|
+
try {
|
|
2425
|
+
await friendsApi
|
|
2426
|
+
.path('users', targetUserId, 'request-friendship')
|
|
2427
|
+
.body({})
|
|
2428
|
+
.request();
|
|
2429
|
+
}
|
|
2430
|
+
catch (cause) {
|
|
2431
|
+
throw wrapVigorError(cause);
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
async function unfriend(targetUserId) {
|
|
2435
|
+
try {
|
|
2436
|
+
await friendsApi
|
|
2437
|
+
.path('users', targetUserId, 'unfriend')
|
|
2438
|
+
.body({})
|
|
2439
|
+
.request();
|
|
2440
|
+
}
|
|
2441
|
+
catch (cause) {
|
|
2442
|
+
throw wrapVigorError(cause);
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2401
2445
|
return {
|
|
2402
2446
|
authenticated,
|
|
2403
2447
|
usersSimple,
|
|
@@ -2413,7 +2457,10 @@ function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }) {
|
|
|
2413
2457
|
usersWithImg,
|
|
2414
2458
|
track,
|
|
2415
2459
|
serversRegion,
|
|
2416
|
-
|
|
2460
|
+
friends,
|
|
2461
|
+
sendFriendRequest,
|
|
2462
|
+
unfriend,
|
|
2463
|
+
_internal: { gamejoinApi, gamesApi, apisRoblox, friendsApi, presenceApi },
|
|
2417
2464
|
};
|
|
2418
2465
|
}
|
|
2419
2466
|
|
package/dist/index.mjs
CHANGED
|
@@ -1902,6 +1902,14 @@ function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }) {
|
|
|
1902
1902
|
.retryConfig(c => c
|
|
1903
1903
|
.settings(s => s.attempt(4))
|
|
1904
1904
|
.algorithms(a => a.backoff().initial(500).multiplier(2)));
|
|
1905
|
+
// friends.roblox.com — used for friend list lookups, sending friend
|
|
1906
|
+
// requests, and unfriending. Same cookie + WinInet headers as usersApi.
|
|
1907
|
+
const friendsApi = vigor.fetch('https://friends.roblox.com/v1')
|
|
1908
|
+
.interceptors(cookieInterceptor)
|
|
1909
|
+
.interceptors(winInetInterceptor)
|
|
1910
|
+
.retryConfig(c => c
|
|
1911
|
+
.settings(s => s.attempt(5))
|
|
1912
|
+
.algorithms(a => a.backoff().initial(500).multiplier(2)));
|
|
1905
1913
|
async function withCache(opts) {
|
|
1906
1914
|
const { type, keys, ttlMs, getKey, fetchMissing, fallback } = opts;
|
|
1907
1915
|
const cached = await cache.select(type, keys);
|
|
@@ -2396,6 +2404,42 @@ function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }) {
|
|
|
2396
2404
|
]);
|
|
2397
2405
|
return jobIds.flatMap(id => { const loc = resultMap.get(id); return loc ? [loc] : []; });
|
|
2398
2406
|
}
|
|
2407
|
+
// ----------------------------------------------------------------
|
|
2408
|
+
// Friends
|
|
2409
|
+
// ----------------------------------------------------------------
|
|
2410
|
+
async function friends(userId) {
|
|
2411
|
+
try {
|
|
2412
|
+
return await friendsApi
|
|
2413
|
+
.path('users', userId, 'friends')
|
|
2414
|
+
.interceptors(dataInterceptor)
|
|
2415
|
+
.request();
|
|
2416
|
+
}
|
|
2417
|
+
catch (cause) {
|
|
2418
|
+
throw wrapVigorError(cause);
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
async function sendFriendRequest(targetUserId) {
|
|
2422
|
+
try {
|
|
2423
|
+
await friendsApi
|
|
2424
|
+
.path('users', targetUserId, 'request-friendship')
|
|
2425
|
+
.body({})
|
|
2426
|
+
.request();
|
|
2427
|
+
}
|
|
2428
|
+
catch (cause) {
|
|
2429
|
+
throw wrapVigorError(cause);
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
async function unfriend(targetUserId) {
|
|
2433
|
+
try {
|
|
2434
|
+
await friendsApi
|
|
2435
|
+
.path('users', targetUserId, 'unfriend')
|
|
2436
|
+
.body({})
|
|
2437
|
+
.request();
|
|
2438
|
+
}
|
|
2439
|
+
catch (cause) {
|
|
2440
|
+
throw wrapVigorError(cause);
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2399
2443
|
return {
|
|
2400
2444
|
authenticated,
|
|
2401
2445
|
usersSimple,
|
|
@@ -2411,7 +2455,10 @@ function createRobloxApi({ cache, cookies: cookiesList, ipgeolocationKey, }) {
|
|
|
2411
2455
|
usersWithImg,
|
|
2412
2456
|
track,
|
|
2413
2457
|
serversRegion,
|
|
2414
|
-
|
|
2458
|
+
friends,
|
|
2459
|
+
sendFriendRequest,
|
|
2460
|
+
unfriend,
|
|
2461
|
+
_internal: { gamejoinApi, gamesApi, apisRoblox, friendsApi, presenceApi },
|
|
2415
2462
|
};
|
|
2416
2463
|
}
|
|
2417
2464
|
|