@antelopejs/interface-database 0.1.4 → 0.1.5
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/antelope.test.js +2 -2
- package/dist/antelope.test.js.map +1 -1
- package/dist/atomic.d.ts +41 -0
- package/dist/atomic.js +135 -0
- package/dist/atomic.js.map +1 -0
- package/dist/common.js.map +1 -1
- package/dist/datum.d.ts +2 -2
- package/dist/datum.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/query.js +1 -1
- package/dist/query.js.map +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/dist/schema.js.map +1 -1
- package/dist/selection.d.ts +4 -1
- package/dist/selection.js +7 -0
- package/dist/selection.js.map +1 -1
- package/dist/stream.d.ts +1 -1
- package/dist/stream.js.map +1 -1
- package/dist/tests/aggregation_operations.test.js +1 -1
- package/dist/tests/aggregation_operations.test.js.map +1 -1
- package/dist/tests/atomic_mutation.test.d.ts +1 -0
- package/dist/tests/atomic_mutation.test.js +185 -0
- package/dist/tests/atomic_mutation.test.js.map +1 -0
- package/dist/tests/basic_operations.test.js +1 -1
- package/dist/tests/basic_operations.test.js.map +1 -1
- package/dist/tests/between_operations.test.js +1 -1
- package/dist/tests/between_operations.test.js.map +1 -1
- package/dist/tests/change_feeds.test.js +1 -1
- package/dist/tests/change_feeds.test.js.map +1 -1
- package/dist/tests/datasets/codec_fields.js.map +1 -1
- package/dist/tests/date_operations.test.js +1 -1
- package/dist/tests/date_operations.test.js.map +1 -1
- package/dist/tests/do_operations.test.js +1 -1
- package/dist/tests/do_operations.test.js.map +1 -1
- package/dist/tests/filters.test.js +1 -1
- package/dist/tests/filters.test.js.map +1 -1
- package/dist/tests/group_operations.test.js +1 -1
- package/dist/tests/group_operations.test.js.map +1 -1
- package/dist/tests/instance_modes.test.js +1 -1
- package/dist/tests/instance_modes.test.js.map +1 -1
- package/dist/tests/joins.test.js +2 -2
- package/dist/tests/joins.test.js.map +1 -1
- package/dist/tests/lookup_operations.test.js +2 -2
- package/dist/tests/lookup_operations.test.js.map +1 -1
- package/dist/tests/merge_operations.test.js +2 -2
- package/dist/tests/merge_operations.test.js.map +1 -1
- package/dist/tests/sorting.test.js +1 -1
- package/dist/tests/sorting.test.js.map +1 -1
- package/dist/tests/union_operations.test.js +2 -2
- package/dist/tests/union_operations.test.js.map +1 -1
- package/docs/1.query_types/2.table.md +10 -4
- package/docs/1.query_types/3.selection.md +15 -17
- package/docs/1.query_types/5.stream.md +2 -5
- package/docs/1.query_types/6.feed.md +1 -1
- package/docs/1.query_types/9.valueproxy.md +43 -41
- package/docs/2.operations/2.database_management.md +2 -2
- package/docs/2.operations/3.table_operations.md +1 -1
- package/docs/2.operations/4.crud.md +1 -2
- package/docs/2.operations/5.indexes.md +4 -4
- package/docs/2.operations/6.filtering.md +23 -27
- package/docs/2.operations/7.lookup.md +13 -15
- package/docs/2.operations/8.atomic_mutations.md +71 -0
- package/docs/3.results/3.index_changes.md +9 -5
- package/docs/3.results/4.table_changes.md +3 -3
- package/docs/3.results/6.value_changes.md +5 -5
- package/docs/index.md +1 -0
- package/package.json +55 -40
- package/skills/database-interface/SKILL.md +41 -7
|
@@ -13,10 +13,34 @@ AQL is a lazy, chainable query builder. Every class here (`Schema`, `Table`, `Se
|
|
|
13
13
|
|
|
14
14
|
```ts
|
|
15
15
|
// Root re-exports everything most consumers need:
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
Schema,
|
|
18
|
+
SchemaInstance,
|
|
19
|
+
SchemaDefinition,
|
|
20
|
+
Table,
|
|
21
|
+
Selection,
|
|
22
|
+
SingleSelection,
|
|
23
|
+
Stream,
|
|
24
|
+
Datum,
|
|
25
|
+
Query,
|
|
26
|
+
ValueProxy,
|
|
27
|
+
ValueProxyOrValue,
|
|
28
|
+
InstanceId,
|
|
29
|
+
CROSS_INSTANCE,
|
|
30
|
+
} from "@antelopejs/interface-database";
|
|
17
31
|
// Types only available via subpath (not re-exported at root):
|
|
18
|
-
import {
|
|
19
|
-
|
|
32
|
+
import {
|
|
33
|
+
TableDefinition,
|
|
34
|
+
IndexDefinition,
|
|
35
|
+
FieldType,
|
|
36
|
+
} from "@antelopejs/interface-database/schema";
|
|
37
|
+
import {
|
|
38
|
+
Changes,
|
|
39
|
+
DeepPartial,
|
|
40
|
+
InsertOptions,
|
|
41
|
+
Value,
|
|
42
|
+
ExtractType,
|
|
43
|
+
} from "@antelopejs/interface-database/common";
|
|
20
44
|
// Each root symbol is also importable from its own subpath (/schema, /selection, /stream, /datum, /query, /valueproxy) — equivalent alternatives, do not combine with the root import for the same symbol.
|
|
21
45
|
```
|
|
22
46
|
|
|
@@ -27,7 +51,12 @@ Add `@antelopejs/interface-database` to the module's `dependencies`; `@antelopej
|
|
|
27
51
|
```ts
|
|
28
52
|
import { Schema } from "@antelopejs/interface-database";
|
|
29
53
|
|
|
30
|
-
interface Novel {
|
|
54
|
+
interface Novel {
|
|
55
|
+
_id?: string;
|
|
56
|
+
title: string;
|
|
57
|
+
pageCount: number;
|
|
58
|
+
available: boolean;
|
|
59
|
+
}
|
|
31
60
|
|
|
32
61
|
// Registers the schema with the provider. The generic maps table names to row types.
|
|
33
62
|
const schema = new Schema<{ novels: Novel }>("library", {
|
|
@@ -39,12 +68,17 @@ const schema = new Schema<{ novels: Novel }>("library", {
|
|
|
39
68
|
|
|
40
69
|
const novels = schema.instance().table("novels"); // default instance
|
|
41
70
|
|
|
42
|
-
const ids = await novels.insert({
|
|
71
|
+
const ids = await novels.insert({
|
|
72
|
+
title: "The Glass Meridian",
|
|
73
|
+
pageCount: 412,
|
|
74
|
+
available: true,
|
|
75
|
+
}); // string[] of inserted ids
|
|
43
76
|
const longNovels = await novels
|
|
44
77
|
.filter((n) => n.key("pageCount").ge(300).and(n.key("available")))
|
|
45
|
-
.orderBy("pageCount", "desc");
|
|
78
|
+
.orderBy("pageCount", "desc"); // await executes: Novel[]
|
|
46
79
|
await novels.get(ids[0]).update({ available: false }); // number of modified docs
|
|
47
|
-
for await (const change of novels.changes()) {
|
|
80
|
+
for await (const change of novels.changes()) {
|
|
81
|
+
// change feed via async iteration
|
|
48
82
|
console.log(change.changeType, change.newValue); // "added" | "removed" | "modified"
|
|
49
83
|
}
|
|
50
84
|
```
|