@graphprotocol/graph-cli 0.62.0 → 0.62.1-alpha-20231124170720-3199a59

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,5 +1,13 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.62.1-alpha-20231124170720-3199a59
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1521](https://github.com/graphprotocol/graph-tooling/pull/1521)
8
+ [`51376c2`](https://github.com/graphprotocol/graph-tooling/commit/51376c29b39fac46910680e66e6f42672e8f3c71)
9
+ Thanks [@saihaj](https://github.com/saihaj)! - remove studio network validation checks
10
+
3
11
  ## 0.62.0
4
12
 
5
13
  ### Minor Changes
@@ -38,7 +38,6 @@ const ipfs_1 = require("../command-helpers/ipfs");
38
38
  const jsonrpc_1 = require("../command-helpers/jsonrpc");
39
39
  const network_1 = require("../command-helpers/network");
40
40
  const node_1 = require("../command-helpers/node");
41
- const studio_1 = require("../command-helpers/studio");
42
41
  const version_1 = require("../command-helpers/version");
43
42
  const constants_1 = require("../constants");
44
43
  const protocols_1 = __importDefault(require("../protocols"));
@@ -293,27 +292,9 @@ class DeployCommand extends core_1.Command {
293
292
  this.error(`Could not find subgraph manifest at IPFS hash ${ipfsHash}`, { exit: 1 });
294
293
  }
295
294
  await ipfsClient.pin.add(ipfsHash);
296
- try {
297
- const dataSourcesAndTemplates = DataSourcesExtractor.fromManifestString(manifestFile);
298
- for (const { network } of dataSourcesAndTemplates) {
299
- (0, studio_1.validateStudioNetwork)({ studio, product, network });
300
- }
301
- }
302
- catch (e) {
303
- this.error(e, { exit: 1 });
304
- }
305
295
  await deploySubgraph(ipfsHash);
306
296
  return;
307
297
  }
308
- try {
309
- const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifest);
310
- for (const { network } of dataSourcesAndTemplates) {
311
- (0, studio_1.validateStudioNetwork)({ studio, product, network });
312
- }
313
- }
314
- catch (e) {
315
- this.error(e, { exit: 1 });
316
- }
317
298
  let protocol;
318
299
  try {
319
300
  // Checks to make sure deploy doesn't run against
@@ -37,7 +37,6 @@ const network_1 = require("../command-helpers/network");
37
37
  const node_1 = require("../command-helpers/node");
38
38
  const scaffold_1 = require("../command-helpers/scaffold");
39
39
  const spinner_1 = require("../command-helpers/spinner");
40
- const studio_1 = require("../command-helpers/studio");
41
40
  const subgraph_1 = require("../command-helpers/subgraph");
42
41
  const debug_1 = __importDefault(require("../debug"));
43
42
  const protocols_1 = __importDefault(require("../protocols"));
@@ -144,8 +143,6 @@ class InitCommand extends core_1.Command {
144
143
  subgraphName,
145
144
  contractName,
146
145
  node,
147
- studio,
148
- product,
149
146
  startBlock,
150
147
  spkgPath,
151
148
  skipInstall,
@@ -212,8 +209,6 @@ class InitCommand extends core_1.Command {
212
209
  indexEvents: answers.indexEvents,
213
210
  contractName: answers.contractName,
214
211
  node,
215
- studio: answers.studio,
216
- product: answers.product,
217
212
  startBlock: answers.startBlock,
218
213
  spkgPath: answers.spkgPath,
219
214
  skipInstall,
@@ -831,7 +826,7 @@ async function initSubgraphFromExample({ fromExample, allowSimpleName, subgraphN
831
826
  }
832
827
  printNextSteps.bind(this)({ subgraphName, directory }, { commands });
833
828
  }
834
- async function initSubgraphFromContract({ protocolInstance, allowSimpleName, subgraphName, directory, abi, network, contract, indexEvents, contractName, node, studio, product, startBlock, spkgPath, skipInstall, }, { commands, addContract, }) {
829
+ async function initSubgraphFromContract({ protocolInstance, allowSimpleName, subgraphName, directory, abi, network, contract, indexEvents, contractName, node, startBlock, spkgPath, skipInstall, }, { commands, addContract, }) {
835
830
  const isSubstreams = protocolInstance.name === 'substreams';
836
831
  // Fail if the subgraph name is invalid
837
832
  if (!revalidateSubgraphName.bind(this)(subgraphName, { allowSimpleName })) {
@@ -849,15 +844,6 @@ async function initSubgraphFromContract({ protocolInstance, allowSimpleName, sub
849
844
  // Fail if the ABI does not contain any events
850
845
  this.error(`ABI does not contain any events`, { exit: 1 });
851
846
  }
852
- // We can validate this before the scaffold because we receive
853
- // the network from the form or via command line argument.
854
- // We don't need to read the manifest in this case.
855
- try {
856
- (0, studio_1.validateStudioNetwork)({ studio, product, network });
857
- }
858
- catch (e) {
859
- this.error(e, { exit: 1 });
860
- }
861
847
  // Scaffold subgraph
862
848
  const scaffold = await (0, spinner_1.withSpinner)(`Create subgraph scaffold`, `Failed to create subgraph scaffold`, `Warnings while creating subgraph scaffold`, async (spinner) => {
863
849
  const scaffold = await (0, scaffold_1.generateScaffold)({
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.62.0",
2
+ "version": "0.62.1-alpha-20231124170720-3199a59",
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.62.0",
3
+ "version": "0.62.1-alpha-20231124170720-3199a59",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {
@@ -1,6 +0,0 @@
1
- export declare const allowedStudioNetworks: readonly ["mainnet", "rinkeby", "goerli", "gnosis", "chapel", "optimism-goerli", "clover", "fantom", "matic", "fantom-testnet", "arbitrum-goerli", "fuji", "celo-alfajores", "mumbai", "aurora-testnet", "near-testnet", "optimism", "optimism-goerli", "theta-testnet-001", "osmo-test-4", "base-testnet", "base", "celo", "arbitrum-one", "arbitrum-sepolia", "avalanche", "zksync-era", "zksync-era-testnet", "sepolia", "polygon-zkevm-testnet", "polygon-zkevm", "scroll-sepolia", "scroll"];
2
- export declare const validateStudioNetwork: ({ studio, product, network, }: {
3
- studio?: string | boolean | undefined;
4
- product?: string | undefined;
5
- network?: string | undefined;
6
- }) => void;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateStudioNetwork = exports.allowedStudioNetworks = void 0;
4
- exports.allowedStudioNetworks = [
5
- 'mainnet',
6
- 'rinkeby',
7
- 'goerli',
8
- 'gnosis',
9
- 'chapel',
10
- 'optimism-goerli',
11
- 'clover',
12
- 'fantom',
13
- 'matic',
14
- 'fantom-testnet',
15
- 'arbitrum-goerli',
16
- 'fuji',
17
- 'celo-alfajores',
18
- 'mumbai',
19
- 'aurora-testnet',
20
- 'near-testnet',
21
- 'optimism',
22
- 'optimism-goerli',
23
- 'theta-testnet-001',
24
- 'osmo-test-4',
25
- 'base-testnet',
26
- 'base',
27
- 'celo',
28
- 'arbitrum-one',
29
- 'arbitrum-sepolia',
30
- 'avalanche',
31
- 'zksync-era',
32
- 'zksync-era-testnet',
33
- 'sepolia',
34
- 'polygon-zkevm-testnet',
35
- 'polygon-zkevm',
36
- 'scroll-sepolia',
37
- 'scroll',
38
- ];
39
- const validateStudioNetwork = ({ studio, product, network, }) => {
40
- const isStudio = studio || product === 'subgraph-studio';
41
- const isAllowedNetwork = !network ||
42
- exports.allowedStudioNetworks.includes(
43
- // @ts-expect-error we're checking if the network is allowed
44
- network);
45
- if (isStudio && !isAllowedNetwork) {
46
- throw new Error(`The Subgraph Studio only allows subgraphs for these networks: ${exports.allowedStudioNetworks.join(', ')}`);
47
- }
48
- };
49
- exports.validateStudioNetwork = validateStudioNetwork;
@@ -1 +0,0 @@
1
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const studio_1 = require("./studio");
4
- describe('Version Command Helpers', () => {
5
- describe('validateStudioNetwork', () => {
6
- describe("When it's studio", () => {
7
- test("And it's Ethereum mainnet", () => {
8
- expect(() => (0, studio_1.validateStudioNetwork)({
9
- studio: true,
10
- network: 'mainnet',
11
- })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
12
- });
13
- test("And it's Gnosis chain", () => {
14
- expect(() => (0, studio_1.validateStudioNetwork)({
15
- studio: true,
16
- network: 'gnosis',
17
- })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
18
- });
19
- test('And no network is passed', () => {
20
- expect(() => (0, studio_1.validateStudioNetwork)({
21
- studio: true,
22
- network: undefined,
23
- })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
24
- });
25
- test("And it's NOT an allowed network", () => {
26
- expect(() => (0, studio_1.validateStudioNetwork)({
27
- product: 'subgraph-studio',
28
- network: 'moonriver',
29
- })).toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
30
- });
31
- });
32
- describe("When it's NOT studio", () => {
33
- test("And it's Rinkeby", () => {
34
- expect(() => (0, studio_1.validateStudioNetwork)({
35
- studio: false,
36
- network: 'rinkeby',
37
- })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
38
- });
39
- test("And it's NOT an allowed network", () => {
40
- expect(() => (0, studio_1.validateStudioNetwork)({
41
- product: 'hosted-service',
42
- network: 'celo',
43
- })).not.toThrow(new Error(`The Subgraph Studio only allows subgraphs for these networks: ${studio_1.allowedStudioNetworks.join(', ')}`));
44
- });
45
- });
46
- });
47
- });