Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@indigov/flags-api

Package Overview
Dependencies
Maintainers
14
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@indigov/flags-api - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

8

dist/index.d.ts

@@ -25,8 +25,8 @@ declare type Env = 'prod' | 'staging' | 'local';

constructor(token: string, office: string, source: Source, { env, traceId, cohort }?: ConstructorOps);
getFlag: (flag: Flag) => Promise<GetFlagResponse>;
getFlags: (flags: Flag[]) => Promise<GetFlagsResponse>;
getFlagValue: (flag: string) => Promise<GetFlagValueResponse>;
getAllFlags: () => Promise<GetAllFlagsResponse>;
getFlag(flag: Flag): Promise<GetFlagResponse>;
getFlags(flags: Flag[]): Promise<GetFlagsResponse>;
getFlagValue(flag: string): Promise<GetFlagValueResponse>;
getAllFlags(): Promise<GetAllFlagsResponse>;
private request;
}
export {};

@@ -17,7 +17,23 @@ "use strict";

this.source = source;
this.getFlag = async (flag) => (await this.request(`flag/${flag}`)).value;
this.getFlags = async (flags) => this.request(`flags?${flags.map((flag) => `&flags=${flag}`).join('')}`).then((_) => _.value);
this.getFlagValue = async (flag) => this.request(`flag/${flag}/raw`).then((_) => _.value);
this.getAllFlags = async () => this.request('flags/all').then((_) => _.value);
this.request = (path) => (0, cross_fetch_1.default)(`${this.endpoint}/${path}`, {
if (!token) {
throw new Error('FLAGS token not provided');
}
this.traceId = traceId;
this.endpoint = Endpoints[env];
this.cohort = cohort;
}
async getFlag(flag) {
return (await this.request(`flag/${flag}`)).value;
}
async getFlags(flags) {
return this.request(`flags?${flags.map((flag) => `&flags=${flag}`).join('')}`).then((_) => _.value);
}
async getFlagValue(flag) {
return this.request(`flag/${flag}/raw`).then((_) => _.value);
}
async getAllFlags() {
return this.request('flags/all').then((_) => _.value);
}
async request(path) {
return (0, cross_fetch_1.default)(`${this.endpoint}/${path}`, {
method: 'GET',

@@ -32,8 +48,2 @@ headers: {

}).then((_) => _.json());
if (!token) {
throw new Error('FLAGS token not provided');
}
this.traceId = traceId;
this.endpoint = Endpoints[env];
this.cohort = cohort;
}

@@ -40,0 +50,0 @@ }

{
"name": "@indigov/flags-api",
"version": "0.0.21",
"version": "0.0.22",
"description": "Strongly typed React/Node client for the Flags service",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -53,3 +53,5 @@ import fetch from 'cross-fetch'

*/
public getFlag = async (flag: Flag): Promise<GetFlagResponse> => (await this.request<GetFlagResponse>(`flag/${flag}`)).value
public async getFlag(flag: Flag): Promise<GetFlagResponse> {
return (await this.request<GetFlagResponse>(`flag/${flag}`)).value
}

@@ -60,4 +62,5 @@ /**

*/
public getFlags = async (flags: Flag[]): Promise<GetFlagsResponse> =>
this.request<GetFlagsResponse>(`flags?${flags.map((flag) => `&flags=${flag}`).join('')}`).then((_) => _.value)
public async getFlags(flags: Flag[]): Promise<GetFlagsResponse> {
return this.request<GetFlagsResponse>(`flags?${flags.map((flag) => `&flags=${flag}`).join('')}`).then((_) => _.value)
}

@@ -67,3 +70,5 @@ /**

*/
public getFlagValue = async (flag: string): Promise<GetFlagValueResponse> => this.request<GetFlagValueResponse>(`flag/${flag}/raw`).then((_) => _.value)
public async getFlagValue(flag: string): Promise<GetFlagValueResponse> {
return this.request<GetFlagValueResponse>(`flag/${flag}/raw`).then((_) => _.value)
}

@@ -73,6 +78,8 @@ /**

*/
public getAllFlags = async (): Promise<GetAllFlagsResponse> => this.request<GetAllFlagsResponse>('flags/all').then((_) => _.value)
public async getAllFlags(): Promise<GetAllFlagsResponse> {
return this.request<GetAllFlagsResponse>('flags/all').then((_) => _.value)
}
private request = <T>(path: string): Promise<{ value: T }> =>
fetch(`${this.endpoint}/${path}`, {
private async request<T>(path: string): Promise<{ value: T }> {
return fetch(`${this.endpoint}/${path}`, {
method: 'GET',

@@ -87,2 +94,3 @@ headers: {

}).then((_) => _.json())
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc