Skip to content

Commit

Permalink
chore: migrate from js-sdk to server-sdk (#258)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
  • Loading branch information
beeme1mr authored Nov 30, 2023
1 parent 60134dc commit b537c90
Show file tree
Hide file tree
Showing 21 changed files with 72 additions and 41 deletions.
47 changes: 34 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"@nestjs/core": "9.4.3",
"@nestjs/platform-express": "9.4.3",
"@nestjs/serve-static": "^3.0.0",
"@openfeature/env-var-provider": "^0.1.1",
"@openfeature/flagd-provider": "^0.8.2",
"@openfeature/env-var-provider": "^0.2.0",
"@openfeature/flagd-provider": "^0.8.3",
"@openfeature/flagd-web-provider": "^0.4.0",
"@openfeature/go-feature-flag-provider": "^0.5.14",
"@openfeature/js-sdk": "^1.4.1",
"@openfeature/open-telemetry-hooks": "^0.2.3",
"@openfeature/web-sdk": "0.4.0",
"@openfeature/go-feature-flag-provider": "^0.5.16",
"@openfeature/open-telemetry-hooks": "^0.2.4",
"@openfeature/server-sdk": "^1.7.4",
"@openfeature/web-sdk": "0.4.7",
"@opentelemetry/api": "~1.6.0",
"@opentelemetry/auto-instrumentations-node": "^0.39.2",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.43.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {MiddlewareConsumer, Module, NestModule, Scope} from '@nestjs/common';
import {REQUEST} from '@nestjs/core';
import {ServeStaticModule} from '@nestjs/serve-static';
import {AsyncLocalStorageTransactionContext, LoggingHook, OpenFeatureLogger} from '@openfeature/extra';
import {FlagMetadata, OpenFeature} from '@openfeature/js-sdk';
import { FlagMetadata, OpenFeature } from '@openfeature/server-sdk';
import {MetricsHook, TracingHook as SpanEventBasedTracingHook} from '@openfeature/open-telemetry-hooks';
import {ProviderService} from '@openfeature/provider';
import {Request} from 'express';
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/app/fibonacci/fibonacci.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpService } from '@nestjs/axios';
import { Inject, Injectable } from '@nestjs/common';
import { fibonacci } from '@openfeature/fibonacci';
import { Client } from '@openfeature/js-sdk';
import { Client } from '@openfeature/server-sdk';
import { OPENFEATURE_CLIENT } from '../constants';
import { lastValueFrom, map } from 'rxjs';

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/app/transaction-context.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, NestMiddleware, Inject } from '@nestjs/common';
import { OpenFeature } from '@openfeature/js-sdk';
import { OpenFeature } from '@openfeature/server-sdk';
import { NextFunction, Request, Response } from 'express';
import { REQUEST_DATA } from './constants';
import { RequestData } from './types';
Expand Down
2 changes: 1 addition & 1 deletion packages/fibonacci-service/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {MiddlewareConsumer, Module, NestModule} from '@nestjs/common';
import {AppController} from './app.controller';
import {LoggerModule} from 'nestjs-pino';
import {FlagMetadata, OpenFeature} from '@openfeature/js-sdk';
import { FlagMetadata, OpenFeature } from '@openfeature/server-sdk';
import {AsyncLocalStorageTransactionContext, LoggingHook, OpenFeatureLogger} from '@openfeature/extra';
import {MetricsHook, TracingHook as SpanEventBasedTracingHook} from '@openfeature/open-telemetry-hooks';
import {TransactionContextMiddleware} from './transaction-context.middleware';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { EvaluationContext, OpenFeature } from '@openfeature/js-sdk';
import { EvaluationContext, OpenFeature } from '@openfeature/server-sdk';
import { NextFunction, Request, Response } from 'express';
import { propagation, context } from '@opentelemetry/api';

Expand Down
2 changes: 1 addition & 1 deletion packages/fibonacci/src/lib/fibonacci.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OpenFeature } from '@openfeature/js-sdk';
import { OpenFeature } from '@openfeature/server-sdk';

const oFeatClient = OpenFeature.getClient('fibonacci');

Expand Down
12 changes: 11 additions & 1 deletion packages/js-flagsmith-provider/src/lib/flagsmith.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { EvaluationContext, EvaluationContextValue, FlagNotFoundError, JsonValue, Logger, ParseError, Provider, ResolutionDetails, TypeMismatchError } from '@openfeature/js-sdk';
import {
EvaluationContext,
EvaluationContextValue,
FlagNotFoundError,
JsonValue,
Logger,
ParseError,
Provider,
ResolutionDetails,
TypeMismatchError,
} from '@openfeature/server-sdk';
import { parseValidJsonObject } from '@openfeature/utils';
import Flagsmith from 'flagsmith-nodejs';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client, Target } from '@harnessio/ff-nodejs-server-sdk';
import { EvaluationContext, Provider, ResolutionDetails, JsonValue } from '@openfeature/js-sdk';
import { EvaluationContext, Provider, ResolutionDetails, JsonValue } from '@openfeature/server-sdk';

/**
* NOTE: This is an unofficial provider that was created for demonstration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FlagValue, JsonValue, ParseError, TypeMismatchError } from '@openfeature/js-sdk';
import { EvaluationContext, Provider, ResolutionDetails, Logger } from '@openfeature/js-sdk';
import { FlagValue, JsonValue, ParseError, TypeMismatchError } from '@openfeature/server-sdk';
import { EvaluationContext, Provider, ResolutionDetails, Logger } from '@openfeature/server-sdk';
import { init, LDClient, LDUser } from 'launchdarkly-node-server-sdk';

export interface LaunchDarklyProviderOptions {
Expand Down
6 changes: 3 additions & 3 deletions packages/js-split-provider/src/lib/js-split-provider.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { JsonValue, TypeMismatchError } from '@openfeature/js-sdk';
import { EvaluationContext, Provider, ResolutionDetails, Logger } from '@openfeature/js-sdk';
import { JsonValue, TypeMismatchError } from '@openfeature/server-sdk';
import { EvaluationContext, Provider, ResolutionDetails, Logger } from '@openfeature/server-sdk';
import type { Attributes, IClient } from '@splitsoftware/splitio/types/splitio';
import { parseValidNumber, parseValidJsonObject } from '@openfeature/utils';

/**
*
*
* NOTE: This is an unofficial provider that was created for demonstration
* purposes only. The playground environment will be updated to use official
* providers once they're available.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EvaluationDetails, Hook, HookContext, JsonObject } from '@openfeature/js-sdk';
import { EvaluationDetails, Hook, HookContext, JsonObject } from '@openfeature/server-sdk';
import { validateSync } from 'class-validator';

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down
2 changes: 1 addition & 1 deletion packages/openfeature-extra/src/lib/hooks/logging-hook.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EvaluationDetails, FlagValue, Hook, HookContext, HookHints } from '@openfeature/js-sdk';
import { EvaluationDetails, FlagValue, Hook, HookContext, HookHints } from '@openfeature/server-sdk';

/**
* A hook that simply logs at every life-cycle stage.
Expand Down
2 changes: 1 addition & 1 deletion packages/openfeature-extra/src/lib/logger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Logger as OFLogger } from '@openfeature/js-sdk';
import { Logger as OFLogger } from '@openfeature/server-sdk';
import { Logger } from '@nestjs/common';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EvaluationContext, TransactionContextPropagator } from '@openfeature/js-sdk';
import { EvaluationContext, TransactionContextPropagator } from '@openfeature/server-sdk';
import { AsyncLocalStorage } from 'async_hooks';

export class AsyncLocalStorageTransactionContext implements TransactionContextPropagator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
BaggageEntry,
} from '@opentelemetry/api';
import { isTracingSuppressed } from '@opentelemetry/core';
import { OpenFeature, EvaluationContext } from '@openfeature/js-sdk';
import { OpenFeature, EvaluationContext } from '@openfeature/server-sdk';

const KEY_PAIR_SEPARATOR = '=';
const PROPERTIES_SEPARATOR = ';';
Expand Down
2 changes: 1 addition & 1 deletion packages/provider/src/lib/provider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GoFeatureFlagProvider } from '@openfeature/go-feature-flag-provider';
import { EnvVarProvider } from '@openfeature/env-var-provider';
import { FlagsmithProvider } from '@openfeature/js-flagsmith-provider';
import { OpenFeatureLaunchDarklyProvider } from '@openfeature/js-launchdarkly-provider';
import { OpenFeature, Provider } from '@openfeature/js-sdk';
import { OpenFeature, Provider } from '@openfeature/server-sdk';
import { OpenFeatureSplitProvider } from '@openfeature/js-split-provider';
import { SplitFactory } from '@splitsoftware/splitio';
import { CloudbeesProvider } from 'cloudbees-openfeature-provider-node';
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/lib/parse-valid-boolean.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypeMismatchError } from '@openfeature/js-sdk';
import { TypeMismatchError } from '@openfeature/server-sdk';

export const parseValidBoolean = (stringValue: string | undefined) => {
const asUnknown = stringValue as unknown;
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/lib/parse-valid-json-object.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonValue, ParseError, TypeMismatchError } from '@openfeature/js-sdk';
import { JsonValue, ParseError, TypeMismatchError } from '@openfeature/server-sdk';

export const parseValidJsonObject = <T extends JsonValue>(stringValue: string): T => {
if (stringValue === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/lib/parse-valid-number.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ParseError, TypeMismatchError } from '@openfeature/js-sdk';
import { ParseError, TypeMismatchError } from '@openfeature/server-sdk';

export const parseValidNumber = (stringValue: string | undefined) => {
if (stringValue === undefined) {
Expand Down

0 comments on commit b537c90

Please sign in to comment.