@dereekb/zoom 13.3.1 → 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/nestjs/index.cjs.js
CHANGED
|
@@ -74,8 +74,10 @@ function _define_property$8(obj, key, value) {
|
|
|
74
74
|
value: function assertValidConfig(config) {
|
|
75
75
|
var zoomOAuth = config.zoomOAuth;
|
|
76
76
|
if (!zoomOAuth) {
|
|
77
|
+
// eslint-disable-line @typescript-eslint/no-unnecessary-condition -- runtime validation
|
|
77
78
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth is required');
|
|
78
|
-
}
|
|
79
|
+
}
|
|
80
|
+
{
|
|
79
81
|
if (!zoomOAuth.accountId) {
|
|
80
82
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth.accountId is required');
|
|
81
83
|
} else if (!zoomOAuth.clientSecret) {
|
|
@@ -89,7 +91,13 @@ function _define_property$8(obj, key, value) {
|
|
|
89
91
|
]);
|
|
90
92
|
return ZoomOAuthServiceConfig;
|
|
91
93
|
}();
|
|
92
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Reads a ZoomOAuthServiceConfig from the NestJS ConfigService using environment variables.
|
|
96
|
+
*
|
|
97
|
+
* @param configService The NestJS ConfigService to read from
|
|
98
|
+
* @param prefix Optional prefix for environment variable names
|
|
99
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
100
|
+
*/ function readZoomOAuthServiceConfigFromConfigService(configService, prefix) {
|
|
93
101
|
var prefixString = util.characterPrefixSuffixInstance({
|
|
94
102
|
suffix: '_',
|
|
95
103
|
suffixEmptyString: false
|
|
@@ -339,7 +347,11 @@ function _ts_generator$2(thisArg, body) {
|
|
|
339
347
|
exports.ZoomOAuthAccessTokenCacheService = __decorate([
|
|
340
348
|
common.Injectable()
|
|
341
349
|
], exports.ZoomOAuthAccessTokenCacheService);
|
|
342
|
-
|
|
350
|
+
/**
|
|
351
|
+
* Default error logging function for merged cache service update failures.
|
|
352
|
+
*
|
|
353
|
+
* @param failedUpdates Array of failed cache update results with their errors
|
|
354
|
+
*/ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
343
355
|
console.warn("mergeZoomOAuthAccessTokenCacheServices(): failed updating ".concat(failedUpdates.length, " caches."));
|
|
344
356
|
failedUpdates.forEach(function(param, i) {
|
|
345
357
|
var _param = _sliced_to_array(param, 2); _param[0]; var e = _param[1];
|
|
@@ -353,7 +365,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
353
365
|
*
|
|
354
366
|
* When updating a cached token, it will update the token across all services.
|
|
355
367
|
*
|
|
356
|
-
* @param
|
|
368
|
+
* @param inputServicesToMerge Must include at least one service. Empty arrays will throw an error.
|
|
369
|
+
* @param logError Optional error logging configuration. Pass a function, true for default logging, or false to disable.
|
|
370
|
+
* @returns A merged ZoomOAuthAccessTokenCacheService
|
|
357
371
|
*/ function mergeZoomOAuthAccessTokenCacheServices(inputServicesToMerge, logError) {
|
|
358
372
|
var allServices = _to_consumable_array$2(inputServicesToMerge);
|
|
359
373
|
var logErrorFunction = typeof logError === 'function' ? logError : logError !== false ? logMergeZoomOAuthAccessTokenCacheServiceErrorFunction : undefined;
|
|
@@ -398,7 +412,7 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
398
412
|
});
|
|
399
413
|
})).then(function(x) {
|
|
400
414
|
// only find the failures if we're logging
|
|
401
|
-
if (logErrorFunction
|
|
415
|
+
if (logErrorFunction) {
|
|
402
416
|
var failedUpdates = util.filterMaybeArrayValues(x.map(function(y) {
|
|
403
417
|
return y.value;
|
|
404
418
|
}));
|
|
@@ -414,13 +428,13 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
414
428
|
};
|
|
415
429
|
return cacheForService;
|
|
416
430
|
};
|
|
417
|
-
var allServiceAccessTokenCaches = allServices.map(function(
|
|
418
|
-
return
|
|
431
|
+
var allServiceAccessTokenCaches = allServices.map(function(service) {
|
|
432
|
+
return service.loadZoomAccessTokenCache();
|
|
419
433
|
});
|
|
420
|
-
var allServicesWithCacheForRefreshToken = allServices.filter(function(
|
|
421
|
-
return
|
|
434
|
+
var allServicesWithCacheForRefreshToken = allServices.filter(function(service) {
|
|
435
|
+
return service.cacheForRefreshToken != null;
|
|
422
436
|
});
|
|
423
|
-
var cacheForRefreshToken =
|
|
437
|
+
var cacheForRefreshToken = allServicesWithCacheForRefreshToken.length > 0 ? function(refreshToken) {
|
|
424
438
|
var allCaches = allServicesWithCacheForRefreshToken.map(function(x) {
|
|
425
439
|
return x.cacheForRefreshToken(refreshToken);
|
|
426
440
|
});
|
|
@@ -438,7 +452,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
438
452
|
/**
|
|
439
453
|
* Creates a ZoomOAuthAccessTokenCacheService that uses in-memory storage.
|
|
440
454
|
*
|
|
441
|
-
* @
|
|
455
|
+
* @param existingToken Optional initial token to seed the cache with
|
|
456
|
+
* @param logAccessToConsole Whether to log token access to console
|
|
457
|
+
* @returns A memory-backed ZoomOAuthAccessTokenCacheService
|
|
442
458
|
*/ function memoryZoomOAuthAccessTokenCacheService(existingToken, logAccessToConsole) {
|
|
443
459
|
var token = existingToken;
|
|
444
460
|
function loadZoomAccessTokenCache() {
|
|
@@ -490,7 +506,9 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
490
506
|
*
|
|
491
507
|
* Useful for testing.
|
|
492
508
|
*
|
|
493
|
-
* @
|
|
509
|
+
* @param filename Path to the token cache file
|
|
510
|
+
* @param useMemoryCache Whether to also cache tokens in memory for faster access
|
|
511
|
+
* @returns A file-system-backed ZoomOAuthAccessTokenCacheService
|
|
494
512
|
*/ function fileZoomOAuthAccessTokenCacheService() {
|
|
495
513
|
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
514
|
var loadedToken = null;
|
|
@@ -594,7 +612,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
594
612
|
var accessTokenCache = {
|
|
595
613
|
loadCachedToken: function loadCachedToken() {
|
|
596
614
|
return _async_to_generator$2(function() {
|
|
597
|
-
var tokens
|
|
615
|
+
var tokens;
|
|
598
616
|
return _ts_generator$2(this, function(_state) {
|
|
599
617
|
switch(_state.label){
|
|
600
618
|
case 0:
|
|
@@ -604,11 +622,10 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
604
622
|
];
|
|
605
623
|
case 1:
|
|
606
624
|
tokens = _state.sent();
|
|
607
|
-
token = tokens.token;
|
|
608
625
|
// console.log('retrieving access token from file: ', { token });
|
|
609
626
|
return [
|
|
610
627
|
2,
|
|
611
|
-
token
|
|
628
|
+
tokens.token
|
|
612
629
|
];
|
|
613
630
|
}
|
|
614
631
|
});
|
|
@@ -626,9 +643,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
626
643
|
];
|
|
627
644
|
case 1:
|
|
628
645
|
tokenFile = _state.sent();
|
|
629
|
-
|
|
630
|
-
tokenFile.token = accessToken;
|
|
631
|
-
}
|
|
646
|
+
tokenFile.token = accessToken;
|
|
632
647
|
_state.label = 2;
|
|
633
648
|
case 2:
|
|
634
649
|
_state.trys.push([
|
|
@@ -722,13 +737,13 @@ function _object_spread$2(target) {
|
|
|
722
737
|
exports.ZoomOAuthApi = /*#__PURE__*/ function() {
|
|
723
738
|
function ZoomOAuthApi(config, cacheService) {
|
|
724
739
|
_class_call_check$6(this, ZoomOAuthApi);
|
|
725
|
-
var _config_factoryConfig;
|
|
740
|
+
var _config_zoomOAuth_accessTokenCache, _config_factoryConfig;
|
|
726
741
|
_define_property$6(this, "config", void 0);
|
|
727
742
|
_define_property$6(this, "cacheService", void 0);
|
|
728
743
|
_define_property$6(this, "zoomOAuth", void 0);
|
|
729
744
|
this.config = config;
|
|
730
745
|
this.cacheService = cacheService;
|
|
731
|
-
var accessTokenCache = config.zoomOAuth.accessTokenCache ?
|
|
746
|
+
var accessTokenCache = (_config_zoomOAuth_accessTokenCache = config.zoomOAuth.accessTokenCache) !== null && _config_zoomOAuth_accessTokenCache !== void 0 ? _config_zoomOAuth_accessTokenCache : cacheService.loadZoomAccessTokenCache();
|
|
732
747
|
this.zoomOAuth = zoom.zoomOAuthFactory((_config_factoryConfig = config.factoryConfig) !== null && _config_factoryConfig !== void 0 ? _config_factoryConfig : {})(_object_spread$2({
|
|
733
748
|
accessTokenCache: accessTokenCache
|
|
734
749
|
}, config.zoomOAuth));
|
|
@@ -787,16 +802,19 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
787
802
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
788
803
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
789
804
|
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
805
|
+
/**
|
|
806
|
+
* Default factory function for creating ZoomOAuthServiceConfig from ConfigService.
|
|
807
|
+
*
|
|
808
|
+
* @param configService The NestJS ConfigService
|
|
809
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
810
|
+
*/ function zoomOAuthServiceConfigFactory(configService) {
|
|
811
|
+
return readZoomOAuthServiceConfigFromConfigService(configService);
|
|
793
812
|
}
|
|
794
813
|
/**
|
|
795
814
|
* Convenience function used to generate ModuleMetadata for an app's ZoomOAuthModule.
|
|
796
815
|
*
|
|
797
|
-
* @param
|
|
798
|
-
* @
|
|
799
|
-
* @returns
|
|
816
|
+
* @param config The configuration for the module metadata
|
|
817
|
+
* @returns Module metadata for the Zoom OAuth module
|
|
800
818
|
*/ function appZoomOAuthModuleMetadata(config$1) {
|
|
801
819
|
var _config_zoomOAuthServiceConfigFactory;
|
|
802
820
|
var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
|
|
@@ -978,7 +996,7 @@ var zoomEventHandlerConfigurerFactory = util.handlerConfigurerFactory({
|
|
|
978
996
|
* @param zoomSecretToken The Zoom secret token.
|
|
979
997
|
* @returns A function that verifies a Zoom webhook event.
|
|
980
998
|
*/ function zoomWebhookEventVerifier(zoomSecretToken) {
|
|
981
|
-
return function(request,
|
|
999
|
+
return function(request, _rawBody) {
|
|
982
1000
|
var requestBodyString = String(request.body);
|
|
983
1001
|
var message = "v0:".concat(request.headers['x-zm-request-timestamp'], ":").concat(requestBodyString);
|
|
984
1002
|
var hashForVerify = crypto.createHmac('sha256', zoomSecretToken).update(message).digest('hex');
|
|
@@ -1488,7 +1506,12 @@ function _class_call_check$2(instance, Constructor) {
|
|
|
1488
1506
|
throw new TypeError("Cannot call a class as a function");
|
|
1489
1507
|
}
|
|
1490
1508
|
}
|
|
1491
|
-
|
|
1509
|
+
/**
|
|
1510
|
+
* Factory function that creates ZoomWebhookServiceConfig from NestJS ConfigService.
|
|
1511
|
+
*
|
|
1512
|
+
* @param configService The NestJS ConfigService
|
|
1513
|
+
* @returns A validated ZoomWebhookServiceConfig
|
|
1514
|
+
*/ function zoomWebhookServiceConfigFactory(configService) {
|
|
1492
1515
|
var config = {
|
|
1493
1516
|
webhookConfig: {
|
|
1494
1517
|
zoomSecretToken: configService.get(ZOOM_SECRET_TOKEN_ENV_VAR)
|
|
@@ -1568,7 +1591,7 @@ function _define_property$1(obj, key, value) {
|
|
|
1568
1591
|
_create_class$1(ZoomServiceConfig, null, [
|
|
1569
1592
|
{
|
|
1570
1593
|
key: "assertValidConfig",
|
|
1571
|
-
value: function assertValidConfig(
|
|
1594
|
+
value: function assertValidConfig(_config) {
|
|
1572
1595
|
// TODO?
|
|
1573
1596
|
}
|
|
1574
1597
|
}
|
|
@@ -1744,7 +1767,7 @@ exports.ZoomApi = __decorate([
|
|
|
1744
1767
|
__param(0, common.Inject(ZoomServiceConfig)),
|
|
1745
1768
|
__param(1, common.Inject(exports.ZoomOAuthApi))
|
|
1746
1769
|
], exports.ZoomApi);
|
|
1747
|
-
var ZoomApiUserContext = function ZoomApiUserContext(
|
|
1770
|
+
var ZoomApiUserContext = function ZoomApiUserContext(_refreshToken) {
|
|
1748
1771
|
_class_call_check(this, ZoomApiUserContext);
|
|
1749
1772
|
}
|
|
1750
1773
|
;
|
|
@@ -1775,7 +1798,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1775
1798
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1776
1799
|
}
|
|
1777
1800
|
// MARK: Provider Factories
|
|
1778
|
-
|
|
1801
|
+
/**
|
|
1802
|
+
* Default factory function for creating ZoomServiceConfig from ConfigService.
|
|
1803
|
+
*
|
|
1804
|
+
* @param _configService The NestJS ConfigService (unused currently)
|
|
1805
|
+
* @returns A validated ZoomServiceConfig
|
|
1806
|
+
*/ function zoomServiceConfigFactory(_configService) {
|
|
1779
1807
|
var config = {
|
|
1780
1808
|
zoom: {}
|
|
1781
1809
|
};
|
|
@@ -1785,9 +1813,8 @@ function zoomServiceConfigFactory(configService) {
|
|
|
1785
1813
|
/**
|
|
1786
1814
|
* Convenience function used to generate ModuleMetadata for an app's ZoomModule.
|
|
1787
1815
|
*
|
|
1788
|
-
* @param
|
|
1789
|
-
* @
|
|
1790
|
-
* @returns
|
|
1816
|
+
* @param config The configuration for the module metadata
|
|
1817
|
+
* @returns Module metadata for the Zoom module
|
|
1791
1818
|
*/ function appZoomModuleMetadata(config$1) {
|
|
1792
1819
|
var dependencyModule = config$1.dependencyModule, imports = config$1.imports, exports$1 = config$1.exports, providers = config$1.providers;
|
|
1793
1820
|
var dependencyModuleImport = dependencyModule ? [
|
package/nestjs/index.esm.js
CHANGED
|
@@ -72,8 +72,10 @@ function _define_property$8(obj, key, value) {
|
|
|
72
72
|
value: function assertValidConfig(config) {
|
|
73
73
|
var zoomOAuth = config.zoomOAuth;
|
|
74
74
|
if (!zoomOAuth) {
|
|
75
|
+
// eslint-disable-line @typescript-eslint/no-unnecessary-condition -- runtime validation
|
|
75
76
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth is required');
|
|
76
|
-
}
|
|
77
|
+
}
|
|
78
|
+
{
|
|
77
79
|
if (!zoomOAuth.accountId) {
|
|
78
80
|
throw new Error('ZoomOAuthServiceConfig.zoomOAuth.accountId is required');
|
|
79
81
|
} else if (!zoomOAuth.clientSecret) {
|
|
@@ -87,7 +89,13 @@ function _define_property$8(obj, key, value) {
|
|
|
87
89
|
]);
|
|
88
90
|
return ZoomOAuthServiceConfig;
|
|
89
91
|
}();
|
|
90
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Reads a ZoomOAuthServiceConfig from the NestJS ConfigService using environment variables.
|
|
94
|
+
*
|
|
95
|
+
* @param configService The NestJS ConfigService to read from
|
|
96
|
+
* @param prefix Optional prefix for environment variable names
|
|
97
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
98
|
+
*/ function readZoomOAuthServiceConfigFromConfigService(configService, prefix) {
|
|
91
99
|
var prefixString = characterPrefixSuffixInstance({
|
|
92
100
|
suffix: '_',
|
|
93
101
|
suffixEmptyString: false
|
|
@@ -337,7 +345,11 @@ function _ts_generator$2(thisArg, body) {
|
|
|
337
345
|
ZoomOAuthAccessTokenCacheService = __decorate([
|
|
338
346
|
Injectable()
|
|
339
347
|
], ZoomOAuthAccessTokenCacheService);
|
|
340
|
-
|
|
348
|
+
/**
|
|
349
|
+
* Default error logging function for merged cache service update failures.
|
|
350
|
+
*
|
|
351
|
+
* @param failedUpdates Array of failed cache update results with their errors
|
|
352
|
+
*/ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
341
353
|
console.warn("mergeZoomOAuthAccessTokenCacheServices(): failed updating ".concat(failedUpdates.length, " caches."));
|
|
342
354
|
failedUpdates.forEach(function(param, i) {
|
|
343
355
|
var _param = _sliced_to_array(param, 2); _param[0]; var e = _param[1];
|
|
@@ -351,7 +363,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
351
363
|
*
|
|
352
364
|
* When updating a cached token, it will update the token across all services.
|
|
353
365
|
*
|
|
354
|
-
* @param
|
|
366
|
+
* @param inputServicesToMerge Must include at least one service. Empty arrays will throw an error.
|
|
367
|
+
* @param logError Optional error logging configuration. Pass a function, true for default logging, or false to disable.
|
|
368
|
+
* @returns A merged ZoomOAuthAccessTokenCacheService
|
|
355
369
|
*/ function mergeZoomOAuthAccessTokenCacheServices(inputServicesToMerge, logError) {
|
|
356
370
|
var allServices = _to_consumable_array$2(inputServicesToMerge);
|
|
357
371
|
var logErrorFunction = typeof logError === 'function' ? logError : logError !== false ? logMergeZoomOAuthAccessTokenCacheServiceErrorFunction : undefined;
|
|
@@ -396,7 +410,7 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
396
410
|
});
|
|
397
411
|
})).then(function(x) {
|
|
398
412
|
// only find the failures if we're logging
|
|
399
|
-
if (logErrorFunction
|
|
413
|
+
if (logErrorFunction) {
|
|
400
414
|
var failedUpdates = filterMaybeArrayValues(x.map(function(y) {
|
|
401
415
|
return y.value;
|
|
402
416
|
}));
|
|
@@ -412,13 +426,13 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
412
426
|
};
|
|
413
427
|
return cacheForService;
|
|
414
428
|
};
|
|
415
|
-
var allServiceAccessTokenCaches = allServices.map(function(
|
|
416
|
-
return
|
|
429
|
+
var allServiceAccessTokenCaches = allServices.map(function(service) {
|
|
430
|
+
return service.loadZoomAccessTokenCache();
|
|
417
431
|
});
|
|
418
|
-
var allServicesWithCacheForRefreshToken = allServices.filter(function(
|
|
419
|
-
return
|
|
432
|
+
var allServicesWithCacheForRefreshToken = allServices.filter(function(service) {
|
|
433
|
+
return service.cacheForRefreshToken != null;
|
|
420
434
|
});
|
|
421
|
-
var cacheForRefreshToken =
|
|
435
|
+
var cacheForRefreshToken = allServicesWithCacheForRefreshToken.length > 0 ? function(refreshToken) {
|
|
422
436
|
var allCaches = allServicesWithCacheForRefreshToken.map(function(x) {
|
|
423
437
|
return x.cacheForRefreshToken(refreshToken);
|
|
424
438
|
});
|
|
@@ -436,7 +450,9 @@ function logMergeZoomOAuthAccessTokenCacheServiceErrorFunction(failedUpdates) {
|
|
|
436
450
|
/**
|
|
437
451
|
* Creates a ZoomOAuthAccessTokenCacheService that uses in-memory storage.
|
|
438
452
|
*
|
|
439
|
-
* @
|
|
453
|
+
* @param existingToken Optional initial token to seed the cache with
|
|
454
|
+
* @param logAccessToConsole Whether to log token access to console
|
|
455
|
+
* @returns A memory-backed ZoomOAuthAccessTokenCacheService
|
|
440
456
|
*/ function memoryZoomOAuthAccessTokenCacheService(existingToken, logAccessToConsole) {
|
|
441
457
|
var token = existingToken;
|
|
442
458
|
function loadZoomAccessTokenCache() {
|
|
@@ -488,7 +504,9 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
488
504
|
*
|
|
489
505
|
* Useful for testing.
|
|
490
506
|
*
|
|
491
|
-
* @
|
|
507
|
+
* @param filename Path to the token cache file
|
|
508
|
+
* @param useMemoryCache Whether to also cache tokens in memory for faster access
|
|
509
|
+
* @returns A file-system-backed ZoomOAuthAccessTokenCacheService
|
|
492
510
|
*/ function fileZoomOAuthAccessTokenCacheService() {
|
|
493
511
|
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
512
|
var loadedToken = null;
|
|
@@ -592,7 +610,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
592
610
|
var accessTokenCache = {
|
|
593
611
|
loadCachedToken: function loadCachedToken() {
|
|
594
612
|
return _async_to_generator$2(function() {
|
|
595
|
-
var tokens
|
|
613
|
+
var tokens;
|
|
596
614
|
return _ts_generator$2(this, function(_state) {
|
|
597
615
|
switch(_state.label){
|
|
598
616
|
case 0:
|
|
@@ -602,11 +620,10 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
602
620
|
];
|
|
603
621
|
case 1:
|
|
604
622
|
tokens = _state.sent();
|
|
605
|
-
token = tokens.token;
|
|
606
623
|
// console.log('retrieving access token from file: ', { token });
|
|
607
624
|
return [
|
|
608
625
|
2,
|
|
609
|
-
token
|
|
626
|
+
tokens.token
|
|
610
627
|
];
|
|
611
628
|
}
|
|
612
629
|
});
|
|
@@ -624,9 +641,7 @@ var DEFAULT_FILE_ZOOM_ACCOUNTS_ACCESS_TOKEN_CACHE_SERVICE_PATH = '.tmp/zoom-acce
|
|
|
624
641
|
];
|
|
625
642
|
case 1:
|
|
626
643
|
tokenFile = _state.sent();
|
|
627
|
-
|
|
628
|
-
tokenFile.token = accessToken;
|
|
629
|
-
}
|
|
644
|
+
tokenFile.token = accessToken;
|
|
630
645
|
_state.label = 2;
|
|
631
646
|
case 2:
|
|
632
647
|
_state.trys.push([
|
|
@@ -720,13 +735,13 @@ function _object_spread$2(target) {
|
|
|
720
735
|
var ZoomOAuthApi = /*#__PURE__*/ function() {
|
|
721
736
|
function ZoomOAuthApi(config, cacheService) {
|
|
722
737
|
_class_call_check$6(this, ZoomOAuthApi);
|
|
723
|
-
var _config_factoryConfig;
|
|
738
|
+
var _config_zoomOAuth_accessTokenCache, _config_factoryConfig;
|
|
724
739
|
_define_property$6(this, "config", void 0);
|
|
725
740
|
_define_property$6(this, "cacheService", void 0);
|
|
726
741
|
_define_property$6(this, "zoomOAuth", void 0);
|
|
727
742
|
this.config = config;
|
|
728
743
|
this.cacheService = cacheService;
|
|
729
|
-
var accessTokenCache = config.zoomOAuth.accessTokenCache ?
|
|
744
|
+
var accessTokenCache = (_config_zoomOAuth_accessTokenCache = config.zoomOAuth.accessTokenCache) !== null && _config_zoomOAuth_accessTokenCache !== void 0 ? _config_zoomOAuth_accessTokenCache : cacheService.loadZoomAccessTokenCache();
|
|
730
745
|
this.zoomOAuth = zoomOAuthFactory((_config_factoryConfig = config.factoryConfig) !== null && _config_factoryConfig !== void 0 ? _config_factoryConfig : {})(_object_spread$2({
|
|
731
746
|
accessTokenCache: accessTokenCache
|
|
732
747
|
}, config.zoomOAuth));
|
|
@@ -785,16 +800,19 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
785
800
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
786
801
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
787
802
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
803
|
+
/**
|
|
804
|
+
* Default factory function for creating ZoomOAuthServiceConfig from ConfigService.
|
|
805
|
+
*
|
|
806
|
+
* @param configService The NestJS ConfigService
|
|
807
|
+
* @returns A validated ZoomOAuthServiceConfig
|
|
808
|
+
*/ function zoomOAuthServiceConfigFactory(configService) {
|
|
809
|
+
return readZoomOAuthServiceConfigFromConfigService(configService);
|
|
791
810
|
}
|
|
792
811
|
/**
|
|
793
812
|
* Convenience function used to generate ModuleMetadata for an app's ZoomOAuthModule.
|
|
794
813
|
*
|
|
795
|
-
* @param
|
|
796
|
-
* @
|
|
797
|
-
* @returns
|
|
814
|
+
* @param config The configuration for the module metadata
|
|
815
|
+
* @returns Module metadata for the Zoom OAuth module
|
|
798
816
|
*/ function appZoomOAuthModuleMetadata(config) {
|
|
799
817
|
var _config_zoomOAuthServiceConfigFactory;
|
|
800
818
|
var dependencyModule = config.dependencyModule, imports = config.imports, exports$1 = config.exports, providers = config.providers;
|
|
@@ -976,7 +994,7 @@ var zoomEventHandlerConfigurerFactory = handlerConfigurerFactory({
|
|
|
976
994
|
* @param zoomSecretToken The Zoom secret token.
|
|
977
995
|
* @returns A function that verifies a Zoom webhook event.
|
|
978
996
|
*/ function zoomWebhookEventVerifier(zoomSecretToken) {
|
|
979
|
-
return function(request,
|
|
997
|
+
return function(request, _rawBody) {
|
|
980
998
|
var requestBodyString = String(request.body);
|
|
981
999
|
var message = "v0:".concat(request.headers['x-zm-request-timestamp'], ":").concat(requestBodyString);
|
|
982
1000
|
var hashForVerify = createHmac('sha256', zoomSecretToken).update(message).digest('hex');
|
|
@@ -1486,7 +1504,12 @@ function _class_call_check$2(instance, Constructor) {
|
|
|
1486
1504
|
throw new TypeError("Cannot call a class as a function");
|
|
1487
1505
|
}
|
|
1488
1506
|
}
|
|
1489
|
-
|
|
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) {
|
|
1490
1513
|
var config = {
|
|
1491
1514
|
webhookConfig: {
|
|
1492
1515
|
zoomSecretToken: configService.get(ZOOM_SECRET_TOKEN_ENV_VAR)
|
|
@@ -1566,7 +1589,7 @@ function _define_property$1(obj, key, value) {
|
|
|
1566
1589
|
_create_class$1(ZoomServiceConfig, null, [
|
|
1567
1590
|
{
|
|
1568
1591
|
key: "assertValidConfig",
|
|
1569
|
-
value: function assertValidConfig(
|
|
1592
|
+
value: function assertValidConfig(_config) {
|
|
1570
1593
|
// TODO?
|
|
1571
1594
|
}
|
|
1572
1595
|
}
|
|
@@ -1742,7 +1765,7 @@ ZoomApi = __decorate([
|
|
|
1742
1765
|
__param(0, Inject(ZoomServiceConfig)),
|
|
1743
1766
|
__param(1, Inject(ZoomOAuthApi))
|
|
1744
1767
|
], ZoomApi);
|
|
1745
|
-
var ZoomApiUserContext = function ZoomApiUserContext(
|
|
1768
|
+
var ZoomApiUserContext = function ZoomApiUserContext(_refreshToken) {
|
|
1746
1769
|
_class_call_check(this, ZoomApiUserContext);
|
|
1747
1770
|
}
|
|
1748
1771
|
;
|
|
@@ -1773,7 +1796,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
1773
1796
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
1774
1797
|
}
|
|
1775
1798
|
// MARK: Provider Factories
|
|
1776
|
-
|
|
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) {
|
|
1777
1805
|
var config = {
|
|
1778
1806
|
zoom: {}
|
|
1779
1807
|
};
|
|
@@ -1783,9 +1811,8 @@ function zoomServiceConfigFactory(configService) {
|
|
|
1783
1811
|
/**
|
|
1784
1812
|
* Convenience function used to generate ModuleMetadata for an app's ZoomModule.
|
|
1785
1813
|
*
|
|
1786
|
-
* @param
|
|
1787
|
-
* @
|
|
1788
|
-
* @returns
|
|
1814
|
+
* @param config The configuration for the module metadata
|
|
1815
|
+
* @returns Module metadata for the Zoom module
|
|
1789
1816
|
*/ function appZoomModuleMetadata(config) {
|
|
1790
1817
|
var dependencyModule = config.dependencyModule, imports = config.imports, exports$1 = config.exports, providers = config.providers;
|
|
1791
1818
|
var dependencyModuleImport = dependencyModule ? [
|
package/nestjs/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/zoom/nestjs",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/nestjs": "13.
|
|
6
|
-
"@dereekb/util": "13.
|
|
7
|
-
"@dereekb/zoom": "13.
|
|
5
|
+
"@dereekb/nestjs": "13.4.1",
|
|
6
|
+
"@dereekb/util": "13.4.1",
|
|
7
|
+
"@dereekb/zoom": "13.4.1",
|
|
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
|
}
|
|
@@ -2,7 +2,13 @@ import { type ModuleMetadata } from '@nestjs/common';
|
|
|
2
2
|
import { ConfigService } from '@nestjs/config';
|
|
3
3
|
import { ZoomServiceConfig } from './zoom.config';
|
|
4
4
|
import { type Maybe } from '@dereekb/util';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Default factory function for creating ZoomServiceConfig from ConfigService.
|
|
7
|
+
*
|
|
8
|
+
* @param _configService The NestJS ConfigService (unused currently)
|
|
9
|
+
* @returns A validated ZoomServiceConfig
|
|
10
|
+
*/
|
|
11
|
+
export declare function zoomServiceConfigFactory(_configService: ConfigService): ZoomServiceConfig;
|
|
6
12
|
export interface ProvideAppZoomMetadataConfig extends Pick<ModuleMetadata, 'imports' | 'exports' | 'providers'> {
|
|
7
13
|
/**
|
|
8
14
|
* The ZoomModule requires the following dependencies in order to initialze properly:
|
|
@@ -15,8 +21,7 @@ export interface ProvideAppZoomMetadataConfig extends Pick<ModuleMetadata, 'impo
|
|
|
15
21
|
/**
|
|
16
22
|
* Convenience function used to generate ModuleMetadata for an app's ZoomModule.
|
|
17
23
|
*
|
|
18
|
-
* @param
|
|
19
|
-
* @
|
|
20
|
-
* @returns
|
|
24
|
+
* @param config The configuration for the module metadata
|
|
25
|
+
* @returns Module metadata for the Zoom module
|
|
21
26
|
*/
|
|
22
27
|
export declare function appZoomModuleMetadata(config: ProvideAppZoomMetadataConfig): ModuleMetadata;
|