@liveblocks/core 2.18.4-uns2 → 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 +10 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -73
- package/dist/index.d.ts +9 -73
- package/dist/index.js +9 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.
|
|
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,73 +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 (typeof value === "undefined") {
|
|
3640
|
-
error2(
|
|
3641
|
-
`In order to use the '${channel}' channel, please set up your project first. For more information https://liveblocks.io/docs/errors/enable-a-notification-channel`
|
|
3642
|
-
);
|
|
3643
|
-
return null;
|
|
3644
|
-
}
|
|
3645
|
-
return value;
|
|
3646
|
-
}
|
|
3647
|
-
};
|
|
3648
|
-
}
|
|
3649
|
-
return create(null, descriptors);
|
|
3650
|
-
}
|
|
3651
|
-
function patchUserNotificationSettings(existing, patch) {
|
|
3652
|
-
const outcoming = createUserNotificationSettings({
|
|
3653
|
-
...existing[kPrivate].__plain__
|
|
3654
|
-
});
|
|
3655
|
-
for (const channel of keys(patch)) {
|
|
3656
|
-
const updates = patch[channel];
|
|
3657
|
-
if (updates !== void 0) {
|
|
3658
|
-
const kindUpdates = Object.fromEntries(
|
|
3659
|
-
entries(updates).filter(([, value]) => value !== void 0)
|
|
3660
|
-
);
|
|
3661
|
-
outcoming[kPrivate].__plain__[channel] = {
|
|
3662
|
-
...outcoming[kPrivate].__plain__[channel],
|
|
3663
|
-
...kindUpdates
|
|
3664
|
-
};
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
return outcoming;
|
|
3668
|
-
}
|
|
3669
|
-
function isNotificationChannelEnabled(settings) {
|
|
3670
|
-
return settings !== null ? values(settings).every((enabled) => enabled === true) : false;
|
|
3671
|
-
}
|
|
3672
|
-
|
|
3673
3600
|
// src/lib/position.ts
|
|
3674
3601
|
var MIN_CODE = 32;
|
|
3675
3602
|
var MAX_CODE = 126;
|
|
@@ -8262,16 +8189,6 @@ function createClient(options) {
|
|
|
8262
8189
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
8263
8190
|
_optionalChain([win, 'optionalAccess', _184 => _184.addEventListener, 'call', _185 => _185("beforeunload", maybePreventClose)]);
|
|
8264
8191
|
}
|
|
8265
|
-
async function getNotificationSettings(options2) {
|
|
8266
|
-
const plainSettings = await httpClient.getUserNotificationSettings(options2);
|
|
8267
|
-
const settings = createUserNotificationSettings(plainSettings);
|
|
8268
|
-
return settings;
|
|
8269
|
-
}
|
|
8270
|
-
async function updateNotificationSettings(settings) {
|
|
8271
|
-
const plainSettings = await httpClient.updateUserNotificationSettings(settings);
|
|
8272
|
-
const settingsObject = createUserNotificationSettings(plainSettings);
|
|
8273
|
-
return settingsObject;
|
|
8274
|
-
}
|
|
8275
8192
|
const client = Object.defineProperty(
|
|
8276
8193
|
{
|
|
8277
8194
|
enterRoom,
|
|
@@ -8285,9 +8202,9 @@ function createClient(options) {
|
|
|
8285
8202
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
8286
8203
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
8287
8204
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
8288
|
-
// Public
|
|
8289
|
-
getNotificationSettings,
|
|
8290
|
-
updateNotificationSettings,
|
|
8205
|
+
// Public channel notification settings API
|
|
8206
|
+
getNotificationSettings: httpClient.getUserNotificationSettings,
|
|
8207
|
+
updateNotificationSettings: httpClient.updateUserNotificationSettings,
|
|
8291
8208
|
// Advanced resolvers APIs
|
|
8292
8209
|
resolvers: {
|
|
8293
8210
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -9277,6 +9194,11 @@ var SortedList = class _SortedList {
|
|
|
9277
9194
|
}
|
|
9278
9195
|
};
|
|
9279
9196
|
|
|
9197
|
+
// src/protocol/UserNotificationSettings.ts
|
|
9198
|
+
function isNotificationChannelEnabled(settings) {
|
|
9199
|
+
return values(settings).every((enabled) => enabled === true);
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9280
9202
|
// src/types/Others.ts
|
|
9281
9203
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
9282
9204
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -9377,7 +9299,5 @@ var NotificationsApiError = HttpError;
|
|
|
9377
9299
|
|
|
9378
9300
|
|
|
9379
9301
|
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
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;
|
|
9383
9303
|
//# sourceMappingURL=index.cjs.map
|