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

@balena/abstract-sql-to-typescript

Package Overview
Dependencies
Maintainers
3
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@balena/abstract-sql-to-typescript - npm Package Compare versions

Comparing version 5.1.0-build-joshbwlng-replace-serials-57a92b59b8c98447a4fbb476bbaeb70d8475c77b-1 to 5.1.0-build-joshbwlng-replace-serials-9ffed15dc113018d9cf52543d7fe1ff41fa237ed-1

2

out/package.json

@@ -57,4 +57,4 @@ {

"versionist": {
"publishedAt": "2024-12-08T07:20:21.684Z"
"publishedAt": "2024-12-10T23:34:29.144Z"
}
}

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

default:
return `Types['${opts?.convertSerialToInteger ? replaceSerial(f.dataType) : f.dataType}']['${mode}']`;
return `Types['${opts.convertSerialToInteger ? replaceSerial(f.dataType) : f.dataType}']['${mode}']`;
}

@@ -59,3 +59,3 @@ };

};
const recurseRelationships = (m, relationships, inverseSynonyms, mode, currentTable, parentKey) => Object.keys(relationships).flatMap((key) => {
const recurseRelationships = (m, relationships, inverseSynonyms, mode, currentTable, parentKey, opts) => Object.keys(relationships).flatMap((key) => {
if (key === '$') {

@@ -85,3 +85,3 @@ const [localField, referencedField] = relationships.$;

if (f.fieldName !== propName) {
const propDefiniton = fieldToInterfaceProps(propName, m, f, mode);
const propDefiniton = fieldToInterfaceProps(propName, m, f, mode, opts);
if (propDefiniton != null) {

@@ -104,5 +104,5 @@ propDefinitons.push(propDefiniton);

}
return recurseRelationships(m, relationships[key], inverseSynonyms, mode, currentTable, `${parentKey}-${key}`);
return recurseRelationships(m, relationships[key], inverseSynonyms, mode, currentTable, `${parentKey}-${key}`, opts);
});
const relationshipsToInterfaceProps = (m, table, mode) => {
const relationshipsToInterfaceProps = (m, table, mode, opts) => {
const relationships = m.relationships[table.resourceName];

@@ -120,3 +120,3 @@ if (relationships == null) {

]));
return recurseRelationships(m, relationships[key], inverseSynonyms, mode, table, key);
return recurseRelationships(m, relationships[key], inverseSynonyms, mode, table, key, opts);
});

@@ -139,3 +139,3 @@ };

...fieldsToInterfaceProps(m, table.fields, 'Read', opts),
...relationshipsToInterfaceProps(m, table, 'Read'),
...relationshipsToInterfaceProps(m, table, 'Read', opts),
].join('\n\t\t')}

@@ -147,3 +147,3 @@ };

};
const abstractSqlToTypescriptTypes = (m, opts) => {
const abstractSqlToTypescriptTypes = (m, opts = {}) => {
return trimNL `

@@ -150,0 +150,0 @@ // These types were generated by @balena/abstract-sql-to-typescript v${package_json_1.version}

{
"name": "@balena/abstract-sql-to-typescript",
"version": "5.1.0-build-joshbwlng-replace-serials-57a92b59b8c98447a4fbb476bbaeb70d8475c77b-1",
"version": "5.1.0-build-joshbwlng-replace-serials-9ffed15dc113018d9cf52543d7fe1ff41fa237ed-1",
"description": "A translator for abstract sql into typescript types.",

@@ -57,4 +57,4 @@ "type": "commonjs",

"versionist": {
"publishedAt": "2024-12-08T07:20:21.684Z"
"publishedAt": "2024-12-10T23:34:29.144Z"
}
}

@@ -43,3 +43,3 @@ import type {

mode: Mode,
opts?: Options,
opts: Options,
): string => {

@@ -74,3 +74,3 @@ if (!['ForeignKey', 'ConceptType'].includes(f.dataType) && f.checks) {

default:
return `Types['${opts?.convertSerialToInteger ? replaceSerial(f.dataType) : f.dataType}']['${mode}']`;
return `Types['${opts.convertSerialToInteger ? replaceSerial(f.dataType) : f.dataType}']['${mode}']`;
}

@@ -84,3 +84,3 @@ };

mode: Mode,
opts?: Options,
opts: Options,
): string | undefined => {

@@ -104,3 +104,3 @@ if (mode === 'Write' && f.computed != null) {

mode: Mode,
opts?: Options,
opts: Options,
): string[] =>

@@ -131,2 +131,3 @@ fields

parentKey: string,
opts: Options,
): string[] =>

@@ -167,3 +168,9 @@ Object.keys(relationships).flatMap((key) => {

if (f.fieldName !== propName) {
const propDefiniton = fieldToInterfaceProps(propName, m, f, mode);
const propDefiniton = fieldToInterfaceProps(
propName,
m,
f,
mode,
opts,
);
if (propDefiniton != null) {

@@ -193,2 +200,3 @@ propDefinitons.push(propDefiniton);

`${parentKey}-${key}`,
opts,
);

@@ -201,2 +209,3 @@ });

mode: Mode,
opts: Options,
): string[] => {

@@ -225,2 +234,3 @@ const relationships = m.relationships[table.resourceName];

key,
opts,
);

@@ -233,3 +243,3 @@ });

table: AbstractSqlTable,
opts?: Options,
opts: Options,
) => {

@@ -252,3 +262,3 @@ const writableFields =

...fieldsToInterfaceProps(m, table.fields, 'Read', opts),
...relationshipsToInterfaceProps(m, table, 'Read'),
...relationshipsToInterfaceProps(m, table, 'Read', opts),
].join('\n\t\t')}

@@ -265,3 +275,3 @@ };

m: RequiredModelSubset,
opts?: Options,
opts: Options = {},
): string => {

@@ -268,0 +278,0 @@ return trimNL`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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