@sapixdb/sdk 0.2.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.
@@ -0,0 +1,190 @@
1
+ // ── CollectionSnapshot ────────────────────────────────────────────────────────
2
+ /**
3
+ * A read-only view of a collection scoped to a specific point in time.
4
+ * Returned by `CollectionClient.asOf(timestampHlc)`.
5
+ *
6
+ * @example
7
+ * const snapshot = db.collection("orders").asOf(record.timestamp_hlc);
8
+ * const results = await snapshot.latest({ limit: 10 });
9
+ */
10
+ export class CollectionSnapshot {
11
+ name;
12
+ timestampHlc;
13
+ req;
14
+ constructor(name, timestampHlc, req) {
15
+ this.name = name;
16
+ this.timestampHlc = timestampHlc;
17
+ this.req = req;
18
+ }
19
+ /** Records written at or before this snapshot timestamp, newest-first. */
20
+ latest(opts = {}) {
21
+ return this.req("POST", `/v1/agents/${this.name}/query`, {
22
+ type: "as_of",
23
+ timestamp_hlc: this.timestampHlc,
24
+ limit: opts.limit ?? 20,
25
+ });
26
+ }
27
+ /**
28
+ * Equality-filter scan bounded by the snapshot timestamp.
29
+ * `filter` is a `{field: value}` object — first key is used.
30
+ */
31
+ find(filter, opts = {}) {
32
+ const [field, value] = Object.entries(filter)[0] ?? [];
33
+ const whereFilter = field
34
+ ? { field, op: "eq", value }
35
+ : undefined;
36
+ return this.req("POST", `/v1/agents/${this.name}/query`, {
37
+ type: "scan",
38
+ limit: opts.limit ?? 20,
39
+ ...(whereFilter ? { filter: whereFilter } : {}),
40
+ });
41
+ }
42
+ async findOne(filter) {
43
+ const result = await this.find(filter, { limit: 1 });
44
+ return result.records[0] ?? null;
45
+ }
46
+ }
47
+ // ── CollectionClient ──────────────────────────────────────────────────────────
48
+ /**
49
+ * Client for a named SapixDB agent (collection).
50
+ * All operations route to `/v1/agents/{name}/...`.
51
+ *
52
+ * Obtain via `SapixClient.collection(name)` or `SapixClient.agent(name)`.
53
+ *
54
+ * @example
55
+ * const orders = db.collection("orders");
56
+ *
57
+ * // Write
58
+ * const record = await orders.write({ total: 99.99, status: "pending" });
59
+ *
60
+ * // Read
61
+ * const latest = await orders.latest({ limit: 20 });
62
+ * const pending = await orders.find({ status: "pending" });
63
+ * const one = await orders.findOne({ status: "pending" });
64
+ * const byHash = await orders.get(record.content_hash);
65
+ *
66
+ * // History (chronological)
67
+ * const history = await orders.history({ limit: 100, offset: 0 });
68
+ *
69
+ * // Time travel
70
+ * const snapshot = await orders.asOf(record.timestamp_hlc).latest();
71
+ *
72
+ * // Direct SaQL
73
+ * const result = await orders.query({ type: "latest", limit: 5 });
74
+ *
75
+ * // Realtime — handled on SapixClient
76
+ * client.subscribeAgent("orders", (event) => console.log(event));
77
+ */
78
+ export class CollectionClient {
79
+ name;
80
+ req;
81
+ constructor(name, req) {
82
+ this.name = name;
83
+ this.req = req;
84
+ }
85
+ // ── Writes ──────────────────────────────────────────────────────────────────
86
+ /**
87
+ * Append a JSON record to the agent's strand.
88
+ * `data` can be any JSON-serialisable object.
89
+ */
90
+ write(data) {
91
+ return this.req("POST", `/v1/agents/${this.name}/records/json`, { data });
92
+ }
93
+ /** Alias for `write` — matches Python/Go SDK naming. */
94
+ writeJson(data) {
95
+ return this.write(data);
96
+ }
97
+ // ── Reads ───────────────────────────────────────────────────────────────────
98
+ /**
99
+ * Fetch a single record by its BLAKE3 content hash.
100
+ * Use `record.content_hash` from a previous write or query.
101
+ */
102
+ get(contentHash) {
103
+ return this.req("GET", `/v1/agents/${this.name}/records/${contentHash}`);
104
+ }
105
+ /**
106
+ * Return the most recent records, newest-first.
107
+ *
108
+ * Pass `filter: { field: value }` to run an equality scan (uses a field
109
+ * index when one is available for that field, otherwise a full strand scan).
110
+ */
111
+ latest(opts = {}) {
112
+ if (opts.filter) {
113
+ const [field, value] = Object.entries(opts.filter)[0] ?? [];
114
+ if (field !== undefined) {
115
+ return this.req("POST", `/v1/agents/${this.name}/query`, {
116
+ type: "scan",
117
+ limit: opts.limit ?? 20,
118
+ filter: { field, op: "eq", value },
119
+ });
120
+ }
121
+ }
122
+ return this.req("POST", `/v1/agents/${this.name}/query`, {
123
+ type: "latest",
124
+ limit: opts.limit ?? 20,
125
+ });
126
+ }
127
+ /**
128
+ * Return records in chronological order (oldest-first) with pagination.
129
+ * Uses `GET /v1/agents/{name}/strand/records`.
130
+ */
131
+ history(opts = {}) {
132
+ const params = new URLSearchParams();
133
+ if (opts.limit !== undefined)
134
+ params.set("limit", String(opts.limit));
135
+ if (opts.offset !== undefined)
136
+ params.set("offset", String(opts.offset));
137
+ const qs = params.size > 0 ? `?${params}` : "";
138
+ return this.req("GET", `/v1/agents/${this.name}/strand/records${qs}`);
139
+ }
140
+ /**
141
+ * Equality-filter scan across the full strand.
142
+ * `filter` is a `{field: value}` object — first key is used.
143
+ *
144
+ * Uses a field index when one exists for that field; otherwise falls back
145
+ * to a full strand scan on the server.
146
+ */
147
+ find(filter, opts = {}) {
148
+ const [field, value] = Object.entries(filter)[0] ?? [];
149
+ const whereFilter = field
150
+ ? { field, op: "eq", value }
151
+ : undefined;
152
+ return this.req("POST", `/v1/agents/${this.name}/query`, {
153
+ type: "scan",
154
+ limit: opts.limit ?? 20,
155
+ ...(whereFilter ? { filter: whereFilter } : {}),
156
+ });
157
+ }
158
+ /** Return the first matching record, or `null` if none. */
159
+ async findOne(filter) {
160
+ const result = await this.find(filter, { limit: 1 });
161
+ return result.records[0] ?? null;
162
+ }
163
+ /** Execute any SaQL query directly against this agent. */
164
+ query(q) {
165
+ return this.req("POST", `/v1/agents/${this.name}/query`, q);
166
+ }
167
+ /** Current chain head hash and record count. */
168
+ head() {
169
+ return this.req("GET", `/v1/agents/${this.name}/strand/head`);
170
+ }
171
+ /** Agent status: record count, chain head, zone, schema version, caged state. */
172
+ status() {
173
+ return this.req("GET", `/v1/agents/${this.name}/status`);
174
+ }
175
+ // ── Time travel ─────────────────────────────────────────────────────────────
176
+ /**
177
+ * Scope reads to a point in time identified by an HLC timestamp.
178
+ * Returns a `CollectionSnapshot` — call `.latest()` or `.find()` on it.
179
+ *
180
+ * @param timestampHlc — `NucleotideRecord.timestamp_hlc` from any prior record
181
+ *
182
+ * @example
183
+ * const snapshot = orders.asOf(record.timestamp_hlc);
184
+ * const state = await snapshot.latest({ limit: 50 });
185
+ */
186
+ asOf(timestampHlc) {
187
+ return new CollectionSnapshot(this.name, timestampHlc, this.req);
188
+ }
189
+ }
190
+ //# sourceMappingURL=collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAaA,iFAAiF;AAEjF;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAkB;IAEV;IACA;IACA;IAHnB,YACmB,IAAY,EACZ,YAAoB,EACpB,GAAc;QAFd,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAQ;QACpB,QAAG,GAAH,GAAG,CAAW;IAC9B,CAAC;IAEJ,0EAA0E;IAC1E,MAAM,CAAC,OAA2B,EAAE;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,IAAI,CAAC,IAAI,QAAQ,EAAE;YACvD,IAAI,EAAE,OAAO;YACb,aAAa,EAAE,IAAI,CAAC,YAAY;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;SACxB,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,IAAI,CACF,MAA+B,EAC/B,OAA2B,EAAE;QAE7B,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvD,MAAM,WAAW,GAA4B,KAAK;YAChD,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YAC5B,CAAC,CAAC,SAAS,CAAC;QACd,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,IAAI,CAAC,IAAI,QAAQ,EA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;OASG;IACH,IAAI,CAAC,YAAoB;QACvB,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ export declare class SapixError extends Error {
2
+ readonly status?: number | undefined;
3
+ readonly body?: string | undefined;
4
+ constructor(message: string, status?: number | undefined, body?: string | undefined);
5
+ static fromResponse(resp: Response): Promise<SapixError>;
6
+ }
7
+ /**
8
+ * Thrown when an API key exceeds its configured requests-per-second limit (HTTP 429).
9
+ *
10
+ * @example
11
+ * import { SapixRateLimitError } from "@sapixdb/client";
12
+ *
13
+ * try {
14
+ * await orders.write(data);
15
+ * } catch (err) {
16
+ * if (err instanceof SapixRateLimitError) {
17
+ * const delay = err.rpsLimit ? 1000 / err.rpsLimit : 1000;
18
+ * await new Promise(r => setTimeout(r, delay));
19
+ * await orders.write(data); // retry once
20
+ * } else throw err;
21
+ * }
22
+ */
23
+ export declare class SapixRateLimitError extends SapixError {
24
+ /** The key's configured limit in requests/second, parsed from the server message. */
25
+ readonly rpsLimit?: number | undefined;
26
+ constructor(message: string,
27
+ /** The key's configured limit in requests/second, parsed from the server message. */
28
+ rpsLimit?: number | undefined);
29
+ }
30
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAW,SAAQ,KAAK;aAGjB,MAAM,CAAC,EAAE,MAAM;aACf,IAAI,CAAC,EAAE,MAAM;gBAF7B,OAAO,EAAE,MAAM,EACC,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,IAAI,CAAC,EAAE,MAAM,YAAA;WAMlB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CA0B/D;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;IAG/C,qFAAqF;aACrE,QAAQ,CAAC,EAAE,MAAM;gBAFjC,OAAO,EAAE,MAAM;IACf,qFAAqF;IACrE,QAAQ,CAAC,EAAE,MAAM,YAAA;CAKpC"}
package/dist/errors.js ADDED
@@ -0,0 +1,60 @@
1
+ export class SapixError extends Error {
2
+ status;
3
+ body;
4
+ constructor(message, status, body) {
5
+ super(message);
6
+ this.status = status;
7
+ this.body = body;
8
+ this.name = "SapixError";
9
+ }
10
+ static async fromResponse(resp) {
11
+ let body;
12
+ try {
13
+ body = await resp.text();
14
+ }
15
+ catch {
16
+ body = "<unreadable>";
17
+ }
18
+ if (resp.status === 429) {
19
+ let message = "rate limit exceeded";
20
+ let rpsLimit;
21
+ try {
22
+ const data = JSON.parse(body);
23
+ message = data.message ?? data.error ?? message;
24
+ const m = message.match(/rate limit of (\d+) req\/s/);
25
+ if (m)
26
+ rpsLimit = Number(m[1]);
27
+ }
28
+ catch { /* body was not JSON */ }
29
+ return new SapixRateLimitError(message, rpsLimit);
30
+ }
31
+ return new SapixError(`sapix-agent returned ${resp.status} ${resp.statusText}: ${body}`, resp.status, body);
32
+ }
33
+ }
34
+ /**
35
+ * Thrown when an API key exceeds its configured requests-per-second limit (HTTP 429).
36
+ *
37
+ * @example
38
+ * import { SapixRateLimitError } from "@sapixdb/client";
39
+ *
40
+ * try {
41
+ * await orders.write(data);
42
+ * } catch (err) {
43
+ * if (err instanceof SapixRateLimitError) {
44
+ * const delay = err.rpsLimit ? 1000 / err.rpsLimit : 1000;
45
+ * await new Promise(r => setTimeout(r, delay));
46
+ * await orders.write(data); // retry once
47
+ * } else throw err;
48
+ * }
49
+ */
50
+ export class SapixRateLimitError extends SapixError {
51
+ rpsLimit;
52
+ constructor(message,
53
+ /** The key's configured limit in requests/second, parsed from the server message. */
54
+ rpsLimit) {
55
+ super(message, 429);
56
+ this.rpsLimit = rpsLimit;
57
+ this.name = "SapixRateLimitError";
58
+ }
59
+ }
60
+ //# sourceMappingURL=errors.js.map
@@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,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IAI/B;IAHlB,YACE,OAAe;IACf,qFAAqF;IACrE,QAAiB;QAEjC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;QAFJ,aAAQ,GAAR,QAAQ,CAAS;QAGjC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ export { SapixClient } from "./client.js";
2
+ export { AdminClient } from "./admin.js";
3
+ export { CollectionClient, CollectionSnapshot } from "./collection.js";
4
+ export { SapixError, SapixRateLimitError } from "./errors.js";
5
+ export { openAgentStream, openGlobalStream } from "./stream.js";
6
+ export type { AddEdgeRequest, AddRecordRefRequest, AgentStatusResponse, ApiKeyPatch, ApiKeyUsage, ApiKeyView, ChainHeadResponse, CreateApiKeyRequest, CreateApiKeyResponse, EdgeView, GenesisRequest, GenesisResponse, HealthResponse, ListApiKeysResponse, QueryResult, RecordRefView, RecordView, SapixClientOptions, SaqlQuery, StrandRecordsResponse, WhereFilter, WriteResponse, } from "./types.js";
7
+ export type { StreamEvent, SubscribeOptions } from "./stream.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export { SapixClient } from "./client.js";
2
+ export { AdminClient } from "./admin.js";
3
+ export { CollectionClient, CollectionSnapshot } from "./collection.js";
4
+ export { SapixError, SapixRateLimitError } from "./errors.js";
5
+ export { openAgentStream, openGlobalStream } from "./stream.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,42 @@
1
+ /** A realtime write event pushed via SSE from SapixDB. */
2
+ export interface StreamEvent {
3
+ agent_id: string;
4
+ event_type: string;
5
+ record_id: string;
6
+ content_hash: string;
7
+ timestamp_ms: number;
8
+ payload?: unknown;
9
+ }
10
+ /** Options for SSE subscriptions. */
11
+ export interface SubscribeOptions {
12
+ /** HLC timestamp — the server replays records written after this before going live. */
13
+ since?: number;
14
+ /** Only emit events whose JSON payload contains this top-level field name. */
15
+ filter?: string;
16
+ }
17
+ /**
18
+ * Open an SSE stream for a single named agent.
19
+ *
20
+ * Returns an `EventSource`. Call `.close()` to unsubscribe.
21
+ *
22
+ * @example
23
+ * const es = client.subscribeAgent("orders", (ev) => {
24
+ * console.log(ev.record_id, ev.payload);
25
+ * });
26
+ * es.close();
27
+ */
28
+ export declare function openAgentStream(baseUrl: string, agentId: string, onEvent: (event: StreamEvent) => void, opts?: SubscribeOptions): EventSource;
29
+ /**
30
+ * Open an SSE stream for all agents on the node.
31
+ *
32
+ * Returns an `EventSource`. Call `.close()` to unsubscribe.
33
+ *
34
+ * @example
35
+ * const es = client.subscribeGlobal((ev) => {
36
+ * console.log(ev.agent_id, ev.record_id);
37
+ * }, { agents: ["orders", "payments"] });
38
+ */
39
+ export declare function openGlobalStream(baseUrl: string, onEvent: (event: StreamEvent) => void, opts?: SubscribeOptions & {
40
+ agents?: string[];
41
+ }): EventSource;
42
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,uFAAuF;IACvF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EACrC,IAAI,CAAC,EAAE,gBAAgB,GACtB,WAAW,CAcb;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EACrC,IAAI,CAAC,EAAE,gBAAgB,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC9C,WAAW,CAeb"}
package/dist/stream.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Open an SSE stream for a single named agent.
3
+ *
4
+ * Returns an `EventSource`. Call `.close()` to unsubscribe.
5
+ *
6
+ * @example
7
+ * const es = client.subscribeAgent("orders", (ev) => {
8
+ * console.log(ev.record_id, ev.payload);
9
+ * });
10
+ * es.close();
11
+ */
12
+ export function openAgentStream(baseUrl, agentId, onEvent, opts) {
13
+ const params = new URLSearchParams();
14
+ if (opts?.since != null)
15
+ params.set("since", String(opts.since));
16
+ if (opts?.filter)
17
+ params.set("filter", opts.filter);
18
+ const qs = params.size > 0 ? `?${params}` : "";
19
+ const es = new EventSource(`${baseUrl}/v1/agents/${agentId}/stream${qs}`);
20
+ es.addEventListener("record.written", (e) => {
21
+ try {
22
+ onEvent(JSON.parse(e.data));
23
+ }
24
+ catch {
25
+ // ignore malformed events
26
+ }
27
+ });
28
+ return es;
29
+ }
30
+ /**
31
+ * Open an SSE stream for all agents on the node.
32
+ *
33
+ * Returns an `EventSource`. Call `.close()` to unsubscribe.
34
+ *
35
+ * @example
36
+ * const es = client.subscribeGlobal((ev) => {
37
+ * console.log(ev.agent_id, ev.record_id);
38
+ * }, { agents: ["orders", "payments"] });
39
+ */
40
+ export function openGlobalStream(baseUrl, onEvent, opts) {
41
+ const params = new URLSearchParams();
42
+ if (opts?.agents?.length)
43
+ params.set("agents", opts.agents.join(","));
44
+ if (opts?.since != null)
45
+ params.set("since", String(opts.since));
46
+ if (opts?.filter)
47
+ params.set("filter", opts.filter);
48
+ const qs = params.size > 0 ? `?${params}` : "";
49
+ const es = new EventSource(`${baseUrl}/v1/stream${qs}`);
50
+ es.addEventListener("record.written", (e) => {
51
+ try {
52
+ onEvent(JSON.parse(e.data));
53
+ }
54
+ catch {
55
+ // ignore malformed events
56
+ }
57
+ });
58
+ return es;
59
+ }
60
+ //# sourceMappingURL=stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe,EACf,OAAe,EACf,OAAqC,EACrC,IAAuB;IAEvB,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,IAAI,IAAI,EAAE,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,OAAO,cAAc,OAAO,UAAU,EAAE,EAAE,CAAC,CAAC;IAC1E,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAQ,EAAE,EAAE;QACjD,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAE,CAAkB,CAAC,IAAI,CAAgB,CAAC,CAAC;QAC/D,CAAC;QAAC,MAAM,CAAC;YACP,0BAA0B;QAC5B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,OAAqC,EACrC,IAA+C;IAE/C,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,IAAI,IAAI,EAAE,MAAM,EAAE,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,IAAI,IAAI,EAAE,KAAK,IAAI,IAAI;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACjE,IAAI,IAAI,EAAE,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/C,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,GAAG,OAAO,aAAa,EAAE,EAAE,CAAC,CAAC;IACxD,EAAE,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAQ,EAAE,EAAE;QACjD,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAE,CAAkB,CAAC,IAAI,CAAgB,CAAC,CAAC;QAC/D,CAAC;QAAC,MAAM,CAAC;YACP,0BAA0B;QAC5B,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,195 @@
1
+ export interface GenesisRequest {
2
+ zone?: "immutable_core" | "protected" | "governed" | "free";
3
+ }
4
+ export interface GenesisResponse {
5
+ agent_id: string;
6
+ public_key_hex: string;
7
+ genesis_record_id: string;
8
+ chain_head_hex: string;
9
+ zone: string;
10
+ }
11
+ export interface AgentStatusResponse {
12
+ agent_id: string;
13
+ record_count: number;
14
+ chain_head: string;
15
+ schema_version: number;
16
+ zone: string;
17
+ caged: boolean;
18
+ }
19
+ export interface WriteRequest {
20
+ /** Base64-encoded payload bytes. */
21
+ payload_b64: string;
22
+ /** Block flag bits: GENESIS=1, TOMBSTONE=2, BLOB_REF=4. Default 0. */
23
+ flags?: number;
24
+ }
25
+ export interface WriteResponse {
26
+ record_id: string;
27
+ content_hash: string;
28
+ chain_head: string;
29
+ /** null = Codios not configured (open mode); true = Codios authorized. */
30
+ codios_verified: boolean | null;
31
+ /** "open" or "enforced" */
32
+ codios_mode: string;
33
+ codios_contract_id?: string;
34
+ }
35
+ export interface RecordView {
36
+ record_id: string;
37
+ content_hash: string;
38
+ parent_hash: string;
39
+ /** HLC timestamp packed as a u64. JSON number — safe to ~2^53 ms (~year 285,428). */
40
+ timestamp_hlc: number;
41
+ /** Wall-clock milliseconds since epoch extracted from the HLC. */
42
+ timestamp_ms: number;
43
+ /** Base64-encoded raw MessagePack payload bytes. */
44
+ payload_b64: string;
45
+ /**
46
+ * Payload decoded from MessagePack to a plain JSON value.
47
+ * `null` when the payload is raw binary (not a MessagePack map).
48
+ */
49
+ payload: Record<string, unknown> | null;
50
+ /** Block flag bits (bit0=GENESIS, bit1=TOMBSTONE, bit2=BLOB_REF, bit3=MUTATION). */
51
+ flags: number;
52
+ schema_version: number;
53
+ }
54
+ export interface ChainHeadResponse {
55
+ chain_head: string;
56
+ record_count: number;
57
+ }
58
+ export interface StrandRecordsResponse {
59
+ records: RecordView[];
60
+ total: number;
61
+ }
62
+ export interface WhereFilter {
63
+ field: string;
64
+ op: "eq" | "between";
65
+ value: unknown;
66
+ /** Upper bound for `between` queries. */
67
+ upper?: unknown;
68
+ }
69
+ export type SaqlQuery = {
70
+ type: "hash";
71
+ content_hash: string;
72
+ } | {
73
+ type: "time_range";
74
+ from_ts: number;
75
+ to_ts: number;
76
+ } | {
77
+ type: "latest";
78
+ limit?: number;
79
+ } | {
80
+ type: "chain_head";
81
+ } | {
82
+ type: "as_of";
83
+ timestamp_hlc: number;
84
+ limit?: number;
85
+ } | {
86
+ type: "scan";
87
+ limit?: number;
88
+ filter?: WhereFilter;
89
+ };
90
+ export interface QueryResult {
91
+ records: RecordView[];
92
+ }
93
+ export interface AddEdgeRequest {
94
+ src: string;
95
+ edge_type: string;
96
+ dst: string;
97
+ weight?: number;
98
+ }
99
+ export interface EdgeView {
100
+ src: string;
101
+ edge_type: string;
102
+ dst: string;
103
+ timestamp_hlc: number;
104
+ weight: number;
105
+ }
106
+ export interface AddRecordRefRequest {
107
+ src_agent: string;
108
+ src_content_hash: string;
109
+ edge_type: string;
110
+ dst_agent: string;
111
+ dst_content_hash: string;
112
+ }
113
+ export interface RecordRefView {
114
+ src_agent: string;
115
+ src_content_hash: string;
116
+ edge_type: string;
117
+ dst_agent: string;
118
+ dst_content_hash: string;
119
+ }
120
+ export interface ApiKeyView {
121
+ key_id: string;
122
+ /** First 14 characters of the key, e.g. ``sapix_sk_a3f9…`` */
123
+ key_prefix: string;
124
+ label: string;
125
+ scopes: string[];
126
+ created_at_ms: number;
127
+ /** undefined = permanent key */
128
+ expires_at_ms?: number;
129
+ revoked: boolean;
130
+ caller_id?: string;
131
+ /** undefined = unlimited */
132
+ rate_limit_rps?: number;
133
+ }
134
+ export interface CreateApiKeyRequest {
135
+ label: string;
136
+ scopes: string[];
137
+ /** Unix ms expiry. Omit for a permanent key. */
138
+ expires_at_ms?: number;
139
+ caller_id?: string;
140
+ rate_limit_rps?: number;
141
+ }
142
+ export interface CreateApiKeyResponse extends ApiKeyView {
143
+ /** The full secret key — shown exactly once. Save it immediately. */
144
+ key: string;
145
+ warning: string;
146
+ }
147
+ /**
148
+ * Partial update for an existing key.
149
+ * Only provided fields are changed.
150
+ * Set a nullable field to `null` to clear it (e.g. remove expiry).
151
+ */
152
+ export interface ApiKeyPatch {
153
+ label?: string;
154
+ scopes?: string[];
155
+ /** `null` = remove expiry (make permanent). */
156
+ expires_at_ms?: number | null;
157
+ /** `null` = remove caller identity override. */
158
+ caller_id?: string | null;
159
+ /** `null` = remove rate limit (unlimited). */
160
+ rate_limit_rps?: number | null;
161
+ }
162
+ export interface ApiKeyUsage {
163
+ key_id: string;
164
+ label: string;
165
+ request_count_since_restart: number;
166
+ /** undefined if the key has never been used since last restart. */
167
+ last_used_at_ms?: number;
168
+ }
169
+ export interface ListApiKeysResponse {
170
+ keys: ApiKeyView[];
171
+ total: number;
172
+ }
173
+ export interface HealthResponse {
174
+ status: "ok";
175
+ agent: string;
176
+ }
177
+ export interface SapixClientOptions {
178
+ /** sapix-agent base URL, e.g. "http://localhost:7475" */
179
+ baseUrl: string;
180
+ /**
181
+ * API key for SapixDB bearer-token authentication.
182
+ * When set, every request includes `Authorization: Bearer <apiKey>`.
183
+ */
184
+ apiKey?: string;
185
+ /**
186
+ * Caller identity forwarded to Codios as `caller_identity`.
187
+ * Sent as `X-Sapix-Caller: <callerId>`.
188
+ */
189
+ callerId?: string;
190
+ /** Request timeout in milliseconds. Default: 10_000. */
191
+ timeoutMs?: number;
192
+ /** Optional fetch override (useful for testing). Default: globalThis.fetch */
193
+ fetch?: typeof globalThis.fetch;
194
+ }
195
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;CAC7D;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB;AAID,MAAM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AAmB;IAClC,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,IAAI,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // ── Agent identity ─────────────────────────────────────────────────────────────
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,kFAAkF"}