@oddington/sdk 0.1.23 → 0.1.25

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
@@ -1,6 +1,6 @@
1
- # Oddington SDK
1
+ # OS SDK
2
2
 
3
- The importable client for Oddington apps, routines and response handlers.
3
+ The importable client for OS apps, routines and response handlers.
4
4
  Node operations require Node.js 22.12.0 or later. The root import and hosted
5
5
  Data and Files APIs work in browsers. Installing the package grants no authority.
6
6
 
@@ -396,8 +396,8 @@ await files.upload(report.id); // Move a local File and every retained enrichmen
396
396
 
397
397
  Hosted Files retains remote originals and caller-produced named enrichments;
398
398
  `storage: 'local'` requires a managed CLI parent. Configure that parent with
399
- `ODDINGTON_FILES_ROOT` pointing to an empty or already OS-managed dedicated
400
- directory outside tracked Git content. `ODDINGTON_FILES_DEFAULT=local|remote`
399
+ `OS_FILES_ROOT` pointing to an empty or already OS-managed dedicated
400
+ directory outside tracked Git content. `OS_FILES_DEFAULT=local|remote`
401
401
  selects its default; without it, remote remains the default. Per-File `storage`
402
402
  overrides it. The root stays private to the parent. Local creation without a
403
403
  configured root fails with `unsupported_context`. Files have one durable home;
@@ -501,6 +501,55 @@ replacement; repeat its options and links while omitting unrelated collections.
501
501
  There is no automatic retry or separate version fetch.
502
502
  Collection schemas omit Markdown storage hints.
503
503
 
504
+ Iterate matching Records on demand or collect them with an explicit total ceiling:
505
+
506
+ ```ts
507
+ import type { RecordsQuery } from '@oddington/sdk';
508
+
509
+ const query = {
510
+ invoices: { $: { limit: 50, count: true }, supplier: { $: { fields: ['name'] } } },
511
+ suppliers: { $: { fields: ['name'], limit: 50 } },
512
+ } satisfies RecordsQuery;
513
+
514
+ for await (const page of general.records.pages(query)) {
515
+ consume(page.invoices, page.suppliers);
516
+ }
517
+ const matches = await general.records.all(query, { maxRecords: 10_000 });
518
+ ```
519
+
520
+ Both helpers preserve literal collection arrays and selected-link inference.
521
+ `pages` captures the query at invocation, fetches only when requested, and never
522
+ prefetches after a consumer stops. Independent collection cursors pin the first
523
+ snapshot. Completed collections yield empty arrays on later pages and retain
524
+ requested counts. Empty matches yield one versioned page. Helpers own continuation;
525
+ use `select` for a manual `after` cursor or explicit historical selection.
526
+
527
+ `all` consumes the same iterator and returns only after successful exhaustion.
528
+ Its required positive safe-integer `maxRecords` caps top-level Record occurrences
529
+ across all collections; expanded links do not count toward that ceiling. Overflow
530
+ rejects with nonretryable `capacity`, without a partial or truncated result.
531
+ Invalid helper arguments use `invalid_query`; malformed pages, cursor cycles,
532
+ snapshot changes or inconsistent requested counts use nonretryable `unavailable`.
533
+ Selection and authority failures propagate unchanged, with no retry or restart.
534
+
535
+ Read known stable refs directly, including refs from different collections:
536
+
537
+ ```ts
538
+ const invoice = await general.records.read('invoices/one'); // complete Record or null
539
+ const batch = await general.records.read(['invoices/one', 'suppliers/acme']);
540
+ // batch.$meta.version identifies one repository snapshot.
541
+ // batch.records has one Record-or-null slot per input, in the same order.
542
+ ```
543
+
544
+ An array accepts 1–100 distinct valid refs; a one-element array keeps the batch
545
+ shape, and all-missing batches still carry their version. Both forms send one
546
+ bounded operation through the same app/routine authority and snapshot as `select`.
547
+ Records include `$ref`, `$version` and all canonical structured fields; links
548
+ remain refs, omitted and null fields stay distinct, and Markdown bodies and
549
+ `$filing` are excluded. Invalid refs, exceeded bounds, denied access and service
550
+ failures reject the entire call; only a missing Record returns null. No options,
551
+ projection, expansion or historical version argument is accepted.
552
+
504
553
  Read published History through the same inert repository handle:
505
554
 
506
555
  ```ts
@@ -663,8 +712,8 @@ work; never repeat the whole change blindly. Credentials must never be retained
663
712
  in files, publication, logs, handler input, errors or receipts.
664
713
 
665
714
  Managed routine launches supply workspace, scoped capability and working root.
666
- The defaults read `ODDINGTON_ROUTINE_WORKSPACE`, `ODDINGTON_ROUTINE_RUN` and
667
- `ODDINGTON_INBOX_WORKING_ROOT` (or the current directory). Callers may supply the
715
+ The defaults read `OS_ROUTINE_WORKSPACE`, `OS_ROUTINE_RUN` and
716
+ `OS_INBOX_WORKING_ROOT` (or the current directory). Callers may supply the
668
717
  existing `workspace`, `capability` and `workingRoot` options. Runtime context
669
718
  provides authority; callers cannot select repository remotes or expand grants.
670
719
  `os routine run <name> [--input <file|->]` executes the conventional inert