@shardlink/agent-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +129 -0
- package/dist/client-quick-join.d.ts +38 -0
- package/dist/client-quick-join.d.ts.map +1 -0
- package/dist/client-quick-join.js +141 -0
- package/dist/client-quick-join.js.map +1 -0
- package/dist/client.d.ts +134 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +190 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +126 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +330 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/a2a.d.ts +42 -0
- package/dist/modules/a2a.d.ts.map +1 -0
- package/dist/modules/a2a.js +47 -0
- package/dist/modules/a2a.js.map +1 -0
- package/dist/modules/agents.d.ts +100 -0
- package/dist/modules/agents.d.ts.map +1 -0
- package/dist/modules/agents.js +85 -0
- package/dist/modules/agents.js.map +1 -0
- package/dist/modules/auth.d.ts +49 -0
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/auth.js +69 -0
- package/dist/modules/auth.js.map +1 -0
- package/dist/modules/billing.d.ts +254 -0
- package/dist/modules/billing.d.ts.map +1 -0
- package/dist/modules/billing.js +203 -0
- package/dist/modules/billing.js.map +1 -0
- package/dist/modules/clans.d.ts +73 -0
- package/dist/modules/clans.d.ts.map +1 -0
- package/dist/modules/clans.js +94 -0
- package/dist/modules/clans.js.map +1 -0
- package/dist/modules/compliance.d.ts +97 -0
- package/dist/modules/compliance.d.ts.map +1 -0
- package/dist/modules/compliance.js +227 -0
- package/dist/modules/compliance.js.map +1 -0
- package/dist/modules/cross-plane.d.ts +164 -0
- package/dist/modules/cross-plane.d.ts.map +1 -0
- package/dist/modules/cross-plane.js +195 -0
- package/dist/modules/cross-plane.js.map +1 -0
- package/dist/modules/dashboard.d.ts +130 -0
- package/dist/modules/dashboard.d.ts.map +1 -0
- package/dist/modules/dashboard.js +120 -0
- package/dist/modules/dashboard.js.map +1 -0
- package/dist/modules/degradation.d.ts +120 -0
- package/dist/modules/degradation.d.ts.map +1 -0
- package/dist/modules/degradation.js +205 -0
- package/dist/modules/degradation.js.map +1 -0
- package/dist/modules/diagnostics-checks.d.ts +32 -0
- package/dist/modules/diagnostics-checks.d.ts.map +1 -0
- package/dist/modules/diagnostics-checks.js +231 -0
- package/dist/modules/diagnostics-checks.js.map +1 -0
- package/dist/modules/diagnostics-types.d.ts +118 -0
- package/dist/modules/diagnostics-types.d.ts.map +1 -0
- package/dist/modules/diagnostics-types.js +16 -0
- package/dist/modules/diagnostics-types.js.map +1 -0
- package/dist/modules/diagnostics.d.ts +64 -0
- package/dist/modules/diagnostics.d.ts.map +1 -0
- package/dist/modules/diagnostics.js +206 -0
- package/dist/modules/diagnostics.js.map +1 -0
- package/dist/modules/discovery.d.ts +152 -0
- package/dist/modules/discovery.d.ts.map +1 -0
- package/dist/modules/discovery.js +100 -0
- package/dist/modules/discovery.js.map +1 -0
- package/dist/modules/fleets.d.ts +82 -0
- package/dist/modules/fleets.d.ts.map +1 -0
- package/dist/modules/fleets.js +33 -0
- package/dist/modules/fleets.js.map +1 -0
- package/dist/modules/lease-manager.d.ts +119 -0
- package/dist/modules/lease-manager.d.ts.map +1 -0
- package/dist/modules/lease-manager.js +242 -0
- package/dist/modules/lease-manager.js.map +1 -0
- package/dist/modules/leases.d.ts +70 -0
- package/dist/modules/leases.d.ts.map +1 -0
- package/dist/modules/leases.js +51 -0
- package/dist/modules/leases.js.map +1 -0
- package/dist/modules/operators.d.ts +176 -0
- package/dist/modules/operators.d.ts.map +1 -0
- package/dist/modules/operators.js +133 -0
- package/dist/modules/operators.js.map +1 -0
- package/dist/modules/providers.d.ts +141 -0
- package/dist/modules/providers.d.ts.map +1 -0
- package/dist/modules/providers.js +118 -0
- package/dist/modules/providers.js.map +1 -0
- package/dist/modules/quota.d.ts +102 -0
- package/dist/modules/quota.d.ts.map +1 -0
- package/dist/modules/quota.js +135 -0
- package/dist/modules/quota.js.map +1 -0
- package/dist/modules/reactions.d.ts +141 -0
- package/dist/modules/reactions.d.ts.map +1 -0
- package/dist/modules/reactions.js +122 -0
- package/dist/modules/reactions.js.map +1 -0
- package/dist/modules/register.d.ts +159 -0
- package/dist/modules/register.d.ts.map +1 -0
- package/dist/modules/register.js +239 -0
- package/dist/modules/register.js.map +1 -0
- package/dist/modules/sandbox.d.ts +106 -0
- package/dist/modules/sandbox.d.ts.map +1 -0
- package/dist/modules/sandbox.js +224 -0
- package/dist/modules/sandbox.js.map +1 -0
- package/dist/modules/streams.d.ts +81 -0
- package/dist/modules/streams.d.ts.map +1 -0
- package/dist/modules/streams.js +292 -0
- package/dist/modules/streams.js.map +1 -0
- package/dist/modules/tasks.d.ts +145 -0
- package/dist/modules/tasks.d.ts.map +1 -0
- package/dist/modules/tasks.js +165 -0
- package/dist/modules/tasks.js.map +1 -0
- package/dist/modules/telemetry.d.ts +137 -0
- package/dist/modules/telemetry.d.ts.map +1 -0
- package/dist/modules/telemetry.js +203 -0
- package/dist/modules/telemetry.js.map +1 -0
- package/dist/modules/workspace.d.ts +180 -0
- package/dist/modules/workspace.d.ts.map +1 -0
- package/dist/modules/workspace.js +157 -0
- package/dist/modules/workspace.js.map +1 -0
- package/dist/quickstart-join.d.ts +56 -0
- package/dist/quickstart-join.d.ts.map +1 -0
- package/dist/quickstart-join.js +116 -0
- package/dist/quickstart-join.js.map +1 -0
- package/dist/quickstart.d.ts +137 -0
- package/dist/quickstart.d.ts.map +1 -0
- package/dist/quickstart.js +292 -0
- package/dist/quickstart.js.map +1 -0
- package/dist/retry.d.ts +88 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +152 -0
- package/dist/retry.js.map +1 -0
- package/dist/types.d.ts +447 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +10 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +88 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +199 -0
- package/dist/utils.js.map +1 -0
- package/package.json +215 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing — accounts, instruments, envelopes, delegated-spend grants.
|
|
3
|
+
*
|
|
4
|
+
* All endpoints under `/v1/workspaces/:slug/billing/*` plus
|
|
5
|
+
* `/v1/workspaces/:slug/pricing/quotes` (the pricing quote is the first step
|
|
6
|
+
* of every funding flow, so it lives here for convenience).
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import type { BillingMode, WorkspaceRegion } from "../types.js";
|
|
11
|
+
import type { HttpContext } from "../utils.js";
|
|
12
|
+
/** A pricing quote bound to a workspace lease tier. */
|
|
13
|
+
export interface PricingQuote {
|
|
14
|
+
quoteId: string;
|
|
15
|
+
workspaceSlug: string;
|
|
16
|
+
identity: string;
|
|
17
|
+
tier: "sandbox" | "standard";
|
|
18
|
+
amountUsdCents: number;
|
|
19
|
+
creditUnits: number;
|
|
20
|
+
pricingVersion: string;
|
|
21
|
+
/** Epoch ms after which the quote can no longer be accepted. */
|
|
22
|
+
expiresAt: number;
|
|
23
|
+
status: "active" | "accepted" | "expired";
|
|
24
|
+
createdAt: number;
|
|
25
|
+
acceptedAt?: number | null;
|
|
26
|
+
}
|
|
27
|
+
/** A billing account (agent-owned or sponsor-owned). */
|
|
28
|
+
export interface BillingAccount {
|
|
29
|
+
accountId: string;
|
|
30
|
+
workspaceSlug: string;
|
|
31
|
+
partyType: "agent" | "sponsor";
|
|
32
|
+
identity: string;
|
|
33
|
+
billingMode: BillingMode;
|
|
34
|
+
region: WorkspaceRegion;
|
|
35
|
+
status: "active" | "on_hold" | "blocked";
|
|
36
|
+
externalCustomerRef?: string | null;
|
|
37
|
+
createdAt: number;
|
|
38
|
+
updatedAt: number;
|
|
39
|
+
}
|
|
40
|
+
/** A funding instrument attached to a billing account. */
|
|
41
|
+
export interface FundingInstrument {
|
|
42
|
+
instrumentId: string;
|
|
43
|
+
accountId: string;
|
|
44
|
+
workspaceSlug: string;
|
|
45
|
+
provider: "stripe_card" | "crossmint_wallet";
|
|
46
|
+
status: "pending_verification" | "verified" | "revoked";
|
|
47
|
+
label?: string | null;
|
|
48
|
+
externalRef: string;
|
|
49
|
+
providerCustomerRef?: string | null;
|
|
50
|
+
verificationRef?: string | null;
|
|
51
|
+
verificationStatusDetail?: string | null;
|
|
52
|
+
metadata: Record<string, unknown>;
|
|
53
|
+
createdAt: number;
|
|
54
|
+
updatedAt: number;
|
|
55
|
+
verifiedAt?: number | null;
|
|
56
|
+
}
|
|
57
|
+
/** Funding-rail health envelope returned alongside instrument verification. */
|
|
58
|
+
export interface FundingRailHealth {
|
|
59
|
+
provider: "stripe_card" | "crossmint_wallet";
|
|
60
|
+
status: "ready" | "degraded" | "unconfigured" | "unavailable";
|
|
61
|
+
configured: boolean;
|
|
62
|
+
webhookConfigured: boolean;
|
|
63
|
+
verificationMode: "payment_method_attach" | "wallet_locator_lookup" | "pay_and_retry";
|
|
64
|
+
locatorInput?: string | null;
|
|
65
|
+
normalizedLocator?: string | null;
|
|
66
|
+
walletAddress?: string | null;
|
|
67
|
+
reasonCodes: string[];
|
|
68
|
+
}
|
|
69
|
+
/** A spend envelope authorizing draw-down up to `authorizedAmountUsdCents`. */
|
|
70
|
+
export interface SpendEnvelope {
|
|
71
|
+
envelopeId: string;
|
|
72
|
+
accountId: string;
|
|
73
|
+
workspaceSlug: string;
|
|
74
|
+
identity: string;
|
|
75
|
+
partyType: "agent" | "sponsor";
|
|
76
|
+
region: WorkspaceRegion;
|
|
77
|
+
currency: "USD";
|
|
78
|
+
status: "active" | "on_hold" | "disputed" | "exhausted" | "revoked" | "expired";
|
|
79
|
+
authorizedAmountUsdCents: number;
|
|
80
|
+
consumedAmountUsdCents: number;
|
|
81
|
+
fundingInstrumentId: string;
|
|
82
|
+
delegatedGrantId?: string | null;
|
|
83
|
+
pricingVersion?: string | null;
|
|
84
|
+
reconciliationStatus: "pending" | "settled" | "reconciled" | "refunded" | "failed";
|
|
85
|
+
metadata: Record<string, unknown>;
|
|
86
|
+
expiresAt: number;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
updatedAt: number;
|
|
89
|
+
revokedAt?: number | null;
|
|
90
|
+
}
|
|
91
|
+
/** A delegated-spend grant letting another identity draw from an account. */
|
|
92
|
+
export interface DelegatedSpendGrant {
|
|
93
|
+
grantId: string;
|
|
94
|
+
workspaceSlug: string;
|
|
95
|
+
accountId: string;
|
|
96
|
+
principalIdentity: string;
|
|
97
|
+
delegateIdentity: string;
|
|
98
|
+
allowedActions: Array<"lease.request" | "provider.quote.execute">;
|
|
99
|
+
maxUsdCents: number;
|
|
100
|
+
status: "active" | "revoked" | "expired";
|
|
101
|
+
notBefore: number;
|
|
102
|
+
expiresAt: number;
|
|
103
|
+
metadata: Record<string, unknown>;
|
|
104
|
+
createdAt: number;
|
|
105
|
+
updatedAt: number;
|
|
106
|
+
revokedAt?: number | null;
|
|
107
|
+
}
|
|
108
|
+
/** Result of {@link BillingClient.createPricingQuote}. */
|
|
109
|
+
export interface CreatePricingQuoteResult {
|
|
110
|
+
quote: PricingQuote;
|
|
111
|
+
/** ISO-8601 mirror of `quote.expiresAt`. */
|
|
112
|
+
quoteExpiresAt: string;
|
|
113
|
+
}
|
|
114
|
+
/** Result of {@link BillingClient.verifyInstrument}. */
|
|
115
|
+
export interface VerifyInstrumentResult {
|
|
116
|
+
instrument: FundingInstrument;
|
|
117
|
+
account: BillingAccount;
|
|
118
|
+
fundingRailHealth: FundingRailHealth;
|
|
119
|
+
}
|
|
120
|
+
/** Workspace-scoped billing client. All methods require an actor session token. */
|
|
121
|
+
export declare class BillingClient {
|
|
122
|
+
private readonly http;
|
|
123
|
+
constructor(http: HttpContext);
|
|
124
|
+
/**
|
|
125
|
+
* Create a pricing quote for a workspace lease tier — the first step of any
|
|
126
|
+
* funding flow. Accept it ({@link acceptPricingQuote}) before requesting a
|
|
127
|
+
* lease.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const { quote } = await billing.createPricingQuote("ws_1", actorSessionToken, {
|
|
132
|
+
* tier: "sandbox"
|
|
133
|
+
* });
|
|
134
|
+
* console.log(quote.amountUsdCents, quote.creditUnits);
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
createPricingQuote(workspaceSlug: string, actorSessionToken: string, input: {
|
|
138
|
+
tier?: "sandbox" | "standard";
|
|
139
|
+
}, idempotencyKey?: string): Promise<CreatePricingQuoteResult>;
|
|
140
|
+
/**
|
|
141
|
+
* Accept a pricing quote, binding it to the active session so it can back a
|
|
142
|
+
* lease request.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const { quote } = await billing.acceptPricingQuote("ws_1", actorSessionToken, quoteId);
|
|
147
|
+
* console.log(quote.status); // "accepted"
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
acceptPricingQuote(workspaceSlug: string, actorSessionToken: string, quoteId: string, idempotencyKey?: string): Promise<{
|
|
151
|
+
quote: PricingQuote;
|
|
152
|
+
}>;
|
|
153
|
+
/**
|
|
154
|
+
* Create a billing account (agent or sponsor). `region` is required and must
|
|
155
|
+
* be permitted by the workspace.
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* const { account } = await billing.createAccount("ws_1", actorSessionToken, {
|
|
160
|
+
* partyType: "agent",
|
|
161
|
+
* region: "US"
|
|
162
|
+
* });
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
createAccount(workspaceSlug: string, actorSessionToken: string, input: Record<string, unknown>, idempotencyKey?: string): Promise<{
|
|
166
|
+
account: BillingAccount;
|
|
167
|
+
}>;
|
|
168
|
+
/**
|
|
169
|
+
* Attach a funding instrument to a billing account. The instrument starts in
|
|
170
|
+
* `pending_verification` — call {@link verifyInstrument} before it can fund
|
|
171
|
+
* an envelope.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const { instrument } = await billing.attachInstrument("ws_1", actorSessionToken, accountId, {
|
|
176
|
+
* provider: "stripe_card",
|
|
177
|
+
* externalRef: "pm_123"
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
attachInstrument(workspaceSlug: string, actorSessionToken: string, accountId: string, input: Record<string, unknown>, idempotencyKey?: string): Promise<{
|
|
182
|
+
instrument: FundingInstrument;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Verify a funding instrument so it can be used by an envelope. Returns the
|
|
186
|
+
* verified instrument, its account, and the funding-rail health snapshot.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* const { instrument, fundingRailHealth } = await billing.verifyInstrument(
|
|
191
|
+
* "ws_1", actorSessionToken, accountId, instrumentId
|
|
192
|
+
* );
|
|
193
|
+
* console.log(instrument.status, fundingRailHealth.status);
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
verifyInstrument(workspaceSlug: string, actorSessionToken: string, accountId: string, instrumentId: string, idempotencyKey?: string): Promise<VerifyInstrumentResult>;
|
|
197
|
+
/**
|
|
198
|
+
* Create a spend envelope authorizing up to `authorizedAmountUsdCents`. The
|
|
199
|
+
* instrument must already be verified.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const { envelope } = await billing.createEnvelope("ws_1", actorSessionToken, accountId, {
|
|
204
|
+
* fundingInstrumentId: instrumentId,
|
|
205
|
+
* authorizedAmountUsdCents: 5000
|
|
206
|
+
* });
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
createEnvelope(workspaceSlug: string, actorSessionToken: string, accountId: string, input: Record<string, unknown>, idempotencyKey?: string): Promise<{
|
|
210
|
+
envelope: SpendEnvelope;
|
|
211
|
+
}>;
|
|
212
|
+
/**
|
|
213
|
+
* Create a delegated-spend grant so another identity can draw from this
|
|
214
|
+
* account up to `maxUsdCents`.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* const { grant } = await billing.createDelegatedGrant("ws_1", actorSessionToken, accountId, {
|
|
219
|
+
* delegateIdentity: "agent_42",
|
|
220
|
+
* allowedActions: ["lease.request"],
|
|
221
|
+
* maxUsdCents: 2000,
|
|
222
|
+
* expiresInSeconds: 86400
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
createDelegatedGrant(workspaceSlug: string, actorSessionToken: string, accountId: string, input: Record<string, unknown>, idempotencyKey?: string): Promise<{
|
|
227
|
+
grant: DelegatedSpendGrant;
|
|
228
|
+
}>;
|
|
229
|
+
/**
|
|
230
|
+
* List delegated-spend grants on the account.
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* const { grants } = await billing.listDelegatedGrants("ws_1", actorSessionToken, accountId);
|
|
235
|
+
* for (const grant of grants) console.log(grant.delegateIdentity, grant.status);
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
listDelegatedGrants(workspaceSlug: string, actorSessionToken: string, accountId: string): Promise<{
|
|
239
|
+
grants: DelegatedSpendGrant[];
|
|
240
|
+
}>;
|
|
241
|
+
/**
|
|
242
|
+
* Revoke a delegated-spend grant.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```ts
|
|
246
|
+
* const { grant } = await billing.revokeDelegatedGrant("ws_1", actorSessionToken, accountId, grantId);
|
|
247
|
+
* console.log(grant.status); // "revoked"
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
revokeDelegatedGrant(workspaceSlug: string, actorSessionToken: string, accountId: string, grantId: string, idempotencyKey?: string): Promise<{
|
|
251
|
+
grant: DelegatedSpendGrant;
|
|
252
|
+
}>;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/modules/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,SAAS,GAAG,UAAU,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,0DAA0D;AAC1D,MAAM,WA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|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Billing — accounts, instruments, envelopes, delegated-spend grants.
|
|
3
|
+
*
|
|
4
|
+
* All endpoints under `/v1/workspaces/:slug/billing/*` plus
|
|
5
|
+
* `/v1/workspaces/:slug/pricing/quotes` (the pricing quote is the first step
|
|
6
|
+
* of every funding flow, so it lives here for convenience).
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
function idempotencyHeader(key) {
|
|
11
|
+
return key ? { "idempotency-key": key } : {};
|
|
12
|
+
}
|
|
13
|
+
/** Workspace-scoped billing client. All methods require an actor session token. */
|
|
14
|
+
export class BillingClient {
|
|
15
|
+
http;
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a pricing quote for a workspace lease tier — the first step of any
|
|
21
|
+
* funding flow. Accept it ({@link acceptPricingQuote}) before requesting a
|
|
22
|
+
* lease.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const { quote } = await billing.createPricingQuote("ws_1", actorSessionToken, {
|
|
27
|
+
* tier: "sandbox"
|
|
28
|
+
* });
|
|
29
|
+
* console.log(quote.amountUsdCents, quote.creditUnits);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
async createPricingQuote(workspaceSlug, actorSessionToken, input, idempotencyKey) {
|
|
33
|
+
return this.http.request({
|
|
34
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/pricing/quotes`,
|
|
35
|
+
method: "POST",
|
|
36
|
+
operation: "pricing-quote-create",
|
|
37
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
38
|
+
body: input
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Accept a pricing quote, binding it to the active session so it can back a
|
|
43
|
+
* lease request.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const { quote } = await billing.acceptPricingQuote("ws_1", actorSessionToken, quoteId);
|
|
48
|
+
* console.log(quote.status); // "accepted"
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
async acceptPricingQuote(workspaceSlug, actorSessionToken, quoteId, idempotencyKey) {
|
|
52
|
+
return this.http.request({
|
|
53
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/pricing/quotes/${encodeURIComponent(quoteId)}/accept`,
|
|
54
|
+
method: "POST",
|
|
55
|
+
operation: "pricing-quote-accept",
|
|
56
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
57
|
+
body: {}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a billing account (agent or sponsor). `region` is required and must
|
|
62
|
+
* be permitted by the workspace.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const { account } = await billing.createAccount("ws_1", actorSessionToken, {
|
|
67
|
+
* partyType: "agent",
|
|
68
|
+
* region: "US"
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
async createAccount(workspaceSlug, actorSessionToken, input, idempotencyKey) {
|
|
73
|
+
return this.http.request({
|
|
74
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts`,
|
|
75
|
+
method: "POST",
|
|
76
|
+
operation: "billing-account-create",
|
|
77
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
78
|
+
body: input
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Attach a funding instrument to a billing account. The instrument starts in
|
|
83
|
+
* `pending_verification` — call {@link verifyInstrument} before it can fund
|
|
84
|
+
* an envelope.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const { instrument } = await billing.attachInstrument("ws_1", actorSessionToken, accountId, {
|
|
89
|
+
* provider: "stripe_card",
|
|
90
|
+
* externalRef: "pm_123"
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
async attachInstrument(workspaceSlug, actorSessionToken, accountId, input, idempotencyKey) {
|
|
95
|
+
return this.http.request({
|
|
96
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts/${encodeURIComponent(accountId)}/instruments`,
|
|
97
|
+
method: "POST",
|
|
98
|
+
operation: "funding-instrument-create",
|
|
99
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
100
|
+
body: input
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Verify a funding instrument so it can be used by an envelope. Returns the
|
|
105
|
+
* verified instrument, its account, and the funding-rail health snapshot.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* const { instrument, fundingRailHealth } = await billing.verifyInstrument(
|
|
110
|
+
* "ws_1", actorSessionToken, accountId, instrumentId
|
|
111
|
+
* );
|
|
112
|
+
* console.log(instrument.status, fundingRailHealth.status);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
async verifyInstrument(workspaceSlug, actorSessionToken, accountId, instrumentId, idempotencyKey) {
|
|
116
|
+
return this.http.request({
|
|
117
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts/${encodeURIComponent(accountId)}/instruments/${encodeURIComponent(instrumentId)}/verify`,
|
|
118
|
+
method: "POST",
|
|
119
|
+
operation: "funding-instrument-verify",
|
|
120
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
121
|
+
body: {}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Create a spend envelope authorizing up to `authorizedAmountUsdCents`. The
|
|
126
|
+
* instrument must already be verified.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* const { envelope } = await billing.createEnvelope("ws_1", actorSessionToken, accountId, {
|
|
131
|
+
* fundingInstrumentId: instrumentId,
|
|
132
|
+
* authorizedAmountUsdCents: 5000
|
|
133
|
+
* });
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
async createEnvelope(workspaceSlug, actorSessionToken, accountId, input, idempotencyKey) {
|
|
137
|
+
return this.http.request({
|
|
138
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts/${encodeURIComponent(accountId)}/envelopes`,
|
|
139
|
+
method: "POST",
|
|
140
|
+
operation: "spend-envelope-create",
|
|
141
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
142
|
+
body: input
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Create a delegated-spend grant so another identity can draw from this
|
|
147
|
+
* account up to `maxUsdCents`.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* const { grant } = await billing.createDelegatedGrant("ws_1", actorSessionToken, accountId, {
|
|
152
|
+
* delegateIdentity: "agent_42",
|
|
153
|
+
* allowedActions: ["lease.request"],
|
|
154
|
+
* maxUsdCents: 2000,
|
|
155
|
+
* expiresInSeconds: 86400
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
async createDelegatedGrant(workspaceSlug, actorSessionToken, accountId, input, idempotencyKey) {
|
|
160
|
+
return this.http.request({
|
|
161
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts/${encodeURIComponent(accountId)}/delegated-spend-grants`,
|
|
162
|
+
method: "POST",
|
|
163
|
+
operation: "delegated-spend-grant-create",
|
|
164
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
165
|
+
body: input
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* List delegated-spend grants on the account.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const { grants } = await billing.listDelegatedGrants("ws_1", actorSessionToken, accountId);
|
|
174
|
+
* for (const grant of grants) console.log(grant.delegateIdentity, grant.status);
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
async listDelegatedGrants(workspaceSlug, actorSessionToken, accountId) {
|
|
178
|
+
return this.http.request({
|
|
179
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts/${encodeURIComponent(accountId)}/delegated-spend-grants`,
|
|
180
|
+
operation: "delegated-spend-grant-list",
|
|
181
|
+
headers: this.http.bearerHeaders(actorSessionToken)
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Revoke a delegated-spend grant.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const { grant } = await billing.revokeDelegatedGrant("ws_1", actorSessionToken, accountId, grantId);
|
|
190
|
+
* console.log(grant.status); // "revoked"
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
async revokeDelegatedGrant(workspaceSlug, actorSessionToken, accountId, grantId, idempotencyKey) {
|
|
194
|
+
return this.http.request({
|
|
195
|
+
path: `/v1/workspaces/${encodeURIComponent(workspaceSlug)}/billing/accounts/${encodeURIComponent(accountId)}/delegated-spend-grants/${encodeURIComponent(grantId)}/revoke`,
|
|
196
|
+
method: "POST",
|
|
197
|
+
operation: "delegated-spend-grant-revoke",
|
|
198
|
+
headers: this.http.bearerHeaders(actorSessionToken, idempotencyHeader(idempotencyKey)),
|
|
199
|
+
body: {}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@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kBAAkB,CAAC,aAAa,CAAC,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,yBAAyB;YACpI,SAAS,EAAE,4BAA4B;YACvC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,oBAAoB,CACxB,aAAqB,EACrB,iBAAyB,EACzB,SAAiB,EACjB,OAAe,EACf,cAAuB;QAEvB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAiC;YACvD,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,aAAa,CAAC,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,kBAAkB,CAAC,OAAO,CAAC,SAAS;YAC1K,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,8BAA8B;YACzC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;YACtF,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clan-formation client — bottom-up emergent collectives. Any operator can
|
|
3
|
+
* open/join/leave; commanders emerge via in-clan endorsement, never top-down.
|
|
4
|
+
* See `memory/emergence_thesis_solo_operators.md`.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
import type { HttpContext } from "../utils.js";
|
|
9
|
+
export type ClanStatus = "forming" | "active" | "dormant" | "archived";
|
|
10
|
+
export type ClanRoleFlag = "founder" | "commander" | "steward";
|
|
11
|
+
export interface ClanMembership {
|
|
12
|
+
operatorId: string;
|
|
13
|
+
joinedAt: number;
|
|
14
|
+
roleFlags: ClanRoleFlag[];
|
|
15
|
+
endorsementCount: number;
|
|
16
|
+
flavorMatchConfidence?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface Clan {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
flavorManifesto: string | null;
|
|
22
|
+
openedAt: number;
|
|
23
|
+
openedBy: string;
|
|
24
|
+
currentCommanderId: string | null;
|
|
25
|
+
memberRoster: ClanMembership[];
|
|
26
|
+
aggregateFlavor: {
|
|
27
|
+
clanFlavorSeed: string;
|
|
28
|
+
memberCount: number;
|
|
29
|
+
domainTags: string[];
|
|
30
|
+
};
|
|
31
|
+
reputation: {
|
|
32
|
+
meanScore: number;
|
|
33
|
+
sampleSize: number;
|
|
34
|
+
};
|
|
35
|
+
status: ClanStatus;
|
|
36
|
+
updatedAt: number;
|
|
37
|
+
}
|
|
38
|
+
export interface OpenClanInput {
|
|
39
|
+
name: string;
|
|
40
|
+
flavorManifesto?: string;
|
|
41
|
+
initialDomainTags?: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface JoinClanInput {
|
|
44
|
+
flavorMatchConfidence?: number;
|
|
45
|
+
}
|
|
46
|
+
export interface EmergeCommanderInput {
|
|
47
|
+
electedOperatorId: string;
|
|
48
|
+
endorsementRecord: {
|
|
49
|
+
endorserIds: string[];
|
|
50
|
+
thresholdMetAt: number | string;
|
|
51
|
+
note?: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ClanMutationOptions {
|
|
55
|
+
idempotencyKey?: string;
|
|
56
|
+
signal?: AbortSignal;
|
|
57
|
+
}
|
|
58
|
+
/** Typed client over `/v1/clans/*`. Thin pass-through; no local state. */
|
|
59
|
+
export declare class ClansClient {
|
|
60
|
+
private readonly http;
|
|
61
|
+
constructor(http: HttpContext);
|
|
62
|
+
openClan(input: OpenClanInput, options?: ClanMutationOptions): Promise<Clan>;
|
|
63
|
+
getClan(clanId: string, signal?: AbortSignal): Promise<Clan>;
|
|
64
|
+
listClans(filter?: {
|
|
65
|
+
status?: ClanStatus;
|
|
66
|
+
}, signal?: AbortSignal): Promise<Clan[]>;
|
|
67
|
+
listClansForOperator(identity: string, signal?: AbortSignal): Promise<Clan[]>;
|
|
68
|
+
joinClan(clanId: string, input?: JoinClanInput, options?: ClanMutationOptions): Promise<ClanMembership>;
|
|
69
|
+
leaveClan(clanId: string, operatorId: string, options?: ClanMutationOptions): Promise<void>;
|
|
70
|
+
emergeCommander(clanId: string, input: EmergeCommanderInput, options?: ClanMutationOptions): Promise<Clan>;
|
|
71
|
+
private authHeaders;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=clans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clans.d.ts","sourceRoot":"","sources":["../../src/modules/clans.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AACvE,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,eAAe,EAAE;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACvF,U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AAE,MAAM,EACd,KAAK,GAAE,aAAkB,EACzB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,cAAc,CAAC;IAYpB,SAAS,CACb,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC;IAUV,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,oBAAoB,EAC3B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC;YAYF,WAAW;CAK1B"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clan-formation client — bottom-up emergent collectives. Any operator can
|
|
3
|
+
* open/join/leave; commanders emerge via in-clan endorsement, never top-down.
|
|
4
|
+
* See `memory/emergence_thesis_solo_operators.md`.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
/** Typed client over `/v1/clans/*`. Thin pass-through; no local state. */
|
|
9
|
+
export class ClansClient {
|
|
10
|
+
http;
|
|
11
|
+
constructor(http) {
|
|
12
|
+
this.http = http;
|
|
13
|
+
}
|
|
14
|
+
async openClan(input, options = {}) {
|
|
15
|
+
const { clan } = await this.http.request({
|
|
16
|
+
path: "/v1/clans",
|
|
17
|
+
method: "POST",
|
|
18
|
+
operation: "clan-open",
|
|
19
|
+
headers: await this.authHeaders(options.idempotencyKey),
|
|
20
|
+
body: input,
|
|
21
|
+
...(options.signal ? { signal: options.signal } : {})
|
|
22
|
+
});
|
|
23
|
+
return clan;
|
|
24
|
+
}
|
|
25
|
+
async getClan(clanId, signal) {
|
|
26
|
+
const { clan } = await this.http.request({
|
|
27
|
+
path: `/v1/clans/${encodeURIComponent(clanId)}`,
|
|
28
|
+
operation: "clan-get",
|
|
29
|
+
headers: await this.http.requiredAuthHeaders(),
|
|
30
|
+
...(signal ? { signal } : {})
|
|
31
|
+
});
|
|
32
|
+
return clan;
|
|
33
|
+
}
|
|
34
|
+
async listClans(filter = {}, signal) {
|
|
35
|
+
const params = new URLSearchParams();
|
|
36
|
+
if (filter.status)
|
|
37
|
+
params.set("status", filter.status);
|
|
38
|
+
const { clans } = await this.http.request({
|
|
39
|
+
path: "/v1/clans",
|
|
40
|
+
operation: "clan-list",
|
|
41
|
+
headers: await this.http.requiredAuthHeaders(),
|
|
42
|
+
params,
|
|
43
|
+
...(signal ? { signal } : {})
|
|
44
|
+
});
|
|
45
|
+
return clans;
|
|
46
|
+
}
|
|
47
|
+
async listClansForOperator(identity, signal) {
|
|
48
|
+
const { clans } = await this.http.request({
|
|
49
|
+
path: `/v1/operators/${encodeURIComponent(identity)}/clans`,
|
|
50
|
+
operation: "clan-list-for-operator",
|
|
51
|
+
headers: await this.http.requiredAuthHeaders(),
|
|
52
|
+
...(signal ? { signal } : {})
|
|
53
|
+
});
|
|
54
|
+
return clans;
|
|
55
|
+
}
|
|
56
|
+
async joinClan(clanId, input = {}, options = {}) {
|
|
57
|
+
const { membership } = await this.http.request({
|
|
58
|
+
path: `/v1/clans/${encodeURIComponent(clanId)}/members`,
|
|
59
|
+
method: "POST",
|
|
60
|
+
operation: "clan-join",
|
|
61
|
+
headers: await this.authHeaders(options.idempotencyKey),
|
|
62
|
+
body: input,
|
|
63
|
+
...(options.signal ? { signal: options.signal } : {})
|
|
64
|
+
});
|
|
65
|
+
return membership;
|
|
66
|
+
}
|
|
67
|
+
async leaveClan(clanId, operatorId, options = {}) {
|
|
68
|
+
await this.http.rawRequest({
|
|
69
|
+
path: `/v1/clans/${encodeURIComponent(clanId)}/members/${encodeURIComponent(operatorId)}`,
|
|
70
|
+
method: "DELETE",
|
|
71
|
+
operation: "clan-leave",
|
|
72
|
+
headers: await this.authHeaders(options.idempotencyKey),
|
|
73
|
+
...(options.signal ? { signal: options.signal } : {})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async emergeCommander(clanId, input, options = {}) {
|
|
77
|
+
const { clan } = await this.http.request({
|
|
78
|
+
path: `/v1/clans/${encodeURIComponent(clanId)}/commander`,
|
|
79
|
+
method: "POST",
|
|
80
|
+
operation: "clan-commander-emerge",
|
|
81
|
+
headers: await this.authHeaders(options.idempotencyKey),
|
|
82
|
+
body: input,
|
|
83
|
+
...(options.signal ? { signal: options.signal } : {})
|
|
84
|
+
});
|
|
85
|
+
return clan;
|
|
86
|
+
}
|
|
87
|
+
async authHeaders(idempotencyKey) {
|
|
88
|
+
const headers = await this.http.requiredAuthHeaders({ "content-type": "application/json" });
|
|
89
|
+
if (idempotencyKey)
|
|
90
|
+
headers["idempotency-key"] = idempotencyKey;
|
|
91
|
+
return headers;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=clans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clans.js","sourceRoot":"","sources":["../../src/modules/clans.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkDH,0EAA0E;AAC1E,MAAM,OAAO,WAAW;IACO;IAA7B,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,QAAQ,CAAC,KAAoB,EAAE,UAA+B,EAAE;QACpE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAiB;YACvD,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,WAAW;YACtB,OAAO,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC;YACvD,IAAI,EAAE,KAAK;YACX,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,MAAoB;QAChD,MAAM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