@secondlayer/shared 4.3.4 → 4.4.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/dist/src/index.d.ts +50 -1
- package/dist/src/index.js +347 -1
- package/dist/src/index.js.map +5 -4
- package/dist/src/schemas/index.d.ts +9 -0
- package/dist/src/schemas/index.js.map +1 -1
- package/dist/src/schemas/subgraphs.d.ts +9 -0
- package/dist/src/schemas/subgraphs.js.map +1 -1
- package/dist/src/subgraphs/spec.d.ts +104 -0
- package/dist/src/subgraphs/spec.js +366 -0
- package/dist/src/subgraphs/spec.js.map +10 -0
- package/package.json +5 -1
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/subgraphs/spec.ts
|
|
18
|
+
var SYSTEM_COLUMNS = ["_id", "_block_height", "_tx_id", "_created_at"];
|
|
19
|
+
var BASE_QUERY_PARAMS = ["_limit", "_offset", "_sort", "_order", "_fields"];
|
|
20
|
+
var COMPARISON_OPS = ["neq", "gt", "gte", "lt", "lte"];
|
|
21
|
+
function generatedAt(options) {
|
|
22
|
+
return options.generatedAt ?? new Date().toISOString();
|
|
23
|
+
}
|
|
24
|
+
function normalizeServerUrl(serverUrl) {
|
|
25
|
+
return (serverUrl ?? "https://api.secondlayer.tools").replace(/\/+$/, "");
|
|
26
|
+
}
|
|
27
|
+
function tablePath(subgraphName, tableName) {
|
|
28
|
+
return `/api/subgraphs/${subgraphName}/${tableName}`;
|
|
29
|
+
}
|
|
30
|
+
function countPath(subgraphName, tableName) {
|
|
31
|
+
return `${tablePath(subgraphName, tableName)}/count`;
|
|
32
|
+
}
|
|
33
|
+
function isTextLike(type) {
|
|
34
|
+
return type === "text" || type === "principal" || type === "timestamp";
|
|
35
|
+
}
|
|
36
|
+
function isComparable(type) {
|
|
37
|
+
return type === "uint" || type === "int" || type === "bigint" || type === "serial" || type === "timestamp";
|
|
38
|
+
}
|
|
39
|
+
function exampleForColumn(type) {
|
|
40
|
+
switch (type) {
|
|
41
|
+
case "uint":
|
|
42
|
+
case "int":
|
|
43
|
+
case "bigint":
|
|
44
|
+
return "1000";
|
|
45
|
+
case "serial":
|
|
46
|
+
return 1;
|
|
47
|
+
case "principal":
|
|
48
|
+
return "SP000000000000000000002Q6VF78";
|
|
49
|
+
case "timestamp":
|
|
50
|
+
return "2026-01-01T00:00:00.000Z";
|
|
51
|
+
case "boolean":
|
|
52
|
+
return true;
|
|
53
|
+
case "jsonb":
|
|
54
|
+
return { example: true };
|
|
55
|
+
default:
|
|
56
|
+
return "example";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function openApiSchemaForColumn(col) {
|
|
60
|
+
let schema;
|
|
61
|
+
switch (col.type) {
|
|
62
|
+
case "uint":
|
|
63
|
+
case "int":
|
|
64
|
+
case "bigint":
|
|
65
|
+
schema = { type: "string", pattern: "^-?\\d+(\\.\\d+)?$" };
|
|
66
|
+
break;
|
|
67
|
+
case "serial":
|
|
68
|
+
schema = { type: "integer" };
|
|
69
|
+
break;
|
|
70
|
+
case "principal":
|
|
71
|
+
case "text":
|
|
72
|
+
schema = { type: "string" };
|
|
73
|
+
break;
|
|
74
|
+
case "timestamp":
|
|
75
|
+
schema = { type: "string", format: "date-time" };
|
|
76
|
+
break;
|
|
77
|
+
case "boolean":
|
|
78
|
+
schema = { type: "boolean" };
|
|
79
|
+
break;
|
|
80
|
+
case "jsonb":
|
|
81
|
+
schema = { type: "object", additionalProperties: true };
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
schema = {};
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (col.nullable) {
|
|
88
|
+
const type = schema.type;
|
|
89
|
+
if (typeof type === "string")
|
|
90
|
+
schema.type = [type, "null"];
|
|
91
|
+
}
|
|
92
|
+
return schema;
|
|
93
|
+
}
|
|
94
|
+
function columnEntries(table) {
|
|
95
|
+
return Object.entries(table.columns);
|
|
96
|
+
}
|
|
97
|
+
function selectableColumns(table) {
|
|
98
|
+
return columnEntries(table).map(([name]) => name);
|
|
99
|
+
}
|
|
100
|
+
function searchableColumns(table) {
|
|
101
|
+
return columnEntries(table).filter(([, col]) => col.searchable).map(([name]) => name);
|
|
102
|
+
}
|
|
103
|
+
function filterNames(table) {
|
|
104
|
+
const result = [];
|
|
105
|
+
for (const [name, col] of columnEntries(table)) {
|
|
106
|
+
result.push(name);
|
|
107
|
+
result.push(`${name}.neq`);
|
|
108
|
+
if (isComparable(col.type)) {
|
|
109
|
+
for (const op of COMPARISON_OPS.filter((op2) => op2 !== "neq")) {
|
|
110
|
+
result.push(`${name}.${op}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (isTextLike(col.type))
|
|
114
|
+
result.push(`${name}.like`);
|
|
115
|
+
}
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
function queryParameters(table) {
|
|
119
|
+
const params = [...BASE_QUERY_PARAMS];
|
|
120
|
+
if (searchableColumns(table).length > 0)
|
|
121
|
+
params.push("_search");
|
|
122
|
+
return params;
|
|
123
|
+
}
|
|
124
|
+
function rowExample(table) {
|
|
125
|
+
const row = {};
|
|
126
|
+
for (const [name, col] of columnEntries(table)) {
|
|
127
|
+
row[name] = exampleForColumn(col.type);
|
|
128
|
+
}
|
|
129
|
+
return row;
|
|
130
|
+
}
|
|
131
|
+
function openApiParameter(name, description, schema = { type: "string" }) {
|
|
132
|
+
return {
|
|
133
|
+
name,
|
|
134
|
+
in: "query",
|
|
135
|
+
required: false,
|
|
136
|
+
description,
|
|
137
|
+
schema
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function tableParameters(table) {
|
|
141
|
+
const parameters = [
|
|
142
|
+
openApiParameter("_limit", "Maximum rows to return.", {
|
|
143
|
+
type: "integer",
|
|
144
|
+
default: 50,
|
|
145
|
+
minimum: 1,
|
|
146
|
+
maximum: 1000
|
|
147
|
+
}),
|
|
148
|
+
openApiParameter("_offset", "Rows to skip for pagination.", {
|
|
149
|
+
type: "integer",
|
|
150
|
+
default: 0,
|
|
151
|
+
minimum: 0
|
|
152
|
+
}),
|
|
153
|
+
openApiParameter("_sort", "Column to sort by.", {
|
|
154
|
+
type: "string",
|
|
155
|
+
enum: selectableColumns(table)
|
|
156
|
+
}),
|
|
157
|
+
openApiParameter("_order", "Sort direction.", {
|
|
158
|
+
type: "string",
|
|
159
|
+
enum: ["asc", "desc"],
|
|
160
|
+
default: "asc"
|
|
161
|
+
}),
|
|
162
|
+
openApiParameter("_fields", "Comma-separated columns to include.", {
|
|
163
|
+
type: "string"
|
|
164
|
+
})
|
|
165
|
+
];
|
|
166
|
+
if (searchableColumns(table).length > 0) {
|
|
167
|
+
parameters.push(openApiParameter("_search", "Search across searchable columns.", {
|
|
168
|
+
type: "string"
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
for (const [name, col] of columnEntries(table)) {
|
|
172
|
+
parameters.push(openApiParameter(name, `Filter ${name} by equality.`, {
|
|
173
|
+
type: "string"
|
|
174
|
+
}));
|
|
175
|
+
parameters.push(openApiParameter(`${name}.neq`, `Filter ${name} by inequality.`, {
|
|
176
|
+
type: "string"
|
|
177
|
+
}));
|
|
178
|
+
if (isComparable(col.type)) {
|
|
179
|
+
for (const op of ["gt", "gte", "lt", "lte"]) {
|
|
180
|
+
parameters.push(openApiParameter(`${name}.${op}`, `Filter ${name} with ${op}.`, {
|
|
181
|
+
type: "string"
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (isTextLike(col.type)) {
|
|
186
|
+
parameters.push(openApiParameter(`${name}.like`, `Case-insensitive contains filter for ${name}.`, {
|
|
187
|
+
type: "string"
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return parameters;
|
|
192
|
+
}
|
|
193
|
+
function generateSubgraphAgentSchema(detail, options = {}) {
|
|
194
|
+
const serverUrl = normalizeServerUrl(options.serverUrl);
|
|
195
|
+
const tables = {};
|
|
196
|
+
for (const [tableName, table] of Object.entries(detail.tables)) {
|
|
197
|
+
const path = tablePath(detail.name, tableName);
|
|
198
|
+
tables[tableName] = {
|
|
199
|
+
endpoint: `${serverUrl}${path}`,
|
|
200
|
+
countEndpoint: `${serverUrl}${countPath(detail.name, tableName)}`,
|
|
201
|
+
rowCount: table.rowCount,
|
|
202
|
+
columns: table.columns,
|
|
203
|
+
...table.indexes ? { indexes: table.indexes } : {},
|
|
204
|
+
...table.uniqueKeys ? { uniqueKeys: table.uniqueKeys } : {},
|
|
205
|
+
query: {
|
|
206
|
+
parameters: queryParameters(table),
|
|
207
|
+
sortable: selectableColumns(table),
|
|
208
|
+
selectable: selectableColumns(table),
|
|
209
|
+
searchable: searchableColumns(table),
|
|
210
|
+
filters: filterNames(table)
|
|
211
|
+
},
|
|
212
|
+
examples: {
|
|
213
|
+
list: rowExample(table),
|
|
214
|
+
count: { count: table.rowCount },
|
|
215
|
+
curl: `curl '${serverUrl}${path}?_limit=10&_sort=_block_height&_order=desc'`
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
name: detail.name,
|
|
221
|
+
version: detail.version,
|
|
222
|
+
...detail.description ? { description: detail.description } : {},
|
|
223
|
+
...detail.schemaHash ? { schemaHash: detail.schemaHash } : {},
|
|
224
|
+
generatedAt: generatedAt(options),
|
|
225
|
+
serverUrl,
|
|
226
|
+
...detail.sources ? { sources: detail.sources } : {},
|
|
227
|
+
tables
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function generateSubgraphOpenApi(detail, options = {}) {
|
|
231
|
+
const serverUrl = normalizeServerUrl(options.serverUrl);
|
|
232
|
+
const paths = {};
|
|
233
|
+
const schemas = {};
|
|
234
|
+
for (const [tableName, table] of Object.entries(detail.tables)) {
|
|
235
|
+
const schemaName = `${tableName}Row`;
|
|
236
|
+
const properties = {};
|
|
237
|
+
const required = [];
|
|
238
|
+
for (const [columnName, column] of columnEntries(table)) {
|
|
239
|
+
properties[columnName] = openApiSchemaForColumn(column);
|
|
240
|
+
if (!column.nullable)
|
|
241
|
+
required.push(columnName);
|
|
242
|
+
}
|
|
243
|
+
schemas[schemaName] = {
|
|
244
|
+
type: "object",
|
|
245
|
+
properties,
|
|
246
|
+
required,
|
|
247
|
+
example: rowExample(table)
|
|
248
|
+
};
|
|
249
|
+
paths[tablePath(detail.name, tableName)] = {
|
|
250
|
+
get: {
|
|
251
|
+
summary: `Query ${detail.name}.${tableName}`,
|
|
252
|
+
operationId: `query_${detail.name.replace(/-/g, "_")}_${tableName}`,
|
|
253
|
+
parameters: tableParameters(table),
|
|
254
|
+
responses: {
|
|
255
|
+
"200": {
|
|
256
|
+
description: "Rows returned from the subgraph table.",
|
|
257
|
+
content: {
|
|
258
|
+
"application/json": {
|
|
259
|
+
schema: {
|
|
260
|
+
type: "object",
|
|
261
|
+
properties: {
|
|
262
|
+
data: {
|
|
263
|
+
type: "array",
|
|
264
|
+
items: { $ref: `#/components/schemas/${schemaName}` }
|
|
265
|
+
},
|
|
266
|
+
meta: {
|
|
267
|
+
type: "object",
|
|
268
|
+
properties: {
|
|
269
|
+
total: { type: "integer" },
|
|
270
|
+
limit: { type: "integer" },
|
|
271
|
+
offset: { type: "integer" }
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
paths[countPath(detail.name, tableName)] = {
|
|
283
|
+
get: {
|
|
284
|
+
summary: `Count ${detail.name}.${tableName}`,
|
|
285
|
+
operationId: `count_${detail.name.replace(/-/g, "_")}_${tableName}`,
|
|
286
|
+
parameters: tableParameters(table),
|
|
287
|
+
responses: {
|
|
288
|
+
"200": {
|
|
289
|
+
description: "Row count for the filtered table query.",
|
|
290
|
+
content: {
|
|
291
|
+
"application/json": {
|
|
292
|
+
schema: {
|
|
293
|
+
type: "object",
|
|
294
|
+
properties: { count: { type: "integer" } },
|
|
295
|
+
required: ["count"],
|
|
296
|
+
example: { count: table.rowCount }
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
openapi: "3.1.0",
|
|
307
|
+
info: {
|
|
308
|
+
title: `${detail.name} Subgraph API`,
|
|
309
|
+
version: detail.version,
|
|
310
|
+
...detail.description ? { description: detail.description } : {}
|
|
311
|
+
},
|
|
312
|
+
servers: [{ url: serverUrl }],
|
|
313
|
+
paths,
|
|
314
|
+
components: { schemas },
|
|
315
|
+
"x-secondlayer-subgraph": detail.name,
|
|
316
|
+
"x-secondlayer-version": detail.version,
|
|
317
|
+
"x-secondlayer-schema-hash": detail.schemaHash,
|
|
318
|
+
"x-secondlayer-generated-at": generatedAt(options),
|
|
319
|
+
"x-secondlayer-sources": detail.sources ?? {},
|
|
320
|
+
"x-secondlayer-tables": Object.keys(detail.tables)
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function generateSubgraphMarkdown(detail, options = {}) {
|
|
324
|
+
const agent = generateSubgraphAgentSchema(detail, options);
|
|
325
|
+
const lines = [
|
|
326
|
+
`# ${detail.name} Subgraph API`,
|
|
327
|
+
"",
|
|
328
|
+
`Version: ${detail.version}`,
|
|
329
|
+
detail.schemaHash ? `Schema hash: ${detail.schemaHash}` : undefined,
|
|
330
|
+
`Server: ${agent.serverUrl}`,
|
|
331
|
+
"",
|
|
332
|
+
detail.description
|
|
333
|
+
].filter((line) => line !== undefined && line !== "");
|
|
334
|
+
for (const [tableName, table] of Object.entries(agent.tables)) {
|
|
335
|
+
lines.push("", `## ${tableName}`, "", `GET ${table.endpoint}`, `GET ${table.countEndpoint}`, "", `Rows: ${table.rowCount}`, "", "### Columns", "", "| Column | Type | Attributes |", "| --- | --- | --- |");
|
|
336
|
+
for (const [columnName, col] of Object.entries(table.columns)) {
|
|
337
|
+
const attrs = [
|
|
338
|
+
SYSTEM_COLUMNS.includes(columnName) ? "system" : undefined,
|
|
339
|
+
col.nullable ? "nullable" : undefined,
|
|
340
|
+
col.indexed ? "indexed" : undefined,
|
|
341
|
+
col.searchable ? "searchable" : undefined
|
|
342
|
+
].filter(Boolean).join(", ");
|
|
343
|
+
lines.push(`| \`${columnName}\` | \`${col.type}\` | ${attrs || "-"} |`);
|
|
344
|
+
}
|
|
345
|
+
lines.push("", "### Query", "", `Parameters: ${table.query.parameters.map((p) => `\`${p}\``).join(", ")}`, `Filters: ${table.query.filters.map((p) => `\`${p}\``).join(", ")}`, "", "### Example", "", "```bash", table.examples.curl, "```");
|
|
346
|
+
}
|
|
347
|
+
return `${lines.join(`
|
|
348
|
+
`)}
|
|
349
|
+
`;
|
|
350
|
+
}
|
|
351
|
+
function generateSubgraphSpec(detail, format, options = {}) {
|
|
352
|
+
if (format === "openapi")
|
|
353
|
+
return generateSubgraphOpenApi(detail, options);
|
|
354
|
+
if (format === "agent")
|
|
355
|
+
return generateSubgraphAgentSchema(detail, options);
|
|
356
|
+
return generateSubgraphMarkdown(detail, options);
|
|
357
|
+
}
|
|
358
|
+
export {
|
|
359
|
+
generateSubgraphSpec,
|
|
360
|
+
generateSubgraphOpenApi,
|
|
361
|
+
generateSubgraphMarkdown,
|
|
362
|
+
generateSubgraphAgentSchema
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
//# debugId=A3421FBB41B33DFB64756E2164756E21
|
|
366
|
+
//# sourceMappingURL=spec.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/subgraphs/spec.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { SubgraphDetail } from \"../schemas/subgraphs.ts\";\n\nexport type SubgraphSpecFormat = \"openapi\" | \"agent\" | \"markdown\";\n\nexport interface SubgraphSpecOptions {\n\tserverUrl?: string;\n\tgeneratedAt?: string;\n}\n\nexport interface SubgraphAgentSchema {\n\tname: string;\n\tversion: string;\n\tdescription?: string;\n\tschemaHash?: string;\n\tgeneratedAt: string;\n\tserverUrl: string;\n\tsources?: Record<string, unknown>;\n\ttables: Record<\n\t\tstring,\n\t\t{\n\t\t\tendpoint: string;\n\t\t\tcountEndpoint: string;\n\t\t\trowCount: number;\n\t\t\tcolumns: SubgraphDetail[\"tables\"][string][\"columns\"];\n\t\t\tindexes?: string[][];\n\t\t\tuniqueKeys?: string[][];\n\t\t\tquery: {\n\t\t\t\tparameters: string[];\n\t\t\t\tsortable: string[];\n\t\t\t\tselectable: string[];\n\t\t\t\tsearchable: string[];\n\t\t\t\tfilters: string[];\n\t\t\t};\n\t\t\texamples: {\n\t\t\t\tlist: Record<string, unknown>;\n\t\t\t\tcount: { count: number };\n\t\t\t\tcurl: string;\n\t\t\t};\n\t\t}\n\t>;\n}\n\ntype ColumnMeta = SubgraphDetail[\"tables\"][string][\"columns\"][string];\n\nconst SYSTEM_COLUMNS = [\"_id\", \"_block_height\", \"_tx_id\", \"_created_at\"];\nconst BASE_QUERY_PARAMS = [\"_limit\", \"_offset\", \"_sort\", \"_order\", \"_fields\"];\nconst COMPARISON_OPS = [\"neq\", \"gt\", \"gte\", \"lt\", \"lte\"];\n\nfunction generatedAt(options: SubgraphSpecOptions): string {\n\treturn options.generatedAt ?? new Date().toISOString();\n}\n\nfunction normalizeServerUrl(serverUrl?: string): string {\n\treturn (serverUrl ?? \"https://api.secondlayer.tools\").replace(/\\/+$/, \"\");\n}\n\nfunction tablePath(subgraphName: string, tableName: string): string {\n\treturn `/api/subgraphs/${subgraphName}/${tableName}`;\n}\n\nfunction countPath(subgraphName: string, tableName: string): string {\n\treturn `${tablePath(subgraphName, tableName)}/count`;\n}\n\nfunction isTextLike(type: string): boolean {\n\treturn type === \"text\" || type === \"principal\" || type === \"timestamp\";\n}\n\nfunction isComparable(type: string): boolean {\n\treturn (\n\t\ttype === \"uint\" ||\n\t\ttype === \"int\" ||\n\t\ttype === \"bigint\" ||\n\t\ttype === \"serial\" ||\n\t\ttype === \"timestamp\"\n\t);\n}\n\nfunction exampleForColumn(type: string): unknown {\n\tswitch (type) {\n\t\tcase \"uint\":\n\t\tcase \"int\":\n\t\tcase \"bigint\":\n\t\t\treturn \"1000\";\n\t\tcase \"serial\":\n\t\t\treturn 1;\n\t\tcase \"principal\":\n\t\t\treturn \"SP000000000000000000002Q6VF78\";\n\t\tcase \"timestamp\":\n\t\t\treturn \"2026-01-01T00:00:00.000Z\";\n\t\tcase \"boolean\":\n\t\t\treturn true;\n\t\tcase \"jsonb\":\n\t\t\treturn { example: true };\n\t\tdefault:\n\t\t\treturn \"example\";\n\t}\n}\n\nfunction openApiSchemaForColumn(col: ColumnMeta): Record<string, unknown> {\n\tlet schema: Record<string, unknown>;\n\tswitch (col.type) {\n\t\tcase \"uint\":\n\t\tcase \"int\":\n\t\tcase \"bigint\":\n\t\t\tschema = { type: \"string\", pattern: \"^-?\\\\d+(\\\\.\\\\d+)?$\" };\n\t\t\tbreak;\n\t\tcase \"serial\":\n\t\t\tschema = { type: \"integer\" };\n\t\t\tbreak;\n\t\tcase \"principal\":\n\t\tcase \"text\":\n\t\t\tschema = { type: \"string\" };\n\t\t\tbreak;\n\t\tcase \"timestamp\":\n\t\t\tschema = { type: \"string\", format: \"date-time\" };\n\t\t\tbreak;\n\t\tcase \"boolean\":\n\t\t\tschema = { type: \"boolean\" };\n\t\t\tbreak;\n\t\tcase \"jsonb\":\n\t\t\tschema = { type: \"object\", additionalProperties: true };\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tschema = {};\n\t\t\tbreak;\n\t}\n\tif (col.nullable) {\n\t\tconst type = schema.type;\n\t\tif (typeof type === \"string\") schema.type = [type, \"null\"];\n\t}\n\treturn schema;\n}\n\nfunction columnEntries(table: SubgraphDetail[\"tables\"][string]) {\n\treturn Object.entries(table.columns);\n}\n\nfunction selectableColumns(table: SubgraphDetail[\"tables\"][string]): string[] {\n\treturn columnEntries(table).map(([name]) => name);\n}\n\nfunction searchableColumns(table: SubgraphDetail[\"tables\"][string]): string[] {\n\treturn columnEntries(table)\n\t\t.filter(([, col]) => col.searchable)\n\t\t.map(([name]) => name);\n}\n\nfunction filterNames(table: SubgraphDetail[\"tables\"][string]): string[] {\n\tconst result: string[] = [];\n\tfor (const [name, col] of columnEntries(table)) {\n\t\tresult.push(name);\n\t\tresult.push(`${name}.neq`);\n\t\tif (isComparable(col.type)) {\n\t\t\tfor (const op of COMPARISON_OPS.filter((op) => op !== \"neq\")) {\n\t\t\t\tresult.push(`${name}.${op}`);\n\t\t\t}\n\t\t}\n\t\tif (isTextLike(col.type)) result.push(`${name}.like`);\n\t}\n\treturn result;\n}\n\nfunction queryParameters(table: SubgraphDetail[\"tables\"][string]): string[] {\n\tconst params = [...BASE_QUERY_PARAMS];\n\tif (searchableColumns(table).length > 0) params.push(\"_search\");\n\treturn params;\n}\n\nfunction rowExample(table: SubgraphDetail[\"tables\"][string]) {\n\tconst row: Record<string, unknown> = {};\n\tfor (const [name, col] of columnEntries(table)) {\n\t\trow[name] = exampleForColumn(col.type);\n\t}\n\treturn row;\n}\n\nfunction openApiParameter(\n\tname: string,\n\tdescription: string,\n\tschema: Record<string, unknown> = { type: \"string\" },\n) {\n\treturn {\n\t\tname,\n\t\tin: \"query\",\n\t\trequired: false,\n\t\tdescription,\n\t\tschema,\n\t};\n}\n\nfunction tableParameters(table: SubgraphDetail[\"tables\"][string]) {\n\tconst parameters = [\n\t\topenApiParameter(\"_limit\", \"Maximum rows to return.\", {\n\t\t\ttype: \"integer\",\n\t\t\tdefault: 50,\n\t\t\tminimum: 1,\n\t\t\tmaximum: 1000,\n\t\t}),\n\t\topenApiParameter(\"_offset\", \"Rows to skip for pagination.\", {\n\t\t\ttype: \"integer\",\n\t\t\tdefault: 0,\n\t\t\tminimum: 0,\n\t\t}),\n\t\topenApiParameter(\"_sort\", \"Column to sort by.\", {\n\t\t\ttype: \"string\",\n\t\t\tenum: selectableColumns(table),\n\t\t}),\n\t\topenApiParameter(\"_order\", \"Sort direction.\", {\n\t\t\ttype: \"string\",\n\t\t\tenum: [\"asc\", \"desc\"],\n\t\t\tdefault: \"asc\",\n\t\t}),\n\t\topenApiParameter(\"_fields\", \"Comma-separated columns to include.\", {\n\t\t\ttype: \"string\",\n\t\t}),\n\t];\n\tif (searchableColumns(table).length > 0) {\n\t\tparameters.push(\n\t\t\topenApiParameter(\"_search\", \"Search across searchable columns.\", {\n\t\t\t\ttype: \"string\",\n\t\t\t}),\n\t\t);\n\t}\n\tfor (const [name, col] of columnEntries(table)) {\n\t\tparameters.push(\n\t\t\topenApiParameter(name, `Filter ${name} by equality.`, {\n\t\t\t\ttype: \"string\",\n\t\t\t}),\n\t\t);\n\t\tparameters.push(\n\t\t\topenApiParameter(`${name}.neq`, `Filter ${name} by inequality.`, {\n\t\t\t\ttype: \"string\",\n\t\t\t}),\n\t\t);\n\t\tif (isComparable(col.type)) {\n\t\t\tfor (const op of [\"gt\", \"gte\", \"lt\", \"lte\"]) {\n\t\t\t\tparameters.push(\n\t\t\t\t\topenApiParameter(`${name}.${op}`, `Filter ${name} with ${op}.`, {\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tif (isTextLike(col.type)) {\n\t\t\tparameters.push(\n\t\t\t\topenApiParameter(\n\t\t\t\t\t`${name}.like`,\n\t\t\t\t\t`Case-insensitive contains filter for ${name}.`,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"string\",\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\treturn parameters;\n}\n\nexport function generateSubgraphAgentSchema(\n\tdetail: SubgraphDetail,\n\toptions: SubgraphSpecOptions = {},\n): SubgraphAgentSchema {\n\tconst serverUrl = normalizeServerUrl(options.serverUrl);\n\tconst tables: SubgraphAgentSchema[\"tables\"] = {};\n\tfor (const [tableName, table] of Object.entries(detail.tables)) {\n\t\tconst path = tablePath(detail.name, tableName);\n\t\ttables[tableName] = {\n\t\t\tendpoint: `${serverUrl}${path}`,\n\t\t\tcountEndpoint: `${serverUrl}${countPath(detail.name, tableName)}`,\n\t\t\trowCount: table.rowCount,\n\t\t\tcolumns: table.columns,\n\t\t\t...(table.indexes ? { indexes: table.indexes } : {}),\n\t\t\t...(table.uniqueKeys ? { uniqueKeys: table.uniqueKeys } : {}),\n\t\t\tquery: {\n\t\t\t\tparameters: queryParameters(table),\n\t\t\t\tsortable: selectableColumns(table),\n\t\t\t\tselectable: selectableColumns(table),\n\t\t\t\tsearchable: searchableColumns(table),\n\t\t\t\tfilters: filterNames(table),\n\t\t\t},\n\t\t\texamples: {\n\t\t\t\tlist: rowExample(table),\n\t\t\t\tcount: { count: table.rowCount },\n\t\t\t\tcurl: `curl '${serverUrl}${path}?_limit=10&_sort=_block_height&_order=desc'`,\n\t\t\t},\n\t\t};\n\t}\n\treturn {\n\t\tname: detail.name,\n\t\tversion: detail.version,\n\t\t...(detail.description ? { description: detail.description } : {}),\n\t\t...(detail.schemaHash ? { schemaHash: detail.schemaHash } : {}),\n\t\tgeneratedAt: generatedAt(options),\n\t\tserverUrl,\n\t\t...(detail.sources ? { sources: detail.sources } : {}),\n\t\ttables,\n\t};\n}\n\nexport function generateSubgraphOpenApi(\n\tdetail: SubgraphDetail,\n\toptions: SubgraphSpecOptions = {},\n): Record<string, unknown> {\n\tconst serverUrl = normalizeServerUrl(options.serverUrl);\n\tconst paths: Record<string, unknown> = {};\n\tconst schemas: Record<string, unknown> = {};\n\n\tfor (const [tableName, table] of Object.entries(detail.tables)) {\n\t\tconst schemaName = `${tableName}Row`;\n\t\tconst properties: Record<string, unknown> = {};\n\t\tconst required: string[] = [];\n\t\tfor (const [columnName, column] of columnEntries(table)) {\n\t\t\tproperties[columnName] = openApiSchemaForColumn(column);\n\t\t\tif (!column.nullable) required.push(columnName);\n\t\t}\n\t\tschemas[schemaName] = {\n\t\t\ttype: \"object\",\n\t\t\tproperties,\n\t\t\trequired,\n\t\t\texample: rowExample(table),\n\t\t};\n\n\t\tpaths[tablePath(detail.name, tableName)] = {\n\t\t\tget: {\n\t\t\t\tsummary: `Query ${detail.name}.${tableName}`,\n\t\t\t\toperationId: `query_${detail.name.replace(/-/g, \"_\")}_${tableName}`,\n\t\t\t\tparameters: tableParameters(table),\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"Rows returned from the subgraph table.\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\t\t\t\t\titems: { $ref: `#/components/schemas/${schemaName}` },\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tmeta: {\n\t\t\t\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\t\t\t\ttotal: { type: \"integer\" },\n\t\t\t\t\t\t\t\t\t\t\t\tlimit: { type: \"integer\" },\n\t\t\t\t\t\t\t\t\t\t\t\toffset: { type: \"integer\" },\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tpaths[countPath(detail.name, tableName)] = {\n\t\t\tget: {\n\t\t\t\tsummary: `Count ${detail.name}.${tableName}`,\n\t\t\t\toperationId: `count_${detail.name.replace(/-/g, \"_\")}_${tableName}`,\n\t\t\t\tparameters: tableParameters(table),\n\t\t\t\tresponses: {\n\t\t\t\t\t\"200\": {\n\t\t\t\t\t\tdescription: \"Row count for the filtered table query.\",\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t\"application/json\": {\n\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\t\tproperties: { count: { type: \"integer\" } },\n\t\t\t\t\t\t\t\t\trequired: [\"count\"],\n\t\t\t\t\t\t\t\t\texample: { count: table.rowCount },\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}\n\n\treturn {\n\t\topenapi: \"3.1.0\",\n\t\tinfo: {\n\t\t\ttitle: `${detail.name} Subgraph API`,\n\t\t\tversion: detail.version,\n\t\t\t...(detail.description ? { description: detail.description } : {}),\n\t\t},\n\t\tservers: [{ url: serverUrl }],\n\t\tpaths,\n\t\tcomponents: { schemas },\n\t\t\"x-secondlayer-subgraph\": detail.name,\n\t\t\"x-secondlayer-version\": detail.version,\n\t\t\"x-secondlayer-schema-hash\": detail.schemaHash,\n\t\t\"x-secondlayer-generated-at\": generatedAt(options),\n\t\t\"x-secondlayer-sources\": detail.sources ?? {},\n\t\t\"x-secondlayer-tables\": Object.keys(detail.tables),\n\t};\n}\n\nexport function generateSubgraphMarkdown(\n\tdetail: SubgraphDetail,\n\toptions: SubgraphSpecOptions = {},\n): string {\n\tconst agent = generateSubgraphAgentSchema(detail, options);\n\tconst lines = [\n\t\t`# ${detail.name} Subgraph API`,\n\t\t\"\",\n\t\t`Version: ${detail.version}`,\n\t\tdetail.schemaHash ? `Schema hash: ${detail.schemaHash}` : undefined,\n\t\t`Server: ${agent.serverUrl}`,\n\t\t\"\",\n\t\tdetail.description,\n\t].filter((line): line is string => line !== undefined && line !== \"\");\n\n\tfor (const [tableName, table] of Object.entries(agent.tables)) {\n\t\tlines.push(\n\t\t\t\"\",\n\t\t\t`## ${tableName}`,\n\t\t\t\"\",\n\t\t\t`GET ${table.endpoint}`,\n\t\t\t`GET ${table.countEndpoint}`,\n\t\t\t\"\",\n\t\t\t`Rows: ${table.rowCount}`,\n\t\t\t\"\",\n\t\t\t\"### Columns\",\n\t\t\t\"\",\n\t\t\t\"| Column | Type | Attributes |\",\n\t\t\t\"| --- | --- | --- |\",\n\t\t);\n\t\tfor (const [columnName, col] of Object.entries(table.columns)) {\n\t\t\tconst attrs = [\n\t\t\t\tSYSTEM_COLUMNS.includes(columnName) ? \"system\" : undefined,\n\t\t\t\tcol.nullable ? \"nullable\" : undefined,\n\t\t\t\tcol.indexed ? \"indexed\" : undefined,\n\t\t\t\tcol.searchable ? \"searchable\" : undefined,\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\", \");\n\t\t\tlines.push(`| \\`${columnName}\\` | \\`${col.type}\\` | ${attrs || \"-\"} |`);\n\t\t}\n\t\tlines.push(\n\t\t\t\"\",\n\t\t\t\"### Query\",\n\t\t\t\"\",\n\t\t\t`Parameters: ${table.query.parameters.map((p) => `\\`${p}\\``).join(\", \")}`,\n\t\t\t`Filters: ${table.query.filters.map((p) => `\\`${p}\\``).join(\", \")}`,\n\t\t\t\"\",\n\t\t\t\"### Example\",\n\t\t\t\"\",\n\t\t\t\"```bash\",\n\t\t\ttable.examples.curl,\n\t\t\t\"```\",\n\t\t);\n\t}\n\treturn `${lines.join(\"\\n\")}\\n`;\n}\n\nexport function generateSubgraphSpec(\n\tdetail: SubgraphDetail,\n\tformat: SubgraphSpecFormat,\n\toptions: SubgraphSpecOptions = {},\n): Record<string, unknown> | SubgraphAgentSchema | string {\n\tif (format === \"openapi\") return generateSubgraphOpenApi(detail, options);\n\tif (format === \"agent\") return generateSubgraphAgentSchema(detail, options);\n\treturn generateSubgraphMarkdown(detail, options);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;AA4CA,IAAM,iBAAiB,CAAC,OAAO,iBAAiB,UAAU,aAAa;AACvE,IAAM,oBAAoB,CAAC,UAAU,WAAW,SAAS,UAAU,SAAS;AAC5E,IAAM,iBAAiB,CAAC,OAAO,MAAM,OAAO,MAAM,KAAK;AAEvD,SAAS,WAAW,CAAC,SAAsC;AAAA,EAC1D,OAAO,QAAQ,eAAe,IAAI,KAAK,EAAE,YAAY;AAAA;AAGtD,SAAS,kBAAkB,CAAC,WAA4B;AAAA,EACvD,QAAQ,aAAa,iCAAiC,QAAQ,QAAQ,EAAE;AAAA;AAGzE,SAAS,SAAS,CAAC,cAAsB,WAA2B;AAAA,EACnE,OAAO,kBAAkB,gBAAgB;AAAA;AAG1C,SAAS,SAAS,CAAC,cAAsB,WAA2B;AAAA,EACnE,OAAO,GAAG,UAAU,cAAc,SAAS;AAAA;AAG5C,SAAS,UAAU,CAAC,MAAuB;AAAA,EAC1C,OAAO,SAAS,UAAU,SAAS,eAAe,SAAS;AAAA;AAG5D,SAAS,YAAY,CAAC,MAAuB;AAAA,EAC5C,OACC,SAAS,UACT,SAAS,SACT,SAAS,YACT,SAAS,YACT,SAAS;AAAA;AAIX,SAAS,gBAAgB,CAAC,MAAuB;AAAA,EAChD,QAAQ;AAAA,SACF;AAAA,SACA;AAAA,SACA;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,MACJ,OAAO;AAAA,SACH;AAAA,M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layer/shared",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
"types": "./dist/src/schemas/subgraphs.d.ts",
|
|
62
62
|
"import": "./dist/src/schemas/subgraphs.js"
|
|
63
63
|
},
|
|
64
|
+
"./subgraphs/spec": {
|
|
65
|
+
"types": "./dist/src/subgraphs/spec.d.ts",
|
|
66
|
+
"import": "./dist/src/subgraphs/spec.js"
|
|
67
|
+
},
|
|
64
68
|
"./schemas/subscriptions": {
|
|
65
69
|
"types": "./dist/src/schemas/subscriptions.d.ts",
|
|
66
70
|
"import": "./dist/src/schemas/subscriptions.js"
|