@fuzdev/fuz_app 0.110.1 → 0.112.0

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.
Files changed (210) hide show
  1. package/dist/actions/CLAUDE.md +15 -11
  2. package/dist/actions/action_rpc.d.ts +3 -3
  3. package/dist/actions/action_rpc.d.ts.map +1 -1
  4. package/dist/actions/action_rpc.js +4 -6
  5. package/dist/actions/peer_ping.d.ts +8 -0
  6. package/dist/actions/peer_ping.d.ts.map +1 -1
  7. package/dist/actions/peer_ping.js +8 -0
  8. package/dist/actions/peer_request.d.ts +1 -1
  9. package/dist/actions/peer_request.js +1 -1
  10. package/dist/actions/perform_action.d.ts +16 -9
  11. package/dist/actions/perform_action.d.ts.map +1 -1
  12. package/dist/actions/perform_action.js +30 -21
  13. package/dist/actions/register_action_ws.d.ts +1 -1
  14. package/dist/actions/register_action_ws.d.ts.map +1 -1
  15. package/dist/actions/register_action_ws.js +88 -21
  16. package/dist/auth/CLAUDE.md +59 -10
  17. package/dist/auth/account_action_specs.d.ts +0 -2
  18. package/dist/auth/account_action_specs.d.ts.map +1 -1
  19. package/dist/auth/account_actions.d.ts.map +1 -1
  20. package/dist/auth/account_actions.js +10 -1
  21. package/dist/auth/account_queries.d.ts +22 -0
  22. package/dist/auth/account_queries.d.ts.map +1 -1
  23. package/dist/auth/account_queries.js +70 -16
  24. package/dist/auth/account_schema.d.ts +27 -9
  25. package/dist/auth/account_schema.d.ts.map +1 -1
  26. package/dist/auth/account_schema.js +23 -3
  27. package/dist/auth/actor_search_actions.d.ts +3 -3
  28. package/dist/auth/actor_search_actions.d.ts.map +1 -1
  29. package/dist/auth/actor_search_actions.js +10 -6
  30. package/dist/auth/admin_action_specs.d.ts +0 -2
  31. package/dist/auth/admin_action_specs.d.ts.map +1 -1
  32. package/dist/auth/api_token_queries.d.ts +9 -4
  33. package/dist/auth/api_token_queries.d.ts.map +1 -1
  34. package/dist/auth/api_token_queries.js +36 -8
  35. package/dist/auth/app_settings_queries.d.ts +8 -0
  36. package/dist/auth/app_settings_queries.d.ts.map +1 -1
  37. package/dist/auth/app_settings_queries.js +16 -3
  38. package/dist/auth/audit_log_queries.d.ts +21 -3
  39. package/dist/auth/audit_log_queries.d.ts.map +1 -1
  40. package/dist/auth/audit_log_queries.js +38 -7
  41. package/dist/auth/audit_log_schema.d.ts +0 -1
  42. package/dist/auth/audit_log_schema.d.ts.map +1 -1
  43. package/dist/auth/auth_ddl.d.ts +6 -0
  44. package/dist/auth/auth_ddl.d.ts.map +1 -1
  45. package/dist/auth/auth_ddl.js +9 -0
  46. package/dist/auth/cell_actions.d.ts.map +1 -1
  47. package/dist/auth/cell_actions.js +3 -8
  48. package/dist/auth/cell_audit_actions.d.ts.map +1 -1
  49. package/dist/auth/cell_audit_actions.js +1 -1
  50. package/dist/auth/cell_field_actions.js +1 -1
  51. package/dist/auth/cell_grant_actions.js +1 -1
  52. package/dist/auth/cell_item_actions.js +1 -1
  53. package/dist/auth/invite_queries.d.ts +10 -0
  54. package/dist/auth/invite_queries.d.ts.map +1 -1
  55. package/dist/auth/invite_queries.js +28 -7
  56. package/dist/auth/migrations.d.ts.map +1 -1
  57. package/dist/auth/migrations.js +10 -0
  58. package/dist/auth/role_grant_offer_ddl.d.ts +34 -2
  59. package/dist/auth/role_grant_offer_ddl.d.ts.map +1 -1
  60. package/dist/auth/role_grant_offer_ddl.js +61 -2
  61. package/dist/auth/role_grant_offer_queries.d.ts.map +1 -1
  62. package/dist/auth/role_grant_offer_queries.js +48 -53
  63. package/dist/auth/role_grant_queries.d.ts +18 -0
  64. package/dist/auth/role_grant_queries.d.ts.map +1 -1
  65. package/dist/auth/role_grant_queries.js +58 -18
  66. package/dist/auth/session_queries.d.ts +12 -3
  67. package/dist/auth/session_queries.d.ts.map +1 -1
  68. package/dist/auth/session_queries.js +26 -6
  69. package/dist/db/CLAUDE.md +34 -0
  70. package/dist/db/cell_audit_queries.d.ts.map +1 -1
  71. package/dist/db/cell_audit_queries.js +3 -1
  72. package/dist/db/cell_field_queries.d.ts +12 -3
  73. package/dist/db/cell_field_queries.d.ts.map +1 -1
  74. package/dist/db/cell_field_queries.js +25 -7
  75. package/dist/db/cell_grant_queries.d.ts +10 -2
  76. package/dist/db/cell_grant_queries.d.ts.map +1 -1
  77. package/dist/db/cell_grant_queries.js +29 -11
  78. package/dist/db/cell_item_queries.d.ts +13 -2
  79. package/dist/db/cell_item_queries.d.ts.map +1 -1
  80. package/dist/db/cell_item_queries.js +27 -7
  81. package/dist/db/cell_queries.d.ts +32 -3
  82. package/dist/db/cell_queries.d.ts.map +1 -1
  83. package/dist/db/cell_queries.js +57 -22
  84. package/dist/db/fact_queries.d.ts +7 -0
  85. package/dist/db/fact_queries.d.ts.map +1 -1
  86. package/dist/db/fact_queries.js +27 -4
  87. package/dist/db/schema_ready.d.ts +6 -1
  88. package/dist/db/schema_ready.d.ts.map +1 -1
  89. package/dist/db/schema_ready.js +6 -2
  90. package/dist/db/sql_columns.d.ts +144 -0
  91. package/dist/db/sql_columns.d.ts.map +1 -0
  92. package/dist/db/sql_columns.js +164 -0
  93. package/dist/db/sql_identifier.d.ts +6 -5
  94. package/dist/db/sql_identifier.d.ts.map +1 -1
  95. package/dist/db/sql_identifier.js +6 -5
  96. package/dist/http/CLAUDE.md +4 -2
  97. package/dist/http/jsonrpc_helpers.d.ts +13 -0
  98. package/dist/http/jsonrpc_helpers.d.ts.map +1 -1
  99. package/dist/http/jsonrpc_helpers.js +13 -0
  100. package/dist/http/route_spec.d.ts +2 -2
  101. package/dist/server/app_server.d.ts.map +1 -1
  102. package/dist/server/app_server.js +1 -2
  103. package/dist/server/serve_fact_route.d.ts.map +1 -1
  104. package/dist/server/serve_fact_route.js +7 -2
  105. package/dist/testing/CLAUDE.md +55 -28
  106. package/dist/testing/admin_integration.d.ts +0 -3
  107. package/dist/testing/admin_integration.d.ts.map +1 -1
  108. package/dist/testing/admin_integration.js +0 -1
  109. package/dist/testing/adversarial_404.d.ts.map +1 -1
  110. package/dist/testing/adversarial_404.js +4 -1
  111. package/dist/testing/adversarial_input.d.ts.map +1 -1
  112. package/dist/testing/adversarial_input.js +5 -4
  113. package/dist/testing/app_server.d.ts +4 -3
  114. package/dist/testing/app_server.d.ts.map +1 -1
  115. package/dist/testing/app_server.js +11 -5
  116. package/dist/testing/attack_surface.d.ts +16 -0
  117. package/dist/testing/attack_surface.d.ts.map +1 -1
  118. package/dist/testing/attack_surface.js +36 -13
  119. package/dist/testing/audit_completeness.d.ts +0 -3
  120. package/dist/testing/audit_completeness.d.ts.map +1 -1
  121. package/dist/testing/audit_completeness.js +0 -1
  122. package/dist/testing/auth_apps.d.ts +9 -2
  123. package/dist/testing/auth_apps.d.ts.map +1 -1
  124. package/dist/testing/auth_apps.js +9 -2
  125. package/dist/testing/cross_backend/account_lifecycle.d.ts +5 -4
  126. package/dist/testing/cross_backend/account_lifecycle.d.ts.map +1 -1
  127. package/dist/testing/cross_backend/account_lifecycle.js +7 -0
  128. package/dist/testing/cross_backend/action_manifest.d.ts +19 -3
  129. package/dist/testing/cross_backend/action_manifest.d.ts.map +1 -1
  130. package/dist/testing/cross_backend/action_manifest.js +10 -4
  131. package/dist/testing/cross_backend/action_manifest_parity.d.ts +9 -3
  132. package/dist/testing/cross_backend/action_manifest_parity.d.ts.map +1 -1
  133. package/dist/testing/cross_backend/action_manifest_parity.js +6 -0
  134. package/dist/testing/cross_backend/actor_lookup.d.ts +3 -2
  135. package/dist/testing/cross_backend/actor_lookup.d.ts.map +1 -1
  136. package/dist/testing/cross_backend/body_size.d.ts +4 -2
  137. package/dist/testing/cross_backend/body_size.d.ts.map +1 -1
  138. package/dist/testing/cross_backend/body_size.js +1 -1
  139. package/dist/testing/cross_backend/cell_crud.d.ts +2 -2
  140. package/dist/testing/cross_backend/cell_crud.d.ts.map +1 -1
  141. package/dist/testing/cross_backend/cell_crud.js +10 -0
  142. package/dist/testing/cross_backend/cell_gated_create.d.ts +3 -3
  143. package/dist/testing/cross_backend/cell_gated_create.d.ts.map +1 -1
  144. package/dist/testing/cross_backend/cell_grant_role.d.ts +2 -2
  145. package/dist/testing/cross_backend/cell_grant_role.d.ts.map +1 -1
  146. package/dist/testing/cross_backend/cell_relations.d.ts +2 -2
  147. package/dist/testing/cross_backend/cell_relations.d.ts.map +1 -1
  148. package/dist/testing/cross_backend/expected_schema.json +1 -1
  149. package/dist/testing/cross_backend/fact_serving.d.ts +2 -2
  150. package/dist/testing/cross_backend/fact_serving.d.ts.map +1 -1
  151. package/dist/testing/cross_backend/make_cross_backend_project.d.ts +17 -2
  152. package/dist/testing/cross_backend/make_cross_backend_project.d.ts.map +1 -1
  153. package/dist/testing/cross_backend/make_cross_backend_project.js +23 -3
  154. package/dist/testing/cross_backend/origin.d.ts +4 -2
  155. package/dist/testing/cross_backend/origin.d.ts.map +1 -1
  156. package/dist/testing/cross_backend/origin.js +1 -1
  157. package/dist/testing/cross_backend/peer_ping_ws.d.ts.map +1 -1
  158. package/dist/testing/cross_backend/peer_ping_ws.js +11 -7
  159. package/dist/testing/cross_backend/query_shape.d.ts +6 -5
  160. package/dist/testing/cross_backend/query_shape.d.ts.map +1 -1
  161. package/dist/testing/cross_backend/ready.d.ts +2 -2
  162. package/dist/testing/cross_backend/ready.d.ts.map +1 -1
  163. package/dist/testing/cross_backend/role_grant_offer_enumeration.d.ts.map +1 -1
  164. package/dist/testing/cross_backend/role_grant_offer_enumeration.js +7 -1
  165. package/dist/testing/cross_backend/setup.d.ts +26 -6
  166. package/dist/testing/cross_backend/setup.d.ts.map +1 -1
  167. package/dist/testing/cross_backend/standard.d.ts +5 -1
  168. package/dist/testing/cross_backend/standard.d.ts.map +1 -1
  169. package/dist/testing/cross_backend/standard.js +1 -5
  170. package/dist/testing/cross_backend/testing_backdoor.js +1 -1
  171. package/dist/testing/cross_backend/testing_reset_actions.d.ts +5 -0
  172. package/dist/testing/cross_backend/testing_reset_actions.d.ts.map +1 -1
  173. package/dist/testing/cross_backend/token_lifetime.d.ts.map +1 -1
  174. package/dist/testing/cross_backend/token_lifetime.js +6 -0
  175. package/dist/testing/cross_backend/token_scope_surface.d.ts +2 -2
  176. package/dist/testing/cross_backend/token_scope_surface.d.ts.map +1 -1
  177. package/dist/testing/cross_backend/wire_shapes.d.ts +22 -0
  178. package/dist/testing/cross_backend/wire_shapes.d.ts.map +1 -0
  179. package/dist/testing/cross_backend/wire_shapes.js +41 -0
  180. package/dist/testing/data_exposure.d.ts +0 -3
  181. package/dist/testing/data_exposure.d.ts.map +1 -1
  182. package/dist/testing/data_exposure.js +0 -1
  183. package/dist/testing/db.d.ts +62 -7
  184. package/dist/testing/db.d.ts.map +1 -1
  185. package/dist/testing/db.js +86 -28
  186. package/dist/testing/integration.d.ts.map +1 -1
  187. package/dist/testing/integration.js +15 -2
  188. package/dist/testing/round_trip.d.ts +0 -3
  189. package/dist/testing/round_trip.d.ts.map +1 -1
  190. package/dist/testing/round_trip.js +0 -4
  191. package/dist/testing/rpc_attack_surface.js +2 -2
  192. package/dist/testing/rpc_round_trip.d.ts +0 -3
  193. package/dist/testing/rpc_round_trip.d.ts.map +1 -1
  194. package/dist/testing/rpc_round_trip.js +0 -1
  195. package/dist/testing/schema_generators.d.ts +15 -0
  196. package/dist/testing/schema_generators.d.ts.map +1 -1
  197. package/dist/testing/schema_generators.js +45 -11
  198. package/dist/testing/standard.d.ts +5 -1
  199. package/dist/testing/standard.d.ts.map +1 -1
  200. package/dist/testing/standard.js +2 -7
  201. package/dist/timestamp.d.ts +58 -0
  202. package/dist/timestamp.d.ts.map +1 -0
  203. package/dist/timestamp.js +57 -0
  204. package/dist/ui/AdminOverview.svelte +5 -10
  205. package/dist/ui/AdminOverview.svelte.d.ts.map +1 -1
  206. package/dist/ui/RoleGrantOfferHistory.svelte +3 -1
  207. package/dist/ui/RoleGrantOfferHistory.svelte.d.ts.map +1 -1
  208. package/dist/ui/role_grant_offers_state.svelte.d.ts.map +1 -1
  209. package/dist/ui/role_grant_offers_state.svelte.js +6 -2
  210. package/package.json +1 -1
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { hash_blake3 } from '@fuzdev/fuz_util/hash_blake3.ts';
10
10
  import { generate_random_base64url } from '../crypto.js';
11
+ import { columns_sql, iso8601_timestamp_expr, qualify_columns } from '../db/sql_columns.js';
11
12
  /**
12
13
  * Session lifetime in milliseconds (30 days).
13
14
  *
@@ -53,6 +54,27 @@ export const query_create_session = async (deps, token_hash, account_id, expires
53
54
  expires_at.toISOString()
54
55
  ]);
55
56
  };
57
+ /**
58
+ * The full `auth_session` column set, named explicitly so a row read fails
59
+ * loud on schema drift — `SELECT *` would silently carry a dropped or
60
+ * leftover column into the strict-validated wire shapes (see
61
+ * `ACCOUNT_COLUMNS` in `auth/account_queries.ts` for the outage class this
62
+ * discipline exists to prevent; the Rust twin already names columns at every
63
+ * session site). Keep in sync with `AuthSession` and the migration chain's
64
+ * end state — not the frozen v0 DDL in `auth/auth_ddl.ts`, which still
65
+ * creates `last_seen_at` for the appended drop migration to remove.
66
+ */
67
+ export const AUTH_SESSION_COLUMNS = [
68
+ 'id',
69
+ 'account_id',
70
+ 'created_at',
71
+ 'expires_at'
72
+ ];
73
+ /** The `auth_session` timestamp override, by row qualifier (`''` bare, `s` for the admin listing's JOIN). */
74
+ const auth_session_expr = iso8601_timestamp_expr(AUTH_SESSION_COLUMNS, [
75
+ 'created_at',
76
+ 'expires_at'
77
+ ]);
56
78
  /**
57
79
  * Get a session if it exists, is not expired, and has not been revoked.
58
80
  *
@@ -60,7 +82,7 @@ export const query_create_session = async (deps, token_hash, account_id, expires
60
82
  * @param token_hash - blake3 hash of the session token
61
83
  */
62
84
  export const query_session_get_valid = async (deps, token_hash) => {
63
- return deps.db.query_one(`SELECT * FROM auth_session WHERE id = $1 AND expires_at > NOW()`, [token_hash]);
85
+ return deps.db.query_one(`SELECT ${columns_sql(AUTH_SESSION_COLUMNS, auth_session_expr(''))} FROM auth_session WHERE id = $1 AND expires_at > NOW()`, [token_hash]);
64
86
  };
65
87
  /**
66
88
  * Revoke (delete) a session by its token hash, with no account scoping.
@@ -106,7 +128,7 @@ export const query_session_revoke_all_for_account = async (deps, account_id) =>
106
128
  * List sessions for an account, newest first.
107
129
  */
108
130
  export const query_session_list_for_account = async (deps, account_id, limit = 50) => {
109
- return deps.db.query(`SELECT * FROM auth_session WHERE account_id = $1 ORDER BY created_at DESC LIMIT $2`, [account_id, limit]);
131
+ return deps.db.query(`SELECT ${columns_sql(AUTH_SESSION_COLUMNS, auth_session_expr(''))} FROM auth_session WHERE account_id = $1 ORDER BY auth_session.created_at DESC LIMIT $2`, [account_id, limit]);
110
132
  };
111
133
  /**
112
134
  * Enforce a per-account session limit by evicting the oldest sessions.
@@ -163,16 +185,14 @@ export const query_session_enforce_limit = async (deps, account_id, max_sessions
163
185
  * List all active sessions across all accounts with usernames.
164
186
  *
165
187
  * Ordered by `created_at DESC` (newest session first), matching the
166
- * per-account listing. `last_seen_at` is still selected for the wire shape
167
- * but is decorative — nothing updates it post-mint (it always equals
168
- * `created_at`); it is slated for removal on its own twin migration.
188
+ * per-account listing.
169
189
  *
170
190
  * @param deps - query dependencies
171
191
  * @param limit - maximum entries to return
172
192
  * @returns active sessions joined with account usernames, newest first
173
193
  */
174
194
  export const query_session_list_all_active = async (deps, limit = 200) => {
175
- return deps.db.query(`SELECT s.id, s.account_id, s.created_at, s.expires_at, s.last_seen_at, a.username
195
+ return deps.db.query(`SELECT ${qualify_columns(AUTH_SESSION_COLUMNS, 's', auth_session_expr('s'))}, a.username
176
196
  FROM auth_session s
177
197
  JOIN account a ON a.id = s.account_id
178
198
  WHERE s.expires_at > NOW()
package/dist/db/CLAUDE.md CHANGED
@@ -27,6 +27,29 @@ the code.
27
27
  - `assert_row.ts` — `assert_row(row, context)` for INSERT … RETURNING.
28
28
  - `pg_error.ts` — `pg_error_code` (SQLSTATE extractor for `pg`/PGlite errors), `is_pg_unique_violation` (Postgres `23505`).
29
29
  - `sql_identifier.ts` — `assert_valid_sql_identifier`.
30
+ - `sql_columns.ts` — `columns_sql` / `qualify_columns` / `omit_columns`,
31
+ the derivation helpers every `*_COLUMNS` projection const's variants
32
+ (alias-qualified JOIN reads, the client-safe `minus token_hash` listing)
33
+ are built from, so the drift guard on the base const covers them. Both
34
+ renderers take an optional `ColumnExpr` — a per-column expression
35
+ override, twin of the third argument to `fuz_db::qualify_columns` — and
36
+ alias an overridden column back to its own name (TS reads rows by name;
37
+ the Rust twin decodes positionally and needs no output name). The one
38
+ override in this repo is `iso8601_timestamp_column(alias, column)`, twin
39
+ of `fuz_db::iso8601_timestamp_column` down to the format literal
40
+ (`to_char(… AT TIME ZONE 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')`): every
41
+ timestamp that reaches the wire projects through it, so both spines
42
+ serialize the same instant to the same 20-character second-precision UTC
43
+ string. Each query module builds its override once with
44
+ `iso8601_timestamp_expr(TABLE_COLUMNS, [...timestamp columns])` — typed
45
+ against the const, checked at load — and passes `expr(alias)` at each
46
+ read. `timestamp.ts` (`to_iso8601_seconds` / `ISO8601_SECONDS`) is that
47
+ shape for stamps minted in TS rather than read from a row. A cascade's
48
+ inner `RETURNING` inside a `WITH updated AS (…)` stays raw — the outer
49
+ select formats, and `to_char` over already-formatted text would fail.
50
+ `fact`'s store rows are the deliberate exception: `PgFactStore` feeds
51
+ `FactMeta.created_at`, a `Date` in the `@fuzdev/fuz_util` `FactStore`
52
+ contract, and nothing serializes it.
30
53
  - `status.ts` — CLI DB status utility.
31
54
  - `schema_ready.ts` — `/ready` deploy-gate core: `query_public_columns`
32
55
  (keeps `schema_version`, unlike `query_schema_snapshot`), pure
@@ -98,6 +121,17 @@ child_id`, fractional-index keyed): `query_cell_item_insert` (throws
98
121
  `target_id`), bitmap-OR over `idx_audit_log_metadata` (the `jsonb_path_ops`
99
122
  GIN the `audit_log_metadata_gin_index` auth migration ships).
100
123
 
124
+ **Named projections** (rationale + helpers: ../../../docs/architecture.md
125
+ §Query Modules). The consts on this side: `CELL_COLUMNS`,
126
+ `CELL_GRANT_COLUMNS`, `CELL_FIELD_COLUMNS`, `CELL_ITEM_COLUMNS`, `FACT_COLUMNS`
127
+ (the meta read derives `minus bytes`). The derived `grant_count` stays an
128
+ appended expression in the exported `cell_row_projection(alias)` rather than a
129
+ `CELL_COLUMNS` entry, so the const is exactly the table's column set. Column
130
+ order twins the Rust `fuz_cell` / `fuz_fact` `*_COLUMNS` consts. Every const is pinned to
131
+ the live schema — and every public table forced to carry a const or a named
132
+ exemption — by `src/test/db/column_projections.db.test.ts`; the cell
133
+ `*_queries.db.test.ts` files pin the aliased JOIN reads and `grant_count`.
134
+
101
135
  ## Fact layer
102
136
 
103
137
  Content-addressed byte store. Cells reference facts by blake3 hash
@@ -1 +1 @@
1
- {"version":3,"file":"cell_audit_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_audit_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAoBnD,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,SAAS,EACf,SAAS,IAAI,EACb,SAAS,oBAAoB,KAC3B,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAwB9B,CAAC"}
1
+ {"version":3,"file":"cell_audit_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_audit_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAoBnD,MAAM,WAAW,oBAAoB;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACxC,MAAM,SAAS,EACf,SAAS,IAAI,EACb,SAAS,oBAAoB,KAC3B,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAwB9B,CAAC"}
@@ -12,6 +12,8 @@
12
12
  *
13
13
  * @module
14
14
  */
15
+ import { AUDIT_LOG_COLUMNS, audit_log_expr } from '../auth/audit_log_queries.js';
16
+ import { columns_sql } from './sql_columns.js';
15
17
  /**
16
18
  * Metadata-jsonb keys cell-domain events use to name the cell. This
17
19
  * array is the **only** source these key strings can come from —
@@ -51,5 +53,5 @@ export const query_audit_log_list_by_cell = async (deps, cell_id, options) => {
51
53
  const where = `WHERE ${conditions.join(' AND ')}`;
52
54
  const limit_placeholder = `$${i++}`;
53
55
  params.push(options.limit);
54
- return deps.db.query(`SELECT * FROM audit_log ${where} ORDER BY seq DESC LIMIT ${limit_placeholder}`, params);
56
+ return deps.db.query(`SELECT ${columns_sql(AUDIT_LOG_COLUMNS, audit_log_expr(''))} FROM audit_log ${where} ORDER BY seq DESC LIMIT ${limit_placeholder}`, params);
55
57
  };
@@ -23,8 +23,15 @@ export interface CellFieldRow {
23
23
  source_id: Uuid;
24
24
  name: string;
25
25
  target_id: Uuid;
26
- created_at: Date;
26
+ created_at: string;
27
27
  }
28
+ /**
29
+ * The full `cell_field` column set, named explicitly so a row read fails
30
+ * loud on schema drift (see `CELL_COLUMNS` in `db/cell_queries.ts`). Column
31
+ * order mirrors the Rust twin's `field_columns(alias)` (`fuz_cell`). Keep in
32
+ * sync with `CellFieldRow` and the `cell_field` DDL in `db/cell_ddl.ts`.
33
+ */
34
+ export declare const CELL_FIELD_COLUMNS: readonly ["source_id", "name", "target_id", "created_at"];
28
35
  /** Input for `query_cell_field_set`. */
29
36
  export interface CellFieldSetQueryInput {
30
37
  source_id: Uuid;
@@ -76,7 +83,9 @@ export declare const query_cell_field_delete: (deps: QueryDeps, source_id: Uuid,
76
83
  *
77
84
  * @param deps - query deps
78
85
  * @param source_id - source cell id
79
- * @returns matching rows, oldest first by name (lex order)
86
+ * @param options - `limit` caps the row count; `name_after` resumes after a
87
+ * name (keyset pagination)
88
+ * @returns matching rows in lex `name` order
80
89
  */
81
90
  export declare const query_cell_field_list_for_source: (deps: QueryDeps, source_id: Uuid, options?: {
82
91
  limit?: number;
@@ -97,7 +106,7 @@ export declare const query_cell_field_list_for_source: (deps: QueryDeps, source_
97
106
  * @param deps - query deps
98
107
  * @param target_id - target cell id
99
108
  * @param options - `limit` caps the row count
100
- * @returns matching rows, oldest first by source created_at
109
+ * @returns matching rows, oldest field first (by the field row's `created_at`)
101
110
  */
102
111
  export declare const query_cell_field_list_for_target: (deps: QueryDeps, target_id: Uuid, options?: {
103
112
  limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"cell_field_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_field_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,kDAAkD;AAClD,MAAM,WAAW,YAAY;IAC5B,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;CACjB;AAED,wCAAwC;AACxC,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,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;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,2DAKuB,CAAC;AAKvD,wCAAwC;AACxC,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,IAAI,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,IAAI,CAAC;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,SAAS,EACf,OAAO,sBAAsB,KAC3B,OAAO,CAAC,YAAY,CAUtB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAChC,MAAM,SAAS,EACf,WAAW,IAAI,EACf,MAAM,MAAM,KACV,OAAO,CAAC,YAAY,GAAG,IAAI,CAM7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GACnC,MAAM,SAAS,EACf,WAAW,IAAI,EACf,MAAM,MAAM,KACV,OAAO,CAAC,YAAY,GAAG,IAAI,CAO7B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,SAAS,EACf,WAAW,IAAI,EACf,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,KAC/C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAa7B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gCAAgC,GAC5C,MAAM,SAAS,EACf,WAAW,IAAI,EACf,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAC1B,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAS5B,CAAC"}
@@ -17,6 +17,21 @@
17
17
  * @module
18
18
  */
19
19
  import { assert_row } from './assert_row.js';
20
+ import { columns_sql, iso8601_timestamp_expr, qualify_columns } from './sql_columns.js';
21
+ /**
22
+ * The full `cell_field` column set, named explicitly so a row read fails
23
+ * loud on schema drift (see `CELL_COLUMNS` in `db/cell_queries.ts`). Column
24
+ * order mirrors the Rust twin's `field_columns(alias)` (`fuz_cell`). Keep in
25
+ * sync with `CellFieldRow` and the `cell_field` DDL in `db/cell_ddl.ts`.
26
+ */
27
+ export const CELL_FIELD_COLUMNS = [
28
+ 'source_id',
29
+ 'name',
30
+ 'target_id',
31
+ 'created_at'
32
+ ];
33
+ /** The `cell_field` timestamp override, by row qualifier (`''` bare, `f` for the cell-joined reads). */
34
+ const cell_field_expr = iso8601_timestamp_expr(CELL_FIELD_COLUMNS, ['created_at']);
20
35
  /**
21
36
  * Insert or update a field row.
22
37
  *
@@ -35,7 +50,7 @@ export const query_cell_field_set = async (deps, input) => {
35
50
  VALUES ($1, $2, $3)
36
51
  ON CONFLICT (source_id, name)
37
52
  DO UPDATE SET target_id = EXCLUDED.target_id, created_at = NOW()
38
- RETURNING *`, [input.source_id, input.name, input.target_id]);
53
+ RETURNING ${columns_sql(CELL_FIELD_COLUMNS, cell_field_expr(''))}`, [input.source_id, input.name, input.target_id]);
39
54
  return assert_row(row, 'INSERT INTO cell_field');
40
55
  };
41
56
  /**
@@ -51,7 +66,7 @@ export const query_cell_field_set = async (deps, input) => {
51
66
  * @returns the row or `null` when not found
52
67
  */
53
68
  export const query_cell_field_get = async (deps, source_id, name) => {
54
- const row = await deps.db.query_one(`SELECT * FROM cell_field WHERE source_id = $1 AND name = $2`, [source_id, name]);
69
+ const row = await deps.db.query_one(`SELECT ${columns_sql(CELL_FIELD_COLUMNS, cell_field_expr(''))} FROM cell_field WHERE source_id = $1 AND name = $2`, [source_id, name]);
55
70
  return row ?? null;
56
71
  };
57
72
  /**
@@ -63,7 +78,8 @@ export const query_cell_field_get = async (deps, source_id, name) => {
63
78
  * @mutates `cell_field` - deletes one row
64
79
  */
65
80
  export const query_cell_field_delete = async (deps, source_id, name) => {
66
- const row = await deps.db.query_one(`DELETE FROM cell_field WHERE source_id = $1 AND name = $2 RETURNING *`, [source_id, name]);
81
+ const row = await deps.db.query_one(`DELETE FROM cell_field WHERE source_id = $1 AND name = $2
82
+ RETURNING ${columns_sql(CELL_FIELD_COLUMNS, cell_field_expr(''))}`, [source_id, name]);
67
83
  return row ?? null;
68
84
  };
69
85
  /**
@@ -75,12 +91,14 @@ export const query_cell_field_delete = async (deps, source_id, name) => {
75
91
  *
76
92
  * @param deps - query deps
77
93
  * @param source_id - source cell id
78
- * @returns matching rows, oldest first by name (lex order)
94
+ * @param options - `limit` caps the row count; `name_after` resumes after a
95
+ * name (keyset pagination)
96
+ * @returns matching rows in lex `name` order
79
97
  */
80
98
  export const query_cell_field_list_for_source = async (deps, source_id, options) => {
81
99
  const limit = options?.limit ?? null;
82
100
  const name_after = options?.name_after ?? null;
83
- return deps.db.query(`SELECT f.* FROM cell_field f
101
+ return deps.db.query(`SELECT ${qualify_columns(CELL_FIELD_COLUMNS, 'f', cell_field_expr('f'))} FROM cell_field f
84
102
  JOIN cell t ON t.id = f.target_id
85
103
  WHERE f.source_id = $1
86
104
  AND t.deleted_at IS NULL
@@ -103,9 +121,9 @@ export const query_cell_field_list_for_source = async (deps, source_id, options)
103
121
  * @param deps - query deps
104
122
  * @param target_id - target cell id
105
123
  * @param options - `limit` caps the row count
106
- * @returns matching rows, oldest first by source created_at
124
+ * @returns matching rows, oldest field first (by the field row's `created_at`)
107
125
  */
108
- export const query_cell_field_list_for_target = async (deps, target_id, options) => deps.db.query(`SELECT f.* FROM cell_field f
126
+ export const query_cell_field_list_for_target = async (deps, target_id, options) => deps.db.query(`SELECT ${qualify_columns(CELL_FIELD_COLUMNS, 'f', cell_field_expr('f'))} FROM cell_field f
109
127
  JOIN cell s ON s.id = f.source_id
110
128
  WHERE f.target_id = $1
111
129
  AND s.deleted_at IS NULL
@@ -33,8 +33,15 @@ export interface CellGrantRow {
33
33
  role: string | null;
34
34
  scope_id: Uuid | null;
35
35
  granted_by: Uuid | null;
36
- created_at: Date;
36
+ created_at: string;
37
37
  }
38
+ /**
39
+ * The full `cell_grant` column set, named explicitly so a row read fails
40
+ * loud on schema drift (see `CELL_COLUMNS` in `db/cell_queries.ts`). Column
41
+ * order mirrors the Rust twin's `grant_columns(alias)` (`fuz_cell`). Keep in
42
+ * sync with `CellGrantRow` and the `cell_grant` DDL in `db/cell_ddl.ts`.
43
+ */
44
+ export declare const CELL_GRANT_COLUMNS: readonly ["id", "cell_id", "level", "actor_id", "role", "scope_id", "granted_by", "created_at"];
38
45
  /**
39
46
  * Discriminated principal input for `query_cell_grant_create`. Wire
40
47
  * and query shapes are aligned — actor-shaped principals carry a
@@ -121,6 +128,7 @@ export declare const query_cell_grant_list_for_cells: (deps: QueryDeps, cell_ids
121
128
  * granted access. Returns grants for the given cells that match the caller's
122
129
  * identity or role_grant set.
123
130
  *
131
+ * @param deps - query deps
124
132
  * @param cell_ids - cells to fetch grants for
125
133
  * @param caller_actor_id - actor id of the caller (null for unauth)
126
134
  * @param role_grant_roles - active role_grant roles (parallel array)
@@ -128,5 +136,5 @@ export declare const query_cell_grant_list_for_cells: (deps: QueryDeps, cell_ids
128
136
  * @returns matching grants (may include grants the caller doesn't match; caller's
129
137
  * list handler must filter when returning to the API)
130
138
  */
131
- export declare const query_cell_grants_for_caller_in_cells: (deps: QueryDeps, cell_ids: Array<Uuid>, caller_actor_id: Uuid | null, role_grant_roles: Array<string>, role_grant_scope_ids: Array<Uuid | null>) => Promise<Array<CellGrantRow>>;
139
+ export declare const query_cell_grants_for_caller_in_cells: (deps: QueryDeps, cell_ids: ReadonlyArray<Uuid>, caller_actor_id: Uuid | null, role_grant_roles: ReadonlyArray<string>, role_grant_scope_ids: ReadonlyArray<Uuid | null>) => Promise<Array<CellGrantRow>>;
132
140
  //# sourceMappingURL=cell_grant_queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cell_grant_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_grant_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,SAAS,E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AAO,MAAM,qCAAqC,GACjD,MAAM,SAAS,EACf,UAAU,aAAa,CAAC,IAAI,CAAC,EAC7B,iBAAiB,IAAI,GAAG,IAAI,EAC5B,kBAAkB,aAAa,CAAC,MAAM,CAAC,EACvC,sBAAsB,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,KAC9C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAmB7B,CAAC"}
@@ -22,6 +22,25 @@
22
22
  * @module
23
23
  */
24
24
  import { assert_row } from './assert_row.js';
25
+ import { columns_sql, iso8601_timestamp_expr, qualify_columns } from './sql_columns.js';
26
+ /**
27
+ * The full `cell_grant` column set, named explicitly so a row read fails
28
+ * loud on schema drift (see `CELL_COLUMNS` in `db/cell_queries.ts`). Column
29
+ * order mirrors the Rust twin's `grant_columns(alias)` (`fuz_cell`). Keep in
30
+ * sync with `CellGrantRow` and the `cell_grant` DDL in `db/cell_ddl.ts`.
31
+ */
32
+ export const CELL_GRANT_COLUMNS = [
33
+ 'id',
34
+ 'cell_id',
35
+ 'level',
36
+ 'actor_id',
37
+ 'role',
38
+ 'scope_id',
39
+ 'granted_by',
40
+ 'created_at'
41
+ ];
42
+ /** The `cell_grant` timestamp override, by row qualifier (`''` bare, `g` for the cell-joined reads). */
43
+ const cell_grant_expr = iso8601_timestamp_expr(CELL_GRANT_COLUMNS, ['created_at']);
25
44
  /**
26
45
  * Insert a grant, or update the existing row's `level` + `granted_by` when
27
46
  * one already exists for the same `(cell_id, principal)` pair.
@@ -43,14 +62,14 @@ export const query_cell_grant_create = async (deps, input) => {
43
62
  VALUES ($1, $2, $3, $4)
44
63
  ON CONFLICT (cell_id, actor_id) WHERE actor_id IS NOT NULL
45
64
  DO UPDATE SET level = EXCLUDED.level, granted_by = EXCLUDED.granted_by
46
- RETURNING *`, [cell_id, level, principal.actor_id, granted_by]);
65
+ RETURNING ${columns_sql(CELL_GRANT_COLUMNS, cell_grant_expr(''))}`, [cell_id, level, principal.actor_id, granted_by]);
47
66
  return assert_row(row, 'INSERT INTO cell_grant (actor)');
48
67
  }
49
68
  const row = await deps.db.query_one(`INSERT INTO cell_grant (cell_id, level, role, scope_id, granted_by)
50
69
  VALUES ($1, $2, $3, $4, $5)
51
70
  ON CONFLICT (cell_id, role, scope_id) WHERE role IS NOT NULL
52
71
  DO UPDATE SET level = EXCLUDED.level, granted_by = EXCLUDED.granted_by
53
- RETURNING *`, [cell_id, level, principal.role, principal.scope_id, granted_by]);
72
+ RETURNING ${columns_sql(CELL_GRANT_COLUMNS, cell_grant_expr(''))}`, [cell_id, level, principal.role, principal.scope_id, granted_by]);
54
73
  return assert_row(row, 'INSERT INTO cell_grant (role)');
55
74
  };
56
75
  /**
@@ -61,9 +80,7 @@ export const query_cell_grant_create = async (deps, input) => {
61
80
  * @returns the row or `null` when not found
62
81
  */
63
82
  export const query_cell_grant_get = async (deps, grant_id) => {
64
- const row = await deps.db.query_one(`SELECT * FROM cell_grant WHERE id = $1`, [
65
- grant_id
66
- ]);
83
+ const row = await deps.db.query_one(`SELECT ${columns_sql(CELL_GRANT_COLUMNS, cell_grant_expr(''))} FROM cell_grant WHERE id = $1`, [grant_id]);
67
84
  return row ?? null;
68
85
  };
69
86
  /**
@@ -79,7 +96,7 @@ export const query_cell_grant_get = async (deps, grant_id) => {
79
96
  * @mutates `cell_grant` - deletes one row
80
97
  */
81
98
  export const query_cell_grant_delete = async (deps, grant_id) => {
82
- const row = await deps.db.query_one(`DELETE FROM cell_grant WHERE id = $1 RETURNING *`, [grant_id]);
99
+ const row = await deps.db.query_one(`DELETE FROM cell_grant WHERE id = $1 RETURNING ${columns_sql(CELL_GRANT_COLUMNS, cell_grant_expr(''))}`, [grant_id]);
83
100
  return row ?? null;
84
101
  };
85
102
  /**
@@ -92,9 +109,9 @@ export const query_cell_grant_delete = async (deps, grant_id) => {
92
109
  * @param cell_id - cell id
93
110
  * @returns matching rows
94
111
  */
95
- export const query_cell_grant_list_for_cell = async (deps, cell_id) => deps.db.query(`SELECT * FROM cell_grant
112
+ export const query_cell_grant_list_for_cell = async (deps, cell_id) => deps.db.query(`SELECT ${columns_sql(CELL_GRANT_COLUMNS, cell_grant_expr(''))} FROM cell_grant
96
113
  WHERE cell_id = $1
97
- ORDER BY created_at ASC`, [cell_id]);
114
+ ORDER BY cell_grant.created_at ASC`, [cell_id]);
98
115
  /**
99
116
  * List all grants across a set of cells, ordered by cell then creation.
100
117
  * Used by the strict relation-read filter to test `can_view_cell` per
@@ -109,9 +126,9 @@ export const query_cell_grant_list_for_cell = async (deps, cell_id) => deps.db.q
109
126
  export const query_cell_grant_list_for_cells = async (deps, cell_ids) => {
110
127
  if (cell_ids.length === 0)
111
128
  return [];
112
- return deps.db.query(`SELECT * FROM cell_grant
129
+ return deps.db.query(`SELECT ${columns_sql(CELL_GRANT_COLUMNS, cell_grant_expr(''))} FROM cell_grant
113
130
  WHERE cell_id = ANY($1::uuid[])
114
- ORDER BY cell_id, created_at ASC`, [cell_ids]);
131
+ ORDER BY cell_grant.cell_id, cell_grant.created_at ASC`, [cell_ids]);
115
132
  };
116
133
  /**
117
134
  * Load grants that admit the caller (by actor or role-scoped role_grants) across
@@ -119,6 +136,7 @@ export const query_cell_grant_list_for_cells = async (deps, cell_ids) => {
119
136
  * granted access. Returns grants for the given cells that match the caller's
120
137
  * identity or role_grant set.
121
138
  *
139
+ * @param deps - query deps
122
140
  * @param cell_ids - cells to fetch grants for
123
141
  * @param caller_actor_id - actor id of the caller (null for unauth)
124
142
  * @param role_grant_roles - active role_grant roles (parallel array)
@@ -130,7 +148,7 @@ export const query_cell_grants_for_caller_in_cells = async (deps, cell_ids, call
130
148
  if (cell_ids.length === 0) {
131
149
  return [];
132
150
  }
133
- return deps.db.query(`SELECT g.* FROM cell_grant g
151
+ return deps.db.query(`SELECT ${qualify_columns(CELL_GRANT_COLUMNS, 'g', cell_grant_expr('g'))} FROM cell_grant g
134
152
  WHERE g.cell_id = ANY($1::uuid[])
135
153
  AND (
136
154
  g.actor_id = $2
@@ -26,8 +26,15 @@ export interface CellItemRow {
26
26
  parent_id: Uuid;
27
27
  position: string;
28
28
  child_id: Uuid;
29
- created_at: Date;
29
+ created_at: string;
30
30
  }
31
+ /**
32
+ * The full `cell_item` column set, named explicitly so a row read fails
33
+ * loud on schema drift (see `CELL_COLUMNS` in `db/cell_queries.ts`). Column
34
+ * order mirrors the Rust twin's `item_columns(alias)` (`fuz_cell`). Keep in
35
+ * sync with `CellItemRow` and the `cell_item` DDL in `db/cell_ddl.ts`.
36
+ */
37
+ export declare const CELL_ITEM_COLUMNS: readonly ["parent_id", "position", "child_id", "created_at"];
31
38
  /** Input for `query_cell_item_insert`. */
32
39
  export interface CellItemInsertQueryInput {
33
40
  parent_id: Uuid;
@@ -83,7 +90,11 @@ export declare const query_cell_item_delete: (deps: QueryDeps, parent_id: Uuid,
83
90
  * cells don't surface; the parent filter is the caller's responsibility
84
91
  * (gated upstream by `can_view_cell(parent)`).
85
92
  *
86
- * @param limit - optional row cap (passes through to SQL `LIMIT`)
93
+ * @param deps - query deps
94
+ * @param parent_id - parent cell id
95
+ * @param options - `limit` caps the row count (passes through to SQL `LIMIT`);
96
+ * `position_after` resumes after a position (keyset pagination)
97
+ * @returns matching rows in lex `position` order
87
98
  */
88
99
  export declare const query_cell_item_list_for_parent: (deps: QueryDeps, parent_id: Uuid, options?: {
89
100
  limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"cell_item_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_item_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAGnD,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,IAAI,CAAC;IACf,UAA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CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,KACnD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAa5B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,8BAA8B,GAC1C,MAAM,SAAS,EACf,UAAU,IAAI,EACd,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAC1B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAS3B,CAAC"}
@@ -20,6 +20,21 @@
20
20
  * @module
21
21
  */
22
22
  import { assert_row } from './assert_row.js';
23
+ import { columns_sql, iso8601_timestamp_expr, qualify_columns } from './sql_columns.js';
24
+ /**
25
+ * The full `cell_item` column set, named explicitly so a row read fails
26
+ * loud on schema drift (see `CELL_COLUMNS` in `db/cell_queries.ts`). Column
27
+ * order mirrors the Rust twin's `item_columns(alias)` (`fuz_cell`). Keep in
28
+ * sync with `CellItemRow` and the `cell_item` DDL in `db/cell_ddl.ts`.
29
+ */
30
+ export const CELL_ITEM_COLUMNS = [
31
+ 'parent_id',
32
+ 'position',
33
+ 'child_id',
34
+ 'created_at'
35
+ ];
36
+ /** The `cell_item` timestamp override, by row qualifier (`''` bare, `i` for the cell-joined reads). */
37
+ const cell_item_expr = iso8601_timestamp_expr(CELL_ITEM_COLUMNS, ['created_at']);
23
38
  /**
24
39
  * Insert one item row at the caller-supplied `position`.
25
40
  *
@@ -34,7 +49,7 @@ import { assert_row } from './assert_row.js';
34
49
  export const query_cell_item_insert = async (deps, input) => {
35
50
  const row = await deps.db.query_one(`INSERT INTO cell_item (parent_id, position, child_id)
36
51
  VALUES ($1, $2, $3)
37
- RETURNING *`, [input.parent_id, input.position, input.child_id]);
52
+ RETURNING ${columns_sql(CELL_ITEM_COLUMNS, cell_item_expr(''))}`, [input.parent_id, input.position, input.child_id]);
38
53
  return assert_row(row, 'INSERT INTO cell_item');
39
54
  };
40
55
  /**
@@ -44,7 +59,7 @@ export const query_cell_item_insert = async (deps, input) => {
44
59
  * @returns the row or `null` when not found
45
60
  */
46
61
  export const query_cell_item_get = async (deps, parent_id, position) => {
47
- const row = await deps.db.query_one(`SELECT * FROM cell_item WHERE parent_id = $1 AND position = $2`, [parent_id, position]);
62
+ const row = await deps.db.query_one(`SELECT ${columns_sql(CELL_ITEM_COLUMNS, cell_item_expr(''))} FROM cell_item WHERE parent_id = $1 AND position = $2`, [parent_id, position]);
48
63
  return row ?? null;
49
64
  };
50
65
  /**
@@ -64,7 +79,7 @@ export const query_cell_item_move = async (deps, parent_id, position_old, positi
64
79
  const row = await deps.db.query_one(`UPDATE cell_item
65
80
  SET position = $3
66
81
  WHERE parent_id = $1 AND position = $2
67
- RETURNING *`, [parent_id, position_old, position_new]);
82
+ RETURNING ${columns_sql(CELL_ITEM_COLUMNS, cell_item_expr(''))}`, [parent_id, position_old, position_new]);
68
83
  return row ?? null;
69
84
  };
70
85
  /**
@@ -76,7 +91,8 @@ export const query_cell_item_move = async (deps, parent_id, position_old, positi
76
91
  * @mutates `cell_item` - deletes one row
77
92
  */
78
93
  export const query_cell_item_delete = async (deps, parent_id, position) => {
79
- const row = await deps.db.query_one(`DELETE FROM cell_item WHERE parent_id = $1 AND position = $2 RETURNING *`, [parent_id, position]);
94
+ const row = await deps.db.query_one(`DELETE FROM cell_item WHERE parent_id = $1 AND position = $2
95
+ RETURNING ${columns_sql(CELL_ITEM_COLUMNS, cell_item_expr(''))}`, [parent_id, position]);
80
96
  return row ?? null;
81
97
  };
82
98
  /**
@@ -86,12 +102,16 @@ export const query_cell_item_delete = async (deps, parent_id, position) => {
86
102
  * cells don't surface; the parent filter is the caller's responsibility
87
103
  * (gated upstream by `can_view_cell(parent)`).
88
104
  *
89
- * @param limit - optional row cap (passes through to SQL `LIMIT`)
105
+ * @param deps - query deps
106
+ * @param parent_id - parent cell id
107
+ * @param options - `limit` caps the row count (passes through to SQL `LIMIT`);
108
+ * `position_after` resumes after a position (keyset pagination)
109
+ * @returns matching rows in lex `position` order
90
110
  */
91
111
  export const query_cell_item_list_for_parent = async (deps, parent_id, options) => {
92
112
  const limit = options?.limit ?? null;
93
113
  const position_after = options?.position_after ?? null;
94
- return deps.db.query(`SELECT i.* FROM cell_item i
114
+ return deps.db.query(`SELECT ${qualify_columns(CELL_ITEM_COLUMNS, 'i', cell_item_expr('i'))} FROM cell_item i
95
115
  JOIN cell c ON c.id = i.child_id
96
116
  WHERE i.parent_id = $1
97
117
  AND c.deleted_at IS NULL
@@ -111,7 +131,7 @@ export const query_cell_item_list_for_parent = async (deps, parent_id, options)
111
131
  * inbound-linked child can't force an unbounded fetch + per-parent authz
112
132
  * pass on the public, IP-rate-limited reverse endpoint.
113
133
  */
114
- export const query_cell_item_list_for_child = async (deps, child_id, options) => deps.db.query(`SELECT i.* FROM cell_item i
134
+ export const query_cell_item_list_for_child = async (deps, child_id, options) => deps.db.query(`SELECT ${qualify_columns(CELL_ITEM_COLUMNS, 'i', cell_item_expr('i'))} FROM cell_item i
115
135
  JOIN cell p ON p.id = i.parent_id
116
136
  WHERE i.child_id = $1
117
137
  AND p.deleted_at IS NULL
@@ -49,13 +49,42 @@ export interface CellRow {
49
49
  parent_id: Uuid | null;
50
50
  root_id: Uuid | null;
51
51
  moderation: string | null;
52
- created_at: Date;
53
- updated_at: Date | null;
54
- deleted_at: Date | null;
52
+ created_at: string;
53
+ updated_at: string | null;
54
+ deleted_at: string | null;
55
55
  created_by: Uuid | null;
56
56
  updated_by: Uuid | null;
57
57
  grant_count: number;
58
58
  }
59
+ /**
60
+ * The full `cell` column set, named explicitly so a row read fails loud on
61
+ * schema drift — a `SELECT *` silently omits a dropped column and the
62
+ * `deleted_at IS NULL`-shaped predicates on the hydrated row then misread
63
+ * `undefined` (see `ACCOUNT_COLUMNS` in `auth/account_queries.ts` for the
64
+ * outage class). Column order mirrors the Rust twin's `cell_columns(alias)`
65
+ * (`fuz_cell`), which decodes the same projection positionally. The derived
66
+ * `grant_count` is not a column — `cell_row_projection` appends it. Keep
67
+ * in sync with `CellRow` and the `cell` DDL in `db/cell_ddl.ts`.
68
+ */
69
+ export declare const CELL_COLUMNS: readonly ["id", "data", "kind", "visibility", "path", "refs", "parent_id", "root_id", "moderation", "created_at", "updated_at", "deleted_at", "created_by", "updated_by"];
70
+ /**
71
+ * The full `CellRow` projection — `CELL_COLUMNS` qualified by `alias` plus
72
+ * the derived `grant_count` (a correlated subquery against `cell_grant`,
73
+ * served by `idx_cell_grant_cell`) — used by every cell-row SELECT /
74
+ * RETURNING. `alias` is the row qualifier: the table name (`'cell'`) for
75
+ * single-table reads + `RETURNING`, the query alias (`'c'`) for
76
+ * `query_cell_list`. Twin of `fuz_cell`'s `cell_columns(alias)`.
77
+ *
78
+ * `::int` narrows the count from `bigint` so the JS row hydrates a `number`
79
+ * rather than a bigint primitive — counts on a single cell are trivially
80
+ * within int32.
81
+ *
82
+ * Exported for consumers writing their own cell-row reads: `CELL_COLUMNS`
83
+ * alone hydrates a row without `grant_count`, which typechecks as a
84
+ * `CellRow` but fails at `to_cell_json` — this is the projection that
85
+ * actually produces one.
86
+ */
87
+ export declare const cell_row_projection: (alias: string) => string;
59
88
  /**
60
89
  * Input for `query_cell_create`. `refs` is derived from `data`. `kind` is
61
90
  * the write-once capability axis (`cell.kind` column) — set here at INSERT
@@ -1 +1 @@
1
- {"version":3,"file":"cell_queries.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/db/cell_queries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC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