@artblocks/abx-sdk 0.1.0-alpha.2 → 0.1.0-alpha.3

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/dist/service.d.ts CHANGED
@@ -16,6 +16,49 @@ export declare const WELL_KNOWN_SERVICE_PATH = "/.well-known/abx-service";
16
16
  export declare const TOKEN_API_INTERFACE = "abx-token-api/v1";
17
17
  export declare const CONTROL_PLANE_INTERFACE = "abx-control-plane/v1";
18
18
  export declare const EFFECTS_PUBLISH_INTERFACE = "abx-effects-publish/v1";
19
+ /**
20
+ * The indexing lifecycle a registration moves through, closed and provider-neutral
21
+ * (specs/self-host-toolkit/remote-services.md → The indexing lifecycle). One vocabulary for a
22
+ * managed provider and for your own node — the reference resolver stamps these too.
23
+ *
24
+ * queued registered + accepted; catch-up hasn't started
25
+ * backfilling actively catching up (initial sync or a forced replay); may already serve partial state
26
+ * live caught up to head; tracking head incrementally
27
+ * stale was live, now lagging (watcher behind, or transient RPC trouble) — still serving
28
+ * failed catch-up errored; carries `error`; will be retried
29
+ *
30
+ * Observability, never a source of truth: token resolution never consults it, and a project
31
+ * reconstructs from chain regardless.
32
+ */
33
+ export type IndexStatus = 'queued' | 'backfilling' | 'live' | 'stale' | 'failed';
34
+ /** Statuses a caller can stop waiting on — see {@link AbxServiceClient.awaitIndexed}. */
35
+ export declare const TERMINAL_INDEX_STATUSES: readonly IndexStatus[];
36
+ /**
37
+ * Why catch-up failed, as a closed machine class — never free-form prose the client must parse.
38
+ * Deliberately NOT extended with a reorg class: the protocol defines no reorg detection (the repair
39
+ * is the deterministic full replay), so no implementation could emit one honestly.
40
+ */
41
+ export type IndexErrorClass =
42
+ /** The RPC didn't answer (down, timing out, network). Retryable — nothing is wrong with the add. */
43
+ 'rpc_unavailable'
44
+ /** The RPC answered "too many requests". Retryable, slower — the usual cause of a long backfill. */
45
+ | 'rpc_rate_limited'
46
+ /** The address doesn't look like an ABX contract on this chain. NOT emitted by the reference
47
+ * (it indexes what its operator tells it); a provider that validates clone-ness SHOULD refuse
48
+ * synchronously at register instead of accepting and failing here. */
49
+ | 'not_abx_contract'
50
+ /** Anything else. Carries no detail — the service logs the cause. */
51
+ | 'internal';
52
+ /** A catch-up failure as it crosses the wire: a machine class plus a short, CREDENTIAL-FREE hint.
53
+ * Messages come from a closed set (see {@link classifyIndexError}) rather than from a scrubber, so
54
+ * "no RPC URL can leak through here" is checkable by reading the code. */
55
+ export interface IndexError {
56
+ class: IndexErrorClass;
57
+ message?: string;
58
+ }
59
+ /** Map a catch-up failure to its wire form. Sniffs the underlying error's shape only to CHOOSE a
60
+ * class — nothing from it reaches the returned message. */
61
+ export declare function classifyIndexError(err: unknown): IndexError;
19
62
  /** Machine error codes every conforming service uses — clients key off these, never off prose. */
20
63
  export type ServiceErrorCode = 'invalid_request' | 'unsupported_chain' | 'unauthorized' | 'forbidden' | 'not_registered' | 'disabled'
21
64
  /** 500 — an unexpected server-side failure. Never carries internal detail (it could embed the
@@ -75,8 +118,11 @@ export interface RegisterProjectBody {
75
118
  /** Force a full replay even on a re-POST. */
76
119
  full?: boolean;
77
120
  }
78
- export interface RegisterProjectResult {
121
+ /** `200` — catch-up finished inside the request; the counts are facts. */
122
+ export interface RegisterProjectSummary {
79
123
  ok: boolean;
124
+ /** Discriminator. Normalized from the HTTP status by {@link AbxServiceClient.registerProject}. */
125
+ accepted: false;
80
126
  mode: 'full' | 'incremental';
81
127
  elapsedMs: number;
82
128
  project: {
@@ -85,8 +131,28 @@ export interface RegisterProjectResult {
85
131
  eventCount: number;
86
132
  tokenCount: number;
87
133
  mintedCount: number;
134
+ status?: IndexStatus;
135
+ };
136
+ }
137
+ /** `202` — the registration is durable and catch-up is deferred; there are no counts yet. Poll
138
+ * {@link AbxServiceClient.projectStatus} (or {@link AbxServiceClient.awaitIndexed}) for progress. */
139
+ export interface RegisterProjectAccepted {
140
+ ok: boolean;
141
+ accepted: true;
142
+ project: {
143
+ address: string;
144
+ name?: string | null;
145
+ status: IndexStatus;
88
146
  };
89
147
  }
148
+ /**
149
+ * `POST /v1/projects` answers in one of two shapes and **the HTTP status code is the discriminator**
150
+ * (200 = done, 202 = accepted). Both are conformant; a client MUST handle both, which is why this is
151
+ * a union rather than a shape with everything optional. Narrow with {@link isAccepted}.
152
+ */
153
+ export type RegisterProjectResult = RegisterProjectSummary | RegisterProjectAccepted;
154
+ /** Narrow a register response to the deferred-catch-up branch. */
155
+ export declare function isAccepted(r: RegisterProjectResult): r is RegisterProjectAccepted;
90
156
  /** One row of `GET /v1/projects` — the projects visible to this token. */
91
157
  export interface RemoteProjectSummary {
92
158
  chainId: number;
@@ -97,17 +163,33 @@ export interface RemoteProjectSummary {
97
163
  tokenCount?: number;
98
164
  mintedCount?: number;
99
165
  reconstructedAt?: string | null;
166
+ /** Where this project is in the indexing lifecycle — so a list renders "3 live, 1 backfilling,
167
+ * 1 failed" with no per-project round trip. */
168
+ status?: IndexStatus;
169
+ /** Present on `stale`/`failed` — the class only; the full hint lives on the status route. */
170
+ error?: {
171
+ class: IndexErrorClass;
172
+ };
100
173
  }
101
- /** `GET /v1/projects/{chainId}/{address}/status` — indexing freshness. */
174
+ /** `GET /v1/projects/{chainId}/{address}/status` — indexing freshness + lifecycle. */
102
175
  export interface RemoteProjectStatus {
103
176
  chainId: number;
104
177
  address: string;
178
+ /** Where this project is in the lifecycle. */
179
+ status: IndexStatus;
105
180
  fromBlock: string;
106
181
  toBlock: string | null;
182
+ /** Chain head as the service last saw it — so a client computes lag / % complete without knowing
183
+ * anything about the service's watcher. `null` when the service can't say. */
184
+ headBlock?: string | null;
107
185
  eventCount: number;
108
186
  tokenCount: number;
109
187
  mintedCount: number;
110
188
  reconstructedAt: string | null;
189
+ /** Present on `stale`/`failed`. Credential-free by contract. */
190
+ error?: IndexError;
191
+ /** Catch-up attempts since the last success. */
192
+ attempts?: number;
111
193
  watcher?: {
112
194
  watching: boolean;
113
195
  pollAt: string | null;
@@ -115,6 +197,21 @@ export interface RemoteProjectStatus {
115
197
  intervalMs?: number;
116
198
  };
117
199
  }
200
+ /**
201
+ * How far along a BACKFILL is, from a status read — `null` when there is no meaningful ratio.
202
+ *
203
+ * Deliberately `null` for anything but `backfilling`, because `toBlock` measures two different things
204
+ * depending on the state. During an initial sync it advances monotonically, so `toBlock` vs head IS
205
+ * progress. Once a project is `live` it only moves when that project has *events* — so a perfectly
206
+ * current project on a busy chain sits at a tiny fraction of head, and rendering that as "3%" reads
207
+ * as broken when nothing is wrong. Same reason the reference measures staleness against its watcher's
208
+ * watermark rather than a project's `toBlock`.
209
+ */
210
+ export declare function indexProgress(s: RemoteProjectStatus): {
211
+ done: bigint;
212
+ total: bigint;
213
+ percent: number;
214
+ } | null;
118
215
  /** `POST /v1/effect-artifacts` — a render producer publishes one output (locator or bytes). */
119
216
  export interface PublishEffectArtifactBody {
120
217
  chainId: number;
@@ -147,12 +244,30 @@ export declare class AbxServiceError extends Error {
147
244
  readonly status: number;
148
245
  readonly code?: ServiceErrorCode;
149
246
  readonly url: string;
247
+ /** The failure CLASS when the service volunteered one (a credential-free hint about *why* — an
248
+ * exhausted RPC reads very differently from a broken service). Optional on the wire. */
249
+ readonly class?: IndexErrorClass;
150
250
  constructor(message: string, opts: {
151
251
  status: number;
152
252
  code?: ServiceErrorCode;
153
253
  url: string;
254
+ class?: IndexErrorClass;
154
255
  });
155
256
  }
257
+ /** Waiting for a project to reach a terminal status ran out of time. The registration is durable —
258
+ * this is "still working", never "the add failed". */
259
+ export declare class AbxIndexTimeoutError extends Error {
260
+ readonly last?: RemoteProjectStatus;
261
+ constructor(message: string, last?: RemoteProjectStatus);
262
+ }
263
+ export interface AwaitIndexedOptions {
264
+ /** Give up after this long (default 5 min). The registration stays durable regardless. */
265
+ timeoutMs?: number;
266
+ /** Poll cadence (default 3s). */
267
+ intervalMs?: number;
268
+ /** Called on every poll — drive a progress line from it. */
269
+ onProgress?: (status: RemoteProjectStatus) => void;
270
+ }
156
271
  export interface ServiceClientOptions {
157
272
  baseUrl: string;
158
273
  /** Bearer token for the control plane. Omit for descriptor-only use. */
@@ -170,8 +285,23 @@ export declare class AbxServiceClient {
170
285
  constructor(opts: ServiceClientOptions);
171
286
  /** The public service descriptor — no auth, safe to fetch before trusting a provider. */
172
287
  descriptor(): Promise<ServiceDescriptor>;
173
- /** Register + index a project (the HTTP form of `abx add`; a re-POST is the nudge). */
288
+ /**
289
+ * Register + index a project (the HTTP form of `abx add`; a re-POST is the nudge). Returns the
290
+ * completed summary (HTTP 200) or the accepted-and-still-working shape (HTTP 202) — narrow with
291
+ * {@link isAccepted}, and follow a 202 with {@link awaitIndexed}.
292
+ *
293
+ * A timed-out register is NOT retried blind. A conforming service persists the registration before
294
+ * it starts catching up, so a timeout usually means "it's in there, still working" — and re-POSTing
295
+ * would kick off a *second* full reconstruct against the RPC that was already too slow to answer.
296
+ * So we ask the status route whether it landed, and if it did we return the async shape instead.
297
+ */
174
298
  registerProject(body: RegisterProjectBody): Promise<RegisterProjectResult>;
299
+ /**
300
+ * Poll a project's status until it reaches a terminal lifecycle state (`live` or `failed`) — the
301
+ * one implementation of the wait loop, so the CLI, the effects runner, and any hosted agent all
302
+ * behave identically against any provider. `stale` keeps polling: it means lagging, not caught up.
303
+ */
304
+ awaitIndexed(chainId: number, address: string, opts?: AwaitIndexedOptions): Promise<RemoteProjectStatus>;
175
305
  /** The projects this token may see. */
176
306
  listProjects(): Promise<RemoteProjectSummary[]>;
177
307
  /** Deregister (remote `abx forget`). `not_registered` means "already gone" — reported, not
@@ -179,7 +309,8 @@ export declare class AbxServiceClient {
179
309
  removeProject(chainId: number, address: string): Promise<{
180
310
  removed: boolean;
181
311
  }>;
182
- /** Nudge a re-index. */
312
+ /** Nudge a re-index. Answers in the same two shapes as {@link registerProject} — a full replay is
313
+ * the *most* likely call to outlive one HTTP request. */
183
314
  reindexProject(chainId: number, address: string): Promise<RegisterProjectResult>;
184
315
  /** Indexing freshness for one project. */
185
316
  projectStatus(chainId: number, address: string): Promise<RemoteProjectStatus>;
@@ -192,5 +323,6 @@ export declare class AbxServiceClient {
192
323
  /** Report a run's transient state for the artifact key it is producing. */
193
324
  reportEffectStatus(body: ReportEffectStatusBody): Promise<void>;
194
325
  private request;
326
+ private requestWithStatus;
195
327
  }
196
328
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,MAAM,CAAC;AAC9B,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,uBAAuB,6BAA6B,CAAC;AAElE;yFACyF;AACzF,eAAO,MAAM,mBAAmB,qBAAqB,CAAC;AACtD,eAAO,MAAM,uBAAuB,yBAAyB,CAAC;AAC9D,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,kGAAkG;AAClG,MAAM,MAAM,gBAAgB,GACxB,iBAAiB,GACjB,mBAAmB,GACnB,cAAc,GACd,WAAW,GACX,gBAAgB,GAChB,UAAU;AACZ;uEACuE;GACrE,gBAAgB,CAAC;AAErB,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,0FAA0F;IAC1F,OAAO,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC5C,mFAAmF;IACnF,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,2FAA2F;IAC3F,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;uCACmC;IACnC,IAAI,CAAC,EAAE;QAAC,MAAM,EAAE,QAAQ,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAChE;sFACkF;IAClF,MAAM,CAAC,EAAE;QAAC,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,EA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,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUhF;;;;OAIG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAmBlH,uCAAuC;IACjC,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAKrD;qGACiG;IAC3F,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAC,CAAC;IAUlF;8DAC0D;IACpD,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAUtF,0CAA0C;IACpC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAInF,iGAAiG;IAC3F,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC;QAAC,EAAE,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;QAAC,GAAG,EAAE,GAAG,CAAA;KAAC,CAAC;IAIzH,2EAA2E;IACrE,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;YAIvD,OAAO;YAIP,iBAAiB;CAsEhC"}
package/dist/service.js CHANGED
@@ -14,18 +14,89 @@ export const WELL_KNOWN_SERVICE_PATH = '/.well-known/abx-service';
14
14
  export const TOKEN_API_INTERFACE = 'abx-token-api/v1';
15
15
  export const CONTROL_PLANE_INTERFACE = 'abx-control-plane/v1';
16
16
  export const EFFECTS_PUBLISH_INTERFACE = 'abx-effects-publish/v1';
17
+ /** Statuses a caller can stop waiting on — see {@link AbxServiceClient.awaitIndexed}. */
18
+ export const TERMINAL_INDEX_STATUSES = ['live', 'failed'];
19
+ /** The one message per class. Fixed strings — an upstream error is never interpolated, because a
20
+ * keyed RPC URL *is* a credential and upstream messages routinely embed one. */
21
+ const INDEX_ERROR_MESSAGES = {
22
+ rpc_unavailable: 'upstream RPC unavailable; will retry',
23
+ rpc_rate_limited: 'upstream RPC rate-limited; will retry',
24
+ not_abx_contract: 'address emits no ABX event spine on this chain',
25
+ internal: 'indexing failed; see the service operator’s logs',
26
+ };
27
+ /** Map a catch-up failure to its wire form. Sniffs the underlying error's shape only to CHOOSE a
28
+ * class — nothing from it reaches the returned message. */
29
+ export function classifyIndexError(err) {
30
+ const raw = err instanceof Error ? `${err.name} ${err.message}` : String(err);
31
+ const text = raw.toLowerCase();
32
+ let cls = 'internal';
33
+ if (/rate.?limit|too many requests|\b429\b|quota|exceeded .*(?:compute|cu)|throttl/.test(text)) {
34
+ cls = 'rpc_rate_limited';
35
+ }
36
+ else if (/timeout|timed out|econnrefused|econnreset|enotfound|eai_again|socket hang up|fetch failed|network|502|503|504|http request failed/.test(text)) {
37
+ cls = 'rpc_unavailable';
38
+ }
39
+ return { class: cls, message: INDEX_ERROR_MESSAGES[cls] };
40
+ }
41
+ /** Narrow a register response to the deferred-catch-up branch. */
42
+ export function isAccepted(r) {
43
+ return r.accepted === true;
44
+ }
45
+ /**
46
+ * How far along a BACKFILL is, from a status read — `null` when there is no meaningful ratio.
47
+ *
48
+ * Deliberately `null` for anything but `backfilling`, because `toBlock` measures two different things
49
+ * depending on the state. During an initial sync it advances monotonically, so `toBlock` vs head IS
50
+ * progress. Once a project is `live` it only moves when that project has *events* — so a perfectly
51
+ * current project on a busy chain sits at a tiny fraction of head, and rendering that as "3%" reads
52
+ * as broken when nothing is wrong. Same reason the reference measures staleness against its watcher's
53
+ * watermark rather than a project's `toBlock`.
54
+ */
55
+ export function indexProgress(s) {
56
+ if (s.status !== 'backfilling')
57
+ return null;
58
+ if (!s.headBlock || !s.toBlock)
59
+ return null;
60
+ try {
61
+ const from = BigInt(s.fromBlock);
62
+ const to = BigInt(s.toBlock);
63
+ const head = BigInt(s.headBlock);
64
+ if (head <= from || to < from)
65
+ return null;
66
+ const total = head - from;
67
+ const done = (to > head ? head : to) - from;
68
+ return { done, total, percent: Number((done * 100n) / total) };
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ }
17
74
  /** A non-2xx control-plane response (or an unreachable service, after retries). `code` is the
18
75
  * spec's machine code when the service sent one — key behavior off it, never off `message`. */
19
76
  export class AbxServiceError extends Error {
20
77
  status;
21
78
  code;
22
79
  url;
80
+ /** The failure CLASS when the service volunteered one (a credential-free hint about *why* — an
81
+ * exhausted RPC reads very differently from a broken service). Optional on the wire. */
82
+ class;
23
83
  constructor(message, opts) {
24
84
  super(message);
25
85
  this.name = 'AbxServiceError';
26
86
  this.status = opts.status;
27
87
  this.code = opts.code;
28
88
  this.url = opts.url;
89
+ this.class = opts.class;
90
+ }
91
+ }
92
+ /** Waiting for a project to reach a terminal status ran out of time. The registration is durable —
93
+ * this is "still working", never "the add failed". */
94
+ export class AbxIndexTimeoutError extends Error {
95
+ last;
96
+ constructor(message, last) {
97
+ super(message);
98
+ this.name = 'AbxIndexTimeoutError';
99
+ this.last = last;
29
100
  }
30
101
  }
31
102
  /**
@@ -51,11 +122,48 @@ export class AbxServiceClient {
51
122
  }
52
123
  /** The public service descriptor — no auth, safe to fetch before trusting a provider. */
53
124
  async descriptor() {
54
- return (await this.request('GET', WELL_KNOWN_SERVICE_PATH, undefined, DESCRIPTOR_ATTEMPTS));
125
+ return (await this.request('GET', WELL_KNOWN_SERVICE_PATH, undefined, { attempts: DESCRIPTOR_ATTEMPTS }));
55
126
  }
56
- /** Register + index a project (the HTTP form of `abx add`; a re-POST is the nudge). */
127
+ /**
128
+ * Register + index a project (the HTTP form of `abx add`; a re-POST is the nudge). Returns the
129
+ * completed summary (HTTP 200) or the accepted-and-still-working shape (HTTP 202) — narrow with
130
+ * {@link isAccepted}, and follow a 202 with {@link awaitIndexed}.
131
+ *
132
+ * A timed-out register is NOT retried blind. A conforming service persists the registration before
133
+ * it starts catching up, so a timeout usually means "it's in there, still working" — and re-POSTing
134
+ * would kick off a *second* full reconstruct against the RPC that was already too slow to answer.
135
+ * So we ask the status route whether it landed, and if it did we return the async shape instead.
136
+ */
57
137
  async registerProject(body) {
58
- return (await this.request('POST', '/v1/projects', body));
138
+ const landed = async () => {
139
+ const st = await this.projectStatus(body.chainId, body.address).catch(() => null);
140
+ if (!st)
141
+ return undefined; // not there (or the service is truly unreachable) — keep retrying
142
+ return { ok: true, accepted: true, project: { address: body.address, status: st.status } };
143
+ };
144
+ const { status, body: out } = await this.requestWithStatus('POST', '/v1/projects', body, { onTimeout: landed });
145
+ return normalizeRegisterResult(status, out, body.address);
146
+ }
147
+ /**
148
+ * Poll a project's status until it reaches a terminal lifecycle state (`live` or `failed`) — the
149
+ * one implementation of the wait loop, so the CLI, the effects runner, and any hosted agent all
150
+ * behave identically against any provider. `stale` keeps polling: it means lagging, not caught up.
151
+ */
152
+ async awaitIndexed(chainId, address, opts = {}) {
153
+ const timeoutMs = opts.timeoutMs ?? 300_000;
154
+ const intervalMs = opts.intervalMs ?? 3_000;
155
+ const deadline = Date.now() + timeoutMs;
156
+ let last;
157
+ for (;;) {
158
+ last = await this.projectStatus(chainId, address);
159
+ opts.onProgress?.(last);
160
+ if (TERMINAL_INDEX_STATUSES.includes(last.status))
161
+ return last;
162
+ if (Date.now() + intervalMs > deadline) {
163
+ throw new AbxIndexTimeoutError(`${address} was still '${last.status}' after ${Math.round(timeoutMs / 1000)}s — the registration is durable and the service keeps working; check back with \`abx status ${address} --remote\``, last);
164
+ }
165
+ await sleep(intervalMs);
166
+ }
59
167
  }
60
168
  /** The projects this token may see. */
61
169
  async listProjects() {
@@ -75,9 +183,16 @@ export class AbxServiceClient {
75
183
  throw err;
76
184
  }
77
185
  }
78
- /** Nudge a re-index. */
186
+ /** Nudge a re-index. Answers in the same two shapes as {@link registerProject} — a full replay is
187
+ * the *most* likely call to outlive one HTTP request. */
79
188
  async reindexProject(chainId, address) {
80
- return (await this.request('POST', `/v1/projects/${chainId}/${address}/reindex`));
189
+ const { status, body } = await this.requestWithStatus('POST', `/v1/projects/${chainId}/${address}/reindex`, undefined, {
190
+ onTimeout: async () => {
191
+ const st = await this.projectStatus(chainId, address).catch(() => null);
192
+ return st ? { ok: true, accepted: true, project: { address, status: st.status } } : undefined;
193
+ },
194
+ });
195
+ return normalizeRegisterResult(status, body, address);
81
196
  }
82
197
  /** Indexing freshness for one project. */
83
198
  async projectStatus(chainId, address) {
@@ -91,7 +206,11 @@ export class AbxServiceClient {
91
206
  async reportEffectStatus(body) {
92
207
  await this.request('POST', '/v1/effect-status', body);
93
208
  }
94
- async request(method, path, body, attempts = ATTEMPTS) {
209
+ async request(method, path, body, opts) {
210
+ return (await this.requestWithStatus(method, path, body, opts)).body;
211
+ }
212
+ async requestWithStatus(method, path, body, opts) {
213
+ const attempts = opts?.attempts ?? ATTEMPTS;
95
214
  const url = this.baseUrl + path;
96
215
  const headers = {};
97
216
  if (this.token)
@@ -101,6 +220,7 @@ export class AbxServiceClient {
101
220
  let lastFailure = '';
102
221
  let lastStatus = 0;
103
222
  let lastCode;
223
+ let lastClass;
104
224
  for (let attempt = 1; attempt <= attempts; attempt++) {
105
225
  let resp;
106
226
  try {
@@ -114,13 +234,21 @@ export class AbxServiceClient {
114
234
  catch (err) {
115
235
  lastFailure = err.message;
116
236
  lastStatus = 0;
237
+ // "We waited the full timeout" and "nothing is listening" are different failures, and for a
238
+ // mutating POST the difference decides whether retrying is safe: the request may still be
239
+ // running on the service. Let the caller check before we hammer it again.
240
+ if (opts?.onTimeout && err.name === 'TimeoutError') {
241
+ const resolved = await opts.onTimeout();
242
+ if (resolved !== undefined)
243
+ return { status: 202, body: resolved };
244
+ }
117
245
  if (attempt < attempts)
118
246
  await sleep(this.retryDelayMs * attempt);
119
247
  continue;
120
248
  }
121
249
  if (resp.ok) {
122
250
  const text = await resp.text();
123
- return text ? JSON.parse(text) : {};
251
+ return { status: resp.status, body: text ? JSON.parse(text) : {} };
124
252
  }
125
253
  if (resp.status >= 500 || resp.status === 429) {
126
254
  // Retryable — but KEEP the service's own words. A 5xx body carries the actual cause (an
@@ -129,6 +257,7 @@ export class AbxServiceClient {
129
257
  const said = await bodyMessage(resp);
130
258
  lastStatus = resp.status;
131
259
  lastCode = said.code;
260
+ lastClass = said.class;
132
261
  lastFailure = said.error ? `${resp.status} ${said.error}` : `${resp.status} ${resp.statusText}`;
133
262
  if (attempt < attempts)
134
263
  await sleep(this.retryDelayMs * attempt);
@@ -139,6 +268,7 @@ export class AbxServiceClient {
139
268
  throw new AbxServiceError(`${method} ${url}: ${resp.status} ${detail.error ?? resp.statusText}`, {
140
269
  status: resp.status,
141
270
  code: detail.code,
271
+ class: detail.class,
142
272
  url,
143
273
  });
144
274
  }
@@ -147,14 +277,37 @@ export class AbxServiceClient {
147
277
  const summary = lastStatus
148
278
  ? `service failed after ${attempts} attempt(s) — last response ${lastFailure}`
149
279
  : `nothing responded after ${attempts} attempt(s) (${lastFailure})`;
150
- throw new AbxServiceError(`${method} ${url}: ${summary}`, { status: lastStatus, code: lastCode, url });
280
+ throw new AbxServiceError(`${method} ${url}: ${summary}`, { status: lastStatus, code: lastCode, class: lastClass, url });
281
+ }
282
+ }
283
+ /** Normalize a register/reindex response: the HTTP status is the authoritative discriminator, and
284
+ * the `accepted` flag is derived from it so callers switch on one field even against a service that
285
+ * doesn't send it. */
286
+ function normalizeRegisterResult(status, out, fallbackAddress) {
287
+ if (status === 202) {
288
+ const r = out;
289
+ return {
290
+ ok: r.ok ?? true,
291
+ accepted: true,
292
+ project: {
293
+ address: r.project?.address ?? fallbackAddress,
294
+ name: r.project?.name ?? null,
295
+ status: r.project?.status ?? 'backfilling',
296
+ },
297
+ };
151
298
  }
299
+ return { ...out, accepted: false };
152
300
  }
153
- /** The service's own `{error, code}` from a non-2xx body (never throws — a body may be empty/HTML). */
301
+ /** The service's own `{error, code, class?}` from a non-2xx body (never throws — a body may be
302
+ * empty/HTML). `class` is the optional credential-free failure hint. */
154
303
  async function bodyMessage(resp) {
155
304
  try {
156
305
  const parsed = (await resp.json());
157
- return { error: parsed.error, code: parsed.code };
306
+ return {
307
+ error: parsed.error,
308
+ code: parsed.code,
309
+ class: parsed.class,
310
+ };
158
311
  }
159
312
  catch {
160
313
  return {};
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,CAAC,MAAM,uBAAuB,GAAG,0BAA0B,CAAC;AAElE;yFACyF;AACzF,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAC;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAkHlE;gGACgG;AAChG,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,MAAM,CAAS;IACf,IAAI,CAAoB;IACxB,GAAG,CAAS;IAErB,YAAY,OAAe,EAAE,IAA4D;QACvF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IACtB,CAAC;CACF;AAYD;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB;;2EAE2E;AAC3E,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,OAAO,gBAAgB;IAClB,OAAO,CAAS;IACR,KAAK,CAAU;IACf,SAAS,CAAS;IAClB,YAAY,CAAS;IAEtC,YAAY,IAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAA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;QACH,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAoD,CAAC;QACtF,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,IAAI,EAAE,MAAM,CAAC,IAAoC;YACjD,KAAK,EAAE,MAAM,CAAC,KAAoC;SACnD,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artblocks/abx-sdk",
3
- "version": "0.1.0-alpha.2",
3
+ "version": "0.1.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "description": "ABX SDK (Layer 2) — the neutral, low-level library that turns protocol operations into typed function calls. No provider, no chain, no UX baked in.",
6
6
  "type": "module",