@graphprotocol/graph-cli 0.25.3 → 0.28.0

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.
Files changed (37) hide show
  1. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/ethereum.ts +1 -1
  2. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/tendermint.ts +554 -0
  3. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/collections.ts +52 -2
  4. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/numbers.ts +11 -0
  5. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/value.ts +47 -0
  6. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/global/global.ts +150 -1
  7. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/index.ts +2 -0
  8. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/package.json +2 -1
  9. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/test/test.js +2 -0
  10. package/examples/basic-event-handlers/package.json +5 -5
  11. package/examples/basic-event-handlers/yarn.lock +12 -12
  12. package/examples/example-subgraph/package.json +1 -1
  13. package/examples/example-subgraph/yarn.lock +4 -4
  14. package/package.json +27 -24
  15. package/src/codegen/schema.js +104 -25
  16. package/src/codegen/schema.test.js +3 -7
  17. package/src/commands/deploy.js +3 -1
  18. package/src/commands/init.js +2 -0
  19. package/src/commands/test.js +82 -59
  20. package/src/protocols/ethereum/codegen/abi.js +72 -2
  21. package/src/protocols/ethereum/manifest.graphql +92 -0
  22. package/src/protocols/index.js +41 -7
  23. package/src/protocols/near/manifest.graphql +57 -0
  24. package/src/protocols/tendermint/contract.js +12 -0
  25. package/src/protocols/tendermint/manifest.graphql +64 -0
  26. package/src/protocols/tendermint/subgraph.js +20 -0
  27. package/src/scaffold/index.js +1 -1
  28. package/src/subgraph.js +18 -13
  29. package/src/validation/manifest.js +29 -8
  30. package/src/validation/schema.js +120 -119
  31. package/tests/cli/validation/example-values-found.stderr +2 -2
  32. package/tests/cli/validation/invalid-manifest/subgraph.yaml +2 -1
  33. package/tests/cli/validation/invalid-manifest-cannot-infer-protocol/subgraph.yaml +12 -0
  34. package/tests/cli/validation/invalid-manifest-cannot-infer-protocol.stderr +5 -0
  35. package/tests/cli/validation/invalid-manifest.stderr +0 -3
  36. package/tests/cli/validation.test.js +8 -0
  37. package/manifest-schema.graphql +0 -122
@@ -0,0 +1,12 @@
1
+ module.exports = class TendermintContract {
2
+ static identifierName() {
3
+ return 'address'
4
+ }
5
+
6
+ validate() {
7
+ return {
8
+ valid: true,
9
+ error: null,
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,64 @@
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
+
11
+ type SubgraphManifest {
12
+ specVersion: String!
13
+ schema: Schema!
14
+ description: String
15
+ repository: String
16
+ graft: Graft
17
+ dataSources: [DataSource!]!
18
+ }
19
+
20
+ type Schema {
21
+ file: File!
22
+ }
23
+
24
+ type DataSource {
25
+ kind: String!
26
+ name: String!
27
+ network: String
28
+ source: ContractSource!
29
+ mapping: ContractMapping!
30
+ }
31
+
32
+ type ContractSource {
33
+ startBlock: BigInt
34
+ }
35
+
36
+ type ContractMapping {
37
+ apiVersion: String!
38
+ language: String!
39
+ file: File!
40
+ entities: [String!]!
41
+ blockHandlers: [BlockHandler!]
42
+ eventHandlers: [EventHandler!]
43
+ }
44
+
45
+ type BlockHandler {
46
+ handler: String!
47
+ }
48
+
49
+ enum EventOrigin {
50
+ BeginBlock
51
+ DeliverTx
52
+ EndBlock
53
+ }
54
+
55
+ type EventHandler {
56
+ event: String!
57
+ origin: EventOrigin
58
+ handler: String!
59
+ }
60
+
61
+ type Graft {
62
+ base: String!
63
+ block: BigInt!
64
+ }
@@ -0,0 +1,20 @@
1
+ const immutable = require('immutable')
2
+
3
+ module.exports = class TendermintSubgraph {
4
+ constructor(options = {}) {
5
+ this.manifest = options.manifest
6
+ this.resolveFile = options.resolveFile
7
+ this.protocol = options.protocol
8
+ }
9
+
10
+ validateManifest() {
11
+ return immutable.List()
12
+ }
13
+
14
+ handlerTypes() {
15
+ return immutable.List([
16
+ 'blockHandlers',
17
+ 'eventHandlers',
18
+ ])
19
+ }
20
+ }
@@ -50,7 +50,7 @@ module.exports = class Scaffold {
50
50
  },
51
51
  dependencies: {
52
52
  '@graphprotocol/graph-cli': GRAPH_CLI_VERSION,
53
- '@graphprotocol/graph-ts': `0.24.1`,
53
+ '@graphprotocol/graph-ts': `0.26.0`,
54
54
  },
55
55
  }),
56
56
  { parser: 'json' },
package/src/subgraph.js CHANGED
@@ -27,7 +27,7 @@ const buildCombinedWarning = (filename, warnings) =>
27
27
  ? warnings.reduce(
28
28
  (msg, w) =>
29
29
  `${msg}
30
-
30
+
31
31
  Path: ${w.get('path').size === 0 ? '/' : w.get('path').join(' > ')}
32
32
  ${w
33
33
  .get('message')
@@ -39,9 +39,21 @@ const buildCombinedWarning = (filename, warnings) =>
39
39
 
40
40
  module.exports = class Subgraph {
41
41
  static async validate(data, protocol, { resolveFile }) {
42
+ if (protocol.name == null) {
43
+ return immutable.fromJS([
44
+ {
45
+ path: [],
46
+ message: `Unable to determine for which protocol manifest file is built for. Ensure you have at least one 'dataSources' and/or 'templates' elements defined in your subgraph.`,
47
+ },
48
+ ])
49
+ }
50
+
42
51
  // Parse the default subgraph schema
43
52
  let schema = graphql.parse(
44
- await fs.readFile(path.join(__dirname, '..', 'manifest-schema.graphql'), 'utf-8'),
53
+ await fs.readFile(
54
+ path.join(__dirname, 'protocols', protocol.name, `manifest.graphql`),
55
+ 'utf-8',
56
+ ),
45
57
  )
46
58
 
47
59
  // Obtain the root `SubgraphManifest` type from the schema
@@ -146,10 +158,7 @@ At least one such handler must be defined.`,
146
158
  }
147
159
 
148
160
  static validateContractValues(manifest, protocol) {
149
- return validation.validateContractValues(
150
- manifest,
151
- protocol,
152
- )
161
+ return validation.validateContractValues(manifest, protocol)
153
162
  }
154
163
 
155
164
  // Validate that data source names are unique, so they don't overwrite each other.
@@ -200,17 +209,13 @@ More than one template named '${name}', template names must be unique.`,
200
209
  return yaml.stringify(manifest.toJS())
201
210
  }
202
211
 
203
- static async load(
204
- filename,
205
- { protocol, skipValidation } = { skipValidation: false }
206
- ) {
212
+ static async load(filename, { protocol, skipValidation } = { skipValidation: false }) {
207
213
  // Load and validate the manifest
208
214
  let data = null
209
215
 
210
- if(filename.match(/.js$/)) {
216
+ if (filename.match(/.js$/)) {
211
217
  data = require(path.resolve(filename))
212
- }
213
- else {
218
+ } else {
214
219
  data = yaml.parse(await fs.readFile(filename, 'utf-8'))
215
220
  }
216
221
 
@@ -52,8 +52,7 @@ const validators = immutable.fromJS({
52
52
  validators.get(ctx.getIn(['type', 'name', 'value']))(value, ctx),
53
53
 
54
54
  UnionTypeDefinition: (value, ctx) => {
55
- const unionVariants = ctx
56
- .getIn(['type', 'types'])
55
+ const unionVariants = ctx.getIn(['type', 'types'])
57
56
 
58
57
  let errors = List()
59
58
 
@@ -78,7 +77,10 @@ const validators = immutable.fromJS({
78
77
 
79
78
  NonNullType: (value, ctx) =>
80
79
  value !== null && value !== undefined
81
- ? validateValue(value, ctx.update('type', type => type.get('type')))
80
+ ? validateValue(
81
+ value,
82
+ ctx.update('type', type => type.get('type')),
83
+ )
82
84
  : immutable.fromJS([
83
85
  {
84
86
  path: ctx.get('path'),
@@ -126,7 +128,7 @@ const validators = immutable.fromJS({
126
128
  ),
127
129
  )
128
130
  : errors.push(
129
- key == 'templates'
131
+ key == 'templates' && ctx.get('protocol').hasTemplates()
130
132
  ? immutable.fromJS({
131
133
  path: ctx.get('path'),
132
134
  message:
@@ -149,6 +151,23 @@ const validators = immutable.fromJS({
149
151
  ])
150
152
  },
151
153
 
154
+ EnumTypeDefinition: (value, ctx) => {
155
+ const enumValues = ctx.getIn(['type', 'values']).map((v) => {
156
+ return v.getIn(['name', 'value'])
157
+ })
158
+
159
+ const allowedValues = enumValues.toArray().join(', ')
160
+
161
+ return enumValues.includes(value)
162
+ ? List()
163
+ : immutable.fromJS([
164
+ {
165
+ path: ctx.get('path'),
166
+ message: `Unexpected enum value: ${value}, allowed values: ${allowedValues}`,
167
+ },
168
+ ])
169
+ },
170
+
152
171
  String: (value, ctx) =>
153
172
  typeof value === 'string'
154
173
  ? List()
@@ -211,7 +230,8 @@ const validateValue = (value, ctx) => {
211
230
  }
212
231
 
213
232
  const validateDataSourceForNetwork = (dataSources, protocol) =>
214
- dataSources.filter(dataSource => protocol.isValidKindName(dataSource.kind))
233
+ dataSources
234
+ .filter(dataSource => protocol.isValidKindName(dataSource.kind))
215
235
  .reduce(
216
236
  (networks, dataSource) =>
217
237
  networks.update(dataSource.network, dataSources =>
@@ -235,11 +255,11 @@ const validateDataSourceNetworks = (value, protocol) => {
235
255
  ${networks
236
256
  .map(
237
257
  (dataSources, network) =>
238
- ` ${
258
+ ` ${
239
259
  network === undefined
240
260
  ? 'Data sources and templates having no network set'
241
- : `Data sources and templates using '${network}'`
242
- }:\n${dataSources.map(ds => ` - ${ds}`).join('\n')}`,
261
+ : `Data sources and templates using '${network}'`
262
+ }:\n${dataSources.map(ds => ` - ${ds}`).join('\n')}`,
243
263
  )
244
264
  .join('\n')}
245
265
  Recommendation: Make all data sources and templates use the same network name.`,
@@ -262,6 +282,7 @@ const validateManifest = (value, type, schema, protocol, { resolveFile }) => {
262
282
  path: [],
263
283
  errors: [],
264
284
  resolveFile,
285
+ protocol,
265
286
  }),
266
287
  )
267
288
  : immutable.fromJS([
@@ -76,12 +76,12 @@ const validateEntityDirective = def =>
76
76
  def.directives.find(directive => directive.name.value === 'entity')
77
77
  ? List()
78
78
  : immutable.fromJS([
79
- {
80
- loc: def.loc,
81
- entity: def.name.value,
82
- message: `Defined without @entity directive`,
83
- },
84
- ])
79
+ {
80
+ loc: def.loc,
81
+ entity: def.name.value,
82
+ message: `Defined without @entity directive`,
83
+ },
84
+ ])
85
85
 
86
86
  const validateEntityID = def => {
87
87
  let idField = def.fields.find(field => field.name.value === 'id')
@@ -99,7 +99,9 @@ const validateEntityID = def => {
99
99
  if (
100
100
  idField.type.kind === 'NonNullType' &&
101
101
  idField.type.type.kind === 'NamedType' &&
102
- idField.type.type.name.value === 'ID'
102
+ (idField.type.type.name.value === 'ID' ||
103
+ idField.type.type.name.value === 'Bytes' ||
104
+ idField.type.type.name.value === 'String')
103
105
  ) {
104
106
  return List()
105
107
  } else {
@@ -107,7 +109,7 @@ const validateEntityID = def => {
107
109
  {
108
110
  loc: idField.loc,
109
111
  entity: def.name.value,
110
- message: `Field 'id': Entity IDs must be of type ID!`,
112
+ message: `Field 'id': Entity ids must be of type Bytes! or String!`,
111
113
  },
112
114
  ])
113
115
  }
@@ -115,22 +117,22 @@ const validateEntityID = def => {
115
117
 
116
118
  const validateListFieldType = (def, field) =>
117
119
  field.type.kind === 'NonNullType' &&
118
- field.type.kind === 'ListType' &&
119
- field.type.type.kind !== 'NonNullType'
120
+ field.type.kind === 'ListType' &&
121
+ field.type.type.kind !== 'NonNullType'
120
122
  ? immutable.fromJS([
121
- {
122
- loc: field.loc,
123
- entity: def.name.value,
124
- message: `\
123
+ {
124
+ loc: field.loc,
125
+ entity: def.name.value,
126
+ message: `\
125
127
  Field '${field.name.value}':
126
128
  Field has type [${field.type.type.name.value}]! but
127
129
  must have type [${field.type.type.name.value}!]!
128
130
 
129
131
  Reason: Lists with null elements are not supported.`,
130
- },
131
- ])
132
+ },
133
+ ])
132
134
  : field.type.kind === 'ListType' && field.type.type.kind !== 'NonNullType'
133
- ? immutable.fromJS([
135
+ ? immutable.fromJS([
134
136
  {
135
137
  loc: field.loc,
136
138
  entity: def.name.value,
@@ -142,7 +144,7 @@ must have type [${field.type.type.name.value}!]
142
144
  Reason: Lists with null elements are not supported.`,
143
145
  },
144
146
  ])
145
- : List()
147
+ : List()
146
148
 
147
149
  const unwrapType = type => {
148
150
  let innerTypeFromList = listType =>
@@ -159,8 +161,8 @@ const unwrapType = type => {
159
161
  return type.kind === 'NonNullType'
160
162
  ? innerTypeFromNonNull(type)
161
163
  : type.kind === 'ListType'
162
- ? innerTypeFromList(type)
163
- : type
164
+ ? innerTypeFromList(type)
165
+ : type
164
166
  }
165
167
 
166
168
  const gatherLocalTypes = defs =>
@@ -206,8 +208,8 @@ const gatherImportedTypes = defs =>
206
208
  type.fields.find(
207
209
  field => field.name.value == 'as' && field.value.kind == 'StringValue',
208
210
  )
209
- ? type.fields.find(field => field.name.value == 'as').value.value
210
- : undefined,
211
+ ? type.fields.find(field => field.name.value == 'as').value.value
212
+ : undefined,
211
213
  ),
212
214
  ),
213
215
  )
@@ -256,16 +258,15 @@ const validateInnerFieldType = (defs, def, field) => {
256
258
  return availableTypes.includes(typeName)
257
259
  ? List()
258
260
  : immutable.fromJS([
259
- {
260
- loc: field.loc,
261
- entity: def.name.value,
262
- message: `\
261
+ {
262
+ loc: field.loc,
263
+ entity: def.name.value,
264
+ message: `\
263
265
  Field '${field.name.value}': \
264
- Unknown type '${typeName}'.${
265
- suggestion !== undefined ? ` Did you mean '${suggestion}'?` : ''
266
+ Unknown type '${typeName}'.${suggestion !== undefined ? ` Did you mean '${suggestion}'?` : ''
266
267
  }`,
267
- },
268
- ])
268
+ },
269
+ ])
269
270
  }
270
271
 
271
272
  const validateEntityFieldType = (defs, def, field) =>
@@ -277,14 +278,14 @@ const validateEntityFieldType = (defs, def, field) =>
277
278
  const validateEntityFieldArguments = (defs, def, field) =>
278
279
  field.arguments.length > 0
279
280
  ? immutable.fromJS([
280
- {
281
- loc: field.loc,
282
- entity: def.name.value,
283
- message: `\
281
+ {
282
+ loc: field.loc,
283
+ entity: def.name.value,
284
+ message: `\
284
285
  Field '${field.name.value}': \
285
286
  Field arguments are not supported.`,
286
- },
287
- ])
287
+ },
288
+ ])
288
289
  : List()
289
290
 
290
291
  const entityFieldExists = (entityDef, name) =>
@@ -390,23 +391,23 @@ const validateEntityFields = (defs, def) =>
390
391
  const validateNoImportDirective = def =>
391
392
  def.directives.find(directive => directive.name.value == 'import')
392
393
  ? List([
393
- immutable.fromJS({
394
- loc: def.name.loc,
395
- entity: def.name.value,
396
- message: `@import directive only allowed on '${RESERVED_TYPE}' type`,
397
- }),
398
- ])
394
+ immutable.fromJS({
395
+ loc: def.name.loc,
396
+ entity: def.name.value,
397
+ message: `@import directive only allowed on '${RESERVED_TYPE}' type`,
398
+ }),
399
+ ])
399
400
  : List()
400
401
 
401
402
  const validateNoFulltext = def =>
402
403
  def.directives.find(directive => directive.name.value == 'fulltext')
403
404
  ? List([
404
- immutable.fromJS({
405
- loc: def.name.loc,
406
- entity: def.name.value,
407
- message: `@fulltext directive only allowed on '${RESERVED_TYPE}' type`,
408
- }),
409
- ])
405
+ immutable.fromJS({
406
+ loc: def.name.loc,
407
+ entity: def.name.value,
408
+ message: `@fulltext directive only allowed on '${RESERVED_TYPE}' type`,
409
+ }),
410
+ ])
410
411
  : List()
411
412
 
412
413
  const validateFulltextFields = (def, directive) => {
@@ -415,13 +416,13 @@ const validateFulltextFields = (def, directive) => {
415
416
  ['name', 'language', 'algorithm', 'include'].includes(argument.name.value)
416
417
  ? List([])
417
418
  : List([
418
- immutable.fromJS({
419
- loc: directive.name.loc,
420
- entity: def.name.value,
421
- directive: fulltextDirectiveName(directive),
422
- message: `found invalid argument: '${argument.name.value}', @fulltext directives only allow 'name', 'language', 'algorithm', and 'includes' arguments`,
423
- }),
424
- ]),
419
+ immutable.fromJS({
420
+ loc: directive.name.loc,
421
+ entity: def.name.value,
422
+ directive: fulltextDirectiveName(directive),
423
+ message: `found invalid argument: '${argument.name.value}', @fulltext directives only allow 'name', 'language', 'algorithm', and 'includes' arguments`,
424
+ }),
425
+ ]),
425
426
  )
426
427
  }, List([]))
427
428
  }
@@ -431,25 +432,25 @@ const validateFulltextName = (def, directive) => {
431
432
  return name
432
433
  ? validateFulltextArgumentName(def, directive, name)
433
434
  : List([
434
- immutable.fromJS({
435
- loc: directive.name.loc,
436
- entity: def.name.value,
437
- directive: fulltextDirectiveName(directive),
438
- message: `@fulltext argument 'name' must be specified`,
439
- }),
440
- ])
435
+ immutable.fromJS({
436
+ loc: directive.name.loc,
437
+ entity: def.name.value,
438
+ directive: fulltextDirectiveName(directive),
439
+ message: `@fulltext argument 'name' must be specified`,
440
+ }),
441
+ ])
441
442
  }
442
443
 
443
444
  const validateFulltextArgumentName = (def, directive, argument) => {
444
445
  return argument.value.kind != 'StringValue'
445
446
  ? List([
446
- immutable.fromJS({
447
- loc: directive.name.loc,
448
- entity: def.name.value,
449
- directive: fulltextDirectiveName(directive),
450
- message: `@fulltext argument 'name' must be a string`,
451
- }),
452
- ])
447
+ immutable.fromJS({
448
+ loc: directive.name.loc,
449
+ entity: def.name.value,
450
+ directive: fulltextDirectiveName(directive),
451
+ message: `@fulltext argument 'name' must be a string`,
452
+ }),
453
+ ])
453
454
  : List([])
454
455
  }
455
456
 
@@ -463,13 +464,13 @@ const validateFulltextLanguage = (def, directive) => {
463
464
  return language
464
465
  ? validateFulltextArgumentLanguage(def, directive, language)
465
466
  : List([
466
- immutable.fromJS({
467
- loc: directive.name.loc,
468
- entity: def.name.value,
469
- directive: fulltextDirectiveName(directive),
470
- message: `@fulltext argument 'language' must be specified`,
471
- }),
472
- ])
467
+ immutable.fromJS({
468
+ loc: directive.name.loc,
469
+ entity: def.name.value,
470
+ directive: fulltextDirectiveName(directive),
471
+ message: `@fulltext argument 'language' must be specified`,
472
+ }),
473
+ ])
473
474
  }
474
475
 
475
476
  const validateFulltextArgumentLanguage = (def, directive, argument) => {
@@ -521,13 +522,13 @@ const validateFulltextAlgorithm = (def, directive) => {
521
522
  return algorithm
522
523
  ? validateFulltextArgumentAlgorithm(def, directive, algorithm)
523
524
  : List([
524
- immutable.fromJS({
525
- loc: directive.name.loc,
526
- entity: def.name.value,
527
- directive: fulltextDirectiveName(directive),
528
- message: `@fulltext argument 'algorithm' must be specified`,
529
- }),
530
- ])
525
+ immutable.fromJS({
526
+ loc: directive.name.loc,
527
+ entity: def.name.value,
528
+ directive: fulltextDirectiveName(directive),
529
+ message: `@fulltext argument 'algorithm' must be specified`,
530
+ }),
531
+ ])
531
532
  }
532
533
 
533
534
  const validateFulltextArgumentAlgorithm = (def, directive, argument) => {
@@ -740,12 +741,12 @@ const validateImportDirectiveType = (def, directive, type) => {
740
741
  return importDirectiveTypeValidators[type.kind]
741
742
  ? importDirectiveTypeValidators[type.kind](def, directive, type)
742
743
  : List([
743
- immutable.fromJS({
744
- loc: directive.name.loc,
745
- entity: def.name.value,
746
- message: `Import must be one of "Name" or { name: "Name", as: "Alias" }`,
747
- }),
748
- ])
744
+ immutable.fromJS({
745
+ loc: directive.name.loc,
746
+ entity: def.name.value,
747
+ message: `Import must be one of "Name" or { name: "Name", as: "Alias" }`,
748
+ }),
749
+ ])
749
750
  }
750
751
 
751
752
  const validateImportDirectiveArgumentTypes = (def, directive, argument) => {
@@ -815,12 +816,12 @@ const validateImportDirectiveFields = (def, directive) => {
815
816
  ['types', 'from'].includes(argument.name.value)
816
817
  ? List([])
817
818
  : List([
818
- immutable.fromJS({
819
- loc: directive.name.loc,
820
- entity: def.name.value,
821
- message: `found invalid argument: '${argument.name.value}', @import directives only allow 'types' and 'from' arguments`,
822
- }),
823
- ]),
819
+ immutable.fromJS({
820
+ loc: directive.name.loc,
821
+ entity: def.name.value,
822
+ message: `found invalid argument: '${argument.name.value}', @import directives only allow 'types' and 'from' arguments`,
823
+ }),
824
+ ]),
824
825
  )
825
826
  }, List([]))
826
827
  }
@@ -830,12 +831,12 @@ const validateImportDirectiveTypes = (def, directive) => {
830
831
  return types
831
832
  ? validateImportDirectiveArgumentTypes(def, directive, types)
832
833
  : List([
833
- immutable.fromJS({
834
- loc: directive.name.loc,
835
- entity: def.name.value,
836
- message: `@import argument 'types' must be specified`,
837
- }),
838
- ])
834
+ immutable.fromJS({
835
+ loc: directive.name.loc,
836
+ entity: def.name.value,
837
+ message: `@import argument 'types' must be specified`,
838
+ }),
839
+ ])
839
840
  }
840
841
 
841
842
  const validateImportDirectiveFrom = (def, directive) => {
@@ -843,12 +844,12 @@ const validateImportDirectiveFrom = (def, directive) => {
843
844
  return from
844
845
  ? validateImportDirectiveArgumentFrom(def, directive, from)
845
846
  : List([
846
- immutable.fromJS({
847
- loc: directive.name.loc,
848
- entity: def.name.value,
849
- message: `@import argument 'from' must be specified`,
850
- }),
851
- ])
847
+ immutable.fromJS({
848
+ loc: directive.name.loc,
849
+ entity: def.name.value,
850
+ message: `@import argument 'from' must be specified`,
851
+ }),
852
+ ])
852
853
  }
853
854
 
854
855
  const validateImportDirective = (def, directive) =>
@@ -892,12 +893,12 @@ const validateSubgraphSchemaDirectives = def =>
892
893
  const validateTypeHasNoFields = def =>
893
894
  def.fields.length
894
895
  ? List([
895
- immutable.fromJS({
896
- loc: def.name.loc,
897
- entity: def.name.value,
898
- message: `${def.name.value} type is not allowed any fields by convention`,
899
- }),
900
- ])
896
+ immutable.fromJS({
897
+ loc: def.name.loc,
898
+ entity: def.name.value,
899
+ message: `${def.name.value} type is not allowed any fields by convention`,
900
+ }),
901
+ ])
901
902
  : List()
902
903
 
903
904
  const validateAtLeastOneExtensionField = def => List()
@@ -907,12 +908,12 @@ const typeDefinitionValidators = {
907
908
  def.name && def.name.value == RESERVED_TYPE
908
909
  ? List.of(...validateSubgraphSchemaDirectives(def), ...validateTypeHasNoFields(def))
909
910
  : List.of(
910
- ...validateEntityDirective(def),
911
- ...validateEntityID(def),
912
- ...validateEntityFields(defs, def),
913
- ...validateNoImportDirective(def),
914
- ...validateNoFulltext(def),
915
- ),
911
+ ...validateEntityDirective(def),
912
+ ...validateEntityID(def),
913
+ ...validateEntityFields(defs, def),
914
+ ...validateNoImportDirective(def),
915
+ ...validateNoFulltext(def),
916
+ ),
916
917
  ObjectTypeExtension: (_defs, def) => validateAtLeastOneExtensionField(def),
917
918
  }
918
919
 
@@ -1,10 +1,10 @@
1
1
  - Load subgraph from subgraph.yaml
2
2
  ⚠ Warnings while loading subgraph from subgraph.yaml: Warnings in subgraph.yaml:
3
-
3
+
4
4
  Path: repository
5
5
  The repository is still set to https://github.com/graphprotocol/example-subgraph.
6
6
  Please replace it with a link to your subgraph source code.
7
-
7
+
8
8
  Path: description
9
9
  The description is still the one from the example subgraph.
10
10
  Please update it to tell users more about your subgraph.
@@ -1,7 +1,8 @@
1
1
  schema:
2
2
  file: ./non-existent.grapqhl
3
3
  dataSources:
4
- - name: 5
4
+ - kind: ethereum/contract
5
+ name: 5
5
6
  abis:
6
7
  name: Foo
7
8
  mapping: