@dereekb/zoom 13.4.0 → 13.4.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 +152 -56
- package/index.esm.js +152 -57
- package/nestjs/index.cjs.js +61 -34
- package/nestjs/index.esm.js +61 -34
- package/nestjs/package.json +4 -4
- package/nestjs/src/lib/oauth/oauth.config.d.ts +7 -0
- package/nestjs/src/lib/oauth/oauth.module.d.ts +8 -3
- package/nestjs/src/lib/oauth/oauth.service.d.ts +14 -3
- package/nestjs/src/lib/webhook/webhook.zoom.module.d.ts +6 -0
- package/nestjs/src/lib/webhook/webhook.zoom.type.common.d.ts +1 -1
- package/nestjs/src/lib/webhook/webhook.zoom.verify.d.ts +1 -1
- package/nestjs/src/lib/zoom/zoom.api.d.ts +1 -1
- package/nestjs/src/lib/zoom/zoom.config.d.ts +1 -1
- package/nestjs/src/lib/zoom/zoom.module.d.ts +9 -4
- package/package.json +3 -3
- package/src/lib/oauth/oauth.api.d.ts +13 -0
- package/src/lib/oauth/oauth.config.d.ts +12 -4
- package/src/lib/oauth/oauth.d.ts +7 -4
- package/src/lib/oauth/oauth.error.api.d.ts +14 -1
- package/src/lib/oauth/oauth.factory.d.ts +8 -2
- package/src/lib/zoom/zoom.api.meeting.d.ts +41 -2
- package/src/lib/zoom/zoom.api.meeting.type.d.ts +53 -18
- package/src/lib/zoom/zoom.api.user.d.ts +6 -0
- package/src/lib/zoom/zoom.api.user.type.d.ts +9 -4
- package/src/lib/zoom/zoom.config.d.ts +12 -4
- package/src/lib/zoom/zoom.error.api.d.ts +14 -1
- package/src/lib/zoom/zoom.factory.d.ts +6 -0
- package/src/lib/zoom.error.api.d.ts +22 -6
- package/src/lib/zoom.limit.d.ts +15 -1
package/index.cjs.js
CHANGED
|
@@ -59,6 +59,7 @@ function _object_spread_props(target, source) {
|
|
|
59
59
|
* @param dataTypeKey
|
|
60
60
|
* @returns
|
|
61
61
|
*/ function mapToZoomPageResult(dataTypeKey) {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
63
|
return function(data) {
|
|
63
64
|
var next_page_token = data.next_page_token, page_count = data.page_count, page_number = data.page_number, page_size = data.page_size, total_records = data.total_records;
|
|
64
65
|
return {
|
|
@@ -77,7 +78,8 @@ function _object_spread_props(target, source) {
|
|
|
77
78
|
* @param fetch
|
|
78
79
|
* @param defaults
|
|
79
80
|
* @returns
|
|
80
|
-
*/
|
|
81
|
+
*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
+
function zoomFetchPageFactory(fetch$1, defaults) {
|
|
81
83
|
return fetch.fetchPageFactory(_object_spread_props(_object_spread({}, defaults), {
|
|
82
84
|
fetch: fetch$1,
|
|
83
85
|
readFetchPageResultInfo: function readFetchPageResultInfo(result) {
|
|
@@ -384,8 +386,9 @@ function _ts_generator$5(thisArg, body) {
|
|
|
384
386
|
/**
|
|
385
387
|
* Wraps a ConfiguredFetch to support handling errors returned by fetch.
|
|
386
388
|
*
|
|
387
|
-
* @param fetch
|
|
388
|
-
* @
|
|
389
|
+
* @param parseZoomError Function to parse fetch response errors into typed Zoom errors
|
|
390
|
+
* @param defaultLogError Default error logging function
|
|
391
|
+
* @returns A factory that wraps ConfiguredFetch with error handling
|
|
389
392
|
*/ function handleZoomErrorFetchFactory(parseZoomError, defaultLogError) {
|
|
390
393
|
return function(fetch$1) {
|
|
391
394
|
var logError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultLogError;
|
|
@@ -453,7 +456,12 @@ var ZOOM_RATE_LIMIT_REMAINING_HEADER = 'X-RateLimit-Remaining';
|
|
|
453
456
|
var ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER = 'Retry-After';
|
|
454
457
|
var DEFAULT_ZOOM_API_RATE_LIMIT = 2;
|
|
455
458
|
var DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = util.MS_IN_SECOND;
|
|
456
|
-
|
|
459
|
+
/**
|
|
460
|
+
* Parses rate limit header details from a Zoom API response.
|
|
461
|
+
*
|
|
462
|
+
* @param headers The response headers to parse
|
|
463
|
+
* @returns Parsed rate limit details, or null if required headers are missing
|
|
464
|
+
*/ function zoomRateLimitHeaderDetails(headers) {
|
|
457
465
|
var limitHeader = headers.get(ZOOM_RATE_LIMIT_LIMIT_HEADER);
|
|
458
466
|
var remainingHeader = headers.get(ZOOM_RATE_LIMIT_REMAINING_HEADER);
|
|
459
467
|
var retryAfterHeader = headers.get(ZOOM_RATE_LIMIT_RETRY_AFTER_HEADER);
|
|
@@ -497,9 +505,9 @@ var ZoomTooManyRequestsError = /*#__PURE__*/ function(ZoomServerFetchResponseErr
|
|
|
497
505
|
/**
|
|
498
506
|
* Function that parses/transforms a ZoomServerErrorData into a general ZoomServerError or other known error type.
|
|
499
507
|
*
|
|
500
|
-
* @param
|
|
501
|
-
* @param responseError
|
|
502
|
-
* @returns
|
|
508
|
+
* @param zoomServerError The error data from the Zoom API
|
|
509
|
+
* @param responseError The original fetch response error
|
|
510
|
+
* @returns A typed ZoomServerFetchResponseError, or undefined
|
|
503
511
|
*/ function parseZoomServerErrorData(zoomServerError, responseError) {
|
|
504
512
|
var result;
|
|
505
513
|
if (responseError.response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
|
|
@@ -509,7 +517,7 @@ var ZoomTooManyRequestsError = /*#__PURE__*/ function(ZoomServerFetchResponseErr
|
|
|
509
517
|
responseError: responseError,
|
|
510
518
|
headerDetails: result.headerDetails
|
|
511
519
|
});
|
|
512
|
-
} else
|
|
520
|
+
} else {
|
|
513
521
|
switch(zoomServerError.code){
|
|
514
522
|
default:
|
|
515
523
|
result = new ZoomServerFetchResponseError(zoomServerError, responseError);
|
|
@@ -522,6 +530,9 @@ var ZoomTooManyRequestsError = /*#__PURE__*/ function(ZoomServerFetchResponseErr
|
|
|
522
530
|
* Returns a pre-configured MakeUrlSearchParamsOptions that omits the silenceError key.
|
|
523
531
|
*
|
|
524
532
|
* If other options are input, it merges those two options together and adds silenceError to the omitted keys.
|
|
533
|
+
*
|
|
534
|
+
* @param options Optional additional MakeUrlSearchParamsOptions to merge
|
|
535
|
+
* @returns A MakeUrlSearchParamsOptions that omits silenceError
|
|
525
536
|
*/ function omitSilenceZoomErrorKeys(options) {
|
|
526
537
|
var omitKeys = [
|
|
527
538
|
'silenceError'
|
|
@@ -537,10 +548,8 @@ function silenceZoomErrorWithCodesFunction(codes, returnFn) {
|
|
|
537
548
|
var codesSet = new Set(util.asArray(codes));
|
|
538
549
|
return function(silence) {
|
|
539
550
|
return function(reason) {
|
|
540
|
-
if (silence !== false && _instanceof(reason, ZoomServerFetchResponseError)) {
|
|
541
|
-
|
|
542
|
-
return returnFn === null || returnFn === void 0 ? void 0 : returnFn(reason);
|
|
543
|
-
}
|
|
551
|
+
if (silence !== false && _instanceof(reason, ZoomServerFetchResponseError) && codesSet.has(reason.code)) {
|
|
552
|
+
return returnFn === null || returnFn === void 0 ? void 0 : returnFn(reason);
|
|
544
553
|
}
|
|
545
554
|
throw reason;
|
|
546
555
|
};
|
|
@@ -549,6 +558,9 @@ function silenceZoomErrorWithCodesFunction(codes, returnFn) {
|
|
|
549
558
|
|
|
550
559
|
/**
|
|
551
560
|
* https://developers.zoom.us/docs/api/rest/reference/zoom-api/methods/#operation/meeting
|
|
561
|
+
*
|
|
562
|
+
* @param context The Zoom API context
|
|
563
|
+
* @returns A function that retrieves a meeting by ID
|
|
552
564
|
*/ function getMeeting(context) {
|
|
553
565
|
return function(input) {
|
|
554
566
|
return context.fetchJson("/meetings/".concat(input.meetingId), 'GET');
|
|
@@ -556,16 +568,27 @@ function silenceZoomErrorWithCodesFunction(codes, returnFn) {
|
|
|
556
568
|
}
|
|
557
569
|
/**
|
|
558
570
|
* https://developers.zoom.us/docs/api/rest/reference/zoom-api/methods/#operation/meetings
|
|
571
|
+
*
|
|
572
|
+
* @param context The Zoom API context
|
|
573
|
+
* @returns A function that lists meetings for a user
|
|
559
574
|
*/ function listMeetingsForUser(context) {
|
|
560
575
|
return function(input) {
|
|
561
576
|
return context.fetchJson("/users/".concat(input.user, "/meetings"), 'GET').then(mapToZoomPageResult('meetings'));
|
|
562
577
|
};
|
|
563
578
|
}
|
|
564
|
-
|
|
579
|
+
/**
|
|
580
|
+
* Creates a page factory for listing meetings for a user.
|
|
581
|
+
*
|
|
582
|
+
* @param context The Zoom API context
|
|
583
|
+
* @returns A page factory for paginated meeting listing
|
|
584
|
+
*/ function listMeetingsForUserPageFactory(context) {
|
|
565
585
|
return zoomFetchPageFactory(listMeetingsForUser(context));
|
|
566
586
|
}
|
|
567
587
|
/**
|
|
568
588
|
* https://developers.zoom.us/docs/api/meetings/#tag/meetings/POST/users/{userId}/meetings
|
|
589
|
+
*
|
|
590
|
+
* @param context The Zoom API context
|
|
591
|
+
* @returns A function that creates a meeting for a user
|
|
569
592
|
*/ function createMeetingForUser(context) {
|
|
570
593
|
return function(input) {
|
|
571
594
|
return context.fetchJson("/users/".concat(input.user, "/meetings"), {
|
|
@@ -576,6 +599,9 @@ function listMeetingsForUserPageFactory(context) {
|
|
|
576
599
|
}
|
|
577
600
|
/**
|
|
578
601
|
* https://developers.zoom.us/docs/api/meetings/#tag/meetings/PUT/meetings/{meetingId}
|
|
602
|
+
*
|
|
603
|
+
* @param context The Zoom API context
|
|
604
|
+
* @returns A function that updates a meeting
|
|
579
605
|
*/ function updateMeeting(context) {
|
|
580
606
|
return function(input) {
|
|
581
607
|
return context.fetchJson("/meetings/".concat(input.meetingId, "?").concat(fetch.makeUrlSearchParams({
|
|
@@ -589,6 +615,9 @@ function listMeetingsForUserPageFactory(context) {
|
|
|
589
615
|
var DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE = 3001;
|
|
590
616
|
/**
|
|
591
617
|
* https://developers.zoom.us/docs/api/meetings/#tag/meetings/DELETE/meetings/{meetingId}
|
|
618
|
+
*
|
|
619
|
+
* @param context The Zoom API context
|
|
620
|
+
* @returns A function that deletes a meeting (silences 3001 "not found" errors by default)
|
|
592
621
|
*/ function deleteMeeting(context) {
|
|
593
622
|
var silenceDoesNotExistError = silenceZoomErrorWithCodesFunction(DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE);
|
|
594
623
|
return function(input) {
|
|
@@ -597,6 +626,9 @@ var DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE = 3001;
|
|
|
597
626
|
}
|
|
598
627
|
/**
|
|
599
628
|
* https://developers.zoom.us/docs/api/meetings/#tag/meetings/GET/past_meetings/{meetingId}
|
|
629
|
+
*
|
|
630
|
+
* @param context The Zoom API context
|
|
631
|
+
* @returns A function that retrieves a past meeting
|
|
600
632
|
*/ function getPastMeeting(context) {
|
|
601
633
|
return function(input) {
|
|
602
634
|
return context.fetchJson("/past_meetings/".concat(input.meetingId), 'GET');
|
|
@@ -604,12 +636,20 @@ var DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE = 3001;
|
|
|
604
636
|
}
|
|
605
637
|
/**
|
|
606
638
|
* https://developers.zoom.us/docs/api/meetings/#tag/meetings/GET/past_meetings/{meetingId}/participants
|
|
639
|
+
*
|
|
640
|
+
* @param context The Zoom API context
|
|
641
|
+
* @returns A function that retrieves participants from a past meeting
|
|
607
642
|
*/ function getPastMeetingParticipants(context) {
|
|
608
643
|
return function(input) {
|
|
609
644
|
return context.fetchJson("/past_meetings/".concat(input.meetingId, "/participants"), 'GET').then(mapToZoomPageResult('participants'));
|
|
610
645
|
};
|
|
611
646
|
}
|
|
612
|
-
|
|
647
|
+
/**
|
|
648
|
+
* Creates a page factory for listing past meeting participants.
|
|
649
|
+
*
|
|
650
|
+
* @param context The Zoom API context
|
|
651
|
+
* @returns A page factory for paginated participant listing
|
|
652
|
+
*/ function getPastMeetingParticipantsPageFactory(context) {
|
|
613
653
|
return zoomFetchPageFactory(getPastMeetingParticipants(context));
|
|
614
654
|
}
|
|
615
655
|
|
|
@@ -699,7 +739,12 @@ exports.ZoomRegistrationType = void 0;
|
|
|
699
739
|
return context.fetchJson("/users?".concat(fetch.makeUrlSearchParams(input)), 'GET').then(mapToZoomPageResult('users'));
|
|
700
740
|
};
|
|
701
741
|
}
|
|
702
|
-
|
|
742
|
+
/**
|
|
743
|
+
* Creates a page factory for listing users.
|
|
744
|
+
*
|
|
745
|
+
* @param context The Zoom API context
|
|
746
|
+
* @returns A page factory for paginated user listing
|
|
747
|
+
*/ function listUsersPageFactory(context) {
|
|
703
748
|
return zoomFetchPageFactory(listUsers(context));
|
|
704
749
|
}
|
|
705
750
|
|
|
@@ -841,7 +886,12 @@ function _ts_generator$4(thisArg, body) {
|
|
|
841
886
|
}
|
|
842
887
|
// MARK: Parser
|
|
843
888
|
var logZoomErrorToConsole = logZoomServerErrorFunction('Zoom');
|
|
844
|
-
|
|
889
|
+
/**
|
|
890
|
+
* Parses a FetchResponseError into a typed Zoom API error.
|
|
891
|
+
*
|
|
892
|
+
* @param responseError The fetch response error to parse
|
|
893
|
+
* @returns The parsed error, or undefined if parsing fails
|
|
894
|
+
*/ function parseZoomApiError(responseError) {
|
|
845
895
|
return _async_to_generator$4(function() {
|
|
846
896
|
var data, result;
|
|
847
897
|
return _ts_generator$4(this, function(_state) {
|
|
@@ -849,7 +899,7 @@ function parseZoomApiError(responseError) {
|
|
|
849
899
|
case 0:
|
|
850
900
|
return [
|
|
851
901
|
4,
|
|
852
|
-
responseError.response.json().catch(function(
|
|
902
|
+
responseError.response.json().catch(function() {
|
|
853
903
|
return undefined;
|
|
854
904
|
})
|
|
855
905
|
];
|
|
@@ -866,9 +916,15 @@ function parseZoomApiError(responseError) {
|
|
|
866
916
|
});
|
|
867
917
|
})();
|
|
868
918
|
}
|
|
869
|
-
|
|
919
|
+
/**
|
|
920
|
+
* Parses a ZoomServerErrorData into a Zoom API-specific error.
|
|
921
|
+
*
|
|
922
|
+
* @param zoomServerError The raw error data from the Zoom API
|
|
923
|
+
* @param responseError The original fetch response error
|
|
924
|
+
* @returns A parsed error, or undefined if the error is unrecognized
|
|
925
|
+
*/ function parseZoomApiServerErrorResponseData(zoomServerError, responseError) {
|
|
870
926
|
var result;
|
|
871
|
-
|
|
927
|
+
{
|
|
872
928
|
switch(zoomServerError.code){
|
|
873
929
|
default:
|
|
874
930
|
result = parseZoomServerErrorData(zoomServerError, responseError);
|
|
@@ -1114,7 +1170,12 @@ function _ts_generator$3(thisArg, body) {
|
|
|
1114
1170
|
return ZoomOAuthAuthFailureError;
|
|
1115
1171
|
}(fetch.FetchRequestFactoryError);
|
|
1116
1172
|
var logZoomOAuthErrorToConsole = logZoomServerErrorFunction('ZoomOAuth');
|
|
1117
|
-
|
|
1173
|
+
/**
|
|
1174
|
+
* Parses a FetchResponseError into a typed Zoom OAuth error.
|
|
1175
|
+
*
|
|
1176
|
+
* @param responseError The fetch response error to parse
|
|
1177
|
+
* @returns The parsed error, or undefined if parsing fails
|
|
1178
|
+
*/ function parseZoomOAuthError(responseError) {
|
|
1118
1179
|
return _async_to_generator$3(function() {
|
|
1119
1180
|
var data, result;
|
|
1120
1181
|
return _ts_generator$3(this, function(_state) {
|
|
@@ -1122,7 +1183,7 @@ function parseZoomOAuthError(responseError) {
|
|
|
1122
1183
|
case 0:
|
|
1123
1184
|
return [
|
|
1124
1185
|
4,
|
|
1125
|
-
responseError.response.json().catch(function(
|
|
1186
|
+
responseError.response.json().catch(function() {
|
|
1126
1187
|
return undefined;
|
|
1127
1188
|
})
|
|
1128
1189
|
];
|
|
@@ -1139,9 +1200,15 @@ function parseZoomOAuthError(responseError) {
|
|
|
1139
1200
|
});
|
|
1140
1201
|
})();
|
|
1141
1202
|
}
|
|
1142
|
-
|
|
1203
|
+
/**
|
|
1204
|
+
* Parses a ZoomServerErrorData into a Zoom OAuth-specific error.
|
|
1205
|
+
*
|
|
1206
|
+
* @param zoomServerError The raw error data from the Zoom API
|
|
1207
|
+
* @param responseError The original fetch response error
|
|
1208
|
+
* @returns A parsed error, or undefined if the error is unrecognized
|
|
1209
|
+
*/ function parseZoomOAuthServerErrorResponseData(zoomServerError, responseError) {
|
|
1143
1210
|
var result;
|
|
1144
|
-
|
|
1211
|
+
{
|
|
1145
1212
|
var potentialErrorStringCode = zoomServerError.error;
|
|
1146
1213
|
var errorCode = potentialErrorStringCode !== null && potentialErrorStringCode !== void 0 ? potentialErrorStringCode : zoomServerError.code;
|
|
1147
1214
|
switch(errorCode){
|
|
@@ -1286,7 +1353,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
1286
1353
|
}
|
|
1287
1354
|
}
|
|
1288
1355
|
/**
|
|
1289
|
-
* Generates a new ZoomAccessTokenStringFactory.
|
|
1356
|
+
* Generates a new ZoomAccessTokenStringFactory from a ZoomAccessTokenFactory.
|
|
1357
|
+
*
|
|
1358
|
+
* @param zoomAccessTokenFactory The factory to extract the token string from
|
|
1359
|
+
* @returns A factory that returns the access token string
|
|
1290
1360
|
*/ function zoomAccessTokenStringFactory(zoomAccessTokenFactory) {
|
|
1291
1361
|
return function() {
|
|
1292
1362
|
return _async_to_generator$2(function() {
|
|
@@ -1300,7 +1370,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
1300
1370
|
];
|
|
1301
1371
|
case 1:
|
|
1302
1372
|
token = _state.sent();
|
|
1303
|
-
if (!
|
|
1373
|
+
if (!token.accessToken) {
|
|
1304
1374
|
throw new ZoomOAuthAuthFailureError();
|
|
1305
1375
|
}
|
|
1306
1376
|
return [
|
|
@@ -1313,12 +1383,17 @@ function _ts_generator$2(thisArg, body) {
|
|
|
1313
1383
|
};
|
|
1314
1384
|
}
|
|
1315
1385
|
|
|
1316
|
-
var
|
|
1386
|
+
var DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = function DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION(headers) {
|
|
1317
1387
|
console.warn("zoomRateLimitedFetchHandler(): Too many requests made. The limit is ".concat(headers.limit, " requests per reset period. RetryAt is set for ").concat(headers.retryAfterAt, "."));
|
|
1318
1388
|
};
|
|
1319
|
-
|
|
1389
|
+
/**
|
|
1390
|
+
* Creates a rate-limited fetch handler configured for the Zoom API.
|
|
1391
|
+
*
|
|
1392
|
+
* @param config Optional configuration for rate limiting behavior
|
|
1393
|
+
* @returns A configured rate-limited fetch handler
|
|
1394
|
+
*/ function zoomRateLimitedFetchHandler(config) {
|
|
1320
1395
|
var _ref, _ref1, _ref2;
|
|
1321
|
-
var onTooManyRequests = (config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== false ? (_ref = config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== null && _ref !== void 0 ? _ref :
|
|
1396
|
+
var onTooManyRequests = (config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== false ? (_ref = config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== null && _ref !== void 0 ? _ref : DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION : undefined;
|
|
1322
1397
|
var defaultLimit = (_ref1 = config === null || config === void 0 ? void 0 : config.maxRateLimit) !== null && _ref1 !== void 0 ? _ref1 : DEFAULT_ZOOM_API_RATE_LIMIT;
|
|
1323
1398
|
var defaultResetPeriod = (_ref2 = config === null || config === void 0 ? void 0 : config.resetPeriod) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD;
|
|
1324
1399
|
function configForLimit(limit, resetAt) {
|
|
@@ -1344,13 +1419,13 @@ function zoomRateLimitedFetchHandler(config) {
|
|
|
1344
1419
|
var headerDetails = zoomRateLimitHeaderDetails(response.headers);
|
|
1345
1420
|
if (headerDetails) {
|
|
1346
1421
|
var type = headerDetails.type, limit = headerDetails.limit, retryAfterAt = headerDetails.retryAfterAt, remaining = headerDetails.remaining;
|
|
1347
|
-
if (response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1422
|
+
if (response.status === ZOOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE && // For simple query-per-second rate limits, just schedule a retry
|
|
1423
|
+
type === 'QPS') {
|
|
1424
|
+
shouldRetry = true;
|
|
1425
|
+
try {
|
|
1426
|
+
void (onTooManyRequests === null || onTooManyRequests === void 0 ? void 0 : onTooManyRequests(headerDetails, response, fetchResponseError));
|
|
1427
|
+
} catch (unused) {
|
|
1428
|
+
// ignored: onTooManyRequests is for logging only
|
|
1354
1429
|
}
|
|
1355
1430
|
}
|
|
1356
1431
|
// NOTE: typically it seems like these headers are not available usually.
|
|
@@ -1371,6 +1446,10 @@ function zoomRateLimitedFetchHandler(config) {
|
|
|
1371
1446
|
}
|
|
1372
1447
|
});
|
|
1373
1448
|
}
|
|
1449
|
+
// MARK: Compat
|
|
1450
|
+
/**
|
|
1451
|
+
* @deprecated use DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION instead.
|
|
1452
|
+
*/ var DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
|
|
1374
1453
|
|
|
1375
1454
|
/**
|
|
1376
1455
|
* The Zoom API URL for the US datacenter.
|
|
@@ -1504,7 +1583,12 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1504
1583
|
};
|
|
1505
1584
|
}
|
|
1506
1585
|
}
|
|
1507
|
-
|
|
1586
|
+
/**
|
|
1587
|
+
* Creates a Zoom API factory from the given configuration.
|
|
1588
|
+
*
|
|
1589
|
+
* @param factoryConfig Configuration including OAuth context, rate limiting, and fetch settings
|
|
1590
|
+
* @returns A factory function that creates a configured Zoom API instance
|
|
1591
|
+
*/ function zoomFactory(factoryConfig) {
|
|
1508
1592
|
var oauthContext = factoryConfig.oauthContext;
|
|
1509
1593
|
var serverAccessTokenStringFactory = zoomAccessTokenStringFactory(oauthContext.loadAccessToken);
|
|
1510
1594
|
var fetchHandler = zoomRateLimitedFetchHandler(factoryConfig.rateLimiterConfig);
|
|
@@ -1614,7 +1698,13 @@ function zoomFactory(factoryConfig) {
|
|
|
1614
1698
|
return context.fetchJson("/token?grant_type=refresh_token&refresh_token=".concat(refreshToken), zoomOAuthApiFetchJsonInput(context, input));
|
|
1615
1699
|
};
|
|
1616
1700
|
}
|
|
1617
|
-
|
|
1701
|
+
/**
|
|
1702
|
+
* Builds a FetchJsonInput for Zoom OAuth API calls with Basic auth.
|
|
1703
|
+
*
|
|
1704
|
+
* @param context The Zoom OAuth context
|
|
1705
|
+
* @param input Optional override for client credentials
|
|
1706
|
+
* @returns A configured FetchJsonInput for the OAuth API call
|
|
1707
|
+
*/ function zoomOAuthApiFetchJsonInput(context, input) {
|
|
1618
1708
|
var _ref, _ref1;
|
|
1619
1709
|
var _input_client, _input_client1;
|
|
1620
1710
|
var clientId = (_ref = input === null || input === void 0 ? void 0 : (_input_client = input.client) === null || _input_client === void 0 ? void 0 : _input_client.clientId) !== null && _ref !== void 0 ? _ref : context.config.clientId;
|
|
@@ -1630,8 +1720,14 @@ function zoomOAuthApiFetchJsonInput(context, input) {
|
|
|
1630
1720
|
};
|
|
1631
1721
|
return fetchJsonInput;
|
|
1632
1722
|
}
|
|
1633
|
-
|
|
1634
|
-
|
|
1723
|
+
/**
|
|
1724
|
+
* Generates a Basic Authorization header value for Zoom OAuth.
|
|
1725
|
+
*
|
|
1726
|
+
* @param input The client ID and secret pair
|
|
1727
|
+
* @returns The Base64-encoded Basic auth header value
|
|
1728
|
+
*/ function zoomOAuthServerBasicAuthorizationHeaderValue(input) {
|
|
1729
|
+
var credentials = input.clientId + ':' + input.clientSecret;
|
|
1730
|
+
return "Basic ".concat(Buffer.from(credentials).toString('base64'));
|
|
1635
1731
|
}
|
|
1636
1732
|
|
|
1637
1733
|
/**
|
|
@@ -1766,9 +1862,14 @@ function _ts_generator(thisArg, body) {
|
|
|
1766
1862
|
};
|
|
1767
1863
|
}
|
|
1768
1864
|
}
|
|
1769
|
-
|
|
1865
|
+
/**
|
|
1866
|
+
* Creates a ZoomOAuth instance factory from the given configuration.
|
|
1867
|
+
*
|
|
1868
|
+
* @param factoryConfig Configuration for the OAuth factory
|
|
1869
|
+
* @returns A factory that creates configured ZoomOAuth instances
|
|
1870
|
+
*/ function zoomOAuthFactory(factoryConfig) {
|
|
1770
1871
|
var fetchHandler = zoomRateLimitedFetchHandler();
|
|
1771
|
-
var logZoomServerErrorFunction = factoryConfig.logZoomServerErrorFunction, _factoryConfig_fetchFactory = factoryConfig.fetchFactory, fetchFactory = _factoryConfig_fetchFactory === void 0 ? function(
|
|
1872
|
+
var logZoomServerErrorFunction = factoryConfig.logZoomServerErrorFunction, _factoryConfig_fetchFactory = factoryConfig.fetchFactory, fetchFactory = _factoryConfig_fetchFactory === void 0 ? function() {
|
|
1772
1873
|
return fetch.fetchApiFetchService.makeFetch({
|
|
1773
1874
|
baseUrl: ZOOM_OAUTH_API_URL,
|
|
1774
1875
|
baseRequest: {
|
|
@@ -1912,7 +2013,7 @@ function zoomOAuthFactory(factoryConfig) {
|
|
|
1912
2013
|
}
|
|
1913
2014
|
if (!!currentToken) return [
|
|
1914
2015
|
3,
|
|
1915
|
-
|
|
2016
|
+
9
|
|
1916
2017
|
];
|
|
1917
2018
|
_state.label = 3;
|
|
1918
2019
|
case 3:
|
|
@@ -1937,35 +2038,29 @@ function zoomOAuthFactory(factoryConfig) {
|
|
|
1937
2038
|
console.error("zoomOAuthZoomAccessTokenFactory(): Failed retrieving new token from tokenRefresher: ", e);
|
|
1938
2039
|
throw new ZoomOAuthAuthFailureError('Token Refresh Failed');
|
|
1939
2040
|
case 6:
|
|
1940
|
-
if (!currentToken) return [
|
|
1941
|
-
3,
|
|
1942
|
-
10
|
|
1943
|
-
];
|
|
1944
|
-
_state.label = 7;
|
|
1945
|
-
case 7:
|
|
1946
2041
|
_state.trys.push([
|
|
1947
|
-
|
|
1948
|
-
|
|
2042
|
+
6,
|
|
2043
|
+
8,
|
|
1949
2044
|
,
|
|
1950
|
-
|
|
2045
|
+
9
|
|
1951
2046
|
]);
|
|
1952
2047
|
return [
|
|
1953
2048
|
4,
|
|
1954
2049
|
accessTokenCache === null || accessTokenCache === void 0 ? void 0 : accessTokenCache.updateCachedToken(currentToken)
|
|
1955
2050
|
];
|
|
1956
|
-
case
|
|
2051
|
+
case 7:
|
|
1957
2052
|
_state.sent();
|
|
1958
2053
|
return [
|
|
1959
2054
|
3,
|
|
1960
|
-
|
|
2055
|
+
9
|
|
1961
2056
|
];
|
|
1962
|
-
case
|
|
2057
|
+
case 8:
|
|
1963
2058
|
_state.sent();
|
|
1964
2059
|
return [
|
|
1965
2060
|
3,
|
|
1966
|
-
|
|
2061
|
+
9
|
|
1967
2062
|
];
|
|
1968
|
-
case
|
|
2063
|
+
case 9:
|
|
1969
2064
|
return [
|
|
1970
2065
|
2,
|
|
1971
2066
|
currentToken
|
|
@@ -1978,6 +2073,7 @@ function zoomOAuthFactory(factoryConfig) {
|
|
|
1978
2073
|
|
|
1979
2074
|
exports.DEFAULT_ZOOM_API_RATE_LIMIT = DEFAULT_ZOOM_API_RATE_LIMIT;
|
|
1980
2075
|
exports.DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD = DEFAULT_ZOOM_API_RATE_LIMIT_RESET_PERIOD;
|
|
2076
|
+
exports.DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION;
|
|
1981
2077
|
exports.DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION = DEFAULT_ZOOM_RATE_LIMITED_TOO_MANY_REQUETS_LOG_FUNCTION;
|
|
1982
2078
|
exports.DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE = DELETE_MEETING_DOES_NOT_EXIST_ERROR_CODE;
|
|
1983
2079
|
exports.ZOOM_ACCOUNTS_INVALID_GRANT_ERROR_CODE = ZOOM_ACCOUNTS_INVALID_GRANT_ERROR_CODE;
|