@model-ts/dynamodb 0.1.2 → 0.2.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/CHANGELOG.md +6 -0
- package/README.md +169 -1
- package/dist/cjs/__test__/client.test.js +85 -57
- package/dist/cjs/__test__/client.test.js.map +1 -1
- package/dist/cjs/client.js +2 -2
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/dynamodb-model.d.ts +4 -0
- package/dist/cjs/operations.d.ts +4 -0
- package/dist/cjs/operations.js.map +1 -1
- package/dist/cjs/pagination.d.ts +10 -2
- package/dist/cjs/pagination.js +19 -4
- package/dist/cjs/pagination.js.map +1 -1
- package/dist/cjs/provider.d.ts +16 -0
- package/dist/cjs/provider.js +4 -0
- package/dist/cjs/provider.js.map +1 -1
- package/dist/cjs/sandbox.js +24 -0
- package/dist/cjs/sandbox.js.map +1 -1
- package/dist/esm/__test__/client.test.js +86 -58
- package/dist/esm/__test__/client.test.js.map +1 -1
- package/dist/esm/client.js +2 -2
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/dynamodb-model.d.ts +4 -0
- package/dist/esm/operations.d.ts +4 -0
- package/dist/esm/operations.js.map +1 -1
- package/dist/esm/pagination.d.ts +10 -2
- package/dist/esm/pagination.js +19 -4
- package/dist/esm/pagination.js.map +1 -1
- package/dist/esm/provider.d.ts +16 -0
- package/dist/esm/provider.js +4 -0
- package/dist/esm/provider.js.map +1 -1
- package/dist/esm/sandbox.js +24 -0
- package/dist/esm/sandbox.js.map +1 -1
- package/package.json +1 -1
- package/src/__test__/client.test.ts +86 -58
- package/src/client.ts +13 -8
- package/src/dynamodb-model.ts +16 -14
- package/src/operations.ts +4 -0
- package/src/pagination.ts +42 -8
- package/src/provider.ts +5 -1
- package/src/sandbox.ts +24 -0
|
@@ -11,7 +11,7 @@ const client = new client_1.Client({ tableName: "table" });
|
|
|
11
11
|
const provider = provider_1.getProvider(client);
|
|
12
12
|
const SIMPLE_CODEC = t.type({
|
|
13
13
|
foo: t.string,
|
|
14
|
-
bar: t.number
|
|
14
|
+
bar: t.number
|
|
15
15
|
});
|
|
16
16
|
class Simple extends core_1.model("Simple", SIMPLE_CODEC, provider) {
|
|
17
17
|
get PK() {
|
|
@@ -54,6 +54,18 @@ class MultiGSI extends core_1.model("MultiGSI", SIMPLE_CODEC, provider) {
|
|
|
54
54
|
get GSI3SK() {
|
|
55
55
|
return `GSI3SK#${this.bar}${this.bar}`;
|
|
56
56
|
}
|
|
57
|
+
get GSI4PK() {
|
|
58
|
+
return `GSI4PK#FIXED`;
|
|
59
|
+
}
|
|
60
|
+
get GSI4SK() {
|
|
61
|
+
return `GSI4SK#${this.bar}${this.bar}`;
|
|
62
|
+
}
|
|
63
|
+
get GSI5PK() {
|
|
64
|
+
return `GSI5PK#FIXED`;
|
|
65
|
+
}
|
|
66
|
+
get GSI5SK() {
|
|
67
|
+
return `GSI5SK#${this.bar}${this.bar}`;
|
|
68
|
+
}
|
|
57
69
|
}
|
|
58
70
|
class A extends core_1.model("A", t.type({ pk: t.string, sk: t.string, a: t.number }), provider) {
|
|
59
71
|
get PK() {
|
|
@@ -154,6 +166,10 @@ describe("put", () => {
|
|
|
154
166
|
+ "GSI2SK": "GSI2SK#FIXED",
|
|
155
167
|
+ "GSI3PK": "GSI3PK#FIXED",
|
|
156
168
|
+ "GSI3SK": "GSI3SK#4242",
|
|
169
|
+
+ "GSI4PK": "GSI4PK#FIXED",
|
|
170
|
+
+ "GSI4SK": "GSI4SK#4242",
|
|
171
|
+
+ "GSI5PK": "GSI5PK#FIXED",
|
|
172
|
+
+ "GSI5SK": "GSI5SK#4242",
|
|
157
173
|
+ "PK": "PK#yes",
|
|
158
174
|
+ "SK": "SK#42",
|
|
159
175
|
+ "_docVersion": 0,
|
|
@@ -233,6 +249,10 @@ describe("put", () => {
|
|
|
233
249
|
+ "GSI2SK": "GSI2SK#FIXED",
|
|
234
250
|
+ "GSI3PK": "GSI3PK#FIXED",
|
|
235
251
|
+ "GSI3SK": "GSI3SK#4242",
|
|
252
|
+
+ "GSI4PK": "GSI4PK#FIXED",
|
|
253
|
+
+ "GSI4SK": "GSI4SK#4242",
|
|
254
|
+
+ "GSI5PK": "GSI5PK#FIXED",
|
|
255
|
+
+ "GSI5SK": "GSI5SK#4242",
|
|
236
256
|
+ "PK": "PK#yes",
|
|
237
257
|
+ "SK": "SK#42",
|
|
238
258
|
+ "_docVersion": 0,
|
|
@@ -250,7 +270,7 @@ describe("put", () => {
|
|
|
250
270
|
test("it overwrites item if `ignoreExistence` is set", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
251
271
|
yield MultiGSI.put(new MultiGSI({ foo: "yes", bar: 42 }));
|
|
252
272
|
yield expect(MultiGSI.put(new MultiGSI({ foo: "yes", bar: 42 }), {
|
|
253
|
-
IgnoreExistence: true
|
|
273
|
+
IgnoreExistence: true
|
|
254
274
|
})).resolves.toBeInstanceOf(MultiGSI);
|
|
255
275
|
}));
|
|
256
276
|
});
|
|
@@ -264,7 +284,7 @@ describe("get", () => {
|
|
|
264
284
|
const item = yield new Simple({ foo: "hi", bar: 432 }).put();
|
|
265
285
|
const result = yield Simple.get({
|
|
266
286
|
PK: item.keys().PK,
|
|
267
|
-
SK: item.keys().SK
|
|
287
|
+
SK: item.keys().SK
|
|
268
288
|
});
|
|
269
289
|
expect(result.values()).toMatchInlineSnapshot(`
|
|
270
290
|
Object {
|
|
@@ -311,8 +331,8 @@ describe("delete", () => {
|
|
|
311
331
|
_model: Simple,
|
|
312
332
|
key: {
|
|
313
333
|
PK: item.keys().PK,
|
|
314
|
-
SK: item.keys().SK
|
|
315
|
-
}
|
|
334
|
+
SK: item.keys().SK
|
|
335
|
+
}
|
|
316
336
|
});
|
|
317
337
|
expect(result).toBeNull();
|
|
318
338
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
@@ -340,7 +360,7 @@ describe("delete", () => {
|
|
|
340
360
|
const before = yield sandbox.snapshot();
|
|
341
361
|
const result = yield Simple.delete({
|
|
342
362
|
PK: item.keys().PK,
|
|
343
|
-
SK: item.keys().SK
|
|
363
|
+
SK: item.keys().SK
|
|
344
364
|
});
|
|
345
365
|
expect(result).toBeNull();
|
|
346
366
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
@@ -413,13 +433,17 @@ describe("softDelete", () => {
|
|
|
413
433
|
- First value
|
|
414
434
|
+ Second value
|
|
415
435
|
|
|
416
|
-
@@ -1,
|
|
436
|
+
@@ -1,25 +1,27 @@
|
|
417
437
|
Object {
|
|
418
438
|
- "PK#hello__SK#42": Object {
|
|
419
439
|
- "GSI2PK": "GSI2PK#hellohello",
|
|
420
440
|
- "GSI2SK": "GSI2SK#FIXED",
|
|
421
441
|
- "GSI3PK": "GSI3PK#FIXED",
|
|
422
442
|
- "GSI3SK": "GSI3SK#4242",
|
|
443
|
+
- "GSI4PK": "GSI4PK#FIXED",
|
|
444
|
+
- "GSI4SK": "GSI4SK#4242",
|
|
445
|
+
- "GSI5PK": "GSI5PK#FIXED",
|
|
446
|
+
- "GSI5SK": "GSI5SK#4242",
|
|
423
447
|
- "PK": "PK#hello",
|
|
424
448
|
- "SK": "SK#42",
|
|
425
449
|
+ "$$DELETED$$PK#hello__$$DELETED$$SK#42": Object {
|
|
@@ -427,6 +451,10 @@ describe("softDelete", () => {
|
|
|
427
451
|
+ "GSI2SK": "$$DELETED$$GSI2SK#FIXED",
|
|
428
452
|
+ "GSI3PK": "$$DELETED$$GSI3PK#FIXED",
|
|
429
453
|
+ "GSI3SK": "$$DELETED$$GSI3SK#4242",
|
|
454
|
+
+ "GSI4PK": "$$DELETED$$GSI4PK#FIXED",
|
|
455
|
+
+ "GSI4SK": "$$DELETED$$GSI4SK#4242",
|
|
456
|
+
+ "GSI5PK": "$$DELETED$$GSI5PK#FIXED",
|
|
457
|
+
+ "GSI5SK": "$$DELETED$$GSI5SK#4242",
|
|
430
458
|
+ "PK": "$$DELETED$$PK#hello",
|
|
431
459
|
+ "SK": "$$DELETED$$SK#42",
|
|
432
460
|
+ "_deletedAt": "2021-05-01T08:00:00.000Z",
|
|
@@ -644,7 +672,7 @@ describe("query", () => {
|
|
|
644
672
|
test("it returns empty results", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
645
673
|
expect(yield client.query({
|
|
646
674
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
647
|
-
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT" }
|
|
675
|
+
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT" }
|
|
648
676
|
}, { a: A, b: B, union: Union })).toMatchInlineSnapshot(`
|
|
649
677
|
Object {
|
|
650
678
|
"_unknown": Array [],
|
|
@@ -661,7 +689,7 @@ describe("query", () => {
|
|
|
661
689
|
yield sandbox.seed({ PK: "abc", SK: "SORT#1", doesnt: "match" });
|
|
662
690
|
expect(yield client.query({
|
|
663
691
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
664
|
-
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" }
|
|
692
|
+
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" }
|
|
665
693
|
}, { a: A, b: B, union: Union })).toMatchInlineSnapshot(`
|
|
666
694
|
Object {
|
|
667
695
|
"_unknown": Array [
|
|
@@ -684,14 +712,14 @@ describe("query", () => {
|
|
|
684
712
|
yield sandbox.seed(new A({ pk: "abc", sk: "SORT#1", a: 1 }), new A({ pk: "abc", sk: "SORT#2", a: 2 }), new B({ pk: "abc", sk: "SORT#3", b: "hi" }), { PK: "abc", SK: "SORT#4", probably: "unknown" }, new C({ pk: "abc", sk: "SORT#5", c: "hi" }), new D({ pk: "abc", sk: "SORT#6", d: "hi" }));
|
|
685
713
|
const { a, b, union, _unknown, meta } = yield client.query({
|
|
686
714
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
687
|
-
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" }
|
|
715
|
+
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" }
|
|
688
716
|
}, { a: A, b: B, union: Union });
|
|
689
717
|
expect({
|
|
690
718
|
meta: meta,
|
|
691
719
|
_unknown: _unknown,
|
|
692
|
-
a: a.map(
|
|
693
|
-
b: b.map(
|
|
694
|
-
union: union.map(
|
|
720
|
+
a: a.map(item => item.values()),
|
|
721
|
+
b: b.map(item => item.values()),
|
|
722
|
+
union: union.map(item => item.values())
|
|
695
723
|
}).toMatchInlineSnapshot(`
|
|
696
724
|
Object {
|
|
697
725
|
"_unknown": Array [
|
|
@@ -743,7 +771,7 @@ describe("query", () => {
|
|
|
743
771
|
const firstPage = yield client.query({
|
|
744
772
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
745
773
|
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
746
|
-
Limit: 30
|
|
774
|
+
Limit: 30
|
|
747
775
|
}, { a: A, b: B });
|
|
748
776
|
expect(firstPage.a.length).toBe(20);
|
|
749
777
|
expect(firstPage.b.length).toBe(10);
|
|
@@ -753,7 +781,7 @@ describe("query", () => {
|
|
|
753
781
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
754
782
|
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
755
783
|
Limit: 30,
|
|
756
|
-
ExclusiveStartKey: firstPage.meta.lastEvaluatedKey
|
|
784
|
+
ExclusiveStartKey: firstPage.meta.lastEvaluatedKey
|
|
757
785
|
}, { a: A, b: B });
|
|
758
786
|
expect(secondPage.a.length).toBe(0);
|
|
759
787
|
expect(secondPage.b.length).toBe(10);
|
|
@@ -767,7 +795,7 @@ describe("query", () => {
|
|
|
767
795
|
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
768
796
|
FetchAllPages: true,
|
|
769
797
|
// You wouldn't set a limit in a real-world use case here to optimize fetching all items.
|
|
770
|
-
Limit: 10
|
|
798
|
+
Limit: 10
|
|
771
799
|
}, { a: A, b: B });
|
|
772
800
|
expect(a.length).toBe(20);
|
|
773
801
|
expect(b.length).toBe(20);
|
|
@@ -791,16 +819,16 @@ describe("bulk", () => {
|
|
|
791
819
|
new B({
|
|
792
820
|
pk: "PK#UPDATE",
|
|
793
821
|
sk: "SK#UPDATE",
|
|
794
|
-
b: "bar"
|
|
822
|
+
b: "bar"
|
|
795
823
|
}).operation("update", { b: "baz" }),
|
|
796
824
|
new B({
|
|
797
825
|
pk: "PK#COND",
|
|
798
826
|
sk: "SK#COND",
|
|
799
|
-
b: "cond"
|
|
827
|
+
b: "cond"
|
|
800
828
|
}).operation("condition", {
|
|
801
829
|
ConditionExpression: "b = :cond",
|
|
802
|
-
ExpressionAttributeValues: { ":cond": "cond" }
|
|
803
|
-
})
|
|
830
|
+
ExpressionAttributeValues: { ":cond": "cond" }
|
|
831
|
+
})
|
|
804
832
|
]);
|
|
805
833
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
806
834
|
Snapshot Diff:
|
|
@@ -904,7 +932,7 @@ describe("bulk", () => {
|
|
|
904
932
|
A.operation("put", new A({ pk: "PK5", sk: "PK5", a: 5 })),
|
|
905
933
|
new B({ pk: "PK#6", sk: "SK#6", b: "baz" }).operation("put"),
|
|
906
934
|
// Fails
|
|
907
|
-
A.operation("updateRaw", { PK: "PK#nicetry", SK: "SK#nope" }, { a: 234 })
|
|
935
|
+
A.operation("updateRaw", { PK: "PK#nicetry", SK: "SK#nope" }, { a: 234 })
|
|
908
936
|
])).rejects.toBeInstanceOf(errors_1.BulkWriteTransactionError);
|
|
909
937
|
expect(yield sandbox.snapshot()).toEqual(before);
|
|
910
938
|
}));
|
|
@@ -923,9 +951,9 @@ describe("bulk", () => {
|
|
|
923
951
|
new B({
|
|
924
952
|
pk: "PK#UPDATE",
|
|
925
953
|
sk: "SK#UPDATE",
|
|
926
|
-
b: "bar"
|
|
954
|
+
b: "bar"
|
|
927
955
|
}).operation("update", { b: "baz" }),
|
|
928
|
-
...Array.from({ length: 25 }).map((_, i) => new A({ pk: `PK#A${i}`, sk: `SK#A${i}`, a: i }).operation("put"))
|
|
956
|
+
...Array.from({ length: 25 }).map((_, i) => new A({ pk: `PK#A${i}`, sk: `SK#A${i}`, a: i }).operation("put"))
|
|
929
957
|
]);
|
|
930
958
|
//#region snapshot
|
|
931
959
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
@@ -1226,7 +1254,7 @@ describe("bulk", () => {
|
|
|
1226
1254
|
// Succeeds
|
|
1227
1255
|
...Array.from({ length: 40 }).map((_, i) => new A({ pk: `PK#${i}`, sk: `SK#${i}`, a: i }).operation("put")),
|
|
1228
1256
|
// Fails
|
|
1229
|
-
A.operation("condition", { PK: "nicetry", SK: "nope" }, { ConditionExpression: "attribute_exists(PK)" })
|
|
1257
|
+
A.operation("condition", { PK: "nicetry", SK: "nope" }, { ConditionExpression: "attribute_exists(PK)" })
|
|
1230
1258
|
])).rejects.toBeInstanceOf(errors_1.BulkWriteTransactionError);
|
|
1231
1259
|
expect(yield sandbox.snapshot()).toEqual(before);
|
|
1232
1260
|
}));
|
|
@@ -1250,7 +1278,7 @@ describe("batchGet", () => {
|
|
|
1250
1278
|
two: A.operation("get", { PK: "PK#2", SK: "SK#2" }),
|
|
1251
1279
|
three: A.operation("get", { PK: "PK#3", SK: "SK#3" }),
|
|
1252
1280
|
four: A.operation("get", { PK: "PK#4", SK: "SK#4" }),
|
|
1253
|
-
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" })
|
|
1281
|
+
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" })
|
|
1254
1282
|
})).rejects.toBeInstanceOf(errors_1.ItemNotFoundError);
|
|
1255
1283
|
}));
|
|
1256
1284
|
test("it returns individual errors", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1260,7 +1288,7 @@ describe("batchGet", () => {
|
|
|
1260
1288
|
two: A.operation("get", { PK: "PK#2", SK: "SK#2" }),
|
|
1261
1289
|
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" }),
|
|
1262
1290
|
error: A.operation("get", { PK: "PK#error", SK: "SK#error" }),
|
|
1263
|
-
error2: A.operation("get", { PK: "PK#error2", SK: "SK#error2" })
|
|
1291
|
+
error2: A.operation("get", { PK: "PK#error2", SK: "SK#error2" })
|
|
1264
1292
|
}, { individualErrors: true });
|
|
1265
1293
|
expect(result.one).toBeInstanceOf(A);
|
|
1266
1294
|
expect(result.two).toBeInstanceOf(A);
|
|
@@ -1274,7 +1302,7 @@ describe("batchGet", () => {
|
|
|
1274
1302
|
two: A.operation("get", { PK: "PK#2", SK: "SK#2" }),
|
|
1275
1303
|
three: A.operation("get", { PK: "PK#3", SK: "SK#3" }),
|
|
1276
1304
|
four: A.operation("get", { PK: "PK#4", SK: "SK#4" }),
|
|
1277
|
-
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" })
|
|
1305
|
+
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" })
|
|
1278
1306
|
});
|
|
1279
1307
|
expect(Object.fromEntries(Object.entries(results).map(([key, val]) => [key, val.values()]))).toMatchInlineSnapshot(`
|
|
1280
1308
|
Object {
|
|
@@ -1363,8 +1391,8 @@ describe("load", () => {
|
|
|
1363
1391
|
yield sandbox.seed(...items);
|
|
1364
1392
|
const results = yield Promise.all(items.map(({ PK, SK }, i) => Union.load({ PK, SK })));
|
|
1365
1393
|
expect(results.length).toBe(234);
|
|
1366
|
-
expect(results.filter(
|
|
1367
|
-
expect(results.filter(
|
|
1394
|
+
expect(results.filter(item => item instanceof C).length).toBe(123);
|
|
1395
|
+
expect(results.filter(item => item instanceof D).length).toBe(111);
|
|
1368
1396
|
expect(spy).toHaveBeenCalledTimes(3);
|
|
1369
1397
|
spy.mockReset();
|
|
1370
1398
|
spy.mockRestore();
|
|
@@ -1409,8 +1437,8 @@ describe("loadMany", () => {
|
|
|
1409
1437
|
yield sandbox.seed(...items);
|
|
1410
1438
|
const results = yield Union.loadMany(items.map(({ PK, SK }) => ({ PK, SK })));
|
|
1411
1439
|
expect(results.length).toBe(234);
|
|
1412
|
-
expect(results.filter(
|
|
1413
|
-
expect(results.filter(
|
|
1440
|
+
expect(results.filter(item => item instanceof C).length).toBe(123);
|
|
1441
|
+
expect(results.filter(item => item instanceof D).length).toBe(111);
|
|
1414
1442
|
expect(spy).toHaveBeenCalledTimes(3);
|
|
1415
1443
|
spy.mockReset();
|
|
1416
1444
|
spy.mockRestore();
|
|
@@ -1425,7 +1453,7 @@ describe("paginate", () => {
|
|
|
1425
1453
|
// Forwards
|
|
1426
1454
|
const page1 = yield client.paginate(C, {}, {
|
|
1427
1455
|
KeyConditionExpression: "PK = :pk",
|
|
1428
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1456
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1429
1457
|
});
|
|
1430
1458
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1431
1459
|
Object {
|
|
@@ -1440,7 +1468,7 @@ describe("paginate", () => {
|
|
|
1440
1468
|
expect(page1.edges[19].node.c).toBe("19");
|
|
1441
1469
|
const page2 = yield client.paginate(C, { after: page1.pageInfo.endCursor }, {
|
|
1442
1470
|
KeyConditionExpression: "PK = :pk",
|
|
1443
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1471
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1444
1472
|
});
|
|
1445
1473
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1446
1474
|
Object {
|
|
@@ -1455,7 +1483,7 @@ describe("paginate", () => {
|
|
|
1455
1483
|
expect(page2.edges[19].node.c).toBe("39");
|
|
1456
1484
|
const page3 = yield client.paginate(C, { after: page2.pageInfo.endCursor }, {
|
|
1457
1485
|
KeyConditionExpression: "PK = :pk",
|
|
1458
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1486
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1459
1487
|
});
|
|
1460
1488
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1461
1489
|
Object {
|
|
@@ -1471,7 +1499,7 @@ describe("paginate", () => {
|
|
|
1471
1499
|
// Backwards
|
|
1472
1500
|
const backwardsPage2 = yield client.paginate(C, { before: page3.pageInfo.startCursor }, {
|
|
1473
1501
|
KeyConditionExpression: "PK = :pk",
|
|
1474
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1502
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1475
1503
|
});
|
|
1476
1504
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1477
1505
|
Object {
|
|
@@ -1486,7 +1514,7 @@ describe("paginate", () => {
|
|
|
1486
1514
|
expect(backwardsPage2.edges[19].node.c).toBe("39");
|
|
1487
1515
|
const backwardsPage1 = yield client.paginate(C, { before: backwardsPage2.pageInfo.startCursor }, {
|
|
1488
1516
|
KeyConditionExpression: "PK = :pk",
|
|
1489
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1517
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1490
1518
|
});
|
|
1491
1519
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1492
1520
|
Object {
|
|
@@ -1508,7 +1536,7 @@ describe("paginate", () => {
|
|
|
1508
1536
|
// Forwards
|
|
1509
1537
|
const page1 = yield client.paginate(Union, {}, {
|
|
1510
1538
|
KeyConditionExpression: "PK = :pk",
|
|
1511
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1539
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1512
1540
|
});
|
|
1513
1541
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1514
1542
|
Object {
|
|
@@ -1523,7 +1551,7 @@ describe("paginate", () => {
|
|
|
1523
1551
|
expect(page1.edges[19].node.SK).toBe("019");
|
|
1524
1552
|
const page2 = yield client.paginate(Union, { after: page1.pageInfo.endCursor }, {
|
|
1525
1553
|
KeyConditionExpression: "PK = :pk",
|
|
1526
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1554
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1527
1555
|
});
|
|
1528
1556
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1529
1557
|
Object {
|
|
@@ -1538,7 +1566,7 @@ describe("paginate", () => {
|
|
|
1538
1566
|
expect(page2.edges[19].node.SK).toBe("039");
|
|
1539
1567
|
const page3 = yield client.paginate(Union, { after: page2.pageInfo.endCursor }, {
|
|
1540
1568
|
KeyConditionExpression: "PK = :pk",
|
|
1541
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1569
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1542
1570
|
});
|
|
1543
1571
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1544
1572
|
Object {
|
|
@@ -1554,7 +1582,7 @@ describe("paginate", () => {
|
|
|
1554
1582
|
// Backwards
|
|
1555
1583
|
const backwardsPage2 = yield client.paginate(Union, { before: page3.pageInfo.startCursor }, {
|
|
1556
1584
|
KeyConditionExpression: "PK = :pk",
|
|
1557
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1585
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1558
1586
|
});
|
|
1559
1587
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1560
1588
|
Object {
|
|
@@ -1569,7 +1597,7 @@ describe("paginate", () => {
|
|
|
1569
1597
|
expect(backwardsPage2.edges[19].node.SK).toBe("039");
|
|
1570
1598
|
const backwardsPage1 = yield client.paginate(Union, { before: backwardsPage2.pageInfo.startCursor }, {
|
|
1571
1599
|
KeyConditionExpression: "PK = :pk",
|
|
1572
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1600
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1573
1601
|
});
|
|
1574
1602
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1575
1603
|
Object {
|
|
@@ -1589,7 +1617,7 @@ describe("paginate", () => {
|
|
|
1589
1617
|
// Forwards
|
|
1590
1618
|
const page = yield client.paginate(C, { first: 10 }, {
|
|
1591
1619
|
KeyConditionExpression: "PK = :pk",
|
|
1592
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1620
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1593
1621
|
});
|
|
1594
1622
|
expect(page.pageInfo).toMatchInlineSnapshot(`
|
|
1595
1623
|
Object {
|
|
@@ -1609,7 +1637,7 @@ describe("paginate", () => {
|
|
|
1609
1637
|
// Forwards
|
|
1610
1638
|
const page1 = yield client.paginate(C, { first: 60 }, {
|
|
1611
1639
|
KeyConditionExpression: "PK = :pk",
|
|
1612
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1640
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1613
1641
|
});
|
|
1614
1642
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1615
1643
|
Object {
|
|
@@ -1631,7 +1659,7 @@ describe("paginate", () => {
|
|
|
1631
1659
|
// Forwards
|
|
1632
1660
|
const page1 = yield C.paginate({}, {
|
|
1633
1661
|
KeyConditionExpression: "PK = :pk",
|
|
1634
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1662
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1635
1663
|
});
|
|
1636
1664
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1637
1665
|
Object {
|
|
@@ -1646,7 +1674,7 @@ describe("paginate", () => {
|
|
|
1646
1674
|
expect(page1.edges[19].node.c).toBe("19");
|
|
1647
1675
|
const page2 = yield C.paginate({ after: page1.pageInfo.endCursor }, {
|
|
1648
1676
|
KeyConditionExpression: "PK = :pk",
|
|
1649
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1677
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1650
1678
|
});
|
|
1651
1679
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1652
1680
|
Object {
|
|
@@ -1661,7 +1689,7 @@ describe("paginate", () => {
|
|
|
1661
1689
|
expect(page2.edges[19].node.c).toBe("39");
|
|
1662
1690
|
const page3 = yield C.paginate({ after: page2.pageInfo.endCursor }, {
|
|
1663
1691
|
KeyConditionExpression: "PK = :pk",
|
|
1664
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1692
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1665
1693
|
});
|
|
1666
1694
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1667
1695
|
Object {
|
|
@@ -1677,7 +1705,7 @@ describe("paginate", () => {
|
|
|
1677
1705
|
// Backwards
|
|
1678
1706
|
const backwardsPage2 = yield C.paginate({ before: page3.pageInfo.startCursor }, {
|
|
1679
1707
|
KeyConditionExpression: "PK = :pk",
|
|
1680
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1708
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1681
1709
|
});
|
|
1682
1710
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1683
1711
|
Object {
|
|
@@ -1692,7 +1720,7 @@ describe("paginate", () => {
|
|
|
1692
1720
|
expect(backwardsPage2.edges[19].node.c).toBe("39");
|
|
1693
1721
|
const backwardsPage1 = yield C.paginate({ before: backwardsPage2.pageInfo.startCursor }, {
|
|
1694
1722
|
KeyConditionExpression: "PK = :pk",
|
|
1695
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1723
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1696
1724
|
});
|
|
1697
1725
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1698
1726
|
Object {
|
|
@@ -1712,7 +1740,7 @@ describe("paginate", () => {
|
|
|
1712
1740
|
// Forwards
|
|
1713
1741
|
const page = yield C.paginate({ first: 10 }, {
|
|
1714
1742
|
KeyConditionExpression: "PK = :pk",
|
|
1715
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1743
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1716
1744
|
});
|
|
1717
1745
|
expect(page.pageInfo).toMatchInlineSnapshot(`
|
|
1718
1746
|
Object {
|
|
@@ -1732,7 +1760,7 @@ describe("paginate", () => {
|
|
|
1732
1760
|
// Forwards
|
|
1733
1761
|
const page1 = yield C.paginate({ first: 60 }, {
|
|
1734
1762
|
KeyConditionExpression: "PK = :pk",
|
|
1735
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1763
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1736
1764
|
});
|
|
1737
1765
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1738
1766
|
Object {
|
|
@@ -1756,7 +1784,7 @@ describe("paginate", () => {
|
|
|
1756
1784
|
// Forwards
|
|
1757
1785
|
const page1 = yield Union.paginate({}, {
|
|
1758
1786
|
KeyConditionExpression: "PK = :pk",
|
|
1759
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1787
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1760
1788
|
});
|
|
1761
1789
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1762
1790
|
Object {
|
|
@@ -1771,7 +1799,7 @@ describe("paginate", () => {
|
|
|
1771
1799
|
expect(page1.edges[19].node.SK).toBe("019");
|
|
1772
1800
|
const page2 = yield Union.paginate({ after: page1.pageInfo.endCursor }, {
|
|
1773
1801
|
KeyConditionExpression: "PK = :pk",
|
|
1774
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1802
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1775
1803
|
});
|
|
1776
1804
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1777
1805
|
Object {
|
|
@@ -1786,7 +1814,7 @@ describe("paginate", () => {
|
|
|
1786
1814
|
expect(page2.edges[19].node.SK).toBe("039");
|
|
1787
1815
|
const page3 = yield Union.paginate({ after: page2.pageInfo.endCursor }, {
|
|
1788
1816
|
KeyConditionExpression: "PK = :pk",
|
|
1789
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1817
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1790
1818
|
});
|
|
1791
1819
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1792
1820
|
Object {
|
|
@@ -1802,7 +1830,7 @@ describe("paginate", () => {
|
|
|
1802
1830
|
// Backwards
|
|
1803
1831
|
const backwardsPage2 = yield Union.paginate({ before: page3.pageInfo.startCursor }, {
|
|
1804
1832
|
KeyConditionExpression: "PK = :pk",
|
|
1805
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1833
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1806
1834
|
});
|
|
1807
1835
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1808
1836
|
Object {
|
|
@@ -1817,7 +1845,7 @@ describe("paginate", () => {
|
|
|
1817
1845
|
expect(backwardsPage2.edges[19].node.SK).toBe("039");
|
|
1818
1846
|
const backwardsPage1 = yield Union.paginate({ before: backwardsPage2.pageInfo.startCursor }, {
|
|
1819
1847
|
KeyConditionExpression: "PK = :pk",
|
|
1820
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1848
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1821
1849
|
});
|
|
1822
1850
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1823
1851
|
Object {
|
|
@@ -1839,7 +1867,7 @@ describe("paginate", () => {
|
|
|
1839
1867
|
// Forwards
|
|
1840
1868
|
const page = yield Union.paginate({ first: 10 }, {
|
|
1841
1869
|
KeyConditionExpression: "PK = :pk",
|
|
1842
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1870
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1843
1871
|
});
|
|
1844
1872
|
expect(page.pageInfo).toMatchInlineSnapshot(`
|
|
1845
1873
|
Object {
|
|
@@ -1861,7 +1889,7 @@ describe("paginate", () => {
|
|
|
1861
1889
|
// Forwards
|
|
1862
1890
|
const page1 = yield Union.paginate({ first: 60 }, {
|
|
1863
1891
|
KeyConditionExpression: "PK = :pk",
|
|
1864
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1892
|
+
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1865
1893
|
});
|
|
1866
1894
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1867
1895
|
Object {
|