@devcycle/nodejs-server-sdk
Advanced tools
Comparing version 1.22.1 to 1.23.0
# config-manager | ||
This library extracts the `EnvironmentConfigManager` Server SDK logic to be used across the NodeJS SDK | ||
This library extracts the `EnvironmentConfigManager` Server SDK logic to be used across the Node.js SDK | ||
and Edge Worker SDKs. | ||
@@ -5,0 +5,0 @@ |
{ | ||
"name": "@devcycle/nodejs-server-sdk", | ||
"version": "1.22.1", | ||
"version": "1.23.0", | ||
"description": "The DevCycle NodeJS Server SDK used for feature management.", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@devcycle/bucketing-assembly-script": "^1.15.1", | ||
"@devcycle/js-cloud-server-sdk": "^1.7.1", | ||
"@devcycle/types": "^1.8.1", | ||
"@devcycle/bucketing-assembly-script": "^1.16.0", | ||
"@devcycle/js-cloud-server-sdk": "^1.8.0", | ||
"@devcycle/types": "^1.9.0", | ||
"cross-fetch": "^3.1.8", | ||
@@ -14,6 +14,6 @@ "fetch-retry": "^5.0.3" | ||
"peerDependencies": { | ||
"@openfeature/server-sdk": "^1.9.1" | ||
"@openfeature/server-sdk": "^1.11.0" | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0" | ||
"node": ">=16.0.0" | ||
}, | ||
@@ -20,0 +20,0 @@ "main": "src/index.js", |
@@ -1,4 +0,4 @@ | ||
# DevCycle NodeJS Server SDK | ||
# DevCycle Node.js Server SDK | ||
The NodeJS Server SDK for DevCycle. | ||
The Node.js Server SDK for DevCycle. | ||
@@ -5,0 +5,0 @@ This SDK uses local bucketing to perform all user segmentation and bucketing locally in the SDK, |
import { DevCycleServerSDKOptions, VariableTypeAlias } from '@devcycle/types'; | ||
import { DevCycleUser, DVCVariable, DVCVariableValue, DVCVariableSet, DVCFeatureSet, DevCycleEvent } from '@devcycle/js-cloud-server-sdk'; | ||
import DevCycleProvider from './open-feature-provider/DevCycleProvider'; | ||
type DevCycleProviderConstructor = typeof import('./open-feature-provider/DevCycleProvider').DevCycleProvider; | ||
type DevCycleProvider = InstanceType<DevCycleProviderConstructor>; | ||
export declare class DevCycleClient { | ||
@@ -14,3 +15,3 @@ private sdkKey; | ||
constructor(sdkKey: string, options?: DevCycleServerSDKOptions); | ||
getOpenFeatureProvider(): DevCycleProvider; | ||
getOpenFeatureProvider(): Promise<DevCycleProvider>; | ||
/** | ||
@@ -31,1 +32,2 @@ * Notify the user when Features have been loaded from the server. | ||
} | ||
export {}; |
@@ -40,3 +40,2 @@ "use strict"; | ||
const populatedUserHelpers_1 = require("./models/populatedUserHelpers"); | ||
const DevCycleProvider_1 = __importDefault(require("./open-feature-provider/DevCycleProvider")); | ||
const castIncomingUser = (user) => { | ||
@@ -100,6 +99,15 @@ if (!(user instanceof js_cloud_server_sdk_1.DevCycleUser)) { | ||
} | ||
getOpenFeatureProvider() { | ||
async getOpenFeatureProvider() { | ||
let DevCycleProviderClass; | ||
try { | ||
const importedModule = await import('./open-feature-provider/DevCycleProvider.js'); | ||
DevCycleProviderClass = importedModule.DevCycleProvider; | ||
} | ||
catch (error) { | ||
throw new Error('Missing "@openfeature/server-sdk" and/or "@openfeature/core" ' + | ||
'peer dependencies to get OpenFeature Provider'); | ||
} | ||
if (this.openFeatureProvider) | ||
return this.openFeatureProvider; | ||
this.openFeatureProvider = new DevCycleProvider_1.default(this, { | ||
this.openFeatureProvider = new DevCycleProviderClass(this, { | ||
logger: this.logger, | ||
@@ -106,0 +114,0 @@ }); |
import { DevCycleClient } from './client'; | ||
import { DevCycleUser, DevCycleCloudClient as InternalDevCycleCloudClient, dvcDefaultLogger, DevCycleEvent, DVCVariableValue, JSON, DVCJSON, DVCCustomDataJSON, DVCVariable, DVCVariableSet, DVCVariableInterface, DVCFeature, DVCFeatureSet, DevCyclePlatformDetails } from '@devcycle/js-cloud-server-sdk'; | ||
import { DevCycleServerSDKOptions } from '@devcycle/types'; | ||
import DevCycleProvider from './open-feature-provider/DevCycleProvider'; | ||
type DevCycleProviderConstructor = typeof import('./open-feature-provider/DevCycleProvider').DevCycleProvider; | ||
type DevCycleProvider = InstanceType<DevCycleProviderConstructor>; | ||
declare class DevCycleCloudClient extends InternalDevCycleCloudClient { | ||
private openFeatureProvider; | ||
constructor(sdkKey: string, options: DevCycleServerSDKOptions, platformDetails: DevCyclePlatformDetails); | ||
getOpenFeatureProvider(): DevCycleProvider; | ||
getOpenFeatureProvider(): Promise<DevCycleProvider>; | ||
} | ||
export { DevCycleClient, DevCycleCloudClient, DevCycleUser, DevCycleServerSDKOptions as DevCycleOptions, DevCycleEvent, DevCycleProvider, DVCVariableValue, JSON, DVCJSON, DVCCustomDataJSON, DVCVariable, DVCVariableSet, DVCVariableInterface, DVCFeature, DVCFeatureSet, }; | ||
export { DevCycleClient, DevCycleCloudClient, DevCycleUser, DevCycleServerSDKOptions as DevCycleOptions, DevCycleEvent, DVCVariableValue, JSON, DVCJSON, DVCCustomDataJSON, DVCVariable, DVCVariableSet, DVCVariableInterface, DVCFeature, DVCFeatureSet, }; | ||
export { dvcDefaultLogger }; | ||
@@ -12,0 +13,0 @@ /** |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.initialize = exports.initializeDevCycle = exports.dvcDefaultLogger = exports.DVCVariable = exports.DevCycleProvider = exports.DevCycleUser = exports.DevCycleCloudClient = exports.DevCycleClient = void 0; | ||
exports.initialize = exports.initializeDevCycle = exports.dvcDefaultLogger = exports.DVCVariable = exports.DevCycleUser = exports.DevCycleCloudClient = exports.DevCycleClient = void 0; | ||
const client_1 = require("./client"); | ||
@@ -14,4 +11,2 @@ Object.defineProperty(exports, "DevCycleClient", { enumerable: true, get: function () { return client_1.DevCycleClient; } }); | ||
const platformDetails_1 = require("./utils/platformDetails"); | ||
const DevCycleProvider_1 = __importDefault(require("./open-feature-provider/DevCycleProvider")); | ||
exports.DevCycleProvider = DevCycleProvider_1.default; | ||
class DevCycleCloudClient extends js_cloud_server_sdk_1.DevCycleCloudClient { | ||
@@ -21,6 +16,15 @@ constructor(sdkKey, options, platformDetails) { | ||
} | ||
getOpenFeatureProvider() { | ||
async getOpenFeatureProvider() { | ||
let DevCycleProviderClass; | ||
try { | ||
const importedModule = await import('./open-feature-provider/DevCycleProvider.js'); | ||
DevCycleProviderClass = importedModule.DevCycleProvider; | ||
} | ||
catch (error) { | ||
throw new Error('Missing "@openfeature/server-sdk" and/or "@openfeature/core" ' + | ||
'peer dependencies to get OpenFeature Provider'); | ||
} | ||
if (this.openFeatureProvider) | ||
return this.openFeatureProvider; | ||
this.openFeatureProvider = new DevCycleProvider_1.default(this, { | ||
this.openFeatureProvider = new DevCycleProviderClass(this, { | ||
logger: this.logger, | ||
@@ -27,0 +31,0 @@ }); |
import { Provider, ResolutionDetails, EvaluationContext, JsonValue, ProviderMetadata, ProviderStatus } from '@openfeature/server-sdk'; | ||
import { DevCycleClient, DevCycleCloudClient, DevCycleOptions } from '../index'; | ||
export default class DevCycleProvider implements Provider { | ||
export declare class DevCycleProvider implements Provider { | ||
private readonly devcycleClient; | ||
@@ -5,0 +5,0 @@ readonly metadata: ProviderMetadata; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DevCycleProvider = void 0; | ||
const server_sdk_1 = require("@openfeature/server-sdk"); | ||
@@ -235,3 +236,3 @@ const index_1 = require("../index"); | ||
} | ||
exports.default = DevCycleProvider; | ||
exports.DevCycleProvider = DevCycleProvider; | ||
//# sourceMappingURL=DevCycleProvider.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
219004
2138