@graphprotocol/graph-cli 0.60.0 → 0.60.1-alpha-20231103131654-82a8eec

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,5 +1,15 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.60.1-alpha-20231103131654-82a8eec
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1490](https://github.com/graphprotocol/graph-tooling/pull/1490)
8
+ [`82a8eec`](https://github.com/graphprotocol/graph-tooling/commit/82a8eec03c25ce5c1e9edeb97ecf08a6e3a1b9cb)
9
+ Thanks [@mangas](https://github.com/mangas)! - dependencies updates:
10
+ - Updated dependency [`prettier@3.0.3` ↗︎](https://www.npmjs.com/package/prettier/v/3.0.3) (from
11
+ `1.19.1`, in `dependencies`)
12
+
3
13
  ## 0.60.0
4
14
 
5
15
  ### Minor Changes
@@ -657,7 +667,7 @@
657
667
 
658
668
  - [#1132](https://github.com/graphprotocol/graph-tooling/pull/1132)
659
669
  [`719c8f5`](https://github.com/graphprotocol/graph-tooling/commit/719c8f5e890cc2392fb15cdb318b8f55570f9419)
660
- Thanks [@cmwhited](https://github.com/cmwhited)! - enable deployment of celo, avalance and
670
+ Thanks [@cmwhited](https://github.com/cmwhited)! - enable deployment of celo, avalanche and
661
671
  arbitrum-one in studio
662
672
 
663
673
  ## 0.42.1
@@ -192,7 +192,7 @@ const ASSEMBLYSCRIPT_TO_ETHEREUM_VALUE = [
192
192
  /^tuple\[([0-9]+)?\]$/,
193
193
  (code) => `ethereum.Value.fromTupleArray(${code})`,
194
194
  ],
195
- // Multi dimentional arrays
195
+ // Multi dimensional arrays
196
196
  [
197
197
  'Array<Array<Address>>',
198
198
  /^address\[([0-9]+)?\]\[([0-9]+)?\]$/,
@@ -77,7 +77,7 @@ const compile = ({ inputFile, global, baseDir, libs, outputFile }) => {
77
77
  '--debug',
78
78
  ];
79
79
  assemblyScriptCompiler(compilerArgs, compilerDefaults);
80
- // only if compiler succeded, that is, when the line above doesn't throw
80
+ // only if compiler succeeded, that is, when the line above doesn't throw
81
81
  removeExitHandler(exitHandler);
82
82
  };
83
83
  exports.compile = compile;
@@ -50,9 +50,9 @@ class Compiler {
50
50
  this.libsDirs = [];
51
51
  this.protocol = this.options.protocol;
52
52
  this.ABI = this.protocol.getABI();
53
- if (options.protocol.name === 'substreams') {
54
- return;
55
- }
53
+ // if (options.protocol.name === 'substreams') {
54
+ // return;
55
+ // }
56
56
  for (let dir = path_1.default.resolve(this.sourceDir);
57
57
  // Terminate after the root dir or when we have found node_modules
58
58
  dir !== undefined;
@@ -245,7 +245,7 @@ class Compiler {
245
245
  return missingHandlers;
246
246
  }
247
247
  _compileDataSourceMapping(protocol, dataSource, mappingPath, compiledFiles, spinner, validate = false) {
248
- if (protocol.name == 'substreams') {
248
+ if (protocol.name == 'substreams' && !dataSource.getIn(["mapping", "file"])) {
249
249
  return;
250
250
  }
251
251
  try {
@@ -382,6 +382,9 @@ class Compiler {
382
382
  const packageContent = fs_extra_1.default.readFileSync(packageFile);
383
383
  return path_1.default.relative(this.options.outputDir, this._writeSubgraphFile(packageFile, packageContent, this.sourceDir, this.subgraphDir(this.options.outputDir, dataSource), spinner));
384
384
  }));
385
+ if (updatedDataSource.getIn(["mapping", "file"])) {
386
+ updatedDataSource = updatedDataSource.updateIn(['mapping', 'file'], (mappingFile) => path_1.default.relative(this.options.outputDir, path_1.default.resolve(this.sourceDir, mappingFile)));
387
+ }
385
388
  return updatedDataSource;
386
389
  }
387
390
  // The mapping file is already being written to the output
@@ -441,6 +444,16 @@ class Compiler {
441
444
  keyPath: ['dataSources', i, 'source', 'package', 'file'],
442
445
  value: await this._uploadFileToIPFS(dataSource.getIn(['source', 'package', 'file']), uploadedFiles, spinner),
443
446
  });
447
+ console.log("####11");
448
+ console.log(dataSource.getIn(["mapping", "file"]));
449
+ console.log(dataSource.toJS());
450
+ if (dataSource.getIn(["mapping", "file"])) {
451
+ console.log("####10");
452
+ updates.push({
453
+ keyPath: ['dataSources', i, 'mapping', 'file'],
454
+ value: await this._uploadFileToIPFS(dataSource.getIn(['mapping', 'file']), uploadedFiles, spinner),
455
+ });
456
+ }
444
457
  }
445
458
  }
446
459
  else {
@@ -493,11 +506,14 @@ class Compiler {
493
506
  return immutable_1.default.fromJS({ '/': `/ipfs/${hash}` });
494
507
  }
495
508
  async _uploadSubgraphDefinitionToIPFS(subgraph) {
509
+ console.log("####1");
496
510
  const str = js_yaml_1.default.safeDump(subgraph.toJS(), { noRefs: true, sortKeys: true });
511
+ console.log("####2");
497
512
  const file = { path: 'subgraph.yaml', content: Buffer.from(str, 'utf-8') };
498
513
  return await this._uploadToIPFS(file);
499
514
  }
500
515
  async _uploadToIPFS(file) {
516
+ console.log("####4");
501
517
  try {
502
518
  const files = this.ipfs.addAll([file]);
503
519
  // We get back async iterable
@@ -507,6 +523,7 @@ class Compiler {
507
523
  // we grab the file and pin it
508
524
  const uploadedFile = value;
509
525
  await this.ipfs.pin.add(uploadedFile.cid);
526
+ console.log("####5");
510
527
  return uploadedFile.cid.toString();
511
528
  }
512
529
  catch (e) {
@@ -32,14 +32,18 @@ type DataSource {
32
32
 
33
33
  type SubstreamsSource {
34
34
  package: SubstreamsPackage!
35
+ startBlock: BigInt
35
36
  }
36
37
 
37
38
  type SubstreamsPackage {
38
39
  moduleName: String!
39
40
  file: String!
41
+ params: String
40
42
  }
41
43
 
42
44
  type SubstreamMapping {
43
45
  apiVersion: String!
44
46
  kind: String!
47
+ file: File
48
+ handler: String
45
49
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.60.0",
2
+ "version": "0.60.1-alpha-20231103131654-82a8eec",
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.60.0",
3
+ "version": "0.60.1-alpha-20231103131654-82a8eec",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "ipfs-http-client": "55.0.0",
40
40
  "jayson": "4.0.0",
41
41
  "js-yaml": "3.14.1",
42
- "prettier": "1.19.1",
42
+ "prettier": "3.0.3",
43
43
  "request": "2.88.2",
44
44
  "semver": "7.4.0",
45
45
  "sync-request": "6.1.0",