Rewrite store JSDoc, split quote/order into modules, and generate typed API docs
- Rewrite JSDoc across all store methods to document the actual async methods (real params, returns, throws) instead of the internal wrappers - Split quote/order into individual module files backed by shared manifestDoc helpers; remove the createStore factory and thin wrappers - Deduplicate manifest line helpers into src/store/manifestLines.js - Extend generate-api-doc.js to render parameter/return/throws types and emit per-namespace API.<module>.md files with an API.md index - Regenerate all API docs
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
import { GET_FULL_BY_HASH } from '../../sql/pic.js';
|
||||
import resolvePicAccess from './resolvePicAccess.js';
|
||||
|
||||
/**
|
||||
* Returns the full-size image (AVIF) for a given hash.
|
||||
*
|
||||
* @param {object} pool - The mssql connection pool.
|
||||
* @returns {Function} An async function that fetches a full image by hash.
|
||||
*
|
||||
* @example
|
||||
* const fn = getImageByHash(pool);
|
||||
* const image = await fn(42, 'abc123');
|
||||
* // => { buffer, w, h, size, contentType: 'image/avif' }
|
||||
*/
|
||||
export default function getImageByHash(pool) {
|
||||
const authorize = resolvePicAccess(pool);
|
||||
|
||||
/**
|
||||
* Returns the full-size image (AVIF) for a given hash.
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {string} fullHash - The full image hash.
|
||||
* @returns {Promise<{buffer: Buffer, w: number, h: number, size: number, contentType: string}>} The full image.
|
||||
* @throws {Error} If the image is not found.
|
||||
*
|
||||
* @example
|
||||
* const image = await store.pic.getImageByHash(42, 'abc123');
|
||||
* // => { buffer, w, h, size, contentType: 'image/avif' }
|
||||
*/
|
||||
return async (googleAuthId, fullHash) => {
|
||||
await authorize(googleAuthId, fullHash);
|
||||
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import { GET_THUMB_BY_HASH } from '../../sql/pic.js';
|
||||
import resolvePicAccess from './resolvePicAccess.js';
|
||||
|
||||
/**
|
||||
* Returns the thumbnail image (AVIF) for a given hash.
|
||||
*
|
||||
* @param {object} pool - The mssql connection pool.
|
||||
* @returns {Function} An async function that fetches a thumbnail by hash.
|
||||
*
|
||||
* @example
|
||||
* const fn = getThumbByHash(pool);
|
||||
* const thumb = await fn(42, 'abc123');
|
||||
* // => { buffer, w, h, contentType: 'image/avif' }
|
||||
*/
|
||||
export default function getThumbByHash(pool) {
|
||||
const authorize = resolvePicAccess(pool);
|
||||
|
||||
/**
|
||||
* Returns the thumbnail image (AVIF) for a given hash.
|
||||
*
|
||||
* @param {number} googleAuthId - The id of the Google auth user.
|
||||
* @param {string} fullHash - The full image hash.
|
||||
* @returns {Promise<{buffer: Buffer, w: number, h: number, contentType: string}>} The thumbnail image.
|
||||
* @throws {Error} If the image is not found.
|
||||
*
|
||||
* @example
|
||||
* const thumb = await store.pic.getThumbByHash(42, 'abc123');
|
||||
* // => { buffer, w, h, contentType: 'image/avif' }
|
||||
*/
|
||||
return async (googleAuthId, fullHash) => {
|
||||
await authorize(googleAuthId, fullHash);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user