@devlider001/washlab-backend 1.0.5 → 1.0.6

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/convex/admin.d.ts CHANGED
@@ -226,6 +226,7 @@ export declare const getCustomers: import("convex/server").RegisteredQuery<"publ
226
226
  _creationTime: number;
227
227
  email?: string | undefined;
228
228
  clerkUserId?: string | undefined;
229
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
229
230
  statusNote?: string | undefined;
230
231
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
231
232
  statusChangedAt?: number | undefined;
@@ -235,7 +236,6 @@ export declare const getCustomers: import("convex/server").RegisteredQuery<"publ
235
236
  name: string;
236
237
  isRegistered: boolean;
237
238
  isVerified: boolean;
238
- status: "active" | "blocked" | "suspended" | "restricted";
239
239
  createdAt: number;
240
240
  isDeleted: boolean;
241
241
  }[];
@@ -16,6 +16,7 @@ export declare const getByPhone: import("convex/server").RegisteredQuery<"public
16
16
  _creationTime: number;
17
17
  email?: string | undefined;
18
18
  clerkUserId?: string | undefined;
19
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
19
20
  statusNote?: string | undefined;
20
21
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
21
22
  statusChangedAt?: number | undefined;
@@ -25,12 +26,12 @@ export declare const getByPhone: import("convex/server").RegisteredQuery<"public
25
26
  name: string;
26
27
  isRegistered: boolean;
27
28
  isVerified: boolean;
28
- status: "active" | "blocked" | "suspended" | "restricted";
29
29
  createdAt: number;
30
30
  isDeleted: boolean;
31
31
  } | null>>;
32
32
  /**
33
33
  * Get current customer profile (from authenticated Clerk session)
34
+ * Returns null if customer hasn't completed registration yet
34
35
  */
35
36
  export declare const getProfile: import("convex/server").RegisteredQuery<"public", {}, Promise<{
36
37
  orderCount: number;
@@ -39,6 +40,7 @@ export declare const getProfile: import("convex/server").RegisteredQuery<"public
39
40
  _creationTime: number;
40
41
  email?: string | undefined;
41
42
  clerkUserId?: string | undefined;
43
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
42
44
  statusNote?: string | undefined;
43
45
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
44
46
  statusChangedAt?: number | undefined;
@@ -48,18 +50,22 @@ export declare const getProfile: import("convex/server").RegisteredQuery<"public
48
50
  name: string;
49
51
  isRegistered: boolean;
50
52
  isVerified: boolean;
51
- status: "active" | "blocked" | "suspended" | "restricted";
52
53
  createdAt: number;
53
54
  isDeleted: boolean;
54
- }>>;
55
+ } | null>>;
55
56
  /**
56
57
  * Get customer order history - Paginated
57
58
  * Supports usePaginatedQuery for infinite scroll
59
+ * Returns empty results if customer not found
58
60
  */
59
61
  export declare const getOrders: import("convex/server").RegisteredQuery<"public", {
60
62
  cursor?: string | undefined;
61
63
  numItems?: number | undefined;
62
64
  }, Promise<{
65
+ page: never[];
66
+ isDone: boolean;
67
+ continueCursor: null;
68
+ } | {
63
69
  page: {
64
70
  _id: import("convex/values").GenericId<"orders">;
65
71
  _creationTime: number;
@@ -106,6 +112,7 @@ export declare const getOrders: import("convex/server").RegisteredQuery<"public"
106
112
  }>>;
107
113
  /**
108
114
  * Get customer loyalty points balance
115
+ * Returns zero points if customer not found
109
116
  */
110
117
  export declare const getLoyaltyPoints: import("convex/server").RegisteredQuery<"public", {}, Promise<{
111
118
  points: number;
@@ -178,6 +185,7 @@ export declare const search: import("convex/server").RegisteredQuery<"public", {
178
185
  _creationTime: number;
179
186
  email?: string | undefined;
180
187
  clerkUserId?: string | undefined;
188
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
181
189
  statusNote?: string | undefined;
182
190
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
183
191
  statusChangedAt?: number | undefined;
@@ -187,7 +195,6 @@ export declare const search: import("convex/server").RegisteredQuery<"public", {
187
195
  name: string;
188
196
  isRegistered: boolean;
189
197
  isVerified: boolean;
190
- status: "active" | "blocked" | "suspended" | "restricted";
191
198
  createdAt: number;
192
199
  isDeleted: boolean;
193
200
  }[]>>;
@@ -208,6 +215,7 @@ export declare const getDetails: import("convex/server").RegisteredQuery<"public
208
215
  _creationTime: number;
209
216
  email?: string | undefined;
210
217
  clerkUserId?: string | undefined;
218
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
211
219
  statusNote?: string | undefined;
212
220
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
213
221
  statusChangedAt?: number | undefined;
@@ -217,7 +225,6 @@ export declare const getDetails: import("convex/server").RegisteredQuery<"public
217
225
  name: string;
218
226
  isRegistered: boolean;
219
227
  isVerified: boolean;
220
- status: "active" | "blocked" | "suspended" | "restricted";
221
228
  createdAt: number;
222
229
  isDeleted: boolean;
223
230
  }>>;
@@ -5,6 +5,29 @@ import { Id } from "../_generated/dataModel";
5
5
  * @throws Error if user is not authenticated
6
6
  */
7
7
  export declare function getClerkIdentity(ctx: QueryCtx | MutationCtx): Promise<import("convex/server").UserIdentity>;
8
+ /**
9
+ * Find current customer user from Clerk identity
10
+ * Returns null if customer doesn't exist (for profile check scenarios)
11
+ * @throws Error if user is not authenticated
12
+ */
13
+ export declare function findCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise<{
14
+ _id: import("convex/values").GenericId<"users">;
15
+ _creationTime: number;
16
+ email?: string | undefined;
17
+ clerkUserId?: string | undefined;
18
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
19
+ statusNote?: string | undefined;
20
+ statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
21
+ statusChangedAt?: number | undefined;
22
+ lastLoginAt?: number | undefined;
23
+ preferredBranchId?: import("convex/values").GenericId<"branches"> | undefined;
24
+ phoneNumber: string;
25
+ name: string;
26
+ isRegistered: boolean;
27
+ isVerified: boolean;
28
+ createdAt: number;
29
+ isDeleted: boolean;
30
+ } | null>;
8
31
  /**
9
32
  * Get current customer user from Clerk identity
10
33
  * @throws Error if user is not authenticated or not found
@@ -14,6 +37,7 @@ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise
14
37
  _creationTime: number;
15
38
  email?: string | undefined;
16
39
  clerkUserId?: string | undefined;
40
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
17
41
  statusNote?: string | undefined;
18
42
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
19
43
  statusChangedAt?: number | undefined;
@@ -23,7 +47,6 @@ export declare function getCurrentCustomer(ctx: QueryCtx | MutationCtx): Promise
23
47
  name: string;
24
48
  isRegistered: boolean;
25
49
  isVerified: boolean;
26
- status: "active" | "blocked" | "suspended" | "restricted";
27
50
  createdAt: number;
28
51
  isDeleted: boolean;
29
52
  }>;
@@ -8,6 +8,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
8
8
  users: import("convex/server").TableDefinition<import("convex/values").VObject<{
9
9
  email?: string | undefined;
10
10
  clerkUserId?: string | undefined;
11
+ status?: "active" | "blocked" | "suspended" | "restricted" | undefined;
11
12
  statusNote?: string | undefined;
12
13
  statusChangedBy?: import("convex/values").GenericId<"admins"> | undefined;
13
14
  statusChangedAt?: number | undefined;
@@ -17,7 +18,6 @@ declare const _default: import("convex/server").SchemaDefinition<{
17
18
  name: string;
18
19
  isRegistered: boolean;
19
20
  isVerified: boolean;
20
- status: "active" | "blocked" | "suspended" | "restricted";
21
21
  createdAt: number;
22
22
  isDeleted: boolean;
23
23
  }, {
@@ -27,7 +27,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
27
27
  clerkUserId: import("convex/values").VString<string | undefined, "optional">;
28
28
  isRegistered: import("convex/values").VBoolean<boolean, "required">;
29
29
  isVerified: import("convex/values").VBoolean<boolean, "required">;
30
- status: import("convex/values").VUnion<"active" | "blocked" | "suspended" | "restricted", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"blocked", "required">, import("convex/values").VLiteral<"suspended", "required">, import("convex/values").VLiteral<"restricted", "required">], "required", never>;
30
+ status: import("convex/values").VUnion<"active" | "blocked" | "suspended" | "restricted" | undefined, [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"blocked", "required">, import("convex/values").VLiteral<"suspended", "required">, import("convex/values").VLiteral<"restricted", "required">], "optional", never>;
31
31
  statusNote: import("convex/values").VString<string | undefined, "optional">;
32
32
  statusChangedBy: import("convex/values").VId<import("convex/values").GenericId<"admins"> | undefined, "optional">;
33
33
  statusChangedAt: import("convex/values").VFloat64<number | undefined, "optional">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devlider001/washlab-backend",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Washlab backend - Convex API package for Lider Technology Ltd",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -35,8 +35,10 @@
35
35
  "homepage": "https://github.com/lider-technology-ltd/washlab-backend#readme",
36
36
  "scripts": {
37
37
  "build": "tsc --project tsconfig.build.json >nul 2>&1 || exit 0",
38
+ "clean:convex": "node -e \"const fs=require('fs'),p=require('path');function rm(d){for(const f of fs.readdirSync(d)){const fp=p.join(d,f);const st=fs.statSync(fp);if(st.isDirectory()){if(f==='_generated')continue;rm(fp);}else{if(/\\.(?:js|js\\.map|d\\.ts|d\\.ts\\.map)$/.test(f)){fs.unlinkSync(fp);}}}}rm('convex');\"",
39
+ "prepack": "npm run clean:convex && npm run build",
38
40
  "build:strict": "tsc --project tsconfig.build.json",
39
- "prepublishOnly": "npm run build",
41
+ "prepublishOnly": "npm run clean:convex && npm run build",
40
42
  "test": "echo \"Error: no test specified\" && exit 1"
41
43
  },
42
44
  "keywords": [
@@ -59,4 +61,4 @@
59
61
  "peerDependencies": {
60
62
  "convex": "^1.31.2"
61
63
  }
62
- }
64
+ }
@@ -1,23 +0,0 @@
1
- /* eslint-disable */
2
- /**
3
- * Generated `api` utility.
4
- *
5
- * THIS CODE IS AUTOMATICALLY GENERATED.
6
- *
7
- * To regenerate, run `npx convex dev`.
8
- * @module
9
- */
10
-
11
- import { anyApi, componentsGeneric } from "convex/server";
12
-
13
- /**
14
- * A utility for referencing Convex functions in your app's API.
15
- *
16
- * Usage:
17
- * ```js
18
- * const myFunctionReference = api.myModule.myFunction;
19
- * ```
20
- */
21
- export const api = anyApi;
22
- export const internal = anyApi;
23
- export const components = componentsGeneric();
@@ -1,93 +0,0 @@
1
- /* eslint-disable */
2
- /**
3
- * Generated utilities for implementing server-side Convex query and mutation functions.
4
- *
5
- * THIS CODE IS AUTOMATICALLY GENERATED.
6
- *
7
- * To regenerate, run `npx convex dev`.
8
- * @module
9
- */
10
-
11
- import {
12
- actionGeneric,
13
- httpActionGeneric,
14
- queryGeneric,
15
- mutationGeneric,
16
- internalActionGeneric,
17
- internalMutationGeneric,
18
- internalQueryGeneric,
19
- } from "convex/server";
20
-
21
- /**
22
- * Define a query in this Convex app's public API.
23
- *
24
- * This function will be allowed to read your Convex database and will be accessible from the client.
25
- *
26
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
27
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
28
- */
29
- export const query = queryGeneric;
30
-
31
- /**
32
- * Define a query that is only accessible from other Convex functions (but not from the client).
33
- *
34
- * This function will be allowed to read from your Convex database. It will not be accessible from the client.
35
- *
36
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
37
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
38
- */
39
- export const internalQuery = internalQueryGeneric;
40
-
41
- /**
42
- * Define a mutation in this Convex app's public API.
43
- *
44
- * This function will be allowed to modify your Convex database and will be accessible from the client.
45
- *
46
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
47
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
48
- */
49
- export const mutation = mutationGeneric;
50
-
51
- /**
52
- * Define a mutation that is only accessible from other Convex functions (but not from the client).
53
- *
54
- * This function will be allowed to modify your Convex database. It will not be accessible from the client.
55
- *
56
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
57
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
58
- */
59
- export const internalMutation = internalMutationGeneric;
60
-
61
- /**
62
- * Define an action in this Convex app's public API.
63
- *
64
- * An action is a function which can execute any JavaScript code, including non-deterministic
65
- * code and code with side-effects, like calling third-party services.
66
- * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
67
- * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
68
- *
69
- * @param func - The action. It receives an {@link ActionCtx} as its first argument.
70
- * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
71
- */
72
- export const action = actionGeneric;
73
-
74
- /**
75
- * Define an action that is only accessible from other Convex functions (but not from the client).
76
- *
77
- * @param func - The function. It receives an {@link ActionCtx} as its first argument.
78
- * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
79
- */
80
- export const internalAction = internalActionGeneric;
81
-
82
- /**
83
- * Define an HTTP action.
84
- *
85
- * The wrapped function will be used to respond to HTTP requests received
86
- * by a Convex deployment if the requests matches the path and method where
87
- * this action is routed. Be sure to route your httpAction in `convex/http.js`.
88
- *
89
- * @param func - The function. It receives an {@link ActionCtx} as its first argument
90
- * and a Fetch API `Request` object as its second.
91
- * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
92
- */
93
- export const httpAction = httpActionGeneric;