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

@ovotech/avro-ts

Package Overview
Dependencies
Maintainers
158
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ovotech/avro-ts - npm Package Compare versions

Comparing version 4.2.4 to 5.0.0

1

dist/types/record.d.ts
import { schema, Schema } from 'avsc';
import { Convert } from '../types';
export declare const isRecordType: (type: Schema) => type is schema.RecordType;
export declare const withDefault: (def: any, doc: string | undefined) => string | undefined;
export declare const convertRecordType: Convert<schema.RecordType>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertRecordType = exports.isRecordType = void 0;
exports.convertRecordType = exports.withDefault = exports.isRecordType = void 0;
const ts_compose_1 = require("@ovotech/ts-compose");
const convert_1 = require("../convert");
exports.isRecordType = (type) => typeof type === 'object' && 'type' in type && type.type === 'record';
exports.withDefault = (def, doc) => {
if (def === undefined) {
return doc;
}
const defDoc = `Default: ${JSON.stringify(def)}`;
return doc === undefined ? defDoc : `${doc}\n\n${defDoc}`;
};
exports.convertRecordType = (context, schema) => {
var _a;
const namespace = (_a = schema.namespace) !== null && _a !== void 0 ? _a : context.namespace;
const fields = ts_compose_1.mapWithContext(context, schema.fields, (fieldContext, { name, type, doc }) => {
const fields = ts_compose_1.mapWithContext(context, schema.fields, (fieldContext, { name, type, doc, default: def }) => {
const converted = convert_1.convertType({ ...fieldContext, namespace }, type);
return ts_compose_1.document(converted.context, ts_compose_1.Type.Prop({ name, type: converted.type, jsDoc: doc }));
return ts_compose_1.document(converted.context, ts_compose_1.Type.Prop({
name,
type: converted.type,
jsDoc: exports.withDefault(def, doc),
isOptional: def !== undefined,
}));
});

@@ -14,0 +26,0 @@ const name = convert_1.firstUpperCase(schema.name);

4

package.json
{
"name": "@ovotech/avro-ts",
"description": "Convert avro schemas into typescript interfaces",
"version": "4.2.4",
"version": "5.0.0",
"main": "dist/index.js",

@@ -38,3 +38,3 @@ "source": "src/index.ts",

},
"gitHead": "e85f4cdfc56c0c8514326bebb40aaf0dfd30339d"
"gitHead": "fe95a576eb2366110b3bf478cbe587aff3fc63fa"
}
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