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:
@@ -8,9 +8,29 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
||||
|
||||
Creates a new contact for an entity.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `entityId` | `number` | The id of the entity. |
|
||||
| `input` | `object` | The contact input. |
|
||||
| `input.contactType` | `string` | The contact type (e.g. `'email'`). |
|
||||
| `input.contact` | `string` | The contact value. |
|
||||
| `[input.sort]` | `number` | 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**
|
||||
|
||||
```js
|
||||
const fn = create(pool);
|
||||
const contact = await fn(42, 5, { contactType: 'email', contact: 'a@b.c' });
|
||||
const contact = await store.entitycontact.create(42, 5, { contactType: 'email', contact: 'a@b.c' });
|
||||
// => { id, entityId, contactType, contact, sort }
|
||||
```
|
||||
|
||||
@@ -20,9 +40,26 @@ const contact = await fn(42, 5, { contactType: 'email', contact: 'a@b.c' });
|
||||
|
||||
Deletes a contact of an entity.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `entityId` | `number` | The id of the entity. |
|
||||
| `id` | `number` | The id of the contact to delete. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the contact is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(42, 5, 9);
|
||||
await store.entitycontact.delete(42, 5, 9);
|
||||
```
|
||||
|
||||
## `entitycontact.list`
|
||||
@@ -31,9 +68,21 @@ await fn(42, 5, 9);
|
||||
|
||||
Lists the contacts of an entity.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `entityId` | `number` | The id of the entity. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, entityId: number, contactType: string, contact: string, sort: number}>>` — The contacts.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const contacts = await fn(42, 5);
|
||||
const contacts = await store.entitycontact.list(42, 5);
|
||||
// => [{ id, entityId, contactType, contact, sort }]
|
||||
```
|
||||
|
||||
@@ -43,8 +92,26 @@ const contacts = await fn(42, 5);
|
||||
|
||||
Updates a contact of an entity.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `entityId` | `number` | The id of the entity. |
|
||||
| `id` | `number` | The id of the contact to update. |
|
||||
| `patch` | `object` | The update patch (any subset of contact fields). |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, entityId: number, contactType: string, contact: string, sort: number}>` — The updated contact.
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the contact is not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = update(pool);
|
||||
const contact = await fn(42, 5, 9, { contact: 'b@c.d' });
|
||||
const contact = await store.entitycontact.update(42, 5, 9, { contact: 'b@c.d' });
|
||||
// => { id, entityId, contactType, contact, sort }
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user