@m5kdev/backend 0.7.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/api/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/factory.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/get-field-attributes.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/get-id-field.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/adapter/types.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/get-tables.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/account.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/rate-limit.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/session.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/shared.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/user.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/db/schema/verification.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/social-providers/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/context.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/helper.d.mts +7 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/init-options.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/plugin-client.d.mts +1 -0
- package/dist/node_modules/.pnpm/@better-auth_core@1.4.18_@better-auth_utils@0.3.0_@better-fetch_fetch@1.1.21_better-cal_347838d331444e5371f256b914727290/node_modules/@better-auth/core/dist/types/plugin.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect-adapter-base.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mssql/mssql-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/mysql/mysql-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/postgres/postgres-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-adapter.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-dialect.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/dialect/sqlite/sqlite-introspector.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/expression/expression-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/index.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/kysely.d.mts +38 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/migration/file-migration-provider.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/migration/migrator.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/binary-operation-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/delete-from-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/expression-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/group-by-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/insert-values-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/join-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/merge-into-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/reference-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/returning-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/select-from-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/select-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/set-operation-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/tuple-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/unary-operation-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/update-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/update-set-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/value-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/parser/with-parser.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/case-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/delete-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/having-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/insert-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/join-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/merge-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/on-conflict-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/output-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/returning-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/select-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/update-query-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-builder/where-interface.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-creator.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/default-query-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/noop-query-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor-base.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor-provider.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/query-executor/query-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/raw-builder/raw-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/raw-builder/sql.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-add-index-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-drop-constraint-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/alter-table-executor.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-index-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-schema-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-table-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-type-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/create-view-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-index-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-schema-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-table-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-type-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/drop-view-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/refresh-materialized-view-builder.d.mts +1 -0
- package/dist/node_modules/.pnpm/kysely@0.28.5/node_modules/kysely/dist/esm/schema/schema.d.mts +1 -0
- package/dist/src/lib/posthog.d.mts +7 -0
- package/dist/src/lib/posthog.mjs +7 -0
- package/dist/src/lib/posthog.mjs.map +1 -0
- package/dist/src/lib/sentry.d.mts +1 -0
- package/dist/src/lib/sentry.mjs +10 -0
- package/dist/src/lib/sentry.mjs.map +1 -0
- package/dist/src/modules/access/access.repository.d.mts +2352 -0
- package/dist/src/modules/access/access.repository.mjs +24 -0
- package/dist/src/modules/access/access.repository.mjs.map +1 -0
- package/dist/src/modules/access/access.service.d.mts +25 -0
- package/dist/src/modules/access/access.service.mjs +40 -0
- package/dist/src/modules/access/access.service.mjs.map +1 -0
- package/dist/src/modules/access/access.utils.d.mts +19 -0
- package/dist/src/modules/access/access.utils.mjs +21 -0
- package/dist/src/modules/access/access.utils.mjs.map +1 -0
- package/dist/src/modules/ai/ai.db.d.mts +401 -0
- package/dist/src/modules/ai/ai.db.mjs +38 -0
- package/dist/src/modules/ai/ai.db.mjs.map +1 -0
- package/dist/src/modules/ai/ai.prompt.d.mts +30 -0
- package/dist/src/modules/ai/ai.prompt.mjs +30 -0
- package/dist/src/modules/ai/ai.prompt.mjs.map +1 -0
- package/dist/src/modules/ai/ai.prompts.d.mts +10 -0
- package/dist/src/modules/ai/{ai.prompts.js → ai.prompts.mjs} +17 -15
- package/dist/src/modules/ai/ai.prompts.mjs.map +1 -0
- package/dist/src/modules/ai/ai.repository.d.mts +428 -0
- package/dist/src/modules/ai/ai.repository.mjs +23 -0
- package/dist/src/modules/ai/ai.repository.mjs.map +1 -0
- package/dist/src/modules/ai/ai.router.d.mts +1 -0
- package/dist/src/modules/ai/ai.service.d.mts +129 -0
- package/dist/src/modules/ai/ai.service.mjs +267 -0
- package/dist/src/modules/ai/ai.service.mjs.map +1 -0
- package/dist/src/modules/ai/ai.trpc.d.mts +31 -0
- package/dist/src/modules/ai/ai.trpc.mjs +17 -0
- package/dist/src/modules/ai/ai.trpc.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.mts +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.mjs +184 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.mts +234 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.mjs +45 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.mts +7 -0
- package/dist/src/modules/ai/ideogram/{ideogram.prompt.js → ideogram.prompt.mjs} +861 -859
- package/dist/src/modules/ai/ideogram/ideogram.prompt.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.mts +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.mjs +32 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.mjs.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.d.mts +14 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.mjs +11 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.mjs.map +1 -0
- package/dist/src/modules/auth/auth.db.d.mts +2341 -0
- package/dist/src/modules/auth/auth.db.mjs +169 -0
- package/dist/src/modules/auth/auth.db.mjs.map +1 -0
- package/dist/src/modules/auth/auth.dto.d.mts +70 -0
- package/dist/src/modules/auth/auth.dto.mjs +43 -0
- package/dist/src/modules/auth/auth.dto.mjs.map +1 -0
- package/dist/src/modules/auth/auth.lib.d.mts +4894 -0
- package/dist/src/modules/auth/auth.lib.mjs +232 -0
- package/dist/src/modules/auth/auth.lib.mjs.map +1 -0
- package/dist/src/modules/auth/auth.middleware.d.mts +619 -0
- package/dist/src/modules/auth/auth.middleware.mjs +38 -0
- package/dist/src/modules/auth/auth.middleware.mjs.map +1 -0
- package/dist/src/modules/auth/auth.repository.d.mts +2453 -0
- package/dist/src/modules/auth/auth.repository.mjs +401 -0
- package/dist/src/modules/auth/auth.repository.mjs.map +1 -0
- package/dist/src/modules/auth/auth.service.d.mts +105 -0
- package/dist/src/modules/auth/auth.service.mjs +227 -0
- package/dist/src/modules/auth/auth.service.mjs.map +1 -0
- package/dist/src/modules/auth/auth.trpc.d.mts +303 -0
- package/dist/src/modules/auth/auth.trpc.mjs +108 -0
- package/dist/src/modules/auth/auth.trpc.mjs.map +1 -0
- package/dist/src/modules/auth/auth.utils.d.mts +2356 -0
- package/dist/src/modules/auth/auth.utils.mjs +77 -0
- package/dist/src/modules/auth/auth.utils.mjs.map +1 -0
- package/dist/src/modules/base/base.abstract.d.mts +29 -0
- package/dist/src/modules/base/base.abstract.mjs +60 -0
- package/dist/src/modules/base/base.abstract.mjs.map +1 -0
- package/dist/src/modules/base/base.actor.d.mts +73 -0
- package/dist/src/modules/base/base.actor.mjs +78 -0
- package/dist/src/modules/base/base.actor.mjs.map +1 -0
- package/dist/src/modules/base/base.dto.d.mts +67 -0
- package/dist/src/modules/base/base.dto.mjs +79 -0
- package/dist/src/modules/base/base.dto.mjs.map +1 -0
- package/dist/src/modules/base/base.grants.d.mts +28 -0
- package/dist/src/modules/base/base.grants.mjs +103 -0
- package/dist/src/modules/base/base.grants.mjs.map +1 -0
- package/dist/src/modules/base/base.procedure.d.mts +111 -0
- package/dist/src/modules/base/base.procedure.mjs +252 -0
- package/dist/src/modules/base/base.procedure.mjs.map +1 -0
- package/dist/src/modules/base/base.repository.d.mts +123 -0
- package/dist/src/modules/base/base.repository.mjs +250 -0
- package/dist/src/modules/base/base.repository.mjs.map +1 -0
- package/dist/src/modules/base/base.service.d.mts +44 -0
- package/dist/src/modules/base/base.service.mjs +116 -0
- package/dist/src/modules/base/base.service.mjs.map +1 -0
- package/dist/src/modules/base/base.types.d.mts +5 -0
- package/dist/src/modules/billing/billing.db.d.mts +371 -0
- package/dist/src/modules/billing/billing.db.mjs +31 -0
- package/dist/src/modules/billing/billing.db.mjs.map +1 -0
- package/dist/src/modules/billing/billing.repository.d.mts +2787 -0
- package/dist/src/modules/billing/billing.repository.mjs +188 -0
- package/dist/src/modules/billing/billing.repository.mjs.map +1 -0
- package/dist/src/modules/billing/billing.router.d.mts +9 -0
- package/dist/src/modules/billing/billing.router.mjs +40 -0
- package/dist/src/modules/billing/billing.router.mjs.map +1 -0
- package/dist/src/modules/billing/billing.service.d.mts +53 -0
- package/dist/src/modules/billing/billing.service.mjs +125 -0
- package/dist/src/modules/billing/billing.service.mjs.map +1 -0
- package/dist/src/modules/billing/billing.trpc.d.mts +48 -0
- package/dist/src/modules/billing/billing.trpc.mjs +17 -0
- package/dist/src/modules/billing/billing.trpc.mjs.map +1 -0
- package/dist/src/modules/clay/clay.repository.d.mts +10 -0
- package/dist/src/modules/clay/clay.repository.mjs +27 -0
- package/dist/src/modules/clay/clay.repository.mjs.map +1 -0
- package/dist/src/modules/clay/clay.service.d.mts +32 -0
- package/dist/src/modules/clay/clay.service.mjs +23 -0
- package/dist/src/modules/clay/clay.service.mjs.map +1 -0
- package/dist/src/modules/connect/connect.db.d.mts +362 -0
- package/dist/src/modules/connect/connect.db.mjs +30 -0
- package/dist/src/modules/connect/connect.db.mjs.map +1 -0
- package/dist/src/modules/connect/connect.dto.d.mts +79 -0
- package/dist/src/modules/connect/connect.dto.mjs +38 -0
- package/dist/src/modules/connect/connect.dto.mjs.map +1 -0
- package/dist/src/modules/connect/connect.linkedin.d.mts +7 -0
- package/dist/src/modules/connect/connect.linkedin.mjs +47 -0
- package/dist/src/modules/connect/connect.linkedin.mjs.map +1 -0
- package/dist/src/modules/connect/connect.oauth.d.mts +32 -0
- package/dist/src/modules/connect/connect.oauth.mjs +145 -0
- package/dist/src/modules/connect/connect.oauth.mjs.map +1 -0
- package/dist/src/modules/connect/connect.repository.d.mts +419 -0
- package/dist/src/modules/connect/connect.repository.mjs +40 -0
- package/dist/src/modules/connect/connect.repository.mjs.map +1 -0
- package/dist/src/modules/connect/connect.router.d.mts +9 -0
- package/dist/src/modules/connect/connect.router.mjs +46 -0
- package/dist/src/modules/connect/connect.router.mjs.map +1 -0
- package/dist/src/modules/connect/connect.service.d.mts +103 -0
- package/dist/src/modules/connect/connect.service.mjs +88 -0
- package/dist/src/modules/connect/connect.service.mjs.map +1 -0
- package/dist/src/modules/connect/connect.trpc.d.mts +53 -0
- package/dist/src/modules/connect/connect.trpc.mjs +17 -0
- package/dist/src/modules/connect/connect.trpc.mjs.map +1 -0
- package/dist/src/modules/connect/connect.types.d.mts +29 -0
- package/dist/src/modules/crypto/crypto.db.d.mts +157 -0
- package/dist/src/modules/crypto/crypto.db.mjs +19 -0
- package/dist/src/modules/crypto/crypto.db.mjs.map +1 -0
- package/dist/src/modules/crypto/crypto.repository.d.mts +163 -0
- package/dist/src/modules/crypto/crypto.repository.mjs +9 -0
- package/dist/src/modules/crypto/crypto.repository.mjs.map +1 -0
- package/dist/src/modules/crypto/crypto.service.d.mts +15 -0
- package/dist/src/modules/crypto/crypto.service.mjs +40 -0
- package/dist/src/modules/crypto/crypto.service.mjs.map +1 -0
- package/dist/src/modules/email/email.service.d.mts +62 -0
- package/dist/src/modules/email/email.service.mjs +105 -0
- package/dist/src/modules/email/email.service.mjs.map +1 -0
- package/dist/src/modules/file/file.repository.d.mts +17 -0
- package/dist/src/modules/file/file.repository.mjs +72 -0
- package/dist/src/modules/file/file.repository.mjs.map +1 -0
- package/dist/src/modules/file/{file.router.d.ts → file.router.d.mts} +4 -0
- package/dist/src/modules/file/file.router.mjs +88 -0
- package/dist/src/modules/file/file.router.mjs.map +1 -0
- package/dist/src/modules/file/file.service.d.mts +30 -0
- package/dist/src/modules/file/file.service.mjs +117 -0
- package/dist/src/modules/file/file.service.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.db.d.mts +568 -0
- package/dist/src/modules/recurrence/recurrence.db.mjs +47 -0
- package/dist/src/modules/recurrence/recurrence.db.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.repository.d.mts +588 -0
- package/dist/src/modules/recurrence/recurrence.repository.mjs +28 -0
- package/dist/src/modules/recurrence/recurrence.repository.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.service.d.mts +87 -0
- package/dist/src/modules/recurrence/recurrence.service.mjs +64 -0
- package/dist/src/modules/recurrence/recurrence.service.mjs.map +1 -0
- package/dist/src/modules/recurrence/recurrence.trpc.d.mts +215 -0
- package/dist/src/modules/recurrence/recurrence.trpc.mjs +44 -0
- package/dist/src/modules/recurrence/recurrence.trpc.mjs.map +1 -0
- package/dist/src/modules/social/social.dto.d.mts +39 -0
- package/dist/src/modules/social/social.dto.mjs +22 -0
- package/dist/src/modules/social/social.dto.mjs.map +1 -0
- package/dist/src/modules/social/{social.linkedin.d.ts → social.linkedin.d.mts} +8 -3
- package/dist/src/modules/social/social.linkedin.mjs +346 -0
- package/dist/src/modules/social/social.linkedin.mjs.map +1 -0
- package/dist/src/modules/social/social.service.d.mts +34 -0
- package/dist/src/modules/social/social.service.mjs +55 -0
- package/dist/src/modules/social/social.service.mjs.map +1 -0
- package/dist/src/modules/social/social.types.d.mts +40 -0
- package/dist/src/modules/tag/tag.db.d.mts +352 -0
- package/dist/src/modules/tag/tag.db.mjs +35 -0
- package/dist/src/modules/tag/tag.db.mjs.map +1 -0
- package/dist/src/modules/tag/tag.dto.d.mts +1025 -0
- package/dist/src/modules/tag/tag.dto.mjs +11 -0
- package/dist/src/modules/tag/tag.dto.mjs.map +1 -0
- package/dist/src/modules/tag/tag.repository.d.mts +394 -0
- package/dist/src/modules/tag/tag.repository.mjs +114 -0
- package/dist/src/modules/tag/tag.repository.mjs.map +1 -0
- package/dist/src/modules/tag/tag.service.d.mts +120 -0
- package/dist/src/modules/tag/tag.service.mjs +47 -0
- package/dist/src/modules/tag/tag.service.mjs.map +1 -0
- package/dist/src/modules/tag/tag.trpc.d.mts +173 -0
- package/dist/src/modules/tag/tag.trpc.mjs +30 -0
- package/dist/src/modules/tag/tag.trpc.mjs.map +1 -0
- package/dist/src/modules/utils/{applyPagination.d.ts → applyPagination.d.mts} +5 -1
- package/dist/src/modules/utils/applyPagination.mjs +15 -0
- package/dist/src/modules/utils/applyPagination.mjs.map +1 -0
- package/dist/src/modules/utils/applySorting.d.mts +13 -0
- package/dist/src/modules/utils/applySorting.mjs +18 -0
- package/dist/src/modules/utils/applySorting.mjs.map +1 -0
- package/dist/src/modules/utils/getConditionsFromFilters.d.mts +9 -0
- package/dist/src/modules/utils/getConditionsFromFilters.mjs +150 -0
- package/dist/src/modules/utils/getConditionsFromFilters.mjs.map +1 -0
- package/dist/src/modules/video/video.service.d.mts +12 -0
- package/dist/src/modules/video/video.service.mjs +50 -0
- package/dist/src/modules/video/video.service.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.constants.d.mts +12 -0
- package/dist/src/modules/webhook/webhook.constants.mjs +12 -0
- package/dist/src/modules/webhook/webhook.constants.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.db.d.mts +142 -0
- package/dist/src/modules/webhook/webhook.db.mjs +17 -0
- package/dist/src/modules/webhook/webhook.db.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.dto.d.mts +402 -0
- package/dist/src/modules/webhook/webhook.dto.mjs +9 -0
- package/dist/src/modules/webhook/webhook.dto.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.repository.d.mts +154 -0
- package/dist/src/modules/webhook/webhook.repository.mjs +50 -0
- package/dist/src/modules/webhook/webhook.repository.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.router.d.mts +8 -0
- package/dist/src/modules/webhook/webhook.router.mjs +23 -0
- package/dist/src/modules/webhook/webhook.router.mjs.map +1 -0
- package/dist/src/modules/webhook/webhook.service.d.mts +14 -0
- package/dist/src/modules/webhook/webhook.service.mjs +59 -0
- package/dist/src/modules/webhook/webhook.service.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.db.d.mts +302 -0
- package/dist/src/modules/workflow/workflow.db.mjs +28 -0
- package/dist/src/modules/workflow/workflow.db.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.repository.d.mts +371 -0
- package/dist/src/modules/workflow/workflow.repository.mjs +93 -0
- package/dist/src/modules/workflow/workflow.repository.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.service.d.mts +68 -0
- package/dist/src/modules/workflow/workflow.service.mjs +40 -0
- package/dist/src/modules/workflow/workflow.service.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.trpc.d.mts +65 -0
- package/dist/src/modules/workflow/workflow.trpc.mjs +17 -0
- package/dist/src/modules/workflow/workflow.trpc.mjs.map +1 -0
- package/dist/src/modules/workflow/workflow.types.d.mts +25 -0
- package/dist/src/modules/workflow/workflow.utils.d.mts +36 -0
- package/dist/src/modules/workflow/workflow.utils.mjs +181 -0
- package/dist/src/modules/workflow/workflow.utils.mjs.map +1 -0
- package/dist/src/types.d.mts +344 -0
- package/dist/src/types.mjs +11 -0
- package/dist/src/types.mjs.map +1 -0
- package/dist/src/utils/errors.d.mts +62 -0
- package/dist/src/utils/errors.mjs +96 -0
- package/dist/src/utils/errors.mjs.map +1 -0
- package/dist/src/utils/logger.d.mts +7 -0
- package/dist/src/utils/logger.mjs +10 -0
- package/dist/src/utils/logger.mjs.map +1 -0
- package/dist/src/utils/posthog.d.mts +17 -0
- package/dist/src/utils/posthog.mjs +25 -0
- package/dist/src/utils/posthog.mjs.map +1 -0
- package/dist/src/utils/trpc.d.mts +54 -0
- package/dist/src/utils/trpc.mjs +146 -0
- package/dist/src/utils/trpc.mjs.map +1 -0
- package/dist/src/utils/types.d.mts +9 -0
- package/package.json +47 -46
- package/dist/src/lib/posthog.d.ts +0 -2
- package/dist/src/lib/posthog.js +0 -7
- package/dist/src/lib/sentry.d.ts +0 -1
- package/dist/src/lib/sentry.js +0 -9
- package/dist/src/modules/access/access.repository.d.ts +0 -2347
- package/dist/src/modules/access/access.repository.js +0 -32
- package/dist/src/modules/access/access.service.d.ts +0 -21
- package/dist/src/modules/access/access.service.js +0 -51
- package/dist/src/modules/access/access.test.d.ts +0 -1
- package/dist/src/modules/access/access.test.js +0 -182
- package/dist/src/modules/access/access.utils.d.ts +0 -16
- package/dist/src/modules/access/access.utils.js +0 -20
- package/dist/src/modules/ai/ai.db.d.ts +0 -395
- package/dist/src/modules/ai/ai.db.js +0 -39
- package/dist/src/modules/ai/ai.prompt.d.ts +0 -26
- package/dist/src/modules/ai/ai.prompt.js +0 -30
- package/dist/src/modules/ai/ai.prompts.d.ts +0 -5
- package/dist/src/modules/ai/ai.repository.d.ts +0 -423
- package/dist/src/modules/ai/ai.repository.js +0 -26
- package/dist/src/modules/ai/ai.router.js +0 -132
- package/dist/src/modules/ai/ai.service.d.ts +0 -125
- package/dist/src/modules/ai/ai.service.js +0 -297
- package/dist/src/modules/ai/ai.trpc.d.ts +0 -22
- package/dist/src/modules/ai/ai.trpc.js +0 -20
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.ts +0 -7
- package/dist/src/modules/ai/ideogram/ideogram.constants.js +0 -167
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.ts +0 -229
- package/dist/src/modules/ai/ideogram/ideogram.dto.js +0 -49
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts +0 -2
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts +0 -6
- package/dist/src/modules/ai/ideogram/ideogram.repository.js +0 -46
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts +0 -9
- package/dist/src/modules/ai/ideogram/ideogram.service.js +0 -11
- package/dist/src/modules/auth/auth.db.d.ts +0 -2335
- package/dist/src/modules/auth/auth.db.js +0 -215
- package/dist/src/modules/auth/auth.dto.d.ts +0 -65
- package/dist/src/modules/auth/auth.dto.js +0 -38
- package/dist/src/modules/auth/auth.lib.d.ts +0 -4869
- package/dist/src/modules/auth/auth.lib.js +0 -284
- package/dist/src/modules/auth/auth.middleware.d.ts +0 -614
- package/dist/src/modules/auth/auth.middleware.js +0 -52
- package/dist/src/modules/auth/auth.repository.d.ts +0 -2421
- package/dist/src/modules/auth/auth.repository.js +0 -636
- package/dist/src/modules/auth/auth.service.d.ts +0 -78
- package/dist/src/modules/auth/auth.service.js +0 -259
- package/dist/src/modules/auth/auth.trpc.d.ts +0 -292
- package/dist/src/modules/auth/auth.trpc.js +0 -179
- package/dist/src/modules/auth/auth.utils.d.ts +0 -2351
- package/dist/src/modules/auth/auth.utils.js +0 -97
- package/dist/src/modules/base/base.abstract.d.ts +0 -19
- package/dist/src/modules/base/base.abstract.js +0 -62
- package/dist/src/modules/base/base.actor.d.ts +0 -68
- package/dist/src/modules/base/base.actor.js +0 -99
- package/dist/src/modules/base/base.actor.test.js +0 -58
- package/dist/src/modules/base/base.dto.d.ts +0 -69
- package/dist/src/modules/base/base.dto.js +0 -112
- package/dist/src/modules/base/base.grants.d.ts +0 -24
- package/dist/src/modules/base/base.grants.js +0 -135
- package/dist/src/modules/base/base.grants.test.js +0 -639
- package/dist/src/modules/base/base.procedure.d.ts +0 -109
- package/dist/src/modules/base/base.procedure.js +0 -301
- package/dist/src/modules/base/base.repository.d.ts +0 -97
- package/dist/src/modules/base/base.repository.js +0 -317
- package/dist/src/modules/base/base.service.d.ts +0 -40
- package/dist/src/modules/base/base.service.js +0 -123
- package/dist/src/modules/base/base.service.test.js +0 -443
- package/dist/src/modules/base/base.types.d.ts +0 -1
- package/dist/src/modules/base/base.types.js +0 -2
- package/dist/src/modules/billing/billing.db.d.ts +0 -365
- package/dist/src/modules/billing/billing.db.js +0 -29
- package/dist/src/modules/billing/billing.repository.d.ts +0 -2763
- package/dist/src/modules/billing/billing.repository.js +0 -235
- package/dist/src/modules/billing/billing.router.d.ts +0 -4
- package/dist/src/modules/billing/billing.router.js +0 -56
- package/dist/src/modules/billing/billing.service.d.ts +0 -38
- package/dist/src/modules/billing/billing.service.js +0 -147
- package/dist/src/modules/billing/billing.trpc.d.ts +0 -38
- package/dist/src/modules/billing/billing.trpc.js +0 -15
- package/dist/src/modules/clay/clay.repository.d.ts +0 -5
- package/dist/src/modules/clay/clay.repository.js +0 -26
- package/dist/src/modules/clay/clay.service.d.ts +0 -28
- package/dist/src/modules/clay/clay.service.js +0 -24
- package/dist/src/modules/connect/connect.db.d.ts +0 -356
- package/dist/src/modules/connect/connect.db.js +0 -30
- package/dist/src/modules/connect/connect.dto.d.ts +0 -74
- package/dist/src/modules/connect/connect.dto.js +0 -36
- package/dist/src/modules/connect/connect.linkedin.d.ts +0 -2
- package/dist/src/modules/connect/connect.linkedin.js +0 -53
- package/dist/src/modules/connect/connect.oauth.d.ts +0 -27
- package/dist/src/modules/connect/connect.oauth.js +0 -198
- package/dist/src/modules/connect/connect.repository.d.ts +0 -413
- package/dist/src/modules/connect/connect.repository.js +0 -54
- package/dist/src/modules/connect/connect.router.d.ts +0 -4
- package/dist/src/modules/connect/connect.router.js +0 -54
- package/dist/src/modules/connect/connect.service.d.ts +0 -96
- package/dist/src/modules/connect/connect.service.js +0 -116
- package/dist/src/modules/connect/connect.trpc.d.ts +0 -44
- package/dist/src/modules/connect/connect.trpc.js +0 -21
- package/dist/src/modules/connect/connect.types.d.ts +0 -25
- package/dist/src/modules/connect/connect.types.js +0 -2
- package/dist/src/modules/crypto/crypto.db.d.ts +0 -151
- package/dist/src/modules/crypto/crypto.db.js +0 -17
- package/dist/src/modules/crypto/crypto.repository.d.ts +0 -159
- package/dist/src/modules/crypto/crypto.repository.js +0 -10
- package/dist/src/modules/crypto/crypto.service.d.ts +0 -10
- package/dist/src/modules/crypto/crypto.service.js +0 -52
- package/dist/src/modules/email/email.service.d.ts +0 -56
- package/dist/src/modules/email/email.service.js +0 -106
- package/dist/src/modules/file/file.repository.d.ts +0 -12
- package/dist/src/modules/file/file.repository.js +0 -79
- package/dist/src/modules/file/file.router.js +0 -99
- package/dist/src/modules/file/file.service.d.ts +0 -24
- package/dist/src/modules/file/file.service.js +0 -150
- package/dist/src/modules/recurrence/recurrence.db.d.ts +0 -562
- package/dist/src/modules/recurrence/recurrence.db.js +0 -66
- package/dist/src/modules/recurrence/recurrence.repository.d.ts +0 -584
- package/dist/src/modules/recurrence/recurrence.repository.js +0 -39
- package/dist/src/modules/recurrence/recurrence.service.d.ts +0 -80
- package/dist/src/modules/recurrence/recurrence.service.js +0 -72
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts +0 -206
- package/dist/src/modules/recurrence/recurrence.trpc.js +0 -65
- package/dist/src/modules/social/social.dto.d.ts +0 -34
- package/dist/src/modules/social/social.dto.js +0 -18
- package/dist/src/modules/social/social.linkedin.js +0 -427
- package/dist/src/modules/social/social.linkedin.test.js +0 -235
- package/dist/src/modules/social/social.service.d.ts +0 -27
- package/dist/src/modules/social/social.service.js +0 -76
- package/dist/src/modules/social/social.types.d.ts +0 -35
- package/dist/src/modules/social/social.types.js +0 -2
- package/dist/src/modules/tag/tag.db.d.ts +0 -346
- package/dist/src/modules/tag/tag.db.js +0 -42
- package/dist/src/modules/tag/tag.dto.d.ts +0 -1018
- package/dist/src/modules/tag/tag.dto.js +0 -9
- package/dist/src/modules/tag/tag.repository.d.ts +0 -383
- package/dist/src/modules/tag/tag.repository.js +0 -156
- package/dist/src/modules/tag/tag.service.d.ts +0 -113
- package/dist/src/modules/tag/tag.service.js +0 -42
- package/dist/src/modules/tag/tag.trpc.d.ts +0 -164
- package/dist/src/modules/tag/tag.trpc.js +0 -53
- package/dist/src/modules/utils/applyPagination.js +0 -16
- package/dist/src/modules/utils/applySorting.d.ts +0 -8
- package/dist/src/modules/utils/applySorting.js +0 -18
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts +0 -4
- package/dist/src/modules/utils/getConditionsFromFilters.js +0 -200
- package/dist/src/modules/video/video.service.d.ts +0 -7
- package/dist/src/modules/video/video.service.js +0 -84
- package/dist/src/modules/webhook/webhook.constants.d.ts +0 -8
- package/dist/src/modules/webhook/webhook.constants.js +0 -10
- package/dist/src/modules/webhook/webhook.db.d.ts +0 -136
- package/dist/src/modules/webhook/webhook.db.js +0 -17
- package/dist/src/modules/webhook/webhook.dto.d.ts +0 -394
- package/dist/src/modules/webhook/webhook.dto.js +0 -7
- package/dist/src/modules/webhook/webhook.repository.d.ts +0 -148
- package/dist/src/modules/webhook/webhook.repository.js +0 -56
- package/dist/src/modules/webhook/webhook.router.d.ts +0 -3
- package/dist/src/modules/webhook/webhook.router.js +0 -30
- package/dist/src/modules/webhook/webhook.service.d.ts +0 -9
- package/dist/src/modules/webhook/webhook.service.js +0 -68
- package/dist/src/modules/workflow/workflow.db.d.ts +0 -296
- package/dist/src/modules/workflow/workflow.db.js +0 -30
- package/dist/src/modules/workflow/workflow.repository.d.ts +0 -343
- package/dist/src/modules/workflow/workflow.repository.js +0 -105
- package/dist/src/modules/workflow/workflow.service.d.ts +0 -61
- package/dist/src/modules/workflow/workflow.service.js +0 -37
- package/dist/src/modules/workflow/workflow.trpc.d.ts +0 -56
- package/dist/src/modules/workflow/workflow.trpc.js +0 -21
- package/dist/src/modules/workflow/workflow.types.d.ts +0 -20
- package/dist/src/modules/workflow/workflow.types.js +0 -2
- package/dist/src/modules/workflow/workflow.utils.d.ts +0 -21
- package/dist/src/modules/workflow/workflow.utils.js +0 -173
- package/dist/src/test/stubs/utils.d.ts +0 -2
- package/dist/src/test/stubs/utils.js +0 -5
- package/dist/src/trpc/context.d.ts +0 -41
- package/dist/src/trpc/context.js +0 -17
- package/dist/src/trpc/index.d.ts +0 -3
- package/dist/src/trpc/index.js +0 -6
- package/dist/src/trpc/procedures.d.ts +0 -233
- package/dist/src/trpc/procedures.js +0 -32
- package/dist/src/trpc/utils.d.ts +0 -4
- package/dist/src/trpc/utils.js +0 -20
- package/dist/src/types.d.ts +0 -358
- package/dist/src/types.js +0 -12
- package/dist/src/utils/errors.d.ts +0 -49
- package/dist/src/utils/errors.js +0 -104
- package/dist/src/utils/logger.d.ts +0 -1
- package/dist/src/utils/logger.js +0 -11
- package/dist/src/utils/posthog.d.ts +0 -13
- package/dist/src/utils/posthog.js +0 -31
- package/dist/src/utils/trpc.d.ts +0 -48
- package/dist/src/utils/trpc.js +0 -158
- package/dist/src/utils/trpc.test.js +0 -154
- package/dist/src/utils/types.d.ts +0 -4
- package/dist/src/utils/types.js +0 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/dist/src/{utils/trpc.test.d.ts → modules/ai/ai.router.mjs} +0 -0
- /package/dist/src/modules/{social/social.linkedin.test.d.ts → base/base.types.mjs} +0 -0
- /package/dist/src/modules/{base/base.service.test.d.ts → connect/connect.types.mjs} +0 -0
- /package/dist/src/modules/{base/base.grants.test.d.ts → social/social.types.mjs} +0 -0
- /package/dist/src/modules/{base/base.actor.test.d.ts → workflow/workflow.types.mjs} +0 -0
- /package/dist/src/{modules/ai/ai.router.d.ts → utils/types.mjs} +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type { QueryInput } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
2
|
-
import type { TRPC_ERROR_CODE_KEY } from "@trpc/server";
|
|
3
|
-
import type { ServerError } from "../../utils/errors";
|
|
4
|
-
import type { logger } from "../../utils/logger";
|
|
5
|
-
import type { Base } from "./base.abstract";
|
|
6
|
-
import { type Actor, type ActorScope, type AuthenticatedActor } from "./base.actor";
|
|
7
|
-
import type { ServerResult, ServerResultAsync } from "./base.dto";
|
|
8
|
-
import type { Entity, ResourceActionGrant } from "./base.grants";
|
|
9
|
-
type ServiceLogger = ReturnType<typeof logger.child>;
|
|
10
|
-
type RepositoryMap = Record<string, Base>;
|
|
11
|
-
type ServiceMap = Record<string, Base>;
|
|
12
|
-
export type ServiceProcedureContext = {
|
|
13
|
-
actor?: AuthenticatedActor | null;
|
|
14
|
-
} & Record<string, unknown>;
|
|
15
|
-
export type ServiceProcedureState = Record<string, unknown>;
|
|
16
|
-
export type ServiceProcedureStoredValue<T> = [T] extends [undefined] ? undefined : Awaited<T>;
|
|
17
|
-
export type ServiceProcedureResultLike<T> = T | ServerResult<T> | Promise<T | ServerResult<T>>;
|
|
18
|
-
export type ServiceProcedureContextFilterScope = ActorScope;
|
|
19
|
-
export type ServiceProcedureContextFilteredInput<TInput> = Extract<NonNullable<TInput>, QueryInput>;
|
|
20
|
-
type ServiceProcedureAuthContext<Scope extends ActorScope> = {
|
|
21
|
-
actor: Actor[Scope];
|
|
22
|
-
};
|
|
23
|
-
type ServiceProcedureRequiredScopeFromFilter<TInclude extends readonly ServiceProcedureContextFilterScope[] | undefined> = TInclude extends readonly ServiceProcedureContextFilterScope[] ? "team" extends TInclude[number] ? "team" : "organization" extends TInclude[number] ? "organization" : "user" : "user";
|
|
24
|
-
export type ServiceProcedure<TInput, TCtx extends ServiceProcedureContext, TOutput> = (input: TInput, ctx: TCtx) => ServerResultAsync<TOutput>;
|
|
25
|
-
export type ServiceProcedureArgs<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState> = {
|
|
26
|
-
input: TInput;
|
|
27
|
-
ctx: TCtx;
|
|
28
|
-
state: State;
|
|
29
|
-
repository: Repositories;
|
|
30
|
-
service: Services;
|
|
31
|
-
logger: ServiceLogger;
|
|
32
|
-
};
|
|
33
|
-
export type ServiceProcedureStep<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState, TOutput = undefined> = (args: ServiceProcedureArgs<TInput, TCtx, Repositories, Services, State>) => ServiceProcedureResultLike<ServiceProcedureStoredValue<TOutput>>;
|
|
34
|
-
export type ServiceProcedureInputMapper<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState, TNextInput> = (args: ServiceProcedureArgs<TInput, TCtx, Repositories, Services, State>) => ServiceProcedureResultLike<ServiceProcedureStoredValue<TNextInput>>;
|
|
35
|
-
export type ServiceProcedureHandler<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState, TOutput> = (args: ServiceProcedureArgs<TInput, TCtx, Repositories, Services, State>) => ServiceProcedureResultLike<TOutput>;
|
|
36
|
-
export type ServiceProcedureEntityResolver<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState, TEntities extends Entity | Entity[] | undefined> = TEntities | ((args: ServiceProcedureArgs<TInput, TCtx, Repositories, Services, State>) => ServiceProcedureResultLike<TEntities>);
|
|
37
|
-
type ServiceProcedureAccessBaseConfig = {
|
|
38
|
-
action: string;
|
|
39
|
-
grants?: ResourceActionGrant[];
|
|
40
|
-
};
|
|
41
|
-
export type ServiceProcedureEntityStepName<State extends ServiceProcedureState> = Extract<{
|
|
42
|
-
[Key in keyof State]: State[Key] extends Entity | Entity[] | undefined ? Key : never;
|
|
43
|
-
}[keyof State], string>;
|
|
44
|
-
export type ServiceProcedureAccessEntitiesConfig<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState, TEntities extends Entity | Entity[] | undefined = undefined> = ServiceProcedureAccessBaseConfig & {
|
|
45
|
-
entities?: ServiceProcedureEntityResolver<TInput, TCtx, Repositories, Services, State, TEntities>;
|
|
46
|
-
entityStep?: never;
|
|
47
|
-
};
|
|
48
|
-
export type ServiceProcedureAccessStateConfig<State extends ServiceProcedureState, StepName extends ServiceProcedureEntityStepName<State>> = ServiceProcedureAccessBaseConfig & {
|
|
49
|
-
entityStep: StepName;
|
|
50
|
-
entities?: never;
|
|
51
|
-
};
|
|
52
|
-
export type ServiceProcedureAccessConfig<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState, TEntities extends Entity | Entity[] | undefined = undefined> = ServiceProcedureAccessEntitiesConfig<TInput, TCtx, Repositories, Services, State, TEntities> | ServiceProcedureAccessStateConfig<State, ServiceProcedureEntityStepName<State>>;
|
|
53
|
-
export interface ServiceProcedureBuilder<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState = Record<string, never>> {
|
|
54
|
-
use<StepName extends string, TOutput = void>(stepName: StepName, step: ServiceProcedureStep<TInput, TCtx, Repositories, Services, State, TOutput>): ServiceProcedureBuilder<TInput, TCtx, Repositories, Services, State & Record<StepName, ServiceProcedureStoredValue<TOutput>>>;
|
|
55
|
-
mapInput<StepName extends string, TNextInput>(stepName: StepName, step: ServiceProcedureInputMapper<TInput, TCtx, Repositories, Services, State, TNextInput>): ServiceProcedureBuilder<ServiceProcedureStoredValue<TNextInput>, TCtx, Repositories, Services, State & Record<StepName, ServiceProcedureStoredValue<TNextInput>>>;
|
|
56
|
-
addContextFilter<TInclude extends readonly ServiceProcedureContextFilterScope[] | undefined = undefined>(include?: TInclude): ServiceProcedureBuilder<ServiceProcedureContextFilteredInput<TInput>, TCtx & ServiceProcedureAuthContext<ServiceProcedureRequiredScopeFromFilter<TInclude>>, Repositories, Services, State & {
|
|
57
|
-
contextFilter: ServiceProcedureContextFilteredInput<TInput>;
|
|
58
|
-
}>;
|
|
59
|
-
requireAuth<Scope extends ActorScope = "user">(scope?: Scope): ServiceProcedureBuilder<TInput, TCtx & ServiceProcedureAuthContext<Scope>, Repositories, Services, State>;
|
|
60
|
-
handle<TOutput>(handler: ServiceProcedureHandler<TInput, TCtx, Repositories, Services, State, TOutput>): ServiceProcedure<TInput, TCtx, TOutput>;
|
|
61
|
-
}
|
|
62
|
-
export interface PermissionServiceProcedureBuilder<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState = Record<string, never>> extends ServiceProcedureBuilder<TInput, TCtx, Repositories, Services, State> {
|
|
63
|
-
use<StepName extends string, TOutput = void>(stepName: StepName, step: ServiceProcedureStep<TInput, TCtx, Repositories, Services, State, TOutput>): PermissionServiceProcedureBuilder<TInput, TCtx, Repositories, Services, State & Record<StepName, ServiceProcedureStoredValue<TOutput>>>;
|
|
64
|
-
mapInput<StepName extends string, TNextInput>(stepName: StepName, step: ServiceProcedureInputMapper<TInput, TCtx, Repositories, Services, State, TNextInput>): PermissionServiceProcedureBuilder<ServiceProcedureStoredValue<TNextInput>, TCtx, Repositories, Services, State & Record<StepName, ServiceProcedureStoredValue<TNextInput>>>;
|
|
65
|
-
addContextFilter<TInclude extends readonly ServiceProcedureContextFilterScope[] | undefined = undefined>(include?: TInclude): PermissionServiceProcedureBuilder<ServiceProcedureContextFilteredInput<TInput>, TCtx & ServiceProcedureAuthContext<ServiceProcedureRequiredScopeFromFilter<TInclude>>, Repositories, Services, State & {
|
|
66
|
-
contextFilter: ServiceProcedureContextFilteredInput<TInput>;
|
|
67
|
-
}>;
|
|
68
|
-
requireAuth<Scope extends ActorScope = "user">(scope?: Scope): PermissionServiceProcedureBuilder<TInput, TCtx & ServiceProcedureAuthContext<Scope>, Repositories, Services, State>;
|
|
69
|
-
access(config: ServiceProcedureAccessEntitiesConfig<TInput, TCtx, Repositories, Services, State>): PermissionServiceProcedureBuilder<TInput, TCtx & ServiceProcedureAuthContext<"user">, Repositories, Services, State>;
|
|
70
|
-
access<TEntities extends Entity | Entity[] | undefined>(config: ServiceProcedureAccessEntitiesConfig<TInput, TCtx, Repositories, Services, State, TEntities>): PermissionServiceProcedureBuilder<TInput, TCtx & ServiceProcedureAuthContext<"user">, Repositories, Services, State & {
|
|
71
|
-
access: TEntities;
|
|
72
|
-
}>;
|
|
73
|
-
access<StepName extends ServiceProcedureEntityStepName<State>>(config: ServiceProcedureAccessStateConfig<State, StepName>): PermissionServiceProcedureBuilder<TInput, TCtx & ServiceProcedureAuthContext<"user">, Repositories, Services, State & {
|
|
74
|
-
access: State[StepName];
|
|
75
|
-
}>;
|
|
76
|
-
}
|
|
77
|
-
type BaseServiceProcedureHost<Repositories extends RepositoryMap, Services extends ServiceMap> = {
|
|
78
|
-
repository: Repositories;
|
|
79
|
-
service: Services;
|
|
80
|
-
logger: ServiceLogger;
|
|
81
|
-
addContextFilter(actor: AuthenticatedActor, include?: {
|
|
82
|
-
user?: boolean;
|
|
83
|
-
organization?: boolean;
|
|
84
|
-
team?: boolean;
|
|
85
|
-
}, query?: QueryInput): QueryInput;
|
|
86
|
-
error(code: TRPC_ERROR_CODE_KEY, message?: string, options?: {
|
|
87
|
-
cause?: unknown;
|
|
88
|
-
clientMessage?: string;
|
|
89
|
-
log?: boolean;
|
|
90
|
-
}): ServerResult<never>;
|
|
91
|
-
throwableAsync<T>(fn: () => ServerResultAsync<T>): ServerResultAsync<T>;
|
|
92
|
-
handleUnknownError(error: unknown): ServerError;
|
|
93
|
-
};
|
|
94
|
-
type PermissionServiceProcedureHost<Repositories extends RepositoryMap, Services extends ServiceMap> = BaseServiceProcedureHost<Repositories, Services> & {
|
|
95
|
-
checkPermission<T extends Entity>(actor: AuthenticatedActor, action: string, entities?: T | T[], grants?: ResourceActionGrant[]): boolean;
|
|
96
|
-
checkPermissionAsync<T extends Entity>(actor: AuthenticatedActor, action: string, getEntities: () => ServerResultAsync<T | T[] | undefined>, grants?: ResourceActionGrant[]): ServerResultAsync<boolean>;
|
|
97
|
-
};
|
|
98
|
-
type ProcedureRuntimeStep<Repositories extends RepositoryMap, Services extends ServiceMap> = {
|
|
99
|
-
stage: "use" | "input" | "auth" | "access";
|
|
100
|
-
stepName: string;
|
|
101
|
-
run: (args: ServiceProcedureArgs<unknown, ServiceProcedureContext, Repositories, Services, ServiceProcedureState>) => Promise<ServerResult<unknown>>;
|
|
102
|
-
};
|
|
103
|
-
type ProcedureBuilderConfig<Repositories extends RepositoryMap, Services extends ServiceMap> = {
|
|
104
|
-
name: string;
|
|
105
|
-
steps: ProcedureRuntimeStep<Repositories, Services>[];
|
|
106
|
-
};
|
|
107
|
-
export declare function createServiceProcedureBuilder<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState = Record<string, never>>(host: BaseServiceProcedureHost<Repositories, Services>, config: ProcedureBuilderConfig<Repositories, Services>): ServiceProcedureBuilder<TInput, TCtx, Repositories, Services, State>;
|
|
108
|
-
export declare function createPermissionServiceProcedureBuilder<TInput, TCtx extends ServiceProcedureContext, Repositories extends RepositoryMap, Services extends ServiceMap, State extends ServiceProcedureState = Record<string, never>>(host: PermissionServiceProcedureHost<Repositories, Services>, config: ProcedureBuilderConfig<Repositories, Services>): PermissionServiceProcedureBuilder<TInput, TCtx, Repositories, Services, State>;
|
|
109
|
-
export {};
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createServiceProcedureBuilder = createServiceProcedureBuilder;
|
|
4
|
-
exports.createPermissionServiceProcedureBuilder = createPermissionServiceProcedureBuilder;
|
|
5
|
-
const neverthrow_1 = require("neverthrow");
|
|
6
|
-
const base_actor_1 = require("./base.actor");
|
|
7
|
-
const DEFAULT_CONTEXT_FILTER_INCLUDE = [
|
|
8
|
-
"user",
|
|
9
|
-
];
|
|
10
|
-
function isServerResult(value) {
|
|
11
|
-
return (typeof value === "object" &&
|
|
12
|
-
value !== null &&
|
|
13
|
-
"isErr" in value &&
|
|
14
|
-
typeof value.isErr === "function" &&
|
|
15
|
-
"isOk" in value &&
|
|
16
|
-
typeof value.isOk === "function");
|
|
17
|
-
}
|
|
18
|
-
async function normalizeProcedureResult(result) {
|
|
19
|
-
const resolved = await result;
|
|
20
|
-
return isServerResult(resolved) ? resolved : (0, neverthrow_1.ok)(resolved);
|
|
21
|
-
}
|
|
22
|
-
function assertUniqueStepName(steps, stepName) {
|
|
23
|
-
if (steps.some((step) => step.stepName === stepName)) {
|
|
24
|
-
throw new Error(`Duplicate service procedure step name: ${stepName}`);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function hasStepName(steps, stepName) {
|
|
28
|
-
return steps.some((step) => step.stepName === stepName);
|
|
29
|
-
}
|
|
30
|
-
function getContextFilterInclude(include = DEFAULT_CONTEXT_FILTER_INCLUDE) {
|
|
31
|
-
return {
|
|
32
|
-
user: include.includes("user"),
|
|
33
|
-
organization: include.includes("organization"),
|
|
34
|
-
team: include.includes("team"),
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function getFailureStage(code) {
|
|
38
|
-
return code === "FORBIDDEN" || code === "UNAUTHORIZED" ? "forbidden" : "error";
|
|
39
|
-
}
|
|
40
|
-
function logProcedureStage(host, procedureName, ctx, stage, { stepName, durationMs, errorCode, } = {}) {
|
|
41
|
-
host.logger.debug({
|
|
42
|
-
procedureName,
|
|
43
|
-
stage,
|
|
44
|
-
stepName,
|
|
45
|
-
durationMs,
|
|
46
|
-
errorCode,
|
|
47
|
-
hasActor: Boolean(ctx.actor),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function requireProcedureActor(host, ctx, scope) {
|
|
51
|
-
if (!ctx.actor) {
|
|
52
|
-
return host.error("UNAUTHORIZED", "Unauthorized");
|
|
53
|
-
}
|
|
54
|
-
if (!(0, base_actor_1.validateActor)(ctx.actor, scope)) {
|
|
55
|
-
return host.error("FORBIDDEN", "Forbidden");
|
|
56
|
-
}
|
|
57
|
-
return (0, neverthrow_1.ok)(ctx.actor);
|
|
58
|
-
}
|
|
59
|
-
function createRequireAuthStep(host, scope = "user") {
|
|
60
|
-
return {
|
|
61
|
-
stage: "auth",
|
|
62
|
-
stepName: "auth",
|
|
63
|
-
run: async ({ ctx }) => {
|
|
64
|
-
return requireProcedureActor(host, ctx, scope);
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function createUseStep(stepName, step) {
|
|
69
|
-
return {
|
|
70
|
-
stage: "use",
|
|
71
|
-
stepName,
|
|
72
|
-
run: async (args) => normalizeProcedureResult(step(args)),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function createInputStep(stepName, step) {
|
|
76
|
-
return {
|
|
77
|
-
stage: "input",
|
|
78
|
-
stepName,
|
|
79
|
-
run: async (args) => normalizeProcedureResult(step(args)),
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
function createContextFilterStep(host, include) {
|
|
83
|
-
const contextInclude = getContextFilterInclude(include);
|
|
84
|
-
const requiredScope = contextInclude.team
|
|
85
|
-
? "team"
|
|
86
|
-
: contextInclude.organization
|
|
87
|
-
? "organization"
|
|
88
|
-
: "user";
|
|
89
|
-
return {
|
|
90
|
-
stage: "input",
|
|
91
|
-
stepName: "contextFilter",
|
|
92
|
-
run: async ({ input, ctx }) => {
|
|
93
|
-
const actor = requireProcedureActor(host, ctx, requiredScope);
|
|
94
|
-
if (actor.isErr())
|
|
95
|
-
return actor;
|
|
96
|
-
return (0, neverthrow_1.ok)(host.addContextFilter(actor.value, contextInclude, input));
|
|
97
|
-
},
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function createAccessStep(host, config) {
|
|
101
|
-
return {
|
|
102
|
-
stage: "access",
|
|
103
|
-
stepName: "access",
|
|
104
|
-
run: async (args) => {
|
|
105
|
-
const typedArgs = args;
|
|
106
|
-
const actor = requireProcedureActor(host, typedArgs.ctx, "user");
|
|
107
|
-
if (actor.isErr())
|
|
108
|
-
return actor;
|
|
109
|
-
if ("entityStep" in config && typeof config.entityStep === "string") {
|
|
110
|
-
const entities = typedArgs.state[config.entityStep];
|
|
111
|
-
const hasPermission = host.checkPermission(actor.value, config.action, entities, config.grants);
|
|
112
|
-
if (!hasPermission) {
|
|
113
|
-
return host.error("FORBIDDEN");
|
|
114
|
-
}
|
|
115
|
-
return (0, neverthrow_1.ok)(entities);
|
|
116
|
-
}
|
|
117
|
-
if (typeof config.entities === "function") {
|
|
118
|
-
const resolveEntities = config.entities;
|
|
119
|
-
let loadedEntities;
|
|
120
|
-
const permission = await host.checkPermissionAsync(actor.value, config.action, async () => {
|
|
121
|
-
const entityResult = await normalizeProcedureResult(resolveEntities(typedArgs));
|
|
122
|
-
if (entityResult.isOk()) {
|
|
123
|
-
loadedEntities = entityResult.value;
|
|
124
|
-
}
|
|
125
|
-
return entityResult;
|
|
126
|
-
}, config.grants);
|
|
127
|
-
if (permission.isErr()) {
|
|
128
|
-
return permission;
|
|
129
|
-
}
|
|
130
|
-
if (!permission.value) {
|
|
131
|
-
return host.error("FORBIDDEN");
|
|
132
|
-
}
|
|
133
|
-
return (0, neverthrow_1.ok)(loadedEntities);
|
|
134
|
-
}
|
|
135
|
-
const entities = config.entities;
|
|
136
|
-
const hasPermission = host.checkPermission(actor.value, config.action, entities, config.grants);
|
|
137
|
-
if (!hasPermission) {
|
|
138
|
-
return host.error("FORBIDDEN");
|
|
139
|
-
}
|
|
140
|
-
return (0, neverthrow_1.ok)(entities);
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
function createProcedureHandler(host, config, handler) {
|
|
145
|
-
return async (input, ctx) => host.throwableAsync(async () => {
|
|
146
|
-
const state = {};
|
|
147
|
-
const startTime = Date.now();
|
|
148
|
-
const typedCtx = ctx;
|
|
149
|
-
let currentInput = input;
|
|
150
|
-
logProcedureStage(host, config.name, typedCtx, "start");
|
|
151
|
-
try {
|
|
152
|
-
for (const step of config.steps) {
|
|
153
|
-
const stepResult = await step.run({
|
|
154
|
-
input: currentInput,
|
|
155
|
-
ctx: typedCtx,
|
|
156
|
-
state,
|
|
157
|
-
repository: host.repository,
|
|
158
|
-
service: host.service,
|
|
159
|
-
logger: host.logger,
|
|
160
|
-
});
|
|
161
|
-
if (stepResult.isErr()) {
|
|
162
|
-
logProcedureStage(host, config.name, typedCtx, getFailureStage(stepResult.error.code), {
|
|
163
|
-
stepName: step.stepName,
|
|
164
|
-
durationMs: Date.now() - startTime,
|
|
165
|
-
errorCode: stepResult.error.code,
|
|
166
|
-
});
|
|
167
|
-
return stepResult;
|
|
168
|
-
}
|
|
169
|
-
state[step.stepName] = stepResult.value;
|
|
170
|
-
if (step.stage === "input") {
|
|
171
|
-
currentInput = stepResult.value;
|
|
172
|
-
}
|
|
173
|
-
if (step.stage === "auth") {
|
|
174
|
-
logProcedureStage(host, config.name, typedCtx, "auth_passed", {
|
|
175
|
-
stepName: step.stepName,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
if (step.stage === "access") {
|
|
179
|
-
logProcedureStage(host, config.name, typedCtx, "access_passed", {
|
|
180
|
-
stepName: step.stepName,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
const handlerResult = await normalizeProcedureResult(handler({
|
|
185
|
-
input: currentInput,
|
|
186
|
-
ctx: ctx,
|
|
187
|
-
state: state,
|
|
188
|
-
repository: host.repository,
|
|
189
|
-
service: host.service,
|
|
190
|
-
logger: host.logger,
|
|
191
|
-
}));
|
|
192
|
-
if (handlerResult.isErr()) {
|
|
193
|
-
logProcedureStage(host, config.name, typedCtx, getFailureStage(handlerResult.error.code), {
|
|
194
|
-
durationMs: Date.now() - startTime,
|
|
195
|
-
errorCode: handlerResult.error.code,
|
|
196
|
-
});
|
|
197
|
-
return handlerResult;
|
|
198
|
-
}
|
|
199
|
-
logProcedureStage(host, config.name, typedCtx, "success", {
|
|
200
|
-
durationMs: Date.now() - startTime,
|
|
201
|
-
});
|
|
202
|
-
return handlerResult;
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
const serverError = host.handleUnknownError(error);
|
|
206
|
-
logProcedureStage(host, config.name, typedCtx, getFailureStage(serverError.code), {
|
|
207
|
-
durationMs: Date.now() - startTime,
|
|
208
|
-
errorCode: serverError.code,
|
|
209
|
-
});
|
|
210
|
-
throw error;
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function createServiceProcedureBuilder(host, config) {
|
|
215
|
-
function addContextFilter(include) {
|
|
216
|
-
const steps = hasStepName(config.steps, "auth")
|
|
217
|
-
? config.steps
|
|
218
|
-
: [...config.steps, createRequireAuthStep(host, "user")];
|
|
219
|
-
assertUniqueStepName(steps, "contextFilter");
|
|
220
|
-
return createServiceProcedureBuilder(host, {
|
|
221
|
-
...config,
|
|
222
|
-
steps: [...steps, createContextFilterStep(host, include)],
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
const builder = {
|
|
226
|
-
use(stepName, step) {
|
|
227
|
-
assertUniqueStepName(config.steps, stepName);
|
|
228
|
-
return createServiceProcedureBuilder(host, {
|
|
229
|
-
...config,
|
|
230
|
-
steps: [...config.steps, createUseStep(stepName, step)],
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
mapInput(stepName, step) {
|
|
234
|
-
assertUniqueStepName(config.steps, stepName);
|
|
235
|
-
return createServiceProcedureBuilder(host, {
|
|
236
|
-
...config,
|
|
237
|
-
steps: [...config.steps, createInputStep(stepName, step)],
|
|
238
|
-
});
|
|
239
|
-
},
|
|
240
|
-
addContextFilter,
|
|
241
|
-
requireAuth(scope) {
|
|
242
|
-
assertUniqueStepName(config.steps, "auth");
|
|
243
|
-
return createServiceProcedureBuilder(host, {
|
|
244
|
-
...config,
|
|
245
|
-
steps: [...config.steps, createRequireAuthStep(host, scope ?? "user")],
|
|
246
|
-
});
|
|
247
|
-
},
|
|
248
|
-
handle(handler) {
|
|
249
|
-
return createProcedureHandler(host, config, handler);
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
return builder;
|
|
253
|
-
}
|
|
254
|
-
function createPermissionServiceProcedureBuilder(host, config) {
|
|
255
|
-
function addContextFilter(include) {
|
|
256
|
-
const steps = hasStepName(config.steps, "auth")
|
|
257
|
-
? config.steps
|
|
258
|
-
: [...config.steps, createRequireAuthStep(host, "user")];
|
|
259
|
-
assertUniqueStepName(steps, "contextFilter");
|
|
260
|
-
return createPermissionServiceProcedureBuilder(host, {
|
|
261
|
-
...config,
|
|
262
|
-
steps: [...steps, createContextFilterStep(host, include)],
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
function access(accessConfig) {
|
|
266
|
-
assertUniqueStepName(config.steps, "access");
|
|
267
|
-
return createPermissionServiceProcedureBuilder(host, {
|
|
268
|
-
...config,
|
|
269
|
-
steps: [...config.steps, createAccessStep(host, accessConfig)],
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
const builder = {
|
|
273
|
-
use(stepName, step) {
|
|
274
|
-
assertUniqueStepName(config.steps, stepName);
|
|
275
|
-
return createPermissionServiceProcedureBuilder(host, {
|
|
276
|
-
...config,
|
|
277
|
-
steps: [...config.steps, createUseStep(stepName, step)],
|
|
278
|
-
});
|
|
279
|
-
},
|
|
280
|
-
mapInput(stepName, step) {
|
|
281
|
-
assertUniqueStepName(config.steps, stepName);
|
|
282
|
-
return createPermissionServiceProcedureBuilder(host, {
|
|
283
|
-
...config,
|
|
284
|
-
steps: [...config.steps, createInputStep(stepName, step)],
|
|
285
|
-
});
|
|
286
|
-
},
|
|
287
|
-
addContextFilter,
|
|
288
|
-
requireAuth(scope) {
|
|
289
|
-
assertUniqueStepName(config.steps, "auth");
|
|
290
|
-
return createPermissionServiceProcedureBuilder(host, {
|
|
291
|
-
...config,
|
|
292
|
-
steps: [...config.steps, createRequireAuthStep(host, scope ?? "user")],
|
|
293
|
-
});
|
|
294
|
-
},
|
|
295
|
-
access,
|
|
296
|
-
handle(handler) {
|
|
297
|
-
return createProcedureHandler(host, config, handler);
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
return builder;
|
|
301
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { QueryFilters, QueryInput } from "@m5kdev/commons/modules/schemas/query.schema";
|
|
2
|
-
import { type InferInsertModel, type InferSelectModel, type SelectedFields, type SQL } from "drizzle-orm";
|
|
3
|
-
import type { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
4
|
-
import type { SQLiteColumn, SQLiteTableWithColumns } from "drizzle-orm/sqlite-core";
|
|
5
|
-
import { Base } from "./base.abstract";
|
|
6
|
-
import { pickColumns, type ServerResultAsync } from "./base.dto";
|
|
7
|
-
/** Payload for update/updateMany: id key required (string), other table fields optional. */
|
|
8
|
-
export type TableUpdatePayload<TTable extends SQLiteTableWithColumns<any>, TIdKey extends Extract<keyof InferSelectModel<TTable>, string> = "id"> = Record<TIdKey, string> & Partial<Omit<InferSelectModel<TTable>, TIdKey>>;
|
|
9
|
-
export declare class ConditionBuilder {
|
|
10
|
-
private conditions;
|
|
11
|
-
constructor(conditions?: SQL[]);
|
|
12
|
-
push(condition?: SQL): void;
|
|
13
|
-
join(type?: "and" | "or"): SQL<unknown> | undefined;
|
|
14
|
-
[Symbol.iterator](): ArrayIterator<SQL<unknown>>;
|
|
15
|
-
}
|
|
16
|
-
export declare class TableConditionBuilder<TTable extends SQLiteTableWithColumns<any>> extends ConditionBuilder {
|
|
17
|
-
private table;
|
|
18
|
-
constructor(table: TTable);
|
|
19
|
-
applyFilters({ filters }?: {
|
|
20
|
-
filters?: QueryFilters;
|
|
21
|
-
}): void;
|
|
22
|
-
}
|
|
23
|
-
export declare const arrayContains: (table: SQLiteColumn, values: string[]) => SQL<unknown> | undefined;
|
|
24
|
-
export declare class BaseRepository<O extends LibSQLDatabase<any>, S extends Record<string, SQLiteTableWithColumns<any>>, R extends Record<string, BaseRepository<any, any, any> | BaseExternaRepository>> extends Base {
|
|
25
|
-
protected orm: O;
|
|
26
|
-
protected schema: S;
|
|
27
|
-
repository?: R;
|
|
28
|
-
constructor(options: {
|
|
29
|
-
orm: O;
|
|
30
|
-
schema: S;
|
|
31
|
-
}, repository?: R);
|
|
32
|
-
getConditionBuilder(): ConditionBuilder;
|
|
33
|
-
getConditionBuilder(table: undefined): ConditionBuilder;
|
|
34
|
-
getConditionBuilder<TTable extends SQLiteTableWithColumns<any>>(table: TTable): TableConditionBuilder<TTable>;
|
|
35
|
-
throwableQuery<T>(fn: () => Promise<T>): ServerResultAsync<T>;
|
|
36
|
-
withPagination<TQuery>(query: TQuery, { page, limit }: Pick<QueryInput, "page" | "limit">): TQuery;
|
|
37
|
-
withSorting<TTable extends SQLiteTableWithColumns<any>, TQuery>(query: TQuery, { sort, order }: Pick<QueryInput, "sort" | "order">, table?: TTable): TQuery;
|
|
38
|
-
withSortingAndPagination<TTable extends SQLiteTableWithColumns<any>, TQuery>(query: TQuery, { sort, order, page, limit }: Pick<QueryInput, "sort" | "order" | "page" | "limit">, table?: TTable): TQuery;
|
|
39
|
-
addUserIdFilter(userId: string, query?: QueryInput): QueryInput;
|
|
40
|
-
helpers: {
|
|
41
|
-
pickColumns: typeof pickColumns;
|
|
42
|
-
arrayContains: (table: SQLiteColumn, values: string[]) => SQL<unknown> | undefined;
|
|
43
|
-
ConditionBuilder: typeof ConditionBuilder;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Generic table-bound repository with typed CRUD, returning ServerResultAsync via throwableAsync.
|
|
48
|
-
*
|
|
49
|
-
* Example:
|
|
50
|
-
* const userRepo = new UserRepository(db, schema);
|
|
51
|
-
* class UserRepository extends BaseTableRepository<typeof schema.user> {
|
|
52
|
-
* constructor(db: LibSQLDatabase<typeof schema>, schema: typeof schema) {
|
|
53
|
-
* super(db, schema, schema.user);
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
*/
|
|
57
|
-
export declare class BaseTableRepository<O extends LibSQLDatabase<any>, S extends Record<string, SQLiteTableWithColumns<any>>, R extends Record<string, BaseRepository<any, any, any> | BaseExternaRepository>, TTable extends SQLiteTableWithColumns<any>, TIdKey extends Extract<keyof InferSelectModel<TTable>, string> = "id"> extends BaseRepository<O, S, R> {
|
|
58
|
-
protected readonly table: TTable;
|
|
59
|
-
protected readonly idKey: TIdKey;
|
|
60
|
-
protected readonly idColumn: SQLiteColumn;
|
|
61
|
-
constructor(options: {
|
|
62
|
-
orm: O;
|
|
63
|
-
schema: S;
|
|
64
|
-
table: TTable;
|
|
65
|
-
idKey?: TIdKey;
|
|
66
|
-
}, repository?: R);
|
|
67
|
-
withSorting<TQuery>(query: TQuery, { sort, order }: Pick<QueryInput, "sort" | "order">, table?: SQLiteTableWithColumns<any>): TQuery;
|
|
68
|
-
withSortingAndPagination<MTable extends SQLiteTableWithColumns<any>, TQuery>(query: TQuery, { sort, order, page, limit }: Pick<QueryInput, "sort" | "order" | "page" | "limit">, table?: MTable): TQuery;
|
|
69
|
-
queryList(query?: QueryInput, options?: {
|
|
70
|
-
conditions?: TableConditionBuilder<TTable>;
|
|
71
|
-
select?: SelectedFields<SQLiteColumn, TTable>;
|
|
72
|
-
}, tx?: O): ServerResultAsync<{
|
|
73
|
-
rows: InferSelectModel<TTable>[];
|
|
74
|
-
total: number;
|
|
75
|
-
}>;
|
|
76
|
-
findById(id: string, tx?: O): ServerResultAsync<InferSelectModel<TTable> | undefined>;
|
|
77
|
-
findManyById(ids: readonly string[], tx?: O): ServerResultAsync<Array<InferSelectModel<TTable>>>;
|
|
78
|
-
create(data: InferInsertModel<TTable>, tx?: O): ServerResultAsync<InferSelectModel<TTable>>;
|
|
79
|
-
createMany(data: readonly InferInsertModel<TTable>[], tx?: O): ServerResultAsync<Array<InferSelectModel<TTable>>>;
|
|
80
|
-
update(data: TableUpdatePayload<TTable, TIdKey>, tx?: O): ServerResultAsync<InferSelectModel<TTable>>;
|
|
81
|
-
updateMany(data: readonly TableUpdatePayload<TTable, TIdKey>[], tx?: O): ServerResultAsync<Array<InferSelectModel<TTable>>>;
|
|
82
|
-
softDeleteById(id: string, tx?: O): ServerResultAsync<{
|
|
83
|
-
id: string;
|
|
84
|
-
}>;
|
|
85
|
-
softDeleteManyById(ids: readonly string[], tx?: O): ServerResultAsync<Array<{
|
|
86
|
-
id: string;
|
|
87
|
-
}>>;
|
|
88
|
-
deleteById(id: string, tx?: O): ServerResultAsync<{
|
|
89
|
-
id: string;
|
|
90
|
-
}>;
|
|
91
|
-
deleteManyById(ids: readonly string[], tx?: O): ServerResultAsync<Array<{
|
|
92
|
-
id: string;
|
|
93
|
-
}>>;
|
|
94
|
-
}
|
|
95
|
-
export declare class BaseExternaRepository extends Base {
|
|
96
|
-
constructor();
|
|
97
|
-
}
|