@matrix-widget-toolkit/api 5.0.0 → 5.0.1

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.
@@ -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 { ROOM_VERSION_12_CREATOR, UserPowerLevelType } from './powerLevel';
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
  *
@@ -413,6 +413,12 @@ function compareOriginServerTS(a, b) {
413
413
  * This is a workaround to allow the room creator to always have the highest power level.
414
414
  */
415
415
  var ROOM_VERSION_12_CREATOR = 'ROOM_VERSION_12_CREATOR';
416
+ /**
417
+ * Compare a user's power level to a normal power level.
418
+ * @param userPowerLevel - The user's power level
419
+ * @param normalPowerLevel - The normal power level
420
+ * @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
421
+ */
416
422
  function compareUserPowerLevelToNormalPowerLevel(userPowerLevel, normalPowerLevel) {
417
423
  if (userPowerLevel === ROOM_VERSION_12_CREATOR) {
418
424
  // Room version 12 creator has the highest power level.
@@ -2017,6 +2023,7 @@ var WidgetApiImpl = /** @class */ (function () {
2017
2023
  }());
2018
2024
 
2019
2025
  exports.ROOM_EVENT_REDACTION = ROOM_EVENT_REDACTION;
2026
+ exports.ROOM_VERSION_12_CREATOR = ROOM_VERSION_12_CREATOR;
2020
2027
  exports.STATE_EVENT_CREATE = STATE_EVENT_CREATE;
2021
2028
  exports.STATE_EVENT_POWER_LEVELS = STATE_EVENT_POWER_LEVELS;
2022
2029
  exports.STATE_EVENT_ROOM_MEMBER = STATE_EVENT_ROOM_MEMBER;
@@ -2024,6 +2031,7 @@ exports.WIDGET_CAPABILITY_NAVIGATE = WIDGET_CAPABILITY_NAVIGATE;
2024
2031
  exports.WidgetApiImpl = WidgetApiImpl;
2025
2032
  exports.calculateUserPowerLevel = calculateUserPowerLevel;
2026
2033
  exports.compareOriginServerTS = compareOriginServerTS;
2034
+ exports.compareUserPowerLevelToNormalPowerLevel = compareUserPowerLevelToNormalPowerLevel;
2027
2035
  exports.extractRawWidgetParameters = extractRawWidgetParameters;
2028
2036
  exports.extractWidgetApiParameters = extractWidgetApiParameters;
2029
2037
  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 { ROOM_VERSION_12_CREATOR, UserPowerLevelType } from './powerLevel';
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
  *
@@ -407,6 +407,12 @@ function compareOriginServerTS(a, b) {
407
407
  * This is a workaround to allow the room creator to always have the highest power level.
408
408
  */
409
409
  var ROOM_VERSION_12_CREATOR = 'ROOM_VERSION_12_CREATOR';
410
+ /**
411
+ * Compare a user's power level to a normal power level.
412
+ * @param userPowerLevel - The user's power level
413
+ * @param normalPowerLevel - The normal power level
414
+ * @returns True if the user's power level is greater than or equal to the normal power level, false otherwise
415
+ */
410
416
  function compareUserPowerLevelToNormalPowerLevel(userPowerLevel, normalPowerLevel) {
411
417
  if (userPowerLevel === ROOM_VERSION_12_CREATOR) {
412
418
  // Room version 12 creator has the highest power level.
@@ -2010,4 +2016,4 @@ var WidgetApiImpl = /** @class */ (function () {
2010
2016
  return WidgetApiImpl;
2011
2017
  }());
2012
2018
 
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 };
2019
+ 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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matrix-widget-toolkit/api",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "A simplified layer on top of matrix-widget-api to use build widgets.",
5
5
  "author": "Nordeck IT + Consulting GmbH",
6
6
  "license": "Apache-2.0",