-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
282 additions
and
13 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
packages/apps-engine/deno-runtime/handlers/app/handleOnUpdate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import type { App } from '@rocket.chat/apps-engine/definition/App.ts'; | ||
|
||
import { AppObjectRegistry } from '../../AppObjectRegistry.ts'; | ||
import { AppAccessorsInstance } from '../../lib/accessors/mod.ts'; | ||
|
||
export default async function handleOnUpdate(params: unknown): Promise<boolean> { | ||
const app = AppObjectRegistry.get<App>('app'); | ||
|
||
if (typeof app?.onUpdate !== 'function') { | ||
throw new Error('App must contain an onUpdate function', { | ||
cause: 'invalid_app', | ||
}); | ||
} | ||
|
||
if (!Array.isArray(params)) { | ||
throw new Error('Invalid params', { cause: 'invalid_param_type' }); | ||
} | ||
|
||
const [context] = params as [Record<string, unknown>]; | ||
|
||
await app.onUpdate( | ||
context, | ||
AppAccessorsInstance.getReader(), | ||
AppAccessorsInstance.getHttp(), | ||
AppAccessorsInstance.getPersistence(), | ||
AppAccessorsInstance.getModifier(), | ||
); | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/apps-engine/src/definition/accessors/IAppUpdateContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { IUser } from '../users'; | ||
|
||
export interface IAppUpdateContext { | ||
user?: IUser; | ||
oldAppVersion: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/apps-engine/src/definition/messages/IMessageRaw.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import type { IBlock, Block } from '@rocket.chat/ui-kit'; | ||
|
||
import type { IRoom } from '../rooms'; | ||
import type { IUserLookup } from '../users'; | ||
import type { IMessageAttachment } from './IMessageAttachment'; | ||
import type { IMessageFile } from './IMessageFile'; | ||
import type { IMessageReactions } from './IMessageReaction'; | ||
|
||
/** | ||
* The raw version of a message, without resolved information for relationship fields, i.e. | ||
* `room`, `sender` and `editor` are not the complete entity like they are in `IMessage` | ||
* | ||
* This is used in methods that fetch multiple messages at the same time, as resolving the relationship | ||
* fields require additional queries to the database and would hit the system's performance significantly. | ||
*/ | ||
export interface IMessageRaw { | ||
id: string; | ||
roomId: IRoom['id']; | ||
sender: IUserLookup; | ||
createdAt: Date; | ||
threadId?: string; | ||
text?: string; | ||
updatedAt?: Date; | ||
editor?: IUserLookup; | ||
editedAt?: Date; | ||
emoji?: string; | ||
avatarUrl?: string; | ||
alias?: string; | ||
file?: IMessageFile; | ||
attachments?: Array<IMessageAttachment>; | ||
reactions?: IMessageReactions; | ||
groupable?: boolean; | ||
parseUrls?: boolean; | ||
customFields?: { [key: string]: any }; | ||
blocks?: Array<IBlock | Block>; | ||
starred?: Array<{ _id: string }>; | ||
pinned?: boolean; | ||
pinnedAt?: Date; | ||
pinnedBy?: IUserLookup; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export interface IUserLookup { | ||
_id: string; | ||
username: string; | ||
name?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/apps-engine/src/definition/videoConfProviders/VideoConfData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import type { IGroupVideoConference, IVideoConference } from '../videoConferences/IVideoConference'; | ||
|
||
export type VideoConfData = Pick<IVideoConference, '_id' | 'type' | 'rid' | 'createdBy' | 'providerData'> & { title?: IGroupVideoConference['title'] }; | ||
export type VideoConfData = Pick<IVideoConference, '_id' | 'type' | 'rid' | 'createdBy' | 'providerData' | 'discussionRid'> & { | ||
title?: IGroupVideoConference['title']; | ||
}; | ||
|
||
export type VideoConfDataExtended = VideoConfData & Required<Pick<IVideoConference, 'url'>>; |
2 changes: 1 addition & 1 deletion
2
packages/apps-engine/src/definition/videoConferences/AppVideoConference.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type { IGroupVideoConference } from './IVideoConference'; | ||
|
||
// Type for video conferences being created by an app | ||
export type AppVideoConference = Pick<IGroupVideoConference, 'rid' | 'providerName' | 'providerData' | 'title'> & { | ||
export type AppVideoConference = Pick<IGroupVideoConference, 'rid' | 'providerName' | 'providerData' | 'title' | 'discussionRid'> & { | ||
createdBy: IGroupVideoConference['createdBy']['_id']; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.