@graphprotocol/graph-cli 0.69.0-alpha-20240222193216-9c4dbba → 0.69.0-alpha-20240229130518-c7c0da3

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/CHANGELOG.md CHANGED
@@ -1,12 +1,28 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.69.0-alpha-20240222193216-9c4dbba
3
+ ## 0.69.0-alpha-20240229130518-c7c0da3
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - [#1592](https://github.com/graphprotocol/graph-tooling/pull/1592)
8
- [`9c4dbba`](https://github.com/graphprotocol/graph-tooling/commit/9c4dbba14ebfd5852a1c9f629f0be1bd6ae019b1)
9
- Thanks [@saihaj](https://github.com/saihaj)! - add support for `dataset` source kind
7
+ - [#1598](https://github.com/graphprotocol/graph-tooling/pull/1598)
8
+ [`c7c0da3`](https://github.com/graphprotocol/graph-tooling/commit/c7c0da30d18d11aacba9c08030e7ef7000b0edd0)
9
+ Thanks [@incrypto32](https://github.com/incrypto32)! - Allow topic filters in event handlers
10
+
11
+ ## 0.68.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1595](https://github.com/graphprotocol/graph-tooling/pull/1595)
16
+ [`decff14`](https://github.com/graphprotocol/graph-tooling/commit/decff1435bdd3b4e459ffa83d881f23d26e2ee5f)
17
+ Thanks [@saihaj](https://github.com/saihaj)! - improve error handling for `graph deploy`
18
+
19
+ ## 0.68.3
20
+
21
+ ### Patch Changes
22
+
23
+ - [#1593](https://github.com/graphprotocol/graph-tooling/pull/1593)
24
+ [`5f78825`](https://github.com/graphprotocol/graph-tooling/commit/5f788250bbd50406b59b75cc82fee4b197b88e18)
25
+ Thanks [@saihaj](https://github.com/saihaj)! - increase jayson client timeout
10
26
 
11
27
  ## 0.68.2
12
28
 
@@ -13,6 +13,7 @@ function createJsonRpcClient(url) {
13
13
  path: url.pathname,
14
14
  // username may be empty
15
15
  auth: url.password ? `${url.username}:${url.password}` : undefined,
16
+ timeout: 60000, // 60 seconds
16
17
  };
17
18
  if (url.protocol === 'https:') {
18
19
  return jayson_1.default.Client.https(params);
@@ -40,6 +40,7 @@ const network_1 = require("../command-helpers/network");
40
40
  const node_1 = require("../command-helpers/node");
41
41
  const version_1 = require("../command-helpers/version");
42
42
  const constants_1 = require("../constants");
43
+ const debug_1 = __importDefault(require("../debug"));
43
44
  const protocols_1 = __importDefault(require("../protocols"));
44
45
  const headersFlag = core_1.Flags.custom({
45
46
  summary: 'Add custom headers that will be used by the IPFS HTTP client.',
@@ -48,6 +49,7 @@ const headersFlag = core_1.Flags.custom({
48
49
  default: {},
49
50
  });
50
51
  const productOptions = ['subgraph-studio', 'hosted-service'];
52
+ const deployDebugger = (0, debug_1.default)('graph-cli:deploy');
51
53
  class DeployCommand extends core_1.Command {
52
54
  async run() {
53
55
  const { args: { 'subgraph-name': subgraphNameArg, 'subgraph-manifest': manifest }, flags: { product: productFlag, studio, 'deploy-key': deployKeyFlag, 'access-token': accessToken, 'version-label': versionLabelFlag, ipfs, headers, node: nodeFlag, 'output-dir': outputDir, 'skip-migrations': skipMigrations, watch, 'debug-fork': debugFork, network, 'network-file': networkFile, 'ipfs-hash': ipfsHash, 'from-hosted-service': hostedServiceSubgraphName, }, } = await this.parse(DeployCommand);
@@ -111,15 +113,19 @@ class DeployCommand extends core_1.Command {
111
113
  jsonRpcError,
112
114
  // @ts-expect-error TODO: why are the arguments not typed?
113
115
  res) => {
116
+ deployDebugger('requestError: %O', requestError);
117
+ deployDebugger('jsonRpcError: %O', jsonRpcError);
114
118
  if (jsonRpcError) {
115
- let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${jsonRpcError.message}`;
119
+ const message = jsonRpcError?.message || jsonRpcError?.code?.toString();
120
+ deployDebugger('message: %O', message);
121
+ let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${message}`;
116
122
  // Provide helpful advice when the subgraph has not been created yet
117
- if (jsonRpcError.message.match(/subgraph name not found/)) {
123
+ if (message?.match(/subgraph name not found/)) {
118
124
  errorMessage += `
119
125
  Make sure to create the subgraph first by running the following command:
120
126
  $ graph create --node ${node} ${subgraphName}`;
121
127
  }
122
- if (jsonRpcError.message.match(/auth failure/)) {
128
+ if (message?.match(/auth failure/)) {
123
129
  errorMessage += '\nYou may need to authenticate first.';
124
130
  }
125
131
  spinner.fail(errorMessage);
@@ -223,10 +229,14 @@ class DeployCommand extends core_1.Command {
223
229
  jsonRpcError,
224
230
  // @ts-expect-error TODO: why are the arguments not typed?
225
231
  res) => {
232
+ deployDebugger('requestError: %O', requestError);
233
+ deployDebugger('jsonRpcError: %O', jsonRpcError);
226
234
  if (jsonRpcError) {
227
- let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${jsonRpcError.message}`;
235
+ const message = jsonRpcError?.message || jsonRpcError?.code?.toString();
236
+ deployDebugger('message: %O', message);
237
+ let errorMessage = `Failed to deploy to Graph node ${requestUrl}: ${message}`;
228
238
  // Provide helpful advice when the subgraph has not been created yet
229
- if (jsonRpcError.message.match(/subgraph name not found/)) {
239
+ if (message?.match(/subgraph name not found/)) {
230
240
  if (isHostedService) {
231
241
  errorMessage +=
232
242
  '\nYou may need to create it at https://thegraph.com/explorer/dashboard.';
@@ -237,7 +247,7 @@ class DeployCommand extends core_1.Command {
237
247
  $ graph create --node ${node} ${subgraphName}`;
238
248
  }
239
249
  }
240
- if (jsonRpcError.message.match(/auth failure/)) {
250
+ if (message?.match(/auth failure/)) {
241
251
  errorMessage += '\nYou may need to authenticate first.';
242
252
  }
243
253
  spinner.fail(errorMessage);
@@ -44,12 +44,7 @@ const protocols_1 = __importDefault(require("../protocols"));
44
44
  const schema_1 = require("../scaffold/schema");
45
45
  const validation_1 = require("../validation");
46
46
  const add_1 = __importDefault(require("./add"));
47
- /**
48
- * Today we have protocol -> data source -> kind
49
- * Not the best but it is too deeply rooted to change now
50
- * So simpler just add a new protocol and hide from the `init` command
51
- */
52
- const protocolChoices = Array.from(protocols_1.default.availableProtocols().keys()).filter(n => n !== 'dataset');
47
+ const protocolChoices = Array.from(protocols_1.default.availableProtocols().keys());
53
48
  const initDebugger = (0, debug_1.default)('graph-cli:commands:init');
54
49
  /**
55
50
  * a dynamic list of available networks supported by the studio
@@ -95,6 +95,9 @@ type CallHandler {
95
95
  type ContractEventHandler {
96
96
  event: String!
97
97
  topic0: String
98
+ topic1: [String]
99
+ topic2: [String]
100
+ topic3: [String]
98
101
  handler: String!
99
102
  receipt: Boolean
100
103
  }
@@ -25,7 +25,7 @@ export default class Protocol {
25
25
  getManifestScaffold(): any;
26
26
  getMappingScaffold(): any;
27
27
  }
28
- export type ProtocolName = 'arweave' | 'ethereum' | 'near' | 'cosmos' | 'substreams' | 'substreams/triggers' | 'dataset';
28
+ export type ProtocolName = 'arweave' | 'ethereum' | 'near' | 'cosmos' | 'substreams' | 'substreams/triggers';
29
29
  export interface ProtocolConfig {
30
30
  displayName: string;
31
31
  abi?: any;
@@ -34,20 +34,19 @@ const subgraph_1 = __importDefault(require("./arweave/subgraph"));
34
34
  const CosmosManifestScaffold = __importStar(require("./cosmos/scaffold/manifest"));
35
35
  const CosmosMappingScaffold = __importStar(require("./cosmos/scaffold/mapping"));
36
36
  const subgraph_2 = __importDefault(require("./cosmos/subgraph"));
37
- const subgraph_3 = __importDefault(require("./dataset/subgraph"));
38
37
  const abi_1 = __importDefault(require("./ethereum/abi"));
39
38
  const template_1 = __importDefault(require("./ethereum/codegen/template"));
40
39
  const contract_1 = __importDefault(require("./ethereum/contract"));
41
40
  const EthereumManifestScaffold = __importStar(require("./ethereum/scaffold/manifest"));
42
41
  const EthereumMappingScaffold = __importStar(require("./ethereum/scaffold/mapping"));
43
- const subgraph_4 = __importDefault(require("./ethereum/subgraph"));
42
+ const subgraph_3 = __importDefault(require("./ethereum/subgraph"));
44
43
  const type_generator_1 = __importDefault(require("./ethereum/type-generator"));
45
44
  const contract_2 = __importDefault(require("./near/contract"));
46
45
  const NearManifestScaffold = __importStar(require("./near/scaffold/manifest"));
47
46
  const NearMappingScaffold = __importStar(require("./near/scaffold/mapping"));
48
- const subgraph_5 = __importDefault(require("./near/subgraph"));
47
+ const subgraph_4 = __importDefault(require("./near/subgraph"));
49
48
  const SubstreamsManifestScaffold = __importStar(require("./substreams/scaffold/manifest"));
50
- const subgraph_6 = __importDefault(require("./substreams/subgraph"));
49
+ const subgraph_5 = __importDefault(require("./substreams/subgraph"));
51
50
  const protocolDebug = (0, debug_1.default)('graph-cli:protocol');
52
51
  class Protocol {
53
52
  static fromDataSources(dataSourcesAndTemplates) {
@@ -76,9 +75,6 @@ class Protocol {
76
75
  case 'near':
77
76
  this.config = nearProtocol;
78
77
  break;
79
- case 'dataset':
80
- this.config = datasetProtocol;
81
- break;
82
78
  case 'substreams':
83
79
  this.config = substreamsProtocol;
84
80
  /**
@@ -103,7 +99,6 @@ class Protocol {
103
99
  near: ['near'],
104
100
  cosmos: ['cosmos'],
105
101
  substreams: ['substreams'],
106
- dataset: ['dataset'],
107
102
  });
108
103
  }
109
104
  static availableNetworks() {
@@ -255,7 +250,7 @@ const ethereumProtocol = {
255
250
  return new type_generator_1.default(options);
256
251
  },
257
252
  getSubgraph(options) {
258
- return new subgraph_4.default(options);
253
+ return new subgraph_3.default(options);
259
254
  },
260
255
  manifestScaffold: EthereumManifestScaffold,
261
256
  mappingScaffold: EthereumMappingScaffold,
@@ -267,7 +262,7 @@ const nearProtocol = {
267
262
  getTypeGenerator: undefined,
268
263
  getTemplateCodeGen: undefined,
269
264
  getSubgraph(options) {
270
- return new subgraph_5.default(options);
265
+ return new subgraph_4.default(options);
271
266
  },
272
267
  manifestScaffold: NearManifestScaffold,
273
268
  mappingScaffold: NearMappingScaffold,
@@ -279,21 +274,9 @@ const substreamsProtocol = {
279
274
  getTypeGenerator: undefined,
280
275
  getTemplateCodeGen: undefined,
281
276
  getSubgraph(options) {
282
- return new subgraph_6.default(options);
277
+ return new subgraph_5.default(options);
283
278
  },
284
279
  manifestScaffold: SubstreamsManifestScaffold,
285
280
  mappingScaffold: undefined,
286
281
  };
287
- const datasetProtocol = {
288
- displayName: 'Dataset',
289
- abi: undefined,
290
- contract: undefined,
291
- getTypeGenerator: undefined,
292
- getTemplateCodeGen: undefined,
293
- getSubgraph(options) {
294
- return new subgraph_3.default(options);
295
- },
296
- manifestScaffold: undefined,
297
- mappingScaffold: undefined,
298
- };
299
282
  protocolDebug('Available networks %M', Protocol.availableNetworks());
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.69.0-alpha-20240222193216-9c4dbba",
2
+ "version": "0.69.0-alpha-20240229130518-c7c0da3",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.69.0-alpha-20240222193216-9c4dbba",
3
+ "version": "0.69.0-alpha-20240229130518-c7c0da3",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {
@@ -1,50 +0,0 @@
1
- # Each referenced type's in any of the types below must be listed
2
- # here either as `scalar` or `type` for the validation code to work
3
- # properly.
4
- #
5
- # That's why `String` is listed as a scalar even though it's built-in
6
- # GraphQL basic types.
7
- scalar String
8
- scalar File
9
- scalar BigInt
10
- scalar Boolean
11
- scalar JSON
12
-
13
- union StringOrBigInt = String | BigInt
14
-
15
- type SubgraphManifest {
16
- specVersion: String!
17
- features: [String!]
18
- schema: Schema!
19
- description: String
20
- repository: String
21
- dataSources: [DataSource!]!
22
- indexerHints: IndexerHints
23
- }
24
-
25
- type Schema {
26
- file: File!
27
- }
28
-
29
- type IndexerHints {
30
- prune: StringOrBigInt
31
- }
32
-
33
- type DataSource {
34
- kind: String!
35
- name: String!
36
- network: String!
37
- source: DatasetSource!
38
- mapping: DatasetMapping!
39
- }
40
-
41
- type DatasetSource {
42
- dataset: String!
43
- }
44
-
45
- type DatasetMapping {
46
- kind: String!
47
- apiVersion: String!
48
- file: File!
49
- handler: String!
50
- }
@@ -1,10 +0,0 @@
1
- import immutable from 'immutable';
2
- import { Subgraph, SubgraphOptions } from '../subgraph';
3
- export default class DatasetSubgraph implements Subgraph {
4
- manifest: SubgraphOptions['manifest'];
5
- resolveFile: SubgraphOptions['resolveFile'];
6
- protocol: SubgraphOptions['protocol'];
7
- constructor(options: SubgraphOptions);
8
- validateManifest(): immutable.List<unknown>;
9
- handlerTypes(): immutable.List<never>;
10
- }
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const immutable_1 = __importDefault(require("immutable"));
7
- class DatasetSubgraph {
8
- constructor(options) {
9
- this.manifest = options.manifest;
10
- this.resolveFile = options.resolveFile;
11
- this.protocol = options.protocol;
12
- }
13
- validateManifest() {
14
- return immutable_1.default.List();
15
- }
16
- handlerTypes() {
17
- return immutable_1.default.List([]);
18
- }
19
- }
20
- exports.default = DatasetSubgraph;