Tento Metaobject Insert

Tento represents Shopify Create Metaobject mutation

Tento provides you the most GraphQL-like way to insert rows into the Shopify.

index.ts
schema.ts
import { tento } from "@drizzle-team/tento";
import * as schema from "./schema";

const client = tento({ schema });

const result = await client.metaobjects.designer.insert({
  name: "Alex",
});
// return type
const result: {
  _id: string;
  _handle: string;
  _displayName: string;
  _updatedAt: Date;
  name: string;
  description: string | null;
  website: string | null;
}

If you need insert type for a particular Metaobject Definition you can use typeof designer.$inferInsert syntax.

type NewDesigner = typeof client.metaobjects.designer.$inferInsert;

const newDesigner: NewDesigner = { name: "Alex" };
const result = await client.metaobjects.designer.insert(designer);
// return type
const result: {
  _id: string;
  _handle: string;
  _displayName: string;
  _updatedAt: Date;
  name: string;
  description: string | null;
  website: string | null;
}