@secondlayer/shared 10.0.0 → 11.0.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.
Files changed (44) hide show
  1. package/dist/src/archive/range-digest.d.ts +15 -0
  2. package/dist/src/archive/semantic-digest-builder.d.ts +15 -0
  3. package/dist/src/coverage/index.d.ts +15 -0
  4. package/dist/src/crypto/secrets.js.map +2 -2
  5. package/dist/src/db/index.d.ts +20 -1
  6. package/dist/src/db/index.js +2 -1
  7. package/dist/src/db/index.js.map +5 -5
  8. package/dist/src/db/queries/chain-reorgs.d.ts +15 -0
  9. package/dist/src/db/queries/chain-reorgs.js +2 -1
  10. package/dist/src/db/queries/chain-reorgs.js.map +5 -5
  11. package/dist/src/db/queries/contracts.d.ts +15 -0
  12. package/dist/src/db/queries/instance.d.ts +15 -0
  13. package/dist/src/db/queries/integrity.d.ts +15 -0
  14. package/dist/src/db/queries/subgraph-gaps.d.ts +15 -0
  15. package/dist/src/db/queries/subgraph-operations.d.ts +15 -0
  16. package/dist/src/db/queries/subgraphs.d.ts +16 -8
  17. package/dist/src/db/queries/subgraphs.js +1 -9
  18. package/dist/src/db/queries/subgraphs.js.map +4 -4
  19. package/dist/src/db/queries/subscriptions.d.ts +15 -0
  20. package/dist/src/db/queries/subscriptions.js.map +2 -2
  21. package/dist/src/db/queries/sync-scope.d.ts +15 -0
  22. package/dist/src/db/schema.d.ts +19 -1
  23. package/dist/src/errors.d.ts +5 -2
  24. package/dist/src/errors.js +5 -5
  25. package/dist/src/errors.js.map +3 -3
  26. package/dist/src/index.d.ts +34 -9
  27. package/dist/src/index.js +13 -13
  28. package/dist/src/index.js.map +8 -8
  29. package/dist/src/mode.d.ts +4 -3
  30. package/dist/src/mode.js.map +2 -2
  31. package/dist/src/node/local-client.d.ts +15 -0
  32. package/dist/src/runtime/index.js +2 -2
  33. package/dist/src/runtime/index.js.map +3 -3
  34. package/dist/src/schemas/index.d.ts +0 -6
  35. package/dist/src/schemas/index.js +2 -3
  36. package/dist/src/schemas/index.js.map +3 -3
  37. package/dist/src/schemas/subgraphs.d.ts +0 -6
  38. package/dist/src/schemas/subgraphs.js +2 -3
  39. package/dist/src/schemas/subgraphs.js.map +3 -3
  40. package/dist/src/subgraphs/spec.d.ts +9 -0
  41. package/dist/src/subgraphs/spec.js +7 -7
  42. package/dist/src/subgraphs/spec.js.map +3 -3
  43. package/migrations/0121_archive_fetches.ts +49 -0
  44. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -783,6 +783,7 @@ var TABLE_TO_DB = {
783
783
  x402_payments: "target",
784
784
  x402_balances: "target",
785
785
  account_credits: "target",
786
+ archive_fetches: "target",
786
787
  service_heartbeats: "both"
787
788
  };
788
789
 
@@ -1022,8 +1023,8 @@ class DatabaseError extends SecondLayerError {
1022
1023
  }
1023
1024
 
1024
1025
  class AuthenticationError extends SecondLayerError {
1025
- constructor(message) {
1026
- super("AUTHENTICATION_ERROR", message);
1026
+ constructor(message, details) {
1027
+ super("AUTHENTICATION_ERROR", message, undefined, details);
1027
1028
  }
1028
1029
  }
1029
1030
 
@@ -1086,8 +1087,8 @@ var CODE_TO_STATUS = {
1086
1087
  NO_TENANT_FOR_PROJECT: 404,
1087
1088
  INSTANCE_EXISTS: 409,
1088
1089
  SUBGRAPH_NOT_FOUND: 404,
1089
- PUBLIC_NAME_TAKEN: 409,
1090
- GHOST_KEY_READ_ONLY: 403
1090
+ GHOST_KEY_READ_ONLY: 403,
1091
+ UNSUPPORTED_MEDIA_TYPE: 415
1091
1092
  };
1092
1093
  function getErrorMessage(err) {
1093
1094
  return err instanceof Error ? err.message : String(err);
@@ -1104,8 +1105,7 @@ var DeploySubgraphRequestSchema = z2.object({
1104
1105
  handlerCode: z2.string().max(1048576, "handler code exceeds 1MB limit"),
1105
1106
  startBlock: z2.number().int().nonnegative().optional(),
1106
1107
  sourceCode: z2.string().max(1048576, "source code exceeds 1MB limit").optional(),
1107
- dryRun: z2.boolean().optional(),
1108
- visibility: z2.enum(["public", "private"]).optional()
1108
+ dryRun: z2.boolean().optional()
1109
1109
  });
1110
1110
 
1111
1111
  // src/schemas/subscriptions.ts
@@ -1481,14 +1481,14 @@ var SYSTEM_COLUMNS = ["_id", "_block_height", "_tx_id", "_created_at"];
1481
1481
  var BASE_QUERY_PARAMS = ["_limit", "_offset", "_sort", "_order", "_fields"];
1482
1482
  var PUBLIC_BASE_QUERY_PARAMS = ["_limit", "cursor", "_order", "_fields"];
1483
1483
  var COMPARISON_OPS = ["neq", "gt", "gte", "lt", "lte"];
1484
- function isPublicRead(detail) {
1485
- return detail.visibility === "public";
1484
+ function isPublicRead(detail, options) {
1485
+ return options.forcePublicRead ?? detail.visibility === "public";
1486
1486
  }
1487
1487
  function generatedAt(options) {
1488
1488
  return options.generatedAt ?? new Date().toISOString();
1489
1489
  }
1490
1490
  function normalizeServerUrl(serverUrl) {
1491
- return (serverUrl ?? "https://api.secondlayer.tools").replace(/\/+$/, "");
1491
+ return (serverUrl ?? "http://127.0.0.1:3800").replace(/\/+$/, "");
1492
1492
  }
1493
1493
  function tablePath(subgraphName, tableName, publicRead) {
1494
1494
  const base = publicRead ? "/v1/subgraphs" : "/api/subgraphs";
@@ -1675,7 +1675,7 @@ function tableParameters(table, publicRead) {
1675
1675
  }
1676
1676
  function generateSubgraphAgentSchema(detail, options = {}) {
1677
1677
  const serverUrl = normalizeServerUrl(options.serverUrl);
1678
- const publicRead = isPublicRead(detail);
1678
+ const publicRead = isPublicRead(detail, options);
1679
1679
  const tables = {};
1680
1680
  for (const [tableName, table] of Object.entries(detail.tables)) {
1681
1681
  const path = tablePath(detail.name, tableName, publicRead);
@@ -1717,7 +1717,7 @@ function generateSubgraphAgentSchema(detail, options = {}) {
1717
1717
  }
1718
1718
  function generateSubgraphOpenApi(detail, options = {}) {
1719
1719
  const serverUrl = normalizeServerUrl(options.serverUrl);
1720
- const publicRead = isPublicRead(detail);
1720
+ const publicRead = isPublicRead(detail, options);
1721
1721
  const paths = {};
1722
1722
  const schemas = {};
1723
1723
  for (const [tableName, table] of Object.entries(detail.tables)) {
@@ -1829,7 +1829,7 @@ function generateSubgraphOpenApi(detail, options = {}) {
1829
1829
  }
1830
1830
  function generateSubgraphMarkdown(detail, options = {}) {
1831
1831
  const agent = generateSubgraphAgentSchema(detail, options);
1832
- const publicRead = isPublicRead(detail);
1832
+ const publicRead = isPublicRead(detail, options);
1833
1833
  const lines = [
1834
1834
  `# ${detail.name} Subgraph API`,
1835
1835
  "",
@@ -2147,5 +2147,5 @@ export {
2147
2147
  AuthenticationError
2148
2148
  };
2149
2149
 
2150
- //# debugId=8F376771928DF15764756E2164756E21
2150
+ //# debugId=CC94EE7EB04C7F8864756E2164756E21
2151
2151
  //# sourceMappingURL=index.js.map