@m5kdev/backend 0.1.0 → 0.1.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/.cursor/rules/backend.mdc +70 -0
- package/.turbo/turbo-build.log +5 -0
- package/.turbo/turbo-check-types.log +5 -0
- package/.turbo/turbo-lint$colon$fix.log +255 -0
- package/CHANGELOG.md +19 -0
- package/dist/src/lib/posthog.d.ts +3 -0
- package/dist/src/lib/posthog.d.ts.map +1 -0
- package/dist/src/lib/posthog.js +7 -0
- package/dist/src/lib/sentry.d.ts +2 -0
- package/dist/src/lib/sentry.d.ts.map +1 -0
- package/dist/src/lib/sentry.js +9 -0
- package/dist/src/modules/access/access.repository.d.ts +2348 -0
- package/dist/src/modules/access/access.repository.d.ts.map +1 -0
- package/dist/src/modules/access/access.repository.js +32 -0
- package/dist/src/modules/access/access.service.d.ts +22 -0
- package/dist/src/modules/access/access.service.d.ts.map +1 -0
- package/dist/src/modules/access/access.service.js +51 -0
- package/dist/src/modules/access/access.test.d.ts +2 -0
- package/dist/src/modules/access/access.test.d.ts.map +1 -0
- package/dist/src/modules/access/access.test.js +182 -0
- package/dist/src/modules/access/access.utils.d.ts +17 -0
- package/dist/src/modules/access/access.utils.d.ts.map +1 -0
- package/dist/src/modules/access/access.utils.js +20 -0
- package/dist/src/modules/ai/ai.db.d.ts +396 -0
- package/dist/src/modules/ai/ai.db.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.db.js +39 -0
- package/dist/src/modules/ai/ai.prompt.d.ts +28 -0
- package/dist/src/modules/ai/ai.prompt.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.prompt.js +30 -0
- package/dist/src/modules/ai/ai.repository.d.ts +424 -0
- package/dist/src/modules/ai/ai.repository.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.repository.js +26 -0
- package/dist/src/modules/ai/ai.router.d.ts +2 -0
- package/dist/src/modules/ai/ai.router.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.router.js +132 -0
- package/dist/src/modules/ai/ai.service.d.ts +115 -0
- package/dist/src/modules/ai/ai.service.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.service.js +207 -0
- package/dist/src/modules/ai/ai.trpc.d.ts +59 -0
- package/dist/src/modules/ai/ai.trpc.d.ts.map +1 -0
- package/dist/src/modules/ai/ai.trpc.js +20 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.ts +8 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.d.ts.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.constants.js +167 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.ts +230 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.d.ts.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.dto.js +49 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts +3 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.d.ts.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.prompt.js +860 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts +7 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.d.ts.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.repository.js +46 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts +10 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.d.ts.map +1 -0
- package/dist/src/modules/ai/ideogram/ideogram.service.js +11 -0
- package/dist/src/modules/auth/auth.db.d.ts +2336 -0
- package/dist/src/modules/auth/auth.db.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.db.js +215 -0
- package/dist/src/modules/auth/auth.dto.d.ts +66 -0
- package/dist/src/modules/auth/auth.dto.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.dto.js +38 -0
- package/dist/src/modules/auth/auth.lib.d.ts +4874 -0
- package/dist/src/modules/auth/auth.lib.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.lib.js +284 -0
- package/dist/src/modules/auth/auth.middleware.d.ts +615 -0
- package/dist/src/modules/auth/auth.middleware.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.middleware.js +52 -0
- package/dist/src/modules/auth/auth.repository.d.ts +2417 -0
- package/dist/src/modules/auth/auth.repository.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.repository.js +541 -0
- package/dist/src/modules/auth/auth.service.d.ts +104 -0
- package/dist/src/modules/auth/auth.service.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.service.js +201 -0
- package/dist/src/modules/auth/auth.trpc.d.ts +309 -0
- package/dist/src/modules/auth/auth.trpc.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.trpc.js +157 -0
- package/dist/src/modules/auth/auth.utils.d.ts +2352 -0
- package/dist/src/modules/auth/auth.utils.d.ts.map +1 -0
- package/dist/src/modules/auth/auth.utils.js +97 -0
- package/dist/src/modules/base/base.abstract.d.ts +19 -0
- package/dist/src/modules/base/base.abstract.d.ts.map +1 -0
- package/dist/src/modules/base/base.abstract.js +53 -0
- package/dist/src/modules/base/base.dto.d.ts +70 -0
- package/dist/src/modules/base/base.dto.d.ts.map +1 -0
- package/dist/src/modules/base/base.dto.js +112 -0
- package/dist/src/modules/base/base.grants.d.ts +29 -0
- package/dist/src/modules/base/base.grants.d.ts.map +1 -0
- package/dist/src/modules/base/base.grants.js +123 -0
- package/dist/src/modules/base/base.grants.test.d.ts +2 -0
- package/dist/src/modules/base/base.grants.test.d.ts.map +1 -0
- package/dist/src/modules/base/base.grants.test.js +668 -0
- package/dist/src/modules/base/base.repository.d.ts +97 -0
- package/dist/src/modules/base/base.repository.d.ts.map +1 -0
- package/dist/src/modules/base/base.repository.js +307 -0
- package/dist/src/modules/base/base.service.d.ts +42 -0
- package/dist/src/modules/base/base.service.d.ts.map +1 -0
- package/dist/src/modules/base/base.service.js +109 -0
- package/dist/src/modules/base/base.types.d.ts +2 -0
- package/dist/src/modules/base/base.types.d.ts.map +1 -0
- package/dist/src/modules/base/base.types.js +2 -0
- package/dist/src/modules/billing/billing.db.d.ts +366 -0
- package/dist/src/modules/billing/billing.db.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.db.js +29 -0
- package/dist/src/modules/billing/billing.repository.d.ts +2764 -0
- package/dist/src/modules/billing/billing.repository.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.repository.js +235 -0
- package/dist/src/modules/billing/billing.router.d.ts +5 -0
- package/dist/src/modules/billing/billing.router.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.router.js +56 -0
- package/dist/src/modules/billing/billing.service.d.ts +60 -0
- package/dist/src/modules/billing/billing.service.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.service.js +147 -0
- package/dist/src/modules/billing/billing.trpc.d.ts +75 -0
- package/dist/src/modules/billing/billing.trpc.d.ts.map +1 -0
- package/dist/src/modules/billing/billing.trpc.js +17 -0
- package/dist/src/modules/clay/clay.repository.d.ts +6 -0
- package/dist/src/modules/clay/clay.repository.d.ts.map +1 -0
- package/dist/src/modules/clay/clay.repository.js +26 -0
- package/dist/src/modules/clay/clay.service.d.ts +29 -0
- package/dist/src/modules/clay/clay.service.d.ts.map +1 -0
- package/dist/src/modules/clay/clay.service.js +24 -0
- package/dist/src/modules/connect/connect.db.d.ts +357 -0
- package/dist/src/modules/connect/connect.db.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.db.js +30 -0
- package/dist/src/modules/connect/connect.dto.d.ts +75 -0
- package/dist/src/modules/connect/connect.dto.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.dto.js +36 -0
- package/dist/src/modules/connect/connect.linkedin.d.ts +3 -0
- package/dist/src/modules/connect/connect.linkedin.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.linkedin.js +53 -0
- package/dist/src/modules/connect/connect.oauth.d.ts +28 -0
- package/dist/src/modules/connect/connect.oauth.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.oauth.js +198 -0
- package/dist/src/modules/connect/connect.repository.d.ts +414 -0
- package/dist/src/modules/connect/connect.repository.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.repository.js +54 -0
- package/dist/src/modules/connect/connect.router.d.ts +5 -0
- package/dist/src/modules/connect/connect.router.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.router.js +54 -0
- package/dist/src/modules/connect/connect.service.d.ts +89 -0
- package/dist/src/modules/connect/connect.service.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.service.js +114 -0
- package/dist/src/modules/connect/connect.trpc.d.ts +81 -0
- package/dist/src/modules/connect/connect.trpc.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.trpc.js +21 -0
- package/dist/src/modules/connect/connect.types.d.ts +26 -0
- package/dist/src/modules/connect/connect.types.d.ts.map +1 -0
- package/dist/src/modules/connect/connect.types.js +2 -0
- package/dist/src/modules/crypto/crypto.db.d.ts +152 -0
- package/dist/src/modules/crypto/crypto.db.d.ts.map +1 -0
- package/dist/src/modules/crypto/crypto.db.js +17 -0
- package/dist/src/modules/crypto/crypto.repository.d.ts +160 -0
- package/dist/src/modules/crypto/crypto.repository.d.ts.map +1 -0
- package/dist/src/modules/crypto/crypto.repository.js +10 -0
- package/dist/src/modules/crypto/crypto.service.d.ts +11 -0
- package/dist/src/modules/crypto/crypto.service.d.ts.map +1 -0
- package/dist/src/modules/crypto/crypto.service.js +52 -0
- package/dist/src/modules/email/email.service.d.ts +57 -0
- package/dist/src/modules/email/email.service.d.ts.map +1 -0
- package/dist/src/modules/email/email.service.js +107 -0
- package/dist/src/modules/file/file.repository.d.ts +13 -0
- package/dist/src/modules/file/file.repository.d.ts.map +1 -0
- package/dist/src/modules/file/file.repository.js +79 -0
- package/dist/src/modules/file/file.router.d.ts +4 -0
- package/dist/src/modules/file/file.router.d.ts.map +1 -0
- package/dist/src/modules/file/file.router.js +99 -0
- package/dist/src/modules/file/file.service.d.ts +25 -0
- package/dist/src/modules/file/file.service.d.ts.map +1 -0
- package/dist/src/modules/file/file.service.js +150 -0
- package/dist/src/modules/recurrence/recurrence.db.d.ts +563 -0
- package/dist/src/modules/recurrence/recurrence.db.d.ts.map +1 -0
- package/dist/src/modules/recurrence/recurrence.db.js +66 -0
- package/dist/src/modules/recurrence/recurrence.repository.d.ts +585 -0
- package/dist/src/modules/recurrence/recurrence.repository.d.ts.map +1 -0
- package/dist/src/modules/recurrence/recurrence.repository.js +39 -0
- package/dist/src/modules/recurrence/recurrence.service.d.ts +30 -0
- package/dist/src/modules/recurrence/recurrence.service.d.ts.map +1 -0
- package/dist/src/modules/recurrence/recurrence.service.js +70 -0
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts +243 -0
- package/dist/src/modules/recurrence/recurrence.trpc.d.ts.map +1 -0
- package/dist/src/modules/recurrence/recurrence.trpc.js +65 -0
- package/dist/src/modules/social/social.dto.d.ts +35 -0
- package/dist/src/modules/social/social.dto.d.ts.map +1 -0
- package/dist/src/modules/social/social.dto.js +18 -0
- package/dist/src/modules/social/social.linkedin.d.ts +11 -0
- package/dist/src/modules/social/social.linkedin.d.ts.map +1 -0
- package/dist/src/modules/social/social.linkedin.js +427 -0
- package/dist/src/modules/social/social.linkedin.test.d.ts +2 -0
- package/dist/src/modules/social/social.linkedin.test.d.ts.map +1 -0
- package/dist/src/modules/social/social.linkedin.test.js +235 -0
- package/dist/src/modules/social/social.service.d.ts +29 -0
- package/dist/src/modules/social/social.service.d.ts.map +1 -0
- package/dist/src/modules/social/social.service.js +76 -0
- package/dist/src/modules/social/social.types.d.ts +36 -0
- package/dist/src/modules/social/social.types.d.ts.map +1 -0
- package/dist/src/modules/social/social.types.js +2 -0
- package/dist/src/modules/tag/tag.db.d.ts +347 -0
- package/dist/src/modules/tag/tag.db.d.ts.map +1 -0
- package/dist/src/modules/tag/tag.db.js +42 -0
- package/dist/src/modules/tag/tag.dto.d.ts +1019 -0
- package/dist/src/modules/tag/tag.dto.d.ts.map +1 -0
- package/dist/src/modules/tag/tag.dto.js +9 -0
- package/dist/src/modules/tag/tag.repository.d.ts +384 -0
- package/dist/src/modules/tag/tag.repository.d.ts.map +1 -0
- package/dist/src/modules/tag/tag.repository.js +154 -0
- package/dist/src/modules/tag/tag.service.d.ts +36 -0
- package/dist/src/modules/tag/tag.service.d.ts.map +1 -0
- package/dist/src/modules/tag/tag.service.js +31 -0
- package/dist/src/modules/tag/tag.trpc.d.ts +191 -0
- package/dist/src/modules/tag/tag.trpc.d.ts.map +1 -0
- package/dist/src/modules/tag/tag.trpc.js +47 -0
- package/dist/src/modules/utils/applyPagination.d.ts +7 -0
- package/dist/src/modules/utils/applyPagination.d.ts.map +1 -0
- package/dist/src/modules/utils/applyPagination.js +16 -0
- package/dist/src/modules/utils/applySorting.d.ts +9 -0
- package/dist/src/modules/utils/applySorting.d.ts.map +1 -0
- package/dist/src/modules/utils/applySorting.js +18 -0
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts +5 -0
- package/dist/src/modules/utils/getConditionsFromFilters.d.ts.map +1 -0
- package/dist/src/modules/utils/getConditionsFromFilters.js +200 -0
- package/dist/src/modules/video/video.service.d.ts +8 -0
- package/dist/src/modules/video/video.service.d.ts.map +1 -0
- package/dist/src/modules/video/video.service.js +84 -0
- package/dist/src/modules/webhook/webhook.constants.d.ts +9 -0
- package/dist/src/modules/webhook/webhook.constants.d.ts.map +1 -0
- package/dist/src/modules/webhook/webhook.constants.js +10 -0
- package/dist/src/modules/webhook/webhook.db.d.ts +137 -0
- package/dist/src/modules/webhook/webhook.db.d.ts.map +1 -0
- package/dist/src/modules/webhook/webhook.db.js +17 -0
- package/dist/src/modules/webhook/webhook.dto.d.ts +395 -0
- package/dist/src/modules/webhook/webhook.dto.d.ts.map +1 -0
- package/dist/src/modules/webhook/webhook.dto.js +7 -0
- package/dist/src/modules/webhook/webhook.repository.d.ts +149 -0
- package/dist/src/modules/webhook/webhook.repository.d.ts.map +1 -0
- package/dist/src/modules/webhook/webhook.repository.js +56 -0
- package/dist/src/modules/webhook/webhook.router.d.ts +4 -0
- package/dist/src/modules/webhook/webhook.router.d.ts.map +1 -0
- package/dist/src/modules/webhook/webhook.router.js +30 -0
- package/dist/src/modules/webhook/webhook.service.d.ts +10 -0
- package/dist/src/modules/webhook/webhook.service.d.ts.map +1 -0
- package/dist/src/modules/webhook/webhook.service.js +68 -0
- package/dist/src/modules/workflow/workflow.db.d.ts +297 -0
- package/dist/src/modules/workflow/workflow.db.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.db.js +30 -0
- package/dist/src/modules/workflow/workflow.repository.d.ts +344 -0
- package/dist/src/modules/workflow/workflow.repository.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.repository.js +105 -0
- package/dist/src/modules/workflow/workflow.service.d.ts +22 -0
- package/dist/src/modules/workflow/workflow.service.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.service.js +37 -0
- package/dist/src/modules/workflow/workflow.trpc.d.ts +93 -0
- package/dist/src/modules/workflow/workflow.trpc.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.trpc.js +21 -0
- package/dist/src/modules/workflow/workflow.types.d.ts +21 -0
- package/dist/src/modules/workflow/workflow.types.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.types.js +2 -0
- package/dist/src/modules/workflow/workflow.utils.d.ts +22 -0
- package/dist/src/modules/workflow/workflow.utils.d.ts.map +1 -0
- package/dist/src/modules/workflow/workflow.utils.js +173 -0
- package/dist/src/test/stubs/utils.d.ts +3 -0
- package/dist/src/test/stubs/utils.d.ts.map +1 -0
- package/dist/src/test/stubs/utils.js +5 -0
- package/dist/src/trpc/context.d.ts +42 -0
- package/dist/src/trpc/context.d.ts.map +1 -0
- package/dist/src/trpc/context.js +17 -0
- package/dist/src/trpc/index.d.ts +4 -0
- package/dist/src/trpc/index.d.ts.map +1 -0
- package/dist/src/trpc/index.js +6 -0
- package/dist/src/trpc/procedures.d.ts +234 -0
- package/dist/src/trpc/procedures.d.ts.map +1 -0
- package/dist/src/trpc/procedures.js +32 -0
- package/dist/src/trpc/utils.d.ts +5 -0
- package/dist/src/trpc/utils.d.ts.map +1 -0
- package/dist/src/trpc/utils.js +20 -0
- package/dist/src/types.d.ts +486 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +13 -0
- package/dist/src/utils/errors.d.ts +50 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +104 -0
- package/dist/src/utils/logger.d.ts +2 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +11 -0
- package/dist/src/utils/posthog.d.ts +14 -0
- package/dist/src/utils/posthog.d.ts.map +1 -0
- package/dist/src/utils/posthog.js +31 -0
- package/dist/src/utils/types.d.ts +5 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/src/utils/types.js +2 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/jest.config.ts +19 -0
- package/package.json +3 -6
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { ServerResultAsync } from "#modules/base/base.dto";
|
|
3
|
+
import { BaseService } from "#modules/base/base.service";
|
|
4
|
+
import type { WebhookService } from "#modules/webhook/webhook.service";
|
|
5
|
+
import type { ClayRepository } from "./clay.repository";
|
|
6
|
+
type ClayTable = {
|
|
7
|
+
name?: string;
|
|
8
|
+
tableId?: string;
|
|
9
|
+
viewId?: string;
|
|
10
|
+
webhookUrl: string;
|
|
11
|
+
schema?: z.ZodAny;
|
|
12
|
+
timeoutInSeconds?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare class ClayService<K extends string> extends BaseService<{
|
|
15
|
+
clay: ClayRepository;
|
|
16
|
+
}, {
|
|
17
|
+
webhook: WebhookService;
|
|
18
|
+
}> {
|
|
19
|
+
private tables;
|
|
20
|
+
constructor(repositories: {
|
|
21
|
+
clay: ClayRepository;
|
|
22
|
+
}, services: {
|
|
23
|
+
webhook: WebhookService;
|
|
24
|
+
}, tables: Record<K, ClayTable>);
|
|
25
|
+
waitForResponse<T>(webhookUrl: string, row: Record<string, unknown>, timeoutInSeconds?: number): ServerResultAsync<T>;
|
|
26
|
+
sendToTable(table: K, row: Record<string, unknown>, timeoutInSeconds?: number): ServerResultAsync<z.infer<(typeof this.tables)[K]["schema"] extends z.ZodAny ? z.infer<(typeof this.tables)[K]["schema"]> : unknown>>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=clay.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clay.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/clay/clay.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,KAAK,SAAS,GAAG;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,WAAW,CAC5D;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,EACxB;IAAE,OAAO,EAAE,cAAc,CAAA;CAAE,CAC5B;IACC,OAAO,CAAC,MAAM,CAAuB;gBAEnC,YAAY,EAAE;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,EACtC,QAAQ,EAAE;QAAE,OAAO,EAAE,cAAc,CAAA;KAAE,EACrC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC;IAMxB,eAAe,CAAC,CAAC,EACrB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,gBAAgB,CAAC,EAAE,MAAM,GACxB,iBAAiB,CAAC,CAAC,CAAC;IAMjB,WAAW,CACf,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,gBAAgB,CAAC,EAAE,MAAM,GACxB,iBAAiB,CAClB,CAAC,CAAC,KAAK,CACL,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,MAAM,GAC9C,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,GAC1C,OAAO,CACZ,CACF;CAWF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClayService = void 0;
|
|
4
|
+
const base_service_1 = require("#modules/base/base.service");
|
|
5
|
+
class ClayService extends base_service_1.BaseService {
|
|
6
|
+
tables;
|
|
7
|
+
constructor(repositories, services, tables) {
|
|
8
|
+
super(repositories, services);
|
|
9
|
+
this.tables = tables;
|
|
10
|
+
}
|
|
11
|
+
async waitForResponse(webhookUrl, row, timeoutInSeconds) {
|
|
12
|
+
return await this.service.webhook.waitForRequest((url) => {
|
|
13
|
+
return this.repository.clay.sendToWebhook(webhookUrl, row, url);
|
|
14
|
+
}, timeoutInSeconds);
|
|
15
|
+
}
|
|
16
|
+
async sendToTable(table, row, timeoutInSeconds) {
|
|
17
|
+
const tableData = this.tables[table];
|
|
18
|
+
if (!tableData)
|
|
19
|
+
return this.error("NOT_FOUND", `Table ${table} not found`);
|
|
20
|
+
const response = await this.waitForResponse(tableData.webhookUrl, row, tableData.timeoutInSeconds || timeoutInSeconds);
|
|
21
|
+
return response;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ClayService = ClayService;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
export declare const connect: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
2
|
+
name: "connect";
|
|
3
|
+
schema: undefined;
|
|
4
|
+
columns: {
|
|
5
|
+
id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
6
|
+
name: "id";
|
|
7
|
+
tableName: "connect";
|
|
8
|
+
dataType: "string";
|
|
9
|
+
columnType: "SQLiteText";
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
notNull: true;
|
|
13
|
+
hasDefault: true;
|
|
14
|
+
isPrimaryKey: true;
|
|
15
|
+
isAutoincrement: false;
|
|
16
|
+
hasRuntimeDefault: true;
|
|
17
|
+
enumValues: [string, ...string[]];
|
|
18
|
+
baseColumn: never;
|
|
19
|
+
identity: undefined;
|
|
20
|
+
generated: undefined;
|
|
21
|
+
}, {}, {
|
|
22
|
+
length: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
userId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
25
|
+
name: "user_id";
|
|
26
|
+
tableName: "connect";
|
|
27
|
+
dataType: "string";
|
|
28
|
+
columnType: "SQLiteText";
|
|
29
|
+
data: string;
|
|
30
|
+
driverParam: string;
|
|
31
|
+
notNull: true;
|
|
32
|
+
hasDefault: false;
|
|
33
|
+
isPrimaryKey: false;
|
|
34
|
+
isAutoincrement: false;
|
|
35
|
+
hasRuntimeDefault: false;
|
|
36
|
+
enumValues: [string, ...string[]];
|
|
37
|
+
baseColumn: never;
|
|
38
|
+
identity: undefined;
|
|
39
|
+
generated: undefined;
|
|
40
|
+
}, {}, {
|
|
41
|
+
length: number | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
provider: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
44
|
+
name: "provider";
|
|
45
|
+
tableName: "connect";
|
|
46
|
+
dataType: "string";
|
|
47
|
+
columnType: "SQLiteText";
|
|
48
|
+
data: string;
|
|
49
|
+
driverParam: string;
|
|
50
|
+
notNull: true;
|
|
51
|
+
hasDefault: false;
|
|
52
|
+
isPrimaryKey: false;
|
|
53
|
+
isAutoincrement: false;
|
|
54
|
+
hasRuntimeDefault: false;
|
|
55
|
+
enumValues: [string, ...string[]];
|
|
56
|
+
baseColumn: never;
|
|
57
|
+
identity: undefined;
|
|
58
|
+
generated: undefined;
|
|
59
|
+
}, {}, {
|
|
60
|
+
length: number | undefined;
|
|
61
|
+
}>;
|
|
62
|
+
accountType: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
63
|
+
name: "account_type";
|
|
64
|
+
tableName: "connect";
|
|
65
|
+
dataType: "string";
|
|
66
|
+
columnType: "SQLiteText";
|
|
67
|
+
data: string;
|
|
68
|
+
driverParam: string;
|
|
69
|
+
notNull: true;
|
|
70
|
+
hasDefault: false;
|
|
71
|
+
isPrimaryKey: false;
|
|
72
|
+
isAutoincrement: false;
|
|
73
|
+
hasRuntimeDefault: false;
|
|
74
|
+
enumValues: [string, ...string[]];
|
|
75
|
+
baseColumn: never;
|
|
76
|
+
identity: undefined;
|
|
77
|
+
generated: undefined;
|
|
78
|
+
}, {}, {
|
|
79
|
+
length: number | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
providerAccountId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
82
|
+
name: "provider_account_id";
|
|
83
|
+
tableName: "connect";
|
|
84
|
+
dataType: "string";
|
|
85
|
+
columnType: "SQLiteText";
|
|
86
|
+
data: string;
|
|
87
|
+
driverParam: string;
|
|
88
|
+
notNull: true;
|
|
89
|
+
hasDefault: false;
|
|
90
|
+
isPrimaryKey: false;
|
|
91
|
+
isAutoincrement: false;
|
|
92
|
+
hasRuntimeDefault: false;
|
|
93
|
+
enumValues: [string, ...string[]];
|
|
94
|
+
baseColumn: never;
|
|
95
|
+
identity: undefined;
|
|
96
|
+
generated: undefined;
|
|
97
|
+
}, {}, {
|
|
98
|
+
length: number | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
handle: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
101
|
+
name: "handle";
|
|
102
|
+
tableName: "connect";
|
|
103
|
+
dataType: "string";
|
|
104
|
+
columnType: "SQLiteText";
|
|
105
|
+
data: string;
|
|
106
|
+
driverParam: string;
|
|
107
|
+
notNull: false;
|
|
108
|
+
hasDefault: false;
|
|
109
|
+
isPrimaryKey: false;
|
|
110
|
+
isAutoincrement: false;
|
|
111
|
+
hasRuntimeDefault: false;
|
|
112
|
+
enumValues: [string, ...string[]];
|
|
113
|
+
baseColumn: never;
|
|
114
|
+
identity: undefined;
|
|
115
|
+
generated: undefined;
|
|
116
|
+
}, {}, {
|
|
117
|
+
length: number | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
displayName: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
120
|
+
name: "display_name";
|
|
121
|
+
tableName: "connect";
|
|
122
|
+
dataType: "string";
|
|
123
|
+
columnType: "SQLiteText";
|
|
124
|
+
data: string;
|
|
125
|
+
driverParam: string;
|
|
126
|
+
notNull: false;
|
|
127
|
+
hasDefault: false;
|
|
128
|
+
isPrimaryKey: false;
|
|
129
|
+
isAutoincrement: false;
|
|
130
|
+
hasRuntimeDefault: false;
|
|
131
|
+
enumValues: [string, ...string[]];
|
|
132
|
+
baseColumn: never;
|
|
133
|
+
identity: undefined;
|
|
134
|
+
generated: undefined;
|
|
135
|
+
}, {}, {
|
|
136
|
+
length: number | undefined;
|
|
137
|
+
}>;
|
|
138
|
+
avatarUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
139
|
+
name: "avatar_url";
|
|
140
|
+
tableName: "connect";
|
|
141
|
+
dataType: "string";
|
|
142
|
+
columnType: "SQLiteText";
|
|
143
|
+
data: string;
|
|
144
|
+
driverParam: string;
|
|
145
|
+
notNull: false;
|
|
146
|
+
hasDefault: false;
|
|
147
|
+
isPrimaryKey: false;
|
|
148
|
+
isAutoincrement: false;
|
|
149
|
+
hasRuntimeDefault: false;
|
|
150
|
+
enumValues: [string, ...string[]];
|
|
151
|
+
baseColumn: never;
|
|
152
|
+
identity: undefined;
|
|
153
|
+
generated: undefined;
|
|
154
|
+
}, {}, {
|
|
155
|
+
length: number | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
accessToken: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
158
|
+
name: "access_token";
|
|
159
|
+
tableName: "connect";
|
|
160
|
+
dataType: "string";
|
|
161
|
+
columnType: "SQLiteText";
|
|
162
|
+
data: string;
|
|
163
|
+
driverParam: string;
|
|
164
|
+
notNull: true;
|
|
165
|
+
hasDefault: false;
|
|
166
|
+
isPrimaryKey: false;
|
|
167
|
+
isAutoincrement: false;
|
|
168
|
+
hasRuntimeDefault: false;
|
|
169
|
+
enumValues: [string, ...string[]];
|
|
170
|
+
baseColumn: never;
|
|
171
|
+
identity: undefined;
|
|
172
|
+
generated: undefined;
|
|
173
|
+
}, {}, {
|
|
174
|
+
length: number | undefined;
|
|
175
|
+
}>;
|
|
176
|
+
refreshToken: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
177
|
+
name: "refresh_token";
|
|
178
|
+
tableName: "connect";
|
|
179
|
+
dataType: "string";
|
|
180
|
+
columnType: "SQLiteText";
|
|
181
|
+
data: string;
|
|
182
|
+
driverParam: string;
|
|
183
|
+
notNull: false;
|
|
184
|
+
hasDefault: false;
|
|
185
|
+
isPrimaryKey: false;
|
|
186
|
+
isAutoincrement: false;
|
|
187
|
+
hasRuntimeDefault: false;
|
|
188
|
+
enumValues: [string, ...string[]];
|
|
189
|
+
baseColumn: never;
|
|
190
|
+
identity: undefined;
|
|
191
|
+
generated: undefined;
|
|
192
|
+
}, {}, {
|
|
193
|
+
length: number | undefined;
|
|
194
|
+
}>;
|
|
195
|
+
tokenType: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
196
|
+
name: "token_type";
|
|
197
|
+
tableName: "connect";
|
|
198
|
+
dataType: "string";
|
|
199
|
+
columnType: "SQLiteText";
|
|
200
|
+
data: string;
|
|
201
|
+
driverParam: string;
|
|
202
|
+
notNull: false;
|
|
203
|
+
hasDefault: false;
|
|
204
|
+
isPrimaryKey: false;
|
|
205
|
+
isAutoincrement: false;
|
|
206
|
+
hasRuntimeDefault: false;
|
|
207
|
+
enumValues: [string, ...string[]];
|
|
208
|
+
baseColumn: never;
|
|
209
|
+
identity: undefined;
|
|
210
|
+
generated: undefined;
|
|
211
|
+
}, {}, {
|
|
212
|
+
length: number | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
scope: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
215
|
+
name: "scope";
|
|
216
|
+
tableName: "connect";
|
|
217
|
+
dataType: "string";
|
|
218
|
+
columnType: "SQLiteText";
|
|
219
|
+
data: string;
|
|
220
|
+
driverParam: string;
|
|
221
|
+
notNull: false;
|
|
222
|
+
hasDefault: false;
|
|
223
|
+
isPrimaryKey: false;
|
|
224
|
+
isAutoincrement: false;
|
|
225
|
+
hasRuntimeDefault: false;
|
|
226
|
+
enumValues: [string, ...string[]];
|
|
227
|
+
baseColumn: never;
|
|
228
|
+
identity: undefined;
|
|
229
|
+
generated: undefined;
|
|
230
|
+
}, {}, {
|
|
231
|
+
length: number | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
expiresAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
234
|
+
name: "expires_at";
|
|
235
|
+
tableName: "connect";
|
|
236
|
+
dataType: "date";
|
|
237
|
+
columnType: "SQLiteTimestamp";
|
|
238
|
+
data: Date;
|
|
239
|
+
driverParam: number;
|
|
240
|
+
notNull: false;
|
|
241
|
+
hasDefault: false;
|
|
242
|
+
isPrimaryKey: false;
|
|
243
|
+
isAutoincrement: false;
|
|
244
|
+
hasRuntimeDefault: false;
|
|
245
|
+
enumValues: undefined;
|
|
246
|
+
baseColumn: never;
|
|
247
|
+
identity: undefined;
|
|
248
|
+
generated: undefined;
|
|
249
|
+
}, {}, {}>;
|
|
250
|
+
parentId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
251
|
+
name: "parent_id";
|
|
252
|
+
tableName: "connect";
|
|
253
|
+
dataType: "string";
|
|
254
|
+
columnType: "SQLiteText";
|
|
255
|
+
data: string;
|
|
256
|
+
driverParam: string;
|
|
257
|
+
notNull: false;
|
|
258
|
+
hasDefault: false;
|
|
259
|
+
isPrimaryKey: false;
|
|
260
|
+
isAutoincrement: false;
|
|
261
|
+
hasRuntimeDefault: false;
|
|
262
|
+
enumValues: [string, ...string[]];
|
|
263
|
+
baseColumn: never;
|
|
264
|
+
identity: undefined;
|
|
265
|
+
generated: undefined;
|
|
266
|
+
}, {}, {
|
|
267
|
+
length: number | undefined;
|
|
268
|
+
}>;
|
|
269
|
+
metadataJson: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
270
|
+
name: "metadata_json";
|
|
271
|
+
tableName: "connect";
|
|
272
|
+
dataType: "json";
|
|
273
|
+
columnType: "SQLiteTextJson";
|
|
274
|
+
data: unknown;
|
|
275
|
+
driverParam: string;
|
|
276
|
+
notNull: false;
|
|
277
|
+
hasDefault: false;
|
|
278
|
+
isPrimaryKey: false;
|
|
279
|
+
isAutoincrement: false;
|
|
280
|
+
hasRuntimeDefault: false;
|
|
281
|
+
enumValues: undefined;
|
|
282
|
+
baseColumn: never;
|
|
283
|
+
identity: undefined;
|
|
284
|
+
generated: undefined;
|
|
285
|
+
}, {}, {}>;
|
|
286
|
+
revokedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
287
|
+
name: "revoked_at";
|
|
288
|
+
tableName: "connect";
|
|
289
|
+
dataType: "date";
|
|
290
|
+
columnType: "SQLiteTimestamp";
|
|
291
|
+
data: Date;
|
|
292
|
+
driverParam: number;
|
|
293
|
+
notNull: false;
|
|
294
|
+
hasDefault: false;
|
|
295
|
+
isPrimaryKey: false;
|
|
296
|
+
isAutoincrement: false;
|
|
297
|
+
hasRuntimeDefault: false;
|
|
298
|
+
enumValues: undefined;
|
|
299
|
+
baseColumn: never;
|
|
300
|
+
identity: undefined;
|
|
301
|
+
generated: undefined;
|
|
302
|
+
}, {}, {}>;
|
|
303
|
+
lastRefreshedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
304
|
+
name: "last_refreshed_at";
|
|
305
|
+
tableName: "connect";
|
|
306
|
+
dataType: "date";
|
|
307
|
+
columnType: "SQLiteTimestamp";
|
|
308
|
+
data: Date;
|
|
309
|
+
driverParam: number;
|
|
310
|
+
notNull: false;
|
|
311
|
+
hasDefault: false;
|
|
312
|
+
isPrimaryKey: false;
|
|
313
|
+
isAutoincrement: false;
|
|
314
|
+
hasRuntimeDefault: false;
|
|
315
|
+
enumValues: undefined;
|
|
316
|
+
baseColumn: never;
|
|
317
|
+
identity: undefined;
|
|
318
|
+
generated: undefined;
|
|
319
|
+
}, {}, {}>;
|
|
320
|
+
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
321
|
+
name: "created_at";
|
|
322
|
+
tableName: "connect";
|
|
323
|
+
dataType: "date";
|
|
324
|
+
columnType: "SQLiteTimestamp";
|
|
325
|
+
data: Date;
|
|
326
|
+
driverParam: number;
|
|
327
|
+
notNull: true;
|
|
328
|
+
hasDefault: true;
|
|
329
|
+
isPrimaryKey: false;
|
|
330
|
+
isAutoincrement: false;
|
|
331
|
+
hasRuntimeDefault: true;
|
|
332
|
+
enumValues: undefined;
|
|
333
|
+
baseColumn: never;
|
|
334
|
+
identity: undefined;
|
|
335
|
+
generated: undefined;
|
|
336
|
+
}, {}, {}>;
|
|
337
|
+
updatedAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
338
|
+
name: "updated_at";
|
|
339
|
+
tableName: "connect";
|
|
340
|
+
dataType: "date";
|
|
341
|
+
columnType: "SQLiteTimestamp";
|
|
342
|
+
data: Date;
|
|
343
|
+
driverParam: number;
|
|
344
|
+
notNull: false;
|
|
345
|
+
hasDefault: false;
|
|
346
|
+
isPrimaryKey: false;
|
|
347
|
+
isAutoincrement: false;
|
|
348
|
+
hasRuntimeDefault: false;
|
|
349
|
+
enumValues: undefined;
|
|
350
|
+
baseColumn: never;
|
|
351
|
+
identity: undefined;
|
|
352
|
+
generated: undefined;
|
|
353
|
+
}, {}, {}>;
|
|
354
|
+
};
|
|
355
|
+
dialect: "sqlite";
|
|
356
|
+
}>;
|
|
357
|
+
//# sourceMappingURL=connect.db.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.db.d.ts","sourceRoot":"","sources":["../../../../src/modules/connect/connect.db.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BlB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connect = void 0;
|
|
4
|
+
const sqlite_core_1 = require("drizzle-orm/sqlite-core");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
exports.connect = (0, sqlite_core_1.sqliteTable)("connect", {
|
|
7
|
+
id: (0, sqlite_core_1.text)("id").primaryKey().$default(uuid_1.v4),
|
|
8
|
+
userId: (0, sqlite_core_1.text)("user_id").notNull(), // FK -> users.id
|
|
9
|
+
provider: (0, sqlite_core_1.text)("provider").notNull(), // e.g. "linkedin"
|
|
10
|
+
accountType: (0, sqlite_core_1.text)("account_type").notNull(), // "user" | "page" | "org" | "channel"
|
|
11
|
+
providerAccountId: (0, sqlite_core_1.text)("provider_account_id").notNull(), // e.g. LinkedIn URN, FB Page ID, IG business acct ID, X user ID
|
|
12
|
+
handle: (0, sqlite_core_1.text)("handle"), // @name or page slug
|
|
13
|
+
displayName: (0, sqlite_core_1.text)("display_name"),
|
|
14
|
+
avatarUrl: (0, sqlite_core_1.text)("avatar_url"),
|
|
15
|
+
// OAuth credentials (ENCRYPTED)
|
|
16
|
+
accessToken: (0, sqlite_core_1.text)("access_token").notNull(),
|
|
17
|
+
refreshToken: (0, sqlite_core_1.text)("refresh_token"), // may be null if provider doesn’t issue refresh tokens
|
|
18
|
+
tokenType: (0, sqlite_core_1.text)("token_type"), // e.g. "bearer"
|
|
19
|
+
scope: (0, sqlite_core_1.text)("scope"), // space- or comma-separated list, for auditing
|
|
20
|
+
expiresAt: (0, sqlite_core_1.integer)("expires_at", { mode: "timestamp" }), // epoch seconds
|
|
21
|
+
// Provider-specific glue
|
|
22
|
+
parentId: (0, sqlite_core_1.text)("parent_id"), // e.g. FB Page’s connected IG business account, or org URN
|
|
23
|
+
metadataJson: (0, sqlite_core_1.text)("metadata_json", { mode: "json" }), // JSON string for extras (region, perms, etc.)
|
|
24
|
+
revokedAt: (0, sqlite_core_1.integer)("revoked_at", { mode: "timestamp" }),
|
|
25
|
+
lastRefreshedAt: (0, sqlite_core_1.integer)("last_refreshed_at", { mode: "timestamp" }),
|
|
26
|
+
createdAt: (0, sqlite_core_1.integer)("created_at", { mode: "timestamp" })
|
|
27
|
+
.notNull()
|
|
28
|
+
.$default(() => new Date()),
|
|
29
|
+
updatedAt: (0, sqlite_core_1.integer)("updated_at", { mode: "timestamp" }),
|
|
30
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const connectSelectSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
userId: z.ZodString;
|
|
5
|
+
provider: z.ZodString;
|
|
6
|
+
accountType: z.ZodString;
|
|
7
|
+
providerAccountId: z.ZodString;
|
|
8
|
+
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9
|
+
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
11
|
+
accessToken: z.ZodString;
|
|
12
|
+
refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
|
+
tokenType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
16
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
metadataJson: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
18
|
+
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
19
|
+
lastRefreshedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
20
|
+
createdAt: z.ZodDate;
|
|
21
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type ConnectSelectSchema = z.infer<typeof connectSelectSchema>;
|
|
24
|
+
export declare const connectSelectOutputSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
userId: z.ZodString;
|
|
27
|
+
provider: z.ZodString;
|
|
28
|
+
accountType: z.ZodString;
|
|
29
|
+
providerAccountId: z.ZodString;
|
|
30
|
+
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
31
|
+
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
32
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
tokenType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
36
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
metadataJson: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
38
|
+
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
39
|
+
lastRefreshedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
40
|
+
createdAt: z.ZodDate;
|
|
41
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export declare const connectListInputSchema: z.ZodObject<{
|
|
44
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
inactive: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type ConnectListInputSchema = z.infer<typeof connectListInputSchema>;
|
|
48
|
+
export declare const connectListOutputSchema: z.ZodArray<z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
userId: z.ZodString;
|
|
51
|
+
provider: z.ZodString;
|
|
52
|
+
accountType: z.ZodString;
|
|
53
|
+
providerAccountId: z.ZodString;
|
|
54
|
+
handle: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
displayName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
avatarUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
57
|
+
tokenType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
expiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
60
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
metadataJson: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
62
|
+
revokedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
63
|
+
lastRefreshedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
64
|
+
createdAt: z.ZodDate;
|
|
65
|
+
updatedAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
66
|
+
}, z.core.$strip>>;
|
|
67
|
+
export declare const connectDeleteInputSchema: z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const connectDeleteOutputSchema: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type ConnectDeleteInputSchema = z.infer<typeof connectDeleteInputSchema>;
|
|
74
|
+
export type ConnectDeleteOutputSchema = z.infer<typeof connectDeleteOutputSchema>;
|
|
75
|
+
//# sourceMappingURL=connect.dto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.dto.d.ts","sourceRoot":"","sources":["../../../../src/modules/connect/connect.dto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;iBAoB9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;iBAGpC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAE5E,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;kBAAqC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;iBAA+B,CAAC;AACrE,eAAO,MAAM,yBAAyB;;iBAA+B,CAAC;AACtE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAChF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectDeleteOutputSchema = exports.connectDeleteInputSchema = exports.connectListOutputSchema = exports.connectListInputSchema = exports.connectSelectOutputSchema = exports.connectSelectSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.connectSelectSchema = zod_1.z.object({
|
|
6
|
+
id: zod_1.z.string(),
|
|
7
|
+
userId: zod_1.z.string(),
|
|
8
|
+
provider: zod_1.z.string(),
|
|
9
|
+
accountType: zod_1.z.string(),
|
|
10
|
+
providerAccountId: zod_1.z.string(),
|
|
11
|
+
handle: zod_1.z.string().nullish(),
|
|
12
|
+
displayName: zod_1.z.string().nullish(),
|
|
13
|
+
avatarUrl: zod_1.z.string().nullish(),
|
|
14
|
+
accessToken: zod_1.z.string(),
|
|
15
|
+
refreshToken: zod_1.z.string().nullish(),
|
|
16
|
+
tokenType: zod_1.z.string().nullish(),
|
|
17
|
+
scope: zod_1.z.string().nullish(),
|
|
18
|
+
expiresAt: zod_1.z.date().nullish(),
|
|
19
|
+
parentId: zod_1.z.string().nullish(),
|
|
20
|
+
metadataJson: zod_1.z.unknown().nullish(),
|
|
21
|
+
revokedAt: zod_1.z.date().nullish(),
|
|
22
|
+
lastRefreshedAt: zod_1.z.date().nullish(),
|
|
23
|
+
createdAt: zod_1.z.date(),
|
|
24
|
+
updatedAt: zod_1.z.date().nullish(),
|
|
25
|
+
});
|
|
26
|
+
exports.connectSelectOutputSchema = exports.connectSelectSchema.omit({
|
|
27
|
+
accessToken: true,
|
|
28
|
+
refreshToken: true,
|
|
29
|
+
});
|
|
30
|
+
exports.connectListInputSchema = zod_1.z.object({
|
|
31
|
+
providers: zod_1.z.array(zod_1.z.string()).optional(),
|
|
32
|
+
inactive: zod_1.z.boolean().optional(),
|
|
33
|
+
});
|
|
34
|
+
exports.connectListOutputSchema = zod_1.z.array(exports.connectSelectOutputSchema);
|
|
35
|
+
exports.connectDeleteInputSchema = zod_1.z.object({ id: zod_1.z.string() });
|
|
36
|
+
exports.connectDeleteOutputSchema = zod_1.z.object({ id: zod_1.z.string() });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.linkedin.d.ts","sourceRoot":"","sources":["../../../../src/modules/connect/connect.linkedin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAavE,wBAAgB,sBAAsB,IAAI,eAAe,CAwDxD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLinkedInProvider = createLinkedInProvider;
|
|
4
|
+
function createLinkedInProvider() {
|
|
5
|
+
const clientId = process.env.LINKEDIN_CLIENT_ID;
|
|
6
|
+
const clientSecret = process.env.LINKEDIN_CLIENT_SECRET;
|
|
7
|
+
const baseUrl = process.env.VITE_SERVER_URL;
|
|
8
|
+
if (!clientId || !clientSecret || !baseUrl) {
|
|
9
|
+
throw new Error("Missing required LinkedIn OAuth environment variables: LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET, VITE_SERVER_URL");
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
id: "linkedin",
|
|
13
|
+
clientId,
|
|
14
|
+
clientSecret,
|
|
15
|
+
redirectUri: `${baseUrl}/connect/linkedin/callback`,
|
|
16
|
+
// LinkedIn OpenID Connect scopes
|
|
17
|
+
scopes: ["openid", "profile", "w_member_social"],
|
|
18
|
+
// LinkedIn doesn't support PKCE - disable it
|
|
19
|
+
supportsPKCE: false,
|
|
20
|
+
// LinkedIn OpenID Connect endpoints
|
|
21
|
+
issuerConfig: {
|
|
22
|
+
issuer: "https://www.linkedin.com",
|
|
23
|
+
authorization_endpoint: "https://www.linkedin.com/oauth/v2/authorization",
|
|
24
|
+
token_endpoint: "https://www.linkedin.com/oauth/v2/accessToken",
|
|
25
|
+
userinfo_endpoint: "https://api.linkedin.com/v2/userinfo",
|
|
26
|
+
},
|
|
27
|
+
async mapProfile(accessToken) {
|
|
28
|
+
// Use OpenID Connect userinfo endpoint
|
|
29
|
+
const response = await fetch("https://api.linkedin.com/v2/userinfo", {
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${accessToken}`,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
throw new Error(`LinkedIn API error: ${response.status} ${response.statusText}`);
|
|
36
|
+
}
|
|
37
|
+
const data = (await response.json());
|
|
38
|
+
return {
|
|
39
|
+
providerAccountId: data.sub,
|
|
40
|
+
displayName: data.name,
|
|
41
|
+
avatarUrl: data.picture,
|
|
42
|
+
accountType: "user",
|
|
43
|
+
metadata: {
|
|
44
|
+
givenName: data.given_name,
|
|
45
|
+
familyName: data.family_name,
|
|
46
|
+
locale: data.locale,
|
|
47
|
+
email: data.email,
|
|
48
|
+
emailVerified: data.email_verified,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as client from "openid-client";
|
|
2
|
+
import type { ConnectProvider } from "./connect.types";
|
|
3
|
+
export interface OAuthState {
|
|
4
|
+
state: string;
|
|
5
|
+
codeVerifier: string;
|
|
6
|
+
codeChallenge: string;
|
|
7
|
+
sessionId: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function generateOAuthState(sessionId: string, provider: string): Promise<OAuthState>;
|
|
11
|
+
export declare function getOAuthState(sessionId: string, provider: string, state: string): OAuthState | null;
|
|
12
|
+
export declare function createConfiguration(provider: ConnectProvider): Promise<client.Configuration>;
|
|
13
|
+
export declare function buildAuthorizationUrl(provider: ConnectProvider, state: OAuthState): Promise<string>;
|
|
14
|
+
export declare function exchangeCodeForTokens(provider: ConnectProvider, code: string, codeVerifier: string, redirectUri: string, state: string): Promise<{
|
|
15
|
+
accessToken: string;
|
|
16
|
+
refreshToken?: string;
|
|
17
|
+
tokenType?: string;
|
|
18
|
+
expiresAt?: Date;
|
|
19
|
+
scope?: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function refreshAccessToken(provider: ConnectProvider, refreshToken: string): Promise<{
|
|
22
|
+
accessToken: string;
|
|
23
|
+
refreshToken?: string;
|
|
24
|
+
tokenType?: string;
|
|
25
|
+
expiresAt?: Date;
|
|
26
|
+
scope?: string;
|
|
27
|
+
}>;
|
|
28
|
+
//# sourceMappingURL=connect.oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.oauth.d.ts","sourceRoot":"","sources":["../../../../src/modules/connect/connect.oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAYD,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAsBjG;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,UAAU,GAAG,IAAI,CAWnB;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAuC/B;AAED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CA4HD;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,eAAe,EACzB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAYD"}
|