@graphprotocol/graph-cli 0.63.0-alpha-20231206164429-cdb032a → 0.63.0-alpha-20231207185752-5284a6d
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 +14 -1
- package/README.md +7 -1
- package/dist/commands/auth.js +6 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/create.js +4 -0
- package/dist/commands/deploy.js +4 -2
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +35 -11
- package/dist/commands/remove.d.ts +3 -0
- package/dist/commands/remove.js +4 -0
- package/dist/compiler/index.js +11 -2
- package/dist/protocols/index.d.ts +3 -3
- package/dist/protocols/index.js +17 -3
- package/dist/protocols/substreams/manifest.graphql +4 -0
- package/dist/subgraph.js +3 -1
- package/oclif.manifest.json +42 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.63.0-alpha-
|
|
3
|
+
## 0.63.0-alpha-20231207185752-5284a6d
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- [#1531](https://github.com/graphprotocol/graph-tooling/pull/1531)
|
|
8
|
+
[`b168be1`](https://github.com/graphprotocol/graph-tooling/commit/b168be1526376fbb386b2ef650813b6696ab59f1)
|
|
9
|
+
Thanks [@travs](https://github.com/travs)! - Add `--skip-git` option to `init` cli command
|
|
10
|
+
|
|
11
|
+
- [#1490](https://github.com/graphprotocol/graph-tooling/pull/1490)
|
|
12
|
+
[`95eb9d0`](https://github.com/graphprotocol/graph-tooling/commit/95eb9d0244a99fdfb7a4750963c1a982d024dd87)
|
|
13
|
+
Thanks [@mangas](https://github.com/mangas)! - substreams based triggers support
|
|
14
|
+
|
|
15
|
+
- [#1533](https://github.com/graphprotocol/graph-tooling/pull/1533)
|
|
16
|
+
[`5284a6d`](https://github.com/graphprotocol/graph-tooling/commit/5284a6df70faa4c35a273c04b7cc1226f2b964a9)
|
|
17
|
+
Thanks [@saihaj](https://github.com/saihaj)! - adding deprecation notices for commands we plan to
|
|
18
|
+
change in the next major. See https://github.com/graphprotocol/graph-tooling/issues/1487
|
|
19
|
+
|
|
7
20
|
- [#1524](https://github.com/graphprotocol/graph-tooling/pull/1524)
|
|
8
21
|
[`086a2da`](https://github.com/graphprotocol/graph-tooling/commit/086a2da03a4388277b69b6db541a0673dc9505bb)
|
|
9
22
|
Thanks [@pedropregueiro](https://github.com/pedropregueiro)! - Add support for M3 apple silicon
|
package/README.md
CHANGED
|
@@ -70,7 +70,13 @@ well, along with API documentation for the
|
|
|
70
70
|
|
|
71
71
|
## Releases
|
|
72
72
|
|
|
73
|
-
The Graph CLI is released on [npm](https://www.npmjs.com/package/@graphprotocol/graph-cli) and
|
|
73
|
+
The Graph CLI is released on [npm](https://www.npmjs.com/package/@graphprotocol/graph-cli) and
|
|
74
|
+
published as a Binary on [GitHub Releases](https://github.com/graphprotocol/graph-tooling/releases).
|
|
75
|
+
We support all the version of CLI that support
|
|
76
|
+
[Maintenance, LTS and Current Node.js releases](https://github.com/nodejs/Release#release-schedule).
|
|
77
|
+
Additionally if there are `graph-node` specific features that are breaking and no-longer supported,
|
|
78
|
+
we will drop support for older versions of CLI. After 90 days of a new `Node.js` release, we will
|
|
79
|
+
drop support for the oldest `Node.js` version.
|
|
74
80
|
|
|
75
81
|
End-of-life Releases
|
|
76
82
|
|
package/dist/commands/auth.js
CHANGED
|
@@ -54,10 +54,16 @@ AuthCommand.flags = {
|
|
|
54
54
|
product: core_1.Flags.string({
|
|
55
55
|
summary: 'Select a product for which to authenticate.',
|
|
56
56
|
options: ['subgraph-studio', 'hosted-service'],
|
|
57
|
+
deprecated: {
|
|
58
|
+
message: 'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
|
|
59
|
+
},
|
|
57
60
|
}),
|
|
58
61
|
studio: core_1.Flags.boolean({
|
|
59
62
|
summary: 'Shortcut for "--product subgraph-studio".',
|
|
60
63
|
exclusive: ['product'],
|
|
64
|
+
deprecated: {
|
|
65
|
+
message: 'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
|
|
66
|
+
},
|
|
61
67
|
}),
|
|
62
68
|
};
|
|
63
69
|
exports.default = AuthCommand;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import { Deprecation } from '@oclif/core/lib/interfaces';
|
|
2
3
|
export default class CreateCommand extends Command {
|
|
3
4
|
static description: string;
|
|
5
|
+
static state: string;
|
|
6
|
+
static deprecationOptions: Deprecation;
|
|
4
7
|
static args: {
|
|
5
8
|
'subgraph-name': import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
6
9
|
};
|
package/dist/commands/create.js
CHANGED
|
@@ -57,6 +57,10 @@ class CreateCommand extends core_1.Command {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
CreateCommand.description = 'Registers a subgraph name';
|
|
60
|
+
CreateCommand.state = 'deprecated';
|
|
61
|
+
CreateCommand.deprecationOptions = {
|
|
62
|
+
message: 'In next major version, this command will be merged as a subcommand for `graph local`.',
|
|
63
|
+
};
|
|
60
64
|
CreateCommand.args = {
|
|
61
65
|
'subgraph-name': core_1.Args.string({
|
|
62
66
|
required: true,
|
package/dist/commands/deploy.js
CHANGED
|
@@ -375,9 +375,11 @@ DeployCommand.flags = {
|
|
|
375
375
|
exclusive: ['access-token'],
|
|
376
376
|
}),
|
|
377
377
|
'access-token': core_1.Flags.string({
|
|
378
|
-
deprecated: true,
|
|
379
|
-
summary: 'Graph access key. DEPRECATED: Use "--deploy-key" instead.',
|
|
380
378
|
exclusive: ['deploy-key'],
|
|
379
|
+
deprecated: {
|
|
380
|
+
to: 'deploy-key',
|
|
381
|
+
message: "In next version, we are removing this flag in favor of '--deploy-key'",
|
|
382
|
+
},
|
|
381
383
|
}),
|
|
382
384
|
'version-label': core_1.Flags.string({
|
|
383
385
|
summary: 'Version label used for the deployment.',
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export default class InitCommand extends Command {
|
|
|
17
17
|
'contract-name': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
18
18
|
'index-events': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
19
19
|
'skip-install': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'skip-git': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
20
21
|
'start-block': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
21
22
|
abi: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
22
23
|
spkg: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
package/dist/commands/init.js
CHANGED
|
@@ -50,7 +50,7 @@ const initDebugger = (0, debug_1.default)('graph-cli:commands:init');
|
|
|
50
50
|
class InitCommand extends core_1.Command {
|
|
51
51
|
async run() {
|
|
52
52
|
const { args: { subgraphName, directory }, flags, } = await this.parse(InitCommand);
|
|
53
|
-
const { protocol, product, studio, node: nodeFlag, 'allow-simple-name': allowSimpleNameFlag, 'from-contract': fromContract, 'contract-name': contractName, 'from-example': fromExample, 'index-events': indexEvents, 'skip-install': skipInstall, network, abi: abiPath, 'start-block': startBlock, spkg: spkgPath, } = flags;
|
|
53
|
+
const { protocol, product, studio, node: nodeFlag, 'allow-simple-name': allowSimpleNameFlag, 'from-contract': fromContract, 'contract-name': contractName, 'from-example': fromExample, 'index-events': indexEvents, 'skip-install': skipInstall, 'skip-git': skipGit, network, abi: abiPath, 'start-block': startBlock, spkg: spkgPath, } = flags;
|
|
54
54
|
initDebugger('Flags: %O', flags);
|
|
55
55
|
let { node, allowSimpleName } = (0, node_1.chooseNodeUrl)({
|
|
56
56
|
product,
|
|
@@ -94,6 +94,7 @@ class InitCommand extends core_1.Command {
|
|
|
94
94
|
directory,
|
|
95
95
|
subgraphName,
|
|
96
96
|
skipInstall,
|
|
97
|
+
skipGit,
|
|
97
98
|
}, { commands });
|
|
98
99
|
// Exit with success
|
|
99
100
|
return this.exit(0);
|
|
@@ -146,6 +147,7 @@ class InitCommand extends core_1.Command {
|
|
|
146
147
|
startBlock,
|
|
147
148
|
spkgPath,
|
|
148
149
|
skipInstall,
|
|
150
|
+
skipGit,
|
|
149
151
|
}, { commands, addContract: false });
|
|
150
152
|
// Exit with success
|
|
151
153
|
return this.exit(0);
|
|
@@ -166,6 +168,7 @@ class InitCommand extends core_1.Command {
|
|
|
166
168
|
subgraphName: answers.subgraphName,
|
|
167
169
|
directory: answers.directory,
|
|
168
170
|
skipInstall,
|
|
171
|
+
skipGit,
|
|
169
172
|
}, { commands });
|
|
170
173
|
}
|
|
171
174
|
else {
|
|
@@ -212,6 +215,7 @@ class InitCommand extends core_1.Command {
|
|
|
212
215
|
startBlock: answers.startBlock,
|
|
213
216
|
spkgPath: answers.spkgPath,
|
|
214
217
|
skipInstall,
|
|
218
|
+
skipGit,
|
|
215
219
|
}, { commands, addContract: true });
|
|
216
220
|
}
|
|
217
221
|
// Exit with success
|
|
@@ -233,10 +237,16 @@ InitCommand.flags = {
|
|
|
233
237
|
product: core_1.Flags.string({
|
|
234
238
|
summary: 'Selects the product for which to initialize.',
|
|
235
239
|
options: ['subgraph-studio', 'hosted-service'],
|
|
240
|
+
deprecated: {
|
|
241
|
+
message: 'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
|
|
242
|
+
},
|
|
236
243
|
}),
|
|
237
244
|
studio: core_1.Flags.boolean({
|
|
238
245
|
summary: 'Shortcut for "--product subgraph-studio".',
|
|
239
246
|
exclusive: ['product'],
|
|
247
|
+
deprecated: {
|
|
248
|
+
message: 'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
|
|
249
|
+
},
|
|
240
250
|
}),
|
|
241
251
|
node: core_1.Flags.string({
|
|
242
252
|
summary: 'Graph node for which to initialize.',
|
|
@@ -245,6 +255,9 @@ InitCommand.flags = {
|
|
|
245
255
|
'allow-simple-name': core_1.Flags.boolean({
|
|
246
256
|
description: 'Use a subgraph name without a prefix.',
|
|
247
257
|
default: false,
|
|
258
|
+
deprecated: {
|
|
259
|
+
message: 'In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/',
|
|
260
|
+
},
|
|
248
261
|
}),
|
|
249
262
|
'from-contract': core_1.Flags.string({
|
|
250
263
|
description: 'Creates a scaffold based on an existing contract.',
|
|
@@ -270,6 +283,13 @@ InitCommand.flags = {
|
|
|
270
283
|
summary: 'Skip installing dependencies.',
|
|
271
284
|
default: false,
|
|
272
285
|
}),
|
|
286
|
+
'skip-git': core_1.Flags.boolean({
|
|
287
|
+
summary: 'Skip initializing a Git repository.',
|
|
288
|
+
default: false,
|
|
289
|
+
deprecated: {
|
|
290
|
+
message: 'In next major version, this flag will be removed. By default we will stop initializing a Git repository.',
|
|
291
|
+
},
|
|
292
|
+
}),
|
|
273
293
|
'start-block': core_1.Flags.string({
|
|
274
294
|
helpGroup: 'Scaffold from contract',
|
|
275
295
|
description: 'Block number to start indexing from.',
|
|
@@ -730,7 +750,7 @@ Subgraph ${subgraphName} created in ${relativeDir}
|
|
|
730
750
|
|
|
731
751
|
Make sure to visit the documentation on https://thegraph.com/docs/ for further information.`);
|
|
732
752
|
}
|
|
733
|
-
async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphName, directory, skipInstall, }, { commands, }) {
|
|
753
|
+
async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphName, directory, skipInstall, skipGit, }, { commands, }) {
|
|
734
754
|
// Fail if the subgraph name is invalid
|
|
735
755
|
if (!revalidateSubgraphName.bind(this)(subgraphName, { allowSimpleName })) {
|
|
736
756
|
process.exitCode = 1;
|
|
@@ -805,10 +825,12 @@ async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphN
|
|
|
805
825
|
return;
|
|
806
826
|
}
|
|
807
827
|
// Initialize a fresh Git repository
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
828
|
+
if (!skipGit) {
|
|
829
|
+
const repo = await initRepository(directory);
|
|
830
|
+
if (repo !== true) {
|
|
831
|
+
this.exit(1);
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
812
834
|
}
|
|
813
835
|
// Install dependencies
|
|
814
836
|
if (!skipInstall) {
|
|
@@ -826,7 +848,7 @@ async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphN
|
|
|
826
848
|
}
|
|
827
849
|
printNextSteps.bind(this)({ subgraphName, directory }, { commands });
|
|
828
850
|
}
|
|
829
|
-
async function initSubgraphFromContract({ protocolInstance, allowSimpleName, subgraphName, directory, abi, network, contract, indexEvents, contractName, node, startBlock, spkgPath, skipInstall, }, { commands, addContract, }) {
|
|
851
|
+
async function initSubgraphFromContract({ protocolInstance, allowSimpleName, subgraphName, directory, abi, network, contract, indexEvents, contractName, node, startBlock, spkgPath, skipInstall, skipGit, }, { commands, addContract, }) {
|
|
830
852
|
const isSubstreams = protocolInstance.name === 'substreams';
|
|
831
853
|
// Fail if the subgraph name is invalid
|
|
832
854
|
if (!revalidateSubgraphName.bind(this)(subgraphName, { allowSimpleName })) {
|
|
@@ -874,10 +896,12 @@ async function initSubgraphFromContract({ protocolInstance, allowSimpleName, sub
|
|
|
874
896
|
}
|
|
875
897
|
}
|
|
876
898
|
// Initialize a fresh Git repository
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
899
|
+
if (!skipGit) {
|
|
900
|
+
const repo = await initRepository(directory);
|
|
901
|
+
if (repo !== true) {
|
|
902
|
+
this.exit(1);
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
881
905
|
}
|
|
882
906
|
if (!skipInstall) {
|
|
883
907
|
// Install dependencies
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Command } from '@oclif/core';
|
|
2
|
+
import { Deprecation } from '@oclif/core/lib/interfaces';
|
|
2
3
|
export default class RemoveCommand extends Command {
|
|
3
4
|
static description: string;
|
|
5
|
+
static state: string;
|
|
6
|
+
static deprecationOptions: Deprecation;
|
|
4
7
|
static args: {
|
|
5
8
|
'subgraph-name': import("@oclif/core/lib/interfaces/parser").Arg<string, Record<string, unknown>>;
|
|
6
9
|
};
|
package/dist/commands/remove.js
CHANGED
|
@@ -58,6 +58,10 @@ class RemoveCommand extends core_1.Command {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
RemoveCommand.description = 'Unregisters a subgraph name';
|
|
61
|
+
RemoveCommand.state = 'deprecated';
|
|
62
|
+
RemoveCommand.deprecationOptions = {
|
|
63
|
+
message: 'In next major version, this command will be merged as a subcommand for `graph local`.',
|
|
64
|
+
};
|
|
61
65
|
RemoveCommand.args = {
|
|
62
66
|
'subgraph-name': core_1.Args.string({
|
|
63
67
|
required: true,
|
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' || protocol.name == 'substreams/triggers') {
|
|
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,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
|
|
@@ -435,12 +438,18 @@ class Compiler {
|
|
|
435
438
|
}
|
|
436
439
|
}
|
|
437
440
|
// Upload all mappings
|
|
438
|
-
if (this.protocol.name === 'substreams') {
|
|
441
|
+
if (this.protocol.name === 'substreams' || this.protocol.name === 'substreams/triggers') {
|
|
439
442
|
for (const [i, dataSource] of subgraph.get('dataSources').entries()) {
|
|
440
443
|
updates.push({
|
|
441
444
|
keyPath: ['dataSources', i, 'source', 'package', 'file'],
|
|
442
445
|
value: await this._uploadFileToIPFS(dataSource.getIn(['source', 'package', 'file']), uploadedFiles, spinner),
|
|
443
446
|
});
|
|
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
|
+
}
|
|
444
453
|
}
|
|
445
454
|
}
|
|
446
455
|
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(datasource: any);
|
|
10
10
|
static availableProtocols(): immutable.Collection<ProtocolName, string[]>;
|
|
11
|
-
static availableNetworks(): immutable.Map<"ethereum" | "arweave" | "near" | "cosmos" | "substreams", immutable.List<string>>;
|
|
11
|
+
static availableNetworks(): immutable.Map<"ethereum" | "arweave" | "near" | "cosmos" | "substreams" | "substreams/triggers", 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' | 'substreams/triggers';
|
|
29
29
|
export interface ProtocolConfig {
|
|
30
30
|
displayName: string;
|
|
31
31
|
abi?: any;
|
package/dist/protocols/index.js
CHANGED
|
@@ -50,11 +50,18 @@ 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 firstDataSource = dataSourcesAndTemplates[0];
|
|
54
|
+
return new Protocol(firstDataSource);
|
|
55
55
|
}
|
|
56
|
-
constructor(
|
|
56
|
+
constructor(datasource) {
|
|
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;
|
|
57
63
|
this.name = Protocol.normalizeName(name);
|
|
64
|
+
protocolDebug('Initializing protocol %s', this.name);
|
|
58
65
|
switch (this.name) {
|
|
59
66
|
case 'arweave':
|
|
60
67
|
this.config = arweaveProtocol;
|
|
@@ -70,6 +77,13 @@ class Protocol {
|
|
|
70
77
|
break;
|
|
71
78
|
case 'substreams':
|
|
72
79
|
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
|
+
}
|
|
73
87
|
break;
|
|
74
88
|
default:
|
|
75
89
|
// Do not throw when undefined, a better error message is printed after the constructor
|
|
@@ -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
|
}
|
package/dist/subgraph.js
CHANGED
|
@@ -60,7 +60,9 @@ 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',
|
|
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'));
|
|
64
66
|
// Obtain the root `SubgraphManifest` type from the schema
|
|
65
67
|
const rootType = schema.definitions.find(definition => {
|
|
66
68
|
// @ts-expect-error TODO: name field does not exist on definition, really?
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.63.0-alpha-
|
|
2
|
+
"version": "0.63.0-alpha-20231207185752-5284a6d",
|
|
3
3
|
"commands": {
|
|
4
4
|
"add": {
|
|
5
5
|
"id": "add",
|
|
@@ -86,7 +86,10 @@
|
|
|
86
86
|
"options": [
|
|
87
87
|
"subgraph-studio",
|
|
88
88
|
"hosted-service"
|
|
89
|
-
]
|
|
89
|
+
],
|
|
90
|
+
"deprecated": {
|
|
91
|
+
"message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/"
|
|
92
|
+
}
|
|
90
93
|
},
|
|
91
94
|
"studio": {
|
|
92
95
|
"name": "studio",
|
|
@@ -95,7 +98,10 @@
|
|
|
95
98
|
"allowNo": false,
|
|
96
99
|
"exclusive": [
|
|
97
100
|
"product"
|
|
98
|
-
]
|
|
101
|
+
],
|
|
102
|
+
"deprecated": {
|
|
103
|
+
"message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/"
|
|
104
|
+
}
|
|
99
105
|
}
|
|
100
106
|
},
|
|
101
107
|
"args": {
|
|
@@ -288,7 +294,11 @@
|
|
|
288
294
|
"pluginName": "@graphprotocol/graph-cli",
|
|
289
295
|
"pluginAlias": "@graphprotocol/graph-cli",
|
|
290
296
|
"pluginType": "core",
|
|
297
|
+
"state": "deprecated",
|
|
291
298
|
"aliases": [],
|
|
299
|
+
"deprecationOptions": {
|
|
300
|
+
"message": "In next major version, this command will be merged as a subcommand for `graph local`."
|
|
301
|
+
},
|
|
292
302
|
"flags": {
|
|
293
303
|
"help": {
|
|
294
304
|
"name": "help",
|
|
@@ -373,12 +383,14 @@
|
|
|
373
383
|
"access-token": {
|
|
374
384
|
"name": "access-token",
|
|
375
385
|
"type": "option",
|
|
376
|
-
"summary": "Graph access key. DEPRECATED: Use \"--deploy-key\" instead.",
|
|
377
386
|
"multiple": false,
|
|
378
387
|
"exclusive": [
|
|
379
388
|
"deploy-key"
|
|
380
389
|
],
|
|
381
|
-
"deprecated":
|
|
390
|
+
"deprecated": {
|
|
391
|
+
"to": "deploy-key",
|
|
392
|
+
"message": "In next version, we are removing this flag in favor of '--deploy-key'"
|
|
393
|
+
}
|
|
382
394
|
},
|
|
383
395
|
"version-label": {
|
|
384
396
|
"name": "version-label",
|
|
@@ -505,7 +517,10 @@
|
|
|
505
517
|
"options": [
|
|
506
518
|
"subgraph-studio",
|
|
507
519
|
"hosted-service"
|
|
508
|
-
]
|
|
520
|
+
],
|
|
521
|
+
"deprecated": {
|
|
522
|
+
"message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/"
|
|
523
|
+
}
|
|
509
524
|
},
|
|
510
525
|
"studio": {
|
|
511
526
|
"name": "studio",
|
|
@@ -514,7 +529,10 @@
|
|
|
514
529
|
"allowNo": false,
|
|
515
530
|
"exclusive": [
|
|
516
531
|
"product"
|
|
517
|
-
]
|
|
532
|
+
],
|
|
533
|
+
"deprecated": {
|
|
534
|
+
"message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/"
|
|
535
|
+
}
|
|
518
536
|
},
|
|
519
537
|
"node": {
|
|
520
538
|
"name": "node",
|
|
@@ -527,7 +545,10 @@
|
|
|
527
545
|
"name": "allow-simple-name",
|
|
528
546
|
"type": "boolean",
|
|
529
547
|
"description": "Use a subgraph name without a prefix.",
|
|
530
|
-
"allowNo": false
|
|
548
|
+
"allowNo": false,
|
|
549
|
+
"deprecated": {
|
|
550
|
+
"message": "In next major version, this flag will be removed. By default we will deploy to the Graph Studio. Learn more about Sunrise of Decentralized Data https://thegraph.com/blog/unveiling-updated-sunrise-decentralized-data/"
|
|
551
|
+
}
|
|
531
552
|
},
|
|
532
553
|
"from-contract": {
|
|
533
554
|
"name": "from-contract",
|
|
@@ -573,6 +594,15 @@
|
|
|
573
594
|
"summary": "Skip installing dependencies.",
|
|
574
595
|
"allowNo": false
|
|
575
596
|
},
|
|
597
|
+
"skip-git": {
|
|
598
|
+
"name": "skip-git",
|
|
599
|
+
"type": "boolean",
|
|
600
|
+
"summary": "Skip initializing a Git repository.",
|
|
601
|
+
"allowNo": false,
|
|
602
|
+
"deprecated": {
|
|
603
|
+
"message": "In next major version, this flag will be removed. By default we will stop initializing a Git repository."
|
|
604
|
+
}
|
|
605
|
+
},
|
|
576
606
|
"start-block": {
|
|
577
607
|
"name": "start-block",
|
|
578
608
|
"type": "option",
|
|
@@ -769,7 +799,11 @@
|
|
|
769
799
|
"pluginName": "@graphprotocol/graph-cli",
|
|
770
800
|
"pluginAlias": "@graphprotocol/graph-cli",
|
|
771
801
|
"pluginType": "core",
|
|
802
|
+
"state": "deprecated",
|
|
772
803
|
"aliases": [],
|
|
804
|
+
"deprecationOptions": {
|
|
805
|
+
"message": "In next major version, this command will be merged as a subcommand for `graph local`."
|
|
806
|
+
},
|
|
773
807
|
"flags": {
|
|
774
808
|
"help": {
|
|
775
809
|
"name": "help",
|
package/package.json
CHANGED