@m5kdev/backend 0.6.0 → 0.8.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/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/api/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/factory.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/get-id-field.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/types.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/get-tables.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/account.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/rate-limit.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/session.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/shared.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/user.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/verification.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/social-providers/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/context.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/helper.d.mts +7 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/init-options.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/plugin-client.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/plugin.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect-adapter-base.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/expression/expression-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/kysely.d.mts +38 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/migration/file-migration-provider.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/migration/migrator.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/binary-operation-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/delete-from-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/expression-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/group-by-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/insert-values-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/join-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/merge-into-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/reference-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/returning-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/select-from-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/select-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/set-operation-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/tuple-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/unary-operation-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/update-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/update-set-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/value-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/with-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/case-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/delete-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/having-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/insert-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/join-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/merge-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/on-conflict-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/output-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/returning-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/select-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/update-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/where-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-creator.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/default-query-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/noop-query-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor-base.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor-provider.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/raw-builder/raw-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/raw-builder/sql.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-add-index-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-drop-constraint-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-index-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-schema-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-table-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-type-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-view-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-index-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-schema-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-table-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-type-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-view-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/refresh-materialized-view-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/schema.d.mts +1 -0
- package/dist/src/lib/posthog.d.mts +7 -0
- package/dist/src/lib/posthog.mjs +7 -0
- package/dist/src/lib/posthog.mjs.map +1 -0
- package/dist/src/lib/sentry.d.mts +1 -0
- package/dist/src/lib/sentry.mjs +10 -0
- package/dist/src/lib/sentry.mjs.map +1 -0
- package/dist/src/modules/access/access.repository.d.mts +2352 -0
- package/dist/src/modules/access/access.repository.mjs +24 -0
- package/dist/src/modules/access/access.repository.mjs.map +1 -0
- package/dist/src/modules/access/access.service.d.mts +25 -0
- package/dist/src/modules/access/access.service.mjs +40 -0
- package/dist/src/modules/access/access.service.mjs.map +1 -0
- package/dist/src/modules/access/access.utils.d.mts +19 -0
- package/dist/src/modules/access/access.utils.mjs +21 -0
- package/dist/src/modules/access/access.utils.mjs.map +1 -0
- package/dist/src/modules/ai/ai.db.d.mts +401 -0
- package/dist/src/modules/ai/ai.db.mjs +38 -0
- package/dist/src/modules/ai/ai.db.mjs.map +1 -0
- package/dist/src/modules/ai/ai.prompt.d.mts +30 -0
- package/dist/src/modules/ai/ai.prompt.mjs +30 -0
- package/dist/src/modules/ai/ai.prompt.mjs.map +1 -0
- package/dist/src/modules/ai/ai.prompts.d.mts +10 -0
- package/dist/src/modules/ai/{ai.prompts.js → ai.prompts.mjs} +17 -15
- package/dist/src/modules/ai/ai.prompts.mjs.map +1 -0
- package/dist/src/modules/ai/ai.repository.d.mts +428 -0
- package/dist/src/modules/ai/ai.repository.mjs +23 -0
- package/dist/src/modules/ai/ai.repository.mjs.map +1 -0
- package/dist/src/modules/ai/ai.router.d.mts +1 -0
- package/dist/src/modules/ai/ai.service.d.mts +128 -0
- package/dist/src/modules/ai/ai.service.mjs +267 -0
- package/dist/src/modules/ai/ai.service.mjs.map +1 -0
- package/dist/src/modules/ai/ai.trpc.d.mts +31 -0
- package/dist/src/modules/ai/ai.trpc.mjs +17 -0
- package/dist/src/modules/ai/ai.trpc.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.mts +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.mjs +184 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.mts +234 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.mjs +45 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.mts +7 -0
- package/dist/src/modules/ai/ideogram/{ideogram.prompt.js → ideogram.prompt.mjs} +861 -859
- package/dist/src/modules/ai/ideogram/ideogram.prompt.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.mts +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.mjs +32 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.d.mts +14 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.mjs +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.mjs.map +1 -0
- package/dist/src/modules/auth/auth.db.d.mts +2341 -0
- package/dist/src/modules/auth/auth.db.mjs +169 -0
- package/dist/src/modules/auth/auth.db.mjs.map +1 -0
- package/dist/src/modules/auth/auth.dto.d.mts +70 -0
- package/dist/src/modules/auth/auth.dto.mjs +43 -0
- package/dist/src/modules/auth/auth.dto.mjs.map +1 -0
- package/dist/src/modules/auth/auth.lib.d.mts +4894 -0
- package/dist/src/modules/auth/auth.lib.mjs +232 -0
- package/dist/src/modules/auth/auth.lib.mjs.map +1 -0
- package/dist/src/modules/auth/auth.middleware.d.mts +619 -0
- package/dist/src/modules/auth/auth.middleware.mjs +38 -0
- package/dist/src/modules/auth/auth.middleware.mjs.map +1 -0
- package/dist/src/modules/auth/auth.repository.d.mts +2453 -0
- package/dist/src/modules/auth/auth.repository.mjs +401 -0
- package/dist/src/modules/auth/auth.repository.mjs.map +1 -0
- package/dist/src/modules/auth/auth.service.d.mts +105 -0
- package/dist/src/modules/auth/auth.service.mjs +227 -0
- package/dist/src/modules/auth/auth.service.mjs.map +1 -0
- package/dist/src/modules/auth/auth.trpc.d.mts +303 -0
- package/dist/src/modules/auth/auth.trpc.mjs +108 -0
- package/dist/src/modules/auth/auth.trpc.mjs.map +1 -0
- package/dist/src/modules/auth/auth.utils.d.mts +2356 -0
- package/dist/src/modules/auth/auth.utils.mjs +77 -0
- package/dist/src/modules/auth/auth.utils.mjs.map +1 -0
- package/dist/src/modules/base/base.abstract.d.mts +29 -0
- package/dist/src/modules/base/base.abstract.mjs +60 -0
- package/dist/src/modules/base/base.abstract.mjs.map +1 -0
- package/dist/src/modules/base/base.actor.d.mts +73 -0
- package/dist/src/modules/base/base.actor.mjs +78 -0
- package/dist/src/modules/base/base.actor.mjs.map +1 -0
- package/dist/src/modules/base/base.dto.d.mts +67 -0
- package/dist/src/modules/base/base.dto.mjs +79 -0
- package/dist/src/modules/base/base.dto.mjs.map +1 -0
- package/dist/src/modules/base/base.grants.d.mts +28 -0
- package/dist/src/modules/base/base.grants.mjs +103 -0
- package/dist/src/modules/base/base.grants.mjs.map +1 -0
- package/dist/src/modules/base/base.procedure.d.mts +111 -0
- package/dist/src/modules/base/base.procedure.mjs +252 -0
- package/dist/src/modules/base/base.procedure.mjs.map +1 -0
- package/dist/src/modules/base/base.repository.d.mts +123 -0
- package/dist/src/modules/base/base.repository.mjs +250 -0
- package/dist/src/modules/base/base.repository.mjs.map +1 -0
- package/dist/src/modules/base/base.service.d.mts +44 -0
- package/dist/src/modules/base/base.service.mjs +116 -0
- package/dist/src/modules/base/base.service.mjs.map +1 -0
- package/dist/src/modules/base/base.types.d.mts +5 -0
- package/dist/src/modules/billing/billing.db.d.mts +371 -0
- package/dist/src/modules/billing/billing.db.mjs +31 -0
- package/dist/src/modules/billing/billing.db.mjs.map +1 -0
- package/dist/src/modules/billing/billing.repository.d.mts +2787 -0
- package/dist/src/modules/billing/billing.repository.mjs +188 -0
- package/dist/src/modules/billing/billing.repository.mjs.map +1 -0
- package/dist/src/modules/billing/billing.router.d.mts +9 -0
- package/dist/src/modules/billing/billing.router.mjs +40 -0
- package/dist/src/modules/billing/billing.router.mjs.map +1 -0
- package/dist/src/modules/billing/billing.service.d.mts +53 -0
- package/dist/src/modules/billing/billing.service.mjs +125 -0
- package/dist/src/modules/billing/billing.service.mjs.map +1 -0
- package/dist/src/modules/billing/billing.trpc.d.mts +29 -0
- package/dist/src/modules/billing/billing.trpc.mjs +17 -0
- package/dist/src/modules/billing/billing.trpc.mjs.map +1 -0
- package/dist/src/modules/clay/clay.repository.d.mts +10 -0
- package/dist/src/modules/clay/clay.repository.mjs +27 -0
- package/dist/src/modules/clay/clay.repository.mjs.map +1 -0
- package/dist/src/modules/clay/clay.service.d.mts +32 -0
- package/dist/src/modules/clay/clay.service.mjs +23 -0
- package/dist/src/modules/clay/clay.service.mjs.map +1 -0
- package/dist/src/modules/connect/connect.db.d.mts +362 -0
- package/dist/src/modules/connect/connect.db.mjs +30 -0
- package/dist/src/modules/connect/connect.db.mjs.map +1 -0
- package/dist/src/modules/connect/connect.dto.d.mts +79 -0
- package/dist/src/modules/connect/connect.dto.mjs +38 -0
- package/dist/src/modules/connect/connect.dto.mjs.map +1 -0
- package/dist/src/modules/connect/connect.linkedin.d.mts +7 -0
- package/dist/src/modules/connect/connect.linkedin.mjs +47 -0
- package/dist/src/modules/connect/connect.linkedin.mjs.map +1 -0
- package/dist/src/modules/connect/connect.oauth.d.mts +32 -0
- package/dist/src/modules/connect/connect.oauth.mjs +145 -0
- package/dist/src/modules/connect/connect.oauth.mjs.map +1 -0
- package/dist/src/modules/connect/connect.repository.d.mts +419 -0
- package/dist/src/modules/connect/connect.repository.mjs +40 -0
- package/dist/src/modules/connect/connect.repository.mjs.map +1 -0
- package/dist/src/modules/connect/connect.router.d.mts +9 -0
- package/dist/src/modules/connect/connect.router.mjs +46 -0
- package/dist/src/modules/connect/connect.router.mjs.map +1 -0
- package/dist/src/modules/connect/connect.service.d.mts +103 -0
- package/dist/src/modules/connect/connect.service.mjs +88 -0
- package/dist/src/modules/connect/connect.service.mjs.map +1 -0
- package/dist/src/modules/connect/connect.trpc.d.mts +53 -0
- package/dist/src/modules/connect/connect.trpc.mjs +17 -0
- package/dist/src/modules/connect/connect.trpc.mjs.map +1 -0
- package/dist/src/modules/connect/connect.types.d.mts +29 -0
- package/dist/src/modules/crypto/crypto.db.d.mts +157 -0
- package/dist/src/modules/crypto/crypto.db.mjs +19 -0
- package/dist/src/modules/crypto/crypto.db.mjs.map +1 -0
- package/dist/src/modules/crypto/crypto.repository.d.mts +163 -0
- package/dist/src/modules/crypto/crypto.repository.mjs +9 -0
- package/dist/src/modules/crypto/crypto.repository.mjs.map +1 -0
- package/dist/src/modules/crypto/crypto.service.d.mts +15 -0
- package/dist/src/modules/crypto/crypto.service.mjs +40 -0
- package/dist/src/modules/crypto/crypto.service.mjs.map +1 -0
- package/dist/src/modules/email/email.service.d.mts +62 -0
- package/dist/src/modules/email/email.service.mjs +105 -0
- package/dist/src/modules/email/email.service.mjs.map +1 -0
- package/dist/src/modules/file/file.repository.d.mts +17 -0
- package/dist/src/modules/file/file.repository.mjs +72 -0
- package/dist/src/modules/file/file.repository.mjs.map +1 -0
- package/dist/src/modules/file/{file.router.d.ts → file.router.d.mts} +4 -0
- package/dist/src/modules/file/file.router.mjs +88 -0
- package/dist/src/modules/file/file.router.mjs.map +1 -0
- package/dist/src/modules/file/file.service.d.mts +30 -0
- package/dist/src/modules/file/file.service.mjs +117 -0
- package/dist/src/modules/file/file.service.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.db.d.mts +568 -0
- package/dist/src/modules/recurrence/recurrence.db.mjs +47 -0
- package/dist/src/modules/recurrence/recurrence.db.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.repository.d.mts +588 -0
- package/dist/src/modules/recurrence/recurrence.repository.mjs +28 -0
- package/dist/src/modules/recurrence/recurrence.repository.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.service.d.mts +51 -0
- package/dist/src/modules/recurrence/recurrence.service.mjs +64 -0
- package/dist/src/modules/recurrence/recurrence.service.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.trpc.d.mts +65 -0
- package/dist/src/modules/recurrence/recurrence.trpc.mjs +44 -0
- package/dist/src/modules/recurrence/recurrence.trpc.mjs.map +1 -0
- package/dist/src/modules/social/social.dto.d.mts +39 -0
- package/dist/src/modules/social/social.dto.mjs +22 -0
- package/dist/src/modules/social/social.dto.mjs.map +1 -0
- package/dist/src/modules/social/{social.linkedin.d.ts → social.linkedin.d.mts} +8 -3
- package/dist/src/modules/social/social.linkedin.mjs +346 -0
- package/dist/src/modules/social/social.linkedin.mjs.map +1 -0
- package/dist/src/modules/social/social.service.d.mts +34 -0
- package/dist/src/modules/social/social.service.mjs +55 -0
- package/dist/src/modules/social/social.service.mjs.map +1 -0
- package/dist/src/modules/social/social.types.d.mts +40 -0
- package/dist/src/modules/tag/tag.db.d.mts +352 -0
- package/dist/src/modules/tag/tag.db.mjs +35 -0
- package/dist/src/modules/tag/tag.db.mjs.map +1 -0
- package/dist/src/modules/tag/tag.dto.d.mts +1025 -0
- package/dist/src/modules/tag/tag.dto.mjs +11 -0
- package/dist/src/modules/tag/tag.dto.mjs.map +1 -0
- package/dist/src/modules/tag/tag.repository.d.mts +394 -0
- package/dist/src/modules/tag/tag.repository.mjs +114 -0
- package/dist/src/modules/tag/tag.repository.mjs.map +1 -0
- package/dist/src/modules/tag/tag.service.d.mts +93 -0
- package/dist/src/modules/tag/tag.service.mjs +47 -0
- package/dist/src/modules/tag/tag.service.mjs.map +1 -0
- package/dist/src/modules/tag/tag.trpc.d.mts +109 -0
- package/dist/src/modules/tag/tag.trpc.mjs +30 -0
- package/dist/src/modules/tag/tag.trpc.mjs.map +1 -0
- package/dist/src/modules/utils/{applyPagination.d.ts → applyPagination.d.mts} +5 -1
- package/dist/src/modules/utils/applyPagination.mjs +15 -0
- package/dist/src/modules/utils/applyPagination.mjs.map +1 -0
- package/dist/src/modules/utils/applySorting.d.mts +13 -0
- package/dist/src/modules/utils/applySorting.mjs +18 -0
- package/dist/src/modules/utils/applySorting.mjs.map +1 -0
- package/dist/src/modules/utils/getConditionsFromFilters.d.mts +9 -0
- package/dist/src/modules/utils/getConditionsFromFilters.mjs +150 -0
- package/dist/src/modules/utils/getConditionsFromFilters.mjs.map +1 -0
- package/dist/src/modules/video/video.service.d.mts +12 -0
- package/dist/src/modules/video/video.service.mjs +50 -0
- package/dist/src/modules/video/video.service.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.constants.d.mts +12 -0
- package/dist/src/modules/webhook/webhook.constants.mjs +12 -0
- package/dist/src/modules/webhook/webhook.constants.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.db.d.mts +142 -0
- package/dist/src/modules/webhook/webhook.db.mjs +17 -0
- package/dist/src/modules/webhook/webhook.db.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.dto.d.mts +402 -0
- package/dist/src/modules/webhook/webhook.dto.mjs +9 -0
- package/dist/src/modules/webhook/webhook.dto.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.repository.d.mts +154 -0
- package/dist/src/modules/webhook/webhook.repository.mjs +50 -0
- package/dist/src/modules/webhook/webhook.repository.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.router.d.mts +8 -0
- package/dist/src/modules/webhook/webhook.router.mjs +23 -0
- package/dist/src/modules/webhook/webhook.router.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.service.d.mts +14 -0
- package/dist/src/modules/webhook/webhook.service.mjs +59 -0
- package/dist/src/modules/webhook/webhook.service.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.db.d.mts +302 -0
- package/dist/src/modules/workflow/workflow.db.mjs +28 -0
- package/dist/src/modules/workflow/workflow.db.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.repository.d.mts +371 -0
- package/dist/src/modules/workflow/workflow.repository.mjs +93 -0
- package/dist/src/modules/workflow/workflow.repository.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.service.d.mts +31 -0
- package/dist/src/modules/workflow/workflow.service.mjs +40 -0
- package/dist/src/modules/workflow/workflow.service.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.trpc.d.mts +28 -0
- package/dist/src/modules/workflow/workflow.trpc.mjs +17 -0
- package/dist/src/modules/workflow/workflow.trpc.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.types.d.mts +25 -0
- package/dist/src/modules/workflow/workflow.utils.d.mts +36 -0
- package/dist/src/modules/workflow/workflow.utils.mjs +181 -0
- package/dist/src/modules/workflow/workflow.utils.mjs.map +1 -0
- package/dist/src/types.d.mts +346 -0
- package/dist/src/types.mjs +13 -0
- package/dist/src/types.mjs.map +1 -0
- package/dist/src/utils/errors.d.mts +62 -0
- package/dist/src/utils/errors.mjs +96 -0
- package/dist/src/utils/errors.mjs.map +1 -0
- package/dist/src/utils/logger.d.mts +7 -0
- package/dist/src/utils/logger.mjs +10 -0
- package/dist/src/utils/logger.mjs.map +1 -0
- package/dist/src/utils/posthog.d.mts +17 -0
- package/dist/src/utils/posthog.mjs +25 -0
- package/dist/src/utils/posthog.mjs.map +1 -0
- package/dist/src/utils/trpc.d.mts +54 -0
- package/dist/src/utils/trpc.mjs +146 -0
- package/dist/src/utils/trpc.mjs.map +1 -0
- package/dist/src/utils/types.d.mts +9 -0
- package/package.json +5 -4
- package/dist/src/lib/posthog.d.ts +0 -2
- package/dist/src/lib/posthog.js +0 -7
- package/dist/src/lib/sentry.js +0 -9
- package/dist/src/modules/access/access.repository.d.ts +0 -2347
- package/dist/src/modules/access/access.repository.js +0 -32
- package/dist/src/modules/access/access.service.d.ts +0 -21
- package/dist/src/modules/access/access.service.js +0 -51
- package/dist/src/modules/access/access.test.js +0 -182
- package/dist/src/modules/access/access.utils.d.ts +0 -16
- package/dist/src/modules/access/access.utils.js +0 -20
- package/dist/src/modules/ai/ai.db.d.ts +0 -395
- package/dist/src/modules/ai/ai.db.js +0 -39
- package/dist/src/modules/ai/ai.prompt.d.ts +0 -26
- package/dist/src/modules/ai/ai.prompt.js +0 -30
- package/dist/src/modules/ai/ai.prompts.d.ts +0 -5
- package/dist/src/modules/ai/ai.repository.d.ts +0 -423
- package/dist/src/modules/ai/ai.repository.js +0 -26
- package/dist/src/modules/ai/ai.router.js +0 -132
- package/dist/src/modules/ai/ai.service.d.ts +0 -127
- package/dist/src/modules/ai/ai.service.js +0 -297
- package/dist/src/modules/ai/ai.trpc.d.ts +0 -22
- package/dist/src/modules/ai/ai.trpc.js +0 -20
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.ts +0 -7
- package/dist/src/modules/ai/ideogram/ideogram.constants.js +0 -167
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.ts +0 -229
- package/dist/src/modules/ai/ideogram/ideogram.dto.js +0 -49
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts +0 -2
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts +0 -6
- package/dist/src/modules/ai/ideogram/ideogram.repository.js +0 -46
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts +0 -9
- package/dist/src/modules/ai/ideogram/ideogram.service.js +0 -11
- package/dist/src/modules/auth/auth.db.d.ts +0 -2335
- package/dist/src/modules/auth/auth.db.js +0 -215
- package/dist/src/modules/auth/auth.dto.d.ts +0 -65
- package/dist/src/modules/auth/auth.dto.js +0 -38
- package/dist/src/modules/auth/auth.lib.d.ts +0 -4873
- package/dist/src/modules/auth/auth.lib.js +0 -284
- package/dist/src/modules/auth/auth.middleware.d.ts +0 -614
- package/dist/src/modules/auth/auth.middleware.js +0 -52
- package/dist/src/modules/auth/auth.repository.d.ts +0 -2421
- package/dist/src/modules/auth/auth.repository.js +0 -636
- package/dist/src/modules/auth/auth.service.d.ts +0 -108
- package/dist/src/modules/auth/auth.service.js +0 -246
- package/dist/src/modules/auth/auth.trpc.d.ts +0 -292
- package/dist/src/modules/auth/auth.trpc.js +0 -179
- package/dist/src/modules/auth/auth.utils.d.ts +0 -2351
- package/dist/src/modules/auth/auth.utils.js +0 -97
- package/dist/src/modules/base/base.abstract.d.ts +0 -19
- package/dist/src/modules/base/base.abstract.js +0 -62
- package/dist/src/modules/base/base.dto.d.ts +0 -69
- package/dist/src/modules/base/base.dto.js +0 -112
- package/dist/src/modules/base/base.grants.d.ts +0 -28
- package/dist/src/modules/base/base.grants.js +0 -123
- package/dist/src/modules/base/base.grants.test.js +0 -668
- package/dist/src/modules/base/base.procedure.d.ts +0 -112
- package/dist/src/modules/base/base.procedure.js +0 -289
- package/dist/src/modules/base/base.repository.d.ts +0 -97
- package/dist/src/modules/base/base.repository.js +0 -317
- package/dist/src/modules/base/base.service.d.ts +0 -52
- package/dist/src/modules/base/base.service.js +0 -116
- package/dist/src/modules/base/base.service.test.js +0 -415
- package/dist/src/modules/base/base.types.d.ts +0 -1
- package/dist/src/modules/base/base.types.js +0 -2
- package/dist/src/modules/billing/billing.db.d.ts +0 -365
- package/dist/src/modules/billing/billing.db.js +0 -29
- package/dist/src/modules/billing/billing.repository.d.ts +0 -2763
- package/dist/src/modules/billing/billing.repository.js +0 -235
- package/dist/src/modules/billing/billing.router.d.ts +0 -4
- package/dist/src/modules/billing/billing.router.js +0 -56
- package/dist/src/modules/billing/billing.service.d.ts +0 -59
- package/dist/src/modules/billing/billing.service.js +0 -147
- package/dist/src/modules/billing/billing.trpc.d.ts +0 -38
- package/dist/src/modules/billing/billing.trpc.js +0 -17
- package/dist/src/modules/clay/clay.repository.d.ts +0 -5
- package/dist/src/modules/clay/clay.repository.js +0 -26
- package/dist/src/modules/clay/clay.service.d.ts +0 -28
- package/dist/src/modules/clay/clay.service.js +0 -24
- package/dist/src/modules/connect/connect.db.d.ts +0 -356
- package/dist/src/modules/connect/connect.db.js +0 -30
- package/dist/src/modules/connect/connect.dto.d.ts +0 -74
- package/dist/src/modules/connect/connect.dto.js +0 -36
- package/dist/src/modules/connect/connect.linkedin.d.ts +0 -2
- package/dist/src/modules/connect/connect.linkedin.js +0 -53
- package/dist/src/modules/connect/connect.oauth.d.ts +0 -27
- package/dist/src/modules/connect/connect.oauth.js +0 -198
- package/dist/src/modules/connect/connect.repository.d.ts +0 -413
- package/dist/src/modules/connect/connect.repository.js +0 -54
- package/dist/src/modules/connect/connect.router.d.ts +0 -4
- package/dist/src/modules/connect/connect.router.js +0 -54
- package/dist/src/modules/connect/connect.service.d.ts +0 -88
- package/dist/src/modules/connect/connect.service.js +0 -114
- package/dist/src/modules/connect/connect.trpc.d.ts +0 -44
- package/dist/src/modules/connect/connect.trpc.js +0 -21
- package/dist/src/modules/connect/connect.types.d.ts +0 -25
- package/dist/src/modules/connect/connect.types.js +0 -2
- package/dist/src/modules/crypto/crypto.db.d.ts +0 -151
- package/dist/src/modules/crypto/crypto.db.js +0 -17
- package/dist/src/modules/crypto/crypto.repository.d.ts +0 -159
- package/dist/src/modules/crypto/crypto.repository.js +0 -10
- package/dist/src/modules/crypto/crypto.service.d.ts +0 -10
- package/dist/src/modules/crypto/crypto.service.js +0 -52
- package/dist/src/modules/email/email.service.d.ts +0 -56
- package/dist/src/modules/email/email.service.js +0 -106
- package/dist/src/modules/file/file.repository.d.ts +0 -12
- package/dist/src/modules/file/file.repository.js +0 -79
- package/dist/src/modules/file/file.router.js +0 -99
- package/dist/src/modules/file/file.service.d.ts +0 -24
- package/dist/src/modules/file/file.service.js +0 -150
- package/dist/src/modules/recurrence/recurrence.db.d.ts +0 -562
- package/dist/src/modules/recurrence/recurrence.db.js +0 -66
- package/dist/src/modules/recurrence/recurrence.repository.d.ts +0 -584
- package/dist/src/modules/recurrence/recurrence.repository.js +0 -39
- package/dist/src/modules/recurrence/recurrence.service.d.ts +0 -50
- package/dist/src/modules/recurrence/recurrence.service.js +0 -69
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts +0 -206
- package/dist/src/modules/recurrence/recurrence.trpc.js +0 -65
- package/dist/src/modules/social/social.dto.d.ts +0 -34
- package/dist/src/modules/social/social.dto.js +0 -18
- package/dist/src/modules/social/social.linkedin.js +0 -427
- package/dist/src/modules/social/social.linkedin.test.js +0 -235
- package/dist/src/modules/social/social.service.d.ts +0 -28
- package/dist/src/modules/social/social.service.js +0 -76
- package/dist/src/modules/social/social.types.d.ts +0 -35
- package/dist/src/modules/social/social.types.js +0 -2
- package/dist/src/modules/tag/tag.db.d.ts +0 -346
- package/dist/src/modules/tag/tag.db.js +0 -42
- package/dist/src/modules/tag/tag.dto.d.ts +0 -1018
- package/dist/src/modules/tag/tag.dto.js +0 -9
- package/dist/src/modules/tag/tag.repository.d.ts +0 -383
- package/dist/src/modules/tag/tag.repository.js +0 -156
- package/dist/src/modules/tag/tag.service.d.ts +0 -109
- package/dist/src/modules/tag/tag.service.js +0 -42
- package/dist/src/modules/tag/tag.trpc.d.ts +0 -164
- package/dist/src/modules/tag/tag.trpc.js +0 -53
- package/dist/src/modules/utils/applyPagination.js +0 -16
- package/dist/src/modules/utils/applySorting.d.ts +0 -8
- package/dist/src/modules/utils/applySorting.js +0 -18
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts +0 -4
- package/dist/src/modules/utils/getConditionsFromFilters.js +0 -200
- package/dist/src/modules/video/video.service.d.ts +0 -7
- package/dist/src/modules/video/video.service.js +0 -84
- package/dist/src/modules/webhook/webhook.constants.d.ts +0 -8
- package/dist/src/modules/webhook/webhook.constants.js +0 -10
- package/dist/src/modules/webhook/webhook.db.d.ts +0 -136
- package/dist/src/modules/webhook/webhook.db.js +0 -17
- package/dist/src/modules/webhook/webhook.dto.d.ts +0 -394
- package/dist/src/modules/webhook/webhook.dto.js +0 -7
- package/dist/src/modules/webhook/webhook.repository.d.ts +0 -148
- package/dist/src/modules/webhook/webhook.repository.js +0 -56
- package/dist/src/modules/webhook/webhook.router.d.ts +0 -3
- package/dist/src/modules/webhook/webhook.router.js +0 -30
- package/dist/src/modules/webhook/webhook.service.d.ts +0 -9
- package/dist/src/modules/webhook/webhook.service.js +0 -68
- package/dist/src/modules/workflow/workflow.db.d.ts +0 -296
- package/dist/src/modules/workflow/workflow.db.js +0 -30
- package/dist/src/modules/workflow/workflow.repository.d.ts +0 -343
- package/dist/src/modules/workflow/workflow.repository.js +0 -105
- package/dist/src/modules/workflow/workflow.service.d.ts +0 -21
- package/dist/src/modules/workflow/workflow.service.js +0 -37
- package/dist/src/modules/workflow/workflow.trpc.d.ts +0 -56
- package/dist/src/modules/workflow/workflow.trpc.js +0 -21
- package/dist/src/modules/workflow/workflow.types.d.ts +0 -20
- package/dist/src/modules/workflow/workflow.types.js +0 -2
- package/dist/src/modules/workflow/workflow.utils.d.ts +0 -21
- package/dist/src/modules/workflow/workflow.utils.js +0 -173
- package/dist/src/test/stubs/utils.d.ts +0 -2
- package/dist/src/test/stubs/utils.js +0 -5
- package/dist/src/trpc/context.d.ts +0 -41
- package/dist/src/trpc/context.js +0 -17
- package/dist/src/trpc/index.d.ts +0 -3
- package/dist/src/trpc/index.js +0 -6
- package/dist/src/trpc/procedures.d.ts +0 -233
- package/dist/src/trpc/procedures.js +0 -32
- package/dist/src/trpc/utils.d.ts +0 -4
- package/dist/src/trpc/utils.js +0 -20
- package/dist/src/types.d.ts +0 -358
- package/dist/src/types.js +0 -12
- package/dist/src/utils/errors.d.ts +0 -49
- package/dist/src/utils/errors.js +0 -104
- package/dist/src/utils/logger.d.ts +0 -1
- package/dist/src/utils/logger.js +0 -11
- package/dist/src/utils/posthog.d.ts +0 -13
- package/dist/src/utils/posthog.js +0 -31
- package/dist/src/utils/trpc.d.ts +0 -58
- package/dist/src/utils/trpc.js +0 -63
- package/dist/src/utils/types.d.ts +0 -4
- package/dist/src/utils/types.js +0 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/src/{lib/sentry.d.ts → modules/ai/ai.router.mjs} +0 -0
- /package/dist/src/modules/{access/access.test.d.ts → base/base.types.mjs} +0 -0
- /package/dist/src/modules/{ai/ai.router.d.ts → connect/connect.types.mjs} +0 -0
- /package/dist/src/modules/{base/base.grants.test.d.ts → social/social.types.mjs} +0 -0
- /package/dist/src/modules/{base/base.service.test.d.ts → workflow/workflow.types.mjs} +0 -0
- /package/dist/src/{modules/social/social.linkedin.test.d.ts → utils/types.mjs} +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CryptoRepository = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const base_repository_1 = require("../base/base.repository");
|
|
6
|
-
const crypto = tslib_1.__importStar(require("./crypto.db"));
|
|
7
|
-
const schema = { ...crypto };
|
|
8
|
-
class CryptoRepository extends base_repository_1.BaseTableRepository {
|
|
9
|
-
}
|
|
10
|
-
exports.CryptoRepository = CryptoRepository;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseService } from "../base/base.service";
|
|
2
|
-
import type { ServerResult } from "../base/base.dto";
|
|
3
|
-
import type { CryptoRepository } from "./crypto.repository";
|
|
4
|
-
export declare class CryptoService extends BaseService<{
|
|
5
|
-
crypto: CryptoRepository;
|
|
6
|
-
}, Record<string, never>> {
|
|
7
|
-
private root;
|
|
8
|
-
private getRoot;
|
|
9
|
-
createBitcoinAddress(derivationIndex: number): ServerResult<string>;
|
|
10
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CryptoService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const bip32_1 = tslib_1.__importDefault(require("bip32"));
|
|
6
|
-
const bip39 = tslib_1.__importStar(require("bip39"));
|
|
7
|
-
const bitcoin = tslib_1.__importStar(require("bitcoinjs-lib"));
|
|
8
|
-
const ecc = tslib_1.__importStar(require("tiny-secp256k1"));
|
|
9
|
-
const neverthrow_1 = require("neverthrow");
|
|
10
|
-
const base_service_1 = require("../base/base.service");
|
|
11
|
-
const BITCOIN_NATIVE_SEGWIT_PATH = "m/84'/0'/0'/0";
|
|
12
|
-
const bip32 = (0, bip32_1.default)(ecc);
|
|
13
|
-
class CryptoService extends base_service_1.BaseService {
|
|
14
|
-
root = null;
|
|
15
|
-
getRoot() {
|
|
16
|
-
if (this.root)
|
|
17
|
-
return this.root;
|
|
18
|
-
const seed = process.env.BITCOIN_SEED;
|
|
19
|
-
if (!seed?.trim()) {
|
|
20
|
-
throw new Error("BITCOIN_SEED environment variable is not set");
|
|
21
|
-
}
|
|
22
|
-
if (!bip39.validateMnemonic(seed.trim())) {
|
|
23
|
-
throw new Error("BITCOIN_SEED is not a valid BIP39 mnemonic");
|
|
24
|
-
}
|
|
25
|
-
const seedBuffer = bip39.mnemonicToSeedSync(seed.trim());
|
|
26
|
-
this.root = bip32.fromSeed(seedBuffer);
|
|
27
|
-
return this.root;
|
|
28
|
-
}
|
|
29
|
-
createBitcoinAddress(derivationIndex) {
|
|
30
|
-
return this.throwable(() => {
|
|
31
|
-
if (derivationIndex < 0 || !Number.isInteger(derivationIndex)) {
|
|
32
|
-
return this.error("BAD_REQUEST", "derivationIndex must be a non-negative integer");
|
|
33
|
-
}
|
|
34
|
-
const root = this.getRoot();
|
|
35
|
-
const path = `${BITCOIN_NATIVE_SEGWIT_PATH}/${derivationIndex}`;
|
|
36
|
-
const child = root.derivePath(path);
|
|
37
|
-
if (!child.publicKey) {
|
|
38
|
-
return this.error("INTERNAL_SERVER_ERROR", "Failed to derive public key");
|
|
39
|
-
}
|
|
40
|
-
const payment = bitcoin.payments.p2wpkh({
|
|
41
|
-
pubkey: child.publicKey,
|
|
42
|
-
network: bitcoin.networks.bitcoin,
|
|
43
|
-
});
|
|
44
|
-
const address = payment.address;
|
|
45
|
-
if (!address) {
|
|
46
|
-
return this.error("INTERNAL_SERVER_ERROR", "Failed to generate address");
|
|
47
|
-
}
|
|
48
|
-
return (0, neverthrow_1.ok)(address);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.CryptoService = CryptoService;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { type FunctionComponent } from "react";
|
|
2
|
-
import { Resend } from "resend";
|
|
3
|
-
import { BaseService } from "../base/base.service";
|
|
4
|
-
type Brand = {
|
|
5
|
-
name: string;
|
|
6
|
-
logo: string;
|
|
7
|
-
tagline: string;
|
|
8
|
-
};
|
|
9
|
-
type OverrideOptions = {
|
|
10
|
-
from?: string;
|
|
11
|
-
subject?: string;
|
|
12
|
-
previewText?: string;
|
|
13
|
-
};
|
|
14
|
-
type EmailTemplate = {
|
|
15
|
-
id: string;
|
|
16
|
-
subject?: string;
|
|
17
|
-
previewText?: string;
|
|
18
|
-
from?: string;
|
|
19
|
-
react: FunctionComponent<Record<string, unknown>>;
|
|
20
|
-
};
|
|
21
|
-
type EmailTemplates = {
|
|
22
|
-
accountDeletion: EmailTemplate;
|
|
23
|
-
verification: EmailTemplate;
|
|
24
|
-
waitlistConfirmation: EmailTemplate;
|
|
25
|
-
passwordReset: EmailTemplate;
|
|
26
|
-
systemWaitlistNotification: EmailTemplate;
|
|
27
|
-
waitlistInvite: EmailTemplate;
|
|
28
|
-
waitlistUserInvite: EmailTemplate;
|
|
29
|
-
organizationInvite: EmailTemplate;
|
|
30
|
-
[key: string]: EmailTemplate;
|
|
31
|
-
};
|
|
32
|
-
type EmailServiceProps = {
|
|
33
|
-
resendApiKey?: string;
|
|
34
|
-
brand: Brand;
|
|
35
|
-
noReplyFrom: string;
|
|
36
|
-
systemNotificationEmail: string;
|
|
37
|
-
templates: EmailTemplates;
|
|
38
|
-
};
|
|
39
|
-
export declare class EmailService extends BaseService<never, never> {
|
|
40
|
-
client: Resend;
|
|
41
|
-
brand: Brand;
|
|
42
|
-
noReplyFrom: string;
|
|
43
|
-
templates: EmailTemplates;
|
|
44
|
-
systemNotificationEmail: string;
|
|
45
|
-
constructor(props: EmailServiceProps);
|
|
46
|
-
sendTemplate(to: string | string[], templateKey: keyof EmailTemplates, templateProps: Record<string, unknown>, options?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
47
|
-
sendBrandTemplate(to: string | string[], templateKey: keyof EmailTemplates, templateProps: Record<string, unknown>, options?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
48
|
-
sendWaitlistConfirmation(email: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
49
|
-
sendWaitlistInvite(email: string, code: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
50
|
-
sendWaitlistUserInvite(email: string, code: string, inviter: string, name?: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
51
|
-
sendOrganizationInvite(email: string, organizationName: string, inviterName: string, role: string, url: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
52
|
-
sendVerification(email: string, url: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
53
|
-
sendResetPassword(email: string, url: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
54
|
-
sendDeleteAccountVerification(email: string, url: string, overrideOptions?: OverrideOptions): Promise<import("neverthrow").Err<never, import("../../utils/errors").ServerError> | import("neverthrow").Ok<void, never>>;
|
|
55
|
-
}
|
|
56
|
-
export {};
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailService = void 0;
|
|
4
|
-
const neverthrow_1 = require("neverthrow");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const resend_1 = require("resend");
|
|
7
|
-
const base_service_1 = require("../base/base.service");
|
|
8
|
-
class EmailService extends base_service_1.BaseService {
|
|
9
|
-
client;
|
|
10
|
-
brand;
|
|
11
|
-
noReplyFrom;
|
|
12
|
-
templates;
|
|
13
|
-
systemNotificationEmail;
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super(undefined, undefined);
|
|
16
|
-
this.client = new resend_1.Resend(props.resendApiKey || process.env.RESEND_API_KEY);
|
|
17
|
-
this.brand = props.brand;
|
|
18
|
-
this.noReplyFrom = props.noReplyFrom;
|
|
19
|
-
this.templates = props.templates;
|
|
20
|
-
this.systemNotificationEmail = props.systemNotificationEmail;
|
|
21
|
-
}
|
|
22
|
-
async sendTemplate(to, templateKey, templateProps, options) {
|
|
23
|
-
const template = this.templates[templateKey];
|
|
24
|
-
if (!template) {
|
|
25
|
-
return this.error("NOT_FOUND", `Email template not found: ${String(templateKey)}`);
|
|
26
|
-
}
|
|
27
|
-
const from = options?.from || this.noReplyFrom;
|
|
28
|
-
const subject = options?.subject || template.subject || String(templateKey);
|
|
29
|
-
const previewText = options?.previewText || template.previewText || subject;
|
|
30
|
-
const { error } = await this.client.emails.send({
|
|
31
|
-
to,
|
|
32
|
-
subject,
|
|
33
|
-
from,
|
|
34
|
-
react: (0, react_1.createElement)(template.react, { ...templateProps, previewText }),
|
|
35
|
-
});
|
|
36
|
-
if (error)
|
|
37
|
-
return this.error("INTERNAL_SERVER_ERROR", `Failed to send email: ${templateKey}`, {
|
|
38
|
-
cause: error,
|
|
39
|
-
});
|
|
40
|
-
return (0, neverthrow_1.ok)();
|
|
41
|
-
}
|
|
42
|
-
async sendBrandTemplate(to, templateKey, templateProps, options) {
|
|
43
|
-
return this.sendTemplate(to, templateKey, {
|
|
44
|
-
brand: this.brand,
|
|
45
|
-
...templateProps,
|
|
46
|
-
}, options);
|
|
47
|
-
}
|
|
48
|
-
async sendWaitlistConfirmation(email, overrideOptions) {
|
|
49
|
-
return this.sendTemplate(email, "waitlistConfirmation", {
|
|
50
|
-
email,
|
|
51
|
-
brand: this.brand,
|
|
52
|
-
}, overrideOptions);
|
|
53
|
-
}
|
|
54
|
-
async sendWaitlistInvite(email, code, overrideOptions) {
|
|
55
|
-
const url = `${process.env.VITE_APP_URL}/signup?code=${code}&email=${email}`;
|
|
56
|
-
return this.sendTemplate(email, "waitlistInvite", {
|
|
57
|
-
url,
|
|
58
|
-
brand: this.brand,
|
|
59
|
-
}, overrideOptions);
|
|
60
|
-
}
|
|
61
|
-
async sendWaitlistUserInvite(email, code, inviter, name, overrideOptions) {
|
|
62
|
-
const url = `${process.env.VITE_APP_URL}/signup?code=${code}&email=${email}`;
|
|
63
|
-
return this.sendTemplate(email, "waitlistUserInvite", {
|
|
64
|
-
url,
|
|
65
|
-
brand: this.brand,
|
|
66
|
-
inviter,
|
|
67
|
-
name,
|
|
68
|
-
}, {
|
|
69
|
-
previewText: `Create your ${this.brand.name} account today!`,
|
|
70
|
-
subject: `${inviter} has invited you to join ${this.brand.name}!`,
|
|
71
|
-
...overrideOptions,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
async sendOrganizationInvite(email, organizationName, inviterName, role, url, overrideOptions) {
|
|
75
|
-
return this.sendTemplate(email, "organizationInvite", {
|
|
76
|
-
url,
|
|
77
|
-
brand: this.brand,
|
|
78
|
-
organizationName,
|
|
79
|
-
inviterName,
|
|
80
|
-
role,
|
|
81
|
-
}, {
|
|
82
|
-
previewText: `${inviterName} invited you to ${organizationName}`,
|
|
83
|
-
subject: `${inviterName} invited you to join ${organizationName}`,
|
|
84
|
-
...overrideOptions,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
async sendVerification(email, url, overrideOptions) {
|
|
88
|
-
return this.sendTemplate(email, "verification", {
|
|
89
|
-
url,
|
|
90
|
-
brand: this.brand,
|
|
91
|
-
}, overrideOptions);
|
|
92
|
-
}
|
|
93
|
-
async sendResetPassword(email, url, overrideOptions) {
|
|
94
|
-
return this.sendTemplate(email, "passwordReset", {
|
|
95
|
-
url,
|
|
96
|
-
brand: this.brand,
|
|
97
|
-
}, overrideOptions);
|
|
98
|
-
}
|
|
99
|
-
async sendDeleteAccountVerification(email, url, overrideOptions) {
|
|
100
|
-
return this.sendTemplate(email, "accountDeletion", {
|
|
101
|
-
url,
|
|
102
|
-
brand: this.brand,
|
|
103
|
-
}, overrideOptions);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
exports.EmailService = EmailService;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type GetObjectCommandOutput } from "@aws-sdk/client-s3";
|
|
2
|
-
import type { ServerResultAsync } from "../base/base.dto";
|
|
3
|
-
import { BaseExternaRepository } from "../base/base.repository";
|
|
4
|
-
export declare class FileRepository extends BaseExternaRepository {
|
|
5
|
-
private readonly s3;
|
|
6
|
-
constructor();
|
|
7
|
-
getS3UploadUrl(filename: string, filetype: string, expiresIn?: number): ServerResultAsync<string>;
|
|
8
|
-
getS3DownloadUrl(path: string, expiresIn?: number): ServerResultAsync<string>;
|
|
9
|
-
getS3Object(path: string): ServerResultAsync<GetObjectCommandOutput>;
|
|
10
|
-
getS3ObjectT(path: string): ServerResultAsync<GetObjectCommandOutput>;
|
|
11
|
-
deleteS3Object(path: string): ServerResultAsync<void>;
|
|
12
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileRepository = void 0;
|
|
4
|
-
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
-
const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
|
|
6
|
-
const neverthrow_1 = require("neverthrow");
|
|
7
|
-
const base_repository_1 = require("../base/base.repository");
|
|
8
|
-
class FileRepository extends base_repository_1.BaseExternaRepository {
|
|
9
|
-
s3;
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
if (!process.env.AWS_REGION ||
|
|
13
|
-
!process.env.AWS_ACCESS_KEY_ID ||
|
|
14
|
-
!process.env.AWS_SECRET_ACCESS_KEY) {
|
|
15
|
-
throw new Error("Missing AWS environment variables");
|
|
16
|
-
}
|
|
17
|
-
this.s3 = new client_s3_1.S3Client({
|
|
18
|
-
region: process.env.AWS_REGION,
|
|
19
|
-
credentials: {
|
|
20
|
-
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
21
|
-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
22
|
-
},
|
|
23
|
-
...(process.env.AWS_S3_ENDPOINT ? { endpoint: process.env.AWS_S3_ENDPOINT } : {}),
|
|
24
|
-
forcePathStyle: !!process.env.AWS_S3_ENDPOINT, // Path style is often required for non-AWS S3 providers
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
async getS3UploadUrl(filename, filetype, expiresIn = 60 * 5) {
|
|
28
|
-
return this.throwableAsync(async () => {
|
|
29
|
-
const command = new client_s3_1.PutObjectCommand({
|
|
30
|
-
Bucket: process.env.AWS_S3_BUCKET,
|
|
31
|
-
Key: filename,
|
|
32
|
-
ContentType: filetype,
|
|
33
|
-
});
|
|
34
|
-
const url = await (0, s3_request_presigner_1.getSignedUrl)(this.s3, command, { expiresIn });
|
|
35
|
-
return (0, neverthrow_1.ok)(url);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
async getS3DownloadUrl(path, expiresIn = 60 * 5) {
|
|
39
|
-
return this.throwableAsync(async () => {
|
|
40
|
-
const command = new client_s3_1.GetObjectCommand({
|
|
41
|
-
Bucket: process.env.AWS_S3_BUCKET,
|
|
42
|
-
Key: path,
|
|
43
|
-
});
|
|
44
|
-
const url = await (0, s3_request_presigner_1.getSignedUrl)(this.s3, command, { expiresIn });
|
|
45
|
-
return (0, neverthrow_1.ok)(url);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
async getS3Object(path) {
|
|
49
|
-
return this.throwableAsync(async () => {
|
|
50
|
-
const command = new client_s3_1.GetObjectCommand({
|
|
51
|
-
Bucket: process.env.AWS_S3_BUCKET,
|
|
52
|
-
Key: path,
|
|
53
|
-
});
|
|
54
|
-
const data = await this.s3.send(command);
|
|
55
|
-
return (0, neverthrow_1.ok)(data);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
async getS3ObjectT(path) {
|
|
59
|
-
return this.throwableAsync(async () => {
|
|
60
|
-
const command = new client_s3_1.GetObjectCommand({
|
|
61
|
-
Bucket: process.env.AWS_S3_BUCKET,
|
|
62
|
-
Key: path,
|
|
63
|
-
});
|
|
64
|
-
const data = await this.s3.send(command);
|
|
65
|
-
return (0, neverthrow_1.ok)(data);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
async deleteS3Object(path) {
|
|
69
|
-
return this.throwableAsync(async () => {
|
|
70
|
-
const command = new client_s3_1.DeleteObjectCommand({
|
|
71
|
-
Bucket: process.env.AWS_S3_BUCKET,
|
|
72
|
-
Key: path,
|
|
73
|
-
});
|
|
74
|
-
await this.s3.send(command);
|
|
75
|
-
return (0, neverthrow_1.ok)(undefined);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.FileRepository = FileRepository;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uploadRouter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
|
-
const file_constants_1 = require("@m5kdev/commons/modules/file/file.constants");
|
|
7
|
-
const body_parser_1 = tslib_1.__importDefault(require("body-parser"));
|
|
8
|
-
const express_1 = tslib_1.__importDefault(require("express"));
|
|
9
|
-
const multer_1 = tslib_1.__importDefault(require("multer"));
|
|
10
|
-
const uuid_1 = require("uuid");
|
|
11
|
-
const file_repository_1 = require("./file.repository");
|
|
12
|
-
const file_service_1 = require("./file.service");
|
|
13
|
-
const fileRepository = new file_repository_1.FileRepository();
|
|
14
|
-
const fileService = new file_service_1.FileService({ file: fileRepository });
|
|
15
|
-
function validateMimeType(type, file) {
|
|
16
|
-
return file_constants_1.fileTypes[type]?.mimetypes.includes(file.mimetype);
|
|
17
|
-
}
|
|
18
|
-
function getFileExtension(file) {
|
|
19
|
-
return file.originalname.split(".").pop();
|
|
20
|
-
}
|
|
21
|
-
const storage = multer_1.default.diskStorage({
|
|
22
|
-
destination: (_req, _file, cb) => {
|
|
23
|
-
cb(null, node_path_1.default.join(__dirname, "..", "uploads"));
|
|
24
|
-
},
|
|
25
|
-
filename: (_req, file, cb) => {
|
|
26
|
-
cb(null, `${(0, uuid_1.v4)()}.${getFileExtension(file)}`);
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
const fileFilter = (req, file, cb) => {
|
|
30
|
-
const { type } = req.params;
|
|
31
|
-
if (type && validateMimeType(type, file)) {
|
|
32
|
-
cb(null, true);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
cb(new Error("Invalid file type"));
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const upload = (0, multer_1.default)({ storage, fileFilter });
|
|
39
|
-
const uploadRouter = express_1.default.Router();
|
|
40
|
-
exports.uploadRouter = uploadRouter;
|
|
41
|
-
uploadRouter.post("/file/:type", upload.single("file"), (req, res) => {
|
|
42
|
-
const { file } = req;
|
|
43
|
-
if (!file) {
|
|
44
|
-
return res.status(400).json({ error: "No file uploaded" });
|
|
45
|
-
}
|
|
46
|
-
return res.json({
|
|
47
|
-
url: `${process.env.VITE_SERVER_URL}/upload/file/${file.filename}`,
|
|
48
|
-
mimetype: file.mimetype,
|
|
49
|
-
size: file.size,
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
uploadRouter.get("/file/:filename", (req, res) => {
|
|
53
|
-
res.sendFile(node_path_1.default.join(__dirname, "..", "uploads", req.params.filename));
|
|
54
|
-
});
|
|
55
|
-
uploadRouter.get("/files/:path", async (req, res) => {
|
|
56
|
-
try {
|
|
57
|
-
const url = await fileService.getS3DownloadUrl(req.params.path);
|
|
58
|
-
if (url.isErr()) {
|
|
59
|
-
console.error(url.error);
|
|
60
|
-
return res.status(500).json({ error: url.error.message });
|
|
61
|
-
}
|
|
62
|
-
return res.json({ url: url.value });
|
|
63
|
-
}
|
|
64
|
-
catch (err) {
|
|
65
|
-
console.error(err);
|
|
66
|
-
return res.status(500).json({ error: err.message || "Failed to generate presigned URL" });
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
uploadRouter.post("/s3-presigned-url", body_parser_1.default.json(), async (req, res) => {
|
|
70
|
-
const { filename, filetype } = req.body;
|
|
71
|
-
if (!filename || !filetype) {
|
|
72
|
-
return res.status(400).json({ error: "Missing filename or filetype" });
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
const url = await fileService.getS3UploadUrl(filename, filetype);
|
|
76
|
-
if (url.isErr()) {
|
|
77
|
-
return res.status(500).json({ error: url.error.message });
|
|
78
|
-
}
|
|
79
|
-
return res.json({ url: url.value });
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
console.error(err);
|
|
83
|
-
return res.status(500).json({ error: err.message || "Failed to generate presigned URL" });
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
uploadRouter.delete("/files/:path(*)", async (req, res) => {
|
|
87
|
-
try {
|
|
88
|
-
const result = await fileService.deleteS3Object(req.params.path);
|
|
89
|
-
if (result.isErr()) {
|
|
90
|
-
console.error(result.error);
|
|
91
|
-
return res.status(500).json({ error: result.error.message });
|
|
92
|
-
}
|
|
93
|
-
return res.json({ success: true });
|
|
94
|
-
}
|
|
95
|
-
catch (err) {
|
|
96
|
-
console.error(err);
|
|
97
|
-
return res.status(500).json({ error: err.message || "Failed to delete S3 object" });
|
|
98
|
-
}
|
|
99
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { fileTypes } from "@m5kdev/commons/modules/file/file.constants";
|
|
2
|
-
import type { ServerResult, ServerResultAsync } from "../base/base.dto";
|
|
3
|
-
import { BaseService } from "../base/base.service";
|
|
4
|
-
import type { FileRepository } from "./file.repository";
|
|
5
|
-
export declare class FileService extends BaseService<{
|
|
6
|
-
file: FileRepository;
|
|
7
|
-
}, never> {
|
|
8
|
-
isS3Path(path: string): boolean;
|
|
9
|
-
parseS3Path(S3Path: string): ServerResult<{
|
|
10
|
-
bucket: string;
|
|
11
|
-
path: string;
|
|
12
|
-
}>;
|
|
13
|
-
wrapS3Path(path: string, bucket: string): string;
|
|
14
|
-
getS3UploadUrl(filename: string, filetype: string, expiresIn?: number): ServerResultAsync<string>;
|
|
15
|
-
getS3DownloadUrl(path: string, expiresIn?: number): ServerResultAsync<string>;
|
|
16
|
-
getS3Object(path: string): ServerResultAsync<import("@aws-sdk/client-s3").GetObjectCommandOutput>;
|
|
17
|
-
deleteS3Object(path: string): ServerResultAsync<void>;
|
|
18
|
-
uploadFileToS3(localPath: string, returnDownloadUrl?: boolean): ServerResultAsync<string>;
|
|
19
|
-
downloadS3ToFile(s3Path: string): ServerResultAsync<string>;
|
|
20
|
-
getFileType(path: string): {
|
|
21
|
-
fileType: keyof typeof fileTypes;
|
|
22
|
-
extension: string;
|
|
23
|
-
} | undefined;
|
|
24
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FileService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_fs_1 = require("node:fs");
|
|
6
|
-
const promises_1 = require("node:fs/promises");
|
|
7
|
-
const node_os_1 = require("node:os");
|
|
8
|
-
const node_path_1 = tslib_1.__importStar(require("node:path"));
|
|
9
|
-
const node_stream_1 = require("node:stream");
|
|
10
|
-
const promises_2 = require("node:stream/promises");
|
|
11
|
-
const file_constants_1 = require("@m5kdev/commons/modules/file/file.constants");
|
|
12
|
-
const neverthrow_1 = require("neverthrow");
|
|
13
|
-
const uuid_1 = require("uuid");
|
|
14
|
-
const base_service_1 = require("../base/base.service");
|
|
15
|
-
class FileService extends base_service_1.BaseService {
|
|
16
|
-
isS3Path(path) {
|
|
17
|
-
return path.startsWith("s3::");
|
|
18
|
-
}
|
|
19
|
-
parseS3Path(S3Path) {
|
|
20
|
-
if (!this.isS3Path(S3Path)) {
|
|
21
|
-
return this.error("BAD_REQUEST", "Invalid S3 path");
|
|
22
|
-
}
|
|
23
|
-
const [bucket, path] = S3Path.split("s3::")[1].split("//");
|
|
24
|
-
return (0, neverthrow_1.ok)({ bucket, path });
|
|
25
|
-
}
|
|
26
|
-
wrapS3Path(path, bucket) {
|
|
27
|
-
return `s3::${bucket}//${path}`;
|
|
28
|
-
}
|
|
29
|
-
getS3UploadUrl(filename, filetype, expiresIn = 60 * 5) {
|
|
30
|
-
return this.repository.file.getS3UploadUrl(filename, filetype, expiresIn);
|
|
31
|
-
}
|
|
32
|
-
getS3DownloadUrl(path, expiresIn = 60 * 5) {
|
|
33
|
-
return this.repository.file.getS3DownloadUrl(path, expiresIn);
|
|
34
|
-
}
|
|
35
|
-
getS3Object(path) {
|
|
36
|
-
return this.repository.file.getS3Object(path);
|
|
37
|
-
}
|
|
38
|
-
deleteS3Object(path) {
|
|
39
|
-
return this.repository.file.deleteS3Object(path);
|
|
40
|
-
}
|
|
41
|
-
async uploadFileToS3(localPath, returnDownloadUrl = false) {
|
|
42
|
-
return this.throwableAsync(async () => {
|
|
43
|
-
const extension = localPath.split(".").pop()?.toLowerCase();
|
|
44
|
-
const filename = `${(0, uuid_1.v4)()}${extension ? `.${extension}` : ""}`;
|
|
45
|
-
const mimeByExt = {
|
|
46
|
-
jpg: "image/jpeg",
|
|
47
|
-
jpeg: "image/jpeg",
|
|
48
|
-
png: "image/png",
|
|
49
|
-
webp: "image/webp",
|
|
50
|
-
mp4: "video/mp4",
|
|
51
|
-
mov: "video/mov",
|
|
52
|
-
avi: "video/avi",
|
|
53
|
-
mkv: "video/mkv",
|
|
54
|
-
webm: "video/webm",
|
|
55
|
-
mp3: "audio/mp3",
|
|
56
|
-
wav: "audio/wav",
|
|
57
|
-
m4a: "audio/m4a",
|
|
58
|
-
};
|
|
59
|
-
const filetype = (extension && mimeByExt[extension]) || "application/octet-stream";
|
|
60
|
-
const presigned = await this.getS3UploadUrl(filename, filetype);
|
|
61
|
-
if (presigned.isErr())
|
|
62
|
-
return (0, neverthrow_1.err)(presigned.error);
|
|
63
|
-
const file = await (0, promises_1.readFile)(localPath);
|
|
64
|
-
const res = await fetch(presigned.value, {
|
|
65
|
-
method: "PUT",
|
|
66
|
-
body: file,
|
|
67
|
-
headers: { "Content-Type": filetype },
|
|
68
|
-
});
|
|
69
|
-
if (!res.ok) {
|
|
70
|
-
return this.error("INTERNAL_SERVER_ERROR", `Failed to upload to S3: ${res.status}`);
|
|
71
|
-
}
|
|
72
|
-
if (returnDownloadUrl) {
|
|
73
|
-
const downloadUrl = await this.getS3DownloadUrl(filename);
|
|
74
|
-
if (downloadUrl.isErr())
|
|
75
|
-
return (0, neverthrow_1.err)(downloadUrl.error);
|
|
76
|
-
return (0, neverthrow_1.ok)(downloadUrl.value);
|
|
77
|
-
}
|
|
78
|
-
return (0, neverthrow_1.ok)(filename);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
async downloadS3ToFile(s3Path) {
|
|
82
|
-
return this.throwableAsync(async () => {
|
|
83
|
-
const extension = s3Path.split(".").pop();
|
|
84
|
-
const destinationPath = node_path_1.default.join((0, node_os_1.tmpdir)(), "s3-downloads", `${(0, uuid_1.v4)()}${extension ? `.${extension}` : ""}`);
|
|
85
|
-
const result = await this.repository.file.getS3Object(s3Path);
|
|
86
|
-
if (result.isErr())
|
|
87
|
-
return (0, neverthrow_1.err)(result.error);
|
|
88
|
-
const body = result.value.Body;
|
|
89
|
-
if (!body)
|
|
90
|
-
return this.error("NOT_FOUND", "S3 object body is empty");
|
|
91
|
-
await (0, promises_1.mkdir)((0, node_path_1.dirname)(destinationPath), { recursive: true });
|
|
92
|
-
// AWS SDK v3 SdkStream has transformToByteArray method - use it for reliable handling
|
|
93
|
-
if (typeof body === "object" &&
|
|
94
|
-
"transformToByteArray" in body &&
|
|
95
|
-
typeof body.transformToByteArray === "function") {
|
|
96
|
-
const bytes = await body.transformToByteArray();
|
|
97
|
-
await (0, promises_1.writeFile)(destinationPath, bytes);
|
|
98
|
-
return (0, neverthrow_1.ok)(destinationPath);
|
|
99
|
-
}
|
|
100
|
-
// Fallback: try streaming approaches
|
|
101
|
-
const writeStream = (0, node_fs_1.createWriteStream)(destinationPath);
|
|
102
|
-
let input = null;
|
|
103
|
-
const unknownBody = body;
|
|
104
|
-
if (typeof unknownBody === "object" &&
|
|
105
|
-
unknownBody !== null &&
|
|
106
|
-
"pipe" in unknownBody &&
|
|
107
|
-
typeof unknownBody.pipe === "function") {
|
|
108
|
-
input = unknownBody;
|
|
109
|
-
}
|
|
110
|
-
else if (typeof unknownBody === "object" &&
|
|
111
|
-
unknownBody !== null &&
|
|
112
|
-
"getReader" in unknownBody &&
|
|
113
|
-
typeof unknownBody.getReader === "function") {
|
|
114
|
-
input = node_stream_1.Readable.fromWeb(unknownBody);
|
|
115
|
-
}
|
|
116
|
-
else if (typeof unknownBody === "object" &&
|
|
117
|
-
unknownBody !== null &&
|
|
118
|
-
"stream" in unknownBody &&
|
|
119
|
-
typeof unknownBody.stream === "function") {
|
|
120
|
-
input = node_stream_1.Readable.fromWeb(unknownBody.stream());
|
|
121
|
-
}
|
|
122
|
-
if (input) {
|
|
123
|
-
await (0, promises_2.pipeline)(input, writeStream);
|
|
124
|
-
return (0, neverthrow_1.ok)(destinationPath);
|
|
125
|
-
}
|
|
126
|
-
if (typeof unknownBody === "object" &&
|
|
127
|
-
unknownBody !== null &&
|
|
128
|
-
"arrayBuffer" in unknownBody &&
|
|
129
|
-
typeof unknownBody.arrayBuffer === "function") {
|
|
130
|
-
const buffer = Buffer.from(await unknownBody.arrayBuffer());
|
|
131
|
-
await (0, promises_2.pipeline)(node_stream_1.Readable.from(buffer), writeStream);
|
|
132
|
-
return (0, neverthrow_1.ok)(destinationPath);
|
|
133
|
-
}
|
|
134
|
-
return this.error("INTERNAL_SERVER_ERROR", "Unsupported S3 body type");
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
getFileType(path) {
|
|
138
|
-
// determine the type of the file
|
|
139
|
-
const extension = path.split(".").pop();
|
|
140
|
-
if (!extension)
|
|
141
|
-
return undefined;
|
|
142
|
-
for (const [key, value] of Object.entries(file_constants_1.fileTypes)) {
|
|
143
|
-
if (value.extensions.includes(extension)) {
|
|
144
|
-
return { fileType: key, extension };
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return undefined;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
exports.FileService = FileService;
|