@m5kdev/backend 0.1.4 → 0.2.0
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/lib/posthog.d.ts +0 -1
- package/dist/src/lib/sentry.d.ts +0 -1
- package/dist/src/modules/access/access.repository.d.ts +0 -1
- package/dist/src/modules/access/access.service.d.ts +0 -1
- package/dist/src/modules/access/access.test.d.ts +0 -1
- package/dist/src/modules/access/access.utils.d.ts +0 -1
- package/dist/src/modules/ai/ai.db.d.ts +0 -1
- package/dist/src/modules/ai/ai.prompt.d.ts +0 -1
- package/dist/src/modules/ai/ai.repository.d.ts +0 -1
- package/dist/src/modules/ai/ai.router.d.ts +0 -1
- package/dist/src/modules/ai/ai.service.d.ts +0 -1
- package/dist/src/modules/ai/ai.trpc.d.ts +5 -42
- package/dist/src/modules/ai/ai.trpc.js +5 -5
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.ts +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.ts +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts +0 -1
- package/dist/src/modules/auth/auth.db.d.ts +0 -1
- package/dist/src/modules/auth/auth.dto.d.ts +7 -8
- package/dist/src/modules/auth/auth.lib.d.ts +8 -9
- package/dist/src/modules/auth/auth.middleware.d.ts +0 -1
- package/dist/src/modules/auth/auth.repository.d.ts +0 -1
- package/dist/src/modules/auth/auth.service.d.ts +0 -1
- package/dist/src/modules/auth/auth.trpc.d.ts +52 -89
- package/dist/src/modules/auth/auth.trpc.js +55 -53
- package/dist/src/modules/auth/auth.utils.d.ts +0 -1
- package/dist/src/modules/base/base.abstract.d.ts +0 -1
- package/dist/src/modules/base/base.dto.d.ts +2 -3
- package/dist/src/modules/base/base.grants.d.ts +0 -1
- package/dist/src/modules/base/base.grants.test.d.ts +0 -1
- package/dist/src/modules/base/base.repository.d.ts +0 -1
- package/dist/src/modules/base/base.service.d.ts +2 -4
- package/dist/src/modules/base/base.types.d.ts +0 -1
- package/dist/src/modules/billing/billing.db.d.ts +0 -1
- package/dist/src/modules/billing/billing.repository.d.ts +0 -1
- package/dist/src/modules/billing/billing.router.d.ts +0 -1
- package/dist/src/modules/billing/billing.service.d.ts +0 -1
- package/dist/src/modules/billing/billing.trpc.d.ts +6 -43
- package/dist/src/modules/billing/billing.trpc.js +7 -7
- package/dist/src/modules/clay/clay.repository.d.ts +0 -1
- package/dist/src/modules/clay/clay.service.d.ts +0 -1
- package/dist/src/modules/connect/connect.db.d.ts +0 -1
- package/dist/src/modules/connect/connect.dto.d.ts +8 -9
- package/dist/src/modules/connect/connect.linkedin.d.ts +0 -1
- package/dist/src/modules/connect/connect.oauth.d.ts +0 -1
- package/dist/src/modules/connect/connect.repository.d.ts +3 -4
- package/dist/src/modules/connect/connect.router.d.ts +0 -1
- package/dist/src/modules/connect/connect.service.d.ts +6 -7
- package/dist/src/modules/connect/connect.trpc.d.ts +9 -46
- package/dist/src/modules/connect/connect.trpc.js +7 -7
- package/dist/src/modules/connect/connect.types.d.ts +0 -1
- package/dist/src/modules/crypto/crypto.db.d.ts +0 -1
- package/dist/src/modules/crypto/crypto.repository.d.ts +0 -1
- package/dist/src/modules/crypto/crypto.service.d.ts +0 -1
- package/dist/src/modules/email/email.service.d.ts +0 -1
- package/dist/src/modules/file/file.repository.d.ts +0 -1
- package/dist/src/modules/file/file.router.d.ts +0 -1
- package/dist/src/modules/file/file.service.d.ts +0 -1
- package/dist/src/modules/recurrence/recurrence.db.d.ts +0 -1
- package/dist/src/modules/recurrence/recurrence.repository.d.ts +0 -1
- package/dist/src/modules/recurrence/recurrence.service.d.ts +0 -1
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts +11 -48
- package/dist/src/modules/recurrence/recurrence.trpc.js +17 -17
- package/dist/src/modules/social/social.dto.d.ts +0 -1
- package/dist/src/modules/social/social.linkedin.d.ts +0 -1
- package/dist/src/modules/social/social.linkedin.test.d.ts +0 -1
- package/dist/src/modules/social/social.service.d.ts +0 -1
- package/dist/src/modules/social/social.types.d.ts +0 -1
- package/dist/src/modules/tag/tag.db.d.ts +0 -1
- package/dist/src/modules/tag/tag.dto.d.ts +0 -1
- package/dist/src/modules/tag/tag.repository.d.ts +0 -1
- package/dist/src/modules/tag/tag.service.d.ts +0 -1
- package/dist/src/modules/tag/tag.trpc.d.ts +10 -47
- package/dist/src/modules/tag/tag.trpc.js +15 -15
- package/dist/src/modules/utils/applyPagination.d.ts +0 -1
- package/dist/src/modules/utils/applySorting.d.ts +0 -1
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts +0 -1
- package/dist/src/modules/video/video.service.d.ts +0 -1
- package/dist/src/modules/webhook/webhook.constants.d.ts +0 -1
- package/dist/src/modules/webhook/webhook.db.d.ts +0 -1
- package/dist/src/modules/webhook/webhook.dto.d.ts +0 -1
- package/dist/src/modules/webhook/webhook.repository.d.ts +0 -1
- package/dist/src/modules/webhook/webhook.router.d.ts +0 -1
- package/dist/src/modules/webhook/webhook.service.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.db.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.repository.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.service.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.trpc.d.ts +6 -43
- package/dist/src/modules/workflow/workflow.trpc.js +7 -7
- package/dist/src/modules/workflow/workflow.types.d.ts +0 -1
- package/dist/src/modules/workflow/workflow.utils.d.ts +0 -1
- package/dist/src/test/stubs/utils.d.ts +0 -1
- package/dist/src/trpc/context.d.ts +4 -5
- package/dist/src/trpc/index.d.ts +0 -1
- package/dist/src/trpc/procedures.d.ts +24 -25
- package/dist/src/trpc/utils.d.ts +0 -1
- package/dist/src/types.d.ts +61 -209
- package/dist/src/types.js +4 -5
- package/dist/src/utils/errors.d.ts +0 -1
- package/dist/src/utils/logger.d.ts +0 -1
- package/dist/src/utils/posthog.d.ts +0 -1
- package/dist/src/utils/trpc.d.ts +58 -0
- package/dist/src/utils/trpc.js +63 -0
- package/dist/src/utils/types.d.ts +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -8
- package/.cursor/rules/backend.mdc +0 -70
- package/.turbo/turbo-build.log +0 -5
- package/.turbo/turbo-check-types.log +0 -5
- package/.turbo/turbo-lint$colon$fix.log +0 -255
- package/CHANGELOG.md +0 -37
- package/dist/src/lib/posthog.d.ts.map +0 -1
- package/dist/src/lib/sentry.d.ts.map +0 -1
- package/dist/src/modules/access/access.repository.d.ts.map +0 -1
- package/dist/src/modules/access/access.service.d.ts.map +0 -1
- package/dist/src/modules/access/access.test.d.ts.map +0 -1
- package/dist/src/modules/access/access.utils.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.db.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.prompt.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.repository.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.router.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.service.d.ts.map +0 -1
- package/dist/src/modules/ai/ai.trpc.d.ts.map +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.ts.map +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.ts.map +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts.map +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts.map +0 -1
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.db.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.dto.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.lib.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.middleware.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.repository.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.service.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.trpc.d.ts.map +0 -1
- package/dist/src/modules/auth/auth.utils.d.ts.map +0 -1
- package/dist/src/modules/base/base.abstract.d.ts.map +0 -1
- package/dist/src/modules/base/base.dto.d.ts.map +0 -1
- package/dist/src/modules/base/base.grants.d.ts.map +0 -1
- package/dist/src/modules/base/base.grants.test.d.ts.map +0 -1
- package/dist/src/modules/base/base.repository.d.ts.map +0 -1
- package/dist/src/modules/base/base.service.d.ts.map +0 -1
- package/dist/src/modules/base/base.types.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.db.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.repository.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.router.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.service.d.ts.map +0 -1
- package/dist/src/modules/billing/billing.trpc.d.ts.map +0 -1
- package/dist/src/modules/clay/clay.repository.d.ts.map +0 -1
- package/dist/src/modules/clay/clay.service.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.db.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.dto.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.linkedin.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.oauth.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.repository.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.router.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.service.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.trpc.d.ts.map +0 -1
- package/dist/src/modules/connect/connect.types.d.ts.map +0 -1
- package/dist/src/modules/crypto/crypto.db.d.ts.map +0 -1
- package/dist/src/modules/crypto/crypto.repository.d.ts.map +0 -1
- package/dist/src/modules/crypto/crypto.service.d.ts.map +0 -1
- package/dist/src/modules/email/email.service.d.ts.map +0 -1
- package/dist/src/modules/file/file.repository.d.ts.map +0 -1
- package/dist/src/modules/file/file.router.d.ts.map +0 -1
- package/dist/src/modules/file/file.service.d.ts.map +0 -1
- package/dist/src/modules/recurrence/recurrence.db.d.ts.map +0 -1
- package/dist/src/modules/recurrence/recurrence.repository.d.ts.map +0 -1
- package/dist/src/modules/recurrence/recurrence.service.d.ts.map +0 -1
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts.map +0 -1
- package/dist/src/modules/social/social.dto.d.ts.map +0 -1
- package/dist/src/modules/social/social.linkedin.d.ts.map +0 -1
- package/dist/src/modules/social/social.linkedin.test.d.ts.map +0 -1
- package/dist/src/modules/social/social.service.d.ts.map +0 -1
- package/dist/src/modules/social/social.types.d.ts.map +0 -1
- package/dist/src/modules/tag/tag.db.d.ts.map +0 -1
- package/dist/src/modules/tag/tag.dto.d.ts.map +0 -1
- package/dist/src/modules/tag/tag.repository.d.ts.map +0 -1
- package/dist/src/modules/tag/tag.service.d.ts.map +0 -1
- package/dist/src/modules/tag/tag.trpc.d.ts.map +0 -1
- package/dist/src/modules/utils/applyPagination.d.ts.map +0 -1
- package/dist/src/modules/utils/applySorting.d.ts.map +0 -1
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts.map +0 -1
- package/dist/src/modules/video/video.service.d.ts.map +0 -1
- package/dist/src/modules/webhook/webhook.constants.d.ts.map +0 -1
- package/dist/src/modules/webhook/webhook.db.d.ts.map +0 -1
- package/dist/src/modules/webhook/webhook.dto.d.ts.map +0 -1
- package/dist/src/modules/webhook/webhook.repository.d.ts.map +0 -1
- package/dist/src/modules/webhook/webhook.router.d.ts.map +0 -1
- package/dist/src/modules/webhook/webhook.service.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.db.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.repository.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.service.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.trpc.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.types.d.ts.map +0 -1
- package/dist/src/modules/workflow/workflow.utils.d.ts.map +0 -1
- package/dist/src/test/stubs/utils.d.ts.map +0 -1
- package/dist/src/trpc/context.d.ts.map +0 -1
- package/dist/src/trpc/index.d.ts.map +0 -1
- package/dist/src/trpc/procedures.d.ts.map +0 -1
- package/dist/src/trpc/utils.d.ts.map +0 -1
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils/errors.d.ts.map +0 -1
- package/dist/src/utils/logger.d.ts.map +0 -1
- package/dist/src/utils/posthog.d.ts.map +0 -1
- package/dist/src/utils/types.d.ts.map +0 -1
- package/jest.config.ts +0 -19
- package/src/lib/posthog.ts +0 -5
- package/src/lib/sentry.ts +0 -8
- package/src/modules/access/access.repository.ts +0 -36
- package/src/modules/access/access.service.ts +0 -81
- package/src/modules/access/access.test.ts +0 -216
- package/src/modules/access/access.utils.ts +0 -46
- package/src/modules/ai/ai.db.ts +0 -38
- package/src/modules/ai/ai.prompt.ts +0 -47
- package/src/modules/ai/ai.repository.ts +0 -53
- package/src/modules/ai/ai.router.ts +0 -148
- package/src/modules/ai/ai.service.ts +0 -310
- package/src/modules/ai/ai.trpc.ts +0 -22
- package/src/modules/ai/ideogram/ideogram.constants.ts +0 -170
- package/src/modules/ai/ideogram/ideogram.dto.ts +0 -64
- package/src/modules/ai/ideogram/ideogram.prompt.ts +0 -858
- package/src/modules/ai/ideogram/ideogram.repository.ts +0 -39
- package/src/modules/ai/ideogram/ideogram.service.ts +0 -14
- package/src/modules/auth/auth.db.ts +0 -224
- package/src/modules/auth/auth.dto.ts +0 -47
- package/src/modules/auth/auth.lib.ts +0 -349
- package/src/modules/auth/auth.middleware.ts +0 -62
- package/src/modules/auth/auth.repository.ts +0 -672
- package/src/modules/auth/auth.service.ts +0 -261
- package/src/modules/auth/auth.trpc.ts +0 -208
- package/src/modules/auth/auth.utils.ts +0 -117
- package/src/modules/base/base.abstract.ts +0 -62
- package/src/modules/base/base.dto.ts +0 -206
- package/src/modules/base/base.grants.test.ts +0 -861
- package/src/modules/base/base.grants.ts +0 -199
- package/src/modules/base/base.repository.ts +0 -433
- package/src/modules/base/base.service.ts +0 -154
- package/src/modules/base/base.types.ts +0 -7
- package/src/modules/billing/billing.db.ts +0 -27
- package/src/modules/billing/billing.repository.ts +0 -328
- package/src/modules/billing/billing.router.ts +0 -77
- package/src/modules/billing/billing.service.ts +0 -177
- package/src/modules/billing/billing.trpc.ts +0 -17
- package/src/modules/clay/clay.repository.ts +0 -29
- package/src/modules/clay/clay.service.ts +0 -61
- package/src/modules/connect/connect.db.ts +0 -32
- package/src/modules/connect/connect.dto.ts +0 -44
- package/src/modules/connect/connect.linkedin.ts +0 -70
- package/src/modules/connect/connect.oauth.ts +0 -288
- package/src/modules/connect/connect.repository.ts +0 -65
- package/src/modules/connect/connect.router.ts +0 -76
- package/src/modules/connect/connect.service.ts +0 -171
- package/src/modules/connect/connect.trpc.ts +0 -26
- package/src/modules/connect/connect.types.ts +0 -27
- package/src/modules/crypto/crypto.db.ts +0 -15
- package/src/modules/crypto/crypto.repository.ts +0 -13
- package/src/modules/crypto/crypto.service.ts +0 -57
- package/src/modules/email/email.service.ts +0 -222
- package/src/modules/file/file.repository.ts +0 -95
- package/src/modules/file/file.router.ts +0 -108
- package/src/modules/file/file.service.ts +0 -186
- package/src/modules/recurrence/recurrence.db.ts +0 -79
- package/src/modules/recurrence/recurrence.repository.ts +0 -70
- package/src/modules/recurrence/recurrence.service.ts +0 -105
- package/src/modules/recurrence/recurrence.trpc.ts +0 -82
- package/src/modules/social/social.dto.ts +0 -22
- package/src/modules/social/social.linkedin.test.ts +0 -277
- package/src/modules/social/social.linkedin.ts +0 -593
- package/src/modules/social/social.service.ts +0 -112
- package/src/modules/social/social.types.ts +0 -43
- package/src/modules/tag/tag.db.ts +0 -41
- package/src/modules/tag/tag.dto.ts +0 -18
- package/src/modules/tag/tag.repository.ts +0 -222
- package/src/modules/tag/tag.service.ts +0 -48
- package/src/modules/tag/tag.trpc.ts +0 -62
- package/src/modules/uploads/0581796b-8845-420d-bd95-cd7de79f6d37.webm +0 -0
- package/src/modules/uploads/33b1e649-6727-4bd0-94d0-a0b363646865.webm +0 -0
- package/src/modules/uploads/49a8c4c0-54d7-4c94-bef4-c93c029f9ed0.webm +0 -0
- package/src/modules/uploads/50e31e38-a2f0-47ca-8b7d-2d7fcad9267d.webm +0 -0
- package/src/modules/uploads/72ac8cf9-c3a7-4cd8-8a78-6d8e137a4c7e.webm +0 -0
- package/src/modules/uploads/75293649-d966-46cd-a675-67518958ae9c.png +0 -0
- package/src/modules/uploads/88b7b867-ce15-4891-bf73-81305a7de1f7.wav +0 -0
- package/src/modules/uploads/a5d6fee8-6a59-42c6-9d4a-ac8a3c5e7245.webm +0 -0
- package/src/modules/uploads/c13a9785-ca5a-4983-af30-b338ed76d370.webm +0 -0
- package/src/modules/uploads/caa1a5a7-71ba-4381-902d-7e2cafdf6dcb.webm +0 -0
- package/src/modules/uploads/cbeb0b81-374d-445b-914b-40ace7c8e031.webm +0 -0
- package/src/modules/uploads/d626aa82-b10f-493f-aee7-87bfb3361dfc.webm +0 -0
- package/src/modules/uploads/d7de4c16-de0c-495d-9612-e72260a6ecca.png +0 -0
- package/src/modules/uploads/e532e38a-6421-400e-8a5f-8e7bc8ce411b.wav +0 -0
- package/src/modules/uploads/e86ec867-6adf-4c51-84e0-00b0836625e8.webm +0 -0
- package/src/modules/utils/applyPagination.ts +0 -13
- package/src/modules/utils/applySorting.ts +0 -21
- package/src/modules/utils/getConditionsFromFilters.ts +0 -216
- package/src/modules/video/video.service.ts +0 -89
- package/src/modules/webhook/webhook.constants.ts +0 -9
- package/src/modules/webhook/webhook.db.ts +0 -15
- package/src/modules/webhook/webhook.dto.ts +0 -9
- package/src/modules/webhook/webhook.repository.ts +0 -68
- package/src/modules/webhook/webhook.router.ts +0 -29
- package/src/modules/webhook/webhook.service.ts +0 -78
- package/src/modules/workflow/workflow.db.ts +0 -29
- package/src/modules/workflow/workflow.repository.ts +0 -171
- package/src/modules/workflow/workflow.service.ts +0 -56
- package/src/modules/workflow/workflow.trpc.ts +0 -26
- package/src/modules/workflow/workflow.types.ts +0 -30
- package/src/modules/workflow/workflow.utils.ts +0 -259
- package/src/test/stubs/utils.ts +0 -2
- package/src/trpc/context.ts +0 -21
- package/src/trpc/index.ts +0 -3
- package/src/trpc/procedures.ts +0 -43
- package/src/trpc/utils.ts +0 -20
- package/src/types.ts +0 -22
- package/src/utils/errors.ts +0 -148
- package/src/utils/logger.ts +0 -8
- package/src/utils/posthog.ts +0 -43
- package/src/utils/types.ts +0 -5
- package/tsconfig.json +0 -21
package/dist/src/types.d.ts
CHANGED
|
@@ -2,96 +2,23 @@ import type { Mastra } from "@mastra/core";
|
|
|
2
2
|
import type { AIService } from "#modules/ai/ai.service";
|
|
3
3
|
import type { AuthService } from "#modules/auth/auth.service";
|
|
4
4
|
import type { BillingService } from "#modules/billing/billing.service";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
userId: string;
|
|
10
|
-
updatedAt: Date;
|
|
11
|
-
createdAt: Date;
|
|
12
|
-
expiresAt: Date;
|
|
13
|
-
token: string;
|
|
14
|
-
ipAddress: string | null;
|
|
15
|
-
userAgent: string | null;
|
|
16
|
-
impersonatedBy: string | null;
|
|
17
|
-
activeOrganizationId: string | null;
|
|
18
|
-
activeOrganizationRole: string | null;
|
|
19
|
-
activeTeamId: string | null;
|
|
20
|
-
activeTeamRole: string | null;
|
|
21
|
-
};
|
|
22
|
-
user: {
|
|
23
|
-
name: string;
|
|
24
|
-
id: string;
|
|
25
|
-
updatedAt: Date;
|
|
26
|
-
email: string;
|
|
27
|
-
emailVerified: boolean;
|
|
28
|
-
image: string | null;
|
|
29
|
-
createdAt: Date;
|
|
30
|
-
role: string | null;
|
|
31
|
-
banned: boolean | null;
|
|
32
|
-
banReason: string | null;
|
|
33
|
-
banExpires: Date | null;
|
|
34
|
-
stripeCustomerId: string | null;
|
|
35
|
-
paymentCustomerId: string | null;
|
|
36
|
-
paymentPlanTier: string | null;
|
|
37
|
-
paymentPlanExpiresAt: Date | null;
|
|
38
|
-
preferences: string | null;
|
|
39
|
-
metadata: Record<string, unknown>;
|
|
40
|
-
onboarding: number | null;
|
|
41
|
-
flags: string | null;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
5
|
+
import type { TRPCMethods } from "#utils/trpc";
|
|
6
|
+
export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcMethods: TRPCMethods, authService: AuthService, aiService: AIService<MastraInstance>, billingService: BillingService) => import("@trpc/server").TRPCBuiltRouter<{
|
|
7
|
+
ctx: import("./modules/auth/auth.lib").Context;
|
|
8
|
+
meta: any;
|
|
45
9
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
46
10
|
transformer: true;
|
|
47
11
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
48
12
|
auth: import("@trpc/server").TRPCBuiltRouter<{
|
|
49
|
-
ctx:
|
|
50
|
-
|
|
51
|
-
id: string;
|
|
52
|
-
userId: string;
|
|
53
|
-
updatedAt: Date;
|
|
54
|
-
createdAt: Date;
|
|
55
|
-
expiresAt: Date;
|
|
56
|
-
token: string;
|
|
57
|
-
ipAddress: string | null;
|
|
58
|
-
userAgent: string | null;
|
|
59
|
-
impersonatedBy: string | null;
|
|
60
|
-
activeOrganizationId: string | null;
|
|
61
|
-
activeOrganizationRole: string | null;
|
|
62
|
-
activeTeamId: string | null;
|
|
63
|
-
activeTeamRole: string | null;
|
|
64
|
-
};
|
|
65
|
-
user: {
|
|
66
|
-
name: string;
|
|
67
|
-
id: string;
|
|
68
|
-
updatedAt: Date;
|
|
69
|
-
email: string;
|
|
70
|
-
emailVerified: boolean;
|
|
71
|
-
image: string | null;
|
|
72
|
-
createdAt: Date;
|
|
73
|
-
role: string | null;
|
|
74
|
-
banned: boolean | null;
|
|
75
|
-
banReason: string | null;
|
|
76
|
-
banExpires: Date | null;
|
|
77
|
-
stripeCustomerId: string | null;
|
|
78
|
-
paymentCustomerId: string | null;
|
|
79
|
-
paymentPlanTier: string | null;
|
|
80
|
-
paymentPlanExpiresAt: Date | null;
|
|
81
|
-
preferences: string | null;
|
|
82
|
-
metadata: Record<string, unknown>;
|
|
83
|
-
onboarding: number | null;
|
|
84
|
-
flags: string | null;
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
13
|
+
ctx: import("./modules/auth/auth.lib").Context;
|
|
14
|
+
meta: any;
|
|
88
15
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
89
16
|
transformer: true;
|
|
90
17
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
91
18
|
getUserWaitlistCount: import("@trpc/server").TRPCQueryProcedure<{
|
|
92
19
|
input: void;
|
|
93
20
|
output: number;
|
|
94
|
-
meta:
|
|
21
|
+
meta: any;
|
|
95
22
|
}>;
|
|
96
23
|
createInvitationCode: import("@trpc/server").TRPCMutationProcedure<{
|
|
97
24
|
input: {
|
|
@@ -107,7 +34,7 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
107
34
|
code: string | null;
|
|
108
35
|
expiresAt: Date | null;
|
|
109
36
|
};
|
|
110
|
-
meta:
|
|
37
|
+
meta: any;
|
|
111
38
|
}>;
|
|
112
39
|
createAccountClaimCode: import("@trpc/server").TRPCMutationProcedure<{
|
|
113
40
|
input: {
|
|
@@ -125,21 +52,21 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
125
52
|
createdAt: Date;
|
|
126
53
|
updatedAt: Date | null;
|
|
127
54
|
};
|
|
128
|
-
meta:
|
|
55
|
+
meta: any;
|
|
129
56
|
}>;
|
|
130
57
|
listAccountClaims: import("@trpc/server").TRPCQueryProcedure<{
|
|
131
58
|
input: void;
|
|
132
59
|
output: {
|
|
60
|
+
expiresAt: Date | null;
|
|
133
61
|
id: string;
|
|
134
|
-
updatedAt: Date | null;
|
|
135
62
|
createdAt: Date;
|
|
136
|
-
|
|
63
|
+
updatedAt: Date | null;
|
|
137
64
|
status: string;
|
|
138
65
|
claimUserId: string | null;
|
|
139
66
|
claimedAt: Date | null;
|
|
140
67
|
claimedEmail: string | null;
|
|
141
68
|
}[];
|
|
142
|
-
meta:
|
|
69
|
+
meta: any;
|
|
143
70
|
}>;
|
|
144
71
|
generateAccountClaimMagicLink: import("@trpc/server").TRPCMutationProcedure<{
|
|
145
72
|
input: {
|
|
@@ -147,30 +74,30 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
147
74
|
email?: string | undefined;
|
|
148
75
|
};
|
|
149
76
|
output: {
|
|
77
|
+
email: string;
|
|
78
|
+
url: string;
|
|
79
|
+
expiresAt: Date | null;
|
|
150
80
|
id: string;
|
|
151
81
|
userId: string;
|
|
152
|
-
email: string;
|
|
153
82
|
createdAt: Date;
|
|
154
|
-
expiresAt: Date | null;
|
|
155
83
|
claimId: string;
|
|
156
|
-
url: string;
|
|
157
84
|
};
|
|
158
|
-
meta:
|
|
85
|
+
meta: any;
|
|
159
86
|
}>;
|
|
160
87
|
listAccountClaimMagicLinks: import("@trpc/server").TRPCQueryProcedure<{
|
|
161
88
|
input: {
|
|
162
89
|
claimId: string;
|
|
163
90
|
};
|
|
164
91
|
output: {
|
|
92
|
+
email: string;
|
|
93
|
+
url: string;
|
|
94
|
+
expiresAt: Date | null;
|
|
165
95
|
id: string;
|
|
166
96
|
userId: string;
|
|
167
|
-
email: string;
|
|
168
97
|
createdAt: Date;
|
|
169
|
-
expiresAt: Date | null;
|
|
170
98
|
claimId: string;
|
|
171
|
-
url: string;
|
|
172
99
|
}[];
|
|
173
|
-
meta:
|
|
100
|
+
meta: any;
|
|
174
101
|
}>;
|
|
175
102
|
getMyAccountClaimStatus: import("@trpc/server").TRPCQueryProcedure<{
|
|
176
103
|
input: void;
|
|
@@ -185,7 +112,7 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
185
112
|
createdAt: Date;
|
|
186
113
|
updatedAt: Date | null;
|
|
187
114
|
} | null;
|
|
188
|
-
meta:
|
|
115
|
+
meta: any;
|
|
189
116
|
}>;
|
|
190
117
|
setMyAccountClaimEmail: import("@trpc/server").TRPCMutationProcedure<{
|
|
191
118
|
input: {
|
|
@@ -194,14 +121,14 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
194
121
|
output: {
|
|
195
122
|
status: boolean;
|
|
196
123
|
};
|
|
197
|
-
meta:
|
|
124
|
+
meta: any;
|
|
198
125
|
}>;
|
|
199
126
|
acceptMyAccountClaim: import("@trpc/server").TRPCMutationProcedure<{
|
|
200
127
|
input: void;
|
|
201
128
|
output: {
|
|
202
129
|
status: boolean;
|
|
203
130
|
};
|
|
204
|
-
meta:
|
|
131
|
+
meta: any;
|
|
205
132
|
}>;
|
|
206
133
|
listWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
207
134
|
input: void;
|
|
@@ -215,33 +142,33 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
215
142
|
code: string | null;
|
|
216
143
|
expiresAt: Date | null;
|
|
217
144
|
}[];
|
|
218
|
-
meta:
|
|
145
|
+
meta: any;
|
|
219
146
|
}>;
|
|
220
147
|
listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
221
148
|
input: void;
|
|
222
149
|
output: {
|
|
223
|
-
name: string | null;
|
|
224
|
-
id: string;
|
|
225
|
-
updatedAt: Date | null;
|
|
226
150
|
email: string | null;
|
|
151
|
+
id: string;
|
|
152
|
+
name: string | null;
|
|
227
153
|
createdAt: Date;
|
|
154
|
+
updatedAt: Date | null;
|
|
228
155
|
status: string;
|
|
229
156
|
}[];
|
|
230
|
-
meta:
|
|
157
|
+
meta: any;
|
|
231
158
|
}>;
|
|
232
159
|
addToWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
233
160
|
input: {
|
|
234
161
|
email: string;
|
|
235
162
|
};
|
|
236
163
|
output: {
|
|
237
|
-
name: string | null;
|
|
238
|
-
id: string;
|
|
239
|
-
updatedAt: Date | null;
|
|
240
164
|
email: string | null;
|
|
165
|
+
id: string;
|
|
166
|
+
name: string | null;
|
|
241
167
|
createdAt: Date;
|
|
168
|
+
updatedAt: Date | null;
|
|
242
169
|
status: string;
|
|
243
170
|
};
|
|
244
|
-
meta:
|
|
171
|
+
meta: any;
|
|
245
172
|
}>;
|
|
246
173
|
inviteToWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
247
174
|
input: {
|
|
@@ -258,89 +185,89 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
258
185
|
code: string | null;
|
|
259
186
|
expiresAt: Date | null;
|
|
260
187
|
};
|
|
261
|
-
meta:
|
|
188
|
+
meta: any;
|
|
262
189
|
}>;
|
|
263
190
|
inviteFromWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
264
191
|
input: {
|
|
265
192
|
id: string;
|
|
266
193
|
};
|
|
267
194
|
output: {
|
|
268
|
-
name: string | null;
|
|
269
|
-
id: string;
|
|
270
|
-
updatedAt: Date | null;
|
|
271
195
|
email: string | null;
|
|
196
|
+
id: string;
|
|
197
|
+
name: string | null;
|
|
272
198
|
createdAt: Date;
|
|
199
|
+
updatedAt: Date | null;
|
|
273
200
|
status: string;
|
|
274
201
|
};
|
|
275
|
-
meta:
|
|
202
|
+
meta: any;
|
|
276
203
|
}>;
|
|
277
204
|
removeFromWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
278
205
|
input: {
|
|
279
206
|
id: string;
|
|
280
207
|
};
|
|
281
208
|
output: {
|
|
282
|
-
name: string | null;
|
|
283
|
-
id: string;
|
|
284
|
-
updatedAt: Date | null;
|
|
285
209
|
email: string | null;
|
|
210
|
+
id: string;
|
|
211
|
+
name: string | null;
|
|
286
212
|
createdAt: Date;
|
|
213
|
+
updatedAt: Date | null;
|
|
287
214
|
status: string;
|
|
288
215
|
};
|
|
289
|
-
meta:
|
|
216
|
+
meta: any;
|
|
290
217
|
}>;
|
|
291
218
|
joinWaitlist: import("@trpc/server").TRPCMutationProcedure<{
|
|
292
219
|
input: {
|
|
293
220
|
email: string;
|
|
294
221
|
};
|
|
295
222
|
output: {
|
|
296
|
-
name: string | null;
|
|
297
|
-
id: string;
|
|
298
|
-
updatedAt: Date | null;
|
|
299
223
|
email: string | null;
|
|
224
|
+
id: string;
|
|
225
|
+
name: string | null;
|
|
300
226
|
createdAt: Date;
|
|
227
|
+
updatedAt: Date | null;
|
|
301
228
|
status: string;
|
|
302
229
|
};
|
|
303
|
-
meta:
|
|
230
|
+
meta: any;
|
|
304
231
|
}>;
|
|
305
232
|
getOnboarding: import("@trpc/server").TRPCQueryProcedure<{
|
|
306
233
|
input: void;
|
|
307
234
|
output: number;
|
|
308
|
-
meta:
|
|
235
|
+
meta: any;
|
|
309
236
|
}>;
|
|
310
237
|
setOnboarding: import("@trpc/server").TRPCMutationProcedure<{
|
|
311
238
|
input: number;
|
|
312
239
|
output: number;
|
|
313
|
-
meta:
|
|
240
|
+
meta: any;
|
|
314
241
|
}>;
|
|
315
242
|
getPreferences: import("@trpc/server").TRPCQueryProcedure<{
|
|
316
243
|
input: void;
|
|
317
244
|
output: Record<string, unknown>;
|
|
318
|
-
meta:
|
|
245
|
+
meta: any;
|
|
319
246
|
}>;
|
|
320
247
|
setPreferences: import("@trpc/server").TRPCMutationProcedure<{
|
|
321
248
|
input: Record<string, unknown>;
|
|
322
249
|
output: Record<string, unknown>;
|
|
323
|
-
meta:
|
|
250
|
+
meta: any;
|
|
324
251
|
}>;
|
|
325
252
|
getMetadata: import("@trpc/server").TRPCQueryProcedure<{
|
|
326
253
|
input: void;
|
|
327
254
|
output: Record<string, unknown>;
|
|
328
|
-
meta:
|
|
255
|
+
meta: any;
|
|
329
256
|
}>;
|
|
330
257
|
setMetadata: import("@trpc/server").TRPCMutationProcedure<{
|
|
331
258
|
input: Record<string, unknown>;
|
|
332
259
|
output: Record<string, unknown>;
|
|
333
|
-
meta:
|
|
260
|
+
meta: any;
|
|
334
261
|
}>;
|
|
335
262
|
getFlags: import("@trpc/server").TRPCQueryProcedure<{
|
|
336
263
|
input: void;
|
|
337
264
|
output: string[];
|
|
338
|
-
meta:
|
|
265
|
+
meta: any;
|
|
339
266
|
}>;
|
|
340
267
|
setFlags: import("@trpc/server").TRPCMutationProcedure<{
|
|
341
268
|
input: string[];
|
|
342
269
|
output: string[];
|
|
343
|
-
meta:
|
|
270
|
+
meta: any;
|
|
344
271
|
}>;
|
|
345
272
|
validateWaitlistCode: import("@trpc/server").TRPCQueryProcedure<{
|
|
346
273
|
input: {
|
|
@@ -349,49 +276,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
349
276
|
output: {
|
|
350
277
|
status: string;
|
|
351
278
|
};
|
|
352
|
-
meta:
|
|
279
|
+
meta: any;
|
|
353
280
|
}>;
|
|
354
281
|
}>>;
|
|
355
282
|
ai: import("@trpc/server").TRPCBuiltRouter<{
|
|
356
|
-
ctx:
|
|
357
|
-
|
|
358
|
-
id: string;
|
|
359
|
-
userId: string;
|
|
360
|
-
updatedAt: Date;
|
|
361
|
-
createdAt: Date;
|
|
362
|
-
expiresAt: Date;
|
|
363
|
-
token: string;
|
|
364
|
-
ipAddress: string | null;
|
|
365
|
-
userAgent: string | null;
|
|
366
|
-
impersonatedBy: string | null;
|
|
367
|
-
activeOrganizationId: string | null;
|
|
368
|
-
activeOrganizationRole: string | null;
|
|
369
|
-
activeTeamId: string | null;
|
|
370
|
-
activeTeamRole: string | null;
|
|
371
|
-
};
|
|
372
|
-
user: {
|
|
373
|
-
name: string;
|
|
374
|
-
id: string;
|
|
375
|
-
updatedAt: Date;
|
|
376
|
-
email: string;
|
|
377
|
-
emailVerified: boolean;
|
|
378
|
-
image: string | null;
|
|
379
|
-
createdAt: Date;
|
|
380
|
-
role: string | null;
|
|
381
|
-
banned: boolean | null;
|
|
382
|
-
banReason: string | null;
|
|
383
|
-
banExpires: Date | null;
|
|
384
|
-
stripeCustomerId: string | null;
|
|
385
|
-
paymentCustomerId: string | null;
|
|
386
|
-
paymentPlanTier: string | null;
|
|
387
|
-
paymentPlanExpiresAt: Date | null;
|
|
388
|
-
preferences: string | null;
|
|
389
|
-
metadata: Record<string, unknown>;
|
|
390
|
-
onboarding: number | null;
|
|
391
|
-
flags: string | null;
|
|
392
|
-
};
|
|
393
|
-
};
|
|
394
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
283
|
+
ctx: import("./modules/auth/auth.lib").Context;
|
|
284
|
+
meta: any;
|
|
395
285
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
396
286
|
transformer: true;
|
|
397
287
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
@@ -405,49 +295,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
405
295
|
totalTokens: number | null;
|
|
406
296
|
cost: number | null;
|
|
407
297
|
};
|
|
408
|
-
meta:
|
|
298
|
+
meta: any;
|
|
409
299
|
}>;
|
|
410
300
|
}>>;
|
|
411
301
|
billing: import("@trpc/server").TRPCBuiltRouter<{
|
|
412
|
-
ctx:
|
|
413
|
-
|
|
414
|
-
id: string;
|
|
415
|
-
userId: string;
|
|
416
|
-
updatedAt: Date;
|
|
417
|
-
createdAt: Date;
|
|
418
|
-
expiresAt: Date;
|
|
419
|
-
token: string;
|
|
420
|
-
ipAddress: string | null;
|
|
421
|
-
userAgent: string | null;
|
|
422
|
-
impersonatedBy: string | null;
|
|
423
|
-
activeOrganizationId: string | null;
|
|
424
|
-
activeOrganizationRole: string | null;
|
|
425
|
-
activeTeamId: string | null;
|
|
426
|
-
activeTeamRole: string | null;
|
|
427
|
-
};
|
|
428
|
-
user: {
|
|
429
|
-
name: string;
|
|
430
|
-
id: string;
|
|
431
|
-
updatedAt: Date;
|
|
432
|
-
email: string;
|
|
433
|
-
emailVerified: boolean;
|
|
434
|
-
image: string | null;
|
|
435
|
-
createdAt: Date;
|
|
436
|
-
role: string | null;
|
|
437
|
-
banned: boolean | null;
|
|
438
|
-
banReason: string | null;
|
|
439
|
-
banExpires: Date | null;
|
|
440
|
-
stripeCustomerId: string | null;
|
|
441
|
-
paymentCustomerId: string | null;
|
|
442
|
-
paymentPlanTier: string | null;
|
|
443
|
-
paymentPlanExpiresAt: Date | null;
|
|
444
|
-
preferences: string | null;
|
|
445
|
-
metadata: Record<string, unknown>;
|
|
446
|
-
onboarding: number | null;
|
|
447
|
-
flags: string | null;
|
|
448
|
-
};
|
|
449
|
-
};
|
|
450
|
-
meta: import("trpc-to-openapi").OpenApiMeta;
|
|
302
|
+
ctx: import("./modules/auth/auth.lib").Context;
|
|
303
|
+
meta: any;
|
|
451
304
|
errorShape: import("@trpc/server").TRPCDefaultErrorShape;
|
|
452
305
|
transformer: true;
|
|
453
306
|
}, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
|
|
@@ -473,14 +326,13 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(authS
|
|
|
473
326
|
unitAmount?: number | null | undefined;
|
|
474
327
|
discounts?: string[] | null | undefined;
|
|
475
328
|
} | null;
|
|
476
|
-
meta:
|
|
329
|
+
meta: any;
|
|
477
330
|
}>;
|
|
478
331
|
listInvoices: import("@trpc/server").TRPCQueryProcedure<{
|
|
479
332
|
input: void;
|
|
480
333
|
output: import("stripe").Stripe.Invoice[];
|
|
481
|
-
meta:
|
|
334
|
+
meta: any;
|
|
482
335
|
}>;
|
|
483
336
|
}>>;
|
|
484
337
|
}>>;
|
|
485
338
|
export type BackendTRPCRouter = ReturnType<typeof createAuthTRPCRouter>;
|
|
486
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.js
CHANGED
|
@@ -4,10 +4,9 @@ exports.createAuthTRPCRouter = void 0;
|
|
|
4
4
|
const ai_trpc_1 = require("#modules/ai/ai.trpc");
|
|
5
5
|
const auth_trpc_1 = require("#modules/auth/auth.trpc");
|
|
6
6
|
const billing_trpc_1 = require("#modules/billing/billing.trpc");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
billing: (0, billing_trpc_1.createBillingTRPC)(billingService),
|
|
7
|
+
const createAuthTRPCRouter = (trpcMethods, authService, aiService, billingService) => trpcMethods.router({
|
|
8
|
+
auth: (0, auth_trpc_1.createAuthTRPC)(trpcMethods, authService),
|
|
9
|
+
ai: (0, ai_trpc_1.createAITRPC)(trpcMethods, aiService),
|
|
10
|
+
billing: (0, billing_trpc_1.createBillingTRPC)(trpcMethods, billingService),
|
|
12
11
|
});
|
|
13
12
|
exports.createAuthTRPCRouter = createAuthTRPCRouter;
|
|
@@ -47,4 +47,3 @@ declare global {
|
|
|
47
47
|
export declare function getErrorReporter(): ErrorReporter | undefined;
|
|
48
48
|
export declare function setErrorReporter(reporter: ErrorReporter): void;
|
|
49
49
|
export declare function reportError(err: ServerError | Error | unknown, hint?: Parameters<typeof captureException>[1]): string | undefined;
|
|
50
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -11,4 +11,3 @@ export declare function runWithPosthogRequestState<T>(state: PosthogRequestState
|
|
|
11
11
|
export declare function isPosthogCaptureDisabled(): boolean;
|
|
12
12
|
export declare function posthogCapture(event: Parameters<PostHog["capture"]>[0]): ReturnType<PostHog["capture"]> | undefined;
|
|
13
13
|
export {};
|
|
14
|
-
//# sourceMappingURL=posthog.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { transformer } from "@m5kdev/commons/utils/trpc";
|
|
2
|
+
import type { TRPCRootObject } from "@trpc/server";
|
|
3
|
+
import type { CreateExpressContextOptions } from "@trpc/server/adapters/express";
|
|
4
|
+
import type { Result } from "neverthrow";
|
|
5
|
+
import type { BetterAuth, Context } from "#modules/auth/auth.lib";
|
|
6
|
+
import { ServerError } from "#utils/errors";
|
|
7
|
+
type TRPCCreate = TRPCRootObject<Context, any, {
|
|
8
|
+
transformer: typeof transformer;
|
|
9
|
+
}>;
|
|
10
|
+
export type TRPCMethods = {
|
|
11
|
+
router: TRPCCreate["router"];
|
|
12
|
+
publicProcedure: TRPCCreate["procedure"];
|
|
13
|
+
privateProcedure: TRPCCreate["procedure"];
|
|
14
|
+
adminProcedure: TRPCCreate["procedure"];
|
|
15
|
+
};
|
|
16
|
+
export declare function createAuthContext(auth: BetterAuth): ({ req }: CreateExpressContextOptions) => Promise<{
|
|
17
|
+
session: {
|
|
18
|
+
token: string;
|
|
19
|
+
expiresAt: Date;
|
|
20
|
+
id: string;
|
|
21
|
+
userId: string;
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
updatedAt: Date;
|
|
24
|
+
ipAddress: string | null;
|
|
25
|
+
userAgent: string | null;
|
|
26
|
+
impersonatedBy: string | null;
|
|
27
|
+
activeOrganizationId: string | null;
|
|
28
|
+
activeOrganizationRole: string | null;
|
|
29
|
+
activeTeamId: string | null;
|
|
30
|
+
activeTeamRole: string | null;
|
|
31
|
+
};
|
|
32
|
+
user: {
|
|
33
|
+
email: string;
|
|
34
|
+
metadata: Record<string, unknown>;
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
image: string | null;
|
|
38
|
+
createdAt: Date;
|
|
39
|
+
updatedAt: Date;
|
|
40
|
+
emailVerified: boolean;
|
|
41
|
+
role: string | null;
|
|
42
|
+
banned: boolean | null;
|
|
43
|
+
banReason: string | null;
|
|
44
|
+
banExpires: Date | null;
|
|
45
|
+
stripeCustomerId: string | null;
|
|
46
|
+
paymentCustomerId: string | null;
|
|
47
|
+
paymentPlanTier: string | null;
|
|
48
|
+
paymentPlanExpiresAt: Date | null;
|
|
49
|
+
preferences: string | null;
|
|
50
|
+
onboarding: number | null;
|
|
51
|
+
flags: string | null;
|
|
52
|
+
};
|
|
53
|
+
}>;
|
|
54
|
+
export declare function handleAsyncTRPCResult<T>(result: Promise<Result<T, ServerError>>): Promise<T>;
|
|
55
|
+
export declare function handleTRPCResult<T>(result: Result<T, ServerError>): T;
|
|
56
|
+
export declare function verifyProtectedProcedureContext(ctx: Context): void;
|
|
57
|
+
export declare function verifyAdminProcedureContext(ctx: Context): void;
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAuthContext = createAuthContext;
|
|
4
|
+
exports.handleAsyncTRPCResult = handleAsyncTRPCResult;
|
|
5
|
+
exports.handleTRPCResult = handleTRPCResult;
|
|
6
|
+
exports.verifyProtectedProcedureContext = verifyProtectedProcedureContext;
|
|
7
|
+
exports.verifyAdminProcedureContext = verifyAdminProcedureContext;
|
|
8
|
+
const node_1 = require("better-auth/node");
|
|
9
|
+
const errors_1 = require("#utils/errors");
|
|
10
|
+
const logger_1 = require("#utils/logger");
|
|
11
|
+
function createAuthContext(auth) {
|
|
12
|
+
return async function createContext({ req }) {
|
|
13
|
+
const data = await auth.api.getSession({
|
|
14
|
+
headers: (0, node_1.fromNodeHeaders)(req.headers),
|
|
15
|
+
});
|
|
16
|
+
const user = data?.user || null;
|
|
17
|
+
const session = data?.session || null;
|
|
18
|
+
return {
|
|
19
|
+
session,
|
|
20
|
+
user,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async function handleAsyncTRPCResult(result) {
|
|
25
|
+
return handleTRPCResult(await result);
|
|
26
|
+
}
|
|
27
|
+
function handleTRPCResult(result) {
|
|
28
|
+
if (result.isErr()) {
|
|
29
|
+
logger_1.logger.debug("Is tRPC Error");
|
|
30
|
+
logger_1.logger.error({
|
|
31
|
+
layer: result.error.layer,
|
|
32
|
+
layerName: result.error.layerName,
|
|
33
|
+
error: result.error.toJSON(),
|
|
34
|
+
});
|
|
35
|
+
throw result.error.toTRPC();
|
|
36
|
+
}
|
|
37
|
+
return result.value;
|
|
38
|
+
}
|
|
39
|
+
function verifyProtectedProcedureContext(ctx) {
|
|
40
|
+
if (!ctx.user || !ctx.session) {
|
|
41
|
+
throw new errors_1.ServerError({
|
|
42
|
+
code: "UNAUTHORIZED",
|
|
43
|
+
layer: "controller",
|
|
44
|
+
layerName: "TRPCController",
|
|
45
|
+
}).toTRPC();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function verifyAdminProcedureContext(ctx) {
|
|
49
|
+
if (!ctx.user || !ctx.session) {
|
|
50
|
+
throw new errors_1.ServerError({
|
|
51
|
+
code: "UNAUTHORIZED",
|
|
52
|
+
layer: "controller",
|
|
53
|
+
layerName: "TRPCController",
|
|
54
|
+
}).toTRPC();
|
|
55
|
+
}
|
|
56
|
+
if (ctx.user.role !== "admin") {
|
|
57
|
+
throw new errors_1.ServerError({
|
|
58
|
+
code: "FORBIDDEN",
|
|
59
|
+
layer: "controller",
|
|
60
|
+
layerName: "TRPCController",
|
|
61
|
+
}).toTRPC();
|
|
62
|
+
}
|
|
63
|
+
}
|