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