@graphprotocol/graph-cli 0.63.0-alpha-20231206152354-981f2bb → 0.63.0-alpha-20231206164429-cdb032a
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 +1 -5
- package/README.md +10 -0
- package/dist/compiler/index.js +2 -11
- package/dist/protocols/index.d.ts +3 -3
- package/dist/protocols/index.js +3 -17
- package/dist/protocols/substreams/manifest.graphql +0 -4
- package/dist/subgraph.js +1 -3
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.63.0-alpha-
|
|
3
|
+
## 0.63.0-alpha-20231206164429-cdb032a
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#1490](https://github.com/graphprotocol/graph-tooling/pull/1490)
|
|
8
|
-
[`3fa19c5`](https://github.com/graphprotocol/graph-tooling/commit/3fa19c5b212bff03d57b027f1dbdf80090e69b02)
|
|
9
|
-
Thanks [@mangas](https://github.com/mangas)! - substreams based triggers support
|
|
10
|
-
|
|
11
7
|
- [#1524](https://github.com/graphprotocol/graph-tooling/pull/1524)
|
|
12
8
|
[`086a2da`](https://github.com/graphprotocol/graph-tooling/commit/086a2da03a4388277b69b6db541a0673dc9505bb)
|
|
13
9
|
Thanks [@pedropregueiro](https://github.com/pedropregueiro)! - Add support for M3 apple silicon
|
package/README.md
CHANGED
|
@@ -68,6 +68,16 @@ If you are ready to dive into the details of building a subgraph from scratch, t
|
|
|
68
68
|
well, along with API documentation for the
|
|
69
69
|
[AssemblyScript API](https://thegraph.com/docs/en/developer/assemblyscript-api/).
|
|
70
70
|
|
|
71
|
+
## Releases
|
|
72
|
+
|
|
73
|
+
The Graph CLI is released on [npm](https://www.npmjs.com/package/@graphprotocol/graph-cli) and published as a Binary on [GitHub Releases](https://github.com/graphprotocol/graph-tooling/releases). We support all the version of CLI that support [Maintenance, LTS and Current Node.js releases](https://github.com/nodejs/Release#release-schedule). Additionally if there are `graph-node` specific features that are breaking and no-longer supported, we will drop support for older versions of CLI. After 90 days of a new `Node.js` release, we will drop support for the oldest `Node.js` version.
|
|
74
|
+
|
|
75
|
+
End-of-life Releases
|
|
76
|
+
|
|
77
|
+
| Release | End-of-life | Reason |
|
|
78
|
+
| ---------- | ----------------- | ------------------------------------- |
|
|
79
|
+
| `>=0.60.0` | December 31, 2023 | No longer supporting Node 16 or lower |
|
|
80
|
+
|
|
71
81
|
## License
|
|
72
82
|
|
|
73
83
|
Copyright © 2018-2019 Graph Protocol, Inc. and contributors.
|
package/dist/compiler/index.js
CHANGED
|
@@ -374,7 +374,7 @@ class Compiler {
|
|
|
374
374
|
return path_1.default.relative(this.options.outputDir, this._writeSubgraphFile(abiFile, JSON.stringify(abiData.data.toJS(), null, 2), this.sourceDir, this.subgraphDir(this.options.outputDir, dataSource), spinner));
|
|
375
375
|
})));
|
|
376
376
|
}
|
|
377
|
-
if (protocol.name == 'substreams'
|
|
377
|
+
if (protocol.name == 'substreams') {
|
|
378
378
|
updatedDataSource = updatedDataSource
|
|
379
379
|
// Write data source ABIs to the output directory
|
|
380
380
|
.updateIn(['source', 'package'], (substreamsPackage) => substreamsPackage.update('file', (packageFile) => {
|
|
@@ -382,9 +382,6 @@ 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
|
-
}
|
|
388
385
|
return updatedDataSource;
|
|
389
386
|
}
|
|
390
387
|
// The mapping file is already being written to the output
|
|
@@ -438,18 +435,12 @@ class Compiler {
|
|
|
438
435
|
}
|
|
439
436
|
}
|
|
440
437
|
// Upload all mappings
|
|
441
|
-
if (this.protocol.name === 'substreams'
|
|
438
|
+
if (this.protocol.name === 'substreams') {
|
|
442
439
|
for (const [i, dataSource] of subgraph.get('dataSources').entries()) {
|
|
443
440
|
updates.push({
|
|
444
441
|
keyPath: ['dataSources', i, 'source', 'package', 'file'],
|
|
445
442
|
value: await this._uploadFileToIPFS(dataSource.getIn(['source', 'package', 'file']), uploadedFiles, spinner),
|
|
446
443
|
});
|
|
447
|
-
if (dataSource.getIn(['mapping', 'file'])) {
|
|
448
|
-
updates.push({
|
|
449
|
-
keyPath: ['dataSources', i, 'mapping', 'file'],
|
|
450
|
-
value: await this._uploadFileToIPFS(dataSource.getIn(['mapping', 'file']), uploadedFiles, spinner),
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
444
|
}
|
|
454
445
|
}
|
|
455
446
|
else {
|
|
@@ -6,9 +6,9 @@ export default class Protocol {
|
|
|
6
6
|
static fromDataSources(dataSourcesAndTemplates: any): Protocol;
|
|
7
7
|
name: ProtocolName;
|
|
8
8
|
config: ProtocolConfig;
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(name: ProtocolName);
|
|
10
10
|
static availableProtocols(): immutable.Collection<ProtocolName, string[]>;
|
|
11
|
-
static availableNetworks(): immutable.Map<"ethereum" | "arweave" | "near" | "cosmos" | "substreams"
|
|
11
|
+
static availableNetworks(): immutable.Map<"ethereum" | "arweave" | "near" | "cosmos" | "substreams", immutable.List<string>>;
|
|
12
12
|
static normalizeName(name: ProtocolName): ProtocolName;
|
|
13
13
|
displayName(): string;
|
|
14
14
|
isValidKindName(kind: string): boolean;
|
|
@@ -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'
|
|
28
|
+
export type ProtocolName = 'arweave' | 'ethereum' | 'near' | 'cosmos' | 'substreams';
|
|
29
29
|
export interface ProtocolConfig {
|
|
30
30
|
displayName: string;
|
|
31
31
|
abi?: any;
|
package/dist/protocols/index.js
CHANGED
|
@@ -50,18 +50,11 @@ const subgraph_5 = __importDefault(require("./substreams/subgraph"));
|
|
|
50
50
|
const protocolDebug = (0, debug_1.default)('graph-cli:protocol');
|
|
51
51
|
class Protocol {
|
|
52
52
|
static fromDataSources(dataSourcesAndTemplates) {
|
|
53
|
-
const
|
|
54
|
-
return new Protocol(
|
|
53
|
+
const firstDataSourceKind = dataSourcesAndTemplates[0].kind;
|
|
54
|
+
return new Protocol(firstDataSourceKind);
|
|
55
55
|
}
|
|
56
|
-
constructor(
|
|
57
|
-
/**
|
|
58
|
-
* TODO: we should improve this `any` type, because some places
|
|
59
|
-
* we can initiate a Protocol with just a string (the name) and
|
|
60
|
-
* some other places use datasource object
|
|
61
|
-
*/
|
|
62
|
-
const name = typeof datasource === 'string' ? datasource : datasource.kind;
|
|
56
|
+
constructor(name) {
|
|
63
57
|
this.name = Protocol.normalizeName(name);
|
|
64
|
-
protocolDebug('Initializing protocol %s', this.name);
|
|
65
58
|
switch (this.name) {
|
|
66
59
|
case 'arweave':
|
|
67
60
|
this.config = arweaveProtocol;
|
|
@@ -77,13 +70,6 @@ class Protocol {
|
|
|
77
70
|
break;
|
|
78
71
|
case 'substreams':
|
|
79
72
|
this.config = substreamsProtocol;
|
|
80
|
-
/**
|
|
81
|
-
* Substreams triggers are a special case of substreams data sources
|
|
82
|
-
* which have a mapping file and a handler.
|
|
83
|
-
*/
|
|
84
|
-
if (datasource?.mapping?.file && datasource?.mapping.handler) {
|
|
85
|
-
this.name = 'substreams/triggers';
|
|
86
|
-
}
|
|
87
73
|
break;
|
|
88
74
|
default:
|
|
89
75
|
// Do not throw when undefined, a better error message is printed after the constructor
|
|
@@ -32,18 +32,14 @@ type DataSource {
|
|
|
32
32
|
|
|
33
33
|
type SubstreamsSource {
|
|
34
34
|
package: SubstreamsPackage!
|
|
35
|
-
startBlock: BigInt
|
|
36
35
|
}
|
|
37
36
|
|
|
38
37
|
type SubstreamsPackage {
|
|
39
38
|
moduleName: String!
|
|
40
39
|
file: String!
|
|
41
|
-
params: String
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
type SubstreamMapping {
|
|
45
43
|
apiVersion: String!
|
|
46
44
|
kind: String!
|
|
47
|
-
file: File
|
|
48
|
-
handler: String
|
|
49
45
|
}
|
package/dist/subgraph.js
CHANGED
|
@@ -60,9 +60,7 @@ class Subgraph {
|
|
|
60
60
|
]);
|
|
61
61
|
}
|
|
62
62
|
// Parse the default subgraph schema
|
|
63
|
-
const schema = graphql.parse(await fs_extra_1.default.readFile(path_1.default.join(__dirname, 'protocols',
|
|
64
|
-
// TODO: substreams/triggers is a special case, should be handled better
|
|
65
|
-
protocol.name === 'substreams/triggers' ? 'substreams' : protocol.name, `manifest.graphql`), 'utf-8'));
|
|
63
|
+
const schema = graphql.parse(await fs_extra_1.default.readFile(path_1.default.join(__dirname, 'protocols', protocol.name, `manifest.graphql`), 'utf-8'));
|
|
66
64
|
// Obtain the root `SubgraphManifest` type from the schema
|
|
67
65
|
const rootType = schema.definitions.find(definition => {
|
|
68
66
|
// @ts-expect-error TODO: name field does not exist on definition, really?
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED