@eeplatform/core 1.4.2 → 1.4.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @eeplatform/core
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 1ae128a: Revise verification indexing
8
+
3
9
  ## 1.4.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -20,9 +20,9 @@ type TVerification = {
20
20
  email: string;
21
21
  metadata?: TVerificationMetadata;
22
22
  status?: string;
23
- createdAt: string;
24
- updatedAt?: string | null;
25
- expireAt: string;
23
+ createdAt: string | Date;
24
+ updatedAt?: string | Date | null;
25
+ expireAt: string | Date;
26
26
  };
27
27
  declare class MVerification implements TVerification {
28
28
  _id?: ObjectId;
@@ -30,16 +30,14 @@ declare class MVerification implements TVerification {
30
30
  email: string;
31
31
  metadata?: TVerificationMetadata;
32
32
  status?: string;
33
- createdAt: string;
34
- updatedAt?: string | null;
35
- expireAt: string;
33
+ createdAt: string | Date;
34
+ updatedAt?: string | Date | null;
35
+ expireAt: string | Date;
36
36
  constructor(value: TVerification);
37
37
  }
38
38
 
39
39
  declare function useVerificationRepo(): {
40
- createIndex: () => Promise<void>;
41
- createTextIndex: () => Promise<void>;
42
- createUniqueIndex: () => Promise<void>;
40
+ createIndexes: () => Promise<void>;
43
41
  add: (value: TVerification, session?: ClientSession) => Promise<ObjectId>;
44
42
  getVerifications: ({ search, page, limit, sort, status, type, email, app, }?: {
45
43
  search?: string | undefined;
package/dist/index.js CHANGED
@@ -11512,6 +11512,24 @@ function useVerificationRepo() {
11512
11512
  });
11513
11513
  });
11514
11514
  }
11515
+ async function createIndexes() {
11516
+ try {
11517
+ await collection.createIndexes([
11518
+ { key: { email: 1 } },
11519
+ { key: { type: 1 } },
11520
+ { key: { status: 1 } },
11521
+ { key: { "metadata.org": 1 } },
11522
+ { key: { email: "text" } },
11523
+ {
11524
+ key: { expiredAt: 1 },
11525
+ expireAfterSeconds: 0,
11526
+ name: "ttl_expiredAt_index"
11527
+ }
11528
+ ]);
11529
+ } catch (error) {
11530
+ throw new import_nodejs_utils2.InternalServerError("Failed to create indexes.");
11531
+ }
11532
+ }
11515
11533
  async function createIndex() {
11516
11534
  try {
11517
11535
  await collection.createIndex([
@@ -11734,9 +11752,7 @@ function useVerificationRepo() {
11734
11752
  }
11735
11753
  }
11736
11754
  return {
11737
- createIndex,
11738
- createTextIndex,
11739
- createUniqueIndex,
11755
+ createIndexes,
11740
11756
  add,
11741
11757
  getVerifications,
11742
11758
  getById,
@@ -13121,7 +13137,7 @@ function useVerificationService() {
13121
13137
  type: "user-sign-up",
13122
13138
  email,
13123
13139
  metadata,
13124
- expireAt: new Date((/* @__PURE__ */ new Date()).getTime() + 5 * 60 * 1e3).toISOString(),
13140
+ expireAt: new Date((/* @__PURE__ */ new Date()).getTime() + 5 * 60 * 1e3),
13125
13141
  // 5mins from now
13126
13142
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
13127
13143
  };