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

schema-typegen

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

schema-typegen - npm Package Compare versions

Comparing version 2.5.4 to 2.6.0

2

help.txt

@@ -30,2 +30,4 @@ Usage: schema-typegen [opts] connection_string

Use bigint for int8 types instead of strings. Default: false.
--date-as-string
Use string for date types instead of javascript Date object. Default: false.
-v/--version

@@ -32,0 +34,0 @@ Print the version number.

14

lib/postgres.js

@@ -11,3 +11,3 @@ 'use strict'

object: ['json', 'jsonb'],
Date: ['date', 'timestamp', 'timestamptz'],
Date: ['timestamp', 'timestamptz'],
'Array<string>': ['_bpchar', '_char', '_varchar', '_text', '_uuid', '_bytea', '_inet', '_int8', '_time', '_timetz', '_interval', '_name'],

@@ -17,3 +17,3 @@ 'Array<number>': ['_int2', '_int4', '_float4', '_float8', '_numeric', '_money', '_oid'],

'Array<object>': ['_json', '_jsonb'],
'Array<Date>': ['_date', '_timestamp', '_timestamptz']
'Array<Date>': ['_timestamp', '_timestamptz']
}

@@ -53,3 +53,3 @@

async function getSchemaDefinition (opts) {
const { schema, connection, bigint } = opts
const { schema, connection, bigint, dateAsString } = opts

@@ -62,2 +62,10 @@ if (bigint) {

if (dateAsString) {
typeMapping.string.push('date')
typeMapping['Array<string>'].push('_date')
} else {
typeMapping.Date.push('date')
typeMapping['Array<Date>'].push('_date')
}
const sql = postgres(connection, getPostgresOpts(opts))

@@ -64,0 +72,0 @@ try {

{
"name": "schema-typegen",
"version": "2.5.4",
"version": "2.6.0",
"description": "Generate TypeScript type definitions from database schema",

@@ -5,0 +5,0 @@ "main": "schema-typegen.js",

@@ -11,2 +11,3 @@ declare module 'schema-typegen' {

bigint?: boolean;
dateAsString?: boolean;
schema?: string;

@@ -13,0 +14,0 @@ output?: string;

@@ -21,2 +21,3 @@ #! /usr/bin/env node

bigint: false,
dateAsString: false,
schema: 'public',

@@ -30,3 +31,3 @@ output: undefined,

const argv = minimist(argvs, {
boolean: ['type', 'noSemi', 'bigint', 'semicolons', 'version', 'optionals', 'ssl', 'pascal-enums'],
boolean: ['type', 'noSemi', 'bigint', 'date-as-string', 'semicolons', 'version', 'optionals', 'ssl', 'pascal-enums'],
alias: {

@@ -33,0 +34,0 @@ suffix: 'f',

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