@umituz/web-hono 1.7.7 → 1.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/org.ts +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-hono",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.8",
|
|
4
4
|
"description": "API backend platform for Cloudflare Workers + Neon Postgres: createApi skeleton + error envelope layer, full-CRUD resource factory (opt-in create/remove, list params), schema→client type bridge (ClientRow), apiFetch/apiWrite client, reactive fetch-backed store (+React hooks), and db lifecycle scripts (reset / snapshot / seed)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
package/src/org.ts
CHANGED
|
@@ -32,8 +32,10 @@ export async function orgHasMode(db: CrudDb, orgs: OrgsLike, orgId: string, mode
|
|
|
32
32
|
/** Next `PREFIX-n` (or `PREFIX-YYYY-NNNN` with year: true) document number:
|
|
33
33
|
* max numeric suffix +1 among the current year's live rows. Not a
|
|
34
34
|
* reservation — the partial-unique on number turns races into a 409.
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* pad applies in EVERY mode — plain `pad: 4` yields `PRD-0001` and reads
|
|
36
|
+
* padded/legacy rows alike (`PRD-9` still counts as 9). digitsOnly: true
|
|
37
|
+
* serves prefix-less columns that store the bare integer ("101") — prefix
|
|
38
|
+
* is ignored, non-numeric rows don't count. */
|
|
37
39
|
export async function nextNumber(
|
|
38
40
|
db: CrudDb,
|
|
39
41
|
table: NumberedTable,
|
|
@@ -68,5 +70,6 @@ export async function nextNumber(
|
|
|
68
70
|
}, opts.base ?? (bare ? 0 : withYear ? 0 : 2000));
|
|
69
71
|
const n = max + 1;
|
|
70
72
|
if (bare) return opts.pad ? String(n).padStart(opts.pad, '0') : String(n);
|
|
71
|
-
|
|
73
|
+
const body = String(n).padStart(opts.pad ?? (withYear ? 4 : 0), '0');
|
|
74
|
+
return withYear ? `${prefix}-${year}-${body}` : `${prefix}${opts.separator ?? '-'}${body}`;
|
|
72
75
|
}
|