@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,9 +1,9 @@
|
|
|
1
1
|
import type { CreateRecurrenceSchema, DeleteRecurrenceRulesSchema, DeleteRecurrenceSchema, UpdateRecurrenceRulesSchema, UpdateRecurrenceSchema } from "@m5kdev/commons/modules/recurrence/recurrence.schema";
|
|
2
2
|
import type { QueryInput } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
3
|
-
import type { Context, User } from "
|
|
4
|
-
import type { ServerResultAsync } from "
|
|
5
|
-
import { BaseService } from "
|
|
6
|
-
import type { CreateWithRulesResult, RecurrenceRepository, RecurrenceRulesRepository } from "
|
|
3
|
+
import type { Context, User } from "../auth/auth.lib";
|
|
4
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
|
+
import { BaseService } from "../base/base.service";
|
|
6
|
+
import type { CreateWithRulesResult, RecurrenceRepository, RecurrenceRulesRepository } from "./recurrence.repository";
|
|
7
7
|
export declare class RecurrenceService extends BaseService<{
|
|
8
8
|
recurrence: RecurrenceRepository;
|
|
9
9
|
recurrenceRules: RecurrenceRulesRepository;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RecurrenceService = 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
|
const RECURRENCE_RULE_INSERT_KEYS = [
|
|
7
7
|
"freq",
|
|
8
8
|
"dtstart",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RecurrenceService } from "
|
|
2
|
-
import { type TRPCMethods } from "
|
|
1
|
+
import type { RecurrenceService } from "./recurrence.service";
|
|
2
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
3
3
|
export declare function createRecurrenceTRPC({ router, privateProcedure: procedure }: TRPCMethods, recurrenceService: RecurrenceService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
4
|
ctx: import("../auth/auth.lib").Context;
|
|
5
5
|
meta: any;
|
|
@@ -15,7 +15,7 @@ export declare function createRecurrenceTRPC({ router, privateProcedure: procedu
|
|
|
15
15
|
filters?: {
|
|
16
16
|
columnId: string;
|
|
17
17
|
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
18
|
-
method: "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "
|
|
18
|
+
method: "on" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "intersect" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
19
19
|
value: string | number | boolean | string[];
|
|
20
20
|
valueTo?: string | undefined;
|
|
21
21
|
endColumnId?: string | undefined;
|
|
@@ -4,7 +4,7 @@ exports.createRecurrenceTRPC = createRecurrenceTRPC;
|
|
|
4
4
|
const recurrence_schema_1 = require("@m5kdev/commons/modules/recurrence/recurrence.schema");
|
|
5
5
|
const query_schema_1 = require("@m5kdev/commons/modules/schemas/query.schema");
|
|
6
6
|
const zod_1 = require("zod");
|
|
7
|
-
const trpc_1 = require("
|
|
7
|
+
const trpc_1 = require("../../utils/trpc");
|
|
8
8
|
const createRecurrenceOutputSchema = zod_1.z.object({
|
|
9
9
|
recurrence: recurrence_schema_1.recurrenceSchema,
|
|
10
10
|
rules: zod_1.z.array(recurrence_schema_1.recurrenceRulesSchema),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ServerResultAsync } from "
|
|
2
|
-
import { BaseService } from "
|
|
3
|
-
import type { ConnectRepository } from "
|
|
4
|
-
import type { ConnectService } from "
|
|
5
|
-
import type { FileService } from "
|
|
1
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
2
|
+
import { BaseService } from "../base/base.service";
|
|
3
|
+
import type { ConnectRepository } from "../connect/connect.repository";
|
|
4
|
+
import type { ConnectService } from "../connect/connect.service";
|
|
5
|
+
import type { FileService } from "../file/file.service";
|
|
6
6
|
import type { SocialPostInput } from "./social.dto";
|
|
7
7
|
import type { SocialPostResult, SocialProvider } from "./social.types";
|
|
8
8
|
export declare class SocialService extends BaseService<{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SocialService = 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 SocialService extends base_service_1.BaseService {
|
|
7
7
|
providers = new Map();
|
|
8
8
|
constructor(repositories, services, providers) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ConnectRow } from "
|
|
2
|
-
import type { FileService } from "
|
|
1
|
+
import type { ConnectRow } from "../connect/connect.repository";
|
|
2
|
+
import type { FileService } from "../file/file.service";
|
|
3
3
|
export type SocialMediaType = "image" | "video" | "document";
|
|
4
4
|
export interface SocialMediaDescriptor {
|
|
5
5
|
readonly s3Path: string;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.taggings = exports.tags = 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.tags = (0, sqlite_core_1.sqliteTable)("tags", {
|
|
8
8
|
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
9
9
|
createdAt: (0, sqlite_core_1.integer)("created_at", { mode: "timestamp" })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Result } from "neverthrow";
|
|
2
2
|
import type { z } from "zod";
|
|
3
|
-
import type { ServerError } from "
|
|
3
|
+
import type { ServerError } from "../../utils/errors";
|
|
4
4
|
export declare const tagsSelectDTO: {
|
|
5
5
|
columns: {
|
|
6
6
|
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.taggingsSelectOutput = exports.tagsSelectOutput = exports.taggingsSelectDTO = exports.tagsSelectDTO = void 0;
|
|
4
|
-
const base_dto_1 = require("
|
|
5
|
-
const tag_db_1 = require("
|
|
4
|
+
const base_dto_1 = require("../base/base.dto");
|
|
5
|
+
const tag_db_1 = require("./tag.db");
|
|
6
6
|
exports.tagsSelectDTO = (0, base_dto_1.createSelectDTO)(tag_db_1.tags);
|
|
7
7
|
exports.taggingsSelectDTO = (0, base_dto_1.createSelectDTO)(tag_db_1.taggings);
|
|
8
8
|
exports.tagsSelectOutput = exports.tagsSelectDTO.schema;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TaggingSchema, TagLinkSchema, TagListInputSchema, TagListSchema, TagSchema } from "@m5kdev/commons/modules/tag/tag.schema";
|
|
2
2
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseTableRepository } from "
|
|
5
|
-
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseTableRepository } from "../base/base.repository";
|
|
5
|
+
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "./tag.dto";
|
|
6
6
|
declare const schema: {
|
|
7
7
|
tags: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
8
8
|
name: "tags";
|
|
@@ -4,8 +4,8 @@ exports.TagRepository = 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 base_repository_1 = require("
|
|
8
|
-
const tag = tslib_1.__importStar(require("
|
|
7
|
+
const base_repository_1 = require("../base/base.repository");
|
|
8
|
+
const tag = tslib_1.__importStar(require("./tag.db"));
|
|
9
9
|
const schema = { ...tag };
|
|
10
10
|
class TagRepository extends base_repository_1.BaseTableRepository {
|
|
11
11
|
async link({ userId, ...data }, tx) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { TagCreateSchema, TagLinkSchema, TagListInputSchema, TagListOutputSchema, TagListSchema, TagSchema, TagUpdateSchema } from "@m5kdev/commons/modules/tag/tag.schema";
|
|
2
|
-
import type { User } from "
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseService } from "
|
|
5
|
-
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "
|
|
6
|
-
import type { TagRepository } from "
|
|
2
|
+
import type { User } from "../auth/auth.lib";
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseService } from "../base/base.service";
|
|
5
|
+
import type { TaggingSelectOutputResult, TagSelectOutputResult } from "./tag.dto";
|
|
6
|
+
import type { TagRepository } from "./tag.repository";
|
|
7
7
|
export declare class TagService extends BaseService<{
|
|
8
8
|
tag: TagRepository;
|
|
9
9
|
}, Record<string, never>> {
|
|
@@ -11,7 +11,7 @@ export declare class TagService extends BaseService<{
|
|
|
11
11
|
listTaggings(input: {
|
|
12
12
|
resourceType: string;
|
|
13
13
|
resourceIds?: readonly string[];
|
|
14
|
-
}): Promise<import("
|
|
14
|
+
}): Promise<import("../base/base.dto").ServerResult<{
|
|
15
15
|
id: string;
|
|
16
16
|
createdAt: Date;
|
|
17
17
|
tagId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TagService = void 0;
|
|
4
|
-
const base_service_1 = require("
|
|
4
|
+
const base_service_1 = require("../base/base.service");
|
|
5
5
|
class TagService extends base_service_1.BaseService {
|
|
6
6
|
async list(input) {
|
|
7
7
|
return this.repository.tag.list(input);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TagService } from "
|
|
2
|
-
import { type TRPCMethods } from "
|
|
1
|
+
import type { TagService } from "./tag.service";
|
|
2
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
3
3
|
export declare function createTagTRPC({ router, privateProcedure: procedure }: TRPCMethods, tagService: TagService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
4
|
ctx: import("../auth/auth.lib").Context;
|
|
5
5
|
meta: any;
|
|
@@ -15,7 +15,7 @@ export declare function createTagTRPC({ router, privateProcedure: procedure }: T
|
|
|
15
15
|
filters?: {
|
|
16
16
|
columnId: string;
|
|
17
17
|
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
18
|
-
method: "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "
|
|
18
|
+
method: "on" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "intersect" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
19
19
|
value: string | number | boolean | string[];
|
|
20
20
|
valueTo?: string | undefined;
|
|
21
21
|
endColumnId?: string | undefined;
|
|
@@ -48,7 +48,7 @@ export declare function createTagTRPC({ router, privateProcedure: procedure }: T
|
|
|
48
48
|
resourceIds?: {
|
|
49
49
|
columnId: string;
|
|
50
50
|
type: "string" | "number" | "boolean" | "date" | "enum";
|
|
51
|
-
method: "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "
|
|
51
|
+
method: "on" | "contains" | "equals" | "starts_with" | "ends_with" | "greater_than" | "less_than" | "between" | "before" | "after" | "oneOf" | "intersect" | "isEmpty" | "isNotEmpty" | "is_null" | "is_not_null";
|
|
52
52
|
value: string | number | boolean | string[];
|
|
53
53
|
valueTo?: string | undefined;
|
|
54
54
|
endColumnId?: string | undefined;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTagTRPC = createTagTRPC;
|
|
4
4
|
const tag_schema_1 = require("@m5kdev/commons/modules/tag/tag.schema");
|
|
5
|
-
const tag_dto_1 = require("
|
|
6
|
-
const trpc_1 = require("
|
|
5
|
+
const tag_dto_1 = require("./tag.dto");
|
|
6
|
+
const trpc_1 = require("../../utils/trpc");
|
|
7
7
|
function createTagTRPC({ router, privateProcedure: procedure }, tagService) {
|
|
8
8
|
const tagListInput = tag_schema_1.tagListInputSchema.extend({
|
|
9
9
|
assignableTo: tag_schema_1.tagListSchema.shape.assignableTo,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { QueryFilters } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
2
2
|
import type { SQLiteTableWithColumns } from "drizzle-orm/sqlite-core";
|
|
3
|
-
import type { ConditionBuilder } from "
|
|
3
|
+
import type { ConditionBuilder } from "../base/base.repository";
|
|
4
4
|
export declare const getConditionsFromFilters: <T extends SQLiteTableWithColumns<any>>(conditions: ConditionBuilder, filters: QueryFilters | undefined, table: T) => ConditionBuilder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ServerResultAsync } from "
|
|
2
|
-
import { BaseService } from "
|
|
1
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
2
|
+
import { BaseService } from "../base/base.service";
|
|
3
3
|
export declare class VideoService extends BaseService<never, never> {
|
|
4
4
|
cut(file: string, start: number, end: number): ServerResultAsync<string>;
|
|
5
5
|
webmToWav(input: string, hz?: number): ServerResultAsync<string>;
|
|
@@ -9,7 +9,7 @@ const ffmpeg_ffprobe_static_1 = tslib_1.__importDefault(require("ffmpeg-ffprobe-
|
|
|
9
9
|
const fluent_ffmpeg_1 = tslib_1.__importDefault(require("fluent-ffmpeg"));
|
|
10
10
|
const neverthrow_1 = require("neverthrow");
|
|
11
11
|
const uuid_1 = require("uuid");
|
|
12
|
-
const base_service_1 = require("
|
|
12
|
+
const base_service_1 = require("../base/base.service");
|
|
13
13
|
if (!ffmpeg_ffprobe_static_1.default.ffmpegPath || !ffmpeg_ffprobe_static_1.default.ffprobePath) {
|
|
14
14
|
throw new Error("FFmpeg or FFprobe not found");
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.webhookSelectSchema = exports.webhookSelectDTO = void 0;
|
|
4
|
-
const base_dto_1 = require("
|
|
4
|
+
const base_dto_1 = require("../base/base.dto");
|
|
5
5
|
const webhook_db_1 = require("./webhook.db");
|
|
6
6
|
exports.webhookSelectDTO = (0, base_dto_1.createSelectDTO)(webhook_db_1.webhook);
|
|
7
7
|
exports.webhookSelectSchema = exports.webhookSelectDTO.schema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
2
|
-
import type { ServerResultAsync } from "
|
|
3
|
-
import { BaseTableRepository } from "
|
|
2
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
3
|
+
import { BaseTableRepository } from "../base/base.repository";
|
|
4
4
|
declare const schema: {
|
|
5
5
|
webhook: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
6
6
|
name: "webhook";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebhookRepository = 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
|
const webhook_constants_1 = require("./webhook.constants");
|
|
7
7
|
const webhook_db_1 = require("./webhook.db");
|
|
8
8
|
const schema = { webhook: webhook_db_1.webhook };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ServerResultAsync } from "
|
|
2
|
-
import { BaseService } from "
|
|
1
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
2
|
+
import { BaseService } from "../base/base.service";
|
|
3
3
|
import type { WebhookRepository } from "./webhook.repository";
|
|
4
4
|
export declare class WebhookService extends BaseService<{
|
|
5
5
|
webhook: WebhookRepository;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WebhookService = void 0;
|
|
4
4
|
const json_1 = require("@m5kdev/commons/utils/json");
|
|
5
5
|
const neverthrow_1 = require("neverthrow");
|
|
6
|
-
const base_service_1 = require("
|
|
6
|
+
const base_service_1 = require("../base/base.service");
|
|
7
7
|
const webhook_constants_1 = require("./webhook.constants");
|
|
8
8
|
class WebhookService extends base_service_1.BaseService {
|
|
9
9
|
async completed(id, payload) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.workflows = 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.workflows = (0, sqlite_core_1.sqliteTable)("workflows", {
|
|
8
8
|
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
9
9
|
userId: (0, sqlite_core_1.text)("user_id").references(() => auth_db_1.users.id, { onDelete: "cascade" }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WorkflowListInputSchema, WorkflowListOutputSchema, WorkflowReadOutputSchema } from "@m5kdev/commons/modules/workflow/workflow.schema";
|
|
2
2
|
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
-
import type { ServerResultAsync } from "
|
|
4
|
-
import { BaseRepository } from "
|
|
3
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
4
|
+
import { BaseRepository } from "../base/base.repository";
|
|
5
5
|
declare const schema: {
|
|
6
6
|
workflows: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
7
7
|
name: "workflows";
|
|
@@ -4,8 +4,8 @@ exports.WorkflowRepository = 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 base_repository_1 = require("
|
|
8
|
-
const workflow = tslib_1.__importStar(require("
|
|
7
|
+
const base_repository_1 = require("../base/base.repository");
|
|
8
|
+
const workflow = tslib_1.__importStar(require("./workflow.db"));
|
|
9
9
|
const schema = { ...workflow };
|
|
10
10
|
class WorkflowRepository extends base_repository_1.BaseRepository {
|
|
11
11
|
async read({ jobId, userId, }) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { WorkflowListInputSchema, WorkflowListOutputSchema, WorkflowReadInputSchema, WorkflowReadOutputSchema } from "@m5kdev/commons/modules/workflow/workflow.schema";
|
|
2
2
|
import type { Job } from "bullmq";
|
|
3
|
-
import type { User } from "
|
|
4
|
-
import type { ServerResultAsync } from "
|
|
5
|
-
import { BaseService } from "
|
|
6
|
-
import type { WorkflowRepository } from "
|
|
3
|
+
import type { User } from "../auth/auth.lib";
|
|
4
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
5
|
+
import { BaseService } from "../base/base.service";
|
|
6
|
+
import type { WorkflowRepository } from "./workflow.repository";
|
|
7
7
|
export declare class WorkflowService extends BaseService<{
|
|
8
8
|
workflow: WorkflowRepository;
|
|
9
9
|
}, never> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkflowService = void 0;
|
|
4
|
-
const base_service_1 = require("
|
|
4
|
+
const base_service_1 = require("../base/base.service");
|
|
5
5
|
class WorkflowService extends base_service_1.BaseService {
|
|
6
6
|
async read(input, { user }) {
|
|
7
7
|
return await this.repository.workflow.read({ ...input, userId: user.id });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { WorkflowService } from "
|
|
2
|
-
import { type TRPCMethods } from "
|
|
1
|
+
import type { WorkflowService } from "./workflow.service";
|
|
2
|
+
import { type TRPCMethods } from "../../utils/trpc";
|
|
3
3
|
export declare function createWorkflowTRPC({ router, privateProcedure: procedure }: TRPCMethods, workflowService: WorkflowService): import("@trpc/server").TRPCBuiltRouter<{
|
|
4
4
|
ctx: import("../auth/auth.lib").Context;
|
|
5
5
|
meta: any;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createWorkflowTRPC = createWorkflowTRPC;
|
|
4
4
|
const workflow_schema_1 = require("@m5kdev/commons/modules/workflow/workflow.schema");
|
|
5
|
-
const trpc_1 = require("
|
|
5
|
+
const trpc_1 = require("../../utils/trpc");
|
|
6
6
|
function createWorkflowTRPC({ router, privateProcedure: procedure }, workflowService) {
|
|
7
7
|
return router({
|
|
8
8
|
read: procedure
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Job, JobsOptions } from "bullmq";
|
|
2
|
-
import type { ServerResultAsync } from "
|
|
3
|
-
import type { ServerError } from "
|
|
2
|
+
import type { ServerResultAsync } from "../base/base.dto";
|
|
3
|
+
import type { ServerError } from "../../utils/errors";
|
|
4
4
|
export type WorkflowMeta = {
|
|
5
5
|
queue?: string;
|
|
6
6
|
userId?: string;
|
|
@@ -5,9 +5,9 @@ exports.createWorkflowWorker = createWorkflowWorker;
|
|
|
5
5
|
exports.createWorkflowWorkers = createWorkflowWorkers;
|
|
6
6
|
const bullmq_1 = require("bullmq");
|
|
7
7
|
const neverthrow_1 = require("neverthrow");
|
|
8
|
-
const errors_1 = require("
|
|
9
|
-
const logger_1 = require("
|
|
10
|
-
const posthog_1 = require("
|
|
8
|
+
const errors_1 = require("../../utils/errors");
|
|
9
|
+
const logger_1 = require("../../utils/logger");
|
|
10
|
+
const posthog_1 = require("../../utils/posthog");
|
|
11
11
|
const errorOptions = {
|
|
12
12
|
layer: "workflow",
|
|
13
13
|
layerName: "WorkflowTrigger",
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Mastra } from "@mastra/core";
|
|
2
|
-
import type { AIService } from "
|
|
3
|
-
import type { AuthService } from "
|
|
4
|
-
import type { BillingService } from "
|
|
5
|
-
import type { TRPCMethods } from "
|
|
2
|
+
import type { AIService } from "./modules/ai/ai.service";
|
|
3
|
+
import type { AuthService } from "./modules/auth/auth.service";
|
|
4
|
+
import type { BillingService } from "./modules/billing/billing.service";
|
|
5
|
+
import type { TRPCMethods } from "./utils/trpc";
|
|
6
6
|
export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcMethods: TRPCMethods, authService: AuthService, aiService: AIService<MastraInstance>, billingService: BillingService) => import("@trpc/server").TRPCBuiltRouter<{
|
|
7
7
|
ctx: import("./modules/auth/auth.lib").Context;
|
|
8
8
|
meta: any;
|
|
@@ -57,11 +57,11 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
57
57
|
listAccountClaims: import("@trpc/server").TRPCQueryProcedure<{
|
|
58
58
|
input: void;
|
|
59
59
|
output: {
|
|
60
|
-
expiresAt: Date | null;
|
|
61
60
|
id: string;
|
|
61
|
+
status: string;
|
|
62
62
|
createdAt: Date;
|
|
63
63
|
updatedAt: Date | null;
|
|
64
|
-
|
|
64
|
+
expiresAt: Date | null;
|
|
65
65
|
claimUserId: string | null;
|
|
66
66
|
claimedAt: Date | null;
|
|
67
67
|
claimedEmail: string | null;
|
|
@@ -74,12 +74,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
74
74
|
email?: string | undefined;
|
|
75
75
|
};
|
|
76
76
|
output: {
|
|
77
|
-
email: string;
|
|
78
77
|
url: string;
|
|
79
|
-
expiresAt: Date | null;
|
|
80
78
|
id: string;
|
|
81
|
-
|
|
79
|
+
email: string;
|
|
82
80
|
createdAt: Date;
|
|
81
|
+
userId: string;
|
|
82
|
+
expiresAt: Date | null;
|
|
83
83
|
claimId: string;
|
|
84
84
|
};
|
|
85
85
|
meta: any;
|
|
@@ -89,12 +89,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
89
89
|
claimId: string;
|
|
90
90
|
};
|
|
91
91
|
output: {
|
|
92
|
-
email: string;
|
|
93
92
|
url: string;
|
|
94
|
-
expiresAt: Date | null;
|
|
95
93
|
id: string;
|
|
96
|
-
|
|
94
|
+
email: string;
|
|
97
95
|
createdAt: Date;
|
|
96
|
+
userId: string;
|
|
97
|
+
expiresAt: Date | null;
|
|
98
98
|
claimId: string;
|
|
99
99
|
}[];
|
|
100
100
|
meta: any;
|
|
@@ -147,12 +147,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
147
147
|
listAdminWaitlist: import("@trpc/server").TRPCQueryProcedure<{
|
|
148
148
|
input: void;
|
|
149
149
|
output: {
|
|
150
|
-
email: string | null;
|
|
151
|
-
id: string;
|
|
152
150
|
name: string | null;
|
|
151
|
+
id: string;
|
|
152
|
+
email: string | null;
|
|
153
|
+
status: string;
|
|
153
154
|
createdAt: Date;
|
|
154
155
|
updatedAt: Date | null;
|
|
155
|
-
status: string;
|
|
156
156
|
}[];
|
|
157
157
|
meta: any;
|
|
158
158
|
}>;
|
|
@@ -161,12 +161,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
161
161
|
email: string;
|
|
162
162
|
};
|
|
163
163
|
output: {
|
|
164
|
-
email: string | null;
|
|
165
|
-
id: string;
|
|
166
164
|
name: string | null;
|
|
165
|
+
id: string;
|
|
166
|
+
email: string | null;
|
|
167
|
+
status: string;
|
|
167
168
|
createdAt: Date;
|
|
168
169
|
updatedAt: Date | null;
|
|
169
|
-
status: string;
|
|
170
170
|
};
|
|
171
171
|
meta: any;
|
|
172
172
|
}>;
|
|
@@ -192,12 +192,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
192
192
|
id: string;
|
|
193
193
|
};
|
|
194
194
|
output: {
|
|
195
|
-
email: string | null;
|
|
196
|
-
id: string;
|
|
197
195
|
name: string | null;
|
|
196
|
+
id: string;
|
|
197
|
+
email: string | null;
|
|
198
|
+
status: string;
|
|
198
199
|
createdAt: Date;
|
|
199
200
|
updatedAt: Date | null;
|
|
200
|
-
status: string;
|
|
201
201
|
};
|
|
202
202
|
meta: any;
|
|
203
203
|
}>;
|
|
@@ -206,12 +206,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
206
206
|
id: string;
|
|
207
207
|
};
|
|
208
208
|
output: {
|
|
209
|
-
email: string | null;
|
|
210
|
-
id: string;
|
|
211
209
|
name: string | null;
|
|
210
|
+
id: string;
|
|
211
|
+
email: string | null;
|
|
212
|
+
status: string;
|
|
212
213
|
createdAt: Date;
|
|
213
214
|
updatedAt: Date | null;
|
|
214
|
-
status: string;
|
|
215
215
|
};
|
|
216
216
|
meta: any;
|
|
217
217
|
}>;
|
|
@@ -220,12 +220,12 @@ export declare const createAuthTRPCRouter: <MastraInstance extends Mastra>(trpcM
|
|
|
220
220
|
email: string;
|
|
221
221
|
};
|
|
222
222
|
output: {
|
|
223
|
-
email: string | null;
|
|
224
|
-
id: string;
|
|
225
223
|
name: string | null;
|
|
224
|
+
id: string;
|
|
225
|
+
email: string | null;
|
|
226
|
+
status: string;
|
|
226
227
|
createdAt: Date;
|
|
227
228
|
updatedAt: Date | null;
|
|
228
|
-
status: string;
|
|
229
229
|
};
|
|
230
230
|
meta: any;
|
|
231
231
|
}>;
|
package/dist/src/types.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createAuthTRPCRouter = void 0;
|
|
4
|
-
const ai_trpc_1 = require("
|
|
5
|
-
const auth_trpc_1 = require("
|
|
6
|
-
const billing_trpc_1 = require("
|
|
4
|
+
const ai_trpc_1 = require("./modules/ai/ai.trpc");
|
|
5
|
+
const auth_trpc_1 = require("./modules/auth/auth.trpc");
|
|
6
|
+
const billing_trpc_1 = require("./modules/billing/billing.trpc");
|
|
7
7
|
const createAuthTRPCRouter = (trpcMethods, authService, aiService, billingService) => trpcMethods.router({
|
|
8
8
|
auth: (0, auth_trpc_1.createAuthTRPC)(trpcMethods, authService),
|
|
9
9
|
ai: (0, ai_trpc_1.createAITRPC)(trpcMethods, aiService),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { captureException } from "@sentry/node";
|
|
2
2
|
import { type TRPC_ERROR_CODE_KEY, TRPCError } from "@trpc/server";
|
|
3
|
-
import type { ServerErrorLayer } from "
|
|
3
|
+
import type { ServerErrorLayer } from "../modules/base/base.types";
|
|
4
4
|
export type { ServerErrorLayer };
|
|
5
5
|
export declare class ServerError extends Error {
|
|
6
6
|
readonly code: TRPC_ERROR_CODE_KEY;
|
package/dist/src/utils/trpc.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { transformer } from "@m5kdev/commons/utils/trpc";
|
|
|
2
2
|
import type { TRPCRootObject } from "@trpc/server";
|
|
3
3
|
import type { CreateExpressContextOptions } from "@trpc/server/adapters/express";
|
|
4
4
|
import type { Result } from "neverthrow";
|
|
5
|
-
import type { BetterAuth, Context } from "
|
|
6
|
-
import { ServerError } from "
|
|
5
|
+
import type { BetterAuth, Context } from "../modules/auth/auth.lib";
|
|
6
|
+
import { ServerError } from "./errors";
|
|
7
7
|
type TRPCCreate = TRPCRootObject<Context, any, {
|
|
8
8
|
transformer: typeof transformer;
|
|
9
9
|
}>;
|
|
@@ -15,12 +15,12 @@ export type TRPCMethods = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare function createAuthContext(auth: BetterAuth): ({ req }: CreateExpressContextOptions) => Promise<{
|
|
17
17
|
session: {
|
|
18
|
-
token: string;
|
|
19
|
-
expiresAt: Date;
|
|
20
18
|
id: string;
|
|
21
|
-
userId: string;
|
|
22
19
|
createdAt: Date;
|
|
23
20
|
updatedAt: Date;
|
|
21
|
+
userId: string;
|
|
22
|
+
token: string;
|
|
23
|
+
expiresAt: Date;
|
|
24
24
|
ipAddress: string | null;
|
|
25
25
|
userAgent: string | null;
|
|
26
26
|
impersonatedBy: string | null;
|
|
@@ -30,14 +30,14 @@ export declare function createAuthContext(auth: BetterAuth): ({ req }: CreateExp
|
|
|
30
30
|
activeTeamRole: string | null;
|
|
31
31
|
};
|
|
32
32
|
user: {
|
|
33
|
+
name: string;
|
|
34
|
+
id: string;
|
|
33
35
|
email: string;
|
|
34
36
|
metadata: Record<string, unknown>;
|
|
35
|
-
|
|
36
|
-
name: string;
|
|
37
|
+
emailVerified: boolean;
|
|
37
38
|
image: string | null;
|
|
38
39
|
createdAt: Date;
|
|
39
40
|
updatedAt: Date;
|
|
40
|
-
emailVerified: boolean;
|
|
41
41
|
role: string | null;
|
|
42
42
|
banned: boolean | null;
|
|
43
43
|
banReason: string | null;
|
package/dist/src/utils/trpc.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.handleTRPCResult = handleTRPCResult;
|
|
|
6
6
|
exports.verifyProtectedProcedureContext = verifyProtectedProcedureContext;
|
|
7
7
|
exports.verifyAdminProcedureContext = verifyAdminProcedureContext;
|
|
8
8
|
const node_1 = require("better-auth/node");
|
|
9
|
-
const errors_1 = require("
|
|
10
|
-
const logger_1 = require("
|
|
9
|
+
const errors_1 = require("./errors");
|
|
10
|
+
const logger_1 = require("./logger");
|
|
11
11
|
function createAuthContext(auth) {
|
|
12
12
|
return async function createContext({ req }) {
|
|
13
13
|
const data = await auth.api.getSession({
|