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
4
Versions
235
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 1.0.3-lookup-referenced-data-type-f5def75cf04efec72ef1d8b6e3ee0c3c51b36019 to 1.0.3

2

package.json
{
"name": "@balena/abstract-sql-to-typescript",
"version": "1.0.3-lookup-referenced-data-type-f5def75cf04efec72ef1d8b6e3ee0c3c51b36019",
"version": "1.0.3",
"description": "A translator for abstract sql into typescript types.",

@@ -5,0 +5,0 @@ "main": "out/index.js",

@@ -34,3 +34,3 @@ import { AbstractSqlModel } from '@balena/abstract-sql-compiler';

tables: {
test: {
parent: {
fields: [

@@ -55,26 +55,43 @@ {

},
],
primitive: false,
name: 'parent',
indexes: [],
idField: 'id',
resourceName: 'parent',
triggers: [
{
dataType: 'ConceptType',
fieldName: 'parent',
when: 'BEFORE',
operation: 'UPDATE',
level: 'ROW',
fnName: 'trigger_update_modified_at',
},
],
},
other: {
fields: [
{
dataType: 'Date Time',
fieldName: 'created at',
required: true,
references: {
resourceName: 'parent',
fieldName: 'id',
},
defaultValue: 'CURRENT_TIMESTAMP',
},
{
dataType: 'ForeignKey',
fieldName: 'referenced',
dataType: 'Date Time',
fieldName: 'modified at',
required: true,
references: {
resourceName: 'referenced',
fieldName: 'id',
},
defaultValue: 'CURRENT_TIMESTAMP',
},
{
dataType: 'Serial',
fieldName: 'id',
required: true,
index: 'PRIMARY KEY',
},
],
primitive: false,
name: 'test',
name: 'other',
indexes: [],
idField: 'id',
resourceName: 'test',
resourceName: 'other',
triggers: [

@@ -89,5 +106,17 @@ {

},
referenced: {
test: {
fields: [
{
dataType: 'Date Time',
fieldName: 'created at',
required: true,
defaultValue: 'CURRENT_TIMESTAMP',
},
{
dataType: 'Date Time',
fieldName: 'modified at',
required: true,
defaultValue: 'CURRENT_TIMESTAMP',
},
{
dataType: 'Serial',

@@ -98,8 +127,26 @@ fieldName: 'id',

},
{
dataType: 'ConceptType',
fieldName: 'parent',
required: true,
references: {
resourceName: 'parent',
fieldName: 'id',
},
},
{
dataType: 'ForeignKey',
fieldName: 'references-other',
required: true,
references: {
resourceName: 'other',
fieldName: 'id',
},
},
],
primitive: false,
name: 'referenced',
name: 'test',
indexes: [],
idField: 'id',
resourceName: 'referenced',
resourceName: 'test',
triggers: [

@@ -121,13 +168,21 @@ {

source`
export interface Test {
export interface Parent {
created_at: DateString;
modified_at: DateString;
id: number;
parent: number;
referenced: { __id: number } | [Referenced];
}
export interface Referenced {
export interface Other {
created_at: DateString;
modified_at: DateString;
id: number;
}
export interface Test {
created_at: DateString;
modified_at: DateString;
id: number;
parent: number;
references__other: { __id: number } | [Other];
}
`,

@@ -140,15 +195,23 @@ );

source`
export interface Test {
export interface Parent {
created_at: Date;
modified_at: Date;
id: number;
parent: number;
referenced: number;
}
export interface Referenced {
export interface Other {
created_at: Date;
modified_at: Date;
id: number;
}
export interface Test {
created_at: Date;
modified_at: Date;
id: number;
parent: number;
references__other: number;
}
`,
'write',
);

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