@liveblocks/node 2.9.2-emails1 → 2.9.3-composer1

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/dist/index.d.mts CHANGED
@@ -1096,29 +1096,6 @@ declare type CustomNotificationEvent = {
1096
1096
  };
1097
1097
  declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificationEvent | CustomNotificationEvent;
1098
1098
 
1099
- /**
1100
- * Type guard to check if a webhook event is a `ThreadNotificationEvent`
1101
- *
1102
- * The check is made against the event type and event data kind.
1103
- * You should use this guard to safely check the webhook event you received
1104
- * when you're expecting a `ThreadNotificationEvent`.
1105
- *
1106
- * @param event The webhook event received after calling `webhookHandler.verifyRequest()`.
1107
- * @returns A boolean type predicate.
1108
- */
1109
- declare function isThreadNotificationEvent(event: WebhookEvent): event is ThreadNotificationEvent;
1110
- /**
1111
- * Type guard to check if a webhook event is a `TextMentionNotificationEvent`
1112
- *
1113
- * The check is made against the event type and event data kind.
1114
- * You should use this guard to safely check the webhook event you received
1115
- * when you're expecting a `TextMentionNotificationEvent`.
1116
- *
1117
- * @param event The webhook event received after calling `webhookHandler.verifyRequest()`.
1118
- * @returns A boolean type predicate.
1119
- */
1120
- declare function isTextMentionNotificationEvent(event: WebhookEvent): event is TextMentionNotificationEvent;
1121
-
1122
1099
  /**
1123
1100
  * @deprecated RoomInfo was renamed to RoomData, to avoid
1124
1101
  * confusion with the globally augmentable RoomInfo type. This
@@ -1126,4 +1103,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
1126
1103
  */
1127
1104
  declare type RoomInfo = RoomData;
1128
1105
 
1129
- export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
1106
+ export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent };
package/dist/index.d.ts CHANGED
@@ -1096,29 +1096,6 @@ declare type CustomNotificationEvent = {
1096
1096
  };
1097
1097
  declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificationEvent | CustomNotificationEvent;
1098
1098
 
1099
- /**
1100
- * Type guard to check if a webhook event is a `ThreadNotificationEvent`
1101
- *
1102
- * The check is made against the event type and event data kind.
1103
- * You should use this guard to safely check the webhook event you received
1104
- * when you're expecting a `ThreadNotificationEvent`.
1105
- *
1106
- * @param event The webhook event received after calling `webhookHandler.verifyRequest()`.
1107
- * @returns A boolean type predicate.
1108
- */
1109
- declare function isThreadNotificationEvent(event: WebhookEvent): event is ThreadNotificationEvent;
1110
- /**
1111
- * Type guard to check if a webhook event is a `TextMentionNotificationEvent`
1112
- *
1113
- * The check is made against the event type and event data kind.
1114
- * You should use this guard to safely check the webhook event you received
1115
- * when you're expecting a `TextMentionNotificationEvent`.
1116
- *
1117
- * @param event The webhook event received after calling `webhookHandler.verifyRequest()`.
1118
- * @returns A boolean type predicate.
1119
- */
1120
- declare function isTextMentionNotificationEvent(event: WebhookEvent): event is TextMentionNotificationEvent;
1121
-
1122
1099
  /**
1123
1100
  * @deprecated RoomInfo was renamed to RoomData, to avoid
1124
1101
  * confusion with the globally augmentable RoomInfo type. This
@@ -1126,4 +1103,4 @@ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is T
1126
1103
  */
1127
1104
  declare type RoomInfo = RoomData;
1128
1105
 
1129
- export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };
1106
+ export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CustomNotificationEvent, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var _core = require('@liveblocks/core');
3
3
 
4
4
  // src/version.ts
5
5
  var PKG_NAME = "@liveblocks/node";
6
- var PKG_VERSION = "2.9.2-emails1";
6
+ var PKG_VERSION = "2.9.3-composer1";
7
7
  var PKG_FORMAT = "cjs";
8
8
 
9
9
  // src/client.ts
@@ -22,6 +22,7 @@ var PKG_FORMAT = "cjs";
22
22
 
23
23
  // src/utils.ts
24
24
  var DEFAULT_BASE_URL = "https://api.liveblocks.io";
25
+ var VALID_KEY_CHARS_REGEX = /^[\w-]+$/;
25
26
  function getBaseUrl(baseUrl) {
26
27
  if (typeof baseUrl === "string" && baseUrl.startsWith("http")) {
27
28
  return baseUrl;
@@ -32,20 +33,31 @@ function getBaseUrl(baseUrl) {
32
33
  async function fetchPolyfill() {
33
34
  return typeof globalThis.fetch !== "undefined" ? globalThis.fetch : (await Promise.resolve().then(() => _interopRequireWildcard(require("node-fetch")))).default;
34
35
  }
36
+ function isString(value) {
37
+ return typeof value === "string";
38
+ }
39
+ function startsWith(value, prefix) {
40
+ return isString(value) && value.startsWith(prefix);
41
+ }
35
42
  function isNonEmpty(value) {
36
- return typeof value === "string" && value.length > 0;
43
+ return isString(value) && value.length > 0;
37
44
  }
38
45
  function assertNonEmpty(value, field) {
39
46
  if (!isNonEmpty(value)) {
40
47
  throw new Error(
41
- `Invalid value for field "${field}". Please provide a non-empty string. For more information: https://liveblocks.io/docs/api-reference/liveblocks-node#authorize`
48
+ `Invalid value for field '${field}'. Please provide a non-empty string. For more information: https://liveblocks.io/docs/api-reference/liveblocks-node#authorize`
42
49
  );
43
50
  }
44
51
  }
45
52
  function assertSecretKey(value, field) {
46
- if (!isNonEmpty(value) || !value.startsWith("sk_")) {
53
+ if (!startsWith(value, "sk_")) {
54
+ throw new Error(
55
+ `Invalid value for field '${field}'. Secret keys must start with 'sk_'. Please provide the secret key from your Liveblocks dashboard at https://liveblocks.io/dashboard/apikeys.`
56
+ );
57
+ }
58
+ if (!VALID_KEY_CHARS_REGEX.test(value)) {
47
59
  throw new Error(
48
- `Invalid value for field "${field}". Secret keys must start with "sk_". Please provide the secret key from your Liveblocks dashboard at https://liveblocks.io/dashboard/apikeys.`
60
+ `Invalid chars found in field '${field}'. Please check that you correctly copied the secret key from your Liveblocks dashboard at https://liveblocks.io/dashboard/apikeys.`
49
61
  );
50
62
  }
51
63
  }
@@ -1328,12 +1340,6 @@ _WebhookHandler.secretPrefix = "whsec_";
1328
1340
  var WebhookHandler = _WebhookHandler;
1329
1341
  var WEBHOOK_TOLERANCE_IN_SECONDS = 5 * 60;
1330
1342
  var isNotUndefined = (value) => value !== void 0;
1331
- function isThreadNotificationEvent(event) {
1332
- return event.type === "notification" && event.data.kind === "thread";
1333
- }
1334
- function isTextMentionNotificationEvent(event) {
1335
- return event.type === "notification" && event.data.kind === "textMention";
1336
- }
1337
1343
 
1338
1344
  // src/index.ts
1339
1345
 
@@ -1347,7 +1353,5 @@ _core.detectDupes.call(void 0, PKG_NAME, PKG_VERSION, PKG_FORMAT);
1347
1353
 
1348
1354
 
1349
1355
 
1350
-
1351
-
1352
- exports.Liveblocks = Liveblocks; exports.LiveblocksError = LiveblocksError; exports.WebhookHandler = WebhookHandler; exports.getMentionedIdsFromCommentBody = _core.getMentionedIdsFromCommentBody; exports.isTextMentionNotificationEvent = isTextMentionNotificationEvent; exports.isThreadNotificationEvent = isThreadNotificationEvent; exports.stringifyCommentBody = _core.stringifyCommentBody;
1356
+ exports.Liveblocks = Liveblocks; exports.LiveblocksError = LiveblocksError; exports.WebhookHandler = WebhookHandler; exports.getMentionedIdsFromCommentBody = _core.getMentionedIdsFromCommentBody; exports.stringifyCommentBody = _core.stringifyCommentBody;
1353
1357
  //# sourceMappingURL=index.js.map