# numbers This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. ## `numbers.ensureType` *Source: `src/store/numbers/ensureType.js`* Ensures a number sequence row exists for a company and type, inferring the company's prefix style, padding, and next counter if not yet created or unconfigured. **Parameters** | Name | Type | Description | | --- | --- | --- | | `runner` | `object` | The database runner. | | `companyId` | `number` | The id of the company. | | `type` | `string` | The number type (e.g. 'order', 'quote', 'sku'). | **Returns** `Promise<{id: number, type: string, prefix: string, padding: number, next: number}>` — The sequence row. ## `numbers.list` *Source: `src/store/numbers/list.js`* Lists the number sequences of the user's selected company. Ensures that default sequences ('sku', 'entity', 'delivery', 'adjustment', 'shipment', 'quote', 'order') exist. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise>` — The number sequences. **Example** ```js const numbers = await store.numbers.list(42); // => [{ id, type, prefix, padding, next }] ``` ## `numbers.update` *Source: `src/store/numbers/update.js`* Updates the sequence settings of a number for the user's selected company. Only the provided fields are changed (all optional). `prefix` is trimmed and must be at most 50 characters. `padding` and `next` must be finite numbers greater than or equal to 0 and 1 respectively. If no field is provided, the row is returned unchanged. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `id` | `number` | The id of the number sequence to update. | | `input` | `object` | The update input. | | `[input.prefix]` | `string` | The new prefix. | | `[input.padding]` | `number` | The new padding length. | | `[input.next]` | `number` | The new next value. | | `[tx]` | `object` | Optional transaction to run within. | **Returns** `Promise<{id: number, type: string, prefix: string, padding: number, next: number}>` — The updated number sequence. **Throws** `Error` — If the number is not found or a field is invalid. **Example** ```js const number = await store.numbers.update(42, 3, { prefix: 'A-', padding: 4, next: 100 }); // => { id, type, prefix, padding, next } ```