caelum0x e361a8dc22 feat: ProofChain platform — 64 contracts (11 modules), backend API, expanded web
- core: AddressBook registry, Roles lib, ProofChainAccess base, Pauser
- modules: provenance, payments/treasury, identity, reputation, finance/RWA,
  insurance, disputes+governance, esg/tokenization, marketplace, rewards
- @proofchain/api: 33 routers + event indexer (Supabase)
- web: 37 pages incl landing, explorer, finance, governance, esg, marketplace
- 704 forge tests + 449 vitest tests green; 61 ABIs exported

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-31 19:22:38 +03:00

30 lines
1.0 KiB
TypeScript

/**
* Deterministic in-package double for `@proofchain/infra`.
*
* The API only uses `createSupabaseStore(...).raw()` to borrow the underlying
* client. By default `raw()` is null (so the DB layer exercises its graceful
* no-op path). Tests that want to drive the LIVE query path install a fake
* PostgREST-shaped client via `__setRawClient(...)`; `createSupabaseStore`
* returns it whenever the config is `configured`.
*/
export interface FakeStore {
raw(): unknown | null;
}
let injectedRawClient: unknown | null = null;
/** Test-only: set the fake raw client returned for configured stores. */
export const __setRawClient = (client: unknown | null): void => {
injectedRawClient = client;
};
export const createSupabaseStore = async (config: {
supabase: { configured: boolean; url?: string; serviceRoleKey?: string };
ipfs?: { configured: boolean; apiUrl: string; gatewayUrl: string; jwt?: string };
}): Promise<FakeStore> => {
if (!config.supabase.configured) {
return { raw: () => null };
}
return { raw: () => injectedRawClient };
};