@model-ts/dynamodb 1.1.0 → 1.2.1
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 +12 -0
- package/dist/cjs/__test__/client.test.js +77 -56
- package/dist/cjs/__test__/client.test.js.map +1 -1
- package/dist/cjs/client.d.ts +7 -2
- package/dist/cjs/client.js +18 -2
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/provider.d.ts +14 -4
- package/dist/cjs/provider.js +2 -2
- package/dist/cjs/provider.js.map +1 -1
- package/dist/esm/__test__/client.test.js +78 -57
- package/dist/esm/__test__/client.test.js.map +1 -1
- package/dist/esm/client.d.ts +7 -2
- package/dist/esm/client.js +18 -2
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/provider.d.ts +14 -4
- package/dist/esm/provider.js +2 -2
- package/dist/esm/provider.js.map +1 -1
- package/package.json +2 -2
- package/src/__test__/client.test.ts +92 -57
- package/src/client.ts +34 -4
- package/src/provider.ts +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @model-ts/dynamodb
|
|
2
2
|
|
|
3
|
+
## 1.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- abb6c2e: fix: proxy recover flag to client implementation
|
|
8
|
+
|
|
9
|
+
## 1.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 4fd7913: add option to load soft-deleted items
|
|
14
|
+
|
|
3
15
|
## 1.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -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() {
|
|
@@ -270,7 +270,7 @@ describe("put", () => {
|
|
|
270
270
|
test("it overwrites item if `ignoreExistence` is set", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
271
271
|
yield MultiGSI.put(new MultiGSI({ foo: "yes", bar: 42 }));
|
|
272
272
|
yield expect(MultiGSI.put(new MultiGSI({ foo: "yes", bar: 42 }), {
|
|
273
|
-
IgnoreExistence: true
|
|
273
|
+
IgnoreExistence: true,
|
|
274
274
|
})).resolves.toBeInstanceOf(MultiGSI);
|
|
275
275
|
}));
|
|
276
276
|
});
|
|
@@ -284,7 +284,7 @@ describe("get", () => {
|
|
|
284
284
|
const item = yield new Simple({ foo: "hi", bar: 432 }).put();
|
|
285
285
|
const result = yield Simple.get({
|
|
286
286
|
PK: item.keys().PK,
|
|
287
|
-
SK: item.keys().SK
|
|
287
|
+
SK: item.keys().SK,
|
|
288
288
|
});
|
|
289
289
|
expect(result.values()).toMatchInlineSnapshot(`
|
|
290
290
|
Object {
|
|
@@ -331,8 +331,8 @@ describe("delete", () => {
|
|
|
331
331
|
_model: Simple,
|
|
332
332
|
key: {
|
|
333
333
|
PK: item.keys().PK,
|
|
334
|
-
SK: item.keys().SK
|
|
335
|
-
}
|
|
334
|
+
SK: item.keys().SK,
|
|
335
|
+
},
|
|
336
336
|
});
|
|
337
337
|
expect(result).toBeNull();
|
|
338
338
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
@@ -360,7 +360,7 @@ describe("delete", () => {
|
|
|
360
360
|
const before = yield sandbox.snapshot();
|
|
361
361
|
const result = yield Simple.delete({
|
|
362
362
|
PK: item.keys().PK,
|
|
363
|
-
SK: item.keys().SK
|
|
363
|
+
SK: item.keys().SK,
|
|
364
364
|
});
|
|
365
365
|
expect(result).toBeNull();
|
|
366
366
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
@@ -672,7 +672,7 @@ describe("query", () => {
|
|
|
672
672
|
test("it returns empty results", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
673
673
|
expect(yield client.query({
|
|
674
674
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
675
|
-
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT" }
|
|
675
|
+
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT" },
|
|
676
676
|
}, { a: A, b: B, union: Union })).toMatchInlineSnapshot(`
|
|
677
677
|
Object {
|
|
678
678
|
"_unknown": Array [],
|
|
@@ -689,7 +689,7 @@ describe("query", () => {
|
|
|
689
689
|
yield sandbox.seed({ PK: "abc", SK: "SORT#1", doesnt: "match" });
|
|
690
690
|
expect(yield client.query({
|
|
691
691
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
692
|
-
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" }
|
|
692
|
+
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
693
693
|
}, { a: A, b: B, union: Union })).toMatchInlineSnapshot(`
|
|
694
694
|
Object {
|
|
695
695
|
"_unknown": Array [
|
|
@@ -712,14 +712,14 @@ describe("query", () => {
|
|
|
712
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" }));
|
|
713
713
|
const { a, b, union, _unknown, meta } = yield client.query({
|
|
714
714
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
715
|
-
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" }
|
|
715
|
+
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
716
716
|
}, { a: A, b: B, union: Union });
|
|
717
717
|
expect({
|
|
718
718
|
meta: meta,
|
|
719
719
|
_unknown: _unknown,
|
|
720
|
-
a: a.map(item => item.values()),
|
|
721
|
-
b: b.map(item => item.values()),
|
|
722
|
-
union: union.map(item => item.values())
|
|
720
|
+
a: a.map((item) => item.values()),
|
|
721
|
+
b: b.map((item) => item.values()),
|
|
722
|
+
union: union.map((item) => item.values()),
|
|
723
723
|
}).toMatchInlineSnapshot(`
|
|
724
724
|
Object {
|
|
725
725
|
"_unknown": Array [
|
|
@@ -771,7 +771,7 @@ describe("query", () => {
|
|
|
771
771
|
const firstPage = yield client.query({
|
|
772
772
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
773
773
|
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
774
|
-
Limit: 30
|
|
774
|
+
Limit: 30,
|
|
775
775
|
}, { a: A, b: B });
|
|
776
776
|
expect(firstPage.a.length).toBe(20);
|
|
777
777
|
expect(firstPage.b.length).toBe(10);
|
|
@@ -781,7 +781,7 @@ describe("query", () => {
|
|
|
781
781
|
KeyConditionExpression: `PK = :pk and begins_with(SK, :sk)`,
|
|
782
782
|
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
783
783
|
Limit: 30,
|
|
784
|
-
ExclusiveStartKey: firstPage.meta.lastEvaluatedKey
|
|
784
|
+
ExclusiveStartKey: firstPage.meta.lastEvaluatedKey,
|
|
785
785
|
}, { a: A, b: B });
|
|
786
786
|
expect(secondPage.a.length).toBe(0);
|
|
787
787
|
expect(secondPage.b.length).toBe(10);
|
|
@@ -795,7 +795,7 @@ describe("query", () => {
|
|
|
795
795
|
ExpressionAttributeValues: { ":pk": "abc", ":sk": "SORT#" },
|
|
796
796
|
FetchAllPages: true,
|
|
797
797
|
// You wouldn't set a limit in a real-world use case here to optimize fetching all items.
|
|
798
|
-
Limit: 10
|
|
798
|
+
Limit: 10,
|
|
799
799
|
}, { a: A, b: B });
|
|
800
800
|
expect(a.length).toBe(20);
|
|
801
801
|
expect(b.length).toBe(20);
|
|
@@ -819,16 +819,16 @@ describe("bulk", () => {
|
|
|
819
819
|
new B({
|
|
820
820
|
pk: "PK#UPDATE",
|
|
821
821
|
sk: "SK#UPDATE",
|
|
822
|
-
b: "bar"
|
|
822
|
+
b: "bar",
|
|
823
823
|
}).operation("update", { b: "baz" }),
|
|
824
824
|
new B({
|
|
825
825
|
pk: "PK#COND",
|
|
826
826
|
sk: "SK#COND",
|
|
827
|
-
b: "cond"
|
|
827
|
+
b: "cond",
|
|
828
828
|
}).operation("condition", {
|
|
829
829
|
ConditionExpression: "b = :cond",
|
|
830
|
-
ExpressionAttributeValues: { ":cond": "cond" }
|
|
831
|
-
})
|
|
830
|
+
ExpressionAttributeValues: { ":cond": "cond" },
|
|
831
|
+
}),
|
|
832
832
|
]);
|
|
833
833
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
834
834
|
Snapshot Diff:
|
|
@@ -932,7 +932,7 @@ describe("bulk", () => {
|
|
|
932
932
|
A.operation("put", new A({ pk: "PK5", sk: "PK5", a: 5 })),
|
|
933
933
|
new B({ pk: "PK#6", sk: "SK#6", b: "baz" }).operation("put"),
|
|
934
934
|
// Fails
|
|
935
|
-
A.operation("updateRaw", { PK: "PK#nicetry", SK: "SK#nope" }, { a: 234 })
|
|
935
|
+
A.operation("updateRaw", { PK: "PK#nicetry", SK: "SK#nope" }, { a: 234 }),
|
|
936
936
|
])).rejects.toBeInstanceOf(errors_1.BulkWriteTransactionError);
|
|
937
937
|
expect(yield sandbox.snapshot()).toEqual(before);
|
|
938
938
|
}));
|
|
@@ -951,9 +951,9 @@ describe("bulk", () => {
|
|
|
951
951
|
new B({
|
|
952
952
|
pk: "PK#UPDATE",
|
|
953
953
|
sk: "SK#UPDATE",
|
|
954
|
-
b: "bar"
|
|
954
|
+
b: "bar",
|
|
955
955
|
}).operation("update", { b: "baz" }),
|
|
956
|
-
...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")),
|
|
957
957
|
]);
|
|
958
958
|
//#region snapshot
|
|
959
959
|
expect(yield sandbox.diff(before)).toMatchInlineSnapshot(`
|
|
@@ -1254,7 +1254,7 @@ describe("bulk", () => {
|
|
|
1254
1254
|
// Succeeds
|
|
1255
1255
|
...Array.from({ length: 40 }).map((_, i) => new A({ pk: `PK#${i}`, sk: `SK#${i}`, a: i }).operation("put")),
|
|
1256
1256
|
// Fails
|
|
1257
|
-
A.operation("condition", { PK: "nicetry", SK: "nope" }, { ConditionExpression: "attribute_exists(PK)" })
|
|
1257
|
+
A.operation("condition", { PK: "nicetry", SK: "nope" }, { ConditionExpression: "attribute_exists(PK)" }),
|
|
1258
1258
|
])).rejects.toBeInstanceOf(errors_1.BulkWriteTransactionError);
|
|
1259
1259
|
expect(yield sandbox.snapshot()).toEqual(before);
|
|
1260
1260
|
}));
|
|
@@ -1278,7 +1278,7 @@ describe("batchGet", () => {
|
|
|
1278
1278
|
two: A.operation("get", { PK: "PK#2", SK: "SK#2" }),
|
|
1279
1279
|
three: A.operation("get", { PK: "PK#3", SK: "SK#3" }),
|
|
1280
1280
|
four: A.operation("get", { PK: "PK#4", SK: "SK#4" }),
|
|
1281
|
-
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" })
|
|
1281
|
+
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" }),
|
|
1282
1282
|
})).rejects.toBeInstanceOf(errors_1.ItemNotFoundError);
|
|
1283
1283
|
}));
|
|
1284
1284
|
test("it returns individual errors", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -1288,7 +1288,7 @@ describe("batchGet", () => {
|
|
|
1288
1288
|
two: A.operation("get", { PK: "PK#2", SK: "SK#2" }),
|
|
1289
1289
|
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" }),
|
|
1290
1290
|
error: A.operation("get", { PK: "PK#error", SK: "SK#error" }),
|
|
1291
|
-
error2: A.operation("get", { PK: "PK#error2", SK: "SK#error2" })
|
|
1291
|
+
error2: A.operation("get", { PK: "PK#error2", SK: "SK#error2" }),
|
|
1292
1292
|
}, { individualErrors: true });
|
|
1293
1293
|
expect(result.one).toBeInstanceOf(A);
|
|
1294
1294
|
expect(result.two).toBeInstanceOf(A);
|
|
@@ -1302,7 +1302,7 @@ describe("batchGet", () => {
|
|
|
1302
1302
|
two: A.operation("get", { PK: "PK#2", SK: "SK#2" }),
|
|
1303
1303
|
three: A.operation("get", { PK: "PK#3", SK: "SK#3" }),
|
|
1304
1304
|
four: A.operation("get", { PK: "PK#4", SK: "SK#4" }),
|
|
1305
|
-
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" })
|
|
1305
|
+
duplicate: A.operation("get", { PK: "PK#1", SK: "SK#1" }),
|
|
1306
1306
|
});
|
|
1307
1307
|
expect(Object.fromEntries(Object.entries(results).map(([key, val]) => [key, val.values()]))).toMatchInlineSnapshot(`
|
|
1308
1308
|
Object {
|
|
@@ -1343,6 +1343,27 @@ describe("load", () => {
|
|
|
1343
1343
|
test("it returns null instead of throwing if item doesn't exist", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1344
1344
|
yield expect(client.load(A.operation("get", { PK: "PK", SK: "SK" }), { null: true })).resolves.toBeNull();
|
|
1345
1345
|
}));
|
|
1346
|
+
test("it recovers a soft deleted item", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1347
|
+
const item = new A({ pk: "PK#1", sk: "SK#1", a: 1 });
|
|
1348
|
+
yield sandbox.seed(item);
|
|
1349
|
+
yield item.softDelete();
|
|
1350
|
+
const recovered = yield client.load(A.operation("get", { PK: "PK#1", SK: "SK#1" }), {
|
|
1351
|
+
recover: true,
|
|
1352
|
+
});
|
|
1353
|
+
expect(recovered).toBeInstanceOf(A);
|
|
1354
|
+
expect(recovered.isDeleted).toBe(true);
|
|
1355
|
+
}));
|
|
1356
|
+
test("it throws if no item or soft deleted item exists", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1357
|
+
yield expect(client.load(A.operation("get", { PK: "PK", SK: "SK" }), {
|
|
1358
|
+
recover: true,
|
|
1359
|
+
})).rejects.toBeInstanceOf(errors_1.ItemNotFoundError);
|
|
1360
|
+
}));
|
|
1361
|
+
test("it returns null instead of throwing if no item or soft deleted item exists", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1362
|
+
yield expect(client.load(A.operation("get", { PK: "PK", SK: "SK" }), {
|
|
1363
|
+
recover: true,
|
|
1364
|
+
null: true,
|
|
1365
|
+
})).resolves.toBeNull();
|
|
1366
|
+
}));
|
|
1346
1367
|
test("it fetches >100 items", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
1347
1368
|
const items = Array.from({ length: 234 }).map((_, i) => i < 100
|
|
1348
1369
|
? new A({ pk: String(i), sk: String(i), a: i })
|
|
@@ -1391,8 +1412,8 @@ describe("load", () => {
|
|
|
1391
1412
|
yield sandbox.seed(...items);
|
|
1392
1413
|
const results = yield Promise.all(items.map(({ PK, SK }, i) => Union.load({ PK, SK })));
|
|
1393
1414
|
expect(results.length).toBe(234);
|
|
1394
|
-
expect(results.filter(item => item instanceof C).length).toBe(123);
|
|
1395
|
-
expect(results.filter(item => item instanceof D).length).toBe(111);
|
|
1415
|
+
expect(results.filter((item) => item instanceof C).length).toBe(123);
|
|
1416
|
+
expect(results.filter((item) => item instanceof D).length).toBe(111);
|
|
1396
1417
|
expect(spy).toHaveBeenCalledTimes(3);
|
|
1397
1418
|
spy.mockReset();
|
|
1398
1419
|
spy.mockRestore();
|
|
@@ -1437,8 +1458,8 @@ describe("loadMany", () => {
|
|
|
1437
1458
|
yield sandbox.seed(...items);
|
|
1438
1459
|
const results = yield Union.loadMany(items.map(({ PK, SK }) => ({ PK, SK })));
|
|
1439
1460
|
expect(results.length).toBe(234);
|
|
1440
|
-
expect(results.filter(item => item instanceof C).length).toBe(123);
|
|
1441
|
-
expect(results.filter(item => item instanceof D).length).toBe(111);
|
|
1461
|
+
expect(results.filter((item) => item instanceof C).length).toBe(123);
|
|
1462
|
+
expect(results.filter((item) => item instanceof D).length).toBe(111);
|
|
1442
1463
|
expect(spy).toHaveBeenCalledTimes(3);
|
|
1443
1464
|
spy.mockReset();
|
|
1444
1465
|
spy.mockRestore();
|
|
@@ -1453,7 +1474,7 @@ describe("paginate", () => {
|
|
|
1453
1474
|
// Forwards
|
|
1454
1475
|
const page1 = yield client.paginate(C, {}, {
|
|
1455
1476
|
KeyConditionExpression: "PK = :pk",
|
|
1456
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1477
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1457
1478
|
});
|
|
1458
1479
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1459
1480
|
Object {
|
|
@@ -1468,7 +1489,7 @@ describe("paginate", () => {
|
|
|
1468
1489
|
expect(page1.edges[19].node.c).toBe("19");
|
|
1469
1490
|
const page2 = yield client.paginate(C, { after: page1.pageInfo.endCursor }, {
|
|
1470
1491
|
KeyConditionExpression: "PK = :pk",
|
|
1471
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1492
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1472
1493
|
});
|
|
1473
1494
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1474
1495
|
Object {
|
|
@@ -1483,7 +1504,7 @@ describe("paginate", () => {
|
|
|
1483
1504
|
expect(page2.edges[19].node.c).toBe("39");
|
|
1484
1505
|
const page3 = yield client.paginate(C, { after: page2.pageInfo.endCursor }, {
|
|
1485
1506
|
KeyConditionExpression: "PK = :pk",
|
|
1486
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1507
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1487
1508
|
});
|
|
1488
1509
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1489
1510
|
Object {
|
|
@@ -1499,7 +1520,7 @@ describe("paginate", () => {
|
|
|
1499
1520
|
// Backwards
|
|
1500
1521
|
const backwardsPage2 = yield client.paginate(C, { before: page3.pageInfo.startCursor }, {
|
|
1501
1522
|
KeyConditionExpression: "PK = :pk",
|
|
1502
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1523
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1503
1524
|
});
|
|
1504
1525
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1505
1526
|
Object {
|
|
@@ -1514,7 +1535,7 @@ describe("paginate", () => {
|
|
|
1514
1535
|
expect(backwardsPage2.edges[19].node.c).toBe("39");
|
|
1515
1536
|
const backwardsPage1 = yield client.paginate(C, { before: backwardsPage2.pageInfo.startCursor }, {
|
|
1516
1537
|
KeyConditionExpression: "PK = :pk",
|
|
1517
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1538
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1518
1539
|
});
|
|
1519
1540
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1520
1541
|
Object {
|
|
@@ -1536,7 +1557,7 @@ describe("paginate", () => {
|
|
|
1536
1557
|
// Forwards
|
|
1537
1558
|
const page1 = yield client.paginate(Union, {}, {
|
|
1538
1559
|
KeyConditionExpression: "PK = :pk",
|
|
1539
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1560
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1540
1561
|
});
|
|
1541
1562
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1542
1563
|
Object {
|
|
@@ -1551,7 +1572,7 @@ describe("paginate", () => {
|
|
|
1551
1572
|
expect(page1.edges[19].node.SK).toBe("019");
|
|
1552
1573
|
const page2 = yield client.paginate(Union, { after: page1.pageInfo.endCursor }, {
|
|
1553
1574
|
KeyConditionExpression: "PK = :pk",
|
|
1554
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1575
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1555
1576
|
});
|
|
1556
1577
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1557
1578
|
Object {
|
|
@@ -1566,7 +1587,7 @@ describe("paginate", () => {
|
|
|
1566
1587
|
expect(page2.edges[19].node.SK).toBe("039");
|
|
1567
1588
|
const page3 = yield client.paginate(Union, { after: page2.pageInfo.endCursor }, {
|
|
1568
1589
|
KeyConditionExpression: "PK = :pk",
|
|
1569
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1590
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1570
1591
|
});
|
|
1571
1592
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1572
1593
|
Object {
|
|
@@ -1582,7 +1603,7 @@ describe("paginate", () => {
|
|
|
1582
1603
|
// Backwards
|
|
1583
1604
|
const backwardsPage2 = yield client.paginate(Union, { before: page3.pageInfo.startCursor }, {
|
|
1584
1605
|
KeyConditionExpression: "PK = :pk",
|
|
1585
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1606
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1586
1607
|
});
|
|
1587
1608
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1588
1609
|
Object {
|
|
@@ -1597,7 +1618,7 @@ describe("paginate", () => {
|
|
|
1597
1618
|
expect(backwardsPage2.edges[19].node.SK).toBe("039");
|
|
1598
1619
|
const backwardsPage1 = yield client.paginate(Union, { before: backwardsPage2.pageInfo.startCursor }, {
|
|
1599
1620
|
KeyConditionExpression: "PK = :pk",
|
|
1600
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1621
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1601
1622
|
});
|
|
1602
1623
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1603
1624
|
Object {
|
|
@@ -1617,7 +1638,7 @@ describe("paginate", () => {
|
|
|
1617
1638
|
// Forwards
|
|
1618
1639
|
const page = yield client.paginate(C, { first: 10 }, {
|
|
1619
1640
|
KeyConditionExpression: "PK = :pk",
|
|
1620
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1641
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1621
1642
|
});
|
|
1622
1643
|
expect(page.pageInfo).toMatchInlineSnapshot(`
|
|
1623
1644
|
Object {
|
|
@@ -1637,7 +1658,7 @@ describe("paginate", () => {
|
|
|
1637
1658
|
// Forwards
|
|
1638
1659
|
const page1 = yield client.paginate(C, { first: 60 }, {
|
|
1639
1660
|
KeyConditionExpression: "PK = :pk",
|
|
1640
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1661
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1641
1662
|
});
|
|
1642
1663
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1643
1664
|
Object {
|
|
@@ -1659,7 +1680,7 @@ describe("paginate", () => {
|
|
|
1659
1680
|
// Forwards
|
|
1660
1681
|
const page1 = yield C.paginate({}, {
|
|
1661
1682
|
KeyConditionExpression: "PK = :pk",
|
|
1662
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1683
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1663
1684
|
});
|
|
1664
1685
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1665
1686
|
Object {
|
|
@@ -1674,7 +1695,7 @@ describe("paginate", () => {
|
|
|
1674
1695
|
expect(page1.edges[19].node.c).toBe("19");
|
|
1675
1696
|
const page2 = yield C.paginate({ after: page1.pageInfo.endCursor }, {
|
|
1676
1697
|
KeyConditionExpression: "PK = :pk",
|
|
1677
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1698
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1678
1699
|
});
|
|
1679
1700
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1680
1701
|
Object {
|
|
@@ -1689,7 +1710,7 @@ describe("paginate", () => {
|
|
|
1689
1710
|
expect(page2.edges[19].node.c).toBe("39");
|
|
1690
1711
|
const page3 = yield C.paginate({ after: page2.pageInfo.endCursor }, {
|
|
1691
1712
|
KeyConditionExpression: "PK = :pk",
|
|
1692
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1713
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1693
1714
|
});
|
|
1694
1715
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1695
1716
|
Object {
|
|
@@ -1705,7 +1726,7 @@ describe("paginate", () => {
|
|
|
1705
1726
|
// Backwards
|
|
1706
1727
|
const backwardsPage2 = yield C.paginate({ before: page3.pageInfo.startCursor }, {
|
|
1707
1728
|
KeyConditionExpression: "PK = :pk",
|
|
1708
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1729
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1709
1730
|
});
|
|
1710
1731
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1711
1732
|
Object {
|
|
@@ -1720,7 +1741,7 @@ describe("paginate", () => {
|
|
|
1720
1741
|
expect(backwardsPage2.edges[19].node.c).toBe("39");
|
|
1721
1742
|
const backwardsPage1 = yield C.paginate({ before: backwardsPage2.pageInfo.startCursor }, {
|
|
1722
1743
|
KeyConditionExpression: "PK = :pk",
|
|
1723
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1744
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1724
1745
|
});
|
|
1725
1746
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1726
1747
|
Object {
|
|
@@ -1740,7 +1761,7 @@ describe("paginate", () => {
|
|
|
1740
1761
|
// Forwards
|
|
1741
1762
|
const page = yield C.paginate({ first: 10 }, {
|
|
1742
1763
|
KeyConditionExpression: "PK = :pk",
|
|
1743
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1764
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1744
1765
|
});
|
|
1745
1766
|
expect(page.pageInfo).toMatchInlineSnapshot(`
|
|
1746
1767
|
Object {
|
|
@@ -1760,7 +1781,7 @@ describe("paginate", () => {
|
|
|
1760
1781
|
// Forwards
|
|
1761
1782
|
const page1 = yield C.paginate({ first: 60 }, {
|
|
1762
1783
|
KeyConditionExpression: "PK = :pk",
|
|
1763
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1784
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1764
1785
|
});
|
|
1765
1786
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1766
1787
|
Object {
|
|
@@ -1784,7 +1805,7 @@ describe("paginate", () => {
|
|
|
1784
1805
|
// Forwards
|
|
1785
1806
|
const page1 = yield Union.paginate({}, {
|
|
1786
1807
|
KeyConditionExpression: "PK = :pk",
|
|
1787
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1808
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1788
1809
|
});
|
|
1789
1810
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1790
1811
|
Object {
|
|
@@ -1799,7 +1820,7 @@ describe("paginate", () => {
|
|
|
1799
1820
|
expect(page1.edges[19].node.SK).toBe("019");
|
|
1800
1821
|
const page2 = yield Union.paginate({ after: page1.pageInfo.endCursor }, {
|
|
1801
1822
|
KeyConditionExpression: "PK = :pk",
|
|
1802
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1823
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1803
1824
|
});
|
|
1804
1825
|
expect(page2.pageInfo).toMatchInlineSnapshot(`
|
|
1805
1826
|
Object {
|
|
@@ -1814,7 +1835,7 @@ describe("paginate", () => {
|
|
|
1814
1835
|
expect(page2.edges[19].node.SK).toBe("039");
|
|
1815
1836
|
const page3 = yield Union.paginate({ after: page2.pageInfo.endCursor }, {
|
|
1816
1837
|
KeyConditionExpression: "PK = :pk",
|
|
1817
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1838
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1818
1839
|
});
|
|
1819
1840
|
expect(page3.pageInfo).toMatchInlineSnapshot(`
|
|
1820
1841
|
Object {
|
|
@@ -1830,7 +1851,7 @@ describe("paginate", () => {
|
|
|
1830
1851
|
// Backwards
|
|
1831
1852
|
const backwardsPage2 = yield Union.paginate({ before: page3.pageInfo.startCursor }, {
|
|
1832
1853
|
KeyConditionExpression: "PK = :pk",
|
|
1833
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1854
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1834
1855
|
});
|
|
1835
1856
|
expect(backwardsPage2.pageInfo).toMatchInlineSnapshot(`
|
|
1836
1857
|
Object {
|
|
@@ -1845,7 +1866,7 @@ describe("paginate", () => {
|
|
|
1845
1866
|
expect(backwardsPage2.edges[19].node.SK).toBe("039");
|
|
1846
1867
|
const backwardsPage1 = yield Union.paginate({ before: backwardsPage2.pageInfo.startCursor }, {
|
|
1847
1868
|
KeyConditionExpression: "PK = :pk",
|
|
1848
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1869
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1849
1870
|
});
|
|
1850
1871
|
expect(backwardsPage1.pageInfo).toMatchInlineSnapshot(`
|
|
1851
1872
|
Object {
|
|
@@ -1867,7 +1888,7 @@ describe("paginate", () => {
|
|
|
1867
1888
|
// Forwards
|
|
1868
1889
|
const page = yield Union.paginate({ first: 10 }, {
|
|
1869
1890
|
KeyConditionExpression: "PK = :pk",
|
|
1870
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1891
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1871
1892
|
});
|
|
1872
1893
|
expect(page.pageInfo).toMatchInlineSnapshot(`
|
|
1873
1894
|
Object {
|
|
@@ -1889,7 +1910,7 @@ describe("paginate", () => {
|
|
|
1889
1910
|
// Forwards
|
|
1890
1911
|
const page1 = yield Union.paginate({ first: 60 }, {
|
|
1891
1912
|
KeyConditionExpression: "PK = :pk",
|
|
1892
|
-
ExpressionAttributeValues: { ":pk": "PK" }
|
|
1913
|
+
ExpressionAttributeValues: { ":pk": "PK" },
|
|
1893
1914
|
});
|
|
1894
1915
|
expect(page1.pageInfo).toMatchInlineSnapshot(`
|
|
1895
1916
|
Object {
|