Files
defiQUG c24ae925cf
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
Initial commit: AS4/411 directory and discovery service for Sankofa Marketplace
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 08:44:20 -08:00

31 lines
966 B
JavaScript

import { Resolver, InMemoryResolveCache } from "@as4-411/resolver";
import { InMemoryDirectoryStore } from "@as4-411/storage";
const store = new InMemoryDirectoryStore();
store.addTenant({ id: "t1", name: "Example Tenant" });
store.addParticipant({ id: "p1", tenantId: "t1", name: "Example Participant" });
store.addIdentifier({
id: "i1",
participantId: "p1",
identifier_type: "as4.partyId",
value: "0088:123456789",
priority: 1,
});
store.addEndpoint({
id: "e1",
participantId: "p1",
protocol: "as4",
address: "https://example.com/as4",
profile: "peppol-as4",
priority: 1,
status: "active",
});
const resolver = new Resolver({ store, cache: new InMemoryResolveCache() });
const result = await resolver.resolve({
identifiers: [{ type: "as4.partyId", value: "0088:123456789" }],
tenant: "t1",
});
console.log("Sidecar resolve OK. Directives:", result.directives.length);
console.log("Target URL:", result.directives[0]?.target_address);