@secondlayer/sdk 2.0.0 → 3.0.0-beta.1
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 +67 -167
- package/dist/index.js +21 -136
- package/dist/index.js.map +5 -5
- package/dist/subgraphs/index.d.ts +66 -166
- package/dist/subgraphs/index.js +20 -136
- package/dist/subgraphs/index.js.map +5 -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,83 @@ declare class Subgraphs extends BaseClient {
|
|
|
92
92
|
private createTableClient;
|
|
93
93
|
}
|
|
94
94
|
import { InferSubgraphClient as InferSubgraphClient2 } from "@secondlayer/subgraphs";
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
sourceCode: string | null;
|
|
100
|
-
readOnly: boolean;
|
|
101
|
-
reason?: string;
|
|
102
|
-
updatedAt: string;
|
|
103
|
-
}
|
|
104
|
-
interface WorkflowStepEvent {
|
|
95
|
+
type SubscriptionStatus = "active" | "paused" | "error";
|
|
96
|
+
type SubscriptionFormat = "standard-webhooks" | "inngest" | "trigger" | "cloudflare" | "cloudevents" | "raw";
|
|
97
|
+
type SubscriptionRuntime = "inngest" | "trigger" | "cloudflare" | "node";
|
|
98
|
+
interface SubscriptionSummary {
|
|
105
99
|
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
100
|
name: string;
|
|
165
|
-
status:
|
|
166
|
-
|
|
101
|
+
status: SubscriptionStatus;
|
|
102
|
+
subgraphName: string;
|
|
103
|
+
tableName: string;
|
|
104
|
+
format: SubscriptionFormat;
|
|
105
|
+
runtime: SubscriptionRuntime | null;
|
|
106
|
+
url: string;
|
|
107
|
+
lastDeliveryAt: string | null;
|
|
108
|
+
lastSuccessAt: string | null;
|
|
167
109
|
createdAt: string;
|
|
168
110
|
updatedAt: string;
|
|
169
111
|
}
|
|
170
|
-
interface
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
interface
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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>;
|
|
112
|
+
interface SubscriptionDetail extends SubscriptionSummary {
|
|
113
|
+
filter: Record<string, unknown>;
|
|
114
|
+
authConfig: Record<string, unknown>;
|
|
115
|
+
maxRetries: number;
|
|
116
|
+
timeoutMs: number;
|
|
117
|
+
concurrency: number;
|
|
118
|
+
circuitFailures: number;
|
|
119
|
+
circuitOpenedAt: string | null;
|
|
120
|
+
lastError: string | null;
|
|
121
|
+
}
|
|
122
|
+
interface CreateSubscriptionRequest {
|
|
123
|
+
name: string;
|
|
124
|
+
subgraphName: string;
|
|
125
|
+
tableName: string;
|
|
126
|
+
url: string;
|
|
127
|
+
filter?: Record<string, unknown>;
|
|
128
|
+
format?: SubscriptionFormat;
|
|
129
|
+
runtime?: SubscriptionRuntime;
|
|
130
|
+
authConfig?: Record<string, unknown>;
|
|
131
|
+
maxRetries?: number;
|
|
132
|
+
timeoutMs?: number;
|
|
133
|
+
concurrency?: number;
|
|
134
|
+
}
|
|
135
|
+
interface CreateSubscriptionResponse {
|
|
136
|
+
subscription: SubscriptionDetail;
|
|
137
|
+
/** Plaintext signing secret — surfaced ONCE. Store it server-side. */
|
|
138
|
+
signingSecret: string;
|
|
139
|
+
}
|
|
140
|
+
interface UpdateSubscriptionRequest {
|
|
141
|
+
name?: string;
|
|
142
|
+
url?: string;
|
|
143
|
+
filter?: Record<string, unknown>;
|
|
144
|
+
format?: SubscriptionFormat;
|
|
145
|
+
runtime?: SubscriptionRuntime | null;
|
|
146
|
+
authConfig?: Record<string, unknown>;
|
|
147
|
+
maxRetries?: number;
|
|
148
|
+
timeoutMs?: number;
|
|
149
|
+
concurrency?: number;
|
|
150
|
+
}
|
|
151
|
+
interface RotateSecretResponse {
|
|
152
|
+
subscription: SubscriptionDetail;
|
|
153
|
+
signingSecret: string;
|
|
154
|
+
}
|
|
155
|
+
declare class Subscriptions extends BaseClient {
|
|
251
156
|
list(): Promise<{
|
|
252
|
-
|
|
157
|
+
data: SubscriptionSummary[]
|
|
253
158
|
}>;
|
|
254
|
-
get(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
listRuns(name: string, params?: {
|
|
262
|
-
status?: WorkflowRunStatus
|
|
263
|
-
limit?: number
|
|
264
|
-
}): Promise<{
|
|
265
|
-
runs: WorkflowRunSummary[]
|
|
159
|
+
get(id: string): Promise<SubscriptionDetail>;
|
|
160
|
+
create(input: CreateSubscriptionRequest): Promise<CreateSubscriptionResponse>;
|
|
161
|
+
update(id: string, patch: UpdateSubscriptionRequest): Promise<SubscriptionDetail>;
|
|
162
|
+
pause(id: string): Promise<SubscriptionDetail>;
|
|
163
|
+
resume(id: string): Promise<SubscriptionDetail>;
|
|
164
|
+
delete(id: string): Promise<{
|
|
165
|
+
ok: true
|
|
266
166
|
}>;
|
|
267
|
-
|
|
167
|
+
rotateSecret(id: string): Promise<RotateSecretResponse>;
|
|
268
168
|
}
|
|
269
169
|
declare class SecondLayer extends BaseClient {
|
|
270
170
|
readonly subgraphs: Subgraphs;
|
|
271
|
-
readonly
|
|
171
|
+
readonly subscriptions: Subscriptions;
|
|
272
172
|
constructor(options?: Partial<SecondLayerOptions>);
|
|
273
173
|
}
|
|
274
174
|
/**
|
|
@@ -348,4 +248,4 @@ declare class VersionConflictError extends ApiError {
|
|
|
348
248
|
* ```
|
|
349
249
|
*/
|
|
350
250
|
declare function verifyWebhookSignature(rawBody: string, signatureHeader: string, secret: string, toleranceSeconds?: number): boolean;
|
|
351
|
-
export { verifyWebhookSignature, getSubgraph, VersionConflictError, Subgraphs, SecondLayerOptions, SecondLayer, ApiError };
|
|
251
|
+
export { verifyWebhookSignature, getSubgraph, VersionConflictError, UpdateSubscriptionRequest, Subscriptions, SubscriptionSummary, SubscriptionStatus, SubscriptionRuntime, SubscriptionFormat, SubscriptionDetail, Subgraphs, SecondLayerOptions, SecondLayer, RotateSecretResponse, CreateSubscriptionResponse, CreateSubscriptionRequest, ApiError };
|
package/dist/index.js
CHANGED
|
@@ -248,158 +248,42 @@ class Subgraphs extends BaseClient {
|
|
|
248
248
|
};
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
// src/
|
|
252
|
-
|
|
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
|
-
}
|
|
251
|
+
// src/subscriptions/client.ts
|
|
252
|
+
class Subscriptions extends BaseClient {
|
|
363
253
|
async list() {
|
|
364
|
-
return this.request("GET", "/api/
|
|
254
|
+
return this.request("GET", "/api/subscriptions");
|
|
365
255
|
}
|
|
366
|
-
async get(
|
|
367
|
-
return this.request("GET", `/api/
|
|
256
|
+
async get(id) {
|
|
257
|
+
return this.request("GET", `/api/subscriptions/${id}`);
|
|
368
258
|
}
|
|
369
|
-
async
|
|
370
|
-
return this.request("POST",
|
|
259
|
+
async create(input) {
|
|
260
|
+
return this.request("POST", "/api/subscriptions", input);
|
|
371
261
|
}
|
|
372
|
-
async
|
|
373
|
-
return this.request("
|
|
262
|
+
async update(id, patch) {
|
|
263
|
+
return this.request("PATCH", `/api/subscriptions/${id}`, patch);
|
|
374
264
|
}
|
|
375
|
-
async
|
|
376
|
-
return this.request("POST", `/api/
|
|
265
|
+
async pause(id) {
|
|
266
|
+
return this.request("POST", `/api/subscriptions/${id}/pause`);
|
|
377
267
|
}
|
|
378
|
-
async
|
|
379
|
-
return this.request("
|
|
268
|
+
async resume(id) {
|
|
269
|
+
return this.request("POST", `/api/subscriptions/${id}/resume`);
|
|
380
270
|
}
|
|
381
|
-
async
|
|
382
|
-
|
|
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}` : ""}`);
|
|
271
|
+
async delete(id) {
|
|
272
|
+
return this.request("DELETE", `/api/subscriptions/${id}`);
|
|
389
273
|
}
|
|
390
|
-
async
|
|
391
|
-
return this.request("
|
|
274
|
+
async rotateSecret(id) {
|
|
275
|
+
return this.request("POST", `/api/subscriptions/${id}/rotate-secret`);
|
|
392
276
|
}
|
|
393
277
|
}
|
|
394
278
|
|
|
395
279
|
// src/client.ts
|
|
396
280
|
class SecondLayer extends BaseClient {
|
|
397
281
|
subgraphs;
|
|
398
|
-
|
|
282
|
+
subscriptions;
|
|
399
283
|
constructor(options = {}) {
|
|
400
284
|
super(options);
|
|
401
285
|
this.subgraphs = new Subgraphs(options);
|
|
402
|
-
this.
|
|
286
|
+
this.subscriptions = new Subscriptions(options);
|
|
403
287
|
}
|
|
404
288
|
}
|
|
405
289
|
|
|
@@ -422,10 +306,11 @@ export {
|
|
|
422
306
|
verifyWebhookSignature,
|
|
423
307
|
getSubgraph,
|
|
424
308
|
VersionConflictError,
|
|
309
|
+
Subscriptions,
|
|
425
310
|
Subgraphs,
|
|
426
311
|
SecondLayer,
|
|
427
312
|
ApiError
|
|
428
313
|
};
|
|
429
314
|
|
|
430
|
-
//# debugId=
|
|
315
|
+
//# debugId=8D5F53ED0AC865AD64756E2164756E21
|
|
431
316
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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/subscriptions/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 {
|
|
9
|
+
"import { BaseClient } from \"../base.ts\";\n\nexport type SubscriptionStatus = \"active\" | \"paused\" | \"error\";\nexport type SubscriptionFormat =\n\t| \"standard-webhooks\"\n\t| \"inngest\"\n\t| \"trigger\"\n\t| \"cloudflare\"\n\t| \"cloudevents\"\n\t| \"raw\";\nexport type SubscriptionRuntime = \"inngest\" | \"trigger\" | \"cloudflare\" | \"node\";\n\nexport interface SubscriptionSummary {\n\tid: string;\n\tname: string;\n\tstatus: SubscriptionStatus;\n\tsubgraphName: string;\n\ttableName: string;\n\tformat: SubscriptionFormat;\n\truntime: SubscriptionRuntime | null;\n\turl: string;\n\tlastDeliveryAt: string | null;\n\tlastSuccessAt: string | null;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface SubscriptionDetail extends SubscriptionSummary {\n\tfilter: Record<string, unknown>;\n\tauthConfig: Record<string, unknown>;\n\tmaxRetries: number;\n\ttimeoutMs: number;\n\tconcurrency: number;\n\tcircuitFailures: number;\n\tcircuitOpenedAt: string | null;\n\tlastError: string | null;\n}\n\nexport interface CreateSubscriptionRequest {\n\tname: string;\n\tsubgraphName: string;\n\ttableName: string;\n\turl: string;\n\tfilter?: Record<string, unknown>;\n\tformat?: SubscriptionFormat;\n\truntime?: SubscriptionRuntime;\n\tauthConfig?: Record<string, unknown>;\n\tmaxRetries?: number;\n\ttimeoutMs?: number;\n\tconcurrency?: number;\n}\n\nexport interface CreateSubscriptionResponse {\n\tsubscription: SubscriptionDetail;\n\t/** Plaintext signing secret — surfaced ONCE. Store it server-side. */\n\tsigningSecret: string;\n}\n\nexport interface UpdateSubscriptionRequest {\n\tname?: string;\n\turl?: string;\n\tfilter?: Record<string, unknown>;\n\tformat?: SubscriptionFormat;\n\truntime?: SubscriptionRuntime | null;\n\tauthConfig?: Record<string, unknown>;\n\tmaxRetries?: number;\n\ttimeoutMs?: number;\n\tconcurrency?: number;\n}\n\nexport interface RotateSecretResponse {\n\tsubscription: SubscriptionDetail;\n\tsigningSecret: string;\n}\n\nexport class Subscriptions extends BaseClient {\n\tasync list(): Promise<{ data: SubscriptionSummary[] }> {\n\t\treturn this.request<{ data: SubscriptionSummary[] }>(\n\t\t\t\"GET\",\n\t\t\t\"/api/subscriptions\",\n\t\t);\n\t}\n\n\tasync get(id: string): Promise<SubscriptionDetail> {\n\t\treturn this.request<SubscriptionDetail>(\"GET\", `/api/subscriptions/${id}`);\n\t}\n\n\tasync create(\n\t\tinput: CreateSubscriptionRequest,\n\t): Promise<CreateSubscriptionResponse> {\n\t\treturn this.request<CreateSubscriptionResponse>(\n\t\t\t\"POST\",\n\t\t\t\"/api/subscriptions\",\n\t\t\tinput,\n\t\t);\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\tpatch: UpdateSubscriptionRequest,\n\t): Promise<SubscriptionDetail> {\n\t\treturn this.request<SubscriptionDetail>(\n\t\t\t\"PATCH\",\n\t\t\t`/api/subscriptions/${id}`,\n\t\t\tpatch,\n\t\t);\n\t}\n\n\tasync pause(id: string): Promise<SubscriptionDetail> {\n\t\treturn this.request<SubscriptionDetail>(\n\t\t\t\"POST\",\n\t\t\t`/api/subscriptions/${id}/pause`,\n\t\t);\n\t}\n\n\tasync resume(id: string): Promise<SubscriptionDetail> {\n\t\treturn this.request<SubscriptionDetail>(\n\t\t\t\"POST\",\n\t\t\t`/api/subscriptions/${id}/resume`,\n\t\t);\n\t}\n\n\tasync delete(id: string): Promise<{ ok: true }> {\n\t\treturn this.request<{ ok: true }>(\"DELETE\", `/api/subscriptions/${id}`);\n\t}\n\n\tasync rotateSecret(id: string): Promise<RotateSecretResponse> {\n\t\treturn this.request<RotateSecretResponse>(\n\t\t\t\"POST\",\n\t\t\t`/api/subscriptions/${id}/rotate-secret`,\n\t\t);\n\t}\n}\n",
|
|
10
|
+
"import { BaseClient } from \"./base.ts\";\nimport type { SecondLayerOptions } from \"./base.ts\";\nimport { Subgraphs } from \"./subgraphs/client.ts\";\nimport { Subscriptions } from \"./subscriptions/client.ts\";\n\nexport class SecondLayer extends BaseClient {\n\treadonly subgraphs: Subgraphs;\n\treadonly subscriptions: Subscriptions;\n\n\tconstructor(options: Partial<SecondLayerOptions> = {}) {\n\t\tsuper(options);\n\t\tthis.subgraphs = new Subgraphs(options);\n\t\tthis.subscriptions = new Subscriptions(options);\n\t}\n}\n",
|
|
11
11
|
"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
12
|
"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
13
|
],
|
|
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,gBA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