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

@@ -6,11 +6,31 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
*Source: `src/store/delivery/create.js`*
Creates a new delivery for a company with its lines.
Creates a new delivery for the user's selected company with its lines.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `body` | `object` | The delivery input. |
| `body.number` | `string` | The delivery number. |
| `body.date` | `string` | The delivery date. |
| `body.supplierId` | `number` | The id of the supplier. |
| `[body.lines]` | `Array<object>` | The delivery lines. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number, date: string, lines: Array<object>}>` — The created delivery.
**Throws**
`Error` — If the delivery is invalid.
**Example**
```js
const fn = create(pool);
const delivery = await fn(42, { number: 'D-1', date: '2026-01-01', supplierId: 5, lines: [...] });
const delivery = await store.delivery.create(42, { number: 'D-1', date: '2026-01-01', supplierId: 5, lines: [...] });
// => { id, number, type, entityId, date, lines: [...] }
```
@@ -18,22 +38,54 @@ const delivery = await fn(42, { number: 'D-1', date: '2026-01-01', supplierId: 5
*Source: `src/store/delivery/delete.js`*
Deletes a delivery by its id within a company.
Deletes a delivery by its id within the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The id of the delivery to delete. |
**Returns**
`Promise<void>`
**Throws**
`Error` — If the delivery is not found.
**Example**
```js
const fn = del(pool);
await fn(42, 5);
await store.delivery.delete(42, 5);
```
## `delivery.getById`
*Source: `src/store/delivery/getById.js`*
Returns a single delivery by its id within a company.
Returns a single delivery by its id within the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The id of the delivery. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number, date: string, lines: Array<object>}>` — The delivery.
**Throws**
`Error` — If the delivery is not found.
**Example**
```js
const fn = getById(pool);
const delivery = await fn(42, 5);
const delivery = await store.delivery.getById(42, 5);
// => { id, number, type, entityId, date, lines: [...] }
```
@@ -41,11 +93,22 @@ const delivery = await fn(42, 5);
*Source: `src/store/delivery/list.js`*
Lists the deliveries of a company.
Lists the deliveries of the user's selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
**Returns**
`Promise<Array<{id: number, number: string, type: string, entityId: number, date: string}>>` — The deliveries.
**Example**
```js
const fn = list(pool);
const deliveries = await fn(42);
const deliveries = await store.delivery.list(42);
// => [{ id, number, type, entityId, date }]
```
@@ -55,8 +118,29 @@ const deliveries = await fn(42);
Updates a delivery's header and/or lines.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `id` | `number` | The id of the delivery to update. |
| `patch` | `object` | The update patch. |
| `[patch.number]` | `string` | The new delivery number. |
| `[patch.date]` | `string` | The new delivery date. |
| `[patch.supplierId]` | `number` | The new supplier id. |
| `[patch.lines]` | `Array<object>` | The new delivery lines. |
**Returns**
`Promise<{id: number, number: string, type: string, entityId: number, date: string, lines: Array<object>}>` — The updated delivery.
**Throws**
`Error` — If the delivery is not found.
**Example**
```js
const fn = update(pool);
const delivery = await fn(42, 5, { number: 'D-2', lines: [...] });
const delivery = await store.delivery.update(42, 5, { number: 'D-2', lines: [...] });
// => { id, number, type, entityId, date, lines: [...] }
```