Repository navigation
@flags-sdk/flagsmith@2.0.0
Major Changes
-
#519
05e8e0eReplaced the Flagsmith JavaScript SDK with@flagsmith/nodejs, adding support for local evaluation and batched flag evaluation throughevaluate().Breaking changes
- The default adapter reads
FLAGSMITH_ENVIRONMENT_KEYinstead ofFLAGSMITH_ENVIRONMENT_ID. Rename the environment variable in your project, or create a duplicate holding the same value. createFlagsmithAdapter()now acceptsFlagsmithConfigfrom@flagsmith/nodejs. RenameenvironmentIDtoenvironmentKeyandapitoapiUrl.- Browser SDK options, including
cacheFlags,state, andonChange, are no longer supported. Supply user identity and traits through the flag'sidentifyfunction. - Internally replaced the deprecated
flagsmithpackage with@flagsmith/nodejs.
- The default adapter reads
For long-running servers, enable local evaluation with a server-side environment key (starting with ser.):
const adapter = createFlagsmithAdapter({
environmentKey: process.env.FLAGSMITH_ENVIRONMENT_KEY,
enableLocalEvaluation: true,
});Local evaluation shares an environment document across requests and refreshes it every 60 seconds. Configure environmentRefreshIntervalSeconds to change the interval, and call the new adapter.close() method on shutdown to stop polling. Remote evaluation does not download or poll an environment document.
evaluate() fetches flags once per batch. Flags with different coercion modes are evaluated in separate batches. Individual flag evaluation, value coercion, and per-flag defaults remain supported.