
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
@prisma-next/sql-contract
Advanced tools
SQL contract types, validators, and IR factories for Prisma Next.
This package provides TypeScript type definitions, Arktype validators, and factory functions for constructing SQL contract structures. It is located in the shared plane, making it available to both migration-plane (authoring, emitter) and runtime-plane (lanes, runtime) packages.
SqlContract, SqlStorage, StorageTable, ModelDefinition, SqlMappings) that extend framework-level contract typesEach StorageColumn in SQL contracts includes both:
nativeType (required): Native database type identifier (e.g., 'int4', 'text', 'vector') - used for database structure verification and migration planningcodecId (required): Codec identifier (e.g., 'pg/int4@1', 'pg/text@1', 'pg/vector@1') - used for query builders and runtime codecsnullable (required): Whether the column is nullableBoth nativeType and codecId are required to ensure contracts are consumable by both the application (via codec IDs) and the database (via native types). See docs/briefs/Sql-Contract-Native-and-Codec-Types.md for details.
SqlContract, SqlStorage, StorageTable, ModelDefinition, and related typesImport SQL contract types:
import type {
SqlContract,
SqlStorage,
StorageTable,
ModelDefinition,
} from '@prisma-next/sql-contract/exports/types';
Validate contract structures using Arktype validators:
import { validateSqlContract, validateStorage, validateModel } from '@prisma-next/sql-contract/exports/validators';
// Validate a complete contract
const contract = validateSqlContract<Contract>(contractJson);
// Validate storage structure
const storage = validateStorage(storageJson);
// Validate model structure
const model = validateModel(modelJson);
Use factory functions to construct contract IR structures in tests:
import { col, table, storage, model, contract, pk, unique, index, fk } from '@prisma-next/sql-contract/exports/factories';
// Create a column (nativeType, codecId, nullable)
const idColumn = col('int4', 'pg/int4@1', false);
// Create a table
const userTable = table(
{
id: col('int4', 'pg/int4@1'),
email: col('text', 'pg/text@1'),
},
{
pk: pk('id'),
uniques: [unique('email')],
indexes: [index('email')],
}
);
// Create storage
const s = storage({ user: userTable });
// Create a model
const userModel = model('user', {
id: { column: 'id' },
email: { column: 'email' },
});
// Create a complete contract
const c = contract({
target: 'postgres',
coreHash: 'sha256:abc123',
storage: s,
models: { User: userModel },
});
./exports/types: TypeScript type definitions./exports/validators: Arktype validators for structural validation./exports/factories: Factory functions for constructing contract IRflowchart TD
subgraph "SQL Contract Package (Shared Plane)"
TYPES[Type Definitions]
VALIDATORS[Validators]
FACTORIES[IR Factories]
end
subgraph "Migration Plane"
AUTHORING[Authoring]
EMITTER[Emitter]
end
subgraph "Runtime Plane"
LANES[Lanes]
RUNTIME[Runtime]
end
TYPES --> AUTHORING
TYPES --> EMITTER
TYPES --> LANES
TYPES --> RUNTIME
VALIDATORS --> AUTHORING
VALIDATORS --> EMITTER
VALIDATORS --> RUNTIME
FACTORIES --> AUTHORING
FACTORIES --> EMITTER
@prisma-next/contract: Framework-level contract types (ContractBase)arktype: Runtime validation libraryDependents:
@prisma-next/sql-contract-ts: Uses SQL contract types and validators for authoring@prisma-next/sql-contract-emitter: Uses SQL contract types for emission@prisma-next/sql-query: Uses SQL contract types for query building@prisma-next/sql-runtime: Uses SQL contract types for runtime execution@prisma-next/sql-lane: Uses SQL contract types for lane operations@prisma-next/contract: Framework-level contract types (ContractBase)@prisma-next/sql-contract-ts: SQL contract authoring surface (uses this package)@prisma-next/emitter: Contract emission engine (uses validators)FAQs
SQL contract types, validators, and IR factories for Prisma Next
The npm package @prisma-next/sql-contract receives a total of 1,862 weekly downloads. As such, @prisma-next/sql-contract popularity was classified as popular.
We found that @prisma-next/sql-contract demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.