edmaxlabs-core 2.6.7 → 2.6.9

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/dist/index.d.cts CHANGED
@@ -86,6 +86,7 @@ declare class Authentication {
86
86
  }) => Promise<Credentials | null>;
87
87
  deleteUser: () => Promise<void>;
88
88
  signOut: () => Promise<void>;
89
+ resetPassword: () => Promise<string>;
89
90
  rules: (path: string, context: Record<string, any>) => Promise<{
90
91
  success: boolean;
91
92
  allowed: any;
package/dist/index.d.ts CHANGED
@@ -86,6 +86,7 @@ declare class Authentication {
86
86
  }) => Promise<Credentials | null>;
87
87
  deleteUser: () => Promise<void>;
88
88
  signOut: () => Promise<void>;
89
+ resetPassword: () => Promise<string>;
89
90
  rules: (path: string, context: Record<string, any>) => Promise<{
90
91
  success: boolean;
91
92
  allowed: any;
package/dist/index.mjs CHANGED
@@ -201,6 +201,20 @@ var _Authentication = class _Authentication {
201
201
  });
202
202
  return;
203
203
  };
204
+ this.resetPassword = async () => {
205
+ const app = this.app?.getDatabase;
206
+ const luid = this.currentUser();
207
+ const payload = {
208
+ uid: luid?.uid,
209
+ ttl: 3
210
+ //minutes
211
+ };
212
+ const id = await app?.collection("_auth_tokens").add(payload);
213
+ if (id) {
214
+ return `https://auth.edmaxlabs.com/reset/${id}`;
215
+ }
216
+ throw new Error("Failed to request reset tokens. Try Again");
217
+ };
204
218
  this.rules = async (path, context) => {
205
219
  const res = await new HttpsRequest({
206
220
  method: "POST" /* POST */,
@@ -837,7 +851,6 @@ var Query = class {
837
851
  return [];
838
852
  }
839
853
  const snapshots = res.documents.map((d) => {
840
- delete d.token;
841
854
  d.id = d.id ?? d._id;
842
855
  delete d._id;
843
856
  return DocumentSnapshot.fromMap(d);
@@ -1086,7 +1099,6 @@ var CollectionRef = class {
1086
1099
  return [];
1087
1100
  }
1088
1101
  return res.documents.map((d) => {
1089
- delete d.token;
1090
1102
  d.id = d.id ?? d._id;
1091
1103
  delete d._id;
1092
1104
  return DocumentSnapshot.fromMap(d);