@aronnaxlin/bgm-cli 1.0.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/LICENSE +660 -0
- package/README.en.md +122 -0
- package/README.md +127 -0
- package/README.zh-TW.md +122 -0
- package/package.json +41 -0
- package/src/cli.js +993 -0
- package/src/commands/blog.js +213 -0
- package/src/commands/calendar.js +32 -0
- package/src/commands/character.js +291 -0
- package/src/commands/collection.js +418 -0
- package/src/commands/episode.js +379 -0
- package/src/commands/group.js +488 -0
- package/src/commands/index.js +362 -0
- package/src/commands/notify.js +74 -0
- package/src/commands/person.js +297 -0
- package/src/commands/status.js +74 -0
- package/src/commands/subject.js +537 -0
- package/src/commands/timeline.js +288 -0
- package/src/commands/trending.js +58 -0
- package/src/commands/tui.js +1537 -0
- package/src/commands/user.js +83 -0
- package/src/core/client.js +2065 -0
- package/src/core/config.js +450 -0
- package/src/core/http.js +144 -0
- package/src/core/output.js +3888 -0
- package/src/core/proxy.js +47 -0
- package/src/core/reactions.js +62 -0
- package/src/core/turnstile.js +526 -0
- package/src/data/bangumi-emotes.json +311 -0
- package/src/utils/args.js +113 -0
- package/src/utils/auth-flow.js +373 -0
- package/src/utils/auth.js +90 -0
- package/src/utils/calendar.js +23 -0
- package/src/utils/collection-ops.js +333 -0
- package/src/utils/collection.js +240 -0
- package/src/utils/formatters.js +157 -0
- package/src/utils/helpers.js +283 -0
- package/src/utils/hot.js +182 -0
- package/src/utils/install.js +40 -0
- package/src/utils/prompts.js +87 -0
- package/src/utils/relay.js +74 -0
- package/src/utils/status.js +68 -0
- package/src/utils/tui-interactive.js +197 -0
- package/src/utils/tui-render.js +86 -0
- package/src/utils/turnstile-flow.js +154 -0
- package/src/utils/validators.js +412 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
import { BangumiClient } from "../core/client.js";
|
|
2
|
+
import { getConfig } from "../core/config.js";
|
|
3
|
+
import { BangumiApiError } from "../core/http.js";
|
|
4
|
+
import { CommandError, printResult } from "../core/output.js";
|
|
5
|
+
import { firstPositional, getPositional, parseFlags } from "../utils/args.js";
|
|
6
|
+
import {
|
|
7
|
+
normalizeNonNegativeInteger,
|
|
8
|
+
normalizePageSize,
|
|
9
|
+
normalizeRateValue,
|
|
10
|
+
parseOptionalInteger,
|
|
11
|
+
resolveUsernameOrMe,
|
|
12
|
+
} from "../utils/helpers.js";
|
|
13
|
+
import {
|
|
14
|
+
COLLECTION_STATUS_MAP,
|
|
15
|
+
normalizeCollectionSort,
|
|
16
|
+
normalizeCollectionStatusFilter,
|
|
17
|
+
normalizeCollectionStatusValue,
|
|
18
|
+
normalizeSortOrder,
|
|
19
|
+
normalizeSubjectTypeFilter,
|
|
20
|
+
} from "../utils/validators.js";
|
|
21
|
+
import { fetchAllCollections, sortCollections } from "../utils/collection.js";
|
|
22
|
+
import {
|
|
23
|
+
buildCollectionActionResult,
|
|
24
|
+
buildCollectionMutationPayload,
|
|
25
|
+
fetchMySubjectCollection,
|
|
26
|
+
fetchMySubjectCollectionVerified,
|
|
27
|
+
formatCollectionStatusForError,
|
|
28
|
+
resolveCollectionTarget,
|
|
29
|
+
} from "../utils/collection-ops.js";
|
|
30
|
+
import { executeSubjectSearchCommand } from "./subject.js";
|
|
31
|
+
|
|
32
|
+
export async function runCollectionCommand(command, args, context) {
|
|
33
|
+
switch (command) {
|
|
34
|
+
case "list": {
|
|
35
|
+
const result = await executeCollectionListCommand(args);
|
|
36
|
+
printResult(result, context);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
case "get": {
|
|
40
|
+
const result = await executeCollectionGetCommand(args);
|
|
41
|
+
printResult(result, context);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
case "collect": {
|
|
45
|
+
const result = await executeCollectionCollectCommand(args);
|
|
46
|
+
printResult(result, context);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
case "comment": {
|
|
50
|
+
const result = await executeCollectionCommentCommand(args);
|
|
51
|
+
printResult(result, context);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
case "rate": {
|
|
55
|
+
const result = await executeCollectionRateCommand(args);
|
|
56
|
+
printResult(result, context);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
case "status": {
|
|
60
|
+
const result = await executeCollectionStatusCommand(args);
|
|
61
|
+
printResult(result, context);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
case "characters": {
|
|
65
|
+
const result = await executeP1CollectionListCommand(args, "characters");
|
|
66
|
+
printResult(result, context);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
case "persons": {
|
|
70
|
+
const result = await executeP1CollectionListCommand(args, "persons");
|
|
71
|
+
printResult(result, context);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
case "indexes": {
|
|
75
|
+
const result = await executeP1CollectionListCommand(args, "indexes");
|
|
76
|
+
printResult(result, context);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
case "collect-character":
|
|
80
|
+
case "uncollect-character":
|
|
81
|
+
case "collect-person":
|
|
82
|
+
case "uncollect-person":
|
|
83
|
+
case "collect-index":
|
|
84
|
+
case "uncollect-index": {
|
|
85
|
+
const result = await executeSimpleCollectionMutationCommand(command, args);
|
|
86
|
+
printResult(result, context);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
default:
|
|
90
|
+
throw new CommandError(
|
|
91
|
+
"Usage: bgm collection <list|get|collect|comment|rate|status|characters|persons|indexes|collect-character|uncollect-character|collect-person|uncollect-person|collect-index|uncollect-index> ...",
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function executeCollectionListCommand(args) {
|
|
97
|
+
const options = parseFlags(args);
|
|
98
|
+
const client = new BangumiClient(getConfig());
|
|
99
|
+
const username = await resolveUsernameOrMe(client, options.user);
|
|
100
|
+
const subjectTypes = normalizeSubjectTypeFilter(options.type);
|
|
101
|
+
const collectionTypes = normalizeCollectionStatusFilter(options.status);
|
|
102
|
+
const sort = normalizeCollectionSort(options.sort);
|
|
103
|
+
const order = normalizeSortOrder(options.order);
|
|
104
|
+
const limit = parseOptionalInteger(options.limit);
|
|
105
|
+
const offset = parseOptionalInteger(options.offset);
|
|
106
|
+
|
|
107
|
+
const apiQuery = {};
|
|
108
|
+
if (subjectTypes.length === 1) {
|
|
109
|
+
apiQuery.subject_type = subjectTypes[0];
|
|
110
|
+
}
|
|
111
|
+
if (collectionTypes.length === 1) {
|
|
112
|
+
apiQuery.type = collectionTypes[0];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let result = await fetchAllCollections(client, username, { query: apiQuery });
|
|
116
|
+
let data = Array.isArray(result.data) ? result.data : [];
|
|
117
|
+
|
|
118
|
+
if (subjectTypes.length > 1) {
|
|
119
|
+
const allowed = new Set(subjectTypes);
|
|
120
|
+
data = data.filter((item) => allowed.has(item.subject_type));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (collectionTypes.length > 1) {
|
|
124
|
+
const allowed = new Set(collectionTypes);
|
|
125
|
+
data = data.filter((item) => allowed.has(item.type));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
data = sortCollections(data, sort, order);
|
|
129
|
+
|
|
130
|
+
const start = offset ?? 0;
|
|
131
|
+
const end = limit !== undefined ? start + limit : undefined;
|
|
132
|
+
if (start > 0 || end !== undefined) {
|
|
133
|
+
data = data.slice(start, end);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
...result,
|
|
138
|
+
data,
|
|
139
|
+
total: result.total ?? data.length,
|
|
140
|
+
filters: {
|
|
141
|
+
user: username,
|
|
142
|
+
status: collectionTypes,
|
|
143
|
+
subjectType: subjectTypes,
|
|
144
|
+
sort,
|
|
145
|
+
order,
|
|
146
|
+
offset: offset ?? 0,
|
|
147
|
+
limit,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export async function executeP1CollectionListCommand(args, kind) {
|
|
153
|
+
const options = parseFlags(args);
|
|
154
|
+
const client = new BangumiClient(getConfig());
|
|
155
|
+
const username = await resolveUsernameOrMe(client, options.user);
|
|
156
|
+
const limit = normalizePageSize(options.limit);
|
|
157
|
+
const offset = normalizeNonNegativeInteger(options.offset, "offset");
|
|
158
|
+
const query = { limit, offset };
|
|
159
|
+
|
|
160
|
+
const method = {
|
|
161
|
+
characters: "listUserCharacterCollections",
|
|
162
|
+
persons: "listUserPersonCollections",
|
|
163
|
+
indexes: "listUserIndexCollections",
|
|
164
|
+
}[kind];
|
|
165
|
+
if (!method) {
|
|
166
|
+
throw new CommandError(`Unsupported collection kind: ${kind}`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const result = await client[method](username, query);
|
|
170
|
+
return {
|
|
171
|
+
...result,
|
|
172
|
+
resource: `collection-${kind}`,
|
|
173
|
+
title: formatP1CollectionTitle(kind),
|
|
174
|
+
filters: { user: username, limit, offset },
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function formatP1CollectionTitle(kind) {
|
|
179
|
+
return {
|
|
180
|
+
characters: "Character collections",
|
|
181
|
+
persons: "Person collections",
|
|
182
|
+
indexes: "Index collections",
|
|
183
|
+
}[kind] ?? `${kind} collections`;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export async function executeSimpleCollectionMutationCommand(command, args) {
|
|
187
|
+
const options = parseFlags(args);
|
|
188
|
+
const id = firstCollectionMutationId(options);
|
|
189
|
+
if (!id) {
|
|
190
|
+
throw new CommandError(`Usage: bgm collection ${command} <id>`);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const method = {
|
|
194
|
+
"collect-character": "addCharacterCollection",
|
|
195
|
+
"uncollect-character": "deleteCharacterCollection",
|
|
196
|
+
"collect-person": "addPersonCollection",
|
|
197
|
+
"uncollect-person": "deletePersonCollection",
|
|
198
|
+
"collect-index": "addIndexCollection",
|
|
199
|
+
"uncollect-index": "deleteIndexCollection",
|
|
200
|
+
}[command];
|
|
201
|
+
const kind = command.endsWith("character") ? "character" : command.endsWith("person") ? "person" : "index";
|
|
202
|
+
const action = command.startsWith("uncollect") ? "delete" : "add";
|
|
203
|
+
|
|
204
|
+
await new BangumiClient(getConfig())[method](id);
|
|
205
|
+
return {
|
|
206
|
+
resource: "simple-collection-mutation",
|
|
207
|
+
action,
|
|
208
|
+
kind,
|
|
209
|
+
id: Number(id),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function firstCollectionMutationId(options) {
|
|
214
|
+
return firstPositional(options) ?? options.id ?? options.characterId ?? options.personId ?? options.indexId;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export async function executeCollectionGetCommand(args) {
|
|
218
|
+
const options = parseFlags(args);
|
|
219
|
+
const client = new BangumiClient(getConfig());
|
|
220
|
+
const { subjectId, subject } = await resolveCollectionTarget(options, {
|
|
221
|
+
client,
|
|
222
|
+
searchSubjects: executeSubjectSearchCommand,
|
|
223
|
+
usage: "Usage: bgm collection get <subject_id> | bgm collection get --search <keyword> [--pick n] [--type anime] [--sort rank] [--limit n]",
|
|
224
|
+
});
|
|
225
|
+
const collection = await fetchMySubjectCollection(client, subjectId);
|
|
226
|
+
return buildCollectionActionResult({
|
|
227
|
+
action: "get",
|
|
228
|
+
actionLabel: "Collection detail",
|
|
229
|
+
subjectId,
|
|
230
|
+
subject,
|
|
231
|
+
collection,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export async function executeCollectionCollectCommand(args) {
|
|
236
|
+
const options = parseFlags(args);
|
|
237
|
+
const client = new BangumiClient(getConfig());
|
|
238
|
+
const rawStatus = options.status ?? getPositional(options, options.search ? 0 : 1) ?? "wish";
|
|
239
|
+
const { subjectId, subject } = await resolveCollectionTarget(options, {
|
|
240
|
+
client,
|
|
241
|
+
searchSubjects: executeSubjectSearchCommand,
|
|
242
|
+
usage: "Usage: bgm collection collect <subject_id> [<wish|collect|doing|on_hold|dropped>] | bgm collection collect --search <keyword> [<wish|collect|doing|on_hold|dropped>] [--status ...] [--pick n]",
|
|
243
|
+
});
|
|
244
|
+
const requestedStatus = normalizeCollectionStatusValue(rawStatus);
|
|
245
|
+
const payload = buildCollectionMutationPayload(options, {
|
|
246
|
+
defaultStatus: requestedStatus,
|
|
247
|
+
});
|
|
248
|
+
const currentCollection = await fetchMySubjectCollectionIfExists(client, subjectId);
|
|
249
|
+
const mutationPayload = currentCollection
|
|
250
|
+
? buildPreservedCollectionMutationPayload(currentCollection, payload)
|
|
251
|
+
: payload;
|
|
252
|
+
|
|
253
|
+
await client.upsertMyCollection(subjectId, mutationPayload);
|
|
254
|
+
const collection = await fetchMySubjectCollectionVerified(client, subjectId, {
|
|
255
|
+
expected: { type: requestedStatus },
|
|
256
|
+
actionLabel: "Collection status update",
|
|
257
|
+
mismatchMessage: (latest) =>
|
|
258
|
+
`Bangumi did not persist the requested collection status. Requested ${formatCollectionStatusForError(requestedStatus)}, but read back ${formatCollectionStatusForError(latest?.type)}.`,
|
|
259
|
+
});
|
|
260
|
+
return buildCollectionActionResult({
|
|
261
|
+
action: "collect",
|
|
262
|
+
actionLabel: "Collection updated",
|
|
263
|
+
subjectId,
|
|
264
|
+
subject,
|
|
265
|
+
collection,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export async function executeCollectionCommentCommand(args) {
|
|
270
|
+
const options = parseFlags(args);
|
|
271
|
+
const client = new BangumiClient(getConfig());
|
|
272
|
+
const comment = options.comment ?? getPositional(options, options.search ? 0 : 1);
|
|
273
|
+
if (comment === undefined) {
|
|
274
|
+
throw new CommandError(
|
|
275
|
+
"Usage: bgm collection comment <subject_id> <comment> | bgm collection comment --search <keyword> <comment> [--pick n]",
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const { subjectId, subject } = await resolveCollectionTarget(options, {
|
|
280
|
+
client,
|
|
281
|
+
searchSubjects: executeSubjectSearchCommand,
|
|
282
|
+
usage: "Usage: bgm collection comment <subject_id> <comment> | bgm collection comment --search <keyword> <comment> [--pick n]",
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const currentCollection = await fetchMySubjectCollection(client, subjectId);
|
|
286
|
+
await client.patchMyCollection(subjectId, buildPreservedCollectionMutationPayload(currentCollection, {
|
|
287
|
+
comment: String(comment),
|
|
288
|
+
}));
|
|
289
|
+
const collection = await fetchMySubjectCollection(client, subjectId);
|
|
290
|
+
return buildCollectionActionResult({
|
|
291
|
+
action: "comment",
|
|
292
|
+
actionLabel: "Collection comment updated",
|
|
293
|
+
subjectId,
|
|
294
|
+
subject,
|
|
295
|
+
collection,
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export async function executeCollectionRateCommand(args) {
|
|
300
|
+
const options = parseFlags(args);
|
|
301
|
+
const client = new BangumiClient(getConfig());
|
|
302
|
+
const rawRate = options.rate ?? options.value ?? getPositional(options, options.search ? 0 : 1);
|
|
303
|
+
if (rawRate === undefined) {
|
|
304
|
+
throw new CommandError(
|
|
305
|
+
"Usage: bgm collection rate <subject_id> <0-10> | bgm collection rate --search <keyword> <0-10> [--pick n]",
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const { subjectId, subject } = await resolveCollectionTarget(options, {
|
|
310
|
+
client,
|
|
311
|
+
searchSubjects: executeSubjectSearchCommand,
|
|
312
|
+
usage: "Usage: bgm collection rate <subject_id> <0-10> | bgm collection rate --search <keyword> <0-10> [--pick n]",
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
const requestedRate = normalizeRateValue(rawRate);
|
|
316
|
+
const currentCollection = await fetchMySubjectCollection(client, subjectId);
|
|
317
|
+
if (currentCollection?.type === COLLECTION_STATUS_MAP.wish && requestedRate > 0) {
|
|
318
|
+
throw new CommandError(
|
|
319
|
+
"Bangumi does not allow rating while the collection status is wish. Change it to collect/doing/on_hold/dropped first, or use rate 0.",
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
await client.patchMyCollection(subjectId, buildPreservedCollectionMutationPayload(currentCollection, {
|
|
324
|
+
rate: requestedRate,
|
|
325
|
+
}));
|
|
326
|
+
const collection = await fetchMySubjectCollectionVerified(client, subjectId, {
|
|
327
|
+
expected: { rate: requestedRate },
|
|
328
|
+
actionLabel: "Rating update",
|
|
329
|
+
mismatchMessage: (latest) =>
|
|
330
|
+
`Bangumi did not persist the requested rating. Requested ${requestedRate}, but read back ${latest?.rate ?? "-"}. This can happen under some collection states such as wish.`,
|
|
331
|
+
});
|
|
332
|
+
return buildCollectionActionResult({
|
|
333
|
+
action: "rate",
|
|
334
|
+
actionLabel: "Collection rating updated",
|
|
335
|
+
subjectId,
|
|
336
|
+
subject,
|
|
337
|
+
collection,
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export async function executeCollectionStatusCommand(args) {
|
|
342
|
+
const options = parseFlags(args);
|
|
343
|
+
const client = new BangumiClient(getConfig());
|
|
344
|
+
const rawStatus = options.status ?? getPositional(options, options.search ? 0 : 1);
|
|
345
|
+
if (!rawStatus) {
|
|
346
|
+
throw new CommandError(
|
|
347
|
+
"Usage: bgm collection status <subject_id> <wish|collect|doing|on_hold|dropped> | bgm collection status --search <keyword> <wish|collect|doing|on_hold|dropped> [--pick n]",
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const { subjectId, subject } = await resolveCollectionTarget(options, {
|
|
352
|
+
client,
|
|
353
|
+
searchSubjects: executeSubjectSearchCommand,
|
|
354
|
+
usage: "Usage: bgm collection status <subject_id> <wish|collect|doing|on_hold|dropped> | bgm collection status --search <keyword> <wish|collect|doing|on_hold|dropped> [--pick n]",
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
const requestedStatus = normalizeCollectionStatusValue(rawStatus);
|
|
358
|
+
const currentCollection = await fetchMySubjectCollection(client, subjectId);
|
|
359
|
+
await client.patchMyCollection(subjectId, buildPreservedCollectionMutationPayload(currentCollection, {
|
|
360
|
+
type: requestedStatus,
|
|
361
|
+
}));
|
|
362
|
+
const collection = await fetchMySubjectCollection(client, subjectId);
|
|
363
|
+
return buildCollectionActionResult({
|
|
364
|
+
action: "status",
|
|
365
|
+
actionLabel: "Collection status updated",
|
|
366
|
+
subjectId,
|
|
367
|
+
subject,
|
|
368
|
+
collection,
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
async function fetchMySubjectCollectionIfExists(client, subjectId) {
|
|
373
|
+
try {
|
|
374
|
+
return await fetchMySubjectCollection(client, subjectId);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
if (error instanceof BangumiApiError && error.status === 404) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
throw error;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function buildPreservedCollectionMutationPayload(currentCollection, changes = {}) {
|
|
384
|
+
const nextType = changes.type ?? currentCollection?.type;
|
|
385
|
+
const payload = {};
|
|
386
|
+
|
|
387
|
+
if (nextType !== undefined) {
|
|
388
|
+
payload.type = nextType;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const nextRate = changes.rate ?? currentCollection?.rate;
|
|
392
|
+
if (nextRate !== undefined) {
|
|
393
|
+
payload.rate = Number(nextType) === COLLECTION_STATUS_MAP.wish ? 0 : nextRate;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const nextComment = changes.comment ?? currentCollection?.comment;
|
|
397
|
+
if (nextComment !== undefined) {
|
|
398
|
+
payload.comment = String(nextComment);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
if (changes.private !== undefined) {
|
|
402
|
+
payload.private = changes.private;
|
|
403
|
+
} else if (currentCollection?.private !== undefined) {
|
|
404
|
+
payload.private = currentCollection.private;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (changes.tags !== undefined) {
|
|
408
|
+
payload.tags = changes.tags;
|
|
409
|
+
} else if (Array.isArray(currentCollection?.tags)) {
|
|
410
|
+
payload.tags = currentCollection.tags;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
if (changes.progress !== undefined) {
|
|
414
|
+
payload.progress = changes.progress;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return payload;
|
|
418
|
+
}
|