
Security News
The Code You Didn't Write Is Still Yours to Defend
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.
@piadina/scheme-up
Advanced tools
`Scheme-up` is a full working **framework-agnostic**, **type-safe**, **semver-compatible**, **auto-upgrading**, versioned API response handler.
Scheme-up is a full working framework-agnostic, type-safe, semver-compatible, auto-upgrading, versioned API response handler.
npm install @piadina/scheme-up
scheme-up helps you safely evolve JSON data structures and API responses over time, with type safety, semver, and automated migrations. It’s ideal when you need to manage breaking changes gracefully and maintain compatibility across versions.
// Create version flow for V1
const preferencesFlow = new VersionFlow<UserPreferencesV1>()
.add<UserPreferencesV1>((builder) => {
builder
// Schema version this node handles
.version('1.0.0')
// Semantic version range (compatible with 1.x.x)
.semverRange('^1.0.0')
// Validation function to run
.assert(assertUserPreferencesV1);
});
export async function fetchUserPreferences() {
try {
// Standard API call to fetch user data
const response = await fetch('/api/user-preferences');
const rawData = await response.json();
// Execute validation through the version flow
const schemaResult = preferencesFlow.execute(rawData);
const [ isSuccess, result ] = schemaResult;
if (!isSuccess) {
console.error('Validation failed:', result.message);
// Return the error tuple
return schemaResult;
}
// Extract validated data from the wrapper
return [ true, result.data ] as const;
} catch (error) {
// Handle network/parsing errors separately from validation errors
return [
false,
new Error(`Fetch failed: ${ error instanceof Error ? error.message : 'Unknown error' }`),
] as const;
}
}
// Usage example
async function loadUserPreferences() {
const [ isSuccess, result ] = await fetchUserPreferences();
if (!isSuccess) {
console.error('Failed to load preferences:', result.message);
// Handle error case
return;
}
// TypeScript now knows `result` is UserPreferencesV1Data
console.log('User theme:', result.theme);
console.log('User language:', result.language);
console.log('Font size:', result.fontSize);
}
FAQs
`Scheme-up` is a full working **framework-agnostic**, **type-safe**, **semver-compatible**, **auto-upgrading**, versioned API response handler.
We found that @piadina/scheme-up demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
AI agents are pulling packages into environments no scanner is watching, creating exposure before security teams can see it.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.