@graphprotocol/graph-cli 0.49.0-alpha-20230427181905-94ca8fc → 0.49.0-alpha-20230501184859-1f24d05

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,13 +1,13 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.49.0-alpha-20230427181905-94ca8fc
3
+ ## 0.49.0-alpha-20230501184859-1f24d05
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - [#1306](https://github.com/graphprotocol/graph-tooling/pull/1306)
8
- [`f106dbf`](https://github.com/graphprotocol/graph-tooling/commit/f106dbf7e39d9c430c255f3eaafb591080c69e86)
9
- Thanks [@saihaj](https://github.com/saihaj)! - Add loadInBlock function for entities as part of
10
- codegen
7
+ - [#1327](https://github.com/graphprotocol/graph-tooling/pull/1327)
8
+ [`1288a95`](https://github.com/graphprotocol/graph-tooling/commit/1288a95721c0d601253e8ef041479f3c9784eadd)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - do not generate types, instead show a message to
10
+ user to use substreams CLI for codegen.
11
11
 
12
12
  ## 0.48.0
13
13
 
@@ -138,9 +138,6 @@ class SchemaCodeGenerator {
138
138
  \`Entities of type ${entityName} must have an ID of type ${idField.gqlTypeName()} but the id '\${id.displayData()}' is of type \${id.displayKind()}\`)
139
139
  store.set('${entityName}', ${idField.tsValueToString()}, this)
140
140
  }`),
141
- tsCodegen.staticMethod('loadInBlock', [tsCodegen.param('id', tsCodegen.namedType(idField.typeName()))], tsCodegen.nullableType(tsCodegen.namedType(entityName)), `
142
- return changetype<${entityName} | null>(store.get_in_block('${entityName}', ${idField.tsToString()}))
143
- `),
144
141
  tsCodegen.staticMethod('load', [tsCodegen.param('id', tsCodegen.namedType(idField.typeName()))], tsCodegen.nullableType(tsCodegen.namedType(entityName)), `
145
142
  return changetype<${entityName} | null>(store.get('${entityName}', ${idField.tsToString()}))
146
143
  `),
@@ -128,15 +128,6 @@ describe('Schema code generator', () => {
128
128
  \`Entities of type Account must have an ID of type String but the id '\${id.displayData()}' is of type \${id.displayKind()}\`)
129
129
  store.set('Account', id.toString(), this)
130
130
  }
131
- `,
132
- },
133
- {
134
- name: 'loadInBlock',
135
- static: true,
136
- params: [new typescript_1.Param('id', new typescript_1.NamedType('string'))],
137
- returnType: new typescript_1.NullableType(new typescript_1.NamedType('Account')),
138
- body: `
139
- return changetype<Account | null>(store.get_in_block('Account', id))
140
131
  `,
141
132
  },
142
133
  {
@@ -316,15 +307,6 @@ describe('Schema code generator', () => {
316
307
  \`Entities of type Wallet must have an ID of type String but the id '\${id.displayData()}' is of type \${id.displayKind()}\`)
317
308
  store.set('Wallet', id.toString(), this)
318
309
  }
319
- `,
320
- },
321
- {
322
- name: 'loadInBlock',
323
- static: true,
324
- params: [new typescript_1.Param('id', new typescript_1.NamedType('string'))],
325
- returnType: new typescript_1.NullableType(new typescript_1.NamedType('Wallet')),
326
- body: `
327
- return changetype<Wallet | null>(store.get_in_block('Wallet', id))
328
310
  `,
329
311
  },
330
312
  {
@@ -443,15 +425,6 @@ describe('Schema code generator', () => {
443
425
  " store.set('Task', id.toBytes().toHexString(), this)\n" +
444
426
  ' }',
445
427
  },
446
- {
447
- name: 'loadInBlock',
448
- static: true,
449
- params: [new typescript_1.Param('id', new typescript_1.NamedType('Bytes'))],
450
- returnType: new typescript_1.NullableType(new typescript_1.NamedType('Task')),
451
- body: '\n' +
452
- " return changetype<Task | null>(store.get_in_block('Task', id.toHexString()))\n" +
453
- ' ',
454
- },
455
428
  {
456
429
  name: 'load',
457
430
  static: true,
@@ -16,7 +16,7 @@ export default class TypeGenerator {
16
16
  private protocol;
17
17
  private protocolTypeGenerator;
18
18
  constructor(options: TypeGeneratorOptions);
19
- generateTypes(): Promise<boolean>;
19
+ generateTypes(): Promise<boolean | undefined>;
20
20
  generateUncrashableEntities(graphSchema: any): Promise<any>;
21
21
  loadSubgraph({ quiet }?: {
22
22
  quiet: boolean;
@@ -58,6 +58,10 @@ class TypeGenerator {
58
58
  });
59
59
  }
60
60
  async generateTypes() {
61
+ if (this.protocol.name === 'substreams') {
62
+ toolbox.print.warning('No types generated for Substreams. Use the Substreams CLI for codegen.');
63
+ return;
64
+ }
61
65
  try {
62
66
  if (!this.options.skipMigrations && this.options.subgraphManifest) {
63
67
  await (0, migrations_1.applyMigrations)({
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.49.0-alpha-20230427181905-94ca8fc",
2
+ "version": "0.49.0-alpha-20230501184859-1f24d05",
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.49.0-alpha-20230427181905-94ca8fc",
3
+ "version": "0.49.0-alpha-20230501184859-1f24d05",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {