@moltendb-web/query 0.1.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/dist/index.js ADDED
@@ -0,0 +1,454 @@
1
+ "use strict";
2
+ // ─── MoltenDB Query Builder ───────────────────────────────────────────────────
3
+ // Chainable, type-safe query builder for MoltenDB.
4
+ //
5
+ // Each operation has its own builder class that only exposes the methods
6
+ // that are valid for that operation — matching the server's allowed-property
7
+ // lists exactly:
8
+ //
9
+ // GET_ALLOWED: collection, keys, where, fields, excludedFields,
10
+ // joins, sort, count, offset
11
+ // SET_ALLOWED: collection, data, extends
12
+ // UPDATE_ALLOWED: collection, data
13
+ // DELETE_ALLOWED: collection, keys, drop
14
+ //
15
+ // Usage (vanilla JS or TypeScript):
16
+ //
17
+ // const db = new MoltenDBClient(worker);
18
+ //
19
+ // // GET — chainable query
20
+ // const results = await db.collection('laptops')
21
+ // .get()
22
+ // .where({ brand: 'Apple' })
23
+ // .fields(['brand', 'model', 'price'])
24
+ // .sort([{ field: 'price', order: 'asc' }])
25
+ // .count(10)
26
+ // .exec();
27
+ //
28
+ // // SET — insert/upsert
29
+ // await db.collection('laptops')
30
+ // .set({ lp1: { brand: 'Lenovo', price: 1499 } })
31
+ // .exec();
32
+ //
33
+ // // UPDATE — partial patch
34
+ // await db.collection('laptops')
35
+ // .update({ lp4: { price: 1749, in_stock: true } })
36
+ // .exec();
37
+ //
38
+ // // DELETE — single key, batch, or drop
39
+ // await db.collection('laptops').delete().keys('lp6').exec();
40
+ // await db.collection('laptops').delete().keys(['lp4', 'lp5']).exec();
41
+ // await db.collection('laptops').delete().drop().exec();
42
+ // ─────────────────────────────────────────────────────────────────────────────
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.MoltenDBQueryBuilder = exports.CollectionHandle = exports.DeleteQuery = exports.UpdateQuery = exports.SetQuery = exports.GetQuery = exports.WorkerTransport = void 0;
45
+ // ─── WorkerTransport ──────────────────────────────────────────────────────────
46
+ /**
47
+ * Default transport that communicates with a MoltenDB Web Worker.
48
+ *
49
+ * The worker must follow the moltendb-worker.js message protocol:
50
+ * postMessage({ id, action, ...payload })
51
+ * onmessage → { id, result } | { id, error }
52
+ */
53
+ class WorkerTransport {
54
+ constructor(worker, startId = 0) {
55
+ this.pending = new Map();
56
+ this.messageId = startId;
57
+ this.worker = worker;
58
+ this.worker.addEventListener('message', (event) => {
59
+ const { id, result, error } = event.data;
60
+ const p = this.pending.get(id);
61
+ if (!p)
62
+ return;
63
+ this.pending.delete(id);
64
+ if (error)
65
+ p.reject(new Error(error));
66
+ else
67
+ p.resolve(result ?? null);
68
+ });
69
+ }
70
+ send(action, payload) {
71
+ return new Promise((resolve, reject) => {
72
+ const id = this.messageId++;
73
+ this.pending.set(id, { resolve, reject });
74
+ this.worker.postMessage({ id, action, ...payload });
75
+ });
76
+ }
77
+ }
78
+ exports.WorkerTransport = WorkerTransport;
79
+ // ─── GetQuery ─────────────────────────────────────────────────────────────────
80
+ /**
81
+ * Builder for GET (read/query) operations.
82
+ *
83
+ * Allowed fields: collection, keys, where, fields, excludedFields,
84
+ * joins, sort, count, offset
85
+ *
86
+ * @example
87
+ * const rows = await db.collection('laptops')
88
+ * .get()
89
+ * .where({ brand: 'Apple' })
90
+ * .fields(['brand', 'model', 'price'])
91
+ * .sort([{ field: 'price', order: 'asc' }])
92
+ * .count(5)
93
+ * .exec();
94
+ */
95
+ class GetQuery {
96
+ /** @internal */
97
+ constructor(transport, collection) {
98
+ this.transport = transport;
99
+ this.payload = { collection };
100
+ }
101
+ /**
102
+ * Fetch a single document by key, or a batch of documents by key array.
103
+ *
104
+ * @param keys - A single key string or an array of key strings.
105
+ *
106
+ * @example
107
+ * // Single key
108
+ * .keys('lp2')
109
+ * // Batch
110
+ * .keys(['lp1', 'lp3', 'lp5'])
111
+ */
112
+ keys(keys) {
113
+ this.payload['keys'] = keys;
114
+ return this;
115
+ }
116
+ /**
117
+ * Filter documents using a WHERE clause.
118
+ * Multiple conditions are combined with implicit AND.
119
+ *
120
+ * Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $contains
121
+ * Dot-notation is supported for nested fields.
122
+ *
123
+ * @example
124
+ * .where({ brand: 'Apple' })
125
+ * .where({ price: { $gt: 1000, $lt: 3000 } })
126
+ * .where({ 'specs.cpu.brand': 'Intel', in_stock: true })
127
+ */
128
+ where(clause) {
129
+ this.payload['where'] = clause;
130
+ return this;
131
+ }
132
+ /**
133
+ * Project the response to only the specified fields (dot-notation supported).
134
+ * Cannot be combined with {@link excludedFields}.
135
+ *
136
+ * @example
137
+ * .fields(['brand', 'model', 'specs.cpu.ghz'])
138
+ */
139
+ fields(fields) {
140
+ this.payload['fields'] = fields;
141
+ return this;
142
+ }
143
+ /**
144
+ * Return all fields except the specified ones.
145
+ * Cannot be combined with {@link fields}.
146
+ *
147
+ * @example
148
+ * .excludedFields(['price', 'memory_id', 'display_id'])
149
+ */
150
+ excludedFields(fields) {
151
+ this.payload['excludedFields'] = fields;
152
+ return this;
153
+ }
154
+ /**
155
+ * Join related documents from other collections.
156
+ * Each join embeds the related document under the given alias.
157
+ *
158
+ * @example
159
+ * .joins([
160
+ * { alias: 'ram', from: 'memory', on: 'memory_id', fields: ['capacity_gb', 'type'] },
161
+ * { alias: 'screen', from: 'display', on: 'display_id', fields: ['refresh_hz', 'panel'] },
162
+ * ])
163
+ */
164
+ joins(specs) {
165
+ this.payload['joins'] = specs.map(({ alias, from, on, fields }) => ({
166
+ [alias]: fields ? { from, on, fields } : { from, on },
167
+ }));
168
+ return this;
169
+ }
170
+ /**
171
+ * Sort the results.
172
+ * Multiple specs are applied in priority order (first = primary sort key).
173
+ *
174
+ * @example
175
+ * .sort([{ field: 'price', order: 'asc' }])
176
+ * .sort([{ field: 'brand', order: 'asc' }, { field: 'price', order: 'desc' }])
177
+ */
178
+ sort(specs) {
179
+ this.payload['sort'] = specs;
180
+ return this;
181
+ }
182
+ /**
183
+ * Limit the number of results returned (applied after filtering and sorting).
184
+ *
185
+ * @example
186
+ * .count(10)
187
+ */
188
+ count(n) {
189
+ this.payload['count'] = n;
190
+ return this;
191
+ }
192
+ /**
193
+ * Skip the first N results (for pagination, applied after sorting).
194
+ *
195
+ * @example
196
+ * .offset(20).count(10) // page 3 of 10
197
+ */
198
+ offset(n) {
199
+ this.payload['offset'] = n;
200
+ return this;
201
+ }
202
+ /**
203
+ * Build and return the raw JSON payload without sending it.
204
+ * Useful for debugging or passing to a custom transport.
205
+ */
206
+ build() {
207
+ return { ...this.payload };
208
+ }
209
+ /**
210
+ * Execute the query and return the result.
211
+ * Returns a single document for single-key lookups, or an array for all others.
212
+ */
213
+ exec() {
214
+ return this.transport.send('get', this.payload);
215
+ }
216
+ }
217
+ exports.GetQuery = GetQuery;
218
+ // ─── SetQuery ─────────────────────────────────────────────────────────────────
219
+ /**
220
+ * Builder for SET (insert / upsert) operations.
221
+ *
222
+ * Allowed fields: collection, data, extends
223
+ *
224
+ * @example
225
+ * await db.collection('laptops')
226
+ * .set({
227
+ * lp1: { brand: 'Lenovo', model: 'ThinkPad X1', price: 1499 },
228
+ * lp2: { brand: 'Apple', model: 'MacBook Pro', price: 3499 },
229
+ * })
230
+ * .exec();
231
+ */
232
+ class SetQuery {
233
+ /** @internal */
234
+ constructor(transport, collection, data) {
235
+ this.transport = transport;
236
+ this.payload = { collection, data: data };
237
+ }
238
+ /**
239
+ * Embed data from other collections into each document at insert time.
240
+ * The referenced document is fetched once and stored as a snapshot.
241
+ *
242
+ * Format: `{ alias: "collection.key" }`
243
+ *
244
+ * @example
245
+ * .extends({ ram: 'memory.mem4', screen: 'display.dsp3' })
246
+ */
247
+ extends(map) {
248
+ // The extends map is applied to every document in data.
249
+ // We store it at the top level; the server resolves it per-document.
250
+ const data = this.payload['data'];
251
+ if (Array.isArray(data)) {
252
+ // Array format — inject extends into each item
253
+ this.payload['data'] = data.map((doc) => ({
254
+ ...doc,
255
+ extends: map,
256
+ }));
257
+ }
258
+ else if (data && typeof data === 'object') {
259
+ // Object format — inject extends into each document value
260
+ const updated = {};
261
+ for (const [key, doc] of Object.entries(data)) {
262
+ updated[key] = { ...doc, extends: map };
263
+ }
264
+ this.payload['data'] = updated;
265
+ }
266
+ return this;
267
+ }
268
+ /** Build and return the raw JSON payload without sending it. */
269
+ build() {
270
+ return { ...this.payload };
271
+ }
272
+ /** Execute the insert/upsert and return `{ count, status }`. */
273
+ exec() {
274
+ return this.transport.send('set', this.payload);
275
+ }
276
+ }
277
+ exports.SetQuery = SetQuery;
278
+ // ─── UpdateQuery ──────────────────────────────────────────────────────────────
279
+ /**
280
+ * Builder for UPDATE (partial patch / merge) operations.
281
+ *
282
+ * Allowed fields: collection, data
283
+ *
284
+ * Only the fields present in each patch object are updated —
285
+ * all other fields on the existing document are left unchanged.
286
+ *
287
+ * @example
288
+ * await db.collection('laptops')
289
+ * .update({ lp4: { price: 1749, in_stock: true } })
290
+ * .exec();
291
+ */
292
+ class UpdateQuery {
293
+ /** @internal */
294
+ constructor(transport, collection, data) {
295
+ this.transport = transport;
296
+ this.payload = { collection, data: data };
297
+ }
298
+ /** Build and return the raw JSON payload without sending it. */
299
+ build() {
300
+ return { ...this.payload };
301
+ }
302
+ /** Execute the patch and return `{ count, status }`. */
303
+ exec() {
304
+ return this.transport.send('update', this.payload);
305
+ }
306
+ }
307
+ exports.UpdateQuery = UpdateQuery;
308
+ // ─── DeleteQuery ──────────────────────────────────────────────────────────────
309
+ /**
310
+ * Builder for DELETE operations.
311
+ *
312
+ * Allowed fields: collection, keys, drop
313
+ *
314
+ * @example
315
+ * // Delete a single document
316
+ * await db.collection('laptops').delete().keys('lp6').exec();
317
+ *
318
+ * // Delete multiple documents
319
+ * await db.collection('laptops').delete().keys(['lp4', 'lp5']).exec();
320
+ *
321
+ * // Drop the entire collection
322
+ * await db.collection('laptops').delete().drop().exec();
323
+ */
324
+ class DeleteQuery {
325
+ /** @internal */
326
+ constructor(transport, collection) {
327
+ this.transport = transport;
328
+ this.payload = { collection };
329
+ }
330
+ /**
331
+ * Delete a single document by key, or multiple documents by key array.
332
+ *
333
+ * @example
334
+ * .keys('lp6')
335
+ * .keys(['lp4', 'lp5'])
336
+ */
337
+ keys(keys) {
338
+ this.payload['keys'] = keys;
339
+ return this;
340
+ }
341
+ /**
342
+ * Drop the entire collection (deletes all documents).
343
+ * Cannot be combined with {@link keys}.
344
+ *
345
+ * @example
346
+ * .drop()
347
+ */
348
+ drop() {
349
+ this.payload['drop'] = true;
350
+ return this;
351
+ }
352
+ /** Build and return the raw JSON payload without sending it. */
353
+ build() {
354
+ return { ...this.payload };
355
+ }
356
+ /** Execute the delete and return `{ count, status }`. */
357
+ exec() {
358
+ return this.transport.send('delete', this.payload);
359
+ }
360
+ }
361
+ exports.DeleteQuery = DeleteQuery;
362
+ // ─── CollectionHandle ─────────────────────────────────────────────────────────
363
+ /**
364
+ * A handle to a specific collection.
365
+ * Returned by `MoltenDBClient.collection(name)`.
366
+ * Use it to start any of the four operation builders.
367
+ */
368
+ class CollectionHandle {
369
+ /** @internal */
370
+ constructor(transport, collectionName) {
371
+ this.transport = transport;
372
+ this.collectionName = collectionName;
373
+ }
374
+ /**
375
+ * Start a GET (read/query) builder for this collection.
376
+ *
377
+ * @example
378
+ * db.collection('laptops').get().where({ brand: 'Apple' }).exec()
379
+ */
380
+ get() {
381
+ return new GetQuery(this.transport, this.collectionName);
382
+ }
383
+ /**
384
+ * Start a SET (insert/upsert) builder for this collection.
385
+ *
386
+ * @param data - A map of `{ key: document }` pairs, or an array of documents
387
+ * (keys are auto-generated as UUIDv7 when using array format).
388
+ *
389
+ * @example
390
+ * db.collection('laptops').set({ lp1: { brand: 'Lenovo', price: 1499 } }).exec()
391
+ */
392
+ set(data) {
393
+ return new SetQuery(this.transport, this.collectionName, data);
394
+ }
395
+ /**
396
+ * Start an UPDATE (partial patch) builder for this collection.
397
+ *
398
+ * @param data - A map of `{ key: patch }` pairs. Only the provided fields are updated.
399
+ *
400
+ * @example
401
+ * db.collection('laptops').update({ lp4: { price: 1749 } }).exec()
402
+ */
403
+ update(data) {
404
+ return new UpdateQuery(this.transport, this.collectionName, data);
405
+ }
406
+ /**
407
+ * Start a DELETE builder for this collection.
408
+ * Chain `.keys(...)` or `.drop()` to specify what to delete.
409
+ *
410
+ * @example
411
+ * db.collection('laptops').delete().keys('lp6').exec()
412
+ */
413
+ delete() {
414
+ return new DeleteQuery(this.transport, this.collectionName);
415
+ }
416
+ }
417
+ exports.CollectionHandle = CollectionHandle;
418
+ // ─── MoltenDBClient ───────────────────────────────────────────────────────────
419
+ /**
420
+ * The main entry point for the MoltenDB query builder.
421
+ *
422
+ * Accepts any {@link MoltenTransport} implementation — use {@link WorkerTransport}
423
+ * to connect to a MoltenDB WASM Web Worker, or provide your own transport
424
+ * for HTTP, WebSocket, or testing.
425
+ *
426
+ * @example
427
+ * // Browser + WASM Web Worker
428
+ * const worker = new Worker('./moltendb-worker.js', { type: 'module' });
429
+ * const transport = new WorkerTransport(worker);
430
+ * const db = new MoltenDBClient(transport);
431
+ *
432
+ * const results = await db.collection('laptops')
433
+ * .get()
434
+ * .where({ in_stock: true })
435
+ * .sort([{ field: 'price', order: 'asc' }])
436
+ * .count(5)
437
+ * .exec();
438
+ */
439
+ class MoltenDBQueryBuilder {
440
+ constructor(transport) {
441
+ this.transport = transport;
442
+ }
443
+ /**
444
+ * Select a collection to operate on.
445
+ * Returns a {@link CollectionHandle} from which you can start any query builder.
446
+ *
447
+ * @param name - The collection name (e.g. `'laptops'`).
448
+ */
449
+ collection(name) {
450
+ return new CollectionHandle(this.transport, name);
451
+ }
452
+ }
453
+ exports.MoltenDBQueryBuilder = MoltenDBQueryBuilder;
454
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,iFAAiF;AACjF,mDAAmD;AACnD,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAC7E,iBAAiB;AACjB,EAAE;AAC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,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACH,GAAG;QACD,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,IAA0B;QAC5B,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,IAAa;QAClB,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;OAMG;IACH,MAAM;QACJ,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9D,CAAC;CACF;AAvDD,4CAuDC;AAED,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,oBAAoB;IAG/B,YAAY,SAA0B;QACpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,UAAU,CAAC,IAAY;QACrB,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACF;AAhBD,oDAgBC"}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@moltendb-web/query",
3
+ "version": "0.1.0",
4
+ "description": "Type-safe query builder for MoltenDB — chainable API for get, set, update and delete operations.",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.esm.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc --project tsconfig.build.json && node scripts/build-esm.js",
21
+ "typecheck": "tsc --noEmit",
22
+ "test": "node --experimental-vm-modules node_modules/.bin/jest"
23
+ },
24
+ "keywords": ["moltendb", "database", "query-builder", "nosql", "wasm"],
25
+ "license": "MIT OR Apache-2.0",
26
+ "devDependencies": {
27
+ "typescript": "^6.0.1-rc"
28
+ }
29
+ }