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

@@ -24,21 +24,32 @@ function optionalString(value) {
return s || null;
}
/**
* Creates a new address for an entity.
*
* @param {object} pool - The mssql connection pool.
* @returns {Function} An async function that creates an entity address.
*
* @example
* const fn = create(pool);
* const address = await fn(42, 5, { addressType: 'billing', street: 'Main St', city: 'Berlin' });
* // => { id, entityId, firstName, name, street, streetNumber, zip, city, county, addressType, sort }
*/
export default function create(pool) {
const access = resolveSelectedCompanyAccess(pool);
const entityAccess = resolveEntityAccess(pool);
/**
* Creates a new address 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 address input.
* @param {string} input.addressType - The address type (e.g. `'billing'`).
* @param {string} [input.firstName] - The first name.
* @param {string} [input.name] - The name.
* @param {string} [input.street] - The street.
* @param {string} [input.streetNumber] - The street number.
* @param {string} [input.zip] - The zip code.
* @param {string} [input.city] - The city.
* @param {string} [input.county] - The county.
* @param {number} [input.sort] - Optional sort order.
* @returns {Promise<object>} The created address.
* @throws {Error} If the address type is missing.
*
* @example
* const address = await store.entityaddress.create(42, 5, { addressType: 'billing', street: 'Main St', city: 'Berlin' });
* // => { id, entityId, firstName, name, street, streetNumber, zip, city, county, addressType, sort }
*/
return async (googleAuthId, entityId, input = {}) => {
const addressType = input.addressType?.trim?.()
? input.addressType.trim()