@m5kdev/backend 0.8.7 → 0.8.8
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.cjs +33 -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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +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.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect-adapter-base.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect-adapter.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-adapter.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-introspector.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-adapter.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-introspector.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-introspector.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-adapter.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-introspector.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/expression/expression-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/index.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/kysely.d.cts +38 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/migration/file-migration-provider.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/migration/migrator.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/binary-operation-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/delete-from-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/expression-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/group-by-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/insert-values-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/join-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/merge-into-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/reference-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/returning-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/select-from-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/select-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/set-operation-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/tuple-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/unary-operation-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/update-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/update-set-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/value-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/with-parser.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/case-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/delete-query-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/having-interface.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/insert-query-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/join-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/merge-query-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/on-conflict-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/output-interface.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/returning-interface.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/select-query-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/update-query-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/where-interface.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-creator.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/default-query-executor.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/noop-query-executor.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor-base.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor-provider.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/raw-builder/raw-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/raw-builder/sql.d.cts +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.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-add-index-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-drop-constraint-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-executor.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-index-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-schema-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-table-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-type-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-view-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-index-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-schema-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-table-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-type-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-view-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/refresh-materialized-view-builder.d.cts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/schema.d.cts +1 -0
- package/dist/src/lib/posthog.cjs +8 -0
- package/dist/src/lib/posthog.cjs.map +1 -0
- package/dist/src/lib/posthog.d.cts +7 -0
- package/dist/src/lib/sentry.cjs +11 -0
- package/dist/src/lib/sentry.cjs.map +1 -0
- package/dist/src/lib/sentry.d.cts +1 -0
- package/dist/src/modules/access/access.repository.cjs +26 -0
- package/dist/src/modules/access/access.repository.cjs.map +1 -0
- package/dist/src/modules/access/access.repository.d.cts +2352 -0
- package/dist/src/modules/access/access.service.cjs +42 -0
- package/dist/src/modules/access/access.service.cjs.map +1 -0
- package/dist/src/modules/access/access.service.d.cts +25 -0
- package/dist/src/modules/access/access.utils.cjs +23 -0
- package/dist/src/modules/access/access.utils.cjs.map +1 -0
- package/dist/src/modules/access/access.utils.d.cts +19 -0
- package/dist/src/modules/ai/ai.db.cjs +46 -0
- package/dist/src/modules/ai/ai.db.cjs.map +1 -0
- package/dist/src/modules/ai/ai.db.d.cts +401 -0
- package/dist/src/modules/ai/ai.prompt.cjs +33 -0
- package/dist/src/modules/ai/ai.prompt.cjs.map +1 -0
- package/dist/src/modules/ai/ai.prompt.d.cts +30 -0
- package/dist/src/modules/ai/ai.prompts.cjs +18 -0
- package/dist/src/modules/ai/ai.prompts.cjs.map +1 -0
- package/dist/src/modules/ai/ai.prompts.d.cts +10 -0
- package/dist/src/modules/ai/ai.repository.cjs +25 -0
- package/dist/src/modules/ai/ai.repository.cjs.map +1 -0
- package/dist/src/modules/ai/ai.repository.d.cts +428 -0
- package/dist/src/modules/ai/ai.router.cjs +0 -0
- package/dist/src/modules/ai/ai.router.d.cts +1 -0
- package/dist/src/modules/ai/ai.service.cjs +312 -0
- package/dist/src/modules/ai/ai.service.cjs.map +1 -0
- package/dist/src/modules/ai/ai.service.d.cts +141 -0
- package/dist/src/modules/ai/ai.trpc.cjs +19 -0
- package/dist/src/modules/ai/ai.trpc.cjs.map +1 -0
- package/dist/src/modules/ai/ai.trpc.d.cts +31 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.cjs +191 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.cjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.cts +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.cjs +49 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.cjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.cts +234 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.cjs +862 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.cjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.cts +7 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.cjs +34 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.cjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.cts +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.cjs +12 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.cjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.d.cts +14 -0
- package/dist/src/modules/auth/auth.db.cjs +187 -0
- package/dist/src/modules/auth/auth.db.cjs.map +1 -0
- package/dist/src/modules/auth/auth.db.d.cts +2341 -0
- package/dist/src/modules/auth/auth.dto.cjs +50 -0
- package/dist/src/modules/auth/auth.dto.cjs.map +1 -0
- package/dist/src/modules/auth/auth.dto.d.cts +70 -0
- package/dist/src/modules/auth/auth.dto.d.mts +2 -2
- package/dist/src/modules/auth/auth.lib.cjs +234 -0
- package/dist/src/modules/auth/auth.lib.cjs.map +1 -0
- package/dist/src/modules/auth/auth.lib.d.cts +4894 -0
- package/dist/src/modules/auth/auth.lib.d.mts +1 -1
- package/dist/src/modules/auth/auth.middleware.cjs +41 -0
- package/dist/src/modules/auth/auth.middleware.cjs.map +1 -0
- package/dist/src/modules/auth/auth.middleware.d.cts +619 -0
- package/dist/src/modules/auth/auth.repository.cjs +403 -0
- package/dist/src/modules/auth/auth.repository.cjs.map +1 -0
- package/dist/src/modules/auth/auth.repository.d.cts +2453 -0
- package/dist/src/modules/auth/auth.service.cjs +229 -0
- package/dist/src/modules/auth/auth.service.cjs.map +1 -0
- package/dist/src/modules/auth/auth.service.d.cts +105 -0
- package/dist/src/modules/auth/auth.trpc.cjs +110 -0
- package/dist/src/modules/auth/auth.trpc.cjs.map +1 -0
- package/dist/src/modules/auth/auth.trpc.d.cts +303 -0
- package/dist/src/modules/auth/auth.trpc.d.mts +6 -6
- package/dist/src/modules/auth/auth.utils.cjs +80 -0
- package/dist/src/modules/auth/auth.utils.cjs.map +1 -0
- package/dist/src/modules/auth/auth.utils.d.cts +2356 -0
- package/dist/src/modules/base/base.abstract.cjs +62 -0
- package/dist/src/modules/base/base.abstract.cjs.map +1 -0
- package/dist/src/modules/base/base.abstract.d.cts +29 -0
- package/dist/src/modules/base/base.actor.cjs +83 -0
- package/dist/src/modules/base/base.actor.cjs.map +1 -0
- package/dist/src/modules/base/base.actor.d.cts +73 -0
- package/dist/src/modules/base/base.dto.cjs +98 -0
- package/dist/src/modules/base/base.dto.cjs.map +1 -0
- package/dist/src/modules/base/base.dto.d.cts +67 -0
- package/dist/src/modules/base/base.grants.cjs +107 -0
- package/dist/src/modules/base/base.grants.cjs.map +1 -0
- package/dist/src/modules/base/base.grants.d.cts +28 -0
- package/dist/src/modules/base/base.procedure.cjs +255 -0
- package/dist/src/modules/base/base.procedure.cjs.map +1 -0
- package/dist/src/modules/base/base.procedure.d.cts +111 -0
- package/dist/src/modules/base/base.repository.cjs +269 -0
- package/dist/src/modules/base/base.repository.cjs.map +1 -0
- package/dist/src/modules/base/base.repository.d.cts +125 -0
- package/dist/src/modules/base/base.repository.d.mts +2 -0
- package/dist/src/modules/base/base.repository.mjs +12 -0
- package/dist/src/modules/base/base.repository.mjs.map +1 -1
- package/dist/src/modules/base/base.service.cjs +119 -0
- package/dist/src/modules/base/base.service.cjs.map +1 -0
- package/dist/src/modules/base/base.service.d.cts +44 -0
- package/dist/src/modules/base/base.types.cjs +0 -0
- package/dist/src/modules/base/base.types.d.cts +5 -0
- package/dist/src/modules/billing/billing.db.cjs +38 -0
- package/dist/src/modules/billing/billing.db.cjs.map +1 -0
- package/dist/src/modules/billing/billing.db.d.cts +371 -0
- package/dist/src/modules/billing/billing.repository.cjs +190 -0
- package/dist/src/modules/billing/billing.repository.cjs.map +1 -0
- package/dist/src/modules/billing/billing.repository.d.cts +2787 -0
- package/dist/src/modules/billing/billing.router.cjs +43 -0
- package/dist/src/modules/billing/billing.router.cjs.map +1 -0
- package/dist/src/modules/billing/billing.router.d.cts +9 -0
- package/dist/src/modules/billing/billing.service.cjs +127 -0
- package/dist/src/modules/billing/billing.service.cjs.map +1 -0
- package/dist/src/modules/billing/billing.service.d.cts +53 -0
- package/dist/src/modules/billing/billing.trpc.cjs +19 -0
- package/dist/src/modules/billing/billing.trpc.cjs.map +1 -0
- package/dist/src/modules/billing/billing.trpc.d.cts +48 -0
- package/dist/src/modules/clay/clay.repository.cjs +29 -0
- package/dist/src/modules/clay/clay.repository.cjs.map +1 -0
- package/dist/src/modules/clay/clay.repository.d.cts +10 -0
- package/dist/src/modules/clay/clay.service.cjs +24 -0
- package/dist/src/modules/clay/clay.service.cjs.map +1 -0
- package/dist/src/modules/clay/clay.service.d.cts +32 -0
- package/dist/src/modules/connect/connect.db.cjs +37 -0
- package/dist/src/modules/connect/connect.db.cjs.map +1 -0
- package/dist/src/modules/connect/connect.db.d.cts +362 -0
- package/dist/src/modules/connect/connect.dto.cjs +45 -0
- package/dist/src/modules/connect/connect.dto.cjs.map +1 -0
- package/dist/src/modules/connect/connect.dto.d.cts +79 -0
- package/dist/src/modules/connect/connect.dto.d.mts +2 -2
- package/dist/src/modules/connect/connect.linkedin.cjs +48 -0
- package/dist/src/modules/connect/connect.linkedin.cjs.map +1 -0
- package/dist/src/modules/connect/connect.linkedin.d.cts +7 -0
- package/dist/src/modules/connect/connect.oauth.cjs +153 -0
- package/dist/src/modules/connect/connect.oauth.cjs.map +1 -0
- package/dist/src/modules/connect/connect.oauth.d.cts +32 -0
- package/dist/src/modules/connect/connect.repository.cjs +42 -0
- package/dist/src/modules/connect/connect.repository.cjs.map +1 -0
- package/dist/src/modules/connect/connect.repository.d.cts +419 -0
- package/dist/src/modules/connect/connect.repository.d.mts +1 -1
- package/dist/src/modules/connect/connect.router.cjs +48 -0
- package/dist/src/modules/connect/connect.router.cjs.map +1 -0
- package/dist/src/modules/connect/connect.router.d.cts +9 -0
- package/dist/src/modules/connect/connect.service.cjs +90 -0
- package/dist/src/modules/connect/connect.service.cjs.map +1 -0
- package/dist/src/modules/connect/connect.service.d.cts +103 -0
- package/dist/src/modules/connect/connect.service.d.mts +2 -2
- package/dist/src/modules/connect/connect.trpc.cjs +18 -0
- package/dist/src/modules/connect/connect.trpc.cjs.map +1 -0
- package/dist/src/modules/connect/connect.trpc.d.cts +53 -0
- package/dist/src/modules/connect/connect.types.cjs +0 -0
- package/dist/src/modules/connect/connect.types.d.cts +29 -0
- package/dist/src/modules/crypto/crypto.db.cjs +26 -0
- package/dist/src/modules/crypto/crypto.db.cjs.map +1 -0
- package/dist/src/modules/crypto/crypto.db.d.cts +157 -0
- package/dist/src/modules/crypto/crypto.repository.cjs +9 -0
- package/dist/src/modules/crypto/crypto.repository.cjs.map +1 -0
- package/dist/src/modules/crypto/crypto.repository.d.cts +163 -0
- package/dist/src/modules/crypto/crypto.service.cjs +46 -0
- package/dist/src/modules/crypto/crypto.service.cjs.map +1 -0
- package/dist/src/modules/crypto/crypto.service.d.cts +15 -0
- package/dist/src/modules/email/email.service.cjs +107 -0
- package/dist/src/modules/email/email.service.cjs.map +1 -0
- package/dist/src/modules/email/email.service.d.cts +62 -0
- package/dist/src/modules/file/file.repository.cjs +74 -0
- package/dist/src/modules/file/file.repository.cjs.map +1 -0
- package/dist/src/modules/file/file.repository.d.cts +17 -0
- package/dist/src/modules/file/file.router.cjs +94 -0
- package/dist/src/modules/file/file.router.cjs.map +1 -0
- package/dist/src/modules/file/file.router.d.cts +7 -0
- package/dist/src/modules/file/file.service.cjs +120 -0
- package/dist/src/modules/file/file.service.cjs.map +1 -0
- package/dist/src/modules/file/file.service.d.cts +30 -0
- package/dist/src/modules/recurrence/recurrence.db.cjs +55 -0
- package/dist/src/modules/recurrence/recurrence.db.cjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.db.d.cts +568 -0
- package/dist/src/modules/recurrence/recurrence.repository.cjs +31 -0
- package/dist/src/modules/recurrence/recurrence.repository.cjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.repository.d.cts +588 -0
- package/dist/src/modules/recurrence/recurrence.service.cjs +66 -0
- package/dist/src/modules/recurrence/recurrence.service.cjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.service.d.cts +88 -0
- package/dist/src/modules/recurrence/recurrence.service.d.mts +3 -2
- package/dist/src/modules/recurrence/recurrence.service.mjs +1 -1
- package/dist/src/modules/recurrence/recurrence.service.mjs.map +1 -1
- package/dist/src/modules/recurrence/recurrence.trpc.cjs +46 -0
- package/dist/src/modules/recurrence/recurrence.trpc.cjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.trpc.d.cts +216 -0
- package/dist/src/modules/recurrence/recurrence.trpc.d.mts +1 -0
- package/dist/src/modules/social/social.dto.cjs +26 -0
- package/dist/src/modules/social/social.dto.cjs.map +1 -0
- package/dist/src/modules/social/social.dto.d.cts +39 -0
- package/dist/src/modules/social/social.linkedin.cjs +349 -0
- package/dist/src/modules/social/social.linkedin.cjs.map +1 -0
- package/dist/src/modules/social/social.linkedin.d.cts +15 -0
- package/dist/src/modules/social/social.service.cjs +57 -0
- package/dist/src/modules/social/social.service.cjs.map +1 -0
- package/dist/src/modules/social/social.service.d.cts +34 -0
- package/dist/src/modules/social/social.types.cjs +0 -0
- package/dist/src/modules/social/social.types.d.cts +40 -0
- package/dist/src/modules/tag/tag.db.cjs +43 -0
- package/dist/src/modules/tag/tag.db.cjs.map +1 -0
- package/dist/src/modules/tag/tag.db.d.cts +352 -0
- package/dist/src/modules/tag/tag.dto.cjs +15 -0
- package/dist/src/modules/tag/tag.dto.cjs.map +1 -0
- package/dist/src/modules/tag/tag.dto.d.cts +1025 -0
- package/dist/src/modules/tag/tag.repository.cjs +116 -0
- package/dist/src/modules/tag/tag.repository.cjs.map +1 -0
- package/dist/src/modules/tag/tag.repository.d.cts +394 -0
- package/dist/src/modules/tag/tag.service.cjs +48 -0
- package/dist/src/modules/tag/tag.service.cjs.map +1 -0
- package/dist/src/modules/tag/tag.service.d.cts +120 -0
- package/dist/src/modules/tag/tag.trpc.cjs +32 -0
- package/dist/src/modules/tag/tag.trpc.cjs.map +1 -0
- package/dist/src/modules/tag/tag.trpc.d.cts +174 -0
- package/dist/src/modules/tag/tag.trpc.d.mts +1 -0
- package/dist/src/modules/utils/applyPagination.cjs +16 -0
- package/dist/src/modules/utils/applyPagination.cjs.map +1 -0
- package/dist/src/modules/utils/applyPagination.d.cts +10 -0
- package/dist/src/modules/utils/applySorting.cjs +20 -0
- package/dist/src/modules/utils/applySorting.cjs.map +1 -0
- package/dist/src/modules/utils/applySorting.d.cts +13 -0
- package/dist/src/modules/utils/getConditionsFromFilters.cjs +152 -0
- package/dist/src/modules/utils/getConditionsFromFilters.cjs.map +1 -0
- package/dist/src/modules/utils/getConditionsFromFilters.d.cts +9 -0
- package/dist/src/modules/utils/getGlobalSearchCondition.cjs +30 -0
- package/dist/src/modules/utils/getGlobalSearchCondition.cjs.map +1 -0
- package/dist/src/modules/utils/getGlobalSearchCondition.d.cts +18 -0
- package/dist/src/modules/utils/getGlobalSearchCondition.d.mts +18 -0
- package/dist/src/modules/utils/getGlobalSearchCondition.mjs +26 -0
- package/dist/src/modules/utils/getGlobalSearchCondition.mjs.map +1 -0
- package/dist/src/modules/video/video.service.cjs +114 -0
- package/dist/src/modules/video/video.service.cjs.map +1 -0
- package/dist/src/modules/video/video.service.d.cts +12 -0
- package/dist/src/modules/video/video.service.mjs.map +1 -1
- package/dist/src/modules/webhook/webhook.constants.cjs +13 -0
- package/dist/src/modules/webhook/webhook.constants.cjs.map +1 -0
- package/dist/src/modules/webhook/webhook.constants.d.cts +12 -0
- package/dist/src/modules/webhook/webhook.db.cjs +19 -0
- package/dist/src/modules/webhook/webhook.db.cjs.map +1 -0
- package/dist/src/modules/webhook/webhook.db.d.cts +142 -0
- package/dist/src/modules/webhook/webhook.dto.cjs +11 -0
- package/dist/src/modules/webhook/webhook.dto.cjs.map +1 -0
- package/dist/src/modules/webhook/webhook.dto.d.cts +402 -0
- package/dist/src/modules/webhook/webhook.repository.cjs +52 -0
- package/dist/src/modules/webhook/webhook.repository.cjs.map +1 -0
- package/dist/src/modules/webhook/webhook.repository.d.cts +154 -0
- package/dist/src/modules/webhook/webhook.router.cjs +26 -0
- package/dist/src/modules/webhook/webhook.router.cjs.map +1 -0
- package/dist/src/modules/webhook/webhook.router.d.cts +8 -0
- package/dist/src/modules/webhook/webhook.service.cjs +61 -0
- package/dist/src/modules/webhook/webhook.service.cjs.map +1 -0
- package/dist/src/modules/webhook/webhook.service.d.cts +14 -0
- package/dist/src/modules/workflow/workflow.db.cjs +35 -0
- package/dist/src/modules/workflow/workflow.db.cjs.map +1 -0
- package/dist/src/modules/workflow/workflow.db.d.cts +302 -0
- package/dist/src/modules/workflow/workflow.repository.cjs +95 -0
- package/dist/src/modules/workflow/workflow.repository.cjs.map +1 -0
- package/dist/src/modules/workflow/workflow.repository.d.cts +371 -0
- package/dist/src/modules/workflow/workflow.service.cjs +41 -0
- package/dist/src/modules/workflow/workflow.service.cjs.map +1 -0
- package/dist/src/modules/workflow/workflow.service.d.cts +68 -0
- package/dist/src/modules/workflow/workflow.trpc.cjs +19 -0
- package/dist/src/modules/workflow/workflow.trpc.cjs.map +1 -0
- package/dist/src/modules/workflow/workflow.trpc.d.cts +65 -0
- package/dist/src/modules/workflow/workflow.types.cjs +0 -0
- package/dist/src/modules/workflow/workflow.types.d.cts +25 -0
- package/dist/src/modules/workflow/workflow.utils.cjs +185 -0
- package/dist/src/modules/workflow/workflow.utils.cjs.map +1 -0
- package/dist/src/modules/workflow/workflow.utils.d.cts +36 -0
- package/dist/src/types.cjs +12 -0
- package/dist/src/types.cjs.map +1 -0
- package/dist/src/types.d.cts +344 -0
- package/dist/src/utils/errors.cjs +101 -0
- package/dist/src/utils/errors.cjs.map +1 -0
- package/dist/src/utils/errors.d.cts +62 -0
- package/dist/src/utils/logger.cjs +13 -0
- package/dist/src/utils/logger.cjs.map +1 -0
- package/dist/src/utils/logger.d.cts +7 -0
- package/dist/src/utils/posthog.cjs +31 -0
- package/dist/src/utils/posthog.cjs.map +1 -0
- package/dist/src/utils/posthog.d.cts +17 -0
- package/dist/src/utils/trpc.cjs +156 -0
- package/dist/src/utils/trpc.cjs.map +1 -0
- package/dist/src/utils/trpc.d.cts +54 -0
- package/dist/src/utils/types.cjs +0 -0
- package/dist/src/utils/types.d.cts +9 -0
- package/package.json +171 -45
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let body_parser = require("body-parser");
|
|
4
|
+
body_parser = require_runtime.__toESM(body_parser);
|
|
5
|
+
let express = require("express");
|
|
6
|
+
//#region src/modules/billing/billing.router.ts
|
|
7
|
+
function createBillingRouter(authMiddleware, service) {
|
|
8
|
+
const billingRouter = (0, express.Router)();
|
|
9
|
+
billingRouter.get("/checkout/:priceId", authMiddleware, async (req, res) => {
|
|
10
|
+
const user = req.user;
|
|
11
|
+
const session = await service.createCheckoutSession({ priceId: req.params.priceId }, { user });
|
|
12
|
+
if (session.isErr()) return res.status(500).json({ message: session.error.message });
|
|
13
|
+
if (!session.value.url) return res.status(500).json({ message: "Failed to create checkout session" });
|
|
14
|
+
return res.redirect(session.value.url);
|
|
15
|
+
});
|
|
16
|
+
billingRouter.get("/portal", authMiddleware, async (req, res) => {
|
|
17
|
+
const user = req.user;
|
|
18
|
+
const session = await service.createBillingPortalSession({ user });
|
|
19
|
+
if (session.isErr()) return res.status(500).json({ message: session.error.message });
|
|
20
|
+
return res.redirect(session.value.url);
|
|
21
|
+
});
|
|
22
|
+
billingRouter.get("/success", authMiddleware, async (req, res) => {
|
|
23
|
+
const user = req.user;
|
|
24
|
+
if (!user.stripeCustomerId) return res.redirect(`${process.env.VITE_APP_URL}/billing`);
|
|
25
|
+
if ((await service.syncStripeData(user.stripeCustomerId)).isErr()) return res.redirect(`${process.env.VITE_APP_URL}/billing?error=SYNC_FAILED`);
|
|
26
|
+
return res.redirect(`${process.env.VITE_APP_URL}/billing`);
|
|
27
|
+
});
|
|
28
|
+
billingRouter.post("/webhook", body_parser.default.raw({ type: "application/json" }), async (req, res) => {
|
|
29
|
+
const signature = req.headers["stripe-signature"];
|
|
30
|
+
if (!signature) return res.status(400).json({ message: "No signature" });
|
|
31
|
+
if (typeof signature !== "string") return res.status(500).json({ message: "Signature is not a string" });
|
|
32
|
+
const event = service.constructEvent(req.body, signature);
|
|
33
|
+
if (event.isErr()) return res.status(500).json({ message: event.error.message });
|
|
34
|
+
const result = await service.processEvent(event.value);
|
|
35
|
+
if (result.isErr()) return res.status(500).json({ message: result.error.message });
|
|
36
|
+
return res.status(200).json({ received: true });
|
|
37
|
+
});
|
|
38
|
+
return billingRouter;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
exports.createBillingRouter = createBillingRouter;
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=billing.router.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.router.cjs","names":["bodyParser"],"sources":["../../../../src/modules/billing/billing.router.ts"],"sourcesContent":["import bodyParser from \"body-parser\";\r\nimport { Router } from \"express\";\r\nimport type { AuthMiddleware, AuthRequest } from \"../auth/auth.middleware\";\r\nimport type { BillingService } from \"./billing.service\";\r\n\r\nexport function createBillingRouter(\r\n authMiddleware: AuthMiddleware,\r\n service: BillingService\r\n): Router {\r\n const billingRouter = Router();\r\n\r\n billingRouter.get(\"/checkout/:priceId\", authMiddleware, async (req: AuthRequest, res) => {\r\n const user = req.user!;\r\n\r\n const session = await service.createCheckoutSession({ priceId: req.params.priceId }, { user });\r\n if (session.isErr()) {\r\n return res.status(500).json({ message: session.error.message });\r\n }\r\n\r\n if (!session.value.url) {\r\n return res.status(500).json({ message: \"Failed to create checkout session\" });\r\n }\r\n\r\n return res.redirect(session.value.url);\r\n });\r\n\r\n billingRouter.get(\"/portal\", authMiddleware, async (req: AuthRequest, res) => {\r\n const user = req.user!;\r\n\r\n const session = await service.createBillingPortalSession({ user });\r\n\r\n if (session.isErr()) {\r\n return res.status(500).json({ message: session.error.message });\r\n }\r\n\r\n return res.redirect(session.value.url);\r\n });\r\n\r\n billingRouter.get(\"/success\", authMiddleware, async (req: AuthRequest, res) => {\r\n const user = req.user!;\r\n\r\n if (!user.stripeCustomerId) {\r\n return res.redirect(`${process.env.VITE_APP_URL}/billing`);\r\n }\r\n\r\n const result = await service.syncStripeData(user.stripeCustomerId);\r\n\r\n if (result.isErr()) {\r\n return res.redirect(`${process.env.VITE_APP_URL}/billing?error=SYNC_FAILED`);\r\n }\r\n\r\n return res.redirect(`${process.env.VITE_APP_URL}/billing`);\r\n });\r\n\r\n billingRouter.post(\"/webhook\", bodyParser.raw({ type: \"application/json\" }), async (req, res) => {\r\n const signature = req.headers[\"stripe-signature\"];\r\n\r\n if (!signature) return res.status(400).json({ message: \"No signature\" });\r\n\r\n if (typeof signature !== \"string\")\r\n return res.status(500).json({ message: \"Signature is not a string\" });\r\n\r\n const event = service.constructEvent(req.body, signature);\r\n if (event.isErr()) {\r\n return res.status(500).json({ message: event.error.message });\r\n }\r\n\r\n const result = await service.processEvent(event.value);\r\n if (result.isErr()) {\r\n return res.status(500).json({ message: result.error.message });\r\n }\r\n\r\n return res.status(200).json({ received: true });\r\n });\r\n\r\n return billingRouter;\r\n}\r\n"],"mappings":";;;;;;AAKA,SAAgB,oBACd,gBACA,SACQ;CACR,MAAM,iBAAA,GAAA,QAAA,SAAwB;AAE9B,eAAc,IAAI,sBAAsB,gBAAgB,OAAO,KAAkB,QAAQ;EACvF,MAAM,OAAO,IAAI;EAEjB,MAAM,UAAU,MAAM,QAAQ,sBAAsB,EAAE,SAAS,IAAI,OAAO,SAAS,EAAE,EAAE,MAAM,CAAC;AAC9F,MAAI,QAAQ,OAAO,CACjB,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,MAAM,SAAS,CAAC;AAGjE,MAAI,CAAC,QAAQ,MAAM,IACjB,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,qCAAqC,CAAC;AAG/E,SAAO,IAAI,SAAS,QAAQ,MAAM,IAAI;GACtC;AAEF,eAAc,IAAI,WAAW,gBAAgB,OAAO,KAAkB,QAAQ;EAC5E,MAAM,OAAO,IAAI;EAEjB,MAAM,UAAU,MAAM,QAAQ,2BAA2B,EAAE,MAAM,CAAC;AAElE,MAAI,QAAQ,OAAO,CACjB,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,QAAQ,MAAM,SAAS,CAAC;AAGjE,SAAO,IAAI,SAAS,QAAQ,MAAM,IAAI;GACtC;AAEF,eAAc,IAAI,YAAY,gBAAgB,OAAO,KAAkB,QAAQ;EAC7E,MAAM,OAAO,IAAI;AAEjB,MAAI,CAAC,KAAK,iBACR,QAAO,IAAI,SAAS,GAAG,QAAQ,IAAI,aAAa,UAAU;AAK5D,OAFe,MAAM,QAAQ,eAAe,KAAK,iBAAiB,EAEvD,OAAO,CAChB,QAAO,IAAI,SAAS,GAAG,QAAQ,IAAI,aAAa,4BAA4B;AAG9E,SAAO,IAAI,SAAS,GAAG,QAAQ,IAAI,aAAa,UAAU;GAC1D;AAEF,eAAc,KAAK,YAAYA,YAAAA,QAAW,IAAI,EAAE,MAAM,oBAAoB,CAAC,EAAE,OAAO,KAAK,QAAQ;EAC/F,MAAM,YAAY,IAAI,QAAQ;AAE9B,MAAI,CAAC,UAAW,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,gBAAgB,CAAC;AAExE,MAAI,OAAO,cAAc,SACvB,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,6BAA6B,CAAC;EAEvE,MAAM,QAAQ,QAAQ,eAAe,IAAI,MAAM,UAAU;AACzD,MAAI,MAAM,OAAO,CACf,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,MAAM,MAAM,SAAS,CAAC;EAG/D,MAAM,SAAS,MAAM,QAAQ,aAAa,MAAM,MAAM;AACtD,MAAI,OAAO,OAAO,CAChB,QAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,SAAS,OAAO,MAAM,SAAS,CAAC;AAGhE,SAAO,IAAI,OAAO,IAAI,CAAC,KAAK,EAAE,UAAU,MAAM,CAAC;GAC/C;AAEF,QAAO"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BillingService } from "./billing.service.cjs";
|
|
2
|
+
import { AuthMiddleware } from "../auth/auth.middleware.cjs";
|
|
3
|
+
import { Router } from "express";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/billing/billing.router.d.ts
|
|
6
|
+
declare function createBillingRouter(authMiddleware: AuthMiddleware, service: BillingService): Router;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { createBillingRouter };
|
|
9
|
+
//# sourceMappingURL=billing.router.d.cts.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_src_utils_posthog = require("../../utils/posthog.cjs");
|
|
4
|
+
const require_src_modules_base_base_service = require("../base/base.service.cjs");
|
|
5
|
+
let neverthrow = require("neverthrow");
|
|
6
|
+
//#region src/modules/billing/billing.service.ts
|
|
7
|
+
const allowedEvents = [
|
|
8
|
+
"checkout.session.completed",
|
|
9
|
+
"customer.subscription.created",
|
|
10
|
+
"customer.subscription.updated",
|
|
11
|
+
"customer.subscription.deleted",
|
|
12
|
+
"customer.subscription.paused",
|
|
13
|
+
"customer.subscription.resumed",
|
|
14
|
+
"customer.subscription.pending_update_applied",
|
|
15
|
+
"customer.subscription.pending_update_expired",
|
|
16
|
+
"customer.subscription.trial_will_end",
|
|
17
|
+
"invoice.paid",
|
|
18
|
+
"invoice.payment_failed",
|
|
19
|
+
"invoice.payment_action_required",
|
|
20
|
+
"invoice.upcoming",
|
|
21
|
+
"invoice.marked_uncollectible",
|
|
22
|
+
"invoice.payment_succeeded",
|
|
23
|
+
"payment_intent.succeeded",
|
|
24
|
+
"payment_intent.payment_failed",
|
|
25
|
+
"payment_intent.canceled"
|
|
26
|
+
];
|
|
27
|
+
var BillingService = class extends require_src_modules_base_base_service.BaseService {
|
|
28
|
+
async createUserCustomer({ user }) {
|
|
29
|
+
let stripeCustomer = null;
|
|
30
|
+
const existingCustomer = await this.repository.billing.getCustomerByEmail(user.email);
|
|
31
|
+
if (existingCustomer.isErr()) return (0, neverthrow.err)(existingCustomer.error);
|
|
32
|
+
stripeCustomer = existingCustomer.value;
|
|
33
|
+
if (!stripeCustomer) {
|
|
34
|
+
const newCustomer = await this.repository.billing.createCustomer({
|
|
35
|
+
email: user.email,
|
|
36
|
+
name: user.name,
|
|
37
|
+
userId: user.id
|
|
38
|
+
});
|
|
39
|
+
if (newCustomer.isErr()) return (0, neverthrow.err)(newCustomer.error);
|
|
40
|
+
stripeCustomer = newCustomer.value;
|
|
41
|
+
}
|
|
42
|
+
if (!stripeCustomer) return this.error("INTERNAL_SERVER_ERROR", "Failed to create or get stripe customer");
|
|
43
|
+
const updatedUser = await this.repository.billing.updateUserCustomerId({
|
|
44
|
+
userId: user.id,
|
|
45
|
+
customerId: stripeCustomer.id
|
|
46
|
+
});
|
|
47
|
+
if (updatedUser.isErr()) return (0, neverthrow.err)(updatedUser.error);
|
|
48
|
+
return (0, neverthrow.ok)(stripeCustomer);
|
|
49
|
+
}
|
|
50
|
+
async createUserHook({ user }) {
|
|
51
|
+
const stripeCustomer = await this.createUserCustomer({ user });
|
|
52
|
+
if (stripeCustomer.isErr()) return (0, neverthrow.err)(stripeCustomer.error);
|
|
53
|
+
if (this.repository.billing.hasTrial()) {
|
|
54
|
+
const existingSubscription = await this.repository.billing.getLatestSubscription(user.id);
|
|
55
|
+
if (existingSubscription.isErr()) return (0, neverthrow.err)(existingSubscription.error);
|
|
56
|
+
if (!existingSubscription.value) {
|
|
57
|
+
const subscription = await this.repository.billing.createTrialSubscription(stripeCustomer.value.id);
|
|
58
|
+
if (subscription.isErr()) return (0, neverthrow.err)(subscription.error);
|
|
59
|
+
}
|
|
60
|
+
const syncResult = await this.syncStripeData(stripeCustomer.value.id);
|
|
61
|
+
if (syncResult.isErr()) return (0, neverthrow.err)(syncResult.error);
|
|
62
|
+
if (syncResult.value === false) return this.error("INTERNAL_SERVER_ERROR", "Sync did not create new subscription");
|
|
63
|
+
}
|
|
64
|
+
return (0, neverthrow.ok)(true);
|
|
65
|
+
}
|
|
66
|
+
async getActiveSubscription(ctx) {
|
|
67
|
+
return this.repository.billing.getActiveSubscription(ctx.actor.userId);
|
|
68
|
+
}
|
|
69
|
+
async listInvoices(ctx) {
|
|
70
|
+
if (!ctx.user.stripeCustomerId) return this.error("NOT_FOUND", "User has no stripe customer id");
|
|
71
|
+
return this.repository.billing.listInvoices(ctx.user.stripeCustomerId);
|
|
72
|
+
}
|
|
73
|
+
async createCheckoutSession({ priceId }, { user }) {
|
|
74
|
+
let stripeCustomerId = user.stripeCustomerId;
|
|
75
|
+
if (!stripeCustomerId) {
|
|
76
|
+
const stripeCustomer = await this.createUserCustomer({ user });
|
|
77
|
+
if (stripeCustomer.isErr()) return (0, neverthrow.err)(stripeCustomer.error);
|
|
78
|
+
stripeCustomerId = stripeCustomer.value.id;
|
|
79
|
+
}
|
|
80
|
+
return this.repository.billing.createCheckoutSession({
|
|
81
|
+
customerId: stripeCustomerId,
|
|
82
|
+
priceId,
|
|
83
|
+
userId: user.id
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async createBillingPortalSession({ user }) {
|
|
87
|
+
let stripeCustomerId = user.stripeCustomerId;
|
|
88
|
+
if (!stripeCustomerId) {
|
|
89
|
+
const stripeCustomer = await this.createUserCustomer({ user });
|
|
90
|
+
if (stripeCustomer.isErr()) return (0, neverthrow.err)(stripeCustomer.error);
|
|
91
|
+
stripeCustomerId = stripeCustomer.value.id;
|
|
92
|
+
}
|
|
93
|
+
return this.repository.billing.createBillingPortalSession(stripeCustomerId);
|
|
94
|
+
}
|
|
95
|
+
constructEvent(body, signature) {
|
|
96
|
+
if (!process.env.STRIPE_WEBHOOK_SECRET) return this.error("INTERNAL_SERVER_ERROR", "Stripe webhook secret is not set");
|
|
97
|
+
return this.repository.billing.constructEvent(body, signature, process.env.STRIPE_WEBHOOK_SECRET);
|
|
98
|
+
}
|
|
99
|
+
async syncStripeData(customerId, eventType) {
|
|
100
|
+
const user = await this.repository.billing.getUserByCustomerId(customerId);
|
|
101
|
+
if (user.isErr()) return (0, neverthrow.err)(user.error);
|
|
102
|
+
if (!user.value) return this.error("NOT_FOUND", "User not found");
|
|
103
|
+
if (eventType) require_src_utils_posthog.posthogCapture({
|
|
104
|
+
distinctId: user.value.id,
|
|
105
|
+
event: `stripe.${eventType}`,
|
|
106
|
+
properties: { customerId }
|
|
107
|
+
});
|
|
108
|
+
return this.repository.billing.syncStripeData({
|
|
109
|
+
customerId,
|
|
110
|
+
userId: user.value.id
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async processEvent(event) {
|
|
114
|
+
return this.throwableAsync(async () => {
|
|
115
|
+
if (!allowedEvents.includes(event.type)) return (0, neverthrow.ok)(false);
|
|
116
|
+
const { customer: customerId } = event?.data?.object;
|
|
117
|
+
if (typeof customerId !== "string") return this.error("INTERNAL_SERVER_ERROR", `[STRIPE HOOK] Unexpected event structure: customer ID is not a string. Event type: ${event.type}`);
|
|
118
|
+
const result = await this.syncStripeData(customerId, event.type);
|
|
119
|
+
if (result.isErr()) return (0, neverthrow.err)(result.error);
|
|
120
|
+
return (0, neverthrow.ok)(true);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
exports.BillingService = BillingService;
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=billing.service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.service.cjs","names":["BaseService"],"sources":["../../../../src/modules/billing/billing.service.ts"],"sourcesContent":["import type { BillingSchema } from \"@m5kdev/commons/modules/billing/billing.schema\";\r\nimport { err, ok } from \"neverthrow\";\r\nimport type Stripe from \"stripe\";\r\nimport { posthogCapture } from \"../../utils/posthog\";\r\nimport type { User } from \"../auth/auth.lib\";\r\nimport type { ServerResult, ServerResultAsync } from \"../base/base.dto\";\r\nimport type { Context } from \"../../utils/trpc\";\r\nimport { BaseService } from \"../base/base.service\";\r\nimport type { BillingRepository } from \"./billing.repository\";\r\n\r\nconst allowedEvents: Stripe.Event.Type[] = [\r\n \"checkout.session.completed\",\r\n \"customer.subscription.created\",\r\n \"customer.subscription.updated\",\r\n \"customer.subscription.deleted\",\r\n \"customer.subscription.paused\",\r\n \"customer.subscription.resumed\",\r\n \"customer.subscription.pending_update_applied\",\r\n \"customer.subscription.pending_update_expired\",\r\n \"customer.subscription.trial_will_end\",\r\n \"invoice.paid\",\r\n \"invoice.payment_failed\",\r\n \"invoice.payment_action_required\",\r\n \"invoice.upcoming\",\r\n \"invoice.marked_uncollectible\",\r\n \"invoice.payment_succeeded\",\r\n \"payment_intent.succeeded\",\r\n \"payment_intent.payment_failed\",\r\n \"payment_intent.canceled\",\r\n];\r\n\r\nexport class BillingService extends BaseService<{ billing: BillingRepository }, never> {\r\n async createUserCustomer({\r\n user,\r\n }: {\r\n user: { id: string; email: string; name?: string };\r\n }): ServerResultAsync<Stripe.Customer> {\r\n let stripeCustomer: Stripe.Customer | null = null;\r\n const existingCustomer = await this.repository.billing.getCustomerByEmail(user.email);\r\n if (existingCustomer.isErr()) return err(existingCustomer.error);\r\n stripeCustomer = existingCustomer.value;\r\n if (!stripeCustomer) {\r\n const newCustomer = await this.repository.billing.createCustomer({\r\n email: user.email,\r\n name: user.name,\r\n userId: user.id,\r\n });\r\n if (newCustomer.isErr()) return err(newCustomer.error);\r\n stripeCustomer = newCustomer.value;\r\n }\r\n\r\n if (!stripeCustomer)\r\n return this.error(\"INTERNAL_SERVER_ERROR\", \"Failed to create or get stripe customer\");\r\n const updatedUser = await this.repository.billing.updateUserCustomerId({\r\n userId: user.id,\r\n customerId: stripeCustomer.id,\r\n });\r\n if (updatedUser.isErr()) return err(updatedUser.error);\r\n return ok(stripeCustomer);\r\n }\r\n\r\n async createUserHook({\r\n user,\r\n }: {\r\n user: { id: string; email: string; name?: string };\r\n }): ServerResultAsync<boolean> {\r\n const stripeCustomer = await this.createUserCustomer({ user });\r\n if (stripeCustomer.isErr()) return err(stripeCustomer.error);\r\n\r\n if (this.repository.billing.hasTrial()) {\r\n const existingSubscription = await this.repository.billing.getLatestSubscription(user.id);\r\n if (existingSubscription.isErr()) return err(existingSubscription.error);\r\n if (!existingSubscription.value) {\r\n const subscription = await this.repository.billing.createTrialSubscription(\r\n stripeCustomer.value.id\r\n );\r\n if (subscription.isErr()) return err(subscription.error);\r\n }\r\n const syncResult = await this.syncStripeData(stripeCustomer.value.id);\r\n if (syncResult.isErr()) return err(syncResult.error);\r\n if (syncResult.value === false)\r\n return this.error(\"INTERNAL_SERVER_ERROR\", \"Sync did not create new subscription\");\r\n }\r\n\r\n return ok(true);\r\n }\r\n\r\n async getActiveSubscription(ctx: Context): ServerResultAsync<BillingSchema | null> {\r\n return this.repository.billing.getActiveSubscription(ctx.actor.userId);\r\n }\r\n\r\n async listInvoices(ctx: Context): ServerResultAsync<Stripe.Invoice[]> {\r\n if (!ctx.user.stripeCustomerId)\r\n return this.error(\"NOT_FOUND\", \"User has no stripe customer id\");\r\n return this.repository.billing.listInvoices(ctx.user.stripeCustomerId);\r\n }\r\n\r\n async createCheckoutSession(\r\n { priceId }: { priceId: string },\r\n { user }: { user: User }\r\n ): ServerResultAsync<Stripe.Checkout.Session> {\r\n let stripeCustomerId = user.stripeCustomerId;\r\n if (!stripeCustomerId) {\r\n const stripeCustomer = await this.createUserCustomer({ user });\r\n if (stripeCustomer.isErr()) return err(stripeCustomer.error);\r\n stripeCustomerId = stripeCustomer.value.id;\r\n }\r\n return this.repository.billing.createCheckoutSession({\r\n customerId: stripeCustomerId,\r\n priceId,\r\n userId: user.id,\r\n });\r\n }\r\n\r\n async createBillingPortalSession({\r\n user,\r\n }: {\r\n user: User;\r\n }): ServerResultAsync<Stripe.BillingPortal.Session> {\r\n let stripeCustomerId = user.stripeCustomerId;\r\n if (!stripeCustomerId) {\r\n const stripeCustomer = await this.createUserCustomer({ user });\r\n if (stripeCustomer.isErr()) return err(stripeCustomer.error);\r\n stripeCustomerId = stripeCustomer.value.id;\r\n }\r\n return this.repository.billing.createBillingPortalSession(stripeCustomerId);\r\n }\r\n\r\n constructEvent(body: Buffer | string, signature: string): ServerResult<Stripe.Event> {\r\n if (!process.env.STRIPE_WEBHOOK_SECRET)\r\n return this.error(\"INTERNAL_SERVER_ERROR\", \"Stripe webhook secret is not set\");\r\n return this.repository.billing.constructEvent(\r\n body,\r\n signature,\r\n process.env.STRIPE_WEBHOOK_SECRET!\r\n );\r\n }\r\n\r\n async syncStripeData(customerId: string, eventType?: string): ServerResultAsync<boolean> {\r\n const user = await this.repository.billing.getUserByCustomerId(customerId);\r\n if (user.isErr()) return err(user.error);\r\n if (!user.value) return this.error(\"NOT_FOUND\", \"User not found\");\r\n\r\n if (eventType) {\r\n posthogCapture({\r\n distinctId: user.value.id,\r\n event: `stripe.${eventType}`,\r\n properties: {\r\n customerId,\r\n },\r\n });\r\n }\r\n return this.repository.billing.syncStripeData({ customerId, userId: user.value.id });\r\n }\r\n\r\n async processEvent(event: Stripe.Event): ServerResultAsync<boolean> {\r\n return this.throwableAsync(async () => {\r\n // Skip processing if the event isn't one I'm tracking (list of all events below)\r\n if (!allowedEvents.includes(event.type)) return ok(false);\r\n\r\n // All the events I track have a customerId\r\n const { customer: customerId } = event?.data?.object as {\r\n customer: string; // Sadly TypeScript does not know this\r\n };\r\n\r\n // This helps make it typesafe and also lets me know if my assumption is wrong\r\n if (typeof customerId !== \"string\") {\r\n return this.error(\r\n \"INTERNAL_SERVER_ERROR\",\r\n `[STRIPE HOOK] Unexpected event structure: customer ID is not a string. Event type: ${event.type}`\r\n );\r\n }\r\n\r\n const result = await this.syncStripeData(customerId, event.type);\r\n if (result.isErr()) return err(result.error);\r\n return ok(true);\r\n });\r\n }\r\n}\r\n"],"mappings":";;;;;;AAUA,MAAM,gBAAqC;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,IAAa,iBAAb,cAAoCA,sCAAAA,YAAmD;CACrF,MAAM,mBAAmB,EACvB,QAGqC;EACrC,IAAI,iBAAyC;EAC7C,MAAM,mBAAmB,MAAM,KAAK,WAAW,QAAQ,mBAAmB,KAAK,MAAM;AACrF,MAAI,iBAAiB,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,iBAAiB,MAAM;AAChE,mBAAiB,iBAAiB;AAClC,MAAI,CAAC,gBAAgB;GACnB,MAAM,cAAc,MAAM,KAAK,WAAW,QAAQ,eAAe;IAC/D,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,QAAQ,KAAK;IACd,CAAC;AACF,OAAI,YAAY,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,YAAY,MAAM;AACtD,oBAAiB,YAAY;;AAG/B,MAAI,CAAC,eACH,QAAO,KAAK,MAAM,yBAAyB,0CAA0C;EACvF,MAAM,cAAc,MAAM,KAAK,WAAW,QAAQ,qBAAqB;GACrE,QAAQ,KAAK;GACb,YAAY,eAAe;GAC5B,CAAC;AACF,MAAI,YAAY,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,YAAY,MAAM;AACtD,UAAA,GAAA,WAAA,IAAU,eAAe;;CAG3B,MAAM,eAAe,EACnB,QAG6B;EAC7B,MAAM,iBAAiB,MAAM,KAAK,mBAAmB,EAAE,MAAM,CAAC;AAC9D,MAAI,eAAe,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,eAAe,MAAM;AAE5D,MAAI,KAAK,WAAW,QAAQ,UAAU,EAAE;GACtC,MAAM,uBAAuB,MAAM,KAAK,WAAW,QAAQ,sBAAsB,KAAK,GAAG;AACzF,OAAI,qBAAqB,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,qBAAqB,MAAM;AACxE,OAAI,CAAC,qBAAqB,OAAO;IAC/B,MAAM,eAAe,MAAM,KAAK,WAAW,QAAQ,wBACjD,eAAe,MAAM,GACtB;AACD,QAAI,aAAa,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,aAAa,MAAM;;GAE1D,MAAM,aAAa,MAAM,KAAK,eAAe,eAAe,MAAM,GAAG;AACrE,OAAI,WAAW,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,WAAW,MAAM;AACpD,OAAI,WAAW,UAAU,MACvB,QAAO,KAAK,MAAM,yBAAyB,uCAAuC;;AAGtF,UAAA,GAAA,WAAA,IAAU,KAAK;;CAGjB,MAAM,sBAAsB,KAAuD;AACjF,SAAO,KAAK,WAAW,QAAQ,sBAAsB,IAAI,MAAM,OAAO;;CAGxE,MAAM,aAAa,KAAmD;AACpE,MAAI,CAAC,IAAI,KAAK,iBACZ,QAAO,KAAK,MAAM,aAAa,iCAAiC;AAClE,SAAO,KAAK,WAAW,QAAQ,aAAa,IAAI,KAAK,iBAAiB;;CAGxE,MAAM,sBACJ,EAAE,WACF,EAAE,QAC0C;EAC5C,IAAI,mBAAmB,KAAK;AAC5B,MAAI,CAAC,kBAAkB;GACrB,MAAM,iBAAiB,MAAM,KAAK,mBAAmB,EAAE,MAAM,CAAC;AAC9D,OAAI,eAAe,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,eAAe,MAAM;AAC5D,sBAAmB,eAAe,MAAM;;AAE1C,SAAO,KAAK,WAAW,QAAQ,sBAAsB;GACnD,YAAY;GACZ;GACA,QAAQ,KAAK;GACd,CAAC;;CAGJ,MAAM,2BAA2B,EAC/B,QAGkD;EAClD,IAAI,mBAAmB,KAAK;AAC5B,MAAI,CAAC,kBAAkB;GACrB,MAAM,iBAAiB,MAAM,KAAK,mBAAmB,EAAE,MAAM,CAAC;AAC9D,OAAI,eAAe,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,eAAe,MAAM;AAC5D,sBAAmB,eAAe,MAAM;;AAE1C,SAAO,KAAK,WAAW,QAAQ,2BAA2B,iBAAiB;;CAG7E,eAAe,MAAuB,WAA+C;AACnF,MAAI,CAAC,QAAQ,IAAI,sBACf,QAAO,KAAK,MAAM,yBAAyB,mCAAmC;AAChF,SAAO,KAAK,WAAW,QAAQ,eAC7B,MACA,WACA,QAAQ,IAAI,sBACb;;CAGH,MAAM,eAAe,YAAoB,WAAgD;EACvF,MAAM,OAAO,MAAM,KAAK,WAAW,QAAQ,oBAAoB,WAAW;AAC1E,MAAI,KAAK,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,KAAK,MAAM;AACxC,MAAI,CAAC,KAAK,MAAO,QAAO,KAAK,MAAM,aAAa,iBAAiB;AAEjE,MAAI,UACF,2BAAA,eAAe;GACb,YAAY,KAAK,MAAM;GACvB,OAAO,UAAU;GACjB,YAAY,EACV,YACD;GACF,CAAC;AAEJ,SAAO,KAAK,WAAW,QAAQ,eAAe;GAAE;GAAY,QAAQ,KAAK,MAAM;GAAI,CAAC;;CAGtF,MAAM,aAAa,OAAiD;AAClE,SAAO,KAAK,eAAe,YAAY;AAErC,OAAI,CAAC,cAAc,SAAS,MAAM,KAAK,CAAE,SAAA,GAAA,WAAA,IAAU,MAAM;GAGzD,MAAM,EAAE,UAAU,eAAe,OAAO,MAAM;AAK9C,OAAI,OAAO,eAAe,SACxB,QAAO,KAAK,MACV,yBACA,sFAAsF,MAAM,OAC7F;GAGH,MAAM,SAAS,MAAM,KAAK,eAAe,YAAY,MAAM,KAAK;AAChE,OAAI,OAAO,OAAO,CAAE,SAAA,GAAA,WAAA,KAAW,OAAO,MAAM;AAC5C,WAAA,GAAA,WAAA,IAAU,KAAK;IACf"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ServerResult, ServerResultAsync } from "../base/base.dto.cjs";
|
|
2
|
+
import { Context } from "../../utils/trpc.cjs";
|
|
3
|
+
import { BillingRepository } from "./billing.repository.cjs";
|
|
4
|
+
import { User } from "../auth/auth.lib.cjs";
|
|
5
|
+
import { BaseService } from "../base/base.service.cjs";
|
|
6
|
+
import { BillingSchema } from "@m5kdev/commons/modules/billing/billing.schema";
|
|
7
|
+
import Stripe from "stripe";
|
|
8
|
+
|
|
9
|
+
//#region src/modules/billing/billing.service.d.ts
|
|
10
|
+
declare class BillingService extends BaseService<{
|
|
11
|
+
billing: BillingRepository;
|
|
12
|
+
}, never> {
|
|
13
|
+
createUserCustomer({
|
|
14
|
+
user
|
|
15
|
+
}: {
|
|
16
|
+
user: {
|
|
17
|
+
id: string;
|
|
18
|
+
email: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
};
|
|
21
|
+
}): ServerResultAsync<Stripe.Customer>;
|
|
22
|
+
createUserHook({
|
|
23
|
+
user
|
|
24
|
+
}: {
|
|
25
|
+
user: {
|
|
26
|
+
id: string;
|
|
27
|
+
email: string;
|
|
28
|
+
name?: string;
|
|
29
|
+
};
|
|
30
|
+
}): ServerResultAsync<boolean>;
|
|
31
|
+
getActiveSubscription(ctx: Context): ServerResultAsync<BillingSchema | null>;
|
|
32
|
+
listInvoices(ctx: Context): ServerResultAsync<Stripe.Invoice[]>;
|
|
33
|
+
createCheckoutSession({
|
|
34
|
+
priceId
|
|
35
|
+
}: {
|
|
36
|
+
priceId: string;
|
|
37
|
+
}, {
|
|
38
|
+
user
|
|
39
|
+
}: {
|
|
40
|
+
user: User;
|
|
41
|
+
}): ServerResultAsync<Stripe.Checkout.Session>;
|
|
42
|
+
createBillingPortalSession({
|
|
43
|
+
user
|
|
44
|
+
}: {
|
|
45
|
+
user: User;
|
|
46
|
+
}): ServerResultAsync<Stripe.BillingPortal.Session>;
|
|
47
|
+
constructEvent(body: Buffer | string, signature: string): ServerResult<Stripe.Event>;
|
|
48
|
+
syncStripeData(customerId: string, eventType?: string): ServerResultAsync<boolean>;
|
|
49
|
+
processEvent(event: Stripe.Event): ServerResultAsync<boolean>;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { BillingService };
|
|
53
|
+
//# sourceMappingURL=billing.service.d.cts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_src_utils_trpc = require("../../utils/trpc.cjs");
|
|
4
|
+
let _m5kdev_commons_modules_billing_billing_schema = require("@m5kdev/commons/modules/billing/billing.schema");
|
|
5
|
+
//#region src/modules/billing/billing.trpc.ts
|
|
6
|
+
function createBillingTRPC({ router, privateProcedure: procedure }, billingService) {
|
|
7
|
+
return router({
|
|
8
|
+
getActiveSubscription: procedure.output(_m5kdev_commons_modules_billing_billing_schema.billingSchema.nullable()).query(async ({ ctx }) => {
|
|
9
|
+
return require_src_utils_trpc.handleTRPCResult(await billingService.getActiveSubscription(ctx));
|
|
10
|
+
}),
|
|
11
|
+
listInvoices: procedure.query(async ({ ctx }) => {
|
|
12
|
+
return require_src_utils_trpc.handleTRPCResult(await billingService.listInvoices(ctx));
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.createBillingTRPC = createBillingTRPC;
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=billing.trpc.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.trpc.cjs","names":["billingSchema","handleTRPCResult"],"sources":["../../../../src/modules/billing/billing.trpc.ts"],"sourcesContent":["import { billingSchema } from \"@m5kdev/commons/modules/billing/billing.schema\";\r\nimport { handleTRPCResult, type TRPCMethods } from \"../../utils/trpc\";\r\nimport type { BillingService } from \"./billing.service\";\r\n\r\nexport function createBillingTRPC(\r\n { router, privateProcedure: procedure }: TRPCMethods,\r\n billingService: BillingService\r\n) {\r\n return router({\r\n getActiveSubscription: procedure.output(billingSchema.nullable()).query(async ({ ctx }) => {\r\n return handleTRPCResult(await billingService.getActiveSubscription(ctx));\r\n }),\r\n\r\n listInvoices: procedure.query(async ({ ctx }) => {\r\n return handleTRPCResult(await billingService.listInvoices(ctx));\r\n }),\r\n });\r\n}\r\n"],"mappings":";;;;;AAIA,SAAgB,kBACd,EAAE,QAAQ,kBAAkB,aAC5B,gBACA;AACA,QAAO,OAAO;EACZ,uBAAuB,UAAU,OAAOA,+CAAAA,cAAc,UAAU,CAAC,CAAC,MAAM,OAAO,EAAE,UAAU;AACzF,UAAOC,uBAAAA,iBAAiB,MAAM,eAAe,sBAAsB,IAAI,CAAC;IACxE;EAEF,cAAc,UAAU,MAAM,OAAO,EAAE,UAAU;AAC/C,UAAOA,uBAAAA,iBAAiB,MAAM,eAAe,aAAa,IAAI,CAAC;IAC/D;EACH,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context, TRPCMethods } from "../../utils/trpc.cjs";
|
|
2
|
+
import { BillingService } from "./billing.service.cjs";
|
|
3
|
+
import * as _$_trpc_server0 from "@trpc/server";
|
|
4
|
+
import * as _$stripe from "stripe";
|
|
5
|
+
|
|
6
|
+
//#region src/modules/billing/billing.trpc.d.ts
|
|
7
|
+
declare function createBillingTRPC({
|
|
8
|
+
router,
|
|
9
|
+
privateProcedure: procedure
|
|
10
|
+
}: TRPCMethods, billingService: BillingService): _$_trpc_server0.TRPCBuiltRouter<{
|
|
11
|
+
ctx: Context;
|
|
12
|
+
meta: any;
|
|
13
|
+
errorShape: _$_trpc_server0.TRPCDefaultErrorShape;
|
|
14
|
+
transformer: true;
|
|
15
|
+
}, _$_trpc_server0.TRPCDecorateCreateRouterOptions<{
|
|
16
|
+
getActiveSubscription: _$_trpc_server0.TRPCQueryProcedure<{
|
|
17
|
+
input: void;
|
|
18
|
+
output: {
|
|
19
|
+
id: string;
|
|
20
|
+
plan: string;
|
|
21
|
+
referenceId: string;
|
|
22
|
+
status: string;
|
|
23
|
+
stripeCustomerId?: string | null | undefined;
|
|
24
|
+
stripeSubscriptionId?: string | null | undefined;
|
|
25
|
+
periodStart?: Date | null | undefined;
|
|
26
|
+
periodEnd?: Date | null | undefined;
|
|
27
|
+
cancelAtPeriodEnd?: boolean | null | undefined;
|
|
28
|
+
cancelAt?: Date | null | undefined;
|
|
29
|
+
canceledAt?: Date | null | undefined;
|
|
30
|
+
seats?: number | null | undefined;
|
|
31
|
+
trialStart?: Date | null | undefined;
|
|
32
|
+
trialEnd?: Date | null | undefined;
|
|
33
|
+
priceId?: string | null | undefined;
|
|
34
|
+
interval?: string | null | undefined;
|
|
35
|
+
unitAmount?: number | null | undefined;
|
|
36
|
+
discounts?: string[] | null | undefined;
|
|
37
|
+
} | null;
|
|
38
|
+
meta: any;
|
|
39
|
+
}>;
|
|
40
|
+
listInvoices: _$_trpc_server0.TRPCQueryProcedure<{
|
|
41
|
+
input: void;
|
|
42
|
+
output: _$stripe.Stripe.Invoice[];
|
|
43
|
+
meta: any;
|
|
44
|
+
}>;
|
|
45
|
+
}>>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { createBillingTRPC };
|
|
48
|
+
//# sourceMappingURL=billing.trpc.d.cts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_src_modules_base_base_repository = require("../base/base.repository.cjs");
|
|
4
|
+
let neverthrow = require("neverthrow");
|
|
5
|
+
//#region src/modules/clay/clay.repository.ts
|
|
6
|
+
const { CLAY_WEBHOOK_AUTH_TOKEN } = process.env;
|
|
7
|
+
var ClayRepository = class extends require_src_modules_base_base_repository.BaseExternaRepository {
|
|
8
|
+
async sendToWebhook(webhookUrl, row, callbackUrl) {
|
|
9
|
+
return this.throwableAsync(async () => {
|
|
10
|
+
const response = await fetch(webhookUrl, {
|
|
11
|
+
method: "POST",
|
|
12
|
+
headers: {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
...CLAY_WEBHOOK_AUTH_TOKEN ? { "x-clay-webhook-auth": CLAY_WEBHOOK_AUTH_TOKEN } : {}
|
|
15
|
+
},
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
...row,
|
|
18
|
+
callback: callbackUrl
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) return this.error("BAD_REQUEST", `HTTP error! status: ${response.status}`, { cause: response });
|
|
22
|
+
return (0, neverthrow.ok)();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.ClayRepository = ClayRepository;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=clay.repository.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clay.repository.cjs","names":["BaseExternaRepository"],"sources":["../../../../src/modules/clay/clay.repository.ts"],"sourcesContent":["import { ok } from \"neverthrow\";\r\nimport type { ServerResultAsync } from \"../base/base.dto\";\r\nimport { BaseExternaRepository } from \"../base/base.repository\";\r\n\r\nconst { CLAY_WEBHOOK_AUTH_TOKEN } = process.env;\r\n\r\nexport class ClayRepository extends BaseExternaRepository {\r\n async sendToWebhook(\r\n webhookUrl: string,\r\n row: Record<string, unknown>,\r\n callbackUrl: string\r\n ): ServerResultAsync<void> {\r\n return this.throwableAsync(async () => {\r\n const response = await fetch(webhookUrl, {\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n ...(CLAY_WEBHOOK_AUTH_TOKEN ? { \"x-clay-webhook-auth\": CLAY_WEBHOOK_AUTH_TOKEN } : {}),\r\n },\r\n body: JSON.stringify({ ...row, callback: callbackUrl }),\r\n });\r\n if (!response.ok)\r\n return this.error(\"BAD_REQUEST\", `HTTP error! status: ${response.status}`, {\r\n cause: response,\r\n });\r\n return ok();\r\n });\r\n }\r\n}\r\n"],"mappings":";;;;;AAIA,MAAM,EAAE,4BAA4B,QAAQ;AAE5C,IAAa,iBAAb,cAAoCA,yCAAAA,sBAAsB;CACxD,MAAM,cACJ,YACA,KACA,aACyB;AACzB,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,WAAW,MAAM,MAAM,YAAY;IACvC,QAAQ;IACR,SAAS;KACP,gBAAgB;KAChB,GAAI,0BAA0B,EAAE,uBAAuB,yBAAyB,GAAG,EAAE;KACtF;IACD,MAAM,KAAK,UAAU;KAAE,GAAG;KAAK,UAAU;KAAa,CAAC;IACxD,CAAC;AACF,OAAI,CAAC,SAAS,GACZ,QAAO,KAAK,MAAM,eAAe,uBAAuB,SAAS,UAAU,EACzE,OAAO,UACR,CAAC;AACJ,WAAA,GAAA,WAAA,KAAW;IACX"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ServerResultAsync } from "../base/base.dto.cjs";
|
|
2
|
+
import { BaseExternaRepository } from "../base/base.repository.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/modules/clay/clay.repository.d.ts
|
|
5
|
+
declare class ClayRepository extends BaseExternaRepository {
|
|
6
|
+
sendToWebhook(webhookUrl: string, row: Record<string, unknown>, callbackUrl: string): ServerResultAsync<void>;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ClayRepository };
|
|
10
|
+
//# sourceMappingURL=clay.repository.d.cts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src_modules_base_base_service = require("../base/base.service.cjs");
|
|
3
|
+
//#region src/modules/clay/clay.service.ts
|
|
4
|
+
var ClayService = class extends require_src_modules_base_base_service.BaseService {
|
|
5
|
+
tables;
|
|
6
|
+
constructor(repositories, services, tables) {
|
|
7
|
+
super(repositories, services);
|
|
8
|
+
this.tables = tables;
|
|
9
|
+
}
|
|
10
|
+
async waitForResponse(webhookUrl, row, timeoutInSeconds) {
|
|
11
|
+
return await this.service.webhook.waitForRequest((url) => {
|
|
12
|
+
return this.repository.clay.sendToWebhook(webhookUrl, row, url);
|
|
13
|
+
}, timeoutInSeconds);
|
|
14
|
+
}
|
|
15
|
+
async sendToTable(table, row, timeoutInSeconds) {
|
|
16
|
+
const tableData = this.tables[table];
|
|
17
|
+
if (!tableData) return this.error("NOT_FOUND", `Table ${table} not found`);
|
|
18
|
+
return await this.waitForResponse(tableData.webhookUrl, row, tableData.timeoutInSeconds || timeoutInSeconds);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.ClayService = ClayService;
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=clay.service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clay.service.cjs","names":["BaseService"],"sources":["../../../../src/modules/clay/clay.service.ts"],"sourcesContent":["import type { z } from \"zod\";\r\nimport type { ServerResultAsync } from \"../base/base.dto\";\r\nimport { BaseService } from \"../base/base.service\";\r\nimport type { WebhookService } from \"../webhook/webhook.service\";\r\nimport type { ClayRepository } from \"./clay.repository\";\r\n\r\ntype ClayTable = {\r\n name?: string;\r\n tableId?: string;\r\n viewId?: string;\r\n webhookUrl: string;\r\n schema?: z.ZodAny;\r\n timeoutInSeconds?: number;\r\n};\r\n\r\nexport class ClayService<K extends string> extends BaseService<\r\n { clay: ClayRepository },\r\n { webhook: WebhookService }\r\n> {\r\n private tables: Record<K, ClayTable>;\r\n constructor(\r\n repositories: { clay: ClayRepository },\r\n services: { webhook: WebhookService },\r\n tables: Record<K, ClayTable>\r\n ) {\r\n super(repositories, services);\r\n this.tables = tables;\r\n }\r\n\r\n async waitForResponse<T>(\r\n webhookUrl: string,\r\n row: Record<string, unknown>,\r\n timeoutInSeconds?: number\r\n ): ServerResultAsync<T> {\r\n return await this.service.webhook.waitForRequest<T>((url) => {\r\n return this.repository.clay.sendToWebhook(webhookUrl, row, url);\r\n }, timeoutInSeconds);\r\n }\r\n\r\n async sendToTable(\r\n table: K,\r\n row: Record<string, unknown>,\r\n timeoutInSeconds?: number\r\n ): ServerResultAsync<\r\n z.infer<\r\n (typeof this.tables)[K][\"schema\"] extends z.ZodAny\r\n ? z.infer<(typeof this.tables)[K][\"schema\"]>\r\n : unknown\r\n >\r\n > {\r\n const tableData = this.tables[table];\r\n if (!tableData) return this.error(\"NOT_FOUND\", `Table ${table} not found`);\r\n const response = await this.waitForResponse<z.infer<typeof tableData.schema>>(\r\n tableData.webhookUrl,\r\n row,\r\n tableData.timeoutInSeconds || timeoutInSeconds\r\n );\r\n\r\n return response;\r\n }\r\n}\r\n"],"mappings":";;;AAeA,IAAa,cAAb,cAAmDA,sCAAAA,YAGjD;CACA;CACA,YACE,cACA,UACA,QACA;AACA,QAAM,cAAc,SAAS;AAC7B,OAAK,SAAS;;CAGhB,MAAM,gBACJ,YACA,KACA,kBACsB;AACtB,SAAO,MAAM,KAAK,QAAQ,QAAQ,gBAAmB,QAAQ;AAC3D,UAAO,KAAK,WAAW,KAAK,cAAc,YAAY,KAAK,IAAI;KAC9D,iBAAiB;;CAGtB,MAAM,YACJ,OACA,KACA,kBAOA;EACA,MAAM,YAAY,KAAK,OAAO;AAC9B,MAAI,CAAC,UAAW,QAAO,KAAK,MAAM,aAAa,SAAS,MAAM,YAAY;AAO1E,SANiB,MAAM,KAAK,gBAC1B,UAAU,YACV,KACA,UAAU,oBAAoB,iBAC/B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ServerResultAsync } from "../base/base.dto.cjs";
|
|
2
|
+
import { BaseService } from "../base/base.service.cjs";
|
|
3
|
+
import { ClayRepository } from "./clay.repository.cjs";
|
|
4
|
+
import { WebhookService } from "../webhook/webhook.service.cjs";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/modules/clay/clay.service.d.ts
|
|
8
|
+
type ClayTable = {
|
|
9
|
+
name?: string;
|
|
10
|
+
tableId?: string;
|
|
11
|
+
viewId?: string;
|
|
12
|
+
webhookUrl: string;
|
|
13
|
+
schema?: z.ZodAny;
|
|
14
|
+
timeoutInSeconds?: number;
|
|
15
|
+
};
|
|
16
|
+
declare class ClayService<K extends string> extends BaseService<{
|
|
17
|
+
clay: ClayRepository;
|
|
18
|
+
}, {
|
|
19
|
+
webhook: WebhookService;
|
|
20
|
+
}> {
|
|
21
|
+
private tables;
|
|
22
|
+
constructor(repositories: {
|
|
23
|
+
clay: ClayRepository;
|
|
24
|
+
}, services: {
|
|
25
|
+
webhook: WebhookService;
|
|
26
|
+
}, tables: Record<K, ClayTable>);
|
|
27
|
+
waitForResponse<T>(webhookUrl: string, row: Record<string, unknown>, timeoutInSeconds?: number): ServerResultAsync<T>;
|
|
28
|
+
sendToTable(table: K, row: Record<string, unknown>, timeoutInSeconds?: number): ServerResultAsync<z.infer<(typeof this.tables)[K]["schema"] extends z.ZodAny ? z.infer<(typeof this.tables)[K]["schema"]> : unknown>>;
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ClayService };
|
|
32
|
+
//# sourceMappingURL=clay.service.d.cts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let drizzle_orm_sqlite_core = require("drizzle-orm/sqlite-core");
|
|
4
|
+
let uuid = require("uuid");
|
|
5
|
+
//#region src/modules/connect/connect.db.ts
|
|
6
|
+
var connect_db_exports = /* @__PURE__ */ require_runtime.__exportAll({ connect: () => connect });
|
|
7
|
+
const connect = (0, drizzle_orm_sqlite_core.sqliteTable)("connect", {
|
|
8
|
+
id: (0, drizzle_orm_sqlite_core.text)("id").primaryKey().$default(uuid.v4),
|
|
9
|
+
userId: (0, drizzle_orm_sqlite_core.text)("user_id").notNull(),
|
|
10
|
+
provider: (0, drizzle_orm_sqlite_core.text)("provider").notNull(),
|
|
11
|
+
accountType: (0, drizzle_orm_sqlite_core.text)("account_type").notNull(),
|
|
12
|
+
providerAccountId: (0, drizzle_orm_sqlite_core.text)("provider_account_id").notNull(),
|
|
13
|
+
handle: (0, drizzle_orm_sqlite_core.text)("handle"),
|
|
14
|
+
displayName: (0, drizzle_orm_sqlite_core.text)("display_name"),
|
|
15
|
+
avatarUrl: (0, drizzle_orm_sqlite_core.text)("avatar_url"),
|
|
16
|
+
accessToken: (0, drizzle_orm_sqlite_core.text)("access_token").notNull(),
|
|
17
|
+
refreshToken: (0, drizzle_orm_sqlite_core.text)("refresh_token"),
|
|
18
|
+
tokenType: (0, drizzle_orm_sqlite_core.text)("token_type"),
|
|
19
|
+
scope: (0, drizzle_orm_sqlite_core.text)("scope"),
|
|
20
|
+
expiresAt: (0, drizzle_orm_sqlite_core.integer)("expires_at", { mode: "timestamp" }),
|
|
21
|
+
parentId: (0, drizzle_orm_sqlite_core.text)("parent_id"),
|
|
22
|
+
metadataJson: (0, drizzle_orm_sqlite_core.text)("metadata_json", { mode: "json" }),
|
|
23
|
+
revokedAt: (0, drizzle_orm_sqlite_core.integer)("revoked_at", { mode: "timestamp" }),
|
|
24
|
+
lastRefreshedAt: (0, drizzle_orm_sqlite_core.integer)("last_refreshed_at", { mode: "timestamp" }),
|
|
25
|
+
createdAt: (0, drizzle_orm_sqlite_core.integer)("created_at", { mode: "timestamp" }).notNull().$default(() => /* @__PURE__ */ new Date()),
|
|
26
|
+
updatedAt: (0, drizzle_orm_sqlite_core.integer)("updated_at", { mode: "timestamp" })
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.connect = connect;
|
|
30
|
+
Object.defineProperty(exports, "connect_db_exports", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function() {
|
|
33
|
+
return connect_db_exports;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=connect.db.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.db.cjs","names":["uuidv4"],"sources":["../../../../src/modules/connect/connect.db.ts"],"sourcesContent":["import { integer, sqliteTable, text } from \"drizzle-orm/sqlite-core\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\n\r\nexport const connect = sqliteTable(\"connect\", {\r\n id: text(\"id\").primaryKey().$default(uuidv4),\r\n userId: text(\"user_id\").notNull(), // FK -> users.id\r\n\r\n provider: text(\"provider\").notNull(), // e.g. \"linkedin\"\r\n accountType: text(\"account_type\").notNull(), // \"user\" | \"page\" | \"org\" | \"channel\"\r\n providerAccountId: text(\"provider_account_id\").notNull(), // e.g. LinkedIn URN, FB Page ID, IG business acct ID, X user ID\r\n handle: text(\"handle\"), // @name or page slug\r\n displayName: text(\"display_name\"),\r\n avatarUrl: text(\"avatar_url\"),\r\n\r\n // OAuth credentials (ENCRYPTED)\r\n accessToken: text(\"access_token\").notNull(),\r\n refreshToken: text(\"refresh_token\"), // may be null if provider doesn’t issue refresh tokens\r\n tokenType: text(\"token_type\"), // e.g. \"bearer\"\r\n scope: text(\"scope\"), // space- or comma-separated list, for auditing\r\n expiresAt: integer(\"expires_at\", { mode: \"timestamp\" }), // epoch seconds\r\n\r\n // Provider-specific glue\r\n parentId: text(\"parent_id\"), // e.g. FB Page’s connected IG business account, or org URN\r\n metadataJson: text(\"metadata_json\", { mode: \"json\" }), // JSON string for extras (region, perms, etc.)\r\n\r\n revokedAt: integer(\"revoked_at\", { mode: \"timestamp\" }),\r\n lastRefreshedAt: integer(\"last_refreshed_at\", { mode: \"timestamp\" }),\r\n createdAt: integer(\"created_at\", { mode: \"timestamp\" })\r\n .notNull()\r\n .$default(() => new Date()),\r\n updatedAt: integer(\"updated_at\", { mode: \"timestamp\" }),\r\n});\r\n"],"mappings":";;;;;;AAGA,MAAa,WAAA,GAAA,wBAAA,aAAsB,WAAW;CAC5C,KAAA,GAAA,wBAAA,MAAS,KAAK,CAAC,YAAY,CAAC,SAASA,KAAAA,GAAO;CAC5C,SAAA,GAAA,wBAAA,MAAa,UAAU,CAAC,SAAS;CAEjC,WAAA,GAAA,wBAAA,MAAe,WAAW,CAAC,SAAS;CACpC,cAAA,GAAA,wBAAA,MAAkB,eAAe,CAAC,SAAS;CAC3C,oBAAA,GAAA,wBAAA,MAAwB,sBAAsB,CAAC,SAAS;CACxD,SAAA,GAAA,wBAAA,MAAa,SAAS;CACtB,cAAA,GAAA,wBAAA,MAAkB,eAAe;CACjC,YAAA,GAAA,wBAAA,MAAgB,aAAa;CAG7B,cAAA,GAAA,wBAAA,MAAkB,eAAe,CAAC,SAAS;CAC3C,eAAA,GAAA,wBAAA,MAAmB,gBAAgB;CACnC,YAAA,GAAA,wBAAA,MAAgB,aAAa;CAC7B,QAAA,GAAA,wBAAA,MAAY,QAAQ;CACpB,YAAA,GAAA,wBAAA,SAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;CAGvD,WAAA,GAAA,wBAAA,MAAe,YAAY;CAC3B,eAAA,GAAA,wBAAA,MAAmB,iBAAiB,EAAE,MAAM,QAAQ,CAAC;CAErD,YAAA,GAAA,wBAAA,SAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;CACvD,kBAAA,GAAA,wBAAA,SAAyB,qBAAqB,EAAE,MAAM,aAAa,CAAC;CACpE,YAAA,GAAA,wBAAA,SAAmB,cAAc,EAAE,MAAM,aAAa,CAAC,CACpD,SAAS,CACT,+BAAe,IAAI,MAAM,CAAC;CAC7B,YAAA,GAAA,wBAAA,SAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;CACxD,CAAC"}
|