
Security News
/Company News
Securing the Financial Frontier: How Capital One Uses Socket for Open Source Security
Capital One is partnering with Socket to proactively secure its open source supply chain.
@prisma-next/utils
Advanced tools
Shared utility functions for Prisma Next.
This package provides general-purpose utility functions used across the Prisma Next codebase. These utilities are target-agnostic and have no dependencies on other Prisma Next packages.
ifDefined(key, value)Returns an object with the key/value if value is defined, otherwise an empty object. Use with spread to conditionally include optional properties while satisfying exactOptionalPropertyTypes.
import { ifDefined } from '@prisma-next/utils/defined';
// Instead of:
const obj = {
required: 'value',
...(optional ? { optional } : {}),
};
// Use:
const obj = {
required: 'value',
...ifDefined('optional', optional),
};
Why use this?
{} or { key: V } (without undefined)Result<T, F>, ok(), notOk(), okVoid()Generic Result type for representing success or failure outcomes. This is the standard way to return "expected failures" as values rather than throwing exceptions.
import { type Result, ok, notOk, okVoid } from '@prisma-next/utils/result';
// Success result with value
function divide(a: number, b: number): Result<number, string> {
if (b === 0) {
return notOk('Division by zero');
}
return ok(a / b);
}
// Using the result
const result = divide(10, 2);
if (result.ok) {
console.log(result.value); // 5
} else {
console.error(result.failure); // error message
}
// Void success for validation
function validate(value: unknown): Result<void, string> {
if (!value) {
return notOk('Value is required');
}
return okVoid();
}
Types:
Ok<T> - Success with value: { ok: true, value: T }NotOk<F> - Failure with details: { ok: false, failure: F }Result<T, F> - Discriminated union of Ok<T> | NotOk<F>See docs/Error Handling.md for the full error taxonomy.
This package is part of the framework domain, core layer, shared plane:
packages/1-framework/1-core/shared/utilsThis package has no dependencies - it's part of the innermost core ring and provides foundational utilities.
FAQs
Shared utility functions for Prisma Next
The npm package @prisma-next/utils receives a total of 900 weekly downloads. As such, @prisma-next/utils popularity was classified as not popular.
We found that @prisma-next/utils 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
/Company News
Capital One is partnering with Socket to proactively secure its open source supply chain.

Security News
Socket CTO Ahmad Nassri discusses how to keep AI agents from bypassing package blocks, limit credential access, and monitor their actions.

Security News
GPT-6 Astra tried to plant malicious code in simulated open source projects using fake GitHub accounts and deceptive PRs during an assigned CTF challenge.