@dereekb/calcom 13.11.14 → 13.11.16
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 +98 -89
- package/index.esm.js +98 -89
- package/nestjs/index.cjs.js +79 -74
- package/nestjs/index.esm.js +79 -74
- package/nestjs/package.json +5 -5
- package/nestjs/src/lib/calcom/calcom.api.d.ts +24 -24
- package/nestjs/src/lib/calcom/calcom.module.d.ts +4 -4
- package/nestjs/src/lib/oauth/oauth.api.d.ts +7 -7
- package/nestjs/src/lib/oauth/oauth.config.d.ts +2 -2
- package/nestjs/src/lib/oauth/oauth.module.d.ts +2 -2
- package/nestjs/src/lib/oauth/oauth.service.d.ts +12 -11
- package/nestjs/src/lib/webhook/webhook.calcom.d.ts +2 -2
- package/nestjs/src/lib/webhook/webhook.calcom.module.d.ts +4 -4
- package/nestjs/src/lib/webhook/webhook.calcom.verify.d.ts +2 -2
- package/package.json +4 -4
- package/src/lib/calcom/calcom.api.booking.d.ts +10 -9
- package/src/lib/calcom/calcom.api.calendar.d.ts +6 -6
- package/src/lib/calcom/calcom.api.eventtype.d.ts +15 -14
- package/src/lib/calcom/calcom.api.schedule.d.ts +3 -3
- package/src/lib/calcom/calcom.api.slot.d.ts +3 -3
- package/src/lib/calcom/calcom.api.user.d.ts +6 -6
- package/src/lib/calcom/calcom.api.webhook.d.ts +19 -18
- package/src/lib/calcom/calcom.error.api.d.ts +5 -5
- package/src/lib/calcom/calcom.factory.d.ts +3 -2
- package/src/lib/calcom.error.api.d.ts +12 -10
- package/src/lib/calcom.limit.d.ts +2 -2
- package/src/lib/oauth/oauth.api.d.ts +6 -6
- package/src/lib/oauth/oauth.d.ts +3 -2
- package/src/lib/oauth/oauth.error.api.d.ts +5 -5
- package/src/lib/oauth/oauth.factory.d.ts +8 -6
- package/src/lib/shared/calcom.api-version.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -265,8 +265,9 @@ function _ts_generator$5(thisArg, body) {
|
|
|
265
265
|
/**
|
|
266
266
|
* Creates a logCalcomServerErrorFunction that logs the error to console.
|
|
267
267
|
*
|
|
268
|
-
* @param calcomApiNamePrefix Prefix to use when logging. I.E. CalcomError, etc.
|
|
269
|
-
* @returns
|
|
268
|
+
* @param calcomApiNamePrefix - Prefix to use when logging. I.E. CalcomError, etc.
|
|
269
|
+
* @returns A LogCalcomServerErrorFunction that logs errors with the given prefix.
|
|
270
|
+
*
|
|
270
271
|
* @__NO_SIDE_EFFECTS__
|
|
271
272
|
*/ function logCalcomServerErrorFunction(calcomApiNamePrefix) {
|
|
272
273
|
return function(error) {
|
|
@@ -289,9 +290,10 @@ function _ts_generator$5(thisArg, body) {
|
|
|
289
290
|
/**
|
|
290
291
|
* Wraps a ConfiguredFetch to support handling errors returned by fetch.
|
|
291
292
|
*
|
|
292
|
-
* @param parseCalcomError -
|
|
293
|
-
* @param defaultLogError -
|
|
294
|
-
* @returns
|
|
293
|
+
* @param parseCalcomError - Function to parse a FetchResponseError into a CalcomServerError.
|
|
294
|
+
* @param defaultLogError - Default error logging function used when no override is provided.
|
|
295
|
+
* @returns A factory that wraps any ConfiguredFetch with Cal.com error handling.
|
|
296
|
+
*
|
|
295
297
|
* @__NO_SIDE_EFFECTS__
|
|
296
298
|
*/ function handleCalcomErrorFetchFactory(parseCalcomError, defaultLogError) {
|
|
297
299
|
return function(fetch) {
|
|
@@ -358,8 +360,8 @@ var DEFAULT_CALCOM_API_RATE_LIMIT_RESET_PERIOD = 60 * MS_IN_SECOND;
|
|
|
358
360
|
/**
|
|
359
361
|
* Extracts Cal.com rate limit information from HTTP response headers.
|
|
360
362
|
*
|
|
361
|
-
* @param headers -
|
|
362
|
-
* @returns
|
|
363
|
+
* @param headers - The HTTP response headers to parse.
|
|
364
|
+
* @returns Parsed rate limit details, or null if no rate limit headers are present.
|
|
363
365
|
*/ function calcomRateLimitHeaderDetails(headers) {
|
|
364
366
|
var limitHeader = headers.get(CALCOM_RATE_LIMIT_LIMIT_HEADER);
|
|
365
367
|
var remainingHeader = headers.get(CALCOM_RATE_LIMIT_REMAINING_HEADER);
|
|
@@ -396,9 +398,9 @@ var CalcomTooManyRequestsError = /*#__PURE__*/ function(CalcomServerFetchRespons
|
|
|
396
398
|
/**
|
|
397
399
|
* Function that parses/transforms a CalcomServerErrorData into a general CalcomServerError or other known error type.
|
|
398
400
|
*
|
|
399
|
-
* @param calcomServerError -
|
|
400
|
-
* @param responseError -
|
|
401
|
-
* @returns
|
|
401
|
+
* @param calcomServerError - The parsed error data from the Cal.com response body.
|
|
402
|
+
* @param responseError - The original FetchResponseError containing the HTTP response.
|
|
403
|
+
* @returns A CalcomServerFetchResponseError (or subclass like CalcomTooManyRequestsError), or undefined if unrecognized.
|
|
402
404
|
*/ function parseCalcomServerErrorData(calcomServerError, responseError) {
|
|
403
405
|
var result;
|
|
404
406
|
if (responseError.response.status === CALCOM_TOO_MANY_REQUESTS_HTTP_STATUS_CODE) {
|
|
@@ -552,8 +554,8 @@ var logCalcomErrorToConsole = logCalcomServerErrorFunction('Calcom');
|
|
|
552
554
|
* Parses a FetchResponseError from a Cal.com API call into a typed CalcomServerError.
|
|
553
555
|
* Attempts to extract JSON error data from the response body.
|
|
554
556
|
*
|
|
555
|
-
* @param responseError -
|
|
556
|
-
* @returns
|
|
557
|
+
* @param responseError - The fetch response error to parse.
|
|
558
|
+
* @returns A parsed CalcomServerError, or undefined if the response body cannot be parsed.
|
|
557
559
|
*/ function parseCalcomApiError(responseError) {
|
|
558
560
|
return _async_to_generator$4(function() {
|
|
559
561
|
var data, result;
|
|
@@ -583,9 +585,9 @@ var logCalcomErrorToConsole = logCalcomServerErrorFunction('Calcom');
|
|
|
583
585
|
* Parses Cal.com API server error response data into a specific error type.
|
|
584
586
|
* Delegates to {@link parseCalcomServerErrorData} for general error classification.
|
|
585
587
|
*
|
|
586
|
-
* @param calcomServerError -
|
|
587
|
-
* @param responseError -
|
|
588
|
-
* @returns
|
|
588
|
+
* @param calcomServerError - The parsed error data from the Cal.com response body.
|
|
589
|
+
* @param responseError - The original FetchResponseError containing the HTTP response.
|
|
590
|
+
* @returns A parsed CalcomServerError, or undefined if the error data is falsy.
|
|
589
591
|
*/ function parseCalcomApiServerErrorResponseData(calcomServerError, responseError) {
|
|
590
592
|
var result;
|
|
591
593
|
if (calcomServerError) {
|
|
@@ -838,8 +840,8 @@ var logCalcomOAuthErrorToConsole = logCalcomServerErrorFunction('CalcomOAuth');
|
|
|
838
840
|
* Parses a FetchResponseError from a Cal.com OAuth call into a typed error.
|
|
839
841
|
* Attempts to extract JSON error data from the response body.
|
|
840
842
|
*
|
|
841
|
-
* @param responseError -
|
|
842
|
-
* @returns
|
|
843
|
+
* @param responseError - The fetch response error to parse.
|
|
844
|
+
* @returns A parsed CalcomServerError or CalcomOAuthAccessTokenError, or undefined if unparseable.
|
|
843
845
|
*/ function parseCalcomOAuthError(responseError) {
|
|
844
846
|
return _async_to_generator$3(function() {
|
|
845
847
|
var data, result;
|
|
@@ -870,9 +872,9 @@ var logCalcomOAuthErrorToConsole = logCalcomServerErrorFunction('CalcomOAuth');
|
|
|
870
872
|
* Handles known error codes like `invalid_grant` and delegates unknown errors
|
|
871
873
|
* to {@link parseCalcomServerErrorData}.
|
|
872
874
|
*
|
|
873
|
-
* @param calcomServerError -
|
|
874
|
-
* @param responseError -
|
|
875
|
-
* @returns
|
|
875
|
+
* @param calcomServerError - The parsed error data from the Cal.com OAuth response body.
|
|
876
|
+
* @param responseError - The original FetchResponseError containing the HTTP response.
|
|
877
|
+
* @returns A parsed error instance, or undefined if the error data is falsy.
|
|
876
878
|
*/ function parseCalcomOAuthServerErrorResponseData(calcomServerError, responseError) {
|
|
877
879
|
var result;
|
|
878
880
|
if (calcomServerError) {
|
|
@@ -1024,8 +1026,9 @@ function _ts_generator$2(thisArg, body) {
|
|
|
1024
1026
|
* Wraps a CalcomAccessTokenFactory to extract just the access token string,
|
|
1025
1027
|
* throwing a CalcomOAuthAuthFailureError if the token is missing.
|
|
1026
1028
|
*
|
|
1027
|
-
* @param calcomAccessTokenFactory -
|
|
1028
|
-
* @returns
|
|
1029
|
+
* @param calcomAccessTokenFactory - The factory that produces CalcomAccessToken objects.
|
|
1030
|
+
* @returns A factory function that returns the access token string.
|
|
1031
|
+
*
|
|
1029
1032
|
* @__NO_SIDE_EFFECTS__
|
|
1030
1033
|
*/ function calcomAccessTokenStringFactory(calcomAccessTokenFactory) {
|
|
1031
1034
|
return function() {
|
|
@@ -1060,8 +1063,8 @@ var DEFAULT_CALCOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION = function DEFAUL
|
|
|
1060
1063
|
* Creates a rate-limited fetch handler configured for Cal.com API rate limits.
|
|
1061
1064
|
* Automatically adjusts based on rate limit response headers and retries on 429 responses.
|
|
1062
1065
|
*
|
|
1063
|
-
* @param config -
|
|
1064
|
-
* @returns
|
|
1066
|
+
* @param config - Optional rate limiter configuration overrides.
|
|
1067
|
+
* @returns A CalcomRateLimitedFetchHandler that enforces rate limiting.
|
|
1065
1068
|
*/ function calcomRateLimitedFetchHandler(config) {
|
|
1066
1069
|
var _ref, _ref1, _ref2;
|
|
1067
1070
|
var onTooManyRequests = (config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== false ? (_ref = config === null || config === void 0 ? void 0 : config.onTooManyRequests) !== null && _ref !== void 0 ? _ref : DEFAULT_CALCOM_RATE_LIMITED_TOO_MANY_REQUESTS_LOG_FUNCTION : undefined;
|
|
@@ -1257,8 +1260,9 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1257
1260
|
* Sets up rate limiting, error handling, OAuth token management, and both server
|
|
1258
1261
|
* and per-user fetch contexts.
|
|
1259
1262
|
*
|
|
1260
|
-
* @param factoryConfig -
|
|
1261
|
-
* @returns
|
|
1263
|
+
* @param factoryConfig - Configuration including OAuth context, rate limiter, and optional fetch/logging overrides.
|
|
1264
|
+
* @returns A factory function that accepts a CalcomConfig and produces a Calcom instance.
|
|
1265
|
+
*
|
|
1262
1266
|
* @__NO_SIDE_EFFECTS__
|
|
1263
1267
|
*/ function calcomFactory(factoryConfig) {
|
|
1264
1268
|
var oauthContext = factoryConfig.oauthContext;
|
|
@@ -1400,8 +1404,8 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1400
1404
|
/**
|
|
1401
1405
|
* Returns a headers object with the cal-api-version header set.
|
|
1402
1406
|
*
|
|
1403
|
-
* @param version -
|
|
1404
|
-
* @returns
|
|
1407
|
+
* @param version - The Cal.com API version string to include in the header.
|
|
1408
|
+
* @returns A headers record containing the cal-api-version header.
|
|
1405
1409
|
*/ function calcomApiVersionHeaders(version) {
|
|
1406
1410
|
return _define_property({}, CALCOM_API_VERSION_HEADER, version);
|
|
1407
1411
|
}
|
|
@@ -1409,10 +1413,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1409
1413
|
/**
|
|
1410
1414
|
* Retrieves the profile of the currently authenticated Cal.com user.
|
|
1411
1415
|
*
|
|
1412
|
-
* @
|
|
1416
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1417
|
+
* @returns Retrieves the authenticated user's profile.
|
|
1413
1418
|
*
|
|
1414
|
-
* @
|
|
1415
|
-
* @returns a function that retrieves the authenticated user's profile
|
|
1419
|
+
* @see https://cal.com/docs/api-reference/v2/me
|
|
1416
1420
|
*
|
|
1417
1421
|
* @example
|
|
1418
1422
|
* ```ts
|
|
@@ -1431,10 +1435,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1431
1435
|
/**
|
|
1432
1436
|
* Retrieves all schedules for the authenticated user, including availability rules and overrides.
|
|
1433
1437
|
*
|
|
1434
|
-
* @
|
|
1438
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1439
|
+
* @returns Retrieves all schedules.
|
|
1435
1440
|
*
|
|
1436
|
-
* @
|
|
1437
|
-
* @returns a function that retrieves all schedules
|
|
1441
|
+
* @see https://cal.com/docs/api-reference/v2/schedules/get-all-schedules
|
|
1438
1442
|
*
|
|
1439
1443
|
* @example
|
|
1440
1444
|
* ```ts
|
|
@@ -1456,10 +1460,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1456
1460
|
*
|
|
1457
1461
|
* Identify the event type by `eventTypeId`, or by `eventTypeSlug` + `username`/`teamSlug`.
|
|
1458
1462
|
*
|
|
1459
|
-
* @
|
|
1463
|
+
* @param context - The Cal.com API context (authenticated or public)
|
|
1464
|
+
* @returns Queries available slots for the given input.
|
|
1460
1465
|
*
|
|
1461
|
-
* @
|
|
1462
|
-
* @returns a function that queries available slots for the given input
|
|
1466
|
+
* @see https://cal.com/docs/api-reference/v2/slots/get-available-time-slots-for-an-event-type
|
|
1463
1467
|
*
|
|
1464
1468
|
* @example
|
|
1465
1469
|
* ```ts
|
|
@@ -1487,10 +1491,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1487
1491
|
* Creates a new booking for the specified event type. The `attendee` represents the person
|
|
1488
1492
|
* booking (the client), not the host. This endpoint can be called without authentication.
|
|
1489
1493
|
*
|
|
1490
|
-
* @
|
|
1494
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1495
|
+
* @returns Creates a booking from the given input.
|
|
1491
1496
|
*
|
|
1492
|
-
* @
|
|
1493
|
-
* @returns a function that creates a booking from the given input
|
|
1497
|
+
* @see https://cal.com/docs/api-reference/v2/bookings/create-a-booking
|
|
1494
1498
|
*
|
|
1495
1499
|
* @example
|
|
1496
1500
|
* ```ts
|
|
@@ -1501,6 +1505,7 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1501
1505
|
* });
|
|
1502
1506
|
* console.log(response.data.uid);
|
|
1503
1507
|
* ```
|
|
1508
|
+
*
|
|
1504
1509
|
* @__NO_SIDE_EFFECTS__
|
|
1505
1510
|
*/ function createBooking(context) {
|
|
1506
1511
|
return function(input) {
|
|
@@ -1514,10 +1519,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1514
1519
|
/**
|
|
1515
1520
|
* Retrieves a booking by its unique UID.
|
|
1516
1521
|
*
|
|
1517
|
-
* @
|
|
1522
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1523
|
+
* @returns Retrieves a booking by its UID.
|
|
1518
1524
|
*
|
|
1519
|
-
* @
|
|
1520
|
-
* @returns a function that retrieves a booking by its UID
|
|
1525
|
+
* @see https://cal.com/docs/api-reference/v2/bookings/get-a-booking
|
|
1521
1526
|
*
|
|
1522
1527
|
* @example
|
|
1523
1528
|
* ```ts
|
|
@@ -1535,10 +1540,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1535
1540
|
/**
|
|
1536
1541
|
* Cancels a booking by its unique UID, with an optional cancellation reason.
|
|
1537
1542
|
*
|
|
1538
|
-
* @
|
|
1543
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1544
|
+
* @returns Cancels a booking by UID.
|
|
1539
1545
|
*
|
|
1540
|
-
* @
|
|
1541
|
-
* @returns a function that cancels a booking by UID
|
|
1546
|
+
* @see https://cal.com/docs/api-reference/v2/bookings/cancel-a-booking
|
|
1542
1547
|
*
|
|
1543
1548
|
* @example
|
|
1544
1549
|
* ```ts
|
|
@@ -1561,10 +1566,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1561
1566
|
/**
|
|
1562
1567
|
* Retrieves all event types for the authenticated user.
|
|
1563
1568
|
*
|
|
1564
|
-
* @
|
|
1569
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1570
|
+
* @returns Retrieves all event types.
|
|
1565
1571
|
*
|
|
1566
|
-
* @
|
|
1567
|
-
* @returns a function that retrieves all event types
|
|
1572
|
+
* @see https://cal.com/docs/api-reference/v2/event-types/get-all-event-types
|
|
1568
1573
|
*
|
|
1569
1574
|
* @example
|
|
1570
1575
|
* ```ts
|
|
@@ -1582,10 +1587,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1582
1587
|
/**
|
|
1583
1588
|
* Creates a new event type for the authenticated user.
|
|
1584
1589
|
*
|
|
1585
|
-
* @
|
|
1590
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1591
|
+
* @returns Creates a new event type from the given input.
|
|
1586
1592
|
*
|
|
1587
|
-
* @
|
|
1588
|
-
* @returns a function that creates a new event type from the given input
|
|
1593
|
+
* @see https://cal.com/docs/api-reference/v2/event-types/create-an-event-type
|
|
1589
1594
|
*
|
|
1590
1595
|
* @example
|
|
1591
1596
|
* ```ts
|
|
@@ -1596,6 +1601,7 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1596
1601
|
* });
|
|
1597
1602
|
* console.log(response.data.id);
|
|
1598
1603
|
* ```
|
|
1604
|
+
*
|
|
1599
1605
|
* @__NO_SIDE_EFFECTS__
|
|
1600
1606
|
*/ function createEventType(context) {
|
|
1601
1607
|
return function(input) {
|
|
@@ -1609,10 +1615,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1609
1615
|
/**
|
|
1610
1616
|
* Updates an existing event type by ID.
|
|
1611
1617
|
*
|
|
1612
|
-
* @
|
|
1618
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1619
|
+
* @returns Updates an event type by ID.
|
|
1613
1620
|
*
|
|
1614
|
-
* @
|
|
1615
|
-
* @returns a function that updates an event type by ID
|
|
1621
|
+
* @see https://cal.com/docs/api-reference/v2/event-types/update-an-event-type
|
|
1616
1622
|
*
|
|
1617
1623
|
* @example
|
|
1618
1624
|
* ```ts
|
|
@@ -1630,10 +1636,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1630
1636
|
/**
|
|
1631
1637
|
* Deletes an event type by ID.
|
|
1632
1638
|
*
|
|
1633
|
-
* @
|
|
1639
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1640
|
+
* @returns Deletes an event type by ID.
|
|
1634
1641
|
*
|
|
1635
|
-
* @
|
|
1636
|
-
* @returns a function that deletes an event type by ID
|
|
1642
|
+
* @see https://cal.com/docs/api-reference/v2/event-types/delete-an-event-type
|
|
1637
1643
|
*
|
|
1638
1644
|
* @example
|
|
1639
1645
|
* ```ts
|
|
@@ -1651,10 +1657,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1651
1657
|
/**
|
|
1652
1658
|
* Retrieves all connected calendars and the destination calendar for the authenticated user.
|
|
1653
1659
|
*
|
|
1654
|
-
* @
|
|
1660
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1661
|
+
* @returns Retrieves all connected calendars.
|
|
1655
1662
|
*
|
|
1656
|
-
* @
|
|
1657
|
-
* @returns a function that retrieves all connected calendars
|
|
1663
|
+
* @see https://cal.com/docs/api-reference/v2/calendars/get-all-calendars
|
|
1658
1664
|
*
|
|
1659
1665
|
* @example
|
|
1660
1666
|
* ```ts
|
|
@@ -1672,10 +1678,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1672
1678
|
/**
|
|
1673
1679
|
* Retrieves busy time ranges across the user's connected calendars for a given date range.
|
|
1674
1680
|
*
|
|
1675
|
-
* @
|
|
1681
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1682
|
+
* @returns Retrieves busy time ranges for a date range.
|
|
1676
1683
|
*
|
|
1677
|
-
* @
|
|
1678
|
-
* @returns a function that retrieves busy time ranges for a date range
|
|
1684
|
+
* @see https://cal.com/docs/api-reference/v2/calendars/get-busy-times
|
|
1679
1685
|
*
|
|
1680
1686
|
* @example
|
|
1681
1687
|
* ```ts
|
|
@@ -1704,10 +1710,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1704
1710
|
* Creates a webhook subscription for the authenticated user. Webhooks notify your app
|
|
1705
1711
|
* when specified events occur (e.g., bookings created, cancelled, rescheduled).
|
|
1706
1712
|
*
|
|
1707
|
-
* @
|
|
1713
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1714
|
+
* @returns Creates a webhook subscription from the given input.
|
|
1708
1715
|
*
|
|
1709
|
-
* @
|
|
1710
|
-
* @returns a function that creates a webhook subscription from the given input
|
|
1716
|
+
* @see https://cal.com/docs/api-reference/v2/webhooks/create-a-webhook
|
|
1711
1717
|
*
|
|
1712
1718
|
* @example
|
|
1713
1719
|
* ```ts
|
|
@@ -1718,6 +1724,7 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1718
1724
|
* });
|
|
1719
1725
|
* console.log(response.data.id);
|
|
1720
1726
|
* ```
|
|
1727
|
+
*
|
|
1721
1728
|
* @__NO_SIDE_EFFECTS__
|
|
1722
1729
|
*/ function createWebhook(context) {
|
|
1723
1730
|
return function(input) {
|
|
@@ -1730,10 +1737,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1730
1737
|
/**
|
|
1731
1738
|
* Retrieves all webhooks for the authenticated user.
|
|
1732
1739
|
*
|
|
1733
|
-
* @
|
|
1740
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1741
|
+
* @returns Retrieves all webhooks.
|
|
1734
1742
|
*
|
|
1735
|
-
* @
|
|
1736
|
-
* @returns a function that retrieves all webhooks
|
|
1743
|
+
* @see https://cal.com/docs/api-reference/v2/webhooks/get-all-webhooks
|
|
1737
1744
|
*
|
|
1738
1745
|
* @example
|
|
1739
1746
|
* ```ts
|
|
@@ -1750,10 +1757,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1750
1757
|
/**
|
|
1751
1758
|
* Retrieves a specific webhook by ID.
|
|
1752
1759
|
*
|
|
1753
|
-
* @
|
|
1760
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1761
|
+
* @returns Retrieves a specific webhook by ID.
|
|
1754
1762
|
*
|
|
1755
|
-
* @
|
|
1756
|
-
* @returns a function that retrieves a specific webhook by ID
|
|
1763
|
+
* @see https://cal.com/docs/api-reference/v2/webhooks/get-a-webhook
|
|
1757
1764
|
*
|
|
1758
1765
|
* @example
|
|
1759
1766
|
* ```ts
|
|
@@ -1770,10 +1777,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1770
1777
|
/**
|
|
1771
1778
|
* Updates an existing webhook by ID.
|
|
1772
1779
|
*
|
|
1773
|
-
* @
|
|
1780
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1781
|
+
* @returns Updates an existing webhook by ID.
|
|
1774
1782
|
*
|
|
1775
|
-
* @
|
|
1776
|
-
* @returns a function that updates an existing webhook by ID
|
|
1783
|
+
* @see https://cal.com/docs/api-reference/v2/webhooks/update-a-webhook
|
|
1777
1784
|
*
|
|
1778
1785
|
* @example
|
|
1779
1786
|
* ```ts
|
|
@@ -1790,10 +1797,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1790
1797
|
/**
|
|
1791
1798
|
* Deletes a webhook by ID.
|
|
1792
1799
|
*
|
|
1793
|
-
* @
|
|
1800
|
+
* @param context - The Cal.com API context providing authentication and fetch capabilities.
|
|
1801
|
+
* @returns Deletes a webhook by ID.
|
|
1794
1802
|
*
|
|
1795
|
-
* @
|
|
1796
|
-
* @returns a function that deletes a webhook by ID
|
|
1803
|
+
* @see https://cal.com/docs/api-reference/v2/webhooks/delete-a-webhook
|
|
1797
1804
|
*
|
|
1798
1805
|
* @example
|
|
1799
1806
|
* ```ts
|
|
@@ -1813,10 +1820,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1813
1820
|
*
|
|
1814
1821
|
* Cal.com uses JSON body (not Basic Auth) for token requests.
|
|
1815
1822
|
*
|
|
1816
|
-
* @
|
|
1823
|
+
* @param context - The Cal.com OAuth context providing client credentials and fetch capabilities.
|
|
1824
|
+
* @returns Refreshes an access token using an optional refresh token override.
|
|
1817
1825
|
*
|
|
1818
|
-
* @
|
|
1819
|
-
* @returns a function that refreshes an access token using an optional refresh token override
|
|
1826
|
+
* @see https://cal.com/docs/api-reference/v2/oauth/refresh-an-existing-access-token
|
|
1820
1827
|
*
|
|
1821
1828
|
* @example
|
|
1822
1829
|
* ```ts
|
|
@@ -1845,10 +1852,10 @@ var CALCOM_API_VERSION_HEADER = 'cal-api-version';
|
|
|
1845
1852
|
*
|
|
1846
1853
|
* Cal.com uses JSON body (not Basic Auth) for token requests.
|
|
1847
1854
|
*
|
|
1848
|
-
* @
|
|
1855
|
+
* @param context - The Cal.com OAuth context providing client credentials and fetch capabilities.
|
|
1856
|
+
* @returns Exchanges an authorization code for access and refresh tokens.
|
|
1849
1857
|
*
|
|
1850
|
-
* @
|
|
1851
|
-
* @returns a function that exchanges an authorization code for access and refresh tokens
|
|
1858
|
+
* @see https://cal.com/docs/api-reference/v2/oauth/exchange-an-authorization-code-for-access-tokens
|
|
1852
1859
|
*
|
|
1853
1860
|
* @example
|
|
1854
1861
|
* ```ts
|
|
@@ -2014,8 +2021,9 @@ function _ts_generator(thisArg, body) {
|
|
|
2014
2021
|
* Supports both API key authentication (static token, no refresh) and full OAuth
|
|
2015
2022
|
* refresh token flow with automatic token rotation.
|
|
2016
2023
|
*
|
|
2017
|
-
* @param factoryConfig -
|
|
2018
|
-
* @returns
|
|
2024
|
+
* @param factoryConfig - Configuration including optional fetch factory and error logging.
|
|
2025
|
+
* @returns A factory function that accepts a CalcomOAuthConfig and produces a CalcomOAuth instance.
|
|
2026
|
+
*
|
|
2019
2027
|
* @__NO_SIDE_EFFECTS__
|
|
2020
2028
|
*/ function calcomOAuthFactory(factoryConfig) {
|
|
2021
2029
|
var fetchHandler = calcomRateLimitedFetchHandler();
|
|
@@ -2175,8 +2183,9 @@ function _ts_generator(thisArg, body) {
|
|
|
2175
2183
|
* Checks the in-memory cache first, then the external cache, and finally refreshes
|
|
2176
2184
|
* from the token refresher if no valid token is available.
|
|
2177
2185
|
*
|
|
2178
|
-
* @param config -
|
|
2179
|
-
* @returns
|
|
2186
|
+
* @param config - Configuration including the token refresher, optional cache, and expiration buffer.
|
|
2187
|
+
* @returns A CalcomAccessTokenFactory that returns a valid access token on each call.
|
|
2188
|
+
*
|
|
2180
2189
|
* @__NO_SIDE_EFFECTS__
|
|
2181
2190
|
*/ function calcomOAuthAccessTokenFactory(config) {
|
|
2182
2191
|
var tokenRefresher = config.tokenRefresher, accessTokenCache = config.accessTokenCache, inputTokenExpirationBuffer = config.tokenExpirationBuffer;
|