🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@prisma-next/sql-contract-psl

Package Overview
Dependencies
Maintainers
4
Versions
558
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/sql-contract-psl - npm Package Compare versions

Comparing version
0.15.0-dev.17
to
0.15.0-dev.21
dist/interpreter-BYP3e_Mq.mjs

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

+1
-1

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

{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"mappings":";;;;;;;;;;;;KAoDY,gBAAA;EAAA,SACD,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAA;EAJZ;;;;;;;;EAAA,SAaD,QAAA,GAAW,WAAW;AAAA;;;UCuDhB,sCAAA;EAAA,SACN,WAAA,EAAa,WAAA;EAAA,SACb,UAAA,EAAY,UAAA;EAAA,SACZ,QAAA;EAAA,SACA,MAAA,EAAQ,aAAA;EAAA,SACR,qBAAA,EAAuB,WAAA,SAAoB,gBAAA;EAAA,SAC3C,sBAAA;EAAA,SACA,yBAAA,YAAqC,gBAAA;EAAA,SACrC,uBAAA,GAA0B,yBAAA;EAAA,SAC1B,sBAAA,GAAyB,sBAAA;EDhEzB;;;AAAsB;;;;ACuDjC;;EDvDW,SC0EA,0BAAA,EAA4B,WAAA,SAAoB,QAAA;EAlBnC;EAAA,SAoBb,eAAA,GAAkB,KAAA,EAAO,iBAAA,KAAsB,gBAAA;EAAA,SAC/C,WAAA,GAAc,WAAA;EAAA,SACd,eAAA,YAA2B,wBAAA;EAlBJ;EAAA,SAoBvB,mBAAA;IAAA,SAAiC,IAAA;IAAA,SAAuB,GAAA;EAAA;EAAA,SACxD,YAAA,EAAc,gBAAA;AAAA;AAAA,iBAgvDT,iCAAA,CACd,KAAA,EAAO,sCAAA,GACN,MAAA,CAAO,QAAA,EAAU,yBAAA"}
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"mappings":";;;;;;;;;;;;KAoDY,gBAAA;EAAA,SACD,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAA;EAJZ;;;;;;;;EAAA,SAaD,QAAA,GAAW,WAAW;AAAA;;;UCuDhB,sCAAA;EAAA,SACN,WAAA,EAAa,WAAA;EAAA,SACb,UAAA,EAAY,UAAA;EAAA,SACZ,QAAA;EAAA,SACA,MAAA,EAAQ,aAAA;EAAA,SACR,qBAAA,EAAuB,WAAA,SAAoB,gBAAA;EAAA,SAC3C,sBAAA;EAAA,SACA,yBAAA,YAAqC,gBAAA;EAAA,SACrC,uBAAA,GAA0B,yBAAA;EAAA,SAC1B,sBAAA,GAAyB,sBAAA;EDhEzB;;;AAAsB;;;;ACuDjC;;EDvDW,SC0EA,0BAAA,EAA4B,WAAA,SAAoB,QAAA;EAlBnC;EAAA,SAoBb,eAAA,GAAkB,KAAA,EAAO,iBAAA,KAAsB,gBAAA;EAAA,SAC/C,WAAA,GAAc,WAAA;EAAA,SACd,eAAA,YAA2B,wBAAA;EAlBJ;EAAA,SAoBvB,mBAAA;IAAA,SAAiC,IAAA;IAAA,SAAuB,GAAA;EAAA;EAAA,SACxD,YAAA,EAAc,gBAAA;AAAA;AAAA,iBAgxDT,iCAAA,CACd,KAAA,EAAO,sCAAA,GACN,MAAA,CAAO,QAAA,EAAU,yBAAA"}

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

import { t as interpretPslDocumentToSqlContract } from "./interpreter-BqX3gYaS.mjs";
import { t as interpretPslDocumentToSqlContract } from "./interpreter-BYP3e_Mq.mjs";
export { interpretPslDocumentToSqlContract };

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

import { t as interpretPslDocumentToSqlContract } from "./interpreter-BqX3gYaS.mjs";
import { t as interpretPslDocumentToSqlContract } from "./interpreter-BYP3e_Mq.mjs";
import { buildSymbolTable, rangeToPslSpan } from "@prisma-next/psl-parser";

@@ -3,0 +3,0 @@ import { ifDefined } from "@prisma-next/utils/defined";

{
"name": "@prisma-next/sql-contract-psl",
"version": "0.15.0-dev.17",
"version": "0.15.0-dev.21",
"license": "Apache-2.0",

@@ -9,16 +9,16 @@ "type": "module",

"dependencies": {
"@prisma-next/config": "0.15.0-dev.17",
"@prisma-next/contract": "0.15.0-dev.17",
"@prisma-next/framework-components": "0.15.0-dev.17",
"@prisma-next/psl-parser": "0.15.0-dev.17",
"@prisma-next/sql-contract": "0.15.0-dev.17",
"@prisma-next/sql-contract-ts": "0.15.0-dev.17",
"@prisma-next/utils": "0.15.0-dev.17",
"@prisma-next/config": "0.15.0-dev.21",
"@prisma-next/contract": "0.15.0-dev.21",
"@prisma-next/framework-components": "0.15.0-dev.21",
"@prisma-next/psl-parser": "0.15.0-dev.21",
"@prisma-next/sql-contract": "0.15.0-dev.21",
"@prisma-next/sql-contract-ts": "0.15.0-dev.21",
"@prisma-next/utils": "0.15.0-dev.21",
"pathe": "^2.0.3"
},
"devDependencies": {
"@prisma-next/contract-authoring": "0.15.0-dev.17",
"@prisma-next/test-utils": "0.15.0-dev.17",
"@prisma-next/tsconfig": "0.15.0-dev.17",
"@prisma-next/tsdown": "0.15.0-dev.17",
"@prisma-next/contract-authoring": "0.15.0-dev.21",
"@prisma-next/test-utils": "0.15.0-dev.21",
"@prisma-next/tsconfig": "0.15.0-dev.21",
"@prisma-next/tsdown": "0.15.0-dev.21",
"arktype": "^2.2.2",

@@ -25,0 +25,0 @@ "tsdown": "0.22.3",

@@ -350,2 +350,9 @@ import type { ContractSourceDiagnostic } from '@prisma-next/config/config-types';

}
// A model-typed, non-list field with no `@relation` is the back side of a
// 1:1 relation — the owning side always carries `@relation(fields: [...],
// references: [...])`. It is lowered separately, via the interpreter's
// backrelation-candidate matching, not as a scalar column here.
if (isModelField) {
continue;
}

@@ -352,0 +359,0 @@ const isValueObjectField = compositeTypeNames.has(field.typeName);

@@ -65,2 +65,4 @@ import type { ContractSourceDiagnostic } from '@prisma-next/config/config-types';

readonly targetModelName: string;
/** Whether the PSL field itself is list-typed (`Target[]`) rather than singular (`Target?`). A singular candidate is the back side of a 1:1 relation and can never be many-to-many. */
readonly isList: boolean;
readonly relationName?: string;

@@ -457,31 +459,35 @@ };

if (matches.length === 0) {
const { pairs: junctionPairs, nearMisses } = findJunctionFkPairs({
candidate,
fkRelationsByDeclaringModel: input.fkRelationsByDeclaringModel,
modelIdColumns: input.modelIdColumns,
});
const junctionPair = junctionPairs[0];
if (junctionPairs.length === 1 && junctionPair) {
relationsForModel(input.modelRelations, candidate.modelName).push(
manyToManyRelationNode(candidate, junctionPair),
);
continue;
}
if (junctionPairs.length > 1) {
input.diagnostics.push({
code: 'PSL_AMBIGUOUS_BACKRELATION_LIST',
message: `Backrelation list field "${candidate.modelName}.${candidate.field.name}" matches multiple junction FK pairs for a many-to-many relation. Add @relation(name: "...") (or @relation("...")) to the list field and the junction FK-side relation pointing back at "${candidate.modelName}" to disambiguate.`,
sourceId: input.sourceId,
span: candidate.field.span,
// A singular candidate is the back side of a 1:1 — many-to-many junction
// matching only makes sense for a list-typed backrelation.
if (candidate.isList) {
const { pairs: junctionPairs, nearMisses } = findJunctionFkPairs({
candidate,
fkRelationsByDeclaringModel: input.fkRelationsByDeclaringModel,
modelIdColumns: input.modelIdColumns,
});
continue;
const junctionPair = junctionPairs[0];
if (junctionPairs.length === 1 && junctionPair) {
relationsForModel(input.modelRelations, candidate.modelName).push(
manyToManyRelationNode(candidate, junctionPair),
);
continue;
}
if (junctionPairs.length > 1) {
input.diagnostics.push({
code: 'PSL_AMBIGUOUS_BACKRELATION',
message: `Backrelation list field "${candidate.modelName}.${candidate.field.name}" matches multiple junction FK pairs for a many-to-many relation. Add @relation(name: "...") (or @relation("...")) to the list field and the junction FK-side relation pointing back at "${candidate.modelName}" to disambiguate.`,
sourceId: input.sourceId,
span: candidate.field.span,
});
continue;
}
const nearMiss = nearMisses[0];
if (nearMiss) {
input.diagnostics.push(junctionNearMissDiagnostic(candidate, nearMiss, input.sourceId));
continue;
}
}
const nearMiss = nearMisses[0];
if (nearMiss) {
input.diagnostics.push(junctionNearMissDiagnostic(candidate, nearMiss, input.sourceId));
continue;
}
input.diagnostics.push({
code: 'PSL_ORPHANED_BACKRELATION_LIST',
message: `Backrelation list field "${candidate.modelName}.${candidate.field.name}" has no matching FK-side relation on model "${candidate.targetModelName}". Add @relation(fields: [...], references: [...]) on the FK-side relation or use an explicit join model for many-to-many.`,
code: 'PSL_ORPHANED_BACKRELATION',
message: `Backrelation field "${candidate.modelName}.${candidate.field.name}" has no matching FK-side relation on model "${candidate.targetModelName}". Add @relation(fields: [...], references: [...]) on the FK-side relation${candidate.isList ? ' or use an explicit join model for many-to-many' : ''}.`,
sourceId: input.sourceId,

@@ -494,4 +500,4 @@ span: candidate.field.span,

input.diagnostics.push({
code: 'PSL_AMBIGUOUS_BACKRELATION_LIST',
message: `Backrelation list field "${candidate.modelName}.${candidate.field.name}" matches multiple FK-side relations on model "${candidate.targetModelName}". Add @relation(name: "...") (or @relation("...")) to both sides to disambiguate.`,
code: 'PSL_AMBIGUOUS_BACKRELATION',
message: `Backrelation field "${candidate.modelName}.${candidate.field.name}" matches multiple FK-side relations on model "${candidate.targetModelName}". Add @relation(name: "...") (or @relation("...")) to both sides to disambiguate.`,
sourceId: input.sourceId,

@@ -512,3 +518,3 @@ span: candidate.field.span,

...ifDefined('toNamespaceId', matched.declaringNamespaceId),
cardinality: '1:N',
cardinality: candidate.isList ? '1:N' : '1:1',
on: {

@@ -524,3 +530,3 @@ parentTable: candidate.tableName,

export function validateNavigationListFieldAttributes(input: {
export function validateBackrelationFieldAttributes(input: {
readonly modelName: string;

@@ -527,0 +533,0 @@ readonly field: FieldSymbol;

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display