@prisma-next/sql-contract-ts 0.11.0-dev.62 → 0.11.0-dev.64

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.
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
2
  "name": "@prisma-next/sql-contract-ts",
3
- "version": "0.11.0-dev.62",
3
+ "version": "0.11.0-dev.64",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "SQL-specific TypeScript contract authoring surface for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/config": "0.11.0-dev.62",
10
- "@prisma-next/contract": "0.11.0-dev.62",
11
- "@prisma-next/contract-authoring": "0.11.0-dev.62",
12
- "@prisma-next/framework-components": "0.11.0-dev.62",
13
- "@prisma-next/sql-contract": "0.11.0-dev.62",
14
- "@prisma-next/utils": "0.11.0-dev.62",
9
+ "@prisma-next/config": "0.11.0-dev.64",
10
+ "@prisma-next/contract": "0.11.0-dev.64",
11
+ "@prisma-next/contract-authoring": "0.11.0-dev.64",
12
+ "@prisma-next/framework-components": "0.11.0-dev.64",
13
+ "@prisma-next/sql-contract": "0.11.0-dev.64",
14
+ "@prisma-next/utils": "0.11.0-dev.64",
15
15
  "arktype": "^2.2.0",
16
16
  "pathe": "^2.0.3",
17
17
  "ts-toolbelt": "^9.6.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@prisma-next/test-utils": "0.11.0-dev.62",
21
- "@prisma-next/tsconfig": "0.11.0-dev.62",
20
+ "@prisma-next/test-utils": "0.11.0-dev.64",
21
+ "@prisma-next/tsconfig": "0.11.0-dev.64",
22
22
  "@types/pg": "8.20.0",
23
23
  "pg": "8.20.0",
24
- "@prisma-next/tsdown": "0.11.0-dev.62",
24
+ "@prisma-next/tsdown": "0.11.0-dev.64",
25
25
  "tsdown": "0.22.0",
26
26
  "typescript": "5.9.3",
27
27
  "vitest": "4.1.6"
@@ -1,9 +1,11 @@
1
1
  import { pathToFileURL } from 'node:url';
2
2
  import type { ContractConfig } from '@prisma-next/config/config-types';
3
3
  import type { Contract } from '@prisma-next/contract/types';
4
+ import type { TargetPackRef } from '@prisma-next/framework-components/components';
4
5
  import { ifDefined } from '@prisma-next/utils/defined';
5
6
  import { ok } from '@prisma-next/utils/result';
6
7
  import { extname } from 'pathe';
8
+ import { buildSqlContractFromDefinition } from './build-contract';
7
9
 
8
10
  /**
9
11
  * Derives the emit output path from the TS contract input so artefacts land
@@ -17,6 +19,18 @@ function defaultOutputFromContractPath(contractPath: string): string {
17
19
  return `${contractPath.slice(0, -ext.length)}.json`;
18
20
  }
19
21
 
22
+ export function emptyContract(options: {
23
+ readonly output?: string;
24
+ readonly target: TargetPackRef<'sql', string>;
25
+ }): ContractConfig {
26
+ return {
27
+ source: {
28
+ load: async () => ok(buildSqlContractFromDefinition({ target: options.target, models: [] })),
29
+ },
30
+ ...ifDefined('output', options.output),
31
+ };
32
+ }
33
+
20
34
  export function typescriptContract(contract: Contract, output?: string): ContractConfig {
21
35
  return {
22
36
  source: {
@@ -1,2 +1,6 @@
1
1
  export type { ContractConfig } from '@prisma-next/config/config-types';
2
- export { typescriptContract, typescriptContractFromPath } from '../config-types';
2
+ export {
3
+ emptyContract,
4
+ typescriptContract,
5
+ typescriptContractFromPath,
6
+ } from '../config-types';