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

@prisma-next/psl-parser

Package Overview
Dependencies
Maintainers
4
Versions
655
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@prisma-next/psl-parser - npm Package Compare versions

Comparing version
0.16.0-dev.31
to
0.16.0-dev.32
+9
-4
dist/index.d.mts

@@ -43,3 +43,8 @@ import { C as AttributeArgAst, P as AstNode, T as ExpressionAst, b as FieldAttributeAst, et as SourceFile, x as ModelAttributeAst } from "./parse-Bl1gwWGn.mjs";

readonly named: Readonly<Record<string, Param<unknown>>>;
readonly refine?: (parsed: Out, ctx: InterpretCtx) => readonly PslDiagnostic$1[];
/**
* Cross-argument validation after all arguments parse. `attributeNode` is
* the attribute's own AST node so refines can span-anchor their
* diagnostics at the attribute rather than the enclosing model.
*/
readonly refine?: (parsed: Out, ctx: InterpretCtx, attributeNode: AstNode) => readonly PslDiagnostic$1[];
}

@@ -57,3 +62,3 @@ type OutOf<P> = P extends ArgType<infer T> ? T : never;

//#region src/attribute-spec/combinators/diagnostic.d.ts
declare function leafDiagnostic(ctx: InterpretCtx, node: AstNode, message: string): PslDiagnostic$1;
declare function leafDiagnostic(ctx: InterpretCtx, node: AstNode, message: string, code?: PslDiagnostic$1['code']): PslDiagnostic$1;
//#endregion

@@ -115,3 +120,3 @@ //#region src/attribute-spec/combinators/entity-ref.d.ts

readonly named?: Named;
readonly refine?: (parsed: AttributeOut<Pos, Named>, ctx: InterpretCtx) => readonly PslDiagnostic$1[];
readonly refine?: (parsed: AttributeOut<Pos, Named>, ctx: InterpretCtx, attributeNode: AstNode) => readonly PslDiagnostic$1[];
}

@@ -133,3 +138,3 @@ declare function fieldAttribute<const Pos extends readonly PositionalParam[] = readonly [], const Named extends Record<string, Param<unknown>> = Record<never, never>>(name: string, config: FieldAttributeConfig<Pos, Named>): AttributeSpec<AttributeOut<Pos, Named>>;

readonly named?: Named;
readonly refine?: (parsed: AttributeOut<Pos, Named>, ctx: InterpretCtx) => readonly PslDiagnostic$1[];
readonly refine?: (parsed: AttributeOut<Pos, Named>, ctx: InterpretCtx, attributeNode: AstNode) => readonly PslDiagnostic$1[];
}

@@ -136,0 +141,0 @@ declare function modelAttribute<const Pos extends readonly PositionalParam[] = readonly [], const Named extends Record<string, Param<unknown>> = Record<never, never>>(name: string, config: ModelAttributeConfig<Pos, Named>): AttributeSpec<AttributeOut<Pos, Named>>;

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

{"version":3,"file":"index.d.mts","names":[],"sources":["../src/attribute-helpers.ts","../src/attribute-spec/types.ts","../src/attribute-spec/combinators/bool.ts","../src/attribute-spec/combinators/diagnostic.ts","../src/attribute-spec/combinators/entity-ref.ts","../src/attribute-spec/combinators/field-ref.ts","../src/attribute-spec/combinators/func-call.ts","../src/attribute-spec/combinators/identifier.ts","../src/attribute-spec/combinators/int.ts","../src/attribute-spec/combinators/list.ts","../src/attribute-spec/combinators/num.ts","../src/attribute-spec/combinators/one-of.ts","../src/attribute-spec/combinators/record.ts","../src/attribute-spec/combinators/str.ts","../src/attribute-spec/field-attribute.ts","../src/attribute-spec/interpret.ts","../src/attribute-spec/model-attribute.ts","../src/attribute-spec/optional.ts","../src/extension-block.ts"],"mappings":";;;;;;;;iBAEgB,sBAAsB,WAAW,gBAAc;iBAK/C,yBAAyB;;;KCA7B;UAEK,QAAQ;WACd;WACA;WAEA,OAAO;EAChB,MAAM,KAAK,eAAe,KAAK,eAAe,OAAO,YAAY;;UAGlD;WACN,OAAO;WACP;WACA,YAAY;WACZ,WAAW;EACpB,0BAA0B;WACjB,QAAQ;;UAGF,gBAAgB,WAAW,QAAQ;WAEzC;WACA;WACA,eAAe;;KAGd,MAAM,KAAK,QAAQ;UAEd,gBAAgB;WACtB;WACA,MAAM,MAAM;;UAGN,cAAc;WACpB,OAAO;WACP;WACA,qBAAqB;WACrB,OAAO,SAAS,eAAe;WAC/B,UAAU,QAAQ,KAAK,KAAK,0BAA0B;;KAGrD,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cAAc,QAAQ,qBAAqB,KAAK,SAAS,cAAc,aAAa,KAAK;;;UCC1E;WACN;WACA,qBAAqB;WACrB,OAAO,SAAS,eAAe;;iBAG1B,cACd,MAAM,SAAS,kBACf,MAAM,gBACN,KAAK,cACL,MAAM,YACL,OAAO,kCAAkC;iBA+F5B,mBAAmB,KACjC,UAAU,oBAAoB,mBAC9B,MAAM,cAAc,MACpB,KAAK,eACJ,OAAO,cAAc;;;UC9Hd,qBACR,qBAAqB,mBACrB,cAAc,eAAe;WAEpB,aAAa;WACb,QAAQ;WACR,UACP,QAAQ,aAAa,KAAK,QAC1B,KAAK,0BACO;;iBAGA,qBACR,qBAAqB,uCACrB,cAAc,eAAe,kBAAkB,sBACrD,cAAc,QAAQ,qBAAqB,KAAK,SAAS,cAAc,aAAa,KAAK;;;iBChB3E,SAAS,GAAG,MAAM,QAAQ,OAAO,OAAO,cAAc,UAAU,gBAAgB;;;iBCgBhF,oBACd,aAAa,kDACb,kBACC;iBAca,iCAAiC;WACtC,OAAO;WACP,YAAY;WACZ,aAAa;WACb,YAAY;WACZ;WACA,aAAa;aACX"}
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/attribute-helpers.ts","../src/attribute-spec/types.ts","../src/attribute-spec/combinators/bool.ts","../src/attribute-spec/combinators/diagnostic.ts","../src/attribute-spec/combinators/entity-ref.ts","../src/attribute-spec/combinators/field-ref.ts","../src/attribute-spec/combinators/func-call.ts","../src/attribute-spec/combinators/identifier.ts","../src/attribute-spec/combinators/int.ts","../src/attribute-spec/combinators/list.ts","../src/attribute-spec/combinators/num.ts","../src/attribute-spec/combinators/one-of.ts","../src/attribute-spec/combinators/record.ts","../src/attribute-spec/combinators/str.ts","../src/attribute-spec/field-attribute.ts","../src/attribute-spec/interpret.ts","../src/attribute-spec/model-attribute.ts","../src/attribute-spec/optional.ts","../src/extension-block.ts"],"mappings":";;;;;;;;iBAEgB,sBAAsB,WAAW,gBAAc;iBAK/C,yBAAyB;;;KCC7B;UAEK,QA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KAAK,GAAG,IAAI,QAAQ,IAAI,OAAO,cAAc,QAAQ;;;iBCDrD,OAAO;iBACP,IAAI,gBAAgB;;;iBCLpB,MAAM,uBAAuB,qBAAqB,wBAC7D,MAAM,OACR,QAAQ,MAAM;;;iBCFD,OAAO,GAAG,IAAI,QAAQ,KAAK,QAAQ,eAAe;;;iBCAlD,OAAO;;;UCFb,qBACR,qBAAqB,mBACrB,cAAc,eAAe;WAEpB,aAAa;WACb,QAAQ;WACR,UACP,QAAQ,aAAa,KAAK,QAC1B,KAAK,cACL,eAAe,qBACH;;iBAGA,qBACR,qBAAqB,uCACrB,cAAc,eAAe,kBAAkB,sBACrD,cAAc,QAAQ,qBAAqB,KAAK,SAAS,cAAc,aAAa,KAAK;;;UCD1E;WACN;WACA,qBAAqB;WACrB,OAAO,SAAS,eAAe;;iBAG1B,cACd,MAAM,SAAS,kBACf,MAAM,gBACN,KAAK,cACL,MAAM,YACL,OAAO,kCAAkC;iBA+F5B,mBAAmB,KACjC,UAAU,oBAAoB,mBAC9B,MAAM,cAAc,MACpB,KAAK,eACJ,OAAO,cAAc;;;UC7Hd,qBACR,qBAAqB,mBACrB,cAAc,eAAe;WAEpB,aAAa;WACb,QAAQ;WACR,UACP,QAAQ,aAAa,KAAK,QAC1B,KAAK,cACL,eAAe,qBACH;;iBAGA,qBACR,qBAAqB,uCACrB,cAAc,eAAe,kBAAkB,sBACrD,cAAc,QAAQ,qBAAqB,KAAK,SAAS,cAAc,aAAa,KAAK;;;iBClB3E,SAAS,GAAG,MAAM,QAAQ,OAAO,OAAO,cAAc,UAAU,gBAAgB;;;iBCgBhF,oBACd,aAAa,kDACb,kBACC;iBAca,iCAAiC;WACtC,OAAO;WACP,YAAY;WACZ,aAAa;WACb,YAAY;WACZ;WACA,aAAa;aACX"}

@@ -93,5 +93,5 @@ import { _ as FunctionCallAst, b as ObjectLiteralExprAst, c as NamespaceDeclarationAst, g as BooleanLiteralExprAst, i as GenericBlockDeclarationAst, k as printSyntax, l as TypesBlockAst, m as ArrayLiteralAst, o as ModelDeclarationAst, t as CompositeTypeDeclarationAst, v as NumberLiteralExprAst, w as IdentifierAst, x as StringLiteralExprAst } from "./declarations-DR6To8_k.mjs";

const ATTRIBUTE_DIAGNOSTIC_CODE = "PSL_INVALID_ATTRIBUTE_SYNTAX";
function leafDiagnostic(ctx, node, message) {
function leafDiagnostic(ctx, node, message, code = ATTRIBUTE_DIAGNOSTIC_CODE) {
return {
code: ATTRIBUTE_DIAGNOSTIC_CODE,
code,
message,

@@ -215,3 +215,3 @@ sourceId: ctx.sourceId,

if (spec.refine !== void 0) {
const refineDiagnostics = spec.refine(value, ctx);
const refineDiagnostics = spec.refine(value, ctx, attrNode);
if (refineDiagnostics.length > 0) return notOk(refineDiagnostics);

@@ -218,0 +218,0 @@ }

{
"name": "@prisma-next/psl-parser",
"version": "0.16.0-dev.31",
"version": "0.16.0-dev.32",
"license": "Apache-2.0",

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

"dependencies": {
"@prisma-next/config": "0.16.0-dev.31",
"@prisma-next/contract": "0.16.0-dev.31",
"@prisma-next/framework-components": "0.16.0-dev.31",
"@prisma-next/utils": "0.16.0-dev.31"
"@prisma-next/config": "0.16.0-dev.32",
"@prisma-next/contract": "0.16.0-dev.32",
"@prisma-next/framework-components": "0.16.0-dev.32",
"@prisma-next/utils": "0.16.0-dev.32"
},
"devDependencies": {
"@prisma-next/tsconfig": "0.16.0-dev.31",
"@prisma-next/tsdown": "0.16.0-dev.31",
"@prisma-next/tsconfig": "0.16.0-dev.32",
"@prisma-next/tsdown": "0.16.0-dev.32",
"tsdown": "0.22.8",

@@ -19,0 +19,0 @@ "typescript": "5.9.3",

@@ -8,5 +8,10 @@ import type { PslDiagnostic, PslDiagnosticCode } from '@prisma-next/framework-components/psl-ast';

export function leafDiagnostic(ctx: InterpretCtx, node: AstNode, message: string): PslDiagnostic {
export function leafDiagnostic(
ctx: InterpretCtx,
node: AstNode,
message: string,
code: PslDiagnostic['code'] = ATTRIBUTE_DIAGNOSTIC_CODE,
): PslDiagnostic {
return {
code: ATTRIBUTE_DIAGNOSTIC_CODE,
code,
message,

@@ -13,0 +18,0 @@ sourceId: ctx.sourceId,

import type { PslDiagnostic } from '@prisma-next/framework-components/psl-ast';
import type { AstNode } from '../syntax/ast-helpers';
import type { AttributeOut, AttributeSpec, InterpretCtx, Param, PositionalParam } from './types';

@@ -13,2 +14,3 @@

ctx: InterpretCtx,
attributeNode: AstNode,
) => readonly PslDiagnostic[];

@@ -15,0 +17,0 @@ }

@@ -140,3 +140,3 @@ import type { PslDiagnostic, PslSpan } from '@prisma-next/framework-components/psl-ast';

if (spec.refine !== undefined) {
const refineDiagnostics = spec.refine(value, ctx);
const refineDiagnostics = spec.refine(value, ctx, attrNode);
if (refineDiagnostics.length > 0) {

@@ -143,0 +143,0 @@ return notOk<readonly PslDiagnostic[]>(refineDiagnostics);

import type { PslDiagnostic } from '@prisma-next/framework-components/psl-ast';
import type { AstNode } from '../syntax/ast-helpers';
import type { AttributeOut, AttributeSpec, InterpretCtx, Param, PositionalParam } from './types';

@@ -13,2 +14,3 @@

ctx: InterpretCtx,
attributeNode: AstNode,
) => readonly PslDiagnostic[];

@@ -15,0 +17,0 @@ }

@@ -7,2 +7,3 @@ import type { PslDiagnostic } from '@prisma-next/framework-components/psl-ast';

import type { ExpressionAst } from '../syntax/ast/expressions';
import type { AstNode } from '../syntax/ast-helpers';

@@ -47,3 +48,12 @@ export type AttributeLevel = 'field' | 'model' | 'block';

readonly named: Readonly<Record<string, Param<unknown>>>;
readonly refine?: (parsed: Out, ctx: InterpretCtx) => readonly PslDiagnostic[];
/**
* Cross-argument validation after all arguments parse. `attributeNode` is
* the attribute's own AST node so refines can span-anchor their
* diagnostics at the attribute rather than the enclosing model.
*/
readonly refine?: (
parsed: Out,
ctx: InterpretCtx,
attributeNode: AstNode,
) => readonly PslDiagnostic[];
}

@@ -50,0 +60,0 @@

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