@graphprotocol/graph-cli 0.27.0 → 0.27.1
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/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/tendermint.ts +554 -0
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/collections.ts +52 -2
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/numbers.ts +11 -0
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/value.ts +47 -0
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/global/global.ts +150 -1
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/index.ts +2 -0
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/package.json +2 -1
- package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/test/test.js +2 -0
- package/examples/basic-event-handlers/node_modules/keccak/build/Makefile +1 -1
- package/examples/basic-event-handlers/node_modules/keccak/build/Release/.deps/Release/obj.target/keccak/src/addon.o.d.raw +16 -16
- package/examples/basic-event-handlers/node_modules/keccak/build/config.gypi +4 -4
- package/examples/basic-event-handlers/node_modules/keccak/build/keccak.target.mk +14 -14
- package/examples/basic-event-handlers/node_modules/websocket/build/Makefile +1 -1
- package/examples/basic-event-handlers/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw +16 -16
- package/examples/basic-event-handlers/node_modules/websocket/build/bufferutil.target.mk +14 -14
- package/examples/basic-event-handlers/node_modules/websocket/build/config.gypi +1 -1
- package/examples/basic-event-handlers/node_modules/websocket/build/validation.target.mk +14 -14
- package/package.json +1 -1
- package/src/codegen/schema.js +5 -46
- package/src/codegen/schema.test.js +0 -6
- package/src/codegen/types/conversions.js +19 -19
- package/src/codegen/types/index.js +0 -25
- package/src/codegen/types/index.test.js +0 -22
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { BigDecimal } from '../common/numbers'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Bytes,
|
|
4
|
+
TypedMapEntry,
|
|
5
|
+
Entity,
|
|
6
|
+
TypedMap,
|
|
7
|
+
Result,
|
|
8
|
+
Wrapped,
|
|
9
|
+
} from '../common/collections'
|
|
3
10
|
import { JSONValue, Value } from '../common/value'
|
|
4
11
|
import { ethereum } from '../chain/ethereum'
|
|
5
12
|
import { near } from '../chain/near'
|
|
13
|
+
import { tendermint } from '../chain/tendermint'
|
|
6
14
|
|
|
7
15
|
export enum TypeId {
|
|
8
16
|
String = 0,
|
|
@@ -92,6 +100,53 @@ export enum TypeId {
|
|
|
92
100
|
NearChunkHeader = 84,
|
|
93
101
|
NearBlock = 85,
|
|
94
102
|
NearReceiptWithOutcome = 86,
|
|
103
|
+
TendermintArrayEventTx = 87,
|
|
104
|
+
TendermintArrayEvent = 88,
|
|
105
|
+
TendermintArrayCommitSig = 89,
|
|
106
|
+
TendermintArrayBytes = 90,
|
|
107
|
+
TendermintArrayEvidence = 91,
|
|
108
|
+
TendermintArrayEventAttribute = 92,
|
|
109
|
+
TendermintBlockIDFlagEnum = 93,
|
|
110
|
+
TendermintSignedMsgTypeEnum = 94,
|
|
111
|
+
TendermintEventList = 95,
|
|
112
|
+
TendermintEventBlock = 96,
|
|
113
|
+
TendermintResponseBeginBlock = 97,
|
|
114
|
+
TendermintResponseEndBlock = 98,
|
|
115
|
+
TendermintValidatorUpdate = 99,
|
|
116
|
+
TendermintArrayValidatorUpdate = 100,
|
|
117
|
+
TendermintConsensusParams = 101,
|
|
118
|
+
TendermintBlockParams = 102,
|
|
119
|
+
TendermintEvidenceParams = 103,
|
|
120
|
+
TendermintValidatorParams = 104,
|
|
121
|
+
TendermintVersionParams = 105,
|
|
122
|
+
TendermintBlock = 106,
|
|
123
|
+
TendermintCommit = 107,
|
|
124
|
+
TendermintCommitSig = 108,
|
|
125
|
+
TendermintHeader = 109,
|
|
126
|
+
TendermintConsensus = 110,
|
|
127
|
+
TendermintBlockID = 111,
|
|
128
|
+
TendermintPartSetHeader = 112,
|
|
129
|
+
TendermintData = 113,
|
|
130
|
+
TendermintEvidence = 114,
|
|
131
|
+
TendermintDuplicateVoteEvidence = 115,
|
|
132
|
+
TendermintEventTx = 116,
|
|
133
|
+
TendermintEventVote = 117,
|
|
134
|
+
TendermintLightClientAttackEvidence = 118,
|
|
135
|
+
TendermintLightBlock = 119,
|
|
136
|
+
TendermintValidatorSet = 120,
|
|
137
|
+
TendermintSignedHeader = 121,
|
|
138
|
+
TendermintEvidenceList = 122,
|
|
139
|
+
TendermintValidator = 123,
|
|
140
|
+
TendermintArrayValidator = 124,
|
|
141
|
+
TendermintPublicKey = 125,
|
|
142
|
+
TendermintTxResult = 126,
|
|
143
|
+
TendermintResponseDeliverTx = 127,
|
|
144
|
+
TendermintEvent = 128,
|
|
145
|
+
TendermintEventAttribute = 129,
|
|
146
|
+
TendermintEventValidatorSetUpdates = 130,
|
|
147
|
+
TendermintDuration = 131,
|
|
148
|
+
TendermintTimestamp = 132,
|
|
149
|
+
TendermintEventData = 133,
|
|
95
150
|
}
|
|
96
151
|
|
|
97
152
|
export function id_of_type(typeId: TypeId): usize {
|
|
@@ -271,6 +326,100 @@ export function id_of_type(typeId: TypeId): usize {
|
|
|
271
326
|
return idof<near.Block>()
|
|
272
327
|
case TypeId.NearReceiptWithOutcome:
|
|
273
328
|
return idof<near.ReceiptWithOutcome>()
|
|
329
|
+
case TypeId.TendermintArrayEventTx:
|
|
330
|
+
return idof<Array<tendermint.EventTx>>()
|
|
331
|
+
case TypeId.TendermintArrayEvent:
|
|
332
|
+
return idof<Array<tendermint.Event>>()
|
|
333
|
+
case TypeId.TendermintArrayCommitSig:
|
|
334
|
+
return idof<Array<tendermint.CommitSig>>()
|
|
335
|
+
case TypeId.TendermintArrayBytes:
|
|
336
|
+
return idof<Array<Bytes>>()
|
|
337
|
+
case TypeId.TendermintArrayEvidence:
|
|
338
|
+
return idof<Array<tendermint.Evidence>>()
|
|
339
|
+
case TypeId.TendermintArrayEventAttribute:
|
|
340
|
+
return idof<Array<tendermint.EventAttribute>>()
|
|
341
|
+
case TypeId.TendermintBlockIDFlagEnum:
|
|
342
|
+
return idof<Array<tendermint.BlockIDFlag>>()
|
|
343
|
+
case TypeId.TendermintSignedMsgTypeEnum:
|
|
344
|
+
return idof<Array<tendermint.SignedMsgType>>()
|
|
345
|
+
case TypeId.TendermintEventList:
|
|
346
|
+
return idof<tendermint.EventList>()
|
|
347
|
+
case TypeId.TendermintEventBlock:
|
|
348
|
+
return idof<tendermint.EventBlock>()
|
|
349
|
+
case TypeId.TendermintResponseBeginBlock:
|
|
350
|
+
return idof<tendermint.ResponseBeginBlock>()
|
|
351
|
+
case TypeId.TendermintResponseEndBlock:
|
|
352
|
+
return idof<tendermint.ResponseEndBlock>()
|
|
353
|
+
case TypeId.TendermintValidatorUpdate:
|
|
354
|
+
return idof<tendermint.ValidatorUpdate>()
|
|
355
|
+
case TypeId.TendermintArrayValidatorUpdate:
|
|
356
|
+
return idof<Array<tendermint.ValidatorUpdate>>()
|
|
357
|
+
case TypeId.TendermintConsensusParams:
|
|
358
|
+
return idof<tendermint.ConsensusParams>()
|
|
359
|
+
case TypeId.TendermintBlockParams:
|
|
360
|
+
return idof<tendermint.BlockParams>()
|
|
361
|
+
case TypeId.TendermintEvidenceParams:
|
|
362
|
+
return idof<tendermint.EvidenceParams>()
|
|
363
|
+
case TypeId.TendermintValidatorParams:
|
|
364
|
+
return idof<tendermint.ValidatorParams>()
|
|
365
|
+
case TypeId.TendermintVersionParams:
|
|
366
|
+
return idof<tendermint.VersionParams>()
|
|
367
|
+
case TypeId.TendermintBlock:
|
|
368
|
+
return idof<tendermint.Block>()
|
|
369
|
+
case TypeId.TendermintCommit:
|
|
370
|
+
return idof<tendermint.Commit>()
|
|
371
|
+
case TypeId.TendermintCommitSig:
|
|
372
|
+
return idof<tendermint.CommitSig>()
|
|
373
|
+
case TypeId.TendermintHeader:
|
|
374
|
+
return idof<tendermint.Header>()
|
|
375
|
+
case TypeId.TendermintConsensus:
|
|
376
|
+
return idof<tendermint.Consensus>()
|
|
377
|
+
case TypeId.TendermintBlockID:
|
|
378
|
+
return idof<tendermint.BlockID>()
|
|
379
|
+
case TypeId.TendermintPartSetHeader:
|
|
380
|
+
return idof<tendermint.PartSetHeader>()
|
|
381
|
+
case TypeId.TendermintData:
|
|
382
|
+
return idof<tendermint.Data>()
|
|
383
|
+
case TypeId.TendermintEvidence:
|
|
384
|
+
return idof<tendermint.Evidence>()
|
|
385
|
+
case TypeId.TendermintDuplicateVoteEvidence:
|
|
386
|
+
return idof<tendermint.DuplicateVoteEvidence>()
|
|
387
|
+
case TypeId.TendermintEventTx:
|
|
388
|
+
return idof<tendermint.EventTx>()
|
|
389
|
+
case TypeId.TendermintEventVote:
|
|
390
|
+
return idof<tendermint.EventVote>()
|
|
391
|
+
case TypeId.TendermintLightClientAttackEvidence:
|
|
392
|
+
return idof<tendermint.LightClientAttackEvidence>()
|
|
393
|
+
case TypeId.TendermintLightBlock:
|
|
394
|
+
return idof<tendermint.LightBlock>()
|
|
395
|
+
case TypeId.TendermintValidatorSet:
|
|
396
|
+
return idof<tendermint.ValidatorSet>()
|
|
397
|
+
case TypeId.TendermintSignedHeader:
|
|
398
|
+
return idof<tendermint.SignedHeader>()
|
|
399
|
+
case TypeId.TendermintEvidenceList:
|
|
400
|
+
return idof<tendermint.EvidenceList>()
|
|
401
|
+
case TypeId.TendermintValidator:
|
|
402
|
+
return idof<tendermint.Validator>()
|
|
403
|
+
case TypeId.TendermintArrayValidator:
|
|
404
|
+
return idof<Array<tendermint.Validator>>()
|
|
405
|
+
case TypeId.TendermintPublicKey:
|
|
406
|
+
return idof<tendermint.PublicKey>()
|
|
407
|
+
case TypeId.TendermintTxResult:
|
|
408
|
+
return idof<tendermint.TxResult>()
|
|
409
|
+
case TypeId.TendermintResponseDeliverTx:
|
|
410
|
+
return idof<tendermint.ResponseDeliverTx>()
|
|
411
|
+
case TypeId.TendermintEvent:
|
|
412
|
+
return idof<tendermint.Event>()
|
|
413
|
+
case TypeId.TendermintEventAttribute:
|
|
414
|
+
return idof<tendermint.EventAttribute>()
|
|
415
|
+
case TypeId.TendermintEventValidatorSetUpdates:
|
|
416
|
+
return idof<tendermint.EventValidatorSetUpdates>()
|
|
417
|
+
case TypeId.TendermintDuration:
|
|
418
|
+
return idof<tendermint.Duration>()
|
|
419
|
+
case TypeId.TendermintTimestamp:
|
|
420
|
+
return idof<tendermint.Timestamp>()
|
|
421
|
+
case TypeId.TendermintEventData:
|
|
422
|
+
return idof<tendermint.EventData>()
|
|
274
423
|
default:
|
|
275
424
|
return 0
|
|
276
425
|
}
|
|
@@ -4,6 +4,8 @@ import './common/eager_offset'
|
|
|
4
4
|
export * from './chain/ethereum'
|
|
5
5
|
// NEAR support
|
|
6
6
|
export * from './chain/near'
|
|
7
|
+
// Tendermint support
|
|
8
|
+
export * from './chain/tendermint'
|
|
7
9
|
// Regular re-exports
|
|
8
10
|
export * from './common/numbers'
|
|
9
11
|
export * from './common/collections'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphprotocol/graph-ts",
|
|
3
3
|
"description": "TypeScript/AssemblyScript library for writing subgraph mappings for The Graph",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"types": "index.ts",
|
|
7
7
|
"main": "index.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"lint": "prettier -c **/*.{js,ts}",
|
|
16
|
+
"format": "prettier --write -c **/*.{js,ts}",
|
|
16
17
|
"build": "asc --explicitStart --exportRuntime --runtime stub index.ts helper-functions.ts --lib graph-ts -b index.wasm",
|
|
17
18
|
"test": "node test/test.js"
|
|
18
19
|
}
|
|
@@ -31,6 +31,7 @@ async function main() {
|
|
|
31
31
|
fs.copyFileSync('common/value.ts', 'test/temp_lib/common/value.ts')
|
|
32
32
|
fs.copyFileSync('chain/ethereum.ts', 'test/temp_lib/chain/ethereum.ts')
|
|
33
33
|
fs.copyFileSync('chain/near.ts', 'test/temp_lib/chain/near.ts')
|
|
34
|
+
fs.copyFileSync('chain/tendermint.ts', 'test/temp_lib/chain/tendermint.ts')
|
|
34
35
|
fs.copyFileSync('index.ts', 'test/temp_lib/index.ts')
|
|
35
36
|
|
|
36
37
|
try {
|
|
@@ -63,6 +64,7 @@ async function main() {
|
|
|
63
64
|
fs.rmdirSync('test/temp_lib/common')
|
|
64
65
|
fs.unlinkSync('test/temp_lib/chain/ethereum.ts')
|
|
65
66
|
fs.unlinkSync('test/temp_lib/chain/near.ts')
|
|
67
|
+
fs.unlinkSync('test/temp_lib/chain/tendermint.ts')
|
|
66
68
|
fs.rmdirSync('test/temp_lib/chain')
|
|
67
69
|
fs.unlinkSync('test/temp_lib/index.ts')
|
|
68
70
|
fs.rmdirSync('test/temp_lib')
|
|
@@ -326,7 +326,7 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
|
|
326
326
|
endif
|
|
327
327
|
|
|
328
328
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
329
|
-
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/
|
|
329
|
+
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/keccak/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/eva/Library/Caches/node-gyp/14.16.0" "-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/eva/Library/Caches/node-gyp/14.16.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/keccak" "-Dnode_engine=v8" binding.gyp
|
|
330
330
|
Makefile: $(srcdir)/../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../Library/Caches/node-gyp/14.16.0/include/node/common.gypi
|
|
331
331
|
$(call do_cmd,regen_makefile)
|
|
332
332
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Release/obj.target/keccak/src/addon.o: ../src/addon.cc \
|
|
2
|
-
/Users/
|
|
3
|
-
/Users/
|
|
4
|
-
/Users/
|
|
5
|
-
/Users/
|
|
6
|
-
/Users/
|
|
7
|
-
/Users/
|
|
8
|
-
/Users/
|
|
9
|
-
/Users/
|
|
2
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node.h \
|
|
3
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8.h \
|
|
4
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/cppgc/common.h \
|
|
5
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8config.h \
|
|
6
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-internal.h \
|
|
7
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-version.h \
|
|
8
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-platform.h \
|
|
9
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_version.h \
|
|
10
10
|
../../nan/nan.h \
|
|
11
|
-
/Users/
|
|
12
|
-
/Users/
|
|
13
|
-
/Users/
|
|
14
|
-
/Users/
|
|
15
|
-
/Users/
|
|
16
|
-
/Users/
|
|
17
|
-
/Users/
|
|
18
|
-
/Users/
|
|
11
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv.h \
|
|
12
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/errno.h \
|
|
13
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/version.h \
|
|
14
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/unix.h \
|
|
15
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/threadpool.h \
|
|
16
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/darwin.h \
|
|
17
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_buffer.h \
|
|
18
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_object_wrap.h \
|
|
19
19
|
../../nan/nan_callbacks.h ../../nan/nan_callbacks_12_inl.h \
|
|
20
20
|
../../nan/nan_maybe_43_inl.h ../../nan/nan_converters.h \
|
|
21
21
|
../../nan/nan_converters_43_inl.h ../../nan/nan_new.h \
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"v8_use_siphash": 1,
|
|
77
77
|
"want_separate_host_toolset": 0,
|
|
78
78
|
"xcode_version": "11.0",
|
|
79
|
-
"nodedir": "/Users/
|
|
79
|
+
"nodedir": "/Users/eva/Library/Caches/node-gyp/14.16.0",
|
|
80
80
|
"standalone_static_library": 1,
|
|
81
81
|
"save_dev": "",
|
|
82
82
|
"legacy_bundling": "",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"https_proxy": "",
|
|
134
134
|
"engine_strict": "",
|
|
135
135
|
"description": "true",
|
|
136
|
-
"userconfig": "/Users/
|
|
137
|
-
"init_module": "/Users/
|
|
136
|
+
"userconfig": "/Users/eva/.npmrc",
|
|
137
|
+
"init_module": "/Users/eva/.npm-init.js",
|
|
138
138
|
"cidr": "",
|
|
139
139
|
"user": "",
|
|
140
140
|
"node_version": "14.16.0",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"otp": "",
|
|
179
179
|
"cache_min": "10",
|
|
180
180
|
"searchexclude": "",
|
|
181
|
-
"cache": "/Users/
|
|
181
|
+
"cache": "/Users/eva/.npm",
|
|
182
182
|
"color": "true",
|
|
183
183
|
"package_lock": "true",
|
|
184
184
|
"package_lock_only": "",
|
|
@@ -52,13 +52,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
52
52
|
CFLAGS_OBJCC_Debug :=
|
|
53
53
|
|
|
54
54
|
INCS_Debug := \
|
|
55
|
-
-I/Users/
|
|
56
|
-
-I/Users/
|
|
57
|
-
-I/Users/
|
|
58
|
-
-I/Users/
|
|
59
|
-
-I/Users/
|
|
60
|
-
-I/Users/
|
|
61
|
-
-I/Users/
|
|
55
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
56
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
57
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
58
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
59
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
60
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
61
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
62
62
|
-I$(srcdir)/../nan
|
|
63
63
|
|
|
64
64
|
DEFS_Release := \
|
|
@@ -108,13 +108,13 @@ CFLAGS_OBJC_Release :=
|
|
|
108
108
|
CFLAGS_OBJCC_Release :=
|
|
109
109
|
|
|
110
110
|
INCS_Release := \
|
|
111
|
-
-I/Users/
|
|
112
|
-
-I/Users/
|
|
113
|
-
-I/Users/
|
|
114
|
-
-I/Users/
|
|
115
|
-
-I/Users/
|
|
116
|
-
-I/Users/
|
|
117
|
-
-I/Users/
|
|
111
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
112
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
113
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
114
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
115
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
116
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
117
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
118
118
|
-I$(srcdir)/../nan
|
|
119
119
|
|
|
120
120
|
OBJS := \
|
|
@@ -331,7 +331,7 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
|
|
331
331
|
endif
|
|
332
332
|
|
|
333
333
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
334
|
-
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/
|
|
334
|
+
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/websocket/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/eva/Library/Caches/node-gyp/14.16.0" "-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/eva/Library/Caches/node-gyp/14.16.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/websocket" "-Dnode_engine=v8" binding.gyp
|
|
335
335
|
Makefile: $(srcdir)/../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../Library/Caches/node-gyp/14.16.0/include/node/common.gypi
|
|
336
336
|
$(call do_cmd,regen_makefile)
|
|
337
337
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \
|
|
2
|
-
/Users/
|
|
3
|
-
/Users/
|
|
4
|
-
/Users/
|
|
5
|
-
/Users/
|
|
6
|
-
/Users/
|
|
7
|
-
/Users/
|
|
8
|
-
/Users/
|
|
9
|
-
/Users/
|
|
10
|
-
/Users/
|
|
11
|
-
/Users/
|
|
2
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8.h \
|
|
3
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/cppgc/common.h \
|
|
4
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8config.h \
|
|
5
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-internal.h \
|
|
6
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-version.h \
|
|
7
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node.h \
|
|
8
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-platform.h \
|
|
9
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_version.h \
|
|
10
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_buffer.h \
|
|
11
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_object_wrap.h \
|
|
12
12
|
../../nan/nan.h \
|
|
13
|
-
/Users/
|
|
14
|
-
/Users/
|
|
15
|
-
/Users/
|
|
16
|
-
/Users/
|
|
17
|
-
/Users/
|
|
18
|
-
/Users/
|
|
13
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv.h \
|
|
14
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/errno.h \
|
|
15
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/version.h \
|
|
16
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/unix.h \
|
|
17
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/threadpool.h \
|
|
18
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/darwin.h \
|
|
19
19
|
../../nan/nan_callbacks.h ../../nan/nan_callbacks_12_inl.h \
|
|
20
20
|
../../nan/nan_maybe_43_inl.h ../../nan/nan_converters.h \
|
|
21
21
|
../../nan/nan_converters_43_inl.h ../../nan/nan_new.h \
|
|
@@ -49,13 +49,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
49
49
|
CFLAGS_OBJCC_Debug :=
|
|
50
50
|
|
|
51
51
|
INCS_Debug := \
|
|
52
|
-
-I/Users/
|
|
53
|
-
-I/Users/
|
|
54
|
-
-I/Users/
|
|
55
|
-
-I/Users/
|
|
56
|
-
-I/Users/
|
|
57
|
-
-I/Users/
|
|
58
|
-
-I/Users/
|
|
52
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
53
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
54
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
55
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
56
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
57
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
58
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
59
59
|
-I$(srcdir)/../nan
|
|
60
60
|
|
|
61
61
|
DEFS_Release := \
|
|
@@ -102,13 +102,13 @@ CFLAGS_OBJC_Release :=
|
|
|
102
102
|
CFLAGS_OBJCC_Release :=
|
|
103
103
|
|
|
104
104
|
INCS_Release := \
|
|
105
|
-
-I/Users/
|
|
106
|
-
-I/Users/
|
|
107
|
-
-I/Users/
|
|
108
|
-
-I/Users/
|
|
109
|
-
-I/Users/
|
|
110
|
-
-I/Users/
|
|
111
|
-
-I/Users/
|
|
105
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
106
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
107
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
108
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
109
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
110
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
111
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
112
112
|
-I$(srcdir)/../nan
|
|
113
113
|
|
|
114
114
|
OBJS := \
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"v8_use_siphash": 1,
|
|
77
77
|
"want_separate_host_toolset": 0,
|
|
78
78
|
"xcode_version": "11.0",
|
|
79
|
-
"nodedir": "/Users/
|
|
79
|
+
"nodedir": "/Users/eva/Library/Caches/node-gyp/14.16.0",
|
|
80
80
|
"standalone_static_library": 1,
|
|
81
81
|
"version_git_tag": "true",
|
|
82
82
|
"init_license": "MIT",
|
|
@@ -49,13 +49,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
49
49
|
CFLAGS_OBJCC_Debug :=
|
|
50
50
|
|
|
51
51
|
INCS_Debug := \
|
|
52
|
-
-I/Users/
|
|
53
|
-
-I/Users/
|
|
54
|
-
-I/Users/
|
|
55
|
-
-I/Users/
|
|
56
|
-
-I/Users/
|
|
57
|
-
-I/Users/
|
|
58
|
-
-I/Users/
|
|
52
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
53
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
54
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
55
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
56
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
57
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
58
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
59
59
|
-I$(srcdir)/../nan
|
|
60
60
|
|
|
61
61
|
DEFS_Release := \
|
|
@@ -102,13 +102,13 @@ CFLAGS_OBJC_Release :=
|
|
|
102
102
|
CFLAGS_OBJCC_Release :=
|
|
103
103
|
|
|
104
104
|
INCS_Release := \
|
|
105
|
-
-I/Users/
|
|
106
|
-
-I/Users/
|
|
107
|
-
-I/Users/
|
|
108
|
-
-I/Users/
|
|
109
|
-
-I/Users/
|
|
110
|
-
-I/Users/
|
|
111
|
-
-I/Users/
|
|
105
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
106
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
107
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
108
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
109
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
110
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
111
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
112
112
|
-I$(srcdir)/../nan
|
|
113
113
|
|
|
114
114
|
OBJS := \
|
package/package.json
CHANGED
package/src/codegen/schema.js
CHANGED
|
@@ -54,7 +54,7 @@ module.exports = class SchemaCodeGenerator {
|
|
|
54
54
|
let klass = tsCodegen.klass(name, { export: true, extends: 'Entity' })
|
|
55
55
|
|
|
56
56
|
// Generate and add a constructor
|
|
57
|
-
klass.addMethod(this._generateConstructor(name
|
|
57
|
+
klass.addMethod(this._generateConstructor(name))
|
|
58
58
|
|
|
59
59
|
// Generate and add save() and getById() methods
|
|
60
60
|
this._generateStoreMethods(name).forEach(method => klass.addMethod(method))
|
|
@@ -71,42 +71,7 @@ module.exports = class SchemaCodeGenerator {
|
|
|
71
71
|
return klass
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
_generateDefaultFieldValues(fields) {
|
|
76
|
-
const indexOfIdField = fields.findIndex(field => field.getIn(['name', 'value']) === 'id')
|
|
77
|
-
const fieldsWithoutId = fields.remove(indexOfIdField)
|
|
78
|
-
|
|
79
|
-
const fieldsSetCalls = fieldsWithoutId
|
|
80
|
-
.map(field => {
|
|
81
|
-
const name = field.getIn(['name', 'value'])
|
|
82
|
-
const type = this._typeFromGraphQl(field.get('type'), true, true)
|
|
83
|
-
|
|
84
|
-
const isNullable = type instanceof tsCodegen.NullableType
|
|
85
|
-
|
|
86
|
-
const directives = field.get('directives')
|
|
87
|
-
const isDerivedFrom = directives.some(directive => directive.getIn(['name', 'value']) === 'derivedFrom')
|
|
88
|
-
|
|
89
|
-
return { name, type, isNullable, isDerivedFrom }
|
|
90
|
-
})
|
|
91
|
-
// We only call the setter with the default value in the constructor for fields that are:
|
|
92
|
-
// - Not nullable, so that AS doesn't break when subgraph developers try to access them before a `set`
|
|
93
|
-
// - It doesn't matter if it's primitive or not
|
|
94
|
-
// - Not tagged as `derivedFrom`, because they only exist in query time
|
|
95
|
-
.filter(({
|
|
96
|
-
isNullable,
|
|
97
|
-
isDerivedFrom,
|
|
98
|
-
}) => !isNullable && !isDerivedFrom)
|
|
99
|
-
.map(({ name, type, isNullable }) => {
|
|
100
|
-
const fieldTypeString = isNullable ? type.inner.toString() : type.toString()
|
|
101
|
-
|
|
102
|
-
return `
|
|
103
|
-
this.set('${name}', ${typesCodegen.initializedValueFromAsc(fieldTypeString)})`
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
return fieldsSetCalls.join('')
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
_generateConstructor(entityName, fields) {
|
|
74
|
+
_generateConstructor(entityName) {
|
|
110
75
|
return tsCodegen.method(
|
|
111
76
|
'constructor',
|
|
112
77
|
[tsCodegen.param('id', tsCodegen.namedType('string'))],
|
|
@@ -114,7 +79,6 @@ module.exports = class SchemaCodeGenerator {
|
|
|
114
79
|
`
|
|
115
80
|
super()
|
|
116
81
|
this.set('id', Value.fromString(id))
|
|
117
|
-
${this._generateDefaultFieldValues(fields)}
|
|
118
82
|
`,
|
|
119
83
|
)
|
|
120
84
|
}
|
|
@@ -234,7 +198,7 @@ Suggestion: add an '!' to the member type of the List, change from '${fieldValue
|
|
|
234
198
|
: gqlType.getIn(['name', 'value'])
|
|
235
199
|
}
|
|
236
200
|
|
|
237
|
-
_typeFromGraphQl(gqlType, nullable = true
|
|
201
|
+
_typeFromGraphQl(gqlType, nullable = true) {
|
|
238
202
|
if (gqlType.get('kind') === 'NonNullType') {
|
|
239
203
|
return this._typeFromGraphQl(gqlType.get('type'), false)
|
|
240
204
|
} else if (gqlType.get('kind') === 'ListType') {
|
|
@@ -245,13 +209,8 @@ Suggestion: add an '!' to the member type of the List, change from '${fieldValue
|
|
|
245
209
|
let type = tsCodegen.namedType(
|
|
246
210
|
typesCodegen.ascTypeForValue(gqlType.getIn(['name', 'value'])),
|
|
247
211
|
)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (!nullablePrimitive && type.isPrimitive()) {
|
|
251
|
-
return type
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
return nullable ? tsCodegen.nullableType(type) : type
|
|
212
|
+
// In AssemblyScript, primitives cannot be nullable.
|
|
213
|
+
return nullable && !type.isPrimitive() ? tsCodegen.nullableType(type) : type
|
|
255
214
|
}
|
|
256
215
|
}
|
|
257
216
|
}
|
|
@@ -114,9 +114,6 @@ describe('Schema code generator', () => {
|
|
|
114
114
|
body: `
|
|
115
115
|
super()
|
|
116
116
|
this.set('id', Value.fromString(id))
|
|
117
|
-
|
|
118
|
-
this.set('name', Value.fromString(''))
|
|
119
|
-
this.set('count', Value.fromI32(0))
|
|
120
117
|
`,
|
|
121
118
|
},
|
|
122
119
|
{
|
|
@@ -279,9 +276,6 @@ describe('Schema code generator', () => {
|
|
|
279
276
|
body: `
|
|
280
277
|
super()
|
|
281
278
|
this.set('id', Value.fromString(id))
|
|
282
|
-
|
|
283
|
-
this.set('amount', Value.fromBigInt(BigInt.zero()))
|
|
284
|
-
this.set('account', Value.fromString(''))
|
|
285
279
|
`,
|
|
286
280
|
},
|
|
287
281
|
{
|