auth0 7.2.0 → 7.3.0

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 (93) hide show
  1. package/dist/cjs/management/api/requests/requests.d.ts +208 -4
  2. package/dist/cjs/management/api/resources/experimentation/client/Client.d.ts +6 -0
  3. package/dist/cjs/management/api/resources/experimentation/client/Client.js +10 -0
  4. package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.d.ts +133 -0
  5. package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.js +485 -0
  6. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/client/Client.d.ts +126 -0
  7. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/client/Client.js +471 -0
  8. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/exports.d.ts +3 -0
  9. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/exports.js +22 -0
  10. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/index.d.ts +2 -0
  11. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/index.js +18 -0
  12. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/index.d.ts +1 -0
  13. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/index.js +37 -0
  14. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.d.ts +109 -0
  15. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.js +390 -0
  16. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.js +2 -0
  17. package/dist/cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/exports.d.ts +2 -0
  18. package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/exports.js +2 -2
  19. package/dist/cjs/management/api/resources/experimentation/resources/index.d.ts +2 -0
  20. package/dist/cjs/management/api/resources/experimentation/resources/index.js +3 -1
  21. package/dist/cjs/management/api/resources/experimentation/resources/segments/client/Client.d.ts +104 -0
  22. package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/segments}/client/Client.js +205 -39
  23. package/dist/cjs/management/api/resources/experimentation/resources/segments/client/index.js +2 -0
  24. package/dist/cjs/management/api/resources/experimentation/resources/segments/exports.d.ts +2 -0
  25. package/dist/cjs/management/api/resources/experimentation/resources/segments/exports.js +21 -0
  26. package/dist/cjs/management/api/resources/experimentation/resources/segments/index.d.ts +1 -0
  27. package/dist/cjs/management/api/resources/experimentation/resources/segments/index.js +17 -0
  28. package/dist/cjs/management/api/resources/organizations/client/Client.d.ts +0 -3
  29. package/dist/cjs/management/api/resources/organizations/client/Client.js +2 -7
  30. package/dist/cjs/management/api/resources/organizations/resources/index.d.ts +0 -1
  31. package/dist/cjs/management/api/resources/organizations/resources/index.js +1 -2
  32. package/dist/cjs/management/api/resources/users/client/Client.d.ts +8 -10
  33. package/dist/cjs/management/api/resources/users/client/Client.js +8 -10
  34. package/dist/cjs/management/api/types/types.d.ts +507 -91
  35. package/dist/cjs/management/api/types/types.js +99 -50
  36. package/dist/cjs/management/version.d.ts +1 -1
  37. package/dist/cjs/management/version.js +1 -1
  38. package/dist/esm/management/api/requests/requests.d.mts +208 -4
  39. package/dist/esm/management/api/resources/experimentation/client/Client.d.mts +6 -0
  40. package/dist/esm/management/api/resources/experimentation/client/Client.mjs +10 -0
  41. package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.d.mts +133 -0
  42. package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.mjs +485 -0
  43. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/Client.d.mts +126 -0
  44. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/Client.mjs +434 -0
  45. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/index.d.mts +1 -0
  46. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/client/index.mjs +1 -0
  47. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/exports.d.mts +3 -0
  48. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/exports.mjs +4 -0
  49. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/index.d.mts +2 -0
  50. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/index.mjs +2 -0
  51. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/index.d.mts +1 -0
  52. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/index.mjs +1 -0
  53. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.d.mts +109 -0
  54. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/Client.mjs +353 -0
  55. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.d.mts +1 -0
  56. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.mjs +1 -0
  57. package/dist/esm/management/api/resources/experimentation/resources/featureFlags/resources/variations/exports.d.mts +2 -0
  58. package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/exports.mjs +1 -1
  59. package/dist/esm/management/api/resources/experimentation/resources/index.d.mts +2 -0
  60. package/dist/esm/management/api/resources/experimentation/resources/index.mjs +2 -0
  61. package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.d.mts +104 -0
  62. package/dist/esm/management/api/resources/experimentation/resources/segments/client/Client.mjs +361 -0
  63. package/dist/esm/management/api/resources/experimentation/resources/segments/client/index.d.mts +1 -0
  64. package/dist/esm/management/api/resources/experimentation/resources/segments/client/index.mjs +1 -0
  65. package/dist/esm/management/api/resources/experimentation/resources/segments/exports.d.mts +2 -0
  66. package/dist/esm/management/api/resources/experimentation/resources/segments/exports.mjs +3 -0
  67. package/dist/esm/management/api/resources/experimentation/resources/segments/index.d.mts +1 -0
  68. package/dist/esm/management/api/resources/experimentation/resources/segments/index.mjs +1 -0
  69. package/dist/esm/management/api/resources/organizations/client/Client.d.mts +0 -3
  70. package/dist/esm/management/api/resources/organizations/client/Client.mjs +0 -5
  71. package/dist/esm/management/api/resources/organizations/resources/index.d.mts +0 -1
  72. package/dist/esm/management/api/resources/organizations/resources/index.mjs +0 -1
  73. package/dist/esm/management/api/resources/users/client/Client.d.mts +8 -10
  74. package/dist/esm/management/api/resources/users/client/Client.mjs +8 -10
  75. package/dist/esm/management/api/types/types.d.mts +507 -91
  76. package/dist/esm/management/api/types/types.mjs +78 -29
  77. package/dist/esm/management/version.d.mts +1 -1
  78. package/dist/esm/management/version.mjs +1 -1
  79. package/package.json +34 -12
  80. package/reference.md +1635 -220
  81. package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.ts +0 -63
  82. package/dist/cjs/management/api/resources/organizations/resources/organizationTemplate/exports.d.ts +0 -2
  83. package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.d.mts +0 -63
  84. package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/client/Client.mjs +0 -195
  85. package/dist/esm/management/api/resources/organizations/resources/organizationTemplate/exports.d.mts +0 -2
  86. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags}/client/index.d.ts +0 -0
  87. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags}/client/index.js +0 -0
  88. /package/dist/{esm/management/api/resources/organizations/resources/organizationTemplate/client/index.d.mts → cjs/management/api/resources/experimentation/resources/featureFlags/resources/variations/client/index.d.ts} +0 -0
  89. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.d.ts +0 -0
  90. /package/dist/cjs/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.js +0 -0
  91. /package/dist/{esm/management/api/resources/organizations/resources/organizationTemplate/client/index.mjs → cjs/management/api/resources/experimentation/resources/segments/client/index.d.ts} +0 -0
  92. /package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.d.mts +0 -0
  93. /package/dist/esm/management/api/resources/{organizations/resources/organizationTemplate → experimentation/resources/featureFlags/resources/variations}/index.mjs +0 -0
@@ -19,6 +19,356 @@ export class ExperimentsClient {
19
19
  constructor(options) {
20
20
  this._options = normalizeClientOptionsWithAuth(options);
21
21
  }
22
+ /**
23
+ * Retrieve a paginated list of experiments for the tenant, with optional filters.
24
+ *
25
+ * @param {Management.ListExperimentsRequestParameters} request
26
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
27
+ *
28
+ * @throws {@link Management.BadRequestError}
29
+ * @throws {@link Management.UnauthorizedError}
30
+ * @throws {@link Management.ForbiddenError}
31
+ * @throws {@link Management.TooManyRequestsError}
32
+ *
33
+ * @example
34
+ * await client.experimentation.experiments.list({
35
+ * from: "from",
36
+ * take: 1,
37
+ * status: "draft",
38
+ * authentication_flow: "authentication_flow",
39
+ * feature_flag_id: "feature_flag_id"
40
+ * })
41
+ */
42
+ list() {
43
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
44
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46
+ const { from: from_, take = 50, status, authentication_flow: authenticationFlow, feature_flag_id: featureFlagId, } = request;
47
+ const _queryParams = {
48
+ from: from_,
49
+ take,
50
+ status: status !== undefined ? status : undefined,
51
+ authentication_flow: authenticationFlow,
52
+ feature_flag_id: featureFlagId,
53
+ };
54
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
55
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
56
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
57
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, "experimentation/experiments"),
58
+ method: "GET",
59
+ headers: _headers,
60
+ queryString: core.url
61
+ .queryBuilder()
62
+ .addMany(_queryParams)
63
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
64
+ .build(),
65
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
66
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
67
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
68
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
69
+ logging: this._options.logging,
70
+ });
71
+ if (_response.ok) {
72
+ return {
73
+ data: _response.body,
74
+ rawResponse: _response.rawResponse,
75
+ };
76
+ }
77
+ if (_response.error.reason === "status-code") {
78
+ switch (_response.error.statusCode) {
79
+ case 400:
80
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
81
+ case 401:
82
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
83
+ case 403:
84
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
85
+ case 429:
86
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
87
+ default:
88
+ throw new errors.ManagementError({
89
+ statusCode: _response.error.statusCode,
90
+ body: _response.error.body,
91
+ rawResponse: _response.rawResponse,
92
+ });
93
+ }
94
+ }
95
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/experimentation/experiments");
96
+ }));
97
+ const dataWithRawResponse = yield list(request).withRawResponse();
98
+ return new core.Page({
99
+ response: dataWithRawResponse.data,
100
+ rawResponse: dataWithRawResponse.rawResponse,
101
+ hasNextPage: (response) => (response === null || response === void 0 ? void 0 : response.next) != null && !(typeof (response === null || response === void 0 ? void 0 : response.next) === "string" && (response === null || response === void 0 ? void 0 : response.next) === ""),
102
+ getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.experiments) !== null && _a !== void 0 ? _a : []; },
103
+ loadPage: (response) => {
104
+ return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next));
105
+ },
106
+ });
107
+ });
108
+ }
109
+ /**
110
+ * Create a new experiment for A/B testing.
111
+ *
112
+ * @param {Management.CreateExperimentRequestContent} request
113
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
114
+ *
115
+ * @throws {@link Management.BadRequestError}
116
+ * @throws {@link Management.UnauthorizedError}
117
+ * @throws {@link Management.ForbiddenError}
118
+ * @throws {@link Management.NotFoundError}
119
+ * @throws {@link Management.ConflictError}
120
+ * @throws {@link Management.UnprocessableEntityError}
121
+ * @throws {@link Management.TooManyRequestsError}
122
+ *
123
+ * @example
124
+ * await client.experimentation.experiments.create({
125
+ * name: "name",
126
+ * feature_flag_id: "feature_flag_id",
127
+ * authentication_flow: "authentication"
128
+ * })
129
+ */
130
+ create(request, requestOptions) {
131
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
132
+ }
133
+ __create(request, requestOptions) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
136
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
137
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
138
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
139
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, "experimentation/experiments"),
140
+ method: "POST",
141
+ headers: _headers,
142
+ contentType: "application/json",
143
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
144
+ requestType: "json",
145
+ body: request,
146
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
147
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
148
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
149
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
150
+ logging: this._options.logging,
151
+ });
152
+ if (_response.ok) {
153
+ return {
154
+ data: _response.body,
155
+ rawResponse: _response.rawResponse,
156
+ };
157
+ }
158
+ if (_response.error.reason === "status-code") {
159
+ switch (_response.error.statusCode) {
160
+ case 400:
161
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
162
+ case 401:
163
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
164
+ case 403:
165
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
166
+ case 404:
167
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
168
+ case 409:
169
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
170
+ case 422:
171
+ throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
172
+ case 429:
173
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
174
+ default:
175
+ throw new errors.ManagementError({
176
+ statusCode: _response.error.statusCode,
177
+ body: _response.error.body,
178
+ rawResponse: _response.rawResponse,
179
+ });
180
+ }
181
+ }
182
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/experiments");
183
+ });
184
+ }
185
+ /**
186
+ * Retrieve a single experiment with its allocations by ID.
187
+ *
188
+ * @param {string} id - The ID of the experiment to retrieve.
189
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
190
+ *
191
+ * @throws {@link Management.UnauthorizedError}
192
+ * @throws {@link Management.ForbiddenError}
193
+ * @throws {@link Management.NotFoundError}
194
+ * @throws {@link Management.TooManyRequestsError}
195
+ *
196
+ * @example
197
+ * await client.experimentation.experiments.get("id")
198
+ */
199
+ get(id, requestOptions) {
200
+ return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
201
+ }
202
+ __get(id, requestOptions) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
205
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
206
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
207
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
208
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/experiments/${core.url.encodePathParam(id)}`),
209
+ method: "GET",
210
+ headers: _headers,
211
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
212
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
213
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
214
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
215
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
216
+ logging: this._options.logging,
217
+ });
218
+ if (_response.ok) {
219
+ return {
220
+ data: _response.body,
221
+ rawResponse: _response.rawResponse,
222
+ };
223
+ }
224
+ if (_response.error.reason === "status-code") {
225
+ switch (_response.error.statusCode) {
226
+ case 401:
227
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
228
+ case 403:
229
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
230
+ case 404:
231
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
232
+ case 429:
233
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
234
+ default:
235
+ throw new errors.ManagementError({
236
+ statusCode: _response.error.statusCode,
237
+ body: _response.error.body,
238
+ rawResponse: _response.rawResponse,
239
+ });
240
+ }
241
+ }
242
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/experimentation/experiments/{id}");
243
+ });
244
+ }
245
+ /**
246
+ * Permanently delete an experiment and its allocations by ID. Active experiments cannot be deleted; pause or complete first. Idempotent: returns 204 even if the experiment does not exist.
247
+ *
248
+ * @param {string} id - The ID of the experiment to delete.
249
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
250
+ *
251
+ * @throws {@link Management.BadRequestError}
252
+ * @throws {@link Management.ForbiddenError}
253
+ * @throws {@link Management.TooManyRequestsError}
254
+ *
255
+ * @example
256
+ * await client.experimentation.experiments.delete("id")
257
+ */
258
+ delete(id, requestOptions) {
259
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
260
+ }
261
+ __delete(id, requestOptions) {
262
+ return __awaiter(this, void 0, void 0, function* () {
263
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
264
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
265
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
266
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
267
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/experiments/${core.url.encodePathParam(id)}`),
268
+ method: "DELETE",
269
+ headers: _headers,
270
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
271
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
272
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
273
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
274
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
275
+ logging: this._options.logging,
276
+ });
277
+ if (_response.ok) {
278
+ return { data: undefined, rawResponse: _response.rawResponse };
279
+ }
280
+ if (_response.error.reason === "status-code") {
281
+ switch (_response.error.statusCode) {
282
+ case 400:
283
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
284
+ case 403:
285
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
286
+ case 429:
287
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
288
+ default:
289
+ throw new errors.ManagementError({
290
+ statusCode: _response.error.statusCode,
291
+ body: _response.error.body,
292
+ rawResponse: _response.rawResponse,
293
+ });
294
+ }
295
+ }
296
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/experimentation/experiments/{id}");
297
+ });
298
+ }
299
+ /**
300
+ * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set.
301
+ *
302
+ * @param {string} id - The ID of the experiment to update.
303
+ * @param {Management.UpdateExperimentRequestParameters} request
304
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
305
+ *
306
+ * @throws {@link Management.BadRequestError}
307
+ * @throws {@link Management.UnauthorizedError}
308
+ * @throws {@link Management.ForbiddenError}
309
+ * @throws {@link Management.NotFoundError}
310
+ * @throws {@link Management.ConflictError}
311
+ * @throws {@link Management.UnprocessableEntityError}
312
+ * @throws {@link Management.TooManyRequestsError}
313
+ *
314
+ * @example
315
+ * await client.experimentation.experiments.update("id")
316
+ */
317
+ update(id, request = {}, requestOptions) {
318
+ return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
319
+ }
320
+ __update(id_1) {
321
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
322
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
323
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
324
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
325
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
326
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/experiments/${core.url.encodePathParam(id)}`),
327
+ method: "PATCH",
328
+ headers: _headers,
329
+ contentType: "application/json",
330
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
331
+ requestType: "json",
332
+ body: request,
333
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
334
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
335
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
336
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
337
+ logging: this._options.logging,
338
+ });
339
+ if (_response.ok) {
340
+ return {
341
+ data: _response.body,
342
+ rawResponse: _response.rawResponse,
343
+ };
344
+ }
345
+ if (_response.error.reason === "status-code") {
346
+ switch (_response.error.statusCode) {
347
+ case 400:
348
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
349
+ case 401:
350
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
351
+ case 403:
352
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
353
+ case 404:
354
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
355
+ case 409:
356
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
357
+ case 422:
358
+ throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
359
+ case 429:
360
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
361
+ default:
362
+ throw new errors.ManagementError({
363
+ statusCode: _response.error.statusCode,
364
+ body: _response.error.body,
365
+ rawResponse: _response.rawResponse,
366
+ });
367
+ }
368
+ }
369
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/experimentation/experiments/{id}");
370
+ });
371
+ }
22
372
  /**
23
373
  * Increments the current ramp index to the requested target level. Up-only: the target must be the immediate next level in the schedule. Idempotent: calling with the current level returns success without writing anything.
24
374
  *
@@ -91,4 +441,139 @@ export class ExperimentsClient {
91
441
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/advance-ramp");
92
442
  });
93
443
  }
444
+ /**
445
+ * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation.
446
+ *
447
+ * @param {string} id - The ID of the experiment to transition.
448
+ * @param {Management.UpdateExperimentStatusRequestContent} request
449
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
450
+ *
451
+ * @throws {@link Management.BadRequestError}
452
+ * @throws {@link Management.UnauthorizedError}
453
+ * @throws {@link Management.ForbiddenError}
454
+ * @throws {@link Management.NotFoundError}
455
+ * @throws {@link Management.ConflictError}
456
+ * @throws {@link Management.UnprocessableEntityError}
457
+ * @throws {@link Management.TooManyRequestsError}
458
+ *
459
+ * @example
460
+ * await client.experimentation.experiments.updateStatus("id", {
461
+ * status: "active"
462
+ * })
463
+ */
464
+ updateStatus(id, request, requestOptions) {
465
+ return core.HttpResponsePromise.fromPromise(this.__updateStatus(id, request, requestOptions));
466
+ }
467
+ __updateStatus(id, request, requestOptions) {
468
+ return __awaiter(this, void 0, void 0, function* () {
469
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
470
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
471
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
472
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
473
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/experiments/${core.url.encodePathParam(id)}/status`),
474
+ method: "POST",
475
+ headers: _headers,
476
+ contentType: "application/json",
477
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
478
+ requestType: "json",
479
+ body: request,
480
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
481
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
482
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
483
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
484
+ logging: this._options.logging,
485
+ });
486
+ if (_response.ok) {
487
+ return {
488
+ data: _response.body,
489
+ rawResponse: _response.rawResponse,
490
+ };
491
+ }
492
+ if (_response.error.reason === "status-code") {
493
+ switch (_response.error.statusCode) {
494
+ case 400:
495
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
496
+ case 401:
497
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
498
+ case 403:
499
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
500
+ case 404:
501
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
502
+ case 409:
503
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
504
+ case 422:
505
+ throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
506
+ case 429:
507
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
508
+ default:
509
+ throw new errors.ManagementError({
510
+ statusCode: _response.error.statusCode,
511
+ body: _response.error.body,
512
+ rawResponse: _response.rawResponse,
513
+ });
514
+ }
515
+ }
516
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/status");
517
+ });
518
+ }
519
+ /**
520
+ * Checks whether an experiment is ready to be activated. Returns is_valid boolean and an errors array describing any blockers. Read-only; no state is modified.
521
+ *
522
+ * @param {string} id - The ID of the experiment to validate.
523
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
524
+ *
525
+ * @throws {@link Management.UnauthorizedError}
526
+ * @throws {@link Management.ForbiddenError}
527
+ * @throws {@link Management.NotFoundError}
528
+ * @throws {@link Management.TooManyRequestsError}
529
+ *
530
+ * @example
531
+ * await client.experimentation.experiments.validate("id")
532
+ */
533
+ validate(id, requestOptions) {
534
+ return core.HttpResponsePromise.fromPromise(this.__validate(id, requestOptions));
535
+ }
536
+ __validate(id, requestOptions) {
537
+ return __awaiter(this, void 0, void 0, function* () {
538
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
539
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
540
+ let _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
541
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
542
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ManagementEnvironment.Default, `experimentation/experiments/${core.url.encodePathParam(id)}/validate`),
543
+ method: "POST",
544
+ headers: _headers,
545
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
546
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
547
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
548
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
549
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
550
+ logging: this._options.logging,
551
+ });
552
+ if (_response.ok) {
553
+ return {
554
+ data: _response.body,
555
+ rawResponse: _response.rawResponse,
556
+ };
557
+ }
558
+ if (_response.error.reason === "status-code") {
559
+ switch (_response.error.statusCode) {
560
+ case 401:
561
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
562
+ case 403:
563
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
564
+ case 404:
565
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
566
+ case 429:
567
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
568
+ default:
569
+ throw new errors.ManagementError({
570
+ statusCode: _response.error.statusCode,
571
+ body: _response.error.body,
572
+ rawResponse: _response.rawResponse,
573
+ });
574
+ }
575
+ }
576
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/validate");
577
+ });
578
+ }
94
579
  }
@@ -0,0 +1,126 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../core/index.mjs";
4
+ import * as Management from "../../../../../index.mjs";
5
+ import { VariationsClient } from "../resources/variations/client/Client.mjs";
6
+ export declare namespace FeatureFlagsClient {
7
+ type Options = BaseClientOptions;
8
+ interface RequestOptions extends BaseRequestOptions {
9
+ }
10
+ }
11
+ export declare class FeatureFlagsClient {
12
+ protected readonly _options: NormalizedClientOptionsWithAuth<FeatureFlagsClient.Options>;
13
+ protected _variations: VariationsClient | undefined;
14
+ constructor(options: FeatureFlagsClient.Options);
15
+ get variations(): VariationsClient;
16
+ /**
17
+ * Retrieve a paginated list of feature flags for the tenant.
18
+ *
19
+ * @param {Management.ListFeatureFlagsRequestParameters} request
20
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
21
+ *
22
+ * @throws {@link Management.BadRequestError}
23
+ * @throws {@link Management.UnauthorizedError}
24
+ * @throws {@link Management.ForbiddenError}
25
+ * @throws {@link Management.TooManyRequestsError}
26
+ *
27
+ * @example
28
+ * await client.experimentation.featureFlags.list({
29
+ * from: "from",
30
+ * take: 1,
31
+ * type: "auth0",
32
+ * status: "draft"
33
+ * })
34
+ */
35
+ list(request?: Management.ListFeatureFlagsRequestParameters, requestOptions?: FeatureFlagsClient.RequestOptions): Promise<core.Page<Management.FeatureFlag, Management.ListFeatureFlagsResponseContent>>;
36
+ /**
37
+ * Create a new feature flag with parameters for use in experiments.
38
+ *
39
+ * @param {Management.CreateFeatureFlagRequestContent} request
40
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
41
+ *
42
+ * @throws {@link Management.BadRequestError}
43
+ * @throws {@link Management.UnauthorizedError}
44
+ * @throws {@link Management.ForbiddenError}
45
+ * @throws {@link Management.ConflictError}
46
+ * @throws {@link Management.TooManyRequestsError}
47
+ *
48
+ * @example
49
+ * await client.experimentation.featureFlags.create({
50
+ * name: "name",
51
+ * parameters: {}
52
+ * })
53
+ */
54
+ create(request: Management.CreateFeatureFlagRequestContent, requestOptions?: FeatureFlagsClient.RequestOptions): core.HttpResponsePromise<Management.CreateFeatureFlagResponseContent>;
55
+ private __create;
56
+ /**
57
+ * Retrieve a single feature flag by its ID.
58
+ *
59
+ * @param {string} id - The ID of the feature flag to retrieve.
60
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link Management.UnauthorizedError}
63
+ * @throws {@link Management.ForbiddenError}
64
+ * @throws {@link Management.NotFoundError}
65
+ * @throws {@link Management.TooManyRequestsError}
66
+ *
67
+ * @example
68
+ * await client.experimentation.featureFlags.get("id")
69
+ */
70
+ get(id: string, requestOptions?: FeatureFlagsClient.RequestOptions): core.HttpResponsePromise<Management.GetFeatureFlagResponseContent>;
71
+ private __get;
72
+ /**
73
+ * Delete a feature flag by ID. Idempotent: returns 204 even if flag does not exist.
74
+ *
75
+ * @param {string} id - The ID of the feature flag to delete.
76
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
77
+ *
78
+ * @throws {@link Management.ForbiddenError}
79
+ * @throws {@link Management.ConflictError}
80
+ * @throws {@link Management.TooManyRequestsError}
81
+ *
82
+ * @example
83
+ * await client.experimentation.featureFlags.delete("id")
84
+ */
85
+ delete(id: string, requestOptions?: FeatureFlagsClient.RequestOptions): core.HttpResponsePromise<void>;
86
+ private __delete;
87
+ /**
88
+ * Partially update a feature flag by ID. Only provided fields are updated.
89
+ *
90
+ * @param {string} id - The ID of the feature flag to update.
91
+ * @param {Management.UpdateFeatureFlagRequestContent} request
92
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
93
+ *
94
+ * @throws {@link Management.BadRequestError}
95
+ * @throws {@link Management.UnauthorizedError}
96
+ * @throws {@link Management.ForbiddenError}
97
+ * @throws {@link Management.NotFoundError}
98
+ * @throws {@link Management.ConflictError}
99
+ * @throws {@link Management.TooManyRequestsError}
100
+ *
101
+ * @example
102
+ * await client.experimentation.featureFlags.update("id")
103
+ */
104
+ update(id: string, request?: Management.UpdateFeatureFlagRequestContent, requestOptions?: FeatureFlagsClient.RequestOptions): core.HttpResponsePromise<Management.UpdateFeatureFlagResponseContent>;
105
+ private __update;
106
+ /**
107
+ * Transitions a feature flag through its lifecycle states: draft → active, draft → archived, active → archived.
108
+ *
109
+ * @param {string} id - The ID of the feature flag to transition.
110
+ * @param {Management.UpdateFeatureFlagStatusRequestContent} request
111
+ * @param {FeatureFlagsClient.RequestOptions} requestOptions - Request-specific configuration.
112
+ *
113
+ * @throws {@link Management.BadRequestError}
114
+ * @throws {@link Management.UnauthorizedError}
115
+ * @throws {@link Management.ForbiddenError}
116
+ * @throws {@link Management.NotFoundError}
117
+ * @throws {@link Management.TooManyRequestsError}
118
+ *
119
+ * @example
120
+ * await client.experimentation.featureFlags.updateStatus("id", {
121
+ * status: "draft"
122
+ * })
123
+ */
124
+ updateStatus(id: string, request: Management.UpdateFeatureFlagStatusRequestContent, requestOptions?: FeatureFlagsClient.RequestOptions): core.HttpResponsePromise<Management.UpdateFeatureFlagStatusResponseContent>;
125
+ private __updateStatus;
126
+ }