@thingd/client 0.67.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.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # @thingd/client
2
+
3
+ Zero-dependency HTTP client for thingd — works in **browsers**, Cloudflare Workers, AWS Lambda, Bun, Deno, and Node.js 18+.
4
+
5
+ ```ts
6
+ import { ThingdClient } from "@thingd/client";
7
+
8
+ const client = new ThingdClient({
9
+ url: "https://api.thingd.cloud",
10
+ authToken: "sk-...",
11
+ });
12
+
13
+ await client.put("notes", { id: "1", text: "Hello world" });
14
+ const note = await client.get("notes", "1");
15
+ ```
16
+
17
+ ## Why this package?
18
+
19
+ `@thingd/client` is a **pure fetch-based** client with zero runtime dependencies (~5KB). Use it when you need to call the thingd REST API from environments where Node.js packages aren't available or desirable.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install @thingd/client
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ Connect to any thingd instance — local sidecar, Docker, or thingd.cloud:
30
+
31
+ ```ts
32
+ const client = new ThingdClient({
33
+ url: "http://localhost:8757", // local sidecar
34
+ // url: "https://api.thingd.cloud", // thingd.cloud
35
+ authToken: "your-api-key",
36
+ });
37
+ ```
38
+
39
+ ### Objects
40
+
41
+ ```ts
42
+ await client.put("users", { id: "user-1", name: "Alice" });
43
+ const user = await client.get("users", "user-1");
44
+ const deleted = await client.delete("users", "user-1");
45
+ const users = await client.listObjects("users", {
46
+ filter: { role: "admin" },
47
+ sortBy: { field: "created_at", direction: "desc" },
48
+ limit: 10,
49
+ });
50
+ ```
51
+
52
+ ### Search
53
+
54
+ ```ts
55
+ const results = await client.search("alice", {
56
+ collections: ["users", "notes"],
57
+ limit: 5,
58
+ });
59
+ ```
60
+
61
+ ### Events
62
+
63
+ ```ts
64
+ await client.events.append("audit", {
65
+ type: "user.login",
66
+ text: "Alice logged in",
67
+ });
68
+ const events = await client.events.list("audit", { limit: 10 });
69
+ ```
70
+
71
+ ### Queues
72
+
73
+ ```ts
74
+ await client.queue("email").push(
75
+ { to: "alice@example.com" },
76
+ { idempotencyKey: "email:user-1", maxAttempts: 3 }
77
+ );
78
+
79
+ const job = await client.queue("email").claim({ leaseMs: 30_000 });
80
+ if (job) {
81
+ await client.queue("email").ack(job.id);
82
+ }
83
+ ```
84
+
85
+ ### Links
86
+
87
+ ```ts
88
+ await client.links.create("users/alice", "authored", "notes/1");
89
+ const neighbors = await client.links.neighbors("users/alice", "Outgoing");
90
+ ```
91
+
92
+ ### Aggregation
93
+
94
+ ```ts
95
+ const count = await client.aggregate.count("sales", {
96
+ groupBy: "region",
97
+ });
98
+ const revenue = await client.aggregate.sum("sales", "amount");
99
+ ```
100
+
101
+ ### NLQ (Natural Language Query)
102
+
103
+ ```ts
104
+ const result = await client.nlq.query("What were total sales by region?");
105
+ ```
106
+
107
+ ## API
108
+
109
+ | Method | Description |
110
+ |--------|-------------|
111
+ | `put(collection, object)` | Create or replace an object |
112
+ | `get(collection, id)` | Get an object by ID |
113
+ | `delete(collection, id)` | Delete an object |
114
+ | `listObjects(collection, opts)` | List/filter/sort objects |
115
+ | `search(query, opts)` | Full-text search |
116
+ | `events.append(stream, event)` | Append an event |
117
+ | `events.list(stream?, opts)` | List events |
118
+ | `queue(name).push(payload, opts)` | Push a queue job |
119
+ | `queue(name).claim(opts)` | Claim a job |
120
+ | `queue(name).ack(jobId)` | Acknowledge a job |
121
+ | `queue(name).nack(jobId, opts)` | Nack a job |
122
+ | `links.create(from, type, to)` | Create a graph link |
123
+ | `links.neighbors(ref, dir)` | Get linked references |
124
+ | `aggregate.count/sum/avg/min/max` | Aggregation queries |
125
+ | `timeseries(collection, opts)` | Time-bucketed aggregation |
126
+ | `schema(collection?)` | Reflect collection schema |
127
+ | `nlq.query(question)` | Natural language query |
128
+ | `listCollections()` | List all collections |
129
+ | `listStreams()` | List all event streams |
130
+ | `listQueues()` | List all queues |
131
+ | `close()` | Clean up |
132
+
133
+ ## thingd.cloud
134
+
135
+ Connect to thingd Cloud using a project-scoped API key:
136
+
137
+ ```ts
138
+ const client = new ThingdClient({
139
+ url: "https://api.thingd.cloud",
140
+ authToken: "md_live_xxx",
141
+ });
142
+ ```
143
+
144
+ ## License
145
+
146
+ Apache-2.0
@@ -0,0 +1,82 @@
1
+ import type { AggregateOptions, AggregateResult, CollectionSchema, Link, LinkDirection, LinkQueryOptions, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemoryQueue, MemorySearchOptions, MemorySearchResult, NlqOptions, NlqResult, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueNackOptions, SchemaOptions, StoredMemoryEvent, StoredMemoryObject, ThingDeleteResult, TimeSeriesOptions, TimeSeriesResult, VectorSearchHit, VectorSearchOptions } from "./types.js";
2
+ export type ThingdClientOptions = {
3
+ url: string;
4
+ authToken?: string;
5
+ };
6
+ /**
7
+ * Zero-dependency HTTP client for thingd REST API.
8
+ *
9
+ * Works in any runtime with `fetch()` — browsers, Cloudflare Workers,
10
+ * AWS Lambda, Bun, Deno, Node.js 18+.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const client = new ThingdClient({
15
+ * url: "https://api.thingd.cloud",
16
+ * authToken: "sk-...",
17
+ * });
18
+ * await client.put("notes", { id: "1", text: "hello" });
19
+ * ```
20
+ */
21
+ export declare class ThingdClient {
22
+ private readonly options;
23
+ private readonly base;
24
+ constructor(options: ThingdClientOptions);
25
+ private get token();
26
+ private request;
27
+ put(collection: string, object: MemoryObject): Promise<StoredMemoryObject>;
28
+ get<T = StoredMemoryObject>(collection: string, id: string): Promise<T | null>;
29
+ delete(collection: string, id: string): Promise<ThingDeleteResult>;
30
+ listObjects<T = StoredMemoryObject>(collection: string, options?: ListObjectsOptions): Promise<T[]>;
31
+ putBatch(collection: string, objects: MemoryObject[]): Promise<StoredMemoryObject[]>;
32
+ deleteBatch(collection: string, ids: string[]): Promise<number>;
33
+ search(query: string, options?: MemorySearchOptions): Promise<MemorySearchResult[]>;
34
+ vectorSearch(collection: string, queryVector: number[], options?: VectorSearchOptions): Promise<VectorSearchHit[]>;
35
+ appendEvent(stream: string, event: MemoryEvent): Promise<StoredMemoryEvent>;
36
+ listEvents<T = StoredMemoryEvent>(stream?: string, options?: ListEventsOptions): Promise<T[]>;
37
+ readonly events: {
38
+ append: (stream: string, event: MemoryEvent) => Promise<StoredMemoryEvent>;
39
+ list: <T = StoredMemoryEvent>(stream?: string, options?: ListEventsOptions) => Promise<T[]>;
40
+ };
41
+ pushJob(queue: string, payload: QueueJobPayload, options?: QueueJobOptions): Promise<QueueJob>;
42
+ claimJob(queue: string, options?: QueueClaimOptions): Promise<QueueJob | null>;
43
+ ackJob(queue: string, jobId: string): Promise<QueueJobResult>;
44
+ nackJob(queue: string, jobId: string, nackOptions?: QueueNackOptions): Promise<QueueJobResult>;
45
+ listJobs(queue: string): Promise<QueueJob[]>;
46
+ listDeadJobs(queue: string): Promise<QueueJob[]>;
47
+ queue(name: string): MemoryQueue;
48
+ createLink(fromRef: string, linkType: string, toRef: string, weight?: number, metadataJson?: string): Promise<Link>;
49
+ deleteLink(id: string): Promise<boolean>;
50
+ getLink(id: string): Promise<Link | null>;
51
+ getNeighbors(reference: string, direction?: LinkDirection, options?: LinkQueryOptions): Promise<Link[]>;
52
+ readonly links: {
53
+ create: (fromRef: string, linkType: string, toRef: string, weight?: number, metadataJson?: string) => Promise<Link>;
54
+ delete: (id: string) => Promise<boolean>;
55
+ get: (id: string) => Promise<Link | null>;
56
+ neighbors: (reference: string, direction?: LinkDirection, options?: LinkQueryOptions) => Promise<Link[]>;
57
+ };
58
+ countObjects(): Promise<number>;
59
+ countEvents(): Promise<number>;
60
+ countActiveJobs(): Promise<number>;
61
+ countDeadJobs(): Promise<number>;
62
+ countLinks(): Promise<number>;
63
+ listCollections(): Promise<string[]>;
64
+ listStreams(): Promise<string[]>;
65
+ listQueues(): Promise<string[]>;
66
+ private sendAggregateRequest;
67
+ readonly aggregate: {
68
+ count: (collection: string, options?: Omit<AggregateOptions, "function">) => Promise<AggregateResult>;
69
+ sum: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
70
+ avg: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
71
+ min: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
72
+ max: (collection: string, field: string, options?: Omit<AggregateOptions, "function" | "field">) => Promise<AggregateResult>;
73
+ };
74
+ timeseries(collection: string, options: TimeSeriesOptions): Promise<TimeSeriesResult>;
75
+ schema(collection?: string, _options?: SchemaOptions): Promise<CollectionSchema[]>;
76
+ nlqQuery(question: string, options?: NlqOptions): Promise<NlqResult>;
77
+ readonly nlq: {
78
+ query: (question: string, options?: NlqOptions) => Promise<NlqResult>;
79
+ };
80
+ close(): Promise<void>;
81
+ }
82
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,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Ae,CAAC;QAG3B,GAAG,eACW,MAAM,SACX,MAAM,YACJ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAAC,KACpD,OAAO,CAAC,eAAe,CAAC;QAG3B,GAAG,eACW,MAAM,SACX,MAAM,YACJ,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAAC,KACpD,OAAO,CAAC,eAAe,CAAC;MAE3B;IAEI,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAK1F;IAIK,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAKvF;IAIK,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAEzE;IAED,QAAQ,CAAC,GAAG;QACV,KAAK,aAAa,MAAM,YAAY,UAAU;MAC9C;IAII,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;CAChC"}
package/dist/client.js ADDED
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Zero-dependency HTTP client for thingd REST API.
3
+ *
4
+ * Works in any runtime with `fetch()` — browsers, Cloudflare Workers,
5
+ * AWS Lambda, Bun, Deno, Node.js 18+.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const client = new ThingdClient({
10
+ * url: "https://api.thingd.cloud",
11
+ * authToken: "sk-...",
12
+ * });
13
+ * await client.put("notes", { id: "1", text: "hello" });
14
+ * ```
15
+ */
16
+ export class ThingdClient {
17
+ options;
18
+ base;
19
+ constructor(options) {
20
+ this.options = options;
21
+ const base = options.url.replace(/\/+$/, "");
22
+ this.base = base.endsWith("/v1") ? base : `${base}/v1`;
23
+ }
24
+ get token() {
25
+ return this.options.authToken;
26
+ }
27
+ async request(method, path, body) {
28
+ const headers = {};
29
+ if (body) {
30
+ headers["content-type"] = "application/json";
31
+ }
32
+ if (this.token) {
33
+ headers.authorization = `Bearer ${this.token}`;
34
+ }
35
+ const res = await fetch(`${this.base}${path}`, {
36
+ method,
37
+ headers,
38
+ body: body ? JSON.stringify(body) : undefined,
39
+ });
40
+ const json = await res.json();
41
+ if (!res.ok) {
42
+ const msg = json?.error?.message ?? `HTTP ${res.status}`;
43
+ throw new Error(msg);
44
+ }
45
+ return json.data;
46
+ }
47
+ // ── Objects ──────────────────────────────────────────
48
+ async put(collection, object) {
49
+ return this.request("PUT", `/objects/${encodeURIComponent(collection)}/${encodeURIComponent(object.id)}`, object);
50
+ }
51
+ async get(collection, id) {
52
+ try {
53
+ return await this.request("GET", `/objects/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`);
54
+ }
55
+ catch (err) {
56
+ if (err instanceof Error && err.message.includes("404")) {
57
+ return null;
58
+ }
59
+ throw err;
60
+ }
61
+ }
62
+ async delete(collection, id) {
63
+ return this.request("DELETE", `/objects/${encodeURIComponent(collection)}/${encodeURIComponent(id)}`);
64
+ }
65
+ async listObjects(collection, options) {
66
+ const params = new URLSearchParams({ collection });
67
+ if (options?.limit) {
68
+ params.set("limit", String(options.limit));
69
+ }
70
+ if (options?.offset) {
71
+ params.set("offset", String(options.offset));
72
+ }
73
+ if (options?.filter) {
74
+ for (const [k, v] of Object.entries(options.filter)) {
75
+ params.set(`filter.${k}`, String(v));
76
+ }
77
+ }
78
+ if (options?.sortBy) {
79
+ params.set("sortBy", options.sortBy.field);
80
+ if (options.sortBy.direction) {
81
+ params.set("sortDir", options.sortBy.direction);
82
+ }
83
+ }
84
+ return this.request("GET", `/objects?${params}`);
85
+ }
86
+ async putBatch(collection, objects) {
87
+ return this.request("PUT", `/objects/batch?collection=${encodeURIComponent(collection)}`, objects);
88
+ }
89
+ async deleteBatch(collection, ids) {
90
+ const result = await this.request("DELETE", `/objects/batch?collection=${encodeURIComponent(collection)}`, ids);
91
+ return result.deleted;
92
+ }
93
+ // ── Search ───────────────────────────────────────────
94
+ async search(query, options = {}) {
95
+ return this.request("POST", "/search", { query, ...options });
96
+ }
97
+ async vectorSearch(collection, queryVector, options = {}) {
98
+ return this.request("POST", "/search/vector", {
99
+ collection,
100
+ vector: queryVector,
101
+ topK: options.topK,
102
+ filter: options.filter,
103
+ });
104
+ }
105
+ // ── Events ───────────────────────────────────────────
106
+ async appendEvent(stream, event) {
107
+ return this.request("POST", `/events/${encodeURIComponent(stream)}`, event);
108
+ }
109
+ async listEvents(stream, options) {
110
+ const params = new URLSearchParams();
111
+ if (stream) {
112
+ params.set("stream", stream);
113
+ }
114
+ if (options?.fromSequence) {
115
+ params.set("fromSequence", String(options.fromSequence));
116
+ }
117
+ if (options?.limit) {
118
+ params.set("limit", String(options.limit));
119
+ }
120
+ return this.request("GET", `/events?${params}`);
121
+ }
122
+ events = {
123
+ append: (stream, event) => this.appendEvent(stream, event),
124
+ list: (stream, options) => this.listEvents(stream, options),
125
+ };
126
+ // ── Queues ───────────────────────────────────────────
127
+ async pushJob(queue, payload, options = {}) {
128
+ return this.request("POST", `/queues/${encodeURIComponent(queue)}/push`, {
129
+ payload,
130
+ ...options,
131
+ });
132
+ }
133
+ async claimJob(queue, options = {}) {
134
+ return this.request("POST", `/queues/${encodeURIComponent(queue)}/claim`, options);
135
+ }
136
+ async ackJob(queue, jobId) {
137
+ return this.request("POST", `/queues/${encodeURIComponent(queue)}/ack`, {
138
+ jobId,
139
+ });
140
+ }
141
+ async nackJob(queue, jobId, nackOptions = {}) {
142
+ return this.request("POST", `/queues/${encodeURIComponent(queue)}/nack`, {
143
+ jobId,
144
+ ...nackOptions,
145
+ });
146
+ }
147
+ async listJobs(queue) {
148
+ return this.request("GET", `/queues/${encodeURIComponent(queue)}/jobs`);
149
+ }
150
+ async listDeadJobs(queue) {
151
+ return this.request("GET", `/queues/${encodeURIComponent(queue)}/dead`);
152
+ }
153
+ queue(name) {
154
+ return {
155
+ push: (payload, options) => this.pushJob(name, payload, options),
156
+ claim: (options) => this.claimJob(name, options),
157
+ ack: (jobId) => this.ackJob(name, jobId),
158
+ nack: (jobId, opts) => this.nackJob(name, jobId, opts),
159
+ list: () => this.listJobs(name),
160
+ dead: () => this.listDeadJobs(name),
161
+ };
162
+ }
163
+ // ── Links ────────────────────────────────────────────
164
+ async createLink(fromRef, linkType, toRef, weight, metadataJson) {
165
+ return this.request("POST", "/links", {
166
+ fromRef,
167
+ linkType,
168
+ toRef,
169
+ weight,
170
+ metadataJson,
171
+ });
172
+ }
173
+ async deleteLink(id) {
174
+ const result = await this.request("DELETE", `/links/${encodeURIComponent(id)}`);
175
+ return result.deleted;
176
+ }
177
+ async getLink(id) {
178
+ try {
179
+ return await this.request("GET", `/links/${encodeURIComponent(id)}`);
180
+ }
181
+ catch (err) {
182
+ if (err instanceof Error && err.message.includes("404")) {
183
+ return null;
184
+ }
185
+ throw err;
186
+ }
187
+ }
188
+ async getNeighbors(reference, direction = "Both", options = {}) {
189
+ const params = new URLSearchParams({ reference, direction });
190
+ if (options.linkType) {
191
+ params.set("linkType", options.linkType);
192
+ }
193
+ if (options.limit) {
194
+ params.set("limit", String(options.limit));
195
+ }
196
+ return this.request("GET", `/links?${params}`);
197
+ }
198
+ links = {
199
+ create: (fromRef, linkType, toRef, weight, metadataJson) => this.createLink(fromRef, linkType, toRef, weight, metadataJson),
200
+ delete: (id) => this.deleteLink(id),
201
+ get: (id) => this.getLink(id),
202
+ neighbors: (reference, direction, options) => this.getNeighbors(reference, direction, options),
203
+ };
204
+ // ── Counts ───────────────────────────────────────────
205
+ async countObjects() {
206
+ const result = await this.request("GET", "/counts/objects");
207
+ return result.count;
208
+ }
209
+ async countEvents() {
210
+ const result = await this.request("GET", "/counts/events");
211
+ return result.count;
212
+ }
213
+ async countActiveJobs() {
214
+ return 0;
215
+ }
216
+ async countDeadJobs() {
217
+ return 0;
218
+ }
219
+ async countLinks() {
220
+ const result = await this.request("GET", "/counts/links");
221
+ return result.count;
222
+ }
223
+ // ── Discovery ────────────────────────────────────────
224
+ async listCollections() {
225
+ return this.request("GET", "/collections");
226
+ }
227
+ async listStreams() {
228
+ return this.request("GET", "/streams");
229
+ }
230
+ async listQueues() {
231
+ return this.request("GET", "/queues");
232
+ }
233
+ // ── Aggregate ────────────────────────────────────────
234
+ async sendAggregateRequest(collection, options) {
235
+ return this.request("POST", "/aggregate", { collection, ...options });
236
+ }
237
+ aggregate = {
238
+ count: (collection, options = {}) => this.sendAggregateRequest(collection, { ...options, function: "count" }),
239
+ sum: (collection, field, options = {}) => this.sendAggregateRequest(collection, { ...options, function: "sum", field }),
240
+ avg: (collection, field, options = {}) => this.sendAggregateRequest(collection, { ...options, function: "avg", field }),
241
+ min: (collection, field, options = {}) => this.sendAggregateRequest(collection, { ...options, function: "min", field }),
242
+ max: (collection, field, options = {}) => this.sendAggregateRequest(collection, { ...options, function: "max", field }),
243
+ };
244
+ async timeseries(collection, options) {
245
+ return this.request("POST", "/aggregate/timeseries", {
246
+ collection,
247
+ ...options,
248
+ });
249
+ }
250
+ // ── Schema ───────────────────────────────────────────
251
+ async schema(collection, _options) {
252
+ if (collection) {
253
+ return this.request("GET", `/collections/${encodeURIComponent(collection)}/schema`);
254
+ }
255
+ return this.request("GET", "/collections/schema");
256
+ }
257
+ // ── NLQ ──────────────────────────────────────────────
258
+ async nlqQuery(question, options) {
259
+ return this.request("POST", "/nlq", { question, ...options });
260
+ }
261
+ nlq = {
262
+ query: (question, options) => this.nlqQuery(question, options),
263
+ };
264
+ // ── Lifecycle ────────────────────────────────────────
265
+ async close() { }
266
+ }
267
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,YAAY;IAGM,OAAO;IAFnB,IAAI,CAAS;IAE9B,YAA6B,OAA4B;uBAA5B,OAAO;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC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ED,wDAAwD;IAExD,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,OAAoB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAEQ,GAAG,GAAG;QACb,KAAK,EAAE,CAAC,QAAgB,EAAE,OAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;KACpF,CAAC;IAEF,wDAAwD;IAExD,KAAK,CAAC,KAAK,KAAmB,CAAC;CAChC"}
@@ -0,0 +1,3 @@
1
+ export { ThingdClient, type ThingdClientOptions } from "./client.js";
2
+ export type { AggregateOptions, AggregateResult, CollectionSchema, Link, LinkDirection, LinkQueryOptions, ListEventsOptions, ListObjectsOptions, MemoryEvent, MemoryObject, MemoryQueue, MemorySearchOptions, MemorySearchResult, NlqOptions, NlqResult, QueueClaimOptions, QueueJob, QueueJobOptions, QueueJobPayload, QueueJobResult, QueueJobStatus, QueueNackOptions, SchemaOptions, SortBy, StoredMemoryEvent, StoredMemoryObject, ThingDeleteResult, TimeSeriesOptions, TimeSeriesResult, } from "./types.js";
3
+ //# 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,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { ThingdClient } from "./client.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,178 @@
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 PutOptions = {
12
+ expectedVersion?: number;
13
+ };
14
+ export type ThingDeleteResult = {
15
+ deleted: boolean;
16
+ };
17
+ export type SortBy = {
18
+ field: "id" | "collection" | "created_at" | "updated_at" | "version";
19
+ direction?: "asc" | "desc";
20
+ };
21
+ export type ListObjectsOptions = {
22
+ limit?: number;
23
+ offset?: number;
24
+ filter?: Record<string, string>;
25
+ sortBy?: SortBy;
26
+ };
27
+ export type MemoryEvent = {
28
+ type: string;
29
+ text?: string;
30
+ [key: string]: unknown;
31
+ };
32
+ export type StoredMemoryEvent = MemoryEvent & {
33
+ id: string;
34
+ stream: string;
35
+ sequence: number;
36
+ createdAt: string;
37
+ };
38
+ export type ListEventsOptions = {
39
+ fromSequence?: number;
40
+ limit?: number;
41
+ since?: string;
42
+ };
43
+ export type QueueJobPayload = Record<string, unknown>;
44
+ export type QueueJobStatus = "ready" | "leased" | "completed" | "dead";
45
+ export type QueueJob = {
46
+ id: string;
47
+ queue: string;
48
+ payload: QueueJobPayload;
49
+ status: QueueJobStatus;
50
+ attempts: number;
51
+ maxAttempts: number;
52
+ createdAt: string;
53
+ availableAt: string;
54
+ leasedAt?: string;
55
+ leaseExpiresAt?: string;
56
+ completedAt?: string;
57
+ deadAt?: string;
58
+ lastError?: string;
59
+ };
60
+ export type QueueJobOptions = {
61
+ idempotencyKey?: string;
62
+ maxAttempts?: number;
63
+ delayMs?: number;
64
+ };
65
+ export type QueueClaimOptions = {
66
+ leaseMs?: number;
67
+ };
68
+ export type QueueNackOptions = {
69
+ delayMs?: number;
70
+ error?: string;
71
+ };
72
+ export type QueueJobResult = {
73
+ ok: true;
74
+ job: QueueJob;
75
+ } | {
76
+ ok: false;
77
+ reason: "not_found" | "not_leased" | "terminal";
78
+ };
79
+ export type MemoryQueue = {
80
+ push(payload: QueueJobPayload, options?: QueueJobOptions): Promise<QueueJob>;
81
+ claim(options?: QueueClaimOptions): Promise<QueueJob | null>;
82
+ ack(jobId: string): Promise<QueueJobResult>;
83
+ nack(jobId: string, options?: QueueNackOptions): Promise<QueueJobResult>;
84
+ list(): Promise<QueueJob[]>;
85
+ dead(): Promise<QueueJob[]>;
86
+ };
87
+ export type MemorySearchOptions = {
88
+ collections?: string[];
89
+ limit?: number;
90
+ filter?: Record<string, string>;
91
+ };
92
+ export type MemorySearchResult = {
93
+ kind: "object" | "event";
94
+ id: string;
95
+ collection?: string;
96
+ stream?: string;
97
+ score: number;
98
+ value: Record<string, unknown>;
99
+ };
100
+ export type VectorSearchOptions = {
101
+ topK?: number;
102
+ filter?: Record<string, unknown>;
103
+ };
104
+ export type VectorSearchHit = {
105
+ id: string;
106
+ score: number;
107
+ value: Record<string, unknown>;
108
+ };
109
+ export type LinkDirection = "Outgoing" | "Incoming" | "Both";
110
+ export type Link = {
111
+ id: string;
112
+ fromRef: string;
113
+ linkType: string;
114
+ toRef: string;
115
+ weight?: number;
116
+ metadataJson: string;
117
+ createdAt: string;
118
+ };
119
+ export type LinkQueryOptions = {
120
+ linkType?: string;
121
+ limit?: number;
122
+ };
123
+ export type AggregateOptions = {
124
+ function: "count" | "sum" | "avg" | "min" | "max";
125
+ field?: string;
126
+ groupBy?: string;
127
+ filter?: Record<string, string>;
128
+ };
129
+ export type AggregateGroupResult = {
130
+ key: string;
131
+ value: number;
132
+ };
133
+ export type AggregateResult = {
134
+ total: number;
135
+ groups: AggregateGroupResult[];
136
+ };
137
+ export type TimeBucket = "hour" | "day" | "week" | "month";
138
+ export type TimeSeriesOptions = {
139
+ function: "count" | "sum" | "avg" | "min" | "max";
140
+ field?: string;
141
+ bucket: TimeBucket;
142
+ from?: string;
143
+ to?: string;
144
+ filter?: Record<string, string>;
145
+ };
146
+ export type TimeSeriesBucket = {
147
+ label: string;
148
+ value: number;
149
+ };
150
+ export type TimeSeriesResult = {
151
+ buckets: TimeSeriesBucket[];
152
+ };
153
+ export type FieldSchema = {
154
+ name: string;
155
+ type: "string" | "number" | "boolean" | "date" | "null" | "unknown";
156
+ nullable: boolean;
157
+ sampleValues: unknown[];
158
+ };
159
+ export type CollectionSchema = {
160
+ name: string;
161
+ objectCount: number;
162
+ fields: FieldSchema[];
163
+ };
164
+ export type SchemaOptions = {
165
+ sampleSize?: number;
166
+ };
167
+ export type NlqOptions = {
168
+ collections?: string[];
169
+ model?: string;
170
+ maxTokens?: number;
171
+ };
172
+ export type NlqResult = {
173
+ answer: string;
174
+ sql?: string;
175
+ data?: Record<string, unknown>[];
176
+ error?: string;
177
+ };
178
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,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,UAAU,GAAG;IACvB,eAAe,CAAC,EAA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O,EAAE,gBAAgB,EAAE,CAAC;CAC7B,CAAC;AAIF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACpE,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAIF,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // ── Objects ──────────────────────────────────────────
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wDAAwD"}
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@thingd/client",
3
+ "version": "0.67.2",
4
+ "description": "Zero-dependency HTTP client for thingd — works in browsers, edge runtimes, Node.js, Bun, Deno",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "homepage": "https://engine.thingd.cloud",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sayanmohsin/thingd.git"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "require": "./dist/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "sideEffects": false,
26
+ "scripts": {
27
+ "build": "tsc",
28
+ "test": "node --test dist/test/*.test.js"
29
+ }
30
+ }