Skip to content

Commit

Permalink
chore: upgrade node client (#169)
Browse files Browse the repository at this point in the history
Co-authored-by: sjaanus <[email protected]>
  • Loading branch information
kwasniew and sjaanus authored Mar 21, 2024
1 parent 82be9a8 commit 0cf22b4
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 191 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unleash/proxy",
"version": "1.1.1",
"version": "1.2.0",
"description": "The Unleash Proxy (Open-Source)",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -45,7 +45,7 @@
"json-schema-to-ts": "^2.3.0",
"openapi-types": "^11.0.0",
"type-is": "^1.6.18",
"unleash-client": "^5.0.0"
"unleash-client": "^5.5.2"
},
"devDependencies": {
"@apidevtools/swagger-parser": "10.1.0",
Expand Down Expand Up @@ -89,6 +89,8 @@
]
},
"resolutions": {
"wrap-ansi": "7.0.0",
"string-width": "4.1.0",
"qs": "^6.9.7",
"json5": "^2.2.2",
"cookiejar": "^2.1.4"
Expand Down
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Logger } from './logger';
export type FeatureToggleStatus = {
name: string;
enabled: boolean;
impressionData: boolean;
impressionData?: boolean;
variant?: Variant;
};

Expand Down
2 changes: 1 addition & 1 deletion src/openapi/spec/feature-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { variantSchema } from './variant-schema';

export const schema = {
type: 'object',
required: ['name', 'enabled', 'impressionData'],
required: ['name', 'enabled'],
additionalProperties: false,
properties: {
name: {
Expand Down
11 changes: 10 additions & 1 deletion src/openapi/spec/variant-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ export const schema = {
enabled: {
type: 'boolean',
},
feature_enabled: {
type: 'boolean',
},
featureEnabled: {
type: 'boolean',
},
payload: {
type: 'object',
additionalProperties: false,
required: ['type', 'value'],
properties: {
type: { type: 'string', enum: ['string', 'json', 'csv'] },
type: {
type: 'string',
enum: ['string', 'json', 'csv', 'number'],
},
value: { type: 'string' },
},
},
Expand Down
23 changes: 21 additions & 2 deletions src/test/__snapshots__/openapi.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ Object {
"enabled": Object {
"type": "boolean",
},
"featureEnabled": Object {
"type": "boolean",
},
"feature_enabled": Object {
"type": "boolean",
},
"name": Object {
"type": "string",
},
Expand All @@ -260,6 +266,7 @@ Object {
"string",
"json",
"csv",
"number",
],
"type": "string",
},
Expand All @@ -284,7 +291,6 @@ Object {
"required": Array [
"name",
"enabled",
"impressionData",
],
"type": "object",
},
Expand All @@ -310,6 +316,12 @@ Object {
"enabled": Object {
"type": "boolean",
},
"featureEnabled": Object {
"type": "boolean",
},
"feature_enabled": Object {
"type": "boolean",
},
"name": Object {
"type": "string",
},
Expand All @@ -321,6 +333,7 @@ Object {
"string",
"json",
"csv",
"number",
],
"type": "string",
},
Expand All @@ -345,7 +358,6 @@ Object {
"required": Array [
"name",
"enabled",
"impressionData",
],
"type": "object",
},
Expand Down Expand Up @@ -563,6 +575,12 @@ Object {
"enabled": Object {
"type": "boolean",
},
"featureEnabled": Object {
"type": "boolean",
},
"feature_enabled": Object {
"type": "boolean",
},
"name": Object {
"type": "string",
},
Expand All @@ -574,6 +592,7 @@ Object {
"string",
"json",
"csv",
"number",
],
"type": "string",
},
Expand Down
5 changes: 3 additions & 2 deletions src/test/unleash.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Context, Unleash, Variant } from 'unleash-client';
import { FeatureInterface } from 'unleash-client/lib/feature';
import { FallbackFunction } from 'unleash-client/lib/helpers';
import { UnleashConfig } from 'unleash-client/lib/unleash';
import { VariantWithFeatureStatus } from 'unleash-client/lib/variant';

class FakeUnleash extends Unleash {
public toggleDefinitions: FeatureInterface[] = [];
Expand Down Expand Up @@ -39,9 +40,9 @@ class FakeUnleash extends Unleash {
name: string,
context?: Context,
fallbackVariant?: Variant,
): Variant {
): VariantWithFeatureStatus {
// console.log(name, context, fallbackVariant);
return { name: 'disabled', enabled: false };
return { name: 'disabled', enabled: false, featureEnabled: false };
}

forceGetVariant(
Expand Down
Loading

0 comments on commit 0cf22b4

Please sign in to comment.