Skip to content

Commit 1d1967a

Browse files
authored
feat: adds support for 'scope' (#13)
1 parent 16a9524 commit 1d1967a

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

demo/main.tsp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ model Job {
5757
sk: [Person.firstName],
5858
}
5959
)
60+
@index(
61+
"byName",
62+
{
63+
collection: "jobs",
64+
index: "gsi1",
65+
scope: "org",
66+
pk: [],
67+
sk: [Person.firstName],
68+
}
69+
)
6070
model Person {
6171
@invisible(Lifecycle)
6272
pk: UUID;

src/decorators/$index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export function $index(
100100
sk: normalizeKey("sk", { target, pattern }),
101101
};
102102

103-
for (const key of ["index", "collection", "type"]) {
103+
for (const key of ["index", "collection", "type", "scope"] as const) {
104104
const value = getStringValue(pattern, key);
105105

106106
if (value) {

tsp/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ enum IndexType {
99
model AccessPattern {
1010
index?: string;
1111
collection?: string | string[];
12+
scope?: string;
1213
type?: IndexType = IndexType.isolated;
1314
pk?: ModelProperty[] | {
1415
field?: string = "pk";

0 commit comments

Comments
 (0)