@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,61 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_src_modules_base_base_service = require("../base/base.service.cjs");
|
|
4
|
+
const require_src_modules_webhook_webhook_constants = require("./webhook.constants.cjs");
|
|
5
|
+
let neverthrow = require("neverthrow");
|
|
6
|
+
let _m5kdev_commons_utils_json = require("@m5kdev/commons/utils/json");
|
|
7
|
+
//#region src/modules/webhook/webhook.service.ts
|
|
8
|
+
var WebhookService = class extends require_src_modules_base_base_service.BaseService {
|
|
9
|
+
async completed(id, payload) {
|
|
10
|
+
const result = await this.repository.webhook.completed(id, payload);
|
|
11
|
+
if (result.isErr()) {
|
|
12
|
+
await this.repository.webhook.registerError(id, require_src_modules_webhook_webhook_constants.WEBHOOK_STATUS_ENUM.ERROR_DATA, JSON.stringify(result.error));
|
|
13
|
+
return this.error("INTERNAL_SERVER_ERROR", "Webhook completed failed", { cause: result.error });
|
|
14
|
+
}
|
|
15
|
+
return (0, neverthrow.ok)();
|
|
16
|
+
}
|
|
17
|
+
async waitForRequest(callback, timeoutSec = 60) {
|
|
18
|
+
const webhook = await this.repository.webhook.create({ timeoutSec });
|
|
19
|
+
if (webhook.isErr()) return Promise.reject(webhook.error);
|
|
20
|
+
const url = `${process.env.NGROK_LOCALHOST_TUNNEL || process.env.VITE_SERVER_URL}/webhook/${webhook.value.id}`;
|
|
21
|
+
try {
|
|
22
|
+
await callback(url);
|
|
23
|
+
} catch (error) {
|
|
24
|
+
await this.repository.webhook.registerError(webhook.value.id, require_src_modules_webhook_webhook_constants.WEBHOOK_STATUS_ENUM.ERROR_CALLBACK, JSON.stringify(error));
|
|
25
|
+
return this.error("INTERNAL_SERVER_ERROR", "Error callback failed", { cause: error });
|
|
26
|
+
}
|
|
27
|
+
const endTime = new Date(webhook.value.createdAt).getTime() + timeoutSec * 1e3;
|
|
28
|
+
return await new Promise((resolve, reject) => {
|
|
29
|
+
const intervalId = setInterval(async () => {
|
|
30
|
+
if (Date.now() > endTime) {
|
|
31
|
+
await this.repository.webhook.timeout(webhook.value.id);
|
|
32
|
+
clearInterval(intervalId);
|
|
33
|
+
return reject(this.error("TIMEOUT", "Wait for request timeout"));
|
|
34
|
+
}
|
|
35
|
+
const result = await this.repository.webhook.findById(webhook.value.id);
|
|
36
|
+
if (result.isErr()) {
|
|
37
|
+
clearInterval(intervalId);
|
|
38
|
+
return reject((0, neverthrow.err)(result.error));
|
|
39
|
+
}
|
|
40
|
+
if (!result.value) {
|
|
41
|
+
clearInterval(intervalId);
|
|
42
|
+
return reject(this.error("NOT_FOUND", "Wait for request failed: cannot find webhook"));
|
|
43
|
+
}
|
|
44
|
+
const { status, payload } = result.value;
|
|
45
|
+
if (status === "COMPLETED") {
|
|
46
|
+
const data = payload ? (0, _m5kdev_commons_utils_json.safeParseJson)(payload, payload) : payload;
|
|
47
|
+
clearInterval(intervalId);
|
|
48
|
+
return resolve((0, neverthrow.ok)(data));
|
|
49
|
+
}
|
|
50
|
+
if (status !== "WAITING") {
|
|
51
|
+
clearInterval(intervalId);
|
|
52
|
+
return reject(this.error("BAD_REQUEST", "Wait for request failed"));
|
|
53
|
+
}
|
|
54
|
+
}, 1e3);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.WebhookService = WebhookService;
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=webhook.service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook.service.cjs","names":["BaseService","WEBHOOK_STATUS_ENUM"],"sources":["../../../../src/modules/webhook/webhook.service.ts"],"sourcesContent":["import { safeParseJson } from \"@m5kdev/commons/utils/json\";\r\nimport { err, ok } from \"neverthrow\";\r\nimport type { ServerResult, ServerResultAsync } from \"../base/base.dto\";\r\nimport { BaseService } from \"../base/base.service\";\r\nimport { WEBHOOK_STATUS_ENUM } from \"./webhook.constants\";\r\nimport type { WebhookRepository } from \"./webhook.repository\";\r\n\r\nexport class WebhookService extends BaseService<{ webhook: WebhookRepository }, never> {\r\n async completed(id: string, payload: unknown): ServerResultAsync<void> {\r\n const result = await this.repository.webhook.completed(id, payload);\r\n if (result.isErr()) {\r\n await this.repository.webhook.registerError(\r\n id,\r\n WEBHOOK_STATUS_ENUM.ERROR_DATA,\r\n JSON.stringify(result.error)\r\n );\r\n return this.error(\"INTERNAL_SERVER_ERROR\", \"Webhook completed failed\", {\r\n cause: result.error,\r\n });\r\n }\r\n return ok();\r\n }\r\n\r\n async waitForRequest<T>(callback: (url: string) => any, timeoutSec = 60): ServerResultAsync<T> {\r\n const webhook = await this.repository.webhook.create({\r\n timeoutSec,\r\n });\r\n if (webhook.isErr()) return Promise.reject(webhook.error);\r\n const url = `${process.env.NGROK_LOCALHOST_TUNNEL || process.env.VITE_SERVER_URL}/webhook/${webhook.value.id}`;\r\n try {\r\n await callback(url);\r\n } catch (error) {\r\n await this.repository.webhook.registerError(\r\n webhook.value.id,\r\n WEBHOOK_STATUS_ENUM.ERROR_CALLBACK,\r\n JSON.stringify(error)\r\n );\r\n return this.error(\"INTERNAL_SERVER_ERROR\", \"Error callback failed\", { cause: error });\r\n }\r\n\r\n const startTime = new Date(webhook.value.createdAt).getTime();\r\n const endTime = startTime + timeoutSec * 1000;\r\n\r\n const promise = await new Promise<ServerResult<T>>((resolve, reject) => {\r\n const intervalId = setInterval(async () => {\r\n const currentTime = Date.now();\r\n\r\n // Check if the timeout is reached\r\n if (currentTime > endTime) {\r\n await this.repository.webhook.timeout(webhook.value.id);\r\n clearInterval(intervalId);\r\n return reject(this.error(\"TIMEOUT\", \"Wait for request timeout\"));\r\n }\r\n const result = await this.repository.webhook.findById(webhook.value.id);\r\n if (result.isErr()) {\r\n clearInterval(intervalId);\r\n return reject(err(result.error));\r\n }\r\n\r\n if (!result.value) {\r\n clearInterval(intervalId);\r\n return reject(this.error(\"NOT_FOUND\", \"Wait for request failed: cannot find webhook\"));\r\n }\r\n const { status, payload } = result.value;\r\n if (status === \"COMPLETED\") {\r\n const data = payload ? safeParseJson<T>(payload, payload as T) : (payload as T);\r\n clearInterval(intervalId);\r\n return resolve(ok(data));\r\n }\r\n if (status !== \"WAITING\") {\r\n clearInterval(intervalId);\r\n return reject(this.error(\"BAD_REQUEST\", \"Wait for request failed\"));\r\n }\r\n }, 1000);\r\n });\r\n return promise;\r\n }\r\n}\r\n"],"mappings":";;;;;;;AAOA,IAAa,iBAAb,cAAoCA,sCAAAA,YAAmD;CACrF,MAAM,UAAU,IAAY,SAA2C;EACrE,MAAM,SAAS,MAAM,KAAK,WAAW,QAAQ,UAAU,IAAI,QAAQ;AACnE,MAAI,OAAO,OAAO,EAAE;AAClB,SAAM,KAAK,WAAW,QAAQ,cAC5B,IACAC,8CAAAA,oBAAoB,YACpB,KAAK,UAAU,OAAO,MAAM,CAC7B;AACD,UAAO,KAAK,MAAM,yBAAyB,4BAA4B,EACrE,OAAO,OAAO,OACf,CAAC;;AAEJ,UAAA,GAAA,WAAA,KAAW;;CAGb,MAAM,eAAkB,UAAgC,aAAa,IAA0B;EAC7F,MAAM,UAAU,MAAM,KAAK,WAAW,QAAQ,OAAO,EACnD,YACD,CAAC;AACF,MAAI,QAAQ,OAAO,CAAE,QAAO,QAAQ,OAAO,QAAQ,MAAM;EACzD,MAAM,MAAM,GAAG,QAAQ,IAAI,0BAA0B,QAAQ,IAAI,gBAAgB,WAAW,QAAQ,MAAM;AAC1G,MAAI;AACF,SAAM,SAAS,IAAI;WACZ,OAAO;AACd,SAAM,KAAK,WAAW,QAAQ,cAC5B,QAAQ,MAAM,IACdA,8CAAAA,oBAAoB,gBACpB,KAAK,UAAU,MAAM,CACtB;AACD,UAAO,KAAK,MAAM,yBAAyB,yBAAyB,EAAE,OAAO,OAAO,CAAC;;EAIvF,MAAM,UADY,IAAI,KAAK,QAAQ,MAAM,UAAU,CAAC,SAAS,GACjC,aAAa;AAkCzC,SAhCgB,MAAM,IAAI,SAA0B,SAAS,WAAW;GACtE,MAAM,aAAa,YAAY,YAAY;AAIzC,QAHoB,KAAK,KAAK,GAGZ,SAAS;AACzB,WAAM,KAAK,WAAW,QAAQ,QAAQ,QAAQ,MAAM,GAAG;AACvD,mBAAc,WAAW;AACzB,YAAO,OAAO,KAAK,MAAM,WAAW,2BAA2B,CAAC;;IAElE,MAAM,SAAS,MAAM,KAAK,WAAW,QAAQ,SAAS,QAAQ,MAAM,GAAG;AACvE,QAAI,OAAO,OAAO,EAAE;AAClB,mBAAc,WAAW;AACzB,YAAO,QAAA,GAAA,WAAA,KAAW,OAAO,MAAM,CAAC;;AAGlC,QAAI,CAAC,OAAO,OAAO;AACjB,mBAAc,WAAW;AACzB,YAAO,OAAO,KAAK,MAAM,aAAa,+CAA+C,CAAC;;IAExF,MAAM,EAAE,QAAQ,YAAY,OAAO;AACnC,QAAI,WAAW,aAAa;KAC1B,MAAM,OAAO,WAAA,GAAA,2BAAA,eAA2B,SAAS,QAAa,GAAI;AAClE,mBAAc,WAAW;AACzB,YAAO,SAAA,GAAA,WAAA,IAAW,KAAK,CAAC;;AAE1B,QAAI,WAAW,WAAW;AACxB,mBAAc,WAAW;AACzB,YAAO,OAAO,KAAK,MAAM,eAAe,0BAA0B,CAAC;;MAEpE,IAAK;IACR"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ServerResultAsync } from "../base/base.dto.cjs";
|
|
2
|
+
import { BaseService } from "../base/base.service.cjs";
|
|
3
|
+
import { WebhookRepository } from "./webhook.repository.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/modules/webhook/webhook.service.d.ts
|
|
6
|
+
declare class WebhookService extends BaseService<{
|
|
7
|
+
webhook: WebhookRepository;
|
|
8
|
+
}, never> {
|
|
9
|
+
completed(id: string, payload: unknown): ServerResultAsync<void>;
|
|
10
|
+
waitForRequest<T>(callback: (url: string) => any, timeoutSec?: number): ServerResultAsync<T>;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { WebhookService };
|
|
14
|
+
//# sourceMappingURL=webhook.service.d.cts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_src_modules_auth_auth_db = require("../auth/auth.db.cjs");
|
|
4
|
+
let drizzle_orm_sqlite_core = require("drizzle-orm/sqlite-core");
|
|
5
|
+
let uuid = require("uuid");
|
|
6
|
+
//#region src/modules/workflow/workflow.db.ts
|
|
7
|
+
var workflow_db_exports = /* @__PURE__ */ require_runtime.__exportAll({ workflows: () => workflows });
|
|
8
|
+
const workflows = (0, drizzle_orm_sqlite_core.sqliteTable)("workflows", {
|
|
9
|
+
id: (0, drizzle_orm_sqlite_core.text)("id").primaryKey().$default(uuid.v4),
|
|
10
|
+
userId: (0, drizzle_orm_sqlite_core.text)("user_id").references(() => require_src_modules_auth_auth_db.users.id, { onDelete: "cascade" }),
|
|
11
|
+
jobId: (0, drizzle_orm_sqlite_core.text)("job_id").unique().notNull(),
|
|
12
|
+
jobName: (0, drizzle_orm_sqlite_core.text)("job_name").notNull(),
|
|
13
|
+
queueName: (0, drizzle_orm_sqlite_core.text)("queue_name").notNull(),
|
|
14
|
+
timeout: (0, drizzle_orm_sqlite_core.integer)("timeout"),
|
|
15
|
+
tags: (0, drizzle_orm_sqlite_core.text)("tags", { mode: "json" }).$default(() => []).$type(),
|
|
16
|
+
input: (0, drizzle_orm_sqlite_core.text)("input", { mode: "json" }),
|
|
17
|
+
output: (0, drizzle_orm_sqlite_core.text)("output", { mode: "json" }),
|
|
18
|
+
status: (0, drizzle_orm_sqlite_core.text)("status").notNull().$type(),
|
|
19
|
+
error: (0, drizzle_orm_sqlite_core.text)("error"),
|
|
20
|
+
retries: (0, drizzle_orm_sqlite_core.integer)("retries").notNull().default(0),
|
|
21
|
+
finishedAt: (0, drizzle_orm_sqlite_core.integer)("finished_at", { mode: "timestamp" }),
|
|
22
|
+
processedAt: (0, drizzle_orm_sqlite_core.integer)("processed_at", { mode: "timestamp" }),
|
|
23
|
+
createdAt: (0, drizzle_orm_sqlite_core.integer)("created_at", { mode: "timestamp" }).notNull().$default(() => /* @__PURE__ */ new Date()),
|
|
24
|
+
updatedAt: (0, drizzle_orm_sqlite_core.integer)("updated_at", { mode: "timestamp" }).notNull().$default(() => /* @__PURE__ */ new Date())
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
Object.defineProperty(exports, "workflow_db_exports", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return workflow_db_exports;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
exports.workflows = workflows;
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=workflow.db.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.db.cjs","names":["uuidv4","users"],"sources":["../../../../src/modules/workflow/workflow.db.ts"],"sourcesContent":["import type { WorkflowStatus } from \"@m5kdev/commons/modules/workflow/workflow.constants\";\r\nimport { integer, sqliteTable as table, text } from \"drizzle-orm/sqlite-core\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\nimport { users } from \"../auth/auth.db\";\r\n\r\nexport const workflows = table(\"workflows\", {\r\n id: text(\"id\").primaryKey().$default(uuidv4),\r\n userId: text(\"user_id\").references(() => users.id, { onDelete: \"cascade\" }),\r\n jobId: text(\"job_id\").unique().notNull(),\r\n jobName: text(\"job_name\").notNull(),\r\n queueName: text(\"queue_name\").notNull(),\r\n timeout: integer(\"timeout\"),\r\n tags: text(\"tags\", { mode: \"json\" })\r\n .$default(() => [])\r\n .$type<string[]>(),\r\n input: text(\"input\", { mode: \"json\" }),\r\n output: text(\"output\", { mode: \"json\" }),\r\n status: text(\"status\").notNull().$type<WorkflowStatus>(),\r\n error: text(\"error\"),\r\n retries: integer(\"retries\").notNull().default(0),\r\n finishedAt: integer(\"finished_at\", { mode: \"timestamp\" }),\r\n processedAt: integer(\"processed_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 .notNull()\r\n .$default(() => new Date()),\r\n});\r\n"],"mappings":";;;;;;;AAKA,MAAa,aAAA,GAAA,wBAAA,aAAkB,aAAa;CAC1C,KAAA,GAAA,wBAAA,MAAS,KAAK,CAAC,YAAY,CAAC,SAASA,KAAAA,GAAO;CAC5C,SAAA,GAAA,wBAAA,MAAa,UAAU,CAAC,iBAAiBC,iCAAAA,MAAM,IAAI,EAAE,UAAU,WAAW,CAAC;CAC3E,QAAA,GAAA,wBAAA,MAAY,SAAS,CAAC,QAAQ,CAAC,SAAS;CACxC,UAAA,GAAA,wBAAA,MAAc,WAAW,CAAC,SAAS;CACnC,YAAA,GAAA,wBAAA,MAAgB,aAAa,CAAC,SAAS;CACvC,UAAA,GAAA,wBAAA,SAAiB,UAAU;CAC3B,OAAA,GAAA,wBAAA,MAAW,QAAQ,EAAE,MAAM,QAAQ,CAAC,CACjC,eAAe,EAAE,CAAC,CAClB,OAAiB;CACpB,QAAA,GAAA,wBAAA,MAAY,SAAS,EAAE,MAAM,QAAQ,CAAC;CACtC,SAAA,GAAA,wBAAA,MAAa,UAAU,EAAE,MAAM,QAAQ,CAAC;CACxC,SAAA,GAAA,wBAAA,MAAa,SAAS,CAAC,SAAS,CAAC,OAAuB;CACxD,QAAA,GAAA,wBAAA,MAAY,QAAQ;CACpB,UAAA,GAAA,wBAAA,SAAiB,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE;CAChD,aAAA,GAAA,wBAAA,SAAoB,eAAe,EAAE,MAAM,aAAa,CAAC;CACzD,cAAA,GAAA,wBAAA,SAAqB,gBAAgB,EAAE,MAAM,aAAa,CAAC;CAC3D,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,CACpD,SAAS,CACT,+BAAe,IAAI,MAAM,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
|
|
2
|
+
|
|
3
|
+
//#region src/modules/workflow/workflow.db.d.ts
|
|
4
|
+
declare const workflows: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
5
|
+
name: "workflows";
|
|
6
|
+
schema: undefined;
|
|
7
|
+
columns: {
|
|
8
|
+
id: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
9
|
+
name: "id";
|
|
10
|
+
tableName: "workflows";
|
|
11
|
+
dataType: "string";
|
|
12
|
+
columnType: "SQLiteText";
|
|
13
|
+
data: string;
|
|
14
|
+
driverParam: string;
|
|
15
|
+
notNull: true;
|
|
16
|
+
hasDefault: true;
|
|
17
|
+
isPrimaryKey: true;
|
|
18
|
+
isAutoincrement: false;
|
|
19
|
+
hasRuntimeDefault: true;
|
|
20
|
+
enumValues: [string, ...string[]];
|
|
21
|
+
baseColumn: never;
|
|
22
|
+
identity: undefined;
|
|
23
|
+
generated: undefined;
|
|
24
|
+
}, {}, {
|
|
25
|
+
length: number | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
userId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
28
|
+
name: "user_id";
|
|
29
|
+
tableName: "workflows";
|
|
30
|
+
dataType: "string";
|
|
31
|
+
columnType: "SQLiteText";
|
|
32
|
+
data: string;
|
|
33
|
+
driverParam: string;
|
|
34
|
+
notNull: false;
|
|
35
|
+
hasDefault: false;
|
|
36
|
+
isPrimaryKey: false;
|
|
37
|
+
isAutoincrement: false;
|
|
38
|
+
hasRuntimeDefault: false;
|
|
39
|
+
enumValues: [string, ...string[]];
|
|
40
|
+
baseColumn: never;
|
|
41
|
+
identity: undefined;
|
|
42
|
+
generated: undefined;
|
|
43
|
+
}, {}, {
|
|
44
|
+
length: number | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
jobId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
47
|
+
name: "job_id";
|
|
48
|
+
tableName: "workflows";
|
|
49
|
+
dataType: "string";
|
|
50
|
+
columnType: "SQLiteText";
|
|
51
|
+
data: string;
|
|
52
|
+
driverParam: string;
|
|
53
|
+
notNull: true;
|
|
54
|
+
hasDefault: false;
|
|
55
|
+
isPrimaryKey: false;
|
|
56
|
+
isAutoincrement: false;
|
|
57
|
+
hasRuntimeDefault: false;
|
|
58
|
+
enumValues: [string, ...string[]];
|
|
59
|
+
baseColumn: never;
|
|
60
|
+
identity: undefined;
|
|
61
|
+
generated: undefined;
|
|
62
|
+
}, {}, {
|
|
63
|
+
length: number | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
jobName: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
66
|
+
name: "job_name";
|
|
67
|
+
tableName: "workflows";
|
|
68
|
+
dataType: "string";
|
|
69
|
+
columnType: "SQLiteText";
|
|
70
|
+
data: string;
|
|
71
|
+
driverParam: string;
|
|
72
|
+
notNull: true;
|
|
73
|
+
hasDefault: false;
|
|
74
|
+
isPrimaryKey: false;
|
|
75
|
+
isAutoincrement: false;
|
|
76
|
+
hasRuntimeDefault: false;
|
|
77
|
+
enumValues: [string, ...string[]];
|
|
78
|
+
baseColumn: never;
|
|
79
|
+
identity: undefined;
|
|
80
|
+
generated: undefined;
|
|
81
|
+
}, {}, {
|
|
82
|
+
length: number | undefined;
|
|
83
|
+
}>;
|
|
84
|
+
queueName: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
85
|
+
name: "queue_name";
|
|
86
|
+
tableName: "workflows";
|
|
87
|
+
dataType: "string";
|
|
88
|
+
columnType: "SQLiteText";
|
|
89
|
+
data: string;
|
|
90
|
+
driverParam: string;
|
|
91
|
+
notNull: true;
|
|
92
|
+
hasDefault: false;
|
|
93
|
+
isPrimaryKey: false;
|
|
94
|
+
isAutoincrement: false;
|
|
95
|
+
hasRuntimeDefault: false;
|
|
96
|
+
enumValues: [string, ...string[]];
|
|
97
|
+
baseColumn: never;
|
|
98
|
+
identity: undefined;
|
|
99
|
+
generated: undefined;
|
|
100
|
+
}, {}, {
|
|
101
|
+
length: number | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
timeout: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
104
|
+
name: "timeout";
|
|
105
|
+
tableName: "workflows";
|
|
106
|
+
dataType: "number";
|
|
107
|
+
columnType: "SQLiteInteger";
|
|
108
|
+
data: number;
|
|
109
|
+
driverParam: number;
|
|
110
|
+
notNull: false;
|
|
111
|
+
hasDefault: false;
|
|
112
|
+
isPrimaryKey: false;
|
|
113
|
+
isAutoincrement: false;
|
|
114
|
+
hasRuntimeDefault: false;
|
|
115
|
+
enumValues: undefined;
|
|
116
|
+
baseColumn: never;
|
|
117
|
+
identity: undefined;
|
|
118
|
+
generated: undefined;
|
|
119
|
+
}, {}, {}>;
|
|
120
|
+
tags: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
121
|
+
name: "tags";
|
|
122
|
+
tableName: "workflows";
|
|
123
|
+
dataType: "json";
|
|
124
|
+
columnType: "SQLiteTextJson";
|
|
125
|
+
data: string[];
|
|
126
|
+
driverParam: string;
|
|
127
|
+
notNull: false;
|
|
128
|
+
hasDefault: true;
|
|
129
|
+
isPrimaryKey: false;
|
|
130
|
+
isAutoincrement: false;
|
|
131
|
+
hasRuntimeDefault: true;
|
|
132
|
+
enumValues: undefined;
|
|
133
|
+
baseColumn: never;
|
|
134
|
+
identity: undefined;
|
|
135
|
+
generated: undefined;
|
|
136
|
+
}, {}, {
|
|
137
|
+
$type: string[];
|
|
138
|
+
}>;
|
|
139
|
+
input: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
140
|
+
name: "input";
|
|
141
|
+
tableName: "workflows";
|
|
142
|
+
dataType: "json";
|
|
143
|
+
columnType: "SQLiteTextJson";
|
|
144
|
+
data: unknown;
|
|
145
|
+
driverParam: string;
|
|
146
|
+
notNull: false;
|
|
147
|
+
hasDefault: false;
|
|
148
|
+
isPrimaryKey: false;
|
|
149
|
+
isAutoincrement: false;
|
|
150
|
+
hasRuntimeDefault: false;
|
|
151
|
+
enumValues: undefined;
|
|
152
|
+
baseColumn: never;
|
|
153
|
+
identity: undefined;
|
|
154
|
+
generated: undefined;
|
|
155
|
+
}, {}, {}>;
|
|
156
|
+
output: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
157
|
+
name: "output";
|
|
158
|
+
tableName: "workflows";
|
|
159
|
+
dataType: "json";
|
|
160
|
+
columnType: "SQLiteTextJson";
|
|
161
|
+
data: unknown;
|
|
162
|
+
driverParam: string;
|
|
163
|
+
notNull: false;
|
|
164
|
+
hasDefault: false;
|
|
165
|
+
isPrimaryKey: false;
|
|
166
|
+
isAutoincrement: false;
|
|
167
|
+
hasRuntimeDefault: false;
|
|
168
|
+
enumValues: undefined;
|
|
169
|
+
baseColumn: never;
|
|
170
|
+
identity: undefined;
|
|
171
|
+
generated: undefined;
|
|
172
|
+
}, {}, {}>;
|
|
173
|
+
status: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
174
|
+
name: "status";
|
|
175
|
+
tableName: "workflows";
|
|
176
|
+
dataType: "string";
|
|
177
|
+
columnType: "SQLiteText";
|
|
178
|
+
data: "queued" | "running" | "completed" | "failed";
|
|
179
|
+
driverParam: string;
|
|
180
|
+
notNull: true;
|
|
181
|
+
hasDefault: false;
|
|
182
|
+
isPrimaryKey: false;
|
|
183
|
+
isAutoincrement: false;
|
|
184
|
+
hasRuntimeDefault: false;
|
|
185
|
+
enumValues: [string, ...string[]];
|
|
186
|
+
baseColumn: never;
|
|
187
|
+
identity: undefined;
|
|
188
|
+
generated: undefined;
|
|
189
|
+
}, {}, {
|
|
190
|
+
length: number | undefined;
|
|
191
|
+
$type: "queued" | "running" | "completed" | "failed";
|
|
192
|
+
}>;
|
|
193
|
+
error: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
194
|
+
name: "error";
|
|
195
|
+
tableName: "workflows";
|
|
196
|
+
dataType: "string";
|
|
197
|
+
columnType: "SQLiteText";
|
|
198
|
+
data: string;
|
|
199
|
+
driverParam: string;
|
|
200
|
+
notNull: false;
|
|
201
|
+
hasDefault: false;
|
|
202
|
+
isPrimaryKey: false;
|
|
203
|
+
isAutoincrement: false;
|
|
204
|
+
hasRuntimeDefault: false;
|
|
205
|
+
enumValues: [string, ...string[]];
|
|
206
|
+
baseColumn: never;
|
|
207
|
+
identity: undefined;
|
|
208
|
+
generated: undefined;
|
|
209
|
+
}, {}, {
|
|
210
|
+
length: number | undefined;
|
|
211
|
+
}>;
|
|
212
|
+
retries: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
213
|
+
name: "retries";
|
|
214
|
+
tableName: "workflows";
|
|
215
|
+
dataType: "number";
|
|
216
|
+
columnType: "SQLiteInteger";
|
|
217
|
+
data: number;
|
|
218
|
+
driverParam: number;
|
|
219
|
+
notNull: true;
|
|
220
|
+
hasDefault: true;
|
|
221
|
+
isPrimaryKey: false;
|
|
222
|
+
isAutoincrement: false;
|
|
223
|
+
hasRuntimeDefault: false;
|
|
224
|
+
enumValues: undefined;
|
|
225
|
+
baseColumn: never;
|
|
226
|
+
identity: undefined;
|
|
227
|
+
generated: undefined;
|
|
228
|
+
}, {}, {}>;
|
|
229
|
+
finishedAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
230
|
+
name: "finished_at";
|
|
231
|
+
tableName: "workflows";
|
|
232
|
+
dataType: "date";
|
|
233
|
+
columnType: "SQLiteTimestamp";
|
|
234
|
+
data: Date;
|
|
235
|
+
driverParam: number;
|
|
236
|
+
notNull: false;
|
|
237
|
+
hasDefault: false;
|
|
238
|
+
isPrimaryKey: false;
|
|
239
|
+
isAutoincrement: false;
|
|
240
|
+
hasRuntimeDefault: false;
|
|
241
|
+
enumValues: undefined;
|
|
242
|
+
baseColumn: never;
|
|
243
|
+
identity: undefined;
|
|
244
|
+
generated: undefined;
|
|
245
|
+
}, {}, {}>;
|
|
246
|
+
processedAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
247
|
+
name: "processed_at";
|
|
248
|
+
tableName: "workflows";
|
|
249
|
+
dataType: "date";
|
|
250
|
+
columnType: "SQLiteTimestamp";
|
|
251
|
+
data: Date;
|
|
252
|
+
driverParam: number;
|
|
253
|
+
notNull: false;
|
|
254
|
+
hasDefault: false;
|
|
255
|
+
isPrimaryKey: false;
|
|
256
|
+
isAutoincrement: false;
|
|
257
|
+
hasRuntimeDefault: false;
|
|
258
|
+
enumValues: undefined;
|
|
259
|
+
baseColumn: never;
|
|
260
|
+
identity: undefined;
|
|
261
|
+
generated: undefined;
|
|
262
|
+
}, {}, {}>;
|
|
263
|
+
createdAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
264
|
+
name: "created_at";
|
|
265
|
+
tableName: "workflows";
|
|
266
|
+
dataType: "date";
|
|
267
|
+
columnType: "SQLiteTimestamp";
|
|
268
|
+
data: Date;
|
|
269
|
+
driverParam: number;
|
|
270
|
+
notNull: true;
|
|
271
|
+
hasDefault: true;
|
|
272
|
+
isPrimaryKey: false;
|
|
273
|
+
isAutoincrement: false;
|
|
274
|
+
hasRuntimeDefault: true;
|
|
275
|
+
enumValues: undefined;
|
|
276
|
+
baseColumn: never;
|
|
277
|
+
identity: undefined;
|
|
278
|
+
generated: undefined;
|
|
279
|
+
}, {}, {}>;
|
|
280
|
+
updatedAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
281
|
+
name: "updated_at";
|
|
282
|
+
tableName: "workflows";
|
|
283
|
+
dataType: "date";
|
|
284
|
+
columnType: "SQLiteTimestamp";
|
|
285
|
+
data: Date;
|
|
286
|
+
driverParam: number;
|
|
287
|
+
notNull: true;
|
|
288
|
+
hasDefault: true;
|
|
289
|
+
isPrimaryKey: false;
|
|
290
|
+
isAutoincrement: false;
|
|
291
|
+
hasRuntimeDefault: true;
|
|
292
|
+
enumValues: undefined;
|
|
293
|
+
baseColumn: never;
|
|
294
|
+
identity: undefined;
|
|
295
|
+
generated: undefined;
|
|
296
|
+
}, {}, {}>;
|
|
297
|
+
};
|
|
298
|
+
dialect: "sqlite";
|
|
299
|
+
}>;
|
|
300
|
+
//#endregion
|
|
301
|
+
export { workflows };
|
|
302
|
+
//# sourceMappingURL=workflow.db.d.cts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
const require_src_modules_workflow_workflow_db = require("./workflow.db.cjs");
|
|
5
|
+
let drizzle_orm = require("drizzle-orm");
|
|
6
|
+
let neverthrow = require("neverthrow");
|
|
7
|
+
//#region src/modules/workflow/workflow.repository.ts
|
|
8
|
+
({ ...require_src_modules_workflow_workflow_db.workflow_db_exports });
|
|
9
|
+
var WorkflowRepository = class extends require_src_modules_base_base_repository.BaseRepository {
|
|
10
|
+
async read({ jobId, userId }) {
|
|
11
|
+
return this.throwableAsync(async () => {
|
|
12
|
+
const [wf] = await this.orm.select().from(this.schema.workflows).where((0, drizzle_orm.and)((0, drizzle_orm.eq)(this.schema.workflows.jobId, jobId), (0, drizzle_orm.eq)(this.schema.workflows.userId, userId)));
|
|
13
|
+
if (!wf) return this.error("NOT_FOUND");
|
|
14
|
+
return (0, neverthrow.ok)(wf);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async list({ userId, status, jobName }) {
|
|
18
|
+
return this.throwableAsync(async () => {
|
|
19
|
+
const { ConditionBuilder } = this.helpers;
|
|
20
|
+
const condition = new ConditionBuilder([(0, drizzle_orm.eq)(this.schema.workflows.userId, userId)]);
|
|
21
|
+
if (status) condition.push((0, drizzle_orm.inArray)(this.schema.workflows.status, status));
|
|
22
|
+
if (jobName) condition.push((0, drizzle_orm.eq)(this.schema.workflows.jobName, jobName));
|
|
23
|
+
return (0, neverthrow.ok)(await this.orm.select().from(this.schema.workflows).where(condition.join()));
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async added({ userId, jobId, jobName, queueName, timeout, tags, input }) {
|
|
27
|
+
return this.throwableAsync(async () => {
|
|
28
|
+
const [wf] = await this.orm.insert(this.schema.workflows).values({
|
|
29
|
+
userId,
|
|
30
|
+
jobId,
|
|
31
|
+
jobName,
|
|
32
|
+
input,
|
|
33
|
+
status: "queued",
|
|
34
|
+
queueName,
|
|
35
|
+
timeout,
|
|
36
|
+
tags,
|
|
37
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
38
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
39
|
+
}).returning();
|
|
40
|
+
return (0, neverthrow.ok)(wf);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async addedMany(data) {
|
|
44
|
+
return this.throwableAsync(async () => {
|
|
45
|
+
return (0, neverthrow.ok)(await this.orm.insert(this.schema.workflows).values(data.map((d) => ({
|
|
46
|
+
userId: d.userId,
|
|
47
|
+
jobId: d.jobId,
|
|
48
|
+
jobName: d.jobName,
|
|
49
|
+
queueName: d.queueName,
|
|
50
|
+
timeout: d.timeout,
|
|
51
|
+
tags: d.tags,
|
|
52
|
+
input: d.input,
|
|
53
|
+
status: "queued",
|
|
54
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
55
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
56
|
+
}))).returning());
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async started({ jobId }) {
|
|
60
|
+
return this.throwableAsync(async () => {
|
|
61
|
+
const [wf] = await this.orm.update(this.schema.workflows).set({
|
|
62
|
+
status: "running",
|
|
63
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
64
|
+
processedAt: /* @__PURE__ */ new Date()
|
|
65
|
+
}).where((0, drizzle_orm.eq)(this.schema.workflows.jobId, jobId)).returning();
|
|
66
|
+
return (0, neverthrow.ok)(wf);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async failed({ jobId, error }) {
|
|
70
|
+
return this.throwableAsync(async () => {
|
|
71
|
+
const [wf] = await this.orm.update(this.schema.workflows).set({
|
|
72
|
+
status: "failed",
|
|
73
|
+
error,
|
|
74
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
75
|
+
finishedAt: /* @__PURE__ */ new Date()
|
|
76
|
+
}).where((0, drizzle_orm.eq)(this.schema.workflows.jobId, jobId)).returning();
|
|
77
|
+
return (0, neverthrow.ok)(wf);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
async completed({ jobId, output }) {
|
|
81
|
+
return this.throwableAsync(async () => {
|
|
82
|
+
const [wf] = await this.orm.update(this.schema.workflows).set({
|
|
83
|
+
status: "completed",
|
|
84
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
85
|
+
finishedAt: /* @__PURE__ */ new Date(),
|
|
86
|
+
output
|
|
87
|
+
}).where((0, drizzle_orm.eq)(this.schema.workflows.jobId, jobId)).returning();
|
|
88
|
+
return (0, neverthrow.ok)(wf);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//#endregion
|
|
93
|
+
exports.WorkflowRepository = WorkflowRepository;
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=workflow.repository.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.repository.cjs","names":["workflow","BaseRepository"],"sources":["../../../../src/modules/workflow/workflow.repository.ts"],"sourcesContent":["import type {\n WorkflowListInputSchema,\n WorkflowListOutputSchema,\n WorkflowReadOutputSchema,\n} from \"@m5kdev/commons/modules/workflow/workflow.schema\";\nimport { and, eq, inArray } from \"drizzle-orm\";\nimport type { LibSQLDatabase } from \"drizzle-orm/libsql\";\nimport { ok } from \"neverthrow\";\nimport type { ServerResultAsync } from \"../base/base.dto\";\nimport { BaseRepository } from \"../base/base.repository\";\nimport * as workflow from \"./workflow.db\";\n\nconst schema = { ...workflow };\n\ntype Schema = typeof schema;\ntype Orm = LibSQLDatabase<Schema>;\n\nexport class WorkflowRepository extends BaseRepository<Orm, Schema, Record<string, never>> {\n async read({\n jobId,\n userId,\n }: {\n jobId: string;\n userId: string;\n }): ServerResultAsync<WorkflowReadOutputSchema> {\n return this.throwableAsync(async () => {\n const [wf] = await this.orm\n .select()\n .from(this.schema.workflows)\n .where(\n and(eq(this.schema.workflows.jobId, jobId), eq(this.schema.workflows.userId, userId))\n );\n if (!wf) return this.error(\"NOT_FOUND\");\n return ok(wf);\n });\n }\n\n async list({\n userId,\n status,\n jobName,\n }: WorkflowListInputSchema & {\n userId: string;\n }): ServerResultAsync<WorkflowListOutputSchema> {\n return this.throwableAsync(async () => {\n const { ConditionBuilder } = this.helpers;\n const condition = new ConditionBuilder([eq(this.schema.workflows.userId, userId)]);\n if (status) condition.push(inArray(this.schema.workflows.status, status));\n if (jobName) condition.push(eq(this.schema.workflows.jobName, jobName));\n\n const workflows = await this.orm.select().from(this.schema.workflows).where(condition.join());\n\n return ok(workflows);\n });\n }\n\n async added({\n userId,\n jobId,\n jobName,\n queueName,\n timeout,\n tags,\n input,\n }: {\n userId?: string;\n jobId: string;\n jobName: string;\n queueName: string;\n timeout?: number;\n tags?: string[];\n input: unknown;\n }): ServerResultAsync<WorkflowReadOutputSchema> {\n return this.throwableAsync(async () => {\n const [wf] = await this.orm\n .insert(this.schema.workflows)\n .values({\n userId,\n jobId,\n jobName,\n input,\n status: \"queued\",\n queueName,\n timeout,\n tags,\n createdAt: new Date(),\n updatedAt: new Date(),\n })\n .returning();\n return ok(wf);\n });\n }\n\n async addedMany(\n data: {\n userId?: string;\n jobId: string;\n jobName: string;\n queueName: string;\n timeout?: number;\n tags?: string[];\n input: unknown;\n }[]\n ): ServerResultAsync<WorkflowReadOutputSchema[]> {\n return this.throwableAsync(async () => {\n const wfs = await this.orm\n .insert(this.schema.workflows)\n .values(\n data.map((d) => ({\n userId: d.userId,\n jobId: d.jobId,\n jobName: d.jobName,\n queueName: d.queueName,\n timeout: d.timeout,\n tags: d.tags,\n input: d.input,\n status: \"queued\" as const,\n createdAt: new Date(),\n updatedAt: new Date(),\n }))\n )\n .returning();\n return ok(wfs);\n });\n }\n\n async started({ jobId }: { jobId: string }): ServerResultAsync<WorkflowReadOutputSchema> {\n return this.throwableAsync(async () => {\n const [wf] = await this.orm\n .update(this.schema.workflows)\n .set({ status: \"running\", updatedAt: new Date(), processedAt: new Date() })\n .where(eq(this.schema.workflows.jobId, jobId))\n .returning();\n return ok(wf);\n });\n }\n\n async failed({\n jobId,\n error,\n }: {\n jobId: string;\n error: string;\n }): ServerResultAsync<WorkflowReadOutputSchema> {\n return this.throwableAsync(async () => {\n const [wf] = await this.orm\n .update(this.schema.workflows)\n .set({ status: \"failed\", error, updatedAt: new Date(), finishedAt: new Date() })\n .where(eq(this.schema.workflows.jobId, jobId))\n .returning();\n return ok(wf);\n });\n }\n\n async completed({\n jobId,\n output,\n }: {\n jobId: string;\n output: unknown;\n }): ServerResultAsync<WorkflowReadOutputSchema> {\n return this.throwableAsync(async () => {\n const [wf] = await this.orm\n .update(this.schema.workflows)\n .set({ status: \"completed\", updatedAt: new Date(), finishedAt: new Date(), output })\n .where(eq(this.schema.workflows.jobId, jobId))\n .returning();\n return ok(wf);\n });\n }\n}\n"],"mappings":";;;;;;;CAYe,EAAE,GAAGA,yCAAAA,qBAAU;AAK9B,IAAa,qBAAb,cAAwCC,yCAAAA,eAAmD;CACzF,MAAM,KAAK,EACT,OACA,UAI8C;AAC9C,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,CAAC,MAAM,MAAM,KAAK,IACrB,QAAQ,CACR,KAAK,KAAK,OAAO,UAAU,CAC3B,OAAA,GAAA,YAAA,MAAA,GAAA,YAAA,IACQ,KAAK,OAAO,UAAU,OAAO,MAAM,GAAA,GAAA,YAAA,IAAK,KAAK,OAAO,UAAU,QAAQ,OAAO,CAAC,CACtF;AACH,OAAI,CAAC,GAAI,QAAO,KAAK,MAAM,YAAY;AACvC,WAAA,GAAA,WAAA,IAAU,GAAG;IACb;;CAGJ,MAAM,KAAK,EACT,QACA,QACA,WAG8C;AAC9C,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,EAAE,qBAAqB,KAAK;GAClC,MAAM,YAAY,IAAI,iBAAiB,EAAA,GAAA,YAAA,IAAI,KAAK,OAAO,UAAU,QAAQ,OAAO,CAAC,CAAC;AAClF,OAAI,OAAQ,WAAU,MAAA,GAAA,YAAA,SAAa,KAAK,OAAO,UAAU,QAAQ,OAAO,CAAC;AACzE,OAAI,QAAS,WAAU,MAAA,GAAA,YAAA,IAAQ,KAAK,OAAO,UAAU,SAAS,QAAQ,CAAC;AAIvE,WAAA,GAAA,WAAA,IAFkB,MAAM,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,OAAO,UAAU,CAAC,MAAM,UAAU,MAAM,CAAC,CAEzE;IACpB;;CAGJ,MAAM,MAAM,EACV,QACA,OACA,SACA,WACA,SACA,MACA,SAS8C;AAC9C,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,CAAC,MAAM,MAAM,KAAK,IACrB,OAAO,KAAK,OAAO,UAAU,CAC7B,OAAO;IACN;IACA;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA,2BAAW,IAAI,MAAM;IACrB,2BAAW,IAAI,MAAM;IACtB,CAAC,CACD,WAAW;AACd,WAAA,GAAA,WAAA,IAAU,GAAG;IACb;;CAGJ,MAAM,UACJ,MAS+C;AAC/C,SAAO,KAAK,eAAe,YAAY;AAkBrC,WAAA,GAAA,WAAA,IAjBY,MAAM,KAAK,IACpB,OAAO,KAAK,OAAO,UAAU,CAC7B,OACC,KAAK,KAAK,OAAO;IACf,QAAQ,EAAE;IACV,OAAO,EAAE;IACT,SAAS,EAAE;IACX,WAAW,EAAE;IACb,SAAS,EAAE;IACX,MAAM,EAAE;IACR,OAAO,EAAE;IACT,QAAQ;IACR,2BAAW,IAAI,MAAM;IACrB,2BAAW,IAAI,MAAM;IACtB,EAAE,CACJ,CACA,WAAW,CACA;IACd;;CAGJ,MAAM,QAAQ,EAAE,SAAyE;AACvF,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,CAAC,MAAM,MAAM,KAAK,IACrB,OAAO,KAAK,OAAO,UAAU,CAC7B,IAAI;IAAE,QAAQ;IAAW,2BAAW,IAAI,MAAM;IAAE,6BAAa,IAAI,MAAM;IAAE,CAAC,CAC1E,OAAA,GAAA,YAAA,IAAS,KAAK,OAAO,UAAU,OAAO,MAAM,CAAC,CAC7C,WAAW;AACd,WAAA,GAAA,WAAA,IAAU,GAAG;IACb;;CAGJ,MAAM,OAAO,EACX,OACA,SAI8C;AAC9C,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,CAAC,MAAM,MAAM,KAAK,IACrB,OAAO,KAAK,OAAO,UAAU,CAC7B,IAAI;IAAE,QAAQ;IAAU;IAAO,2BAAW,IAAI,MAAM;IAAE,4BAAY,IAAI,MAAM;IAAE,CAAC,CAC/E,OAAA,GAAA,YAAA,IAAS,KAAK,OAAO,UAAU,OAAO,MAAM,CAAC,CAC7C,WAAW;AACd,WAAA,GAAA,WAAA,IAAU,GAAG;IACb;;CAGJ,MAAM,UAAU,EACd,OACA,UAI8C;AAC9C,SAAO,KAAK,eAAe,YAAY;GACrC,MAAM,CAAC,MAAM,MAAM,KAAK,IACrB,OAAO,KAAK,OAAO,UAAU,CAC7B,IAAI;IAAE,QAAQ;IAAa,2BAAW,IAAI,MAAM;IAAE,4BAAY,IAAI,MAAM;IAAE;IAAQ,CAAC,CACnF,OAAA,GAAA,YAAA,IAAS,KAAK,OAAO,UAAU,OAAO,MAAM,CAAC,CAC7C,WAAW;AACd,WAAA,GAAA,WAAA,IAAU,GAAG;IACb"}
|