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

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,13 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.69.0-alpha-20240222193216-9c4dbba
4
+
5
+ ### Minor Changes
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
10
+
3
11
  ## 0.68.2
4
12
 
5
13
  ### Patch Changes
@@ -44,7 +44,12 @@ 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
- const protocolChoices = Array.from(protocols_1.default.availableProtocols().keys());
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');
48
53
  const initDebugger = (0, debug_1.default)('graph-cli:commands:init');
49
54
  /**
50
55
  * a dynamic list of available networks supported by the studio
@@ -0,0 +1,50 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,20 @@
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;
@@ -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';
28
+ export type ProtocolName = 'arweave' | 'ethereum' | 'near' | 'cosmos' | 'substreams' | 'substreams/triggers' | 'dataset';
29
29
  export interface ProtocolConfig {
30
30
  displayName: string;
31
31
  abi?: any;
@@ -34,19 +34,20 @@ 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"));
37
38
  const abi_1 = __importDefault(require("./ethereum/abi"));
38
39
  const template_1 = __importDefault(require("./ethereum/codegen/template"));
39
40
  const contract_1 = __importDefault(require("./ethereum/contract"));
40
41
  const EthereumManifestScaffold = __importStar(require("./ethereum/scaffold/manifest"));
41
42
  const EthereumMappingScaffold = __importStar(require("./ethereum/scaffold/mapping"));
42
- const subgraph_3 = __importDefault(require("./ethereum/subgraph"));
43
+ const subgraph_4 = __importDefault(require("./ethereum/subgraph"));
43
44
  const type_generator_1 = __importDefault(require("./ethereum/type-generator"));
44
45
  const contract_2 = __importDefault(require("./near/contract"));
45
46
  const NearManifestScaffold = __importStar(require("./near/scaffold/manifest"));
46
47
  const NearMappingScaffold = __importStar(require("./near/scaffold/mapping"));
47
- const subgraph_4 = __importDefault(require("./near/subgraph"));
48
+ const subgraph_5 = __importDefault(require("./near/subgraph"));
48
49
  const SubstreamsManifestScaffold = __importStar(require("./substreams/scaffold/manifest"));
49
- const subgraph_5 = __importDefault(require("./substreams/subgraph"));
50
+ const subgraph_6 = __importDefault(require("./substreams/subgraph"));
50
51
  const protocolDebug = (0, debug_1.default)('graph-cli:protocol');
51
52
  class Protocol {
52
53
  static fromDataSources(dataSourcesAndTemplates) {
@@ -75,6 +76,9 @@ class Protocol {
75
76
  case 'near':
76
77
  this.config = nearProtocol;
77
78
  break;
79
+ case 'dataset':
80
+ this.config = datasetProtocol;
81
+ break;
78
82
  case 'substreams':
79
83
  this.config = substreamsProtocol;
80
84
  /**
@@ -99,6 +103,7 @@ class Protocol {
99
103
  near: ['near'],
100
104
  cosmos: ['cosmos'],
101
105
  substreams: ['substreams'],
106
+ dataset: ['dataset'],
102
107
  });
103
108
  }
104
109
  static availableNetworks() {
@@ -250,7 +255,7 @@ const ethereumProtocol = {
250
255
  return new type_generator_1.default(options);
251
256
  },
252
257
  getSubgraph(options) {
253
- return new subgraph_3.default(options);
258
+ return new subgraph_4.default(options);
254
259
  },
255
260
  manifestScaffold: EthereumManifestScaffold,
256
261
  mappingScaffold: EthereumMappingScaffold,
@@ -262,7 +267,7 @@ const nearProtocol = {
262
267
  getTypeGenerator: undefined,
263
268
  getTemplateCodeGen: undefined,
264
269
  getSubgraph(options) {
265
- return new subgraph_4.default(options);
270
+ return new subgraph_5.default(options);
266
271
  },
267
272
  manifestScaffold: NearManifestScaffold,
268
273
  mappingScaffold: NearMappingScaffold,
@@ -274,9 +279,21 @@ const substreamsProtocol = {
274
279
  getTypeGenerator: undefined,
275
280
  getTemplateCodeGen: undefined,
276
281
  getSubgraph(options) {
277
- return new subgraph_5.default(options);
282
+ return new subgraph_6.default(options);
278
283
  },
279
284
  manifestScaffold: SubstreamsManifestScaffold,
280
285
  mappingScaffold: undefined,
281
286
  };
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
+ };
282
299
  protocolDebug('Available networks %M', Protocol.availableNetworks());
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.68.2",
2
+ "version": "0.69.0-alpha-20240222193216-9c4dbba",
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.68.2",
3
+ "version": "0.69.0-alpha-20240222193216-9c4dbba",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {