auth0 6.4.0 → 7.1.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.
- package/README.md +20 -15
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/lib/errors.d.ts +0 -18
- package/dist/cjs/lib/errors.js +1 -25
- package/dist/cjs/lib/middleware/auth0-client-telemetry.d.ts +3 -7
- package/dist/cjs/lib/middleware/auth0-client-telemetry.js +1 -25
- package/dist/cjs/lib/models.d.ts +0 -24
- package/dist/cjs/lib/models.js +0 -53
- package/dist/cjs/management/Client.d.ts +5 -5
- package/dist/cjs/management/Client.js +28 -28
- package/dist/cjs/management/api/errors/GatewayTimeoutError.d.ts +5 -0
- package/dist/cjs/management/api/errors/GatewayTimeoutError.js +54 -0
- package/dist/cjs/management/api/errors/index.d.ts +1 -0
- package/dist/cjs/management/api/errors/index.js +1 -0
- package/dist/cjs/management/api/requests/requests.d.ts +112 -88
- package/dist/cjs/management/api/resources/experimentation/client/Client.d.ts +12 -0
- package/dist/cjs/management/api/resources/experimentation/client/Client.js +16 -0
- package/dist/cjs/management/api/resources/experimentation/exports.d.ts +3 -0
- package/dist/cjs/management/api/resources/experimentation/exports.js +22 -0
- package/dist/cjs/management/api/resources/experimentation/index.d.ts +2 -0
- package/dist/cjs/management/api/resources/experimentation/index.js +18 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.d.ts +34 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/Client.js +131 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/client/index.js +2 -0
- package/dist/cjs/management/api/resources/experimentation/resources/experiments/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/exports.js +2 -2
- package/dist/cjs/management/api/resources/experimentation/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/experimentation/resources/index.js +37 -0
- package/dist/cjs/management/api/resources/guardian/client/Client.d.ts +40 -1
- package/dist/cjs/management/api/resources/guardian/client/Client.js +172 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/client/Client.d.ts +3 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/client/Client.js +11 -6
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/client/Client.d.ts +46 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/client/Client.js +181 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/client/index.js +2 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/exports.d.ts +2 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/exports.js +21 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/email/index.d.ts +1 -0
- package/dist/cjs/{lib → management/api/resources/guardian/resources/factors/resources/email}/index.js +1 -2
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/index.d.ts +1 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/index.js +2 -1
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/phone/client/Client.d.ts +33 -0
- package/dist/cjs/management/api/resources/guardian/resources/factors/resources/phone/client/Client.js +122 -0
- package/dist/cjs/management/api/resources/index.d.ts +1 -1
- package/dist/cjs/management/api/resources/index.js +2 -2
- package/dist/cjs/management/api/resources/organizations/client/Client.d.ts +36 -0
- package/dist/cjs/management/api/resources/organizations/client/Client.js +104 -0
- package/dist/cjs/management/api/resources/resourceServers/client/Client.d.ts +29 -0
- package/dist/cjs/management/api/resources/resourceServers/client/Client.js +103 -0
- package/dist/cjs/management/api/types/types.d.ts +226 -51
- package/dist/cjs/management/api/types/types.js +37 -36
- package/dist/cjs/management/version.d.ts +1 -1
- package/dist/cjs/management/version.js +1 -1
- package/dist/cjs/management/wrapper/ManagementClient.d.ts +9 -2
- package/dist/cjs/management/wrapper/ManagementClient.js +0 -1
- package/dist/cjs/management/wrapper/token-provider.d.ts +4 -2
- package/dist/cjs/management/wrapper/token-provider.js +142 -11
- package/dist/cjs/utils.d.ts +0 -18
- package/dist/cjs/utils.js +1 -32
- package/dist/esm/index.d.mts +0 -2
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/lib/errors.d.mts +0 -18
- package/dist/esm/lib/errors.mjs +0 -22
- package/dist/esm/lib/middleware/auth0-client-telemetry.d.mts +3 -7
- package/dist/esm/lib/middleware/auth0-client-telemetry.mjs +1 -25
- package/dist/esm/lib/models.d.mts +0 -24
- package/dist/esm/lib/models.mjs +1 -49
- package/dist/esm/management/Client.d.mts +5 -5
- package/dist/esm/management/Client.mjs +7 -7
- package/dist/esm/management/api/errors/GatewayTimeoutError.d.mts +5 -0
- package/dist/esm/management/api/errors/GatewayTimeoutError.mjs +17 -0
- package/dist/esm/management/api/errors/index.d.mts +1 -0
- package/dist/esm/management/api/errors/index.mjs +1 -0
- package/dist/esm/management/api/requests/requests.d.mts +112 -88
- package/dist/esm/management/api/resources/experimentation/client/Client.d.mts +12 -0
- package/dist/esm/management/api/resources/experimentation/client/Client.mjs +12 -0
- package/dist/esm/management/api/resources/experimentation/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/exports.d.mts +3 -0
- package/dist/esm/management/api/resources/experimentation/exports.mjs +4 -0
- package/dist/esm/management/api/resources/experimentation/index.d.mts +2 -0
- package/dist/esm/management/api/resources/experimentation/index.mjs +2 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.d.mts +34 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/Client.mjs +94 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/experiments/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/exports.mjs +1 -1
- package/dist/esm/management/api/resources/experimentation/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/experimentation/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/client/Client.d.mts +40 -1
- package/dist/esm/management/api/resources/guardian/client/Client.mjs +139 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/client/Client.d.mts +3 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/client/Client.mjs +5 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/Client.d.mts +46 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/Client.mjs +144 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/index.d.mts +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/client/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/exports.d.mts +2 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/exports.mjs +3 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/index.d.mts +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/email/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/index.d.mts +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/index.mjs +1 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/phone/client/Client.d.mts +33 -0
- package/dist/esm/management/api/resources/guardian/resources/factors/resources/phone/client/Client.mjs +122 -0
- package/dist/esm/management/api/resources/index.d.mts +1 -1
- package/dist/esm/management/api/resources/index.mjs +1 -1
- package/dist/esm/management/api/resources/organizations/client/Client.d.mts +36 -0
- package/dist/esm/management/api/resources/organizations/client/Client.mjs +104 -0
- package/dist/esm/management/api/resources/resourceServers/client/Client.d.mts +29 -0
- package/dist/esm/management/api/resources/resourceServers/client/Client.mjs +103 -0
- package/dist/esm/management/api/types/types.d.mts +226 -51
- package/dist/esm/management/api/types/types.mjs +34 -33
- package/dist/esm/management/version.d.mts +1 -1
- package/dist/esm/management/version.mjs +1 -1
- package/dist/esm/management/wrapper/ManagementClient.d.mts +9 -2
- package/dist/esm/management/wrapper/ManagementClient.mjs +0 -1
- package/dist/esm/management/wrapper/token-provider.d.mts +4 -2
- package/dist/esm/management/wrapper/token-provider.mjs +142 -11
- package/dist/esm/utils.d.mts +0 -18
- package/dist/esm/utils.mjs +0 -30
- package/package.json +45 -23
- package/reference.md +654 -389
- package/dist/cjs/auth/backchannel.d.ts +0 -158
- package/dist/cjs/auth/backchannel.js +0 -135
- package/dist/cjs/auth/base-auth-api.d.ts +0 -41
- package/dist/cjs/auth/base-auth-api.js +0 -109
- package/dist/cjs/auth/client-authentication.d.ts +0 -27
- package/dist/cjs/auth/client-authentication.js +0 -82
- package/dist/cjs/auth/database.d.ts +0 -157
- package/dist/cjs/auth/database.js +0 -94
- package/dist/cjs/auth/id-token-validator.d.ts +0 -18
- package/dist/cjs/auth/id-token-validator.js +0 -158
- package/dist/cjs/auth/index.d.ts +0 -65
- package/dist/cjs/auth/index.js +0 -80
- package/dist/cjs/auth/oauth.d.ts +0 -462
- package/dist/cjs/auth/oauth.js +0 -280
- package/dist/cjs/auth/passwordless.d.ts +0 -165
- package/dist/cjs/auth/passwordless.js +0 -173
- package/dist/cjs/auth/tokenExchange.d.ts +0 -166
- package/dist/cjs/auth/tokenExchange.js +0 -74
- package/dist/cjs/lib/index.d.ts +0 -3
- package/dist/cjs/lib/runtime.d.ts +0 -61
- package/dist/cjs/lib/runtime.js +0 -222
- package/dist/cjs/management/api/resources/organizationTemplates/client/Client.d.ts +0 -106
- package/dist/cjs/management/api/resources/organizationTemplates/client/Client.js +0 -411
- package/dist/cjs/management/api/resources/organizationTemplates/exports.d.ts +0 -2
- package/dist/cjs/userinfo/index.d.ts +0 -87
- package/dist/cjs/userinfo/index.js +0 -104
- package/dist/esm/auth/backchannel.d.mts +0 -158
- package/dist/esm/auth/backchannel.mjs +0 -131
- package/dist/esm/auth/base-auth-api.d.mts +0 -41
- package/dist/esm/auth/base-auth-api.mjs +0 -103
- package/dist/esm/auth/client-authentication.d.mts +0 -27
- package/dist/esm/auth/client-authentication.mjs +0 -45
- package/dist/esm/auth/database.d.mts +0 -157
- package/dist/esm/auth/database.mjs +0 -90
- package/dist/esm/auth/id-token-validator.d.mts +0 -18
- package/dist/esm/auth/id-token-validator.mjs +0 -120
- package/dist/esm/auth/index.d.mts +0 -65
- package/dist/esm/auth/index.mjs +0 -60
- package/dist/esm/auth/oauth.d.mts +0 -462
- package/dist/esm/auth/oauth.mjs +0 -276
- package/dist/esm/auth/passwordless.d.mts +0 -165
- package/dist/esm/auth/passwordless.mjs +0 -169
- package/dist/esm/auth/tokenExchange.d.mts +0 -166
- package/dist/esm/auth/tokenExchange.mjs +0 -70
- package/dist/esm/lib/index.d.mts +0 -3
- package/dist/esm/lib/index.mjs +0 -2
- package/dist/esm/lib/runtime.d.mts +0 -61
- package/dist/esm/lib/runtime.mjs +0 -201
- package/dist/esm/management/api/resources/organizationTemplates/client/Client.d.mts +0 -106
- package/dist/esm/management/api/resources/organizationTemplates/client/Client.mjs +0 -374
- package/dist/esm/management/api/resources/organizationTemplates/exports.d.mts +0 -2
- package/dist/esm/userinfo/index.d.mts +0 -87
- package/dist/esm/userinfo/index.mjs +0 -98
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation}/client/index.d.ts +0 -0
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation}/client/index.js +0 -0
- /package/dist/{esm/management/api/resources/organizationTemplates/client/index.d.mts → cjs/management/api/resources/experimentation/resources/experiments/client/index.d.ts} +0 -0
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.d.ts +0 -0
- /package/dist/cjs/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.js +0 -0
- /package/dist/{esm/management/api/resources/organizationTemplates/client/index.mjs → cjs/management/api/resources/guardian/resources/factors/resources/email/client/index.d.ts} +0 -0
- /package/dist/esm/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.d.mts +0 -0
- /package/dist/esm/management/api/resources/{organizationTemplates → experimentation/resources/experiments}/index.mjs +0 -0
|
@@ -1,374 +0,0 @@
|
|
|
1
|
-
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
|
|
12
|
-
import * as core from "../../../../core/index.mjs";
|
|
13
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
14
|
-
import * as environments from "../../../../environments.mjs";
|
|
15
|
-
import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.mjs";
|
|
16
|
-
import * as errors from "../../../../errors/index.mjs";
|
|
17
|
-
import * as Management from "../../../index.mjs";
|
|
18
|
-
export class OrganizationTemplatesClient {
|
|
19
|
-
constructor(options) {
|
|
20
|
-
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Retrieve a list of Organization Templates. This endpoint supports Checkpoint pagination. Results are returned in a stable order, sorted by their identifier (`id`) in ascending order.
|
|
24
|
-
*
|
|
25
|
-
* @param {Management.ListOrganizationTemplatesRequestParameters} request
|
|
26
|
-
* @param {OrganizationTemplatesClient.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.organizationTemplates.list({
|
|
35
|
-
* from: "from",
|
|
36
|
-
* take: 1
|
|
37
|
-
* })
|
|
38
|
-
*/
|
|
39
|
-
list() {
|
|
40
|
-
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
41
|
-
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
43
|
-
const { from: from_, take = 5 } = request;
|
|
44
|
-
const _queryParams = {
|
|
45
|
-
from: from_,
|
|
46
|
-
take,
|
|
47
|
-
};
|
|
48
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
49
|
-
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);
|
|
50
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
51
|
-
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, "organization-templates"),
|
|
52
|
-
method: "GET",
|
|
53
|
-
headers: _headers,
|
|
54
|
-
queryString: core.url
|
|
55
|
-
.queryBuilder()
|
|
56
|
-
.addMany(_queryParams)
|
|
57
|
-
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
58
|
-
.build(),
|
|
59
|
-
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,
|
|
60
|
-
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,
|
|
61
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
62
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
63
|
-
logging: this._options.logging,
|
|
64
|
-
});
|
|
65
|
-
if (_response.ok) {
|
|
66
|
-
return {
|
|
67
|
-
data: _response.body,
|
|
68
|
-
rawResponse: _response.rawResponse,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
if (_response.error.reason === "status-code") {
|
|
72
|
-
switch (_response.error.statusCode) {
|
|
73
|
-
case 400:
|
|
74
|
-
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
75
|
-
case 401:
|
|
76
|
-
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
77
|
-
case 403:
|
|
78
|
-
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
79
|
-
case 429:
|
|
80
|
-
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
81
|
-
default:
|
|
82
|
-
throw new errors.ManagementError({
|
|
83
|
-
statusCode: _response.error.statusCode,
|
|
84
|
-
body: _response.error.body,
|
|
85
|
-
rawResponse: _response.rawResponse,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/organization-templates");
|
|
90
|
-
}));
|
|
91
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
92
|
-
return new core.Page({
|
|
93
|
-
response: dataWithRawResponse.data,
|
|
94
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
95
|
-
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) === ""),
|
|
96
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.organization_templates) !== null && _a !== void 0 ? _a : []; },
|
|
97
|
-
loadPage: (response) => {
|
|
98
|
-
return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next));
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Create an Organization Template.
|
|
105
|
-
*
|
|
106
|
-
* @param {Management.CreateOrganizationTemplateRequestContent} request
|
|
107
|
-
* @param {OrganizationTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
-
*
|
|
109
|
-
* @throws {@link Management.BadRequestError}
|
|
110
|
-
* @throws {@link Management.UnauthorizedError}
|
|
111
|
-
* @throws {@link Management.ForbiddenError}
|
|
112
|
-
* @throws {@link Management.ConflictError}
|
|
113
|
-
* @throws {@link Management.TooManyRequestsError}
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* await client.organizationTemplates.create({
|
|
117
|
-
* name: "name",
|
|
118
|
-
* organization_deletion_behavior: "allow",
|
|
119
|
-
* enforce_permission_ceiling: true,
|
|
120
|
-
* enforce_self_assignment_restriction: true
|
|
121
|
-
* })
|
|
122
|
-
*/
|
|
123
|
-
create(request, requestOptions) {
|
|
124
|
-
return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
|
|
125
|
-
}
|
|
126
|
-
__create(request, requestOptions) {
|
|
127
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
129
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
130
|
-
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);
|
|
131
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
132
|
-
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, "organization-templates"),
|
|
133
|
-
method: "POST",
|
|
134
|
-
headers: _headers,
|
|
135
|
-
contentType: "application/json",
|
|
136
|
-
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
137
|
-
requestType: "json",
|
|
138
|
-
body: request,
|
|
139
|
-
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,
|
|
140
|
-
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,
|
|
141
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
142
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
143
|
-
logging: this._options.logging,
|
|
144
|
-
});
|
|
145
|
-
if (_response.ok) {
|
|
146
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
147
|
-
}
|
|
148
|
-
if (_response.error.reason === "status-code") {
|
|
149
|
-
switch (_response.error.statusCode) {
|
|
150
|
-
case 400:
|
|
151
|
-
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
152
|
-
case 401:
|
|
153
|
-
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
154
|
-
case 403:
|
|
155
|
-
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
156
|
-
case 409:
|
|
157
|
-
throw new Management.ConflictError(_response.error.body, _response.rawResponse);
|
|
158
|
-
case 429:
|
|
159
|
-
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
160
|
-
default:
|
|
161
|
-
throw new errors.ManagementError({
|
|
162
|
-
statusCode: _response.error.statusCode,
|
|
163
|
-
body: _response.error.body,
|
|
164
|
-
rawResponse: _response.rawResponse,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/organization-templates");
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Retrieve details about a single Organization Template specified by ID.
|
|
173
|
-
*
|
|
174
|
-
* @param {string} id - Organization Template identifier.
|
|
175
|
-
* @param {OrganizationTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
176
|
-
*
|
|
177
|
-
* @throws {@link Management.UnauthorizedError}
|
|
178
|
-
* @throws {@link Management.ForbiddenError}
|
|
179
|
-
* @throws {@link Management.NotFoundError}
|
|
180
|
-
* @throws {@link Management.TooManyRequestsError}
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* await client.organizationTemplates.get("id")
|
|
184
|
-
*/
|
|
185
|
-
get(id, requestOptions) {
|
|
186
|
-
return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
|
|
187
|
-
}
|
|
188
|
-
__get(id, requestOptions) {
|
|
189
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
191
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
192
|
-
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);
|
|
193
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
194
|
-
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, `organization-templates/${core.url.encodePathParam(id)}`),
|
|
195
|
-
method: "GET",
|
|
196
|
-
headers: _headers,
|
|
197
|
-
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
198
|
-
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,
|
|
199
|
-
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,
|
|
200
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
201
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
202
|
-
logging: this._options.logging,
|
|
203
|
-
});
|
|
204
|
-
if (_response.ok) {
|
|
205
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
206
|
-
}
|
|
207
|
-
if (_response.error.reason === "status-code") {
|
|
208
|
-
switch (_response.error.statusCode) {
|
|
209
|
-
case 401:
|
|
210
|
-
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
211
|
-
case 403:
|
|
212
|
-
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
213
|
-
case 404:
|
|
214
|
-
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
215
|
-
case 429:
|
|
216
|
-
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
217
|
-
default:
|
|
218
|
-
throw new errors.ManagementError({
|
|
219
|
-
statusCode: _response.error.statusCode,
|
|
220
|
-
body: _response.error.body,
|
|
221
|
-
rawResponse: _response.rawResponse,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/organization-templates/{id}");
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Update the details of a specific Organization Template.
|
|
230
|
-
*
|
|
231
|
-
* @param {string} id - Organization Template identifier.
|
|
232
|
-
* @param {Management.UpdateOrganizationTemplateRequestContent} request
|
|
233
|
-
* @param {OrganizationTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
234
|
-
*
|
|
235
|
-
* @throws {@link Management.BadRequestError}
|
|
236
|
-
* @throws {@link Management.UnauthorizedError}
|
|
237
|
-
* @throws {@link Management.ForbiddenError}
|
|
238
|
-
* @throws {@link Management.NotFoundError}
|
|
239
|
-
* @throws {@link Management.TooManyRequestsError}
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* await client.organizationTemplates.update("id")
|
|
243
|
-
*/
|
|
244
|
-
update(id, request = {}, requestOptions) {
|
|
245
|
-
return core.HttpResponsePromise.fromPromise(this.__update(id, request, requestOptions));
|
|
246
|
-
}
|
|
247
|
-
__update(id_1) {
|
|
248
|
-
return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
|
|
249
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
250
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
251
|
-
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);
|
|
252
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
253
|
-
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, `organization-templates/${core.url.encodePathParam(id)}`),
|
|
254
|
-
method: "PATCH",
|
|
255
|
-
headers: _headers,
|
|
256
|
-
contentType: "application/json",
|
|
257
|
-
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
258
|
-
requestType: "json",
|
|
259
|
-
body: request,
|
|
260
|
-
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,
|
|
261
|
-
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,
|
|
262
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
263
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
264
|
-
logging: this._options.logging,
|
|
265
|
-
});
|
|
266
|
-
if (_response.ok) {
|
|
267
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
268
|
-
}
|
|
269
|
-
if (_response.error.reason === "status-code") {
|
|
270
|
-
switch (_response.error.statusCode) {
|
|
271
|
-
case 400:
|
|
272
|
-
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
273
|
-
case 401:
|
|
274
|
-
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
275
|
-
case 403:
|
|
276
|
-
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
277
|
-
case 404:
|
|
278
|
-
throw new Management.NotFoundError(_response.error.body, _response.rawResponse);
|
|
279
|
-
case 429:
|
|
280
|
-
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
281
|
-
default:
|
|
282
|
-
throw new errors.ManagementError({
|
|
283
|
-
statusCode: _response.error.statusCode,
|
|
284
|
-
body: _response.error.body,
|
|
285
|
-
rawResponse: _response.rawResponse,
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PATCH", "/organization-templates/{id}");
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Retrieve a list of organizations assigned to an Organization Template. This endpoint supports Checkpoint pagination. Results are returned in a stable order, sorted by their identifier (`id`) in ascending order.
|
|
294
|
-
*
|
|
295
|
-
* @param {string} id - The ID of the organization template.
|
|
296
|
-
* @param {Management.ListTemplateOrganizationsRequestParameters} request
|
|
297
|
-
* @param {OrganizationTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
298
|
-
*
|
|
299
|
-
* @throws {@link Management.BadRequestError}
|
|
300
|
-
* @throws {@link Management.UnauthorizedError}
|
|
301
|
-
* @throws {@link Management.ForbiddenError}
|
|
302
|
-
* @throws {@link Management.TooManyRequestsError}
|
|
303
|
-
*
|
|
304
|
-
* @example
|
|
305
|
-
* await client.organizationTemplates.listOrganizations("id", {
|
|
306
|
-
* from: "from",
|
|
307
|
-
* take: 1
|
|
308
|
-
* })
|
|
309
|
-
*/
|
|
310
|
-
listOrganizations(id_1) {
|
|
311
|
-
return __awaiter(this, arguments, void 0, function* (id, request = {}, requestOptions) {
|
|
312
|
-
const list = core.HttpResponsePromise.interceptFunction((request) => __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
314
|
-
const { from: from_, take = 5 } = request;
|
|
315
|
-
const _queryParams = {
|
|
316
|
-
from: from_,
|
|
317
|
-
take,
|
|
318
|
-
};
|
|
319
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
320
|
-
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);
|
|
321
|
-
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
322
|
-
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, `organization-templates/${core.url.encodePathParam(id)}/organizations`),
|
|
323
|
-
method: "GET",
|
|
324
|
-
headers: _headers,
|
|
325
|
-
queryString: core.url
|
|
326
|
-
.queryBuilder()
|
|
327
|
-
.addMany(_queryParams)
|
|
328
|
-
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
329
|
-
.build(),
|
|
330
|
-
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,
|
|
331
|
-
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,
|
|
332
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
333
|
-
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
334
|
-
logging: this._options.logging,
|
|
335
|
-
});
|
|
336
|
-
if (_response.ok) {
|
|
337
|
-
return {
|
|
338
|
-
data: _response.body,
|
|
339
|
-
rawResponse: _response.rawResponse,
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
if (_response.error.reason === "status-code") {
|
|
343
|
-
switch (_response.error.statusCode) {
|
|
344
|
-
case 400:
|
|
345
|
-
throw new Management.BadRequestError(_response.error.body, _response.rawResponse);
|
|
346
|
-
case 401:
|
|
347
|
-
throw new Management.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
348
|
-
case 403:
|
|
349
|
-
throw new Management.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
350
|
-
case 429:
|
|
351
|
-
throw new Management.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
352
|
-
default:
|
|
353
|
-
throw new errors.ManagementError({
|
|
354
|
-
statusCode: _response.error.statusCode,
|
|
355
|
-
body: _response.error.body,
|
|
356
|
-
rawResponse: _response.rawResponse,
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/organization-templates/{id}/organizations");
|
|
361
|
-
}));
|
|
362
|
-
const dataWithRawResponse = yield list(request).withRawResponse();
|
|
363
|
-
return new core.Page({
|
|
364
|
-
response: dataWithRawResponse.data,
|
|
365
|
-
rawResponse: dataWithRawResponse.rawResponse,
|
|
366
|
-
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) === ""),
|
|
367
|
-
getItems: (response) => { var _a; return (_a = response === null || response === void 0 ? void 0 : response.organizations) !== null && _a !== void 0 ? _a : []; },
|
|
368
|
-
loadPage: (response) => {
|
|
369
|
-
return list(core.setObjectProperty(request, "from", response === null || response === void 0 ? void 0 : response.next));
|
|
370
|
-
},
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { ResponseError } from "../lib/errors.mjs";
|
|
2
|
-
import { ClientOptions, InitOverride, JSONApiResponse } from "../lib/models.mjs";
|
|
3
|
-
import { BaseAPI } from "../lib/runtime.mjs";
|
|
4
|
-
/**
|
|
5
|
-
* Response interface for the UserInfo endpoint
|
|
6
|
-
* @group UserInfo API
|
|
7
|
-
*/
|
|
8
|
-
export interface UserInfoResponse {
|
|
9
|
-
sub: string;
|
|
10
|
-
name: string;
|
|
11
|
-
given_name?: string;
|
|
12
|
-
family_name?: string;
|
|
13
|
-
middle_name?: string;
|
|
14
|
-
nickname: string;
|
|
15
|
-
preferred_username?: string;
|
|
16
|
-
profile?: string;
|
|
17
|
-
picture?: string;
|
|
18
|
-
website?: string;
|
|
19
|
-
email: string;
|
|
20
|
-
email_verified: boolean;
|
|
21
|
-
gender?: string;
|
|
22
|
-
birthdate?: string;
|
|
23
|
-
zoneinfo?: string;
|
|
24
|
-
locale?: string;
|
|
25
|
-
phone_number?: string;
|
|
26
|
-
phone_number_verified?: string;
|
|
27
|
-
address?: {
|
|
28
|
-
country?: string;
|
|
29
|
-
};
|
|
30
|
-
updated_at: string;
|
|
31
|
-
[key: string]: unknown;
|
|
32
|
-
}
|
|
33
|
-
export declare class UserInfoError extends Error {
|
|
34
|
-
error: string;
|
|
35
|
-
error_description: string;
|
|
36
|
-
statusCode: number;
|
|
37
|
-
body: string;
|
|
38
|
-
headers: Headers;
|
|
39
|
-
name: "UserInfoError";
|
|
40
|
-
constructor(error: string, error_description: string, statusCode: number, body: string, headers: Headers);
|
|
41
|
-
}
|
|
42
|
-
export declare function parseError(response: Response): Promise<ResponseError | UserInfoError>;
|
|
43
|
-
/**
|
|
44
|
-
* Auth0 UserInfo API Client
|
|
45
|
-
*
|
|
46
|
-
* Provides access to the UserInfo endpoint to retrieve user profile information
|
|
47
|
-
* using an access token obtained during authentication.
|
|
48
|
-
*
|
|
49
|
-
* @group UserInfo API
|
|
50
|
-
*
|
|
51
|
-
* @example Basic usage
|
|
52
|
-
* ```typescript
|
|
53
|
-
* import { UserInfoClient } from 'auth0';
|
|
54
|
-
*
|
|
55
|
-
* const userInfoClient = new UserInfoClient({
|
|
56
|
-
* domain: 'your-tenant.auth0.com'
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* const userInfo = await userInfoClient.getUserInfo(accessToken);
|
|
60
|
-
* console.log(userInfo.data.sub, userInfo.data.email);
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare class UserInfoClient extends BaseAPI {
|
|
64
|
-
/**
|
|
65
|
-
* Create a new UserInfo API client
|
|
66
|
-
* @param options - Configuration options including domain and client settings
|
|
67
|
-
*/
|
|
68
|
-
constructor(options: {
|
|
69
|
-
domain: string;
|
|
70
|
-
} & ClientOptions);
|
|
71
|
-
/**
|
|
72
|
-
* Given an access token get the user profile linked to it.
|
|
73
|
-
*
|
|
74
|
-
* @example <caption>
|
|
75
|
-
* Get the user information based on the Auth0 access token (obtained during
|
|
76
|
-
* login). Find more information in the
|
|
77
|
-
* <a href="https://auth0.com/docs/auth-api#!#get--userinfo">API Docs</a>.
|
|
78
|
-
* </caption>
|
|
79
|
-
*
|
|
80
|
-
* const userInfoClient = new UserInfoClient({
|
|
81
|
-
* domain: '...'
|
|
82
|
-
* });
|
|
83
|
-
|
|
84
|
-
* const userInfo = await userInfoClient.getUserInfo(accessToken);
|
|
85
|
-
*/
|
|
86
|
-
getUserInfo(accessToken: string, initOverrides?: InitOverride): Promise<JSONApiResponse<UserInfoResponse>>;
|
|
87
|
-
}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { ResponseError } from "../lib/errors.mjs";
|
|
11
|
-
import { Auth0ClientTelemetry } from "../lib/middleware/auth0-client-telemetry.mjs";
|
|
12
|
-
import { JSONApiResponse } from "../lib/models.mjs";
|
|
13
|
-
import { BaseAPI } from "../lib/runtime.mjs";
|
|
14
|
-
export class UserInfoError extends Error {
|
|
15
|
-
constructor(error, error_description, statusCode, body, headers) {
|
|
16
|
-
super(error_description || error);
|
|
17
|
-
this.error = error;
|
|
18
|
-
this.error_description = error_description;
|
|
19
|
-
this.statusCode = statusCode;
|
|
20
|
-
this.body = body;
|
|
21
|
-
this.headers = headers;
|
|
22
|
-
this.name = "UserInfoError";
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function parseError(response) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
// Errors typically have a specific format:
|
|
28
|
-
// {
|
|
29
|
-
// error: 'invalid_body',
|
|
30
|
-
// error_description: 'Bad Request',
|
|
31
|
-
// }
|
|
32
|
-
const body = yield response.text();
|
|
33
|
-
let data;
|
|
34
|
-
try {
|
|
35
|
-
data = JSON.parse(body);
|
|
36
|
-
return new UserInfoError(data.error, data.error_description, response.status, body, response.headers);
|
|
37
|
-
}
|
|
38
|
-
catch (_a) {
|
|
39
|
-
return new ResponseError(response.status, body, response.headers, "Response returned an error code");
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Auth0 UserInfo API Client
|
|
45
|
-
*
|
|
46
|
-
* Provides access to the UserInfo endpoint to retrieve user profile information
|
|
47
|
-
* using an access token obtained during authentication.
|
|
48
|
-
*
|
|
49
|
-
* @group UserInfo API
|
|
50
|
-
*
|
|
51
|
-
* @example Basic usage
|
|
52
|
-
* ```typescript
|
|
53
|
-
* import { UserInfoClient } from 'auth0';
|
|
54
|
-
*
|
|
55
|
-
* const userInfoClient = new UserInfoClient({
|
|
56
|
-
* domain: 'your-tenant.auth0.com'
|
|
57
|
-
* });
|
|
58
|
-
*
|
|
59
|
-
* const userInfo = await userInfoClient.getUserInfo(accessToken);
|
|
60
|
-
* console.log(userInfo.data.sub, userInfo.data.email);
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export class UserInfoClient extends BaseAPI {
|
|
64
|
-
/**
|
|
65
|
-
* Create a new UserInfo API client
|
|
66
|
-
* @param options - Configuration options including domain and client settings
|
|
67
|
-
*/
|
|
68
|
-
constructor(options) {
|
|
69
|
-
super(Object.assign(Object.assign({}, options), { baseUrl: `https://${options.domain}`, middleware: options.telemetry !== false ? [new Auth0ClientTelemetry(options)] : [], parseError }));
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Given an access token get the user profile linked to it.
|
|
73
|
-
*
|
|
74
|
-
* @example <caption>
|
|
75
|
-
* Get the user information based on the Auth0 access token (obtained during
|
|
76
|
-
* login). Find more information in the
|
|
77
|
-
* <a href="https://auth0.com/docs/auth-api#!#get--userinfo">API Docs</a>.
|
|
78
|
-
* </caption>
|
|
79
|
-
*
|
|
80
|
-
* const userInfoClient = new UserInfoClient({
|
|
81
|
-
* domain: '...'
|
|
82
|
-
* });
|
|
83
|
-
|
|
84
|
-
* const userInfo = await userInfoClient.getUserInfo(accessToken);
|
|
85
|
-
*/
|
|
86
|
-
getUserInfo(accessToken, initOverrides) {
|
|
87
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
const response = yield this.request({
|
|
89
|
-
path: `/userinfo`,
|
|
90
|
-
method: "GET",
|
|
91
|
-
headers: {
|
|
92
|
-
Authorization: `Bearer ${accessToken}`,
|
|
93
|
-
},
|
|
94
|
-
}, initOverrides);
|
|
95
|
-
return JSONApiResponse.fromResponse(response);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
File without changes
|
/package/dist/cjs/management/api/resources/{organizationTemplates → experimentation}/client/index.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|