Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@compas/code-gen
Advanced tools
Changelog
eventStart
calls
491561
event
is passed into an async function, you most
certainly want to call eventStart
.056d40
ed546c
Readme
Code generators for routers, validators, SQL queries, API clients and more. Take a look at the documentation.
mainFn(import.meta, main);
async function main() {
const app = new App();
const T = new TypeCreator("post");
const R = T.router("/post");
app.add(
new TypeCreator("database")
.object("post")
.keys({
title: T.string().searchable(),
body: T.string(),
})
.enableQueries({ withDates: true }),
T.crud("/post").entity(T.reference("database", "post")).routes({
listRoute: true,
singleRoute: true,
createRoute: true,
updateRoute: true,
deleteRoute: true,
}),
);
await app.generate({
outputDirectory: "./src/generated/application",
dumpStructure: true,
dumpApiStructure: true,
dumpPostgres: true,
enabledGenerators: ["validator", "router", "sql", "apiClient"],
});
}
mainFn(import.meta, main);
async function main() {
const app = new App({ verbose: true });
let fromRemote = await loadApiStructureFromRemote(
Axios,
"https://some.compas.powered.backend",
);
app.extend(fromRemote);
await app.generate({
outputDirectory: "./src/generated",
isBrowser: true,
enabledGenerators: ["type", "apiClient", "reactQuery"],
});
await spawn("yarn", ["format"]);
}
FAQs
Generate various boring parts of your server
The npm package @compas/code-gen receives a total of 1,347 weekly downloads. As such, @compas/code-gen popularity was classified as popular.
We found that @compas/code-gen demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.