@graphprotocol/graph-cli 0.23.2 → 0.24.0-alpha.0
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/package.json +1 -1
- package/examples/basic-event-handlers/yarn.lock +4 -4
- package/examples/example-subgraph/package.json +1 -1
- package/examples/example-subgraph/yarn.lock +4 -4
- package/package.json +1 -1
- package/src/migrations/mapping_api_version_0_0_5.js +74 -0
- package/src/scaffold.js +1 -1
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"deploy-test": "../../bin/graph deploy test/basic-event-handlers --version-label v0.0.1 --ipfs http://localhost:15001 --node http://127.0.0.1:18020"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@graphprotocol/graph-ts": "0.
|
|
12
|
+
"@graphprotocol/graph-ts": "0.24.0-alpha.0",
|
|
13
13
|
"apollo-fetch": "^0.7.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# yarn lockfile v1
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
"@graphprotocol/graph-ts@0.
|
|
6
|
-
version "0.
|
|
7
|
-
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.
|
|
8
|
-
integrity sha512-
|
|
5
|
+
"@graphprotocol/graph-ts@0.24.0-alpha.0":
|
|
6
|
+
version "0.24.0-alpha.0"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.24.0-alpha.0.tgz#8fe2b09a123adc5a65c82b823a1cb2d99f3cce2b"
|
|
8
|
+
integrity sha512-PLhTMlFMoLZpTqJlKH5f+5VRN3yWmXfssVwWk7uauVeY8IuAWjWB3RNubS574q9uf0QjPKOacekXY5EKRWOzEA==
|
|
9
9
|
dependencies:
|
|
10
10
|
assemblyscript "0.19.10"
|
|
11
11
|
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# yarn lockfile v1
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
"@graphprotocol/graph-ts@0.
|
|
6
|
-
version "0.
|
|
7
|
-
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.
|
|
8
|
-
integrity sha512-
|
|
5
|
+
"@graphprotocol/graph-ts@0.24.0-alpha.0":
|
|
6
|
+
version "0.24.0-alpha.0"
|
|
7
|
+
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.24.0-alpha.0.tgz#8fe2b09a123adc5a65c82b823a1cb2d99f3cce2b"
|
|
8
|
+
integrity sha512-PLhTMlFMoLZpTqJlKH5f+5VRN3yWmXfssVwWk7uauVeY8IuAWjWB3RNubS574q9uf0QjPKOacekXY5EKRWOzEA==
|
|
9
9
|
dependencies:
|
|
10
10
|
assemblyscript "0.19.10"
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const fs = require('fs-extra')
|
|
2
|
+
const semver = require('semver')
|
|
3
|
+
const toolbox = require('gluegun/toolbox')
|
|
4
|
+
const yaml = require('js-yaml')
|
|
5
|
+
const { loadManifest } = require('./util/load-manifest')
|
|
6
|
+
const { getGraphTsVersion } = require('./util/versions')
|
|
7
|
+
|
|
8
|
+
// If any of the manifest apiVersions are 0.0.5, replace them with 0.0.6
|
|
9
|
+
module.exports = {
|
|
10
|
+
name: 'Bump mapping apiVersion from 0.0.5 to 0.0.6',
|
|
11
|
+
predicate: async ({ sourceDir, manifestFile }) => {
|
|
12
|
+
// Obtain the graph-ts version, if possible
|
|
13
|
+
let graphTsVersion
|
|
14
|
+
try {
|
|
15
|
+
graphTsVersion = await getGraphTsVersion(sourceDir)
|
|
16
|
+
} catch (_) {
|
|
17
|
+
// If we cannot obtain the version, return a hint that the graph-ts
|
|
18
|
+
// hasn't been installed yet
|
|
19
|
+
return 'graph-ts dependency not installed yet'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let manifest = loadManifest(manifestFile)
|
|
23
|
+
return (
|
|
24
|
+
// Only migrate if the graph-ts version is >= 0.23.0...
|
|
25
|
+
// Coerce needed because we may be dealing with an alpha version
|
|
26
|
+
// and in the `semver` library this would not return true on equality.
|
|
27
|
+
semver.gte(semver.coerce(graphTsVersion), '0.24.0') &&
|
|
28
|
+
// ...and we have a manifest with mapping > apiVersion = 0.0.5
|
|
29
|
+
manifest &&
|
|
30
|
+
typeof manifest === 'object' &&
|
|
31
|
+
Array.isArray(manifest.dataSources) &&
|
|
32
|
+
(manifest.dataSources.reduce(
|
|
33
|
+
(hasOldMappings, dataSource) =>
|
|
34
|
+
hasOldMappings ||
|
|
35
|
+
(typeof dataSource === 'object' &&
|
|
36
|
+
dataSource.mapping &&
|
|
37
|
+
typeof dataSource.mapping === 'object' &&
|
|
38
|
+
dataSource.mapping.apiVersion === '0.0.5'),
|
|
39
|
+
false,
|
|
40
|
+
) ||
|
|
41
|
+
(Array.isArray(manifest.templates) &&
|
|
42
|
+
manifest.templates.reduce(
|
|
43
|
+
(hasOldMappings, template) =>
|
|
44
|
+
hasOldMappings ||
|
|
45
|
+
(typeof template === 'object' &&
|
|
46
|
+
template.mapping &&
|
|
47
|
+
typeof template.mapping === 'object' &&
|
|
48
|
+
template.mapping.apiVersion === '0.0.5'),
|
|
49
|
+
false,
|
|
50
|
+
)))
|
|
51
|
+
)
|
|
52
|
+
},
|
|
53
|
+
apply: async ({ manifestFile }) => {
|
|
54
|
+
// Make sure we catch all variants; we could load the manifest
|
|
55
|
+
// and replace the values in the data structures here; unfortunately
|
|
56
|
+
// writing that back to the file messes with the formatting more than
|
|
57
|
+
// we'd like; that's why for now, we use a simple patching approach
|
|
58
|
+
await toolbox.patching.replace(
|
|
59
|
+
manifestFile,
|
|
60
|
+
new RegExp('apiVersion: 0.0.5', 'g'),
|
|
61
|
+
'apiVersion: 0.0.6',
|
|
62
|
+
)
|
|
63
|
+
await toolbox.patching.replace(
|
|
64
|
+
manifestFile,
|
|
65
|
+
new RegExp("apiVersion: '0.0.5'", 'g'),
|
|
66
|
+
"apiVersion: '0.0.6'",
|
|
67
|
+
)
|
|
68
|
+
await toolbox.patching.replace(
|
|
69
|
+
manifestFile,
|
|
70
|
+
new RegExp('apiVersion: "0.0.5"', 'g'),
|
|
71
|
+
'apiVersion: "0.0.6"',
|
|
72
|
+
)
|
|
73
|
+
},
|
|
74
|
+
}
|
package/src/scaffold.js
CHANGED