move all typedefs to the top

This commit is contained in:
Robonau 2024-11-11 22:08:06 +00:00 committed by shamoon
parent c6e01f4334
commit dd7a06819c

View File

@ -13,33 +13,6 @@ const logger = createLogger(proxyName);
* @property {string} gqlCondition * @property {string} gqlCondition
*/ */
/** @type {Record<string, countsToExtractItem>} */
const countsToExtract = {
download: {
condition: (c) => c.isDownloaded,
gqlCondition: "isDownloaded: true",
},
nondownload: {
condition: (c) => !c.isDownloaded,
gqlCondition: "isDownloaded: false",
},
read: { condition: (c) => c.isRead, gqlCondition: "isRead: true" },
unread: { condition: (c) => !c.isRead, gqlCondition: "isRead: false" },
downloadedread: { condition: (c) => c.isDownloaded && c.isRead, gqlCondition: "isDownloaded: true, isRead: true" },
downloadedunread: {
condition: (c) => c.isDownloaded && !c.isRead,
gqlCondition: "isDownloaded: true, isRead: false",
},
nondownloadedread: {
condition: (c) => !c.isDownloaded && c.isRead,
gqlCondition: "isDownloaded: false, isRead: true",
},
nondownloadedunread: {
condition: (c) => !c.isDownloaded && !c.isRead,
gqlCondition: "isDownloaded: false, isRead: false",
},
};
/** /**
* @typedef totalCount * @typedef totalCount
* @type {object} * @type {object}
@ -87,6 +60,42 @@ const countsToExtract = {
* }} * }}
*/ */
/**
* @typedef {object} widget
* @property {string} username
* @property {string} password
* @property {string[]|null} fields
* @property {string|number|undefined} category
* @property {keyof typeof widgets} type
*/
/** @type {Record<string, countsToExtractItem>} */
const countsToExtract = {
download: {
condition: (c) => c.isDownloaded,
gqlCondition: "isDownloaded: true",
},
nondownload: {
condition: (c) => !c.isDownloaded,
gqlCondition: "isDownloaded: false",
},
read: { condition: (c) => c.isRead, gqlCondition: "isRead: true" },
unread: { condition: (c) => !c.isRead, gqlCondition: "isRead: false" },
downloadedread: { condition: (c) => c.isDownloaded && c.isRead, gqlCondition: "isDownloaded: true, isRead: true" },
downloadedunread: {
condition: (c) => c.isDownloaded && !c.isRead,
gqlCondition: "isDownloaded: true, isRead: false",
},
nondownloadedread: {
condition: (c) => !c.isDownloaded && c.isRead,
gqlCondition: "isDownloaded: false, isRead: true",
},
nondownloadedunread: {
condition: (c) => !c.isDownloaded && !c.isRead,
gqlCondition: "isDownloaded: false, isRead: false",
},
};
/** /**
* Makes a GraphQL query body based on the provided fieldsSet and category. * Makes a GraphQL query body based on the provided fieldsSet and category.
* *
@ -189,15 +198,6 @@ function makeFields(Fields = []) {
return fields; return fields;
} }
/**
* @typedef {object} widget
* @property {string} username
* @property {string} password
* @property {string[]|null} fields
* @property {string|number|undefined} category
* @property {keyof typeof widgets} type
*/
/** /**
* @param {widget} widget * @param {widget} widget
* @returns {{ "Content-Type": string, Authorization?: string }} * @returns {{ "Content-Type": string, Authorization?: string }}