ORM for dbs and GraphQL. The mission is to make graphql zeus typings database friendly. This is an alpha version and supports mongodb only.
npm i -D graphql-zeus
npm i i-graphql mongodb
$ npx zeus https://example.com/graphql ./src
Now when you generated your types you can use them inside project
src/orm.ts
import { ModelTypes } from "./zeus";
import { iGraphQL } from "i-graphql";
export const orm = async () => {
return iGraphQL<
Pick<ModelTypes, "Operation" | "Invoice" | "Source">,
{
_id: () => string;
createdAt: () => string;
updatedAt: () => string;
}
>({
_id: () => new ObjectId().toHexString(),
createdAt: () => new Date().toISOString(),
updatedAt: () => new Date().toISOString(),
});
};
export const MongOrb = await orm();
const resolver = () =>
MongOrb("Source").createWithAutoFields(
"_id",
"createdAt"
)({
name: "My Source",
});