auth0 5.3.0 → 5.4.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/dist/cjs/management/BaseClient.d.ts +4 -4
- package/dist/cjs/management/api/requests/requests.d.ts +50 -134
- package/dist/cjs/management/api/requests/requests.js +0 -108
- package/dist/cjs/management/api/resources/actions/client/Client.js +25 -37
- package/dist/cjs/management/api/resources/actions/resources/modules/client/Client.js +22 -28
- package/dist/cjs/management/api/resources/actions/resources/modules/resources/versions/client/Client.d.ts +6 -3
- package/dist/cjs/management/api/resources/actions/resources/modules/resources/versions/client/Client.js +65 -45
- package/dist/cjs/management/api/resources/actions/resources/triggers/resources/bindings/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/actions/resources/versions/client/Client.d.ts +2 -2
- package/dist/cjs/management/api/resources/actions/resources/versions/client/Client.js +13 -16
- package/dist/cjs/management/api/resources/branding/resources/phone/resources/providers/client/Client.js +10 -11
- package/dist/cjs/management/api/resources/branding/resources/phone/resources/templates/client/Client.js +10 -11
- package/dist/cjs/management/api/resources/clientGrants/client/Client.js +15 -26
- package/dist/cjs/management/api/resources/clientGrants/resources/organizations/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/clients/client/Client.js +29 -49
- package/dist/cjs/management/api/resources/clients/resources/connections/client/Client.js +18 -28
- package/dist/cjs/management/api/resources/connectionProfiles/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/connections/client/Client.d.ts +2 -2
- package/dist/cjs/management/api/resources/connections/client/Client.js +34 -49
- package/dist/cjs/management/api/resources/connections/resources/clients/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/connections/resources/directoryProvisioning/client/Client.js +13 -16
- package/dist/cjs/management/api/resources/connections/resources/keys/client/Client.d.ts +19 -0
- package/dist/cjs/management/api/resources/connections/resources/keys/client/Client.js +71 -1
- package/dist/cjs/management/api/resources/connections/resources/scimConfiguration/client/Client.d.ts +18 -0
- package/dist/cjs/management/api/resources/connections/resources/scimConfiguration/client/Client.js +78 -1
- package/dist/cjs/management/api/resources/connections/resources/users/client/Client.js +3 -2
- package/dist/cjs/management/api/resources/customDomains/client/Client.js +13 -20
- package/dist/cjs/management/api/resources/deviceCredentials/client/Client.js +17 -32
- package/dist/cjs/management/api/resources/emails/resources/provider/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/eventStreams/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/eventStreams/resources/deliveries/client/Client.js +15 -26
- package/dist/cjs/management/api/resources/flows/client/Client.d.ts +2 -2
- package/dist/cjs/management/api/resources/flows/client/Client.js +22 -38
- package/dist/cjs/management/api/resources/flows/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/flows/index.js +0 -1
- package/dist/cjs/management/api/resources/flows/resources/executions/client/Client.d.ts +4 -4
- package/dist/cjs/management/api/resources/flows/resources/executions/client/Client.js +16 -25
- package/dist/cjs/management/api/resources/flows/resources/executions/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/flows/resources/executions/index.js +0 -1
- package/dist/cjs/management/api/resources/flows/resources/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/flows/resources/index.js +0 -4
- package/dist/cjs/management/api/resources/flows/resources/vault/resources/connections/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/forms/client/Client.js +20 -34
- package/dist/cjs/management/api/resources/groups/client/Client.js +16 -29
- package/dist/cjs/management/api/resources/groups/resources/members/client/Client.js +13 -20
- package/dist/cjs/management/api/resources/hooks/client/Client.js +18 -30
- package/dist/cjs/management/api/resources/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/index.js +0 -1
- package/dist/cjs/management/api/resources/jobs/resources/usersImports/client/Client.js +14 -14
- package/dist/cjs/management/api/resources/keys/resources/encryption/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/logs/client/Client.js +16 -29
- package/dist/cjs/management/api/resources/networkAcls/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/organizations/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/organizations/resources/clientGrants/client/Client.js +15 -31
- package/dist/cjs/management/api/resources/organizations/resources/discoveryDomains/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/organizations/resources/enabledConnections/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/organizations/resources/invitations/client/Client.js +26 -40
- package/dist/cjs/management/api/resources/organizations/resources/members/client/Client.js +13 -20
- package/dist/cjs/management/api/resources/organizations/resources/members/resources/roles/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/prompts/resources/rendering/client/Client.js +17 -32
- package/dist/cjs/management/api/resources/resourceServers/client/Client.js +24 -39
- package/dist/cjs/management/api/resources/roles/client/Client.js +13 -20
- package/dist/cjs/management/api/resources/roles/resources/permissions/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/roles/resources/users/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/rules/client/Client.js +26 -40
- package/dist/cjs/management/api/resources/selfServiceProfiles/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/stats/client/Client.js +4 -7
- package/dist/cjs/management/api/resources/tenants/resources/settings/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/tokenExchangeProfiles/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/userAttributeProfiles/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/userBlocks/client/Client.js +24 -25
- package/dist/cjs/management/api/resources/userGrants/client/Client.js +18 -28
- package/dist/cjs/management/api/resources/users/client/Client.js +42 -67
- package/dist/cjs/management/api/resources/users/resources/authenticationMethods/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/users/resources/connectedAccounts/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/users/resources/groups/client/Client.js +13 -20
- package/dist/cjs/management/api/resources/users/resources/logs/client/Client.js +13 -20
- package/dist/cjs/management/api/resources/users/resources/organizations/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/users/resources/permissions/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/users/resources/refreshToken/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/users/resources/roles/client/Client.js +12 -17
- package/dist/cjs/management/api/resources/users/resources/sessions/client/Client.js +11 -14
- package/dist/cjs/management/api/resources/verifiableCredentials/resources/verification/resources/templates/client/Client.js +11 -14
- package/dist/cjs/management/api/types/types.d.ts +5257 -4642
- package/dist/cjs/management/api/types/types.js +457 -431
- package/dist/cjs/management/auth/BearerAuthProvider.d.ts +14 -10
- package/dist/cjs/management/auth/BearerAuthProvider.js +15 -6
- package/dist/cjs/management/core/fetcher/EndpointSupplier.d.ts +2 -2
- package/dist/cjs/management/core/fetcher/Fetcher.d.ts +1 -2
- package/dist/cjs/management/core/fetcher/Fetcher.js +7 -1
- package/dist/cjs/management/core/form-data-utils/FormDataWrapper.js +1 -1
- package/dist/cjs/management/core/headers.d.ts +2 -2
- package/dist/cjs/management/core/pagination/CustomPager.d.ts +29 -44
- package/dist/cjs/management/core/pagination/CustomPager.js +60 -42
- package/dist/cjs/management/core/pagination/exports.d.ts +0 -1
- package/dist/cjs/management/core/pagination/exports.js +0 -3
- package/dist/cjs/management/core/pagination/index.d.ts +1 -1
- package/dist/cjs/management/core/pagination/index.js +2 -1
- package/dist/cjs/management/version.d.ts +1 -1
- package/dist/cjs/management/version.js +1 -1
- package/dist/esm/management/BaseClient.d.mts +4 -4
- package/dist/esm/management/api/requests/requests.d.mts +50 -134
- package/dist/esm/management/api/requests/requests.mjs +1 -107
- package/dist/esm/management/api/resources/actions/client/Client.mjs +25 -37
- package/dist/esm/management/api/resources/actions/resources/modules/client/Client.mjs +22 -28
- package/dist/esm/management/api/resources/actions/resources/modules/resources/versions/client/Client.d.mts +6 -3
- package/dist/esm/management/api/resources/actions/resources/modules/resources/versions/client/Client.mjs +65 -45
- package/dist/esm/management/api/resources/actions/resources/triggers/resources/bindings/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/actions/resources/versions/client/Client.d.mts +2 -2
- package/dist/esm/management/api/resources/actions/resources/versions/client/Client.mjs +13 -16
- package/dist/esm/management/api/resources/branding/resources/phone/resources/providers/client/Client.mjs +10 -11
- package/dist/esm/management/api/resources/branding/resources/phone/resources/templates/client/Client.mjs +10 -11
- package/dist/esm/management/api/resources/clientGrants/client/Client.mjs +15 -26
- package/dist/esm/management/api/resources/clientGrants/resources/organizations/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/clients/client/Client.mjs +29 -49
- package/dist/esm/management/api/resources/clients/resources/connections/client/Client.mjs +18 -28
- package/dist/esm/management/api/resources/connectionProfiles/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/connections/client/Client.d.mts +2 -2
- package/dist/esm/management/api/resources/connections/client/Client.mjs +34 -49
- package/dist/esm/management/api/resources/connections/resources/clients/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/connections/resources/directoryProvisioning/client/Client.mjs +13 -16
- package/dist/esm/management/api/resources/connections/resources/keys/client/Client.d.mts +19 -0
- package/dist/esm/management/api/resources/connections/resources/keys/client/Client.mjs +71 -1
- package/dist/esm/management/api/resources/connections/resources/scimConfiguration/client/Client.d.mts +18 -0
- package/dist/esm/management/api/resources/connections/resources/scimConfiguration/client/Client.mjs +78 -1
- package/dist/esm/management/api/resources/connections/resources/users/client/Client.mjs +3 -2
- package/dist/esm/management/api/resources/customDomains/client/Client.mjs +13 -20
- package/dist/esm/management/api/resources/deviceCredentials/client/Client.mjs +17 -32
- package/dist/esm/management/api/resources/emails/resources/provider/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/eventStreams/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/eventStreams/resources/deliveries/client/Client.mjs +15 -26
- package/dist/esm/management/api/resources/flows/client/Client.d.mts +2 -2
- package/dist/esm/management/api/resources/flows/client/Client.mjs +22 -38
- package/dist/esm/management/api/resources/flows/index.d.mts +0 -1
- package/dist/esm/management/api/resources/flows/index.mjs +0 -1
- package/dist/esm/management/api/resources/flows/resources/executions/client/Client.d.mts +4 -4
- package/dist/esm/management/api/resources/flows/resources/executions/client/Client.mjs +16 -25
- package/dist/esm/management/api/resources/flows/resources/executions/index.d.mts +0 -1
- package/dist/esm/management/api/resources/flows/resources/executions/index.mjs +0 -1
- package/dist/esm/management/api/resources/flows/resources/index.d.mts +0 -1
- package/dist/esm/management/api/resources/flows/resources/index.mjs +0 -1
- package/dist/esm/management/api/resources/flows/resources/vault/resources/connections/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/forms/client/Client.mjs +20 -34
- package/dist/esm/management/api/resources/groups/client/Client.mjs +16 -29
- package/dist/esm/management/api/resources/groups/resources/members/client/Client.mjs +13 -20
- package/dist/esm/management/api/resources/hooks/client/Client.mjs +18 -30
- package/dist/esm/management/api/resources/index.d.mts +0 -1
- package/dist/esm/management/api/resources/index.mjs +0 -1
- package/dist/esm/management/api/resources/jobs/resources/usersImports/client/Client.mjs +14 -14
- package/dist/esm/management/api/resources/keys/resources/encryption/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/logs/client/Client.mjs +16 -29
- package/dist/esm/management/api/resources/networkAcls/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/organizations/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/organizations/resources/clientGrants/client/Client.mjs +15 -31
- package/dist/esm/management/api/resources/organizations/resources/discoveryDomains/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/organizations/resources/enabledConnections/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/organizations/resources/invitations/client/Client.mjs +26 -40
- package/dist/esm/management/api/resources/organizations/resources/members/client/Client.mjs +13 -20
- package/dist/esm/management/api/resources/organizations/resources/members/resources/roles/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/prompts/resources/rendering/client/Client.mjs +17 -32
- package/dist/esm/management/api/resources/resourceServers/client/Client.mjs +24 -39
- package/dist/esm/management/api/resources/roles/client/Client.mjs +13 -20
- package/dist/esm/management/api/resources/roles/resources/permissions/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/roles/resources/users/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/rules/client/Client.mjs +26 -40
- package/dist/esm/management/api/resources/selfServiceProfiles/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/stats/client/Client.mjs +4 -7
- package/dist/esm/management/api/resources/tenants/resources/settings/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/tokenExchangeProfiles/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/userAttributeProfiles/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/userBlocks/client/Client.mjs +24 -25
- package/dist/esm/management/api/resources/userGrants/client/Client.mjs +18 -28
- package/dist/esm/management/api/resources/users/client/Client.mjs +42 -67
- package/dist/esm/management/api/resources/users/resources/authenticationMethods/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/users/resources/connectedAccounts/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/users/resources/groups/client/Client.mjs +13 -20
- package/dist/esm/management/api/resources/users/resources/logs/client/Client.mjs +13 -20
- package/dist/esm/management/api/resources/users/resources/organizations/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/users/resources/permissions/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/users/resources/refreshToken/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/users/resources/roles/client/Client.mjs +12 -17
- package/dist/esm/management/api/resources/users/resources/sessions/client/Client.mjs +11 -14
- package/dist/esm/management/api/resources/verifiableCredentials/resources/verification/resources/templates/client/Client.mjs +11 -14
- package/dist/esm/management/api/types/types.d.mts +5257 -4642
- package/dist/esm/management/api/types/types.mjs +447 -421
- package/dist/esm/management/auth/BearerAuthProvider.d.mts +14 -10
- package/dist/esm/management/auth/BearerAuthProvider.mjs +15 -6
- package/dist/esm/management/core/fetcher/EndpointSupplier.d.mts +2 -2
- package/dist/esm/management/core/fetcher/Fetcher.d.mts +1 -2
- package/dist/esm/management/core/fetcher/Fetcher.mjs +7 -1
- package/dist/esm/management/core/form-data-utils/FormDataWrapper.mjs +1 -1
- package/dist/esm/management/core/headers.d.mts +2 -2
- package/dist/esm/management/core/pagination/CustomPager.d.mts +29 -44
- package/dist/esm/management/core/pagination/CustomPager.mjs +58 -41
- package/dist/esm/management/core/pagination/exports.d.mts +0 -1
- package/dist/esm/management/core/pagination/exports.mjs +1 -1
- package/dist/esm/management/core/pagination/index.d.mts +1 -1
- package/dist/esm/management/core/pagination/index.mjs +1 -1
- package/dist/esm/management/version.d.mts +1 -1
- package/dist/esm/management/version.mjs +1 -1
- package/package.json +4 -3
- package/reference.md +302 -124
- package/dist/cjs/management/api/resources/flows/resources/executions/types/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/flows/resources/executions/types/index.js +0 -17
- package/dist/cjs/management/api/resources/flows/resources/executions/types/types.d.ts +0 -4
- package/dist/cjs/management/api/resources/flows/resources/executions/types/types.js +0 -7
- package/dist/cjs/management/api/resources/flows/types/index.d.ts +0 -1
- package/dist/cjs/management/api/resources/flows/types/index.js +0 -17
- package/dist/cjs/management/api/resources/flows/types/types.d.ts +0 -4
- package/dist/cjs/management/api/resources/flows/types/types.js +0 -7
- package/dist/esm/management/api/resources/flows/resources/executions/types/index.d.mts +0 -1
- package/dist/esm/management/api/resources/flows/resources/executions/types/index.mjs +0 -1
- package/dist/esm/management/api/resources/flows/resources/executions/types/types.d.mts +0 -4
- package/dist/esm/management/api/resources/flows/resources/executions/types/types.mjs +0 -4
- package/dist/esm/management/api/resources/flows/types/index.d.mts +0 -1
- package/dist/esm/management/api/resources/flows/types/index.mjs +0 -1
- package/dist/esm/management/api/resources/flows/types/types.d.mts +0 -4
- package/dist/esm/management/api/resources/flows/types/types.mjs +0 -4
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as core from "../core/index.mjs";
|
|
2
|
-
|
|
3
|
-
interface AuthOptions {
|
|
4
|
-
token: core.Supplier<core.BearerToken>;
|
|
5
|
-
}
|
|
6
|
-
interface Options extends AuthOptions {
|
|
7
|
-
}
|
|
8
|
-
}
|
|
2
|
+
declare const TOKEN_PARAM: "token";
|
|
9
3
|
export declare class BearerAuthProvider implements core.AuthProvider {
|
|
10
|
-
private readonly
|
|
4
|
+
private readonly options;
|
|
11
5
|
constructor(options: BearerAuthProvider.Options);
|
|
12
|
-
static canCreate(options: BearerAuthProvider.Options): boolean;
|
|
13
|
-
getAuthRequest(
|
|
6
|
+
static canCreate(options: Partial<BearerAuthProvider.Options>): boolean;
|
|
7
|
+
getAuthRequest({ endpointMetadata, }?: {
|
|
14
8
|
endpointMetadata?: core.EndpointMetadata;
|
|
15
9
|
}): Promise<core.AuthRequest>;
|
|
16
10
|
}
|
|
11
|
+
export declare namespace BearerAuthProvider {
|
|
12
|
+
const AUTH_SCHEME: "bearerAuth";
|
|
13
|
+
const AUTH_CONFIG_ERROR_MESSAGE: string;
|
|
14
|
+
type Options = AuthOptions;
|
|
15
|
+
type AuthOptions = {
|
|
16
|
+
[TOKEN_PARAM]: core.Supplier<core.BearerToken>;
|
|
17
|
+
};
|
|
18
|
+
function createInstance(options: Options): core.AuthProvider;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -10,19 +10,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
import * as core from "../core/index.mjs";
|
|
12
12
|
import * as errors from "../errors/index.mjs";
|
|
13
|
+
const TOKEN_PARAM = "token";
|
|
13
14
|
export class BearerAuthProvider {
|
|
14
15
|
constructor(options) {
|
|
15
|
-
this.
|
|
16
|
+
this.options = options;
|
|
16
17
|
}
|
|
17
18
|
static canCreate(options) {
|
|
18
|
-
return options
|
|
19
|
+
return (options === null || options === void 0 ? void 0 : options[TOKEN_PARAM]) != null;
|
|
19
20
|
}
|
|
20
|
-
getAuthRequest(
|
|
21
|
-
return __awaiter(this,
|
|
22
|
-
const token = yield core.Supplier.get(this.
|
|
21
|
+
getAuthRequest() {
|
|
22
|
+
return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
|
|
23
|
+
const token = yield core.Supplier.get(this.options[TOKEN_PARAM]);
|
|
23
24
|
if (token == null) {
|
|
24
25
|
throw new errors.ManagementError({
|
|
25
|
-
message:
|
|
26
|
+
message: BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
return {
|
|
@@ -31,3 +32,11 @@ export class BearerAuthProvider {
|
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
(function (BearerAuthProvider) {
|
|
36
|
+
BearerAuthProvider.AUTH_SCHEME = "bearerAuth";
|
|
37
|
+
BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${TOKEN_PARAM}' when initializing the client`;
|
|
38
|
+
function createInstance(options) {
|
|
39
|
+
return new BearerAuthProvider(options);
|
|
40
|
+
}
|
|
41
|
+
BearerAuthProvider.createInstance = createInstance;
|
|
42
|
+
})(BearerAuthProvider || (BearerAuthProvider = {}));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
2
2
|
import type { Supplier } from "./Supplier.mjs";
|
|
3
3
|
type EndpointSupplierFn<T> = (arg: {
|
|
4
|
-
endpointMetadata
|
|
4
|
+
endpointMetadata?: EndpointMetadata;
|
|
5
5
|
}) => T | Promise<T>;
|
|
6
6
|
export type EndpointSupplier<T> = Supplier<T> | EndpointSupplierFn<T>;
|
|
7
7
|
export declare const EndpointSupplier: {
|
|
8
8
|
get: <T>(supplier: EndpointSupplier<T>, arg: {
|
|
9
|
-
endpointMetadata
|
|
9
|
+
endpointMetadata?: EndpointMetadata;
|
|
10
10
|
}) => Promise<T>;
|
|
11
11
|
};
|
|
12
12
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { type LogConfig, type Logger } from "../logging/logger.mjs";
|
|
2
2
|
import type { APIResponse } from "./APIResponse.mjs";
|
|
3
3
|
import type { EndpointMetadata } from "./EndpointMetadata.mjs";
|
|
4
|
-
import { EndpointSupplier } from "./EndpointSupplier.mjs";
|
|
5
4
|
export type FetchFunction = <R = unknown>(args: Fetcher.Args) => Promise<APIResponse<R, Fetcher.Error>>;
|
|
6
5
|
export declare namespace Fetcher {
|
|
7
6
|
interface Args {
|
|
8
7
|
url: string;
|
|
9
8
|
method: string;
|
|
10
9
|
contentType?: string;
|
|
11
|
-
headers?: Record<string,
|
|
10
|
+
headers?: Record<string, unknown>;
|
|
12
11
|
queryParameters?: Record<string, unknown>;
|
|
13
12
|
body?: unknown;
|
|
14
13
|
timeoutMs?: number;
|
|
@@ -152,7 +152,13 @@ function getHeaders(args) {
|
|
|
152
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
153
|
var _a;
|
|
154
154
|
const newHeaders = new Headers();
|
|
155
|
-
newHeaders.set("Accept", args.responseType === "json"
|
|
155
|
+
newHeaders.set("Accept", args.responseType === "json"
|
|
156
|
+
? "application/json"
|
|
157
|
+
: args.responseType === "text"
|
|
158
|
+
? "text/plain"
|
|
159
|
+
: args.responseType === "sse"
|
|
160
|
+
? "text/event-stream"
|
|
161
|
+
: "*/*");
|
|
156
162
|
if (args.body !== undefined && args.contentType != null) {
|
|
157
163
|
newHeaders.set("Content-Type", args.contentType);
|
|
158
164
|
}
|
|
@@ -115,7 +115,7 @@ function streamToBuffer(stream) {
|
|
|
115
115
|
}
|
|
116
116
|
return Buffer.from(result);
|
|
117
117
|
}
|
|
118
|
-
throw new Error(
|
|
118
|
+
throw new Error(`Unsupported stream type: ${typeof stream}. Expected Node.js Readable stream or Web ReadableStream.`);
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
function convertToBlob(value, contentType) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function mergeHeaders
|
|
2
|
-
export declare function mergeOnlyDefinedHeaders
|
|
1
|
+
export declare function mergeHeaders(...headersArray: (Record<string, unknown> | null | undefined)[]): Record<string, unknown>;
|
|
2
|
+
export declare function mergeOnlyDefinedHeaders(...headersArray: (Record<string, unknown> | null | undefined)[]): Record<string, unknown>;
|
|
@@ -1,49 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { BaseRequestOptions, NormalizedClientOptions } from "../../BaseClient.mjs";
|
|
2
|
+
import type { APIResponse } from "../fetcher/APIResponse.mjs";
|
|
3
|
+
import type { Fetcher } from "../fetcher/Fetcher.mjs";
|
|
4
|
+
import type { RawResponse } from "../fetcher/index.mjs";
|
|
2
5
|
/**
|
|
3
|
-
* Parser function type for custom pagination.
|
|
4
|
-
* SDK authors implement this to define how to extract items and determine pagination state.
|
|
5
|
-
*
|
|
6
|
-
* @template TItem The type of items in the paginated response.
|
|
7
|
-
* @template TRequest The type of the request object.
|
|
8
|
-
* @template TResponse The type of the API response.
|
|
9
|
-
*/
|
|
10
|
-
export type CustomPagerParser<TItem, TRequest, TResponse> = (request: TRequest, response: WithRawResponse<TResponse>) => Promise<{
|
|
11
|
-
/** The request to use for fetching the next page, if any */
|
|
12
|
-
nextRequest?: TRequest;
|
|
13
|
-
/** Whether there is a next page available */
|
|
14
|
-
hasNextPage: boolean;
|
|
15
|
-
/** The request to use for fetching the previous page, if any */
|
|
16
|
-
previousRequest?: TRequest;
|
|
17
|
-
/** Whether there is a previous page available */
|
|
18
|
-
hasPreviousPage: boolean;
|
|
19
|
-
/** The items extracted from the current response */
|
|
20
|
-
items: TItem[];
|
|
21
|
-
}>;
|
|
22
|
-
/**
|
|
23
|
-
* A custom pager for paginated API responses where the pagination logic
|
|
24
|
-
* must be implemented by the SDK author.
|
|
25
|
-
*
|
|
26
|
-
* SDK authors provide a parser callback to extract items and determine
|
|
27
|
-
* pagination state from responses.
|
|
28
6
|
*
|
|
29
7
|
* @template TItem The type of the items in the page.
|
|
30
|
-
* @template TRequest The type of the request object.
|
|
31
8
|
* @template TResponse The type of the API response.
|
|
32
9
|
*/
|
|
33
|
-
export declare class CustomPager<TItem,
|
|
10
|
+
export declare class CustomPager<TItem, TResponse> implements AsyncIterable<TItem> {
|
|
34
11
|
/** The items from the current page */
|
|
35
12
|
data: TItem[];
|
|
36
13
|
/** The raw HTTP response */
|
|
37
14
|
rawResponse: RawResponse;
|
|
38
15
|
/** The parsed response object */
|
|
39
16
|
response: TResponse;
|
|
40
|
-
private
|
|
41
|
-
private parser;
|
|
17
|
+
private sendRequest;
|
|
42
18
|
private nextRequest?;
|
|
43
19
|
private previousRequest?;
|
|
44
20
|
private _hasNextPage;
|
|
45
21
|
private _hasPreviousPage;
|
|
46
|
-
|
|
22
|
+
constructor(args: {
|
|
23
|
+
response: TResponse;
|
|
24
|
+
rawResponse: RawResponse;
|
|
25
|
+
items: TItem[];
|
|
26
|
+
hasNextPage: boolean;
|
|
27
|
+
hasPreviousPage: boolean;
|
|
28
|
+
nextRequest?: Fetcher.Args;
|
|
29
|
+
previousRequest?: Fetcher.Args;
|
|
30
|
+
sendRequest: (request: Fetcher.Args) => Promise<APIResponse<TResponse, Fetcher.Error>>;
|
|
31
|
+
});
|
|
47
32
|
/**
|
|
48
33
|
* @returns whether there is a next page to load
|
|
49
34
|
*/
|
|
@@ -52,6 +37,13 @@ export declare class CustomPager<TItem, TRequest, TResponse> implements AsyncIte
|
|
|
52
37
|
* @returns whether there is a previous page to load
|
|
53
38
|
*/
|
|
54
39
|
hasPreviousPage(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the current page data.
|
|
42
|
+
* This is an alias for the `data` property for consistency with other pagination APIs.
|
|
43
|
+
*
|
|
44
|
+
* @returns the items from the current page
|
|
45
|
+
*/
|
|
46
|
+
getCurrentPage(): TItem[];
|
|
55
47
|
/**
|
|
56
48
|
* Retrieves the next page of results.
|
|
57
49
|
* @returns this pager with updated data
|
|
@@ -66,17 +58,10 @@ export declare class CustomPager<TItem, TRequest, TResponse> implements AsyncIte
|
|
|
66
58
|
getPreviousPage(): Promise<this>;
|
|
67
59
|
private iterMessages;
|
|
68
60
|
[Symbol.asyncIterator](): AsyncIterator<TItem, void, unknown>;
|
|
69
|
-
/**
|
|
70
|
-
* Creates a CustomPager by making the initial request and parsing the response.
|
|
71
|
-
*
|
|
72
|
-
* @param args.sendRequest Function to send a request and get a response
|
|
73
|
-
* @param args.initialRequest The initial request to start pagination
|
|
74
|
-
* @param args.parse The parser function to extract items and pagination state
|
|
75
|
-
* @returns A new CustomPager instance
|
|
76
|
-
*/
|
|
77
|
-
static create<TItem, TRequest, TResponse>(args: {
|
|
78
|
-
sendRequest: (request: TRequest) => HttpResponsePromise<TResponse>;
|
|
79
|
-
initialRequest: TRequest;
|
|
80
|
-
parse: CustomPagerParser<TItem, TRequest, TResponse>;
|
|
81
|
-
}): Promise<CustomPager<TItem, TRequest, TResponse>>;
|
|
82
61
|
}
|
|
62
|
+
export declare function createCustomPager<TItem, TResponse>({ sendRequest, initialHttpRequest, clientOptions, }: {
|
|
63
|
+
sendRequest: (request: Fetcher.Args) => Promise<APIResponse<TResponse, Fetcher.Error>>;
|
|
64
|
+
initialHttpRequest: Fetcher.Args;
|
|
65
|
+
clientOptions: NormalizedClientOptions;
|
|
66
|
+
requestOptions?: BaseRequestOptions;
|
|
67
|
+
}): Promise<CustomPager<TItem, TResponse>>;
|
|
@@ -28,14 +28,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
28
28
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* A custom pager for paginated API responses where the pagination logic
|
|
32
|
-
* must be implemented by the SDK author.
|
|
33
|
-
*
|
|
34
|
-
* SDK authors provide a parser callback to extract items and determine
|
|
35
|
-
* pagination state from responses.
|
|
36
31
|
*
|
|
37
32
|
* @template TItem The type of the items in the page.
|
|
38
|
-
* @template TRequest The type of the request object.
|
|
39
33
|
* @template TResponse The type of the API response.
|
|
40
34
|
*/
|
|
41
35
|
export class CustomPager {
|
|
@@ -47,8 +41,7 @@ export class CustomPager {
|
|
|
47
41
|
this._hasPreviousPage = args.hasPreviousPage;
|
|
48
42
|
this.nextRequest = args.nextRequest;
|
|
49
43
|
this.previousRequest = args.previousRequest;
|
|
50
|
-
this.
|
|
51
|
-
this.parser = args.parser;
|
|
44
|
+
this.sendRequest = args.sendRequest;
|
|
52
45
|
}
|
|
53
46
|
/**
|
|
54
47
|
* @returns whether there is a next page to load
|
|
@@ -62,6 +55,15 @@ export class CustomPager {
|
|
|
62
55
|
hasPreviousPage() {
|
|
63
56
|
return this._hasPreviousPage;
|
|
64
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns the current page data.
|
|
60
|
+
* This is an alias for the `data` property for consistency with other pagination APIs.
|
|
61
|
+
*
|
|
62
|
+
* @returns the items from the current page
|
|
63
|
+
*/
|
|
64
|
+
getCurrentPage() {
|
|
65
|
+
return this.data;
|
|
66
|
+
}
|
|
65
67
|
/**
|
|
66
68
|
* Retrieves the next page of results.
|
|
67
69
|
* @returns this pager with updated data
|
|
@@ -72,14 +74,19 @@ export class CustomPager {
|
|
|
72
74
|
if (!this._hasNextPage || !this.nextRequest) {
|
|
73
75
|
throw new Error("No next page available");
|
|
74
76
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
+
const response = yield this.sendRequest(this.nextRequest);
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
const reason = response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason;
|
|
80
|
+
throw new Error(`Failed to fetch next page: ${reason}`);
|
|
81
|
+
}
|
|
82
|
+
const data = response.body;
|
|
83
|
+
const rawResponse = response.rawResponse;
|
|
84
|
+
const parsed = yield parse({ request: this.nextRequest, data, rawResponse });
|
|
77
85
|
this.response = data;
|
|
78
86
|
this.rawResponse = rawResponse;
|
|
79
87
|
this.data = parsed.items;
|
|
80
88
|
this._hasNextPage = parsed.hasNextPage;
|
|
81
89
|
this._hasPreviousPage = parsed.hasPreviousPage;
|
|
82
|
-
this.context.currentRequest = this.nextRequest;
|
|
83
90
|
this.nextRequest = parsed.nextRequest;
|
|
84
91
|
this.previousRequest = parsed.previousRequest;
|
|
85
92
|
return this;
|
|
@@ -95,14 +102,19 @@ export class CustomPager {
|
|
|
95
102
|
if (!this._hasPreviousPage || !this.previousRequest) {
|
|
96
103
|
throw new Error("No previous page available");
|
|
97
104
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
105
|
+
const response = yield this.sendRequest(this.previousRequest);
|
|
106
|
+
if (!response.ok) {
|
|
107
|
+
const reason = response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason;
|
|
108
|
+
throw new Error(`Failed to fetch previous page: ${reason}`);
|
|
109
|
+
}
|
|
110
|
+
const data = response.body;
|
|
111
|
+
const rawResponse = response.rawResponse;
|
|
112
|
+
const parsed = yield parse({ request: this.previousRequest, data, rawResponse });
|
|
100
113
|
this.response = data;
|
|
101
114
|
this.rawResponse = rawResponse;
|
|
102
115
|
this.data = parsed.items;
|
|
103
116
|
this._hasNextPage = parsed.hasNextPage;
|
|
104
117
|
this._hasPreviousPage = parsed.hasPreviousPage;
|
|
105
|
-
this.context.currentRequest = this.previousRequest;
|
|
106
118
|
this.nextRequest = parsed.nextRequest;
|
|
107
119
|
this.previousRequest = parsed.previousRequest;
|
|
108
120
|
return this;
|
|
@@ -141,32 +153,37 @@ export class CustomPager {
|
|
|
141
153
|
}
|
|
142
154
|
});
|
|
143
155
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
context: {
|
|
165
|
-
sendRequest: args.sendRequest,
|
|
166
|
-
currentRequest: args.initialRequest,
|
|
167
|
-
},
|
|
168
|
-
parser: args.parse,
|
|
169
|
-
});
|
|
156
|
+
}
|
|
157
|
+
export function createCustomPager(_a) {
|
|
158
|
+
return __awaiter(this, arguments, void 0, function* ({ sendRequest, initialHttpRequest, clientOptions, }) {
|
|
159
|
+
const response = yield sendRequest(initialHttpRequest);
|
|
160
|
+
if (!response.ok) {
|
|
161
|
+
const reason = response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason;
|
|
162
|
+
throw new Error(`Failed to fetch initial page: ${reason}`);
|
|
163
|
+
}
|
|
164
|
+
const data = response.body;
|
|
165
|
+
const rawResponse = response.rawResponse;
|
|
166
|
+
const parsed = yield parse({ request: initialHttpRequest, data, rawResponse });
|
|
167
|
+
return new CustomPager({
|
|
168
|
+
response: data,
|
|
169
|
+
rawResponse,
|
|
170
|
+
items: parsed.items,
|
|
171
|
+
hasNextPage: parsed.hasNextPage,
|
|
172
|
+
hasPreviousPage: parsed.hasPreviousPage,
|
|
173
|
+
nextRequest: parsed.nextRequest,
|
|
174
|
+
previousRequest: parsed.previousRequest,
|
|
175
|
+
sendRequest: sendRequest,
|
|
170
176
|
});
|
|
171
|
-
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
function parse(args) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
// Placeholder implementation.
|
|
182
|
+
// TODO: Replace this with actual parsing logic.
|
|
183
|
+
return {
|
|
184
|
+
items: [],
|
|
185
|
+
hasNextPage: false,
|
|
186
|
+
hasPreviousPage: false,
|
|
187
|
+
};
|
|
188
|
+
});
|
|
172
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CustomPager,
|
|
1
|
+
export { CustomPager, createCustomPager } from "./CustomPager.mjs";
|
|
2
2
|
export { Page } from "./Page.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CustomPager } from "./CustomPager.mjs";
|
|
1
|
+
export { CustomPager, createCustomPager } from "./CustomPager.mjs";
|
|
2
2
|
export { Page } from "./Page.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.
|
|
1
|
+
export declare const SDK_VERSION = "5.4.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "5.
|
|
1
|
+
export const SDK_VERSION = "5.4.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auth0",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"msw": "2.11.2",
|
|
88
88
|
"@types/node": "^18.19.70",
|
|
89
89
|
"typescript": "~5.7.2",
|
|
90
|
-
"prettier": "3.4
|
|
90
|
+
"prettier": "3.7.4",
|
|
91
91
|
"typedoc": "^0.28.7",
|
|
92
92
|
"typedoc-plugin-missing-exports": "^4.0.0",
|
|
93
93
|
"nock": "^14.0.6",
|
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
"fs": false,
|
|
107
107
|
"os": false,
|
|
108
108
|
"path": false,
|
|
109
|
-
"stream": false
|
|
109
|
+
"stream": false,
|
|
110
|
+
"crypto": false
|
|
110
111
|
},
|
|
111
112
|
"packageManager": "yarn@1.22.22",
|
|
112
113
|
"engines": {
|