New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@redocly/openapi-core

Package Overview
Dependencies
Maintainers
4
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redocly/openapi-core - npm Package Compare versions

Comparing version 1.0.0-beta.32 to 1.0.0-beta.33

4

lib/redocly/index.d.ts

@@ -7,5 +7,5 @@ export declare class RedoclyClient {

isAuthorizedWithRedocly(): Promise<boolean>;
verifyToken(accessToken: string): Promise<boolean>;
verifyToken(accessToken: string, verbose?: boolean): Promise<boolean>;
getAuthorizationHeader(): Promise<string | undefined>;
login(accessToken: string): Promise<void>;
login(accessToken: string, verbose?: boolean): Promise<void>;
logout(): void;

@@ -12,0 +12,0 @@ query(queryString: string, parameters?: {}, headers?: {}): Promise<any>;

@@ -42,7 +42,7 @@ "use strict";

}
verifyToken(accessToken) {
verifyToken(accessToken, verbose = false) {
return __awaiter(this, void 0, void 0, function* () {
if (!accessToken)
return false;
const authDetails = yield RedoclyClient.authorize(accessToken, true);
const authDetails = yield RedoclyClient.authorize(accessToken, verbose);
if (!authDetails)

@@ -57,3 +57,3 @@ return false;

if (this.accessToken && !(yield this.verifyToken(this.accessToken))) {
process.stderr.write(`${colorette_1.yellow('Warning:')} invalid Redoc.ly access token. Use "npx @redocly/openapi-cli login" to provide your access token\n`);
process.stderr.write(`${colorette_1.yellow('Warning:')} invalid Redocly API key. Use "npx @redocly/openapi-cli login" to provide your API key\n`);
return undefined;

@@ -64,9 +64,9 @@ }

}
login(accessToken) {
login(accessToken, verbose = false) {
return __awaiter(this, void 0, void 0, function* () {
const credentialsPath = path_1.resolve(os_1.homedir(), TOKEN_FILENAME);
process.stdout.write(colorette_1.gray('\n Logging in...\n'));
const authorized = yield this.verifyToken(accessToken);
const authorized = yield this.verifyToken(accessToken, verbose);
if (!authorized) {
process.stdout.write(colorette_1.red('Authorization failed. Please check if you entered a valid token.\n'));
process.stdout.write(colorette_1.red('Authorization failed. Please check if you entered a valid API key.\n'));
process.exit(1);

@@ -87,3 +87,3 @@ }

}
process.stdout.write('Logged out from the Redoc.ly account. ✋\n');
process.stdout.write('Logged out from the Redocly account. ✋\n');
}

@@ -90,0 +90,0 @@ query(queryString, parameters = {}, headers = {}) {

{
"name": "@redocly/openapi-core",
"version": "1.0.0-beta.32",
"version": "1.0.0-beta.33",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -5,2 +5,22 @@ # openapi-core

TBD
## Basic usage
### Lint
```js
import { formatProblems, lint, loadConfig } from '@redocly/openapi-core';
const pathToEntryPoint = 'openapi.yaml';
const config = loadConfig('optional/path/to/.redocly.yaml');
const lintResults = await lint({ ref: pathToEntryPoint, config });
```
### Bundle
```js
import { formatProblems, bundle, loadConfig } from '@redocly/openapi-core';
const pathToEntryPoint = 'openapi.yaml';
const config = loadConfig('optional/path/to/.redocly.yaml');
const { bundle, problems } = await bundle({ ref: pathToEntryPoint, config });
```

@@ -37,5 +37,5 @@ import { existsSync, readFileSync, writeFileSync, unlinkSync } from 'fs';

async verifyToken(accessToken: string): Promise<boolean> {
async verifyToken(accessToken: string, verbose: boolean = false): Promise<boolean> {
if (!accessToken) return false;
const authDetails = await RedoclyClient.authorize(accessToken, true);
const authDetails = await RedoclyClient.authorize(accessToken, verbose);
if (!authDetails) return false;

@@ -51,3 +51,3 @@ return true;

'Warning:',
)} invalid Redoc.ly access token. Use "npx @redocly/openapi-cli login" to provide your access token\n`,
)} invalid Redocly API key. Use "npx @redocly/openapi-cli login" to provide your API key\n`,
);

@@ -59,11 +59,11 @@ return undefined;

async login(accessToken: string) {
async login(accessToken: string, verbose: boolean = false) {
const credentialsPath = resolve(homedir(), TOKEN_FILENAME);
process.stdout.write(gray('\n Logging in...\n'));
const authorized = await this.verifyToken(accessToken);
const authorized = await this.verifyToken(accessToken, verbose);
if (!authorized) {
process.stdout.write(
red('Authorization failed. Please check if you entered a valid token.\n'),
red('Authorization failed. Please check if you entered a valid API key.\n'),
);

@@ -87,3 +87,3 @@ process.exit(1);

}
process.stdout.write('Logged out from the Redoc.ly account. ✋\n');
process.stdout.write('Logged out from the Redocly account. ✋\n');
}

@@ -90,0 +90,0 @@

Sorry, the diff of this file is not supported yet

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