Skip to content

Commit

Permalink
Merge branch 'main' into update-aws-amplify-dep-post-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
svidgen authored Apr 22, 2024
2 parents 8d3754b + 0d7f0c1 commit 4eb0f7b
Show file tree
Hide file tree
Showing 22 changed files with 1,752 additions and 617 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
],
"scripts": {
"build": "turbo run build",
"build:clean": "turbo run clean && rimraf node_modules",
"build:clean": "turbo run clean && rimraf node_modules && npm run delete-cache",
"check": "npm run build && npm run test && npm run lint && npm run check-api",
"check-api": "turbo run check-api",
"docs": "turbo run docs",
"test": "turbo run test",
"lint": "turbo run lint",
"clean": "turbo run clean",
"turbo": "turbo",
"delete-cache": "find . -type d ( -name .turbo -o -name .rollup.cache ) -exec rm -rf {} +",
"publish-packages:release": "changeset version && changeset publish",
"publish-packages:preid": "changeset version --snapshot ${PREID_PREFIX} && changeset publish --tag ${PREID_PREFIX}",
"publish-packages:local": "npm_config_registry=http://localhost:4873/ npm run publish-packages:release"
Expand Down
4 changes: 2 additions & 2 deletions packages/benches/basic/basic-schema.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bench('basic schema', () => {
title: a.string().required(),
}),
});
}).types([4362, 'instantiations']);
}).types([4334, 'instantiations']);

bench('basic schema w client types', () => {
const s = a.schema({
Expand All @@ -19,4 +19,4 @@ bench('basic schema w client types', () => {
});

type _ = ClientSchema<typeof s>;
}).types([28918, 'instantiations']);
}).types([28908, 'instantiations']);
24 changes: 12 additions & 12 deletions packages/benches/basic/custom-operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bench('custom op returning primitive types; schema only', () => {
})
.returns(a.string().required())
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
}).types([17419, 'instantiations']);

Expand All @@ -47,7 +47,7 @@ bench('custom op returning primitive types; schema + ClientSchema', () => {
})
.returns(a.string().required())
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});

type _Schema = ClientSchema<typeof schema>;
Expand All @@ -64,7 +64,7 @@ bench(
})
.returns(a.string().required())
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});

type Schema = ClientSchema<typeof schema>;
Expand All @@ -82,7 +82,7 @@ bench('custom op returning an enum; schema only', () => {
})
.returns(a.ref('Status').required())
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
}).types([17560, 'instantiations']);

Expand All @@ -96,7 +96,7 @@ bench('custom op returning an enum; schema + ClientSchema', () => {
})
.returns(a.ref('Status').required())
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});

type _Schema = ClientSchema<typeof schema>;
Expand All @@ -114,7 +114,7 @@ bench(
})
.returns(a.ref('Status').required())
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});

type Schema = ClientSchema<typeof schema>;
Expand All @@ -134,7 +134,7 @@ bench('custom op returning custom type; schema only', () => {
})
.returns(a.ref('EchoResult'))
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
}).types([18876, 'instantiations']);

Expand All @@ -150,7 +150,7 @@ bench('custom op returning custom type; schema + ClientSchema', () => {
})
.returns(a.ref('EchoResult'))
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
type _Schema = ClientSchema<typeof schema>;
}).types([59193, 'instantiations']);
Expand All @@ -169,7 +169,7 @@ bench(
})
.returns(a.ref('EchoResult'))
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
type Schema = ClientSchema<typeof schema>;
const _client = generateClient<Schema>();
Expand All @@ -188,7 +188,7 @@ bench('custom op returning model; schema only', () => {
})
.returns(a.ref('DataModel'))
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
}).types([20043, 'instantiations']);

Expand All @@ -204,7 +204,7 @@ bench('custom op returning model; schema + ClientSchema', () => {
})
.returns(a.ref('DataModel'))
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
type _Schema = ClientSchema<typeof schema>;
}).types([69637, 'instantiations']);
Expand All @@ -221,7 +221,7 @@ bench('custom op returning model; schema + ClientSchema + client types', () => {
})
.returns(a.ref('DataModel'))
.handler(a.handler.function('echoFunction'))
.authorization([a.allow.public()]),
.authorization((allow) => allow.publicApiKey()),
});
type Schema = ClientSchema<typeof schema>;
const _client = generateClient<Schema>();
Expand Down
2 changes: 1 addition & 1 deletion packages/benches/basic/secondaryIndexes.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ bench('secondary index', () => {
});

type _ = ClientSchema<typeof s>;
}).types([52056, 'instantiations']);
}).types([52054, 'instantiations']);
20 changes: 13 additions & 7 deletions packages/benches/p50/operations/p50-CRUDL.bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ bench('p50 CRUDL', async () => {
Employee: a
.model({
name: a.string().required(),
email: a.email().authorization([a.allow.owner()]),
phone: a.phone().authorization([a.allow.owner()]),
email: a.email().authorization((allow) => allow.owner()),
phone: a.phone().authorization((allow) => allow.owner()),
website: a.url(),
ssn: a.string().authorization([a.allow.owner()]),
ssn: a.string().authorization((allow) => allow.owner()),
todos: a.hasMany('Todo', 'employeeId'),
posts: a.hasMany('Post', 'employeeId'),
})
.authorization([a.allow.private().to(['read']), a.allow.owner()]),
.authorization((allow) => [
allow.authenticated().to(['read']),
allow.owner(),
]),
Todo: a
.model({
todoId: a.id().required(),
Expand All @@ -46,9 +49,12 @@ bench('p50 CRUDL', async () => {
employeeId: a.id(),
employee: a.belongsTo('Employee', 'employeeId'),
})
.authorization([a.allow.public().to(['read']), a.allow.owner()]),
.authorization((allow) => [
allow.publicApiKey().to(['read']),
allow.owner(),
]),
})
.authorization([a.allow.public()]);
.authorization((allow) => allow.publicApiKey());

type Schema = ClientSchema<typeof schema>;

Expand Down Expand Up @@ -86,4 +92,4 @@ bench('p50 CRUDL', async () => {
});

await client.models.Todo.list();
}).types([1534845, 'instantiations']);
}).types([1561069, 'instantiations']);
Loading

0 comments on commit 4eb0f7b

Please sign in to comment.