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:
66
API.unit.md
66
API.unit.md
@@ -6,22 +6,49 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
||||
|
||||
*Source: `src/store/unit/delete.js`*
|
||||
|
||||
Deletes a unit for a company by its SI code.
|
||||
Deletes a unit for the user's selected company by its SI code.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `si` | `string` | The SI code of the unit to delete. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the unit is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(42, 'l');
|
||||
await store.unit.delete(42, 'l');
|
||||
```
|
||||
|
||||
## `unit.list`
|
||||
|
||||
*Source: `src/store/unit/list.js`*
|
||||
|
||||
Lists the units available for a company.
|
||||
Lists the units available for the user's selected company.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, si: string, basesi: string, basesifactor: number, symbol: string, name: string}>>` — The units.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const units = await fn(42);
|
||||
const units = await store.unit.list(42);
|
||||
// => [{ id, si, basesi, basesifactor, symbol, name }]
|
||||
```
|
||||
|
||||
@@ -29,10 +56,31 @@ const units = await fn(42);
|
||||
|
||||
*Source: `src/store/unit/upsert.js`*
|
||||
|
||||
Creates or updates a unit for a company, keyed by its SI code.
|
||||
Creates or updates a unit for the user's selected company, keyed by its SI code.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | The unit input. |
|
||||
| `input.si` | `string` | The SI code. |
|
||||
| `input.basesi` | `string` | The base SI code. |
|
||||
| `input.basesifactor` | `number` | The base SI factor (must be > 0). |
|
||||
| `input.symbol` | `string` | The unit symbol. |
|
||||
| `input.name` | `string` | The unit name. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, si: string, basesi: string, basesifactor: number, symbol: string, name: string}>` — The upserted unit.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the unit is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = upsert(pool);
|
||||
const unit = await fn(42, { si: 'l', basesi: 'm3', basesifactor: 0.001, symbol: 'L', name: 'Liter' });
|
||||
const unit = await store.unit.upsert(42, { si: 'l', basesi: 'm3', basesifactor: 0.001, symbol: 'L', name: 'Liter' });
|
||||
// => { id, si, basesi, basesifactor, symbol, name }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user