@types/rox-browser
Advanced tools
Comparing version 4.8.3 to 5.0.0
@@ -1,4 +0,5 @@ | ||
// Type definitions for rox-browser 4.8 | ||
// Type definitions for rox-browser 5.0 | ||
// Project: https://rollout.io | ||
// Definitions by: g-guirado <https://github.com/g-guirado> | ||
// AsafRollout: <https://github.com/asafRollout> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -10,3 +11,3 @@ // TypeScript Version: 3.0 | ||
* Official documentation for rox-browser is available here: | ||
* https://support.rollout.io/docs/javascript-browser-api | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api | ||
* | ||
@@ -16,3 +17,3 @@ */ | ||
export interface RoxContainer { | ||
[key: string]: Flag | Configuration<any> | Variant; | ||
[key: string]: Flag | RoxNumber | RoxString; | ||
} | ||
@@ -23,6 +24,8 @@ | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section-register | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_register | ||
*/ | ||
export function register(namespace: string, roxContainer: RoxContainer): void; | ||
export function register(roxContainer: RoxContainer): void; | ||
/** | ||
@@ -32,3 +35,3 @@ * Set Global Context. | ||
* | ||
* https://support.rollout.io/docs/context#section-global-context | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties#_global_context | ||
*/ | ||
@@ -41,3 +44,3 @@ export function setContext(globalContext: unknown): void; | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section-setup | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_setup | ||
*/ | ||
@@ -48,7 +51,7 @@ export function setup(apiKey: string, options?: RoxSetupOptions): Promise<unknown>; | ||
version?: string; | ||
// https://support.rollout.io/docs/javascript-browser-api#section-configurationfetchedhandler | ||
// https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_configurationfetchedhandler | ||
configurationFetchedHandler?(fetcherResult: RoxFetcherResult): void; | ||
debugLevel?: 'verbose'; | ||
// https://support.rollout.io/docs/javascript-browser-api#section-using-the-impressionhandler-option | ||
impressionHandler?(reporting: RoxReporting, experiment: RoxExperiment, context: unknown): void; | ||
// https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_using_the_impressionhandler_option | ||
impressionHandler?(reporting: RoxReporting, context: unknown): void; | ||
platform?: string; | ||
@@ -61,5 +64,7 @@ freeze?: RoxFlagFreezeLevel; | ||
* | ||
* https://support.rollout.io/docs/microservices-automated-testing-and-local-development | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/debugging/microservices-automated-testing-and-local-development | ||
*/ | ||
roxy?: string; | ||
// https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_dynamicpropertyrulehandler | ||
dynamicPropertyRuleHandler?(propName: string, context: any): any; | ||
} | ||
@@ -74,2 +79,9 @@ | ||
export enum RoxErrorTrigger { | ||
DYNAMIC_PROPERTIES_RULE = 'DYNAMIC_PROPERTIES_RULE', | ||
CONFIGURATION_FETCHED_HANDLER = 'CONFIGURATION_FETCHED_HANDLER', | ||
IMPRESSION_HANDLER = 'IMPRESSION_HANDLER', | ||
CUSTOM_PROPERTY_GENERATOR = 'CUSTOM_PROPERTY_GENERATOR' | ||
} | ||
export interface RoxFetcherResult { | ||
@@ -85,14 +97,8 @@ fetcherStatus: RoxFetcherStatus; | ||
value: string; | ||
targeting: boolean; | ||
} | ||
export interface RoxExperiment { | ||
identifier: string; // experiment id | ||
name: string; | ||
isArchived: boolean; | ||
labels: string[]; // experiment's labels. assigned from dashboard | ||
} | ||
/** | ||
* Note that you might have to call unfreeze after setting custom properties such as email after login | ||
* https://support.rollout.io/docs/custom-properties | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-releases/custom-properties | ||
*/ | ||
@@ -102,4 +108,6 @@ export function setCustomNumberProperty(name: string, value: number | ((context?: unknown) => number)): void; | ||
export function setCustomBooleanProperty(name: string, value: boolean | ((context?: unknown) => boolean)): void; | ||
export function setDynamicCustomPropertyRule( | ||
handler: (propName: string, context: unknown) => number | string | boolean | ||
// https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_setuserspaceunhandlederrorhandler | ||
export function setUserspaceUnhandledErrorHandler( | ||
handler: (errorTrigger: RoxErrorTrigger, error: Error) => void | ||
): void; | ||
@@ -111,4 +119,4 @@ | ||
* | ||
* https://support.rollout.io/docs/flags-update-flow#section-flag-unfreeze | ||
* https://support.rollout.io/docs/javascript-browser-api#section-unfreeze | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-flags/flag-freeze#_flag_unfreeze | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_unfreeze_4 | ||
*/ | ||
@@ -120,3 +128,3 @@ export function unfreeze(namespace?: string): void; | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section-fetch | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_fetch | ||
*/ | ||
@@ -127,3 +135,3 @@ export function fetch(): void; | ||
* Opens the flag override view, providing a debug UI for the application's set of feature flags. | ||
* https://support.rollout.io/docs/javascript-browser-api#section-showoverrides | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_showoverrides | ||
*/ | ||
@@ -140,5 +148,5 @@ export function showOverrides(position?: RoxOverridesPosition): void; | ||
/** | ||
* Default is untilForeground | ||
* Default is none | ||
* | ||
* https://support.rollout.io/docs/flags-update-flow#section-flag-freeze-level | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags/latest/feature-flags/flag-freeze | ||
*/ | ||
@@ -157,3 +165,3 @@ export enum RoxFlagFreezeLevel { | ||
* Creates a new Flag | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-flag- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_flag | ||
*/ | ||
@@ -177,19 +185,19 @@ export class Flag { | ||
/** | ||
* Used to create and manage Rollout feature flags that determine different predefined values | ||
* Used to create and manage Rollout feature flags that determine different predefined string values | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-variant- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_roxstring | ||
*/ | ||
export class Variant<T extends string = string> { | ||
constructor(defaultValue: T, options: ReadonlyArray<T>, name?: string); | ||
export class RoxString { | ||
constructor(defaultValue: string, options?: ReadonlyArray<string>); | ||
// The name of the Variant | ||
// The name of the RoxString | ||
readonly name: string; | ||
// Default value of the Variant | ||
readonly defaultValue: BasicType<T>; | ||
// Default value of the RoxString | ||
readonly defaultValue: string; | ||
// Returns the current value of the Variant, accounting for value overrides | ||
getValue(context?: unknown): BasicType<T>; | ||
// Returns the current value of the RoxString, accounting for value overrides | ||
getValue(context?: unknown): string; | ||
// Unlock the Variant value from changes from the last time it was freezed | ||
// Unlock the RoxString value from changes from the last time it was freezed | ||
unfreeze(): void; | ||
@@ -199,20 +207,19 @@ } | ||
/** | ||
* manages a remote configuration setting with a value of type string, boolean, or number. | ||
* The constructor sets the default value for the remote configuration setting | ||
* Used to create and manage Rollout feature flags that determine different predefined number values | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-configuration- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_roxnumber | ||
*/ | ||
export class Configuration<T extends number | boolean | string> { | ||
constructor(defaultValue: T); | ||
export class RoxNumber { | ||
constructor(defaultValue: number, options?: ReadonlyArray<number>); | ||
// The name of the Configuration | ||
// The name of the RoxNumber | ||
readonly name: string; | ||
// Default value of the Configuration | ||
readonly defaultValue: BasicType<T>; | ||
// Default value of the RoxNumber | ||
readonly defaultValue: number; | ||
// Returns the current value of the Configuration, accounting for value overrides | ||
getValue(context?: unknown): BasicType<T>; | ||
// Returns the current value of the RoxNumber, accounting for value overrides | ||
getValue(context?: unknown): number; | ||
// Unlock the Configuration value from changes from the last time it was freezed | ||
// Unlock the RoxNumber value from changes from the last time it was freezed | ||
unfreeze(): void; | ||
@@ -222,8 +229,2 @@ } | ||
/** | ||
* Ensure that TypeScript properly types things with a basic type. | ||
* For example, if T is true, returnedtype shall be boolean, not true | ||
*/ | ||
export type BasicType<T> = T extends boolean ? boolean : T extends number ? number : T extends string ? string : never; | ||
/** | ||
* Override: Should only be used for development purposes (QA - Feature dev - e2e) | ||
@@ -237,3 +238,3 @@ * | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_overrides | ||
*/ | ||
@@ -247,3 +248,3 @@ export namespace overrides { | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides-setoverride- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_overrides_setoverride | ||
* | ||
@@ -257,3 +258,3 @@ * Note that for boolean flag we still give the value as a string. | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides-clearoverride- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_overrides_clearoverride | ||
*/ | ||
@@ -272,3 +273,3 @@ function clearOverride(nameSpacedFlagName: string): void; | ||
* | ||
* https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides-hasoverride- | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_overrides_hasoverride | ||
*/ | ||
@@ -281,3 +282,3 @@ function hasOverride(nameSpacedFlagName: string): boolean; | ||
* different container objects and accessing them from that container object. | ||
* https://support.rollout.io/docs/dynamic-api | ||
* https://docs.cloudbees.com/docs/cloudbees-feature-flags-api/latest/api-reference/javascript-browser-api#_rox_dynamicapi | ||
*/ | ||
@@ -291,7 +292,12 @@ export namespace dynamicApi { | ||
/** | ||
* Getting string value of a Variant flag | ||
* Getting string value of a string flag | ||
*/ | ||
function value(nameSpacedFlagName: string, defaultValue: string, context?: unknown): string; | ||
/** | ||
* Getting string value of a number flag | ||
*/ | ||
function getNumber(nameSpacedFlagName: string, defaultValue: number, context?: unknown): number; | ||
} | ||
export const flags: ReadonlyArray<Flag>; |
{ | ||
"name": "@types/rox-browser", | ||
"version": "4.8.3", | ||
"version": "5.0.0", | ||
"description": "TypeScript definitions for rox-browser", | ||
@@ -11,2 +11,7 @@ "license": "MIT", | ||
"githubUsername": "g-guirado" | ||
}, | ||
{ | ||
"name": "AsafRollout:", | ||
"url": "https://github.com/asafRollout", | ||
"githubUsername": "asafRollout" | ||
} | ||
@@ -23,4 +28,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "14605abd2d3c32d84fc459842e5326125d2d1e741434fa68c63b6c92264149f2", | ||
"typeScriptVersion": "3.0" | ||
"typesPublisherContentHash": "5d19cb5c56920601700580ea9a8b9bfa918b40dbe27a0c79bf59525d16112bb1", | ||
"typeScriptVersion": "3.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 03 Dec 2019 02:46:28 GMT | ||
* Last updated: Tue, 08 Dec 2020 00:49:03 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by g-guirado (https://github.com/g-guirado). | ||
These definitions were written by [g-guirado](https://github.com/g-guirado), and [AsafRollout:](https://github.com/asafRollout). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12755
236