@dereekb/calcom 13.32.0 → 13.34.0

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.
@@ -80,6 +80,8 @@ var CALCOM_API_KEY_CONFIG_KEY = 'CALCOM_API_KEY';
80
80
  if (!calcomOAuth) {
81
81
  throw new Error('CalcomOAuthServiceConfig.calcomOAuth is required');
82
82
  }
83
+ // mirrors the guard in calcomOAuthFactory(): an api key IS a token, anything else is an exchange
84
+ // the token endpoint authenticates with the client pair. The two must not drift
83
85
  var hasApiKey = !!calcomOAuth.apiKey;
84
86
  var hasOAuth = !!calcomOAuth.clientId && !!calcomOAuth.clientSecret;
85
87
  if (!hasApiKey && !hasOAuth) {
@@ -108,6 +110,12 @@ var CALCOM_API_KEY_CONFIG_KEY = 'CALCOM_API_KEY';
108
110
  apiKey: apiKey || undefined
109
111
  }
110
112
  };
113
+ // the api key wins for ambient calls because it does not expire, so a configured refresh token is
114
+ // silently unused. Warned here rather than in assertValidConfig, which tests call directly and
115
+ // which stays side-effect-free
116
+ if (apiKey && refreshToken) {
117
+ new common.Logger('CalcomOAuthServiceConfig').warn("Both ".concat(CALCOM_API_KEY_CONFIG_KEY, " and ").concat(CALCOM_REFRESH_TOKEN_CONFIG_KEY, " are set. The api key takes precedence for ambient calls and the refresh token is ignored — unset one to make the intent explicit."));
118
+ }
111
119
  CalcomOAuthServiceConfig.assertValidConfig(config);
112
120
  return config;
113
121
  }
@@ -123,7 +131,7 @@ function _array_with_holes(arr) {
123
131
  function _array_without_holes$3(arr) {
124
132
  if (Array.isArray(arr)) return _array_like_to_array$3(arr);
125
133
  }
126
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
134
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
127
135
  try {
128
136
  var info = gen[key](arg);
129
137
  var value = info.value;
@@ -137,16 +145,16 @@ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
137
145
  Promise.resolve(value).then(_next, _throw);
138
146
  }
139
147
  }
140
- function _async_to_generator$2(fn) {
148
+ function _async_to_generator$3(fn) {
141
149
  return function() {
142
150
  var self = this, args = arguments;
143
151
  return new Promise(function(resolve, reject) {
144
152
  var gen = fn.apply(self, args);
145
153
  function _next(value) {
146
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
154
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
147
155
  }
148
156
  function _throw(err) {
149
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
157
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
150
158
  }
151
159
  _next(undefined);
152
160
  });
@@ -263,7 +271,7 @@ function _unsupported_iterable_to_array$3(o, minLen) {
263
271
  if (n === "Map" || n === "Set") return Array.from(n);
264
272
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
265
273
  }
266
- function _ts_generator$2(thisArg, body) {
274
+ function _ts_generator$3(thisArg, body) {
267
275
  var f, y, t, _ = {
268
276
  label: 0,
269
277
  sent: function() {
@@ -367,7 +375,8 @@ function _ts_generator$2(thisArg, body) {
367
375
  *
368
376
  * Implementations store and retrieve OAuth access tokens (and the rotated refresh tokens
369
377
  * embedded in them). The service supports both a server-level cache and per-user caches
370
- * keyed by the user's initial refresh token.
378
+ * keyed either by a caller-owned key ({@link cacheForKey}) or by the user's refresh token
379
+ * ({@link cacheForRefreshToken}).
371
380
  */ exports.CalcomOAuthAccessTokenCacheService = function CalcomOAuthAccessTokenCacheService() {
372
381
  _class_call_check$7(this, CalcomOAuthAccessTokenCacheService);
373
382
  };
@@ -384,13 +393,29 @@ exports.CalcomOAuthAccessTokenCacheService = __decorate([
384
393
  */ function calcomRefreshTokenCacheKey(refreshToken) {
385
394
  return node_crypto.createHash('sha256').update(refreshToken).digest('hex').substring(0, 16);
386
395
  }
396
+ /**
397
+ * Matches any character that is unsafe in a filesystem path segment.
398
+ */ var UNSAFE_CALCOM_CACHE_FILE_KEY_CHARACTERS_REGEX = /[^a-zA-Z0-9_-]/g;
399
+ /**
400
+ * Converts a cache key into a filesystem-safe path segment.
401
+ *
402
+ * A key that is already safe (such as the hex output of {@link calcomRefreshTokenCacheKey}) is
403
+ * returned unchanged. Otherwise the unsafe characters are replaced and a hash of the original key
404
+ * is appended, so two different keys can never collapse onto the same file.
405
+ *
406
+ * @param key - The cache key to convert.
407
+ * @returns A filesystem-safe path segment for the key.
408
+ */ function calcomAccessTokenCacheFileKey(key) {
409
+ var safeKey = key.replaceAll(UNSAFE_CALCOM_CACHE_FILE_KEY_CHARACTERS_REGEX, '_');
410
+ return safeKey === key ? key : "".concat(safeKey, "-").concat(node_crypto.createHash('sha256').update(key).digest('hex').substring(0, 8));
411
+ }
387
412
  // MARK: Merge
388
413
  function buildCalcomReadAdapter(cache) {
389
414
  return {
390
415
  load: function load() {
391
- return _async_to_generator$2(function() {
416
+ return _async_to_generator$3(function() {
392
417
  var value;
393
- return _ts_generator$2(this, function(_state) {
418
+ return _ts_generator$3(this, function(_state) {
394
419
  switch(_state.label){
395
420
  case 0:
396
421
  return [
@@ -413,8 +438,8 @@ function buildCalcomReadAdapter(cache) {
413
438
  return cache.updateCachedToken(token);
414
439
  },
415
440
  clear: function clear() {
416
- return _async_to_generator$2(function() {
417
- return _ts_generator$2(this, function(_state) {
441
+ return _async_to_generator$3(function() {
442
+ return _ts_generator$3(this, function(_state) {
418
443
  return [
419
444
  2
420
445
  ];
@@ -475,9 +500,9 @@ function updateCalcomCacheCapturingError(cache, accessToken) {
475
500
  return merged.load();
476
501
  },
477
502
  updateCachedToken: function updateCachedToken(accessToken) {
478
- return _async_to_generator$2(function() {
503
+ return _async_to_generator$3(function() {
479
504
  var settled, failedUpdates;
480
- return _ts_generator$2(this, function(_state) {
505
+ return _ts_generator$3(this, function(_state) {
481
506
  switch(_state.label){
482
507
  case 0:
483
508
  return [
@@ -511,16 +536,26 @@ function updateCalcomCacheCapturingError(cache, accessToken) {
511
536
  var allServicesWithCacheForRefreshToken = allServices.filter(function(x) {
512
537
  return x.cacheForRefreshToken != null;
513
538
  });
539
+ var allServicesWithCacheForKey = allServices.filter(function(x) {
540
+ return x.cacheForKey != null;
541
+ });
514
542
  var cacheForRefreshToken = allServicesWithCacheForRefreshToken.length > 0 ? function(refreshToken) {
515
543
  var allCaches = allServicesWithCacheForRefreshToken.map(function(x) {
516
544
  return x.cacheForRefreshToken(refreshToken);
517
545
  });
518
546
  return mergeCachesForService(allCaches);
519
547
  } : undefined;
548
+ var cacheForKey = allServicesWithCacheForKey.length > 0 ? function(key) {
549
+ var allCaches = allServicesWithCacheForKey.map(function(x) {
550
+ return x.cacheForKey(key);
551
+ });
552
+ return mergeCachesForService(allCaches);
553
+ } : undefined;
520
554
  var service = {
521
555
  loadCalcomAccessTokenCache: function loadCalcomAccessTokenCache() {
522
556
  return mergeCachesForService(allServiceAccessTokenCaches);
523
557
  },
558
+ cacheForKey: cacheForKey,
524
559
  cacheForRefreshToken: cacheForRefreshToken
525
560
  };
526
561
  return service;
@@ -535,9 +570,9 @@ function updateCalcomCacheCapturingError(cache, accessToken) {
535
570
  */ function calcomAccessTokenCacheFromAsyncValueCache(cache, logAccessToConsole) {
536
571
  return {
537
572
  loadCachedToken: function loadCachedToken() {
538
- return _async_to_generator$2(function() {
573
+ return _async_to_generator$3(function() {
539
574
  var token;
540
- return _ts_generator$2(this, function(_state) {
575
+ return _ts_generator$3(this, function(_state) {
541
576
  switch(_state.label){
542
577
  case 0:
543
578
  return [
@@ -561,8 +596,8 @@ function updateCalcomCacheCapturingError(cache, accessToken) {
561
596
  })();
562
597
  },
563
598
  updateCachedToken: function updateCachedToken(accessToken) {
564
- return _async_to_generator$2(function() {
565
- return _ts_generator$2(this, function(_state) {
599
+ return _async_to_generator$3(function() {
600
+ return _ts_generator$3(this, function(_state) {
566
601
  switch(_state.label){
567
602
  case 0:
568
603
  return [
@@ -611,13 +646,16 @@ function updateCalcomCacheCapturingError(cache, accessToken) {
611
646
  }
612
647
  };
613
648
  }
649
+ function cacheForKey(key) {
650
+ return calcomAccessTokenCacheFromAsyncValueCache(userCacheView(key), logAccessToConsole);
651
+ }
614
652
  return {
615
653
  loadCalcomAccessTokenCache: function loadCalcomAccessTokenCache() {
616
654
  return calcomAccessTokenCacheFromAsyncValueCache(serverCache, logAccessToConsole);
617
655
  },
656
+ cacheForKey: cacheForKey,
618
657
  cacheForRefreshToken: function cacheForRefreshToken(refreshToken) {
619
- var key = calcomRefreshTokenCacheKey(refreshToken);
620
- return calcomAccessTokenCacheFromAsyncValueCache(userCacheView(key), logAccessToConsole);
658
+ return cacheForKey(calcomRefreshTokenCacheKey(refreshToken));
621
659
  }
622
660
  };
623
661
  }
@@ -691,9 +729,9 @@ var CALCOM_SERVER_TOKEN_FILE_KEY = 'server';
691
729
  return cache.load();
692
730
  },
693
731
  updateCachedToken: function updateCachedToken(accessToken) {
694
- return _async_to_generator$2(function() {
732
+ return _async_to_generator$3(function() {
695
733
  var e;
696
- return _ts_generator$2(this, function(_state) {
734
+ return _ts_generator$3(this, function(_state) {
697
735
  switch(_state.label){
698
736
  case 0:
699
737
  _state.trys.push([
@@ -726,17 +764,50 @@ var CALCOM_SERVER_TOKEN_FILE_KEY = 'server';
726
764
  }
727
765
  };
728
766
  }
767
+ function cacheForCallerKey(key) {
768
+ return makeCacheForKey("user-".concat(calcomAccessTokenCacheFileKey(key)));
769
+ }
729
770
  return {
730
771
  cacheDir: cacheDir,
731
772
  loadCalcomAccessTokenCache: function loadCalcomAccessTokenCache() {
732
773
  return makeCacheForKey(CALCOM_SERVER_TOKEN_FILE_KEY);
733
774
  },
775
+ cacheForKey: cacheForCallerKey,
734
776
  cacheForRefreshToken: function cacheForRefreshToken(refreshToken) {
735
- return makeCacheForKey("user-".concat(calcomRefreshTokenCacheKey(refreshToken)));
777
+ return cacheForCallerKey(calcomRefreshTokenCacheKey(refreshToken));
736
778
  }
737
779
  };
738
780
  }
739
781
 
782
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
783
+ try {
784
+ var info = gen[key](arg);
785
+ var value = info.value;
786
+ } catch (error) {
787
+ reject(error);
788
+ return;
789
+ }
790
+ if (info.done) {
791
+ resolve(value);
792
+ } else {
793
+ Promise.resolve(value).then(_next, _throw);
794
+ }
795
+ }
796
+ function _async_to_generator$2(fn) {
797
+ return function() {
798
+ var self = this, args = arguments;
799
+ return new Promise(function(resolve, reject) {
800
+ var gen = fn.apply(self, args);
801
+ function _next(value) {
802
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
803
+ }
804
+ function _throw(err) {
805
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
806
+ }
807
+ _next(undefined);
808
+ });
809
+ };
810
+ }
740
811
  function _class_call_check$6(instance, Constructor) {
741
812
  if (!(instance instanceof Constructor)) {
742
813
  throw new TypeError("Cannot call a class as a function");
@@ -768,6 +839,105 @@ function _define_property$6(obj, key, value) {
768
839
  }
769
840
  return obj;
770
841
  }
842
+ function _ts_generator$2(thisArg, body) {
843
+ var f, y, t, _ = {
844
+ label: 0,
845
+ sent: function() {
846
+ if (t[0] & 1) throw t[1];
847
+ return t[1];
848
+ },
849
+ trys: [],
850
+ ops: []
851
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
852
+ return d(g, "next", {
853
+ value: verb(0)
854
+ }), d(g, "throw", {
855
+ value: verb(1)
856
+ }), d(g, "return", {
857
+ value: verb(2)
858
+ }), typeof Symbol === "function" && d(g, Symbol.iterator, {
859
+ value: function() {
860
+ return this;
861
+ }
862
+ }), g;
863
+ function verb(n) {
864
+ return function(v) {
865
+ return step([
866
+ n,
867
+ v
868
+ ]);
869
+ };
870
+ }
871
+ function step(op) {
872
+ if (f) throw new TypeError("Generator is already executing.");
873
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
874
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
875
+ if (y = 0, t) op = [
876
+ op[0] & 2,
877
+ t.value
878
+ ];
879
+ switch(op[0]){
880
+ case 0:
881
+ case 1:
882
+ t = op;
883
+ break;
884
+ case 4:
885
+ _.label++;
886
+ return {
887
+ value: op[1],
888
+ done: false
889
+ };
890
+ case 5:
891
+ _.label++;
892
+ y = op[1];
893
+ op = [
894
+ 0
895
+ ];
896
+ continue;
897
+ case 7:
898
+ op = _.ops.pop();
899
+ _.trys.pop();
900
+ continue;
901
+ default:
902
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
903
+ _ = 0;
904
+ continue;
905
+ }
906
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
907
+ _.label = op[1];
908
+ break;
909
+ }
910
+ if (op[0] === 6 && _.label < t[1]) {
911
+ _.label = t[1];
912
+ t = op;
913
+ break;
914
+ }
915
+ if (t && _.label < t[2]) {
916
+ _.label = t[2];
917
+ _.ops.push(op);
918
+ break;
919
+ }
920
+ if (t[2]) _.ops.pop();
921
+ _.trys.pop();
922
+ continue;
923
+ }
924
+ op = body.call(thisArg, _);
925
+ } catch (e) {
926
+ op = [
927
+ 6,
928
+ e
929
+ ];
930
+ y = 0;
931
+ } finally{
932
+ f = t = 0;
933
+ }
934
+ if (op[0] & 5) throw op[1];
935
+ return {
936
+ value: op[0] ? op[1] : void 0,
937
+ done: true
938
+ };
939
+ }
940
+ }
771
941
  exports.CalcomOAuthApi = /*#__PURE__*/ function() {
772
942
  function CalcomOAuthApi(config, cacheService) {
773
943
  _class_call_check$6(this, CalcomOAuthApi);
@@ -779,12 +949,20 @@ exports.CalcomOAuthApi = /*#__PURE__*/ function() {
779
949
  this.cacheService = cacheService;
780
950
  var accessTokenCache = cacheService.loadCalcomAccessTokenCache();
781
951
  var _config_calcomOAuth = config.calcomOAuth, clientId = _config_calcomOAuth.clientId, clientSecret = _config_calcomOAuth.clientSecret, refreshToken = _config_calcomOAuth.refreshToken, apiKey = _config_calcomOAuth.apiKey;
952
+ // the environment-facing config stays flat, mirroring the CALCOM_* variables it is read from.
953
+ // `client` is the app's OAuth registration, sent on every exchange; `defaultAuth` is the one
954
+ // credential the ambient loadAccessToken() resolves. The client is taken as a pair or not at all,
955
+ // which replaces the empty-string sentinels this used to pass for a config with no OAuth client
782
956
  this.calcomOAuth = calcom.calcomOAuthFactory((_config_factoryConfig = config.factoryConfig) !== null && _config_factoryConfig !== void 0 ? _config_factoryConfig : {})({
783
- accessTokenCache: accessTokenCache,
784
- clientId: clientId !== null && clientId !== void 0 ? clientId : '',
785
- clientSecret: clientSecret !== null && clientSecret !== void 0 ? clientSecret : '',
786
- refreshToken: refreshToken,
787
- apiKey: apiKey
957
+ client: clientId && clientSecret ? {
958
+ clientId: clientId,
959
+ clientSecret: clientSecret
960
+ } : undefined,
961
+ defaultAuth: calcom.calcomAuthCredentialFromValues({
962
+ apiKey: apiKey,
963
+ refreshToken: refreshToken,
964
+ accessTokenCache: accessTokenCache
965
+ })
788
966
  });
789
967
  }
790
968
  _create_class$5(CalcomOAuthApi, [
@@ -805,23 +983,80 @@ exports.CalcomOAuthApi = /*#__PURE__*/ function() {
805
983
  return calcom.exchangeAuthorizationCode(this.oauthContext);
806
984
  }
807
985
  },
986
+ {
987
+ key: "exchangeAuthorizationCodeToAccessToken",
988
+ value: /**
989
+ * Exchanges an OAuth authorization code and maps the response to a {@link CalcomAccessToken}.
990
+ *
991
+ * The returned `refreshToken` is the one to persist: Cal.com rotates refresh tokens on every use.
992
+ *
993
+ * @param input - The authorization code and the exact redirect URI it was issued for.
994
+ * @returns The exchanged access token.
995
+ */ function exchangeAuthorizationCodeToAccessToken(input) {
996
+ return _async_to_generator$2(function() {
997
+ var response;
998
+ return _ts_generator$2(this, function(_state) {
999
+ switch(_state.label){
1000
+ case 0:
1001
+ return [
1002
+ 4,
1003
+ this.exchangeAuthorizationCode(input)
1004
+ ];
1005
+ case 1:
1006
+ response = _state.sent();
1007
+ return [
1008
+ 2,
1009
+ calcom.calcomAccessTokenFromTokenResponse(response)
1010
+ ];
1011
+ }
1012
+ });
1013
+ }).call(this);
1014
+ }
1015
+ },
808
1016
  {
809
1017
  /**
810
1018
  * Retrieves an access token for a specific user using their refresh token.
811
1019
  *
812
- * @param input - Contains the user's refresh token and optional access token cache.
813
- * @param input.refreshToken - The user's OAuth refresh token.
814
- * @param input.userAccessTokenCache - Optional cache to store/retrieve the user's access token.
1020
+ * @param credential - The user's refresh token credential, with the cache scoped to that grant.
815
1021
  * @returns Promise resolving to the user's CalcomAccessToken.
816
1022
  */ key: "userAccessToken",
817
- value: function userAccessToken(input) {
818
- var factory = this.oauthContext.makeUserAccessTokenFactory(input);
819
- return factory();
1023
+ value: function userAccessToken(credential) {
1024
+ return this.userAccessTokenFactory(credential)();
1025
+ }
1026
+ },
1027
+ {
1028
+ /**
1029
+ * Returns the CalcomAccessTokenFactory for a user's credential.
1030
+ *
1031
+ * A fresh factory on every call: its in-memory tier lives only as long as the returned factory, so
1032
+ * one caller's tokens are never visible to the next. Durable sharing is the access token cache's
1033
+ * job — see {@link cacheForKey}.
1034
+ *
1035
+ * @param credential - The user's refresh token credential.
1036
+ * @returns The CalcomAccessTokenFactory for that credential.
1037
+ */ key: "userAccessTokenFactory",
1038
+ value: function userAccessTokenFactory(credential) {
1039
+ return this.oauthContext.makeAccessTokenFactory(credential);
820
1040
  }
821
1041
  },
822
1042
  {
823
1043
  /**
824
- * Returns a per-user CalcomAccessTokenCache derived from the refresh token (md5 hashed as the file key).
1044
+ * Returns a per-user CalcomAccessTokenCache for a stable, caller-owned key.
1045
+ * Returns undefined if the cache service does not support keyed caching.
1046
+ *
1047
+ * Preferred over {@link cacheForRefreshToken}, whose key changes as Cal.com rotates the token.
1048
+ *
1049
+ * @param key - A stable key identifying the user, such as their user or profile id.
1050
+ * @returns A per-user access token cache, or undefined if not supported.
1051
+ */ key: "cacheForKey",
1052
+ value: function cacheForKey(key) {
1053
+ var _this_cacheService_cacheForKey, _this_cacheService;
1054
+ return (_this_cacheService_cacheForKey = (_this_cacheService = this.cacheService).cacheForKey) === null || _this_cacheService_cacheForKey === void 0 ? void 0 : _this_cacheService_cacheForKey.call(_this_cacheService, key);
1055
+ }
1056
+ },
1057
+ {
1058
+ /**
1059
+ * Returns a per-user CalcomAccessTokenCache derived from a hash of the refresh token.
825
1060
  * Returns undefined if the cache service does not support per-user caching.
826
1061
  *
827
1062
  * @param refreshToken - The user's OAuth refresh token used to derive the cache key.
@@ -1090,7 +1325,7 @@ function _object_spread_props$1(target, source) {
1090
1325
  * resolved from the cache service using an md5 hash of the refresh token as the key.
1091
1326
  * This ensures tokens persist across requests and server restarts without collisions.
1092
1327
  *
1093
- * @param input - The user context factory input containing the refresh token and optional cache.
1328
+ * @param credential - The user's refresh token credential, with an optional cache scoped to that grant.
1094
1329
  * @returns A new CalcomApiContextInstance scoped to the user.
1095
1330
  *
1096
1331
  * @example
@@ -1107,16 +1342,13 @@ function _object_spread_props$1(target, source) {
1107
1342
  * });
1108
1343
  * ```
1109
1344
  */ key: "makeUserContextInstance",
1110
- value: function makeUserContextInstance(input) {
1111
- var contextInput = _object_spread$1({}, input);
1112
- // Auto-resolve per-user cache from the refresh token if no explicit cache was given
1113
- if (!contextInput.accessTokenCache && contextInput.refreshToken) {
1114
- var userCache = this.calcomOAuthApi.cacheForRefreshToken(contextInput.refreshToken);
1115
- if (userCache) {
1116
- contextInput.accessTokenCache = userCache;
1117
- }
1118
- }
1119
- var userContext = this.calcom.calcomServerContext.makeUserContext(contextInput);
1345
+ value: function makeUserContextInstance(credential) {
1346
+ var _credential_accessTokenCache;
1347
+ // auto-resolve a per-user cache from the refresh token when none was given
1348
+ var accessTokenCache = (_credential_accessTokenCache = credential.accessTokenCache) !== null && _credential_accessTokenCache !== void 0 ? _credential_accessTokenCache : this.calcomOAuthApi.cacheForRefreshToken(credential.refreshToken);
1349
+ var userContext = this.calcom.calcomServerContext.makeUserContext(_object_spread_props$1(_object_spread$1({}, credential), {
1350
+ accessTokenCache: accessTokenCache
1351
+ }));
1120
1352
  return this.makeContextInstance(userContext);
1121
1353
  }
1122
1354
  },
@@ -1136,11 +1368,11 @@ function _object_spread_props$1(target, source) {
1136
1368
  * Creates a raw {@link CalcomUserContext} from a refresh token, without wrapping in a {@link CalcomApiContextInstance}.
1137
1369
  * Prefer {@link makeUserContextInstance} unless you need direct context access.
1138
1370
  *
1139
- * @param input - The user context factory input containing the refresh token and optional cache.
1371
+ * @param credential - The user's refresh token credential, with the cache scoped to that grant.
1140
1372
  * @returns A CalcomUserContext for the given user.
1141
1373
  */ key: "makeUserContext",
1142
- value: function makeUserContext(input) {
1143
- return this.calcom.calcomServerContext.makeUserContext(input);
1374
+ value: function makeUserContext(credential) {
1375
+ return this.calcom.calcomServerContext.makeUserContext(credential);
1144
1376
  }
1145
1377
  }
1146
1378
  ]);
@@ -2158,6 +2390,7 @@ exports.DEFAULT_FILE_CALCOM_ACCESS_TOKEN_CACHE_DIR = DEFAULT_FILE_CALCOM_ACCESS_
2158
2390
  exports.appCalcomModuleMetadata = appCalcomModuleMetadata;
2159
2391
  exports.appCalcomOAuthModuleMetadata = appCalcomOAuthModuleMetadata;
2160
2392
  exports.appCalcomWebhookModuleMetadata = appCalcomWebhookModuleMetadata;
2393
+ exports.calcomAccessTokenCacheFileKey = calcomAccessTokenCacheFileKey;
2161
2394
  exports.calcomEventHandlerConfigurerFactory = calcomEventHandlerConfigurerFactory;
2162
2395
  exports.calcomEventHandlerFactory = calcomEventHandlerFactory;
2163
2396
  exports.calcomOAuthServiceConfigFactory = calcomOAuthServiceConfigFactory;