@m5kdev/backend 0.2.0 → 0.3.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/modules/access/access.repository.d.ts +2 -2
- package/dist/src/modules/access/access.repository.js +2 -2
- package/dist/src/modules/access/access.service.d.ts +4 -4
- package/dist/src/modules/access/access.service.js +1 -1
- package/dist/src/modules/access/access.test.js +4 -4
- package/dist/src/modules/ai/ai.db.js +1 -1
- package/dist/src/modules/ai/ai.prompt.js +1 -1
- package/dist/src/modules/ai/ai.repository.d.ts +2 -2
- package/dist/src/modules/ai/ai.repository.js +2 -2
- package/dist/src/modules/ai/ai.service.d.ts +6 -6
- package/dist/src/modules/ai/ai.service.js +1 -1
- package/dist/src/modules/ai/ai.trpc.d.ts +2 -2
- package/dist/src/modules/ai/ai.trpc.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.dto.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.prompt.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts +3 -3
- package/dist/src/modules/ai/ideogram/ideogram.repository.js +1 -1
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts +4 -4
- package/dist/src/modules/ai/ideogram/ideogram.service.js +1 -1
- package/dist/src/modules/auth/auth.dto.d.ts +5 -5
- package/dist/src/modules/auth/auth.lib.d.ts +10 -10
- package/dist/src/modules/auth/auth.lib.js +4 -4
- package/dist/src/modules/auth/auth.middleware.d.ts +1 -1
- package/dist/src/modules/auth/auth.middleware.js +2 -2
- package/dist/src/modules/auth/auth.repository.d.ts +4 -4
- package/dist/src/modules/auth/auth.repository.js +2 -2
- package/dist/src/modules/auth/auth.service.d.ts +7 -7
- package/dist/src/modules/auth/auth.service.js +2 -2
- package/dist/src/modules/auth/auth.trpc.d.ts +25 -25
- package/dist/src/modules/auth/auth.trpc.js +2 -2
- package/dist/src/modules/auth/auth.utils.js +1 -1
- package/dist/src/modules/base/base.abstract.d.ts +4 -4
- package/dist/src/modules/base/base.abstract.js +2 -2
- package/dist/src/modules/base/base.dto.d.ts +3 -3
- package/dist/src/modules/base/base.grants.d.ts +2 -2
- package/dist/src/modules/base/base.grants.test.js +2 -2
- package/dist/src/modules/base/base.repository.d.ts +2 -2
- package/dist/src/modules/base/base.repository.js +5 -5
- package/dist/src/modules/base/base.service.d.ts +5 -5
- package/dist/src/modules/base/base.service.js +2 -2
- package/dist/src/modules/billing/billing.repository.d.ts +2 -2
- package/dist/src/modules/billing/billing.repository.js +4 -4
- package/dist/src/modules/billing/billing.router.d.ts +2 -2
- package/dist/src/modules/billing/billing.service.d.ts +4 -4
- package/dist/src/modules/billing/billing.service.js +2 -2
- package/dist/src/modules/billing/billing.trpc.d.ts +2 -2
- package/dist/src/modules/billing/billing.trpc.js +1 -1
- package/dist/src/modules/clay/clay.repository.d.ts +2 -2
- package/dist/src/modules/clay/clay.repository.js +1 -1
- package/dist/src/modules/clay/clay.service.d.ts +3 -3
- package/dist/src/modules/clay/clay.service.js +1 -1
- package/dist/src/modules/connect/connect.dto.d.ts +4 -4
- package/dist/src/modules/connect/connect.oauth.js +1 -1
- package/dist/src/modules/connect/connect.repository.d.ts +4 -4
- package/dist/src/modules/connect/connect.repository.js +2 -2
- package/dist/src/modules/connect/connect.router.d.ts +1 -1
- package/dist/src/modules/connect/connect.service.d.ts +12 -12
- package/dist/src/modules/connect/connect.service.js +1 -1
- package/dist/src/modules/connect/connect.trpc.d.ts +3 -3
- package/dist/src/modules/connect/connect.trpc.js +1 -1
- package/dist/src/modules/crypto/crypto.repository.d.ts +1 -1
- package/dist/src/modules/crypto/crypto.repository.js +2 -2
- package/dist/src/modules/crypto/crypto.service.d.ts +3 -3
- package/dist/src/modules/crypto/crypto.service.js +1 -1
- package/dist/src/modules/email/email.service.d.ts +1 -1
- package/dist/src/modules/email/email.service.js +1 -1
- package/dist/src/modules/file/file.repository.d.ts +2 -2
- package/dist/src/modules/file/file.repository.js +1 -1
- package/dist/src/modules/file/file.router.js +2 -2
- package/dist/src/modules/file/file.service.d.ts +3 -3
- package/dist/src/modules/file/file.service.js +1 -1
- package/dist/src/modules/recurrence/recurrence.db.js +1 -1
- package/dist/src/modules/recurrence/recurrence.repository.d.ts +2 -2
- package/dist/src/modules/recurrence/recurrence.repository.js +2 -2
- package/dist/src/modules/recurrence/recurrence.service.d.ts +4 -4
- package/dist/src/modules/recurrence/recurrence.service.js +1 -1
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts +3 -3
- package/dist/src/modules/recurrence/recurrence.trpc.js +1 -1
- package/dist/src/modules/social/social.service.d.ts +5 -5
- package/dist/src/modules/social/social.service.js +1 -1
- package/dist/src/modules/social/social.types.d.ts +2 -2
- package/dist/src/modules/tag/tag.db.js +1 -1
- package/dist/src/modules/tag/tag.dto.d.ts +1 -1
- package/dist/src/modules/tag/tag.dto.js +2 -2
- package/dist/src/modules/tag/tag.repository.d.ts +3 -3
- package/dist/src/modules/tag/tag.repository.js +2 -2
- package/dist/src/modules/tag/tag.service.d.ts +6 -6
- package/dist/src/modules/tag/tag.service.js +1 -1
- package/dist/src/modules/tag/tag.trpc.d.ts +4 -4
- package/dist/src/modules/tag/tag.trpc.js +2 -2
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts +1 -1
- package/dist/src/modules/video/video.service.d.ts +2 -2
- package/dist/src/modules/video/video.service.js +1 -1
- package/dist/src/modules/webhook/webhook.dto.js +1 -1
- package/dist/src/modules/webhook/webhook.repository.d.ts +2 -2
- package/dist/src/modules/webhook/webhook.repository.js +1 -1
- package/dist/src/modules/webhook/webhook.service.d.ts +2 -2
- package/dist/src/modules/webhook/webhook.service.js +1 -1
- package/dist/src/modules/workflow/workflow.db.js +1 -1
- package/dist/src/modules/workflow/workflow.repository.d.ts +2 -2
- package/dist/src/modules/workflow/workflow.repository.js +2 -2
- package/dist/src/modules/workflow/workflow.service.d.ts +4 -4
- package/dist/src/modules/workflow/workflow.service.js +1 -1
- package/dist/src/modules/workflow/workflow.trpc.d.ts +2 -2
- package/dist/src/modules/workflow/workflow.trpc.js +1 -1
- package/dist/src/modules/workflow/workflow.types.d.ts +2 -2
- package/dist/src/modules/workflow/workflow.utils.js +3 -3
- package/dist/src/types.d.ts +27 -27
- package/dist/src/types.js +3 -3
- package/dist/src/utils/errors.d.ts +1 -1
- package/dist/src/utils/trpc.d.ts +8 -8
- package/dist/src/utils/trpc.js +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -25
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
2
|
-
import type { ServerResultAsync } from "
|
|
3
|
-
import { BaseRepository } from "
|
|
2
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
3
|
+
import { BaseRepository } from "../base/base.repository";
|
|
4
4
|
declare const schema: {
|
|
5
5
|
users: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
6
6
|
name: "users";
|
|
@@ -4,8 +4,8 @@ exports.AccessRepository = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
6
|
const neverthrow_1 = require("neverthrow");
|
|
7
|
-
const auth = tslib_1.__importStar(require("
|
|
8
|
-
const base_repository_1 = require("
|
|
7
|
+
const auth = tslib_1.__importStar(require("../auth/auth.db"));
|
|
8
|
+
const base_repository_1 = require("../base/base.repository");
|
|
9
9
|
const schema = { ...auth };
|
|
10
10
|
class AccessRepository extends base_repository_1.BaseRepository {
|
|
11
11
|
async getOrganizationRole(userId, organizationId) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Statements } from "better-auth/plugins/access";
|
|
2
|
-
import type { AccessRepository } from "
|
|
3
|
-
import type { AccessControlRoles } from "
|
|
4
|
-
import type { ServerResultAsync } from "
|
|
5
|
-
import { BaseService } from "
|
|
2
|
+
import type { AccessRepository } from "./access.repository";
|
|
3
|
+
import type { AccessControlRoles } from "./access.utils";
|
|
4
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
|
+
import { BaseService } from "../base/base.service";
|
|
6
6
|
type User = {
|
|
7
7
|
id: string;
|
|
8
8
|
role: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AccessService = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const base_service_1 = require("
|
|
5
|
+
const base_service_1 = require("../base/base.service");
|
|
6
6
|
class AccessService extends base_service_1.BaseService {
|
|
7
7
|
acr;
|
|
8
8
|
constructor(repositories, acr) {
|
|
@@ -5,10 +5,10 @@ const client_1 = require("@libsql/client");
|
|
|
5
5
|
const libsql_1 = require("drizzle-orm/libsql");
|
|
6
6
|
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const access_repository_1 = require("
|
|
9
|
-
const access_service_1 = require("
|
|
10
|
-
const access_utils_1 = require("
|
|
11
|
-
const authSchema = tslib_1.__importStar(require("
|
|
8
|
+
const access_repository_1 = require("./access.repository");
|
|
9
|
+
const access_service_1 = require("./access.service");
|
|
10
|
+
const access_utils_1 = require("./access.utils");
|
|
11
|
+
const authSchema = tslib_1.__importStar(require("../auth/auth.db"));
|
|
12
12
|
describe("AccessService", () => {
|
|
13
13
|
const statements = {
|
|
14
14
|
project: ["create", "share", "update", "delete"],
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.aiUsage = exports.chats = void 0;
|
|
4
4
|
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
|
-
const auth_db_1 = require("
|
|
6
|
+
const auth_db_1 = require("../auth/auth.db");
|
|
7
7
|
exports.chats = (0, sqlite_core_1.sqliteTable)("chats", {
|
|
8
8
|
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
9
9
|
userId: (0, sqlite_core_1.text)("user_id")
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Prompt = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const mustache_1 = tslib_1.__importDefault(require("mustache"));
|
|
6
|
-
const logger_1 = require("
|
|
6
|
+
const logger_1 = require("../../utils/logger");
|
|
7
7
|
class Prompt {
|
|
8
8
|
prompt;
|
|
9
9
|
name;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
|
2
2
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseTableRepository } from "
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseTableRepository } from "../base/base.repository";
|
|
5
5
|
declare const schema: {
|
|
6
6
|
chats: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
7
7
|
name: "chats";
|
|
@@ -4,8 +4,8 @@ exports.AiUsageRepository = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
6
|
const neverthrow_1 = require("neverthrow");
|
|
7
|
-
const ai = tslib_1.__importStar(require("
|
|
8
|
-
const base_repository_1 = require("
|
|
7
|
+
const ai = tslib_1.__importStar(require("./ai.db"));
|
|
8
|
+
const base_repository_1 = require("../base/base.repository");
|
|
9
9
|
const schema = { ...ai };
|
|
10
10
|
class AiUsageRepository extends base_repository_1.BaseTableRepository {
|
|
11
11
|
getUsage(userId) {
|
|
@@ -7,12 +7,12 @@ import type { OpenRouterProvider } from "@openrouter/ai-sdk-provider";
|
|
|
7
7
|
import { generateObject, generateText } from "ai";
|
|
8
8
|
import type Replicate from "replicate";
|
|
9
9
|
import type { ZodType, z } from "zod";
|
|
10
|
-
import type { AiUsageRepository, AiUsageRow } from "
|
|
11
|
-
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "
|
|
12
|
-
import type { IdeogramService } from "
|
|
13
|
-
import type { User } from "
|
|
14
|
-
import type { ServerResultAsync } from "
|
|
15
|
-
import { BaseService } from "
|
|
10
|
+
import type { AiUsageRepository, AiUsageRow } from "./ai.repository";
|
|
11
|
+
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "./ideogram/ideogram.dto";
|
|
12
|
+
import type { IdeogramService } from "./ideogram/ideogram.service";
|
|
13
|
+
import type { User } from "../auth/auth.lib";
|
|
14
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
15
|
+
import { BaseService } from "../base/base.service";
|
|
16
16
|
type MastraAgent = ReturnType<Mastra["getAgent"]>;
|
|
17
17
|
type MastraAgentGenerateOptions = Parameters<MastraAgent["generate"]>[1];
|
|
18
18
|
type MessageListInput = {
|
|
@@ -7,7 +7,7 @@ const request_context_1 = require("@mastra/core/request-context");
|
|
|
7
7
|
const rag_1 = require("@mastra/rag");
|
|
8
8
|
const ai_1 = require("ai");
|
|
9
9
|
const neverthrow_1 = require("neverthrow");
|
|
10
|
-
const base_service_1 = require("
|
|
10
|
+
const base_service_1 = require("../base/base.service");
|
|
11
11
|
class AIService extends base_service_1.BaseService {
|
|
12
12
|
helpers = {
|
|
13
13
|
arrayToPseudoXML: ai_utils_1.arrayToPseudoXML,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Mastra } from "@mastra/core";
|
|
2
|
-
import type { AIService } from "
|
|
3
|
-
import { type TRPCMethods } from "
|
|
2
|
+
import type { AIService } from "./ai.service";
|
|
3
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
4
4
|
export declare function createAITRPC<MastraInstance extends Mastra>({ router, adminProcedure }: TRPCMethods, aiService: AIService<MastraInstance>): import("@trpc/server").TRPCBuiltRouter<{
|
|
5
5
|
ctx: import("../auth/auth.lib").Context;
|
|
6
6
|
meta: any;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAITRPC = createAITRPC;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const trpc_1 = require("
|
|
5
|
+
const trpc_1 = require("../../utils/trpc");
|
|
6
6
|
function createAITRPC({ router, adminProcedure }, aiService) {
|
|
7
7
|
return router({
|
|
8
8
|
getUserUsage: adminProcedure
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ideogramV3GenerateOutputSchema = exports.ideogramV3GenerateInputSchema = exports.ideogramAISchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const ideogram_constants_1 = require("
|
|
5
|
+
const ideogram_constants_1 = require("./ideogram.constants");
|
|
6
6
|
exports.ideogramAISchema = zod_1.z.object({
|
|
7
7
|
prompt: zod_1.z.string().describe("Create a prompt for the image generation."),
|
|
8
8
|
style_type: zod_1.z.enum(ideogram_constants_1.ideogramStyleTypes).describe("Choose a style type for the image generation."),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Prompt } from "
|
|
1
|
+
import { Prompt } from "../ai.prompt";
|
|
2
2
|
export declare const ideogramGenerateSystemPrompt: Prompt<Record<string, never>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ideogramGenerateSystemPrompt = void 0;
|
|
4
|
-
const ai_prompt_1 = require("
|
|
4
|
+
const ai_prompt_1 = require("../ai.prompt");
|
|
5
5
|
exports.ideogramGenerateSystemPrompt = new ai_prompt_1.Prompt(`
|
|
6
6
|
You are an expert prompt writer for Ideogram. Use the instruction below to assist user in creating prompts for Ideogram.
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "
|
|
2
|
-
import type { ServerResultAsync } from "
|
|
3
|
-
import { BaseExternaRepository } from "
|
|
1
|
+
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "./ideogram.dto";
|
|
2
|
+
import type { ServerResultAsync } from "../../base/base.dto";
|
|
3
|
+
import { BaseExternaRepository } from "../../base/base.repository";
|
|
4
4
|
export declare class IdeogramRepository extends BaseExternaRepository {
|
|
5
5
|
generate(input: IdeogramV3GenerateInput): ServerResultAsync<IdeogramV3GenerateOutput>;
|
|
6
6
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdeogramRepository = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const base_repository_1 = require("
|
|
5
|
+
const base_repository_1 = require("../../base/base.repository");
|
|
6
6
|
class IdeogramRepository extends base_repository_1.BaseExternaRepository {
|
|
7
7
|
async generate(input) {
|
|
8
8
|
if (!process.env.IDEOGRAM_API_KEY)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "
|
|
2
|
-
import type { IdeogramRepository } from "
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseService } from "
|
|
1
|
+
import type { IdeogramV3GenerateInput, IdeogramV3GenerateOutput } from "./ideogram.dto";
|
|
2
|
+
import type { IdeogramRepository } from "./ideogram.repository";
|
|
3
|
+
import type { ServerResultAsync } from "../../base/base.dto";
|
|
4
|
+
import { BaseService } from "../../base/base.service";
|
|
5
5
|
export declare class IdeogramService extends BaseService<{
|
|
6
6
|
ideogram: IdeogramRepository;
|
|
7
7
|
}, never> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdeogramService = void 0;
|
|
4
|
-
const base_service_1 = require("
|
|
4
|
+
const base_service_1 = require("../../base/base.service");
|
|
5
5
|
class IdeogramService extends base_service_1.BaseService {
|
|
6
6
|
async generate(input) {
|
|
7
7
|
const result = await this.repository.ideogram.generate(input);
|
|
@@ -10,12 +10,12 @@ export declare const waitlistSchema: z.ZodObject<{
|
|
|
10
10
|
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
export declare const waitlistOutputSchema: z.ZodObject<{
|
|
13
|
-
id: z.ZodString;
|
|
14
13
|
name: z.ZodNullable<z.ZodString>;
|
|
14
|
+
id: z.ZodString;
|
|
15
15
|
email: z.ZodNullable<z.ZodString>;
|
|
16
|
+
status: z.ZodString;
|
|
16
17
|
createdAt: z.ZodDate;
|
|
17
18
|
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
18
|
-
status: z.ZodString;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
20
|
export type WaitlistOutput = z.infer<typeof waitlistOutputSchema>;
|
|
21
21
|
export type Waitlist = z.infer<typeof waitlistSchema>;
|
|
@@ -32,10 +32,10 @@ export declare const accountClaimSchema: z.ZodObject<{
|
|
|
32
32
|
}, z.core.$strip>;
|
|
33
33
|
export declare const accountClaimOutputSchema: z.ZodObject<{
|
|
34
34
|
id: z.ZodString;
|
|
35
|
+
status: z.ZodString;
|
|
35
36
|
createdAt: z.ZodDate;
|
|
36
37
|
updatedAt: z.ZodNullable<z.ZodDate>;
|
|
37
38
|
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
38
|
-
status: z.ZodString;
|
|
39
39
|
claimUserId: z.ZodNullable<z.ZodString>;
|
|
40
40
|
claimedAt: z.ZodNullable<z.ZodDate>;
|
|
41
41
|
claimedEmail: z.ZodNullable<z.ZodString>;
|
|
@@ -53,13 +53,13 @@ export declare const accountClaimMagicLinkSchema: z.ZodObject<{
|
|
|
53
53
|
createdAt: z.ZodDate;
|
|
54
54
|
}, z.core.$strip>;
|
|
55
55
|
export declare const accountClaimMagicLinkOutputSchema: z.ZodObject<{
|
|
56
|
+
url: z.ZodString;
|
|
56
57
|
id: z.ZodString;
|
|
57
58
|
email: z.ZodString;
|
|
58
59
|
createdAt: z.ZodDate;
|
|
59
|
-
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
60
60
|
userId: z.ZodString;
|
|
61
|
+
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
61
62
|
claimId: z.ZodString;
|
|
62
|
-
url: z.ZodString;
|
|
63
63
|
}, z.core.$strip>;
|
|
64
64
|
export type AccountClaimMagicLink = z.infer<typeof accountClaimMagicLinkSchema>;
|
|
65
65
|
export type AccountClaimMagicLinkOutput = z.infer<typeof accountClaimMagicLinkOutputSchema>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type BetterAuthOptions, betterAuth } from "better-auth";
|
|
2
2
|
import { type InferSelectModel } from "drizzle-orm";
|
|
3
3
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
4
|
-
import * as auth from "
|
|
5
|
-
import type { BillingService } from "
|
|
6
|
-
import type { EmailService } from "
|
|
4
|
+
import * as auth from "./auth.db";
|
|
5
|
+
import type { BillingService } from "../billing/billing.service";
|
|
6
|
+
import type { EmailService } from "../email/email.service";
|
|
7
7
|
declare const schema: {
|
|
8
8
|
users: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
9
9
|
name: "users";
|
|
@@ -3260,13 +3260,13 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
|
|
|
3260
3260
|
$Infer: {
|
|
3261
3261
|
body: ({
|
|
3262
3262
|
permission: {
|
|
3263
|
-
readonly user?: ("
|
|
3263
|
+
readonly user?: ("get" | "create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
|
|
3264
3264
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3265
3265
|
};
|
|
3266
3266
|
permissions?: never | undefined;
|
|
3267
3267
|
} | {
|
|
3268
3268
|
permissions: {
|
|
3269
|
-
readonly user?: ("
|
|
3269
|
+
readonly user?: ("get" | "create" | "update" | "delete" | "set-role" | "list" | "ban" | "impersonate" | "set-password")[] | undefined;
|
|
3270
3270
|
readonly session?: ("delete" | "list" | "revoke")[] | undefined;
|
|
3271
3271
|
};
|
|
3272
3272
|
permission?: never | undefined;
|
|
@@ -3528,7 +3528,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
|
|
|
3528
3528
|
id: string;
|
|
3529
3529
|
organizationId: string;
|
|
3530
3530
|
email: string;
|
|
3531
|
-
role: "member" | "
|
|
3531
|
+
role: "member" | "admin" | "owner";
|
|
3532
3532
|
status: import("better-auth/plugins", { with: { "resolution-mode": "import" } }).InvitationStatus;
|
|
3533
3533
|
inviterId: string;
|
|
3534
3534
|
expiresAt: Date;
|
|
@@ -3538,7 +3538,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
|
|
|
3538
3538
|
Member: {
|
|
3539
3539
|
id: string;
|
|
3540
3540
|
organizationId: string;
|
|
3541
|
-
role: "member" | "
|
|
3541
|
+
role: "member" | "admin" | "owner";
|
|
3542
3542
|
createdAt: Date;
|
|
3543
3543
|
userId: string;
|
|
3544
3544
|
teamId?: string | undefined | undefined;
|
|
@@ -3566,7 +3566,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
|
|
|
3566
3566
|
members: {
|
|
3567
3567
|
id: string;
|
|
3568
3568
|
organizationId: string;
|
|
3569
|
-
role: "member" | "
|
|
3569
|
+
role: "member" | "admin" | "owner";
|
|
3570
3570
|
createdAt: Date;
|
|
3571
3571
|
userId: string;
|
|
3572
3572
|
teamId?: string | undefined | undefined;
|
|
@@ -3581,7 +3581,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
|
|
|
3581
3581
|
id: string;
|
|
3582
3582
|
organizationId: string;
|
|
3583
3583
|
email: string;
|
|
3584
|
-
role: "member" | "
|
|
3584
|
+
role: "member" | "admin" | "owner";
|
|
3585
3585
|
status: import("better-auth/plugins", { with: { "resolution-mode": "import" } }).InvitationStatus;
|
|
3586
3586
|
inviterId: string;
|
|
3587
3587
|
expiresAt: Date;
|
|
@@ -4811,7 +4811,7 @@ export declare function createBetterAuth<O extends Orm, S extends Schema, E exte
|
|
|
4811
4811
|
} | undefined;
|
|
4812
4812
|
verification?: {
|
|
4813
4813
|
modelName?: string;
|
|
4814
|
-
fields?: Partial<Record<"
|
|
4814
|
+
fields?: Partial<Record<"value" | "createdAt" | "updatedAt" | "expiresAt" | "identifier", string>>;
|
|
4815
4815
|
additionalFields?: {
|
|
4816
4816
|
[key: string]: import("better-auth", { with: { "resolution-mode": "import" } }).DBFieldAttribute;
|
|
4817
4817
|
};
|
|
@@ -7,10 +7,10 @@ const drizzle_1 = require("better-auth/adapters/drizzle");
|
|
|
7
7
|
const api_1 = require("better-auth/api");
|
|
8
8
|
const plugins_1 = require("better-auth/plugins");
|
|
9
9
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
10
|
-
const auth = tslib_1.__importStar(require("
|
|
11
|
-
const auth_utils_1 = require("
|
|
12
|
-
const logger_1 = require("
|
|
13
|
-
const posthog_1 = require("
|
|
10
|
+
const auth = tslib_1.__importStar(require("./auth.db"));
|
|
11
|
+
const auth_utils_1 = require("./auth.utils");
|
|
12
|
+
const logger_1 = require("../../utils/logger");
|
|
13
|
+
const posthog_1 = require("../../utils/posthog");
|
|
14
14
|
const schema = { ...auth };
|
|
15
15
|
function createBetterAuth({ orm, schema, services, hooks, options, config }) {
|
|
16
16
|
const { email: emailService, billing: billingService } = services;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InferSelectModel } from "drizzle-orm";
|
|
2
2
|
import type { NextFunction, Request, Response } from "express";
|
|
3
|
-
import type { BetterAuth } from "
|
|
3
|
+
import type { BetterAuth } from "./auth.lib";
|
|
4
4
|
declare const users: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
5
5
|
name: "users";
|
|
6
6
|
schema: undefined;
|
|
@@ -4,8 +4,8 @@ exports.createAuthMiddleware = createAuthMiddleware;
|
|
|
4
4
|
exports.createRoleAuthMiddleware = createRoleAuthMiddleware;
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const node_1 = require("better-auth/node");
|
|
7
|
-
const auth = tslib_1.__importStar(require("
|
|
8
|
-
const posthog_1 = require("
|
|
7
|
+
const auth = tslib_1.__importStar(require("./auth.db"));
|
|
8
|
+
const posthog_1 = require("../../utils/posthog");
|
|
9
9
|
const { users, sessions } = auth;
|
|
10
10
|
function createAuthMiddleware(auth) {
|
|
11
11
|
return (req, res, next) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
2
|
-
import * as auth from "
|
|
3
|
-
import type { AccountClaim, AccountClaimMagicLink, AccountClaimMagicLinkOutput, AccountClaimOutput, Waitlist, WaitlistOutput } from "
|
|
4
|
-
import type { ServerResultAsync } from "
|
|
5
|
-
import { BaseRepository } from "
|
|
2
|
+
import * as auth from "./auth.db";
|
|
3
|
+
import type { AccountClaim, AccountClaimMagicLink, AccountClaimMagicLinkOutput, AccountClaimOutput, Waitlist, WaitlistOutput } from "./auth.dto";
|
|
4
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
|
+
import { BaseRepository } from "../base/base.repository";
|
|
6
6
|
declare const schema: {
|
|
7
7
|
users: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
8
8
|
name: "users";
|
|
@@ -5,8 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
6
|
const neverthrow_1 = require("neverthrow");
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
8
|
-
const auth = tslib_1.__importStar(require("
|
|
9
|
-
const base_repository_1 = require("
|
|
8
|
+
const auth = tslib_1.__importStar(require("./auth.db"));
|
|
9
|
+
const base_repository_1 = require("../base/base.repository");
|
|
10
10
|
const schema = { ...auth };
|
|
11
11
|
class AuthRepository extends base_repository_1.BaseRepository {
|
|
12
12
|
async getUserWaitlistCount(userId, tx) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { AccountClaim, AccountClaimMagicLinkOutput, AccountClaimOutput, Waitlist, WaitlistOutput } from "
|
|
2
|
-
import type { User } from "
|
|
3
|
-
import type { AuthRepository } from "
|
|
4
|
-
import type { ServerResultAsync } from "
|
|
5
|
-
import { BaseService } from "
|
|
6
|
-
import type { BillingService } from "
|
|
7
|
-
import type { EmailService } from "
|
|
1
|
+
import type { AccountClaim, AccountClaimMagicLinkOutput, AccountClaimOutput, Waitlist, WaitlistOutput } from "./auth.dto";
|
|
2
|
+
import type { User } from "./auth.lib";
|
|
3
|
+
import type { AuthRepository } from "./auth.repository";
|
|
4
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
|
+
import { BaseService } from "../base/base.service";
|
|
6
|
+
import type { BillingService } from "../billing/billing.service";
|
|
7
|
+
import type { EmailService } from "../email/email.service";
|
|
8
8
|
type AuthServiceDependencies = {
|
|
9
9
|
email: EmailService;
|
|
10
10
|
} | {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthService = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const base_service_1 = require("
|
|
6
|
-
const posthog_1 = require("
|
|
5
|
+
const base_service_1 = require("../base/base.service");
|
|
6
|
+
const posthog_1 = require("../../utils/posthog");
|
|
7
7
|
class AuthService extends base_service_1.BaseService {
|
|
8
8
|
getBillingService() {
|
|
9
9
|
if (!("billing" in this.service))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AuthService } from "
|
|
2
|
-
import { type TRPCMethods } from "
|
|
1
|
+
import type { AuthService } from "./auth.service";
|
|
2
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
3
3
|
export declare function createAuthTRPC({ router, publicProcedure, privateProcedure: procedure, adminProcedure }: TRPCMethods, authService: AuthService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
4
|
ctx: import("./auth.lib").Context;
|
|
5
5
|
meta: any;
|
|
@@ -48,11 +48,11 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
48
48
|
listAccountClaims: import("@trpc/server").TRPCQueryProcedure<{
|
|
49
49
|
input: void;
|
|
50
50
|
output: {
|
|
51
|
-
expiresAt: Date | null;
|
|
52
51
|
id: string;
|
|
52
|
+
status: string;
|
|
53
53
|
createdAt: Date;
|
|
54
54
|
updatedAt: Date | null;
|
|
55
|
-
|
|
55
|
+
expiresAt: Date | null;
|
|
56
56
|
claimUserId: string | null;
|
|
57
57
|
claimedAt: Date | null;
|
|
58
58
|
claimedEmail: string | null;
|
|
@@ -65,12 +65,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
65
65
|
email?: string | undefined;
|
|
66
66
|
};
|
|
67
67
|
output: {
|
|
68
|
-
email: string;
|
|
69
68
|
url: string;
|
|
70
|
-
expiresAt: Date | null;
|
|
71
69
|
id: string;
|
|
72
|
-
|
|
70
|
+
email: string;
|
|
73
71
|
createdAt: Date;
|
|
72
|
+
userId: string;
|
|
73
|
+
expiresAt: Date | null;
|
|
74
74
|
claimId: string;
|
|
75
75
|
};
|
|
76
76
|
meta: any;
|
|
@@ -80,12 +80,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
80
80
|
claimId: string;
|
|
81
81
|
};
|
|
82
82
|
output: {
|
|
83
|
-
email: string;
|
|
84
83
|
url: string;
|
|
85
|
-
expiresAt: Date | null;
|
|
86
84
|
id: string;
|
|
87
|
-
|
|
85
|
+
email: string;
|
|
88
86
|
createdAt: Date;
|
|
87
|
+
userId: string;
|
|
88
|
+
expiresAt: Date | null;
|
|
89
89
|
claimId: string;
|
|
90
90
|
}[];
|
|
91
91
|
meta: any;
|
|
@@ -138,12 +138,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
138
138
|
listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
139
139
|
input: void;
|
|
140
140
|
output: {
|
|
141
|
-
email: string | null;
|
|
142
|
-
id: string;
|
|
143
141
|
name: string | null;
|
|
142
|
+
id: string;
|
|
143
|
+
email: string | null;
|
|
144
|
+
status: string;
|
|
144
145
|
createdAt: Date;
|
|
145
146
|
updatedAt: Date | null;
|
|
146
|
-
status: string;
|
|
147
147
|
}[];
|
|
148
148
|
meta: any;
|
|
149
149
|
}>;
|
|
@@ -152,12 +152,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
152
152
|
email: string;
|
|
153
153
|
};
|
|
154
154
|
output: {
|
|
155
|
-
email: string | null;
|
|
156
|
-
id: string;
|
|
157
155
|
name: string | null;
|
|
156
|
+
id: string;
|
|
157
|
+
email: string | null;
|
|
158
|
+
status: string;
|
|
158
159
|
createdAt: Date;
|
|
159
160
|
updatedAt: Date | null;
|
|
160
|
-
status: string;
|
|
161
161
|
};
|
|
162
162
|
meta: any;
|
|
163
163
|
}>;
|
|
@@ -183,12 +183,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
183
183
|
id: string;
|
|
184
184
|
};
|
|
185
185
|
output: {
|
|
186
|
-
email: string | null;
|
|
187
|
-
id: string;
|
|
188
186
|
name: string | null;
|
|
187
|
+
id: string;
|
|
188
|
+
email: string | null;
|
|
189
|
+
status: string;
|
|
189
190
|
createdAt: Date;
|
|
190
191
|
updatedAt: Date | null;
|
|
191
|
-
status: string;
|
|
192
192
|
};
|
|
193
193
|
meta: any;
|
|
194
194
|
}>;
|
|
@@ -197,12 +197,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
197
197
|
id: string;
|
|
198
198
|
};
|
|
199
199
|
output: {
|
|
200
|
-
email: string | null;
|
|
201
|
-
id: string;
|
|
202
200
|
name: string | null;
|
|
201
|
+
id: string;
|
|
202
|
+
email: string | null;
|
|
203
|
+
status: string;
|
|
203
204
|
createdAt: Date;
|
|
204
205
|
updatedAt: Date | null;
|
|
205
|
-
status: string;
|
|
206
206
|
};
|
|
207
207
|
meta: any;
|
|
208
208
|
}>;
|
|
@@ -211,12 +211,12 @@ export declare function createAuthTRPC({ router, publicProcedure, privateProcedu
|
|
|
211
211
|
email: string;
|
|
212
212
|
};
|
|
213
213
|
output: {
|
|
214
|
-
email: string | null;
|
|
215
|
-
id: string;
|
|
216
214
|
name: string | null;
|
|
215
|
+
id: string;
|
|
216
|
+
email: string | null;
|
|
217
|
+
status: string;
|
|
217
218
|
createdAt: Date;
|
|
218
219
|
updatedAt: Date | null;
|
|
219
|
-
status: string;
|
|
220
220
|
};
|
|
221
221
|
meta: any;
|
|
222
222
|
}>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAuthTRPC = createAuthTRPC;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const auth_dto_1 = require("
|
|
6
|
-
const trpc_1 = require("
|
|
5
|
+
const auth_dto_1 = require("./auth.dto");
|
|
6
|
+
const trpc_1 = require("../../utils/trpc");
|
|
7
7
|
function createAuthTRPC({ router, publicProcedure, privateProcedure: procedure, adminProcedure }, authService) {
|
|
8
8
|
return router({
|
|
9
9
|
getUserWaitlistCount: procedure.output(zod_1.z.number()).query(async ({ ctx }) => {
|
|
@@ -5,7 +5,7 @@ exports.createOrganizationAndTeam = createOrganizationAndTeam;
|
|
|
5
5
|
const tslib_1 = require("tslib");
|
|
6
6
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
8
|
-
const auth = tslib_1.__importStar(require("
|
|
8
|
+
const auth = tslib_1.__importStar(require("./auth.db"));
|
|
9
9
|
const schema = { ...auth };
|
|
10
10
|
async function getActiveOrganizationAndTeam(orm, schema, userId) {
|
|
11
11
|
let organizationId;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TRPC_ERROR_CODE_KEY } from "@trpc/server";
|
|
2
|
-
import type { ServerResult, ServerResultAsync } from "
|
|
3
|
-
import type { ServerErrorLayer } from "
|
|
4
|
-
import { ServerError } from "
|
|
5
|
-
import { logger } from "
|
|
2
|
+
import type { ServerResult, ServerResultAsync } from "./base.dto";
|
|
3
|
+
import type { ServerErrorLayer } from "./base.types";
|
|
4
|
+
import { ServerError } from "../../utils/errors";
|
|
5
|
+
import { logger } from "../../utils/logger";
|
|
6
6
|
export declare abstract class Base {
|
|
7
7
|
layer: ServerErrorLayer;
|
|
8
8
|
logger: ReturnType<typeof logger.child>;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Base = void 0;
|
|
4
4
|
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const errors_1 = require("
|
|
6
|
-
const logger_1 = require("
|
|
5
|
+
const errors_1 = require("../../utils/errors");
|
|
6
|
+
const logger_1 = require("../../utils/logger");
|
|
7
7
|
class Base {
|
|
8
8
|
layer;
|
|
9
9
|
logger;
|