@antelopejs/interface-database 0.0.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 +190 -0
- package/README.md +45 -0
- package/dist/antelope.test.d.ts +2 -0
- package/dist/antelope.test.js +35 -0
- package/dist/antelope.test.js.map +1 -0
- package/dist/common.d.ts +58 -0
- package/dist/common.js +44 -0
- package/dist/common.js.map +1 -0
- package/dist/datum.d.ts +55 -0
- package/dist/datum.js +70 -0
- package/dist/datum.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/query.d.ts +15 -0
- package/dist/query.js +79 -0
- package/dist/query.js.map +1 -0
- package/dist/schema.d.ts +102 -0
- package/dist/schema.js +88 -0
- package/dist/schema.js.map +1 -0
- package/dist/selection.d.ts +99 -0
- package/dist/selection.js +119 -0
- package/dist/selection.js.map +1 -0
- package/dist/stream.d.ts +185 -0
- package/dist/stream.js +221 -0
- package/dist/stream.js.map +1 -0
- package/dist/tests/aggregation_operations.test.d.ts +1 -0
- package/dist/tests/aggregation_operations.test.js +157 -0
- package/dist/tests/aggregation_operations.test.js.map +1 -0
- package/dist/tests/basic_operations.test.d.ts +1 -0
- package/dist/tests/basic_operations.test.js +216 -0
- package/dist/tests/basic_operations.test.js.map +1 -0
- package/dist/tests/between_operations.test.d.ts +1 -0
- package/dist/tests/between_operations.test.js +76 -0
- package/dist/tests/between_operations.test.js.map +1 -0
- package/dist/tests/change_feeds.test.d.ts +1 -0
- package/dist/tests/change_feeds.test.js +90 -0
- package/dist/tests/change_feeds.test.js.map +1 -0
- package/dist/tests/datasets/index.d.ts +4 -0
- package/dist/tests/datasets/index.js +22 -0
- package/dist/tests/datasets/index.js.map +1 -0
- package/dist/tests/datasets/orders.d.ts +62 -0
- package/dist/tests/datasets/orders.js +158 -0
- package/dist/tests/datasets/orders.js.map +1 -0
- package/dist/tests/datasets/products.d.ts +48 -0
- package/dist/tests/datasets/products.js +139 -0
- package/dist/tests/datasets/products.js.map +1 -0
- package/dist/tests/datasets/users.d.ts +50 -0
- package/dist/tests/datasets/users.js +145 -0
- package/dist/tests/datasets/users.js.map +1 -0
- package/dist/tests/datasets/vehicles.d.ts +23 -0
- package/dist/tests/datasets/vehicles.js +41 -0
- package/dist/tests/datasets/vehicles.js.map +1 -0
- package/dist/tests/date_operations.test.d.ts +1 -0
- package/dist/tests/date_operations.test.js +119 -0
- package/dist/tests/date_operations.test.js.map +1 -0
- package/dist/tests/do_operations.test.d.ts +1 -0
- package/dist/tests/do_operations.test.js +209 -0
- package/dist/tests/do_operations.test.js.map +1 -0
- package/dist/tests/filters.test.d.ts +1 -0
- package/dist/tests/filters.test.js +158 -0
- package/dist/tests/filters.test.js.map +1 -0
- package/dist/tests/group_operations.test.d.ts +1 -0
- package/dist/tests/group_operations.test.js +190 -0
- package/dist/tests/group_operations.test.js.map +1 -0
- package/dist/tests/instance_modes.test.d.ts +1 -0
- package/dist/tests/instance_modes.test.js +192 -0
- package/dist/tests/instance_modes.test.js.map +1 -0
- package/dist/tests/joins.test.d.ts +1 -0
- package/dist/tests/joins.test.js +163 -0
- package/dist/tests/joins.test.js.map +1 -0
- package/dist/tests/lookup_operations.test.d.ts +1 -0
- package/dist/tests/lookup_operations.test.js +103 -0
- package/dist/tests/lookup_operations.test.js.map +1 -0
- package/dist/tests/merge_operations.test.d.ts +1 -0
- package/dist/tests/merge_operations.test.js +216 -0
- package/dist/tests/merge_operations.test.js.map +1 -0
- package/dist/tests/row_level_operations.test.d.ts +1 -0
- package/dist/tests/row_level_operations.test.js +467 -0
- package/dist/tests/row_level_operations.test.js.map +1 -0
- package/dist/tests/sorting.test.d.ts +1 -0
- package/dist/tests/sorting.test.js +161 -0
- package/dist/tests/sorting.test.js.map +1 -0
- package/dist/tests/union_operations.test.d.ts +1 -0
- package/dist/tests/union_operations.test.js +129 -0
- package/dist/tests/union_operations.test.js.map +1 -0
- package/dist/valueproxy.d.ts +415 -0
- package/dist/valueproxy.js +562 -0
- package/dist/valueproxy.js.map +1 -0
- package/package.json +88 -0
package/dist/stream.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stream = void 0;
|
|
4
|
+
const datum_1 = require("./datum");
|
|
5
|
+
const query_1 = require("./query");
|
|
6
|
+
const valueproxy_1 = require("./valueproxy");
|
|
7
|
+
class Stream extends query_1.Query {
|
|
8
|
+
/**
|
|
9
|
+
* Changes the type of the value in this stream.
|
|
10
|
+
* This does not actually perform any conversion, it only changes the typescript type.
|
|
11
|
+
*
|
|
12
|
+
* @returns Same stream with a different type
|
|
13
|
+
*/
|
|
14
|
+
cast() {
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Indexes the stream value.
|
|
19
|
+
*
|
|
20
|
+
* TODO: Better name?
|
|
21
|
+
*
|
|
22
|
+
* @param key Field name
|
|
23
|
+
* @param def Default value
|
|
24
|
+
* @returns New stream
|
|
25
|
+
*/
|
|
26
|
+
key(key, def) {
|
|
27
|
+
return this.stage((Stream), "key", undefined, key, def);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Defaults the stream value to a given value if it is null.
|
|
31
|
+
*
|
|
32
|
+
* @param value Default value
|
|
33
|
+
* @returns Stream with non-null value
|
|
34
|
+
*/
|
|
35
|
+
default(val) {
|
|
36
|
+
return this.stage((Stream), "default", undefined, val);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Maps the array values using a mapping function.
|
|
40
|
+
*
|
|
41
|
+
* @param mapper Mapping function
|
|
42
|
+
* @returns New stream
|
|
43
|
+
*/
|
|
44
|
+
map(mapper) {
|
|
45
|
+
return this.stage((Stream), "map", undefined, this.callfunc(mapper, (valueproxy_1.ValueProxy)));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Filters the array using a predicate function.
|
|
49
|
+
*
|
|
50
|
+
* @param predicate Predicate function.
|
|
51
|
+
* @returns Filtered stream
|
|
52
|
+
*/
|
|
53
|
+
filter(predicate) {
|
|
54
|
+
return this.stage(undefined, "filter", undefined, this.callfunc(predicate, (valueproxy_1.ValueProxy)));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Selects specific fields in the documents, discarding the rest.
|
|
58
|
+
*
|
|
59
|
+
* @param fields Selected fields
|
|
60
|
+
* @returns New stream
|
|
61
|
+
*/
|
|
62
|
+
pluck(...fields) {
|
|
63
|
+
return this.stage((Stream), "pluck", undefined, fields);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Excludes specific fields in the documents
|
|
67
|
+
*
|
|
68
|
+
* @param fields Excluded fields
|
|
69
|
+
* @returns New stream
|
|
70
|
+
*/
|
|
71
|
+
without(...fields) {
|
|
72
|
+
return this.stage((Stream), "without", undefined, fields);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Concatenates the results of another stream into this stream without deduplication
|
|
76
|
+
*
|
|
77
|
+
* @param other Stream to concatenate
|
|
78
|
+
* @returns New stream containing elements from both streams
|
|
79
|
+
*/
|
|
80
|
+
union(other) {
|
|
81
|
+
return this.stage((Stream), "union", undefined, other);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Perform a left join operation between this stream (left) and another stream (right)
|
|
85
|
+
*
|
|
86
|
+
* @param right Right stream
|
|
87
|
+
* @param predicate Predicate to match elements from the left stream to the right stream
|
|
88
|
+
* @param mapper Mapping function for each pair of documents
|
|
89
|
+
* @returns New stream with results of the mapping function
|
|
90
|
+
*/
|
|
91
|
+
join(right, predicate, mapper) {
|
|
92
|
+
return this.stage((Stream), "join", { innerOnly: false }, right, this.callfunc(predicate, (valueproxy_1.ValueProxy), (valueproxy_1.ValueProxy)), this.callfunc(mapper, (valueproxy_1.ValueProxy), (valueproxy_1.ValueProxy)));
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Perform an inner join operation between this stream (left) and another stream (right)
|
|
96
|
+
*
|
|
97
|
+
* @param right Right stream
|
|
98
|
+
* @param predicate Predicate to match elements from the left stream to the right stream
|
|
99
|
+
* @param mapper Mapping function for each pair of documents
|
|
100
|
+
* @returns New stream with results of the mapping function
|
|
101
|
+
*/
|
|
102
|
+
joinInner(right, predicate, mapper) {
|
|
103
|
+
return this.stage((Stream), "join", { innerOnly: true }, right, this.callfunc(predicate, (valueproxy_1.ValueProxy), (valueproxy_1.ValueProxy)), this.callfunc(mapper, (valueproxy_1.ValueProxy), (valueproxy_1.ValueProxy)));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Transform a foreign key or array of foreign keys into a document from another stream
|
|
107
|
+
*
|
|
108
|
+
* @param right Stream containing the other documents
|
|
109
|
+
* @param localKey Key in the local document to search with and replace
|
|
110
|
+
* @param otherKey Key in the other document to match against
|
|
111
|
+
* @returns New stream
|
|
112
|
+
*/
|
|
113
|
+
lookup(right, localKey, otherKey) {
|
|
114
|
+
return this.stage((Stream), "lookup", { localKey, otherKey }, right);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Group the documents using the given index and maps the result using a mapping function
|
|
118
|
+
*
|
|
119
|
+
* The parameters of this function are:
|
|
120
|
+
* - The stream with all the documents inside the group
|
|
121
|
+
* - The index value for this group
|
|
122
|
+
*
|
|
123
|
+
* The result of this function is used as the element in the new stream
|
|
124
|
+
*
|
|
125
|
+
* @param index Index to group on
|
|
126
|
+
* @param mapper Mapping function
|
|
127
|
+
* @returns New stream of grouped data
|
|
128
|
+
*/
|
|
129
|
+
group(index, mapper) {
|
|
130
|
+
return this.stage((Stream), "group", { index }, this.callfunc(mapper, (Stream), (valueproxy_1.ValueProxy)));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Sort the stream using the given index and direction
|
|
134
|
+
*
|
|
135
|
+
* @param index Index to sort
|
|
136
|
+
* @param direction Sort direction
|
|
137
|
+
* @returns New (sorted) stream
|
|
138
|
+
*/
|
|
139
|
+
orderBy(index, direction) {
|
|
140
|
+
return this.stage(undefined, "orderBy", { index, direction });
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Obtain a slice (subsection) of the stream
|
|
144
|
+
*
|
|
145
|
+
* @param offset Offset into the stream
|
|
146
|
+
* @param count Number of documents to pick
|
|
147
|
+
* @returns New stream
|
|
148
|
+
*/
|
|
149
|
+
slice(offset, count) {
|
|
150
|
+
return this.stage(undefined, "slice", undefined, offset, count);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Obtain the Nth document of the stream
|
|
154
|
+
*
|
|
155
|
+
* @param n N
|
|
156
|
+
* @returns Single document
|
|
157
|
+
*/
|
|
158
|
+
nth(n) {
|
|
159
|
+
return this.stage((datum_1.Datum), "nth", undefined, n);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets the count of documents or the count of distinct values of a given field
|
|
163
|
+
*
|
|
164
|
+
* @param field Field to count distinct entries
|
|
165
|
+
* @returns Count
|
|
166
|
+
*/
|
|
167
|
+
count(field) {
|
|
168
|
+
return this.stage((datum_1.Datum), "count", { field });
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Sum of the values on the given field
|
|
172
|
+
*
|
|
173
|
+
* @param field Field to use
|
|
174
|
+
* @returns Sum
|
|
175
|
+
*/
|
|
176
|
+
sum(field) {
|
|
177
|
+
return this.stage((datum_1.Datum), "sum", { field });
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Average of the values on the given field
|
|
181
|
+
*
|
|
182
|
+
* @param field Field to use
|
|
183
|
+
* @returns Average
|
|
184
|
+
*/
|
|
185
|
+
avg(field) {
|
|
186
|
+
return this.stage((datum_1.Datum), "avg", { field });
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Minimum of the values on the given field
|
|
190
|
+
*
|
|
191
|
+
* @param field Field to use
|
|
192
|
+
* @returns Minimum value
|
|
193
|
+
*/
|
|
194
|
+
min(field) {
|
|
195
|
+
return this.stage((datum_1.Datum), "min", { field });
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Maximum of the values on the given field
|
|
199
|
+
*
|
|
200
|
+
* @param field Field to use
|
|
201
|
+
* @returns Maximum value
|
|
202
|
+
*/
|
|
203
|
+
max(field) {
|
|
204
|
+
return this.stage((datum_1.Datum), "max", { field });
|
|
205
|
+
}
|
|
206
|
+
distinct(field) {
|
|
207
|
+
return this.stage(field ? Stream : datum_1.Datum, "distinct", {
|
|
208
|
+
field,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Turns this stream into a change feed
|
|
213
|
+
*
|
|
214
|
+
* @returns Change feed
|
|
215
|
+
*/
|
|
216
|
+
changes() {
|
|
217
|
+
return this.stage((query_1.Query), "changes");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.Stream = Stream;
|
|
221
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAChC,mCAAgC;AAEhC,6CAAkE;AAElE,MAAa,MAAU,SAAQ,aAAU;IACvC;;;;;OAKG;IACI,IAAI;QACT,OAAO,IAA4B,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACI,GAAG,CAAmC,GAAM,EAAE,GAAO;QAC1D,OAAO,IAAI,CAAC,KAAK,CACf,CAAA,MAAwE,CAAA,EACxE,KAAK,EACL,SAAS,EACT,GAAG,EACH,GAAG,CACJ,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAI,GAAa;QAC7B,OAAO,IAAI,CAAC,KAAK,CACf,CAAA,MAAwC,CAAA,EACxC,SAAS,EACT,SAAS,EACT,GAAG,CACJ,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACI,GAAG,CAA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,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const interface_database_1 = require("@antelopejs/interface-database");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const vehicles_1 = require("./datasets/vehicles");
|
|
6
|
+
const tableName = "test-table";
|
|
7
|
+
const schema = new interface_database_1.Schema("test-aggregation-operations", { [tableName]: vehicles_1.Vehicle });
|
|
8
|
+
const table = schema.instance("default").table(tableName);
|
|
9
|
+
let insertedKeys = [];
|
|
10
|
+
describe("Aggregation & Projection Operations", () => {
|
|
11
|
+
before(async () => {
|
|
12
|
+
await schema.createInstance("default").run();
|
|
13
|
+
await table.delete().run();
|
|
14
|
+
});
|
|
15
|
+
after(async () => {
|
|
16
|
+
await table.delete().run();
|
|
17
|
+
await schema.destroyInstance("default").run();
|
|
18
|
+
});
|
|
19
|
+
it("Insert Test Data", InsertTestData);
|
|
20
|
+
it("Count All", CountAll);
|
|
21
|
+
it("Count Field", CountField);
|
|
22
|
+
it("Sum", Sum);
|
|
23
|
+
it("Avg", Avg);
|
|
24
|
+
it("Min", Min);
|
|
25
|
+
it("Max", Max);
|
|
26
|
+
it("Nth", Nth);
|
|
27
|
+
it("Slice", Slice);
|
|
28
|
+
it("Pluck", Pluck);
|
|
29
|
+
it("Without", Without);
|
|
30
|
+
it("Distinct", Distinct);
|
|
31
|
+
it("Distinct Without Field", DistinctWithoutField);
|
|
32
|
+
it("Cursor", CursorTest);
|
|
33
|
+
it("Cleanup", CleanupTest);
|
|
34
|
+
});
|
|
35
|
+
async function InsertTestData() {
|
|
36
|
+
const response = await table.insert(vehicles_1.vehicles).run();
|
|
37
|
+
(0, chai_1.expect)(response).to.be.an("array");
|
|
38
|
+
(0, chai_1.expect)(response).to.have.lengthOf(vehicles_1.vehicles.length);
|
|
39
|
+
response.forEach((val) => {
|
|
40
|
+
(0, chai_1.expect)(val).to.be.a("string");
|
|
41
|
+
});
|
|
42
|
+
insertedKeys = response;
|
|
43
|
+
}
|
|
44
|
+
async function CountAll() {
|
|
45
|
+
const result = await table.count().run();
|
|
46
|
+
(0, chai_1.expect)(result).to.be.a("number");
|
|
47
|
+
(0, chai_1.expect)(result).to.equal(vehicles_1.vehicles.length);
|
|
48
|
+
}
|
|
49
|
+
async function CountField() {
|
|
50
|
+
const result = await table.count("car").run();
|
|
51
|
+
(0, chai_1.expect)(result).to.be.a("number");
|
|
52
|
+
const expectedDistinctCars = new Set(vehicles_1.vehicles.map((v) => v.car)).size;
|
|
53
|
+
(0, chai_1.expect)(result).to.equal(expectedDistinctCars);
|
|
54
|
+
}
|
|
55
|
+
async function Sum() {
|
|
56
|
+
const result = await table.sum("price").run();
|
|
57
|
+
(0, chai_1.expect)(result).to.be.a("number");
|
|
58
|
+
const expectedSum = vehicles_1.vehicles.reduce((acc, v) => acc + v.price, 0);
|
|
59
|
+
(0, chai_1.expect)(result).to.equal(expectedSum);
|
|
60
|
+
}
|
|
61
|
+
async function Avg() {
|
|
62
|
+
const result = await table.avg("price").run();
|
|
63
|
+
(0, chai_1.expect)(result).to.be.a("number");
|
|
64
|
+
const expectedAvg = vehicles_1.vehicles.reduce((acc, v) => acc + v.price, 0) / vehicles_1.vehicles.length;
|
|
65
|
+
(0, chai_1.expect)(result).to.be.closeTo(expectedAvg, 0.01);
|
|
66
|
+
}
|
|
67
|
+
async function Min() {
|
|
68
|
+
const result = await table.min("price").run();
|
|
69
|
+
(0, chai_1.expect)(result).to.be.a("number");
|
|
70
|
+
const expectedMin = Math.min(...vehicles_1.vehicles.map((v) => v.price));
|
|
71
|
+
(0, chai_1.expect)(result).to.equal(expectedMin);
|
|
72
|
+
}
|
|
73
|
+
async function Max() {
|
|
74
|
+
const result = await table.max("price").run();
|
|
75
|
+
(0, chai_1.expect)(result).to.be.a("number");
|
|
76
|
+
const expectedMax = Math.max(...vehicles_1.vehicles.map((v) => v.price));
|
|
77
|
+
(0, chai_1.expect)(result).to.equal(expectedMax);
|
|
78
|
+
}
|
|
79
|
+
async function Nth() {
|
|
80
|
+
const sortedVehicles = [...vehicles_1.vehicles].sort((a, b) => a.price - b.price);
|
|
81
|
+
const result = await table.orderBy("price", "asc").nth(0).run();
|
|
82
|
+
(0, chai_1.expect)(result).to.be.an("object");
|
|
83
|
+
(0, chai_1.expect)(result).to.not.be.an("array");
|
|
84
|
+
(0, chai_1.expect)(result).to.have.property("price", sortedVehicles[0].price);
|
|
85
|
+
}
|
|
86
|
+
async function Slice() {
|
|
87
|
+
const sortedVehicles = [...vehicles_1.vehicles].sort((a, b) => a.price - b.price);
|
|
88
|
+
const result = await table.orderBy("price", "asc").slice(1, 2).run();
|
|
89
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
90
|
+
(0, chai_1.expect)(result).to.have.lengthOf(2);
|
|
91
|
+
(0, chai_1.expect)(result[0].price).to.equal(sortedVehicles[1].price);
|
|
92
|
+
(0, chai_1.expect)(result[1].price).to.equal(sortedVehicles[2].price);
|
|
93
|
+
}
|
|
94
|
+
async function Pluck() {
|
|
95
|
+
const result = await table.pluck("car", "price").run();
|
|
96
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
97
|
+
(0, chai_1.expect)(result).to.have.lengthOf(vehicles_1.vehicles.length);
|
|
98
|
+
result.forEach((doc) => {
|
|
99
|
+
(0, chai_1.expect)(doc).to.have.property("car");
|
|
100
|
+
(0, chai_1.expect)(doc).to.have.property("price");
|
|
101
|
+
(0, chai_1.expect)(doc).to.not.have.property("isElectric");
|
|
102
|
+
(0, chai_1.expect)(doc).to.not.have.property("kilometers");
|
|
103
|
+
(0, chai_1.expect)(doc).to.not.have.property("manufactured");
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async function Without() {
|
|
107
|
+
const result = await table.without("kilometers").run();
|
|
108
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
109
|
+
(0, chai_1.expect)(result).to.have.lengthOf(vehicles_1.vehicles.length);
|
|
110
|
+
result.forEach((doc) => {
|
|
111
|
+
(0, chai_1.expect)(doc).to.not.have.property("kilometers");
|
|
112
|
+
(0, chai_1.expect)(doc).to.have.property("car");
|
|
113
|
+
(0, chai_1.expect)(doc).to.have.property("price");
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async function Distinct() {
|
|
117
|
+
const result = await table.distinct("isElectric").run();
|
|
118
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
119
|
+
const expectedDistinct = [...new Set(vehicles_1.vehicles.map((v) => v.isElectric))];
|
|
120
|
+
(0, chai_1.expect)(result).to.have.lengthOf(expectedDistinct.length);
|
|
121
|
+
expectedDistinct.forEach((val) => {
|
|
122
|
+
(0, chai_1.expect)(result).to.include(val);
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
async function DistinctWithoutField() {
|
|
126
|
+
const result = await table.distinct().run();
|
|
127
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
128
|
+
(0, chai_1.expect)(result).to.have.lengthOf(vehicles_1.vehicles.length);
|
|
129
|
+
result.forEach((doc) => {
|
|
130
|
+
(0, chai_1.expect)(doc).to.have.property("car");
|
|
131
|
+
(0, chai_1.expect)(doc).to.have.property("price");
|
|
132
|
+
(0, chai_1.expect)(doc).to.have.property("isElectric");
|
|
133
|
+
});
|
|
134
|
+
const cars = result.map((doc) => doc.car).sort();
|
|
135
|
+
const expectedCars = vehicles_1.vehicles.map((v) => v.car).sort();
|
|
136
|
+
(0, chai_1.expect)(cars).to.deep.equal(expectedCars);
|
|
137
|
+
}
|
|
138
|
+
async function CursorTest() {
|
|
139
|
+
const sortedVehicles = [...vehicles_1.vehicles].sort((a, b) => a.price - b.price);
|
|
140
|
+
const cursor = table.orderBy("price", "asc").cursor();
|
|
141
|
+
const results = [];
|
|
142
|
+
let next = await cursor.next();
|
|
143
|
+
while (!next.done) {
|
|
144
|
+
results.push(next.value);
|
|
145
|
+
next = await cursor.next();
|
|
146
|
+
}
|
|
147
|
+
(0, chai_1.expect)(results).to.have.lengthOf(vehicles_1.vehicles.length);
|
|
148
|
+
results.forEach((doc, i) => {
|
|
149
|
+
(0, chai_1.expect)(doc).to.have.property("price", sortedVehicles[i].price);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async function CleanupTest() {
|
|
153
|
+
for (const key of insertedKeys) {
|
|
154
|
+
await table.get(key).delete().run();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=aggregation_operations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregation_operations.test.js","sourceRoot":"","sources":["../../src/tests/aggregation_operations.test.ts"],"names":[],"mappings":";;AAAA,uEAAwD;AACxD,+BAA8B;AAC9B,kDAAwD;AAExD,MAAM,SAAS,GAAG,YAAY,CAAC;AAC/B,MAAM,MAAM,GAAG,IAAI,2BAAM,CACvB,6BAA6B,EAC7B,EAAE,CAAC,SAAS,CAAC,EAAE,kBAAO,EAAE,CACzB,CAAC;AACF,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAE1D,IAAI,YAAY,GAAa,EAAE,CAAC;AAEhC,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,MAAM,CAAC,KAAK,IAAI,EAAE;QAChB,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;QAC7C,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,MAAM,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kBAAkB,EA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AE,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const interface_database_1 = require("@antelopejs/interface-database");
|
|
4
|
+
const chai_1 = require("chai");
|
|
5
|
+
const vehicles_1 = require("./datasets/vehicles");
|
|
6
|
+
const tableName = "test-table";
|
|
7
|
+
const schema = new interface_database_1.Schema("test-basic-operations", {
|
|
8
|
+
[tableName]: vehicles_1.Vehicle,
|
|
9
|
+
});
|
|
10
|
+
const table = schema.instance("default").table(tableName);
|
|
11
|
+
let insertedKeys = [];
|
|
12
|
+
const expectedVehicles = vehicles_1.vehicles.map((v) => ({ ...v }));
|
|
13
|
+
describe("Basic Operations", () => {
|
|
14
|
+
it("Insert", InsertTest);
|
|
15
|
+
it("Insert conflict update (existing doc)", InsertConflictUpdateTest);
|
|
16
|
+
it("Insert conflict replace (existing doc)", InsertConflictReplaceTest);
|
|
17
|
+
it("Insert conflict update (new doc)", InsertConflictUpdateNewDocTest);
|
|
18
|
+
it("Get", GetTest);
|
|
19
|
+
it("Get All", GetAllTest);
|
|
20
|
+
it("Get By Index", GetAllMultiKeyByIndex);
|
|
21
|
+
it("Get All by primary keys", GetAllMultiKeyByPrimaryKey);
|
|
22
|
+
it("Get All With OrderBy", GetAllWithOrderBy);
|
|
23
|
+
it("Update", UpdateTest);
|
|
24
|
+
it("Replace", ReplaceTest);
|
|
25
|
+
it("Delete", DeleteTest);
|
|
26
|
+
before(async () => {
|
|
27
|
+
await schema.createInstance("default").run();
|
|
28
|
+
});
|
|
29
|
+
after(async () => {
|
|
30
|
+
await table.delete().run();
|
|
31
|
+
await schema.destroyInstance("default").run();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
async function InsertTest() {
|
|
35
|
+
const response = await table.insert(vehicles_1.vehicles).run();
|
|
36
|
+
(0, chai_1.expect)(response).to.be.an("array");
|
|
37
|
+
(0, chai_1.expect)(response).to.have.lengthOf(vehicles_1.vehicles.length);
|
|
38
|
+
response.forEach((val) => {
|
|
39
|
+
(0, chai_1.expect)(val).to.be.a("string");
|
|
40
|
+
});
|
|
41
|
+
insertedKeys = response;
|
|
42
|
+
}
|
|
43
|
+
async function InsertConflictUpdateTest() {
|
|
44
|
+
const existingKey = insertedKeys[0];
|
|
45
|
+
const response = await table
|
|
46
|
+
.insert({ _id: existingKey, price: 9999 }, { conflict: "update" })
|
|
47
|
+
.run();
|
|
48
|
+
(0, chai_1.expect)(response).to.be.an("array").with.lengthOf(1);
|
|
49
|
+
(0, chai_1.expect)(response[0]).to.equal(existingKey);
|
|
50
|
+
const doc = await table.get(existingKey).run();
|
|
51
|
+
(0, chai_1.expect)(doc.price).to.equal(9999);
|
|
52
|
+
(0, chai_1.expect)(doc.car).to.equal(expectedVehicles[0].car);
|
|
53
|
+
expectedVehicles[0].price = 9999;
|
|
54
|
+
}
|
|
55
|
+
async function InsertConflictReplaceTest() {
|
|
56
|
+
const existingKey = insertedKeys[1];
|
|
57
|
+
const replacementData = {
|
|
58
|
+
_id: existingKey,
|
|
59
|
+
car: "BMW",
|
|
60
|
+
manufactured: new Date("2020-06-15"),
|
|
61
|
+
price: 35000,
|
|
62
|
+
isElectric: false,
|
|
63
|
+
kilometers: 50000,
|
|
64
|
+
};
|
|
65
|
+
const response = await table
|
|
66
|
+
.insert(replacementData, { conflict: "replace" })
|
|
67
|
+
.run();
|
|
68
|
+
(0, chai_1.expect)(response).to.be.an("array").with.lengthOf(1);
|
|
69
|
+
(0, chai_1.expect)(response[0]).to.equal(existingKey);
|
|
70
|
+
const doc = await table.get(existingKey).run();
|
|
71
|
+
(0, chai_1.expect)(doc.car).to.equal("BMW");
|
|
72
|
+
(0, chai_1.expect)(doc.price).to.equal(35000);
|
|
73
|
+
(0, chai_1.expect)(doc.isElectric).to.equal(false);
|
|
74
|
+
(0, chai_1.expect)(doc.kilometers).to.equal(50000);
|
|
75
|
+
expectedVehicles[1] = {
|
|
76
|
+
car: "BMW",
|
|
77
|
+
manufactured: new Date("2020-06-15"),
|
|
78
|
+
price: 35000,
|
|
79
|
+
isElectric: false,
|
|
80
|
+
kilometers: 50000,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async function InsertConflictUpdateNewDocTest() {
|
|
84
|
+
const newDoc = {
|
|
85
|
+
car: "Audi",
|
|
86
|
+
manufactured: new Date("2022-03-01"),
|
|
87
|
+
price: 45000,
|
|
88
|
+
isElectric: true,
|
|
89
|
+
kilometers: 10000,
|
|
90
|
+
};
|
|
91
|
+
const response = await table.insert(newDoc, { conflict: "update" }).run();
|
|
92
|
+
(0, chai_1.expect)(response).to.be.an("array").with.lengthOf(1);
|
|
93
|
+
(0, chai_1.expect)(response[0]).to.be.a("string");
|
|
94
|
+
const doc = await table.get(response[0]).run();
|
|
95
|
+
(0, chai_1.expect)(doc.car).to.equal("Audi");
|
|
96
|
+
(0, chai_1.expect)(doc.price).to.equal(45000);
|
|
97
|
+
await table.get(response[0]).delete().run();
|
|
98
|
+
}
|
|
99
|
+
async function GetTest() {
|
|
100
|
+
for (const key of insertedKeys) {
|
|
101
|
+
const result = await table.get(key).run();
|
|
102
|
+
validateDocumentStructure(result, key);
|
|
103
|
+
validateDocumentContent(result);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function findExpectedData(doc) {
|
|
107
|
+
return expectedVehicles.find((item) => item.car === doc.car &&
|
|
108
|
+
item.manufactured.getTime() === doc.manufactured.getTime() &&
|
|
109
|
+
item.price === doc.price &&
|
|
110
|
+
item.isElectric === doc.isElectric &&
|
|
111
|
+
Number(item.kilometers) === Number(doc.kilometers));
|
|
112
|
+
}
|
|
113
|
+
function validateDocumentStructure(result, expectedId) {
|
|
114
|
+
(0, chai_1.expect)(result).to.be.an("object");
|
|
115
|
+
(0, chai_1.expect)(result).to.have.property("_id", expectedId).and.to.be.a("string");
|
|
116
|
+
(0, chai_1.expect)(result).to.have.property("car").and.to.be.a("string");
|
|
117
|
+
(0, chai_1.expect)(result).to.have.property("manufactured").and.to.be.a("Date");
|
|
118
|
+
(0, chai_1.expect)(result).to.have.property("price").and.to.be.a("number");
|
|
119
|
+
(0, chai_1.expect)(result).to.have.property("isElectric").and.to.be.a("boolean");
|
|
120
|
+
(0, chai_1.expect)(result).to.have.property("kilometers").and.to.be.a("number");
|
|
121
|
+
}
|
|
122
|
+
function validateDocumentContent(result) {
|
|
123
|
+
const expected = findExpectedData(result);
|
|
124
|
+
(0, chai_1.expect)(expected).to.not.equal(undefined);
|
|
125
|
+
(0, chai_1.expect)(result).to.deep.include({
|
|
126
|
+
car: expected?.car,
|
|
127
|
+
price: expected?.price,
|
|
128
|
+
isElectric: expected?.isElectric,
|
|
129
|
+
kilometers: Number(expected?.kilometers),
|
|
130
|
+
});
|
|
131
|
+
(0, chai_1.expect)(result.manufactured.getTime()).to.equal(expected?.manufactured.getTime());
|
|
132
|
+
}
|
|
133
|
+
async function GetAllTest() {
|
|
134
|
+
const result = await table.getAll(false, "isElectric").run();
|
|
135
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
136
|
+
const expectedCount = expectedVehicles.filter((v) => !v.isElectric).length;
|
|
137
|
+
(0, chai_1.expect)(result).to.have.lengthOf(expectedCount);
|
|
138
|
+
for (const doc of result) {
|
|
139
|
+
validateDocumentStructure(doc, doc._id);
|
|
140
|
+
(0, chai_1.expect)(doc.isElectric).to.equal(false);
|
|
141
|
+
const expected = findExpectedData(doc);
|
|
142
|
+
(0, chai_1.expect)(expected).to.not.equal(undefined);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const TARGET_PRICES = [3000, 0];
|
|
146
|
+
async function GetAllMultiKeyByIndex() {
|
|
147
|
+
const result = await table.getAll(TARGET_PRICES, "price").run();
|
|
148
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
149
|
+
const expectedCount = expectedVehicles.filter((v) => TARGET_PRICES.includes(v.price)).length;
|
|
150
|
+
(0, chai_1.expect)(result).to.have.lengthOf(expectedCount);
|
|
151
|
+
for (const doc of result) {
|
|
152
|
+
validateDocumentStructure(doc, doc._id);
|
|
153
|
+
(0, chai_1.expect)(TARGET_PRICES).to.include(doc.price);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async function GetAllMultiKeyByPrimaryKey() {
|
|
157
|
+
const targetKeys = [insertedKeys[0], insertedKeys[2]];
|
|
158
|
+
const result = await table.getAll(targetKeys).run();
|
|
159
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
160
|
+
(0, chai_1.expect)(result).to.have.lengthOf(targetKeys.length);
|
|
161
|
+
for (const doc of result) {
|
|
162
|
+
(0, chai_1.expect)(targetKeys).to.include(doc._id);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async function GetAllWithOrderBy() {
|
|
166
|
+
const result = await table
|
|
167
|
+
.getAll(false, "isElectric")
|
|
168
|
+
.orderBy("price", "asc")
|
|
169
|
+
.run();
|
|
170
|
+
(0, chai_1.expect)(result).to.be.an("array");
|
|
171
|
+
const expectedCount = expectedVehicles.filter((v) => !v.isElectric).length;
|
|
172
|
+
(0, chai_1.expect)(result).to.have.lengthOf(expectedCount);
|
|
173
|
+
const expectedOrder = ["Peugeot", "BMW"];
|
|
174
|
+
result.forEach((doc, index) => {
|
|
175
|
+
(0, chai_1.expect)(doc.car).to.equal(expectedOrder[index]);
|
|
176
|
+
(0, chai_1.expect)(doc.isElectric).to.equal(false);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
async function UpdateTest() {
|
|
180
|
+
const result = await table.get(insertedKeys[0]).update({ price: 4000 }).run();
|
|
181
|
+
(0, chai_1.expect)(result).to.equal(1);
|
|
182
|
+
expectedVehicles[0].price = 4000;
|
|
183
|
+
const doc = await table.get(insertedKeys[0]).run();
|
|
184
|
+
(0, chai_1.expect)(doc).to.not.equal(undefined);
|
|
185
|
+
validateDocumentStructure(doc, insertedKeys[0]);
|
|
186
|
+
validateDocumentContent(doc);
|
|
187
|
+
(0, chai_1.expect)(doc.price).to.equal(expectedVehicles[0].price);
|
|
188
|
+
}
|
|
189
|
+
async function ReplaceTest() {
|
|
190
|
+
const replacementData = {
|
|
191
|
+
car: "Tesla",
|
|
192
|
+
manufactured: new Date("2023-01-01"),
|
|
193
|
+
price: 50000,
|
|
194
|
+
isElectric: true,
|
|
195
|
+
kilometers: 100000,
|
|
196
|
+
};
|
|
197
|
+
const result = await table
|
|
198
|
+
.get(insertedKeys[1])
|
|
199
|
+
.replace(replacementData)
|
|
200
|
+
.run();
|
|
201
|
+
(0, chai_1.expect)(result).to.equal(1);
|
|
202
|
+
const doc = await table.get(insertedKeys[1]).run();
|
|
203
|
+
(0, chai_1.expect)(doc).to.not.equal(undefined);
|
|
204
|
+
validateDocumentStructure(doc, insertedKeys[1]);
|
|
205
|
+
(0, chai_1.expect)(doc.car).to.equal(replacementData.car);
|
|
206
|
+
(0, chai_1.expect)(doc.price).to.equal(replacementData.price);
|
|
207
|
+
(0, chai_1.expect)(doc.isElectric).to.equal(replacementData.isElectric);
|
|
208
|
+
(0, chai_1.expect)(doc.kilometers).to.equal(Number(replacementData.kilometers));
|
|
209
|
+
}
|
|
210
|
+
async function DeleteTest() {
|
|
211
|
+
const result = await table.get(insertedKeys[2]).delete().run();
|
|
212
|
+
(0, chai_1.expect)(result).to.equal(1);
|
|
213
|
+
const doc = await table.get(insertedKeys[2]).run();
|
|
214
|
+
(0, chai_1.expect)(doc).to.equal(undefined);
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=basic_operations.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic_operations.test.js","sourceRoot":"","sources":["../../src/tests/basic_operations.test.ts"],"names":[],"mappings":";;AAAA,uEAAwD;AACxD,+BAA8B;AAC9B,kDAAwD;AAExD,MAAM,SAAS,GAAG,YAAY,CAAC;AAC/B,MAAM,MAAM,GAAG,IAAI,2BA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