eggi-ai-db-schema-2 0.1.1

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.
Files changed (188) hide show
  1. package/CHANGELOG.md +750 -0
  2. package/README.md +660 -0
  3. package/dist/config/database.d.ts +28 -0
  4. package/dist/config/database.d.ts.map +1 -0
  5. package/dist/config/database.js +72 -0
  6. package/dist/config/database.js.map +1 -0
  7. package/dist/index.d.ts +28 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +199 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/lib/database-service.d.ts +714 -0
  12. package/dist/lib/database-service.d.ts.map +1 -0
  13. package/dist/lib/database-service.js +1394 -0
  14. package/dist/lib/database-service.js.map +1 -0
  15. package/dist/lib/db-types.d.ts +167 -0
  16. package/dist/lib/db-types.d.ts.map +1 -0
  17. package/dist/lib/db-types.js +28 -0
  18. package/dist/lib/db-types.js.map +1 -0
  19. package/dist/lib/db.d.ts +58 -0
  20. package/dist/lib/db.d.ts.map +1 -0
  21. package/dist/lib/db.js +292 -0
  22. package/dist/lib/db.js.map +1 -0
  23. package/dist/lib/index.d.ts +11 -0
  24. package/dist/lib/index.d.ts.map +1 -0
  25. package/dist/lib/index.js +26 -0
  26. package/dist/lib/index.js.map +1 -0
  27. package/dist/lib/pg-client.d.ts +50 -0
  28. package/dist/lib/pg-client.d.ts.map +1 -0
  29. package/dist/lib/pg-client.js +106 -0
  30. package/dist/lib/pg-client.js.map +1 -0
  31. package/dist/lib/schema.d.ts +298 -0
  32. package/dist/lib/schema.d.ts.map +1 -0
  33. package/dist/lib/schema.js +12 -0
  34. package/dist/lib/schema.js.map +1 -0
  35. package/dist/migration-manager.d.ts +49 -0
  36. package/dist/migration-manager.d.ts.map +1 -0
  37. package/dist/migration-manager.js +282 -0
  38. package/dist/migration-manager.js.map +1 -0
  39. package/dist/queries/minimal-connections.d.ts +31 -0
  40. package/dist/queries/minimal-connections.d.ts.map +1 -0
  41. package/dist/queries/minimal-connections.js +143 -0
  42. package/dist/queries/minimal-connections.js.map +1 -0
  43. package/dist/schema.ts +340 -0
  44. package/dist/seed.d.ts +8 -0
  45. package/dist/seed.d.ts.map +1 -0
  46. package/dist/seed.js +40 -0
  47. package/dist/seed.js.map +1 -0
  48. package/dist/types/index.d.ts +7 -0
  49. package/dist/types/index.d.ts.map +1 -0
  50. package/dist/types/index.js +23 -0
  51. package/dist/types/index.js.map +1 -0
  52. package/dist/types/types.d.ts +77 -0
  53. package/dist/types/types.d.ts.map +1 -0
  54. package/dist/types/types.js +3 -0
  55. package/dist/types/types.js.map +1 -0
  56. package/dist/utils/authenticated-user-operations.d.ts +110 -0
  57. package/dist/utils/authenticated-user-operations.d.ts.map +1 -0
  58. package/dist/utils/authenticated-user-operations.js +292 -0
  59. package/dist/utils/authenticated-user-operations.js.map +1 -0
  60. package/dist/utils/authentication-operations.d.ts +48 -0
  61. package/dist/utils/authentication-operations.d.ts.map +1 -0
  62. package/dist/utils/authentication-operations.js +172 -0
  63. package/dist/utils/authentication-operations.js.map +1 -0
  64. package/dist/utils/company-mapping-job-operations.d.ts +103 -0
  65. package/dist/utils/company-mapping-job-operations.d.ts.map +1 -0
  66. package/dist/utils/company-mapping-job-operations.js +413 -0
  67. package/dist/utils/company-mapping-job-operations.js.map +1 -0
  68. package/dist/utils/company-sheet-upload-operations.d.ts +53 -0
  69. package/dist/utils/company-sheet-upload-operations.d.ts.map +1 -0
  70. package/dist/utils/company-sheet-upload-operations.js +135 -0
  71. package/dist/utils/company-sheet-upload-operations.js.map +1 -0
  72. package/dist/utils/contact-operations.d.ts +70 -0
  73. package/dist/utils/contact-operations.d.ts.map +1 -0
  74. package/dist/utils/contact-operations.js +294 -0
  75. package/dist/utils/contact-operations.js.map +1 -0
  76. package/dist/utils/forager-linkedin-operations.d.ts +74 -0
  77. package/dist/utils/forager-linkedin-operations.d.ts.map +1 -0
  78. package/dist/utils/forager-linkedin-operations.js +778 -0
  79. package/dist/utils/forager-linkedin-operations.js.map +1 -0
  80. package/dist/utils/ghost-genius-linkedin-operations.d.ts +23 -0
  81. package/dist/utils/ghost-genius-linkedin-operations.d.ts.map +1 -0
  82. package/dist/utils/ghost-genius-linkedin-operations.js +282 -0
  83. package/dist/utils/ghost-genius-linkedin-operations.js.map +1 -0
  84. package/dist/utils/index.d.ts +29 -0
  85. package/dist/utils/index.d.ts.map +1 -0
  86. package/dist/utils/index.js +77 -0
  87. package/dist/utils/index.js.map +1 -0
  88. package/dist/utils/introduction-request-operations.d.ts +160 -0
  89. package/dist/utils/introduction-request-operations.d.ts.map +1 -0
  90. package/dist/utils/introduction-request-operations.js +492 -0
  91. package/dist/utils/introduction-request-operations.js.map +1 -0
  92. package/dist/utils/invitation-operations.d.ts +141 -0
  93. package/dist/utils/invitation-operations.d.ts.map +1 -0
  94. package/dist/utils/invitation-operations.js +749 -0
  95. package/dist/utils/invitation-operations.js.map +1 -0
  96. package/dist/utils/linkedin-account-operations.d.ts +45 -0
  97. package/dist/utils/linkedin-account-operations.d.ts.map +1 -0
  98. package/dist/utils/linkedin-account-operations.js +279 -0
  99. package/dist/utils/linkedin-account-operations.js.map +1 -0
  100. package/dist/utils/linkedin-account-relationship-operations.d.ts +77 -0
  101. package/dist/utils/linkedin-account-relationship-operations.d.ts.map +1 -0
  102. package/dist/utils/linkedin-account-relationship-operations.js +274 -0
  103. package/dist/utils/linkedin-account-relationship-operations.js.map +1 -0
  104. package/dist/utils/linkedin-data-operations.d.ts +102 -0
  105. package/dist/utils/linkedin-data-operations.d.ts.map +1 -0
  106. package/dist/utils/linkedin-data-operations.js +613 -0
  107. package/dist/utils/linkedin-data-operations.js.map +1 -0
  108. package/dist/utils/linkedin-identifier-utils.d.ts +31 -0
  109. package/dist/utils/linkedin-identifier-utils.d.ts.map +1 -0
  110. package/dist/utils/linkedin-identifier-utils.js +63 -0
  111. package/dist/utils/linkedin-identifier-utils.js.map +1 -0
  112. package/dist/utils/linkedin-profile-cache.d.ts +131 -0
  113. package/dist/utils/linkedin-profile-cache.d.ts.map +1 -0
  114. package/dist/utils/linkedin-profile-cache.js +418 -0
  115. package/dist/utils/linkedin-profile-cache.js.map +1 -0
  116. package/dist/utils/llm-inference-job-operations.d.ts +116 -0
  117. package/dist/utils/llm-inference-job-operations.d.ts.map +1 -0
  118. package/dist/utils/llm-inference-job-operations.js +267 -0
  119. package/dist/utils/llm-inference-job-operations.js.map +1 -0
  120. package/dist/utils/mapping-job-operations.d.ts +272 -0
  121. package/dist/utils/mapping-job-operations.d.ts.map +1 -0
  122. package/dist/utils/mapping-job-operations.js +833 -0
  123. package/dist/utils/mapping-job-operations.js.map +1 -0
  124. package/dist/utils/mapping-operations.d.ts +80 -0
  125. package/dist/utils/mapping-operations.d.ts.map +1 -0
  126. package/dist/utils/mapping-operations.js +318 -0
  127. package/dist/utils/mapping-operations.js.map +1 -0
  128. package/dist/utils/on-demand-mapping-operations.d.ts +199 -0
  129. package/dist/utils/on-demand-mapping-operations.d.ts.map +1 -0
  130. package/dist/utils/on-demand-mapping-operations.js +728 -0
  131. package/dist/utils/on-demand-mapping-operations.js.map +1 -0
  132. package/dist/utils/onboarding-operations.d.ts +53 -0
  133. package/dist/utils/onboarding-operations.d.ts.map +1 -0
  134. package/dist/utils/onboarding-operations.js +223 -0
  135. package/dist/utils/onboarding-operations.js.map +1 -0
  136. package/dist/utils/organization-assignment-job-operations.d.ts +258 -0
  137. package/dist/utils/organization-assignment-job-operations.d.ts.map +1 -0
  138. package/dist/utils/organization-assignment-job-operations.js +881 -0
  139. package/dist/utils/organization-assignment-job-operations.js.map +1 -0
  140. package/dist/utils/organization-assignment-operations.d.ts +59 -0
  141. package/dist/utils/organization-assignment-operations.d.ts.map +1 -0
  142. package/dist/utils/organization-assignment-operations.js +130 -0
  143. package/dist/utils/organization-assignment-operations.js.map +1 -0
  144. package/dist/utils/organization-operations.d.ts +284 -0
  145. package/dist/utils/organization-operations.d.ts.map +1 -0
  146. package/dist/utils/organization-operations.js +1030 -0
  147. package/dist/utils/organization-operations.js.map +1 -0
  148. package/dist/utils/organization-relationship-operations.d.ts +79 -0
  149. package/dist/utils/organization-relationship-operations.d.ts.map +1 -0
  150. package/dist/utils/organization-relationship-operations.js +294 -0
  151. package/dist/utils/organization-relationship-operations.js.map +1 -0
  152. package/dist/utils/quota-operations.d.ts +107 -0
  153. package/dist/utils/quota-operations.d.ts.map +1 -0
  154. package/dist/utils/quota-operations.js +692 -0
  155. package/dist/utils/quota-operations.js.map +1 -0
  156. package/dist/utils/recursive-mapping-job-operations.d.ts +42 -0
  157. package/dist/utils/recursive-mapping-job-operations.d.ts.map +1 -0
  158. package/dist/utils/recursive-mapping-job-operations.js +169 -0
  159. package/dist/utils/recursive-mapping-job-operations.js.map +1 -0
  160. package/dist/utils/relationship-operations.d.ts +130 -0
  161. package/dist/utils/relationship-operations.d.ts.map +1 -0
  162. package/dist/utils/relationship-operations.js +329 -0
  163. package/dist/utils/relationship-operations.js.map +1 -0
  164. package/dist/utils/sales-pipeline-operations.d.ts +163 -0
  165. package/dist/utils/sales-pipeline-operations.d.ts.map +1 -0
  166. package/dist/utils/sales-pipeline-operations.js +725 -0
  167. package/dist/utils/sales-pipeline-operations.js.map +1 -0
  168. package/dist/utils/skills-operations.d.ts +117 -0
  169. package/dist/utils/skills-operations.d.ts.map +1 -0
  170. package/dist/utils/skills-operations.js +487 -0
  171. package/dist/utils/skills-operations.js.map +1 -0
  172. package/dist/utils/subscription-operations.d.ts +123 -0
  173. package/dist/utils/subscription-operations.d.ts.map +1 -0
  174. package/dist/utils/subscription-operations.js +391 -0
  175. package/dist/utils/subscription-operations.js.map +1 -0
  176. package/dist/utils/unipile-account-operations.d.ts +96 -0
  177. package/dist/utils/unipile-account-operations.d.ts.map +1 -0
  178. package/dist/utils/unipile-account-operations.js +255 -0
  179. package/dist/utils/unipile-account-operations.js.map +1 -0
  180. package/dist/utils/user-industry-operations.d.ts +80 -0
  181. package/dist/utils/user-industry-operations.d.ts.map +1 -0
  182. package/dist/utils/user-industry-operations.js +237 -0
  183. package/dist/utils/user-industry-operations.js.map +1 -0
  184. package/dist/utils/user-operations.d.ts +87 -0
  185. package/dist/utils/user-operations.d.ts.map +1 -0
  186. package/dist/utils/user-operations.js +212 -0
  187. package/dist/utils/user-operations.js.map +1 -0
  188. package/package.json +98 -0
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * Database Configuration
4
+ *
5
+ * Centralized database connection configuration for different environments
6
+ * Uses AWS Secrets Manager for both dev and prod environments
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.getDatabaseCredentials = getDatabaseCredentials;
10
+ exports.getConnectionString = getConnectionString;
11
+ exports.getDatabaseConfig = getDatabaseConfig;
12
+ const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
13
+ // Load environment variables
14
+ require("dotenv").config();
15
+ // AWS Secrets Manager client
16
+ const secretsClient = new client_secrets_manager_1.SecretsManagerClient({
17
+ region: process.env.AWS_REGION || "eu-west-3",
18
+ });
19
+ // Secret ARNs from environment variables
20
+ const SECRET_ARNS = {
21
+ dev: process.env.DEV_DB_SECRET_ARN || "eggi-dev-db-admin-direct-main",
22
+ prod: process.env.PROD_DB_SECRET_ARN || "eggi-db-admin-direct-main",
23
+ };
24
+ /**
25
+ * Get database credentials from AWS Secrets Manager
26
+ */
27
+ async function getDatabaseCredentials(env) {
28
+ const secretName = SECRET_ARNS[env];
29
+ try {
30
+ const command = new client_secrets_manager_1.GetSecretValueCommand({ SecretId: secretName });
31
+ const response = await secretsClient.send(command);
32
+ if (!response.SecretString) {
33
+ throw new Error(`No secret value found for ${secretName}`);
34
+ }
35
+ const secret = JSON.parse(response.SecretString);
36
+ // Extract host and port from the host string (format: "host:port")
37
+ const [host, portStr] = secret.host.split(":");
38
+ const port = portStr ? parseInt(portStr) : secret.port;
39
+ if (!host) {
40
+ throw new Error(`Invalid host format in secret: ${secret.host}`);
41
+ }
42
+ return {
43
+ host,
44
+ port,
45
+ database: secret.dbname,
46
+ username: secret.username,
47
+ password: secret.password,
48
+ ssl: true,
49
+ };
50
+ }
51
+ catch (error) {
52
+ console.error(`Failed to get database credentials for ${env}:`, error);
53
+ throw error;
54
+ }
55
+ }
56
+ /**
57
+ * Get database connection string for environment
58
+ */
59
+ async function getConnectionString(env = "dev") {
60
+ const config = await getDatabaseCredentials(env);
61
+ const { host, port, database, username, password, ssl = false } = config;
62
+ // URL encode the password to handle special characters
63
+ const encodedPassword = encodeURIComponent(password);
64
+ return `postgresql://${username}:${encodedPassword}@${host}:${port}/${database}${ssl ? "?sslmode=require" : ""}`;
65
+ }
66
+ /**
67
+ * Get database config for environment
68
+ */
69
+ async function getDatabaseConfig(env = "dev") {
70
+ return await getDatabaseCredentials(env);
71
+ }
72
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/config/database.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAyEM,wDAAsB;AAK/B,kDAQC;AAKD,8CAEC;AA3FD,4EAA8F;AAmB9F,6BAA6B;AAC7B,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAE3B,6BAA6B;AAC7B,MAAM,aAAa,GAAG,IAAI,6CAAoB,CAAC;IAC7C,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,WAAW;CAC9C,CAAC,CAAC;AAEH,yCAAyC;AACzC,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,+BAA+B;IACrE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,2BAA2B;CACpE,CAAC;AAEF;;GAEG;AACH,KAAK,UAAU,sBAAsB,CAAC,GAAmB;IACvD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;IAEpC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,8CAAqB,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;QACpE,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEnD,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,6BAA6B,UAAU,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,MAAM,GAAgB,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;QAE9D,mEAAmE;QACnE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAEvD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,kCAAkC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,OAAO;YACL,IAAI;YACJ,IAAI;YACJ,QAAQ,EAAE,MAAM,CAAC,MAAM;YACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,GAAG,EAAE,IAAI;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0CAA0C,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;QACvE,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAID;;GAEG;AACI,KAAK,UAAU,mBAAmB,CAAC,MAAsB,KAAK;IACnE,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC,GAAG,CAAC,CAAC;IACjD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;IAEzE,uDAAuD;IACvD,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAErD,OAAO,gBAAgB,QAAQ,IAAI,eAAe,IAAI,IAAI,IAAI,IAAI,IAAI,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACnH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,iBAAiB,CAAC,MAAsB,KAAK;IACjE,OAAO,MAAM,sBAAsB,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * =============================================================================
3
+ * EGGI.AI DATABASE SCHEMA - NATIVE POSTGRESQL
4
+ * =============================================================================
5
+ * Fully-typed database schema and client for Eggi.AI authentication & LinkedIn accounts
6
+ *
7
+ * This package provides:
8
+ * - Type-safe database schema definitions (TypeScript interfaces)
9
+ * - Native PostgreSQL client with connection pooling
10
+ * - Object-oriented DatabaseService with singleton pattern
11
+ * - Custom migration system with hash validation
12
+ */
13
+ export * from "./lib";
14
+ export * from "./types";
15
+ export * from "./utils/forager-linkedin-operations";
16
+ export * from "./utils/ghost-genius-linkedin-operations";
17
+ export * from "./utils/authentication-operations";
18
+ export * from "./utils/user-operations";
19
+ export * from "./utils/contact-operations";
20
+ export * from "./utils/skills-operations";
21
+ export * from "./utils/authenticated-user-operations";
22
+ export * from "./utils/linkedin-identifier-utils";
23
+ export * from "./queries/minimal-connections";
24
+ export * from "./utils/on-demand-mapping-operations";
25
+ export * from "./utils/subscription-operations";
26
+ export * from "./utils/organization-assignment-operations";
27
+ export { storeCompleteLinkedInProfileByForagerId, storeCompleteLinkedInProfileByAcoa, refreshCompleteLinkedInProfileByForagerId, getCompleteLinkedInProfile, type LinkedInProfileData, } from "./utils/linkedin-data-operations";
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AAExB,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4CAA4C,CAAC;AAG3D,OAAO,EACL,uCAAuC,EACvC,kCAAkC,EAClC,yCAAyC,EACzC,0BAA0B,EAC1B,KAAK,mBAAmB,GACzB,MAAM,kCAAkC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ /**
3
+ * =============================================================================
4
+ * EGGI.AI DATABASE SCHEMA - NATIVE POSTGRESQL
5
+ * =============================================================================
6
+ * Fully-typed database schema and client for Eggi.AI authentication & LinkedIn accounts
7
+ *
8
+ * This package provides:
9
+ * - Type-safe database schema definitions (TypeScript interfaces)
10
+ * - Native PostgreSQL client with connection pooling
11
+ * - Object-oriented DatabaseService with singleton pattern
12
+ * - Custom migration system with hash validation
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.getCompleteLinkedInProfile = exports.refreshCompleteLinkedInProfileByForagerId = exports.storeCompleteLinkedInProfileByAcoa = exports.storeCompleteLinkedInProfileByForagerId = void 0;
30
+ // =============================================================================
31
+ // CORE EXPORTS
32
+ // =============================================================================
33
+ __exportStar(require("./lib"), exports);
34
+ __exportStar(require("./types"), exports);
35
+ // Export utils but exclude conflicting names to avoid duplicate exports
36
+ __exportStar(require("./utils/forager-linkedin-operations"), exports);
37
+ __exportStar(require("./utils/ghost-genius-linkedin-operations"), exports);
38
+ __exportStar(require("./utils/authentication-operations"), exports);
39
+ __exportStar(require("./utils/user-operations"), exports);
40
+ __exportStar(require("./utils/contact-operations"), exports);
41
+ __exportStar(require("./utils/skills-operations"), exports);
42
+ __exportStar(require("./utils/authenticated-user-operations"), exports);
43
+ __exportStar(require("./utils/linkedin-identifier-utils"), exports);
44
+ __exportStar(require("./queries/minimal-connections"), exports);
45
+ __exportStar(require("./utils/on-demand-mapping-operations"), exports);
46
+ __exportStar(require("./utils/subscription-operations"), exports);
47
+ __exportStar(require("./utils/organization-assignment-operations"), exports);
48
+ // LinkedIn data operations - export separately to handle CompleteLinkedInProfileResult conflict
49
+ var linkedin_data_operations_1 = require("./utils/linkedin-data-operations");
50
+ Object.defineProperty(exports, "storeCompleteLinkedInProfileByForagerId", { enumerable: true, get: function () { return linkedin_data_operations_1.storeCompleteLinkedInProfileByForagerId; } });
51
+ Object.defineProperty(exports, "storeCompleteLinkedInProfileByAcoa", { enumerable: true, get: function () { return linkedin_data_operations_1.storeCompleteLinkedInProfileByAcoa; } });
52
+ Object.defineProperty(exports, "refreshCompleteLinkedInProfileByForagerId", { enumerable: true, get: function () { return linkedin_data_operations_1.refreshCompleteLinkedInProfileByForagerId; } });
53
+ Object.defineProperty(exports, "getCompleteLinkedInProfile", { enumerable: true, get: function () { return linkedin_data_operations_1.getCompleteLinkedInProfile; } });
54
+ // =============================================================================
55
+ // LEGACY EXPORTS - REMOVED
56
+ // =============================================================================
57
+ // Drizzle ORM exports have been removed in favor of native PostgreSQL queries
58
+ // =============================================================================
59
+ // USAGE EXAMPLE
60
+ // =============================================================================
61
+ /*
62
+ import {
63
+ dbService,
64
+ initializeDb,
65
+ getDb,
66
+ ConnectionPoolConfig,
67
+ DbConfig,
68
+ authenticatedUsers,
69
+ unipileAccounts,
70
+ eq,
71
+ findUserByCognitoId,
72
+ getExistingUnipileAccount
73
+ } from "eggi-ai-db-schema-2";
74
+
75
+ // NEW RECOMMENDED APPROACH: Object-Oriented Database Service
76
+ // Auto-initializes on first use - no manual setup required!
77
+
78
+ // Direct usage - auto-initializes with smart defaults
79
+ const mappingJob = await dbService.createMappingJobWithSingleLinkedInAccount({
80
+ linkedinAccountId: 123,
81
+ jobMetadata: { source: "lambda" }
82
+ });
83
+
84
+ await dbService.setMappingJobId("job-key-123", mappingJob.mappingJob.id);
85
+
86
+ const userProfile = await dbService.getComprehensiveLinkedinProfile("ACoA-identifier");
87
+
88
+ // Manual initialization (optional) - for custom configuration
89
+ await dbService.initialize({
90
+ poolConfig: {
91
+ max: 10,
92
+ idle_timeout: 60,
93
+ connect_timeout: 30
94
+ }
95
+ });
96
+
97
+ // Check if service is ready
98
+ if (dbService.isReady()) {
99
+ console.log("Database service initialized");
100
+ }
101
+
102
+ // LEGACY APPROACH: Still supported for backward compatibility
103
+ await initializeDb();
104
+ const db = await getDb();
105
+
106
+ // Use environment variables for fine-tuning
107
+ // Set: DB_MAX_CONNECTIONS=15, DB_IDLE_TIMEOUT=180
108
+ await initializeDb(); // Will use env vars + smart defaults
109
+
110
+ // Type-safe queries
111
+ const users = await db.select().from(authenticatedUsers);
112
+ // Type: AuthenticatedUser[]
113
+
114
+ const user = await db.query.authenticatedUsers.findFirst({
115
+ where: eq(authenticatedUsers.cognitoUserId, "cognito-123"),
116
+ with: {
117
+ contactInfo: true // Email is stored in contact_infos table
118
+ }
119
+ });
120
+ // Type: (AuthenticatedUser & { contactInfo: ContactInfo }) | undefined
121
+
122
+ // Type-safe inserts (contactInfoId must reference existing contact_infos entry)
123
+ const newUser = await db.insert(authenticatedUsers).values({
124
+ cognitoUserId: "cognito-123",
125
+ userId: 123,
126
+ contactInfoId: 456, // References contact_infos table
127
+ authProvider: "cognito"
128
+ }).returning();
129
+ // Type: AuthenticatedUser[]
130
+
131
+ // User operations utilities (perfect for Lambda functions)
132
+ const existingUser = await findUserByCognitoId("cognito-123");
133
+ // Type: AuthenticatedUser | null
134
+
135
+ // Account worker operations (DEPRECATED - use Forager-based operations instead)
136
+ // const linkedAccount = await upsertLinkedAccount("cognito-123", {
137
+ // unipileAccountId: "unipile-456",
138
+ // providerType: "linkedin",
139
+ // email: "user@example.com",
140
+ // linkedAt: new Date().toISOString()
141
+ // });
142
+ // Type: UnipileAccount
143
+
144
+ // Conversation operations
145
+ const conversation = await createConversation({
146
+ chatId: "chat-789",
147
+ participantUserIds: [1, 2, 3],
148
+ metadata: { platform: "linkedin", type: "group" }
149
+ });
150
+ // Type: ConversationWithParticipants
151
+
152
+ const messages = await batchCreateMessages({
153
+ conversationId: conversation.id,
154
+ messages: [
155
+ {
156
+ authorUserId: 1,
157
+ messageId: "msg-1",
158
+ sentAt: new Date(),
159
+ body: "Hello everyone!"
160
+ }
161
+ ]
162
+ });
163
+ // Type: Message[]
164
+
165
+ // Relationship scoring
166
+ const relationshipScore = await upsertRelationshipScore({
167
+ userIdA: 1,
168
+ userIdB: 2,
169
+ score: 85,
170
+ modelVersion: "v1.0.0"
171
+ });
172
+ // Type: RelationshipScore
173
+
174
+ const userRelationships = await getUserRelationships(1, "v1.0.0", 70);
175
+ // Type: UserRelationshipSummary
176
+
177
+ // Contact operations
178
+ const contactInfo = await upsertContactInfo({
179
+ userId: 1,
180
+ type: "EMAIL",
181
+ value: "user@example.com",
182
+ metadata: { verified: true }
183
+ });
184
+ // Type: ContactInfo
185
+
186
+ // Unipile account operations
187
+ const unipileAccount = await upsertUnipileAccount({
188
+ userId: 1,
189
+ unipileAccountId: "unipile-456",
190
+ platformType: "linkedin",
191
+
192
+ });
193
+ // Type: UnipileAccount
194
+
195
+ const accountsNeedingSync = await getAccountsNeedingSync("linkedin", 24, 10);
196
+ // Type: UnipileAccountWithUser[]
197
+ */
198
+ // Updated for v2.5.17 - Enhanced package stability
199
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;AAEH,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAChF,wCAAsB;AACtB,0CAAwB;AACxB,wEAAwE;AACxE,sEAAoD;AACpD,2EAAyD;AACzD,oEAAkD;AAClD,0DAAwC;AACxC,6DAA2C;AAC3C,4DAA0C;AAC1C,wEAAsD;AACtD,oEAAkD;AAClD,gEAA8C;AAC9C,uEAAqD;AACrD,kEAAgD;AAChD,6EAA2D;AAE3D,gGAAgG;AAChG,6EAM0C;AALxC,mJAAA,uCAAuC,OAAA;AACvC,8IAAA,kCAAkC,OAAA;AAClC,qJAAA,yCAAyC,OAAA;AACzC,sIAAA,0BAA0B,OAAA;AAI5B,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAChF,8EAA8E;AAE9E,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwIE;AACF,mDAAmD"}