@graphprotocol/graph-cli 0.46.2-alpha-20230413184333-359d69f → 0.46.2-alpha-20230413191858-806ff8a

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,6 +1,6 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.46.2-alpha-20230413184333-359d69f
3
+ ## 0.46.2-alpha-20230413191858-806ff8a
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -30,10 +30,6 @@
30
30
  Thanks [@saihaj](https://github.com/saihaj)! - refactor out immutable.js usage from schema
31
31
  generation
32
32
 
33
- - [#1291](https://github.com/graphprotocol/graph-tooling/pull/1291)
34
- [`569bb80`](https://github.com/graphprotocol/graph-tooling/commit/569bb80f387da90f8e054bc2f332e5b0de96a523)
35
- Thanks [@saihaj](https://github.com/saihaj)! - append /api/v0 automatically to Graph IPFS endpoint
36
-
37
33
  ## 0.46.1
38
34
 
39
35
  ### Patch Changes
@@ -26,32 +26,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.createCompiler = exports.appendApiVersionForGraph = void 0;
29
+ exports.createCompiler = void 0;
30
30
  const url_1 = require("url");
31
31
  const toolbox = __importStar(require("gluegun"));
32
32
  const ipfs_http_client_1 = require("ipfs-http-client");
33
33
  const compiler_1 = __importDefault(require("../compiler"));
34
- /**
35
- * Appends /api/v0 to the end of a The Graph IPFS URL
36
- */
37
- function appendApiVersionForGraph(inputString) {
38
- // Check if the input string is a valid The Graph IPFS URL
39
- const pattern = /^(https?:\/\/)?([\w-]+\.)+thegraph\.com\/ipfs\/?$/;
40
- if (pattern.test(inputString)) {
41
- // account for trailing slash
42
- if (inputString.endsWith('/')) {
43
- return inputString.slice(0, -1) + '/api/v0';
44
- }
45
- return inputString + '/api/v0';
46
- }
47
- return inputString;
48
- }
49
- exports.appendApiVersionForGraph = appendApiVersionForGraph;
50
34
  // Helper function to construct a subgraph compiler
51
35
  function createCompiler(manifest, { ipfs, headers, outputDir, outputFormat, skipMigrations, blockIpfsMethods, protocol, }) {
52
36
  // Validate the IPFS URL (if a node address was provided)
53
37
  try {
54
- if (ipfs && typeof ipfs === 'string')
38
+ if (ipfs)
55
39
  new url_1.URL(ipfs);
56
40
  }
57
41
  catch (e) {
@@ -60,11 +44,9 @@ The IPFS URL must be of the following format: http(s)://host[:port]/[path]`);
60
44
  return null;
61
45
  }
62
46
  // Connect to the IPFS node (if a node address was provided)
63
- const ipfsClient = ipfs
64
- ? (0, ipfs_http_client_1.create)({ url: appendApiVersionForGraph(ipfs.toString()), headers })
65
- : undefined;
47
+ ipfs = ipfs ? (0, ipfs_http_client_1.create)({ url: ipfs, headers }) : undefined;
66
48
  return new compiler_1.default({
67
- ipfs: ipfsClient,
49
+ ipfs,
68
50
  subgraphManifest: manifest,
69
51
  outputDir,
70
52
  outputFormat,
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.46.2-alpha-20230413184333-359d69f",
2
+ "version": "0.46.2-alpha-20230413191858-806ff8a",
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.46.2-alpha-20230413184333-359d69f",
3
+ "version": "0.46.2-alpha-20230413191858-806ff8a",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const compiler_1 = require("./compiler");
4
- describe('appendApiVersionForGraph', () => {
5
- it('append /api/v0 to Prod URL with trailing slash', () => {
6
- expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs/')).toBe('https://api.thegraph.com/ipfs/api/v0');
7
- });
8
- it('append /api/v0 to Prod URL without trailing slash', () => {
9
- expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs')).toBe('https://api.thegraph.com/ipfs/api/v0');
10
- });
11
- it('append /api/v0 to Staging URL without trailing slash', () => {
12
- expect((0, compiler_1.appendApiVersionForGraph)('https://staging.api.thegraph.com/ipfs')).toBe('https://staging.api.thegraph.com/ipfs/api/v0');
13
- });
14
- it('do nothing if Prod URL has /api/v0', () => {
15
- expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com/ipfs/api/v0')).toBe('https://api.thegraph.com/ipfs/api/v0');
16
- });
17
- it('do nothing if Prod URL has no /ipfs', () => {
18
- expect((0, compiler_1.appendApiVersionForGraph)('https://api.thegraph.com')).toBe('https://api.thegraph.com');
19
- });
20
- it('do nothing for non-graph endpoint', () => {
21
- expect((0, compiler_1.appendApiVersionForGraph)('https://ipfs.saihaj.dev/')).toBe('https://ipfs.saihaj.dev/');
22
- });
23
- it('do nothing for non-graph endpoint ending with /ipfs', () => {
24
- expect((0, compiler_1.appendApiVersionForGraph)('https://ipfs.saihaj.dev/ipfs/')).toBe('https://ipfs.saihaj.dev/ipfs/');
25
- });
26
- });