mirror of
https://github.com/PretendoNetwork/BOSS.git
synced 2026-07-06 20:14:53 -05:00
chore: Update pretendonetwork/grpc to 2.3.5
This commit is contained in:
parent
90f02ac286
commit
f3f895ebd6
14
package-lock.json
generated
14
package-lock.json
generated
|
|
@ -11,7 +11,7 @@
|
|||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.723.0",
|
||||
"@pretendonetwork/boss-crypto": "^1.1.3",
|
||||
"@pretendonetwork/grpc": "^2.3.4",
|
||||
"@pretendonetwork/grpc": "^2.3.5",
|
||||
"@typegoose/auto-increment": "^4.13.1",
|
||||
"commander": "^14.0.0",
|
||||
"cron": "^4.3.3",
|
||||
|
|
@ -2072,9 +2072,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@pretendonetwork/grpc": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-2.3.4.tgz",
|
||||
"integrity": "sha512-Ajtk8nHR2Auaks6SKUkm0cDVivjuIhitz6xaaxmVfb0hyVdZZO4EfjEtQdsRLmfbA+SWDxdszBPRD+LBsIdjxQ==",
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-2.3.5.tgz",
|
||||
"integrity": "sha512-FU0uvhZr8gFgiIi+gBtD6+5or34bHcd9X+ZVpRdc7IiupW5V+uxiXigJKX4Vd46QC412y+BEGofCjM1bBlTJhg==",
|
||||
"license": "AGPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@bufbuild/protobuf": "^2.2.2",
|
||||
|
|
@ -11320,9 +11320,9 @@
|
|||
}
|
||||
},
|
||||
"@pretendonetwork/grpc": {
|
||||
"version": "2.3.4",
|
||||
"resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-2.3.4.tgz",
|
||||
"integrity": "sha512-Ajtk8nHR2Auaks6SKUkm0cDVivjuIhitz6xaaxmVfb0hyVdZZO4EfjEtQdsRLmfbA+SWDxdszBPRD+LBsIdjxQ==",
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-2.3.5.tgz",
|
||||
"integrity": "sha512-FU0uvhZr8gFgiIi+gBtD6+5or34bHcd9X+ZVpRdc7IiupW5V+uxiXigJKX4Vd46QC412y+BEGofCjM1bBlTJhg==",
|
||||
"requires": {
|
||||
"@bufbuild/protobuf": "^2.2.2",
|
||||
"nice-grpc-common": "^2.0.2",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.723.0",
|
||||
"@pretendonetwork/boss-crypto": "^1.1.3",
|
||||
"@pretendonetwork/grpc": "^2.3.4",
|
||||
"@pretendonetwork/grpc": "^2.3.5",
|
||||
"@typegoose/auto-increment": "^4.13.1",
|
||||
"commander": "^14.0.0",
|
||||
"cron": "^4.3.3",
|
||||
|
|
|
|||
|
|
@ -12,12 +12,19 @@ const listCmd = new Command('ls')
|
|||
.description('List all task files in BOSS')
|
||||
.argument('<app_id>', 'BOSS app to search in')
|
||||
.argument('<task_id>', 'Task to search in')
|
||||
.option('-c, --country [country]', 'Country to filter with')
|
||||
.option('-l, --language [language]', 'Language to filter with')
|
||||
.option('-a, --any', 'Shows any file regardless of country and language requirements')
|
||||
.action(commandHandler<[string, string]>(async (cmd): Promise<void> => {
|
||||
const [appId, taskId] = cmd.args;
|
||||
const opts = cmd.opts<{ country?: string; language?: string; any: boolean }>();
|
||||
const ctx = getCliContext();
|
||||
const { files } = await ctx.grpc.listFilesCTR({
|
||||
bossAppId: appId,
|
||||
taskId: taskId
|
||||
taskId: taskId,
|
||||
country: opts.country,
|
||||
language: opts.language,
|
||||
any: opts.any
|
||||
});
|
||||
logOutputList(files, {
|
||||
format: cmd.format,
|
||||
|
|
@ -40,7 +47,8 @@ const viewCmd = new Command('view')
|
|||
const ctx = getCliContext();
|
||||
const { files } = await ctx.grpc.listFilesCTR({
|
||||
bossAppId: appId,
|
||||
taskId: taskId
|
||||
taskId: taskId,
|
||||
any: true
|
||||
});
|
||||
const file = files.find(v => v.dataId === dataId);
|
||||
if (!file) {
|
||||
|
|
|
|||
|
|
@ -12,12 +12,19 @@ const listCmd = new Command('ls')
|
|||
.description('List all task files in BOSS')
|
||||
.argument('<app_id>', 'BOSS app to search in')
|
||||
.argument('<task_id>', 'Task to search in')
|
||||
.option('-c, --country [country]', 'Country to filter with')
|
||||
.option('-l, --language [language]', 'Language to filter with')
|
||||
.option('-a, --any', 'Shows any file regardless of country and language requirements')
|
||||
.action(commandHandler<[string, string]>(async (cmd): Promise<void> => {
|
||||
const [appId, taskId] = cmd.args;
|
||||
const opts = cmd.opts<{ country?: string; language?: string; any: boolean }>();
|
||||
const ctx = getCliContext();
|
||||
const { files } = await ctx.grpc.listFilesWUP({
|
||||
bossAppId: appId,
|
||||
taskId: taskId
|
||||
taskId: taskId,
|
||||
country: opts.country,
|
||||
language: opts.language,
|
||||
any: opts.any
|
||||
});
|
||||
logOutputList(files, {
|
||||
format: cmd.format,
|
||||
|
|
@ -41,7 +48,8 @@ const viewCmd = new Command('view')
|
|||
const ctx = getCliContext();
|
||||
const { files } = await ctx.grpc.listFilesWUP({
|
||||
bossAppId: appId,
|
||||
taskId: taskId
|
||||
taskId: taskId,
|
||||
any: true
|
||||
});
|
||||
const file = files.find(v => v.dataId === dataId);
|
||||
if (!file) {
|
||||
|
|
|
|||
|
|
@ -81,19 +81,10 @@ export async function processTasksheet(ctx: CliContext, taskFiles: string[], fil
|
|||
bossAppId: bossAppId,
|
||||
id: taskName,
|
||||
titleId: BigInt(parseInt(xmlContents.TaskSheet.TitleId._text, 16)),
|
||||
country: 'This value isnt used'
|
||||
status: xmlContents.TaskSheet.ServiceStatus._text
|
||||
});
|
||||
console.log(`${filename}: Created task`);
|
||||
}
|
||||
await ctx.grpc.updateTask({
|
||||
bossAppId: bossAppId,
|
||||
id: taskName,
|
||||
updateData: {
|
||||
titleId: BigInt(parseInt(xmlContents.TaskSheet.TitleId._text, 16)),
|
||||
status: xmlContents.TaskSheet.ServiceStatus._text
|
||||
}
|
||||
});
|
||||
console.log(`${filename}: Updated title ID and status`);
|
||||
|
||||
let xmlFiles = xmlContents.TaskSheet.Files?.File ?? [];
|
||||
if (!Array.isArray(xmlFiles)) {
|
||||
|
|
|
|||
|
|
@ -54,17 +54,20 @@ const createCmd = new Command('create')
|
|||
.argument('<app_id>', 'BOSS app to store the task in')
|
||||
.requiredOption('--id <id>', 'Id of the task')
|
||||
.requiredOption('--title-id <titleId>', 'Title ID for the task')
|
||||
.option('--status [status]', 'Initial status of the task')
|
||||
.option('--interval [interval]', 'Interval of the task')
|
||||
.option('--desc [desc]', 'Description of the task')
|
||||
.action(commandHandler<[string]>(async (cmd): Promise<void> => {
|
||||
const [appId] = cmd.args;
|
||||
const ctx = getCliContext();
|
||||
const opts = cmd.opts<{ id: string; titleId: string; desc?: string }>();
|
||||
const opts = cmd.opts<{ id: string; titleId: string; status?: string; interval?: string; desc?: string }>();
|
||||
const { task } = await ctx.grpc.registerTask({
|
||||
bossAppId: appId,
|
||||
id: opts.id,
|
||||
titleId: BigInt(parseInt(opts.titleId, 16)),
|
||||
description: opts.desc ?? '',
|
||||
country: 'This value isnt used'
|
||||
status: opts.status ?? 'open',
|
||||
interval: Number(opts.interval ?? 0),
|
||||
description: opts.desc ?? ''
|
||||
});
|
||||
if (!task) {
|
||||
console.log(`Failed to create task!`);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export function getTask(bossAppID: string, taskID: string): Promise<HydratedTask
|
|||
});
|
||||
}
|
||||
|
||||
export function getCTRTaskFiles(allowDeleted: boolean, bossAppID: string, taskID: string, country?: string, language?: string): Promise<HydratedFileCTRDocument[]> {
|
||||
export function getCTRTaskFiles(allowDeleted: boolean, bossAppID: string, taskID: string, country?: string, language?: string, any: boolean = false): Promise<HydratedFileCTRDocument[]> {
|
||||
verifyConnected();
|
||||
|
||||
const filter: mongoose.FilterQuery<IFileCTR> = {
|
||||
|
|
@ -74,7 +74,7 @@ export function getCTRTaskFiles(allowDeleted: boolean, bossAppID: string, taskID
|
|||
{ supported_countries: country }
|
||||
]
|
||||
});
|
||||
} else {
|
||||
} else if (!any) {
|
||||
filter.$and?.push({
|
||||
supported_countries: { $eq: [] }
|
||||
});
|
||||
|
|
@ -87,16 +87,20 @@ export function getCTRTaskFiles(allowDeleted: boolean, bossAppID: string, taskID
|
|||
{ supported_languages: language }
|
||||
]
|
||||
});
|
||||
} else {
|
||||
} else if (!any) {
|
||||
filter.$and?.push({
|
||||
supported_languages: { $eq: [] }
|
||||
});
|
||||
}
|
||||
|
||||
if (filter.$and?.length === 0) {
|
||||
delete filter.$and;
|
||||
}
|
||||
|
||||
return FileCTR.find(filter);
|
||||
}
|
||||
|
||||
export function getWUPTaskFiles(allowDeleted: boolean, bossAppID: string, taskID: string, country?: string, language?: string): Promise<HydratedFileWUPDocument[]> {
|
||||
export function getWUPTaskFiles(allowDeleted: boolean, bossAppID: string, taskID: string, country?: string, language?: string, any: boolean = false): Promise<HydratedFileWUPDocument[]> {
|
||||
verifyConnected();
|
||||
|
||||
const filter: mongoose.FilterQuery<IFileWUP> = {
|
||||
|
|
@ -116,7 +120,7 @@ export function getWUPTaskFiles(allowDeleted: boolean, bossAppID: string, taskID
|
|||
{ supported_countries: country }
|
||||
]
|
||||
});
|
||||
} else {
|
||||
} else if (!any) {
|
||||
filter.$and?.push({
|
||||
supported_countries: { $eq: [] }
|
||||
});
|
||||
|
|
@ -129,12 +133,16 @@ export function getWUPTaskFiles(allowDeleted: boolean, bossAppID: string, taskID
|
|||
{ supported_languages: language }
|
||||
]
|
||||
});
|
||||
} else {
|
||||
} else if (!any) {
|
||||
filter.$and?.push({
|
||||
supported_languages: { $eq: [] }
|
||||
});
|
||||
}
|
||||
|
||||
if (filter.$and?.length === 0) {
|
||||
delete filter.$and;
|
||||
}
|
||||
|
||||
return FileWUP.find(filter);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ export async function registerTask(request: RegisterTaskRequest, context: CallCo
|
|||
in_game_id: taskID,
|
||||
boss_app_id: bossAppID,
|
||||
creator_pid: context.user?.pid,
|
||||
status: 'open', // TODO - Make this configurable
|
||||
status: 'open',
|
||||
title_id: titleID,
|
||||
description: description,
|
||||
created: Date.now(),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export async function listFilesCTR(request: ListFilesCTRRequest): Promise<ListFi
|
|||
const bossAppID = request.bossAppId.trim();
|
||||
const country = request.country?.trim();
|
||||
const language = request.language?.trim();
|
||||
const any = request.any;
|
||||
|
||||
if (!taskID) {
|
||||
throw new ServerError(Status.INVALID_ARGUMENT, 'Missing task ID');
|
||||
|
|
@ -35,12 +36,12 @@ export async function listFilesCTR(request: ListFilesCTRRequest): Promise<ListFi
|
|||
throw new ServerError(Status.INVALID_ARGUMENT, `${language} is not a valid language`);
|
||||
}
|
||||
|
||||
const files = await getCTRTaskFiles(false, bossAppID, taskID, country, language);
|
||||
const files = await getCTRTaskFiles(false, bossAppID, taskID, country, language, any);
|
||||
|
||||
return {
|
||||
files: files.map(file => ({
|
||||
deleted: file.deleted,
|
||||
dataId: file.serial_number, // TODO - Is this okay?
|
||||
dataId: file.serial_number,
|
||||
taskId: file.task_id,
|
||||
bossAppId: file.boss_app_id,
|
||||
supportedCountries: file.supported_countries,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ export async function listFilesWUP(request: ListFilesWUPRequest): Promise<ListFi
|
|||
const bossAppID = request.bossAppId.trim();
|
||||
const country = request.country?.trim();
|
||||
const language = request.language?.trim();
|
||||
const any = request.any;
|
||||
|
||||
if (!taskID) {
|
||||
throw new ServerError(Status.INVALID_ARGUMENT, 'Missing task ID');
|
||||
|
|
@ -35,7 +36,7 @@ export async function listFilesWUP(request: ListFilesWUPRequest): Promise<ListFi
|
|||
throw new ServerError(Status.INVALID_ARGUMENT, `${language} is not a valid language`);
|
||||
}
|
||||
|
||||
const files = await getWUPTaskFiles(false, bossAppID, taskID, country, language);
|
||||
const files = await getWUPTaskFiles(false, bossAppID, taskID, country, language, any);
|
||||
|
||||
return {
|
||||
files: files.map(file => ({
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export async function registerTask(request: RegisterTaskRequest, context: CallCo
|
|||
const taskID = request.id.trim();
|
||||
const bossAppID = request.bossAppId.trim();
|
||||
const titleID = request.titleId.toString(16).toLowerCase().padStart(16, '0');
|
||||
const status = request.status;
|
||||
const description = request.description.trim();
|
||||
|
||||
if (!taskID) {
|
||||
|
|
@ -38,6 +39,10 @@ export async function registerTask(request: RegisterTaskRequest, context: CallCo
|
|||
throw new ServerError(Status.ALREADY_EXISTS, `Task ${taskID} already exists for BOSS app ${bossAppID}`);
|
||||
}
|
||||
|
||||
if (status !== 'open' && status !== 'close') {
|
||||
throw new ServerError(Status.INVALID_ARGUMENT, `Status ${status} is invalid`);
|
||||
}
|
||||
|
||||
// * BOSS tasks have 2 IDs
|
||||
// * - 1: The ID which is registered in-game
|
||||
// * - 2: The ID which is registered on the server
|
||||
|
|
@ -53,7 +58,7 @@ export async function registerTask(request: RegisterTaskRequest, context: CallCo
|
|||
in_game_id: taskID,
|
||||
boss_app_id: bossAppID,
|
||||
creator_pid: context.user?.pid,
|
||||
status: 'open', // TODO - Make this configurable
|
||||
status,
|
||||
title_id: titleID,
|
||||
description: description,
|
||||
created: Date.now(),
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export async function updateTask(request: UpdateTaskRequest, context: CallContex
|
|||
throw new ServerError(Status.INVALID_ARGUMENT, `Task ${taskID} not found for BOSS app ${bossAppID}`);
|
||||
}
|
||||
|
||||
if (updateData.status !== 'open') {
|
||||
if (updateData.status !== 'open' && updateData.status !== 'close') {
|
||||
throw new ServerError(Status.INVALID_ARGUMENT, `Status ${updateData.status} is invalid`);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export interface ITask {
|
|||
in_game_id: string;
|
||||
boss_app_id: string;
|
||||
creator_pid: number;
|
||||
status: 'open'; // TODO - Make this a union. What else is there?
|
||||
status: 'open' | 'close'; // TODO - Make this a union. What else is there?
|
||||
title_id: string;
|
||||
description: string;
|
||||
created: bigint;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user