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
chore(mount): remove declaration comments
Raulfe26d03a0c5e
diff --git a/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx b/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsxindex 1cdba86e34..f2e70d30ad 100644--- a/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx+++ b/apps/erp/app/modules/settings/ui/Integrations/IntegrationForm.tsx@@ -569,12 +569,6 @@ export type IntegrationFormTab = {interface IntegrationFormProps {metadata: Record<string, unknown>;installed: boolean;- /**- * Collapse the settings and setup instructions behind a disclosure,- * labelled with `settingsLabel`, and move the actions above them. For an- * integration whose day-to-day surface is its actions: the credentials are- * entered once and then only re-read when something breaks.- */collapseSettings?: boolean;settingsLabel?: ReactNode;onClose: () => void;diff --git a/apps/erp/app/routes/api+/integrations.mount.publish.ts b/apps/erp/app/routes/api+/integrations.mount.publish.tsindex 94124d7fb2..12f5df5be4 100644--- a/apps/erp/app/routes/api+/integrations.mount.publish.ts+++ b/apps/erp/app/routes/api+/integrations.mount.publish.ts@@ -17,12 +17,6 @@ const PublishRequestSchema = z.object({entityType: z.enum(["customer", "supplier", "item"])});-/**- * POST — start a Mount publish for one family of records (the "Push- * customers / suppliers / parts" actions on the integration settings page).- * Fire-and-forget: the `mount-publish` job does the work, one run per company- * at a time, and records its outcome on the integration's metadata.- */export async function action({ request }: ActionFunctionArgs) {assertIsPost(request);const { client, companyId } = await requirePermissions(request, {diff --git a/apps/erp/app/routes/x+/settings+/integrations.$id.tsx b/apps/erp/app/routes/x+/settings+/integrations.$id.tsxindex c1e5a2ad39..caf7e3a65f 100644--- a/apps/erp/app/routes/x+/settings+/integrations.$id.tsx+++ b/apps/erp/app/routes/x+/settings+/integrations.$id.tsx@@ -1885,8 +1885,6 @@ export default function IntegrationRoute() {const [searchParams] = useSearchParams();const { id: integrationId } = useParams();- // Mount is used through its push actions once connected, so its credentials- // fold away beneath them.const collapseSettings = integrationId === "mount" && installed;// Accounting-category integrations get Account Mapping, Posting, Dimensionsdiff --git a/packages/ee/src/accounting/core/external-mapping.ts b/packages/ee/src/accounting/core/external-mapping.tsindex b0d5d4df6e..777c506ac8 100644--- a/packages/ee/src/accounting/core/external-mapping.ts+++ b/packages/ee/src/accounting/core/external-mapping.ts@@ -19,12 +19,6 @@ export interface ExternalIntegrationMapping {export interface LinkOptions {metadata?: Record<string, unknown>;remoteUpdatedAt?: Date | string;- /**- * When the Carbon side was read for this sync. Defaults to now. A caller that- * detects changes by comparing `lastSyncedAt` with the entity's `updatedAt`- * passes its read time, so an edit made while the sync was in flight still- * reads as newer and is picked up next time.- */lastSyncedAt?: Date | string;createdBy?: string;/**diff --git a/packages/ee/src/mount/config.tsx b/packages/ee/src/mount/config.tsxindex 45ce6442eb..97f851caf6 100644--- a/packages/ee/src/mount/config.tsx+++ b/packages/ee/src/mount/config.tsx@@ -5,7 +5,6 @@ import { MOUNT_DEFAULT_BASE_URL } from "./lib/constants";const MountSettingsSchema = z.object({clientId: z.string().min(1),- // Empty means "keep the existing vaulted secret"; presence enforced at install.clientSecret: z.string(),// A plain string check, not a refinement: zod v4 skips refinements for a// `.default()` value (conformance: no-default-on-effects).@@ -16,9 +15,6 @@ const MountSettingsSchema = z.object({.default(MOUNT_DEFAULT_BASE_URL),tenant: z.string().min(1),scope: z.string().optional(),- // Slug and titles, not ids. Mount never shows a user a UUID: the object- // definition's slug is in its settings URL, and company types are listed by- // title. The client resolves both to ids at publish time.partDefinitionSlug: z.string().min(1),customerTypeTitle: z.string().optional(),supplierTypeTitle: z.string().optional()@@ -153,11 +149,6 @@ export const Mount = defineIntegration({]});-/**- * Steps verified against Mount's own admin UI, and against the API itself.- * Member ID is called out because a client with no member is refused on every- * request with a bare 403, and the integration can only report "unhealthy".- */function SetupInstructions() {return (<>@@ -215,10 +206,6 @@ function SetupInstructions() {);}-/**- * Placeholder mark in `currentColor`, matching the other integration logos.- * Replace with Mount's own asset when they provide one.- */function Logo(props: ComponentProps<"svg">) {return (<svgdiff --git a/packages/ee/src/mount/hooks.server.ts b/packages/ee/src/mount/hooks.server.tsindex 4b5c543a87..fb9ae8f958 100644--- a/packages/ee/src/mount/hooks.server.ts+++ b/packages/ee/src/mount/hooks.server.ts@@ -1,21 +1,5 @@import { getMountClient } from "./lib/client";-/**- * Mount has no install-time server state to converge.- *- * An earlier revision registered event-system subscriptions here so a write to- * customer/supplier/item would push immediately. That was wrong twice over:- * the event queue routes every SYNC record into the accounting sync function,- * whose payload schema only admits accounting providers — a Mount record would- * fail the parse for the whole chunk, taking any accounting records batched- * with it. Delivery is the publish sweep instead (see lib/publish.ts), which- * needs no subscriptions and is its own retry.- *- * If near-real-time publishing is ever wanted, the way in is a new event-system- * handler type (the path SEARCH, AUDIT and EMBEDDING took), not a SYNC- * subscription — and the sweep still has to sit underneath it, because a- * dropped event is otherwise invisible.- */export async function mountHealthcheck(companyId: string) {return await getMountClient().healthcheck(companyId);}diff --git a/packages/ee/src/mount/lib/client.ts b/packages/ee/src/mount/lib/client.tsindex e4dad88400..bf2383426b 100644--- a/packages/ee/src/mount/lib/client.ts+++ b/packages/ee/src/mount/lib/client.ts@@ -37,37 +37,11 @@ type MountSettings = {type CachedToken = {accessToken: string;expiresAt: number;- /** The settings the token was issued under; see `connectionKey`. */connection: string;};-/**- * Re-exchange this long before a token actually lapses, so a request never- * races the expiry it was issued under.- */const TOKEN_EXPIRY_MARGIN_MS = 60_000;-/**- * Mount's OpenAPI spec declares no `securitySchemes` at all, so the shape here- * comes from its admin UI's own usage instructions: OAuth 2.0 client- * credentials against `/auth/v2/token`, then a bearer token plus `X-Tenant` on- * every call. Tenants are configured separately, so one Carbon company maps to- * one Mount tenant.- *- * Mount also offers "direct key auth", sending the client secret itself as the- * bearer. Do not use it here: that mode is only honoured by Mount's MCP- * endpoint, and the REST API answers every request with a bare 403 — no body,- * no explanation — which reads exactly like a permissions problem.- *- * The token response is NOT the OAuth-standard shape. It is camelCase with an- * absolute expiry (`accessToken`, `refreshToken`, `expiresAt`,- * `refreshExpiresAt`) and carries no `token_type` or `expires_in`.- *- * Tokens are cached in memory per company and never persisted. There is no- * refresh-token handling on purpose: the secret is vaulted, so a new token is- * always one call away, which avoids the concurrent-rotation problem the- * accounting OAuth clients carry.- */export class MountClient {instance: AxiosInstance;private tokens = new Map<string, CachedToken>();@@ -166,7 +140,6 @@ export class MountClient {return accessToken;}- /** Drops a company's cached token; the next call re-exchanges. */invalidateToken(companyId: string) {this.tokens.delete(companyId);}@@ -328,12 +301,6 @@ export class MountClient {return MountObjectDefinitionSchema.array().parse(data);}- /**- * Resolve the definition a user named by slug. The slug is what Mount shows- * them (it is the definition's settings URL); the id is what the write- * payload needs. Resolved per publish run, not stored, so renaming a- * definition in Mount does not silently strand the integration.- */async findObjectDefinitionBySlug(companyId: string,slug: string@@ -347,7 +314,6 @@ export class MountClient {return match ?? null;}- /** Company types are listed to users by title; the payload needs the id. */async findCompanyTypeByTitle(companyId: string,title: string@@ -369,11 +335,6 @@ export class MountClient {return MountCompanyTypeSchema.array().parse(data);}- /**- * `identifier` is not enforced unique by Mount, so this can legitimately- * return more than one row. The caller treats >1 as ambiguous rather than- * picking one — silently patching the wrong record is worse than failing.- */async findCompaniesByIdentifier(companyId: string,identifier: string@@ -469,11 +430,6 @@ export class MountClient {}}-/**- * Identifies the Mount connection a cached value belongs to. Changing the- * client, secret, tenant or API URL in settings must not keep serving a token- * or domain id issued under the old ones. In memory only, never persisted.- */function connectionKey(settings: MountSettings) {return [settings.baseUrl || MOUNT_DEFAULT_BASE_URL,@@ -488,7 +444,6 @@ const MOUNT_REQUEST_TIMEOUT_MS = 30_000;const UUID_PATTERN =/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;-/** OData string literals escape a single quote by doubling it. */export function escapeODataString(value: string) {return value.replace(/'/g, "''");}diff --git a/packages/ee/src/mount/lib/constants.ts b/packages/ee/src/mount/lib/constants.tsindex 3fde98c76b..e09008c6a8 100644--- a/packages/ee/src/mount/lib/constants.ts+++ b/packages/ee/src/mount/lib/constants.ts@@ -8,16 +8,10 @@export const MOUNT_DEFAULT_BASE_URL = "https://api.mount.cloud";-/**- * Mount versions its API by date. Omitting the header defaults to `latest`,- * so this is always sent. Bumping it is a breaking-change review:- * 2026-04-01 -> 2026-06-01 already changed the update payload shape.- */export const MOUNT_API_VERSION = "2026-06-01";export const MOUNT_INTEGRATION_ID = "mount";-/** The Mount API URL receives the client secret, so it must be HTTPS. */export function isHttpsUrl(value: string) {try {return new URL(value).protocol === "https:";diff --git a/packages/ee/src/mount/lib/mappers.ts b/packages/ee/src/mount/lib/mappers.tsindex 9382dab7b9..dee55bd0e3 100644--- a/packages/ee/src/mount/lib/mappers.ts+++ b/packages/ee/src/mount/lib/mappers.ts@@ -80,12 +80,6 @@ export function mapSupplierToMountCompany(};}-/**- * Part number -> `identifier`, part name -> `title`. Mount generates an- * identifier from the definition's prefix when one is not supplied, so passing- * Carbon's part number explicitly is what keeps the two sides legible to a- * quality handler.- */export function mapItemToMountObject(item: CarbonItemRecord,definitionId: stringdiff --git a/packages/ee/src/mount/lib/publish.test.ts b/packages/ee/src/mount/lib/publish.test.tsindex 41bd230a8e..1524ab7843 100644--- a/packages/ee/src/mount/lib/publish.test.ts+++ b/packages/ee/src/mount/lib/publish.test.ts@@ -71,7 +71,6 @@ function createFakeMappings() {return { mappings, rows };}-/** Mirrors the real source's ordering: deferred records sort last. */function partSource(parts: PublishablePart[]): MountPublishSource {return {async listStale(_entityType, limit, deferIds = []) {diff --git a/packages/ee/src/mount/lib/publish.ts b/packages/ee/src/mount/lib/publish.tsindex 01eb0219cd..70f3095125 100644--- a/packages/ee/src/mount/lib/publish.ts+++ b/packages/ee/src/mount/lib/publish.ts@@ -38,12 +38,6 @@ export type PublishableSupplier = CarbonCompanyRecord & { id: string };export type PublishablePart = CarbonItemRecord & { id: string };export type MountPublishSource = {- /**- * Carbon records of this type that are missing from Mount or changed since- * they were last published. Ordered oldest-change first so a capped run- * always makes progress instead of re-reading the same head, with- * `deferIds` after everything else.- */listStale(entityType: MountEntityType,limit: number,@@ -63,22 +57,12 @@ export type MountPublishSummary = {entityType: MountEntityType;created: number;updated: number;- /** Identifier matched more than one Mount record; a person must resolve it. */ambiguous: Array<{ entityId: string; identifier: string; matches: number }>;- /** Record could not be mapped or the push threw. */failed: Array<{ entityId: string; reason: string }>;- /** True when the cap was hit and records not already deferred remain. */more: boolean;- /**- * Records to sort last on the next run: this run's failures and ambiguous- * matches, plus earlier ones the cap kept this run from reaching. Without- * it a record that can never publish stays stale, sorts first by age, and- * takes a slot in every run ahead of records that would succeed.- */deferred: string[];};-/** Records per run. A cap keeps one button press bounded and re-runnable. */export const MOUNT_PUBLISH_BATCH_SIZE = 200;export async function publishEntityType(@@ -113,7 +97,6 @@ export async function publishEntityType(return summary;}- // Taken before the read, so anything edited after it stays stale.const readAt = datetime.timestamp();const records = await source.listStale(entityType, limit + 1, deferIds);const batch = records.slice(0, limit);diff --git a/packages/ee/src/mount/lib/push.test.ts b/packages/ee/src/mount/lib/push.test.tsindex 8edacec55c..7ef68dc928 100644--- a/packages/ee/src/mount/lib/push.test.ts+++ b/packages/ee/src/mount/lib/push.test.ts@@ -15,11 +15,6 @@ import {const COMPANY_ID = "co_1";const PART_DEFINITION = "def_part";-/**- * An in-memory stand-in for Mount that behaves the way the real API does,- * including the part that matters most here: `identifier` is NOT unique, so a- * second create with the same identifier succeeds and leaves two rows.- */function createFakeMount() {const companies: MountCompany[] = [];const objects: MountObject[] = [];diff --git a/packages/ee/src/mount/lib/push.ts b/packages/ee/src/mount/lib/push.tsindex 66b2ae2fa4..1f2a0d3c59 100644--- a/packages/ee/src/mount/lib/push.ts+++ b/packages/ee/src/mount/lib/push.ts@@ -9,11 +9,6 @@ import {type MountObjectInput} from "./types";-/**- * The slice of `ExternalIntegrationMappingService` a push needs. Mount has no- * external-id field, no idempotency key and no ETag, so this table is the only- * record of which Mount row a Carbon record owns.- */export type MountMappingPort = {getExternalId(entityType: string,@@ -33,7 +28,6 @@ export type MountMappingPort = {): Promise<void>;};-/** The slice of `MountClient` a push needs. */export type MountApiPort = {findCompaniesByIdentifier(companyId: string,@@ -69,16 +63,6 @@ export type PushOutcome =| { status: "updated"; externalId: string }| { status: "ambiguous"; identifier: string; matches: number };-/**- * Resolution order for every push: the mapping row first, then a lookup by- * identifier to adopt a record someone created by hand, then create. Mount- * accepts duplicate identifiers, so more than one match is reported rather- * than resolved — patching an arbitrary one of two records is worse than- * failing loudly.- *- * A mapped record that was deleted in Mount falls through to the lookup and- * is published again: Carbon is the master, so Mount does not get to drop it.- */export async function pushCompanyToMount(mappings: MountMappingPort,api: MountApiPort,@@ -185,15 +169,6 @@ export async function pushItemToMount(return { status: match ? "updated" : "created", externalId: mountId };}-/**- * The mapping's metadata records what Carbon last sent. Mount's PATCH does not- * return the record, so the payload is the only snapshot available on update.- *- * `readAt` is when the record was read from Carbon, stored as `lastSyncedAt`.- * Stamping the link time instead would hide an edit made between the read and- * the push: its `updatedAt` would sort before `lastSyncedAt` and the sweep- * would never send it.- */async function link(mappings: MountMappingPort,entityType: MountEntityType,diff --git a/packages/ee/src/mount/lib/run.ts b/packages/ee/src/mount/lib/run.tsindex ef13388ae5..ca8435c2f9 100644--- a/packages/ee/src/mount/lib/run.ts+++ b/packages/ee/src/mount/lib/run.ts@@ -18,11 +18,6 @@ import type { MountEntityType } from "./types";const logger = getLogger("ee", "mount");-/**- * One publish run: resolve settings, sweep, record the outcome. The- * `mount-publish` job calls it for the integration's push actions, and a cron- * would call it the same way.- */export async function runMountPublish({serviceRole,db,@@ -107,11 +102,6 @@ export async function runMountPublish({return { status: "ran", summaries };}-/**- * Persist what happened, including the deferred ids the next run sorts last.- * A record that never published has no mapping row to carry a reason, so- * this is the only record of why it failed or was ambiguous.- */async function recordOutcome(serviceRole: SupabaseClient<Database>,companyId: string,diff --git a/packages/ee/src/mount/lib/source.ts b/packages/ee/src/mount/lib/source.tsindex 7dc8061453..d1f7215f95 100644--- a/packages/ee/src/mount/lib/source.ts+++ b/packages/ee/src/mount/lib/source.ts@@ -8,18 +8,6 @@ import type {import { MOUNT_INTEGRATION_ID } from "./service";import type { MountEntityType } from "./types";-/**- * "Stale" is: no mapping row, or the Carbon record changed after it was last- * published. That definition is what makes the sweep idempotent — a run that- * succeeds takes a record out of the set, and a run that fails leaves it in.- *- * Records that failed or were ambiguous on earlier runs (`deferIds`) sort- * after everything else, so they only take capacity the rest of the stale set- * leaves over.- *- * Every record publishes regardless of active status; see the note in- * mappers.ts.- */export function createMountPublishSource(db: Kysely<KyselyDatabase>,companyId: stringdiff --git a/packages/ee/src/mount/lib/types.ts b/packages/ee/src/mount/lib/types.tsindex f0aad94e83..bcc4ca8b15 100644--- a/packages/ee/src/mount/lib/types.ts+++ b/packages/ee/src/mount/lib/types.ts@@ -54,11 +54,9 @@ export type MountObject = z.infer<typeof MountObjectSchema>;export type MountObjectDefinition = z.infer<typeof MountObjectDefinitionSchema>;export type MountCompanyType = z.infer<typeof MountCompanyTypeSchema>;-/** The Carbon-side entity types this integration pushes. */export const MOUNT_ENTITY_TYPES = ["customer", "supplier", "item"] as const;export type MountEntityType = (typeof MOUNT_ENTITY_TYPES)[number];-/** Write payloads. Mount names these `*Partial` in its OpenAPI spec. */export type MountCompanyInput = {identifier: string;name: string;@@ -74,17 +72,12 @@ export type MountObjectInput = {definitionId: string;};-/**- * What `PATCH /X/{id}` returns: the fields that changed, not the record. An- * update that changes nothing returns an empty list.- */export type MountChange = {field: string;oldValue?: unknown;newValue?: unknown;};-/** The Mount record a mapping row points at no longer exists. */export class MountNotFoundError extends Error {constructor(collection: string, mountId: string) {super(`Mount ${collection} ${mountId} not found`);