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

@ovotech/laminar-cli

Package Overview
Dependencies
Maintainers
267
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ovotech/laminar-cli - npm Package Compare versions

Comparing version 0.11.5 to 0.11.6

14

dist/commands/api/convert.js

@@ -26,4 +26,4 @@ "use strict";

var _a;
const param = traverse_1.getReferencedObject(paramOrRef, traverse_1.isParameterObject, node.context);
const schema = traverse_1.getReferencedObject(param.schema, traverse_1.isSchemaObject, node.context);
const param = traverse_1.getReferencedObject(paramOrRef, traverse_1.isParameterObject, 'parameter', node.context);
const schema = traverse_1.getReferencedObject(param.schema, traverse_1.isSchemaObject, 'schema', node.context);
const paramNode = param.schema ? convert_schema_1.convertSchema(node.context, param.schema) : ts_compose_1.document(node.context, ts_compose_1.Type.Any);

@@ -68,3 +68,3 @@ const params = (_a = node.in[toParamLocation(param.in)]) !== null && _a !== void 0 ? _a : [];

if (schemaOrRef) {
const schema = traverse_1.getReferencedObject(schemaOrRef, traverse_1.isSchemaObject, context);
const schema = traverse_1.getReferencedObject(schemaOrRef, traverse_1.isSchemaObject, 'schema', context);
const responseDocument = convert_schema_1.convertSchema(context, schemaOrRef);

@@ -86,7 +86,7 @@ if (schema.type === 'string') {

var _a;
const response = traverse_1.getReferencedObject(responseOrRef, traverse_1.isResponseObject, responseContext);
const response = traverse_1.getReferencedObject(responseOrRef, traverse_1.isResponseObject, 'response', responseContext);
const responseMediaTypes = Object.entries((_a = response.content) !== null && _a !== void 0 ? _a : { '*': {} });
const { items, context: mediaTypesContext } = ts_compose_1.mapWithContext(responseContext, responseMediaTypes, (mediaTypeContext, [type, mediaTypeOrRef]) => {
var _a;
const mediaType = traverse_1.getReferencedObject(mediaTypeOrRef, traverse_1.isMediaTypeObject, mediaTypeContext);
const mediaType = traverse_1.getReferencedObject(mediaTypeOrRef, traverse_1.isMediaTypeObject, 'media-type', mediaTypeContext);
const typeString = type.includes('*') ? ts_compose_1.Type.String : ts_compose_1.Type.Literal(type);

@@ -109,3 +109,3 @@ const typeStatus = status === 'default' ? ts_compose_1.Type.Number : ts_compose_1.Type.Literal(Number(status));

const convertRequestBody = (context, requestBodyOrRef) => {
const requestBody = traverse_1.getReferencedObject(requestBodyOrRef, traverse_1.isRequestBodyObject, context);
const requestBody = traverse_1.getReferencedObject(requestBodyOrRef, traverse_1.isRequestBodyObject, 'request-body', context);
const schema = requestBody.content['application/json'] ? requestBody.content['application/json'].schema : {};

@@ -121,3 +121,3 @@ const node = schema ? convert_schema_1.convertSchema(context, schema) : ts_compose_1.document(context, ts_compose_1.Type.Any);

const { parameters, description, summary, ...methodsApiOrRef } = pathApiOrRef;
const pathApi = traverse_1.getReferencedObject(methodsApiOrRef, traverse_1.isSchemaObject, context);
const pathApi = traverse_1.getReferencedObject(methodsApiOrRef, traverse_1.isSchemaObject, 'schema', context);
const methods = ts_compose_1.mapWithContext(pathContext, Object.entries(pathApi), (methodContext, [method, operation]) => {

@@ -124,0 +124,0 @@ var _a;

@@ -75,3 +75,3 @@ "use strict";

var _a, _b, _c, _d, _e;
const response = traverse_1.getReferencedObject(responseOrRef, traverse_1.isResponseObject, responseContext);
const response = traverse_1.getReferencedObject(responseOrRef, traverse_1.isResponseObject, 'response', responseContext);
const schema = (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.content) === null || _a === void 0 ? void 0 : _a['application/json']) === null || _b === void 0 ? void 0 : _b.schema) !== null && _c !== void 0 ? _c : (_e = (_d = response === null || response === void 0 ? void 0 : response.content) === null || _d === void 0 ? void 0 : _d['*/*']) === null || _e === void 0 ? void 0 : _e.schema;

@@ -86,3 +86,3 @@ return schema ? convert_schema_1.convertSchema(responseContext, schema) : ts_compose_1.document(responseContext, undefined);

const requestBody = requestBodyOrRef
? traverse_1.getReferencedObject(requestBodyOrRef, traverse_1.isRequestBodyObject, context)
? traverse_1.getReferencedObject(requestBodyOrRef, traverse_1.isRequestBodyObject, 'request-body', context)
: undefined;

@@ -99,6 +99,6 @@ const schema = (_a = requestBody === null || requestBody === void 0 ? void 0 : requestBody.content['application/json']) === null || _a === void 0 ? void 0 : _a.schema;

const { parameters, description, summary, ...methodsApiOrRef } = pathApiOrRef;
const pathApi = traverse_1.getReferencedObject(methodsApiOrRef, traverse_1.isSchemaObject, context);
const pathApi = traverse_1.getReferencedObject(methodsApiOrRef, traverse_1.isSchemaObject, 'schema', context);
const methods = ts_compose_1.mapWithContext(pathContext, Object.entries(pathApi), (methodContext, [method, operation]) => {
var _a;
const combinedParameters = [...(parameters !== null && parameters !== void 0 ? parameters : []), ...((_a = operation.parameters) !== null && _a !== void 0 ? _a : [])].map((item) => traverse_1.getReferencedObject(item, traverse_1.isParameterObject, methodContext));
const combinedParameters = [...(parameters !== null && parameters !== void 0 ? parameters : []), ...((_a = operation.parameters) !== null && _a !== void 0 ? _a : [])].map((item) => traverse_1.getReferencedObject(item, traverse_1.isParameterObject, 'parameter', methodContext));
const requestName = `${method.toUpperCase()} ${path}`;

@@ -105,0 +105,0 @@ const pathItems = convertPathParams(methodContext, path, combinedParameters);

@@ -94,3 +94,3 @@ "use strict";

const props = ts_compose_1.mapWithContext(additional.context, Object.entries(schema.properties), (propContext, [name, value]) => {
const propSchema = traverse_1.getReferencedObject(value, traverse_1.isSchemaObject, propContext);
const propSchema = traverse_1.getReferencedObject(value, traverse_1.isSchemaObject, 'schema', propContext);
const item = exports.convertSchema(propContext, value);

@@ -97,0 +97,0 @@ const isOptional = !(Array.isArray(schema.required) && schema.required.includes(name)) && propSchema.default === undefined;

@@ -19,2 +19,2 @@ import { Document, DocumentContext } from '@ovotech/ts-compose';

export declare const isSchemaObject: (item: unknown) => item is SchemaObject;
export declare const getReferencedObject: <T>(item: ReferenceObject | T, guard: (item: unknown) => item is T, context: AstContext) => T;
export declare const getReferencedObject: <T>(item: ReferenceObject | T, guard: (item: unknown) => item is T, type: string, context: AstContext) => T;

@@ -18,10 +18,10 @@ "use strict";

exports.isSchemaObject = isSchemaObject;
const getReferencedObject = (item, guard, context) => {
const getReferencedObject = (item, guard, type, context) => {
if (exports.isReferenceObject(item)) {
if (!context.refs[item.$ref]) {
throw new Error(`Reference Error [${item.$ref}] not found`);
throw new Error(`Reference Error [${JSON.stringify(item)}] not found`);
}
const resolved = context.refs[item.$ref];
if (!guard(resolved)) {
throw new Error(`Reference Error [${item.$ref}] was not the correct type`);
throw new Error(`Reference Error [${JSON.stringify(item)}] was not the expected type ${type}`);
}

@@ -28,0 +28,0 @@ return resolved;

{
"name": "@ovotech/laminar-cli",
"version": "0.11.5",
"version": "0.11.6",
"main": "dist/index.js",

@@ -65,3 +65,3 @@ "types": "dist/index.d.ts",

},
"gitHead": "04f81681401b3c7ff275d1ab233a844ad3a3c92b"
"gitHead": "00bdfa83a5be776e4f49178e9b2c33774349245a"
}
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