@matrix-widget-toolkit/api 5.0.0 → 5.0.2
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/build/cjs/api/extras/events.d.cts +1 -0
- package/build/cjs/api/extras/index.d.cts +2 -2
- package/build/cjs/api/extras/powerLevel.d.cts +7 -0
- package/build/cjs/index.cjs +10 -0
- package/build/esm/api/extras/events.d.ts +1 -0
- package/build/esm/api/extras/index.d.ts +2 -2
- package/build/esm/api/extras/powerLevel.d.ts +7 -0
- package/build/esm/index.js +9 -1
- package/build/index.d.ts +9 -0
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ export type { PowerLevelsActions, PowerLevelsStateEvent, StateEventCreateContent
|
|
|
5
5
|
export { WIDGET_CAPABILITY_NAVIGATE, navigateToRoom } from './navigateTo';
|
|
6
6
|
export type { NavigateToRoomOptions } from './navigateTo';
|
|
7
7
|
export { compareOriginServerTS } from './originServerTs';
|
|
8
|
-
export { STATE_EVENT_POWER_LEVELS, calculateUserPowerLevel, hasActionPower, hasRoomEventPower, hasStateEventPower, isValidPowerLevelStateEvent, } from './powerLevel';
|
|
9
|
-
export type {
|
|
8
|
+
export { ROOM_VERSION_12_CREATOR, STATE_EVENT_POWER_LEVELS, calculateUserPowerLevel, compareUserPowerLevelToNormalPowerLevel, hasActionPower, hasRoomEventPower, hasStateEventPower, isValidPowerLevelStateEvent, } from './powerLevel';
|
|
9
|
+
export type { UserPowerLevelType } from './powerLevel';
|
|
10
10
|
export { ROOM_EVENT_REDACTION, isValidRedactionEvent, observeRedactionEvents, redactEvent, } from './redactions';
|
|
11
11
|
export type { Redaction, RedactionRoomEvent } from './redactions';
|
|
12
12
|
export { getContent, getOriginalEventId, isValidEventWithRelatesTo, } from './relatesTo';
|
|
@@ -7,6 +7,13 @@ export { isValidPowerLevelStateEvent, STATE_EVENT_POWER_LEVELS, } from './events
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const ROOM_VERSION_12_CREATOR = "ROOM_VERSION_12_CREATOR";
|
|
9
9
|
export type UserPowerLevelType = number | typeof ROOM_VERSION_12_CREATOR;
|
|
10
|
+
/**
|
|
11
|
+
* Compare a user's power level to a normal power level.
|
|
12
|
+
* @param userPowerLevel - The user's power level
|
|
13
|
+
* @param normalPowerLevel - The normal power level
|
|
14
|
+
* @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
|
|
15
|
+
*/
|
|
16
|
+
export declare function compareUserPowerLevelToNormalPowerLevel(userPowerLevel: UserPowerLevelType, normalPowerLevel: number): boolean;
|
|
10
17
|
/**
|
|
11
18
|
* Check if a user has the power to send a specific room event.
|
|
12
19
|
*
|
package/build/cjs/index.cjs
CHANGED
|
@@ -224,6 +224,8 @@ var createEventSchema = Joi__default.default.object(__assign$2(__assign$2({}, ev
|
|
|
224
224
|
creator: Joi__default.default.string().optional(),
|
|
225
225
|
// Room version 12 introduces the additional_creators field.
|
|
226
226
|
additional_creators: Joi__default.default.array().items(Joi__default.default.string()).optional(),
|
|
227
|
+
// Optional room type
|
|
228
|
+
type: Joi__default.default.string().optional(),
|
|
227
229
|
})
|
|
228
230
|
.unknown()
|
|
229
231
|
.required() })).unknown();
|
|
@@ -413,6 +415,12 @@ function compareOriginServerTS(a, b) {
|
|
|
413
415
|
* This is a workaround to allow the room creator to always have the highest power level.
|
|
414
416
|
*/
|
|
415
417
|
var ROOM_VERSION_12_CREATOR = 'ROOM_VERSION_12_CREATOR';
|
|
418
|
+
/**
|
|
419
|
+
* Compare a user's power level to a normal power level.
|
|
420
|
+
* @param userPowerLevel - The user's power level
|
|
421
|
+
* @param normalPowerLevel - The normal power level
|
|
422
|
+
* @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
|
|
423
|
+
*/
|
|
416
424
|
function compareUserPowerLevelToNormalPowerLevel(userPowerLevel, normalPowerLevel) {
|
|
417
425
|
if (userPowerLevel === ROOM_VERSION_12_CREATOR) {
|
|
418
426
|
// Room version 12 creator has the highest power level.
|
|
@@ -2017,6 +2025,7 @@ var WidgetApiImpl = /** @class */ (function () {
|
|
|
2017
2025
|
}());
|
|
2018
2026
|
|
|
2019
2027
|
exports.ROOM_EVENT_REDACTION = ROOM_EVENT_REDACTION;
|
|
2028
|
+
exports.ROOM_VERSION_12_CREATOR = ROOM_VERSION_12_CREATOR;
|
|
2020
2029
|
exports.STATE_EVENT_CREATE = STATE_EVENT_CREATE;
|
|
2021
2030
|
exports.STATE_EVENT_POWER_LEVELS = STATE_EVENT_POWER_LEVELS;
|
|
2022
2031
|
exports.STATE_EVENT_ROOM_MEMBER = STATE_EVENT_ROOM_MEMBER;
|
|
@@ -2024,6 +2033,7 @@ exports.WIDGET_CAPABILITY_NAVIGATE = WIDGET_CAPABILITY_NAVIGATE;
|
|
|
2024
2033
|
exports.WidgetApiImpl = WidgetApiImpl;
|
|
2025
2034
|
exports.calculateUserPowerLevel = calculateUserPowerLevel;
|
|
2026
2035
|
exports.compareOriginServerTS = compareOriginServerTS;
|
|
2036
|
+
exports.compareUserPowerLevelToNormalPowerLevel = compareUserPowerLevelToNormalPowerLevel;
|
|
2027
2037
|
exports.extractRawWidgetParameters = extractRawWidgetParameters;
|
|
2028
2038
|
exports.extractWidgetApiParameters = extractWidgetApiParameters;
|
|
2029
2039
|
exports.extractWidgetParameters = extractWidgetParameters;
|
|
@@ -5,8 +5,8 @@ export type { PowerLevelsActions, PowerLevelsStateEvent, StateEventCreateContent
|
|
|
5
5
|
export { WIDGET_CAPABILITY_NAVIGATE, navigateToRoom } from './navigateTo';
|
|
6
6
|
export type { NavigateToRoomOptions } from './navigateTo';
|
|
7
7
|
export { compareOriginServerTS } from './originServerTs';
|
|
8
|
-
export { STATE_EVENT_POWER_LEVELS, calculateUserPowerLevel, hasActionPower, hasRoomEventPower, hasStateEventPower, isValidPowerLevelStateEvent, } from './powerLevel';
|
|
9
|
-
export type {
|
|
8
|
+
export { ROOM_VERSION_12_CREATOR, STATE_EVENT_POWER_LEVELS, calculateUserPowerLevel, compareUserPowerLevelToNormalPowerLevel, hasActionPower, hasRoomEventPower, hasStateEventPower, isValidPowerLevelStateEvent, } from './powerLevel';
|
|
9
|
+
export type { UserPowerLevelType } from './powerLevel';
|
|
10
10
|
export { ROOM_EVENT_REDACTION, isValidRedactionEvent, observeRedactionEvents, redactEvent, } from './redactions';
|
|
11
11
|
export type { Redaction, RedactionRoomEvent } from './redactions';
|
|
12
12
|
export { getContent, getOriginalEventId, isValidEventWithRelatesTo, } from './relatesTo';
|
|
@@ -7,6 +7,13 @@ export { isValidPowerLevelStateEvent, STATE_EVENT_POWER_LEVELS, } from './events
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const ROOM_VERSION_12_CREATOR = "ROOM_VERSION_12_CREATOR";
|
|
9
9
|
export type UserPowerLevelType = number | typeof ROOM_VERSION_12_CREATOR;
|
|
10
|
+
/**
|
|
11
|
+
* Compare a user's power level to a normal power level.
|
|
12
|
+
* @param userPowerLevel - The user's power level
|
|
13
|
+
* @param normalPowerLevel - The normal power level
|
|
14
|
+
* @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
|
|
15
|
+
*/
|
|
16
|
+
export declare function compareUserPowerLevelToNormalPowerLevel(userPowerLevel: UserPowerLevelType, normalPowerLevel: number): boolean;
|
|
10
17
|
/**
|
|
11
18
|
* Check if a user has the power to send a specific room event.
|
|
12
19
|
*
|
package/build/esm/index.js
CHANGED
|
@@ -218,6 +218,8 @@ var createEventSchema = Joi.object(__assign$2(__assign$2({}, eventSchemaBasicPro
|
|
|
218
218
|
creator: Joi.string().optional(),
|
|
219
219
|
// Room version 12 introduces the additional_creators field.
|
|
220
220
|
additional_creators: Joi.array().items(Joi.string()).optional(),
|
|
221
|
+
// Optional room type
|
|
222
|
+
type: Joi.string().optional(),
|
|
221
223
|
})
|
|
222
224
|
.unknown()
|
|
223
225
|
.required() })).unknown();
|
|
@@ -407,6 +409,12 @@ function compareOriginServerTS(a, b) {
|
|
|
407
409
|
* This is a workaround to allow the room creator to always have the highest power level.
|
|
408
410
|
*/
|
|
409
411
|
var ROOM_VERSION_12_CREATOR = 'ROOM_VERSION_12_CREATOR';
|
|
412
|
+
/**
|
|
413
|
+
* Compare a user's power level to a normal power level.
|
|
414
|
+
* @param userPowerLevel - The user's power level
|
|
415
|
+
* @param normalPowerLevel - The normal power level
|
|
416
|
+
* @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
|
|
417
|
+
*/
|
|
410
418
|
function compareUserPowerLevelToNormalPowerLevel(userPowerLevel, normalPowerLevel) {
|
|
411
419
|
if (userPowerLevel === ROOM_VERSION_12_CREATOR) {
|
|
412
420
|
// Room version 12 creator has the highest power level.
|
|
@@ -2010,4 +2018,4 @@ var WidgetApiImpl = /** @class */ (function () {
|
|
|
2010
2018
|
return WidgetApiImpl;
|
|
2011
2019
|
}());
|
|
2012
2020
|
|
|
2013
|
-
export { ROOM_EVENT_REDACTION, STATE_EVENT_CREATE, STATE_EVENT_POWER_LEVELS, STATE_EVENT_ROOM_MEMBER, WIDGET_CAPABILITY_NAVIGATE, WidgetApiImpl, WidgetParameter, calculateUserPowerLevel, compareOriginServerTS, extractRawWidgetParameters, extractWidgetApiParameters, extractWidgetParameters, generateRoomTimelineCapabilities, generateWidgetRegistrationUrl, getContent, getOriginalEventId, getRoomMemberDisplayName, hasActionPower, hasRoomEventPower, hasStateEventPower, hasWidgetParameters, isRoomEvent, isStateEvent, isValidCreateEventSchema, isValidEventWithRelatesTo, isValidPowerLevelStateEvent, isValidRedactionEvent, isValidRoomEvent, isValidRoomMemberStateEvent, isValidStateEvent as isValidStateEVent, isValidToDeviceMessageEvent, makeEventFromSendStateEventResult, navigateToRoom, observeRedactionEvents, parseWidgetId, redactEvent, repairWidgetRegistration, sendStateEventWithEventResult };
|
|
2021
|
+
export { ROOM_EVENT_REDACTION, ROOM_VERSION_12_CREATOR, STATE_EVENT_CREATE, STATE_EVENT_POWER_LEVELS, STATE_EVENT_ROOM_MEMBER, WIDGET_CAPABILITY_NAVIGATE, WidgetApiImpl, WidgetParameter, calculateUserPowerLevel, compareOriginServerTS, compareUserPowerLevelToNormalPowerLevel, extractRawWidgetParameters, extractWidgetApiParameters, extractWidgetParameters, generateRoomTimelineCapabilities, generateWidgetRegistrationUrl, getContent, getOriginalEventId, getRoomMemberDisplayName, hasActionPower, hasRoomEventPower, hasStateEventPower, hasWidgetParameters, isRoomEvent, isStateEvent, isValidCreateEventSchema, isValidEventWithRelatesTo, isValidPowerLevelStateEvent, isValidRedactionEvent, isValidRoomEvent, isValidRoomMemberStateEvent, isValidStateEvent as isValidStateEVent, isValidToDeviceMessageEvent, makeEventFromSendStateEventResult, navigateToRoom, observeRedactionEvents, parseWidgetId, redactEvent, repairWidgetRegistration, sendStateEventWithEventResult };
|
package/build/index.d.ts
CHANGED
|
@@ -47,6 +47,14 @@ export declare function calculateUserPowerLevel(powerLevelStateEvent: PowerLevel
|
|
|
47
47
|
*/
|
|
48
48
|
export declare function compareOriginServerTS<T>(a: RoomEvent<T>, b: RoomEvent<T>): number;
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Compare a user's power level to a normal power level.
|
|
52
|
+
* @param userPowerLevel - The user's power level
|
|
53
|
+
* @param normalPowerLevel - The normal power level
|
|
54
|
+
* @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
|
|
55
|
+
*/
|
|
56
|
+
export declare function compareUserPowerLevelToNormalPowerLevel(userPowerLevel: UserPowerLevelType, normalPowerLevel: number): boolean;
|
|
57
|
+
|
|
50
58
|
/**
|
|
51
59
|
* Content of a room event that relates to another event.
|
|
52
60
|
*/
|
|
@@ -469,6 +477,7 @@ export declare type StateEventCreateContent = {
|
|
|
469
477
|
room_version?: string;
|
|
470
478
|
creator?: string;
|
|
471
479
|
additional_creators?: string[];
|
|
480
|
+
type?: string;
|
|
472
481
|
};
|
|
473
482
|
|
|
474
483
|
/**
|
package/package.json
CHANGED