@ethitrust/sdk 1.0.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +177 -0
  3. package/dist/client.d.ts +42 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +45 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/errors.d.ts +66 -0
  8. package/dist/errors.d.ts.map +1 -0
  9. package/dist/errors.js +115 -0
  10. package/dist/errors.js.map +1 -0
  11. package/dist/http.d.ts +49 -0
  12. package/dist/http.d.ts.map +1 -0
  13. package/dist/http.js +193 -0
  14. package/dist/http.js.map +1 -0
  15. package/dist/index.d.ts +10 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +7 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/resources/orgEscrows.d.ts +53 -0
  20. package/dist/resources/orgEscrows.d.ts.map +1 -0
  21. package/dist/resources/orgEscrows.js +168 -0
  22. package/dist/resources/orgEscrows.js.map +1 -0
  23. package/dist/types.d.ts +229 -0
  24. package/dist/types.d.ts.map +1 -0
  25. package/dist/types.js +6 -0
  26. package/dist/types.js.map +1 -0
  27. package/dist/utils/idempotency.d.ts +9 -0
  28. package/dist/utils/idempotency.d.ts.map +1 -0
  29. package/dist/utils/idempotency.js +25 -0
  30. package/dist/utils/idempotency.js.map +1 -0
  31. package/dist/utils/query.d.ts +8 -0
  32. package/dist/utils/query.d.ts.map +1 -0
  33. package/dist/utils/query.js +35 -0
  34. package/dist/utils/query.js.map +1 -0
  35. package/package.json +51 -0
  36. package/src/client.ts +69 -0
  37. package/src/errors.ts +140 -0
  38. package/src/http.ts +246 -0
  39. package/src/index.ts +23 -0
  40. package/src/resources/orgEscrows.ts +246 -0
  41. package/src/types.ts +286 -0
  42. package/src/utils/idempotency.ts +23 -0
  43. package/src/utils/query.ts +31 -0
package/dist/http.js ADDED
@@ -0,0 +1,193 @@
1
+ import { EthitrustAbortError, EthitrustNetworkError, EthitrustRateLimitError, buildApiError, } from './errors.js';
2
+ import { toQueryString } from './utils/query.js';
3
+ export class HttpClient {
4
+ baseUrl;
5
+ apiKey;
6
+ apiKeyHeader;
7
+ timeoutMs;
8
+ maxRetries;
9
+ retryBaseDelayMs;
10
+ fetchImpl;
11
+ defaultHeaders;
12
+ constructor(opts) {
13
+ if (!opts.apiKey)
14
+ throw new Error('apiKey is required');
15
+ if (!opts.baseUrl)
16
+ throw new Error('baseUrl is required');
17
+ this.apiKey = opts.apiKey;
18
+ this.apiKeyHeader = opts.apiKeyHeader ?? 'X-API-Key';
19
+ this.baseUrl = stripTrailingSlash(opts.baseUrl);
20
+ this.timeoutMs = opts.timeoutMs ?? 30_000;
21
+ this.maxRetries = opts.maxRetries ?? 2;
22
+ this.retryBaseDelayMs = opts.retryBaseDelayMs ?? 300;
23
+ const fImpl = opts.fetch ?? globalThis.fetch;
24
+ if (!fImpl) {
25
+ throw new Error('No fetch implementation found. Use Node 18+ or pass `fetch` explicitly.');
26
+ }
27
+ this.fetchImpl = fImpl.bind(globalThis);
28
+ this.defaultHeaders = {
29
+ Accept: 'application/json',
30
+ 'User-Agent': opts.userAgent ?? '@ethitrust/sdk/1.0.0 node',
31
+ ...opts.defaultHeaders,
32
+ };
33
+ }
34
+ async request(opts) {
35
+ const url = this.buildUrl(opts.path, opts.query);
36
+ const headers = this.buildHeaders(opts);
37
+ const hasBody = opts.body !== undefined && opts.body !== null;
38
+ const init = {
39
+ method: opts.method,
40
+ headers,
41
+ body: hasBody ? JSON.stringify(opts.body) : undefined,
42
+ };
43
+ let attempt = 0;
44
+ // eslint-disable-next-line no-constant-condition
45
+ while (true) {
46
+ const { signal, cancel } = mergeSignals(opts.signal, opts.timeoutMs ?? this.timeoutMs);
47
+ try {
48
+ const response = await this.fetchImpl(url, { ...init, signal });
49
+ cancel();
50
+ if (response.ok) {
51
+ return (await parseBody(response));
52
+ }
53
+ const body = await parseBody(response);
54
+ const retryAfter = parseRetryAfter(response.headers.get('Retry-After'));
55
+ const err = buildApiError({
56
+ status: response.status,
57
+ statusText: response.statusText,
58
+ url,
59
+ method: opts.method,
60
+ body,
61
+ requestId: response.headers.get('X-Request-Id') ?? undefined,
62
+ retryAfter,
63
+ });
64
+ if (this.shouldRetry(response.status, attempt) && opts.method === 'GET') {
65
+ await sleep(this.backoff(attempt, retryAfter));
66
+ attempt++;
67
+ continue;
68
+ }
69
+ // Always retry 429s regardless of method, since the server signals it.
70
+ if (response.status === 429 && attempt < this.maxRetries) {
71
+ await sleep(this.backoff(attempt, retryAfter));
72
+ attempt++;
73
+ continue;
74
+ }
75
+ throw err;
76
+ }
77
+ catch (err) {
78
+ cancel();
79
+ if (err instanceof EthitrustRateLimitError)
80
+ throw err;
81
+ if (isAbortError(err)) {
82
+ if (opts.signal?.aborted)
83
+ throw new EthitrustAbortError();
84
+ // Timeout: treat as network error, eligible for retry on GET.
85
+ if (opts.method === 'GET' && attempt < this.maxRetries) {
86
+ await sleep(this.backoff(attempt));
87
+ attempt++;
88
+ continue;
89
+ }
90
+ throw new EthitrustNetworkError('Request timed out', err);
91
+ }
92
+ // Non-API error rethrown (validation, etc.).
93
+ if (err && typeof err === 'object' && 'status' in err) {
94
+ throw err;
95
+ }
96
+ if (opts.method === 'GET' && attempt < this.maxRetries) {
97
+ await sleep(this.backoff(attempt));
98
+ attempt++;
99
+ continue;
100
+ }
101
+ throw new EthitrustNetworkError(err instanceof Error ? err.message : 'Network error', err);
102
+ }
103
+ }
104
+ }
105
+ buildUrl(path, query) {
106
+ const p = path.startsWith('/') ? path : `/${path}`;
107
+ const qs = query ? toQueryString(query) : '';
108
+ return `${this.baseUrl}${p}${qs}`;
109
+ }
110
+ buildHeaders(opts) {
111
+ const h = new Headers(this.defaultHeaders);
112
+ h.set(this.apiKeyHeader, this.apiKey);
113
+ if (opts.body !== undefined && opts.body !== null) {
114
+ h.set('Content-Type', 'application/json');
115
+ }
116
+ if (opts.idempotencyKey) {
117
+ h.set('X-Idempotency-Key', opts.idempotencyKey);
118
+ }
119
+ if (opts.headers) {
120
+ for (const [k, v] of Object.entries(opts.headers))
121
+ h.set(k, v);
122
+ }
123
+ return h;
124
+ }
125
+ shouldRetry(status, attempt) {
126
+ if (attempt >= this.maxRetries)
127
+ return false;
128
+ return status >= 500 && status < 600;
129
+ }
130
+ backoff(attempt, retryAfterSec) {
131
+ if (retryAfterSec && retryAfterSec > 0)
132
+ return retryAfterSec * 1000;
133
+ const jitter = Math.random() * 0.25 + 0.875; // 0.875–1.125
134
+ return Math.min(this.retryBaseDelayMs * 2 ** attempt * jitter, 10_000);
135
+ }
136
+ }
137
+ function stripTrailingSlash(s) {
138
+ return s.endsWith('/') ? s.slice(0, -1) : s;
139
+ }
140
+ async function parseBody(res) {
141
+ if (res.status === 204)
142
+ return undefined;
143
+ const ct = res.headers.get('Content-Type') ?? '';
144
+ if (ct.includes('application/json')) {
145
+ try {
146
+ return await res.json();
147
+ }
148
+ catch {
149
+ return undefined;
150
+ }
151
+ }
152
+ const txt = await res.text();
153
+ return txt || undefined;
154
+ }
155
+ function parseRetryAfter(h) {
156
+ if (!h)
157
+ return undefined;
158
+ const n = Number(h);
159
+ if (Number.isFinite(n))
160
+ return n;
161
+ const date = Date.parse(h);
162
+ if (Number.isFinite(date)) {
163
+ return Math.max(0, Math.round((date - Date.now()) / 1000));
164
+ }
165
+ return undefined;
166
+ }
167
+ function mergeSignals(user, timeoutMs) {
168
+ const ctrl = new AbortController();
169
+ const onUserAbort = () => ctrl.abort(user?.reason);
170
+ if (user) {
171
+ if (user.aborted)
172
+ ctrl.abort(user.reason);
173
+ else
174
+ user.addEventListener('abort', onUserAbort, { once: true });
175
+ }
176
+ const timer = setTimeout(() => ctrl.abort(new Error('timeout')), timeoutMs);
177
+ return {
178
+ signal: ctrl.signal,
179
+ cancel: () => {
180
+ clearTimeout(timer);
181
+ if (user)
182
+ user.removeEventListener('abort', onUserAbort);
183
+ },
184
+ };
185
+ }
186
+ function isAbortError(err) {
187
+ return (err instanceof Error &&
188
+ (err.name === 'AbortError' || err.name === 'TimeoutError'));
189
+ }
190
+ function sleep(ms) {
191
+ return new Promise((r) => setTimeout(r, ms));
192
+ }
193
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAoCjD,MAAM,OAAO,UAAU;IACZ,OAAO,CAAS;IACR,MAAM,CAAS;IACf,YAAY,CAAS;IACrB,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,gBAAgB,CAAS;IACzB,SAAS,CAAe;IACxB,cAAc,CAAyB;IAExD,YAAY,IAAuB;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC1D,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,WAAW,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,IAAI,GAAG,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;QAC7C,IAAI,CAAC,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ptions } from './client.js';
3
+ export { HttpClient } from './http.js';
4
+ export type { HttpClientOptions, RequestOptions } from './http.js';
5
+ export { OrgEscrowsResource } from './resources/orgEscrows.js';
6
+ export type { RequestExtras } from './resources/orgEscrows.js';
7
+ export { generateIdempotencyKey } from './utils/idempotency.js';
8
+ export * from './types.js';
9
+ export { EthitrustError, EthitrustApiError, EthitrustAuthError, EthitrustNotFoundError, EthitrustConflictError, EthitrustValidationError, EthitrustRateLimitError, EthitrustNetworkError, EthitrustAbortError, } from './errors.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { EthitrustClient } from './client.js';
2
+ export { HttpClient } from './http.js';
3
+ export { OrgEscrowsResource } from './resources/orgEscrows.js';
4
+ export { generateIdempotencyKey } from './utils/idempotency.js';
5
+ export * from './types.js';
6
+ export { EthitrustError, EthitrustApiError, EthitrustAuthError, EthitrustNotFoundError, EthitrustConflictError, EthitrustValidationError, EthitrustRateLimitError, EthitrustNetworkError, EthitrustAbortError, } from './errors.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { InitializeEscrowResponse, ListOrgEscrowsParams, OrgEscrowAuditTrailResponse, OrgEscrowCancelResponse, OrgEscrowDetailResponse, OrgEscrowHealthResponse, OrgEscrowListItem, OrgEscrowListResponse, OrgEscrowReportParams, OrgEscrowReportResponse, OrgEscrowStatusResponse, OrganizationInitializeEscrowRequest, WebhookLogEntry, WebhookTestResponse } from '../types.js';
3
+ export interface RequestExtras {
4
+ /**
5
+ * Idempotency key for write operations. If omitted, the SDK auto-generates
6
+ * a UUID v4 so safe retries remain idempotent.
7
+ * Pass `null` to explicitly disable the header.
8
+ */
9
+ idempotencyKey?: string | null;
10
+ signal?: AbortSignal;
11
+ timeoutMs?: number;
12
+ headers?: Record<string, string>;
13
+ }
14
+ export declare class OrgEscrowsResource {
15
+ private readonly http;
16
+ constructor(http: HttpClient);
17
+ /** POST /api/v1/org-escrows — initialise a new escrow on behalf of the org. */
18
+ create(body: OrganizationInitializeEscrowRequest, extras?: RequestExtras): Promise<InitializeEscrowResponse>;
19
+ /** GET /api/v1/org-escrows — paginated, filterable list. */
20
+ list(params?: ListOrgEscrowsParams, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<OrgEscrowListResponse>;
21
+ /**
22
+ * Async iterator over every page of org escrows. Yields individual
23
+ * `OrgEscrowListItem` records.
24
+ *
25
+ * ```ts
26
+ * for await (const e of client.orgEscrows.iter({ status: 'active' })) {
27
+ * console.log(e.escrow_id);
28
+ * }
29
+ * ```
30
+ */
31
+ iter(params?: ListOrgEscrowsParams, extras?: Omit<RequestExtras, 'idempotencyKey'>): AsyncGenerator<OrgEscrowListItem, void, void>;
32
+ /** GET /api/v1/org-escrows/{escrow_id} — lightweight status snapshot. */
33
+ getStatus(escrowId: string, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<OrgEscrowStatusResponse>;
34
+ /** GET /api/v1/org-escrows/{escrow_id}/detail — full detail incl. progress, risk flags. */
35
+ getDetail(escrowId: string, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<OrgEscrowDetailResponse>;
36
+ /** GET /api/v1/org-escrows/{escrow_id}/events — audit trail. */
37
+ getEvents(escrowId: string, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<OrgEscrowAuditTrailResponse>;
38
+ /** GET /api/v1/org-escrows/{escrow_id}/health — boolean state flags. */
39
+ getHealth(escrowId: string, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<OrgEscrowHealthResponse>;
40
+ /** POST /api/v1/org-escrows/{escrow_id}/cancel — cancel & refund (if eligible). */
41
+ cancel(escrowId: string, extras?: RequestExtras): Promise<OrgEscrowCancelResponse>;
42
+ /** POST /api/v1/org-escrows/{escrow_id}/resend — resend the invitation email. */
43
+ resendInvitation(escrowId: string, extras?: RequestExtras): Promise<InitializeEscrowResponse>;
44
+ /** GET /api/v1/org-escrows/reports/summary — org-wide aggregates over a period. */
45
+ getReport(params?: OrgEscrowReportParams, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<OrgEscrowReportResponse>;
46
+ /** GET /api/v1/org-escrows/{escrow_id}/webhooks — deliveries for one escrow. */
47
+ listEscrowWebhookLogs(escrowId: string, extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<WebhookLogEntry[]>;
48
+ /** GET /api/v1/org-escrows/webhooks — 50 most recent deliveries across the org. */
49
+ listWebhookLogs(extras?: Omit<RequestExtras, 'idempotencyKey'>): Promise<WebhookLogEntry[]>;
50
+ /** POST /api/v1/org-escrows/webhooks/test — send a synthetic delivery. */
51
+ testWebhook(extras?: RequestExtras): Promise<WebhookTestResponse>;
52
+ }
53
+ //# sourceMappingURL=orgEscrows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orgEscrows.d.ts","sourceRoot":"","sources":["../../src/resources/orgEscrows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,mCAAmC,EACnC,eAAe,EACf,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAGrB,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAI7C,+EAA+E;IAC/E,MAAM,CACJ,IAAI,EAAE,mCAAmC,EACzC,MAAM,GAAE,aAAkB,GACzB,OAAO,CAAC,wBAAwB,CAAC;IAYpC,4DAA4D;IAC5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gF;IAChF,qBAAqB,CACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,GAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAM,GACjD,OAAO,CAAC,eAAe,EAAE,CAAC;IAU7B,mFAAmF;IACnF,eAAe,CACb,MAAM,GAAE,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAM,GACjD,OAAO,CAAC,eAAe,EAAE,CAAC;IAU7B,0EAA0E;IAC1E,WAAW,CACT,MAAM,GAAE,aAAkB,GACzB,OAAO,CAAC,mBAAmB,CAAC;CAUhC"}
@@ -0,0 +1,168 @@
1
+ import { generateIdempotencyKey } from '../utils/idempotency.js';
2
+ export class OrgEscrowsResource {
3
+ http;
4
+ constructor(http) {
5
+ this.http = http;
6
+ }
7
+ // ── CRUD-ish ──────────────────────────────────────────────────────────────
8
+ /** POST /api/v1/org-escrows — initialise a new escrow on behalf of the org. */
9
+ create(body, extras = {}) {
10
+ return this.http.request({
11
+ method: 'POST',
12
+ path: '/api/v1/org-escrows',
13
+ body,
14
+ idempotencyKey: resolveIdempotencyKey(extras.idempotencyKey),
15
+ signal: extras.signal,
16
+ timeoutMs: extras.timeoutMs,
17
+ headers: extras.headers,
18
+ });
19
+ }
20
+ /** GET /api/v1/org-escrows — paginated, filterable list. */
21
+ list(params = {}, extras = {}) {
22
+ return this.http.request({
23
+ method: 'GET',
24
+ path: '/api/v1/org-escrows',
25
+ query: params,
26
+ signal: extras.signal,
27
+ timeoutMs: extras.timeoutMs,
28
+ headers: extras.headers,
29
+ });
30
+ }
31
+ /**
32
+ * Async iterator over every page of org escrows. Yields individual
33
+ * `OrgEscrowListItem` records.
34
+ *
35
+ * ```ts
36
+ * for await (const e of client.orgEscrows.iter({ status: 'active' })) {
37
+ * console.log(e.escrow_id);
38
+ * }
39
+ * ```
40
+ */
41
+ async *iter(params = {}, extras = {}) {
42
+ let page = params.page ?? 1;
43
+ const pageSize = params.page_size ?? 20;
44
+ // eslint-disable-next-line no-constant-condition
45
+ while (true) {
46
+ const res = await this.list({ ...params, page, page_size: pageSize }, extras);
47
+ for (const item of res.items)
48
+ yield item;
49
+ if (page >= res.total_pages || res.items.length === 0)
50
+ return;
51
+ page++;
52
+ }
53
+ }
54
+ /** GET /api/v1/org-escrows/{escrow_id} — lightweight status snapshot. */
55
+ getStatus(escrowId, extras = {}) {
56
+ return this.http.request({
57
+ method: 'GET',
58
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}`,
59
+ signal: extras.signal,
60
+ timeoutMs: extras.timeoutMs,
61
+ headers: extras.headers,
62
+ });
63
+ }
64
+ /** GET /api/v1/org-escrows/{escrow_id}/detail — full detail incl. progress, risk flags. */
65
+ getDetail(escrowId, extras = {}) {
66
+ return this.http.request({
67
+ method: 'GET',
68
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}/detail`,
69
+ signal: extras.signal,
70
+ timeoutMs: extras.timeoutMs,
71
+ headers: extras.headers,
72
+ });
73
+ }
74
+ /** GET /api/v1/org-escrows/{escrow_id}/events — audit trail. */
75
+ getEvents(escrowId, extras = {}) {
76
+ return this.http.request({
77
+ method: 'GET',
78
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}/events`,
79
+ signal: extras.signal,
80
+ timeoutMs: extras.timeoutMs,
81
+ headers: extras.headers,
82
+ });
83
+ }
84
+ /** GET /api/v1/org-escrows/{escrow_id}/health — boolean state flags. */
85
+ getHealth(escrowId, extras = {}) {
86
+ return this.http.request({
87
+ method: 'GET',
88
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}/health`,
89
+ signal: extras.signal,
90
+ timeoutMs: extras.timeoutMs,
91
+ headers: extras.headers,
92
+ });
93
+ }
94
+ /** POST /api/v1/org-escrows/{escrow_id}/cancel — cancel & refund (if eligible). */
95
+ cancel(escrowId, extras = {}) {
96
+ return this.http.request({
97
+ method: 'POST',
98
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}/cancel`,
99
+ idempotencyKey: resolveIdempotencyKey(extras.idempotencyKey),
100
+ signal: extras.signal,
101
+ timeoutMs: extras.timeoutMs,
102
+ headers: extras.headers,
103
+ });
104
+ }
105
+ /** POST /api/v1/org-escrows/{escrow_id}/resend — resend the invitation email. */
106
+ resendInvitation(escrowId, extras = {}) {
107
+ return this.http.request({
108
+ method: 'POST',
109
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}/resend`,
110
+ idempotencyKey: resolveIdempotencyKey(extras.idempotencyKey),
111
+ signal: extras.signal,
112
+ timeoutMs: extras.timeoutMs,
113
+ headers: extras.headers,
114
+ });
115
+ }
116
+ // ── Reports ───────────────────────────────────────────────────────────────────
117
+ /** GET /api/v1/org-escrows/reports/summary — org-wide aggregates over a period. */
118
+ getReport(params = {}, extras = {}) {
119
+ return this.http.request({
120
+ method: 'GET',
121
+ path: '/api/v1/org-escrows/reports/summary',
122
+ query: params,
123
+ signal: extras.signal,
124
+ timeoutMs: extras.timeoutMs,
125
+ headers: extras.headers,
126
+ });
127
+ }
128
+ // ── Webhooks ─────────────────────────────────────────────────────────────────
129
+ /** GET /api/v1/org-escrows/{escrow_id}/webhooks — deliveries for one escrow. */
130
+ listEscrowWebhookLogs(escrowId, extras = {}) {
131
+ return this.http.request({
132
+ method: 'GET',
133
+ path: `/api/v1/org-escrows/${encodeURIComponent(escrowId)}/webhooks`,
134
+ signal: extras.signal,
135
+ timeoutMs: extras.timeoutMs,
136
+ headers: extras.headers,
137
+ });
138
+ }
139
+ /** GET /api/v1/org-escrows/webhooks — 50 most recent deliveries across the org. */
140
+ listWebhookLogs(extras = {}) {
141
+ return this.http.request({
142
+ method: 'GET',
143
+ path: '/api/v1/org-escrows/webhooks',
144
+ signal: extras.signal,
145
+ timeoutMs: extras.timeoutMs,
146
+ headers: extras.headers,
147
+ });
148
+ }
149
+ /** POST /api/v1/org-escrows/webhooks/test — send a synthetic delivery. */
150
+ testWebhook(extras = {}) {
151
+ return this.http.request({
152
+ method: 'POST',
153
+ path: '/api/v1/org-escrows/webhooks/test',
154
+ idempotencyKey: resolveIdempotencyKey(extras.idempotencyKey),
155
+ signal: extras.signal,
156
+ timeoutMs: extras.timeoutMs,
157
+ headers: extras.headers,
158
+ });
159
+ }
160
+ }
161
+ function resolveIdempotencyKey(k) {
162
+ if (k === null)
163
+ return undefined; // explicitly disabled
164
+ if (k === undefined)
165
+ return generateIdempotencyKey();
166
+ return k;
167
+ }
168
+ //# sourceMappingURL=orgEscrows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orgEscrows.js","sourceRoot":"","sources":["../../src/resources/orgEscrows.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAcjE,MAAM,OAAO,kBAAkB;IACA;IAA7B,YAA6B,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAEjD,6EAA6E;IAE7E,+EAA+E;IAC/E,MAAM,CACJ,IAAyC,EACzC,SAAwB,EAAE;QAE1B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA2B;YACjD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,qBAAqB;YAC3B,IAAI;YACJ,cAAc,EAAE,qBAAqB,CAAC,MAAM,CAAC,cAAc,CAAC;YAC5D,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;IACL,CAAC;IAED,4DAA4D;IAC5D,IAAI,CACF,SAA+B,EAAE,EACjC,SAAgD,EAAE;QAElD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,MAAiC;YACxC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC;IACL,C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