@mozilla/nimbus-schemas 2024.9.1 → 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
@@ -1,213 +1,500 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- /* This file was automatically generated from pydantic models by running pydantic2ts.
5
- /* Do not modify it by hand - just update the pydantic models and then re-run the script
6
- */
4
+ /* This file was automatically generated from pydantic models.
5
+ /* Do not modify by hand - update the pydantic models and re-run
6
+ * make schemas_build
7
+ */
7
8
 
8
- export type AnalysisBasis = "enrollments" | "exposures";
9
- export type LogSource = "jetstream" | "sizing" | "jetstream-preview";
10
- export type AnalysisErrors = AnalysisError[];
11
- export type Feature = FeatureWithExposure | FeatureWithoutExposure;
9
+ export type DesktopApplication = "firefox-desktop" | "firefox-desktop-background-task";
12
10
  export type FeatureVariableType = "int" | "string" | "boolean" | "json";
13
11
  export type PrefBranch = "default" | "user";
12
+ /**
13
+ * A unique, stable indentifier for the user used as an input to bucket hashing.
14
+ */
14
15
  export type RandomizationUnit = "normandy_id" | "nimbus_id" | "user_id" | "group_id";
16
+ export type AnalysisBasis = "enrollments" | "exposures";
17
+ export type LogSource = "jetstream" | "sizing" | "jetstream-preview";
18
+ export type AnalysisErrors = AnalysisError[];
19
+ export type AnalysisSegment = "all";
20
+ export type AnalysisSignificance = "positive" | "negative" | "neutral";
21
+ export type AnalysisWindow = "daily" | "weekly" | "overall";
22
+ export type BranchComparison = "absolute" | "difference" | "relative_uplift";
23
+ export type MetricGroup = "search_metrics" | "usage_metrics" | "other_metrics";
24
+ export type MetricIngestEnum = "retained" | "search_count" | "days_of_use" | "identity";
15
25
  export type SizingReleaseChannel = "release" | "beta" | "nightly";
16
26
  export type SizingUserType = "new" | "existing" | "all";
27
+ export type SizingMetricName = "active_hours" | "search_count" | "days_of_use" | "tagged_search_count";
28
+ /**
29
+ * This is the list of statistics supported in Experimenter,
30
+ * not a complete list of statistics available in Jetstream.
31
+ */
32
+ export type StatisticIngestEnum = "percentage" | "binomial" | "mean" | "count";
17
33
  export type Statistics = Statistic[];
18
34
 
19
- export interface AnalysisError {
20
- analysis_basis?: AnalysisBasis;
21
- source?: LogSource;
22
- exception?: string;
23
- exception_type?: string;
24
- experiment?: string;
25
- filename: string;
26
- func_name: string;
27
- log_level: string;
28
- message: string;
29
- metric?: string;
30
- segment?: string;
31
- statistic?: string;
32
- timestamp: string;
33
- }
34
- export interface ConfigVersionDetails {
35
- path?: string;
36
- revision?: string;
37
- }
38
- export interface ConfigVersions {
39
- metric_definitions?: ConfigVersionDetails[];
40
- jetstream_image?: ConfigVersionDetails;
41
- }
42
- export interface ExternalConfig {
43
- reference_branch?: string;
44
- end_date?: string;
45
- start_date?: string;
46
- enrollment_period?: number;
47
- skip?: boolean;
48
- url: string;
49
- }
50
- export interface FeatureManifest {
51
- [k: string]: Feature;
52
- }
53
35
  /**
54
- * A feature that has exposure.
36
+ * A feature.
55
37
  */
56
- export interface FeatureWithExposure {
57
- description?: string;
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
+ */
58
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
+ */
59
70
  variables: {
60
- [k: string]: FeatureVariable;
71
+ [k: string]: DesktopFeatureVariable;
61
72
  };
62
73
  schema?: NimbusFeatureSchema;
63
- hasExposure: true;
64
- exposureDescription: string;
65
74
  }
66
- export interface FeatureVariable {
67
- description?: string;
68
- enum?: string[];
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
+ */
69
95
  fallbackPref?: string;
70
- type?: FeatureVariableType;
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
+ */
71
101
  setPref?: string | SetPref;
72
102
  }
73
103
  export interface SetPref {
74
104
  branch: PrefBranch;
105
+ /**
106
+ * The name of the pref to set.
107
+ */
75
108
  pref: string;
76
109
  }
110
+ /**
111
+ * Information about a JSON schema.
112
+ */
77
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
+ */
78
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
+ */
79
125
  path: string;
80
126
  }
81
127
  /**
82
- * A feature without exposure.
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.
83
132
  */
84
- export interface FeatureWithoutExposure {
85
- description?: string;
86
- isEarlyStartup?: boolean;
87
- variables: {
88
- [k: string]: FeatureVariable;
89
- };
90
- schema?: NimbusFeatureSchema;
91
- hasExposure: false;
92
- }
93
- export interface Metadata {
94
- analysis_start_time?: string;
95
- external_config?: ExternalConfig;
96
- metrics: {
97
- [k: string]: Metric;
98
- };
99
- outcomes?: {
100
- [k: string]: Outcome;
101
- };
102
- version_info?: ConfigVersions;
103
- version_date?: string;
104
- schema_version?: number;
105
- }
106
- export interface Metric {
107
- analysis_bases: AnalysisBasis[];
108
- bigger_is_better: boolean;
109
- description?: string;
110
- friendly_name?: string;
111
- }
112
- export interface Outcome {
113
- commit_hash?: string;
114
- default_metrics: string[];
115
- description: string;
116
- friendly_name: string;
117
- metrics: string[];
118
- slug: string;
133
+ export interface DesktopFeatureManifest {
134
+ [k: string]: DesktopFeature;
119
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
+ */
120
142
  export interface NimbusExperiment {
143
+ /**
144
+ * Version of the NimbusExperiment schema this experiment refers to
145
+ */
121
146
  schemaVersion: string;
147
+ /**
148
+ * Unique identifier for the experiment
149
+ */
122
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
+ */
123
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
+ */
124
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
+ */
125
170
  appId: string;
171
+ /**
172
+ * A specific channel of an application such as "nightly", "beta", or "release".
173
+ */
126
174
  channel: string;
175
+ /**
176
+ * Public name of the experiment that will be displayed on "about:studies".
177
+ */
127
178
  userFacingName: string;
179
+ /**
180
+ * Short public description of the experiment that will be displayed on "about:studies".
181
+ */
128
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
+ */
129
186
  isEnrollmentPaused: boolean;
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
+ */
130
194
  isRollout?: boolean;
131
195
  bucketConfig: ExperimentBucketConfig;
196
+ /**
197
+ * A list of outcomes relevant to the experiment analysis.
198
+ */
132
199
  outcomes?: ExperimentOutcome[];
133
- featureIds: string[];
134
- branches: (
135
- | ExperimentSingleFeatureBranch
136
- | ExperimentMultiFeatureDesktopBranch
137
- | ExperimentMultiFeatureMobileBranch
138
- )[];
139
- targeting?: string;
140
- startDate?: string;
141
- enrollmentEndDate?: string;
142
- endDate?: string;
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
+ */
214
+ targeting?: 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
+ */
226
+ enrollmentEndDate?: string | 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
+ */
143
238
  proposedDuration?: number;
144
- proposedEnrollment?: number;
145
- referenceBranch?: string;
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
+ */
146
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
+ */
147
260
  localizations?: {
148
- [k: string]: unknown;
149
- };
150
- locales?: string[];
261
+ [k: string]: {
262
+ [k: string]: string;
263
+ };
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
+ */
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;
151
277
  }
152
278
  export interface ExperimentBucketConfig {
153
279
  randomizationUnit: RandomizationUnit;
280
+ /**
281
+ * Additional inputs to the hashing function.
282
+ */
154
283
  namespace: string;
284
+ /**
285
+ * Index of the starting bucket of the range.
286
+ */
155
287
  start: number;
288
+ /**
289
+ * Number of buckets in the range.
290
+ */
156
291
  count: number;
292
+ /**
293
+ * The total number of buckets.
294
+ *
295
+ * You can assume this will always be 10000
296
+ */
157
297
  total: number;
158
298
  }
159
299
  export interface ExperimentOutcome {
300
+ /**
301
+ * Identifier for the outcome.
302
+ */
160
303
  slug: string;
304
+ /**
305
+ * e.g., "primary" or "secondary".
306
+ */
161
307
  priority: string;
162
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
+ */
163
315
  export interface ExperimentSingleFeatureBranch {
316
+ /**
317
+ * Identifier for the branch.
318
+ */
164
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
+ */
165
325
  ratio: number;
166
326
  feature: ExperimentFeatureConfig;
167
327
  }
168
328
  export interface ExperimentFeatureConfig {
329
+ /**
330
+ * The identifier for the feature flag.
331
+ */
169
332
  featureId: string;
170
- enabled?: boolean;
333
+ /**
334
+ * The values that define the feature configuration.
335
+ *
336
+ * This should be validated against a schema.
337
+ */
171
338
  value: {
172
339
  [k: string]: unknown;
173
340
  };
174
341
  }
342
+ /**
343
+ * The branch definition supported on Firefox Desktop 95+.
344
+ */
175
345
  export interface ExperimentMultiFeatureDesktopBranch {
346
+ /**
347
+ * Identifier for the branch.
348
+ */
176
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
+ */
177
355
  ratio: number;
178
- feature: ExperimentFeatureConfig;
356
+ /**
357
+ * An array of feature configurations.
358
+ */
179
359
  features: ExperimentFeatureConfig[];
360
+ feature: DesktopTombstoneFeatureConfig;
361
+ }
362
+ export interface DesktopTombstoneFeatureConfig {
363
+ featureId: "unused-feature-id-for-legacy-support";
364
+ value: {
365
+ [k: string]: unknown;
366
+ };
367
+ enabled: false;
180
368
  }
369
+ /**
370
+ * The branch definition for mobile browsers.
371
+ *
372
+ * Supported on Firefox for Android 96+ and Firefox for iOS 39+.
373
+ */
181
374
  export interface ExperimentMultiFeatureMobileBranch {
375
+ /**
376
+ * Identifier for the branch.
377
+ */
182
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
+ */
183
384
  ratio: number;
385
+ /**
386
+ * An array of feature configurations.
387
+ */
184
388
  features: ExperimentFeatureConfig[];
185
389
  }
186
390
  /**
187
- * `extra=Extra.allow` is needed for the pydantic2ts generation of
188
- * typescript definitions. Without this, models with only a custom
189
- * __root__ dictionary field will generate as empty types.
190
- *
191
- * See https://github.com/phillipdupuis/pydantic-to-typescript/blob/master/pydantic2ts/cli/script.py#L150-L153
192
- * and https://github.com/phillipdupuis/pydantic-to-typescript/issues/39
193
- * for more info.
194
- *
195
- * If this is fixed we should remove `extra=Extra.allow`.
391
+ * The SDK-specific feature manifest.
196
392
  */
197
- export interface SampleSizes {
198
- [k: string]: SizingByUserType;
393
+ export interface SdkFeatureManifest {
394
+ [k: string]: SdkFeature;
199
395
  }
200
396
  /**
201
- * `extra=Extra.allow` is needed for the pydantic2ts generation of
202
- * typescript definitions. Without this, models with only a custom
203
- * __root__ dictionary field will generate as empty types.
204
- *
205
- * See https://github.com/phillipdupuis/pydantic-to-typescript/blob/master/pydantic2ts/cli/script.py#L150-L153
206
- * and https://github.com/phillipdupuis/pydantic-to-typescript/issues/39
207
- * for more info.
208
- *
209
- * If this is fixed we should remove `extra=Extra.allow`.
397
+ * A feature.
398
+ */
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
+ */
417
+ variables: {
418
+ [k: string]: SdkFeatureVariable;
419
+ };
420
+ }
421
+ /**
422
+ * A feature variable.
210
423
  */
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[];
436
+ }
437
+ export interface AnalysisError {
438
+ analysis_basis?: AnalysisBasis | null;
439
+ source?: LogSource | null;
440
+ exception?: string | null;
441
+ exception_type?: string | null;
442
+ experiment?: string | null;
443
+ filename: string;
444
+ func_name: string;
445
+ log_level: string;
446
+ message: string;
447
+ metric?: string | null;
448
+ segment?: string | null;
449
+ statistic?: string | null;
450
+ timestamp: string;
451
+ }
452
+ export interface ConfigVersions {
453
+ metric_definitions?: ConfigVersionDetails[] | null;
454
+ jetstream_image?: ConfigVersionDetails | null;
455
+ }
456
+ export interface ConfigVersionDetails {
457
+ path?: string | null;
458
+ revision?: string | null;
459
+ }
460
+ export interface ExternalConfig {
461
+ reference_branch?: string | null;
462
+ end_date?: string | null;
463
+ start_date?: string | null;
464
+ enrollment_period?: number | null;
465
+ skip?: boolean | null;
466
+ url: string;
467
+ }
468
+ export interface Metadata {
469
+ analysis_start_time?: string | null;
470
+ external_config?: ExternalConfig | null;
471
+ metrics: {
472
+ [k: string]: Metric;
473
+ };
474
+ outcomes?: {
475
+ [k: string]: Outcome;
476
+ };
477
+ version_info?: ConfigVersions | null;
478
+ version_date?: string | null;
479
+ schema_version?: number;
480
+ }
481
+ export interface Metric {
482
+ analysis_bases: AnalysisBasis[];
483
+ bigger_is_better: boolean;
484
+ description?: string | null;
485
+ friendly_name?: string | null;
486
+ }
487
+ export interface Outcome {
488
+ commit_hash?: string | null;
489
+ default_metrics: string[];
490
+ description: string;
491
+ friendly_name: string;
492
+ metrics: string[];
493
+ slug: string;
494
+ }
495
+ export interface SampleSizes {
496
+ [k: string]: SizingByUserType;
497
+ }
211
498
  export interface SizingByUserType {
212
499
  [k: string]: SizingTarget;
213
500
  }
@@ -220,8 +507,8 @@ export interface SizingTarget {
220
507
  export interface SizingRecipe {
221
508
  app_id: string;
222
509
  channel: SizingReleaseChannel;
223
- locale?: string;
224
- language?: string;
510
+ locale?: string | null;
511
+ language?: string | null;
225
512
  country: string;
226
513
  new_or_existing: SizingUserType;
227
514
  }
@@ -244,14 +531,14 @@ export interface Statistic {
244
531
  metric: string;
245
532
  statistic: string;
246
533
  branch: string;
247
- parameter?: number;
248
- comparison?: string;
249
- comparison_to_branch?: string;
250
- ci_width?: number;
251
- point?: number;
252
- lower?: number;
253
- upper?: number;
534
+ parameter?: number | null;
535
+ comparison?: string | null;
536
+ comparison_to_branch?: string | null;
537
+ ci_width?: number | null;
538
+ point?: number | null;
539
+ lower?: number | null;
540
+ upper?: number | null;
254
541
  segment?: string;
255
- analysis_basis?: AnalysisBasis;
256
- window_index?: string;
542
+ analysis_basis?: AnalysisBasis | null;
543
+ window_index?: string | null;
257
544
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mozilla/nimbus-schemas",
3
- "version": "2024.9.1",
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
  }