@dereekb/zoom 13.4.0 → 13.4.2
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 -58
- package/index.esm.js +152 -59
- package/nestjs/index.cjs.js +60 -35
- package/nestjs/index.esm.js +60 -35
- 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.api.page.d.ts +3 -3
- package/src/lib/zoom.error.api.d.ts +22 -6
- package/src/lib/zoom.limit.d.ts +15 -1
package/nestjs/index.cjs.js
CHANGED
|
@@ -75,7 +75,8 @@ function _define_property$8(obj, key, value) {
|
|
|
75
75
|
var zoomOAuth = config.zoomOAuth;
|
|
76
76
|
if (!zoomOAuth) {
|
|
77
77
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth is required');
|
|
78
|
-
}
|
|
78
|
+
}
|
|
79
|
+
{
|
|
79
80
|
if (!zoomOAuth.accountId) {
|
|
80
81
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth.accountId is required');
|
|
81
82
|
} else if (!zoomOAuth.clientSecret) {
|
|
@@ -89,7 +90,13 @@ function _define_property$8(obj, key, value) {
|
|
|
89
90
|
]);
|
|
90
91
|
return ZoomOAuthServiceConfig;
|
|
91
92
|
}();
|
|
92
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Reads a ZoomOAuthServiceConfig from the NestJS ConfigService using environment variables.
|
|
95
|
+
*
|
|
96
|
+
* @param configService The NestJS ConfigService to read from
|
|
97
|
+
* @param prefix Optional prefix for environment variable names
|
|
98
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
99
|
+
*/ function readZoomOAuthServiceConfigFromConfigService(configService, prefix) {
|
|
93
100
|
var prefixString = util.characterPrefixSuffixInstance({
|
|
94
101
|
suffix: '_',
|
|
95
102
|
suffixEmptyString: false
|
|
@@ -339,7 +346,11 @@ function _ts_generator$2(thisArg, body) {
|
|
|
339
346
|
exports.ZoomOAuthAccessTokenCacheService = __decorate([
|
|
340
347
|
common.Injectable()
|
|
341
348
|
], exports.ZoomOAuthAccessTokenCacheService);
|
|
342
|
-
|
|
349
|
+
/**
|
|
350
|
+
* Default error logging function for merged cache service update failures.
|
|
351
|
+
*
|
|
352
|
+
* @param failedUpdates Array of failed cache update results with their errors
|
|
353
|
+
*/ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
343
354
|
console.warn("mergeZoomOAuthAccessTokenCacheServices(): failed updating ".concat(failedUpdates.length, " caches."));
|
|
344
355
|
failedUpdates.forEach(function(param, i) {
|
|
345
356
|
var _param = _sliced_to_array(param, 2); _param[0]; var e = _param[1];
|
|
@@ -353,7 +364,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
353
364
|
*
|
|
354
365
|
* When updating a cached token, it will update the token across all services.
|
|
355
366
|
*
|
|
356
|
-
* @param
|
|
367
|
+
* @param inputServicesToMerge Must include at least one service. Empty arrays will throw an error.
|
|
368
|
+
* @param logError Optional error logging configuration. Pass a function, true for default logging, or false to disable.
|
|
369
|
+
* @returns A merged ZoomOAuthAccessTokenCacheService
|
|
357
370
|
*/ function mergeZoomOAuthAccessTokenCacheServices(inputServicesToMerge, logError) {
|
|
358
371
|
var allServices = _to_consumable_array$2(inputServicesToMerge);
|
|
359
372
|
var logErrorFunction = typeof logError === 'function' ? logError : logError !== false ? logMergeZoomOAuthAccessTokenCacheServiceErrorFunction : undefined;
|
|
@@ -398,7 +411,7 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
398
411
|
});
|
|
399
412
|
})).then(function(x) {
|
|
400
413
|
// only find the failures if we're logging
|
|
401
|
-
if (logErrorFunction
|
|
414
|
+
if (logErrorFunction) {
|
|
402
415
|
var failedUpdates = util.filterMaybeArrayValues(x.map(function(y) {
|
|
403
416
|
return y.value;
|
|
404
417
|
}));
|
|
@@ -414,13 +427,13 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
414
427
|
};
|
|
415
428
|
return cacheForService;
|
|
416
429
|
};
|
|
417
|
-
var allServiceAccessTokenCaches = allServices.map(function(
|
|
418
|
-
return
|
|
430
|
+
var allServiceAccessTokenCaches = allServices.map(function(service) {
|
|
431
|
+
return service.loadZoomAccessTokenCache();
|
|
419
432
|
});
|
|
420
|
-
var allServicesWithCacheForRefreshToken = allServices.filter(function(
|
|
421
|
-
return
|
|
433
|
+
var allServicesWithCacheForRefreshToken = allServices.filter(function(service) {
|
|
434
|
+
return service.cacheForRefreshToken != null;
|
|
422
435
|
});
|
|
423
|
-
var cacheForRefreshToken =
|
|
436
|
+
var cacheForRefreshToken = allServicesWithCacheForRefreshToken.length > 0 ? function(refreshToken) {
|
|
424
437
|
var allCaches = allServicesWithCacheForRefreshToken.map(function(x) {
|
|
425
438
|
return x.cacheForRefreshToken(refreshToken);
|
|
426
439
|
});
|
|
@@ -438,7 +451,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
438
451
|
/**
|
|
439
452
|
* Creates a ZoomOAuthAccessTokenCacheService that uses in-memory storage.
|
|
440
453
|
*
|
|
441
|
-
* @
|
|
454
|
+
* @param existingToken Optional initial token to seed the cache with
|
|
455
|
+
* @param logAccessToConsole Whether to log token access to console
|
|
456
|
+
* @returns A memory-backed ZoomOAuthAccessTokenCacheService
|
|
442
457
|
*/ function memoryZoomOAuthAccessTokenCacheService(existingToken, logAccessToConsole) {
|
|
443
458
|
var token = existingToken;
|
|
444
459
|
function loadZoomAccessTokenCache() {
|
|
@@ -490,7 +505,9 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
490
505
|
*
|
|
491
506
|
* Useful for testing.
|
|
492
507
|
*
|
|
493
|
-
* @
|
|
508
|
+
* @param filename Path to the token cache file
|
|
509
|
+
* @param useMemoryCache Whether to also cache tokens in memory for faster access
|
|
510
|
+
* @returns A file-system-backed ZoomOAuthAccessTokenCacheService
|
|
494
511
|
*/ function fileZoomOAuthAccessTokenCacheService() {
|
|
495
512
|
var filename = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH, useMemoryCache = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
496
513
|
var loadedToken = null;
|
|
@@ -594,7 +611,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
594
611
|
var accessTokenCache = {
|
|
595
612
|
loadCachedToken: function loadCachedToken() {
|
|
596
613
|
return _async_to_generator$2(function() {
|
|
597
|
-
var tokens
|
|
614
|
+
var tokens;
|
|
598
615
|
return _ts_generator$2(this, function(_state) {
|
|
599
616
|
switch(_state.label){
|
|
600
617
|
case 0:
|
|
@@ -604,11 +621,10 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
604
621
|
];
|
|
605
622
|
case 1:
|
|
606
623
|
tokens = _state.sent();
|
|
607
|
-
token = tokens.token;
|
|
608
624
|
// console.log('retrieving access token from file: ', { token });
|
|
609
625
|
return [
|
|
610
626
|
2,
|
|
611
|
-
token
|
|
627
|
+
tokens.token
|
|
612
628
|
];
|
|
613
629
|
}
|
|
614
630
|
});
|
|
@@ -626,9 +642,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
626
642
|
];
|
|
627
643
|
case 1:
|
|
628
644
|
tokenFile = _state.sent();
|
|
629
|
-
|
|
630
|
-
tokenFile.token = accessToken;
|
|
631
|
-
}
|
|
645
|
+
tokenFile.token = accessToken;
|
|
632
646
|
_state.label = 2;
|
|
633
647
|
case 2:
|
|
634
648
|
_state.trys.push([
|
|
@@ -722,13 +736,13 @@ function _object_spread$2(target) {
|
|
|
722
736
|
exports.ZoomOAuthApi = /*#__PURE__*/ function() {
|
|
723
737
|
function ZoomOAuthApi(config, cacheService) {
|
|
724
738
|
_class_call_check$6(this, ZoomOAuthApi);
|
|
725
|
-
var _config_factoryConfig;
|
|
739
|
+
var _config_zoomOAuth_accessTokenCache, _config_factoryConfig;
|
|
726
740
|
_define_property$6(this, "config", void 0);
|
|
727
741
|
_define_property$6(this, "cacheService", void 0);
|
|
728
742
|
_define_property$6(this, "zoomOAuth", void 0);
|
|
729
743
|
this.config = config;
|
|
730
744
|
this.cacheService = cacheService;
|
|
731
|
-
var accessTokenCache = config.zoomOAuth.accessTokenCache ?
|
|
745
|
+
var accessTokenCache = (_config_zoomOAuth_accessTokenCache = config.zoomOAuth.accessTokenCache) !== null && _config_zoomOAuth_accessTokenCache !== void 0 ? _config_zoomOAuth_accessTokenCache : cacheService.loadZoomAccessTokenCache();
|
|
732
746
|
this.zoomOAuth = zoom.zoomOAuthFactory((_config_factoryConfig = config.factoryConfig) !== null && _config_factoryConfig !== void 0 ? _config_factoryConfig : {})(_object_spread$2({
|
|
733
747
|
accessTokenCache: accessTokenCache
|
|
734
748
|
}, config.zoomOAuth));
|
|
@@ -787,16 +801,19 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
787
801
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
788
802
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
789
803
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
804
|
+
/**
|
|
805
|
+
* Default factory function for creating ZoomOAuthServiceConfig from ConfigService.
|
|
806
|
+
*
|
|
807
|
+
* @param configService The NestJS ConfigService
|
|
808
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
809
|
+
*/ function zoomOAuthServiceConfigFactory(configService) {
|
|
810
|
+
return readZoomOAuthServiceConfigFromConfigService(configService);
|
|
793
811
|
}
|
|
794
812
|
/**
|
|
795
813
|
* Convenience function used to generate ModuleMetadata for an app's ZoomOAuthModule.
|
|
796
814
|
*
|
|
797
|
-
* @param
|
|
798
|
-
* @
|
|
799
|
-
* @returns
|
|
815
|
+
* @param config The configuration for the module metadata
|
|
816
|
+
* @returns Module metadata for the Zoom OAuth module
|
|
800
817
|
*/ function appZoomOAuthModuleMetadata(config$1) {
|
|
801
818
|
var _config_zoomOAuthServiceConfigFactory;
|
|
802
819
|
var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
|
|
@@ -955,7 +972,6 @@ var zoomEventHandlerFactory = util.handlerFactory(function(x) {
|
|
|
955
972
|
});
|
|
956
973
|
var zoomEventHandlerConfigurerFactory = util.handlerConfigurerFactory({
|
|
957
974
|
configurerForAccessor: function configurerForAccessor(accessor) {
|
|
958
|
-
// eslint-disable-next-line
|
|
959
975
|
var fnWithKey = util.handlerMappedSetFunctionFactory(accessor, zoomWebhookEvent);
|
|
960
976
|
var configurer = _object_spread_props$1(_object_spread$1({}, accessor), {
|
|
961
977
|
// Meetings
|
|
@@ -978,7 +994,7 @@ var zoomEventHandlerConfigurerFactory = util.handlerConfigurerFactory({
|
|
|
978
994
|
* @param zoomSecretToken The Zoom secret token.
|
|
979
995
|
* @returns A function that verifies a Zoom webhook event.
|
|
980
996
|
*/ function zoomWebhookEventVerifier(zoomSecretToken) {
|
|
981
|
-
return function(request,
|
|
997
|
+
return function(request, _rawBody) {
|
|
982
998
|
var requestBodyString = String(request.body);
|
|
983
999
|
var message = "v0:".concat(request.headers['x-zm-request-timestamp'], ":").concat(requestBodyString);
|
|
984
1000
|
var hashForVerify = crypto.createHmac('sha256', zoomSecretToken).update(message).digest('hex');
|
|
@@ -1488,7 +1504,12 @@ function _class_call_check$2(instance, Constructor) {
|
|
|
1488
1504
|
throw new TypeError("Cannot call a class as a function");
|
|
1489
1505
|
}
|
|
1490
1506
|
}
|
|
1491
|
-
|
|
1507
|
+
/**
|
|
1508
|
+
* Factory function that creates ZoomWebhookServiceConfig from NestJS ConfigService.
|
|
1509
|
+
*
|
|
1510
|
+
* @param configService The NestJS ConfigService
|
|
1511
|
+
* @returns A validated ZoomWebhookServiceConfig
|
|
1512
|
+
*/ function zoomWebhookServiceConfigFactory(configService) {
|
|
1492
1513
|
var config = {
|
|
1493
1514
|
webhookConfig: {
|
|
1494
1515
|
zoomSecretToken: configService.get(ZOOM_SECRET_TOKEN_ENV_VAR)
|
|
@@ -1568,7 +1589,7 @@ function _define_property$1(obj, key, value) {
|
|
|
1568
1589
|
_create_class$1(ZoomServiceConfig, null, [
|
|
1569
1590
|
{
|
|
1570
1591
|
key: "assertValidConfig",
|
|
1571
|
-
value: function assertValidConfig(
|
|
1592
|
+
value: function assertValidConfig(_config) {
|
|
1572
1593
|
// TODO?
|
|
1573
1594
|
}
|
|
1574
1595
|
}
|
|
@@ -1744,7 +1765,7 @@ exports.ZoomApi = __decorate([
|
|
|
1744
1765
|
__param(0, common.Inject(ZoomServiceConfig)),
|
|
1745
1766
|
__param(1, common.Inject(exports.ZoomOAuthApi))
|
|
1746
1767
|
], exports.ZoomApi);
|
|
1747
|
-
var ZoomApiUserContext = function ZoomApiUserContext(
|
|
1768
|
+
var ZoomApiUserContext = function ZoomApiUserContext(_refreshToken) {
|
|
1748
1769
|
_class_call_check(this, ZoomApiUserContext);
|
|
1749
1770
|
}
|
|
1750
1771
|
;
|
|
@@ -1775,7 +1796,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1775
1796
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1776
1797
|
}
|
|
1777
1798
|
// MARK: Provider Factories
|
|
1778
|
-
|
|
1799
|
+
/**
|
|
1800
|
+
* Default factory function for creating ZoomServiceConfig from ConfigService.
|
|
1801
|
+
*
|
|
1802
|
+
* @param _configService The NestJS ConfigService (unused currently)
|
|
1803
|
+
* @returns A validated ZoomServiceConfig
|
|
1804
|
+
*/ function zoomServiceConfigFactory(_configService) {
|
|
1779
1805
|
var config = {
|
|
1780
1806
|
zoom: {}
|
|
1781
1807
|
};
|
|
@@ -1785,9 +1811,8 @@ function zoomServiceConfigFactory(configService) {
|
|
|
1785
1811
|
/**
|
|
1786
1812
|
* Convenience function used to generate ModuleMetadata for an app's ZoomModule.
|
|
1787
1813
|
*
|
|
1788
|
-
* @param
|
|
1789
|
-
* @
|
|
1790
|
-
* @returns
|
|
1814
|
+
* @param config The configuration for the module metadata
|
|
1815
|
+
* @returns Module metadata for the Zoom module
|
|
1791
1816
|
*/ function appZoomModuleMetadata(config$1) {
|
|
1792
1817
|
var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
|
|
1793
1818
|
var dependencyModuleImport = dependencyModule ? [
|
package/nestjs/index.esm.js
CHANGED
|
@@ -73,7 +73,8 @@ function _define_property$8(obj, key, value) {
|
|
|
73
73
|
var zoomOAuth = config.zoomOAuth;
|
|
74
74
|
if (!zoomOAuth) {
|
|
75
75
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth is required');
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
|
+
{
|
|
77
78
|
if (!zoomOAuth.accountId) {
|
|
78
79
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth.accountId is required');
|
|
79
80
|
} else if (!zoomOAuth.clientSecret) {
|
|
@@ -87,7 +88,13 @@ function _define_property$8(obj, key, value) {
|
|
|
87
88
|
]);
|
|
88
89
|
return ZoomOAuthServiceConfig;
|
|
89
90
|
}();
|
|
90
|
-
|
|
91
|
+
/**
|
|
92
|
+
* Reads a ZoomOAuthServiceConfig from the NestJS ConfigService using environment variables.
|
|
93
|
+
*
|
|
94
|
+
* @param configService The NestJS ConfigService to read from
|
|
95
|
+
* @param prefix Optional prefix for environment variable names
|
|
96
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
97
|
+
*/ function readZoomOAuthServiceConfigFromConfigService(configService, prefix) {
|
|
91
98
|
var prefixString = characterPrefixSuffixInstance({
|
|
92
99
|
suffix: '_',
|
|
93
100
|
suffixEmptyString: false
|
|
@@ -337,7 +344,11 @@ function _ts_generator$2(thisArg, body) {
|
|
|
337
344
|
ZoomOAuthAccessTokenCacheService = __decorate([
|
|
338
345
|
Injectable()
|
|
339
346
|
], ZoomOAuthAccessTokenCacheService);
|
|
340
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Default error logging function for merged cache service update failures.
|
|
349
|
+
*
|
|
350
|
+
* @param failedUpdates Array of failed cache update results with their errors
|
|
351
|
+
*/ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
341
352
|
console.warn("mergeZoomOAuthAccessTokenCacheServices(): failed updating ".concat(failedUpdates.length, " caches."));
|
|
342
353
|
failedUpdates.forEach(function(param, i) {
|
|
343
354
|
var _param = _sliced_to_array(param, 2); _param[0]; var e = _param[1];
|
|
@@ -351,7 +362,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
351
362
|
*
|
|
352
363
|
* When updating a cached token, it will update the token across all services.
|
|
353
364
|
*
|
|
354
|
-
* @param
|
|
365
|
+
* @param inputServicesToMerge Must include at least one service. Empty arrays will throw an error.
|
|
366
|
+
* @param logError Optional error logging configuration. Pass a function, true for default logging, or false to disable.
|
|
367
|
+
* @returns A merged ZoomOAuthAccessTokenCacheService
|
|
355
368
|
*/ function mergeZoomOAuthAccessTokenCacheServices(inputServicesToMerge, logError) {
|
|
356
369
|
var allServices = _to_consumable_array$2(inputServicesToMerge);
|
|
357
370
|
var logErrorFunction = typeof logError === 'function' ? logError : logError !== false ? logMergeZoomOAuthAccessTokenCacheServiceErrorFunction : undefined;
|
|
@@ -396,7 +409,7 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
396
409
|
});
|
|
397
410
|
})).then(function(x) {
|
|
398
411
|
// only find the failures if we're logging
|
|
399
|
-
if (logErrorFunction
|
|
412
|
+
if (logErrorFunction) {
|
|
400
413
|
var failedUpdates = filterMaybeArrayValues(x.map(function(y) {
|
|
401
414
|
return y.value;
|
|
402
415
|
}));
|
|
@@ -412,13 +425,13 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
412
425
|
};
|
|
413
426
|
return cacheForService;
|
|
414
427
|
};
|
|
415
|
-
var allServiceAccessTokenCaches = allServices.map(function(
|
|
416
|
-
return
|
|
428
|
+
var allServiceAccessTokenCaches = allServices.map(function(service) {
|
|
429
|
+
return service.loadZoomAccessTokenCache();
|
|
417
430
|
});
|
|
418
|
-
var allServicesWithCacheForRefreshToken = allServices.filter(function(
|
|
419
|
-
return
|
|
431
|
+
var allServicesWithCacheForRefreshToken = allServices.filter(function(service) {
|
|
432
|
+
return service.cacheForRefreshToken != null;
|
|
420
433
|
});
|
|
421
|
-
var cacheForRefreshToken =
|
|
434
|
+
var cacheForRefreshToken = allServicesWithCacheForRefreshToken.length > 0 ? function(refreshToken) {
|
|
422
435
|
var allCaches = allServicesWithCacheForRefreshToken.map(function(x) {
|
|
423
436
|
return x.cacheForRefreshToken(refreshToken);
|
|
424
437
|
});
|
|
@@ -436,7 +449,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
436
449
|
/**
|
|
437
450
|
* Creates a ZoomOAuthAccessTokenCacheService that uses in-memory storage.
|
|
438
451
|
*
|
|
439
|
-
* @
|
|
452
|
+
* @param existingToken Optional initial token to seed the cache with
|
|
453
|
+
* @param logAccessToConsole Whether to log token access to console
|
|
454
|
+
* @returns A memory-backed ZoomOAuthAccessTokenCacheService
|
|
440
455
|
*/ function memoryZoomOAuthAccessTokenCacheService(existingToken, logAccessToConsole) {
|
|
441
456
|
var token = existingToken;
|
|
442
457
|
function loadZoomAccessTokenCache() {
|
|
@@ -488,7 +503,9 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
488
503
|
*
|
|
489
504
|
* Useful for testing.
|
|
490
505
|
*
|
|
491
|
-
* @
|
|
506
|
+
* @param filename Path to the token cache file
|
|
507
|
+
* @param useMemoryCache Whether to also cache tokens in memory for faster access
|
|
508
|
+
* @returns A file-system-backed ZoomOAuthAccessTokenCacheService
|
|
492
509
|
*/ function fileZoomOAuthAccessTokenCacheService() {
|
|
493
510
|
var filename = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH, useMemoryCache = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
494
511
|
var loadedToken = null;
|
|
@@ -592,7 +609,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
592
609
|
var accessTokenCache = {
|
|
593
610
|
loadCachedToken: function loadCachedToken() {
|
|
594
611
|
return _async_to_generator$2(function() {
|
|
595
|
-
var tokens
|
|
612
|
+
var tokens;
|
|
596
613
|
return _ts_generator$2(this, function(_state) {
|
|
597
614
|
switch(_state.label){
|
|
598
615
|
case 0:
|
|
@@ -602,11 +619,10 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
602
619
|
];
|
|
603
620
|
case 1:
|
|
604
621
|
tokens = _state.sent();
|
|
605
|
-
token = tokens.token;
|
|
606
622
|
// console.log('retrieving access token from file: ', { token });
|
|
607
623
|
return [
|
|
608
624
|
2,
|
|
609
|
-
token
|
|
625
|
+
tokens.token
|
|
610
626
|
];
|
|
611
627
|
}
|
|
612
628
|
});
|
|
@@ -624,9 +640,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
624
640
|
];
|
|
625
641
|
case 1:
|
|
626
642
|
tokenFile = _state.sent();
|
|
627
|
-
|
|
628
|
-
tokenFile.token = accessToken;
|
|
629
|
-
}
|
|
643
|
+
tokenFile.token = accessToken;
|
|
630
644
|
_state.label = 2;
|
|
631
645
|
case 2:
|
|
632
646
|
_state.trys.push([
|
|
@@ -720,13 +734,13 @@ function _object_spread$2(target) {
|
|
|
720
734
|
var ZoomOAuthApi = /*#__PURE__*/ function() {
|
|
721
735
|
function ZoomOAuthApi(config, cacheService) {
|
|
722
736
|
_class_call_check$6(this, ZoomOAuthApi);
|
|
723
|
-
var _config_factoryConfig;
|
|
737
|
+
var _config_zoomOAuth_accessTokenCache, _config_factoryConfig;
|
|
724
738
|
_define_property$6(this, "config", void 0);
|
|
725
739
|
_define_property$6(this, "cacheService", void 0);
|
|
726
740
|
_define_property$6(this, "zoomOAuth", void 0);
|
|
727
741
|
this.config = config;
|
|
728
742
|
this.cacheService = cacheService;
|
|
729
|
-
var accessTokenCache = config.zoomOAuth.accessTokenCache ?
|
|
743
|
+
var accessTokenCache = (_config_zoomOAuth_accessTokenCache = config.zoomOAuth.accessTokenCache) !== null && _config_zoomOAuth_accessTokenCache !== void 0 ? _config_zoomOAuth_accessTokenCache : cacheService.loadZoomAccessTokenCache();
|
|
730
744
|
this.zoomOAuth = zoomOAuthFactory((_config_factoryConfig = config.factoryConfig) !== null && _config_factoryConfig !== void 0 ? _config_factoryConfig : {})(_object_spread$2({
|
|
731
745
|
accessTokenCache: accessTokenCache
|
|
732
746
|
}, config.zoomOAuth));
|
|
@@ -785,16 +799,19 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
785
799
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
786
800
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
787
801
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
802
|
+
/**
|
|
803
|
+
* Default factory function for creating ZoomOAuthServiceConfig from ConfigService.
|
|
804
|
+
*
|
|
805
|
+
* @param configService The NestJS ConfigService
|
|
806
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
807
|
+
*/ function zoomOAuthServiceConfigFactory(configService) {
|
|
808
|
+
return readZoomOAuthServiceConfigFromConfigService(configService);
|
|
791
809
|
}
|
|
792
810
|
/**
|
|
793
811
|
* Convenience function used to generate ModuleMetadata for an app's ZoomOAuthModule.
|
|
794
812
|
*
|
|
795
|
-
* @param
|
|
796
|
-
* @
|
|
797
|
-
* @returns
|
|
813
|
+
* @param config The configuration for the module metadata
|
|
814
|
+
* @returns Module metadata for the Zoom OAuth module
|
|
798
815
|
*/ function appZoomOAuthModuleMetadata(config) {
|
|
799
816
|
var _config_zoomOAuthServiceConfigFactory;
|
|
800
817
|
var dependencyModule = config.dependencyModule, imports = config.imports, exports$1 = config.exports, providers = config.providers;
|
|
@@ -953,7 +970,6 @@ var zoomEventHandlerFactory = handlerFactory(function(x) {
|
|
|
953
970
|
});
|
|
954
971
|
var zoomEventHandlerConfigurerFactory = handlerConfigurerFactory({
|
|
955
972
|
configurerForAccessor: function configurerForAccessor(accessor) {
|
|
956
|
-
// eslint-disable-next-line
|
|
957
973
|
var fnWithKey = handlerMappedSetFunctionFactory(accessor, zoomWebhookEvent);
|
|
958
974
|
var configurer = _object_spread_props$1(_object_spread$1({}, accessor), {
|
|
959
975
|
// Meetings
|
|
@@ -976,7 +992,7 @@ var zoomEventHandlerConfigurerFactory = handlerConfigurerFactory({
|
|
|
976
992
|
* @param zoomSecretToken The Zoom secret token.
|
|
977
993
|
* @returns A function that verifies a Zoom webhook event.
|
|
978
994
|
*/ function zoomWebhookEventVerifier(zoomSecretToken) {
|
|
979
|
-
return function(request,
|
|
995
|
+
return function(request, _rawBody) {
|
|
980
996
|
var requestBodyString = String(request.body);
|
|
981
997
|
var message = "v0:".concat(request.headers['x-zm-request-timestamp'], ":").concat(requestBodyString);
|
|
982
998
|
var hashForVerify = createHmac('sha256', zoomSecretToken).update(message).digest('hex');
|
|
@@ -1486,7 +1502,12 @@ function _class_call_check$2(instance, Constructor) {
|
|
|
1486
1502
|
throw new TypeError("Cannot call a class as a function");
|
|
1487
1503
|
}
|
|
1488
1504
|
}
|
|
1489
|
-
|
|
1505
|
+
/**
|
|
1506
|
+
* Factory function that creates ZoomWebhookServiceConfig from NestJS ConfigService.
|
|
1507
|
+
*
|
|
1508
|
+
* @param configService The NestJS ConfigService
|
|
1509
|
+
* @returns A validated ZoomWebhookServiceConfig
|
|
1510
|
+
*/ function zoomWebhookServiceConfigFactory(configService) {
|
|
1490
1511
|
var config = {
|
|
1491
1512
|
webhookConfig: {
|
|
1492
1513
|
zoomSecretToken: configService.get(ZOOM_SECRET_TOKEN_ENV_VAR)
|
|
@@ -1566,7 +1587,7 @@ function _define_property$1(obj, key, value) {
|
|
|
1566
1587
|
_create_class$1(ZoomServiceConfig, null, [
|
|
1567
1588
|
{
|
|
1568
1589
|
key: "assertValidConfig",
|
|
1569
|
-
value: function assertValidConfig(
|
|
1590
|
+
value: function assertValidConfig(_config) {
|
|
1570
1591
|
// TODO?
|
|
1571
1592
|
}
|
|
1572
1593
|
}
|
|
@@ -1742,7 +1763,7 @@ ZoomApi = __decorate([
|
|
|
1742
1763
|
__param(0, Inject(ZoomServiceConfig)),
|
|
1743
1764
|
__param(1, Inject(ZoomOAuthApi))
|
|
1744
1765
|
], ZoomApi);
|
|
1745
|
-
var ZoomApiUserContext = function ZoomApiUserContext(
|
|
1766
|
+
var ZoomApiUserContext = function ZoomApiUserContext(_refreshToken) {
|
|
1746
1767
|
_class_call_check(this, ZoomApiUserContext);
|
|
1747
1768
|
}
|
|
1748
1769
|
;
|
|
@@ -1773,7 +1794,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1773
1794
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1774
1795
|
}
|
|
1775
1796
|
// MARK: Provider Factories
|
|
1776
|
-
|
|
1797
|
+
/**
|
|
1798
|
+
* Default factory function for creating ZoomServiceConfig from ConfigService.
|
|
1799
|
+
*
|
|
1800
|
+
* @param _configService The NestJS ConfigService (unused currently)
|
|
1801
|
+
* @returns A validated ZoomServiceConfig
|
|
1802
|
+
*/ function zoomServiceConfigFactory(_configService) {
|
|
1777
1803
|
var config = {
|
|
1778
1804
|
zoom: {}
|
|
1779
1805
|
};
|
|
@@ -1783,9 +1809,8 @@ function zoomServiceConfigFactory(configService) {
|
|
|
1783
1809
|
/**
|
|
1784
1810
|
* Convenience function used to generate ModuleMetadata for an app's ZoomModule.
|
|
1785
1811
|
*
|
|
1786
|
-
* @param
|
|
1787
|
-
* @
|
|
1788
|
-
* @returns
|
|
1812
|
+
* @param config The configuration for the module metadata
|
|
1813
|
+
* @returns Module metadata for the Zoom module
|
|
1789
1814
|
*/ function appZoomModuleMetadata(config) {
|
|
1790
1815
|
var dependencyModule = config.dependencyModule, imports = config.imports, exports$1 = config.exports, providers = config.providers;
|
|
1791
1816
|
var dependencyModuleImport = dependencyModule ? [
|
package/nestjs/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/zoom/nestjs",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/nestjs": "13.4.
|
|
6
|
-
"@dereekb/util": "13.4.
|
|
7
|
-
"@dereekb/zoom": "13.4.
|
|
5
|
+
"@dereekb/nestjs": "13.4.2",
|
|
6
|
+
"@dereekb/util": "13.4.2",
|
|
7
|
+
"@dereekb/zoom": "13.4.2",
|
|
8
8
|
"@nestjs/common": "^11.1.16",
|
|
9
9
|
"@nestjs/config": "^4.0.3",
|
|
10
10
|
"express": "^5.0.0"
|
|
@@ -11,4 +11,11 @@ export declare abstract class ZoomOAuthServiceConfig {
|
|
|
11
11
|
readonly factoryConfig?: ZoomOAuthFactoryConfig;
|
|
12
12
|
static assertValidConfig(config: ZoomOAuthServiceConfig): void;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Reads a ZoomOAuthServiceConfig from the NestJS ConfigService using environment variables.
|
|
16
|
+
*
|
|
17
|
+
* @param configService The NestJS ConfigService to read from
|
|
18
|
+
* @param prefix Optional prefix for environment variable names
|
|
19
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
20
|
+
*/
|
|
14
21
|
export declare function readZoomOAuthServiceConfigFromConfigService(configService: ConfigService, prefix?: string): ZoomOAuthServiceConfig;
|
|
@@ -3,6 +3,12 @@ import { ConfigService } from '@nestjs/config';
|
|
|
3
3
|
import { ZoomOAuthServiceConfig } from './oauth.config';
|
|
4
4
|
import { type Maybe } from '@dereekb/util';
|
|
5
5
|
export type ZoomOAuthServiceConfigFactory = (configService: ConfigService) => ZoomOAuthServiceConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Default factory function for creating ZoomOAuthServiceConfig from ConfigService.
|
|
8
|
+
*
|
|
9
|
+
* @param configService The NestJS ConfigService
|
|
10
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
11
|
+
*/
|
|
6
12
|
export declare function zoomOAuthServiceConfigFactory(configService: ConfigService): ZoomOAuthServiceConfig;
|
|
7
13
|
export interface ProvideAppZoomOAuthMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
8
14
|
/**
|
|
@@ -22,8 +28,7 @@ export interface ProvideAppZoomOAuthMetadataConfig extends Pick<ModuleMetadata,
|
|
|
22
28
|
/**
|
|
23
29
|
* Convenience function used to generate ModuleMetadata for an app's ZoomOAuthModule.
|
|
24
30
|
*
|
|
25
|
-
* @param
|
|
26
|
-
* @
|
|
27
|
-
* @returns
|
|
31
|
+
* @param config The configuration for the module metadata
|
|
32
|
+
* @returns Module metadata for the Zoom OAuth module
|
|
28
33
|
*/
|
|
29
34
|
export declare function appZoomOAuthModuleMetadata(config: ProvideAppZoomOAuthMetadataConfig): ModuleMetadata;
|
|
@@ -19,6 +19,11 @@ export declare abstract class ZoomOAuthAccessTokenCacheService {
|
|
|
19
19
|
}
|
|
20
20
|
export type ZoomOAuthAccessTokenCacheServiceWithRefreshToken = Required<ZoomOAuthAccessTokenCacheService>;
|
|
21
21
|
export type LogMergeZoomOAuthAccessTokenCacheServiceErrorFunction = (failedUpdates: (readonly [ZoomAccessTokenCache, unknown])[]) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Default error logging function for merged cache service update failures.
|
|
24
|
+
*
|
|
25
|
+
* @param failedUpdates Array of failed cache update results with their errors
|
|
26
|
+
*/
|
|
22
27
|
export declare function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates: (readonly [ZoomAccessTokenCache, unknown])[]): void;
|
|
23
28
|
/**
|
|
24
29
|
* Merges the input services in order to use some as a backup source.
|
|
@@ -27,13 +32,17 @@ export declare function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(fa
|
|
|
27
32
|
*
|
|
28
33
|
* When updating a cached token, it will update the token across all services.
|
|
29
34
|
*
|
|
30
|
-
* @param
|
|
35
|
+
* @param inputServicesToMerge Must include at least one service. Empty arrays will throw an error.
|
|
36
|
+
* @param logError Optional error logging configuration. Pass a function, true for default logging, or false to disable.
|
|
37
|
+
* @returns A merged ZoomOAuthAccessTokenCacheService
|
|
31
38
|
*/
|
|
32
39
|
export declare function mergeZoomOAuthAccessTokenCacheServices(inputServicesToMerge: ZoomOAuthAccessTokenCacheService[], logError?: Maybe<boolean | LogMergeZoomOAuthAccessTokenCacheServiceErrorFunction>): ZoomOAuthAccessTokenCacheService;
|
|
33
40
|
/**
|
|
34
41
|
* Creates a ZoomOAuthAccessTokenCacheService that uses in-memory storage.
|
|
35
42
|
*
|
|
36
|
-
* @
|
|
43
|
+
* @param existingToken Optional initial token to seed the cache with
|
|
44
|
+
* @param logAccessToConsole Whether to log token access to console
|
|
45
|
+
* @returns A memory-backed ZoomOAuthAccessTokenCacheService
|
|
37
46
|
*/
|
|
38
47
|
export declare function memoryZoomOAuthAccessTokenCacheService(existingToken?: Maybe<ZoomAccessToken>, logAccessToConsole?: boolean): ZoomOAuthAccessTokenCacheService;
|
|
39
48
|
export interface FileSystemZoomOAuthAccessTokenCacheService extends ZoomOAuthAccessTokenCacheService {
|
|
@@ -50,6 +59,8 @@ export type ZoomOAuthAccessTokenCacheFileContent = {
|
|
|
50
59
|
*
|
|
51
60
|
* Useful for testing.
|
|
52
61
|
*
|
|
53
|
-
* @
|
|
62
|
+
* @param filename Path to the token cache file
|
|
63
|
+
* @param useMemoryCache Whether to also cache tokens in memory for faster access
|
|
64
|
+
* @returns A file-system-backed ZoomOAuthAccessTokenCacheService
|
|
54
65
|
*/
|
|
55
66
|
export declare function fileZoomOAuthAccessTokenCacheService(filename?: string, useMemoryCache?: boolean): FileSystemZoomOAuthAccessTokenCacheService;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ConfigService } from '@nestjs/config';
|
|
2
2
|
import { ZoomWebhookServiceConfig } from './webhook.zoom.config';
|
|
3
|
+
/**
|
|
4
|
+
* Factory function that creates ZoomWebhookServiceConfig from NestJS ConfigService.
|
|
5
|
+
*
|
|
6
|
+
* @param configService The NestJS ConfigService
|
|
7
|
+
* @returns A validated ZoomWebhookServiceConfig
|
|
8
|
+
*/
|
|
3
9
|
export declare function zoomWebhookServiceConfigFactory(configService: ConfigService): ZoomWebhookServiceConfig;
|
|
4
10
|
/**
|
|
5
11
|
* Configures webhooks for the service.
|
|
@@ -8,7 +8,7 @@ export interface ZoomWebhookEvent<T, ET extends ZoomWebhookEventTypeString = Zoo
|
|
|
8
8
|
readonly event_ts: ZoomWebhookTimestamp;
|
|
9
9
|
readonly payload: T;
|
|
10
10
|
}
|
|
11
|
-
export type UntypedZoomWebhookEvent = ZoomWebhookEvent<
|
|
11
|
+
export type UntypedZoomWebhookEvent = ZoomWebhookEvent<unknown>;
|
|
12
12
|
export interface ZoomWebhookAccountIdAndObjectPayloadData<T = unknown> {
|
|
13
13
|
readonly account_id: ZoomAccountId;
|
|
14
14
|
readonly object: T;
|
|
@@ -8,7 +8,7 @@ export interface ZoomWebhookEventVerificationResult {
|
|
|
8
8
|
/**
|
|
9
9
|
* Function that verifies a Zoom webhook event.
|
|
10
10
|
*/
|
|
11
|
-
export type ZoomWebhookEventVerifier = (req: Request,
|
|
11
|
+
export type ZoomWebhookEventVerifier = (req: Request, _rawBody: Buffer) => ZoomWebhookEventVerificationResult;
|
|
12
12
|
/**
|
|
13
13
|
* Verifies a Zoom webhook event header.
|
|
14
14
|
*
|
|
@@ -6,5 +6,5 @@ export type ZoomServiceApiConfig = ZoomConfig & {};
|
|
|
6
6
|
export declare abstract class ZoomServiceConfig {
|
|
7
7
|
readonly zoom: ZoomServiceApiConfig;
|
|
8
8
|
readonly factoryConfig?: ZoomFactoryConfig;
|
|
9
|
-
static assertValidConfig(
|
|
9
|
+
static assertValidConfig(_config: ZoomServiceConfig): void;
|
|
10
10
|
}
|