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

@mozilla/nimbus-shared

Package Overview
Dependencies
Maintainers
8
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mozilla/nimbus-shared - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

LICENSE

23

CHANGELOG.md
# Changelog
## Version 0.0.6
### Content Changes
- Add count to AA preset ([#69](https://github.com/mozilla/nimbus-shared/pull/69))
- Add Proposed duration to Experiment ([#68](https://github.com/mozilla/nimbus-shared/pull/68))
- Add Firefox channel to audiences ([#60](https://github.com/mozilla/nimbus-shared/pull/60))
- Add filter_expression and targeting to AA preset fixes
([#73](https://github.com/mozilla/nimbus-shared/pull/73))
- Compatibility of messaging schema with Mozilla-Central
### Library Changes
- Show schemas and data in docs ([#70](https://github.com/mozilla/nimbus-shared/pull/70))
- Add heading links to docs ([#70](https://github.com/mozilla/nimbus-shared/pull/70))
- Docs are compatible with more browsers ([#78](https://github.com/mozilla/nimbus-shared/pull/78))
### Minor changes
- Format with Prettier ([#67](https://github.com/mozilla/nimbus-shared/pull/67))
- Automatic publishing of the library ([#82](https://github.com/mozilla/nimbus-shared/pull/82),
[#84](https://github.com/mozilla/nimbus-shared/pull/84))
## Version 0.0.5

@@ -4,0 +27,0 @@

45

dist/data.json

@@ -7,3 +7,4 @@ {

"targeting": "localeLanguageCode == 'en' && browserSettings.update.channel == 'release'",
"desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'"
"desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'",
"firefox_channel": "Release"
},

@@ -14,3 +15,4 @@ "us_only": {

"targeting": "localeLanguageCode == 'en' && region == 'US' && browserSettings.update.channel == 'release'",
"desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'"
"desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'",
"firefox_channel": "Release"
},

@@ -21,3 +23,4 @@ "first_run": {

"targeting": "localeLanguageCode == 'en' && (isFirstStartup || currentExperiment.slug in activeExperiments) && browserSettings.update.channel == 'release'",
"desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'"
"desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'",
"firefox_channel": "Release"
}

@@ -30,17 +33,24 @@ },

"preset": {
"branches": [
{
"slug": "control",
"ratio": 1,
"value": null
},
{
"slug": "treatment",
"ratio": 1,
"value": null
"filter_expression": "env.version|versionCompare('{minFirefoxVersion}') >= 0",
"targeting": "[{randomizationUnit}, \"{bucketNamespace}\"]|bucketSample({bucketStart}, {bucketCount}, {bucketTotal}) && {audienceTargeting}",
"arguments": {
"proposedDuration": 28,
"proposedEnrollment": 7,
"branches": [
{
"slug": "control",
"ratio": 1,
"value": null
},
{
"slug": "treatment",
"ratio": 1,
"value": null
}
],
"bucketConfig": {
"randomizationUnit": "userId",
"count": 100,
"total": 10000
}
],
"bucketConfig": {
"randomizationUnit": "normandy_id",
"total": 10000
}

@@ -70,2 +80,3 @@ }

"endDate": null,
"proposedDuration": 28,
"proposedEnrollment": 7,

@@ -72,0 +83,0 @@ "referenceBranch": "control",

@@ -8,3 +8,4 @@ "use strict";

targeting: "localeLanguageCode == 'en' && browserSettings.update.channel == 'release'",
desktop_telemetry: "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'"
desktop_telemetry: "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'",
firefox_channel: "Release",
},

@@ -15,3 +16,4 @@ us_only: {

targeting: "localeLanguageCode == 'en' && region == 'US' && browserSettings.update.channel == 'release'",
desktop_telemetry: "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'"
desktop_telemetry: "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'",
firefox_channel: "Release",
},

@@ -22,5 +24,6 @@ first_run: {

targeting: "localeLanguageCode == 'en' && (isFirstStartup || currentExperiment.slug in activeExperiments) && browserSettings.update.channel == 'release'",
desktop_telemetry: "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'"
}
desktop_telemetry: "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'",
firefox_channel: "Release",
},
};
exports.default = audiences;

@@ -1,2 +0,2 @@

import { ExperimentDesign } from "../types/experiments";
import { ExperimentRecipe } from "../types/experiments";
declare type RecursivePartial<T> = {

@@ -13,4 +13,4 @@ [P in keyof T]?: T[P] extends Array<infer U> ? Array<RecursivePartial<U>> : T[P] extends {

declare const presets: {
[id: string]: Preset<ExperimentDesign>;
[id: string]: Preset<ExperimentRecipe>;
};
export default presets;

@@ -8,13 +8,20 @@ "use strict";

preset: {
branches: [
{ slug: "control", ratio: 1, value: null },
{ slug: "treatment", ratio: 1, value: null }
],
bucketConfig: {
randomizationUnit: "normandy_id",
total: 10000
}
}
}
filter_expression: "env.version|versionCompare('{minFirefoxVersion}') >= 0",
targeting: '[{randomizationUnit}, "{bucketNamespace}"]|bucketSample({bucketStart}, {bucketCount}, {bucketTotal}) && {audienceTargeting}',
arguments: {
proposedDuration: 28,
proposedEnrollment: 7,
branches: [
{ slug: "control", ratio: 1, value: null },
{ slug: "treatment", ratio: 1, value: null },
],
bucketConfig: {
randomizationUnit: "userId",
count: 100,
total: 10000,
},
},
},
},
};
exports.default = presets;

@@ -8,2 +8,3 @@ export declare const data: {

desktop_telemetry: string;
firefox_channel: string;
};

@@ -15,2 +16,3 @@ us_only: {

desktop_telemetry: string;
firefox_channel: string;
};

@@ -22,2 +24,3 @@ first_run: {

desktop_telemetry: string;
firefox_channel: string;
};

@@ -30,10 +33,17 @@ };

preset: {
branches: {
slug: string;
ratio: number;
value: null;
}[];
bucketConfig: {
randomizationUnit: string;
total: number;
filter_expression: string;
targeting: string;
arguments: {
proposedDuration: number;
proposedEnrollment: number;
branches: {
slug: string;
ratio: number;
value: null;
}[];
bucketConfig: {
randomizationUnit: string;
count: number;
total: number;
};
};

@@ -63,2 +73,3 @@ };

endDate: null;
proposedDuration: number;
proposedEnrollment: number;

@@ -65,0 +76,0 @@ referenceBranch: string;

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

"all_english": {
"name": "All English users (release)", "description": "All users in en-* locales using the release channel.", "targeting": "localeLanguageCode == 'en' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'"
"name": "All English users (release)", "description": "All users in en-* locales using the release channel.", "targeting": "localeLanguageCode == 'en' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'", "firefox_channel": "Release"
}, "us_only": {
"name": "US users (en; release)", "description": "All users in the US with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && region == 'US' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'"
"name": "US users (en; release)", "description": "All users in the US with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && region == 'US' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'", "firefox_channel": "Release"
}, "first_run": {
"name": "First start-up users (en; release)", "description": "First start-up users (e.g. for about:welcome) with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && (isFirstStartup || currentExperiment.slug in activeExperiments) && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'"
"name": "First start-up users (en; release)", "description": "First start-up users (e.g. for about:welcome) with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && (isFirstStartup || currentExperiment.slug in activeExperiments) && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'", "firefox_channel": "Release"
}

@@ -17,10 +17,12 @@ }, "ExperimentDesignPresets": {

"name": "A/A Experiment", "description": "A design for diagnostic testing of targeting or enrollment. Fixed to 1% of the population.", "preset": {
"branches": [
{
"slug": "control", "ratio": 1, "value": null
}, {
"slug": "treatment", "ratio": 1, "value": null
"filter_expression": "env.version|versionCompare('{minFirefoxVersion}') >= 0", "targeting": "[{randomizationUnit}, \"{bucketNamespace}\"]|bucketSample({bucketStart}, {bucketCount}, {bucketTotal}) && {audienceTargeting}", "arguments": {
"proposedDuration": 28, "proposedEnrollment": 7, "branches": [
{
"slug": "control", "ratio": 1, "value": null
}, {
"slug": "treatment", "ratio": 1, "value": null
}
], "bucketConfig": {
"randomizationUnit": "userId", "count": 100, "total": 10000
}
], "bucketConfig": {
"randomizationUnit": "normandy_id", "total": 10000
}

@@ -34,3 +36,3 @@ }

"randomizationUnit": "normandy_id", "namespace": "bug-1637316-message-aboutwelcome-pull-factor-reinforcement-76-rel-release-76-77", "start": 0, "count": 2000, "total": 10000
}, "startDate": "2020-06-17T23:20:47.230Z", "endDate": null, "proposedEnrollment": 7, "referenceBranch": "control", "features": [], "branches": [
}, "startDate": "2020-06-17T23:20:47.230Z", "endDate": null, "proposedDuration": 28, "proposedEnrollment": 7, "referenceBranch": "control", "features": [], "branches": [
{

@@ -37,0 +39,0 @@ "slug": "control", "ratio": 1, "value": {}

import { SchemaResult } from "../typeGuards";
import type { Experiment, EmptyAAExperiment, ExperimentRecipe, ExperimentDesign } from "../../types/experiments";
import type { Experiment, ExperimentRecipe } from "../../types/experiments";
import type { Feature } from "../../types/features";
import type { FoodColors } from "../../types/test";
import type { Audience } from "../../types/targeting";
import type { SimpleCFRMessage } from "../../types/messaging";
import type { SimpleCFRMessage, TriggerActionSchemas, SpecialMessageActionSchemas } from "../../types/messaging";
import type { PreferenceRolloutArguments, MessagingExperimentArguments, AddonRollbackArguments, ConsoleLogArguments, ShowHeartbeatArguments, OptOutStudyArguments, NormandyRecipe, PreferenceExperimentArguments, PreferenceRollbackArguments, BranchedAddonStudyArguments, MultiPreferenceExperimentArguments, AddonRolloutArguments } from "../../types/normandy";

@@ -11,11 +11,5 @@ export declare function experiments_isExperiment(obj: object): obj is Experiment;

export declare function experiments_assertExperiment(obj: object): asserts obj is Experiment;
export declare function experiments_isEmptyAAExperiment(obj: object): obj is EmptyAAExperiment;
export declare function experiments_checkEmptyAAExperiment(obj: object): SchemaResult;
export declare function experiments_assertEmptyAAExperiment(obj: object): asserts obj is EmptyAAExperiment;
export declare function experiments_isExperimentRecipe(obj: object): obj is ExperimentRecipe;
export declare function experiments_checkExperimentRecipe(obj: object): SchemaResult;
export declare function experiments_assertExperimentRecipe(obj: object): asserts obj is ExperimentRecipe;
export declare function experiments_isExperimentDesign(obj: object): obj is ExperimentDesign;
export declare function experiments_checkExperimentDesign(obj: object): SchemaResult;
export declare function experiments_assertExperimentDesign(obj: object): asserts obj is ExperimentDesign;
export declare function features_isFeature(obj: object): obj is Feature;

@@ -33,2 +27,8 @@ export declare function features_checkFeature(obj: object): SchemaResult;

export declare function messaging_assertSimpleCFRMessage(obj: object): asserts obj is SimpleCFRMessage;
export declare function messaging_isTriggerActionSchemas(obj: object): obj is TriggerActionSchemas;
export declare function messaging_checkTriggerActionSchemas(obj: object): SchemaResult;
export declare function messaging_assertTriggerActionSchemas(obj: object): asserts obj is TriggerActionSchemas;
export declare function messaging_isSpecialMessageActionSchemas(obj: object): obj is SpecialMessageActionSchemas;
export declare function messaging_checkSpecialMessageActionSchemas(obj: object): SchemaResult;
export declare function messaging_assertSpecialMessageActionSchemas(obj: object): asserts obj is SpecialMessageActionSchemas;
export declare function normandy_isPreferenceRolloutArguments(obj: object): obj is PreferenceRolloutArguments;

@@ -35,0 +35,0 @@ export declare function normandy_checkPreferenceRolloutArguments(obj: object): SchemaResult;

"use strict";
/* eslint-disable @typescript-eslint/ban-types */
Object.defineProperty(exports, "__esModule", { value: true });
exports.normandy_assertAddonRolloutArguments = exports.normandy_checkAddonRolloutArguments = exports.normandy_isAddonRolloutArguments = exports.normandy_assertMultiPreferenceExperimentArguments = exports.normandy_checkMultiPreferenceExperimentArguments = exports.normandy_isMultiPreferenceExperimentArguments = exports.normandy_assertBranchedAddonStudyArguments = exports.normandy_checkBranchedAddonStudyArguments = exports.normandy_isBranchedAddonStudyArguments = exports.normandy_assertPreferenceRollbackArguments = exports.normandy_checkPreferenceRollbackArguments = exports.normandy_isPreferenceRollbackArguments = exports.normandy_assertPreferenceExperimentArguments = exports.normandy_checkPreferenceExperimentArguments = exports.normandy_isPreferenceExperimentArguments = exports.normandy_assertNormandyRecipe = exports.normandy_checkNormandyRecipe = exports.normandy_isNormandyRecipe = exports.normandy_assertOptOutStudyArguments = exports.normandy_checkOptOutStudyArguments = exports.normandy_isOptOutStudyArguments = exports.normandy_assertShowHeartbeatArguments = exports.normandy_checkShowHeartbeatArguments = exports.normandy_isShowHeartbeatArguments = exports.normandy_assertConsoleLogArguments = exports.normandy_checkConsoleLogArguments = exports.normandy_isConsoleLogArguments = exports.normandy_assertAddonRollbackArguments = exports.normandy_checkAddonRollbackArguments = exports.normandy_isAddonRollbackArguments = exports.normandy_assertMessagingExperimentArguments = exports.normandy_checkMessagingExperimentArguments = exports.normandy_isMessagingExperimentArguments = exports.normandy_assertPreferenceRolloutArguments = exports.normandy_checkPreferenceRolloutArguments = exports.normandy_isPreferenceRolloutArguments = exports.messaging_assertSimpleCFRMessage = exports.messaging_checkSimpleCFRMessage = exports.messaging_isSimpleCFRMessage = exports.targeting_assertAudience = exports.targeting_checkAudience = exports.targeting_isAudience = exports.test_assertFoodColors = exports.test_checkFoodColors = exports.test_isFoodColors = exports.features_assertFeature = exports.features_checkFeature = exports.features_isFeature = exports.experiments_assertExperimentDesign = exports.experiments_checkExperimentDesign = exports.experiments_isExperimentDesign = exports.experiments_assertExperimentRecipe = exports.experiments_checkExperimentRecipe = exports.experiments_isExperimentRecipe = exports.experiments_assertEmptyAAExperiment = exports.experiments_checkEmptyAAExperiment = exports.experiments_isEmptyAAExperiment = exports.experiments_assertExperiment = exports.experiments_checkExperiment = exports.experiments_isExperiment = void 0;
exports.normandy_assertAddonRolloutArguments = exports.normandy_checkAddonRolloutArguments = exports.normandy_isAddonRolloutArguments = exports.normandy_assertMultiPreferenceExperimentArguments = exports.normandy_checkMultiPreferenceExperimentArguments = exports.normandy_isMultiPreferenceExperimentArguments = exports.normandy_assertBranchedAddonStudyArguments = exports.normandy_checkBranchedAddonStudyArguments = exports.normandy_isBranchedAddonStudyArguments = exports.normandy_assertPreferenceRollbackArguments = exports.normandy_checkPreferenceRollbackArguments = exports.normandy_isPreferenceRollbackArguments = exports.normandy_assertPreferenceExperimentArguments = exports.normandy_checkPreferenceExperimentArguments = exports.normandy_isPreferenceExperimentArguments = exports.normandy_assertNormandyRecipe = exports.normandy_checkNormandyRecipe = exports.normandy_isNormandyRecipe = exports.normandy_assertOptOutStudyArguments = exports.normandy_checkOptOutStudyArguments = exports.normandy_isOptOutStudyArguments = exports.normandy_assertShowHeartbeatArguments = exports.normandy_checkShowHeartbeatArguments = exports.normandy_isShowHeartbeatArguments = exports.normandy_assertConsoleLogArguments = exports.normandy_checkConsoleLogArguments = exports.normandy_isConsoleLogArguments = exports.normandy_assertAddonRollbackArguments = exports.normandy_checkAddonRollbackArguments = exports.normandy_isAddonRollbackArguments = exports.normandy_assertMessagingExperimentArguments = exports.normandy_checkMessagingExperimentArguments = exports.normandy_isMessagingExperimentArguments = exports.normandy_assertPreferenceRolloutArguments = exports.normandy_checkPreferenceRolloutArguments = exports.normandy_isPreferenceRolloutArguments = exports.messaging_assertSpecialMessageActionSchemas = exports.messaging_checkSpecialMessageActionSchemas = exports.messaging_isSpecialMessageActionSchemas = exports.messaging_assertTriggerActionSchemas = exports.messaging_checkTriggerActionSchemas = exports.messaging_isTriggerActionSchemas = exports.messaging_assertSimpleCFRMessage = exports.messaging_checkSimpleCFRMessage = exports.messaging_isSimpleCFRMessage = exports.targeting_assertAudience = exports.targeting_checkAudience = exports.targeting_isAudience = exports.test_assertFoodColors = exports.test_checkFoodColors = exports.test_isFoodColors = exports.features_assertFeature = exports.features_checkFeature = exports.features_isFeature = exports.experiments_assertExperimentRecipe = exports.experiments_checkExperimentRecipe = exports.experiments_isExperimentRecipe = exports.experiments_assertExperiment = exports.experiments_checkExperiment = exports.experiments_isExperiment = void 0;
const typeGuards_1 = require("../typeGuards");

@@ -12,8 +12,2 @@ function experiments_isExperiment(obj) { return typeGuards_1.isSchema("experiments/Experiment", obj); }

exports.experiments_assertExperiment = experiments_assertExperiment;
function experiments_isEmptyAAExperiment(obj) { return typeGuards_1.isSchema("experiments/EmptyAAExperiment", obj); }
exports.experiments_isEmptyAAExperiment = experiments_isEmptyAAExperiment;
function experiments_checkEmptyAAExperiment(obj) { return typeGuards_1.checkSchema("experiments/EmptyAAExperiment", obj); }
exports.experiments_checkEmptyAAExperiment = experiments_checkEmptyAAExperiment;
function experiments_assertEmptyAAExperiment(obj) { return typeGuards_1.assertSchema("experiments/EmptyAAExperiment", obj); }
exports.experiments_assertEmptyAAExperiment = experiments_assertEmptyAAExperiment;
function experiments_isExperimentRecipe(obj) { return typeGuards_1.isSchema("experiments/ExperimentRecipe", obj); }

@@ -25,8 +19,2 @@ exports.experiments_isExperimentRecipe = experiments_isExperimentRecipe;

exports.experiments_assertExperimentRecipe = experiments_assertExperimentRecipe;
function experiments_isExperimentDesign(obj) { return typeGuards_1.isSchema("experiments/ExperimentDesign", obj); }
exports.experiments_isExperimentDesign = experiments_isExperimentDesign;
function experiments_checkExperimentDesign(obj) { return typeGuards_1.checkSchema("experiments/ExperimentDesign", obj); }
exports.experiments_checkExperimentDesign = experiments_checkExperimentDesign;
function experiments_assertExperimentDesign(obj) { return typeGuards_1.assertSchema("experiments/ExperimentDesign", obj); }
exports.experiments_assertExperimentDesign = experiments_assertExperimentDesign;
function features_isFeature(obj) { return typeGuards_1.isSchema("features/Feature", obj); }

@@ -56,2 +44,14 @@ exports.features_isFeature = features_isFeature;

exports.messaging_assertSimpleCFRMessage = messaging_assertSimpleCFRMessage;
function messaging_isTriggerActionSchemas(obj) { return typeGuards_1.isSchema("messaging/TriggerActionSchemas", obj); }
exports.messaging_isTriggerActionSchemas = messaging_isTriggerActionSchemas;
function messaging_checkTriggerActionSchemas(obj) { return typeGuards_1.checkSchema("messaging/TriggerActionSchemas", obj); }
exports.messaging_checkTriggerActionSchemas = messaging_checkTriggerActionSchemas;
function messaging_assertTriggerActionSchemas(obj) { return typeGuards_1.assertSchema("messaging/TriggerActionSchemas", obj); }
exports.messaging_assertTriggerActionSchemas = messaging_assertTriggerActionSchemas;
function messaging_isSpecialMessageActionSchemas(obj) { return typeGuards_1.isSchema("messaging/SpecialMessageActionSchemas", obj); }
exports.messaging_isSpecialMessageActionSchemas = messaging_isSpecialMessageActionSchemas;
function messaging_checkSpecialMessageActionSchemas(obj) { return typeGuards_1.checkSchema("messaging/SpecialMessageActionSchemas", obj); }
exports.messaging_checkSpecialMessageActionSchemas = messaging_checkSpecialMessageActionSchemas;
function messaging_assertSpecialMessageActionSchemas(obj) { return typeGuards_1.assertSchema("messaging/SpecialMessageActionSchemas", obj); }
exports.messaging_assertSpecialMessageActionSchemas = messaging_assertSpecialMessageActionSchemas;
function normandy_isPreferenceRolloutArguments(obj) { return typeGuards_1.isSchema("normandy/PreferenceRolloutArguments", obj); }

@@ -58,0 +58,0 @@ exports.normandy_isPreferenceRolloutArguments = normandy_isPreferenceRolloutArguments;

@@ -46,2 +46,4 @@ /**

endDate: string | null;
/** Duration of the experiment from the start date in days */
proposedDuration: number;
/** Duration of enrollment from the start date in days */

@@ -57,3 +59,3 @@ proposedEnrollment: number;

*/
randomizationUnit: "client_id" | "normandy_id";
randomizationUnit: "client_id" | "normandy_id" | "userId";
/** Additional inputs to the hashing function */

@@ -89,19 +91,2 @@ namespace: string;

}
/**
* Preset types
* */
export declare type ExperimentDesign = EmptyAAExperiment;
/**
* An empty experiment that can target a maximum of 1% of the population
*/
export interface EmptyAAExperiment extends Experiment {
branches: Array<EmptyBranch>;
bucketConfig: AABucketConfig;
}
interface AABucketConfig extends BucketConfig {
total: 10000;
}
interface EmptyBranch extends Branch {
value: null;
}
export {};

@@ -20,3 +20,3 @@ declare type FluentId = {

} | FluentId;
action: SpecialMessagingAction;
action: SpecialMessageActionSchemas;
}

@@ -55,3 +55,3 @@ interface SimpleCFRContent {

targeting?: string;
trigger?: TriggerAction;
trigger?: TriggerActionSchemas;
/** If more than one message is valid, the message with the higher priority will be shown */

@@ -81,5 +81,5 @@ priority?: number;

template: "cfr_doorhanger";
trigger: TriggerAction;
trigger: TriggerActionSchemas;
}
declare type TriggerAction = OpenUrl | OpenArticleUrl | OpenBookmarkedUrl | FrequentVisits | NewSavedLogin | ContentBlocking;
export declare type TriggerActionSchemas = OpenUrl | OpenArticleUrl | OpenBookmarkedUrl | FrequentVisits | NewSavedLogin | ContentBlocking;
/** List of urls we should match against */

@@ -117,5 +117,5 @@ declare type UrlParams = Array<string>;

id: "contentBlocking";
params: Array<number>;
params: Array<number> | Array<string>;
}
declare type SpecialMessagingAction = DisableSTPDoorhangers | HighlightFeature | InstallAddonFromURL | OpenAboutPage | OpenApplicationsMenu | OpenAwesomeBar | OpenPreferencesPage | OpenPrivateBrowserWindow | OpenProtectionPanel | OpenProtectionReport | OpenUrlAction | PinCurrentTab | ShowFirefoxAccounts | ShowMigrationWizard | Minimize;
export declare type SpecialMessageActionSchemas = DisableSTPDoorhangers | HighlightFeature | InstallAddonFromURL | OpenAboutPage | OpenApplicationsMenu | OpenAwesomeBar | OpenPreferencesPage | OpenPrivateBrowserWindow | OpenProtectionPanel | OpenProtectionReport | OpenUrlAction | PinCurrentTab | ShowFirefoxAccounts | ShowMigrationWizard | Minimize | AcceptDoH | DisableDoH;
/** Disables all STP doorhangers. */

@@ -175,3 +175,3 @@ interface DisableSTPDoorhangers {

/** Add a queryparam for metrics */
entrypoint: string;
entrypoint?: string;
};

@@ -226,2 +226,10 @@ type: "OPEN_PREFERENCES_PAGE";

}
/** Accept DOH doorhanger notification */
interface AcceptDoH {
type: "ACCEPT_DOH";
}
/** Dismiss DOH doorhanger notification */
interface DisableDoH {
type: "DISABLE_DOH";
}
export {};

@@ -12,2 +12,3 @@ export interface Audience {

desktop_telemetry?: string;
firefox_channel: "Nightly" | "Beta" | "Release";
}
{
"name": "@mozilla/nimbus-shared",
"version": "0.0.5",
"version": "0.0.6",
"license": "MPL-2.0",

@@ -29,2 +29,3 @@ "engines": {

"eslint": "^7.1.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-react": "^7.20.3",

@@ -34,2 +35,3 @@ "mocha": "^7.2.0",

"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"ts-json-schema-generator": "^0.68.0",

@@ -36,0 +38,0 @@ "ts-node": "^8.10.1",

@@ -35,3 +35,4 @@ {

"client_id",
"normandy_id"
"normandy_id",
"userId"
],

@@ -136,2 +137,6 @@ "description": "The randomization unit. Note that client_id is not yet implemented.",

},
"proposedDuration": {
"type": "number",
"description": "Duration of the experiment from the start date in days"
},
"proposedEnrollment": {

@@ -160,2 +165,3 @@ "type": "number",

"endDate",
"proposedDuration",
"proposedEnrollment",

@@ -162,0 +168,0 @@ "referenceBranch"

@@ -68,3 +68,4 @@ {

"client_id",
"normandy_id"
"normandy_id",
"userId"
],

@@ -169,2 +170,6 @@ "description": "The randomization unit. Note that client_id is not yet implemented.",

},
"proposedDuration": {
"type": "number",
"description": "Duration of the experiment from the start date in days"
},
"proposedEnrollment": {

@@ -193,2 +198,3 @@ "type": "number",

"endDate",
"proposedDuration",
"proposedEnrollment",

@@ -195,0 +201,0 @@ "referenceBranch"

@@ -23,2 +23,10 @@ {

"description": "A boolean BigQuery SQL expression expressing whether a single row in telemetry.main would have\nmatched the audience definition. These are used for sizing experiment populations,\nnot for targeting."
},
"firefox_channel": {
"type": "string",
"enum": [
"Nightly",
"Beta",
"Release"
]
}

@@ -28,3 +36,4 @@ },

"name",
"description"
"description",
"firefox_channel"
],

@@ -31,0 +40,0 @@ "additionalProperties": false

export const data = {
"Audiences": {
"all_english": {
"name": "All English users (release)", "description": "All users in en-* locales using the release channel.", "targeting": "localeLanguageCode == 'en' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'"
"name": "All English users (release)", "description": "All users in en-* locales using the release channel.", "targeting": "localeLanguageCode == 'en' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_channel = 'release'", "firefox_channel": "Release"
}, "us_only": {
"name": "US users (en; release)", "description": "All users in the US with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && region == 'US' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'"
"name": "US users (en; release)", "description": "All users in the US with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && region == 'US' && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND normalized_country_code = 'US' AND normalized_channel = 'release'", "firefox_channel": "Release"
}, "first_run": {
"name": "First start-up users (en; release)", "description": "First start-up users (e.g. for about:welcome) with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && (isFirstStartup || currentExperiment.slug in activeExperiments) && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'"
"name": "First start-up users (en; release)", "description": "First start-up users (e.g. for about:welcome) with an en-* locale using the release channel.", "targeting": "localeLanguageCode == 'en' && (isFirstStartup || currentExperiment.slug in activeExperiments) && browserSettings.update.channel == 'release'", "desktop_telemetry": "STARTS_WITH(environment.settings.locale, 'en') AND payload.info.profile_subsession_counter = 1 AND normalized_channel = 'release'", "firefox_channel": "Release"
}

@@ -13,10 +13,12 @@ }, "ExperimentDesignPresets": {

"name": "A/A Experiment", "description": "A design for diagnostic testing of targeting or enrollment. Fixed to 1% of the population.", "preset": {
"branches": [
{
"slug": "control", "ratio": 1, "value": null
}, {
"slug": "treatment", "ratio": 1, "value": null
"filter_expression": "env.version|versionCompare('{minFirefoxVersion}') >= 0", "targeting": "[{randomizationUnit}, \"{bucketNamespace}\"]|bucketSample({bucketStart}, {bucketCount}, {bucketTotal}) && {audienceTargeting}", "arguments": {
"proposedDuration": 28, "proposedEnrollment": 7, "branches": [
{
"slug": "control", "ratio": 1, "value": null
}, {
"slug": "treatment", "ratio": 1, "value": null
}
], "bucketConfig": {
"randomizationUnit": "userId", "count": 100, "total": 10000
}
], "bucketConfig": {
"randomizationUnit": "normandy_id", "total": 10000
}

@@ -30,3 +32,3 @@ }

"randomizationUnit": "normandy_id", "namespace": "bug-1637316-message-aboutwelcome-pull-factor-reinforcement-76-rel-release-76-77", "start": 0, "count": 2000, "total": 10000
}, "startDate": "2020-06-17T23:20:47.230Z", "endDate": null, "proposedEnrollment": 7, "referenceBranch": "control", "features": [], "branches": [
}, "startDate": "2020-06-17T23:20:47.230Z", "endDate": null, "proposedDuration": 28, "proposedEnrollment": 7, "referenceBranch": "control", "features": [], "branches": [
{

@@ -33,0 +35,0 @@ "slug": "control", "ratio": 1, "value": {}

/* eslint-disable @typescript-eslint/ban-types */
import { checkSchema, isSchema, assertSchema, SchemaResult } from "../typeGuards";
import type { Experiment, EmptyAAExperiment, ExperimentRecipe, ExperimentDesign } from "../../types/experiments";
import type { Experiment, ExperimentRecipe } from "../../types/experiments";
import type { Feature } from "../../types/features";
import type { FoodColors } from "../../types/test";
import type { Audience } from "../../types/targeting";
import type { SimpleCFRMessage } from "../../types/messaging";
import type { SimpleCFRMessage, TriggerActionSchemas, SpecialMessageActionSchemas } from "../../types/messaging";
import type { PreferenceRolloutArguments, MessagingExperimentArguments, AddonRollbackArguments, ConsoleLogArguments, ShowHeartbeatArguments, OptOutStudyArguments, NormandyRecipe, PreferenceExperimentArguments, PreferenceRollbackArguments, BranchedAddonStudyArguments, MultiPreferenceExperimentArguments, AddonRolloutArguments } from "../../types/normandy";

@@ -16,7 +16,2 @@

export function experiments_isEmptyAAExperiment(obj: object): obj is EmptyAAExperiment { return isSchema("experiments/EmptyAAExperiment", obj); }
export function experiments_checkEmptyAAExperiment(obj: object): SchemaResult { return checkSchema("experiments/EmptyAAExperiment", obj); }
export function experiments_assertEmptyAAExperiment(obj: object): asserts obj is EmptyAAExperiment { return assertSchema("experiments/EmptyAAExperiment", obj); }
export function experiments_isExperimentRecipe(obj: object): obj is ExperimentRecipe { return isSchema("experiments/ExperimentRecipe", obj); }

@@ -27,7 +22,2 @@ export function experiments_checkExperimentRecipe(obj: object): SchemaResult { return checkSchema("experiments/ExperimentRecipe", obj); }

export function experiments_isExperimentDesign(obj: object): obj is ExperimentDesign { return isSchema("experiments/ExperimentDesign", obj); }
export function experiments_checkExperimentDesign(obj: object): SchemaResult { return checkSchema("experiments/ExperimentDesign", obj); }
export function experiments_assertExperimentDesign(obj: object): asserts obj is ExperimentDesign { return assertSchema("experiments/ExperimentDesign", obj); }
export function features_isFeature(obj: object): obj is Feature { return isSchema("features/Feature", obj); }

@@ -53,2 +43,12 @@ export function features_checkFeature(obj: object): SchemaResult { return checkSchema("features/Feature", obj); }

export function messaging_isTriggerActionSchemas(obj: object): obj is TriggerActionSchemas { return isSchema("messaging/TriggerActionSchemas", obj); }
export function messaging_checkTriggerActionSchemas(obj: object): SchemaResult { return checkSchema("messaging/TriggerActionSchemas", obj); }
export function messaging_assertTriggerActionSchemas(obj: object): asserts obj is TriggerActionSchemas { return assertSchema("messaging/TriggerActionSchemas", obj); }
export function messaging_isSpecialMessageActionSchemas(obj: object): obj is SpecialMessageActionSchemas { return isSchema("messaging/SpecialMessageActionSchemas", obj); }
export function messaging_checkSpecialMessageActionSchemas(obj: object): SchemaResult { return checkSchema("messaging/SpecialMessageActionSchemas", obj); }
export function messaging_assertSpecialMessageActionSchemas(obj: object): asserts obj is SpecialMessageActionSchemas { return assertSchema("messaging/SpecialMessageActionSchemas", obj); }
export function normandy_isPreferenceRolloutArguments(obj: object): obj is PreferenceRolloutArguments { return isSchema("normandy/PreferenceRolloutArguments", obj); }

@@ -55,0 +55,0 @@ export function normandy_checkPreferenceRolloutArguments(obj: object): SchemaResult { return checkSchema("normandy/PreferenceRolloutArguments", obj); }

@@ -27,3 +27,3 @@ import path from "path";

dir: string,
opts: WalkOptions = { includeDirs: "exclude" }
opts: WalkOptions = { includeDirs: "exclude" },
): AsyncGenerator<WalkDirEntry, void> {

@@ -30,0 +30,0 @@ for await (const entry of await fs.opendir(dir)) {

@@ -47,2 +47,4 @@ /**

endDate: string | null;
/** Duration of the experiment from the start date in days */
proposedDuration: number;
/** Duration of enrollment from the start date in days */

@@ -59,3 +61,3 @@ proposedEnrollment: number;

*/
randomizationUnit: "client_id" | "normandy_id";
randomizationUnit: "client_id" | "normandy_id" | "userId";
/** Additional inputs to the hashing function */

@@ -90,24 +92,1 @@ namespace: string;

}
/**
* Preset types
* */
// A union of all available experiment designs; right now there is only one.
export type ExperimentDesign = EmptyAAExperiment;
/**
* An empty experiment that can target a maximum of 1% of the population
*/
export interface EmptyAAExperiment extends Experiment {
branches: Array<EmptyBranch>;
bucketConfig: AABucketConfig;
}
interface AABucketConfig extends BucketConfig {
total: 10000
}
interface EmptyBranch extends Branch {
value: null
}

@@ -21,3 +21,3 @@ type FluentId = { string_id: string };

| FluentId;
action: SpecialMessagingAction;
action: SpecialMessageActionSchemas;
}

@@ -61,3 +61,3 @@

trigger?: TriggerAction;
trigger?: TriggerActionSchemas;

@@ -94,6 +94,6 @@ /** If more than one message is valid, the message with the higher priority will be shown */

// Triggers are required for CFR, not optional
trigger: TriggerAction;
trigger: TriggerActionSchemas;
}
type TriggerAction =
export type TriggerActionSchemas =
| OpenUrl

@@ -146,6 +146,8 @@ | OpenArticleUrl

id: "contentBlocking";
params: Array<number>;
// number param for social/protection CFRs, string param for content blocking
// milestone
params: Array<number> | Array<string>;
}
type SpecialMessagingAction =
export type SpecialMessageActionSchemas =
| DisableSTPDoorhangers

@@ -165,3 +167,5 @@ | HighlightFeature

| ShowMigrationWizard
| Minimize;
| Minimize
| AcceptDoH
| DisableDoH;

@@ -228,3 +232,3 @@ /** Disables all STP doorhangers. */

/** Add a queryparam for metrics */
entrypoint: string;
entrypoint?: string;
};

@@ -287,1 +291,11 @@ type: "OPEN_PREFERENCES_PAGE";

}
/** Accept DOH doorhanger notification */
interface AcceptDoH {
type: "ACCEPT_DOH";
}
/** Dismiss DOH doorhanger notification */
interface DisableDoH {
type: "DISABLE_DOH";
}
export interface Audience {
name: string;
description: string;
targeting?: string;
filter_expression?: string;
/**
* A boolean BigQuery SQL expression expressing whether a single row in telemetry.main would have
* matched the audience definition. These are used for sizing experiment populations,
* not for targeting.
*/
desktop_telemetry?: string;
}
name: string;
description: string;
targeting?: string;
filter_expression?: string;
/**
* A boolean BigQuery SQL expression expressing whether a single row in telemetry.main would have
* matched the audience definition. These are used for sizing experiment populations,
* not for targeting.
*/
desktop_telemetry?: string;
firefox_channel: "Nightly" | "Beta" | "Release";
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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