Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat: add database functions and edge functions for webhooks
Brad Barbinf94e9fb9e8c5
diff --git a/apps/erp/app/components/Table/components/Filter/Filter.tsx b/apps/erp/app/components/Table/components/Filter/Filter.tsxindex 0141f13eb7..e048c89457 100644--- a/apps/erp/app/components/Table/components/Filter/Filter.tsx+++ b/apps/erp/app/components/Table/components/Filter/Filter.tsx@@ -162,7 +162,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(className="h-9"/><CommandEmpty>- {loading ? "Loading..." : "No available filters."}+ {loading ? "Loading..." : "No available filters"}</CommandEmpty>{activeFilter === null ? (<CommandGroup>diff --git a/apps/erp/app/modules/settings/settings.models.ts b/apps/erp/app/modules/settings/settings.models.tsindex 4b5826adb2..7e16977023 100644--- a/apps/erp/app/modules/settings/settings.models.ts+++ b/apps/erp/app/modules/settings/settings.models.ts@@ -110,13 +110,24 @@ export const themeValidator = z.object({}),});-export const webhookValidator = z.object({- id: zfd.text(z.string().optional()),- name: z.string().min(1, { message: "Name is required" }),- table: z.string().min(1, { message: "Table is required" }),- url: z.string().url({ message: "Must be a valid URL" }),- onInsert: zfd.checkbox(),- onUpdate: zfd.checkbox(),- onDelete: zfd.checkbox(),- active: zfd.checkbox(),-});+export const webhookValidator = z+ .object({+ id: zfd.text(z.string().optional()),+ name: z.string().min(1, { message: "Name is required" }),+ table: z.string().min(1, { message: "Table is required" }),+ url: z.string().url({ message: "Must be a valid URL" }),+ onInsert: zfd.checkbox(),+ onUpdate: zfd.checkbox(),+ onDelete: zfd.checkbox(),+ active: zfd.checkbox(),+ })+ .refine(+ (input) => {+ if (input.onInsert || input.onUpdate || input.onDelete) return true;+ return false;+ },+ {+ message: "At least one action is required",+ path: ["onDelete"],+ }+ );diff --git a/apps/erp/app/modules/settings/settings.service.ts b/apps/erp/app/modules/settings/settings.service.tsindex d99bea4d6f..84dc7d9e25 100644--- a/apps/erp/app/modules/settings/settings.service.ts+++ b/apps/erp/app/modules/settings/settings.service.ts@@ -84,46 +84,6 @@ export async function getApiKeys(return query;}-export async function getTerms(- client: SupabaseClient<Database>,- companyId: string-) {- return client.from("terms").select("*").eq("id", companyId).single();-}--export async function getWebhook(client: SupabaseClient<Database>, id: string) {- return client.from("webhook").select("*").eq("id", id).single();-}--export async function getWebhookTables(client: SupabaseClient<Database>) {- return client.from("webhookTable").select("*");-}--export async function getWebhooks(- client: SupabaseClient<Database>,- companyId: string,- args?: GenericQueryFilters & { search: string | null }-) {- let query = client- .from("webhook")- .select("*", {- count: "exact",- })- .eq("companyId", companyId);-- if (args?.search) {- query = query.ilike("name", `%${args.search}%`);- }-- if (args) {- query = setGenericQueryFilters(query, args, [- { column: "createdAt", ascending: true },- ]);- }-- return query;-}-export async function getCompanies(client: SupabaseClient<Database>,userId: string@@ -212,6 +172,10 @@ export async function getCompanyIntegrations(.eq("companyId", companyId);}+export async function getConfig(client: SupabaseClient<Database>) {+ return client.from("config").select("*").single();+}+export async function getCurrentSequence(client: SupabaseClient<Database>,table: string,@@ -359,6 +323,46 @@ export async function getSequencesList(.order("table");}+export async function getTerms(+ client: SupabaseClient<Database>,+ companyId: string+) {+ return client.from("terms").select("*").eq("id", companyId).single();+}++export async function getWebhook(client: SupabaseClient<Database>, id: string) {+ return client.from("webhook").select("*").eq("id", id).single();+}++export async function getWebhookTables(client: SupabaseClient<Database>) {+ return client.from("webhookTable").select("*").order("name");+}++export async function getWebhooks(+ client: SupabaseClient<Database>,+ companyId: string,+ args?: GenericQueryFilters & { search: string | null }+) {+ let query = client+ .from("webhook")+ .select("*", {+ count: "exact",+ })+ .eq("companyId", companyId);++ if (args?.search) {+ query = query.ilike("name", `%${args.search}%`);+ }++ if (args) {+ query = setGenericQueryFilters(query, args, [+ { column: "createdAt", ascending: true },+ ]);+ }++ return query;+}+export async function insertCompany(client: SupabaseClient<Database>,company: z.infer<typeof companyValidator>diff --git a/apps/erp/app/modules/settings/ui/Webhooks/WebhookForm.tsx b/apps/erp/app/modules/settings/ui/Webhooks/WebhookForm.tsxindex 981125fe45..7c9d3f6abd 100644--- a/apps/erp/app/modules/settings/ui/Webhooks/WebhookForm.tsx+++ b/apps/erp/app/modules/settings/ui/Webhooks/WebhookForm.tsx@@ -1,5 +1,6 @@-import { Boolean, Combobox, Input, ValidatedForm } from "@carbon/form";+import { Boolean, Input, Select, ValidatedForm } from "@carbon/form";import {+ Badge,Button,Drawer,DrawerBody,@@ -83,25 +84,38 @@ const WebhookForm = ({<Hidden name="id" /><VStack spacing={4}>+ <Select name="table" label="Table" options={tables} />+ <FormControl>+ <FormLabel>Notifications</FormLabel>+ <VStack>+ <Boolean+ name="onInsert"+ description={<Badge variant="green">Insert</Badge>}+ />+ <Boolean+ name="onUpdate"+ description={<Badge variant="blue">Update</Badge>}+ />+ <Boolean+ name="onDelete"+ description={<Badge variant="red">Delete</Badge>}+ />+ </VStack>+ </FormControl>++ <Separator />+<Inputname="name"label="Name"helperText="This is a unique identifier for the webhook"/>+<Inputname="url"label="Webhook URL"- helperText="The URL of the webhook"+ helperText="The endpoint that receives a POST request with the updated data when the table is updated"/>- <Combobox name="table" label="Table" options={tables} />- <FormControl>- <FormLabel>Notifications</FormLabel>- <VStack>- <Boolean name="onInsert" description="Insert" />- <Boolean name="onUpdate" description="Update" />- <Boolean name="onDelete" description="Delete" />- </VStack>- </FormControl><Separator />diff --git a/apps/erp/app/modules/settings/ui/Webhooks/WebhooksTable.tsx b/apps/erp/app/modules/settings/ui/Webhooks/WebhooksTable.tsxindex c087988e8d..c79cc0b55c 100644--- a/apps/erp/app/modules/settings/ui/Webhooks/WebhooksTable.tsx+++ b/apps/erp/app/modules/settings/ui/Webhooks/WebhooksTable.tsx@@ -1,19 +1,50 @@-import { Badge, HStack, MenuIcon, MenuItem } from "@carbon/react";+import {+ Badge,+ Button,+ CodeBlock,+ Drawer,+ DrawerBody,+ DrawerContent,+ DrawerHeader,+ DrawerTitle,+ HStack,+ Kbd,+ MenuIcon,+ MenuItem,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ Separator,+ Tabs,+ TabsContent,+ TabsList,+ TabsTrigger,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ useDisclosure,+} from "@carbon/react";import { formatDate } from "@carbon/utils";-import { Outlet, useNavigate } from "@remix-run/react";+import { useNumberFormatter } from "@react-aria/i18n";+import { Link, Outlet, useNavigate } from "@remix-run/react";import type { ColumnDef } from "@tanstack/react-table";-import { memo, useCallback, useMemo } from "react";+import { memo, useCallback, useMemo, useState } from "react";import {LuCalendar,+ LuCode,LuDatabase,+ LuFileText,LuPencil,+ LuPercent,LuTable2,LuTag,LuTrash,LuUser,} from "react-icons/lu";import { EmployeeAvatar, Hyperlink, New, Table } from "~/components";-import { usePermissions, useUrlParams } from "~/hooks";+import { usePermissions, useUrlParams, useUser } from "~/hooks";import type { Webhook } from "~/modules/settings";import { usePeople } from "~/stores";import { path } from "~/utils/path";@@ -84,6 +115,19 @@ const WebhooksTable = memo(({ data, count }: WebhooksTableProps) => {},},},+ {+ accessorKey: "successCount",+ header: "Success",+ cell: ({ row }) => (+ <SuccessErrorBar+ successCount={row.original.successCount}+ errorCount={row.original.errorCount}+ />+ ),+ meta: {+ icon: <LuPercent />,+ },+ },{id: "createdBy",header: "Created By",@@ -142,27 +186,298 @@ const WebhooksTable = memo(({ data, count }: WebhooksTableProps) => {[navigate, params, permissions]);+ const docsDisclosure = useDisclosure();+return (<><Table<Webhook>data={data}columns={columns}count={count ?? 0}+ defaultColumnVisibility={{+ createdAt: false,+ createdBy: false,+ }}primaryAction={- permissions.can("update", "users") && (- <New- label="Webhook"- to={`${path.to.newWebhook}?${params.toString()}`}- />- )+ <HStack>+ {permissions.can("update", "users") && (+ <New+ label="Webhook"+ to={`${path.to.newWebhook}?${params.toString()}`}+ />+ )}+ <Button+ leftIcon={<LuCode />}+ variant="secondary"+ onClick={docsDisclosure.onOpen}+ >+ Webhooks Docs+ </Button>+ </HStack>}renderContextMenu={renderContextMenu}title="Webhooks"/><Outlet />+ <WebhookDocs+ open={docsDisclosure.isOpen}+ onClose={docsDisclosure.onClose}+ /></>);});WebhooksTable.displayName = "WebhooksTable";export default WebhooksTable;++type WebhookDocsProps = {+ open: boolean;+ onClose: () => void;+};++const code = {+ insertPayload: (table: string, companyId: string) => `+const url = "<your-webhook-url>";++const payload = {+ type: "INSERT",+ table: "${table}",+ record: {+ // the new row+ },+ companyId: "${companyId}",+};++fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify(payload),+});+`,+ updatePayload: (table: string, companyId: string) => `+const url = "<your-webhook-url>";++const payload = {+ type: "UPDATE",+ table: "${table}",+ record: {+ // the new row+ },+ old: {+ // the old row+ },+ companyId: "${companyId}",+};++fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify(payload),+});+`,+ deletePayload: (table: string, companyId: string) => `+const url = "<your-webhook-url>";++const payload = {+ type: "DELETE",+ table: "${table}",+ record: {+ // the deleted row+ },+ companyId: "${companyId}",+};++fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify(payload),+});+ `,+};++function WebhookDocs({ open, onClose }: WebhookDocsProps) {+ const webhookTables = useWebhookTables();+ const [activeTable, setActiveTable] = useState<string>("quote");+ const { company } = useUser();++ return (+ <Drawer+ open={open}+ onOpenChange={(open) => {+ if (!open) onClose();+ }}+ >+ <DrawerContent size="md">+ <DrawerHeader>+ <DrawerTitle>Webhook Documentation</DrawerTitle>+ </DrawerHeader>+ <DrawerBody>+ <Tabs defaultValue="INSERT" className="w-full">+ <HStack className="w-full justify-between">+ <div>+ <TabsList className="grid grid-cols-3">+ <TabsTrigger value="INSERT">INSERT</TabsTrigger>+ <TabsTrigger value="UPDATE">UPDATE</TabsTrigger>+ <TabsTrigger value="DELETE">DELETE</TabsTrigger>+ </TabsList>+ </div>+ <div>+ <Select+ value={activeTable}+ onValueChange={(val) => setActiveTable(val)}+ >+ <SelectTrigger id="table" className="min-w-[200px]">+ <SelectValue placeholder="Select a table" />+ </SelectTrigger>+ <SelectContent>+ {webhookTables.map((option) => (+ <SelectItem key={option.value} value={option.value}>+ {option.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ </HStack>+ <TabsContent value="INSERT">+ <div className="flex flex-col gap-4 py-4">+ <p>+ When an <Badge variant="green">INSERT</Badge> event occurs,+ the following webhook will be triggered. The <Kbd>record</Kbd>{" "}+ object will contain the inserted row.+ </p>+ <Separator />+ <CodeBlock className="js">+ {code.insertPayload(activeTable, company.id)}+ </CodeBlock>+ <Separator />+ <div>+ <Button leftIcon={<LuFileText />} variant="link" asChild>+ <Link to={path.to.apiTable("js", activeTable)}>+ {+ webhookTables.find(+ (table) => table.value === activeTable+ )?.label+ }{" "}+ Table Schema+ </Link>+ </Button>+ </div>+ </div>+ </TabsContent>+ <TabsContent value="UPDATE">+ <div className="flex flex-col gap-4 py-4">+ <p>+ When an <Badge variant="blue">UPDATE</Badge> event occurs,+ we'll send a <Kbd>POST</Kbd> request to the webhook URL you've+ provided.+ </p>+ <p>+ The payload will be similar to the code below. The{" "}+ <Kbd>record</Kbd> object will contain the updated row and the{" "}+ <Kbd>old</Kbd> object will contain the previous values.+ </p>+ <Separator />+ <CodeBlock className="js">+ {code.updatePayload(activeTable, company.id)}+ </CodeBlock>+ <Separator />+ <div>+ <Button leftIcon={<LuFileText />} variant="link" asChild>+ <Link to={path.to.apiTable("js", activeTable)}>+ {+ webhookTables.find(+ (table) => table.value === activeTable+ )?.label+ }{" "}+ Table Schema+ </Link>+ </Button>+ </div>+ </div>+ </TabsContent>+ <TabsContent value="DELETE">+ <div className="flex flex-col gap-4 py-4">+ <p>+ When a <Badge variant="red">DELETE</Badge> event occurs, we'll+ send a <Kbd>POST</Kbd> request to the webhook URL you've+ provided. The payload will be similar to the code below. The{" "}+ <Kbd>record</Kbd> object will contain the deleted row.+ </p>+ <Separator />+ <CodeBlock className="js">+ {code.deletePayload(activeTable, company.id)}+ </CodeBlock>+ <Separator />+ <div>+ <Button leftIcon={<LuFileText />} variant="link" asChild>+ <Link to={path.to.apiTable("js", activeTable)}>+ {+ webhookTables.find(+ (table) => table.value === activeTable+ )?.label+ }{" "}+ Table Schema+ </Link>+ </Button>+ </div>+ </div>+ </TabsContent>+ </Tabs>+ </DrawerBody>+ </DrawerContent>+ </Drawer>+ );+}++interface SuccessErrorBarProps {+ successCount: number;+ errorCount: number;+}++function SuccessErrorBar({ successCount, errorCount }: SuccessErrorBarProps) {+ const total = successCount + errorCount;+ const successPercentage = total > 0 ? (successCount / total) * 100 : 0;+ const errorPercentage = total > 0 ? (errorCount / total) * 100 : 0;++ const numberFormatter = useNumberFormatter({+ maximumFractionDigits: 0,+ notation: "compact",+ compactDisplay: "short",+ });++ return (+ <div className="flex flex-col w-full gap-0">+ <div className="w-full h-3 bg-muted rounded-sm overflow-hidden flex">+ <Tooltip>+ <TooltipTrigger asChild>+ <div+ className="h-full bg-emerald-500"+ style={{ width: `${numberFormatter.format(successPercentage)}%` }}+ />+ </TooltipTrigger>+ <TooltipContent>+ <p>Success: {successCount}</p>+ </TooltipContent>+ </Tooltip>+ <Tooltip>+ <TooltipTrigger asChild>+ <div+ className="h-full bg-red-500"+ style={{ width: `${errorPercentage}%` }}+ />+ </TooltipTrigger>+ <TooltipContent>+ <p>Error: {numberFormatter.format(errorCount)}</p>+ </TooltipContent>+ </Tooltip>+ </div>+ </div>+ );+}diff --git a/apps/erp/app/routes/x+/settings+/logos.tsx b/apps/erp/app/routes/x+/settings+/logos.tsxindex 2e5a598cc7..0f69690932 100644--- a/apps/erp/app/routes/x+/settings+/logos.tsx+++ b/apps/erp/app/routes/x+/settings+/logos.tsx@@ -72,10 +72,7 @@ export default function LogosRoute() {return (<ScrollArea className="w-full h-[calc(100dvh-49px)]">- <VStack- spacing={4}- className="py-12 px-4 max-w-[60rem] h-full mx-auto gap-4"- >+ <VStack spacing={4} className="py-12 px-4 max-w-[60rem] h-full mx-auto"><Heading size="h3">Logos</Heading><div className="grid grid-cols-2 gap-4 w-full"><Card>diff --git a/apps/erp/app/routes/x+/settings+/webhooks.tsx b/apps/erp/app/routes/x+/settings+/webhooks.tsxindex 8dbcc841eb..8dc8c2bb29 100644--- a/apps/erp/app/routes/x+/settings+/webhooks.tsx+++ b/apps/erp/app/routes/x+/settings+/webhooks.tsx@@ -3,7 +3,7 @@ import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import { Outlet, useLoaderData } from "@remix-run/react";import { json, redirect, type LoaderFunctionArgs } from "@vercel/remix";-import { getWebhooks } from "~/modules/settings";+import { getConfig, getWebhooks } from "~/modules/settings";import { WebhooksTable } from "~/modules/settings/ui/Webhooks";import type { Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -25,13 +25,17 @@ export async function loader({ request }: LoaderFunctionArgs) {const { limit, offset, sorts, filters } =getGenericQueryFilters(searchParams);- const webhooks = await getWebhooks(client, companyId, {- limit,- offset,- sorts,- search,- filters,- });+ const [webhooks, config] = await Promise.all([+ getWebhooks(client, companyId, {+ limit,+ offset,+ sorts,+ search,+ filters,+ }),+ getConfig(client),+ ]);+if (webhooks.error) {throw redirect(path.to.settings,@@ -39,9 +43,23 @@ export async function loader({ request }: LoaderFunctionArgs) {);}+ if (config.error || !config.data?.apiUrl) {+ throw redirect(+ path.to.settings,+ await flash(+ request,+ error(+ config.error,+ "Failed to load config. Please make sure a valid record exists in your public.config table."+ )+ )+ );+ }+return json({webhooks: webhooks.data ?? [],count: webhooks.count ?? 0,+ config: config.data,});}diff --git a/apps/mes/app/components/Filter/Filter.tsx b/apps/mes/app/components/Filter/Filter.tsxindex df4154ccd1..51702fd99a 100644--- a/apps/mes/app/components/Filter/Filter.tsx+++ b/apps/mes/app/components/Filter/Filter.tsx@@ -160,7 +160,7 @@ const Filter = forwardRef<HTMLButtonElement, FilterProps>(className="h-9"/><CommandEmpty>- {loading ? "Loading..." : "No available filters."}+ {loading ? "Loading..." : "No available filters"}</CommandEmpty>{activeFilter === null ? (<CommandGroup>diff --git a/packages/database/src/seed.ts b/packages/database/src/seed.tsindex 3542333a7b..5dafc8e560 100644--- a/packages/database/src/seed.ts+++ b/packages/database/src/seed.ts@@ -46,6 +46,17 @@ const getUserId = async (): Promise<string> => {async function seed() {const id = await getUserId();+ const upsertConfig = await supabaseAdmin.from("config").upsert([+ {+ id: true,+ apiUrl: process.env.SUPABASE_API_URL!.includes("localhost")+ ? "http://host.docker.internal:54321"+ : process.env.SUPABASE_API_URL,+ anonKey: process.env.SUPABASE_ANON_PUBLIC!,+ },+ ]);+ if (upsertConfig.error) throw upsertConfig.error;+const upsertAdmin = await supabaseAdmin.from("user").upsert([{id,diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.tsindex 41c12f0f81..5ba2470857 100644--- a/packages/database/src/swagger-docs-schema.ts+++ b/packages/database/src/swagger-docs-schema.ts@@ -1266,6 +1266,123 @@ export default {tags: ["shippingTerm"],},},+ "/config": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.config.id",+ },+ {+ $ref: "#/parameters/rowFilter.config.apiUrl",+ },+ {+ $ref: "#/parameters/rowFilter.config.anonKey",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/config",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["config"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.config",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["config"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.config.id",+ },+ {+ $ref: "#/parameters/rowFilter.config.apiUrl",+ },+ {+ $ref: "#/parameters/rowFilter.config.anonKey",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["config"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.config.id",+ },+ {+ $ref: "#/parameters/rowFilter.config.apiUrl",+ },+ {+ $ref: "#/parameters/rowFilter.config.anonKey",+ },+ {+ $ref: "#/parameters/body.config",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["config"],+ },+ },"/customerAccount": {get: {parameters: [@@ -7032,74 +7149,17 @@ export default {tags: ["item"],},},- "/receipt": {+ "/webhookTable": {get: {parameters: [{- $ref: "#/parameters/rowFilter.receipt.id",- },- {- $ref: "#/parameters/rowFilter.receipt.receiptId",- },- {- $ref: "#/parameters/rowFilter.receipt.locationId",- },- {- $ref: "#/parameters/rowFilter.receipt.sourceDocument",- },- {- $ref: "#/parameters/rowFilter.receipt.sourceDocumentId",- },- {- $ref: "#/parameters/rowFilter.receipt.sourceDocumentReadableId",- },- {- $ref: "#/parameters/rowFilter.receipt.externalDocumentId",- },- {- $ref: "#/parameters/rowFilter.receipt.supplierId",- },- {- $ref: "#/parameters/rowFilter.receipt.status",+ $ref: "#/parameters/rowFilter.webhookTable.table",},{- $ref: "#/parameters/rowFilter.receipt.postingDate",+ $ref: "#/parameters/rowFilter.webhookTable.module",},{- $ref: "#/parameters/rowFilter.receipt.invoiced",- },- {- $ref: "#/parameters/rowFilter.receipt.assignee",- },- {- $ref: "#/parameters/rowFilter.receipt.companyId",- },- {- $ref: "#/parameters/rowFilter.receipt.createdAt",- },- {- $ref: "#/parameters/rowFilter.receipt.createdBy",- },- {- $ref: "#/parameters/rowFilter.receipt.updatedAt",- },- {- $ref: "#/parameters/rowFilter.receipt.updatedBy",- },- {- $ref: "#/parameters/rowFilter.receipt.customFields",- },- {- $ref: "#/parameters/rowFilter.receipt.tags",- },- {- $ref: "#/parameters/rowFilter.receipt.internalNotes",- },- {- $ref: "#/parameters/rowFilter.receipt.supplierInteractionId",- },- {- $ref: "#/parameters/rowFilter.receipt.postedBy",+ $ref: "#/parameters/rowFilter.webhookTable.name",},{$ref: "#/parameters/select",@@ -7128,7 +7188,7 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/receipt",+ $ref: "#/definitions/webhookTable",},type: "array",},@@ -7137,12 +7197,12 @@ export default {description: "Partial Content",},},- tags: ["receipt"],+ tags: ["webhookTable"],},post: {parameters: [{- $ref: "#/parameters/body.receipt",+ $ref: "#/parameters/body.webhookTable",},{$ref: "#/parameters/select",@@ -7156,9 +7216,58 @@ export default {description: "Created",},},- tags: ["receipt"],+ tags: ["webhookTable"],},delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.webhookTable.table",+ },+ {+ $ref: "#/parameters/rowFilter.webhookTable.module",+ },+ {+ $ref: "#/parameters/rowFilter.webhookTable.name",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["webhookTable"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.webhookTable.table",+ },+ {+ $ref: "#/parameters/rowFilter.webhookTable.module",+ },+ {+ $ref: "#/parameters/rowFilter.webhookTable.name",+ },+ {+ $ref: "#/parameters/body.webhookTable",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["webhookTable"],+ },+ },+ "/receipt": {+ get: {parameters: [{$ref: "#/parameters/rowFilter.receipt.id",@@ -7227,17 +7336,142 @@ export default {$ref: "#/parameters/rowFilter.receipt.postedBy",},{- $ref: "#/parameters/preferReturn",+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",},],responses: {- "204": {- description: "No Content",+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/receipt",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",},},tags: ["receipt"],},- patch: {+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.receipt",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["receipt"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.receipt.id",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.receiptId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.locationId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.sourceDocument",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.sourceDocumentId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.sourceDocumentReadableId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.externalDocumentId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.supplierId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.status",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.postingDate",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.invoiced",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.assignee",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.tags",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.internalNotes",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.supplierInteractionId",+ },+ {+ $ref: "#/parameters/rowFilter.receipt.postedBy",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["receipt"],+ },+ patch: {parameters: [{$ref: "#/parameters/rowFilter.receipt.id",@@ -15549,140 +15783,59 @@ export default {tags: ["job"],},},- "/purchaseOrderFavorite": {+ "/webhook": {get: {parameters: [{- $ref: "#/parameters/rowFilter.purchaseOrderFavorite.purchaseOrderId",+ $ref: "#/parameters/rowFilter.webhook.id",},{- $ref: "#/parameters/rowFilter.purchaseOrderFavorite.userId",+ $ref: "#/parameters/rowFilter.webhook.name",},{- $ref: "#/parameters/select",+ $ref: "#/parameters/rowFilter.webhook.table",},{- $ref: "#/parameters/order",+ $ref: "#/parameters/rowFilter.webhook.url",},{- $ref: "#/parameters/range",+ $ref: "#/parameters/rowFilter.webhook.active",},{- $ref: "#/parameters/rangeUnit",+ $ref: "#/parameters/rowFilter.webhook.onInsert",},{- $ref: "#/parameters/offset",+ $ref: "#/parameters/rowFilter.webhook.onUpdate",},{- $ref: "#/parameters/limit",+ $ref: "#/parameters/rowFilter.webhook.onDelete",},{- $ref: "#/parameters/preferCount",+ $ref: "#/parameters/rowFilter.webhook.successCount",},- ],- responses: {- "200": {- description: "OK",- schema: {- items: {- $ref: "#/definitions/purchaseOrderFavorite",- },- type: "array",- },- },- "206": {- description: "Partial Content",- },- },- tags: ["purchaseOrderFavorite"],- },- post: {- parameters: [{- $ref: "#/parameters/body.purchaseOrderFavorite",+ $ref: "#/parameters/rowFilter.webhook.lastSuccess",},{- $ref: "#/parameters/select",+ $ref: "#/parameters/rowFilter.webhook.errorCount",},{- $ref: "#/parameters/preferPost",- },- ],- responses: {- "201": {- description: "Created",+ $ref: "#/parameters/rowFilter.webhook.lastError",},- },- tags: ["purchaseOrderFavorite"],- },- delete: {- parameters: [{- $ref: "#/parameters/rowFilter.purchaseOrderFavorite.purchaseOrderId",+ $ref: "#/parameters/rowFilter.webhook.companyId",},{- $ref: "#/parameters/rowFilter.purchaseOrderFavorite.userId",+ $ref: "#/parameters/rowFilter.webhook.createdAt",},{- $ref: "#/parameters/preferReturn",- },- ],- responses: {- "204": {- description: "No Content",+ $ref: "#/parameters/rowFilter.webhook.createdBy",},- },- tags: ["purchaseOrderFavorite"],- },- patch: {- parameters: [{- $ref: "#/parameters/rowFilter.purchaseOrderFavorite.purchaseOrderId",+ $ref: "#/parameters/rowFilter.webhook.updatedAt",},{- $ref: "#/parameters/rowFilter.purchaseOrderFavorite.userId",- },- {- $ref: "#/parameters/body.purchaseOrderFavorite",- },- {- $ref: "#/parameters/preferReturn",- },- ],- responses: {- "204": {- description: "No Content",- },- },- tags: ["purchaseOrderFavorite"],- },- },- "/scrapReason": {- get: {- parameters: [- {- $ref: "#/parameters/rowFilter.scrapReason.id",- },- {- $ref: "#/parameters/rowFilter.scrapReason.name",- },- {- $ref: "#/parameters/rowFilter.scrapReason.companyId",- },- {- $ref: "#/parameters/rowFilter.scrapReason.createdAt",- },- {- $ref: "#/parameters/rowFilter.scrapReason.createdBy",- },- {- $ref: "#/parameters/rowFilter.scrapReason.updatedBy",- },- {- $ref: "#/parameters/rowFilter.scrapReason.updatedAt",- },- {- $ref: "#/parameters/rowFilter.scrapReason.customFields",+ $ref: "#/parameters/rowFilter.webhook.updatedBy",},{$ref: "#/parameters/select",@@ -15711,7 +15864,7 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/scrapReason",+ $ref: "#/definitions/webhook",},type: "array",},@@ -15720,12 +15873,12 @@ export default {description: "Partial Content",},},- tags: ["scrapReason"],+ tags: ["webhook"],},post: {parameters: [{- $ref: "#/parameters/body.scrapReason",+ $ref: "#/parameters/body.webhook",},{$ref: "#/parameters/select",@@ -15739,73 +15892,60 @@ export default {description: "Created",},},- tags: ["scrapReason"],+ tags: ["webhook"],},delete: {parameters: [{- $ref: "#/parameters/rowFilter.scrapReason.id",+ $ref: "#/parameters/rowFilter.webhook.id",},{- $ref: "#/parameters/rowFilter.scrapReason.name",+ $ref: "#/parameters/rowFilter.webhook.name",},{- $ref: "#/parameters/rowFilter.scrapReason.companyId",+ $ref: "#/parameters/rowFilter.webhook.table",},{- $ref: "#/parameters/rowFilter.scrapReason.createdAt",+ $ref: "#/parameters/rowFilter.webhook.url",},{- $ref: "#/parameters/rowFilter.scrapReason.createdBy",+ $ref: "#/parameters/rowFilter.webhook.active",},{- $ref: "#/parameters/rowFilter.scrapReason.updatedBy",+ $ref: "#/parameters/rowFilter.webhook.onInsert",},{- $ref: "#/parameters/rowFilter.scrapReason.updatedAt",+ $ref: "#/parameters/rowFilter.webhook.onUpdate",},{- $ref: "#/parameters/rowFilter.scrapReason.customFields",+ $ref: "#/parameters/rowFilter.webhook.onDelete",},{- $ref: "#/parameters/preferReturn",- },- ],- responses: {- "204": {- description: "No Content",- },- },- tags: ["scrapReason"],- },- patch: {- parameters: [- {- $ref: "#/parameters/rowFilter.scrapReason.id",+ $ref: "#/parameters/rowFilter.webhook.successCount",},{- $ref: "#/parameters/rowFilter.scrapReason.name",+ $ref: "#/parameters/rowFilter.webhook.lastSuccess",},{- $ref: "#/parameters/rowFilter.scrapReason.companyId",+ $ref: "#/parameters/rowFilter.webhook.errorCount",},{- $ref: "#/parameters/rowFilter.scrapReason.createdAt",+ $ref: "#/parameters/rowFilter.webhook.lastError",},{- $ref: "#/parameters/rowFilter.scrapReason.createdBy",+ $ref: "#/parameters/rowFilter.webhook.companyId",},{- $ref: "#/parameters/rowFilter.scrapReason.updatedBy",+ $ref: "#/parameters/rowFilter.webhook.createdAt",},{- $ref: "#/parameters/rowFilter.scrapReason.updatedAt",+ $ref: "#/parameters/rowFilter.webhook.createdBy",},{- $ref: "#/parameters/rowFilter.scrapReason.customFields",+ $ref: "#/parameters/rowFilter.webhook.updatedAt",},{- $ref: "#/parameters/body.scrapReason",+ $ref: "#/parameters/rowFilter.webhook.updatedBy",},{$ref: "#/parameters/preferReturn",@@ -15816,83 +15956,420 @@ export default {description: "No Content",},},- tags: ["scrapReason"],+ tags: ["webhook"],},- },- "/consumables": {- get: {+ patch: {parameters: [{- $ref: "#/parameters/rowFilter.consumables.active",- },- {- $ref: "#/parameters/rowFilter.consumables.assignee",- },- {- $ref: "#/parameters/rowFilter.consumables.defaultMethodType",+ $ref: "#/parameters/rowFilter.webhook.id",},{- $ref: "#/parameters/rowFilter.consumables.description",+ $ref: "#/parameters/rowFilter.webhook.name",},{- $ref: "#/parameters/rowFilter.consumables.itemTrackingType",+ $ref: "#/parameters/rowFilter.webhook.table",},{- $ref: "#/parameters/rowFilter.consumables.name",+ $ref: "#/parameters/rowFilter.webhook.url",},{- $ref: "#/parameters/rowFilter.consumables.replenishmentSystem",+ $ref: "#/parameters/rowFilter.webhook.active",},{- $ref: "#/parameters/rowFilter.consumables.thumbnailPath",+ $ref: "#/parameters/rowFilter.webhook.onInsert",},{- $ref: "#/parameters/rowFilter.consumables.unitOfMeasureCode",+ $ref: "#/parameters/rowFilter.webhook.onUpdate",},{- $ref: "#/parameters/rowFilter.consumables.notes",+ $ref: "#/parameters/rowFilter.webhook.onDelete",},{- $ref: "#/parameters/rowFilter.consumables.id",+ $ref: "#/parameters/rowFilter.webhook.successCount",},{- $ref: "#/parameters/rowFilter.consumables.itemId",+ $ref: "#/parameters/rowFilter.webhook.lastSuccess",},{- $ref: "#/parameters/rowFilter.consumables.approved",+ $ref: "#/parameters/rowFilter.webhook.errorCount",},{- $ref: "#/parameters/rowFilter.consumables.approvedBy",+ $ref: "#/parameters/rowFilter.webhook.lastError",},{- $ref: "#/parameters/rowFilter.consumables.customFields",+ $ref: "#/parameters/rowFilter.webhook.companyId",},{- $ref: "#/parameters/rowFilter.consumables.companyId",+ $ref: "#/parameters/rowFilter.webhook.createdAt",},{- $ref: "#/parameters/rowFilter.consumables.createdBy",+ $ref: "#/parameters/rowFilter.webhook.createdBy",},{- $ref: "#/parameters/rowFilter.consumables.createdAt",+ $ref: "#/parameters/rowFilter.webhook.updatedAt",},{- $ref: "#/parameters/rowFilter.consumables.updatedBy",+ $ref: "#/parameters/rowFilter.webhook.updatedBy",},{- $ref: "#/parameters/rowFilter.consumables.updatedAt",+ $ref: "#/parameters/body.webhook",},{- $ref: "#/parameters/rowFilter.consumables.externalId",+ $ref: "#/parameters/preferReturn",},- {- $ref: "#/parameters/rowFilter.consumables.tags",+ ],+ responses: {+ "204": {+ description: "No Content",},+ },+ tags: ["webhook"],+ },+ },+ "/purchaseOrderFavorite": {+ get: {+ parameters: [{- $ref: "#/parameters/rowFilter.consumables.supplierIds",+ $ref: "#/parameters/rowFilter.purchaseOrderFavorite.purchaseOrderId",},{- $ref: "#/parameters/rowFilter.consumables.unitOfMeasure",+ $ref: "#/parameters/rowFilter.purchaseOrderFavorite.userId",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/purchaseOrderFavorite",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["purchaseOrderFavorite"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.purchaseOrderFavorite",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["purchaseOrderFavorite"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchaseOrderFavorite.purchaseOrderId",+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderFavorite.userId",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchaseOrderFavorite"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.purchaseOrderFavorite.purchaseOrderId",+ },+ {+ $ref: "#/parameters/rowFilter.purchaseOrderFavorite.userId",+ },+ {+ $ref: "#/parameters/body.purchaseOrderFavorite",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["purchaseOrderFavorite"],+ },+ },+ "/scrapReason": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.scrapReason.id",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.name",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.customFields",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/order",+ },+ {+ $ref: "#/parameters/range",+ },+ {+ $ref: "#/parameters/rangeUnit",+ },+ {+ $ref: "#/parameters/offset",+ },+ {+ $ref: "#/parameters/limit",+ },+ {+ $ref: "#/parameters/preferCount",+ },+ ],+ responses: {+ "200": {+ description: "OK",+ schema: {+ items: {+ $ref: "#/definitions/scrapReason",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["scrapReason"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.scrapReason",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["scrapReason"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.scrapReason.id",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.name",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.customFields",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["scrapReason"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.scrapReason.id",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.name",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.scrapReason.customFields",+ },+ {+ $ref: "#/parameters/body.scrapReason",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["scrapReason"],+ },+ },+ "/consumables": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.consumables.active",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.assignee",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.defaultMethodType",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.description",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.itemTrackingType",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.name",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.replenishmentSystem",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.thumbnailPath",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.unitOfMeasureCode",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.notes",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.id",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.itemId",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.approved",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.approvedBy",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.externalId",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.tags",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.supplierIds",+ },+ {+ $ref: "#/parameters/rowFilter.consumables.unitOfMeasure",},{$ref: "#/parameters/select",@@ -41060,6 +41537,63 @@ export default {tags: ["(rpc) journalLinesByAccountNumber"],},},+ "/rpc/increment_webhook_success": {+ get: {+ parameters: [+ {+ format: "text",+ in: "query",+ name: "webhook_id",+ required: true,+ type: "string",+ },+ ],+ produces: [+ "application/json",+ "application/vnd.pgrst.object+json;nulls=stripped",+ "application/vnd.pgrst.object+json",+ ],+ responses: {+ "200": {+ description: "OK",+ },+ },+ tags: ["(rpc) increment_webhook_success"],+ },+ post: {+ parameters: [+ {+ in: "body",+ name: "args",+ required: true,+ schema: {+ properties: {+ webhook_id: {+ format: "text",+ type: "string",+ },+ },+ required: ["webhook_id"],+ type: "object",+ },+ },+ {+ $ref: "#/parameters/preferParams",+ },+ ],+ produces: [+ "application/json",+ "application/vnd.pgrst.object+json;nulls=stripped",+ "application/vnd.pgrst.object+json",+ ],+ responses: {+ "200": {+ description: "OK",+ },+ },+ tags: ["(rpc) increment_webhook_success"],+ },+ },"/rpc/get_my_permission": {get: {parameters: [@@ -42575,6 +43109,63 @@ export default {tags: ["(rpc) has_valid_api_key_for_company"],},},+ "/rpc/increment_webhook_error": {+ get: {+ parameters: [+ {+ format: "text",+ in: "query",+ name: "webhook_id",+ required: true,+ type: "string",+ },+ ],+ produces: [+ "application/json",+ "application/vnd.pgrst.object+json;nulls=stripped",+ "application/vnd.pgrst.object+json",+ ],+ responses: {+ "200": {+ description: "OK",+ },+ },+ tags: ["(rpc) increment_webhook_error"],+ },+ post: {+ parameters: [+ {+ in: "body",+ name: "args",+ required: true,+ schema: {+ properties: {+ webhook_id: {+ format: "text",+ type: "string",+ },+ },+ required: ["webhook_id"],+ type: "object",+ },+ },+ {+ $ref: "#/parameters/preferParams",+ },+ ],+ produces: [+ "application/json",+ "application/vnd.pgrst.object+json;nulls=stripped",+ "application/vnd.pgrst.object+json",+ ],+ responses: {+ "200": {+ description: "OK",+ },+ },+ tags: ["(rpc) increment_webhook_error"],+ },+ },"/rpc/xid_pid": {get: {parameters: [@@ -44256,6 +44847,26 @@ export default {},type: "object",},+ config: {+ required: ["id", "apiUrl", "anonKey"],+ properties: {+ id: {+ default: true,+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "boolean",+ type: "boolean",+ },+ apiUrl: {+ format: "text",+ type: "string",+ },+ anonKey: {+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },customerAccount: {required: ["id", "customerId", "companyId", "active"],properties: {@@ -47043,6 +47654,41 @@ export default {},type: "object",},+ webhookTable: {+ required: ["table", "module", "name"],+ properties: {+ table: {+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ module: {+ enum: [+ "Accounting",+ "Documents",+ "Invoicing",+ "Inventory",+ "Items",+ "Messaging",+ "Parts",+ "People",+ "Production",+ "Purchasing",+ "Resources",+ "Sales",+ "Settings",+ "Users",+ ],+ format: "public.module",+ type: "string",+ },+ name: {+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },receipt: {required: ["id",@@ -51092,6 +51738,107 @@ export default {},type: "object",},+ webhook: {+ required: [+ "id",+ "name",+ "table",+ "url",+ "active",+ "onInsert",+ "onUpdate",+ "onDelete",+ "successCount",+ "errorCount",+ "companyId",+ "createdAt",+ "createdBy",+ ],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ name: {+ format: "text",+ type: "string",+ },+ table: {+ description:+ "Note:\nThis is a Foreign Key to `webhookTable.table`.<fk table='webhookTable' column='table'/>",+ format: "text",+ type: "string",+ },+ url: {+ format: "text",+ type: "string",+ },+ active: {+ default: true,+ format: "boolean",+ type: "boolean",+ },+ onInsert: {+ default: false,+ format: "boolean",+ type: "boolean",+ },+ onUpdate: {+ default: false,+ format: "boolean",+ type: "boolean",+ },+ onDelete: {+ default: false,+ format: "boolean",+ type: "boolean",+ },+ successCount: {+ default: 0,+ format: "bigint",+ type: "integer",+ },+ lastSuccess: {+ format: "timestamp with time zone",+ type: "string",+ },+ errorCount: {+ default: 0,+ format: "bigint",+ type: "integer",+ },+ lastError: {+ format: "timestamp with time zone",+ type: "string",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ createdAt: {+ default: "now()",+ format: "timestamp with time zone",+ type: "string",+ },+ createdBy: {+ format: "text",+ type: "string",+ },+ updatedAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ updatedBy: {+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },purchaseOrderFavorite: {required: ["purchaseOrderId", "userId"],properties: {@@ -63159,6 +63906,36 @@ export default {in: "query",type: "string",},+ "body.config": {+ name: "config",+ description: "config",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/config",+ },+ },+ "rowFilter.config.id": {+ name: "id",+ required: false,+ format: "boolean",+ in: "query",+ type: "string",+ },+ "rowFilter.config.apiUrl": {+ name: "apiUrl",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.config.anonKey": {+ name: "anonKey",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.customerAccount": {name: "customerAccount",description: "customerAccount",@@ -66766,6 +67543,36 @@ export default {in: "query",type: "string",},+ "body.webhookTable": {+ name: "webhookTable",+ description: "webhookTable",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/webhookTable",+ },+ },+ "rowFilter.webhookTable.table": {+ name: "table",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhookTable.module": {+ name: "module",+ required: false,+ format: "public.module",+ in: "query",+ type: "string",+ },+ "rowFilter.webhookTable.name": {+ name: "name",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.receipt": {name: "receipt",description: "receipt",@@ -71988,6 +72795,134 @@ export default {in: "query",type: "string",},+ "body.webhook": {+ name: "webhook",+ description: "webhook",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/webhook",+ },+ },+ "rowFilter.webhook.id": {+ name: "id",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.name": {+ name: "name",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.table": {+ name: "table",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.url": {+ name: "url",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.active": {+ name: "active",+ required: false,+ format: "boolean",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.onInsert": {+ name: "onInsert",+ required: false,+ format: "boolean",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.onUpdate": {+ name: "onUpdate",+ required: false,+ format: "boolean",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.onDelete": {+ name: "onDelete",+ required: false,+ format: "boolean",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.successCount": {+ name: "successCount",+ required: false,+ format: "bigint",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.lastSuccess": {+ name: "lastSuccess",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.errorCount": {+ name: "errorCount",+ required: false,+ format: "bigint",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.lastError": {+ name: "lastError",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.companyId": {+ name: "companyId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.createdAt": {+ name: "createdAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.createdBy": {+ name: "createdBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.updatedAt": {+ name: "updatedAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.webhook.updatedBy": {+ name: "updatedBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.purchaseOrderFavorite": {name: "purchaseOrderFavorite",description: "purchaseOrderFavorite",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 36da23634d..ef9d777c4e 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -2224,6 +2224,24 @@ export type Database = {},]}+ config: {+ Row: {+ anonKey: string+ apiUrl: string+ id: boolean+ }+ Insert: {+ anonKey: string+ apiUrl: string+ id?: boolean+ }+ Update: {+ anonKey?: string+ apiUrl?: string+ id?: boolean+ }+ Relationships: []+ }configurationParameter: {Row: {companyId: string@@ -25417,11 +25435,15 @@ export type Database = {companyId: stringcreatedAt: stringcreatedBy: string+ errorCount: numberid: string+ lastError: string | null+ lastSuccess: string | nullname: stringonDelete: booleanonInsert: booleanonUpdate: boolean+ successCount: numbertable: stringupdatedAt: string | nullupdatedBy: string | null@@ -25432,11 +25454,15 @@ export type Database = {companyId: stringcreatedAt?: stringcreatedBy: string+ errorCount?: numberid?: string+ lastError?: string | null+ lastSuccess?: string | nullname: stringonDelete?: booleanonInsert?: booleanonUpdate?: boolean+ successCount?: numbertable: stringupdatedAt?: string | nullupdatedBy?: string | null@@ -25447,11 +25473,15 @@ export type Database = {companyId?: stringcreatedAt?: stringcreatedBy?: string+ errorCount?: numberid?: string+ lastError?: string | null+ lastSuccess?: string | nullname?: stringonDelete?: booleanonInsert?: booleanonUpdate?: boolean+ successCount?: numbertable?: stringupdatedAt?: string | nullupdatedBy?: string | null@@ -33802,6 +33832,18 @@ export type Database = {}Returns: boolean}+ increment_webhook_error: {+ Args: {+ webhook_id: string+ }+ Returns: undefined+ }+ increment_webhook_success: {+ Args: {+ webhook_id: string+ }+ Returns: undefined+ }is_claims_admin: {Args: Record<PropertyKey, never>Returns: booleandiff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 36da23634d..ef9d777c4e 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -2224,6 +2224,24 @@ export type Database = {},]}+ config: {+ Row: {+ anonKey: string+ apiUrl: string+ id: boolean+ }+ Insert: {+ anonKey: string+ apiUrl: string+ id?: boolean+ }+ Update: {+ anonKey?: string+ apiUrl?: string+ id?: boolean+ }+ Relationships: []+ }configurationParameter: {Row: {companyId: string@@ -25417,11 +25435,15 @@ export type Database = {companyId: stringcreatedAt: stringcreatedBy: string+ errorCount: numberid: string+ lastError: string | null+ lastSuccess: string | nullname: stringonDelete: booleanonInsert: booleanonUpdate: boolean+ successCount: numbertable: stringupdatedAt: string | nullupdatedBy: string | null@@ -25432,11 +25454,15 @@ export type Database = {companyId: stringcreatedAt?: stringcreatedBy: string+ errorCount?: numberid?: string+ lastError?: string | null+ lastSuccess?: string | nullname: stringonDelete?: booleanonInsert?: booleanonUpdate?: boolean+ successCount?: numbertable: stringupdatedAt?: string | nullupdatedBy?: string | null@@ -25447,11 +25473,15 @@ export type Database = {companyId?: stringcreatedAt?: stringcreatedBy?: string+ errorCount?: numberid?: string+ lastError?: string | null+ lastSuccess?: string | nullname?: stringonDelete?: booleanonInsert?: booleanonUpdate?: boolean+ successCount?: numbertable?: stringupdatedAt?: string | nullupdatedBy?: string | null@@ -33802,6 +33832,18 @@ export type Database = {}Returns: boolean}+ increment_webhook_error: {+ Args: {+ webhook_id: string+ }+ Returns: undefined+ }+ increment_webhook_success: {+ Args: {+ webhook_id: string+ }+ Returns: undefined+ }is_claims_admin: {Args: Record<PropertyKey, never>Returns: booleandiff --git a/packages/database/supabase/functions/webhook/index.ts b/packages/database/supabase/functions/webhook/index.tsnew file mode 100644index 0000000000..1199f47b69--- /dev/null+++ b/packages/database/supabase/functions/webhook/index.ts@@ -0,0 +1,89 @@+import { serve } from "https://deno.land/[email protected]/http/server.ts";+import { z } from "https://deno.land/x/[email protected]/mod.ts";+import { createClient } from "https://esm.sh/@supabase/[email protected]";+import { corsHeaders } from "../lib/headers.ts";+import type { Database } from "../lib/types.ts";++const payloadValidator = z.object({+ webhookId: z.string(),+ type: z.enum(["INSERT", "UPDATE", "DELETE"]),+ record: z.any(),+ old: z.any().optional(),+ url: z.string(),+ companyId: z.string(),+ table: z.string(),+});++serve(async (req: Request) => {+ if (req.method === "OPTIONS") {+ return new Response("ok", { headers: corsHeaders });+ }+ const payload = await req.json();+ const { type, record, old, url, companyId, table, webhookId } =+ payloadValidator.parse(payload);++ const serviceRole = createClient<Database>(+ Deno.env.get("SUPABASE_URL") ?? "",+ Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") ?? "",+ {+ auth: {+ autoRefreshToken: false,+ persistSession: false,+ },+ }+ );++ try {+ console.log({+ function: "webhook",+ type,+ url,+ companyId,+ table,+ });++ // Send webhook request+ const response = await fetch(url, {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ type,+ record,+ ...(old && { old }),+ companyId,+ table,+ }),+ });++ if (!response.ok) {+ throw new Error(`Webhook request failed with status ${response.status}`);+ }++ await serviceRole.rpc("increment_webhook_success", {+ webhook_id: webhookId,+ });++ return new Response(+ JSON.stringify({+ success: true,+ }),+ {+ headers: { ...corsHeaders, "Content-Type": "application/json" },+ status: 200,+ }+ );+ } catch (err) {+ console.error(err);+ if (webhookId) {+ await serviceRole.rpc("increment_webhook_error", {+ webhook_id: webhookId,+ });+ }+ return new Response(JSON.stringify(err), {+ headers: { ...corsHeaders, "Content-Type": "application/json" },+ status: 500,+ });+ }+});diff --git a/packages/database/supabase/migrations/20250203121216_webhooks.sql b/packages/database/supabase/migrations/20250203121216_webhooks.sqlindex 0e6878cfc5..d541a1d74e 100644--- a/packages/database/supabase/migrations/20250203121216_webhooks.sql+++ b/packages/database/supabase/migrations/20250203121216_webhooks.sql@@ -1,3 +1,22 @@+-- we need to store some environment variables for the webhook to work+CREATE TABLE "config" (+ "id" BOOLEAN DEFAULT TRUE,+ "apiUrl" TEXT NOT NULL,+ "anonKey" TEXT NOT NULL,++ CONSTRAINT "config_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "config_id_check" CHECK ("id" = TRUE)+);++ALTER TABLE "config" ENABLE ROW LEVEL SECURITY;++CREATE POLICY "SELECT" ON "config"+FOR SELECT+USING (+ auth.role() = 'authenticated'+);++CREATE TABLE "webhookTable" ("table" TEXT NOT NULL,"module" module NOT NULL,@@ -15,10 +34,7 @@ USING (auth.role() = 'authenticated');-INSERT INTO "webhookTable" ("table", "module", "name") VALUES-('quote', 'Sales', 'Quote'),-('salesOrder', 'Sales', 'Sales Order'),-('salesRfq', 'Sales', 'Sales RFQ');+CREATE TABLE "webhook" (@@ -30,6 +46,10 @@ CREATE TABLE "webhook" ("onInsert" BOOLEAN NOT NULL DEFAULT FALSE,"onUpdate" BOOLEAN NOT NULL DEFAULT FALSE,"onDelete" BOOLEAN NOT NULL DEFAULT FALSE,+ "successCount" BIGINT NOT NULL DEFAULT 0,+ "lastSuccess" TIMESTAMP WITH TIME ZONE,+ "errorCount" BIGINT NOT NULL DEFAULT 0,+ "lastError" TIMESTAMP WITH TIME ZONE,"companyId" TEXT NOT NULL,"createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,"createdBy" TEXT NOT NULL,@@ -37,10 +57,41 @@ CREATE TABLE "webhook" ("updatedBy" TEXT,CONSTRAINT "webhook_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "webhook_name_key" UNIQUE ("name", "companyId"),CONSTRAINT "webhook_table_fkey" FOREIGN KEY ("table") REFERENCES "webhookTable"("table") ON DELETE CASCADE ON UPDATE CASCADE,CONSTRAINT "webhook_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE);+CREATE OR REPLACE FUNCTION public.increment_webhook_success(webhook_id TEXT)+RETURNS void+LANGUAGE plpgsql+SECURITY DEFINER+AS $$+BEGIN+ UPDATE webhook+ SET+ "successCount" = "successCount" + 1,+ "lastSuccess" = NOW()+ WHERE "id" = webhook_id;+END;+$$;++CREATE OR REPLACE FUNCTION public.increment_webhook_error(webhook_id TEXT)+RETURNS void+LANGUAGE plpgsql+SECURITY DEFINER+AS $$+BEGIN+ UPDATE webhook+ SET+ "errorCount" = "errorCount" + 1,+ "lastError" = NOW()+ WHERE "id" = webhook_id;+END;+$$;+++ALTER TABLE "webhook" ENABLE ROW LEVEL SECURITY;@@ -86,4 +137,353 @@ USING (get_companies_with_employee_permission ('settings_delete'))::text[])-);\ No newline at end of file+);++CREATE EXTENSION IF NOT EXISTS pg_net;++CREATE OR REPLACE FUNCTION public.webhook_insert ()+RETURNS trigger+LANGUAGE plpgsql+SECURITY DEFINER+AS $$+DECLARE+ webhook_endpoint TEXT;+ api_url TEXT;+ anon_key TEXT;+ webhook_record RECORD;+BEGIN++ FOR webhook_record IN+ SELECT "url", "id"+ FROM webhook+ WHERE "companyId" = NEW."companyId"+ AND "onInsert" = true+ AND "table" = TG_TABLE_NAME+ AND "active" = true+ LOOP++ DECLARE+ request_id TEXT;+ BEGIN+ IF api_url IS NULL THEN+ SELECT "apiUrl", "anonKey" INTO api_url, anon_key FROM "config" LIMIT 1;+ webhook_endpoint := api_url || '/functions/v1/webhook';+ END IF;+++ SELECT net.http_post(+ webhook_endpoint,+ jsonb_build_object(+ 'type', 'INSERT',+ 'record', row_to_json(NEW),+ 'old', NULL,+ 'url', webhook_record.url,+ 'companyId', NEW."companyId",+ 'table', TG_TABLE_NAME,+ 'webhookId', webhook_record.id+ )::jsonb,+ '{}'::jsonb,+ jsonb_build_object('Content-Type', 'application/json', 'Authorization', 'Bearer ' || anon_key)+ ) INTO request_id;+++ END;+ END LOOP;++ RETURN NEW;+EXCEPTION WHEN OTHERS THEN+ RAISE LOG 'Error in webhook_insert: % %', SQLERRM, SQLSTATE;+ RETURN NEW;+END;+$$;++CREATE OR REPLACE FUNCTION public.webhook_update ()+RETURNS trigger+LANGUAGE plpgsql+SECURITY DEFINER+AS $$+DECLARE+ webhook_endpoint TEXT;+ api_url TEXT;+ anon_key TEXT;+ webhook_record RECORD;+BEGIN++ FOR webhook_record IN+ SELECT "url", "id"+ FROM webhook+ WHERE "companyId" = NEW."companyId"+ AND "onUpdate" = true+ AND "table" = TG_TABLE_NAME+ AND "active" = true+ LOOP++ DECLARE+ request_id TEXT;+ BEGIN+ IF api_url IS NULL THEN+ SELECT "apiUrl", "anonKey" INTO api_url, anon_key FROM "config" LIMIT 1;+ webhook_endpoint := api_url || '/functions/v1/webhook';+ END IF;+++ SELECT net.http_post(+ webhook_endpoint,+ jsonb_build_object(+ 'type', 'UPDATE',+ 'record', row_to_json(NEW),+ 'old', row_to_json(OLD),+ 'url', webhook_record.url,+ 'companyId', NEW."companyId",+ 'table', TG_TABLE_NAME,+ 'webhookId', webhook_record.id+ )::jsonb,+ '{}'::jsonb,+ jsonb_build_object('Content-Type', 'application/json', 'Authorization', 'Bearer ' || anon_key)+ ) INTO request_id;+++ END;+ END LOOP;++ RETURN NEW;+EXCEPTION WHEN OTHERS THEN+ RAISE LOG 'Error in webhook_insert: % %', SQLERRM, SQLSTATE;+ RETURN NEW;+END;+$$;++CREATE OR REPLACE FUNCTION public.webhook_delete()+RETURNS TRIGGER+LANGUAGE plpgsql+SECURITY DEFINER+AS $$+DECLARE+ webhook_endpoint TEXT;+ api_url TEXT;+ anon_key TEXT;+ webhook_record RECORD;+BEGIN++ FOR webhook_record IN+ SELECT "url", "id"+ FROM webhook+ WHERE "companyId" = OLD."companyId"+ AND "onDelete" = true+ AND "table" = TG_TABLE_NAME+ AND "active" = true+ LOOP++ DECLARE+ request_id TEXT;+ BEGIN+ IF api_url IS NULL THEN+ SELECT "apiUrl", "anonKey" INTO api_url, anon_key FROM "config" LIMIT 1;+ webhook_endpoint := api_url || '/functions/v1/webhook';+ END IF;++ SELECT net.http_post(+ webhook_endpoint,+ jsonb_build_object(+ 'type', 'DELETE',+ 'record', row_to_json(OLD),+ 'url', webhook_record.url,+ 'companyId', OLD."companyId",+ 'table', TG_TABLE_NAME,+ 'webhookId', webhook_record.id+ )::jsonb,+ '{}'::jsonb,+ jsonb_build_object('Content-Type', 'application/json', 'Authorization', 'Bearer ' || anon_key)+ ) INTO request_id;++ END;+ END LOOP;++ RETURN OLD;+EXCEPTION WHEN OTHERS THEN+ RAISE LOG 'Error in webhook_delete: % %', SQLERRM, SQLSTATE;+ RETURN OLD;+END;+$$;++++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('customer', 'Sales', 'Customer');++CREATE OR REPLACE TRIGGER "customerInsertWebhook"+AFTER INSERT ON "customer"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "customerUpdateWebhook"+AFTER UPDATE ON "customer"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "customerDeleteWebhook"+AFTER DELETE ON "customer"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('quote', 'Sales', 'Quote');++CREATE OR REPLACE TRIGGER "quoteInsertWebhook"+AFTER INSERT ON "quote"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "quoteUpdateWebhook"+AFTER UPDATE ON "quote"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "quoteDeleteWebhook"+AFTER DELETE ON "quote"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('salesOrder', 'Sales', 'Sales Order');++CREATE OR REPLACE TRIGGER "salesOrderInsertWebhook"+AFTER INSERT ON "salesOrder"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "salesOrderUpdateWebhook"+AFTER UPDATE ON "salesOrder"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "salesOrderDeleteWebhook"+AFTER DELETE ON "salesOrder"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('salesRfq', 'Sales', 'Sales RFQ');++CREATE OR REPLACE TRIGGER "salesRfqInsertWebhook"+AFTER INSERT ON "salesRfq"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "salesRfqUpdateWebhook"+AFTER UPDATE ON "salesRfq"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "salesRfqDeleteWebhook"+AFTER DELETE ON "salesRfq"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('job', 'Production', 'Job');++CREATE OR REPLACE TRIGGER "jobInsertWebhook"+AFTER INSERT ON "job"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "jobUpdateWebhook"+AFTER UPDATE ON "job"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "jobDeleteWebhook"+AFTER DELETE ON "job"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('item', 'Items', 'Item');++CREATE OR REPLACE TRIGGER "itemInsertWebhook"+AFTER INSERT ON "item"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "itemUpdateWebhook"+AFTER UPDATE ON "item"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "itemDeleteWebhook"+AFTER DELETE ON "item"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('receipt', 'Inventory', 'Receipt');++CREATE OR REPLACE TRIGGER "receiptInsertWebhook"+AFTER INSERT ON "receipt"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "receiptUpdateWebhook"+AFTER UPDATE ON "receipt"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "receiptDeleteWebhook"+AFTER DELETE ON "receipt"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('purchaseOrder', 'Purchasing', 'Purchase Order');++CREATE OR REPLACE TRIGGER "purchaseOrderInsertWebhook"+AFTER INSERT ON "purchaseOrder"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "purchaseOrderUpdateWebhook"+AFTER UPDATE ON "purchaseOrder"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "purchaseOrderDeleteWebhook"+AFTER DELETE ON "purchaseOrder"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('supplier', 'Purchasing', 'Supplier');++CREATE OR REPLACE TRIGGER "supplierInsertWebhook"+AFTER INSERT ON "supplier"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "supplierUpdateWebhook"+AFTER UPDATE ON "supplier"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "supplierDeleteWebhook"+AFTER DELETE ON "supplier"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('supplierQuote', 'Purchasing', 'Supplier Quote');++CREATE OR REPLACE TRIGGER "supplierQuoteInsertWebhook"+AFTER INSERT ON "supplierQuote"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "supplierQuoteUpdateWebhook"+AFTER UPDATE ON "supplierQuote"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "supplierQuoteDeleteWebhook"+AFTER DELETE ON "supplierQuote"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('purchaseInvoice', 'Invoicing', 'Purchase Invoice');++CREATE OR REPLACE TRIGGER "purchaseInvoiceInsertWebhook"+AFTER INSERT ON "purchaseInvoice"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "purchaseInvoiceUpdateWebhook"+AFTER UPDATE ON "purchaseInvoice"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "purchaseInvoiceDeleteWebhook"+AFTER DELETE ON "purchaseInvoice"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();++INSERT INTO "webhookTable" ("table", "module", "name") VALUES+('employee', 'Users', 'Employee');++CREATE OR REPLACE TRIGGER "employeeInsertWebhook"+AFTER INSERT ON "employee"+FOR EACH ROW EXECUTE FUNCTION public.webhook_insert();++CREATE OR REPLACE TRIGGER "employeeUpdateWebhook"+AFTER UPDATE ON "employee"+FOR EACH ROW EXECUTE FUNCTION public.webhook_update();++CREATE OR REPLACE TRIGGER "employeeDeleteWebhook"+AFTER DELETE ON "employee"+FOR EACH ROW EXECUTE FUNCTION public.webhook_delete();diff --git a/packages/form/src/components/Boolean.tsx b/packages/form/src/components/Boolean.tsxindex fb2fb59661..7af1c18979 100644--- a/packages/form/src/components/Boolean.tsx+++ b/packages/form/src/components/Boolean.tsx@@ -15,7 +15,7 @@ type FormBooleanProps = {label?: string;helperText?: string;isDisabled?: boolean;- description?: string;+ description?: string | JSX.Element;onChange?: (value: boolean) => void;};