@thingd/sdk 0.72.0 → 0.74.2

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.
Files changed (77) hide show
  1. package/dist/__type-tests__/exports.d.ts +178 -0
  2. package/dist/__type-tests__/exports.d.ts.map +1 -0
  3. package/dist/__type-tests__/exports.js +87 -0
  4. package/dist/client/http-thing-store.d.ts +55 -0
  5. package/dist/client/http-thing-store.d.ts.map +1 -0
  6. package/dist/client/http-thing-store.js +233 -0
  7. package/dist/client/in-memory-thing-store.d.ts +41 -0
  8. package/dist/client/in-memory-thing-store.d.ts.map +1 -0
  9. package/dist/client/in-memory-thing-store.js +292 -0
  10. package/dist/client/index.d.ts +5 -0
  11. package/dist/client/index.d.ts.map +1 -0
  12. package/dist/client/index.js +3 -0
  13. package/dist/client/thingd.d.ts +24 -0
  14. package/dist/client/thingd.d.ts.map +1 -0
  15. package/dist/client/thingd.js +27 -0
  16. package/dist/constants.d.ts +4 -0
  17. package/dist/constants.d.ts.map +1 -0
  18. package/dist/constants.js +3 -0
  19. package/dist/index.d.ts +13 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +11 -0
  22. package/dist/mcp/audit.d.ts +27 -0
  23. package/dist/mcp/audit.d.ts.map +1 -0
  24. package/dist/mcp/audit.js +36 -0
  25. package/dist/mcp/config.d.ts +22 -0
  26. package/dist/mcp/config.d.ts.map +1 -0
  27. package/dist/mcp/config.js +52 -0
  28. package/dist/mcp/index.d.ts +6 -0
  29. package/dist/mcp/index.d.ts.map +1 -0
  30. package/dist/mcp/index.js +5 -0
  31. package/dist/mcp/result.d.ts +3 -0
  32. package/dist/mcp/result.d.ts.map +1 -0
  33. package/dist/mcp/result.js +10 -0
  34. package/dist/mcp/server.d.ts +19 -0
  35. package/dist/mcp/server.d.ts.map +1 -0
  36. package/dist/mcp/server.js +51 -0
  37. package/dist/mcp/tools.d.ts +10 -0
  38. package/dist/mcp/tools.d.ts.map +1 -0
  39. package/dist/mcp/tools.js +1033 -0
  40. package/dist/memory/index.d.ts +7 -0
  41. package/dist/memory/index.d.ts.map +1 -0
  42. package/dist/memory/index.js +7 -0
  43. package/dist/rest/helpers.d.ts +17 -0
  44. package/dist/rest/helpers.d.ts.map +1 -0
  45. package/dist/rest/helpers.js +60 -0
  46. package/dist/rest/index.d.ts +3 -0
  47. package/dist/rest/index.d.ts.map +1 -0
  48. package/dist/rest/index.js +2 -0
  49. package/dist/rest/server.d.ts +4 -0
  50. package/dist/rest/server.d.ts.map +1 -0
  51. package/dist/rest/server.js +472 -0
  52. package/dist/scheduler.d.ts +28 -0
  53. package/dist/scheduler.d.ts.map +1 -0
  54. package/dist/scheduler.js +451 -0
  55. package/dist/stores/cloud-thing-store.d.ts +60 -0
  56. package/dist/stores/cloud-thing-store.d.ts.map +1 -0
  57. package/dist/stores/cloud-thing-store.js +396 -0
  58. package/dist/stores/in-memory-thing-store.d.ts +59 -0
  59. package/dist/stores/in-memory-thing-store.d.ts.map +1 -0
  60. package/dist/stores/in-memory-thing-store.js +709 -0
  61. package/dist/stores/native-thing-store.d.ts +62 -0
  62. package/dist/stores/native-thing-store.d.ts.map +1 -0
  63. package/dist/stores/native-thing-store.js +374 -0
  64. package/dist/thingd.d.ts +84 -0
  65. package/dist/thingd.d.ts.map +1 -0
  66. package/dist/thingd.js +236 -0
  67. package/dist/types/index.d.ts +2 -0
  68. package/dist/types/index.d.ts.map +1 -0
  69. package/dist/types/index.js +1 -0
  70. package/dist/types.d.ts +448 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/types.js +1 -0
  73. package/dist/version.d.ts +6 -0
  74. package/dist/version.d.ts.map +1 -0
  75. package/dist/version.js +5 -0
  76. package/package.json +8 -7
  77. package/LICENSE +0 -201
@@ -0,0 +1,62 @@
1
+ import type { AggregateOptions, AggregateResult, CollectionSchema, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemorySearchOptions, MemorySearchResult, PutOptions, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueNackOptions, SchemaOptions, StoredMemoryEvent, StoredMemoryObject, ThingDeleteResult, ThingStore, TimeSeriesOptions, TimeSeriesResult, VectorSearchHit, VectorSearchOptions } from "../types.js";
2
+ export declare class NativeThingStore implements ThingStore {
3
+ private readonly binding;
4
+ static open(path: string): Promise<NativeThingStore>;
5
+ static isAvailable(): Promise<boolean>;
6
+ static getLoadedPath(): Promise<string | undefined>;
7
+ private constructor();
8
+ close(): Promise<void>;
9
+ put(collection: string, object: MemoryObject, options?: PutOptions): Promise<StoredMemoryObject>;
10
+ get<T = StoredMemoryObject>(collection: string, id: string): Promise<T | null>;
11
+ getBatch<T = StoredMemoryObject>(collection: string, ids: string[]): Promise<(T | null)[]>;
12
+ delete(collection: string, id: string): Promise<ThingDeleteResult>;
13
+ listObjects<T = StoredMemoryObject>(collection: string, options?: ListObjectsOptions): Promise<T[]>;
14
+ appendEvent(stream: string, event: MemoryEvent): Promise<StoredMemoryEvent>;
15
+ listEvents<T = StoredMemoryEvent>(stream?: string, options?: ListEventsOptions): Promise<T[]>;
16
+ pushJob(queue: string, payload: QueueJobPayload, options?: QueueJobOptions): Promise<QueueJob>;
17
+ claimJob(queue: string, options?: QueueClaimOptions): Promise<QueueJob | null>;
18
+ ackJob(queue: string, jobId: string): Promise<QueueJobResult>;
19
+ nackJob(queue: string, jobId: string, options?: QueueNackOptions): Promise<QueueJobResult>;
20
+ listJobs(queue: string): Promise<QueueJob[]>;
21
+ listDeadJobs(queue: string): Promise<QueueJob[]>;
22
+ vectorSearch(collection: string, queryVector: number[], options?: VectorSearchOptions): Promise<VectorSearchHit[]>;
23
+ search(query: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
24
+ putObjectsBatch(objects: Array<{
25
+ collection: string;
26
+ id: string;
27
+ body: string;
28
+ }>): Promise<StoredMemoryObject[]>;
29
+ appendEventsBatch(events: Array<{
30
+ stream: string;
31
+ eventType: string;
32
+ body: string;
33
+ }>): Promise<StoredMemoryEvent[]>;
34
+ pushJobsBatch(jobs: Array<{
35
+ queue: string;
36
+ id: string;
37
+ body: string;
38
+ maxAttempts: number;
39
+ delayMs: number;
40
+ }>): Promise<QueueJob[]>;
41
+ countObjects(): Promise<number>;
42
+ countObjectsInCollection(collection: string): Promise<number>;
43
+ countEvents(): Promise<number>;
44
+ countActiveJobs(): Promise<number>;
45
+ countDeadJobs(): Promise<number>;
46
+ countLinks(): Promise<number>;
47
+ putBatch(collection: string, objects: MemoryObject[]): Promise<StoredMemoryObject[]>;
48
+ deleteBatch(collection: string, ids: string[]): Promise<number>;
49
+ createLink(fromRef: string, linkType: string, toRef: string, weight?: number, metadataJson?: string): Promise<import("../types.js").Link>;
50
+ deleteLink(id: string): Promise<boolean>;
51
+ getLink(id: string): Promise<import("../types.js").Link | null>;
52
+ getNeighbors(reference: string, direction: import("../types.js").LinkDirection, options: import("../types.js").LinkQueryOptions): Promise<import("../types.js").Link[]>;
53
+ listCollections(): Promise<string[]>;
54
+ listStreams(): Promise<string[]>;
55
+ listQueues(): Promise<string[]>;
56
+ createIndex(collection: string, field: string): Promise<void>;
57
+ listIndexes(): Promise<Array<[string, string]>>;
58
+ aggregate(collection: string, options: AggregateOptions): Promise<AggregateResult>;
59
+ timeseries(collection: string, options: TimeSeriesOptions): Promise<TimeSeriesResult>;
60
+ schema(collection?: string, options?: SchemaOptions): Promise<CollectionSchema[]>;
61
+ }
62
+ //# sourceMappingURL=native-thing-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-thing-store.d.ts","sourceRoot":"","sources":["../../src/stores/native-thing-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,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,CAAC,CAE7C;IAEK,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC,CAGpE;IAEK,YAAY,CAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,OAAO,aAAa,EAAE,aAAa,EAC9C,OAAO,EAAE,OAAO,aAAa,EAAE,gBAAgB,GAC9C,OAAO,CAAC,OAAO,aAAa,EAAE,IAAI,EAAE,CAAC,CAIvC;IAEK,eAAe,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAEzC;IAEK,WAAW,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAErC;IAEK,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAEpC;IAEK,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAElE;IAEK,WAAW,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAEpD;IAEK,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAWvF;IAEK,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAa1F;IAEK,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAGtF;CACF"}
@@ -0,0 +1,374 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { createRequire } from "node:module";
3
+ const DEFAULT_LEASE_MS = 30_000;
4
+ const NATIVE_PACKAGE_NAME = "@thingd/native";
5
+ export class NativeThingStore {
6
+ binding;
7
+ static async open(path) {
8
+ const native = await loadNativeModule();
9
+ return new NativeThingStore(native.NativeThingStore.open(path));
10
+ }
11
+ static async isAvailable() {
12
+ try {
13
+ await loadNativeModule();
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ static async getLoadedPath() {
21
+ try {
22
+ const native = await loadNativeModule();
23
+ return native.loadedPath;
24
+ }
25
+ catch {
26
+ return undefined;
27
+ }
28
+ }
29
+ constructor(binding) {
30
+ this.binding = binding;
31
+ }
32
+ async close() {
33
+ this.binding.close();
34
+ }
35
+ async put(collection, object, options) {
36
+ const record = parseJson(this.binding.putObjectJson(collection, object.id, JSON.stringify(object), options?.expectedVersion));
37
+ return objectFromNative(record);
38
+ }
39
+ async get(collection, id) {
40
+ const record = this.binding.getObjectJson(collection, id);
41
+ return record ? objectFromNative(parseJson(record)) : null;
42
+ }
43
+ async getBatch(collection, ids) {
44
+ return parseJson(this.binding.getObjectsBatchJson(collection, ids)).map((record) => (record ? objectFromNative(record) : null));
45
+ }
46
+ async delete(collection, id) {
47
+ return {
48
+ deleted: this.binding.deleteObject(collection, id),
49
+ };
50
+ }
51
+ async listObjects(collection, options) {
52
+ const collectionsJson = JSON.stringify([collection]);
53
+ const filterJson = serializeFilter(options?.filter);
54
+ const sortField = options?.sortBy?.field;
55
+ const sortDirection = options?.sortBy?.direction;
56
+ return parseJson(await this.binding.listObjectsJson(collectionsJson, filterJson, options?.limit, options?.offset, sortField, sortDirection)).map(objectFromNative);
57
+ }
58
+ async appendEvent(stream, event) {
59
+ const record = parseJson(this.binding.appendEventJson(stream, JSON.stringify(event)));
60
+ return eventFromNative(record);
61
+ }
62
+ async listEvents(stream, options) {
63
+ return parseJson(this.binding.listEventsJson(stream, options?.fromSequence, options?.limit, options?.since)).map(eventFromNative);
64
+ }
65
+ async pushJob(queue, payload, options = {}) {
66
+ const record = parseJson(this.binding.pushJobJson(queue, options.idempotencyKey ?? randomUUID(), JSON.stringify(payload), options.maxAttempts ?? 3, options.delayMs ?? 0, options.priority));
67
+ return jobFromNative(record);
68
+ }
69
+ async claimJob(queue, options = {}) {
70
+ const record = this.binding.claimJobJson(queue, options.leaseMs ?? DEFAULT_LEASE_MS);
71
+ return record ? jobFromNative(parseJson(record)) : null;
72
+ }
73
+ async ackJob(queue, jobId) {
74
+ return resultFromNative(parseJson(this.binding.ackJobJson(queue, jobId)));
75
+ }
76
+ async nackJob(queue, jobId, options = {}) {
77
+ const result = resultFromNative(parseJson(this.binding.nackJobJson(queue, jobId, options.delayMs ?? 0, options.error)));
78
+ return result;
79
+ }
80
+ async listJobs(queue) {
81
+ return parseJson(this.binding.listJobsJson(queue)).map(jobFromNative);
82
+ }
83
+ async listDeadJobs(queue) {
84
+ return parseJson(this.binding.listDeadJobsJson(queue)).map(jobFromNative);
85
+ }
86
+ async vectorSearch(collection, queryVector, options = {}) {
87
+ const filterJson = serializeFilter(options.filter);
88
+ const hits = parseJson(this.binding.vectorSearchJson(collection, JSON.stringify(queryVector), options.topK, filterJson));
89
+ return hits.map((hit) => {
90
+ const value = parseJson(hit.value.body);
91
+ const storedObject = {
92
+ ...value,
93
+ id: hit.value.key.id,
94
+ collection: hit.value.key.collection,
95
+ createdAt: hit.value.createdAt,
96
+ updatedAt: hit.value.updatedAt,
97
+ version: hit.value.version,
98
+ };
99
+ if (hit.value.vector) {
100
+ storedObject.vector = hit.value.vector;
101
+ }
102
+ return { id: hit.id, score: hit.score, value: storedObject };
103
+ });
104
+ }
105
+ async search(query, options = {}) {
106
+ const collectionsJson = options.collections ? JSON.stringify(options.collections) : undefined;
107
+ const filterJson = serializeFilter(options.filter);
108
+ const hits = parseJson(this.binding.searchJson(query, collectionsJson, options.limit, filterJson));
109
+ return hits.map((hit) => {
110
+ if (hit.kind === "object") {
111
+ const objectRecord = {
112
+ collection: hit.collection,
113
+ id: hit.id,
114
+ body: hit.body,
115
+ version: hit.version ?? 0,
116
+ createdAt: hit.createdAt ?? "",
117
+ updatedAt: hit.updatedAt ?? "",
118
+ };
119
+ const storedObject = objectFromNative(objectRecord);
120
+ return {
121
+ kind: "object",
122
+ id: hit.id,
123
+ collection: hit.collection,
124
+ score: hit.score,
125
+ value: storedObject,
126
+ };
127
+ }
128
+ else {
129
+ const eventRecord = {
130
+ stream: hit.collection,
131
+ eventType: hit.eventType ?? "event",
132
+ body: hit.body,
133
+ sequence: Number(hit.id) || 0,
134
+ createdAt: hit.createdAt ?? "",
135
+ };
136
+ const storedEvent = eventFromNative(eventRecord);
137
+ return {
138
+ kind: "event",
139
+ id: hit.id,
140
+ stream: hit.collection,
141
+ score: hit.score,
142
+ value: storedEvent,
143
+ };
144
+ }
145
+ });
146
+ }
147
+ async putObjectsBatch(objects) {
148
+ return parseJson(this.binding.putObjectsBatchJson(JSON.stringify(objects))).map(objectFromNative);
149
+ }
150
+ async appendEventsBatch(events) {
151
+ return parseJson(this.binding.appendEventsBatchJson(JSON.stringify(events))).map(eventFromNative);
152
+ }
153
+ async pushJobsBatch(jobs) {
154
+ return parseJson(this.binding.pushJobsBatchJson(JSON.stringify(jobs))).map(jobFromNative);
155
+ }
156
+ async countObjects() {
157
+ return this.binding.countObjectsJson();
158
+ }
159
+ async countObjectsInCollection(collection) {
160
+ return this.binding.countObjectsInCollectionJson(collection);
161
+ }
162
+ async countEvents() {
163
+ return this.binding.countEventsJson();
164
+ }
165
+ async countActiveJobs() {
166
+ return this.binding.countActiveJobsJson();
167
+ }
168
+ async countDeadJobs() {
169
+ return this.binding.countDeadJobsJson();
170
+ }
171
+ async countLinks() {
172
+ return this.binding.countLinksJson();
173
+ }
174
+ async putBatch(collection, objects) {
175
+ const inputs = objects.map((obj) => ({ collection, id: obj.id, body: JSON.stringify(obj) }));
176
+ return parseJson(this.binding.putObjectsBatchJson(JSON.stringify(inputs))).map(objectFromNative);
177
+ }
178
+ async deleteBatch(collection, ids) {
179
+ const keys = ids.map((id) => [collection, id]);
180
+ return this.binding.deleteObjectsBatchJson(JSON.stringify(keys));
181
+ }
182
+ async createLink(fromRef, linkType, toRef, weight, metadataJson) {
183
+ return linkFromNative(parseJson(this.binding.createLinkJson(fromRef, linkType, toRef, weight, metadataJson)));
184
+ }
185
+ async deleteLink(id) {
186
+ return this.binding.deleteLink(id);
187
+ }
188
+ async getLink(id) {
189
+ const record = this.binding.getLinkJson(id);
190
+ return record ? linkFromNative(parseJson(record)) : null;
191
+ }
192
+ async getNeighbors(reference, direction, options) {
193
+ return parseJson(this.binding.getNeighborsJson(reference, direction, options.linkType, options.limit)).map(linkFromNative);
194
+ }
195
+ async listCollections() {
196
+ return parseJson(await this.binding.listCollectionsJson());
197
+ }
198
+ async listStreams() {
199
+ return parseJson(await this.binding.listStreamsJson());
200
+ }
201
+ async listQueues() {
202
+ return parseJson(await this.binding.listQueuesJson());
203
+ }
204
+ async createIndex(collection, field) {
205
+ this.binding.createIndexJson(collection, field);
206
+ }
207
+ async listIndexes() {
208
+ return parseJson(this.binding.listIndexesJson());
209
+ }
210
+ async aggregate(collection, options) {
211
+ const filterJson = serializeFilter(options.filter);
212
+ return parseJson(this.binding.aggregateJson(collection, options.function, options.field, options.groupBy, filterJson));
213
+ }
214
+ async timeseries(collection, options) {
215
+ const filterJson = serializeFilter(options.filter);
216
+ return parseJson(this.binding.timeseriesJson(collection, options.function, options.field, options.bucket, options.from, options.to, filterJson));
217
+ }
218
+ async schema(collection, options) {
219
+ const sampleSize = options?.sampleSize ?? 50;
220
+ return parseJson(this.binding.schemaJson(collection, sampleSize));
221
+ }
222
+ }
223
+ async function loadNativeModule() {
224
+ const customPath = process.env.THINGD_NATIVE_PATH;
225
+ if (customPath) {
226
+ try {
227
+ const require = createRequire(import.meta.url);
228
+ const binding = require(customPath);
229
+ return {
230
+ NativeThingStore: binding.NativeThingStore,
231
+ loadedPath: customPath,
232
+ };
233
+ }
234
+ catch (error) {
235
+ throw new Error(`Failed to load native store from THINGD_NATIVE_PATH="${customPath}": ${error instanceof Error ? error.message : String(error)}`);
236
+ }
237
+ }
238
+ // Try direct import (resolves via node_modules when published, or workspace link locally)
239
+ try {
240
+ const mod = (await import(NATIVE_PACKAGE_NAME));
241
+ return {
242
+ NativeThingStore: mod.NativeThingStore,
243
+ loadedPath: mod.loadedPath,
244
+ };
245
+ }
246
+ catch (importError) {
247
+ // Fallback: scan workspace-relative paths for local development
248
+ try {
249
+ const { existsSync } = await import("node:fs");
250
+ const { join, dirname } = await import("node:path");
251
+ const { fileURLToPath } = await import("node:url");
252
+ const __dirname = dirname(fileURLToPath(import.meta.url));
253
+ const platform = process.platform;
254
+ const arch = process.arch;
255
+ const candidates = [
256
+ // monorepo: packages/thingd/dist/stores/ -> ../../../../thingd-native/
257
+ join(__dirname, "../../../../thingd-native/dist/thingd_native.node"),
258
+ join(__dirname, "../../../../thingd-native/prebuilds", `${platform}-${arch}`, "thingd_native.node"),
259
+ // global install: sibling to thingd-cli in node_modules
260
+ join(__dirname, "../../../../../../thingd-native/dist/thingd_native.node"),
261
+ join(__dirname, "../../../../../../thingd-native/prebuilds", `${platform}-${arch}`, "thingd_native.node"),
262
+ ];
263
+ for (const candidate of candidates) {
264
+ if (existsSync(candidate)) {
265
+ try {
266
+ const require = createRequire(import.meta.url);
267
+ const binding = require(candidate);
268
+ if (binding?.NativeThingStore) {
269
+ return {
270
+ NativeThingStore: binding.NativeThingStore,
271
+ loadedPath: candidate,
272
+ };
273
+ }
274
+ }
275
+ catch {
276
+ // candidate failed to load, try next
277
+ }
278
+ }
279
+ }
280
+ }
281
+ catch {
282
+ // fallback resolution failed
283
+ }
284
+ throw new Error(`The native thingd driver is not available. Install @thingd/native with "npm install @thingd/native" or set THINGD_NATIVE_PATH. For monorepo development: "pnpm --filter thingd-native build". ${formatUnknownError(importError)}`);
285
+ }
286
+ }
287
+ function objectFromNative(record) {
288
+ const value = parseJson(record.body);
289
+ return {
290
+ ...value,
291
+ id: record.id,
292
+ collection: record.collection,
293
+ createdAt: record.createdAt ?? new Date().toISOString(),
294
+ updatedAt: record.updatedAt ?? new Date().toISOString(),
295
+ version: record.version,
296
+ };
297
+ }
298
+ function eventFromNative(record) {
299
+ const value = parseJson(record.body);
300
+ return {
301
+ ...value,
302
+ type: value.type ?? record.eventType,
303
+ id: String(record.sequence),
304
+ sequence: record.sequence,
305
+ stream: record.stream,
306
+ createdAt: record.createdAt ?? new Date().toISOString(),
307
+ };
308
+ }
309
+ function jobFromNative(record) {
310
+ return {
311
+ id: record.id,
312
+ queue: record.queue,
313
+ payload: parseJson(record.body),
314
+ status: record.status,
315
+ attempts: record.attempts,
316
+ maxAttempts: record.maxAttempts,
317
+ createdAt: record.createdAt ?? new Date().toISOString(),
318
+ availableAt: timestampToIso(record.availableAtMs),
319
+ leasedAt: optionalTimestampToIso(record.leasedAtMs),
320
+ leaseExpiresAt: optionalTimestampToIso(record.leaseExpiresAtMs),
321
+ completedAt: optionalTimestampToIso(record.completedAtMs),
322
+ deadAt: optionalTimestampToIso(record.deadAtMs),
323
+ lastError: record.lastError || undefined,
324
+ priority: record.priority ?? 0,
325
+ };
326
+ }
327
+ function linkFromNative(record) {
328
+ return {
329
+ ...record,
330
+ createdAt: record.createdAt ?? new Date().toISOString(),
331
+ };
332
+ }
333
+ function resultFromNative(result) {
334
+ if (!result.ok) {
335
+ return result;
336
+ }
337
+ return {
338
+ ok: true,
339
+ job: jobFromNative(result.job),
340
+ };
341
+ }
342
+ function parseJson(json) {
343
+ return JSON.parse(json);
344
+ }
345
+ function timestampToIso(value) {
346
+ if (value <= 0) {
347
+ return new Date().toISOString();
348
+ }
349
+ return new Date(value).toISOString();
350
+ }
351
+ function optionalTimestampToIso(value) {
352
+ return value === undefined ? undefined : timestampToIso(value);
353
+ }
354
+ function formatUnknownError(error) {
355
+ if (error instanceof Error) {
356
+ return `Original error: ${error.message}`;
357
+ }
358
+ return `Original error: ${String(error)}`;
359
+ }
360
+ function serializeFilter(filter) {
361
+ if (!filter) {
362
+ return undefined;
363
+ }
364
+ const cleaned = {};
365
+ for (const [key, value] of Object.entries(filter)) {
366
+ if (value !== undefined) {
367
+ cleaned[key] = value;
368
+ }
369
+ }
370
+ if (Object.keys(cleaned).length === 0) {
371
+ return undefined;
372
+ }
373
+ return JSON.stringify(cleaned);
374
+ }
@@ -0,0 +1,84 @@
1
+ import type { AggregateOptions, AggregateResult, CollectionSchema, ConnectorAuth, ConnectorSchema, ConnectorSyncOptions, ConnectorSyncResult, ListEventsOptions, ListObjectsOptions, LocalThingDConnection, MemoryEvent, MemoryObject, MemoryQueue, MemorySearchOptions, MemorySearchResult, NlqOptions, NlqResult, PutOptions, SchedulerFacade, SchemaOptions, StoredMemoryEvent, StoredMemoryObject, ThingDeleteResult, ThingStore, TimeSeriesOptions, TimeSeriesResult, VectorSearchHit, VectorSearchOptions } from "./types.js";
2
+ export type ThingDDriver = "memory" | "native" | "cloud";
3
+ export type ThingDOpenOptions = {
4
+ driver?: ThingDDriver;
5
+ store?: ThingStore;
6
+ authToken?: string;
7
+ /** Alias for authToken. If both are set, authToken takes precedence. */
8
+ apiKey?: string;
9
+ /** Cloud instance slug for multi-instance routing. Passed as X-Instance-Slug header. */
10
+ instanceSlug?: string;
11
+ };
12
+ export type ThingDOpenConfig = ThingDOpenOptions & {
13
+ path?: string;
14
+ url?: string;
15
+ };
16
+ export declare class ThingD implements LocalThingDConnection {
17
+ readonly path: string;
18
+ private readonly store;
19
+ static open(pathOrConfig?: string | ThingDOpenConfig, options?: ThingDOpenOptions): Promise<ThingD>;
20
+ readonly scheduler: SchedulerFacade;
21
+ private constructor();
22
+ put(collection: string, object: MemoryObject, options?: PutOptions): Promise<StoredMemoryObject>;
23
+ get<T = StoredMemoryObject>(collection: string, id: string): Promise<T | null>;
24
+ delete(collection: string, id: string): Promise<ThingDeleteResult>;
25
+ listObjects<T = StoredMemoryObject>(collection: string, options?: ListObjectsOptions): Promise<T[]>;
26
+ search(query: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
27
+ searchObjects<T = StoredMemoryObject>(query: string, options?: MemorySearchOptions): Promise<T[]>;
28
+ vectorSearch(collection: string, queryVector: number[], options?: VectorSearchOptions): Promise<VectorSearchHit[]>;
29
+ putBatch(collection: string, objects: MemoryObject[]): Promise<StoredMemoryObject[]>;
30
+ deleteBatch(collection: string, ids: string[]): Promise<number>;
31
+ getBatch<T = StoredMemoryObject>(collection: string, ids: string[]): Promise<(T | null)[]>;
32
+ readonly events: {
33
+ append: (stream: string, event: MemoryEvent) => Promise<StoredMemoryEvent>;
34
+ list: <T = StoredMemoryEvent>(stream?: string, options?: ListEventsOptions) => Promise<T[]>;
35
+ };
36
+ queue(name: string): MemoryQueue;
37
+ readonly links: {
38
+ create: (fromRef: string, linkType: string, toRef: string, weight?: number, metadataJson?: string) => Promise<import("./types.js").Link>;
39
+ delete: (id: string) => Promise<boolean>;
40
+ get: (id: string) => Promise<import("./types.js").Link | null>;
41
+ neighbors: (reference: string, direction?: import("./types.js").LinkDirection, options?: import("./types.js").LinkQueryOptions) => Promise<import("./types.js").Link[]>;
42
+ };
43
+ readonly aggregate: {
44
+ count: (collection: string, options?: Omit<AggregateOptions, "function">) => Promise<AggregateResult>;
45
+ sum: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
46
+ avg: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
47
+ min: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
48
+ max: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
49
+ };
50
+ timeseries(collection: string, options: TimeSeriesOptions): Promise<TimeSeriesResult>;
51
+ schema(collection?: string, options?: SchemaOptions): Promise<CollectionSchema[]>;
52
+ readonly nlq: {
53
+ query: (question: string, options?: NlqOptions) => Promise<NlqResult>;
54
+ };
55
+ close(): Promise<void>;
56
+ backupTo(path: string): void;
57
+ walCheckpoint(): import("./types.js").WalCheckpointResult;
58
+ countObjects(): Promise<number>;
59
+ countObjectsInCollection(collection: string): Promise<number>;
60
+ countEvents(): Promise<number>;
61
+ countActiveJobs(): Promise<number>;
62
+ countDeadJobs(): Promise<number>;
63
+ countLinks(): Promise<number>;
64
+ listCollections(): Promise<string[]>;
65
+ listStreams(): Promise<string[]>;
66
+ listQueues(): Promise<string[]>;
67
+ /** Create a functional index on a JSON body field for a collection. */
68
+ createIndex(collection: string, field: string): Promise<void>;
69
+ /** List all custom functional indexes. */
70
+ listIndexes(): Promise<Array<[string, string]>>;
71
+ /** List available connector types. Requires sidecar/HTTP store (returns [] for in-memory/native). */
72
+ listConnectors(): Promise<string[]>;
73
+ /**
74
+ * Discover the schema of an external table or file source.
75
+ * Requires sidecar/HTTP store — throws on in-memory/native stores.
76
+ */
77
+ discoverConnectorSchema(type: string, query: string, auth?: ConnectorAuth): Promise<ConnectorSchema>;
78
+ /**
79
+ * Import data from an external source into a thingd collection.
80
+ * Requires sidecar/HTTP store — throws on in-memory/native stores.
81
+ */
82
+ connectorSync(type: string, options: ConnectorSyncOptions): Promise<ConnectorSyncResult>;
83
+ }
84
+ //# sourceMappingURL=thingd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"thingd.d.ts","sourceRoot":"","sources":["../src/thingd.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,UAAU,EAKV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,UAAU,CAAC;I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