New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cwqt/refract

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cwqt/refract - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

3

dist/codegen/align.d.ts

@@ -1,1 +0,2 @@

export declare const align: (value: string, delimiter?: string) => string;
export declare const alignKv: (value: string) => string;
export declare const alignFields: (value: string) => string;
Object.defineProperty(exports, "__esModule", { value: true });
exports.align = void 0;
const align = (value, delimiter = ' ') => {
exports.alignFields = exports.alignKv = void 0;
const alignKv = (value) => {
const lines = value.split('\n');
const delimiter = '=';
const max = Math.max(...lines.map(l => l.trim().split(delimiter).shift().length)) + 1;

@@ -11,2 +12,20 @@ return lines

};
exports.align = align;
exports.alignKv = alignKv;
const alignFields = (value) => {
const lines = value.split('\n');
const [maximumColumnName, maximumColumnType] = lines
.map(l => l.split(' '))
.reduce(([maxName, maxType], [name, type]) => [
Math.max(maxName, name.length),
Math.max(maxType, (type ?? '').length),
], [0, 0]);
return lines
.map(line => line.split(' '))
.map(([columnName, columnType, ...rest]) => [
columnName.padEnd(maximumColumnName + 1),
columnType ? columnType.padEnd(maximumColumnType + 1) : '',
...rest.map(v => v.trim()),
].join(' '))
.join('\n');
};
exports.alignFields = alignFields;

@@ -44,6 +44,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

(0, block_1.header)('datasource'),
(0, block_1.block)('datasource db', (0, align_1.align)((0, transform_1.kv)(datasource), '=')),
group((0, block_1.header)('generators'), generators.map(generator => (0, block_1.block)(`generator ${generator.name}`, (0, align_1.align)((0, transform_1.kv)((0, utils_1.del)(generator, 'name')), '=')))),
(0, block_1.block)('datasource db', (0, align_1.alignKv)((0, transform_1.kv)(datasource))),
group((0, block_1.header)('generators'), generators.map(generator => (0, block_1.block)(`generator ${generator.name}`, (0, align_1.alignKv)((0, transform_1.kv)((0, utils_1.del)(generator, 'name')))))),
group((0, block_1.header)('enums'), enums.map(e => (0, block_1.block)(`enum ${e.name}`, e.columns.map(e => (0, column_1.column)(e)).join('\n')))),
group((0, block_1.header)('models'), models.map(model => (0, block_1.block)(`model ${model.name}`, (0, align_1.align)(model.columns.map(column_1.column).join('\n'))))),
group((0, block_1.header)('models'), models.map(model => (0, block_1.block)(`model ${model.name}`, (0, align_1.alignFields)(model.columns.map(column_1.column).join('\n'))))),
]

@@ -50,0 +50,0 @@ .filter(utils_1.nonNullable)

@@ -8,3 +8,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

return `@default(${type == 'Enum' ? modifier.value : (0, transform_1.transform)(modifier.value)})`;
case 'index':
case 'id':
return `@id`;

@@ -11,0 +11,0 @@ case 'unique':

@@ -12,3 +12,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

case 'string': {
if (value.endsWith('()'))
if (/^.*\(.*\)$/.test(value))
return value;

@@ -15,0 +15,0 @@ return `"${value}"`;

@@ -6,3 +6,3 @@ import * as Types from '../types';

};
export declare const String: <M extends "raw" | "map" | "default" | "nullable" | "ignore" | "unique" | "limit">(...modifiers: Types.Modifier<"String", M>[]) => {
export declare const String: <M extends "raw" | "map" | "default" | "id" | "nullable" | "ignore" | "unique" | "limit">(...modifiers: Types.Modifier<"String", M>[]) => {
type: "String";

@@ -9,0 +9,0 @@ modifiers: Types.Modifier<"String", M>[];

@@ -30,2 +30,3 @@ import { JsonValue } from '../codegen/lib/json';

unique?: true;
id?: true;
default?: string | 'auto()';

@@ -32,0 +33,0 @@ limit?: number;

{
"name": "@cwqt/refract",
"version": "1.0.11",
"version": "1.0.12",
"description": "Generate Prisma from TypeScript",

@@ -37,2 +37,3 @@ "author": "cwqt",

"jest": "^27.5.1",
"prettier": "^2.6.2",
"ts-jest": "^27.1.4",

@@ -39,0 +40,0 @@ "ts-node": "^10.7.0",

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