@graphprotocol/graph-cli 0.45.0-alpha-20230329190855-a394fcb → 0.45.0-alpha-20230329212449-cc53040
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 +6 -1
- package/dist/codegen/schema.js +1 -2
- package/dist/codegen/schema.test.js +27 -5
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.45.0-alpha-
|
|
3
|
+
## 0.45.0-alpha-20230329212449-cc53040
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
[`ad275b3`](https://github.com/graphprotocol/graph-tooling/commit/ad275b31e635dab03cfefda00617ef9f612b01c0)
|
|
15
15
|
Thanks [@saihaj](https://github.com/saihaj)! - bring back short hand for version and help
|
|
16
16
|
|
|
17
|
+
- [#1203](https://github.com/graphprotocol/graph-tooling/pull/1203)
|
|
18
|
+
[`f4768f5`](https://github.com/graphprotocol/graph-tooling/commit/f4768f54e39c5480a66fd08808ba1b74b7bd66ac)
|
|
19
|
+
Thanks [@saihaj](https://github.com/saihaj)! - Explicitly handle null assertions for primitive
|
|
20
|
+
types.
|
|
21
|
+
|
|
17
22
|
## 0.44.0
|
|
18
23
|
|
|
19
24
|
### Minor Changes
|
package/dist/codegen/schema.js
CHANGED
|
@@ -245,8 +245,7 @@ Suggestion: add an '!' to the member type of the List, change from '[${baseType}
|
|
|
245
245
|
}
|
|
246
246
|
// NamedType
|
|
247
247
|
const type = tsCodegen.namedType(typesCodegen.ascTypeForValue(this._resolveFieldType(gqlType)));
|
|
248
|
-
|
|
249
|
-
return nullable && !type.isPrimitive() ? tsCodegen.nullableType(type) : type;
|
|
248
|
+
return nullable ? tsCodegen.nullableType(type) : type;
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
251
|
exports.default = SchemaCodeGenerator;
|
|
@@ -82,6 +82,9 @@ describe('Schema code generator', () => {
|
|
|
82
82
|
# two primitive types (i32)
|
|
83
83
|
age: Int
|
|
84
84
|
count: Int!
|
|
85
|
+
|
|
86
|
+
# https://github.com/graphprotocol/graph-tooling/issues/1196
|
|
87
|
+
active: Boolean
|
|
85
88
|
|
|
86
89
|
# derivedFrom
|
|
87
90
|
wallets: [Wallet!] @derivedFrom(field: "account")
|
|
@@ -200,18 +203,26 @@ describe('Schema code generator', () => {
|
|
|
200
203
|
{
|
|
201
204
|
name: 'get age',
|
|
202
205
|
params: [],
|
|
203
|
-
returnType: new typescript_1.NamedType('i32'),
|
|
206
|
+
returnType: new typescript_1.NullableType(new typescript_1.NamedType('i32')),
|
|
204
207
|
body: `
|
|
205
|
-
let value = this.get(
|
|
206
|
-
|
|
208
|
+
let value = this.get("age")
|
|
209
|
+
if (!value || value.kind == ValueKind.NULL) {
|
|
210
|
+
return null
|
|
211
|
+
} else {
|
|
212
|
+
return value.toI32()
|
|
213
|
+
}
|
|
207
214
|
`,
|
|
208
215
|
},
|
|
209
216
|
{
|
|
210
217
|
name: 'set age',
|
|
211
|
-
params: [new typescript_1.Param('value', new typescript_1.NamedType('i32'))],
|
|
218
|
+
params: [new typescript_1.Param('value', new typescript_1.NullableType(new typescript_1.NamedType('i32')))],
|
|
212
219
|
returnType: undefined,
|
|
213
220
|
body: `
|
|
214
|
-
|
|
221
|
+
if (!value) {
|
|
222
|
+
this.unset("age")
|
|
223
|
+
} else {
|
|
224
|
+
this.set("age", Value.fromI32(<i32>value))
|
|
225
|
+
}
|
|
215
226
|
`,
|
|
216
227
|
},
|
|
217
228
|
{
|
|
@@ -231,6 +242,17 @@ describe('Schema code generator', () => {
|
|
|
231
242
|
this.set('count', Value.fromI32(value))
|
|
232
243
|
`,
|
|
233
244
|
},
|
|
245
|
+
{
|
|
246
|
+
name: 'get active',
|
|
247
|
+
params: [],
|
|
248
|
+
returnType: new typescript_1.NullableType(new typescript_1.NamedType('boolean')),
|
|
249
|
+
body: "\n let value = this.get('active')\n if (!value || value.kind == ValueKind.NULL) {\n return null\n } else {\n return value.toBoolean()\n }\n ",
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'set active',
|
|
253
|
+
params: [new typescript_1.Param('value', new typescript_1.NullableType(new typescript_1.NamedType('boolean')))],
|
|
254
|
+
body: "\n if (!value) {\n this.unset('active')\n } else {\n this.set('active', Value.fromBoolean(<boolean>value))\n }\n ",
|
|
255
|
+
},
|
|
234
256
|
{
|
|
235
257
|
name: 'get wallets',
|
|
236
258
|
params: [],
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphprotocol/graph-cli",
|
|
3
|
-
"version": "0.45.0-alpha-
|
|
3
|
+
"version": "0.45.0-alpha-20230329212449-cc53040",
|
|
4
4
|
"description": "CLI for building for and deploying to The Graph",
|
|
5
5
|
"license": "(Apache-2.0 OR MIT)",
|
|
6
6
|
"engines": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"jest": "26.0.0",
|
|
57
57
|
"oclif": "3.6.1",
|
|
58
58
|
"spawn-command": "0.0.2-1",
|
|
59
|
-
"strip-ansi": "6.0.
|
|
59
|
+
"strip-ansi": "6.0.0",
|
|
60
60
|
"tern": "0.24.3",
|
|
61
61
|
"typescript": "^4.9.4"
|
|
62
62
|
},
|