@temboplus/afloat 0.1.55 → 0.1.56

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.
@@ -25,9 +25,6 @@ export declare class User {
25
25
  token: string;
26
26
  /**
27
27
  * Indicates whether the user is required to change their default password.
28
- *
29
- * Afloat users are initially provided with a default username and password. After the first
30
- * successful login, `resetPassword` will be set to `true` to prompt the user to set a new password.
31
28
  */
32
29
  resetPassword: boolean;
33
30
  /**
@@ -49,28 +46,37 @@ export declare class User {
49
46
  * @returns `true` if the user has the specified permission, otherwise `false`.
50
47
  */
51
48
  can(permission: string): boolean;
49
+ /**
50
+ * Returns all permissions the user has.
51
+ *
52
+ * @returns An array of permission keys granted to the user.
53
+ */
54
+ getPermissions(): string[];
55
+ /**
56
+ * Returns a plain object representation of the user.
57
+ * Unlike `toJSON()`, this does not stringify the object.
58
+ *
59
+ * @returns An object representing the current User instance.
60
+ */
61
+ toObject(): Record<string, any>;
52
62
  /**
53
63
  * Serializes the `User` instance to a JSON string.
54
64
  *
55
- * @returns A JSON string representation of the `User` instance, including:
56
- * - `profile`: The user's profile information. (Requires profile.toJSON() method)
57
- * - `token`: The user's authentication token.
58
- * - `resetPassword`: Indicates whether the user must reset their password.
59
- * - `permissions`: An array of permission keys the user has.
65
+ * @returns A JSON string representation of the `User` instance.
60
66
  */
61
67
  toJSON(): string;
62
68
  /**
63
69
  * Creates a new `User` instance from a JSON string.
64
70
  *
65
71
  * @param jsonString - A JSON string containing user data.
66
- * @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
72
+ * @returns A `User` instance reconstructed from the JSON data, or `undefined` if invalid.
67
73
  */
68
74
  static fromJSON(jsonString: string): User | undefined;
69
75
  /**
70
76
  * Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
71
77
  *
72
- * @param data - The data object, JSON string, or object with Profile instance/object containing user information.
73
- * @returns A `User` instance, or undefined if data is invalid.
78
+ * @param data - The data object or stringified JSON containing user information.
79
+ * @returns A `User` instance, or `undefined` if the data is invalid or incomplete.
74
80
  */
75
81
  static from(data: any): User | undefined;
76
82
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "description": "A foundational library for Temboplus-Afloat projects.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",