Add index support for entities. Also upgraded ts-jest (they don't support semantic versioning and the latest version is the first that supports typescript 5).
const myEntity = entity("myEntity", {
attributes: {
pk: z.string(),
pk2: z.string(),
field1: z.number(),
field2: z.number(),
},
partition: ["pk", "pk2"]
});
// create a GSI with pk as the only key part.
const index1 = myEntity.index("index1", {
partition: ["pk1"]
});
// create a GSI with the original partition key [pk, pk2]
// NOTE: tables without a sort key cannot have LSIs
const index2 = myEntity.index("index2", {
sort: ["field1"]
});
// create a GSI with the partition key [pk], ordered by field1
const index3 = myEntity.index("index3", {
partition: ["pk1"],
sort: ["field1"]
});
const myEntity = entity("myEntity", {
attributes: {
pk: z.string(),
pk2: z.string(),
field1: z.number(),
field2: z.number(),
},
partition: ["pk", "pk2"],
sort: ["field1"]
});
// create a GSI with pk as the only key part.
const index1 = myEntity.index("index1", {
partition: ["pk1"]
});
// create a LSI with the original partition key [pk, pk2]
const index2 = myEntity.index("index2", {
sort: ["field1"]
});
// create a GSI with the partition key [pk], ordered by field1
const index3 = myEntity.index("index3", {
partition: ["pk1"],
sort: ["field1"]
});
Add index support for entities. Also upgraded ts-jest (they don't support semantic versioning and the latest version is the first that supports typescript 5).