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

@paljs/generator

Package Overview
Dependencies
Maintainers
0
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paljs/generator - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

1

dist/sdl/GenerateTypes.d.ts

@@ -144,2 +144,3 @@ import { GeneratorOptions, DMMF } from '@paljs/types';

isModel(modelName: string): boolean;
getParentType(name: string): string;
capital(name: string): string;

@@ -146,0 +147,0 @@ getOutputType(options: DMMF.SchemaField['outputType'] | DMMF.InputTypeRef, input?: boolean): string;

28

dist/sdl/GenerateTypes.js

@@ -41,2 +41,18 @@ "use strict";

}
getParentType(name) {
if (['Query', 'Mutation'].includes(name)) {
return '{}';
}
if (name === 'AffectedRowsOutput') {
return 'Client.Prisma.BatchPayload';
}
if (this.isModel(name)) {
return `Client.${name}`;
}
if (name.startsWith('CreateMany') && name.endsWith('AndReturnOutputType')) {
const innerType = name.replace(/^CreateMany|AndReturnOutputType$/g, '');
return `ReturnType<Client.Prisma.${innerType}Delegate["createManyAndReturn"]>`;
}
return `Client.Prisma.${name}`;
}
capital(name) {

@@ -53,2 +69,6 @@ return name.charAt(0).toUpperCase() + name.slice(1);

}
if (options.type.startsWith('CreateMany') && options.type.endsWith('AndReturnOutputType')) {
const innerType = options.type.replace(/^CreateMany|AndReturnOutputType$/g, '');
return `ReturnType<Client.Prisma.${innerType}Delegate["createManyAndReturn"]>`;
}
const type = options.type.toString() === 'AffectedRowsOutput'

@@ -97,9 +117,3 @@ ? 'Prisma.BatchPayload'

type.fields.forEach((field) => {
const parentType = ['Query', 'Mutation'].includes(type.name)
? '{}'
: `Client.${type.name === 'AffectedRowsOutput'
? 'Prisma.BatchPayload'
: !this.isModel(type.name)
? 'Prisma.' + type.name
: type.name}`;
const parentType = this.getParentType(type.name);
const argsType = field.args.length > 0

@@ -106,0 +120,0 @@ ? `${['Query', 'Mutation'].includes(type.name) ? '' : type.name}${this.capital(field.name)}Args`

{
"name": "@paljs/generator",
"version": "7.0.1",
"version": "7.0.2",
"main": "dist/index.js",

@@ -19,5 +19,5 @@ "types": "dist/index.d.ts",

"prettier": "^2.8.8",
"@paljs/types": "7.0.1",
"@paljs/schema": "7.0.1",
"@paljs/utils": "7.0.1"
"@paljs/types": "7.0.2",
"@paljs/utils": "7.0.2",
"@paljs/schema": "7.0.2"
},

@@ -24,0 +24,0 @@ "devDependencies": {

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