auth0 7.4.0 → 7.5.0-beta.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 (40) hide show
  1. package/dist/cjs/management/api/requests/requests.d.ts +61 -0
  2. package/dist/cjs/management/api/resources/attackProtection/client/Client.d.ts +3 -0
  3. package/dist/cjs/management/api/resources/attackProtection/client/Client.js +9 -4
  4. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/client/Client.d.ts +105 -0
  5. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/client/Client.js +388 -0
  6. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/client/index.d.ts +1 -0
  7. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/client/index.js +2 -0
  8. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/exports.d.ts +2 -0
  9. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/exports.js +21 -0
  10. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/index.d.ts +1 -0
  11. package/dist/cjs/management/api/resources/attackProtection/resources/captchaPolicies/index.js +17 -0
  12. package/dist/cjs/management/api/resources/attackProtection/resources/index.d.ts +1 -0
  13. package/dist/cjs/management/api/resources/attackProtection/resources/index.js +2 -1
  14. package/dist/cjs/management/api/resources/clientGrants/client/Client.d.ts +27 -0
  15. package/dist/cjs/management/api/resources/clientGrants/client/Client.js +101 -0
  16. package/dist/cjs/management/api/types/types.d.ts +1063 -467
  17. package/dist/cjs/management/api/types/types.js +36 -171
  18. package/dist/cjs/management/version.d.ts +1 -1
  19. package/dist/cjs/management/version.js +1 -1
  20. package/dist/esm/management/api/requests/requests.d.mts +61 -0
  21. package/dist/esm/management/api/resources/attackProtection/client/Client.d.mts +3 -0
  22. package/dist/esm/management/api/resources/attackProtection/client/Client.mjs +5 -0
  23. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/client/Client.d.mts +105 -0
  24. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/client/Client.mjs +351 -0
  25. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/client/index.d.mts +1 -0
  26. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/client/index.mjs +1 -0
  27. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/exports.d.mts +2 -0
  28. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/exports.mjs +3 -0
  29. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/index.d.mts +1 -0
  30. package/dist/esm/management/api/resources/attackProtection/resources/captchaPolicies/index.mjs +1 -0
  31. package/dist/esm/management/api/resources/attackProtection/resources/index.d.mts +1 -0
  32. package/dist/esm/management/api/resources/attackProtection/resources/index.mjs +1 -0
  33. package/dist/esm/management/api/resources/clientGrants/client/Client.d.mts +27 -0
  34. package/dist/esm/management/api/resources/clientGrants/client/Client.mjs +101 -0
  35. package/dist/esm/management/api/types/types.d.mts +1063 -467
  36. package/dist/esm/management/api/types/types.mjs +15 -150
  37. package/dist/esm/management/version.d.mts +1 -1
  38. package/dist/esm/management/version.mjs +1 -1
  39. package/package.json +12 -1
  40. package/reference.md +414 -0
@@ -197,6 +197,34 @@ export interface CreateClientGrantRequestContent {
197
197
  /** If enabled, all scopes configured on the resource server are allowed for this grant. */
198
198
  allow_all_scopes?: boolean;
199
199
  }
200
+ /**
201
+ * @example
202
+ * {
203
+ * q: "q",
204
+ * parser: "scim",
205
+ * fields: "fields",
206
+ * include_fields: true,
207
+ * take: 1,
208
+ * from: "from",
209
+ * sort: "audience"
210
+ * }
211
+ */
212
+ export interface SearchClientGrantsRequestParameters {
213
+ /** Filter expression in SCIM or Lucene syntax (depending on parser parameter). SCIM examples: `audience eq "https://api.example.com"`, `client_id eq "cli_abc"`, `subject_type eq "client"`, `allow_any_organization eq true`, `default_for eq "third_party_clients"`, `audience co "example" and organization_id eq "org_123"`. SCIM operators: eq, ne, sw, ew, co, pr, gt, ge, lt, le, and, or. <br /><br /><b>Supported Fields</b>:<ul><li><i>audience</i> - Filter by audience (eq, ne, sw, co, ew, pr)</li><li><i>client_id</i> - Filter by client ID (eq, ne, sw, pr)</li><li><i>subject_type</i> - Filter by subject type (eq, ne, sw, pr)</li><li><i>allow_any_organization</i> - Filter by allow_any_organization (eq, ne, pr)</li><li><i>organization_id</i> - Filter by organization ID (eq, ne, sw, pr)</li><li><i>updated_at</i> - Filter by last update date (eq, ne, gt, ge, lt, le, pr)</li><li><i>default_for</i> - Filter by default grant group (eq, ne, sw, pr)</li></ul>Maximum 5 filter operations per query. Results are eventually consistent and may not reflect recent updates. */
214
+ q?: string | null;
215
+ /** Query parser to use for the filter expression. Use "scim" for SCIM filter syntax or "lucene" for Lucene query syntax (default). */
216
+ parser?: Management.SearchParserEnum | null;
217
+ /** Comma-separated list of fields to include or exclude in the response. Works with the include_fields parameter to control projection mode. */
218
+ fields?: string | null;
219
+ /** Controls field projection mode. Set to true to include only fields specified in the fields parameter. Set to false to exclude fields specified in the fields parameter. Defaults to true if not specified. */
220
+ include_fields?: boolean | null;
221
+ /** Maximum number of results to return per page (1-100). Defaults to 50. */
222
+ take?: number | null;
223
+ /** Cursor for the next page of results. Use the value from the next field in the previous response. */
224
+ from?: string | null;
225
+ /** Field name to sort results by in ascending order. Defaults to insertion order (oldest first) if not provided. */
226
+ sort?: Management.ClientGrantSortFieldEnum | null;
227
+ }
200
228
  /**
201
229
  * @example
202
230
  * {}
@@ -2303,6 +2331,39 @@ export interface UpdateAttackProtectionCaptchaRequestContent {
2303
2331
  recaptcha_v2?: Management.AttackProtectionUpdateCaptchaRecaptchaV2;
2304
2332
  simple_captcha?: Management.AttackProtectionCaptchaSimpleCaptchaResponseContent;
2305
2333
  }
2334
+ /**
2335
+ * @example
2336
+ * {
2337
+ * name: "name",
2338
+ * priority: 1,
2339
+ * match: {},
2340
+ * action: {}
2341
+ * }
2342
+ */
2343
+ export interface CreateAttackProtectionCaptchaPolicyRequestContent {
2344
+ /** Human-readable policy name. */
2345
+ name: string;
2346
+ /** Description of the attack protection policy. */
2347
+ description?: string;
2348
+ /** Conflict resolution order. Lower number takes higher precedence. Must be unique per tenant. */
2349
+ priority: number;
2350
+ match: Management.AttackProtectionCaptchaPolicyMatch;
2351
+ action: Management.AttackProtectionCaptchaPolicyActionInput;
2352
+ }
2353
+ /**
2354
+ * @example
2355
+ * {}
2356
+ */
2357
+ export interface UpdateAttackProtectionCaptchaPolicyRequestContent {
2358
+ /** Human-readable policy name. */
2359
+ name?: string;
2360
+ /** Description of the policy's purpose. */
2361
+ description?: string;
2362
+ /** Conflict resolution order. Lower number takes higher precedence. Must be unique per tenant. */
2363
+ priority?: number;
2364
+ match?: Management.AttackProtectionCaptchaPolicyMatch;
2365
+ action?: Management.AttackProtectionCaptchaPolicyActionInput;
2366
+ }
2306
2367
  /**
2307
2368
  * @example
2308
2369
  * {
@@ -4,6 +4,7 @@ import { BotDetectionClient } from "../resources/botDetection/client/Client.js";
4
4
  import { BreachedPasswordDetectionClient } from "../resources/breachedPasswordDetection/client/Client.js";
5
5
  import { BruteForceProtectionClient } from "../resources/bruteForceProtection/client/Client.js";
6
6
  import { CaptchaClient } from "../resources/captcha/client/Client.js";
7
+ import { CaptchaPoliciesClient } from "../resources/captchaPolicies/client/Client.js";
7
8
  import { PhoneProviderProtectionClient } from "../resources/phoneProviderProtection/client/Client.js";
8
9
  import { SuspiciousIpThrottlingClient } from "../resources/suspiciousIpThrottling/client/Client.js";
9
10
  export declare namespace AttackProtectionClient {
@@ -15,6 +16,7 @@ export declare class AttackProtectionClient {
15
16
  protected _breachedPasswordDetection: BreachedPasswordDetectionClient | undefined;
16
17
  protected _bruteForceProtection: BruteForceProtectionClient | undefined;
17
18
  protected _captcha: CaptchaClient | undefined;
19
+ protected _captchaPolicies: CaptchaPoliciesClient | undefined;
18
20
  protected _phoneProviderProtection: PhoneProviderProtectionClient | undefined;
19
21
  protected _suspiciousIpThrottling: SuspiciousIpThrottlingClient | undefined;
20
22
  constructor(options: AttackProtectionClient.Options);
@@ -22,6 +24,7 @@ export declare class AttackProtectionClient {
22
24
  get breachedPasswordDetection(): BreachedPasswordDetectionClient;
23
25
  get bruteForceProtection(): BruteForceProtectionClient;
24
26
  get captcha(): CaptchaClient;
27
+ get captchaPolicies(): CaptchaPoliciesClient;
25
28
  get phoneProviderProtection(): PhoneProviderProtectionClient;
26
29
  get suspiciousIpThrottling(): SuspiciousIpThrottlingClient;
27
30
  }
@@ -7,8 +7,9 @@ const Client_js_1 = require("../resources/botDetection/client/Client.js");
7
7
  const Client_js_2 = require("../resources/breachedPasswordDetection/client/Client.js");
8
8
  const Client_js_3 = require("../resources/bruteForceProtection/client/Client.js");
9
9
  const Client_js_4 = require("../resources/captcha/client/Client.js");
10
- const Client_js_5 = require("../resources/phoneProviderProtection/client/Client.js");
11
- const Client_js_6 = require("../resources/suspiciousIpThrottling/client/Client.js");
10
+ const Client_js_5 = require("../resources/captchaPolicies/client/Client.js");
11
+ const Client_js_6 = require("../resources/phoneProviderProtection/client/Client.js");
12
+ const Client_js_7 = require("../resources/suspiciousIpThrottling/client/Client.js");
12
13
  class AttackProtectionClient {
13
14
  constructor(options) {
14
15
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
@@ -29,13 +30,17 @@ class AttackProtectionClient {
29
30
  var _a;
30
31
  return ((_a = this._captcha) !== null && _a !== void 0 ? _a : (this._captcha = new Client_js_4.CaptchaClient(this._options)));
31
32
  }
33
+ get captchaPolicies() {
34
+ var _a;
35
+ return ((_a = this._captchaPolicies) !== null && _a !== void 0 ? _a : (this._captchaPolicies = new Client_js_5.CaptchaPoliciesClient(this._options)));
36
+ }
32
37
  get phoneProviderProtection() {
33
38
  var _a;
34
- return ((_a = this._phoneProviderProtection) !== null && _a !== void 0 ? _a : (this._phoneProviderProtection = new Client_js_5.PhoneProviderProtectionClient(this._options)));
39
+ return ((_a = this._phoneProviderProtection) !== null && _a !== void 0 ? _a : (this._phoneProviderProtection = new Client_js_6.PhoneProviderProtectionClient(this._options)));
35
40
  }
36
41
  get suspiciousIpThrottling() {
37
42
  var _a;
38
- return ((_a = this._suspiciousIpThrottling) !== null && _a !== void 0 ? _a : (this._suspiciousIpThrottling = new Client_js_6.SuspiciousIpThrottlingClient(this._options)));
43
+ return ((_a = this._suspiciousIpThrottling) !== null && _a !== void 0 ? _a : (this._suspiciousIpThrottling = new Client_js_7.SuspiciousIpThrottlingClient(this._options)));
39
44
  }
40
45
  }
41
46
  exports.AttackProtectionClient = AttackProtectionClient;
@@ -0,0 +1,105 @@
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
+ export declare namespace CaptchaPoliciesClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class CaptchaPoliciesClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<CaptchaPoliciesClient.Options>;
12
+ constructor(options: CaptchaPoliciesClient.Options);
13
+ /**
14
+ * Retrieve all CAPTCHA attack protection policies for the tenant, sorted by priority ascending.
15
+ *
16
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
17
+ *
18
+ * @throws {@link Management.BadRequestError}
19
+ * @throws {@link Management.UnauthorizedError}
20
+ * @throws {@link Management.ForbiddenError}
21
+ * @throws {@link Management.NotFoundError}
22
+ * @throws {@link Management.TooManyRequestsError}
23
+ *
24
+ * @example
25
+ * await client.attackProtection.captchaPolicies.list()
26
+ */
27
+ list(requestOptions?: CaptchaPoliciesClient.RequestOptions): core.HttpResponsePromise<Management.ListAttackProtectionCaptchaPoliciesResponseContent>;
28
+ private __list;
29
+ /**
30
+ * Create a new CAPTCHA attack protection policy for the tenant. The maximum number of policies per tenant is determined by the tenant's subscription.
31
+ *
32
+ * @param {Management.CreateAttackProtectionCaptchaPolicyRequestContent} request
33
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
34
+ *
35
+ * @throws {@link Management.BadRequestError}
36
+ * @throws {@link Management.UnauthorizedError}
37
+ * @throws {@link Management.ForbiddenError}
38
+ * @throws {@link Management.NotFoundError}
39
+ * @throws {@link Management.ConflictError}
40
+ * @throws {@link Management.TooManyRequestsError}
41
+ *
42
+ * @example
43
+ * await client.attackProtection.captchaPolicies.create({
44
+ * name: "name",
45
+ * priority: 1,
46
+ * match: {},
47
+ * action: {}
48
+ * })
49
+ */
50
+ create(request: Management.CreateAttackProtectionCaptchaPolicyRequestContent, requestOptions?: CaptchaPoliciesClient.RequestOptions): core.HttpResponsePromise<Management.AttackProtectionCaptchaPolicy>;
51
+ private __create;
52
+ /**
53
+ * Retrieve a single CAPTCHA attack protection policy for the tenant by ID.
54
+ *
55
+ * @param {string} id - ID of the CAPTCHA attack protection policy.
56
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @throws {@link Management.BadRequestError}
59
+ * @throws {@link Management.UnauthorizedError}
60
+ * @throws {@link Management.ForbiddenError}
61
+ * @throws {@link Management.NotFoundError}
62
+ * @throws {@link Management.TooManyRequestsError}
63
+ *
64
+ * @example
65
+ * await client.attackProtection.captchaPolicies.get("id")
66
+ */
67
+ get(id: string, requestOptions?: CaptchaPoliciesClient.RequestOptions): core.HttpResponsePromise<Management.AttackProtectionCaptchaPolicy>;
68
+ private __get;
69
+ /**
70
+ * Delete a CAPTCHA attack protection policy for the tenant.
71
+ *
72
+ * @param {string} id - ID of the CAPTCHA attack protection policy.
73
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
74
+ *
75
+ * @throws {@link Management.BadRequestError}
76
+ * @throws {@link Management.UnauthorizedError}
77
+ * @throws {@link Management.ForbiddenError}
78
+ * @throws {@link Management.NotFoundError}
79
+ * @throws {@link Management.TooManyRequestsError}
80
+ *
81
+ * @example
82
+ * await client.attackProtection.captchaPolicies.delete("id")
83
+ */
84
+ delete(id: string, requestOptions?: CaptchaPoliciesClient.RequestOptions): core.HttpResponsePromise<void>;
85
+ private __delete;
86
+ /**
87
+ * Partially update a CAPTCHA attack protection policy. Only the provided fields are modified. A provided match or action replaces the stored value in full rather than merging with it; within action, a provider secret or API key that is omitted from a provided provider block keeps its stored value.
88
+ *
89
+ * @param {string} id - ID of the CAPTCHA attack protection policy.
90
+ * @param {Management.UpdateAttackProtectionCaptchaPolicyRequestContent} request
91
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
92
+ *
93
+ * @throws {@link Management.BadRequestError}
94
+ * @throws {@link Management.UnauthorizedError}
95
+ * @throws {@link Management.ForbiddenError}
96
+ * @throws {@link Management.NotFoundError}
97
+ * @throws {@link Management.ConflictError}
98
+ * @throws {@link Management.TooManyRequestsError}
99
+ *
100
+ * @example
101
+ * await client.attackProtection.captchaPolicies.update("id")
102
+ */
103
+ update(id: string, request?: Management.UpdateAttackProtectionCaptchaPolicyRequestContent, requestOptions?: CaptchaPoliciesClient.RequestOptions): core.HttpResponsePromise<Management.AttackProtectionCaptchaPolicy>;
104
+ private __update;
105
+ }
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.CaptchaPoliciesClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../../../BaseClient.js");
48
+ const core = __importStar(require("../../../../../../core/index.js"));
49
+ const headers_js_1 = require("../../../../../../core/headers.js");
50
+ const environments = __importStar(require("../../../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../../../errors/index.js"));
53
+ const Management = __importStar(require("../../../../../index.js"));
54
+ class CaptchaPoliciesClient {
55
+ constructor(options) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Retrieve all CAPTCHA attack protection policies for the tenant, sorted by priority ascending.
60
+ *
61
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
62
+ *
63
+ * @throws {@link Management.BadRequestError}
64
+ * @throws {@link Management.UnauthorizedError}
65
+ * @throws {@link Management.ForbiddenError}
66
+ * @throws {@link Management.NotFoundError}
67
+ * @throws {@link Management.TooManyRequestsError}
68
+ *
69
+ * @example
70
+ * await client.attackProtection.captchaPolicies.list()
71
+ */
72
+ list(requestOptions) {
73
+ return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
74
+ }
75
+ __list(requestOptions) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
78
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
79
+ 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);
80
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
81
+ 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, "attack-protection/captcha/policies"),
82
+ method: "GET",
83
+ headers: _headers,
84
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
85
+ 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,
86
+ 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,
87
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
88
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
89
+ logging: this._options.logging,
90
+ });
91
+ if (_response.ok) {
92
+ return {
93
+ data: _response.body,
94
+ rawResponse: _response.rawResponse,
95
+ };
96
+ }
97
+ if (_response.error.reason === "status-code") {
98
+ switch (_response.error.statusCode) {
99
+ case 400:
100
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
101
+ case 401:
102
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
103
+ case 403:
104
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
105
+ case 404:
106
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
107
+ case 429:
108
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
109
+ default:
110
+ throw new errors.ManagementError({
111
+ statusCode: _response.error.statusCode,
112
+ body: _response.error.body,
113
+ rawResponse: _response.rawResponse,
114
+ });
115
+ }
116
+ }
117
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/attack-protection/captcha/policies");
118
+ });
119
+ }
120
+ /**
121
+ * Create a new CAPTCHA attack protection policy for the tenant. The maximum number of policies per tenant is determined by the tenant's subscription.
122
+ *
123
+ * @param {Management.CreateAttackProtectionCaptchaPolicyRequestContent} request
124
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
125
+ *
126
+ * @throws {@link Management.BadRequestError}
127
+ * @throws {@link Management.UnauthorizedError}
128
+ * @throws {@link Management.ForbiddenError}
129
+ * @throws {@link Management.NotFoundError}
130
+ * @throws {@link Management.ConflictError}
131
+ * @throws {@link Management.TooManyRequestsError}
132
+ *
133
+ * @example
134
+ * await client.attackProtection.captchaPolicies.create({
135
+ * name: "name",
136
+ * priority: 1,
137
+ * match: {},
138
+ * action: {}
139
+ * })
140
+ */
141
+ create(request, requestOptions) {
142
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
143
+ }
144
+ __create(request, requestOptions) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
147
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
148
+ 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);
149
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
150
+ 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, "attack-protection/captcha/policies"),
151
+ method: "POST",
152
+ headers: _headers,
153
+ contentType: "application/json",
154
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
155
+ requestType: "json",
156
+ body: request,
157
+ 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,
158
+ 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,
159
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
160
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
161
+ logging: this._options.logging,
162
+ });
163
+ if (_response.ok) {
164
+ return {
165
+ data: _response.body,
166
+ rawResponse: _response.rawResponse,
167
+ };
168
+ }
169
+ if (_response.error.reason === "status-code") {
170
+ switch (_response.error.statusCode) {
171
+ case 400:
172
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
173
+ case 401:
174
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
175
+ case 403:
176
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
177
+ case 404:
178
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
179
+ case 409:
180
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
181
+ case 429:
182
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
183
+ default:
184
+ throw new errors.ManagementError({
185
+ statusCode: _response.error.statusCode,
186
+ body: _response.error.body,
187
+ rawResponse: _response.rawResponse,
188
+ });
189
+ }
190
+ }
191
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/attack-protection/captcha/policies");
192
+ });
193
+ }
194
+ /**
195
+ * Retrieve a single CAPTCHA attack protection policy for the tenant by ID.
196
+ *
197
+ * @param {string} id - ID of the CAPTCHA attack protection policy.
198
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
199
+ *
200
+ * @throws {@link Management.BadRequestError}
201
+ * @throws {@link Management.UnauthorizedError}
202
+ * @throws {@link Management.ForbiddenError}
203
+ * @throws {@link Management.NotFoundError}
204
+ * @throws {@link Management.TooManyRequestsError}
205
+ *
206
+ * @example
207
+ * await client.attackProtection.captchaPolicies.get("id")
208
+ */
209
+ get(id, requestOptions) {
210
+ return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
211
+ }
212
+ __get(id, requestOptions) {
213
+ return __awaiter(this, void 0, void 0, function* () {
214
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
215
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
216
+ 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);
217
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
218
+ 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, `attack-protection/captcha/policies/${core.url.encodePathParam(id)}`),
219
+ method: "GET",
220
+ headers: _headers,
221
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
222
+ 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,
223
+ 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,
224
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
225
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
226
+ logging: this._options.logging,
227
+ });
228
+ if (_response.ok) {
229
+ return {
230
+ data: _response.body,
231
+ rawResponse: _response.rawResponse,
232
+ };
233
+ }
234
+ if (_response.error.reason === "status-code") {
235
+ switch (_response.error.statusCode) {
236
+ case 400:
237
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
238
+ case 401:
239
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
240
+ case 403:
241
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
242
+ case 404:
243
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
244
+ case 429:
245
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
246
+ default:
247
+ throw new errors.ManagementError({
248
+ statusCode: _response.error.statusCode,
249
+ body: _response.error.body,
250
+ rawResponse: _response.rawResponse,
251
+ });
252
+ }
253
+ }
254
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/attack-protection/captcha/policies/{id}");
255
+ });
256
+ }
257
+ /**
258
+ * Delete a CAPTCHA attack protection policy for the tenant.
259
+ *
260
+ * @param {string} id - ID of the CAPTCHA attack protection policy.
261
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
262
+ *
263
+ * @throws {@link Management.BadRequestError}
264
+ * @throws {@link Management.UnauthorizedError}
265
+ * @throws {@link Management.ForbiddenError}
266
+ * @throws {@link Management.NotFoundError}
267
+ * @throws {@link Management.TooManyRequestsError}
268
+ *
269
+ * @example
270
+ * await client.attackProtection.captchaPolicies.delete("id")
271
+ */
272
+ delete(id, requestOptions) {
273
+ return core.HttpResponsePromise.fromPromise(this.__delete(id, requestOptions));
274
+ }
275
+ __delete(id, requestOptions) {
276
+ return __awaiter(this, void 0, void 0, function* () {
277
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
278
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
279
+ 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);
280
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
281
+ 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, `attack-protection/captcha/policies/${core.url.encodePathParam(id)}`),
282
+ method: "DELETE",
283
+ headers: _headers,
284
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
285
+ 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,
286
+ 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,
287
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
288
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
289
+ logging: this._options.logging,
290
+ });
291
+ if (_response.ok) {
292
+ return { data: undefined, rawResponse: _response.rawResponse };
293
+ }
294
+ if (_response.error.reason === "status-code") {
295
+ switch (_response.error.statusCode) {
296
+ case 400:
297
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
298
+ case 401:
299
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
300
+ case 403:
301
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
302
+ case 404:
303
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
304
+ case 429:
305
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
306
+ default:
307
+ throw new errors.ManagementError({
308
+ statusCode: _response.error.statusCode,
309
+ body: _response.error.body,
310
+ rawResponse: _response.rawResponse,
311
+ });
312
+ }
313
+ }
314
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/attack-protection/captcha/policies/{id}");
315
+ });
316
+ }
317
+ /**
318
+ * Partially update a CAPTCHA attack protection policy. Only the provided fields are modified. A provided match or action replaces the stored value in full rather than merging with it; within action, a provider secret or API key that is omitted from a provided provider block keeps its stored value.
319
+ *
320
+ * @param {string} id - ID of the CAPTCHA attack protection policy.
321
+ * @param {Management.UpdateAttackProtectionCaptchaPolicyRequestContent} request
322
+ * @param {CaptchaPoliciesClient.RequestOptions} requestOptions - Request-specific configuration.
323
+ *
324
+ * @throws {@link Management.BadRequestError}
325
+ * @throws {@link Management.UnauthorizedError}
326
+ * @throws {@link Management.ForbiddenError}
327
+ * @throws {@link Management.NotFoundError}
328
+ * @throws {@link Management.ConflictError}
329
+ * @throws {@link Management.TooManyRequestsError}
330
+ *
331
+ * @example
332
+ * await client.attackProtection.captchaPolicies.update("id")
333
+ */
334
+ update(id, request = {}, requestOptions) {
335
+ return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
336
+ }
337
+ __update(id_1) {
338
+ return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
339
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
340
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
341
+ 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);
342
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
343
+ 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, `attack-protection/captcha/policies/${core.url.encodePathParam(id)}`),
344
+ method: "PATCH",
345
+ headers: _headers,
346
+ contentType: "application/json",
347
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
348
+ requestType: "json",
349
+ body: request,
350
+ 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,
351
+ 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,
352
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
353
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
354
+ logging: this._options.logging,
355
+ });
356
+ if (_response.ok) {
357
+ return {
358
+ data: _response.body,
359
+ rawResponse: _response.rawResponse,
360
+ };
361
+ }
362
+ if (_response.error.reason === "status-code") {
363
+ switch (_response.error.statusCode) {
364
+ case 400:
365
+ throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
366
+ case 401:
367
+ throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
368
+ case 403:
369
+ throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
370
+ case 404:
371
+ throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
372
+ case 409:
373
+ throw new Management.ConflictError(_response.error.body, _response.rawResponse);
374
+ case 429:
375
+ throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
376
+ default:
377
+ throw new errors.ManagementError({
378
+ statusCode: _response.error.statusCode,
379
+ body: _response.error.body,
380
+ rawResponse: _response.rawResponse,
381
+ });
382
+ }
383
+ }
384
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/attack-protection/captcha/policies/{id}");
385
+ });
386
+ }
387
+ }
388
+ exports.CaptchaPoliciesClient = CaptchaPoliciesClient;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { CaptchaPoliciesClient } from "./client/Client.js";
2
+ export * from "./client/index.js";