@graphprotocol/graph-cli 0.52.1-alpha-20230719201219-dde01c9 → 0.53.0-alpha-20230721161547-13ba32e
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 +14 -2
- package/dist/codegen/schema.js +11 -1
- package/dist/codegen/schema.test.js +8 -0
- package/dist/commands/deploy.js +9 -4
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.53.0-alpha-20230721161547-13ba32e
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1406](https://github.com/graphprotocol/graph-tooling/pull/1406)
|
|
8
|
+
[`34030b5`](https://github.com/graphprotocol/graph-tooling/commit/34030b5808f0f3996d8ea2133eedf19a0b3d9548)
|
|
9
|
+
Thanks [@incrypto32](https://github.com/incrypto32)! - Fix derived loaders not working failing for
|
|
10
|
+
entities with Bytes as ID's
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
6
13
|
|
|
@@ -9,8 +16,13 @@
|
|
|
9
16
|
Thanks [@saihaj](https://github.com/saihaj)! - only update `network.json` file during `graph add`
|
|
10
17
|
if it exists
|
|
11
18
|
|
|
19
|
+
- [#1402](https://github.com/graphprotocol/graph-tooling/pull/1402)
|
|
20
|
+
[`f0ce6c0`](https://github.com/graphprotocol/graph-tooling/commit/f0ce6c00e8adab94847ee3f9fde187513583b86c)
|
|
21
|
+
Thanks [@saihaj](https://github.com/saihaj)! - show a descriptive error message and do not hang if
|
|
22
|
+
there is a deploy key issue
|
|
23
|
+
|
|
12
24
|
- [#1403](https://github.com/graphprotocol/graph-tooling/pull/1403)
|
|
13
|
-
[`
|
|
25
|
+
[`dfa9ee1`](https://github.com/graphprotocol/graph-tooling/commit/dfa9ee1184bb1af499289baa92eb8c3b3cf37f85)
|
|
14
26
|
Thanks [@saihaj](https://github.com/saihaj)! - do not ask for local path when trying to add more
|
|
15
27
|
contracts during init
|
|
16
28
|
|
package/dist/codegen/schema.js
CHANGED
|
@@ -244,8 +244,18 @@ class SchemaCodeGenerator {
|
|
|
244
244
|
const name = fieldDef.name.value;
|
|
245
245
|
const gqlType = fieldDef.type;
|
|
246
246
|
const returnType = this._returnTypeForDervied(gqlType);
|
|
247
|
+
const obj = this.schema.ast.definitions.find(def => {
|
|
248
|
+
if (def.kind == 'ObjectTypeDefinition') {
|
|
249
|
+
const defobj = def;
|
|
250
|
+
return defobj.name.value == this._baseType(gqlType);
|
|
251
|
+
}
|
|
252
|
+
return false;
|
|
253
|
+
});
|
|
254
|
+
const idf = IdField.fromTypeDef(obj);
|
|
255
|
+
const idIsBytes = idf.typeName() == 'Bytes';
|
|
256
|
+
const toValueString = idIsBytes ? '.toBytes().toHexString()' : '.toString()';
|
|
247
257
|
return tsCodegen.method(`get ${name}`, [], returnType, `
|
|
248
|
-
return new ${returnType}('${entityName}', this.get('id')
|
|
258
|
+
return new ${returnType}('${entityName}', this.get('id')!${toValueString}, '${name}')
|
|
249
259
|
`);
|
|
250
260
|
}
|
|
251
261
|
_returnTypeForDervied(gqlType) {
|
|
@@ -428,11 +428,13 @@ describe('Schema code generator', () => {
|
|
|
428
428
|
type Worker implements Employee @entity {
|
|
429
429
|
id: Bytes!
|
|
430
430
|
name: String!
|
|
431
|
+
tasks: [Task!]
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
type Task @entity {
|
|
434
435
|
id: Bytes!
|
|
435
436
|
employee: Employee!
|
|
437
|
+
workers: [Worker!] @derivedFrom(field: "tasks")
|
|
436
438
|
worker: Worker!
|
|
437
439
|
}
|
|
438
440
|
`);
|
|
@@ -530,6 +532,12 @@ describe('Schema code generator', () => {
|
|
|
530
532
|
returnType: undefined,
|
|
531
533
|
body: "\n this.set('worker', Value.fromBytes(value))\n ",
|
|
532
534
|
},
|
|
535
|
+
{
|
|
536
|
+
name: 'get workers',
|
|
537
|
+
params: [],
|
|
538
|
+
returnType: new typescript_1.NamedType('WorkerLoader'),
|
|
539
|
+
body: "\n return new WorkerLoader('Task', this.get('id')!.toBytes().toHexString(), 'workers')\n ",
|
|
540
|
+
},
|
|
533
541
|
],
|
|
534
542
|
});
|
|
535
543
|
});
|
package/dist/commands/deploy.js
CHANGED
|
@@ -107,8 +107,6 @@ class DeployCommand extends core_1.Command {
|
|
|
107
107
|
required: true,
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias -- request needs it
|
|
111
|
-
const self = this;
|
|
112
110
|
const deploySubgraph = async (ipfsHash) => {
|
|
113
111
|
const spinner = gluegun_1.print.spin(`Deploying to Graph node ${requestUrl}`);
|
|
114
112
|
client.request('subgraph_deploy', {
|
|
@@ -137,7 +135,11 @@ class DeployCommand extends core_1.Command {
|
|
|
137
135
|
$ graph create --node ${node} ${subgraphName}`;
|
|
138
136
|
}
|
|
139
137
|
}
|
|
140
|
-
|
|
138
|
+
if (jsonRpcError.message.match(/auth failure/)) {
|
|
139
|
+
errorMessage += '\nYou may need to authenticate first.';
|
|
140
|
+
}
|
|
141
|
+
spinner.fail(errorMessage);
|
|
142
|
+
this.exit(1);
|
|
141
143
|
}
|
|
142
144
|
else if (requestError) {
|
|
143
145
|
spinner.fail(`HTTP error deploying the subgraph ${requestError.code}`);
|
|
@@ -171,7 +173,10 @@ class DeployCommand extends core_1.Command {
|
|
|
171
173
|
// we are provided the IPFS hash, so we deploy directly
|
|
172
174
|
if (ipfsHash) {
|
|
173
175
|
// Connect to the IPFS node (if a node address was provided)
|
|
174
|
-
const ipfsClient = (0, ipfs_http_client_1.create)({
|
|
176
|
+
const ipfsClient = (0, ipfs_http_client_1.create)({
|
|
177
|
+
url: (0, compiler_1.appendApiVersionForGraph)(ipfs.toString()),
|
|
178
|
+
headers,
|
|
179
|
+
});
|
|
175
180
|
// Fetch the manifest from IPFS
|
|
176
181
|
const manifestBuffer = ipfsClient.cat(ipfsHash);
|
|
177
182
|
let manifestFile = '';
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED