Files
Solaire/src/integrations/mock.ts
oceans2alaska 135be480e5
Some checks failed
CI / verify (push) Has been cancelled
Build the Solaire inventory intelligence MVP
Add the tenant-ready dashboard, freshness and pricing analytics, mock integration adapters, persistence schema, and verification tooling needed for the initial pilot.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 12:16:52 -07:00

45 lines
1.0 KiB
TypeScript

import {
branches,
inventoryBatches,
products,
sales,
salespeople,
} from "@/lib/demo-data";
import type { IntegrationProvider } from "@/lib/types";
import type { IntegrationAdapter, SyncPage } from "@/integrations/types";
function page<T>(records: T[]): SyncPage<T> {
return { records, nextCursor: null };
}
export class MockIntegrationAdapter implements IntegrationAdapter {
constructor(readonly provider: IntegrationProvider) {}
async testConnection() {
return {
ok: true,
message: `${this.provider === "odoo" ? "Odoo" : "Salesforce"} demo source is ready`,
};
}
async fetchProducts() {
return page(this.provider === "odoo" ? products : []);
}
async fetchBranches() {
return page(branches);
}
async fetchInventory() {
return page(this.provider === "odoo" ? inventoryBatches : []);
}
async fetchSalespeople() {
return page(this.provider === "salesforce" ? salespeople : []);
}
async fetchSales() {
return page(this.provider === "salesforce" ? sales : []);
}
}