@m5kdev/backend 0.8.9 → 0.8.11
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/src/modules/auth/auth.dto.d.cts +2 -2
- package/dist/src/modules/auth/auth.dto.d.mts +2 -2
- package/dist/src/modules/auth/auth.trpc.d.cts +6 -6
- package/dist/src/modules/auth/auth.trpc.d.mts +6 -6
- package/dist/src/modules/base/base.repository.cjs +1 -1
- package/dist/src/modules/base/base.repository.mjs +1 -1
- package/dist/src/modules/billing/billing.repository.d.cts +11 -11
- package/dist/src/modules/billing/billing.service.d.cts +7 -7
- package/dist/src/modules/connect/connect.dto.d.cts +2 -2
- package/dist/src/modules/connect/connect.dto.d.mts +2 -2
- package/dist/src/modules/connect/connect.repository.d.cts +1 -1
- package/dist/src/modules/connect/connect.repository.d.mts +1 -1
- package/dist/src/modules/connect/connect.service.d.cts +2 -2
- package/dist/src/modules/connect/connect.service.d.mts +2 -2
- package/dist/src/modules/recurrence/recurrence.service.d.cts +5 -5
- package/dist/src/modules/recurrence/recurrence.service.d.mts +5 -5
- package/dist/src/modules/recurrence/recurrence.trpc.d.cts +4 -4
- package/dist/src/modules/recurrence/recurrence.trpc.d.mts +4 -4
- package/dist/src/modules/tag/tag.trpc.d.cts +4 -4
- package/dist/src/modules/tag/tag.trpc.d.mts +4 -4
- package/dist/src/modules/utils/getConditionsFromFilters.cjs +32 -0
- package/dist/src/modules/utils/getConditionsFromFilters.cjs.map +1 -1
- package/dist/src/modules/utils/getConditionsFromFilters.mjs +33 -1
- package/dist/src/modules/utils/getConditionsFromFilters.mjs.map +1 -1
- package/dist/src/types.d.cts +6 -6
- package/dist/src/types.d.mts +6 -6
- package/package.json +3 -3
|
@@ -12,8 +12,8 @@ declare const waitlistSchema: z.ZodObject<{
|
|
|
12
12
|
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
declare const waitlistOutputSchema: z.ZodObject<{
|
|
15
|
-
id: z.ZodString;
|
|
16
15
|
name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
id: z.ZodString;
|
|
17
17
|
email: z.ZodNullable<z.ZodString>;
|
|
18
18
|
createdAt: z.ZodDate;
|
|
19
19
|
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
@@ -36,8 +36,8 @@ declare const accountClaimOutputSchema: z.ZodObject<{
|
|
|
36
36
|
id: z.ZodString;
|
|
37
37
|
createdAt: z.ZodDate;
|
|
38
38
|
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
39
|
-
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
40
39
|
status: z.ZodString;
|
|
40
|
+
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
41
41
|
claimUserId: z.ZodNullable<z.ZodString>;
|
|
42
42
|
claimedAt: z.ZodNullable<z.ZodDate>;
|
|
43
43
|
claimedEmail: z.ZodNullable<z.ZodString>;
|
|
@@ -12,8 +12,8 @@ declare const waitlistSchema: z.ZodObject<{
|
|
|
12
12
|
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
declare const waitlistOutputSchema: z.ZodObject<{
|
|
15
|
-
id: z.ZodString;
|
|
16
15
|
name: z.ZodNullable<z.ZodString>;
|
|
16
|
+
id: z.ZodString;
|
|
17
17
|
email: z.ZodNullable<z.ZodString>;
|
|
18
18
|
createdAt: z.ZodDate;
|
|
19
19
|
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
@@ -36,8 +36,8 @@ declare const accountClaimOutputSchema: z.ZodObject<{
|
|
|
36
36
|
id: z.ZodString;
|
|
37
37
|
createdAt: z.ZodDate;
|
|
38
38
|
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
39
|
-
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
40
39
|
status: z.ZodString;
|
|
40
|
+
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
41
41
|
claimUserId: z.ZodNullable<z.ZodString>;
|
|
42
42
|
claimedAt: z.ZodNullable<z.ZodDate>;
|
|
43
43
|
claimedEmail: z.ZodNullable<z.ZodString>;
|
|
@@ -59,8 +59,8 @@ declare function createAuthTRPC({
|
|
|
59
59
|
id: string;
|
|
60
60
|
createdAt: Date;
|
|
61
61
|
updatedAt: Date | null;
|
|
62
|
-
expiresAt: Date | null;
|
|
63
62
|
status: string;
|
|
63
|
+
expiresAt: Date | null;
|
|
64
64
|
claimUserId: string | null;
|
|
65
65
|
claimedAt: Date | null;
|
|
66
66
|
claimedEmail: string | null;
|
|
@@ -146,8 +146,8 @@ declare function createAuthTRPC({
|
|
|
146
146
|
listAdminWaitlist: _$_trpc_server0.TRPCQueryProcedure<{
|
|
147
147
|
input: void;
|
|
148
148
|
output: {
|
|
149
|
-
id: string;
|
|
150
149
|
name: string | null;
|
|
150
|
+
id: string;
|
|
151
151
|
email: string | null;
|
|
152
152
|
createdAt: Date;
|
|
153
153
|
updatedAt: Date | null;
|
|
@@ -160,8 +160,8 @@ declare function createAuthTRPC({
|
|
|
160
160
|
email: string;
|
|
161
161
|
};
|
|
162
162
|
output: {
|
|
163
|
-
id: string;
|
|
164
163
|
name: string | null;
|
|
164
|
+
id: string;
|
|
165
165
|
email: string | null;
|
|
166
166
|
createdAt: Date;
|
|
167
167
|
updatedAt: Date | null;
|
|
@@ -191,8 +191,8 @@ declare function createAuthTRPC({
|
|
|
191
191
|
id: string;
|
|
192
192
|
};
|
|
193
193
|
output: {
|
|
194
|
-
id: string;
|
|
195
194
|
name: string | null;
|
|
195
|
+
id: string;
|
|
196
196
|
email: string | null;
|
|
197
197
|
createdAt: Date;
|
|
198
198
|
updatedAt: Date | null;
|
|
@@ -205,8 +205,8 @@ declare function createAuthTRPC({
|
|
|
205
205
|
id: string;
|
|
206
206
|
};
|
|
207
207
|
output: {
|
|
208
|
-
id: string;
|
|
209
208
|
name: string | null;
|
|
209
|
+
id: string;
|
|
210
210
|
email: string | null;
|
|
211
211
|
createdAt: Date;
|
|
212
212
|
updatedAt: Date | null;
|
|
@@ -219,8 +219,8 @@ declare function createAuthTRPC({
|
|
|
219
219
|
email: string;
|
|
220
220
|
};
|
|
221
221
|
output: {
|
|
222
|
-
id: string;
|
|
223
222
|
name: string | null;
|
|
223
|
+
id: string;
|
|
224
224
|
email: string | null;
|
|
225
225
|
createdAt: Date;
|
|
226
226
|
updatedAt: Date | null;
|
|
@@ -59,8 +59,8 @@ declare function createAuthTRPC({
|
|
|
59
59
|
id: string;
|
|
60
60
|
createdAt: Date;
|
|
61
61
|
updatedAt: Date | null;
|
|
62
|
-
expiresAt: Date | null;
|
|
63
62
|
status: string;
|
|
63
|
+
expiresAt: Date | null;
|
|
64
64
|
claimUserId: string | null;
|
|
65
65
|
claimedAt: Date | null;
|
|
66
66
|
claimedEmail: string | null;
|
|
@@ -146,8 +146,8 @@ declare function createAuthTRPC({
|
|
|
146
146
|
listAdminWaitlist: _$_trpc_server0.TRPCQueryProcedure<{
|
|
147
147
|
input: void;
|
|
148
148
|
output: {
|
|
149
|
-
id: string;
|
|
150
149
|
name: string | null;
|
|
150
|
+
id: string;
|
|
151
151
|
email: string | null;
|
|
152
152
|
createdAt: Date;
|
|
153
153
|
updatedAt: Date | null;
|
|
@@ -160,8 +160,8 @@ declare function createAuthTRPC({
|
|
|
160
160
|
email: string;
|
|
161
161
|
};
|
|
162
162
|
output: {
|
|
163
|
-
id: string;
|
|
164
163
|
name: string | null;
|
|
164
|
+
id: string;
|
|
165
165
|
email: string | null;
|
|
166
166
|
createdAt: Date;
|
|
167
167
|
updatedAt: Date | null;
|
|
@@ -191,8 +191,8 @@ declare function createAuthTRPC({
|
|
|
191
191
|
id: string;
|
|
192
192
|
};
|
|
193
193
|
output: {
|
|
194
|
-
id: string;
|
|
195
194
|
name: string | null;
|
|
195
|
+
id: string;
|
|
196
196
|
email: string | null;
|
|
197
197
|
createdAt: Date;
|
|
198
198
|
updatedAt: Date | null;
|
|
@@ -205,8 +205,8 @@ declare function createAuthTRPC({
|
|
|
205
205
|
id: string;
|
|
206
206
|
};
|
|
207
207
|
output: {
|
|
208
|
-
id: string;
|
|
209
208
|
name: string | null;
|
|
209
|
+
id: string;
|
|
210
210
|
email: string | null;
|
|
211
211
|
createdAt: Date;
|
|
212
212
|
updatedAt: Date | null;
|
|
@@ -219,8 +219,8 @@ declare function createAuthTRPC({
|
|
|
219
219
|
email: string;
|
|
220
220
|
};
|
|
221
221
|
output: {
|
|
222
|
-
id: string;
|
|
223
222
|
name: string | null;
|
|
223
|
+
id: string;
|
|
224
224
|
email: string | null;
|
|
225
225
|
createdAt: Date;
|
|
226
226
|
updatedAt: Date | null;
|
|
@@ -3,8 +3,8 @@ require("../../../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_src_utils_errors = require("../../utils/errors.cjs");
|
|
4
4
|
const require_src_modules_utils_applyPagination = require("../utils/applyPagination.cjs");
|
|
5
5
|
const require_src_modules_utils_applySorting = require("../utils/applySorting.cjs");
|
|
6
|
-
const require_src_modules_utils_getConditionsFromFilters = require("../utils/getConditionsFromFilters.cjs");
|
|
7
6
|
const require_src_modules_utils_getGlobalSearchCondition = require("../utils/getGlobalSearchCondition.cjs");
|
|
7
|
+
const require_src_modules_utils_getConditionsFromFilters = require("../utils/getConditionsFromFilters.cjs");
|
|
8
8
|
const require_src_modules_base_base_abstract = require("./base.abstract.cjs");
|
|
9
9
|
const require_src_modules_base_base_dto = require("./base.dto.cjs");
|
|
10
10
|
let drizzle_orm = require("drizzle-orm");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ServerError } from "../../utils/errors.mjs";
|
|
2
2
|
import { applyPagination } from "../utils/applyPagination.mjs";
|
|
3
3
|
import { applySorting } from "../utils/applySorting.mjs";
|
|
4
|
-
import { getConditionsFromFilters } from "../utils/getConditionsFromFilters.mjs";
|
|
5
4
|
import { pushGlobalSearch } from "../utils/getGlobalSearchCondition.mjs";
|
|
5
|
+
import { getConditionsFromFilters } from "../utils/getConditionsFromFilters.mjs";
|
|
6
6
|
import { Base } from "./base.abstract.mjs";
|
|
7
7
|
import { pickColumns } from "./base.dto.mjs";
|
|
8
8
|
import { and, count, eq, inArray, like, or } from "drizzle-orm";
|
|
@@ -4,7 +4,7 @@ import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
|
|
|
4
4
|
import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
5
5
|
import { InferSelectModel } from "drizzle-orm";
|
|
6
6
|
import { BillingSchema } from "@m5kdev/commons/modules/billing/billing.schema";
|
|
7
|
-
import { Stripe
|
|
7
|
+
import { Stripe } from "stripe";
|
|
8
8
|
import { StripePlan } from "@m5kdev/commons/modules/billing/billing.types";
|
|
9
9
|
|
|
10
10
|
//#region src/modules/billing/billing.repository.d.ts
|
|
@@ -2713,7 +2713,7 @@ declare const schema: {
|
|
|
2713
2713
|
type Schema = typeof schema;
|
|
2714
2714
|
type Orm = LibSQLDatabase<Schema>;
|
|
2715
2715
|
declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<string, never>, Schema["subscriptions"]> {
|
|
2716
|
-
stripe: Stripe
|
|
2716
|
+
stripe: Stripe;
|
|
2717
2717
|
plans: StripePlan[];
|
|
2718
2718
|
trial?: StripePlan;
|
|
2719
2719
|
constructor(options: {
|
|
@@ -2721,7 +2721,7 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2721
2721
|
schema: Schema;
|
|
2722
2722
|
table: Schema["subscriptions"];
|
|
2723
2723
|
libs: {
|
|
2724
|
-
stripe: Stripe
|
|
2724
|
+
stripe: Stripe;
|
|
2725
2725
|
};
|
|
2726
2726
|
config: {
|
|
2727
2727
|
trial?: StripePlan;
|
|
@@ -2730,7 +2730,7 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2730
2730
|
});
|
|
2731
2731
|
hasTrial(): boolean;
|
|
2732
2732
|
getPlanByPriceId(priceId: string): StripePlan | undefined;
|
|
2733
|
-
getCustomerByEmail(email: string): ServerResultAsync<Stripe
|
|
2733
|
+
getCustomerByEmail(email: string): ServerResultAsync<Stripe.Customer | null>;
|
|
2734
2734
|
getUserByCustomerId(customerId: string): ServerResultAsync<InferSelectModel<Schema["users"]> | null>;
|
|
2735
2735
|
createCustomer({
|
|
2736
2736
|
email,
|
|
@@ -2740,8 +2740,8 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2740
2740
|
email: string;
|
|
2741
2741
|
name?: string;
|
|
2742
2742
|
userId: string;
|
|
2743
|
-
}): ServerResultAsync<Stripe
|
|
2744
|
-
createTrialSubscription(customerId: string): ServerResultAsync<Stripe
|
|
2743
|
+
}): ServerResultAsync<Stripe.Customer>;
|
|
2744
|
+
createTrialSubscription(customerId: string): ServerResultAsync<Stripe.Subscription>;
|
|
2745
2745
|
createSubscription({
|
|
2746
2746
|
customerId,
|
|
2747
2747
|
priceId,
|
|
@@ -2752,7 +2752,7 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2752
2752
|
priceId: string;
|
|
2753
2753
|
quantity?: number;
|
|
2754
2754
|
trialDays?: number;
|
|
2755
|
-
}): ServerResultAsync<Stripe
|
|
2755
|
+
}): ServerResultAsync<Stripe.Subscription>;
|
|
2756
2756
|
updateUserCustomerId({
|
|
2757
2757
|
userId,
|
|
2758
2758
|
customerId
|
|
@@ -2762,7 +2762,7 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2762
2762
|
}): ServerResultAsync<InferSelectModel<Schema["users"]>>;
|
|
2763
2763
|
getLatestSubscription(referenceId: string): ServerResultAsync<BillingSchema | null>;
|
|
2764
2764
|
getActiveSubscription(referenceId: string): ServerResultAsync<BillingSchema | null>;
|
|
2765
|
-
listInvoices(customerId: string): ServerResultAsync<Stripe
|
|
2765
|
+
listInvoices(customerId: string): ServerResultAsync<Stripe.Invoice[]>;
|
|
2766
2766
|
createCheckoutSession({
|
|
2767
2767
|
customerId,
|
|
2768
2768
|
priceId,
|
|
@@ -2771,8 +2771,8 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2771
2771
|
customerId: string;
|
|
2772
2772
|
priceId: string;
|
|
2773
2773
|
userId: string;
|
|
2774
|
-
}): ServerResultAsync<Stripe
|
|
2775
|
-
createBillingPortalSession(customerId: string): ServerResultAsync<Stripe
|
|
2774
|
+
}): ServerResultAsync<Stripe.Checkout.Session>;
|
|
2775
|
+
createBillingPortalSession(customerId: string): ServerResultAsync<Stripe.BillingPortal.Session>;
|
|
2776
2776
|
syncStripeData({
|
|
2777
2777
|
customerId,
|
|
2778
2778
|
userId
|
|
@@ -2780,7 +2780,7 @@ declare class BillingRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
2780
2780
|
customerId: string;
|
|
2781
2781
|
userId: string;
|
|
2782
2782
|
}): ServerResultAsync<boolean>;
|
|
2783
|
-
constructEvent(body: Buffer | string, signature: string, secret: string): ServerResult<Stripe
|
|
2783
|
+
constructEvent(body: Buffer | string, signature: string, secret: string): ServerResult<Stripe.Event>;
|
|
2784
2784
|
}
|
|
2785
2785
|
//#endregion
|
|
2786
2786
|
export { BillingRepository };
|
|
@@ -4,7 +4,7 @@ import { BillingRepository } from "./billing.repository.cjs";
|
|
|
4
4
|
import { User } from "../auth/auth.lib.cjs";
|
|
5
5
|
import { BaseService } from "../base/base.service.cjs";
|
|
6
6
|
import { BillingSchema } from "@m5kdev/commons/modules/billing/billing.schema";
|
|
7
|
-
import Stripe from "stripe";
|
|
7
|
+
import Stripe$1 from "stripe";
|
|
8
8
|
|
|
9
9
|
//#region src/modules/billing/billing.service.d.ts
|
|
10
10
|
declare class BillingService extends BaseService<{
|
|
@@ -18,7 +18,7 @@ declare class BillingService extends BaseService<{
|
|
|
18
18
|
email: string;
|
|
19
19
|
name?: string;
|
|
20
20
|
};
|
|
21
|
-
}): ServerResultAsync<Stripe.Customer>;
|
|
21
|
+
}): ServerResultAsync<Stripe$1.Customer>;
|
|
22
22
|
createUserHook({
|
|
23
23
|
user
|
|
24
24
|
}: {
|
|
@@ -29,7 +29,7 @@ declare class BillingService extends BaseService<{
|
|
|
29
29
|
};
|
|
30
30
|
}): ServerResultAsync<boolean>;
|
|
31
31
|
getActiveSubscription(ctx: Context): ServerResultAsync<BillingSchema | null>;
|
|
32
|
-
listInvoices(ctx: Context): ServerResultAsync<Stripe.Invoice[]>;
|
|
32
|
+
listInvoices(ctx: Context): ServerResultAsync<Stripe$1.Invoice[]>;
|
|
33
33
|
createCheckoutSession({
|
|
34
34
|
priceId
|
|
35
35
|
}: {
|
|
@@ -38,15 +38,15 @@ declare class BillingService extends BaseService<{
|
|
|
38
38
|
user
|
|
39
39
|
}: {
|
|
40
40
|
user: User;
|
|
41
|
-
}): ServerResultAsync<Stripe.Checkout.Session>;
|
|
41
|
+
}): ServerResultAsync<Stripe$1.Checkout.Session>;
|
|
42
42
|
createBillingPortalSession({
|
|
43
43
|
user
|
|
44
44
|
}: {
|
|
45
45
|
user: User;
|
|
46
|
-
}): ServerResultAsync<Stripe.BillingPortal.Session>;
|
|
47
|
-
constructEvent(body: Buffer | string, signature: string): ServerResult<Stripe.Event>;
|
|
46
|
+
}): ServerResultAsync<Stripe$1.BillingPortal.Session>;
|
|
47
|
+
constructEvent(body: Buffer | string, signature: string): ServerResult<Stripe$1.Event>;
|
|
48
48
|
syncStripeData(customerId: string, eventType?: string): ServerResultAsync<boolean>;
|
|
49
|
-
processEvent(event: Stripe.Event): ServerResultAsync<boolean>;
|
|
49
|
+
processEvent(event: Stripe$1.Event): ServerResultAsync<boolean>;
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
export { BillingService };
|
|
@@ -30,8 +30,8 @@ declare const connectSelectOutputSchema: z.ZodObject<{
|
|
|
30
30
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
31
31
|
userId: z.ZodString;
|
|
32
32
|
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
-
provider: z.ZodString;
|
|
34
33
|
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
provider: z.ZodString;
|
|
35
35
|
accountType: z.ZodString;
|
|
36
36
|
providerAccountId: z.ZodString;
|
|
37
37
|
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -54,8 +54,8 @@ declare const connectListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
54
54
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
55
55
|
userId: z.ZodString;
|
|
56
56
|
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
-
provider: z.ZodString;
|
|
58
57
|
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
provider: z.ZodString;
|
|
59
59
|
accountType: z.ZodString;
|
|
60
60
|
providerAccountId: z.ZodString;
|
|
61
61
|
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -30,8 +30,8 @@ declare const connectSelectOutputSchema: z.ZodObject<{
|
|
|
30
30
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
31
31
|
userId: z.ZodString;
|
|
32
32
|
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
-
provider: z.ZodString;
|
|
34
33
|
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
provider: z.ZodString;
|
|
35
35
|
accountType: z.ZodString;
|
|
36
36
|
providerAccountId: z.ZodString;
|
|
37
37
|
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -54,8 +54,8 @@ declare const connectListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
54
54
|
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
55
55
|
userId: z.ZodString;
|
|
56
56
|
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
-
provider: z.ZodString;
|
|
58
57
|
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
provider: z.ZodString;
|
|
59
59
|
accountType: z.ZodString;
|
|
60
60
|
providerAccountId: z.ZodString;
|
|
61
61
|
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -401,8 +401,8 @@ declare class ConnectRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
401
401
|
accessToken: string;
|
|
402
402
|
refreshToken: string | null;
|
|
403
403
|
scope: string | null;
|
|
404
|
-
provider: string;
|
|
405
404
|
parentId: string | null;
|
|
405
|
+
provider: string;
|
|
406
406
|
accountType: string;
|
|
407
407
|
providerAccountId: string;
|
|
408
408
|
handle: string | null;
|
|
@@ -401,8 +401,8 @@ declare class ConnectRepository extends BaseTableRepository<Orm, Schema, Record<
|
|
|
401
401
|
accessToken: string;
|
|
402
402
|
refreshToken: string | null;
|
|
403
403
|
scope: string | null;
|
|
404
|
-
provider: string;
|
|
405
404
|
parentId: string | null;
|
|
405
|
+
provider: string;
|
|
406
406
|
accountType: string;
|
|
407
407
|
providerAccountId: string;
|
|
408
408
|
handle: string | null;
|
|
@@ -27,8 +27,8 @@ declare class ConnectService extends BaseService<{
|
|
|
27
27
|
accessToken: string;
|
|
28
28
|
refreshToken: string | null;
|
|
29
29
|
scope: string | null;
|
|
30
|
-
provider: string;
|
|
31
30
|
parentId: string | null;
|
|
31
|
+
provider: string;
|
|
32
32
|
accountType: string;
|
|
33
33
|
providerAccountId: string;
|
|
34
34
|
handle: string | null;
|
|
@@ -48,8 +48,8 @@ declare class ConnectService extends BaseService<{
|
|
|
48
48
|
accessToken: string;
|
|
49
49
|
refreshToken: string | null;
|
|
50
50
|
scope: string | null;
|
|
51
|
-
provider: string;
|
|
52
51
|
parentId: string | null;
|
|
52
|
+
provider: string;
|
|
53
53
|
accountType: string;
|
|
54
54
|
providerAccountId: string;
|
|
55
55
|
handle: string | null;
|
|
@@ -27,8 +27,8 @@ declare class ConnectService extends BaseService<{
|
|
|
27
27
|
accessToken: string;
|
|
28
28
|
refreshToken: string | null;
|
|
29
29
|
scope: string | null;
|
|
30
|
-
provider: string;
|
|
31
30
|
parentId: string | null;
|
|
31
|
+
provider: string;
|
|
32
32
|
accountType: string;
|
|
33
33
|
providerAccountId: string;
|
|
34
34
|
handle: string | null;
|
|
@@ -48,8 +48,8 @@ declare class ConnectService extends BaseService<{
|
|
|
48
48
|
accessToken: string;
|
|
49
49
|
refreshToken: string | null;
|
|
50
50
|
scope: string | null;
|
|
51
|
-
provider: string;
|
|
52
51
|
parentId: string | null;
|
|
52
|
+
provider: string;
|
|
53
53
|
accountType: string;
|
|
54
54
|
providerAccountId: string;
|
|
55
55
|
handle: string | null;
|
|
@@ -17,8 +17,8 @@ declare class RecurrenceService extends BaseService<{
|
|
|
17
17
|
order?: "asc" | "desc" | undefined;
|
|
18
18
|
filters?: {
|
|
19
19
|
columnId: string;
|
|
20
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
21
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
20
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
21
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
22
22
|
value: string | number | boolean | string[];
|
|
23
23
|
valueTo?: string | undefined;
|
|
24
24
|
endColumnId?: string | undefined;
|
|
@@ -30,12 +30,12 @@ declare class RecurrenceService extends BaseService<{
|
|
|
30
30
|
actor: UserActor;
|
|
31
31
|
}, {
|
|
32
32
|
rows: {
|
|
33
|
-
id: string;
|
|
34
33
|
name: string | null;
|
|
34
|
+
id: string;
|
|
35
35
|
createdAt: Date;
|
|
36
36
|
updatedAt: Date;
|
|
37
|
-
metadata: Record<string, any> | null;
|
|
38
37
|
userId: string | null;
|
|
38
|
+
metadata: Record<string, any> | null;
|
|
39
39
|
organizationId: string | null;
|
|
40
40
|
teamId: string | null;
|
|
41
41
|
enabled: boolean;
|
|
@@ -48,8 +48,8 @@ declare class RecurrenceService extends BaseService<{
|
|
|
48
48
|
kind: string;
|
|
49
49
|
enabled: boolean;
|
|
50
50
|
recurrenceRules: {
|
|
51
|
-
interval: number;
|
|
52
51
|
freq: number;
|
|
52
|
+
interval: number;
|
|
53
53
|
bysetpos?: number | number[] | null | undefined;
|
|
54
54
|
bymonth?: number | number[] | null | undefined;
|
|
55
55
|
bymonthday?: number | number[] | null | undefined;
|
|
@@ -17,8 +17,8 @@ declare class RecurrenceService extends BaseService<{
|
|
|
17
17
|
order?: "asc" | "desc" | undefined;
|
|
18
18
|
filters?: {
|
|
19
19
|
columnId: string;
|
|
20
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
21
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
20
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
21
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
22
22
|
value: string | number | boolean | string[];
|
|
23
23
|
valueTo?: string | undefined;
|
|
24
24
|
endColumnId?: string | undefined;
|
|
@@ -30,12 +30,12 @@ declare class RecurrenceService extends BaseService<{
|
|
|
30
30
|
actor: UserActor;
|
|
31
31
|
}, {
|
|
32
32
|
rows: {
|
|
33
|
-
id: string;
|
|
34
33
|
name: string | null;
|
|
34
|
+
id: string;
|
|
35
35
|
createdAt: Date;
|
|
36
36
|
updatedAt: Date;
|
|
37
|
-
metadata: Record<string, any> | null;
|
|
38
37
|
userId: string | null;
|
|
38
|
+
metadata: Record<string, any> | null;
|
|
39
39
|
organizationId: string | null;
|
|
40
40
|
teamId: string | null;
|
|
41
41
|
enabled: boolean;
|
|
@@ -48,8 +48,8 @@ declare class RecurrenceService extends BaseService<{
|
|
|
48
48
|
kind: string;
|
|
49
49
|
enabled: boolean;
|
|
50
50
|
recurrenceRules: {
|
|
51
|
-
interval: number;
|
|
52
51
|
freq: number;
|
|
52
|
+
interval: number;
|
|
53
53
|
bysetpos?: number | number[] | null | undefined;
|
|
54
54
|
bymonth?: number | number[] | null | undefined;
|
|
55
55
|
bymonthday?: number | number[] | null | undefined;
|
|
@@ -20,8 +20,8 @@ declare function createRecurrenceTRPC({
|
|
|
20
20
|
order?: "asc" | "desc" | undefined;
|
|
21
21
|
filters?: {
|
|
22
22
|
columnId: string;
|
|
23
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
24
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
23
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
24
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
25
25
|
value: string | number | boolean | string[];
|
|
26
26
|
valueTo?: string | undefined;
|
|
27
27
|
endColumnId?: string | undefined;
|
|
@@ -51,8 +51,8 @@ declare function createRecurrenceTRPC({
|
|
|
51
51
|
kind: string;
|
|
52
52
|
enabled: boolean;
|
|
53
53
|
recurrenceRules: {
|
|
54
|
-
interval: number;
|
|
55
54
|
freq: number;
|
|
55
|
+
interval: number;
|
|
56
56
|
bysetpos?: number | number[] | null | undefined;
|
|
57
57
|
bymonth?: number | number[] | null | undefined;
|
|
58
58
|
bymonthday?: number | number[] | null | undefined;
|
|
@@ -151,8 +151,8 @@ declare function createRecurrenceTRPC({
|
|
|
151
151
|
updateRule: _$_trpc_server0.TRPCMutationProcedure<{
|
|
152
152
|
input: {
|
|
153
153
|
id: string;
|
|
154
|
-
interval: number;
|
|
155
154
|
freq: number;
|
|
155
|
+
interval: number;
|
|
156
156
|
bysetpos?: number | number[] | null | undefined;
|
|
157
157
|
bymonth?: number | number[] | null | undefined;
|
|
158
158
|
bymonthday?: number | number[] | null | undefined;
|
|
@@ -20,8 +20,8 @@ declare function createRecurrenceTRPC({
|
|
|
20
20
|
order?: "asc" | "desc" | undefined;
|
|
21
21
|
filters?: {
|
|
22
22
|
columnId: string;
|
|
23
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
24
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
23
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
24
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
25
25
|
value: string | number | boolean | string[];
|
|
26
26
|
valueTo?: string | undefined;
|
|
27
27
|
endColumnId?: string | undefined;
|
|
@@ -51,8 +51,8 @@ declare function createRecurrenceTRPC({
|
|
|
51
51
|
kind: string;
|
|
52
52
|
enabled: boolean;
|
|
53
53
|
recurrenceRules: {
|
|
54
|
-
interval: number;
|
|
55
54
|
freq: number;
|
|
55
|
+
interval: number;
|
|
56
56
|
bysetpos?: number | number[] | null | undefined;
|
|
57
57
|
bymonth?: number | number[] | null | undefined;
|
|
58
58
|
bymonthday?: number | number[] | null | undefined;
|
|
@@ -151,8 +151,8 @@ declare function createRecurrenceTRPC({
|
|
|
151
151
|
updateRule: _$_trpc_server0.TRPCMutationProcedure<{
|
|
152
152
|
input: {
|
|
153
153
|
id: string;
|
|
154
|
-
interval: number;
|
|
155
154
|
freq: number;
|
|
155
|
+
interval: number;
|
|
156
156
|
bysetpos?: number | number[] | null | undefined;
|
|
157
157
|
bymonth?: number | number[] | null | undefined;
|
|
158
158
|
bymonthday?: number | number[] | null | undefined;
|
|
@@ -20,8 +20,8 @@ declare function createTagTRPC({
|
|
|
20
20
|
order?: "asc" | "desc" | undefined;
|
|
21
21
|
filters?: {
|
|
22
22
|
columnId: string;
|
|
23
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
24
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
23
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
24
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
25
25
|
value: string | number | boolean | string[];
|
|
26
26
|
valueTo?: string | undefined;
|
|
27
27
|
endColumnId?: string | undefined;
|
|
@@ -54,8 +54,8 @@ declare function createTagTRPC({
|
|
|
54
54
|
resourceType: string;
|
|
55
55
|
resourceIds?: {
|
|
56
56
|
columnId: string;
|
|
57
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
58
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
57
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
58
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
59
59
|
value: string | number | boolean | string[];
|
|
60
60
|
valueTo?: string | undefined;
|
|
61
61
|
endColumnId?: string | undefined;
|
|
@@ -20,8 +20,8 @@ declare function createTagTRPC({
|
|
|
20
20
|
order?: "asc" | "desc" | undefined;
|
|
21
21
|
filters?: {
|
|
22
22
|
columnId: string;
|
|
23
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
24
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
23
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
24
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
25
25
|
value: string | number | boolean | string[];
|
|
26
26
|
valueTo?: string | undefined;
|
|
27
27
|
endColumnId?: string | undefined;
|
|
@@ -54,8 +54,8 @@ declare function createTagTRPC({
|
|
|
54
54
|
resourceType: string;
|
|
55
55
|
resourceIds?: {
|
|
56
56
|
columnId: string;
|
|
57
|
-
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
58
|
-
method: "contains" | "starts_with" | "ends_with" | "
|
|
57
|
+
type: "string" | "number" | "boolean" | "date" | "enum" | "jsonArray";
|
|
58
|
+
method: "contains" | "starts_with" | "ends_with" | "intersect" | "on" | "equals" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
59
59
|
value: string | number | boolean | string[];
|
|
60
60
|
valueTo?: string | undefined;
|
|
61
61
|
endColumnId?: string | undefined;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_src_modules_utils_getGlobalSearchCondition = require("./getGlobalSearchCondition.cjs");
|
|
3
4
|
let drizzle_orm = require("drizzle-orm");
|
|
4
5
|
let luxon = require("luxon");
|
|
5
6
|
//#region src/modules/utils/getConditionsFromFilters.ts
|
|
7
|
+
function getJsonArrayLikeCondition(column, value) {
|
|
8
|
+
return drizzle_orm.sql`${column} LIKE ${`%${require_src_modules_utils_getGlobalSearchCondition.escapeLikeUserInput(JSON.stringify(value))}%`} ESCAPE '\\'`;
|
|
9
|
+
}
|
|
6
10
|
const getUTCDateBoundaries = (isoString) => {
|
|
7
11
|
const dateTime = luxon.DateTime.fromISO(isoString, { zone: "utc" });
|
|
8
12
|
return {
|
|
@@ -22,6 +26,10 @@ const getConditionsFromFilters = (conditions, filters, table) => {
|
|
|
22
26
|
if (method === "isEmpty") conditions.push((0, drizzle_orm.or)((0, drizzle_orm.isNull)(column), (0, drizzle_orm.eq)(column, "")));
|
|
23
27
|
else conditions.push((0, drizzle_orm.and)((0, drizzle_orm.isNotNull)(column), (0, drizzle_orm.ne)(column, "")));
|
|
24
28
|
continue;
|
|
29
|
+
case "jsonArray":
|
|
30
|
+
if (method === "isEmpty") conditions.push((0, drizzle_orm.or)((0, drizzle_orm.isNull)(column), (0, drizzle_orm.eq)(column, ""), (0, drizzle_orm.eq)(column, "[]")));
|
|
31
|
+
else conditions.push((0, drizzle_orm.and)((0, drizzle_orm.isNotNull)(column), (0, drizzle_orm.ne)(column, ""), (0, drizzle_orm.ne)(column, "[]")));
|
|
32
|
+
continue;
|
|
25
33
|
case "number":
|
|
26
34
|
if (method === "isEmpty") conditions.push((0, drizzle_orm.or)((0, drizzle_orm.isNull)(column), (0, drizzle_orm.eq)(column, 0)));
|
|
27
35
|
else conditions.push((0, drizzle_orm.and)((0, drizzle_orm.isNotNull)(column), (0, drizzle_orm.ne)(column, 0)));
|
|
@@ -142,6 +150,30 @@ const getConditionsFromFilters = (conditions, filters, table) => {
|
|
|
142
150
|
break;
|
|
143
151
|
}
|
|
144
152
|
break;
|
|
153
|
+
case "jsonArray":
|
|
154
|
+
switch (method) {
|
|
155
|
+
case "oneOf":
|
|
156
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
157
|
+
const clauses = value.filter((v) => typeof v === "string" && v.length > 0).map((v) => getJsonArrayLikeCondition(column, v));
|
|
158
|
+
if (clauses.length === 1) conditions.push(clauses[0]);
|
|
159
|
+
else if (clauses.length > 1) conditions.push((0, drizzle_orm.or)(...clauses));
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case "equals":
|
|
163
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
164
|
+
const clauses = value.filter((v) => typeof v === "string" && v.length > 0).map((v) => getJsonArrayLikeCondition(column, v));
|
|
165
|
+
if (clauses.length === 1) conditions.push(clauses[0]);
|
|
166
|
+
else if (clauses.length > 1) conditions.push((0, drizzle_orm.and)(...clauses));
|
|
167
|
+
}
|
|
168
|
+
break;
|
|
169
|
+
case "is_null":
|
|
170
|
+
conditions.push((0, drizzle_orm.isNull)(column));
|
|
171
|
+
break;
|
|
172
|
+
case "is_not_null":
|
|
173
|
+
conditions.push((0, drizzle_orm.isNotNull)(column));
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
145
177
|
}
|
|
146
178
|
}
|
|
147
179
|
return conditions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConditionsFromFilters.cjs","names":["DateTime"],"sources":["../../../../src/modules/utils/getConditionsFromFilters.ts"],"sourcesContent":["import type { QueryFilters } from \"@m5kdev/commons/modules/schemas/query.schema\";\r\nimport { and, between, eq, gte, inArray, isNotNull, isNull, like, lte, ne, or } from \"drizzle-orm\";\r\nimport type { SQLiteTableWithColumns } from \"drizzle-orm/sqlite-core\";\r\nimport { DateTime } from \"luxon\";\r\nimport type { ConditionBuilder } from \"../base/base.repository\";\r\n\r\ntype ColumnDataType = \"string\" | \"number\" | \"date\" | \"boolean\" | \"enum\";\r\n\r\n// Helper: Create UTC date boundaries from ISO string\r\nconst getUTCDateBoundaries = (isoString: string) => {\r\n const dateTime = DateTime.fromISO(isoString, { zone: \"utc\" });\r\n return {\r\n start: dateTime.startOf(\"day\").toJSDate(),\r\n end: dateTime.endOf(\"day\").toJSDate(),\r\n };\r\n};\r\n\r\nexport const getConditionsFromFilters = <T extends SQLiteTableWithColumns<any>>(\r\n conditions: ConditionBuilder,\r\n filters: QueryFilters | undefined,\r\n table: T\r\n): ConditionBuilder => {\r\n if (!filters || filters.length === 0) {\r\n return conditions;\r\n }\r\n\r\n // Process each filter (maximum one filter per column)\r\n for (const filter of filters) {\r\n const { columnId, type, method, value, valueTo } = filter;\r\n\r\n // Get the column from the table using columnId\r\n const column = (table as any)[columnId];\r\n if (!column) {\r\n continue; // Skip if column doesn't exist\r\n }\r\n\r\n // Handle isEmpty/isNotEmpty methods (work across types, ignore value)\r\n if (method === \"isEmpty\" || method === \"isNotEmpty\") {\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n case \"enum\":\r\n // isEmpty: IS NULL OR = ''\r\n // isNotEmpty: IS NOT NULL AND != ''\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, \"\")));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, \"\")));\r\n }\r\n continue;\r\n case \"number\":\r\n // isEmpty: IS NULL OR = 0\r\n // isNotEmpty: IS NOT NULL AND != 0\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, 0)));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, 0)));\r\n }\r\n continue;\r\n case \"boolean\":\r\n // Should not happen per plan, but handle gracefully\r\n continue;\r\n default:\r\n continue;\r\n }\r\n }\r\n\r\n // Apply filter based on type and method\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n switch (method) {\r\n case \"contains\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}%`));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"starts_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `${value}%`));\r\n }\r\n break;\r\n case \"ends_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}`));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"number\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"number\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"greater_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(gte(column, value));\r\n }\r\n break;\r\n case \"less_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(lte(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"date\":\r\n if (typeof value !== \"string\") break;\r\n\r\n switch (method) {\r\n case \"on\": {\r\n const { start, end } = getUTCDateBoundaries(value);\r\n conditions.push(and(gte(column, start), lte(column, end)));\r\n break;\r\n }\r\n case \"between\":\r\n if (valueTo) {\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n conditions.push(between(column, start, end));\r\n }\r\n break;\r\n case \"before\": {\r\n const { end } = getUTCDateBoundaries(value);\r\n conditions.push(lte(column, end));\r\n break;\r\n }\r\n case \"after\": {\r\n const { start } = getUTCDateBoundaries(value);\r\n conditions.push(gte(column, start));\r\n break;\r\n }\r\n case \"intersect\": {\r\n // Interval overlap: [columnId, endColumnId] intersects with [value, valueTo]\r\n // Logic: columnId <= valueTo AND (endColumnId IS NULL OR endColumnId >= value)\r\n if (!valueTo || !filter.endColumnId) break;\r\n\r\n const endColumn = (table as any)[filter.endColumnId];\r\n if (!endColumn) break;\r\n\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n\r\n conditions.push(and(lte(column, end), or(isNull(endColumn), gte(endColumn, start))));\r\n break;\r\n }\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"boolean\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"boolean\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n\r\n break;\r\n\r\n case \"enum\":\r\n switch (method) {\r\n case \"oneOf\":\r\n if (Array.isArray(value) && value.length > 0) {\r\n conditions.push(inArray(column, value));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));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C,YAAW,MAAA,GAAA,YAAA,SAAa,QAAQ,MAAM,CAAC;AAEzC;KACF,KAAK;AACH,UAAI,OAAO,UAAU,SACnB,YAAW,MAAA,GAAA,YAAA,IAAQ,QAAQ,MAAM,CAAC;AAEpC;KACF,KAAK;AACH,iBAAW,MAAA,GAAA,YAAA,QAAY,OAAO,CAAC;AAC/B;KACF,KAAK;AACH,iBAAW,MAAA,GAAA,YAAA,WAAe,OAAO,CAAC;AAClC;;AAEJ;;;AAIN,QAAO"}
|
|
1
|
+
{"version":3,"file":"getConditionsFromFilters.cjs","names":["escapeLikeUserInput","DateTime"],"sources":["../../../../src/modules/utils/getConditionsFromFilters.ts"],"sourcesContent":["import type { QueryFilters } from \"@m5kdev/commons/modules/schemas/query.schema\";\r\nimport {\r\n and,\r\n between,\r\n eq,\r\n gte,\r\n inArray,\r\n isNotNull,\r\n isNull,\r\n like,\r\n lte,\r\n ne,\r\n or,\r\n sql,\r\n} from \"drizzle-orm\";\r\nimport type { SQLiteColumn, SQLiteTableWithColumns } from \"drizzle-orm/sqlite-core\";\r\nimport { DateTime } from \"luxon\";\r\nimport type { ConditionBuilder } from \"../base/base.repository\";\r\nimport { escapeLikeUserInput } from \"./getGlobalSearchCondition\";\r\n\r\ntype ColumnDataType = \"string\" | \"number\" | \"date\" | \"boolean\" | \"enum\" | \"jsonArray\";\r\n\r\nfunction getJsonArrayLikeCondition(\r\n column: SQLiteColumn,\r\n value: string\r\n): ReturnType<typeof sql> {\r\n // We store JSON arrays as TEXT (e.g. [\"a\",\"b\"]). To avoid partial token matches,\r\n // search for the JSON-stringified element, including quotes/escapes.\r\n const needle = JSON.stringify(value);\r\n const pattern = `%${escapeLikeUserInput(needle)}%`;\r\n return sql`${column} LIKE ${pattern} ESCAPE '\\\\'`;\r\n}\r\n\r\n// Helper: Create UTC date boundaries from ISO string\r\nconst getUTCDateBoundaries = (isoString: string) => {\r\n const dateTime = DateTime.fromISO(isoString, { zone: \"utc\" });\r\n return {\r\n start: dateTime.startOf(\"day\").toJSDate(),\r\n end: dateTime.endOf(\"day\").toJSDate(),\r\n };\r\n};\r\n\r\n// biome-ignore lint/suspicious/noExplicitAny: Drizzle TableConfig is complex; we access columns dynamically by `columnId`.\r\nexport const getConditionsFromFilters = <T extends SQLiteTableWithColumns<any>>(\r\n conditions: ConditionBuilder,\r\n filters: QueryFilters | undefined,\r\n table: T\r\n): ConditionBuilder => {\r\n if (!filters || filters.length === 0) {\r\n return conditions;\r\n }\r\n\r\n // Process each filter (maximum one filter per column)\r\n for (const filter of filters) {\r\n const { columnId, type, method, value, valueTo } = filter;\r\n\r\n // Get the column from the table using columnId\r\n const column = (table as unknown as Record<string, SQLiteColumn>)[columnId];\r\n if (!column) {\r\n continue; // Skip if column doesn't exist\r\n }\r\n\r\n // Handle isEmpty/isNotEmpty methods (work across types, ignore value)\r\n if (method === \"isEmpty\" || method === \"isNotEmpty\") {\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n case \"enum\":\r\n // isEmpty: IS NULL OR = ''\r\n // isNotEmpty: IS NOT NULL AND != ''\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, \"\")));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, \"\")));\r\n }\r\n continue;\r\n case \"jsonArray\":\r\n // isEmpty: IS NULL OR = '' OR = '[]'\r\n // isNotEmpty: IS NOT NULL AND != '' AND != '[]'\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, \"\"), eq(column, \"[]\")));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, \"\"), ne(column, \"[]\")));\r\n }\r\n continue;\r\n case \"number\":\r\n // isEmpty: IS NULL OR = 0\r\n // isNotEmpty: IS NOT NULL AND != 0\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, 0)));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, 0)));\r\n }\r\n continue;\r\n case \"boolean\":\r\n // Should not happen per plan, but handle gracefully\r\n continue;\r\n default:\r\n continue;\r\n }\r\n }\r\n\r\n // Apply filter based on type and method\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n switch (method) {\r\n case \"contains\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}%`));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"starts_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `${value}%`));\r\n }\r\n break;\r\n case \"ends_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}`));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"number\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"number\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"greater_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(gte(column, value));\r\n }\r\n break;\r\n case \"less_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(lte(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"date\":\r\n if (typeof value !== \"string\") break;\r\n\r\n switch (method) {\r\n case \"on\": {\r\n const { start, end } = getUTCDateBoundaries(value);\r\n conditions.push(and(gte(column, start), lte(column, end)));\r\n break;\r\n }\r\n case \"between\":\r\n if (valueTo) {\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n conditions.push(between(column, start, end));\r\n }\r\n break;\r\n case \"before\": {\r\n const { end } = getUTCDateBoundaries(value);\r\n conditions.push(lte(column, end));\r\n break;\r\n }\r\n case \"after\": {\r\n const { start } = getUTCDateBoundaries(value);\r\n conditions.push(gte(column, start));\r\n break;\r\n }\r\n case \"intersect\": {\r\n // Interval overlap: [columnId, endColumnId] intersects with [value, valueTo]\r\n // Logic: columnId <= valueTo AND (endColumnId IS NULL OR endColumnId >= value)\r\n if (!valueTo || !filter.endColumnId) break;\r\n\r\n const endColumn = (table as unknown as Record<string, SQLiteColumn>)[filter.endColumnId];\r\n if (!endColumn) break;\r\n\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n\r\n conditions.push(and(lte(column, end), or(isNull(endColumn), gte(endColumn, start))));\r\n break;\r\n }\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"boolean\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"boolean\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n\r\n break;\r\n\r\n case \"enum\":\r\n switch (method) {\r\n case \"oneOf\":\r\n if (Array.isArray(value) && value.length > 0) {\r\n conditions.push(inArray(column, value));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"jsonArray\":\r\n switch (method) {\r\n case \"oneOf\": {\r\n if (Array.isArray(value) && value.length > 0) {\r\n const clauses = value\r\n .filter((v): v is string => typeof v === \"string\" && v.length > 0)\r\n .map((v) => getJsonArrayLikeCondition(column, v));\r\n\r\n if (clauses.length === 1) {\r\n conditions.push(clauses[0]);\r\n } else if (clauses.length > 1) {\r\n conditions.push(or(...clauses));\r\n }\r\n }\r\n break;\r\n }\r\n case \"equals\": {\r\n if (Array.isArray(value) && value.length > 0) {\r\n const clauses = value\r\n .filter((v): v is string => typeof v === \"string\" && v.length > 0)\r\n .map((v) => getJsonArrayLikeCondition(column, v));\r\n\r\n if (clauses.length === 1) {\r\n conditions.push(clauses[0]);\r\n } else if (clauses.length > 1) {\r\n conditions.push(and(...clauses));\r\n }\r\n }\r\n break;\r\n }\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return conditions;\r\n};\r\n"],"mappings":";;;;;;AAsBA,SAAS,0BACP,QACA,OACwB;AAKxB,QAAO,YAAA,GAAG,GAAG,OAAO,QADJ,IAAIA,mDAAAA,oBADL,KAAK,UAAU,MAAM,CACW,CAAC,GACZ;;AAItC,MAAM,wBAAwB,cAAsB;CAClD,MAAM,WAAWC,MAAAA,SAAS,QAAQ,WAAW,EAAE,MAAM,OAAO,CAAC;AAC7D,QAAO;EACL,OAAO,SAAS,QAAQ,MAAM,CAAC,UAAU;EACzC,KAAK,SAAS,MAAM,MAAM,CAAC,UAAU;EACtC;;AAIH,MAAa,4BACX,YACA,SACA,UACqB;AACrB,KAAI,CAAC,WAAW,QAAQ,WAAW,EACjC,QAAO;AAIT,MAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,EAAE,UAAU,MAAM,QAAQ,OAAO,YAAY;EAGnD,MAAM,SAAU,MAAkD;AAClE,MAAI,CAAC,OACH;AAIF,MAAI,WAAW,aAAa,WAAW,aACrC,SAAQ,MAAR;GACE,KAAK;GACL,KAAK;AAGH,QAAI,WAAW,UACb,YAAW,MAAA,GAAA,YAAA,KAAA,GAAA,YAAA,QAAe,OAAO,GAAA,GAAA,YAAA,IAAK,QAAQ,GAAG,CAAC,CAAC;QAEnD,YAAW,MAAA,GAAA,YAAA,MAAA,GAAA,YAAA,WAAmB,OAAO,GAAA,GAAA,YAAA,IAAK,QAAQ,GAAG,CAAC,CAAC;AAEzD;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KAAK,MAAM,0BAA0B,QAAQ,EAAE,CAAC;AAEnD,WAAI,QAAQ,WAAW,EACrB,YAAW,KAAK,QAAQ,GAAG;gBAClB,QAAQ,SAAS,EAC1B,YAAW,MAAA,GAAA,YAAA,IAAQ,GAAG,QAAQ,CAAC;;AAGnC;KAEF,KAAK;AACH,UAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,GAAG;OAC5C,MAAM,UAAU,MACb,QAAQ,MAAmB,OAAO,MAAM,YAAY,EAAE,SAAS,EAAE,CACjE,KAAK,MAAM,0BAA0B,QAAQ,EAAE,CAAC;AAEnD,WAAI,QAAQ,WAAW,EACrB,YAAW,KAAK,QAAQ,GAAG;gBAClB,QAAQ,SAAS,EAC1B,YAAW,MAAA,GAAA,YAAA,KAAS,GAAG,QAAQ,CAAC;;AAGpC;KAEF,KAAK;AACH,iBAAW,MAAA,GAAA,YAAA,QAAY,OAAO,CAAC;AAC/B;KACF,KAAK;AACH,iBAAW,MAAA,GAAA,YAAA,WAAe,OAAO,CAAC;AAClC;;AAEJ;;;AAIN,QAAO"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { escapeLikeUserInput } from "./getGlobalSearchCondition.mjs";
|
|
2
|
+
import { and, between, eq, gte, inArray, isNotNull, isNull, like, lte, ne, or, sql } from "drizzle-orm";
|
|
2
3
|
import { DateTime } from "luxon";
|
|
3
4
|
//#region src/modules/utils/getConditionsFromFilters.ts
|
|
5
|
+
function getJsonArrayLikeCondition(column, value) {
|
|
6
|
+
return sql`${column} LIKE ${`%${escapeLikeUserInput(JSON.stringify(value))}%`} ESCAPE '\\'`;
|
|
7
|
+
}
|
|
4
8
|
const getUTCDateBoundaries = (isoString) => {
|
|
5
9
|
const dateTime = DateTime.fromISO(isoString, { zone: "utc" });
|
|
6
10
|
return {
|
|
@@ -20,6 +24,10 @@ const getConditionsFromFilters = (conditions, filters, table) => {
|
|
|
20
24
|
if (method === "isEmpty") conditions.push(or(isNull(column), eq(column, "")));
|
|
21
25
|
else conditions.push(and(isNotNull(column), ne(column, "")));
|
|
22
26
|
continue;
|
|
27
|
+
case "jsonArray":
|
|
28
|
+
if (method === "isEmpty") conditions.push(or(isNull(column), eq(column, ""), eq(column, "[]")));
|
|
29
|
+
else conditions.push(and(isNotNull(column), ne(column, ""), ne(column, "[]")));
|
|
30
|
+
continue;
|
|
23
31
|
case "number":
|
|
24
32
|
if (method === "isEmpty") conditions.push(or(isNull(column), eq(column, 0)));
|
|
25
33
|
else conditions.push(and(isNotNull(column), ne(column, 0)));
|
|
@@ -140,6 +148,30 @@ const getConditionsFromFilters = (conditions, filters, table) => {
|
|
|
140
148
|
break;
|
|
141
149
|
}
|
|
142
150
|
break;
|
|
151
|
+
case "jsonArray":
|
|
152
|
+
switch (method) {
|
|
153
|
+
case "oneOf":
|
|
154
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
155
|
+
const clauses = value.filter((v) => typeof v === "string" && v.length > 0).map((v) => getJsonArrayLikeCondition(column, v));
|
|
156
|
+
if (clauses.length === 1) conditions.push(clauses[0]);
|
|
157
|
+
else if (clauses.length > 1) conditions.push(or(...clauses));
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case "equals":
|
|
161
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
162
|
+
const clauses = value.filter((v) => typeof v === "string" && v.length > 0).map((v) => getJsonArrayLikeCondition(column, v));
|
|
163
|
+
if (clauses.length === 1) conditions.push(clauses[0]);
|
|
164
|
+
else if (clauses.length > 1) conditions.push(and(...clauses));
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
case "is_null":
|
|
168
|
+
conditions.push(isNull(column));
|
|
169
|
+
break;
|
|
170
|
+
case "is_not_null":
|
|
171
|
+
conditions.push(isNotNull(column));
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
143
175
|
}
|
|
144
176
|
}
|
|
145
177
|
return conditions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConditionsFromFilters.mjs","names":[],"sources":["../../../../src/modules/utils/getConditionsFromFilters.ts"],"sourcesContent":["import type { QueryFilters } from \"@m5kdev/commons/modules/schemas/query.schema\";\r\nimport { and, between, eq, gte, inArray, isNotNull, isNull, like, lte, ne, or } from \"drizzle-orm\";\r\nimport type { SQLiteTableWithColumns } from \"drizzle-orm/sqlite-core\";\r\nimport { DateTime } from \"luxon\";\r\nimport type { ConditionBuilder } from \"../base/base.repository\";\r\n\r\ntype ColumnDataType = \"string\" | \"number\" | \"date\" | \"boolean\" | \"enum\";\r\n\r\n// Helper: Create UTC date boundaries from ISO string\r\nconst getUTCDateBoundaries = (isoString: string) => {\r\n const dateTime = DateTime.fromISO(isoString, { zone: \"utc\" });\r\n return {\r\n start: dateTime.startOf(\"day\").toJSDate(),\r\n end: dateTime.endOf(\"day\").toJSDate(),\r\n };\r\n};\r\n\r\nexport const getConditionsFromFilters = <T extends SQLiteTableWithColumns<any>>(\r\n conditions: ConditionBuilder,\r\n filters: QueryFilters | undefined,\r\n table: T\r\n): ConditionBuilder => {\r\n if (!filters || filters.length === 0) {\r\n return conditions;\r\n }\r\n\r\n // Process each filter (maximum one filter per column)\r\n for (const filter of filters) {\r\n const { columnId, type, method, value, valueTo } = filter;\r\n\r\n // Get the column from the table using columnId\r\n const column = (table as any)[columnId];\r\n if (!column) {\r\n continue; // Skip if column doesn't exist\r\n }\r\n\r\n // Handle isEmpty/isNotEmpty methods (work across types, ignore value)\r\n if (method === \"isEmpty\" || method === \"isNotEmpty\") {\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n case \"enum\":\r\n // isEmpty: IS NULL OR = ''\r\n // isNotEmpty: IS NOT NULL AND != ''\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, \"\")));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, \"\")));\r\n }\r\n continue;\r\n case \"number\":\r\n // isEmpty: IS NULL OR = 0\r\n // isNotEmpty: IS NOT NULL AND != 0\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, 0)));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, 0)));\r\n }\r\n continue;\r\n case \"boolean\":\r\n // Should not happen per plan, but handle gracefully\r\n continue;\r\n default:\r\n continue;\r\n }\r\n }\r\n\r\n // Apply filter based on type and method\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n switch (method) {\r\n case \"contains\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}%`));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"starts_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `${value}%`));\r\n }\r\n break;\r\n case \"ends_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}`));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"number\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"number\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"greater_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(gte(column, value));\r\n }\r\n break;\r\n case \"less_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(lte(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"date\":\r\n if (typeof value !== \"string\") break;\r\n\r\n switch (method) {\r\n case \"on\": {\r\n const { start, end } = getUTCDateBoundaries(value);\r\n conditions.push(and(gte(column, start), lte(column, end)));\r\n break;\r\n }\r\n case \"between\":\r\n if (valueTo) {\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n conditions.push(between(column, start, end));\r\n }\r\n break;\r\n case \"before\": {\r\n const { end } = getUTCDateBoundaries(value);\r\n conditions.push(lte(column, end));\r\n break;\r\n }\r\n case \"after\": {\r\n const { start } = getUTCDateBoundaries(value);\r\n conditions.push(gte(column, start));\r\n break;\r\n }\r\n case \"intersect\": {\r\n // Interval overlap: [columnId, endColumnId] intersects with [value, valueTo]\r\n // Logic: columnId <= valueTo AND (endColumnId IS NULL OR endColumnId >= value)\r\n if (!valueTo || !filter.endColumnId) break;\r\n\r\n const endColumn = (table as any)[filter.endColumnId];\r\n if (!endColumn) break;\r\n\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n\r\n conditions.push(and(lte(column, end), or(isNull(endColumn), gte(endColumn, start))));\r\n break;\r\n }\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"boolean\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"boolean\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n\r\n break;\r\n\r\n case \"enum\":\r\n switch (method) {\r\n case \"oneOf\":\r\n if (Array.isArray(value) && value.length > 0) {\r\n conditions.push(inArray(column, value));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return conditions;\r\n};\r\n"],"mappings":";;;AASA,MAAM,wBAAwB,cAAsB;CAClD,MAAM,WAAW,SAAS,QAAQ,WAAW,EAAE,MAAM,OAAO,CAAC;AAC7D,QA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AQ,qBAAqB,QAAQ;AAE7C,iBAAW,KAAK,IAAI,IAAI,QAAQ,IAAI,EAAE,GAAG,OAAO,UAAU,EAAE,IAAI,WAAW,MAAM,CAAC,CAAC,CAAC;AACpF;;KAEF,KAAK;AACH,iBAAW,KAAK,OAAO,OAAO,CAAC;AAC/B;KACF,KAAK;AACH,iBAAW,KAAK,UAAU,OAAO,CAAC;AAClC;;AAEJ;GAEF,KAAK;AACH,YAAQ,QAAR;KACE,KAAK;AACH,UAAI,OAAO,UAAU,UACnB,YAAW,KAAK,GAAG,QAAQ,MAAM,CAAC;AAEpC;KACF,KAAK;AACH,iBAAW,KAAK,OAAO,OAAO,CAAC;AAC/B;KACF,KAAK;AACH,iBAAW,KAAK,UAAU,OAAO,CAAC;AAClC;;AAGJ;GAEF,KAAK;AACH,YAAQ,QAAR;KACE,KAAK;AACH,UAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,EACzC,YAAW,KAAK,QAAQ,QAAQ,MAAM,CAAC;AAEzC;KACF,KAAK;AACH,UAAI,OAAO,UAAU,SACnB,YAAW,KAAK,GAAG,QAAQ,MAAM,CAAC;AAEpC;KACF,KAAK;AACH,iBAAW,KAAK,OAAO,OAAO,CAAC;AAC/B;KACF,KAAK;AACH,iBAAW,KAAK,UAAU,OAAO,CAAC;AAClC;;AAEJ;;;AAIN,QAAO"}
|
|
1
|
+
{"version":3,"file":"getConditionsFromFilters.mjs","names":[],"sources":["../../../../src/modules/utils/getConditionsFromFilters.ts"],"sourcesContent":["import type { QueryFilters } from \"@m5kdev/commons/modules/schemas/query.schema\";\r\nimport {\r\n and,\r\n between,\r\n eq,\r\n gte,\r\n inArray,\r\n isNotNull,\r\n isNull,\r\n like,\r\n lte,\r\n ne,\r\n or,\r\n sql,\r\n} from \"drizzle-orm\";\r\nimport type { SQLiteColumn, SQLiteTableWithColumns } from \"drizzle-orm/sqlite-core\";\r\nimport { DateTime } from \"luxon\";\r\nimport type { ConditionBuilder } from \"../base/base.repository\";\r\nimport { escapeLikeUserInput } from \"./getGlobalSearchCondition\";\r\n\r\ntype ColumnDataType = \"string\" | \"number\" | \"date\" | \"boolean\" | \"enum\" | \"jsonArray\";\r\n\r\nfunction getJsonArrayLikeCondition(\r\n column: SQLiteColumn,\r\n value: string\r\n): ReturnType<typeof sql> {\r\n // We store JSON arrays as TEXT (e.g. [\"a\",\"b\"]). To avoid partial token matches,\r\n // search for the JSON-stringified element, including quotes/escapes.\r\n const needle = JSON.stringify(value);\r\n const pattern = `%${escapeLikeUserInput(needle)}%`;\r\n return sql`${column} LIKE ${pattern} ESCAPE '\\\\'`;\r\n}\r\n\r\n// Helper: Create UTC date boundaries from ISO string\r\nconst getUTCDateBoundaries = (isoString: string) => {\r\n const dateTime = DateTime.fromISO(isoString, { zone: \"utc\" });\r\n return {\r\n start: dateTime.startOf(\"day\").toJSDate(),\r\n end: dateTime.endOf(\"day\").toJSDate(),\r\n };\r\n};\r\n\r\n// biome-ignore lint/suspicious/noExplicitAny: Drizzle TableConfig is complex; we access columns dynamically by `columnId`.\r\nexport const getConditionsFromFilters = <T extends SQLiteTableWithColumns<any>>(\r\n conditions: ConditionBuilder,\r\n filters: QueryFilters | undefined,\r\n table: T\r\n): ConditionBuilder => {\r\n if (!filters || filters.length === 0) {\r\n return conditions;\r\n }\r\n\r\n // Process each filter (maximum one filter per column)\r\n for (const filter of filters) {\r\n const { columnId, type, method, value, valueTo } = filter;\r\n\r\n // Get the column from the table using columnId\r\n const column = (table as unknown as Record<string, SQLiteColumn>)[columnId];\r\n if (!column) {\r\n continue; // Skip if column doesn't exist\r\n }\r\n\r\n // Handle isEmpty/isNotEmpty methods (work across types, ignore value)\r\n if (method === \"isEmpty\" || method === \"isNotEmpty\") {\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n case \"enum\":\r\n // isEmpty: IS NULL OR = ''\r\n // isNotEmpty: IS NOT NULL AND != ''\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, \"\")));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, \"\")));\r\n }\r\n continue;\r\n case \"jsonArray\":\r\n // isEmpty: IS NULL OR = '' OR = '[]'\r\n // isNotEmpty: IS NOT NULL AND != '' AND != '[]'\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, \"\"), eq(column, \"[]\")));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, \"\"), ne(column, \"[]\")));\r\n }\r\n continue;\r\n case \"number\":\r\n // isEmpty: IS NULL OR = 0\r\n // isNotEmpty: IS NOT NULL AND != 0\r\n if (method === \"isEmpty\") {\r\n conditions.push(or(isNull(column), eq(column, 0)));\r\n } else {\r\n conditions.push(and(isNotNull(column), ne(column, 0)));\r\n }\r\n continue;\r\n case \"boolean\":\r\n // Should not happen per plan, but handle gracefully\r\n continue;\r\n default:\r\n continue;\r\n }\r\n }\r\n\r\n // Apply filter based on type and method\r\n switch (type as ColumnDataType) {\r\n case \"string\":\r\n switch (method) {\r\n case \"contains\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}%`));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"starts_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `${value}%`));\r\n }\r\n break;\r\n case \"ends_with\":\r\n if (typeof value === \"string\") {\r\n conditions.push(like(column, `%${value}`));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"number\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"number\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"greater_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(gte(column, value));\r\n }\r\n break;\r\n case \"less_than\":\r\n if (typeof value === \"number\") {\r\n conditions.push(lte(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"date\":\r\n if (typeof value !== \"string\") break;\r\n\r\n switch (method) {\r\n case \"on\": {\r\n const { start, end } = getUTCDateBoundaries(value);\r\n conditions.push(and(gte(column, start), lte(column, end)));\r\n break;\r\n }\r\n case \"between\":\r\n if (valueTo) {\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n conditions.push(between(column, start, end));\r\n }\r\n break;\r\n case \"before\": {\r\n const { end } = getUTCDateBoundaries(value);\r\n conditions.push(lte(column, end));\r\n break;\r\n }\r\n case \"after\": {\r\n const { start } = getUTCDateBoundaries(value);\r\n conditions.push(gte(column, start));\r\n break;\r\n }\r\n case \"intersect\": {\r\n // Interval overlap: [columnId, endColumnId] intersects with [value, valueTo]\r\n // Logic: columnId <= valueTo AND (endColumnId IS NULL OR endColumnId >= value)\r\n if (!valueTo || !filter.endColumnId) break;\r\n\r\n const endColumn = (table as unknown as Record<string, SQLiteColumn>)[filter.endColumnId];\r\n if (!endColumn) break;\r\n\r\n const { start } = getUTCDateBoundaries(value);\r\n const { end } = getUTCDateBoundaries(valueTo);\r\n\r\n conditions.push(and(lte(column, end), or(isNull(endColumn), gte(endColumn, start))));\r\n break;\r\n }\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"boolean\":\r\n switch (method) {\r\n case \"equals\":\r\n if (typeof value === \"boolean\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n\r\n break;\r\n\r\n case \"enum\":\r\n switch (method) {\r\n case \"oneOf\":\r\n if (Array.isArray(value) && value.length > 0) {\r\n conditions.push(inArray(column, value));\r\n }\r\n break;\r\n case \"equals\":\r\n if (typeof value === \"string\") {\r\n conditions.push(eq(column, value));\r\n }\r\n break;\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n\r\n case \"jsonArray\":\r\n switch (method) {\r\n case \"oneOf\": {\r\n if (Array.isArray(value) && value.length > 0) {\r\n const clauses = value\r\n .filter((v): v is string => typeof v === \"string\" && v.length > 0)\r\n .map((v) => getJsonArrayLikeCondition(column, v));\r\n\r\n if (clauses.length === 1) {\r\n conditions.push(clauses[0]);\r\n } else if (clauses.length > 1) {\r\n conditions.push(or(...clauses));\r\n }\r\n }\r\n break;\r\n }\r\n case \"equals\": {\r\n if (Array.isArray(value) && value.length > 0) {\r\n const clauses = value\r\n .filter((v): v is string => typeof v === \"string\" && v.length > 0)\r\n .map((v) => getJsonArrayLikeCondition(column, v));\r\n\r\n if (clauses.length === 1) {\r\n conditions.push(clauses[0]);\r\n } else if (clauses.length > 1) {\r\n conditions.push(and(...clauses));\r\n }\r\n }\r\n break;\r\n }\r\n case \"is_null\":\r\n conditions.push(isNull(column));\r\n break;\r\n case \"is_not_null\":\r\n conditions.push(isNotNull(column));\r\n break;\r\n }\r\n break;\r\n }\r\n }\r\n\r\n return conditions;\r\n};\r\n"],"mappings":";;;;AAsBA,SAAS,0BACP,QACA,OACwB;AAKxB,QAAO,GAAG,GAAG,OAAO,QADJ,IAAI,oBADL,KAAK,UAAU,MAAM,CACW,CAAC,GACZ;;AAItC,MAAM,wBAAwB,cAAsB;CAClD,MAAM,WAAW,SAAS,QAAQ,WAAW,EAAE,MAAM,OAAO,CAAC;AAC7D,QAAO;EACL,OAAO,SAAS,QAAQ,MAAM,CAAC,UAAU;EACzC,KAAK,SAAS,MAAM,MAAM,CAAC,UAAU;EACtC;;AAIH,MAAa,4BACX,YACA,SACA,UACqB;AACrB,KAAI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K,GAAG,GAAG,QAAQ,CAAC;;AAGnC;KAEF,KAAK;AACH,UAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,GAAG;OAC5C,MAAM,UAAU,MACb,QAAQ,MAAmB,OAAO,MAAM,YAAY,EAAE,SAAS,EAAE,CACjE,KAAK,MAAM,0BAA0B,QAAQ,EAAE,CAAC;AAEnD,WAAI,QAAQ,WAAW,EACrB,YAAW,KAAK,QAAQ,GAAG;gBAClB,QAAQ,SAAS,EAC1B,YAAW,KAAK,IAAI,GAAG,QAAQ,CAAC;;AAGpC;KAEF,KAAK;AACH,iBAAW,KAAK,OAAO,OAAO,CAAC;AAC/B;KACF,KAAK;AACH,iBAAW,KAAK,UAAU,OAAO,CAAC;AAClC;;AAEJ;;;AAIN,QAAO"}
|
package/dist/src/types.d.cts
CHANGED
|
@@ -62,8 +62,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
62
62
|
id: string;
|
|
63
63
|
createdAt: Date;
|
|
64
64
|
updatedAt: Date | null;
|
|
65
|
-
expiresAt: Date | null;
|
|
66
65
|
status: string;
|
|
66
|
+
expiresAt: Date | null;
|
|
67
67
|
claimUserId: string | null;
|
|
68
68
|
claimedAt: Date | null;
|
|
69
69
|
claimedEmail: string | null;
|
|
@@ -149,8 +149,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
149
149
|
listAdminWaitlist: _$_trpc_server0.TRPCQueryProcedure<{
|
|
150
150
|
input: void;
|
|
151
151
|
output: {
|
|
152
|
-
id: string;
|
|
153
152
|
name: string | null;
|
|
153
|
+
id: string;
|
|
154
154
|
email: string | null;
|
|
155
155
|
createdAt: Date;
|
|
156
156
|
updatedAt: Date | null;
|
|
@@ -163,8 +163,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
163
163
|
email: string;
|
|
164
164
|
};
|
|
165
165
|
output: {
|
|
166
|
-
id: string;
|
|
167
166
|
name: string | null;
|
|
167
|
+
id: string;
|
|
168
168
|
email: string | null;
|
|
169
169
|
createdAt: Date;
|
|
170
170
|
updatedAt: Date | null;
|
|
@@ -194,8 +194,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
194
194
|
id: string;
|
|
195
195
|
};
|
|
196
196
|
output: {
|
|
197
|
-
id: string;
|
|
198
197
|
name: string | null;
|
|
198
|
+
id: string;
|
|
199
199
|
email: string | null;
|
|
200
200
|
createdAt: Date;
|
|
201
201
|
updatedAt: Date | null;
|
|
@@ -208,8 +208,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
208
208
|
id: string;
|
|
209
209
|
};
|
|
210
210
|
output: {
|
|
211
|
-
id: string;
|
|
212
211
|
name: string | null;
|
|
212
|
+
id: string;
|
|
213
213
|
email: string | null;
|
|
214
214
|
createdAt: Date;
|
|
215
215
|
updatedAt: Date | null;
|
|
@@ -222,8 +222,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
222
222
|
email: string;
|
|
223
223
|
};
|
|
224
224
|
output: {
|
|
225
|
-
id: string;
|
|
226
225
|
name: string | null;
|
|
226
|
+
id: string;
|
|
227
227
|
email: string | null;
|
|
228
228
|
createdAt: Date;
|
|
229
229
|
updatedAt: Date | null;
|
package/dist/src/types.d.mts
CHANGED
|
@@ -62,8 +62,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
62
62
|
id: string;
|
|
63
63
|
createdAt: Date;
|
|
64
64
|
updatedAt: Date | null;
|
|
65
|
-
expiresAt: Date | null;
|
|
66
65
|
status: string;
|
|
66
|
+
expiresAt: Date | null;
|
|
67
67
|
claimUserId: string | null;
|
|
68
68
|
claimedAt: Date | null;
|
|
69
69
|
claimedEmail: string | null;
|
|
@@ -149,8 +149,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
149
149
|
listAdminWaitlist: _$_trpc_server0.TRPCQueryProcedure<{
|
|
150
150
|
input: void;
|
|
151
151
|
output: {
|
|
152
|
-
id: string;
|
|
153
152
|
name: string | null;
|
|
153
|
+
id: string;
|
|
154
154
|
email: string | null;
|
|
155
155
|
createdAt: Date;
|
|
156
156
|
updatedAt: Date | null;
|
|
@@ -163,8 +163,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
163
163
|
email: string;
|
|
164
164
|
};
|
|
165
165
|
output: {
|
|
166
|
-
id: string;
|
|
167
166
|
name: string | null;
|
|
167
|
+
id: string;
|
|
168
168
|
email: string | null;
|
|
169
169
|
createdAt: Date;
|
|
170
170
|
updatedAt: Date | null;
|
|
@@ -194,8 +194,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
194
194
|
id: string;
|
|
195
195
|
};
|
|
196
196
|
output: {
|
|
197
|
-
id: string;
|
|
198
197
|
name: string | null;
|
|
198
|
+
id: string;
|
|
199
199
|
email: string | null;
|
|
200
200
|
createdAt: Date;
|
|
201
201
|
updatedAt: Date | null;
|
|
@@ -208,8 +208,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
208
208
|
id: string;
|
|
209
209
|
};
|
|
210
210
|
output: {
|
|
211
|
-
id: string;
|
|
212
211
|
name: string | null;
|
|
212
|
+
id: string;
|
|
213
213
|
email: string | null;
|
|
214
214
|
createdAt: Date;
|
|
215
215
|
updatedAt: Date | null;
|
|
@@ -222,8 +222,8 @@ declare const createAuthTRPCRouter: (trpcMethods: TRPCMethods, authService: Auth
|
|
|
222
222
|
email: string;
|
|
223
223
|
};
|
|
224
224
|
output: {
|
|
225
|
-
id: string;
|
|
226
225
|
name: string | null;
|
|
226
|
+
id: string;
|
|
227
227
|
email: string | null;
|
|
228
228
|
createdAt: Date;
|
|
229
229
|
updatedAt: Date | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m5kdev/backend",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.11",
|
|
4
4
|
"description": "Composable Express server stack with Drizzle ORM and tRPC.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"trpc-to-openapi": "2.3.0",
|
|
59
59
|
"uuid": "11.0.5",
|
|
60
60
|
"zod": "4.2.1",
|
|
61
|
-
"@m5kdev/commons": "0.8.
|
|
62
|
-
"@m5kdev/config": "0.8.
|
|
61
|
+
"@m5kdev/commons": "0.8.11",
|
|
62
|
+
"@m5kdev/config": "0.8.11"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@jest/globals": "30.2.0",
|