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

@ovotech/avro-ts

Package Overview
Dependencies
Maintainers
121
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.0.0 to 4.1.0

6

dist/convert.js

@@ -56,6 +56,6 @@ "use strict";

const [name, nameNamespace] = exports.nameParts(type);
const namespace = (nameNamespace !== null && nameNamespace !== void 0 ? nameNamespace : context.namespace);
const namespace = nameNamespace !== null && nameNamespace !== void 0 ? nameNamespace : context.namespace;
const ref = namespace
? ts_compose_1.Type.Ref([exports.convertNamespace(namespace), exports.firstUpperCase(name)])
: ts_compose_1.Type.Ref(exports.firstUpperCase(name));
? ts_compose_1.Type.Referance([exports.convertNamespace(namespace), exports.firstUpperCase(name)])
: ts_compose_1.Type.Referance(exports.firstUpperCase(name));
return ts_compose_1.document(context, ref);

@@ -62,0 +62,0 @@ }

import { Context } from './types';
import { schema } from 'avsc';
export declare const fullName: (context: Context, schema: schema.RecordType) => string;
import { schema as avroSchema } from 'avsc';
export declare const fullName: (context: Context, schema: avroSchema.RecordType) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fullName = (context, schema) => { var _a; return `${_a = schema.namespace, (_a !== null && _a !== void 0 ? _a : context.namespace)}.${schema.name}`; };
exports.fullName = (context, schema) => { var _a; return `${(_a = schema.namespace) !== null && _a !== void 0 ? _a : context.namespace}.${schema.name}`; };

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

const converted = convert_1.convertType(context, schema.items);
return ts_compose_1.document(converted.context, ts_compose_1.Type.Arr(converted.type));
return ts_compose_1.document(converted.context, ts_compose_1.Type.Array(converted.type));
};

@@ -5,2 +5,5 @@ "use strict";

exports.isFixedType = (type) => typeof type === 'object' && 'type' in type && type.type === 'fixed';
exports.convertFixedType = context => ({ context, type: ts_compose_1.Type.Str });
exports.convertFixedType = context => ({
context,
type: ts_compose_1.Type.String,
});

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

if (typeof logicalType === 'string') {
return ts_compose_1.document(context, ts_compose_1.Type.Ref(logicalType));
return ts_compose_1.document(context, ts_compose_1.Type.Referance(logicalType));
}

@@ -17,3 +17,3 @@ else {

? { ...logicalType, named: [{ name: logicalType.named }] }
: logicalType), ts_compose_1.Type.Ref('named' in logicalType
: logicalType), ts_compose_1.Type.Referance('named' in logicalType
? logicalType.named

@@ -20,0 +20,0 @@ : 'defaultAs' in logicalType

@@ -11,5 +11,5 @@ "use strict";

type: ts_compose_1.Type.TypeLiteral({
index: ts_compose_1.Type.Index({ name: 'index', nameType: ts_compose_1.Type.Str, type: map.type }),
index: ts_compose_1.Type.Index({ name: 'index', nameType: ts_compose_1.Type.String, type: map.type }),
}),
};
};

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

const primitiveTypeMap = {
long: ts_compose_1.Type.Num,
int: ts_compose_1.Type.Num,
double: ts_compose_1.Type.Num,
float: ts_compose_1.Type.Num,
bytes: ts_compose_1.Type.Ref('Buffer'),
long: ts_compose_1.Type.Number,
int: ts_compose_1.Type.Number,
double: ts_compose_1.Type.Number,
float: ts_compose_1.Type.Number,
bytes: ts_compose_1.Type.Referance('Buffer'),
null: ts_compose_1.Type.Null,
boolean: ts_compose_1.Type.Bool,
string: ts_compose_1.Type.Str,
boolean: ts_compose_1.Type.Boolean,
string: ts_compose_1.Type.String,
};

@@ -23,2 +23,2 @@ exports.isPrimitiveType = (type) => type === 'null' ||

type === 'string';
exports.convertPrimitiveType = (context, schema) => { var _a; return ts_compose_1.document(context, (_a = primitiveTypeMap[schema], (_a !== null && _a !== void 0 ? _a : ts_compose_1.Type.Any))); };
exports.convertPrimitiveType = (context, schema) => { var _a; return ts_compose_1.document(context, (_a = primitiveTypeMap[schema]) !== null && _a !== void 0 ? _a : ts_compose_1.Type.Any); };

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

var _a;
const namespace = (_a = schema.namespace, (_a !== null && _a !== void 0 ? _a : context.namespace));
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 }) => {

@@ -30,3 +30,3 @@ const converted = convert_1.convertType({ ...fieldContext, namespace }, type);

: fields.context;
return ts_compose_1.document(ts_compose_1.withIdentifier(contextWithRef, record, namespaceName), ts_compose_1.Type.Ref(fullName));
return ts_compose_1.document(ts_compose_1.withIdentifier(contextWithRef, record, namespaceName), ts_compose_1.Type.Referance(fullName));
};
{
"name": "@ovotech/avro-ts",
"description": "Convert avro schemas into typescript interfaces",
"version": "4.0.0",
"version": "4.1.0",
"main": "dist/index.js",

@@ -22,11 +22,11 @@ "source": "src/index.ts",

"@ovotech/avro-logical-types": "^1.0.0",
"@types/jest": "^24.0.24",
"@types/node": "^13.1.0",
"@types/jest": "^25.1.3",
"@types/node": "^13.7.6",
"avsc": "^5.4.18",
"eslint-config-prettier": "^6.7.0",
"jest": "^24.9.0",
"eslint-config-prettier": "^6.10.0",
"jest": "^25.1.0",
"moment": "^2.24.0",
"prettier": "^1.19.1",
"ts-jest": "^24.3.0",
"ts-node": "^8.5.4"
"ts-jest": "^25.2.1",
"ts-node": "^8.6.2"
},

@@ -37,6 +37,6 @@ "jest": {

"dependencies": {
"@ovotech/ts-compose": "^0.10.0",
"typescript": "^3.7.4"
"@ovotech/ts-compose": "^0.11.0",
"typescript": "^3.8.2"
},
"gitHead": "821a55c53b17a4055675132e7a272710a3dc6a5a"
"gitHead": "9901acb5a8f8e6b65d6d79a0f5ba23e693a123aa"
}
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