@graphprotocol/graph-cli 0.37.4-alpha-20230117095424-b5750b1 → 0.37.4

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 (100) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/package.json +1 -1
  3. package/dist/bin.js +0 -6
  4. package/dist/cli.js +0 -26
  5. package/dist/codegen/schema.js +0 -244
  6. package/dist/codegen/schema.test.js +0 -455
  7. package/dist/codegen/template.js +0 -66
  8. package/dist/codegen/types/conversions.js +0 -335
  9. package/dist/codegen/types/index.js +0 -71
  10. package/dist/codegen/types/index.test.js +0 -563
  11. package/dist/codegen/typescript.js +0 -200
  12. package/dist/codegen/util.js +0 -40
  13. package/dist/codegen/util.test.js +0 -93
  14. package/dist/command-helpers/abi.js +0 -76
  15. package/dist/command-helpers/auth.js +0 -76
  16. package/dist/command-helpers/compiler.js +0 -66
  17. package/dist/command-helpers/data-sources.js +0 -29
  18. package/dist/command-helpers/fs.js +0 -9
  19. package/dist/command-helpers/gluegun.js +0 -48
  20. package/dist/command-helpers/ipfs.js +0 -5
  21. package/dist/command-helpers/jsonrpc.js +0 -27
  22. package/dist/command-helpers/network.js +0 -90
  23. package/dist/command-helpers/network.test.js +0 -86
  24. package/dist/command-helpers/node.js +0 -40
  25. package/dist/command-helpers/scaffold.js +0 -110
  26. package/dist/command-helpers/spinner.js +0 -80
  27. package/dist/command-helpers/studio.js +0 -14
  28. package/dist/command-helpers/studio.test.js +0 -41
  29. package/dist/command-helpers/subgraph.js +0 -22
  30. package/dist/command-helpers/version.js +0 -66
  31. package/dist/command-helpers/version.test.js +0 -186
  32. package/dist/commands/add.js +0 -187
  33. package/dist/commands/auth.js +0 -122
  34. package/dist/commands/build.js +0 -136
  35. package/dist/commands/codegen.js +0 -128
  36. package/dist/commands/create.js +0 -94
  37. package/dist/commands/deploy.js +0 -335
  38. package/dist/commands/init.js +0 -800
  39. package/dist/commands/local.js +0 -380
  40. package/dist/commands/remove.js +0 -95
  41. package/dist/commands/test.js +0 -293
  42. package/dist/compiler/asc.js +0 -83
  43. package/dist/compiler/index.js +0 -466
  44. package/dist/debug.js +0 -16
  45. package/dist/migrations/mapping_api_version_0_0_1.js +0 -83
  46. package/dist/migrations/mapping_api_version_0_0_2.js +0 -83
  47. package/dist/migrations/mapping_api_version_0_0_3.js +0 -83
  48. package/dist/migrations/mapping_api_version_0_0_4.js +0 -85
  49. package/dist/migrations/mapping_api_version_0_0_5.js +0 -85
  50. package/dist/migrations/spec_version_0_0_2.js +0 -45
  51. package/dist/migrations/spec_version_0_0_3.js +0 -50
  52. package/dist/migrations/util/load-manifest.js +0 -16
  53. package/dist/migrations/util/versions.js +0 -28
  54. package/dist/migrations.js +0 -54
  55. package/dist/protocols/arweave/manifest.graphql +0 -57
  56. package/dist/protocols/arweave/scaffold/manifest.js +0 -18
  57. package/dist/protocols/arweave/scaffold/mapping.js +0 -52
  58. package/dist/protocols/arweave/subgraph.js +0 -23
  59. package/dist/protocols/contract.js +0 -2
  60. package/dist/protocols/cosmos/manifest.graphql +0 -76
  61. package/dist/protocols/cosmos/scaffold/manifest.js +0 -15
  62. package/dist/protocols/cosmos/scaffold/mapping.js +0 -38
  63. package/dist/protocols/cosmos/subgraph.js +0 -28
  64. package/dist/protocols/ethereum/abi.js +0 -138
  65. package/dist/protocols/ethereum/codegen/abi.js +0 -474
  66. package/dist/protocols/ethereum/codegen/abi.test.js +0 -325
  67. package/dist/protocols/ethereum/codegen/template.js +0 -52
  68. package/dist/protocols/ethereum/contract.js +0 -22
  69. package/dist/protocols/ethereum/manifest.graphql +0 -94
  70. package/dist/protocols/ethereum/scaffold/manifest.js +0 -32
  71. package/dist/protocols/ethereum/scaffold/mapping.js +0 -65
  72. package/dist/protocols/ethereum/subgraph.js +0 -172
  73. package/dist/protocols/ethereum/type-generator.js +0 -123
  74. package/dist/protocols/index.js +0 -266
  75. package/dist/protocols/ipfs/codegen/file_template.js +0 -53
  76. package/dist/protocols/near/contract.js +0 -41
  77. package/dist/protocols/near/manifest.graphql +0 -64
  78. package/dist/protocols/near/scaffold/manifest.js +0 -16
  79. package/dist/protocols/near/scaffold/mapping.js +0 -38
  80. package/dist/protocols/near/subgraph.js +0 -23
  81. package/dist/protocols/subgraph.js +0 -2
  82. package/dist/protocols/substreams/manifest.graphql +0 -45
  83. package/dist/protocols/substreams/scaffold/manifest.js +0 -12
  84. package/dist/protocols/substreams/subgraph.js +0 -23
  85. package/dist/scaffold/cosmos.test.js +0 -82
  86. package/dist/scaffold/ethereum.test.js +0 -496
  87. package/dist/scaffold/index.js +0 -133
  88. package/dist/scaffold/mapping.js +0 -57
  89. package/dist/scaffold/near.test.js +0 -85
  90. package/dist/scaffold/schema.js +0 -86
  91. package/dist/scaffold/tests.js +0 -179
  92. package/dist/schema.js +0 -54
  93. package/dist/subgraph.js +0 -243
  94. package/dist/type-generator.js +0 -225
  95. package/dist/validation/contract.js +0 -44
  96. package/dist/validation/index.js +0 -10
  97. package/dist/validation/manifest.js +0 -266
  98. package/dist/validation/schema.js +0 -768
  99. package/dist/validation/schema.test.js +0 -35
  100. package/dist/watcher.js +0 -79
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schema_1 = require("./schema");
4
- describe('Schema validation', () => {
5
- test('Type suggestions', () => {
6
- expect((0, schema_1.typeSuggestion)('Address')).toEqual('Bytes');
7
- expect((0, schema_1.typeSuggestion)('address')).toEqual('Bytes');
8
- expect((0, schema_1.typeSuggestion)('bytes')).toEqual('Bytes');
9
- expect((0, schema_1.typeSuggestion)('string')).toEqual('String');
10
- expect((0, schema_1.typeSuggestion)('bool')).toEqual('Boolean');
11
- expect((0, schema_1.typeSuggestion)('boolean')).toEqual('Boolean');
12
- expect((0, schema_1.typeSuggestion)('float')).toEqual('BigDecimal');
13
- expect((0, schema_1.typeSuggestion)('Float')).toEqual('BigDecimal');
14
- expect((0, schema_1.typeSuggestion)(`int`)).toBe('Int');
15
- expect((0, schema_1.typeSuggestion)(`uint`)).toBe('BigInt');
16
- expect((0, schema_1.typeSuggestion)(`uint32`)).toBe('BigInt');
17
- // Test i8..i32, int8..int32
18
- for (let i = 8; i <= 32; i += 8) {
19
- expect((0, schema_1.typeSuggestion)(`i${i}`)).toBe('Int');
20
- expect((0, schema_1.typeSuggestion)(`int${i}`)).toBe('Int');
21
- }
22
- // Test u8..u24, uint8..uint24
23
- for (let i = 8; i <= 24; i += 8) {
24
- expect((0, schema_1.typeSuggestion)(`u${i}`)).toBe('Int');
25
- expect((0, schema_1.typeSuggestion)(`uint${i}`)).toBe('Int');
26
- }
27
- // Test i40..i256, int40..int256, u40..u256, uint40..uint256
28
- for (let i = 40; i <= 256; i += 8) {
29
- expect((0, schema_1.typeSuggestion)(`i${i}`)).toBe('BigInt');
30
- expect((0, schema_1.typeSuggestion)(`int${i}`)).toBe('BigInt');
31
- expect((0, schema_1.typeSuggestion)(`u${i}`)).toBe('BigInt');
32
- expect((0, schema_1.typeSuggestion)(`uint${i}`)).toBe('BigInt');
33
- }
34
- });
35
- });
package/dist/watcher.js DELETED
@@ -1,79 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = __importDefault(require("path"));
7
- const chokidar_1 = __importDefault(require("chokidar"));
8
- class Watcher {
9
- onReady;
10
- onTrigger;
11
- onCollectFiles;
12
- onError;
13
- watcher;
14
- constructor(options) {
15
- const { onReady, onTrigger, onCollectFiles, onError } = options;
16
- this.onReady = onReady;
17
- this.onTrigger = onTrigger;
18
- this.onCollectFiles = onCollectFiles;
19
- this.onError = onError;
20
- }
21
- async watch() {
22
- // Collect files to watch
23
- const files = await this.onCollectFiles();
24
- // Initialize watcher
25
- this.watcher = chokidar_1.default.watch(files, {
26
- persistent: true,
27
- ignoreInitial: true,
28
- atomic: 500,
29
- });
30
- // Bind variables locally
31
- const watcher = this.watcher;
32
- const onTrigger = this.onTrigger;
33
- const onCollectFiles = this.onCollectFiles;
34
- const onError = this.onError;
35
- const onReady = this.onReady;
36
- watcher.on('ready', async () => {
37
- // Notify listeners that we're watching
38
- onReady();
39
- // Trigger once when ready
40
- await onTrigger(undefined);
41
- });
42
- watcher.on('error', (error) => {
43
- onError(error);
44
- });
45
- watcher.on('all', async (_, file) => {
46
- try {
47
- // Collect watch all new files to watch
48
- const newFiles = await onCollectFiles();
49
- // Collect watched files, if there are any
50
- let watchedFiles = [];
51
- const watched = watcher.getWatched();
52
- watchedFiles = Object.keys(watched).reduce((files, dirname) => watched[dirname].reduce((files, filename) => {
53
- files.push(path_1.default.resolve(path_1.default.join(dirname, filename)));
54
- return files;
55
- }, files), []);
56
- const diff = (xs, ys) => ({
57
- added: ys.filter((y) => !xs.includes(y)),
58
- removed: xs.filter((x) => !ys.includes(x)),
59
- });
60
- // Diff previously watched files and new files; then remove and
61
- // add files from/to the watcher accordingly
62
- const filesDiff = diff(watchedFiles, newFiles);
63
- watcher.unwatch(filesDiff.removed);
64
- watcher.add(filesDiff.added);
65
- // Run the trigger callback
66
- await onTrigger(file);
67
- }
68
- catch (e) {
69
- onError(e);
70
- }
71
- });
72
- }
73
- close() {
74
- if (this.watcher !== undefined) {
75
- this.watcher.close();
76
- }
77
- }
78
- }
79
- exports.default = Watcher;