@liveblocks/core 2.18.4-uns1 → 2.19.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.
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ var __export = (target, all) => {
6
6
 
7
7
  // src/version.ts
8
8
  var PKG_NAME = "@liveblocks/core";
9
- var PKG_VERSION = "2.18.4-uns1";
9
+ var PKG_VERSION = "2.19.0";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -187,12 +187,6 @@ function keys(obj) {
187
187
  function values(obj) {
188
188
  return Object.values(obj);
189
189
  }
190
- function create(obj, descriptors) {
191
- if (typeof descriptors !== "undefined") {
192
- return Object.create(obj, descriptors);
193
- }
194
- return Object.create(obj);
195
- }
196
190
  function mapValues(obj, mapFn) {
197
191
  const result = {};
198
192
  for (const pair of Object.entries(obj)) {
@@ -3603,72 +3597,6 @@ function unlinkDevTools(roomId) {
3603
3597
  });
3604
3598
  }
3605
3599
 
3606
- // src/protocol/UserNotificationSettings.ts
3607
- var kPrivate = Symbol("user-notification-settings-private");
3608
- function createUserNotificationSettings(plain) {
3609
- const channels = [
3610
- "email",
3611
- "slack",
3612
- "teams",
3613
- "webPush"
3614
- ];
3615
- const descriptors = {
3616
- [kPrivate]: {
3617
- value: {
3618
- __plain__: plain
3619
- },
3620
- enumerable: false
3621
- }
3622
- };
3623
- for (const channel of channels) {
3624
- descriptors[channel] = {
3625
- enumerable: true,
3626
- /**
3627
- * In the TypeScript standard library definitions, the built-in interface for a property descriptor
3628
- * does not include a specialized type for the “this” context in the getter or setter functions.
3629
- * As a result, both the ⁠get and ⁠set methods implicitly have ⁠this: any.
3630
- * The reason is that property descriptors in JavaScript are used across various objects with
3631
- * no enforced shape for ⁠this. And so the standard library definitions have to remain as broad as possible
3632
- * to support any valid JavaScript usage (e.g `Object.defineProperty`).
3633
- *
3634
- * So we can safely tells that this getter is typed as `this: UserNotificationSettings` because we're
3635
- * creating a well known shaped object → `UserNotificationSettings`.
3636
- */
3637
- get() {
3638
- const value = this[kPrivate].__plain__[channel];
3639
- if (!value) {
3640
- raise(
3641
- `In order to use the '${channel}' channel, please set up your project first. See <link to docs>`
3642
- );
3643
- }
3644
- return value;
3645
- }
3646
- };
3647
- }
3648
- return create(null, descriptors);
3649
- }
3650
- function patchUserNotificationSettings(existing, patch) {
3651
- const outcoming = createUserNotificationSettings({
3652
- ...existing[kPrivate].__plain__
3653
- });
3654
- for (const channel of keys(patch)) {
3655
- const updates = patch[channel];
3656
- if (updates !== void 0) {
3657
- const kindUpdates = Object.fromEntries(
3658
- entries(updates).filter(([, value]) => value !== void 0)
3659
- );
3660
- outcoming[kPrivate].__plain__[channel] = {
3661
- ...outcoming[kPrivate].__plain__[channel],
3662
- ...kindUpdates
3663
- };
3664
- }
3665
- }
3666
- return outcoming;
3667
- }
3668
- function isNotificationChannelEnabled(settings) {
3669
- return values(settings).every((enabled) => enabled === true);
3670
- }
3671
-
3672
3600
  // src/lib/position.ts
3673
3601
  var MIN_CODE = 32;
3674
3602
  var MAX_CODE = 126;
@@ -8261,16 +8189,6 @@ function createClient(options) {
8261
8189
  const win = typeof window !== "undefined" ? window : void 0;
8262
8190
  _optionalChain([win, 'optionalAccess', _184 => _184.addEventListener, 'call', _185 => _185("beforeunload", maybePreventClose)]);
8263
8191
  }
8264
- async function getNotificationSettings(options2) {
8265
- const plainSettings = await httpClient.getUserNotificationSettings(options2);
8266
- const settings = createUserNotificationSettings(plainSettings);
8267
- return settings;
8268
- }
8269
- async function updateNotificationSettings(settings) {
8270
- const plainSettings = await httpClient.updateUserNotificationSettings(settings);
8271
- const settingsObject = createUserNotificationSettings(plainSettings);
8272
- return settingsObject;
8273
- }
8274
8192
  const client = Object.defineProperty(
8275
8193
  {
8276
8194
  enterRoom,
@@ -8284,9 +8202,9 @@ function createClient(options) {
8284
8202
  markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
8285
8203
  deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
8286
8204
  deleteInboxNotification: httpClient.deleteInboxNotification,
8287
- // Public user notification settings API
8288
- getNotificationSettings,
8289
- updateNotificationSettings,
8205
+ // Public channel notification settings API
8206
+ getNotificationSettings: httpClient.getUserNotificationSettings,
8207
+ updateNotificationSettings: httpClient.updateUserNotificationSettings,
8290
8208
  // Advanced resolvers APIs
8291
8209
  resolvers: {
8292
8210
  invalidateUsers: invalidateResolvedUsers,
@@ -9276,6 +9194,11 @@ var SortedList = class _SortedList {
9276
9194
  }
9277
9195
  };
9278
9196
 
9197
+ // src/protocol/UserNotificationSettings.ts
9198
+ function isNotificationChannelEnabled(settings) {
9199
+ return values(settings).every((enabled) => enabled === true);
9200
+ }
9201
+
9279
9202
  // src/types/Others.ts
9280
9203
  var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
9281
9204
  TextEditorType2["Lexical"] = "lexical";
@@ -9376,7 +9299,5 @@ var NotificationsApiError = HttpError;
9376
9299
 
9377
9300
 
9378
9301
 
9379
-
9380
-
9381
- exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.createUserNotificationSettings = createUserNotificationSettings; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.patchUserNotificationSettings = patchUserNotificationSettings; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
9302
+ exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
9382
9303
  //# sourceMappingURL=index.cjs.map