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.js";
|
|
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 {};
|
|
@@ -46,19 +46,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
46
46
|
exports.BearerAuthProvider = void 0;
|
|
47
47
|
const core = __importStar(require("../core/index.js"));
|
|
48
48
|
const errors = __importStar(require("../errors/index.js"));
|
|
49
|
+
const TOKEN_PARAM = "token";
|
|
49
50
|
class BearerAuthProvider {
|
|
50
51
|
constructor(options) {
|
|
51
|
-
this.
|
|
52
|
+
this.options = options;
|
|
52
53
|
}
|
|
53
54
|
static canCreate(options) {
|
|
54
|
-
return options
|
|
55
|
+
return (options === null || options === void 0 ? void 0 : options[TOKEN_PARAM]) != null;
|
|
55
56
|
}
|
|
56
|
-
getAuthRequest(
|
|
57
|
-
return __awaiter(this,
|
|
58
|
-
const token = yield core.Supplier.get(this.
|
|
57
|
+
getAuthRequest() {
|
|
58
|
+
return __awaiter(this, arguments, void 0, function* ({ endpointMetadata, } = {}) {
|
|
59
|
+
const token = yield core.Supplier.get(this.options[TOKEN_PARAM]);
|
|
59
60
|
if (token == null) {
|
|
60
61
|
throw new errors.ManagementError({
|
|
61
|
-
message:
|
|
62
|
+
message: BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE,
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
return {
|
|
@@ -68,3 +69,11 @@ class BearerAuthProvider {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
exports.BearerAuthProvider = BearerAuthProvider;
|
|
72
|
+
(function (BearerAuthProvider) {
|
|
73
|
+
BearerAuthProvider.AUTH_SCHEME = "bearerAuth";
|
|
74
|
+
BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE = `Please provide '${TOKEN_PARAM}' when initializing the client`;
|
|
75
|
+
function createInstance(options) {
|
|
76
|
+
return new BearerAuthProvider(options);
|
|
77
|
+
}
|
|
78
|
+
BearerAuthProvider.createInstance = createInstance;
|
|
79
|
+
})(BearerAuthProvider || (exports.BearerAuthProvider = BearerAuthProvider = {}));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
2
2
|
import type { Supplier } from "./Supplier.js";
|
|
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.js";
|
|
2
2
|
import type { APIResponse } from "./APIResponse.js";
|
|
3
3
|
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
4
|
-
import { EndpointSupplier } from "./EndpointSupplier.js";
|
|
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;
|
|
@@ -156,7 +156,13 @@ function getHeaders(args) {
|
|
|
156
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
157
|
var _a;
|
|
158
158
|
const newHeaders = new Headers_js_1.Headers();
|
|
159
|
-
newHeaders.set("Accept", args.responseType === "json"
|
|
159
|
+
newHeaders.set("Accept", args.responseType === "json"
|
|
160
|
+
? "application/json"
|
|
161
|
+
: args.responseType === "text"
|
|
162
|
+
? "text/plain"
|
|
163
|
+
: args.responseType === "sse"
|
|
164
|
+
? "text/event-stream"
|
|
165
|
+
: "*/*");
|
|
160
166
|
if (args.body !== undefined && args.contentType != null) {
|
|
161
167
|
newHeaders.set("Content-Type", args.contentType);
|
|
162
168
|
}
|
|
@@ -153,7 +153,7 @@ function streamToBuffer(stream) {
|
|
|
153
153
|
}
|
|
154
154
|
return Buffer.from(result);
|
|
155
155
|
}
|
|
156
|
-
throw new Error(
|
|
156
|
+
throw new Error(`Unsupported stream type: ${typeof stream}. Expected Node.js Readable stream or Web ReadableStream.`);
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
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.js";
|
|
2
|
+
import type { APIResponse } from "../fetcher/APIResponse.js";
|
|
3
|
+
import type { Fetcher } from "../fetcher/Fetcher.js";
|
|
4
|
+
import type { RawResponse } from "../fetcher/index.js";
|
|
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>>;
|
|
@@ -30,15 +30,10 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.CustomPager = void 0;
|
|
33
|
+
exports.createCustomPager = createCustomPager;
|
|
33
34
|
/**
|
|
34
|
-
* A custom pager for paginated API responses where the pagination logic
|
|
35
|
-
* must be implemented by the SDK author.
|
|
36
|
-
*
|
|
37
|
-
* SDK authors provide a parser callback to extract items and determine
|
|
38
|
-
* pagination state from responses.
|
|
39
35
|
*
|
|
40
36
|
* @template TItem The type of the items in the page.
|
|
41
|
-
* @template TRequest The type of the request object.
|
|
42
37
|
* @template TResponse The type of the API response.
|
|
43
38
|
*/
|
|
44
39
|
class CustomPager {
|
|
@@ -50,8 +45,7 @@ class CustomPager {
|
|
|
50
45
|
this._hasPreviousPage = args.hasPreviousPage;
|
|
51
46
|
this.nextRequest = args.nextRequest;
|
|
52
47
|
this.previousRequest = args.previousRequest;
|
|
53
|
-
this.
|
|
54
|
-
this.parser = args.parser;
|
|
48
|
+
this.sendRequest = args.sendRequest;
|
|
55
49
|
}
|
|
56
50
|
/**
|
|
57
51
|
* @returns whether there is a next page to load
|
|
@@ -65,6 +59,15 @@ class CustomPager {
|
|
|
65
59
|
hasPreviousPage() {
|
|
66
60
|
return this._hasPreviousPage;
|
|
67
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns the current page data.
|
|
64
|
+
* This is an alias for the `data` property for consistency with other pagination APIs.
|
|
65
|
+
*
|
|
66
|
+
* @returns the items from the current page
|
|
67
|
+
*/
|
|
68
|
+
getCurrentPage() {
|
|
69
|
+
return this.data;
|
|
70
|
+
}
|
|
68
71
|
/**
|
|
69
72
|
* Retrieves the next page of results.
|
|
70
73
|
* @returns this pager with updated data
|
|
@@ -75,14 +78,19 @@ class CustomPager {
|
|
|
75
78
|
if (!this._hasNextPage || !this.nextRequest) {
|
|
76
79
|
throw new Error("No next page available");
|
|
77
80
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
81
|
+
const response = yield this.sendRequest(this.nextRequest);
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
const reason = response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason;
|
|
84
|
+
throw new Error(`Failed to fetch next page: ${reason}`);
|
|
85
|
+
}
|
|
86
|
+
const data = response.body;
|
|
87
|
+
const rawResponse = response.rawResponse;
|
|
88
|
+
const parsed = yield parse({ request: this.nextRequest, data, rawResponse });
|
|
80
89
|
this.response = data;
|
|
81
90
|
this.rawResponse = rawResponse;
|
|
82
91
|
this.data = parsed.items;
|
|
83
92
|
this._hasNextPage = parsed.hasNextPage;
|
|
84
93
|
this._hasPreviousPage = parsed.hasPreviousPage;
|
|
85
|
-
this.context.currentRequest = this.nextRequest;
|
|
86
94
|
this.nextRequest = parsed.nextRequest;
|
|
87
95
|
this.previousRequest = parsed.previousRequest;
|
|
88
96
|
return this;
|
|
@@ -98,14 +106,19 @@ class CustomPager {
|
|
|
98
106
|
if (!this._hasPreviousPage || !this.previousRequest) {
|
|
99
107
|
throw new Error("No previous page available");
|
|
100
108
|
}
|
|
101
|
-
const
|
|
102
|
-
|
|
109
|
+
const response = yield this.sendRequest(this.previousRequest);
|
|
110
|
+
if (!response.ok) {
|
|
111
|
+
const reason = response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason;
|
|
112
|
+
throw new Error(`Failed to fetch previous page: ${reason}`);
|
|
113
|
+
}
|
|
114
|
+
const data = response.body;
|
|
115
|
+
const rawResponse = response.rawResponse;
|
|
116
|
+
const parsed = yield parse({ request: this.previousRequest, data, rawResponse });
|
|
103
117
|
this.response = data;
|
|
104
118
|
this.rawResponse = rawResponse;
|
|
105
119
|
this.data = parsed.items;
|
|
106
120
|
this._hasNextPage = parsed.hasNextPage;
|
|
107
121
|
this._hasPreviousPage = parsed.hasPreviousPage;
|
|
108
|
-
this.context.currentRequest = this.previousRequest;
|
|
109
122
|
this.nextRequest = parsed.nextRequest;
|
|
110
123
|
this.previousRequest = parsed.previousRequest;
|
|
111
124
|
return this;
|
|
@@ -144,33 +157,38 @@ class CustomPager {
|
|
|
144
157
|
}
|
|
145
158
|
});
|
|
146
159
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Creates a CustomPager by making the initial request and parsing the response.
|
|
149
|
-
*
|
|
150
|
-
* @param args.sendRequest Function to send a request and get a response
|
|
151
|
-
* @param args.initialRequest The initial request to start pagination
|
|
152
|
-
* @param args.parse The parser function to extract items and pagination state
|
|
153
|
-
* @returns A new CustomPager instance
|
|
154
|
-
*/
|
|
155
|
-
static create(args) {
|
|
156
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
const { data, rawResponse } = yield args.sendRequest(args.initialRequest).withRawResponse();
|
|
158
|
-
const parsed = yield args.parse(args.initialRequest, { data, rawResponse });
|
|
159
|
-
return new CustomPager({
|
|
160
|
-
response: data,
|
|
161
|
-
rawResponse,
|
|
162
|
-
items: parsed.items,
|
|
163
|
-
hasNextPage: parsed.hasNextPage,
|
|
164
|
-
hasPreviousPage: parsed.hasPreviousPage,
|
|
165
|
-
nextRequest: parsed.nextRequest,
|
|
166
|
-
previousRequest: parsed.previousRequest,
|
|
167
|
-
context: {
|
|
168
|
-
sendRequest: args.sendRequest,
|
|
169
|
-
currentRequest: args.initialRequest,
|
|
170
|
-
},
|
|
171
|
-
parser: args.parse,
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
160
|
}
|
|
176
161
|
exports.CustomPager = CustomPager;
|
|
162
|
+
function createCustomPager(_a) {
|
|
163
|
+
return __awaiter(this, arguments, void 0, function* ({ sendRequest, initialHttpRequest, clientOptions, }) {
|
|
164
|
+
const response = yield sendRequest(initialHttpRequest);
|
|
165
|
+
if (!response.ok) {
|
|
166
|
+
const reason = response.error.reason === "status-code" ? `HTTP ${response.error.statusCode}` : response.error.reason;
|
|
167
|
+
throw new Error(`Failed to fetch initial page: ${reason}`);
|
|
168
|
+
}
|
|
169
|
+
const data = response.body;
|
|
170
|
+
const rawResponse = response.rawResponse;
|
|
171
|
+
const parsed = yield parse({ request: initialHttpRequest, data, rawResponse });
|
|
172
|
+
return new CustomPager({
|
|
173
|
+
response: data,
|
|
174
|
+
rawResponse,
|
|
175
|
+
items: parsed.items,
|
|
176
|
+
hasNextPage: parsed.hasNextPage,
|
|
177
|
+
hasPreviousPage: parsed.hasPreviousPage,
|
|
178
|
+
nextRequest: parsed.nextRequest,
|
|
179
|
+
previousRequest: parsed.previousRequest,
|
|
180
|
+
sendRequest: sendRequest,
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function parse(args) {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
// Placeholder implementation.
|
|
187
|
+
// TODO: Replace this with actual parsing logic.
|
|
188
|
+
return {
|
|
189
|
+
items: [],
|
|
190
|
+
hasNextPage: false,
|
|
191
|
+
hasPreviousPage: false,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CustomPager = void 0;
|
|
4
|
-
var CustomPager_js_1 = require("./CustomPager.js");
|
|
5
|
-
Object.defineProperty(exports, "CustomPager", { enumerable: true, get: function () { return CustomPager_js_1.CustomPager; } });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CustomPager,
|
|
1
|
+
export { CustomPager, createCustomPager } from "./CustomPager.js";
|
|
2
2
|
export { Page } from "./Page.js";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Page = exports.CustomPager = void 0;
|
|
3
|
+
exports.Page = exports.createCustomPager = exports.CustomPager = void 0;
|
|
4
4
|
var CustomPager_js_1 = require("./CustomPager.js");
|
|
5
5
|
Object.defineProperty(exports, "CustomPager", { enumerable: true, get: function () { return CustomPager_js_1.CustomPager; } });
|
|
6
|
+
Object.defineProperty(exports, "createCustomPager", { enumerable: true, get: function () { return CustomPager_js_1.createCustomPager; } });
|
|
6
7
|
var Page_js_1 = require("./Page.js");
|
|
7
8
|
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return Page_js_1.Page; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "5.
|
|
1
|
+
export declare const SDK_VERSION = "5.4.0";
|
|
@@ -29,12 +29,12 @@ export interface BaseRequestOptions {
|
|
|
29
29
|
/** Additional headers to include in the request. */
|
|
30
30
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
31
31
|
}
|
|
32
|
-
export type NormalizedClientOptions<T extends BaseClientOptions> = T & {
|
|
32
|
+
export type NormalizedClientOptions<T extends BaseClientOptions = BaseClientOptions> = T & {
|
|
33
33
|
logging: core.logging.Logger;
|
|
34
34
|
authProvider?: core.AuthProvider;
|
|
35
35
|
};
|
|
36
|
-
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
36
|
+
export type NormalizedClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions> = NormalizedClientOptions<T> & {
|
|
37
37
|
authProvider: core.AuthProvider;
|
|
38
38
|
};
|
|
39
|
-
export declare function normalizeClientOptions<T extends BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
40
|
-
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|
|
39
|
+
export declare function normalizeClientOptions<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptions<T>;
|
|
40
|
+
export declare function normalizeClientOptionsWithAuth<T extends BaseClientOptions = BaseClientOptions>(options: T): NormalizedClientOptionsWithAuth<T>;
|