diff --git a/AGENTS.md b/AGENTS.md index 094e49d..e295b84 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -51,16 +51,19 @@ required. ## Updating the upstream artifact -Use a detached, clean Mini worktree at the intended commit. Build `@minmo/core` -before the private SDK workspace, then run: +Use the one-command refresh with the intended Mini commit or ref: ```sh -npm run vendor:upstream -- --worktree /path/to/mini-worktree +npm run refresh:upstream -- --ref ``` -Review `vendor/upstream/manifest.json`, run the full verification commands, and -commit the generated artifact together with any facade or documentation changes -that depend on it. Never edit generated vendor files by hand. +The command installs locked dependencies, creates a temporary detached Mini +worktree, builds `@minmo/core` and the private SDK in order, refreshes the +artifact, runs the full package verification, and reports removed declaration +lines. Use +`--mini ` when Mini is not the sibling `../mini` checkout. Review +`vendor/upstream/manifest.json` and every reported removal before committing. +Never edit generated vendor files by hand. ## Compatibility and releases diff --git a/RELEASING.md b/RELEASING.md index cd3ef99..34b57e3 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -29,6 +29,40 @@ Do not add a long-lived npm automation token to GitHub Actions. ## Preparing a release +### Refreshing the vendored Mini SDK + +Start from a clean public SDK checkout and pin the intended Mini commit: + +```sh +npm run refresh:upstream -- --ref +``` + +The command uses the sibling `../mini` repository by default. It fetches that +repository's `origin`, installs locked dependencies in both repositories, +creates a temporary detached worktree at the resolved commit, builds +`@minmo/core` and the private SDK, regenerates `vendor/upstream`, and runs: + +```sh +npm run check +npm run test:package +npm pack --dry-run +``` + +Use `--mini ` for another local Mini repository or `--no-fetch` when +the pinned commit is already available and the refresh must stay offline. + +After the command succeeds, review: + +- the old and new commits printed by the command; +- `vendor/upstream/manifest.json`; +- the generated artifact diff; +- every removed declaration line reported as a compatibility risk. + +Commit only the generated vendor artifact and any public tests or documentation +that explain its consumer-visible changes. Do not commit `dist`, a package +tarball, or the temporary Mini worktree. The refresh command does not update +versions, changelogs, tags, or npm. + Merge changes using Conventional Commit subjects: - `fix: ...` requests a patch release. diff --git a/package.json b/package.json index 6d92d19..e41e609 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "test:package": "node scripts/test-package.mjs", "check": "npm run verify:upstream && npm run typecheck && npm test && npm run verify:dist", "prepack": "npm run check", + "refresh:upstream": "node scripts/refresh-upstream.mjs", "vendor:upstream": "node scripts/vendor-upstream.mjs" }, "devDependencies": { diff --git a/scripts/refresh-upstream.mjs b/scripts/refresh-upstream.mjs new file mode 100644 index 0000000..56d0a39 --- /dev/null +++ b/scripts/refresh-upstream.mjs @@ -0,0 +1,271 @@ +import { execFileSync } from "node:child_process"; +import { + existsSync, + mkdtempSync, + readFileSync, + rmSync, + statSync, +} from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const scriptPath = fileURLToPath(import.meta.url); +const repositoryRoot = resolve(dirname(scriptPath), ".."); +const defaultMiniRepository = resolve(repositoryRoot, "..", "mini"); +const manifestPath = join( + repositoryRoot, + "vendor", + "upstream", + "manifest.json", +); + +const usage = [ + "Usage:", + " npm run refresh:upstream -- --ref [--mini ] [--no-fetch]", + "", + "Options:", + " --ref Mini commit or ref to vendor (required)", + " --mini Mini repository (default: ../mini)", + " --no-fetch Resolve the ref without fetching origin first", + " --help Show this help", + "", +].join("\n"); + +export function parseOptions( + args, + { defaultMiniPath = defaultMiniRepository } = {}, +) { + const options = { + ref: undefined, + miniRepository: resolve(defaultMiniPath), + fetch: true, + help: false, + }; + + for (let index = 0; index < args.length; index += 1) { + const option = args[index]; + if (option === "--help") { + options.help = true; + continue; + } + if (option === "--no-fetch") { + options.fetch = false; + continue; + } + if (option === "--ref") { + options.ref = requiredOptionValue(args, ++index, option); + continue; + } + if (option === "--mini") { + options.miniRepository = resolve( + requiredOptionValue(args, ++index, option), + ); + continue; + } + throw new Error("Unknown option: " + option); + } + + if (!options.help && !options.ref) { + throw new Error("--ref is required"); + } + return options; +} + +export function removedDeclarationLines(diff) { + const removals = []; + let declarationFile; + + for (const line of diff.split("\n")) { + const header = /^diff --git a\/(.+) b\/(.+)$/.exec(line); + if (header) { + declarationFile = /\.d\.(?:ts|mts)$/.test(header[2]) + ? header[2] + : undefined; + continue; + } + if ( + declarationFile && + line.startsWith("-") && + !line.startsWith("---") + ) { + removals.push({ file: declarationFile, line: line.slice(1) }); + } + } + + return removals; +} + +export function refreshUpstream(options) { + assertDirectory(options.miniRepository, "Mini repository"); + assertCleanSdkCheckout(); + + run("npm", ["ci"], repositoryRoot); + const previousManifest = JSON.parse(readFileSync(manifestPath, "utf8")); + if (options.fetch) { + run("git", ["fetch", "origin"], options.miniRepository); + } + + const upstreamCommit = capture( + "git", + ["rev-parse", "--verify", options.ref + "^{commit}"], + options.miniRepository, + ).trim(); + if (!/^[0-9a-f]{40}$/.test(upstreamCommit)) { + throw new Error( + "Could not resolve a full Mini commit for " + options.ref, + ); + } + + const temporaryRoot = mkdtempSync(join(tmpdir(), "minmo-sdk-vendor-")); + const miniWorktree = join(temporaryRoot, "mini"); + let worktreeAdded = false; + + try { + run( + "git", + ["worktree", "add", "--detach", miniWorktree, upstreamCommit], + options.miniRepository, + ); + worktreeAdded = true; + + run("npm", ["ci"], miniWorktree); + run( + "npm", + ["run", "build", "--workspace=@minmo/core"], + miniWorktree, + ); + run( + "npm", + ["run", "build", "--workspace=@minmo/sdk"], + miniWorktree, + ); + run( + process.execPath, + [ + join(repositoryRoot, "scripts", "vendor-upstream.mjs"), + "--worktree", + miniWorktree, + ], + repositoryRoot, + ); + + run("npm", ["run", "check"], repositoryRoot); + run("npm", ["run", "test:package"], repositoryRoot); + run("npm", ["pack", "--dry-run"], repositoryRoot); + + reportRefresh(previousManifest.upstreamCommit, upstreamCommit); + } finally { + if (worktreeAdded) { + try { + run( + "git", + ["worktree", "remove", "--force", miniWorktree], + options.miniRepository, + ); + } catch (error) { + console.error( + "Failed to remove temporary Mini worktree: " + error.message, + ); + } + } + try { + run("git", ["worktree", "prune"], options.miniRepository); + } catch (error) { + console.error("Failed to prune Mini worktrees: " + error.message); + } + rmSync(temporaryRoot, { recursive: true, force: true }); + } +} + +function requiredOptionValue(args, index, option) { + const value = args[index]; + if (!value || value.startsWith("--")) { + throw new Error(option + " requires a value"); + } + return value; +} + +function assertCleanSdkCheckout() { + const status = capture("git", ["status", "--porcelain"], repositoryRoot).trim(); + if (status) { + throw new Error( + "The public SDK checkout must be clean before refreshing vendored artifacts", + ); + } +} + +function assertDirectory(path, label) { + if (!existsSync(path) || !statSync(path).isDirectory()) { + throw new Error(label + " does not exist: " + path); + } +} + +function run(command, args, cwd) { + console.log("\n> " + command + " " + args.join(" ")); + execFileSync(command, args, { cwd, stdio: "inherit" }); +} + +function capture(command, args, cwd) { + return execFileSync(command, args, { + cwd, + encoding: "utf8", + stdio: ["ignore", "pipe", "inherit"], + }); +} + +function reportRefresh(previousCommit, upstreamCommit) { + const stat = capture( + "git", + ["diff", "--stat", "--", "vendor/upstream"], + repositoryRoot, + ).trim(); + const declarationDiff = capture( + "git", + [ + "diff", + "--unified=0", + "--", + "vendor/upstream/runtime.d.mts", + ":(glob)vendor/upstream/**/*.d.ts", + ], + repositoryRoot, + ); + const removals = removedDeclarationLines(declarationDiff); + + console.log("\nVendored Mini SDK refresh complete"); + console.log(" previous: " + previousCommit); + console.log(" current: " + upstreamCommit); + console.log("\nGenerated artifact diff:"); + console.log(stat || " No vendored artifact changes"); + + if (removals.length === 0) { + console.log("\nNo removed declaration lines detected."); + return; + } + + console.log( + "\nRemoved declaration lines require compatibility review before release:", + ); + for (const removal of removals.slice(0, 100)) { + console.log(" - " + removal.file + ": " + removal.line); + } + if (removals.length > 100) { + console.log(" ... and " + (removals.length - 100) + " more"); + } +} + +if (process.argv[1] && resolve(process.argv[1]) === scriptPath) { + try { + const options = parseOptions(process.argv.slice(2)); + if (options.help) { + console.log(usage); + } else { + refreshUpstream(options); + } + } catch (error) { + console.error(error instanceof Error ? error.message : error); + console.error("\n" + usage); + process.exitCode = 1; + } +} diff --git a/test/refresh-upstream.test.mjs b/test/refresh-upstream.test.mjs new file mode 100644 index 0000000..6edd728 --- /dev/null +++ b/test/refresh-upstream.test.mjs @@ -0,0 +1,71 @@ +import assert from "node:assert/strict"; +import { test } from "node:test"; + +import { + parseOptions, + removedDeclarationLines, +} from "../scripts/refresh-upstream.mjs"; + +test("parses a pinned upstream ref with safe defaults", () => { + assert.deepEqual( + parseOptions(["--ref", "origin/main"], { + defaultMiniPath: "/repos/mini", + }), + { + ref: "origin/main", + miniRepository: "/repos/mini", + fetch: true, + help: false, + }, + ); +}); + +test("supports an explicit Mini repository and offline resolution", () => { + const options = parseOptions([ + "--ref", + "4e5e473c834535699553ede6b9c4923eef443d96", + "--mini", + "/tmp/mini", + "--no-fetch", + ]); + + assert.equal( + options.ref, + "4e5e473c834535699553ede6b9c4923eef443d96", + ); + assert.equal(options.miniRepository, "/tmp/mini"); + assert.equal(options.fetch, false); +}); + +test("requires a ref and rejects incomplete options", () => { + assert.throws(() => parseOptions([]), /--ref is required/); + assert.throws(() => parseOptions(["--ref"]), /--ref requires a value/); + assert.throws(() => parseOptions(["--unknown"]), /Unknown option/); +}); + +test("reports removed declaration lines without implementation noise", () => { + const diff = [ + "diff --git a/vendor/upstream/sdk/pay/client.d.ts b/vendor/upstream/sdk/pay/client.d.ts", + "index 1111111..2222222 100644", + "--- a/vendor/upstream/sdk/pay/client.d.ts", + "+++ b/vendor/upstream/sdk/pay/client.d.ts", + "@@ -1,2 +1 @@", + "- export(query?: Query): Promise;", + " create(): Promise;", + "diff --git a/vendor/upstream/runtime.mjs b/vendor/upstream/runtime.mjs", + "index 3333333..4444444 100644", + "--- a/vendor/upstream/runtime.mjs", + "+++ b/vendor/upstream/runtime.mjs", + "@@ -1 +1 @@", + "-implementation detail", + "+replacement detail", + "", + ].join("\n"); + + assert.deepEqual(removedDeclarationLines(diff), [ + { + file: "vendor/upstream/sdk/pay/client.d.ts", + line: " export(query?: Query): Promise;", + }, + ]); +}); diff --git a/vendor/upstream/core/types/agent.d.ts b/vendor/upstream/core/types/agent.d.ts index 5c3ab47..470e9ee 100644 --- a/vendor/upstream/core/types/agent.d.ts +++ b/vendor/upstream/core/types/agent.d.ts @@ -45,6 +45,11 @@ export declare enum SwapState { FIAT_RECEIVER_TIMEOUT = "fiat_receiver_timeout", TRANSFERRED_TO_BACKUP = "transferred_to_backup" } +export declare enum SwapRepairAction { + ATTACH_ESCROW = "attach_escrow", + CLOSE_LEGACY = "close_legacy", + RECOVER_PAYOUT = "recover_payout" +} export declare enum SwapCancellationActorType { USER = "user", AGENT = "agent", diff --git a/vendor/upstream/core/types/pay.d.ts b/vendor/upstream/core/types/pay.d.ts index 1fa94dc..b52c597 100644 --- a/vendor/upstream/core/types/pay.d.ts +++ b/vendor/upstream/core/types/pay.d.ts @@ -130,6 +130,10 @@ export interface PayInvoice { paidAmount?: string; /** Hosted checkout page to send the customer to. */ checkoutUrl?: string; + /** Raw BOLT11 payment request for a direct Lightning payment. */ + lightningInvoice?: string; + /** Bitcoin address for a direct on-chain payment. */ + onChainAddress?: string; /** The partner's own reference, echoed back. */ reference?: string | null; createdAt?: string; diff --git a/vendor/upstream/manifest.json b/vendor/upstream/manifest.json index 09a7407..deeeb6e 100644 --- a/vendor/upstream/manifest.json +++ b/vendor/upstream/manifest.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, "upstreamRepository": "https://github.com/minmoto/mini", - "upstreamCommit": "e5a57d82556d787d0c3be677b32b7ac02f93c65a", - "artifactSha256": "91833e2e0c0f677fd27a45a3d81601388720119ff6124a9f0142a5bfdaed3846" + "upstreamCommit": "4e5e473c834535699553ede6b9c4923eef443d96", + "artifactSha256": "b3aaf0bd5bc0de36312bfbb5401f7d551578c95a2264dead255492d4ce23e479" } diff --git a/vendor/upstream/runtime.mjs b/vendor/upstream/runtime.mjs index f256466..1ef911d 100644 --- a/vendor/upstream/runtime.mjs +++ b/vendor/upstream/runtime.mjs @@ -185,12 +185,17 @@ var EventSubscriptionImpl = class { this.http = http; this.options = options; this.streamKey = options.streamKey ?? this.defaultStreamKey(); - options.signal?.addEventListener("abort", () => void this.close(), { - once: true - }); + if (options.signal?.aborted) { + void this.close(); + } else { + options.signal?.addEventListener("abort", () => void this.close(), { + once: true + }); + } void this.run(); } currentState = "idle" /* IDLE */; + hasConnected = false; abortController = new AbortController(); seenIds = /* @__PURE__ */ new Set(); streamKey; @@ -213,7 +218,7 @@ var EventSubscriptionImpl = class { while (!this.abortController.signal.aborted) { try { this.setState( - retry ? "reconnecting" /* RECONNECTING */ : "connecting" /* CONNECTING */ + retry || this.hasConnected ? "reconnecting" /* RECONNECTING */ : "connecting" /* CONNECTING */ ); await this.connect(); retry = 0; @@ -265,6 +270,7 @@ var EventSubscriptionImpl = class { if (!response.ok || !response.body) { throw new Error(`Event stream failed (${response.status})`); } + this.hasConnected = true; this.setState("connected" /* CONNECTED */); this.resolveReady(); await this.readStream(response.body); @@ -288,20 +294,25 @@ var EventSubscriptionImpl = class { } async handleRecord(record) { let id; + let eventName; const data = []; for (const line of record.split(/\r?\n/)) { if (line.startsWith("id:")) id = line.slice(3).trim(); + if (line.startsWith("event:")) eventName = line.slice(6).trim(); if (line.startsWith("data:")) data.push(line.slice(5).trimStart()); } if (!data.length) return; - const event = JSON.parse(data.join("\n")); - if (event.type === "resync_required") { + const parsed = JSON.parse(data.join("\n")); + const parsedType = parsed !== null && typeof parsed === "object" && "type" in parsed ? parsed.type : void 0; + if (eventName === "resync_required" /* RESYNC_REQUIRED */ || parsedType === "resync_required" /* RESYNC_REQUIRED */) { + const payload = parsed !== null && typeof parsed === "object" && "payload" in parsed ? parsed.payload : parsed; throw new ResyncRequiredError( String( - event.payload?.reason ?? "Event cursor requires resynchronization" + payload?.reason ?? "Event cursor requires resynchronization" ) ); } + const event = parsed; const eventId = id ?? event.id; if (!eventId || this.seenIds.has(eventId)) return; this.seenIds.add(eventId); @@ -1315,6 +1326,9 @@ var RatesClient = class { constructor(http) { this.http = http; } + health() { + return this.http.request("/fx/health"); + } quote(baseCurrency, targetCurrency) { return this.get(baseCurrency, targetCurrency); } @@ -1462,18 +1476,6 @@ var SwapClient = class { { method: "PATCH", body: JSON.stringify(input) } ); } - export(query = {}) { - const params = new URLSearchParams(); - for (const [key, value] of Object.entries(query)) { - if (value !== void 0) params.set(key, String(value)); - } - return this.http.fetchResponse(`/swap/export?${params}`).then(async (response) => { - if (!response.ok) { - throw new Error(`Swap export failed (${response.status})`); - } - return response.blob(); - }); - } repair(partnerId, swapId, input) { return this.http.request( `/teams/${encodeURIComponent(partnerId)}/swaps/${encodeURIComponent(swapId)}/repair`, @@ -1499,11 +1501,12 @@ var OtcClient = class { rates; agents; subscribe(options) { + const { eventTypes, ...subscriptionOptions } = options; return subscribeToDomainEvents( this.events, "otc", - Object.values(OtcEventType), - options + eventTypes ?? Object.values(OtcEventType), + subscriptionOptions ); } }; @@ -1644,13 +1647,30 @@ var ReferralCodeScope = /* @__PURE__ */ ((ReferralCodeScope2) => { async function readPartnerDetail(http, partnerId) { return http.request(partnerPath(partnerId)); } +function createPartnerDetailReader(http, partnerId) { + let pending; + return () => { + if (pending) return pending; + const request = readPartnerDetail(http, partnerId); + pending = request; + const clearPending = () => { + if (pending === request) pending = void 0; + }; + void request.then(clearPending, clearPending); + return request; + }; +} var AccountClient = class { - constructor(http, partnerId) { + constructor(http, partnerId, readDetail = createPartnerDetailReader( + http, + partnerId + )) { this.http = http; this.partnerId = partnerId; + this.readDetail = readDetail; } async get() { - const detail = await readPartnerDetail(this.http, this.partnerId); + const detail = await this.readDetail(); return detail.team; } async update(input) { @@ -1692,12 +1712,16 @@ var AnalyticsClient = class { } }; var MembersClient = class { - constructor(http, partnerId) { + constructor(http, partnerId, readDetail = createPartnerDetailReader( + http, + partnerId + )) { this.http = http; this.partnerId = partnerId; + this.readDetail = readDetail; } async list() { - const detail = await readPartnerDetail(this.http, this.partnerId); + const detail = await this.readDetail(); return detail.members; } async add(input) { @@ -1728,12 +1752,16 @@ var MembersClient = class { } }; var InvitationsClient = class { - constructor(http, partnerId) { + constructor(http, partnerId, readDetail = createPartnerDetailReader( + http, + partnerId + )) { this.http = http; this.partnerId = partnerId; + this.readDetail = readDetail; } async list() { - const detail = await readPartnerDetail(this.http, this.partnerId); + const detail = await this.readDetail(); return detail.invitations; } async create(input) { @@ -1744,12 +1772,16 @@ var InvitationsClient = class { } }; var ApiKeysClient = class { - constructor(http, partnerId) { + constructor(http, partnerId, readDetail = createPartnerDetailReader( + http, + partnerId + )) { this.http = http; this.partnerId = partnerId; + this.readDetail = readDetail; } async list() { - const detail = await readPartnerDetail(this.http, this.partnerId); + const detail = await this.readDetail(); return detail.apiKeys; } async create(input) { @@ -1985,12 +2017,13 @@ var PartnerClient = class extends MinmoClient { referrals; constructor(options, partnerId) { super(options, partnerId); - this.account = new AccountClient(this.http, partnerId); + const readDetail = createPartnerDetailReader(this.http, partnerId); + this.account = new AccountClient(this.http, partnerId, readDetail); this.settings = new SettingsClient(this.http, partnerId); this.analytics = new AnalyticsClient(this.http, partnerId); - this.members = new MembersClient(this.http, partnerId); - this.invitations = new InvitationsClient(this.http, partnerId); - this.apiKeys = new ApiKeysClient(this.http, partnerId); + this.members = new MembersClient(this.http, partnerId, readDetail); + this.invitations = new InvitationsClient(this.http, partnerId, readDetail); + this.apiKeys = new ApiKeysClient(this.http, partnerId, readDetail); this.referrals = new ReferralsClient(this.http, partnerId); } }; diff --git a/vendor/upstream/sdk/otc/index.d.ts b/vendor/upstream/sdk/otc/index.d.ts index e1efbc8..d007f6e 100644 --- a/vendor/upstream/sdk/otc/index.d.ts +++ b/vendor/upstream/sdk/otc/index.d.ts @@ -7,7 +7,9 @@ import { SwapClient } from "./swap"; export * from "./agents"; export * from "./rates"; export * from "./swap"; -export type OtcSubscriptionOptions = DomainEventSubscriptionOptions; +export type OtcSubscriptionOptions = DomainEventSubscriptionOptions & { + eventTypes?: readonly OtcEventType[]; +}; export declare class OtcClient { private readonly events; readonly swap: SwapClient; diff --git a/vendor/upstream/sdk/otc/rates.d.ts b/vendor/upstream/sdk/otc/rates.d.ts index 3390497..f89ed8c 100644 --- a/vendor/upstream/sdk/otc/rates.d.ts +++ b/vendor/upstream/sdk/otc/rates.d.ts @@ -3,6 +3,7 @@ import type { HttpClient } from "../http"; export declare class RatesClient { private readonly http; constructor(http: HttpClient); + health(): Promise; quote(baseCurrency: Currency, targetCurrency: Currency): Promise; get(baseCurrency: Currency, targetCurrency: Currency): Promise; detailed(baseCurrency: Currency, targetCurrency: Currency): Promise; diff --git a/vendor/upstream/sdk/otc/swap.d.ts b/vendor/upstream/sdk/otc/swap.d.ts index b82c7d6..fb276aa 100644 --- a/vendor/upstream/sdk/otc/swap.d.ts +++ b/vendor/upstream/sdk/otc/swap.d.ts @@ -1,4 +1,4 @@ -import type { AgentSelectionMode, ConfirmationRole, Currency, DisputeDetails, PaymentDetails, PaymentChannel, PaymentInstructions, SwapAgentTeamContext, SwapMetadata, SwapState, SwapType, PartnerQuoteResponse } from "@minmo/core"; +import type { AgentSelectionMode, ConfirmationRole, Currency, DisputeDetails, PaymentDetails, PaymentChannel, PaymentInstructions, SwapAgentTeamContext, SwapMetadata, SwapRepairAction, SwapState, SwapType, PartnerQuoteResponse } from "@minmo/core"; import type { ExecuteDisputeRefundInput, OpenDisputeInput, ResolveDisputeInput, SubmitDisputeEvidenceInput } from "../disputes"; import type { SwapEscrowPaymentStatusResponse } from "../escrow"; import type { HttpClient } from "../http"; @@ -114,10 +114,12 @@ export type SubmitPaymentProofInput = { beneficiaryId?: string; }; export type SwapActionInput = Record; -export type SwapRepairInput = SwapActionInput & { - action: string; - expectedState: string; +export type SwapRepairInput = { + action: SwapRepairAction; + expectedState: SwapState; reason: string; + newInvoice?: string; + newOnchainAddress?: string; }; export declare class SwapClient { private readonly http; @@ -136,7 +138,6 @@ export declare class SwapClient { executeRefund(swapId: string, input: ExecuteDisputeRefundInput): Promise; resolveDispute(swapId: string, input: ResolveDisputeInput): Promise; transfer(swapId: string, input: SwapActionInput): Promise; - export(query?: SwapListQuery): Promise; repair(partnerId: string, swapId: string, input: SwapRepairInput): Promise; escrowStatus(swapId: string): Promise; } diff --git a/vendor/upstream/sdk/partner.d.ts b/vendor/upstream/sdk/partner.d.ts index 1cd72dd..642600e 100644 --- a/vendor/upstream/sdk/partner.d.ts +++ b/vendor/upstream/sdk/partner.d.ts @@ -87,13 +87,27 @@ export interface ReferralCode { export interface AnalyticsOptions { bucket?: AnalyticsBucket; } +interface PartnerDetailResponse { + team: Account; + members: Member[]; + invitations: Invitation[]; + apiKeys: ApiKey[]; +} +export type PartnerDetailReader = () => Promise; export interface CommandResult { ok: true; } +/** + * Coalesces concurrent projections of the aggregate Partner-management read. + * The API exposes account, member, invitation, and API-key metadata from one + * endpoint, while the SDK keeps those concepts in focused clients. + */ +export declare function createPartnerDetailReader(http: HttpClient, partnerId: string): PartnerDetailReader; export declare class AccountClient { private readonly http; private readonly partnerId; - constructor(http: HttpClient, partnerId: string); + private readonly readDetail; + constructor(http: HttpClient, partnerId: string, readDetail?: PartnerDetailReader); get(): Promise; update(input: UpdateAccountInput): Promise; } @@ -113,7 +127,8 @@ export declare class AnalyticsClient { export declare class MembersClient { private readonly http; private readonly partnerId; - constructor(http: HttpClient, partnerId: string); + private readonly readDetail; + constructor(http: HttpClient, partnerId: string, readDetail?: PartnerDetailReader); list(): Promise; add(input: AddMemberInput): Promise; updateRoles(memberId: string, input: UpdateMemberRolesInput): Promise; @@ -122,14 +137,16 @@ export declare class MembersClient { export declare class InvitationsClient { private readonly http; private readonly partnerId; - constructor(http: HttpClient, partnerId: string); + private readonly readDetail; + constructor(http: HttpClient, partnerId: string, readDetail?: PartnerDetailReader); list(): Promise; create(input: CreateInvitationInput): Promise; } export declare class ApiKeysClient { private readonly http; private readonly partnerId; - constructor(http: HttpClient, partnerId: string); + private readonly readDetail; + constructor(http: HttpClient, partnerId: string, readDetail?: PartnerDetailReader); list(): Promise; create(input: CreateApiKeyInput): Promise; updatePolicy(apiKeyId: string, policy: ApiKeyResourcePolicy): Promise; @@ -142,4 +159,5 @@ export declare class ReferralsClient { get(): Promise; rotate(): Promise; } +export {}; //# sourceMappingURL=partner.d.ts.map \ No newline at end of file