@prisma-next/psl-parser 0.16.0-dev.20 → 0.16.0-dev.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,7 +17,7 @@ function withSeedDiagnostics(result, seedDiagnostics) {
17
17
  }
18
18
  /** The single seam that narrows a contract source to the interpret capability. */
19
19
  function hasPslInterpreter(source) {
20
- return source.sourceFormat === "psl" && "interpret" in source && typeof source.interpret === "function";
20
+ return source.format === "psl" && "interpret" in source && typeof source.interpret === "function";
21
21
  }
22
22
  //#endregion
23
23
  export { hasPslInterpreter, withSeedDiagnostics };
@@ -1 +1 @@
1
- {"version":3,"file":"interpret.mjs","names":[],"sources":["../src/interpret.ts"],"sourcesContent":["import type {\n ContractSourceContext,\n ContractSourceDiagnostic,\n ContractSourceDiagnostics,\n ContractSourceProvider,\n PslContractSourceProvider,\n} from '@prisma-next/config/config-types';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { notOk, type Result } from '@prisma-next/utils/result';\nimport type { SourceFile } from './source-file';\nimport type { SymbolTable } from './symbol-table';\nimport type { DocumentAst } from './syntax/ast/declarations';\n\n/**\n * Lets editor tooling that already parses incrementally (e.g. the language\n * server) hand cached artifacts to the interpreter instead of forcing a\n * disk re-parse.\n */\nexport interface PslInterpretInput {\n readonly document: DocumentAst;\n readonly sourceFile: SourceFile;\n readonly symbolTable: SymbolTable;\n readonly sourceId: string;\n}\n\n/**\n * Declared here — the authoring layer that owns `DocumentAst` / `SourceFile` /\n * `SymbolTable` — because `@prisma-next/config` (core) cannot name authoring\n * types. `interpret` must not read disk or `context.resolvedInputs` — those\n * are load-path concerns.\n */\nexport interface PslInterpretCapable extends PslContractSourceProvider {\n interpret(\n input: PslInterpretInput,\n context: ContractSourceContext,\n ): Result<Contract, ContractSourceDiagnostics>;\n}\n\n/**\n * Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n * interpretation result. The authored headline is deliberately uniform — it\n * reports how many errors the schema has, never which pipeline stage found\n * them.\n */\nexport function withSeedDiagnostics(\n result: Result<Contract, ContractSourceDiagnostics>,\n seedDiagnostics: readonly ContractSourceDiagnostic[],\n): Result<Contract, ContractSourceDiagnostics> {\n if (seedDiagnostics.length === 0) {\n return result;\n }\n const diagnostics = result.ok\n ? seedDiagnostics\n : [...seedDiagnostics, ...result.failure.diagnostics];\n return notOk({\n summary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? '' : 's'}`,\n diagnostics,\n ...(result.ok || result.failure.meta === undefined ? {} : { meta: result.failure.meta }),\n });\n}\n\n/** The single seam that narrows a contract source to the interpret capability. */\nexport function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable {\n return (\n source.sourceFormat === 'psl' && 'interpret' in source && typeof source.interpret === 'function'\n );\n}\n"],"mappings":";;;;;;;;AA4CA,SAAgB,oBACd,QACA,iBAC6C;CAC7C,IAAI,gBAAgB,WAAW,GAC7B,OAAO;CAET,MAAM,cAAc,OAAO,KACvB,kBACA,CAAC,GAAG,iBAAiB,GAAG,OAAO,QAAQ,WAAW;CACtD,OAAO,MAAM;EACX,SAAS,cAAc,YAAY,OAAO,QAAQ,YAAY,WAAW,IAAI,KAAK;EAClF;EACA,GAAI,OAAO,MAAM,OAAO,QAAQ,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,OAAO,QAAQ,KAAK;CACxF,CAAC;AACH;;AAGA,SAAgB,kBAAkB,QAA+D;CAC/F,OACE,OAAO,iBAAiB,SAAS,eAAe,UAAU,OAAO,OAAO,cAAc;AAE1F"}
1
+ {"version":3,"file":"interpret.mjs","names":[],"sources":["../src/interpret.ts"],"sourcesContent":["import type {\n ContractSourceContext,\n ContractSourceDiagnostic,\n ContractSourceDiagnostics,\n ContractSourceProvider,\n PslContractSourceProvider,\n} from '@prisma-next/config/config-types';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { notOk, type Result } from '@prisma-next/utils/result';\nimport type { SourceFile } from './source-file';\nimport type { SymbolTable } from './symbol-table';\nimport type { DocumentAst } from './syntax/ast/declarations';\n\n/**\n * Lets editor tooling that already parses incrementally (e.g. the language\n * server) hand cached artifacts to the interpreter instead of forcing a\n * disk re-parse.\n */\nexport interface PslInterpretInput {\n readonly document: DocumentAst;\n readonly sourceFile: SourceFile;\n readonly symbolTable: SymbolTable;\n readonly sourceId: string;\n}\n\n/**\n * Declared here — the authoring layer that owns `DocumentAst` / `SourceFile` /\n * `SymbolTable` — because `@prisma-next/config` (core) cannot name authoring\n * types. `interpret` must not read disk or `context.resolvedInputs` — those\n * are load-path concerns.\n */\nexport interface PslInterpretCapable extends PslContractSourceProvider {\n interpret(\n input: PslInterpretInput,\n context: ContractSourceContext,\n ): Result<Contract, ContractSourceDiagnostics>;\n}\n\n/**\n * Merges caller-side diagnostics (e.g. parse / symbol-table findings) into an\n * interpretation result. The authored headline is deliberately uniform — it\n * reports how many errors the schema has, never which pipeline stage found\n * them.\n */\nexport function withSeedDiagnostics(\n result: Result<Contract, ContractSourceDiagnostics>,\n seedDiagnostics: readonly ContractSourceDiagnostic[],\n): Result<Contract, ContractSourceDiagnostics> {\n if (seedDiagnostics.length === 0) {\n return result;\n }\n const diagnostics = result.ok\n ? seedDiagnostics\n : [...seedDiagnostics, ...result.failure.diagnostics];\n return notOk({\n summary: `Schema has ${diagnostics.length} error${diagnostics.length === 1 ? '' : 's'}`,\n diagnostics,\n ...(result.ok || result.failure.meta === undefined ? {} : { meta: result.failure.meta }),\n });\n}\n\n/** The single seam that narrows a contract source to the interpret capability. */\nexport function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable {\n return source.format === 'psl' && 'interpret' in source && typeof source.interpret === 'function';\n}\n"],"mappings":";;;;;;;;AA4CA,SAAgB,oBACd,QACA,iBAC6C;CAC7C,IAAI,gBAAgB,WAAW,GAC7B,OAAO;CAET,MAAM,cAAc,OAAO,KACvB,kBACA,CAAC,GAAG,iBAAiB,GAAG,OAAO,QAAQ,WAAW;CACtD,OAAO,MAAM;EACX,SAAS,cAAc,YAAY,OAAO,QAAQ,YAAY,WAAW,IAAI,KAAK;EAClF;EACA,GAAI,OAAO,MAAM,OAAO,QAAQ,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,OAAO,QAAQ,KAAK;CACxF,CAAC;AACH;;AAGA,SAAgB,kBAAkB,QAA+D;CAC/F,OAAO,OAAO,WAAW,SAAS,eAAe,UAAU,OAAO,OAAO,cAAc;AACzF"}
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@prisma-next/psl-parser",
3
- "version": "0.16.0-dev.20",
3
+ "version": "0.16.0-dev.22",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Reusable parser for Prisma Schema Language (PSL)",
8
8
  "dependencies": {
9
- "@prisma-next/config": "0.16.0-dev.20",
10
- "@prisma-next/contract": "0.16.0-dev.20",
11
- "@prisma-next/framework-components": "0.16.0-dev.20",
12
- "@prisma-next/utils": "0.16.0-dev.20"
9
+ "@prisma-next/config": "0.16.0-dev.22",
10
+ "@prisma-next/contract": "0.16.0-dev.22",
11
+ "@prisma-next/framework-components": "0.16.0-dev.22",
12
+ "@prisma-next/utils": "0.16.0-dev.22"
13
13
  },
14
14
  "devDependencies": {
15
- "@prisma-next/tsconfig": "0.16.0-dev.20",
16
- "@prisma-next/tsdown": "0.16.0-dev.20",
15
+ "@prisma-next/tsconfig": "0.16.0-dev.22",
16
+ "@prisma-next/tsdown": "0.16.0-dev.22",
17
17
  "tsdown": "0.22.8",
18
18
  "typescript": "5.9.3",
19
19
  "vitest": "4.1.10"
package/src/interpret.ts CHANGED
@@ -61,7 +61,5 @@ export function withSeedDiagnostics(
61
61
 
62
62
  /** The single seam that narrows a contract source to the interpret capability. */
63
63
  export function hasPslInterpreter(source: ContractSourceProvider): source is PslInterpretCapable {
64
- return (
65
- source.sourceFormat === 'psl' && 'interpret' in source && typeof source.interpret === 'function'
66
- );
64
+ return source.format === 'psl' && 'interpret' in source && typeof source.interpret === 'function';
67
65
  }