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

prisma-schema-dsl

Package Overview
Dependencies
Maintainers
8
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-schema-dsl - npm Package Compare versions

Comparing version 1.2.4 to 1.2.5

2

dist/builders.d.ts

@@ -6,5 +6,5 @@ import { DataSource, Model, Schema, ScalarField, ObjectField, ScalarType, DataSourceProvider, DataSourceURLEnv, Generator, ScalarFieldDefault, Enum } from "prisma-schema-dsl-types";

export declare function createModel(name: string, fields: Array<ScalarField | ObjectField>, documentation?: string): Model;
export declare function createScalarField(name: string, type: ScalarType, isList?: boolean, isRequired?: boolean, isUnique?: boolean, isId?: boolean, isUpdatedAt?: boolean, defaultValue?: ScalarFieldDefault, documentation?: string): ScalarField;
export declare function createScalarField(name: string, type: ScalarType, isList?: boolean, isRequired?: boolean, isUnique?: boolean, isId?: boolean, isUpdatedAt?: boolean, defaultValue?: ScalarFieldDefault, documentation?: string, isForeignKey?: boolean): ScalarField;
export declare function createObjectField(name: string, type: string, isList?: boolean, isRequired?: boolean, relationName?: string | null, relationFields?: string[], relationReferences?: string[], relationOnDelete?: "NONE", documentation?: string): ObjectField;
export declare function createDataSource(name: string, provider: DataSourceProvider, url: string | DataSourceURLEnv): DataSource;
export declare function createGenerator(name: string, provider: string, output?: string | null, binaryTargets?: string[]): Generator;

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

exports.createModel = createModel;
function createScalarField(name, type, isList, isRequired, isUnique, isId, isUpdatedAt, defaultValue, documentation) {
function createScalarField(name, type, isList, isRequired, isUnique, isId, isUpdatedAt, defaultValue, documentation, isForeignKey) {
if (isList === void 0) { isList = false; }

@@ -43,2 +43,3 @@ if (isRequired === void 0) { isRequired = false; }

if (defaultValue === void 0) { defaultValue = null; }
if (isForeignKey === void 0) { isForeignKey = false; }
validateName(name);

@@ -57,3 +58,4 @@ validateScalarDefault(type, defaultValue);

"default": defaultValue,
documentation: documentation
documentation: documentation,
isForeignKey: isForeignKey
};

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

@@ -120,9 +120,11 @@ "use strict";

var isMongoDBProvider = provider === prisma_schema_dsl_types_1.DataSourceProvider.MongoDB;
if (field.isId && isMongoDBProvider) {
attributes.push("@id @map(\"_id\") @mongo.ObjectId");
if (field.isId) {
if (isMongoDBProvider) {
attributes.push("@id @map(\"_id\") @mongo.ObjectId");
}
else {
attributes.push("@id");
}
}
else if (field.isId) {
attributes.push("@id");
}
if (isMongoDBProvider && field.name.includes("Id") && !field.isId) {
if (isMongoDBProvider && field.isForeignKey) {
attributes.push("@mongo.ObjectId");

@@ -129,0 +131,0 @@ }

{
"name": "prisma-schema-dsl",
"version": "1.2.4",
"version": "1.2.5",
"description": "JavaScript interface for Prisma Schema DSL",

@@ -30,3 +30,3 @@ "main": "dist/index.js",

"lodash.isempty": "^4.4.0",
"prisma-schema-dsl-types": "^1.0.2",
"prisma-schema-dsl-types": "^1.0.3",
"typescript": "^4.1.3"

@@ -33,0 +33,0 @@ },

@@ -81,3 +81,4 @@ import {

defaultValue: ScalarFieldDefault = null,
documentation?: string
documentation?: string,
isForeignKey:boolean = false
): ScalarField {

@@ -98,2 +99,3 @@ validateName(name);

documentation,
isForeignKey
};

@@ -100,0 +102,0 @@ }

@@ -164,10 +164,14 @@ import isEmpty from "lodash.isempty";

if (field.isId && isMongoDBProvider) {
attributes.push(`@id @map("_id") @mongo.ObjectId`);
} else if (field.isId) {
attributes.push("@id");
if (field.isId) {
if (isMongoDBProvider) {
attributes.push(`@id @map("_id") @mongo.ObjectId`);
} else {
attributes.push("@id");
}
}
if (isMongoDBProvider && field.name.includes("Id") && !field.isId) {
if (isMongoDBProvider && field.isForeignKey ) {
attributes.push("@mongo.ObjectId");
}
if (field.isUnique) {

@@ -174,0 +178,0 @@ attributes.push("@unique");

Sorry, the diff of this file is not supported yet

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