@secondlayer/subgraphs 1.3.2 → 1.3.4

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 CHANGED
@@ -51,7 +51,7 @@ export default defineSubgraph({
51
51
  });
52
52
  ```
53
53
 
54
- Deploy via CLI (`sl subgraphs deploy path/to/definition.ts`), SDK (`sl.subgraphs.deploy({...})`), or MCP (`subgraphs_deploy`). The dashboard is read-only — creation always happens through an API surface.
54
+ Deploy via CLI (`sl subgraphs deploy path/to/definition.ts`), SDK (`sl.subgraphs.deploy({...})`), or MCP (`subgraphs_deploy`). The CLI can also scaffold from a deployed contract with `sl subgraphs scaffold <contract> -o subgraphs/name.ts`; scaffold writes or amends `package.json` and runs `bun install` unless `--no-install` is passed. The dashboard is read-only — creation always happens through an API surface.
55
55
 
56
56
  ## Exports
57
57
 
package/dist/src/index.js CHANGED
@@ -256,9 +256,9 @@ class SubgraphContext {
256
256
  const blockHeight = op.data._block_height ?? this.block.height;
257
257
  const txId = op.data._tx_id ?? this._tx.txId;
258
258
  const baseRow = op.kind === "update" ? { ...op.data, ...op.set ?? {} } : { ...op.data };
259
- delete baseRow._upsert_keys;
260
- delete baseRow._upsert_fallback_keys;
261
- delete baseRow._upsert_fallback_set;
259
+ baseRow._upsert_keys = undefined;
260
+ baseRow._upsert_fallback_keys = undefined;
261
+ baseRow._upsert_fallback_set = undefined;
262
262
  return {
263
263
  op: op.kind,
264
264
  table: op.table,
@@ -1405,16 +1405,16 @@ function generateSubgraphSQL(def, schemaNameOverride) {
1405
1405
  const statements = [];
1406
1406
  const needsTrgm = Object.values(def.schema).some((table) => Object.values(table.columns).some((col) => col.search));
1407
1407
  if (needsTrgm) {
1408
- statements.push(`CREATE EXTENSION IF NOT EXISTS pg_trgm`);
1408
+ statements.push("CREATE EXTENSION IF NOT EXISTS pg_trgm");
1409
1409
  }
1410
1410
  statements.push(`CREATE SCHEMA IF NOT EXISTS ${schemaName}`);
1411
1411
  for (const [tableName, tableDef] of Object.entries(def.schema)) {
1412
1412
  const qualifiedName = `${schemaName}.${tableName}`;
1413
1413
  const columnDefs = [
1414
- `_id BIGSERIAL PRIMARY KEY`,
1415
- `_block_height BIGINT NOT NULL`,
1416
- `_tx_id TEXT NOT NULL`,
1417
- `_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()`
1414
+ "_id BIGSERIAL PRIMARY KEY",
1415
+ "_block_height BIGINT NOT NULL",
1416
+ "_tx_id TEXT NOT NULL",
1417
+ "_created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()"
1418
1418
  ];
1419
1419
  for (const [colName, col] of Object.entries(tableDef.columns)) {
1420
1420
  const sqlType = TYPE_MAP[col.type];
@@ -2158,5 +2158,5 @@ export {
2158
2158
  backfillSubgraph
2159
2159
  };
2160
2160
 
2161
- //# debugId=11BF8179DC1BF57D64756E2164756E21
2161
+ //# debugId=6E118676092C466764756E2164756E21
2162
2162
  //# sourceMappingURL=index.js.map