@liveblocks/node
Advanced tools
Comparing version 1.12.0-test1 to 1.12.0-test2
@@ -1,2 +0,2 @@ | ||
import { IUserInfo, Json, PlainLsonObject, JsonObject, ThreadData, BaseMetadata, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings } from '@liveblocks/core'; | ||
import { IUserInfo, Json, PlainLsonObject, JsonObject, BaseMetadata, QueryMetadata, ThreadData, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, ActivityData } from '@liveblocks/core'; | ||
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, stringifyCommentBody } from '@liveblocks/core'; | ||
@@ -178,2 +178,3 @@ import { IncomingHttpHeaders } from 'http'; | ||
declare type RoomMetadata = Record<string, string | string[]>; | ||
declare type QueryRoomMetadata = Record<string, string>; | ||
declare type RoomInfo = { | ||
@@ -270,2 +271,3 @@ type: "room"; | ||
* @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used. | ||
* @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID. | ||
* @returns A list of rooms. | ||
@@ -276,5 +278,36 @@ */ | ||
startingAfter?: string; | ||
metadata?: RoomMetadata; | ||
/** | ||
* @deprecated Use `query` instead. | ||
*/ | ||
metadata?: QueryRoomMetadata; | ||
userId?: string; | ||
groupIds?: string[]; | ||
/** | ||
* The query to filter rooms by. It is based on our query language. | ||
* @example | ||
* ``` | ||
* { | ||
* query: 'metadata["status"]:"open" AND roomId^"liveblocks:"' | ||
* } | ||
* ``` | ||
* @example | ||
* ``` | ||
* { | ||
* query: { | ||
* metadata: { | ||
* status: "open", | ||
* }, | ||
* roomId: { | ||
* startsWith: "liveblocks:" | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
query?: string | { | ||
metadata?: QueryRoomMetadata; | ||
roomId?: { | ||
startsWith: string; | ||
}; | ||
}; | ||
}): Promise<{ | ||
@@ -462,6 +495,35 @@ nextPage: string | null; | ||
* @param params.roomId The room ID to get the threads from. | ||
* @param params.query The query to filter threads by. It is based on our query language and can filter by metadata. | ||
* @returns A list of threads. | ||
*/ | ||
getThreads(params: { | ||
getThreads<TThreadMetadata extends BaseMetadata>(params: { | ||
roomId: string; | ||
/** | ||
* The query to filter threads by. It is based on our query language. | ||
* | ||
* @example | ||
* ``` | ||
* { | ||
* query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['resolved']:false AND metadata['priority']:3" | ||
* } | ||
* ``` | ||
* @example | ||
* ``` | ||
* { | ||
* query: { | ||
* metadata: { | ||
* status: "open", | ||
* resolved: false, | ||
* priority: 3, | ||
* organization: { | ||
* startsWith: "liveblocks:" | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
query?: string | { | ||
metadata?: Partial<QueryMetadata<TThreadMetadata>>; | ||
}; | ||
}): Promise<{ | ||
@@ -681,2 +743,9 @@ data: ThreadData[]; | ||
}): Promise<RoomInfo>; | ||
triggerInboxNotification(params: { | ||
userId: string; | ||
kind: `$${string}`; | ||
roomId?: string; | ||
subjectId: string; | ||
activityData: ActivityData; | ||
}): Promise<void>; | ||
} | ||
@@ -895,2 +964,7 @@ declare class LiveblocksError extends Error { | ||
roomId: string; | ||
/** | ||
* ISO 8601 datestring | ||
* @example "2021-03-01T12:00:00.000Z" | ||
*/ | ||
updatedAt: string; | ||
}; | ||
@@ -897,0 +971,0 @@ }; |
@@ -6,3 +6,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts | ||
var PKG_NAME = "@liveblocks/node"; | ||
var PKG_VERSION = "1.12.0-test1"; | ||
var PKG_VERSION = "1.12.0-test2"; | ||
var PKG_FORMAT = "cjs"; | ||
@@ -13,3 +13,2 @@ | ||
function getBaseUrl(baseUrl) { | ||
baseUrl || (baseUrl = process.env.LIVEBLOCKS_BASE_URL || process.env.NEXT_PUBLIC_LIVEBLOCKS_BASE_URL || process.env.VITE_LIVEBLOCKS_BASE_URL || void 0); | ||
if (typeof baseUrl === "string" && baseUrl.startsWith("http")) { | ||
@@ -122,2 +121,3 @@ return baseUrl; | ||
// src/Session.ts | ||
@@ -413,2 +413,3 @@ var ALL_PERMISSIONS = Object.freeze([ | ||
* @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used. | ||
* @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID. | ||
* @returns A list of rooms. | ||
@@ -418,2 +419,8 @@ */ | ||
const path = url`/v2/rooms`; | ||
let query; | ||
if (typeof params.query === "string") { | ||
query = params.query; | ||
} else if (typeof params.query === "object") { | ||
query = _core.objectToQuery.call(void 0, params.query); | ||
} | ||
const queryParams = { | ||
@@ -426,7 +433,8 @@ limit: params.limit, | ||
...Object.fromEntries( | ||
Object.entries(_nullishCoalesce(params.metadata, () => ( {}))).map(([key, val]) => { | ||
const value = Array.isArray(val) ? val.join(",") : val; | ||
return [`metadata.${key}`, value]; | ||
}) | ||
) | ||
Object.entries(_nullishCoalesce(params.metadata, () => ( {}))).map(([key, val]) => [ | ||
`metadata.${key}`, | ||
val | ||
]) | ||
), | ||
query | ||
}; | ||
@@ -802,2 +810,3 @@ const res = await this.get(path, queryParams); | ||
* @param params.roomId The room ID to get the threads from. | ||
* @param params.query The query to filter threads by. It is based on our query language and can filter by metadata. | ||
* @returns A list of threads. | ||
@@ -807,3 +816,11 @@ */ | ||
const { roomId } = params; | ||
const res = await this.get(url`/v2/rooms/${roomId}/threads`); | ||
let query; | ||
if (typeof params.query === "string") { | ||
query = params.query; | ||
} else if (typeof params.query === "object") { | ||
query = _core.objectToQuery.call(void 0, params.query); | ||
} | ||
const res = await this.get(url`/v2/rooms/${roomId}/threads`, { | ||
query | ||
}); | ||
if (!res.ok) { | ||
@@ -1132,2 +1149,9 @@ const text = await res.text(); | ||
} | ||
async triggerInboxNotification(params) { | ||
const res = await this.post(url`/v2/inbox-notifications/trigger`, params); | ||
if (!res.ok) { | ||
const text = await res.text(); | ||
throw new LiveblocksError(res.status, text); | ||
} | ||
} | ||
}; | ||
@@ -1134,0 +1158,0 @@ var LiveblocksError = class extends Error { |
{ | ||
"name": "@liveblocks/node", | ||
"version": "1.12.0-test1", | ||
"version": "1.12.0-test2", | ||
"description": "A server-side utility that lets you set up a Liveblocks authentication endpoint. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.", | ||
@@ -36,3 +36,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@liveblocks/core": "1.12.0-test1", | ||
"@liveblocks/core": "1.12.0-test2", | ||
"@stablelib/base64": "^1.0.1", | ||
@@ -39,0 +39,0 @@ "fast-sha256": "^1.3.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 3 instances in 1 package
381325
3561
0
+ Added@liveblocks/core@1.12.0-test2(transitive)
- Removed@liveblocks/core@1.12.0-test1(transitive)