@devlider001/washlab-backend 1.0.7 → 1.0.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.
@@ -57,16 +57,36 @@ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise
57
57
  export declare function getCurrentAttendant(ctx: QueryCtx | MutationCtx): Promise<{
58
58
  _id: import("convex/values").GenericId<"attendants">;
59
59
  _creationTime: number;
60
+ clerkUserId?: string | undefined;
60
61
  lastLoginAt?: number | undefined;
61
62
  passcode?: string | undefined;
63
+ enrollmentTokenHash?: string | undefined;
64
+ enrollmentTokenExpiresAt?: number | undefined;
65
+ enrolledAt?: number | undefined;
66
+ enrolledBy?: import("convex/values").GenericId<"admins"> | undefined;
67
+ biometricTemplateHash?: string | undefined;
68
+ biometricDataEncrypted?: string | undefined;
69
+ biometricCaptureMetadata?: {
70
+ deviceInfo?: string | undefined;
71
+ captureType: "face" | "hand";
72
+ anglesCaptured: string[];
73
+ captureQuality: number;
74
+ livenessPassed: boolean;
75
+ captureTimestamp: number;
76
+ } | undefined;
77
+ lastVerificationAt?: number | undefined;
78
+ lastVerificationSuccess?: boolean | undefined;
79
+ verificationTimeoutAt?: number | undefined;
62
80
  phoneNumber: string;
63
81
  email: string;
64
82
  name: string;
65
- clerkUserId: string;
66
83
  createdAt: number;
67
84
  isDeleted: boolean;
68
85
  branchId: import("convex/values").GenericId<"branches">;
69
86
  isActive: boolean;
87
+ enrollmentStatus: "active" | "suspended" | "invited" | "enrolling" | "locked";
88
+ consecutiveFailures: number;
89
+ createdBy: import("convex/values").GenericId<"admins">;
70
90
  }>;
71
91
  /**
72
92
  * Get current admin from Clerk identity
@@ -105,15 +125,35 @@ export declare function getSuperAdmin(ctx: QueryCtx | MutationCtx): Promise<{
105
125
  export declare function verifyAttendantBranch(ctx: QueryCtx | MutationCtx, attendantId: Id<"attendants">, branchId: Id<"branches">): Promise<{
106
126
  _id: import("convex/values").GenericId<"attendants">;
107
127
  _creationTime: number;
128
+ clerkUserId?: string | undefined;
108
129
  lastLoginAt?: number | undefined;
109
130
  passcode?: string | undefined;
131
+ enrollmentTokenHash?: string | undefined;
132
+ enrollmentTokenExpiresAt?: number | undefined;
133
+ enrolledAt?: number | undefined;
134
+ enrolledBy?: import("convex/values").GenericId<"admins"> | undefined;
135
+ biometricTemplateHash?: string | undefined;
136
+ biometricDataEncrypted?: string | undefined;
137
+ biometricCaptureMetadata?: {
138
+ deviceInfo?: string | undefined;
139
+ captureType: "face" | "hand";
140
+ anglesCaptured: string[];
141
+ captureQuality: number;
142
+ livenessPassed: boolean;
143
+ captureTimestamp: number;
144
+ } | undefined;
145
+ lastVerificationAt?: number | undefined;
146
+ lastVerificationSuccess?: boolean | undefined;
147
+ verificationTimeoutAt?: number | undefined;
110
148
  phoneNumber: string;
111
149
  email: string;
112
150
  name: string;
113
- clerkUserId: string;
114
151
  createdAt: number;
115
152
  isDeleted: boolean;
116
153
  branchId: import("convex/values").GenericId<"branches">;
117
154
  isActive: boolean;
155
+ enrollmentStatus: "active" | "suspended" | "invited" | "enrolling" | "locked";
156
+ consecutiveFailures: number;
157
+ createdBy: import("convex/values").GenericId<"admins">;
118
158
  }>;
119
159
  //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Biometric Comparison Utilities
3
+ *
4
+ * Provides functions to compare live biometric data with stored templates.
5
+ */
6
+ export interface BiometricData {
7
+ landmarks: number[][];
8
+ angles: {
9
+ headLeft?: number;
10
+ headRight?: number;
11
+ headUp?: number;
12
+ headDown?: number;
13
+ handLeft?: number;
14
+ handRight?: number;
15
+ handUp?: number;
16
+ handDown?: number;
17
+ };
18
+ features: number[];
19
+ }
20
+ /**
21
+ * Compare two biometric templates and return confidence score (0-1)
22
+ */
23
+ export declare function compareBiometricData(live: BiometricData, stored: BiometricData): number;
24
+ /**
25
+ * Compare biometric templates (wrapper for stored vs live comparison)
26
+ */
27
+ export declare function compareBiometricTemplates(storedTemplate: BiometricData, liveData: {
28
+ features: number[];
29
+ measurements: any;
30
+ angles: string[];
31
+ }, options: {
32
+ captureQuality: number;
33
+ type: "face" | "hand";
34
+ }): Promise<{
35
+ confidence: number;
36
+ match: boolean;
37
+ }>;
38
+ //# sourceMappingURL=biometricComparison.d.ts.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Biometric Data Encryption Utilities
3
+ *
4
+ * Provides encryption and decryption for biometric templates.
5
+ * Uses base64 encoding for now (placeholder for proper encryption).
6
+ *
7
+ * NOTE: In Convex, we use base64 encoding for now.
8
+ * For production, implement proper encryption using environment variables
9
+ * or an external encryption service.
10
+ */
11
+ export interface BiometricData {
12
+ landmarks: number[][];
13
+ angles: {
14
+ headLeft?: number;
15
+ headRight?: number;
16
+ headUp?: number;
17
+ headDown?: number;
18
+ handLeft?: number;
19
+ handRight?: number;
20
+ handUp?: number;
21
+ handDown?: number;
22
+ };
23
+ features: number[];
24
+ }
25
+ /**
26
+ * Encrypt biometric data
27
+ * Returns encrypted data, IV, and auth tag as base64 strings
28
+ *
29
+ * IMPORTANT: In production, use proper encryption library or service
30
+ * This is a placeholder that should be replaced with actual encryption
31
+ */
32
+ export declare function encryptBiometricData(data: BiometricData): {
33
+ encryptedData: string;
34
+ iv: string;
35
+ authTag: string;
36
+ };
37
+ /**
38
+ * Decrypt biometric data
39
+ *
40
+ * IMPORTANT: In production, use proper decryption library or service
41
+ * This is a placeholder that should be replaced with actual decryption
42
+ */
43
+ export declare function decryptBiometricData(encryptedData: string, iv: string, authTag: string): BiometricData;
44
+ /**
45
+ * Hash biometric template for quick comparison
46
+ * Uses Web Crypto API (available in Convex V8 runtime)
47
+ */
48
+ export declare function hashBiometricTemplate(data: BiometricData): Promise<string>;
49
+ //# sourceMappingURL=biometricEncryption.d.ts.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Token Hashing Utilities
3
+ *
4
+ * Provides secure token hashing and verification.
5
+ * Used for enrollment tokens, session tokens, and OTP codes.
6
+ *
7
+ * Uses Web Crypto API (available in Convex V8 runtime)
8
+ */
9
+ /**
10
+ * Hash a token using SHA-256 (for enrollment tokens and challenges)
11
+ * Uses Web Crypto API which is available in Convex V8 runtime
12
+ */
13
+ export declare function hashToken(token: string): Promise<string>;
14
+ /**
15
+ * Verify a token against its hash
16
+ */
17
+ export declare function verifyToken(token: string, hash: string): Promise<boolean>;
18
+ /**
19
+ * Generate a secure random token
20
+ */
21
+ export declare function generateSecureToken(length?: number): string;
22
+ /**
23
+ * Generate a challenge string for biometric verification
24
+ */
25
+ export declare function generateChallenge(): string;
26
+ //# sourceMappingURL=tokenHashing.d.ts.map
@@ -15,15 +15,18 @@ export declare const getBalance: import("convex/server").RegisteredQuery<"public
15
15
  lastRedeemedAt: number | undefined;
16
16
  }>>;
17
17
  /**
18
- * Get loyalty transaction history
19
- */
20
- /**
21
- * Get loyalty transactions - Paginated
18
+ * Get loyalty transaction history - Paginated
22
19
  * Supports usePaginatedQuery for infinite scroll
23
20
  */
24
21
  export declare const getTransactions: import("convex/server").RegisteredQuery<"public", {
25
- cursor?: string | undefined;
26
- numItems?: number | undefined;
22
+ paginationOpts: {
23
+ id?: number;
24
+ endCursor?: string | null;
25
+ maximumRowsRead?: number;
26
+ maximumBytesRead?: number;
27
+ numItems: number;
28
+ cursor: string | null;
29
+ };
27
30
  }, Promise<{
28
31
  page: {
29
32
  _id: import("convex/values").GenericId<"loyaltyTransactions">;
@@ -41,6 +44,117 @@ export declare const getTransactions: import("convex/server").RegisteredQuery<"p
41
44
  isDone: boolean;
42
45
  continueCursor: string;
43
46
  }>>;
47
+ /**
48
+ * Admin: Get all loyalty points balances (paginated)
49
+ */
50
+ export declare const getAllLoyaltyPoints: import("convex/server").RegisteredQuery<"public", {
51
+ searchQuery?: string | undefined;
52
+ paginationOpts: {
53
+ id?: number;
54
+ endCursor?: string | null;
55
+ maximumRowsRead?: number;
56
+ maximumBytesRead?: number;
57
+ numItems: number;
58
+ cursor: string | null;
59
+ };
60
+ }, Promise<{
61
+ page: never[];
62
+ isDone: boolean;
63
+ continueCursor: null;
64
+ } | {
65
+ page: {
66
+ customer: {
67
+ _id: import("convex/values").GenericId<"users">;
68
+ name: string;
69
+ phoneNumber: string;
70
+ email: string | undefined;
71
+ } | null;
72
+ _id: import("convex/values").GenericId<"loyaltyPoints">;
73
+ _creationTime: number;
74
+ lastEarnedAt?: number | undefined;
75
+ lastRedeemedAt?: number | undefined;
76
+ isDeleted: boolean;
77
+ customerId: import("convex/values").GenericId<"users">;
78
+ points: number;
79
+ totalEarned: number;
80
+ totalRedeemed: number;
81
+ }[];
82
+ isDone: boolean;
83
+ continueCursor: string;
84
+ }>>;
85
+ /**
86
+ * Admin: Get all loyalty transactions (paginated)
87
+ */
88
+ export declare const getAllTransactions: import("convex/server").RegisteredQuery<"public", {
89
+ type?: "earned" | "redeemed" | "adjusted" | undefined;
90
+ customerId?: import("convex/values").GenericId<"users"> | undefined;
91
+ paginationOpts: {
92
+ id?: number;
93
+ endCursor?: string | null;
94
+ maximumRowsRead?: number;
95
+ maximumBytesRead?: number;
96
+ numItems: number;
97
+ cursor: string | null;
98
+ };
99
+ }, Promise<{
100
+ page: {
101
+ customer: {
102
+ _id: import("convex/values").GenericId<"users">;
103
+ name: string;
104
+ phoneNumber: string;
105
+ email: string | undefined;
106
+ } | null;
107
+ order: {
108
+ _id: import("convex/values").GenericId<"orders">;
109
+ orderNumber: string;
110
+ } | null;
111
+ adjustedBy: {
112
+ _id: import("convex/values").GenericId<"admins">;
113
+ name: string;
114
+ email: string;
115
+ } | null;
116
+ _id: import("convex/values").GenericId<"loyaltyTransactions">;
117
+ _creationTime: number;
118
+ createdBy?: import("convex/values").GenericId<"admins"> | undefined;
119
+ orderId?: import("convex/values").GenericId<"orders"> | undefined;
120
+ description?: string | undefined;
121
+ type: "earned" | "redeemed" | "expired" | "adjusted";
122
+ createdAt: number;
123
+ isDeleted: boolean;
124
+ customerId: import("convex/values").GenericId<"users">;
125
+ points: number;
126
+ balanceAfter: number;
127
+ }[];
128
+ isDone: boolean;
129
+ continueCursor: string;
130
+ }>>;
131
+ /**
132
+ * Admin: Get loyalty points for a specific customer
133
+ */
134
+ export declare const getCustomerLoyaltyPoints: import("convex/server").RegisteredQuery<"public", {
135
+ customerId: import("convex/values").GenericId<"users">;
136
+ }, Promise<{
137
+ points: number;
138
+ totalEarned: number;
139
+ totalRedeemed: number;
140
+ lastEarnedAt: undefined;
141
+ lastRedeemedAt: undefined;
142
+ customerId: import("convex/values").GenericId<"users">;
143
+ customer?: undefined;
144
+ } | {
145
+ points: number;
146
+ totalEarned: number;
147
+ totalRedeemed: number;
148
+ lastEarnedAt: number | undefined;
149
+ lastRedeemedAt: number | undefined;
150
+ customerId: import("convex/values").GenericId<"users">;
151
+ customer: {
152
+ _id: import("convex/values").GenericId<"users">;
153
+ name: string;
154
+ phoneNumber: string;
155
+ email: string | undefined;
156
+ } | null;
157
+ }>>;
44
158
  /**
45
159
  * Earn loyalty points (internal - called when order is completed)
46
160
  */
@@ -48,7 +162,17 @@ export declare const earnPoints: import("convex/server").RegisteredMutation<"int
48
162
  customerId: import("convex/values").GenericId<"users">;
49
163
  orderId: import("convex/values").GenericId<"orders">;
50
164
  points: number;
51
- }, Promise<void>>;
165
+ }, Promise<{
166
+ skipped: boolean;
167
+ reason: string;
168
+ success?: undefined;
169
+ pointsAwarded?: undefined;
170
+ } | {
171
+ success: boolean;
172
+ pointsAwarded: number;
173
+ skipped?: undefined;
174
+ reason?: undefined;
175
+ }>>;
52
176
  /**
53
177
  * Redeem loyalty points for free wash
54
178
  */
@@ -76,6 +76,8 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
76
76
  };
77
77
  }, Promise<{
78
78
  page: {
79
+ isRead: boolean;
80
+ readAt: number | undefined;
79
81
  _id: import("convex/values").GenericId<"notifications">;
80
82
  _creationTime: number;
81
83
  branchId?: import("convex/values").GenericId<"branches"> | undefined;
@@ -83,7 +85,6 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
83
85
  entityId?: string | undefined;
84
86
  actionUrl?: string | undefined;
85
87
  actionLabel?: string | undefined;
86
- readAt?: number | undefined;
87
88
  senderId?: string | undefined;
88
89
  senderType?: "admin" | "attendant" | "system" | undefined;
89
90
  expiresAt?: number | undefined;
@@ -97,7 +98,6 @@ export declare const getAllNotifications: import("convex/server").RegisteredQuer
97
98
  title: string;
98
99
  message: string;
99
100
  priority: "low" | "normal" | "high" | "urgent";
100
- isRead: boolean;
101
101
  }[];
102
102
  isDone: boolean;
103
103
  continueCursor: string;
@@ -123,6 +123,29 @@ export declare const createNotification: import("convex/server").RegisteredMutat
123
123
  notificationId: import("convex/values").GenericId<"notifications">;
124
124
  success: boolean;
125
125
  }>>;
126
+ /**
127
+ * Internal mutation to create notification (can be called from other mutations)
128
+ */
129
+ export declare const internalCreateNotification: import("convex/server").RegisteredMutation<"internal", {
130
+ branchId?: import("convex/values").GenericId<"branches"> | undefined;
131
+ entityType?: string | undefined;
132
+ entityId?: string | undefined;
133
+ recipientId?: string | undefined;
134
+ actionUrl?: string | undefined;
135
+ actionLabel?: string | undefined;
136
+ priority?: "low" | "normal" | "high" | "urgent" | undefined;
137
+ senderId?: string | undefined;
138
+ senderType?: "admin" | "attendant" | "system" | undefined;
139
+ expiresAt?: number | undefined;
140
+ scheduledFor?: number | undefined;
141
+ type: "info" | "success" | "warning" | "error" | "order" | "payment" | "system";
142
+ recipientType: "admin" | "customer" | "attendant" | "all";
143
+ title: string;
144
+ message: string;
145
+ }, Promise<{
146
+ notificationId: import("convex/values").GenericId<"notifications">;
147
+ success: boolean;
148
+ }>>;
126
149
  /**
127
150
  * Delete notification (admin only - hard delete)
128
151
  */