@oimlsmart/platform-server 0.2.2 → 0.2.3

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": "@oimlsmart/platform-server",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "The OIML SMART platform server kernel: the store seam (ServerStore + the D1 and SQLite implementations), the canonical D1 migration set both deployments apply, the instance profile, the mailer, the RBAC map, the OIDC/OAuth client cones, and the shared role/permission vocabulary. Consumed by the smart monorepo (browser/) and the identity service.",
5
5
  "type": "module",
6
6
  "repository": {
package/src/store/d1.ts CHANGED
@@ -3235,8 +3235,16 @@ export class D1ServerStore implements ServerStore {
3235
3235
  // ── the workflow entity store + change journal ───────────────────
3236
3236
 
3237
3237
  async listEntities(store: string): Promise<EntityRow[]> {
3238
+ // The ORDER BY is the seam's contract (the 0.2.3 pin): the answer
3239
+ // arrives in (org_id, rowid) order — the read's observable order
3240
+ // since migration 0001, when the planner walked
3241
+ // idx_entities_store_org. Migration 0023's expression index offered
3242
+ // a second store-prefixed walk and the unnamed order flipped to
3243
+ // insertion (the smart app's render-baseline red, oimlsmart/smart
3244
+ // PR #264) — a list read's order is a consumer-visible contract,
3245
+ // never the planner's pick.
3238
3246
  const res = await this.stmt(
3239
- 'SELECT store, id, org_id, data, updated_at FROM entities WHERE store = ?', store,
3247
+ 'SELECT store, id, org_id, data, updated_at FROM entities WHERE store = ? ORDER BY org_id, rowid', store,
3240
3248
  ).all<EntityRow>()
3241
3249
  return res.results
3242
3250
  }
@@ -21,8 +21,13 @@ export { ORG_FIELDS, CATALOG_STORES, orgIdOf } from '../../store'
21
21
  import type { EntityRow, EntityChange } from '../../store'
22
22
 
23
23
  export function listEntities(store: string): EntityRow[] {
24
+ // The ORDER BY is the seam's contract (the 0.2.3 pin, the D1 half's
25
+ // twin): (org_id, rowid) — the read's observable order since
26
+ // migration 0001's idx_entities_store_org walk, made planner-proof
27
+ // when migration 0023's expression index offered a second
28
+ // store-prefixed plan.
24
29
  return getDb()
25
- .prepare('SELECT store, id, org_id, data, updated_at FROM entities WHERE store = ?')
30
+ .prepare('SELECT store, id, org_id, data, updated_at FROM entities WHERE store = ? ORDER BY org_id, rowid')
26
31
  .all(store) as EntityRow[]
27
32
  }
28
33
 
package/src/store.ts CHANGED
@@ -2221,6 +2221,12 @@ export interface ServerStore {
2221
2221
  ): Promise<InstrumentRegistration | null>
2222
2222
 
2223
2223
  // ── the workflow entity store + change journal ──
2224
+ /** The store's rows, in the seam's declared order: (org_id, rowid) —
2225
+ * the read's observable order since migration 0001 (NULL org ids
2226
+ * first, then by org id, then by insertion). Both backends spell the
2227
+ * ORDER BY explicitly — a list read's order is a consumer-visible
2228
+ * contract, never the planner's pick (the 0.2.3 pin, after
2229
+ * migration 0023's expression index flipped the unnamed walk). */
2224
2230
  listEntities(store: string): Promise<EntityRow[]>
2225
2231
  getEntity(store: string, id: string): Promise<EntityRow | undefined>
2226
2232
  putEntity(store: string, id: string, orgId: string | null, data: string): Promise<void>