@graphprotocol/graph-cli 0.25.2 → 0.26.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.
Files changed (78) hide show
  1. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/ethereum.ts +1 -1
  2. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/tendermint.ts +554 -0
  3. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/collections.ts +52 -2
  4. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/numbers.ts +11 -0
  5. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/value.ts +47 -0
  6. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/global/global.ts +150 -1
  7. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/index.ts +2 -0
  8. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/package.json +2 -1
  9. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/test/test.js +2 -0
  10. package/examples/basic-event-handlers/node_modules/chalk/node_modules/supports-color/index.js +50 -0
  11. package/examples/basic-event-handlers/node_modules/chalk/node_modules/supports-color/license +21 -0
  12. package/examples/basic-event-handlers/node_modules/chalk/node_modules/supports-color/package.json +49 -0
  13. package/examples/basic-event-handlers/node_modules/chalk/node_modules/supports-color/readme.md +36 -0
  14. package/examples/basic-event-handlers/node_modules/cliui/node_modules/ansi-regex/index.js +10 -0
  15. package/examples/basic-event-handlers/node_modules/cliui/node_modules/ansi-regex/license +9 -0
  16. package/examples/basic-event-handlers/node_modules/cliui/node_modules/ansi-regex/package.json +53 -0
  17. package/examples/basic-event-handlers/node_modules/cliui/node_modules/ansi-regex/readme.md +46 -0
  18. package/examples/basic-event-handlers/node_modules/cliui/node_modules/strip-ansi/index.js +4 -0
  19. package/examples/basic-event-handlers/node_modules/cliui/node_modules/strip-ansi/license +9 -0
  20. package/examples/basic-event-handlers/node_modules/cliui/node_modules/strip-ansi/package.json +52 -0
  21. package/examples/basic-event-handlers/node_modules/cliui/node_modules/strip-ansi/readme.md +39 -0
  22. package/examples/basic-event-handlers/node_modules/keccak/build/Makefile +342 -0
  23. package/examples/basic-event-handlers/node_modules/keccak/build/Release/.deps/Release/obj.target/keccak/src/addon.o.d.raw +27 -0
  24. package/examples/basic-event-handlers/node_modules/keccak/build/binding.Makefile +6 -0
  25. package/examples/basic-event-handlers/node_modules/keccak/build/config.gypi +207 -0
  26. package/examples/basic-event-handlers/node_modules/keccak/build/gyp-mac-tool +615 -0
  27. package/examples/basic-event-handlers/node_modules/keccak/build/keccak.target.mk +209 -0
  28. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/.coveralls.yml +1 -0
  29. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/.eslintrc +14 -0
  30. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/.travis.yml +20 -0
  31. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/CHANGELOG.md +395 -0
  32. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/LICENSE +19 -0
  33. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/Makefile +58 -0
  34. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/README.md +368 -0
  35. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/karma.conf.js +70 -0
  36. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/node.js +1 -0
  37. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/package.json +43 -0
  38. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/src/browser.js +195 -0
  39. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/src/debug.js +225 -0
  40. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/src/index.js +10 -0
  41. package/examples/basic-event-handlers/node_modules/mocha/node_modules/debug/src/node.js +186 -0
  42. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/LICENSE +15 -0
  43. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/README.md +368 -0
  44. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/changelog.md +67 -0
  45. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/common.js +240 -0
  46. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/glob.js +790 -0
  47. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/package.json +43 -0
  48. package/examples/basic-event-handlers/node_modules/rimraf/node_modules/glob/sync.js +486 -0
  49. package/examples/basic-event-handlers/node_modules/string-width/node_modules/ansi-regex/index.js +10 -0
  50. package/examples/basic-event-handlers/node_modules/string-width/node_modules/ansi-regex/license +9 -0
  51. package/examples/basic-event-handlers/node_modules/string-width/node_modules/ansi-regex/package.json +53 -0
  52. package/examples/basic-event-handlers/node_modules/string-width/node_modules/ansi-regex/readme.md +46 -0
  53. package/examples/basic-event-handlers/node_modules/string-width/node_modules/strip-ansi/index.js +4 -0
  54. package/examples/basic-event-handlers/node_modules/string-width/node_modules/strip-ansi/license +9 -0
  55. package/examples/basic-event-handlers/node_modules/string-width/node_modules/strip-ansi/package.json +52 -0
  56. package/examples/basic-event-handlers/node_modules/string-width/node_modules/strip-ansi/readme.md +39 -0
  57. package/examples/basic-event-handlers/node_modules/websocket/build/Makefile +1 -1
  58. package/examples/basic-event-handlers/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw +16 -16
  59. package/examples/basic-event-handlers/node_modules/websocket/build/bufferutil.target.mk +14 -14
  60. package/examples/basic-event-handlers/node_modules/websocket/build/config.gypi +1 -1
  61. package/examples/basic-event-handlers/node_modules/websocket/build/validation.target.mk +14 -14
  62. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/index.js +46 -0
  63. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/license +21 -0
  64. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/package.json +45 -0
  65. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/is-fullwidth-code-point/readme.md +39 -0
  66. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/string-width/index.js +37 -0
  67. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/string-width/license +21 -0
  68. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/string-width/package.json +56 -0
  69. package/examples/basic-event-handlers/node_modules/wrap-ansi/node_modules/string-width/readme.md +42 -0
  70. package/package.json +1 -1
  71. package/src/codegen/schema.js +2 -40
  72. package/src/codegen/schema.test.js +362 -0
  73. package/src/codegen/types/conversions.js +19 -19
  74. package/src/codegen/types/index.js +0 -25
  75. package/src/codegen/types/index.test.js +0 -22
  76. package/src/codegen/typescript.js +7 -11
  77. package/examples/basic-event-handlers/node_modules/mocha/lib/reporters/base.js.orig +0 -498
  78. package/examples/basic-event-handlers/node_modules/node-fetch/lib/index.js +0 -1416
@@ -0,0 +1,362 @@
1
+ const prettier = require('prettier')
2
+ const graphql = require('graphql/language')
3
+ const immutable = require('immutable')
4
+ const SchemaCodeGenerator = require('./schema')
5
+ const {
6
+ Class,
7
+ Method,
8
+ StaticMethod,
9
+ Param,
10
+ NamedType,
11
+ NullableType,
12
+ ArrayType,
13
+ } = require('./typescript')
14
+
15
+ const formatTS = code =>
16
+ prettier.format(
17
+ code,
18
+ { parser: 'typescript', semi: false }
19
+ )
20
+
21
+ const createSchemaCodeGen = schema =>
22
+ new SchemaCodeGenerator({
23
+ ast: immutable.fromJS(graphql.parse(schema)),
24
+ })
25
+
26
+ const testEntity = (generatedTypes, expectedEntity) => {
27
+ const entity = generatedTypes.find(type => type.name === expectedEntity.name)
28
+
29
+ expect(entity instanceof Class).toBe(true)
30
+ expect(entity.extends).toBe('Entity')
31
+ expect(entity.export).toBe(true)
32
+
33
+ const { members, methods } = entity
34
+
35
+ expect(members).toStrictEqual(expectedEntity.members)
36
+
37
+ for (const expectedMethod of expectedEntity.methods) {
38
+ const method = methods.find(method => method.name === expectedMethod.name)
39
+
40
+ expectedMethod.static
41
+ ? expect(method instanceof StaticMethod).toBe(true)
42
+ : expect(method instanceof Method).toBe(true)
43
+
44
+ expect(method.params).toStrictEqual(expectedMethod.params)
45
+ expect(method.returnType).toStrictEqual(expectedMethod.returnType)
46
+ expect(formatTS(method.body)).toBe(formatTS(expectedMethod.body))
47
+ }
48
+
49
+ expect(methods.length).toBe(expectedEntity.methods.length)
50
+ }
51
+
52
+ describe('Schema code generator', () => {
53
+ test('Should generate nothing for non entity types', () => {
54
+ const codegen = createSchemaCodeGen(`
55
+ type Foo {
56
+ foobar: Int
57
+ }
58
+
59
+ type Bar {
60
+ barfoo: Int
61
+ }
62
+ `)
63
+
64
+ expect(codegen.generateTypes().size).toBe(0)
65
+ })
66
+
67
+ describe('Should generate correct classes for each entity', () => {
68
+ const codegen = createSchemaCodeGen(`
69
+ # just to be sure nothing will be generated from non-entity types alongside regular ones
70
+ type Foo {
71
+ foobar: Int
72
+ }
73
+
74
+ type Account @entity {
75
+ id: ID!
76
+
77
+ # two non primitive types
78
+ description: String
79
+ name: String!
80
+
81
+ # two primitive types (i32)
82
+ age: Int
83
+ count: Int!
84
+
85
+ # derivedFrom
86
+ wallets: [Wallet!] @derivedFrom(field: "account")
87
+ }
88
+
89
+ type Wallet @entity {
90
+ id: ID!
91
+ amount: BigInt!
92
+ account: Account!
93
+ }
94
+ `)
95
+
96
+ const generatedTypes = codegen.generateTypes()
97
+
98
+ test('Foo is NOT an entity', () => {
99
+ const foo = generatedTypes.find(type => type.name === 'Foo')
100
+ expect(foo).toBe(undefined)
101
+ // Account and Wallet
102
+ expect(generatedTypes.size).toBe(2)
103
+ })
104
+
105
+ test('Account is an entity with the correct methods', () => {
106
+ testEntity(generatedTypes, {
107
+ name: 'Account',
108
+ members: [],
109
+ methods: [
110
+ {
111
+ name: 'constructor',
112
+ params: [new Param('id', new NamedType('string'))],
113
+ returnType: undefined,
114
+ body: `
115
+ super()
116
+ this.set('id', Value.fromString(id))
117
+ `,
118
+ },
119
+ {
120
+ name: 'save',
121
+ params: [],
122
+ returnType: new NamedType('void'),
123
+ body: `
124
+ let id = this.get('id')
125
+ assert(id != null, 'Cannot save Account entity without an ID')
126
+ if (id) {
127
+ assert(
128
+ id.kind == ValueKind.STRING,
129
+ 'Cannot save Account entity with non-string ID. ' +
130
+ 'Considering using .toHex() to convert the "id" to a string.'
131
+ )
132
+ store.set('Account', id.toString(), this)
133
+ }
134
+ `,
135
+ },
136
+ {
137
+ name: 'load',
138
+ static: true,
139
+ params: [new Param('id', new NamedType('string'))],
140
+ returnType: new NullableType(new NamedType('Account')),
141
+ body: `
142
+ return changetype<Account | null>(store.get('Account', id))
143
+ `,
144
+ },
145
+ {
146
+ name: 'get id',
147
+ params: [],
148
+ returnType: new NamedType('string'),
149
+ body: `
150
+ let value = this.get('id')
151
+ return value!.toString()
152
+ `,
153
+ },
154
+ {
155
+ name: 'set id',
156
+ params: [new Param('value', new NamedType('string'))],
157
+ returnType: undefined,
158
+ body: `
159
+ this.set('id', Value.fromString(value))
160
+ `,
161
+ },
162
+ {
163
+ name: 'get description',
164
+ params: [],
165
+ returnType: new NullableType(new NamedType('string')),
166
+ body: `
167
+ let value = this.get('description')
168
+ if (!value || value.kind == ValueKind.NULL) {
169
+ return null
170
+ } else {
171
+ return value.toString()
172
+ }
173
+ `,
174
+ },
175
+ {
176
+ name: 'set description',
177
+ params: [new Param('value', new NullableType(new NamedType('string')))],
178
+ returnType: undefined,
179
+ body: `
180
+ if (!value) {
181
+ this.unset('description')
182
+ } else {
183
+ this.set('description', Value.fromString(<string>value))
184
+ }
185
+ `,
186
+ },
187
+ {
188
+ name: 'get name',
189
+ params: [],
190
+ returnType: new NamedType('string'),
191
+ body: `
192
+ let value = this.get('name')
193
+ return value!.toString()
194
+ `,
195
+ },
196
+ {
197
+ name: 'set name',
198
+ params: [new Param('value', new NamedType('string'))],
199
+ returnType: undefined,
200
+ body: `
201
+ this.set('name', Value.fromString(value))
202
+ `,
203
+ },
204
+ {
205
+ name: 'get age',
206
+ params: [],
207
+ returnType: new NamedType('i32'),
208
+ body: `
209
+ let value = this.get('age')
210
+ return value!.toI32()
211
+ `,
212
+ },
213
+ {
214
+ name: 'set age',
215
+ params: [new Param('value', new NamedType('i32'))],
216
+ returnType: undefined,
217
+ body: `
218
+ this.set('age', Value.fromI32(value))
219
+ `,
220
+ },
221
+ {
222
+ name: 'get count',
223
+ params: [],
224
+ returnType: new NamedType('i32'),
225
+ body: `
226
+ let value = this.get('count')
227
+ return value!.toI32()
228
+ `,
229
+ },
230
+ {
231
+ name: 'set count',
232
+ params: [new Param('value', new NamedType('i32'))],
233
+ returnType: undefined,
234
+ body: `
235
+ this.set('count', Value.fromI32(value))
236
+ `,
237
+ },
238
+ {
239
+ name: 'get wallets',
240
+ params: [],
241
+ returnType: new NullableType(new ArrayType(new NamedType('string'))),
242
+ body: `
243
+ let value = this.get('wallets')
244
+ if (!value || value.kind == ValueKind.NULL) {
245
+ return null
246
+ } else {
247
+ return value.toStringArray()
248
+ }
249
+ `,
250
+ },
251
+ {
252
+ name: 'set wallets',
253
+ params: [new Param('value', new NullableType(new ArrayType(new NamedType('string'))))],
254
+ returnType: undefined,
255
+ body: `
256
+ if (!value) {
257
+ this.unset('wallets')
258
+ } else {
259
+ this.set('wallets', Value.fromStringArray(<Array<string>>value))
260
+ }
261
+ `,
262
+ },
263
+ ],
264
+ })
265
+ })
266
+
267
+ test('Wallet is an entity with the correct methods', () => {
268
+ testEntity(generatedTypes, {
269
+ name: 'Wallet',
270
+ members: [],
271
+ methods: [
272
+ {
273
+ name: 'constructor',
274
+ params: [new Param('id', new NamedType('string'))],
275
+ returnType: undefined,
276
+ body: `
277
+ super()
278
+ this.set('id', Value.fromString(id))
279
+ `,
280
+ },
281
+ {
282
+ name: 'save',
283
+ params: [],
284
+ returnType: new NamedType('void'),
285
+ body: `
286
+ let id = this.get('id')
287
+ assert(id != null, 'Cannot save Wallet entity without an ID')
288
+ if (id) {
289
+ assert(
290
+ id.kind == ValueKind.STRING,
291
+ 'Cannot save Wallet entity with non-string ID. ' +
292
+ 'Considering using .toHex() to convert the "id" to a string.'
293
+ )
294
+ store.set('Wallet', id.toString(), this)
295
+ }
296
+ `,
297
+ },
298
+ {
299
+ name: 'load',
300
+ static: true,
301
+ params: [new Param('id', new NamedType('string'))],
302
+ returnType: new NullableType(new NamedType('Wallet')),
303
+ body: `
304
+ return changetype<Wallet | null>(store.get('Wallet', id))
305
+ `,
306
+ },
307
+ {
308
+ name: 'get id',
309
+ params: [],
310
+ returnType: new NamedType('string'),
311
+ body: `
312
+ let value = this.get('id')
313
+ return value!.toString()
314
+ `,
315
+ },
316
+ {
317
+ name: 'set id',
318
+ params: [new Param('value', new NamedType('string'))],
319
+ returnType: undefined,
320
+ body: `
321
+ this.set('id', Value.fromString(value))
322
+ `,
323
+ },
324
+ {
325
+ name: 'get amount',
326
+ params: [],
327
+ returnType: new NamedType('BigInt'),
328
+ body: `
329
+ let value = this.get('amount')
330
+ return value!.toBigInt()
331
+ `,
332
+ },
333
+ {
334
+ name: 'set amount',
335
+ params: [new Param('value', new NamedType('BigInt'))],
336
+ returnType: undefined,
337
+ body: `
338
+ this.set('amount', Value.fromBigInt(value))
339
+ `,
340
+ },
341
+ {
342
+ name: 'get account',
343
+ params: [],
344
+ returnType: new NamedType('string'),
345
+ body: `
346
+ let value = this.get('account')
347
+ return value!.toString()
348
+ `,
349
+ },
350
+ {
351
+ name: 'set account',
352
+ params: [new Param('value', new NamedType('string'))],
353
+ returnType: undefined,
354
+ body: `
355
+ this.set('account', Value.fromString(value))
356
+ `,
357
+ },
358
+ ],
359
+ })
360
+ })
361
+ })
362
+ })
@@ -188,28 +188,28 @@ const VALUE_TO_ASSEMBLYSCRIPT = [
188
188
  const ASSEMBLYSCRIPT_TO_VALUE = [
189
189
  // Arrays
190
190
 
191
- ['Array<Address>', '[Bytes]', code => `Value.fromBytesArray(${code})`, 'new Array(0)'],
192
- ['Array<Bytes>', '[Bytes]', code => `Value.fromBytesArray(${code})`, 'new Array(0)'],
193
- ['Array<boolean>', '[Boolean]', code => `Value.fromBooleanArray(${code})`, 'new Array(0)'],
194
- ['Array<i32>', '[Int]', code => `Value.fromI32Array(${code})`, 'new Array(0)'],
195
- ['Array<BigInt>', '[BigInt]', code => `Value.fromBigIntArray(${code})`, 'new Array(0)'],
196
- ['Array<string>', '[String]', code => `Value.fromStringArray(${code})`, 'new Array(0)'],
197
- ['Array<string>', '[ID]', code => `Value.fromStringArray(${code})`, 'new Array(0)'],
198
- ['Array<BigDecimal>', '[BigDecimal]', code => `Value.fromBigDecimalArray(${code})`, 'new Array(0)'],
199
- ['Array<string>', /\[.*\]/, code => `Value.fromStringArray(${code})`, 'new Array(0)'],
200
- ['Array<string | null>', null, code => `Value.fromStringArray(${code})`, 'new Array(0)'],
191
+ ['Array<Address>', '[Bytes]', code => `Value.fromBytesArray(${code})`],
192
+ ['Array<Bytes>', '[Bytes]', code => `Value.fromBytesArray(${code})`],
193
+ ['Array<boolean>', '[Boolean]', code => `Value.fromBooleanArray(${code})`],
194
+ ['Array<i32>', '[Int]', code => `Value.fromI32Array(${code})`],
195
+ ['Array<BigInt>', '[BigInt]', code => `Value.fromBigIntArray(${code})`],
196
+ ['Array<string>', '[String]', code => `Value.fromStringArray(${code})`],
197
+ ['Array<string>', '[ID]', code => `Value.fromStringArray(${code})`],
198
+ ['Array<BigDecimal>', '[BigDecimal]', code => `Value.fromBigDecimalArray(${code})`],
199
+ ['Array<string>', /\[.*\]/, code => `Value.fromStringArray(${code})`],
200
+ ['Array<string | null>', null, code => `Value.fromStringArray(${code})`],
201
201
 
202
202
  // Scalar values
203
203
 
204
- ['Address', 'Bytes', code => `Value.fromBytes(${code})`, 'Address.zero()'],
205
- ['Bytes', 'Bytes', code => `Value.fromBytes(${code})`, 'Bytes.empty()'],
206
- ['boolean', 'Boolean', code => `Value.fromBoolean(${code})`, 'false'],
207
- ['i32', 'Int', code => `Value.fromI32(${code})`, '0'],
208
- ['BigInt', 'BigInt', code => `Value.fromBigInt(${code})`, 'BigInt.zero()'],
209
- ['string', 'String', code => `Value.fromString(${code})`, "''"],
210
- ['string', 'ID', code => `Value.fromString(${code})`, "''"],
211
- ['BigDecimal', 'BigDecimal', code => `Value.fromBigDecimal(${code})`, 'BigDecimal.zero()'],
212
- ['string', /.*/, code => `Value.fromString(${code})`, "''"],
204
+ ['Address', 'Bytes', code => `Value.fromBytes(${code})`],
205
+ ['Bytes', 'Bytes', code => `Value.fromBytes(${code})`],
206
+ ['boolean', 'Boolean', code => `Value.fromBoolean(${code})`],
207
+ ['i32', 'Int', code => `Value.fromI32(${code})`],
208
+ ['BigInt', 'BigInt', code => `Value.fromBigInt(${code})`],
209
+ ['string', 'String', code => `Value.fromString(${code})`],
210
+ ['string', 'ID', code => `Value.fromString(${code})`],
211
+ ['BigDecimal', 'BigDecimal', code => `Value.fromBigDecimal(${code})`],
212
+ ['string', /.*/, code => `Value.fromString(${code})`],
213
213
  ]
214
214
 
215
215
  /**
@@ -66,27 +66,6 @@ const findConversionToType = (fromTypeSystem, toTypeSystem, toType) => {
66
66
  return objectifyConversion(fromTypeSystem, toTypeSystem, conversion)
67
67
  }
68
68
 
69
- const findInitializationForType = (fromTypeSystem, toTypeSystem, ascType) => {
70
- const conversions = conversionsForTypeSystems(fromTypeSystem, toTypeSystem)
71
-
72
- const conversion = conversions.find(conversion =>
73
- typeof conversion.get(0) === 'string'
74
- ? conversion.get(0) === ascType
75
- : ascType.match(conversion.get(0)),
76
- )
77
-
78
- if (conversion === undefined) {
79
- throw new Error(
80
- `Conversion from '${fromTypeSystem}' to '${toTypeSystem}' for ` +
81
- `target type '${ascType}' is not supported`,
82
- )
83
- }
84
-
85
- const conversionObj = objectifyConversion(fromTypeSystem, toTypeSystem, conversion)
86
-
87
- return conversionObj.get('convert')(conversion.get(3))
88
- }
89
-
90
69
  // High-level type system API
91
70
 
92
71
  const ascTypeForProtocol = (protocol, protocolType) =>
@@ -120,9 +99,6 @@ const valueToAsc = (code, valueType) =>
120
99
  const valueFromAsc = (code, valueType) =>
121
100
  findConversionToType('AssemblyScript', 'Value', valueType).get('convert')(code)
122
101
 
123
- const initializedValueFromAsc = ascType =>
124
- findInitializationForType('AssemblyScript', 'Value', ascType)
125
-
126
102
  module.exports = {
127
103
  // protocol <-> AssemblyScript
128
104
  ascTypeForProtocol,
@@ -138,5 +114,4 @@ module.exports = {
138
114
  valueTypeForAsc,
139
115
  valueToAsc,
140
116
  valueFromAsc,
141
- initializedValueFromAsc,
142
117
  }
@@ -449,26 +449,4 @@ describe('AssemblyScript -> Value', () => {
449
449
  expect(codegen.valueFromAsc('x', '[String]')).toBe('Value.fromStringArray(x)')
450
450
  expect(codegen.valueTypeForAsc('Array<string>')).toBe('[String]')
451
451
  })
452
-
453
- describe('Initialization for zero/empty values', () => {
454
- test('Array<string>', () => {
455
- expect(codegen.initializedValueFromAsc('Array<string>')).toBe('Value.fromStringArray(new Array(0))')
456
- })
457
-
458
- test('Array<string | null>', () => {
459
- expect(codegen.initializedValueFromAsc('Array<string | null>')).toBe('Value.fromStringArray(new Array(0))')
460
- })
461
-
462
- test('i32', () => {
463
- expect(codegen.initializedValueFromAsc('i32')).toBe('Value.fromI32(0)')
464
- })
465
-
466
- test('string', () => {
467
- expect(codegen.initializedValueFromAsc('string')).toBe("Value.fromString('')")
468
- })
469
-
470
- test('BigInt', () => {
471
- expect(codegen.initializedValueFromAsc('BigInt')).toBe('Value.fromBigInt(BigInt.zero())')
472
- })
473
- })
474
452
  })
@@ -12,17 +12,6 @@ class Param {
12
12
  }
13
13
  }
14
14
 
15
- class ReturnType {
16
- constructor(name, type) {
17
- this.name = name
18
- this.type = type
19
- }
20
-
21
- toString() {
22
- return `${this.type.toString()}`
23
- }
24
- }
25
-
26
15
  class Method {
27
16
  constructor(name, params, returnType, body) {
28
17
  this.name = name
@@ -185,8 +174,15 @@ const GENERATED_FILE_NOTE = `
185
174
 
186
175
  module.exports = {
187
176
  // Types
177
+ Param,
178
+ Method,
179
+ StaticMethod,
180
+ Class,
181
+ ClassMember,
182
+ NamedType,
188
183
  NullableType,
189
184
  ArrayType,
185
+ ModuleImports,
190
186
 
191
187
  // Code generators
192
188
  namedType,