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:
seb
2026-08-07 06:23:17 +02:00
parent 396389457f
commit aefd97a171
127 changed files with 3956 additions and 1684 deletions

View File

@@ -12,21 +12,26 @@ function shape(row) {
};
}
/**
* Creates a new contact for an entity.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that creates an entity contact.
*
* @example
* const fn = create(pool);
* const contact = await fn(42, 5, { contactType: 'email', contact: 'a@b.c' });
* // => { id, entityId, contactType, contact, sort }
*/
export default function create(pool) {
const access = resolveSelectedCompanyAccess(pool);
const entityAccess = resolveEntityAccess(pool);
/**
* Creates a new contact for an entity.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {number} entityId - The id of the entity.
* @param {object} input - The contact input.
* @param {string} input.contactType - The contact type (e.g. `'email'`).
* @param {string} input.contact - The contact value.
* @param {number} [input.sort] - Optional sort order.
* @returns {Promise<{id: number, entityId: number, contactType: string, contact: string, sort: number}>} The created contact.
* @throws {Error} If the contact type or value is missing.
*
* @example
* const contact = await store.entitycontact.create(42, 5, { contactType: 'email', contact: 'a@b.c' });
* // => { id, entityId, contactType, contact, sort }
*/
return async (googleAuthId, entityId, input = {}) => {
const contactType = input.contactType?.trim?.()
? input.contactType.trim()