@graphprotocol/graph-cli 0.37.3-alpha-20230113140726-64762bb → 0.37.3
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 +5 -1
- package/package.json +1 -1
- package/src/cli.ts +1 -1
- package/src/command-helpers/abi.ts +2 -0
- package/src/command-helpers/auth.ts +3 -3
- package/src/command-helpers/compiler.ts +1 -1
- package/src/command-helpers/fs.ts +1 -1
- package/src/command-helpers/network.test.ts +1 -1
- package/src/command-helpers/network.ts +1 -1
- package/src/command-helpers/node.ts +1 -1
- package/src/command-helpers/scaffold.ts +1 -1
- package/src/commands/codegen.ts +1 -1
- package/src/commands/create.ts +1 -1
- package/src/commands/deploy.ts +2 -2
- package/src/commands/init.ts +3 -3
- package/src/commands/local.ts +4 -4
- package/src/commands/remove.ts +1 -1
- package/src/commands/test.ts +3 -3
- package/src/compiler/index.ts +2 -2
- package/src/migrations/util/load-manifest.ts +1 -1
- package/src/migrations/util/versions.ts +1 -1
- package/src/protocols/ethereum/abi.ts +1 -1
- package/src/protocols/ethereum/codegen/abi.test.ts +1 -1
- package/src/protocols/ethereum/codegen/abi.ts +1 -1
- package/src/protocols/ethereum/type-generator.ts +1 -1
- package/src/subgraph.ts +1 -1
- package/src/type-generator.ts +1 -1
- package/src/validation/manifest.ts +2 -2
- package/src/validation/schema.ts +1 -1
- package/src/watcher.ts +1 -1
- package/tests/cli/init.test.ts +1 -1
- package/tests/cli/spawn-command.d.ts +1 -1
- package/tests/cli/util.ts +1 -1
- package/dist/bin.js +0 -6
- package/dist/cli.js +0 -26
- package/dist/codegen/schema.js +0 -244
- package/dist/codegen/schema.test.js +0 -455
- package/dist/codegen/template.js +0 -66
- package/dist/codegen/types/conversions.js +0 -335
- package/dist/codegen/types/index.js +0 -71
- package/dist/codegen/types/index.test.js +0 -563
- package/dist/codegen/typescript.js +0 -200
- package/dist/codegen/util.js +0 -40
- package/dist/codegen/util.test.js +0 -93
- package/dist/command-helpers/abi.js +0 -74
- package/dist/command-helpers/auth.js +0 -76
- package/dist/command-helpers/compiler.js +0 -66
- package/dist/command-helpers/data-sources.js +0 -29
- package/dist/command-helpers/fs.js +0 -9
- package/dist/command-helpers/gluegun.js +0 -48
- package/dist/command-helpers/ipfs.js +0 -5
- package/dist/command-helpers/jsonrpc.js +0 -27
- package/dist/command-helpers/network.js +0 -90
- package/dist/command-helpers/network.test.js +0 -86
- package/dist/command-helpers/node.js +0 -40
- package/dist/command-helpers/scaffold.js +0 -110
- package/dist/command-helpers/spinner.js +0 -80
- package/dist/command-helpers/studio.js +0 -14
- package/dist/command-helpers/studio.test.js +0 -41
- package/dist/command-helpers/subgraph.js +0 -22
- package/dist/command-helpers/version.js +0 -66
- package/dist/command-helpers/version.test.js +0 -186
- package/dist/commands/add.js +0 -187
- package/dist/commands/auth.js +0 -122
- package/dist/commands/build.js +0 -136
- package/dist/commands/codegen.js +0 -128
- package/dist/commands/create.js +0 -94
- package/dist/commands/deploy.js +0 -335
- package/dist/commands/init.js +0 -800
- package/dist/commands/local.js +0 -380
- package/dist/commands/remove.js +0 -95
- package/dist/commands/test.js +0 -293
- package/dist/compiler/asc.js +0 -83
- package/dist/compiler/index.js +0 -466
- package/dist/debug.js +0 -16
- package/dist/migrations/mapping_api_version_0_0_1.js +0 -83
- package/dist/migrations/mapping_api_version_0_0_2.js +0 -83
- package/dist/migrations/mapping_api_version_0_0_3.js +0 -83
- package/dist/migrations/mapping_api_version_0_0_4.js +0 -85
- package/dist/migrations/mapping_api_version_0_0_5.js +0 -85
- package/dist/migrations/spec_version_0_0_2.js +0 -45
- package/dist/migrations/spec_version_0_0_3.js +0 -50
- package/dist/migrations/util/load-manifest.js +0 -16
- package/dist/migrations/util/versions.js +0 -28
- package/dist/migrations.js +0 -54
- package/dist/protocols/arweave/manifest.graphql +0 -57
- package/dist/protocols/arweave/scaffold/manifest.js +0 -18
- package/dist/protocols/arweave/scaffold/mapping.js +0 -52
- package/dist/protocols/arweave/subgraph.js +0 -23
- package/dist/protocols/contract.js +0 -2
- package/dist/protocols/cosmos/manifest.graphql +0 -76
- package/dist/protocols/cosmos/scaffold/manifest.js +0 -15
- package/dist/protocols/cosmos/scaffold/mapping.js +0 -38
- package/dist/protocols/cosmos/subgraph.js +0 -28
- package/dist/protocols/ethereum/abi.js +0 -138
- package/dist/protocols/ethereum/codegen/abi.js +0 -474
- package/dist/protocols/ethereum/codegen/abi.test.js +0 -325
- package/dist/protocols/ethereum/codegen/template.js +0 -52
- package/dist/protocols/ethereum/contract.js +0 -22
- package/dist/protocols/ethereum/manifest.graphql +0 -94
- package/dist/protocols/ethereum/scaffold/manifest.js +0 -32
- package/dist/protocols/ethereum/scaffold/mapping.js +0 -65
- package/dist/protocols/ethereum/subgraph.js +0 -172
- package/dist/protocols/ethereum/type-generator.js +0 -123
- package/dist/protocols/index.js +0 -266
- package/dist/protocols/ipfs/codegen/file_template.js +0 -53
- package/dist/protocols/near/contract.js +0 -41
- package/dist/protocols/near/manifest.graphql +0 -64
- package/dist/protocols/near/scaffold/manifest.js +0 -16
- package/dist/protocols/near/scaffold/mapping.js +0 -38
- package/dist/protocols/near/subgraph.js +0 -23
- package/dist/protocols/subgraph.js +0 -2
- package/dist/protocols/substreams/manifest.graphql +0 -45
- package/dist/protocols/substreams/scaffold/manifest.js +0 -12
- package/dist/protocols/substreams/subgraph.js +0 -23
- package/dist/scaffold/cosmos.test.js +0 -82
- package/dist/scaffold/ethereum.test.js +0 -496
- package/dist/scaffold/index.js +0 -133
- package/dist/scaffold/mapping.js +0 -57
- package/dist/scaffold/near.test.js +0 -85
- package/dist/scaffold/schema.js +0 -86
- package/dist/scaffold/tests.js +0 -179
- package/dist/schema.js +0 -54
- package/dist/subgraph.js +0 -243
- package/dist/type-generator.js +0 -225
- package/dist/validation/contract.js +0 -44
- package/dist/validation/index.js +0 -10
- package/dist/validation/manifest.js +0 -266
- package/dist/validation/schema.js +0 -768
- package/dist/validation/schema.test.js +0 -35
- 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 node_path_1 = __importDefault(require("node: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(node_path_1.default.resolve(node_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;
|