@umituz/web-hono 1.8.6 → 1.8.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/web-hono",
3
- "version": "1.8.6",
3
+ "version": "1.8.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/dates.ts CHANGED
@@ -1,36 +1,25 @@
1
- /**
2
- * ISO date-string primitives for TEXT datetime columns and doc-wire dates.
3
- *
4
- * Fleet schemas split into two worlds: timestamptz columns (drizzle wants a
5
- * Date — see pickPatch/stampUpdate) and TEXT/date-string columns whose wire
6
- * format is a truncated ISO string the client renders verbatim. These helpers
7
- * are the canon for the second world: one `isoNow` with explicit precision so
8
- * each domain keeps its historical wire format byte-identical, plus the
9
- * calendar-day arithmetic (today / addDays) that deadline features keep
10
- * re-implementing. All UTC — the local-calendar branch inside stampUpdate is
11
- * the only local-time stamp in the package and stays that way.
12
- */
13
-
14
1
  export type IsoPrecision = 'ms' | 's' | 'm' | 'd';
15
2
 
16
3
  const ISO_LENGTH: Record<Exclude<IsoPrecision, 'ms'>, number> = { s: 19, m: 16, d: 10 };
17
4
 
18
- /** Current instant as an ISO string truncated to the requested precision:
19
- * 'ms' → 2026-10-18T05:28:47.941Z (full), 's' → …:47, 'm' → …:28, 'd' → 2026-10-18. */
20
- export function isoNow(precision: IsoPrecision = 'ms'): string {
21
- const iso = new Date().toISOString();
5
+ function trunc(iso: string, precision: IsoPrecision): string {
22
6
  return precision === 'ms' ? iso : iso.slice(0, ISO_LENGTH[precision]);
23
7
  }
24
8
 
25
- /** UTC calendar day as 'YYYY-MM-DD' — equals isoNow('d'). */
9
+ export function isoNow(precision: IsoPrecision = 'ms'): string {
10
+ return trunc(new Date().toISOString(), precision);
11
+ }
12
+
13
+ export function isoAt(d: Date, precision: IsoPrecision = 'ms'): string {
14
+ return trunc(d.toISOString(), precision);
15
+ }
16
+
26
17
  export function todayISO(): string {
27
18
  return new Date().toISOString().slice(0, 10);
28
19
  }
29
20
 
30
- /** Day-shifted UTC calendar day: addDaysISO(3) is three days out, negative
31
- * values reach back. Month/year rollovers ride Date's own calendar math. */
32
- export function addDaysISO(days: number): string {
33
- const d = new Date();
21
+ export function addDaysISO(iso: string, days: number): string {
22
+ const d = new Date(`${iso.slice(0, 10)}T00:00:00Z`);
34
23
  d.setUTCDate(d.getUTCDate() + days);
35
24
  return d.toISOString().slice(0, 10);
36
25
  }
package/src/docstore.ts CHANGED
@@ -50,7 +50,7 @@ export interface DocCollectionSpec {
50
50
  singletonId?: string;
51
51
  /** Status state machine: allowed targets per current status. */
52
52
  transitions?: Record<string, string[]>;
53
- /** Doc field the transitions guard reads. Default 'status' (fuelora: state, franchisia: stage). */
53
+ /** Doc field the transitions guard reads. Default 'status'. */
54
54
  statusKey?: string;
55
55
  /** Write guard — see DocValidateFn. */
56
56
  validate?: DocValidateFn;
package/src/index.ts CHANGED
@@ -30,7 +30,7 @@ export { docStore, canTransition, epoch, WorkflowError, UnknownCollectionError }
30
30
  export type { Doc, DocTable, DocCollectionSpec, DocStoreSpec, DocValidateFn } from './docstore';
31
31
  export { getDb } from './db';
32
32
  export { uid, pickPatch, patchTypeErrors, normalizeRow, stampUpdate, trio, actor } from './lib';
33
- export { isoNow, todayISO, addDaysISO } from './dates';
33
+ export { isoNow, isoAt, todayISO, addDaysISO } from './dates';
34
34
  export type { IsoPrecision } from './dates';
35
35
  export { resolveOrg, orgHasMode, nextNumber } from './org';
36
36
  export type { UsersLike, OrgsLike, NumberedTable } from './org';
package/src/lib.ts CHANGED
@@ -43,7 +43,7 @@ function localDateStamp(): string {
43
43
  * updatedAt stamp matching the table's column type. Fleet-standard tables
44
44
  * (timestamp withTimezone) get a Date — unchanged from previous versions.
45
45
  * Domains that model updatedAt as a calendar date column (date string,
46
- * e.g. polaris) get today's local 'YYYY-MM-DD' instead of a Date that the
46
+ * date-string) get today's local 'YYYY-MM-DD' instead of a Date that the
47
47
  * column cannot carry.
48
48
  */
49
49
  export function stampUpdate(table: PgTable): Record<string, unknown> {
package/src/lifecycle.ts CHANGED
@@ -8,13 +8,13 @@ import { gzipSync, gunzipSync } from 'node:zlib';
8
8
  /**
9
9
  * Database lifecycle for the shared-Neon-project fleet model: one Neon
10
10
  * project hosts many products, each living in its own `TABLE_PREFIX*`
11
- * tables. `specs` is the app's single table registry (foodora's
11
+ * tables. `specs` is the app's single table registry (the
12
12
  * `scripts/tables.ts` shape) shared by all three operations so snapshot
13
13
  * and seed can never diverge.
14
14
  */
15
15
 
16
16
  export interface TableSpec {
17
- /** Snapshot/seed key AND the SQL table name — e.g. 'users' for `foodora_users`. */
17
+ /** Snapshot/seed key AND the SQL table name — e.g. 'users' for `prefix_users`. */
18
18
  name: string;
19
19
  table: PgTable;
20
20
  }