@thingd/sdk 0.31.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/LICENSE +201 -0
- package/README.md +39 -0
- package/dist/client/http-thing-store.d.ts +41 -0
- package/dist/client/http-thing-store.d.ts.map +1 -0
- package/dist/client/http-thing-store.js +178 -0
- package/dist/client/in-memory-thing-store.d.ts +38 -0
- package/dist/client/in-memory-thing-store.d.ts.map +1 -0
- package/dist/client/in-memory-thing-store.js +270 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/thingd.d.ts +46 -0
- package/dist/client/thingd.d.ts.map +1 -0
- package/dist/client/thingd.js +115 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/mcp/audit.d.ts +27 -0
- package/dist/mcp/audit.d.ts.map +1 -0
- package/dist/mcp/audit.js +36 -0
- package/dist/mcp/config.d.ts +22 -0
- package/dist/mcp/config.d.ts.map +1 -0
- package/dist/mcp/config.js +52 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/result.d.ts +3 -0
- package/dist/mcp/result.d.ts.map +1 -0
- package/dist/mcp/result.js +10 -0
- package/dist/mcp/server.d.ts +19 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +51 -0
- package/dist/mcp/tools.d.ts +10 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +568 -0
- package/dist/memory/index.d.ts +36 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +86 -0
- package/dist/rest/helpers.d.ts +17 -0
- package/dist/rest/helpers.d.ts.map +1 -0
- package/dist/rest/helpers.js +55 -0
- package/dist/rest/index.d.ts +3 -0
- package/dist/rest/index.d.ts.map +1 -0
- package/dist/rest/index.js +2 -0
- package/dist/rest/server.d.ts +4 -0
- package/dist/rest/server.d.ts.map +1 -0
- package/dist/rest/server.js +317 -0
- package/dist/stores/cloud-thing-store.d.ts +49 -0
- package/dist/stores/cloud-thing-store.d.ts.map +1 -0
- package/dist/stores/cloud-thing-store.js +243 -0
- package/dist/stores/in-memory-thing-store.d.ts +44 -0
- package/dist/stores/in-memory-thing-store.d.ts.map +1 -0
- package/dist/stores/in-memory-thing-store.js +411 -0
- package/dist/stores/native-thing-store.d.ts +53 -0
- package/dist/stores/native-thing-store.d.ts.map +1 -0
- package/dist/stores/native-thing-store.js +312 -0
- package/dist/stores/remote-thing-store.d.ts +27 -0
- package/dist/stores/remote-thing-store.d.ts.map +1 -0
- package/dist/stores/remote-thing-store.js +131 -0
- package/dist/thingd.d.ts +48 -0
- package/dist/thingd.d.ts.map +1 -0
- package/dist/thingd.js +147 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types.d.ts +185 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/package.json +79 -0
package/dist/thingd.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { CloudThingStore } from "./stores/cloud-thing-store.js";
|
|
2
|
+
import { InMemoryThingStore } from "./stores/in-memory-thing-store.js";
|
|
3
|
+
import { NativeThingStore } from "./stores/native-thing-store.js";
|
|
4
|
+
export class ThingD {
|
|
5
|
+
path;
|
|
6
|
+
store;
|
|
7
|
+
static async open(pathOrConfig, options = {}) {
|
|
8
|
+
const resolvedOptions = resolveOpenOptions(pathOrConfig, options);
|
|
9
|
+
return new ThingD(resolvedOptions.path, await openStore(resolvedOptions.path, resolvedOptions));
|
|
10
|
+
}
|
|
11
|
+
constructor(path, store) {
|
|
12
|
+
this.path = path;
|
|
13
|
+
this.store = store;
|
|
14
|
+
}
|
|
15
|
+
put(collection, object) {
|
|
16
|
+
return this.store.put(collection, object);
|
|
17
|
+
}
|
|
18
|
+
get(collection, id) {
|
|
19
|
+
return this.store.get(collection, id);
|
|
20
|
+
}
|
|
21
|
+
delete(collection, id) {
|
|
22
|
+
return this.store.delete(collection, id);
|
|
23
|
+
}
|
|
24
|
+
listObjects(collection, options) {
|
|
25
|
+
return this.store.listObjects?.(collection, options) ?? Promise.resolve([]);
|
|
26
|
+
}
|
|
27
|
+
search(query, options = {}) {
|
|
28
|
+
return this.store.search(query, options);
|
|
29
|
+
}
|
|
30
|
+
async searchObjects(query, options = {}) {
|
|
31
|
+
const results = await this.search(query, options);
|
|
32
|
+
return results
|
|
33
|
+
.filter((r) => r.kind === "object")
|
|
34
|
+
.map((r) => r.value);
|
|
35
|
+
}
|
|
36
|
+
async putBatch(collection, objects) {
|
|
37
|
+
return (this.store.putBatch?.(collection, objects) ??
|
|
38
|
+
Promise.reject(new Error("Batch put not supported by this driver")));
|
|
39
|
+
}
|
|
40
|
+
async deleteBatch(collection, ids) {
|
|
41
|
+
return (this.store.deleteBatch?.(collection, ids) ??
|
|
42
|
+
Promise.reject(new Error("Batch delete not supported by this driver")));
|
|
43
|
+
}
|
|
44
|
+
events = {
|
|
45
|
+
append: (stream, event) => this.store.appendEvent(stream, event),
|
|
46
|
+
list: (stream, options) => this.store.listEvents(stream, options),
|
|
47
|
+
};
|
|
48
|
+
queue(name) {
|
|
49
|
+
return {
|
|
50
|
+
push: (payload, options) => this.store.pushJob(name, payload, options),
|
|
51
|
+
claim: (options) => this.store.claimJob(name, options),
|
|
52
|
+
ack: (jobId) => this.store.ackJob(name, jobId),
|
|
53
|
+
nack: (jobId, options) => this.store.nackJob(name, jobId, options),
|
|
54
|
+
list: () => this.store.listJobs(name),
|
|
55
|
+
dead: () => this.store.listDeadJobs(name),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
links = {
|
|
59
|
+
create: (fromRef, linkType, toRef, weight, metadataJson) => this.store.createLink?.(fromRef, linkType, toRef, weight, metadataJson) ??
|
|
60
|
+
Promise.reject(new Error("Graph links not supported by this driver")),
|
|
61
|
+
delete: (id) => this.store.deleteLink?.(id) ?? Promise.resolve(false),
|
|
62
|
+
get: (id) => this.store.getLink?.(id) ?? Promise.resolve(null),
|
|
63
|
+
neighbors: (reference, direction = "Both", options = {}) => this.store.getNeighbors?.(reference, direction, options) ?? Promise.resolve([]),
|
|
64
|
+
};
|
|
65
|
+
async close() {
|
|
66
|
+
await this.store.close?.();
|
|
67
|
+
}
|
|
68
|
+
async countObjects() {
|
|
69
|
+
return this.store.countObjects?.() ?? 0;
|
|
70
|
+
}
|
|
71
|
+
async countEvents() {
|
|
72
|
+
return this.store.countEvents?.() ?? 0;
|
|
73
|
+
}
|
|
74
|
+
async countActiveJobs() {
|
|
75
|
+
return this.store.countActiveJobs?.() ?? 0;
|
|
76
|
+
}
|
|
77
|
+
async countDeadJobs() {
|
|
78
|
+
return this.store.countDeadJobs?.() ?? 0;
|
|
79
|
+
}
|
|
80
|
+
async countLinks() {
|
|
81
|
+
return this.store.countLinks?.() ?? 0;
|
|
82
|
+
}
|
|
83
|
+
async listCollections() {
|
|
84
|
+
return this.store.listCollections?.() ?? [];
|
|
85
|
+
}
|
|
86
|
+
async listStreams() {
|
|
87
|
+
return this.store.listStreams?.() ?? [];
|
|
88
|
+
}
|
|
89
|
+
async listQueues() {
|
|
90
|
+
return this.store.listQueues?.() ?? [];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function resolveOpenOptions(pathOrConfig, options) {
|
|
94
|
+
const config = typeof pathOrConfig === "string"
|
|
95
|
+
? {
|
|
96
|
+
path: pathOrConfig,
|
|
97
|
+
}
|
|
98
|
+
: (pathOrConfig ?? {});
|
|
99
|
+
const path = config.url ?? config.path ?? process.env.THINGD_URL ?? ":memory:";
|
|
100
|
+
const driver = options.driver ?? config.driver ?? inferDriver(path);
|
|
101
|
+
return {
|
|
102
|
+
...config,
|
|
103
|
+
...options,
|
|
104
|
+
path,
|
|
105
|
+
driver,
|
|
106
|
+
authToken: options.authToken ??
|
|
107
|
+
config.authToken ??
|
|
108
|
+
config.apiKey ??
|
|
109
|
+
options.apiKey ??
|
|
110
|
+
process.env.THINGD_AUTH_TOKEN,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function inferDriver(path) {
|
|
114
|
+
if (isCloudPath(path)) {
|
|
115
|
+
return "cloud";
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
function isCloudPath(path) {
|
|
120
|
+
return path.startsWith("http://") || path.startsWith("https://") || path.startsWith("thingd://");
|
|
121
|
+
}
|
|
122
|
+
async function openStore(path, options) {
|
|
123
|
+
if (options.store) {
|
|
124
|
+
return options.store;
|
|
125
|
+
}
|
|
126
|
+
if (options.driver === "cloud") {
|
|
127
|
+
return CloudThingStore.open({
|
|
128
|
+
url: path,
|
|
129
|
+
authToken: options.authToken,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const hasNative = await NativeThingStore.isAvailable();
|
|
133
|
+
if (options.driver === "native") {
|
|
134
|
+
if (!hasNative) {
|
|
135
|
+
throw new Error(`The native thingd driver is not available. Run "pnpm --filter thingd-native build" before using driver: "native".`);
|
|
136
|
+
}
|
|
137
|
+
return NativeThingStore.open(path);
|
|
138
|
+
}
|
|
139
|
+
// Auto-detect and promote file paths to native store when available, with a warning fallback to memory.
|
|
140
|
+
if (!options.driver && path !== ":memory:") {
|
|
141
|
+
if (hasNative) {
|
|
142
|
+
return NativeThingStore.open(path);
|
|
143
|
+
}
|
|
144
|
+
console.warn(`Warning: The native thingd driver is not available. Falling back to the temporary in-memory store. Data will not persist. Run "pnpm --filter @thingd/native build" or install "@thingd/native" to enable native persistence.`);
|
|
145
|
+
}
|
|
146
|
+
return new InMemoryThingStore();
|
|
147
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { Link, LinkDirection, LinkQueryOptions, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemoryQueue, MemorySearchOptions, MemorySearchResult, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueJobStatus, QueueNackOptions, SortBy, SortDirection, StoredMemoryEvent, StoredMemoryObject, ThingDConnection, ThingDeleteResult, ThingStore, } from "../types.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,GACX,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
export type MemoryObject = {
|
|
2
|
+
id: string;
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
};
|
|
5
|
+
export type StoredMemoryObject = MemoryObject & {
|
|
6
|
+
collection: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
updatedAt: string;
|
|
9
|
+
version: number;
|
|
10
|
+
};
|
|
11
|
+
export type MemoryEvent = {
|
|
12
|
+
type: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
};
|
|
16
|
+
export type StoredMemoryEvent = MemoryEvent & {
|
|
17
|
+
id: string;
|
|
18
|
+
stream: string;
|
|
19
|
+
sequence: number;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
};
|
|
22
|
+
export type QueueJobPayload = Record<string, unknown>;
|
|
23
|
+
export type QueueJobStatus = "ready" | "leased" | "completed" | "dead";
|
|
24
|
+
export type QueueJob = {
|
|
25
|
+
id: string;
|
|
26
|
+
queue: string;
|
|
27
|
+
payload: QueueJobPayload;
|
|
28
|
+
status: QueueJobStatus;
|
|
29
|
+
attempts: number;
|
|
30
|
+
maxAttempts: number;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
availableAt: string;
|
|
33
|
+
leasedAt?: string;
|
|
34
|
+
leaseExpiresAt?: string;
|
|
35
|
+
completedAt?: string;
|
|
36
|
+
deadAt?: string;
|
|
37
|
+
lastError?: string;
|
|
38
|
+
};
|
|
39
|
+
export type QueueJobOptions = {
|
|
40
|
+
idempotencyKey?: string;
|
|
41
|
+
maxAttempts?: number;
|
|
42
|
+
delayMs?: number;
|
|
43
|
+
};
|
|
44
|
+
export type QueueClaimOptions = {
|
|
45
|
+
leaseMs?: number;
|
|
46
|
+
};
|
|
47
|
+
export type QueueNackOptions = {
|
|
48
|
+
delayMs?: number;
|
|
49
|
+
error?: string;
|
|
50
|
+
};
|
|
51
|
+
export type QueueJobResult = {
|
|
52
|
+
ok: true;
|
|
53
|
+
job: QueueJob;
|
|
54
|
+
} | {
|
|
55
|
+
ok: false;
|
|
56
|
+
reason: "not_found" | "not_leased" | "terminal";
|
|
57
|
+
};
|
|
58
|
+
export type ThingDeleteResult = {
|
|
59
|
+
deleted: boolean;
|
|
60
|
+
};
|
|
61
|
+
export type MemorySearchOptions = {
|
|
62
|
+
collections?: string[];
|
|
63
|
+
limit?: number;
|
|
64
|
+
filter?: Record<string, unknown>;
|
|
65
|
+
};
|
|
66
|
+
export type MemorySearchResult = {
|
|
67
|
+
kind: "object";
|
|
68
|
+
id: string;
|
|
69
|
+
collection: string;
|
|
70
|
+
score: number;
|
|
71
|
+
value: StoredMemoryObject;
|
|
72
|
+
} | {
|
|
73
|
+
kind: "event";
|
|
74
|
+
id: string;
|
|
75
|
+
stream: string;
|
|
76
|
+
score: number;
|
|
77
|
+
value: StoredMemoryEvent;
|
|
78
|
+
};
|
|
79
|
+
export type LinkDirection = "Outgoing" | "Incoming" | "Both";
|
|
80
|
+
export type LinkQueryOptions = {
|
|
81
|
+
linkType?: string;
|
|
82
|
+
limit?: number;
|
|
83
|
+
};
|
|
84
|
+
export type Link = {
|
|
85
|
+
id: string;
|
|
86
|
+
fromRef: string;
|
|
87
|
+
linkType: string;
|
|
88
|
+
toRef: string;
|
|
89
|
+
weight?: number;
|
|
90
|
+
metadataJson: string;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
};
|
|
93
|
+
export type MemoryQueue = {
|
|
94
|
+
push(payload: QueueJobPayload, options?: QueueJobOptions): Promise<QueueJob>;
|
|
95
|
+
claim(options?: QueueClaimOptions): Promise<QueueJob | null>;
|
|
96
|
+
ack(jobId: string): Promise<QueueJobResult>;
|
|
97
|
+
nack(jobId: string, options?: QueueNackOptions): Promise<QueueJobResult>;
|
|
98
|
+
list(): Promise<QueueJob[]>;
|
|
99
|
+
dead(): Promise<QueueJob[]>;
|
|
100
|
+
};
|
|
101
|
+
export type ListEventsOptions = {
|
|
102
|
+
fromSequence?: number;
|
|
103
|
+
limit?: number;
|
|
104
|
+
};
|
|
105
|
+
export type SortDirection = "asc" | "desc";
|
|
106
|
+
export type SortBy = {
|
|
107
|
+
field: "id" | "collection" | "created_at" | "updated_at" | "version";
|
|
108
|
+
direction?: SortDirection;
|
|
109
|
+
};
|
|
110
|
+
export type ListObjectsOptions = {
|
|
111
|
+
limit?: number;
|
|
112
|
+
offset?: number;
|
|
113
|
+
filter?: Record<string, unknown>;
|
|
114
|
+
sortBy?: SortBy;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Typed interface for a thingd database connection returned by `ThingD.open()`.
|
|
118
|
+
* Consumers can use this for type-safe dependency injection instead of `any`:
|
|
119
|
+
*
|
|
120
|
+
* ```ts
|
|
121
|
+
* import type { ThingDConnection } from "@thingd/sdk";
|
|
122
|
+
* private readonly db: ThingDConnection;
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export interface ThingDConnection {
|
|
126
|
+
put(collection: string, object: MemoryObject): Promise<StoredMemoryObject>;
|
|
127
|
+
get<T = StoredMemoryObject>(collection: string, id: string): Promise<T | null>;
|
|
128
|
+
delete(collection: string, id: string): Promise<ThingDeleteResult>;
|
|
129
|
+
listObjects<T = StoredMemoryObject>(collection: string, options?: ListObjectsOptions): Promise<T[]>;
|
|
130
|
+
search(query: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
|
|
131
|
+
searchObjects<T = StoredMemoryObject>(query: string, options?: MemorySearchOptions): Promise<T[]>;
|
|
132
|
+
putBatch(collection: string, objects: MemoryObject[]): Promise<StoredMemoryObject[]>;
|
|
133
|
+
deleteBatch(collection: string, ids: string[]): Promise<number>;
|
|
134
|
+
readonly events: {
|
|
135
|
+
append(stream: string, event: MemoryEvent): Promise<StoredMemoryEvent>;
|
|
136
|
+
list<T = StoredMemoryEvent>(stream?: string, options?: ListEventsOptions): Promise<T[]>;
|
|
137
|
+
};
|
|
138
|
+
queue(name: string): MemoryQueue;
|
|
139
|
+
close(): Promise<void>;
|
|
140
|
+
countObjects(): Promise<number>;
|
|
141
|
+
countEvents(): Promise<number>;
|
|
142
|
+
countActiveJobs(): Promise<number>;
|
|
143
|
+
countDeadJobs(): Promise<number>;
|
|
144
|
+
countLinks(): Promise<number>;
|
|
145
|
+
readonly links: {
|
|
146
|
+
create(fromRef: string, linkType: string, toRef: string, weight?: number, metadataJson?: string): Promise<Link>;
|
|
147
|
+
delete(id: string): Promise<boolean>;
|
|
148
|
+
get(id: string): Promise<Link | null>;
|
|
149
|
+
neighbors(reference: string, direction?: LinkDirection, options?: LinkQueryOptions): Promise<Link[]>;
|
|
150
|
+
};
|
|
151
|
+
listCollections(): Promise<string[]>;
|
|
152
|
+
listStreams(): Promise<string[]>;
|
|
153
|
+
listQueues(): Promise<string[]>;
|
|
154
|
+
}
|
|
155
|
+
export interface ThingStore {
|
|
156
|
+
put(collection: string, object: MemoryObject): Promise<StoredMemoryObject>;
|
|
157
|
+
get<T = StoredMemoryObject>(collection: string, id: string): Promise<T | null>;
|
|
158
|
+
delete(collection: string, id: string): Promise<ThingDeleteResult>;
|
|
159
|
+
listObjects<T = StoredMemoryObject>(collection: string, options?: ListObjectsOptions): Promise<T[]>;
|
|
160
|
+
appendEvent(stream: string, event: MemoryEvent): Promise<StoredMemoryEvent>;
|
|
161
|
+
listEvents<T = StoredMemoryEvent>(stream?: string, options?: ListEventsOptions): Promise<T[]>;
|
|
162
|
+
pushJob(queue: string, payload: QueueJobPayload, options?: QueueJobOptions): Promise<QueueJob>;
|
|
163
|
+
claimJob(queue: string, options?: QueueClaimOptions): Promise<QueueJob | null>;
|
|
164
|
+
ackJob(queue: string, jobId: string): Promise<QueueJobResult>;
|
|
165
|
+
nackJob(queue: string, jobId: string, options?: QueueNackOptions): Promise<QueueJobResult>;
|
|
166
|
+
listJobs(queue: string): Promise<QueueJob[]>;
|
|
167
|
+
listDeadJobs(queue: string): Promise<QueueJob[]>;
|
|
168
|
+
search(query: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
|
|
169
|
+
countObjects?(): Promise<number>;
|
|
170
|
+
countEvents?(): Promise<number>;
|
|
171
|
+
countActiveJobs?(): Promise<number>;
|
|
172
|
+
countDeadJobs?(): Promise<number>;
|
|
173
|
+
countLinks?(): Promise<number>;
|
|
174
|
+
createLink?(fromRef: string, linkType: string, toRef: string, weight?: number, metadataJson?: string): Promise<Link>;
|
|
175
|
+
deleteLink?(id: string): Promise<boolean>;
|
|
176
|
+
getLink?(id: string): Promise<Link | null>;
|
|
177
|
+
getNeighbors?(reference: string, direction: LinkDirection, options: LinkQueryOptions): Promise<Link[]>;
|
|
178
|
+
putBatch?(collection: string, objects: MemoryObject[]): Promise<StoredMemoryObject[]>;
|
|
179
|
+
deleteBatch?(collection: string, ids: string[]): Promise<number>;
|
|
180
|
+
listCollections?(): Promise<string[]>;
|
|
181
|
+
listStreams?(): Promise<string[]>;
|
|
182
|
+
listQueues?(): Promise<string[]>;
|
|
183
|
+
close?(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,eAAe,CAAC;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;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AAY,CAAC,CACX,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACnB,QAAQ,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtF,WAAW,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjE,eAAe,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtC,WAAW,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAClC,UAAU,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW,WAAW,CAAC"}
|
package/dist/version.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thingd/sdk",
|
|
3
|
+
"version": "0.31.0",
|
|
4
|
+
"description": "A fast object-first data engine for applications and AI agents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"author": "Sayan Mohsin",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"homepage": "https://github.com/sayanmohsin/thingd#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/sayanmohsin/thingd/issues"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ai",
|
|
14
|
+
"agents",
|
|
15
|
+
"mcp",
|
|
16
|
+
"mcp-server",
|
|
17
|
+
"mcp-database",
|
|
18
|
+
"memory",
|
|
19
|
+
"queue",
|
|
20
|
+
"durable-queues",
|
|
21
|
+
"sqlite",
|
|
22
|
+
"rust",
|
|
23
|
+
"local-first",
|
|
24
|
+
"data-engine",
|
|
25
|
+
"object-store",
|
|
26
|
+
"embedded-database",
|
|
27
|
+
"ai-memory",
|
|
28
|
+
"local-database",
|
|
29
|
+
"full-text-search",
|
|
30
|
+
"event-stream"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/sayanmohsin/thingd.git"
|
|
36
|
+
},
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"import": "./dist/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./client": {
|
|
45
|
+
"types": "./dist/client/index.d.ts",
|
|
46
|
+
"import": "./dist/client/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./memory": {
|
|
49
|
+
"types": "./dist/memory/index.d.ts",
|
|
50
|
+
"import": "./dist/memory/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./types": {
|
|
53
|
+
"types": "./dist/types/index.d.ts",
|
|
54
|
+
"import": "./dist/types/index.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"files": [
|
|
58
|
+
"dist",
|
|
59
|
+
"README.md"
|
|
60
|
+
],
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
63
|
+
"zod": "^4.4.3"
|
|
64
|
+
},
|
|
65
|
+
"optionalDependencies": {
|
|
66
|
+
"@thingd/native": "0.31.0"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": ">=24.0.0"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public",
|
|
73
|
+
"provenance": true
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "tsc -p tsconfig.json",
|
|
77
|
+
"test": "pnpm build && node --test test/*.test.mjs"
|
|
78
|
+
}
|
|
79
|
+
}
|