@graphprotocol/graph-cli 0.69.0-alpha-20240315144301-ea4b16f → 0.69.0-alpha-20240317072253-db1272f

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,12 +1,18 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.69.0-alpha-20240315144301-ea4b16f
3
+ ## 0.69.0-alpha-20240317072253-db1272f
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - [#1611](https://github.com/graphprotocol/graph-tooling/pull/1611)
8
- [`ea4b16f`](https://github.com/graphprotocol/graph-tooling/commit/ea4b16f903098665f80247af5085a8dbf0e1d4f3)
9
- Thanks [@lutter](https://github.com/lutter)! - Allow declared calls in the manifest
7
+ - [#1522](https://github.com/graphprotocol/graph-tooling/pull/1522)
8
+ [`db1272f`](https://github.com/graphprotocol/graph-tooling/commit/db1272f96e698b9d427b7ab6d48f01d67eb1173e)
9
+ Thanks [@dotansimha](https://github.com/dotansimha)! - Added support for handling GraphQL
10
+ `Timestamp` scalar as `i64` (AssemblyScript)
11
+
12
+ - [#1610](https://github.com/graphprotocol/graph-tooling/pull/1610)
13
+ [`fc03add`](https://github.com/graphprotocol/graph-tooling/commit/fc03add1a8510afa49110481b486c8fa56f8c19f)
14
+ Thanks [@yehia67](https://github.com/yehia67)! - Generate `docker-compose.yml` with `graph init`
15
+ command
10
16
 
11
17
  ## 0.68.5
12
18
 
@@ -91,6 +91,7 @@ vitest_1.describe.concurrent('Schema code generator', () => {
91
91
 
92
92
  # New scalars
93
93
  int8: Int8!
94
+ timestamp: Timestamp!
94
95
  }
95
96
 
96
97
  type Wallet @entity {
@@ -296,6 +297,26 @@ vitest_1.describe.concurrent('Schema code generator', () => {
296
297
  returnType: undefined,
297
298
  body: `
298
299
  this.set('int8', Value.fromI64(value))
300
+ `,
301
+ },
302
+ {
303
+ name: 'get timestamp',
304
+ params: [],
305
+ returnType: new typescript_1.NamedType('i64'),
306
+ body: `let value = this.get('timestamp')
307
+ if (!value || value.kind == ValueKind.NULL) {
308
+ return 0
309
+ } else {
310
+ return value.toI64()
311
+ }
312
+ `,
313
+ },
314
+ {
315
+ name: 'set timestamp',
316
+ params: [new typescript_1.Param('value', new typescript_1.NamedType('i64'))],
317
+ returnType: undefined,
318
+ body: `
319
+ this.set('timestamp', Value.fromI64(value))
299
320
  `,
300
321
  },
301
322
  {
@@ -258,6 +258,7 @@ const VALUE_TO_ASSEMBLYSCRIPT = [
258
258
  ['[Boolean]', 'Array<boolean>', (code) => `${code}.toBooleanArray()`],
259
259
  ['[Int]', 'Array<i32>', (code) => `${code}.toI32Array()`],
260
260
  ['[Int8]', 'Array<i64>', (code) => `${code}.toI64Array()`],
261
+ ['[Timestamp]', 'Array<i64>', (code) => `${code}.toI64Array()`],
261
262
  ['[BigInt]', 'Array<BigInt>', (code) => `${code}.toBigIntArray()`],
262
263
  ['[ID]', 'Array<string>', (code) => `${code}.toStringArray()`],
263
264
  ['[String]', 'Array<string>', (code) => `${code}.toStringArray()`],
@@ -272,6 +273,7 @@ const VALUE_TO_ASSEMBLYSCRIPT = [
272
273
  ['ID', 'string', (code) => `${code}.toString()`],
273
274
  ['String', 'string', (code) => `${code}.toString()`],
274
275
  ['BigDecimal', 'BigDecimal', (code) => `${code}.toBigDecimal()`],
276
+ ['Timestamp', 'i64', (code) => `${code}.toI64()`],
275
277
  [/.*/, 'string', (code) => `${code}.toString()`],
276
278
  ];
277
279
  /**
@@ -288,6 +290,7 @@ const ASSEMBLYSCRIPT_TO_VALUE = [
288
290
  ['Array<Array<boolean>>', '[[Boolean]]', (code) => `Value.fromBooleanMatrix(${code})`],
289
291
  ['Array<Array<i32>>', '[[Int]]', (code) => `Value.fromI32Matrix(${code})`],
290
292
  ['Array<Array<i64>>', '[[Int8]]', (code) => `Value.fromI64Matrix(${code})`],
293
+ ['Array<Array<i64>>', '[[Timestamp]]', (code) => `Value.fromI64Matrix(${code})`],
291
294
  ['Array<Array<BigInt>>', '[[BigInt]]', (code) => `Value.fromBigIntMatrix(${code})`],
292
295
  ['Array<Array<string>>', '[[String]]', (code) => `Value.fromStringMatrix(${code})`],
293
296
  ['Array<Array<string>>', '[[ID]]', (code) => `Value.fromStringMatrix(${code})`],
@@ -305,6 +308,7 @@ const ASSEMBLYSCRIPT_TO_VALUE = [
305
308
  ['Array<boolean>', '[Boolean]', (code) => `Value.fromBooleanArray(${code})`],
306
309
  ['Array<i32>', '[Int]', (code) => `Value.fromI32Array(${code})`],
307
310
  ['Array<i64>', '[Int8]', (code) => `Value.fromI64Array(${code})`],
311
+ ['Array<i64>', '[Timestamp]', (code) => `Value.fromI64Array(${code})`],
308
312
  ['Array<BigInt>', '[BigInt]', (code) => `Value.fromBigIntArray(${code})`],
309
313
  ['Array<string>', '[String]', (code) => `Value.fromStringArray(${code})`],
310
314
  ['Array<string>', '[ID]', (code) => `Value.fromStringArray(${code})`],
@@ -317,6 +321,7 @@ const ASSEMBLYSCRIPT_TO_VALUE = [
317
321
  ['boolean', 'Boolean', (code) => `Value.fromBoolean(${code})`],
318
322
  ['i32', 'Int', (code) => `Value.fromI32(${code})`],
319
323
  ['i64', 'Int8', (code) => `Value.fromI64(${code})`],
324
+ ['i64', 'Timestamp', (code) => `Value.fromI64(${code})`],
320
325
  ['BigInt', 'BigInt', (code) => `Value.fromBigInt(${code})`],
321
326
  ['string', 'String', (code) => `Value.fromString(${code})`],
322
327
  ['string', 'ID', (code) => `Value.fromString(${code})`],
@@ -19,6 +19,7 @@ export declare const generateScaffold: ({ protocolInstance, abi, contract, netwo
19
19
  'schema.graphql': string;
20
20
  'package.json': string;
21
21
  'tsconfig.json'?: undefined;
22
+ 'docker-compose.yml'?: undefined;
22
23
  src?: undefined;
23
24
  abis?: undefined;
24
25
  tests?: undefined;
@@ -27,6 +28,7 @@ export declare const generateScaffold: ({ protocolInstance, abi, contract, netwo
27
28
  'subgraph.yaml': string;
28
29
  'schema.graphql': string;
29
30
  'tsconfig.json': string;
31
+ 'docker-compose.yml': string;
30
32
  src: {
31
33
  [x: string]: string;
32
34
  } | undefined;
@@ -97,8 +97,6 @@ type ContractEventHandler {
97
97
  topic0: String
98
98
  handler: String!
99
99
  receipt: Boolean
100
- # This should really be just a Map<String, String>
101
- calls: JSON
102
100
  }
103
101
 
104
102
  type Graft {
@@ -0,0 +1 @@
1
+ export declare const getDockerFile: () => string;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDockerFile = void 0;
4
+ const getDockerFile = () => {
5
+ return `version: '3'
6
+ services:
7
+ graph-node:
8
+ image: graphprotocol/graph-node
9
+ ports:
10
+ - '8000:8000'
11
+ - '8001:8001'
12
+ - '8020:8020'
13
+ - '8030:8030'
14
+ - '8040:8040'
15
+ depends_on:
16
+ - ipfs
17
+ - postgres
18
+ extra_hosts:
19
+ - host.docker.internal:host-gateway
20
+ environment:
21
+ postgres_host: postgres
22
+ postgres_user: graph-node
23
+ postgres_pass: let-me-in
24
+ postgres_db: graph-node
25
+ ipfs: 'ipfs:5001'
26
+ ethereum: 'mainnet:http://host.docker.internal:8545'
27
+ GRAPH_LOG: info
28
+ ipfs:
29
+ image: ipfs/kubo:v0.17.0
30
+ ports:
31
+ - '5001:5001'
32
+ volumes:
33
+ - ./data/ipfs:/data/ipfs
34
+ postgres:
35
+ image: postgres:14
36
+ ports:
37
+ - '5432:5432'
38
+ command:
39
+ [
40
+ "postgres",
41
+ "-cshared_preload_libraries=pg_stat_statements",
42
+ "-cmax_connections=200"
43
+ ]
44
+ environment:
45
+ POSTGRES_USER: graph-node
46
+ POSTGRES_PASSWORD: let-me-in
47
+ POSTGRES_DB: graph-node
48
+ # FIXME: remove this env. var. which we shouldn't need. Introduced by
49
+ # <https://github.com/graphprotocol/graph-node/pull/3511>, maybe as a
50
+ # workaround for https://github.com/docker/for-mac/issues/6270?
51
+ PGDATA: "/var/lib/postgresql/data"
52
+ POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
53
+ volumes:
54
+ - ./data/postgres:/var/lib/postgresql/data`;
55
+ };
56
+ exports.getDockerFile = getDockerFile;
@@ -29,6 +29,7 @@ export default class Scaffold {
29
29
  generateManifest(): Promise<string>;
30
30
  generateSchema(): Promise<string>;
31
31
  generateTsConfig(): Promise<string>;
32
+ generateDockerFileConfig(): Promise<string>;
32
33
  generateMappings(): Promise<{
33
34
  [x: string]: string;
34
35
  } | undefined>;
@@ -44,6 +45,7 @@ export default class Scaffold {
44
45
  'schema.graphql': string;
45
46
  'package.json': string;
46
47
  'tsconfig.json'?: undefined;
48
+ 'docker-compose.yml'?: undefined;
47
49
  src?: undefined;
48
50
  abis?: undefined;
49
51
  tests?: undefined;
@@ -52,6 +54,7 @@ export default class Scaffold {
52
54
  'subgraph.yaml': string;
53
55
  'schema.graphql': string;
54
56
  'tsconfig.json': string;
57
+ 'docker-compose.yml': string;
55
58
  src: {
56
59
  [x: string]: string;
57
60
  } | undefined;
@@ -7,6 +7,7 @@ const gluegun_1 = require("gluegun");
7
7
  const prettier_1 = __importDefault(require("prettier"));
8
8
  const subgraph_1 = require("../command-helpers/subgraph");
9
9
  const version_1 = require("../version");
10
+ const get_docker_file_1 = require("./get-docker-file");
10
11
  const mapping_1 = require("./mapping");
11
12
  const schema_1 = require("./schema");
12
13
  const tests_1 = require("./tests");
@@ -106,6 +107,9 @@ dataSources:
106
107
  include: ['src', 'tests'],
107
108
  }), { parser: 'json' });
108
109
  }
110
+ async generateDockerFileConfig() {
111
+ return await prettier_1.default.format((0, get_docker_file_1.getDockerFile)(), { parser: 'yaml' });
112
+ }
109
113
  async generateMappings() {
110
114
  return this.protocol.getMappingScaffold()
111
115
  ? { [`${gluegun_1.strings.kebabCase(this.contractName)}.ts`]: await this.generateMapping() }
@@ -151,6 +155,7 @@ dataSources:
151
155
  'subgraph.yaml': await this.generateManifest(),
152
156
  'schema.graphql': await this.generateSchema(),
153
157
  'tsconfig.json': await this.generateTsConfig(),
158
+ 'docker-compose.yml': await this.generateDockerFileConfig(),
154
159
  src: await this.generateMappings(),
155
160
  abis: await this.generateABIs(),
156
161
  tests: await this.generateTests(),
@@ -44,6 +44,7 @@ const BUILTIN_SCALAR_TYPES = [
44
44
  'Bytes',
45
45
  'ID',
46
46
  'Int8',
47
+ 'Timestamp',
47
48
  ];
48
49
  // Type suggestions for common mistakes
49
50
  const TYPE_SUGGESTIONS = [
@@ -64,6 +65,8 @@ const TYPE_SUGGESTIONS = [
64
65
  ['Float', 'BigDecimal'],
65
66
  ['int', 'Int'],
66
67
  ['int8', 'Int8'],
68
+ ['timestamp', 'Timestamp'],
69
+ ['ts', 'Timestamp'],
67
70
  ['uint', 'BigInt'],
68
71
  ['owner', 'String'],
69
72
  ['Owner', 'String'],
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.69.0-alpha-20240315144301-ea4b16f",
2
+ "version": "0.69.0-alpha-20240317072253-db1272f",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.69.0-alpha-20240315144301-ea4b16f",
3
+ "version": "0.69.0-alpha-20240317072253-db1272f",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {