@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
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { logger } from "./logger.mjs";
|
|
2
|
+
import { TRPCError } from "@trpc/server";
|
|
3
|
+
import { getHTTPStatusCodeFromError } from "@trpc/server/http";
|
|
4
|
+
import { camel } from "radashi";
|
|
5
|
+
//#region src/utils/errors.ts
|
|
6
|
+
var ServerError = class ServerError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
layer;
|
|
9
|
+
layerName;
|
|
10
|
+
clientMessage;
|
|
11
|
+
context;
|
|
12
|
+
boundaryStack;
|
|
13
|
+
constructor({ code, layer, layerName, message, clientMessage, cause, context, captureBoundary = true }) {
|
|
14
|
+
super(message ?? `server.error.${layer}.${camel(code)}`, { cause: cause instanceof Error ? cause : void 0 });
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.layer = layer ?? "unknown";
|
|
17
|
+
this.layerName = layerName ?? "UnknownLayer";
|
|
18
|
+
this.clientMessage = clientMessage ?? `server.error.${layer}.${camel(code)}`;
|
|
19
|
+
this.context = context;
|
|
20
|
+
if (captureBoundary) this.boundaryStack = (/* @__PURE__ */ new Error()).stack;
|
|
21
|
+
Error.captureStackTrace?.(this, ServerError);
|
|
22
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
23
|
+
}
|
|
24
|
+
is5xxError() {
|
|
25
|
+
const statusCode = this.getHTTPStatusCode();
|
|
26
|
+
return statusCode >= 500 && statusCode < 600;
|
|
27
|
+
}
|
|
28
|
+
getHTTPStatusCode() {
|
|
29
|
+
return getHTTPStatusCodeFromError(this.toTRPC());
|
|
30
|
+
}
|
|
31
|
+
toTRPC() {
|
|
32
|
+
return new TRPCError({
|
|
33
|
+
code: this.code,
|
|
34
|
+
message: this.message,
|
|
35
|
+
cause: this.cause
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
toJSON() {
|
|
39
|
+
return {
|
|
40
|
+
code: this.code,
|
|
41
|
+
layer: this.layer,
|
|
42
|
+
layerName: this.layerName,
|
|
43
|
+
message: this.message,
|
|
44
|
+
context: this.context,
|
|
45
|
+
stack: process.env.NODE_ENV !== "production" ? this.stack : void 0,
|
|
46
|
+
boundaryStack: process.env.NODE_ENV !== "production" ? this.boundaryStack : void 0,
|
|
47
|
+
cause: this.cause instanceof Error ? {
|
|
48
|
+
name: this.cause.name,
|
|
49
|
+
message: this.cause.message,
|
|
50
|
+
stack: this.cause.stack
|
|
51
|
+
} : this.cause
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static fromUnknown(code, cause, opts) {
|
|
55
|
+
const msg = cause instanceof Error ? cause.message : void 0;
|
|
56
|
+
return new ServerError({
|
|
57
|
+
code,
|
|
58
|
+
layer: opts?.layer,
|
|
59
|
+
layerName: opts?.layerName,
|
|
60
|
+
message: msg,
|
|
61
|
+
cause,
|
|
62
|
+
context: opts?.context,
|
|
63
|
+
captureBoundary: true
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
function getErrorReporter() {
|
|
68
|
+
return globalThis.m5ErrorReporter;
|
|
69
|
+
}
|
|
70
|
+
function setErrorReporter(reporter) {
|
|
71
|
+
globalThis.m5ErrorReporter = reporter;
|
|
72
|
+
}
|
|
73
|
+
function reportError(err, hint) {
|
|
74
|
+
let eventHint = hint;
|
|
75
|
+
const reporter = getErrorReporter();
|
|
76
|
+
if (!reporter) {
|
|
77
|
+
logger.error("[reportError] No error reporter set!");
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (err instanceof ServerError) eventHint = {
|
|
81
|
+
...hint,
|
|
82
|
+
captureContext: {
|
|
83
|
+
...hint?.captureContext,
|
|
84
|
+
extra: {
|
|
85
|
+
...hint?.captureContext?.extra ?? {},
|
|
86
|
+
layer: err.layer,
|
|
87
|
+
layerName: err.layerName
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
return reporter.captureException(err, eventHint);
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { ServerError, getErrorReporter, reportError, setErrorReporter };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/utils/errors.ts"],"sourcesContent":["import type { captureException } from \"@sentry/node\";\r\nimport { type TRPC_ERROR_CODE_KEY, TRPCError } from \"@trpc/server\";\r\nimport { getHTTPStatusCodeFromError } from \"@trpc/server/http\";\r\nimport { camel } from \"radashi\";\r\nimport type { ServerErrorLayer } from \"../modules/base/base.types\";\r\nimport { logger } from \"./logger\";\r\n\r\nexport type { ServerErrorLayer };\r\nexport class ServerError extends Error {\r\n readonly code: TRPC_ERROR_CODE_KEY;\r\n readonly layer: ServerErrorLayer;\r\n readonly layerName: string;\r\n readonly clientMessage?: string;\r\n readonly context?: Record<string, unknown>;\r\n readonly boundaryStack?: string; // where we wrapped it\r\n\r\n constructor({\r\n code,\r\n layer,\r\n layerName,\r\n message,\r\n clientMessage,\r\n cause,\r\n context,\r\n captureBoundary = true,\r\n }: {\r\n code: TRPC_ERROR_CODE_KEY;\r\n layer?: ServerErrorLayer;\r\n layerName?: string;\r\n message?: string;\r\n clientMessage?: string;\r\n cause?: unknown;\r\n context?: Record<string, unknown>;\r\n captureBoundary?: boolean;\r\n }) {\r\n // keep native cause chain when the cause is an Error\r\n super(message ?? `server.error.${layer}.${camel(code)}`, {\r\n cause: cause instanceof Error ? cause : undefined,\r\n });\r\n\r\n this.code = code;\r\n this.layer = layer ?? \"unknown\";\r\n this.layerName = layerName ?? \"UnknownLayer\";\r\n this.clientMessage = clientMessage ?? `server.error.${layer}.${camel(code)}`;\r\n this.context = context;\r\n if (captureBoundary) this.boundaryStack = new Error().stack;\r\n\r\n Error.captureStackTrace?.(this, ServerError);\r\n Object.setPrototypeOf(this, new.target.prototype);\r\n }\r\n\r\n is5xxError(): boolean {\r\n const statusCode = this.getHTTPStatusCode();\r\n return statusCode >= 500 && statusCode < 600;\r\n }\r\n\r\n getHTTPStatusCode(): number {\r\n return getHTTPStatusCodeFromError(this.toTRPC());\r\n }\r\n\r\n toTRPC(): TRPCError {\r\n return new TRPCError({\r\n code: this.code,\r\n message: this.message,\r\n cause: this.cause,\r\n });\r\n }\r\n\r\n toJSON() {\r\n return {\r\n code: this.code,\r\n layer: this.layer,\r\n layerName: this.layerName,\r\n message: this.message,\r\n context: this.context,\r\n stack: process.env.NODE_ENV !== \"production\" ? this.stack : undefined,\r\n boundaryStack: process.env.NODE_ENV !== \"production\" ? this.boundaryStack : undefined,\r\n // Shallow representation of cause to avoid cycles\r\n cause:\r\n this.cause instanceof Error\r\n ? { name: this.cause.name, message: this.cause.message, stack: this.cause.stack }\r\n : this.cause,\r\n };\r\n }\r\n\r\n static fromUnknown(\r\n code: TRPC_ERROR_CODE_KEY,\r\n cause: unknown,\r\n opts?: { layer?: ServerErrorLayer; layerName?: string; context?: Record<string, unknown> }\r\n ) {\r\n const msg = cause instanceof Error ? cause.message : undefined;\r\n return new ServerError({\r\n code,\r\n layer: opts?.layer,\r\n layerName: opts?.layerName,\r\n message: msg,\r\n cause,\r\n context: opts?.context,\r\n captureBoundary: true,\r\n });\r\n }\r\n}\r\n\r\nexport type ErrorReporter = {\r\n captureException: (\r\n err: Parameters<typeof captureException>[0],\r\n hint?: Parameters<typeof captureException>[1]\r\n ) => string;\r\n};\r\ndeclare global {\r\n // eslint-disable-next-line no-var\r\n var m5ErrorReporter: ErrorReporter | undefined;\r\n}\r\n\r\nexport function getErrorReporter(): ErrorReporter | undefined {\r\n return globalThis.m5ErrorReporter;\r\n}\r\n\r\nexport function setErrorReporter(reporter: ErrorReporter) {\r\n globalThis.m5ErrorReporter = reporter;\r\n}\r\n\r\nexport function reportError(\r\n err: ServerError | Error | unknown,\r\n hint?: Parameters<typeof captureException>[1]\r\n): string | undefined {\r\n let eventHint = hint;\r\n const reporter = getErrorReporter();\r\n if (!reporter) {\r\n logger.error(\"[reportError] No error reporter set!\");\r\n return;\r\n }\r\n if (err instanceof ServerError) {\r\n // Merge - don't clobber caller-provided hint\r\n eventHint = {\r\n ...hint,\r\n captureContext: {\r\n ...(hint as any)?.captureContext,\r\n extra: {\r\n ...((hint as any)?.captureContext?.extra ?? {}),\r\n layer: err.layer,\r\n layerName: err.layerName,\r\n },\r\n },\r\n };\r\n }\r\n return reporter.captureException(err, eventHint);\r\n}\r\n"],"mappings":";;;;;AAQA,IAAa,cAAb,MAAa,oBAAoB,MAAM;CACrC;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,EACV,MACA,OACA,WACA,SACA,eACA,OACA,SACA,kBAAkB,QAUjB;AAED,QAAM,WAAW,gBAAgB,MAAM,GAAG,MAAM,KAAK,IAAI,EACvD,OAAO,iBAAiB,QAAQ,QAAQ,KAAA,GACzC,CAAC;AAEF,OAAK,OAAO;AACZ,OAAK,QAAQ,SAAS;AACtB,OAAK,YAAY,aAAa;AAC9B,OAAK,gBAAgB,iBAAiB,gBAAgB,MAAM,GAAG,MAAM,KAAK;AAC1E,OAAK,UAAU;AACf,MAAI,gBAAiB,MAAK,iCAAgB,IAAI,OAAO,EAAC;AAEtD,QAAM,oBAAoB,MAAM,YAAY;AAC5C,SAAO,eAAe,MAAM,IAAI,OAAO,UAAU;;CAGnD,aAAsB;EACpB,MAAM,aAAa,KAAK,mBAAmB;AAC3C,SAAO,cAAc,OAAO,aAAa;;CAG3C,oBAA4B;AAC1B,SAAO,2BAA2B,KAAK,QAAQ,CAAC;;CAGlD,SAAoB;AAClB,SAAO,IAAI,UAAU;GACnB,MAAM,KAAK;GACX,SAAS,KAAK;GACd,OAAO,KAAK;GACb,CAAC;;CAGJ,SAAS;AACP,SAAO;GACL,MAAM,KAAK;GACX,OAAO,KAAK;GACZ,WAAW,KAAK;GAChB,SAAS,KAAK;GACd,SAAS,KAAK;GACd,OAAO,QAAQ,IAAI,aAAa,eAAe,KAAK,QAAQ,KAAA;GAC5D,eAAe,QAAQ,IAAI,aAAa,eAAe,KAAK,gBAAgB,KAAA;GAE5E,OACE,KAAK,iBAAiB,QAClB;IAAE,MAAM,KAAK,MAAM;IAAM,SAAS,KAAK,MAAM;IAAS,OAAO,KAAK,MAAM;IAAO,GAC/E,KAAK;GACZ;;CAGH,OAAO,YACL,MACA,OACA,MACA;EACA,MAAM,MAAM,iBAAiB,QAAQ,MAAM,UAAU,KAAA;AACrD,SAAO,IAAI,YAAY;GACrB;GACA,OAAO,MAAM;GACb,WAAW,MAAM;GACjB,SAAS;GACT;GACA,SAAS,MAAM;GACf,iBAAiB;GAClB,CAAC;;;AAeN,SAAgB,mBAA8C;AAC5D,QAAO,WAAW;;AAGpB,SAAgB,iBAAiB,UAAyB;AACxD,YAAW,kBAAkB;;AAG/B,SAAgB,YACd,KACA,MACoB;CACpB,IAAI,YAAY;CAChB,MAAM,WAAW,kBAAkB;AACnC,KAAI,CAAC,UAAU;AACb,SAAO,MAAM,uCAAuC;AACpD;;AAEF,KAAI,eAAe,YAEjB,aAAY;EACV,GAAG;EACH,gBAAgB;GACd,GAAI,MAAc;GAClB,OAAO;IACL,GAAK,MAAc,gBAAgB,SAAS,EAAE;IAC9C,OAAO,IAAI;IACX,WAAW,IAAI;IAChB;GACF;EACF;AAEH,QAAO,SAAS,iBAAiB,KAAK,UAAU"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.mjs","names":[],"sources":["../../../src/utils/logger.ts"],"sourcesContent":["import pino from \"pino\";\r\n\r\nexport const logger = pino({\r\n transport: {\r\n target: \"pino-pretty\",\r\n },\r\n level: \"debug\",\r\n});\r\n"],"mappings":";;AAEA,MAAa,SAAS,KAAK;CACzB,WAAW,EACT,QAAQ,eACT;CACD,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PostHog } from "posthog-node";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/posthog.d.ts
|
|
4
|
+
declare global {
|
|
5
|
+
var m5Posthog: PostHog | undefined;
|
|
6
|
+
}
|
|
7
|
+
declare function getPosthog(): PostHog | undefined;
|
|
8
|
+
declare function setPosthog(posthog: PostHog): void;
|
|
9
|
+
type PosthogRequestState = {
|
|
10
|
+
disableCapture: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function runWithPosthogRequestState<T>(state: PosthogRequestState, callback: () => T): T;
|
|
13
|
+
declare function isPosthogCaptureDisabled(): boolean;
|
|
14
|
+
declare function posthogCapture(event: Parameters<PostHog["capture"]>[0]): ReturnType<PostHog["capture"]> | undefined;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getPosthog, isPosthogCaptureDisabled, posthogCapture, runWithPosthogRequestState, setPosthog };
|
|
17
|
+
//# sourceMappingURL=posthog.d.mts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
//#region src/utils/posthog.ts
|
|
3
|
+
function getPosthog() {
|
|
4
|
+
return globalThis.m5Posthog;
|
|
5
|
+
}
|
|
6
|
+
function setPosthog(posthog) {
|
|
7
|
+
globalThis.m5Posthog = posthog;
|
|
8
|
+
}
|
|
9
|
+
const posthogRequestState = new AsyncLocalStorage();
|
|
10
|
+
function runWithPosthogRequestState(state, callback) {
|
|
11
|
+
return posthogRequestState.run(state, callback);
|
|
12
|
+
}
|
|
13
|
+
function isPosthogCaptureDisabled() {
|
|
14
|
+
return posthogRequestState.getStore()?.disableCapture ?? false;
|
|
15
|
+
}
|
|
16
|
+
function posthogCapture(event) {
|
|
17
|
+
if (isPosthogCaptureDisabled()) return;
|
|
18
|
+
const posthog = getPosthog();
|
|
19
|
+
if (!posthog) return;
|
|
20
|
+
return posthog.capture(event);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getPosthog, isPosthogCaptureDisabled, posthogCapture, runWithPosthogRequestState, setPosthog };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=posthog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posthog.mjs","names":[],"sources":["../../../src/utils/posthog.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\r\nimport type { PostHog } from \"posthog-node\";\r\n\r\ndeclare global {\r\n // eslint-disable-next-line no-var\r\n var m5Posthog: PostHog | undefined;\r\n}\r\n\r\nexport function getPosthog(): PostHog | undefined {\r\n return globalThis.m5Posthog;\r\n}\r\n\r\nexport function setPosthog(posthog: PostHog) {\r\n globalThis.m5Posthog = posthog;\r\n}\r\n\r\ntype PosthogRequestState = {\r\n disableCapture: boolean;\r\n};\r\n\r\nconst posthogRequestState = new AsyncLocalStorage<PosthogRequestState>();\r\n\r\nexport function runWithPosthogRequestState<T>(state: PosthogRequestState, callback: () => T): T {\r\n return posthogRequestState.run(state, callback);\r\n}\r\n\r\nexport function isPosthogCaptureDisabled(): boolean {\r\n return posthogRequestState.getStore()?.disableCapture ?? false;\r\n}\r\n\r\nexport function posthogCapture(\r\n event: Parameters<PostHog[\"capture\"]>[0]\r\n): ReturnType<PostHog[\"capture\"]> | undefined {\r\n if (isPosthogCaptureDisabled()) {\r\n return undefined;\r\n }\r\n\r\n const posthog = getPosthog();\r\n if (!posthog) {\r\n return undefined;\r\n }\r\n return posthog.capture(event);\r\n}\r\n"],"mappings":";;AAQA,SAAgB,aAAkC;AAChD,QAAO,WAAW;;AAGpB,SAAgB,WAAW,SAAkB;AAC3C,YAAW,YAAY;;AAOzB,MAAM,sBAAsB,IAAI,mBAAwC;AAExE,SAAgB,2BAA8B,OAA4B,UAAsB;AAC9F,QAAO,oBAAoB,IAAI,OAAO,SAAS;;AAGjD,SAAgB,2BAAoC;AAClD,QAAO,oBAAoB,UAAU,EAAE,kBAAkB;;AAG3D,SAAgB,eACd,OAC4C;AAC5C,KAAI,0BAA0B,CAC5B;CAGF,MAAM,UAAU,YAAY;AAC5B,KAAI,CAAC,QACH;AAEF,QAAO,QAAQ,QAAQ,MAAM"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ServerError } from "./errors.mjs";
|
|
2
|
+
import { BetterAuth, Session, User } from "../modules/auth/auth.lib.mjs";
|
|
3
|
+
import { OrganizationActor, TeamActor, UserActor } from "../modules/base/base.actor.mjs";
|
|
4
|
+
import { TRPCRootObject } from "@trpc/server";
|
|
5
|
+
import { Result } from "neverthrow";
|
|
6
|
+
import { transformer } from "@m5kdev/commons/utils/trpc";
|
|
7
|
+
import { CreateExpressContextOptions } from "@trpc/server/adapters/express";
|
|
8
|
+
|
|
9
|
+
//#region src/utils/trpc.d.ts
|
|
10
|
+
type RequestContext = {
|
|
11
|
+
session: Session | null;
|
|
12
|
+
user: User | null;
|
|
13
|
+
actor: UserActor | null;
|
|
14
|
+
};
|
|
15
|
+
type Context = {
|
|
16
|
+
session: Session;
|
|
17
|
+
user: User;
|
|
18
|
+
actor: UserActor;
|
|
19
|
+
};
|
|
20
|
+
type OrganizationContext = {
|
|
21
|
+
session: Session;
|
|
22
|
+
user: User;
|
|
23
|
+
actor: OrganizationActor;
|
|
24
|
+
};
|
|
25
|
+
type TeamContext = {
|
|
26
|
+
session: Session;
|
|
27
|
+
user: User;
|
|
28
|
+
actor: TeamActor;
|
|
29
|
+
};
|
|
30
|
+
type TRPCCreate = TRPCRootObject<Context, any, {
|
|
31
|
+
transformer: typeof transformer;
|
|
32
|
+
}>;
|
|
33
|
+
type TRPCMethods = {
|
|
34
|
+
router: TRPCCreate["router"];
|
|
35
|
+
publicProcedure: TRPCCreate["procedure"];
|
|
36
|
+
privateProcedure: TRPCCreate["procedure"];
|
|
37
|
+
adminProcedure: TRPCCreate["procedure"];
|
|
38
|
+
};
|
|
39
|
+
declare function createAuthContext(auth: BetterAuth): ({
|
|
40
|
+
req
|
|
41
|
+
}: CreateExpressContextOptions) => Promise<RequestContext>;
|
|
42
|
+
declare function handleAsyncTRPCResult<T>(result: Promise<Result<T, ServerError>>): Promise<T>;
|
|
43
|
+
declare function handleTRPCResult<T>(result: Result<T, ServerError>): T;
|
|
44
|
+
declare function verifyProtectedProcedureContext(ctx: RequestContext): Context;
|
|
45
|
+
declare function verifyOrganizationProcedureContext(ctx: Context): OrganizationContext;
|
|
46
|
+
declare function verifyTeamProcedureContext(ctx: Context): TeamContext;
|
|
47
|
+
declare function verifyAdminProcedureContext(ctx: RequestContext): Context;
|
|
48
|
+
declare function requireRequestUser(ctx: RequestContext): User;
|
|
49
|
+
declare function requireRequestActor(ctx: RequestContext): UserActor;
|
|
50
|
+
declare function requireRequestActor(ctx: RequestContext, scope: "organization"): OrganizationActor;
|
|
51
|
+
declare function requireRequestActor(ctx: RequestContext, scope: "team"): TeamActor;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { Context, OrganizationContext, RequestContext, TRPCMethods, TeamContext, createAuthContext, handleAsyncTRPCResult, handleTRPCResult, requireRequestActor, requireRequestUser, verifyAdminProcedureContext, verifyOrganizationProcedureContext, verifyProtectedProcedureContext, verifyTeamProcedureContext };
|
|
54
|
+
//# sourceMappingURL=trpc.d.mts.map
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { logger } from "./logger.mjs";
|
|
2
|
+
import { ServerError } from "./errors.mjs";
|
|
3
|
+
import { createActorFromContext, validateActor } from "../modules/base/base.actor.mjs";
|
|
4
|
+
import { fromNodeHeaders } from "better-auth/node";
|
|
5
|
+
//#region src/utils/trpc.ts
|
|
6
|
+
function createAuthContext(auth) {
|
|
7
|
+
return async function createContext({ req }) {
|
|
8
|
+
const data = await auth.api.getSession({ headers: fromNodeHeaders(req.headers) });
|
|
9
|
+
const user = data?.user || null;
|
|
10
|
+
const session = data?.session || null;
|
|
11
|
+
return {
|
|
12
|
+
session,
|
|
13
|
+
user,
|
|
14
|
+
actor: user && session ? createActorFromContext({
|
|
15
|
+
user,
|
|
16
|
+
session
|
|
17
|
+
}, "user") : null
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
async function handleAsyncTRPCResult(result) {
|
|
22
|
+
return handleTRPCResult(await result);
|
|
23
|
+
}
|
|
24
|
+
function handleTRPCResult(result) {
|
|
25
|
+
if (result.isErr()) {
|
|
26
|
+
logger.debug("Is tRPC Error");
|
|
27
|
+
logger.error({
|
|
28
|
+
layer: result.error.layer,
|
|
29
|
+
layerName: result.error.layerName,
|
|
30
|
+
error: result.error.toJSON()
|
|
31
|
+
});
|
|
32
|
+
throw result.error.toTRPC();
|
|
33
|
+
}
|
|
34
|
+
return result.value;
|
|
35
|
+
}
|
|
36
|
+
function verifyProtectedProcedureContext(ctx) {
|
|
37
|
+
if (!ctx.user || !ctx.session || !ctx.actor) throw new ServerError({
|
|
38
|
+
code: "UNAUTHORIZED",
|
|
39
|
+
layer: "controller",
|
|
40
|
+
layerName: "TRPCController"
|
|
41
|
+
}).toTRPC();
|
|
42
|
+
return ctx;
|
|
43
|
+
}
|
|
44
|
+
function verifyOrganizationProcedureContext(ctx) {
|
|
45
|
+
if (!ctx.user || !ctx.session) throw new ServerError({
|
|
46
|
+
code: "UNAUTHORIZED",
|
|
47
|
+
layer: "controller",
|
|
48
|
+
layerName: "TRPCController"
|
|
49
|
+
}).toTRPC();
|
|
50
|
+
try {
|
|
51
|
+
const actor = createActorFromContext({
|
|
52
|
+
user: ctx.user,
|
|
53
|
+
session: ctx.session
|
|
54
|
+
}, "organization");
|
|
55
|
+
return {
|
|
56
|
+
...ctx,
|
|
57
|
+
actor
|
|
58
|
+
};
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (e instanceof ServerError) throw e.toTRPC();
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function verifyTeamProcedureContext(ctx) {
|
|
65
|
+
if (!ctx.user || !ctx.session) throw new ServerError({
|
|
66
|
+
code: "UNAUTHORIZED",
|
|
67
|
+
layer: "controller",
|
|
68
|
+
layerName: "TRPCController"
|
|
69
|
+
}).toTRPC();
|
|
70
|
+
try {
|
|
71
|
+
const actor = createActorFromContext({
|
|
72
|
+
user: ctx.user,
|
|
73
|
+
session: ctx.session
|
|
74
|
+
}, "team");
|
|
75
|
+
return {
|
|
76
|
+
...ctx,
|
|
77
|
+
actor
|
|
78
|
+
};
|
|
79
|
+
} catch (e) {
|
|
80
|
+
if (e instanceof ServerError) throw e.toTRPC();
|
|
81
|
+
throw e;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function verifyAdminProcedureContext(ctx) {
|
|
85
|
+
if (!ctx.user || !ctx.session) throw new ServerError({
|
|
86
|
+
code: "UNAUTHORIZED",
|
|
87
|
+
layer: "controller",
|
|
88
|
+
layerName: "TRPCController"
|
|
89
|
+
}).toTRPC();
|
|
90
|
+
if (ctx.user.role !== "admin") throw new ServerError({
|
|
91
|
+
code: "FORBIDDEN",
|
|
92
|
+
layer: "controller",
|
|
93
|
+
layerName: "TRPCController"
|
|
94
|
+
}).toTRPC();
|
|
95
|
+
if (!ctx.actor) throw new ServerError({
|
|
96
|
+
code: "UNAUTHORIZED",
|
|
97
|
+
layer: "controller",
|
|
98
|
+
layerName: "TRPCController"
|
|
99
|
+
}).toTRPC();
|
|
100
|
+
return ctx;
|
|
101
|
+
}
|
|
102
|
+
function requireRequestUser(ctx) {
|
|
103
|
+
return verifyProtectedProcedureContext(ctx).user;
|
|
104
|
+
}
|
|
105
|
+
function requireRequestActor(ctx, scope = "user") {
|
|
106
|
+
const verified = verifyProtectedProcedureContext(ctx);
|
|
107
|
+
if (scope === "user") {
|
|
108
|
+
if (!validateActor(verified.actor, "user")) throw new ServerError({
|
|
109
|
+
code: "FORBIDDEN",
|
|
110
|
+
layer: "controller",
|
|
111
|
+
layerName: "TRPCController"
|
|
112
|
+
}).toTRPC();
|
|
113
|
+
return verified.actor;
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
if (scope === "organization") {
|
|
117
|
+
const actor = createActorFromContext({
|
|
118
|
+
user: verified.user,
|
|
119
|
+
session: verified.session
|
|
120
|
+
}, "organization");
|
|
121
|
+
if (!validateActor(actor, "organization")) throw new ServerError({
|
|
122
|
+
code: "FORBIDDEN",
|
|
123
|
+
layer: "controller",
|
|
124
|
+
layerName: "TRPCController"
|
|
125
|
+
}).toTRPC();
|
|
126
|
+
return actor;
|
|
127
|
+
}
|
|
128
|
+
const actor = createActorFromContext({
|
|
129
|
+
user: verified.user,
|
|
130
|
+
session: verified.session
|
|
131
|
+
}, "team");
|
|
132
|
+
if (!validateActor(actor, "team")) throw new ServerError({
|
|
133
|
+
code: "FORBIDDEN",
|
|
134
|
+
layer: "controller",
|
|
135
|
+
layerName: "TRPCController"
|
|
136
|
+
}).toTRPC();
|
|
137
|
+
return actor;
|
|
138
|
+
} catch (e) {
|
|
139
|
+
if (e instanceof ServerError) throw e.toTRPC();
|
|
140
|
+
throw e;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { createAuthContext, handleAsyncTRPCResult, handleTRPCResult, requireRequestActor, requireRequestUser, verifyAdminProcedureContext, verifyOrganizationProcedureContext, verifyProtectedProcedureContext, verifyTeamProcedureContext };
|
|
145
|
+
|
|
146
|
+
//# sourceMappingURL=trpc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trpc.mjs","names":[],"sources":["../../../src/utils/trpc.ts"],"sourcesContent":["import type { transformer } from \"@m5kdev/commons/utils/trpc\";\r\nimport type { TRPCRootObject } from \"@trpc/server\";\r\nimport type { CreateExpressContextOptions } from \"@trpc/server/adapters/express\";\r\nimport { fromNodeHeaders } from \"better-auth/node\";\r\nimport type { Result } from \"neverthrow\";\r\nimport type { BetterAuth, Session, User } from \"../modules/auth/auth.lib\";\r\nimport {\r\n createActorFromContext,\r\n validateActor,\r\n type ActorScope,\r\n type AuthenticatedActor,\r\n type OrganizationActor,\r\n type TeamActor,\r\n type UserActor,\r\n} from \"../modules/base/base.actor\";\r\nimport { ServerError } from \"./errors\";\r\nimport { logger } from \"./logger\";\r\n\r\nexport type RequestContext = {\r\n session: Session | null;\r\n user: User | null;\r\n actor: UserActor | null;\r\n};\r\n\r\nexport type Context = {\r\n session: Session;\r\n user: User;\r\n actor: UserActor;\r\n};\r\n\r\nexport type OrganizationContext = {\r\n session: Session;\r\n user: User;\r\n actor: OrganizationActor;\r\n};\r\n\r\nexport type TeamContext = {\r\n session: Session;\r\n user: User;\r\n actor: TeamActor;\r\n};\r\n\r\ntype TRPCCreate = TRPCRootObject<Context, any, { transformer: typeof transformer }>;\r\n\r\nexport type TRPCMethods = {\r\n router: TRPCCreate[\"router\"];\r\n publicProcedure: TRPCCreate[\"procedure\"];\r\n privateProcedure: TRPCCreate[\"procedure\"];\r\n adminProcedure: TRPCCreate[\"procedure\"];\r\n};\r\n\r\nexport function createAuthContext(auth: BetterAuth) {\r\n return async function createContext({ req }: CreateExpressContextOptions): Promise<RequestContext> {\r\n const data = await auth.api.getSession({\r\n headers: fromNodeHeaders(req.headers),\r\n });\r\n\r\n const user = (data?.user as User) || null;\r\n const session = (data?.session as Session) || null;\r\n const actor =\r\n user && session ? createActorFromContext({ user, session }, \"user\") : null;\r\n\r\n return {\r\n session,\r\n user,\r\n actor,\r\n };\r\n };\r\n}\r\n\r\nexport async function handleAsyncTRPCResult<T>(result: Promise<Result<T, ServerError>>) {\r\n return handleTRPCResult(await result);\r\n}\r\n\r\nexport function handleTRPCResult<T>(result: Result<T, ServerError>) {\r\n if (result.isErr()) {\r\n logger.debug(\"Is tRPC Error\");\r\n logger.error({\r\n layer: result.error.layer,\r\n layerName: result.error.layerName,\r\n error: result.error.toJSON(),\r\n });\r\n throw result.error.toTRPC();\r\n }\r\n return result.value;\r\n}\r\n\r\nexport function verifyProtectedProcedureContext(ctx: RequestContext): Context {\r\n if (!ctx.user || !ctx.session || !ctx.actor) {\r\n throw new ServerError({\r\n code: \"UNAUTHORIZED\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n return ctx as Context;\r\n}\r\n\r\nexport function verifyOrganizationProcedureContext(ctx: Context): OrganizationContext {\r\n if (!ctx.user || !ctx.session) {\r\n throw new ServerError({\r\n code: \"UNAUTHORIZED\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n try {\r\n const actor = createActorFromContext({ user: ctx.user, session: ctx.session }, \"organization\");\r\n return { ...ctx, actor };\r\n } catch (e) {\r\n if (e instanceof ServerError) throw e.toTRPC();\r\n throw e;\r\n }\r\n}\r\n\r\nexport function verifyTeamProcedureContext(ctx: Context): TeamContext {\r\n if (!ctx.user || !ctx.session) {\r\n throw new ServerError({\r\n code: \"UNAUTHORIZED\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n try {\r\n const actor = createActorFromContext({ user: ctx.user, session: ctx.session }, \"team\");\r\n return { ...ctx, actor };\r\n } catch (e) {\r\n if (e instanceof ServerError) throw e.toTRPC();\r\n throw e;\r\n }\r\n}\r\n\r\nexport function verifyAdminProcedureContext(ctx: RequestContext): Context {\r\n if (!ctx.user || !ctx.session) {\r\n throw new ServerError({\r\n code: \"UNAUTHORIZED\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n\r\n if (ctx.user.role !== \"admin\") {\r\n throw new ServerError({\r\n code: \"FORBIDDEN\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n if (!ctx.actor) {\r\n throw new ServerError({\r\n code: \"UNAUTHORIZED\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n return ctx as Context;\r\n}\r\n\r\nexport function requireRequestUser(ctx: RequestContext): User {\r\n return verifyProtectedProcedureContext(ctx).user;\r\n}\r\n\r\nexport function requireRequestActor(ctx: RequestContext): UserActor;\r\nexport function requireRequestActor(ctx: RequestContext, scope: \"organization\"): OrganizationActor;\r\nexport function requireRequestActor(ctx: RequestContext, scope: \"team\"): TeamActor;\r\nexport function requireRequestActor(\r\n ctx: RequestContext,\r\n scope: ActorScope = \"user\"\r\n): AuthenticatedActor {\r\n const verified = verifyProtectedProcedureContext(ctx);\r\n\r\n if (scope === \"user\") {\r\n if (!validateActor(verified.actor, \"user\")) {\r\n throw new ServerError({\r\n code: \"FORBIDDEN\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n return verified.actor;\r\n }\r\n\r\n try {\r\n if (scope === \"organization\") {\r\n const actor = createActorFromContext(\r\n { user: verified.user, session: verified.session },\r\n \"organization\"\r\n );\r\n if (!validateActor(actor, \"organization\")) {\r\n throw new ServerError({\r\n code: \"FORBIDDEN\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n return actor;\r\n }\r\n\r\n const actor = createActorFromContext(\r\n { user: verified.user, session: verified.session },\r\n \"team\"\r\n );\r\n if (!validateActor(actor, \"team\")) {\r\n throw new ServerError({\r\n code: \"FORBIDDEN\",\r\n layer: \"controller\",\r\n layerName: \"TRPCController\",\r\n }).toTRPC();\r\n }\r\n return actor;\r\n } catch (e) {\r\n if (e instanceof ServerError) throw e.toTRPC();\r\n throw e;\r\n }\r\n}\r\n"],"mappings":";;;;;AAmDA,SAAgB,kBAAkB,MAAkB;AAClD,QAAO,eAAe,cAAc,EAAE,OAA6D;EACjG,MAAM,OAAO,MAAM,KAAK,IAAI,WAAW,EACrC,SAAS,gBAAgB,IAAI,QAAQ,EACtC,CAAC;EAEF,MAAM,OAAQ,MAAM,QAAiB;EACrC,MAAM,UAAW,MAAM,WAAuB;AAI9C,SAAO;GACL;GACA;GACA,OALA,QAAQ,UAAU,uBAAuB;IAAE;IAAM;IAAS,EAAE,OAAO,GAAG;GAMvE;;;AAIL,eAAsB,sBAAyB,QAAyC;AACtF,QAAO,iBAAiB,MAAM,OAAO;;AAGvC,SAAgB,iBAAoB,QAAgC;AAClE,KAAI,OAAO,OAAO,EAAE;AAClB,SAAO,MAAM,gBAAgB;AAC7B,SAAO,MAAM;GACX,OAAO,OAAO,MAAM;GACpB,WAAW,OAAO,MAAM;GACxB,OAAO,OAAO,MAAM,QAAQ;GAC7B,CAAC;AACF,QAAM,OAAO,MAAM,QAAQ;;AAE7B,QAAO,OAAO;;AAGhB,SAAgB,gCAAgC,KAA8B;AAC5E,KAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,WAAW,CAAC,IAAI,MACpC,OAAM,IAAI,YAAY;EACpB,MAAM;EACN,OAAO;EACP,WAAW;EACZ,CAAC,CAAC,QAAQ;AAEb,QAAO;;AAGT,SAAgB,mCAAmC,KAAmC;AACpF,KAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,QACpB,OAAM,IAAI,YAAY;EACpB,MAAM;EACN,OAAO;EACP,WAAW;EACZ,CAAC,CAAC,QAAQ;AAEb,KAAI;EACF,MAAM,QAAQ,uBAAuB;GAAE,MAAM,IAAI;GAAM,SAAS,IAAI;GAAS,EAAE,eAAe;AAC9F,SAAO;GAAE,GAAG;GAAK;GAAO;UACjB,GAAG;AACV,MAAI,aAAa,YAAa,OAAM,EAAE,QAAQ;AAC9C,QAAM;;;AAIV,SAAgB,2BAA2B,KAA2B;AACpE,KAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,QACpB,OAAM,IAAI,YAAY;EACpB,MAAM;EACN,OAAO;EACP,WAAW;EACZ,CAAC,CAAC,QAAQ;AAEb,KAAI;EACF,MAAM,QAAQ,uBAAuB;GAAE,MAAM,IAAI;GAAM,SAAS,IAAI;GAAS,EAAE,OAAO;AACtF,SAAO;GAAE,GAAG;GAAK;GAAO;UACjB,GAAG;AACV,MAAI,aAAa,YAAa,OAAM,EAAE,QAAQ;AAC9C,QAAM;;;AAIV,SAAgB,4BAA4B,KAA8B;AACxE,KAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,QACpB,OAAM,IAAI,YAAY;EACpB,MAAM;EACN,OAAO;EACP,WAAW;EACZ,CAAC,CAAC,QAAQ;AAGb,KAAI,IAAI,KAAK,SAAS,QACpB,OAAM,IAAI,YAAY;EACpB,MAAM;EACN,OAAO;EACP,WAAW;EACZ,CAAC,CAAC,QAAQ;AAEb,KAAI,CAAC,IAAI,MACP,OAAM,IAAI,YAAY;EACpB,MAAM;EACN,OAAO;EACP,WAAW;EACZ,CAAC,CAAC,QAAQ;AAEb,QAAO;;AAGT,SAAgB,mBAAmB,KAA2B;AAC5D,QAAO,gCAAgC,IAAI,CAAC;;AAM9C,SAAgB,oBACd,KACA,QAAoB,QACA;CACpB,MAAM,WAAW,gCAAgC,IAAI;AAErD,KAAI,UAAU,QAAQ;AACpB,MAAI,CAAC,cAAc,SAAS,OAAO,OAAO,CACxC,OAAM,IAAI,YAAY;GACpB,MAAM;GACN,OAAO;GACP,WAAW;GACZ,CAAC,CAAC,QAAQ;AAEb,SAAO,SAAS;;AAGlB,KAAI;AACF,MAAI,UAAU,gBAAgB;GAC5B,MAAM,QAAQ,uBACZ;IAAE,MAAM,SAAS;IAAM,SAAS,SAAS;IAAS,EAClD,eACD;AACD,OAAI,CAAC,cAAc,OAAO,eAAe,CACvC,OAAM,IAAI,YAAY;IACpB,MAAM;IACN,OAAO;IACP,WAAW;IACZ,CAAC,CAAC,QAAQ;AAEb,UAAO;;EAGT,MAAM,QAAQ,uBACZ;GAAE,MAAM,SAAS;GAAM,SAAS,SAAS;GAAS,EAClD,OACD;AACD,MAAI,CAAC,cAAc,OAAO,OAAO,CAC/B,OAAM,IAAI,YAAY;GACpB,MAAM;GACN,OAAO;GACP,WAAW;GACZ,CAAC,CAAC,QAAQ;AAEb,SAAO;UACA,GAAG;AACV,MAAI,aAAa,YAAa,OAAM,EAAE,QAAQ;AAC9C,QAAM"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ServerError } from "./errors.mjs";
|
|
2
|
+
import { Result } from "neverthrow";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/types.d.ts
|
|
5
|
+
type ServerResult<T> = Result<T, ServerError>;
|
|
6
|
+
type ServerResultAsync<T> = Promise<ServerResult<T>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ServerResult, ServerResultAsync };
|
|
9
|
+
//# sourceMappingURL=types.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m5kdev/backend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Composable Express server stack with Drizzle ORM and tRPC.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"trpc-to-openapi": "2.3.0",
|
|
60
60
|
"uuid": "11.0.5",
|
|
61
61
|
"zod": "4.2.1",
|
|
62
|
-
"@m5kdev/commons": "0.
|
|
63
|
-
"@m5kdev/config": "0.
|
|
62
|
+
"@m5kdev/commons": "0.8.0",
|
|
63
|
+
"@m5kdev/config": "0.8.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@jest/globals": "30.2.0",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
"jest": "30.1.3",
|
|
79
79
|
"ts-jest": "29.4.4",
|
|
80
80
|
"tslib": "2.8.1",
|
|
81
|
+
"tsdown": "0.21.7",
|
|
81
82
|
"tsup": "8.4.0",
|
|
82
83
|
"tsx": "4.19.2",
|
|
83
84
|
"typescript": "5.9.2"
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
"scripts": {
|
|
172
173
|
"lint": "biome check .",
|
|
173
174
|
"lint:fix": "biome check . --write",
|
|
174
|
-
"build": "
|
|
175
|
+
"build": "tsdown",
|
|
175
176
|
"check-types": "tsc --noEmit",
|
|
176
177
|
"test": "jest -c jest.config.ts",
|
|
177
178
|
"test:watch": "jest -c jest.config.ts --watch"
|
package/dist/src/lib/posthog.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.posthogClient = void 0;
|
|
4
|
-
const posthog_node_1 = require("posthog-node");
|
|
5
|
-
exports.posthogClient = new posthog_node_1.PostHog(process.env.VITE_PUBLIC_POSTHOG_KEY, {
|
|
6
|
-
host: process.env.VITE_PUBLIC_POSTHOG_HOST,
|
|
7
|
-
});
|
package/dist/src/lib/sentry.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const Sentry = tslib_1.__importStar(require("@sentry/node"));
|
|
5
|
-
Sentry.init({
|
|
6
|
-
dsn: process.env.SENTRY_SERVER_DNS,
|
|
7
|
-
// Set sampling rate for profiling - this is evaluated only once per SDK.init
|
|
8
|
-
profileSessionSampleRate: 1.0,
|
|
9
|
-
});
|