mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Update splatnet3-types
This commit is contained in:
parent
24a0d2bdc8
commit
4a9c0085f1
14
package-lock.json
generated
14
package-lock.json
generated
|
|
@ -23,7 +23,7 @@
|
|||
"node-notifier": "^10.0.1",
|
||||
"node-persist": "^3.1.0",
|
||||
"read": "^1.0.7",
|
||||
"splatnet3-types": "^0.2.20221212221842",
|
||||
"splatnet3-types": "^0.2.20230125112953",
|
||||
"supports-color": "^8.1.1",
|
||||
"tslib": "^2.4.1",
|
||||
"uuid": "^8.3.2",
|
||||
|
|
@ -4065,9 +4065,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/splatnet3-types": {
|
||||
"version": "0.2.20221212221842",
|
||||
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20221212221842.tgz",
|
||||
"integrity": "sha512-A/fs/0mUBpdH2q2ye7z5fbUFOFJdmD9t0j36RZ0fpTm8hiA0orjZ15l8FJ1gZTo8xVtzYbA9cQWjq/dth0nPmw=="
|
||||
"version": "0.2.20230125112953",
|
||||
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20230125112953.tgz",
|
||||
"integrity": "sha512-ZoyYHjRlq0ZIg8ZWVnQ6MYWSjEv7nVMgSImyDqho9taZS31yxrSj/xZer6teTSrCTGIabYDvx+MPEhAHg8Jbpw=="
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.1.2",
|
||||
|
|
@ -7769,9 +7769,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"splatnet3-types": {
|
||||
"version": "0.2.20221212221842",
|
||||
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20221212221842.tgz",
|
||||
"integrity": "sha512-A/fs/0mUBpdH2q2ye7z5fbUFOFJdmD9t0j36RZ0fpTm8hiA0orjZ15l8FJ1gZTo8xVtzYbA9cQWjq/dth0nPmw=="
|
||||
"version": "0.2.20230125112953",
|
||||
"resolved": "https://registry.npmjs.org/splatnet3-types/-/splatnet3-types-0.2.20230125112953.tgz",
|
||||
"integrity": "sha512-ZoyYHjRlq0ZIg8ZWVnQ6MYWSjEv7nVMgSImyDqho9taZS31yxrSj/xZer6teTSrCTGIabYDvx+MPEhAHg8Jbpw=="
|
||||
},
|
||||
"sprintf-js": {
|
||||
"version": "1.1.2",
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
"node-notifier": "^10.0.1",
|
||||
"node-persist": "^3.1.0",
|
||||
"read": "^1.0.7",
|
||||
"splatnet3-types": "^0.2.20221212221842",
|
||||
"splatnet3-types": "^0.2.20230125112953",
|
||||
"supports-color": "^8.1.1",
|
||||
"tslib": "^2.4.1",
|
||||
"uuid": "^8.3.2",
|
||||
|
|
|
|||
|
|
@ -51,6 +51,16 @@ export interface PersistedQueryResultData {
|
|||
[VariablesSymbol]: {};
|
||||
}
|
||||
|
||||
export type NotNullPersistedQueryResult<
|
||||
T extends PersistedQueryResult<unknown> | unknown,
|
||||
K extends T extends PersistedQueryResult<infer Result> ? keyof Result : keyof T,
|
||||
> =
|
||||
T extends PersistedQueryResult<infer Result> ? PersistedQueryResult<{
|
||||
[FieldName in keyof Result]: FieldName extends K ? Exclude<Result[FieldName], null> : Result[FieldName];
|
||||
}> : PersistedQueryResult<{
|
||||
[FieldName in keyof T]: FieldName extends K ? Exclude<T[FieldName], null> : T[FieldName];
|
||||
}>;
|
||||
|
||||
enum MapQueriesMode {
|
||||
/** NXAPI_SPLATNET3_UPGRADE_QUERIES=0 - never upgrade persisted query IDs (not recommended) */
|
||||
NEVER,
|
||||
|
|
@ -353,7 +363,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Journey not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'journey'>;
|
||||
}
|
||||
|
||||
/** / -> /challenge -> /challenge/{id} -> pull-to-refresh */
|
||||
|
|
@ -366,7 +376,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Journey not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'journey'>;
|
||||
}
|
||||
|
||||
/** / -> /challenge -> /challenge/{id} -> /challenge/{id}/*s */
|
||||
|
|
@ -379,7 +389,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Journey not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'journey'>;
|
||||
}
|
||||
|
||||
/** / -> /challenge -> /challenge/{id} -> /challenge/{id}/* -> pull-to-refresh */
|
||||
|
|
@ -392,7 +402,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Journey not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'journey'>;
|
||||
}
|
||||
|
||||
/** / -> /challenge -> /challenge/{id} -> /challenge/{id}/* -> support */
|
||||
|
|
@ -426,7 +436,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Fest not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'fest'>;
|
||||
}
|
||||
|
||||
/** / -> /fest_record -> /fest_record/{id} -> pull-to-refresh */
|
||||
|
|
@ -439,7 +449,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Fest not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'fest'>;
|
||||
}
|
||||
|
||||
/** / -> /fest_record -> /fest_record/{id} - not closed -> /fest_record/voting_status/{id} */
|
||||
|
|
@ -452,7 +462,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Fest not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'fest'>;
|
||||
}
|
||||
|
||||
/** / -> /fest_record -> /fest_record/{id} - not closed -> /fest_record/voting_status/{id} -> pull-to-refresh */
|
||||
|
|
@ -465,7 +475,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Fest not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'fest'>;
|
||||
}
|
||||
|
||||
/** / -> /fest_record -> /fest_record/{id} - not closed -> /fest_record/voting_status/{id} - not voted in game */
|
||||
|
|
@ -485,7 +495,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Fest not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'fest'>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -504,7 +514,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] FestTeam not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'node'>;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -609,7 +619,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Sale gear not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'saleGear'>;
|
||||
}
|
||||
|
||||
/** / -> /gesotown -> /gesotown/{id} -> order */
|
||||
|
|
@ -646,7 +656,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] My outfit not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'myOutfit'>;
|
||||
}
|
||||
|
||||
/** / -> /my_outfits -> /my_outfits/{id / create} */
|
||||
|
|
@ -709,7 +719,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Replay not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'replay'>;
|
||||
}
|
||||
|
||||
/** / -> /replay -> enter code -> download */
|
||||
|
|
@ -810,7 +820,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Battle history not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'vsHistoryDetail'>;
|
||||
}
|
||||
|
||||
/** / -> /history -> /history/detail/{id} -> pull-to-refresh */
|
||||
|
|
@ -823,7 +833,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Battle history not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'vsHistoryDetail'>;
|
||||
}
|
||||
|
||||
/** / -> /history -> /history/detail/* -> latest */
|
||||
|
|
@ -869,7 +879,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Co-op history not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'coopHistoryDetail'>;
|
||||
}
|
||||
|
||||
/** / -> /coop -> /coop/{id} -> pull-to-refresh */
|
||||
|
|
@ -882,7 +892,7 @@ export default class SplatNet3Api {
|
|||
throw new ErrorResponse('[splatnet3] Co-op history not found', result[ResponseSymbol], result);
|
||||
}
|
||||
|
||||
return result;
|
||||
return result as NotNullPersistedQueryResult<typeof result, 'node'>;
|
||||
}
|
||||
|
||||
/** / -> /coop -> /coop/* -> latest */
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import SplatNet3Api from '../api/splatnet3.js';
|
|||
import { ErrorResponse } from '../api/util.js';
|
||||
import { EventStreamResponse, HttpServer, ResponseError } from './util/http-server.js';
|
||||
import { getTitleIdFromEcUrl } from '../util/misc.js';
|
||||
import StageScheduleQuery_730cd98 from 'splatnet3-types/graphql/730cd98e84f1030d3e9ac86b6f1aae13';
|
||||
|
||||
const debug = createDebug('cli:presence-server');
|
||||
const debugSplatnet3Proxy = createDebug('cli:presence-server:splatnet3-proxy');
|
||||
|
|
@ -659,8 +660,8 @@ class Server extends HttpServer {
|
|||
if (vs_mode.mode === 'FEST') {
|
||||
return getSchedule(schedules.festSchedules)?.festMatchSetting;
|
||||
}
|
||||
if (vs_mode.mode === 'LEAGUE') {
|
||||
return getSchedule(schedules.leagueSchedules)?.leagueMatchSetting;
|
||||
if (vs_mode.mode === 'LEAGUE' && 'leagueSchedules' in schedules) {
|
||||
return getSchedule((schedules as StageScheduleQuery_730cd98).leagueSchedules)?.leagueMatchSetting;
|
||||
}
|
||||
if (vs_mode.mode === 'X_MATCH') {
|
||||
return getSchedule(schedules.xSchedules)?.xMatchSetting;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export async function handler(argv: ArgumentsCamelCase<Arguments>) {
|
|||
throw new Error('Invalid Splatfest ID');
|
||||
}
|
||||
|
||||
const fest = (await splatnet.getFestDetail(fest_record.id)).data.fest!;
|
||||
const fest = (await splatnet.getFestDetail(fest_record.id)).data.fest;
|
||||
const fest_votes = fest.state !== FestState.CLOSED ?
|
||||
(await splatnet.getFestVotingStatus(fest_record.id)).data.fest : null;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { EmbeddedLoop, LoopResult } from '../../util/loop.js';
|
|||
import { ArgumentsCamelCase } from '../../util/yargs.js';
|
||||
import { DiscordPresenceContext, ErrorResult } from '../types.js';
|
||||
import { product } from '../../util/product.js';
|
||||
import StageScheduleQuery_730cd98 from 'splatnet3-types/graphql/730cd98e84f1030d3e9ac86b6f1aae13';
|
||||
|
||||
const debug = createDebug('nxapi:discord:splatnet3');
|
||||
|
||||
|
|
@ -129,7 +130,8 @@ export default class SplatNet3Monitor extends EmbeddedLoop {
|
|||
|
||||
this.anarchy_schedule = this.getSchedule(this.cached_schedules?.data.bankaraSchedules.nodes ?? []);
|
||||
this.fest_schedule = this.getSchedule(this.cached_schedules?.data.festSchedules.nodes ?? []);
|
||||
this.league_schedule = this.getSchedule(this.cached_schedules?.data.leagueSchedules.nodes ?? []);
|
||||
this.league_schedule = this.cached_schedules?.data && 'leagueSchedules' in this.cached_schedules.data ?
|
||||
this.getSchedule((this.cached_schedules.data as StageScheduleQuery_730cd98).leagueSchedules.nodes ?? []) : null;
|
||||
this.x_schedule = this.getSchedule(this.cached_schedules?.data.xSchedules.nodes ?? []);
|
||||
this.coop_regular_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.regularSchedules.nodes ?? []);
|
||||
this.coop_big_run_schedule = this.getSchedule(this.cached_schedules?.data.coopGroupingSchedule.bigRunSchedules.nodes ?? []);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user