@m5kdev/backend 0.7.0 → 0.8.2
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 +129 -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 +48 -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 +87 -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 +215 -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 +120 -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 +173 -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 +68 -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 +65 -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 +344 -0
- package/dist/src/types.mjs +11 -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 +47 -46
- package/dist/src/lib/posthog.d.ts +0 -2
- package/dist/src/lib/posthog.js +0 -7
- package/dist/src/lib/sentry.d.ts +0 -1
- 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.d.ts +0 -1
- 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 -125
- 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 -4869
- 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 -78
- package/dist/src/modules/auth/auth.service.js +0 -259
- 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.actor.d.ts +0 -68
- package/dist/src/modules/base/base.actor.js +0 -99
- package/dist/src/modules/base/base.actor.test.js +0 -58
- 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 -24
- package/dist/src/modules/base/base.grants.js +0 -135
- package/dist/src/modules/base/base.grants.test.js +0 -639
- package/dist/src/modules/base/base.procedure.d.ts +0 -109
- package/dist/src/modules/base/base.procedure.js +0 -301
- 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 -40
- package/dist/src/modules/base/base.service.js +0 -123
- package/dist/src/modules/base/base.service.test.js +0 -443
- 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 -38
- 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 -15
- 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 -96
- package/dist/src/modules/connect/connect.service.js +0 -116
- 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 -80
- package/dist/src/modules/recurrence/recurrence.service.js +0 -72
- 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 -27
- 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 -113
- 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 -61
- 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 -48
- package/dist/src/utils/trpc.js +0 -158
- package/dist/src/utils/trpc.test.js +0 -154
- 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/{utils/trpc.test.d.ts → modules/ai/ai.router.mjs} +0 -0
- /package/dist/src/modules/{social/social.linkedin.test.d.ts → base/base.types.mjs} +0 -0
- /package/dist/src/modules/{base/base.service.test.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.actor.test.d.ts → workflow/workflow.types.mjs} +0 -0
- /package/dist/src/{modules/ai/ai.router.d.ts → utils/types.mjs} +0 -0
|
@@ -1,636 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthRepository = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const drizzle_orm_1 = require("drizzle-orm");
|
|
6
|
-
const neverthrow_1 = require("neverthrow");
|
|
7
|
-
const uuid_1 = require("uuid");
|
|
8
|
-
const base_repository_1 = require("../base/base.repository");
|
|
9
|
-
const auth = tslib_1.__importStar(require("./auth.db"));
|
|
10
|
-
const schema = { ...auth };
|
|
11
|
-
function parseOrganizationMetadata(metadata) {
|
|
12
|
-
if (!metadata)
|
|
13
|
-
return {};
|
|
14
|
-
if (typeof metadata === "string") {
|
|
15
|
-
try {
|
|
16
|
-
const parsed = JSON.parse(metadata);
|
|
17
|
-
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
18
|
-
return parsed;
|
|
19
|
-
}
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return {};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (typeof metadata === "object" && !Array.isArray(metadata)) {
|
|
27
|
-
return metadata;
|
|
28
|
-
}
|
|
29
|
-
return {};
|
|
30
|
-
}
|
|
31
|
-
function normalizeOrganizationPreferences(value) {
|
|
32
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
33
|
-
return value;
|
|
34
|
-
}
|
|
35
|
-
return {};
|
|
36
|
-
}
|
|
37
|
-
function normalizeOrganizationFlags(value) {
|
|
38
|
-
if (!Array.isArray(value))
|
|
39
|
-
return [];
|
|
40
|
-
return value.filter((item) => typeof item === "string");
|
|
41
|
-
}
|
|
42
|
-
class AuthRepository extends base_repository_1.BaseRepository {
|
|
43
|
-
async getOrganizationMetadataForMember(userId, organizationId, tx) {
|
|
44
|
-
const db = tx ?? this.orm;
|
|
45
|
-
const [organization] = await db
|
|
46
|
-
.select({ metadata: this.schema.organizations.metadata })
|
|
47
|
-
.from(this.schema.organizations)
|
|
48
|
-
.innerJoin(this.schema.members, (0, drizzle_orm_1.eq)(this.schema.members.organizationId, this.schema.organizations.id))
|
|
49
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.organizations.id, organizationId), (0, drizzle_orm_1.eq)(this.schema.members.userId, userId)))
|
|
50
|
-
.limit(1);
|
|
51
|
-
if (!organization)
|
|
52
|
-
return null;
|
|
53
|
-
return parseOrganizationMetadata(organization.metadata);
|
|
54
|
-
}
|
|
55
|
-
async getUserWaitlistCount(userId, tx) {
|
|
56
|
-
return this.throwableAsync(async () => {
|
|
57
|
-
const db = tx ?? this.orm;
|
|
58
|
-
const [waitlist] = await db
|
|
59
|
-
.select({ count: (0, drizzle_orm_1.count)() })
|
|
60
|
-
.from(this.schema.waitlist)
|
|
61
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.userId, userId));
|
|
62
|
-
return (0, neverthrow_1.ok)(waitlist.count ?? 0);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
async getOnboarding(userId, tx) {
|
|
66
|
-
return this.throwableAsync(async () => {
|
|
67
|
-
const db = tx ?? this.orm;
|
|
68
|
-
const [user] = await db
|
|
69
|
-
.select({ onboarding: this.schema.users.onboarding })
|
|
70
|
-
.from(this.schema.users)
|
|
71
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId))
|
|
72
|
-
.limit(1);
|
|
73
|
-
if (!user)
|
|
74
|
-
return this.error("FORBIDDEN");
|
|
75
|
-
return (0, neverthrow_1.ok)(user.onboarding ?? 0);
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
async setOnboarding(userId, onboarding, tx) {
|
|
79
|
-
return this.throwableAsync(async () => {
|
|
80
|
-
const db = tx ?? this.orm;
|
|
81
|
-
await db
|
|
82
|
-
.update(this.schema.users)
|
|
83
|
-
.set({ onboarding })
|
|
84
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId));
|
|
85
|
-
return (0, neverthrow_1.ok)(onboarding);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async getPreferences(userId, tx) {
|
|
89
|
-
return this.throwableAsync(async () => {
|
|
90
|
-
const db = tx ?? this.orm;
|
|
91
|
-
const [user] = await db
|
|
92
|
-
.select({ preferences: this.schema.users.preferences })
|
|
93
|
-
.from(this.schema.users)
|
|
94
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId))
|
|
95
|
-
.limit(1);
|
|
96
|
-
if (!user)
|
|
97
|
-
return this.error("FORBIDDEN");
|
|
98
|
-
const json = user.preferences
|
|
99
|
-
? JSON.parse(user.preferences)
|
|
100
|
-
: {};
|
|
101
|
-
return (0, neverthrow_1.ok)(json);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
async setPreferences(userId, preferences, tx) {
|
|
105
|
-
return this.throwableAsync(async () => {
|
|
106
|
-
const db = tx ?? this.orm;
|
|
107
|
-
await db
|
|
108
|
-
.update(this.schema.users)
|
|
109
|
-
.set({ preferences: JSON.stringify(preferences) })
|
|
110
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId));
|
|
111
|
-
return (0, neverthrow_1.ok)(preferences);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
async getOrganizationPreferences(userId, organizationId, tx) {
|
|
115
|
-
return this.throwableAsync(async () => {
|
|
116
|
-
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
117
|
-
if (!metadata)
|
|
118
|
-
return this.error("FORBIDDEN");
|
|
119
|
-
return (0, neverthrow_1.ok)(normalizeOrganizationPreferences(metadata.preferences));
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
async setOrganizationPreferences(userId, organizationId, preferences, tx) {
|
|
123
|
-
return this.throwableAsync(async () => {
|
|
124
|
-
const db = tx ?? this.orm;
|
|
125
|
-
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
126
|
-
if (!metadata)
|
|
127
|
-
return this.error("FORBIDDEN");
|
|
128
|
-
await db
|
|
129
|
-
.update(this.schema.organizations)
|
|
130
|
-
.set({
|
|
131
|
-
metadata: JSON.stringify({
|
|
132
|
-
...metadata,
|
|
133
|
-
preferences,
|
|
134
|
-
}),
|
|
135
|
-
})
|
|
136
|
-
.where((0, drizzle_orm_1.eq)(this.schema.organizations.id, organizationId));
|
|
137
|
-
return (0, neverthrow_1.ok)(preferences);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
async getMetadata(userId, tx) {
|
|
141
|
-
return this.throwableAsync(async () => {
|
|
142
|
-
const db = tx ?? this.orm;
|
|
143
|
-
const [user] = await db
|
|
144
|
-
.select({ metadata: this.schema.users.metadata })
|
|
145
|
-
.from(this.schema.users)
|
|
146
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId))
|
|
147
|
-
.limit(1);
|
|
148
|
-
if (!user)
|
|
149
|
-
return this.error("FORBIDDEN");
|
|
150
|
-
return (0, neverthrow_1.ok)(user.metadata);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
async setMetadata(userId, metadata, tx) {
|
|
154
|
-
return this.throwableAsync(async () => {
|
|
155
|
-
const db = tx ?? this.orm;
|
|
156
|
-
const [user] = await db
|
|
157
|
-
.select({ metadata: this.schema.users.metadata })
|
|
158
|
-
.from(this.schema.users)
|
|
159
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId))
|
|
160
|
-
.limit(1);
|
|
161
|
-
if (!user)
|
|
162
|
-
return this.error("FORBIDDEN");
|
|
163
|
-
await db
|
|
164
|
-
.update(this.schema.users)
|
|
165
|
-
.set({
|
|
166
|
-
metadata: {
|
|
167
|
-
...user.metadata,
|
|
168
|
-
...metadata,
|
|
169
|
-
},
|
|
170
|
-
})
|
|
171
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId));
|
|
172
|
-
return (0, neverthrow_1.ok)(metadata);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
async getFlags(userId, tx) {
|
|
176
|
-
return this.throwableAsync(async () => {
|
|
177
|
-
const db = tx ?? this.orm;
|
|
178
|
-
const [user] = await db
|
|
179
|
-
.select({ flags: this.schema.users.flags })
|
|
180
|
-
.from(this.schema.users)
|
|
181
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId))
|
|
182
|
-
.limit(1);
|
|
183
|
-
if (!user)
|
|
184
|
-
return this.error("FORBIDDEN");
|
|
185
|
-
const json = user.flags ? JSON.parse(user.flags) : [];
|
|
186
|
-
return (0, neverthrow_1.ok)(json);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
async getOrganizationFlags(userId, organizationId, tx) {
|
|
190
|
-
return this.throwableAsync(async () => {
|
|
191
|
-
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
192
|
-
if (!metadata)
|
|
193
|
-
return this.error("FORBIDDEN");
|
|
194
|
-
return (0, neverthrow_1.ok)(normalizeOrganizationFlags(metadata.flags));
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
async setFlags(userId, flags, tx) {
|
|
198
|
-
return this.throwableAsync(async () => {
|
|
199
|
-
const db = tx ?? this.orm;
|
|
200
|
-
await db
|
|
201
|
-
.update(this.schema.users)
|
|
202
|
-
.set({ flags: JSON.stringify(flags) })
|
|
203
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId));
|
|
204
|
-
return (0, neverthrow_1.ok)(flags);
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
async setOrganizationFlags(userId, organizationId, flags, tx) {
|
|
208
|
-
return this.throwableAsync(async () => {
|
|
209
|
-
const db = tx ?? this.orm;
|
|
210
|
-
const metadata = await this.getOrganizationMetadataForMember(userId, organizationId, tx);
|
|
211
|
-
if (!metadata)
|
|
212
|
-
return this.error("FORBIDDEN");
|
|
213
|
-
await db
|
|
214
|
-
.update(this.schema.organizations)
|
|
215
|
-
.set({
|
|
216
|
-
metadata: JSON.stringify({
|
|
217
|
-
...metadata,
|
|
218
|
-
flags,
|
|
219
|
-
}),
|
|
220
|
-
})
|
|
221
|
-
.where((0, drizzle_orm_1.eq)(this.schema.organizations.id, organizationId));
|
|
222
|
-
return (0, neverthrow_1.ok)(flags);
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
async listAdminWaitlist(tx) {
|
|
226
|
-
return this.throwableAsync(async () => {
|
|
227
|
-
const db = tx ?? this.orm;
|
|
228
|
-
const waitlist = await db
|
|
229
|
-
.select({
|
|
230
|
-
id: this.schema.waitlist.id,
|
|
231
|
-
name: this.schema.waitlist.name,
|
|
232
|
-
email: this.schema.waitlist.email,
|
|
233
|
-
createdAt: this.schema.waitlist.createdAt,
|
|
234
|
-
updatedAt: this.schema.waitlist.updatedAt,
|
|
235
|
-
status: this.schema.waitlist.status,
|
|
236
|
-
})
|
|
237
|
-
.from(this.schema.waitlist)
|
|
238
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.type, "WAITLIST"))
|
|
239
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.waitlist.createdAt));
|
|
240
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
async listWaitlist(userId, tx) {
|
|
244
|
-
return this.throwableAsync(async () => {
|
|
245
|
-
const db = tx ?? this.orm;
|
|
246
|
-
const waitlist = await db
|
|
247
|
-
.select()
|
|
248
|
-
.from(this.schema.waitlist)
|
|
249
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.userId, userId), (0, drizzle_orm_1.eq)(this.schema.waitlist.type, "WAITLIST")));
|
|
250
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
async addToWaitlist(email, tx) {
|
|
254
|
-
return this.throwableAsync(async () => {
|
|
255
|
-
const db = tx ?? this.orm;
|
|
256
|
-
const [waitlist] = await db.insert(this.schema.waitlist).values({ email }).returning();
|
|
257
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
async inviteFromWaitlist(id, tx) {
|
|
261
|
-
return this.throwableAsync(async () => {
|
|
262
|
-
const db = tx ?? this.orm;
|
|
263
|
-
const [waitlist] = await db
|
|
264
|
-
.update(this.schema.waitlist)
|
|
265
|
-
.set({
|
|
266
|
-
status: "INVITED",
|
|
267
|
-
code: (0, uuid_1.v4)(),
|
|
268
|
-
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24 * 14),
|
|
269
|
-
})
|
|
270
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.id, id))
|
|
271
|
-
.returning();
|
|
272
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
async inviteToWaitlist({ email, userId, name }, tx) {
|
|
276
|
-
return this.throwableAsync(async () => {
|
|
277
|
-
const db = tx ?? this.orm;
|
|
278
|
-
const [waitlist] = await db
|
|
279
|
-
.insert(this.schema.waitlist)
|
|
280
|
-
.values({
|
|
281
|
-
email,
|
|
282
|
-
name,
|
|
283
|
-
status: "INVITED",
|
|
284
|
-
code: (0, uuid_1.v4)(),
|
|
285
|
-
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24),
|
|
286
|
-
userId: userId,
|
|
287
|
-
})
|
|
288
|
-
.returning();
|
|
289
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
async createInvitationCode({ userId, name }, tx) {
|
|
293
|
-
return this.throwableAsync(async () => {
|
|
294
|
-
const db = tx ?? this.orm;
|
|
295
|
-
const [waitlist] = await db
|
|
296
|
-
.insert(this.schema.waitlist)
|
|
297
|
-
.values({
|
|
298
|
-
name,
|
|
299
|
-
status: "INVITED",
|
|
300
|
-
code: (0, uuid_1.v4)(),
|
|
301
|
-
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * 24),
|
|
302
|
-
userId: userId,
|
|
303
|
-
})
|
|
304
|
-
.returning();
|
|
305
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
async joinWaitlist(email, tx) {
|
|
309
|
-
return this.throwableAsync(async () => {
|
|
310
|
-
const db = tx ?? this.orm;
|
|
311
|
-
const [waitlist] = await db.insert(this.schema.waitlist).values({ email }).returning();
|
|
312
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
async removeFromWaitlist(id, tx) {
|
|
316
|
-
return this.throwableAsync(async () => {
|
|
317
|
-
const db = tx ?? this.orm;
|
|
318
|
-
const [waitlist] = await db
|
|
319
|
-
.update(this.schema.waitlist)
|
|
320
|
-
.set({ status: "REMOVED" })
|
|
321
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.id, id))
|
|
322
|
-
.returning();
|
|
323
|
-
return (0, neverthrow_1.ok)(waitlist);
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
async validateWaitlistCode(code, tx) {
|
|
327
|
-
return this.throwableAsync(async () => {
|
|
328
|
-
const db = tx ?? this.orm;
|
|
329
|
-
const [waitlist] = await db
|
|
330
|
-
.select()
|
|
331
|
-
.from(this.schema.waitlist)
|
|
332
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.code, code), (0, drizzle_orm_1.eq)(this.schema.waitlist.type, "WAITLIST")))
|
|
333
|
-
.limit(1);
|
|
334
|
-
if (!waitlist)
|
|
335
|
-
return (0, neverthrow_1.ok)({ status: "NOT_FOUND" });
|
|
336
|
-
if (waitlist.expiresAt && waitlist.expiresAt < new Date())
|
|
337
|
-
return (0, neverthrow_1.ok)({ status: "EXPIRED" });
|
|
338
|
-
if (waitlist.status !== "INVITED")
|
|
339
|
-
return (0, neverthrow_1.ok)({ status: "INVALID" });
|
|
340
|
-
return (0, neverthrow_1.ok)({ status: "VALID" });
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
async createAccountClaimCode({ userId, expiresInHours = 24 * 14 }, tx) {
|
|
344
|
-
return this.throwableAsync(async () => {
|
|
345
|
-
const db = tx ?? this.orm;
|
|
346
|
-
const [claim] = await db
|
|
347
|
-
.insert(this.schema.waitlist)
|
|
348
|
-
.values({
|
|
349
|
-
type: "ACCOUNT_CLAIM",
|
|
350
|
-
claimUserId: userId,
|
|
351
|
-
code: (0, uuid_1.v4)(),
|
|
352
|
-
status: "INVITED",
|
|
353
|
-
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * expiresInHours),
|
|
354
|
-
})
|
|
355
|
-
.returning();
|
|
356
|
-
return (0, neverthrow_1.ok)(claim);
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
async createClaimableProvisionedUser({ name, email, metadata = {}, onboarding = 0, role = "user", expiresInHours = 24 * 14, }) {
|
|
360
|
-
return this.throwableAsync(async () => {
|
|
361
|
-
const normalizedEmail = email.toLowerCase();
|
|
362
|
-
const [existingUser] = await this.orm
|
|
363
|
-
.select({ id: this.schema.users.id })
|
|
364
|
-
.from(this.schema.users)
|
|
365
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.email, normalizedEmail))
|
|
366
|
-
.limit(1);
|
|
367
|
-
if (existingUser) {
|
|
368
|
-
return this.error("CONFLICT", "Email already in use");
|
|
369
|
-
}
|
|
370
|
-
const created = await this.orm.transaction(async (tx) => {
|
|
371
|
-
const [user] = await tx
|
|
372
|
-
.insert(this.schema.users)
|
|
373
|
-
.values({
|
|
374
|
-
name,
|
|
375
|
-
email: normalizedEmail,
|
|
376
|
-
emailVerified: false,
|
|
377
|
-
role,
|
|
378
|
-
onboarding,
|
|
379
|
-
metadata,
|
|
380
|
-
})
|
|
381
|
-
.returning();
|
|
382
|
-
if (!user)
|
|
383
|
-
throw new Error("Failed to create user");
|
|
384
|
-
const organizationId = (0, uuid_1.v4)();
|
|
385
|
-
const [organization] = await tx
|
|
386
|
-
.insert(this.schema.organizations)
|
|
387
|
-
.values({
|
|
388
|
-
id: organizationId,
|
|
389
|
-
name: organizationId,
|
|
390
|
-
slug: organizationId,
|
|
391
|
-
})
|
|
392
|
-
.returning();
|
|
393
|
-
if (!organization)
|
|
394
|
-
throw new Error("Failed to create organization");
|
|
395
|
-
const [member] = await tx
|
|
396
|
-
.insert(this.schema.members)
|
|
397
|
-
.values({
|
|
398
|
-
userId: user.id,
|
|
399
|
-
organizationId: organization.id,
|
|
400
|
-
role: "owner",
|
|
401
|
-
})
|
|
402
|
-
.returning();
|
|
403
|
-
if (!member)
|
|
404
|
-
throw new Error("Failed to create organization membership");
|
|
405
|
-
const [team] = await tx
|
|
406
|
-
.insert(this.schema.teams)
|
|
407
|
-
.values({
|
|
408
|
-
name: organization.id,
|
|
409
|
-
organizationId: organization.id,
|
|
410
|
-
})
|
|
411
|
-
.returning();
|
|
412
|
-
if (!team)
|
|
413
|
-
throw new Error("Failed to create team");
|
|
414
|
-
const [teamMember] = await tx
|
|
415
|
-
.insert(this.schema.teamMembers)
|
|
416
|
-
.values({
|
|
417
|
-
userId: user.id,
|
|
418
|
-
teamId: team.id,
|
|
419
|
-
role: "owner",
|
|
420
|
-
})
|
|
421
|
-
.returning();
|
|
422
|
-
if (!teamMember)
|
|
423
|
-
throw new Error("Failed to create team membership");
|
|
424
|
-
const [claim] = await tx
|
|
425
|
-
.insert(this.schema.waitlist)
|
|
426
|
-
.values({
|
|
427
|
-
type: "ACCOUNT_CLAIM",
|
|
428
|
-
claimUserId: user.id,
|
|
429
|
-
code: (0, uuid_1.v4)(),
|
|
430
|
-
status: "INVITED",
|
|
431
|
-
expiresAt: new Date(Date.now() + 1000 * 60 * 60 * expiresInHours),
|
|
432
|
-
})
|
|
433
|
-
.returning();
|
|
434
|
-
if (!claim)
|
|
435
|
-
throw new Error("Failed to create account claim");
|
|
436
|
-
return { user, claim };
|
|
437
|
-
});
|
|
438
|
-
return (0, neverthrow_1.ok)(created);
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
async listAccountClaims(tx) {
|
|
442
|
-
return this.throwableAsync(async () => {
|
|
443
|
-
const db = tx ?? this.orm;
|
|
444
|
-
const claims = await db
|
|
445
|
-
.select({
|
|
446
|
-
id: this.schema.waitlist.id,
|
|
447
|
-
claimUserId: this.schema.waitlist.claimUserId,
|
|
448
|
-
status: this.schema.waitlist.status,
|
|
449
|
-
expiresAt: this.schema.waitlist.expiresAt,
|
|
450
|
-
claimedAt: this.schema.waitlist.claimedAt,
|
|
451
|
-
claimedEmail: this.schema.waitlist.claimedEmail,
|
|
452
|
-
createdAt: this.schema.waitlist.createdAt,
|
|
453
|
-
updatedAt: this.schema.waitlist.updatedAt,
|
|
454
|
-
})
|
|
455
|
-
.from(this.schema.waitlist)
|
|
456
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM"))
|
|
457
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.waitlist.createdAt));
|
|
458
|
-
return (0, neverthrow_1.ok)(claims);
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
async validateAccountClaimCode(code, tx) {
|
|
462
|
-
return this.throwableAsync(async () => {
|
|
463
|
-
const db = tx ?? this.orm;
|
|
464
|
-
const [claim] = await db
|
|
465
|
-
.select()
|
|
466
|
-
.from(this.schema.waitlist)
|
|
467
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.code, code), (0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM")))
|
|
468
|
-
.limit(1);
|
|
469
|
-
if (!claim)
|
|
470
|
-
return (0, neverthrow_1.ok)({ status: "NOT_FOUND" });
|
|
471
|
-
if (claim.expiresAt && claim.expiresAt < new Date())
|
|
472
|
-
return (0, neverthrow_1.ok)({ status: "EXPIRED" });
|
|
473
|
-
if (claim.status !== "INVITED")
|
|
474
|
-
return (0, neverthrow_1.ok)({ status: "INVALID" });
|
|
475
|
-
return (0, neverthrow_1.ok)({ status: "VALID" });
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
async findAccountClaimByCode(code, tx) {
|
|
479
|
-
return this.throwableAsync(async () => {
|
|
480
|
-
const db = tx ?? this.orm;
|
|
481
|
-
const [claim] = await db
|
|
482
|
-
.select()
|
|
483
|
-
.from(this.schema.waitlist)
|
|
484
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.code, code), (0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM"), (0, drizzle_orm_1.eq)(this.schema.waitlist.status, "INVITED"), (0, drizzle_orm_1.gte)(this.schema.waitlist.expiresAt, new Date())))
|
|
485
|
-
.limit(1);
|
|
486
|
-
return (0, neverthrow_1.ok)(claim ?? null);
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
async findAccountClaimById(id, tx) {
|
|
490
|
-
return this.throwableAsync(async () => {
|
|
491
|
-
const db = tx ?? this.orm;
|
|
492
|
-
const [claim] = await db
|
|
493
|
-
.select()
|
|
494
|
-
.from(this.schema.waitlist)
|
|
495
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.id, id), (0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM")))
|
|
496
|
-
.limit(1);
|
|
497
|
-
return (0, neverthrow_1.ok)(claim ?? null);
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
async findPendingAccountClaimForUser(userId, tx) {
|
|
501
|
-
return this.throwableAsync(async () => {
|
|
502
|
-
const db = tx ?? this.orm;
|
|
503
|
-
const [claim] = await db
|
|
504
|
-
.select()
|
|
505
|
-
.from(this.schema.waitlist)
|
|
506
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM"), (0, drizzle_orm_1.eq)(this.schema.waitlist.claimUserId, userId), (0, drizzle_orm_1.eq)(this.schema.waitlist.status, "INVITED"), (0, drizzle_orm_1.gte)(this.schema.waitlist.expiresAt, new Date())))
|
|
507
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.waitlist.createdAt))
|
|
508
|
-
.limit(1);
|
|
509
|
-
return (0, neverthrow_1.ok)(claim ?? null);
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
async setAccountClaimEmail({ userId, email }, tx) {
|
|
513
|
-
return this.throwableAsync(async () => {
|
|
514
|
-
const db = tx ?? this.orm;
|
|
515
|
-
const normalizedEmail = email.toLowerCase();
|
|
516
|
-
const [existingUser] = await db
|
|
517
|
-
.select({ id: this.schema.users.id })
|
|
518
|
-
.from(this.schema.users)
|
|
519
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.users.email, normalizedEmail), (0, drizzle_orm_1.ne)(this.schema.users.id, userId)))
|
|
520
|
-
.limit(1);
|
|
521
|
-
if (existingUser) {
|
|
522
|
-
return this.error("BAD_REQUEST", "Email is already in use");
|
|
523
|
-
}
|
|
524
|
-
const [claim] = await db
|
|
525
|
-
.select({ id: this.schema.waitlist.id })
|
|
526
|
-
.from(this.schema.waitlist)
|
|
527
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM"), (0, drizzle_orm_1.eq)(this.schema.waitlist.claimUserId, userId), (0, drizzle_orm_1.eq)(this.schema.waitlist.status, "INVITED"), (0, drizzle_orm_1.gte)(this.schema.waitlist.expiresAt, new Date())))
|
|
528
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.waitlist.createdAt))
|
|
529
|
-
.limit(1);
|
|
530
|
-
if (!claim) {
|
|
531
|
-
return this.error("BAD_REQUEST", "No pending claim found");
|
|
532
|
-
}
|
|
533
|
-
await db
|
|
534
|
-
.update(this.schema.users)
|
|
535
|
-
.set({
|
|
536
|
-
email: normalizedEmail,
|
|
537
|
-
emailVerified: false,
|
|
538
|
-
updatedAt: new Date(),
|
|
539
|
-
})
|
|
540
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId));
|
|
541
|
-
await db
|
|
542
|
-
.update(this.schema.waitlist)
|
|
543
|
-
.set({
|
|
544
|
-
claimedEmail: normalizedEmail,
|
|
545
|
-
updatedAt: new Date(),
|
|
546
|
-
})
|
|
547
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.id, claim.id));
|
|
548
|
-
return (0, neverthrow_1.ok)({ status: true });
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
async acceptAccountClaim(userId, tx) {
|
|
552
|
-
return this.throwableAsync(async () => {
|
|
553
|
-
const db = tx ?? this.orm;
|
|
554
|
-
const [claim] = await db
|
|
555
|
-
.select({ id: this.schema.waitlist.id })
|
|
556
|
-
.from(this.schema.waitlist)
|
|
557
|
-
.where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(this.schema.waitlist.type, "ACCOUNT_CLAIM"), (0, drizzle_orm_1.eq)(this.schema.waitlist.claimUserId, userId), (0, drizzle_orm_1.eq)(this.schema.waitlist.status, "INVITED"), (0, drizzle_orm_1.gte)(this.schema.waitlist.expiresAt, new Date())))
|
|
558
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.waitlist.createdAt))
|
|
559
|
-
.limit(1);
|
|
560
|
-
if (!claim)
|
|
561
|
-
return (0, neverthrow_1.ok)({ status: true });
|
|
562
|
-
const [user] = await db
|
|
563
|
-
.select({ email: this.schema.users.email })
|
|
564
|
-
.from(this.schema.users)
|
|
565
|
-
.where((0, drizzle_orm_1.eq)(this.schema.users.id, userId))
|
|
566
|
-
.limit(1);
|
|
567
|
-
await db
|
|
568
|
-
.update(this.schema.waitlist)
|
|
569
|
-
.set({
|
|
570
|
-
status: "ACCEPTED",
|
|
571
|
-
claimedAt: new Date(),
|
|
572
|
-
claimedEmail: user?.email ?? null,
|
|
573
|
-
updatedAt: new Date(),
|
|
574
|
-
})
|
|
575
|
-
.where((0, drizzle_orm_1.eq)(this.schema.waitlist.id, claim.id));
|
|
576
|
-
return (0, neverthrow_1.ok)({ status: true });
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
async createAccountClaimMagicLink({ claimId, userId, email, token, url, expiresAt, }, tx) {
|
|
580
|
-
return this.throwableAsync(async () => {
|
|
581
|
-
const db = tx ?? this.orm;
|
|
582
|
-
const [link] = await db
|
|
583
|
-
.insert(this.schema.accountClaimMagicLinks)
|
|
584
|
-
.values({
|
|
585
|
-
claimId,
|
|
586
|
-
userId,
|
|
587
|
-
email,
|
|
588
|
-
token,
|
|
589
|
-
url,
|
|
590
|
-
expiresAt: expiresAt ?? null,
|
|
591
|
-
})
|
|
592
|
-
.returning();
|
|
593
|
-
return (0, neverthrow_1.ok)(link);
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
async listAccountClaimMagicLinks(claimId, tx) {
|
|
597
|
-
return this.throwableAsync(async () => {
|
|
598
|
-
const db = tx ?? this.orm;
|
|
599
|
-
const links = await db
|
|
600
|
-
.select({
|
|
601
|
-
id: this.schema.accountClaimMagicLinks.id,
|
|
602
|
-
claimId: this.schema.accountClaimMagicLinks.claimId,
|
|
603
|
-
userId: this.schema.accountClaimMagicLinks.userId,
|
|
604
|
-
email: this.schema.accountClaimMagicLinks.email,
|
|
605
|
-
url: this.schema.accountClaimMagicLinks.url,
|
|
606
|
-
expiresAt: this.schema.accountClaimMagicLinks.expiresAt,
|
|
607
|
-
createdAt: this.schema.accountClaimMagicLinks.createdAt,
|
|
608
|
-
})
|
|
609
|
-
.from(this.schema.accountClaimMagicLinks)
|
|
610
|
-
.where((0, drizzle_orm_1.eq)(this.schema.accountClaimMagicLinks.claimId, claimId))
|
|
611
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.accountClaimMagicLinks.createdAt));
|
|
612
|
-
return (0, neverthrow_1.ok)(links);
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
async latestAccountClaimMagicLink(claimId, tx) {
|
|
616
|
-
return this.throwableAsync(async () => {
|
|
617
|
-
const db = tx ?? this.orm;
|
|
618
|
-
const [link] = await db
|
|
619
|
-
.select({
|
|
620
|
-
id: this.schema.accountClaimMagicLinks.id,
|
|
621
|
-
claimId: this.schema.accountClaimMagicLinks.claimId,
|
|
622
|
-
userId: this.schema.accountClaimMagicLinks.userId,
|
|
623
|
-
email: this.schema.accountClaimMagicLinks.email,
|
|
624
|
-
url: this.schema.accountClaimMagicLinks.url,
|
|
625
|
-
expiresAt: this.schema.accountClaimMagicLinks.expiresAt,
|
|
626
|
-
createdAt: this.schema.accountClaimMagicLinks.createdAt,
|
|
627
|
-
})
|
|
628
|
-
.from(this.schema.accountClaimMagicLinks)
|
|
629
|
-
.where((0, drizzle_orm_1.eq)(this.schema.accountClaimMagicLinks.claimId, claimId))
|
|
630
|
-
.orderBy((0, drizzle_orm_1.desc)(this.schema.accountClaimMagicLinks.createdAt))
|
|
631
|
-
.limit(1);
|
|
632
|
-
return (0, neverthrow_1.ok)(link ?? null);
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
exports.AuthRepository = AuthRepository;
|