
Security News
AI Agent Lands PRs in Major OSS Projects, Targets Maintainers via Cold Outreach
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.
@ceski23/stan-js-utils
Advanced tools
This package is UNOFFICIAL set of utils for use with [stan-js](https://github.com/codemask-labs/stan-js).
This package is UNOFFICIAL set of utils for use with stan-js.
This is small util that helps to maintain backward compatibility of state when persisting it e.g. in localStorage. It accepts one parameter - configuration object with few params:
version - this is current version of your state, you should increase it each time you change your state in non-backwards compatible waymigrations - object with state migrations, each key is version number and value is function which will get old state and should return migrated stateserialize/deserialize - custom (de)serializer, same as in stan-jsLet's say you stored user info in store and persisted it in localStorage:
type UserData = {
username: string
}
const store = createStore({
user: storage<UserData | null>(null, {
...withMigrations({
version: 0,
migrations: {},
}),
}),
})
Then, after some time you decide that you also want to have user's name in that state. You now have to do two steps:
const userDataV0Schema = z.object({
username: z.string(),
})
type UserData = {
username: string
name: string
}
const store = createStore({
user: storage<UserData | null>(null, {
...withMigrations({
version: 1,
migrations: {
1: (prev: unknown) => {
const { success, data } = userDataV0Schema.safeParse(prev)
return success ? { ...data, name: data.username } : null
},
},
}),
}),
})
In above example we declare migration from version 0 to 1 which is using zod to parse data and add new property. In the future if you change state's shape again you will have to repeat those steps.
Let's add age property:
const userDataV0Schema = z.object({
username: z.string(),
})
const userDataV1Schema = userDataV0Schema.extend({
name: z.string(),
})
type UserData = {
username: string
name: string
}
const store = createStore({
user: storage<UserData | null>(null, {
...withMigrations({
version: 2,
migrations: {
1: (prev: unknown) => {
const { success, data } = userDataV0Schema.safeParse(prev)
return success ? { ...data, name: data.username } : null
},
2: (prev: unknown) => {
const { success, data } = userDataV1Schema.safeParse(prev)
return success ? { ...data, age: 0 } : null
},
},
}),
}),
})
FAQs
This package is UNOFFICIAL set of utils for use with [stan-js](https://github.com/codemask-labs/stan-js).
We found that @ceski23/stan-js-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
An AI agent is merging PRs into major OSS projects and cold-emailing maintainers to drum up more work.

Research
/Security News
Chrome extension CL Suite by @CLMasters neutralizes 2FA for Facebook and Meta Business accounts while exfiltrating Business Manager contact and analytics data.

Security News
After Matplotlib rejected an AI-written PR, the agent fired back with a blog post, igniting debate over AI contributions and maintainer burden.