Author: SRE Team · Last updated: February 2026 Constraint: All management and gateway access MUST traverse the Tailscale tailnet. Zero public ports.
The sync process happens in two main phases: fetching BOM data and syncing to the database.
File: apps/erp/app/routes/api+/integrations.onshape.d.$did.v.$vid.e.$eid.bom.ts
| CREATE TABLE "material" ( | |
| "id" TEXT NOT NULL PRIMARY KEY DEFAULT xid(), | |
| "materialFormId" TEXT, | |
| "materialSubstanceId" TEXT, | |
| "materialTypeId" TEXT, | |
| "finishId" TEXT, | |
| "gradeId" TEXT, | |
| "dimensionId" TEXT, | |
| "companyId" TEXT, | |
| "customFields" JSONB, |
| // deno-lint-ignore-file no-case-declarations | |
| import { serve } from "https://deno.land/std@0.175.0/http/server.ts"; | |
| import { format } from "https://deno.land/std@0.205.0/datetime/mod.ts"; | |
| import { nanoid } from "https://deno.land/x/nanoid@v3.0.0/mod.ts"; | |
| import { DB, getConnectionPool, getDatabaseClient } from "../lib/database.ts"; | |
| import { corsHeaders } from "../lib/headers.ts"; | |
| import { getSupabaseServiceRole } from "../lib/supabase.ts"; | |
| import type { Database } from "../lib/types.ts"; | |
| import { credit, debit, journalReference } from "../lib/utils.ts"; | |
| import { getCurrentAccountingPeriod } from "../shared/get-accounting-period.ts"; |
A manufacturing process is a function that turns inputs to outputs. We can think of it like a math function:
f(x) = y
In this simplified example x is all inputs, y is the manufactured good, and f is a transformation function that turns x into y. Of course we know that f is not necessarily one process, but multiple processes such that:
f(x) = g1(x) + g2(x) + ... gn(x)
| [ | |
| { | |
| "id": "1", | |
| "from": "Sample User", | |
| "address": "john@carbonos.dev", | |
| "time": "2021-10-07 15:35:14", | |
| "message": "Duis cursus, diam at pretium aliquet, metus urna convallis erat, eget tincidunt dui augue eu tellus. Phasellus elit pede, malesuada vel, venenatis vel, faucibus id, libero. Donec consectetuer mauris id sapien. Cras", | |
| "subject": "CarbonOS Interview", | |
| "tag": "inbox", | |
| "read": "false" |
| [ | |
| { | |
| "city": "Qal eh-ye Now", | |
| "timezone": "Asia/Kabul", | |
| "pop": 2997 | |
| }, | |
| { | |
| "city": "Chaghcharan", | |
| "timezone": "Asia/Kabul", | |
| "pop": 15000 |
| CREATE TABLE "group" ( | |
| "id" TEXT NOT NULL DEFAULT uuid_generate_v4(), | |
| "name" TEXT NOT NULL, | |
| "isIdentityGroup" BOOLEAN NOT NULL DEFAULT false, | |
| "isEmployeeTypeGroup" BOOLEAN NOT NULL DEFAULT false, | |
| "isCustomerOrgGroup" BOOLEAN NOT NULL DEFAULT false, | |
| "isCustomerTypeGroup" BOOLEAN NOT NULL DEFAULT false, | |
| "isSupplierTypeGroup" BOOLEAN NOT NULL DEFAULT false, | |
| "isSupplierOrgGroup" BOOLEAN NOT NULL DEFAULT false, | |
| "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), |
| function observe (obj) { | |
| if (Object.prototype.toString.call(obj) !== '[object Object]') { | |
| throw new TypeError() | |
| } | |
| Object.keys(obj).forEach(key => { | |
| let internalValue = obj[key] | |
| let dep = new Dependencies() | |
| Object.defineProperty(obj, key, { |