@littlebigbrain/client 0.6.0 → 0.7.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.
package/README.md CHANGED
@@ -1,106 +1,89 @@
1
1
  # @littlebigbrain/client
2
2
 
3
- Typed TypeScript client for little big brain: ingest, BM25/vector/graph index,
4
- authorized hybrid search, traversal, ontology, feedback, and training jobs.
5
- Runs on Node 18+, browsers, and edge workers using the platform `fetch`.
3
+ The typed TypeScript client for [Little Big Brain](https://littlebigbrain.com) — write graph facts, build indexes, and run hybrid search over one snapshot. Request and response types are generated from the API contract, so every call is fully typed. Runs anywhere there's a global `fetch`: Node 18+, browsers, and edge workers.
6
4
 
7
5
  ```sh
8
6
  npm install @littlebigbrain/client
9
7
  ```
10
8
 
11
- ## Five-minute start
9
+ ## Quickstart
12
10
 
13
11
  ```ts
14
12
  import { LbbClient } from "@littlebigbrain/client";
15
13
 
16
14
  const lbb = new LbbClient({
17
- baseUrl: "https://db.eu.littlebigbrain.com",
18
- apiKey: process.env.LBB_API_KEY,
15
+ baseUrl: "https://0abc1def--production.db.eu.littlebigbrain.com",
16
+ apiKey: process.env.LBB_API_KEY, // lbb_sk_live_… — keep it server-side
19
17
  });
20
18
  const graph = lbb.graph("main");
21
19
 
22
- await graph.facts.create({
23
- triplets: [{
24
- source: { type: "CONCEPT", name: "policy-42" },
25
- relation: "RELATED_TO",
26
- target: { type: "CONCEPT", name: "seven-year retention" },
27
- evidence: "Customer records are retained for seven years.",
28
- }],
29
- }, { idempotencyKey: "policy-42-v1" });
20
+ // 1. Write a fact.
21
+ await graph.facts.create(
22
+ {
23
+ triplets: [
24
+ {
25
+ source: { type: "CONCEPT", name: "policy-42" },
26
+ relation: "RELATED_TO",
27
+ target: { type: "CONCEPT", name: "seven-year retention" },
28
+ evidence: "Customer records are retained for seven years.",
29
+ },
30
+ ],
31
+ },
32
+ { idempotencyKey: "policy-42-v1" },
33
+ );
30
34
 
35
+ // 2. Build persisted BM25 + vector + adjacency indexes and wait.
31
36
  await graph.indexes.run({ wait: true });
32
37
 
38
+ // 3. Hybrid search over the snapshot.
33
39
  const results = await graph.search.hybrid(
34
40
  "How long are customer records retained?",
35
41
  { topK: 10, source: "persisted", consistency: "strong" },
36
42
  );
37
43
  ```
38
44
 
39
- Methods return parsed JSON and throw `LbbError` on non-2xx responses. Safe
40
- reads and idempotency-keyed writes retry transient failures and honor
41
- `Retry-After`. Keep live stack keys on the server, never in browser bundles.
42
-
43
- ## Enterprise search integrations
44
-
45
- Keep the host product's users, connectors, tasks, and cursors in its existing
46
- database. Put searchable documents, passages, facts, embeddings, indexes,
47
- feedback, and model runs in little big brain:
48
-
49
- 1. Give every document/chunk/passage a stable external key.
50
- 2. Bulk-import content, provenance, and native ACL/tag/project sets.
51
- 3. Configure managed embeddings; build ANN, BM25, and adjacency once per batch.
52
- 4. Filter by ACL inside the search request before ranking and return projected
53
- fields on the ranked hits.
54
- 5. Grade cited results, reconnect to durable trainer jobs, and require a
55
- held-out quality plus latency gate before promotion.
45
+ For hosted use, `baseUrl` is required and must be the exact `endpoint_url`
46
+ shown on the stack's Connect page. Graph and branch remain client scope
47
+ parameters; they are not encoded in the hostname.
56
48
 
57
- `suggestionShown`, `suggestionAdopted`, `externalPlannerTrace`, and
58
- `askFeedback` use generated versioned payload types and idempotency keys. Their
59
- acknowledgements expose stable receipt/event identity, replay state, and why an
60
- event is or is not trainable.
49
+ ## Examples
61
50
 
62
- For an LLM query planner, call `lbb.context.suggest(...)` to fill grounded
63
- schema/value prefixes, then `lbb.context.resolve(...)` to snap free-text guesses
64
- onto real vocabulary. `resolve` uses managed embeddings when configured. Record
65
- adopted suggestions and accepted/rejected/corrected plans so a smaller planner
66
- and suggest ranker can be trained on the product's actual workload.
51
+ **Search with filters.** Pass the request body to filter before ranking — here, only facts an ACL principal may see:
67
52
 
68
- The [enterprise-search integration guide](https://docs.littlebigbrain.com/guides/enterprise-search/)
69
- contains the graph model, migration sequence, and acceptance tests.
53
+ ```ts
54
+ const results = await graph.search.hybrid({
55
+ query: "incident response runbook",
56
+ targets: ["entities"],
57
+ search: {
58
+ filters: {
59
+ op: "overlaps",
60
+ field: "acl",
61
+ values: ["user:rino@example.com", "group:engineering"],
62
+ },
63
+ },
64
+ top_k: 20,
65
+ });
66
+ ```
70
67
 
71
- ## Main surface
68
+ **Bulk import.** Load an array of records (or an NDJSON string) in one call:
72
69
 
73
70
  ```ts
74
- graph.facts.create(...)
75
- graph.facts.import(...)
76
- graph.search.hybrid(...)
77
- graph.entities.iterate(...)
78
- graph.context.ask(...)
79
- graph.ontology.view(...)
80
- graph.query.sparql(...)
81
- graph.schema.audit(...)
82
-
83
- const build = await graph.indexes.submit({}, { idempotencyKey: "index:head:147" })
84
- await graph.indexes.job(build.job_id)
85
- await graph.indexes.cancel(build.job_id)
86
-
87
- const gc = await graph.indexes.submitGc({ dry_run: false }, { idempotencyKey: "gc:2026-07-15" })
88
- await graph.indexes.gcJob(gc.job_id)
89
-
90
- await graph.branch("review").deleteBranch({ confirm: "review" })
91
- await graph.delete({ confirm: "main" }) // whole graph, every branch
71
+ await graph.facts.import(
72
+ [
73
+ { source: { type: "DOC", name: "handbook", key: "doc:42" }, relation: "HAS_PASSAGE", target: { type: "PASSAGE", name: "leave-policy", key: "p:42:1" } },
74
+ // …one record per line
75
+ ],
76
+ { idempotencyKey: "handbook-batch-1" },
77
+ );
92
78
  ```
93
79
 
94
- Other focused methods cover managed embeddings, full-text/vector search,
95
- multi-query fusion, traversal, temporal state/history, SHACL, ontology
96
- evolution, feedback, indexing, and graph inspection. Request/response types are
97
- generated from `contracts/openapi.json`; common aliases and the complete
98
- `Schemas` map are exported from the package.
80
+ **Time-travel read.** Pin any search to a past instant — results reflect the graph as it was then:
99
81
 
100
- Use `rawRequest()` when you need response headers, request ID, retry count, or
101
- elapsed time. `onRequest` and `onResponse` provide body-free instrumentation.
82
+ ```ts
83
+ const asOf = await graph.search.hybrid("retention policy", { asOf: "2026-01-01T00:00:00Z" });
84
+ ```
102
85
 
103
- ## SPARQL
86
+ **SPARQL.** `sparqlRows` runs a SPARQL 1.1 SELECT/ASK and returns parsed rows:
104
87
 
105
88
  ```ts
106
89
  const { rows } = await lbb.sparqlRows({
@@ -108,15 +91,21 @@ const { rows } = await lbb.sparqlRows({
108
91
  });
109
92
  ```
110
93
 
111
- `sparqlRows` parses SELECT/ASK results. The native SPARQL 1.1 Protocol is also
112
- available at `/sparql` for standard RDF clients.
94
+ ## Errors & retries
95
+
96
+ Methods return parsed JSON and throw `LbbError` (with `status`, `code`, `message`, `param`, `requestId`, `docUrl`) on any non-2xx response. Safe reads and idempotency-keyed writes retry `429`/`5xx` and network failures with full-jitter backoff, bounded by a retry budget (`retryBudgetMs`, default 60s) rather than a fixed count, and honor `Retry-After` — a terminal error the server marks non-retryable surfaces immediately. Use `rawRequest()` for response headers, request id, and retry/timing metadata.
97
+
98
+ ## More
99
+
100
+ The `graph(...)` scope exposes `facts`, `search`, `entities`, `indexes`, `ontology`, `query`, `schema`, and `context` namespaces — covering managed embeddings, multi-query fusion, traversal, temporal state and history, SHACL, ontology evolution, and durable index jobs. Every generated shape is available as `Schemas["TypeName"]`.
101
+
102
+ Full reference and guides: [docs.littlebigbrain.com/sdks/typescript](https://docs.littlebigbrain.com/sdks/typescript/).
113
103
 
114
104
  ## Develop
115
105
 
116
106
  ```sh
117
107
  npm install
118
- npm run generate
108
+ npm run generate # regenerate types from contracts/openapi.json
119
109
  npm run typecheck
120
110
  npm test
121
- npm run pack:check
122
111
  ```
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import type { ImportLine, LbbClientOptions, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults } from "./types.js";
2
- import { type RequestOptions } from "./transport.js";
1
+ import type { ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults } from "./types.js";
2
+ import { type CallOptions, type RequestOptions } from "./transport.js";
3
3
  import { ContextNamespace, EntityNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace } from "./namespaces.js";
4
4
  export { parseSparqlResults } from "./types.js";
5
- export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./types.js";
5
+ export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./types.js";
6
6
  export { LbbError } from "./transport.js";
7
7
  export type { CallOptions, Query, QueryValue, RequestOptions, } from "./transport.js";
8
8
  export type { EntityListOptions, HybridSearchOptions } from "./namespaces.js";
@@ -115,6 +115,42 @@ export declare class LbbClient {
115
115
  }): Promise<Schemas["GraphRetractResponse"]>;
116
116
  /** Create the scoped graph/branch. Construct the client with the desired graph/branch first. */
117
117
  createGraph(): Promise<Schemas["CreateGraphResponse"]>;
118
+ /**
119
+ * Fork a whole graph into a brand-new destination graph in the same tenant.
120
+ * The copy runs as a durable background job (`confirm` is fixed to `dst`, which
121
+ * the route requires to authorize the fork); the destination must not already
122
+ * exist, so the create-only CAS on the server side makes the call safe to
123
+ * retry. The response only acknowledges the enqueue — poll the destination
124
+ * graph's metadata (see `response.poll`) to observe the fork completing: the
125
+ * destination becomes readable once its head is published.
126
+ */
127
+ forkGraph(opts: {
128
+ src: string;
129
+ dst: string;
130
+ }): Promise<Schemas["GraphForkResponse"]>;
131
+ /**
132
+ * Declarative full-state replace: reconcile the scoped graph so its current
133
+ * state matches exactly the NDJSON payload (same line grammar as
134
+ * {@link import} — triplets or `{type,name,properties}` entity records; pass an
135
+ * array, serialized here, or a pre-built NDJSON string). The whole
136
+ * reconciliation lands as one atomic cutover: payload records are upserted, and
137
+ * entities present at the pre-reload head but absent from the payload leave
138
+ * current state (retraction semantics — history is preserved, so an `as_of`
139
+ * read pinned before the cutover still sees the old state). `confirm` must
140
+ * equal the target graph id (reload is semi-destructive). `dryRun` previews the
141
+ * full delta with zero durable changes. The response carries
142
+ * `prior_commit_seq` / `prior_snapshot_token` as the rollback anchor — read
143
+ * them back with `?as_of_commit_seq=<prior_commit_seq>` to see the pre-reload
144
+ * state. An Idempotency-Key scopes the single cutover commit, so a retry
145
+ * replays rather than re-applying.
146
+ */
147
+ reload(lines: ImportLine[] | string, opts: {
148
+ confirm: string;
149
+ dryRun?: boolean;
150
+ strict?: boolean;
151
+ observedAt?: string;
152
+ idempotencyKey?: string;
153
+ }): Promise<Schemas["GraphReloadResponse"]>;
118
154
  /** Fork the scoped branch from an existing branch in the same graph. */
119
155
  createBranch(body: Schemas["GraphBranchCreateRequest"]): Promise<Schemas["GraphBranchCreateResponse"]>;
120
156
  /**
@@ -385,7 +421,14 @@ export declare class LbbClient {
385
421
  name?: string;
386
422
  relations?: string[];
387
423
  asOf?: string;
424
+ /** Require the bounded ranged-adjacency path; returns `index_busy` while unavailable. */
425
+ indexed?: boolean;
388
426
  }): Promise<Schemas["EntityNeighborhoodResponse"]>;
427
+ /** Exact type cardinality plus a bounded deterministic sample from ranged adjacency. */
428
+ entityTypeSample(opts: {
429
+ type: string;
430
+ limit?: number;
431
+ } & CallOptions): Promise<Schemas["EntityTypeSampleResponse"]>;
389
432
  /** Stored entity object-ref status and index-coverage metadata (no
390
433
  * attributes — read those from `entityDetail`'s top-level `attributes`). */
391
434
  entityMetadata(opts: {
@@ -581,8 +624,12 @@ export declare class LbbClient {
581
624
  }): Promise<Schemas["WalCompactResponse"]>;
582
625
  /** Server, graph, and persisted-index status. */
583
626
  status(): Promise<unknown>;
584
- /** Graph footprint, WAL tail, and index coverage. */
585
- metadata(): Promise<Schemas["GraphMetadataResponse"]>;
627
+ /** Graph footprint, WAL tail, and index coverage. Exact object inventory is opt-in. */
628
+ metadata(opts?: {
629
+ includeObjects?: boolean;
630
+ includeIndexes?: boolean;
631
+ includeTemporalCoverage?: boolean;
632
+ }): Promise<Schemas["GraphMetadataResponse"]>;
586
633
  waitForIndexLineage(targetSeq: number, opts?: {
587
634
  timeoutMs?: number;
588
635
  pollIntervalMs?: number;
@@ -591,6 +638,4 @@ export declare class LbbClient {
591
638
  summary(): Promise<Schemas["GraphSummaryResponse"]>;
592
639
  /** List the graphs (and branches) under the scoped tenant. */
593
640
  listGraphs(): Promise<Schemas["GraphListResponse"]>;
594
- /** Activity for the stack selected by the bearer stack key or session. */
595
- stackActivity(window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
596
641
  }
package/dist/client.js CHANGED
@@ -32,7 +32,11 @@ export class LbbClient {
32
32
  ontology;
33
33
  query;
34
34
  constructor(options) {
35
- this.baseUrl = options.baseUrl.replace(/\/+$/, "");
35
+ const baseUrl = options.baseUrl?.trim();
36
+ if (!baseUrl) {
37
+ throw new Error("baseUrl is required; copy endpoint_url from the stack's Connect page for hosted use");
38
+ }
39
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
36
40
  this.apiKey = options.apiKey;
37
41
  this.graphName = options.graph;
38
42
  this.branchName = options.branch;
@@ -396,6 +400,53 @@ export class LbbClient {
396
400
  createGraph() {
397
401
  return this.request("POST", "/v1/graph/create");
398
402
  }
403
+ /**
404
+ * Fork a whole graph into a brand-new destination graph in the same tenant.
405
+ * The copy runs as a durable background job (`confirm` is fixed to `dst`, which
406
+ * the route requires to authorize the fork); the destination must not already
407
+ * exist, so the create-only CAS on the server side makes the call safe to
408
+ * retry. The response only acknowledges the enqueue — poll the destination
409
+ * graph's metadata (see `response.poll`) to observe the fork completing: the
410
+ * destination becomes readable once its head is published.
411
+ */
412
+ forkGraph(opts) {
413
+ return this.request("POST", "/v1/graph/fork", {
414
+ query: { src: opts.src, dst: opts.dst, confirm: opts.dst },
415
+ retry: true,
416
+ });
417
+ }
418
+ /**
419
+ * Declarative full-state replace: reconcile the scoped graph so its current
420
+ * state matches exactly the NDJSON payload (same line grammar as
421
+ * {@link import} — triplets or `{type,name,properties}` entity records; pass an
422
+ * array, serialized here, or a pre-built NDJSON string). The whole
423
+ * reconciliation lands as one atomic cutover: payload records are upserted, and
424
+ * entities present at the pre-reload head but absent from the payload leave
425
+ * current state (retraction semantics — history is preserved, so an `as_of`
426
+ * read pinned before the cutover still sees the old state). `confirm` must
427
+ * equal the target graph id (reload is semi-destructive). `dryRun` previews the
428
+ * full delta with zero durable changes. The response carries
429
+ * `prior_commit_seq` / `prior_snapshot_token` as the rollback anchor — read
430
+ * them back with `?as_of_commit_seq=<prior_commit_seq>` to see the pre-reload
431
+ * state. An Idempotency-Key scopes the single cutover commit, so a retry
432
+ * replays rather than re-applying.
433
+ */
434
+ reload(lines, opts) {
435
+ const ndjson = typeof lines === "string"
436
+ ? lines
437
+ : lines.map((line) => JSON.stringify(line)).join("\n");
438
+ return this.request("POST", "/v1/graph/reload", {
439
+ rawBody: ndjson,
440
+ contentType: "application/x-ndjson",
441
+ query: {
442
+ confirm: opts.confirm,
443
+ dry_run: opts.dryRun,
444
+ strict: opts.strict,
445
+ observed_at: opts.observedAt,
446
+ },
447
+ idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("reload"),
448
+ });
449
+ }
399
450
  /** Fork the scoped branch from an existing branch in the same graph. */
400
451
  createBranch(body) {
401
452
  return this.request("POST", "/v1/graph/branch", { body });
@@ -779,9 +830,18 @@ export class LbbClient {
779
830
  name: opts.name,
780
831
  relations: opts.relations?.join(","),
781
832
  as_of: opts.asOf,
833
+ indexed: opts.indexed,
782
834
  },
783
835
  });
784
836
  }
837
+ /** Exact type cardinality plus a bounded deterministic sample from ranged adjacency. */
838
+ entityTypeSample(opts) {
839
+ const { type, limit, ...request } = opts;
840
+ return this.request("GET", "/v1/graph/entities/sample", {
841
+ ...request,
842
+ query: { type, limit },
843
+ });
844
+ }
785
845
  /** Stored entity object-ref status and index-coverage metadata (no
786
846
  * attributes — read those from `entityDetail`'s top-level `attributes`). */
787
847
  entityMetadata(opts) {
@@ -1074,9 +1134,15 @@ export class LbbClient {
1074
1134
  status() {
1075
1135
  return this.request("GET", "/v1/status");
1076
1136
  }
1077
- /** Graph footprint, WAL tail, and index coverage. */
1078
- metadata() {
1079
- return this.request("GET", "/v1/graph/metadata");
1137
+ /** Graph footprint, WAL tail, and index coverage. Exact object inventory is opt-in. */
1138
+ metadata(opts = {}) {
1139
+ return this.request("GET", "/v1/graph/metadata", {
1140
+ query: {
1141
+ include_objects: opts.includeObjects,
1142
+ include_indexes: opts.includeIndexes,
1143
+ include_temporal_coverage: opts.includeTemporalCoverage,
1144
+ },
1145
+ });
1080
1146
  }
1081
1147
  async waitForIndexLineage(targetSeq, opts = {}) {
1082
1148
  const deadline = Date.now() + (opts.timeoutMs ?? 30_000);
@@ -1117,9 +1183,4 @@ export class LbbClient {
1117
1183
  listGraphs() {
1118
1184
  return this.request("GET", "/v1/graphs");
1119
1185
  }
1120
- // --- stack activity ---
1121
- /** Activity for the stack selected by the bearer stack key or session. */
1122
- stackActivity(window = "24h") {
1123
- return this.request("GET", "/v1/stack/activity", { query: { window } });
1124
- }
1125
1186
  }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { LbbClient, LbbError, parseSparqlResults } from "./client.js";
2
- export type { LbbClientOptions, CallOptions, RequestOptions, EntityListOptions, HybridSearchOptions, LbbRequestEvent, LbbResponseEvent, LbbStackActivityResponse, LbbStackActivityWindow, FetchLike, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./client.js";
2
+ export type { LbbClientOptions, CallOptions, RequestOptions, EntityListOptions, HybridSearchOptions, LbbRequestEvent, LbbResponseEvent, FetchLike, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./client.js";
3
3
  export type { components, paths, operations } from "./schema.js";
@@ -143,6 +143,15 @@ export declare class IndexNamespace {
143
143
  export declare class EntityNamespace {
144
144
  private readonly client;
145
145
  constructor(client: LbbClient);
146
+ /**
147
+ * Return the exact type cardinality and a bounded deterministic sample from
148
+ * the ranged adjacency index. The server returns `index_busy` rather than
149
+ * falling back to an exhaustive snapshot scan when the index is unavailable.
150
+ */
151
+ sample(opts: {
152
+ type: string;
153
+ limit?: number;
154
+ } & CallOptions): Promise<Schemas["EntityTypeSampleResponse"]>;
146
155
  /**
147
156
  * Browse entities as the unified list envelope. Pass `fields` (names or `*`)
148
157
  * to inline each row's typed attributes as native JSON (under `attributes`) —
@@ -344,6 +344,14 @@ export class EntityNamespace {
344
344
  constructor(client) {
345
345
  this.client = client;
346
346
  }
347
+ /**
348
+ * Return the exact type cardinality and a bounded deterministic sample from
349
+ * the ranged adjacency index. The server returns `index_busy` rather than
350
+ * falling back to an exhaustive snapshot scan when the index is unavailable.
351
+ */
352
+ sample(opts) {
353
+ return this.client.entityTypeSample(opts);
354
+ }
347
355
  /**
348
356
  * Browse entities as the unified list envelope. Pass `fields` (names or `*`)
349
357
  * to inline each row's typed attributes as native JSON (under `attributes`) —