auth0 7.1.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 +213 -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 +568 -91
  35. package/dist/cjs/management/api/types/types.js +113 -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 +213 -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 +568 -91
  76. package/dist/esm/management/api/types/types.mjs +92 -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
@@ -55,6 +55,356 @@ class ExperimentsClient {
55
55
  constructor(options) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
+ /**
59
+ * Retrieve a paginated list of experiments for the tenant, with optional filters.
60
+ *
61
+ * @param {Management.ListExperimentsRequestParameters} request
62
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Management.BadRequestError}
65
+ * @throws {@link Management.UnauthorizedError}
66
+ * @throws {@link Management.ForbiddenError}
67
+ * @throws {@link Management.TooManyRequestsError}
68
+ *
69
+ * @example
70
+ * await client.experimentation.experiments.list({
71
+ * from: "from",
72
+ * take: 1,
73
+ * status: "draft",
74
+ * authentication_flow: "authentication_flow",
75
+ * feature_flag_id: "feature_flag_id"
76
+ * })
77
+ */
78
+ list() {
79
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
80
+ const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
81
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
82
+ const { from: from_, take = 50, status, authentication_flow: authenticationFlow, feature_flag_id: featureFlagId, } = request;
83
+ const _queryParams = {
84
+ from: from_,
85
+ take,
86
+ status: status !== undefined ? status : undefined,
87
+ authentication_flow: authenticationFlow,
88
+ feature_flag_id: featureFlagId,
89
+ };
90
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
91
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
92
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
93
+ 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"),
94
+ method: "GET",
95
+ headers: _headers,
96
+ queryString: core.url
97
+ .queryBuilder()
98
+ .addMany(_queryParams)
99
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
100
+ .build(),
101
+ 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,
102
+ 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,
103
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
104
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
105
+ logging: this._options.logging,
106
+ });
107
+ if (_response.ok) {
108
+ return {
109
+ data: _response.body,
110
+ rawResponse: _response.rawResponse,
111
+ };
112
+ }
113
+ if (_response.error.reason === "status-code") {
114
+ switch (_response.error.statusCode) {
115
+ case 400:
116
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
117
+ case 401:
118
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
119
+ case 403:
120
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
121
+ case 429:
122
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
123
+ default:
124
+ throw new errors.ManagementError({
125
+ statusCode: _response.error.statusCode,
126
+ body: _response.error.body,
127
+ rawResponse: _response.rawResponse,
128
+ });
129
+ }
130
+ }
131
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/experimentation/experiments");
132
+ }));
133
+ const dataWithRawResponse = yield list(request).withRawResponse();
134
+ return new core.Page({
135
+ response: dataWithRawResponse.data,
136
+ rawResponse: dataWithRawResponse.rawResponse,
137
+ 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) === ""),
138
+ getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.experiments) !== null && _a !== void 0 ? _a : []; },
139
+ loadPage: (response) => {
140
+ return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next));
141
+ },
142
+ });
143
+ });
144
+ }
145
+ /**
146
+ * Create a new experiment for A/B testing.
147
+ *
148
+ * @param {Management.CreateExperimentRequestContent} request
149
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
150
+ *
151
+ * @throws {@link Management.BadRequestError}
152
+ * @throws {@link Management.UnauthorizedError}
153
+ * @throws {@link Management.ForbiddenError}
154
+ * @throws {@link Management.NotFoundError}
155
+ * @throws {@link Management.ConflictError}
156
+ * @throws {@link Management.UnprocessableEntityError}
157
+ * @throws {@link Management.TooManyRequestsError}
158
+ *
159
+ * @example
160
+ * await client.experimentation.experiments.create({
161
+ * name: "name",
162
+ * feature_flag_id: "feature_flag_id",
163
+ * authentication_flow: "authentication"
164
+ * })
165
+ */
166
+ create(request, requestOptions) {
167
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
168
+ }
169
+ __create(request, requestOptions) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
172
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
173
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
174
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
175
+ 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"),
176
+ method: "POST",
177
+ headers: _headers,
178
+ contentType: "application/json",
179
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
180
+ requestType: "json",
181
+ body: request,
182
+ 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,
183
+ 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,
184
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
185
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
186
+ logging: this._options.logging,
187
+ });
188
+ if (_response.ok) {
189
+ return {
190
+ data: _response.body,
191
+ rawResponse: _response.rawResponse,
192
+ };
193
+ }
194
+ if (_response.error.reason === "status-code") {
195
+ switch (_response.error.statusCode) {
196
+ case 400:
197
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
198
+ case 401:
199
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
200
+ case 403:
201
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
202
+ case 404:
203
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
204
+ case 409:
205
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
206
+ case 422:
207
+ throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
208
+ case 429:
209
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
210
+ default:
211
+ throw new errors.ManagementError({
212
+ statusCode: _response.error.statusCode,
213
+ body: _response.error.body,
214
+ rawResponse: _response.rawResponse,
215
+ });
216
+ }
217
+ }
218
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments");
219
+ });
220
+ }
221
+ /**
222
+ * Retrieve a single experiment with its allocations by ID.
223
+ *
224
+ * @param {string} id - The ID of the experiment to retrieve.
225
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
226
+ *
227
+ * @throws {@link Management.UnauthorizedError}
228
+ * @throws {@link Management.ForbiddenError}
229
+ * @throws {@link Management.NotFoundError}
230
+ * @throws {@link Management.TooManyRequestsError}
231
+ *
232
+ * @example
233
+ * await client.experimentation.experiments.get("id")
234
+ */
235
+ get(id, requestOptions) {
236
+ return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
237
+ }
238
+ __get(id, requestOptions) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
241
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
242
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
243
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
244
+ 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)}`),
245
+ method: "GET",
246
+ headers: _headers,
247
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
248
+ 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,
249
+ 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,
250
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
251
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
252
+ logging: this._options.logging,
253
+ });
254
+ if (_response.ok) {
255
+ return {
256
+ data: _response.body,
257
+ rawResponse: _response.rawResponse,
258
+ };
259
+ }
260
+ if (_response.error.reason === "status-code") {
261
+ switch (_response.error.statusCode) {
262
+ case 401:
263
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
264
+ case 403:
265
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
266
+ case 404:
267
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
268
+ case 429:
269
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
270
+ default:
271
+ throw new errors.ManagementError({
272
+ statusCode: _response.error.statusCode,
273
+ body: _response.error.body,
274
+ rawResponse: _response.rawResponse,
275
+ });
276
+ }
277
+ }
278
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/experimentation/experiments/{id}");
279
+ });
280
+ }
281
+ /**
282
+ * 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.
283
+ *
284
+ * @param {string} id - The ID of the experiment to delete.
285
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
286
+ *
287
+ * @throws {@link Management.BadRequestError}
288
+ * @throws {@link Management.ForbiddenError}
289
+ * @throws {@link Management.TooManyRequestsError}
290
+ *
291
+ * @example
292
+ * await client.experimentation.experiments.delete("id")
293
+ */
294
+ delete(id, requestOptions) {
295
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
296
+ }
297
+ __delete(id, requestOptions) {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
300
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
301
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
302
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
303
+ 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)}`),
304
+ method: "DELETE",
305
+ headers: _headers,
306
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
307
+ 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,
308
+ 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,
309
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
310
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
311
+ logging: this._options.logging,
312
+ });
313
+ if (_response.ok) {
314
+ return { data: undefined, rawResponse: _response.rawResponse };
315
+ }
316
+ if (_response.error.reason === "status-code") {
317
+ switch (_response.error.statusCode) {
318
+ case 400:
319
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
320
+ case 403:
321
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
322
+ case 429:
323
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
324
+ default:
325
+ throw new errors.ManagementError({
326
+ statusCode: _response.error.statusCode,
327
+ body: _response.error.body,
328
+ rawResponse: _response.rawResponse,
329
+ });
330
+ }
331
+ }
332
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/experimentation/experiments/{id}");
333
+ });
334
+ }
335
+ /**
336
+ * Partially update an experiment by ID. Only provided fields are updated. Providing allocations replaces the entire allocations set.
337
+ *
338
+ * @param {string} id - The ID of the experiment to update.
339
+ * @param {Management.UpdateExperimentRequestParameters} request
340
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
341
+ *
342
+ * @throws {@link Management.BadRequestError}
343
+ * @throws {@link Management.UnauthorizedError}
344
+ * @throws {@link Management.ForbiddenError}
345
+ * @throws {@link Management.NotFoundError}
346
+ * @throws {@link Management.ConflictError}
347
+ * @throws {@link Management.UnprocessableEntityError}
348
+ * @throws {@link Management.TooManyRequestsError}
349
+ *
350
+ * @example
351
+ * await client.experimentation.experiments.update("id")
352
+ */
353
+ update(id, request = {}, requestOptions) {
354
+ return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
355
+ }
356
+ __update(id_1) {
357
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
358
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
359
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
360
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
361
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
362
+ 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)}`),
363
+ method: "PATCH",
364
+ headers: _headers,
365
+ contentType: "application/json",
366
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
367
+ requestType: "json",
368
+ body: request,
369
+ 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,
370
+ 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,
371
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
372
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
373
+ logging: this._options.logging,
374
+ });
375
+ if (_response.ok) {
376
+ return {
377
+ data: _response.body,
378
+ rawResponse: _response.rawResponse,
379
+ };
380
+ }
381
+ if (_response.error.reason === "status-code") {
382
+ switch (_response.error.statusCode) {
383
+ case 400:
384
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
385
+ case 401:
386
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
387
+ case 403:
388
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
389
+ case 404:
390
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
391
+ case 409:
392
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
393
+ case 422:
394
+ throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
395
+ case 429:
396
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
397
+ default:
398
+ throw new errors.ManagementError({
399
+ statusCode: _response.error.statusCode,
400
+ body: _response.error.body,
401
+ rawResponse: _response.rawResponse,
402
+ });
403
+ }
404
+ }
405
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/experimentation/experiments/{id}");
406
+ });
407
+ }
58
408
  /**
59
409
  * 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.
60
410
  *
@@ -127,5 +477,140 @@ class ExperimentsClient {
127
477
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/advance-ramp");
128
478
  });
129
479
  }
480
+ /**
481
+ * Transitions an experiment through its lifecycle: draft → active, active → paused, paused → active, active/paused → completed. Activation runs full readiness validation.
482
+ *
483
+ * @param {string} id - The ID of the experiment to transition.
484
+ * @param {Management.UpdateExperimentStatusRequestContent} request
485
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
486
+ *
487
+ * @throws {@link Management.BadRequestError}
488
+ * @throws {@link Management.UnauthorizedError}
489
+ * @throws {@link Management.ForbiddenError}
490
+ * @throws {@link Management.NotFoundError}
491
+ * @throws {@link Management.ConflictError}
492
+ * @throws {@link Management.UnprocessableEntityError}
493
+ * @throws {@link Management.TooManyRequestsError}
494
+ *
495
+ * @example
496
+ * await client.experimentation.experiments.updateStatus("id", {
497
+ * status: "active"
498
+ * })
499
+ */
500
+ updateStatus(id, request, requestOptions) {
501
+ return core.HttpResponsePromise.fromPromise(this.__updateStatus(id, request, requestOptions));
502
+ }
503
+ __updateStatus(id, request, requestOptions) {
504
+ return __awaiter(this, void 0, void 0, function* () {
505
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
506
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
507
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
508
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
509
+ 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`),
510
+ method: "POST",
511
+ headers: _headers,
512
+ contentType: "application/json",
513
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
514
+ requestType: "json",
515
+ body: request,
516
+ 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,
517
+ 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,
518
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
519
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
520
+ logging: this._options.logging,
521
+ });
522
+ if (_response.ok) {
523
+ return {
524
+ data: _response.body,
525
+ rawResponse: _response.rawResponse,
526
+ };
527
+ }
528
+ if (_response.error.reason === "status-code") {
529
+ switch (_response.error.statusCode) {
530
+ case 400:
531
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
532
+ case 401:
533
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
534
+ case 403:
535
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
536
+ case 404:
537
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
538
+ case 409:
539
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
540
+ case 422:
541
+ throw new Management.UnprocessableEntityError(_response.error.body, _response.rawResponse);
542
+ case 429:
543
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
544
+ default:
545
+ throw new errors.ManagementError({
546
+ statusCode: _response.error.statusCode,
547
+ body: _response.error.body,
548
+ rawResponse: _response.rawResponse,
549
+ });
550
+ }
551
+ }
552
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/status");
553
+ });
554
+ }
555
+ /**
556
+ * 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.
557
+ *
558
+ * @param {string} id - The ID of the experiment to validate.
559
+ * @param {ExperimentsClient.RequestOptions} requestOptions - Request-specific configuration.
560
+ *
561
+ * @throws {@link Management.UnauthorizedError}
562
+ * @throws {@link Management.ForbiddenError}
563
+ * @throws {@link Management.NotFoundError}
564
+ * @throws {@link Management.TooManyRequestsError}
565
+ *
566
+ * @example
567
+ * await client.experimentation.experiments.validate("id")
568
+ */
569
+ validate(id, requestOptions) {
570
+ return core.HttpResponsePromise.fromPromise(this.__validate(id, requestOptions));
571
+ }
572
+ __validate(id, requestOptions) {
573
+ return __awaiter(this, void 0, void 0, function* () {
574
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
575
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
576
+ let _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
577
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
578
+ 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`),
579
+ method: "POST",
580
+ headers: _headers,
581
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
582
+ 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,
583
+ 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,
584
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
585
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
586
+ logging: this._options.logging,
587
+ });
588
+ if (_response.ok) {
589
+ return {
590
+ data: _response.body,
591
+ rawResponse: _response.rawResponse,
592
+ };
593
+ }
594
+ if (_response.error.reason === "status-code") {
595
+ switch (_response.error.statusCode) {
596
+ case 401:
597
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
598
+ case 403:
599
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
600
+ case 404:
601
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
602
+ case 429:
603
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
604
+ default:
605
+ throw new errors.ManagementError({
606
+ statusCode: _response.error.statusCode,
607
+ body: _response.error.body,
608
+ rawResponse: _response.rawResponse,
609
+ });
610
+ }
611
+ }
612
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/experimentation/experiments/{id}/validate");
613
+ });
614
+ }
130
615
  }
131
616
  exports.ExperimentsClient = ExperimentsClient;
@@ -0,0 +1,126 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as Management from "../../../../../index.js";
5
+ import { VariationsClient } from "../resources/variations/client/Client.js";
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
+ }