@mozilla/nimbus-schemas 2024.9.3 → 2024.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -2,13 +2,17 @@
2
2
  /* eslint-disable */
3
3
  /**
4
4
  /* This file was automatically generated from pydantic models.
5
- /* Do not modify by hand - update the pydantic models and re-run the script
5
+ /* Do not modify by hand - update the pydantic models and re-run
6
+ * make schemas_build
6
7
  */
7
8
 
8
- export type RandomizationUnit = "normandy_id" | "nimbus_id" | "user_id" | "group_id";
9
- export type Feature = FeatureWithExposure | FeatureWithoutExposure;
9
+ export type DesktopApplication = "firefox-desktop" | "firefox-desktop-background-task";
10
10
  export type FeatureVariableType = "int" | "string" | "boolean" | "json";
11
11
  export type PrefBranch = "default" | "user";
12
+ /**
13
+ * A unique, stable indentifier for the user used as an input to bucket hashing.
14
+ */
15
+ export type RandomizationUnit = "normandy_id" | "nimbus_id" | "user_id" | "group_id";
12
16
  export type AnalysisBasis = "enrollments" | "exposures";
13
17
  export type LogSource = "jetstream" | "sizing" | "jetstream-preview";
14
18
  export type AnalysisErrors = AnalysisError[];
@@ -28,114 +32,407 @@ export type SizingMetricName = "active_hours" | "search_count" | "days_of_use" |
28
32
  export type StatisticIngestEnum = "percentage" | "binomial" | "mean" | "count";
29
33
  export type Statistics = Statistic[];
30
34
 
35
+ /**
36
+ * A feature.
37
+ */
38
+ export interface DesktopFeature {
39
+ /**
40
+ * The description of the feature.
41
+ */
42
+ description: string;
43
+ /**
44
+ * Whether or not this feature records exposure telemetry.
45
+ */
46
+ hasExposure: boolean;
47
+ /**
48
+ * A description of the exposure telemetry collected by this feature.
49
+ *
50
+ * Only required if hasExposure is true.
51
+ */
52
+ exposureDescription?: string;
53
+ /**
54
+ * The owner of the feature.
55
+ */
56
+ owner: string;
57
+ /**
58
+ * If true, the feature values will be cached in prefs so that they can be read before Nimbus is initialized during Firefox startup.
59
+ */
60
+ isEarlyStartup?: boolean;
61
+ /**
62
+ * The applications that can enroll in experiments for this feature.
63
+ *
64
+ * Defaults to "firefox-desktop".
65
+ */
66
+ applications?: DesktopApplication[];
67
+ /**
68
+ * The variables that this feature can set.
69
+ */
70
+ variables: {
71
+ [k: string]: DesktopFeatureVariable;
72
+ };
73
+ schema?: NimbusFeatureSchema;
74
+ }
75
+ /**
76
+ * A feature variable.
77
+ */
78
+ export interface DesktopFeatureVariable {
79
+ /**
80
+ * A description of the feature.
81
+ */
82
+ description: string;
83
+ type: FeatureVariableType;
84
+ /**
85
+ * An optional list of possible string or integer values.
86
+ *
87
+ * Only allowed when type is string or int.
88
+ *
89
+ * The types in the enum must match the type of the field.
90
+ */
91
+ enum?: string[] | number[];
92
+ /**
93
+ * A pref that provides the default value for a feature when none is present.
94
+ */
95
+ fallbackPref?: string;
96
+ /**
97
+ * A pref that should be set to the value of this variable when enrolling in experiments.
98
+ *
99
+ * Using a string is deprecated and unsupported in Firefox 124+.
100
+ */
101
+ setPref?: string | SetPref;
102
+ }
103
+ export interface SetPref {
104
+ branch: PrefBranch;
105
+ /**
106
+ * The name of the pref to set.
107
+ */
108
+ pref: string;
109
+ }
110
+ /**
111
+ * Information about a JSON schema.
112
+ */
113
+ export interface NimbusFeatureSchema {
114
+ /**
115
+ * The resource:// or chrome:// URI that can be loaded at runtime within Firefox.
116
+ *
117
+ * Required by Firefox so that Nimbus can import the schema for validation.
118
+ */
119
+ uri: string;
120
+ /**
121
+ * The path to the schema file in the source checkout.
122
+ *
123
+ * Required by Experimenter so that it can find schema files in source checkouts.
124
+ */
125
+ path: string;
126
+ }
127
+ /**
128
+ * The Firefox Desktop-specific feature manifest.
129
+ *
130
+ * Firefox Desktop requires different fields for its features compared to the general
131
+ * Nimbus feature manifest.
132
+ */
133
+ export interface DesktopFeatureManifest {
134
+ [k: string]: DesktopFeature;
135
+ }
136
+ /**
137
+ * The experiment definition accessible to:
138
+ *
139
+ * 1. The Nimbus SDK via Remote Settings
140
+ * 2. Jetstream via the Experimenter API
141
+ */
31
142
  export interface NimbusExperiment {
143
+ /**
144
+ * Version of the NimbusExperiment schema this experiment refers to
145
+ */
32
146
  schemaVersion: string;
147
+ /**
148
+ * Unique identifier for the experiment
149
+ */
33
150
  slug: string;
151
+ /**
152
+ * Unique identifier for the experiiment.
153
+ *
154
+ * This is a duplicate of slug, but is required field for all Remote Settings records.
155
+ */
34
156
  id: string;
157
+ /**
158
+ * A slug identifying the targeted product of this experiment.
159
+ *
160
+ * It should be a lowercased_with_underscores name that is short and unambiguous and it should match the app_name found in https://probeinfo.telemetry.mozilla.org/glean/repositories. Examples are "fenix" and "firefox_desktop".
161
+ */
35
162
  appName: string;
163
+ /**
164
+ * The platform identifier for the targeted app.
165
+ *
166
+ * This should match app's identifier exactly as it appears in the relevant app store listing (for relevant platforms) or the app's Glean initialization (for other platforms).
167
+ *
168
+ * Examples are "org.mozilla.firefox_beta" and "firefox-desktop".
169
+ */
36
170
  appId: string;
171
+ /**
172
+ * A specific channel of an application such as "nightly", "beta", or "release".
173
+ */
37
174
  channel: string;
175
+ /**
176
+ * Public name of the experiment that will be displayed on "about:studies".
177
+ */
38
178
  userFacingName: string;
179
+ /**
180
+ * Short public description of the experiment that will be displayed on "about:studies".
181
+ */
39
182
  userFacingDescription: string;
183
+ /**
184
+ * When this property is set to true, the SDK should not enroll new users into the experiment that have not already been enrolled.
185
+ */
40
186
  isEnrollmentPaused: boolean;
41
- isRollout?: boolean | null;
187
+ /**
188
+ * When this property is set to true, treat this experiment as a rollout.
189
+ *
190
+ * Rollouts are currently handled as single-branch experiments separated from the bucketing namespace for normal experiments.
191
+ *
192
+ * See-also: https://mozilla-hub.atlassian.net/browse/SDK-405
193
+ */
194
+ isRollout?: boolean;
42
195
  bucketConfig: ExperimentBucketConfig;
43
- outcomes?: ExperimentOutcome[] | null;
44
- featureIds: string[];
45
- branches: (
46
- | ExperimentSingleFeatureBranch
47
- | ExperimentMultiFeatureDesktopBranch
48
- | ExperimentMultiFeatureMobileBranch
49
- )[];
196
+ /**
197
+ * A list of outcomes relevant to the experiment analysis.
198
+ */
199
+ outcomes?: ExperimentOutcome[];
200
+ /**
201
+ * A list of featureIds the experiment contains configurations for.
202
+ */
203
+ featureIds?: string[];
204
+ /**
205
+ * Branch configuration for the experiment.
206
+ */
207
+ branches:
208
+ | ExperimentSingleFeatureBranch[]
209
+ | ExperimentMultiFeatureDesktopBranch[]
210
+ | ExperimentMultiFeatureMobileBranch[];
211
+ /**
212
+ * A JEXL targeting expression used to filter out experiments.
213
+ */
50
214
  targeting?: string | null;
51
- startDate?: string | null;
215
+ /**
216
+ * Actual publish date of the experiment.
217
+ *
218
+ * Note that this value is expected to be null in Remote Settings.
219
+ */
220
+ startDate: string | null;
221
+ /**
222
+ * Actual enrollment end date of the experiment.
223
+ *
224
+ * Note that this value is expected to be null in Remote Settings.
225
+ */
52
226
  enrollmentEndDate?: string | null;
53
- endDate?: string | null;
54
- proposedDuration?: number | null;
55
- proposedEnrollment?: number | null;
56
- referenceBranch?: string | null;
57
- featureValidationOptOut?: boolean | null;
227
+ /**
228
+ * Actual end date of this experiment.
229
+ *
230
+ * Note that this field is expected to be null in Remote Settings.
231
+ */
232
+ endDate: string | null;
233
+ /**
234
+ * Duration of the experiment from the start date in days.
235
+ *
236
+ * Note that this property is only used during the analysis phase (i.e., not by the SDK).
237
+ */
238
+ proposedDuration?: number;
239
+ /**
240
+ * This represents the number of days that we expect to enroll new users.
241
+ *
242
+ * Note that this property is only used during the analysis phase (i.e., not by the SDK).
243
+ */
244
+ proposedEnrollment: number;
245
+ /**
246
+ * The slug of the reference branch (i.e., the branch we consider "control").
247
+ */
248
+ referenceBranch: string | null;
249
+ /**
250
+ * Opt out of feature schema validation. Only supported on desktop.
251
+ */
252
+ featureValidationOptOut?: boolean;
253
+ /**
254
+ * Per-locale localization substitutions.
255
+ *
256
+ * The top level key is the locale (e.g., "en-US" or "fr"). Each entry is a mapping of string IDs to their localized equivalents.
257
+ *
258
+ * Only supported on desktop.
259
+ */
58
260
  localizations?: {
59
- [k: string]: unknown;
261
+ [k: string]: {
262
+ [k: string]: string;
263
+ };
60
264
  } | null;
265
+ /**
266
+ * The list of locale codes (e.g., "en-US" or "fr") that this experiment is targeting.
267
+ *
268
+ * If null, all locales are targeted.
269
+ */
61
270
  locales?: string[] | null;
271
+ /**
272
+ * The date that this experiment was first published to Remote Settings.
273
+ *
274
+ * If null, it has not yet been published.
275
+ */
276
+ publishedDate?: string | null;
62
277
  }
63
278
  export interface ExperimentBucketConfig {
64
279
  randomizationUnit: RandomizationUnit;
280
+ /**
281
+ * Additional inputs to the hashing function.
282
+ */
65
283
  namespace: string;
284
+ /**
285
+ * Index of the starting bucket of the range.
286
+ */
66
287
  start: number;
288
+ /**
289
+ * Number of buckets in the range.
290
+ */
67
291
  count: number;
292
+ /**
293
+ * The total number of buckets.
294
+ *
295
+ * You can assume this will always be 10000
296
+ */
68
297
  total: number;
69
298
  }
70
299
  export interface ExperimentOutcome {
300
+ /**
301
+ * Identifier for the outcome.
302
+ */
71
303
  slug: string;
304
+ /**
305
+ * e.g., "primary" or "secondary".
306
+ */
72
307
  priority: string;
73
308
  }
309
+ /**
310
+ * A single-feature branch definition.
311
+ *
312
+ * Supported by Firefox Desktop for versions before 95, Firefox for Android for versions
313
+ * before 96, and Firefox for iOS for versions before 39.
314
+ */
74
315
  export interface ExperimentSingleFeatureBranch {
316
+ /**
317
+ * Identifier for the branch.
318
+ */
75
319
  slug: string;
320
+ /**
321
+ * Relative ratio of population for the branch.
322
+ *
323
+ * e.g., if branch A=1 and branch B=3, then branch A would get 25% of the population.
324
+ */
76
325
  ratio: number;
77
326
  feature: ExperimentFeatureConfig;
78
327
  }
79
328
  export interface ExperimentFeatureConfig {
329
+ /**
330
+ * The identifier for the feature flag.
331
+ */
80
332
  featureId: string;
81
- enabled?: boolean | null;
333
+ /**
334
+ * The values that define the feature configuration.
335
+ *
336
+ * This should be validated against a schema.
337
+ */
82
338
  value: {
83
339
  [k: string]: unknown;
84
340
  };
85
341
  }
342
+ /**
343
+ * The branch definition supported on Firefox Desktop 95+.
344
+ */
86
345
  export interface ExperimentMultiFeatureDesktopBranch {
346
+ /**
347
+ * Identifier for the branch.
348
+ */
87
349
  slug: string;
350
+ /**
351
+ * Relative ratio of population for the branch.
352
+ *
353
+ * e.g., if branch A=1 and branch B=3, then branch A would get 25% of the population.
354
+ */
88
355
  ratio: number;
89
- feature: ExperimentFeatureConfig;
356
+ /**
357
+ * An array of feature configurations.
358
+ */
90
359
  features: ExperimentFeatureConfig[];
360
+ feature: DesktopTombstoneFeatureConfig;
91
361
  }
362
+ export interface DesktopTombstoneFeatureConfig {
363
+ featureId: "unused-feature-id-for-legacy-support";
364
+ value: {
365
+ [k: string]: unknown;
366
+ };
367
+ enabled: false;
368
+ }
369
+ /**
370
+ * The branch definition for mobile browsers.
371
+ *
372
+ * Supported on Firefox for Android 96+ and Firefox for iOS 39+.
373
+ */
92
374
  export interface ExperimentMultiFeatureMobileBranch {
375
+ /**
376
+ * Identifier for the branch.
377
+ */
93
378
  slug: string;
379
+ /**
380
+ * Relative ratio of population for the branch.
381
+ *
382
+ * e.g., if branch A=1 and branch B=3, then branch A would get 25% of the population.
383
+ */
94
384
  ratio: number;
385
+ /**
386
+ * An array of feature configurations.
387
+ */
95
388
  features: ExperimentFeatureConfig[];
96
389
  }
97
- export interface FeatureManifest {
98
- [k: string]: Feature;
390
+ /**
391
+ * The SDK-specific feature manifest.
392
+ */
393
+ export interface SdkFeatureManifest {
394
+ [k: string]: SdkFeature;
99
395
  }
100
396
  /**
101
- * A feature that has exposure.
397
+ * A feature.
102
398
  */
103
- export interface FeatureWithExposure {
104
- description?: string | null;
105
- isEarlyStartup?: boolean | null;
399
+ export interface SdkFeature {
400
+ /**
401
+ * The description of the feature.
402
+ */
403
+ description: string;
404
+ /**
405
+ * Whether or not this feature records exposure telemetry.
406
+ */
407
+ hasExposure: boolean;
408
+ /**
409
+ * A description of the exposure telemetry collected by this feature.
410
+ *
411
+ * Only required if hasExposure is true.
412
+ */
413
+ exposureDescription?: string;
414
+ /**
415
+ * The variables that this feature can set.
416
+ */
106
417
  variables: {
107
- [k: string]: FeatureVariable;
418
+ [k: string]: SdkFeatureVariable;
108
419
  };
109
- schema?: NimbusFeatureSchema | null;
110
- hasExposure: true;
111
- exposureDescription: string;
112
- }
113
- export interface FeatureVariable {
114
- description?: string | null;
115
- enum?: string[] | null;
116
- fallbackPref?: string | null;
117
- type?: FeatureVariableType | null;
118
- setPref?: string | SetPref | null;
119
- }
120
- export interface SetPref {
121
- branch: PrefBranch;
122
- pref: string;
123
- }
124
- export interface NimbusFeatureSchema {
125
- uri: string;
126
- path: string;
127
420
  }
128
421
  /**
129
- * A feature without exposure.
422
+ * A feature variable.
130
423
  */
131
- export interface FeatureWithoutExposure {
132
- description?: string | null;
133
- isEarlyStartup?: boolean | null;
134
- variables: {
135
- [k: string]: FeatureVariable;
136
- };
137
- schema?: NimbusFeatureSchema | null;
138
- hasExposure: false;
424
+ export interface SdkFeatureVariable {
425
+ /**
426
+ * A description of the feature.
427
+ */
428
+ description: string;
429
+ type: FeatureVariableType;
430
+ /**
431
+ * An optional list of possible string values.
432
+ *
433
+ * Only allowed when type is string.
434
+ */
435
+ enum?: string[];
139
436
  }
140
437
  export interface AnalysisError {
141
438
  analysis_basis?: AnalysisBasis | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozilla/nimbus-schemas",
3
- "version": "2024.9.3",
3
+ "version": "2024.10.1",
4
4
  "description": "Schemas used by Mozilla Nimbus and related projects.",
5
5
  "main": "index.d.ts",
6
6
  "repository": {
@@ -18,6 +18,7 @@
18
18
  "typescript": "^5.1.6"
19
19
  },
20
20
  "files": [
21
- "index.d.ts"
21
+ "index.d.ts",
22
+ "schemas"
22
23
  ]
23
24
  }