@dereekb/zoom 12.1.0 → 12.1.1

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/index.cjs.js CHANGED
@@ -3412,13 +3412,17 @@ function handleZoomErrorFetchFactory(parseZoomError, defaultLogError) {
3412
3412
  * The status code that Zoom uses to indicates that too many requests have been made in a short period of time.
3413
3413
  */
3414
3414
  const ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE = 429;
3415
+ /**
3416
+ * Also shares the same 429 code as ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE.
3417
+ */
3418
+ const ZOOM_TOO_MANY_REQUESTS_ERROR_CODE = 429;
3415
3419
  const ZOOM_RATE_LIMIT_CATEGORY_HEADER = 'X-RateLimit-Category';
3416
3420
  const ZOOM_RATE_LIMIT_TYPE_HEADER = 'X-RateLimit-Type';
3417
3421
  const ZOOM_RATE_LIMIT_LIMIT_HEADER = 'X-RateLimit-Limit';
3418
3422
  const ZOOM_RATE_LIMIT_REMAINING_HEADER = 'X-RateLimit-Remaining';
3419
3423
  const ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER = 'Retry-After';
3420
- const DEFAULT_ZOOM_API_RATE_LIMIT = 100;
3421
- const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = util.MS_IN_MINUTE;
3424
+ const DEFAULT_ZOOM_API_RATE_LIMIT = 2;
3425
+ const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = util.MS_IN_SECOND;
3422
3426
  function zoomRateLimitHeaderDetails(headers) {
3423
3427
  const limitHeader = headers.get(ZOOM_RATE_LIMIT_LIMIT_HEADER);
3424
3428
  const remainingHeader = headers.get(ZOOM_RATE_LIMIT_REMAINING_HEADER);
@@ -3426,13 +3430,13 @@ function zoomRateLimitHeaderDetails(headers) {
3426
3430
  const categoryHeader = headers.get(ZOOM_RATE_LIMIT_CATEGORY_HEADER);
3427
3431
  const typeHeader = headers.get(ZOOM_RATE_LIMIT_TYPE_HEADER);
3428
3432
  let result = null;
3429
- if (limitHeader != null && remainingHeader != null && retryAfterHeader != null) {
3430
- const limit = Number(limitHeader);
3431
- const remaining = Number(remainingHeader);
3432
- const retryAfter = Number(retryAfterHeader);
3433
- const retryAfterAt = new Date(retryAfter);
3433
+ if (categoryHeader != null && typeHeader != null) {
3434
3434
  const category = categoryHeader;
3435
3435
  const type = typeHeader;
3436
+ const limit = limitHeader ? Number(limitHeader) : undefined;
3437
+ const remaining = remainingHeader ? Number(remainingHeader) : undefined;
3438
+ const retryAfter = retryAfterHeader ? Number(retryAfterHeader) : undefined;
3439
+ const retryAfterAt = retryAfterHeader ? new Date(retryAfterHeader) : undefined;
3436
3440
  result = {
3437
3441
  limit,
3438
3442
  remaining,
@@ -3460,6 +3464,11 @@ function parseZoomServerErrorData(zoomServerError, responseError) {
3460
3464
  let result;
3461
3465
  if (responseError.response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3462
3466
  result = new ZoomTooManyRequestsError(zoomServerError, responseError);
3467
+ console.warn('ZoomTooManyRequestsError', {
3468
+ result,
3469
+ responseError,
3470
+ headerDetails: result.headerDetails
3471
+ });
3463
3472
  } else if (zoomServerError) {
3464
3473
  switch (zoomServerError.code) {
3465
3474
  default:
@@ -3720,48 +3729,54 @@ function zoomRateLimitedFetchHandler(config) {
3720
3729
  function configForLimit(limit, resetAt) {
3721
3730
  return {
3722
3731
  limit: defaultLimit,
3723
- startLimitAt: Math.ceil(limit / 10),
3724
- // can do 10% of the requests of the limit before rate limiting begins
3725
- cooldownRate: 1.2 * (limit / (defaultResetPeriod / util.MS_IN_SECOND)),
3726
- exponentRate: 1.08,
3727
- maxWaitTime: util.MS_IN_SECOND * 10,
3732
+ startLimitAt: 2,
3733
+ cooldownRate: 1,
3734
+ exponentRate: 1.2,
3735
+ maxWaitTime: util.MS_IN_SECOND * 5,
3728
3736
  resetPeriod: defaultResetPeriod,
3729
3737
  resetAt
3730
3738
  };
3731
3739
  }
3732
- const defaultConfig = configForLimit(defaultLimit);
3740
+ const defaultConfig = configForLimit();
3733
3741
  const rateLimiter = util.resetPeriodPromiseRateLimiter(defaultConfig);
3734
3742
  return fetch.rateLimitedFetchHandler({
3735
3743
  rateLimiter,
3736
3744
  updateWithResponse: function (response, fetchResponseError) {
3737
3745
  const hasLimitHeader = response.headers.has(ZOOM_RATE_LIMIT_REMAINING_HEADER);
3738
3746
  let shouldRetry = false;
3739
- let enabled = false;
3747
+ // let enabled = false; // rate limiter should not be turned off
3740
3748
  if (hasLimitHeader) {
3741
3749
  const headerDetails = zoomRateLimitHeaderDetails(response.headers);
3742
3750
  if (headerDetails) {
3743
3751
  const {
3752
+ type,
3744
3753
  limit,
3745
3754
  retryAfterAt,
3746
3755
  remaining
3747
3756
  } = headerDetails;
3748
- if (limit !== defaultLimit) {
3749
- const newConfig = configForLimit(limit, retryAfterAt);
3750
- rateLimiter.setConfig(newConfig, false);
3751
- }
3752
- rateLimiter.setRemainingLimit(remaining);
3753
- rateLimiter.setNextResetAt(retryAfterAt);
3754
- enabled = true;
3755
- // only retry if it's a TOO MANY REQUESTS error
3756
3757
  if (response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3757
- shouldRetry = true;
3758
- try {
3759
- onTooManyRequests == null || onTooManyRequests(headerDetails, response, fetchResponseError);
3760
- } catch (e) {}
3758
+ // For simple query-per-second rate limits, just schedule a retry
3759
+ if (type === 'QPS') {
3760
+ shouldRetry = true;
3761
+ try {
3762
+ onTooManyRequests == null || onTooManyRequests(headerDetails, response, fetchResponseError);
3763
+ } catch (e) {}
3764
+ }
3765
+ }
3766
+ // NOTE: typically it seems like these headers are not available usually.
3767
+ // There is a daily limit for message requests
3768
+ if (limit != null && retryAfterAt != null && remaining != null) {
3769
+ if (limit !== defaultLimit) {
3770
+ const newConfig = configForLimit(limit, retryAfterAt);
3771
+ rateLimiter.setConfig(newConfig, false);
3772
+ }
3773
+ rateLimiter.setRemainingLimit(remaining);
3774
+ rateLimiter.setNextResetAt(retryAfterAt);
3775
+ // enabled = true;
3761
3776
  }
3762
3777
  }
3763
3778
  }
3764
- rateLimiter.setEnabled(enabled);
3779
+ // rateLimiter.setEnabled(enabled);
3765
3780
  return shouldRetry;
3766
3781
  }
3767
3782
  });
@@ -4305,6 +4320,7 @@ exports.ZOOM_RATE_LIMIT_REMAINING_HEADER = ZOOM_RATE_LIMIT_REMAINING_HEADER;
4305
4320
  exports.ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER = ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER;
4306
4321
  exports.ZOOM_RATE_LIMIT_TYPE_HEADER = ZOOM_RATE_LIMIT_TYPE_HEADER;
4307
4322
  exports.ZOOM_SUCCESS_CODE = ZOOM_SUCCESS_CODE;
4323
+ exports.ZOOM_TOO_MANY_REQUESTS_ERROR_CODE = ZOOM_TOO_MANY_REQUESTS_ERROR_CODE;
4308
4324
  exports.ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE = ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE;
4309
4325
  exports.ZoomOAuthAccessTokenError = ZoomOAuthAccessTokenError;
4310
4326
  exports.ZoomOAuthAuthFailureError = ZoomOAuthAuthFailureError;
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { fetchPageFactory, FetchResponseError, mergeMakeUrlSearchParamsOptions, makeUrlSearchParams, FetchRequestFactoryError, rateLimitedFetchHandler, fetchJsonFunction, returnNullHandleFetchJsonParseErrorFunction, fetchApiFetchService } from '@dereekb/util/fetch';
2
- import { MS_IN_MINUTE, asArray, resetPeriodPromiseRateLimiter, MS_IN_SECOND } from '@dereekb/util';
2
+ import { MS_IN_SECOND, asArray, resetPeriodPromiseRateLimiter, MS_IN_MINUTE } from '@dereekb/util';
3
3
  import { BaseError } from 'make-error';
4
4
 
5
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -3410,13 +3410,17 @@ function handleZoomErrorFetchFactory(parseZoomError, defaultLogError) {
3410
3410
  * The status code that Zoom uses to indicates that too many requests have been made in a short period of time.
3411
3411
  */
3412
3412
  const ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE = 429;
3413
+ /**
3414
+ * Also shares the same 429 code as ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE.
3415
+ */
3416
+ const ZOOM_TOO_MANY_REQUESTS_ERROR_CODE = 429;
3413
3417
  const ZOOM_RATE_LIMIT_CATEGORY_HEADER = 'X-RateLimit-Category';
3414
3418
  const ZOOM_RATE_LIMIT_TYPE_HEADER = 'X-RateLimit-Type';
3415
3419
  const ZOOM_RATE_LIMIT_LIMIT_HEADER = 'X-RateLimit-Limit';
3416
3420
  const ZOOM_RATE_LIMIT_REMAINING_HEADER = 'X-RateLimit-Remaining';
3417
3421
  const ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER = 'Retry-After';
3418
- const DEFAULT_ZOOM_API_RATE_LIMIT = 100;
3419
- const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = MS_IN_MINUTE;
3422
+ const DEFAULT_ZOOM_API_RATE_LIMIT = 2;
3423
+ const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = MS_IN_SECOND;
3420
3424
  function zoomRateLimitHeaderDetails(headers) {
3421
3425
  const limitHeader = headers.get(ZOOM_RATE_LIMIT_LIMIT_HEADER);
3422
3426
  const remainingHeader = headers.get(ZOOM_RATE_LIMIT_REMAINING_HEADER);
@@ -3424,13 +3428,13 @@ function zoomRateLimitHeaderDetails(headers) {
3424
3428
  const categoryHeader = headers.get(ZOOM_RATE_LIMIT_CATEGORY_HEADER);
3425
3429
  const typeHeader = headers.get(ZOOM_RATE_LIMIT_TYPE_HEADER);
3426
3430
  let result = null;
3427
- if (limitHeader != null && remainingHeader != null && retryAfterHeader != null) {
3428
- const limit = Number(limitHeader);
3429
- const remaining = Number(remainingHeader);
3430
- const retryAfter = Number(retryAfterHeader);
3431
- const retryAfterAt = new Date(retryAfter);
3431
+ if (categoryHeader != null && typeHeader != null) {
3432
3432
  const category = categoryHeader;
3433
3433
  const type = typeHeader;
3434
+ const limit = limitHeader ? Number(limitHeader) : undefined;
3435
+ const remaining = remainingHeader ? Number(remainingHeader) : undefined;
3436
+ const retryAfter = retryAfterHeader ? Number(retryAfterHeader) : undefined;
3437
+ const retryAfterAt = retryAfterHeader ? new Date(retryAfterHeader) : undefined;
3434
3438
  result = {
3435
3439
  limit,
3436
3440
  remaining,
@@ -3458,6 +3462,11 @@ function parseZoomServerErrorData(zoomServerError, responseError) {
3458
3462
  let result;
3459
3463
  if (responseError.response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3460
3464
  result = new ZoomTooManyRequestsError(zoomServerError, responseError);
3465
+ console.warn('ZoomTooManyRequestsError', {
3466
+ result,
3467
+ responseError,
3468
+ headerDetails: result.headerDetails
3469
+ });
3461
3470
  } else if (zoomServerError) {
3462
3471
  switch (zoomServerError.code) {
3463
3472
  default:
@@ -3718,48 +3727,54 @@ function zoomRateLimitedFetchHandler(config) {
3718
3727
  function configForLimit(limit, resetAt) {
3719
3728
  return {
3720
3729
  limit: defaultLimit,
3721
- startLimitAt: Math.ceil(limit / 10),
3722
- // can do 10% of the requests of the limit before rate limiting begins
3723
- cooldownRate: 1.2 * (limit / (defaultResetPeriod / MS_IN_SECOND)),
3724
- exponentRate: 1.08,
3725
- maxWaitTime: MS_IN_SECOND * 10,
3730
+ startLimitAt: 2,
3731
+ cooldownRate: 1,
3732
+ exponentRate: 1.2,
3733
+ maxWaitTime: MS_IN_SECOND * 5,
3726
3734
  resetPeriod: defaultResetPeriod,
3727
3735
  resetAt
3728
3736
  };
3729
3737
  }
3730
- const defaultConfig = configForLimit(defaultLimit);
3738
+ const defaultConfig = configForLimit();
3731
3739
  const rateLimiter = resetPeriodPromiseRateLimiter(defaultConfig);
3732
3740
  return rateLimitedFetchHandler({
3733
3741
  rateLimiter,
3734
3742
  updateWithResponse: function (response, fetchResponseError) {
3735
3743
  const hasLimitHeader = response.headers.has(ZOOM_RATE_LIMIT_REMAINING_HEADER);
3736
3744
  let shouldRetry = false;
3737
- let enabled = false;
3745
+ // let enabled = false; // rate limiter should not be turned off
3738
3746
  if (hasLimitHeader) {
3739
3747
  const headerDetails = zoomRateLimitHeaderDetails(response.headers);
3740
3748
  if (headerDetails) {
3741
3749
  const {
3750
+ type,
3742
3751
  limit,
3743
3752
  retryAfterAt,
3744
3753
  remaining
3745
3754
  } = headerDetails;
3746
- if (limit !== defaultLimit) {
3747
- const newConfig = configForLimit(limit, retryAfterAt);
3748
- rateLimiter.setConfig(newConfig, false);
3749
- }
3750
- rateLimiter.setRemainingLimit(remaining);
3751
- rateLimiter.setNextResetAt(retryAfterAt);
3752
- enabled = true;
3753
- // only retry if it's a TOO MANY REQUESTS error
3754
3755
  if (response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
3755
- shouldRetry = true;
3756
- try {
3757
- onTooManyRequests == null || onTooManyRequests(headerDetails, response, fetchResponseError);
3758
- } catch (e) {}
3756
+ // For simple query-per-second rate limits, just schedule a retry
3757
+ if (type === 'QPS') {
3758
+ shouldRetry = true;
3759
+ try {
3760
+ onTooManyRequests == null || onTooManyRequests(headerDetails, response, fetchResponseError);
3761
+ } catch (e) {}
3762
+ }
3763
+ }
3764
+ // NOTE: typically it seems like these headers are not available usually.
3765
+ // There is a daily limit for message requests
3766
+ if (limit != null && retryAfterAt != null && remaining != null) {
3767
+ if (limit !== defaultLimit) {
3768
+ const newConfig = configForLimit(limit, retryAfterAt);
3769
+ rateLimiter.setConfig(newConfig, false);
3770
+ }
3771
+ rateLimiter.setRemainingLimit(remaining);
3772
+ rateLimiter.setNextResetAt(retryAfterAt);
3773
+ // enabled = true;
3759
3774
  }
3760
3775
  }
3761
3776
  }
3762
- rateLimiter.setEnabled(enabled);
3777
+ // rateLimiter.setEnabled(enabled);
3763
3778
  return shouldRetry;
3764
3779
  }
3765
3780
  });
@@ -4290,4 +4305,4 @@ function zoomOAuthZoomAccessTokenFactory(config) {
4290
4305
  };
4291
4306
  }
4292
4307
 
4293
- export { DEFAULT_ZOOM_API_RATE_LIMIT, DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD, DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION, DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE, ZOOM_ACCOUNTS_INVALID_GRANT_ERROR_CODE, ZOOM_API_URL, ZOOM_OAUTH_API_URL, ZOOM_RATE_LIMIT_CATEGORY_HEADER, ZOOM_RATE_LIMIT_LIMIT_HEADER, ZOOM_RATE_LIMIT_REMAINING_HEADER, ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER, ZOOM_RATE_LIMIT_TYPE_HEADER, ZOOM_SUCCESS_CODE, ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE, ZoomApprovalType, ZoomMeetingType, ZoomMonthlyWeek, ZoomMonthlyWeekDay, ZoomOAuthAccessTokenError, ZoomOAuthAuthFailureError, ZoomRecurrenceType, ZoomRegistrationType, ZoomServerError, ZoomServerFetchResponseError, ZoomTooManyRequestsError, ZoomUserType, createMeetingForUser, deleteMeeting, getMeeting, getUser, handleZoomErrorFetch, handleZoomErrorFetchFactory, handleZoomOAuthErrorFetch, listMeetingsForUser, listMeetingsForUserPageFactory, listUsers, listUsersPageFactory, logZoomErrorToConsole, logZoomOAuthErrorToConsole, logZoomServerErrorFunction, mapToZoomPageResult, omitSilenceZoomErrorKeys, parseZoomApiError, parseZoomApiServerErrorResponseData, parseZoomOAuthError, parseZoomOAuthServerErrorResponseData, parseZoomServerErrorData, serverAccessToken, silenceZoomErrorWithCodesFunction, userAccessToken, zoomAccessTokenStringFactory, zoomFactory, zoomFetchPageFactory, zoomOAuthApiFetchJsonInput, zoomOAuthFactory, zoomOAuthServerBasicAuthorizationHeaderValue, zoomOAuthZoomAccessTokenFactory, zoomRateLimitHeaderDetails, zoomRateLimitedFetchHandler };
4308
+ export { DEFAULT_ZOOM_API_RATE_LIMIT, DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD, DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION, DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE, ZOOM_ACCOUNTS_INVALID_GRANT_ERROR_CODE, ZOOM_API_URL, ZOOM_OAUTH_API_URL, ZOOM_RATE_LIMIT_CATEGORY_HEADER, ZOOM_RATE_LIMIT_LIMIT_HEADER, ZOOM_RATE_LIMIT_REMAINING_HEADER, ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER, ZOOM_RATE_LIMIT_TYPE_HEADER, ZOOM_SUCCESS_CODE, ZOOM_TOO_MANY_REQUESTS_ERROR_CODE, ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE, ZoomApprovalType, ZoomMeetingType, ZoomMonthlyWeek, ZoomMonthlyWeekDay, ZoomOAuthAccessTokenError, ZoomOAuthAuthFailureError, ZoomRecurrenceType, ZoomRegistrationType, ZoomServerError, ZoomServerFetchResponseError, ZoomTooManyRequestsError, ZoomUserType, createMeetingForUser, deleteMeeting, getMeeting, getUser, handleZoomErrorFetch, handleZoomErrorFetchFactory, handleZoomOAuthErrorFetch, listMeetingsForUser, listMeetingsForUserPageFactory, listUsers, listUsersPageFactory, logZoomErrorToConsole, logZoomOAuthErrorToConsole, logZoomServerErrorFunction, mapToZoomPageResult, omitSilenceZoomErrorKeys, parseZoomApiError, parseZoomApiServerErrorResponseData, parseZoomOAuthError, parseZoomOAuthServerErrorResponseData, parseZoomServerErrorData, serverAccessToken, silenceZoomErrorWithCodesFunction, userAccessToken, zoomAccessTokenStringFactory, zoomFactory, zoomFetchPageFactory, zoomOAuthApiFetchJsonInput, zoomOAuthFactory, zoomOAuthServerBasicAuthorizationHeaderValue, zoomOAuthZoomAccessTokenFactory, zoomRateLimitHeaderDetails, zoomRateLimitedFetchHandler };
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [12.1.1](https://github.com/dereekb/dbx-components/compare/v12.1.0-dev...v12.1.1) (2025-05-12)
6
+
7
+
8
+
5
9
  # [12.1.0](https://github.com/dereekb/dbx-components/compare/v12.0.6-dev...v12.1.0) (2025-05-10)
6
10
 
7
11
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/zoom/nestjs",
3
- "version": "12.1.0",
3
+ "version": "12.1.1",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "main": "./src/index.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/zoom",
3
- "version": "12.1.0",
3
+ "version": "12.1.1",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -76,24 +76,23 @@ export declare function handleZoomErrorFetchFactory(parseZoomError: ParseZoomFet
76
76
  * The status code that Zoom uses to indicates that too many requests have been made in a short period of time.
77
77
  */
78
78
  export declare const ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE = 429;
79
+ /**
80
+ * Also shares the same 429 code as ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE.
81
+ */
82
+ export declare const ZOOM_TOO_MANY_REQUESTS_ERROR_CODE = 429;
79
83
  export type ZoomRateLimitCategory = 'Light' | 'Medium' | 'Heavy';
80
- export type ZoomRateLimitType = 'Per-second-limit' | 'Daily-limit';
84
+ /**
85
+ * QPS - Queries per second
86
+ */
87
+ export type ZoomRateLimitType = 'QPS' | 'Per-second-limit' | 'Daily-limit';
81
88
  export declare const ZOOM_RATE_LIMIT_CATEGORY_HEADER = "X-RateLimit-Category";
82
89
  export declare const ZOOM_RATE_LIMIT_TYPE_HEADER = "X-RateLimit-Type";
83
90
  export declare const ZOOM_RATE_LIMIT_LIMIT_HEADER = "X-RateLimit-Limit";
84
91
  export declare const ZOOM_RATE_LIMIT_REMAINING_HEADER = "X-RateLimit-Remaining";
85
92
  export declare const ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER = "Retry-After";
86
- export declare const DEFAULT_ZOOM_API_RATE_LIMIT = 100;
87
- export declare const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD: number;
93
+ export declare const DEFAULT_ZOOM_API_RATE_LIMIT = 2;
94
+ export declare const DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = 1000;
88
95
  export interface ZoomRateLimitHeaderDetails {
89
- /**
90
- * Total limit in a given period.
91
- */
92
- readonly limit: number;
93
- /**
94
- * Total number of remaining allowed requests.
95
- */
96
- readonly remaining: number;
97
96
  /**
98
97
  * The category of the rate limit.
99
98
  */
@@ -102,14 +101,22 @@ export interface ZoomRateLimitHeaderDetails {
102
101
  * The type of the rate limit.
103
102
  */
104
103
  readonly type: ZoomRateLimitType;
104
+ /**
105
+ * Total limit in a given period.
106
+ */
107
+ readonly limit?: number;
108
+ /**
109
+ * Total number of remaining allowed requests.
110
+ */
111
+ readonly remaining?: number;
105
112
  /**
106
113
  * The time at which the rate limit will reset.
107
114
  */
108
- readonly retryAfter: UnixDateTimeNumber;
115
+ readonly retryAfter?: UnixDateTimeNumber;
109
116
  /**
110
117
  * The time at which the rate limit will reset.
111
118
  */
112
- readonly retryAfterAt: Date;
119
+ readonly retryAfterAt?: Date;
113
120
  }
114
121
  export declare function zoomRateLimitHeaderDetails(headers: Headers): Maybe<ZoomRateLimitHeaderDetails>;
115
122
  export declare class ZoomTooManyRequestsError extends ZoomServerFetchResponseError {
@@ -15,19 +15,17 @@ export interface ZoomRateLimitedFetchHandlerConfig {
15
15
  /**
16
16
  * Custom max rate limit.
17
17
  *
18
- * Rate limits are different between account types and are described here:
19
- *
20
- * https://help.zoom.com/portal/en/community/topic/key-changes-in-api-limits-26-9-2018#:~:text=X%2DRATELIMIT%2DREMAINING%20%2D%20Represents,time%20of%20the%20current%20window.&text=Please%20note%20that%20these%20Rate,API%20limit%20changes%20are%20implemented.
18
+ * The QPS is the main rate limit to watch for. We start slowing down requets after 2 requests per second.
21
19
  */
22
20
  readonly maxRateLimit?: number;
23
21
  /**
24
22
  * Custom reset period for the rate limiter.
25
23
  *
26
- * Defaults to 1 minute in milliseconds.
24
+ * Defaults to 1 second in milliseconds.
27
25
  */
28
26
  readonly resetPeriod?: Milliseconds;
29
27
  /**
30
- * Optional function to execute when too many requests is reached.t
28
+ * Optional function to execute when too many requests is reached.
31
29
  *
32
30
  * Defaults to the default logging function, unless false is passed.
33
31
  */