@graphprotocol/graph-cli 0.43.1-alpha-20230321032415-91f97ff → 0.43.1-alpha-20230321033455-a6a309d

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,23 +1,17 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.43.1-alpha-20230321032415-91f97ff
3
+ ## 0.43.1-alpha-20230321033455-a6a309d
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - [#1201](https://github.com/graphprotocol/graph-tooling/pull/1201)
8
- [`91f97ff`](https://github.com/graphprotocol/graph-tooling/commit/91f97ff8893d20d288e84312062f33060d5f0b4e)
9
- Thanks [@saihaj](https://github.com/saihaj)! - read testsFolder from matchstick yaml and set the
10
- paths based on that
11
-
12
- - [#1201](https://github.com/graphprotocol/graph-tooling/pull/1201)
13
- [`95edea6`](https://github.com/graphprotocol/graph-tooling/commit/95edea632dee687d18bcffa19d4108fe5da99a94)
14
- Thanks [@saihaj](https://github.com/saihaj)! - make datasource and version optional args for test
15
- command
16
-
17
7
  - [`876bc52`](https://github.com/graphprotocol/graph-tooling/commit/876bc523e5a53db162d9b5aa79e9de76a9e92ccf)
18
8
  Thanks [@saihaj](https://github.com/saihaj)! - Allow file data sources (with no network) to deploy
19
9
  to the studio. File data sources don't have a network specified.
20
10
 
11
+ - [#1197](https://github.com/graphprotocol/graph-tooling/pull/1197)
12
+ [`de852df`](https://github.com/graphprotocol/graph-tooling/commit/de852df94df7bab814aa15b3e506b9b636d2c9b2)
13
+ Thanks [@saihaj](https://github.com/saihaj)! - make generated list children non-nullable
14
+
21
15
  ## 0.43.0
22
16
 
23
17
  ### Minor Changes
@@ -15,16 +15,28 @@ const semver_1 = __importDefault(require("semver"));
15
15
  class TestCommand extends core_1.Command {
16
16
  async run() {
17
17
  const { args: { datasource }, flags: { coverage, docker, force, logs, recompile, version }, } = await this.parse(TestCommand);
18
- let testsDir = './tests';
18
+ const testsDir = './tests';
19
+ const cachePath = path_1.default.resolve(testsDir, '.latest.json');
20
+ const opts = {
21
+ testsDir,
22
+ cachePath,
23
+ coverage,
24
+ docker,
25
+ force,
26
+ logs,
27
+ recompile,
28
+ version,
29
+ latestVersion: getLatestVersionFromCache(cachePath),
30
+ };
19
31
  // Check if matchstick.yaml config exists
20
32
  if (gluegun_1.filesystem.exists('matchstick.yaml')) {
21
33
  try {
22
34
  // Load the config
23
35
  const config = await js_yaml_1.default.load(gluegun_1.filesystem.read('matchstick.yaml', 'utf8'));
24
- // Check if matchstick.yaml and testsFolder not null
25
- if (config?.testsFolder) {
36
+ // Check if matchstick.yaml and testsDir not null
37
+ if (config?.testsDir) {
26
38
  // assign test folder from matchstick.yaml if present
27
- testsDir = config.testsFolder;
39
+ opts.testsDir = config.testsDir;
28
40
  }
29
41
  }
30
42
  catch (error) {
@@ -33,18 +45,6 @@ class TestCommand extends core_1.Command {
33
45
  });
34
46
  }
35
47
  }
36
- const cachePath = path_1.default.resolve(testsDir, '.latest.json');
37
- const opts = {
38
- testsDir,
39
- cachePath,
40
- coverage,
41
- docker,
42
- force,
43
- logs,
44
- recompile,
45
- version,
46
- latestVersion: getLatestVersionFromCache(cachePath),
47
- };
48
48
  // Fetch the latest version tag if version is not specified with -v/--version or if the version is not cached
49
49
  if (opts.force || (!opts.version && !opts.latestVersion)) {
50
50
  this.log('Fetching latest version tag...');
@@ -69,7 +69,9 @@ class TestCommand extends core_1.Command {
69
69
  exports.default = TestCommand;
70
70
  TestCommand.description = 'Runs rust binary for subgraph testing.';
71
71
  TestCommand.args = {
72
- datasource: core_1.Args.string(),
72
+ datasource: core_1.Args.string({
73
+ required: true,
74
+ }),
73
75
  };
74
76
  TestCommand.flags = {
75
77
  help: core_1.Flags.help({
@@ -98,6 +100,7 @@ TestCommand.flags = {
98
100
  version: core_1.Flags.string({
99
101
  summary: 'Choose the version of the rust binary that you want to be downloaded/used.',
100
102
  char: 'v',
103
+ required: true,
101
104
  }),
102
105
  };
103
106
  function getLatestVersionFromCache(cachePath) {
@@ -200,7 +203,7 @@ async function runDocker(datasource, opts) {
200
203
  // Get current working directory
201
204
  const current_folder = gluegun_1.filesystem.cwd();
202
205
  // Declate dockerfilePath with default location
203
- const dockerfilePath = path_1.default.join(opts.testsDir, '.docker/Dockerfile');
206
+ const dockerfilePath = path_1.default.join(opts.testsDir || 'tests', '.docker/Dockerfile');
204
207
  // Check if the Dockerfil already exists
205
208
  const dockerfileExists = gluegun_1.filesystem.exists(dockerfilePath);
206
209
  // Generate the Dockerfile only if it doesn't exists,
@@ -107,7 +107,7 @@ type ExampleEntity @entity {
107
107
  id: Bytes!
108
108
  count: BigInt!
109
109
  a: BigInt! # uint256
110
- b: [Bytes]! # bytes[4]
110
+ b: [Bytes!]! # bytes[4]
111
111
  }
112
112
  `);
113
113
  });
@@ -116,7 +116,7 @@ type ExampleEntity @entity {
116
116
  type ExampleEvent @entity(immutable: true) {
117
117
  id: Bytes!
118
118
  a: BigInt! # uint256
119
- b: [Bytes]! # bytes[4]
119
+ b: [Bytes!]! # bytes[4]
120
120
  param2: String! # string
121
121
  c_c1: BigInt! # uint256
122
122
  c_value1: Bytes! # bytes32
@@ -39,7 +39,13 @@ function abiEvents(abi) {
39
39
  exports.abiEvents = abiEvents;
40
40
  const protocolTypeToGraphQL = (protocol, name) => {
41
41
  const ascType = (0, types_1.ascTypeForProtocol)(protocol, name);
42
- return (0, types_1.valueTypeForAsc)(ascType);
42
+ // TODO: we need to figure out how to improve types
43
+ // but for now this always is returning a string
44
+ const convertedType = (0, types_1.valueTypeForAsc)(ascType);
45
+ // TODO: this is a hack to make array type non-nullable
46
+ // We should refactor the way we convert the Values from ASC to GraphQL
47
+ // For arrays we always want non-nullable children
48
+ return convertedType.endsWith(']') ? convertedType.replace(']', '!]') : convertedType;
43
49
  };
44
50
  exports.protocolTypeToGraphQL = protocolTypeToGraphQL;
45
51
  const generateField = ({ name, type, protocolName, }) => `${name}: ${(0, exports.protocolTypeToGraphQL)(protocolName, type)}! # ${type}`;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.43.1-alpha-20230321032415-91f97ff",
2
+ "version": "0.43.1-alpha-20230321033455-a6a309d",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
@@ -782,12 +782,14 @@
782
782
  "type": "option",
783
783
  "char": "v",
784
784
  "summary": "Choose the version of the rust binary that you want to be downloaded/used.",
785
+ "required": true,
785
786
  "multiple": false
786
787
  }
787
788
  },
788
789
  "args": {
789
790
  "datasource": {
790
- "name": "datasource"
791
+ "name": "datasource",
792
+ "required": true
791
793
  }
792
794
  }
793
795
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.43.1-alpha-20230321032415-91f97ff",
3
+ "version": "0.43.1-alpha-20230321033455-a6a309d",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {