🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@etrigan/feature-toggles

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etrigan/feature-toggles - npm Package Compare versions

Comparing version

to
1.2.0

10

CHANGELOG.md
# @etrigan/feature-toggles
## 1.2.0
### Minor Changes
- 26418a5: Allow the feature updater to return null which will skip writing the feature state file and just use the existing values
### Patch Changes
- @etrigan/feature-toggles-client@1.1.6
## 1.1.4

@@ -4,0 +14,0 @@

3

dist/create-feature-updater.d.ts

@@ -12,3 +12,4 @@ import { RawFeatureValues } from '@etrigan/feature-toggles-client';

log?: Logger;
getFeatures(log: Logger): Promise<RawFeatureValues>;
/** @returns null when unable to fetch features, will just use values from feature state file if it exists */
getFeatures(log: Logger): Promise<RawFeatureValues | null>;
/**

@@ -15,0 +16,0 @@ * If specified, will subscribe to changes and notify workers when the toggles change

@@ -85,2 +85,3 @@ "use strict";

case 6:
if (!rawFeatureValues) return [3 /*break*/, 12];
log.debug({ featureStateFile: options.featureStateFile }, "Writing new feature state to feature state file");

@@ -101,3 +102,4 @@ _a.label = 7;

_a.sent();
return [2 /*return*/];
_a.label = 12;
case 12: return [2 /*return*/];
}

@@ -104,0 +106,0 @@ });

{
"name": "@etrigan/feature-toggles",
"version": "1.1.4",
"version": "1.2.0",
"description": "Etrigan feature toggles",

@@ -10,3 +10,3 @@ "main": "dist/index.js",

"dependencies": {
"@etrigan/feature-toggles-client": "1.1.5"
"@etrigan/feature-toggles-client": "1.1.6"
},

@@ -13,0 +13,0 @@ "peerDependencies": {

import { RawFeatureValues } from '@etrigan/feature-toggles-client'
import { raw } from 'express'
import { Logger, noopLogger } from 'typescript-log'

@@ -21,3 +22,4 @@ import { FeatureUpdater } from './feature-updater'

getFeatures(log: Logger): Promise<RawFeatureValues>
/** @returns null when unable to fetch features, will just use values from feature state file if it exists */
getFeatures(log: Logger): Promise<RawFeatureValues | null>

@@ -36,3 +38,3 @@ /**

const { log = noopLogger(), featureStateFile, getFeatures, subscribeToChanges } = options
let initialFeatureState: RawFeatureValues | undefined
let initialFeatureState: RawFeatureValues | undefined | null
try {

@@ -80,3 +82,3 @@ initialFeatureState = await getFeatures(log)

log.debug(`Processing features changed notification`)
let rawFeatureValues: RawFeatureValues
let rawFeatureValues: RawFeatureValues | null | undefined
try {

@@ -94,13 +96,15 @@ if (newFeatures) {

log.debug(
{ featureStateFile: options.featureStateFile },
`Writing new feature state to feature state file`,
)
try {
await writeFeatureFile(options.featureStateFile, rawFeatureValues, log)
} catch (err) {
log.error({ err }, 'Failed to write feature file')
if (rawFeatureValues) {
log.debug(
{ featureStateFile: options.featureStateFile },
`Writing new feature state to feature state file`,
)
try {
await writeFeatureFile(options.featureStateFile, rawFeatureValues, log)
} catch (err) {
log.error({ err }, 'Failed to write feature file')
}
await featureUpdater.updateToggleState(rawFeatureValues)
}
await featureUpdater.updateToggleState(rawFeatureValues)
}

Sorry, the diff of this file is not supported yet