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,20 @@ This document is auto-generated from the JSDoc comments in `src/store` by runnin
|
||||
|
||||
Adds a new allowed Google auth email.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `email` | `string` | The email address to allow. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<number>` — The id of the created Google auth row.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = add(pool);
|
||||
const id = await fn('user@example.com');
|
||||
const id = await store.google_auth.add('user@example.com');
|
||||
// => 1
|
||||
```
|
||||
|
||||
@@ -20,9 +31,20 @@ const id = await fn('user@example.com');
|
||||
|
||||
Returns a Google auth row by email.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `email` | `string` | The email address. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<object|undefined>` — The Google auth row, or `undefined` if not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = getByEmail(pool);
|
||||
const auth = await fn('user@example.com');
|
||||
const auth = await store.google_auth.getByEmail('user@example.com');
|
||||
// => { id, email, ... }
|
||||
```
|
||||
|
||||
@@ -32,9 +54,20 @@ const auth = await fn('user@example.com');
|
||||
|
||||
Returns a Google auth row by its id.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth row. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<object|undefined>` — The Google auth row, or `undefined` if not found.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = getById(pool);
|
||||
const auth = await fn(42);
|
||||
const auth = await store.google_auth.getById(42);
|
||||
// => { id, email, ... }
|
||||
```
|
||||
|
||||
@@ -44,9 +77,14 @@ const auth = await fn(42);
|
||||
|
||||
Lists all allowed Google auth emails.
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<Array<{id: number, email: string}>>` — The allowed emails.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = listAllowedEmails(pool);
|
||||
const emails = await fn();
|
||||
const emails = await store.google_auth.listAllowedEmails();
|
||||
// => [{ id, email }]
|
||||
```
|
||||
|
||||
@@ -56,9 +94,20 @@ const emails = await fn();
|
||||
|
||||
Removes an allowed Google auth email.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `email` | `string` | The email address to remove. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = removeAllowedEmail(pool);
|
||||
await fn('user@example.com');
|
||||
await store.google_auth.removeAllowedEmail('user@example.com');
|
||||
```
|
||||
|
||||
## `google_auth.setProfile`
|
||||
@@ -67,9 +116,28 @@ await fn('user@example.com');
|
||||
|
||||
Updates the profile (picture, picture binary, sub) of a Google auth user.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `input` | `object` | The profile input. |
|
||||
| `[input.picture]` | `string` | The picture URL. |
|
||||
| `[input.pictureBinary]` | `Buffer` | The picture binary. |
|
||||
| `[input.sub]` | `string` | The Google sub identifier. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — If the user is not found or the picture binary is invalid.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = setProfile(pool);
|
||||
await fn(42, { picture: 'url', pictureBinary: buffer, sub: 'sub' });
|
||||
await store.google_auth.setProfile(42, { picture: 'url', pictureBinary: buffer, sub: 'sub' });
|
||||
```
|
||||
|
||||
## `google_auth.setSelectedCompany`
|
||||
@@ -78,7 +146,19 @@ await fn(42, { picture: 'url', pictureBinary: buffer, sub: 'sub' });
|
||||
|
||||
Sets the currently selected company for a Google auth user.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `companyId` | `number` | The id of the company to select. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<void>`
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const fn = setSelectedCompany(pool);
|
||||
await fn(42, 1);
|
||||
await store.google_auth.setSelectedCompany(42, 1);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user