@azure-rest/onlineexperimentation 1.0.0-alpha.20250613.5

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +98 -0
  4. package/dist/browser/clientDefinitions.d.ts +30 -0
  5. package/dist/browser/clientDefinitions.js +3 -0
  6. package/dist/browser/extensibleEnums.d.ts +99 -0
  7. package/dist/browser/extensibleEnums.js +106 -0
  8. package/dist/browser/index.d.ts +11 -0
  9. package/dist/browser/index.js +13 -0
  10. package/dist/browser/isUnexpected.d.ts +6 -0
  11. package/dist/browser/isUnexpected.js +72 -0
  12. package/dist/browser/logger.d.ts +1 -0
  13. package/dist/browser/logger.js +4 -0
  14. package/dist/browser/models.d.ts +104 -0
  15. package/dist/browser/models.js +3 -0
  16. package/dist/browser/onlineExperimentationClient.d.ts +15 -0
  17. package/dist/browser/onlineExperimentationClient.js +45 -0
  18. package/dist/browser/outputModels.d.ts +137 -0
  19. package/dist/browser/outputModels.js +3 -0
  20. package/dist/browser/package.json +3 -0
  21. package/dist/browser/paginateHelper.d.ts +67 -0
  22. package/dist/browser/paginateHelper.js +136 -0
  23. package/dist/browser/parameters.d.ts +92 -0
  24. package/dist/browser/parameters.js +3 -0
  25. package/dist/browser/responses.d.ts +113 -0
  26. package/dist/browser/responses.js +3 -0
  27. package/dist/commonjs/clientDefinitions.d.ts +30 -0
  28. package/dist/commonjs/clientDefinitions.js +4 -0
  29. package/dist/commonjs/extensibleEnums.d.ts +99 -0
  30. package/dist/commonjs/extensibleEnums.js +109 -0
  31. package/dist/commonjs/index.d.ts +11 -0
  32. package/dist/commonjs/index.js +33 -0
  33. package/dist/commonjs/isUnexpected.d.ts +6 -0
  34. package/dist/commonjs/isUnexpected.js +75 -0
  35. package/dist/commonjs/logger.d.ts +1 -0
  36. package/dist/commonjs/logger.js +7 -0
  37. package/dist/commonjs/models.d.ts +104 -0
  38. package/dist/commonjs/models.js +4 -0
  39. package/dist/commonjs/onlineExperimentationClient.d.ts +15 -0
  40. package/dist/commonjs/onlineExperimentationClient.js +48 -0
  41. package/dist/commonjs/outputModels.d.ts +137 -0
  42. package/dist/commonjs/outputModels.js +4 -0
  43. package/dist/commonjs/package.json +3 -0
  44. package/dist/commonjs/paginateHelper.d.ts +67 -0
  45. package/dist/commonjs/paginateHelper.js +139 -0
  46. package/dist/commonjs/parameters.d.ts +92 -0
  47. package/dist/commonjs/parameters.js +4 -0
  48. package/dist/commonjs/responses.d.ts +113 -0
  49. package/dist/commonjs/responses.js +4 -0
  50. package/dist/commonjs/tsdoc-metadata.json +11 -0
  51. package/dist/esm/clientDefinitions.d.ts +30 -0
  52. package/dist/esm/clientDefinitions.js +3 -0
  53. package/dist/esm/extensibleEnums.d.ts +99 -0
  54. package/dist/esm/extensibleEnums.js +106 -0
  55. package/dist/esm/index.d.ts +11 -0
  56. package/dist/esm/index.js +13 -0
  57. package/dist/esm/isUnexpected.d.ts +6 -0
  58. package/dist/esm/isUnexpected.js +72 -0
  59. package/dist/esm/logger.d.ts +1 -0
  60. package/dist/esm/logger.js +4 -0
  61. package/dist/esm/models.d.ts +104 -0
  62. package/dist/esm/models.js +3 -0
  63. package/dist/esm/onlineExperimentationClient.d.ts +15 -0
  64. package/dist/esm/onlineExperimentationClient.js +45 -0
  65. package/dist/esm/outputModels.d.ts +137 -0
  66. package/dist/esm/outputModels.js +3 -0
  67. package/dist/esm/package.json +3 -0
  68. package/dist/esm/paginateHelper.d.ts +67 -0
  69. package/dist/esm/paginateHelper.js +136 -0
  70. package/dist/esm/parameters.d.ts +92 -0
  71. package/dist/esm/parameters.js +3 -0
  72. package/dist/esm/responses.d.ts +113 -0
  73. package/dist/esm/responses.js +3 -0
  74. package/dist/react-native/clientDefinitions.d.ts +30 -0
  75. package/dist/react-native/clientDefinitions.js +3 -0
  76. package/dist/react-native/extensibleEnums.d.ts +99 -0
  77. package/dist/react-native/extensibleEnums.js +106 -0
  78. package/dist/react-native/index.d.ts +11 -0
  79. package/dist/react-native/index.js +13 -0
  80. package/dist/react-native/isUnexpected.d.ts +6 -0
  81. package/dist/react-native/isUnexpected.js +72 -0
  82. package/dist/react-native/logger.d.ts +1 -0
  83. package/dist/react-native/logger.js +4 -0
  84. package/dist/react-native/models.d.ts +104 -0
  85. package/dist/react-native/models.js +3 -0
  86. package/dist/react-native/onlineExperimentationClient.d.ts +15 -0
  87. package/dist/react-native/onlineExperimentationClient.js +45 -0
  88. package/dist/react-native/outputModels.d.ts +137 -0
  89. package/dist/react-native/outputModels.js +3 -0
  90. package/dist/react-native/package.json +3 -0
  91. package/dist/react-native/paginateHelper.d.ts +67 -0
  92. package/dist/react-native/paginateHelper.js +136 -0
  93. package/dist/react-native/parameters.d.ts +92 -0
  94. package/dist/react-native/parameters.js +3 -0
  95. package/dist/react-native/responses.d.ts +113 -0
  96. package/dist/react-native/responses.js +3 -0
  97. package/package.json +138 -0
  98. package/review/onlineexperimentation.api.md +612 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Desired direction for an experiment metric value.
3
+ */
4
+ export declare enum KnownDesiredDirection {
5
+ /**
6
+ * An increase to the metric value is desired. E.g., Success rate, Total revenue.
7
+ */
8
+ Increase = "Increase",
9
+ /**
10
+ * A decrease to the metric value is desired. E.g., Error rate, Latency.
11
+ */
12
+ Decrease = "Decrease",
13
+ /**
14
+ * Neither an increase nor a decrease to the metric value is desired, or the desired direction depends on other factors. E.g., Number of video play attempts, Number of user feedbacks
15
+ */
16
+ Neutral = "Neutral"
17
+ }
18
+ /**
19
+ * How the metric definition calculates metric values from event data.
20
+ */
21
+ export declare enum KnownExperimentMetricType {
22
+ /**
23
+ * Counts the occurrences of an event. Experiment analysis accounts for unequal traffic allocation.
24
+ */
25
+ EventCount = "EventCount",
26
+ /**
27
+ * Counts the number of unique users who encounter an event. Experiment analysis accounts for unequal traffic allocation.
28
+ */
29
+ UserCount = "UserCount",
30
+ /**
31
+ * Calculates the percentage of events that satisfy a specified condition.
32
+ */
33
+ EventRate = "EventRate",
34
+ /**
35
+ * Calculates the percentage of users who encounter a start event and subsequently encounter an end event. Users must encounter the start event before the end event to be counted.
36
+ */
37
+ UserRate = "UserRate",
38
+ /**
39
+ * Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic allocation.
40
+ */
41
+ Sum = "Sum",
42
+ /**
43
+ * Calculates the average value of a specified event property.
44
+ */
45
+ Average = "Average",
46
+ /**
47
+ * Calculates a specified percentile of an event property.
48
+ */
49
+ Percentile = "Percentile"
50
+ }
51
+ /**
52
+ * Lifecycle stages of an experiment metric, determining whether the metric is included in experiment analysis.
53
+ */
54
+ export declare enum KnownLifecycleStage {
55
+ /**
56
+ * The metric is included in experiment analysis.
57
+ */
58
+ Active = "Active",
59
+ /**
60
+ * The metric is excluded from experiment analysis but remains available for future use.
61
+ */
62
+ Inactive = "Inactive"
63
+ }
64
+ /**
65
+ * The diagnostic error codes.
66
+ */
67
+ export declare enum KnownDiagnosticCode {
68
+ /**
69
+ * The metric definition does not conform to the JSON schema.
70
+ */
71
+ FailedSchemaValidation = "FailedSchemaValidation",
72
+ /**
73
+ * The event filter condition is invalid.
74
+ */
75
+ InvalidEventCondition = "InvalidEventCondition",
76
+ /**
77
+ * Event filter condition has valid syntax but is not currently supported.
78
+ */
79
+ UnsupportedEventCondition = "UnsupportedEventCondition",
80
+ /**
81
+ * The provided experiment metric definition is invalid.
82
+ * For example, defining a metric to calculate the average of a numeric property but
83
+ * including a filter condition that compares it to a string value creates a type mismatch.
84
+ */
85
+ InvalidExperimentMetricDefinition = "InvalidExperimentMetricDefinition"
86
+ }
87
+ /**
88
+ * The result of validating an experiment metric.
89
+ */
90
+ export declare enum KnownValidationResult {
91
+ /**
92
+ * The experiment metric is valid.
93
+ */
94
+ Valid = "Valid",
95
+ /**
96
+ * The experiment metric is invalid.
97
+ */
98
+ Invalid = "Invalid"
99
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.KnownValidationResult = exports.KnownDiagnosticCode = exports.KnownLifecycleStage = exports.KnownExperimentMetricType = exports.KnownDesiredDirection = void 0;
6
+ /**
7
+ * Desired direction for an experiment metric value.
8
+ */
9
+ var KnownDesiredDirection;
10
+ (function (KnownDesiredDirection) {
11
+ /**
12
+ * An increase to the metric value is desired. E.g., Success rate, Total revenue.
13
+ */
14
+ KnownDesiredDirection["Increase"] = "Increase";
15
+ /**
16
+ * A decrease to the metric value is desired. E.g., Error rate, Latency.
17
+ */
18
+ KnownDesiredDirection["Decrease"] = "Decrease";
19
+ /**
20
+ * Neither an increase nor a decrease to the metric value is desired, or the desired direction depends on other factors. E.g., Number of video play attempts, Number of user feedbacks
21
+ */
22
+ KnownDesiredDirection["Neutral"] = "Neutral";
23
+ })(KnownDesiredDirection || (exports.KnownDesiredDirection = KnownDesiredDirection = {}));
24
+ /**
25
+ * How the metric definition calculates metric values from event data.
26
+ */
27
+ var KnownExperimentMetricType;
28
+ (function (KnownExperimentMetricType) {
29
+ /**
30
+ * Counts the occurrences of an event. Experiment analysis accounts for unequal traffic allocation.
31
+ */
32
+ KnownExperimentMetricType["EventCount"] = "EventCount";
33
+ /**
34
+ * Counts the number of unique users who encounter an event. Experiment analysis accounts for unequal traffic allocation.
35
+ */
36
+ KnownExperimentMetricType["UserCount"] = "UserCount";
37
+ /**
38
+ * Calculates the percentage of events that satisfy a specified condition.
39
+ */
40
+ KnownExperimentMetricType["EventRate"] = "EventRate";
41
+ /**
42
+ * Calculates the percentage of users who encounter a start event and subsequently encounter an end event. Users must encounter the start event before the end event to be counted.
43
+ */
44
+ KnownExperimentMetricType["UserRate"] = "UserRate";
45
+ /**
46
+ * Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic allocation.
47
+ */
48
+ KnownExperimentMetricType["Sum"] = "Sum";
49
+ /**
50
+ * Calculates the average value of a specified event property.
51
+ */
52
+ KnownExperimentMetricType["Average"] = "Average";
53
+ /**
54
+ * Calculates a specified percentile of an event property.
55
+ */
56
+ KnownExperimentMetricType["Percentile"] = "Percentile";
57
+ })(KnownExperimentMetricType || (exports.KnownExperimentMetricType = KnownExperimentMetricType = {}));
58
+ /**
59
+ * Lifecycle stages of an experiment metric, determining whether the metric is included in experiment analysis.
60
+ */
61
+ var KnownLifecycleStage;
62
+ (function (KnownLifecycleStage) {
63
+ /**
64
+ * The metric is included in experiment analysis.
65
+ */
66
+ KnownLifecycleStage["Active"] = "Active";
67
+ /**
68
+ * The metric is excluded from experiment analysis but remains available for future use.
69
+ */
70
+ KnownLifecycleStage["Inactive"] = "Inactive";
71
+ })(KnownLifecycleStage || (exports.KnownLifecycleStage = KnownLifecycleStage = {}));
72
+ /**
73
+ * The diagnostic error codes.
74
+ */
75
+ var KnownDiagnosticCode;
76
+ (function (KnownDiagnosticCode) {
77
+ /**
78
+ * The metric definition does not conform to the JSON schema.
79
+ */
80
+ KnownDiagnosticCode["FailedSchemaValidation"] = "FailedSchemaValidation";
81
+ /**
82
+ * The event filter condition is invalid.
83
+ */
84
+ KnownDiagnosticCode["InvalidEventCondition"] = "InvalidEventCondition";
85
+ /**
86
+ * Event filter condition has valid syntax but is not currently supported.
87
+ */
88
+ KnownDiagnosticCode["UnsupportedEventCondition"] = "UnsupportedEventCondition";
89
+ /**
90
+ * The provided experiment metric definition is invalid.
91
+ * For example, defining a metric to calculate the average of a numeric property but
92
+ * including a filter condition that compares it to a string value creates a type mismatch.
93
+ */
94
+ KnownDiagnosticCode["InvalidExperimentMetricDefinition"] = "InvalidExperimentMetricDefinition";
95
+ })(KnownDiagnosticCode || (exports.KnownDiagnosticCode = KnownDiagnosticCode = {}));
96
+ /**
97
+ * The result of validating an experiment metric.
98
+ */
99
+ var KnownValidationResult;
100
+ (function (KnownValidationResult) {
101
+ /**
102
+ * The experiment metric is valid.
103
+ */
104
+ KnownValidationResult["Valid"] = "Valid";
105
+ /**
106
+ * The experiment metric is invalid.
107
+ */
108
+ KnownValidationResult["Invalid"] = "Invalid";
109
+ })(KnownValidationResult || (exports.KnownValidationResult = KnownValidationResult = {}));
@@ -0,0 +1,11 @@
1
+ import OnlineExperimentationClient from "./onlineExperimentationClient.js";
2
+ export * from "./onlineExperimentationClient.js";
3
+ export * from "./parameters.js";
4
+ export * from "./responses.js";
5
+ export * from "./clientDefinitions.js";
6
+ export * from "./isUnexpected.js";
7
+ export * from "./models.js";
8
+ export * from "./outputModels.js";
9
+ export * from "./paginateHelper.js";
10
+ export * from "./extensibleEnums.js";
11
+ export { OnlineExperimentationClient };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.OnlineExperimentationClient = void 0;
23
+ const onlineExperimentationClient_js_1 = __importDefault(require("./onlineExperimentationClient.js"));
24
+ exports.OnlineExperimentationClient = onlineExperimentationClient_js_1.default;
25
+ __exportStar(require("./onlineExperimentationClient.js"), exports);
26
+ __exportStar(require("./parameters.js"), exports);
27
+ __exportStar(require("./responses.js"), exports);
28
+ __exportStar(require("./clientDefinitions.js"), exports);
29
+ __exportStar(require("./isUnexpected.js"), exports);
30
+ __exportStar(require("./models.js"), exports);
31
+ __exportStar(require("./outputModels.js"), exports);
32
+ __exportStar(require("./paginateHelper.js"), exports);
33
+ __exportStar(require("./extensibleEnums.js"), exports);
@@ -0,0 +1,6 @@
1
+ import type { GetMetric200Response, GetMetricDefaultResponse, CreateOrUpdateMetric200Response, CreateOrUpdateMetric201Response, CreateOrUpdateMetricDefaultResponse, DeleteMetric204Response, DeleteMetricDefaultResponse, ValidateMetric200Response, ValidateMetricDefaultResponse, ListMetrics200Response, ListMetricsDefaultResponse } from "./responses.js";
2
+ export declare function isUnexpected(response: GetMetric200Response | GetMetricDefaultResponse): response is GetMetricDefaultResponse;
3
+ export declare function isUnexpected(response: CreateOrUpdateMetric200Response | CreateOrUpdateMetric201Response | CreateOrUpdateMetricDefaultResponse): response is CreateOrUpdateMetricDefaultResponse;
4
+ export declare function isUnexpected(response: DeleteMetric204Response | DeleteMetricDefaultResponse): response is DeleteMetricDefaultResponse;
5
+ export declare function isUnexpected(response: ValidateMetric200Response | ValidateMetricDefaultResponse): response is ValidateMetricDefaultResponse;
6
+ export declare function isUnexpected(response: ListMetrics200Response | ListMetricsDefaultResponse): response is ListMetricsDefaultResponse;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.isUnexpected = isUnexpected;
6
+ const responseMap = {
7
+ "GET /experiment-metrics/{experimentMetricId}": ["200"],
8
+ "PATCH /experiment-metrics/{experimentMetricId}": ["200", "201"],
9
+ "DELETE /experiment-metrics/{experimentMetricId}": ["204"],
10
+ "POST /experiment-metrics:validate": ["200"],
11
+ "GET /experiment-metrics": ["200"],
12
+ };
13
+ function isUnexpected(response) {
14
+ const lroOriginal = response.headers["x-ms-original-url"];
15
+ const url = new URL(lroOriginal ?? response.request.url);
16
+ const method = response.request.method;
17
+ let pathDetails = responseMap[`${method} ${url.pathname}`];
18
+ if (!pathDetails) {
19
+ pathDetails = getParametrizedPathSuccess(method, url.pathname);
20
+ }
21
+ return !pathDetails.includes(response.status);
22
+ }
23
+ function getParametrizedPathSuccess(method, path) {
24
+ const pathParts = path.split("/");
25
+ // Traverse list to match the longest candidate
26
+ // matchedLen: the length of candidate path
27
+ // matchedValue: the matched status code array
28
+ let matchedLen = -1, matchedValue = [];
29
+ // Iterate the responseMap to find a match
30
+ for (const [key, value] of Object.entries(responseMap)) {
31
+ // Extracting the path from the map key which is in format
32
+ // GET /path/foo
33
+ if (!key.startsWith(method)) {
34
+ continue;
35
+ }
36
+ const candidatePath = getPathFromMapKey(key);
37
+ // Get each part of the url path
38
+ const candidateParts = candidatePath.split("/");
39
+ // track if we have found a match to return the values found.
40
+ let found = true;
41
+ for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
42
+ if (candidateParts[i]?.startsWith("{") && candidateParts[i]?.indexOf("}") !== -1) {
43
+ const start = candidateParts[i].indexOf("}") + 1, end = candidateParts[i]?.length;
44
+ // If the current part of the candidate is a "template" part
45
+ // Try to use the suffix of pattern to match the path
46
+ // {guid} ==> $
47
+ // {guid}:export ==> :export$
48
+ const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(pathParts[j] || "");
49
+ if (!isMatched) {
50
+ found = false;
51
+ break;
52
+ }
53
+ continue;
54
+ }
55
+ // If the candidate part is not a template and
56
+ // the parts don't match mark the candidate as not found
57
+ // to move on with the next candidate path.
58
+ if (candidateParts[i] !== pathParts[j]) {
59
+ found = false;
60
+ break;
61
+ }
62
+ }
63
+ // We finished evaluating the current candidate parts
64
+ // Update the matched value if and only if we found the longer pattern
65
+ if (found && candidatePath.length > matchedLen) {
66
+ matchedLen = candidatePath.length;
67
+ matchedValue = value;
68
+ }
69
+ }
70
+ return matchedValue;
71
+ }
72
+ function getPathFromMapKey(mapKey) {
73
+ const pathStart = mapKey.indexOf("/");
74
+ return mapKey.slice(pathStart);
75
+ }
@@ -0,0 +1 @@
1
+ export declare const logger: import("@azure/logger").AzureLogger;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.logger = void 0;
6
+ const logger_1 = require("@azure/logger");
7
+ exports.logger = (0, logger_1.createClientLogger)("onlineexperimentation");
@@ -0,0 +1,104 @@
1
+ /** Defines experiment metric metadata and computation details. */
2
+ export interface ExperimentMetric {
3
+ /**
4
+ * Determines whether it is included in experiment analysis.
5
+ *
6
+ * Possible values: "Active", "Inactive"
7
+ */
8
+ lifecycle: LifecycleStage;
9
+ /** A user-friendly display name for the experiment metric shown in reports and dashboards. */
10
+ displayName: string;
11
+ /** A detailed description of the experiment metric. */
12
+ description: string;
13
+ /** Categories associated with the experiment metric. Used for organizing and filtering metrics. */
14
+ categories: string[];
15
+ /**
16
+ * The desired direction for changes in the metric value.
17
+ *
18
+ * Possible values: "Increase", "Decrease", "Neutral"
19
+ */
20
+ desiredDirection: DesiredDirection;
21
+ /** The metric definition specifying how the metric value is calculated from event data. */
22
+ definition: ExperimentMetricDefinition;
23
+ }
24
+ /** The metric definition, which determines how the metric value is calculated from event data. */
25
+ export interface ExperimentMetricDefinitionParent {
26
+ type: string;
27
+ }
28
+ /** The definition of an EventCount metric definition. Counts the occurrences of a specified event. */
29
+ export interface EventCountMetricDefinition extends ExperimentMetricDefinitionParent {
30
+ /** The type of metric. */
31
+ type: "EventCount";
32
+ /** Event to observe. */
33
+ event: ObservedEvent;
34
+ }
35
+ /** An event observed by a metric. */
36
+ export interface ObservedEvent {
37
+ /** The name of the event. */
38
+ eventName: string;
39
+ /** [Optional] A condition to filter events. */
40
+ filter?: string;
41
+ }
42
+ /** The definition of a UserCount metric definition. Counts unique users who encounter a specified event. */
43
+ export interface UserCountMetricDefinition extends ExperimentMetricDefinitionParent {
44
+ /** The type of metric. */
45
+ type: "UserCount";
46
+ /** Event to observe. */
47
+ event: ObservedEvent;
48
+ }
49
+ /** The definition of an EventRate metric definition. Calculates the percentage of events satisfying a specified condition. */
50
+ export interface EventRateMetricDefinition extends ExperimentMetricDefinitionParent {
51
+ /** The type of metric. */
52
+ type: "EventRate";
53
+ /** Event to observe as the rate denominator. */
54
+ event: ObservedEvent;
55
+ /** The event contributes to the rate numerator if it satisfies this condition. */
56
+ rateCondition: string;
57
+ }
58
+ /** The definition of a UserRate metric definition. Calculates the percentage of users who encounter a start event and subsequently an end event. Users must encounter events in the specified order. */
59
+ export interface UserRateMetricDefinition extends ExperimentMetricDefinitionParent {
60
+ /** The type of metric. */
61
+ type: "UserRate";
62
+ /** The start event to observe as the rate denominator. */
63
+ startEvent: ObservedEvent;
64
+ /** The end event to observe, which is a condition for the rate numerator. */
65
+ endEvent: ObservedEvent;
66
+ }
67
+ /** The definition of a Sum metric definition. Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic allocation. */
68
+ export interface SumMetricDefinition extends ExperimentMetricDefinitionParent {
69
+ /** The type of metric. */
70
+ type: "Sum";
71
+ /** The value to aggregate. */
72
+ value: AggregatedValue;
73
+ }
74
+ /** An event property value aggregated by a metric. */
75
+ export interface AggregatedValue {
76
+ /** The name of the event. */
77
+ eventName: string;
78
+ /** [Optional] A condition to filter events. */
79
+ filter?: string;
80
+ /** The key of the event property to aggregate. */
81
+ eventProperty: string;
82
+ }
83
+ /** The definition of an Average metric definition. Calculates the average value of a specified event property. */
84
+ export interface AverageMetricDefinition extends ExperimentMetricDefinitionParent {
85
+ /** The type of metric. */
86
+ type: "Average";
87
+ /** The value to aggregate. */
88
+ value: AggregatedValue;
89
+ }
90
+ /** The definition of a Percentile metric definition. Calculates a specified percentile of an event property. */
91
+ export interface PercentileMetricDefinition extends ExperimentMetricDefinitionParent {
92
+ /** The type of metric. */
93
+ type: "Percentile";
94
+ /** The value to aggregate, including the event name and property to measure. */
95
+ value: AggregatedValue;
96
+ /** The percentile to measure. */
97
+ percentile: number;
98
+ }
99
+ /** The metric definition, which determines how the metric value is calculated from event data. */
100
+ export type ExperimentMetricDefinition = ExperimentMetricDefinitionParent | EventCountMetricDefinition | UserCountMetricDefinition | EventRateMetricDefinition | UserRateMetricDefinition | SumMetricDefinition | AverageMetricDefinition | PercentileMetricDefinition;
101
+ /** Alias for LifecycleStage */
102
+ export type LifecycleStage = string;
103
+ /** Alias for DesiredDirection */
104
+ export type DesiredDirection = string;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import type { ClientOptions } from "@azure-rest/core-client";
2
+ import type { TokenCredential } from "@azure/core-auth";
3
+ import type { OnlineExperimentationClient } from "./clientDefinitions.js";
4
+ /** The optional parameters for the client */
5
+ export interface OnlineExperimentationClientOptions extends ClientOptions {
6
+ /** The api version option of the client */
7
+ apiVersion?: string;
8
+ }
9
+ /**
10
+ * Initialize a new instance of `OnlineExperimentationClient`
11
+ * @param endpointParam - Endpoint URL for the Online Experimentation workspace.
12
+ * @param credentials - uniquely identify client credential
13
+ * @param options - the parameter for all optional parameters
14
+ */
15
+ export default function createClient(endpointParam: string, credentials: TokenCredential, { apiVersion, ...options }?: OnlineExperimentationClientOptions): OnlineExperimentationClient;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.default = createClient;
6
+ const core_client_1 = require("@azure-rest/core-client");
7
+ const logger_js_1 = require("./logger.js");
8
+ /**
9
+ * Initialize a new instance of `OnlineExperimentationClient`
10
+ * @param endpointParam - Endpoint URL for the Online Experimentation workspace.
11
+ * @param credentials - uniquely identify client credential
12
+ * @param options - the parameter for all optional parameters
13
+ */
14
+ function createClient(endpointParam, credentials, { apiVersion = "2025-05-31-preview", ...options } = {}) {
15
+ const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;
16
+ const userAgentInfo = `azsdk-js-@azure-rest/onlineexperimentation/1.0.0-beta.1`;
17
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
18
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
19
+ : `${userAgentInfo}`;
20
+ const clientOptions = {
21
+ ...options,
22
+ userAgentOptions: {
23
+ userAgentPrefix,
24
+ },
25
+ loggingOptions: {
26
+ logger: options.loggingOptions?.logger ?? logger_js_1.logger.info,
27
+ },
28
+ credentials: {
29
+ scopes: options.credentials?.scopes ?? ["https://exp.azure.net/.default"],
30
+ },
31
+ };
32
+ const client = (0, core_client_1.getClient)(endpointUrl, credentials, clientOptions);
33
+ client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
34
+ client.pipeline.addPolicy({
35
+ name: "ClientApiVersionPolicy",
36
+ sendRequest: (req, next) => {
37
+ // Use the apiVersion defined in request url directly
38
+ // Append one if there is no apiVersion and we have one at client options
39
+ const url = new URL(req.url);
40
+ if (!url.searchParams.get("api-version") && apiVersion) {
41
+ // eslint-disable-next-line no-param-reassign
42
+ req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
43
+ }
44
+ return next(req);
45
+ },
46
+ });
47
+ return client;
48
+ }
@@ -0,0 +1,137 @@
1
+ /** Defines experiment metric metadata and computation details. */
2
+ export interface ExperimentMetricOutput {
3
+ /** Identifier for this experiment metric. Must start with a lowercase letter and contain only lowercase letters, numbers, and underscores. */
4
+ readonly id: string;
5
+ /**
6
+ * Determines whether it is included in experiment analysis.
7
+ *
8
+ * Possible values: "Active", "Inactive"
9
+ */
10
+ lifecycle: LifecycleStageOutput;
11
+ /** A user-friendly display name for the experiment metric shown in reports and dashboards. */
12
+ displayName: string;
13
+ /** A detailed description of the experiment metric. */
14
+ description: string;
15
+ /** Categories associated with the experiment metric. Used for organizing and filtering metrics. */
16
+ categories: string[];
17
+ /**
18
+ * The desired direction for changes in the metric value.
19
+ *
20
+ * Possible values: "Increase", "Decrease", "Neutral"
21
+ */
22
+ desiredDirection: DesiredDirectionOutput;
23
+ /** The metric definition specifying how the metric value is calculated from event data. */
24
+ definition: ExperimentMetricDefinitionOutput;
25
+ /** ETag of the experiment metric. */
26
+ readonly eTag: string;
27
+ /** The timestamp (UTC) of the last modification to the experiment metric resource. */
28
+ readonly lastModifiedAt: string;
29
+ }
30
+ /** The metric definition, which determines how the metric value is calculated from event data. */
31
+ export interface ExperimentMetricDefinitionOutputParent {
32
+ type: string;
33
+ }
34
+ /** The definition of an EventCount metric definition. Counts the occurrences of a specified event. */
35
+ export interface EventCountMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
36
+ /** The type of metric. */
37
+ type: "EventCount";
38
+ /** Event to observe. */
39
+ event: ObservedEventOutput;
40
+ }
41
+ /** An event observed by a metric. */
42
+ export interface ObservedEventOutput {
43
+ /** The name of the event. */
44
+ eventName: string;
45
+ /** [Optional] A condition to filter events. */
46
+ filter?: string;
47
+ }
48
+ /** The definition of a UserCount metric definition. Counts unique users who encounter a specified event. */
49
+ export interface UserCountMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
50
+ /** The type of metric. */
51
+ type: "UserCount";
52
+ /** Event to observe. */
53
+ event: ObservedEventOutput;
54
+ }
55
+ /** The definition of an EventRate metric definition. Calculates the percentage of events satisfying a specified condition. */
56
+ export interface EventRateMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
57
+ /** The type of metric. */
58
+ type: "EventRate";
59
+ /** Event to observe as the rate denominator. */
60
+ event: ObservedEventOutput;
61
+ /** The event contributes to the rate numerator if it satisfies this condition. */
62
+ rateCondition: string;
63
+ }
64
+ /** The definition of a UserRate metric definition. Calculates the percentage of users who encounter a start event and subsequently an end event. Users must encounter events in the specified order. */
65
+ export interface UserRateMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
66
+ /** The type of metric. */
67
+ type: "UserRate";
68
+ /** The start event to observe as the rate denominator. */
69
+ startEvent: ObservedEventOutput;
70
+ /** The end event to observe, which is a condition for the rate numerator. */
71
+ endEvent: ObservedEventOutput;
72
+ }
73
+ /** The definition of a Sum metric definition. Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic allocation. */
74
+ export interface SumMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
75
+ /** The type of metric. */
76
+ type: "Sum";
77
+ /** The value to aggregate. */
78
+ value: AggregatedValueOutput;
79
+ }
80
+ /** An event property value aggregated by a metric. */
81
+ export interface AggregatedValueOutput {
82
+ /** The name of the event. */
83
+ eventName: string;
84
+ /** [Optional] A condition to filter events. */
85
+ filter?: string;
86
+ /** The key of the event property to aggregate. */
87
+ eventProperty: string;
88
+ }
89
+ /** The definition of an Average metric definition. Calculates the average value of a specified event property. */
90
+ export interface AverageMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
91
+ /** The type of metric. */
92
+ type: "Average";
93
+ /** The value to aggregate. */
94
+ value: AggregatedValueOutput;
95
+ }
96
+ /** The definition of a Percentile metric definition. Calculates a specified percentile of an event property. */
97
+ export interface PercentileMetricDefinitionOutput extends ExperimentMetricDefinitionOutputParent {
98
+ /** The type of metric. */
99
+ type: "Percentile";
100
+ /** The value to aggregate, including the event name and property to measure. */
101
+ value: AggregatedValueOutput;
102
+ /** The percentile to measure. */
103
+ percentile: number;
104
+ }
105
+ /** The result of validating an experiment metric. */
106
+ export interface ExperimentMetricValidationResultOutput {
107
+ /** Indicates whether the experiment metric is valid. */
108
+ isValid: boolean;
109
+ /** Diagnostic details from the validation process. */
110
+ readonly diagnostics: Array<DiagnosticDetailOutput>;
111
+ }
112
+ /** Diagnostic details for validation errors. */
113
+ export interface DiagnosticDetailOutput {
114
+ /** A human-readable error message. */
115
+ readonly message: string;
116
+ /**
117
+ * The diagnostic error code.
118
+ *
119
+ * Possible values: "FailedSchemaValidation", "InvalidEventCondition", "UnsupportedEventCondition", "InvalidExperimentMetricDefinition"
120
+ */
121
+ readonly code: DiagnosticCodeOutput;
122
+ }
123
+ /** Paged collection of ExperimentMetric items */
124
+ export interface PagedExperimentMetricOutput {
125
+ /** The ExperimentMetric items on this page */
126
+ value: Array<ExperimentMetricOutput>;
127
+ /** The link to the next page of items */
128
+ nextLink?: string;
129
+ }
130
+ /** The metric definition, which determines how the metric value is calculated from event data. */
131
+ export type ExperimentMetricDefinitionOutput = ExperimentMetricDefinitionOutputParent | EventCountMetricDefinitionOutput | UserCountMetricDefinitionOutput | EventRateMetricDefinitionOutput | UserRateMetricDefinitionOutput | SumMetricDefinitionOutput | AverageMetricDefinitionOutput | PercentileMetricDefinitionOutput;
132
+ /** Alias for LifecycleStageOutput */
133
+ export type LifecycleStageOutput = string;
134
+ /** Alias for DesiredDirectionOutput */
135
+ export type DesiredDirectionOutput = string;
136
+ /** Alias for DiagnosticCodeOutput */
137
+ export type DiagnosticCodeOutput = string;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });