@graphprotocol/graph-cli 0.64.0-alpha-20231215205836-6d9a26b → 0.64.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.
@@ -67,7 +67,7 @@ class EthereumTypeGenerator {
67
67
  throw Error(`Failed to load data source template ABI: ${e.message}`);
68
68
  }
69
69
  }
70
- async generateTypesForABIs(abis) {
70
+ generateTypesForABIs(abis) {
71
71
  return (0, spinner_1.withSpinner)(`Generate types for contract ABIs`, `Failed to generate types for contract ABIs`, `Warnings while generating types for contract ABIs`, async (spinner) => {
72
72
  return await Promise.all(abis.map(async (abi) => await this._generateTypesForABI(abi, spinner)));
73
73
  });
@@ -76,7 +76,7 @@ class EthereumTypeGenerator {
76
76
  try {
77
77
  (0, spinner_1.step)(spinner, `Generate types for contract ABI:`, `${abi.abi.name} (${(0, fs_1.displayPath)(abi.abi.file)})`);
78
78
  const codeGenerator = abi.abi.codeGenerator();
79
- const code = await prettier_1.default.format([
79
+ const code = prettier_1.default.format([
80
80
  typescript_1.GENERATED_FILE_NOTE,
81
81
  ...codeGenerator.generateModuleImports(),
82
82
  ...codeGenerator.generateTypes(),
@@ -101,7 +101,7 @@ class EthereumTypeGenerator {
101
101
  try {
102
102
  (0, spinner_1.step)(spinner, `Generate types for data source template ABI:`, `${abi.template.get('name')} > ${abi.abi.name} (${(0, fs_1.displayPath)(abi.abi.file)})`);
103
103
  const codeGenerator = abi.abi.codeGenerator();
104
- const code = await prettier_1.default.format([
104
+ const code = prettier_1.default.format([
105
105
  typescript_1.GENERATED_FILE_NOTE,
106
106
  ...codeGenerator.generateModuleImports(),
107
107
  ...codeGenerator.generateTypes(),
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const vitest_1 = require("vitest");
7
6
  const protocols_1 = __importDefault(require("../protocols"));
8
7
  const index_1 = __importDefault(require("./index"));
9
8
  const protocol = new protocols_1.default('cosmos');
@@ -13,9 +12,9 @@ const scaffoldOptions = {
13
12
  contractName: 'CosmosHub',
14
13
  };
15
14
  const scaffold = new index_1.default(scaffoldOptions);
16
- vitest_1.describe.concurrent('Cosmos subgraph scaffolding', () => {
17
- (0, vitest_1.test)('Manifest', async () => {
18
- (0, vitest_1.expect)(await scaffold.generateManifest()).toEqual(`\
15
+ describe('Cosmos subgraph scaffolding', () => {
16
+ test('Manifest', () => {
17
+ expect(scaffold.generateManifest()).toEqual(`\
19
18
  specVersion: 0.0.5
20
19
  schema:
21
20
  file: ./schema.graphql
@@ -35,8 +34,8 @@ dataSources:
35
34
  file: ./src/contract.ts
36
35
  `);
37
36
  });
38
- (0, vitest_1.test)('Schema (default)', async () => {
39
- (0, vitest_1.expect)(await scaffold.generateSchema()).toEqual(`\
37
+ test('Schema (default)', () => {
38
+ expect(scaffold.generateSchema()).toEqual(`\
40
39
  type ExampleEntity @entity {
41
40
  id: ID!
42
41
  block: Bytes!
@@ -44,8 +43,8 @@ type ExampleEntity @entity {
44
43
  }
45
44
  `);
46
45
  });
47
- (0, vitest_1.test)('Mapping (default)', async () => {
48
- (0, vitest_1.expect)(await scaffold.generateMapping()).toEqual(`\
46
+ test('Mapping (default)', () => {
47
+ expect(scaffold.generateMapping()).toEqual(`\
49
48
  import { cosmos, BigInt } from "@graphprotocol/graph-ts"
50
49
  import { ExampleEntity } from "../generated/schema"
51
50
 
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const immutable_1 = __importDefault(require("immutable"));
7
- const vitest_1 = require("vitest");
8
7
  const protocols_1 = __importDefault(require("../protocols"));
9
8
  const abi_1 = __importDefault(require("../protocols/ethereum/abi"));
10
9
  const index_1 = __importDefault(require("./index"));
@@ -70,9 +69,9 @@ const scaffoldWithIndexEvents = new index_1.default({
70
69
  ...scaffoldOptions,
71
70
  indexEvents: true,
72
71
  });
73
- vitest_1.describe.concurrent('Ethereum subgraph scaffolding', () => {
74
- (0, vitest_1.test)('Manifest', async () => {
75
- (0, vitest_1.expect)(await scaffold.generateManifest()).toEqual(`\
72
+ describe('Ethereum subgraph scaffolding', () => {
73
+ test('Manifest', () => {
74
+ expect(scaffold.generateManifest()).toEqual(`\
76
75
  specVersion: 0.0.5
77
76
  schema:
78
77
  file: ./schema.graphql
@@ -102,8 +101,8 @@ dataSources:
102
101
  file: ./src/contract.ts
103
102
  `);
104
103
  });
105
- (0, vitest_1.test)('Schema (default)', async () => {
106
- (0, vitest_1.expect)(await scaffold.generateSchema()).toEqual(`\
104
+ test('Schema (default)', () => {
105
+ expect(scaffold.generateSchema()).toEqual(`\
107
106
  type ExampleEntity @entity {
108
107
  id: Bytes!
109
108
  count: BigInt!
@@ -112,8 +111,8 @@ type ExampleEntity @entity {
112
111
  }
113
112
  `);
114
113
  });
115
- (0, vitest_1.test)('Schema (for indexing events)', async () => {
116
- (0, vitest_1.expect)(await scaffoldWithIndexEvents.generateSchema()).toEqual(`\
114
+ test('Schema (for indexing events)', () => {
115
+ expect(scaffoldWithIndexEvents.generateSchema()).toEqual(`\
117
116
  type ExampleEvent @entity(immutable: true) {
118
117
  id: Bytes!
119
118
  a: BigInt! # uint256
@@ -140,8 +139,8 @@ type ExampleEvent1 @entity(immutable: true) {
140
139
  }
141
140
  `);
142
141
  });
143
- (0, vitest_1.test)('Mapping (default)', async () => {
144
- (0, vitest_1.expect)(await scaffold.generateMapping()).toEqual(`\
142
+ test('Mapping (default)', () => {
143
+ expect(scaffold.generateMapping()).toEqual(`\
145
144
  import { BigInt } from "@graphprotocol/graph-ts"
146
145
  import {
147
146
  Contract,
@@ -196,8 +195,8 @@ export function handleExampleEvent(event: ExampleEvent): void {
196
195
  export function handleExampleEvent1(event: ExampleEvent1): void {}
197
196
  `);
198
197
  });
199
- (0, vitest_1.test)('Mapping (for indexing events)', async () => {
200
- (0, vitest_1.expect)(await scaffoldWithIndexEvents.generateMapping()).toEqual(`\
198
+ test('Mapping (for indexing events)', () => {
199
+ expect(scaffoldWithIndexEvents.generateMapping()).toEqual(`\
201
200
  import {
202
201
  ExampleEvent as ExampleEventEvent,
203
202
  ExampleEvent1 as ExampleEvent1Event
@@ -240,11 +239,11 @@ export function handleExampleEvent1(event: ExampleEvent1Event): void {
240
239
  }
241
240
  `);
242
241
  });
243
- (0, vitest_1.test)('Test Files (default)', async () => {
244
- const files = await scaffoldWithIndexEvents.generateTests();
242
+ test('Test Files (default)', () => {
243
+ const files = scaffoldWithIndexEvents.generateTests();
245
244
  const testFile = files?.['contract.test.ts'];
246
245
  const utilsFile = files?.['contract-utils.ts'];
247
- (0, vitest_1.expect)(testFile).toEqual(`\
246
+ expect(testFile).toEqual(`\
248
247
  import {
249
248
  assert,
250
249
  describe,
@@ -320,7 +319,7 @@ describe("Describe entity assertions", () => {
320
319
  })
321
320
  })
322
321
  `);
323
- (0, vitest_1.expect)(utilsFile).toEqual(`\
322
+ expect(utilsFile).toEqual(`\
324
323
  import { newMockEvent } from "matchstick-as"
325
324
  import { ethereum, BigInt, Bytes } from "@graphprotocol/graph-ts"
326
325
  import { ExampleEvent, ExampleEvent1 } from "../generated/Contract/Contract"
@@ -368,11 +367,11 @@ export function createExampleEvent1Event(a: Bytes): ExampleEvent1 {
368
367
  }
369
368
  `);
370
369
  });
371
- (0, vitest_1.test)('Test Files (for indexing events)', async () => {
372
- const files = await scaffoldWithIndexEvents.generateTests();
370
+ test('Test Files (for indexing events)', () => {
371
+ const files = scaffoldWithIndexEvents.generateTests();
373
372
  const testFile = files?.['contract.test.ts'];
374
373
  const utilsFile = files?.['contract-utils.ts'];
375
- (0, vitest_1.expect)(testFile).toEqual(`\
374
+ expect(testFile).toEqual(`\
376
375
  import {
377
376
  assert,
378
377
  describe,
@@ -448,7 +447,7 @@ describe("Describe entity assertions", () => {
448
447
  })
449
448
  })
450
449
  `);
451
- (0, vitest_1.expect)(utilsFile).toEqual(`\
450
+ expect(utilsFile).toEqual(`\
452
451
  import { newMockEvent } from "matchstick-as"
453
452
  import { ethereum, BigInt, Bytes } from "@graphprotocol/graph-ts"
454
453
  import { ExampleEvent, ExampleEvent1 } from "../generated/Contract/Contract"
@@ -29,37 +29,37 @@ export default class Scaffold {
29
29
  generateManifest(): Promise<string>;
30
30
  generateSchema(): Promise<string>;
31
31
  generateTsConfig(): Promise<string>;
32
- generateMappings(): Promise<{
33
- [x: string]: string;
34
- } | undefined>;
32
+ generateMappings(): {
33
+ [x: string]: Promise<string>;
34
+ } | undefined;
35
35
  generateMapping(): Promise<string>;
36
- generateABIs(): Promise<{
37
- [x: string]: string;
38
- } | undefined>;
39
- generateTests(): Promise<{
40
- [x: string]: string;
41
- } | undefined>;
42
- generate(): Promise<{
43
- 'subgraph.yaml': string;
44
- 'schema.graphql': string;
45
- 'package.json': string;
36
+ generateABIs(): {
37
+ [x: string]: Promise<string>;
38
+ } | undefined;
39
+ generateTests(): {
40
+ [x: string]: Promise<string>;
41
+ } | undefined;
42
+ generate(): {
43
+ 'subgraph.yaml': Promise<string>;
44
+ 'schema.graphql': Promise<string>;
45
+ 'package.json': Promise<string>;
46
46
  'tsconfig.json'?: undefined;
47
47
  src?: undefined;
48
48
  abis?: undefined;
49
49
  tests?: undefined;
50
50
  } | {
51
- 'package.json': string;
52
- 'subgraph.yaml': string;
53
- 'schema.graphql': string;
54
- 'tsconfig.json': string;
51
+ 'package.json': Promise<string>;
52
+ 'subgraph.yaml': Promise<string>;
53
+ 'schema.graphql': Promise<string>;
54
+ 'tsconfig.json': Promise<string>;
55
55
  src: {
56
- [x: string]: string;
56
+ [x: string]: Promise<string>;
57
57
  } | undefined;
58
58
  abis: {
59
- [x: string]: string;
59
+ [x: string]: Promise<string>;
60
60
  } | undefined;
61
61
  tests: {
62
- [x: string]: string;
62
+ [x: string]: Promise<string>;
63
63
  } | undefined;
64
- }>;
64
+ };
65
65
  }
@@ -29,8 +29,8 @@ class Scaffold {
29
29
  this.node = options.node;
30
30
  this.spkgPath = options.spkgPath;
31
31
  }
32
- async generatePackageJson() {
33
- return await prettier_1.default.format(JSON.stringify({
32
+ generatePackageJson() {
33
+ return prettier_1.default.format(JSON.stringify({
34
34
  name: (0, subgraph_1.getSubgraphBasename)(String(this.subgraphName)),
35
35
  license: 'UNLICENSED',
36
36
  scripts: {
@@ -52,8 +52,8 @@ class Scaffold {
52
52
  devDependencies: this.protocol.hasEvents() ? { 'matchstick-as': `0.5.0` } : undefined,
53
53
  }), { parser: 'json' });
54
54
  }
55
- async generatePackageJsonForSubstreams() {
56
- return await prettier_1.default.format(JSON.stringify({
55
+ generatePackageJsonForSubstreams() {
56
+ return prettier_1.default.format(JSON.stringify({
57
57
  name: (0, subgraph_1.getSubgraphBasename)(String(this.subgraphName)),
58
58
  license: 'UNLICENSED',
59
59
  scripts: {
@@ -72,9 +72,9 @@ class Scaffold {
72
72
  },
73
73
  }), { parser: 'json' });
74
74
  }
75
- async generateManifest() {
75
+ generateManifest() {
76
76
  const protocolManifest = this.protocol.getManifestScaffold();
77
- return await prettier_1.default.format(`
77
+ return prettier_1.default.format(`
78
78
  specVersion: 0.0.5
79
79
  schema:
80
80
  file: ./schema.graphql
@@ -86,72 +86,71 @@ dataSources:
86
86
  mapping: ${protocolManifest.mapping(this)}
87
87
  `, { parser: 'yaml' });
88
88
  }
89
- async generateSchema() {
89
+ generateSchema() {
90
90
  const hasEvents = this.protocol.hasEvents();
91
91
  const events = hasEvents ? (0, schema_1.abiEvents)(this.abi).toJS() : [];
92
- return await prettier_1.default.format(hasEvents && this.indexEvents
92
+ return prettier_1.default.format(hasEvents && this.indexEvents
93
93
  ? events
94
94
  .map((event) => (0, schema_1.generateEventType)(event, this.protocol.name, this.contractName))
95
95
  .join('\n\n')
96
96
  : (0, schema_1.generateExampleEntityType)(this.protocol, events), {
97
97
  parser: 'graphql',
98
- trailingComma: 'none',
99
98
  });
100
99
  }
101
- async generateTsConfig() {
102
- return await prettier_1.default.format(JSON.stringify({
100
+ generateTsConfig() {
101
+ return prettier_1.default.format(JSON.stringify({
103
102
  extends: '@graphprotocol/graph-ts/types/tsconfig.base.json',
104
103
  include: ['src', 'tests'],
105
104
  }), { parser: 'json' });
106
105
  }
107
- async generateMappings() {
106
+ generateMappings() {
108
107
  return this.protocol.getMappingScaffold()
109
- ? { [`${gluegun_1.strings.kebabCase(this.contractName)}.ts`]: await this.generateMapping() }
108
+ ? { [`${gluegun_1.strings.kebabCase(this.contractName)}.ts`]: this.generateMapping() }
110
109
  : undefined;
111
110
  }
112
- async generateMapping() {
111
+ generateMapping() {
113
112
  const hasEvents = this.protocol.hasEvents();
114
113
  const events = hasEvents ? (0, schema_1.abiEvents)(this.abi).toJS() : [];
115
114
  const protocolMapping = this.protocol.getMappingScaffold();
116
- return await prettier_1.default.format(hasEvents && this.indexEvents
115
+ return prettier_1.default.format(hasEvents && this.indexEvents
117
116
  ? (0, mapping_1.generateEventIndexingHandlers)(events, this.contractName)
118
117
  : protocolMapping.generatePlaceholderHandlers({
119
118
  ...this,
120
119
  events,
121
- }), { parser: 'typescript', semi: false, trailingComma: 'none' });
120
+ }), { parser: 'typescript', semi: false });
122
121
  }
123
- async generateABIs() {
122
+ generateABIs() {
124
123
  return this.protocol.hasABIs()
125
124
  ? {
126
- [`${this.contractName}.json`]: await prettier_1.default.format(JSON.stringify(this.abi?.data), {
125
+ [`${this.contractName}.json`]: prettier_1.default.format(JSON.stringify(this.abi?.data), {
127
126
  parser: 'json',
128
127
  }),
129
128
  }
130
129
  : undefined;
131
130
  }
132
- async generateTests() {
131
+ generateTests() {
133
132
  const hasEvents = this.protocol.hasEvents();
134
133
  const events = hasEvents ? (0, schema_1.abiEvents)(this.abi).toJS() : [];
135
134
  return events.length > 0
136
- ? await (0, tests_1.generateTestsFiles)(this.contractName, events, this.indexEvents)
135
+ ? (0, tests_1.generateTestsFiles)(this.contractName, events, this.indexEvents)
137
136
  : undefined;
138
137
  }
139
- async generate() {
138
+ generate() {
140
139
  if (this.protocol.name === 'substreams') {
141
140
  return {
142
- 'subgraph.yaml': await this.generateManifest(),
143
- 'schema.graphql': await this.generateSchema(),
144
- 'package.json': await this.generatePackageJsonForSubstreams(),
141
+ 'subgraph.yaml': this.generateManifest(),
142
+ 'schema.graphql': this.generateSchema(),
143
+ 'package.json': this.generatePackageJsonForSubstreams(),
145
144
  };
146
145
  }
147
146
  return {
148
- 'package.json': await this.generatePackageJson(),
149
- 'subgraph.yaml': await this.generateManifest(),
150
- 'schema.graphql': await this.generateSchema(),
151
- 'tsconfig.json': await this.generateTsConfig(),
152
- src: await this.generateMappings(),
153
- abis: await this.generateABIs(),
154
- tests: await this.generateTests(),
147
+ 'package.json': this.generatePackageJson(),
148
+ 'subgraph.yaml': this.generateManifest(),
149
+ 'schema.graphql': this.generateSchema(),
150
+ 'tsconfig.json': this.generateTsConfig(),
151
+ src: this.generateMappings(),
152
+ abis: this.generateABIs(),
153
+ tests: this.generateTests(),
155
154
  };
156
155
  }
157
156
  }
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const vitest_1 = require("vitest");
7
6
  const protocols_1 = __importDefault(require("../protocols"));
8
7
  const index_1 = __importDefault(require("./index"));
9
8
  const protocol = new protocols_1.default('near');
@@ -14,9 +13,9 @@ const scaffoldOptions = {
14
13
  contractName: 'Contract',
15
14
  };
16
15
  const scaffold = new index_1.default(scaffoldOptions);
17
- vitest_1.describe.concurrent('NEAR subgraph scaffolding', () => {
18
- (0, vitest_1.test)('Manifest', async () => {
19
- (0, vitest_1.expect)(await scaffold.generateManifest()).toEqual(`\
16
+ describe('NEAR subgraph scaffolding', () => {
17
+ test('Manifest', () => {
18
+ expect(scaffold.generateManifest()).toEqual(`\
20
19
  specVersion: 0.0.5
21
20
  schema:
22
21
  file: ./schema.graphql
@@ -36,8 +35,8 @@ dataSources:
36
35
  file: ./src/contract.ts
37
36
  `);
38
37
  });
39
- (0, vitest_1.test)('Schema (default)', async () => {
40
- (0, vitest_1.expect)(await scaffold.generateSchema()).toEqual(`\
38
+ test('Schema (default)', () => {
39
+ expect(scaffold.generateSchema()).toEqual(`\
41
40
  type ExampleEntity @entity {
42
41
  id: ID!
43
42
  block: Bytes!
@@ -45,8 +44,8 @@ type ExampleEntity @entity {
45
44
  }
46
45
  `);
47
46
  });
48
- (0, vitest_1.test)('Mapping (default)', async () => {
49
- (0, vitest_1.expect)(await scaffold.generateMapping()).toEqual(`\
47
+ test('Mapping (default)', () => {
48
+ expect(scaffold.generateMapping()).toEqual(`\
50
49
  import { near, BigInt } from "@graphprotocol/graph-ts"
51
50
  import { ExampleEntity } from "../generated/schema"
52
51
 
@@ -1,3 +1,3 @@
1
- export declare const generateTestsFiles: (contract: any, events: any[], indexEvents?: boolean) => Promise<{
2
- [x: string]: string;
3
- }>;
1
+ export declare const generateTestsFiles: (contract: any, events: any[], indexEvents?: boolean) => {
2
+ [x: string]: Promise<string>;
3
+ };
@@ -15,7 +15,7 @@ const VARIABLES_VALUES = {
15
15
  string: 'Example string value',
16
16
  bool: true,
17
17
  };
18
- const generateTestsFiles = async (contract, events, indexEvents) => {
18
+ const generateTestsFiles = (contract, events, indexEvents) => {
19
19
  const eventsTypes = events
20
20
  .flatMap(event => event.inputs.map((input) => {
21
21
  // If the asc type is Array<T> we need to check if T is a native type or a custom graph-ts type
@@ -27,8 +27,8 @@ const generateTestsFiles = async (contract, events, indexEvents) => {
27
27
  .filter(type => !type.startsWith('ethereum.') && !isNativeType(type));
28
28
  const importTypes = [...new Set(eventsTypes)].join(', ');
29
29
  return {
30
- [`${gluegun_1.strings.kebabCase(contract)}.test.ts`]: await prettier_1.default.format(generateExampleTest(contract, events[0], indexEvents, importTypes), { parser: 'typescript', semi: false, trailingComma: 'none' }),
31
- [`${gluegun_1.strings.kebabCase(contract)}-utils.ts`]: await prettier_1.default.format(generateTestHelper(contract, events, importTypes), { parser: 'typescript', semi: false, trailingComma: 'none' }),
30
+ [`${gluegun_1.strings.kebabCase(contract)}.test.ts`]: prettier_1.default.format(generateExampleTest(contract, events[0], indexEvents, importTypes), { parser: 'typescript', semi: false }),
31
+ [`${gluegun_1.strings.kebabCase(contract)}-utils.ts`]: prettier_1.default.format(generateTestHelper(contract, events, importTypes), { parser: 'typescript', semi: false }),
32
32
  };
33
33
  };
34
34
  exports.generateTestsFiles = generateTestsFiles;
@@ -136,7 +136,7 @@ class TypeGenerator {
136
136
  return await (0, spinner_1.withSpinner)(`Generate types for GraphQL schema`, `Failed to generate types for GraphQL schema`, `Warnings while generating types for GraphQL schema`, async (spinner) => {
137
137
  // Generate TypeScript module from schema
138
138
  const codeGenerator = schema.codeGenerator();
139
- const code = await prettier_1.default.format([
139
+ const code = prettier_1.default.format([
140
140
  typescript_1.GENERATED_FILE_NOTE,
141
141
  ...codeGenerator.generateModuleImports(),
142
142
  ...codeGenerator.generateTypes(),
@@ -182,7 +182,7 @@ class TypeGenerator {
182
182
  return acc;
183
183
  }, []);
184
184
  if (!codeSegments.isEmpty()) {
185
- const code = await prettier_1.default.format([typescript_1.GENERATED_FILE_NOTE, ...dedupeModulesImports, ...codeSegments].join('\n'), {
185
+ const code = prettier_1.default.format([typescript_1.GENERATED_FILE_NOTE, ...dedupeModulesImports, ...codeSegments].join('\n'), {
186
186
  parser: 'typescript',
187
187
  });
188
188
  const outputFile = path_1.default.join(this.options.outputDir, 'templates.ts');
@@ -1,40 +1,39 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const vitest_1 = require("vitest");
4
3
  const schema_1 = require("./schema");
5
- vitest_1.describe.concurrent('Schema validation', () => {
6
- (0, vitest_1.test)('Type suggestions', () => {
7
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('Address')).toEqual('Bytes');
8
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('address')).toEqual('Bytes');
9
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('bytes')).toEqual('Bytes');
10
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('string')).toEqual('String');
11
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('bool')).toEqual('Boolean');
12
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('boolean')).toEqual('Boolean');
13
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('float')).toEqual('BigDecimal');
14
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)('Float')).toEqual('BigDecimal');
15
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`int`)).toBe('Int');
16
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`uint`)).toBe('BigInt');
17
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`uint32`)).toBe('BigInt');
18
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`int8`)).toBe('Int8');
19
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`i8`)).toBe('Int8');
20
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`u8`)).toBe('Int8');
21
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`uint8`)).toBe('Int8');
4
+ describe('Schema validation', () => {
5
+ test('Type suggestions', () => {
6
+ expect((0, schema_1.typeSuggestion)('Address')).toEqual('Bytes');
7
+ expect((0, schema_1.typeSuggestion)('address')).toEqual('Bytes');
8
+ expect((0, schema_1.typeSuggestion)('bytes')).toEqual('Bytes');
9
+ expect((0, schema_1.typeSuggestion)('string')).toEqual('String');
10
+ expect((0, schema_1.typeSuggestion)('bool')).toEqual('Boolean');
11
+ expect((0, schema_1.typeSuggestion)('boolean')).toEqual('Boolean');
12
+ expect((0, schema_1.typeSuggestion)('float')).toEqual('BigDecimal');
13
+ expect((0, schema_1.typeSuggestion)('Float')).toEqual('BigDecimal');
14
+ expect((0, schema_1.typeSuggestion)(`int`)).toBe('Int');
15
+ expect((0, schema_1.typeSuggestion)(`uint`)).toBe('BigInt');
16
+ expect((0, schema_1.typeSuggestion)(`uint32`)).toBe('BigInt');
17
+ expect((0, schema_1.typeSuggestion)(`int8`)).toBe('Int8');
18
+ expect((0, schema_1.typeSuggestion)(`i8`)).toBe('Int8');
19
+ expect((0, schema_1.typeSuggestion)(`u8`)).toBe('Int8');
20
+ expect((0, schema_1.typeSuggestion)(`uint8`)).toBe('Int8');
22
21
  // Test i16..i32, int17..int32
23
22
  for (let i = 16; i <= 32; i += 8) {
24
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`i${i}`)).toBe('Int');
25
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`int${i}`)).toBe('Int');
23
+ expect((0, schema_1.typeSuggestion)(`i${i}`)).toBe('Int');
24
+ expect((0, schema_1.typeSuggestion)(`int${i}`)).toBe('Int');
26
25
  }
27
26
  // Test u16..u24, uint16..uint24
28
27
  for (let i = 16; i <= 24; i += 8) {
29
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`u${i}`)).toBe('Int');
30
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`uint${i}`)).toBe('Int');
28
+ expect((0, schema_1.typeSuggestion)(`u${i}`)).toBe('Int');
29
+ expect((0, schema_1.typeSuggestion)(`uint${i}`)).toBe('Int');
31
30
  }
32
31
  // Test i40..i256, int40..int256, u40..u256, uint40..uint256
33
32
  for (let i = 40; i <= 256; i += 8) {
34
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`i${i}`)).toBe('BigInt');
35
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`int${i}`)).toBe('BigInt');
36
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`u${i}`)).toBe('BigInt');
37
- (0, vitest_1.expect)((0, schema_1.typeSuggestion)(`uint${i}`)).toBe('BigInt');
33
+ expect((0, schema_1.typeSuggestion)(`i${i}`)).toBe('BigInt');
34
+ expect((0, schema_1.typeSuggestion)(`int${i}`)).toBe('BigInt');
35
+ expect((0, schema_1.typeSuggestion)(`u${i}`)).toBe('BigInt');
36
+ expect((0, schema_1.typeSuggestion)(`uint${i}`)).toBe('BigInt');
38
37
  }
39
38
  });
40
39
  });
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.64.0-alpha-20231215205836-6d9a26b",
2
+ "version": "0.64.0",
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.64.0-alpha-20231215205836-6d9a26b",
3
+ "version": "0.64.0",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {
@@ -39,7 +39,7 @@
39
39
  "ipfs-http-client": "55.0.0",
40
40
  "jayson": "4.0.0",
41
41
  "js-yaml": "3.14.1",
42
- "prettier": "3.0.3",
42
+ "prettier": "1.19.1",
43
43
  "request": "2.88.2",
44
44
  "semver": "7.4.0",
45
45
  "sync-request": "6.1.0",
@@ -51,16 +51,17 @@
51
51
  "devDependencies": {
52
52
  "@types/debug": "^4.1.7",
53
53
  "@types/fs-extra": "^9.0.13",
54
+ "@types/jest": "^29.0.0",
54
55
  "@types/js-yaml": "^3.12.7",
55
56
  "@types/semver": "^7.3.13",
56
57
  "@types/which": "^2.0.1",
57
58
  "copyfiles": "^2.4.1",
59
+ "jest": "29.7.0",
58
60
  "oclif": "3.8.1",
59
61
  "spawn-command": "0.0.2-1",
60
62
  "strip-ansi": "6.0.1",
61
63
  "tern": "0.24.3",
62
- "typescript": "^5.0.0",
63
- "vitest": "^1.0.2"
64
+ "typescript": "^5.0.0"
64
65
  },
65
66
  "publishConfig": {
66
67
  "access": "public"
@@ -82,10 +83,10 @@
82
83
  "scripts": {
83
84
  "build": "tsc -b tsconfig.build.json && oclif manifest && oclif readme && copyfiles -u 1 src/**/*.graphql dist/",
84
85
  "oclif:pack": "npm pack && pnpm oclif pack tarballs --no-xz && node scripts/rename-tarballs.mjs",
85
- "test": "vitest run --bail=1",
86
- "test:add": "vitest run tests/cli/add.test.ts",
87
- "test:init": "vitest run tests/cli/init.test.ts",
88
- "test:validation": "vitest run tests/cli/validation.test.ts",
86
+ "test": "jest --verbose",
87
+ "test:add": "jest tests/cli/add.test.ts --verbose",
88
+ "test:init": "jest tests/cli/init.test.ts --verbose",
89
+ "test:validation": "jest tests/cli/validation.test.ts --verbose",
89
90
  "type-check": "tsc --noEmit"
90
91
  }
91
92
  }