@secondlayer/sdk 2.0.0 → 3.0.0-alpha.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/README.md +0 -33
- package/dist/index.d.ts +0 -175
- package/dist/index.js +1 -147
- package/dist/index.js.map +4 -5
- package/dist/subgraphs/index.d.ts +0 -175
- package/dist/subgraphs/index.js +1 -147
- package/dist/subgraphs/index.js.map +4 -5
- package/package.json +3 -8
- package/dist/workflows/index.d.ts +0 -191
- package/dist/workflows/index.js +0 -244
- package/dist/workflows/index.js.map +0 -12
package/README.md
CHANGED
|
@@ -41,39 +41,6 @@ const rows = await sl.subgraphs.queryTable("my-subgraph", "transfers", {
|
|
|
41
41
|
const result = await sl.subgraphs.deploy({ name, sources, schema, handlerCode });
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
## Workflows
|
|
45
|
-
|
|
46
|
-
Deploy and manage automated workflows.
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
// List
|
|
50
|
-
const { workflows } = await sl.workflows.list();
|
|
51
|
-
|
|
52
|
-
// Get
|
|
53
|
-
const detail = await sl.workflows.get("whale-alerts");
|
|
54
|
-
|
|
55
|
-
// Deploy
|
|
56
|
-
const result = await sl.workflows.deploy({
|
|
57
|
-
name: "whale-alerts",
|
|
58
|
-
trigger: { type: "event", filter: { type: "stx_transfer" } },
|
|
59
|
-
handlerCode: "...",
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Trigger manually
|
|
63
|
-
const { runId } = await sl.workflows.trigger("whale-alerts", { threshold: 100000 });
|
|
64
|
-
|
|
65
|
-
// Pause / Resume / Delete
|
|
66
|
-
await sl.workflows.pause("whale-alerts");
|
|
67
|
-
await sl.workflows.resume("whale-alerts");
|
|
68
|
-
await sl.workflows.delete("whale-alerts");
|
|
69
|
-
|
|
70
|
-
// List runs
|
|
71
|
-
const { runs } = await sl.workflows.listRuns("whale-alerts", { status: "completed", limit: 10 });
|
|
72
|
-
|
|
73
|
-
// Get run details
|
|
74
|
-
const run = await sl.workflows.getRun("run-id");
|
|
75
|
-
```
|
|
76
|
-
|
|
77
44
|
## Error Handling
|
|
78
45
|
|
|
79
46
|
```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -92,183 +92,8 @@ declare class Subgraphs extends BaseClient {
|
|
|
92
92
|
private createTableClient;
|
|
93
93
|
}
|
|
94
94
|
import { InferSubgraphClient as InferSubgraphClient2 } from "@secondlayer/subgraphs";
|
|
95
|
-
import { WorkflowRun, WorkflowRunStatus } from "@secondlayer/workflows";
|
|
96
|
-
interface WorkflowSource {
|
|
97
|
-
name: string;
|
|
98
|
-
version: string;
|
|
99
|
-
sourceCode: string | null;
|
|
100
|
-
readOnly: boolean;
|
|
101
|
-
reason?: string;
|
|
102
|
-
updatedAt: string;
|
|
103
|
-
}
|
|
104
|
-
interface WorkflowStepEvent {
|
|
105
|
-
id: string;
|
|
106
|
-
stepIndex: number;
|
|
107
|
-
stepId: string;
|
|
108
|
-
stepType: string;
|
|
109
|
-
status: string;
|
|
110
|
-
output?: unknown;
|
|
111
|
-
error: string | null;
|
|
112
|
-
retryCount: number;
|
|
113
|
-
aiTokensUsed: number;
|
|
114
|
-
startedAt: string | null;
|
|
115
|
-
completedAt: string | null;
|
|
116
|
-
durationMs: number | null;
|
|
117
|
-
ts: string;
|
|
118
|
-
}
|
|
119
|
-
interface WorkflowRunDoneEvent {
|
|
120
|
-
runId: string;
|
|
121
|
-
status: string;
|
|
122
|
-
error?: string | null;
|
|
123
|
-
completedAt?: string | null;
|
|
124
|
-
}
|
|
125
|
-
type WorkflowTailEvent = {
|
|
126
|
-
type: "step"
|
|
127
|
-
step: WorkflowStepEvent
|
|
128
|
-
} | {
|
|
129
|
-
type: "done"
|
|
130
|
-
done: WorkflowRunDoneEvent
|
|
131
|
-
} | {
|
|
132
|
-
type: "heartbeat"
|
|
133
|
-
ts: string
|
|
134
|
-
} | {
|
|
135
|
-
type: "timeout"
|
|
136
|
-
message: string
|
|
137
|
-
};
|
|
138
|
-
interface DeployDryRunResponse {
|
|
139
|
-
valid: boolean;
|
|
140
|
-
validation?: {
|
|
141
|
-
name: string
|
|
142
|
-
triggerType: string
|
|
143
|
-
};
|
|
144
|
-
bundleSize: number;
|
|
145
|
-
error?: string;
|
|
146
|
-
}
|
|
147
|
-
interface DeployResponse {
|
|
148
|
-
action: "created" | "updated";
|
|
149
|
-
workflowId: string;
|
|
150
|
-
version: string;
|
|
151
|
-
message: string;
|
|
152
|
-
}
|
|
153
|
-
interface BundleWorkflowResponse {
|
|
154
|
-
ok: true;
|
|
155
|
-
name: string;
|
|
156
|
-
trigger: Record<string, unknown>;
|
|
157
|
-
handlerCode: string;
|
|
158
|
-
sourceCode: string;
|
|
159
|
-
retries: Record<string, unknown> | null;
|
|
160
|
-
timeout: number | null;
|
|
161
|
-
bundleSize: number;
|
|
162
|
-
}
|
|
163
|
-
interface WorkflowSummary {
|
|
164
|
-
name: string;
|
|
165
|
-
status: "active" | "paused";
|
|
166
|
-
triggerType: "event" | "schedule" | "manual";
|
|
167
|
-
createdAt: string;
|
|
168
|
-
updatedAt: string;
|
|
169
|
-
}
|
|
170
|
-
interface WorkflowDetail extends WorkflowSummary {
|
|
171
|
-
trigger: Record<string, unknown>;
|
|
172
|
-
retries?: {
|
|
173
|
-
maxAttempts?: number
|
|
174
|
-
backoffMs?: number
|
|
175
|
-
};
|
|
176
|
-
timeout?: number;
|
|
177
|
-
totalRuns: number;
|
|
178
|
-
lastRunAt: string | null;
|
|
179
|
-
}
|
|
180
|
-
interface WorkflowRunSummary {
|
|
181
|
-
id: string;
|
|
182
|
-
workflowName: string;
|
|
183
|
-
status: WorkflowRunStatus;
|
|
184
|
-
duration: number;
|
|
185
|
-
aiTokensUsed: number;
|
|
186
|
-
triggeredAt: string;
|
|
187
|
-
completedAt: string | null;
|
|
188
|
-
}
|
|
189
|
-
declare class Workflows extends BaseClient {
|
|
190
|
-
deploy(data: {
|
|
191
|
-
name: string
|
|
192
|
-
trigger: Record<string, unknown>
|
|
193
|
-
handlerCode: string
|
|
194
|
-
sourceCode?: string
|
|
195
|
-
expectedVersion?: string
|
|
196
|
-
retries?: Record<string, unknown>
|
|
197
|
-
timeout?: number
|
|
198
|
-
clientRequestId?: string
|
|
199
|
-
} & {
|
|
200
|
-
dryRun?: false
|
|
201
|
-
}): Promise<DeployResponse>;
|
|
202
|
-
deploy(data: {
|
|
203
|
-
name: string
|
|
204
|
-
trigger: Record<string, unknown>
|
|
205
|
-
handlerCode: string
|
|
206
|
-
sourceCode?: string
|
|
207
|
-
expectedVersion?: string
|
|
208
|
-
retries?: Record<string, unknown>
|
|
209
|
-
timeout?: number
|
|
210
|
-
dryRun: true
|
|
211
|
-
}): Promise<DeployDryRunResponse>;
|
|
212
|
-
getSource(name: string): Promise<WorkflowSource>;
|
|
213
|
-
/**
|
|
214
|
-
* Bundle a TypeScript workflow source on the server. Used by the web chat
|
|
215
|
-
* authoring loop so Vercel's serverless runtime doesn't have to run esbuild.
|
|
216
|
-
* CLI and MCP still bundle locally — this method is for clients that can't
|
|
217
|
-
* install `@secondlayer/bundler` directly (e.g. browser tooling, edge
|
|
218
|
-
* functions).
|
|
219
|
-
*/
|
|
220
|
-
bundle(data: {
|
|
221
|
-
code: string
|
|
222
|
-
}): Promise<BundleWorkflowResponse>;
|
|
223
|
-
pauseAll(): Promise<{
|
|
224
|
-
paused: number
|
|
225
|
-
workflows: Array<{
|
|
226
|
-
name: string
|
|
227
|
-
version: string
|
|
228
|
-
status: string
|
|
229
|
-
}>
|
|
230
|
-
}>;
|
|
231
|
-
cancelRun(runId: string): Promise<{
|
|
232
|
-
runId: string
|
|
233
|
-
status: string
|
|
234
|
-
cancelled: boolean
|
|
235
|
-
completedAt?: string
|
|
236
|
-
message?: string
|
|
237
|
-
}>;
|
|
238
|
-
rollback(name: string, toVersion?: string): Promise<{
|
|
239
|
-
action: "rolled-back"
|
|
240
|
-
name: string
|
|
241
|
-
fromVersion: string
|
|
242
|
-
restoredFromVersion: string
|
|
243
|
-
version: string
|
|
244
|
-
}>;
|
|
245
|
-
/**
|
|
246
|
-
* Subscribe to a workflow run's server-sent event stream. Resolves when the
|
|
247
|
-
* run completes, times out, or the signal is aborted. Throws on HTTP errors
|
|
248
|
-
* opening the stream.
|
|
249
|
-
*/
|
|
250
|
-
streamRun(name: string, runId: string, onEvent: (event: WorkflowTailEvent) => void, signal?: AbortSignal): Promise<void>;
|
|
251
|
-
list(): Promise<{
|
|
252
|
-
workflows: WorkflowSummary[]
|
|
253
|
-
}>;
|
|
254
|
-
get(name: string): Promise<WorkflowDetail>;
|
|
255
|
-
trigger(name: string, input?: Record<string, unknown>): Promise<{
|
|
256
|
-
runId: string
|
|
257
|
-
}>;
|
|
258
|
-
pause(name: string): Promise<void>;
|
|
259
|
-
resume(name: string): Promise<void>;
|
|
260
|
-
delete(name: string): Promise<void>;
|
|
261
|
-
listRuns(name: string, params?: {
|
|
262
|
-
status?: WorkflowRunStatus
|
|
263
|
-
limit?: number
|
|
264
|
-
}): Promise<{
|
|
265
|
-
runs: WorkflowRunSummary[]
|
|
266
|
-
}>;
|
|
267
|
-
getRun(runId: string): Promise<WorkflowRun>;
|
|
268
|
-
}
|
|
269
95
|
declare class SecondLayer extends BaseClient {
|
|
270
96
|
readonly subgraphs: Subgraphs;
|
|
271
|
-
readonly workflows: Workflows;
|
|
272
97
|
constructor(options?: Partial<SecondLayerOptions>);
|
|
273
98
|
}
|
|
274
99
|
/**
|
package/dist/index.js
CHANGED
|
@@ -248,158 +248,12 @@ class Subgraphs extends BaseClient {
|
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
// src/workflows/client.ts
|
|
252
|
-
function parseSseChunk(raw) {
|
|
253
|
-
let event = "message";
|
|
254
|
-
const dataLines = [];
|
|
255
|
-
for (const line of raw.split(`
|
|
256
|
-
`)) {
|
|
257
|
-
if (line.startsWith("event:")) {
|
|
258
|
-
event = line.slice(6).trim();
|
|
259
|
-
} else if (line.startsWith("data:")) {
|
|
260
|
-
dataLines.push(line.slice(5).trimStart());
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if (dataLines.length === 0)
|
|
264
|
-
return null;
|
|
265
|
-
const data = dataLines.join(`
|
|
266
|
-
`);
|
|
267
|
-
try {
|
|
268
|
-
const parsed = JSON.parse(data);
|
|
269
|
-
switch (event) {
|
|
270
|
-
case "step":
|
|
271
|
-
return { type: "step", step: parsed };
|
|
272
|
-
case "done":
|
|
273
|
-
return { type: "done", done: parsed };
|
|
274
|
-
case "heartbeat":
|
|
275
|
-
return {
|
|
276
|
-
type: "heartbeat",
|
|
277
|
-
ts: typeof parsed === "string" ? parsed : String(parsed)
|
|
278
|
-
};
|
|
279
|
-
case "timeout":
|
|
280
|
-
return {
|
|
281
|
-
type: "timeout",
|
|
282
|
-
message: parsed.message ?? "timeout"
|
|
283
|
-
};
|
|
284
|
-
default:
|
|
285
|
-
return null;
|
|
286
|
-
}
|
|
287
|
-
} catch {
|
|
288
|
-
return null;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
class Workflows extends BaseClient {
|
|
293
|
-
async deploy(data) {
|
|
294
|
-
try {
|
|
295
|
-
return await this.request("POST", "/api/workflows", data);
|
|
296
|
-
} catch (err) {
|
|
297
|
-
if (err instanceof ApiError && err.status === 409) {
|
|
298
|
-
const body = err.body;
|
|
299
|
-
if (body?.currentVersion && body.expectedVersion) {
|
|
300
|
-
throw new VersionConflictError(body.currentVersion, body.expectedVersion, err.message);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
throw err;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
async getSource(name) {
|
|
307
|
-
return this.request("GET", `/api/workflows/${name}/source`);
|
|
308
|
-
}
|
|
309
|
-
async bundle(data) {
|
|
310
|
-
return this.request("POST", "/api/workflows/bundle", data);
|
|
311
|
-
}
|
|
312
|
-
async pauseAll() {
|
|
313
|
-
return this.request("POST", "/api/workflows/pause-all");
|
|
314
|
-
}
|
|
315
|
-
async cancelRun(runId) {
|
|
316
|
-
return this.request("POST", `/api/workflows/runs/${runId}/cancel`);
|
|
317
|
-
}
|
|
318
|
-
async rollback(name, toVersion) {
|
|
319
|
-
return this.request("POST", `/api/workflows/${name}/rollback`, toVersion ? { toVersion } : {});
|
|
320
|
-
}
|
|
321
|
-
async streamRun(name, runId, onEvent, signal) {
|
|
322
|
-
const url = `${this.baseUrl}/api/workflows/${name}/runs/${runId}/stream`;
|
|
323
|
-
const headers = {
|
|
324
|
-
Accept: "text/event-stream",
|
|
325
|
-
"x-sl-origin": this.origin
|
|
326
|
-
};
|
|
327
|
-
if (this.apiKey) {
|
|
328
|
-
headers.Authorization = `Bearer ${this.apiKey}`;
|
|
329
|
-
}
|
|
330
|
-
const res = await fetch(url, { headers, signal });
|
|
331
|
-
if (!res.ok || !res.body) {
|
|
332
|
-
throw new ApiError(res.status, `Failed to open workflow run stream (HTTP ${res.status})`);
|
|
333
|
-
}
|
|
334
|
-
const reader = res.body.pipeThrough(new TextDecoderStream).getReader();
|
|
335
|
-
let buffer = "";
|
|
336
|
-
while (true) {
|
|
337
|
-
const { value, done } = await reader.read();
|
|
338
|
-
if (done)
|
|
339
|
-
break;
|
|
340
|
-
buffer += value;
|
|
341
|
-
let sep = buffer.indexOf(`
|
|
342
|
-
|
|
343
|
-
`);
|
|
344
|
-
while (sep !== -1) {
|
|
345
|
-
const chunk = buffer.slice(0, sep);
|
|
346
|
-
buffer = buffer.slice(sep + 2);
|
|
347
|
-
const parsed = parseSseChunk(chunk);
|
|
348
|
-
if (parsed) {
|
|
349
|
-
onEvent(parsed);
|
|
350
|
-
if (parsed.type === "done" || parsed.type === "timeout") {
|
|
351
|
-
await reader.cancel().catch(() => {
|
|
352
|
-
return;
|
|
353
|
-
});
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
sep = buffer.indexOf(`
|
|
358
|
-
|
|
359
|
-
`);
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
async list() {
|
|
364
|
-
return this.request("GET", "/api/workflows");
|
|
365
|
-
}
|
|
366
|
-
async get(name) {
|
|
367
|
-
return this.request("GET", `/api/workflows/${name}`);
|
|
368
|
-
}
|
|
369
|
-
async trigger(name, input) {
|
|
370
|
-
return this.request("POST", `/api/workflows/${name}/trigger`, input ? { input } : undefined);
|
|
371
|
-
}
|
|
372
|
-
async pause(name) {
|
|
373
|
-
return this.request("POST", `/api/workflows/${name}/pause`);
|
|
374
|
-
}
|
|
375
|
-
async resume(name) {
|
|
376
|
-
return this.request("POST", `/api/workflows/${name}/resume`);
|
|
377
|
-
}
|
|
378
|
-
async delete(name) {
|
|
379
|
-
return this.request("DELETE", `/api/workflows/${name}`);
|
|
380
|
-
}
|
|
381
|
-
async listRuns(name, params) {
|
|
382
|
-
const qs = new URLSearchParams;
|
|
383
|
-
if (params?.status)
|
|
384
|
-
qs.set("status", params.status);
|
|
385
|
-
if (params?.limit !== undefined)
|
|
386
|
-
qs.set("limit", String(params.limit));
|
|
387
|
-
const query = qs.toString();
|
|
388
|
-
return this.request("GET", `/api/workflows/${name}/runs${query ? `?${query}` : ""}`);
|
|
389
|
-
}
|
|
390
|
-
async getRun(runId) {
|
|
391
|
-
return this.request("GET", `/api/workflows/runs/${runId}`);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
251
|
// src/client.ts
|
|
396
252
|
class SecondLayer extends BaseClient {
|
|
397
253
|
subgraphs;
|
|
398
|
-
workflows;
|
|
399
254
|
constructor(options = {}) {
|
|
400
255
|
super(options);
|
|
401
256
|
this.subgraphs = new Subgraphs(options);
|
|
402
|
-
this.workflows = new Workflows(options);
|
|
403
257
|
}
|
|
404
258
|
}
|
|
405
259
|
|
|
@@ -427,5 +281,5 @@ export {
|
|
|
427
281
|
ApiError
|
|
428
282
|
};
|
|
429
283
|
|
|
430
|
-
//# debugId=
|
|
284
|
+
//# debugId=1B497BDD0B6E9C0964756E2164756E21
|
|
431
285
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/errors.ts", "../src/base.ts", "../src/subgraphs/serialize.ts", "../src/subgraphs/client.ts", "../src/
|
|
3
|
+
"sources": ["../src/errors.ts", "../src/base.ts", "../src/subgraphs/serialize.ts", "../src/subgraphs/client.ts", "../src/client.ts", "../src/subgraphs/get-subgraph.ts", "../src/webhooks.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Error thrown by {@link SecondLayer} when an API request fails.\n * Includes the HTTP status code for programmatic error handling.\n *\n * @example\n * ```ts\n * try {\n * await client.subgraphs.get(\"my-subgraph\");\n * } catch (err) {\n * if (err instanceof ApiError && err.status === 404) {\n * console.log(\"Subgraph not found\");\n * }\n * }\n * ```\n */\nexport class ApiError extends Error {\n\tconstructor(\n\t\t/** HTTP status code (0 for network errors). */\n\t\tpublic status: number,\n\t\tmessage: string,\n\t\t/** Raw response body (parsed JSON if possible) — preserved for callers that need error details. */\n\t\tpublic body?: unknown,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"ApiError\";\n\t}\n}\n\n/**\n * Thrown by {@link Workflows.deploy} when the server rejects a deploy because the\n * provided `expectedVersion` does not match the current stored version.\n */\nexport class VersionConflictError extends ApiError {\n\tconstructor(\n\t\tpublic currentVersion: string,\n\t\tpublic expectedVersion: string,\n\t\tmessage = `Version conflict: expected ${expectedVersion}, current ${currentVersion}`,\n\t) {\n\t\tsuper(409, message, { currentVersion, expectedVersion });\n\t\tthis.name = \"VersionConflictError\";\n\t}\n}\n",
|
|
6
6
|
"import { ApiError } from \"./errors.ts\";\n\nexport interface SecondLayerOptions {\n\t/** Base URL of the Secondlayer API (trailing slashes are stripped). */\n\tbaseUrl: string;\n\t/** Bearer token for authenticated requests. */\n\tapiKey?: string;\n\t/** Deploy origin label sent as `x-sl-origin` (telemetry). Defaults to `cli`. */\n\torigin?: \"cli\" | \"mcp\" | \"session\";\n}\n\nconst DEFAULT_BASE_URL = \"https://api.secondlayer.tools\";\n\nexport abstract class BaseClient {\n\tprotected baseUrl: string;\n\tprotected apiKey?: string;\n\tprotected origin: \"cli\" | \"mcp\" | \"session\";\n\n\tconstructor(options: Partial<SecondLayerOptions> = {}) {\n\t\tthis.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n\t\tthis.apiKey = options.apiKey;\n\t\tthis.origin = options.origin ?? \"cli\";\n\t}\n\n\tstatic authHeaders(apiKey?: string): Record<string, string> {\n\t\tconst headers: Record<string, string> = {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t};\n\t\tif (apiKey) {\n\t\t\theaders.Authorization = `Bearer ${apiKey}`;\n\t\t}\n\t\treturn headers;\n\t}\n\n\tprotected async request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\tbody?: unknown,\n\t): Promise<T> {\n\t\tconst url = `${this.baseUrl}${path}`;\n\t\tconst headers = BaseClient.authHeaders(this.apiKey);\n\t\theaders[\"x-sl-origin\"] = this.origin;\n\n\t\tlet response: Response;\n\t\ttry {\n\t\t\tresponse = await fetch(url, {\n\t\t\t\tmethod,\n\t\t\t\theaders,\n\t\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t\t});\n\t\t} catch {\n\t\t\tthrow new ApiError(\n\t\t\t\t0,\n\t\t\t\t`Cannot reach API at ${this.baseUrl}. Check your connection or try again.`,\n\t\t\t);\n\t\t}\n\n\t\tif (!response.ok) {\n\t\t\tif (response.status === 401) {\n\t\t\t\tthrow new ApiError(401, \"API key invalid or expired.\");\n\t\t\t}\n\n\t\t\tif (response.status === 429) {\n\t\t\t\tconst retryAfter = response.headers.get(\"Retry-After\");\n\t\t\t\tconst msg = retryAfter\n\t\t\t\t\t? `Rate limited. Wait ${retryAfter} seconds.`\n\t\t\t\t\t: \"Rate limited. Try again later.\";\n\t\t\t\tthrow new ApiError(429, msg);\n\t\t\t}\n\n\t\t\tif (response.status >= 500) {\n\t\t\t\tthrow new ApiError(\n\t\t\t\t\tresponse.status,\n\t\t\t\t\t`Server error. Try again or check status at ${this.baseUrl}/health`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst errorBody = await response.text();\n\t\t\tlet message = `HTTP ${response.status}`;\n\t\t\tlet parsedBody: unknown = errorBody;\n\t\t\ttry {\n\t\t\t\tconst json = JSON.parse(errorBody);\n\t\t\t\tparsedBody = json;\n\t\t\t\tconst err = json.error ?? json.message;\n\t\t\t\tif (typeof err === \"string\") {\n\t\t\t\t\tmessage = err;\n\t\t\t\t} else if (err && typeof err === \"object\") {\n\t\t\t\t\tmessage = JSON.stringify(err);\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\tif (errorBody) message = errorBody;\n\t\t\t}\n\t\t\tthrow new ApiError(response.status, message, parsedBody);\n\t\t}\n\n\t\tif (response.status === 204) {\n\t\t\treturn undefined as T;\n\t\t}\n\n\t\treturn response.json() as Promise<T>;\n\t}\n}\n",
|
|
7
7
|
"/**\n * Maps camelCase system column names (with or without `_` prefix) to the\n * actual snake_case DB column names used in query params.\n */\nconst SYSTEM_COLUMN_MAP: Record<string, string> = {\n\t// underscore-prefixed camelCase (canonical row shape)\n\t_blockHeight: \"_block_height\",\n\t_txId: \"_tx_id\",\n\t_createdAt: \"_created_at\",\n\t_id: \"_id\",\n\t// no-prefix aliases\n\tblockHeight: \"_block_height\",\n\ttxId: \"_tx_id\",\n\tcreatedAt: \"_created_at\",\n\tid: \"_id\",\n};\n\nfunction resolveColumn(col: string): string {\n\treturn SYSTEM_COLUMN_MAP[col] ?? col;\n}\n\n/**\n * Serializes a WhereInput object into the flat filter map expected by\n * SubgraphQueryParams.filters (and the REST API query string).\n *\n * Scalar values → `{ column: \"value\" }`\n * Comparison objects → `{ \"column.gte\": \"100\", \"column.lt\": \"200\" }`\n * System column aliases → `blockHeight` / `_blockHeight` both → `_block_height`\n */\nexport function serializeWhere(\n\twhere: Record<string, unknown>,\n): Record<string, string> {\n\tconst filters: Record<string, string> = {};\n\n\tfor (const [column, value] of Object.entries(where)) {\n\t\tif (value === null || value === undefined) continue;\n\n\t\tconst col = resolveColumn(column);\n\n\t\tif (typeof value === \"object\" && !Array.isArray(value)) {\n\t\t\tconst ops = value as Record<string, unknown>;\n\t\t\tfor (const [op, opValue] of Object.entries(ops)) {\n\t\t\t\tif (opValue === null || opValue === undefined) continue;\n\t\t\t\tif (op === \"eq\") {\n\t\t\t\t\tfilters[col] = String(opValue);\n\t\t\t\t} else if ([\"neq\", \"gt\", \"gte\", \"lt\", \"lte\"].includes(op)) {\n\t\t\t\t\tfilters[`${col}.${op}`] = String(opValue);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfilters[col] = String(value);\n\t\t}\n\t}\n\n\treturn filters;\n}\n\n/**\n * Resolves an orderBy column name (either alias or canonical) to the DB column name.\n */\nexport function resolveOrderByColumn(col: string): string {\n\treturn resolveColumn(col);\n}\n",
|
|
8
8
|
"import type {\n\tReindexResponse,\n\tSubgraphDetail,\n\tSubgraphGapsResponse,\n\tSubgraphQueryParams,\n\tSubgraphSummary,\n} from \"@secondlayer/shared/schemas\";\nimport type {\n\tDeploySubgraphRequest,\n\tDeploySubgraphResponse,\n} from \"@secondlayer/shared/schemas/subgraphs\";\nimport type {\n\tFindManyOptions,\n\tInferSubgraphClient,\n\tWhereInput,\n} from \"@secondlayer/subgraphs\";\nimport { BaseClient } from \"../base.ts\";\nimport { resolveOrderByColumn, serializeWhere } from \"./serialize.ts\";\n\nexport interface SubgraphSource {\n\tname: string;\n\tversion: string;\n\tsourceCode: string | null;\n\treadOnly: boolean;\n\treason?: string;\n\tupdatedAt: string;\n}\n\nexport interface BundleSubgraphResponse {\n\tok: true;\n\tname: string;\n\tversion: string | null;\n\tdescription: string | null;\n\tsources: Record<string, Record<string, unknown>>;\n\tschema: Record<string, unknown>;\n\thandlerCode: string;\n\tsourceCode: string;\n\tbundleSize: number;\n}\n\nfunction buildSubgraphQueryString(params: SubgraphQueryParams): string {\n\tconst qs = new URLSearchParams();\n\tif (params.sort) qs.set(\"_sort\", params.sort);\n\tif (params.order) qs.set(\"_order\", params.order);\n\tif (params.limit !== undefined) qs.set(\"_limit\", String(params.limit));\n\tif (params.offset !== undefined) qs.set(\"_offset\", String(params.offset));\n\tif (params.fields) qs.set(\"_fields\", params.fields);\n\tif (params.filters) {\n\t\tfor (const [key, value] of Object.entries(params.filters)) {\n\t\t\tqs.set(key, String(value));\n\t\t}\n\t}\n\tconst str = qs.toString();\n\treturn str ? `?${str}` : \"\";\n}\n\nexport class Subgraphs extends BaseClient {\n\tasync list(): Promise<{ data: SubgraphSummary[] }> {\n\t\treturn this.request<{ data: SubgraphSummary[] }>(\"GET\", \"/api/subgraphs\");\n\t}\n\n\tasync get(name: string): Promise<SubgraphDetail> {\n\t\treturn this.request<SubgraphDetail>(\"GET\", `/api/subgraphs/${name}`);\n\t}\n\n\tasync reindex(\n\t\tname: string,\n\t\toptions?: { fromBlock?: number; toBlock?: number },\n\t): Promise<ReindexResponse> {\n\t\treturn this.request<ReindexResponse>(\n\t\t\t\"POST\",\n\t\t\t`/api/subgraphs/${name}/reindex`,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tasync stop(name: string): Promise<{ message: string }> {\n\t\treturn this.request<{ message: string }>(\n\t\t\t\"POST\",\n\t\t\t`/api/subgraphs/${name}/stop`,\n\t\t);\n\t}\n\n\tasync backfill(\n\t\tname: string,\n\t\toptions: { fromBlock: number; toBlock: number },\n\t): Promise<ReindexResponse> {\n\t\treturn this.request<ReindexResponse>(\n\t\t\t\"POST\",\n\t\t\t`/api/subgraphs/${name}/backfill`,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tasync gaps(\n\t\tname: string,\n\t\topts?: { limit?: number; offset?: number; resolved?: boolean },\n\t): Promise<SubgraphGapsResponse> {\n\t\tconst qs = new URLSearchParams();\n\t\tif (opts?.limit !== undefined) qs.set(\"_limit\", String(opts.limit));\n\t\tif (opts?.offset !== undefined) qs.set(\"_offset\", String(opts.offset));\n\t\tif (opts?.resolved !== undefined) qs.set(\"resolved\", String(opts.resolved));\n\t\tconst query = qs.toString();\n\t\treturn this.request<SubgraphGapsResponse>(\n\t\t\t\"GET\",\n\t\t\t`/api/subgraphs/${name}/gaps${query ? `?${query}` : \"\"}`,\n\t\t);\n\t}\n\n\tasync delete(name: string): Promise<{ message: string }> {\n\t\treturn this.request<{ message: string }>(\n\t\t\t\"DELETE\",\n\t\t\t`/api/subgraphs/${name}`,\n\t\t);\n\t}\n\n\tasync deploy(data: DeploySubgraphRequest): Promise<DeploySubgraphResponse> {\n\t\treturn this.request<DeploySubgraphResponse>(\"POST\", \"/api/subgraphs\", data);\n\t}\n\n\tasync getSource(name: string): Promise<SubgraphSource> {\n\t\treturn this.request<SubgraphSource>(\"GET\", `/api/subgraphs/${name}/source`);\n\t}\n\n\t/**\n\t * Bundle a TypeScript subgraph source on the server. Used by the web chat\n\t * authoring loop so Vercel's serverless runtime doesn't have to run esbuild.\n\t */\n\tasync bundle(data: { code: string }): Promise<BundleSubgraphResponse> {\n\t\treturn this.request<BundleSubgraphResponse>(\n\t\t\t\"POST\",\n\t\t\t\"/api/subgraphs/bundle\",\n\t\t\tdata,\n\t\t);\n\t}\n\n\tasync queryTable(\n\t\tname: string,\n\t\ttable: string,\n\t\tparams: SubgraphQueryParams = {},\n\t): Promise<unknown[]> {\n\t\tconst result = await this.request<{ data: unknown[] } | unknown[]>(\n\t\t\t\"GET\",\n\t\t\t`/api/subgraphs/${name}/${table}${buildSubgraphQueryString(params)}`,\n\t\t);\n\t\treturn Array.isArray(result) ? result : result.data;\n\t}\n\n\tasync queryTableCount(\n\t\tname: string,\n\t\ttable: string,\n\t\tparams: SubgraphQueryParams = {},\n\t): Promise<{ count: number }> {\n\t\treturn this.request<{ count: number }>(\n\t\t\t\"GET\",\n\t\t\t`/api/subgraphs/${name}/${table}/count${buildSubgraphQueryString(params)}`,\n\t\t);\n\t}\n\n\t/**\n\t * Returns a typed client for a subgraph defined with `defineSubgraph()`.\n\t * Row types are inferred from the subgraph's schema literal types.\n\t *\n\t * @example\n\t * ```ts\n\t * import mySubgraph from './subgraphs/my-token-subgraph'\n\t * const client = sl.subgraphs.typed(mySubgraph)\n\t * const rows = await client.transfers.findMany({ where: { sender: 'SP...' } })\n\t * // rows: InferTableRow<typeof mySubgraph.schema.transfers>[]\n\t * ```\n\t */\n\ttyped<T extends { name: string; schema: Record<string, unknown> }>(\n\t\tdef: T,\n\t): InferSubgraphClient<T> {\n\t\tconst result: Record<string, unknown> = {};\n\n\t\tfor (const tableName of Object.keys(def.schema)) {\n\t\t\tresult[tableName] = this.createTableClient(def.name, tableName);\n\t\t}\n\n\t\treturn result as InferSubgraphClient<T>;\n\t}\n\n\tprivate createTableClient(subgraphName: string, tableName: string) {\n\t\tconst self = this;\n\n\t\treturn {\n\t\t\tasync findMany<TRow>(\n\t\t\t\toptions: FindManyOptions<TRow> = {},\n\t\t\t): Promise<TRow[]> {\n\t\t\t\tconst filters = options.where\n\t\t\t\t\t? serializeWhere(options.where as Record<string, unknown>)\n\t\t\t\t\t: undefined;\n\n\t\t\t\tlet sort: string | undefined;\n\t\t\t\tlet order: string | undefined;\n\t\t\t\tif (options.orderBy) {\n\t\t\t\t\tconst entries = Object.entries(options.orderBy) as [\n\t\t\t\t\t\tstring,\n\t\t\t\t\t\t\"asc\" | \"desc\",\n\t\t\t\t\t][];\n\t\t\t\t\tif (entries.length > 0) {\n\t\t\t\t\t\tif (entries.length > 1) {\n\t\t\t\t\t\t\tconst extra = entries\n\t\t\t\t\t\t\t\t.slice(1)\n\t\t\t\t\t\t\t\t.map(([col]) => col)\n\t\t\t\t\t\t\t\t.join(\", \");\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`orderBy supports only one column; remove extra keys: ${extra}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst [col, dir] = entries[0]!;\n\t\t\t\t\t\tsort = resolveOrderByColumn(col);\n\t\t\t\t\t\torder = dir ?? \"asc\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst params: SubgraphQueryParams = {\n\t\t\t\t\tsort,\n\t\t\t\t\torder,\n\t\t\t\t\tlimit: options.limit,\n\t\t\t\t\toffset: options.offset,\n\t\t\t\t\tfields: options.fields?.join(\",\"),\n\t\t\t\t\tfilters,\n\t\t\t\t};\n\n\t\t\t\treturn self.queryTable(subgraphName, tableName, params) as Promise<\n\t\t\t\t\tTRow[]\n\t\t\t\t>;\n\t\t\t},\n\n\t\t\tasync count<TRow>(where?: WhereInput<TRow>): Promise<number> {\n\t\t\t\tconst filters = where\n\t\t\t\t\t? serializeWhere(where as Record<string, unknown>)\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst result = await self.queryTableCount(subgraphName, tableName, {\n\t\t\t\t\tfilters,\n\t\t\t\t});\n\t\t\t\treturn result.count;\n\t\t\t},\n\t\t};\n\t}\n}\n",
|
|
9
|
-
"import
|
|
10
|
-
"import { BaseClient } from \"./base.ts\";\nimport type { SecondLayerOptions } from \"./base.ts\";\nimport { Subgraphs } from \"./subgraphs/client.ts\";\nimport { Workflows } from \"./workflows/client.ts\";\n\nexport class SecondLayer extends BaseClient {\n\treadonly subgraphs: Subgraphs;\n\treadonly workflows: Workflows;\n\n\tconstructor(options: Partial<SecondLayerOptions> = {}) {\n\t\tsuper(options);\n\t\tthis.subgraphs = new Subgraphs(options);\n\t\tthis.workflows = new Workflows(options);\n\t}\n}\n",
|
|
9
|
+
"import { BaseClient } from \"./base.ts\";\nimport type { SecondLayerOptions } from \"./base.ts\";\nimport { Subgraphs } from \"./subgraphs/client.ts\";\n\nexport class SecondLayer extends BaseClient {\n\treadonly subgraphs: Subgraphs;\n\n\tconstructor(options: Partial<SecondLayerOptions> = {}) {\n\t\tsuper(options);\n\t\tthis.subgraphs = new Subgraphs(options);\n\t}\n}\n",
|
|
11
10
|
"import type { InferSubgraphClient } from \"@secondlayer/subgraphs\";\nimport type { SecondLayerOptions } from \"../base.ts\";\nimport { SecondLayer } from \"../client.ts\";\nimport { Subgraphs } from \"./client.ts\";\n\n/**\n * Returns a typed client for a subgraph defined with `defineSubgraph()`.\n *\n * Accepts a plain options object, a `SecondLayer` instance, or a `Subgraphs` instance.\n *\n * @example\n * ```ts\n * import mySubgraph from './subgraphs/my-subgraph'\n * import { getSubgraph } from '@secondlayer/sdk'\n *\n * const client = getSubgraph(mySubgraph, { apiKey: 'sl_...' })\n * const rows = await client.transfers.findMany({ where: { sender: 'SP...' } })\n * ```\n */\nexport function getSubgraph<\n\tT extends { name: string; schema: Record<string, unknown> },\n>(\n\tdef: T,\n\toptions: Partial<SecondLayerOptions> | SecondLayer | Subgraphs = {},\n): InferSubgraphClient<T> {\n\tif (options instanceof Subgraphs) {\n\t\treturn options.typed(def);\n\t}\n\tif (options instanceof SecondLayer) {\n\t\treturn options.subgraphs.typed(def);\n\t}\n\treturn new Subgraphs(options).typed(def);\n}\n",
|
|
12
11
|
"import { verifySignatureHeader } from \"@secondlayer/shared/crypto/hmac\";\n\nexport { verifySignatureHeader };\n\n/**\n * Verify a webhook delivery signature from Secondlayer.\n *\n * Every delivery includes an `x-secondlayer-signature` header in the format\n * `t=<timestamp>,v1=<hmac>`. This function verifies the HMAC and checks\n * the timestamp is within the tolerance window (default 5 minutes).\n *\n * @param rawBody - The raw request body as a string (not parsed JSON)\n * @param signatureHeader - The value of the `x-secondlayer-signature` header\n * @param secret - Your signing secret\n * @param toleranceSeconds - Max age of signature in seconds (default 300)\n * @returns true if the signature is valid\n *\n * @example\n * ```ts\n * import { verifyWebhookSignature } from \"@secondlayer/sdk\";\n *\n * app.post(\"/webhook\", (req, res) => {\n * const sig = req.headers[\"x-secondlayer-signature\"];\n * const raw = JSON.stringify(req.body);\n * if (!verifyWebhookSignature(raw, sig, process.env.SIGNING_SECRET!)) {\n * return res.status(401).send(\"Invalid signature\");\n * }\n * // Process the event...\n * });\n * ```\n */\nexport function verifyWebhookSignature(\n\trawBody: string,\n\tsignatureHeader: string,\n\tsecret: string,\n\ttoleranceSeconds = 300,\n): boolean {\n\treturn verifySignatureHeader(\n\t\trawBody,\n\t\tsignatureHeader,\n\t\tsecret,\n\t\ttoleranceSeconds,\n\t);\n}\n"
|
|
13
12
|
],
|
|
14
|
-
"mappings": ";AAeO,MAAM,iBAAiB,MAAM;AAAA,EAG3B;AAAA,EAGA;AAAA,EALR,WAAW,CAEH,QACP,SAEO,MACN;AAAA,IACD,MAAM,OAAO;AAAA,IALN;AAAA,IAGA;AAAA,IAGP,KAAK,OAAO;AAAA;AAEd;AAAA;AAMO,MAAM,6BAA6B,SAAS;AAAA,EAE1C;AAAA,EACA;AAAA,EAFR,WAAW,CACH,gBACA,iBACP,UAAU,8BAA8B,4BAA4B,kBACnE;AAAA,IACD,MAAM,KAAK,SAAS,EAAE,gBAAgB,gBAAgB,CAAC;AAAA,IAJhD;AAAA,IACA;AAAA,IAIP,KAAK,OAAO;AAAA;AAEd;;;AC9BA,IAAM,mBAAmB;AAAA;AAElB,MAAe,WAAW;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EAEV,WAAW,CAAC,UAAuC,CAAC,GAAG;AAAA,IACtD,KAAK,WAAW,QAAQ,WAAW,kBAAkB,QAAQ,QAAQ,EAAE;AAAA,IACvE,KAAK,SAAS,QAAQ;AAAA,IACtB,KAAK,SAAS,QAAQ,UAAU;AAAA;AAAA,SAG1B,WAAW,CAAC,QAAyC;AAAA,IAC3D,MAAM,UAAkC;AAAA,MACvC,gBAAgB;AAAA,IACjB;AAAA,IACA,IAAI,QAAQ;AAAA,MACX,QAAQ,gBAAgB,UAAU;AAAA,IACnC;AAAA,IACA,OAAO;AAAA;AAAA,OAGQ,QAAU,CACzB,QACA,MACA,MACa;AAAA,IACb,MAAM,MAAM,GAAG,KAAK,UAAU;AAAA,IAC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