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

@hyperone/cli-core

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperone/cli-core - npm Package Compare versions

Comparing version 1.0.16 to 1.0.17

14

lib/json_schema.js
import $RefParser from '@apidevtools/json-schema-ref-parser';
import fetch from 'node-fetch';

@@ -8,7 +7,12 @@ export const lazy_resolver = (baseUrl, options = {}) => ({

// TODO: Support extensions parameter
read({ url /*, extensions */ }, callback) {
read({ url/*, extensions */ }, callback) {
return callback(null, async () => {
const path = new URL(url, baseUrl).toString();
const resp = await fetch(path);
const schema = await resp.json();
// json-schema-ref-parser is opinionated regarding environemnt
// See https://github.com/APIDevTools/json-schema-ref-parser/blob/5674d1941042602d81165dbbd46879071d4af9ba/lib/index.js#L103
// https://github.com/APIDevTools/json-schema-ref-parser/blob/5674d1941042602d81165dbbd46879071d4af9ba/lib/util/url.js#L33
if (url.startsWith(process.cwd())) {
url = url.replace(process.cwd(), '.');
}
url = new URL(url, baseUrl).toString();
const schema = await $RefParser.parse(url);
return $RefParser.dereference(schema, {

@@ -15,0 +19,0 @@ resolve: {

@@ -1,2 +0,1 @@

import fetch from 'node-fetch';
import $RefParser from '@apidevtools/json-schema-ref-parser';

@@ -14,11 +13,4 @@ import {lazy_resolver} from './json_schema';

init: async (options) => {
let schema;
const openapiUrl = options.openapiUrl || 'https://api.hyperone.com/v2/openapi.json';
if (options.openapiSpec) {
schema = options.openapiSpec;
} else {
const resp = await fetch(openapiUrl);
schema = await resp.json();
}
const schema = await $RefParser.parse(options.openapiSpec || openapiUrl);
Object.assign(spec, await $RefParser.dereference(schema, {

@@ -25,0 +17,0 @@ resolve: {

{
"name": "@hyperone/cli-core",
"version": "1.0.16",
"version": "1.0.17",
"description": "",

@@ -8,3 +8,3 @@ "main": "index.js",

"@apidevtools/json-schema-ref-parser": "^9.0.3",
"@hyperone/cli-framework": "^1.0.12",
"@hyperone/cli-framework": "^1.0.17",
"camel-case": "^4.1.1",

@@ -30,3 +30,3 @@ "command-line-args": "^5.1.1",

"license": "MIT",
"gitHead": "f965f99bb528f0d8a3aa513fe37d64627c6361d9"
"gitHead": "596e620b30d7431c04af75d402f5f986e1569c34"
}
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