Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cognite/itg-cli

Package Overview
Dependencies
Maintainers
143
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cognite/itg-cli - npm Package Compare versions

Comparing version 0.0.1-alpha.1 to 0.0.1-alpha.2

12

lib/cmds/schema_cmds/validate.d.ts

@@ -1,1 +0,11 @@

export {};
export declare const command = "validate";
export declare const desc = "Validate schema";
export declare const builder: {
file: {
description: string;
alias: string;
};
'fail-on-invalid': {
description: string;
};
};

@@ -46,2 +46,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.builder = exports.desc = exports.command = void 0;
var graphql_request_1 = require("graphql-request");

@@ -57,2 +58,5 @@ var fs_1 = __importDefault(require("fs"));

},
'fail-on-invalid': {
description: 'Fail when passed an invalid schema',
},
};

@@ -78,2 +82,6 @@ var schemaRequest = graphql_request_1.gql(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n query ValidateSchema($schema: String!) {\n ValidateSchema(graphQLSchemaString: $schema) {\n valid\n }\n }\n"], ["\n query ValidateSchema($schema: String!) {\n ValidateSchema(graphQLSchemaString: $schema) {\n valid\n }\n }\n"])));

res = _a.sent();
if (!res.ValidateSchema.valid && argv['fail-on-invalid']) {
console.error(chalk_1.default.red('Invalid schema'));
process.exit(1);
}
console.log("Successfully checked validity of schema\n\tRESULT: Schema is " + (res.ValidateSchema.valid ? chalk_1.default.green('valid') : chalk_1.default.red('invalid')));

@@ -80,0 +88,0 @@ return [2 /*return*/];

2

package.json
{
"name": "@cognite/itg-cli",
"version": "0.0.1-alpha.1",
"version": "0.0.1-alpha.2",
"description": "A CLI for itg.cognite.ai",

@@ -5,0 +5,0 @@ "repository": "https://github.com/cognitedata/il-tempo-gigante/tree/master/packages/itg-cli",

# itg - A CLI for https://itg.cognite.ai
## Install
```bash

@@ -19,2 +20,8 @@ npm install -g @cognite/itg-cli

# Check if a schema is valid graphql and fits ITG requirements
itg schema validate -f mymodel.graphql
# For CI/CD, add flag to fail when invalid schema detected
itg schema validate --fail-on-invalid -f mymodel.graphql
# Add and replace a schema in itg

@@ -35,1 +42,5 @@ itg schema update -f mymodel.graphql

Set the COGNITE_CREDENTIALS variable with an api key for the respective cdf project to get access
## CI/CD
We expect the main use of the CLI for CI/CD will be validating and updating schemas. The validate step should be added to the `create pr` workflow, while the update step should be added to the `merge to master` workflow. Remember to include the `--fail-on-invalid` flag in the validate command to avoid false positives in the workflow.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc