@oddington/sdk 0.1.53 → 0.1.55

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/README.md CHANGED
@@ -308,14 +308,25 @@ provider internally through exact-origin `GET /api/auth`, owned by OS. The SDK
308
308
  uses same-origin credentials, refuses redirects and bypasses caching. Missing or
309
309
  invalid setup makes authentication unavailable without a legacy endpoint or
310
310
  app-configured provider fallback; ordinary app modules do not consume this
311
- internal bootstrap. Hosted state is `initializing`, `signed_out`, `signed_in`, `expired`
312
- or `unavailable`; actions complete without returning a session. Invitation-only
313
- code delivery never creates accounts or reveals account existence. Keep form
311
+ internal bootstrap. Hosted state is `initializing`, `signed_out`, `signed_in`,
312
+ `reconnecting`, `expired` or `unavailable`; actions complete without returning a
313
+ session. Invitation-only code delivery never creates accounts or reveals account existence. Keep form
314
314
  selection, entered values, copy and navigation in the app. The handle exposes no
315
315
  provider, configuration, membership list or access/refresh credential. Consumers
316
316
  never construct bearer headers. Multiple handles share provider coordination on
317
317
  the same origin; each owns its subscription/disposal independently.
318
318
 
319
+ When established hosted access expires, including after a suspended tab resumes,
320
+ the handle reports `reconnecting` with the already confirmed account. Keep that
321
+ account for presentation only: protected SDK operations wait for one shared,
322
+ bounded provider refresh and never send expired access. Same-session success
323
+ restores `signed_in` without requiring sign-in UI. Retryable or unconfirmed
324
+ failure settles to `unavailable`; a later protected operation may retry the
325
+ still-eligible session, with no automatic retry loop or app-owned retry API.
326
+ Only confirmed loss or revocation of refresh authority permits `expired` or
327
+ `signed_out`. Explicit `signOut()` ends access immediately, including during
328
+ recovery.
329
+
319
330
  `dispose()` releases that handle's subscriptions, timers, installed SDK context
320
331
  and pending in-memory work. It does not sign out. A disposed handle cannot be
321
332
  reused; a refreshed or reopened document creates a fresh handle and calls
@@ -364,6 +375,32 @@ session subscription. Workspace existence and member access are checked by the
364
375
  OS service. App modules use capability namespaces; routines and handlers receive
365
376
  runtime context without calling `os.init`.
366
377
 
378
+ Hosted browser apps can initialize an existing named Data snapshot for local,
379
+ read-only queries after host startup has installed that context:
380
+
381
+ ```ts
382
+ const accounting = await data.init({ repository: 'general', snapshot: 'buchhaltung' });
383
+ const month = await accounting.records.query({
384
+ transactions: { $: { where: { date: { $gte: '2026-10-01', $lt: '2026-11-01' } } } },
385
+ });
386
+ const transaction = await accounting.records.read('transactions/example');
387
+ const changes = await accounting.changes.list();
388
+ ```
389
+
390
+ Initialization confirms current access and the available artifact, reuses an
391
+ exact complete artifact-and-Changes installation or installs the validated
392
+ download and relevant Changes together. Published Changes are materialized before
393
+ querying or exact reads. Stored Changes without publication information remain
394
+ in the read-only `changes.list()` result and never alter Records.
395
+ `records.query`, `records.pages` and `records.all(query, { maxRecords })` use the existing query language and generated-schema inference.
396
+ They read locally and expose the initialized version in `$meta.version`. The
397
+ handle stays on that version; explicitly call `data.init` again to observe
398
+ later published Changes or an operator-built snapshot. Single-ref `records.read(ref)`
399
+ returns the complete structured Record or `null` from that same pinned state.
400
+ Initialization never refreshes the hosted artifact. Sign-out, context replacement and expiry invalidate local reads.
401
+ Snapshot initialization requires a hosted browser app; Node, routines and local
402
+ app contexts receive `DataOperationError` with `context_unavailable`.
403
+
367
404
  First-party Auth uses the handle without initializing workspace context. Its
368
405
  bounded `browserAuth.authorization.get(id)`, `approve(id)` and `deny(id)` actions
369
406
  support only the OS CLI request and fixed callback. Inspection/restoration never